@dropins/storefront-checkout 0.1.0-alpha45 → 0.1.0-alpha47

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 (220) hide show
  1. package/__generated__/types.d.ts +22 -20
  2. package/api/errors/index.d.ts +16 -0
  3. package/api/estimateShippingMethods/graphql/estimateShippingMethods.graphql.d.ts +16 -0
  4. package/api/estimateShippingMethods/graphql/index.d.ts +16 -0
  5. package/api/estimateShippingMethods/index.d.ts +16 -0
  6. package/api/fetch-graphql/fetch-graphql.d.ts +16 -0
  7. package/api/fetch-graphql/index.d.ts +16 -0
  8. package/api/fetchAddressFormFields/fetchAddressFormFields.d.ts +16 -0
  9. package/api/fetchAddressFormFields/graphql/fetchAddressFormFields.graphql.d.ts +16 -0
  10. package/api/fetchAddressFormFields/index.d.ts +16 -0
  11. package/api/getCart/getCart.d.ts +16 -0
  12. package/api/getCart/graphql/getCart.graphql.d.ts +16 -0
  13. package/api/getCart/graphql/index.d.ts +16 -0
  14. package/api/getCart/index.d.ts +16 -0
  15. package/api/getCheckoutData/getCheckoutData.d.ts +16 -0
  16. package/api/getCheckoutData/index.d.ts +16 -0
  17. package/api/getCountries/getCountries.d.ts +16 -0
  18. package/api/getCountries/graphql/getCountries.graphql.d.ts +16 -0
  19. package/api/getCountries/index.d.ts +16 -0
  20. package/api/getCustomer/graphql/getCustomer.graphql.d.ts +16 -0
  21. package/api/getCustomer/graphql/index.d.ts +16 -0
  22. package/api/getCustomer/index.d.ts +16 -0
  23. package/api/getRegions/graphql/getRegions.graphql.d.ts +16 -0
  24. package/api/getRegions/index.d.ts +16 -0
  25. package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +16 -0
  26. package/api/getStoreConfig/index.d.ts +16 -0
  27. package/api/index.d.ts +16 -0
  28. package/api/initialize/index.d.ts +16 -0
  29. package/api/initialize/listeners.d.ts +16 -0
  30. package/api/initializeCheckout/index.d.ts +16 -0
  31. package/api/initializeCheckout/initializeCheckout.d.ts +16 -0
  32. package/api/isEmailAvailable/graphql/isEmailAvailable.graphql.d.ts +16 -0
  33. package/api/isEmailAvailable/index.d.ts +16 -0
  34. package/api/placeOrder/graphql/index.d.ts +16 -0
  35. package/api/placeOrder/graphql/placeOrder.graphql.d.ts +17 -1
  36. package/api/placeOrder/index.d.ts +16 -0
  37. package/api/placeOrder/placeOrder.d.ts +16 -0
  38. package/api/redirect/index.d.ts +16 -0
  39. package/api/redirect/redirect.d.ts +16 -0
  40. package/api/resetCheckout/index.d.ts +16 -0
  41. package/api/resetCheckout/resetCheckout.d.ts +16 -0
  42. package/api/resetCustomer/index.d.ts +16 -0
  43. package/api/resetCustomer/resetCustomer.d.ts +16 -0
  44. package/api/setBillingAddress/graphql/setBillingAddress.graphql.d.ts +16 -0
  45. package/api/setBillingAddress/index.d.ts +16 -0
  46. package/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql.d.ts +16 -0
  47. package/api/setGuestEmailOnCart/index.d.ts +16 -0
  48. package/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts +16 -0
  49. package/api/setPaymentMethod/graphql/setPaymentMethod.graphql.d.ts +16 -0
  50. package/api/setPaymentMethod/index.d.ts +16 -0
  51. package/api/setPaymentMethod/setPaymentMethod.d.ts +16 -0
  52. package/api/setShippingAddress/graphql/setShippingAddress.graphql.d.ts +16 -0
  53. package/api/setShippingAddress/index.d.ts +16 -0
  54. package/api/setShippingAddress/setShippingAddress.d.ts +17 -1
  55. package/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.d.ts +16 -0
  56. package/api/setShippingMethods/index.d.ts +16 -0
  57. package/api/setShippingMethods/setShippingMethods.d.ts +16 -0
  58. package/api/utils/enqueueRequest.d.ts +16 -0
  59. package/api.js +1 -1
  60. package/chunks/BillToShippingAddress.js +1 -1
  61. package/chunks/OrderError.js +1 -0
  62. package/chunks/ShippingMethods.js +1 -1
  63. package/chunks/fixtures.js +15 -0
  64. package/chunks/getCart.graphql.js +6 -20
  65. package/chunks/getCustomer.js +1 -1
  66. package/chunks/getMultilineValues.js +43 -0
  67. package/chunks/placeOrder.js +6 -2
  68. package/chunks/resetCustomer.js +1 -1
  69. package/chunks/setBillingAddress.js +3 -3
  70. package/chunks/setGuestEmailOnCart.js +17 -0
  71. package/chunks/setPaymentMethod.js +13 -0
  72. package/chunks/setShippingAddress.js +16 -0
  73. package/chunks/setShippingMethods.js +3 -85
  74. package/chunks/transform-shipping-methods.js +1 -0
  75. package/chunks/withConditionalRendering.js +1 -0
  76. package/components/AddressForm/constants.d.ts +16 -0
  77. package/components/AddressForm/index.d.ts +16 -0
  78. package/components/BillToShippingAddress/index.d.ts +16 -0
  79. package/components/EstimateShipping/index.d.ts +16 -0
  80. package/components/FieldsForm/index.d.ts +16 -0
  81. package/components/Heading/index.d.ts +16 -0
  82. package/components/LoginForm/index.d.ts +16 -0
  83. package/components/OutOfStock/index.d.ts +16 -0
  84. package/components/OverlayLoader/index.d.ts +16 -0
  85. package/components/PaymentMethods/index.d.ts +16 -0
  86. package/components/PlaceOrder/PlaceOrder.d.ts +1 -1
  87. package/components/PlaceOrder/index.d.ts +16 -0
  88. package/components/ServerError/index.d.ts +16 -0
  89. package/components/ShippingMethods/index.d.ts +16 -0
  90. package/components/ToggleButton/assets/icons/index.d.ts +16 -0
  91. package/components/ToggleButton/assets/images/index.d.ts +16 -0
  92. package/components/ToggleButton/index.d.ts +16 -0
  93. package/components/index.d.ts +16 -2
  94. package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +1 -1
  95. package/containers/BillToShippingAddress/constants.d.ts +16 -0
  96. package/containers/BillToShippingAddress/index.d.ts +16 -0
  97. package/containers/BillToShippingAddress.js +1 -1
  98. package/containers/BillingForm/BillingForm.d.ts +1 -1
  99. package/containers/BillingForm/constants.d.ts +16 -0
  100. package/containers/BillingForm/index.d.ts +16 -0
  101. package/containers/BillingForm.js +1 -1
  102. package/containers/ErrorBanner/index.d.ts +16 -0
  103. package/containers/ErrorBanner.js +1 -1
  104. package/containers/EstimateShipping/index.d.ts +16 -0
  105. package/containers/EstimateShipping.js +1 -1
  106. package/containers/LoginForm/LoginForm.d.ts +1 -1
  107. package/containers/LoginForm/constants.d.ts +16 -0
  108. package/containers/LoginForm/index.d.ts +16 -0
  109. package/containers/LoginForm.js +1 -1
  110. package/containers/MergedCartBanner/index.d.ts +16 -0
  111. package/containers/MergedCartBanner.js +1 -1
  112. package/containers/OutOfStock/index.d.ts +16 -0
  113. package/containers/OutOfStock.js +1 -1
  114. package/containers/PaymentMethods/PaymentMethods.d.ts +10 -11
  115. package/containers/PaymentMethods/defaultHandlers.d.ts +2 -9
  116. package/containers/PaymentMethods/index.d.ts +16 -0
  117. package/containers/PaymentMethods.js +1 -1
  118. package/containers/PlaceOrder/PlaceOrder.d.ts +10 -3
  119. package/containers/PlaceOrder/index.d.ts +16 -0
  120. package/containers/PlaceOrder.js +1 -1
  121. package/containers/ServerError/ServerError.d.ts +8 -0
  122. package/containers/ServerError/index.d.ts +19 -0
  123. package/containers/ServerError.d.ts +3 -0
  124. package/containers/ServerError.js +1 -0
  125. package/containers/ShippingForm/ShippingForm.d.ts +1 -1
  126. package/containers/ShippingForm/constants.d.ts +16 -0
  127. package/containers/ShippingForm/index.d.ts +17 -1
  128. package/containers/ShippingForm.js +1 -1
  129. package/containers/ShippingMethods/ShippingMethods.d.ts +7 -3
  130. package/containers/ShippingMethods/hooks/useShippingEstimateEventEmitter.d.ts +16 -0
  131. package/containers/ShippingMethods/index.d.ts +16 -0
  132. package/containers/ShippingMethods.js +1 -1
  133. package/containers/index.d.ts +17 -2
  134. package/data/models/acdl.d.ts +16 -0
  135. package/data/models/country.d.ts +16 -0
  136. package/data/models/custom-attribute.d.ts +16 -0
  137. package/data/models/email-availability.d.ts +16 -0
  138. package/data/models/index.d.ts +16 -0
  139. package/data/models/payment-method.d.ts +16 -0
  140. package/data/models/price.d.ts +16 -0
  141. package/data/models/region.d.ts +16 -0
  142. package/data/models/store-config.d.ts +16 -0
  143. package/data/transforms/index.d.ts +16 -0
  144. package/hocs/index.d.ts +16 -0
  145. package/hocs/withConditionalRendering.d.ts +1 -1
  146. package/hooks/index.d.ts +16 -0
  147. package/hooks/useBreakpoint/index.d.ts +16 -0
  148. package/hooks/useBreakpoint/useBreakpoint.d.ts +16 -0
  149. package/hooks/useLockScroll/index.d.ts +16 -0
  150. package/hooks/useLockScroll/useLockScroll.d.ts +16 -0
  151. package/hooks/useValidity/index.d.ts +16 -0
  152. package/hooks/useValidity/useValidity.d.ts +16 -0
  153. package/i18n/en_US.json.d.ts +0 -8
  154. package/lib/backup-data.d.ts +16 -0
  155. package/lib/fetch-error.d.ts +16 -0
  156. package/lib/index.d.ts +16 -0
  157. package/lib/network-error.d.ts +16 -0
  158. package/lib/redirect.d.ts +16 -0
  159. package/lib/state.d.ts +16 -0
  160. package/msw/browser.d.ts +16 -0
  161. package/msw/fixtures/fragments/billing-address.d.ts +16 -0
  162. package/msw/fixtures/fragments/cart.d.ts +16 -0
  163. package/msw/fixtures/fragments/index.d.ts +16 -0
  164. package/msw/fixtures/fragments/shipping-address.d.ts +16 -0
  165. package/msw/fixtures/index.d.ts +16 -0
  166. package/msw/fixtures/mutations/index.d.ts +16 -0
  167. package/msw/fixtures/queries/index.d.ts +16 -0
  168. package/msw/server.d.ts +16 -0
  169. package/package.json +1 -1
  170. package/render/index.d.ts +16 -0
  171. package/render.js +4 -3
  172. package/signals/IsBillToShippingSignal.d.ts +16 -0
  173. package/signals/ServerErrorSignal.d.ts +18 -0
  174. package/signals/index.d.ts +17 -0
  175. package/tests/constants.d.ts +16 -0
  176. package/tests/integration/utils/index.d.ts +16 -0
  177. package/tests/integration/utils/setup.d.ts +6 -4
  178. package/tests/integration/utils/user-actions.d.ts +16 -0
  179. package/tests/mocks/svg.d.ts +16 -0
  180. package/tests/utils/expectError.d.ts +16 -0
  181. package/tests/utils/index.d.ts +16 -0
  182. package/tests/utils/mockEvents.d.ts +16 -0
  183. package/utils/autocompleteFieldCodes/autocompleteFieldCodes.d.ts +16 -0
  184. package/utils/autocompleteFieldCodes/index.d.ts +16 -0
  185. package/utils/getDisplayName/index.d.ts +16 -0
  186. package/utils/getMultilineValues/getMultilineValues.d.ts +16 -0
  187. package/utils/getMultilineValues/index.d.ts +16 -0
  188. package/utils/index.d.ts +19 -0
  189. package/utils/isEmpty/index.d.ts +16 -0
  190. package/utils/isEmpty/isEmpty.d.ts +16 -0
  191. package/utils/isNullish/index.d.ts +16 -0
  192. package/utils/isNullish/isNullish.d.ts +16 -0
  193. package/utils/isUnexpectedError/index.d.ts +18 -0
  194. package/utils/isUnexpectedError/isUnexpectedError.d.ts +18 -0
  195. package/utils/parseRegionId/index.d.ts +16 -0
  196. package/utils/parseRegionId/parseRegionId.d.ts +16 -0
  197. package/utils/processFormFields/index.d.ts +16 -0
  198. package/utils/refetchEstimatedShippingMethods/index.d.ts +16 -0
  199. package/utils/scrollToElement/index.d.ts +18 -0
  200. package/utils/scrollToElement/scrollToElement.d.ts +18 -0
  201. package/utils/shippingMethods/index.d.ts +16 -0
  202. package/utils/validateForms/index.d.ts +18 -0
  203. package/utils/validateForms/validateForms.d.ts +18 -0
  204. package/chunks/EmptyCart.js +0 -1
  205. package/chunks/ErrorBanner.js +0 -1
  206. package/chunks/MergedCartBanner.js +0 -1
  207. package/chunks/OutOfStock.js +0 -1
  208. package/components/Checkout/Checkout.d.ts +0 -28
  209. package/components/Checkout/index.d.ts +0 -3
  210. package/components/EmptyCart/EmptyCart.d.ts +0 -9
  211. package/components/EmptyCart/index.d.ts +0 -3
  212. package/containers/Checkout/Checkout.d.ts +0 -35
  213. package/containers/Checkout/constants.d.ts +0 -2
  214. package/containers/Checkout/index.d.ts +0 -4
  215. package/containers/Checkout.d.ts +0 -3
  216. package/containers/Checkout.js +0 -1
  217. package/containers/EmptyCart/EmptyCart.d.ts +0 -8
  218. package/containers/EmptyCart/index.d.ts +0 -3
  219. package/containers/EmptyCart.d.ts +0 -3
  220. package/containers/EmptyCart.js +0 -1
