@zonos/elements 1.3.232 → 1.3.234

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 (415) hide show
  1. package/dist/cjs/{cart-bc615014.js → cart-22ced7cc.js} +33 -29
  2. package/dist/cjs/{shouldRenderTaxIdInput-9b8a8de1.js → containsNonLatinChars-2be5129b.js} +0 -23
  3. package/dist/cjs/{hasInclusivePrice-84145546.js → hasInclusivePrice-ca85cabd.js} +1 -1
  4. package/dist/cjs/index.cjs.js +11 -7
  5. package/dist/cjs/invoice-8fd4242c.js +151 -0
  6. package/dist/cjs/{renderFallback-c2576fbe.js → isCollectMobileTablet-7962c57f.js} +2 -11
  7. package/dist/cjs/isInvoiceMobileTablet-dde41e4e.js +15 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{translationStore-08d3ff9c.js → localization-8ef6250a.js} +1059 -1
  10. package/dist/cjs/{paypal-1d6f1a71.js → paypal-4a086f84.js} +7 -8
  11. package/dist/cjs/placeTestOrder-f25d08ee.js +45 -0
  12. package/dist/cjs/{placeTestOrder-a5469e40.js → renderCheckoutCurrency-5494e45b.js} +2 -42
  13. package/dist/cjs/renderFallback-78b54537.js +12 -0
  14. package/dist/cjs/shouldRenderTaxIdInput-eda13ef8.js +25 -0
  15. package/dist/cjs/throttle-7dd64984.js +76 -0
  16. package/dist/cjs/{zonos-address_11.cjs.entry.js → zonos-address-display_9.cjs.entry.js} +62 -668
  17. package/dist/cjs/zonos-address_4.cjs.entry.js +715 -0
  18. package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
  19. package/dist/cjs/{zonos-banner_2.cjs.entry.js → zonos-banner.cjs.entry.js} +0 -40
  20. package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
  21. package/dist/cjs/{zonos-empty-state-payment_4.cjs.entry.js → zonos-card_5.cjs.entry.js} +44 -6
  22. package/dist/cjs/{zonos-cart-items_13.cjs.entry.js → zonos-cart-items_12.cjs.entry.js} +81 -94
  23. package/dist/cjs/zonos-checkout.cjs.entry.js +20 -21
  24. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  25. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +5 -6
  26. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +66 -65
  27. package/dist/cjs/zonos-collect.cjs.entry.js +25 -25
  28. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  29. package/dist/cjs/zonos-controller.cjs.entry.js +39 -10
  30. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -2
  31. package/dist/cjs/zonos-country-select_4.cjs.entry.js +10 -11
  32. package/dist/cjs/zonos-elements.cjs.js +1 -1
  33. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +30 -31
  34. package/dist/cjs/zonos-hello.cjs.entry.js +7 -8
  35. package/dist/cjs/zonos-input.cjs.entry.js +4 -4
  36. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +94 -0
  37. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +686 -0
  38. package/dist/cjs/zonos-invoice.cjs.entry.js +466 -0
  39. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -6
  40. package/dist/cjs/zonos-link.cjs.entry.js +24 -0
  41. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  42. package/dist/cjs/zonos-stripe-input.cjs.entry.js +5 -5
  43. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  44. package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
  45. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  46. package/dist/collection/collection-manifest.json +8 -0
  47. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +3 -1
  48. package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +3 -1
  49. package/dist/collection/components/checkout/zonos-invoice/assets/ChevronDownIcon.svg +1 -0
  50. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/assets/empty-item.jpeg +0 -0
  51. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.css +72 -0
  52. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +87 -0
  53. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/RemoveIcon.svg +1 -0
  54. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/SuccessIcon.svg +1 -0
  55. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.css +90 -0
  56. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +405 -0
  57. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/chevronDownIcon.svg +1 -0
  58. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/globe.svg +3 -0
  59. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconDark.svg +10 -0
  60. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconLight.svg +10 -0
  61. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosWordmark.svg +7 -0
  62. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.css +155 -0
  63. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +165 -0
  64. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronDownIcon.svg +1 -0
  65. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronUpIcon.svg +1 -0
  66. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.css +117 -0
  67. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +175 -0
  68. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/CheckmarkLineIcon.svg +1 -0
  69. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/RemoveLineIcon.svg +1 -0
  70. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.css +98 -0
  71. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +368 -0
  72. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.css +71 -0
  73. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +151 -0
  74. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.css +83 -0
  75. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +65 -0
  76. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.css +350 -0
  77. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +545 -0
  78. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  79. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  80. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  81. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  82. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  83. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  84. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  85. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
  86. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  87. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  88. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +2 -2
  89. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  90. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  91. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  92. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
  93. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  94. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  95. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  96. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +1 -1
  97. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +5 -5
  98. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
  99. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
  100. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  101. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  102. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  103. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  104. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  105. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  106. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  107. package/dist/collection/components/main/zonos-controller.js +45 -4
  108. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  109. package/dist/collection/components/store/checkout/invoice.js +148 -0
  110. package/dist/collection/components/store/checkout/stripe.js +8 -3
  111. package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
  112. package/dist/collection/components/store/translationStore/strings.base.js +9 -0
  113. package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
  114. package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
  115. package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
  116. package/dist/collection/components/store/translationStore/strings.french.js +9 -0
  117. package/dist/collection/components/store/translationStore/strings.german.js +9 -0
  118. package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
  119. package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
  120. package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
  121. package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
  122. package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
  123. package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
  124. package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
  125. package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
  126. package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
  127. package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
  128. package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
  129. package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
  130. package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
  131. package/dist/collection/components/stripe/zonos-address/zonos-address.js +8 -5
  132. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  133. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  134. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  135. package/dist/collection/components/utils/checkout/initInvoice.js +15 -0
  136. package/dist/collection/components/utils/checkout/isInvoiceMobileTablet.js +10 -0
  137. package/dist/collection/scripts/_zonosBase.js +4 -0
  138. package/dist/esm/{cart-14f305b3.js → cart-66aecbb3.js} +9 -5
  139. package/dist/esm/{shouldRenderTaxIdInput-8bc112bb.js → containsNonLatinChars-2d8810c3.js} +1 -23
  140. package/dist/esm/{hasInclusivePrice-0eda8ba9.js → hasInclusivePrice-2a1bf474.js} +1 -1
  141. package/dist/esm/index.js +11 -7
  142. package/dist/esm/invoice-c7452847.js +146 -0
  143. package/dist/esm/{renderFallback-dbf1e3ae.js → isCollectMobileTablet-921002b0.js} +3 -11
  144. package/dist/esm/isInvoiceMobileTablet-1f7b614e.js +12 -0
  145. package/dist/esm/loader.js +1 -1
  146. package/dist/esm/{translationStore-690c4e04.js → localization-04b05867.js} +1041 -2
  147. package/dist/esm/{paypal-fded8844.js → paypal-56564874.js} +2 -3
  148. package/dist/esm/placeTestOrder-6b9eda9e.js +43 -0
  149. package/dist/esm/{placeTestOrder-2250f719.js → renderCheckoutCurrency-cb808110.js} +3 -42
  150. package/dist/esm/renderFallback-3f010b48.js +10 -0
  151. package/dist/esm/shouldRenderTaxIdInput-d45ceeb4.js +23 -0
  152. package/dist/esm/throttle-ce2432ab.js +74 -0
  153. package/dist/esm/{zonos-address_11.entry.js → zonos-address-display_9.entry.js} +32 -636
  154. package/dist/esm/zonos-address_4.entry.js +708 -0
  155. package/dist/esm/zonos-badge.entry.js +3 -3
  156. package/dist/esm/{zonos-banner_2.entry.js → zonos-banner.entry.js} +1 -40
  157. package/dist/esm/zonos-button_3.entry.js +3 -3
  158. package/dist/esm/{zonos-empty-state-payment_4.entry.js → zonos-card_5.entry.js} +44 -7
  159. package/dist/esm/{zonos-cart-items_13.entry.js → zonos-cart-items_12.entry.js} +21 -33
  160. package/dist/esm/zonos-checkout.entry.js +3 -4
  161. package/dist/esm/zonos-collapse.entry.js +2 -2
  162. package/dist/esm/zonos-collect-cart-items_3.entry.js +5 -6
  163. package/dist/esm/zonos-collect-finish_6.entry.js +7 -6
  164. package/dist/esm/zonos-collect.entry.js +5 -5
  165. package/dist/esm/zonos-component.entry.js +1 -1
  166. package/dist/esm/zonos-controller.entry.js +39 -10
  167. package/dist/esm/zonos-country-flag.entry.js +1 -2
  168. package/dist/esm/zonos-country-select_4.entry.js +10 -11
  169. package/dist/esm/zonos-elements.js +1 -1
  170. package/dist/esm/zonos-hello-dialog.entry.js +6 -7
  171. package/dist/esm/zonos-hello.entry.js +1 -2
  172. package/dist/esm/zonos-input.entry.js +4 -4
  173. package/dist/esm/zonos-invoice-cart-items_2.entry.js +89 -0
  174. package/dist/esm/zonos-invoice-finish_5.entry.js +678 -0
  175. package/dist/esm/zonos-invoice.entry.js +462 -0
  176. package/dist/esm/zonos-language-select_2.entry.js +5 -6
  177. package/dist/esm/zonos-link.entry.js +20 -0
  178. package/dist/esm/zonos-logo.entry.js +2 -2
  179. package/dist/esm/zonos-stripe-input.entry.js +5 -5
  180. package/dist/esm/zonos-toggle.entry.js +2 -2
  181. package/dist/esm/zonos-tooltip.entry.js +2 -2
  182. package/dist/esm/zonos-v-stack.entry.js +2 -2
  183. package/dist/esm-es5/cart-66aecbb3.js +1 -0
  184. package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +1 -0
  185. package/dist/esm-es5/{hasInclusivePrice-0eda8ba9.js → hasInclusivePrice-2a1bf474.js} +1 -1
  186. package/dist/esm-es5/index.js +1 -1
  187. package/dist/esm-es5/invoice-c7452847.js +1 -0
  188. package/dist/esm-es5/isCollectMobileTablet-921002b0.js +1 -0
  189. package/dist/esm-es5/isInvoiceMobileTablet-1f7b614e.js +1 -0
  190. package/dist/esm-es5/loader.js +1 -1
  191. package/dist/esm-es5/localization-04b05867.js +1 -0
  192. package/dist/esm-es5/{paypal-fded8844.js → paypal-56564874.js} +1 -1
  193. package/dist/esm-es5/placeTestOrder-6b9eda9e.js +1 -0
  194. package/dist/esm-es5/renderCheckoutCurrency-cb808110.js +1 -0
  195. package/dist/esm-es5/renderFallback-3f010b48.js +1 -0
  196. package/dist/esm-es5/shouldRenderTaxIdInput-d45ceeb4.js +1 -0
  197. package/dist/esm-es5/throttle-ce2432ab.js +1 -0
  198. package/dist/esm-es5/zonos-address-display_9.entry.js +1 -0
  199. package/dist/esm-es5/zonos-address_4.entry.js +1 -0
  200. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  201. package/dist/esm-es5/zonos-banner.entry.js +1 -0
  202. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  203. package/dist/esm-es5/zonos-card_5.entry.js +1 -0
  204. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -0
  205. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  206. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  207. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  208. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  209. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  210. package/dist/esm-es5/zonos-component.entry.js +1 -1
  211. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  212. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  213. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  214. package/dist/esm-es5/zonos-elements.js +1 -1
  215. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  216. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  217. package/dist/esm-es5/zonos-input.entry.js +1 -1
  218. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -0
  219. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -0
  220. package/dist/esm-es5/zonos-invoice.entry.js +1 -0
  221. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  222. package/dist/esm-es5/zonos-link.entry.js +1 -0
  223. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  224. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  225. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  226. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  227. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  228. package/dist/scripts/index.d.ts +356 -0
  229. package/dist/scripts/index.js +1 -1
  230. package/dist/scripts/loadZonos.js +1 -1
  231. package/dist/scripts/zonos.js +1 -1
  232. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.d.ts +10 -0
  233. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.d.ts +50 -0
  234. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.d.ts +25 -0
  235. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.d.ts +28 -0
  236. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.d.ts +62 -0
  237. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.d.ts +22 -0
  238. package/dist/types/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.d.ts +7 -0
  239. package/dist/types/components/checkout/zonos-invoice/zonos-invoice.d.ts +86 -0
  240. package/dist/types/components/main/zonos-controller.d.ts +4 -0
  241. package/dist/types/components/store/checkout/invoice.d.ts +19 -0
  242. package/dist/types/components/store/translationStore/strings.arabic.d.ts +9 -0
  243. package/dist/types/components/store/translationStore/strings.base.d.ts +9 -0
  244. package/dist/types/components/store/translationStore/strings.chinese.d.ts +9 -0
  245. package/dist/types/components/store/translationStore/strings.danish.d.ts +9 -0
  246. package/dist/types/components/store/translationStore/strings.dutch.d.ts +9 -0
  247. package/dist/types/components/store/translationStore/strings.french.d.ts +9 -0
  248. package/dist/types/components/store/translationStore/strings.german.d.ts +9 -0
  249. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +9 -0
  250. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +9 -0
  251. package/dist/types/components/store/translationStore/strings.italian.d.ts +9 -0
  252. package/dist/types/components/store/translationStore/strings.japanese.d.ts +9 -0
  253. package/dist/types/components/store/translationStore/strings.korean.d.ts +9 -0
  254. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +9 -0
  255. package/dist/types/components/store/translationStore/strings.polish.d.ts +9 -0
  256. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +9 -0
  257. package/dist/types/components/store/translationStore/strings.russian.d.ts +9 -0
  258. package/dist/types/components/store/translationStore/strings.spanish.d.ts +9 -0
  259. package/dist/types/components/store/translationStore/strings.swedish.d.ts +9 -0
  260. package/dist/types/components/store/translationStore/strings.turkish.d.ts +9 -0
  261. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +9 -0
  262. package/dist/types/components/utils/checkout/initInvoice.d.ts +1 -0
  263. package/dist/types/components/utils/checkout/isInvoiceMobileTablet.d.ts +4 -0
  264. package/dist/types/components.d.ts +351 -0
  265. package/dist/types/scripts/_zonosBase.d.ts +5 -0
  266. package/dist/types/types/checkout/api/CheckoutSession.d.ts +4 -0
  267. package/dist/types/types/checkout/api/PartyInfo.d.ts +21 -0
  268. package/dist/zonos-elements/index.esm.js +1 -1
  269. package/dist/zonos-elements/p-00719e49.entry.js +1 -0
  270. package/dist/zonos-elements/p-01b0a2e2.js +1 -0
  271. package/dist/zonos-elements/p-01dada4e.js +1 -0
  272. package/dist/zonos-elements/p-0c64dbbb.js +1 -0
  273. package/dist/zonos-elements/p-0cd5bcb3.entry.js +1 -0
  274. package/dist/zonos-elements/p-0e82fcea.entry.js +1 -0
  275. package/dist/zonos-elements/p-10316d4d.system.entry.js +1 -0
  276. package/dist/zonos-elements/{p-0a90dd80.system.entry.js → p-121c60c1.system.entry.js} +1 -1
  277. package/dist/zonos-elements/{p-bf9d889f.entry.js → p-14314ad3.entry.js} +1 -1
  278. package/dist/zonos-elements/p-170314a3.js +1 -0
  279. package/dist/zonos-elements/p-17a09191.entry.js +1 -0
  280. package/dist/zonos-elements/p-18bc6c7a.entry.js +1 -0
  281. package/dist/zonos-elements/{p-a25428eb.system.js → p-18d20206.system.js} +2 -2
  282. package/dist/zonos-elements/p-1a30fe18.system.entry.js +1 -0
  283. package/dist/zonos-elements/{p-c7b658cb.entry.js → p-1c4d12f0.entry.js} +1 -1
  284. package/dist/zonos-elements/p-1f3549c6.js +1 -0
  285. package/dist/zonos-elements/p-2250e585.entry.js +1 -0
  286. package/dist/zonos-elements/p-248dd596.system.entry.js +1 -0
  287. package/dist/zonos-elements/{p-5f398c28.entry.js → p-264690d7.entry.js} +1 -1
  288. package/dist/zonos-elements/p-2670438c.system.js +1 -0
  289. package/dist/zonos-elements/p-27f6930b.js +1 -0
  290. package/dist/zonos-elements/{p-eea0eb57.system.entry.js → p-2f869f2c.system.entry.js} +1 -1
  291. package/dist/zonos-elements/p-30c661b3.system.entry.js +1 -0
  292. package/dist/zonos-elements/p-34bf7bbe.system.js +1 -0
  293. package/dist/zonos-elements/p-38913b2f.entry.js +1 -0
  294. package/dist/zonos-elements/p-3bec13dd.system.js +1 -0
  295. package/dist/zonos-elements/{p-00ec22b2.entry.js → p-43a22d85.entry.js} +1 -1
  296. package/dist/zonos-elements/p-44b50260.entry.js +1 -0
  297. package/dist/zonos-elements/p-48dc96f9.system.entry.js +1 -0
  298. package/dist/zonos-elements/p-4aa86184.system.entry.js +1 -0
  299. package/dist/zonos-elements/p-4d594c8e.system.js +1 -0
  300. package/dist/zonos-elements/p-4ffbb0d6.system.js +1 -0
  301. package/dist/zonos-elements/{p-452fb638.system.entry.js → p-5062dcf3.system.entry.js} +1 -1
  302. package/dist/zonos-elements/{p-c5cb2364.system.entry.js → p-57cee1b5.system.entry.js} +1 -1
  303. package/dist/zonos-elements/p-59a76f73.entry.js +1 -0
  304. package/dist/zonos-elements/{p-d556c6d1.system.entry.js → p-5afb9260.system.entry.js} +1 -1
  305. package/dist/zonos-elements/p-5e9b45f7.entry.js +1 -0
  306. package/dist/zonos-elements/{p-88ea9f82.entry.js → p-6626d240.entry.js} +1 -1
  307. package/dist/zonos-elements/p-6688473e.entry.js +1 -0
  308. package/dist/zonos-elements/p-6f23a26a.system.js +1 -0
  309. package/dist/zonos-elements/{p-82739127.js → p-73c737aa.js} +2 -2
  310. package/dist/zonos-elements/p-757d4c62.system.entry.js +1 -0
  311. package/dist/zonos-elements/p-7aa50ef2.entry.js +1 -0
  312. package/dist/zonos-elements/p-7e17667d.js +1 -0
  313. package/dist/zonos-elements/p-7e469c5c.entry.js +1 -0
  314. package/dist/zonos-elements/p-7f91617c.system.entry.js +1 -0
  315. package/dist/zonos-elements/p-81e3eb5b.js +1 -0
  316. package/dist/zonos-elements/p-82febf70.system.js +1 -0
  317. package/dist/zonos-elements/{p-770852bf.system.entry.js → p-836db369.system.entry.js} +1 -1
  318. package/dist/zonos-elements/p-83b3f824.system.entry.js +1 -0
  319. package/dist/zonos-elements/p-851011aa.system.entry.js +1 -0
  320. package/dist/zonos-elements/{p-936b54c1.entry.js → p-865536f0.entry.js} +1 -1
  321. package/dist/zonos-elements/{p-b1fd1ec2.system.entry.js → p-8792fef2.system.entry.js} +1 -1
  322. package/dist/zonos-elements/p-890bfc42.system.entry.js +1 -0
  323. package/dist/zonos-elements/{p-c288c6da.system.entry.js → p-89a5e936.system.entry.js} +1 -1
  324. package/dist/zonos-elements/p-8af188f8.system.js +1 -0
  325. package/dist/zonos-elements/p-8d3a62fb.entry.js +1 -0
  326. package/dist/zonos-elements/{p-00ac999f.system.entry.js → p-8dc025c7.system.entry.js} +1 -1
  327. package/dist/zonos-elements/p-944d00da.entry.js +1 -0
  328. package/dist/zonos-elements/p-9479f155.system.js +1 -0
  329. package/dist/zonos-elements/p-95dc475b.system.js +1 -0
  330. package/dist/zonos-elements/p-976afc17.system.js +1 -0
  331. package/dist/zonos-elements/p-97d56c21.system.entry.js +1 -0
  332. package/dist/zonos-elements/p-9b9bfb6d.entry.js +1 -0
  333. package/dist/zonos-elements/{p-55e2e4ed.entry.js → p-9f1bd9b8.entry.js} +1 -1
  334. package/dist/zonos-elements/p-9fa32fdf.js +1 -0
  335. package/dist/zonos-elements/p-a2a0bf4e.js +1 -0
  336. package/dist/zonos-elements/p-a610c24e.system.entry.js +1 -0
  337. package/dist/zonos-elements/{p-9b8750f3.entry.js → p-aedd3911.entry.js} +1 -1
  338. package/dist/zonos-elements/{p-db628e49.system.entry.js → p-b5c31ca4.system.entry.js} +1 -1
  339. package/dist/zonos-elements/p-ba456282.system.entry.js +1 -0
  340. package/dist/zonos-elements/{p-31af91f0.entry.js → p-bd603c1a.entry.js} +1 -1
  341. package/dist/zonos-elements/p-c2442878.system.js +1 -1
  342. package/dist/zonos-elements/p-dc5fb21c.js +1 -0
  343. package/dist/zonos-elements/p-dc94d7eb.js +1 -0
  344. package/dist/zonos-elements/p-e5e64e16.system.js +1 -0
  345. package/dist/zonos-elements/{p-540cec7e.system.entry.js → p-e9e6bea7.system.entry.js} +1 -1
  346. package/dist/zonos-elements/p-eb9ee025.system.js +1 -0
  347. package/dist/zonos-elements/p-ed8ae947.system.entry.js +1 -0
  348. package/dist/zonos-elements/p-f1d9dd4e.entry.js +1 -0
  349. package/dist/zonos-elements/p-f3962950.system.entry.js +1 -0
  350. package/dist/zonos-elements/p-f4e976ae.entry.js +1 -0
  351. package/dist/zonos-elements/p-f513b231.entry.js +1 -0
  352. package/dist/zonos-elements/p-f64207fa.system.entry.js +1 -0
  353. package/dist/zonos-elements/{p-31975752.entry.js → p-fa322dc1.entry.js} +1 -1
  354. package/dist/zonos-elements/p-fb9fb873.system.entry.js +1 -0
  355. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  356. package/package.json +1 -1
  357. package/dist/cjs/localization-39516612.js +0 -884
  358. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +0 -168
  359. package/dist/esm/localization-c5029ffc.js +0 -863
  360. package/dist/esm/zonos-confirm-dialog_2.entry.js +0 -163
  361. package/dist/esm-es5/cart-14f305b3.js +0 -1
  362. package/dist/esm-es5/localization-c5029ffc.js +0 -1
  363. package/dist/esm-es5/placeTestOrder-2250f719.js +0 -1
  364. package/dist/esm-es5/renderFallback-dbf1e3ae.js +0 -1
  365. package/dist/esm-es5/shouldRenderTaxIdInput-8bc112bb.js +0 -1
  366. package/dist/esm-es5/translationStore-690c4e04.js +0 -1
  367. package/dist/esm-es5/zonos-address_11.entry.js +0 -1
  368. package/dist/esm-es5/zonos-banner_2.entry.js +0 -1
  369. package/dist/esm-es5/zonos-cart-items_13.entry.js +0 -1
  370. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +0 -1
  371. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +0 -1
  372. package/dist/zonos-elements/p-03ff7b01.system.entry.js +0 -1
  373. package/dist/zonos-elements/p-100f6a88.system.entry.js +0 -1
  374. package/dist/zonos-elements/p-143d706b.entry.js +0 -1
  375. package/dist/zonos-elements/p-14d7489d.js +0 -1
  376. package/dist/zonos-elements/p-1d5aa016.system.js +0 -1
  377. package/dist/zonos-elements/p-1eae4987.entry.js +0 -1
  378. package/dist/zonos-elements/p-23b45714.system.entry.js +0 -1
  379. package/dist/zonos-elements/p-2557b96b.js +0 -1
  380. package/dist/zonos-elements/p-2ca8b037.entry.js +0 -1
  381. package/dist/zonos-elements/p-2dbcecf4.entry.js +0 -1
  382. package/dist/zonos-elements/p-30e835a8.entry.js +0 -1
  383. package/dist/zonos-elements/p-316f9052.system.entry.js +0 -1
  384. package/dist/zonos-elements/p-3185968f.entry.js +0 -1
  385. package/dist/zonos-elements/p-4e41143a.system.entry.js +0 -1
  386. package/dist/zonos-elements/p-52b87408.system.entry.js +0 -1
  387. package/dist/zonos-elements/p-561be3a2.system.js +0 -1
  388. package/dist/zonos-elements/p-5c680f72.js +0 -1
  389. package/dist/zonos-elements/p-5f77d19e.js +0 -1
  390. package/dist/zonos-elements/p-60469388.system.entry.js +0 -1
  391. package/dist/zonos-elements/p-652e80f0.system.js +0 -1
  392. package/dist/zonos-elements/p-74ca7739.entry.js +0 -1
  393. package/dist/zonos-elements/p-767a31a8.system.js +0 -1
  394. package/dist/zonos-elements/p-78a6e775.system.js +0 -1
  395. package/dist/zonos-elements/p-7c705c76.system.js +0 -1
  396. package/dist/zonos-elements/p-81ba2820.system.entry.js +0 -1
  397. package/dist/zonos-elements/p-8a23bbf5.js +0 -1
  398. package/dist/zonos-elements/p-905d2490.entry.js +0 -1
  399. package/dist/zonos-elements/p-93f2e1ee.system.entry.js +0 -1
  400. package/dist/zonos-elements/p-a0a4e43d.system.entry.js +0 -1
  401. package/dist/zonos-elements/p-a2819807.system.entry.js +0 -1
  402. package/dist/zonos-elements/p-a6e74856.entry.js +0 -1
  403. package/dist/zonos-elements/p-ae940a99.js +0 -1
  404. package/dist/zonos-elements/p-b7ea5f4f.system.entry.js +0 -1
  405. package/dist/zonos-elements/p-c1ecab92.entry.js +0 -1
  406. package/dist/zonos-elements/p-c50cc926.entry.js +0 -1
  407. package/dist/zonos-elements/p-cf765af3.system.js +0 -1
  408. package/dist/zonos-elements/p-e03e1a62.entry.js +0 -1
  409. package/dist/zonos-elements/p-e7874318.system.entry.js +0 -1
  410. package/dist/zonos-elements/p-e8949e7e.entry.js +0 -1
  411. package/dist/zonos-elements/p-ea0b5d10.system.js +0 -1
  412. package/dist/zonos-elements/p-eae3462c.entry.js +0 -1
  413. package/dist/zonos-elements/p-eeb1081e.js +0 -1
  414. package/dist/zonos-elements/p-f892595d.system.entry.js +0 -1
  415. package/dist/zonos-elements/p-fd3b46ee.entry.js +0 -1
