@dropins/storefront-checkout 1.3.0 → 1.4.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 (174) hide show
  1. package/__generated__/types.d.ts +12644 -0
  2. package/api/estimateShippingMethods/graphql/index.d.ts +15 -15
  3. package/api/estimateShippingMethods/index.d.ts +15 -15
  4. package/api/fetch-graphql/fetch-graphql.d.ts +19 -19
  5. package/api/fetch-graphql/index.d.ts +15 -15
  6. package/api/getCart/fixtures.d.ts +3 -2
  7. package/api/getCart/getCart.d.ts +16 -16
  8. package/api/getCart/graphql/index.d.ts +15 -15
  9. package/api/getCart/index.d.ts +15 -15
  10. package/api/getCheckoutAgreements/graphql/getCheckoutAgreements.graphql.d.ts +1 -1
  11. package/api/getCheckoutAgreements/index.d.ts +1 -1
  12. package/api/getCustomer/getCustomer.d.ts +1 -1
  13. package/api/getCustomer/graphql/index.d.ts +15 -15
  14. package/api/getCustomer/index.d.ts +15 -15
  15. package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +1 -1
  16. package/api/getStoreConfig/index.d.ts +15 -15
  17. package/api/index.d.ts +2 -1
  18. package/api/initialize/index.d.ts +15 -15
  19. package/api/initialize/initialize.d.ts +3 -3
  20. package/api/initializeCheckout/index.d.ts +15 -15
  21. package/api/initializeCheckout/initializeCheckout.d.ts +1 -1
  22. package/api/isEmailAvailable/graphql/isEmailAvailable.graphql.d.ts +15 -15
  23. package/api/isEmailAvailable/index.d.ts +15 -15
  24. package/api/setBillingAddress/index.d.ts +15 -15
  25. package/api/setBillingAddress/setBillingAddress.d.ts +1 -1
  26. package/api/setGuestEmailOnCart/index.d.ts +15 -15
  27. package/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts +1 -1
  28. package/api/setPaymentMethod/index.d.ts +15 -15
  29. package/api/setPaymentMethod/setPaymentMethod.d.ts +1 -1
  30. package/api/setShippingAddress/index.d.ts +15 -15
  31. package/api/setShippingAddress/setShippingAddress.d.ts +1 -1
  32. package/api/setShippingMethods/index.d.ts +15 -15
  33. package/api/setShippingMethods/setShippingMethods.d.ts +1 -1
  34. package/api/subscribeEmailToNewsletter/graphql/subscribeEmailToNewsletter.graphql.d.ts +18 -0
  35. package/{hocs → api/subscribeEmailToNewsletter}/index.d.ts +1 -1
  36. package/api/subscribeEmailToNewsletter/subscribeEmailToNewsletter.d.ts +4 -0
  37. package/api/synchronizeCheckout/synchronizeCheckout.d.ts +1 -1
  38. package/api.js +12 -6
  39. package/chunks/ConditionalWrapper.js +3 -0
  40. package/chunks/IsBillToShippingSignal.js +14 -0
  41. package/chunks/SelectedPaymentMethodSignal.js +3 -0
  42. package/chunks/SelectedShippingMethodSignal.js +3 -0
  43. package/chunks/ServerErrorSignal.js +3 -0
  44. package/chunks/TermsAndConditions.js +2 -2
  45. package/chunks/setBillingAddress.js +3 -3
  46. package/chunks/setGuestEmailOnCart.js +12 -4
  47. package/chunks/setPaymentMethod.js +3 -3
  48. package/chunks/setShippingMethods.js +3 -3
  49. package/chunks/subscription-email-statuses.js +3 -0
  50. package/chunks/synchronizeCheckout.js +5 -13
  51. package/components/BillToShippingAddress/BillToShippingAddress.d.ts +1 -2
  52. package/components/BillToShippingAddress/index.d.ts +15 -15
  53. package/components/ConditionalWrapper/ConditionalWrapper.d.ts +8 -0
  54. package/components/ConditionalWrapper/index.d.ts +19 -0
  55. package/components/EstimateShipping/EstimateShipping.d.ts +2 -2
  56. package/components/EstimateShipping/index.d.ts +15 -15
  57. package/components/LoginForm/LoginForm.d.ts +9 -12
  58. package/components/LoginForm/SignOut.d.ts +1 -1
  59. package/components/LoginForm/index.d.ts +15 -15
  60. package/components/Newsletter/Newsletter.d.ts +7 -0
  61. package/components/Newsletter/NewsletterSkeleton.d.ts +4 -0
  62. package/components/Newsletter/index.d.ts +20 -0
  63. package/components/OutOfStock/index.d.ts +15 -15
  64. package/components/PaymentMethods/PaymentMethods.d.ts +7 -5
  65. package/components/PlaceOrder/PlaceOrder.d.ts +1 -1
  66. package/components/PlaceOrder/index.d.ts +15 -15
  67. package/components/ServerError/index.d.ts +15 -15
  68. package/components/ShippingMethods/ShippingMethods.d.ts +8 -5
  69. package/components/ShippingMethods/index.d.ts +15 -15
  70. package/components/TermsAndConditions/TermsAndConditions.d.ts +1 -2
  71. package/components/index.d.ts +2 -0
  72. package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +3 -20
  73. package/containers/BillToShippingAddress.js +1 -1
  74. package/containers/EstimateShipping/index.d.ts +15 -15
  75. package/containers/EstimateShipping.js +1 -1
  76. package/containers/LoginForm/LoginForm.d.ts +10 -5
  77. package/containers/LoginForm.js +1 -1
  78. package/containers/MergedCartBanner/MergedCartBanner.d.ts +3 -5
  79. package/containers/MergedCartBanner.js +1 -1
  80. package/containers/Newsletter/Newsletter.d.ts +9 -0
  81. package/{utils/isUnexpectedError/isUnexpectedError.d.ts → containers/Newsletter/index.d.ts} +3 -2
  82. package/containers/Newsletter.d.ts +3 -0
  83. package/containers/Newsletter.js +3 -0
  84. package/containers/OutOfStock/OutOfStock.d.ts +1 -1
  85. package/containers/OutOfStock/index.d.ts +15 -15
  86. package/containers/OutOfStock.js +1 -1
  87. package/containers/PaymentMethods/PaymentMethods.d.ts +7 -7
  88. package/containers/PaymentMethods.js +1 -1
  89. package/containers/PlaceOrder/PlaceOrder.d.ts +4 -5
  90. package/containers/PlaceOrder/index.d.ts +15 -15
  91. package/containers/PlaceOrder.js +1 -1
  92. package/containers/ServerError/ServerError.d.ts +1 -1
  93. package/containers/ServerError.js +1 -1
  94. package/containers/ShippingMethods/ShippingMethods.d.ts +6 -7
  95. package/containers/ShippingMethods/index.d.ts +15 -15
  96. package/containers/ShippingMethods/utils/emitShippingEstimateEvent.d.ts +1 -1
  97. package/containers/ShippingMethods.js +1 -1
  98. package/containers/TermsAndConditions/TermsAndConditions.d.ts +1 -1
  99. package/containers/TermsAndConditions.js +1 -1
  100. package/containers/index.d.ts +1 -0
  101. package/data/models/country.d.ts +15 -15
  102. package/data/models/custom-attribute.d.ts +15 -15
  103. package/data/models/email-availability.d.ts +15 -15
  104. package/data/models/index.d.ts +1 -0
  105. package/data/models/payment-method.d.ts +15 -15
  106. package/data/models/price.d.ts +15 -15
  107. package/data/models/store-config.d.ts +2 -3
  108. package/{utils/index.d.ts → data/models/subscription-email-statuses.d.ts} +8 -6
  109. package/data/transforms/transform-cart.d.ts +2 -2
  110. package/data/transforms/transform-checkout-agreements.d.ts +1 -1
  111. package/data/transforms/transform-customer.d.ts +1 -1
  112. package/data/transforms/transform-shipping-methods.d.ts +2 -1
  113. package/{api/errors → errors}/errors.d.ts +1 -1
  114. package/{utils/convertCase → errors}/index.d.ts +1 -1
  115. package/i18n/en_US.json.d.ts +31 -28
  116. package/lib/dispatchApiCall.d.ts +16 -0
  117. package/lib/dom.d.ts +18 -0
  118. package/lib/enqueueRequest.d.ts +13 -0
  119. package/{api/utils → lib}/filterControlledErrors.d.ts +1 -1
  120. package/lib/index.d.ts +3 -1
  121. package/lib/network-error.d.ts +15 -15
  122. package/lib/preact.d.ts +4 -0
  123. package/msw/browser.d.ts +15 -15
  124. package/msw/fixtures/fragments/cart.d.ts +15 -15
  125. package/msw/fixtures/index.d.ts +15 -15
  126. package/msw/fixtures/mutations/index.d.ts +15 -15
  127. package/msw/fixtures/queries/index.d.ts +15 -15
  128. package/msw/server.d.ts +15 -15
  129. package/package.json +1 -1
  130. package/render/index.d.ts +15 -15
  131. package/render/render.d.ts +1 -1
  132. package/render.js +7 -6
  133. package/signals/IsSubscribedToNewsletterSignal.d.ts +18 -0
  134. package/signals/ShippingEstimateSignal.d.ts +8 -0
  135. package/signals/index.d.ts +2 -4
  136. package/tests/constants.d.ts +15 -15
  137. package/tests/integration/utils/index.d.ts +15 -15
  138. package/tests/integration/utils/user-actions.d.ts +15 -15
  139. package/tests/mocks/svg.d.ts +15 -15
  140. package/tests/utils/expectError.d.ts +15 -15
  141. package/tests/utils/index.d.ts +15 -15
  142. package/tests/utils/mockEvents.d.ts +15 -15
  143. package/{hooks/index.d.ts → types/ComponentTypes.d.ts} +2 -3
  144. package/types/TitleProps.d.ts +9 -0
  145. package/api/errors/index.d.ts +0 -18
  146. package/api/utils/dispatchApiCall.d.ts +0 -36
  147. package/api/utils/enqueueRequest.d.ts +0 -26
  148. package/chunks/errors.js +0 -3
  149. package/chunks/state.js +0 -3
  150. package/chunks/store-config.js +0 -3
  151. package/chunks/transform-store-config.js +0 -13
  152. package/chunks/withConditionalRendering.js +0 -3
  153. package/hocs/withConditionalRendering.d.ts +0 -13
  154. package/hooks/useBreakpoint/index.d.ts +0 -18
  155. package/hooks/useBreakpoint/useBreakpoint.d.ts +0 -18
  156. package/hooks/useStableList/index.d.ts +0 -2
  157. package/hooks/useStableList/useStableList.d.ts +0 -2
  158. package/lib/fetch-error.d.ts +0 -23
  159. package/signals/CartSignal.d.ts +0 -7
  160. package/signals/CustomerSignal.d.ts +0 -7
  161. package/signals/EmailSignal.d.ts +0 -26
  162. package/signals/EstimateShippingMethodsSignal.d.ts +0 -7
  163. package/utils/convertCase/convertCase.d.ts +0 -4
  164. package/utils/getDisplayName/getDisplayName.d.ts +0 -4
  165. package/utils/getDisplayName/index.d.ts +0 -18
  166. package/utils/isEmpty/index.d.ts +0 -18
  167. package/utils/isEmpty/isEmpty.d.ts +0 -18
  168. package/utils/isNullish/index.d.ts +0 -18
  169. package/utils/isNullish/isNullish.d.ts +0 -18
  170. package/utils/isUnexpectedError/index.d.ts +0 -18
  171. package/utils/scrollToElement/index.d.ts +0 -2
  172. package/utils/scrollToElement/scrollToElement.d.ts +0 -2
  173. package/utils/shippingMethods/index.d.ts +0 -18
  174. package/utils/shippingMethods/isEqual.d.ts +0 -4
