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

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.
@@ -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,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};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as k,Fragment as M,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as A,SkeletonRow as L,Price as g}from"@dropins/tools/components.js";/* empty css */import{VComponent as w,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as z}from"@dropins/tools/i18n.js";import{useState as B,useEffect as x}from"@dropins/tools/preact-hooks.js";/* empty css */import{a as G,T as C}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as f}from"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";const P=({estimated:e=!1,price:o,priceExclTax:d,taxExcluded:p=!1,taxIncluded:a=!1})=>k(M,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(l,{id:"Checkout.EstimateShipping.estimated"}):t(l,{id:"Checkout.EstimateShipping.label"})}),t(w,{node:o,className:"checkout-estimate-shipping__price"}),a&&t("span",{"data-testid":"shipping-tax-included",className:I(["checkout-estimate-shipping__caption"]),children:t(l,{id:"Checkout.EstimateShipping.withTaxes"})}),p&&k("span",{"data-testid":"shipping-tax-included-excluded",className:I(["checkout-estimate-shipping__caption"]),children:[d," ",t(l,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),U=()=>t(A,{"data-testid":"estimate-shipping-skeleton",children:t(L,{size:"xsmall"})}),W=()=>{const[e,o]=B(),d=e!==void 0,p=(e==null?void 0:e.amount.value)===0,{data:a,pending:_}=G.value,y=_||a===void 0,T=a==null?void 0:a.shoppingCartDisplaySetting.shipping,D=T===C.INCLUDING_EXCLUDING_TAX,E=T===C.INCLUDING_TAX,S=z({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});x(()=>{const i=f.on("shipping/estimate",n=>{const s=n.shippingMethod,{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!0,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/initialized",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/updated",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]);const N=()=>p?t("span",{"data-testId":"free-shipping",children:S.freeShipping}):E&&(e!=null&&e.amountInclTax)?t(g,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(g,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),v=()=>e!=null&&e.amountExclTax?t(g,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:S.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!d||y?t(U,{}):t(P,{estimated:e.estimated,price:N(),taxExcluded:D&&!p,taxIncluded:E&&!p,priceExclTax:v()})})};export{W as EstimateShipping,W as default};
3
+ import{jsxs as k,Fragment as M,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as A,SkeletonRow as L,Price as g}from"@dropins/tools/components.js";/* empty css */import{VComponent as w,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as z}from"@dropins/tools/i18n.js";import{useState as B,useEffect as x}from"@dropins/tools/preact-hooks.js";/* empty css */import{a as G,T as C}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as f}from"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";const P=({estimated:e=!1,price:o,priceExclTax:d,taxExcluded:p=!1,taxIncluded:a=!1})=>k(M,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(l,{id:"Checkout.EstimateShipping.estimated"}):t(l,{id:"Checkout.EstimateShipping.label"})}),t(w,{node:o,className:"checkout-estimate-shipping__price"}),a&&t("span",{"data-testid":"shipping-tax-included",className:I(["checkout-estimate-shipping__caption"]),children:t(l,{id:"Checkout.EstimateShipping.withTaxes"})}),p&&k("span",{"data-testid":"shipping-tax-included-excluded",className:I(["checkout-estimate-shipping__caption"]),children:[d," ",t(l,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),U=()=>t(A,{"data-testid":"estimate-shipping-skeleton",children:t(L,{size:"xsmall"})}),W=()=>{const[e,o]=B(),d=e!==void 0,p=(e==null?void 0:e.amount.value)===0,{data:a,pending:_}=G.value,D=_||a===void 0,T=a==null?void 0:a.shoppingCartDisplaySetting.shipping,N=T===C.INCLUDING_EXCLUDING_TAX,E=T===C.INCLUDING_TAX,S=z({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});x(()=>{const i=f.on("shipping/estimate",n=>{const s=n.shippingMethod,{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!0,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/initialized",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),x(()=>{const i=f.on("checkout/updated",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;o({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]);const v=()=>p?t("span",{"data-testId":"free-shipping",children:S.freeShipping}):E&&(e!=null&&e.amountInclTax)?t(g,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(g,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),y=()=>e!=null&&e.amountExclTax?t(g,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:S.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!d||D?t(U,{}):t(P,{estimated:e.estimated,price:v(),taxExcluded:N&&!p,taxIncluded:E&&!p,priceExclTax:y()})})};export{W as EstimateShipping,W as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as e,jsxs as s,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import{c as w,d as R,s as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as j}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{i as q}from"../chunks/isEmailAvailable.js";import{s as D}from"../chunks/setGuestEmailOnCart.js";import{Field as W,Input as G,Skeleton as U,SkeletonRow as x}from"@dropins/tools/components.js";/* empty css *//* empty css */import{H as J}from"../chunks/Heading.js";import{useText as b,Text as _}from"@dropins/tools/i18n.js";import{useState as p,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";/* empty css */import{w as O}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const Q=({value:t,error:i,hint:g,onChange:h,onBlur:o,onInvalid:u})=>{const m=b({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return e(W,{size:"medium",error:i,hint:g,children:e(G,{"aria-label":m.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:m.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",onBlur:o,onChange:h,onInvalid:u,placeholder:m.LoginFormPlaceholder,required:!0,type:"email",value:t})})},X=({onClick:t})=>s("div",{className:"checkout-login-form__sign-in",children:[e(_,{id:"Checkout.LoginForm.account"}),e("a",{"data-testid":"sign-in-link",className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signIn"})})]}),Y=({className:t,customerDetails:i,email:g,error:h,hint:o,loading:u=!1,name:m,onEmailBlur:f,onEmailChange:k,onEmailInvalid:E,onSignInClick:a,onSignOutClick:F,...L})=>{const l=b({Title:"Checkout.LoginForm.title"});return u?e(Z,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e(J,{level:2,className:"checkout-login-form__title",children:l.Title}),i?e(S,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(X,{onClick:d=>{d.preventDefault(),a==null||a(g)}})]}),i?s("div",{className:"checkout-login-form__customer-details",children:[e("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),e("div",{className:"checkout-login-form__customer-email",children:i.email})]}):e("div",{className:"checkout-login-form__content",children:s("form",{...L,className:j(["dropin-login-form__form",t]),name:m,noValidate:!0,children:[e("button",{type:"submit",disabled:!0,style:"display: none","aria-hidden":"true"}),e(Q,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Z=()=>s(U,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),S=({onClick:t})=>s("p",{className:"checkout-login-form__sign-out",children:[e(_,{id:"Checkout.LoginForm.switch"}),e("a",{className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signOut"})})]}),ee={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>ee.EMAIL.test(t),re=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=p(""),[m,f]=p(""),[k,E]=p(!0),[a,F]=p(!0),L=K(""),l=w.value.data,d=(l==null?void 0:l.email)||"",v=R.value.data,c=b({LoginFormInvalidEmailError:"Checkout.LoginForm.invalidEmailError",LoginFormMissingEmailError:"Checkout.LoginForm.missingEmailError",LoginFormEmailExistsAlreadyHaveAccount:"Checkout.LoginForm.emailExists.alreadyHaveAccount",LoginFormEmailExistsSignInButton:"Checkout.LoginForm.emailExists.signInButton",LoginFormEmailExistsForFasterCheckout:"Checkout.LoginForm.emailExists.forFasterCheckout"}),A=r=>r.valid?"":r.valueMissing?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,B=r=>N(r)?"":r===""?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,M=r=>{const n=r.target;u(n.value),f(""),E(!0)},T=r=>{const n=r.target;f(B(n.value))},z=r=>{const n=r.target;f(A(n.validity))};C(()=>{!a||!l||(F(!1),u(l.email||""))},[l,a]),C(()=>{if(a||V.authenticated)return;const r=setTimeout(()=>{!N(o)||o===L.current||(L.current=o,q(o).then(n=>{E(n),d!==o&&D(o).catch(console.error)}).catch(n=>{console.error(n),E(!0)}))},re);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(P,{children:[c.LoginFormEmailExistsAlreadyHaveAccount," ",e("a",{href:"#",onClick:r=>{r.preventDefault(),t==null||t(o)},children:c.LoginFormEmailExistsSignInButton})," ",c.LoginFormEmailExistsForFasterCheckout]}),$=r=>{t==null||t(N(r)?r:"")},H=v?{firstName:v.firstName,lastName:v.lastName,email:v.email}:void 0;return e(Y,{...h,customerDetails:H,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const ke=O(y);export{ke as LoginForm,ke as default};
3
+ import{jsx as e,jsxs as s,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import{s as w}from"../chunks/fetch-graphql.js";import{c as R,b as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as j}from"@dropins/tools/lib.js";import{i as q}from"../chunks/isEmailAvailable.js";import{s as D}from"../chunks/setGuestEmailOnCart.js";import{Field as W,Input as G,Skeleton as U,SkeletonRow as x}from"@dropins/tools/components.js";/* empty css *//* empty css */import{H as J}from"../chunks/Heading.js";import{useText as b,Text as _}from"@dropins/tools/i18n.js";import{useState as p,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";/* empty css */import{w as O}from"../chunks/withConditionalRendering.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const Q=({value:t,error:i,hint:g,onChange:h,onBlur:o,onInvalid:u})=>{const m=b({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return e(W,{size:"medium",error:i,hint:g,children:e(G,{"aria-label":m.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:m.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",onBlur:o,onChange:h,onInvalid:u,placeholder:m.LoginFormPlaceholder,required:!0,type:"email",value:t})})},X=({onClick:t})=>s("div",{className:"checkout-login-form__sign-in",children:[e(_,{id:"Checkout.LoginForm.account"}),e("a",{"data-testid":"sign-in-link",className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signIn"})})]}),Y=({className:t,customerDetails:i,email:g,error:h,hint:o,loading:u=!1,name:m,onEmailBlur:f,onEmailChange:k,onEmailInvalid:E,onSignInClick:a,onSignOutClick:F,...L})=>{const l=b({Title:"Checkout.LoginForm.title"});return u?e(Z,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e(J,{level:2,className:"checkout-login-form__title",children:l.Title}),i?e(S,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(X,{onClick:d=>{d.preventDefault(),a==null||a(g)}})]}),i?s("div",{className:"checkout-login-form__customer-details",children:[e("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),e("div",{className:"checkout-login-form__customer-email",children:i.email})]}):e("div",{className:"checkout-login-form__content",children:s("form",{...L,className:j(["dropin-login-form__form",t]),name:m,noValidate:!0,children:[e("button",{type:"submit",disabled:!0,style:"display: none","aria-hidden":"true"}),e(Q,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Z=()=>s(U,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),S=({onClick:t})=>s("p",{className:"checkout-login-form__sign-out",children:[e(_,{id:"Checkout.LoginForm.switch"}),e("a",{className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signOut"})})]}),ee={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>ee.EMAIL.test(t),re=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=p(""),[m,f]=p(""),[k,E]=p(!0),[a,F]=p(!0),L=K(""),l=R.value.data,d=(l==null?void 0:l.email)||"",v=V.value.data,c=b({LoginFormInvalidEmailError:"Checkout.LoginForm.invalidEmailError",LoginFormMissingEmailError:"Checkout.LoginForm.missingEmailError",LoginFormEmailExistsAlreadyHaveAccount:"Checkout.LoginForm.emailExists.alreadyHaveAccount",LoginFormEmailExistsSignInButton:"Checkout.LoginForm.emailExists.signInButton",LoginFormEmailExistsForFasterCheckout:"Checkout.LoginForm.emailExists.forFasterCheckout"}),A=r=>r.valid?"":r.valueMissing?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,B=r=>N(r)?"":r===""?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,M=r=>{const n=r.target;u(n.value),f(""),E(!0)},T=r=>{const n=r.target;f(B(n.value))},z=r=>{const n=r.target;f(A(n.validity))};C(()=>{!a||!l||(F(!1),u(l.email||""))},[l,a]),C(()=>{if(a||w.authenticated)return;const r=setTimeout(()=>{!N(o)||o===L.current||(L.current=o,q(o).then(n=>{E(n),d!==o&&D(o).catch(console.error)}).catch(n=>{console.error(n),E(!0)}))},re);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(P,{children:[c.LoginFormEmailExistsAlreadyHaveAccount," ",e("a",{href:"#",onClick:r=>{r.preventDefault(),t==null||t(o)},children:c.LoginFormEmailExistsSignInButton})," ",c.LoginFormEmailExistsForFasterCheckout]}),$=r=>{t==null||t(N(r)?r:"")},H=v?{firstName:v.firstName,lastName:v.lastName,email:v.email}:void 0;return e(Y,{...h,customerDetails:H,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const ke=O(y);export{ke as LoginForm,ke as default};
@@ -1,5 +1,7 @@
1
1
  import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components';
2
- import { Container } from '@dropins/tools/types/elsie/src/lib/types';
3
2
 
4
- export declare const MergedCartBanner: Container<AlertBannerProps>;
3
+ export declare const MergedCartBanner: {
4
+ ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs').ConditionalProps & AlertBannerProps): import("preact/compat").JSX.Element;
5
+ displayName: string;
6
+ };
5
7
  //# sourceMappingURL=MergedCartBanner.d.ts.map
@@ -1,19 +1,19 @@
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 * from './MergedCartBanner';
18
18
  export { MergedCartBanner as default } from './MergedCartBanner';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as u,Icon as g}from"@dropins/tools/components.js";import{c as p}from"../chunks/classes.js";import{events as I}from"@dropins/tools/event-bus.js";import*as i from"@dropins/tools/preact-compat.js";import{useState as h,useEffect as v}from"@dropins/tools/preact-compat.js";import{useText as B,Text as M}from"@dropins/tools/i18n.js";const w=t=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},i.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),b=({className:t,initialData:x,...c})=>{const[r,s]=h(0),a=B({mergedCartBannerItems:e(M,{id:"Checkout.MergedCartBanner.items",fields:{count:r},plural:r})});v(()=>{const n=I.on("cart/merged",o=>{var m;const l=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((d,f)=>d+f.quantity,0);l>0&&s(l)});return()=>{n==null||n.off()}},[]);const C=()=>{s(0)};return r?e(u,{...c,"aria-label":a.mergedCartBannerItems,className:p(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(g,{source:w}),message:e("span",{children:a.mergedCartBannerItems}),onDismiss:C,variant:"neutral"}):null};export{b as MergedCartBanner,b as default};
3
+ import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as u}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as B}from"@dropins/tools/event-bus.js";import*as l from"@dropins/tools/preact-compat.js";import{useState as I,useEffect as M}from"@dropins/tools/preact-compat.js";import{w as v}from"../chunks/withConditionalRendering.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";import"../chunks/store-config.js";import"@dropins/tools/signals.js";import"../chunks/ServerErrorSignal.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";const H=t=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),C=({className:t,initialData:V,...c})=>{const[r,a]=I(0),i=w({mergedCartBannerItems:e(x,{id:"Checkout.MergedCartBanner.items",fields:{count:r},plural:r})});M(()=>{const n=B.on("cart/merged",o=>{var m;const s=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((f,p)=>f+p.quantity,0);s>0&&a(s)});return()=>{n==null||n.off()}},[]);const d=()=>{a(0)};return r?e(g,{...c,"aria-label":i.mergedCartBannerItems,className:h(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(u,{source:H}),message:e("span",{children:i.mergedCartBannerItems}),onDismiss:d,variant:"neutral"}):null};C.displayName="MergedCartBannerContainer";const A=v(C);export{A as MergedCartBanner,A as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as t,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as E,Button as y,Skeleton as A,SkeletonRow as n}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import*as o from"@dropins/tools/preact-compat.js";import{useState as C,useEffect as N}from"@dropins/tools/preact-compat.js";import{Text as l}from"@dropins/tools/i18n.js";import{s as f}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"../chunks/fetch-graphql.js";import{i as b}from"../chunks/isEmailAvailable.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";function p(e){var r;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:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(c=>({attribute_code:c.code,value:c.value})))||[]}}const z=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)"})))),V=({customerName:e,isLoading:r,orderNumber:c,onSignUpClick:m})=>r?t(w,{}):h("div",{className:"order-confirmation-header order-confirmation__card",children:[t(E,{source:z,size:"64",className:"order-confirmation-header__icon"}),t("h1",{className:"order-confirmation-header__title",children:e?t(l,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:e}}):t(l,{id:"Checkout.OrderConfirmationHeader.defaultTitle"})}),c&&t("p",{className:"order-confirmation-header__order",children:t(l,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:c}})}),m&&h("div",{className:"order-confirmation-create-account",children:[t("p",{className:"order-confirmation-create-account__message",children:t(l,{id:"Checkout.OrderConfirmationHeader.CreateAccount.message"})}),t(y,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:m,children:t(l,{id:"Checkout.OrderConfirmationHeader.CreateAccount.button"})})]})]}),w=()=>h(A,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[t(n,{variant:"empty",size:"xlarge",fullWidth:!0}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{size:"small",fullWidth:!0}),t(n,{variant:"heading",size:"xsmall",fullWidth:!0})]}),J=({orderData:e,onSignUpClick:r})=>{var g;const[c,m]=C(!f.authenticated),[v,s]=C();N(()=>{f.authenticated||b(e.email).then(a=>s(!a)).catch(()=>s(!0)).finally(()=>m(!1))},[e.email]);const _=r&&!f.authenticated&&v===!1?()=>{const a=e.shippingAddress,i=e.billingAddress,L=[{code:"firstname",defaultValue:(i==null?void 0:i.firstName)||""},{code:"lastname",defaultValue:(i==null?void 0:i.lastName)||""},{code:"email",defaultValue:e.email||""}];let u;if(a){const k={...p(a),default_shipping:!0};u=[{...p(i),default_billing:!0},k]}else u=[{...p(i),default_billing:!0,default_shipping:!0}];r({inputsDefaultValueSet:L,addressesData:u})}:void 0;return t("div",{children:t(V,{customerName:(g=e.billingAddress)==null?void 0:g.firstName,isLoading:c,onSignUpClick:_,orderNumber:e.number})})};export{J as OrderConfirmationHeader,J as default};
3
+ import{jsx as t,jsxs as s}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as A,Button as E,Skeleton as y,SkeletonRow as n}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{H as N}from"../chunks/Heading.js";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 H,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(e){var r;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:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(c=>({attribute_code:c.code,value:c.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)"})))),w=({customerName:e,isLoading:r,orderNumber:c,onSignUpClick:a})=>{const l=H({title:t(v,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:e}}),defaultTitle:"Checkout.OrderConfirmationHeader.defaultTitle",order:t(v,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:c}}),createAccountMessage:"Checkout.OrderConfirmationHeader.CreateAccount.message",createAccountButton:"Checkout.OrderConfirmationHeader.CreateAccount.button"});return r?t(x,{}):s("div",{className:"order-confirmation-header order-confirmation__card",children:[t(A,{source:V,size:"64",className:"order-confirmation-header__icon"}),t(N,{level:1,className:"order-confirmation-header__title",children:e?l.title:l.defaultTitle}),c&&t("p",{className:"order-confirmation-header__order",children:l.order}),a&&s("div",{className:"order-confirmation-create-account",children:[t("p",{className:"order-confirmation-create-account__message",children:l.createAccountMessage}),t(E,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:a,children:l.createAccountButton})]})]})},x=()=>s(y,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[t(n,{variant:"empty",size:"xlarge",fullWidth:!0}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{size:"small",fullWidth:!0}),t(n,{variant:"heading",size:"xsmall",fullWidth:!0})]}),U=({orderData:e,onSignUpClick:r})=>{var g;const[c,a]=C(!f.authenticated),[l,h]=C();b(()=>{f.authenticated||z(e.email).then(m=>h(!m)).catch(()=>h(!0)).finally(()=>a(!1))},[e.email]);const _=r&&!f.authenticated&&l===!1?()=>{const m=e.shippingAddress,i=e.billingAddress,L=[{code:"firstname",defaultValue:(i==null?void 0:i.firstName)||""},{code:"lastname",defaultValue:(i==null?void 0:i.lastName)||""},{code:"email",defaultValue:e.email||""}];let u;if(m){const k={...p(m),default_shipping:!0};u=[{...p(i),default_billing:!0},k]}else u=[{...p(i),default_billing:!0,default_shipping:!0}];r({inputsDefaultValueSet:L,addressesData:u})}:void 0;return t("div",{children:t(w,{customerName:(g=e.billingAddress)==null?void 0:g.firstName,isLoading:c,onSignUpClick:_,orderNumber:e.number})})};export{U as OrderConfirmationHeader,U as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as n,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as k,Icon as l,Image as h}from"@dropins/tools/components.js";/* empty css */import{classes as O}from"@dropins/tools/lib.js";import{S as d}from"../chunks/OrderError.js";import{useText as S}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{events as p}from"@dropins/tools/event-bus.js";import{useState as v,useCallback as _,useEffect as g}from"@dropins/tools/preact-compat.js";const N=({className:i,items:r,onRemoveOutOfStock:o,routeCart:a,...m})=>{const s=S({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n("h4",{className:"checkout-out-of-stock__title",children:[e(l,{source:d,size:"16",stroke:"1"}),s.title]}),e("p",{className:"checkout-out-of-stock__message",children:s.message}),e("ol",{className:"checkout-out-of-stock__items",children:r.map(u=>e("li",{"data-testid":"out-of-stock-item",className:"checkout-out-of-stock__item",children:e(h,{loading:"eager",src:u.image.src,alt:u.image.alt,width:"100",height:"100",params:{width:100}})},u.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[a&&e("a",{"data-testid":"review-cart",className:"checkout-out-of-stock__action",href:a,children:s.reviewCart}),o&&e("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:o,children:s.removeOutOfStock})]})]})},z=({onCartProductsUpdate:i,routeCart:r})=>{const[o,a]=v([]),m=t=>t.outOfStock||t.insufficientQuantity,s=_(()=>{if(!i)return;const t=o.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));i(t)},[o,i]);if(g(()=>{const t=p.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];a(f.filter(m))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const u=!o.some(t=>t.insufficientQuantity);return e(N,{items:o,onRemoveOutOfStock:u?s:void 0,routeCart:r==null?void 0:r()})};export{z as OutOfStock,z as default};
3
+ import{jsxs as n,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as k,Icon as l,Image as h}from"@dropins/tools/components.js";/* empty css */import{classes as O}from"@dropins/tools/lib.js";import{H as d}from"../chunks/Heading.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{S as p}from"../chunks/OrderError.js";import{useText as S}from"@dropins/tools/i18n.js";import{events as v}from"@dropins/tools/event-bus.js";import{useState as g,useCallback as _,useEffect as N}from"@dropins/tools/preact-compat.js";const w=({className:i,items:r,onRemoveOutOfStock:o,routeCart:a,...m})=>{const s=S({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n(d,{level:4,className:"checkout-out-of-stock__title",children:[e(l,{source:p,size:"16",stroke:"1"}),s.title]}),e("p",{className:"checkout-out-of-stock__message",children:s.message}),e("ol",{className:"checkout-out-of-stock__items",children:r.map(u=>e("li",{"data-testid":"out-of-stock-item",className:"checkout-out-of-stock__item",children:e(h,{loading:"eager",src:u.image.src,alt:u.image.alt,width:"100",height:"100",params:{width:100}})},u.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[a&&e("a",{"data-testid":"review-cart",className:"checkout-out-of-stock__action",href:a,children:s.reviewCart}),o&&e("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:o,children:s.removeOutOfStock})]})]})},T=({onCartProductsUpdate:i,routeCart:r})=>{const[o,a]=g([]),m=t=>t.outOfStock||t.insufficientQuantity,s=_(()=>{if(!i)return;const t=o.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));i(t)},[o,i]);if(N(()=>{const t=v.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];a(f.filter(m))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const u=!o.some(t=>t.insufficientQuantity);return e(w,{items:o,onRemoveOutOfStock:u?s:void 0,routeCart:r==null?void 0:r()})};export{T as OutOfStock,T as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as n,jsxs as M,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{c as C,s as D}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as H,Slot as L}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as $}from"../chunks/setPaymentMethod.js";/* empty css */import{IllustratedMessage as B,Icon as U,ProgressSpinner as Z,ToggleButton as F,Skeleton as q,SkeletonRow as y}from"@dropins/tools/components.js";/* empty css */import{H as G}from"../chunks/Heading.js";import{useRef as J}from"@dropins/tools/preact-hooks.js";/* empty css */import*as g from"@dropins/tools/preact-compat.js";import{useState as S,useCallback as T,useEffect as w}from"@dropins/tools/preact-compat.js";import{useText as K}from"@dropins/tools/i18n.js";import{w as Q}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const X=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Y=({code:e,loading:a,selected:r,onChange:d,title:h})=>n(F,{className:"checkout-payment-methods__method",label:h,name:"payment-method",value:e,selected:r,onChange:d,busy:a}),ee=({className:e,paymentMethodContent:a,loading:r=!1,initializing:d=!1,onChange:h=()=>{},options:s,selection:k})=>{const o=K({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return d?n(te,{}):M("div",{className:H(["checkout-payment-methods",e]),children:[n(G,{level:2,className:"checkout-payment-methods__title",children:o.Title}),!r&&s.length===0&&n(B,{icon:n(U,{source:X}),message:n("p",{children:o.EmptyState})}),M("div",{className:H(["checkout-payment-methods__wrapper"]),children:[r&&n(Z,{className:"checkout-payment-methods__spinner"}),n("div",{className:H(["checkout-payment-methods__methods",["checkout-payment-methods--loading",r],["checkout-payment-methods--full-width",s.length%2!==0]]),children:s==null?void 0:s.map(i=>n(Y,{code:i.code,onChange:h,selected:i.code===k,title:i.title},i.code))}),a&&n("div",{className:"checkout-payment-methods__content",children:a})]})]})},te=()=>M(q,{"data-testid":"payment-methods-skeleton",children:[n(y,{variant:"heading",size:"medium"}),n(y,{variant:"empty",size:"medium"}),n(y,{size:"xlarge",fullWidth:!0}),n(y,{size:"xlarge",fullWidth:!0})]}),N={free:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)},checkmo:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)}},ne=(e,a)=>{const r=J(e);return a(r.current,e)||(r.current=e),r.current},V=({slots:e})=>{var x,_;const[a,r]=S(),[d,h]=S(N),[s,k]=S(!0),o=C.value.data,i=!!C.value.data,W=C.value.pending,j=(o==null?void 0:o.isVirtual)??!1,z=(x=o==null?void 0:o.shippingAddresses)==null?void 0:x[0],A=(o==null?void 0:o.availablePaymentMethods)||[],l=(_=o==null?void 0:o.selectedPaymentMethod)==null?void 0:_.code,E=j?!0:!!z,m=ne(A,(t,c)=>t.length!==c.length?!1:t.every((p,v)=>p.code===c[v].code)),u=T(t=>{r(t),!(!t||!E)&&t!==l&&$(t).catch(console.error)},[E,l]);w(()=>{if(!i)return;if(!!!(m!=null&&m.length)){u(void 0);return}const c=m[0].code;if(!l){u(c);return}const p=m.some(v=>v.code===l);u(p?l:c)},[m,i,l,u]);const I=t=>{u(t)},b=T((t,c)=>{if(!t){console.warn("Payment method handler is ignored because it has no code");return}if(!c){console.warn("Payment method handler is ignored because it is empty");return}h(p=>({...p,[t]:c}))},[]);w(()=>{e!=null&&e.Handlers&&Object.entries(e.Handlers).forEach(([t,c])=>{b(t,c)})},[b,e==null?void 0:e.Handlers]);const f=e!=null&&e.Main?n(L,{name:"PaymentMethods",slot:e==null?void 0:e.Main,context:{replaceHTML(t){this.replaceWith(t),k(!1)}}}):null,P=a?d[a]:null,O=P?n(L,{name:"PaymentMethodContent",slot:P,context:{cartId:D.cartId||"",replaceHTML(t){this.replaceWith(t)}}},P):void 0;return w(()=>{!s&&d!=N&&console.warn("Payment method handlers you have added are ignored because the default content has been replaced")},[s,d]),M(R,{children:[f&&n(f.type,{ref:f.ref,...f.props}),s&&n(ee,{initializing:i===!1,loading:i&&W,onChange:I,options:m,paymentMethodContent:O,selection:a})]})};V.displayName="PaymentMethodsContainer";const He=Q(V);export{He as PaymentMethods,He as default};
3
+ import{jsx as n,jsxs as M,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{s as D}from"../chunks/fetch-graphql.js";import{c as C}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as H,Slot as L}from"@dropins/tools/lib.js";import{s as $}from"../chunks/setPaymentMethod.js";/* empty css */import{IllustratedMessage as B,Icon as U,ProgressSpinner as Z,ToggleButton as F,Skeleton as q,SkeletonRow as y}from"@dropins/tools/components.js";/* empty css */import{H as G}from"../chunks/Heading.js";import{useRef as J}from"@dropins/tools/preact-hooks.js";/* empty css */import*as g from"@dropins/tools/preact-compat.js";import{useState as S,useCallback as T,useEffect as w}from"@dropins/tools/preact-compat.js";import{useText as K}from"@dropins/tools/i18n.js";import{w as Q}from"../chunks/withConditionalRendering.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const X=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Y=({code:e,loading:a,selected:r,onChange:d,title:h})=>n(F,{className:"checkout-payment-methods__method",label:h,name:"payment-method",value:e,selected:r,onChange:d,busy:a}),ee=({className:e,paymentMethodContent:a,loading:r=!1,initializing:d=!1,onChange:h=()=>{},options:c,selection:k})=>{const o=K({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return d?n(te,{}):M("div",{className:H(["checkout-payment-methods",e]),children:[n(G,{level:2,className:"checkout-payment-methods__title",children:o.Title}),!r&&c.length===0&&n(B,{icon:n(U,{source:X}),message:n("p",{children:o.EmptyState})}),M("div",{className:H(["checkout-payment-methods__wrapper"]),children:[r&&n(Z,{className:"checkout-payment-methods__spinner"}),n("div",{className:H(["checkout-payment-methods__methods",["checkout-payment-methods--loading",r],["checkout-payment-methods--full-width",c.length%2!==0]]),children:c==null?void 0:c.map(i=>n(Y,{code:i.code,onChange:h,selected:i.code===k,title:i.title},i.code))}),a&&n("div",{className:"checkout-payment-methods__content",children:a})]})]})},te=()=>M(q,{"data-testid":"payment-methods-skeleton",children:[n(y,{variant:"heading",size:"medium"}),n(y,{variant:"empty",size:"medium"}),n(y,{size:"xlarge",fullWidth:!0}),n(y,{size:"xlarge",fullWidth:!0})]}),N={free:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)},checkmo:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)}},ne=(e,a)=>{const r=J(e);return a(r.current,e)||(r.current=e),r.current},V=({slots:e})=>{var x,_;const[a,r]=S(),[d,h]=S(N),[c,k]=S(!0),o=C.value.data,i=!!C.value.data,W=C.value.pending,j=(o==null?void 0:o.isVirtual)??!1,z=(x=o==null?void 0:o.shippingAddresses)==null?void 0:x[0],A=(o==null?void 0:o.availablePaymentMethods)||[],l=(_=o==null?void 0:o.selectedPaymentMethod)==null?void 0:_.code,E=j?!0:!!z,m=ne(A,(t,s)=>t.length!==s.length?!1:t.every((p,v)=>p.code===s[v].code)),u=T(t=>{r(t),!(!t||!E)&&t!==l&&$(t).catch(console.error)},[E,l]);w(()=>{if(!i)return;if(!!!(m!=null&&m.length)){u(void 0);return}const s=m[0].code;if(!l){u(s);return}const p=m.some(v=>v.code===l);u(p?l:s)},[m,i,l,u]);const I=t=>{u(t)},b=T((t,s)=>{if(!t){console.warn("Payment method handler is ignored because it has no code");return}if(!s){console.warn("Payment method handler is ignored because it is empty");return}h(p=>({...p,[t]:s}))},[]);w(()=>{e!=null&&e.Handlers&&Object.entries(e.Handlers).forEach(([t,s])=>{b(t,s)})},[b,e==null?void 0:e.Handlers]);const f=e!=null&&e.Main?n(L,{name:"PaymentMethods",slot:e==null?void 0:e.Main,context:{replaceHTML(t){this.replaceWith(t),k(!1)}}}):null,P=a?d[a]:null,O=P?n(L,{name:"PaymentMethodContent",slot:P,context:{cartId:D.cartId||"",replaceHTML(t){this.replaceWith(t)}}},P):void 0;return w(()=>{!c&&d!=N&&console.warn("Payment method handlers you have added are ignored because the default content has been replaced")},[c,d]),M(R,{children:[f&&n(f.type,{ref:f.ref,...f.props}),c&&n(ee,{initializing:i===!1,loading:i&&W,onChange:I,options:m,paymentMethodContent:O,selection:a})]})};V.displayName="PaymentMethodsContainer";const He=Q(V);export{He as PaymentMethods,He as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{c as x}from"../chunks/store-config.js";import{s as E}from"../chunks/ServerErrorSignal.js";import{events as g}from"@dropins/tools/event-bus.js";import{classes as u}from"@dropins/tools/lib.js";import{U as P}from"../chunks/fetch-graphql.js";import{p as v}from"../chunks/placeOrder2.js";/* empty css */import{Button as S}from"@dropins/tools/components.js";import{Text as b,useText as U}from"@dropins/tools/i18n.js";import{w}from"../chunks/withConditionalRendering.js";import{useState as T,useCallback as l,useEffect as z}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const H=({className:e,onClick:t,disabled:n=!1})=>s("div",{className:u(["checkout-place-order",e]),children:s(S,{className:u(["checkout-place-order__button",e]),"data-testid":"place-order-button",disabled:n,onClick:t,size:"medium",type:"submit",variant:"primary",children:s(b,{id:"Checkout.PlaceOrder.button"})},"placeOrder")}),I=e=>e instanceof TypeError||e instanceof P,f=({handleValidation:e,onPlaceOrder:t})=>{var d;const[n,h]=T(!1),{data:c,pending:O}=x.value,k=!!c,a=((d=c==null?void 0:c.selectedPaymentMethod)==null?void 0:d.code)||"",i=U({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),m=l(r=>{const o=I(r)?i.CheckoutUnexpectedError:r.message;E.value=o},[i]),C=l(async()=>{try{if(!(e?e():!0))return;t?await t({code:a}):await v()}catch(r){m(r)}},[e,t,a,m]);return z(()=>{const r=g.on("cart/initialized",o=>{const y=(o==null?void 0:o.items)||[];h(y.some(p=>p.outOfStock||p.insufficientQuantity))},{eager:!0});return()=>{r==null||r.off()}},[]),s(H,{onClick:C,disabled:!k||O||n})};f.displayName="PlaceOrderContainer";const W=w(f);export{W as PlaceOrder,W as default};
3
+ import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{U as y}from"../chunks/fetch-graphql.js";import{c as E}from"../chunks/store-config.js";import{s as P}from"../chunks/ServerErrorSignal.js";import{events as g}from"@dropins/tools/event-bus.js";import{classes as l}from"@dropins/tools/lib.js";import{p as v}from"../chunks/placeOrder2.js";/* empty css */import{Button as S}from"@dropins/tools/components.js";import{Text as b,useText as U}from"@dropins/tools/i18n.js";import{w}from"../chunks/withConditionalRendering.js";import{useState as T,useCallback as u,useEffect as z}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 H=({className:e,onClick:t,disabled:s=!1})=>c("div",{className:l(["checkout-place-order",e]),children:c(S,{className:l(["checkout-place-order__button",e]),"data-testid":"place-order-button",disabled:s,onClick:t,size:"medium",type:"submit",variant:"primary",children:c(b,{id:"Checkout.PlaceOrder.button"})},"placeOrder")}),I=e=>e instanceof TypeError||e instanceof y,f=({handleValidation:e,onPlaceOrder:t})=>{var d;const[s,h]=T(!1),{data:o,pending:O}=E.value,k=!!o,a=((d=o==null?void 0:o.selectedPaymentMethod)==null?void 0:d.code)||"",i=U({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),m=u(r=>{P.value=I(r)?i.CheckoutUnexpectedError:r.message},[i]),C=u(async()=>{try{if(!(e?e():!0))return;t?await t({code:a}):await v()}catch(r){m(r)}},[e,t,a,m]);return z(()=>{const r=g.on("cart/initialized",n=>{const x=(n==null?void 0:n.items)||[];h(x.some(p=>p.outOfStock||p.insufficientQuantity))},{eager:!0});return()=>{r==null||r.off()}},[]),c(H,{onClick:C,disabled:!k||O||s})};f.displayName="PlaceOrderContainer";const W=w(f);export{W as PlaceOrder,W as default};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as i,jsxs as L,Fragment as z}from"@dropins/tools/preact-jsx-runtime.js";import{b as v,e as M,c as W,a as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as T}from"@dropins/tools/event-bus.js";import{classes as j,Slot as A}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as O}from"../chunks/setShippingMethods.js";/* empty css */import{IllustratedMessage as P,Icon as Z,ProgressSpinner as $,RadioButton as q,Price as F,Skeleton as G,SkeletonRow as _}from"@dropins/tools/components.js";/* empty css */import{H as J}from"../chunks/Heading.js";import{useState as I,useEffect as S}from"@dropins/tools/preact-hooks.js";/* empty css */import*as p from"@dropins/tools/preact-compat.js";import{useCallback as K,useMemo as Q,useEffect as X}from"@dropins/tools/preact-compat.js";import{useText as Y}from"@dropins/tools/i18n.js";import{w as D}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const U=e=>({countryCode:e.country_id,postCode:e.postcode||"",...e.region_id?{regionId:Number(e.region_id)}:{...e.region?{region:e.region}:{}}}),ee=e=>({carrierCode:e.carrier.code||"",methodCode:e.code||"",amount:e.amount,amountExclTax:e.amountExclTax,amountInclTax:e.amountInclTax}),te=e=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),oe=({className:e,isLoading:t=!1,onSelectionChange:o=()=>{},options:s,selection:u,...a})=>{const c=Y({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return s===void 0?i(ne,{}):L("div",{...a,className:j(["checkout-shipping-methods",e]),children:[i(J,{level:3,className:"checkout-shipping-methods__title",children:c.Title}),!t&&s.length===0&&i(P,{icon:i(Z,{source:te}),message:i("p",{children:c.EmptyState})}),L("div",{className:j(["checkout-shipping-methods__content"]),children:[t&&i($,{className:"checkout-shipping-methods__spinner"}),i("div",{className:j(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:s.map(n=>i(q,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:n.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:L(z,{children:[i(F,{amount:n.amount.value,currency:n.amount.currency})," ",i("span",{children:n.carrier.title})]}),description:n.title,value:n.value,checked:(u==null?void 0:u.value)===n.value,onChange:()=>o(n)},n.value))})]})]})},ne=()=>L(G,{"data-testid":"shipping-methods-skeleton",children:[i(_,{variant:"heading",size:"small"}),i(_,{variant:"empty",size:"small"}),i(_,{size:"medium",fullWidth:!0}),i(_,{size:"medium",fullWidth:!0})]});function ie(){var C;const[e,t]=I(),[o,s]=I();S(()=>{T.on("checkout/estimate-shipping-address",({address:x,isValid:g})=>{t({address:x,isValid:g})})},[]),S(()=>{s(v.value)},[v.value]),S(()=>{M.value.pending?s(void 0):s(v.value)},[M.value.pending]);const{country_id:u,region_id:a,region:c,postcode:n}=(e==null?void 0:e.address)||{},f=!!e,r=W.value.data,k=!!((C=r==null?void 0:r.shippingAddresses)!=null&&C[0]),l=e==null?void 0:e.isValid;S(()=>{k||l||!o||!f||T.emit("shipping/estimate",{address:U({country_id:u,region_id:a,region:c,postcode:n}),shippingMethod:ee(o)})},[o,u,a,c,n,f,k,l])}const H=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function re({onCheckoutDataUpdate:e,preSelectedMethod:t,onShippingMethodSelect:o}){const u=!V.value.data,a=W.value.data,c=W.value.pending,n=M.value.data,f=M.value.pending,r=v.value,k=a==null?void 0:a.shippingAddresses,l=k==null?void 0:k[0],C=!!l,x=l==null?void 0:l.availableShippingMethods,g=l==null?void 0:l.selectedShippingMethod,d=x||n,b=K(h=>{if(!C)return;const E={method_code:h.code,carrier_code:h.carrier.code};O([E]).then(()=>{e==null||e()}).catch(y=>{console.error("setting shipping methods on cart failed:",y)})},[C,e]),R=h=>{v.value=h,o==null||o(h)},m=Q(()=>{if(!(d!=null&&d.length))return;const h=d[0],E=r||g;return E?d.some(w=>H(w,E))?E:h:d.find(N=>N.carrier.code===(t==null?void 0:t.carrierCode)&&N.code===(t==null?void 0:t.methodCode))||h},[r,g,d,t]);return X(()=>{m&&((!r||!H(m,r))&&(v.value=m,o==null||o(m)),(!g||!H(m,g))&&b(m))},[m,r,g,b,o]),{isLoading:c||u||f,options:d,selection:m,onSelectionChange:R}}const B=({preSelectedMethod:e,onCheckoutDataUpdate:t,shippingMethodsSlot:o,onShippingMethodSelect:s,initialData:u,...a})=>{const{isLoading:c,options:n,selection:f,onSelectionChange:r}=re({preSelectedMethod:e,onCheckoutDataUpdate:t,onShippingMethodSelect:s});return ie(),L(z,{children:[i(oe,{...a,isLoading:c,onSelectionChange:r,options:n,selection:f}),!c&&o&&i(A,{name:"ShippingMethods",slot:o})]})};B.displayName="ShippingMethodsContainer";const je=D(B);export{je as ShippingMethods,je as default};
3
+ import{jsx as i,jsxs as L,Fragment as z}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/fetch-graphql.js";import{s as v,e as M,c as W,a as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as T}from"@dropins/tools/event-bus.js";import{classes as j,Slot as A}from"@dropins/tools/lib.js";import{s as O}from"../chunks/setShippingMethods.js";/* empty css */import{IllustratedMessage as P,Icon as Z,ProgressSpinner as $,RadioButton as q,Price as F,Skeleton as G,SkeletonRow as _}from"@dropins/tools/components.js";/* empty css */import{H as J}from"../chunks/Heading.js";import{useState as I,useEffect as S}from"@dropins/tools/preact-hooks.js";/* empty css */import*as p from"@dropins/tools/preact-compat.js";import{useCallback as K,useMemo as Q,useEffect as X}from"@dropins/tools/preact-compat.js";import{useText as Y}from"@dropins/tools/i18n.js";import{w as D}from"../chunks/withConditionalRendering.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const U=e=>({countryCode:e.country_id,postCode:e.postcode||"",...e.region_id?{regionId:Number(e.region_id)}:{...e.region?{region:e.region}:{}}}),ee=e=>({carrierCode:e.carrier.code||"",methodCode:e.code||"",amount:e.amount,amountExclTax:e.amountExclTax,amountInclTax:e.amountInclTax}),te=e=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),oe=({className:e,isLoading:t=!1,onSelectionChange:o=()=>{},options:s,selection:u,...a})=>{const c=Y({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return s===void 0?i(ne,{}):L("div",{...a,className:j(["checkout-shipping-methods",e]),children:[i(J,{level:3,className:"checkout-shipping-methods__title",children:c.Title}),!t&&s.length===0&&i(P,{icon:i(Z,{source:te}),message:i("p",{children:c.EmptyState})}),L("div",{className:j(["checkout-shipping-methods__content"]),children:[t&&i($,{className:"checkout-shipping-methods__spinner"}),i("div",{className:j(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:s.map(n=>i(q,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:n.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:L(z,{children:[i(F,{amount:n.amount.value,currency:n.amount.currency})," ",i("span",{children:n.carrier.title})]}),description:n.title,value:n.value,checked:(u==null?void 0:u.value)===n.value,onChange:()=>o(n)},n.value))})]})]})},ne=()=>L(G,{"data-testid":"shipping-methods-skeleton",children:[i(_,{variant:"heading",size:"small"}),i(_,{variant:"empty",size:"small"}),i(_,{size:"medium",fullWidth:!0}),i(_,{size:"medium",fullWidth:!0})]});function ie(){var C;const[e,t]=I(),[o,s]=I();S(()=>{T.on("checkout/estimate-shipping-address",({address:x,isValid:g})=>{t({address:x,isValid:g})})},[]),S(()=>{s(v.value)},[v.value]),S(()=>{M.value.pending?s(void 0):s(v.value)},[M.value.pending]);const{country_id:u,region_id:a,region:c,postcode:n}=(e==null?void 0:e.address)||{},f=!!e,r=W.value.data,k=!!((C=r==null?void 0:r.shippingAddresses)!=null&&C[0]),l=e==null?void 0:e.isValid;S(()=>{k||l||!o||!f||T.emit("shipping/estimate",{address:U({country_id:u,region_id:a,region:c,postcode:n}),shippingMethod:ee(o)})},[o,u,a,c,n,f,k,l])}const H=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function re({onCheckoutDataUpdate:e,preSelectedMethod:t,onShippingMethodSelect:o}){const u=!V.value.data,a=W.value.data,c=W.value.pending,n=M.value.data,f=M.value.pending,r=v.value,k=a==null?void 0:a.shippingAddresses,l=k==null?void 0:k[0],C=!!l,x=l==null?void 0:l.availableShippingMethods,g=l==null?void 0:l.selectedShippingMethod,d=x||n,b=K(h=>{if(!C)return;const E={method_code:h.code,carrier_code:h.carrier.code};O([E]).then(()=>{e==null||e()}).catch(w=>{console.error("setting shipping methods on cart failed:",w)})},[C,e]),R=h=>{v.value=h,o==null||o(h)},m=Q(()=>{if(!(d!=null&&d.length))return;const h=d[0],E=r||g;return E?d.some(y=>H(y,E))?E:h:d.find(N=>N.carrier.code===(t==null?void 0:t.carrierCode)&&N.code===(t==null?void 0:t.methodCode))||h},[r,g,d,t]);return X(()=>{m&&((!r||!H(m,r))&&(v.value=m,o==null||o(m)),(!g||!H(m,g))&&b(m))},[m,r,g,b,o]),{isLoading:c||u||f,options:d,selection:m,onSelectionChange:R}}const B=({preSelectedMethod:e,onCheckoutDataUpdate:t,shippingMethodsSlot:o,onShippingMethodSelect:s,initialData:u,...a})=>{const{isLoading:c,options:n,selection:f,onSelectionChange:r}=re({preSelectedMethod:e,onCheckoutDataUpdate:t,onShippingMethodSelect:s});return ie(),L(z,{children:[i(oe,{...a,isLoading:c,onSelectionChange:r,options:n,selection:f}),!c&&o&&i(A,{name:"ShippingMethods",slot:o})]})};B.displayName="ShippingMethodsContainer";const je=D(B);export{je as ShippingMethods,je as default};
package/fragments.js CHANGED
@@ -93,7 +93,7 @@ const e=`
93
93
  }
94
94
  same_as_billing
95
95
  }
96
- `,a=`
96
+ `,d=`
97
97
  fragment CHECKOUT_DATA_FRAGMENT on Cart {
98
98
  id
99
99
  is_virtual
@@ -117,10 +117,256 @@ const e=`
117
117
 
118
118
  ${e}
119
119
  ${t}
120
- `,_=`
120
+ `,l=`
121
121
  fragment CUSTOMER_FRAGMENT on Customer {
122
122
  firstname
123
123
  lastname
124
124
  email
125
125
  }
126
- `;export{a as CHECKOUT_DATA_FRAGMENT,_ as CUSTOMER_FRAGMENT};
126
+ `,r=`
127
+ fragment ORDER_ADDRESS_FRAGMENT on OrderAddress {
128
+ city
129
+ company
130
+ country_code
131
+ fax
132
+ firstname
133
+ lastname
134
+ middlename
135
+ postcode
136
+ prefix
137
+ region
138
+ region_id
139
+ street
140
+ suffix
141
+ telephone
142
+ vat_id
143
+ custom_attributesV2 {
144
+ code
145
+ ... on AttributeValue {
146
+ value
147
+ }
148
+ }
149
+ }
150
+ `,a=`
151
+ fragment PRODUCT_FRAGMENT on ProductInterface {
152
+ __typename
153
+ canonical_url
154
+ uid
155
+ name
156
+ sku
157
+ only_x_left_in_stock
158
+ stock_status
159
+ image {
160
+ url
161
+ }
162
+ thumbnail {
163
+ label
164
+ url
165
+ }
166
+ price_range {
167
+ maximum_price {
168
+ regular_price {
169
+ currency
170
+ value
171
+ }
172
+ }
173
+ }
174
+ }
175
+ `,_=`
176
+ fragment PRICE_FRAGMENT on OrderItemInterface {
177
+ prices {
178
+ price_including_tax {
179
+ value
180
+ currency
181
+ }
182
+ original_price {
183
+ value
184
+ currency
185
+ }
186
+ original_price_including_tax {
187
+ value
188
+ currency
189
+ }
190
+ price {
191
+ value
192
+ currency
193
+ }
194
+ }
195
+ }
196
+ `,n=`
197
+ fragment GIFT_CARD_FRAGMENT on GiftCardOrderItem {
198
+ ...PRICE_FRAGMENT
199
+ gift_message {
200
+ message
201
+ }
202
+ gift_card {
203
+ recipient_name
204
+ recipient_email
205
+ sender_name
206
+ sender_email
207
+ message
208
+ }
209
+ }
210
+ `,i=`
211
+ fragment ORDER_ITEM_FRAGMENT on OrderItemInterface {
212
+ __typename
213
+ status
214
+ product_name
215
+ id
216
+ quantity_ordered
217
+ quantity_shipped
218
+ quantity_canceled
219
+ quantity_invoiced
220
+ quantity_refunded
221
+ quantity_returned
222
+ product_sale_price {
223
+ value
224
+ currency
225
+ }
226
+ selected_options {
227
+ label
228
+ value
229
+ }
230
+ product {
231
+ ...PRODUCT_FRAGMENT
232
+ }
233
+ ...PRICE_FRAGMENT
234
+ }
235
+ `,c=`
236
+ fragment BUNDLE_ORDER_ITEM_FRAGMENT on BundleOrderItem {
237
+ ...PRICE_FRAGMENT
238
+ bundle_options {
239
+ uid
240
+ label
241
+ values {
242
+ uid
243
+ product_name
244
+ }
245
+ }
246
+ }
247
+ `,o=`
248
+ fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {
249
+ grand_total {
250
+ value
251
+ currency
252
+ }
253
+ total_giftcard {
254
+ currency
255
+ value
256
+ }
257
+ subtotal {
258
+ currency
259
+ value
260
+ }
261
+ taxes {
262
+ amount {
263
+ currency
264
+ value
265
+ }
266
+ rate
267
+ }
268
+ total_tax {
269
+ currency
270
+ value
271
+ }
272
+ total_shipping {
273
+ currency
274
+ value
275
+ }
276
+ discounts {
277
+ amount {
278
+ currency
279
+ value
280
+ }
281
+ label
282
+ }
283
+ }
284
+ `,u=`
285
+ fragment ORDER_FRAGMENT on CustomerOrder {
286
+ email
287
+ id
288
+ number
289
+ order_date
290
+ order_status_change_date
291
+ status
292
+ token
293
+ carrier
294
+ shipping_method
295
+ printed_card_included
296
+ gift_receipt_included
297
+ available_actions
298
+ is_virtual
299
+ payment_methods {
300
+ name
301
+ type
302
+ }
303
+ applied_coupons {
304
+ code
305
+ }
306
+ shipments {
307
+ id
308
+ tracking {
309
+ title
310
+ number
311
+ carrier
312
+ }
313
+ comments {
314
+ message
315
+ timestamp
316
+ }
317
+ items {
318
+ id
319
+ product_sku
320
+ product_name
321
+ order_item {
322
+ ...ORDER_ITEM_FRAGMENT
323
+ ... on GiftCardOrderItem {
324
+ ...GIFT_CARD_FRAGMENT
325
+ product {
326
+ ...PRODUCT_FRAGMENT
327
+ }
328
+ }
329
+ }
330
+ }
331
+ }
332
+ payment_methods {
333
+ name
334
+ type
335
+ }
336
+ shipping_address {
337
+ ...ORDER_ADDRESS_FRAGMENT
338
+ }
339
+ billing_address {
340
+ ...ORDER_ADDRESS_FRAGMENT
341
+ }
342
+ items {
343
+ ...ORDER_ITEM_FRAGMENT
344
+ ... on BundleOrderItem {
345
+ ...BUNDLE_ORDER_ITEM_FRAGMENT
346
+ }
347
+ ... on GiftCardOrderItem {
348
+ ...GIFT_CARD_FRAGMENT
349
+ product {
350
+ ...PRODUCT_FRAGMENT
351
+ }
352
+ }
353
+ ... on DownloadableOrderItem {
354
+ product_name
355
+ downloadable_links {
356
+ sort_order
357
+ title
358
+ }
359
+ }
360
+ }
361
+ total {
362
+ ...ORDER_SUMMARY_FRAGMENT
363
+ }
364
+ }
365
+ ${c}
366
+ ${n}
367
+ ${r}
368
+ ${i}
369
+ ${o}
370
+ ${_}
371
+ ${a}
372
+ `;export{d as CHECKOUT_DATA_FRAGMENT,l as CUSTOMER_FRAGMENT,u as ORDER_FRAGMENT,i as ORDER_ITEM_FRAGMENT};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-checkout", "version": "0.1.0-alpha53", "@dropins/tools": "~0.35.0"}
1
+ {"name": "@dropins/storefront-checkout", "version": "0.1.0-alpha57", "@dropins/tools": "~0.36.0"}
package/render.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- (function(r,o){try{if(typeof document<"u"){const t=document.createElement("style"),n=o.styleId;for(const e in o.attributes)t.setAttribute(e,o.attributes[e]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const e=document.querySelector('link[rel="stylesheet"], style');e?e.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(`.checkout-place-order{display:grid;padding-bottom:var(--spacing-big)}.checkout-place-order__button{align-self:flex-end;justify-self:flex-end}@media only screen and (min-width:320px) and (max-width: 768px){.checkout-place-order{background-color:var(--color-neutral-200);padding:var(--spacing-medium) var(--spacing-medium) var(--spacing-big) var(--spacing-medium)}.checkout-place-order__button{align-self:center;justify-self:stretch}}
4
- .checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}
5
- .checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end;margin-top:var(--spacing-xxsmall)}a.checkout-login-form__link{font:var(--type-body-2-strong-font);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:repeat(1,1fr [col-start]);grid-template-rows:1fr}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:0;margin-bottom:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-2-default-font);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{font:var(--type-details-caption-1-font)}.checkout-out-of-stock__action{background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}.checkout-overlay-loader{align-items:center;background:var(--color-neutral-50);display:flex;height:100vh;justify-content:center;left:0;opacity:.5;position:fixed;top:0;width:100%;z-index:9999}.checkout-payment-methods__title{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods--loading{opacity:.4;pointer-events:none}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.order-confirmation-header{text-align:center;padding:var(--spacing-xxbig)}.order-confirmation-header__icon{margin-bottom:var(--spacing-small)}.order-confirmation-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0}.order-confirmation-header__title:first-letter{text-transform:uppercase}.order-confirmation-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-confirmation-header .success-icon{color:var(--color-positive-500)}.order-confirmation-create-account{gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-confirmation-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-confirmation-create-account__button{margin:0 auto;text-align:center;display:inline-block}.checkout-shipping-methods__title{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-shipping-methods__content{position:relative;display:block}.checkout-shipping-methods__method{margin-bottom:var(--spacing-medium);width:fit-content;cursor:pointer;font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-shipping-methods__method:last-child{margin-bottom:0}.dropin-radio-button__label .dropin-price{color:var(--color-neutral-800);font-weight:400}.checkout-shipping-methods__options--loading{opacity:.4;pointer-events:none}.checkout-shipping-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}`,{styleId:"checkout"});
6
- import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import{events as p}from"@dropins/tools/event-bus.js";import"./chunks/fetch-graphql.js";import{e as y}from"./chunks/synchronizeCheckout.js";import{UIProvider as g}from"@dropins/tools/components.js";import{useState as b,useEffect as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S=function(r){return E(r)&&!v(r)};function E(e){return!!e&&typeof e=="object"}function v(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||M(e)}var w=typeof Symbol=="function"&&Symbol.for,j=w?Symbol.for("react.element"):60103;function M(e){return e.$$typeof===j}function A(e){return Array.isArray(e)?[]:{}}function i(e,r){return r.clone!==!1&&r.isMergeableObject(e)?a(A(e),e,r):e}function P(e,r,t){return e.concat(r).map(function(o){return i(o,t)})}function T(e,r){if(!r.customMerge)return a;var t=r.customMerge(e);return typeof t=="function"?t:a}function C(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(C(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function x(e,r,t){var o={};return t.isMergeableObject(e)&&l(e).forEach(function(n){o[n]=i(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?o[n]=T(n,t)(e[n],r[n],t):o[n]=i(r[n],t))}),o}function a(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||P,t.isMergeableObject=t.isMergeableObject||S,t.cloneUnlessOtherwiseSpecified=i;var o=Array.isArray(r),n=Array.isArray(e),c=o===n;return c?o?t.arrayMerge(e,r,t):x(e,r,t):i(r,t)}a.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(o,n){return a(o,n,t)},{})};var D=a,k=D;const R=O(k),B={title:"Checkout",LoginForm:{title:"Contact details",account:"Already have an account?",ariaLabel:"Email",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",signInButton:"Sign in",forFasterCheckout:"for a faster checkout."},floatingLabel:"Email *",placeholder:"Enter your email address",signIn:"Sign In",switch:"Do you want to switch account?",signOut:"Sign Out"},ShippingMethods:{title:"Shipping options",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct."},BillToShippingAddress:{title:"Bill to shipping address"},PaymentMethods:{title:"Payment",emptyState:"No payment methods available"},OutOfStock:{title:"Your cart contains items that are out of stock",message:"The following items are out of stock:",actions:{reviewCart:"Review cart",removeOutOfStock:"Remove out of stock items"},lowInventory:{one:"Last item!",many:"Only {{count}} left!"},alert:"Out of stock!"},PlaceOrder:{button:"Place Order"},ServerError:{title:"We were unable to process your order",contactSupport:"If you continue to have issues, please contact support.",unexpected:"An unexpected error occurred while processing your order. Please try again later.",button:"Try again"},EmptyCart:{title:"Your cart is empty",button:"Start shopping"},ErrorBanner:{genericMessage:"Server error detected. Please check your connection and try again."},MergedCartBanner:{items:{one:"1 item from a previous session was added to your cart. Please review your new subtotal.",many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal."}},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withTaxes:"Including taxes",withoutTaxes:"Excluding taxes"},OrderConfirmationHeader:{title:"{{name}}, thank you for your order!",defaultTitle:"Thank you for your order!",order:"ORDER #{{order}}",CreateAccount:{message:"Save your information for faster checkout next time.",button:"Create an account"}}},L={Checkout:B},_={default:L},U=({children:e})=>{var c;const[r,t]=b(),o=(c=y.getConfig())==null?void 0:c.langDefinitions;h(()=>{const s=p.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{s==null||s.off()}},[r]);const n=R(_,o??{});return f(g,{lang:r,langDefinitions:n,children:e})},Q=new d(f(U,{}));export{U as Provider,Q as render};
3
+ (function(r,o){try{if(typeof document<"u"){const t=document.createElement("style"),n=o.styleId;for(const e in o.attributes)t.setAttribute(e,o.attributes[e]);t.setAttribute("data-dropin",n),t.appendChild(document.createTextNode(r));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const e=document.querySelector('link[rel="stylesheet"], style');e?e.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(`.checkout__banner{margin-bottom:var(--spacing-xlarge)}
4
+ .checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end;margin-top:var(--spacing-xxsmall)}a.checkout-login-form__link{font:var(--type-body-2-strong-font);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:repeat(1,1fr [col-start]);grid-template-rows:1fr}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:0;margin-bottom:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-2-default-font);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{font:var(--type-details-caption-1-font)}.checkout-out-of-stock__action{background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}.checkout-overlay-loader{align-items:center;background:var(--color-neutral-50);display:flex;height:100vh;justify-content:center;left:0;opacity:.5;position:fixed;top:0;width:100%;z-index:9999}.checkout-payment-methods__title{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods--loading{opacity:.4;pointer-events:none}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.order-confirmation-header{text-align:center;padding:var(--spacing-xxbig)}.order-confirmation-header__icon{margin-bottom:var(--spacing-small)}.order-confirmation-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);margin:0}.order-confirmation-header__title:first-letter{text-transform:uppercase}.order-confirmation-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-confirmation-header .success-icon{color:var(--color-positive-500)}.order-confirmation-create-account{display:grid;gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-confirmation-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-confirmation-create-account__button{display:flex;margin:0 auto;text-align:center}.checkout-shipping-methods__title{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-shipping-methods__content{position:relative;display:block}.checkout-shipping-methods__method{margin-bottom:var(--spacing-medium);width:fit-content;cursor:pointer;font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-shipping-methods__method:last-child{margin-bottom:0}.dropin-radio-button__label .dropin-price{color:var(--color-neutral-800);font-weight:400}.checkout-shipping-methods__options--loading{opacity:.4;pointer-events:none}.checkout-shipping-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}
5
+ .checkout-place-order{display:grid;padding-bottom:var(--spacing-big)}.checkout-place-order__button{align-self:flex-end;justify-self:flex-end}@media only screen and (min-width:320px) and (max-width: 768px){.checkout-place-order{background-color:var(--color-neutral-200);padding:var(--spacing-medium) var(--spacing-medium) var(--spacing-big) var(--spacing-medium)}.checkout-place-order__button{align-self:center;justify-self:stretch}}
6
+ .checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}`,{styleId:"checkout"});
7
+ import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import"./chunks/fetch-graphql.js";import"./chunks/store-config.js";import"./chunks/ServerErrorSignal.js";import{events as p}from"@dropins/tools/event-bus.js";import{c as y}from"./chunks/synchronizeCheckout.js";import{UIProvider as g}from"@dropins/tools/components.js";import{useState as b,useEffect as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"./fragments.js";function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S=function(r){return E(r)&&!v(r)};function E(e){return!!e&&typeof e=="object"}function v(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||M(e)}var w=typeof Symbol=="function"&&Symbol.for,j=w?Symbol.for("react.element"):60103;function M(e){return e.$$typeof===j}function A(e){return Array.isArray(e)?[]:{}}function i(e,r){return r.clone!==!1&&r.isMergeableObject(e)?a(A(e),e,r):e}function P(e,r,t){return e.concat(r).map(function(o){return i(o,t)})}function T(e,r){if(!r.customMerge)return a;var t=r.customMerge(e);return typeof t=="function"?t:a}function C(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(C(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function x(e,r,t){var o={};return t.isMergeableObject(e)&&l(e).forEach(function(n){o[n]=i(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?o[n]=T(n,t)(e[n],r[n],t):o[n]=i(r[n],t))}),o}function a(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||P,t.isMergeableObject=t.isMergeableObject||S,t.cloneUnlessOtherwiseSpecified=i;var o=Array.isArray(r),n=Array.isArray(e),c=o===n;return c?o?t.arrayMerge(e,r,t):x(e,r,t):i(r,t)}a.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(o,n){return a(o,n,t)},{})};var D=a,k=D;const R=O(k),B={title:"Checkout",LoginForm:{title:"Contact details",account:"Already have an account?",ariaLabel:"Email",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",signInButton:"Sign in",forFasterCheckout:"for a faster checkout."},floatingLabel:"Email *",placeholder:"Enter your email address",signIn:"Sign In",switch:"Do you want to switch account?",signOut:"Sign Out"},ShippingMethods:{title:"Shipping options",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct."},BillToShippingAddress:{title:"Bill to shipping address"},PaymentMethods:{title:"Payment",emptyState:"No payment methods available"},OutOfStock:{title:"Your cart contains items that are out of stock",message:"The following items are out of stock:",actions:{reviewCart:"Review cart",removeOutOfStock:"Remove out of stock items"},lowInventory:{one:"Last item!",many:"Only {{count}} left!"},alert:"Out of stock!"},PlaceOrder:{button:"Place Order"},ServerError:{title:"We were unable to process your order",contactSupport:"If you continue to have issues, please contact support.",unexpected:"An unexpected error occurred while processing your order. Please try again later.",button:"Try again"},EmptyCart:{title:"Your cart is empty",button:"Start shopping"},ErrorBanner:{genericMessage:"Server error detected. Please check your connection and try again."},MergedCartBanner:{items:{one:"1 item from a previous session was added to your cart. Please review your new subtotal.",many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal."}},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withTaxes:"Including taxes",withoutTaxes:"Excluding taxes"},OrderConfirmationHeader:{title:"{{name}}, thank you for your order!",defaultTitle:"Thank you for your order!",order:"ORDER #{{order}}",CreateAccount:{message:"Save your information for faster checkout next time.",button:"Create an account"}}},L={Checkout:B},_={default:L},U=({children:e})=>{var c;const[r,t]=b(),o=(c=y.getConfig())==null?void 0:c.langDefinitions;h(()=>{const s=p.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{s==null||s.off()}},[r]);const n=R(_,o??{});return f(g,{lang:r,langDefinitions:n,children:e})},Q=new d(f(U,{}));export{U as Provider,Q as render};