@dropins/storefront-checkout 1.4.0-beta2 → 2.0.0-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/api/fragments.d.ts +2 -0
  2. package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +1 -1
  3. package/api/{subscribeEmailToNewsletter/graphql/subscribeEmailToNewsletter.graphql.d.ts → graphql/CartPaymentMethodFragment.graphql.d.ts} +4 -3
  4. package/api/index.d.ts +0 -1
  5. package/api/initialize/initialize.d.ts +3 -3
  6. package/api.js +7 -13
  7. package/chunks/ConditionalWrapper.js +1 -1
  8. package/chunks/errors.js +13 -0
  9. package/chunks/setBillingAddress.js +2 -2
  10. package/chunks/setGuestEmailOnCart.js +4 -4
  11. package/chunks/setPaymentMethod.js +2 -2
  12. package/chunks/setShippingMethods.js +2 -2
  13. package/chunks/synchronizeCheckout.js +2 -2
  14. package/chunks/values.js +3 -0
  15. package/components/ConditionalWrapper/ConditionalWrapper.d.ts +2 -2
  16. package/components/PaymentMethods/PaymentMethods.d.ts +2 -2
  17. package/components/ShippingMethods/ShippingMethods.d.ts +2 -2
  18. package/components/index.d.ts +0 -1
  19. package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +3 -1
  20. package/containers/BillToShippingAddress.js +1 -1
  21. package/containers/EstimateShipping/EstimateShipping.d.ts +5 -2
  22. package/containers/EstimateShipping.js +1 -1
  23. package/containers/LoginForm/LoginForm.d.ts +3 -1
  24. package/containers/LoginForm.js +1 -1
  25. package/containers/MergedCartBanner/MergedCartBanner.d.ts +6 -3
  26. package/containers/MergedCartBanner.js +1 -1
  27. package/containers/OutOfStock/OutOfStock.d.ts +2 -1
  28. package/containers/OutOfStock.js +1 -1
  29. package/containers/PaymentMethods/PaymentMethods.d.ts +4 -18
  30. package/containers/PaymentMethods.js +1 -1
  31. package/containers/PlaceOrder/PlaceOrder.d.ts +2 -3
  32. package/containers/PlaceOrder.js +1 -1
  33. package/containers/ServerError/ServerError.d.ts +2 -1
  34. package/containers/ServerError.js +1 -1
  35. package/containers/ShippingMethods/ShippingMethods.d.ts +6 -7
  36. package/containers/ShippingMethods.js +1 -1
  37. package/containers/TermsAndConditions/TermsAndConditions.d.ts +2 -1
  38. package/containers/TermsAndConditions.js +1 -1
  39. package/containers/index.d.ts +0 -1
  40. package/data/models/index.d.ts +1 -1
  41. package/data/models/shipping-estimate.d.ts +4 -0
  42. package/data/models/store-config.d.ts +0 -1
  43. package/data/models/values.d.ts +9 -0
  44. package/data/transforms/transform-cart.d.ts +1 -1
  45. package/data/transforms/transform-shipping-methods.d.ts +1 -1
  46. package/fragments.js +16 -6
  47. package/i18n/en_US.json.d.ts +0 -3
  48. package/lib/enqueueRequest.d.ts +1 -1
  49. package/lib/events.d.ts +8 -0
  50. package/lib/index.d.ts +3 -0
  51. package/lib/preact.d.ts +1 -1
  52. package/lib/values.d.ts +17 -0
  53. package/package.json +1 -1
  54. package/render/render.d.ts +1 -1
  55. package/render.js +3 -4
  56. package/signals/ShippingEstimateSignal.d.ts +1 -1
  57. package/signals/index.d.ts +0 -4
  58. package/{api/getCart/fixtures.d.ts → tests/fixtures/cart.d.ts} +2 -2
  59. package/{api/getCustomer/fixtures.d.ts → tests/fixtures/customer.d.ts} +1 -1
  60. package/tests/fixtures/payments.d.ts +8 -0
  61. package/{api/estimateShippingMethods/fixtures.d.ts → tests/fixtures/shipping.d.ts} +1 -1
  62. package/tests/integration/utils/setup.d.ts +1 -1
  63. package/types/TitleProps.d.ts +1 -1
  64. package/__generated__/types.d.ts +0 -12644
  65. package/api/subscribeEmailToNewsletter/index.d.ts +0 -18
  66. package/api/subscribeEmailToNewsletter/subscribeEmailToNewsletter.d.ts +0 -4
  67. package/chunks/IsBillToShippingSignal.js +0 -14
  68. package/chunks/SelectedPaymentMethodSignal.js +0 -3
  69. package/chunks/SelectedShippingMethodSignal.js +0 -3
  70. package/chunks/subscription-email-statuses.js +0 -3
  71. package/components/Newsletter/Newsletter.d.ts +0 -7
  72. package/components/Newsletter/NewsletterSkeleton.d.ts +0 -4
  73. package/components/Newsletter/index.d.ts +0 -20
  74. package/containers/Newsletter/Newsletter.d.ts +0 -9
  75. package/containers/Newsletter/index.d.ts +0 -19
  76. package/containers/Newsletter.d.ts +0 -3
  77. package/containers/Newsletter.js +0 -3
  78. package/data/models/subscription-email-statuses.d.ts +0 -24
  79. package/signals/IsBillToShippingSignal.d.ts +0 -18
  80. package/signals/IsSubscribedToNewsletterSignal.d.ts +0 -18
  81. package/signals/SelectedPaymentMethodSignal.d.ts +0 -18
  82. package/signals/SelectedShippingMethodSignal.d.ts +0 -4
@@ -14,6 +14,8 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
+ export { BILLING_CART_ADDRESS_FRAGMENT, SHIPPING_CART_ADDRESS_FRAGMENT, } from './graphql/CartAddressFragment.graphql';
18
+ export { AVAILABLE_PAYMENT_METHOD_FRAGMENT, SELECTED_PAYMENT_METHOD_FRAGMENT, } from './graphql/CartPaymentMethodFragment.graphql';
17
19
  export { CHECKOUT_DATA_FRAGMENT } from './graphql/CheckoutDataFragment.graphql';
18
20
  export { CUSTOMER_FRAGMENT } from './graphql/CustomerFragment.graphql';
19
21
  //# sourceMappingURL=fragments.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
- export declare const getStoreConfigQuery = "\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n newsletter_enabled\n shopping_cart_display_shipping\n }\n }\n";
17
+ export declare const getStoreConfigQuery = "\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n shopping_cart_display_shipping\n }\n }\n";
18
18
  //# sourceMappingURL=getStoreConfig.graphql.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * ADOBE CONFIDENTIAL
3
3
  * __________________
4
4
  *
5
- * Copyright 2024 Adobe
5
+ * Copyright 2025 Adobe
6
6
  * All Rights Reserved.
7
7
  *
8
8
  * NOTICE: All information contained herein is, and remains
@@ -14,5 +14,6 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
- export declare const subscribeEmailToNewsletterMutation = "\n mutation subscribeEmailToNewsletter($email: String!) {\n subscribeEmailToNewsletter(email: $email) {\n status\n }\n }\n";
18
- //# sourceMappingURL=subscribeEmailToNewsletter.graphql.d.ts.map
17
+ export declare const AVAILABLE_PAYMENT_METHOD_FRAGMENT = "\n fragment AVAILABLE_PAYMENT_METHOD_FRAGMENT on AvailablePaymentMethod {\n code\n title\n }\n";
18
+ export declare const SELECTED_PAYMENT_METHOD_FRAGMENT = "\n fragment SELECTED_PAYMENT_METHOD_FRAGMENT on SelectedPaymentMethod {\n code\n title\n }\n";
19
+ //# sourceMappingURL=CartPaymentMethodFragment.graphql.d.ts.map
package/api/index.d.ts CHANGED
@@ -30,7 +30,6 @@ export * from './setGuestEmailOnCart';
30
30
  export * from './setPaymentMethod';
31
31
  export * from './setShippingAddress';
32
32
  export * from './setShippingMethods';
33
- export * from './subscribeEmailToNewsletter';
34
33
  export * from './synchronizeCheckout';
35
34
  export * from '../errors';
36
35
  export { getStoreConfigCache } from '../lib/state';
@@ -1,6 +1,6 @@
1
1
  import { Cart as CartModel, Customer as CustomerModel } from '../../data/models';
2
- import { Lang } from '../../../@adobe-commerce/elsie/src/i18n';
3
- import { Initializer, Model } from '../../../@adobe-commerce/elsie/src/lib';
2
+ import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
+ import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
4
4
 
5
5
  export type ConfigProps = {
6
6
  langDefinitions?: Lang;
@@ -10,5 +10,5 @@ export type ConfigProps = {
10
10
  };
11
11
  };
12
12
  export declare const initialize: Initializer<ConfigProps>;
13
- export declare const config: import('../../../@adobe-commerce/elsie/src/lib').Config<ConfigProps>;
13
+ export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
14
14
  //# sourceMappingURL=initialize.d.ts.map
