diff --git a/package-lock.json b/package-lock.json index 4ea397fdef..e0823a572f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@dropins/storefront-account": "0.1.0-alpha20", "@dropins/storefront-auth": "0.0.1-alpha25", "@dropins/storefront-cart": "0.10.0", - "@dropins/storefront-checkout": "0.1.0-alpha60", + "@dropins/storefront-checkout": "0.1.0-alpha61", "@dropins/storefront-order": "0.1.0-alpha24", "@dropins/storefront-pdp": "1.0.0-beta3", "@dropins/tools": "^0.36.0" @@ -774,9 +774,9 @@ "version": "0.10.0" }, "node_modules/@dropins/storefront-checkout": { - "version": "0.1.0-alpha60", - "resolved": "https://registry.npmjs.org/@dropins/storefront-checkout/-/storefront-checkout-0.1.0-alpha60.tgz", - "integrity": "sha512-umnLEVmn0NnEMuwFyfF2RRhXwQzV/ldW6tvwRrjTkjYr1F+3+DlcsJHSNOUqMbigmE9xrqf425e3p2wRgW2i4w==" + "version": "0.1.0-alpha61", + "resolved": "https://registry.npmjs.org/@dropins/storefront-checkout/-/storefront-checkout-0.1.0-alpha61.tgz", + "integrity": "sha512-w/6Me6NL1ImA8E3jSzazRihI6kLazVcOWTyXVycr0AgYz8Q2pBSCt9KlMzWZnFT9VsRuIn+wwMd8AsbQqQpetg==" }, "node_modules/@dropins/storefront-order": { "version": "0.1.0-alpha24" diff --git a/package.json b/package.json index f7fdf9be47..713f51b780 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@dropins/storefront-account": "0.1.0-alpha20", "@dropins/storefront-auth": "0.0.1-alpha25", "@dropins/storefront-cart": "0.10.0", - "@dropins/storefront-checkout": "0.1.0-alpha60", + "@dropins/storefront-checkout": "0.1.0-alpha61", "@dropins/storefront-order": "0.1.0-alpha24", "@dropins/storefront-pdp": "1.0.0-beta3", "@dropins/tools": "^0.36.0" diff --git a/scripts/__dropins__/storefront-checkout/api/graphql/CartAddressFragment.graphql.d.ts b/scripts/__dropins__/storefront-checkout/api/graphql/CartAddressFragment.graphql.d.ts index cc29b8a5a8..8915d46c20 100644 --- a/scripts/__dropins__/storefront-checkout/api/graphql/CartAddressFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-checkout/api/graphql/CartAddressFragment.graphql.d.ts @@ -14,6 +14,6 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export declare const BILLING_CART_ADDRESS_FRAGMENT = "\n fragment BILLING_CART_ADDRESS_FRAGMENT on BillingCartAddress {\n id\n city\n country {\n code\n label\n }\n firstname\n lastname\n company\n postcode\n vat_id\n region {\n region_id\n code\n label\n }\n street\n telephone\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n }\n }\n"; -export declare const SHIPPING_CART_ADDRESS_FRAGMENT = "\n fragment SHIPPING_CART_ADDRESS_FRAGMENT on ShippingCartAddress {\n id\n firstname\n lastname\n company\n street\n city\n postcode\n vat_id\n region {\n region_id\n code\n label\n }\n country {\n code\n label\n }\n telephone\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n }\n available_shipping_methods {\n amount {\n currency\n value\n }\n available\n carrier_code\n carrier_title\n error_message\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n selected_shipping_method {\n amount {\n value\n currency\n }\n carrier_code\n carrier_title\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n same_as_billing\n }\n"; +export declare const BILLING_CART_ADDRESS_FRAGMENT = "\n fragment BILLING_CART_ADDRESS_FRAGMENT on BillingCartAddress {\n id\n city\n country {\n code\n label\n }\n firstname\n lastname\n company\n postcode\n vat_id\n region {\n region_id\n code\n label\n }\n street\n telephone\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n }\n prefix\n suffix\n middlename\n fax\n }\n"; +export declare const SHIPPING_CART_ADDRESS_FRAGMENT = "\n fragment SHIPPING_CART_ADDRESS_FRAGMENT on ShippingCartAddress {\n id\n firstname\n lastname\n company\n street\n city\n postcode\n vat_id\n region {\n region_id\n code\n label\n }\n country {\n code\n label\n }\n telephone\n custom_attributes {\n ... on AttributeValue {\n code\n value\n }\n }\n available_shipping_methods {\n amount {\n currency\n value\n }\n available\n carrier_code\n carrier_title\n error_message\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n selected_shipping_method {\n amount {\n value\n currency\n }\n carrier_code\n carrier_title\n method_code\n method_title\n price_excl_tax {\n value\n currency\n }\n price_incl_tax {\n value\n currency\n }\n }\n same_as_billing\n prefix\n suffix\n middlename\n fax\n }\n"; //# sourceMappingURL=CartAddressFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/api/graphql/OrderFragment.graphql.d.ts b/scripts/__dropins__/storefront-checkout/api/graphql/OrderFragment.graphql.d.ts index b40b208fa9..d207dd7594 100644 --- a/scripts/__dropins__/storefront-checkout/api/graphql/OrderFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-checkout/api/graphql/OrderFragment.graphql.d.ts @@ -14,6 +14,6 @@ * is strictly forbidden unless prior written permission is obtained * from Adobe. *******************************************************************/ -export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n"; +export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal {\n currency\n value\n }\n taxes {\n title\n amount {\n currency\n value\n }\n rate\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n"; export declare const ORDER_FRAGMENT: string; //# sourceMappingURL=OrderFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js b/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js index 127a765e74..0359575e51 100644 --- a/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js +++ b/scripts/__dropins__/storefront-checkout/chunks/synchronizeCheckout.js @@ -1,13 +1,13 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{s as i,M as C,d as l,l as A}from"./fetch-graphql.js";import{d as b,a as M,c}from"./store-config.js";import"./ServerErrorSignal.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as a,Initializer as T}from"@dropins/tools/lib.js";import{CHECKOUT_DATA_FRAGMENT as u,CUSTOMER_FRAGMENT as S}from"../fragments.js";const I=async(e=!1)=>{i.authenticated=e,e?await K():b.value={pending:!1,data:null}},x=e=>e==null,E=(e,t)=>e.amount.value-t.amount.value,m=e=>!(!e||!e.method_code||!e.method_title||x(e.amount.value)||!e.amount.currency),f=e=>({amount:{value:e.amount.value,currency:e.amount.currency},title:e.method_title,code:e.method_code,carrier:{code:e.carrier_code,title:e.carrier_title},value:`${e.carrier_code} - ${e.method_code}`,...e.price_excl_tax&&{amountExclTax:{value:e.price_excl_tax.value,currency:e.price_excl_tax.currency}},...e.price_incl_tax&&{amountInclTax:{value:e.price_incl_tax.value,currency:e.price_incl_tax.currency}}}),N=e=>{if(m(e))return f(e)},k=e=>{if(e)return e.filter(m).map(t=>f(t)).sort(E)},w=e=>e?!!e.code&&!!e.label:!1,z=e=>{if(!w(e))return;const{code:t,label:r,region_id:n}=e;return n?{code:t,name:r,id:n}:{code:t,name:r}},R=e=>{const{code:t,label:r}=e;return{value:t,label:r}},q=e=>e?"code"in e&&"value"in e:!1,G=e=>e.filter(q).map(t=>{const{code:r,value:n}=t;return{code:r,value:n}}),d=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:R(e.country),customAttributes:G(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:z(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0}},O=e=>{if(e)return d(e)},P=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:r,selected_shipping_method:n,same_as_billing:o,...v}=t;return{...d(v),availableShippingMethods:k(r),selectedShippingMethod:N(n),sameAsBilling:o}}),ee=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId}),$=e=>{if(e)return{code:e.code,title:e.title}},B=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:r,title:n}=t;return{code:r,title:n}})},D=e=>{var r,n,o;if(!e)return;const t={availablePaymentMethods:B(e.available_payment_methods),billingAddress:O(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:$(e.selected_payment_method),shippingAddresses:P(e.shipping_addresses),isGuest:!i.authenticated};return a(t,(o=(n=(r=_.getConfig().models)==null?void 0:r.CartModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},F=e=>{var r,n,o;if(!e)return;const t={firstName:e.firstname||"",lastName:e.lastname||"",email:e.email||""};return a(t,(o=(n=(r=_.getConfig().models)==null?void 0:r.CustomerModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},U=` +import{s as i,M as C,d as l,l as A}from"./fetch-graphql.js";import{d as x,a as b,c}from"./store-config.js";import"./ServerErrorSignal.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as u,Initializer as M}from"@dropins/tools/lib.js";import{CHECKOUT_DATA_FRAGMENT as a,CUSTOMER_FRAGMENT as T}from"../fragments.js";const S=async(e=!1)=>{i.authenticated=e,e?await K():x.value={pending:!1,data:null}},I=e=>e==null,N=(e,t)=>e.amount.value-t.amount.value,m=e=>!(!e||!e.method_code||!e.method_title||I(e.amount.value)||!e.amount.currency),f=e=>({amount:{value:e.amount.value,currency:e.amount.currency},title:e.method_title,code:e.method_code,carrier:{code:e.carrier_code,title:e.carrier_title},value:`${e.carrier_code} - ${e.method_code}`,...e.price_excl_tax&&{amountExclTax:{value:e.price_excl_tax.value,currency:e.price_excl_tax.currency}},...e.price_incl_tax&&{amountInclTax:{value:e.price_incl_tax.value,currency:e.price_incl_tax.currency}}}),E=e=>{if(m(e))return f(e)},k=e=>{if(e)return e.filter(m).map(t=>f(t)).sort(N)},w=e=>e?!!e.code&&!!e.label:!1,z=e=>{if(!w(e))return;const{code:t,label:r,region_id:n}=e;return n?{code:t,name:r,id:n}:{code:t,name:r}},R=e=>{const{code:t,label:r}=e;return{value:t,label:r}},q=e=>e?"code"in e&&"value"in e:!1,G=e=>e.filter(q).map(t=>{const{code:r,value:n}=t;return{code:r,value:n}}),p=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:R(e.country),customAttributes:G(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:z(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0,prefix:e.prefix||void 0,suffix:e.suffix||void 0,middleName:e.middlename||void 0,fax:e.fax||void 0}},O=e=>{if(e)return p(e)},P=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:r,selected_shipping_method:n,same_as_billing:o,...v}=t;return{...p(v),availableShippingMethods:k(r),selectedShippingMethod:E(n),sameAsBilling:o}}),ee=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId,prefix:e.prefix,suffix:e.suffix,middlename:e.middleName,fax:e.fax}),$=e=>{if(e)return{code:e.code,title:e.title}},B=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:r,title:n}=t;return{code:r,title:n}})},D=e=>{var r,n,o;if(!e)return;const t={availablePaymentMethods:B(e.available_payment_methods),billingAddress:O(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:$(e.selected_payment_method),shippingAddresses:P(e.shipping_addresses),isGuest:!i.authenticated};return u(t,(o=(n=(r=_.getConfig().models)==null?void 0:r.CartModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},F=e=>{var r,n,o;if(!e)return;const t={firstName:e.firstname||"",lastName:e.lastname||"",email:e.email||""};return u(t,(o=(n=(r=_.getConfig().models)==null?void 0:r.CustomerModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},U=` query getCart($cartId: String!) { cart(cart_id: $cartId) { ...CHECKOUT_DATA_FRAGMENT } } - ${u} + ${a} `,V=` query getCustomerCart { cart: customerCart { @@ -15,13 +15,13 @@ import{s as i,M as C,d as l,l as A}from"./fetch-graphql.js";import{d as b,a as M } } - ${u} -`,p=async()=>{const e=i.cartId,t=i.authenticated===!1,r=t?U:V,n=t?{cartId:e}:{};if(t&&!e)throw new C;return await l({type:"query",query:r,options:{method:"POST",cache:"no-cache",variables:n},path:"cart",signalType:"cart",transformer:D})},H=` + ${a} +`,d=async()=>{const e=i.cartId,t=i.authenticated===!1,r=t?U:V,n=t?{cartId:e}:{};if(t&&!e)throw new C;return await l({type:"query",query:r,options:{method:"POST",cache:"no-cache",variables:n},path:"cart",signalType:"cart",transformer:D})},H=` query getCustomer { customer { ...CUSTOMER_FRAGMENT } } - ${S} -`,K=async()=>{if(i.authenticated)return await l({type:"query",query:H,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:F})},Q=()=>[s.on("authenticated",I,{eager:!0}),s.on("cart/initialized",h,{eager:!0}),s.on("cart/reset",L),s.on("cart/updated",y)],g=new T({init:async e=>{const t=e||{};g.config.setConfig(t),M.value.data||await A()},listeners:Q}),_=g.config,h=async e=>{if(i.initialized)return y(e);const t=e?e.id:null;i.cartId=t;const r=t?await p():null;c.value={pending:!1,data:r},i.initialized=!0,s.emit("checkout/initialized",r||null)},L=()=>{i.cartId=null,c.value={pending:!1,data:null},s.emit("checkout/updated",null)},y=async e=>{if(!i.initialized)return h(e);const t=e?e.id:null;i.cartId=t;const r=t?await p():null;c.value={pending:!1,data:r},s.emit("checkout/updated",r||null)};export{ee as a,D as b,_ as c,I as d,K as e,h as f,p as g,g as i,L as r,y as s,k as t}; + ${T} +`,K=async()=>{if(i.authenticated)return await l({type:"query",query:H,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:F})},Q=()=>[s.on("authenticated",S,{eager:!0}),s.on("cart/initialized",h,{eager:!0}),s.on("cart/reset",L),s.on("cart/updated",y)],g=new M({init:async e=>{const t=e||{};g.config.setConfig(t),b.value.data||await A()},listeners:Q}),_=g.config,h=async e=>{if(i.initialized)return y(e);const t=e?e.id:null;i.cartId=t;const r=t?await d():null;c.value={pending:!1,data:r},i.initialized=!0,s.emit("checkout/initialized",r||null)},L=()=>{i.cartId=null,c.value={pending:!1,data:null},s.emit("checkout/updated",null)},y=async e=>{if(!i.initialized)return h(e);const t=e?e.id:null;i.cartId=t;const r=t?await d():null;c.value={pending:!1,data:r},s.emit("checkout/updated",r||null)};export{ee as a,D as b,_ as c,S as d,K as e,h as f,d as g,g as i,L as r,y as s,k as t}; diff --git a/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js b/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js index 84e921117e..382cb09e48 100644 --- a/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js +++ b/scripts/__dropins__/storefront-checkout/containers/OrderConfirmationHeader.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as t,jsxs as s}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as A,Header as E,Button as y,Skeleton as N,SkeletonRow as r}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";/* empty css *//* empty css *//* empty css */import*as o from"@dropins/tools/preact-compat.js";import{useState as C,useEffect as b}from"@dropins/tools/preact-compat.js";import{useText as z,Text as v}from"@dropins/tools/i18n.js";import{s as f}from"../chunks/fetch-graphql.js";import"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{i as H}from"../chunks/isEmailAvailable.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";function p(e){var c;return{region:{region_id:e!=null&&e.regionId?Number(e==null?void 0:e.regionId):null,region:e==null?void 0:e.region},city:e==null?void 0:e.city,company:e==null?void 0:e.company,country_code:e==null?void 0:e.country,firstname:e==null?void 0:e.firstName,lastname:e==null?void 0:e.lastName,middlename:e==null?void 0:e.middleName,postcode:e==null?void 0:e.postCode,street:e==null?void 0:e.street,telephone:e==null?void 0:e.telephone,custom_attributesV2:((c=e==null?void 0:e.customAttributes)==null?void 0:c.map(l=>({attribute_code:l.code,value:l.value})))||[]}}const V=e=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},o.createElement("g",{clipPath:"url(#clip0_4797_15077)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15077"},o.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"})))),d=({customerName:e,isLoading:c,orderNumber:l,onSignUpClick:a})=>{const i=z({title:t(v,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:e}}),defaultTitle:"Checkout.OrderConfirmationHeader.defaultTitle",order:t(v,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:l}}),createAccountMessage:"Checkout.OrderConfirmationHeader.CreateAccount.message",createAccountButton:"Checkout.OrderConfirmationHeader.CreateAccount.button"});return c?t(w,{}):s("div",{className:"order-confirmation-header order-confirmation__card",children:[t(A,{source:V,size:"64",className:"order-confirmation-header__icon"}),t(E,{className:"order-confirmation-header__title",title:i.title,size:"large",divider:!1,children:e?i.title:i.defaultTitle}),l&&t("p",{className:"order-confirmation-header__order",children:i.order}),a&&s("div",{className:"order-confirmation-create-account",children:[t("p",{className:"order-confirmation-create-account__message",children:i.createAccountMessage}),t(y,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:a,children:i.createAccountButton})]})]})},w=()=>s(N,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[t(r,{variant:"empty",size:"xlarge",fullWidth:!0}),t(r,{variant:"empty",size:"medium"}),t(r,{variant:"empty",size:"medium"}),t(r,{variant:"empty",size:"medium"}),t(r,{variant:"empty",size:"medium"}),t(r,{variant:"empty",size:"medium"}),t(r,{size:"small",fullWidth:!0}),t(r,{variant:"heading",size:"xsmall",fullWidth:!0})]}),U=({orderData:e,onSignUpClick:c})=>{var g;const[l,a]=C(!f.authenticated),[i,h]=C();b(()=>{f.authenticated||H(e.email).then(m=>h(!m)).catch(()=>h(!0)).finally(()=>a(!1))},[e.email]);const _=c&&!f.authenticated&&i===!1?()=>{const m=e.shippingAddress,n=e.billingAddress,L=[{code:"firstname",defaultValue:(n==null?void 0:n.firstName)||""},{code:"lastname",defaultValue:(n==null?void 0:n.lastName)||""},{code:"email",defaultValue:e.email||""}];let u;if(m){const k={...p(m),default_shipping:!0};u=[{...p(n),default_billing:!0},k]}else u=[{...p(n),default_billing:!0,default_shipping:!0}];c({inputsDefaultValueSet:L,addressesData:u})}:void 0;return t("div",{children:t(d,{customerName:(g=e.billingAddress)==null?void 0:g.firstName,isLoading:l,onSignUpClick:_,orderNumber:e.number})})};export{U as OrderConfirmationHeader,U as default}; +import{jsx as e,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as A,Header as E,Button as y,Skeleton as N,SkeletonRow as r}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";/* empty css *//* empty css *//* empty css */import*as o from"@dropins/tools/preact-compat.js";import{useState as s,useEffect as x}from"@dropins/tools/preact-compat.js";import{useText as b,Text as v}from"@dropins/tools/i18n.js";import{s as f}from"../chunks/fetch-graphql.js";import"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{i as z}from"../chunks/isEmailAvailable.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";function p(t){var c;return{region:{region_id:t!=null&&t.regionId?Number(t==null?void 0:t.regionId):null,region:t==null?void 0:t.region},city:t==null?void 0:t.city,company:t==null?void 0:t.company,country_code:t==null?void 0:t.country,firstname:t==null?void 0:t.firstName,lastname:t==null?void 0:t.lastName,middlename:t==null?void 0:t.middleName,postcode:t==null?void 0:t.postCode,street:t==null?void 0:t.street,telephone:t==null?void 0:t.telephone,custom_attributesV2:((c=t==null?void 0:t.customAttributes)==null?void 0:c.map(l=>({attribute_code:l.code,value:l.value})))||[],prefix:t==null?void 0:t.prefix,suffix:t==null?void 0:t.suffix,fax:t==null?void 0:t.fax}}const H=t=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},o.createElement("g",{clipPath:"url(#clip0_4797_15077)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15077"},o.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"})))),V=({customerName:t,isLoading:c,orderNumber:l,onSignUpClick:m})=>{const i=b({title:e(v,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:t}}),defaultTitle:"Checkout.OrderConfirmationHeader.defaultTitle",order:e(v,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:l}}),createAccountMessage:"Checkout.OrderConfirmationHeader.CreateAccount.message",createAccountButton:"Checkout.OrderConfirmationHeader.CreateAccount.button"});return c?e(w,{}):h("div",{className:"order-confirmation-header order-confirmation__card",children:[e(A,{source:H,size:"64",className:"order-confirmation-header__icon"}),e(E,{className:"order-confirmation-header__title",title:i.title,size:"large",divider:!1,children:t?i.title:i.defaultTitle}),l&&e("p",{className:"order-confirmation-header__order",children:i.order}),m&&h("div",{className:"order-confirmation-create-account",children:[e("p",{className:"order-confirmation-create-account__message",children:i.createAccountMessage}),e(y,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:m,children:i.createAccountButton})]})]})},w=()=>h(N,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[e(r,{variant:"empty",size:"xlarge",fullWidth:!0}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"small",fullWidth:!0}),e(r,{variant:"heading",size:"xsmall",fullWidth:!0})]}),X=({orderData:t,onSignUpClick:c})=>{var k;const[l,m]=s(!f.authenticated),[i,g]=s();x(()=>{f.authenticated||z(t.email).then(a=>g(!a)).catch(()=>g(!0)).finally(()=>m(!1))},[t.email]);const _=c&&!f.authenticated&&i===!1?()=>{const a=t.shippingAddress,n=t.billingAddress,L=[{code:"firstname",defaultValue:(n==null?void 0:n.firstName)||""},{code:"lastname",defaultValue:(n==null?void 0:n.lastName)||""},{code:"email",defaultValue:t.email||""}];let u;if(a){const C={...p(a),default_shipping:!0};u=[{...p(n),default_billing:!0},C]}else u=[{...p(n),default_billing:!0,default_shipping:!0}];c({inputsDefaultValueSet:L,addressesData:u})}:void 0;return e("div",{children:e(V,{customerName:(k=t.billingAddress)==null?void 0:k.firstName,isLoading:l,onSignUpClick:_,orderNumber:t.number})})};export{X as OrderConfirmationHeader,X as default}; diff --git a/scripts/__dropins__/storefront-checkout/data/models/address.d.ts b/scripts/__dropins__/storefront-checkout/data/models/address.d.ts index 91e1c6032d..d4e9d1db26 100644 --- a/scripts/__dropins__/storefront-checkout/data/models/address.d.ts +++ b/scripts/__dropins__/storefront-checkout/data/models/address.d.ts @@ -13,5 +13,9 @@ export interface Address { street: string[]; telephone?: string; vatId?: string; + prefix?: string; + suffix?: string; + middleName?: string; + fax?: string; } //# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/data/models/api.d.ts b/scripts/__dropins__/storefront-checkout/data/models/api.d.ts index 52bd1340ea..9f26adb175 100644 --- a/scripts/__dropins__/storefront-checkout/data/models/api.d.ts +++ b/scripts/__dropins__/storefront-checkout/data/models/api.d.ts @@ -14,6 +14,10 @@ export interface CartAddress { street: string[]; telephone?: string; vatId?: string; + prefix?: string; + suffix?: string; + middleName?: string; + fax?: string; } export interface ShippingAddressInput { address?: CartAddress; diff --git a/scripts/__dropins__/storefront-checkout/data/models/order.d.ts b/scripts/__dropins__/storefront-checkout/data/models/order.d.ts index 6f6ea55711..039fbc60e1 100644 --- a/scripts/__dropins__/storefront-checkout/data/models/order.d.ts +++ b/scripts/__dropins__/storefront-checkout/data/models/order.d.ts @@ -16,6 +16,9 @@ export type OrderAddressModel = { code: string; value: string; }[]; + prefix: string; + suffix: string; + fax: string; } | null; export type OrderItemProductModel = { stockStatus?: string; diff --git a/scripts/__dropins__/storefront-checkout/data/transforms/transform-address.d.ts b/scripts/__dropins__/storefront-checkout/data/transforms/transform-address.d.ts index 167c803715..d36611fd59 100644 --- a/scripts/__dropins__/storefront-checkout/data/transforms/transform-address.d.ts +++ b/scripts/__dropins__/storefront-checkout/data/transforms/transform-address.d.ts @@ -21,6 +21,10 @@ declare const transformShippingAddresses: (data: ({ vat_id?: string | null | undefined; telephone?: string | null | undefined; same_as_billing: boolean; + prefix?: string | null | undefined; + suffix?: string | null | undefined; + middlename?: string | null | undefined; + fax?: string | null | undefined; region?: { __typename?: "CartAddressRegion" | undefined; region_id?: number | null | undefined; diff --git a/scripts/__dropins__/storefront-checkout/fragments.js b/scripts/__dropins__/storefront-checkout/fragments.js index fbe3a85a4b..3c03a79432 100644 --- a/scripts/__dropins__/storefront-checkout/fragments.js +++ b/scripts/__dropins__/storefront-checkout/fragments.js @@ -26,6 +26,10 @@ const e=` value } } + prefix + suffix + middlename + fax } `,t=` fragment SHIPPING_CART_ADDRESS_FRAGMENT on ShippingCartAddress { @@ -92,6 +96,10 @@ const e=` } } same_as_billing + prefix + suffix + middlename + fax } `,d=` fragment CHECKOUT_DATA_FRAGMENT on Cart { @@ -259,6 +267,7 @@ const e=` value } taxes { + title amount { currency value diff --git a/scripts/__dropins__/storefront-checkout/fragments.original.js b/scripts/__dropins__/storefront-checkout/fragments.original.js index fbe3a85a4b..3c03a79432 100644 --- a/scripts/__dropins__/storefront-checkout/fragments.original.js +++ b/scripts/__dropins__/storefront-checkout/fragments.original.js @@ -26,6 +26,10 @@ const e=` value } } + prefix + suffix + middlename + fax } `,t=` fragment SHIPPING_CART_ADDRESS_FRAGMENT on ShippingCartAddress { @@ -92,6 +96,10 @@ const e=` } } same_as_billing + prefix + suffix + middlename + fax } `,d=` fragment CHECKOUT_DATA_FRAGMENT on Cart { @@ -259,6 +267,7 @@ const e=` value } taxes { + title amount { currency value diff --git a/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/billing-address.d.ts b/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/billing-address.d.ts index f3622f9f70..6d565a4879 100644 --- a/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/billing-address.d.ts +++ b/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/billing-address.d.ts @@ -1,19 +1,19 @@ /******************************************************************** -* ADOBE CONFIDENTIAL -* __________________ -* -* Copyright 2024 Adobe -* All Rights Reserved. -* -* NOTICE: All information contained herein is, and remains -* the property of Adobe and its suppliers, if any. The intellectual -* and technical concepts contained herein are proprietary to Adobe -* and its suppliers and are protected by all applicable intellectual -* property laws, including trade secret and copyright laws. -* Dissemination of this information or reproduction of this material -* is strictly forbidden unless prior written permission is obtained -* from Adobe. -*******************************************************************/ + * ADOBE CONFIDENTIAL + * __________________ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + *******************************************************************/ export declare const billingAddressFixture: { firstname: string; lastname: string; @@ -33,6 +33,10 @@ export declare const billingAddressFixture: { }; telephone: string; custom_attributes: {}[]; + prefix: string; + suffix: string; + middlename: string; + fax: string; }; export declare const ukBillingAddressFixture: { firstname: string; @@ -48,5 +52,9 @@ export declare const ukBillingAddressFixture: { }; telephone: string; custom_attributes: {}[]; + prefix: string; + suffix: string; + middlename: string; + fax: string; }; //# sourceMappingURL=billing-address.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/cart.d.ts b/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/cart.d.ts index a8e011e8fa..bcf29e47d3 100644 --- a/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/cart.d.ts +++ b/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/cart.d.ts @@ -31,6 +31,10 @@ export declare const cartFixture: { vat_id?: string | null | undefined; street: (string | null)[]; telephone?: string | null | undefined; + prefix?: string | null | undefined; + suffix?: string | null | undefined; + middlename?: string | null | undefined; + fax?: string | null | undefined; country: { __typename?: "CartAddressCountry" | undefined; code: string; @@ -62,6 +66,10 @@ export declare const cartFixture: { vat_id?: string | null | undefined; telephone?: string | null | undefined; same_as_billing: boolean; + prefix?: string | null | undefined; + suffix?: string | null | undefined; + middlename?: string | null | undefined; + fax?: string | null | undefined; region?: { __typename?: "CartAddressRegion" | undefined; region_id?: number | null | undefined; diff --git a/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/shipping-address.d.ts b/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/shipping-address.d.ts index bae9900a71..51a9827c53 100644 --- a/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/shipping-address.d.ts +++ b/scripts/__dropins__/storefront-checkout/msw/fixtures/fragments/shipping-address.d.ts @@ -1,19 +1,19 @@ /******************************************************************** -* ADOBE CONFIDENTIAL -* __________________ -* -* Copyright 2024 Adobe -* All Rights Reserved. -* -* NOTICE: All information contained herein is, and remains -* the property of Adobe and its suppliers, if any. The intellectual -* and technical concepts contained herein are proprietary to Adobe -* and its suppliers and are protected by all applicable intellectual -* property laws, including trade secret and copyright laws. -* Dissemination of this information or reproduction of this material -* is strictly forbidden unless prior written permission is obtained -* from Adobe. -*******************************************************************/ + * ADOBE CONFIDENTIAL + * __________________ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + *******************************************************************/ export declare const shippingAddressFixture: { firstname: string; lastname: string; @@ -54,5 +54,9 @@ export declare const shippingAddressFixture: { }; }[]; selected_shipping_method: null; + prefix: string; + suffix: string; + middlename: string; + fax: string; }; //# sourceMappingURL=shipping-address.d.ts.map \ No newline at end of file