@@ -1,25 +1,24 @@
1
1
  import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { HTMLAttributes } from 'preact/compat';
3
3
 
4
- export interface PaymentMethodSlotContext {
5
- addPaymentMethodHandler: (code: string, handler: {
6
- render: SlotProps<PaymentMethodContentSlotContext>;
7
- }) => void;
4
+ export interface PaymentMethodsMainSlotContext {
8
5
  replaceHTML: (domElement: HTMLElement) => void;
9
6
  }
10
- export interface PaymentMethodContentSlotContext {
7
+ export interface PaymentMethodHandlerSlots {
8
+ [code: string]: SlotProps<PaymentMethodHandlerSlotContext>;
9
+ }
10
+ export interface PaymentMethodHandlerSlotContext {
11
11
  cartId: string;
12
- onPlaceOrder: (fn: () => Promise<void>) => void;
13
- handleServerError: (error: any) => void;
14
12
  replaceHTML: (domElement: HTMLElement) => void;
15
13
  }
16
14
  export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement> {
17
- paymentMethodsSlot?: SlotProps<PaymentMethodSlotContext>;
18
- onPlaceOrder: (fn?: () => Promise<void>) => void;
19
- handleServerError: (error: any) => void;
15
+ slots?: {
16
+ Main?: SlotProps<PaymentMethodsMainSlotContext>;
17
+ Handlers?: PaymentMethodHandlerSlots;
18
+ };
20
19
  }
21
20
  export declare const PaymentMethods: {
22
- ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & PaymentMethodsProps): import("preact/compat").JSX.Element | null;
21
+ ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & PaymentMethodsProps): import("preact/compat").JSX.Element;
23
22
  displayName: string;
24
23
  };