package/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,c as Z,g as tt,i as et,e as st,r as it,s as rt}from"./chunks/synchronizeCheckout.js";import{s as p,S as T}from"./chunks/subscription-email-statuses.js";import{g as nt}from"./chunks/subscription-email-statuses.js";import"@dropins/tools/lib.js";import{a as I}from"./chunks/setShippingMethods.js";import{s as dt}from"./chunks/setShippingMethods.js";import{M as _,b as M,d,Q as A,s as y,i as N,c as b,e as O}from"./chunks/IsBillToShippingSignal.js";import{D as pt,F as gt,I as mt,o as ht,n as ut,S as lt,U as _t,k as At,l as St,m as Et,r as ft,f as Ct,g as Tt,j as It}from"./chunks/IsBillToShippingSignal.js";import"@dropins/tools/event-bus.js";import{A as w}from"./chunks/checkout.js";import{g as yt,i as Nt,s as bt}from"./chunks/setGuestEmailOnCart.js";import{s as wt}from"./chunks/setBillingAddress.js";import{s as Gt}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as S}from"./fragments.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const x=`
3
+ import{t as S,a as f,b as E}from"./chunks/synchronizeCheckout.js";import{d as j,c as Y,g as J,i as W,e as X,r as Z,s as tt}from"./chunks/synchronizeCheckout.js";import{s as p,M as l,c as I,d as c,Q as A,a as M,e as T}from"./chunks/errors.js";import{D as st,F as it,I as rt,p as at,n as nt,o as ot,S as dt,U as pt,k as ct,l as gt,m as ht,g as mt,r as _t,f as ut,i as lt,j as At}from"./chunks/errors.js";import"@dropins/tools/lib.js";import{a as y}from"./chunks/setShippingMethods.js";import{s as St}from"./chunks/setShippingMethods.js";import"@dropins/tools/event-bus.js";import{A as O}from"./chunks/checkout.js";import{g as Et,i as It,s as Mt}from"./chunks/setGuestEmailOnCart.js";import{s as yt}from"./chunks/setBillingAddress.js";import{s as xt}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as C}from"./fragments.js";import{g as x}from"./chunks/values.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const G=`
4
4
  mutation estimateShippingMethods(
5
5
  $cartId: String!
6
6
  $address: EstimateAddressInput!
@@ -26,7 +26,7 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
26
26
  error_message
27
27
  }
28
28
  }
29
- `,G=t=>t?t.filter(e=>!!e).map(e=>({id:e.agreement_id,name:e.name,mode:w[e.mode],text:e.checkbox_text,content:{value:e.content,html:e.is_html,height:e.content_height??null}})):[],L=async t=>{var m,h,u,l;const e=p.cartId,r=((m=t==null?void 0:t.criteria)==null?void 0:m.country_code)??((h=p.config)==null?void 0:h.defaultCountry);if(!e)throw new _;if(!r)throw new M;const{region_id:s,region_name:o,zip:a}=(t==null?void 0:t.criteria)??{},i=s||o?{region_id:typeof s=="string"?parseInt(s,10):s,region_code:o}:void 0,n={country_code:r,...a&&{postcode:a},...i&&{region:{...i.region_id&&{region_id:i.region_id},...i.region_code&&{region_code:i.region_code}}}},c={country_id:r,region:(u=n.region)==null?void 0:u.region_code,region_id:(l=n.region)==null?void 0:l.region_id,postcode:a},g=await d({options:{variables:{cartId:e,address:n}},path:"estimateShippingMethods",query:x,queueName:A.ShippingEstimate,transformer:E,type:"mutation"});return y.value={address:I(c),options:g},g},$=`
29
+ `,N=e=>e?e.filter(t=>!!t).map(t=>({id:t.agreement_id,name:t.name,mode:O[t.mode],text:t.checkbox_text,content:{value:t.content,html:t.is_html,height:t.content_height??null}})):[],K=async e=>{var h,m,_,u;const t=p.cartId,r=((h=e==null?void 0:e.criteria)==null?void 0:h.country_code)??((m=p.config)==null?void 0:m.defaultCountry);if(!t)throw new l;if(!r)throw new I;const{region_id:s,region_name:o,zip:a}=(e==null?void 0:e.criteria)??{},i=s||o?{region_id:typeof s=="string"?parseInt(s,10):s,region_code:o}:void 0,n={country_code:r,...a&&{postcode:a},...i&&{region:{...i.region_id&&{region_id:i.region_id},...i.region_code&&{region_code:i.region_code}}}},d={country_id:r,region:(_=n.region)==null?void 0:_.region_code,region_id:(u=n.region)==null?void 0:u.region_id,postcode:a},g=await c({options:{variables:{cartId:t,address:n}},path:"estimateShippingMethods",query:G,queueName:A.ShippingEstimate,transformer:S,type:"mutation"});return M.value={address:y(d),options:g},g},$=`
30
30
  query GET_CHECKOUT_AGREEMENTS {
31
31
  checkoutAgreements {
32
32
  agreement_id
@@ -38,8 +38,8 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
38
38
  name
39
39
  }
40
40
  }
41
- `,V=async()=>await d({defaultValueOnFail:[],options:{method:"GET",cache:"no-cache"},path:"checkoutAgreements",query:$,transformer:G,type:"query"}),U=`
42
- mutation SET_SHIPPING_ADDRESS_ON_CART_MUTATION(
41
+ `,P=async()=>await c({defaultValueOnFail:[],options:{method:"GET",cache:"no-cache"},path:"checkoutAgreements",query:$,transformer:N,type:"query"}),U=`
42
+ mutation setShippingAddress(
43
43
  $cartId: String!
44
44
  $shippingAddressInput: ShippingAddressInput!
45
45
  ) {
@@ -52,7 +52,7 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
52
52
  }
53
53
  }
54
54
 
55
- ${S}
55
+ ${C}
56
56
  `,v=`
57
57
  mutation SET_SHIPPING_ADDRESS_ON_CART_AND_USE_AS_BILLING_MUTATION(
58
58
  $cartId: String!
@@ -75,11 +75,5 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
75
75
  }
76
76
  }
77
77
 
