@zonos/elements 1.3.286 → 1.3.287

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 (656) hide show
  1. package/README.md +9 -1
  2. package/dist/cjs/RemoveIcon-CuM1YmjP.js +5 -0
  3. package/dist/cjs/{cart-0cf8897b.js → cart-CV4buPlT.js} +17 -27
  4. package/dist/cjs/{collect-79131e52.js → collect-jzWKzrV7.js} +17 -113
  5. package/dist/cjs/debounce-5sZmmlCI.js +9 -0
  6. package/dist/cjs/debounce-Nu2lJW4A.js +405 -0
  7. package/dist/cjs/{formatStringWithLinks-c25b4018.js → formatStringWithLinks-vOVkAjlu.js} +1 -1
  8. package/dist/cjs/{getBorderRadius-97fd5e02.js → getBorderRadius-DGZiQu09.js} +1 -1
  9. package/dist/cjs/{getContrastColor-956dfaf7.js → getContrastColor-B2Kn8XHA.js} +2 -2
  10. package/dist/cjs/{getMissingRequiredShippingFields-a8f04267.js → getMissingRequiredShippingFields-r5vYIqoX.js} +1 -1
  11. package/dist/cjs/{handleFetch-954f30e1.js → handleFetch-DQLhurnE.js} +4 -3
  12. package/dist/cjs/{hasInclusivePrice-d0cd2007.js → hasInclusivePrice-BZMQohG9.js} +1 -1
  13. package/dist/cjs/{helpers-5bdbb68c.js → helpers-ClOZ11A9.js} +0 -3
  14. package/dist/cjs/{index-b1f95d96.js → index-DAAr465v.js} +1252 -580
  15. package/dist/cjs/index.cjs.js +17 -21
  16. package/dist/cjs/{invoice-254ae23b.js → invoice-CHw-mJdS.js} +6 -6
  17. package/dist/cjs/{isContrastColor-30f84a91.js → isContrastColor-B9ldIdpa.js} +1 -1
  18. package/dist/cjs/isDarkColor-f-fD9c2l.js +1187 -0
  19. package/dist/cjs/loader.cjs.js +3 -5
  20. package/dist/cjs/{localization-fb2ece37.js → localization-CxXsmxs5.js} +4 -4
  21. package/dist/cjs/{paypal-8ca67278.js → paypal-BLuHeOJH.js} +10 -9
  22. package/dist/cjs/{placeTestOrder-12b63822.js → placeTestOrder-VK_CMeq0.js} +3 -3
  23. package/dist/cjs/{renderCheckoutCurrency-a1f71587.js → renderCheckoutCurrency-CC4CAy-a.js} +2 -2
  24. package/dist/cjs/{renderFallback-bc20ee20.js → renderFallback-Bme86uk8.js} +1 -1
  25. package/dist/cjs/{shouldRenderTaxIdInput-7d19556c.js → shouldRenderTaxIdInput-TxekHCp7.js} +2 -2
  26. package/dist/cjs/{shouldShowLanguageSelect-82985128.js → shouldShowLanguageSelect-Bj_jKWPK.js} +1 -1
  27. package/dist/cjs/{submitGtag-8a25f001.js → submitGtag-CcEL-w5D.js} +3 -3
  28. package/dist/cjs/throttle-BcxGntLr.js +87 -0
  29. package/dist/cjs/{updateCheckoutSessionAttributes-de7b1466.js → updateCheckoutSessionAttributes-Dltl5RBx.js} +3 -3
  30. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +644 -692
  31. package/dist/cjs/zonos-address-display_2.cjs.entry.js +13 -17
  32. package/dist/cjs/zonos-address_4.cjs.entry.js +50 -40
  33. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +15 -16
  34. package/dist/cjs/zonos-badge.cjs.entry.js +7 -10
  35. package/dist/cjs/zonos-banner.cjs.entry.js +6 -9
  36. package/dist/cjs/zonos-button_3.cjs.entry.js +18 -21
  37. package/dist/cjs/zonos-card_5.cjs.entry.js +34 -35
  38. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +85 -83
  39. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +10 -14
  40. package/dist/cjs/zonos-checkout.cjs.entry.js +50 -34
  41. package/dist/cjs/zonos-collapse.cjs.entry.js +5 -8
  42. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +18 -23
  43. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +59 -55
  44. package/dist/cjs/zonos-collect.cjs.entry.js +20 -23
  45. package/dist/cjs/zonos-component.cjs.entry.js +3 -6
  46. package/dist/cjs/zonos-controller.cjs.entry.js +13 -16
  47. package/dist/cjs/zonos-country-flag.cjs.entry.js +8 -11
  48. package/dist/cjs/zonos-country-select_4.cjs.entry.js +68 -57
  49. package/dist/cjs/zonos-elements.cjs.js +7 -7
  50. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +22 -23
  51. package/dist/cjs/zonos-hello.cjs.entry.js +19 -17
  52. package/dist/cjs/zonos-input.cjs.entry.js +10 -11
  53. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +17 -21
  54. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +57 -52
  55. package/dist/cjs/zonos-invoice.cjs.entry.js +19 -22
  56. package/dist/cjs/zonos-language-select_2.cjs.entry.js +11 -15
  57. package/dist/cjs/zonos-link.cjs.entry.js +3 -6
  58. package/dist/cjs/zonos-logo.cjs.entry.js +6 -9
  59. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +15 -19
  60. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +11 -14
  61. package/dist/cjs/zonos-stripe-input.cjs.entry.js +15 -14
  62. package/dist/cjs/zonos-text.cjs.entry.js +8 -11
  63. package/dist/cjs/zonos-tooltip.cjs.entry.js +4 -7
  64. package/dist/cjs/zonos-v-stack.cjs.entry.js +6 -9
  65. package/dist/cjs/zonosStore-BCNYr6Tk.js +3808 -0
  66. package/dist/collection/__tests__/jsxWithChildren.types.js +13 -0
  67. package/dist/collection/collection-manifest.json +3 -2
  68. package/dist/collection/components/checkout/zonos-checkout/zonos-address-completion-dialog/zonos-address-completion-dialog.js +13 -10
  69. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +4 -3
  70. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +8 -5
  71. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +17 -13
  72. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +1 -1
  73. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +4 -4
  74. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +7 -5
  75. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +5 -4
  76. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +8 -8
  77. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-empty-state-payment/zonos-empty-state-payment.js +5 -4
  78. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-store-credit/zonos-store-credit.js +1 -1
  79. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +18 -14
  80. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +13 -10
  81. package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +2 -2
  82. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +7 -7
  83. package/dist/collection/components/checkout/zonos-collect/zonos-collect-finish/zonos-collect-finish.js +8 -6
  84. package/dist/collection/components/checkout/zonos-collect/zonos-collect-footer/zonos-collect-footer.js +6 -5
  85. package/dist/collection/components/checkout/zonos-collect/zonos-collect-order-details/zonos-collect-order-details.js +4 -4
  86. package/dist/collection/components/checkout/zonos-collect/zonos-collect-payment/zonos-collect-payment.js +7 -7
  87. package/dist/collection/components/checkout/zonos-collect/zonos-collect-review/zonos-collect-review.js +3 -3
  88. package/dist/collection/components/checkout/zonos-collect/zonos-collect.js +2 -2
  89. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +1 -1
  90. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +8 -6
  91. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +6 -5
  92. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +4 -4
  93. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +7 -7
  94. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +3 -3
  95. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +1 -1
  96. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +2 -2
  97. package/dist/collection/components/common/zonos-badge/zonos-badge.js +8 -7
  98. package/dist/collection/components/common/zonos-banner/zonos-banner.js +4 -4
  99. package/dist/collection/components/common/zonos-button/zonos-button.js +29 -25
  100. package/dist/collection/components/common/zonos-card/zonos-card.js +9 -8
  101. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +15 -12
  102. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +9 -6
  103. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  104. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +15 -15
  105. package/dist/collection/components/common/zonos-country-flag/zonos-country-flag.js +6 -5
  106. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  107. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +22 -21
  108. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +3 -2
  109. package/dist/collection/components/common/zonos-icon/zonos-icon.js +8 -7
  110. package/dist/collection/components/common/zonos-input/zonos-input.js +7 -7
  111. package/dist/collection/components/common/zonos-link/zonos-link.js +7 -7
  112. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +4 -4
  113. package/dist/collection/components/common/zonos-logo/zonos-logo.js +4 -3
  114. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +8 -7
  115. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +1 -1
  116. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +15 -12
  117. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +2 -2
  118. package/dist/collection/components/common/zonos-spinner/zonos-spinner.js +3 -3
  119. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +17 -17
  120. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +23 -20
  121. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +19 -19
  122. package/dist/collection/components/common/zonos-text/zonos-text.js +15 -11
  123. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +4 -3
  124. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  125. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +3 -2
  126. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +7 -6
  127. package/dist/collection/components/component-template/zonos-component/zonos-component.js +3 -3
  128. package/dist/collection/components/hello/zonos-hello/zonos-hello.js +16 -12
  129. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +3 -2
  130. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +14 -11
  131. package/dist/collection/components/main/zonos-controller.js +18 -10
  132. package/dist/collection/components/store/checkout/stripe.js +1 -1
  133. package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -8
  134. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +6 -4
  135. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +13 -10
  136. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +4 -4
  137. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +2 -2
  138. package/dist/collection/components/utils/checkout/isEuDapRemittance.js +1 -1
  139. package/dist/collection/components/utils/checkout/shouldRenderTaxIdInput.js +1 -1
  140. package/dist/collection/scripts/cart/_setupCartData.js +2 -2
  141. package/dist/collection/scripts/cart/_setupCartDataWithSettings.js +2 -2
  142. package/dist/collection/types/generated/graphql.internal.types.js +5 -0
  143. package/dist/esm/RemoveIcon-C2QMVeWW.js +3 -0
  144. package/dist/esm/{cart-d04742f5.js → cart-ekBk_gxV.js} +18 -28
  145. package/dist/esm/{collect-4c310a16.js → collect-33rMINDo.js} +17 -113
  146. package/dist/esm/debounce-D4ko2kvZ.js +403 -0
  147. package/dist/esm/debounce-DWPsxJsW.js +7 -0
  148. package/dist/esm/{formatStringWithLinks-0d48f183.js → formatStringWithLinks-BcMPqGl0.js} +1 -1
  149. package/dist/esm/{getBorderRadius-1f7be586.js → getBorderRadius-HwG64EKM.js} +1 -1
  150. package/dist/esm/{getContrastColor-4c0ae8c1.js → getContrastColor-CfCPlW9U.js} +2 -2
  151. package/dist/esm/{getMissingRequiredShippingFields-f0878e32.js → getMissingRequiredShippingFields-u1nhQzJ1.js} +1 -1
  152. package/dist/esm/{handleFetch-a844cac1.js → handleFetch-D5GYDF-O.js} +4 -3
  153. package/dist/esm/{hasInclusivePrice-d801be22.js → hasInclusivePrice-CAVXi310.js} +1 -1
  154. package/dist/esm/{helpers-2f6955b1.js → helpers-DJIdCwJ5.js} +0 -3
  155. package/dist/esm/{index-cfd394c8.js → index-_lt63o7c.js} +1253 -561
  156. package/dist/esm/index.js +20 -22
  157. package/dist/esm/{invoice-86487dac.js → invoice-BNDWuVsD.js} +6 -6
  158. package/dist/esm/{isContrastColor-9fa0d013.js → isContrastColor-CWLU13s9.js} +1 -1
  159. package/dist/esm/isDarkColor-YdrG78th.js +1184 -0
  160. package/dist/esm/loader.js +4 -4
  161. package/dist/esm/{localization-36a4dc22.js → localization-AOqYXGdP.js} +5 -5
  162. package/dist/esm/{paypal-997935ab.js → paypal-CW1D2XqZ.js} +10 -9
  163. package/dist/esm/{placeTestOrder-a53f2056.js → placeTestOrder-nhmsLLOA.js} +3 -3
  164. package/dist/esm/{renderCheckoutCurrency-e0e16eb7.js → renderCheckoutCurrency-BQANmZyM.js} +2 -2
  165. package/dist/esm/{renderFallback-b250f4e9.js → renderFallback-Cy03ZcWE.js} +1 -1
  166. package/dist/esm/{shouldRenderTaxIdInput-ef7b5860.js → shouldRenderTaxIdInput-CKyZ6Zni.js} +2 -2
  167. package/dist/esm/{shouldShowLanguageSelect-328f50e2.js → shouldShowLanguageSelect-BQFCXouB.js} +1 -1
  168. package/dist/esm/{submitGtag-71c450b6.js → submitGtag-CCGQS060.js} +4 -4
  169. package/dist/esm/throttle-D5GyA3yr.js +85 -0
  170. package/dist/esm/{updateCheckoutSessionAttributes-23b222de.js → updateCheckoutSessionAttributes-eRSqdC74.js} +3 -3
  171. package/dist/esm/zonos-address-completion-dialog_7.entry.js +644 -690
  172. package/dist/esm/zonos-address-display_2.entry.js +13 -15
  173. package/dist/esm/zonos-address_4.entry.js +50 -38
  174. package/dist/esm/zonos-airwallex-payment.entry.js +15 -14
  175. package/dist/esm/zonos-badge.entry.js +7 -8
  176. package/dist/esm/zonos-banner.entry.js +6 -7
  177. package/dist/esm/zonos-button_3.entry.js +18 -19
  178. package/dist/esm/zonos-card_5.entry.js +34 -33
  179. package/dist/esm/zonos-cart-items_12.entry.js +85 -81
  180. package/dist/esm/zonos-checkbox_2.entry.js +10 -12
  181. package/dist/esm/zonos-checkout.entry.js +50 -32
  182. package/dist/esm/zonos-collapse.entry.js +5 -6
  183. package/dist/esm/zonos-collect-cart-items_3.entry.js +18 -21
  184. package/dist/esm/zonos-collect-finish_6.entry.js +59 -53
  185. package/dist/esm/zonos-collect.entry.js +20 -21
  186. package/dist/esm/zonos-component.entry.js +3 -4
  187. package/dist/esm/zonos-controller.entry.js +13 -14
  188. package/dist/esm/zonos-country-flag.entry.js +8 -9
  189. package/dist/esm/zonos-country-select_4.entry.js +68 -55
  190. package/dist/esm/zonos-elements.js +6 -5
  191. package/dist/esm/zonos-hello-dialog.entry.js +22 -21
  192. package/dist/esm/zonos-hello.entry.js +19 -15
  193. package/dist/esm/zonos-input.entry.js +10 -9
  194. package/dist/esm/zonos-invoice-cart-items_2.entry.js +17 -19
  195. package/dist/esm/zonos-invoice-finish_5.entry.js +57 -50
  196. package/dist/esm/zonos-invoice.entry.js +19 -20
  197. package/dist/esm/zonos-language-select_2.entry.js +11 -13
  198. package/dist/esm/zonos-link.entry.js +3 -4
  199. package/dist/esm/zonos-logo.entry.js +6 -7
  200. package/dist/esm/zonos-policy-consent_2.entry.js +15 -17
  201. package/dist/esm/zonos-shipping-rich-radio.entry.js +11 -12
  202. package/dist/esm/zonos-stripe-input.entry.js +15 -12
  203. package/dist/esm/zonos-text.entry.js +8 -9
  204. package/dist/esm/zonos-tooltip.entry.js +4 -5
  205. package/dist/esm/zonos-v-stack.entry.js +6 -7
  206. package/dist/esm/zonosStore-DrIOAz4M.js +3795 -0
  207. package/dist/esm-es5/{CheckoutConfig-724d7bae.js → CheckoutConfig-D5SpFsQJ.js} +5 -1
  208. package/dist/esm-es5/VarianceTest-BJmZPrZl.js +9 -0
  209. package/dist/esm-es5/{buildCartItemsByTempCart-a117f75d.js → buildCartItemsByTempCart-BycjkdlE.js} +4 -0
  210. package/dist/esm-es5/cart-ekBk_gxV.js +517 -0
  211. package/dist/esm-es5/classes-BJHSB96f.js +10 -0
  212. package/dist/esm-es5/cleanHtmlMarkdown-ByGDytaN.js +191 -0
  213. package/dist/esm-es5/collect-33rMINDo.js +241 -0
  214. package/dist/esm-es5/containsNonLatinChars-C04AWRC2.js +11 -0
  215. package/dist/esm-es5/createCustomEvent-XQfWgQLB.js +6 -0
  216. package/dist/esm-es5/debounce-D4ko2kvZ.js +153 -0
  217. package/dist/esm-es5/debounce-DWPsxJsW.js +1 -0
  218. package/dist/esm-es5/formatStringWithLinks-BcMPqGl0.js +8 -0
  219. package/dist/esm-es5/getBorderRadius-HwG64EKM.js +8 -0
  220. package/dist/esm-es5/getContrastColor-CfCPlW9U.js +14 -0
  221. package/dist/esm-es5/getGenericSettingsOverride-HeAZDwVW.js +4 -0
  222. package/dist/esm-es5/getMissingRequiredShippingFields-u1nhQzJ1.js +20 -0
  223. package/dist/esm-es5/handleFetch-D5GYDF-O.js +60 -0
  224. package/dist/esm-es5/hasInclusivePrice-CAVXi310.js +6 -0
  225. package/dist/esm-es5/helpers-DJIdCwJ5.js +23 -0
  226. package/dist/esm-es5/index-_lt63o7c.js +162 -0
  227. package/dist/esm-es5/index.js +227 -1
  228. package/dist/esm-es5/invoice-BNDWuVsD.js +13 -0
  229. package/dist/esm-es5/isColorVariable-DXXUq2Lv.js +11 -0
  230. package/dist/esm-es5/isContrastColor-CWLU13s9.js +5 -0
  231. package/dist/esm-es5/isDarkColor-YdrG78th.js +204 -0
  232. package/dist/esm-es5/isSameHostCheckoutLink-BxAHnL5J.js +16 -0
  233. package/dist/esm-es5/loader.js +1 -1
  234. package/dist/esm-es5/localization-AOqYXGdP.js +332 -0
  235. package/dist/esm-es5/paypal-CW1D2XqZ.js +192 -0
  236. package/dist/esm-es5/placeTestOrder-nhmsLLOA.js +1 -0
  237. package/dist/esm-es5/renderCheckoutCurrency-BQANmZyM.js +13 -0
  238. package/dist/esm-es5/{renderFallback-b250f4e9.js → renderFallback-Cy03ZcWE.js} +1 -1
  239. package/dist/esm-es5/shouldRenderTaxIdInput-CKyZ6Zni.js +17 -0
  240. package/dist/esm-es5/shouldShowLanguageSelect-BQFCXouB.js +7 -0
  241. package/dist/esm-es5/styles-BTIeCf3T.js +6 -0
  242. package/dist/esm-es5/submitGtag-CCGQS060.js +45 -0
  243. package/dist/esm-es5/throttle-D5GyA3yr.js +46 -0
  244. package/dist/esm-es5/updateCheckoutSessionAttributes-eRSqdC74.js +8 -0
  245. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +2966 -1
  246. package/dist/esm-es5/zonos-address-display_2.entry.js +46 -1
  247. package/dist/esm-es5/zonos-address_4.entry.js +179 -1
  248. package/dist/esm-es5/zonos-airwallex-payment.entry.js +49 -1
  249. package/dist/esm-es5/zonos-badge.entry.js +25 -1
  250. package/dist/esm-es5/zonos-banner.entry.js +7 -1
  251. package/dist/esm-es5/zonos-button_3.entry.js +116 -1
  252. package/dist/esm-es5/zonos-card_5.entry.js +33 -1
  253. package/dist/esm-es5/zonos-cart-items_12.entry.js +666 -1
  254. package/dist/esm-es5/zonos-checkbox_2.entry.js +21 -1
  255. package/dist/esm-es5/zonos-checkout.entry.js +1043 -1
  256. package/dist/esm-es5/zonos-collapse.entry.js +15 -1
  257. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +13 -1
  258. package/dist/esm-es5/zonos-collect-finish_6.entry.js +157 -1
  259. package/dist/esm-es5/zonos-collect.entry.js +171 -1
  260. package/dist/esm-es5/zonos-component.entry.js +10 -1
  261. package/dist/esm-es5/zonos-controller.entry.js +198 -1
  262. package/dist/esm-es5/zonos-country-flag.entry.js +6 -1
  263. package/dist/esm-es5/zonos-country-select_4.entry.js +152 -1
  264. package/dist/esm-es5/zonos-elements.js +4 -1
  265. package/dist/esm-es5/zonos-hello-dialog.entry.js +63 -1
  266. package/dist/esm-es5/zonos-hello.entry.js +121 -1
  267. package/dist/esm-es5/zonos-input.entry.js +16 -1
  268. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +7 -1
  269. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +133 -1
  270. package/dist/esm-es5/zonos-invoice.entry.js +115 -1
  271. package/dist/esm-es5/zonos-language-select_2.entry.js +14 -1
  272. package/dist/esm-es5/zonos-link.entry.js +4 -1
  273. package/dist/esm-es5/zonos-logo.entry.js +7 -1
  274. package/dist/esm-es5/zonos-policy-consent_2.entry.js +31 -1
  275. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +5 -1
  276. package/dist/esm-es5/zonos-stripe-input.entry.js +27 -1
  277. package/dist/esm-es5/zonos-text.entry.js +24 -1
  278. package/dist/esm-es5/zonos-tooltip.entry.js +7 -1
  279. package/dist/esm-es5/zonos-v-stack.entry.js +5 -1
  280. package/dist/esm-es5/zonosStore-DrIOAz4M.js +1153 -0
  281. package/dist/scripts/index.d.ts +1171 -521
  282. package/dist/scripts/index.js +1 -1
  283. package/dist/scripts/loadZonos.js +1 -1
  284. package/dist/scripts/zonos.js +1 -1
  285. package/dist/types/__tests__/jsxWithChildren.types.d.ts +14 -0
  286. package/dist/types/__tests__/vitest-globals.d.ts +1 -0
  287. package/dist/types/components/store/checkout/cart.d.ts +9 -9
  288. package/dist/types/components/utils/api/checkItemRestrictions.d.ts +2 -2
  289. package/dist/types/components/utils/api/getLocaleMessages.d.ts +5 -5
  290. package/dist/types/components/utils/checkout/isShippableCountry.d.ts +5 -1
  291. package/dist/types/components/utils/hello/detectItemRestrictions.d.ts +2 -2
  292. package/dist/types/components.d.ts +797 -147
  293. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +127 -127
  294. package/dist/types/stencil-public-runtime.d.ts +205 -12
  295. package/dist/types/types/generated/graphql.frontend.types.d.ts +60 -60
  296. package/dist/types/types/generated/graphql.frontend.types.ts +55 -55
  297. package/dist/types/types/generated/graphql.internal.types.d.ts +1290 -1285
  298. package/dist/types/types/generated/graphql.internal.types.ts +1113 -1108
  299. package/dist/zonos-elements/index.esm.js +1 -1
  300. package/dist/zonos-elements/p-02ef0f99.system.entry.js +6 -0
  301. package/dist/zonos-elements/{p-1be53c82.entry.js → p-0466650f.entry.js} +1 -1
  302. package/dist/zonos-elements/p-04bfcd72.system.entry.js +152 -0
  303. package/dist/zonos-elements/p-04cc0dac.system.entry.js +198 -0
  304. package/dist/zonos-elements/p-058f07aa.system.entry.js +7 -0
  305. package/dist/zonos-elements/p-0f603278.system.entry.js +5 -0
  306. package/dist/zonos-elements/{p-bb09ee50.entry.js → p-128485dc.entry.js} +1 -1
  307. package/dist/zonos-elements/p-1568ab06.system.entry.js +117 -0
  308. package/dist/zonos-elements/p-2ba738ec.entry.js +1 -0
  309. package/dist/zonos-elements/{p-6afd5fab.entry.js → p-31ac495f.entry.js} +1 -1
  310. package/dist/zonos-elements/p-34d1545a.entry.js +1 -0
  311. package/dist/zonos-elements/p-39c8a898.entry.js +1 -0
  312. package/dist/zonos-elements/p-3ERbuo5a.js +1 -0
  313. package/dist/zonos-elements/p-450ed170.system.entry.js +46 -0
  314. package/dist/zonos-elements/p-4973f8d8.system.entry.js +180 -0
  315. package/dist/zonos-elements/p-49e7bb1e.system.entry.js +7 -0
  316. package/dist/zonos-elements/p-4a54f664.entry.js +1 -0
  317. package/dist/zonos-elements/p-4ab1c533.system.entry.js +4 -0
  318. package/dist/zonos-elements/p-5024df2d.system.entry.js +666 -0
  319. package/dist/zonos-elements/p-5562a955.system.entry.js +7 -0
  320. package/dist/zonos-elements/p-5836d426.system.entry.js +49 -0
  321. package/dist/zonos-elements/p-5a631080.system.entry.js +13 -0
  322. package/dist/zonos-elements/{p-2ce039e5.entry.js → p-5c08d36b.entry.js} +1 -1
  323. package/dist/zonos-elements/{p-aed4ffb2.entry.js → p-5d3079e8.entry.js} +1 -1
  324. package/dist/zonos-elements/p-629f09dc.system.entry.js +171 -0
  325. package/dist/zonos-elements/p-64e7bc5b.entry.js +1 -0
  326. package/dist/zonos-elements/p-6b0afaa7.entry.js +1 -0
  327. package/dist/zonos-elements/p-6f742021.entry.js +1 -0
  328. package/dist/zonos-elements/p-7681798d.entry.js +1 -0
  329. package/dist/zonos-elements/p-7a5d2211.system.entry.js +115 -0
  330. package/dist/zonos-elements/{p-6de2f9c9.entry.js → p-7ae48e31.entry.js} +1 -1
  331. package/dist/zonos-elements/{p-f37150e8.entry.js → p-8328f44d.entry.js} +1 -1
  332. package/dist/zonos-elements/{p-171a7e1e.entry.js → p-844a743a.entry.js} +1 -1
  333. package/dist/zonos-elements/p-891b47d7.entry.js +1 -0
  334. package/dist/zonos-elements/p-89ddab88.entry.js +1 -0
  335. package/dist/zonos-elements/p-8cd3f1e2.entry.js +1 -0
  336. package/dist/zonos-elements/p-9818f823.entry.js +1 -0
  337. package/dist/zonos-elements/p-9b399685.system.entry.js +10 -0
  338. package/dist/zonos-elements/p-9b6482ef.entry.js +1 -0
  339. package/dist/zonos-elements/{p-2c44e013.entry.js → p-9ebe9a36.entry.js} +1 -1
  340. package/dist/zonos-elements/p-B2EZRfoq.system.js +193 -0
  341. package/dist/zonos-elements/p-B3GRrRtL.system.js +5 -0
  342. package/dist/zonos-elements/p-BANhKkF2.system.js +1 -0
  343. package/dist/zonos-elements/p-BDopxBpR.system.js +6 -0
  344. package/dist/zonos-elements/p-BJufDgh3.js +1 -0
  345. package/dist/zonos-elements/p-BLQFeIez.system.js +191 -0
  346. package/dist/zonos-elements/p-BNtWsPPP.system.js +7 -0
  347. package/dist/zonos-elements/p-BSgVcCxT.system.js +9 -0
  348. package/dist/zonos-elements/p-BXjdMMUy.js +1 -0
  349. package/dist/zonos-elements/p-BbgqQIHv.system.js +9 -0
  350. package/dist/zonos-elements/p-BgSx82zO.system.js +11 -0
  351. package/dist/zonos-elements/p-Bi-s0fp_.system.js +17 -0
  352. package/dist/zonos-elements/p-Bu9WCfUC.system.js +5 -0
  353. package/dist/zonos-elements/p-C19J2XSh.js +1 -0
  354. package/dist/zonos-elements/p-C2QMVeWW.js +1 -0
  355. package/dist/zonos-elements/p-C2j7R11h.system.js +11 -0
  356. package/dist/zonos-elements/p-CEl4pzNq.js +1 -0
  357. package/dist/zonos-elements/p-CICjAi70.js +1 -0
  358. package/dist/zonos-elements/p-CIevpRv_.system.js +162 -0
  359. package/dist/zonos-elements/{p-344a6278.js → p-CJCoACvU.js} +2 -2
  360. package/dist/zonos-elements/p-CKBbIU4b.system.js +14 -0
  361. package/dist/zonos-elements/p-CKTIJ2Gr.js +1 -0
  362. package/dist/zonos-elements/p-CKhl__Kc.system.js +4 -0
  363. package/dist/zonos-elements/p-CPnR_T0a.system.js +1153 -0
  364. package/dist/zonos-elements/p-CQqNJo0D.system.js +13 -0
  365. package/dist/zonos-elements/p-CYdt69j5.system.js +241 -0
  366. package/dist/zonos-elements/p-CZl1nwqv.system.js +46 -0
  367. package/dist/zonos-elements/p-CaAod213.system.js +8 -0
  368. package/dist/zonos-elements/p-CaUXHglQ.system.js +153 -0
  369. package/dist/zonos-elements/{p-45bd8072.system.js → p-CeLaK0Ff.system.js} +1 -1
  370. package/dist/zonos-elements/p-CtEsvWI6.js +1 -0
  371. package/dist/zonos-elements/p-D-DawUYF.system.js +1 -0
  372. package/dist/zonos-elements/p-D0erXw7p.js +1 -0
  373. package/dist/zonos-elements/p-D31lQiWo.system.js +21 -0
  374. package/dist/zonos-elements/p-D5AtAlJx.system.js +13 -0
  375. package/dist/zonos-elements/p-DBOI98r5.system.js +7 -0
  376. package/dist/zonos-elements/{p-41dd1cb8.js → p-DE4a-QD5.js} +1 -1
  377. package/dist/zonos-elements/p-DGsEWFDU.system.js +8 -0
  378. package/dist/zonos-elements/{p-a4c7ee17.js → p-DHwpNxG9.js} +1 -1
  379. package/dist/zonos-elements/p-DIJaXkiE.system.js +332 -0
  380. package/dist/zonos-elements/{p-eef5b0cc.js → p-DJIdCwJ5.js} +1 -1
  381. package/dist/zonos-elements/p-DPW1yXt9.system.js +517 -0
  382. package/dist/zonos-elements/{p-6bdc5c96.js → p-DTgv0QpG.js} +1 -1
  383. package/dist/zonos-elements/p-DW-fW8yR.system.js +205 -0
  384. package/dist/zonos-elements/p-Dj-O6VfM.system.js +7 -0
  385. package/dist/zonos-elements/p-DjuFsKLG.js +1 -0
  386. package/dist/zonos-elements/p-DkpYo2Fs.js +1 -0
  387. package/dist/zonos-elements/p-DnjGkbEy.js +1 -0
  388. package/dist/zonos-elements/p-Dw-5yD9y.system.js +227 -0
  389. package/dist/zonos-elements/p-LypTHRUC.js +1 -0
  390. package/dist/zonos-elements/p-MfsSJh_D.system.js +8 -0
  391. package/dist/zonos-elements/p-YdrG78th.js +1 -0
  392. package/dist/zonos-elements/p-_lt63o7c.js +3 -0
  393. package/dist/zonos-elements/p-a38e62cc.entry.js +1 -0
  394. package/dist/zonos-elements/p-a6faab6a.entry.js +1 -0
  395. package/dist/zonos-elements/p-adfee3a3.entry.js +1 -0
  396. package/dist/zonos-elements/p-b14819ab.system.entry.js +14 -0
  397. package/dist/zonos-elements/{p-0c972ddf.entry.js → p-b68ca96f.entry.js} +1 -1
  398. package/dist/zonos-elements/p-b6deae2b.system.entry.js +5 -0
  399. package/dist/zonos-elements/p-bdba7d9e.system.entry.js +25 -0
  400. package/dist/zonos-elements/p-be64d823.system.entry.js +16 -0
  401. package/dist/zonos-elements/p-beeb9d36.system.entry.js +21 -0
  402. package/dist/zonos-elements/p-cadf6b63.system.entry.js +33 -0
  403. package/dist/zonos-elements/p-cc5306fe.system.entry.js +24 -0
  404. package/dist/zonos-elements/p-cc949df1.system.entry.js +7 -0
  405. package/dist/zonos-elements/{p-5d110c2b.entry.js → p-cdffc9b6.entry.js} +1 -1
  406. package/dist/zonos-elements/p-cf5688f7.entry.js +1 -0
  407. package/dist/zonos-elements/p-d05Ku7gM.system.js +24 -0
  408. package/dist/zonos-elements/p-d33dfc78.system.entry.js +2966 -0
  409. package/dist/zonos-elements/p-d55b9664.system.entry.js +157 -0
  410. package/dist/zonos-elements/p-daf9fa07.system.entry.js +133 -0
  411. package/dist/zonos-elements/p-dcdbc610.system.entry.js +27 -0
  412. package/dist/zonos-elements/p-e101d722.system.entry.js +63 -0
  413. package/dist/zonos-elements/{p-9639a8ed.entry.js → p-e284d329.entry.js} +1 -1
  414. package/dist/zonos-elements/{p-5227aa69.entry.js → p-e9320825.entry.js} +1 -1
  415. package/dist/zonos-elements/p-ea8790aa.entry.js +1 -0
  416. package/dist/zonos-elements/{p-6ee4e027.entry.js → p-eadaefdc.entry.js} +1 -1
  417. package/dist/zonos-elements/p-f27317d3.system.entry.js +31 -0
  418. package/dist/zonos-elements/p-f2cedbcd.system.entry.js +121 -0
  419. package/dist/zonos-elements/p-f57495dc.entry.js +1 -0
  420. package/dist/zonos-elements/p-f6e0aeba.system.entry.js +1043 -0
  421. package/dist/zonos-elements/p-f8fd756a.system.entry.js +15 -0
  422. package/dist/zonos-elements/{p-7ada039e.entry.js → p-fe778437.entry.js} +1 -1
  423. package/dist/zonos-elements/{p-adfbf57b.js → p-i1iCWKdv.js} +1 -1
  424. package/dist/zonos-elements/p-lGLcGvEA.js +1 -0
  425. package/dist/zonos-elements/p-nOb4xPLF.system.js +17 -0
  426. package/dist/zonos-elements/p-nU86HJ5w.js +1 -0
  427. package/dist/zonos-elements/p-pfIceXbY.js +1 -0
  428. package/dist/zonos-elements/p-smUku7Ku.system.js +5 -0
  429. package/dist/zonos-elements/p-t_ClFAJR.js +1 -0
  430. package/dist/zonos-elements/p-uV7m6KrY.system.js +46 -0
  431. package/dist/zonos-elements/p-vN6p_rO1.system.js +11 -0
  432. package/dist/zonos-elements/p-zRjRcLMp.js +1 -0
  433. package/dist/zonos-elements/p-zVLAvre1.system.js +60 -0
  434. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  435. package/dist/zonos-elements/zonos-elements.js +1 -1
  436. package/loader/index.d.ts +1 -1
  437. package/package.json +28 -32
  438. package/dist/cjs/RemoveIcon-081ac073.js +0 -5
  439. package/dist/cjs/debounce-7ca3c878.js +0 -357
  440. package/dist/cjs/isDarkColor-a6e6fd5e.js +0 -1202
  441. package/dist/cjs/throttle-366c204b.js +0 -76
  442. package/dist/cjs/zonosStore-0af0b937.js +0 -3030
  443. package/dist/esm/RemoveIcon-9dc5dd1a.js +0 -3
  444. package/dist/esm/debounce-84ade9c2.js +0 -355
  445. package/dist/esm/isDarkColor-939d8e9c.js +0 -1199
  446. package/dist/esm/throttle-c4c24e86.js +0 -74
  447. package/dist/esm/zonosStore-eca1e364.js +0 -3017
  448. package/dist/esm-es5/VarianceTest-572cecf5.js +0 -1
  449. package/dist/esm-es5/cart-d04742f5.js +0 -1
  450. package/dist/esm-es5/classes-0d95c529.js +0 -1
  451. package/dist/esm-es5/cleanHtmlMarkdown-87d195f6.js +0 -1
  452. package/dist/esm-es5/collect-4c310a16.js +0 -1
  453. package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +0 -1
  454. package/dist/esm-es5/createCustomEvent-58159025.js +0 -1
  455. package/dist/esm-es5/debounce-84ade9c2.js +0 -1
  456. package/dist/esm-es5/formatStringWithLinks-0d48f183.js +0 -1
  457. package/dist/esm-es5/getBorderRadius-1f7be586.js +0 -1
  458. package/dist/esm-es5/getContrastColor-4c0ae8c1.js +0 -1
  459. package/dist/esm-es5/getGenericSettingsOverride-0bc3e118.js +0 -1
  460. package/dist/esm-es5/getMissingRequiredShippingFields-f0878e32.js +0 -1
  461. package/dist/esm-es5/handleFetch-a844cac1.js +0 -1
  462. package/dist/esm-es5/hasInclusivePrice-d801be22.js +0 -1
  463. package/dist/esm-es5/helpers-2f6955b1.js +0 -1
  464. package/dist/esm-es5/index-cfd394c8.js +0 -13
  465. package/dist/esm-es5/invoice-86487dac.js +0 -1
  466. package/dist/esm-es5/isColorVariable-0a94004f.js +0 -1
  467. package/dist/esm-es5/isContrastColor-9fa0d013.js +0 -1
  468. package/dist/esm-es5/isDarkColor-939d8e9c.js +0 -1
  469. package/dist/esm-es5/isSameHostCheckoutLink-c1b88ab7.js +0 -1
  470. package/dist/esm-es5/localization-36a4dc22.js +0 -1
  471. package/dist/esm-es5/paypal-997935ab.js +0 -17
  472. package/dist/esm-es5/placeTestOrder-a53f2056.js +0 -1
  473. package/dist/esm-es5/renderCheckoutCurrency-e0e16eb7.js +0 -1
  474. package/dist/esm-es5/shouldRenderTaxIdInput-ef7b5860.js +0 -1
  475. package/dist/esm-es5/shouldShowLanguageSelect-328f50e2.js +0 -1
  476. package/dist/esm-es5/styles-6fc2fad9.js +0 -1
  477. package/dist/esm-es5/submitGtag-71c450b6.js +0 -1
  478. package/dist/esm-es5/throttle-c4c24e86.js +0 -1
  479. package/dist/esm-es5/updateCheckoutSessionAttributes-23b222de.js +0 -1
  480. package/dist/esm-es5/zonosStore-eca1e364.js +0 -1
  481. package/dist/zonos-elements/p-01174496.system.js +0 -1
  482. package/dist/zonos-elements/p-06f798ee.system.js +0 -1
  483. package/dist/zonos-elements/p-083a11cd.system.entry.js +0 -1
  484. package/dist/zonos-elements/p-08e7107d.js +0 -1
  485. package/dist/zonos-elements/p-0b29169b.js +0 -1
  486. package/dist/zonos-elements/p-0c327a57.system.entry.js +0 -1
  487. package/dist/zonos-elements/p-0d2f81ce.system.js +0 -1
  488. package/dist/zonos-elements/p-0e199a6c.system.entry.js +0 -1
  489. package/dist/zonos-elements/p-0ff845ec.js +0 -1
  490. package/dist/zonos-elements/p-117953db.system.entry.js +0 -1
  491. package/dist/zonos-elements/p-14afffa8.system.js +0 -1
  492. package/dist/zonos-elements/p-1834f486.js +0 -1
  493. package/dist/zonos-elements/p-1aa93d1e.system.js +0 -1
  494. package/dist/zonos-elements/p-1ac0c631.system.js +0 -1
  495. package/dist/zonos-elements/p-1b8771bb.js +0 -1
  496. package/dist/zonos-elements/p-1cdd27ec.js +0 -1
  497. package/dist/zonos-elements/p-1cfb5c2a.system.entry.js +0 -1
  498. package/dist/zonos-elements/p-1f8648c8.system.entry.js +0 -1
  499. package/dist/zonos-elements/p-23e7c655.system.js +0 -1
  500. package/dist/zonos-elements/p-2670438c.system.js +0 -1
  501. package/dist/zonos-elements/p-27660512.js +0 -1
  502. package/dist/zonos-elements/p-277b77e3.js +0 -1
  503. package/dist/zonos-elements/p-278abdcf.entry.js +0 -1
  504. package/dist/zonos-elements/p-29b60bf3.system.js +0 -1
  505. package/dist/zonos-elements/p-2b97f7ed.js +0 -1
  506. package/dist/zonos-elements/p-2bbe9d91.js +0 -1
  507. package/dist/zonos-elements/p-2c7a425d.entry.js +0 -1
  508. package/dist/zonos-elements/p-2cab1746.system.entry.js +0 -1
  509. package/dist/zonos-elements/p-3490b6d0.entry.js +0 -1
  510. package/dist/zonos-elements/p-398d9022.system.js +0 -1
  511. package/dist/zonos-elements/p-3a26e5e7.system.entry.js +0 -1
  512. package/dist/zonos-elements/p-40a4c8a2.system.js +0 -1
  513. package/dist/zonos-elements/p-40af92a1.system.entry.js +0 -1
  514. package/dist/zonos-elements/p-4160bbc2.system.js +0 -1
  515. package/dist/zonos-elements/p-41f1697a.system.entry.js +0 -1
  516. package/dist/zonos-elements/p-4671fde7.entry.js +0 -1
  517. package/dist/zonos-elements/p-490d7fec.system.entry.js +0 -1
  518. package/dist/zonos-elements/p-4941c096.system.entry.js +0 -1
  519. package/dist/zonos-elements/p-4b159ff3.system.js +0 -1
  520. package/dist/zonos-elements/p-502d6eeb.js +0 -1
  521. package/dist/zonos-elements/p-50d088f7.system.entry.js +0 -1
  522. package/dist/zonos-elements/p-51e4e61a.system.entry.js +0 -1
  523. package/dist/zonos-elements/p-551fa762.system.js +0 -1
  524. package/dist/zonos-elements/p-5b990c91.entry.js +0 -1
  525. package/dist/zonos-elements/p-60832726.system.js +0 -1
  526. package/dist/zonos-elements/p-67426156.system.js +0 -1
  527. package/dist/zonos-elements/p-6890e060.system.js +0 -1
  528. package/dist/zonos-elements/p-6eaf7c9e.system.entry.js +0 -1
  529. package/dist/zonos-elements/p-7176f582.entry.js +0 -1
  530. package/dist/zonos-elements/p-7261e245.system.js +0 -13
  531. package/dist/zonos-elements/p-7352abe9.js +0 -1
  532. package/dist/zonos-elements/p-74230da8.system.js +0 -1
  533. package/dist/zonos-elements/p-76834a0a.system.entry.js +0 -1
  534. package/dist/zonos-elements/p-77993ba1.entry.js +0 -1
  535. package/dist/zonos-elements/p-78f8e594.entry.js +0 -1
  536. package/dist/zonos-elements/p-7ac8846c.system.js +0 -1
  537. package/dist/zonos-elements/p-7b525c75.system.js +0 -1
  538. package/dist/zonos-elements/p-7f688485.system.entry.js +0 -1
  539. package/dist/zonos-elements/p-7fbbdb0f.system.js +0 -1
  540. package/dist/zonos-elements/p-8861d47e.js +0 -1
  541. package/dist/zonos-elements/p-8a0b8175.system.entry.js +0 -1
  542. package/dist/zonos-elements/p-8a6c4017.js +0 -1
  543. package/dist/zonos-elements/p-8be02f3a.system.js +0 -1
  544. package/dist/zonos-elements/p-8d14cb66.entry.js +0 -1
  545. package/dist/zonos-elements/p-8e6338b9.entry.js +0 -1
  546. package/dist/zonos-elements/p-916228fb.system.js +0 -1
  547. package/dist/zonos-elements/p-944c1fb3.entry.js +0 -1
  548. package/dist/zonos-elements/p-947e4402.system.entry.js +0 -1
  549. package/dist/zonos-elements/p-96ab529e.entry.js +0 -1
  550. package/dist/zonos-elements/p-998975a3.system.js +0 -18
  551. package/dist/zonos-elements/p-9ad640b2.system.entry.js +0 -1
  552. package/dist/zonos-elements/p-9ecb9afc.system.entry.js +0 -1
  553. package/dist/zonos-elements/p-a04e2750.system.entry.js +0 -1
  554. package/dist/zonos-elements/p-a1bd3a53.system.js +0 -1
  555. package/dist/zonos-elements/p-a553e132.js +0 -1
  556. package/dist/zonos-elements/p-acb7dee1.system.entry.js +0 -1
  557. package/dist/zonos-elements/p-af19722c.system.js +0 -1
  558. package/dist/zonos-elements/p-b4ae66cb.system.entry.js +0 -1
  559. package/dist/zonos-elements/p-bcaffb85.system.entry.js +0 -1
  560. package/dist/zonos-elements/p-be6cd28c.system.entry.js +0 -1
  561. package/dist/zonos-elements/p-bf37ccc7.system.js +0 -1
  562. package/dist/zonos-elements/p-c0af11fe.system.js +0 -1
  563. package/dist/zonos-elements/p-c112fa12.system.entry.js +0 -1
  564. package/dist/zonos-elements/p-c4321a1a.system.js +0 -1
  565. package/dist/zonos-elements/p-c5d1217f.system.js +0 -1
  566. package/dist/zonos-elements/p-c7329333.entry.js +0 -1
  567. package/dist/zonos-elements/p-c756a59d.system.js +0 -1
  568. package/dist/zonos-elements/p-c77b049c.entry.js +0 -1
  569. package/dist/zonos-elements/p-ca87ada5.system.entry.js +0 -1
  570. package/dist/zonos-elements/p-ce75b047.js +0 -2
  571. package/dist/zonos-elements/p-d1a51fac.js +0 -1
  572. package/dist/zonos-elements/p-d6a73125.system.entry.js +0 -1
  573. package/dist/zonos-elements/p-d75726e5.system.entry.js +0 -1
  574. package/dist/zonos-elements/p-d938f42f.system.js +0 -1
  575. package/dist/zonos-elements/p-dd866ca3.system.entry.js +0 -1
  576. package/dist/zonos-elements/p-dd8a7bf4.entry.js +0 -1
  577. package/dist/zonos-elements/p-de58684b.system.js +0 -1
  578. package/dist/zonos-elements/p-e160b75f.js +0 -1
  579. package/dist/zonos-elements/p-e1ef3984.system.entry.js +0 -1
  580. package/dist/zonos-elements/p-e27b8e18.entry.js +0 -1
  581. package/dist/zonos-elements/p-e4b07f7d.system.entry.js +0 -1
  582. package/dist/zonos-elements/p-e4dc24e1.system.js +0 -1
  583. package/dist/zonos-elements/p-e5865ad9.system.js +0 -1
  584. package/dist/zonos-elements/p-e7d7afda.entry.js +0 -1
  585. package/dist/zonos-elements/p-ebbda085.system.js +0 -1
  586. package/dist/zonos-elements/p-f4720b0a.js +0 -1
  587. package/dist/zonos-elements/p-f8356934.system.entry.js +0 -1
  588. package/dist/zonos-elements/p-f9346f1c.entry.js +0 -1
  589. package/dist/zonos-elements/p-fc5f6113.js +0 -1
  590. package/dist/zonos-elements/p-fe28dbe6.entry.js +0 -1
  591. package/loader/package.json +0 -11
  592. /package/dist/cjs/{CheckoutConfig-27c82f94.js → CheckoutConfig-B7JRM7yr.js} +0 -0
  593. /package/dist/cjs/{ShortAddressCode-bec338b0.js → ShortAddressCode-C5l520-F.js} +0 -0
  594. /package/dist/cjs/{TaxId-cd9d490e.js → TaxId-Q6aDqqWv.js} +0 -0
  595. /package/dist/cjs/{VarianceTest-bec00ea8.js → VarianceTest-C98whVgO.js} +0 -0
  596. /package/dist/cjs/{app-globals-3a1e7e63.js → app-globals-V2Kpy_OQ.js} +0 -0
  597. /package/dist/cjs/{buildCartItemsByTempCart-edddbf4b.js → buildCartItemsByTempCart-ILzonEjb.js} +0 -0
  598. /package/dist/cjs/{classes-b7918f56.js → classes-D_DL168u.js} +0 -0
  599. /package/dist/cjs/{cleanHtmlMarkdown-57147de7.js → cleanHtmlMarkdown-DpT-nZLH.js} +0 -0
  600. /package/dist/cjs/{containsNonLatinChars-2be5129b.js → containsNonLatinChars-D_OggJN6.js} +0 -0
  601. /package/dist/cjs/{createCustomEvent-7b6fad95.js → createCustomEvent-Cs5zGImL.js} +0 -0
  602. /package/dist/cjs/{getGenericSettingsOverride-c0ca32b9.js → getGenericSettingsOverride-CL6l6wvX.js} +0 -0
  603. /package/dist/cjs/{getHasMoreSpaceOnRight-4c94667f.js → getHasMoreSpaceOnRight-Cl50u1mb.js} +0 -0
  604. /package/dist/cjs/{isCollectMobileTablet-884d4280.js → isCollectMobileTablet-Cx2nZ15_.js} +0 -0
  605. /package/dist/cjs/{isColorVariable-525dbfa7.js → isColorVariable-CKoJdu9G.js} +0 -0
  606. /package/dist/cjs/{isInvoiceMobileTablet-dde41e4e.js → isInvoiceMobileTablet-CCqFYV6m.js} +0 -0
  607. /package/dist/cjs/{isSameHostCheckoutLink-6148cabb.js → isSameHostCheckoutLink-DbmQ7Ha4.js} +0 -0
  608. /package/dist/cjs/{styles-d1e64fb9.js → styles-nowYls3K.js} +0 -0
  609. /package/dist/esm/{CheckoutConfig-724d7bae.js → CheckoutConfig-D5SpFsQJ.js} +0 -0
  610. /package/dist/esm/{ShortAddressCode-7620e622.js → ShortAddressCode-nJ6oI8-n.js} +0 -0
  611. /package/dist/esm/{TaxId-63a14057.js → TaxId-Cye-evFK.js} +0 -0
  612. /package/dist/esm/{VarianceTest-572cecf5.js → VarianceTest-BJmZPrZl.js} +0 -0
  613. /package/dist/esm/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
  614. /package/dist/esm/{buildCartItemsByTempCart-a117f75d.js → buildCartItemsByTempCart-BycjkdlE.js} +0 -0
  615. /package/dist/esm/{classes-0d95c529.js → classes-BJHSB96f.js} +0 -0
  616. /package/dist/esm/{cleanHtmlMarkdown-87d195f6.js → cleanHtmlMarkdown-ByGDytaN.js} +0 -0
  617. /package/dist/esm/{containsNonLatinChars-2d8810c3.js → containsNonLatinChars-C04AWRC2.js} +0 -0
  618. /package/dist/esm/{createCustomEvent-58159025.js → createCustomEvent-XQfWgQLB.js} +0 -0
  619. /package/dist/esm/{getGenericSettingsOverride-0bc3e118.js → getGenericSettingsOverride-HeAZDwVW.js} +0 -0
  620. /package/dist/esm/{getHasMoreSpaceOnRight-70eb913a.js → getHasMoreSpaceOnRight-DAscqB23.js} +0 -0
  621. /package/dist/esm/{isCollectMobileTablet-111b0dd7.js → isCollectMobileTablet-DGlnuxEX.js} +0 -0
  622. /package/dist/esm/{isColorVariable-0a94004f.js → isColorVariable-DXXUq2Lv.js} +0 -0
  623. /package/dist/esm/{isInvoiceMobileTablet-1f7b614e.js → isInvoiceMobileTablet-Clej0Ffe.js} +0 -0
  624. /package/dist/esm/{isSameHostCheckoutLink-c1b88ab7.js → isSameHostCheckoutLink-BxAHnL5J.js} +0 -0
  625. /package/dist/esm/{styles-6fc2fad9.js → styles-BTIeCf3T.js} +0 -0
  626. /package/dist/esm-es5/{RemoveIcon-9dc5dd1a.js → RemoveIcon-C2QMVeWW.js} +0 -0
  627. /package/dist/esm-es5/{ShortAddressCode-7620e622.js → ShortAddressCode-nJ6oI8-n.js} +0 -0
  628. /package/dist/esm-es5/{TaxId-63a14057.js → TaxId-Cye-evFK.js} +0 -0
  629. /package/dist/esm-es5/{app-globals-0f993ce5.js → app-globals-DQuL1Twl.js} +0 -0
  630. /package/dist/esm-es5/{getHasMoreSpaceOnRight-70eb913a.js → getHasMoreSpaceOnRight-DAscqB23.js} +0 -0
  631. /package/dist/esm-es5/{isCollectMobileTablet-111b0dd7.js → isCollectMobileTablet-DGlnuxEX.js} +0 -0
  632. /package/dist/esm-es5/{isInvoiceMobileTablet-1f7b614e.js → isInvoiceMobileTablet-Clej0Ffe.js} +0 -0
  633. /package/dist/zonos-elements/{p-2770ba48.system.js → p-0D0aCMu6.system.js} +0 -0
  634. /package/dist/zonos-elements/{p-b4b7f705.js → p-BJHSB96f.js} +0 -0
  635. /package/dist/zonos-elements/{p-0a377722.js → p-BJmZPrZl.js} +0 -0
  636. /package/dist/zonos-elements/{p-96d77739.js → p-BTIeCf3T.js} +0 -0
  637. /package/dist/zonos-elements/{p-56ba5cbf.system.js → p-BbPAtVJG.system.js} +0 -0
  638. /package/dist/zonos-elements/{p-11206fe2.js → p-BxAHnL5J.js} +0 -0
  639. /package/dist/zonos-elements/{p-cc6ad18a.js → p-ByGDytaN.js} +0 -0
  640. /package/dist/zonos-elements/{p-83666056.js → p-BycjkdlE.js} +0 -0
  641. /package/dist/zonos-elements/{p-0c64dbbb.js → p-C04AWRC2.js} +0 -0
  642. /package/dist/zonos-elements/{p-655ec440.system.js → p-C29tlYn0.system.js} +0 -0
  643. /package/dist/zonos-elements/{p-2adbbce7.system.js → p-CLDnjFm5.system.js} +0 -0
  644. /package/dist/zonos-elements/{p-989cb22b.system.js → p-Cby4EkFu.system.js} +0 -0
  645. /package/dist/zonos-elements/{p-1f3549c6.js → p-Clej0Ffe.js} +0 -0
  646. /package/dist/zonos-elements/{p-bcf5cffb.js → p-Cye-evFK.js} +0 -0
  647. /package/dist/zonos-elements/{p-b2d81c98.js → p-D5SpFsQJ.js} +0 -0
  648. /package/dist/zonos-elements/{p-5883217a.js → p-DAscqB23.js} +0 -0
  649. /package/dist/zonos-elements/{p-579932a7.js → p-DGlnuxEX.js} +0 -0
  650. /package/dist/zonos-elements/{p-e1255160.js → p-DQuL1Twl.js} +0 -0
  651. /package/dist/zonos-elements/{p-ae393255.js → p-DXXUq2Lv.js} +0 -0
  652. /package/dist/zonos-elements/{p-e7b0c156.js → p-HeAZDwVW.js} +0 -0
  653. /package/dist/zonos-elements/{p-595f5dd2.js → p-XQfWgQLB.js} +0 -0
  654. /package/dist/zonos-elements/{p-bc7bf53e.system.js → p-Z99tSPFR.system.js} +0 -0
  655. /package/dist/zonos-elements/{p-6f23a26a.system.js → p-_GDmY2H7.system.js} +0 -0
  656. /package/dist/zonos-elements/{p-1d42cd20.js → p-nJ6oI8-n.js} +0 -0
