@zonos/elements 1.3.184 → 1.3.185

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 (343) hide show
  1. package/dist/cjs/{cart-3d0c0f0b.js → cart-f9df3ac8.js} +3209 -10
  2. package/dist/cjs/debounce-3eaa4f7e.js +357 -0
  3. package/dist/cjs/{getBorderRadius-94ef609c.js → getBorderRadius-87f3b69c.js} +1 -1
  4. package/dist/cjs/getGenericSettingsOverride-c0ca32b9.js +104 -0
  5. package/dist/cjs/helpers-5bdbb68c.js +100 -0
  6. package/dist/cjs/{index-2f90486e.js → index-0993f42d.js} +15 -3
  7. package/dist/cjs/index.cjs.js +19 -8
  8. package/dist/cjs/{isDarkColor-ec4a4e7d.js → isDarkColor-d0c67c3d.js} +1 -1
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/{paypal-9eaa9196.js → paypal-5e73c8f5.js} +3 -3
  11. package/dist/cjs/zonos-address_11.cjs.entry.js +7917 -0
  12. package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-banner.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-button_3.cjs.entry.js +18 -7
  15. package/dist/cjs/zonos-card.cjs.entry.js +3 -3
  16. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +113 -21
  17. package/dist/cjs/zonos-checkout.cjs.entry.js +9 -7
  18. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  19. package/dist/cjs/zonos-component.cjs.entry.js +2 -2
  20. package/dist/cjs/zonos-controller.cjs.entry.js +225 -7
  21. package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
  22. package/dist/cjs/zonos-country-select_4.cjs.entry.js +10 -10
  23. package/dist/cjs/zonos-elements.cjs.js +2 -2
  24. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +8 -8
  25. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +9 -9
  26. package/dist/cjs/zonos-hello.cjs.entry.js +7 -358
  27. package/dist/cjs/zonos-input.cjs.entry.js +3 -3
  28. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
  29. package/dist/cjs/zonos-link.cjs.entry.js +1 -1
  30. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  31. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
  32. package/dist/cjs/zonos-stripe-input.cjs.entry.js +31 -12
  33. package/dist/cjs/zonos-text.cjs.entry.js +2 -2
  34. package/dist/cjs/zonos-toggle.cjs.entry.js +4 -4
  35. package/dist/cjs/zonos-tooltip.cjs.entry.js +3 -3
  36. package/dist/cjs/zonos-v-stack.cjs.entry.js +4 -4
  37. package/dist/cjs/{zonosStore-3812b318.js → zonosStore-adc42868.js} +2 -1
  38. package/dist/collection/collection-manifest.json +4 -0
  39. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +3 -3
  40. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +11 -0
  41. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +22 -0
  42. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +1 -1
  43. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +162 -17
  44. package/dist/collection/components/common/zonos-button/zonos-button.js +14 -3
  45. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +5 -3
  46. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +2 -2
  47. package/dist/collection/components/common/zonos-country-select/zonos-country-select.css +0 -6
  48. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +2 -2
  49. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +2 -3
  50. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +105 -8
  51. package/dist/collection/components/common/zonos-stripe-phone-input/assets/ChevronDownIcon.svg +1 -0
  52. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.css +222 -0
  53. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +481 -0
  54. package/dist/collection/components/common/zonos-stripe-select/assets/ChevronDownIcon.svg +1 -0
  55. package/dist/collection/components/common/zonos-stripe-select/assets/RemoveLineIcon.svg +1 -0
  56. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.css +178 -0
  57. package/dist/collection/components/common/zonos-stripe-select/zonos-stripe-select.js +455 -0
  58. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
  59. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  60. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  61. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  62. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  63. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  64. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  65. package/dist/collection/components/main/zonos-controller.js +24 -1
  66. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  67. package/dist/collection/components/store/checkout/stripe.js +24 -7
  68. package/dist/collection/components/store/translationStore/strings.arabic.js +159 -0
  69. package/dist/collection/components/store/translationStore/strings.base.js +161 -0
  70. package/dist/collection/components/store/translationStore/strings.chinese.js +159 -0
  71. package/dist/collection/components/store/translationStore/strings.danish.js +159 -0
  72. package/dist/collection/components/store/translationStore/strings.dutch.js +159 -0
  73. package/dist/collection/components/store/translationStore/strings.french.js +159 -0
  74. package/dist/collection/components/store/translationStore/strings.german.js +159 -0
  75. package/dist/collection/components/store/translationStore/strings.hebrew.js +159 -0
  76. package/dist/collection/components/store/translationStore/strings.indonesian.js +159 -0
  77. package/dist/collection/components/store/translationStore/strings.italian.js +159 -0
  78. package/dist/collection/components/store/translationStore/strings.japanese.js +159 -0
  79. package/dist/collection/components/store/translationStore/strings.korean.js +159 -0
  80. package/dist/collection/components/store/translationStore/strings.norwegian.js +159 -0
  81. package/dist/collection/components/store/translationStore/strings.polish.js +159 -0
  82. package/dist/collection/components/store/translationStore/strings.portuguese.js +159 -0
  83. package/dist/collection/components/store/translationStore/strings.russian.js +159 -0
  84. package/dist/collection/components/store/translationStore/strings.spanish.js +159 -0
  85. package/dist/collection/components/store/translationStore/strings.swedish.js +159 -0
  86. package/dist/collection/components/store/translationStore/strings.turkish.js +159 -0
  87. package/dist/collection/components/store/translationStore/strings.vietnamese.js +159 -0
  88. package/dist/collection/components/store/zonosStore.js +1 -0
  89. package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
  90. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/assets/RemoveIcon.svg +1 -0
  91. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.css +86 -0
  92. package/dist/collection/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.js +192 -0
  93. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +67 -0
  94. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +978 -0
  95. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  96. package/dist/collection/components/utils/api/getGenericSettingsOverride.js +10 -0
  97. package/dist/collection/components/utils/api/getZonosSettings.js +7 -1
  98. package/dist/collection/components/utils/checkout/form/helpers.js +95 -0
  99. package/dist/collection/components/utils/checkout/form/isValidZip.js +18 -0
  100. package/dist/collection/components/utils/iframe/CheckoutAddressService.js +193 -0
  101. package/dist/collection/components/utils/iframe/IframeHelpers.js +86 -0
  102. package/dist/collection/components/utils/mergeAddress.js +5 -0
  103. package/dist/collection/constants/phone-formats.js +658 -0
  104. package/dist/collection/scripts/_getCartInfoById.js +7 -1
  105. package/dist/collection/scripts/_zonosBase.js +7 -0
  106. package/dist/collection/types/CountryFields.js +1 -0
  107. package/dist/collection/types/checkout/form/CustomAddressErrors.js +1 -0
  108. package/dist/collection/types/generated/graphql.frontend.types.js +9 -0
  109. package/dist/collection/types/generated/graphql.internal.types.js +96 -0
  110. package/dist/collection/types/index.js +0 -1
  111. package/dist/esm/{cart-3fb04f1f.js → cart-4725a63b.js} +3209 -10
  112. package/dist/esm/debounce-3cf0793c.js +355 -0
  113. package/dist/esm/{getBorderRadius-ada3ccad.js → getBorderRadius-a9a48f79.js} +1 -1
  114. package/dist/esm/getGenericSettingsOverride-0bc3e118.js +99 -0
  115. package/dist/esm/helpers-2f6955b1.js +97 -0
  116. package/dist/esm/{index-d82f06f2.js → index-a457c60c.js} +15 -3
  117. package/dist/esm/index.js +19 -8
  118. package/dist/esm/{isDarkColor-446fccb7.js → isDarkColor-62cbddb5.js} +1 -1
  119. package/dist/esm/loader.js +3 -3
  120. package/dist/esm/{paypal-1f2e863c.js → paypal-a09943f4.js} +3 -3
  121. package/dist/esm/zonos-address_11.entry.js +7903 -0
  122. package/dist/esm/zonos-badge.entry.js +2 -2
  123. package/dist/esm/zonos-banner.entry.js +2 -2
  124. package/dist/esm/zonos-button_3.entry.js +18 -7
  125. package/dist/esm/zonos-card.entry.js +3 -3
  126. package/dist/esm/zonos-cart-items_13.entry.js +113 -21
  127. package/dist/esm/zonos-checkout.entry.js +9 -7
  128. package/dist/esm/zonos-collapse.entry.js +2 -2
  129. package/dist/esm/zonos-component.entry.js +2 -2
  130. package/dist/esm/zonos-controller.entry.js +225 -7
  131. package/dist/esm/zonos-country-flag.entry.js +5 -5
  132. package/dist/esm/zonos-country-select_4.entry.js +10 -10
  133. package/dist/esm/zonos-elements.js +3 -3
  134. package/dist/esm/zonos-empty-state-payment_4.entry.js +8 -8
  135. package/dist/esm/zonos-hello-dialog.entry.js +9 -9
  136. package/dist/esm/zonos-hello.entry.js +6 -357
  137. package/dist/esm/zonos-input.entry.js +3 -3
  138. package/dist/esm/zonos-language-select_2.entry.js +5 -5
  139. package/dist/esm/zonos-link.entry.js +1 -1
  140. package/dist/esm/zonos-logo.entry.js +2 -2
  141. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  142. package/dist/esm/zonos-stripe-input.entry.js +31 -12
  143. package/dist/esm/zonos-text.entry.js +2 -2
  144. package/dist/esm/zonos-toggle.entry.js +4 -4
  145. package/dist/esm/zonos-tooltip.entry.js +3 -3
  146. package/dist/esm/zonos-v-stack.entry.js +4 -4
  147. package/dist/esm/{zonosStore-d3c5a0a5.js → zonosStore-1ce34e04.js} +2 -1
  148. package/dist/esm-es5/cart-4725a63b.js +1 -0
  149. package/dist/esm-es5/debounce-3cf0793c.js +1 -0
  150. package/dist/esm-es5/{getBorderRadius-ada3ccad.js → getBorderRadius-a9a48f79.js} +1 -1
  151. package/dist/esm-es5/getGenericSettingsOverride-0bc3e118.js +1 -0
  152. package/dist/esm-es5/helpers-2f6955b1.js +1 -0
  153. package/dist/esm-es5/index-a457c60c.js +2 -0
  154. package/dist/esm-es5/index.js +1 -1
  155. package/dist/esm-es5/{isDarkColor-446fccb7.js → isDarkColor-62cbddb5.js} +1 -1
  156. package/dist/esm-es5/loader.js +1 -1
  157. package/dist/esm-es5/{paypal-1f2e863c.js → paypal-a09943f4.js} +1 -1
  158. package/dist/esm-es5/zonos-address_11.entry.js +1 -0
  159. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  160. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  161. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  162. package/dist/esm-es5/zonos-card.entry.js +1 -1
  163. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  164. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  165. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  166. package/dist/esm-es5/zonos-component.entry.js +1 -1
  167. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  168. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  169. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  170. package/dist/esm-es5/zonos-elements.js +1 -1
  171. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  172. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  173. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  174. package/dist/esm-es5/zonos-input.entry.js +1 -1
  175. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  176. package/dist/esm-es5/zonos-link.entry.js +1 -1
  177. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  178. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  179. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  180. package/dist/esm-es5/zonos-text.entry.js +1 -1
  181. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  182. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  183. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  184. package/dist/esm-es5/{zonosStore-d3c5a0a5.js → zonosStore-1ce34e04.js} +1 -1
  185. package/dist/scripts/index.d.ts +3985 -3371
  186. package/dist/scripts/index.js +1 -1
  187. package/dist/scripts/loadZonos.js +1 -1
  188. package/dist/scripts/zonos.js +1 -1
  189. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +4 -0
  190. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +28 -1
  191. package/dist/types/components/common/zonos-button/zonos-button.d.ts +4 -0
  192. package/dist/types/components/common/zonos-checkbox/zonos-checkbox.d.ts +1 -0
  193. package/dist/types/components/common/zonos-stripe-input/zonos-stripe-input.d.ts +22 -0
  194. package/dist/types/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.d.ts +88 -0
  195. package/dist/types/components/common/zonos-stripe-select/zonos-stripe-select.d.ts +86 -0
  196. package/dist/types/components/main/zonos-controller.d.ts +1 -0
  197. package/dist/types/components/store/checkout/stripe.d.ts +9 -0
  198. package/dist/types/components/store/translationStore/strings.arabic.d.ts +159 -0
  199. package/dist/types/components/store/translationStore/strings.base.d.ts +159 -0
  200. package/dist/types/components/store/translationStore/strings.chinese.d.ts +159 -0
  201. package/dist/types/components/store/translationStore/strings.danish.d.ts +159 -0
  202. package/dist/types/components/store/translationStore/strings.dutch.d.ts +159 -0
  203. package/dist/types/components/store/translationStore/strings.french.d.ts +159 -0
  204. package/dist/types/components/store/translationStore/strings.german.d.ts +159 -0
  205. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +159 -0
  206. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +159 -0
  207. package/dist/types/components/store/translationStore/strings.italian.d.ts +159 -0
  208. package/dist/types/components/store/translationStore/strings.japanese.d.ts +159 -0
  209. package/dist/types/components/store/translationStore/strings.korean.d.ts +159 -0
  210. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +159 -0
  211. package/dist/types/components/store/translationStore/strings.polish.d.ts +159 -0
  212. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +159 -0
  213. package/dist/types/components/store/translationStore/strings.russian.d.ts +159 -0
  214. package/dist/types/components/store/translationStore/strings.spanish.d.ts +159 -0
  215. package/dist/types/components/store/translationStore/strings.swedish.d.ts +159 -0
  216. package/dist/types/components/store/translationStore/strings.turkish.d.ts +159 -0
  217. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +159 -0
  218. package/dist/types/components/store/zonosStore.d.ts +6 -1
  219. package/dist/types/components/stripe/zonos-custom-address/zonos-address-suggestions/zonos-address-suggestions.d.ts +38 -0
  220. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +150 -0
  221. package/dist/types/components/utils/api/getGenericSettingsOverride.d.ts +5 -0
  222. package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
  223. package/dist/types/components/utils/api/getZonosSettings.d.ts +2 -2
  224. package/dist/types/components/utils/checkout/form/helpers.d.ts +19 -0
  225. package/dist/types/components/utils/checkout/form/isValidZip.d.ts +5 -0
  226. package/dist/types/components/utils/iframe/CheckoutAddressService.d.ts +38 -0
  227. package/dist/types/components/utils/iframe/IframeHelpers.d.ts +81 -0
  228. package/dist/types/components/utils/mergeAddress.d.ts +4 -0
  229. package/dist/types/components/utils/resetToSelectedTab.d.ts +1 -1
  230. package/dist/types/components.d.ts +472 -4
  231. package/dist/types/constants/phone-formats.d.ts +5 -0
  232. package/dist/types/environment.d.ts +1 -1
  233. package/dist/types/scripts/_zonosBase.d.ts +13 -1
  234. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +1 -0
  235. package/dist/types/types/CountryFields.d.ts +40 -0
  236. package/dist/types/types/checkout/form/CustomAddressErrors.d.ts +13 -0
  237. package/dist/types/types/generated/graphql.frontend.types.d.ts +164 -1
  238. package/dist/types/types/generated/graphql.frontend.types.ts +145 -1
  239. package/dist/types/types/generated/graphql.internal.types.d.ts +127 -0
  240. package/dist/types/types/generated/graphql.internal.types.ts +155 -0
  241. package/dist/types/types/global.d.ts +1 -0
  242. package/dist/types/types/index.d.ts +1 -1
  243. package/dist/types/types/utils/ZonosSettings.d.ts +17 -0
  244. package/dist/zonos-elements/index.esm.js +1 -1
  245. package/dist/zonos-elements/{p-4622cca6.entry.js → p-0104d3ba.entry.js} +1 -1
  246. package/dist/zonos-elements/{p-7cb87ea7.system.entry.js → p-04303b56.system.entry.js} +1 -1
  247. package/dist/zonos-elements/p-06f798ee.system.js +1 -0
  248. package/dist/zonos-elements/{p-739014f8.system.entry.js → p-0fdd7034.system.entry.js} +1 -1
  249. package/dist/zonos-elements/p-15dd7ea4.system.entry.js +1 -0
  250. package/dist/zonos-elements/{p-a1cfbd0a.js → p-17299200.js} +1 -1
  251. package/dist/zonos-elements/{p-58f660d4.system.entry.js → p-1b29bc5f.system.entry.js} +1 -1
  252. package/dist/zonos-elements/{p-fe2c27c4.entry.js → p-1e612c29.entry.js} +1 -1
  253. package/dist/zonos-elements/{p-98aa88b1.js → p-2097fae5.js} +1 -1
  254. package/dist/zonos-elements/{p-81084be5.system.entry.js → p-240ee490.system.entry.js} +1 -1
  255. package/dist/zonos-elements/p-2416aaa1.system.entry.js +1 -0
  256. package/dist/zonos-elements/{p-cedf08f0.entry.js → p-313ef896.entry.js} +1 -1
  257. package/dist/zonos-elements/{p-fa65b53d.entry.js → p-314fbfe1.entry.js} +1 -1
  258. package/dist/zonos-elements/{p-5187ba8f.system.js → p-31e90130.system.js} +1 -1
  259. package/dist/zonos-elements/{p-4ca666ea.system.entry.js → p-341f40c2.system.entry.js} +1 -1
  260. package/dist/zonos-elements/{p-d49c6a3e.system.entry.js → p-35f33601.system.entry.js} +1 -1
  261. package/dist/zonos-elements/p-4160bbc2.system.js +1 -0
  262. package/dist/zonos-elements/p-43633269.system.js +2 -0
  263. package/dist/zonos-elements/p-443b5db2.entry.js +1 -0
  264. package/dist/zonos-elements/p-46d3e378.system.entry.js +1 -0
  265. package/dist/zonos-elements/{p-3d221556.system.entry.js → p-488ad646.system.entry.js} +1 -1
  266. package/dist/zonos-elements/p-53ffdb91.js +1 -0
  267. package/dist/zonos-elements/p-56b56caa.system.entry.js +1 -0
  268. package/dist/zonos-elements/p-5e15616f.entry.js +1 -0
  269. package/dist/zonos-elements/{p-3eac4b10.entry.js → p-5f896e9a.entry.js} +1 -1
  270. package/dist/zonos-elements/{p-e8c70c7d.system.entry.js → p-609c32a3.system.entry.js} +1 -1
  271. package/dist/zonos-elements/p-64ea232c.system.entry.js +1 -0
  272. package/dist/zonos-elements/{p-f378b4d3.system.entry.js → p-678ccc3f.system.entry.js} +1 -1
  273. package/dist/zonos-elements/{p-8048932d.entry.js → p-67b904c2.entry.js} +1 -1
  274. package/dist/zonos-elements/p-6b40da70.system.js +1 -0
  275. package/dist/zonos-elements/p-70d4d436.entry.js +1 -0
  276. package/dist/zonos-elements/{p-64dbc282.entry.js → p-818d6f17.entry.js} +1 -1
  277. package/dist/zonos-elements/{p-b5b9aa6c.entry.js → p-81ee1683.entry.js} +1 -1
  278. package/dist/zonos-elements/{p-236f32c8.system.entry.js → p-89fcd305.system.entry.js} +1 -1
  279. package/dist/zonos-elements/{p-c4fa8524.system.entry.js → p-94a80d93.system.entry.js} +1 -1
  280. package/dist/zonos-elements/p-961620ae.entry.js +1 -0
  281. package/dist/zonos-elements/{p-4eff2f8a.system.entry.js → p-98e4a965.system.entry.js} +1 -1
  282. package/dist/zonos-elements/{p-5bebcfc2.system.js → p-9913c186.system.js} +1 -1
  283. package/dist/zonos-elements/{p-29e8c9e8.system.entry.js → p-991c85f1.system.entry.js} +1 -1
  284. package/dist/zonos-elements/p-995761ea.system.entry.js +1 -0
  285. package/dist/zonos-elements/p-9a6eb099.entry.js +1 -0
  286. package/dist/zonos-elements/p-9a7a9b1c.entry.js +1 -0
  287. package/dist/zonos-elements/{p-d367c9ae.system.entry.js → p-9f7b9d66.system.entry.js} +1 -1
  288. package/dist/zonos-elements/p-a2dab25e.system.entry.js +1 -0
  289. package/dist/zonos-elements/{p-587568b5.entry.js → p-aaff5dcc.entry.js} +1 -1
  290. package/dist/zonos-elements/{p-3731e7f5.entry.js → p-abc66a0b.entry.js} +1 -1
  291. package/dist/zonos-elements/{p-eb294265.entry.js → p-aca3a2bb.entry.js} +1 -1
  292. package/dist/zonos-elements/p-afa34aff.system.js +1 -0
  293. package/dist/zonos-elements/{p-69f84611.entry.js → p-b2241919.entry.js} +1 -1
  294. package/dist/zonos-elements/p-b5edee66.system.js +1 -0
  295. package/dist/zonos-elements/p-b610f70c.system.js +1 -0
  296. package/dist/zonos-elements/{p-69255ed2.system.js → p-bbbaea3a.system.js} +1 -1
  297. package/dist/zonos-elements/p-c137dc82.js +2 -0
  298. package/dist/zonos-elements/{p-be9e1818.system.entry.js → p-c140a0bd.system.entry.js} +1 -1
  299. package/dist/zonos-elements/{p-de221545.entry.js → p-cf6ae7dc.entry.js} +1 -1
  300. package/dist/zonos-elements/{p-90633d63.entry.js → p-d0f4b6c3.entry.js} +1 -1
  301. package/dist/zonos-elements/{p-112aecac.js → p-de462b9b.js} +2 -2
  302. package/dist/zonos-elements/{p-107b08c1.entry.js → p-e5d081d8.entry.js} +1 -1
  303. package/dist/zonos-elements/p-e7b0c156.js +1 -0
  304. package/dist/zonos-elements/{p-30fdcbee.js → p-e892fb29.js} +1 -1
  305. package/dist/zonos-elements/p-e90cb997.entry.js +1 -0
  306. package/dist/zonos-elements/{p-db3f381d.entry.js → p-e91b244c.entry.js} +1 -1
  307. package/dist/zonos-elements/{p-41dfc828.entry.js → p-e99354d5.entry.js} +1 -1
  308. package/dist/zonos-elements/p-ea6d87a1.system.js +1 -0
  309. package/dist/zonos-elements/p-eef5b0cc.js +1 -0
  310. package/dist/zonos-elements/{p-d0944cc8.system.entry.js → p-f3f27bf2.system.entry.js} +1 -1
  311. package/dist/zonos-elements/{p-0e63259c.system.entry.js → p-f4cc688e.system.entry.js} +1 -1
  312. package/dist/zonos-elements/{p-cc6d9f7d.entry.js → p-f7d3e48b.entry.js} +1 -1
  313. package/dist/zonos-elements/p-fa6de0f3.js +1 -0
  314. package/dist/zonos-elements/{p-c5c8f803.system.entry.js → p-fd348fd4.system.entry.js} +1 -1
  315. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  316. package/dist/zonos-elements/zonos-elements.js +1 -1
  317. package/package.json +3 -1
  318. package/dist/cjs/zonos-address_7.cjs.entry.js +0 -772
  319. package/dist/esm/zonos-address_7.entry.js +0 -762
  320. package/dist/esm-es5/cart-3fb04f1f.js +0 -1
  321. package/dist/esm-es5/index-d82f06f2.js +0 -2
  322. package/dist/esm-es5/zonos-address_7.entry.js +0 -1
  323. package/dist/zonos-elements/p-09041efe.entry.js +0 -1
  324. package/dist/zonos-elements/p-16e4cdb1.entry.js +0 -1
  325. package/dist/zonos-elements/p-43feb95e.entry.js +0 -1
  326. package/dist/zonos-elements/p-46f6e5e9.system.js +0 -1
  327. package/dist/zonos-elements/p-4caffd96.system.js +0 -2
  328. package/dist/zonos-elements/p-642bf613.system.entry.js +0 -1
  329. package/dist/zonos-elements/p-6c0c8722.system.entry.js +0 -1
  330. package/dist/zonos-elements/p-7decb19b.entry.js +0 -1
  331. package/dist/zonos-elements/p-829f6a40.entry.js +0 -1
  332. package/dist/zonos-elements/p-8f640b28.entry.js +0 -1
  333. package/dist/zonos-elements/p-a69dbe14.js +0 -1
  334. package/dist/zonos-elements/p-ab68ad11.js +0 -2
  335. package/dist/zonos-elements/p-b1020237.system.js +0 -1
  336. package/dist/zonos-elements/p-bc0f885e.system.entry.js +0 -1
  337. package/dist/zonos-elements/p-c6d96a42.system.js +0 -1
  338. package/dist/zonos-elements/p-ce853f8f.system.entry.js +0 -1
  339. package/dist/zonos-elements/p-d5d39db4.system.entry.js +0 -1
  340. package/dist/zonos-elements/p-e4f8114a.system.js +0 -1
  341. package/dist/zonos-elements/p-e99e75dd.system.entry.js +0 -1
  342. package/dist/zonos-elements/p-f66a5c7c.system.entry.js +0 -1
  343. package/dist/zonos-elements/p-febb90e0.entry.js +0 -1
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),o=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"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>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 l(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 d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=()=>{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}},g=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],f=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(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}},v=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,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"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await f({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await f({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:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},b=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),c=await v({basePathType:i,options:o,path:n}),{errors:d,response:u}=c,f=l(c,["errors","response"]),S=performance.now()-a;t(`${n} (${S.toFixed(2)}ms)`,"info");const z=null==u?void 0:u.headers.get("Zonos-Duration");200===(null==u?void 0:u.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(g.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=y(),a="object"==typeof i.userAgent&&i.userAgent.mobile,c={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||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 l;window.Zonos.loadTimeApiInfoList.push(c)})({apiPath:n,apiType:i,loadTimeInternal:z?Number(z):0,loadTimeTotal:S});const C=w(i),O=!!d.find((({type:e})=>"unknown"===e))||404===(null==u?void 0:u.status),j=C&&O;return O&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){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},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:C,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==u?void 0:u.status,statusText:null==u?void 0:u.statusText},shouldPostReleaseErrorReporting:!0}),j?(t(`=== "${n}" failed to fetch, trying next fallback ${C}`),b({basePathType:C,options:o,path:n})):Object.assign({errors:d,response:u},f)},S=async(e,o)=>{const t=l(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":a()?"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}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return b({basePathType:d||u,options:i,path:e})},z=()=>{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),n="https://v1.3.184.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.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";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' 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})),r},C="https://js.stripe.com/v3",O=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,j="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let Z=null;const k=e=>(null!==Z||(Z=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(j),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${C}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&O.test(t.src))return t}return null})();r&&e?console.warn(j):r||(r=(e=>{const o=document.createElement("script");o.src=`${C}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),Z),A=Promise.resolve().then((()=>k(null)));let I=!1;A.catch((e=>{I||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s,zonosMode:i}=await S("/api/zonos-elements/get-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),a=!s||r.length;return a&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):a?null:Object.assign(Object.assign({},s),{zonosMode:i})},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${E.source}$`),$=new RegExp(`^cart_${E.source}$`),N=/^[a-zA-Z0-9]{2,}$/,D=/^cart_[a-zA-Z0-9]{2,}$/,P=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await T({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,window.Zonos.zonosMode=s.zonosMode,{cartData:s.cartData,settings:s.settings,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const F=(()=>{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})(),R="https://v1.3.184.js.zonos.com",M=F||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.184",x="https://fonts.googleapis.com",B=/^https:\/\/fonts\.googleapis\.com/;class q{}U=q,q.doneInit=!1,q.cartSettings=null,q.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),q.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),q._paypalMockResponse=null,q.isBigCommerce=!1,q.releaseDate="1745332640034",q.isLegacyCheckout=!1,q.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",q.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),q.isNpm=!0,q.zonosQaUrl=null,q.zonosQaUrlApi=null,q.trackEventLogs=[],q.version="v1.3.184",q.modeAlerted=!1,q.cartData=null,q.paypal=null,q.zonosMode=null,q.getCurrentTimestamp=()=>(new Date).getTime(),q.zonosController=null,q.loadTimeApiInfoList=[],q.logIntervalId=null,q.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=z();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await P(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey,U.cartSettings=e.settings}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await S("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("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)}t("init zonos"),U.restoreNativeBrowserFunctions(),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},q.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},q.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},q.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},q.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},q.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},q.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)}},q.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)},q.injectController=({config:e})=>{var o,r;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(r=e.checkoutSettings)||void 0===r?void 0:r.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=e,s.zonosApiKey=U.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const r=await(async(...e)=>{I=!0;const o=Date.now();return A.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),U.zonosController=s,t("Zonos controller injected!")},q.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},q.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return M;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.184";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.184";case"vercel":return R}};if(U.isNpm){return z()||o()}return o()},q.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},q.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${R}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},q.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},q.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${x}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!B.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=x,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${x}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},q.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},q.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${x}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=x,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=q})();
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 void("error"===o&&console.error(e,...l));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"},h=w[m],y=(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}}},z=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 C=y(i),O=!!d.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),j=C&&O;return O&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{if(r("sendErrorLog","warn",e,t,o),n){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(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();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:C,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()),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 ${C}`),z({basePathType:C,options:o,path:t})):Object.assign({errors:d,response:c},p)},C=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 z({basePathType:a||m,options:i,path:e})},O=()=>{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.3.185.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.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";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},j="https://js.stripe.com/v3",Z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,k="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let A=null;const I=e=>(null!==A||(A=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(k),window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${j}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&Z.test(t.src))return t}return null})();n&&e?console.warn(k):n||(n=(e=>{const o=document.createElement("script");o.src=`${j}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(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)}))),A),E=Promise.resolve().then((()=>I(null)));let T=!1;E.catch((e=>{T||console.warn(e)}));const 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=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:l}=await C(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:t,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),d=!a||i.length;return d&&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})):d?null:Object.assign(Object.assign({},a),{zonosMode:l})},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}$`),U=new RegExp(`^cart_${P.source}$`),N=/^[a-zA-Z0-9]{2,}$/,D=/^cart_[a-zA-Z0-9]{2,}$/,F=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:U.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)};var R;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})(),x="https://v1.3.185.js.zonos.com",B=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.185",q="https://fonts.googleapis.com",W=/^https:\/\/fonts\.googleapis\.com/;class K{}R=K,K.doneInit=!1,K.cartSettings=null,K.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),K.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),K._paypalMockResponse=null,K.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,K.isBigCommerce=!1,K.releaseDate="1745528358769",K.isLegacyCheckout=!1,K.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",K.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),K.overrideUseCustomAddressForm=!1,K.isNpm=!0,K.zonosQaUrl=null,K.zonosQaUrlApi=null,K.trackEventLogs=[],K.version="v1.3.185",K.modeAlerted=!1,K.cartData=null,K.paypal=null,K.zonosMode=null,K.IframeService=o,K.getCurrentTimestamp=()=>(new Date).getTime(),K.zonosController=null,K.loadTimeApiInfoList=[],K.logIntervalId=null,K.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(R.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),R.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${R.version}) ======`),R.zonosApiKey=p,R.storeId=u,R.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=O();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=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!R.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!R.cartData&&R.cartId){r("Initialize cart data");const e=await F(R.cartId);if(!e)return void s("Failed to get cart data");R.cartData=e.cartData,R.zonosApiKey=e.zonosApiKey,R.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 C("/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&&(R.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(R.cartId&&R.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"),R.restoreNativeBrowserFunctions(),R.injectCustomScriptForHostedCheckout(),R.injectZonosCdn(),R.injectZonosCss(),R.injectFonts(),R.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),R.doneInit=!0},K.injectCustomScriptForHostedCheckout=()=>{const e=R.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})},K.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},K.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},K.showNotification=e=>{var o;null===(o=R.zonosController)||void 0===o||o.showNotification(e)},K.updateOrganizationName=e=>{var o;null===(o=R.zonosController)||void 0===o||o.updateOrganizationName(e)},K.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)}},K.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)},K.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;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.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;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.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=R.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{T=!0;const o=Date.now();return E.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);t?(window.Zonos.stripe=t,n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),R.zonosController=n,r("Zonos controller injected!")},K.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${R.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&&R.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},K.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return B;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.185";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.185";case"vercel":return x}};if(R.isNpm){return O()||o()}return o()},K.injectZonosCdn=()=>{R.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),R.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},K.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=R.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${x}/`,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&&R.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},K.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(R.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},K.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${q}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!W.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=q,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${q}/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!")},K.setupGoogleFont=e=>{var o;null===(o=R.zonosController)||void 0===o||o.setupGoogleFont(e)},K.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^="${q}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=q,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=K})();
@@ -1 +1 @@
1
- (function(){"use strict";function o(o,e){var n={};for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&e.indexOf(t)<0&&(n[t]=o[t]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(o);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(o,t[r])&&(n[t[r]]=o[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=()=>window.location.search.includes("zonosStagingMode=1"),n=()=>{var o;return(null===(o=window.Zonos.zonosApiKey)||void 0===o?void 0:o.includes("test"))||window.location.search.includes("zonosTestMode=1")},t=["cloudflare","vercel"],r=t[0],s={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},i=s[r],a=(o=r)=>{const e=t.indexOf(o),n=t[e+1];return n||null},d=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},l=performance.now(),c=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},p=(o,e,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-l,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));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(e){case"warn":d.warn(o,...i);break;case"info":d.info(o,...i);break;case"error":d.error(o,...i);break;default:d.groupCollapsed(o,...i),d.trace(),d.groupEnd()}},u=()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n},w=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],m=({apiPath:o,apiType:e,loadTimeInternal:n,loadTimeTotal:t})=>{if(w.includes(o))return;const r=t-n;if(r<0)return;const s=o.split("?")[0]||o,i=(()=>{const o="userAgentData"in window.navigator?window.navigator.userAgentData:null,e=u();return{connectionDownlink:null==e?void 0:e.downlink,connectionEffectiveType:null==e?void 0:e.effectiveType,connectionRtt:null==e?void 0:e.rtt,connectionSaveData:null==e?void 0:e.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:o&&o.brands.length>0?o:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:e,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((o=>o.brand)).filter((o=>!/Not.*A.*Brand.*/.test(o))).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},g=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(p("sendErrorLog","warn",o,n,e),t){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,d={endpoint:o,errors:e,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(`${i}/api/zonos-elements/log-error`,{body:JSON.stringify(d),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=a();if(!e)return;fetch(`${s[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(d),method:"POST"})}},f=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=d(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},y=async({basePathType:o,options:e,path:n})=>{let t;const i=window.Zonos.zonosQaUrlApi||s[o]||r,a=new URL(i+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{t=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.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 l=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:i,errors:[],json:await f({response:t}),response:t,zonosMode:l}}const p=t.status.toString();try{const o=await f({response:t,shouldThrow:!0});if(o&&"errors"in o&&Array.isArray(o.errors)){const e=o.errors;return{baseUrl:i,errors:e.map((o=>"string"==typeof o?{message:o,type:p}:o)),json:null,response:t,zonosMode:l}}return{baseUrl:i,errors:[{message:JSON.stringify(o),type:p}],json:null,response:t,zonosMode:l}}catch(o){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:l}}},h=async({basePathType:e,options:n,path:t})=>{var r,i;const l=t.startsWith("/api/bigcommerce")?"vercel":e,c=performance.now(),u=await y({basePathType:l,options:n,path:t}),{errors:w,response:f}=u,v=o(u,["errors","response"]),Z=performance.now()-c;p(`${t} (${Z.toFixed(2)}ms)`,"info");const z=null==f?void 0:f.headers.get("Zonos-Duration");200===(null==f?void 0:f.status)&&m({apiPath:t,apiType:l,loadTimeInternal:z?Number(z):0,loadTimeTotal:Z});const S=a(l),b=!!w.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),O=S&&b;return b&&g({endpoint:s[l]+t,errors:w.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:l,nextFallbackApiType:S,requestHeaders:null==n?void 0:n.headers,requestPayload:d(null===(r=null==n?void 0:n.body)||void 0===r?void 0:r.toString())||(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),O?(p(`=== "${t}" failed to fetch, trying next fallback ${S}`),h({basePathType:S,options:n,path:t})):Object.assign({errors:w,response:f},v)},v=async(t,s)=>{const i=o(s||{},[]),a=i.body?JSON.stringify(i.body):void 0,d=i.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":e()?"1":void 0,"Zonos-Test-Mode":n()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},i.headers);Object.keys(l).forEach((o=>void 0===l[o]&&delete l[o]));const c=Object.assign(Object.assign({},i),{body:"GET"===d?void 0:a,headers:l,method:d}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return h({basePathType:p||r,options:c,path:t})},Z=(o,...e)=>{p(o,"error",...e)},z=["jsdelivr","cdnjs","unpkg","vercel"],S=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},b=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,O=new RegExp(`^${b.source}$`),L=new RegExp(`^cart_${b.source}$`),I=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,A=o=>o?o.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:I.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:O.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},C=async({cartId:o,retries:e})=>{const t=n(),{errors:r,json:s,zonosMode:i}=await v("/api/zonos-elements/get-cart",{body:{isTestMode:t,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),a=!s||r.length;return a&&e?(p("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),C({cartId:o,retries:e-1})):a?null:Object.assign(Object.assign({},s),{zonosMode:i})};var U;const k=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=S(window.location.href),n="https://v1.3.184.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const t=`https://${e}.preview.js.zonos.com`;return p(`[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 o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),j=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=S(window.location.href),n=o||e;if(!n&&["dev.demo.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(!o)return null;const t=`https://${o}.route.js.zonos.com`;return p(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})();class ${}U=$,$.isNpm=!1,$.isBigCommerce=!1,$.requested=!1,$.zonosMode=null,$.cartData=null,$.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,$.version="v1.3.184",$.isLegacyCheckout=!1,$.legacyStoreLogo=null,$.legacyStoreFavicon=null,$.parallelLoadTimes=[],$.parallelLoadState="off",$.releaseDate="1745332640034",$.loadTimeApiInfoList=[],$.cartSettings=null,$.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(r)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},t)))}catch(o){}},$.loadScriptLogParallelHandler=async o=>{try{if(U.parallelLoadTimes.push(o),2===U.parallelLoadTimes.length){const o=U.parallelLoadTimes.find((o=>"vercel"===o.type)),e=U.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void g({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});U.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},$.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{Z(`[ZONOS - loadZonos] ${o}`),g({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:U.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},$.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.184";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.184":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.184");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},$.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;e=Object.assign(Object.assign({},e),{zonosApiKey:U.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===o?t:U.getGithubCdn({type:o,version:r}),a=k||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()}`,p(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const w="4g"===(null===(s=u())||void 0===s?void 0:s.effectiveType),m=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),f=z[0]===o,y=z[1],h="on"===U.parallelLoadState&&w&&f&&y&&!m;h&&U.injectZonos({cdnType:y,initConfig:e,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();l.addEventListener("load",(()=>{if(h||n?U.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:U.storeId,type:o}):U.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:U.storeId,type:o}),U.isBigCommerce||(U.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=k,window.Zonos.zonosQaUrlApi=j,window.Zonos.zonosMode=U.zonosMode,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.loadTimeApiInfoList=U.loadTimeApiInfoList,U.cartId){if(!U.zonosApiKey)throw U.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!U.cartData)throw U.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(U.legacyStoreFavicon&&U.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=U.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=U.cartData,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.cartSettings=U.cartSettings;const o=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:U.legacyStoreLogo||""}),zonosApiKey:U.zonosApiKey});e=o}window.Zonos.version&&(p(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(e))})),l.addEventListener("error",(async()=>{const s=(o=>{const e=z.indexOf(o);return z[e+1]||null})(o);if(!h&&!n){if(!s)return;U.injectZonos({cdnType:s,initConfig:e,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||k)return;if(h||n)return void U.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:l.src,storeId:U.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?g({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):g({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(l)},$.init=async o=>{var t;if(p("=== Init zonos script release date","info",U.releaseDate),k&&!window.isZonosPreview){p(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${k}`,"info");const e=document.createElement("script");return e.src=`${k}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${k}`)})),void(window.isZonosPreview=!0)}const r=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:s,isLegacyCartId:i}=A(r);if(r&&!i&&!s)return void U.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${r}`,metadata:{invalidCartId:!0}});U.cartId=r;const a="https://v1.3.184.js.zonos.com",d=document.querySelector('script[src*="/zonos.js"]'),l=null===(t=document.querySelector("script[src*='/loadZonos.js']"))||void 0===t?void 0:t.src;p(`[ZONOS - init] first load script src: ${l}`,"info"),window.Zonos.zonosQaUrl=k,window.Zonos.zonosQaUrlApi=j,window.Zonos.zonosQaUrl&&p(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&p(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==l?void 0:l.includes("timestamp=");if(!(U.isNpm||l&&c))return void Z("[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(d||!l||U.requested)return void p("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!U.cartId)return U.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void Z("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(U.requested=!0,U.zonosApiKey=o.zonosApiKey,U.storeId=o.storeId,U.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=A(o);if(!n&&!e)return Z("[ZONOS - loadZonos] invalid cart id"),null;const t=await C({cartId:o,retries:5});return p("[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}):(Z("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(U.cartId);if(!o)throw U.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");U.cartData=o.cartData,U.cartSettings=o.settings,U.legacyStoreLogo=o.storeLogo,U.legacyStoreFavicon=o.storeFavicon,U.storeId=o.storeId,U.zonosApiKey=o.zonosApiKey}if(!U.zonosApiKey)return void Z('"zonosApiKey" is required to initialize Zonos');const u=await(async()=>{const o=n(),t=e();if(!o&&!t||!window.Zonos.zonosApiKey)return null;if(p("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return p("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return Z("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(p(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(Z("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(u&&(p(`[ZONOS - loadZonos] Using test API key: ${u} for test mode`,"info"),U.zonosApiKey=u),!U.storeId)return p("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void U.injectZonos({initConfig:o,vercelUrl:a,version:null});const w=U.storeId||o.storeId;p(`[ZONOS - loadZonos] Store ID: ${w}`,"info");const m=new URLSearchParams;m.set("storeId",w.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&m.set("_enableStoreVersionPinned","1");const{errors:g,json:f}=await v(`/api/get-store-version?${m.toString()}`);if(g.length||!f)return p("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void U.injectZonos({initConfig:o,vercelUrl:a,version:null});const{isDifferent:y,source:h,version:z}=f;if(p(`[ZONOS - loadZonos] Store version: ${z}, source: ${h}`,"info"),y){p(`[ZONOS - loadZonos] Updating saved store version to ${z}`,"info");const o={storeId:w,version:z};v(`/api/set-store-version?${m.toString()}`,{body:o,method:"POST"}).catch((o=>Z("Unable to save store's vesrion",o)))}if(!d){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),t=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:l}),r=t&&!n?e:`${"alpha"===z?"alpha":`v${z}`}.js.zonos.com`,s=t&&!n?null:z;p("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:z}),U.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=$)})();
1
+ (function(){"use strict";function o(o,e){var n={};for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&e.indexOf(t)<0&&(n[t]=o[t]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(o);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(o,t[r])&&(n[t[r]]=o[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=()=>window.location.search.includes("zonosStagingMode=1"),n=()=>{var o;return(null===(o=window.Zonos.zonosApiKey)||void 0===o?void 0:o.includes("test"))||window.location.search.includes("zonosTestMode=1")},t=["cloudflare","vercel"],r=t[0],s={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},i=s[r],a=(o=r)=>{const e=t.indexOf(o),n=t[e+1];return n||null},d=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},l=performance.now(),c=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},u=(o,e,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-l,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));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(e){case"warn":d.warn(o,...i);break;case"info":d.info(o,...i);break;case"error":d.error(o,...i);break;default:d.groupCollapsed(o,...i),d.trace(),d.groupEnd()}},p=()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n},m=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],w=({apiPath:o,apiType:e,loadTimeInternal:n,loadTimeTotal:t})=>{if(m.includes(o))return;const r=t-n;if(r<0)return;const s=o.split("?")[0]||o,i=(()=>{const o="userAgentData"in window.navigator?window.navigator.userAgentData:null,e=p();return{connectionDownlink:null==e?void 0:e.downlink,connectionEffectiveType:null==e?void 0:e.effectiveType,connectionRtt:null==e?void 0:e.rtt,connectionSaveData:null==e?void 0:e.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:o&&o.brands.length>0?o:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:e,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((o=>o.brand)).filter((o=>!/Not.*A.*Brand.*/.test(o))).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},g=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(u("sendErrorLog","warn",o,n,e),t){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,d={endpoint:o,errors:e,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(`${i}/api/zonos-elements/log-error`,{body:JSON.stringify(d),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=a();if(!e)return;fetch(`${s[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(d),method:"POST"})}},f=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=d(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},y=async({basePathType:o,options:e,path:n})=>{let t;const i=window.Zonos.zonosQaUrlApi||s[o]||r,a=new URL(i+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{t=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.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 l=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&l&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:i,errors:[],json:await f({response:t}),response:t,zonosMode:l}}const u=t.status.toString();try{const o=await f({response:t,shouldThrow:!0});if(o&&"errors"in o&&Array.isArray(o.errors)){const e=o.errors;return{baseUrl:i,errors:e.map((o=>"string"==typeof o?{message:o,type:u}:o)),json:null,response:t,zonosMode:l}}return{baseUrl:i,errors:[{message:JSON.stringify(o),type:u}],json:null,response:t,zonosMode:l}}catch(o){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:l}}},h=async({basePathType:e,options:n,path:t})=>{var r,i;const l=t.startsWith("/api/bigcommerce")?"vercel":e,c=performance.now(),p=await y({basePathType:l,options:n,path:t}),{errors:m,response:f}=p,v=o(p,["errors","response"]),Z=performance.now()-c;u(`${t} (${Z.toFixed(2)}ms)`,"info");const S=null==f?void 0:f.headers.get("Zonos-Duration");200===(null==f?void 0:f.status)&&w({apiPath:t,apiType:l,loadTimeInternal:S?Number(S):0,loadTimeTotal:Z});const z=a(l),b=!!m.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),L=z&&b;return b&&g({endpoint:s[l]+t,errors:m.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:l,nextFallbackApiType:z,requestHeaders:null==n?void 0:n.headers,requestPayload:d(null===(r=null==n?void 0:n.body)||void 0===r?void 0:r.toString())||(null===(i=null==n?void 0:n.body)||void 0===i?void 0:i.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),L?(u(`=== "${t}" failed to fetch, trying next fallback ${z}`),h({basePathType:z,options:n,path:t})):Object.assign({errors:m,response:f},v)},v=async(t,s)=>{const i=o(s||{},[]),a=i.body?JSON.stringify(i.body):void 0,d=i.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":e()?"1":void 0,"Zonos-Test-Mode":n()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},i.headers);Object.keys(l).forEach((o=>void 0===l[o]&&delete l[o]));const c=Object.assign(Object.assign({},i),{body:"GET"===d?void 0:a,headers:l,method:d}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return h({basePathType:u||r,options:c,path:t})},Z=(o,...e)=>{u(o,"error",...e)},S=["jsdelivr","cdnjs","unpkg","vercel"],z=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},b=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${b.source}$`),O=new RegExp(`^cart_${b.source}$`),I=/^[a-zA-Z0-9]{2,}$/,A=/^cart_[a-zA-Z0-9]{2,}$/,C=o=>o?o.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:A.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:I.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:O.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},T=async({cartId:o,retries:e})=>{const t=n(),r=(()=>{const o=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":o.get("overrideShouldEnabledCustomAddress")}})(),s=new URLSearchParams;r.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:d}=await v(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:t,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),l=!a||i.length;return l&&e?(u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),T({cartId:o,retries:e-1})):l?null:Object.assign(Object.assign({},a),{zonosMode:d})};var U;const k=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=z(window.location.href),n="https://v1.3.185.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const t=`https://${e}.preview.js.zonos.com`;return u(`[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 o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),j=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=z(window.location.href),n=o||e;if(!n&&["dev.demo.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(!o)return null;const t=`https://${o}.route.js.zonos.com`;return u(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})();class E{}U=E,E.isNpm=!1,E.isBigCommerce=!1,E.requested=!1,E.zonosMode=null,E.cartData=null,E.overrideUseCustomAddressForm=!1,E.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,E.version="v1.3.185",E.isLegacyCheckout=!1,E.legacyStoreLogo=null,E.legacyStoreFavicon=null,E.parallelLoadTimes=[],E.parallelLoadState="off",E.releaseDate="1745528358769",E.loadTimeApiInfoList=[],E.cartSettings=null,E.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(r)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},t)))}catch(o){}},E.loadScriptLogParallelHandler=async o=>{try{if(U.parallelLoadTimes.push(o),2===U.parallelLoadTimes.length){const o=U.parallelLoadTimes.find((o=>"vercel"===o.type)),e=U.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void g({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});U.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},E.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{Z(`[ZONOS - loadZonos] ${o}`),g({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:U.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},E.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.185";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.185":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.185");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},E.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;e=Object.assign(Object.assign({},e),{zonosApiKey:U.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===o?t:U.getGithubCdn({type:o,version:r}),a=k||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()}`,u(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const m="4g"===(null===(s=p())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),f=S[0]===o,y=S[1],h="on"===U.parallelLoadState&&m&&f&&y&&!w;h&&U.injectZonos({cdnType:y,initConfig:e,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();l.addEventListener("load",(()=>{if(h||n?U.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:U.storeId,type:o}):U.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:l.src,storeId:U.storeId,type:o}),U.isBigCommerce||(U.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=k,window.Zonos.zonosQaUrlApi=j,window.Zonos.zonosMode=U.zonosMode,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.loadTimeApiInfoList=U.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=U.overrideUseCustomAddressForm,U.cartId){if(!U.zonosApiKey)throw U.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!U.cartData)throw U.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(U.legacyStoreFavicon&&U.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=U.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=U.cartData,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.cartSettings=U.cartSettings;const o=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:U.legacyStoreLogo||""}),zonosApiKey:U.zonosApiKey});e=o}window.Zonos.version&&(u(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(e))})),l.addEventListener("error",(async()=>{const s=(o=>{const e=S.indexOf(o);return S[e+1]||null})(o);if(!h&&!n){if(!s)return;U.injectZonos({cdnType:s,initConfig:e,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||k)return;if(h||n)return void U.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:l.src,storeId:U.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?g({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):g({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(l)},E.init=async o=>{var t;if(u("=== Init zonos script release date","info",U.releaseDate),k&&!window.isZonosPreview){u(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${k}`,"info");const e=document.createElement("script");return e.src=`${k}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${k}`)})),void(window.isZonosPreview=!0)}const r=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:s,isLegacyCartId:i}=C(r);if(r&&!i&&!s)return void U.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${r}`,metadata:{invalidCartId:!0}});U.cartId=r;const a="https://v1.3.185.js.zonos.com",d=document.querySelector('script[src*="/zonos.js"]'),l=null===(t=document.querySelector("script[src*='/loadZonos.js']"))||void 0===t?void 0:t.src;u(`[ZONOS - init] first load script src: ${l}`,"info"),window.Zonos.zonosQaUrl=k,window.Zonos.zonosQaUrlApi=j,window.Zonos.zonosQaUrl&&u(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&u(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==l?void 0:l.includes("timestamp=");if(!(U.isNpm||l&&c))return void Z("[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(d||!l||U.requested)return void u("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!U.cartId)return U.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void Z("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(U.requested=!0,U.zonosApiKey=o.zonosApiKey,U.storeId=o.storeId,U.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=C(o);if(!n&&!e)return Z("[ZONOS - loadZonos] invalid cart id"),null;const t=await T({cartId:o,retries:5});return u("[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}):(Z("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(U.cartId);if(!o)throw U.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");U.cartData=o.cartData,U.cartSettings=o.settings,U.legacyStoreLogo=o.storeLogo,U.legacyStoreFavicon=o.storeFavicon,U.storeId=o.storeId,U.zonosApiKey=o.zonosApiKey}if(!U.zonosApiKey)return void Z('"zonosApiKey" is required to initialize Zonos');const p=await(async()=>{const o=n(),t=e();if(!o&&!t||!window.Zonos.zonosApiKey)return null;if(u("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return Z("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(u(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(Z("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(p&&(u(`[ZONOS - loadZonos] Using test API key: ${p} for test mode`,"info"),U.zonosApiKey=p),!U.storeId)return u("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void U.injectZonos({initConfig:o,vercelUrl:a,version:null});const m=U.storeId||o.storeId;u(`[ZONOS - loadZonos] Store ID: ${m}`,"info");const w=new URLSearchParams;w.set("storeId",m.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&w.set("_enableStoreVersionPinned","1");const{errors:g,json:f}=await v(`/api/get-store-version?${w.toString()}`);if(g.length||!f)return u("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void U.injectZonos({initConfig:o,vercelUrl:a,version:null});const{isDifferent:y,source:h,version:S}=f;if(u(`[ZONOS - loadZonos] Store version: ${S}, source: ${h}`,"info"),y){u(`[ZONOS - loadZonos] Updating saved store version to ${S}`,"info");const o={storeId:m,version:S};v(`/api/set-store-version?${w.toString()}`,{body:o,method:"POST"}).catch((o=>Z("Unable to save store's vesrion",o)))}if(!d){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),t=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:l}),r=t&&!n?e:`${"alpha"===S?"alpha":`v${S}`}.js.zonos.com`,s=t&&!n?null:S;u("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:S}),U.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=E)})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),o=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"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>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 l(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 d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=()=>{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}},g=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],f=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(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}},v=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,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"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await f({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await f({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:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},b=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),c=await v({basePathType:i,options:o,path:n}),{errors:d,response:u}=c,f=l(c,["errors","response"]),S=performance.now()-a;t(`${n} (${S.toFixed(2)}ms)`,"info");const z=null==u?void 0:u.headers.get("Zonos-Duration");200===(null==u?void 0:u.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(g.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=y(),a="object"==typeof i.userAgent&&i.userAgent.mobile,c={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||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 l;window.Zonos.loadTimeApiInfoList.push(c)})({apiPath:n,apiType:i,loadTimeInternal:z?Number(z):0,loadTimeTotal:S});const C=w(i),O=!!d.find((({type:e})=>"unknown"===e))||404===(null==u?void 0:u.status),Z=C&&O;return O&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){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},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:C,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==u?void 0:u.status,statusText:null==u?void 0:u.statusText},shouldPostReleaseErrorReporting:!0}),Z?(t(`=== "${n}" failed to fetch, trying next fallback ${C}`),b({basePathType:C,options:o,path:n})):Object.assign({errors:d,response:u},f)},S=async(e,o)=>{const t=l(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":a()?"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}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return b({basePathType:d||u,options:i,path:e})},z=()=>{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),n="https://v1.3.184.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.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";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' 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})),r},C="https://js.stripe.com/v3",O=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Z="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let j=null;const k=e=>(null!==j||(j=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(Z),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${C}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&O.test(t.src))return t}return null})();r&&e?console.warn(Z):r||(r=(e=>{const o=document.createElement("script");o.src=`${C}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),j),I=Promise.resolve().then((()=>k(null)));let A=!1;I.catch((e=>{A||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s,zonosMode:i}=await S("/api/zonos-elements/get-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),a=!s||r.length;return a&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):a?null:Object.assign(Object.assign({},s),{zonosMode:i})},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,L=new RegExp(`^${E.source}$`),$=new RegExp(`^cart_${E.source}$`),N=/^[a-zA-Z0-9]{2,}$/,D=/^cart_[a-zA-Z0-9]{2,}$/,P=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:$.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:L.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await T({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,window.Zonos.zonosMode=s.zonosMode,{cartData:s.cartData,settings:s.settings,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const F=(()=>{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})(),R="https://v1.3.184.js.zonos.com",M=F||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.184",x="https://fonts.googleapis.com",B=/^https:\/\/fonts\.googleapis\.com/;class q{}U=q,q.doneInit=!1,q.cartSettings=null,q.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),q.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),q._paypalMockResponse=null,q.isBigCommerce=!1,q.releaseDate="1745332640034",q.isLegacyCheckout=!1,q.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",q.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),q.isNpm=!0,q.zonosQaUrl=null,q.zonosQaUrlApi=null,q.trackEventLogs=[],q.version="v1.3.184",q.modeAlerted=!1,q.cartData=null,q.paypal=null,q.zonosMode=null,q.getCurrentTimestamp=()=>(new Date).getTime(),q.zonosController=null,q.loadTimeApiInfoList=[],q.logIntervalId=null,q.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=z();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await P(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey,U.cartSettings=e.settings}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await S("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("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)}t("init zonos"),U.restoreNativeBrowserFunctions(),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},q.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},q.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},q.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},q.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},q.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},q.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)}},q.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)},q.injectController=({config:e})=>{var o,r;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(r=e.checkoutSettings)||void 0===r?void 0:r.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=e,s.zonosApiKey=U.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const r=await(async(...e)=>{A=!0;const o=Date.now();return I.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),U.zonosController=s,t("Zonos controller injected!")},q.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},q.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return M;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.184";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.184";case"vercel":return R}};if(U.isNpm){return z()||o()}return o()},q.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},q.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${R}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},q.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},q.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${x}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!B.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=x,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${x}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},q.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},q.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${x}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=x,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=q)})();
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 void("error"===o&&console.error(e,...l));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"},h=w[m],y=(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}}},z=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 C=y(i),O=!!d.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),Z=C&&O;return O&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{if(r("sendErrorLog","warn",e,t,o),n){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(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=y();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:C,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()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),Z?(r(`=== "${t}" failed to fetch, trying next fallback ${C}`),z({basePathType:C,options:o,path:t})):Object.assign({errors:d,response:c},p)},C=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 z({basePathType:a||m,options:i,path:e})},O=()=>{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.3.185.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.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";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",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,k="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let A=null;const I=e=>(null!==A||(A=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(k),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&&j.test(t.src))return t}return null})();n&&e?console.warn(k):n||(n=(e=>{const o=document.createElement("script");o.src=`${Z}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(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)}))),A),E=Promise.resolve().then((()=>I(null)));let T=!1;E.catch((e=>{T||console.warn(e)}));const 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=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:l}=await C(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:t,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),d=!a||i.length;return d&&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})):d?null:Object.assign(Object.assign({},a),{zonosMode:l})},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}$`),U=new RegExp(`^cart_${P.source}$`),N=/^[a-zA-Z0-9]{2,}$/,D=/^cart_[a-zA-Z0-9]{2,}$/,F=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:U.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)};var R;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})(),x="https://v1.3.185.js.zonos.com",B=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.185",q="https://fonts.googleapis.com",W=/^https:\/\/fonts\.googleapis\.com/;class K{}R=K,K.doneInit=!1,K.cartSettings=null,K.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),K.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),K._paypalMockResponse=null,K.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,K.isBigCommerce=!1,K.releaseDate="1745528358769",K.isLegacyCheckout=!1,K.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",K.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),K.overrideUseCustomAddressForm=!1,K.isNpm=!0,K.zonosQaUrl=null,K.zonosQaUrlApi=null,K.trackEventLogs=[],K.version="v1.3.185",K.modeAlerted=!1,K.cartData=null,K.paypal=null,K.zonosMode=null,K.IframeService=o,K.getCurrentTimestamp=()=>(new Date).getTime(),K.zonosController=null,K.loadTimeApiInfoList=[],K.logIntervalId=null,K.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(R.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),R.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${R.version}) ======`),R.zonosApiKey=p,R.storeId=u,R.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=O();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=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!R.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!R.cartData&&R.cartId){r("Initialize cart data");const e=await F(R.cartId);if(!e)return void s("Failed to get cart data");R.cartData=e.cartData,R.zonosApiKey=e.zonosApiKey,R.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 C("/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&&(R.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(R.cartId&&R.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"),R.restoreNativeBrowserFunctions(),R.injectCustomScriptForHostedCheckout(),R.injectZonosCdn(),R.injectZonosCss(),R.injectFonts(),R.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),R.doneInit=!0},K.injectCustomScriptForHostedCheckout=()=>{const e=R.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})},K.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},K.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},K.showNotification=e=>{var o;null===(o=R.zonosController)||void 0===o||o.showNotification(e)},K.updateOrganizationName=e=>{var o;null===(o=R.zonosController)||void 0===o||o.updateOrganizationName(e)},K.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)}},K.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)},K.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;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.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;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{R.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=R.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{T=!0;const o=Date.now();return E.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);t?(window.Zonos.stripe=t,n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),R.zonosController=n,r("Zonos controller injected!")},K.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${R.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&&R.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},K.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return B;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.185";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.185";case"vercel":return x}};if(R.isNpm){return O()||o()}return o()},K.injectZonosCdn=()=>{R.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),R.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},K.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=R.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${x}/`,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&&R.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},K.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(R.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},K.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${q}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!W.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=q,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${q}/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!")},K.setupGoogleFont=e=>{var o;null===(o=R.zonosController)||void 0===o||o.setupGoogleFont(e)},K.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^="${q}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=q,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!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=K)})();
@@ -18,6 +18,10 @@ export declare class ZonosCheckout {
18
18
  * Preview checkout without needing to click on the button. This would be useful for demo purpose
19
19
  */
20
20
  preview: boolean;
21
+ /**
22
+ * Hidden mode to hide the checkout modal in preview mode
23
+ */
24
+ hiddenMode: boolean;
21
25
  /**
22
26
  * Flag to determine if the checkout is on mobile
23
27
  */
@@ -1,4 +1,5 @@
1
1
  import { type EventEmitter } from '../../../../stencil-public-runtime';
2
+ import type { StripeAddressElementChangeEvent } from '@stripe/stripe-js';
2
3
  import { type StripeStoreContactOption } from "../../../store/checkout/stripe";
3
4
  import { containsNonLatinChars } from "../../../utils/containsNonLatinChars";
4
5
  export declare class ZonosCustomerInfo {
@@ -23,10 +24,26 @@ export declare class ZonosCustomerInfo {
23
24
  * Default address to use for the checkout (preview mode)
24
25
  */
25
26
  defaultAddress: StripeStoreContactOption[];
27
+ /**
28
+ * Whether to override custom address form to be always visible
29
+ */
30
+ shouldUseCustomAddressFormOverride: boolean;
26
31
  /**
27
32
  * Event to emit when the continue button is clicked
28
33
  */
29
- continueClicked: EventEmitter<void>;
34
+ continueClicked: EventEmitter<{
35
+ billingAddress: StripeAddressElementChangeEvent | null;
36
+ sameAsBilling: boolean;
37
+ shippingAddress: StripeAddressElementChangeEvent | null;
38
+ }>;
39
+ /**
40
+ * Trigger continue button click even though fields're not validated for testing purposes
41
+ */
42
+ testContinueClicked?: EventEmitter<{
43
+ billingAddress: StripeAddressElementChangeEvent | null;
44
+ sameAsBilling: boolean;
45
+ shippingAddress: StripeAddressElementChangeEvent | null;
46
+ }>;
30
47
  /**
31
48
  * Due to Stripe's validation difficulties, we need to show a banner when users hasn't filled out the form correctly but clicked continue
32
49
  */
@@ -53,10 +70,15 @@ export declare class ZonosCustomerInfo {
53
70
  * Handler for the dialog close button
54
71
  */
55
72
  openAddressValidationDialog: boolean;
73
+ /**
74
+ * Whether or not the custom address form is enabled
75
+ */
76
+ shouldEnabledCustomAddress: boolean;
56
77
  /**
57
78
  * Handler for the email error state
58
79
  */
59
80
  isEmailError: boolean;
81
+ watchShowErrorBanner(): void;
60
82
  private checkInvalidCharacters;
61
83
  /**
62
84
  * Handler for invalid characters in the address
@@ -67,6 +89,10 @@ export declare class ZonosCustomerInfo {
67
89
  * handler for continue button click
68
90
  */
69
91
  private continueClickHandler;
92
+ /**
93
+ * Validate the custom address form, turn the flag showError to false if the form is valid, or vice versa
94
+ */
95
+ private validateCustomAddressForm;
70
96
  private handleValidate;
71
97
  private handleEmailValidation;
72
98
  private prepareAddressObject;
@@ -75,5 +101,6 @@ export declare class ZonosCustomerInfo {
75
101
  * Render tax id input based on ship to country code
76
102
  */
77
103
  private renderTaxIdInput;
104
+ private renderAddressComponent;
78
105
  render(): any;
79
106
  }
@@ -2,6 +2,10 @@ import type { ElementsUiStyle, ElementsUiTheme } from "../../../types/generated/
2
2
  import type { Color } from "../../../types/styles/Color";
3
3
  export declare class ZonosButton {
4
4
  ele: HTMLZonosButtonElement;
5
+ /**
6
+ * Inherited attributes from the host element
7
+ */
8
+ private inheritedAttributes;
5
9
  /**
6
10
  * The color of the button text and svg
7
11
  */
@@ -3,6 +3,7 @@ import type { ElementsUiStyle } from "../../../types/generated/graphql.internal.
3
3
  import type { CheckboxColorPrefix } from "../../../types/styles/Color";
4
4
  import type { Size } from "../../../types/styles/Text";
5
5
  export declare class ZonosCheckbox {
6
+ private inputId;
6
7
  /**
7
8
  * background color of the checkbox
8
9
  */
@@ -3,6 +3,19 @@
3
3
  */
4
4
  export declare class ZonosStripeInput {
5
5
  el: HTMLZonosStripeInputElement;
6
+ /**
7
+ * Inherited attributes from the host element
8
+ */
9
+ private inheritedAttributes;
10
+ private inputId;
11
+ /**
12
+ * Name of the input
13
+ */
14
+ name?: string;
15
+ /**
16
+ * Autocomplete attribute for the input
17
+ */
18
+ autoComplete?: string;
6
19
  /**
7
20
  * Value of the stripeInput
8
21
  */
@@ -27,6 +40,10 @@ export declare class ZonosStripeInput {
27
40
  * Error state of the input
28
41
  */
29
42
  isError: boolean;
43
+ /**
44
+ * Error message of the input
45
+ */
46
+ error?: string;
30
47
  /**
31
48
  * Placeholder for the input
32
49
  */
@@ -39,8 +56,13 @@ export declare class ZonosStripeInput {
39
56
  * Event to emit when input value changes
40
57
  */
41
58
  private inputChange;
59
+ /**
60
+ * Whether the input is required
61
+ */
62
+ required?: boolean;
42
63
  internalValue: string;
43
64
  onInputValueChange(newValue: string): void;
44
65
  onValueChange(newValue: string): void;
66
+ componentWillLoad(): void;
45
67
  render(): any;
46
68
  }
@@ -0,0 +1,88 @@
1
+ import { type EventEmitter } from '../../../stencil-public-runtime';
2
+ import type { CountryFields } from "../../../types/CountryFields";
3
+ import type { CountryCode } from "../../../types/generated/graphql.internal.types";
4
+ import type { GenericZonosSettings } from "../../../types/utils/ZonosSettings";
5
+ export declare class ZonosStripePhoneInput {
6
+ el: HTMLZonosStripePhoneInputElement;
7
+ private inputRef?;
8
+ /**
9
+ * The phone number formatter
10
+ */
11
+ private asYouType;
12
+ private inputId;
13
+ /**
14
+ * Inherited attributes from the host element
15
+ */
16
+ private inheritedAttributes;
17
+ /**
18
+ * The autoComplete attribute for the phone input
19
+ */
20
+ autoComplete: string;
21
+ /**
22
+ * Available country options for the select dropdown
23
+ */
24
+ countryOptions: GenericZonosSettings['countryFields'] | null;
25
+ /**
26
+ * Whether the input is disabled
27
+ */
28
+ disabled: boolean;
29
+ /**
30
+ * Error message to display
31
+ */
32
+ error?: string;
33
+ /**
34
+ * Label text for the input
35
+ */
36
+ inputLabel?: string;
37
+ /**
38
+ * Override the primary color
39
+ */
40
+ overridePrimaryColor?: string;
41
+ /**
42
+ * Override the secondary color
43
+ */
44
+ overrideSecondaryColor?: string;
45
+ /**
46
+ * Current value of the phone input
47
+ */
48
+ inputValue?: string;
49
+ /**
50
+ * The country code of the phone input
51
+ */
52
+ countryCode: CountryCode | null;
53
+ /**
54
+ * Minimum width of the phone input
55
+ */
56
+ minWidth?: string;
57
+ selectedCountry: CountryFields | undefined;
58
+ phoneNumber: string;
59
+ isFocused: boolean;
60
+ isSelectOpen: boolean;
61
+ /**
62
+ * Emitted when the country or phone number changes
63
+ */
64
+ inputValueChange: EventEmitter<{
65
+ countryCode: CountryCode | null;
66
+ isEmpty: boolean;
67
+ phoneNumber: string;
68
+ valid: boolean;
69
+ wrongFormat: boolean;
70
+ }>;
71
+ onCountryOptionsChange(): void;
72
+ onSelectedCountryChange(): void;
73
+ onPhoneNumberChange(): void;
74
+ private validatePhoneNumber;
75
+ /**
76
+ * Update the phone formatter to use the new country code
77
+ */
78
+ private updatePhoneFormatter;
79
+ private handleCountryChange;
80
+ private handlePhoneChange;
81
+ private handleFocus;
82
+ private handleBlur;
83
+ private isCountryCode;
84
+ private initPhoneNumberValue;
85
+ componentWillLoad(): void;
86
+ componentDidLoad(): void;
87
+ render(): any;
88
+ }