25
24
  //# sourceMappingURL=PaymentMethods.d.ts.map
@@ -1,11 +1,4 @@
1
- import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
2
- import { PaymentMethodContentSlotContext } from '.';
1
+ import { PaymentMethodHandlerSlots } from '.';
3
2
 
4
- export interface PaymentMethodHandler {
5
- render: SlotProps<PaymentMethodContentSlotContext>;
6
- }
7
- export interface PaymentMethodHandlers {
8
- [code: string]: PaymentMethodHandler;
9
- }
10
- export declare const defaultHandlers: PaymentMethodHandlers;
3
+ export declare const defaultHandlers: PaymentMethodHandlerSlots;
11
4
  //# sourceMappingURL=defaultHandlers.d.ts.map
@@ -1,3 +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
+ *******************************************************************/
1
17
  export * from './PaymentMethods';
2
18
  export { PaymentMethods as default } from './PaymentMethods';
3
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import{c as y,c as M}from"../chunks/ShippingMethods.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/setShippingMethods.js";import"../chunks/getCart.graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"../chunks/BillToShippingAddress.js";import"../chunks/setBillingAddress.js";import"@dropins/tools/preact-compat.js";import"../chunks/ErrorBanner.js";import"../chunks/MergedCartBanner.js";export{y as PaymentMethods,M as default};
1
+ import{jsx as t,jsxs as p,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/event-bus.js";import{q as T}from"../chunks/fixtures.js";import{s as R}from"../chunks/setPaymentMethod.js";import{H as z}from"../chunks/ShippingMethods.js";import"@dropins/tools/preact-hooks.js";import{classes as y,Slot as E}from"@dropins/tools/lib.js";import{IllustratedMessage as U,Icon as $,ProgressSpinner as q,Skeleton as O,SkeletonRow as g,RadioButton as Z}from"@dropins/tools/components.js";/* empty css *//* empty css */import*as k from"@dropins/tools/preact-compat.js";import{useState as M,useCallback as x,useEffect as v}from"@dropins/tools/preact-compat.js";import{useText as F}from"@dropins/tools/i18n.js";import{w as G}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCart.graphql.js";import"../chunks/transform-shipping-methods.js";import"../chunks/getMultilineValues.js";const J=e=>k.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),K=({code:e,isLoading:n,isSelected:c,onChange:s,title:a})=>t(Y,{className:"checkout-payment-methods__method",label:a,name:"payment-method",value:e,selected:c,onChange:s,radioButtonProps:{"aria-busy":n}}),Q=({className:e,paymentMethodContent:n,isLoading:c,onChange:s=()=>{},options:a,selection:d})=>{const m=F({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return a===void 0?t(X,{}):p("div",{className:y(["checkout-payment-methods",e]),children:[t(z,{level:2,className:"checkout-payment-methods__title",children:m.Title}),!c&&a.length===0&&t(U,{icon:t($,{source:J}),message:t("p",{children:m.EmptyState})}),p("div",{className:y(["checkout-payment-methods__wrapper"]),children:[c&&t(q,{className:"checkout-payment-methods__spinner"}),t("div",{className:y(["checkout-payment-methods__methods",["checkout-payment-methods--loading",c],["checkout-payment-methods--full-width",a.length%2!==0]]),children:a==null?void 0:a.map(h=>t(K,{code:h.code,onChange:s,isSelected:h.code===d,title:h.title},h.code))}),n&&t("div",{className:"checkout-payment-methods__content",children:n})]})]})},X=()=>p(O,{"data-testid":"payment-methods-skeleton",children:[t(g,{variant:"heading",size:"medium"}),t(g,{variant:"empty",size:"medium"}),t(g,{size:"xlarge",fullWidth:!0}),t(g,{size:"xlarge",fullWidth:!0})]}),Y=({label:e,name:n,value:c,icon:s,selected:a,onChange:d,className:m,children:h,radioButtonProps:C,...o})=>t("div",{className:y(["checkout-toggle-button",m,["checkout-toggle-button__selected",a]]),...o,children:p("label",{className:"checkout-toggle-button__actionButton",children:[t(Z,{...C,label:"",name:n,value:c,checked:a,onChange:()=>d(c),"aria-label":e,className:y([m,"checkout-toggle-button__radioButton"])}),p("div",{className:"checkout-toggle-button__content",children:[s&&t(s.type,{...s==null?void 0:s.props,className:"checkout-toggle-button__icon"}),e]})]})}),N={free:e=>{const n=document.createElement("div");n.innerText="",e.replaceHTML(n)},checkmo:e=>{const n=document.createElement("div");n.innerText="",e.replaceHTML(n)}};function D({slots:e}){var S;const[n,c]=M(),[s,a]=M(),[d,m]=M(N),[h,C]=M(!0),{data:o}=T.value,V=(o==null?void 0:o.id)??"",_=!!o,H=!!((S=o==null?void 0:o.shippingAddresses)!=null&&S[0]),b=!((o==null?void 0:o.isVirtual)??!1),l=o==null?void 0:o.availablePaymentMethods,i=o==null?void 0:o.selectedPaymentMethod,f=x(async r=>{try{if(c(r),!H&&b||r===(i==null?void 0:i.code))return;await R(r)}catch(u){console.error("setting payment method failed:",u)}},[H,b,i]);v(()=>{_&&(i!=null&&i.code?(l==null?void 0:l.some(u=>u.code===i.code))?c(i.code):l!=null&&l.length?f(l[0].code):c(void 0):l[0]&&f(s||l[0].code))},[l,_,i,f,s]);const W=async r=>{await f(r),i!=null&&i.code||a(r)},w=x((r,u)=>{if(!r){console.warn("Payment method handler is ignored because it has no code");return}if(!u){console.warn("Payment method handler is ignored because it is empty");return}m(B=>({...B,[r]:u}))},[]);v(()=>{e!=null&&e.Handlers&&Object.entries(e.Handlers).forEach(([r,u])=>{w(r,u)})},[w,e==null?void 0:e.Handlers]);const I=e!=null&&e.Main?t(E,{name:"PaymentMethods",slot:e==null?void 0:e.Main,context:{replaceHTML(r){this.replaceWith(r),C(!1)}}}):null,P=n?d[n]:null,j=P?t(E,{name:"PaymentMethodContent",slot:P,context:{cartId:V,replaceHTML(r){this.replaceWith(r)}}},P):void 0;return v(()=>{!h&&d!=N&&console.warn("Payment method handlers you have added are ignored because the default content has been replaced")},[h,d]),{availablePaymentMethods:l,selectedPaymentMethod:n,onPaymentMethodChange:W,paymentMethodContent:j,mainSlotContent:I,isDefaultContentUsed:h}}const L=e=>{const{availablePaymentMethods:n,selectedPaymentMethod:c,onPaymentMethodChange:s,paymentMethodContent:a,mainSlotContent:d,isDefaultContentUsed:m}=D(e);return p(A,{children:[d&&t(d.type,{ref:d.ref,...d.props}),m&&t(Q,{options:n,selection:c,onChange:s,paymentMethodContent:a,isLoading:T.value.pending})]})};L.displayName="PaymentMethodsContainer";const Me=G(L);export{Me as PaymentMethods,Me as default};
@@ -1,11 +1,18 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
 
3
+ export declare enum CheckoutForms {
4
+ BILLING = "billing_address",
5
+ LOGIN = "login-form",
6
+ SHIPPING = "shipping_address"
7
+ }
3
8
  export interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {
4
- onClick: () => void;
5
- handleServerError: (error: any) => void;
9
+ onPlaceOrder?: (ctx: PlaceOrderContext) => Promise<void>;
10
+ }
11
+ export interface PlaceOrderContext {
12
+ code: string;
6
13
  }
7
14
  export declare const PlaceOrder: {
8
- ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & PlaceOrderProps): import("preact/compat").JSX.Element | null;
15
+ ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & PlaceOrderProps): import("preact/compat").JSX.Element;
9
16
  displayName: string;
10
17
  };
