@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,4 +1,69 @@
1
- import { c as createStore } from './zonosStore-b434e436.js';
1
+ import { c as createStore, z as zonosStore } from './zonosStore-b434e436.js';
2
+ import { j as jsonParse, h as handleFetch, l as logError } from './handleFetch-a844cac1.js';
3
+ import { a as availableTestKeys, l as log } from './VarianceTest-572cecf5.js';
4
+
5
+ /**
6
+ * Check if the response contains at least one available test key that we support
7
+ */
8
+ const hasAtLeastOneAvailableTestKey = (rawResponse) => {
9
+ const hasAvailableTestKey = !!rawResponse.find(item => item.testKey in availableTestKeys);
10
+ if (!hasAvailableTestKey) {
11
+ log('No available test key found in response', 'info', {
12
+ response: rawResponse,
13
+ });
14
+ }
15
+ return !!rawResponse.find(item => item.testKey in availableTestKeys);
16
+ };
17
+
18
+ /**
19
+ * Filter the response to only include test keys and variants key that we support
20
+ */
21
+ const filterValidTests = (testKeys) => {
22
+ // Type guard the response to ensure it matches the expected structure
23
+ if (!hasAtLeastOneAvailableTestKey(testKeys)) {
24
+ return [];
25
+ }
26
+ // Filter the response to only include test keys that we support
27
+ return testKeys
28
+ .filter(item => {
29
+ var _a;
30
+ const isTestKeyValidButNoSelectedVariantKey = availableTestKeys[item.testKey] && !item.selectedVariantKey;
31
+ const validTestKeyWithSelectedVariantKey = item.selectedVariantKey &&
32
+ !!((_a = availableTestKeys[item.testKey]) === null || _a === void 0 ? void 0 : _a['availableVariants'].includes(item.selectedVariantKey));
33
+ return (isTestKeyValidButNoSelectedVariantKey ||
34
+ validTestKeyWithSelectedVariantKey);
35
+ })
36
+ .map(item => (Object.assign(Object.assign({}, item), { expiresAt: item.expiresAt || Date.now() + VARIANT_TEST_KEY_EXPIRATION, selectedVariantKey: item.selectedVariantKey || null })));
37
+ };
38
+
39
+ /**
40
+ * Expiration time for variant test keys in milliseconds
41
+ * @default 1 day
42
+ */
43
+ const VARIANT_TEST_KEY_EXPIRATION = 60 * 60 * 24 * 1000;
44
+ const { onChange: storageStoreOnChange, state: storageStore } = createStore({
45
+ checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id'),
46
+ enabledVariantTestKeys: jsonParse(localStorage.getItem('zonos--enabled-variant-test-keys')),
47
+ });
48
+ storageStoreOnChange('enabledVariantTestKeys', () => {
49
+ var _a;
50
+ // This should be set in localStorage so we don't have multiple tests for the same user in short period of time
51
+ if (!((_a = storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.length)) {
52
+ localStorage.removeItem('zonos--enabled-variant-test-keys');
53
+ return;
54
+ }
55
+ localStorage.setItem('zonos--enabled-variant-test-keys', JSON.stringify(storageStore.enabledVariantTestKeys));
56
+ });
57
+ storageStoreOnChange('checkoutSessionId', () => {
58
+ if (!storageStore.checkoutSessionId) {
59
+ sessionStorage.removeItem('zonos--checkout-session-id');
60
+ return;
61
+ }
62
+ sessionStorage.setItem('zonos--checkout-session-id', storageStore.checkoutSessionId);
63
+ });
64
+ const storageStoreSetEnabledVariantTestKeys = (testKeys) => {
65
+ storageStore.enabledVariantTestKeys = filterValidTests(testKeys);
66
+ };
2
67
 
3
68
  const stringsArabic = {
4
69
  ' (Duties due at door)': {
@@ -280,6 +345,9 @@ const stringsArabic = {
280
345
  'Invalid session': {
281
346
  value: 'جلسة غير صالحة',
282
347
  },
348
+ 'Invoice:': {
349
+ value: 'فاتورة:',
350
+ },
283
351
  Island: {
284
352
  value: 'جزيرة',
285
353
  },
@@ -394,6 +462,9 @@ const stringsArabic = {
394
462
  "Payment processing. We'll update you when payment is received.": {
395
463
  value: 'جارٍ معالجة الدفع. سنحدثك عند استلام الدفعة.',
396
464
  },
465
+ 'Payment total': {
466
+ value: 'إجمالي الدفع',
467
+ },
397
468
  'Personal Customers Clearance Code': {
398
469
  value: 'رمز تخليص العملاء الشخصيين',
399
470
  },
@@ -436,6 +507,9 @@ const stringsArabic = {
436
507
  'Prepay duties and taxes at checkout': {
437
508
  value: 'دفع الرسوم والضرائب مقدمًا عند الدفع',
438
509
  },
510
+ 'Privacy policy': {
511
+ value: 'سياسة الخصوصية',
512
+ },
439
513
  'Proceed with order': {
440
514
  value: 'المتابعة مع الطلب',
441
515
  },
@@ -1022,6 +1096,9 @@ const stringsBase = {
1022
1096
  'Invalid session': {
1023
1097
  value: 'Invalid session',
1024
1098
  },
1099
+ 'Invoice:': {
1100
+ value: 'Invoice:',
1101
+ },
1025
1102
  Island: {
1026
1103
  value: 'Island',
1027
1104
  },
@@ -1136,6 +1213,9 @@ const stringsBase = {
1136
1213
  "Payment processing. We'll update you when payment is received.": {
1137
1214
  value: "Payment processing. We'll update you when payment is received.",
1138
1215
  },
1216
+ 'Payment total': {
1217
+ value: 'Payment total',
1218
+ },
1139
1219
  'Personal Customers Clearance Code': {
1140
1220
  value: 'Personal Customers Clearance Code',
1141
1221
  },
@@ -1178,6 +1258,9 @@ const stringsBase = {
1178
1258
  'Prepay duties and taxes at checkout': {
1179
1259
  value: 'Prepay duties and taxes at checkout',
1180
1260
  },
1261
+ 'Privacy policy': {
1262
+ value: 'Privacy policy',
1263
+ },
1181
1264
  'Proceed with order': {
1182
1265
  value: 'Proceed with order',
1183
1266
  },
@@ -1763,6 +1846,9 @@ const stringsChinese = {
1763
1846
  'Invalid session': {
1764
1847
  value: '无效的会话',
1765
1848
  },
1849
+ 'Invoice:': {
1850
+ value: '发票:',
1851
+ },
1766
1852
  Island: {
1767
1853
  value: '岛',
1768
1854
  },
@@ -1877,6 +1963,9 @@ const stringsChinese = {
1877
1963
  "Payment processing. We'll update you when payment is received.": {
1878
1964
  value: '付款处理中。付款收到后,我们将通知您。',
1879
1965
  },
1966
+ 'Payment total': {
1967
+ value: '付款总额',
1968
+ },
1880
1969
  'Personal Customers Clearance Code': {
1881
1970
  value: '个人客户清关代码',
1882
1971
  },
@@ -1919,6 +2008,9 @@ const stringsChinese = {
1919
2008
  'Prepay duties and taxes at checkout': {
1920
2009
  value: '在结账时预付关税和税款',
1921
2010
  },
2011
+ 'Privacy policy': {
2012
+ value: '隐私政策',
2013
+ },
1922
2014
  'Proceed with order': {
1923
2015
  value: '继续订单',
1924
2016
  },
@@ -2504,6 +2596,9 @@ const stringsDanish = {
2504
2596
  'Invalid session': {
2505
2597
  value: 'Ugyldig session',
2506
2598
  },
2599
+ 'Invoice:': {
2600
+ value: 'Faktura:',
2601
+ },
2507
2602
  Island: {
2508
2603
  value: 'Ø',
2509
2604
  },
@@ -2618,6 +2713,9 @@ const stringsDanish = {
2618
2713
  "Payment processing. We'll update you when payment is received.": {
2619
2714
  value: 'Behandler betaling. Vi opdaterer dig, når betalingen er modtaget.',
2620
2715
  },
2716
+ 'Payment total': {
2717
+ value: 'Betaling i alt',
2718
+ },
2621
2719
  'Personal Customers Clearance Code': {
2622
2720
  value: 'Personlige Kunders Toldkode',
2623
2721
  },
@@ -2660,6 +2758,9 @@ const stringsDanish = {
2660
2758
  'Prepay duties and taxes at checkout': {
2661
2759
  value: 'Betal told og skatter på forhånd ved kassen',
2662
2760
  },
2761
+ 'Privacy policy': {
2762
+ value: 'Privatlivspolitik',
2763
+ },
2663
2764
  'Proceed with order': {
2664
2765
  value: 'Fortsæt med ordren',
2665
2766
  },
@@ -3245,6 +3346,9 @@ const stringsDutch = {
3245
3346
  'Invalid session': {
3246
3347
  value: 'Ongeldige sessie',
3247
3348
  },
3349
+ 'Invoice:': {
3350
+ value: 'Factuur:',
3351
+ },
3248
3352
  Island: {
3249
3353
  value: 'Eiland',
3250
3354
  },
@@ -3359,6 +3463,9 @@ const stringsDutch = {
3359
3463
  "Payment processing. We'll update you when payment is received.": {
3360
3464
  value: 'Betaling verwerken. We brengen je op de hoogte wanneer de betaling is ontvangen.',
3361
3465
  },
3466
+ 'Payment total': {
3467
+ value: 'Betalingstotaal',
3468
+ },
3362
3469
  'Personal Customers Clearance Code': {
3363
3470
  value: 'Persoonlijke Klanten Invoercode',
3364
3471
  },
@@ -3401,6 +3508,9 @@ const stringsDutch = {
3401
3508
  'Prepay duties and taxes at checkout': {
3402
3509
  value: 'Heffingen en belastingen vooraf betalen bij het afrekenen',
3403
3510
  },
3511
+ 'Privacy policy': {
3512
+ value: 'Privacybeleid',
3513
+ },
3404
3514
  'Proceed with order': {
3405
3515
  value: 'Doorgaan met de bestelling',
3406
3516
  },
@@ -3986,6 +4096,9 @@ const stringsFrench = {
3986
4096
  'Invalid session': {
3987
4097
  value: 'Session invalide',
3988
4098
  },
4099
+ 'Invoice:': {
4100
+ value: 'Facture:',
4101
+ },
3989
4102
  Island: {
3990
4103
  value: 'Île',
3991
4104
  },
@@ -4100,6 +4213,9 @@ const stringsFrench = {
4100
4213
  "Payment processing. We'll update you when payment is received.": {
4101
4214
  value: 'Traitement du paiement en cours. Nous vous tiendrons informé dès réception du paiement.',
4102
4215
  },
4216
+ 'Payment total': {
4217
+ value: 'Total du paiement',
4218
+ },
4103
4219
  'Personal Customers Clearance Code': {
4104
4220
  value: 'Code de Dédouanement des Clients Personnels',
4105
4221
  },
@@ -4142,6 +4258,9 @@ const stringsFrench = {
4142
4258
  'Prepay duties and taxes at checkout': {
4143
4259
  value: "Payez les droits et taxes à l'avance lors du checkout",
4144
4260
  },
4261
+ 'Privacy policy': {
4262
+ value: 'Politique de confidentialité',
4263
+ },
4145
4264
  'Proceed with order': {
4146
4265
  value: 'Procéder à la commande',
4147
4266
  },
@@ -4727,6 +4846,9 @@ const stringsGerman = {
4727
4846
  'Invalid session': {
4728
4847
  value: 'Ungültige Sitzung',
4729
4848
  },
4849
+ 'Invoice:': {
4850
+ value: 'Rechnung:',
4851
+ },
4730
4852
  Island: {
4731
4853
  value: 'Insel',
4732
4854
  },
@@ -4841,6 +4963,9 @@ const stringsGerman = {
4841
4963
  "Payment processing. We'll update you when payment is received.": {
4842
4964
  value: 'Zahlung wird verarbeitet. Wir informieren Sie, sobald die Zahlung eingegangen ist.',
4843
4965
  },
4966
+ 'Payment total': {
4967
+ value: 'Zahlungssumme',
4968
+ },
4844
4969
  'Personal Customers Clearance Code': {
4845
4970
  value: 'Zollabfertigungscode für Privatkunden',
4846
4971
  },
@@ -4883,6 +5008,9 @@ const stringsGerman = {
4883
5008
  'Prepay duties and taxes at checkout': {
4884
5009
  value: 'Zölle und Steuern im Voraus bezahlen',
4885
5010
  },
5011
+ 'Privacy policy': {
5012
+ value: 'Datenschutzrichtlinie',
5013
+ },
4886
5014
  'Proceed with order': {
4887
5015
  value: 'Mit der Bestellung fortfahren',
4888
5016
  },
@@ -5468,6 +5596,9 @@ const stringsHebrew = {
5468
5596
  'Invalid session': {
5469
5597
  value: 'סשן לא חוקי',
5470
5598
  },
5599
+ 'Invoice:': {
5600
+ value: 'חשבונית:',
5601
+ },
5471
5602
  Island: {
5472
5603
  value: 'אי',
5473
5604
  },
@@ -5582,6 +5713,9 @@ const stringsHebrew = {
5582
5713
  "Payment processing. We'll update you when payment is received.": {
5583
5714
  value: 'התשלום מעובד. נעדכן אותך כשהתשלום יתקבל.',
5584
5715
  },
5716
+ 'Payment total': {
5717
+ value: 'סך התשלום',
5718
+ },
5585
5719
  'Personal Customers Clearance Code': {
5586
5720
  value: 'קוד שחרור מכס ללקוחות פרטיים',
5587
5721
  },
@@ -5624,6 +5758,9 @@ const stringsHebrew = {
5624
5758
  'Prepay duties and taxes at checkout': {
5625
5759
  value: 'שלם מכסים ומסים מראש בעת התשלום',
5626
5760
  },
5761
+ 'Privacy policy': {
5762
+ value: 'מדיניות פרטיות',
5763
+ },
5627
5764
  'Proceed with order': {
5628
5765
  value: 'המשך עם ההזמנה',
5629
5766
  },
@@ -6209,6 +6346,9 @@ const stringsIndonesian = {
6209
6346
  'Invalid session': {
6210
6347
  value: 'Sesi tidak valid',
6211
6348
  },
6349
+ 'Invoice:': {
6350
+ value: 'Faktur:',
6351
+ },
6212
6352
  Island: {
6213
6353
  value: 'Pulau',
6214
6354
  },
@@ -6323,6 +6463,9 @@ const stringsIndonesian = {
6323
6463
  "Payment processing. We'll update you when payment is received.": {
6324
6464
  value: 'Pemrosesan pembayaran. Kami akan memberi Anda pembaruan ketika pembayaran diterima.',
6325
6465
  },
6466
+ 'Payment total': {
6467
+ value: 'Total pembayaran',
6468
+ },
6326
6469
  'Personal Customers Clearance Code': {
6327
6470
  value: 'Kode Pembebasan Pelanggan Pribadi',
6328
6471
  },
@@ -6365,6 +6508,9 @@ const stringsIndonesian = {
6365
6508
  'Prepay duties and taxes at checkout': {
6366
6509
  value: 'Pembayaran bea masuk dan pajak di kasir',
6367
6510
  },
6511
+ 'Privacy policy': {
6512
+ value: 'Kebijakan privasi',
6513
+ },
6368
6514
  'Proceed with order': {
6369
6515
  value: 'Lanjutkan dengan pesanan',
6370
6516
  },
@@ -6950,6 +7096,9 @@ const stringsItalian = {
6950
7096
  'Invalid session': {
6951
7097
  value: 'Sessione non valida',
6952
7098
  },
7099
+ 'Invoice:': {
7100
+ value: 'Fattura:',
7101
+ },
6953
7102
  Island: {
6954
7103
  value: 'Isola',
6955
7104
  },
@@ -7064,6 +7213,9 @@ const stringsItalian = {
7064
7213
  "Payment processing. We'll update you when payment is received.": {
7065
7214
  value: 'Elaborazione pagamento in corso. Ti aggiorneremo quando il pagamento sarà ricevuto.',
7066
7215
  },
7216
+ 'Payment total': {
7217
+ value: 'Totale del pagamento',
7218
+ },
7067
7219
  'Personal Customers Clearance Code': {
7068
7220
  value: 'Codice di Sdoganamento per Clienti Personali',
7069
7221
  },
@@ -7106,6 +7258,9 @@ const stringsItalian = {
7106
7258
  'Prepay duties and taxes at checkout': {
7107
7259
  value: 'Paga dazi e tasse anticipatamente',
7108
7260
  },
7261
+ 'Privacy policy': {
7262
+ value: 'Informativa sulla privacy',
7263
+ },
7109
7264
  'Proceed with order': {
7110
7265
  value: "Procedi con l'ordine",
7111
7266
  },
@@ -7691,6 +7846,9 @@ const stringsJapanese = {
7691
7846
  'Invalid session': {
7692
7847
  value: '無効なセッション',
7693
7848
  },
7849
+ 'Invoice:': {
7850
+ value: '請求書:',
7851
+ },
7694
7852
  Island: {
7695
7853
  value: '島',
7696
7854
  },
@@ -7805,6 +7963,9 @@ const stringsJapanese = {
7805
7963
  "Payment processing. We'll update you when payment is received.": {
7806
7964
  value: '支払処理中です。入金が確認された際に更新いたします。',
7807
7965
  },
7966
+ 'Payment total': {
7967
+ value: '支払い合計',
7968
+ },
7808
7969
  'Personal Customers Clearance Code': {
7809
7970
  value: '個人顧客通関コード',
7810
7971
  },
@@ -7847,6 +8008,9 @@ const stringsJapanese = {
7847
8008
  'Prepay duties and taxes at checkout': {
7848
8009
  value: ' checkout時に関税と税金を前払い',
7849
8010
  },
8011
+ 'Privacy policy': {
8012
+ value: 'プライバシーポリシー',
8013
+ },
7850
8014
  'Proceed with order': {
7851
8015
  value: '注文を進める',
7852
8016
  },
@@ -8432,6 +8596,9 @@ const stringsKorean = {
8432
8596
  'Invalid session': {
8433
8597
  value: '유효하지 않은 세션',
8434
8598
  },
8599
+ 'Invoice:': {
8600
+ value: '송장:',
8601
+ },
8435
8602
  Island: {
8436
8603
  value: '섬',
8437
8604
  },
@@ -8546,6 +8713,9 @@ const stringsKorean = {
8546
8713
  "Payment processing. We'll update you when payment is received.": {
8547
8714
  value: '결제 처리 중. 결제가 접수되면 알려드리겠습니다.',
8548
8715
  },
8716
+ 'Payment total': {
8717
+ value: '결제 총액',
8718
+ },
8549
8719
  'Personal Customers Clearance Code': {
8550
8720
  value: '개인 고객 통관 코드',
8551
8721
  },
@@ -8588,6 +8758,9 @@ const stringsKorean = {
8588
8758
  'Prepay duties and taxes at checkout': {
8589
8759
  value: '체크아웃 시 관세와 세금 선불',
8590
8760
  },
8761
+ 'Privacy policy': {
8762
+ value: '개인정보 처리방침',
8763
+ },
8591
8764
  'Proceed with order': {
8592
8765
  value: '주문 진행',
8593
8766
  },
@@ -9173,6 +9346,9 @@ const stringsNorwegian = {
9173
9346
  'Invalid session': {
9174
9347
  value: 'Ugyldig økt',
9175
9348
  },
9349
+ 'Invoice:': {
9350
+ value: 'Faktura:',
9351
+ },
9176
9352
  Island: {
9177
9353
  value: 'Øy',
9178
9354
  },
@@ -9287,6 +9463,9 @@ const stringsNorwegian = {
9287
9463
  "Payment processing. We'll update you when payment is received.": {
9288
9464
  value: 'Bearbeider betalingen. Vi gir deg beskjed når betalingen er mottatt.',
9289
9465
  },
9466
+ 'Payment total': {
9467
+ value: 'Betaling totalt',
9468
+ },
9290
9469
  'Personal Customers Clearance Code': {
9291
9470
  value: 'Personlige Kunders Tollklareringskode',
9292
9471
  },
@@ -9329,6 +9508,9 @@ const stringsNorwegian = {
9329
9508
  'Prepay duties and taxes at checkout': {
9330
9509
  value: 'Forhåndsbetal avgifter og skatt ved kassen',
9331
9510
  },
9511
+ 'Privacy policy': {
9512
+ value: 'Personvernregler',
9513
+ },
9332
9514
  'Proceed with order': {
9333
9515
  value: 'Fortsett med bestillingen',
9334
9516
  },
@@ -9914,6 +10096,9 @@ const stringsPolish = {
9914
10096
  'Invalid session': {
9915
10097
  value: 'Nieprawidłowa sesja',
9916
10098
  },
10099
+ 'Invoice:': {
10100
+ value: 'Faktura:',
10101
+ },
9917
10102
  Island: {
9918
10103
  value: 'Wyspa',
9919
10104
  },
@@ -10028,6 +10213,9 @@ const stringsPolish = {
10028
10213
  "Payment processing. We'll update you when payment is received.": {
10029
10214
  value: 'Trwa przetwarzanie płatności. Poinformujemy gdy płatność zostanie otrzymana.',
10030
10215
  },
10216
+ 'Payment total': {
10217
+ value: 'Suma płatności',
10218
+ },
10031
10219
  'Personal Customers Clearance Code': {
10032
10220
  value: 'Kod Odprawy Celnej Klientów Indywidualnych',
10033
10221
  },
@@ -10070,6 +10258,9 @@ const stringsPolish = {
10070
10258
  'Prepay duties and taxes at checkout': {
10071
10259
  value: 'Zapłać cła i podatki z góry podczas realizacji zamówienia',
10072
10260
  },
10261
+ 'Privacy policy': {
10262
+ value: 'Polityka prywatności',
10263
+ },
10073
10264
  'Proceed with order': {
10074
10265
  value: 'Przejdź do zamówienia',
10075
10266
  },
@@ -10655,6 +10846,9 @@ const stringsPortuguese = {
10655
10846
  'Invalid session': {
10656
10847
  value: 'Sessão inválida',
10657
10848
  },
10849
+ 'Invoice:': {
10850
+ value: 'Fatura:',
10851
+ },
10658
10852
  Island: {
10659
10853
  value: 'Ilha',
10660
10854
  },
@@ -10769,6 +10963,9 @@ const stringsPortuguese = {
10769
10963
  "Payment processing. We'll update you when payment is received.": {
10770
10964
  value: 'Processando pagamento. Informaremos quando o pagamento for recebido.',
10771
10965
  },
10966
+ 'Payment total': {
10967
+ value: 'Total do pagamento',
10968
+ },
10772
10969
  'Personal Customers Clearance Code': {
10773
10970
  value: 'Código de Desembaraço de Clientes Pessoais',
10774
10971
  },
@@ -10811,6 +11008,9 @@ const stringsPortuguese = {
10811
11008
  'Prepay duties and taxes at checkout': {
10812
11009
  value: 'Pague impostos e taxas antecipadamente',
10813
11010
  },
11011
+ 'Privacy policy': {
11012
+ value: 'Política de privacidade',
11013
+ },
10814
11014
  'Proceed with order': {
10815
11015
  value: 'Prosseguir com o pedido',
10816
11016
  },
@@ -11396,6 +11596,9 @@ const stringsRussian = {
11396
11596
  'Invalid session': {
11397
11597
  value: 'Недействительная сессия',
11398
11598
  },
11599
+ 'Invoice:': {
11600
+ value: 'Счет:',
11601
+ },
11399
11602
  Island: {
11400
11603
  value: 'Остров',
11401
11604
  },
@@ -11510,6 +11713,9 @@ const stringsRussian = {
11510
11713
  "Payment processing. We'll update you when payment is received.": {
11511
11714
  value: 'Обрабатываем платеж. Сообщим вам, когда платеж будет получен.',
11512
11715
  },
11716
+ 'Payment total': {
11717
+ value: 'Общая сумма платежа',
11718
+ },
11513
11719
  'Personal Customers Clearance Code': {
11514
11720
  value: 'Код таможенной очистки для частных клиентов',
11515
11721
  },
@@ -11552,6 +11758,9 @@ const stringsRussian = {
11552
11758
  'Prepay duties and taxes at checkout': {
11553
11759
  value: 'Предоплата пошлин и налогов при оформлении заказа',
11554
11760
  },
11761
+ 'Privacy policy': {
11762
+ value: 'Политика конфиденциальности',
11763
+ },
11555
11764
  'Proceed with order': {
11556
11765
  value: 'Продолжить с заказом',
11557
11766
  },
@@ -12137,6 +12346,9 @@ const stringsSpanish = {
12137
12346
  'Invalid session': {
12138
12347
  value: 'Sesión no válida',
12139
12348
  },
12349
+ 'Invoice:': {
12350
+ value: 'Factura:',
12351
+ },
12140
12352
  Island: {
12141
12353
  value: 'Isla',
12142
12354
  },
@@ -12251,6 +12463,9 @@ const stringsSpanish = {
12251
12463
  "Payment processing. We'll update you when payment is received.": {
12252
12464
  value: 'Procesando pago. Le informaremos cuando se reciba el pago.',
12253
12465
  },
12466
+ 'Payment total': {
12467
+ value: 'Total de pago',
12468
+ },
12254
12469
  'Personal Customers Clearance Code': {
12255
12470
  value: 'Código de Despacho de Clientes Personales',
12256
12471
  },
@@ -12293,6 +12508,9 @@ const stringsSpanish = {
12293
12508
  'Prepay duties and taxes at checkout': {
12294
12509
  value: 'Pague aranceles e impuestos antes en la compra',
12295
12510
  },
12511
+ 'Privacy policy': {
12512
+ value: 'Política de privacidad',
12513
+ },
12296
12514
  'Proceed with order': {
12297
12515
  value: 'Proceder con el pedido',
12298
12516
  },
@@ -12878,6 +13096,9 @@ const stringsSwedish = {
12878
13096
  'Invalid session': {
12879
13097
  value: 'Ogiltig session',
12880
13098
  },
13099
+ 'Invoice:': {
13100
+ value: 'Faktura:',
13101
+ },
12881
13102
  Island: {
12882
13103
  value: 'Ö',
12883
13104
  },
@@ -12992,6 +13213,9 @@ const stringsSwedish = {
12992
13213
  "Payment processing. We'll update you when payment is received.": {
12993
13214
  value: 'Betalningsbehandling. Vi kommer att uppdatera dig när betalningen har mottagits.',
12994
13215
  },
13216
+ 'Payment total': {
13217
+ value: 'Betalning totalt',
13218
+ },
12995
13219
  'Personal Customers Clearance Code': {
12996
13220
  value: 'Personliga Kunders Tullkod',
12997
13221
  },
@@ -13034,6 +13258,9 @@ const stringsSwedish = {
13034
13258
  'Prepay duties and taxes at checkout': {
13035
13259
  value: 'Förbetala tull och skatter vid utcheckning',
13036
13260
  },
13261
+ 'Privacy policy': {
13262
+ value: 'Integritetspolicy',
13263
+ },
13037
13264
  'Proceed with order': {
13038
13265
  value: 'Fortsätt med beställningen',
13039
13266
  },
@@ -13619,6 +13846,9 @@ const stringsTurkish = {
13619
13846
  'Invalid session': {
13620
13847
  value: 'Geçersiz oturum',
13621
13848
  },
13849
+ 'Invoice:': {
13850
+ value: 'Fatura:',
13851
+ },
13622
13852
  Island: {
13623
13853
  value: 'Ada',
13624
13854
  },
@@ -13733,6 +13963,9 @@ const stringsTurkish = {
13733
13963
  "Payment processing. We'll update you when payment is received.": {
13734
13964
  value: 'Ödeme işleniyor. Ödeme alındığında sizi bilgilendireceğiz.',
13735
13965
  },
13966
+ 'Payment total': {
13967
+ value: 'Ödeme toplamı',
13968
+ },
13736
13969
  'Personal Customers Clearance Code': {
13737
13970
  value: 'Kişisel Müşteri Gümrük Kodları',
13738
13971
  },
@@ -13775,6 +14008,9 @@ const stringsTurkish = {
13775
14008
  'Prepay duties and taxes at checkout': {
13776
14009
  value: 'Ödemede vergi ve gümrük vergisini önceden öde',
13777
14010
  },
14011
+ 'Privacy policy': {
14012
+ value: 'Gizlilik politikası',
14013
+ },
13778
14014
  'Proceed with order': {
13779
14015
  value: 'Siparişe devam et',
13780
14016
  },
@@ -14360,6 +14596,9 @@ const stringsVietnamese = {
14360
14596
  'Invalid session': {
14361
14597
  value: 'Phiên không hợp lệ',
14362
14598
  },
14599
+ 'Invoice:': {
14600
+ value: 'Hóa đơn:',
14601
+ },
14363
14602
  Island: {
14364
14603
  value: 'Đảo',
14365
14604
  },
@@ -14474,6 +14713,9 @@ const stringsVietnamese = {
14474
14713
  "Payment processing. We'll update you when payment is received.": {
14475
14714
  value: 'Đang xử lý thanh toán. Chúng tôi sẽ thông báo khi nhận được thanh toán.',
14476
14715
  },
14716
+ 'Payment total': {
14717
+ value: 'Tổng thanh toán',
14718
+ },
14477
14719
  'Personal Customers Clearance Code': {
14478
14720
  value: 'Mã Thông Quan Khách Hàng Cá Nhân',
14479
14721
  },
@@ -14516,6 +14758,9 @@ const stringsVietnamese = {
14516
14758
  'Prepay duties and taxes at checkout': {
14517
14759
  value: 'Thanh toán trước thuế và phí khi thanh toán',
14518
14760
  },
14761
+ 'Privacy policy': {
14762
+ value: 'Chính sách bảo mật',
14763
+ },
14519
14764
  'Proceed with order': {
14520
14765
  value: 'Tiếp tục với đơn hàng',
14521
14766
  },
@@ -14909,4 +15154,798 @@ const translate = (...[key, replacement]) => {
14909
15154
  return ((_b = translationStore.translatedChunks[key]) === null || _b === void 0 ? void 0 : _b.value) || key;
14910
15155
  };
14911
15156
 
14912
- export { translationStoreUpdateLanguage as a, translationStoreOnChange as b, translate as t };
15157
+ const getCountries = async () => {
15158
+ try {
15159
+ const { errors, json } = await handleFetch('/api/zonos-elements/get-countries', {
15160
+ method: 'GET',
15161
+ });
15162
+ if (errors.length || !json) {
15163
+ return null;
15164
+ }
15165
+ return json;
15166
+ }
15167
+ catch (_a) {
15168
+ return null;
15169
+ }
15170
+ };
15171
+
15172
+ const getCountryLandedCost = async (countryCode) => {
15173
+ var _a;
15174
+ if (!countryCode) {
15175
+ return null;
15176
+ }
15177
+ const url = `/api/zonos-elements/country-landed-cost/${countryCode}`;
15178
+ const { errors, json } = await handleFetch(url);
15179
+ if (errors.length || !json) {
15180
+ logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
15181
+ return null;
15182
+ }
15183
+ return json || null;
15184
+ };
15185
+
15186
+ const defaultUsExchangeRate = {
15187
+ exchangeRate: {
15188
+ rate: 1,
15189
+ targetFormat: {
15190
+ currencyCode: 'USD',
15191
+ decimalDelimiter: '.',
15192
+ scale: 2,
15193
+ symbol: '$',
15194
+ symbolLocation: 'before',
15195
+ thousandsDelimiter: ',',
15196
+ },
15197
+ },
15198
+ maxAge: null,
15199
+ };
15200
+ const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCurrency, }) => {
15201
+ var _a;
15202
+ // If source currency matches target currency (US -> US) and is not a guaranteed rate, return default exchange rate so we still format properly.
15203
+ if (sourceCurrency === targetCurrency && !isGuaranteed) {
15204
+ return defaultUsExchangeRate;
15205
+ }
15206
+ const searchParams = new URLSearchParams();
15207
+ searchParams.set('sourceCurrency', sourceCurrency);
15208
+ searchParams.set('targetCurrency', targetCurrency);
15209
+ searchParams.set('isGuaranteed', String(isGuaranteed));
15210
+ searchParams.set('country', country || '');
15211
+ const { errors, json } = await handleFetch(`/api/zonos-elements/exchange-rates?${searchParams.toString()}`);
15212
+ if (errors.length || !json) {
15213
+ logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
15214
+ return defaultUsExchangeRate;
15215
+ }
15216
+ const { rate, targetFormat } = json.exchangeRateCreate;
15217
+ const maxAge = json.maxAge;
15218
+ if (rate) {
15219
+ sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
15220
+ const exchangeRate = { rate, targetFormat };
15221
+ return { exchangeRate, maxAge };
15222
+ }
15223
+ return defaultUsExchangeRate;
15224
+ };
15225
+
15226
+ const getInclusivePriceConfigurations = async (countryCode) => {
15227
+ var _a;
15228
+ if (!countryCode) {
15229
+ return null;
15230
+ }
15231
+ const { errors, json } = await handleFetch(`/api/zonos-elements/inclusive-prices/${countryCode}`);
15232
+ if (errors.length || !json) {
15233
+ logError(`Error fetching country inclusive price setting: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
15234
+ return null;
15235
+ }
15236
+ return json || null;
15237
+ };
15238
+
15239
+ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
15240
+ var _a;
15241
+ const searchParams = new URLSearchParams();
15242
+ searchParams.set('countryCode', countryCode);
15243
+ searchParams.set('storeId', storeId.toString());
15244
+ if (localeTo) {
15245
+ searchParams.set('localeTo', localeTo);
15246
+ }
15247
+ const { errors, json } = await handleFetch(`/api/zonos-elements/locale-messages?${searchParams.toString()}`);
15248
+ if (errors.length || !json) {
15249
+ logError('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
15250
+ return [];
15251
+ }
15252
+ return json.locale_countryCodesPage;
15253
+ };
15254
+
15255
+ const validateCountryCode = (countryCode) => {
15256
+ // Check that the country is two characters and is upper case
15257
+ if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
15258
+ return countryCode;
15259
+ }
15260
+ return null;
15261
+ };
15262
+ const getZCountryUrlParam = (urlParams) => {
15263
+ const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
15264
+ const getCountryParam = (param) => {
15265
+ const country = urlSearchParams.get(param);
15266
+ // Check that the country is two characters and is upper case
15267
+ return validateCountryCode(country);
15268
+ };
15269
+ const zCountry = getCountryParam('zCountry');
15270
+ // Fallback to legacy 'country'
15271
+ const fallback = getCountryParam('country');
15272
+ // Fallback to customerCountry
15273
+ const secondFallback = getCountryParam('customerCountry');
15274
+ return zCountry || fallback || secondFallback;
15275
+ };
15276
+
15277
+ /**
15278
+ * Retrieve the zCountry from the URL or session storage.
15279
+ */
15280
+ const getOverridenZCountry = () => {
15281
+ const currentUrl = new URL(window.location.href);
15282
+ // load and use country from session storage when zCountry query param is not present
15283
+ const countryLoadedSession = window.sessionStorage.getItem('zonos--country');
15284
+ const zCountry = getZCountryUrlParam(currentUrl.searchParams) || countryLoadedSession;
15285
+ return zCountry;
15286
+ };
15287
+
15288
+ const getLocalization = async () => {
15289
+ try {
15290
+ const zCountry = getOverridenZCountry();
15291
+ const searchParams = new URLSearchParams();
15292
+ if (zCountry) {
15293
+ searchParams.set('zCountry', zCountry);
15294
+ }
15295
+ const { errors, json } = await handleFetch(`/api/zonos-elements/localization?${searchParams.toString()}`);
15296
+ if (errors.length || !json) {
15297
+ return { country: null, locale: null };
15298
+ }
15299
+ return {
15300
+ country: json.country,
15301
+ locale: json.locale,
15302
+ };
15303
+ }
15304
+ catch (_a) {
15305
+ return { country: null, locale: null };
15306
+ }
15307
+ };
15308
+
15309
+ const getShippingZones = async () => {
15310
+ var _a, _b, _c;
15311
+ if ((_a = window.Zonos.cartSettings) === null || _a === void 0 ? void 0 : _a.shippingZones) {
15312
+ return window.Zonos.cartSettings.shippingZones
15313
+ .flatMap(zone => zone === null || zone === void 0 ? void 0 : zone.countryCodes)
15314
+ .filter(Boolean);
15315
+ }
15316
+ const { errors, json } = await handleFetch('/api/zonos-elements/shipping-zones');
15317
+ if (errors.length || !json) {
15318
+ logError(`Error fetching shipping zones: ${(_b = errors.find(Boolean)) === null || _b === void 0 ? void 0 : _b.message}`);
15319
+ return null;
15320
+ }
15321
+ const shippingZones = (_c = json === null || json === void 0 ? void 0 : json.shippingZones) === null || _c === void 0 ? void 0 : _c.flatMap(zone => zone === null || zone === void 0 ? void 0 : zone.countryCodes).filter(Boolean);
15322
+ return shippingZones || null;
15323
+ };
15324
+
15325
+ const applyInclusiveEffectiveRate = (amount) => {
15326
+ const inclusivePrice = localizationStore.inclusivePricingConfigurations.find(x => x.shipToCountry === localizationStore.selectedCountryCode);
15327
+ if (!inclusivePrice) {
15328
+ return amount;
15329
+ }
15330
+ const effectiveRate = inclusivePrice.effectiveRate;
15331
+ // Just multiply the amount by the effective rate to get the new amount for inclusive pricing
15332
+ return amount * (1 + effectiveRate);
15333
+ };
15334
+
15335
+ const currencyConvert = (value) => {
15336
+ // TODO(potentially): Bring over the code for vanity checks
15337
+ const { exchangeRate } = localizationStore;
15338
+ if (!exchangeRate || !value || isNaN(value)) {
15339
+ return value;
15340
+ }
15341
+ const minimumFractionDigits = (exchangeRate === null || exchangeRate === void 0 ? void 0 : exchangeRate.targetFormat.scale) || 2;
15342
+ const convertedValue = value * exchangeRate.rate;
15343
+ const fixedValue = convertedValue.toFixed(minimumFractionDigits);
15344
+ return Number(fixedValue);
15345
+ };
15346
+
15347
+ /**
15348
+ * This function only to format the number in
15349
+ * @returns
15350
+ */
15351
+ const numberFormat = ({ amount, currency, targetFormat, }) => {
15352
+ const targetCurrency = currency || localizationStore.targetCurrency;
15353
+ const minimumFractionDigits = (targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.scale) || 2;
15354
+ const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
15355
+ const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
15356
+ if (isIE || !numberFormatExists) {
15357
+ // use native number formatting if it's IE.
15358
+ const formattedNumber = Number(amount)
15359
+ .toFixed(minimumFractionDigits)
15360
+ .replace('.', '|dec|')
15361
+ .replace(',', (targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.thousandsDelimiter) || '')
15362
+ .replace('|dec|', (targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.decimalDelimiter) || '');
15363
+ return formattedNumber;
15364
+ }
15365
+ const formatedNumber = new Intl.NumberFormat(window.navigator.language, {
15366
+ currency: targetCurrency,
15367
+ currencyDisplay: 'code',
15368
+ minimumFractionDigits: minimumFractionDigits,
15369
+ style: 'currency',
15370
+ }).format(amount);
15371
+ return formatedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '');
15372
+ };
15373
+
15374
+ const currencyFormat = ({ amount, currency, }) => {
15375
+ if (isNaN(amount) || (amount !== 0 && !amount)) {
15376
+ return '';
15377
+ }
15378
+ const overrideCurrencyFormat = zonosStore.overrideCurrencyFormat;
15379
+ const { exchangeRate } = localizationStore;
15380
+ const targetCurrency = currency || localizationStore.targetCurrency;
15381
+ // Use user-defined currency format
15382
+ if (typeof overrideCurrencyFormat === 'function') {
15383
+ return overrideCurrencyFormat({
15384
+ amount: amount,
15385
+ currencyCode: targetCurrency,
15386
+ numberFormat: ({ amount: _amount }) => numberFormat({
15387
+ amount: _amount,
15388
+ currency: targetCurrency,
15389
+ targetFormat: (exchangeRate === null || exchangeRate === void 0 ? void 0 : exchangeRate.targetFormat) || null,
15390
+ }),
15391
+ });
15392
+ }
15393
+ const { targetFormat } = exchangeRate || {};
15394
+ if (!targetFormat || !exchangeRate) {
15395
+ // Return the amount as a string if no exchange rate is available
15396
+ return `${amount.toFixed(2)} ${targetCurrency}`;
15397
+ }
15398
+ const minimumFractionDigits = targetFormat.scale || 2;
15399
+ const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
15400
+ const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
15401
+ if (isIE || !numberFormatExists) {
15402
+ // use native number formatting if it's IE.
15403
+ const formattedNumber = Number(amount)
15404
+ .toFixed(minimumFractionDigits)
15405
+ .replace('.', '|dec|')
15406
+ .replace(',', targetFormat.thousandsDelimiter || '')
15407
+ .replace('|dec|', targetFormat.decimalDelimiter || '');
15408
+ const result = `${formattedNumber}${targetFormat.currencyCode !== 'USD' ? ` ${targetFormat.currencyCode}` : ''}`;
15409
+ return result;
15410
+ }
15411
+ const currencyDisplay = (overrideCurrencyFormat === null || overrideCurrencyFormat === void 0 ? void 0 : overrideCurrencyFormat.currencyDisplay) || 'symbol';
15412
+ const formattedNumber = new Intl.NumberFormat(window.navigator.language, {
15413
+ currency: targetCurrency,
15414
+ currencyDisplay,
15415
+ minimumFractionDigits: minimumFractionDigits,
15416
+ style: 'currency',
15417
+ }).format(amount);
15418
+ // Move currency code to the end of the string if currencyDisplay is 'code'
15419
+ const result = currencyDisplay === 'code'
15420
+ ? `${formattedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '')} ${targetCurrency}`
15421
+ : formattedNumber;
15422
+ return result;
15423
+ };
15424
+
15425
+ const currencyConvertAndFormat = (value) => {
15426
+ const convertedValue = currencyConvert(value);
15427
+ const formattedValue = currencyFormat({ amount: convertedValue });
15428
+ return formattedValue;
15429
+ };
15430
+
15431
+ /**
15432
+ * Check if selector user pass is valid
15433
+ * @example
15434
+ * isValidSelector('div') // true
15435
+ * isValidSelector('div + >>> span') // false
15436
+ */
15437
+ const isValidSelector = (selector) => {
15438
+ try {
15439
+ // this will error out if the selector is invalid in the DOM
15440
+ document.createDocumentFragment().querySelector(selector);
15441
+ }
15442
+ catch (_a) {
15443
+ return false;
15444
+ }
15445
+ return true;
15446
+ };
15447
+
15448
+ const getCurrencyElements = (selector) => {
15449
+ const currencySelector = selector || '.money';
15450
+ if (!isValidSelector(currencySelector)) {
15451
+ logError(`Currency element selector "${currencySelector}" is not valid.`);
15452
+ return null;
15453
+ }
15454
+ const currencyElements = document.querySelectorAll(currencySelector);
15455
+ if (!currencyElements.length) {
15456
+ log(`No currency elements found with selector "${currencySelector}"`, 'warn');
15457
+ return null;
15458
+ }
15459
+ // return array of currency elements instead of a NodeList
15460
+ return Array.from(currencyElements);
15461
+ };
15462
+
15463
+ const getInitialElementAmount = (element) => {
15464
+ var _a;
15465
+ const domesticValue = element.getAttribute('data-domestic');
15466
+ const intlValue = element.getAttribute('data-zintl');
15467
+ // Only keep numbers, decimal, and hyphens
15468
+ const cleanedText = (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.replace(/[^\d.-]/g, '');
15469
+ if (!cleanedText) {
15470
+ return null;
15471
+ }
15472
+ // If the element has no data-domestic attribute, or the text content is different from the data-zintl attribute, set the data-domestic attribute
15473
+ if (!domesticValue || (element.textContent !== intlValue && intlValue)) {
15474
+ // Store the original value on the element once, and international on every new conversion
15475
+ element.setAttribute('data-domestic', cleanedText);
15476
+ return parseFloat(cleanedText);
15477
+ }
15478
+ return parseFloat(domesticValue);
15479
+ };
15480
+
15481
+ const BLUR_CURRENCY_DURATION = 7000;
15482
+ const BLUR_CURRENCY_CLASSNAME = 'z--blur';
15483
+ const removeBlurCurrency = async () => {
15484
+ const intervalId = window.zonosBlurCurrencyOnInitIntervalId;
15485
+ if (!intervalId) {
15486
+ // Do nothing if the interval is not set
15487
+ return;
15488
+ }
15489
+ // Wait a bit to make sure price is fully rendered in DOM
15490
+ await new Promise(resolve => setTimeout(resolve, 500));
15491
+ clearInterval(intervalId);
15492
+ const currencyElements = document.querySelectorAll(`.${BLUR_CURRENCY_CLASSNAME}`);
15493
+ currencyElements.forEach(element => {
15494
+ element.classList.remove(BLUR_CURRENCY_CLASSNAME);
15495
+ });
15496
+ window.zonosBlurCurrencyOnInitIntervalId = undefined;
15497
+ };
15498
+ /**
15499
+ * This function is used to remove the blur effect from a specific element. (combined with performBlurSpecificElement)
15500
+ * @returns void
15501
+ */
15502
+ const removeBlurSpecificElement = async ({ specificSelector, timeoutId, }) => {
15503
+ // Wait a bit to make sure price is fully rendered in DOM
15504
+ await new Promise(resolve => setTimeout(resolve, 500));
15505
+ if (timeoutId) {
15506
+ clearTimeout(timeoutId);
15507
+ }
15508
+ specificSelector.classList.remove(BLUR_CURRENCY_CLASSNAME);
15509
+ };
15510
+ const blurCurrencyElements = ({ currencySelector, specificSelector, }) => {
15511
+ // Do nothing if the currency selector is not provided or blurCurrencyOnInit is false
15512
+ if (!currencySelector && !specificSelector) {
15513
+ return;
15514
+ }
15515
+ if (specificSelector) {
15516
+ specificSelector.classList.add(BLUR_CURRENCY_CLASSNAME);
15517
+ }
15518
+ else {
15519
+ const currencyElements = document.querySelectorAll([currencySelector].filter(Boolean).join(','));
15520
+ currencyElements.forEach(element => {
15521
+ element.classList.add(BLUR_CURRENCY_CLASSNAME);
15522
+ });
15523
+ }
15524
+ };
15525
+ const performBlurSpecificElement = (specificSelector) => {
15526
+ if (typeof window === 'undefined') {
15527
+ return;
15528
+ }
15529
+ blurCurrencyElements({
15530
+ specificSelector,
15531
+ });
15532
+ // The blur will be removed as soon as we got the exchange rate back. But if the exchange rate is not available for some reason, the blur effect will be automatically removed after 10 seconds
15533
+ const timeoutId = setTimeout(() => {
15534
+ void removeBlurSpecificElement({
15535
+ specificSelector,
15536
+ timeoutId,
15537
+ });
15538
+ }, BLUR_CURRENCY_DURATION);
15539
+ return timeoutId;
15540
+ };
15541
+ const performBlurCurrency = () => {
15542
+ if (typeof window === 'undefined') {
15543
+ return;
15544
+ }
15545
+ // If the interval is already in progress, do nothing
15546
+ if (window.zonosBlurCurrencyOnInitIntervalId) {
15547
+ return;
15548
+ }
15549
+ blurCurrencyElements({
15550
+ currencySelector: window.zonosBlurCurrencyOnInitCurrencySelector,
15551
+ });
15552
+ // Add blur effect to the currency elements
15553
+ const intervalId = setInterval(() => {
15554
+ blurCurrencyElements({
15555
+ currencySelector: window.zonosBlurCurrencyOnInitCurrencySelector,
15556
+ });
15557
+ }, 10);
15558
+ window.zonosBlurCurrencyOnInitIntervalId = intervalId;
15559
+ // The blur will be removed as soon as we got the exchange rate back. But if the exchange rate is not available for some reason, the blur effect will be automatically removed after 10 seconds
15560
+ setTimeout(() => {
15561
+ void removeBlurCurrency();
15562
+ }, BLUR_CURRENCY_DURATION);
15563
+ };
15564
+
15565
+ const convertCurrency = (element) => {
15566
+ var _a;
15567
+ const amount = getInitialElementAmount(element);
15568
+ if (!amount || isNaN(amount)) {
15569
+ return;
15570
+ }
15571
+ const currentIntlValue = element.getAttribute('data-zintl');
15572
+ // get rate
15573
+ const currentIntlRateValue = parseFloat(element.getAttribute('data-zrate') || '1');
15574
+ const currentCountryValue = element.getAttribute('data-zcountry-code');
15575
+ // do nothing if the target currency is the same
15576
+ const isExchangeRateReady = localizationStore.exchangeRate &&
15577
+ localizationStore.targetCurrency ===
15578
+ localizationStore.exchangeRate.targetFormat.currencyCode;
15579
+ const rate = ((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
15580
+ // if the current value on the element is different from the current intl value, update the data-zintl attribute
15581
+ if (isExchangeRateReady &&
15582
+ // Update currency if the value is not yet formatted
15583
+ (element.textContent !== currentIntlValue ||
15584
+ // Update rate when new rate is available
15585
+ rate !== currentIntlRateValue ||
15586
+ // Update currency when the country code changes
15587
+ currentCountryValue !== localizationStore.selectedCountryCode)) {
15588
+ // Hide the currency until DOM is ready to display the new value
15589
+ const timeoutId = performBlurSpecificElement(element);
15590
+ const appliedInclusivePrice = applyInclusiveEffectiveRate(amount);
15591
+ const customizedCurrencyFormat = typeof zonosStore.currencyConverter === 'function' &&
15592
+ zonosStore.currencyConverter({
15593
+ convert: currencyConvert,
15594
+ convertAndFormat: currencyConvertAndFormat,
15595
+ currencyCode: localizationStore.targetCurrency,
15596
+ format: (value) => currencyFormat({ amount: value }),
15597
+ originalAmount: appliedInclusivePrice,
15598
+ selector: element,
15599
+ });
15600
+ // default to the currencyConvertAndFormat if the currencyConverter function does not return a value, or invalid value. This is to make sure we don't break the merchant's price.
15601
+ const observedFormattedValue = customizedCurrencyFormat ||
15602
+ currencyConvertAndFormat(appliedInclusivePrice);
15603
+ if (observedFormattedValue !== element.textContent) {
15604
+ // Only set textContent if the value has changed, this is to prevent it redrawing the element if the value is the same
15605
+ element.textContent = observedFormattedValue;
15606
+ }
15607
+ // save the new rate to the data-zrate attribute
15608
+ element.setAttribute('data-zrate', rate.toString());
15609
+ // save the new value to the data-zintl attribute
15610
+ element.setAttribute('data-zintl', observedFormattedValue);
15611
+ element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
15612
+ void removeBlurSpecificElement({
15613
+ specificSelector: element,
15614
+ timeoutId,
15615
+ });
15616
+ }
15617
+ };
15618
+ const defaultCurrencyConverter = () => {
15619
+ const { currencyElementSelector } = zonosStore.helloSettings;
15620
+ const currencyElements = getCurrencyElements(currencyElementSelector);
15621
+ // do nothing if none of the currency elements are found
15622
+ if (!(currencyElements === null || currencyElements === void 0 ? void 0 : currencyElements.length)) {
15623
+ return;
15624
+ }
15625
+ if (!localizationStore.exchangeRate) {
15626
+ logError('Could not display currency. Exchange rate and format data is not available.');
15627
+ return;
15628
+ }
15629
+ currencyElements.forEach(element => {
15630
+ // convert the currency and save the formatted value to the data-zintl attribute
15631
+ convertCurrency(element);
15632
+ });
15633
+ };
15634
+
15635
+ const currencyDisplay = () => {
15636
+ if (zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
15637
+ window.Zonos.isLegacyCheckout) {
15638
+ void removeBlurCurrency();
15639
+ return;
15640
+ }
15641
+ defaultCurrencyConverter();
15642
+ };
15643
+
15644
+ const getCurrencyCode = (code) => {
15645
+ var _a;
15646
+ const countryInShippingZone = (_a = localizationStore.shippingZoneCountries) === null || _a === void 0 ? void 0 : _a[code];
15647
+ if (countryInShippingZone) {
15648
+ return countryInShippingZone.currencyCode;
15649
+ }
15650
+ return null;
15651
+ };
15652
+
15653
+ const setZCountryUrlParam = (selectedCountryCode) => {
15654
+ if (!selectedCountryCode) {
15655
+ return;
15656
+ }
15657
+ const urlSearchParams = new URLSearchParams(window.location.search);
15658
+ // Only append zCountry if it's already in the URL or the countryOverrideBehavior is URL_PARAM
15659
+ const shouldAppendParam = urlSearchParams.has('zCountry') ||
15660
+ zonosStore.helloSettings.countryOverrideBehavior === 'URL_PARAM';
15661
+ if (shouldAppendParam) {
15662
+ // Only append zCountry if it's not already in the URL
15663
+ urlSearchParams.set('zCountry', selectedCountryCode);
15664
+ const newUrl = `${window.location.pathname}?${urlSearchParams.toString()}`;
15665
+ /**
15666
+ * Setting the state to null in window.history.replaceState can cause issues with rendering when using next/link and pressing the back button.
15667
+ * @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
15668
+ **/
15669
+ window.history.replaceState(window.history.state, document.title, newUrl);
15670
+ }
15671
+ };
15672
+
15673
+ const { dispose: localizationDispose, onChange: localizationStoreOnChange, state: localizationStore, } = createStore({
15674
+ countryLandedCost: null,
15675
+ customMessages: [],
15676
+ exchangeRate: null,
15677
+ helloCountryList: null,
15678
+ inclusivePricingConfigurations: [],
15679
+ inclusivePricingIsFetching: false,
15680
+ isDisabledCountry: true,
15681
+ isShippableCountry: false,
15682
+ localizationLoaded: false,
15683
+ selectedCountryCode: null,
15684
+ selectedLocale: 'en',
15685
+ shippingZoneCountries: null,
15686
+ targetCurrency: 'USD',
15687
+ });
15688
+ const triggerGetExchangeRate = async (isGuaranteed) => {
15689
+ const { exchangeRate, maxAge } = await getExchangeRate({
15690
+ country: localizationStore.selectedCountryCode,
15691
+ isGuaranteed,
15692
+ sourceCurrency: zonosStore.sourceCurrency,
15693
+ targetCurrency: localizationStore.targetCurrency,
15694
+ });
15695
+ if (exchangeRate) {
15696
+ localizationStore.exchangeRate = exchangeRate;
15697
+ currencyDisplay();
15698
+ }
15699
+ return { maxAge };
15700
+ };
15701
+ /**
15702
+ * CHORE: This is mostly for legacy checkout as the country param is not guaranteed.
15703
+ */
15704
+ const DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT = 'CA';
15705
+ const getFallbackDefaultCountryCode = (allowedCountries) => {
15706
+ if (localizationStore.selectedCountryCode &&
15707
+ allowedCountries.includes(localizationStore.selectedCountryCode)) {
15708
+ return localizationStore.selectedCountryCode;
15709
+ }
15710
+ // Don't check if it is allowed. If it is not allowed it will fallback to Albania (first option).
15711
+ return DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT;
15712
+ };
15713
+ const refreshInclusivePricingConfigurations = async (countryCode) => {
15714
+ if (!countryCode) {
15715
+ return;
15716
+ }
15717
+ // These requests are only needed for Hello, so we can skip them for legacy checkout
15718
+ localizationStore.inclusivePricingIsFetching = true;
15719
+ const inclusivePricingConfigurations = await getInclusivePriceConfigurations(countryCode);
15720
+ localizationStore.inclusivePricingConfigurations =
15721
+ inclusivePricingConfigurations || [];
15722
+ localizationStore.inclusivePricingIsFetching = false;
15723
+ };
15724
+ // This recursive function is for users who step away from their computer and come back needing a new exchange rate
15725
+ const startExchangeRateTimeout = ({ isGuaranteed, maxAge, }) => {
15726
+ if (localizationStore.exchangeRateTimeout) {
15727
+ clearTimeout(localizationStore.exchangeRateTimeout);
15728
+ }
15729
+ // maxAge comes in seconds, convert to milliseconds
15730
+ const defaultMaxAge = 5 * 60;
15731
+ const maxAgeToUse = maxAge || defaultMaxAge;
15732
+ // Recursively set timeouts to get new exchange rates when the current one expires
15733
+ localizationStore.exchangeRateTimeout = setTimeout(async () => {
15734
+ // Refresh inclusive pricing configurations before getting a new exchange rate, so hello can use the new effective rate
15735
+ await refreshInclusivePricingConfigurations(localizationStore.selectedCountryCode);
15736
+ const { maxAge: newMaxAge } = await triggerGetExchangeRate(isGuaranteed);
15737
+ startExchangeRateTimeout({ isGuaranteed, maxAge: newMaxAge });
15738
+ }, maxAgeToUse * 1000);
15739
+ };
15740
+ const getNewLocalization = async ({ isInitializing, }) => {
15741
+ var _a, _b;
15742
+ log('get new localization store');
15743
+ const { isDisabledCountry, isShippableCountry, selectedCountryCode } = localizationStore;
15744
+ if (zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
15745
+ !isShippableCountry ||
15746
+ isDisabledCountry ||
15747
+ !selectedCountryCode) {
15748
+ return;
15749
+ }
15750
+ const isGuaranteed = zonosStore.checkoutSettings.visibilityStatus === 'ENABLED';
15751
+ // blur currency out before getting exchange rate
15752
+ performBlurCurrency();
15753
+ const { maxAge } = await triggerGetExchangeRate(isGuaranteed);
15754
+ startExchangeRateTimeout({ isGuaranteed, maxAge });
15755
+ if (isInitializing &&
15756
+ ((_a = window.Zonos.cartSettings) === null || _a === void 0 ? void 0 : _a.inclusivePriceConfigurations)) {
15757
+ localizationStore.inclusivePricingConfigurations =
15758
+ ((_b = window.Zonos.cartSettings) === null || _b === void 0 ? void 0 : _b.inclusivePriceConfigurations) || [];
15759
+ void removeBlurCurrency();
15760
+ }
15761
+ // These requests are only needed for Hello, so we can skip them for legacy checkout
15762
+ if (!window.Zonos.isLegacyCheckout) {
15763
+ localizationStore.inclusivePricingIsFetching = true;
15764
+ const [countryLandedCost] = await Promise.all([
15765
+ getCountryLandedCost(localizationStore.selectedCountryCode),
15766
+ refreshInclusivePricingConfigurations(localizationStore.selectedCountryCode),
15767
+ ]);
15768
+ localizationStore.countryLandedCost = countryLandedCost;
15769
+ // Remove blur effect after the currency is converted
15770
+ void removeBlurCurrency();
15771
+ }
15772
+ else {
15773
+ log('Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout');
15774
+ }
15775
+ };
15776
+ const getCustomMessages = async () => {
15777
+ log(`Getting custom messages for ${localizationStore.selectedCountryCode}`);
15778
+ if (!localizationStore.selectedCountryCode || !zonosStore.storeId) {
15779
+ return;
15780
+ }
15781
+ const localeMessages = await getLocaleMessages({
15782
+ countryCode: localizationStore.selectedCountryCode,
15783
+ localeTo: localizationStore.selectedLocale,
15784
+ storeId: zonosStore.storeId,
15785
+ });
15786
+ const allMessages = localeMessages.flatMap(x => {
15787
+ var _a;
15788
+ return {
15789
+ countryCode: localizationStore.selectedCountryCode,
15790
+ message: (_a = x.countryCodesPageMessageLinks.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message.textTo,
15791
+ pageName: x.pageName,
15792
+ };
15793
+ });
15794
+ localizationStore.customMessages = allMessages;
15795
+ };
15796
+ const getOverrideLocale = () => {
15797
+ const currentUrl = new URL(window.location.href);
15798
+ const zonosLocale = currentUrl.searchParams.get('zonosLocale');
15799
+ return zonosLocale;
15800
+ };
15801
+ const addInternationalHideClass = () => {
15802
+ if (localizationStore.isShippableCountry) {
15803
+ document.body.classList.add('z-intl');
15804
+ }
15805
+ else {
15806
+ document.body.classList.remove('z-intl');
15807
+ }
15808
+ };
15809
+ const getValidCountryCode = (countryCode) => {
15810
+ if (countryCode === 'UK') {
15811
+ return 'GB';
15812
+ }
15813
+ return countryCode;
15814
+ };
15815
+ const localizationStoreUpdateSelectedCountryCode = ({ isInitializing, newSelectedCountryCode, }) => {
15816
+ var _a, _b;
15817
+ log(`Updating selected country code to ${newSelectedCountryCode}`);
15818
+ const isFirstTime = !localizationStore.selectedCountryCode;
15819
+ localizationStore.selectedCountryCode = getValidCountryCode(newSelectedCountryCode);
15820
+ const { selectedCountryCode, shippingZoneCountries } = localizationStore;
15821
+ const isShippableCountry = !!shippingZoneCountries &&
15822
+ !!selectedCountryCode &&
15823
+ !!shippingZoneCountries[selectedCountryCode] &&
15824
+ // Make sure the country is not in the disabled countries list
15825
+ !zonosStore.disabledCountries.includes(selectedCountryCode);
15826
+ // update shippable country
15827
+ localizationStore.isShippableCountry = isShippableCountry;
15828
+ log(`${localizationStore.selectedCountryCode} is a shippable country: ${localizationStore.isShippableCountry}`);
15829
+ const isDisabledCountry = !!selectedCountryCode &&
15830
+ zonosStore.disabledCountries.includes(selectedCountryCode);
15831
+ localizationStore.isDisabledCountry = isDisabledCountry;
15832
+ log(`${localizationStore.selectedCountryCode} is a disabled country: ${localizationStore.isDisabledCountry}`);
15833
+ addInternationalHideClass();
15834
+ if (!selectedCountryCode) {
15835
+ return;
15836
+ }
15837
+ const currencyCode = getCurrencyCode(selectedCountryCode);
15838
+ // Only trigger callback onCountryChange if the country code has been set before
15839
+ if (!isFirstTime) {
15840
+ // Trigger callback onCountryChange
15841
+ (_a = zonosStore.onCountryChange) === null || _a === void 0 ? void 0 : _a.call(zonosStore, {
15842
+ countryCode: selectedCountryCode,
15843
+ currencyCode,
15844
+ isShippableCountry: isShippableCountry,
15845
+ });
15846
+ }
15847
+ if (!currencyCode) {
15848
+ return;
15849
+ }
15850
+ localizationStore.targetCurrency = currencyCode;
15851
+ void getNewLocalization({ isInitializing: isInitializing });
15852
+ // Save the country code to session storage for later use
15853
+ window.sessionStorage.setItem('zonos--country', selectedCountryCode);
15854
+ // Update the URL query param with the new country code
15855
+ setZCountryUrlParam(selectedCountryCode);
15856
+ (_b = document
15857
+ .querySelector('zonos-hello')) === null || _b === void 0 ? void 0 : _b.setAttribute('z-country', selectedCountryCode);
15858
+ };
15859
+ const initHelloCountryList = (allCountries) => {
15860
+ const showCountryList = zonosStore.helloSettings.showCountryList;
15861
+ const hellCountryList = localizationStore.shippingZoneCountries;
15862
+ if (!showCountryList || showCountryList === 'ONLY_SHIPPABLE') {
15863
+ // just use the shipping zone countries
15864
+ localizationStore.helloCountryList = hellCountryList;
15865
+ return;
15866
+ }
15867
+ if (showCountryList === 'ALL') {
15868
+ localizationStore.helloCountryList = allCountries;
15869
+ return;
15870
+ }
15871
+ // get all active countries in the showCountryList
15872
+ localizationStore.helloCountryList = showCountryList.reduce((acc, countryCode) => {
15873
+ const countryInfo = allCountries === null || allCountries === void 0 ? void 0 : allCountries[countryCode];
15874
+ return countryInfo
15875
+ ? Object.assign(Object.assign({}, acc), { [countryCode]: countryInfo }) : acc;
15876
+ }, {});
15877
+ };
15878
+ const updateCheckoutSessionLanguage = async () => {
15879
+ if (!storageStore.checkoutSessionId) {
15880
+ return null;
15881
+ }
15882
+ const { errors, json } = await handleFetch('/api/zonos-elements/update-checkout-session-metadata', {
15883
+ body: {
15884
+ id: storageStore.checkoutSessionId,
15885
+ metadata: [
15886
+ // This is being used from the backend to determine the language of the checkout session
15887
+ {
15888
+ key: 'language',
15889
+ value: localizationStore.selectedLocale,
15890
+ },
15891
+ ],
15892
+ },
15893
+ method: 'POST',
15894
+ });
15895
+ if (errors.length || !json) {
15896
+ logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
15897
+ return { errors, json };
15898
+ }
15899
+ return { errors: [], json };
15900
+ };
15901
+ const localizationStoreUpdateSelectedLocale = (newSelectedLocale) => {
15902
+ localizationStore.selectedLocale = newSelectedLocale;
15903
+ translationStoreUpdateLanguage(newSelectedLocale);
15904
+ void updateCheckoutSessionLanguage();
15905
+ void getCustomMessages();
15906
+ };
15907
+ const initLocalizationStore = async () => {
15908
+ var _a;
15909
+ // all countries from countries.json, shipping zone and localization
15910
+ const [allCountries, shippingZoneCountries, localization] = await Promise.all([getCountries(), getShippingZones(), getLocalization()]);
15911
+ // Filter countries to only include countries in the shipping zone
15912
+ const filteredCountries = shippingZoneCountries === null || shippingZoneCountries === void 0 ? void 0 : shippingZoneCountries.reduce((acc, countryCode) => {
15913
+ const countryInfo = allCountries === null || allCountries === void 0 ? void 0 : allCountries[countryCode];
15914
+ return countryInfo
15915
+ ? Object.assign(Object.assign({}, acc), { [countryCode]: countryInfo }) : acc;
15916
+ }, {});
15917
+ localizationStore.shippingZoneCountries = filteredCountries || null;
15918
+ localizationStore.inclusivePricingConfigurations =
15919
+ ((_a = window.Zonos.cartSettings) === null || _a === void 0 ? void 0 : _a.inclusivePriceConfigurations) || [];
15920
+ // Initialize the country list for the hello widget
15921
+ initHelloCountryList(allCountries || {});
15922
+ const { country, locale } = localization;
15923
+ log(`Country code from localization: ${country}`);
15924
+ log(`Locale from localization: ${locale}`);
15925
+ // update selected country code in store
15926
+ localizationStoreUpdateSelectedCountryCode({
15927
+ isInitializing: true,
15928
+ newSelectedCountryCode: country || null,
15929
+ });
15930
+ // use locale from params if it exists, otherwise use locale from localization
15931
+ const overrideLocale = getOverrideLocale();
15932
+ localizationStoreUpdateSelectedLocale(overrideLocale || locale || 'en');
15933
+ const devSites = [
15934
+ 'dev.storybook.elements',
15935
+ 'dev.elements',
15936
+ 'dev.demo.elements',
15937
+ 'dev.dashboard',
15938
+ ];
15939
+ // If the country code is not set, set it to the US for development (vercel can't get geo country in dev)
15940
+ if (!localizationStore.selectedCountryCode &&
15941
+ devSites.some(site => window.location.origin.includes(site))) {
15942
+ // update selected country code in store
15943
+ localizationStoreUpdateSelectedCountryCode({
15944
+ isInitializing: true,
15945
+ newSelectedCountryCode: 'CA',
15946
+ });
15947
+ }
15948
+ localizationStore.localizationLoaded = true;
15949
+ };
15950
+
15951
+ 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, translationStoreOnChange as p, storageStoreOnChange as q, getFallbackDefaultCountryCode as r, storageStore as s, translate as t, localizationStoreUpdateSelectedLocale as u };