@dropins/storefront-checkout 0.1.0-alpha53 → 0.1.0-alpha58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/api/fragments.d.ts +2 -0
  2. package/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts +15 -15
  3. package/api.js +4 -4
  4. package/chunks/fetch-graphql.js +2 -2
  5. package/chunks/isEmailAvailable.js +1 -1
  6. package/chunks/placeOrder2.js +3 -249
  7. package/chunks/setBillingAddress.js +3 -3
  8. package/chunks/setGuestEmailOnCart.js +3 -3
  9. package/chunks/setPaymentMethod.js +3 -3
  10. package/chunks/setShippingMethods.js +3 -3
  11. package/chunks/store-config.js +1 -1
  12. package/chunks/synchronizeCheckout.js +6 -6
  13. package/chunks/withConditionalRendering.js +1 -1
  14. package/components/PlaceOrder/PlaceOrder.d.ts +1 -1
  15. package/components/index.d.ts +1 -3
  16. package/containers/BillToShippingAddress.js +1 -1
  17. package/containers/EstimateShipping.js +1 -1
  18. package/containers/LoginForm.js +1 -1
  19. package/containers/MergedCartBanner/MergedCartBanner.d.ts +4 -2
  20. package/containers/MergedCartBanner/index.d.ts +15 -15
  21. package/containers/MergedCartBanner.js +1 -1
  22. package/containers/OrderConfirmationHeader.js +1 -1
  23. package/containers/OutOfStock.js +1 -1
  24. package/containers/PaymentMethods.js +1 -1
  25. package/containers/PlaceOrder/PlaceOrder.d.ts +1 -0
  26. package/containers/PlaceOrder.js +1 -1
  27. package/containers/ServerError.js +1 -1
  28. package/containers/ShippingMethods.js +1 -1
  29. package/fragments.js +249 -3
  30. package/lib/index.d.ts +3 -1
  31. package/package.json +1 -1
  32. package/render.js +7 -4
  33. package/chunks/Heading.js +0 -3
  34. package/components/Heading/Heading.d.ts +0 -8
  35. package/components/Heading/index.d.ts +0 -19
  36. package/components/OverlayLoader/OverlayLoader.d.ts +0 -6
  37. package/components/OverlayLoader/index.d.ts +0 -18
  38. package/lib/backup-data.d.ts +0 -20
  39. package/lib/redirect.d.ts +0 -18
@@ -16,4 +16,6 @@
16
16
  *******************************************************************/
17
17
  export { CHECKOUT_DATA_FRAGMENT } from './graphql/CheckoutDataFragment.graphql';
18
18
  export { CUSTOMER_FRAGMENT } from './graphql/CustomerFragment.graphql';
19
+ export { ORDER_FRAGMENT } from './graphql/OrderFragment.graphql';
20
+ export { ORDER_ITEM_FRAGMENT } from './graphql/OrderItemFragment.graphql';
19
21
  //# sourceMappingURL=fragments.d.ts.map
@@ -1,18 +1,18 @@
1
1
  /********************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * __________________
4
- *
5
- * Copyright 2024 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
- *******************************************************************/
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2024 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
17
17
  export declare const setGuestEmailOnCart: (email: string) => Promise<import('../../data/models/cart').Cart | null | undefined>;
18
18
  //# sourceMappingURL=setGuestEmailOnCart.d.ts.map
package/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{b as _,a as f,t as g}from"./chunks/synchronizeCheckout.js";import{c as N,e as Q,g as R,d as q,i as K,f as P,r as j,s as L}from"./chunks/synchronizeCheckout.js";import{M as m,c as C,d as o,e as S}from"./chunks/fetch-graphql.js";import{D as J,F as V,I as W,b as X,f as Z,a as tt,S as st,U as et,i as it,j as rt,k as at,r as nt,s as ot,g as pt,h as dt}from"./chunks/fetch-graphql.js";import{s as l,a as A,i as y}from"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{i as ht}from"./chunks/isEmailAvailable.js";import{p as mt}from"./chunks/placeOrder2.js";import{a as M}from"./chunks/setBillingAddress.js";import{s as ut}from"./chunks/setBillingAddress.js";import{s as ft}from"./chunks/setGuestEmailOnCart.js";import{s as St}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as I}from"./fragments.js";import{s as yt}from"./chunks/setShippingMethods.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const T=`
3
+ import{t as _,a as A,b as g}from"./chunks/synchronizeCheckout.js";import{d as Q,c as R,g as q,e as K,i as P,f as j,r as L,s as Y}from"./chunks/synchronizeCheckout.js";import{s as m,M as u,a as C,d as p,b as S}from"./chunks/fetch-graphql.js";import{D as V,F as W,I as X,f as Z,c as tt,e as st,S as et,U as it,j as at,k as rt,l as nt,r as ot,g as pt,h as dt,i as ct}from"./chunks/fetch-graphql.js";import{a as y,i as M}from"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import"@dropins/tools/lib.js";import{events as l}from"@dropins/tools/event-bus.js";import{i as gt}from"./chunks/isEmailAvailable.js";import{p as mt}from"./chunks/placeOrder2.js";import{a as I}from"./chunks/setBillingAddress.js";import{s as ft}from"./chunks/setBillingAddress.js";import{s as At}from"./chunks/setGuestEmailOnCart.js";import{s as St}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as T}from"./fragments.js";import{s as Mt}from"./chunks/setShippingMethods.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const v=`
4
4
  mutation estimateShippingMethods(
5
5
  $cartId: String!
6
6
  $address: EstimateAddressInput!
@@ -26,7 +26,7 @@ import{b as _,a as f,t as g}from"./chunks/synchronizeCheckout.js";import{c as N,
26
26
  error_message
27
27
  }
28
28
  }