@@ -1,163 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-0bbe9693.js';
2
- import { t as translate } from './translationStore-690c4e04.js';
3
- import { g as getZonosStoreTheme, f as zonosStoreFontFamily, z as zonosStore } from './zonosStore-b434e436.js';
4
- import { c as classes } from './classes-0d95c529.js';
5
- import { g as getBorderRadius } from './getBorderRadius-877f6389.js';
6
- import './VarianceTest-572cecf5.js';
7
-
8
- const ExclamationMarkDuotoneIcon = `<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
9
- <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-400)"></path>
10
- <path d="M12.75 9a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V9Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
11
- </svg>`;
12
-
13
- const HelpDuotoneIcon = `<svg color="var(--zonos-elements-blue-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
14
- <path d="M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Z" data-is-secondary-color="true" fill="var(--zonos-elements-blue-400)"></path>
15
- <path d="M10.25 10.25a1.75 1.75 0 1 1 2.431 1.613c-.616.26-1.431.885-1.431 1.887a.75.75 0 0 0 1.5 0c0-.053.02-.128.108-.228.092-.104.236-.205.408-.278A3.25 3.25 0 1 0 8.75 10.25a.75.75 0 0 0 1.5 0Zm2.5 5.75a.75.75 0 0 0-1.5 0v.25a.75.75 0 0 0 1.5 0V16Z" fill="currentColor"></path>
16
- </svg>`;
17
-
18
- const WarningDuotoneIcon = `<svg color="var(--zonos-elements-orange-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" style="display: block;">
19
- <path d="M14.46 5.492c-1.014-2.027-3.906-2.027-4.92 0L4.276 16.02c-.914 1.83.416 3.98 2.46 3.98h10.528c2.044 0 3.374-2.151 2.46-3.98L14.46 5.492Z" data-is-secondary-color="true" fill="var(--zonos-elements-orange-400)"></path>
20
- <path d="M12.75 10a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 0 1.5 0V10Zm0 5.5a.75.75 0 0 0-1.5 0v.5a.75.75 0 0 0 1.5 0v-.5Z" fill="currentColor"></path>
21
- </svg>`;
22
-
23
- const zonosConfirmDialogCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--confirm-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:opacity 0.3s, visibility 0.3s;transition:opacity 0.3s, visibility 0.3s}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--confirm-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color)}:host .zonos--confirm-dialog{position:relative;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;width:var(--zonos--dialog-width);border-radius:var(--zonos--border-radius, 10px);outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;gap:24px}:host .icon-wrapper{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;height:40px;width:40px;border-radius:50%;background:var(--zonos-elements-blue-100)}:host .warn .icon-wrapper{background:var(--zonos-elements-orange-100)}:host .danger .icon-wrapper{background:var(--zonos-elements-red-100)}:host .footer{display:-ms-flexbox;display:flex;width:100%;gap:8px}:host .footer zonos-button{-ms-flex:1;flex:1}:host .content{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .content zonos-text{text-align:center}:host(.open) .zonos--confirm-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483009;opacity:0.65}:host(.open) .zonos--confirm-layout{opacity:1;z-index:2147483010;-webkit-transform:scale(1);transform:scale(1)}";
24
- const ZonosConfirmDialogStyle0 = zonosConfirmDialogCss;
25
-
26
- const ZonosConfirmDialog = class {
27
- constructor(hostRef) {
28
- registerInstance(this, hostRef);
29
- this.confirmClicked = createEvent(this, "confirmClicked", 7);
30
- this.cancelClicked = createEvent(this, "cancelClicked", 7);
31
- /**
32
- * Dialog title text
33
- * @default "Are you sure?"
34
- */
35
- this.dialogTitle = translate('Are you sure?');
36
- /**
37
- * Dialog intent (for icon and button color)
38
- * @default "info"
39
- */
40
- this.dialogIntent = 'info';
41
- /**
42
- * Dialog subtitle text
43
- * @default null No subtitle
44
- */
45
- this.dialogSubtitle = null;
46
- /**
47
- * Dialog width
48
- * @default 350 px
49
- */
50
- this.dialogWidth = 350;
51
- /**
52
- * Type of dialog
53
- * - "alert" - Only confirm button
54
- * - "confirm" - Both Confirm and cancel buttons
55
- * @default "confirm"
56
- */
57
- this.dialogType = 'confirm';
58
- /**
59
- * Whether or not the dialog is open
60
- */
61
- this.isMobile = false;
62
- /**
63
- * Whether or not to close the dialog when clicking outside of it
64
- * @default false
65
- */
66
- this.noClickOutside = false;
67
- this.clickOutsideDialogHandler = (event) => {
68
- if (event.target === event.currentTarget && !this.noClickOutside) {
69
- this.closeDialogHandler();
70
- }
71
- };
72
- }
73
- handleKeyDown(ev) {
74
- if (ev.key === 'Escape') {
75
- this.closeDialogHandler();
76
- }
77
- }
78
- focusDialog() {
79
- if (this.dialogOpen) {
80
- setTimeout(() => {
81
- var _a, _b;
82
- // Focus on a non tabable element (tabIndex=-1), so we will be able to tab to other tabable elements
83
- (_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.zonos--backdrop')) === null || _b === void 0 ? void 0 : _b.focus();
84
- }, 100);
85
- }
86
- }
87
- confirmDialogHandler() {
88
- // Only do the action if the dialog is open
89
- if (!this.dialogOpen) {
90
- return;
91
- }
92
- // Emit confirm event
93
- this.confirmClicked.emit();
94
- }
95
- closeDialogHandler() {
96
- // Only do the action if the dialog is open
97
- if (!this.dialogOpen) {
98
- return;
99
- }
100
- // Emit cancel event
101
- this.cancelClicked.emit();
102
- }
103
- renderIcon() {
104
- switch (this.dialogIntent) {
105
- case 'info':
106
- return (h("zonos-icon", { content: HelpDuotoneIcon, iconColor: 'blue-800' }));
107
- case 'danger':
108
- return (h("zonos-icon", { content: ExclamationMarkDuotoneIcon, iconColor: 'red-800' }));
109
- case 'warn':
110
- return (h("zonos-icon", { content: WarningDuotoneIcon, iconColor: 'orange-800' }));
111
- }
112
- }
113
- getButtonConfirmVariant() {
114
- switch (this.dialogIntent) {
115
- case 'warn':
116
- return 'warning';
117
- case 'danger':
118
- return 'danger';
119
- default:
120
- return 'primary';
121
- }
122
- }
123
- render() {
124
- this.focusDialog();
125
- const borderStyle = getBorderRadius();
126
- // Get theme for the update dialog, inherit from the theme, no from this component theme
127
- const theme = getZonosStoreTheme(zonosStore.appearance.theme);
128
- return (h(Host, { key: 'c9eabf497f7e23ae201e6310e5ecb9f0d7068294', class: classes([this.dialogOpen && 'open', 'zonos--elements']), "data-dialog-type": this.dialogType, "data-theme": theme, style: {
129
- '--zonos--border-radius': borderStyle,
130
- '--zonos--dialog-width': `${this.dialogWidth}px`,
131
- '--zonos--font-family': zonosStoreFontFamily(),
132
- } }, h("div", { key: 'a9a525bfe764bf93e8725d9a00c069455de72ed6', class: "zonos--backdrop", tabIndex: -1 }), h("div", { key: '072ab68e501618b640ffce6c6e8e96096966e09d', class: classes(['zonos--confirm-layout', this.dialogIntent]), onClick: e => this.clickOutsideDialogHandler(e) }, h("div", { key: '3ab415f1cbc2bc36af01d67b279e732480de8685', class: "zonos--confirm-dialog", onBlur: () => {
133
- this.focusDialog();
134
- } }, h("div", { key: 'a1d99558318371c0e5ee95a9578a6de31a6fc27a', class: "wrapper" }, h("div", { key: '3fd7fbc90c430a3e1496e5b0347947c1929aa6ed', class: "icon-wrapper" }, this.renderIcon()), h("div", { key: '5584080e0f0a5a756b0cc2ac761e0e18c864afcd', class: "content" }, h("div", { key: '4a2070c137636193d05ded090fea26f05aada887', class: "title" }, h("zonos-text", { key: 'ab4c773f4af1271f5615a28f6a6193460330f16b', type: "subheader" }, this.dialogTitle)), this.dialogSubtitle && (h("div", { key: '05a445dc37e754c99ea6727ae2bf861d42d5c2c4', class: "subtitle" }, h("zonos-text", { key: 'a7563f9fd3b405653487542e1b7a1f6aeab01893', textColor: "gray-800" }, this.dialogSubtitle)))), h("div", { key: '812e9e43fdb6d10ed62da8138e344b0243ca5c34', class: "footer" }, this.dialogType === 'confirm' && (h("zonos-button", { key: '07d7dc9d1a4bca9cb1ee420a4fed82e9fc513bd9', backgroundColor: "gray-0", class: "cancel-button", onClick: () => this.closeDialogHandler(), size: "lg", withBoxShadow: true }, this.dialogCancelBtnText || translate('Cancel'))), h("zonos-button", { key: 'b607a5244dc39869b6d40cd361d9dee4686858a7', class: "confirm-button", onClick: () => this.confirmDialogHandler(), size: "lg", variant: this.getButtonConfirmVariant() }, this.dialogConfirmBtnText)))))));
135
- }
136
- static get assetsDirs() { return ["assets"]; }
137
- get el() { return getElement(this); }
138
- };
139
- ZonosConfirmDialog.style = ZonosConfirmDialogStyle0;
140
-
141
- const zonosLoadingOverlayCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{position:fixed;inset:0;z-index:2147483010;pointer-events:none;display:block}:host .zonos--loading-overlay{position:fixed;inset:0;width:100vw;height:100vh;background:var(--zonos-elements-backdrop-color);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;opacity:0;visibility:hidden;-webkit-transition:opacity 0.3s ease, visibility 0.3s ease;transition:opacity 0.3s ease, visibility 0.3s ease;z-index:2147483010}:host(.zonos--open){pointer-events:auto}:host(.zonos--open) .zonos--loading-overlay{opacity:0.65;visibility:visible}";
142
- const ZonosLoadingOverlayStyle0 = zonosLoadingOverlayCss;
143
-
144
- const ZonosLoadingOverlay = class {
145
- constructor(hostRef) {
146
- registerInstance(this, hostRef);
147
- /**
148
- * Whether or not the overlay is open
149
- * @default false
150
- */
151
- this.open = false;
152
- /**
153
- * Spinner size (optional, default 40)
154
- */
155
- this.size = 40;
156
- }
157
- render() {
158
- return (h(Host, { key: '1eb7313add29219032d8301abaf55ace726a3309', class: classes(['zonos--elements', this.open && 'zonos--open']) }, h("div", { key: 'df9960e78817a9a98006fed7e87c5441f220f496', class: "zonos--loading-overlay" }, h("zonos-spinner", { key: '32795fe2c626add5d2f53032ea9b5b8d528bef38', size: this.size, spinnerColor: this.spinnerColor }))));
159
- }
160
- };
161
- ZonosLoadingOverlay.style = ZonosLoadingOverlayStyle0;
162
-
163
- export { ZonosConfirmDialog as zonos_confirm_dialog, ZonosLoadingOverlay as zonos_loading_overlay };
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):n(e.value).then(a,s)}d((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return d([e,t])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=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,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++){if(i||!(o in t)){if(!i)i=Array.prototype.slice.call(t,0,o);i[o]=t[o]}}return e.concat(i||Array.prototype.slice.call(t))};import{z as zonosStore,c as createStore}from"./zonosStore-b434e436.js";import{s as storageStore,l as localizationStore,e as getOverridenZCountry,f as filterValidTests,b as storageStoreSetEnabledVariantTestKeys}from"./localization-c5029ffc.js";import{t as translate}from"./translationStore-690c4e04.js";import{f as fallbackApiList,h as handleFetch,g as getIsTestMode,a as getIsStagingMode,s as sendErrorLog,l as logError,j as jsonParse}from"./handleFetch-a844cac1.js";import{l as log,b as allLogs}from"./VarianceTest-572cecf5.js";import{i as isDarkColor}from"./isDarkColor-9ddd90cc.js";import{g as getBorderRadius}from"./getBorderRadius-877f6389.js";var extractName=function(e){var t=e.firstName,r=e.lastName,o=e.name;var n;if(!o&&!t&&!r){return{firstName:"",lastName:""}}var i=(o===null||o===void 0?void 0:o.split(/\s+/))||[];var a=(t===null||t===void 0?void 0:t.trim())||((n=i[0])===null||n===void 0?void 0:n.trim())||"";var s=(r===null||r===void 0?void 0:r.trim())||i.slice(1).join(" ").trim()||"";return{firstName:a,lastName:s}};var getTranslatedAddress=function(e){var t=e.currentAddress,r=e.translatedAddress;var o,n,i,a,s,d;var c=t.value.address,l=c.city,u=c.country,v=c.line1,S=c.line2,p=c.postal_code,f=c.state;var h=t.value.name||[t.value.firstName,t.value.lastName].join(" ");return{city:((o=r.city)===null||o===void 0?void 0:o[l])||l,country:u,line1:((n=r.line1)===null||n===void 0?void 0:n[v])||v,line2:((i=r.line2)===null||i===void 0?void 0:i[S||""])||S||"",name:((a=r.name)===null||a===void 0?void 0:a[h])||h,phone:t.value.phone||"",postal_code:((s=r.postal_code)===null||s===void 0?void 0:s[p])||p,state:((d=r.state)===null||d===void 0?void 0:d[f])||f}};var prepCartCalculateLandedCost=function(e){var t;var r=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var o=stripeStore.stripeLinkEventData;var n=stripeStore.stripeAddressEventData;var i=stripeStore.stripeShippingSameAsBilling?stripeStore.stripeAddressEventData:stripeStore.stripeBillingAddressEventData;if(!n||!i){throw new Error("Missing stripe address data")}var a=getTranslatedAddress({currentAddress:n,translatedAddress:stripeStore.translatedAddress.address});var s=extractName({name:a.name}),d=s.firstName,c=s.lastName;var l=getTranslatedAddress({currentAddress:i,translatedAddress:stripeStore.translatedAddress.address});var u=extractName({name:l.name}),v=u.firstName,S=u.lastName;var p=getOverridenZCountry()||"US";return{billingAddress:{addressLine1:l.line1,addressLine2:l.line2||"",city:l.city,country:l.country,postalCode:l.postal_code,state:l.state},billingContact:{firstName:v,lastName:S,phone:l.phone},cartCurrencyCode:(t=cartStore.items[0])===null||t===void 0?void 0:t.currencyCode,cartId:e,checkoutSessionCountry:p||localizationStore.selectedCountryCode||undefined,checkoutSessionId:storageStore.checkoutSessionId||"",contact:{companyName:stripeStore.companyName,email:o===null||o===void 0?void 0:o.value.email,firstName:d,lastName:c,phone:a.phone},isTest:!!r,landedCostAdjustments:cartStore.promoCode?[{amount:0,productId:null,promoCode:cartStore.promoCode,sku:null,type:"PROMO_CODE"}]:[],shipToTaxId:stripeStore.taxId,shippingAddress:{addressLine1:a.line1,addressLine2:a.line2,city:a.city,country:a.country,postalCode:a.postal_code,state:a.state}}};var prepCalculateLandedCost=function(){var e=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";var t=stripeStore.stripeLinkEventData;var r=stripeStore.stripeAddressEventData;var o=stripeStore.stripeShippingSameAsBilling?stripeStore.stripeAddressEventData:stripeStore.stripeBillingAddressEventData;log({stripeAddressData:r,stripeBillingAddressData:o},"info");if(!r||!o){throw new Error("Missing stripe address data")}var n=getTranslatedAddress({currentAddress:r,translatedAddress:stripeStore.translatedAddress.address});var i=extractName({name:n.name}),a=i.firstName,s=i.lastName;var d=getTranslatedAddress({currentAddress:o,translatedAddress:stripeStore.translatedAddress.address});var c=extractName({name:d.name}),l=c.firstName,u=c.lastName;var v=cartStore.adjustments.map((function(e){return{amount:e.amount,name:e.description||null,productId:e.productId,sku:e.sku,type:e.type}}));var S=cartStore.promoCode?__spreadArray([{amount:0,productId:null,promoCode:cartStore.promoCode,sku:null,type:"PROMO_CODE"}],v,true):v;return{billingAddress:{addressLine1:d.line1,addressLine2:d.line2||"",city:d.city,country:d.country,postalCode:d.postal_code,state:d.state},billingContact:{firstName:l,lastName:u,phone:d.phone},checkoutSessionId:storageStore.checkoutSessionId||"",contact:{companyName:stripeStore.companyName,email:t===null||t===void 0?void 0:t.value.email,firstName:a,lastName:s,phone:n.phone},isTest:e,items:cartStore.items,landedCostAdjustments:S,shipToTaxId:stripeStore.taxId,shippingAddress:{addressLine1:n.line1,addressLine2:n.line2,city:n.city,country:n.country,postalCode:n.postal_code,state:n.state}}};var triggerBuildLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l;return __generator(this,(function(u){switch(u.label){case 0:a=prepCalculateLandedCost();return[4,e({billingAddress:a.billingAddress,billingContact:a.billingContact,checkoutSessionId:a.checkoutSessionId,contact:a.contact,landedCostAdjustments:a.landedCostAdjustments,publicCredential:window.Zonos.zonosApiKey||"",shippingAddress:a.shippingAddress,zonosApiRoute:fallbackApiList["vercel"]})];case 1:s=u.sent();if(!s||!((t=s.checkoutSessionWorkflow)===null||t===void 0?void 0:t.length)&&((r=s.errors)===null||r===void 0?void 0:r.length)){throw new Error("Failed to build landed cost: ".concat(((n=(o=s===null||s===void 0?void 0:s.errors)===null||o===void 0?void 0:o[0])===null||n===void 0?void 0:n.message)||"Unknown error"))}return[4,handleFetch("/api/zonos-elements/validate-landed-cost",{body:s,headers:{"Content-Type":"application/json"},method:"POST"})];case 2:d=u.sent(),c=d.errors,l=d.json;if(!l||c.length){throw new Error("Invalid landed cost object: ".concat(((i=c.find(Boolean))===null||i===void 0?void 0:i.message)||"Unknown error"))}return[2,s]}}))}))};var calculateLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s;return __generator(this,(function(d){switch(d.label){case 0:r=zonosStore.checkoutSettings.buildLandedCost;if(!r)return[3,2];return[4,triggerBuildLandedCost(r)];case 1:o=d.sent();return[2,o];case 2:return[4,handleFetch("/api/zonos-elements/calculate-landed-cost",{body:prepCalculateLandedCost(),method:"POST",signal:e===null||e===void 0?void 0:e.signal})];case 3:n=d.sent(),i=n.errors,a=n.json;if(i.length||!a){s=((t=i[0])===null||t===void 0?void 0:t.message)==="The user aborted a request.";if(s){throw new Error("The landed cost calculation request was aborted to initiate a new one.")}i.forEach((function(e){console.warn("Error calculating landed cost: ".concat(e.message))}));if(!a){throw new Error("Failed to calculate landed cost")}return[2,a]}return[2,a]}}))}))};var cartCalculateLandedCost=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l;var u=e.abortController,v=e.cartId;return __generator(this,(function(e){switch(e.label){case 0:return[4,handleFetch("/api/zonos-elements/cart-calculate-landed-cost",{body:prepCartCalculateLandedCost(v),method:"POST",signal:u===null||u===void 0?void 0:u.signal})];case 1:a=e.sent(),s=a.errors,d=a.json;if(s.length||!d){c=typeof((t=s[0])===null||t===void 0?void 0:t.message)==="string"&&(((r=s[0])===null||r===void 0?void 0:r.message)==="The user aborted a request."||((o=s[0])===null||o===void 0?void 0:o.message.includes("signal is aborted"))||((n=s[0])===null||n===void 0?void 0:n.message.includes("The operation was aborted"))||((i=s[0])===null||i===void 0?void 0:i.message.includes("Fetch is aborted")));l=c?"The landed cost calculation request was aborted to initiate a new one.":"Failed to calculate landed cost";throw new Error(l)}return[2,d]}}))}))};var __rest=undefined&&undefined.__rest||function(e,t){var r={};for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0)r[o]=e[o];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++){if(t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n]))r[o[n]]=e[o[n]]}return r};var calculateLandedCostNormalized=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=window.Zonos.cartId;if(!!t)return[3,2];return[4,calculateLandedCost(e)];case 1:r=a.sent();return[2,r];case 2:return[4,cartCalculateLandedCost({abortController:e,cartId:t})];case 3:o=a.sent(),n=o.cartWorkflow,i=__rest(o,["cartWorkflow"]);return[2,Object.assign(Object.assign({},i),{itemCreateWorkflow:n.items})]}}))}))};var trackConversionEvent=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c;var l=e.checkoutSessionId,u=e.eventName,v=e.metadata;return __generator(this,(function(e){switch(e.label){case 0:o=Date.now();n=__spreadArray([],window.Zonos.trackEventLogs,true);window.Zonos.trackEventLogs.push({checkoutSessionId:l,eventCreated:o,eventName:u});i=window.location.href.includes("zonos.com")&&!window.location.href.includes("checkout.zonos.com")||!!((t=window.Zonos)===null||t===void 0?void 0:t.zonosQaUrl)||!!((r=window.Zonos)===null||r===void 0?void 0:r.debug);a=getIsTestMode()||getIsStagingMode();if((a||i)&&!window.Zonos.zonosConversionTest){return[2]}s=localizationStore.selectedCountryCode;d=zonosStore.organizationId;if(!l){void sendErrorLog({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(u,'" - No checkout session id found')],metadata:{allLogs:allLogs,checkoutSessionId:l,eventName:u,metadata:v,organizationId:d,trackEventLogs:n}});return[2]}if(!d){void sendErrorLog({endpoint:"trackConversionEventMetric",errors:['Event "'.concat(u,'" - No organization id found')],metadata:{allLogs:allLogs,checkoutSessionId:l,eventName:u,metadata:v,organizationId:d,trackEventLogs:n}})}c={checkoutSessionId:l,countryCode:s,eventCreated:o,eventName:u,metadata:Object.assign(Object.assign({},v),{trackEventLogs:n}),organizationId:d};return[4,handleFetch("/api/zonos-elements/track-conversion-event",{body:c,method:"POST"})];case 1:e.sent();return[2]}}))}))};var getExcludeAddressFieldsObject=function(e){var t=e.address,r=e.invalidAdddressList;if(!t){return}if(!r){return}var o={};if(r.city){o.city=t.city}if(r.line1){o.line1=t.line1}if(r.line2){o.line2=t.line2}if(r.postal_code){o.postal_code=t.postal_code}if(r.state){o.state=t.state}if(r.name){o.name=t.name}return Object.keys(o).length?o:undefined};var buildTranslateRequest=function(e){var t=e.addressInvalidCharactersList,r=e.billingAddressInvalidCharactersList,o=e.stripeAddressEventData,n=e.stripeBillingAddressEventData,i=e.stripeShippingSameAsBilling;var a=!!(o===null||o===void 0?void 0:o.complete);var s=i?a:!!(n===null||n===void 0?void 0:n.complete);if(!a||!s){return null}if(!t&&!r){return null}var d=o.value;var c=(n===null||n===void 0?void 0:n.value)||null;var l=extractName({firstName:d.firstName,lastName:d.lastName,name:d.name}),u=l.firstName,v=l.lastName;var S="".concat(u," ").concat(v);var p=extractName({firstName:c===null||c===void 0?void 0:c.firstName,lastName:c===null||c===void 0?void 0:c.lastName,name:(c===null||c===void 0?void 0:c.name)||""}),f=p.firstName,h=p.lastName;var m=f&&h?"".concat(f," ").concat(h):"";var g=d.address;var y=c===null||c===void 0?void 0:c.address;return{address:getExcludeAddressFieldsObject({address:Object.assign(Object.assign({},g),{name:S}),invalidAdddressList:t}),billingAddress:!i?getExcludeAddressFieldsObject({address:y?Object.assign(Object.assign({},y),{name:m}):null,invalidAdddressList:r}):undefined,destinationCountry:g.country}};var sortServiceLevelOptionsByAmount=function(e){var t=e.sort((function(e,t){return e.amount-t.amount}));return t};var getCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:if(!storageStore.checkoutSessionId){return[2,{errors:[{message:"No checkout session id found"}],json:null}]}e=new URLSearchParams;e.set("checkoutSessionId",storageStore.checkoutSessionId);return[4,handleFetch("/api/zonos-elements/get-checkout-session?".concat(e.toString()))];case 1:t=n.sent(),r=t.errors,o=t.json;return[2,{errors:r,json:o}]}}))}))};var validateCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:return[4,getCheckoutSession()];case 1:t=n.sent(),r=t.errors,o=t.json;if(r.length||!o){logError("Failed to retrieve checkout session info before confirming payment ",r);void sendErrorLog({endpoint:"validateCheckoutSession",errors:r.map((function(e){return e.message})),metadata:{allLogs:allLogs}});return[2,{errorMessage:translate("Unable to retrieve the checkout session at the moment. Please try again or contact our support team."),valid:false}]}if(!((e=o.checkoutSession.landedCost)===null||e===void 0?void 0:e.id)){logError("Landed cost is not found in the checkout session before confirming payment.");void sendErrorLog({endpoint:"validateCheckoutSession",errors:["No landed cost found before confirming payment"],metadata:{allLogs:allLogs}});return[2,{errorMessage:translate('No shipment rating selected. Please go back to the "Shipping" step and select a shipment rating to proceed.'),valid:false}]}return[2,{errorMessage:"",valid:true}]}}))}))};var addressRuleStyle=function(e){var t=e.theme;var r={".AccordionItem":{color:"var(--colorText)"},".AccordionItem--selected":{color:"var(--colorText)"},".Action":{color:"var(--colorText)"},".Input":{boxShadow:"none",fontSize:zonosStore.appearance.fontSizeInputValue?"".concat(zonosStore.appearance.fontSizeInputValue,"px"):undefined,padding:"0",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"8px",paddingTop:"6px"},".Label--resting":{fontSize:zonosStore.appearance.fontSizeInputLabel?"".concat(zonosStore.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(t){case"DARK":{return Object.assign(Object.assign({},r),{".Action":Object.assign(Object.assign({},r[".Action"]),{color:"white"}),".PickerItem--new":Object.assign(Object.assign({},r[".PickerItem--new"]),{color:"white"})})}default:return r}};var defaultVariable=function(e){var t=e.borderStyle,r=e.theme;switch(r){case"DARK":return{borderRadius:getBorderRadius({overrideBorderStyle:t}),colorBackground:"#101117",colorBackgroundText:"#C5C6CA",colorText:"#C5C6CA",colorTextPlaceholder:"#C5C6CA"};default:return{borderRadius:getBorderRadius({overrideBorderStyle:t}),iconMenuColor:"var(--colorText)",iconMenuHoverColor:"var(--colorText)"}}};var _m=createStore((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,shouldInventoryRefund:false,shouldRenderPayInUsdButton:false,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:{}}}})),stripeStoreOnChange=_m.onChange,reset$1=_m.reset,stripeStore=_m.state;var getStripeOptions=function(e){var t=e.clientSecret,r=e.overrideBorderRadius,o=e.overridePrimaryColor,n=e.overrideSecondaryColor,i=e.overrideTheme,a=e.paypalEnabled;var s=o||zonosStore.appearance.colorPrimary;var d=n||zonosStore.appearance.colorSecondary;var c=s&&isDarkColor(s)?"night":"flat";var l=i==="DARK"?"night":"flat";var u=a?["external_paypal"]:[];return{appearance:{labels:"floating",rules:Object.assign({},addressRuleStyle({theme:i||"LIGHT"})),theme:i?l:c,variables:Object.assign(Object.assign({},defaultVariable({borderStyle:r,theme:"LIGHT"})),{colorPrimary:d})},clientSecret:t||undefined,customerSessionClientSecret:stripeStore.stripeCustomerSessionClientSecret||undefined,externalPaymentMethodTypes:__spreadArray([],u,true),locale:localizationStore.selectedLocale}};var stripeStoreCleanupDomesticShippingSession=function(){window.sessionStorage.removeItem("zonos--bigcommerce-domestic-checkout-shipping")};var stripeStoreSaveDomesticShippingSession=function(e){window.sessionStorage.setItem("zonos--bigcommerce-domestic-checkout-shipping",JSON.stringify(e))};var stripeStoreGetDomesticShippingSession=function(){var e=window.sessionStorage.getItem("zonos--bigcommerce-domestic-checkout-shipping");return jsonParse(e)};var initStripeElements=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i;return __generator(this,(function(a){o=stripeStore.clientSecret;if(!stripeStore.stripe){log("Skip. Stripe is not initialized");return[2]}n=getStripeOptions({clientSecret:o,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(n)===JSON.stringify(stripeStore.stripeElementsOptions);if(!stripeStore.stripeElements||!stripeStore.stripeElementsForBillingAddress){stripeStore.stripeElementsForBillingAddress=(t=stripeStore.stripe)===null||t===void 0?void 0:t.elements(n);log("Stripe elements for billing address initialized");stripeStore.stripeElements=(r=stripeStore.stripe)===null||r===void 0?void 0:r.elements(n);stripeStore.stripeElementsOptions=n;log("Stripe elements initialized");return[2]}if(!i){stripeStore.stripeElements.update(n);stripeStore.stripeElementsForBillingAddress.update(n);stripeStore.stripeElementsOptions=n;void stripeStore.stripeElements.fetchUpdates()}log("Stripe elements updated");return[2]}))}))};var stripeStoreReset=function(){sessionStorage.removeItem("zonos--client-secret");reset$1();stripeStore.stripe=window.Zonos.stripe};var checkIsAddressOutdatedForValidation=function(){var e,t,r,o;var n=JSON.stringify((e=stripeStore.stripeAddressUsedWhenValidatingAddress)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.value);var i=!stripeStore.stripeShippingSameAsBilling&&JSON.stringify((r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeBillingAddressUsedWhenValidatingAddress)===null||o===void 0?void 0:o.value);return n||i};var checkIsAddressOutdatedForAsyncAddressUpdate=function(){var e,t,r,o,n,i;var a=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var s=JSON.stringify((r=stripeStore.stripeAddressUsedWhenAsyncAddressUpdate)===null||r===void 0?void 0:r.value)!==JSON.stringify((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value);var d=!stripeStore.stripeShippingSameAsBilling&&JSON.stringify((n=stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate)===null||n===void 0?void 0:n.value)!==JSON.stringify((i=stripeStore.stripeBillingAddressEventData)===null||i===void 0?void 0:i.value);var c=stripeStore.taxIdUsedWhenAsyncAddressUpdate!==stripeStore.taxId;var l=stripeStore.companyNameUsedWhenAsyncAddressUpdate!==stripeStore.companyName;return a||s||d||c||l};var stripeStoreBuildAddressForPartyCreate=function(e){var t=e.address,r=e.firstName,o=e.lastName,n=e.name,i=e.phone;var a=extractName({firstName:r,lastName:o,name:n}),s=a.firstName,d=a.lastName;if(!s||!d){void sendErrorLog({endpoint:"PARTY_CREATE_NO_NAME_FOUND",errors:["No name found"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,firstName:r,lastName:o,name:n}})}if(!i){void sendErrorLog({endpoint:"PARTY_CREATE_NO_PHONE_FOUND",errors:["No phone found"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,phone:i}})}return{city:t.city,country:t.country,firstName:s,lastName:d,line1:t.line1,line2:t.line2,phone:i||"",postal_code:t.postal_code,state:t.state}};var stripeStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l,u;return __generator(this,(function(v){switch(v.label){case 0:if(!((e=stripeStore.stripeAddressEventData)===null||e===void 0?void 0:e.complete)||!stripeStore.stripeShippingSameAsBilling&&!((t=stripeStore.stripeBillingAddressEventData)===null||t===void 0?void 0:t.complete)||!stripeStore.stripeBillingAddressEventData){return[2,{partiesCreated:false}]}if(!cartStore.landedCostData){return[2,{partiesCreated:false}]}n=(r=cartStore.landedCostData.find(Boolean))===null||r===void 0?void 0:r.landedCost.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}i=checkIsAddressOutdatedForAsyncAddressUpdate();if(!i){return[2,{partiesCreated:false}]}a=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeAddressEventData.value.address,firstName:stripeStore.stripeAddressEventData.value.firstName,lastName:stripeStore.stripeAddressEventData.value.lastName,name:stripeStore.stripeAddressEventData.value.name,phone:stripeStore.stripeAddressEventData.value.phone});s=stripeStore.stripeShippingSameAsBilling?a:stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});d=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-parties",{body:{address:a,billingAddress:s,companyName:stripeStore.companyName,email:((o=stripeStore.stripeLinkEventData)===null||o===void 0?void 0:o.value.email)||"",isTest:d,rootId:n,taxId:stripeStore.taxId},method:"POST"})];case 1:c=v.sent(),l=c.errors,u=c.json;if(l.length||!u){logError("Error occurs when creating parties",JSON.stringify(l,null,2));void sendErrorLog({endpoint:"PF_PARTY_CREATE_FAILED",errors:["Failed to create parties"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:l,json:u}});return[2,{partiesCreated:false}]}stripeStore.companyNameUsedWhenAsyncAddressUpdate=stripeStore.companyName;stripeStore.stripeAddressUsedWhenAsyncAddressUpdate=stripeStore.stripeAddressEventData;stripeStore.stripeBillingAddressUsedWhenAsyncAddressUpdate=stripeStore.stripeBillingAddressEventData;stripeStore.taxIdUsedWhenAsyncAddressUpdate=stripeStore.taxId;stripeStore.partyBillingId=u.billToPartyId;stripeStore.partyShippingId=u.shipToPartyId;return[2,{partiesCreated:true}]}}))}))};var buildAddressForLCPrefetch=function(e){return{countryCode:e.address.country,postalCode:e.address.postal_code,state:e.address.state}};var checkIsAddressOutdatedForLCPrefetch=function(){var e,t;var r=JSON.stringify((e=stripeStore.stripeLinkUsedWhenFetchingLC)===null||e===void 0?void 0:e.value)!==JSON.stringify((t=stripeStore.stripeLinkEventData)===null||t===void 0?void 0:t.value);var o=stripeStore.stripeAddressEventData&&JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeAddressEventData.value))!==JSON.stringify(stripeStore.stripeAddressUsedWhenFetchingLC);var n=!stripeStore.stripeShippingSameAsBilling&&stripeStore.stripeBillingAddressEventData&&JSON.stringify(buildAddressForLCPrefetch(stripeStore.stripeBillingAddressEventData.value))!==JSON.stringify(stripeStore.stripeBillingAddressUsedWhenFetchingLC);return r||o||n};var isPrefetchInfoOutdated=function(){var e;var t=cartStore.landedCostData&&((e=cartStore.landedCostData.find(Boolean))===null||e===void 0?void 0:e.subtotals.items)!==cartStore.subtotal;var r=checkIsAddressOutdatedForLCPrefetch();log("isPrefetchInfoOutdated","info",{isAddressOutdated:r});return!cartStore.landedCostData&&!stripeStore.isFetchingLandedCost||r||t};var getCountryField=function(e){var t,r;var o=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.countryFields;var n=(r=zonosStore.genericSettings)===null||r===void 0?void 0:r.stripeCountryFieldLabels;var i=n&&e in n?n[e]:null;var a=o&&e in o?o[e]:null;if(cartStore.addressFormRenderType==="stripe"){return i||a}return a};var isAddressReadyToRequestLandedCost=function(){var e,t,r,o;var n=!!((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.complete);var i=!!((t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.complete);var a=stripeStore.stripeShippingSameAsBilling?i:!!((r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.complete);var s=((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US";var d=getCountryField(s);if(i&&a&&n){return true}if(!d||!stripeStore.stripeAddressEventData){return i&&a&&n}var c=stripeStore.stripeAddressEventData.value.address.line1.length>0;var l=stripeStore.stripeAddressEventData.value.firstName&&stripeStore.stripeAddressEventData.value.lastName;var u=!d.stateRequired||d.stateRequired&&stripeStore.stripeAddressEventData.value.address.state.length>0;var v=!d.zipRequired||d.zipRequired&&stripeStore.stripeAddressEventData.value.address.postal_code.length>=3;var S=stripeStore.stripeAddressEventData.value.phone&&stripeStore.stripeAddressEventData.value.phone.length>0;return n&&l&&c&&u&&v&&S};var stripeCalculateLandedCost=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,c,l;return __generator(this,(function(u){switch(u.label){case 0:t=new AbortController;stripeStore.fetchingLandedCostAbortController=t;cartStoreResetCartItems();return[4,calculateLandedCostNormalized(t)];case 1:r=u.sent(),o=r.checkoutSessionWorkflow,n=r.errors,i=r.itemCreateWorkflow,a=r.landedCostCalculateWorkflow,s=r.partyCreateWorkflow,d=r.shipmentRatingCalculateWorkflow;cartStore.customQuotingError=((e=n===null||n===void 0?void 0:n.find((function(e){var t;return((t=e.extensions)===null||t===void 0?void 0:t.ruleMessageType)==="CUSTOM"})))===null||e===void 0?void 0:e.message)||null;cartStore.shippingData=sortServiceLevelOptionsByAmount((d===null||d===void 0?void 0:d.filter(Boolean))||[]);cartStoreCheckItemRestrictions(i);stripeStore.fetchingLandedCostAbortController=null;cartStore.partiesData=(s===null||s===void 0?void 0:s.filter(Boolean))||[];cartStore.landedCostData=(o===null||o===void 0?void 0:o.map((function(e){var t=a===null||a===void 0?void 0:a.find((function(t){return(t===null||t===void 0?void 0:t.id)===e.landedCostId}));if(!t){return null}return Object.assign(Object.assign({},e),{landedCost:t})})).filter(Boolean))||[];c=storageStore.checkoutSessionId;if(o===null||o===void 0?void 0:o.length){void trackConversionEvent({checkoutSessionId:c,eventName:"checkout_quoteReceived"})}l=cartStore.promoCodeApplied&&!cartStore.landedCostData.find((function(e){var t;return(t=e.landedCost.appliedAdjustments)===null||t===void 0?void 0:t.find((function(e){return e.type==="PROMO_CODE"}))}));cartStore.promoCodeError=l;if(!l){sessionStorage.setItem("zonos--promo-code",cartStore.promoCode)}return[2]}}))}))};var stripeStorePrefetchLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l,u,v,S,p;return __generator(this,(function(f){switch(f.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=isPrefetchInfoOutdated();d=isAddressReadyToRequestLandedCost();if(!d){return[2,{isRequestNotReady:true}]}if(s){(t=stripeStore.fetchingLandedCostAbortController)===null||t===void 0?void 0:t.abort();stripeStore.fetchingLandedCostAbortController=null}if(!s&&!a){return[2,{isRequestNotReady:false}]}if(i){stripeStore.isFetchingLandedCost=false;setTimeout((function(){stripeStore.isFetchingLandedCost=true}),300)}else{stripeStore.isFetchingLandedCost=true}if(stripeStore.stripeAddressEventData){stripeStore.stripeAddressUsedWhenFetchingLC={countryCode:stripeStore.stripeAddressEventData.value.address.country,postalCode:stripeStore.stripeAddressEventData.value.address.postal_code,state:stripeStore.stripeAddressEventData.value.address.state}}if(stripeStore.stripeBillingAddressEventData){stripeStore.stripeBillingAddressUsedWhenFetchingLC={countryCode:stripeStore.stripeBillingAddressEventData.value.address.country,postalCode:stripeStore.stripeBillingAddressEventData.value.address.postal_code,state:stripeStore.stripeBillingAddressEventData.value.address.state}}if(stripeStore.stripeLinkEventData){stripeStore.stripeLinkUsedWhenFetchingLC=Object.assign({},stripeStore.stripeLinkEventData)}f.label=1;case 1:f.trys.push([1,3,,7]);cartStoreResetCartItems();return[4,stripeCalculateLandedCost()];case 2:f.sent();c=(r=cartStore.shippingData)===null||r===void 0?void 0:r.find(Boolean);l=(o=cartStore.landedCostData)===null||o===void 0?void 0:o.find((function(e){return e.landedCost.shipmentRating.id===(c===null||c===void 0?void 0:c.id)}));u=!!l?l.subtotals:null;if(u){cartStoreApplySubtotals({method:(l===null||l===void 0?void 0:l.landedCost.method)||"DDP",subtotals:u})}return[3,7];case 3:v=f.sent();cartStore.landedCostData=[];cartStore.shippingData=[];S=["The landed cost calculation request was aborted to initiate a new one."];if(!(v instanceof Error&&v.message&&!S.includes(v.message)))return[3,6];if(!(i<1))return[3,5];return[4,stripeStorePrefetchLandedCost(Object.assign(Object.assign({},e),{retries:(i||0)+1}))];case 4:f.sent();return[2,{isRequestNotReady:false}];case 5:p=(n=stripeStore.stripeAddressEventData)===null||n===void 0?void 0:n.value;void sendErrorLog({endpoint:"Failed to fetch landed cost (".concat(i," retries)"),errors:[v.message],metadata:{cartId:window.Zonos.cartId,shipToAddress:p}});f.label=6;case 6:logError(v);return[3,7];case 7:stripeStore.isFetchingLandedCost=false;return[2,{isRequestNotReady:false}]}}))}))};var stripeStoreApplyPromoCode=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(n){switch(n.label){case 0:return[4,stripeStorePrefetchLandedCost({applyingPromocode:true})];case 1:n.sent();if(cartStore.step==="payment"){cartStorePreviousStep()}return[4,stripeStoreAsyncAddressUpdate()];case 2:n.sent();r=(e=cartStore.shippingData)===null||e===void 0?void 0:e.find(Boolean);o=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCost.id===(r===null||r===void 0?void 0:r.id)}));if(!r||!o){return[2]}return[4,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:false,landedCostId:o.landedCostId,selectedShippingOption:r})];case 3:n.sent();return[2]}}))}))};var stripeStoreResetPromoCode=function(){cartStore.promoCode="";sessionStorage.removeItem("zonos--promo-code");cartStore.promoCodeError=false;cartStore.promoCodeApplied=false};var stripeStoreRemovePromoCode=function(){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(cartStore.step==="payment"){cartStorePreviousStep()}stripeStoreResetPromoCode();return[4,stripeStoreApplyPromoCode()];case 1:e.sent();return[2]}}))}))};var stripeStoreMessageBasedOnStatus=function(e){var t=[];var r=true;var o=window.Zonos.isCollect;switch(e){case"succeeded":{t=[translate("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."),"",translate("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(o){t=[translate("Thank you for submitting your payment. We appreciate your prompt attention."),"",translate("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.")]}r=false;break}case"requires_capture":case"processing":{t=[translate("Payment processing. We'll update you when payment is received.")];r=false;break}case"requires_payment_method":{t=[translate("Payment failed. Please try another payment method.")];if(o){t=[translate("Payment failed. Please reload the page and try another payment method.")]}break}case"requires_action":{r=false;t=[translate("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.")]}default:{t=[translate("Something went wrong.")];break}}return{isError:r,messages:t}};var stripeStoreHandleInventoryCheck=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s,d,s;return __generator(this,(function(c){switch(c.label){case 0:r=zonosStore.checkoutSettings.onInventoryCheck;o=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!(window.Zonos.isLegacyCheckout&&window.Zonos.cartData&&o))return[3,2];return[4,handleFetch("/api/zonos-elements/legacy/inventory-check",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:n=c.sent(),i=n.errors,a=n.json;if(i.length||!a){logError("Error occurs when handling inventory refund","warn",JSON.stringify(i));return[2,null]}if(!a.available||a.status===204){return[2,translate("The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.")]}if(a.available||a.status===200){stripeStore.shouldInventoryRefund=true;return[2,null]}return[2,null];case 2:if(typeof r!=="function"){return[2,null]}c.label=3;case 3:c.trys.push([3,5,,6]);return[4,r({items:cartStore.items})];case 4:s=c.sent();return[2,s];case 5:d=c.sent();s=d instanceof Error?d.message:"Unknown error";void sendErrorLog({endpoint:"onInventoryCheck",errors:["cartId: ".concat(window.Zonos.cartId," - ").concat(s)],metadata:{cartId:window.Zonos.cartId,href:window.location.href,items:cartStore.items}});throw d;case 6:return[2]}}))}))};var stripeStoreHandleInventoryRefund=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r;return __generator(this,(function(o){switch(o.label){case 0:r=!!((t=(e=window.Zonos.cartData)===null||e===void 0?void 0:e.metadata.find((function(e){return e.key==="referenceId"})))===null||t===void 0?void 0:t.value);if(!window.Zonos.isLegacyCheckout||!window.Zonos.cartData||!r){return[2]}return[4,handleFetch("/api/zonos-elements/legacy/inventory-refund",{body:{cartData:window.Zonos.cartData},method:"POST"})];case 1:o.sent();return[2]}}))}))};var stripeStoreRetrievePayment=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c;var l=e.clientSecret,u=e.storybookForceStatus;return __generator(this,(function(e){switch(e.label){case 0:if(u){t=stripeStoreMessageBasedOnStatus(u),r=t.isError,o=t.messages;return[2,{error:r,messages:o}]}n=l||stripeStore.clientSecret;if(!stripeStore.stripe||!n){logError("Failed to retrieve payment intent. Stripe is not initialized");return[2,{error:true,message:[translate("Something went wrong.")]}]}return[4,stripeStore.stripe.retrievePaymentIntent(n)];case 1:i=e.sent().paymentIntent;a=i===null||i===void 0?void 0:i.status;s=stripeStoreMessageBasedOnStatus(a),d=s.isError,c=s.messages;return[2,{error:d,messages:c,paymentIntentId:i===null||i===void 0?void 0:i.id,paymentMethod:i===null||i===void 0?void 0:i.payment_method,status:a}]}}))}))};var stripeStoreConfirmPayment=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,o,n,i,a,s,d,c,l,u,v;return __generator(this,(function(S){switch(S.label){case 0:o=!!((t=stripeStore.stripePaymentEventData)===null||t===void 0?void 0:t.complete);n=stripeStore.stripeElements;i=stripeStore.stripe;a=stripeStore.clientSecret;stripeStore.customErrorMessage=null;if(!((r=cartStore.selectedLandedCost)===null||r===void 0?void 0:r.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,validateCheckoutSession()];case 1:s=S.sent();if(!s.valid){stripeStore.customErrorMessage=s.errorMessage;throw new Error(s.errorMessage)}d=storageStore.checkoutSessionId;if(!(i&&n&&o&&a&&d))return[3,3];c=new URL(window.location.href);c.searchParams.set("payment_intent_client_secret",a);c.searchParams.set("zonosCheckoutSessionId",d);void trackConversionEvent({checkoutSessionId:d,eventName:"checkout_paymentInfoCompleted"});return[4,i.confirmPayment({confirmParams:{return_url:c.toString()},elements:n,redirect:"if_required"})];case 2:l=S.sent(),u=l.error,v=l.paymentIntent;log("Payment intent confirmed","info",{error:u,paymentIntent:v});if((v===null||v===void 0?void 0:v.status)==="requires_action"){throw new Error(translate("Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction."))}if(u){if(u.type==="card_error"||u.type==="validation_error"){throw new Error(u.message)}if(u.type==="invalid_request_error"){if(u.code==="payment_intent_unexpected_state"){return[2]}}throw new Error("An unexpected error occurred.")}if(v.status==="requires_payment_method"){throw new Error(translate("Payment failed. Please try another payment method."))}S.label=3;case 3:return[2]}}))}))};var getCheckoutSessionBody=function(){var e;var t=cartStore.items.reduce((function(e,t){return e+t.amount*t.quantity}),0);var r=storageStore.enabledVariantTestKeys||[];var o={adjustmentsAmount:cartStore.adjustments.reduce((function(e,t){return e+t.amount}),0),cartId:window.Zonos.cartId,currency:((e=cartStore.items.find(Boolean))===null||e===void 0?void 0:e.currencyCode)||"",customerAuthenticationToken:cartStore.customerAuthenticationToken||undefined,isCollect:window.Zonos.isCollect,itemsAmount:t,metadata:[{key:"language",value:localizationStore.selectedLocale}],presentmentCountryCode:localizationStore.selectedCountryCode,skipPaymentIntent:stripeStore.skipPaymentIntent,varianceTestInput:r};return o};var stripeStoreGetPaymentIntent=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n;return __generator(this,(function(i){switch(i.label){case 0:if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"Error creating payment intent",errors:["No checkout session id found when retrieving payment intent"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2]}return[4,handleFetch("/api/zonos-elements/create-payment-intent",{body:{checkoutSessionId:storageStore.checkoutSessionId},method:"POST"})];case 1:t=i.sent(),r=t.errors,o=t.json;n=(e=o===null||o===void 0?void 0:o.checkoutSessionPaymentIntentCreate)===null||e===void 0?void 0:e.clientSecret;if(r.length||!n){logError("Error occurs when getting payment intent",JSON.stringify(r,null,2));void sendErrorLog({endpoint:"Error creating payment intent",errors:r.map((function(e){return e.message})),metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,clientSecret:n}});cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2]}cartStoreSetCheckoutSession(o.checkoutSessionPaymentIntentCreate);return[2]}}))}))};var stripeStoreInitCheckoutSession=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r,o,n,i,a,s;return __generator(this,(function(d){switch(d.label){case 0:if(!localizationStore.targetCurrency){logError("Failed to create checkout session - missing localizationStore.targetCurrency");return[2,false]}stripeStore.isFetchingSession=true;r=getCheckoutSessionBody();log("Checkout session body","info",r);return[4,handleFetch("/api/zonos-elements/create-checkout-session",{body:r,method:"POST"})];case 1:o=d.sent(),n=o.errors,i=o.json;stripeStore.isFetchingSession=false;if(n.length||!i){a=(e=n.find((function(e){return e.message})))===null||e===void 0?void 0:e.message;if(Array.isArray(a)&&a.some((function(e){return e.message==="Cart is expired."}))){throw new Error("Cart is expired.")}logError("Error occurred when creating checkout session",JSON.stringify(n,null,2));return[2,false]}s=i.checkoutSessionCreate;cartStoreSetCheckoutSession(s);cartStoreApplySubtotals({method:((t=s.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:s.subtotals});log("Exchange rate updated for cart items (checkout session create)","info",cartStore.exchangeRate);log("done-init-checkout-session");return[2,true]}}))}))};var stripeStoreUpdateCheckoutSessionBaseCurrency=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,r;return __generator(this,(function(o){switch(o.label){case 0:e=storageStore.checkoutSessionId;if(!e){logError("Failed to update checkout session base currency");return[2,false]}if(zonosStore.checkoutSettings.allowedSettlementCurrencies==="LOCAL"){log('allowedSettlementCurrencies: "LOCAL". Skip updating checkout session base currency');return[2,true]}return[4,handleFetch("/api/zonos-elements/update-checkout-session-base-currency",{body:{checkoutSessionId:e,currencyCode:stripeStore.checkoutSettlementCurrency},method:"POST"})];case 1:t=o.sent().json;r=t===null||t===void 0?void 0:t.checkoutSessionBaseCurrencyUpdate.subtotals.presentmentCurrencyCode;if(!t||r!==stripeStore.checkoutSettlementCurrency){logError("Failed to update checkout session base currency");return[2,false]}log('Updated checkout session to settlement currency "'.concat(r,'".'));return[2,true]}}))}))};var stripeStoreUpdateCheckoutSession=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n;var i=e.adjustmentsAmount,a=e.cartId,s=e.currency,d=e.id,c=e.itemsAmount,l=e.landedCostId,u=e.presentmentCountryCode;return __generator(this,(function(e){switch(e.label){case 0:t=storageStore.enabledVariantTestKeys||[];return[4,handleFetch("/api/zonos-elements/update-checkout-session",{body:{adjustmentsAmount:i,billToPartyId:stripeStore.partyBillingId,cartId:a,currency:s,customerAuthenticationToken:cartStore.customerAuthenticationToken||undefined,id:d,itemsAmount:c,landedCostId:l,metadata:[{key:"language",value:localizationStore.selectedLocale}],presentmentCountryCode:u,shipToPartyId:stripeStore.partyShippingId,skipPaymentIntent:stripeStore.skipPaymentIntent,varianceTestInput:t},method:"POST"})];case 1:r=e.sent(),o=r.errors,n=r.json;if(o.length||!n){logError("Error occurs when updating checkout session",JSON.stringify(o,null,2));return[2,{errors:o,json:n}]}return[2,{errors:[],json:n}]}}))}))};var buildTranslatedAddress=function(e){var t,r,o,n,i,a;var s=e.currentAddress,d=e.translatedAddressResult;var c={};if(!d){return c}var l=d.city,u=d.line1,v=d.line2,S=d.name,p=d.postal_code,f=d.state;if(s.city&&l){c.city=(t={},t[s.city]=l,t)}if(s.line1&&u){c.line1=(r={},r[s.line1]=u,r)}if(s.line2&&v){c.line2=(o={},o[s.line2]=v,o)}if(s.postal_code&&p){c.postal_code=(n={},n[s.postal_code]=p,n)}if(s.state&&f){c.state=(i={},i[s.state]=f,i)}if(s.name&&S){c.name=(a={},a[s.name]=S,a)}return c};var stripeStoreTranslateAddressToLatin=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l,u;var v=e.addressInvalidCharactersList,S=e.billingAddressInvalidCharactersList;return __generator(this,(function(e){switch(e.label){case 0:i=buildTranslateRequest({addressInvalidCharactersList:v,billingAddressInvalidCharactersList:S,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeBillingAddressEventData:stripeStore.stripeBillingAddressEventData,stripeShippingSameAsBilling:stripeStore.stripeShippingSameAsBilling});if(!i){stripeStore.translatedAddress={address:{},billingAddress:{}};return[2]}a=checkIsAddressOutdatedForValidation();if(!a){return[2]}return[4,handleFetch("/api/zonos-elements/validate-address",{body:i,method:"POST"})];case 1:s=e.sent(),d=s.errors,c=s.json;if(d.length||!c){logError("Error occurs when translating address to latin",JSON.stringify(d,null,2));stripeStore.translatedAddress={address:{},billingAddress:{}};return[2]}stripeStore.stripeAddressUsedWhenValidatingAddress=stripeStore.stripeAddressEventData;stripeStore.stripeBillingAddressUsedWhenValidatingAddress=stripeStore.stripeBillingAddressEventData;l=(t=stripeStore.stripeAddressEventData)===null||t===void 0?void 0:t.value.address;u=(r=stripeStore.stripeBillingAddressEventData)===null||r===void 0?void 0:r.value.address;stripeStore.translatedAddress={address:l?buildTranslatedAddress({currentAddress:Object.assign(Object.assign({},l),{name:(o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.name}),translatedAddressResult:c.address||null}):{},billingAddress:!stripeStore.stripeShippingSameAsBilling?buildTranslatedAddress({currentAddress:Object.assign(Object.assign({},u),{name:(n=stripeStore.stripeBillingAddressEventData)===null||n===void 0?void 0:n.value.name}),translatedAddressResult:c.billingAddress||null}):{}};return[2]}}))}))};stripeStoreOnChange("clientSecret",(function(e){if(e&&stripeStore.stripe){sessionStorage.setItem("zonos--client-secret",e)}if(!e){sessionStorage.removeItem("zonos--client-secret")}}));var _o=createStore((function(){return{addressFormRenderType:"stripe",adjustmentTotal:0,adjustments:[],checkoutSession:null,checkoutSessionTimeoutShow:false,checkoutTimeoutInterval:null,currency:"USD",customQuotingError:null,customerAuthenticationToken:null,displayBaseCurrency:false,dutiesTaxesFees:null,dutiesTaxesFeesEstimate:null,error:null,exchangeRate:null,externalConfirmationPageURL:null,inventoryCheckErrorMessage:null,isSelectedShippingAboveDeminimis:false,isSelectedShippingGuarantee:false,isStagingMode:getIsStagingMode(),items:[],landedCostData:null,landedCostMethod:"DDP",partiesData:[],promoCode:sessionStorage.getItem("zonos--promo-code")||"",promoCodeApplied:!!sessionStorage.getItem("zonos--promo-code"),promoCodeError:false,restrictedItems:[],selectedLandedCost:null,selectedShippingOption:null,selectedShippingOptionExpectedDate:"",selectedShippingOptionTransitTime:"",shipping:0,shippingData:null,shouldHideDiscountInput:false,step:"customer-info",subtotal:0,tabItems:{"customer-info":{index:1,isDone:false,label:"Customer",value:"customer-info"},shipping:{index:2,isDone:false,label:"Shipping",value:"shipping"},payment:{index:3,isDone:false,label:"Payment",value:"payment"}},total:0}})),cartStoreOnChange=_o.onChange,reset=_o.reset,cartStore=_o.state;var getTransitUnit=function(e){switch(e){case"DAYS":return translate("days");case"WEEKS":return translate("weeks");case"BUSINESS_DAYS":default:return translate("business days")}};var cartStoreGetShippingTransitInfo=function(e){var t;var r=(t=e.shippingProfile)===null||t===void 0?void 0:t.transitTime;if(!(r===null||r===void 0?void 0:r.min)||!(r===null||r===void 0?void 0:r.max)||!(r===null||r===void 0?void 0:r.type)){return null}return{maxTransit:r.max,minTransit:r.min,unit:getTransitUnit(r.type)}};var getMatchItem=function(e){var t=e.item1,r=e.item2;if(!t||!r){return false}return r.sku&&t.sku&&t.sku===r.sku||r.description&&t.description&&t.description===r.description||t.name&&r.name&&t.name===r.name};var cartStoreCheckItemRestrictions=function(e){log("Checking item restrictions");var t=e.map((function(e){if(!e.restriction){return null}var t=e.restriction;var r=cartStore.items.find((function(t){return getMatchItem({item1:t,item2:e})}));return Object.assign(Object.assign({matchedItem:r},e),{restriction:t})})).filter(Boolean);cartStore.restrictedItems=t;cartStore.items=cartStore.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:!!t.find((function(t){return getMatchItem({item1:t,item2:e})}))})}));return{cartItems:cartStore.items,restrictedItems:t}};var cartStoreReset=function(){storageStore.checkoutSessionId=null;reset()};var cartStoreUpdateToErrorState=function(e){var t=e.messages,r=e.title;cartStoreReset();stripeStoreReset();cartStore.step="error";cartStore.error={messages:t,title:r}};var cartStoreApplySubtotals=function(e){var t=e.dutiesTaxesFeesEstimate,r=e.method,o=e.subtotals;cartStore.exchangeRate=o.exchangeRate;cartStore.adjustmentTotal=o.adjustments;cartStore.dutiesTaxesFees=r==="DAP"?null:o.landedCostTotal;cartStore.subtotal=o.items;cartStore.total=o.total;cartStore.currency=o.presentmentCurrencyCode;cartStore.dutiesTaxesFeesEstimate=t||null};var cartStoreHasOneEligibleItem=function(){var e=cartStore.items.filter((function(e){return e.amount>0}));return!!e.find((function(e){return!e.isRestricted}))};var cartStoreSetCheckoutSession=function(e){var t,r,o,n,i;stripeStore.clientSecret=e.clientSecret;stripeStore.stripeCustomerSessionClientSecret=e.customerSessionClientSecret;stripeStore.customerProfile=e.customerProfile;cartStore.checkoutSession=e;if(!e.id){void sendErrorLog({endpoint:"cartStoreSetCheckoutSession",errors:["Missing checkout session id in checkout session"],metadata:{allLogs:allLogs,checkoutSession:e}})}if(e.id){storageStore.checkoutSessionId=e.id}var a=filterValidTests(e.varianceTestResults||[]);storageStoreSetEnabledVariantTestKeys(a);var s=((o=(r=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.metadata)===null||r===void 0?void 0:r.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||o===void 0?void 0:o.value)||((i=(n=window.Zonos.cartData)===null||n===void 0?void 0:n.metadata.find((function(e){return(e===null||e===void 0?void 0:e.key)==="externalConfirmationPageURL"})))===null||i===void 0?void 0:i.value)||null;if(s){log("Found externalConfirmationPageURL: ".concat(s));cartStore.externalConfirmationPageURL=s}};var cartStoreReCalculateTotal=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a;var s=e.adjustmentsAmount,d=e.cartId,c=e.currency,l=e.dutiesTaxesFeesEstimate,u=e.itemsAmount,v=e.landedCostId,S=e.shouldInitSessionOnFailure;return __generator(this,(function(e){switch(e.label){case 0:if(v&&cartStore.selectedLandedCost){r=cartStore.selectedLandedCost.subtotals;cartStoreApplySubtotals({dutiesTaxesFeesEstimate:l,method:cartStore.landedCostMethod,subtotals:r});log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate)}if(!storageStore.checkoutSessionId){log("Could not update cart total without checkout session id","info");return[2,false]}return[4,stripeStoreUpdateCheckoutSession({adjustmentsAmount:s,billToPartyId:stripeStore.partyBillingId,cartId:d,currency:c,id:storageStore.checkoutSessionId,itemsAmount:u,landedCostId:v,presentmentCountryCode:localizationStore.selectedCountryCode,shipToPartyId:stripeStore.partyShippingId,varianceTestInput:storageStore.enabledVariantTestKeys||[]})];case 1:o=e.sent(),n=o.errors,i=o.json;if(!(n.length>0||!i))return[3,4];logError("Error occurs when updating checkout session.");if(!S)return[3,3];log("Initiating checkout session on failure","info");return[4,stripeStoreInitCheckoutSession()];case 2:a=e.sent();log("stripeStoreInitCheckoutSession: ".concat(a));if(!a){cartStoreUpdateToErrorState({messages:[translate("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:translate("Error creating Checkout")});return[2,false]}return[2,true];case 3:return[2,false];case 4:if(!v){cartStoreApplySubtotals({method:((t=i.checkoutSessionUpdate.landedCost)===null||t===void 0?void 0:t.method)||"DDP",subtotals:i.checkoutSessionUpdate.subtotals});log("Exchange rate updated for cart items (checkout session update)","info",cartStore.exchangeRate)}cartStoreSetCheckoutSession(i.checkoutSessionUpdate);return[2,true]}}))}))};var cartStoreGetMethod=function(e){var t,r,o;if(e.method==="DAP"&&((r=(t=zonosStore.genericSettings)===null||t===void 0?void 0:t.domesticCountries)===null||r===void 0?void 0:r.includes(((o=stripeStore.stripeAddressEventData)===null||o===void 0?void 0:o.value.address.country)||"US"))){return"DDP"}if(e.method==="DAP"&&e.remittance.length&&e.landedCostGuaranteeCode==="ZONOS"){return"DDP"}return e.method};var cartStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i,a,s,d,c,l,u,v,S,p,f,h,m,g,y,C,w,b,O,A,_;var k=e.applySubtotalsOnly,I=e.landedCostId,E=e.selectedShippingOption;return __generator(this,(function(e){switch(e.label){case 0:log("Updating selected shipping option","info",{landedCostId:I,selectedShippingOption:E});cartStore.selectedShippingOption=E;v=cartStoreGetShippingTransitInfo(cartStore.selectedShippingOption);if(v){S=v.maxTransit,p=v.minTransit,f=v.unit;cartStore.selectedShippingOptionTransitTime="".concat(p,"-").concat(S," ").concat(f)}else{cartStore.selectedShippingOptionTransitTime=""}h=(t=cartStore.landedCostData)===null||t===void 0?void 0:t.find((function(e){return e.landedCostId===I}));cartStore.selectedLandedCost=h||null;if(!h){return[2,false]}m=((r=h.landedCost.amountSubtotals)===null||r===void 0?void 0:r.landedCostTotal)||0;g=h.subtotals.exchangeRate.rate;y=m*g;if(y){log("DAP quote, using estimate: ".concat(y),"info")}cartStore.landedCostMethod=cartStoreGetMethod(h.landedCost);cartStore.shipping=h.subtotals.shipping;C=((o=h===null||h===void 0?void 0:h.landedCost)===null||o===void 0?void 0:o.landedCostGuaranteeCode)==="ZONOS";w=!!((i=(n=h===null||h===void 0?void 0:h.landedCost)===null||n===void 0?void 0:n.deMinimis)===null||i===void 0?void 0:i.find((function(e){return["DUTY","TAX"].includes(e.type)&&e.threshold==="ABOVE"})));cartStore.isSelectedShippingAboveDeminimis=w;cartStore.isSelectedShippingGuarantee=C;b=false;if(!k)return[3,1];O=h.subtotals;cartStoreApplySubtotals({dutiesTaxesFeesEstimate:y,method:cartStore.landedCostMethod,subtotals:O});log("Exchange rate updated for cart items (landed cost subtotal)","info",cartStore.exchangeRate);b=true;return[3,3];case 1:return[4,cartStoreReCalculateTotal({adjustmentsAmount:cartStore.adjustmentTotal,billToPartyId:stripeStore.partyBillingId,cartId:window.Zonos.cartId,dutiesTaxesFeesEstimate:y,landedCostId:(a=h.landedCost)===null||a===void 0?void 0:a.id,shipToPartyId:stripeStore.partyShippingId,varianceTestInput:storageStore.enabledVariantTestKeys||[]})];case 2:b=e.sent();e.label=3;case 3:A=(s=cartStore.items.find(Boolean))===null||s===void 0?void 0:s.currencyCode;_=((d=stripeStore.stripeAddressEventData)===null||d===void 0?void 0:d.value.address.country)||"US";stripeStore.shouldRenderPayInUsdButton=A==="USD"&&zonosStore.checkoutSettings.allowedSettlementCurrencies==="LOCAL_AND_USD"&&((c=cartStore.checkoutSession)===null||c===void 0?void 0:c.subtotals.presentmentCurrencyCode)!=="USD"&&!!((u=(l=zonosStore.genericSettings)===null||l===void 0?void 0:l.usdSettlementCountryEnabled)===null||u===void 0?void 0:u.includes(_));return[2,b]}}))}))};var cartStoreStartCheckoutInterval=function(e){var t=e.isPreview,r=e.sessionTimeout;if(t){return}var o=new URLSearchParams(window.location.search).get("zonosCheckoutTimeout");var n=o&&!isNaN(parseInt(o,10))?parseInt(o,10):r;log("==START CHECKOUT TIMEOUT - ".concat(n,"=="));cartStore.checkoutTimeoutInterval=setTimeout((function(){cartStore.checkoutSessionTimeoutShow=true}),n)};var cartStoreClearCheckoutInterval=function(){if(cartStore.checkoutTimeoutInterval){clearTimeout(cartStore.checkoutTimeoutInterval);cartStore.checkoutTimeoutInterval=null}};var getCartItemToUse=function(e){return e.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}))};var cartStoreResetCartItems=function(){cartStore.items=cartStore.items.map((function(e){return Object.assign(Object.assign({},e),{isRestricted:false})}));cartStore.restrictedItems=[]};var cartStoreUpdateItems=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n;var i=e.adjustments,a=e.cartItems,s=e.landedCostId,d=e.shouldInitSessionOnFailure,c=d===void 0?true:d;return __generator(this,(function(e){switch(e.label){case 0:cartStore.adjustments=i;cartStore.items=getCartItemToUse(a);r=(t=a.find(Boolean))===null||t===void 0?void 0:t.currencyCode;o=a.reduce((function(e,t){return e+t.amount*t.quantity}),0);n=i.reduce((function(e,t){return e+t.amount}),0);if(!r||!o){return[2]}cartStore.currency=r;stripeStore.isFetchingSession=true;return[4,cartStoreReCalculateTotal({adjustmentsAmount:n,billToPartyId:stripeStore.partyBillingId,cartId:window.Zonos.cartId,currency:r,dutiesTaxesFeesEstimate:0,itemsAmount:o,landedCostId:s,shipToPartyId:stripeStore.partyShippingId,shouldInitSessionOnFailure:c,varianceTestInput:storageStore.enabledVariantTestKeys||[]})];case 1:e.sent();stripeStore.isFetchingSession=false;return[2]}}))}))};var cartStoreResetSelectedShippingOption=function(){cartStore.selectedShippingOption=null;cartStore.isSelectedShippingAboveDeminimis=false;cartStore.isSelectedShippingGuarantee=false;cartStore.selectedShippingOptionTransitTime="";cartStore.dutiesTaxesFees=0;cartStore.dutiesTaxesFeesEstimate=0;cartStore.shipping=0;cartStore.total=cartStore.subtotal};var cartStorePreviousStep=function(){if(cartStore.step==="shipping"){cartStore.step="customer-info";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})})}else if(cartStore.step==="payment"){cartStore.step="shipping";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})})}else if(cartStore.step==="finish"){cartStore.step="payment";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{payment:Object.assign(Object.assign({},cartStore.tabItems.payment),{isDone:false})})}};var cartStoreNextStep=function(){if(cartStore.step==="customer-info"){cartStore.step="shipping";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems["customer-info"]),{isDone:true})})}else if(cartStore.step==="shipping"){cartStore.step="payment";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:true})})}else if(cartStore.step==="payment"){cartStore.step="finish"}};var cartStoreResetTabItems=function(){cartStore.step="customer-info";cartStore.tabItems=Object.assign(Object.assign({},cartStore.tabItems),{"customer-info":Object.assign(Object.assign({},cartStore.tabItems["customer-info"]),{isDone:false}),payment:Object.assign(Object.assign({},cartStore.tabItems.payment),{isDone:false}),shipping:Object.assign(Object.assign({},cartStore.tabItems.shipping),{isDone:false})});cartStoreResetSelectedShippingOption()};export{validateCheckoutSession as A,stripeStoreOnChange as B,stripeStoreBuildAddressForPartyCreate as C,cartStoreUpdateSelectedShippingOption as D,cartStoreHasOneEligibleItem as E,stripeStoreApplyPromoCode as F,stripeStoreRemovePromoCode as G,stripeStoreResetPromoCode as H,stripeStoreMessageBasedOnStatus as I,stripeStoreTranslateAddressToLatin as J,extractName as K,stripeStoreAsyncAddressUpdate as L,cartStoreGetShippingTransitInfo as M,cartStoreGetMethod as N,sortServiceLevelOptionsByAmount as O,stripeStoreCleanupDomesticShippingSession as a,stripeStoreSaveDomesticShippingSession as b,stripeStore as c,stripeStoreRetrievePayment as d,cartStore as e,cartStoreUpdateItems as f,cartStoreReset as g,cartStoreResetTabItems as h,initStripeElements as i,cartStoreClearCheckoutInterval as j,stripeStoreInitCheckoutSession as k,stripeStoreGetPaymentIntent as l,cartStoreStartCheckoutInterval as m,getCheckoutSessionBody as n,cartStoreUpdateToErrorState as o,cartStoreSetCheckoutSession as p,stripeStorePrefetchLandedCost as q,cartStoreNextStep as r,stripeStoreGetDomesticShippingSession as s,trackConversionEvent as t,stripeStoreUpdateCheckoutSessionBaseCurrency as u,stripeStoreHandleInventoryCheck as v,stripeStoreConfirmPayment as w,stripeStoreHandleInventoryRefund as x,stripeStoreReset as y,cartStoreOnChange as z};
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,r,t,n){function o(e){return e instanceof t?e:new t((function(r){r(e)}))}return new(t||(t=Promise))((function(t,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function u(e){try{c(n["throw"](e))}catch(e){a(e)}}function c(e){e.done?t(e.value):o(e.value).then(i,u)}c((n=n.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function u(e){return function(r){return c([e,r])}}function c(u){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,u[0]&&(t=0)),t)try{if(n=1,o&&(a=u[0]&2?o["return"]:u[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,u[1])).done)return a;if(o=0,a)u=[u[0]&2,a.value];switch(u[0]){case 0:case 1:a=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;o=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(a=t.trys,a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1];a=u;break}if(a&&t.label<a[2]){t.label=a[2];t.ops.push(u);break}if(a[2])t.ops.pop();t.trys.pop();continue}u=r.call(e,t)}catch(e){u=[6,e];o=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-b434e436.js";import{j as jsonParse,h as handleFetch,l as logError}from"./handleFetch-a844cac1.js";import{a as availableTestKeys,l as log}from"./VarianceTest-572cecf5.js";import{a as translationStoreUpdateLanguage}from"./translationStore-690c4e04.js";var hasAtLeastOneAvailableTestKey=function(e){var r=!!e.find((function(e){return e.testKey in availableTestKeys}));if(!r){log("No available test key found in response","info",{response:e})}return!!e.find((function(e){return e.testKey in availableTestKeys}))};var filterValidTests=function(e){if(!hasAtLeastOneAvailableTestKey(e)){return[]}return e.filter((function(e){var r;var t=availableTestKeys[e.testKey]&&!e.selectedVariantKey;var n=e.selectedVariantKey&&!!((r=availableTestKeys[e.testKey])===null||r===void 0?void 0:r["availableVariants"].includes(e.selectedVariantKey));return t||n})).map((function(e){return Object.assign(Object.assign({},e),{expiresAt:e.expiresAt||Date.now()+VARIANT_TEST_KEY_EXPIRATION,selectedVariantKey:e.selectedVariantKey||null})}))};var VARIANT_TEST_KEY_EXPIRATION=60*60*24*1e3;var _d=createStore({checkoutSessionId:sessionStorage.getItem("zonos--checkout-session-id"),enabledVariantTestKeys:jsonParse(localStorage.getItem("zonos--enabled-variant-test-keys"))}),storageStoreOnChange=_d.onChange,storageStore=_d.state;storageStoreOnChange("enabledVariantTestKeys",(function(){var e;if(!((e=storageStore.enabledVariantTestKeys)===null||e===void 0?void 0:e.length)){localStorage.removeItem("zonos--enabled-variant-test-keys");return}localStorage.setItem("zonos--enabled-variant-test-keys",JSON.stringify(storageStore.enabledVariantTestKeys))}));storageStoreOnChange("checkoutSessionId",(function(){if(!storageStore.checkoutSessionId){sessionStorage.removeItem("zonos--checkout-session-id");return}sessionStorage.setItem("zonos--checkout-session-id",storageStore.checkoutSessionId)}));var storageStoreSetEnabledVariantTestKeys=function(e){storageStore.enabledVariantTestKeys=filterValidTests(e)};var getCountries=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,n;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,handleFetch("/api/zonos-elements/get-countries",{method:"GET"})];case 1:e=o.sent(),r=e.errors,t=e.json;if(r.length||!t){return[2,null]}return[2,t];case 2:n=o.sent();return[2,null];case 3:return[2]}}))}))};var getCountryLandedCost=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r,t,n,o,a;return __generator(this,(function(i){switch(i.label){case 0:if(!e){return[2,null]}t="/api/zonos-elements/country-landed-cost/".concat(e);return[4,handleFetch(t)];case 1:n=i.sent(),o=n.errors,a=n.json;if(o.length||!a){logError("Error fetching country landed cost: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,a||null]}}))}))};var defaultUsExchangeRate={exchangeRate:{rate:1,targetFormat:{currencyCode:"USD",decimalDelimiter:".",scale:2,symbol:"$",symbolLocation:"before",thousandsDelimiter:","}},maxAge:null};var getExchangeRate=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r,t,n,o,a,i,u,c,l,s;var v=e.country,d=e.isGuaranteed,f=e.sourceCurrency,g=e.targetCurrency;return __generator(this,(function(e){switch(e.label){case 0:if(f===g&&!d){return[2,defaultUsExchangeRate]}t=new URLSearchParams;t.set("sourceCurrency",f);t.set("targetCurrency",g);t.set("isGuaranteed",String(d));t.set("country",v||"");return[4,handleFetch("/api/zonos-elements/exchange-rates?".concat(t.toString()))];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){logError("Error fetching country landed cost: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,defaultUsExchangeRate]}i=a.exchangeRateCreate,u=i.rate,c=i.targetFormat;l=a.maxAge;if(u){sessionStorage.setItem(v+"_rate",JSON.stringify(u));s={rate:u,targetFormat:c};return[2,{exchangeRate:s,maxAge:l}]}return[2,defaultUsExchangeRate]}}))}))};var getInclusivePriceConfigurations=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r,t,n,o;return __generator(this,(function(a){switch(a.label){case 0:if(!e){return[2,null]}return[4,handleFetch("/api/zonos-elements/inclusive-prices/".concat(e))];case 1:t=a.sent(),n=t.errors,o=t.json;if(n.length||!o){logError("Error fetching country inclusive price setting: ".concat((r=n.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}return[2,o||null]}}))}))};var getLocaleMessages=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r,t,n,o,a;var i=e.countryCode,u=e.localeTo,c=e.storeId;return __generator(this,(function(e){switch(e.label){case 0:t=new URLSearchParams;t.set("countryCode",i);t.set("storeId",c.toString());if(u){t.set("localeTo",u)}return[4,handleFetch("/api/zonos-elements/locale-messages?".concat(t.toString()))];case 1:n=e.sent(),o=n.errors,a=n.json;if(o.length||!a){logError("Error fetching exchange rate",(r=o.find(Boolean))===null||r===void 0?void 0:r.message);return[2,[]]}return[2,a.locale_countryCodesPage]}}))}))};var validateCountryCode=function(e){if(e&&/^[A-Z]{2}$/.test(e)){return e}return null};var getZCountryUrlParam=function(e){var r=new URLSearchParams(e||window.location.search);var t=function(e){var t=r.get(e);return validateCountryCode(t)};var n=t("zCountry");var o=t("country");var a=t("customerCountry");return n||o||a};var getOverridenZCountry=function(){var e=new URL(window.location.href);var r=window.sessionStorage.getItem("zonos--country");var t=getZCountryUrlParam(e.searchParams)||r;return t};var getLocalization=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,n,o,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,2,,3]);e=getOverridenZCountry();r=new URLSearchParams;if(e){r.set("zCountry",e)}return[4,handleFetch("/api/zonos-elements/localization?".concat(r.toString()))];case 1:t=i.sent(),n=t.errors,o=t.json;if(n.length||!o){return[2,{country:null,locale:null}]}return[2,{country:o.country,locale:o.locale}];case 2:a=i.sent();return[2,{country:null,locale:null}];case 3:return[2]}}))}))};var getShippingZones=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,n,o,a,i;return __generator(this,(function(u){switch(u.label){case 0:if((e=window.Zonos.cartSettings)===null||e===void 0?void 0:e.shippingZones){return[2,window.Zonos.cartSettings.shippingZones.flatMap((function(e){return e===null||e===void 0?void 0:e.countryCodes})).filter(Boolean)]}return[4,handleFetch("/api/zonos-elements/shipping-zones")];case 1:n=u.sent(),o=n.errors,a=n.json;if(o.length||!a){logError("Error fetching shipping zones: ".concat((r=o.find(Boolean))===null||r===void 0?void 0:r.message));return[2,null]}i=(t=a===null||a===void 0?void 0:a.shippingZones)===null||t===void 0?void 0:t.flatMap((function(e){return e===null||e===void 0?void 0:e.countryCodes})).filter(Boolean);return[2,i||null]}}))}))};var applyInclusiveEffectiveRate=function(e){var r=localizationStore.inclusivePricingConfigurations.find((function(e){return e.shipToCountry===localizationStore.selectedCountryCode}));if(!r){return e}var t=r.effectiveRate;return e*(1+t)};var currencyConvert=function(e){var r=localizationStore.exchangeRate;if(!r||!e||isNaN(e)){return e}var t=(r===null||r===void 0?void 0:r.targetFormat.scale)||2;var n=e*r.rate;var o=n.toFixed(t);return Number(o)};var numberFormat=function(e){var r=e.amount,t=e.currency,n=e.targetFormat;var o=t||localizationStore.targetCurrency;var a=(n===null||n===void 0?void 0:n.scale)||2;var i=window.navigator.userAgent.indexOf("MSIE ")!==-1;var u=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(i||!u){var c=Number(r).toFixed(a).replace(".","|dec|").replace(",",(n===null||n===void 0?void 0:n.thousandsDelimiter)||"").replace("|dec|",(n===null||n===void 0?void 0:n.decimalDelimiter)||"");return c}var l=new Intl.NumberFormat(window.navigator.language,{currency:o,currencyDisplay:"code",minimumFractionDigits:a,style:"currency"}).format(r);return l.replace(new RegExp("".concat(o,"\\s+")),"")};var currencyFormat=function(e){var r=e.amount,t=e.currency;if(isNaN(r)||r!==0&&!r){return""}var n=zonosStore.overrideCurrencyFormat;var o=localizationStore.exchangeRate;var a=t||localizationStore.targetCurrency;if(typeof n==="function"){return n({amount:r,currencyCode:a,numberFormat:function(e){var r=e.amount;return numberFormat({amount:r,currency:a,targetFormat:(o===null||o===void 0?void 0:o.targetFormat)||null})}})}var i=(o||{}).targetFormat;if(!i||!o){return"".concat(r.toFixed(2)," ").concat(a)}var u=i.scale||2;var c=window.navigator.userAgent.indexOf("MSIE ")!==-1;var l=typeof Intl==="object"&&Intl&&typeof Intl.NumberFormat==="function";if(c||!l){var s=Number(r).toFixed(u).replace(".","|dec|").replace(",",i.thousandsDelimiter||"").replace("|dec|",i.decimalDelimiter||"");var v="".concat(s).concat(i.currencyCode!=="USD"?" ".concat(i.currencyCode):"");return v}var d=(n===null||n===void 0?void 0:n.currencyDisplay)||"symbol";var f=new Intl.NumberFormat(window.navigator.language,{currency:a,currencyDisplay:d,minimumFractionDigits:u,style:"currency"}).format(r);var g=d==="code"?"".concat(f.replace(new RegExp("".concat(a,"\\s+")),"")," ").concat(a):f;return g};var currencyConvertAndFormat=function(e){var r=currencyConvert(e);var t=currencyFormat({amount:r});return t};var isValidSelector=function(e){try{document.createDocumentFragment().querySelector(e)}catch(e){return false}return true};var getCurrencyElements=function(e){var r=e||".money";if(!isValidSelector(r)){logError('Currency element selector "'.concat(r,'" is not valid.'));return null}var t=document.querySelectorAll(r);if(!t.length){log('No currency elements found with selector "'.concat(r,'"'),"warn");return null}return Array.from(t)};var getInitialElementAmount=function(e){var r;var t=e.getAttribute("data-domestic");var n=e.getAttribute("data-zintl");var o=(r=e.textContent)===null||r===void 0?void 0:r.replace(/[^\d.-]/g,"");if(!o){return null}if(!t||e.textContent!==n&&n){e.setAttribute("data-domestic",o);return parseFloat(o)}return parseFloat(t)};var BLUR_CURRENCY_DURATION=7e3;var BLUR_CURRENCY_CLASSNAME="z--blur";var removeBlurCurrency=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r;return __generator(this,(function(t){switch(t.label){case 0:e=window.zonosBlurCurrencyOnInitIntervalId;if(!e){return[2]}return[4,new Promise((function(e){return setTimeout(e,500)}))];case 1:t.sent();clearInterval(e);r=document.querySelectorAll(".".concat(BLUR_CURRENCY_CLASSNAME));r.forEach((function(e){e.classList.remove(BLUR_CURRENCY_CLASSNAME)}));window.zonosBlurCurrencyOnInitIntervalId=undefined;return[2]}}))}))};var removeBlurSpecificElement=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r=e.specificSelector,t=e.timeoutId;return __generator(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){return setTimeout(e,500)}))];case 1:e.sent();if(t){clearTimeout(t)}r.classList.remove(BLUR_CURRENCY_CLASSNAME);return[2]}}))}))};var blurCurrencyElements=function(e){var r=e.currencySelector,t=e.specificSelector;if(!r&&!t){return}if(t){t.classList.add(BLUR_CURRENCY_CLASSNAME)}else{var n=document.querySelectorAll([r].filter(Boolean).join(","));n.forEach((function(e){e.classList.add(BLUR_CURRENCY_CLASSNAME)}))}};var performBlurSpecificElement=function(e){if(typeof window==="undefined"){return}blurCurrencyElements({specificSelector:e});var r=setTimeout((function(){void removeBlurSpecificElement({specificSelector:e,timeoutId:r})}),BLUR_CURRENCY_DURATION);return r};var performBlurCurrency=function(){if(typeof window==="undefined"){return}if(window.zonosBlurCurrencyOnInitIntervalId){return}blurCurrencyElements({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});var e=setInterval((function(){blurCurrencyElements({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})}),10);window.zonosBlurCurrencyOnInitIntervalId=e;setTimeout((function(){void removeBlurCurrency()}),BLUR_CURRENCY_DURATION)};var convertCurrency=function(e){var r;var t=getInitialElementAmount(e);if(!t||isNaN(t)){return}var n=e.getAttribute("data-zintl");var o=parseFloat(e.getAttribute("data-zrate")||"1");var a=e.getAttribute("data-zcountry-code");var i=localizationStore.exchangeRate&&localizationStore.targetCurrency===localizationStore.exchangeRate.targetFormat.currencyCode;var u=((r=localizationStore.exchangeRate)===null||r===void 0?void 0:r.rate)||1;if(i&&(e.textContent!==n||u!==o||a!==localizationStore.selectedCountryCode)){var c=performBlurSpecificElement(e);var l=applyInclusiveEffectiveRate(t);var s=typeof zonosStore.currencyConverter==="function"&&zonosStore.currencyConverter({convert:currencyConvert,convertAndFormat:currencyConvertAndFormat,currencyCode:localizationStore.targetCurrency,format:function(e){return currencyFormat({amount:e})},originalAmount:l,selector:e});var v=s||currencyConvertAndFormat(l);if(v!==e.textContent){e.textContent=v}e.setAttribute("data-zrate",u.toString());e.setAttribute("data-zintl",v);e.setAttribute("data-zcountry-code",localizationStore.selectedCountryCode||"");void removeBlurSpecificElement({specificSelector:e,timeoutId:c})}};var defaultCurrencyConverter=function(){var e=zonosStore.helloSettings.currencyElementSelector;var r=getCurrencyElements(e);if(!(r===null||r===void 0?void 0:r.length)){return}if(!localizationStore.exchangeRate){logError("Could not display currency. Exchange rate and format data is not available.");return}r.forEach((function(e){convertCurrency(e)}))};var currencyDisplay=function(){if(zonosStore.helloSettings.currencyBehavior==="DISABLED"||window.Zonos.isLegacyCheckout){void removeBlurCurrency();return}defaultCurrencyConverter()};var getCurrencyCode=function(e){var r;var t=(r=localizationStore.shippingZoneCountries)===null||r===void 0?void 0:r[e];if(t){return t.currencyCode}return null};var setZCountryUrlParam=function(e){if(!e){return}var r=new URLSearchParams(window.location.search);var t=r.has("zCountry")||zonosStore.helloSettings.countryOverrideBehavior==="URL_PARAM";if(t){r.set("zCountry",e);var n="".concat(window.location.pathname,"?").concat(r.toString());window.history.replaceState(window.history.state,document.title,n)}};var _e=createStore({countryLandedCost:null,customMessages:[],exchangeRate:null,helloCountryList:null,inclusivePricingConfigurations:[],inclusivePricingIsFetching:false,isDisabledCountry:true,isShippableCountry:false,localizationLoaded:false,selectedCountryCode:null,selectedLocale:"en",shippingZoneCountries:null,targetCurrency:"USD"}),localizationDispose=_e.dispose,localizationStoreOnChange=_e.onChange,localizationStore=_e.state;var triggerGetExchangeRate=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r,t,n;return __generator(this,(function(o){switch(o.label){case 0:return[4,getExchangeRate({country:localizationStore.selectedCountryCode,isGuaranteed:e,sourceCurrency:zonosStore.sourceCurrency,targetCurrency:localizationStore.targetCurrency})];case 1:r=o.sent(),t=r.exchangeRate,n=r.maxAge;if(t){localizationStore.exchangeRate=t;currencyDisplay()}return[2,{maxAge:n}]}}))}))};var DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT="CA";var getFallbackDefaultCountryCode=function(e){if(localizationStore.selectedCountryCode&&e.includes(localizationStore.selectedCountryCode)){return localizationStore.selectedCountryCode}return DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT};var refreshInclusivePricingConfigurations=function(e){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(t){switch(t.label){case 0:if(!e){return[2]}localizationStore.inclusivePricingIsFetching=true;return[4,getInclusivePriceConfigurations(e)];case 1:r=t.sent();localizationStore.inclusivePricingConfigurations=r||[];localizationStore.inclusivePricingIsFetching=false;return[2]}}))}))};var startExchangeRateTimeout=function(e){var r=e.isGuaranteed,t=e.maxAge;if(localizationStore.exchangeRateTimeout){clearTimeout(localizationStore.exchangeRateTimeout)}var n=5*60;var o=t||n;localizationStore.exchangeRateTimeout=setTimeout((function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,refreshInclusivePricingConfigurations(localizationStore.selectedCountryCode)];case 1:t.sent();return[4,triggerGetExchangeRate(r)];case 2:e=t.sent().maxAge;startExchangeRateTimeout({isGuaranteed:r,maxAge:e});return[2]}}))}))}),o*1e3)};var getNewLocalization=function(e){return __awaiter(void 0,[e],void 0,(function(e){var r,t,n,o,a,i,u,c;var l=e.isInitializing;return __generator(this,(function(e){switch(e.label){case 0:log("get new localization store");n=localizationStore.isDisabledCountry,o=localizationStore.isShippableCountry,a=localizationStore.selectedCountryCode;if(zonosStore.helloSettings.currencyBehavior==="DISABLED"||!o||n||!a){return[2]}i=zonosStore.checkoutSettings.visibilityStatus==="ENABLED";performBlurCurrency();return[4,triggerGetExchangeRate(i)];case 1:u=e.sent().maxAge;startExchangeRateTimeout({isGuaranteed:i,maxAge:u});if(l&&((r=window.Zonos.cartSettings)===null||r===void 0?void 0:r.inclusivePriceConfigurations)){localizationStore.inclusivePricingConfigurations=((t=window.Zonos.cartSettings)===null||t===void 0?void 0:t.inclusivePriceConfigurations)||[];void removeBlurCurrency()}if(!!window.Zonos.isLegacyCheckout)return[3,3];localizationStore.inclusivePricingIsFetching=true;return[4,Promise.all([getCountryLandedCost(localizationStore.selectedCountryCode),refreshInclusivePricingConfigurations(localizationStore.selectedCountryCode)])];case 2:c=e.sent()[0];localizationStore.countryLandedCost=c;void removeBlurCurrency();return[3,4];case 3:log("Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout");e.label=4;case 4:return[2]}}))}))};var getCustomMessages=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r;return __generator(this,(function(t){switch(t.label){case 0:log("Getting custom messages for ".concat(localizationStore.selectedCountryCode));if(!localizationStore.selectedCountryCode||!zonosStore.storeId){return[2]}return[4,getLocaleMessages({countryCode:localizationStore.selectedCountryCode,localeTo:localizationStore.selectedLocale,storeId:zonosStore.storeId})];case 1:e=t.sent();r=e.flatMap((function(e){var r;return{countryCode:localizationStore.selectedCountryCode,message:(r=e.countryCodesPageMessageLinks.find(Boolean))===null||r===void 0?void 0:r.message.textTo,pageName:e.pageName}}));localizationStore.customMessages=r;return[2]}}))}))};var getOverrideLocale=function(){var e=new URL(window.location.href);var r=e.searchParams.get("zonosLocale");return r};var addInternationalHideClass=function(){if(localizationStore.isShippableCountry){document.body.classList.add("z-intl")}else{document.body.classList.remove("z-intl")}};var getValidCountryCode=function(e){if(e==="UK"){return"GB"}return e};var localizationStoreUpdateSelectedCountryCode=function(e){var r=e.isInitializing,t=e.newSelectedCountryCode;var n,o;log("Updating selected country code to ".concat(t));var a=!localizationStore.selectedCountryCode;localizationStore.selectedCountryCode=getValidCountryCode(t);var i=localizationStore.selectedCountryCode,u=localizationStore.shippingZoneCountries;var c=!!u&&!!i&&!!u[i]&&!zonosStore.disabledCountries.includes(i);localizationStore.isShippableCountry=c;log("".concat(localizationStore.selectedCountryCode," is a shippable country: ").concat(localizationStore.isShippableCountry));var l=!!i&&zonosStore.disabledCountries.includes(i);localizationStore.isDisabledCountry=l;log("".concat(localizationStore.selectedCountryCode," is a disabled country: ").concat(localizationStore.isDisabledCountry));addInternationalHideClass();if(!i){return}var s=getCurrencyCode(i);if(!a){(n=zonosStore.onCountryChange)===null||n===void 0?void 0:n.call(zonosStore,{countryCode:i,currencyCode:s,isShippableCountry:c})}if(!s){return}localizationStore.targetCurrency=s;void getNewLocalization({isInitializing:r});window.sessionStorage.setItem("zonos--country",i);setZCountryUrlParam(i);(o=document.querySelector("zonos-hello"))===null||o===void 0?void 0:o.setAttribute("z-country",i)};var initHelloCountryList=function(e){var r=zonosStore.helloSettings.showCountryList;var t=localizationStore.shippingZoneCountries;if(!r||r==="ONLY_SHIPPABLE"){localizationStore.helloCountryList=t;return}if(r==="ALL"){localizationStore.helloCountryList=e;return}localizationStore.helloCountryList=r.reduce((function(r,t){var n;var o=e===null||e===void 0?void 0:e[t];return o?Object.assign(Object.assign({},r),(n={},n[t]=o,n)):r}),{})};var updateCheckoutSessionLanguage=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t;return __generator(this,(function(n){switch(n.label){case 0:if(!storageStore.checkoutSessionId){return[2,null]}return[4,handleFetch("/api/zonos-elements/update-checkout-session-metadata",{body:{id:storageStore.checkoutSessionId,metadata:[{key:"language",value:localizationStore.selectedLocale}]},method:"POST"})];case 1:e=n.sent(),r=e.errors,t=e.json;if(r.length||!t){logError("Error occurs when updating checkout session",JSON.stringify(r,null,2));return[2,{errors:r,json:t}]}return[2,{errors:[],json:t}]}}))}))};var localizationStoreUpdateSelectedLocale=function(e){localizationStore.selectedLocale=e;translationStoreUpdateLanguage(e);void updateCheckoutSessionLanguage();void getCustomMessages()};var initLocalizationStore=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,r,t,n,o,a,i,u,c,l;return __generator(this,(function(s){switch(s.label){case 0:return[4,Promise.all([getCountries(),getShippingZones(),getLocalization()])];case 1:r=s.sent(),t=r[0],n=r[1],o=r[2];a=n===null||n===void 0?void 0:n.reduce((function(e,r){var n;var o=t===null||t===void 0?void 0:t[r];return o?Object.assign(Object.assign({},e),(n={},n[r]=o,n)):e}),{});localizationStore.shippingZoneCountries=a||null;localizationStore.inclusivePricingConfigurations=((e=window.Zonos.cartSettings)===null||e===void 0?void 0:e.inclusivePriceConfigurations)||[];initHelloCountryList(t||{});i=o.country,u=o.locale;log("Country code from localization: ".concat(i));log("Locale from localization: ".concat(u));localizationStoreUpdateSelectedCountryCode({isInitializing:true,newSelectedCountryCode:i||null});c=getOverrideLocale();localizationStoreUpdateSelectedLocale(c||u||"en");l=["dev.storybook.elements","dev.elements","dev.demo.elements","dev.dashboard"];if(!localizationStore.selectedCountryCode&&l.some((function(e){return window.location.origin.includes(e)}))){localizationStoreUpdateSelectedCountryCode({isInitializing:true,newSelectedCountryCode:"CA"})}localizationStore.localizationLoaded=true;return[2]}}))}))};export{VARIANT_TEST_KEY_EXPIRATION as V,localizationStoreUpdateSelectedCountryCode as a,storageStoreSetEnabledVariantTestKeys as b,localizationStoreOnChange as c,currencyFormat as d,getOverridenZCountry as e,filterValidTests as f,getZCountryUrlParam as g,initLocalizationStore as h,isValidSelector as i,setZCountryUrlParam as j,currencyDisplay as k,localizationStore as l,currencyConvertAndFormat as m,currencyConvert as n,applyInclusiveEffectiveRate as o,getFallbackDefaultCountryCode as p,storageStoreOnChange as q,localizationStoreUpdateSelectedLocale as r,storageStore as s};
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(r,t,e,n){function o(r){return r instanceof e?r:new e((function(t){t(r)}))}return new(e||(e=Promise))((function(e,a){function c(r){try{u(n.next(r))}catch(r){a(r)}}function i(r){try{u(n["throw"](r))}catch(r){a(r)}}function u(r){r.done?e(r.value):o(r.value).then(c,i)}u((n=n.apply(r,t||[])).next())}))};var __generator=this&&this.__generator||function(r,t){var e={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,c;return c={next:i(0),throw:i(1),return:i(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function i(r){return function(t){return u([r,t])}}function u(i){if(n)throw new TypeError("Generator is already executing.");while(c&&(c=0,i[0]&&(e=0)),e)try{if(n=1,o&&(a=i[0]&2?o["return"]:i[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,i[1])).done)return a;if(o=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:e.label++;return{value:i[1],done:false};case 5:e.label++;o=i[1];i=[0];continue;case 7:i=e.ops.pop();e.trys.pop();continue;default:if(!(a=e.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){e=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){e.label=i[1];break}if(i[0]===6&&e.label<a[1]){e.label=a[1];a=i;break}if(a&&e.label<a[2]){e.label=a[2];e.ops.push(i);break}if(a[2])e.ops.pop();e.trys.pop();continue}i=t.call(r,e)}catch(r){i=[6,r];o=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{e as cartStore}from"./cart-14f305b3.js";import{o as applyInclusiveEffectiveRate,d as currencyFormat,s as storageStore}from"./localization-c5029ffc.js";import{l as logError,h as handleFetch}from"./handleFetch-a844cac1.js";var getDisplayCurrency=function(){var r,t;var e=cartStore.displayBaseCurrency;var n=e&&((r=cartStore.exchangeRate)===null||r===void 0?void 0:r.sourceCurrencyCode)?(t=cartStore.exchangeRate)===null||t===void 0?void 0:t.sourceCurrencyCode:cartStore.currency;return n};var renderCheckoutCurrency=function(r){var t=r.amount,e=r.isForeign;var n,o;var a=((n=cartStore.exchangeRate)===null||n===void 0?void 0:n.rate)||1;var c=e?t:applyInclusiveEffectiveRate(t);var i=cartStore.currency;var u=(o=cartStore.items[0])===null||o===void 0?void 0:o.currencyCode;if(u===i){return currencyFormat({amount:c,currency:i})}var s=cartStore.displayBaseCurrency;var l=getDisplayCurrency();if(e){var f=s?c/a:c;return currencyFormat({amount:f,currency:l})}var d=s?c:c*a;return currencyFormat({amount:d,currency:l})};var placeTestOrder=function(){return __awaiter(void 0,void 0,void 0,(function(){var r,t,e,n,o,a,c,i,u;return __generator(this,(function(s){switch(s.label){case 0:e=(r=cartStore.partiesData.find((function(r){return r.type==="DESTINATION"})))===null||r===void 0?void 0:r.id;n=(t=cartStore.partiesData.find((function(r){return r.type==="PAYOR"})))===null||t===void 0?void 0:t.id;o=storageStore.checkoutSessionId;if(!o||!n||!e){logError("Missing required data",{billToPartyId:n,checkoutSessionId:o,shipToPartyId:e});return[2,{errors:["Missing required data"],json:null}]}a={billToPartyId:n,checkoutSessionId:o,shipToPartyId:e};return[4,handleFetch("/api/zonos-elements/place-test-order",{body:a,method:"POST"})];case 1:c=s.sent(),i=c.errors,u=c.json;if(i.length||!u){logError("Error occurs when placing test order",i);return[2,{errors:i.map((function(r){return r.message})),json:null}]}return[2,{errors:[],json:u}]}}))}))};export{placeTestOrder as p,renderCheckoutCurrency as r};
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,o,r){function n(e){return e instanceof o?e:new o((function(t){t(e)}))}return new(o||(o=Promise))((function(o,i){function l(e){try{s(r.next(e))}catch(e){i(e)}}function a(e){try{s(r["throw"](e))}catch(e){i(e)}}function s(e){e.done?o(e.value):n(e.value).then(l,a)}s((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,l;return l={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(l[Symbol.iterator]=function(){return this}),l;function a(e){return function(t){return s([e,t])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(l&&(l=0,a[0]&&(o=0)),o)try{if(r=1,n&&(i=a[0]&2?n["return"]:a[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;if(n=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;n=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e];n=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-b434e436.js";import{c as stripeStore,C as stripeStoreBuildAddressForPartyCreate,e as cartStore,D as cartStoreUpdateSelectedShippingOption}from"./cart-14f305b3.js";import{s as storageStore}from"./localization-c5029ffc.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-a844cac1.js";import{b as allLogs}from"./VarianceTest-572cecf5.js";import{h}from"./index-0bbe9693.js";var _k=createStore((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}})),collectStoreReset=_k.reset,collectStore=_k.state;var collectStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,o,r,n,i,l,a,s,c,d,u,p,S;var f=e.landedCostId,v=e.retries,h=v===void 0?5:v;return __generator(this,(function(e){switch(e.label){case 0:collectStore.isFetchingShippingInfo=true;return[4,handleFetch("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:f},method:"POST"})];case 1:d=e.sent();if(!d.errors.length)return[3,4];if(!(h>0))return[3,3];return[4,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:e.sent();return[2,collectStoreInitShippingInfo({landedCostId:f,retries:h-1})];case 3:return[2,null];case 4:collectStore.landedCostShortId=((t=d.json)===null||t===void 0?void 0:t.landedCostShortId)||null;collectStore.isFetchingShippingInfo=false;collectStore.shippingAddress=((o=d.json)===null||o===void 0?void 0:o.shipping)||null;u=(r=cartStore.checkoutSession)===null||r===void 0?void 0:r.landedCost;p=(n=cartStore.checkoutSession)===null||n===void 0?void 0:n.subtotals;S=(((i=u===null||u===void 0?void 0:u.amountSubtotals)===null||i===void 0?void 0:i.shipping)||0)+(((l=u===null||u===void 0?void 0:u.amountSubtotals)===null||l===void 0?void 0:l.items)||0);collectStore.amountTotalPaid=S*(((a=p===null||p===void 0?void 0:p.exchangeRate)===null||a===void 0?void 0:a.rate)||1);collectStore.amountDutyTaxFeeTotal=((p===null||p===void 0?void 0:p.duties)||0)+((p===null||p===void 0?void 0:p.taxes)||0)+((p===null||p===void 0?void 0:p.fees)||0);collectStore.originCompanyName=((c=(s=d.json)===null||s===void 0?void 0:s.origin)===null||c===void 0?void 0:c.companyName)||null;if(collectStore.amountTotalPaid===0){void sendErrorLog({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:f,organizationId:zonosStore.organizationId}})}return[2]}}))}))};var collectStoreAsyncAddressUpdate=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t,o,r,n,i,l,a,s,c;return __generator(this,(function(d){switch(d.label){case 0:if(!((e=stripeStore.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2,{partiesCreated:false}]}n=(o=(t=cartStore.checkoutSession)===null||t===void 0?void 0:t.landedCost)===null||o===void 0?void 0:o.rootId;if(!n){void sendErrorLog({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId}});return[2,{partiesCreated:false}]}if(!storageStore.checkoutSessionId){void sendErrorLog({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,landedCostRootId:n}});return[2,{partiesCreated:false}]}i=stripeStoreBuildAddressForPartyCreate({address:stripeStore.stripeBillingAddressEventData.value.address,firstName:stripeStore.stripeBillingAddressEventData.value.firstName,lastName:stripeStore.stripeBillingAddressEventData.value.lastName,name:stripeStore.stripeBillingAddressEventData.value.name,phone:stripeStore.stripeBillingAddressEventData.value.phone});l=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4,handleFetch("/api/zonos-elements/create-billing-party",{body:{billingAddress:i,checkoutSessionId:storageStore.checkoutSessionId,companyName:stripeStore.companyName,email:((r=stripeStore.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:l,rootId:n},method:"POST"})];case 1:a=d.sent(),s=a.errors,c=a.json;if(s.length||!c){logError("Error occurs when creating billing party",JSON.stringify(s,null,2));void sendErrorLog({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:allLogs,cartId:window.Zonos.cartId,checkoutSessionId:storageStore.checkoutSessionId,errors:s,json:c}});return[2,{partiesCreated:false}]}collectStore.partyBillingId=c.billToPartyId;return[2,{partiesCreated:true}]}}))}))};var collectStoreUpdateSelectedShippingOption=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(o){t=e.landedCost;if(!t){return[2,false]}cartStore.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},t),landedCostId:t.id})];return[2,cartStoreUpdateSelectedShippingOption({applySubtotalsOnly:true,landedCostId:t.id,selectedShippingOption:t.shipmentRating})]}))}))};var collectTabletBreakpoint=1024;var collectMobileBreakpoint=768;var isCollectTablet=function(e){return e||window.innerWidth<collectTabletBreakpoint&&window.innerWidth>=collectMobileBreakpoint};var isCollectMobile=function(e){return e||window.innerWidth<collectMobileBreakpoint};var renderFallback=function(e){var t=e.content,o=e.isLoading,r=e.skeletonHeight,n=e.skeletonWidth;if(o){return h("zonos-skeleton",{skeletonHeight:r,skeletonWidth:n})}return t};export{isCollectTablet as a,collectStoreInitShippingInfo as b,collectStoreUpdateSelectedShippingOption as c,collectStoreAsyncAddressUpdate as d,collectStore as e,isCollectMobile as i,renderFallback as r};
@@ -1 +0,0 @@
1
- import{e as euCountryCodes,c as countryRequireTaxId}from"./TaxId-50d72254.js";var isTextContainsNonLatinChars=function(n){var r=/[ʼˮ՚ߴߵ']{1}/u;var t=/[^\p{Script=Latin}\p{P}\p{S}\p{N}\p{Z}\p{C}\p{M}]{1}/u;return t.test(n)&&!r.test(n)};var containsNonLatinChars=function(n){var r=Object.entries(n).reduce((function(n,r){var t;var a=r[0],e=r[1];return isTextContainsNonLatinChars(e)?Object.assign(Object.assign({},n),(t={},t[a]=true,t)):n}),{});return r};var isInTaxIdCountry=function(n){return countryRequireTaxId.includes(n)};var shouldRenderTaxIdInput=function(n){var r=n.companyName,t=n.countryCode;if(euCountryCodes.includes(t)){return r.trim().length>0}var a=isInTaxIdCountry(t);if(a){return true}return false};export{containsNonLatinChars as c,isTextContainsNonLatinChars as i,shouldRenderTaxIdInput as s};