@dropins/storefront-checkout 0.1.0-alpha33 → 0.1.0-alpha35

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 (359) hide show
  1. package/__generated__/types.d.ts +16556 -0
  2. package/api/errors/errors.d.ts +27 -0
  3. package/api/errors/index.d.ts +2 -0
  4. package/api/estimateShippingMethods/estimateShippingMethods.d.ts +13 -0
  5. package/api/estimateShippingMethods/fixtures.d.ts +8 -0
  6. package/api/estimateShippingMethods/graphql/estimateShippingMethods.graphql.d.ts +2 -0
  7. package/api/estimateShippingMethods/graphql/index.d.ts +2 -0
  8. package/api/estimateShippingMethods/index.d.ts +2 -0
  9. package/api/fetch-graphql/fetch-graphql.d.ts +8 -0
  10. package/api/fetch-graphql/index.d.ts +2 -0
  11. package/api/fetchAddressFormFields/fetchAddressFormFields.d.ts +4 -0
  12. package/api/fetchAddressFormFields/fixtures.d.ts +5 -0
  13. package/api/fetchAddressFormFields/graphql/fetchAddressFormFields.graphql.d.ts +2 -0
  14. package/api/fetchAddressFormFields/index.d.ts +3 -0
  15. package/api/getCart/fixtures.d.ts +12 -0
  16. package/api/getCart/getCart.d.ts +2 -0
  17. package/api/getCart/graphql/getCart.graphql.d.ts +4 -0
  18. package/api/getCart/graphql/index.d.ts +2 -0
  19. package/api/getCart/index.d.ts +2 -0
  20. package/api/getCountries/fixtures.d.ts +6 -0
  21. package/api/getCountries/getCountries.d.ts +4 -0
  22. package/api/getCountries/graphql/getCountries.graphql.d.ts +2 -0
  23. package/api/getCountries/index.d.ts +2 -0
  24. package/api/getCustomer/getCustomer.d.ts +4 -0
  25. package/api/getCustomer/graphql/getCustomer.graphql.d.ts +2 -0
  26. package/api/getCustomer/graphql/index.d.ts +2 -0
  27. package/api/getCustomer/index.d.ts +2 -0
  28. package/api/getRegions/fixtures.d.ts +5 -0
  29. package/api/getRegions/getRegions.d.ts +5 -0
  30. package/api/getRegions/graphql/getRegions.graphql.d.ts +2 -0
  31. package/api/getRegions/index.d.ts +2 -0
  32. package/api/getStoreConfig/getStoreConfig.d.ts +4 -0
  33. package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +2 -0
  34. package/api/getStoreConfig/index.d.ts +2 -0
  35. package/api/index.d.ts +19 -0
  36. package/api/initialize/index.d.ts +2 -0
  37. package/api/initialize/initialize.d.ts +10 -0
  38. package/api/isEmailAvailable/graphql/isEmailAvailable.graphql.d.ts +2 -0
  39. package/api/isEmailAvailable/index.d.ts +2 -0
  40. package/api/isEmailAvailable/isEmailAvailable.d.ts +4 -0
  41. package/api/placeOrder/fixtures.d.ts +6 -0
  42. package/api/placeOrder/graphql/index.d.ts +2 -0
  43. package/api/placeOrder/graphql/placeOrder.graphql.d.ts +2 -0
  44. package/api/placeOrder/index.d.ts +2 -0
  45. package/api/placeOrder/placeOrder.d.ts +2 -0
  46. package/api/redirect/index.d.ts +2 -0
  47. package/api/redirect/redirect.d.ts +2 -0
  48. package/api/setBillingAddress/graphql/setBillingAddress.graphql.d.ts +2 -0
  49. package/api/setBillingAddress/index.d.ts +2 -0
  50. package/api/setBillingAddress/setBillingAddress.d.ts +13 -0
  51. package/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql.d.ts +2 -0
  52. package/api/setGuestEmailOnCart/index.d.ts +2 -0
  53. package/api/setGuestEmailOnCart/setGuestEmailOnCart.d.ts +2 -0
  54. package/api/setPaymentMethod/graphql/setPaymentMethod.graphql.d.ts +2 -0
  55. package/api/setPaymentMethod/index.d.ts +2 -0
  56. package/api/setPaymentMethod/setPaymentMethod.d.ts +2 -0
  57. package/api/setShippingAddress/graphql/setShippingAddress.graphql.d.ts +2 -0
  58. package/api/setShippingAddress/index.d.ts +2 -0
  59. package/api/setShippingAddress/setShippingAddress.d.ts +30 -0
  60. package/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.d.ts +2 -0
  61. package/api/setShippingMethods/index.d.ts +2 -0
  62. package/api/setShippingMethods/setShippingMethods.d.ts +2 -0
  63. package/api/utils/dispatchApiCall.d.ts +41 -0
  64. package/api/utils/enqueueRequest.d.ts +2 -0
  65. package/api/utils/filterControlledErrors.d.ts +18 -0
  66. package/api.d.ts +1 -0
  67. package/api.js +1 -2
  68. package/chunks/BillToShippingAddress2.js +1 -2
  69. package/chunks/BillingForm.js +1 -2
  70. package/chunks/ErrorBanner.js +1 -2
  71. package/chunks/LoginForm.js +1 -2
  72. package/chunks/MergedCartBanner.js +1 -0
  73. package/chunks/PlaceOrder.js +1 -2
  74. package/chunks/ShippingForm.js +1 -2
  75. package/chunks/ShippingMethods.js +1 -2
  76. package/chunks/ToggleButton.js +1 -2
  77. package/chunks/ToggleButton2.js +1 -0
  78. package/chunks/address-form-fields.js +43 -0
  79. package/chunks/constants.js +0 -1
  80. package/chunks/constants2.js +1 -2
  81. package/chunks/constants3.js +1 -2
  82. package/chunks/getCart.graphql.js +10 -173
  83. package/chunks/getStoreConfig.js +4 -14
  84. package/chunks/initialize.js +1 -2
  85. package/chunks/placeOrder2.js +57 -70
  86. package/chunks/setBillingAddress.js +3 -6
  87. package/chunks/setGuestEmailOnCart.js +4 -7
  88. package/chunks/setPaymentMethod.js +3 -6
  89. package/chunks/setShippingAddress.js +4 -7
  90. package/chunks/setShippingMethods.js +4 -7
  91. package/chunks/transform-shipping-methods.js +1 -2
  92. package/components/AddressForm/AddressForm.d.ts +21 -0
  93. package/components/AddressForm/constants.d.ts +4 -0
  94. package/components/AddressForm/index.d.ts +7 -0
  95. package/components/AddressForm/useAddressBackup.d.ts +8 -0
  96. package/components/AddressForm/useAddressForm.d.ts +38 -0
  97. package/components/AddressForm/useCheckoutAddressEventEmitter.d.ts +9 -0
  98. package/components/AddressForm/usePreselectedFields.d.ts +9 -0
  99. package/components/AddressForm/utils.d.ts +13 -0
  100. package/components/BillToShippingAddress/BillToShippingAddress.d.ts +8 -0
  101. package/components/BillToShippingAddress/BillToShippingAddressSkeleton.d.ts +4 -0
  102. package/components/BillToShippingAddress/index.d.ts +4 -0
  103. package/components/Checkout/Checkout.d.ts +25 -0
  104. package/components/Checkout/index.d.ts +3 -0
  105. package/components/EmptyCart/EmptyCart.d.ts +9 -0
  106. package/components/EmptyCart/index.d.ts +3 -0
  107. package/components/FieldsForm/FieldsForm.d.ts +13 -0
  108. package/components/FieldsForm/FieldsFormSkeleton.d.ts +4 -0
  109. package/components/FieldsForm/fieldFactory.d.ts +9 -0
  110. package/components/FieldsForm/fixtures.d.ts +5 -0
  111. package/components/FieldsForm/index.d.ts +6 -0
  112. package/components/FieldsForm/validation.d.ts +18 -0
  113. package/components/Heading/Heading.d.ts +8 -0
  114. package/components/Heading/index.d.ts +3 -0
  115. package/components/LoginForm/Email.d.ts +13 -0
  116. package/components/LoginForm/LoginForm.d.ts +17 -0
  117. package/components/LoginForm/LoginFormSkeleton.d.ts +4 -0
  118. package/components/LoginForm/SignIn.d.ts +9 -0
  119. package/components/LoginForm/SignOut.d.ts +8 -0
  120. package/components/LoginForm/index.d.ts +6 -0
  121. package/components/OutOfStock/OutOfStock.d.ts +9 -0
  122. package/components/OutOfStock/index.d.ts +3 -0
  123. package/components/OverlayLoader/OverlayLoader.d.ts +6 -0
  124. package/components/OverlayLoader/index.d.ts +2 -0
  125. package/components/PaymentMethods/PaymentMethods.d.ts +13 -0
  126. package/components/PaymentMethods/PaymentMethodsSkeleton.d.ts +4 -0
  127. package/components/PaymentMethods/index.d.ts +4 -0
  128. package/components/PlaceOrder/PlaceOrder.d.ts +9 -0
  129. package/components/PlaceOrder/PlaceOrderSkeleton.d.ts +4 -0
  130. package/components/PlaceOrder/index.d.ts +3 -0
  131. package/components/ServerError/ServerError.d.ts +10 -0
  132. package/components/ServerError/index.d.ts +3 -0
  133. package/components/ShippingMethods/ShippingMethods.d.ts +12 -0
  134. package/components/ShippingMethods/ShippingMethodsSkeleton.d.ts +4 -0
  135. package/components/ShippingMethods/index.d.ts +4 -0
  136. package/components/ToggleButton/ToggleButton.d.ts +14 -0
  137. package/components/ToggleButton/assets/icons/index.d.ts +2 -0
  138. package/components/ToggleButton/assets/images/index.d.ts +2 -0
  139. package/components/ToggleButton/index.d.ts +3 -0
  140. package/components/index.d.ts +15 -0
  141. package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +10 -0
  142. package/containers/BillToShippingAddress/constants.d.ts +2 -0
  143. package/containers/BillToShippingAddress/index.d.ts +4 -0
  144. package/containers/BillToShippingAddress.d.ts +3 -0
  145. package/containers/BillToShippingAddress.js +1 -2
  146. package/containers/BillingForm/BillingForm.d.ts +7 -0
  147. package/containers/BillingForm/constants.d.ts +2 -0
  148. package/containers/BillingForm/index.d.ts +4 -0
  149. package/containers/BillingForm.d.ts +3 -0
  150. package/containers/BillingForm.js +1 -2
  151. package/containers/Checkout/Checkout.d.ts +35 -0
  152. package/containers/Checkout/constants.d.ts +2 -0
  153. package/containers/Checkout/index.d.ts +4 -0
  154. package/containers/Checkout.d.ts +3 -0
  155. package/containers/Checkout.js +1 -2
  156. package/containers/ErrorBanner/ErrorBanner.d.ts +5 -0
  157. package/containers/ErrorBanner/index.d.ts +3 -0
  158. package/containers/ErrorBanner.d.ts +3 -0
  159. package/containers/ErrorBanner.js +0 -1
  160. package/containers/LoginForm/LoginForm.d.ts +10 -0
  161. package/containers/LoginForm/constants.d.ts +2 -0
  162. package/containers/LoginForm/index.d.ts +4 -0
  163. package/containers/LoginForm.d.ts +3 -0
  164. package/containers/LoginForm.js +1 -2
  165. package/containers/MergedCartBanner/MergedCartBanner.d.ts +5 -0
  166. package/containers/MergedCartBanner/index.d.ts +3 -0
  167. package/containers/MergedCartBanner.d.ts +3 -0
  168. package/containers/MergedCartBanner.js +1 -0
  169. package/containers/PaymentMethods/PaymentMethods.d.ts +23 -0
  170. package/containers/PaymentMethods/defaultHandlers.d.ts +11 -0
  171. package/containers/PaymentMethods/index.d.ts +3 -0
  172. package/containers/PaymentMethods.d.ts +3 -0
  173. package/containers/PaymentMethods.js +1 -2
  174. package/containers/PlaceOrder/PlaceOrder.d.ts +9 -0
  175. package/containers/PlaceOrder/index.d.ts +3 -0
  176. package/containers/PlaceOrder.d.ts +3 -0
  177. package/containers/PlaceOrder.js +1 -2
  178. package/containers/ShippingForm/ShippingForm.d.ts +9 -0
  179. package/containers/ShippingForm/constants.d.ts +2 -0
  180. package/containers/ShippingForm/index.d.ts +4 -0
  181. package/containers/ShippingForm.d.ts +3 -0
  182. package/containers/ShippingForm.js +1 -2
  183. package/containers/ShippingMethods/ShippingMethods.d.ts +9 -0
  184. package/containers/ShippingMethods/hooks/useShippingEstimateEventEmitter.d.ts +3 -0
  185. package/containers/ShippingMethods/index.d.ts +3 -0
  186. package/containers/ShippingMethods.d.ts +3 -0
  187. package/containers/ShippingMethods.js +1 -2
  188. package/containers/index.d.ts +11 -0
  189. package/context/address-form-fields.d.ts +13 -0
  190. package/context/checkout.d.ts +44 -0
  191. package/context/countries.d.ts +13 -0
  192. package/context/index.d.ts +6 -0
  193. package/context/services.d.ts +13 -0
  194. package/context/store.d.ts +12 -0
  195. package/data/models/acdl.d.ts +99 -0
  196. package/data/models/address-form-fields.d.ts +52 -0
  197. package/data/models/address.d.ts +21 -0
  198. package/data/models/cart.d.ts +14 -0
  199. package/data/models/country.d.ts +5 -0
  200. package/data/models/custom-attribute.d.ts +5 -0
  201. package/data/models/customer.d.ts +25 -0
  202. package/data/models/email-availability.d.ts +2 -0
  203. package/data/models/index.d.ts +14 -0
  204. package/data/models/order.d.ts +46 -0
  205. package/data/models/payment-method.d.ts +5 -0
  206. package/data/models/price.d.ts +5 -0
  207. package/data/models/region.d.ts +6 -0
  208. package/data/models/shipping-estimate.d.ts +17 -0
  209. package/data/models/shipping-method.d.ts +19 -0
  210. package/data/models/store-config.d.ts +9 -0
  211. package/data/transforms/index.d.ts +12 -0
  212. package/data/transforms/transform-acdl.d.ts +6 -0
  213. package/data/transforms/transform-address-form-fields.d.ts +66 -0
  214. package/data/transforms/transform-address.d.ts +79 -0
  215. package/data/transforms/transform-cart.d.ts +7 -0
  216. package/data/transforms/transform-countries.d.ts +5 -0
  217. package/data/transforms/transform-customer.d.ts +14 -0
  218. package/data/transforms/transform-email-availability.d.ts +6 -0
  219. package/data/transforms/transform-order.d.ts +7 -0
  220. package/data/transforms/transform-payment-methods.d.ts +9 -0
  221. package/data/transforms/transform-regions.d.ts +8 -0
  222. package/data/transforms/transform-shipping-estimate.d.ts +5 -0
  223. package/data/transforms/transform-shipping-methods.d.ts +14 -0
  224. package/data/transforms/transform-store-config.d.ts +5 -0
  225. package/hooks/useAuthentication/index.d.ts +2 -0
  226. package/hooks/useAuthentication/useAuthentication.d.ts +2 -0
  227. package/hooks/useLockScroll/index.d.ts +2 -0
  228. package/hooks/useLockScroll/useLockScroll.d.ts +5 -0
  229. package/hooks/useValidity/index.d.ts +2 -0
  230. package/hooks/useValidity/useValidity.d.ts +19 -0
  231. package/i18n/en_US.json.d.ts +86 -0
  232. package/lib/acdl.d.ts +18 -0
  233. package/lib/fetch-error.d.ts +7 -0
  234. package/lib/index.d.ts +4 -0
  235. package/lib/localStorage.d.ts +10 -0
  236. package/lib/network-error.d.ts +6 -0
  237. package/lib/redirect.d.ts +2 -0
  238. package/lib/state.d.ts +7 -0
  239. package/msw/browser.d.ts +2 -0
  240. package/msw/fixtures/fragments/american-regions.d.ts +4 -0
  241. package/msw/fixtures/fragments/available-shipping-methods.d.ts +23 -0
  242. package/msw/fixtures/fragments/billing-address.d.ts +36 -0
  243. package/msw/fixtures/fragments/cart.d.ts +112 -0
  244. package/msw/fixtures/fragments/countries.d.ts +4 -0
  245. package/msw/fixtures/fragments/form-fields.d.ts +4 -0
  246. package/msw/fixtures/fragments/index.d.ts +8 -0
  247. package/msw/fixtures/fragments/shipping-address.d.ts +42 -0
  248. package/msw/fixtures/index.d.ts +4 -0
  249. package/msw/fixtures/mutations/estimate-shipping-methods.d.ts +4 -0
  250. package/msw/fixtures/mutations/index.d.ts +8 -0
  251. package/msw/fixtures/mutations/place-order.d.ts +4 -0
  252. package/msw/fixtures/mutations/set-billing-address.d.ts +5 -0
  253. package/msw/fixtures/mutations/set-guest-email.d.ts +4 -0
  254. package/msw/fixtures/mutations/set-payment-method.d.ts +4 -0
  255. package/msw/fixtures/mutations/set-shipping-address.d.ts +4 -0
  256. package/msw/fixtures/mutations/set-shipping-methods.d.ts +4 -0
  257. package/msw/fixtures/queries/fetch-address-form-fields.d.ts +4 -0
  258. package/msw/fixtures/queries/get-cart.d.ts +4 -0
  259. package/msw/fixtures/queries/get-countries.d.ts +4 -0
  260. package/msw/fixtures/queries/get-customer-cart-stock-status.d.ts +4 -0
  261. package/msw/fixtures/queries/get-customer.d.ts +5 -0
  262. package/msw/fixtures/queries/get-regions.d.ts +4 -0
  263. package/msw/fixtures/queries/get-stock-status.d.ts +4 -0
  264. package/msw/fixtures/queries/get-store-config.d.ts +4 -0
  265. package/msw/fixtures/queries/index.d.ts +10 -0
  266. package/msw/fixtures/queries/is-email-available.d.ts +4 -0
  267. package/msw/handlers.d.ts +4 -0
  268. package/msw/server.d.ts +2 -0
  269. package/package.json +1 -1
  270. package/render/Provider.d.ts +10 -0
  271. package/render/index.d.ts +2 -0
  272. package/render/render.d.ts +6 -0
  273. package/render.d.ts +1 -0
  274. package/render.js +3 -4
  275. package/services/backup.d.ts +17 -0
  276. package/services/index.d.ts +2 -0
  277. package/signals/AuthenticationSignal.d.ts +2 -0
  278. package/signals/CartSignal.d.ts +7 -0
  279. package/signals/CustomerSignal.d.ts +7 -0
  280. package/signals/EstimateShippingMethodsSignal.d.ts +7 -0
  281. package/signals/IsBillToShippingSignal.d.ts +6 -0
  282. package/signals/RegionsSignal.d.ts +12 -0
  283. package/signals/SelectedShippingMethodSignal.d.ts +4 -0
  284. package/signals/index.d.ts +8 -0
  285. package/tests/constants.d.ts +3 -0
  286. package/tests/index.d.ts +2 -0
  287. package/tests/integration/utils/index.d.ts +3 -0
  288. package/tests/integration/utils/setup.d.ts +5 -0
  289. package/tests/integration/utils/user-actions.d.ts +2 -0
  290. package/tests/mocks/svg.d.ts +4 -0
  291. package/tests/render.d.ts +4 -0
  292. package/tests/utils/expectError.d.ts +9 -0
  293. package/tests/utils/index.d.ts +3 -0
  294. package/tests/utils/mockEvents.d.ts +5 -0
  295. package/utils/autocompleteFieldCodes/autocompleteFieldCodes.d.ts +18 -0
  296. package/utils/autocompleteFieldCodes/index.d.ts +2 -0
  297. package/utils/getMultilineValues/getMultilineValues.d.ts +3 -0
  298. package/utils/getMultilineValues/index.d.ts +2 -0
  299. package/utils/index.d.ts +7 -0
  300. package/utils/isEmpty/index.d.ts +2 -0
  301. package/utils/isEmpty/isEmpty.d.ts +2 -0
  302. package/utils/isNullish/index.d.ts +2 -0
  303. package/utils/isNullish/isNullish.d.ts +2 -0
  304. package/utils/parseRegionId/index.d.ts +2 -0
  305. package/utils/parseRegionId/parseRegionId.d.ts +2 -0
  306. package/utils/processFormFields/index.d.ts +2 -0
  307. package/utils/processFormFields/processFormFields.d.ts +21 -0
  308. package/utils/refetchEstimatedShippingMethods/index.d.ts +2 -0
  309. package/utils/refetchEstimatedShippingMethods/refetchEstimatedShippingMethods.d.ts +4 -0
  310. package/utils/shippingMethods/index.d.ts +2 -0
  311. package/utils/shippingMethods/isEqual.d.ts +4 -0
  312. package/api.js.map +0 -1
  313. package/chunks/BillToShippingAddress2.js.map +0 -1
  314. package/chunks/BillingForm.js.map +0 -1
  315. package/chunks/CartSummary.js +0 -2
  316. package/chunks/CartSummary.js.map +0 -1
  317. package/chunks/ErrorBanner.js.map +0 -1
  318. package/chunks/LoginForm.js.map +0 -1
  319. package/chunks/OrderSummary.js +0 -2
  320. package/chunks/OrderSummary.js.map +0 -1
  321. package/chunks/PaymentMethods.js +0 -2
  322. package/chunks/PaymentMethods.js.map +0 -1
  323. package/chunks/PlaceOrder.js.map +0 -1
  324. package/chunks/SelectedShippingMethodSignal.js +0 -2
  325. package/chunks/SelectedShippingMethodSignal.js.map +0 -1
  326. package/chunks/ShippingForm.js.map +0 -1
  327. package/chunks/ShippingMethods.js.map +0 -1
  328. package/chunks/ToggleButton.js.map +0 -1
  329. package/chunks/cart-item.js +0 -2
  330. package/chunks/cart-item.js.map +0 -1
  331. package/chunks/constants.js.map +0 -1
  332. package/chunks/constants2.js.map +0 -1
  333. package/chunks/constants3.js.map +0 -1
  334. package/chunks/getCart.graphql.js.map +0 -1
  335. package/chunks/getMultilineValues.js +0 -44
  336. package/chunks/getMultilineValues.js.map +0 -1
  337. package/chunks/getStoreConfig.js.map +0 -1
  338. package/chunks/initialize.js.map +0 -1
  339. package/chunks/placeOrder2.js.map +0 -1
  340. package/chunks/setBillingAddress.js.map +0 -1
  341. package/chunks/setGuestEmailOnCart.js.map +0 -1
  342. package/chunks/setPaymentMethod.js.map +0 -1
  343. package/chunks/setShippingAddress.js.map +0 -1
  344. package/chunks/setShippingMethods.js.map +0 -1
  345. package/chunks/transform-shipping-methods.js.map +0 -1
  346. package/containers/BillToShippingAddress.js.map +0 -1
  347. package/containers/BillingForm.js.map +0 -1
  348. package/containers/CartSummary.js +0 -2
  349. package/containers/CartSummary.js.map +0 -1
  350. package/containers/Checkout.js.map +0 -1
  351. package/containers/ErrorBanner.js.map +0 -1
  352. package/containers/LoginForm.js.map +0 -1
  353. package/containers/OrderSummary.js +0 -2
  354. package/containers/OrderSummary.js.map +0 -1
  355. package/containers/PaymentMethods.js.map +0 -1
  356. package/containers/PlaceOrder.js.map +0 -1
  357. package/containers/ShippingForm.js.map +0 -1
  358. package/containers/ShippingMethods.js.map +0 -1
  359. package/render.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{g as T,b as I,t as O}from"./getCart.graphql.js";import{e as y,F as S,M as A,U as E}from"./transform-shipping-methods.js";import{f as k,o as v,P as d,i as q}from"./getStoreConfig.js";import{events as C}from"@dropins/tools/event-bus.js";import{I as L}from"./cart-item.js";const D=t=>t?"code"in t&&"value"in t:!1,N=t=>t.filter(D).map(e=>{const{code:o,value:r}=e;return{code:o,value:r}}),x=t=>{var n,a,u;const e=t.street.filter(Boolean),o=(n=t.region)==null?void 0:n.region_id,r=o&&o>0;return{id:String(t.id),firstName:t.firstname,lastName:t.lastname,company:t.company||void 0,city:t.city,street:e,postCode:t.postcode||void 0,vatId:t.vat_id||void 0,telephone:t.telephone||void 0,region:{id:r?o:void 0,code:(a=t.region)==null?void 0:a.region_code,name:(u=t.region)==null?void 0:u.region},country:{value:t.country_code,label:t.country_code},customAttributes:N(t.custom_attributesV2)}},Q=t=>t?t.filter(Boolean).map(x):[],b=(t,e)=>{if(!e)return;const o=e.find(r=>(r==null?void 0:r[t])===!0);if(o)return x(o)},V=t=>{if(!t)return;const e=t.addresses;return{firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||"",addresses:Q(e),defaultBillingAddress:b("default_billing",e),defaultShippingAddress:b("default_shipping",e)}},st=async t=>await y({type:"query",query:t?T:I,options:{method:"POST",cache:"no-cache",...t?{variables:{cartId:t}}:{}},path:"cart",signalType:"cart",transformer:O}),$=`
1
+ import{t as A,g as E,a as q}from"./getCart.graphql.js";import{M as b,e as d,F as w,U as N}from"./transform-shipping-methods.js";import{i as l,f as k,n as D}from"./getStoreConfig.js";import{events as f}from"@dropins/tools/event-bus.js";const L=t=>({id:l.cartId,totalQuantity:t.totalQuantity,possibleOnepageCheckout:!0,items:t.items.map(n=>{var a;return{canApplyMsrp:!0,formattedPrice:"",id:n.id,quantity:n.totalQuantity,product:{canonicalUrl:n.product.canonicalUrl||"",mainImageUrl:n.product.image||"",name:n.product.name,productId:0,productType:n.product.productType,sku:n.product.sku},prices:{price:{value:n.price.value,currency:n.price.currency}},configurableOptions:((a=n.selectedOptions)==null?void 0:a.map(e=>({optionLabel:e.label,valueLabel:e.value})))||[]}})}),Q=t=>{var e,s,i;const n=t.coupons[0],a=(e=t.payments)==null?void 0:e[0];return{appliedCouponCode:(n==null?void 0:n.code)||"",email:t.email,grandTotal:t.total,orderId:t.number,orderType:"checkout",otherTax:0,salesTax:t.totalTax,shipping:{shippingMethod:((s=t.shipping)==null?void 0:s.code)||"",shippingAmount:((i=t.shipping)==null?void 0:i.amount)||0},subtotalExcludingTax:t.subtotal,subtotalIncludingTax:0,payments:a?[{paymentMethodCode:(a==null?void 0:a.code)||"",paymentMethodName:(a==null?void 0:a.name)||"",total:t.total}]:[]}},R=t=>t?"code"in t&&"value"in t:!1,S=t=>t.filter(R).map(n=>{const{code:a,value:e}=n;return{code:a,value:e}}),T=t=>{var s,i,u;const n=t.street.filter(Boolean),a=(s=t.region)==null?void 0:s.region_id,e=a&&a>0;return{id:String(t.id),firstName:t.firstname,lastName:t.lastname,company:t.company||void 0,city:t.city,street:n,postCode:t.postcode||void 0,vatId:t.vat_id||void 0,telephone:t.telephone||void 0,region:{id:e?a:void 0,code:(i=t.region)==null?void 0:i.region_code,name:(u=t.region)==null?void 0:u.region},country:{value:t.country_code,label:t.country_code},customAttributes:S(t.custom_attributesV2)}},P=t=>t?t.filter(Boolean).map(T):[],m=(t,n)=>{if(!n)return;const a=n.find(e=>(e==null?void 0:e[t])===!0);if(a)return T(a)},V=t=>{if(!t)return;const n=t.addresses;return{firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||"",addresses:P(n),defaultBillingAddress:m("default_billing",n),defaultShippingAddress:m("default_shipping",n)}},o=t=>t||0,M=t=>{var n;return{canonicalUrl:(t==null?void 0:t.canonical_url)||"",id:(t==null?void 0:t.uid)||"",name:(t==null?void 0:t.name)||"",sku:(t==null?void 0:t.sku)||"",image:((n=t==null?void 0:t.image)==null?void 0:n.url)||"",productType:(t==null?void 0:t.__typename)||""}},U=t=>o(t==null?void 0:t.quantity_ordered)+o(t==null?void 0:t.quantity_shipped)+o(t==null?void 0:t.quantity_canceled)+o(t==null?void 0:t.quantity_invoiced)+o(t==null?void 0:t.quantity_refunded)+o(t==null?void 0:t.quantity_returned),F=t=>t?t.map(n=>({id:(n==null?void 0:n.id)||"",price:{value:(n==null?void 0:n.product_sale_price.value)||0,currency:(n==null?void 0:n.product_sale_price.currency)||""},totalQuantity:U(n),product:M(n==null?void 0:n.product)})):[],G=t=>{var p,r,y,g,_,h;const n=((p=t.total)==null?void 0:p.grand_total.value)??0,a=(r=t.payment_methods)==null?void 0:r[0],e=(a==null?void 0:a.type)??"",s=(a==null?void 0:a.name)??"",i=F(t.items),u=i.reduce((c,x)=>c+x.totalQuantity,0);return{coupons:((y=t==null?void 0:t.applied_coupons)==null?void 0:y.map(c=>({code:(c==null?void 0:c.code)??""})))||[],email:t.email??"",items:i,number:t.number,token:t.token,total:n,totalQuantity:u,totalTax:((g=t.total)==null?void 0:g.total_tax.value)??0,subtotal:((_=t.total)==null?void 0:_.subtotal.value)??0,shipping:{amount:((h=t.total)==null?void 0:h.total_shipping.value)??0,code:t.shipping_method??""},payments:[{code:e,name:s}]}},Z=async()=>{const t=l.cartId,n=l.authenticated===!1,a=n?E:q,e=n?{cartId:t}:{};if(n&&!t)throw new b;return await d({type:"query",query:a,options:{method:"POST",cache:"no-cache",variables:e},path:"cart",signalType:"cart",transformer:A})},X=`
2
2
  query getCustomer {
3
3
  customer {
4
4
  firstname
@@ -31,82 +31,69 @@ import{g as T,b as I,t as O}from"./getCart.graphql.js";import{e as y,F as S,M as
31
31
  }
32
32
  }
33
33
  }
