@zonos/elements 1.3.233 → 1.3.235

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 (420) 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} +75 -92
  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 +468 -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-invoice/assets/ChevronDownIcon.svg +1 -0
  48. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/assets/empty-item.jpeg +0 -0
  49. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.css +72 -0
  50. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-cart-items/zonos-invoice-cart-items.js +87 -0
  51. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/RemoveIcon.svg +1 -0
  52. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/assets/SuccessIcon.svg +1 -0
  53. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.css +90 -0
  54. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-finish/zonos-invoice-finish.js +405 -0
  55. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/chevronDownIcon.svg +1 -0
  56. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/globe.svg +3 -0
  57. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconDark.svg +10 -0
  58. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosIconLight.svg +10 -0
  59. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/assets/zonosWordmark.svg +7 -0
  60. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.css +155 -0
  61. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-footer/zonos-invoice-footer.js +165 -0
  62. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronDownIcon.svg +1 -0
  63. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/assets/ChevronUpIcon.svg +1 -0
  64. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.css +117 -0
  65. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-order-details/zonos-invoice-order-details.js +175 -0
  66. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/CheckmarkLineIcon.svg +1 -0
  67. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/assets/RemoveLineIcon.svg +1 -0
  68. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.css +98 -0
  69. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-payment/zonos-invoice-payment.js +368 -0
  70. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.css +71 -0
  71. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-review/zonos-invoice-review.js +151 -0
  72. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.css +83 -0
  73. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice-subtotal/zonos-invoice-subtotal.js +65 -0
  74. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.css +350 -0
  75. package/dist/collection/components/checkout/zonos-invoice/zonos-invoice.js +547 -0
  76. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  77. package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
  78. package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
  79. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
  80. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  81. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  82. package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
  83. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +3 -3
  84. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  85. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
  86. package/dist/collection/components/common/zonos-h-stack/zonos-h-stack.js +2 -2
  87. package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
  88. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  89. package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
  90. package/dist/collection/components/common/zonos-loading-overlay/zonos-loading-overlay.js +1 -1
  91. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  92. package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
  93. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  94. package/dist/collection/components/common/zonos-skeleton/zonos-skeleton.js +1 -1
  95. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +5 -5
  96. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +5 -5
  97. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +5 -5
  98. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  99. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  100. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  101. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  102. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  103. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  104. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  105. package/dist/collection/components/main/zonos-controller.js +45 -4
  106. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  107. package/dist/collection/components/store/checkout/invoice.js +148 -0
  108. package/dist/collection/components/store/checkout/stripe.js +8 -3
  109. package/dist/collection/components/store/translationStore/strings.arabic.js +9 -0
  110. package/dist/collection/components/store/translationStore/strings.base.js +9 -0
  111. package/dist/collection/components/store/translationStore/strings.chinese.js +9 -0
  112. package/dist/collection/components/store/translationStore/strings.danish.js +9 -0
  113. package/dist/collection/components/store/translationStore/strings.dutch.js +9 -0
  114. package/dist/collection/components/store/translationStore/strings.french.js +9 -0
  115. package/dist/collection/components/store/translationStore/strings.german.js +9 -0
  116. package/dist/collection/components/store/translationStore/strings.hebrew.js +9 -0
  117. package/dist/collection/components/store/translationStore/strings.indonesian.js +9 -0
  118. package/dist/collection/components/store/translationStore/strings.italian.js +9 -0
  119. package/dist/collection/components/store/translationStore/strings.japanese.js +9 -0
  120. package/dist/collection/components/store/translationStore/strings.korean.js +9 -0
  121. package/dist/collection/components/store/translationStore/strings.norwegian.js +9 -0
  122. package/dist/collection/components/store/translationStore/strings.polish.js +9 -0
  123. package/dist/collection/components/store/translationStore/strings.portuguese.js +9 -0
  124. package/dist/collection/components/store/translationStore/strings.russian.js +9 -0
  125. package/dist/collection/components/store/translationStore/strings.spanish.js +9 -0
  126. package/dist/collection/components/store/translationStore/strings.swedish.js +9 -0
  127. package/dist/collection/components/store/translationStore/strings.turkish.js +9 -0
  128. package/dist/collection/components/store/translationStore/strings.vietnamese.js +9 -0
  129. package/dist/collection/components/stripe/zonos-address/zonos-address.js +8 -5
  130. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +2 -2
  131. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +2 -2
  132. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  133. package/dist/collection/components/utils/checkout/initInvoice.js +15 -0
  134. package/dist/collection/components/utils/checkout/isInvoiceMobileTablet.js +10 -0
  135. package/dist/collection/scripts/_zonosBase.js +4 -0
  136. package/dist/collection/types/generated/graphql.frontend.types.js +4 -0
  137. package/dist/collection/types/generated/graphql.internal.types.js +239 -5
  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} +15 -31
  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 +464 -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/api/getLocaleMessages.d.ts +1 -1
  263. package/dist/types/components/utils/checkout/initInvoice.d.ts +1 -0
  264. package/dist/types/components/utils/checkout/isInvoiceMobileTablet.d.ts +4 -0
  265. package/dist/types/components.d.ts +351 -0
  266. package/dist/types/scripts/_zonosBase.d.ts +5 -0
  267. package/dist/types/types/checkout/api/CheckoutSession.d.ts +4 -0
  268. package/dist/types/types/checkout/api/PartyInfo.d.ts +21 -0
  269. package/dist/types/types/generated/graphql.frontend.types.d.ts +5 -1
  270. package/dist/types/types/generated/graphql.frontend.types.ts +5 -1
  271. package/dist/types/types/generated/graphql.internal.types.d.ts +285 -8
  272. package/dist/types/types/generated/graphql.internal.types.ts +367 -10
  273. package/dist/zonos-elements/index.esm.js +1 -1
  274. package/dist/zonos-elements/p-00719e49.entry.js +1 -0
  275. package/dist/zonos-elements/p-01b0a2e2.js +1 -0
  276. package/dist/zonos-elements/p-01dada4e.js +1 -0
  277. package/dist/zonos-elements/p-0c64dbbb.js +1 -0
  278. package/dist/zonos-elements/p-0cd5bcb3.entry.js +1 -0
  279. package/dist/zonos-elements/p-0e82fcea.entry.js +1 -0
  280. package/dist/zonos-elements/p-10316d4d.system.entry.js +1 -0
  281. package/dist/zonos-elements/{p-0a90dd80.system.entry.js → p-121c60c1.system.entry.js} +1 -1
  282. package/dist/zonos-elements/{p-bf9d889f.entry.js → p-14314ad3.entry.js} +1 -1
  283. package/dist/zonos-elements/p-170314a3.js +1 -0
  284. package/dist/zonos-elements/p-17a09191.entry.js +1 -0
  285. package/dist/zonos-elements/p-18bc6c7a.entry.js +1 -0
  286. package/dist/zonos-elements/{p-a25428eb.system.js → p-18d20206.system.js} +2 -2
  287. package/dist/zonos-elements/p-1a30fe18.system.entry.js +1 -0
  288. package/dist/zonos-elements/{p-c7b658cb.entry.js → p-1c4d12f0.entry.js} +1 -1
  289. package/dist/zonos-elements/p-1f3549c6.js +1 -0
  290. package/dist/zonos-elements/p-2250e585.entry.js +1 -0
  291. package/dist/zonos-elements/p-248dd596.system.entry.js +1 -0
  292. package/dist/zonos-elements/{p-5f398c28.entry.js → p-264690d7.entry.js} +1 -1
  293. package/dist/zonos-elements/p-2670438c.system.js +1 -0
  294. package/dist/zonos-elements/p-27f6930b.js +1 -0
  295. package/dist/zonos-elements/{p-eea0eb57.system.entry.js → p-2f869f2c.system.entry.js} +1 -1
  296. package/dist/zonos-elements/p-30c661b3.system.entry.js +1 -0
  297. package/dist/zonos-elements/p-34bf7bbe.system.js +1 -0
  298. package/dist/zonos-elements/p-38913b2f.entry.js +1 -0
  299. package/dist/zonos-elements/p-3bec13dd.system.js +1 -0
  300. package/dist/zonos-elements/{p-00ec22b2.entry.js → p-43a22d85.entry.js} +1 -1
  301. package/dist/zonos-elements/p-44b50260.entry.js +1 -0
  302. package/dist/zonos-elements/p-48dc96f9.system.entry.js +1 -0
  303. package/dist/zonos-elements/p-4aa86184.system.entry.js +1 -0
  304. package/dist/zonos-elements/p-4d594c8e.system.js +1 -0
  305. package/dist/zonos-elements/p-4ffbb0d6.system.js +1 -0
  306. package/dist/zonos-elements/{p-452fb638.system.entry.js → p-5062dcf3.system.entry.js} +1 -1
  307. package/dist/zonos-elements/p-50f31c12.system.entry.js +1 -0
  308. package/dist/zonos-elements/{p-c5cb2364.system.entry.js → p-57cee1b5.system.entry.js} +1 -1
  309. package/dist/zonos-elements/p-59a76f73.entry.js +1 -0
  310. package/dist/zonos-elements/{p-d556c6d1.system.entry.js → p-5afb9260.system.entry.js} +1 -1
  311. package/dist/zonos-elements/{p-88ea9f82.entry.js → p-6626d240.entry.js} +1 -1
  312. package/dist/zonos-elements/p-6688473e.entry.js +1 -0
  313. package/dist/zonos-elements/p-6f23a26a.system.js +1 -0
  314. package/dist/zonos-elements/{p-82739127.js → p-73c737aa.js} +2 -2
  315. package/dist/zonos-elements/p-757d4c62.system.entry.js +1 -0
  316. package/dist/zonos-elements/p-7aa50ef2.entry.js +1 -0
  317. package/dist/zonos-elements/p-7e17667d.js +1 -0
  318. package/dist/zonos-elements/p-7e469c5c.entry.js +1 -0
  319. package/dist/zonos-elements/p-7f91617c.system.entry.js +1 -0
  320. package/dist/zonos-elements/p-81e3eb5b.js +1 -0
  321. package/dist/zonos-elements/p-82febf70.system.js +1 -0
  322. package/dist/zonos-elements/{p-770852bf.system.entry.js → p-836db369.system.entry.js} +1 -1
  323. package/dist/zonos-elements/p-83b3f824.system.entry.js +1 -0
  324. package/dist/zonos-elements/p-851011aa.system.entry.js +1 -0
  325. package/dist/zonos-elements/{p-936b54c1.entry.js → p-865536f0.entry.js} +1 -1
  326. package/dist/zonos-elements/{p-b1fd1ec2.system.entry.js → p-8792fef2.system.entry.js} +1 -1
  327. package/dist/zonos-elements/p-890bfc42.system.entry.js +1 -0
  328. package/dist/zonos-elements/{p-c288c6da.system.entry.js → p-89a5e936.system.entry.js} +1 -1
  329. package/dist/zonos-elements/p-8af188f8.system.js +1 -0
  330. package/dist/zonos-elements/p-8d3a62fb.entry.js +1 -0
  331. package/dist/zonos-elements/{p-00ac999f.system.entry.js → p-8dc025c7.system.entry.js} +1 -1
  332. package/dist/zonos-elements/p-944d00da.entry.js +1 -0
  333. package/dist/zonos-elements/p-9479f155.system.js +1 -0
  334. package/dist/zonos-elements/p-95dc475b.system.js +1 -0
  335. package/dist/zonos-elements/p-976afc17.system.js +1 -0
  336. package/dist/zonos-elements/p-9b9bfb6d.entry.js +1 -0
  337. package/dist/zonos-elements/{p-55e2e4ed.entry.js → p-9f1bd9b8.entry.js} +1 -1
  338. package/dist/zonos-elements/p-9fa32fdf.js +1 -0
  339. package/dist/zonos-elements/p-a2a0bf4e.js +1 -0
  340. package/dist/zonos-elements/p-a610c24e.system.entry.js +1 -0
  341. package/dist/zonos-elements/{p-9b8750f3.entry.js → p-aedd3911.entry.js} +1 -1
  342. package/dist/zonos-elements/{p-db628e49.system.entry.js → p-b5c31ca4.system.entry.js} +1 -1
  343. package/dist/zonos-elements/p-ba456282.system.entry.js +1 -0
  344. package/dist/zonos-elements/{p-31af91f0.entry.js → p-bd603c1a.entry.js} +1 -1
  345. package/dist/zonos-elements/p-c2442878.system.js +1 -1
  346. package/dist/zonos-elements/p-c8cc20d9.system.js +1 -0
  347. package/dist/zonos-elements/p-dc5fb21c.js +1 -0
  348. package/dist/zonos-elements/p-dc94d7eb.js +1 -0
  349. package/dist/zonos-elements/{p-540cec7e.system.entry.js → p-e9e6bea7.system.entry.js} +1 -1
  350. package/dist/zonos-elements/p-eb9ee025.system.js +1 -0
  351. package/dist/zonos-elements/p-ed8ae947.system.entry.js +1 -0
  352. package/dist/zonos-elements/p-f1d4d6da.entry.js +1 -0
  353. package/dist/zonos-elements/p-f1d9dd4e.entry.js +1 -0
  354. package/dist/zonos-elements/p-f3962950.system.entry.js +1 -0
  355. package/dist/zonos-elements/p-f4e976ae.entry.js +1 -0
  356. package/dist/zonos-elements/p-f513b231.entry.js +1 -0
  357. package/dist/zonos-elements/p-f64207fa.system.entry.js +1 -0
  358. package/dist/zonos-elements/{p-31975752.entry.js → p-fa322dc1.entry.js} +1 -1
  359. package/dist/zonos-elements/p-fb9fb873.system.entry.js +1 -0
  360. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  361. package/package.json +1 -1
  362. package/dist/cjs/localization-39516612.js +0 -884
  363. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +0 -168
  364. package/dist/esm/localization-c5029ffc.js +0 -863
  365. package/dist/esm/zonos-confirm-dialog_2.entry.js +0 -163
  366. package/dist/esm-es5/cart-14f305b3.js +0 -1
  367. package/dist/esm-es5/localization-c5029ffc.js +0 -1
  368. package/dist/esm-es5/placeTestOrder-2250f719.js +0 -1
  369. package/dist/esm-es5/renderFallback-dbf1e3ae.js +0 -1
  370. package/dist/esm-es5/shouldRenderTaxIdInput-8bc112bb.js +0 -1
  371. package/dist/esm-es5/translationStore-690c4e04.js +0 -1
  372. package/dist/esm-es5/zonos-address_11.entry.js +0 -1
  373. package/dist/esm-es5/zonos-banner_2.entry.js +0 -1
  374. package/dist/esm-es5/zonos-cart-items_13.entry.js +0 -1
  375. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +0 -1
  376. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +0 -1
  377. package/dist/zonos-elements/p-03ff7b01.system.entry.js +0 -1
  378. package/dist/zonos-elements/p-100f6a88.system.entry.js +0 -1
  379. package/dist/zonos-elements/p-143d706b.entry.js +0 -1
  380. package/dist/zonos-elements/p-14d7489d.js +0 -1
  381. package/dist/zonos-elements/p-1bfae137.entry.js +0 -1
  382. package/dist/zonos-elements/p-1d5aa016.system.js +0 -1
  383. package/dist/zonos-elements/p-1eae4987.entry.js +0 -1
  384. package/dist/zonos-elements/p-23b45714.system.entry.js +0 -1
  385. package/dist/zonos-elements/p-2557b96b.js +0 -1
  386. package/dist/zonos-elements/p-2ca8b037.entry.js +0 -1
  387. package/dist/zonos-elements/p-2dbcecf4.entry.js +0 -1
  388. package/dist/zonos-elements/p-316f9052.system.entry.js +0 -1
  389. package/dist/zonos-elements/p-3185968f.entry.js +0 -1
  390. package/dist/zonos-elements/p-4e41143a.system.entry.js +0 -1
  391. package/dist/zonos-elements/p-52b87408.system.entry.js +0 -1
  392. package/dist/zonos-elements/p-561be3a2.system.js +0 -1
  393. package/dist/zonos-elements/p-5c680f72.js +0 -1
  394. package/dist/zonos-elements/p-5f77d19e.js +0 -1
  395. package/dist/zonos-elements/p-74ca7739.entry.js +0 -1
  396. package/dist/zonos-elements/p-767a31a8.system.js +0 -1
  397. package/dist/zonos-elements/p-78a6e775.system.js +0 -1
  398. package/dist/zonos-elements/p-7c705c76.system.js +0 -1
  399. package/dist/zonos-elements/p-81ba2820.system.entry.js +0 -1
  400. package/dist/zonos-elements/p-84078c57.system.js +0 -1
  401. package/dist/zonos-elements/p-8a23bbf5.js +0 -1
  402. package/dist/zonos-elements/p-905d2490.entry.js +0 -1
  403. package/dist/zonos-elements/p-93f2e1ee.system.entry.js +0 -1
  404. package/dist/zonos-elements/p-a0a4e43d.system.entry.js +0 -1
  405. package/dist/zonos-elements/p-a2819807.system.entry.js +0 -1
  406. package/dist/zonos-elements/p-a6e74856.entry.js +0 -1
  407. package/dist/zonos-elements/p-ae940a99.js +0 -1
  408. package/dist/zonos-elements/p-b7ea5f4f.system.entry.js +0 -1
  409. package/dist/zonos-elements/p-c0c458f7.system.entry.js +0 -1
  410. package/dist/zonos-elements/p-c1ecab92.entry.js +0 -1
  411. package/dist/zonos-elements/p-c50cc926.entry.js +0 -1
  412. package/dist/zonos-elements/p-cf765af3.system.js +0 -1
  413. package/dist/zonos-elements/p-e03e1a62.entry.js +0 -1
  414. package/dist/zonos-elements/p-e7874318.system.entry.js +0 -1
  415. package/dist/zonos-elements/p-e8949e7e.entry.js +0 -1
  416. package/dist/zonos-elements/p-ea0b5d10.system.js +0 -1
  417. package/dist/zonos-elements/p-eae3462c.entry.js +0 -1
  418. package/dist/zonos-elements/p-eeb1081e.js +0 -1
  419. package/dist/zonos-elements/p-f892595d.system.entry.js +0 -1
  420. package/dist/zonos-elements/p-fd3b46ee.entry.js +0 -1