@@ -0,0 +1,517 @@
1
+ var __awaiter=this&&this.__awaiter||function(e,r,n,t){function o(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?n(e.value):o(e.value).then(a,s)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;o=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,i;t<o;t++){if(i||!(t in r)){if(!i)i=Array.prototype.slice.call(r,0,t);i[t]=r[t]}}return e.concat(i||Array.prototype.slice.call(r))};System.register(["./p-CPnR_T0a.system.js","./p-DIJaXkiE.system.js","./p-BbgqQIHv.system.js","./p-zVLAvre1.system.js","./p-DW-fW8yR.system.js","./p-BSgVcCxT.system.js","./p-Cby4EkFu.system.js"],(function(e){"use strict";var r,n,t,o,i,a,s,u,d,l,c,v,f,p,m,h,w,y,g,b;return{setters:[function(e){r=e.c;n=e.z},function(e){t=e.s;o=e.t;i=e.k;a=e.l;s=e.f;u=e.d},function(e){d=e.l;l=e.b},function(e){c=e.h;v=e.l;f=e.f;p=e.g;m=e.a;h=e.s;w=e.j},function(e){y=e.i},function(e){g=e.g},function(e){b=e.e}],execute:function(){var _=this;var S=e("g",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o;return __generator(this,(function(i){switch(i.label){case 0:if(!t.checkoutSessionId){return[2/*return*/,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",t.checkoutSessionId);return[4/*yield*/,c("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:r=i.sent(),n=r.errors,o=r.json;return[2/*return*/,{errors:n,json:o}]}}))}))}));var O=r((function(){return{amountToApply:null,appliedAmount:null,availableBalance:null,error:null,isApplying:false,isEnabled:false,orderIdCreated:null,remainingBalance:null,useFullBalance:true}})),A=O.reset,C=O.state;e("R",C);
2
+ /**
3
+ * Reset store credit store to initial state
4
+ */var k=e("S",(function(){A()}));
5
+ /**
6
+ * Set the available balance from the checkout session's customerProfile.storeCreditBalance
7
+ */var I=function(e){d("Store credit balance from session","info",e);C.availableBalance=e};
8
+ /**
9
+ * Re-fetch the store credit balance from the checkout session.
10
+ * Called when the payment step loads to ensure the balance is fresh.
11
+ */var T=e("a6",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:return[4/*yield*/,S()];case 1:n=a.sent(),t=n.errors,o=n.json;if(t.length||!o){v("Failed to refresh store credit balance");return[2/*return*/]}i=(r=(e=o.checkoutSession.customerProfile)===null||e===void 0?void 0:e.storeCreditBalance)!==null&&r!==void 0?r:null;I(i);return[2/*return*/]}}))}))}));
12
+ /**
13
+ * Apply store credit to the checkout session.
14
+ * This must be called BEFORE payment confirmation.
15
+ * The amount/mode are already set via checkout session update with storeCreditApplication.
16
+ */var E=e("A",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,s;return __generator(this,(function(l){switch(l.label){case 0:r=t.checkoutSessionId;if(!r){n="No checkout session found";v(n);C.error=n;return[2/*return*/,{error:n,success:false}]}d("Applying store credit","info",{checkoutSessionId:r});C.isApplying=true;C.error=null;l.label=1;case 1:l.trys.push([1,3,,4]);return[4/*yield*/,c("/api/zonos-elements/store-credit/apply",{body:{checkoutSessionId:r},method:"POST"})];case 2:o=l.sent(),i=o.errors,a=o.json;if(i.length>0||!a){s=((e=i[0])===null||e===void 0?void 0:e.message)||"Failed to apply store credit";v(s);C.error=s;C.isApplying=false;return[2/*return*/,{error:s,success:false}]}C.appliedAmount=a.amountApplied;C.remainingBalance=a.remainingBalance;C.isApplying=false;d("Store credit applied","info",{amountApplied:a.amountApplied,remainingBalance:a.remainingBalance});return[2/*return*/,{error:null,success:true}];case 3:u=l.sent();s=u instanceof Error?u.message:"Failed to apply store credit";v(s);C.error=s;C.isApplying=false;return[2/*return*/,{error:s,success:false}];case 4:return[2/*return*/]}}))}))}));
17
+ /**
18
+ * Enable or disable store credit usage.
19
+ * When enabling, defaults to full balance mode.
20
+ * When disabling, clears the amount.
21
+ */var P=e("a2",(function(e){C.isEnabled=e;C.error=null;if(!e){C.amountToApply=null}}));
22
+ /**
23
+ * Set the amount of store credit to apply
24
+ * Validates against available balance and cart total
25
+ */var N=e("a5",(function(e){if(e===null){C.amountToApply=null;C.error=null;return}
26
+ // Validate amount
27
+ if(e<=0){C.error="Amount must be greater than zero";return}if(C.availableBalance!==null&&e>C.availableBalance){C.error="Amount exceeds available balance";return}var r=Xe.total+(Xe.storeCredit||0);if(e>r){C.error="Amount exceeds order total";return}C.error=null;C.amountToApply=e}));
28
+ /**
29
+ * Toggle whether to use full balance or custom amount.
30
+ * When switching to custom mode, clears the applied amount so the user
31
+ * must explicitly apply via the Apply button.
32
+ */var j=e("a3",(function(e){C.useFullBalance=e;C.error=null;if(e&&C.availableBalance!==null){var r=Xe.total+(Xe.storeCredit||0);var n=Math.min(C.availableBalance,r);C.amountToApply=n}else if(!e){C.amountToApply=null}}));
33
+ /**
34
+ * Get the storeCreditApplication input for checkout session update.
35
+ * Sends mode: 'NONE' when store credit is not being used to clear any
36
+ * previously applied store credit on the backend.
37
+ */var D=function(){if(!C.isEnabled||C.amountToApply===null){return{mode:"NONE"}}if(C.useFullBalance){return{mode:"FULL"}}return{amount:C.amountToApply,mode:"PARTIAL"}};
38
+ /**
39
+ * Get the effective amount to apply based on settings
40
+ */var L=e("K",(function(){if(!C.isEnabled||C.availableBalance===null){return 0}if(C.useFullBalance){return Math.min(C.availableBalance,Xe.total+(Xe.storeCredit||0))}return C.amountToApply||0}));
41
+ /**
42
+ * Check whether the effective store credit amount covers the full order total.
43
+ * When true, the Stripe/PayPal payment flow should be skipped and
44
+ * `storeCreditStoreCreateOrder` should be used instead.
45
+ *
46
+ * Relies on the backend's computed `cartStore.total` (remaining amount to pay
47
+ * after store credit) rather than a client-side comparison, which avoids issues
48
+ * with currency mismatches or rounding.
49
+ */var R=e("B",(function(){
50
+ // Only consider full coverage after the backend has confirmed store credit
51
+ // was applied (cartStore.storeCredit > 0) and the remaining total is 0.
52
+ return C.amountToApply!==null&&C.amountToApply>0&&Xe.storeCredit>0&&Xe.total<=0}));
53
+ /**
54
+ * Create an order paid entirely by store credit.
55
+ * Should only be called when `storeCreditStoreCoversFullAmount()` is true.
56
+ */var x=e("D",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,l,f,p,l;return __generator(this,(function(m){switch(m.label){case 0:o=t.checkoutSessionId;if(!o){i="No checkout session found";v(i);C.error=i;return[2/*return*/,{error:i,orderId:null,success:false}]}d("Creating store credit order","info",{checkoutSessionId:o});m.label=1;case 1:m.trys.push([1,3,,4]);return[4/*yield*/,c("/api/zonos-elements/store-credit/order-create",{body:{checkoutSessionId:o},method:"POST"})];case 2:a=m.sent(),s=a.errors,u=a.json;if(s.length>0||!u){l=((e=s[0])===null||e===void 0?void 0:e.message)||"Failed to create store credit order";v(l);C.error=l;return[2/*return*/,{error:l,orderId:null,success:false}]}f=((n=(r=u.checkoutSessionStoreCreditOrderCreate)===null||r===void 0?void 0:r.order)===null||n===void 0?void 0:n.id)||null;C.orderIdCreated=f;d("Store credit order created","info",{orderId:f});return[2/*return*/,{error:null,orderId:f,success:true}];case 3:p=m.sent();l=p instanceof Error?p.message:"Failed to create store credit order";v(l);C.error=l;return[2/*return*/,{error:l,orderId:null,success:false}];case 4:return[2/*return*/]}}))}))}));var U=["termsAndConditions","privacyPolicy","refundPolicy","shippingPolicy","warrantyPolicy"];
57
+ // Reuses the lowercase `'Privacy policy'` key already translated in 19 locales
58
+ // (also used by the checkout footer) — the other four are new keys that follow
59
+ // the same lowercase convention for visual consistency in the joined consent line.
60
+ var z={privacyPolicy:"Privacy policy",refundPolicy:"Refund policy",shippingPolicy:"Shipping policy",termsAndConditions:"Terms and conditions",warrantyPolicy:"Warranty policy"};var B=r({accepted:false,acceptedAt:null,locked:false,showError:false}),F=B.reset,J=B.state;e({p:F,G:J});
61
+ /**
62
+ * Returns the list of policies the merchant has configured (non-empty link).
63
+ * Policies are returned in a fixed display order so the rendered list is
64
+ * deterministic across renders and across locales. URLs that aren't absolute
65
+ * http(s) URLs are filtered out as defense-in-depth against `javascript:` or
66
+ * other unexpected schemes slipping through the backend validation.
67
+ *
68
+ * Reads from `zonosStore.checkoutSettings` (not `window.Zonos.cartSettings`)
69
+ * so the consent UI works when zonos-elements is consumed via the npm package,
70
+ * where `cartSettings` is not populated.
71
+ */var M=e("a1",(function(){var e=n.checkoutSettings.merchantPolicyLinks;if(!e){return[]}return U.reduce((function(r,n){var t,i;var a=(i=(t=e[n])===null||t===void 0?void 0:t.link)===null||i===void 0?void 0:i.trim();if(!a||!/^https?:\/\//i.test(a)){return r}r.push({key:n,name:o(z[n]),url:a});return r}),[])}));var q=e("y",(function(){return M().length>0}));
72
+ /**
73
+ * Extract first name and last name from the name string
74
+ * If first name and last name are provided, use them
75
+ * If name is provided, extract and return the first and last name from the name string
76
+ * If neither are provided, return an empty object
77
+ */var W=e("U",(function(e){var r=e.firstName,n=e.lastName,t=e.name;var o;if(!t&&!r&&!n){return{firstName:"",lastName:""}}
78
+ // Use first name and last name if they are provided
79
+ var i=(t===null||t===void 0?void 0:t.split(/\s+/))||[];var a=(r===null||r===void 0?void 0:r.trim())||((o=i[0])===null||o===void 0?void 0:o.trim())||"";var s=(n===null||n===void 0?void 0:n.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}}));
80
+ /**
81
+ * Extract value from translated object
82
+ */var Y=function(e){var r=e.currentAddress,n=e.translatedAddress;var t,o,i,a,s,u;var d=r.value.address,l=d.city,c=d.country,v=d.line1,f=d.line2,p=d.postal_code,m=d.state;var h=r.value.name||[r.value.firstName,r.value.lastName].join(" ");return{city:((t=n.city)===null||t===void 0?void 0:t[l])||l,country:c,line1:((o=n.line1)===null||o===void 0?void 0:o[v])||v,line2:((i=n.line2)===null||i===void 0?void 0:i[f||""])||f||"",name:((a=n.name)===null||a===void 0?void 0:a[h])||h,phone:r.value.phone||"",postal_code:((s=n.postal_code)===null||s===void 0?void 0:s[p])||p,state:((u=n.state)===null||u===void 0?void 0:u[m])||m}};
83
+ /**
84
+ * Similar to prepCalculateLandedCost except it only uses cart ID
85
+ */var H=function(e){var r;var n=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";
86
+ // maybe we don't need email now for prefetch the landed cost
87
+ var o=le.stripeLinkEventData;var s=le.stripeAddressEventData;var u=le.stripeShippingSameAsBilling?le.stripeAddressEventData:le.stripeBillingAddressEventData;if(!s||!u){throw new Error("Missing stripe address data")}
88
+ // Attempt to get translated address if available
89
+ var d=Y({currentAddress:s,translatedAddress:le.translatedAddress.address});var l=W({name:d.name}),c=l.firstName,v=l.lastName;var f=Y({currentAddress:u,translatedAddress:le.translatedAddress.address});var p=W({name:f.name}),m=p.firstName,h=p.lastName;var w=i()||"US";return{billingAddress:{addressLine1:f.line1,addressLine2:f.line2||"",city:f.city,country:f.country,postalCode:f.postal_code,state:f.state},billingContact:{
90
+ // firstName and lastName should be valid now since stripe only mark
91
+ // the address as complete when both fields are filled.
92
+ firstName:m,lastName:h,phone:f.phone},
93
+ // Use the first item's currency code
94
+ cartCurrencyCode:(r=Xe.items[0])===null||r===void 0?void 0:r.currencyCode,cartId:e,checkoutSessionCountry:w||a.selectedCountryCode||undefined,checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:le.companyName,email:o===null||o===void 0?void 0:o.value.email,
95
+ // firstName and lastName should be valid now since stripe only mark
96
+ // the address as complete when both fields are filled.
97
+ firstName:c,lastName:v,phone:d.phone},isTest:!!n,landedCostAdjustments:Xe.promoCode?[{amount:0,productId:null,promoCode:Xe.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToShortAddressCode:le.shortAddressCode,shipToTaxId:le.taxId,shippingAddress:{addressLine1:d.line1,addressLine2:d.line2,city:d.city,country:d.country,postalCode:d.postal_code,state:d.state}}};var K=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";
98
+ // maybe we don't need email now for prefetch the landed cost
99
+ var r=le.stripeLinkEventData;var n=le.stripeAddressEventData;var o=le.stripeShippingSameAsBilling?le.stripeAddressEventData:le.stripeBillingAddressEventData;d({stripeAddressData:n,stripeBillingAddressData:o},"info");if(!n||!o){throw new Error("Missing stripe address data")}
100
+ // Attempt to get translated address if available
101
+ var i=Y({currentAddress:n,translatedAddress:le.translatedAddress.address});var a=W({name:i.name}),s=a.firstName,u=a.lastName;var l=Y({currentAddress:o,translatedAddress:le.translatedAddress.address});var c=W({name:l.name}),v=c.firstName,f=c.lastName;var p=Xe.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var m=Xe.promoCode?__spreadArray([{amount:0,productId:null,promoCode:Xe.promoCode,sku:null,type:"PROMO_CODE"}],p,true):p;return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{
102
+ // firstName and lastName should be valid now since stripe only mark
103
+ // the address as complete when both fields are filled.
104
+ firstName:v,lastName:f,phone:l.phone},checkoutSessionId:t.checkoutSessionId||"",contact:{companyName:le.companyName,email:r===null||r===void 0?void 0:r.value.email,
105
+ // firstName and lastName should be valid now since stripe only mark
106
+ // the address as complete when both fields are filled.
107
+ firstName:s,lastName:u,phone:i.phone},isTest:e,items:Xe.items,landedCostAdjustments:m,shipToShortAddressCode:le.shortAddressCode,shipToTaxId:le.taxId,shippingAddress:{addressLine1:i.line1,addressLine2:i.line2,city:i.city,country:i.country,postalCode:i.postal_code,state:i.state}}};var V=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l;return __generator(this,(function(v){switch(v.label){case 0:a=K();return[4/*yield*/,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,
108
+ // zonosApiKey should always be available
109
+ publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:f["vercel"]},{promoCode:Xe.promoCode})];case 1:s=v.sent();if(!s||
110
+ // Only show errors if there are no rate back (checkoutSessionWorkflow) and there are errors
111
+ !((r=s.checkoutSessionWorkflow)===null||r===void 0?void 0:r.length)&&((n=s.errors)===null||n===void 0?void 0:n.length)){throw new Error("Failed to build landed cost: ".concat(((o=(t=s===null||s===void 0?void 0:s.errors)===null||t===void 0?void 0:t[0])===null||o===void 0?void 0:o.message)||"Unknown error"))}return[4/*yield*/,c("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:u=v.sent(),d=u.errors,l=u.json;if(!l||d.length){throw new Error("Invalid landed cost object: ".concat(((i=d.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2/*return*/,s]}}))}))};var G=function(e){return __awaiter(_,void 0,void 0,(function(){var r,t,o,i,a,s,u;return __generator(this,(function(d){switch(d.label){case 0:t=n.checkoutSettings.buildLandedCost;if(!t)return[3/*break*/,2];return[4/*yield*/,V(t)];case 1:o=d.sent();return[2/*return*/,o];case 2:return[4/*yield*/,c("/api/zonos-elements/calculate-landed-cost",{body:K(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:i=d.sent(),a=i.errors,s=i.json;if(a.length||!s){u=((r=a[0])===null||r===void 0?void 0:r.message)==="The user aborted a request.";if(u){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}
112
+ // We want to show any successful quotes even if there are errors
113
+ a.forEach((function(e){
114
+ // eslint-disable-next-line no-console
115
+ console.warn("Error calculating landed cost: ".concat(e.message))}));if(!s){throw new Error("Failed to calculate landed cost")}return[2/*return*/,s]}return[2/*return*/,s]}}))}))};var X=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l;var v=e.abortController,f=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4/*yield*/,c("/api/zonos-elements/cart-calculate-landed-cost",{body:H(f),method:"POST",signal:v===null||v===void 0?void 0:v.signal})];case 1:a=e.sent(),s=a.errors,u=a.json;if(s.length||!u){d=typeof((r=s[0])===null||r===void 0?void 0:r.message)==="string"&&(((n=s[0])===null||n===void 0?void 0:n.message)==="The user aborted a request."||((t=s[0])===null||t===void 0?void 0:t.message.includes("signal is aborted"))||((o=s[0])===null||o===void 0?void 0:o.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=d?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2/*return*/,u]}}))}))};var Q=undefined&&undefined.__rest||function(e,r){var n={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0)n[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))n[t[o]]=e[t[o]]}return n};var Z=function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){switch(a.label){case 0:r=window.Zonos.cartId;if(!!r)return[3/*break*/,2];return[4/*yield*/,G(e)];case 1:n=a.sent();return[2/*return*/,n];case 2:return[4/*yield*/,X({abortController:e,cartId:r})];case 3:t=a.sent(),o=t.cartWorkflow,i=Q(t,["cartWorkflow"]);return[2/*return*/,Object.assign(Object.assign({},i),{itemCreateWorkflow:o.items})]}}))}))};var $=e("t",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,i,s,u,d,v,f;var w=e.checkoutSessionId,y=e.eventName,g=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();i=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:w,eventCreated:o,eventName:y});s=
116
+ // if the url includes zonos.com and not hosted checkout (checkout.zonos.com), it means we are on the development site (dashboard, preview zonos domain or main zonos.com)
117
+ window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((r=window.Zonos)===null||r===void 0?void 0:r.zonosQaUrl)||!!((t=window.Zonos)===null||t===void 0?void 0:t.debug);u=p()||m();if((u||s)&&
118
+ // if found, it means we want to test the conversion event in development site, or test mode and staging mode
119
+ !window.Zonos.zonosConversionTest){return[2/*return*/]}d=a.selectedCountryCode;v=n.organizationId;if(!w){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No checkout session id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:i}});
120
+ // checkoutSessionId is required for tracking conversion events to work properly
121
+ return[2/*return*/]}if(!v){void h({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(y,'" - No organization id found')],metadata:{allLogs:l,checkoutSessionId:w,eventName:y,metadata:g,organizationId:v,trackEventLogs:i}})}f={checkoutSessionId:w,countryCode:d,eventCreated:o,eventName:y,metadata:Object.assign(Object.assign({},g),{trackEventLogs:i}),organizationId:v};return[4/*yield*/,c("/api/zonos-elements/track-conversion-event",{body:f,method:"POST"})];case 1:e.sent();return[2/*return*/]}}))}))}));
122
+ /**
123
+ * This function generates an object that contains the fields of an address that have invalid characters.
124
+ *
125
+ * @param {Object} params - The parameters for the function.
126
+ * @param {Address | null} params.address - The address to check for invalid characters.
127
+ * @param {ReturnType<typeof containsNonLatinChars> | null} params.invalidAdddressList - The list of address fields that contain invalid characters.
128
+ *
129
+ * @returns {Partial<Address> | undefined} - An object that contains the fields of the address that have invalid characters. If no fields have invalid characters, the function returns undefined.
130
+ */var ee=function(e){var r=e.address,n=e.invalidAdddressList;if(!r){return}
131
+ // if there are no invalid characters, return an empty object
132
+ if(!n){return}var t={};if(n.city){t.city=r.city}if(n.line1){t.line1=r.line1}if(n.line2){t.line2=r.line2}if(n.postal_code){t.postal_code=r.postal_code}if(n.state){t.state=r.state}if(n.name){t.name=r.name}
133
+ // return null if there are no fields to exclude
134
+ return Object.keys(t).length?t:undefined};
135
+ /**
136
+ * This function builds the request body for validating an address. It checks if the address and billing address are ready and if they contain any invalid characters.
137
+ * If there are non-latin character to translate, returns an object with the address fields that have invalid characters, the destination country, and the first and last name.
138
+ * If the conditions are not met, it returns null.
139
+ *
140
+ * @param {Object} params - The parameters for the function.
141
+ * @param {ReturnType<typeof containsNonLatinChars> | null} params.addressInvalidCharactersList - The list of address fields that contain invalid characters.
142
+ * @param {ReturnType<typeof containsNonLatinChars> | null} params.billingAddressInvalidCharactersList - The list of billing address fields that contain invalid characters.
143
+ * @param {StripeAddressEventData} params.stripeAddressEventData - The Stripe event data for the address.
144
+ * @param {StripeAddressEventData} params.stripeBillingAddressEventData - The Stripe event data for the billing address.
145
+ * @param {boolean} params.stripeShippingSameAsBilling - A flag indicating whether the shipping address is the same as the billing address.
146
+ *
147
+ * @returns {ValidateAddressRequest | null} - An object that contains the address fields that have invalid characters, the destination country, and the first and last name. If the conditions are not met, the function returns null.
148
+ */var re=function(e){var r=e.addressInvalidCharactersList,n=e.billingAddressInvalidCharactersList,t=e.stripeAddressEventData,o=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(t===null||t===void 0?void 0:t.complete);var s=i?a:!!(o===null||o===void 0?void 0:o.complete);
149
+ // only translate if both address and billing address are ready
150
+ if(!a||!s){return null}
151
+ // only translate if there are invalid characters
152
+ if(!r&&!n){return null}var u=t.value;var d=(o===null||o===void 0?void 0:o.value)||null;
153
+ // Returns undefined if the name is Latin so it won't be included in the request body
154
+ var l=W({firstName:u.firstName,lastName:u.lastName,name:u.name}),c=l.firstName,v=l.lastName;var f="".concat(c," ").concat(v);var p=W({firstName:d===null||d===void 0?void 0:d.firstName,lastName:d===null||d===void 0?void 0:d.lastName,name:(d===null||d===void 0?void 0:d.name)||""}),m=p.firstName,h=p.lastName;var w=m&&h?"".concat(m," ").concat(h):"";var y=u.address;var g=d===null||d===void 0?void 0:d.address;return{address:ee({address:Object.assign(Object.assign({},y),{name:f}),invalidAdddressList:r}),
155
+ // only include billing address if it's different from the shipping address
156
+ billingAddress:!i?ee({address:g?Object.assign(Object.assign({},g),{name:w}):null,invalidAdddressList:n}):undefined,destinationCountry:y.country}};
157
+ /**
158
+ * Sorts service levels with lower cost first
159
+ */var ne=e("$",(function(e){var r=e.sort((function(e,r){return e.amount-r.amount}));return r}));
160
+ /**
161
+ * Validate checkout session before confirming payment
162
+ */var te=e("C",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,i,a;return __generator(this,(function(s){switch(s.label){case 0:return[4/*yield*/,S()];case 1:n=s.sent(),t=n.errors,i=n.json;if(t.length||!i){v("Failed to retrieve checkout session info before confirming payment ",t);void h({endpoint:"validateCheckoutSession",errors:t.map((function(e){return e.message})),metadata:{allLogs:l}});return[2/*return*/,{errorMessage:o("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}a=!!(((e=i.checkoutSession.order)===null||e===void 0?void 0:e.id)&&!i.checkoutSession.completedAt);if(!a&&!((r=i.checkoutSession.landedCost)===null||r===void 0?void 0:r.id)){v("Landed cost is not found in the checkout session before confirming payment.");void h({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:l}});return[2/*return*/,{errorMessage:o('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2/*return*/,{errorMessage:"",valid:true}]}}))}))}));var oe=function(e){var r=e.theme;var t={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:n.appearance.fontSizeInputValue?"".concat(n.appearance.fontSizeInputValue,"px"):undefined,
163
+ // need to reset everything and the paddingTop to default, otherwise the paddingTop will not be updated.
164
+ padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",
165
+ // any value here will be add up to the default paddingTop (20px).
166
+ paddingTop:"6px"},".Label--resting":{fontSize:n.appearance.fontSizeInputLabel?"".concat(n.appearance.fontSizeInputLabel,"px"):undefined},".PickerItem--highlight":{boxShadow:"0 0 0 2px var(--colorBackground)"},".PickerItem--highlight:hover":{backgroundColor:"var(--colorBackground)",boxShadow:"none"},".PickerItem--new":{color:"var(--colorText)"},".Tab--selected":{borderStyle:"solid",borderWidth:"1px"}};switch(r){case"DARK":{return Object.assign(Object.assign({},t),{".Action":Object.assign(Object.assign({},t[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},t[".PickerItem--new"]),{color:"white"})})}default:return t}};var ie=function(e){var r=e.borderStyle,n=e.theme;switch(n){case"DARK":return{borderRadius:g({overrideBorderStyle:r}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:g({overrideBorderStyle:r}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var ae={Airwallex:"AIRWALLEX",Paypal:"PAYPAL",Stripe:"STRIPE"};var se=r((function(){return{checkoutSettlementCurrency:"USD",clientSecret:sessionStorage.getItem("zonos--client-secret")||"",companyName:"",companyNameUsedWhenAsyncAddressUpdate:"",customAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customBillingAddressErrors:{city:"",firstName:"",lastName:"",line1:"",phone:"",postalCode:"",showError:false,state:""},customErrorMessage:null,customerProfile:null,fetchingLandedCostAbortController:null,hasPaymentError:false,isFetchingLandedCost:false,isFetchingSession:false,partyBillingId:null,partyShippingId:null,shortAddressCode:"",shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,
167
+ /**
168
+ * Default to skip payment intent, only create payment intent when "skipPaymentIntent" in url's query params is set "0"
169
+ * @default true
170
+ */
171
+ skipPaymentIntent:new URLSearchParams(window.location.search).get("skipPaymentIntent")==="0"?false:true,stripe:null,stripeAddressElement:null,stripeAddressEventData:null,stripeAddressUsedWhenAsyncAddressUpdate:null,stripeAddressUsedWhenFetchingLC:null,stripeAddressUsedWhenValidatingAddress:null,stripeBillingAddressElement:null,stripeBillingAddressEventData:null,stripeBillingAddressUsedWhenAsyncAddressUpdate:null,stripeBillingAddressUsedWhenFetchingLC:null,stripeBillingAddressUsedWhenValidatingAddress:null,stripeCustomerSessionClientSecret:null,stripeElements:null,stripeElementsForBillingAddress:null,stripeElementsOptions:null,stripeLinkElement:null,stripeLinkEventData:null,stripeLinkUsedWhenFetchingLC:null,stripePaymentElement:null,stripePaymentEventData:null,stripeShippingSameAsBilling:true,taxId:"",taxIdUsedWhenAsyncAddressUpdate:"",translatedAddress:{address:{},billingAddress:{},firstName:{},lastName:{},name:{}}}})),ue=se.onChange,de=se.reset,le=se.state;e({J:ue,b:le});var ce=function(e){var r=e.clientSecret,t=e.overrideBorderRadius,o=e.overridePrimaryColor,i=e.overrideSecondaryColor,s=e.overrideTheme,u=e.paypalEnabled;var d=o||n.appearance.colorPrimary;var l=i||n.appearance.colorSecondary;var c=window.Zonos.isCollect||window.Zonos.isInvoice?n.appearance.theme==="DARK":d&&y(d);var v=c?"night":"flat";
172
+ // if overrideTheme is provided, use it. Otherwise, use theme based on primary color
173
+ var f=s==="DARK"?"night":"flat";var p=u?["external_paypal"]:[];
174
+ // If client secret is Stripe format, use it
175
+ var m=(r===null||r===void 0?void 0:r.includes("_secret_"))?r:undefined;return{appearance:{labels:"floating",rules:Object.assign({},oe({theme:s||"LIGHT"})),
176
+ // get contrast theme color base on primary color
177
+ theme:s?f:v,variables:Object.assign(Object.assign({},ie({borderStyle:t,theme:"LIGHT"})),{
178
+ // use the button background color for input glow color
179
+ colorPrimary:l})},
180
+ // Client secret can be undefined since we will load other elements that doesn't require client secret first, then load client secret and render one that requires it later
181
+ clientSecret:m,customerSessionClientSecret:le.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],p,true),locale:a.selectedLocale}};var ve=e("u",(function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")}));
182
+ // Save shipping address to session storage
183
+ var fe=e("a",(function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))}));var pe=e("s",(function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return w(e)}));var me=e("i",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i;return __generator(this,(function(a){t=le.clientSecret;if(!le.stripe){d("Skip. Stripe is not initialized");return[2/*return*/]}o=ce({clientSecret:t,overrideBorderRadius:e===null||e===void 0?void 0:e.overrideBorderRadius,overridePrimaryColor:e===null||e===void 0?void 0:e.overridePrimaryColor,overrideSecondaryColor:e===null||e===void 0?void 0:e.overrideSecondaryColor,overrideTheme:e===null||e===void 0?void 0:e.overrideTheme,paypalEnabled:e===null||e===void 0?void 0:e.paypalEnabled});i=JSON.stringify(o)===JSON.stringify(le.stripeElementsOptions);if(!le.stripeElements||!le.stripeElementsForBillingAddress){
184
+ // init stripe elements for billing address
185
+ le.stripeElementsForBillingAddress=(r=le.stripe)===null||r===void 0?void 0:r.elements(o);d("Stripe elements for billing address initialized");
186
+ // init stripe elements if it doesn't exist
187
+ le.stripeElements=(n=le.stripe)===null||n===void 0?void 0:n.elements(o);
188
+ // save stripe elements options for later comparison
189
+ le.stripeElementsOptions=o;d("Stripe elements initialized");return[2/*return*/]}if(!i){
190
+ // update elements with new option if it already exists
191
+ le.stripeElements.update(o);
192
+ // update elements for stripe billing address
193
+ le.stripeElementsForBillingAddress.update(o);
194
+ // save stripe elements options for later comparison
195
+ le.stripeElementsOptions=o;void le.stripeElements.fetchUpdates()}d("Stripe elements updated");return[2/*return*/]}))}))}));var he=e("H",(function(){
196
+ // clean clientSecret so that we can start the new one.
197
+ sessionStorage.removeItem("zonos--client-secret");
198
+ // cleanup stripe elements
199
+ de();
200
+ // set stripe back to window.Zonos.stripe
201
+ le.stripe=window.Zonos.stripe}));var we=function(){var e,r,n,t;var o=JSON.stringify((e=le.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=le.stripeAddressEventData)===null||r===void 0?void 0:r.value);var i=!le.stripeShippingSameAsBilling&&JSON.stringify((n=le.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=le.stripeBillingAddressUsedWhenValidatingAddress)===null||t===void 0?void 0:t.value);return o||i};var ye=function(){var e,r,n,t,o,i,a,s;
202
+ /**
203
+ * If user updates the address after prefetching the landed cost, should always create and attach
204
+ * @caveat this will cause the scenario goes wrong after prefetching landed cost, with the current logic, it won't create party because nothing change after the prefetch happened
205
+ */var u=(e=Xe.partiesData.find((function(e){return e.type==="DESTINATION"})))===null||e===void 0?void 0:e.id;var d=(r=Xe.partiesData.find((function(e){return e.type==="PAYOR"})))===null||r===void 0?void 0:r.id;
206
+ // If haven't prefetched landed cost, there is no need to update address async
207
+ if(!u||!d){return false}
208
+ // If we don't have landed cost parties data, should way
209
+ if(le.partyShippingId!==u||le.partyBillingId!==d){return true}var l=JSON.stringify((n=le.stripeLinkUsedWhenFetchingLC)===null||n===void 0?void 0:n.value)!==JSON.stringify((t=le.stripeLinkEventData)===null||t===void 0?void 0:t.value);var c=JSON.stringify((o=le.stripeAddressUsedWhenAsyncAddressUpdate)===null||o===void 0?void 0:o.value)!==JSON.stringify((i=le.stripeAddressEventData)===null||i===void 0?void 0:i.value);var v=!le.stripeShippingSameAsBilling&&JSON.stringify((a=le.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||a===void 0?void 0:a.value)!==JSON.stringify((s=le.stripeBillingAddressEventData)===null||s===void 0?void 0:s.value);var f=le.taxIdUsedWhenAsyncAddressUpdate!==le.taxId;var p=le.companyNameUsedWhenAsyncAddressUpdate!==le.companyName;return l||c||v||f||p};var ge=e("a0",(function(e){var r=e.address,n=e.firstName,o=e.lastName,i=e.name,a=e.phone;var s=W({firstName:n,lastName:o,name:i}),u=s.firstName,d=s.lastName;if(!u||!d){void h({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,firstName:n,lastName:o,name:i}})}if(!a){void h({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,phone:a}})}return{city:r.city,country:r.country,firstName:u,lastName:d,line1:r.line1,line2:r.line2,phone:a||"",postal_code:r.postal_code,state:r.state}}));var be=e("X",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:if(!((e=le.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!le.stripeShippingSameAsBilling&&!((r=le.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete)||!le.stripeBillingAddressEventData){return[2/*return*/,{partiesCreated:false}]}
210
+ // If there is no landed cost data, no need to create parties
211
+ if(!Xe.landedCostData){return[2/*return*/,{partiesCreated:false}]}i=(n=Xe.landedCostData.find(Boolean))===null||n===void 0?void 0:n.landedCost.rootId;if(!i){
212
+ // do nothing if we don't have selected landed cost
213
+ void h({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId}});return[2/*return*/,{partiesCreated:false}]}a=ye();if(!a){return[2/*return*/,{partiesCreated:false}]}s=ge({address:le.stripeAddressEventData.value.address,firstName:le.stripeAddressEventData.value.firstName,lastName:le.stripeAddressEventData.value.lastName,name:le.stripeAddressEventData.value.name,phone:le.stripeAddressEventData.value.phone});u=le.stripeShippingSameAsBilling?s:ge({address:le.stripeBillingAddressEventData.value.address,firstName:le.stripeBillingAddressEventData.value.firstName,lastName:le.stripeBillingAddressEventData.value.lastName,name:le.stripeBillingAddressEventData.value.name,phone:le.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4/*yield*/,c("/api/zonos-elements/create-parties",{body:{address:s,billingAddress:u,companyName:le.companyName,email:((o=le.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:i,shortAddressCode:le.shortAddressCode,taxId:le.taxId},method:"POST"})];case 1:f=w.sent(),p=f.errors,m=f.json;if(p.length||!m){v("Error occurs when creating parties",JSON.stringify(p,null,2));void h({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,errors:p,json:m}});return[2/*return*/,{partiesCreated:false}]}le.companyNameUsedWhenAsyncAddressUpdate=le.companyName;le.stripeAddressUsedWhenAsyncAddressUpdate=le.stripeAddressEventData;le.stripeBillingAddressUsedWhenAsyncAddressUpdate=le.stripeBillingAddressEventData;le.taxIdUsedWhenAsyncAddressUpdate=le.taxId;le.partyBillingId=m.billToPartyId;le.partyShippingId=m.shipToPartyId;
214
+ // Update parties data with the new parties id
215
+ Xe.partiesData=Xe.partiesData.map((function(e){if(e.type==="DESTINATION"&&e.id!==m.shipToPartyId){return Object.assign(Object.assign({},e),{id:m.shipToPartyId})}if(e.type==="PAYOR"&&e.id!==m.billToPartyId){return Object.assign(Object.assign({},e),{id:m.billToPartyId})}return e}));return[2/*return*/,{partiesCreated:true}]}}))}))}));
216
+ /**
217
+ * Extract only the necessary address info for landed cost prefetch
218
+ */var _e=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var Se=function(){var e,r;var n=JSON.stringify((e=le.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((r=le.stripeLinkEventData)===null||r===void 0?void 0:r.value);var t=le.stripeAddressEventData&&JSON.stringify(_e(le.stripeAddressEventData.value))!==JSON.stringify(le.stripeAddressUsedWhenFetchingLC);var o=!le.stripeShippingSameAsBilling&&le.stripeBillingAddressEventData&&JSON.stringify(_e(le.stripeBillingAddressEventData.value))!==JSON.stringify(le.stripeBillingAddressUsedWhenFetchingLC);return n||t||o};
219
+ /**
220
+ * Check if the address and email info used when fetching landed cost with the current email and address info are different
221
+ * Purpose is to resend the request if the info used when fetching landed cost is different from the current info
222
+ */var Oe=function(){var e;
223
+ // Mark the landed cost is outdated since the item total amount has changed (items total didn't match with the cart subtotal)
224
+ var r=Xe.landedCostData&&((e=Xe.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==Xe.subtotal;var n=Se();d("isPrefetchInfoOutdated","info",{isAddressOutdated:n});
225
+ // if landed cost data is not available, we need to fetch it
226
+ return!Xe.landedCostData&&!le.isFetchingLandedCost||n||r};var Ae=e("W",(function(e){var r,t;var o=(r=n.genericSettings)===null||r===void 0?void 0:r.countryFields;var i=(t=n.genericSettings)===null||t===void 0?void 0:t.stripeCountryFieldLabels;var a=i&&e in i?i[e]:null;var s=o&&e in o?o[e]:null;
227
+ /**
228
+ * If the address form is using Stripe component, use Stripe country field label if there is one, if not just use one from our countryFieldLabel data
229
+ * stripeCountryFieldLabels is the list we collect from Stripe, and extract only country that state/zip is required and different from what we have in our countryFieldLabel data
230
+ **/if(Xe.addressFormRenderType==="stripe"){return a||s}return s}));var Ce=function(){var e,r,n,t;var o=!!((e=le.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((r=le.stripeAddressEventData)===null||r===void 0?void 0:r.complete);var a=le.stripeShippingSameAsBilling?i:!!((n=le.stripeBillingAddressEventData)===null||n===void 0?void 0:n.complete);var s=((t=le.stripeAddressEventData)===null||t===void 0?void 0:t.value.address.country)||"US";var u=Ae(s);if(i&&a&&o){return true}
231
+ // Only send landed cost request if the address is complete when we can't get the country field
232
+ if(!u||!le.stripeAddressEventData){return i&&a&&o}var d=le.stripeAddressEventData.value.address.line1.length>0;var l=le.stripeAddressEventData.value.firstName&&le.stripeAddressEventData.value.lastName;var c=!u.stateRequired||u.stateRequired&&le.stripeAddressEventData.value.address.state.length>0;var v=!u.zipRequired||u.zipRequired&&le.stripeAddressEventData.value.address.postal_code.length>=3;var f=le.stripeAddressEventData.value.phone&&le.stripeAddressEventData.value.phone.length>0;return o&&l&&d&&c&&v&&f};var ke=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,a,s,u,d,l,c;return __generator(this,(function(v){switch(v.label){case 0:r=new AbortController;le.fetchingLandedCostAbortController=r;
233
+ // Reset cart items to non-restricted state and restricted item list
234
+ pr();return[4/*yield*/,Z(r)];case 1:n=v.sent(),o=n.checkoutSessionWorkflow,i=n.errors,a=n.itemCreateWorkflow,s=n.landedCostCalculateWorkflow,u=n.partyCreateWorkflow,d=n.shipmentRatingCalculateWorkflow;
235
+ // Surface a custom "no quote" message when either a rule (ruleMessageType CUSTOM) or a country
236
+ // constraint (source COUNTRY_CONSTRAINT) blocked shipment rating with an authored message.
237
+ Xe.customQuotingError=((e=i===null||i===void 0?void 0:i.find((function(e){var r,n;return((r=e.extensions)===null||r===void 0?void 0:r.ruleMessageType)==="CUSTOM"||((n=e.extensions)===null||n===void 0?void 0:n.source)==="COUNTRY_CONSTRAINT"})))===null||e===void 0?void 0:e.message)||null;Xe.shippingData=ne((d===null||d===void 0?void 0:d.filter(Boolean))||[]);
238
+ // check and update cart items with restrictions
239
+ er(a);
240
+ // reset abort controller after we are done
241
+ le.fetchingLandedCostAbortController=null;Xe.partiesData=(u===null||u===void 0?void 0:u.filter(Boolean))||[];
242
+ // update cart store with landed cost info
243
+ Xe.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var r=s===null||s===void 0?void 0:s.find((function(r){return(r===null||r===void 0?void 0:r.id)===e.landedCostId}));if(!r){return null}return Object.assign(Object.assign({},e),{landedCost:r})})).filter(Boolean))||[];l=t.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void $({checkoutSessionId:l,eventName:"checkout_quoteReceived"})}c=Xe.promoCodeApplied&&!Xe.landedCostData.find((function(e){var r;return(r=e.landedCost.appliedAdjustments)===null||r===void 0?void 0:r.find((function(e){return e.type==="PROMO_CODE"}))}));Xe.promoCodeError=c;
244
+ // When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
245
+ if(!c){sessionStorage.setItem("zonos--promo-code",Xe.promoCode)}return[2/*return*/]}}))}))};var Ie=e("w",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,t,o,i,a,s,u,d,l,c,f,p,m;return __generator(this,(function(w){switch(w.label){case 0:i=(e===null||e===void 0?void 0:e.retries)||0;a=!!(e===null||e===void 0?void 0:e.applyingPromocode);s=Oe();u=Ce();
246
+ // Should not do anything if the address is not ready to request landed cost
247
+ if(!u){return[2/*return*/,{isRequestNotReady:true}]}if(s){
248
+ // if the info used when fetching landed cost is different from the current info, abort the previous request
249
+ (r=le.fetchingLandedCostAbortController)===null||r===void 0?void 0:r.abort();le.fetchingLandedCostAbortController=null}
250
+ // Do not fetch if we are not ready or data is not outdated
251
+ if(!s&&!a){return[2/*return*/,{isRequestNotReady:false}]}
252
+ // If there is retries, stop loading for a moment and then showing the spinner again (this is just so customer can see that checkout is doing something and not stuck)
253
+ if(i){le.isFetchingLandedCost=false;setTimeout((function(){le.isFetchingLandedCost=true}),300)}else{le.isFetchingLandedCost=true}if(le.stripeAddressEventData){le.stripeAddressUsedWhenFetchingLC={countryCode:le.stripeAddressEventData.value.address.country,postalCode:le.stripeAddressEventData.value.address.postal_code,state:le.stripeAddressEventData.value.address.state}}if(le.stripeBillingAddressEventData){le.stripeBillingAddressUsedWhenFetchingLC={countryCode:le.stripeBillingAddressEventData.value.address.country,postalCode:le.stripeBillingAddressEventData.value.address.postal_code,state:le.stripeBillingAddressEventData.value.address.state}}if(le.stripeLinkEventData){le.stripeLinkUsedWhenFetchingLC=Object.assign({},le.stripeLinkEventData)}w.label=1;case 1:w.trys.push([1,3,,7]);
254
+ // Reset cart items to non-restricted state and restricted item list
255
+ pr();
256
+ // fetch and apply landed cost
257
+ return[4/*yield*/,ke()];case 2:
258
+ // fetch and apply landed cost
259
+ w.sent();d=(n=Xe.shippingData)===null||n===void 0?void 0:n.find(Boolean);l=(t=Xe.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.shipmentRating.id===(d===null||d===void 0?void 0:d.id)}));c=!!l?l.subtotals:null;if(c){
260
+ // prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
261
+ or({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:c})}return[3/*break*/,7];case 3:f=w.sent();
262
+ // default to empty array if we failed to fetch landed cost, so we can show the error message
263
+ Xe.landedCostData=[];Xe.shippingData=[];p=["The landed cost calculation request was aborted to initiate a new one."];if(!(f instanceof Error&&f.message&&!p.includes(f.message)))return[3/*break*/,6];if(!(i<1))return[3/*break*/,5];
264
+ // retry fetching landed cost one more time
265
+ return[4/*yield*/,Ie(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:
266
+ // retry fetching landed cost one more time
267
+ w.sent();return[2/*return*/,{isRequestNotReady:false}];case 5:m=(o=le.stripeAddressEventData)===null||o===void 0?void 0:o.value;void h({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[f.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:m}});w.label=6;case 6:v(f);return[3/*break*/,7];case 7:le.isFetchingLandedCost=false;return[2/*return*/,{isRequestNotReady:false}]}}))}))}));var Te=e("N",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t;return __generator(this,(function(o){switch(o.label){case 0:return[4/*yield*/,Ie({applyingPromocode:true})];case 1:o.sent();
268
+ // Go back to shipping step if we are in payment step so user can reselect shipping method
269
+ if(Xe.step==="payment"){wr()}
270
+ // async update address with new root id from the new quote
271
+ return[4/*yield*/,be()];case 2:
272
+ // async update address with new root id from the new quote
273
+ o.sent();n=(e=Xe.shippingData)===null||e===void 0?void 0:e.find(Boolean);t=(r=Xe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCost.id===(n===null||n===void 0?void 0:n.id)}));if(!n||!t){return[2/*return*/]}return[4/*yield*/,lr({applySubtotalsOnly:false,landedCostId:t.landedCostId,selectedShippingOption:n})];case 3:o.sent();return[2/*return*/]}}))}))}));var Ee=e("P",(function(){Xe.promoCode="";sessionStorage.removeItem("zonos--promo-code");
274
+ // reset promocode error state
275
+ Xe.promoCodeError=false;Xe.promoCodeApplied=false}));var Pe=e("O",(function(){return __awaiter(_,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:
276
+ // Go back to shipping step if we are in payment step so user can reselect shipping method
277
+ if(Xe.step==="payment"){wr()}Ee();return[4/*yield*/,Te()];case 1:e.sent();return[2/*return*/]}}))}))}));var Ne=e("Q",(function(e){var r=[];var n=true;var t=window.Zonos.isCollect;var i=window.Zonos.isInvoice;
278
+ // Inspect the PaymentIntent `status` to indicate the status of the payment
279
+ // to your customer.
280
+
281
+ // Some payment methods will [immediately succeed or fail][0] upon
282
+ // confirmation, while others will first enter a `processing` state.
283
+
284
+ // [0]: https://stripe.com/docs/payments/payment-methods#payment-notification
285
+ switch(e){case"succeeded":{r=[o("Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us."),"",o("We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time.")];if(t||i){r=[o("Thank you for submitting your payment. We appreciate your prompt attention."),"",o("A confirmation email with your payment details has been sent for your records. If you have any questions or need support, our team is here to help.")]}n=false;break}case"requires_capture":case"processing":{r=[o("Payment processing. We'll update you when payment is received.")];n=false;break}case"requires_payment_method":{r=[o("Payment failed. Please try another payment method.")];if(t){r=[o("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{n=false;r=[o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{r=[o("Something went wrong.")];break}}return{isError:n,messages:r}}));
286
+ /**
287
+ * Handle inventory check and returns error message if the callback provided.
288
+ */var je=e("n",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,t,i,a,s,u,d,l,d;return __generator(this,(function(p){switch(p.label){case 0:t=n.checkoutSettings.onInventoryCheck;i=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&i))return[3/*break*/,2];return[4/*yield*/,c("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:a=p.sent(),s=a.errors,u=a.json;if(s.length||!u){v("Error occurs when handling inventory refund","warn",JSON.stringify(s));return[2/*return*/,null]}
289
+ // Proceed if the item is available
290
+ if(!u.available||u.status===204){return[2/*return*/,o("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(u.available||u.status===200){le.shouldInventoryRefund=true;return[2/*return*/,null]}return[2/*return*/,null];case 2:if(typeof t!=="function"){return[2/*return*/,null]}p.label=3;case 3:p.trys.push([3,5,,6]);return[4/*yield*/,t({items:Xe.items},{translate:o,zonosApiRoute:f["vercel"]})];case 4:d=p.sent();return[2/*return*/,d];case 5:l=p.sent();d=l instanceof Error?l.message:"Unknown error";void h({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(d)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:Xe.items}});throw l;case 6:return[2/*return*/]}}))}))}));
291
+ /**
292
+ * Handle inventory check and returns error message if the callback provided.
293
+ */var De=e("F",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(t){switch(t.label){case 0:n=!!((r=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||r===void 0?void 0:r.value);
294
+ // inventory refund is only available for legacy checkout and store has referenceId in metadata
295
+ if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!n){return[2/*return*/]}
296
+ // handle inventory check on legacy checkout
297
+ return[4/*yield*/,c("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:
298
+ // handle inventory check on legacy checkout
299
+ t.sent();return[2/*return*/]}}))}))}));var Le=e("c",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,i,a,s,u,d,l;var c=e.clientSecret,f=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(f){r=Ne(f),n=r.isError,t=r.messages;return[2/*return*/,{error:n,messages:t}]}i=c||le.clientSecret;if(!le.stripe||!i){v("Failed to retrieve payment intent. Stripe is not initialized");return[2/*return*/,{error:true,message:[o("Something went wrong.")]}]}
300
+ // A client secret that isn't a Stripe payment intent secret (e.g. an Airwallex
301
+ // secret) can't be evaluated by Stripe. Do not treat it as a successful Stripe
302
+ // payment — return an error so callers don't run success analytics / order
303
+ // polling off a secret Stripe never confirmed.
304
+ if(!i.includes("_secret_")){return[2/*return*/,{error:true,messages:[o("Something went wrong.")]}]}return[4/*yield*/,le.stripe.retrievePaymentIntent(i)];case 1:a=e.sent().paymentIntent;s=a===null||a===void 0?void 0:a.status;u=Ne(s),d=u.isError,l=u.messages;return[2/*return*/,{amount:a===null||a===void 0?void 0:a.amount,currency:a===null||a===void 0?void 0:a.currency,error:d,messages:l,paymentIntentId:a===null||a===void 0?void 0:a.id,paymentMethod:a===null||a===void 0?void 0:a.payment_method,status:s}]}}))}))}));var Re=e("E",(function(e){return __awaiter(_,void 0,void 0,(function(){var r,n,i,a,s,u,l,c,v,f,p,m;return __generator(this,(function(h){switch(h.label){case 0:i=!!((r=le.stripePaymentEventData)===null||r===void 0?void 0:r.complete);a=le.stripeElements;s=le.stripe;u=le.clientSecret;le.customErrorMessage=null;if(!((n=Xe.selectedLandedCost)===null||n===void 0?void 0:n.landedCost.id)&&!(e===null||e===void 0?void 0:e.noLandedCostCheck)){throw new Error("Attempted to confirm the payment when no landed cost is found in store")}return[4/*yield*/,te()];case 1:l=h.sent();if(!l.valid){le.customErrorMessage=l.errorMessage;throw new Error(l.errorMessage)}c=t.checkoutSessionId;if(!(s&&a&&i&&u&&c))return[3/*break*/,3];v=new URL(window.location.href);v.searchParams.set("payment_intent_client_secret",u);v.searchParams.set("zonosCheckoutSessionId",c);void $({checkoutSessionId:c,eventName:"checkout_paymentInfoCompleted"});return[4/*yield*/,s.confirmPayment({confirmParams:{return_url:v.toString()},elements:a,redirect:"if_required"})];case 2:f=h.sent(),p=f.error,m=f.paymentIntent;d("Payment intent confirmed","info",{error:p,paymentIntent:m});if((m===null||m===void 0?void 0:m.status)==="requires_action"){throw new Error(o("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(p){if(p.type==="card_error"||p.type==="validation_error"){throw new Error(p.message)}if(p.type==="invalid_request_error"){if(p.code==="payment_intent_unexpected_state"){
305
+ // PaymentIntent was canceled or expired, or status is `require_capture`.
306
+ // don't throw error here because we will reset the checkout session last step
307
+ return[2/*return*/]}}throw new Error("An unexpected error occurred.")}if(m.status==="requires_payment_method"){
308
+ // Failed to confirm payment, allows user to try another payment method
309
+ throw new Error(o("Payment failed. Please try another payment method."))}h.label=3;case 3:return[2/*return*/]}}))}))}));
310
+ /**
311
+ * Builds the single `merchantPolicyConsent` metadata entry that records the buyer's
312
+ * acceptance of the merchant policies (Terms and Conditions, Privacy Policy, etc.).
313
+ * Returns null when consent has not been accepted or when no policies are configured.
314
+ *
315
+ * The recorded value captures which policies were shown, the URLs the buyer
316
+ * agreed to, the active locale, and the snapshotted acceptance timestamp.
317
+ */var xe=function(){if(!J.accepted){return null}var e=M();if(!e.length){return null}return{key:"merchantPolicyConsent",value:JSON.stringify({
318
+ // Use the timestamp snapshotted when the buyer first accepted, so any
319
+ // later session-metadata update keeps the original moment of consent
320
+ // for audit purposes. Fall back to "now" as a safety net for the
321
+ // unlikely case the store value was cleared between accept and write.
322
+ acceptedAt:J.acceptedAt||(new Date).toISOString(),locale:a.selectedLocale,policies:e.reduce((function(e,r){e[r.key]=r.url;return e}),{})})}};
323
+ /**
324
+ * Allow overriding the checkout session payment processor via a `paymentProcessor`
325
+ * URL query param (e.g. `?paymentProcessor=AIRWALLEX`). The processor is normally
326
+ * determined server-side by the billing company; this override is primarily used
327
+ * for testing. Returns `undefined` when the param is missing or not a valid
328
+ * processor.
329
+ */var Ue=function(){var e=new URLSearchParams(window.location.search).get("paymentProcessor");var r=function(e){return Object.values(ae).some((function(r){return r===e}))};return e&&r(e)?e:undefined};var ze=e("q",(function(){var e;var r=Xe.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);var n=t.enabledVariantTestKeys||[];var o={adjustmentsAmount:Xe.adjustments.reduce((function(e,r){return e+r.amount}),0),cartId:window.Zonos.cartId,currency:((e=Xe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:Xe.customerAuthenticationToken||undefined,isCollect:!!window.Zonos.isCollect,isInvoice:!!window.Zonos.isInvoice,itemsAmount:r,metadata:[{key:"language",value:a.selectedLocale}],paymentProcessor:Ue(),presentmentCountryCode:a.selectedCountryCode,skipPaymentIntent:le.skipPaymentIntent,varianceTestInput:n};return o}));var Be=e("l",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,i,a;return __generator(this,(function(s){switch(s.label){case 0:if(!t.checkoutSessionId){
330
+ // We want to log the error anytime we fail to create a checkout session
331
+ void h({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:l,cartId:window.Zonos.cartId}});tr({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2/*return*/]}return[4/*yield*/,c("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:t.checkoutSessionId},method:"POST"})];case 1:r=s.sent(),n=r.errors,i=r.json;a=(e=i===null||i===void 0?void 0:i.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(n.length||!a){v("Error occurs when getting payment intent",JSON.stringify(n,null,2));
332
+ // We want to log the error anytime we fail to create a payment intent
333
+ void h({endpoint:"Error creating payment intent",errors:n.map((function(e){return e.message})),metadata:{allLogs:l,cartId:window.Zonos.cartId,checkoutSessionId:t.checkoutSessionId,clientSecret:a}});tr({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2/*return*/]}
334
+ // update cart store checkout session with updated from checkout session payment intent creation call so the checkout session and payment intent are in sync
335
+ sr(i.checkoutSessionPaymentIntentCreate);return[2/*return*/]}}))}))}));
336
+ /**
337
+ * Init checkout session
338
+ * @returns {boolean} whether or not the checkout session is successfully created
339
+ */var Fe=e("k",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,t,o,i,s,u;return __generator(this,(function(l){switch(l.label){case 0:if(!a.targetCurrency){v("Failed to create checkout session - missing localizationStore.targetCurrency");return[2/*return*/,false]}le.isFetchingSession=true;n=ze();d("Checkout session body","info",n);return[4/*yield*/,c("/api/zonos-elements/create-checkout-session",{body:n,method:"POST"})];case 1:t=l.sent(),o=t.errors,i=t.json;le.isFetchingSession=false;if(o.length||!i){s=(e=o.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;
340
+ // check if the error is related to expired cart and thow error so we can show error message accordingly
341
+ if(Array.isArray(s)&&s.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}v("Error occurred when creating checkout session",JSON.stringify(o,null,2));return[2/*return*/,false]}u=i.checkoutSessionCreate;
342
+ // update cart store with updated information
343
+ sr(u);or({method:((r=u.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.subtotals});d("Exchange rate updated for cart items (checkout session create)","info",Xe.exchangeRate);d("done-init-checkout-session");return[2/*return*/,true]}}))}))}));var Je=e("z",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=t.checkoutSessionId;
344
+ // Checkout session id should be available at this point
345
+ if(!e){v("Failed to update checkout session base currency");return[2/*return*/,false]}
346
+ // Only update checkout session currency if setting is enabled
347
+ if(n.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){d('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2/*return*/,true]}return[4/*yield*/,c("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:le.checkoutSettlementCurrency},method:"POST"})];case 1:r=i.sent().json;o=r===null||r===void 0?void 0:r.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;
348
+ // S
349
+ if(!r||o!==le.checkoutSettlementCurrency){v("Failed to update checkout session base currency");return[2/*return*/,false]}d('Updated checkout session to settlement currency "'.concat(o,'".'));return[2/*return*/,true]}}))}))}));
350
+ /**
351
+ * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
352
+ */var Me=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,o,i;var s=e.adjustmentsAmount,u=e.cartId,d=e.currency,l=e.id,f=e.itemsAmount,p=e.landedCostId,m=e.presentmentCountryCode,h=e.storeCreditApplication;return __generator(this,(function(e){switch(e.label){case 0:r=t.enabledVariantTestKeys||[];return[4/*yield*/,c("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:s,billToPartyId:le.partyBillingId,cartId:u,currency:d,customerAuthenticationToken:Xe.customerAuthenticationToken||undefined,id:l,itemsAmount:f,landedCostId:p,metadata:[{key:"language",value:a.selectedLocale}],presentmentCountryCode:m,shipToPartyId:le.partyShippingId,skipPaymentIntent:le.skipPaymentIntent,storeCreditApplication:h,varianceTestInput:r},method:"POST"})];case 1:n=e.sent(),o=n.errors,i=n.json;if(o.length||!i){v("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2/*return*/,{errors:o,json:i}]}return[2/*return*/,{errors:[],json:i}]}}))}))};
353
+ /**
354
+ * Pushes the buyer's policy consent into the checkout session's metadata via the
355
+ * dedicated metadata-only mutation. Called from the payment continue handler so
356
+ * consent is persisted to the session before Stripe's confirmPayment fires.
357
+ *
358
+ * Uses `checkoutSessionUpdateMetadata` — not the full `checkoutSessionUpdate` —
359
+ * because this fires at the end of the payment phase, when we don't want to
360
+ * touch landed-cost / cart / party state. No-op when no policies are configured,
361
+ * when consent hasn't been accepted, or when there is no active session ID.
362
+ */var qe=e("T",(function(){return __awaiter(_,void 0,void 0,(function(){var e,r;return __generator(this,(function(n){switch(n.label){case 0:e=xe();if(!e){return[2/*return*/,{errors:[]}]}if(!t.checkoutSessionId){return[2/*return*/,{errors:[]}]}return[4/*yield*/,c("/api/zonos-elements/update-checkout-session-metadata",{body:{id:t.checkoutSessionId,metadata:[e]},method:"POST"})];case 1:r=n.sent().errors;if(r.length){
363
+ // Surface failures loudly so we have observability on consent records that
364
+ // didn't persist — callers don't block payment, but the failure is logged.
365
+ v("Failed to record merchant policy consent on checkout session",JSON.stringify(r,null,2));return[2/*return*/,{errors:r.map((function(e){return e.message||"Unknown error"}))}]}return[2/*return*/,{errors:[]}]}}))}))}));
366
+ /**
367
+ * This function builds a translated address object from the current address and the translated address result.
368
+ * It checks each field in the current address and if it exists in the translated address result, it adds it to the translated address object.
369
+ * The key of each field in the translated address object is the current address's field value and the value is the corresponding translated address's field value.
370
+ *
371
+ * @param {Object} params - The parameters for the function.
372
+ * @param {Address} params.currentAddress - The current address information.
373
+ * @param {Address} params.translatedAddressResult - The translated address result.
374
+ *
375
+ * @returns {TranslatedAddress} - An object containing the translated address. Each field is an object with the current address's field value as the key and the translated address's field value as the value.
376
+ */var We=function(e){var r,n,t,o,i,a;var s=e.currentAddress,u=e.translatedAddressResult;var d={};if(!u){return d}var l=u.city,c=u.line1,v=u.line2,f=u.name,p=u.postal_code,m=u.state;
377
+ // If we have translated address, add it to the translated address object
378
+ if(s.city&&l){d.city=(r={},r[s.city]=l,r)}if(s.line1&&c){d.line1=(n={},n[s.line1]=c,n)}if(s.line2&&v){d.line2=(t={},t[s.line2]=v,t)}if(s.postal_code&&p){d.postal_code=(o={},o[s.postal_code]=p,o)}if(s.state&&m){d.state=(i={},i[s.state]=m,i)}if(s.name&&f){d.name=(a={},a[s.name]=f,a)}return d};
379
+ /**
380
+ * This function translates an address to Latin characters using the Zonos API.
381
+ * It first builds the request body for the API call. If there's no request body, it resets the translated address in the store and returns.
382
+ * If the address is not outdated, it returns without making the API call.
383
+ * It then makes a POST request to the Zonos API to validate and translate the address. If the API call fails, it resets the translated address in the store and returns.
384
+ * If the API call is successful, it sets the current address and billing address in the store and builds the translated address and billing address from the API response.
385
+ *
386
+ * @param {Object} params - The parameters for the function.
387
+ * @param {ReturnType<typeof containsNonLatinChars> | null} params.addressInvalidCharactersList - The list of address fields that contain invalid characters.
388
+ * @param {ReturnType<typeof containsNonLatinChars> | null} params.billingAddressInvalidCharactersList - The list of billing address fields that contain invalid characters.
389
+ */var Ye=e("V",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o,i,a,s,u,d,l,f;var p=e.addressInvalidCharactersList,m=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=re({addressInvalidCharactersList:p,billingAddressInvalidCharactersList:m,stripeAddressEventData:le.stripeAddressEventData,stripeBillingAddressEventData:le.stripeBillingAddressEventData,stripeShippingSameAsBilling:le.stripeShippingSameAsBilling});if(!i){
390
+ // reset translated address if we don't have any address to translate
391
+ le.translatedAddress={address:{},billingAddress:{}};return[2/*return*/]}a=we();if(!a){return[2/*return*/]}return[4/*yield*/,c("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),u=s.errors,d=s.json;if(u.length||!d){v("Error occurs when translating address to latin",JSON.stringify(u,null,2));
392
+ // reset translated address if we Failed to translate and let user manually fix it
393
+ le.translatedAddress={address:{},billingAddress:{}};return[2/*return*/]}
394
+ // Set current address to the store so we can compare it later to determine if we need to re-translate the address
395
+ le.stripeAddressUsedWhenValidatingAddress=le.stripeAddressEventData;le.stripeBillingAddressUsedWhenValidatingAddress=le.stripeBillingAddressEventData;l=(r=le.stripeAddressEventData)===null||r===void 0?void 0:r.value.address;f=(n=le.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.address;
396
+ // Set the translated address to the store so we can populate it to the address element for user to update
397
+ le.translatedAddress={address:l?We({currentAddress:Object.assign(Object.assign({},l),{name:(t=le.stripeAddressEventData)===null||t===void 0?void 0:t.value.name}),translatedAddressResult:d.address||null}):{},billingAddress:!le.stripeShippingSameAsBilling?We({currentAddress:Object.assign(Object.assign({},f),{name:(o=le.stripeBillingAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:d.billingAddress||null}):{}};return[2/*return*/]}}))}))}));ue("clientSecret",(function(e){
398
+ // update stripe elements when client secret changes
399
+ if(e&&le.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));
400
+ /**
401
+ * EU 3-EUR cutover (05CHECK-893): when shipping to an EU country with a POSTAL
402
+ * service level whose DAP landed cost has remittance available, we keep treating
403
+ * the quote as DAP (duties paid upon delivery) instead of converting it to DDP.
404
+ * The cart subtotals then show taxes and fees as collected while duties are
405
+ * estimated and paid on delivery.
406
+ *
407
+ * @see [[cartStoreGetMethod]] for the DAP/DDP conversion this guards.
408
+ */var He=e("M",(function(e){var r=e.deliveryType,n=e.landedCost,t=e.shipToCountry;return n.method==="DAP"&&r==="POSTAL"&&n.remittance.length>0&&!!t&&b.includes(t)}));var Ke=r((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customMessage:[],customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:m(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",
409
+ // When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
410
+ promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",storeCredit:0,subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},
411
+ // eslint-disable-next-line sort-keys/sort-keys-fix
412
+ payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),Ve=Ke.onChange,Ge=Ke.reset,Xe=Ke.state;e({I:Ve,d:Xe});var Qe=function(e){switch(e){case"DAYS":return o("days");case"WEEKS":return o("weeks");case"BUSINESS_DAYS":default:return o("business days")}};
413
+ /**
414
+ * Format shipping transit info to be displayed on UI
415
+ * @returns
416
+ * - expectedDate: Thursday, Aug 12
417
+ * - maxTransit: 5
418
+ * - minTransit: 3
419
+ */var Ze=e("Z",(function(e){var r;var n=(r=e.shippingProfile)===null||r===void 0?void 0:r.transitTime;
420
+ // Don't care about falsy 0 values because this is international shipping and 0 days is not feasible
421
+ if(!(n===null||n===void 0?void 0:n.min)||!(n===null||n===void 0?void 0:n.max)||!(n===null||n===void 0?void 0:n.type)){return null}return{maxTransit:n.max,minTransit:n.min,unit:Qe(n.type)}}));var $e=function(e){var r=e.item1,n=e.item2;if(!r||!n){return false}return n.sku&&r.sku&&r.sku===n.sku||n.description&&r.description&&r.description===n.description||r.name&&n.name&&r.name===n.name};
422
+ /**
423
+ * Check and set restricted items in cart
424
+ */var er=function(e){d("Checking item restrictions");var r=e.map((function(e){if(!e.restriction){return null}var r=e.restriction;var n=Xe.items.find((function(r){return $e({item1:r,item2:e})}));return Object.assign(Object.assign({matchedItem:n},e),{restriction:r})})).filter(Boolean);Xe.restrictedItems=r;
425
+ // remove items that are restricted from cart
426
+ Xe.items=Xe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!r.find((function(r){return $e({item1:r,item2:e})}))})}));return{cartItems:Xe.items,restrictedItems:r}};var rr=null;var nr=e("f",(function(){t.checkoutSessionId=null;
427
+ // clear pending store credit debounce timer
428
+ if(rr){clearTimeout(rr);rr=null}
429
+ // reset store credit store
430
+ k();
431
+ // reset cart store
432
+ Ge()}));var tr=e("r",(function(e){var r=e.messages,n=e.title;nr();he();Xe.step="error";Xe.error={messages:r,title:n}}));var or=function(e){var r=e.dutiesTaxesFeesEstimate,n=e.method,t=e.subtotals;var o;
433
+ // update exchange rate so we can use it to display cart items
434
+ Xe.exchangeRate=t.exchangeRate;Xe.adjustmentTotal=t.adjustments;Xe.dutiesTaxesFees=n==="DAP"?null:t.landedCostTotal;Xe.storeCredit=(o=t.storeCredit)!==null&&o!==void 0?o:0;Xe.subtotal=t.items;Xe.total=t.total;Xe.currency=t.presentmentCurrencyCode;Xe.dutiesTaxesFeesEstimate=r||null};
435
+ /**
436
+ * Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
437
+ */var ir=e("L",(function(){
438
+ // filter all items with positive amount
439
+ var e=Xe.items.filter((function(e){return e.amount>0}));
440
+ // only check restricted status for items with positive amount
441
+ // if there is no item restricted found => all items are restricted
442
+ return!!e.find((function(e){return!e.isRestricted}))}));
443
+ /**
444
+ * An order-modification payment-only session (skip-to-payment, no shipping
445
+ * step): a session tied to an order that hasn't completed yet, meaning the
446
+ * shopper is only paying a delta against an already-approved landed cost.
447
+ * Single source of truth for this detection — previously duplicated inline
448
+ * at each call site, which let one of them (the forceDialogOpen/preview init
449
+ * path) miss it entirely.
450
+ */var ar=e("m",(function(){var e,r;return!!(((r=(e=Xe.checkoutSession)===null||e===void 0?void 0:e.order)===null||r===void 0?void 0:r.id)&&!Xe.checkoutSession.completedAt)}));var sr=e("v",(function(e){var r,n,o,i,a,c,v;
451
+ // update stripe store with updated information
452
+ le.clientSecret=e.clientSecret;le.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;le.customerProfile=e.customerProfile;Xe.checkoutSession=e;
453
+ // Populate store credit balance from checkout session customer profile
454
+ I((n=(r=e.customerProfile)===null||r===void 0?void 0:r.storeCreditBalance)!==null&&n!==void 0?n:null);if(!e.id){
455
+ // Log error to track down the issue
456
+ void h({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:l,checkoutSession:e}})}
457
+ // Only update checkout session id if it's not empty
458
+ if(e.id){t.checkoutSessionId=e.id}
459
+ // Filter the response to only include test keys that we support and then save it to the session
460
+ var f=s(e.varianceTestResults||[]);u(f);
461
+ // Check if there is a redirect URL in the metadata to override
462
+ var p=((a=(i=(o=Xe.checkoutSession)===null||o===void 0?void 0:o.metadata)===null||i===void 0?void 0:i.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||a===void 0?void 0:a.value)||(
463
+ // Sometimes externalConfirmationPageURL is not in checkoutSession create/update, check if there is a redirect URL in the cart metadata to override
464
+ (v=(c=window.Zonos.cartData)===null||c===void 0?void 0:c.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||v===void 0?void 0:v.value)||null;if(p){d("Found externalConfirmationPageURL: ".concat(p));Xe.externalConfirmationPageURL=p}}));var ur=function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,i,s,u,l;var c=e.adjustmentsAmount,f=e.cartId,p=e.currency,m=e.dutiesTaxesFeesEstimate,h=e.itemsAmount,w=e.landedCostId,y=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(w&&Xe.selectedLandedCost){n=Xe.selectedLandedCost.subtotals;or({dutiesTaxesFeesEstimate:m,method:Xe.landedCostMethod,subtotals:n});d("Exchange rate updated for cart items (landed cost subtotal)","info",Xe.exchangeRate)}
465
+ // update checkout session
466
+ if(!t.checkoutSessionId){d("Could not update cart total without checkout session id","info");return[2/*return*/,false]}return[4/*yield*/,Me({adjustmentsAmount:c,cartId:f,currency:p,id:t.checkoutSessionId,itemsAmount:h,landedCostId:w,presentmentCountryCode:a.selectedCountryCode})];case 1:i=e.sent(),s=i.errors,u=i.json;if(!(s.length>0||!u))return[3/*break*/,4];v("Error occurs when updating checkout session.");if(!y)return[3/*break*/,3];d("Initiating checkout session on failure","info");return[4/*yield*/,Fe()];case 2:l=e.sent();d("stripeStoreInitCheckoutSession: ".concat(l));if(!l){tr({messages:[o("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:o("Error creating Checkout")});return[2/*return*/,false]}return[2/*return*/,true];case 3:return[2/*return*/,false];case 4:if(!w){
467
+ // This is when we first open the checkout modal and we just want to get info from the old cart session.
468
+ // use subtotals from checkout session to update cart total
469
+ or({method:((r=u.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:u.checkoutSessionUpdate.subtotals});d("Exchange rate updated for cart items (checkout session update)","info",Xe.exchangeRate)}sr(u.checkoutSessionUpdate);return[2/*return*/,true]}}))}))};
470
+ /**
471
+ * For some service levels, the landed cost that's DAP and we do remittance on behalf of the merchant, these landed cost should be treated as DDP
472
+ */var dr=e("_",(function(e,r){var t,o,i,a;
473
+ // If the landed cost is DAP and the country is domestic, then treat it as DDP since no duty or fee is due at the door
474
+ if(e.method==="DAP"&&((o=(t=n.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||o===void 0?void 0:o.includes(((i=le.stripeAddressEventData)===null||i===void 0?void 0:i.value.address.country)||"US"))){return"DDP"}
475
+ // EU 3-EUR cutover (05CHECK-893): keep EU POSTAL remittance quotes as DAP so
476
+ // the shopper is told duties are paid upon delivery, even though we remit.
477
+ if(He({deliveryType:r,landedCost:e,shipToCountry:(a=le.stripeAddressEventData)===null||a===void 0?void 0:a.value.address.country})){return"DAP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method}));var lr=e("Y",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,t,o,i,a,s,u,l,c,v,f,p,m,h,w,y,g,b,_,S,O,A,C,k,I,T;var E=e.applySubtotalsOnly,P=e.landedCostId,N=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:d("Updating selected shipping option","info",{landedCostId:P,selectedShippingOption:N});Xe.selectedShippingOption=N;m=Ze(Xe.selectedShippingOption);if(m){h=m.maxTransit,w=m.minTransit,y=m.unit;Xe.selectedShippingOptionTransitTime="".concat(w,"-").concat(h," ").concat(y)}else{Xe.selectedShippingOptionTransitTime=""}g=(r=Xe.landedCostData)===null||r===void 0?void 0:r.find((function(e){return e.landedCostId===P}));
478
+ // save selected landed cost for later use
479
+ Xe.selectedLandedCost=g||null;if(!g){
480
+ // do nothing if we can't find landed cost for selected shipping option
481
+ return[2/*return*/,false]}b=((t=g.landedCost.amountSubtotals)===null||t===void 0?void 0:t.landedCostTotal)||0;_=g.subtotals.exchangeRate.rate;S=b*_;if(S){d("DAP quote, using estimate: ".concat(S),"info")}Xe.landedCostMethod=dr(g.landedCost,(o=N.shippingProfile)===null||o===void 0?void 0:o.serviceLevel.deliveryType);
482
+ // update shipping value and dutiesTaxFees on selectedShippingOption change
483
+ Xe.shipping=g.subtotals.shipping;O=((i=g===null||g===void 0?void 0:g.landedCost)===null||i===void 0?void 0:i.landedCostGuaranteeCode)==="ZONOS";A=!!((s=(a=g===null||g===void 0?void 0:g.landedCost)===null||a===void 0?void 0:a.deMinimis)===null||s===void 0?void 0:s.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));Xe.isSelectedShippingAboveDeminimis=A;Xe.isSelectedShippingGuarantee=O;C=false;if(!E)return[3/*break*/,1];k=g.subtotals;or({dutiesTaxesFeesEstimate:S,method:Xe.landedCostMethod,subtotals:k});d("Exchange rate updated for cart items (landed cost subtotal)","info",Xe.exchangeRate);C=true;return[3/*break*/,3];case 1:return[4/*yield*/,ur({adjustmentsAmount:Xe.adjustmentTotal,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:S,landedCostId:(u=g.landedCost)===null||u===void 0?void 0:u.id})];case 2:
484
+ // update session with selected landed cost
485
+ C=e.sent();e.label=3;case 3:I=(l=Xe.items.find(Boolean))===null||l===void 0?void 0:l.currencyCode;T=((c=le.stripeAddressEventData)===null||c===void 0?void 0:c.value.address.country)||"US";
486
+ // Only show pay in USD button if item's currency is in USD, the setting is enabled and the order presentment currency is not USD, also only in USD settlement ship to country list
487
+ le.shouldRenderPayInUsdButton=I==="USD"&&n.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((v=Xe.checkoutSession)===null||v===void 0?void 0:v.subtotals.presentmentCurrencyCode)!=="USD"&&!!((p=(f=n.genericSettings)===null||f===void 0?void 0:f.usdSettlementCountryEnabled)===null||p===void 0?void 0:p.includes(T));return[2/*return*/,C]}}))}))}));var cr=e("o",(function(e){var r=e.isPreview,n=e.sessionTimeout;
488
+ // do nothing if in preview mode
489
+ if(r){return}var t=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var o=
490
+ // timeout query is mainly for testing purpose
491
+ t&&!isNaN(parseInt(t,10))?parseInt(t,10):n;d("==START CHECKOUT TIMEOUT - ".concat(o,"=="));Xe.checkoutTimeoutInterval=setTimeout((function(){Xe.checkoutSessionTimeoutShow=true}),o)}));var vr=e("j",(function(){if(Xe.checkoutTimeoutInterval){clearTimeout(Xe.checkoutTimeoutInterval);Xe.checkoutTimeoutInterval=null}}));var fr=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var pr=function(){
492
+ // mark all items as not restricted
493
+ Xe.items=Xe.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));Xe.restrictedItems=[]};var mr=e("e",(function(e){return __awaiter(_,[e],void 0,(function(e){var r,n,t,o;var i=e.adjustments,a=e.cartItems,s=e.landedCostId,u=e.shouldInitSessionOnFailure,d=u===void 0?true:u;return __generator(this,(function(e){switch(e.label){case 0:
494
+ // Update adjustments and items
495
+ Xe.adjustments=i;Xe.items=fr(a);n=(r=a.find(Boolean))===null||r===void 0?void 0:r.currencyCode;t=a.reduce((function(e,r){return e+r.amount*r.quantity}),0);o=i.reduce((function(e,r){return e+r.amount}),0);if(!n||!t){
496
+ // do nothing if we can't get currency or total
497
+ return[2/*return*/]}Xe.currency=n;
498
+ // set loading state here because this is the first load checkout session when we already have checkout session id stored
499
+ le.isFetchingSession=true;return[4/*yield*/,ur({adjustmentsAmount:o,cartId:window.Zonos.cartId,currency:n,dutiesTaxesFeesEstimate:0,itemsAmount:t,landedCostId:s,shouldInitSessionOnFailure:d})];case 1:e.sent();le.isFetchingSession=false;return[2/*return*/]}}))}))}));var hr=function(){Xe.selectedShippingOption=null;Xe.isSelectedShippingAboveDeminimis=false;Xe.isSelectedShippingGuarantee=false;Xe.selectedShippingOptionTransitTime="";Xe.dutiesTaxesFees=0;Xe.dutiesTaxesFeesEstimate=0;Xe.shipping=0;
500
+ // reset total to subtotal
501
+ Xe.total=Xe.subtotal};var wr=function(){if(Xe.step==="shipping"){Xe.step="customer-info";
502
+ // set shipping step to done
503
+ Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{"customer-info":Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:false})})}else if(Xe.step==="payment"){Xe.step="shipping";
504
+ // set shipping step to done
505
+ Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{shipping:Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:false})})}else if(Xe.step==="finish"){Xe.step="payment";
506
+ // set shipping step to done
507
+ Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{payment:Object.assign(Object.assign({},Xe.tabItems.payment),{isDone:false})})}};var yr=e("x",(function(){if(Xe.step==="customer-info"){Xe.step="shipping";
508
+ // set customer-info step to done
509
+ Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{"customer-info":Object.assign(Object.assign({},Xe.tabItems["customer-info"]),{isDone:true})})}else if(Xe.step==="shipping"){Xe.step="payment";
510
+ // set shipping step to done
511
+ Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{shipping:Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:true})})}else if(Xe.step==="payment"){Xe.step="finish"}}));var gr=e("h",(function(){Xe.step="customer-info";Xe.tabItems=Object.assign(Object.assign({},Xe.tabItems),{"customer-info":Object.assign(Object.assign({},Xe.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},Xe.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},Xe.tabItems.shipping),{isDone:false})});hr()}));var br=function(){return __awaiter(_,void 0,void 0,(function(){var e,r,n,o,i,s,u,l,c;return __generator(this,(function(f){switch(f.label){case 0:if(!t.checkoutSessionId){d("Could not update store credit without checkout session id","info");return[2/*return*/]}n=Xe.selectedLandedCost;o=Xe.currency||((e=Xe.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"";i=Xe.adjustments.reduce((function(e,r){return e+r.amount}),0);s=Xe.items.reduce((function(e,r){return e+r.amount*r.quantity}),0);return[4/*yield*/,Me({adjustmentsAmount:i,cartId:window.Zonos.cartId,currency:o,id:t.checkoutSessionId,itemsAmount:s,landedCostId:n===null||n===void 0?void 0:n.landedCostId,presentmentCountryCode:a.selectedCountryCode,storeCreditApplication:D()})];case 1:u=f.sent(),l=u.errors,c=u.json;if(l.length>0||!c){v("Error updating checkout session with store credit");return[2/*return*/]}
512
+ // Apply updated subtotals from the response
513
+ or({method:((r=c.checkoutSessionUpdate.landedCost)===null||r===void 0?void 0:r.method)||"DDP",subtotals:c.checkoutSessionUpdate.subtotals});sr(c.checkoutSessionUpdate);return[2/*return*/]}}))}))};
514
+ /**
515
+ * Update the checkout session with the current store credit selection.
516
+ * Debounced to prevent multiple rapid requests when store changes cascade.
517
+ */var _r=e("a4",(function(){if(rr){clearTimeout(rr)}rr=setTimeout((function(){rr=null;void br()}),300)}))}}}));