11
18
  //# sourceMappingURL=PlaceOrder.d.ts.map
@@ -1,3 +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
+ *******************************************************************/
1
17
  export * from './PlaceOrder';
2
18
  export { PlaceOrder as default } from './PlaceOrder';
3
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import{P as b,P as g}from"../chunks/ShippingMethods.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/setShippingMethods.js";import"../chunks/getCart.graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"../chunks/BillToShippingAddress.js";import"../chunks/setBillingAddress.js";import"@dropins/tools/preact-compat.js";import"../chunks/ErrorBanner.js";import"../chunks/MergedCartBanner.js";export{b as PlaceOrder,g as default};
1
+ import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{events as O}from"@dropins/tools/event-bus.js";import{U as k,q as E,n as b}from"../chunks/fixtures.js";import{p as x}from"../chunks/placeOrder.js";import{classes as f}from"@dropins/tools/lib.js";/* empty css */import{Button as S}from"@dropins/tools/components.js";import{Text as C,useText as I}from"@dropins/tools/i18n.js";import{w as P}from"../chunks/withConditionalRendering.js";import{useState as w,useCallback as p,useEffect as U}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const F=e=>e instanceof TypeError||e instanceof k,L=e=>{e.scrollIntoView({behavior:"smooth"}),e.focus()},N=e=>(Array.from(document.forms)||[]).filter(t=>e.includes(t.name)).filter(t=>t.offsetParent!==null).filter(t=>!t.checkValidity()),T=({className:e,onClick:s,disabled:t=!1})=>c("div",{className:f(["checkout-place-order",e]),children:c(S,{className:f(["checkout-place-order__button",e]),"data-testid":"place-order-button",disabled:t,onClick:s,size:"medium",type:"submit",variant:"primary",children:c(C,{id:"Checkout.PlaceOrder.button"})},"placeOrder")});var h=(e=>(e.BILLING="billing_address",e.LOGIN="login-form",e.SHIPPING="shipping_address",e))(h||{});const _=({onPlaceOrder:e})=>{var m;const[s,t]=w(!1),{data:n,pending:v}=E.value,g=!!n,a=((m=n==null?void 0:n.selectedPaymentMethod)==null?void 0:m.code)||"",l=I({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),d=p(r=>{const o=F(r)?l.CheckoutUnexpectedError:r.message;b.value=o},[l]),y=p(async()=>{const r=N(Object.values(h));if(r.length>0){const i=r[0].querySelector(":invalid");i&&L(i)}else try{e?await e({code:a}):await x()}catch(o){d(o)}},[e,a,d]);return U(()=>{const r=O.on("cart/initialized",o=>{const i=(o==null?void 0:o.items)||[];t(i.some(u=>u.outOfStock||u.insufficientQuantity))},{eager:!0});return()=>{r==null||r.off()}},[]),c(T,{onClick:y,disabled:!g||v||s})},D=P(_);export{h as CheckoutForms,D as PlaceOrder,D as default};
@@ -0,0 +1,8 @@
1
+ import { Container } from '@dropins/tools/types/elsie/src/lib';
2
+
3
+ interface ServerErrorProps {
4
+ onServerError?: () => void;
5
+ }
6
+ export declare const ServerError: Container<ServerErrorProps>;
7
+ export {};
8
+ //# sourceMappingURL=ServerError.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 './ServerError';
18
+ export { ServerError as default } from './ServerError';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './ServerError/index'
2
+ import _default from './ServerError/index'
3
+ export default _default
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as n}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/event-bus.js";import{n as i}from"../chunks/fixtures.js";import{a as u}from"../chunks/getCustomer.js";import"../chunks/ShippingMethods.js";import{useEffect as p}from"@dropins/tools/preact-hooks.js";import{classes as s}from"@dropins/tools/lib.js";import{IllustratedMessage as l,Icon as d,Button as h}from"@dropins/tools/components.js";/* empty css *//* empty css */import{S as v}from"../chunks/OrderError.js";import{useText as k}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCart.graphql.js";import"../chunks/transform-shipping-methods.js";import"../chunks/getMultilineValues.js";import"@dropins/tools/preact-compat.js";const f=({className:r,errorMessage:e,contactSupport:a,...c})=>{const{onClick:m}=c,o=k({Title:"Checkout.ServerError.title",Message:"Checkout.ServerError.message",ContactSupport:"Checkout.ServerError.contactSupport",Button:"Checkout.ServerError.button"});return t(l,{"aria-invalid":"true","aria-describedby":"checkout-server-error__message","aria-live":"polite",className:s(["checkout-server-error",r]),"data-testid":"checkout-server-error",heading:e??o.Title,message:n("p",{id:s(["checkout-server-error__message"]),children:[o.Message,t("br",{}),t("span",{children:a??o.ContactSupport})]}),icon:t(d,{className:s(["checkout-server-error__icon"]),source:v}),action:t(h,{className:s(["checkout-server-error__button"]),onClick:m,children:o.Button})})},$=({onServerError:r})=>{const e=i.value,a=async()=>{i.value=void 0,await u()};return p(()=>{e&&(r==null||r())},[e,r]),e?t(f,{errorMessage:e,onClick:a}):null};export{$ as ServerError,$ as default};
@@ -6,7 +6,7 @@ export interface ShippingFormProps extends HTMLAttributes<HTMLDivElement> {
6
6
  preselectedFields?: PreselectedAddressFields;
7
7
  }