@@ -1,6 +1,71 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-37a4b4f4.js');
4
+ const handleFetch = require('./handleFetch-954f30e1.js');
5
+ const VarianceTest = require('./VarianceTest-bec00ea8.js');
6
+
7
+ /**
8
+ * Check if the response contains at least one available test key that we support
9
+ */
10
+ const hasAtLeastOneAvailableTestKey = (rawResponse) => {
11
+ const hasAvailableTestKey = !!rawResponse.find(item => item.testKey in VarianceTest.availableTestKeys);
12
+ if (!hasAvailableTestKey) {
13
+ VarianceTest.log('No available test key found in response', 'info', {
14
+ response: rawResponse,
15
+ });
16
+ }
17
+ return !!rawResponse.find(item => item.testKey in VarianceTest.availableTestKeys);
18
+ };
19
+
20
+ /**
21
+ * Filter the response to only include test keys and variants key that we support
22
+ */
23
+ const filterValidTests = (testKeys) => {
24
+ // Type guard the response to ensure it matches the expected structure
25
+ if (!hasAtLeastOneAvailableTestKey(testKeys)) {
26
+ return [];
27
+ }
28
+ // Filter the response to only include test keys that we support
29
+ return testKeys
30
+ .filter(item => {
31
+ var _a;
32
+ const isTestKeyValidButNoSelectedVariantKey = VarianceTest.availableTestKeys[item.testKey] && !item.selectedVariantKey;
33
+ const validTestKeyWithSelectedVariantKey = item.selectedVariantKey &&
34
+ !!((_a = VarianceTest.availableTestKeys[item.testKey]) === null || _a === void 0 ? void 0 : _a['availableVariants'].includes(item.selectedVariantKey));
35
+ return (isTestKeyValidButNoSelectedVariantKey ||
36
+ validTestKeyWithSelectedVariantKey);
37
+ })
38
+ .map(item => (Object.assign(Object.assign({}, item), { expiresAt: item.expiresAt || Date.now() + VARIANT_TEST_KEY_EXPIRATION, selectedVariantKey: item.selectedVariantKey || null })));
39
+ };
40
+
41
+ /**
42
+ * Expiration time for variant test keys in milliseconds
43
+ * @default 1 day
44
+ */
45
+ const VARIANT_TEST_KEY_EXPIRATION = 60 * 60 * 24 * 1000;
46
+ const { onChange: storageStoreOnChange, state: storageStore } = zonosStore.createStore({
47
+ checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id'),
48
+ enabledVariantTestKeys: handleFetch.jsonParse(localStorage.getItem('zonos--enabled-variant-test-keys')),
49
+ });
50
+ storageStoreOnChange('enabledVariantTestKeys', () => {
51
+ var _a;
52
+ // This should be set in localStorage so we don't have multiple tests for the same user in short period of time
53
+ if (!((_a = storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.length)) {
54
+ localStorage.removeItem('zonos--enabled-variant-test-keys');
55
+ return;
56
+ }
57
+ localStorage.setItem('zonos--enabled-variant-test-keys', JSON.stringify(storageStore.enabledVariantTestKeys));
58
+ });
59
+ storageStoreOnChange('checkoutSessionId', () => {
60
+ if (!storageStore.checkoutSessionId) {
61
+ sessionStorage.removeItem('zonos--checkout-session-id');
62
+ return;
63
+ }
64
+ sessionStorage.setItem('zonos--checkout-session-id', storageStore.checkoutSessionId);
65
+ });
66
+ const storageStoreSetEnabledVariantTestKeys = (testKeys) => {
67
+ storageStore.enabledVariantTestKeys = filterValidTests(testKeys);
68
+ };
4
69
 
5
70
  const stringsArabic = {
6
71
  ' (Duties due at door)': {
@@ -282,6 +347,9 @@ const stringsArabic = {
282
347
  'Invalid session': {
283
348
  value: 'جلسة غير صالحة',
284
349
  },
350
+ 'Invoice:': {
351
+ value: 'فاتورة:',
352
+ },
285
353
  Island: {
286
354
  value: 'جزيرة',
287
355
  },
@@ -396,6 +464,9 @@ const stringsArabic = {
396
464
  "Payment processing. We'll update you when payment is received.": {
397
465
  value: 'جارٍ معالجة الدفع. سنحدثك عند استلام الدفعة.',
398
466
  },
467
+ 'Payment total': {
468
+ value: 'إجمالي الدفع',
469
+ },
399
470
  'Personal Customers Clearance Code': {
400
471
  value: 'رمز تخليص العملاء الشخصيين',
401
472
  },
@@ -438,6 +509,9 @@ const stringsArabic = {
438
509
  'Prepay duties and taxes at checkout': {
439
510
  value: 'دفع الرسوم والضرائب مقدمًا عند الدفع',
440
511
  },
512
+ 'Privacy policy': {
513
+ value: 'سياسة الخصوصية',
514
+ },
441
515
  'Proceed with order': {
442
516
  value: 'المتابعة مع الطلب',
443
517
  },
@@ -1024,6 +1098,9 @@ const stringsBase = {
1024
1098
  'Invalid session': {
1025
1099
  value: 'Invalid session',
1026
1100
  },
1101
+ 'Invoice:': {
1102
+ value: 'Invoice:',
1103
+ },
1027
1104
  Island: {
1028
1105
  value: 'Island',
1029
1106
  },
@@ -1138,6 +1215,9 @@ const stringsBase = {
1138
1215
  "Payment processing. We'll update you when payment is received.": {
1139
1216
  value: "Payment processing. We'll update you when payment is received.",
1140
1217
  },
1218
+ 'Payment total': {
1219
+ value: 'Payment total',
1220
+ },
1141
1221
  'Personal Customers Clearance Code': {
1142
1222
  value: 'Personal Customers Clearance Code',
1143
1223
  },
@@ -1180,6 +1260,9 @@ const stringsBase = {
1180
1260
  'Prepay duties and taxes at checkout': {
1181
1261
  value: 'Prepay duties and taxes at checkout',
1182
1262
  },
1263
+ 'Privacy policy': {
1264
+ value: 'Privacy policy',
1265
+ },
1183
1266
  'Proceed with order': {
1184
1267
  value: 'Proceed with order',
1185
1268
  },
@@ -1765,6 +1848,9 @@ const stringsChinese = {
1765
1848
  'Invalid session': {
1766
1849
  value: '无效的会话',
1767
1850
  },
1851
+ 'Invoice:': {
1852
+ value: '发票:',
1853
+ },
1768
1854
  Island: {
1769
1855
  value: '岛',
1770
1856
  },
@@ -1879,6 +1965,9 @@ const stringsChinese = {
1879
1965
  "Payment processing. We'll update you when payment is received.": {
1880
1966
  value: '付款处理中。付款收到后,我们将通知您。',
1881
1967
  },
1968
+ 'Payment total': {
1969
+ value: '付款总额',
1970
+ },
1882
1971
  'Personal Customers Clearance Code': {
1883
1972
  value: '个人客户清关代码',
1884
1973
  },
@@ -1921,6 +2010,9 @@ const stringsChinese = {
1921
2010
  'Prepay duties and taxes at checkout': {
1922
2011
  value: '在结账时预付关税和税款',
1923
2012
  },
2013
+ 'Privacy policy': {
2014
+ value: '隐私政策',
2015
+ },
1924
2016
  'Proceed with order': {
1925
2017
  value: '继续订单',
1926
2018
  },
@@ -2506,6 +2598,9 @@ const stringsDanish = {
2506
2598
  'Invalid session': {
2507
2599
  value: 'Ugyldig session',
2508
2600
  },
2601
+ 'Invoice:': {
2602
+ value: 'Faktura:',
2603
+ },
2509
2604
  Island: {
2510
2605
  value: 'Ø',
2511
2606
  },
@@ -2620,6 +2715,9 @@ const stringsDanish = {
2620
2715
  "Payment processing. We'll update you when payment is received.": {
2621
2716
  value: 'Behandler betaling. Vi opdaterer dig, når betalingen er modtaget.',
2622
2717
  },
2718
+ 'Payment total': {
2719
+ value: 'Betaling i alt',
2720
+ },
2623
2721
  'Personal Customers Clearance Code': {
2624
2722
  value: 'Personlige Kunders Toldkode',
2625
2723
  },
@@ -2662,6 +2760,9 @@ const stringsDanish = {
2662
2760
  'Prepay duties and taxes at checkout': {
2663
2761
  value: 'Betal told og skatter på forhånd ved kassen',
2664
2762
  },
2763
+ 'Privacy policy': {
2764
+ value: 'Privatlivspolitik',
2765
+ },
2665
2766
  'Proceed with order': {
2666
2767
  value: 'Fortsæt med ordren',
2667
2768
  },
@@ -3247,6 +3348,9 @@ const stringsDutch = {
3247
3348
  'Invalid session': {
3248
3349
  value: 'Ongeldige sessie',
3249
3350
  },
3351
+ 'Invoice:': {
3352
+ value: 'Factuur:',
3353
+ },
3250
3354
  Island: {
3251
3355
  value: 'Eiland',
3252
3356
  },
@@ -3361,6 +3465,9 @@ const stringsDutch = {
3361
3465
  "Payment processing. We'll update you when payment is received.": {
3362
3466
  value: 'Betaling verwerken. We brengen je op de hoogte wanneer de betaling is ontvangen.',
3363
3467
  },
3468
+ 'Payment total': {
3469
+ value: 'Betalingstotaal',
3470
+ },
3364
3471
  'Personal Customers Clearance Code': {
3365
3472
  value: 'Persoonlijke Klanten Invoercode',
3366
3473
  },
@@ -3403,6 +3510,9 @@ const stringsDutch = {
3403
3510
  'Prepay duties and taxes at checkout': {
3404
3511
  value: 'Heffingen en belastingen vooraf betalen bij het afrekenen',
3405
3512
  },
3513
+ 'Privacy policy': {
3514
+ value: 'Privacybeleid',
3515
+ },
3406
3516
  'Proceed with order': {
3407
3517
  value: 'Doorgaan met de bestelling',
3408
3518
  },
@@ -3988,6 +4098,9 @@ const stringsFrench = {
3988
4098
  'Invalid session': {
3989
4099
  value: 'Session invalide',
3990
4100
  },
4101
+ 'Invoice:': {
4102
+ value: 'Facture:',
4103
+ },
3991
4104
  Island: {
3992
4105
  value: 'Île',
3993
4106
  },
@@ -4102,6 +4215,9 @@ const stringsFrench = {
4102
4215
  "Payment processing. We'll update you when payment is received.": {
4103
4216
  value: 'Traitement du paiement en cours. Nous vous tiendrons informé dès réception du paiement.',
4104
4217
  },
4218
+ 'Payment total': {
4219
+ value: 'Total du paiement',
4220
+ },
4105
4221
  'Personal Customers Clearance Code': {
4106
4222
  value: 'Code de Dédouanement des Clients Personnels',
4107
4223
  },
@@ -4144,6 +4260,9 @@ const stringsFrench = {
4144
4260
  'Prepay duties and taxes at checkout': {
4145
4261
  value: "Payez les droits et taxes à l'avance lors du checkout",
4146
4262
  },
4263
+ 'Privacy policy': {
4264
+ value: 'Politique de confidentialité',
4265
+ },
4147
4266
  'Proceed with order': {
4148
4267
  value: 'Procéder à la commande',
4149
4268
  },
@@ -4729,6 +4848,9 @@ const stringsGerman = {
4729
4848
  'Invalid session': {
4730
4849
  value: 'Ungültige Sitzung',
4731
4850
  },
4851
+ 'Invoice:': {
4852
+ value: 'Rechnung:',
4853
+ },
4732
4854
  Island: {
4733
4855
  value: 'Insel',
4734
4856
  },
@@ -4843,6 +4965,9 @@ const stringsGerman = {
4843
4965
  "Payment processing. We'll update you when payment is received.": {
4844
4966
  value: 'Zahlung wird verarbeitet. Wir informieren Sie, sobald die Zahlung eingegangen ist.',
4845
4967
  },
4968
+ 'Payment total': {
4969
+ value: 'Zahlungssumme',
4970
+ },
4846
4971
  'Personal Customers Clearance Code': {
4847
4972
  value: 'Zollabfertigungscode für Privatkunden',
4848
4973
  },
@@ -4885,6 +5010,9 @@ const stringsGerman = {
4885
5010
  'Prepay duties and taxes at checkout': {
4886
5011
  value: 'Zölle und Steuern im Voraus bezahlen',
4887
5012
  },
5013
+ 'Privacy policy': {
5014
+ value: 'Datenschutzrichtlinie',
5015
+ },
4888
5016
  'Proceed with order': {
4889
5017
  value: 'Mit der Bestellung fortfahren',
4890
5018
  },
@@ -5470,6 +5598,9 @@ const stringsHebrew = {
5470
5598
  'Invalid session': {
5471
5599
  value: 'סשן לא חוקי',
5472
5600
  },
5601
+ 'Invoice:': {
5602
+ value: 'חשבונית:',
5603
+ },
5473
5604
  Island: {
5474
5605
  value: 'אי',
5475
5606
  },
@@ -5584,6 +5715,9 @@ const stringsHebrew = {
5584
5715
  "Payment processing. We'll update you when payment is received.": {
5585
5716
  value: 'התשלום מעובד. נעדכן אותך כשהתשלום יתקבל.',
5586
5717
  },
5718
+ 'Payment total': {
5719
+ value: 'סך התשלום',
5720
+ },
5587
5721
  'Personal Customers Clearance Code': {
5588
5722
  value: 'קוד שחרור מכס ללקוחות פרטיים',
5589
5723
  },
@@ -5626,6 +5760,9 @@ const stringsHebrew = {
5626
5760
  'Prepay duties and taxes at checkout': {
5627
5761
  value: 'שלם מכסים ומסים מראש בעת התשלום',
5628
5762
  },
5763
+ 'Privacy policy': {
5764
+ value: 'מדיניות פרטיות',
5765
+ },
5629
5766
  'Proceed with order': {
5630
5767
  value: 'המשך עם ההזמנה',
5631
5768
  },
@@ -6211,6 +6348,9 @@ const stringsIndonesian = {
6211
6348
  'Invalid session': {
6212
6349
  value: 'Sesi tidak valid',
6213
6350
  },
6351
+ 'Invoice:': {
6352
+ value: 'Faktur:',
6353
+ },
6214
6354
  Island: {
6215
6355
  value: 'Pulau',
6216
6356
  },
@@ -6325,6 +6465,9 @@ const stringsIndonesian = {
6325
6465
  "Payment processing. We'll update you when payment is received.": {
6326
6466
  value: 'Pemrosesan pembayaran. Kami akan memberi Anda pembaruan ketika pembayaran diterima.',
6327
6467
  },
6468
+ 'Payment total': {
6469
+ value: 'Total pembayaran',
6470
+ },
6328
6471
  'Personal Customers Clearance Code': {
6329
6472
  value: 'Kode Pembebasan Pelanggan Pribadi',
6330
6473
  },
@@ -6367,6 +6510,9 @@ const stringsIndonesian = {
6367
6510
  'Prepay duties and taxes at checkout': {
6368
6511
  value: 'Pembayaran bea masuk dan pajak di kasir',
6369
6512
  },
6513
+ 'Privacy policy': {
6514
+ value: 'Kebijakan privasi',
6515
+ },
6370
6516
  'Proceed with order': {
6371
6517
  value: 'Lanjutkan dengan pesanan',
6372
6518
  },
@@ -6952,6 +7098,9 @@ const stringsItalian = {
6952
7098
  'Invalid session': {
6953
7099
  value: 'Sessione non valida',
6954
7100
  },
7101
+ 'Invoice:': {
7102
+ value: 'Fattura:',
7103
+ },
6955
7104
  Island: {
6956
7105
  value: 'Isola',
6957
7106
  },
@@ -7066,6 +7215,9 @@ const stringsItalian = {
7066
7215
  "Payment processing. We'll update you when payment is received.": {
7067
7216
  value: 'Elaborazione pagamento in corso. Ti aggiorneremo quando il pagamento sarà ricevuto.',
7068
7217
  },
7218
+ 'Payment total': {
7219
+ value: 'Totale del pagamento',
7220
+ },
7069
7221
  'Personal Customers Clearance Code': {
7070
7222
  value: 'Codice di Sdoganamento per Clienti Personali',
7071
7223
  },
@@ -7108,6 +7260,9 @@ const stringsItalian = {
7108
7260
  'Prepay duties and taxes at checkout': {
7109
7261
  value: 'Paga dazi e tasse anticipatamente',
7110
7262
  },
7263
+ 'Privacy policy': {
7264
+ value: 'Informativa sulla privacy',
7265
+ },
7111
7266
  'Proceed with order': {
7112
7267
  value: "Procedi con l'ordine",
7113
7268
  },
@@ -7693,6 +7848,9 @@ const stringsJapanese = {
7693
7848
  'Invalid session': {
7694
7849
  value: '無効なセッション',
7695
7850
  },
7851
+ 'Invoice:': {
7852
+ value: '請求書:',
7853
+ },
7696
7854
  Island: {
7697
7855
  value: '島',
7698
7856
  },
@@ -7807,6 +7965,9 @@ const stringsJapanese = {
7807
7965
  "Payment processing. We'll update you when payment is received.": {
7808
7966
  value: '支払処理中です。入金が確認された際に更新いたします。',
7809
7967
  },
7968
+ 'Payment total': {
7969
+ value: '支払い合計',
7970
+ },
7810
7971
  'Personal Customers Clearance Code': {
7811
7972
  value: '個人顧客通関コード',
7812
7973
  },
@@ -7849,6 +8010,9 @@ const stringsJapanese = {
7849
8010
  'Prepay duties and taxes at checkout': {
7850
8011
  value: ' checkout時に関税と税金を前払い',
7851
8012
  },
8013
+ 'Privacy policy': {
8014
+ value: 'プライバシーポリシー',
8015
+ },
7852
8016
  'Proceed with order': {
7853
8017
  value: '注文を進める',
7854
8018
  },
@@ -8434,6 +8598,9 @@ const stringsKorean = {
8434
8598
  'Invalid session': {
8435
8599
  value: '유효하지 않은 세션',
8436
8600
  },
8601
+ 'Invoice:': {
8602
+ value: '송장:',
8603
+ },
8437
8604
  Island: {
8438
8605
  value: '섬',
8439
8606
  },
@@ -8548,6 +8715,9 @@ const stringsKorean = {
8548
8715
  "Payment processing. We'll update you when payment is received.": {
8549
8716
  value: '결제 처리 중. 결제가 접수되면 알려드리겠습니다.',
8550
8717
  },
8718
+ 'Payment total': {
8719
+ value: '결제 총액',
8720
+ },
8551
8721
  'Personal Customers Clearance Code': {
8552
8722
  value: '개인 고객 통관 코드',
8553
8723
  },
@@ -8590,6 +8760,9 @@ const stringsKorean = {
8590
8760
  'Prepay duties and taxes at checkout': {
8591
8761
  value: '체크아웃 시 관세와 세금 선불',
8592
8762
  },
8763
+ 'Privacy policy': {
8764
+ value: '개인정보 처리방침',
8765
+ },
8593
8766
  'Proceed with order': {
8594
8767
  value: '주문 진행',
8595
8768
  },
@@ -9175,6 +9348,9 @@ const stringsNorwegian = {
9175
9348
  'Invalid session': {
9176
9349
  value: 'Ugyldig økt',
9177
9350
  },
9351
+ 'Invoice:': {
9352
+ value: 'Faktura:',
9353
+ },
9178
9354
  Island: {
9179
9355
  value: 'Øy',
9180
9356
  },
@@ -9289,6 +9465,9 @@ const stringsNorwegian = {
9289
9465
  "Payment processing. We'll update you when payment is received.": {
9290
9466
  value: 'Bearbeider betalingen. Vi gir deg beskjed når betalingen er mottatt.',
9291
9467
  },
9468
+ 'Payment total': {
9469
+ value: 'Betaling totalt',
9470
+ },
9292
9471
  'Personal Customers Clearance Code': {
9293
9472
  value: 'Personlige Kunders Tollklareringskode',
9294
9473
  },
@@ -9331,6 +9510,9 @@ const stringsNorwegian = {
9331
9510
  'Prepay duties and taxes at checkout': {
9332
9511
  value: 'Forhåndsbetal avgifter og skatt ved kassen',
9333
9512
  },
9513
+ 'Privacy policy': {
9514
+ value: 'Personvernregler',
9515
+ },
9334
9516
  'Proceed with order': {
9335
9517
  value: 'Fortsett med bestillingen',
9336
9518
  },
@@ -9916,6 +10098,9 @@ const stringsPolish = {
9916
10098
  'Invalid session': {
9917
10099
  value: 'Nieprawidłowa sesja',
9918
10100
  },
10101
+ 'Invoice:': {
10102
+ value: 'Faktura:',
10103
+ },
9919
10104
  Island: {
9920
10105
  value: 'Wyspa',
9921
10106
  },
@@ -10030,6 +10215,9 @@ const stringsPolish = {
10030
10215
  "Payment processing. We'll update you when payment is received.": {
10031
10216
  value: 'Trwa przetwarzanie płatności. Poinformujemy gdy płatność zostanie otrzymana.',
10032
10217
  },
10218
+ 'Payment total': {
10219
+ value: 'Suma płatności',
10220
+ },
10033
10221
  'Personal Customers Clearance Code': {
10034
10222
  value: 'Kod Odprawy Celnej Klientów Indywidualnych',
10035
10223
  },
@@ -10072,6 +10260,9 @@ const stringsPolish = {
10072
10260
  'Prepay duties and taxes at checkout': {
10073
10261
  value: 'Zapłać cła i podatki z góry podczas realizacji zamówienia',
10074
10262
  },
10263
+ 'Privacy policy': {
10264
+ value: 'Polityka prywatności',
10265
+ },
10075
10266
  'Proceed with order': {
10076
10267
  value: 'Przejdź do zamówienia',
10077
10268
  },
@@ -10657,6 +10848,9 @@ const stringsPortuguese = {
10657
10848
  'Invalid session': {
10658
10849
  value: 'Sessão inválida',
10659
10850
  },
10851
+ 'Invoice:': {
10852
+ value: 'Fatura:',
10853
+ },
10660
10854
  Island: {
10661
10855
  value: 'Ilha',
10662
10856
  },
@@ -10771,6 +10965,9 @@ const stringsPortuguese = {
10771
10965
  "Payment processing. We'll update you when payment is received.": {
10772
10966
  value: 'Processando pagamento. Informaremos quando o pagamento for recebido.',
10773
10967
  },
10968
+ 'Payment total': {
10969
+ value: 'Total do pagamento',
10970
+ },
10774
10971
  'Personal Customers Clearance Code': {
10775
10972
  value: 'Código de Desembaraço de Clientes Pessoais',
10776
10973
  },
@@ -10813,6 +11010,9 @@ const stringsPortuguese = {
10813
11010
  'Prepay duties and taxes at checkout': {
10814
11011
  value: 'Pague impostos e taxas antecipadamente',
10815
11012
  },
11013
+ 'Privacy policy': {
11014
+ value: 'Política de privacidade',
11015
+ },
10816
11016
  'Proceed with order': {
10817
11017
  value: 'Prosseguir com o pedido',
10818
11018
  },
@@ -11398,6 +11598,9 @@ const stringsRussian = {
11398
11598
  'Invalid session': {
11399
11599
  value: 'Недействительная сессия',
11400
11600
  },
11601
+ 'Invoice:': {
11602
+ value: 'Счет:',
11603
+ },
11401
11604
  Island: {
11402
11605
  value: 'Остров',
11403
11606
  },
@@ -11512,6 +11715,9 @@ const stringsRussian = {
11512
11715
  "Payment processing. We'll update you when payment is received.": {
11513
11716
  value: 'Обрабатываем платеж. Сообщим вам, когда платеж будет получен.',
11514
11717
  },
11718
+ 'Payment total': {
11719
+ value: 'Общая сумма платежа',
11720
+ },
11515
11721
  'Personal Customers Clearance Code': {
11516
11722
  value: 'Код таможенной очистки для частных клиентов',
11517
11723
  },
@@ -11554,6 +11760,9 @@ const stringsRussian = {
11554
11760
  'Prepay duties and taxes at checkout': {
11555
11761
  value: 'Предоплата пошлин и налогов при оформлении заказа',
11556
11762
  },
11763
+ 'Privacy policy': {
11764
+ value: 'Политика конфиденциальности',
11765
+ },
11557
11766
  'Proceed with order': {
11558
11767
  value: 'Продолжить с заказом',
11559
11768
  },
@@ -12139,6 +12348,9 @@ const stringsSpanish = {
12139
12348
  'Invalid session': {
12140
12349
  value: 'Sesión no válida',
12141
12350
  },
12351
+ 'Invoice:': {
12352
+ value: 'Factura:',
12353
+ },
12142
12354
  Island: {
12143
12355
  value: 'Isla',
12144
12356
  },
@@ -12253,6 +12465,9 @@ const stringsSpanish = {
12253
12465
  "Payment processing. We'll update you when payment is received.": {
12254
12466
  value: 'Procesando pago. Le informaremos cuando se reciba el pago.',
12255
12467
  },
12468
+ 'Payment total': {
12469
+ value: 'Total de pago',
12470
+ },
12256
12471
  'Personal Customers Clearance Code': {
12257
12472
  value: 'Código de Despacho de Clientes Personales',
12258
12473
  },
@@ -12295,6 +12510,9 @@ const stringsSpanish = {
12295
12510
  'Prepay duties and taxes at checkout': {
12296
12511
  value: 'Pague aranceles e impuestos antes en la compra',
12297
12512
  },
12513
+ 'Privacy policy': {
12514
+ value: 'Política de privacidad',
12515
+ },
12298
12516
  'Proceed with order': {
12299
12517
  value: 'Proceder con el pedido',
12300
12518
  },
@@ -12880,6 +13098,9 @@ const stringsSwedish = {
12880
13098
  'Invalid session': {
12881
13099
  value: 'Ogiltig session',
12882
13100
  },
13101
+ 'Invoice:': {
13102
+ value: 'Faktura:',
13103
+ },
12883
13104
  Island: {
12884
13105
  value: 'Ö',
12885
13106
  },
@@ -12994,6 +13215,9 @@ const stringsSwedish = {
12994
13215
  "Payment processing. We'll update you when payment is received.": {
12995
13216
  value: 'Betalningsbehandling. Vi kommer att uppdatera dig när betalningen har mottagits.',
12996
13217
  },
13218
+ 'Payment total': {
13219
+ value: 'Betalning totalt',
13220
+ },
12997
13221
  'Personal Customers Clearance Code': {
12998
13222
  value: 'Personliga Kunders Tullkod',
12999
13223
  },
@@ -13036,6 +13260,9 @@ const stringsSwedish = {
13036
13260
  'Prepay duties and taxes at checkout': {
13037
13261
  value: 'Förbetala tull och skatter vid utcheckning',
13038
13262
  },
13263
+ 'Privacy policy': {
13264
+ value: 'Integritetspolicy',
13265
+ },
13039
13266
  'Proceed with order': {
13040
13267
  value: 'Fortsätt med beställningen',
13041
13268
  },
@@ -13621,6 +13848,9 @@ const stringsTurkish = {
13621
13848
  'Invalid session': {
13622
13849
  value: 'Geçersiz oturum',
13623
13850
  },
13851
+ 'Invoice:': {
13852
+ value: 'Fatura:',
13853
+ },
13624
13854
  Island: {
13625
13855
  value: 'Ada',
13626
13856
  },
@@ -13735,6 +13965,9 @@ const stringsTurkish = {
13735
13965
  "Payment processing. We'll update you when payment is received.": {
13736
13966
  value: 'Ödeme işleniyor. Ödeme alındığında sizi bilgilendireceğiz.',
13737
13967
  },
13968
+ 'Payment total': {
13969
+ value: 'Ödeme toplamı',
13970
+ },
13738
13971
  'Personal Customers Clearance Code': {
13739
13972
  value: 'Kişisel Müşteri Gümrük Kodları',
13740
13973
  },
@@ -13777,6 +14010,9 @@ const stringsTurkish = {
13777
14010
  'Prepay duties and taxes at checkout': {
13778
14011
  value: 'Ödemede vergi ve gümrük vergisini önceden öde',
13779
14012
  },
14013
+ 'Privacy policy': {
14014
+ value: 'Gizlilik politikası',
14015
+ },
13780
14016
  'Proceed with order': {
13781
14017
  value: 'Siparişe devam et',
13782
14018
  },
@@ -14362,6 +14598,9 @@ const stringsVietnamese = {
14362
14598
  'Invalid session': {
14363
14599
  value: 'Phiên không hợp lệ',
14364
14600
  },
14601
+ 'Invoice:': {
14602
+ value: 'Hóa đơn:',
14603
+ },
14365
14604
  Island: {
14366
14605
  value: 'Đảo',
14367
14606
  },
@@ -14476,6 +14715,9 @@ const stringsVietnamese = {
14476
14715
  "Payment processing. We'll update you when payment is received.": {
14477
14716
  value: 'Đang xử lý thanh toán. Chúng tôi sẽ thông báo khi nhận được thanh toán.',
14478
14717
  },
14718
+ 'Payment total': {
14719
+ value: 'Tổng thanh toán',
14720
+ },
14479
14721
  'Personal Customers Clearance Code': {
14480
14722
  value: 'Mã Thông Quan Khách Hàng Cá Nhân',
14481
14723
  },
@@ -14518,6 +14760,9 @@ const stringsVietnamese = {
14518
14760
  'Prepay duties and taxes at checkout': {
14519
14761
  value: 'Thanh toán trước thuế và phí khi thanh toán',
14520
14762
  },
14763
+ 'Privacy policy': {
14764
+ value: 'Chính sách bảo mật',
14765
+ },
14521
14766
  'Proceed with order': {
14522
14767
  value: 'Tiếp tục với đơn hàng',
14523
14768
  },
@@ -14911,6 +15156,819 @@ const translate = (...[key, replacement]) => {
14911
15156
  return ((_b = translationStore.translatedChunks[key]) === null || _b === void 0 ? void 0 : _b.value) || key;
14912
15157
  };
14913
15158
 
15159
+ const getCountries = async () => {
15160
+ try {
15161
+ const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/get-countries', {
15162
+ method: 'GET',
15163
+ });
15164
+ if (errors.length || !json) {
15165
+ return null;
15166
+ }
15167
+ return json;
15168
+ }
15169
+ catch (_a) {
15170
+ return null;
15171
+ }
15172
+ };
15173
+
15174
+ const getCountryLandedCost = async (countryCode) => {
15175
+ var _a;
15176
+ if (!countryCode) {
15177
+ return null;
15178
+ }
15179
+ const url = `/api/zonos-elements/country-landed-cost/${countryCode}`;
15180
+ const { errors, json } = await handleFetch.handleFetch(url);
15181
+ if (errors.length || !json) {
15182
+ handleFetch.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
15183
+ return null;
15184
+ }
15185
+ return json || null;
15186
+ };
15187
+
15188
+ const defaultUsExchangeRate = {
15189
+ exchangeRate: {
15190
+ rate: 1,
15191
+ targetFormat: {
15192
+ currencyCode: 'USD',
15193
+ decimalDelimiter: '.',
15194
+ scale: 2,
15195
+ symbol: '$',
15196
+ symbolLocation: 'before',
15197
+ thousandsDelimiter: ',',
15198
+ },
15199
+ },
15200
+ maxAge: null,
15201
+ };
15202
+ const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCurrency, }) => {
15203
+ var _a;
15204
+ // If source currency matches target currency (US -> US) and is not a guaranteed rate, return default exchange rate so we still format properly.
15205
+ if (sourceCurrency === targetCurrency && !isGuaranteed) {
15206
+ return defaultUsExchangeRate;
15207
+ }
15208
+ const searchParams = new URLSearchParams();
15209
+ searchParams.set('sourceCurrency', sourceCurrency);
15210
+ searchParams.set('targetCurrency', targetCurrency);
15211
+ searchParams.set('isGuaranteed', String(isGuaranteed));
15212
+ searchParams.set('country', country || '');
15213
+ const { errors, json } = await handleFetch.handleFetch(`/api/zonos-elements/exchange-rates?${searchParams.toString()}`);
15214
+ if (errors.length || !json) {
15215
+ handleFetch.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
15216
+ return defaultUsExchangeRate;
15217
+ }
15218
+ const { rate, targetFormat } = json.exchangeRateCreate;
15219
+ const maxAge = json.maxAge;
15220
+ if (rate) {
15221
+ sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
15222
+ const exchangeRate = { rate, targetFormat };
15223
+ return { exchangeRate, maxAge };
15224
+ }
15225
+ return defaultUsExchangeRate;
15226
+ };
15227
+
15228
+ const getInclusivePriceConfigurations = async (countryCode) => {
15229
+ var _a;
15230
+ if (!countryCode) {
15231
+ return null;
15232
+ }
15233
+ const { errors, json } = await handleFetch.handleFetch(`/api/zonos-elements/inclusive-prices/${countryCode}`);
15234
+ if (errors.length || !json) {
15235
+ handleFetch.logError(`Error fetching country inclusive price setting: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
15236
+ return null;
15237
+ }
15238
+ return json || null;
15239
+ };
15240
+
15241
+ const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
15242
+ var _a;
15243
+ const searchParams = new URLSearchParams();
15244
+ searchParams.set('countryCode', countryCode);
15245
+ searchParams.set('storeId', storeId.toString());
15246
+ if (localeTo) {
15247
+ searchParams.set('localeTo', localeTo);
15248
+ }
15249
+ const { errors, json } = await handleFetch.handleFetch(`/api/zonos-elements/locale-messages?${searchParams.toString()}`);
15250
+ if (errors.length || !json) {
15251
+ handleFetch.logError('Error fetching exchange rate', (_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message);
15252
+ return [];
15253
+ }
15254
+ return json.locale_countryCodesPage;
15255
+ };
15256
+
15257
+ const validateCountryCode = (countryCode) => {
15258
+ // Check that the country is two characters and is upper case
15259
+ if (countryCode && /^[A-Z]{2}$/.test(countryCode)) {
15260
+ return countryCode;
15261
+ }
15262
+ return null;
15263
+ };
15264
+ const getZCountryUrlParam = (urlParams) => {
15265
+ const urlSearchParams = new URLSearchParams(urlParams || window.location.search);
15266
+ const getCountryParam = (param) => {
15267
+ const country = urlSearchParams.get(param);
15268
+ // Check that the country is two characters and is upper case
15269
+ return validateCountryCode(country);
15270
+ };
15271
+ const zCountry = getCountryParam('zCountry');
15272
+ // Fallback to legacy 'country'
15273
+ const fallback = getCountryParam('country');
15274
+ // Fallback to customerCountry
15275
+ const secondFallback = getCountryParam('customerCountry');
15276
+ return zCountry || fallback || secondFallback;
15277
+ };
15278
+
15279
+ /**
15280
+ * Retrieve the zCountry from the URL or session storage.
15281
+ */
15282
+ const getOverridenZCountry = () => {
15283
+ const currentUrl = new URL(window.location.href);
15284
+ // load and use country from session storage when zCountry query param is not present
15285
+ const countryLoadedSession = window.sessionStorage.getItem('zonos--country');
15286
+ const zCountry = getZCountryUrlParam(currentUrl.searchParams) || countryLoadedSession;
15287
+ return zCountry;
15288
+ };
15289
+
15290
+ const getLocalization = async () => {
15291
+ try {
15292
+ const zCountry = getOverridenZCountry();
15293
+ const searchParams = new URLSearchParams();
15294
+ if (zCountry) {
15295
+ searchParams.set('zCountry', zCountry);
15296
+ }
15297
+ const { errors, json } = await handleFetch.handleFetch(`/api/zonos-elements/localization?${searchParams.toString()}`);
15298
+ if (errors.length || !json) {
15299
+ return { country: null, locale: null };
15300
+ }
15301
+ return {
15302
+ country: json.country,
15303
+ locale: json.locale,
15304
+ };
15305
+ }
15306
+ catch (_a) {
15307
+ return { country: null, locale: null };
15308
+ }
15309
+ };
15310
+
15311
+ const getShippingZones = async () => {
15312
+ var _a, _b, _c;
15313
+ if ((_a = window.Zonos.cartSettings) === null || _a === void 0 ? void 0 : _a.shippingZones) {
15314
+ return window.Zonos.cartSettings.shippingZones
15315
+ .flatMap(zone => zone === null || zone === void 0 ? void 0 : zone.countryCodes)
15316
+ .filter(Boolean);
15317
+ }
15318
+ const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/shipping-zones');
15319
+ if (errors.length || !json) {
15320
+ handleFetch.logError(`Error fetching shipping zones: ${(_b = errors.find(Boolean)) === null || _b === void 0 ? void 0 : _b.message}`);
15321
+ return null;
15322
+ }
15323
+ 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);
15324
+ return shippingZones || null;
15325
+ };
15326
+
15327
+ const applyInclusiveEffectiveRate = (amount) => {
15328
+ const inclusivePrice = localizationStore.inclusivePricingConfigurations.find(x => x.shipToCountry === localizationStore.selectedCountryCode);
15329
+ if (!inclusivePrice) {
15330
+ return amount;
15331
+ }
15332
+ const effectiveRate = inclusivePrice.effectiveRate;
15333
+ // Just multiply the amount by the effective rate to get the new amount for inclusive pricing
15334
+ return amount * (1 + effectiveRate);
15335
+ };
15336
+
15337
+ const currencyConvert = (value) => {
15338
+ // TODO(potentially): Bring over the code for vanity checks
15339
+ const { exchangeRate } = localizationStore;
15340
+ if (!exchangeRate || !value || isNaN(value)) {
15341
+ return value;
15342
+ }
15343
+ const minimumFractionDigits = (exchangeRate === null || exchangeRate === void 0 ? void 0 : exchangeRate.targetFormat.scale) || 2;
15344
+ const convertedValue = value * exchangeRate.rate;
15345
+ const fixedValue = convertedValue.toFixed(minimumFractionDigits);
15346
+ return Number(fixedValue);
15347
+ };
15348
+
15349
+ /**
15350
+ * This function only to format the number in
15351
+ * @returns
15352
+ */
15353
+ const numberFormat = ({ amount, currency, targetFormat, }) => {
15354
+ const targetCurrency = currency || localizationStore.targetCurrency;
15355
+ const minimumFractionDigits = (targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.scale) || 2;
15356
+ const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
15357
+ const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
15358
+ if (isIE || !numberFormatExists) {
15359
+ // use native number formatting if it's IE.
15360
+ const formattedNumber = Number(amount)
15361
+ .toFixed(minimumFractionDigits)
15362
+ .replace('.', '|dec|')
15363
+ .replace(',', (targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.thousandsDelimiter) || '')
15364
+ .replace('|dec|', (targetFormat === null || targetFormat === void 0 ? void 0 : targetFormat.decimalDelimiter) || '');
15365
+ return formattedNumber;
15366
+ }
15367
+ const formatedNumber = new Intl.NumberFormat(window.navigator.language, {
15368
+ currency: targetCurrency,
15369
+ currencyDisplay: 'code',
15370
+ minimumFractionDigits: minimumFractionDigits,
15371
+ style: 'currency',
15372
+ }).format(amount);
15373
+ return formatedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '');
15374
+ };
15375
+
15376
+ const currencyFormat = ({ amount, currency, }) => {
15377
+ if (isNaN(amount) || (amount !== 0 && !amount)) {
15378
+ return '';
15379
+ }
15380
+ const overrideCurrencyFormat = zonosStore.zonosStore.overrideCurrencyFormat;
15381
+ const { exchangeRate } = localizationStore;
15382
+ const targetCurrency = currency || localizationStore.targetCurrency;
15383
+ // Use user-defined currency format
15384
+ if (typeof overrideCurrencyFormat === 'function') {
15385
+ return overrideCurrencyFormat({
15386
+ amount: amount,
15387
+ currencyCode: targetCurrency,
15388
+ numberFormat: ({ amount: _amount }) => numberFormat({
15389
+ amount: _amount,
15390
+ currency: targetCurrency,
15391
+ targetFormat: (exchangeRate === null || exchangeRate === void 0 ? void 0 : exchangeRate.targetFormat) || null,
15392
+ }),
15393
+ });
15394
+ }
15395
+ const { targetFormat } = exchangeRate || {};
15396
+ if (!targetFormat || !exchangeRate) {
15397
+ // Return the amount as a string if no exchange rate is available
15398
+ return `${amount.toFixed(2)} ${targetCurrency}`;
15399
+ }
15400
+ const minimumFractionDigits = targetFormat.scale || 2;
15401
+ const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
15402
+ const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
15403
+ if (isIE || !numberFormatExists) {
15404
+ // use native number formatting if it's IE.
15405
+ const formattedNumber = Number(amount)
15406
+ .toFixed(minimumFractionDigits)
15407
+ .replace('.', '|dec|')
15408
+ .replace(',', targetFormat.thousandsDelimiter || '')
15409
+ .replace('|dec|', targetFormat.decimalDelimiter || '');
15410
+ const result = `${formattedNumber}${targetFormat.currencyCode !== 'USD' ? ` ${targetFormat.currencyCode}` : ''}`;
15411
+ return result;
15412
+ }
15413
+ const currencyDisplay = (overrideCurrencyFormat === null || overrideCurrencyFormat === void 0 ? void 0 : overrideCurrencyFormat.currencyDisplay) || 'symbol';
15414
+ const formattedNumber = new Intl.NumberFormat(window.navigator.language, {
15415
+ currency: targetCurrency,
15416
+ currencyDisplay,
15417
+ minimumFractionDigits: minimumFractionDigits,
15418
+ style: 'currency',
15419
+ }).format(amount);
15420
+ // Move currency code to the end of the string if currencyDisplay is 'code'
15421
+ const result = currencyDisplay === 'code'
15422
+ ? `${formattedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '')} ${targetCurrency}`
15423
+ : formattedNumber;
15424
+ return result;
15425
+ };
15426
+
15427
+ const currencyConvertAndFormat = (value) => {
15428
+ const convertedValue = currencyConvert(value);
15429
+ const formattedValue = currencyFormat({ amount: convertedValue });
15430
+ return formattedValue;
15431
+ };
15432
+
15433
+ /**
15434
+ * Check if selector user pass is valid
15435
+ * @example
15436
+ * isValidSelector('div') // true
15437
+ * isValidSelector('div + >>> span') // false
15438
+ */
15439
+ const isValidSelector = (selector) => {
15440
+ try {
15441
+ // this will error out if the selector is invalid in the DOM
15442
+ document.createDocumentFragment().querySelector(selector);
15443
+ }
15444
+ catch (_a) {
15445
+ return false;
15446
+ }
15447
+ return true;
15448
+ };
15449
+
15450
+ const getCurrencyElements = (selector) => {
15451
+ const currencySelector = selector || '.money';
15452
+ if (!isValidSelector(currencySelector)) {
15453
+ handleFetch.logError(`Currency element selector "${currencySelector}" is not valid.`);
15454
+ return null;
15455
+ }
15456
+ const currencyElements = document.querySelectorAll(currencySelector);
15457
+ if (!currencyElements.length) {
15458
+ VarianceTest.log(`No currency elements found with selector "${currencySelector}"`, 'warn');
15459
+ return null;
15460
+ }
15461
+ // return array of currency elements instead of a NodeList
15462
+ return Array.from(currencyElements);
15463
+ };
15464
+
15465
+ const getInitialElementAmount = (element) => {
15466
+ var _a;
15467
+ const domesticValue = element.getAttribute('data-domestic');
15468
+ const intlValue = element.getAttribute('data-zintl');
15469
+ // Only keep numbers, decimal, and hyphens
15470
+ const cleanedText = (_a = element.textContent) === null || _a === void 0 ? void 0 : _a.replace(/[^\d.-]/g, '');
15471
+ if (!cleanedText) {
15472
+ return null;
15473
+ }
15474
+ // If the element has no data-domestic attribute, or the text content is different from the data-zintl attribute, set the data-domestic attribute
15475
+ if (!domesticValue || (element.textContent !== intlValue && intlValue)) {
15476
+ // Store the original value on the element once, and international on every new conversion
15477
+ element.setAttribute('data-domestic', cleanedText);
15478
+ return parseFloat(cleanedText);
15479
+ }
15480
+ return parseFloat(domesticValue);
15481
+ };
15482
+
15483
+ const BLUR_CURRENCY_DURATION = 7000;
15484
+ const BLUR_CURRENCY_CLASSNAME = 'z--blur';
15485
+ const removeBlurCurrency = async () => {
15486
+ const intervalId = window.zonosBlurCurrencyOnInitIntervalId;
15487
+ if (!intervalId) {
15488
+ // Do nothing if the interval is not set
15489
+ return;
15490
+ }
15491
+ // Wait a bit to make sure price is fully rendered in DOM
15492
+ await new Promise(resolve => setTimeout(resolve, 500));
15493
+ clearInterval(intervalId);
15494
+ const currencyElements = document.querySelectorAll(`.${BLUR_CURRENCY_CLASSNAME}`);
15495
+ currencyElements.forEach(element => {
15496
+ element.classList.remove(BLUR_CURRENCY_CLASSNAME);
15497
+ });
15498
+ window.zonosBlurCurrencyOnInitIntervalId = undefined;
15499
+ };
15500
+ /**
15501
+ * This function is used to remove the blur effect from a specific element. (combined with performBlurSpecificElement)
15502
+ * @returns void
15503
+ */
15504
+ const removeBlurSpecificElement = async ({ specificSelector, timeoutId, }) => {
15505
+ // Wait a bit to make sure price is fully rendered in DOM
15506
+ await new Promise(resolve => setTimeout(resolve, 500));
15507
+ if (timeoutId) {
15508
+ clearTimeout(timeoutId);
15509
+ }
15510
+ specificSelector.classList.remove(BLUR_CURRENCY_CLASSNAME);
15511
+ };
15512
+ const blurCurrencyElements = ({ currencySelector, specificSelector, }) => {
15513
+ // Do nothing if the currency selector is not provided or blurCurrencyOnInit is false
15514
+ if (!currencySelector && !specificSelector) {
15515
+ return;
15516
+ }
15517
+ if (specificSelector) {
15518
+ specificSelector.classList.add(BLUR_CURRENCY_CLASSNAME);
15519
+ }
15520
+ else {
15521
+ const currencyElements = document.querySelectorAll([currencySelector].filter(Boolean).join(','));
15522
+ currencyElements.forEach(element => {
15523
+ element.classList.add(BLUR_CURRENCY_CLASSNAME);
15524
+ });
15525
+ }
15526
+ };
15527
+ const performBlurSpecificElement = (specificSelector) => {
15528
+ if (typeof window === 'undefined') {
15529
+ return;
15530
+ }
15531
+ blurCurrencyElements({
15532
+ specificSelector,
15533
+ });
15534
+ // 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
15535
+ const timeoutId = setTimeout(() => {
15536
+ void removeBlurSpecificElement({
15537
+ specificSelector,
15538
+ timeoutId,
15539
+ });
15540
+ }, BLUR_CURRENCY_DURATION);
15541
+ return timeoutId;
15542
+ };
15543
+ const performBlurCurrency = () => {
15544
+ if (typeof window === 'undefined') {
15545
+ return;
15546
+ }
15547
+ // If the interval is already in progress, do nothing
15548
+ if (window.zonosBlurCurrencyOnInitIntervalId) {
15549
+ return;
15550
+ }
15551
+ blurCurrencyElements({
15552
+ currencySelector: window.zonosBlurCurrencyOnInitCurrencySelector,
15553
+ });
15554
+ // Add blur effect to the currency elements
15555
+ const intervalId = setInterval(() => {
15556
+ blurCurrencyElements({
15557
+ currencySelector: window.zonosBlurCurrencyOnInitCurrencySelector,
15558
+ });
15559
+ }, 10);
15560
+ window.zonosBlurCurrencyOnInitIntervalId = intervalId;
15561
+ // 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
15562
+ setTimeout(() => {
15563
+ void removeBlurCurrency();
15564
+ }, BLUR_CURRENCY_DURATION);
15565
+ };
15566
+
15567
+ const convertCurrency = (element) => {
15568
+ var _a;
15569
+ const amount = getInitialElementAmount(element);
15570
+ if (!amount || isNaN(amount)) {
15571
+ return;
15572
+ }
15573
+ const currentIntlValue = element.getAttribute('data-zintl');
15574
+ // get rate
15575
+ const currentIntlRateValue = parseFloat(element.getAttribute('data-zrate') || '1');
15576
+ const currentCountryValue = element.getAttribute('data-zcountry-code');
15577
+ // do nothing if the target currency is the same
15578
+ const isExchangeRateReady = localizationStore.exchangeRate &&
15579
+ localizationStore.targetCurrency ===
15580
+ localizationStore.exchangeRate.targetFormat.currencyCode;
15581
+ const rate = ((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
15582
+ // if the current value on the element is different from the current intl value, update the data-zintl attribute
15583
+ if (isExchangeRateReady &&
15584
+ // Update currency if the value is not yet formatted
15585
+ (element.textContent !== currentIntlValue ||
15586
+ // Update rate when new rate is available
15587
+ rate !== currentIntlRateValue ||
15588
+ // Update currency when the country code changes
15589
+ currentCountryValue !== localizationStore.selectedCountryCode)) {
15590
+ // Hide the currency until DOM is ready to display the new value
15591
+ const timeoutId = performBlurSpecificElement(element);
15592
+ const appliedInclusivePrice = applyInclusiveEffectiveRate(amount);
15593
+ const customizedCurrencyFormat = typeof zonosStore.zonosStore.currencyConverter === 'function' &&
15594
+ zonosStore.zonosStore.currencyConverter({
15595
+ convert: currencyConvert,
15596
+ convertAndFormat: currencyConvertAndFormat,
15597
+ currencyCode: localizationStore.targetCurrency,
15598
+ format: (value) => currencyFormat({ amount: value }),
15599
+ originalAmount: appliedInclusivePrice,
15600
+ selector: element,
15601
+ });
15602
+ // 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.
15603
+ const observedFormattedValue = customizedCurrencyFormat ||
15604
+ currencyConvertAndFormat(appliedInclusivePrice);
15605
+ if (observedFormattedValue !== element.textContent) {
15606
+ // Only set textContent if the value has changed, this is to prevent it redrawing the element if the value is the same
15607
+ element.textContent = observedFormattedValue;
15608
+ }
15609
+ // save the new rate to the data-zrate attribute
15610
+ element.setAttribute('data-zrate', rate.toString());
15611
+ // save the new value to the data-zintl attribute
15612
+ element.setAttribute('data-zintl', observedFormattedValue);
15613
+ element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
15614
+ void removeBlurSpecificElement({
15615
+ specificSelector: element,
15616
+ timeoutId,
15617
+ });
15618
+ }
15619
+ };
15620
+ const defaultCurrencyConverter = () => {
15621
+ const { currencyElementSelector } = zonosStore.zonosStore.helloSettings;
15622
+ const currencyElements = getCurrencyElements(currencyElementSelector);
15623
+ // do nothing if none of the currency elements are found
15624
+ if (!(currencyElements === null || currencyElements === void 0 ? void 0 : currencyElements.length)) {
15625
+ return;
15626
+ }
15627
+ if (!localizationStore.exchangeRate) {
15628
+ handleFetch.logError('Could not display currency. Exchange rate and format data is not available.');
15629
+ return;
15630
+ }
15631
+ currencyElements.forEach(element => {
15632
+ // convert the currency and save the formatted value to the data-zintl attribute
15633
+ convertCurrency(element);
15634
+ });
15635
+ };
15636
+
15637
+ const currencyDisplay = () => {
15638
+ if (zonosStore.zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
15639
+ window.Zonos.isLegacyCheckout) {
15640
+ void removeBlurCurrency();
15641
+ return;
15642
+ }
15643
+ defaultCurrencyConverter();
15644
+ };
15645
+
15646
+ const getCurrencyCode = (code) => {
15647
+ var _a;
15648
+ const countryInShippingZone = (_a = localizationStore.shippingZoneCountries) === null || _a === void 0 ? void 0 : _a[code];
15649
+ if (countryInShippingZone) {
15650
+ return countryInShippingZone.currencyCode;
15651
+ }
15652
+ return null;
15653
+ };
15654
+
15655
+ const setZCountryUrlParam = (selectedCountryCode) => {
15656
+ if (!selectedCountryCode) {
15657
+ return;
15658
+ }
15659
+ const urlSearchParams = new URLSearchParams(window.location.search);
15660
+ // Only append zCountry if it's already in the URL or the countryOverrideBehavior is URL_PARAM
15661
+ const shouldAppendParam = urlSearchParams.has('zCountry') ||
15662
+ zonosStore.zonosStore.helloSettings.countryOverrideBehavior === 'URL_PARAM';
15663
+ if (shouldAppendParam) {
15664
+ // Only append zCountry if it's not already in the URL
15665
+ urlSearchParams.set('zCountry', selectedCountryCode);
15666
+ const newUrl = `${window.location.pathname}?${urlSearchParams.toString()}`;
15667
+ /**
15668
+ * Setting the state to null in window.history.replaceState can cause issues with rendering when using next/link and pressing the back button.
15669
+ * @ref https://github.com/vercel/next.js/issues/33233#issuecomment-1052349396
15670
+ **/
15671
+ window.history.replaceState(window.history.state, document.title, newUrl);
15672
+ }
15673
+ };
15674
+
15675
+ const { dispose: localizationDispose, onChange: localizationStoreOnChange, state: localizationStore, } = zonosStore.createStore({
15676
+ countryLandedCost: null,
15677
+ customMessages: [],
15678
+ exchangeRate: null,
15679
+ helloCountryList: null,
15680
+ inclusivePricingConfigurations: [],
15681
+ inclusivePricingIsFetching: false,
15682
+ isDisabledCountry: true,
15683
+ isShippableCountry: false,
15684
+ localizationLoaded: false,
15685
+ selectedCountryCode: null,
15686
+ selectedLocale: 'en',
15687
+ shippingZoneCountries: null,
15688
+ targetCurrency: 'USD',
15689
+ });
15690
+ const triggerGetExchangeRate = async (isGuaranteed) => {
15691
+ const { exchangeRate, maxAge } = await getExchangeRate({
15692
+ country: localizationStore.selectedCountryCode,
15693
+ isGuaranteed,
15694
+ sourceCurrency: zonosStore.zonosStore.sourceCurrency,
15695
+ targetCurrency: localizationStore.targetCurrency,
15696
+ });
15697
+ if (exchangeRate) {
15698
+ localizationStore.exchangeRate = exchangeRate;
15699
+ currencyDisplay();
15700
+ }
15701
+ return { maxAge };
15702
+ };
15703
+ /**
15704
+ * CHORE: This is mostly for legacy checkout as the country param is not guaranteed.
15705
+ */
15706
+ const DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT = 'CA';
15707
+ const getFallbackDefaultCountryCode = (allowedCountries) => {
15708
+ if (localizationStore.selectedCountryCode &&
15709
+ allowedCountries.includes(localizationStore.selectedCountryCode)) {
15710
+ return localizationStore.selectedCountryCode;
15711
+ }
15712
+ // Don't check if it is allowed. If it is not allowed it will fallback to Albania (first option).
15713
+ return DEFAULT_COUNTRY_CODE_LEGACY_CHECKOUT;
15714
+ };
15715
+ const refreshInclusivePricingConfigurations = async (countryCode) => {
15716
+ if (!countryCode) {
15717
+ return;
15718
+ }
15719
+ // These requests are only needed for Hello, so we can skip them for legacy checkout
15720
+ localizationStore.inclusivePricingIsFetching = true;
15721
+ const inclusivePricingConfigurations = await getInclusivePriceConfigurations(countryCode);
15722
+ localizationStore.inclusivePricingConfigurations =
15723
+ inclusivePricingConfigurations || [];
15724
+ localizationStore.inclusivePricingIsFetching = false;
15725
+ };
15726
+ // This recursive function is for users who step away from their computer and come back needing a new exchange rate
15727
+ const startExchangeRateTimeout = ({ isGuaranteed, maxAge, }) => {
15728
+ if (localizationStore.exchangeRateTimeout) {
15729
+ clearTimeout(localizationStore.exchangeRateTimeout);
15730
+ }
15731
+ // maxAge comes in seconds, convert to milliseconds
15732
+ const defaultMaxAge = 5 * 60;
15733
+ const maxAgeToUse = maxAge || defaultMaxAge;
15734
+ // Recursively set timeouts to get new exchange rates when the current one expires
15735
+ localizationStore.exchangeRateTimeout = setTimeout(async () => {
15736
+ // Refresh inclusive pricing configurations before getting a new exchange rate, so hello can use the new effective rate
15737
+ await refreshInclusivePricingConfigurations(localizationStore.selectedCountryCode);
15738
+ const { maxAge: newMaxAge } = await triggerGetExchangeRate(isGuaranteed);
15739
+ startExchangeRateTimeout({ isGuaranteed, maxAge: newMaxAge });
15740
+ }, maxAgeToUse * 1000);
15741
+ };
15742
+ const getNewLocalization = async ({ isInitializing, }) => {
15743
+ var _a, _b;
15744
+ VarianceTest.log('get new localization store');
15745
+ const { isDisabledCountry, isShippableCountry, selectedCountryCode } = localizationStore;
15746
+ if (zonosStore.zonosStore.helloSettings.currencyBehavior === 'DISABLED' ||
15747
+ !isShippableCountry ||
15748
+ isDisabledCountry ||
15749
+ !selectedCountryCode) {
15750
+ return;
15751
+ }
15752
+ const isGuaranteed = zonosStore.zonosStore.checkoutSettings.visibilityStatus === 'ENABLED';
15753
+ // blur currency out before getting exchange rate
15754
+ performBlurCurrency();
15755
+ const { maxAge } = await triggerGetExchangeRate(isGuaranteed);
15756
+ startExchangeRateTimeout({ isGuaranteed, maxAge });
15757
+ if (isInitializing &&
15758
+ ((_a = window.Zonos.cartSettings) === null || _a === void 0 ? void 0 : _a.inclusivePriceConfigurations)) {
15759
+ localizationStore.inclusivePricingConfigurations =
15760
+ ((_b = window.Zonos.cartSettings) === null || _b === void 0 ? void 0 : _b.inclusivePriceConfigurations) || [];
15761
+ void removeBlurCurrency();
15762
+ }
15763
+ // These requests are only needed for Hello, so we can skip them for legacy checkout
15764
+ if (!window.Zonos.isLegacyCheckout) {
15765
+ localizationStore.inclusivePricingIsFetching = true;
15766
+ const [countryLandedCost] = await Promise.all([
15767
+ getCountryLandedCost(localizationStore.selectedCountryCode),
15768
+ refreshInclusivePricingConfigurations(localizationStore.selectedCountryCode),
15769
+ ]);
15770
+ localizationStore.countryLandedCost = countryLandedCost;
15771
+ // Remove blur effect after the currency is converted
15772
+ void removeBlurCurrency();
15773
+ }
15774
+ else {
15775
+ VarianceTest.log('Skipping country landed cost and inclusive pricing requests, because this is a legacy checkout');
15776
+ }
15777
+ };
15778
+ const getCustomMessages = async () => {
15779
+ VarianceTest.log(`Getting custom messages for ${localizationStore.selectedCountryCode}`);
15780
+ if (!localizationStore.selectedCountryCode || !zonosStore.zonosStore.storeId) {
15781
+ return;
15782
+ }
15783
+ const localeMessages = await getLocaleMessages({
15784
+ countryCode: localizationStore.selectedCountryCode,
15785
+ localeTo: localizationStore.selectedLocale,
15786
+ storeId: zonosStore.zonosStore.storeId,
15787
+ });
15788
+ const allMessages = localeMessages.flatMap(x => {
15789
+ var _a;
15790
+ return {
15791
+ countryCode: localizationStore.selectedCountryCode,
15792
+ message: (_a = x.countryCodesPageMessageLinks.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message.textTo,
15793
+ pageName: x.pageName,
15794
+ };
15795
+ });
15796
+ localizationStore.customMessages = allMessages;
15797
+ };
15798
+ const getOverrideLocale = () => {
15799
+ const currentUrl = new URL(window.location.href);
15800
+ const zonosLocale = currentUrl.searchParams.get('zonosLocale');
15801
+ return zonosLocale;
15802
+ };
15803
+ const addInternationalHideClass = () => {
15804
+ if (localizationStore.isShippableCountry) {
15805
+ document.body.classList.add('z-intl');
15806
+ }
15807
+ else {
15808
+ document.body.classList.remove('z-intl');
15809
+ }
15810
+ };
15811
+ const getValidCountryCode = (countryCode) => {
15812
+ if (countryCode === 'UK') {
15813
+ return 'GB';
15814
+ }
15815
+ return countryCode;
15816
+ };
15817
+ const localizationStoreUpdateSelectedCountryCode = ({ isInitializing, newSelectedCountryCode, }) => {
15818
+ var _a, _b;
15819
+ VarianceTest.log(`Updating selected country code to ${newSelectedCountryCode}`);
15820
+ const isFirstTime = !localizationStore.selectedCountryCode;
15821
+ localizationStore.selectedCountryCode = getValidCountryCode(newSelectedCountryCode);
15822
+ const { selectedCountryCode, shippingZoneCountries } = localizationStore;
15823
+ const isShippableCountry = !!shippingZoneCountries &&
15824
+ !!selectedCountryCode &&
15825
+ !!shippingZoneCountries[selectedCountryCode] &&
15826
+ // Make sure the country is not in the disabled countries list
15827
+ !zonosStore.zonosStore.disabledCountries.includes(selectedCountryCode);
15828
+ // update shippable country
15829
+ localizationStore.isShippableCountry = isShippableCountry;
15830
+ VarianceTest.log(`${localizationStore.selectedCountryCode} is a shippable country: ${localizationStore.isShippableCountry}`);
15831
+ const isDisabledCountry = !!selectedCountryCode &&
15832
+ zonosStore.zonosStore.disabledCountries.includes(selectedCountryCode);
15833
+ localizationStore.isDisabledCountry = isDisabledCountry;
15834
+ VarianceTest.log(`${localizationStore.selectedCountryCode} is a disabled country: ${localizationStore.isDisabledCountry}`);
15835
+ addInternationalHideClass();
15836
+ if (!selectedCountryCode) {
15837
+ return;
15838
+ }
15839
+ const currencyCode = getCurrencyCode(selectedCountryCode);
15840
+ // Only trigger callback onCountryChange if the country code has been set before
15841
+ if (!isFirstTime) {
15842
+ // Trigger callback onCountryChange
15843
+ (_a = zonosStore.zonosStore.onCountryChange) === null || _a === void 0 ? void 0 : _a.call(zonosStore.zonosStore, {
15844
+ countryCode: selectedCountryCode,
15845
+ currencyCode,
15846
+ isShippableCountry: isShippableCountry,
15847
+ });
15848
+ }
15849
+ if (!currencyCode) {
15850
+ return;
15851
+ }
15852
+ localizationStore.targetCurrency = currencyCode;
15853
+ void getNewLocalization({ isInitializing: isInitializing });
15854
+ // Save the country code to session storage for later use
15855
+ window.sessionStorage.setItem('zonos--country', selectedCountryCode);
15856
+ // Update the URL query param with the new country code
15857
+ setZCountryUrlParam(selectedCountryCode);
15858
+ (_b = document
15859
+ .querySelector('zonos-hello')) === null || _b === void 0 ? void 0 : _b.setAttribute('z-country', selectedCountryCode);
15860
+ };
15861
+ const initHelloCountryList = (allCountries) => {
15862
+ const showCountryList = zonosStore.zonosStore.helloSettings.showCountryList;
15863
+ const hellCountryList = localizationStore.shippingZoneCountries;
15864
+ if (!showCountryList || showCountryList === 'ONLY_SHIPPABLE') {
15865
+ // just use the shipping zone countries
15866
+ localizationStore.helloCountryList = hellCountryList;
15867
+ return;
15868
+ }
15869
+ if (showCountryList === 'ALL') {
15870
+ localizationStore.helloCountryList = allCountries;
15871
+ return;
15872
+ }
15873
+ // get all active countries in the showCountryList
15874
+ localizationStore.helloCountryList = showCountryList.reduce((acc, countryCode) => {
15875
+ const countryInfo = allCountries === null || allCountries === void 0 ? void 0 : allCountries[countryCode];
15876
+ return countryInfo
15877
+ ? Object.assign(Object.assign({}, acc), { [countryCode]: countryInfo }) : acc;
15878
+ }, {});
15879
+ };
15880
+ const updateCheckoutSessionLanguage = async () => {
15881
+ if (!storageStore.checkoutSessionId) {
15882
+ return null;
15883
+ }
15884
+ const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/update-checkout-session-metadata', {
15885
+ body: {
15886
+ id: storageStore.checkoutSessionId,
15887
+ metadata: [
15888
+ // This is being used from the backend to determine the language of the checkout session
15889
+ {
15890
+ key: 'language',
15891
+ value: localizationStore.selectedLocale,
15892
+ },
15893
+ ],
15894
+ },
15895
+ method: 'POST',
15896
+ });
15897
+ if (errors.length || !json) {
15898
+ handleFetch.logError('Error occurs when updating checkout session', JSON.stringify(errors, null, 2));
15899
+ return { errors, json };
15900
+ }
15901
+ return { errors: [], json };
15902
+ };
15903
+ const localizationStoreUpdateSelectedLocale = (newSelectedLocale) => {
15904
+ localizationStore.selectedLocale = newSelectedLocale;
15905
+ translationStoreUpdateLanguage(newSelectedLocale);
15906
+ void updateCheckoutSessionLanguage();
15907
+ void getCustomMessages();
15908
+ };
15909
+ const initLocalizationStore = async () => {
15910
+ var _a;
15911
+ // all countries from countries.json, shipping zone and localization
15912
+ const [allCountries, shippingZoneCountries, localization] = await Promise.all([getCountries(), getShippingZones(), getLocalization()]);
15913
+ // Filter countries to only include countries in the shipping zone
15914
+ const filteredCountries = shippingZoneCountries === null || shippingZoneCountries === void 0 ? void 0 : shippingZoneCountries.reduce((acc, countryCode) => {
15915
+ const countryInfo = allCountries === null || allCountries === void 0 ? void 0 : allCountries[countryCode];
15916
+ return countryInfo
15917
+ ? Object.assign(Object.assign({}, acc), { [countryCode]: countryInfo }) : acc;
15918
+ }, {});
15919
+ localizationStore.shippingZoneCountries = filteredCountries || null;
15920
+ localizationStore.inclusivePricingConfigurations =
15921
+ ((_a = window.Zonos.cartSettings) === null || _a === void 0 ? void 0 : _a.inclusivePriceConfigurations) || [];
15922
+ // Initialize the country list for the hello widget
15923
+ initHelloCountryList(allCountries || {});
15924
+ const { country, locale } = localization;
15925
+ VarianceTest.log(`Country code from localization: ${country}`);
15926
+ VarianceTest.log(`Locale from localization: ${locale}`);
15927
+ // update selected country code in store
15928
+ localizationStoreUpdateSelectedCountryCode({
15929
+ isInitializing: true,
15930
+ newSelectedCountryCode: country || null,
15931
+ });
15932
+ // use locale from params if it exists, otherwise use locale from localization
15933
+ const overrideLocale = getOverrideLocale();
15934
+ localizationStoreUpdateSelectedLocale(overrideLocale || locale || 'en');
15935
+ const devSites = [
15936
+ 'dev.storybook.elements',
15937
+ 'dev.elements',
15938
+ 'dev.demo.elements',
15939
+ 'dev.dashboard',
15940
+ ];
15941
+ // If the country code is not set, set it to the US for development (vercel can't get geo country in dev)
15942
+ if (!localizationStore.selectedCountryCode &&
15943
+ devSites.some(site => window.location.origin.includes(site))) {
15944
+ // update selected country code in store
15945
+ localizationStoreUpdateSelectedCountryCode({
15946
+ isInitializing: true,
15947
+ newSelectedCountryCode: 'CA',
15948
+ });
15949
+ }
15950
+ localizationStore.localizationLoaded = true;
15951
+ };
15952
+
15953
+ exports.VARIANT_TEST_KEY_EXPIRATION = VARIANT_TEST_KEY_EXPIRATION;
15954
+ exports.applyInclusiveEffectiveRate = applyInclusiveEffectiveRate;
15955
+ exports.currencyConvert = currencyConvert;
15956
+ exports.currencyConvertAndFormat = currencyConvertAndFormat;
15957
+ exports.currencyDisplay = currencyDisplay;
15958
+ exports.currencyFormat = currencyFormat;
15959
+ exports.filterValidTests = filterValidTests;
15960
+ exports.getFallbackDefaultCountryCode = getFallbackDefaultCountryCode;
15961
+ exports.getOverridenZCountry = getOverridenZCountry;
15962
+ exports.getZCountryUrlParam = getZCountryUrlParam;
15963
+ exports.initLocalizationStore = initLocalizationStore;
15964
+ exports.isValidSelector = isValidSelector;
15965
+ exports.localizationStore = localizationStore;
15966
+ exports.localizationStoreOnChange = localizationStoreOnChange;
15967
+ exports.localizationStoreUpdateSelectedCountryCode = localizationStoreUpdateSelectedCountryCode;
15968
+ exports.localizationStoreUpdateSelectedLocale = localizationStoreUpdateSelectedLocale;
15969
+ exports.setZCountryUrlParam = setZCountryUrlParam;
15970
+ exports.storageStore = storageStore;
15971
+ exports.storageStoreOnChange = storageStoreOnChange;
15972
+ exports.storageStoreSetEnabledVariantTestKeys = storageStoreSetEnabledVariantTestKeys;
14914
15973
  exports.translate = translate;
14915
15974
  exports.translationStoreOnChange = translationStoreOnChange;
14916
- exports.translationStoreUpdateLanguage = translationStoreUpdateLanguage;