78
- ${S}
79
- `,j=async({address:t,customerAddressId:e,pickupLocationCode:r})=>{const s=p.cartId;if(!s)throw new _;const o=()=>{if(e)return{customer_address_id:e};if(r)return{pickup_location_code:r};if(!t)throw new b;return{address:f(t)}},a=N.peek(),i=a?v:U,n=a?"setBillingAddressOnCart.cart":"setShippingAddressesOnCart.cart",c={cartId:s,shippingAddressInput:o()};return await d({type:"mutation",query:i,options:{variables:c},path:n,queueName:A.CartUpdate,transformer:C})},F=`
80
- mutation subscribeEmailToNewsletter($email: String!) {
81
- subscribeEmailToNewsletter(email: $email) {
82
- status
83
- }
84
- }
85
- `,Y=async t=>{if(!t)throw new O;return await d({defaultValueOnFail:T.Error,options:{variables:{email:t}},path:"subscribeEmailToNewsletter.status",query:F,type:"mutation"})};export{pt as DEFAULT_COUNTRY,gt as FetchError,mt as InvalidArgument,ht as MissingBillingAddress,_ as MissingCart,M as MissingCountry,O as MissingEmail,ut as MissingPaymentMethod,b as MissingShippinghAddress,lt as STORE_CONFIG_DEFAULTS,_t as UnexpectedError,X as authenticateCustomer,Z as config,L as estimateShippingMethods,At as fetchGraphQl,tt as getCart,V as getCheckoutAgreements,St as getConfig,yt as getCustomer,Et as getStoreConfig,nt as getStoreConfigCache,et as initialize,st as initializeCheckout,Nt as isEmailAvailable,ft as removeFetchGraphQlHeader,it as resetCheckout,wt as setBillingAddress,Ct as setEndpoint,Tt as setFetchGraphQlHeader,It as setFetchGraphQlHeaders,bt as setGuestEmailOnCart,Gt as setPaymentMethod,j as setShippingAddress,dt as setShippingMethodsOnCart,Y as subscribeEmailToNewsletter,rt as synchronizeCheckout};
78
+ ${C}
79
+ `,z=async({address:e,customerAddressId:t,pickupLocationCode:r})=>{const s=p.cartId;if(!s)throw new l;const o=()=>{if(t)return{customer_address_id:t};if(r)return{pickup_location_code:r};if(!e)throw new T;return{address:f(e)}},a=x("isBillToShipping"),i=a?v:U,n=a?"setBillingAddressOnCart.cart":"setShippingAddressesOnCart.cart",d={cartId:s,shippingAddressInput:o()};return await c({type:"mutation",query:i,options:{variables:d},path:n,queueName:A.CartUpdate,transformer:E})};export{st as DEFAULT_COUNTRY,it as FetchError,rt as InvalidArgument,at as MissingBillingAddress,l as MissingCart,I as MissingCountry,nt as MissingEmail,ot as MissingPaymentMethod,T as MissingShippinghAddress,dt as STORE_CONFIG_DEFAULTS,pt as UnexpectedError,j as authenticateCustomer,Y as config,K as estimateShippingMethods,ct as fetchGraphQl,J as getCart,P as getCheckoutAgreements,gt as getConfig,Et as getCustomer,ht as getStoreConfig,mt as getStoreConfigCache,W as initialize,X as initializeCheckout,It as isEmailAvailable,_t as removeFetchGraphQlHeader,Z as resetCheckout,yt as setBillingAddress,ut as setEndpoint,lt as setFetchGraphQlHeader,At as setFetchGraphQlHeaders,Mt as setGuestEmailOnCart,xt as setPaymentMethod,z as setShippingAddress,St as setShippingMethodsOnCart,tt as synchronizeCheckout};
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as a,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";function l(r,t){return function(e){const{isInitialized:i=!0,isVisible:n=!0,...s}=e;return a("div",{className:"conditional-wrapper",children:[n&&!i&&o(t,{}),n&&i&&o(r,{...s})]})}}export{l as W};
3
+ import{events as s}from"@dropins/tools/event-bus.js";import{jsxs as c,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";function i(){return s.lastPayload("checkout/initialized")??null}function e(){return s.lastPayload("checkout/updated")??null}function f(){var n;const t=e()??i();return!!((n=t==null?void 0:t.shippingAddresses)!=null&&n.length)}function m(){const t=e()??i();return!!(t!=null&&t.isVirtual)}function g(){const t=e()??i();return(t==null?void 0:t.email)??null}function C(t,n){return function(u){const{initialized:o=!0,visible:a=!0,...l}=u;return c("div",{className:"conditional-wrapper",children:[a&&!o&&r(n,{}),a&&o&&r(t,{...l})]})}}export{C as W,g as a,e as g,f as h,m as i};
@@ -0,0 +1,13 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import"@dropins/tools/lib.js";import{events as C}from"@dropins/tools/event-bus.js";import{signal as E,computed as I}from"@dropins/tools/signals.js";import{FetchGraphQL as w}from"@dropins/tools/fetch-graphql.js";const A={authenticated:!1,cartId:null,initialized:!1,config:null},N=new Proxy(A,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}}),V=()=>N.config;var i=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(i||{}),S=(e=>(e.CartUpdate="cartUpdate",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(S||{});const d=new Map,g=new Map,c=E(new Set),U=new Map;U.set("cartUpdate",e=>{C.emit("checkout/updated",e)});async function D(e){g.set(e,!0);const t=d.get(e);let s;for(;t.length>0;){const o=t.shift();try{const n=await o.requestFn();o.resolve(n),s=n}catch(n){o.reject(n)}}g.set(e,!1);const r=new Set(c.value);r.delete(e),c.value=r;const a=U.get(e);a&&s&&a(s)}function G(e,t="default"){d.has(t)||d.set(t,[]);const s=d.get(t),r=new Promise((o,n)=>{s.push({requestFn:e,resolve:o,reject:n})}),a=new Set(c.value);return a.add(t),c.value=a,g.get(t)||D(t),r}const B=I(()=>c.value.has("cartUpdate")),z=I(()=>c.value.has("shippingEstimate")),q=["sender_email","recipient_email"];function X(e){return e.filter(t=>!t.path||!q.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const v=e=>{throw e instanceof DOMException&&e.name==="AbortError"||C.emit("error",{source:"checkout",type:"network",error:e}),e};function T(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}async function L(e){const{defaultValueOnFail:t,options:s,path:r,query:a,queueName:o,transformer:n,type:p}=e;try{const l=async()=>{const{data:y,errors:_}=await k(a,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s}).catch(v);if(_){const m=X(_);if(m.length>0)throw new P(m)}let h=T(y,r);if(h===void 0)throw new Error(`No data found at path: ${r}`);return n?n(h):h};return p==="mutation"?await G(l,o):await l()}catch(l){if(t!==void 0)return t;throw l}}const x=`
4
+ query getStoreConfig {
5
+ storeConfig {
6
+ default_country
7
+ is_checkout_agreements_enabled
8
+ is_guest_checkout_enabled
9
+ is_one_page_checkout_enabled
10
+ shopping_cart_display_shipping
11
+ }
12
+ }
13
+ `,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:i.EXCLUDING_TAX}},Y=async()=>await L({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"});function M(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 b(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,shopping_cart_display_shipping:r}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,shoppingCartDisplaySetting:{shipping:M(r)}}}const $=E(),{setEndpoint:J,setFetchGraphQlHeader:K,removeFetchGraphQlHeader:W,setFetchGraphQlHeaders:Z,fetchGraphQl:k,getConfig:ee}=new w().getMethods();class P extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class u extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class te extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class se extends u{constructor(){super("Cart ID is required")}}class re extends u{constructor(){super("Email is required")}}class ne extends u{constructor(){super("Payment method code is required")}}class ae extends u{constructor(){super("Shipping address is required")}}class oe extends u{constructor(){super("Billing address is required")}}class ie extends u{constructor(){super("Country Code is required")}}export{F as D,P as F,u as I,se as M,S as Q,f as S,i as T,te as U,$ as a,z as b,ie as c,L as d,ae as e,J as f,V as g,B as h,K as i,Z as j,k,ee as l,Y as m,re as n,ne as o,oe as p,W as r,N as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as o,b as d}from"./synchronizeCheckout.js";import{s as l}from"./subscription-email-statuses.js";import{M as p,o as m,d as u,Q as f}from"./IsBillToShippingSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const _=`
3
+ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as d,b as l}from"./synchronizeCheckout.js";import{s as o,M as p,p as u,d as _,Q as f}from"./errors.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const m=`
4
4
  mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {
5
5
  setBillingAddressOnCart(input: $input) {
6
6
  cart {
@@ -10,4 +10,4 @@ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as o,b as d}fr
10
10
  }
11
11
 
12
12
  ${e}
13
- `,T=async({address:r,customerAddressId:t,sameAsShipping:s=!1,useForShipping:n=!1})=>{const a=l.cartId;if(!a)throw new p;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 m;i.billing_address.address=o(r)}return await u({options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",query:_,queueName:f.CartUpdate,transformer:d,type:"mutation"})};export{T as s};
13
+ `,M=async({address:a,customerAddressId:s,sameAsShipping:t=!1,useForShipping:n=!1})=>{const r=o.cartId;if(!r)throw new p;const i={cart_id:r,billing_address:{same_as_shipping:t,use_for_shipping:n}};if(!t&&s&&(i.billing_address.customer_address_id=s),!t&&!s){if(!a)throw new u;i.billing_address.address=d(a)}return await _({options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",query:m,queueName:f.CartUpdate,transformer:l,type:"mutation"})};export{M as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m}from"./subscription-email-statuses.js";import{d as r,e as l,M as u,Q as c}from"./IsBillToShippingSignal.js";import"@dropins/tools/event-bus.js";import{merge as E}from"@dropins/tools/lib.js";import{c as f,b as p}from"./synchronizeCheckout.js";const C=t=>{var i,a,s;if(!t)return null;const e={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(e,(s=(a=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:a.transformer)==null?void 0:s.call(a,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
3
+ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,n as l,M as u,Q as c}from"./errors.js";import"@dropins/tools/event-bus.js";import{merge as E}from"@dropins/tools/lib.js";import{c as f,b as p}from"./synchronizeCheckout.js";const C=t=>{var i,e,s;if(!t)return null;const a={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(a,(s=(e=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:e.transformer)==null?void 0:s.call(e,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
4
4
  query getCustomer {
5
5
  customer {
6
6
  ...CUSTOMER_FRAGMENT
@@ -8,13 +8,13 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
8
8
  }
9
9
 
10
10
  ${o}
11
- `,q=async()=>m.authenticated?await r({options:{method:"GET",cache:"no-cache"},path:"customer",query:A,transformer:C,type:"query"}):null,g=`
11
+ `,v=async()=>m.authenticated?await r({options:{method:"GET",cache:"no-cache"},path:"customer",query:A,transformer:C,type:"query"}):null,g=`
12
12
  query isEmailAvailable($email: String!) {
13
13
  isEmailAvailable(email: $email) {
14
14
  is_email_available
15
15
  }
16
16
  }
17
- `,N=async t=>{if(!t)throw new l;return await r({options:{method:"GET",cache:"no-cache",variables:{email:t}},path:"isEmailAvailable",query:g,transformer:y,type:"query"})},h=`
17
+ `,q=async t=>{if(!t)throw new l;return await r({options:{method:"GET",cache:"no-cache",variables:{email:t}},path:"isEmailAvailable",query:g,transformer:y,type:"query"})},h=`
18
18
  mutation setGuestEmail($cartId: String!, $email: String!) {
19
19
  setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
20
20
  cart {
@@ -24,4 +24,4 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
24
24
  }
25
25
 
26
26
  ${n}
27
- `,$=async t=>{const e=m.cartId;if(!e)throw new u;return await r({options:{variables:{cartId:e,email:t}},path:"setGuestEmailOnCart.cart",query:h,queueName:c.CartUpdate,transformer:p,type:"mutation"})};export{q as g,N as i,$ as s};
27
+ `,N=async t=>{const a=m.cartId;if(!a)throw new u;return await r({options:{variables:{cartId:a,email:t}},path:"setGuestEmailOnCart.cart",query:h,queueName:c.CartUpdate,transformer:p,type:"mutation"})};export{v as g,q as i,N as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./synchronizeCheckout.js";import{s as o}from"./subscription-email-statuses.js";import{M as n,n as s,d as m,Q as i}from"./IsBillToShippingSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const d=`
3
+ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./synchronizeCheckout.js";import{s as o,M as n,o as s,d as m,Q as i}from"./errors.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const d=`
4
4
  mutation setPaymentMethod(
5
5
  $cartId: String!
6
6
  $paymentMethod: PaymentMethodInput!
@@ -15,4 +15,4 @@ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./sy
15
15
  }
16
16
 
17
17
  ${e}
18
- `,C=async t=>{const a=o.cartId;if(!a)throw new n;if(!t)throw new s;return await m({options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",query:d,queueName:i.CartUpdate,transformer:r,type:"mutation"})};export{C as s};
18
+ `,u=async t=>{const a=o.cartId;if(!a)throw new n;if(!t)throw new s;return await m({options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",query:d,queueName:i.CartUpdate,transformer:r,type:"mutation"})};export{u as s};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as r}from"./subscription-email-statuses.js";import{b as i}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import{M as n,d as e,Q as s}from"./IsBillToShippingSignal.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as p}from"../fragments.js";const C=t=>({countryCode:t.country_id,postCode:t.postcode||"",...t.region_id?{regionId:Number(t.region_id)}:{...t.region?{region:t.region}:{}}}),M=t=>({carrierCode:t.carrier.code||"",methodCode:t.code||"",amount:t.amount,amountExclTax:t.amountExclTax,amountInclTax:t.amountInclTax}),a=`
3
+ import{s as r,M as i,d as n,Q as e}from"./errors.js";import{b as s}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as p}from"../fragments.js";const g=t=>({countryCode:t.country_id,postCode:t.postcode||"",...t.region_id?{regionId:Number(t.region_id)}:{...t.region?{region:t.region}:{}}}),C=t=>({carrierCode:t.carrier.code||"",methodCode:t.code||"",amount:t.amount,amountExclTax:t.amountExclTax,amountInclTax:t.amountInclTax}),a=`
4
4
  mutation setShippingMethods(
5
5
  $cartId: String!
6
6
  $shippingMethods: [ShippingMethodInput]!
@@ -15,4 +15,4 @@ import{s as r}from"./subscription-email-statuses.js";import{b as i}from"./synchr
15
15
  }
16
16
 
17
17
  ${p}
18
- `,S=async t=>{const o=r.cartId;if(!o)throw new n;return await e({type:"mutation",query:a,queueName:s.CartUpdate,options:{variables:{cartId:o,shippingMethods:t}},path:"setShippingMethodsOnCart.cart",transformer:i})};export{C as a,S as s,M as t};
18
+ `,M=async t=>{const o=r.cartId;if(!o)throw new i;return await n({type:"mutation",query:a,queueName:e.CartUpdate,options:{variables:{cartId:o,shippingMethods:t}},path:"setShippingMethodsOnCart.cart",transformer:s})};export{g as a,M as s,C as t};
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as n}from"./subscription-email-statuses.js";import{merge as h,Initializer as g}from"@dropins/tools/lib.js";import{M as y,d as v,m as C}from"./IsBillToShippingSignal.js";import{events as o}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as c}from"../fragments.js";const A=async(e=!1)=>{n.authenticated=e},x=(e,t)=>e.amount.value-t.amount.value,b=e=>e==null,l=e=>!(!e||!e.method_code||!e.method_title||b(e.amount.value)||!e.amount.currency),u=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}}}),I=e=>{if(l(e))return u(e)},M=e=>{if(e)return e.filter(l).map(t=>u(t)).sort(x)},T=e=>e?!!e.code&&!!e.label:!1,S=e=>{if(!T(e))return;const{code:t,label:i,region_id:r}=e;return r?{code:t,name:i,id:r}:{code:t,name:i}},N=e=>{const{code:t,label:i}=e;return{value:t,label:i}},k=e=>e?"code"in e&&"value"in e:!1,z=e=>e.filter(k).map(t=>{const{code:i,value:r}=t;return{code:i,value:r}}),a=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:N(e.country),customAttributes:z(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:S(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0,prefix:e.prefix||void 0,suffix:e.suffix||void 0,middleName:e.middlename||void 0,fax:e.fax||void 0}},E=e=>{if(e)return a(e)},w=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:i,selected_shipping_method:r,same_as_billing:s,..._}=t;return{...a(_),availableShippingMethods:M(i),selectedShippingMethod:I(r),sameAsBilling:s}}),Q=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId,prefix:e.prefix,suffix:e.suffix,middlename:e.middleName,fax:e.fax}),P=e=>{if(e)return{code:e.code,title:e.title}},$=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:i,title:r}=t;return{code:i,title:r}})},q=e=>{var i,r,s;if(!e)return;const t={availablePaymentMethods:$(e.available_payment_methods),billingAddress:E(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:P(e.selected_payment_method),shippingAddresses:w(e.shipping_addresses),isGuest:!n.authenticated};return h(t,(s=(r=(i=R.getConfig().models)==null?void 0:i.CartModel)==null?void 0:r.transformer)==null?void 0:s.call(r,e))},B=`
3
+ import{s as r,M as h,d as g,m as y}from"./errors.js";import{merge as v,Initializer as C}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as c}from"../fragments.js";const A=async(e=!1)=>{r.authenticated=e},x=(e,t)=>e.amount.value-t.amount.value,b=e=>e==null,l=e=>!(!e||!e.method_code||!e.method_title||b(e.amount.value)||!e.amount.currency),u=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}}}),I=e=>{if(l(e))return u(e)},M=e=>e?e.filter(l).map(t=>u(t)).sort(x):[],T=e=>e?!!e.code&&!!e.label:!1,S=e=>{if(!T(e))return;const{code:t,label:i,region_id:n}=e;return n?{code:t,name:i,id:n}:{code:t,name:i}},N=e=>{const{code:t,label:i}=e;return{value:t,label:i}},k=e=>e?"code"in e&&"value"in e:!1,z=e=>e.filter(k).map(t=>{const{code:i,value:n}=t;return{code:i,value:n}}),a=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:N(e.country),customAttributes:z(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:S(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0,prefix:e.prefix||void 0,suffix:e.suffix||void 0,middleName:e.middlename||void 0,fax:e.fax||void 0}},E=e=>{if(e)return a(e)},w=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:i,selected_shipping_method:n,same_as_billing:s,..._}=t;return{...a(_),availableShippingMethods:M(i),selectedShippingMethod:I(n),sameAsBilling:s}}),U=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId,prefix:e.prefix,suffix:e.suffix,middlename:e.middleName,fax:e.fax}),P=e=>{if(e)return{code:e.code,title:e.title}},$=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:i,title:n}=t;return{code:i,title:n}})},q=e=>{var i,n,s;if(!e)return;const t={availablePaymentMethods:$(e.available_payment_methods),billingAddress:E(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:P(e.selected_payment_method),shippingAddresses:w(e.shipping_addresses),isGuest:!r.authenticated};return v(t,(s=(n=(i=R.getConfig().models)==null?void 0:i.CartModel)==null?void 0:n.transformer)==null?void 0:s.call(n,e))},B=`
4
4
  query getCart($cartId: String!) {
5
5
  cart(cart_id: $cartId) {
6
6
  ...CHECKOUT_DATA_FRAGMENT
@@ -16,4 +16,4 @@ import{s as n}from"./subscription-email-statuses.js";import{merge as h,Initializ
16
16
  }
17
17
 
18
18
  ${c}
19
- `,m=async()=>{const e=n.cartId,t=n.authenticated===!1,i=t?B:D,r=t?{cartId:e}:{};if(t&&!e)throw new y;return await v({type:"query",query:i,options:{method:"POST",cache:"no-cache",variables:r},path:"cart",transformer:q})},G=()=>[o.on("authenticated",A,{eager:!0}),o.on("cart/initialized",p,{eager:!0}),o.on("cart/reset",O),o.on("cart/updated",d)],f=new g({init:async e=>{const t=e||{};f.config.setConfig(t)},listeners:G}),R=f.config,p=async e=>{if(n.initialized)return d(e);n.config||(n.config=await C());const t=e?e.id:null;n.cartId=t;const i=t?await m():null;n.initialized=!0,o.emit("checkout/initialized",i||null)},O=()=>{n.cartId=null,o.emit("checkout/updated",null)},d=async e=>{if(!n.initialized)return p(e);const t=e?e.id:null;n.cartId=t;const i=t?await m():null;o.emit("checkout/updated",i||null)};export{Q as a,q as b,R as c,A as d,p as e,m as g,f as i,O as r,d as s,M as t};
19
+ `,m=async()=>{const e=r.cartId,t=r.authenticated===!1,i=t?B:D,n=t?{cartId:e}:{};if(t&&!e)throw new h;return await g({type:"query",query:i,options:{method:"POST",cache:"no-cache",variables:n},path:"cart",transformer:q})},G=()=>[o.on("authenticated",A,{eager:!0}),o.on("cart/initialized",p,{eager:!0}),o.on("cart/reset",O),o.on("cart/updated",d)],f=new C({init:async e=>{const t={...e};f.config.setConfig(t)},listeners:G}),R=f.config,p=async e=>{if(r.initialized)return d(e);r.config||(r.config=await y());const t=e?e.id:null;r.cartId=t;const i=t?await m():null;r.initialized=!0,o.emit("checkout/initialized",i||null)},O=()=>{r.cartId=null,o.emit("checkout/updated",null)},d=async e=>{if(!r.initialized)return p(e);const t=e?e.id:null;r.cartId=t;const i=t?await m():null;o.emit("checkout/updated",i||null)};export{U as a,q as b,R as c,A as d,p as e,m as g,f as i,O as r,d as s,M as t};
@@ -0,0 +1,3 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{events as l}from"@dropins/tools/event-bus.js";const a={email:"",isBillToShipping:!0,selectedPaymentMethod:null,selectedShippingMethod:null};function s(e){const n={...l.lastPayload("checkout/values")??a,...e};l.emit("checkout/values",n)}function u(e){const t=l.lastPayload("checkout/values");return t&&e in t?t[e]:null}export{u as g,s as n};
@@ -1,8 +1,8 @@
1
1
  import { FunctionComponent } from 'preact';
2
2
 
3
3
  export interface ConditionalProps {
4
- isInitialized?: boolean;
5
- isVisible?: boolean;
4
+ initialized?: boolean;
5
+ visible?: boolean;
6
6
  }
7
7
  export declare function WithConditionals<P extends object>(Component: FunctionComponent<P>, Skeleton: FunctionComponent): FunctionComponent<P & ConditionalProps>;
8
8
  //# sourceMappingURL=ConditionalWrapper.d.ts.map
@@ -8,10 +8,10 @@ interface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {
8
8
  }
9
9
  export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading' | 'title'> {
10
10
  isLoading?: boolean;
11
- onChange?: (value: string) => void;
11
+ onChange?: (value: PaymentMethod) => void;
12
12
  options?: ExtendedPaymentMethod[];
13
13
  paymentMethodContent?: VNode;
14
- selection?: string;
14
+ selection: PaymentMethod | null;
15
15
  title?: VNode;
16
16
  UIComponentType?: UIComponentType;
17
17
  }
@@ -1,13 +1,13 @@
1
1
  import { ShippingMethod } from '../../data/models';
2
+ import { UIComponentType } from '../../types/ComponentTypes';
2
3
  import { FunctionComponent, VNode } from 'preact';
3
4
  import { HTMLAttributes } from 'preact/compat';
4
- import { UIComponentType } from '../../types/ComponentTypes';
5
5
 
6
6
  export interface ShippingMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
7
7
  onSelectionChange?: (method: ShippingMethod) => void;
8
8
  isLoading?: boolean;
9
9
  options: ShippingMethod[];
10
- selection?: ShippingMethod;
10
+ selection: ShippingMethod | null;
11
11
  title?: VNode;
12
12
  UIComponentType?: UIComponentType;
13
13
  }
@@ -19,7 +19,6 @@ export * from './ConditionalWrapper/index';
19
19
  export * from './EstimateShipping';
20
20
  export * from './LoginForm';
21
21
  export * from './Markup';
22
- export * from './Newsletter';
23
22
  export * from './OutOfStock';
24
23
  export * from './PaymentMethods';
25
24
  export * from './PlaceOrder';
@@ -1,7 +1,9 @@
1
- import { Container } from '../../../@adobe-commerce/elsie/src/lib';
1
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
2
2
 
3
3
  export interface BillToShippingAddressProps {
4
4
  onChange?: (checked: boolean) => void;
5
+ active?: boolean;
6
+ autoSync?: boolean;
5
7
  }
6
8
  export declare const BillToShippingAddress: Container<BillToShippingAddressProps>;
7
9
  //# sourceMappingURL=BillToShippingAddress.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/subscription-email-statuses.js";import"@dropins/tools/lib.js";import{i as a,h as S}from"../chunks/IsBillToShippingSignal.js";import{events as u}from"@dropins/tools/event-bus.js";import{s as T}from"../chunks/setBillingAddress.js";/* empty css */import{Skeleton as x,SkeletonRow as v,Checkbox as _}from"@dropins/tools/components.js";import{W as z}from"../chunks/ConditionalWrapper.js";import{c as I}from"../chunks/classes.js";import{useText as V}from"@dropins/tools/i18n.js";import"../chunks/SelectedPaymentMethodSignal.js";import"../chunks/SelectedShippingMethodSignal.js";import"../chunks/ServerErrorSignal.js";import{useState as h,useRef as f,useCallback as g,useEffect as k}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const N=()=>n(x,{className:"bill-to-shipping-address__skeleton","data-testid":"bill-to-shipping-skeleton",children:n(v,{size:"small",variant:"row"})}),w=({className:s,checked:e,disabled:t,onChange:c})=>{const l=V({title:"Checkout.BillToShippingAddress.title"});return n("div",{className:"checkout-bill-to-shipping-address",children:n(_,{checked:e,className:I(["checkout-bill-to-shipping-address__checkbox",s]),"data-testid":"bill-to-shipping-checkbox",disabled:t,label:l.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:c})})},D=z(w,N);function E(s){var l;const e=(l=s.shippingAddresses)==null?void 0:l[0],t=!!s.billingAddress;return(e==null?void 0:e.sameAsBilling)??!t}function P(s){var t;return!!((t=s.shippingAddresses)==null?void 0:t[0])}const C=({onChange:s})=>{const[e,t]=h(!0),[c,l]=h(!1),d=f(!1),m=f(!1),b=a.value,A=S.value,B=g(i=>{const r=i.target.checked;a.value=r,s==null||s(r),m.current&&r&&T({sameAsShipping:!0}).catch(console.error)},[s]),p=g(i=>{const o=!!i&&!i.isEmpty&&!i.isVirtual;if(t(o),!o){a.value=!1,d.current=!1;return}if(m.current=P(i),!d.current){const r=E(i);a.value=r,d.current=!0,s==null||s(r)}},[s]);return k(()=>{const i=u.on("checkout/initialized",o=>{l(!0),p(o)},{eager:!0});return()=>{i==null||i.off()}},[p]),k(()=>{const i=u.on("checkout/updated",p,{eager:!1});return()=>{i==null||i.off()}},[p]),n(D,{checked:b,disabled:A,isInitialized:c,isVisible:e,onChange:B})};export{C as BillToShippingAddress,C as default};
3
+ import{jsx as p}from"@dropins/tools/preact-jsx-runtime.js";import{h as x}from"../chunks/errors.js";import"@dropins/tools/lib.js";import{events as f}from"@dropins/tools/event-bus.js";import{W as _,h as z,g as I}from"../chunks/ConditionalWrapper.js";import{n as h}from"../chunks/values.js";import{s as V}from"../chunks/setBillingAddress.js";/* empty css */import{Skeleton as E,SkeletonRow as N,Checkbox as U}from"@dropins/tools/components.js";import{c as w}from"../chunks/classes.js";import{useText as y}from"@dropins/tools/i18n.js";import{useState as m,useRef as D,useCallback as g,useEffect as k}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const P=()=>p(E,{className:"bill-to-shipping-address__skeleton","data-testid":"bill-to-shipping-skeleton",children:p(N,{size:"small",variant:"row"})}),R=({className:s,checked:e,disabled:r,onChange:c})=>{const l=y({title:"Checkout.BillToShippingAddress.title"});return p("div",{className:"checkout-bill-to-shipping-address",children:p(U,{checked:e,className:w(["checkout-bill-to-shipping-address__checkbox",s]),"data-testid":"bill-to-shipping-checkbox",disabled:r,label:l.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:c})})},W=_(R,P);function j(s){var l;const e=(l=s.shippingAddresses)==null?void 0:l[0],r=!!s.billingAddress;return(e==null?void 0:e.sameAsBilling)??!r}const ii=({onChange:s,active:e=!0,autoSync:r=!0})=>{const[c,l]=m(!1),[B,S]=m(!1),[b,a]=m(!0),d=D(!1),A=x.value,T=g(i=>{const t=i.target.checked;a(t),s==null||s(t),h({isBillToShipping:t}),r&&t&&z()&&V({sameAsShipping:!0}).catch(console.error)},[r,s]),n=g(i=>{const o=!i||(i==null?void 0:i.isEmpty),t=!!(i!=null&&i.isVirtual);if(o||t){S(t),a(!1),h({isBillToShipping:!1}),d.current=!1;return}if(!d.current){const u=j(i);a(u),d.current=!0,s==null||s(u),h({isBillToShipping:u})}},[s]);return k(()=>{if(!e)return;const i=I();if(i){l(!0),n(i);return}const o=f.on("checkout/initialized",t=>{l(!0),n(t)},{eager:!0});return()=>{o==null||o.off()}},[e,n]),k(()=>{if(!e)return;const i=f.on("checkout/updated",n,{eager:!1});return()=>{i==null||i.off()}},[e,n]),p(W,{checked:b,disabled:A,initialized:c,visible:e&&!B,onChange:T})};export{ii as BillToShippingAddress,ii as default};
@@ -1,4 +1,7 @@
1
- import { FunctionComponent } from 'preact';
1
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
2
2
 
3
- export declare const EstimateShipping: FunctionComponent;
3
+ export interface EstimateShippingProps {
4
+ active?: boolean;
5
+ }
6
+ export declare const EstimateShipping: Container<EstimateShippingProps>;
4
7
  //# sourceMappingURL=EstimateShipping.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as i,jsxs as S}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as z,SkeletonRow as w,Price as h}from"@dropins/tools/components.js";import{W as B}from"../chunks/ConditionalWrapper.js";import"../chunks/TermsAndConditions.js";import{VComponent as k,classes as I}from"@dropins/tools/lib.js";import{Text as C,useText as G}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css *//* empty css */import{s as P,T as D}from"../chunks/subscription-email-statuses.js";import{events as d}from"@dropins/tools/event-bus.js";import{useState as b,useCallback as X,useEffect as x}from"@dropins/tools/preact-hooks.js";const j=()=>i(z,{"data-testid":"estimate-shipping-skeleton",children:i(w,{size:"xsmall"})}),A=({label:o,price:p,priceExclTax:e,taxExcluded:n=!1,taxIncluded:l=!1})=>S("div",{className:"checkout-estimate-shipping","data-testid":"estimate-shipping",children:[i(k,{className:"checkout-estimate-shipping__label",node:o}),i(k,{className:"checkout-estimate-shipping__price",node:p}),l&&i("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included",children:i(C,{id:"Checkout.EstimateShipping.withTaxes"})}),n&&S("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included-excluded",children:[e," ",i(C,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),U=B(A,j),ie=()=>{var T;const[o,p]=b(!1),[e,n]=b(null),l=!o||o&&e!==null,u=(e==null?void 0:e.amount.value)===0,g=(T=P.config)==null?void 0:T.shoppingCartDisplaySetting.shipping,y=g===D.INCLUDING_EXCLUDING_TAX,f=g===D.INCLUDING_TAX,c=G({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined",label:"Checkout.EstimateShipping.label",estimated:"Checkout.EstimateShipping.estimated"}),r=X(t=>{var E;if(!t||t.isEmpty){n(null);return}const s=(E=t.shippingAddresses)==null?void 0:E[0],a=s==null?void 0:s.selectedShippingMethod;if(!a){n(null);return}const{amount:v,amountExclTax:L,amountInclTax:M}=a;n({estimated:!1,amount:v,amountExclTax:L,amountInclTax:M}),p(!0)},[]);x(()=>{const t=d.on("shipping/estimate",m=>{let s=null;if(m.shippingMethod){const a=m.shippingMethod;s={estimated:!0,amount:a.amount,amountExclTax:a.amountExclTax,amountInclTax:a.amountInclTax}}n(s),p(!0)},{eager:!0});return()=>{t==null||t.off()}},[]),x(()=>{const t=d.on("checkout/initialized",r,{eager:!0});return()=>{t==null||t.off()}},[r]),x(()=>{const t=d.on("checkout/updated",r,{eager:!1});return()=>{t==null||t.off()}},[r]);const _=()=>u?i("span",{"data-testId":"free-shipping",children:c.freeShipping}):f&&(e!=null&&e.amountInclTax)?i(h,{amount:e.amountInclTax.value,currency:e.amountInclTax.currency,"data-testid":"shipping"}):i(h,{amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency,"data-testid":"shipping"}),N=()=>e!=null&&e.amountExclTax?i(h,{amount:e.amountExclTax.value,currency:e.amountExclTax.currency,"data-testid":"shipping-excluding-tax"}):i("span",{children:c.taxToBeDetermined});return i(U,{isInitialized:o,isVisible:l,label:(()=>{const t=e!=null&&e.estimated?c.estimated:c.label;return i("span",{"data-testid":"estimate-shipping-label",children:t})})(),price:_(),priceExclTax:N(),taxExcluded:y&&!u,taxIncluded:f&&!u})};export{ie as EstimateShipping,ie as default};
3
+ import{jsx as i,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as B,SkeletonRow as U,Price as h}from"@dropins/tools/components.js";import{W as z,g as G}from"../chunks/ConditionalWrapper.js";import"../chunks/TermsAndConditions.js";import{VComponent as C,classes as I}from"@dropins/tools/lib.js";import{useText as _}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{s as P,T as D}from"../chunks/errors.js";import{events as d}from"@dropins/tools/event-bus.js";import{useState as V,useCallback as b,useEffect as x}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const X=()=>i(B,{"data-testid":"estimate-shipping-skeleton",children:i(U,{size:"xsmall"})}),j=({label:n,price:t,priceExclTax:a,taxExcluded:o=!1,taxIncluded:c=!1})=>{const l=_({withTaxes:"Checkout.EstimateShipping.withTaxes",withoutTaxes:"Checkout.EstimateShipping.withoutTaxes"});return k("div",{className:"checkout-estimate-shipping","data-testid":"estimate-shipping",children:[i(C,{className:"checkout-estimate-shipping__label",node:n}),i(C,{className:"checkout-estimate-shipping__price",node:t}),c&&i("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included",children:l.withTaxes}),o&&k("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included-excluded",children:[a," ",l.withoutTaxes]})]})},v=z(j,X),nt=({active:n=!0})=>{var T;const[t,a]=V(),o=(t==null?void 0:t.amount.value)===0,c=(T=P.config)==null?void 0:T.shoppingCartDisplaySetting.shipping,l=c===D.INCLUDING_EXCLUDING_TAX,g=c===D.INCLUDING_TAX,u=_({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined",label:"Checkout.EstimateShipping.label",estimated:"Checkout.EstimateShipping.estimated"}),r=b(e=>{var S;const s=!e||e.isEmpty,p=!!(e!=null&&e.isVirtual);if(s||p){a(null);return}const m=(S=e.shippingAddresses)==null?void 0:S[0];if(!m)return;const E=m==null?void 0:m.selectedShippingMethod;if(!E){a(null);return}const{amount:w,amountExclTax:L,amountInclTax:M}=E;a({estimated:!1,amount:w,amountExclTax:L,amountInclTax:M})},[]),f=b(e=>{let s=null;if(e.shippingMethod){const p=e.shippingMethod;s={estimated:!0,amount:p.amount,amountExclTax:p.amountExclTax,amountInclTax:p.amountInclTax}}a(s)},[]);x(()=>{if(!n)return;const e=d.on("shipping/estimate",f,{eager:!0});return()=>{e==null||e.off()}},[n,f]),x(()=>{if(!n)return;const e=G();if(e){r(e);return}const s=d.on("checkout/initialized",r,{eager:!0});return()=>{s==null||s.off()}},[n,r]),x(()=>{if(!n)return;const e=d.on("checkout/updated",r,{eager:!1});return()=>{e==null||e.off()}},[n,r]);const y=()=>o?i("span",{"data-testId":"free-shipping",children:u.freeShipping}):g&&(t!=null&&t.amountInclTax)?i(h,{amount:t.amountInclTax.value,currency:t.amountInclTax.currency,"data-testid":"shipping"}):i(h,{amount:t==null?void 0:t.amount.value,currency:t==null?void 0:t.amount.currency,"data-testid":"shipping"}),N=()=>t!=null&&t.amountExclTax?i(h,{amount:t.amountExclTax.value,currency:t.amountExclTax.currency,"data-testid":"shipping-excluding-tax"}):i("span",{children:u.taxToBeDetermined});return i(v,{initialized:t!==void 0,label:(()=>{const e=t!=null&&t.estimated?u.estimated:u.label;return i("span",{"data-testid":"estimate-shipping-label",children:e})})(),price:y(),priceExclTax:N(),taxExcluded:l&&!o,taxIncluded:g&&!o,visible:n&&t!==null})};export{nt as EstimateShipping,nt as default};
@@ -1,11 +1,13 @@
1
1
  import { TitleProps } from '../../types/TitleProps';
2
- import { Container, SlotProps } from '../../../@adobe-commerce/elsie/src/lib';
2
+ import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
3
  import { HTMLAttributes } from 'preact/compat';
4
4
 
5
5
  export interface LoginFormProps extends HTMLAttributes<HTMLFormElement>, TitleProps {
6
6
  displayHeadingContent?: boolean;
7
+ active?: boolean;
7
8
  onSignInClick?: (email: string) => void;
8
9
  onSignOutClick?: () => void;
10
+ autoSync?: boolean;
9
11
  slots?: {
10
12
  Heading?: SlotProps<{
11
13
  authenticated: boolean;
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as t,jsxs as m,Fragment as te}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/subscription-email-statuses.js";import{VComponent as S,classes as re,Slot as j}from"@dropins/tools/lib.js";import"../chunks/IsBillToShippingSignal.js";import{events as z}from"@dropins/tools/event-bus.js";import{i as ie,s as oe,g as ne}from"../chunks/setGuestEmailOnCart.js";import{Field as ae,Input as le,Skeleton as ce,SkeletonRow as q}from"@dropins/tools/components.js";import{useText as w,Text as N}from"@dropins/tools/i18n.js";/* empty css */import{W as se}from"../chunks/ConditionalWrapper.js";import"../chunks/TermsAndConditions.js";/* empty css *//* empty css *//* empty css *//* empty css */import{useState as h,useRef as I,useCallback as g,useEffect as V,useMemo as D}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const me={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},$=n=>me.EMAIL.test(n),ue=({value:n,error:i,hint:c,onChange:s,onBlur:f,onInvalid:l})=>{const u=w({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return t(ae,{error:i,hint:c,children:t(le,{"aria-label":u.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:u.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",placeholder:u.LoginFormPlaceholder,required:!0,type:"email",value:n,onBlur:f,onChange:s,onInvalid:l})})},de=({onClick:n})=>m("div",{className:"checkout-login-form__sign-in",children:[t(N,{id:"Checkout.LoginForm.account"}),t("a",{className:"checkout-login-form__link","data-testid":"sign-in-link",href:"#",rel:"noreferrer",target:"_blank",onClick:i=>{i.preventDefault(),n(i)},children:t(N,{id:"Checkout.LoginForm.signIn"})})]}),he=()=>m(ce,{"data-testid":"login-form-skeleton",children:[t(q,{fullWidth:!0,variant:"heading"}),t(q,{fullWidth:!0,size:"medium"})]}),ge=({className:n,customer:i,email:c,error:s,headingContent:f,hint:l,name:u,onEmailBlur:A,onEmailChange:y,onEmailInvalid:M,title:E,...H})=>m("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[m("div",{className:"checkout-login-form__heading",children:[E&&t(S,{className:"checkout-login-form__title",node:E}),f&&t(S,{className:"checkout-login-form__heading-label",node:f})]}),i?m("div",{className:"checkout-login-form__customer-details",children:[t("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),t("div",{className:"checkout-login-form__customer-email",children:i.email})]}):t("div",{className:"checkout-login-form__content",children:m("form",{...H,noValidate:!0,className:re(["dropin-login-form__form",n]),name:u,children:[t("button",{disabled:!0,"aria-hidden":"true",style:"display: none",type:"submit"}),t(ue,{error:s,hint:l,value:c,onBlur:A,onChange:y,onInvalid:M})]})})]}),fe=se(ge,he),Ee=({onClick:n})=>m("p",{className:"checkout-login-form__sign-out",children:[t(N,{id:"Checkout.LoginForm.switch"}),t("a",{className:"checkout-login-form__link",href:"#",rel:"noreferrer",target:"_blank",onClick:i=>{i.preventDefault(),n==null||n(i)},children:t(N,{id:"Checkout.LoginForm.signOut"})})]}),ve=1e3,Pe=({displayTitle:n=!0,displayHeadingContent:i=!0,onSignInClick:c,onSignOutClick:s,initialData:f,slots:l,...u})=>{const[A,y]=h(null),[M,E]=h(""),[H,v]=h(""),[T,R]=h(!1),[B,k]=h(!0),[G,J]=h(!1),[K,O]=h(!0),P=I(!1),x=I(""),L=I(""),d=I(null),r=w({AlreadyHaveAccountHint:"Checkout.LoginForm.emailExists.alreadyHaveAccount",FasterCheckoutHint:"Checkout.LoginForm.emailExists.forFasterCheckout",InvalidEmailError:"Checkout.LoginForm.invalidEmailError",MissingEmailError:"Checkout.LoginForm.missingEmailError",SignInLabel:"Checkout.LoginForm.emailExists.signInButton",Title:"Checkout.LoginForm.title"}),p=g(e=>{!$(e)||e===x.current||Promise.all([ie(e),oe(e)]).then(([o])=>{k(o),x.current=e}).catch(o=>{console.error(o),k(!0)})},[]),Q=g(e=>{const a=e.target.value;E(a),k(!0),v(""),L.current=a,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{p(a),d.current=null},ve)},[p]),U=g(e=>{const o=e.target,a=o.value.trim(),b=$(a);let C="";a===""?C=r.MissingEmailError:b||(C=r.InvalidEmailError),v(C),o.setCustomValidity(C),b&&d.current&&(clearTimeout(d.current),d.current=null,p(a))},[r.InvalidEmailError,r.MissingEmailError,p]),X=g(e=>{const b=e.target.validity.valueMissing?r.MissingEmailError:r.InvalidEmailError;v(b)},[r.MissingEmailError,r.InvalidEmailError]),F=g(()=>{const e=L.current;c==null||c($(e)?e:"")},[c]),W=g(()=>{L.current="",s==null||s()},[s]),_=g(e=>{const o=!!e&&!e.isEmpty;if(O(o),!o||P.current)return;const a=e.email??"";E(a),v(""),k(!0),P.current=!0,L.current=a,x.current=a},[]);V(()=>{const e=z.on("authenticated",o=>{R(o),ne().then(a=>{y(a)}).catch(console.error)},{eager:!0});return()=>{e==null||e.off()}},[]),V(()=>{const e=z.on("checkout/initialized",o=>{J(!0),_(o)},{eager:!0});return()=>{e==null||e.off()}},[_]),V(()=>{const e=z.on("checkout/updated",_,{eager:!1});return()=>{e==null||e.off()}},[_]);const Y=D(()=>{if(n)return t(j,{name:"checkout-login-form-title",slot:l==null?void 0:l.Title,children:t("h2",{children:r.Title})})},[n,l,r.Title]),Z=D(()=>{if(i)return t(j,{context:{authenticated:T},name:"checkout-login-form-heading-label",slot:l==null?void 0:l.Heading,children:T?t(Ee,{onClick:W}):t(de,{onClick:F})})},[i,T,l,F,W]),ee=D(()=>B?"":m(te,{children:[r.AlreadyHaveAccountHint," ",t("a",{href:"#",onClick:F,children:r.SignInLabel})," ",r.FasterCheckoutHint]}),[B,r.AlreadyHaveAccountHint,r.SignInLabel,r.FasterCheckoutHint,F]);return t(fe,{...u,customer:A,email:M,error:H,headingContent:Z,hint:ee,isInitialized:G,isVisible:K,title:Y,onEmailBlur:U,onEmailChange:Q,onEmailInvalid:X})};export{Pe as LoginForm,Pe as default};
3
+ import{jsx as r,jsxs as d,Fragment as Y}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/errors.js";import{VComponent as W,classes as Z,Slot as P}from"@dropins/tools/lib.js";import{events as H}from"@dropins/tools/event-bus.js";import{W as ee,a as te,g as re}from"../chunks/ConditionalWrapper.js";import{n as z,g as j}from"../chunks/values.js";import{i as ie,s as oe,g as ne}from"../chunks/setGuestEmailOnCart.js";import{Field as ae,Input as le,Skeleton as se,SkeletonRow as q}from"@dropins/tools/components.js";import{useText as I}from"@dropins/tools/i18n.js";/* empty css */import"../chunks/TermsAndConditions.js";/* empty css *//* empty css *//* empty css */import{useState as f,useRef as ce,useCallback as g,useEffect as T,useMemo as x}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const me={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},V=a=>me.EMAIL.test(a),ue=({value:a,error:n,hint:c,onChange:u,onBlur:m,onInvalid:s})=>{const l=I({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return r(ae,{error:n,hint:c,children:r(le,{"aria-label":l.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:l.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",placeholder:l.LoginFormPlaceholder,required:!0,type:"email",value:a,onBlur:m,onChange:u,onInvalid:s})})},de=({onClick:a})=>{const n=I({account:"Checkout.LoginForm.account",signIn:"Checkout.LoginForm.signIn"});return d("div",{className:"checkout-login-form__sign-in",children:[n.account,r("a",{className:"checkout-login-form__link","data-testid":"sign-in-link",href:"#",rel:"noreferrer",target:"_blank",onClick:c=>{c.preventDefault(),a(c)},children:n.signIn})]})},he=()=>d(se,{"data-testid":"login-form-skeleton",children:[r(q,{fullWidth:!0,variant:"heading"}),r(q,{fullWidth:!0,size:"medium"})]}),ge=({className:a,customer:n,email:c,error:u,headingContent:m,hint:s,name:l,onEmailBlur:k,onEmailChange:N,onEmailInvalid:A,title:L,...y})=>d("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[d("div",{className:"checkout-login-form__heading",children:[L&&r(W,{className:"checkout-login-form__title",node:L}),m&&r(W,{className:"checkout-login-form__heading-label",node:m})]}),n?d("div",{className:"checkout-login-form__customer-details",children:[r("div",{className:"checkout-login-form__customer-name",children:`${n.firstName} ${n.lastName}`}),r("div",{className:"checkout-login-form__customer-email",children:n.email})]}):r("div",{className:"checkout-login-form__content",children:d("form",{...y,noValidate:!0,className:Z(["dropin-login-form__form",a]),name:l,children:[r("button",{disabled:!0,"aria-hidden":"true",style:"display: none",type:"submit"}),r(ue,{error:u,hint:s,value:c,onBlur:k,onChange:N,onInvalid:A})]})})]}),fe=ee(ge,he),Ee=({onClick:a})=>{const n=I({switch:"Checkout.LoginForm.switch",signOut:"Checkout.LoginForm.signOut"});return d("p",{className:"checkout-login-form__sign-out",children:[n.switch,r("a",{className:"checkout-login-form__link",href:"#",rel:"noreferrer",target:"_blank",onClick:c=>{c.preventDefault(),a==null||a(c)},children:n.signOut})]})},ke=1e3,De=({displayHeadingContent:a=!0,displayTitle:n=!0,initialData:c,onSignInClick:u,onSignOutClick:m,slots:s,active:l=!0,autoSync:k=!0,...N})=>{const[A,L]=f(null),[y,$]=f(""),[O,p]=f(""),[M,R]=f(!1),[B,v]=f(!0),[U,D]=f(!1),h=ce(null),o=I({AlreadyHaveAccountHint:"Checkout.LoginForm.emailExists.alreadyHaveAccount",FasterCheckoutHint:"Checkout.LoginForm.emailExists.forFasterCheckout",InvalidEmailError:"Checkout.LoginForm.invalidEmailError",MissingEmailError:"Checkout.LoginForm.missingEmailError",SignInLabel:"Checkout.LoginForm.emailExists.signInButton",Title:"Checkout.LoginForm.title"}),F=g(e=>{!V(e)||e===te()||(ie(e).then(t=>{v(t)}).catch(t=>{console.error(t),v(!0)}),k&&oe(e).catch(t=>{console.error("Error setting guest email on cart:",t)}))},[k]),G=g(e=>{const i=e.target.value;$(i),v(!0),p(""),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{F(i),z({email:i}),h.current=null},ke)},[F]),S=g(e=>{const t=e.target,i=t.value.trim(),b=V(i);let C="";i===""?C=o.MissingEmailError:b||(C=o.InvalidEmailError),p(C),t.setCustomValidity(C),b&&h.current&&(clearTimeout(h.current),h.current=null,F(i),z({email:i}))},[o.InvalidEmailError,o.MissingEmailError,F]),J=g(e=>{const b=e.target.validity.valueMissing?o.MissingEmailError:o.InvalidEmailError;p(b)},[o.MissingEmailError,o.InvalidEmailError]),_=g(()=>{const e=j("email")??"",t=V(e);u==null||u(t?e:"")},[u]),w=g(()=>{m==null||m()},[m]),E=g(e=>{const t=j("email")??"",i=(e==null?void 0:e.email)??"";i!==t&&($(i),p(""),v(!0),z({email:i}))},[]);T(()=>{if(!l)return;const e=H.on("authenticated",t=>{R(t),ne().then(i=>{L(i)}).catch(console.error)},{eager:!0});return()=>{e==null||e.off()}},[l]),T(()=>{if(!l)return;const e=re();if(e){D(!0),E(e);return}const t=H.on("checkout/initialized",i=>{D(!0),E(i)},{eager:!0});return()=>{t==null||t.off()}},[l,E]),T(()=>{if(!l)return;const e=H.on("checkout/updated",E,{eager:!1});return()=>{e==null||e.off()}},[l,E]);const K=x(()=>{if(n)return r(P,{name:"checkout-login-form-title",slot:s==null?void 0:s.Title,children:r("h2",{children:o.Title})})},[n,s,o.Title]),Q=x(()=>{if(a)return r(P,{context:{authenticated:M},name:"checkout-login-form-heading-label",slot:s==null?void 0:s.Heading,children:M?r(Ee,{onClick:w}):r(de,{onClick:_})})},[a,M,s,_,w]),X=x(()=>B?"":d(Y,{children:[o.AlreadyHaveAccountHint," ",r("a",{href:"#",onClick:_,children:o.SignInLabel})," ",o.FasterCheckoutHint]}),[B,o.AlreadyHaveAccountHint,o.SignInLabel,o.FasterCheckoutHint,_]);return r(fe,{...N,customer:A,email:y,error:O,headingContent:Q,hint:X,initialized:U,title:K,visible:l,onEmailBlur:S,onEmailChange:G,onEmailInvalid:J})};export{De as LoginForm,De as default};
@@ -1,5 +1,8 @@
1
- import { AlertBannerProps } from '../../../@adobe-commerce/elsie/src/components';
2
- import { Container } from '../../../@adobe-commerce/elsie/src/lib/types';
1
+ import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components';
2
+ import { Container } from '@dropins/tools/types/elsie/src/lib/types';
3
3
 
4
- export declare const MergedCartBanner: Container<AlertBannerProps>;
4
+ export interface MergedCartBannerProps extends AlertBannerProps {
5
+ active?: boolean;
6
+ }
7
+ export declare const MergedCartBanner: Container<MergedCartBannerProps>;
5
8
  //# sourceMappingURL=MergedCartBanner.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 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{useState as h,useEffect as v}from"@dropins/tools/preact-hooks.js";import*as i from"@dropins/tools/preact-compat.js";import{useText as B,Text as w}from"@dropins/tools/i18n.js";const x=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"})),Z=({className:t,initialData:H,...c})=>{const[r,s]=h(0),a=B({mergedCartBannerItems:e(w,{fields:{count:r},id:"Checkout.MergedCartBanner.items",plural:r})}),C=()=>{s(0)};return 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()}},[]),r?e(u,{...c,"aria-label":a.mergedCartBannerItems,className:p(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(g,{source:x}),message:e("span",{children:a.mergedCartBannerItems}),variant:"neutral",onDismiss:C}):null};export{Z as MergedCartBanner,Z as default};
3
+ import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as p}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as I}from"@dropins/tools/event-bus.js";import{useState as B,useCallback as M,useEffect as v}from"@dropins/tools/preact-hooks.js";import*as c from"@dropins/tools/preact-compat.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";const H=r=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},c.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"})),D=({className:r,initialData:V,active:n=!0,...C})=>{const[s,o]=B(0),a=w({mergedCartBannerItems:t(x,{fields:{count:s},id:"Checkout.MergedCartBanner.items",plural:s})}),u=()=>{o(0)},l=M(e=>{var i;const m=(i=e==null?void 0:e.oldCartItems)==null?void 0:i.reduce((d,f)=>d+f.quantity,0);m>0&&o(m)},[]);return v(()=>{if(!n)return;const e=I.on("cart/merged",l,{eager:!0});return()=>{e==null||e.off()}},[n,l]),!n||!s?null:t(g,{...C,"aria-label":a.mergedCartBannerItems,className:h(["checkout__banner",r]),"data-testid":"merged-cart-banner",icon:t(p,{source:H}),message:t("span",{children:a.mergedCartBannerItems}),variant:"neutral",onDismiss:u})};export{D as MergedCartBanner,D as default};
@@ -1,4 +1,4 @@
1
- import { Container } from '../../../@adobe-commerce/elsie/src/lib';
1
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
3
 