8
8
  export declare const ShippingForm: {
9
- ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & ShippingFormProps): import("preact/compat").JSX.Element | null;
9
+ ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & ShippingFormProps): import("preact/compat").JSX.Element;
10
10
  displayName: string;
11
11
  };
12
12
  //# sourceMappingURL=ShippingForm.d.ts.map
@@ -1,2 +1,18 @@
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
17
  export declare const SHIPPING_FORM_NAME = "shipping_address";
2
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1,4 +1,20 @@
1
- export * from './ShippingForm';
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
17
  export * from './constants';
18
+ export * from './ShippingForm';
3
19
  export { ShippingForm as default } from './ShippingForm';
4
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import{b,a as d,a as g}from"../chunks/ShippingMethods.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/setShippingMethods.js";import"../chunks/getCart.graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"../chunks/BillToShippingAddress.js";import"../chunks/setBillingAddress.js";import"@dropins/tools/preact-compat.js";import"../chunks/ErrorBanner.js";import"../chunks/MergedCartBanner.js";export{b as SHIPPING_FORM_NAME,d as ShippingForm,g as default};
1
+ import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/event-bus.js";import{m as n}from"../chunks/fixtures.js";import{A as d}from"../chunks/getMultilineValues.js";import{s as a}from"../chunks/setBillingAddress.js";import{s as l,p as g}from"../chunks/setShippingAddress.js";import{A as h}from"../chunks/ShippingMethods.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import{w as f}from"../chunks/withConditionalRendering.js";import{useCallback as A}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-shipping-methods.js";import"../chunks/getCart.graphql.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";/* empty css *//* empty css */const S="shipping_address",p=({onCheckoutDataUpdate:o,preselectedFields:e,...t})=>{const i=n.value.checked,m=A(r=>l({signal:r.signal,address:g(r.address)}).then(()=>{if(i)return a({input:{same_as_shipping:!0}})}),[i]);return s("div",{children:s(h,{...t,addressType:d.SHIPPING,headingId:"Checkout.ShippingAddress.title",name:S,onCheckoutDataUpdate:o,preselectedFields:e,saveAddressHandler:m})})};p.displayName="ShippingFormContainer";const b=f(p);export{S as SHIPPING_FORM_NAME,b as ShippingForm,b as default};
@@ -1,14 +1,18 @@
1
- import { PreselectedShippingMethod } from '../Checkout';
1
+ import { ShippingMethod } from '../../data/models';
2
2
  import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