@@ -1,27 +1,19 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{s as i}from"./state.js";import{f as C,g as y,c as m,e as R,m as z}from"./transform-store-config.js";import{events as c}from"@dropins/tools/event-bus.js";import{merge as A,Initializer as G}from"@dropins/tools/lib.js";import{CHECKOUT_DATA_FRAGMENT as b,CUSTOMER_FRAGMENT as O}from"../fragments.js";import{F as $,M as U}from"./errors.js";const D=async(e=!1)=>{i.authenticated=e,e?await me():C.value={pending:!1,data:null}},x={cartUpdate:{requests:[]},default:{requests:[]}};function F(e,t="default"){const r=x[t];return new Promise((n,o)=>{r.requests.push(e);const a=()=>{r.requests[0]===e?e().then(n).catch(o).finally(()=>{var l;r.requests.shift(),r.requests.length===0?(l=r.onComplete)==null||l.call(r):a()}):setTimeout(a,100)};a()})}function Q(e,t){const r=x[e];r.onComplete=t}const V=["sender_email","recipient_email"];function B(e){return e.filter(t=>!t.path||!V.some(r=>{var n;return((n=t.path)==null?void 0:n.at(-1))===r}))}const v=e=>{throw e instanceof DOMException&&e.name==="AbortError"||c.emit("error",{source:"checkout",type:"network",error:e}),e},H={cart:m,customer:C,estimateShippingMethods:R};function K(e,t){return t.split(".").reduce((r,n)=>r&&r[n]!==void 0?r[n]:void 0,e)}const _={cart:null,customer:null,estimateShippingMethods:null};async function E(e){const{defaultValueOnFail:t,options:r,path:n,query:o,queueName:a,signalType:l,transformer:p,type:P}=e,s=H[l],d=Symbol();_[l]=d,s.value={...s.value,pending:!0};try{const{data:f,errors:h}=await(P==="mutation"?F(()=>y(o,r).catch(v),a):y(o,{method:"GET",cache:"no-cache",...r}).catch(v));if(h){const g=B(h);if(g.length>0)throw new $(g)}let u=K(f,n);if(u===void 0)throw new Error(`No data found at path: ${n}`);return p&&(u=p(u)),s.value={...s.value,data:u},setTimeout(()=>{s.value={...s.value,pending:_[l]===d?!1:s.value.pending}},0),u}catch(f){if(t)return s.value={pending:!1,data:t},t;if(f.name==="AbortError")return;throw s.value={...s.value,pending:!1},f}}const j=e=>e==null,L=(e,t)=>e.amount.value-t.amount.value,M=e=>!(!e||!e.method_code||!e.method_title||j(e.amount.value)||!e.amount.currency),T=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}}}),J=e=>{if(M(e))return T(e)},W=e=>{if(e)return e.filter(M).map(t=>T(t)).sort(L)},X=e=>e?!!e.code&&!!e.label:!1,Y=e=>{if(!X(e))return;const{code:t,label:r,region_id:n}=e;return n?{code:t,name:r,id:n}:{code:t,name:r}},Z=e=>{const{code:t,label:r}=e;return{value:t,label:r}},ee=e=>e?"code"in e&&"value"in e:!1,te=e=>e.filter(ee).map(t=>{const{code:r,value:n}=t;return{code:r,value:n}}),S=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:Z(e.country),customAttributes:te(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:Y(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}},re=e=>{if(e)return S(e)},ne=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:r,selected_shipping_method:n,same_as_billing:o,...a}=t;return{...S(a),availableShippingMethods:W(r),selectedShippingMethod:J(n),sameAsBilling:o}}),Ce=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}),ie=e=>{if(e)return{code:e.code,title:e.title}},oe=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:r,title:n}=t;return{code:r,title:n}})},se=e=>{var r,n,o;if(!e)return;const t={availablePaymentMethods:oe(e.available_payment_methods),billingAddress:re(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:ie(e.selected_payment_method),shippingAddresses:ne(e.shipping_addresses),isGuest:!i.authenticated};return A(t,(o=(n=(r=N.getConfig().models)==null?void 0:r.CartModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},ce=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=N.getConfig().models)==null?void 0:r.CustomerModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},ae=`
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=`
4
4
  query getCart($cartId: String!) {
5
5
  cart(cart_id: $cartId) {
6
6
  ...CHECKOUT_DATA_FRAGMENT
7
7
  }
8
8
  }
9
9
 
10
- ${b}
11
- `,le=`
10
+ ${c}
11
+ `,D=`
12
12
  query getCustomerCart {
13
13
  cart: customerCart {
14
14
  ...CHECKOUT_DATA_FRAGMENT
15
15
  }
16
16
  }
17
17
 
18
- ${b}
19
- `,w=async()=>{const e=i.cartId,t=i.authenticated===!1,r=t?ae:le,n=t?{cartId:e}:{};if(t&&!e)throw new U;return await E({type:"query",query:r,options:{method:"POST",cache:"no-cache",variables:n},path:"cart",signalType:"cart",transformer:se})},ue=`
20
- query getCustomer {
21
- customer {
22
- ...CUSTOMER_FRAGMENT
23
- }
24
- }
25
-
26
- ${O}
27
- `,me=async()=>{if(i.authenticated)return await E({type:"query",query:ue,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:ce})},fe=()=>[c.on("authenticated",D,{eager:!0}),c.on("cart/initialized",I,{eager:!0}),c.on("cart/reset",pe),c.on("cart/updated",k)],q=new G({init:async e=>{const t=e||{};q.config.setConfig(t)},listeners:fe}),N=q.config;Q("cartUpdate",()=>{c.emit("checkout/updated",m.value.data)});const I=async e=>{if(i.initialized)return k(e);i.config||(i.config=await z());const t=e?e.id:null;i.cartId=t;const r=t?await w():null;m.value={pending:!1,data:r},i.initialized=!0,c.emit("checkout/initialized",r||null)},pe=()=>{i.cartId=null,m.value={pending:!1,data:null},c.emit("checkout/updated",null)},k=async e=>{if(!i.initialized)return I(e);const t=e?e.id:null;i.cartId=t;const r=t?await w():null;m.value={pending:!1,data:r},c.emit("checkout/updated",r||null)};export{Ce as a,se as b,N as c,E as d,D as e,me as f,w as g,I as h,q as i,v as j,pe as r,k as s,W as t};
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};
@@ -2,8 +2,7 @@ import { FunctionComponent } from 'preact';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
3
 
4
4
  export interface BillToShippingAddressProps extends Omit<HTMLAttributes<HTMLInputElement>, 'loading' | 'disabled'> {
5
- loading?: boolean;
6
5
  disabled?: boolean;
7
6
  }
8
- export declare const BillToShippingAddress: FunctionComponent<BillToShippingAddressProps>;
7
+ export declare const BillToShippingAddress: FunctionComponent<BillToShippingAddressProps & import('../ConditionalWrapper/ConditionalWrapper').ConditionalProps>;
9
8
  //# sourceMappingURL=BillToShippingAddress.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 './BillToShippingAddress';
18
18
  export * from './BillToShippingAddressSkeleton';
19
19
  export { BillToShippingAddress as default } from './BillToShippingAddress';
@@ -0,0 +1,8 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export interface ConditionalProps {
4
+ isInitialized?: boolean;
5
+ isVisible?: boolean;
6
+ }
7
+ export declare function WithConditionals<P extends object>(Component: FunctionComponent<P>, Skeleton: FunctionComponent): FunctionComponent<P & ConditionalProps>;
8
+ //# sourceMappingURL=ConditionalWrapper.d.ts.map
@@ -0,0 +1,19 @@
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
+ *******************************************************************/
17
+ export * from './ConditionalWrapper';
18
+ export { WithConditionals as default } from './ConditionalWrapper';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -2,11 +2,11 @@ import { FunctionComponent, VNode } from 'preact';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
3
 
4
4
  export interface EstimateShippingProps {
5
- estimated?: boolean;
5
+ label: VNode<HTMLAttributes<HTMLSpanElement>>;
6
6
  price: VNode<HTMLAttributes<HTMLSpanElement>>;
7
7
  priceExclTax?: VNode<HTMLAttributes<HTMLSpanElement>>;
8
8
  taxExcluded?: boolean;
9
9
  taxIncluded?: boolean;
10
10
  }
11
- export declare const EstimateShipping: FunctionComponent<EstimateShippingProps>;
11
+ export declare const EstimateShipping: FunctionComponent<EstimateShippingProps & import('../ConditionalWrapper').ConditionalProps>;
12
12
  //# sourceMappingURL=EstimateShipping.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 './EstimateShipping';
18
18
  export { EstimateShipping as default } from './EstimateShipping';
19
19
  export * from './EstimateShippingSkeleton';
@@ -1,20 +1,17 @@
1
- import { FunctionComponent, HTMLAttributes } from 'preact/compat';
1
+ import { Customer } from '../../data/models';
2
+ import { FunctionComponent, VNode } from 'preact';
3
+ import { HTMLAttributes } from 'preact/compat';
2
4
 
3
- export interface LoginFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'loading'> {
4
- customerDetails?: {
5
- firstName: string;
6
- lastName: string;
7
- email: string;
8
- };
5
+ export interface LoginFormProps extends Omit<HTMLAttributes<HTMLFormElement>, 'title'> {
6
+ customer: Customer | null;
9
7
  email: string;
10
8
  error: string;
11
- hint: string;
12
- loading?: boolean;
9
+ headingContent?: VNode;
10
+ hint: string | VNode;
13
11
  onEmailBlur: (event: Event) => void;
14
12
  onEmailChange: (event: Event) => void;
15
13
  onEmailInvalid: (event: Event) => void;
16
- onSignInClick?: (email: string) => void;
17
- onSignOutClick?: () => void;
14
+ title?: VNode;
18
15
  }
19
- export declare const LoginForm: FunctionComponent<LoginFormProps>;
16
+ export declare const LoginForm: FunctionComponent<LoginFormProps & import('..').ConditionalProps>;
20
17
  //# sourceMappingURL=LoginForm.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { FunctionComponent } from 'preact';
2
2
 
3
3
  interface SignOutProps {
4
- onClick?: (event: Event) => void;
4
+ onClick: (event: Event) => void;
5
5
  }
6
6
  export declare const SignOut: FunctionComponent<SignOutProps>;
7
7
  export {};
@@ -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 './Email';
18
18
  export * from './SignIn';
19
19
  export * from './LoginForm';
@@ -0,0 +1,7 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface NewsletterProps extends HTMLAttributes<HTMLInputElement> {
5
+ }
6
+ export declare const Newsletter: FunctionComponent<NewsletterProps & import('../ConditionalWrapper').ConditionalProps>;
7
+ //# sourceMappingURL=Newsletter.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export declare const NewsletterSkeleton: FunctionComponent;
4
+ //# sourceMappingURL=NewsletterSkeleton.d.ts.map
@@ -0,0 +1,20 @@
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
+ *******************************************************************/
17
+ export * from './Newsletter';
18
+ export * from './NewsletterSkeleton';
19
+ export { Newsletter as default } from './Newsletter';
20
+ //# sourceMappingURL=index.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 './OutOfStock';
18
18
  export { OutOfStock as default } from './OutOfStock';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,20 @@
1
+ import { PaymentMethodConfig } from '../../containers';
1
2
  import { PaymentMethod } from '../../data/models/payment-method';
3
+ import { UIComponentType } from '../../types/ComponentTypes';
2
4
  import { FunctionComponent, VNode } from 'preact';
3
5
  import { HTMLAttributes } from 'preact/compat';
4
- import { PaymentMethodConfig } from '../../containers';
5
6
 
6
7
  interface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {
7
8
  }
8
- export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading'> {
9
- initializing?: boolean;
10
- loading?: boolean;
9
+ export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading' | 'title'> {
10
+ isLoading?: boolean;
11
11
  onChange?: (value: string) => void;
12
12
  options?: ExtendedPaymentMethod[];
13
13
  paymentMethodContent?: VNode;
14
14
  selection?: string;
15
+ title?: VNode;
16
+ UIComponentType?: UIComponentType;
15
17
  }
16
- export declare const PaymentMethods: FunctionComponent<PaymentMethodsProps>;
18
+ export declare const PaymentMethods: FunctionComponent<PaymentMethodsProps & import('../ConditionalWrapper/ConditionalWrapper').ConditionalProps>;
17
19
  export {};
18
20
  //# sourceMappingURL=PaymentMethods.d.ts.map
@@ -5,5 +5,5 @@ export interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {
5
5
  disabled?: boolean;
6
6
  onClick: (event: Event) => Promise<void>;
7
7
  }
8
- export declare const PlaceOrder: FunctionComponent<PlaceOrderProps>;
8
+ export declare const PlaceOrder: FunctionComponent<PlaceOrderProps & import('../ConditionalWrapper/index').ConditionalProps>;
9
9
  //# sourceMappingURL=PlaceOrder.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 './PlaceOrder';
18
18
  export * from './PlaceOrderSkeleton';
19
19
  //# sourceMappingURL=index.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 './ServerError';
18
18
  export { ServerError as default } from './ServerError';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,15 @@
1
1
  import { ShippingMethod } from '../../data/models';
2
- import { FunctionComponent } from 'preact';
2
+ import { FunctionComponent, VNode } from 'preact';
3
3
  import { HTMLAttributes } from 'preact/compat';
4
+ import { UIComponentType } from '../../types/ComponentTypes';
4
5
 
5
- export interface ShippingMethodsProps extends HTMLAttributes<HTMLDivElement> {
6
- isLoading?: boolean;
6
+ export interface ShippingMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
7
7
  onSelectionChange?: (method: ShippingMethod) => void;
8
- options?: ShippingMethod[];
8
+ isLoading?: boolean;
9
+ options: ShippingMethod[];
9
10
  selection?: ShippingMethod;
11
+ title?: VNode;
12
+ UIComponentType?: UIComponentType;
10
13
  }
11
- export declare const ShippingMethods: FunctionComponent<ShippingMethodsProps>;
14
+ export declare const ShippingMethods: FunctionComponent<ShippingMethodsProps & import('../ConditionalWrapper/ConditionalWrapper').ConditionalProps>;
12
15
  //# sourceMappingURL=ShippingMethods.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 './ShippingMethods';
18
18
  export * from './ShippingMethodsSkeleton';
19
19
  export { ShippingMethods as default } from './ShippingMethods';
@@ -4,7 +4,6 @@ import { HTMLAttributes } from 'preact/compat';
4
4
  export interface TermsAndConditionsProps extends HTMLAttributes<HTMLFormElement> {
5
5
  agreements?: VNode;
6
6
  error?: string;
7
- isInitialized?: boolean;
8
7
  }
9
- export declare const TermsAndConditions: FunctionComponent<TermsAndConditionsProps>;
8
+ export declare const TermsAndConditions: FunctionComponent<TermsAndConditionsProps & import('..').ConditionalProps>;
10
9
  //# sourceMappingURL=TermsAndConditions.d.ts.map
@@ -15,9 +15,11 @@
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
17
  export * from './BillToShippingAddress';
18
+ export * from './ConditionalWrapper/index';
18
19
  export * from './EstimateShipping';
19
20
  export * from './LoginForm';
20
21
  export * from './Markup';
22
+ export * from './Newsletter';
21
23
  export * from './OutOfStock';
22
24
  export * from './PaymentMethods';
23
25
  export * from './PlaceOrder';
@@ -1,24 +1,7 @@
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
- *******************************************************************/
1
+ import { Container } from '../../../@adobe-commerce/elsie/src/lib';
2
+
17
3
  export interface BillToShippingAddressProps {
18
4
  onChange?: (checked: boolean) => void;
19
5
  }
20
- export declare const BillToShippingAddress: {
21
- ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & BillToShippingAddressProps): import("preact").JSX.Element;
22
- displayName: string;
23
- };
6
+ export declare const BillToShippingAddress: Container<BillToShippingAddressProps>;
24
7
  //# sourceMappingURL=BillToShippingAddress.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/state.js";import{i as d,c as u}from"../chunks/transform-store-config.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-hooks.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/store-config.js";import"@dropins/tools/signals.js";import"../chunks/errors.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,disabled:n,onChange: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:n,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:s})})},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 V=T(k);export{V as BillToShippingAddress,V as default};
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};
@@ -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 './EstimateShipping';
18
18
  export { EstimateShipping as default } from './EstimateShipping';
19
19
  //# sourceMappingURL=index.d.ts.map