@zonos/elements 1.5.0 → 1.5.2

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 (428) hide show
  1. package/dist/cjs/{TaxId-Q6aDqqWv.js → TaxId-ChhNwG04.js} +36 -0
  2. package/dist/cjs/{cart-B6Aty-21.js → cart-BJpqPdFU.js} +100 -64
  3. package/dist/cjs/{collect-DnrvaXUI.js → collect-CyUttsvB.js} +4 -4
  4. package/dist/cjs/{debounce-Cd2emZPn.js → debounce-BhgA8_3W.js} +2 -2
  5. package/dist/cjs/{debounce-vY0QYT6o.js → debounce-DRPMxNew.js} +1 -1
  6. package/dist/cjs/{getBorderRadius-CyYZw4qq.js → getBorderRadius-CJ_95w3o.js} +1 -1
  7. package/dist/cjs/{getMissingRequiredShippingFields-D03ICqss.js → getMissingRequiredShippingFields-DEbNbRAZ.js} +1 -1
  8. package/dist/cjs/{handleFetch-DQLhurnE.js → handleFetch-DVfjFTYO.js} +181 -71
  9. package/dist/cjs/{hasInclusivePrice-CPCoVeU3.js → hasInclusivePrice-CEPf3_FG.js} +1 -1
  10. package/dist/cjs/index.cjs.js +116 -13
  11. package/dist/cjs/{invoice-Cj8W7NW0.js → invoice-DzRkkpLu.js} +4 -4
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/{localization-BzNeXeDe.js → localization-BhNVhLZs.js} +725 -89
  14. package/dist/cjs/{paypal-CuKshRmZ.js → paypal-DCSqbdjW.js} +5 -5
  15. package/dist/cjs/{placeTestOrder-7czjwkjm.js → placeTestOrder-Bkip4PUT.js} +3 -3
  16. package/dist/cjs/{renderCheckoutCurrency-BH8t2b2x.js → renderCheckoutCurrency-BDvEZ3Hv.js} +2 -2
  17. package/dist/cjs/shouldRenderShortAddressCodeInput-gpu_bMfp.js +21 -0
  18. package/dist/cjs/{shouldShowLanguageSelect-yAbtCmd8.js → shouldShowLanguageSelect-NOVWOU53.js} +1 -1
  19. package/dist/cjs/{submitGtag-D79e8u6s.js → submitGtag-D4sB7w4z.js} +2 -2
  20. package/dist/cjs/{throttle-zSVRQLC0.js → taxIdFields-e4OCgr8K.js} +57 -2
  21. package/dist/cjs/taxIdRules-BBj8kQxJ.js +58 -0
  22. package/dist/cjs/{updateCheckoutSessionAttributes-jMtfOL2m.js → updateCheckoutSessionAttributes-KxwcsKhM.js} +2 -2
  23. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +26 -31
  24. package/dist/cjs/zonos-address-display_2.cjs.entry.js +4 -4
  25. package/dist/cjs/zonos-address_4.cjs.entry.js +28 -31
  26. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +8 -7
  27. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  28. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  29. package/dist/cjs/zonos-button_3.cjs.entry.js +2 -2
  30. package/dist/cjs/zonos-card_5.cjs.entry.js +9 -8
  31. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +91 -86
  32. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +2 -2
  33. package/dist/cjs/zonos-checkout.cjs.entry.js +15 -14
  34. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  35. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +7 -6
  36. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +13 -12
  37. package/dist/cjs/zonos-collect.cjs.entry.js +10 -9
  38. package/dist/cjs/zonos-controller.cjs.entry.js +10 -9
  39. package/dist/cjs/zonos-country-flag.cjs.entry.js +3 -3
  40. package/dist/cjs/zonos-country-select_4.cjs.entry.js +4 -4
  41. package/dist/cjs/zonos-elements.cjs.js +1 -1
  42. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  43. package/dist/cjs/zonos-hello.cjs.entry.js +5 -5
  44. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  45. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +9 -8
  46. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +13 -12
  47. package/dist/cjs/zonos-invoice.cjs.entry.js +10 -9
  48. package/dist/cjs/zonos-language-select_2.cjs.entry.js +3 -3
  49. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  50. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +8 -7
  51. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  52. package/dist/cjs/zonos-stripe-input.cjs.entry.js +2 -2
  53. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  54. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  55. package/dist/cjs/{zonosStore-Bx9jK82G.js → zonosStore-CDV83QyK.js} +2 -0
  56. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +8 -7
  57. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -3
  58. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +12 -4
  59. package/dist/collection/components/main/zonos-controller.js +3 -2
  60. package/dist/collection/components/store/checkout/cart.js +3 -2
  61. package/dist/collection/components/store/checkout/stripe.js +20 -21
  62. package/dist/collection/components/store/storageStore.js +7 -6
  63. package/dist/collection/components/store/translationStore/strings.arabic.js +35 -2
  64. package/dist/collection/components/store/translationStore/strings.base.js +35 -2
  65. package/dist/collection/components/store/translationStore/strings.chinese.js +35 -2
  66. package/dist/collection/components/store/translationStore/strings.danish.js +35 -2
  67. package/dist/collection/components/store/translationStore/strings.dutch.js +35 -2
  68. package/dist/collection/components/store/translationStore/strings.french.js +35 -2
  69. package/dist/collection/components/store/translationStore/strings.german.js +35 -2
  70. package/dist/collection/components/store/translationStore/strings.hebrew.js +35 -2
  71. package/dist/collection/components/store/translationStore/strings.indonesian.js +35 -2
  72. package/dist/collection/components/store/translationStore/strings.italian.js +35 -2
  73. package/dist/collection/components/store/translationStore/strings.japanese.js +35 -2
  74. package/dist/collection/components/store/translationStore/strings.korean.js +35 -2
  75. package/dist/collection/components/store/translationStore/strings.norwegian.js +35 -2
  76. package/dist/collection/components/store/translationStore/strings.polish.js +35 -2
  77. package/dist/collection/components/store/translationStore/strings.portuguese.js +35 -2
  78. package/dist/collection/components/store/translationStore/strings.russian.js +35 -2
  79. package/dist/collection/components/store/translationStore/strings.spanish.js +35 -2
  80. package/dist/collection/components/store/translationStore/strings.swedish.js +35 -2
  81. package/dist/collection/components/store/translationStore/strings.turkish.js +35 -2
  82. package/dist/collection/components/store/translationStore/strings.vietnamese.js +35 -2
  83. package/dist/collection/components/store/zonosStore.js +2 -1
  84. package/dist/collection/components/stripe/zonos-address/zonos-address.css +5 -0
  85. package/dist/collection/components/stripe/zonos-address/zonos-address.js +37 -22
  86. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +5 -0
  87. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +34 -21
  88. package/dist/collection/components/utils/__tests__/helpers/blockStorage.js +24 -0
  89. package/dist/collection/components/utils/api/getExchangeRate.js +2 -1
  90. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +24 -35
  91. package/dist/collection/components/utils/checkout/getCheckoutTaxIdPayload.js +16 -0
  92. package/dist/collection/components/utils/checkout/getTaxIdFieldState.js +26 -0
  93. package/dist/collection/components/utils/checkout/resolveTaxIdSelection.js +23 -0
  94. package/dist/collection/components/utils/checkout/shouldRenderTaxIdInput.js +7 -11
  95. package/dist/collection/components/utils/checkout/taxIdFields.js +29 -0
  96. package/dist/collection/components/utils/handleFetch.js +19 -9
  97. package/dist/collection/components/utils/hello/countryOverrideStorage.js +17 -40
  98. package/dist/collection/components/utils/logging/installConstructorCapture.js +58 -0
  99. package/dist/collection/components/utils/logging/reportBlockedStorage.js +34 -0
  100. package/dist/collection/components/utils/logging/sendErrorLog.js +8 -1
  101. package/dist/collection/components/utils/logging/startZonosInit.js +35 -0
  102. package/dist/collection/components/utils/logging/thrownMessage.js +16 -0
  103. package/dist/collection/components/utils/safeStorage.js +39 -0
  104. package/dist/collection/components/utils/taxId/taxIdRules.js +44 -0
  105. package/dist/collection/components/utils/taxIdValidationResult.js +57 -58
  106. package/dist/collection/index.js +1 -0
  107. package/dist/collection/scripts/_getZonosQaUrl.js +3 -2
  108. package/dist/collection/scripts/_zonosBase.js +6 -2
  109. package/dist/collection/types/checkout/TaxId.js +31 -0
  110. package/dist/collection/types/generated/graphql.frontend.types.js +0 -16
  111. package/dist/collection/types/generated/graphql.internal.types.js +215 -1
  112. package/dist/esm/{TaxId-Cye-evFK.js → TaxId-DMIgN_sT.js} +32 -1
  113. package/dist/esm/{cart-BoQp8Ema.js → cart-BS5mSI8x.js} +100 -65
  114. package/dist/esm/{collect-Eo4gtyql.js → collect-B9ZxDDl7.js} +4 -4
  115. package/dist/esm/{debounce-BR3PaG8X.js → debounce-DHj2iHA1.js} +1 -1
  116. package/dist/esm/{debounce-CrmpwbEE.js → debounce-DWqMT4lo.js} +2 -2
  117. package/dist/esm/{getBorderRadius-DYfkeXdx.js → getBorderRadius-BiGd45jw.js} +1 -1
  118. package/dist/esm/{getMissingRequiredShippingFields-Ks6_tpjn.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
  119. package/dist/esm/{handleFetch-D5GYDF-O.js → handleFetch-BFVO7oAR.js} +178 -72
  120. package/dist/esm/{hasInclusivePrice-CbEfIhI5.js → hasInclusivePrice-zSvDReDb.js} +1 -1
  121. package/dist/esm/index.js +106 -13
  122. package/dist/esm/{invoice-S1KahJ_Z.js → invoice-6iTuS6ek.js} +4 -4
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/esm/{localization-BIh-4pc_.js → localization-CXHiWcJp.js} +725 -89
  125. package/dist/esm/{paypal-DNfvnuUU.js → paypal-BE_NVBoy.js} +5 -5
  126. package/dist/esm/{placeTestOrder-CQaMKFOg.js → placeTestOrder-BXA9K9Iy.js} +3 -3
  127. package/dist/esm/{renderCheckoutCurrency-C2Tw73uR.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
  128. package/dist/esm/shouldRenderShortAddressCodeInput-Bc8k2vN0.js +19 -0
  129. package/dist/esm/{shouldShowLanguageSelect-CCD7gpSY.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
  130. package/dist/esm/{submitGtag-df9AQ2zL.js → submitGtag-C5xzFHjG.js} +2 -2
  131. package/dist/esm/taxIdFields-BUKnHMaL.js +139 -0
  132. package/dist/esm/taxIdRules-xYlx7ZXW.js +47 -0
  133. package/dist/esm/{updateCheckoutSessionAttributes-4Jq6V4pO.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +2 -2
  134. package/dist/esm/zonos-address-completion-dialog_7.entry.js +24 -29
  135. package/dist/esm/zonos-address-display_2.entry.js +4 -4
  136. package/dist/esm/zonos-address_4.entry.js +26 -29
  137. package/dist/esm/zonos-airwallex-payment.entry.js +8 -7
  138. package/dist/esm/zonos-badge.entry.js +1 -1
  139. package/dist/esm/zonos-banner.entry.js +1 -1
  140. package/dist/esm/zonos-button_3.entry.js +2 -2
  141. package/dist/esm/zonos-card_5.entry.js +9 -8
  142. package/dist/esm/zonos-cart-items_12.entry.js +90 -85
  143. package/dist/esm/zonos-checkbox_2.entry.js +2 -2
  144. package/dist/esm/zonos-checkout.entry.js +15 -14
  145. package/dist/esm/zonos-collapse.entry.js +1 -1
  146. package/dist/esm/zonos-collect-cart-items_3.entry.js +7 -6
  147. package/dist/esm/zonos-collect-finish_6.entry.js +13 -12
  148. package/dist/esm/zonos-collect.entry.js +10 -9
  149. package/dist/esm/zonos-controller.entry.js +10 -9
  150. package/dist/esm/zonos-country-flag.entry.js +3 -3
  151. package/dist/esm/zonos-country-select_4.entry.js +4 -4
  152. package/dist/esm/zonos-elements.js +1 -1
  153. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  154. package/dist/esm/zonos-hello.entry.js +5 -5
  155. package/dist/esm/zonos-input.entry.js +2 -2
  156. package/dist/esm/zonos-invoice-cart-items_2.entry.js +9 -8
  157. package/dist/esm/zonos-invoice-finish_5.entry.js +13 -12
  158. package/dist/esm/zonos-invoice.entry.js +10 -9
  159. package/dist/esm/zonos-language-select_2.entry.js +3 -3
  160. package/dist/esm/zonos-logo.entry.js +1 -1
  161. package/dist/esm/zonos-policy-consent_2.entry.js +8 -7
  162. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  163. package/dist/esm/zonos-stripe-input.entry.js +2 -2
  164. package/dist/esm/zonos-text.entry.js +1 -1
  165. package/dist/esm/zonos-v-stack.entry.js +1 -1
  166. package/dist/esm/{zonosStore-msUlqmSD.js → zonosStore-BXP9FvIt.js} +2 -1
  167. package/dist/esm-es5/{TaxId-Cye-evFK.js → TaxId-DMIgN_sT.js} +2 -1
  168. package/dist/esm-es5/{cart-BoQp8Ema.js → cart-BS5mSI8x.js} +42 -31
  169. package/dist/esm-es5/{collect-Eo4gtyql.js → collect-B9ZxDDl7.js} +1 -1
  170. package/dist/esm-es5/{debounce-BR3PaG8X.js → debounce-DHj2iHA1.js} +7 -7
  171. package/dist/esm-es5/debounce-DWqMT4lo.js +1 -0
  172. package/dist/esm-es5/getBorderRadius-BiGd45jw.js +8 -0
  173. package/dist/esm-es5/{getMissingRequiredShippingFields-Ks6_tpjn.js → getMissingRequiredShippingFields-BkEV865q.js} +3 -3
  174. package/dist/esm-es5/handleFetch-BFVO7oAR.js +73 -0
  175. package/dist/esm-es5/{hasInclusivePrice-CbEfIhI5.js → hasInclusivePrice-zSvDReDb.js} +1 -1
  176. package/dist/esm-es5/index.js +30 -12
  177. package/dist/esm-es5/{invoice-S1KahJ_Z.js → invoice-6iTuS6ek.js} +1 -1
  178. package/dist/esm-es5/loader.js +1 -1
  179. package/dist/esm-es5/localization-CXHiWcJp.js +345 -0
  180. package/dist/esm-es5/{paypal-DNfvnuUU.js → paypal-BE_NVBoy.js} +1 -1
  181. package/dist/esm-es5/{placeTestOrder-CQaMKFOg.js → placeTestOrder-BXA9K9Iy.js} +1 -1
  182. package/dist/esm-es5/{renderCheckoutCurrency-C2Tw73uR.js → renderCheckoutCurrency-KMa4HlAf.js} +1 -1
  183. package/dist/esm-es5/shouldRenderShortAddressCodeInput-Bc8k2vN0.js +8 -0
  184. package/dist/esm-es5/{shouldShowLanguageSelect-CCD7gpSY.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
  185. package/dist/esm-es5/{submitGtag-df9AQ2zL.js → submitGtag-C5xzFHjG.js} +1 -1
  186. package/dist/esm-es5/taxIdFields-BUKnHMaL.js +46 -0
  187. package/dist/esm-es5/taxIdRules-xYlx7ZXW.js +6 -0
  188. package/dist/esm-es5/{updateCheckoutSessionAttributes-4Jq6V4pO.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
  189. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +253 -254
  190. package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
  191. package/dist/esm-es5/zonos-address_4.entry.js +8 -9
  192. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  193. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  194. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  195. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  196. package/dist/esm-es5/zonos-card_5.entry.js +6 -6
  197. package/dist/esm-es5/zonos-cart-items_12.entry.js +137 -136
  198. package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
  199. package/dist/esm-es5/zonos-checkout.entry.js +3 -3
  200. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  201. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  202. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  203. package/dist/esm-es5/zonos-collect.entry.js +6 -6
  204. package/dist/esm-es5/zonos-controller.entry.js +5 -5
  205. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  206. package/dist/esm-es5/zonos-country-select_4.entry.js +2 -2
  207. package/dist/esm-es5/zonos-elements.js +1 -1
  208. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  209. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  210. package/dist/esm-es5/zonos-input.entry.js +1 -1
  211. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +2 -2
  212. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  213. package/dist/esm-es5/zonos-invoice.entry.js +3 -3
  214. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  215. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  216. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  217. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  218. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  219. package/dist/esm-es5/zonos-text.entry.js +1 -1
  220. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  221. package/dist/esm-es5/{zonosStore-msUlqmSD.js → zonosStore-BXP9FvIt.js} +1 -1
  222. package/dist/scripts/index.d.ts +103 -1
  223. package/dist/scripts/index.js +1 -1
  224. package/dist/scripts/loadZonos.js +1 -1
  225. package/dist/scripts/zonos.js +1 -1
  226. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +4 -0
  227. package/dist/types/components/store/checkout/stripe.d.ts +9 -0
  228. package/dist/types/components/store/translationStore/strings.arabic.d.ts +34 -1
  229. package/dist/types/components/store/translationStore/strings.base.d.ts +34 -1
  230. package/dist/types/components/store/translationStore/strings.chinese.d.ts +34 -1
  231. package/dist/types/components/store/translationStore/strings.danish.d.ts +34 -1
  232. package/dist/types/components/store/translationStore/strings.dutch.d.ts +34 -1
  233. package/dist/types/components/store/translationStore/strings.french.d.ts +34 -1
  234. package/dist/types/components/store/translationStore/strings.german.d.ts +34 -1
  235. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +34 -1
  236. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +34 -1
  237. package/dist/types/components/store/translationStore/strings.italian.d.ts +34 -1
  238. package/dist/types/components/store/translationStore/strings.japanese.d.ts +34 -1
  239. package/dist/types/components/store/translationStore/strings.korean.d.ts +34 -1
  240. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +34 -1
  241. package/dist/types/components/store/translationStore/strings.polish.d.ts +34 -1
  242. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +34 -1
  243. package/dist/types/components/store/translationStore/strings.russian.d.ts +34 -1
  244. package/dist/types/components/store/translationStore/strings.spanish.d.ts +34 -1
  245. package/dist/types/components/store/translationStore/strings.swedish.d.ts +34 -1
  246. package/dist/types/components/store/translationStore/strings.turkish.d.ts +34 -1
  247. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +34 -1
  248. package/dist/types/components/store/zonosStore.d.ts +2 -1
  249. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +4 -1
  250. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +4 -1
  251. package/dist/types/components/utils/__tests__/helpers/blockStorage.d.ts +3 -0
  252. package/dist/types/components/utils/checkout/getCheckoutTaxIdPayload.d.ts +6 -0
  253. package/dist/types/components/utils/checkout/getTaxIdFieldState.d.ts +18 -0
  254. package/dist/types/components/utils/checkout/resolveTaxIdSelection.d.ts +12 -0
  255. package/dist/types/components/utils/checkout/shouldRenderTaxIdInput.d.ts +2 -1
  256. package/dist/types/components/utils/checkout/taxIdFields.d.ts +11 -0
  257. package/dist/types/components/utils/logging/installConstructorCapture.d.ts +20 -0
  258. package/dist/types/components/utils/logging/reportBlockedStorage.d.ts +16 -0
  259. package/dist/types/components/utils/logging/startZonosInit.d.ts +5 -0
  260. package/dist/types/components/utils/logging/thrownMessage.d.ts +1 -0
  261. package/dist/types/components/utils/safeStorage.d.ts +4 -0
  262. package/dist/types/components/utils/taxId/taxIdRules.d.ts +37 -0
  263. package/dist/types/components/utils/taxIdValidationResult.d.ts +8 -2
  264. package/dist/types/components.d.ts +22 -0
  265. package/dist/types/index.d.ts +1 -0
  266. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
  267. package/dist/types/types/checkout/TaxId.d.ts +45 -0
  268. package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +11 -0
  269. package/dist/types/types/checkout/api/CreateParty.d.ts +2 -0
  270. package/dist/types/types/generated/graphql.frontend.types.d.ts +0 -22
  271. package/dist/types/types/generated/graphql.frontend.types.ts +0 -51
  272. package/dist/types/types/generated/graphql.internal.types.d.ts +270 -1
  273. package/dist/types/types/generated/graphql.internal.types.ts +341 -1
  274. package/dist/types/types/utils/ZonosSettings.d.ts +5 -0
  275. package/dist/zonos-elements/index.esm.js +1 -1
  276. package/dist/zonos-elements/p-08b01c96.entry.js +1 -0
  277. package/dist/zonos-elements/{p-c961caaf.entry.js → p-0909ef77.entry.js} +1 -1
  278. package/dist/zonos-elements/{p-23352709.system.entry.js → p-13015d34.system.entry.js} +4 -4
  279. package/dist/zonos-elements/{p-6c41b00c.entry.js → p-13d5b2f9.entry.js} +1 -1
  280. package/dist/zonos-elements/{p-5b80aff2.system.entry.js → p-150047b3.system.entry.js} +25 -25
  281. package/dist/zonos-elements/p-1986cc37.entry.js +1 -0
  282. package/dist/zonos-elements/{p-CBx5nYet.system.js → p-1OG3IJgY.system.js} +1 -1
  283. package/dist/zonos-elements/{p-d3d0656a.entry.js → p-1a5acbcd.entry.js} +1 -1
  284. package/dist/zonos-elements/{p-756d303f.system.entry.js → p-20eb00de.system.entry.js} +1 -1
  285. package/dist/zonos-elements/{p-9c33f7ed.system.entry.js → p-30bf4700.system.entry.js} +1 -1
  286. package/dist/zonos-elements/{p-d168023b.entry.js → p-3466bcba.entry.js} +1 -1
  287. package/dist/zonos-elements/p-383343c7.entry.js +1 -0
  288. package/dist/zonos-elements/{p-06030d3b.system.entry.js → p-3a506614.system.entry.js} +54 -54
  289. package/dist/zonos-elements/p-43c0ebe9.entry.js +1 -0
  290. package/dist/zonos-elements/{p-acd50b0b.entry.js → p-4612facd.entry.js} +1 -1
  291. package/dist/zonos-elements/{p-244e0302.system.entry.js → p-4715045c.system.entry.js} +1 -1
  292. package/dist/zonos-elements/p-4b65f192.entry.js +1 -0
  293. package/dist/zonos-elements/{p-5967a1c1.system.entry.js → p-573a4e7c.system.entry.js} +6 -6
  294. package/dist/zonos-elements/p-59fc32af.entry.js +1 -0
  295. package/dist/zonos-elements/{p-d82fd8a9.system.entry.js → p-5a296dbc.system.entry.js} +117 -116
  296. package/dist/zonos-elements/{p-193d9722.entry.js → p-61312d5b.entry.js} +1 -1
  297. package/dist/zonos-elements/{p-6abec43f.system.entry.js → p-68325c5a.system.entry.js} +4 -4
  298. package/dist/zonos-elements/{p-0b81f8b9.system.entry.js → p-6db7317a.system.entry.js} +6 -6
  299. package/dist/zonos-elements/{p-51400242.system.entry.js → p-709d1561.system.entry.js} +3 -3
  300. package/dist/zonos-elements/p-71d29603.entry.js +1 -0
  301. package/dist/zonos-elements/{p-7bd99479.system.entry.js → p-7214c953.system.entry.js} +21 -21
  302. package/dist/zonos-elements/p-74659d88.entry.js +1 -0
  303. package/dist/zonos-elements/{p-55916c90.entry.js → p-7f1bea9b.entry.js} +1 -1
  304. package/dist/zonos-elements/{p-0fca452b.entry.js → p-7fe83919.entry.js} +1 -1
  305. package/dist/zonos-elements/{p-1c150f26.entry.js → p-821e413a.entry.js} +1 -1
  306. package/dist/zonos-elements/{p-c403f004.system.entry.js → p-82e45d0c.system.entry.js} +1 -1
  307. package/dist/zonos-elements/{p-1409de3b.system.entry.js → p-88e20e99.system.entry.js} +1 -1
  308. package/dist/zonos-elements/{p-195f6e38.system.entry.js → p-89a3c4db.system.entry.js} +1 -1
  309. package/dist/zonos-elements/p-8ac26831.entry.js +1 -0
  310. package/dist/zonos-elements/{p-a40fd99b.system.entry.js → p-8f9f859f.system.entry.js} +39 -40
  311. package/dist/zonos-elements/{p-92fe9a1f.system.entry.js → p-902cca23.system.entry.js} +1 -1
  312. package/dist/zonos-elements/{p-0a4a7742.system.entry.js → p-93860183.system.entry.js} +1 -1
  313. package/dist/zonos-elements/{p-b5882fbb.system.entry.js → p-9449b4f4.system.entry.js} +1 -1
  314. package/dist/zonos-elements/{p-31043c2e.system.entry.js → p-96b250d8.system.entry.js} +298 -299
  315. package/dist/zonos-elements/p-97729873.entry.js +1 -0
  316. package/dist/zonos-elements/{p-1bac5ac1.system.entry.js → p-990fcf81.system.entry.js} +1 -1
  317. package/dist/zonos-elements/{p-7f031592.system.entry.js → p-9b3668a4.system.entry.js} +155 -155
  318. package/dist/zonos-elements/{p-249c1ee1.system.entry.js → p-9df31243.system.entry.js} +3 -3
  319. package/dist/zonos-elements/p-BD-9rD53.js +1 -0
  320. package/dist/zonos-elements/p-BI6VAB5B.js +1 -0
  321. package/dist/zonos-elements/p-BJFa5RwX.js +1 -0
  322. package/dist/zonos-elements/p-BJ_kE5rM.js +1 -0
  323. package/dist/zonos-elements/{p-Be3Hpms1.system.js → p-BKUlQxBd.system.js} +1 -1
  324. package/dist/zonos-elements/p-BUfCTQXY.system.js +528 -0
  325. package/dist/zonos-elements/{p-CZD8WvyY.system.js → p-BnQyot7Y.system.js} +23 -23
  326. package/dist/zonos-elements/p-Bu9WCfUC.system.js +2 -2
  327. package/dist/zonos-elements/{p-0mGRBGcf.js → p-C-zdj7MK.js} +1 -1
  328. package/dist/zonos-elements/p-C5fs3rIR.js +1 -0
  329. package/dist/zonos-elements/{p-sz4L-ZnB.js → p-CJmWr75U.js} +1 -1
  330. package/dist/zonos-elements/{p-XDxdMlQl.system.js → p-CMneHjck.system.js} +15 -15
  331. package/dist/zonos-elements/p-CP7KnfR3.system.js +245 -0
  332. package/dist/zonos-elements/p-CVRbGFV3.js +1 -0
  333. package/dist/zonos-elements/p-CYxMfUL7.system.js +1 -0
  334. package/dist/zonos-elements/p-Cl5yV0ak.js +1 -0
  335. package/dist/zonos-elements/{p-kaOxUR9u.system.js → p-Cp1IAJvW.system.js} +5 -5
  336. package/dist/zonos-elements/{p-W82paT5F.js → p-CqB9AfBf.js} +1 -1
  337. package/dist/zonos-elements/p-CzKlS3E-.system.js +6 -0
  338. package/dist/zonos-elements/p-D-Lnf8mS.system.js +345 -0
  339. package/dist/zonos-elements/p-D0DkOoAw.system.js +73 -0
  340. package/dist/zonos-elements/{p-c9QtIdJX.js → p-D4xpkSsK.js} +1 -1
  341. package/dist/zonos-elements/p-DATNIakn.js +1 -0
  342. package/dist/zonos-elements/{p-D4MevhAL.system.js → p-DC1OPJDq.system.js} +3 -3
  343. package/dist/zonos-elements/{p-8PPEbm_0.system.js → p-DIab60nK.system.js} +12 -12
  344. package/dist/zonos-elements/p-DKnphvmJ.js +1 -0
  345. package/dist/zonos-elements/{p-Cye-evFK.js → p-DMIgN_sT.js} +1 -1
  346. package/dist/zonos-elements/{p-BuU_p5DP.system.js → p-DTgUqgwV.system.js} +2 -2
  347. package/dist/zonos-elements/p-DW7I0zOF.js +1 -0
  348. package/dist/zonos-elements/{p-DoEHepOc.system.js → p-DXlojp_Y.system.js} +1 -1
  349. package/dist/zonos-elements/p-DqVePqqx.system.js +8 -0
  350. package/dist/zonos-elements/{p-B4Ufchqh.system.js → p-DrS-0mk7.system.js} +3 -3
  351. package/dist/zonos-elements/{p-7abqRc9V.js → p-DrbN3rPL.js} +2 -2
  352. package/dist/zonos-elements/{p-Cby4EkFu.system.js → p-DsBuZ6ob.system.js} +2 -1
  353. package/dist/zonos-elements/{p-DI2vXnXc.system.js → p-Dv5a-V6w.system.js} +1 -1
  354. package/dist/zonos-elements/p-Dwg61Ft_.js +1 -0
  355. package/dist/zonos-elements/{p-474e8a92.system.entry.js → p-a1022808.system.entry.js} +1 -1
  356. package/dist/zonos-elements/{p-17c7ea4a.system.entry.js → p-a3c147d2.system.entry.js} +3 -3
  357. package/dist/zonos-elements/p-aK18R41t.js +1 -0
  358. package/dist/zonos-elements/{p-83aa1c8c.entry.js → p-ad04bba2.entry.js} +1 -1
  359. package/dist/zonos-elements/p-af4ad54b.entry.js +1 -0
  360. package/dist/zonos-elements/p-af741506.entry.js +1 -0
  361. package/dist/zonos-elements/{p-a938c174.entry.js → p-b51010b9.entry.js} +1 -1
  362. package/dist/zonos-elements/{p-6db7c0b1.system.entry.js → p-b540c636.system.entry.js} +2 -2
  363. package/dist/zonos-elements/p-bac94956.entry.js +1 -0
  364. package/dist/zonos-elements/{p-69c3e367.system.entry.js → p-bb1b414a.system.entry.js} +9 -9
  365. package/dist/zonos-elements/{p-b79036fc.entry.js → p-bfa9e32a.entry.js} +1 -1
  366. package/dist/zonos-elements/{p-dfc87b10.system.entry.js → p-c33b8f6a.system.entry.js} +1 -1
  367. package/dist/zonos-elements/p-cf6bf7a4.entry.js +1 -0
  368. package/dist/zonos-elements/{p-CEK_Wk6v.system.js → p-dJcbnNlE.system.js} +1 -1
  369. package/dist/zonos-elements/p-db40b9c3.entry.js +1 -0
  370. package/dist/zonos-elements/p-dd003161.entry.js +1 -0
  371. package/dist/zonos-elements/{p-2603dce0.entry.js → p-e216cc8c.entry.js} +1 -1
  372. package/dist/zonos-elements/p-e374aaa4.entry.js +1 -0
  373. package/dist/zonos-elements/{p-155ed3d3.system.entry.js → p-e43470f7.system.entry.js} +21 -21
  374. package/dist/zonos-elements/p-ebc7ea54.system.entry.js +13 -0
  375. package/dist/zonos-elements/{p-11defdca.system.entry.js → p-f2ed52bc.system.entry.js} +8 -8
  376. package/dist/zonos-elements/{p-d4d2b39e.entry.js → p-fddf3556.entry.js} +1 -1
  377. package/dist/zonos-elements/p-gEViRqvf.js +1 -0
  378. package/dist/zonos-elements/{p-BpDCLBwW.js → p-n5PZKz1k.js} +1 -1
  379. package/dist/zonos-elements/{p-C_z9WL8a.js → p-r-YGHhLa.js} +1 -1
  380. package/dist/zonos-elements/{p-XqkqjeNV.system.js → p-yv7ekcdG.system.js} +2 -2
  381. package/dist/zonos-elements/{p-DQZncB2d.system.js → p-zsTASoh2.system.js} +3 -3
  382. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  383. package/package.json +1 -1
  384. package/dist/cjs/shouldRenderTaxIdInput-TxekHCp7.js +0 -43
  385. package/dist/esm/shouldRenderTaxIdInput-CKyZ6Zni.js +0 -40
  386. package/dist/esm/throttle-Cvlvb-dm.js +0 -85
  387. package/dist/esm-es5/debounce-CrmpwbEE.js +0 -1
  388. package/dist/esm-es5/getBorderRadius-DYfkeXdx.js +0 -8
  389. package/dist/esm-es5/handleFetch-D5GYDF-O.js +0 -60
  390. package/dist/esm-es5/localization-BIh-4pc_.js +0 -348
  391. package/dist/esm-es5/shouldRenderTaxIdInput-CKyZ6Zni.js +0 -17
  392. package/dist/esm-es5/throttle-Cvlvb-dm.js +0 -46
  393. package/dist/zonos-elements/p-06fe2939.entry.js +0 -1
  394. package/dist/zonos-elements/p-24f3c547.entry.js +0 -1
  395. package/dist/zonos-elements/p-30b3c9d3.entry.js +0 -1
  396. package/dist/zonos-elements/p-39ee1558.entry.js +0 -1
  397. package/dist/zonos-elements/p-3a2da031.entry.js +0 -1
  398. package/dist/zonos-elements/p-4679f0ec.entry.js +0 -1
  399. package/dist/zonos-elements/p-4806b264.system.entry.js +0 -13
  400. package/dist/zonos-elements/p-5873ab8e.entry.js +0 -1
  401. package/dist/zonos-elements/p-725e29bb.entry.js +0 -1
  402. package/dist/zonos-elements/p-BGktDPwA.system.js +0 -1
  403. package/dist/zonos-elements/p-Bi-s0fp_.system.js +0 -17
  404. package/dist/zonos-elements/p-CFbfEmjN.js +0 -1
  405. package/dist/zonos-elements/p-CUaf1cEg.js +0 -1
  406. package/dist/zonos-elements/p-CXxvn4GX.system.js +0 -227
  407. package/dist/zonos-elements/p-CcJF6xhQ.js +0 -1
  408. package/dist/zonos-elements/p-Cxuiqv1I.js +0 -1
  409. package/dist/zonos-elements/p-D-bZg-Pc.js +0 -1
  410. package/dist/zonos-elements/p-DE4a-QD5.js +0 -1
  411. package/dist/zonos-elements/p-DOD2I44l.system.js +0 -348
  412. package/dist/zonos-elements/p-DS-qw_qc.system.js +0 -517
  413. package/dist/zonos-elements/p-DZ2mevDK.js +0 -1
  414. package/dist/zonos-elements/p-DnjGkbEy.js +0 -1
  415. package/dist/zonos-elements/p-FRWZayxL.js +0 -1
  416. package/dist/zonos-elements/p-Mrz_lnC1.js +0 -1
  417. package/dist/zonos-elements/p-ad9ff14c.entry.js +0 -1
  418. package/dist/zonos-elements/p-bb3546c0.entry.js +0 -1
  419. package/dist/zonos-elements/p-c1cbfdba.entry.js +0 -1
  420. package/dist/zonos-elements/p-c47ce656.entry.js +0 -1
  421. package/dist/zonos-elements/p-c9d5d8f1.entry.js +0 -1
  422. package/dist/zonos-elements/p-clDfq9AL.js +0 -1
  423. package/dist/zonos-elements/p-d74bc3e8.entry.js +0 -1
  424. package/dist/zonos-elements/p-d8b312e5.entry.js +0 -1
  425. package/dist/zonos-elements/p-db87b0dd.entry.js +0 -1
  426. package/dist/zonos-elements/p-defc2d18.entry.js +0 -1
  427. package/dist/zonos-elements/p-rVp8hgWw.js +0 -1
  428. package/dist/zonos-elements/p-zVLAvre1.system.js +0 -60
@@ -1317,6 +1317,11 @@ type CartCheckoutWorkflowQuery = {
1317
1317
  variantKey: string;
1318
1318
  }>;
1319
1319
  }> | null;
1320
+ plugins: {
1321
+ bigcommerce: {
1322
+ allowBypassQuery: boolean;
1323
+ };
1324
+ };
1320
1325
  };
1321
1326
  onlineStoreSettings: {
1322
1327
  allowedDomains: Array<string>;
@@ -1545,6 +1550,7 @@ type GetOrderQuery = {
1545
1550
  createdAt: string;
1546
1551
  amount: number;
1547
1552
  itemType: ItemType | null;
1553
+ parentProductId: string | null;
1548
1554
  description: string | null;
1549
1555
  hsCode: string | null;
1550
1556
  countryOfOrigin: CountryCode | null;
@@ -1802,6 +1808,37 @@ type CustomAddressErrors = {
1802
1808
  state: string;
1803
1809
  };
1804
1810
 
1811
+ declare const taxIdTypeOptions: {
1812
+ readonly MX: readonly [{
1813
+ readonly label: "RFC";
1814
+ readonly placeholder: "XAXX010101000";
1815
+ readonly value: "RFC";
1816
+ }, {
1817
+ readonly label: "CURP";
1818
+ readonly placeholder: "AAAA800101HDFRRR09";
1819
+ readonly value: "CURP";
1820
+ }];
1821
+ readonly PE: readonly [{
1822
+ readonly label: "DNI";
1823
+ readonly placeholder: "12345678";
1824
+ readonly value: "DNI";
1825
+ }, {
1826
+ readonly label: "RUC";
1827
+ readonly placeholder: "20123456789";
1828
+ readonly value: "RUC";
1829
+ }, {
1830
+ readonly label: "Carné de extranjería";
1831
+ readonly placeholder: "001234567";
1832
+ readonly value: "CE";
1833
+ }];
1834
+ };
1835
+ type TaxIdTypeOption = (typeof taxIdTypeOptions.MX)[number] | (typeof taxIdTypeOptions.PE)[number];
1836
+ declare const checkoutTaxIdTypeValueList: readonly ["CE", "CURP", "DNI", "RFC", "RUC"];
1837
+ type AssertEveryCheckoutTaxIdType<T extends readonly TaxIdTypeOption['value'][]> = Exclude<TaxIdTypeOption['value'], T[number]> extends never ? T : never;
1838
+ /** Every document kind checkout can send. Older clients omit the field. */
1839
+ declare const checkoutTaxIdTypeValues: AssertEveryCheckoutTaxIdType<typeof checkoutTaxIdTypeValueList>;
1840
+ type CheckoutTaxIdTypeValue = (typeof checkoutTaxIdTypeValues)[number];
1841
+
1805
1842
  type StripeStoreContactOption = {
1806
1843
  address: {
1807
1844
  city: string;
@@ -2042,6 +2079,11 @@ type GenericZonosSettings = {
2042
2079
  * Whether or not Canadian shopper has to consent that they are aware of some procedures must happen after checking out otherwise the order will be returned
2043
2080
  */
2044
2081
  shouldFedExShippingConsentForCanadianShopper?: boolean;
2082
+ /**
2083
+ * When true, checkout requires a Peru tax id and lets the shopper pick the document type.
2084
+ * The API sets this from an organization list so stores can be added without a client release.
2085
+ */
2086
+ shouldRequirePeruTaxId?: boolean;
2045
2087
  /**
2046
2088
  * Signed token for Google Places API iframe access.
2047
2089
  */
@@ -2099,6 +2141,11 @@ declare namespace Components {
2099
2141
  * @default ''
2100
2142
  */
2101
2143
  "shortAddressCodeErrorMessage": string;
2144
+ /**
2145
+ * Which tax id control the error belongs on. Empty when there is no error.
2146
+ * @default ''
2147
+ */
2148
+ "taxIdErrorField": 'type' | 'value' | '';
2102
2149
  /**
2103
2150
  * Error message for tax id input
2104
2151
  * @default ''
@@ -2865,6 +2912,11 @@ declare namespace Components {
2865
2912
  * @default ''
2866
2913
  */
2867
2914
  "shortAddressCodeErrorMessage": string;
2915
+ /**
2916
+ * Which tax id control the error belongs on. Empty when there is no error.
2917
+ * @default ''
2918
+ */
2919
+ "taxIdErrorField": 'type' | 'value' | '';
2868
2920
  /**
2869
2921
  * Error message for tax id input
2870
2922
  * @default ''
@@ -4818,6 +4870,11 @@ declare namespace LocalJSX {
4818
4870
  * @default ''
4819
4871
  */
4820
4872
  "shortAddressCodeErrorMessage"?: string;
4873
+ /**
4874
+ * Which tax id control the error belongs on. Empty when there is no error.
4875
+ * @default ''
4876
+ */
4877
+ "taxIdErrorField"?: 'type' | 'value' | '';
4821
4878
  /**
4822
4879
  * Error message for tax id input
4823
4880
  * @default ''
@@ -5619,6 +5676,11 @@ declare namespace LocalJSX {
5619
5676
  * @default ''
5620
5677
  */
5621
5678
  "shortAddressCodeErrorMessage"?: string;
5679
+ /**
5680
+ * Which tax id control the error belongs on. Empty when there is no error.
5681
+ * @default ''
5682
+ */
5683
+ "taxIdErrorField"?: 'type' | 'value' | '';
5622
5684
  /**
5623
5685
  * Error message for tax id input
5624
5686
  * @default ''
@@ -6560,6 +6622,7 @@ declare namespace LocalJSX {
6560
6622
  interface ZonosAddressAttributes {
6561
6623
  "type": 'billing' | 'shipping';
6562
6624
  "titleText": string;
6625
+ "taxIdErrorField": 'type' | 'value' | '';
6563
6626
  "taxIdErrorMessage": string;
6564
6627
  "shortAddressCodeErrorMessage": string;
6565
6628
  }
@@ -6733,6 +6796,7 @@ declare namespace LocalJSX {
6733
6796
  interface ZonosCustomAddressAttributes {
6734
6797
  "type": 'billing' | 'shipping';
6735
6798
  "titleText": string;
6799
+ "taxIdErrorField": 'type' | 'value' | '';
6736
6800
  "taxIdErrorMessage": string;
6737
6801
  "shortAddressCodeErrorMessage": string;
6738
6802
  }
@@ -7200,6 +7264,11 @@ type CalculateLandedCostRequest = {
7200
7264
  * TaxId that the some destination countries require for the shipment.
7201
7265
  */
7202
7266
  shipToTaxId?: string;
7267
+ /**
7268
+ * Document kind selected in checkout. Mexico uses RFC or CURP.
7269
+ * Peru uses DNI, RUC, or CE.
7270
+ */
7271
+ shipToTaxIdType?: CheckoutTaxIdTypeValue;
7203
7272
  shippingAddress: {
7204
7273
  addressLine1: string;
7205
7274
  addressLine2?: string | undefined;
@@ -7371,12 +7440,21 @@ declare const stringsBase: {
7371
7440
  'CPF/CNPJ number': {
7372
7441
  value: string;
7373
7442
  };
7443
+ CURP: {
7444
+ value: string;
7445
+ };
7374
7446
  Cancel: {
7375
7447
  value: string;
7376
7448
  };
7377
7449
  'Card number copied to clipboard': {
7378
7450
  value: string;
7379
7451
  };
7452
+ 'Carn\u00E9 de extranjer\u00EDa': {
7453
+ value: string;
7454
+ };
7455
+ 'Carn\u00E9 de extranjer\u00EDa must be 9 digits.': {
7456
+ value: string;
7457
+ };
7380
7458
  'Cart subtotal': {
7381
7459
  value: string;
7382
7460
  };
@@ -7449,6 +7527,12 @@ declare const stringsBase: {
7449
7527
  'Customs fees total': {
7450
7528
  value: string;
7451
7529
  };
7530
+ DNI: {
7531
+ value: string;
7532
+ };
7533
+ 'DNI must be 8 digits.': {
7534
+ value: string;
7535
+ };
7452
7536
  Delivery: {
7453
7537
  value: string;
7454
7538
  };
@@ -7596,7 +7680,10 @@ declare const stringsBase: {
7596
7680
  'Invalid CUIT/CUIL format. Must contain 11 digits, with or without dashes (XX-XXXXXXXX-X).': {
7597
7681
  value: string;
7598
7682
  };
7599
- 'Invalid RFC or CURP format. Must be a 12\u201313 character RFC or an 18 character CURP, uppercase letters and numbers only.': {
7683
+ 'Invalid CURP format. Must be 18 uppercase letters and numbers.': {
7684
+ value: string;
7685
+ };
7686
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers.': {
7600
7687
  value: string;
7601
7688
  };
7602
7689
  'Invalid promo code': {
@@ -7800,9 +7887,18 @@ declare const stringsBase: {
7800
7887
  Quantity: {
7801
7888
  value: string;
7802
7889
  };
7890
+ RFC: {
7891
+ value: string;
7892
+ };
7803
7893
  'RFC or CURP number': {
7804
7894
  value: string;
7805
7895
  };
7896
+ RUC: {
7897
+ value: string;
7898
+ };
7899
+ 'RUC must be 11 digits.': {
7900
+ value: string;
7901
+ };
7806
7902
  'Refund policy': {
7807
7903
  value: string;
7808
7904
  };
@@ -7944,6 +8040,12 @@ declare const stringsBase: {
7944
8040
  'Tax id is required': {
7945
8041
  value: string;
7946
8042
  };
8043
+ 'Tax id type': {
8044
+ value: string;
8045
+ };
8046
+ 'Tax id type is required': {
8047
+ value: string;
8048
+ };
7947
8049
  Taxes: {
7948
8050
  value: string;
7949
8051
  };
@@ -1 +1 @@
1
- (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},y=w[m],h=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:d}:e),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=h(i),k=d.find(({type:e})=>"unknown"===e),Z=d.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),j=z&&I;return I&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${y}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=h();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:j,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.5.0.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},Z="https://js.stripe.com/v3",I=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let j=null;const O=e=>(null!==j||(j=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&I.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),j),A=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?O(null):null);let E=!1;A.catch(e=>{E||console.warn(e)});const T=async(...e)=>{var o;E=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const[n,r]=o,s=Object.assign({},r),i=(e=>{if(!("version"in e))return;const{version:o}=e;return"number"==typeof o||"string"==typeof o?o:void 0})(e);"string"==typeof i&&i!==3..toString()?delete s.apiVersion:s.apiVersion="2025-02-24.acacia";const a=e(n,s);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(a,t),a})(null!==(o=await A)&&void 0!==o?o:await O(null),e,t)},L=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),L({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},P=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${P.source}$`),D=new RegExp(`^cart_${P.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,R=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await L({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},F="zonos--checkout-hidden-international-button";var x;const M=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),B=Date.now(),q="https://v1.5.0.js.zonos.com",W=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.0",K="https://fonts.googleapis.com",G=/^https:\/\/fonts\.googleapis\.com/;class H{}x=H,H.doneInit=!1,H.cartSettings=null,H.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),H.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),H._paypalMockResponse=null,H.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,H.isBigCommerce=!1,H.releaseDate="1792773618734",H.isLegacyCheckout=!1,H.googleAnalyticId=null,H.googleAnalyticReady=!1,H.facebookPixelId=null,H.facebookPixelReady=!1,H.startLoadTime=B,H.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",H.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),H.overrideUseCustomAddressForm=!1,H.isCollect=!1,H.isInvoice=!1,H.isNpm=!0,H.zonosQaUrl=null,H.zonosQaUrlApi=null,H.trackEventLogs=[],H.version="v1.5.0",H.modeAlerted=!1,H.cartData=null,H.paypal=null,H.zonosMode=null,H.IframeService=o,H.getCurrentTimestamp=()=>(new Date).getTime(),H.zonosController=null,H.loadTimeApiInfoList=[],H.logIntervalId=null,H.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(x.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),x.createCartId=null==t?void 0:t.createCartId,x.buildCartDetail=null==t?void 0:t.buildCartDetail,x.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${x.version}) ======`),x.zonosApiKey=p,x.storeId=u,"undefined"!=typeof window&&window.parent===window&&(x.googleAnalyticReady=!0,x.facebookPixelReady=!0),x.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=x.isNpm,window.Zonos.isBigCommerce=x.isBigCommerce,window.Zonos.isLegacyCheckout=x.isLegacyCheckout,window.Zonos.zonosMode=x.zonosMode,window.Zonos.init(e)}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!p&&!x.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!x.cartData&&x.cartId){r("Initialize cart data");const e=await R(x.cartId);if(!e)return void s("Failed to get cart data");x.cartData=e.cartData,x.zonosApiKey=e.zonosApiKey,x.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(x.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(x.cartId&&x.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),x.restoreNativeBrowserFunctions(),x.injectCustomScriptForHostedCheckout(),x.injectZonosCdn(),x.injectZonosCss(),x.injectFonts(),x.injectCheckoutInternationalButton(),x.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),x.doneInit=!0},H.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${F}`)){const e=document.createElement("button");e.id=F,e.style.display="none",document.body.appendChild(e)}},H.injectCustomScriptForHostedCheckout=()=>{const e=x.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},H.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},H.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${F}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},H.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},H.showNotification=e=>{var o;null===(o=x.zonosController)||void 0===o||o.showNotification(e)},H.updateOrganizationName=e=>{var o;null===(o=x.zonosController)||void 0===o||o.updateOrganizationName(e)},H.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},H.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},H.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=x.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;r("loading Stripe");const t=await T(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),x.zonosController=n,r("Zonos controller injected!")},H.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${x.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&x.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},H.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return W;case"unpkg":return"https://unpkg.com/@zonos/elements@1.5.0";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.0";case"vercel":return q}};if(x.isNpm){return k()||o()}return o()},H.injectZonosCdn=()=>{x.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),x.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},H.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=x.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${q}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&x.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},H.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(x.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},H.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${K}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!G.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=K,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${K}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},H.setupGoogleFont=e=>{var o;null===(o=x.zonosController)||void 0===o||o.setupGoogleFont(e)},H.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${K}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=K,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=H})();
1
+ (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=["cloudflare","vercel"],n=t[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},s=r[n],i=(e=n)=>{const o=t.indexOf(e),r=t[o+1];return r||null},a=performance.now(),l=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},d=(e,o,...t)=>{var n,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...t];i.map(l).join(" ");if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(r=d.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":c.warn(e,...i);break;case"info":c.info(e,...i);break;case"error":c.error(e,...i);break;default:c.groupCollapsed(e,...i),c.trace(),c.groupEnd()}},c=()=>{const e=new URL(window.location.href);return e.searchParams.delete("payment_intent"),e.searchParams.delete("payment_intent_client_secret"),e.searchParams.delete("redirect_status"),e.toString()},u=async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{if(d("sendErrorLog","warn",e,t,o),n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,l={endpoint:e,errors:o,href:c(),metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},t)};try{fetch(`${s}/api/zonos-elements/log-error`,{body:JSON.stringify(l),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=i();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(l),method:"POST"})}},p=(e,o)=>"string"==typeof e&&e?e:e instanceof Error&&e.message||"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message&&e.message?e.message:o,m=/^Constructor for .+ was not found/,w=/^Constructor for "?([^#"]+)#/,h=e=>{var o;const t=p(e,"");if(!t||!m.test(t))return;if(void 0===window.Zonos)return;const n=window.__zonosConstructorCapture;if(!n)return;const r=w.exec(t),s=null!==(o=null==r?void 0:r[1])&&void 0!==o?o:"";n.reported.has(s)||(n.reported.add(s),u({endpoint:"stencil://constructor",errors:[t],metadata:{shape:"constructor-not-found",tag:s}}))},y=(e,...o)=>{d(e,"error",...o)},g=e=>{console.error(e),void 0!==window.Zonos&&u({endpoint:"zonos://init",errors:[p(e,"Unknown init rejection")],metadata:{shape:"init-rejection"}})},f=(e,o,t,n)=>{if(void 0===window.Zonos)return;const r=`${e}\0${o}\0${t}`,s=(window.__zonosReportedBlockedStorage||(window.__zonosReportedBlockedStorage=new Set),window.__zonosReportedBlockedStorage);s.has(r)||(s.add(r),u({endpoint:`storage://${e}/${t}`,errors:[p(n,"SecurityError")],metadata:{area:e,key:t,operation:o,shape:"blocked-storage"}}))},v=e=>{const o="local"===e?window.localStorage:window.sessionStorage;if(!o)throw new DOMException("","SecurityError");return o},b=(e,o)=>{try{v(e).removeItem(o)}catch(t){f(e,"removeItem",o,t)}},S=["jsdelivr","cdnjs","unpkg","vercel"],C="jsdelivr",z=e=>{const o=S.indexOf(e);return S[o+1]||null},k=()=>window.location.search.includes("zonosStagingMode=1"),Z=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function j(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const I=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},O=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},E=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],A=e=>502===e||503===e||504===e,T=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=I(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},L=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t),l=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(l));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const d=s.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&c&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await T({response:s}),response:s,zonosMode:d}}const u=s.status.toString();try{const e=await T({response:s,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:i,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:s,zonosMode:d}}return{baseUrl:i,errors:[{message:JSON.stringify(e),type:u}],json:null,response:s,zonosMode:d}}catch(e){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:A(s.status)?s:null,zonosMode:d}}},P=async({basePathType:e,options:o,path:t})=>{var n,s,a;const l=t.startsWith("/api/bigcommerce")?"vercel":e,c=performance.now(),p=await L({basePathType:l,options:o,path:t}),{errors:m,response:w}=p,h=j(p,["errors","response"]),y=performance.now()-c;d(`${t} (${y.toFixed(2)}ms)`,"info");const g=null==w?void 0:w.headers.get("Zonos-Duration");200===(null==w?void 0:w.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(E.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=O(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:l,loadTimeInternal:g?Number(g):0,loadTimeTotal:y});const f=i(l),v=m.find(({type:e})=>"unknown"===e),b=m.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),S=null==w?void 0:w.status,C=void 0!==S&&A(S),z="GET"===(null!==(n=null==o?void 0:o.method)&&void 0!==n?n:"GET").toUpperCase(),k=!!v||404===S||500===S,Z=f&&(k||C&&z);return(k||C)&&!b&&u({endpoint:r[l]+t,errors:m.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:l,nextFallbackApiType:f,requestHeaders:null==o?void 0:o.headers,requestPayload:I(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString())||(null===(a=null==o?void 0:o.body)||void 0===a?void 0:a.toString()),shouldCallFallback:Z,status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),Z?(d(`=== "${t}" failed to fetch, trying next fallback ${f}`),P({basePathType:f,options:o,path:t})):Object.assign({errors:m,response:w},h)},$=async(e,o)=>{const t=j(o||{},[]),r=t.body?JSON.stringify(t.body):void 0,s=t.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":k()?"1":void 0,"Zonos-Test-Mode":Z()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(i).forEach(e=>void 0===i[e]&&delete i[e]);const a=Object.assign(Object.assign({},t),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return P({basePathType:l||n,options:a,path:e})},U=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.5.2.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const n=`https://${o}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{b("session","zonos--checkout-session-id"),b("session","zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},D="https://js.stripe.com/v3",N=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let R=null;const x=e=>(null!==R||(R=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${D}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&N.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${D}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(y("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),R),F=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?x(null):null);let M=!1;F.catch(e=>{M||console.warn(e)});const B=async(...e)=>{var o;M=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const[n,r]=o,s=Object.assign({},r),i=(e=>{if(!("version"in e))return;const{version:o}=e;return"number"==typeof o||"string"==typeof o?o:void 0})(e);"string"==typeof i&&i!==3..toString()?delete s.apiVersion:s.apiVersion="2025-02-24.acacia";const a=e(n,s);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(a,t),a})(null!==(o=await F)&&void 0!==o?o:await x(null),e,t)},_=async({cartId:e,retries:o})=>{const t=Z(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),r=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,s=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:l}=await $(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:r,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),c=!a||i.length;return c&&o?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),_({cartId:e,retries:o-1})):c?null:Object.assign(Object.assign({},a),{zonosMode:l})},q=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,W=new RegExp(`^${q.source}$`),G=new RegExp(`^cart_${q.source}$`),K=/^[a-zA-Z0-9]{2,}$/,H=/^cart_[a-zA-Z0-9]{2,}$/,V=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:H.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:K.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:G.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:W.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return y("[ZONOS - loadZonos] invalid cart id"),null;const n=await _({cartId:e,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(y("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},Q="zonos--checkout-hidden-international-button";var J;const X=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),Y=Date.now(),ee="https://v1.5.2.js.zonos.com",oe=X||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.2",te="https://fonts.googleapis.com",ne=/^https:\/\/fonts\.googleapis\.com/;class re{}J=re,re.doneInit=!1,re.cartSettings=null,re.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),re.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),re._paypalMockResponse=null,re.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,re.isBigCommerce=!1,re.releaseDate="1793899943651",re.isLegacyCheckout=!1,re.googleAnalyticId=null,re.googleAnalyticReady=!1,re.facebookPixelId=null,re.facebookPixelReady=!1,re.startLoadTime=Y,re.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",re.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),re.overrideUseCustomAddressForm=!1,re.isCollect=!1,re.isInvoice=!1,re.isNpm=!0,re.zonosQaUrl=null,re.zonosQaUrlApi=null,re.trackEventLogs=[],re.version="v1.5.2",re.modeAlerted=!1,re.cartData=null,re.paypal=null,re.zonosMode=null,re.IframeService=o,re.getCurrentTimestamp=()=>(new Date).getTime(),re.zonosController=null,re.loadTimeApiInfoList=[],re.logIntervalId=null,re.init=async e=>{(()=>{if(window.__zonosConstructorCapture)return;const e=e=>{h(e.reason)};window.__zonosConstructorCapture={listener:e,reported:new Set},window.addEventListener("unhandledrejection",e);const o=console.error.bind(console);console.error=(...e)=>{h(e[0]),o(...e)}})();const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:r,onCountryChange:s,overrideCurrencyFormat:i,storeId:a,zonosApiKey:l}=e;if(J.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),J.createCartId=null==t?void 0:t.createCartId,J.buildCartDetail=null==t?void 0:t.buildCartDetail,J.doneInit)return;if(d(`====== ZONOS DEBUG MODE: on (${J.version}) ======`),J.zonosApiKey=l,J.storeId=a,"undefined"!=typeof window&&window.parent===window&&(J.googleAnalyticReady=!0,J.facebookPixelReady=!0),J.isNpm){d("====== ZONOS LOADING FROM NPM ======");const o=U();if(o&&!window.isZonosPreview){d(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=J.isNpm,window.Zonos.isBigCommerce=J.isBigCommerce,window.Zonos.isLegacyCheckout=J.isLegacyCheckout,window.Zonos.zonosMode=J.zonosMode,(e=>{let o;try{o=e()}catch(e){return void g(e)}o.catch(e=>{g(e)})})(()=>window.Zonos.init(e))}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!l&&!J.cartId)return void y("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!J.cartData&&J.cartId){d("Initialize cart data");const e=await V(J.cartId);if(!e)return void y("Failed to get cart data");J.cartData=e.cartData,J.zonosApiKey=e.zonosApiKey,J.cartSettings=e.settings}const t=await(async()=>{const e=Z(),o=k();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(d("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return d("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await $("/api/get-test-public-credential");if(t.length||!n)return y("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const r=n.publicCredential;return r?(d(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(y("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(J.zonosApiKey=t)}const c=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||((e,o)=>{try{return v(e).getItem(o)}catch(t){return f(e,"getItem",o,t),null}})("session","zonos--client-secret");if(J.cartId&&J.cartData||!!c){d("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}d("init zonos"),J.restoreNativeBrowserFunctions(),J.injectCustomScriptForHostedCheckout(),J.injectZonosCdn(),J.injectZonosCss(),J.injectFonts(),J.injectCheckoutInternationalButton(),J.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:r,onCountryChange:s,overrideCurrencyFormat:i}}),J.doneInit=!0},re.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${Q}`)){const e=document.createElement("button");e.id=Q,e.style.display="none",document.body.appendChild(e)}},re.injectCustomScriptForHostedCheckout=()=>{const e=J.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){d("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){d("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else d("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},re.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},re.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${Q}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},re.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},re.showNotification=e=>{var o;null===(o=J.zonosController)||void 0===o||o.showNotification(e)},re.updateOrganizationName=e=>{var o;null===(o=J.zonosController)||void 0===o||o.updateOrganizationName(e)},re.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},re.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},re.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=J.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;d("loading Stripe");const t=await B(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):y("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),J.zonosController=n,d("Zonos controller injected!")},re.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${J.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void d(`Zonos script "${n}" already exists in the document`,"warn");const r=document.head||document.body,s=document.createElement("script");o?s.type="module":s.noModule=!0,s.src=n,s.crossOrigin="anonymous",s.onerror=()=>{y(`Failed to load ${s.src}`);const n=z(e);n&&J.injectScript({cdnType:n,isModule:o,theRestUrl:t})},r.appendChild(s)},re.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return oe;case"unpkg":return"https://unpkg.com/@zonos/elements@1.5.2";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.2";case"vercel":return ee}};if(J.isNpm){return U()||o()}return o()},re.injectZonosCdn=()=>{J.injectScript({cdnType:C,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),J.injectScript({cdnType:C,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),d("Zonos cdn script injected!")},re.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=J.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${ee}/`,n.appendChild(r);const s=document.createElement("link");s.rel="stylesheet",s.href=`${t}/${o}`,s.onerror=()=>{y(`Failed to load ${s.href}`);const t=z(e);t&&J.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(s)},re.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?d("Zonos style links already injected","warn"):(J.injectStylesheet({cdnType:C,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),d("Zonos style css injected!"))},re.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void d("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${te}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!ne.test(t.href))return t}return null})())return void d("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=te,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${te}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),d("Zonos font injected!")},re.setupGoogleFont=e=>{var o;null===(o=J.zonosController)||void 0===o||o.setupGoogleFont(e)},re.injectSupportGoogleFont=e=>{var o;d(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${te}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=te,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void d(`[FONT] ${t} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,n.appendChild(r),d(`[FONT] ${t} font injected!`)},exports.Zonos=re})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=e=>/^[A-Z]{2}$/.test(e),n=e=>{try{const n=e.getItem("zonos--country");return n&&o(n)?n:null}catch(e){return null}},t=()=>(e=>{const n=new URLSearchParams(e||window.location.search),t=e=>{const t=n.get(e);return t&&o(t)?t:null},r=t("zCountry"),s=t("country"),i=t("customerCountry");return r||s||i})(new URL(window.location.href).searchParams)||(()=>{var e;return null!==(e=n(window.localStorage))&&void 0!==e?e:n(window.sessionStorage)})();function r(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const s=()=>window.location.search.includes("zonosStagingMode=1"),i=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},a=["cloudflare","vercel"],d=a[0],l={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},c=l[d],u=(e=d)=>{const o=a.indexOf(e),n=a[o+1];return n||null},p=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},w=performance.now(),g=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},m=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-w,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(g).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let a=document.querySelector("iframe#zonos---debug-logging-iframe");a||(a=document.createElement("iframe"),a.id="zonos---debug-logging-iframe",a.style.display="none",a.style.opacity="0",a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.border="none",a.style.overflow="hidden",a.style.visibility="hidden",document.body.appendChild(a));const d=(null===(r=a.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},y=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},f=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],h=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(f.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=y();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},v=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(m("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};try{fetch(`${c}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=u();if(!o)return;fetch(`${l[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}},S=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=p(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},z=async({basePathType:e,options:o,path:n})=>{let t;const r=window.Zonos.zonosQaUrlApi||l[e]||d,s=new URL(r+n),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{t=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:r,errors:[],json:await S({response:t}),response:t,zonosMode:a}}const u=t.status.toString();try{const e=await S({response:t,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:t,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:t,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:a}}},Z=async({basePathType:e,options:o,path:n})=>{var t,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),d=await z({basePathType:i,options:o,path:n}),{errors:c,response:w}=d,g=r(d,["errors","response"]),y=performance.now()-a;m(`${n} (${y.toFixed(2)}ms)`,"info");const f=null==w?void 0:w.headers.get("Zonos-Duration");200===(null==w?void 0:w.status)&&h({apiPath:n,apiType:i,loadTimeInternal:f?Number(f):0,loadTimeTotal:y});const S=u(i),C=c.find(({type:e})=>"unknown"===e),b=c.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!C||404===(null==w?void 0:w.status)||500===(null==w?void 0:w.status),L=S&&I;return I&&!b&&v({endpoint:l[i]+n,errors:c.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:S,requestHeaders:null==o?void 0:o.headers,requestPayload:p(null===(t=null==o?void 0:o.body)||void 0===t?void 0:t.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:L,status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),L?(m(`=== "${n}" failed to fetch, trying next fallback ${S}`),Z({basePathType:S,options:o,path:n})):Object.assign({errors:c,response:w},g)},C=async(e,o)=>{const n=r(o||{},[]),t=n.body?JSON.stringify(n.body):void 0,a=n.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":s()?"1":void 0,"Zonos-Test-Mode":i()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(l).forEach(e=>void 0===l[e]&&delete l[e]);const c=Object.assign(Object.assign({},n),{body:"GET"===a?void 0:t,headers:l,method:a}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return Z({basePathType:u||d,options:c,path:e})},b=(e,...o)=>{m(e,"error",...o)},I=["jsdelivr","cdnjs","unpkg","vercel"],L=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},O=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${O.source}$`),T=new RegExp(`^cart_${O.source}$`),k=/^[a-zA-Z0-9]{2,}$/,U=/^cart_[a-zA-Z0-9]{2,}$/,j=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:k.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},E=async({cartId:o,retries:n})=>{const t=i(),r=e(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,a=new URLSearchParams;r.overrideShouldEnabledCustomAddress&&a.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress);const{errors:d,json:l,zonosMode:c}=await C(`/api/zonos-elements/get-cart?${a.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||d.length;return u&&n?(m("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise(e=>setTimeout(e,500)),E({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:c})},$="z--blur",P=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise(e=>setTimeout(e,500)),clearInterval(e);document.querySelectorAll(`.${$}`).forEach(e=>{e.classList.remove($)}),window.zonosBlurCurrencyOnInitIntervalId=void 0},N=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add($);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach(e=>{e.classList.add($)})}};var D;const R=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=L(window.location.href),n="https://v1.5.0.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const t=`https://${o}.preview.js.zonos.com`;return m(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null}),t})(),F=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=L(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if("worker"===n)return"https://worker.iglobalstores.com";if(!e)return null;const t=`https://${e}.route.js.zonos.com`;return m(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),B=Date.now();class M{}D=M,M.isNpm=!1,M.isBigCommerce=!1,M.googleAnalyticId=null,M.googleAnalyticReady=!1,M.facebookPixelId=null,M.facebookPixelReady=!1,M.requested=!1,M.zonosMode=null,M.cartData=null,M.startLoadTime=B,M.overrideUseCustomAddressForm=!1,M.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,M.version="v1.5.0",M.isLegacyCheckout=!1,M.isCollect=!1,M.isInvoice=!1,M.legacyStoreLogo=null,M.legacyStoreFavicon=null,M.parallelLoadTimes=[],M.parallelLoadState="off",M.releaseDate="1792773618734",M.loadTimeApiInfoList=[],M.cartSettings=null,M.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find(e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType});null==e||e.transferSize;(async()=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},M.loadScriptLogParallelHandler=async e=>{try{if(D.parallelLoadTimes.push(e),2===D.parallelLoadTimes.length){const e=D.parallelLoadTimes.find(e=>"vercel"===e.type),o=D.parallelLoadTimes.find(e=>"jsdelivr"===e.type);if(!e||!o)return;if(e.isError&&o.isError)return void v({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});D.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},M.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{b(`[ZONOS - loadZonos] ${e}`),v({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:D.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},M.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.0";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.0":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.5.0");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},M.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:D.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:D.getGithubCdn({type:e,version:r}),a=R||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),c=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${c}?timestamp=${Date.now()}`,m(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const u="4g"===(null===(s=y())||void 0===s?void 0:s.effectiveType),p=["dev.elements.zonos.com","zonos.com"].some(e=>window.location.href.includes(e)),w=I[0]===e,g=I[1],f="on"===D.parallelLoadState&&u&&w&&g&&!p;f&&D.injectZonos({cdnType:g,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const h=performance.now();l.addEventListener("load",async()=>{if(f||n?D.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:D.storeId||0,type:e}):D.loadScriptLogHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:D.storeId||0,type:e}),D.isBigCommerce||(D.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=R,window.Zonos.zonosQaUrlApi=F,window.Zonos.zonosMode=D.zonosMode,window.Zonos.isBigCommerce=D.isBigCommerce,window.Zonos.loadTimeApiInfoList=D.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=D.overrideUseCustomAddressForm,window.Zonos.startLoadTime=D.startLoadTime,D.cartSettings&&(window.Zonos.cartSettings=D.cartSettings),D.cartId){const e=D.isCollect?"Collect":"hosted Checkout";if(!D.zonosApiKey)throw D.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!D.cartData)throw D.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(D.legacyStoreFavicon&&D.isLegacyCheckout&&!D.isCollect)try{if(200!==(await fetch(D.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=D.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=D.cartData,window.Zonos.isLegacyCheckout=D.isLegacyCheckout,window.Zonos.cartSettings=D.cartSettings,window.Zonos.isCollect=D.isCollect,window.Zonos.isInvoice=D.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:D.isLegacyCheckout&&!D.isCollect&&D.legacyStoreLogo?D.legacyStoreLogo:void 0}),zonosApiKey:D.zonosApiKey});o=n}window.Zonos.version&&(m(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(o))}),l.addEventListener("error",async()=>{const s=(e=>{const o=I.indexOf(e);return I[o+1]||null})(e);if(!f&&!n){if(!s)return;D.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some(e=>window.location.href.includes(e))||R)return;if(f||n)return void D.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,isError:!0,scriptLoadUrl:l.src,storeId:D.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?v({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-h,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):v({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-h}})}),document.head.appendChild(l)},M.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=D.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?P():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=D.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;N({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval(()=>{N({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})},10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout(()=>{P()},7e3)})())},M.init=async o=>{var n,r;if(m("=== Init zonos script release date","info",D.releaseDate),R&&!window.isZonosPreview){m(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${R}`,"info");const e=document.createElement("script");return e.src=`${R}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=D.isBigCommerce,window.Zonos.isLegacyCheckout=D.isLegacyCheckout,window.Zonos.startLoadTime=D.startLoadTime,window.Zonos.init(o)}),e.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${R}`)}),void(window.isZonosPreview=!0)}const a=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:d,isLegacyCartId:l}=j(a);if(a&&!l&&!d)return void D.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${a}`,metadata:{invalidCartId:!0}});D.cartId=a;const c=document.querySelector('script[src*="/zonos.js"]'),u=null===(n=document.querySelector("script[src*='/loadZonos.js']"))||void 0===n?void 0:n.src;m(`[ZONOS - init] first load script src: ${u}`,"info"),window.Zonos.zonosQaUrl=R,window.Zonos.zonosQaUrlApi=F,window.Zonos.zonosQaUrl&&m(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&m(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const p=null==u?void 0:u.includes("timestamp=");if(!(D.isNpm||u&&p))return void b("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(c||!u||D.requested)return void m("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!D.cartId)return D.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void b("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(D.requested=!0,D.zonosApiKey=o.zonosApiKey,D.storeId=o.storeId,D.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=j(e);if(!n&&!o)return b("[ZONOS - loadZonos] invalid cart id"),null;const t=await E({cartId:e,retries:5});return m("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(b("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(D.cartId);if(!e)throw D.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");D.cartData=e.cartData,D.cartSettings=e.settings,D.legacyStoreLogo=e.storeLogo,D.legacyStoreFavicon=e.storeFavicon,D.storeId=e.storeId,D.zonosApiKey=e.zonosApiKey,D.isCollect=e.cartData.type.includes("COLLECT"),D.isInvoice="INVOICE"===e.cartData.type}if(!D.zonosApiKey)return void b('"zonosApiKey" is required to initialize Zonos');const w=await(async()=>{const e=i(),o=s();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(m("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return m("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:t}=await C("/api/get-test-public-credential");if(n.length||!t)return b("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const r=t.publicCredential;return r?(m(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(b("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(w&&(m(`[ZONOS - loadZonos] Using test API key: ${w} for test mode`,"info"),D.zonosApiKey=w),!D.cartId){const{json:o,zonosMode:n}=await(async()=>{if(window.Zonos.cartSettings)return m("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const o=e(),n=new URLSearchParams;o.overrideShouldEnabledCustomAddress&&n.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress);const r=t();r&&n.set("zCountry",r);const{errors:s,json:i,zonosMode:a}=await C(`/api/zonos-elements/zonos-settings?${n.toString()}`);return s.length?(b("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:s,json:null,zonosMode:a}):{errors:[],json:i,zonosMode:a}})();(null==o?void 0:o.appearanceSettings)&&(null==o?void 0:o.checkoutSettings)&&(null==o?void 0:o.helloSettings)&&(null==o?void 0:o.organization)&&(m("[ZONOS - loadZonos] Prefetching zonos settings","info"),D.cartSettings={appearanceSettings:o.appearanceSettings,checkoutSettings:o.checkoutSettings,credentialTokenId:D.zonosApiKey,genericSettings:o.genericSettings,helloSettings:o.helloSettings,inclusivePriceConfigurations:o.inclusivePriceConfigurations,landedCostSettings:o.landedCostSettings,onlineStoreSettings:o.onlineStoreSettings,organization:o.organization,organizationId:(null===(r=o.organization)||void 0===r?void 0:r.id)||"",shippingZones:o.shippingZones},D.zonosMode=n)}D.handlePerformBlurCurrency();const g=D.storeId||o.storeId||0;m(`[ZONOS - loadZonos] Store ID: ${g}`,"info");const y=new URLSearchParams;y.set("storeId",g.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&y.set("_enableStoreVersionPinned","1");const{errors:f,json:h}=await C(`/api/get-store-version?${y.toString()}`);if(f.length||!h)return m("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void D.injectZonos({initConfig:o,vercelUrl:"https://v1.5.0.js.zonos.com",version:null});const{isDifferent:v,source:S,version:z}=h;if(m(`[ZONOS - loadZonos] Store version: ${z}, source: ${S}`,"info"),v){m(`[ZONOS - loadZonos] Updating saved store version to ${z}`,"info");const e={storeId:g,version:z};C(`/api/set-store-version?${y.toString()}`,{body:e,method:"POST"}).catch(e=>b("Unable to save store's vesrion",e))}if(!c){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),t=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:u}),r=t&&!n?e:`${"alpha"===z?"alpha":`v${z}`}.js.zonos.com`,s=t&&!n?null:z;m("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:z}),D.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=M)})();
1
+ (function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=e=>/^[A-Z]{2}$/.test(e),n=["cloudflare","vercel"],t=n[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},s=r[t],i=(e=t)=>{const o=n.indexOf(e),r=n[o+1];return r||null},a=performance.now(),d=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},c=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(d).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const l=(null===(r=c.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":l.warn(e,...i);break;case"info":l.info(e,...i);break;case"error":l.error(e,...i);break;default:l.groupCollapsed(e,...i),l.trace(),l.groupEnd()}},l=()=>{const e=new URL(window.location.href);return e.searchParams.delete("payment_intent"),e.searchParams.delete("payment_intent_client_secret"),e.searchParams.delete("redirect_status"),e.toString()},u=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(c("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,d={endpoint:e,errors:o,href:l(),metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${s}/api/zonos-elements/log-error`,{body:JSON.stringify(d),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=i();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(d),method:"POST"})}},p=(e,o)=>"string"==typeof e&&e?e:e instanceof Error&&e.message||"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message&&e.message?e.message:o,w=(e,o,n,t)=>{if(void 0===window.Zonos)return;const r=`${e}\0${o}\0${n}`,s=(window.__zonosReportedBlockedStorage||(window.__zonosReportedBlockedStorage=new Set),window.__zonosReportedBlockedStorage);s.has(r)||(s.add(r),u({endpoint:`storage://${e}/${n}`,errors:[p(t,"SecurityError")],metadata:{area:e,key:n,operation:o,shape:"blocked-storage"}}))},m=e=>{const o="local"===e?window.localStorage:window.sessionStorage;if(!o)throw new DOMException("","SecurityError");return o},g=(e,o)=>{try{m(e).removeItem(o)}catch(n){w(e,"removeItem",o,n)}},y=e=>{const n=((e,o)=>{try{return m(e).getItem(o)}catch(n){return w(e,"getItem",o,n),null}})(e,"zonos--country");return n&&o(n)?n:null},f=()=>(e=>{const n=new URLSearchParams(e||window.location.search),t=e=>{const t=n.get(e);return t&&o(t)?t:null},r=t("zCountry"),s=t("country"),i=t("customerCountry");return r||s||i})(new URL(window.location.href).searchParams)||(()=>{var e;return null!==(e=y("local"))&&void 0!==e?e:y("session")})();function h(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const v=()=>window.location.search.includes("zonosStagingMode=1"),S=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},z=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},Z=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},C=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(C.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=Z();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(c=a,c||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var c;window.Zonos.loadTimeApiInfoList.push(d)},I=e=>502===e||503===e||504===e,L=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=z(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},O=async({basePathType:e,options:o,path:n})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||t,a=new URL(i+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await L({response:s}),response:s,zonosMode:c}}const u=s.status.toString();try{const e=await L({response:s,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:i,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:s,zonosMode:c}}return{baseUrl:i,errors:[{message:JSON.stringify(e),type:u}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:I(s.status)?s:null,zonosMode:c}}},T=async({basePathType:e,options:o,path:n})=>{var t,s,a;const d=n.startsWith("/api/bigcommerce")?"vercel":e,l=performance.now(),p=await O({basePathType:d,options:o,path:n}),{errors:w,response:m}=p,g=h(p,["errors","response"]),y=performance.now()-l;c(`${n} (${y.toFixed(2)}ms)`,"info");const f=null==m?void 0:m.headers.get("Zonos-Duration");200===(null==m?void 0:m.status)&&b({apiPath:n,apiType:d,loadTimeInternal:f?Number(f):0,loadTimeTotal:y});const v=i(d),S=w.find(({type:e})=>"unknown"===e),Z=w.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),C=null==m?void 0:m.status,L=void 0!==C&&I(C),A="GET"===(null!==(t=null==o?void 0:o.method)&&void 0!==t?t:"GET").toUpperCase(),k=!!S||404===C||500===C,U=v&&(k||L&&A);return(k||L)&&!Z&&u({endpoint:r[d]+n,errors:w.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:d,nextFallbackApiType:v,requestHeaders:null==o?void 0:o.headers,requestPayload:z(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString())||(null===(a=null==o?void 0:o.body)||void 0===a?void 0:a.toString()),shouldCallFallback:U,status:null==m?void 0:m.status,statusText:null==m?void 0:m.statusText},shouldPostReleaseErrorReporting:!0}),U?(c(`=== "${n}" failed to fetch, trying next fallback ${v}`),T({basePathType:v,options:o,path:n})):Object.assign({errors:w,response:m},g)},A=async(e,o)=>{const n=h(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":v()?"1":void 0,"Zonos-Test-Mode":S()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach(e=>void 0===i[e]&&delete i[e]);const a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return T({basePathType:d||t,options:a,path:e})},k=(e,...o)=>{c(e,"error",...o)},U=/^Constructor for .+ was not found/,j=/^Constructor for "?([^#"]+)#/,E=e=>{var o;const n=p(e,"");if(!n||!U.test(n))return;if(void 0===window.Zonos)return;const t=window.__zonosConstructorCapture;if(!t)return;const r=j.exec(n),s=null!==(o=null==r?void 0:r[1])&&void 0!==o?o:"";t.reported.has(s)||(t.reported.add(s),u({endpoint:"stencil://constructor",errors:[n],metadata:{shape:"constructor-not-found",tag:s}}))},$=e=>{console.error(e),void 0!==window.Zonos&&u({endpoint:"zonos://init",errors:[p(e,"Unknown init rejection")],metadata:{shape:"init-rejection"}})},P=e=>{let o;try{o=e()}catch(e){return void $(e)}o.catch(e=>{$(e)})},D=["jsdelivr","cdnjs","unpkg","vercel"],N=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},R=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,F=new RegExp(`^${R.source}$`),B=new RegExp(`^cart_${R.source}$`),M=/^[a-zA-Z0-9]{2,}$/,x=/^cart_[a-zA-Z0-9]{2,}$/,K=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:x.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:M.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:B.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:F.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},_=async({cartId:o,retries:n})=>{const t=S(),r=e(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;r.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress);const{errors:a,json:d,zonosMode:l}=await A(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!d||a.length;return u&&n?(c("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise(e=>setTimeout(e,500)),_({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},d),{zonosMode:l})},q="z--blur",H=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise(e=>setTimeout(e,500)),clearInterval(e);document.querySelectorAll(`.${q}`).forEach(e=>{e.classList.remove(q)}),window.zonosBlurCurrencyOnInitIntervalId=void 0},Q=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add(q);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach(e=>{e.classList.add(q)})}};var W;const G=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=N(window.location.href),n="https://v1.5.2.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const t=`https://${o}.preview.js.zonos.com`;return c(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then(()=>{g("session","zonos--checkout-session-id"),g("session","zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null}),t})(),V=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=N(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if("worker"===n)return"https://worker.iglobalstores.com";if(!e)return null;const t=`https://${e}.route.js.zonos.com`;return c(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),J=Date.now();class X{}W=X,X.isNpm=!1,X.isBigCommerce=!1,X.googleAnalyticId=null,X.googleAnalyticReady=!1,X.facebookPixelId=null,X.facebookPixelReady=!1,X.requested=!1,X.zonosMode=null,X.cartData=null,X.startLoadTime=J,X.overrideUseCustomAddressForm=!1,X.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,X.version="v1.5.2",X.isLegacyCheckout=!1,X.isCollect=!1,X.isInvoice=!1,X.legacyStoreLogo=null,X.legacyStoreFavicon=null,X.parallelLoadTimes=[],X.parallelLoadState="off",X.releaseDate="1793899943651",X.loadTimeApiInfoList=[],X.cartSettings=null,X.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find(e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType});null==e||e.transferSize;(async()=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},X.loadScriptLogParallelHandler=async e=>{try{if(W.parallelLoadTimes.push(e),2===W.parallelLoadTimes.length){const e=W.parallelLoadTimes.find(e=>"vercel"===e.type),o=W.parallelLoadTimes.find(e=>"jsdelivr"===e.type);if(!e||!o)return;if(e.isError&&o.isError)return void u({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});W.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},X.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{k(`[ZONOS - loadZonos] ${e}`),u({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:W.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},X.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.2";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.2":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.5.2");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},X.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:W.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:W.getGithubCdn({type:e,version:r}),a=G||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),p=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${p}?timestamp=${Date.now()}`,c(`[ZONOS - loadZonos] Injecting "${p}" from "${d}"`,"info");const w="4g"===(null===(s=Z())||void 0===s?void 0:s.effectiveType),m=["dev.elements.zonos.com","zonos.com"].some(e=>window.location.href.includes(e)),g=D[0]===e,y=D[1],f="on"===W.parallelLoadState&&w&&g&&y&&!m;f&&W.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const h=performance.now();l.addEventListener("load",async()=>{if(f||n?W.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:W.storeId||0,type:e}):W.loadScriptLogHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:W.storeId||0,type:e}),W.isBigCommerce||(W.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=G,window.Zonos.zonosQaUrlApi=V,window.Zonos.zonosMode=W.zonosMode,window.Zonos.isBigCommerce=W.isBigCommerce,window.Zonos.loadTimeApiInfoList=W.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=W.overrideUseCustomAddressForm,window.Zonos.startLoadTime=W.startLoadTime,W.cartSettings&&(window.Zonos.cartSettings=W.cartSettings),W.cartId){const e=W.isCollect?"Collect":"hosted Checkout";if(!W.zonosApiKey)throw W.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!W.cartData)throw W.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(W.legacyStoreFavicon&&W.isLegacyCheckout&&!W.isCollect)try{if(200!==(await fetch(W.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=W.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=W.cartData,window.Zonos.isLegacyCheckout=W.isLegacyCheckout,window.Zonos.cartSettings=W.cartSettings,window.Zonos.isCollect=W.isCollect,window.Zonos.isInvoice=W.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:W.isLegacyCheckout&&!W.isCollect&&W.legacyStoreLogo?W.legacyStoreLogo:void 0}),zonosApiKey:W.zonosApiKey});o=n}window.Zonos.version&&(c(`[ZONOS - loadZonos] Execute "Zonos.init" from "${p}" from "${d}"`,"info"),P(()=>window.Zonos.init(o)))}),l.addEventListener("error",async()=>{const s=(e=>{const o=D.indexOf(e);return D[o+1]||null})(e);if(!f&&!n){if(!s)return;W.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some(e=>window.location.href.includes(e))||G)return;if(f||n)return void W.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,isError:!0,scriptLoadUrl:l.src,storeId:W.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?u({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-h,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):u({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-h}})}),document.head.appendChild(l)},X.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=W.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?H():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=W.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;Q({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval(()=>{Q({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})},10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout(()=>{H()},7e3)})())},X.init=async o=>{var n,t;if((()=>{if(window.__zonosConstructorCapture)return;const e=e=>{E(e.reason)};window.__zonosConstructorCapture={listener:e,reported:new Set},window.addEventListener("unhandledrejection",e);const o=console.error.bind(console);console.error=(...e)=>{E(e[0]),o(...e)}})(),c("=== Init zonos script release date","info",W.releaseDate),G&&!window.isZonosPreview){c(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${G}`,"info");const e=document.createElement("script");return e.src=`${G}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=W.isBigCommerce,window.Zonos.isLegacyCheckout=W.isLegacyCheckout,window.Zonos.startLoadTime=W.startLoadTime,P(()=>window.Zonos.init(o))}),e.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${G}`)}),void(window.isZonosPreview=!0)}const r=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:s,isLegacyCartId:i}=K(r);if(r&&!i&&!s)return void W.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${r}`,metadata:{invalidCartId:!0}});W.cartId=r;const a=document.querySelector('script[src*="/zonos.js"]'),d=null===(n=document.querySelector("script[src*='/loadZonos.js']"))||void 0===n?void 0:n.src;c(`[ZONOS - init] first load script src: ${d}`,"info"),window.Zonos.zonosQaUrl=G,window.Zonos.zonosQaUrlApi=V,window.Zonos.zonosQaUrl&&c(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&c(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const l=null==d?void 0:d.includes("timestamp=");if(!(W.isNpm||d&&l))return void k("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(a||!d||W.requested)return void c("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!W.cartId)return W.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void k("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(W.requested=!0,W.zonosApiKey=o.zonosApiKey,W.storeId=o.storeId,W.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=K(e);if(!n&&!o)return k("[ZONOS - loadZonos] invalid cart id"),null;const t=await _({cartId:e,retries:5});return c("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(k("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(W.cartId);if(!e)throw W.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");W.cartData=e.cartData,W.cartSettings=e.settings,W.legacyStoreLogo=e.storeLogo,W.legacyStoreFavicon=e.storeFavicon,W.storeId=e.storeId,W.zonosApiKey=e.zonosApiKey,W.isCollect=e.cartData.type.includes("COLLECT"),W.isInvoice="INVOICE"===e.cartData.type}if(!W.zonosApiKey)return void k('"zonosApiKey" is required to initialize Zonos');const u=await(async()=>{const e=S(),o=v();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(c("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return c("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:t}=await A("/api/get-test-public-credential");if(n.length||!t)return k("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const r=t.publicCredential;return r?(c(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(k("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(u&&(c(`[ZONOS - loadZonos] Using test API key: ${u} for test mode`,"info"),W.zonosApiKey=u),!W.cartId){const{json:o,zonosMode:n}=await(async()=>{if(window.Zonos.cartSettings)return c("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const o=e(),n=new URLSearchParams;o.overrideShouldEnabledCustomAddress&&n.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress);const t=f();t&&n.set("zCountry",t);const{errors:r,json:s,zonosMode:i}=await A(`/api/zonos-elements/zonos-settings?${n.toString()}`);return r.length?(k("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:r,json:null,zonosMode:i}):{errors:[],json:s,zonosMode:i}})();(null==o?void 0:o.appearanceSettings)&&(null==o?void 0:o.checkoutSettings)&&(null==o?void 0:o.helloSettings)&&(null==o?void 0:o.organization)&&(c("[ZONOS - loadZonos] Prefetching zonos settings","info"),W.cartSettings={appearanceSettings:o.appearanceSettings,checkoutSettings:o.checkoutSettings,credentialTokenId:W.zonosApiKey,genericSettings:o.genericSettings,helloSettings:o.helloSettings,inclusivePriceConfigurations:o.inclusivePriceConfigurations,landedCostSettings:o.landedCostSettings,onlineStoreSettings:o.onlineStoreSettings,organization:o.organization,organizationId:(null===(t=o.organization)||void 0===t?void 0:t.id)||"",shippingZones:o.shippingZones},W.zonosMode=n)}W.handlePerformBlurCurrency();const p=W.storeId||o.storeId||0;c(`[ZONOS - loadZonos] Store ID: ${p}`,"info");const w=new URLSearchParams;w.set("storeId",p.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&w.set("_enableStoreVersionPinned","1");const{errors:m,json:g}=await A(`/api/get-store-version?${w.toString()}`);if(m.length||!g)return c("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void W.injectZonos({initConfig:o,vercelUrl:"https://v1.5.2.js.zonos.com",version:null});const{isDifferent:y,source:h,version:z}=g;if(c(`[ZONOS - loadZonos] Store version: ${z}, source: ${h}`,"info"),y){c(`[ZONOS - loadZonos] Updating saved store version to ${z}`,"info");const e={storeId:p,version:z};A(`/api/set-store-version?${w.toString()}`,{body:e,method:"POST"}).catch(e=>k("Unable to save store's vesrion",e))}if(!a){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),t=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:d}),r=t&&!n?e:`${"alpha"===z?"alpha":`v${z}`}.js.zonos.com`,s=t&&!n?null:z;c("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:z}),W.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=X)})();