3
  import { HTMLAttributes } from 'preact/compat';
4
4
 
5
5
  export interface ShippingMethodsProps extends HTMLAttributes<HTMLDivElement> {
6
6
  onCheckoutDataUpdate?: () => Promise<void>;
7
- preSelectedMethod?: PreselectedShippingMethod;
7
+ onShippingMethodSelect?: (method: ShippingMethod) => void;
8
+ preSelectedMethod?: {
9
+ carrierCode: string;
10
+ methodCode: string;
11
+ };
8
12
  shippingMethodsSlot?: SlotProps;
9
13
  }
10
14
  export declare const ShippingMethods: {
11
- ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & ShippingMethodsProps): import("preact/compat").JSX.Element | null;
15
+ ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & ShippingMethodsProps): import("preact/compat").JSX.Element;
12
16
  displayName: string;
13
17
  };
14
18
  //# sourceMappingURL=ShippingMethods.d.ts.map
@@ -1,3 +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
+ *******************************************************************/
1
17
  declare function useShippingEstimateEventEmitter(): void;
2
18
  export default useShippingEstimateEventEmitter;
3
19
  //# sourceMappingURL=useShippingEstimateEventEmitter.d.ts.map
@@ -1,3 +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
+ *******************************************************************/
1
17
  export * from './ShippingMethods';