4
4
  export type UpdateProductsFromCart = Array<{
@@ -8,6 +8,7 @@ export type UpdateProductsFromCart = Array<{
8
8
  export interface OutOfStockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'icon'> {
9
9
  onCartProductsUpdate?: (items: UpdateProductsFromCart) => void;
10
10
  routeCart?: () => string;
11
+ active?: boolean;
11
12
  }
12
13
  export declare const OutOfStock: Container<OutOfStockProps>;
13
14
  //# sourceMappingURL=OutOfStock.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as m,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";import"../chunks/TermsAndConditions.js";import{classes as O}from"@dropins/tools/lib.js";/* empty css */import{S as d}from"../chunks/OrderError.js";import{useText as p}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{events as S}from"@dropins/tools/event-bus.js";import{useState as v,useCallback as _,useEffect as g}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";const N=({className:i,items:r,onRemoveOutOfStock:o,routeCart:u,...a})=>{const s=p({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return m(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...a,children:[m("h4",{className:"checkout-out-of-stock__title",children:[e(l,{size:"16",source:d,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(t=>e("li",{className:"checkout-out-of-stock__item","data-testid":"out-of-stock-item",children:e(h,{alt:t.image.alt,height:"100",loading:"eager",params:{width:100},src:t.image.src,width:"100"})},t.sku))}),m("div",{className:"checkout-out-of-stock__actions",children:[u&&e("a",{className:"checkout-out-of-stock__action","data-testid":"review-cart",href:u,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})]})]})},A=({onCartProductsUpdate:i,routeCart:r})=>{const[o,u]=v([]),a=_(()=>{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=S.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];u(f.filter(n=>n.outOfStock||n.insufficientQuantity))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const s=!o.some(t=>t.insufficientQuantity);return e(N,{items:o,routeCart:r==null?void 0:r(),onRemoveOutOfStock:s?a:void 0})};export{A as OutOfStock,A as default};
3
+ import{jsxs as n,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as l,Icon as h,Image as O}from"@dropins/tools/components.js";import"../chunks/TermsAndConditions.js";import{classes as d}from"@dropins/tools/lib.js";import{S as p}from"../chunks/OrderError.js";import{useText as S}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{events as _}from"@dropins/tools/event-bus.js";import{useState as g,useCallback as v,useEffect as N}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";const w=({className:r,items:u,onRemoveOutOfStock:s,routeCart:t,...m})=>{const i=S({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(l,{className:d(["checkout-out-of-stock",r]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n("h4",{className:"checkout-out-of-stock__title",children:[o(h,{size:"16",source:p,stroke:"1"}),i.title]}),o("p",{className:"checkout-out-of-stock__message",children:i.message}),o("ol",{className:"checkout-out-of-stock__items",children:u.map(a=>o("li",{className:"checkout-out-of-stock__item","data-testid":"out-of-stock-item",children:o(O,{alt:a.image.alt,height:"100",loading:"eager",params:{width:100},src:a.image.src,width:"100"})},a.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[t&&o("a",{className:"checkout-out-of-stock__action","data-testid":"review-cart",href:t,children:i.reviewCart}),s&&o("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:s,children:i.removeOutOfStock})]})]})},A=({onCartProductsUpdate:r,routeCart:u,active:s=!0})=>{const[t,m]=g([]),i=v(()=>{if(!r)return;const e=t.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));r(e)},[t,r]);if(N(()=>{if(!s)return;const e=_.on("cart/data",c=>{const k=(c==null?void 0:c.items)||[];m(k.filter(f=>f.outOfStock||f.insufficientQuantity))},{eager:!0});return()=>{e==null||e.off()}},[s]),!s||t.length===0)return null;const a=!t.some(e=>e.insufficientQuantity);return o(w,{items:t,routeCart:u==null?void 0:u(),onRemoveOutOfStock:a?i:void 0})};export{A as OutOfStock,A as default};
@@ -1,6 +1,6 @@
1
1
  import { UIComponentType } from '../../types/ComponentTypes';