34
- `,ct=async()=>await y({type:"query",query:$,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:V}),w=`
35
- fragment CartStockStatus on Cart {
36
- id
37
- items {
38
- __typename
39
- uid
40
- product {
41
- uid
42
- name
43
- sku
44
- stock_status
45
- only_x_left_in_stock
46
- ... on ConfigurableProduct {
47
- variants {
48
- attributes {
49
- uid
50
- }
51
- product {
52
- uid
53
- stock_status
54
- }
55
- }
34
+ `,I=async()=>await d({type:"query",query:X,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:V}),B=`
35
+ mutation placeOrder($cartId: String!) {
36
+ placeOrder(input: { cart_id: $cartId }) {
37
+ orderV2 {
38
+ number
39
+ token
40
+ applied_coupons {
41
+ code
56
42
  }
57
- ... on BundleProduct {
58
- items {
59
- uid
60
- options {
61
- uid
62
- product {
63
- uid
64
- }
65
- }
43
+ email
44
+ id
45
+ total {
46
+ grand_total {
47
+ value
48
+ }
49
+ subtotal {
50
+ value
51
+ }
52
+ total_shipping {
53
+ value
54
+ }
55
+ total_tax {
56
+ value
66
57
  }
67
58
  }
68
- }
69
- quantity
70
- ... on ConfigurableCartItem {
71
- configurable_options {
72
- configurable_product_option_uid
73
- option_label
74
- configurable_product_option_value_uid
75
- value_label
59
+ shipping_method
60
+ payment_methods {
61
+ name
62
+ type
76
63
  }
77
- }
78
- ... on BundleCartItem {
79
- bundle_options {
80
- uid
81
- values {
64
+ items {
65
+ id
66
+ discounts {
67
+ amount {
68
+ value
69
+ }
70
+ }
71
+ product {
72
+ __typename
73
+ canonical_url
74
+ image {
75
+ url
76
+ }
77
+ name
78
+ sku
82
79
  uid
83
80
  }
81
+ selected_options {
82
+ label
83
+ value
84
+ }
85
+ product_sale_price {
86
+ value
87
+ currency
88
+ }
89
+ quantity_canceled
90
+ quantity_invoiced
91
+ quantity_ordered
92
+ quantity_refunded
93
+ quantity_returned
94
+ quantity_shipped
84
95
  }
85
96
  }
86
97
  }
87
98
  }
88
- `,B=`
89
- query getCartStockStatus($cartId: String!) {
90
- cart(cart_id: $cartId) {
91
- ...CartStockStatus
92
- }
93
- }
94
- ${w}
95
- `,M=`
96
- query getCustomerCartStockStatus {
97
- cart: customerCart {
98
- ...CartStockStatus
99
- }
100
- }
101
- ${w}
102
- `,f=t=>t.stock_status===d.InStock,F=t=>f(t.product),U=t=>{const{configurable_options:e}=t,{variants:o}=t.product;if(!o||!e)return!1;const r=e.map(u=>u==null?void 0:u.configurable_product_option_value_uid),n=o.find(u=>!u||!u.attributes?!1:u.attributes.every(s=>s&&r.includes(s.uid)));if(!n)return!1;const{product:a}=n;return a?f(a):!1},G=t=>{const{product:e}=t;if(!f(e))return!1;const{bundle_options:o}=t,{items:r}=e;return(r==null?void 0:r.length)===(o==null?void 0:o.length)},P=t=>{switch(t){case"ConfigurableCartItem":return U;case"BundleCartItem":return G;default:return F}},R=t=>P(t.__typename)(t)===!1,it=async t=>{var a;const{data:e,errors:o}=await k(t?B:M,{method:"GET",cache:"no-cache",...t?{variables:{cartId:t}}:{}}).catch(v);if(o)throw new S(o);const r=(a=e==null?void 0:e.cart)==null?void 0:a.items;return!r||!r.length?d.InStock:r.filter(u=>u?R(u):!1).length>0?d.OutOfStock:d.InStock},K=`
103
- mutation placeOrder($cartId: String!) {
104
- placeOrder(input: { cart_id: $cartId }) {
105
- orderV2 {
106
- number
107
- token
108
- }
109
- }
110
- }
111
- `;function j(t){const e=[];for(const o in t)t[o]!==null&&e.push({optionLabel:o,valueLabel:t[o]});return e}function z(t){return t.map(e=>{var c;const{uid:o,name:r,sku:n,price:a,quantity:u}=e;let s={canApplyMsrp:!0,formattedPrice:"",id:o,prices:{price:{value:a.value??0,currency:a.currency??""}},product:{productId:0,name:r,sku:n,productType:e.kind,canonicalUrl:e.url||"",mainImageUrl:((c=e==null?void 0:e.image)==null?void 0:c.src)||""},quantity:u};return e.kind===L.Configurable&&(s.configurableOptions=j(e.configurableOptions)),s},[])}function H(t){var s,c,i,l;const{id:e,items:o,prices:r,totalQty:n}=t,a=!!(o!=null&&o.length);let u={id:e,prices:{subtotalExcludingTax:{value:((s=r==null?void 0:r.subtotal_excluding_tax)==null?void 0:s.value)??0,currency:((c=r==null?void 0:r.subtotal_excluding_tax)==null?void 0:c.currency)??""},subtotalIncludingTax:{value:((i=r==null?void 0:r.subtotal_including_tax)==null?void 0:i.value)??0,currency:((l=r==null?void 0:r.subtotal_including_tax)==null?void 0:l.currency)??""}},totalQuantity:n,possibleOnepageCheckout:!0};return a&&(u.items=z(o)),u}function J(t){return t.reduce((o,r)=>o+r.amount.value,0)}function W(t){return{shippingMethod:`${t.carrier.code}_${t.code}`,shippingAmount:t.amount.value??0}}function X(t,e){var i,l,g,m,h;const{coupons:o,email:r,prices:n,selectedPaymentMethod:a,shippingAddresses:u}=e,s=!!(u!=null&&u.length);let c={appliedCouponCode:((i=o[0])==null?void 0:i.code)??"",email:r??"",grandTotal:((l=n==null?void 0:n.grand_total)==null?void 0:l.value)??0,orderId:t,orderType:"checkout",otherTax:0,paymentMethodCode:(a==null?void 0:a.code)??"",paymentMethodName:(a==null?void 0:a.title)??"",payments:[{paymentMethodCode:(a==null?void 0:a.code)??"",paymentMethodName:(a==null?void 0:a.title)??"",total:((g=n==null?void 0:n.grand_total)==null?void 0:g.value)??0}],salesTax:J((n==null?void 0:n.applied_taxes)??[]),subtotalExcludingTax:((m=n==null?void 0:n.subtotal_excluding_tax)==null?void 0:m.value)??0,subtotalIncludingTax:((h=n==null?void 0:n.subtotal_including_tax)==null?void 0:h.value)??0};if(s){const p=u[0],_=p==null?void 0:p.selectedShippingMethod;_&&(c.shipping=W(_))}return c}function Y(t){const{data:e}=q.value,o=H(e),r=X(t,e);window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer.push({shoppingCartContext:null},{orderContext:null}),window.adobeDataLayer.push({shoppingCartContext:o},{orderContext:r})}function Z(){window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer.push(t=>{const e=t.getState()||{};t.push({event:"place-order",eventInfo:{...e}})})}function tt(t){Y(t),Z()}function et(t){throw t.every(o=>{var r;return(r=o.extensions)==null?void 0:r.category})?new S(t):new E(t[0].message)}const lt=async t=>{if(!t)throw new A;const{data:e,errors:o}=await k(K,{variables:{cartId:t}}).catch(v);o&&et(o);const r=e.placeOrder.orderV2;tt(r.number),C.emit("checkout/order",r),C.emit("cart/reset",void 0)};export{ct as a,it as b,st as g,lt as p};
112
- //# sourceMappingURL=placeOrder2.js.map
99
+ `,v={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},$={PLACE_ORDER:"place-order"};function O(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function C(t,n){const a=O();a.push({[t]:null}),a.push({[t]:n})}function H(t,n){O().push(e=>{const s=e.getState?e.getState():{};e.push({event:t,eventInfo:{...s,...n}})})}function j(t){const n=L(t),a=Q(t);console.debug({shoppingCartContext:n,orderContext:a}),C(v.SHOPPING_CART_CONTEXT,{...n}),C(v.ORDER_CONTEXT,{...a}),H($.PLACE_ORDER)}function z(t){throw t.every(a=>{var e;return(e=a.extensions)==null?void 0:e.category})?new w(t):new N(t[0].message)}const tt=async()=>{const t=l.cartId;if(!t)throw new b;const{data:n,errors:a}=await k(B,{variables:{cartId:t}}).catch(D);a&&z(a);const e=G(n.placeOrder.orderV2);return j(e),f.emit("checkout/order",e),f.emit("cart/reset",void 0),e};export{I as a,Z as g,tt as p};
@@ -1,16 +1,13 @@
1
- import{M as n,c as e,e as d}from"./transform-shipping-methods.js";import{C as l,a as o,t as p}from"./getCart.graphql.js";import"./getStoreConfig.js";const A=`
1
+ import{M as e,c as d,e as o}from"./transform-shipping-methods.js";import{C as l,t as c}from"./getCart.graphql.js";import{i as p}from"./getStoreConfig.js";import{events as m}from"@dropins/tools/event-bus.js";const g=`
2
2
  mutation setBillingAddress($cartId: String!, $input: BillingAddressInput!) {
3
3
  setBillingAddressOnCart(
4
4
  input: { cart_id: $cartId, billing_address: $input }
5
5
  ) {
6
6
  cart {
7
7
  id
8
- ...CartData
9
- ...CartSummaryItems
8
+ ...CheckoutData
10
9
  }
11
10
  }
12
11
  }
13
12
  ${l}
14
- ${o}
15
- `,C=async({signal:i,cartId:s,input:t})=>{const{address:a,same_as_shipping:r}=t;if(!s)throw new n;if(!r&&!a)throw new e;return await d({type:"mutation",query:A,options:{signal:i,variables:{cartId:s,input:t}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:p})};export{C as s};
16
- //# sourceMappingURL=setBillingAddress.js.map
13
+ `,B=async({signal:i,input:s})=>{const t=p.cartId,{address:r,same_as_shipping:a}=s;if(!t)throw new e;if(!a&&!r)throw new d;const n=await o({type:"mutation",query:g,options:{signal:i,variables:{cartId:t,input:s}},path:"setBillingAddressOnCart.cart",signalType:"cart",transformer:c});return m.emit("cart/updated",t),n};export{B as s};
@@ -1,20 +1,17 @@
1
- import{a as r,M as s,e}from"./transform-shipping-methods.js";import{f as l,o as m,p as n}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{C as o,a as c,t as E}from"./getCart.graphql.js";const u=a=>!!(a!=null&&a.is_email_available),p=`
1
+ import{a as r,M as s,e}from"./transform-shipping-methods.js";import{f as l,n,o,i as m}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";import{C as c,t as E}from"./getCart.graphql.js";const u=a=>!!(a!=null&&a.is_email_available),h=`
2
2
  query isEmailAvailable($email: String!) {
3
3
  isEmailAvailable(email: $email) {
4
4
  is_email_available
5
5
  }
6
6
  }
7
- `,v=async a=>{if(!a)throw new r;const{data:i,errors:t}=await l(p,{method:"GET",cache:"no-cache",variables:{email:a}}).catch(m);return t&&n(t),u(i.isEmailAvailable)},A=`
7
+ `,C=async a=>{if(!a)throw new r;const{data:t,errors:i}=await l(h,{method:"GET",cache:"no-cache",variables:{email:a}}).catch(n);return i&&o(i),u(t.isEmailAvailable)},p=`
8
8
  mutation setGuestEmail($cartId: String!, $email: String!) {
9
9
  setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
10
10
  cart {
11
11
  id
12
- ...CartData
13
- ...CartSummaryItems
12
+ ...CheckoutData
14
13
  }
15
14
  }
16
15
  }
17
- ${o}
18
16
  ${c}
19
- `,y=async({cartId:a,email:i})=>{if(!a)throw new s;return await e({type:"mutation",query:A,options:{variables:{cartId:a,email:i}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:E})};export{v as i,y as s};
20
- //# sourceMappingURL=setGuestEmailOnCart.js.map
17
+ `,y=async a=>{const t=m.cartId;if(!t)throw new s;return await e({type:"mutation",query:p,options:{variables:{cartId:t,email:a}},path:"setGuestEmailOnCart.cart",signalType:"cart",transformer:E})};export{C as i,y as s};
@@ -1,16 +1,13 @@
1
- import{M as e,b as r,e as n}from"./transform-shipping-methods.js";import{C as s,a as o,t as i}from"./getCart.graphql.js";import"./getStoreConfig.js";const m=`
1
+ import{M as r,b as o,e as n}from"./transform-shipping-methods.js";import{C as s,t as i}from"./getCart.graphql.js";import{i as m}from"./getStoreConfig.js";import{events as d}from"@dropins/tools/event-bus.js";const c=`
2
2
  mutation setPaymentMethod($cartId: String!, $paymentMethod: String!) {
3
3
  setPaymentMethodOnCart(
4
4
  input: { cart_id: $cartId, payment_method: { code: $paymentMethod } }
5
5
  ) {
6
6
  cart {
7
7
  id
8
- ...CartData
9
- ...CartSummaryItems
8
+ ...CheckoutData
10
9
  }
11
10
  }
12
11
  }
13
12
  ${s}
14
- ${o}
15
- `,y=async({cartId:t,paymentMethod:a})=>{if(!t)throw new e;if(!a)throw new r;return await n({type:"mutation",query:m,options:{variables:{cartId:t,paymentMethod:a}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:i})};export{y as s};
16
- //# sourceMappingURL=setPaymentMethod.js.map
13
+ `,u=async a=>{const t=m.cartId;if(!t)throw new r;if(!a)throw new o;const e=await n({type:"mutation",query:c,options:{variables:{cartId:t,paymentMethod:a}},path:"setPaymentMethodOnCart.cart",signalType:"cart",transformer:i});return d.emit("cart/updated",t),e};export{u as s};
@@ -1,16 +1,13 @@
1
- import{a as s,b as p,M as u,c as _}from"./getMultilineValues.js";import"./getStoreConfig.js";import{e as A}from"./transform-shipping-methods.js";import{C as m,a as I,t as g}from"./getCart.graphql.js";import"@dropins/tools/event-bus.js";const C=/^\d+$/,T=t=>{if(C.test(t))return parseInt(t,10)},y=`
1
+ import{a as s,b as p,M as u,c as _}from"./address-form-fields.js";import{i as I}from"./getStoreConfig.js";import{M as g,e as m}from"./transform-shipping-methods.js";import{C,t as h}from"./getCart.graphql.js";import{events as A}from"@dropins/tools/event-bus.js";const l=/^\d+$/,T=t=>{if(l.test(t))return parseInt(t,10)},y=`
2
2
  mutation setShippingAddress($cartId: String!, $address: CartAddressInput!) {
3
3
  setShippingAddressesOnCart(
4
4
  input: { cart_id: $cartId, shipping_addresses: [{ address: $address }] }
5
5
  ) {
6
6
  cart {
7
7
  id
8
- ...CartData
9
- ...CartSummaryItems
8
+ ...CheckoutData
10
9
  }
11
10
  }
12
11
  }
13
- ${m}
14
- ${I}
15
- `,S=["city","company","country_code","firstname","lastname","postcode","region","region_id","save_in_address_book","street","telephone","vat_id"],N=t=>{const a={city:t[s.City],company:t[s.Company],country_code:t[s.Country],firstname:t[s.FirstName],lastname:t[s.LastName],postcode:t[s.PostCode],save_in_address_book:!0,street:p(s.Street,t),telephone:t[s.Telephone],vat_id:t[s.Vat]},n=t[s.Region],d=T(n);d?a.region_id=d:a.region=n;const c=Object.keys(t).filter(e=>!e.startsWith("street")).filter(e=>!S.includes(e)).filter(e=>e!=="country_id").map(e=>{const[r,i]=e.split(u);if(!i)return{attribute_code:r,value:t[e]};const o=p(r,t).join(_);return{attribute_code:r,value:o}}).filter((e,r,i)=>r===i.findIndex(o=>o.attribute_code===e.attribute_code));return c.length>0&&(a.custom_attributes=c),a},v=async({signal:t,cartId:a,address:n})=>await A({type:"mutation",query:y,options:{signal:t,variables:{cartId:a,address:n}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:g});export{S,N as p,v as s};
16
- //# sourceMappingURL=setShippingAddress.js.map
12
+ ${C}
13
+ `,S=["city","company","country_code","firstname","lastname","postcode","region","region_id","save_in_address_book","street","telephone","vat_id"],N=t=>{const a={city:t[s.City],company:t[s.Company],country_code:t[s.Country],firstname:t[s.FirstName],lastname:t[s.LastName],postcode:t[s.PostCode],save_in_address_book:!0,street:p(s.Street,t),telephone:t[s.Telephone],vat_id:t[s.Vat]},r=t[s.Region],i=T(r);i?a.region_id=i:a.region=r;const c=Object.keys(t).filter(e=>!e.startsWith("street")).filter(e=>!S.includes(e)).filter(e=>e!=="country_id").map(e=>{const[n,o]=e.split(u);if(!o)return{attribute_code:n,value:t[e]};const d=p(n,t).join(_);return{attribute_code:n,value:d}}).filter((e,n,o)=>n===o.findIndex(d=>d.attribute_code===e.attribute_code));return c.length>0&&(a.custom_attributes=c),a},U=async({signal:t,address:a})=>{const r=I.cartId;if(!r)throw new g;const i=await m({type:"mutation",query:y,options:{signal:t,variables:{cartId:r,address:a}},path:"setShippingAddressesOnCart.cart",signalType:"cart",transformer:h});return A.emit("cart/updated",r),i};export{S,N as p,U as s};
@@ -1,4 +1,4 @@
1
- import{M as s,e as a}from"./transform-shipping-methods.js";import{C as p,a as r,t as n}from"./getCart.graphql.js";import"./getStoreConfig.js";import"@dropins/tools/event-bus.js";const o=`
1
+ import{M as a,e as r}from"./transform-shipping-methods.js";import{i as p}from"./getStoreConfig.js";import{C as n,t as o}from"./getCart.graphql.js";import{events as e}from"@dropins/tools/event-bus.js";const h=`
2
2
  mutation setShippingMethods(
3
3
  $cartId: String!
4
4
  $shippingMethods: [ShippingMethodInput]!
@@ -8,12 +8,9 @@ import{M as s,e as a}from"./transform-shipping-methods.js";import{C as p,a as r,
8
8
  ) {
9
9
  cart {
10
10
  id
11
- ...CartData
12
- ...CartSummaryItems
11
+ ...CheckoutData
13
12
  }
14
13
  }
15
14
  }
16
- ${p}
17
- ${r}
18
- `,d=async({cartId:t,shippingMethods:i})=>{if(!t)throw new s;return a({type:"mutation",query:o,options:{variables:{cartId:t,shippingMethods:i}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:n})};export{d as s};
19
- //# sourceMappingURL=setShippingMethods.js.map
15
+ ${n}
16
+ `,M=async i=>{const t=p.cartId;if(!t)throw new a;const s=r({type:"mutation",query:h,options:{variables:{cartId:t,shippingMethods:i}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:o});return e.emit("cart/updated",t),s};export{M as s};
@@ -1,2 +1 @@
1
- import{k as v,f as m,o as f,i as S,l as x,v as _}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";class w extends Error{constructor(r){super(r.map(t=>t.message).join(" ")),this.name="FetchError"}}class i extends Error{constructor(r){super(r),this.name="InvalidArgument"}}class k extends Error{constructor(r){super(r),this.name="UnexpectedError"}}class B extends i{constructor(){super("Cart ID is required")}}class F extends i{constructor(){super("Email is required")}}class G extends i{constructor(){super("Payment method code is required")}}class Q extends i{constructor(){super("Billing address is required")}}class R extends i{constructor(){super("Country Code is required")}}const C=v({pending:!1,data:void 0}),q=v({pending:!1,data:void 0}),l=[];function A(e){return new Promise((r,t)=>{l.push(e);const s=()=>{l[0]===e?e().then(r).catch(t).finally(()=>l.shift()):setTimeout(s,100)};s()})}const P=["sender_email","recipient_email"];function T(e){return e.filter(r=>!r.path||!P.some(t=>{var s;return((s=r.path)==null?void 0:s.at(-1))===t}))}const b={cart:S,regions:q,estimateShippingMethods:C,customer:x};function I(e,r){return r.split(".").reduce((t,s)=>t&&t[s]!==void 0?t[s]:void 0,e)}const g={cart:null,customer:null,estimateShippingMethods:null,regions:null};async function V(e){const{query:r,options:t,path:s,signalType:u,type:M,transformer:c}=e,n=b[u],d=Symbol();g[u]=d,n.value={...n.value,pending:!0};try{const{data:a,errors:p}=await(M==="mutation"?A(()=>m(r,t).catch(f)):m(r,{method:"GET",cache:"no-cache",...t}).catch(f));if(p){const h=T(p);if(h.length>0)throw new w(h)}let o=I(a,s);if(o===void 0)throw new Error(`No data found at path: ${s}`);return c&&(o=c(o)),n.value={...n.value,data:o},setTimeout(()=>{n.value={...n.value,pending:g[u]===d?!1:n.value.pending}},0),o}catch(a){if(a.name==="AbortError")return;throw n.value={...n.value,pending:!1},a}}const N=(e,r)=>e.amount.value-r.amount.value,y=e=>!(!e||!e.method_code||!e.method_title||_(e.amount.value)||!e.amount.currency),E=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}`}),j=e=>{if(y(e))return E(e)},D=e=>{if(e)return e.filter(y).map(r=>E(r)).sort(N)};export{w as F,i as I,B as M,k as U,F as a,G as b,Q as c,R as d,V as e,C as f,j as g,q as r,D as t};
2
- //# sourceMappingURL=transform-shipping-methods.js.map
1
+ import{x as v,f as h,n as f,l as E,k as M}from"./getStoreConfig.js";import"@dropins/tools/event-bus.js";class S extends Error{constructor(r){super(r.map(t=>t.message).join(" ")),this.name="FetchError"}}class o extends Error{constructor(r){super(r),this.name="InvalidArgument"}}class k extends Error{constructor(r){super(r),this.name="UnexpectedError"}}class B extends o{constructor(){super("Cart ID is required")}}class F extends o{constructor(){super("Email is required")}}class G extends o{constructor(){super("Payment method code is required")}}class Q extends o{constructor(){super("Billing address is required")}}class R extends o{constructor(){super("Country Code is required")}}const w=v({pending:!1,data:void 0}),C=v({pending:!1,data:void 0}),u=[];function q(e){return new Promise((r,t)=>{u.push(e);const n=()=>{u[0]===e?e().then(r).catch(t).finally(()=>u.shift()):setTimeout(n,100)};n()})}const T=["sender_email","recipient_email"];function A(e){return e.filter(r=>!r.path||!T.some(t=>{var n;return((n=r.path)==null?void 0:n.at(-1))===t}))}const P={cart:E,regions:C,estimateShippingMethods:w,customer:M};function b(e,r){return r.split(".").reduce((t,n)=>t&&t[n]!==void 0?t[n]:void 0,e)}const g={cart:null,customer:null,estimateShippingMethods:null,regions:null};async function V(e){const{query:r,options:t,path:n,signalType:a,type:y,transformer:l}=e,s=P[a],d=Symbol();g[a]=d,s.value={...s.value,pending:!0};try{const{data:c,errors:p}=await(y==="mutation"?q(()=>h(r,t).catch(f)):h(r,{method:"GET",cache:"no-cache",...t}).catch(f));if(p){const m=A(p);if(m.length>0)throw new S(m)}let i=b(c,n);if(i===void 0)throw new Error(`No data found at path: ${n}`);return l&&(i=l(i)),s.value={...s.value,data:i},setTimeout(()=>{s.value={...s.value,pending:g[a]===d?!1:s.value.pending}},0),i}catch(c){if(c.name==="AbortError")return;throw s.value={...s.value,pending:!1},c}}const I=e=>e==null,N=(e,r)=>e.amount.value-r.amount.value,x=e=>!(!e||!e.method_code||!e.method_title||I(e.amount.value)||!e.amount.currency),_=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(x(e))return _(e)},D=e=>{if(e)return e.filter(x).map(r=>_(r)).sort(N)};export{S as F,o as I,B as M,k as U,F as a,G as b,Q as c,R as d,V as e,j as f,w as g,C as r,D as t};
@@ -0,0 +1,21 @@
1
+ import { SaveAddressCommand } from '.';
2
+ import { PreselectedAddressFields } from '../../containers';
3
+ import { AddressFormType } from '../../data/models';
4
+ import { cartSignal } from '../../signals';
5
+ import { HTMLAttributes } from 'preact/compat';
6
+
7
+ export interface AddressFormProps extends HTMLAttributes<HTMLDivElement> {
8
+ addressType: AddressFormType;
9
+ autoFill?: boolean;
10
+ headingId: string;
11
+ name: string;
12
+ preselectedFields?: PreselectedAddressFields;
13
+ saveAddressHandler: (command: SaveAddressCommand) => Promise<typeof cartSignal.value.data>;
14
+ }
15
+ export type AddressFormHandle = {
16
+ triggerSaveAddress: (signal: AbortSignal) => Promise<typeof cartSignal.value.data> | undefined;
17
+ };
18
+ export declare const AddressForm: import('preact').FunctionalComponent<import('preact/compat').PropsWithoutRef<AddressFormProps> & {
19
+ ref?: import('preact').Ref<AddressFormHandle> | undefined;
20
+ }>;
21
+ //# sourceMappingURL=AddressForm.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare const MULTILINE_SUFFIX = "-";
2
+ export declare const MULTILINE_CUSTOM_ATTR_SPLIT = "\n";
3
+ export declare const DEBOUNCE_TIME = 2000;
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,7 @@
1
+ export * from './AddressForm';
2
+ export * from './constants';
3
+ export * from './useAddressForm';
4
+ export * from './usePreselectedFields';
5
+ export * from './utils';
6
+ export { AddressForm as default } from './AddressForm';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { AddressFormType, AddressFormValues } from '../../data/models/address-form-fields';
2
+
3
+ export declare function useAddressBackup(addressType: AddressFormType): {
4
+ addressBackup: AddressFormValues | null;
5
+ backup: (address: AddressFormValues) => NodeJS.Timeout;
6
+ removeBackup: () => void;
7
+ };
8
+ //# sourceMappingURL=useAddressBackup.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { AddressFormErrors, AddressFormType, AddressFormValues } from '../../data/models';
2
+ import { cartSignal } from '../../signals';
3
+ import { RefObject } from 'preact';
4
+
5
+ export type DefaultValues = {
6
+ country_id?: string;
7
+ };
8
+ export type AddressFormState = {
9
+ address: AddressFormValues;
10
+ errors: AddressFormErrors;
11
+ };
12
+ export type SaveAddressCommand = {
13
+ signal?: AbortSignal;
14
+ address: AddressFormValues;
15
+ };
16
+ export type LoadAutoFillProps = {
17
+ values: AddressFormValues;
18
+ triggerAutoSave: boolean;
19
+ };
20
+ export type UseAddressFormProps = {
21
+ formRef: RefObject<HTMLFormElement>;
22
+ type: AddressFormType;
23
+ defaultValues?: DefaultValues;
24
+ preselection?: AddressFormValues;
25
+ saveAddressHandler: (command: SaveAddressCommand) => Promise<typeof cartSignal.value.data>;
26
+ };
27
+ export declare const useAddressForm: ({ formRef, type, defaultValues, preselection, saveAddressHandler, }: UseAddressFormProps) => {
28
+ address: AddressFormValues;
29
+ errors: Record<string, string>;
30
+ loadAutoFill: ({ values, triggerAutoSave, }: LoadAutoFillProps) => void;
31
+ dismissError: (code: string) => void;
32
+ onChange: (event: Event) => void;
33
+ onSelection: (event: Event) => void;
34
+ onBlur: (event: Event) => void;
35
+ onInvalid: (event: Event) => void;
36
+ setAddress: import('preact/hooks').Dispatch<import('preact/hooks').StateUpdater<AddressFormValues>>;
37
+ };
38
+ //# sourceMappingURL=useAddressForm.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { AddressFormType, AddressFormValues } from '../../data/models';
2
+
3
+ type useCheckoutAddressEventEmitterProps = {
4
+ address: AddressFormValues;
5
+ type: AddressFormType;
6
+ };
7
+ declare function useCheckoutAddressEventEmitter({ address, type, }: useCheckoutAddressEventEmitterProps): void;
8
+ export default useCheckoutAddressEventEmitter;
9
+ //# sourceMappingURL=useCheckoutAddressEventEmitter.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { PreselectedAddressFields } from '../../containers';
2
+ import { AddressFormField, AddressFormValues } from '../../data/models/address-form-fields';
3
+
4
+ export type UsePreselectedFieldsProps = {
5
+ fields?: AddressFormField[];
6
+ preselectedFields?: PreselectedAddressFields;
7
+ };
8
+ export declare function usePreselectedFields({ fields, preselectedFields, }: UsePreselectedFieldsProps): AddressFormValues;
9
+ //# sourceMappingURL=usePreselectedFields.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { AddressFormType } from '../../data/models';
2
+ import { Cart } from '../../data/models/cart';
3
+ import { Customer } from '../../data/models/customer';
4
+
5
+ export declare const getCustomerAddress: ({ addressType, customer, }: {
6
+ addressType: AddressFormType;
7
+ customer: Customer;
8
+ }) => import('../../data/models').CustomerAddress | undefined;
9
+ export declare const getCartAddress: ({ addressType, cart, }: {
10
+ addressType: AddressFormType;
11
+ cart: Cart;
12
+ }) => import('../../data/models/address').Address | undefined;
13
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { CheckboxProps } from '@dropins/tools/types/elsie/src/components';
3
+
4
+ export interface BillToShippingAddressProps extends Omit<CheckboxProps, 'name' | 'label'> {
5
+ isInitialized?: boolean;
6
+ }
7
+ export declare const BillToShippingAddress: FunctionComponent<BillToShippingAddressProps>;
8
+ //# sourceMappingURL=BillToShippingAddress.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export declare const BillToShippingAddressSkeleton: FunctionComponent;
4
+ //# sourceMappingURL=BillToShippingAddressSkeleton.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './BillToShippingAddress';
2
+ export * from './BillToShippingAddressSkeleton';
3
+ export { BillToShippingAddress as default } from './BillToShippingAddress';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { FunctionComponent, VNode } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export type MainSections = {
5
+ outOfStock?: VNode;
6
+ billingAddress: VNode;
7
+ billToShippingAddress?: VNode;
8
+ login: VNode;
9
+ paymentMethods: VNode;
10
+ placeOrder: VNode;
11
+ shippingAddress?: VNode;
12
+ shippingMethods?: VNode;
13
+ };
14
+ declare const Main: FunctionComponent<{
15
+ sections?: MainSections;
16
+ }>;
17
+ export interface CheckoutProps extends HTMLAttributes<HTMLDivElement> {
18
+ isLoading?: boolean;
19
+ }
20
+ interface CheckoutComponent extends FunctionComponent<CheckoutProps> {
21
+ Main: typeof Main;
22
+ }
23
+ export declare const Checkout: CheckoutComponent;
24
+ export {};
25
+ //# sourceMappingURL=Checkout.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './Checkout';
2
+ export { Checkout as default } from './Checkout';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface EmptyCartProps extends HTMLAttributes<HTMLDivElement> {
5
+ title?: string;
6
+ routeHome?: () => string;
7
+ }
8
+ export declare const EmptyCart: FunctionComponent<EmptyCartProps>;
9
+ //# sourceMappingURL=EmptyCart.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './EmptyCart';
2
+ export { EmptyCart as default } from './EmptyCart';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { AddressFormElement, AddressFormType } from '../../data/models/address-form-fields';
2
+ import { FunctionComponent, Ref } from 'preact';
3
+ import { HTMLAttributes } from 'preact/compat';
4
+
5
+ export interface FieldsFormProps extends HTMLAttributes<HTMLDivElement> {
6
+ addressType: AddressFormType;
7
+ fields: AddressFormElement[];
8
+ formRef: Ref<HTMLFormElement>;
9
+ headingId: string;
10
+ name: string;
11
+ }
12
+ export declare const FieldsForm: FunctionComponent<FieldsFormProps>;
13
+ //# sourceMappingURL=FieldsForm.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export declare const FieldsFormSkeleton: FunctionComponent;
4
+ //# sourceMappingURL=FieldsFormSkeleton.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { AddressFormElement, AddressFormType } from '../../data/models';
2
+
3
+ type FieldFactoryProps = {
4
+ addressType: AddressFormType;
5
+ element: AddressFormElement;
6
+ };
7
+ export declare const createField: ({ addressType, element }: FieldFactoryProps) => import("preact").JSX.Element | null;
8
+ export {};
9
+ //# sourceMappingURL=fieldFactory.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { AddressFormElement } from '../../data/models/address-form-fields';
2
+
3
+ declare const defaultFormElements: AddressFormElement[];
4
+ export { defaultFormElements };
5
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1,6 @@
1
+ export * from './fieldFactory';
2
+ export * from './validation';
3
+ export * from './FieldsForm';
4
+ export * from './FieldsFormSkeleton';
5
+ export { FieldsForm as default } from './FieldsForm';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { AddressFormField } from '../../data/models/address-form-fields';
2
+
3
+ export type ValidityProps = {
4
+ accept?: string;
5
+ max?: string | number;
6
+ maxLength?: number;
7
+ min?: string | number;
8
+ minLength?: number;
9
+ pattern?: string;
10
+ required?: boolean;
11
+ };
12
+ export type InputValidation = 'alphanumeric' | 'alphanumeric-w-space' | 'alphanum-with-spaces' | 'alpha' | 'url' | 'numeric' | 'email';
13
+ export declare const validityProps: (rules: AddressFormField['validateRules']) => ValidityProps;
14
+ export type Patterns = {
15
+ [key in InputValidation]: RegExp;
16
+ };
17
+ export declare const patterns: Patterns;
18
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { FunctionComponent } from 'preact';
2
+ import { HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface HeadingProps extends Omit<HTMLAttributes<HTMLHeadingElement>, 'level'> {
5
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
6
+ }
7
+ export declare const Heading: FunctionComponent<HeadingProps>;
8
+ //# sourceMappingURL=Heading.d.ts.map
@@ -0,0 +1,3 @@
1
+ export * from './Heading';
2
+ export { Heading as default } from './Heading';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { FunctionComponent } from 'preact';
3
+
4
+ export interface LoginEmailProps extends HTMLAttributes<HTMLFormElement> {
5
+ value?: string;
6
+ error?: string;
7
+ hint?: string;
8
+ onChange: (e: any) => void;
9
+ onBlur: (e: any) => void;
10
+ onInvalid: (e: any) => void;
11
+ }
12
+ export declare const Email: FunctionComponent<LoginEmailProps>;
13
+ //# sourceMappingURL=Email.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { Customer } from '../../data/models';
2
+ import { FunctionComponent, HTMLAttributes } from 'preact/compat';
3
+
4
+ export interface LoginFormProps extends HTMLAttributes<HTMLDivElement> {
5
+ currentEmail: string | null;
6
+ hint?: string;
7
+ error?: string | null;
8
+ onEmailChange: (e: any) => void;
9
+ onEmailBlur: (e: any) => void;
10
+ onEmailInvalid: (e: any) => void;
11
+ onSignInClick?: (email: string | null) => void;
12
+ onSignOutClick?: () => void;
13
+ isAuthenticated: boolean;
14
+ customer?: Customer | null;
15
+ }
16
+ export declare const LoginForm: FunctionComponent<LoginFormProps>;
17
+ //# sourceMappingURL=LoginForm.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ export declare const LoginFormSkeleton: FunctionComponent;
4
+ //# sourceMappingURL=LoginFormSkeleton.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'preact';
2
+
3
+ type SignInProps = {
4
+ onSignInClick?: (email: string | null) => void;
5
+ email: string | null;
6
+ };
7
+ export declare const SignIn: FunctionComponent<SignInProps>;
8
+ export {};
9
+ //# sourceMappingURL=SignIn.d.ts.map