@zonos/elements 1.3.223 → 1.3.225

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 (272) hide show
  1. package/dist/cjs/VarianceTest-bec00ea8.js +91 -0
  2. package/dist/cjs/{cart-3a2a062c.js → cart-af017ac3.js} +41 -40
  3. package/dist/cjs/{debounce-465a4328.js → debounce-2c9f3f1e.js} +1 -1
  4. package/dist/cjs/{getBorderRadius-1b5e33cf.js → getBorderRadius-c7d9f676.js} +1 -1
  5. package/dist/cjs/{handleFetch-45f35cac.js → handleFetch-954f30e1.js} +5 -82
  6. package/dist/cjs/index.cjs.js +40 -37
  7. package/dist/cjs/{isDarkColor-428965f4.js → isDarkColor-994c38e4.js} +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{localization-12e7e934.js → localization-21030292.js} +82 -24
  10. package/dist/cjs/{paypal-a1377508.js → paypal-2b22f0f5.js} +17 -16
  11. package/dist/cjs/{placeTestOrder-6fcce33e.js → placeTestOrder-9cde1ca4.js} +3 -3
  12. package/dist/cjs/{renderFallback-39ba034b.js → renderFallback-9300dbaf.js} +8 -7
  13. package/dist/cjs/{translationStore-951ed4b4.js → translationStore-ce2c700d.js} +1 -1
  14. package/dist/cjs/{updateCheckoutSessionAttributes-c0853fdd.js → updateCheckoutSessionAttributes-a4899e90.js} +2 -2
  15. package/dist/cjs/zonos-address_11.cjs.entry.js +54 -33
  16. package/dist/cjs/zonos-badge.cjs.entry.js +2 -2
  17. package/dist/cjs/zonos-banner_2.cjs.entry.js +3 -3
  18. package/dist/cjs/zonos-button_3.cjs.entry.js +4 -4
  19. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +25 -25
  20. package/dist/cjs/zonos-checkout.cjs.entry.js +68 -67
  21. package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +8 -8
  23. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +19 -19
  24. package/dist/cjs/zonos-collect.cjs.entry.js +20 -20
  25. package/dist/cjs/zonos-confirm-dialog_2.cjs.entry.js +4 -4
  26. package/dist/cjs/zonos-controller.cjs.entry.js +40 -39
  27. package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
  28. package/dist/cjs/zonos-country-select_4.cjs.entry.js +6 -6
  29. package/dist/cjs/zonos-elements.cjs.js +1 -1
  30. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +14 -14
  31. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  32. package/dist/cjs/zonos-hello.cjs.entry.js +12 -12
  33. package/dist/cjs/zonos-input.cjs.entry.js +3 -3
  34. package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
  35. package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
  36. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +3 -3
  37. package/dist/cjs/zonos-stripe-input.cjs.entry.js +5 -5
  38. package/dist/cjs/zonos-text.cjs.entry.js +2 -2
  39. package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
  40. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  41. package/dist/cjs/{zonosStore-f8ee56aa.js → zonosStore-5d489c65.js} +8 -2
  42. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +4 -0
  43. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +1 -0
  44. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +1 -0
  45. package/dist/collection/components/main/zonos-controller.js +1 -1
  46. package/dist/collection/components/store/hello/localization.js +12 -9
  47. package/dist/collection/components/store/zonosStore.js +8 -1
  48. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +41 -18
  49. package/dist/collection/components/utils/api/getZonosSettings.js +2 -0
  50. package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +2 -0
  51. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +5 -0
  52. package/dist/collection/components/utils/logging/sendLoadCheckoutFacadeLog.js +1 -1
  53. package/dist/collection/components/utils/logging/sendLoadNativeCheckoutLog.js +1 -1
  54. package/dist/collection/scripts/_zonosBase.js +3 -0
  55. package/dist/collection/types/generated/graphql.internal.types.js +3 -0
  56. package/dist/collection/utils/performBlurCurrency.js +50 -0
  57. package/dist/esm/VarianceTest-572cecf5.js +86 -0
  58. package/dist/esm/{cart-7f06662c.js → cart-11b87221.js} +7 -6
  59. package/dist/esm/{debounce-c34d1270.js → debounce-f081e4d8.js} +1 -1
  60. package/dist/esm/{getBorderRadius-87593ff4.js → getBorderRadius-6281d902.js} +1 -1
  61. package/dist/esm/{handleFetch-99218189.js → handleFetch-a844cac1.js} +2 -76
  62. package/dist/esm/index.js +13 -9
  63. package/dist/esm/{isDarkColor-1f58b6be.js → isDarkColor-83e0c27e.js} +1 -1
  64. package/dist/esm/loader.js +1 -1
  65. package/dist/esm/{localization-192886e4.js → localization-9320a65d.js} +71 -13
  66. package/dist/esm/{paypal-53f1b4a1.js → paypal-338a4350.js} +7 -6
  67. package/dist/esm/{placeTestOrder-95cbb623.js → placeTestOrder-d28f33c2.js} +3 -3
  68. package/dist/esm/{renderFallback-6352363c.js → renderFallback-28ef3364.js} +5 -4
  69. package/dist/esm/{translationStore-fb98a08d.js → translationStore-7eebaa41.js} +1 -1
  70. package/dist/esm/{updateCheckoutSessionAttributes-92f42882.js → updateCheckoutSessionAttributes-160720f6.js} +2 -2
  71. package/dist/esm/zonos-address_11.entry.js +47 -26
  72. package/dist/esm/zonos-badge.entry.js +2 -2
  73. package/dist/esm/zonos-banner_2.entry.js +3 -3
  74. package/dist/esm/zonos-button_3.entry.js +4 -4
  75. package/dist/esm/zonos-cart-items_12.entry.js +12 -12
  76. package/dist/esm/zonos-checkout.entry.js +15 -14
  77. package/dist/esm/zonos-collapse.entry.js +2 -2
  78. package/dist/esm/zonos-collect-cart-items_3.entry.js +8 -8
  79. package/dist/esm/zonos-collect-finish_6.entry.js +11 -11
  80. package/dist/esm/zonos-collect.entry.js +10 -10
  81. package/dist/esm/zonos-confirm-dialog_2.entry.js +4 -4
  82. package/dist/esm/zonos-controller.entry.js +10 -9
  83. package/dist/esm/zonos-country-flag.entry.js +5 -5
  84. package/dist/esm/zonos-country-select_4.entry.js +6 -6
  85. package/dist/esm/zonos-elements.js +1 -1
  86. package/dist/esm/zonos-empty-state-payment_4.entry.js +9 -9
  87. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  88. package/dist/esm/zonos-hello.entry.js +6 -6
  89. package/dist/esm/zonos-input.entry.js +3 -3
  90. package/dist/esm/zonos-language-select_2.entry.js +5 -5
  91. package/dist/esm/zonos-logo.entry.js +2 -2
  92. package/dist/esm/zonos-shipping-rich-radio.entry.js +3 -3
  93. package/dist/esm/zonos-stripe-input.entry.js +5 -5
  94. package/dist/esm/zonos-text.entry.js +2 -2
  95. package/dist/esm/zonos-toggle.entry.js +2 -2
  96. package/dist/esm/zonos-v-stack.entry.js +2 -2
  97. package/dist/esm/{zonosStore-c456b933.js → zonosStore-e3d0493a.js} +8 -2
  98. package/dist/esm-es5/VarianceTest-572cecf5.js +1 -0
  99. package/dist/esm-es5/cart-11b87221.js +1 -0
  100. package/dist/esm-es5/{debounce-c34d1270.js → debounce-f081e4d8.js} +1 -1
  101. package/dist/esm-es5/{getBorderRadius-87593ff4.js → getBorderRadius-6281d902.js} +1 -1
  102. package/dist/esm-es5/handleFetch-a844cac1.js +1 -0
  103. package/dist/esm-es5/index.js +1 -1
  104. package/dist/esm-es5/{isDarkColor-1f58b6be.js → isDarkColor-83e0c27e.js} +1 -1
  105. package/dist/esm-es5/loader.js +1 -1
  106. package/dist/esm-es5/localization-9320a65d.js +1 -0
  107. package/dist/esm-es5/{paypal-53f1b4a1.js → paypal-338a4350.js} +2 -2
  108. package/dist/esm-es5/{placeTestOrder-95cbb623.js → placeTestOrder-d28f33c2.js} +1 -1
  109. package/dist/esm-es5/renderFallback-28ef3364.js +1 -0
  110. package/dist/esm-es5/{translationStore-fb98a08d.js → translationStore-7eebaa41.js} +1 -1
  111. package/dist/esm-es5/{updateCheckoutSessionAttributes-92f42882.js → updateCheckoutSessionAttributes-160720f6.js} +1 -1
  112. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  113. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  114. package/dist/esm-es5/zonos-banner_2.entry.js +1 -1
  115. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  116. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  117. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  118. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  119. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  120. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  121. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  122. package/dist/esm-es5/zonos-confirm-dialog_2.entry.js +1 -1
  123. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  124. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  125. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  126. package/dist/esm-es5/zonos-elements.js +1 -1
  127. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  128. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  129. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  130. package/dist/esm-es5/zonos-input.entry.js +1 -1
  131. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  132. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  133. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  134. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  135. package/dist/esm-es5/zonos-text.entry.js +1 -1
  136. package/dist/esm-es5/zonos-toggle.entry.js +1 -1
  137. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  138. package/dist/esm-es5/zonosStore-e3d0493a.js +1 -0
  139. package/dist/scripts/blurCurrencyOnInit.js +1 -0
  140. package/dist/scripts/index.d.ts +38 -6
  141. package/dist/scripts/index.js +1 -1
  142. package/dist/scripts/loadZonos.js +1 -1
  143. package/dist/scripts/zonos.js +1 -1
  144. package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +1 -0
  145. package/dist/types/scripts/_zonosBase.d.ts +8 -3
  146. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +7 -3
  147. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +2 -2
  148. package/dist/types/types/generated/graphql.internal.types.d.ts +13 -2
  149. package/dist/types/types/generated/graphql.internal.types.ts +13 -2
  150. package/dist/types/types/global.d.ts +8 -0
  151. package/dist/types/types/utils/ZonosSettings.d.ts +8 -2
  152. package/dist/types/utils/performBlurCurrency.d.ts +2 -0
  153. package/dist/zonos-elements/base.css +1 -0
  154. package/dist/zonos-elements/index.esm.js +1 -1
  155. package/dist/zonos-elements/p-01174496.system.js +1 -0
  156. package/dist/zonos-elements/p-0260fd13.js +1 -0
  157. package/dist/zonos-elements/{p-e970f2aa.system.entry.js → p-04c1dc63.system.entry.js} +1 -1
  158. package/dist/zonos-elements/p-0a377722.js +1 -0
  159. package/dist/zonos-elements/p-0a92e3fd.entry.js +1 -0
  160. package/dist/zonos-elements/{p-8350937d.system.entry.js → p-0b6a3a09.system.entry.js} +1 -1
  161. package/dist/zonos-elements/p-0d82e1fd.entry.js +1 -0
  162. package/dist/zonos-elements/{p-a7485913.system.js → p-0ec82d78.system.js} +2 -2
  163. package/dist/zonos-elements/{p-2b9c124d.js → p-0ffd710e.js} +1 -1
  164. package/dist/zonos-elements/p-112c6453.system.js +1 -0
  165. package/dist/zonos-elements/{p-62fa680d.system.js → p-182da73f.system.js} +1 -1
  166. package/dist/zonos-elements/p-1868a283.entry.js +1 -0
  167. package/dist/zonos-elements/{p-ba18c5f5.system.entry.js → p-1a67ae71.system.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-520bd291.system.entry.js → p-1b9cc0e2.system.entry.js} +1 -1
  169. package/dist/zonos-elements/p-1c5ba523.js +1 -0
  170. package/dist/zonos-elements/p-1ef793d0.entry.js +1 -0
  171. package/dist/zonos-elements/{p-0ed63ce0.system.js → p-23c46dfa.system.js} +1 -1
  172. package/dist/zonos-elements/{p-e7f8595f.system.js → p-24e26a2c.system.js} +1 -1
  173. package/dist/zonos-elements/p-252fa1da.entry.js +1 -0
  174. package/dist/zonos-elements/{p-53b46925.entry.js → p-2616ba72.entry.js} +1 -1
  175. package/dist/zonos-elements/p-2657f099.system.entry.js +1 -0
  176. package/dist/zonos-elements/{p-7d2d2c94.entry.js → p-2dc38ef3.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-12ce9746.system.entry.js → p-360d7101.system.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-19f25feb.system.entry.js → p-375994d1.system.entry.js} +1 -1
  179. package/dist/zonos-elements/{p-ee6f8c02.system.entry.js → p-38f42f10.system.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-4637f365.system.entry.js → p-4004c838.system.entry.js} +1 -1
  181. package/dist/zonos-elements/p-41dd1cb8.js +1 -0
  182. package/dist/zonos-elements/{p-e63b8b24.system.js → p-433d76b4.system.js} +1 -1
  183. package/dist/zonos-elements/{p-a77ed1b9.entry.js → p-4523b982.entry.js} +1 -1
  184. package/dist/zonos-elements/{p-fc27467b.entry.js → p-4ce3489a.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-a61a9b65.system.entry.js → p-4da7b6a8.system.entry.js} +1 -1
  186. package/dist/zonos-elements/{p-7b56e345.js → p-4dfe97ad.js} +2 -2
  187. package/dist/zonos-elements/{p-cd1ebef9.system.js → p-57413c34.system.js} +1 -1
  188. package/dist/zonos-elements/p-5c43ecdf.system.entry.js +1 -0
  189. package/dist/zonos-elements/{p-9fdd3264.system.entry.js → p-5f7a9b69.system.entry.js} +1 -1
  190. package/dist/zonos-elements/p-6092af05.entry.js +1 -0
  191. package/dist/zonos-elements/{p-9b062dfb.entry.js → p-67787bd4.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-7c4e7651.entry.js → p-6bab9096.entry.js} +1 -1
  193. package/dist/zonos-elements/p-6d423364.entry.js +1 -0
  194. package/dist/zonos-elements/p-725605f6.system.js +1 -0
  195. package/dist/zonos-elements/p-7af39c98.js +1 -0
  196. package/dist/zonos-elements/{p-7f7abdf2.system.entry.js → p-7cee0e68.system.entry.js} +1 -1
  197. package/dist/zonos-elements/p-7eb8e2d4.js +1 -0
  198. package/dist/zonos-elements/p-81b357f7.system.js +1 -1
  199. package/dist/zonos-elements/p-820ad058.js +1 -0
  200. package/dist/zonos-elements/{p-5e3d2bd2.system.entry.js → p-873b6185.system.entry.js} +1 -1
  201. package/dist/zonos-elements/p-89c5164b.system.js +1 -0
  202. package/dist/zonos-elements/p-9a09dad4.entry.js +1 -0
  203. package/dist/zonos-elements/{p-245f6ad4.system.entry.js → p-9e03a145.system.entry.js} +1 -1
  204. package/dist/zonos-elements/{p-0ae53ff0.js → p-a199bb13.js} +1 -1
  205. package/dist/zonos-elements/p-ae3e4f2b.entry.js +1 -0
  206. package/dist/zonos-elements/{p-567f7de7.entry.js → p-b4bf2f03.entry.js} +1 -1
  207. package/dist/zonos-elements/p-b5b3f908.system.js +1 -0
  208. package/dist/zonos-elements/{p-a5b0a636.entry.js → p-b658c28a.entry.js} +1 -1
  209. package/dist/zonos-elements/{p-de626806.system.entry.js → p-b6ef4a5e.system.entry.js} +1 -1
  210. package/dist/zonos-elements/{p-4f8563ad.system.entry.js → p-b91df44b.system.entry.js} +1 -1
  211. package/dist/zonos-elements/{p-e8accbef.system.entry.js → p-ba334962.system.entry.js} +1 -1
  212. package/dist/zonos-elements/p-bccd49d7.system.entry.js +1 -0
  213. package/dist/zonos-elements/p-bdeb20cb.js +1 -0
  214. package/dist/zonos-elements/{p-a95d2034.system.entry.js → p-bfc0fc85.system.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-c4b3c878.entry.js → p-c81f6387.entry.js} +1 -1
  216. package/dist/zonos-elements/{p-efa6203f.entry.js → p-c998e4ed.entry.js} +1 -1
  217. package/dist/zonos-elements/{p-9396059b.entry.js → p-cb0e6468.entry.js} +1 -1
  218. package/dist/zonos-elements/{p-421dfb66.system.entry.js → p-cb11d11b.system.entry.js} +1 -1
  219. package/dist/zonos-elements/p-cc599cd9.entry.js +1 -0
  220. package/dist/zonos-elements/{p-14f9bc8c.entry.js → p-d2f7ea09.entry.js} +1 -1
  221. package/dist/zonos-elements/{p-0c0fda23.js → p-d42b5113.js} +1 -1
  222. package/dist/zonos-elements/{p-00423fa0.system.js → p-d531b524.system.js} +1 -1
  223. package/dist/zonos-elements/p-d938f42f.system.js +1 -0
  224. package/dist/zonos-elements/{p-f4fa8720.entry.js → p-d96545ae.entry.js} +1 -1
  225. package/dist/zonos-elements/{p-eb6a35ce.system.entry.js → p-dc56b469.system.entry.js} +1 -1
  226. package/dist/zonos-elements/p-dde6f7fd.system.entry.js +1 -0
  227. package/dist/zonos-elements/{p-45d288d0.system.entry.js → p-e00e5d64.system.entry.js} +1 -1
  228. package/dist/zonos-elements/{p-8194fcd8.entry.js → p-e60b988c.entry.js} +1 -1
  229. package/dist/zonos-elements/{p-56e0ed65.js → p-e688e493.js} +1 -1
  230. package/dist/zonos-elements/p-e9ecb07e.system.js +1 -0
  231. package/dist/zonos-elements/{p-295d9c07.system.entry.js → p-f548807d.system.entry.js} +1 -1
  232. package/dist/zonos-elements/{p-e7b05da2.entry.js → p-f912e9c3.entry.js} +1 -1
  233. package/dist/zonos-elements/zonos-elements.css +1 -1
  234. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  235. package/package.json +4 -3
  236. package/dist/cjs/VarianceTest-0cb1e118.js +0 -12
  237. package/dist/esm/VarianceTest-fef2d958.js +0 -10
  238. package/dist/esm-es5/VarianceTest-fef2d958.js +0 -1
  239. package/dist/esm-es5/cart-7f06662c.js +0 -1
  240. package/dist/esm-es5/handleFetch-99218189.js +0 -1
  241. package/dist/esm-es5/localization-192886e4.js +0 -1
  242. package/dist/esm-es5/renderFallback-6352363c.js +0 -1
  243. package/dist/esm-es5/zonosStore-c456b933.js +0 -1
  244. package/dist/zonos-elements/p-04a01cb1.js +0 -1
  245. package/dist/zonos-elements/p-062430f9.system.js +0 -1
  246. package/dist/zonos-elements/p-0e28207a.js +0 -1
  247. package/dist/zonos-elements/p-1cd1da90.system.js +0 -1
  248. package/dist/zonos-elements/p-2131fa8b.entry.js +0 -1
  249. package/dist/zonos-elements/p-30432622.system.entry.js +0 -1
  250. package/dist/zonos-elements/p-366ea017.entry.js +0 -1
  251. package/dist/zonos-elements/p-3f3c92db.system.entry.js +0 -1
  252. package/dist/zonos-elements/p-4a3abbf2.js +0 -1
  253. package/dist/zonos-elements/p-4d9ad3b1.system.entry.js +0 -1
  254. package/dist/zonos-elements/p-4dcbbd60.js +0 -1
  255. package/dist/zonos-elements/p-5a2dd041.system.js +0 -1
  256. package/dist/zonos-elements/p-640a6898.system.js +0 -1
  257. package/dist/zonos-elements/p-6afbbe66.entry.js +0 -1
  258. package/dist/zonos-elements/p-6cfe66fe.entry.js +0 -1
  259. package/dist/zonos-elements/p-6f6573a5.system.js +0 -1
  260. package/dist/zonos-elements/p-7ce093aa.js +0 -1
  261. package/dist/zonos-elements/p-9d863a3b.system.js +0 -1
  262. package/dist/zonos-elements/p-a435931e.system.entry.js +0 -1
  263. package/dist/zonos-elements/p-a8a312b2.js +0 -1
  264. package/dist/zonos-elements/p-a9b3cfe1.entry.js +0 -1
  265. package/dist/zonos-elements/p-abcefd25.entry.js +0 -1
  266. package/dist/zonos-elements/p-b76db2ac.js +0 -1
  267. package/dist/zonos-elements/p-bbf48b31.entry.js +0 -1
  268. package/dist/zonos-elements/p-bdf183a3.entry.js +0 -1
  269. package/dist/zonos-elements/p-d1b415cd.entry.js +0 -1
  270. package/dist/zonos-elements/p-d2098bef.entry.js +0 -1
  271. package/dist/zonos-elements/p-da200c19.system.js +0 -1
  272. package/dist/zonos-elements/p-df0cbde4.js +0 -1