2
2
  import { TitleProps } from '../../types/TitleProps';
3
- import { Container, SlotProps } from '../../../@adobe-commerce/elsie/src/lib';
3
+ import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
4
4
  import { HTMLAttributes } from 'preact/compat';
5
5
 
6
6
  export interface PaymentMethodRenderCtx {
@@ -11,33 +11,19 @@ export interface PaymentMethodConfig {
11
11
  displayLabel?: boolean;
12
12
  enabled?: boolean;
13
13
  icon?: string;
14
- setOnChange?: boolean;
14
+ autoSync?: boolean;
15
15
  render?: SlotProps<PaymentMethodRenderCtx>;
16
16
  }
17
17
  export interface PaymentMethodsSlot {
18
18
  [code: string]: PaymentMethodConfig;
19
19
  }
20
- /**
21
- * @deprecated This property is deprecated and will be removed in future versions.
22
- */
23
- export interface PaymentMethodsHandlerSlot {
24
- [code: string]: PaymentMethodConfig['render'];
25
- }
26
20
  export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement>, TitleProps {
27
- /**
28
- * @deprecated This property is deprecated and will be removed in future versions.
29
- */
30
- setOnChange?: {
31
- [key: string]: boolean;
32
- };
33
21
  slots?: {
34
- /**
35
- * @deprecated This property is deprecated and will be removed in future versions, use Methods instead.
36
- */
37
- Handlers?: PaymentMethodsHandlerSlot;
38
22
  Methods?: PaymentMethodsSlot;
39
23
  } & TitleProps['slots'];
40
24
  UIComponentType?: UIComponentType;
25
+ active?: boolean;
26
+ autoSync?: boolean;
41
27
  }
42
28
  export declare const PaymentMethods: Container<PaymentMethodsProps>;
43
29
  //# sourceMappingURL=PaymentMethods.d.ts.map