2
18
  export { ShippingMethods as default } from './ShippingMethods';
3
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- import{S as x,S as M}from"../chunks/ShippingMethods.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/setShippingMethods.js";import"../chunks/getCart.graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"@dropins/tools/components.js";import"../chunks/BillToShippingAddress.js";import"../chunks/setBillingAddress.js";import"@dropins/tools/preact-compat.js";import"../chunks/ErrorBanner.js";import"../chunks/MergedCartBanner.js";export{x as ShippingMethods,M as default};
1
+ import{jsx as o,jsxs as S,Fragment as B}from"@dropins/tools/preact-jsx-runtime.js";import{e as P}from"../chunks/getMultilineValues.js";import{events as I}from"@dropins/tools/event-bus.js";import{v as C,w as y,q as N,t as q,x as Z}from"../chunks/fixtures.js";import{s as $}from"../chunks/setShippingMethods.js";import{H as F}from"../chunks/ShippingMethods.js";import{useState as R,useEffect as j}from"@dropins/tools/preact-hooks.js";import{classes as w,Slot as G}from"@dropins/tools/lib.js";import{IllustratedMessage as J,Icon as K,ProgressSpinner as Q,RadioButton as X,Price as Y,Skeleton as D,SkeletonRow as H}from"@dropins/tools/components.js";/* empty css *//* empty css */import*as d from"@dropins/tools/preact-compat.js";import{useCallback as U,useMemo as ee,useEffect as z}from"@dropins/tools/preact-compat.js";import{useText as te}from"@dropins/tools/i18n.js";import{w as ne}from"../chunks/withConditionalRendering.js";import"../chunks/transform-shipping-methods.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getCart.graphql.js";const oe=e=>({countryCode:e.country_id,postCode:e.postcode||"",...e.region_id?{regionId:Number(e.region_id)}:{...e.region?{region:e.region}:{}}}),ie=e=>({carrierCode:e.carrier.code||"",methodCode:e.code||"",amount:e.amount,amountExclTax:e.amountExclTax,amountInclTax:e.amountInclTax}),re=e=>d.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),se=({className:e,isLoading:t=!1,onSelectionChange:i=()=>{},options:r,selection:c,...s})=>{const u=te({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return r===void 0?o(ce,{}):S("div",{...s,className:w(["checkout-shipping-methods",e]),children:[o(F,{level:3,className:"checkout-shipping-methods__title",children:u.Title}),!t&&r.length===0&&o(J,{icon:o(K,{source:re}),message:o("p",{children:u.EmptyState})}),S("div",{className:w(["checkout-shipping-methods__content"]),children:[t&&o(Q,{className:"checkout-shipping-methods__spinner"}),o("div",{className:w(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:r.map(n=>o(X,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:n.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:S(B,{children:[o(Y,{amount:n.amount.value,currency:n.amount.currency})," ",o("span",{children:n.carrier.title})]}),description:n.title,value:n.value,checked:(c==null?void 0:c.value)===n.value,onChange:()=>i(n)},n.value))})]})]})},ce=()=>S(D,{"data-testid":"shipping-methods-skeleton",children:[o(H,{variant:"heading",size:"small"}),o(H,{variant:"empty",size:"small"}),o(H,{size:"medium",fullWidth:!0}),o(H,{size:"medium",fullWidth:!0})]});function ae(){var a;const[e,t]=R(),[i,r]=R();j(()=>{I.on("checkout/address",({address:M,type:L,isValid:g})=>{L==="shipping"&&t({address:M,isValid:g})})},[]),j(()=>{r(C.value)},[C.value]),j(()=>{y.value.pending?r(void 0):r(C.value)},[y.value.pending]);const{country_id:c,region_id:s,region:u,postcode:n}=(e==null?void 0:e.address)||{},k=!!e,p=N.value.data,E=!!((a=p==null?void 0:p.shippingAddresses)!=null&&a[0]),v=e==null?void 0:e.isValid;j(()=>{E||v||!i||!k||I.emit("shipping/estimate",{address:oe({country_id:c,region_id:s,region:u,postcode:n}),shippingMethod:ie(i)})},[i,c,s,u,n,k,E,v])}const b=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function le({onCheckoutDataUpdate:e,preSelectedMethod:t,onShippingMethodSelect:i}){const r=q.value.data,c=!r,s=N.value.data,u=N.value.pending,n=y.value.data,k=y.value.pending,p=C.value,E=s==null?void 0:s.id,v=s==null?void 0:s.shippingAddresses,a=v==null?void 0:v[0],M=!!a,L=a==null?void 0:a.availableShippingMethods,g=a==null?void 0:a.selectedShippingMethod,h=L||n,T=U(l=>{if(!M)return;const f={method_code:l.code,carrier_code:l.carrier.code};$([f]).then(()=>{e==null||e()}).catch(x=>{console.error("setting shipping methods on cart failed:",x)})},[M,e]),A=l=>{C.value=l,i==null||i(l)},m=ee(()=>{if(!(h!=null&&h.length))return;const l=h[0],f=p||g;return f?h.some(_=>b(_,f))?f:l:h.find(W=>W.carrier.code===(t==null?void 0:t.carrierCode)&&W.code===(t==null?void 0:t.methodCode))||l},[p,g,h,t]);return z(()=>{m&&((!p||!b(m,p))&&(C.value=m,i==null||i(m)),(!g||!b(m,g))&&T(m))},[m,p,g,T,i]),z(()=>{if(!E||L)return;const{country:l,selectedRegion:f,selectedRegionId:x}=Z.value,_=l||(r==null?void 0:r.defaultCountry);_&&P({criteria:{country_code:_,region_name:f,region_id:x}}).catch(O=>{y.value={pending:!1,data:[]},console.error("shipping methods estimation failed:",O)})},[E,L,r]),{isLoading:u||c||k,options:h,selection:m,onSelectionChange:A}}const V=({preSelectedMethod:e,onCheckoutDataUpdate:t,shippingMethodsSlot:i,onShippingMethodSelect:r,...c})=>{const{isLoading:s,options:u,selection:n,onSelectionChange:k}=le({preSelectedMethod:e,onCheckoutDataUpdate:t,onShippingMethodSelect:r});return ae(),S(B,{children:[o(se,{...c,className:"checkout-shipping-methods",isLoading:s,onSelectionChange:k,options:u,selection:n}),!s&&o(G,{name:"ShippingMethods",slot:i})]})};V.displayName="ShippingMethodsContainer";const He=ne(V);export{He as ShippingMethods,He as default};
@@ -1,7 +1,21 @@
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
17
  export * from './BillingForm';
2
18
  export * from './BillToShippingAddress';
3
- export * from './Checkout';
4
- export * from './EmptyCart';
5
19
  export * from './ErrorBanner';
6
20
  export * from './EstimateShipping';
7
21
  export * from './LoginForm';
@@ -9,6 +23,7 @@ export * from './MergedCartBanner';
9
23
  export * from './OutOfStock';
10
24
  export * from './PaymentMethods';
11
25
  export * from './PlaceOrder';
26
+ export * from './ServerError';
12
27
  export * from './ShippingForm';
13
28
  export * from './ShippingMethods';
14
29
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +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
+ *******************************************************************/
1
17
  /**
2
18
  * This module contains the schema type definitions to build the ShoppingCart
3
19
  * and Order contexts, which are required to trigger the "place-order" event.
@@ -1,3 +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
+ *******************************************************************/
1
17
  export type Country = {
2
18
  value: string;
3
19
  label: string;
@@ -1,3 +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
+ *******************************************************************/
1
17
  export type CustomAttribute = {
2
18
  code: string;
3
19
  value: string;
@@ -1,2 +1,18 @@
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
17
  export type EmailAvailability = boolean;
2
18
  //# sourceMappingURL=email-availability.d.ts.map
@@ -1,3 +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
+ *******************************************************************/
1
17
  export * from './acdl';
2
18
  export * from './address-form-fields';
3
19
  export * from './cart';
@@ -1,3 +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
+ *******************************************************************/
1
17
  export type PaymentMethod = {
2
18
  code: string;
3
19
  title: string;
@@ -1,3 +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
+ *******************************************************************/
1
17
  export type Price = {
2
18
  value: number;
3
19
  currency: string;
@@ -1,3 +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
+ *******************************************************************/
1
17
  export type Region = {
2
18
  code: string;
3
19
  id?: number;
@@ -1,3 +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
+ *******************************************************************/
1
17
  export declare enum TaxDisplay {
2
18
  EXCLUDING_TAX = "EXCLUDING_TAX",
3
19
  INCLUDING_EXCLUDING_TAX = "INCLUDING_AND_EXCLUDING_TAX",
@@ -1,3 +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
+ *******************************************************************/
1
17
  export * from './transform-acdl';
2
18
  export * from './transform-address-form-fields';
3
19
  export * from './transform-cart';
package/hocs/index.d.ts CHANGED
@@ -1 +1,17 @@
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
17
  //# sourceMappingURL=index.d.ts.map
@@ -7,7 +7,7 @@ export interface ConditionalProps {
7
7
  export declare const withConditionalRendering: <P extends object>(WrappedContainer: Container<P, {
8
8
  [key: string]: any;
9
9
  }>) => {
10
- ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: ConditionalProps & P): import("preact").JSX.Element | null;
10
+ ({ hideOnEmptyCart, hideOnVirtualCart, ...props }: ConditionalProps & P): import("preact").JSX.Element;
11
11
  displayName: string;
12
12
  };
13
13
  //# sourceMappingURL=withConditionalRendering.d.ts.map