@@ -1 +1 @@
1
- (function(){"use strict";const e=({id:e,payload:t,target:o,type:n})=>{var r;o instanceof HTMLIFrameElement?null===(r=o.contentWindow)||void 0===r||r.postMessage({id:e,payload:t,type:n},"*"):o.postMessage({id:e,payload:t,type:n},"*")};class t{constructor(t,o){this.targetElement=t,this.targetId=o,this.sendMessage=(t,o)=>{e({id:this.targetId,payload:o,target:this.targetElement,type:t})}}}t.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},t.sendMessage=e,t.injectPrivateIframe=({id:e,onload:t,src:o})=>{const n=document.createElement("iframe");return n.src=o,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=()=>t(n),document.body.appendChild(n),n};const o=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,t,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-o,t=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(t){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,...t)=>{r(e,"error",...t)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const t=i.indexOf(e);return i[t+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,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"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 t=p.indexOf(e),o=p[t+1];return o||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,t=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,t="mozConnection"in window.navigator?window.navigator.mozConnection:null,o="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||t||o})();return{connectionDownlink:null==t?void 0:t.downlink,connectionEffectiveType:null==t?void 0:t.effectiveType,connectionRtt:null==t?void 0:t.rtt,connectionSaveData:null==t?void 0:t.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:t=!0,shouldThrow:o=!1})=>{try{const t=await e.text(),o=g(t);if(!o)throw new Error(`Failed to parse content: ${t}`);return o}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+o),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(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),t)}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 t=e.errors;return{baseUrl:r,errors:t.map((e=>"string"==typeof e?{message:e,type:d}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:t,path:o})=>{var n,s;const i=o.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:t,path:o}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${o} (${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:t,loadTimeInternal:o,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-o;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:t,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:o,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:o,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),O=z&&j;return j&&!Z&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,o,t);{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:t,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},o)};try{fetch(`${h}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=y();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+o,errors:d.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==t?void 0:t.headers,requestPayload:g(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),shouldCallFallback:O,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),O?(r(`=== "${o}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:t,path:o})):Object.assign({errors:d,response:c},p)},z=async(e,t)=>{const o=u(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.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"},o.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),o="https://v1.3.223.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.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:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},Z="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let O=null;const I=e=>(null!==O||(O=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)t(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&j.test(o.src))return o}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(e=>{const t=document.createElement("script");t.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==n||n.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),O),A=Promise.resolve().then((()=>I(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:t})=>{const o=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:o,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&t?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:t-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${L.source}$`),P=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:t,isLegacyCartId:o}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:P.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!o&&!t)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},F="zonos--checkout-hidden-international-button";var R;const M=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),x="https://v1.3.223.js.zonos.com",B=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.223",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="1752091753539",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.isCollect=!1,K.isNpm=!0,K.zonosQaUrl=null,K.zonosQaUrlApi=null,K.trackEventLogs=[],K.version="v1.3.223",K.modeAlerted=!1,K.cartData=null,K.paypal=null,K.zonosMode=null,K.IframeService=t,K.getCurrentTimestamp=()=>(new Date).getTime(),K.zonosController=null,K.loadTimeApiInfoList=[],K.logIntervalId=null,K.init=async e=>{const{appearance:t,checkoutSettings:o,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 t=k();if(t&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${t} ======`,"info");const o=document.createElement("script");return o.src=`${t}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${t}`)})),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 D(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 o=await(async()=>{const e=c(),t=d();if(!e&&!t||!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:o,json:n}=await z("/api/get-test-public-credential");if(o.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),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)})();o&&(R.zonosApiKey=o)}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.injectCheckoutInternationalButton(),R.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),R.doneInit=!0},K.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${F}`)){const e=document.createElement("button");e.id=F,e.style.display="none",document.body.appendChild(e)}},K.injectCustomScriptForHostedCheckout=()=>{const e=R.cartData,t=(null==e?void 0:e.metadata)||[],o=t.find((e=>"customHeaderScript"===e.key)),n=t.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||n)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.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:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},K.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},K.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${F}`);setTimeout((()=>{var t;e&&e.dispatchEvent(new CustomEvent("click",{detail:t}))}),10)},K.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},K.showNotification=e=>{var t;null===(t=R.zonosController)||void 0===t||t.showNotification(e)},K.updateOrganizationName=e=>{var t;null===(t=R.zonosController)||void 0===t||t.updateOrganizationName(e)},K.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.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 t="zonos---native-browser";let o=document.querySelector(`iframe#${t}`);o||(o=document.createElement("iframe"),o.id=t,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const n=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(o)},K.injectController=({config:e})=>{var t,o;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const t=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).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:t}=e;r("loading Stripe");const o=await(async(...e)=>{E=!0;const t=Date.now();return A.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?n.initCollectElement(o):n.initCheckoutElement(o)):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:t,theRestUrl:o})=>{const n=`${R.getZonosUrl(e)}/${o}`;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");t?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:t,theRestUrl:o})},i.appendChild(a)},K.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return B;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.223";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.223";case"vercel":return x}};if(R.isNpm){return k()||t()}return t()},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:t})=>{const o=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=`${o}/${t}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const o=l(e);o&&R.injectStylesheet({cdnType:o,theRestUrl:t})},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 t=0;t<e.length;t++){const o=e[t];if(o&&!W.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=q,e.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${q}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},K.setupGoogleFont=e=>{var t;null===(t=R.zonosController)||void 0===t||t.setupGoogleFont(e)},K.injectSupportGoogleFont=e=>{var t;r(`[FONT] injecting ${e}`);const o=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[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] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${o} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=K)})();
1
+ (function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},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}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map((e=>e.brand)).filter((e=>!/Not.*A.*Brand.*/.test(e))).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=y(i),k=d.find((({type:e})=>"unknown"===e)),Z=d.find((({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted")))),j=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),O=z&&j;return j&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${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:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:O,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),O?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach((e=>void 0===s[e]&&delete s[e]));const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.3.225.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";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\/?(\?.*)?$/;let O=null;const I=e=>(null!==O||(O=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&j.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(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)}))),O),A=Promise.resolve().then((()=>I(null)));let E=!1;A.catch((e=>{E||console.warn(e)}));const T=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),T({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},L=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${L.source}$`),P=new RegExp(`^cart_${L.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,D=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:P.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 T({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},F="zonos--checkout-hidden-international-button";var M;const R=(()=>{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=Date.now(),B="https://v1.3.225.js.zonos.com",q=R||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.225",W="https://fonts.googleapis.com",K=/^https:\/\/fonts\.googleapis\.com/;class G{}M=G,G.doneInit=!1,G.cartSettings=null,G.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),G.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),G._paypalMockResponse=null,G.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,G.isBigCommerce=!1,G.releaseDate="1753286075439",G.isLegacyCheckout=!1,G.startLoadTime=x,G.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",G.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),G.overrideUseCustomAddressForm=!1,G.isCollect=!1,G.isNpm=!0,G.zonosQaUrl=null,G.zonosQaUrlApi=null,G.trackEventLogs=[],G.version="v1.3.225",G.modeAlerted=!1,G.cartData=null,G.paypal=null,G.zonosMode=null,G.IframeService=o,G.getCurrentTimestamp=()=>(new Date).getTime(),G.zonosController=null,G.loadTimeApiInfoList=[],G.logIntervalId=null,G.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(M.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),M.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${M.version}) ======`),M.zonosApiKey=p,M.storeId=u,M.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",(()=>{window.Zonos.isNpm=M.isNpm,window.Zonos.isBigCommerce=M.isBigCommerce,window.Zonos.isLegacyCheckout=M.isLegacyCheckout,window.Zonos.zonosMode=M.zonosMode,window.Zonos.init(e)})),t.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!M.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!M.cartData&&M.cartId){r("Initialize cart data");const e=await D(M.cartId);if(!e)return void s("Failed to get cart data");M.cartData=e.cartData,M.zonosApiKey=e.zonosApiKey,M.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(M.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(M.cartId&&M.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"),M.restoreNativeBrowserFunctions(),M.injectCustomScriptForHostedCheckout(),M.injectZonosCdn(),M.injectZonosCss(),M.injectFonts(),M.injectCheckoutInternationalButton(),M.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),M.doneInit=!0},G.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${F}`)){const e=document.createElement("button");e.id=F,e.style.display="none",document.body.appendChild(e)}},G.injectCustomScriptForHostedCheckout=()=>{const e=M.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})},G.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},G.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${F}`);setTimeout((()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))}),10)},G.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},G.showNotification=e=>{var o;null===(o=M.zonosController)||void 0===o||o.showNotification(e)},G.updateOrganizationName=e=>{var o;null===(o=M.zonosController)||void 0===o||o.updateOrganizationName(e)},G.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)}},G.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)},G.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;M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{M.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;M.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{M.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=M.zonosApiKey||"",n.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;r("loading Stripe");const t=await(async(...e)=>{E=!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);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(n),M.zonosController=n,r("Zonos controller injected!")},G.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${M.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&&M.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},G.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return q;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.225";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.225";case"vercel":return B}};if(M.isNpm){return k()||o()}return o()},G.injectZonosCdn=()=>{M.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),M.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},G.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=M.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${B}/`,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&&M.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},G.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(M.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},G.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${W}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!K.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=W,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${W}/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!")},G.setupGoogleFont=e=>{var o;null===(o=M.zonosController)||void 0===o||o.setupGoogleFont(e)},G.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^="${W}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=W,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=G)})();
@@ -21,6 +21,7 @@ export declare class ZonosLinkAuthentication {
21
21
  stripe: Stripe | null;
22
22
  isStagingMode: boolean;
23
23
  clientSecret: string;
24
+ retriesInitializeLink: number;
24
25
  el: HTMLZonosLinkAuthenticationElement;
25
26
  watchIsStagingMode(): void;
26
27
  watchInitStripe(): Promise<void>;
@@ -180,7 +180,7 @@ export type LoadZonosParamsConfig = {
180
180
  }) => void;
181
181
  };
182
182
  export type LoadZonosParams = LoadZonosParamsConfig & {
183
- storeId: number;
183
+ storeId?: number;
184
184
  /**
185
185
  * If cart id is provided in the url with query param zCartUUID, you don't need to provide zonosApiKey
186
186
  */
@@ -237,7 +237,11 @@ export interface Zonos {
237
237
  * @default false
238
238
  */
239
239
  showBaseForeign: boolean;
240
- storeId: number;
240
+ /**
241
+ * The time that loadZonos.js started to load
242
+ */
243
+ startLoadTime: number;
244
+ storeId?: number;
241
245
  /** Stripe instance */
242
246
  stripe: Stripe;
243
247
  /**
@@ -272,7 +276,7 @@ export interface Zonos {
272
276
  export declare abstract class Zonos {
273
277
  static zonosApiKey?: string;
274
278
  static stripe: Stripe;
275
- static storeId: number;
279
+ static storeId?: number;
276
280
  static doneInit: boolean;
277
281
  static cartSettings: CartCheckoutResult['settings'] | null;
278
282
  static debug: boolean;
@@ -282,6 +286,7 @@ export declare abstract class Zonos {
282
286
  static isBigCommerce: boolean;
283
287
  static releaseDate: string;
284
288
  static isLegacyCheckout: boolean;
289
+ static startLoadTime: number;
285
290
  static domain: string;
286
291
  static showBaseForeign: boolean;
287
292
  static overrideUseCustomAddressForm: boolean;
@@ -71,7 +71,7 @@ export declare const setupCartDataWithSettings: (cartId: string) => Promise<{
71
71
  checkoutSettings: {
72
72
  allowedCharacterSets: import("../../types/generated/graphql.internal.types").AllowedCharacterSets;
73
73
  allowedSettlementCurrencies: import("../../types/generated/graphql.internal.types").AllowedSettlementCurrencies;
74
- successRedirectUrl: string;
74
+ successBehavior: import("../../types/generated/graphql.internal.types").CheckoutSuccessBehavior;
75
75
  captureDelay: number;
76
76
  companyFieldsStatus: import("../../types/generated/graphql.internal.types").CheckoutCompanyFieldsStatus;
77
77
  createdAt: string;
@@ -110,7 +110,7 @@ export declare const setupCartDataWithSettings: (cartId: string) => Promise<{
110
110
  organization: string;
111
111
  placeOrderButtonSelector: string | null;
112
112
  subscriptionStatus: import("../../types/generated/graphql.internal.types").CheckoutSubscriptionStatus;
113
- successBehavior: import("../../types/generated/graphql.internal.types").CheckoutSuccessBehavior;
113
+ successRedirectUrl: string;
114
114
  analyticsProviders: Array<{
115
115
  status: import("../../types/generated/graphql.internal.types").AnalyticsProviderStatus;
116
116
  type: import("../../types/generated/graphql.internal.types").AnalyticsProviderType;
@@ -155,6 +155,10 @@ export declare const setupCartDataWithSettings: (cartId: string) => Promise<{
155
155
  updatedBy: string;
156
156
  visibilityStatus: import("../../types/generated/graphql.internal.types").HelloVisibilityStatus;
157
157
  };
158
+ landedCostSettings: {
159
+ defaultNativeCurrency: import("../../types/generated/graphql.internal.types").CurrencyCode | null;
160
+ landedCostGuarantee: import("../../types/generated/graphql.internal.types").LandedCostGuaranteeType | null;
161
+ };
158
162
  onlineStoreSettings: {
159
163
  allowedDomains: Array<string>;
160
164
  url: string;
@@ -163,7 +167,7 @@ export declare const setupCartDataWithSettings: (cartId: string) => Promise<{
163
167
  shippingZones: Array<{
164
168
  countryCodes: Array<import("../..").CountryCode> | null;
165
169
  } | null> | null;
166
- }, "cart"> & {
170
+ }, "cart"> & import("../../types/generated/graphql.internal.types").LandedCostSettingsQuery & {
167
171
  genericSettings: import("../..").GenericZonosSettings | null;
168
172
  } & {
169
173
  organization: {
@@ -1,4 +1,4 @@
1
- import type { CartAdjustmentType, CartCheckoutWorkflowQuery, CartType, CountryCode, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure } from "../../generated/graphql.internal.types";
1
+ import type { CartAdjustmentType, CartCheckoutWorkflowQuery, CartType, CountryCode, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure, LandedCostSettingsQuery } from "../../generated/graphql.internal.types";
2
2
  import type { GenericZonosSettings } from "../../utils/ZonosSettings";
3
3
  export type NormalizedItemAttribute = {
4
4
  key: string;
@@ -59,7 +59,7 @@ export type NormalizedTempCart = {
59
59
  storeId: number;
60
60
  type: CartType;
61
61
  };
62
- type Settings = Omit<CartCheckoutWorkflowQuery['cartCheckoutWorkflow'], 'cart'> & {
62
+ type Settings = Omit<CartCheckoutWorkflowQuery['cartCheckoutWorkflow'], 'cart'> & LandedCostSettingsQuery & {
63
63
  genericSettings: GenericZonosSettings | null;
64
64
  };
65
65
  export type CartCheckoutResult = {
@@ -2193,6 +2193,7 @@ export declare const landedCostQuoteType: {
2193
2193
  readonly Collect: "COLLECT";
2194
2194
  readonly Hello: "HELLO";
2195
2195
  readonly InclusivePrice: "INCLUSIVE_PRICE";
2196
+ readonly PrepayCollect: "PREPAY_COLLECT";
2196
2197
  };
2197
2198
  export type LandedCostQuoteType = (typeof landedCostQuoteType)[keyof typeof landedCostQuoteType];
2198
2199
  export declare const landedCostTariffRate: {
@@ -2412,6 +2413,8 @@ export declare const orderBillingAdjustmentFeeType: {
2412
2413
  readonly BrokerageFee: "BROKERAGE_FEE";
2413
2414
  readonly Buffer: "BUFFER";
2414
2415
  readonly Cod: "COD";
2416
+ readonly CollectOrder: "COLLECT_ORDER";
2417
+ readonly CollectPercent: "COLLECT_PERCENT";
2415
2418
  readonly Country: "COUNTRY";
2416
2419
  readonly CurrencyConversionFee: "CURRENCY_CONVERSION_FEE";
2417
2420
  readonly DdpServiceFee: "DDP_SERVICE_FEE";
@@ -4118,6 +4121,7 @@ export type GetTaxIdByCountryQuery = {
4118
4121
  };
4119
4122
  export type LandedCostSettingsQuery = {
4120
4123
  landedCostSettings: {
4124
+ defaultNativeCurrency: CurrencyCode | null;
4121
4125
  landedCostGuarantee: LandedCostGuaranteeType | null;
4122
4126
  } | null;
4123
4127
  };
@@ -4448,7 +4452,7 @@ export type CartCheckoutWorkflowQuery = {
4448
4452
  checkoutSettings: {
4449
4453
  allowedCharacterSets: AllowedCharacterSets;
4450
4454
  allowedSettlementCurrencies: AllowedSettlementCurrencies;
4451
- successRedirectUrl: string;
4455
+ successBehavior: CheckoutSuccessBehavior;
4452
4456
  captureDelay: number;
4453
4457
  companyFieldsStatus: CheckoutCompanyFieldsStatus;
4454
4458
  createdAt: string;
@@ -4487,7 +4491,7 @@ export type CartCheckoutWorkflowQuery = {
4487
4491
  organization: string;
4488
4492
  placeOrderButtonSelector: string | null;
4489
4493
  subscriptionStatus: CheckoutSubscriptionStatus;
4490
- successBehavior: CheckoutSuccessBehavior;
4494
+ successRedirectUrl: string;
4491
4495
  analyticsProviders: Array<{
4492
4496
  status: AnalyticsProviderStatus;
4493
4497
  type: AnalyticsProviderType;
@@ -4532,6 +4536,10 @@ export type CartCheckoutWorkflowQuery = {
4532
4536
  updatedBy: string;
4533
4537
  visibilityStatus: HelloVisibilityStatus;
4534
4538
  };
4539
+ landedCostSettings: {
4540
+ defaultNativeCurrency: CurrencyCode | null;
4541
+ landedCostGuarantee: LandedCostGuaranteeType | null;
4542
+ };
4535
4543
  onlineStoreSettings: {
4536
4544
  allowedDomains: Array<string>;
4537
4545
  url: string;
@@ -4634,6 +4642,7 @@ export type GetReceiptCheckoutSessionQuery = {
4634
4642
  } | null;
4635
4643
  createdAt: string;
4636
4644
  id: string;
4645
+ paymentMethods: Array<string> | null;
4637
4646
  paymentProcessor: PaymentProcessorCode;
4638
4647
  paymentStatus: OrderPaymentStatus;
4639
4648
  }> | null;
@@ -4675,6 +4684,7 @@ export type GetReceiptOrderQuery = {
4675
4684
  } | null;
4676
4685
  createdAt: string;
4677
4686
  id: string;
4687
+ paymentMethods: Array<string> | null;
4678
4688
  paymentProcessor: PaymentProcessorCode;
4679
4689
  paymentStatus: OrderPaymentStatus;
4680
4690
  }> | null;
@@ -4711,6 +4721,7 @@ export type ReceiptOrderFragment = {
4711
4721
  } | null;
4712
4722
  createdAt: string;
4713
4723
  id: string;
4724
+ paymentMethods: Array<string> | null;
4714
4725
  paymentProcessor: PaymentProcessorCode;
4715
4726
  paymentStatus: OrderPaymentStatus;
4716
4727
  }> | null;
@@ -2651,6 +2651,7 @@ export const landedCostQuoteType = {
2651
2651
  Collect: 'COLLECT',
2652
2652
  Hello: 'HELLO',
2653
2653
  InclusivePrice: 'INCLUSIVE_PRICE',
2654
+ PrepayCollect: 'PREPAY_COLLECT',
2654
2655
  } as const;
2655
2656
 
2656
2657
  export type LandedCostQuoteType =
@@ -2914,6 +2915,8 @@ export const orderBillingAdjustmentFeeType = {
2914
2915
  BrokerageFee: 'BROKERAGE_FEE',
2915
2916
  Buffer: 'BUFFER',
2916
2917
  Cod: 'COD',
2918
+ CollectOrder: 'COLLECT_ORDER',
2919
+ CollectPercent: 'COLLECT_PERCENT',
2917
2920
  Country: 'COUNTRY',
2918
2921
  CurrencyConversionFee: 'CURRENCY_CONVERSION_FEE',
2919
2922
  DdpServiceFee: 'DDP_SERVICE_FEE',
@@ -4765,6 +4768,7 @@ export type GetTaxIdByCountryQuery = {
4765
4768
 
4766
4769
  export type LandedCostSettingsQuery = {
4767
4770
  landedCostSettings: {
4771
+ defaultNativeCurrency: CurrencyCode | null;
4768
4772
  landedCostGuarantee: LandedCostGuaranteeType | null;
4769
4773
  } | null;
4770
4774
  };
@@ -5056,7 +5060,7 @@ export type CartCheckoutWorkflowQuery = {
5056
5060
  checkoutSettings: {
5057
5061
  allowedCharacterSets: AllowedCharacterSets;
5058
5062
  allowedSettlementCurrencies: AllowedSettlementCurrencies;
5059
- successRedirectUrl: string;
5063
+ successBehavior: CheckoutSuccessBehavior;
5060
5064
  captureDelay: number;
5061
5065
  companyFieldsStatus: CheckoutCompanyFieldsStatus;
5062
5066
  createdAt: string;
@@ -5095,7 +5099,7 @@ export type CartCheckoutWorkflowQuery = {
5095
5099
  organization: string;
5096
5100
  placeOrderButtonSelector: string | null;
5097
5101
  subscriptionStatus: CheckoutSubscriptionStatus;
5098
- successBehavior: CheckoutSuccessBehavior;
5102
+ successRedirectUrl: string;
5099
5103
  analyticsProviders: Array<{
5100
5104
  status: AnalyticsProviderStatus;
5101
5105
  type: AnalyticsProviderType;
@@ -5137,6 +5141,10 @@ export type CartCheckoutWorkflowQuery = {
5137
5141
  updatedBy: string;
5138
5142
  visibilityStatus: HelloVisibilityStatus;
5139
5143
  };
5144
+ landedCostSettings: {
5145
+ defaultNativeCurrency: CurrencyCode | null;
5146
+ landedCostGuarantee: LandedCostGuaranteeType | null;
5147
+ };
5140
5148
  onlineStoreSettings: { allowedDomains: Array<string>; url: string };
5141
5149
  organizationId: string;
5142
5150
  shippingZones: Array<{
@@ -5208,6 +5216,7 @@ export type GetReceiptCheckoutSessionQuery = {
5208
5216
  cardDetail: { cardBrand: string | null; last4: string | null } | null;
5209
5217
  createdAt: string;
5210
5218
  id: string;
5219
+ paymentMethods: Array<string> | null;
5211
5220
  paymentProcessor: PaymentProcessorCode;
5212
5221
  paymentStatus: OrderPaymentStatus;
5213
5222
  }> | null;
@@ -5243,6 +5252,7 @@ export type GetReceiptOrderQuery = {
5243
5252
  cardDetail: { cardBrand: string | null; last4: string | null } | null;
5244
5253
  createdAt: string;
5245
5254
  id: string;
5255
+ paymentMethods: Array<string> | null;
5246
5256
  paymentProcessor: PaymentProcessorCode;
5247
5257
  paymentStatus: OrderPaymentStatus;
5248
5258
  }> | null;
@@ -5275,6 +5285,7 @@ export type ReceiptOrderFragment = {
5275
5285
  cardDetail: { cardBrand: string | null; last4: string | null } | null;
5276
5286
  createdAt: string;
5277
5287
  id: string;
5288
+ paymentMethods: Array<string> | null;
5278
5289
  paymentProcessor: PaymentProcessorCode;
5279
5290
  paymentStatus: OrderPaymentStatus;
5280
5291
  }> | null;
@@ -31,6 +31,14 @@ declare global {
31
31
  * A flag to determine if the current page is a BigCommerce page
32
32
  */
33
33
  stencilBootstrap?: unknown;
34
+ /**
35
+ * Currency selector to perform blur currency on init
36
+ */
37
+ zonosBlurCurrencyOnInitCurrencySelector?: string;
38
+ /**
39
+ * Interval id to perform blur currency on init
40
+ */
41
+ zonosBlurCurrencyOnInitIntervalId?: NodeJS.Timeout;
34
42
  }
35
43
 
36
44
  namespace NodeJS {
@@ -1,6 +1,10 @@
1
1
  import type { CountryFields } from "../CountryFields";
2
- import type { AppearanceSettingsQuery, CheckoutSettingsQuery, CountryCode, HelloSettingsQuery, OnlineStoreSettingsQuery, OrganizationQuery } from "../generated/graphql.internal.types";
2
+ import type { AppearanceSettingsQuery, CheckoutSettingsQuery, CountryCode, HelloSettingsQuery, LandedCostSettingsQuery, OnlineStoreSettingsQuery, OrganizationQuery, ShippingZonesQuery } from "../generated/graphql.internal.types";
3
3
  export type GenericZonosSettings = {
4
+ /**
5
+ * Whether to blur the currency while initializing Zonos to avoid price flickering.
6
+ */
7
+ blurCurrencyOnInit?: boolean;
4
8
  /**
5
9
  * Country that should be enable the custom address fields in the checkout based on the country user is from.
6
10
  */
@@ -36,7 +40,9 @@ export type GenericZonosSettings = {
36
40
  */
37
41
  usdSettlementCountryEnabled?: CountryCode[];
38
42
  };
39
- export type ZonosSettingsBase = AppearanceSettingsQuery & CheckoutSettingsQuery & HelloSettingsQuery & OnlineStoreSettingsQuery & OrganizationQuery;
43
+ export type ZonosSettingsBase = AppearanceSettingsQuery & CheckoutSettingsQuery & HelloSettingsQuery & OnlineStoreSettingsQuery & OrganizationQuery & ShippingZonesQuery & {
44
+ landedCostSettings: NonNullable<LandedCostSettingsQuery['landedCostSettings']>;
45
+ };
40
46
  export type ZonosSettings = ZonosSettingsBase & {
41
47
  genericSettings: GenericZonosSettings | null;
42
48
  };
@@ -0,0 +1,2 @@
1
+ export declare const removeBlurCurrency: () => Promise<void>;
2
+ export declare const performBlurCurrency: () => void;
@@ -0,0 +1 @@
1
+ .z--blur{filter:blur(5px);transition:filter .3s}
@@ -1 +1 @@
1
- import{c as n}from"./p-595f5dd2.js";import{g as o,I as t}from"./p-e7b0c156.js";import{g as r,a as i,l,h as u,b as m}from"./p-a8a312b2.js";import{g as p,_ as w,c as f,a as h}from"./p-b2d81c98.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b2d81c98.js";export{a as availableTestKeys}from"./p-04a01cb1.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./p-6b361d2b.js";const y=["jsdelivr","cdnjs","unpkg","vercel"],v="jsdelivr",O=e=>{const n=y.indexOf(e);return y[n+1]||null},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.223.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return l(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t},g="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,b="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 N=Promise.resolve().then((()=>{return e=null,null!==j||(j=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(b),window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${g}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&z.test(o.src))return o}return null})();t&&e?console.warn(b):t||(t=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${g}${n}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),j;var e}));let I=!1;N.catch((e=>{I||console.warn(e)}));const k=async({cartId:e,retries:n})=>{const t=r(),s=o(),i=p()||void 0,c=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&c.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:d,json:a,zonosMode:m}=await u(`/api/zonos-elements/get-cart?${c.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:i,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),w=!a||d.length;return w&&n?(l("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),k({cartId:e,retries:n-1})):w?null:Object.assign(Object.assign({},a),{zonosMode:m})};var T;const R=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),$="https://v1.3.223.js.zonos.com",Z=R||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.223",L="https://fonts.googleapis.com",U=/^https:\/\/fonts\.googleapis\.com/;class A{}T=A,A.doneInit=!1,A.cartSettings=null,A.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),A.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),A._paypalMockResponse=null,A.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,A.isBigCommerce=!1,A.releaseDate="1752091697360",A.isLegacyCheckout=!1,A.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",A.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),A.overrideUseCustomAddressForm=!1,A.isCollect=!1,A.isNpm=!0,A.zonosQaUrl=null,A.zonosQaUrlApi=null,A.trackEventLogs=[],A.version="v1.3.223",A.modeAlerted=!1,A.cartData=null,A.paypal=null,A.zonosMode=null,A.IframeService=t,A.getCurrentTimestamp=()=>(new Date).getTime(),A.zonosController=null,A.loadTimeApiInfoList=[],A.logIntervalId=null,A.init=async e=>{const{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d,storeId:a,zonosApiKey:p}=e;if(T.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),T.doneInit)return;if(l(`====== ZONOS DEBUG MODE: on (${T.version}) ======`),T.zonosApiKey=p,T.storeId=a,T.isNpm){l("====== ZONOS LOADING FROM NPM ======");const n=S();if(n&&!window.isZonosPreview){l(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${n} ======`,"info");const o=document.createElement("script");return o.src=`${n}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=T.isNpm,window.Zonos.isBigCommerce=T.isBigCommerce,window.Zonos.isLegacyCheckout=T.isLegacyCheckout,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${n}`)})),void(window.isZonosPreview=!0)}if(!p&&!T.cartId)return void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!T.cartData&&T.cartId){l("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=w(e);if(!o&&!n)return m("[ZONOS - loadZonos] invalid cart id"),null;const t=await k({cartId:e,retries:5});return l("[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}):(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(T.cartId);if(!e)return void m("Failed to get cart data");T.cartData=e.cartData,T.zonosApiKey=e.zonosApiKey,T.cartSettings=e.settings}const o=await(async()=>{const e=r(),n=i();if(!e&&!n||!window.Zonos.zonosApiKey)return null;if(l("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return l("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:t}=await u("/api/get-test-public-credential");if(o.length||!t)return m("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const s=t.publicCredential;return s?(l(`[ZONOS - loadZonos] Retrieve new test public token ${s}`,"info"),s):(m("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(T.zonosApiKey=o)}const h=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(T.cartId&&T.cartData||h){l("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=`${f}`,document.body.appendChild(e)}l("init zonos"),T.restoreNativeBrowserFunctions(),T.injectCustomScriptForHostedCheckout(),T.injectZonosCdn(),T.injectZonosCss(),T.injectFonts(),T.injectCheckoutInternationalButton(),T.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d}}),T.doneInit=!0},A.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${h}`)){const e=document.createElement("button");e.id=h,e.style.display="none",document.body.appendChild(e)}},A.injectCustomScriptForHostedCheckout=()=>{const e=T.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),t=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||t)){if(o){l("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(t){l("Injecting custom footer script");const e=document.createElement("script");e.textContent=t.value,document.body.appendChild(e)}}else l("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},A.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},A.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${h}`);setTimeout((()=>{e&&e.dispatchEvent(n("click"))}),10)},A.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},A.showNotification=e=>{var n;null===(n=T.zonosController)||void 0===n||n.showNotification(e)},A.updateOrganizationName=e=>{var n;null===(n=T.zonosController)||void 0===n||n.updateOrganizationName(e)},A.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},A.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},A.injectController=({config:e})=>{var n,o;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const n=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=T.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;l("loading Stripe");const o=await(async(...e)=>{I=!0;const n=Date.now();return N.then((o=>((e,n,o)=>{if(null===e)return null;const t=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(t,o),t})(o,e,n)))})(n.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?t.initCollectElement(o):t.initCheckoutElement(o)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),T.zonosController=t,l("Zonos controller injected!")},A.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const t=`${T.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${t}"]`))return void l(`Zonos script "${t}" already exists in the document`,"warn");const s=document.head||document.body,r=document.createElement("script");n?r.type="module":r.noModule=!0,r.src=t,r.crossOrigin="anonymous",r.onerror=()=>{m(`Failed to load ${r.src}`);const t=O(e);t&&T.injectScript({cdnType:t,isModule:n,theRestUrl:o})},s.appendChild(r)},A.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return Z;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.223";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.223";case"vercel":return $}};return T.isNpm&&S()||n()},A.injectZonosCdn=()=>{T.injectScript({cdnType:v,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),T.injectScript({cdnType:v,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),l("Zonos cdn script injected!")},A.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=T.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${$}/`,t.appendChild(s);const r=document.createElement("link");r.rel="stylesheet",r.href=`${o}/${n}`,r.onerror=()=>{m(`Failed to load ${r.href}`);const o=O(e);o&&T.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(r)},A.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?l("Zonos style links already injected","warn"):(T.injectStylesheet({cdnType:v,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),l("Zonos style css injected!"))},A.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void l("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!U.test(o.href))return o}return null})())return void l("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=L,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${L}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),l("Zonos font injected!")},A.setupGoogleFont=e=>{var n;null===(n=T.zonosController)||void 0===n||n.setupGoogleFont(e)},A.injectSupportGoogleFont=e=>{var n;l(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],t=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${L}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=L,t.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void l(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,t.appendChild(s),l(`[FONT] ${o} font injected!`)};const C=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"],E=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"],P=[...C,...E];export{A as Zonos,P as checkoutSessionAttributeKeys,E as checkoutSessionImmutableAttributeKeys,C as checkoutSessionMutableAttributeKeys}
1
+ import{c as n}from"./p-595f5dd2.js";import{g as o,I as t}from"./p-e7b0c156.js";import{l as r}from"./p-0a377722.js";export{a as availableTestKeys}from"./p-0a377722.js";import{g as i,a as l,h as u,l as m}from"./p-41dd1cb8.js";import{g as p,_ as w,c as f,a as h}from"./p-b2d81c98.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b2d81c98.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./p-6b361d2b.js";const y=["jsdelivr","cdnjs","unpkg","vercel"],v="jsdelivr",O=e=>{const n=y.indexOf(e);return y[n+1]||null},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const n=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.225.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t},g="https://js.stripe.com/v3",z=/^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 b=null;const N=Promise.resolve().then((()=>{return e=null,null!==b||(b=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(j),window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${g}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&z.test(o.src))return o}return null})();t&&e?console.warn(j):t||(t=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${g}${n}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),b;var e}));let I=!1;N.catch((e=>{I||console.warn(e)}));const k=async({cartId:e,retries:n})=>{const t=i(),s=o(),c=p()||void 0,d=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&d.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:l,json:a,zonosMode:m}=await u(`/api/zonos-elements/get-cart?${d.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:c,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),w=!a||l.length;return w&&n?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),k({cartId:e,retries:n-1})):w?null:Object.assign(Object.assign({},a),{zonosMode:m})};var T;const R=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),$=Date.now(),Z="https://v1.3.225.js.zonos.com",L=R||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.225",U="https://fonts.googleapis.com",A=/^https:\/\/fonts\.googleapis\.com/;class C{}T=C,C.doneInit=!1,C.cartSettings=null,C.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),C.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),C._paypalMockResponse=null,C.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,C.isBigCommerce=!1,C.releaseDate="1753286018445",C.isLegacyCheckout=!1,C.startLoadTime=$,C.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",C.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),C.overrideUseCustomAddressForm=!1,C.isCollect=!1,C.isNpm=!0,C.zonosQaUrl=null,C.zonosQaUrlApi=null,C.trackEventLogs=[],C.version="v1.3.225",C.modeAlerted=!1,C.cartData=null,C.paypal=null,C.zonosMode=null,C.IframeService=t,C.getCurrentTimestamp=()=>(new Date).getTime(),C.zonosController=null,C.loadTimeApiInfoList=[],C.logIntervalId=null,C.init=async e=>{const{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d,storeId:a,zonosApiKey:p}=e;if(T.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),T.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${T.version}) ======`),T.zonosApiKey=p,T.storeId=a,T.isNpm){r("====== ZONOS LOADING FROM NPM ======");const n=S();if(n&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${n} ======`,"info");const o=document.createElement("script");return o.src=`${n}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=T.isNpm,window.Zonos.isBigCommerce=T.isBigCommerce,window.Zonos.isLegacyCheckout=T.isLegacyCheckout,window.Zonos.zonosMode=T.zonosMode,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${n}`)})),void(window.isZonosPreview=!0)}if(!p&&!T.cartId)return void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!T.cartData&&T.cartId){r("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=w(e);if(!o&&!n)return m("[ZONOS - loadZonos] invalid cart id"),null;const t=await k({cartId:e,retries:5});return r("[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}):(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(T.cartId);if(!e)return void m("Failed to get cart data");T.cartData=e.cartData,T.zonosApiKey=e.zonosApiKey,T.cartSettings=e.settings}const o=await(async()=>{const e=i(),n=l();if(!e&&!n||!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:o,json:t}=await u("/api/get-test-public-credential");if(o.length||!t)return m("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const s=t.publicCredential;return s?(r(`[ZONOS - loadZonos] Retrieve new test public token ${s}`,"info"),s):(m("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(T.zonosApiKey=o)}const h=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(T.cartId&&T.cartData||h){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=`${f}`,document.body.appendChild(e)}r("init zonos"),T.restoreNativeBrowserFunctions(),T.injectCustomScriptForHostedCheckout(),T.injectZonosCdn(),T.injectZonosCss(),T.injectFonts(),T.injectCheckoutInternationalButton(),T.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d}}),T.doneInit=!0},C.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${h}`)){const e=document.createElement("button");e.id=h,e.style.display="none",document.body.appendChild(e)}},C.injectCustomScriptForHostedCheckout=()=>{const e=T.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),t=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||t)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(t){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=t.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},C.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},C.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${h}`);setTimeout((()=>{e&&e.dispatchEvent(n("click"))}),10)},C.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},C.showNotification=e=>{var n;null===(n=T.zonosController)||void 0===n||n.showNotification(e)},C.updateOrganizationName=e=>{var n;null===(n=T.zonosController)||void 0===n||n.updateOrganizationName(e)},C.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},C.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},C.injectController=({config:e})=>{var n,o;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const n=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=T.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;r("loading Stripe");const o=await(async(...e)=>{I=!0;const n=Date.now();return N.then((o=>((e,n,o)=>{if(null===e)return null;const t=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(t,o),t})(o,e,n)))})(n.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?t.initCollectElement(o):t.initCheckoutElement(o)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),T.zonosController=t,r("Zonos controller injected!")},C.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const t=`${T.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${t}"]`))return void r(`Zonos script "${t}" already exists in the document`,"warn");const s=document.head||document.body,i=document.createElement("script");n?i.type="module":i.noModule=!0,i.src=t,i.crossOrigin="anonymous",i.onerror=()=>{m(`Failed to load ${i.src}`);const t=O(e);t&&T.injectScript({cdnType:t,isModule:n,theRestUrl:o})},s.appendChild(i)},C.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return L;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.225";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.225";case"vercel":return Z}};return T.isNpm&&S()||n()},C.injectZonosCdn=()=>{T.injectScript({cdnType:v,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),T.injectScript({cdnType:v,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},C.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=T.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${Z}/`,t.appendChild(s);const r=document.createElement("link");r.rel="stylesheet",r.href=`${o}/${n}`,r.onerror=()=>{m(`Failed to load ${r.href}`);const o=O(e);o&&T.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(r)},C.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(T.injectStylesheet({cdnType:v,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},C.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${U}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!A.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=U,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${U}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},C.setupGoogleFont=e=>{var n;null===(n=T.zonosController)||void 0===n||n.setupGoogleFont(e)},C.injectSupportGoogleFont=e=>{var n;r(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],t=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${U}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=U,t.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,t.appendChild(s),r(`[FONT] ${o} font injected!`)};const E=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"],P=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"],F=[...E,...P];export{C as Zonos,F as checkoutSessionAttributeKeys,P as checkoutSessionImmutableAttributeKeys,E as checkoutSessionMutableAttributeKeys}
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(n,e,r,o){function t(n){return n instanceof r?n:new r((function(e){e(n)}))}return new(r||(r=Promise))((function(r,i){function a(n){try{s(o.next(n))}catch(n){i(n)}}function u(n){try{s(o["throw"](n))}catch(n){i(n)}}function s(n){n.done?r(n.value):t(n.value).then(a,u)}s((o=o.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,t,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(n){return function(e){return s([n,e])}}function s(u){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(r=0)),r)try{if(o=1,t&&(i=u[0]&2?t["return"]:u[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,u[1])).done)return i;if(t=0,i)u=[u[0]&2,i.value];switch(u[0]){case 0:case 1:i=u;break;case 4:r.label++;return{value:u[1],done:false};case 5:r.label++;t=u[1];u=[0];continue;case 7:u=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1];i=u;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(u);break}if(i[2])r.ops.pop();r.trys.pop();continue}u=e.call(n,r)}catch(n){u=[6,n];t=0}finally{o=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(n,e,r){if(r||arguments.length===2)for(var o=0,t=e.length,i;o<t;o++){if(i||!(o in e)){if(!i)i=Array.prototype.slice.call(e,0,o);i[o]=e[o]}}return n.concat(i||Array.prototype.slice.call(e))};System.register(["./p-d938f42f.system.js"],(function(n){"use strict";var e;return{setters:[function(n){e=n.l}],execute:function(){var r=this;var o=n("l",(function(n){var r=[];for(var o=1;o<arguments.length;o++){r[o-1]=arguments[o]}e.apply(void 0,__spreadArray([n,"error"],r,false))}));var t=n("a",(function(){return window.location.search.includes("zonosStagingMode=1")}));var i=n("g",(function(){var n;return((n=window.Zonos.zonosApiKey)===null||n===void 0?void 0:n.includes("test"))||window.location.search.includes("zonosTestMode=1")}));var a=["cloudflare","vercel"];var u=a[0];var s=n("f",{cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"});var c=s[u];var d=function(n){if(n===void 0){n=u}var e=a.indexOf(n);var r=a[e+1];if(!r){return null}return r};var l=n("j",(function(n){if(typeof n==="string"){try{var e=JSON.parse(n);return e}catch(n){return null}}return null}));var f=890;var v=n("i",(function(n){return n||window.innerWidth<f}));var w=function(){var n="connection"in window.navigator?window.navigator.connection:null;var e="mozConnection"in window.navigator?window.navigator.mozConnection:null;var r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;var o=n||e||r;return o};var p=n("b",(function(){var n="userAgentData"in window.navigator?window.navigator.userAgentData:null;var e=w();return{connectionDownlink:e===null||e===void 0?void 0:e.downlink,connectionEffectiveType:e===null||e===void 0?void 0:e.effectiveType,connectionRtt:e===null||e===void 0?void 0:e.rtt,connectionSaveData:e===null||e===void 0?void 0:e.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:n&&n.brands.length>0?n:window.navigator.userAgent}}));var h=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"];var b=function(n){var e=n.apiPath,r=n.apiType,o=n.loadTimeInternal,t=n.loadTimeTotal;if(h.includes(e)){return}var i=t-o;if(i<0){return}var a=e.split("?")[0]||e;var u=p();var s=typeof u.userAgent==="object"&&u.userAgent.mobile;var c={apiType:r,connectionType:u.connectionEffectiveType,href:a,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:v(s),loadTimeBrowserApi:i,loadTimeInternal:o,loadTimeTotal:t,metadata:Object.assign({},u),screenHeight:u.screenHeight,screenWidth:u.screenWidth,userAgent:typeof u.userAgent==="string"?u.userAgent:u.userAgent["brands"].map((function(n){return n.brand})).filter((function(n){return!/Not.*A.*Brand.*/.test(n)})).join(",")};window.Zonos.loadTimeApiInfoList.push(c)};var y=1*3600*1e3;var m=n("s",(function(n){return __awaiter(r,[n],void 0,(function(n){var r,o,t,i,a;var u=n.endpoint,l=n.errors,f=n.metadata,v=n.shouldPostReleaseErrorReporting;return __generator(this,(function(n){e("sendErrorLog","warn",u,f,l);if(v){r=Number(window.Zonos.releaseDate);o=(new Date).getTime();if(o-r>y){return[2]}}t="userAgentData"in window.navigator?window.navigator.userAgentData:null;i={endpoint:u,errors:l,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:t&&t.brands.length>0?t:window.navigator.userAgent},f)};try{void fetch("".concat(c,"/api/zonos-elements/log-error"),{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(n){a=d();if(!a){return[2]}void fetch("".concat(s[a],"/api/zonos-elements/log-error"),{body:JSON.stringify(i),method:"POST"})}return[2]}))}))}));var g=undefined&&undefined.__rest||function(n,e){var r={};for(var o in n)if(Object.prototype.hasOwnProperty.call(n,o)&&e.indexOf(o)<0)r[o]=n[o];if(n!=null&&typeof Object.getOwnPropertySymbols==="function")for(var t=0,o=Object.getOwnPropertySymbols(n);t<o.length;t++){if(e.indexOf(o[t])<0&&Object.prototype.propertyIsEnumerable.call(n,o[t]))r[o[t]]=n[o[t]]}return r};var _=function(n){return __awaiter(r,[n],void 0,(function(n){var e,r,o;var t=n.response,i=n.shouldLog,a=i===void 0?true:i,u=n.shouldThrow,s=u===void 0?false:u;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,t.text()];case 1:e=n.sent();r=l(e);if(!r){throw new Error("Failed to parse content: ".concat(e))}return[2,r];case 2:o=n.sent();if(s){throw o}if(a){console.error(o)}return[2,null];case 3:return[2]}}))}))};var T=function(n){try{var e=btoa(n).replace(/=/g,"");return e}catch(e){return n.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}};var j=function(n){return __awaiter(r,[n],void 0,(function(n){var e,r,o,t,i,a,c,d,l,f,v,f,w,p,c,h,c;var b=n.basePathType,y=n.options,m=n.path;return __generator(this,(function(n){switch(n.label){case 0:r=window.Zonos.zonosQaUrlApi||s[b]||u;o=r+m;t=new URL(o);i=window.Zonos.cartId?"".concat(window.location.hostname,"-").concat(window.Zonos.cartId):window.location.hostname;t.searchParams.set("zToken",T(i));n.label=1;case 1:n.trys.push([1,3,,4]);return[4,fetch(t.toString(),y)];case 2:e=n.sent();return[3,4];case 3:a=n.sent();if(a instanceof Error){return[2,{baseUrl:r,errors:[{message:a.message,type:"unknown"}],json:null,response:null,zonosMode:null}]}c="Failed to fetch";return[2,{baseUrl:r,errors:[{message:c,type:"unknown"}],json:null,response:null,zonosMode:null}];case 4:d=e.headers.get("Zonos-Mode");l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&l){window.Zonos.modeAlerted=true}if(!e.ok)return[3,6];return[4,_({response:e})];case 5:f=n.sent();return[2,{baseUrl:r,errors:[],json:f,response:e,zonosMode:d}];case 6:v=e.status.toString();n.label=7;case 7:n.trys.push([7,9,,10]);return[4,_({response:e,shouldThrow:true})];case 8:f=n.sent();if(f&&"errors"in f&&Array.isArray(f.errors)){w=f.errors;p=w.map((function(n){if(typeof n==="string"){return{message:n,type:v}}return n}));return[2,{baseUrl:r,errors:p,json:null,response:e,zonosMode:d}]}c=JSON.stringify(f);return[2,{baseUrl:r,errors:[{message:c,type:v}],json:null,response:e,zonosMode:d}];case 9:h=n.sent();c="Unknown error";return[2,{baseUrl:r,errors:[{message:"".concat(v,": ").concat(c),type:v}],json:null,response:null,zonosMode:d}];case 10:return[2]}}))}))};var k=function(n){return __awaiter(r,[n],void 0,(function(n){var r,o,t,i,a,u,c,f,v,w,p,h,y,_,T,z,O;var A=n.basePathType,S=n.options,M=n.path;return __generator(this,(function(n){switch(n.label){case 0:t=M.startsWith("/api/bigcommerce");i=t?"vercel":A;a=performance.now();return[4,j({basePathType:i,options:S,path:M})];case 1:u=n.sent(),c=u.errors,f=u.response,v=g(u,["errors","response"]);w=performance.now();p=w-a;e("".concat(M," (").concat(p.toFixed(2),"ms)"),"info");h=f===null||f===void 0?void 0:f.headers.get("Zonos-Duration");if((f===null||f===void 0?void 0:f.status)===200){b({apiPath:M,apiType:i,loadTimeInternal:h?Number(h):0,loadTimeTotal:p})}y=d(i);_=c.find((function(n){var e=n.type;return e==="unknown"}));T=c.find((function(n){var e=n.message;return typeof e==="string"&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))}));z=!!_||(f===null||f===void 0?void 0:f.status)===404||(f===null||f===void 0?void 0:f.status)===500;O=y&&z;if(z&&!T){void m({endpoint:s[i]+M,errors:c.map((function(n){var e=n.message;return"API: ".concat(e)})),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:S===null||S===void 0?void 0:S.headers,requestPayload:l((r=S===null||S===void 0?void 0:S.body)===null||r===void 0?void 0:r.toString())||((o=S===null||S===void 0?void 0:S.body)===null||o===void 0?void 0:o.toString()),shouldCallFallback:O,status:f===null||f===void 0?void 0:f.status,statusText:f===null||f===void 0?void 0:f.statusText},shouldPostReleaseErrorReporting:true})}if(O){e('=== "'.concat(M,'" failed to fetch, trying next fallback ').concat(y));return[2,k({basePathType:y,options:S,path:M})]}return[2,Object.assign({errors:c,response:f},v)]}}))}))};var z=n("h",(function(n,e){return __awaiter(r,void 0,void 0,(function(){var r,o,a,s,c,d;return __generator(this,(function(l){r=g(e||{},[]);o=r.body?JSON.stringify(r.body):undefined;a=r.method||"GET";s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":t()?"1":undefined,"Zonos-Test-Mode":i()?"1":undefined,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},r.headers);Object.keys(s).forEach((function(n){return s[n]===undefined&&delete s[n]}));c=Object.assign(Object.assign({},r),{body:a==="GET"?undefined:o,headers:s,method:a});d=new URLSearchParams(window.location.search).get("useFallbackApi");return[2,k({basePathType:d||u,options:c,path:n})]}))}))}))}}}));
@@ -0,0 +1 @@
1
+ import{c as o,z as e}from"./p-7af39c98.js";import{c as n,B as t,e as d,C as i}from"./p-1c5ba523.js";import{s as a}from"./p-7eb8e2d4.js";import{h as l,s,l as r}from"./p-41dd1cb8.js";import{b as u}from"./p-0a377722.js";import{h as c}from"./p-b30c2ad9.js";const{state:p}=o((()=>({amountDutyTaxFeeTotal:null,amountTotalPaid:null,isFetchingShippingInfo:!0,landedCostShortId:null,originCompanyName:null,partyBillingId:null,shippingAddress:null}))),v=async({landedCostId:o,retries:n=5})=>{var t,i,a,r,u,c,m,C,I;p.isFetchingShippingInfo=!0;const g=await l("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:o},method:"POST"});if(g.errors.length)return n>0?(await new Promise((o=>setTimeout(o,1e3))),v({landedCostId:o,retries:n-1})):null;p.landedCostShortId=(null===(t=g.json)||void 0===t?void 0:t.landedCostShortId)||null,p.isFetchingShippingInfo=!1,p.shippingAddress=(null===(i=g.json)||void 0===i?void 0:i.shipping)||null;const h=null===(a=d.checkoutSession)||void 0===a?void 0:a.landedCost,w=null===(r=d.checkoutSession)||void 0===r?void 0:r.subtotals,L=((null===(u=null==h?void 0:h.amountSubtotals)||void 0===u?void 0:u.shipping)||0)+((null===(c=null==h?void 0:h.amountSubtotals)||void 0===c?void 0:c.items)||0);p.amountTotalPaid=L*((null===(m=null==w?void 0:w.exchangeRate)||void 0===m?void 0:m.rate)||1),p.amountDutyTaxFeeTotal=((null==w?void 0:w.duties)||0)+((null==w?void 0:w.taxes)||0)+((null==w?void 0:w.fees)||0),p.originCompanyName=(null===(I=null===(C=g.json)||void 0===C?void 0:C.origin)||void 0===I?void 0:I.companyName)||null,0===p.amountTotalPaid&&s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:o,organizationId:e.organizationId}})},m=async()=>{var o,e,i,c;if(!(null===(o=n.stripeBillingAddressEventData)||void 0===o?void 0:o.complete))return{partiesCreated:!1};const v=null===(i=null===(e=d.checkoutSession)||void 0===e?void 0:e.landedCost)||void 0===i?void 0:i.rootId;if(!v)return s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:u,cartId:window.Zonos.cartId,checkoutSessionId:a.checkoutSessionId}}),{partiesCreated:!1};if(!a.checkoutSessionId)return s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:u,cartId:window.Zonos.cartId,landedCostRootId:v}}),{partiesCreated:!1};const m=t({address:n.stripeBillingAddressEventData.value.address,firstName:n.stripeBillingAddressEventData.value.firstName,lastName:n.stripeBillingAddressEventData.value.lastName,name:n.stripeBillingAddressEventData.value.name,phone:n.stripeBillingAddressEventData.value.phone}),C="1"===new URLSearchParams(window.location.search).get("zonosE2ETest"),{errors:I,json:g}=await l("/api/zonos-elements/create-billing-party",{body:{billingAddress:m,checkoutSessionId:a.checkoutSessionId,companyName:n.companyName,email:(null===(c=n.stripeLinkEventData)||void 0===c?void 0:c.value.email)||"",isTest:C,rootId:v},method:"POST"});return I.length||!g?(r("Error occurs when creating billing party",JSON.stringify(I,null,2)),s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:u,cartId:window.Zonos.cartId,checkoutSessionId:a.checkoutSessionId,errors:I,json:g}}),{partiesCreated:!1}):(p.partyBillingId=g.billToPartyId,{partiesCreated:!0})},C=async o=>{const e=o.landedCost;return!!e&&(d.landedCostData=[Object.assign(Object.assign({},o),{landedCost:Object.assign({},e),landedCostId:e.id})],i({applySubtotalsOnly:!0,landedCostId:e.id,selectedShippingOption:e.shipmentRating}))},I=o=>o||window.innerWidth<1024&&window.innerWidth>=768,g=o=>o||window.innerWidth<768,h=({content:o,isLoading:e,skeletonHeight:n,skeletonWidth:t})=>e?c("zonos-skeleton",{skeletonHeight:n,skeletonWidth:t}):o;export{I as a,v as b,C as c,m as d,p as e,g as i,h as r}