29
- `,D=async r=>{var h;const s=l.cartId,{criteria:a}=r||{},{country_code:e,region_id:t,region_name:i,zip:n}=a||{},p=e||((h=A.value.data)==null?void 0:h.defaultCountry);if(!s)throw new m;if(!p)throw new C;const d=typeof t=="string"?parseInt(t,10):t,c=t||i?{...d&&{region_id:d},...i&&{region_code:i}}:void 0,u={country_code:p,...n&&{postcode:n},...c&&{region:c}};return await o({type:"mutation",query:T,options:{variables:{cartId:s,address:u}},path:"estimateShippingMethods",signalType:"estimateShippingMethods",transformer:_})},E=`
29
+ `,D=async r=>{var h;const e=m.cartId,{criteria:n}=r||{},{country_code:i,region_id:t,region_name:s,zip:o}=n||{},a=i||((h=y.value.data)==null?void 0:h.defaultCountry);if(!e)throw new u;if(!a)throw new C;const d=typeof t=="string"?parseInt(t,10):t,c=t||s?{...d&&{region_id:d},...s&&{region_code:s}}:void 0,f={country_code:a,...o&&{postcode:o},...c&&{region:c}};return await p({type:"mutation",query:v,options:{variables:{cartId:e,address:f}},path:"estimateShippingMethods",signalType:"estimateShippingMethods",transformer:_})},E=`
30
30
  mutation setShippingAddress($input: SetShippingAddressesOnCartInput!) {
31
31
  setShippingAddressesOnCart(input: $input) {
32
32
  cart {
@@ -35,5 +35,5 @@ import{b as _,a as f,t as g}from"./chunks/synchronizeCheckout.js";import{c as N,
35
35
  }
36
36
  }
37
37
 
38
- ${I}
39
- `,H=async({address:r,customerAddressId:s,pickupLocationCode:a})=>{const e=l.cartId;if(!e)throw new m;const t={cart_id:e,shipping_addresses:[]};if(s)t.shipping_addresses.push({customer_address_id:s});else if(a)t.shipping_addresses.push({pickup_location_code:a});else{if(!r)throw new S;t.shipping_addresses.push({address:f(r)})}const i=await o({type:"mutation",query:E,options:{variables:{input:t}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:g});return y.value?await o({type:"mutation",query:M,options:{variables:{input:{cart_id:e,billing_address:{same_as_shipping:!0}}}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:g}):i};export{J as DEFAULT_COUNTRY,V as FetchError,W as InvalidArgument,X as MissingBillingAddress,m as MissingCart,C as MissingCountry,Z as MissingEmail,tt as MissingPaymentMethod,S as MissingShippinghAddress,st as STORE_CONFIG_DEFAULTS,et as UnexpectedError,N as authenticateCustomer,Q as config,D as estimateShippingMethods,it as fetchGraphQl,R as getCart,rt as getConfig,q as getCustomer,at as getStoreConfig,K as initialize,P as initializeCheckout,ht as isEmailAvailable,mt as placeOrder,nt as removeFetchGraphQlHeader,j as resetCheckout,ut as setBillingAddress,ot as setEndpoint,pt as setFetchGraphQlHeader,dt as setFetchGraphQlHeaders,ft as setGuestEmailOnCart,St as setPaymentMethod,H as setShippingAddress,yt as setShippingMethodsOnCart,L as synchronizeCheckout};
38
+ ${T}
39
+ `,H=async({address:r,customerAddressId:e,pickupLocationCode:n})=>{const i=m.cartId;if(!i)throw new u;const t={cart_id:i,shipping_addresses:[]};if(e)t.shipping_addresses.push({customer_address_id:e});else if(n)t.shipping_addresses.push({pickup_location_code:n});else{if(!r)throw new S;t.shipping_addresses.push({address:A(r)})}const s=await p({type:"mutation",query:E,options:{variables:{input:t}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:g});if(!M.value)return l.emit("checkout/updated",s||null),s;const a=await p({type:"mutation",query:I,options:{variables:{input:{cart_id:i,billing_address:{same_as_shipping:!0}}}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:g});return l.emit("checkout/updated",a||null),a};export{V as DEFAULT_COUNTRY,W as FetchError,X as InvalidArgument,Z as MissingBillingAddress,u as MissingCart,C as MissingCountry,tt as MissingEmail,st as MissingPaymentMethod,S as MissingShippinghAddress,et as STORE_CONFIG_DEFAULTS,it as UnexpectedError,Q as authenticateCustomer,R as config,D as estimateShippingMethods,at as fetchGraphQl,q as getCart,rt as getConfig,K as getCustomer,nt as getStoreConfig,P as initialize,j as initializeCheckout,gt as isEmailAvailable,mt as placeOrder,ot as removeFetchGraphQlHeader,L as resetCheckout,ft as setBillingAddress,pt as setEndpoint,dt as setFetchGraphQlHeader,ct as setFetchGraphQlHeaders,At as setGuestEmailOnCart,St as setPaymentMethod,H as setShippingAddress,Mt as setShippingMethodsOnCart,Y as synchronizeCheckout};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{c as S,d as T,e as A,a as v,T as i}from"./store-config.js";import"./ServerErrorSignal.js";import{events as G}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{FetchGraphQL as b}from"@dropins/tools/fetch-graphql.js";class x extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class a extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class H extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class V extends a{constructor(){super("Cart ID is required")}}class j extends a{constructor(){super("Email is required")}}class B extends a{constructor(){super("Payment method code is required")}}class Y extends a{constructor(){super("Shipping address is required")}}class $ extends a{constructor(){super("Billing address is required")}}class z extends a{constructor(){super("Country Code is required")}}const p=[];function D(e){return new Promise((t,s)=>{p.push(e);const r=()=>{p[0]===e?e().then(t).catch(s).finally(()=>p.shift()):setTimeout(r,100)};r()})}const k=["sender_email","recipient_email"];function w(e){return e.filter(t=>!t.path||!k.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const C=e=>{throw e instanceof DOMException&&e.name==="AbortError"||G.emit("error",{source:"checkout",type:"network",error:e}),e},I={cart:S,customer:T,estimateShippingMethods:A,storeConfig:v};function M(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}const E={cart:null,customer:null,estimateShippingMethods:null,storeConfig:null};async function U(e){const{defaultValueOnFail:t,query:s,options:r,path:c,signalType:d,type:y,transformer:h}=e,n=I[d],g=Symbol();E[d]=g,n.value={...n.value,pending:!0};try{const{data:l,errors:f}=await(y==="mutation"?D(()=>_(s,r).catch(C)):_(s,{method:"GET",cache:"no-cache",...r}).catch(C));if(f){const m=w(f);if(m.length>0)throw new x(m)}let o=M(l,c);if(o===void 0)throw new Error(`No data found at path: ${c}`);return h&&(o=h(o)),n.value={...n.value,data:o},setTimeout(()=>{n.value={...n.value,pending:E[d]===g?!1:n.value.pending}},0),o}catch(l){if(t)return n.value={pending:!1,data:t},t;if(l.name==="AbortError")return;throw n.value={...n.value,pending:!1},l}}const q=`
3
+ import{c as S,b as T,e as A,a as b,T as i}from"./store-config.js";import"./ServerErrorSignal.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{FetchGraphQL as G}from"@dropins/tools/fetch-graphql.js";const x={authenticated:!1,cartId:null,initialized:!1},V=new Proxy(x,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}});class w extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class a extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class j extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class B extends a{constructor(){super("Cart ID is required")}}class z extends a{constructor(){super("Email is required")}}class Y extends a{constructor(){super("Payment method code is required")}}class $ extends a{constructor(){super("Shipping address is required")}}class J extends a{constructor(){super("Billing address is required")}}class K extends a{constructor(){super("Country Code is required")}}const p=[];function D(e){return new Promise((t,s)=>{p.push(e);const r=()=>{p[0]===e?e().then(t).catch(s).finally(()=>p.shift()):setTimeout(r,100)};r()})}const k=["sender_email","recipient_email"];function I(e){return e.filter(t=>!t.path||!k.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const C=e=>{throw e instanceof DOMException&&e.name==="AbortError"||v.emit("error",{source:"checkout",type:"network",error:e}),e},M={cart:S,customer:T,estimateShippingMethods:A,storeConfig:b};function U(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}const E={cart:null,customer:null,estimateShippingMethods:null,storeConfig:null};async function q(e){const{defaultValueOnFail:t,query:s,options:r,path:c,signalType:d,type:y,transformer:h}=e,n=M[d],g=Symbol();E[d]=g,n.value={...n.value,pending:!0};try{const{data:l,errors:f}=await(y==="mutation"?D(()=>_(s,r).catch(C)):_(s,{method:"GET",cache:"no-cache",...r}).catch(C));if(f){const m=I(f);if(m.length>0)throw new w(m)}let o=U(l,c);if(o===void 0)throw new Error(`No data found at path: ${c}`);return h&&(o=h(o)),n.value={...n.value,data:o},setTimeout(()=>{n.value={...n.value,pending:E[d]===g?!1:n.value.pending}},0),o}catch(l){if(t)return n.value={pending:!1,data:t},t;if(l.name==="AbortError")return;throw n.value={...n.value,pending:!1},l}}const N=`
4
4
  query getStoreConfig {
5
5
  storeConfig {
6
6
  default_country
@@ -9,4 +9,4 @@ import{c as S,d as T,e as A,a as v,T as i}from"./store-config.js";import"./Serve
9
9
  shopping_cart_display_shipping
10
10
  }
11
11
  }
12
- `,N="US",u={defaultCountry:N,isGuestCheckoutEnabled:!1,isOnePageCheckoutEnabled:!1,shoppingCartDisplaySetting:{shipping:i.EXCLUDING_TAX}},J=async()=>await U({type:"query",query:q,options:{method:"GET",cache:"no-cache"},path:"storeConfig",signalType:"storeConfig",transformer:L,defaultValueOnFail:u});function F(e){switch(e){case 1:return i.EXCLUDING_TAX;case 2:return i.INCLUDING_TAX;case 3:return i.INCLUDING_EXCLUDING_TAX;default:return i.EXCLUDING_TAX}}function L(e){if(!e)return u;const{default_country:t,is_guest_checkout_enabled:s,is_one_page_checkout_enabled:r,shopping_cart_display_shipping:c}=e;return{defaultCountry:t||u.defaultCountry,isGuestCheckoutEnabled:s||u.isGuestCheckoutEnabled,isOnePageCheckoutEnabled:r||u.isOnePageCheckoutEnabled,shoppingCartDisplaySetting:{shipping:F(c)}}}const{setEndpoint:K,setFetchGraphQlHeader:W,removeFetchGraphQlHeader:Z,setFetchGraphQlHeaders:ee,fetchGraphQl:_,getConfig:te}=new b().getMethods();export{N as D,x as F,a as I,V as M,u as S,H as U,B as a,$ as b,z as c,U as d,Y as e,j as f,W as g,ee as h,_ as i,te as j,J as k,C as l,Z as r,K as s};
12
+ `,F="US",u={defaultCountry:F,isGuestCheckoutEnabled:!1,isOnePageCheckoutEnabled:!1,shoppingCartDisplaySetting:{shipping:i.EXCLUDING_TAX}},W=async()=>await q({type:"query",query:N,options:{method:"GET",cache:"no-cache"},path:"storeConfig",signalType:"storeConfig",transformer:O,defaultValueOnFail:u});function L(e){switch(e){case 1:return i.EXCLUDING_TAX;case 2:return i.INCLUDING_TAX;case 3:return i.INCLUDING_EXCLUDING_TAX;default:return i.EXCLUDING_TAX}}function O(e){if(!e)return u;const{default_country:t,is_guest_checkout_enabled:s,is_one_page_checkout_enabled:r,shopping_cart_display_shipping:c}=e;return{defaultCountry:t||u.defaultCountry,isGuestCheckoutEnabled:s||u.isGuestCheckoutEnabled,isOnePageCheckoutEnabled:r||u.isOnePageCheckoutEnabled,shoppingCartDisplaySetting:{shipping:L(c)}}}const{setEndpoint:Z,setFetchGraphQlHeader:ee,removeFetchGraphQlHeader:te,setFetchGraphQlHeaders:se,fetchGraphQl:_,getConfig:re}=new G().getMethods();export{F as D,w as F,a as I,B as M,u as S,j as U,K as a,$ as b,z as c,q as d,Y as e,J as f,Z as g,ee as h,se as i,_ as j,re as k,W as l,C as m,te as r,V as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import"./store-config.js";import"./ServerErrorSignal.js";import{f as e,i as r,l as o}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const s=i=>!!(i!=null&&i.is_email_available),t=`
3
+ import{c as e,j as r,m as o}from"./fetch-graphql.js";import"./store-config.js";import"./ServerErrorSignal.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const s=i=>!!(i!=null&&i.is_email_available),t=`
4
4
  query isEmailAvailable($email: String!) {
5
5
  isEmailAvailable(email: $email) {
6
6
  is_email_available
@@ -1,252 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{M as L,i as k,l as $,F as B,U as Q}from"./fetch-graphql.js";import{s as P}from"./store-config.js";import"./ServerErrorSignal.js";import{events as q}from"@dropins/tools/event-bus.js";import{merge as j}from"@dropins/tools/lib.js";import{e as V}from"./synchronizeCheckout.js";const X=e=>({id:P.cartId,totalQuantity:e.totalQuantity,possibleOnepageCheckout:!0,items:e.items.map(n=>{var t;return{canApplyMsrp:!0,formattedPrice:"",id:n.id,quantity:n.totalQuantity,product:{canonicalUrl:n.product.canonicalUrl||"",mainImageUrl:n.product.image||"",name:n.product.name,productId:0,productType:n.product.productType,sku:n.product.sku},prices:{price:{value:n.price.value,currency:n.price.currency}},configurableOptions:((t=n.selectedOptions)==null?void 0:t.map(a=>({optionLabel:a.label,valueLabel:a.value})))||[]}})}),Y=e=>{var a,r,i;const n=e.coupons[0],t=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(n==null?void 0:n.code)||"",email:e.email,grandTotal:e.total,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax,shipping:{shippingMethod:((r=e.shipping)==null?void 0:r.code)||"",shippingAmount:((i=e.shipping)==null?void 0:i.amount)||0},subtotalExcludingTax:e.subtotal,subtotalIncludingTax:0,payments:t?[{paymentMethodCode:(t==null?void 0:t.code)||"",paymentMethodName:(t==null?void 0:t.name)||"",total:e.total}]:[]}},H=e=>e.replace(/_([a-z])/g,(n,t)=>t.toUpperCase()),g=(e,n,t)=>{const a=["string","boolean","number"],r=H;return Array.isArray(e)?e.map(i=>a.includes(typeof i)||i===null?i:typeof i=="object"?g(i,n,t):i):e!==null&&typeof e=="object"?Object.entries(e).reduce((i,[s,c])=>{const l=t&&t[s]?t[s]:r(s);return i[l]=a.includes(typeof c)||c===null?c:g(c,n,t),i},{}):e},K=e=>e||0,z=e=>{var n,t,a;return{...e,canonicalUrl:(e==null?void 0:e.canonical_url)||"",id:(e==null?void 0:e.uid)||"",name:(e==null?void 0:e.name)||"",sku:(e==null?void 0:e.sku)||"",image:((n=e==null?void 0:e.image)==null?void 0:n.url)||"",productType:(e==null?void 0:e.__typename)||"",thumbnail:{label:((t=e==null?void 0:e.thumbnail)==null?void 0:t.label)||"",url:((a=e==null?void 0:e.thumbnail)==null?void 0:a.url)||""}}},J=e=>{if(!e||!("selected_options"in e))return;const n={};for(const t of e.selected_options)n[t.label]=t.value;return n},W=e=>{const n=e==null?void 0:e.map(a=>({uid:a.uid,label:a.label,values:a.values.map(r=>r.product_name).join(", ")})),t={};return n==null||n.forEach(a=>{t[a.label]=a.values}),Object.keys(t).length>0?t:null},Z=e=>(e==null?void 0:e.length)>0?{count:e.length,result:e.map(n=>n.title).join(", ")}:null,I=e=>e==null?void 0:e.filter(n=>typeof n.__typename<"u").map(n=>{var t,a,r,i,s,c,l,_,p,d,m,y,u,R,E,o,f,T,O,b,h,A,v,C,M,N,D,G,F,x;return{type:n.__typename,productName:n.product_name,quantityCanceled:n.quantity_canceled||0,quantityInvoiced:n.quantity_invoiced||0,quantityOrdered:n.quantity_ordered||0,quantityRefunded:n.quantity_refunded||0,quantityReturned:n.quantity_returned||0,quantityShipped:n.quantity_shipped||0,id:n.id,discounted:((i=(r=(a=(t=n.product)==null?void 0:t.price_range)==null?void 0:a.maximum_price)==null?void 0:r.regular_price)==null?void 0:i.value)*n.quantity_ordered!==((s=n.product_sale_price)==null?void 0:s.value)*n.quantity_ordered,total:{value:((c=n.product_sale_price)==null?void 0:c.value)*n.quantity_ordered||0,currency:((l=n.product_sale_price)==null?void 0:l.currency)||""},totalInclTax:{value:((_=n.product_sale_price)==null?void 0:_.value)*n.quantity_ordered||0,currency:(p=n.product_sale_price)==null?void 0:p.currency},price:{value:((d=n.product_sale_price)==null?void 0:d.value)||0,currency:(m=n.product_sale_price)==null?void 0:m.currency},priceInclTax:{value:((y=n.product_sale_price)==null?void 0:y.value)||0,currency:(u=n.product_sale_price)==null?void 0:u.currency},totalQuantity:K(n.quantity_ordered),regularPrice:{value:(f=(o=(E=(R=n.product)==null?void 0:R.price_range)==null?void 0:E.maximum_price)==null?void 0:o.regular_price)==null?void 0:f.value,currency:(h=(b=(O=(T=n.product)==null?void 0:T.price_range)==null?void 0:O.maximum_price)==null?void 0:b.regular_price)==null?void 0:h.currency},product:z(n.product),thumbnail:{label:((v=(A=n.product)==null?void 0:A.thumbnail)==null?void 0:v.label)||"",url:((M=(C=n.product)==null?void 0:C.thumbnail)==null?void 0:M.url)||""},giftCard:n.__typename==="GiftCardOrderItem"?{senderName:((N=n.gift_card)==null?void 0:N.sender_name)||"",senderEmail:((D=n.gift_card)==null?void 0:D.sender_email)||"",recipientEmail:((G=n.gift_card)==null?void 0:G.recipient_email)||"",recipientName:((F=n.gift_card)==null?void 0:F.recipient_name)||"",message:((x=n.gift_card)==null?void 0:x.message)||""}:void 0,configurableOptions:J(n),bundleOptions:n.__typename==="BundleOrderItem"?W(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?Z(n.downloadable_links):null}}),ee=e=>{var _,p,d,m,y,u,R;const n=I(e.items),{total:t,...a}=g({...e,items:n},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),r=(_=e==null?void 0:e.payment_methods)==null?void 0:_[0],i=(r==null?void 0:r.type)||"",s=(r==null?void 0:r.name)||"",c=(p=a==null?void 0:a.items)==null?void 0:p.reduce((E,o)=>E+(o==null?void 0:o.totalQuantity),0),l={...t,...a,totalQuantity:c,shipping:{amount:((d=t==null?void 0:t.totalShipping)==null?void 0:d.value)??0,currency:((m=t==null?void 0:t.totalShipping)==null?void 0:m.currency)||"",code:a.shippingMethod??""},payments:[{code:i,name:s}]};return j(l,(R=(u=(y=V.getConfig().models)==null?void 0:y.OrderModel)==null?void 0:u.transformer)==null?void 0:R.call(u,e))},ne=`
4
- fragment ORDER_ADDRESS_FRAGMENT on OrderAddress {
5
- city
6
- company
7
- country_code
8
- fax
9
- firstname
10
- lastname
11
- middlename
12
- postcode
13
- prefix
14
- region
15
- region_id
16
- street
17
- suffix
18
- telephone
19
- vat_id
20
- custom_attributesV2 {
21
- code
22
- ... on AttributeValue {
23
- value
24
- }
25
- }
26
- }
27
- `,te=`
28
- fragment PRODUCT_FRAGMENT on ProductInterface {
29
- __typename
30
- canonical_url
31
- uid
32
- name
33
- sku
34
- only_x_left_in_stock
35
- stock_status
36
- image {
37
- url
38
- }
39
- thumbnail {
40
- label
41
- url
42
- }
43
- price_range {
44
- maximum_price {
45
- regular_price {
46
- currency
47
- value
48
- }
49
- }
50
- }
51
- }
52
- `,ae=`
53
- fragment PRICE_FRAGMENT on OrderItemInterface {
54
- prices {
55
- price_including_tax {
56
- value
57
- currency
58
- }
59
- original_price {
60
- value
61
- currency
62
- }
63
- original_price_including_tax {
64
- value
65
- currency
66
- }
67
- price {
68
- value
69
- currency
70
- }
71
- }
72
- }
73
- `,re=`
74
- fragment GIFT_CARD_FRAGMENT on GiftCardOrderItem {
75
- ...PRICE_FRAGMENT
76
- gift_message {
77
- message
78
- }
79
- gift_card {
80
- recipient_name
81
- recipient_email
82
- sender_name
83
- sender_email
84
- message
85
- }
86
- }
87
- `,ie=`
88
- fragment ORDER_ITEM_FRAGMENT on OrderItemInterface {
89
- __typename
90
- status
91
- product_name
92
- id
93
- quantity_ordered
94
- quantity_shipped
95
- quantity_canceled
96
- quantity_invoiced
97
- quantity_refunded
98
- quantity_returned
99
- product_sale_price {
100
- value
101
- currency
102
- }
103
- selected_options {
104
- label
105
- value
106
- }
107
- product {
108
- ...PRODUCT_FRAGMENT
109
- }
110
- ...PRICE_FRAGMENT
111
- }
112
- `,ce=`
113
- fragment BUNDLE_ORDER_ITEM_FRAGMENT on BundleOrderItem {
114
- ...PRICE_FRAGMENT
115
- bundle_options {
116
- uid
117
- label
118
- values {
119
- uid
120
- product_name
121
- }
122
- }
123
- }
124
- `,se=`
125
- fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {
126
- grand_total {
127
- value
128
- currency
129
- }
130
- total_giftcard {
131
- currency
132
- value
133
- }
134
- subtotal {
135
- currency
136
- value
137
- }
138
- taxes {
139
- amount {
140
- currency
141
- value
142
- }
143
- rate
144
- }
145
- total_tax {
146
- currency
147
- value
148
- }
149
- total_shipping {
150
- currency
151
- value
152
- }
153
- discounts {
154
- amount {
155
- currency
156
- value
157
- }
158
- label
159
- }
160
- }
161
- `,ue=`
162
- fragment ORDER_FRAGMENT on CustomerOrder {
163
- email
164
- id
165
- number
166
- order_date
167
- order_status_change_date
168
- status
169
- token
170
- carrier
171
- shipping_method
172
- printed_card_included
173
- gift_receipt_included
174
- available_actions
175
- is_virtual
176
- payment_methods {
177
- name
178
- type
179
- }
180
- applied_coupons {
181
- code
182
- }
183
- shipments {
184
- id
185
- tracking {
186
- title
187
- number
188
- carrier
189
- }
190
- comments {
191
- message
192
- timestamp
193
- }
194
- items {
195
- id
196
- product_sku
197
- product_name
198
- order_item {
199
- ...ORDER_ITEM_FRAGMENT
200
- ... on GiftCardOrderItem {
201
- ...GIFT_CARD_FRAGMENT
202
- product {
203
- ...PRODUCT_FRAGMENT
204
- }
205
- }
206
- }
207
- }
208
- }
209
- payment_methods {
210
- name
211
- type
212
- }
213
- shipping_address {
214
- ...ORDER_ADDRESS_FRAGMENT
215
- }
216
- billing_address {
217
- ...ORDER_ADDRESS_FRAGMENT
218
- }
219
- items {
220
- ...ORDER_ITEM_FRAGMENT
221
- ... on BundleOrderItem {
222
- ...BUNDLE_ORDER_ITEM_FRAGMENT
223
- }
224
- ... on GiftCardOrderItem {
225
- ...GIFT_CARD_FRAGMENT
226
- product {
227
- ...PRODUCT_FRAGMENT
228
- }
229
- }
230
- ... on DownloadableOrderItem {
231
- product_name
232
- downloadable_links {
233
- sort_order
234
- title
235
- }
236
- }
237
- }
238
- total {
239
- ...ORDER_SUMMARY_FRAGMENT
240
- }
241
- }
242
- ${ce}
243
- ${re}
244
- ${ne}
245
- ${ie}
246
- ${se}
247
- ${ae}
248
- ${te}
249
- `,le=`
3
+ import{s as P,M as F,j as G,m as k,F as $,U as Q}from"./fetch-graphql.js";import{ORDER_FRAGMENT as X}from"../fragments.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as S}from"@dropins/tools/event-bus.js";import{merge as B}from"@dropins/tools/lib.js";import{c as H}from"./synchronizeCheckout.js";const K=e=>({id:P.cartId,totalQuantity:e.totalQuantity,possibleOnepageCheckout:!0,items:e.items.map(n=>{var a;return{canApplyMsrp:!0,formattedPrice:"",id:n.id,quantity:n.totalQuantity,product:{canonicalUrl:n.product.canonicalUrl||"",mainImageUrl:n.product.image||"",name:n.product.name,productId:0,productType:n.product.productType,sku:n.product.sku},prices:{price:{value:n.price.value,currency:n.price.currency}},configurableOptions:((a=n.selectedOptions)==null?void 0:a.map(t=>({optionLabel:t.label,valueLabel:t.value})))||[]}})}),V=e=>{var t,i,s;const n=e.coupons[0],a=(t=e.payments)==null?void 0:t[0];return{appliedCouponCode:(n==null?void 0:n.code)||"",email:e.email,grandTotal:e.total,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax,shipping:{shippingMethod:((i=e.shipping)==null?void 0:i.code)||"",shippingAmount:((s=e.shipping)==null?void 0:s.amount)||0},subtotalExcludingTax:e.subtotal,subtotalIncludingTax:0,payments:a?[{paymentMethodCode:(a==null?void 0:a.code)||"",paymentMethodName:(a==null?void 0:a.name)||"",total:e.total}]:[]}},z=e=>e.replace(/_([a-z])/g,(n,a)=>a.toUpperCase()),b=(e,n,a)=>{const t=["string","boolean","number"],i=z;return Array.isArray(e)?e.map(s=>t.includes(typeof s)||s===null?s:typeof s=="object"?b(s,n,a):s):e!==null&&typeof e=="object"?Object.entries(e).reduce((s,[r,c])=>{const u=a&&a[r]?a[r]:i(r);return s[u]=t.includes(typeof c)||c===null?c:b(c,n,a),s},{}):e},J=e=>e||0,W=e=>{var n,a,t;return{...e,canonicalUrl:(e==null?void 0:e.canonical_url)||"",id:(e==null?void 0:e.uid)||"",name:(e==null?void 0:e.name)||"",sku:(e==null?void 0:e.sku)||"",image:((n=e==null?void 0:e.image)==null?void 0:n.url)||"",productType:(e==null?void 0:e.__typename)||"",thumbnail:{label:((a=e==null?void 0:e.thumbnail)==null?void 0:a.label)||"",url:((t=e==null?void 0:e.thumbnail)==null?void 0:t.url)||""}}},Y=e=>{if(!e||!("selected_options"in e))return;const n={};for(const a of e.selected_options)n[a.label]=a.value;return n},Z=e=>{const n=e==null?void 0:e.map(t=>({uid:t.uid,label:t.label,values:t.values.map(i=>i.product_name).join(", ")})),a={};return n==null||n.forEach(t=>{a[t.label]=t.values}),Object.keys(a).length>0?a:null},I=e=>(e==null?void 0:e.length)>0?{count:e.length,result:e.map(n=>n.title).join(", ")}:null,ee=e=>e==null?void 0:e.filter(n=>typeof n.__typename<"u").map(n=>{var a,t,i,s,r,c,u,p,_,y,f,g,l,m,h,o,d,O,C,v,E,T,x,w,q,N,R,L,A,M;return{type:n.__typename,productName:n.product_name,quantityCanceled:n.quantity_canceled||0,quantityInvoiced:n.quantity_invoiced||0,quantityOrdered:n.quantity_ordered||0,quantityRefunded:n.quantity_refunded||0,quantityReturned:n.quantity_returned||0,quantityShipped:n.quantity_shipped||0,id:n.id,discounted:((s=(i=(t=(a=n.product)==null?void 0:a.price_range)==null?void 0:t.maximum_price)==null?void 0:i.regular_price)==null?void 0:s.value)*n.quantity_ordered!==((r=n.product_sale_price)==null?void 0:r.value)*n.quantity_ordered,total:{value:((c=n.product_sale_price)==null?void 0:c.value)*n.quantity_ordered||0,currency:((u=n.product_sale_price)==null?void 0:u.currency)||""},totalInclTax:{value:((p=n.product_sale_price)==null?void 0:p.value)*n.quantity_ordered||0,currency:(_=n.product_sale_price)==null?void 0:_.currency},price:{value:((y=n.product_sale_price)==null?void 0:y.value)||0,currency:(f=n.product_sale_price)==null?void 0:f.currency},priceInclTax:{value:((g=n.product_sale_price)==null?void 0:g.value)||0,currency:(l=n.product_sale_price)==null?void 0:l.currency},totalQuantity:J(n.quantity_ordered),regularPrice:{value:(d=(o=(h=(m=n.product)==null?void 0:m.price_range)==null?void 0:h.maximum_price)==null?void 0:o.regular_price)==null?void 0:d.value,currency:(E=(v=(C=(O=n.product)==null?void 0:O.price_range)==null?void 0:C.maximum_price)==null?void 0:v.regular_price)==null?void 0:E.currency},product:W(n.product),thumbnail:{label:((x=(T=n.product)==null?void 0:T.thumbnail)==null?void 0:x.label)||"",url:((q=(w=n.product)==null?void 0:w.thumbnail)==null?void 0:q.url)||""},giftCard:n.__typename==="GiftCardOrderItem"?{senderName:((N=n.gift_card)==null?void 0:N.sender_name)||"",senderEmail:((R=n.gift_card)==null?void 0:R.sender_email)||"",recipientEmail:((L=n.gift_card)==null?void 0:L.recipient_email)||"",recipientName:((A=n.gift_card)==null?void 0:A.recipient_name)||"",message:((M=n.gift_card)==null?void 0:M.message)||""}:void 0,configurableOptions:Y(n),bundleOptions:n.__typename==="BundleOrderItem"?Z(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?I(n.downloadable_links):null}}),ne=e=>{var p,_,y,f,g,l,m;const n=ee(e.items),{total:a,...t}=b({...e,items:n},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),i=(p=e==null?void 0:e.payment_methods)==null?void 0:p[0],s=(i==null?void 0:i.type)||"",r=(i==null?void 0:i.name)||"",c=(_=t==null?void 0:t.items)==null?void 0:_.reduce((h,o)=>h+(o==null?void 0:o.totalQuantity),0),u={...a,...t,totalQuantity:c,shipping:{amount:((y=a==null?void 0:a.totalShipping)==null?void 0:y.value)??0,currency:((f=a==null?void 0:a.totalShipping)==null?void 0:f.currency)||"",code:t.shippingMethod??""},payments:[{code:s,name:r}]};return B(u,(m=(l=(g=H.getConfig().models)==null?void 0:g.OrderModel)==null?void 0:l.transformer)==null?void 0:m.call(l,e))},ae=`
250
4
  mutation placeOrder($cartId: String!) {
251
5
  placeOrder(input: { cart_id: $cartId }) {
252
6
  errors {
@@ -259,5 +13,5 @@ import{M as L,i as k,l as $,F as B,U as Q}from"./fetch-graphql.js";import{s as P
259
13
  }
260
14
  }
261
15
 
262
- ${ue}
263
- `,w={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},oe={PLACE_ORDER:"place-order"};function U(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function S(e,n){const t=U();t.push({[e]:null}),t.push({[e]:n})}function _e(e,n){U().push(a=>{const r=a.getState?a.getState():{};a.push({event:e,eventInfo:{...r,...n}})})}function pe(e){const n=X(e),t=Y(e);S(w.SHOPPING_CART_CONTEXT,{...n}),S(w.ORDER_CONTEXT,{...t}),_e(oe.PLACE_ORDER)}function de(e){throw e.every(t=>{var a;return(a=t.extensions)==null?void 0:a.category})?new B(e):new Q(e[0].message)}const Te=async()=>{const e=P.cartId;if(!e)throw new L;const{data:n,errors:t}=await k(le,{variables:{cartId:e}}).catch($);t&&de(t);const a=ee(n.placeOrder.orderV2);return pe(a),q.emit("checkout/order",a),q.emit("cart/reset",void 0),a};export{Te as p};
16
+ ${X}
17
+ `,j={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},te={PLACE_ORDER:"place-order"};function U(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function D(e,n){const a=U();a.push({[e]:null}),a.push({[e]:n})}function ie(e,n){U().push(t=>{const i=t.getState?t.getState():{};t.push({event:e,eventInfo:{...i,...n}})})}function se(e){const n=K(e),a=V(e);D(j.SHOPPING_CART_CONTEXT,{...n}),D(j.ORDER_CONTEXT,{...a}),ie(te.PLACE_ORDER)}function ce(e){throw e.every(a=>{var t;return(t=a.extensions)==null?void 0:t.category})?new $(e):new Q(e[0].message)}function re(e){const n=e.map(a=>a==null?void 0:a.message).join(", ");throw new Q(`${n}`)}const ge=async()=>{var i,s;const e=P.cartId;if(!e)throw new F;const{data:n,errors:a}=await G(ae,{variables:{cartId:e}}).catch(k);a&&ce(a),(i=n.placeOrder)!=null&&i.errors&&n.placeOrder.errors.length>0&&re((s=n.placeOrder)==null?void 0:s.errors);const t=ne(n.placeOrder.orderV2);return se(t),S.emit("checkout/order",t),S.emit("cart/reset",void 0),t};export{ge as p};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{M as e,b as o,d as l}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as d}from"../fragments.js";import{s as p}from"./store-config.js";import{a as f,t as m}from"./synchronizeCheckout.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const _=`
3
+ import{s as o,M as d,f as l,d as p}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as u}from"../fragments.js";import{a as c,b as f}from"./synchronizeCheckout.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as m}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const _=`
4
4
  mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {
5
5
  setBillingAddressOnCart(input: $input) {
6
6
  cart {
@@ -9,5 +9,5 @@ import{M as e,b as o,d as l}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGME
9
9
  }
10
10
  }
11
11
 
12
- ${d}
13
- `,M=async({address:r,customerAddressId:t,sameAsShipping:s=!1,useForShipping:n=!1})=>{const a=p.cartId;if(!a)throw new e;const i={cart_id:a,billing_address:{same_as_shipping:s,use_for_shipping:n}};if(!s&&t&&(i.billing_address.customer_address_id=t),!s&&!t){if(!r)throw new o;i.billing_address.address=f(r)}return await l({type:"mutation",query:_,options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:m})};export{_ as a,M as s};
12
+ ${u}
13
+ `,b=async({address:a,customerAddressId:t,sameAsShipping:s=!1,useForShipping:e=!1})=>{const r=o.cartId;if(!r)throw new d;const i={cart_id:r,billing_address:{same_as_shipping:s,use_for_shipping:e}};if(!s&&t&&(i.billing_address.customer_address_id=t),!s&&!t){if(!a)throw new l;i.billing_address.address=c(a)}const n=await p({type:"mutation",query:_,options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:f});return m.emit("checkout/updated",n||null),n};export{_ as a,b as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{M as r,d as i}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as s}from"../fragments.js";import{s as m}from"./store-config.js";import{t as o}from"./synchronizeCheckout.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const e=`
3
+ import{s as i,M as s,d as e}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as o}from"../fragments.js";import{b as m}from"./synchronizeCheckout.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as n}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const c=`
4
4
  mutation setGuestEmail($cartId: String!, $email: String!) {
5
5
  setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
6
6
  cart {
@@ -9,5 +9,5 @@ import{M as r,d as i}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as s
9
9
  }
10
10
  }
11
11
 
12
- ${s}
13
- `,d=async a=>{const t=m.cartId;if(!t)throw new r;return await i({type:"mutation",query:e,options:{variables:{cartId:t,email:a}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:o})};export{d as s};
12
+ ${o}
13
+ `,A=async r=>{const t=i.cartId;if(!t)throw new s;const a=await e({type:"mutation",query:c,options:{variables:{cartId:t,email:r}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:m});return n.emit("checkout/updated",a||null),a};export{A as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{M as r,a as o,d as e}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s}from"./store-config.js";import{t as i}from"./synchronizeCheckout.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const m=`
3
+ import{s as r,M as o,e as n,d as s}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as i}from"../fragments.js";import{b as m}from"./synchronizeCheckout.js";import"./store-config.js";import"./ServerErrorSignal.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const p=`
4
4
  mutation setPaymentMethod($cartId: String!, $paymentMethod: String!) {
5
5
  setPaymentMethodOnCart(
6
6
  input: { cart_id: $cartId, payment_method: { code: $paymentMethod } }
@@ -11,5 +11,5 @@ import{M as r,a as o,d as e}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGME
11
11
  }
12
12
  }
13
13
 
14
- ${n}
15
- `,f=async t=>{const a=s.cartId;if(!a)throw new r;if(!t)throw new o;return await e({type:"mutation",query:m,options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:i})};export{f as s};
14
+ ${i}
15
+ `,A=async t=>{const a=r.cartId;if(!a)throw new o;if(!t)throw new n;const e=await s({type:"mutation",query:p,options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:m});return d.emit("checkout/updated",e||null),e};export{A as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{s as r}from"./store-config.js";import"./ServerErrorSignal.js";import{M as s,d as p}from"./fetch-graphql.js";import{t as a}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as o}from"../fragments.js";const n=`
3
+ import{s as a,M as p,d as r}from"./fetch-graphql.js";import"./store-config.js";import"./ServerErrorSignal.js";import{b as o}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import{events as n}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";const h=`
4
4
  mutation setShippingMethods(
5
5
  $cartId: String!
6
6
  $shippingMethods: [ShippingMethodInput]!
@@ -14,5 +14,5 @@ import{s as r}from"./store-config.js";import"./ServerErrorSignal.js";import{M as
14
14
  }
15
15
  }
16
16
 
17
- ${o}
18
- `,C=async i=>{const t=r.cartId;if(!t)throw new s;return await p({type:"mutation",query:n,options:{variables:{cartId:t,shippingMethods:i}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:a})};export{C as s};
17
+ ${e}
18
+ `,f=async s=>{const t=a.cartId;if(!t)throw new p;const i=await r({type:"mutation",query:h,options:{variables:{cartId:t,shippingMethods:s}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:o});return n.emit("checkout/updated",i||null),i};export{f as s};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{signal as e,effect as i}from"@dropins/tools/signals.js";import{events as o}from"@dropins/tools/event-bus.js";const d={authenticated:!1,cartId:null,initialized:!1},r=new Proxy(d,{set(t,a,s){return t[a]=s,!0},get(t,a){return t[a]}}),l=e(!0),n=e({pending:!1,data:void 0});i(()=>{var t;(t=n.value.data)!=null&&t.isVirtual&&(l.value=!1)});i(()=>{const{data:t,pending:a}=n.value;r.initialized&&(a||t===void 0||o.emit("checkout/updated",t))});const f=e({pending:!1,data:void 0}),p=e({pending:!1,data:void 0}),I=e(void 0),N=e({data:void 0,pending:!1});var c=(t=>(t.EXCLUDING_TAX="EXCLUDING_TAX",t.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",t.INCLUDING_TAX="INCLUDING_TAX",t))(c||{});export{c as T,N as a,I as b,n as c,f as d,p as e,l as i,r as s};
3
+ import{signal as i,effect as e}from"@dropins/tools/signals.js";const n=i(!0),s=i({pending:!1,data:void 0});e(()=>{var a;(a=s.value.data)!=null&&a.isVirtual&&(n.value=!1)});const d=i({pending:!1,data:void 0}),l=i({pending:!1,data:void 0}),g=i(void 0),N=i({data:void 0,pending:!1});var t=(a=>(a.EXCLUDING_TAX="EXCLUDING_TAX",a.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",a.INCLUDING_TAX="INCLUDING_TAX",a))(t||{});export{t as T,N as a,d as b,s as c,l as e,n as i,g as s};
@@ -1,13 +1,13 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{s as i,d as v,a as A,c as l}from"./store-config.js";import"./ServerErrorSignal.js";import{events as s}from"@dropins/tools/event-bus.js";import{merge as a,Initializer as b}from"@dropins/tools/lib.js";import{M,d as u,k as T}from"./fetch-graphql.js";import{CHECKOUT_DATA_FRAGMENT as m,CUSTOMER_FRAGMENT as I}from"../fragments.js";const S=async(e=!1)=>{i.authenticated=e,e?await K():v.value={pending:!1,data:null}},x=e=>e==null,E=(e,t)=>e.amount.value-t.amount.value,f=e=>!(!e||!e.method_code||!e.method_title||x(e.amount.value)||!e.amount.currency),d=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(f(e))return d(e)},w=e=>{if(e)return e.filter(f).map(t=>d(t)).sort(E)},k=e=>e?!!e.code&&!!e.label:!1,z=e=>{if(!k(e))return;const{code:t,label:n,region_id:r}=e;return r?{code:t,name:n,id:r}:{code:t,name:n}},R=e=>{const{code:t,label:n}=e;return{value:t,label:n}},q=e=>e?"code"in e&&"value"in e:!1,G=e=>e.filter(q).map(t=>{const{code:n,value:r}=t;return{code:n,value:r}}),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}},O=e=>{if(e)return p(e)},P=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:n,selected_shipping_method:r,same_as_billing:o,...C}=t;return{...p(C),availableShippingMethods:w(n),selectedShippingMethod:N(r),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:n,title:r}=t;return{code:n,title:r}})},F=e=>{var n,r,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=(r=(n=_.getConfig().models)==null?void 0:n.CartModel)==null?void 0:r.transformer)==null?void 0:o.call(r,e))},U=e=>{var n,r,o;if(!e)return;const t={firstName:e.firstname||"",lastName:e.lastname||"",email:e.email||""};return a(t,(o=(r=(n=_.getConfig().models)==null?void 0:n.CustomerModel)==null?void 0:r.transformer)==null?void 0:o.call(r,e))},D=`
3
+ import{s as i,M as C,d as l,l as A}from"./fetch-graphql.js";import{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=`
4
4
  query getCart($cartId: String!) {
5
5
  cart(cart_id: $cartId) {
6
6
  ...CHECKOUT_DATA_FRAGMENT
7
7
  }
8
8
  }
9
9
 
10
- ${m}
10
+ ${u}
11
11
  `,V=`
12
12
  query getCustomerCart {
13
13
  cart: customerCart {
@@ -15,13 +15,13 @@ import{s as i,d as v,a as A,c as l}from"./store-config.js";import"./ServerErrorS
15
15
  }
16
16
  }
17
17
 
18
- ${m}
19
- `,c=async()=>{const e=i.cartId,t=i.authenticated===!1,n=t?D:V,r=t?{cartId:e}:{};if(t&&!e)throw new M;return await u({type:"query",query:n,options:{method:"POST",cache:"no-cache",variables:r},path:"cart",signalType:"cart",transformer:F})},H=`
18
+ ${u}
19
+ `,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=`
20
20
  query getCustomer {
21
21
  customer {
22
22
  ...CUSTOMER_FRAGMENT
23
23
  }
24
24
  }
25
25
 
26
- ${I}
27
- `,K=async()=>{if(i.authenticated)return await u({type:"query",query:H,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:U})},Q=()=>[s.on("authenticated",S,{eager:!0}),s.on("cart/initialized",h,{eager:!0}),s.on("cart/reset",y),s.on("cart/updated",L),s.on("checkout/initialized",()=>{i.initialized=!0})],g=new b({init:async e=>{const t=e||{};g.config.setConfig(t),A.value.data||await T()},listeners:Q}),_=g.config,h=async e=>{if(!e)i.cartId=null,l.value={pending:!1,data:null},s.emit("checkout/initialized",null);else{i.cartId=e.id;const t=await c();s.emit("checkout/initialized",t||null)}},y=()=>{i.cartId=null,l.value={pending:!1,data:null}},L=async e=>{if(!i.initialized){await h(e);return}if(e===null){y();return}i.cartId===null?(i.cartId=e.id,await c()):i.cartId===e.id&&await c()};export{ee as a,w as b,S as c,K as d,_ as e,h as f,c as g,g as i,y as r,L as s,F as t};
26
+ ${S}
27
+ `,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};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as d}from"./store-config.js";import"./ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"./fetch-graphql.js";function u(i){return i.displayName||i.name||"Component"}const h=i=>{const o=u(i),a=({hideOnEmptyCart:s=!0,hideOnVirtualCart:r=!1,...e})=>{const t=d.value.data,l=t!==void 0&&(t===null||t.isEmpty),m=!!(t!=null&&t.isVirtual),c=s&&l||r&&m,p=`conditional-${o.toLowerCase()}`;return n("div",{className:p,children:!c&&n(i,{...e})})};return a.displayName=`Conditional(${o})`,a};export{h as w};
3
+ import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as d}from"./store-config.js";import"./ServerErrorSignal.js";import"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";function u(i){return i.displayName||i.name||"Component"}const h=i=>{const o=u(i),a=({hideOnEmptyCart:s=!0,hideOnVirtualCart:r=!1,...e})=>{const t=d.value.data,l=t!==void 0&&(t===null||t.isEmpty),m=!!(t!=null&&t.isVirtual),c=s&&l||r&&m,p=`conditional-${o.toLowerCase()}`;return n("div",{className:p,children:!c&&n(i,{...e})})};return a.displayName=`Conditional(${o})`,a};export{h as w};
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent } from 'preact';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
3
 
4
- export interface PlaceOrderProps extends HTMLAttributes<HTMLButtonElement> {
4
+ export interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {
5
5
  disabled?: boolean;
6
6
  onClick: (event: Event) => Promise<void>;
7
7
  }
@@ -16,13 +16,11 @@
16
16
  *******************************************************************/
17
17
  export * from './BillToShippingAddress';
18
18
  export * from './EstimateShipping';
19
- export * from './Heading';
20
19
  export * from './LoginForm';
20
+ export * from './OrderConfirmationHeader';
21
21
  export * from './OutOfStock';
22
- export * from './OverlayLoader';
23
22
  export * from './PaymentMethods';
24
23
  export * from './PlaceOrder';
25
24
  export * from './ServerError';
26
25
  export * from './ShippingMethods';
27
- export * from './OrderConfirmationHeader';
28
26
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{i as d,c as u}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as S}from"../chunks/setBillingAddress.js";/* empty css */import{Checkbox as b,Skeleton as f,SkeletonRow as A}from"@dropins/tools/components.js";import{c as B}from"../chunks/classes.js";import{useText as x}from"@dropins/tools/i18n.js";import{w as T}from"../chunks/withConditionalRendering.js";import{useState as v,useEffect as _}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,onChange:n,disabled:s})=>{const c=x({title:"Checkout.BillToShippingAddress.title"});return r?t(y,{}):t("div",{className:"checkout-bill-to-shipping-address",children:t(b,{checked:e,className:B(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:s,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},y=()=>t(f,{className:"bill-to-shipping-address__skeleton",children:t(A,{variant:"row",size:"small"})}),k=({onChange:i})=>{var g;const[e,r]=v(!0),n=d.value,s=u.value.data,c=u.value.pending,p=!!s,m=!!(s==null?void 0:s.billingAddress),l=(g=s==null?void 0:s.shippingAddresses)==null?void 0:g[0],h=l==null?void 0:l.sameAsBilling;return _(()=>{if(!e||!p)return;r(!1);const o=h??!m;d.value=o,i==null||i(o)},[p,m,h,e,i]),t(w,{checked:n,disabled:c,loading:e,onChange:async o=>{const a=o.target.checked;d.value=a,i==null||i(a),!e&&l&&a&&await S({sameAsShipping:!0}).catch(console.error)}})};k.displayName="BillToShippingAddressContainer";const U=T(k);export{U as BillToShippingAddress,U as default};
3
+ import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/fetch-graphql.js";import{i as d,c as u}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{s as S}from"../chunks/setBillingAddress.js";/* empty css */import{Checkbox as b,Skeleton as f,SkeletonRow as A}from"@dropins/tools/components.js";import{c as B}from"../chunks/classes.js";import{useText as x}from"@dropins/tools/i18n.js";import{w as T}from"../chunks/withConditionalRendering.js";import{useState as v,useEffect as _}from"@dropins/tools/preact-compat.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,onChange:n,disabled:s})=>{const c=x({title:"Checkout.BillToShippingAddress.title"});return r?t(y,{}):t("div",{className:"checkout-bill-to-shipping-address",children:t(b,{checked:e,className:B(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:s,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},y=()=>t(f,{className:"bill-to-shipping-address__skeleton",children:t(A,{variant:"row",size:"small"})}),k=({onChange:i})=>{var g;const[e,r]=v(!0),n=d.value,s=u.value.data,c=u.value.pending,p=!!s,m=!!(s==null?void 0:s.billingAddress),l=(g=s==null?void 0:s.shippingAddresses)==null?void 0:g[0],h=l==null?void 0:l.sameAsBilling;return _(()=>{if(!e||!p)return;r(!1);const o=h??!m;d.value=o,i==null||i(o)},[p,m,h,e,i]),t(w,{checked:n,disabled:c,loading:e,onChange:async o=>{const a=o.target.checked;d.value=a,i==null||i(a),!e&&l&&a&&await S({sameAsShipping:!0}).catch(console.error)}})};k.displayName="BillToShippingAddressContainer";const U=T(k);export{U as BillToShippingAddress,U as default};