@zonos/elements 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/cjs/{cart-CiXlehwQ.js → cart-BJpqPdFU.js} +13 -13
  2. package/dist/cjs/{collect-Drr8fY-q.js → collect-CyUttsvB.js} +3 -3
  3. package/dist/cjs/{getMissingRequiredShippingFields-DI6qF1z3.js → getMissingRequiredShippingFields-DEbNbRAZ.js} +1 -1
  4. package/dist/cjs/{handleFetch-DQLhurnE.js → handleFetch-DVfjFTYO.js} +181 -71
  5. package/dist/cjs/{hasInclusivePrice-84KS94yH.js → hasInclusivePrice-CEPf3_FG.js} +1 -1
  6. package/dist/cjs/index.cjs.js +104 -12
  7. package/dist/cjs/{invoice-5hVfSXpb.js → invoice-DzRkkpLu.js} +3 -3
  8. package/dist/cjs/{localization-B2mjW0Xa.js → localization-BhNVhLZs.js} +24 -48
  9. package/dist/cjs/{paypal-pd8Nz_R_.js → paypal-DCSqbdjW.js} +4 -4
  10. package/dist/cjs/{placeTestOrder-DrI8rD9o.js → placeTestOrder-Bkip4PUT.js} +3 -3
  11. package/dist/cjs/{renderCheckoutCurrency-u5q8YdUb.js → renderCheckoutCurrency-BDvEZ3Hv.js} +2 -2
  12. package/dist/cjs/{shouldShowLanguageSelect-gBg4KeTQ.js → shouldShowLanguageSelect-NOVWOU53.js} +1 -1
  13. package/dist/cjs/{submitGtag-Rc-S3PnH.js → submitGtag-D4sB7w4z.js} +1 -1
  14. package/dist/cjs/{taxIdFields-BrIaPTcd.js → taxIdFields-e4OCgr8K.js} +2 -2
  15. package/dist/cjs/{updateCheckoutSessionAttributes-d0IKpwW8.js → updateCheckoutSessionAttributes-KxwcsKhM.js} +1 -1
  16. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +5 -5
  17. package/dist/cjs/zonos-address-display_2.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-address_4.cjs.entry.js +4 -4
  19. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +4 -4
  20. package/dist/cjs/zonos-card_5.cjs.entry.js +5 -5
  21. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +18 -18
  22. package/dist/cjs/zonos-checkout.cjs.entry.js +9 -9
  23. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +3 -3
  24. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +9 -9
  25. package/dist/cjs/zonos-collect.cjs.entry.js +6 -6
  26. package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
  27. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  28. package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
  29. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  30. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  31. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +5 -5
  32. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +9 -9
  33. package/dist/cjs/zonos-invoice.cjs.entry.js +6 -6
  34. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  35. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +4 -4
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +8 -7
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -3
  38. package/dist/collection/components/main/zonos-controller.js +3 -2
  39. package/dist/collection/components/store/checkout/cart.js +3 -2
  40. package/dist/collection/components/store/checkout/stripe.js +10 -9
  41. package/dist/collection/components/store/storageStore.js +7 -6
  42. package/dist/collection/components/utils/__tests__/helpers/blockStorage.js +24 -0
  43. package/dist/collection/components/utils/api/getExchangeRate.js +2 -1
  44. package/dist/collection/components/utils/handleFetch.js +19 -9
  45. package/dist/collection/components/utils/hello/countryOverrideStorage.js +17 -40
  46. package/dist/collection/components/utils/logging/installConstructorCapture.js +58 -0
  47. package/dist/collection/components/utils/logging/reportBlockedStorage.js +34 -0
  48. package/dist/collection/components/utils/logging/sendErrorLog.js +8 -1
  49. package/dist/collection/components/utils/logging/startZonosInit.js +35 -0
  50. package/dist/collection/components/utils/logging/thrownMessage.js +16 -0
  51. package/dist/collection/components/utils/safeStorage.js +39 -0
  52. package/dist/collection/scripts/_getZonosQaUrl.js +3 -2
  53. package/dist/collection/scripts/_zonosBase.js +6 -2
  54. package/dist/collection/types/generated/graphql.frontend.types.js +0 -16
  55. package/dist/collection/types/generated/graphql.internal.types.js +215 -1
  56. package/dist/esm/{cart-DmJkjiDE.js → cart-BS5mSI8x.js} +13 -13
  57. package/dist/esm/{collect-BV5GTPmh.js → collect-B9ZxDDl7.js} +3 -3
  58. package/dist/esm/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
  59. package/dist/esm/{handleFetch-D5GYDF-O.js → handleFetch-BFVO7oAR.js} +178 -72
  60. package/dist/esm/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-zSvDReDb.js} +1 -1
  61. package/dist/esm/index.js +104 -12
  62. package/dist/esm/{invoice-CO-iqlni.js → invoice-6iTuS6ek.js} +3 -3
  63. package/dist/esm/{localization-DHM91diu.js → localization-CXHiWcJp.js} +24 -48
  64. package/dist/esm/{paypal-BfW5aLJw.js → paypal-BE_NVBoy.js} +4 -4
  65. package/dist/esm/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BXA9K9Iy.js} +3 -3
  66. package/dist/esm/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
  67. package/dist/esm/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
  68. package/dist/esm/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
  69. package/dist/esm/{taxIdFields-ByEYfsO5.js → taxIdFields-BUKnHMaL.js} +2 -2
  70. package/dist/esm/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
  71. package/dist/esm/zonos-address-completion-dialog_7.entry.js +5 -5
  72. package/dist/esm/zonos-address-display_2.entry.js +2 -2
  73. package/dist/esm/zonos-address_4.entry.js +4 -4
  74. package/dist/esm/zonos-airwallex-payment.entry.js +4 -4
  75. package/dist/esm/zonos-card_5.entry.js +5 -5
  76. package/dist/esm/zonos-cart-items_12.entry.js +18 -18
  77. package/dist/esm/zonos-checkout.entry.js +9 -9
  78. package/dist/esm/zonos-collect-cart-items_3.entry.js +3 -3
  79. package/dist/esm/zonos-collect-finish_6.entry.js +9 -9
  80. package/dist/esm/zonos-collect.entry.js +6 -6
  81. package/dist/esm/zonos-controller.entry.js +6 -6
  82. package/dist/esm/zonos-country-flag.entry.js +2 -2
  83. package/dist/esm/zonos-country-select_4.entry.js +3 -3
  84. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  85. package/dist/esm/zonos-hello.entry.js +2 -2
  86. package/dist/esm/zonos-invoice-cart-items_2.entry.js +5 -5
  87. package/dist/esm/zonos-invoice-finish_5.entry.js +9 -9
  88. package/dist/esm/zonos-invoice.entry.js +6 -6
  89. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  90. package/dist/esm/zonos-policy-consent_2.entry.js +4 -4
  91. package/dist/esm-es5/{cart-DmJkjiDE.js → cart-BS5mSI8x.js} +58 -58
  92. package/dist/esm-es5/{collect-BV5GTPmh.js → collect-B9ZxDDl7.js} +1 -1
  93. package/dist/esm-es5/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
  94. package/dist/esm-es5/handleFetch-BFVO7oAR.js +73 -0
  95. package/dist/esm-es5/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-zSvDReDb.js} +1 -1
  96. package/dist/esm-es5/index.js +26 -8
  97. package/dist/esm-es5/{invoice-CO-iqlni.js → invoice-6iTuS6ek.js} +1 -1
  98. package/dist/esm-es5/{localization-DHM91diu.js → localization-CXHiWcJp.js} +6 -9
  99. package/dist/esm-es5/{paypal-BfW5aLJw.js → paypal-BE_NVBoy.js} +1 -1
  100. package/dist/esm-es5/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BXA9K9Iy.js} +1 -1
  101. package/dist/esm-es5/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
  102. package/dist/esm-es5/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
  103. package/dist/esm-es5/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
  104. package/dist/esm-es5/{taxIdFields-ByEYfsO5.js → taxIdFields-BUKnHMaL.js} +2 -2
  105. package/dist/esm-es5/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
  106. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
  107. package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
  108. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  109. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  110. package/dist/esm-es5/zonos-card_5.entry.js +6 -6
  111. package/dist/esm-es5/zonos-cart-items_12.entry.js +127 -127
  112. package/dist/esm-es5/zonos-checkout.entry.js +3 -3
  113. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  114. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  115. package/dist/esm-es5/zonos-collect.entry.js +6 -6
  116. package/dist/esm-es5/zonos-controller.entry.js +5 -5
  117. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  118. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  119. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  120. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  121. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  122. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  123. package/dist/esm-es5/zonos-invoice.entry.js +3 -3
  124. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  125. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  126. package/dist/scripts/index.d.ts +6 -0
  127. package/dist/scripts/index.js +1 -1
  128. package/dist/scripts/loadZonos.js +1 -1
  129. package/dist/scripts/zonos.js +1 -1
  130. package/dist/types/components/utils/__tests__/helpers/blockStorage.d.ts +3 -0
  131. package/dist/types/components/utils/logging/installConstructorCapture.d.ts +20 -0
  132. package/dist/types/components/utils/logging/reportBlockedStorage.d.ts +16 -0
  133. package/dist/types/components/utils/logging/startZonosInit.d.ts +5 -0
  134. package/dist/types/components/utils/logging/thrownMessage.d.ts +1 -0
  135. package/dist/types/components/utils/safeStorage.d.ts +4 -0
  136. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
  137. package/dist/types/types/generated/graphql.frontend.types.d.ts +0 -22
  138. package/dist/types/types/generated/graphql.frontend.types.ts +0 -51
  139. package/dist/types/types/generated/graphql.internal.types.d.ts +270 -1
  140. package/dist/types/types/generated/graphql.internal.types.ts +341 -1
  141. package/dist/zonos-elements/index.esm.js +1 -1
  142. package/dist/zonos-elements/{p-8fa6cfff.entry.js → p-08b01c96.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-3e705c9b.entry.js → p-0909ef77.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-2b63865a.system.entry.js → p-13015d34.system.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-2d513aa3.entry.js → p-13d5b2f9.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-46a839d2.system.entry.js → p-150047b3.system.entry.js} +16 -16
  147. package/dist/zonos-elements/{p-6e691736.entry.js → p-1986cc37.entry.js} +1 -1
  148. package/dist/zonos-elements/{p-vTIygnHq.system.js → p-1OG3IJgY.system.js} +1 -1
  149. package/dist/zonos-elements/{p-189cc594.system.entry.js → p-30bf4700.system.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-4917b74d.entry.js → p-3466bcba.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-12b24ebb.entry.js → p-383343c7.entry.js} +1 -1
  152. package/dist/zonos-elements/{p-5585db86.system.entry.js → p-3a506614.system.entry.js} +36 -36
  153. package/dist/zonos-elements/{p-46b9f0cf.entry.js → p-43c0ebe9.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-84e76348.entry.js → p-4b65f192.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-216a908d.system.entry.js → p-573a4e7c.system.entry.js} +6 -6
  156. package/dist/zonos-elements/{p-1fda4aec.system.entry.js → p-5a296dbc.system.entry.js} +87 -87
  157. package/dist/zonos-elements/{p-960070d0.system.entry.js → p-68325c5a.system.entry.js} +4 -4
  158. package/dist/zonos-elements/{p-53eac12f.system.entry.js → p-6db7317a.system.entry.js} +13 -13
  159. package/dist/zonos-elements/{p-1199baef.system.entry.js → p-709d1561.system.entry.js} +1 -1
  160. package/dist/zonos-elements/p-71d29603.entry.js +1 -0
  161. package/dist/zonos-elements/{p-064d8829.system.entry.js → p-7214c953.system.entry.js} +23 -23
  162. package/dist/zonos-elements/{p-65817880.entry.js → p-7fe83919.entry.js} +1 -1
  163. package/dist/zonos-elements/p-8ac26831.entry.js +1 -0
  164. package/dist/zonos-elements/{p-cccaad60.system.entry.js → p-8f9f859f.system.entry.js} +9 -9
  165. package/dist/zonos-elements/{p-f5f95990.system.entry.js → p-96b250d8.system.entry.js} +14 -14
  166. package/dist/zonos-elements/{p-678b9214.entry.js → p-97729873.entry.js} +1 -1
  167. package/dist/zonos-elements/{p-f3d9a380.system.entry.js → p-9b3668a4.system.entry.js} +144 -144
  168. package/dist/zonos-elements/{p-d8f375da.system.entry.js → p-9df31243.system.entry.js} +1 -1
  169. package/dist/zonos-elements/p-BI6VAB5B.js +1 -0
  170. package/dist/zonos-elements/p-BJFa5RwX.js +1 -0
  171. package/dist/zonos-elements/p-BJ_kE5rM.js +1 -0
  172. package/dist/zonos-elements/{p-XoQH3S7Z.system.js → p-BKUlQxBd.system.js} +1 -1
  173. package/dist/zonos-elements/{p-DprOoI2W.system.js → p-BUfCTQXY.system.js} +154 -154
  174. package/dist/zonos-elements/{p-CBUz18kA.system.js → p-BnQyot7Y.system.js} +23 -23
  175. package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
  176. package/dist/zonos-elements/{p-CMo3ZweU.js → p-C-zdj7MK.js} +1 -1
  177. package/dist/zonos-elements/{p-iAIzUA4k.js → p-C5fs3rIR.js} +1 -1
  178. package/dist/zonos-elements/{p-D1e9zNDA.js → p-CJmWr75U.js} +1 -1
  179. package/dist/zonos-elements/{p-Dtu_Japy.system.js → p-CMneHjck.system.js} +39 -39
  180. package/dist/zonos-elements/p-CP7KnfR3.system.js +245 -0
  181. package/dist/zonos-elements/p-CVRbGFV3.js +1 -0
  182. package/dist/zonos-elements/p-Cl5yV0ak.js +1 -0
  183. package/dist/zonos-elements/{p-CGNVm52g.system.js → p-Cp1IAJvW.system.js} +5 -5
  184. package/dist/zonos-elements/{p-6vSUiBfr.system.js → p-D-Lnf8mS.system.js} +50 -53
  185. package/dist/zonos-elements/p-D0DkOoAw.system.js +73 -0
  186. package/dist/zonos-elements/p-D4xpkSsK.js +1 -0
  187. package/dist/zonos-elements/p-DATNIakn.js +1 -0
  188. package/dist/zonos-elements/{p-CbhN65lj.system.js → p-DC1OPJDq.system.js} +1 -1
  189. package/dist/zonos-elements/{p-CHKKvuiz.js → p-DKnphvmJ.js} +1 -1
  190. package/dist/zonos-elements/{p-ojtNq-r5.system.js → p-DXlojp_Y.system.js} +1 -1
  191. package/dist/zonos-elements/{p-C9XLkmmb.system.js → p-DrS-0mk7.system.js} +1 -1
  192. package/dist/zonos-elements/{p-DpwmHU8R.js → p-DrbN3rPL.js} +2 -2
  193. package/dist/zonos-elements/{p-BrQ8n8NS.system.js → p-Dv5a-V6w.system.js} +3 -3
  194. package/dist/zonos-elements/{p-55813e9f.system.entry.js → p-a3c147d2.system.entry.js} +3 -3
  195. package/dist/zonos-elements/{p-DiMEP3mh.js → p-aK18R41t.js} +1 -1
  196. package/dist/zonos-elements/p-af4ad54b.entry.js +1 -0
  197. package/dist/zonos-elements/{p-1e6db427.entry.js → p-af741506.entry.js} +1 -1
  198. package/dist/zonos-elements/{p-2ca826b9.system.entry.js → p-b540c636.system.entry.js} +1 -1
  199. package/dist/zonos-elements/{p-636b71d4.entry.js → p-bac94956.entry.js} +1 -1
  200. package/dist/zonos-elements/{p-941a95a1.system.entry.js → p-bb1b414a.system.entry.js} +5 -5
  201. package/dist/zonos-elements/{p-e7fdb2c9.entry.js → p-bfa9e32a.entry.js} +1 -1
  202. package/dist/zonos-elements/p-cf6bf7a4.entry.js +1 -0
  203. package/dist/zonos-elements/p-dJcbnNlE.system.js +7 -0
  204. package/dist/zonos-elements/{p-7dc7f328.entry.js → p-db40b9c3.entry.js} +1 -1
  205. package/dist/zonos-elements/{p-d3345b2c.entry.js → p-dd003161.entry.js} +1 -1
  206. package/dist/zonos-elements/{p-ef5344ea.entry.js → p-e374aaa4.entry.js} +1 -1
  207. package/dist/zonos-elements/{p-6410fa11.system.entry.js → p-e43470f7.system.entry.js} +22 -22
  208. package/dist/zonos-elements/{p-fda89981.system.entry.js → p-ebc7ea54.system.entry.js} +3 -3
  209. package/dist/zonos-elements/{p-1cc42a98.system.entry.js → p-f2ed52bc.system.entry.js} +16 -16
  210. package/dist/zonos-elements/p-gEViRqvf.js +1 -0
  211. package/dist/zonos-elements/{p-DgUrB-1a.system.js → p-yv7ekcdG.system.js} +2 -2
  212. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  213. package/package.json +1 -1
  214. package/dist/esm-es5/handleFetch-D5GYDF-O.js +0 -60
  215. package/dist/zonos-elements/p-107f287b.entry.js +0 -1
  216. package/dist/zonos-elements/p-25eb99d4.entry.js +0 -1
  217. package/dist/zonos-elements/p-8f9d8795.entry.js +0 -1
  218. package/dist/zonos-elements/p-BMPYH-LT.js +0 -1
  219. package/dist/zonos-elements/p-C70h5mKA.js +0 -1
  220. package/dist/zonos-elements/p-CTiqplrr.js +0 -1
  221. package/dist/zonos-elements/p-Ch1w0Lr7.js +0 -1
  222. package/dist/zonos-elements/p-D1SmY_fZ.js +0 -1
  223. package/dist/zonos-elements/p-D6xXnsM_.js +0 -1
  224. package/dist/zonos-elements/p-DE4a-QD5.js +0 -1
  225. package/dist/zonos-elements/p-DQrMfUzi.system.js +0 -227
  226. package/dist/zonos-elements/p-DZdkJHK9.system.js +0 -7
  227. package/dist/zonos-elements/p-U33isUJG.js +0 -1
  228. package/dist/zonos-elements/p-ebe157b5.entry.js +0 -1
  229. package/dist/zonos-elements/p-zVLAvre1.system.js +0 -60
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var zonosStore = require('./zonosStore-CDV83QyK.js');
4
- var localization = require('./localization-B2mjW0Xa.js');
4
+ var localization = require('./localization-BhNVhLZs.js');
5
5
  var taxIdRules = require('./taxIdRules-BBj8kQxJ.js');
6
6
  var TaxId = require('./TaxId-ChhNwG04.js');
7
7
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
8
- var handleFetch = require('./handleFetch-DQLhurnE.js');
8
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
9
9
  var isDarkColor = require('./isDarkColor-f-fD9c2l.js');
10
10
  var getBorderRadius = require('./getBorderRadius-CJ_95w3o.js');
11
11
 
@@ -974,7 +974,7 @@ const checkoutPaymentProcessorType = {
974
974
 
975
975
  const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = zonosStore.createStore(() => ({
976
976
  checkoutSettlementCurrency: 'USD',
977
- clientSecret: sessionStorage.getItem('zonos--client-secret') || '',
977
+ clientSecret: handleFetch.safeGetItem('session', 'zonos--client-secret') || '',
978
978
  companyName: '',
979
979
  companyNameUsedWhenAsyncAddressUpdate: '',
980
980
  customAddressErrors: {
@@ -1084,14 +1084,14 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
1084
1084
  };
1085
1085
  };
1086
1086
  const stripeStoreCleanupDomesticShippingSession = () => {
1087
- window.sessionStorage.removeItem('zonos--bigcommerce-domestic-checkout-shipping');
1087
+ handleFetch.safeRemoveItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
1088
1088
  };
1089
1089
  // Save shipping address to session storage
1090
1090
  const stripeStoreSaveDomesticShippingSession = (props) => {
1091
- window.sessionStorage.setItem('zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
1091
+ handleFetch.safeSetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
1092
1092
  };
1093
1093
  const stripeStoreGetDomesticShippingSession = () => {
1094
- const session = window.sessionStorage.getItem('zonos--bigcommerce-domestic-checkout-shipping');
1094
+ const session = handleFetch.safeGetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
1095
1095
  return handleFetch.jsonParse(session);
1096
1096
  };
1097
1097
  const initStripeElements = async (props) => {
@@ -1138,7 +1138,7 @@ const initStripeElements = async (props) => {
1138
1138
  };
1139
1139
  const stripeStoreReset = () => {
1140
1140
  // clean clientSecret so that we can start the new one.
1141
- sessionStorage.removeItem('zonos--client-secret');
1141
+ handleFetch.safeRemoveItem('session', 'zonos--client-secret');
1142
1142
  // cleanup stripe elements
1143
1143
  reset$1();
1144
1144
  // set stripe back to window.Zonos.stripe
@@ -1471,7 +1471,7 @@ const stripeCalculateLandedCost = async () => {
1471
1471
  cartStore.promoCodeError = isInvalidPromoCode;
1472
1472
  // When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
1473
1473
  if (!isInvalidPromoCode) {
1474
- sessionStorage.setItem('zonos--promo-code', cartStore.promoCode);
1474
+ handleFetch.safeSetItem('session', 'zonos--promo-code', cartStore.promoCode);
1475
1475
  }
1476
1476
  };
1477
1477
  const stripeStorePrefetchLandedCost = async (params) => {
@@ -1603,7 +1603,7 @@ const stripeStoreApplyPromoCode = async () => {
1603
1603
  };
1604
1604
  const stripeStoreResetPromoCode = () => {
1605
1605
  cartStore.promoCode = '';
1606
- sessionStorage.removeItem('zonos--promo-code');
1606
+ handleFetch.safeRemoveItem('session', 'zonos--promo-code');
1607
1607
  // reset promocode error state
1608
1608
  cartStore.promoCodeError = false;
1609
1609
  cartStore.promoCodeApplied = false;
@@ -2225,10 +2225,10 @@ const stripeStoreTranslateAddressToLatin = async ({ addressInvalidCharactersList
2225
2225
  stripeStoreOnChange('clientSecret', clientSecret => {
2226
2226
  // update stripe elements when client secret changes
2227
2227
  if (clientSecret && stripeStore.stripe) {
2228
- sessionStorage.setItem('zonos--client-secret', clientSecret);
2228
+ handleFetch.safeSetItem('session', 'zonos--client-secret', clientSecret);
2229
2229
  }
2230
2230
  if (!clientSecret) {
2231
- sessionStorage.removeItem('zonos--client-secret');
2231
+ handleFetch.safeRemoveItem('session', 'zonos--client-secret');
2232
2232
  }
2233
2233
  });
2234
2234
 
@@ -2272,9 +2272,9 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = zonosStore.cre
2272
2272
  landedCostData: null,
2273
2273
  landedCostMethod: 'DDP',
2274
2274
  partiesData: [],
2275
- promoCode: sessionStorage.getItem('zonos--promo-code') || '',
2275
+ promoCode: handleFetch.safeGetItem('session', 'zonos--promo-code') || '',
2276
2276
  // When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
2277
- promoCodeApplied: !!sessionStorage.getItem('zonos--promo-code'),
2277
+ promoCodeApplied: !!handleFetch.safeGetItem('session', 'zonos--promo-code'),
2278
2278
  promoCodeError: false,
2279
2279
  restrictedItems: [],
2280
2280
  selectedLandedCost: null,
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var zonosStore = require('./zonosStore-CDV83QyK.js');
4
- var localization = require('./localization-B2mjW0Xa.js');
5
- var handleFetch = require('./handleFetch-DQLhurnE.js');
4
+ var localization = require('./localization-BhNVhLZs.js');
5
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
6
6
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
7
- var cart = require('./cart-CiXlehwQ.js');
7
+ var cart = require('./cart-BJpqPdFU.js');
8
8
 
9
9
  // src/constant/common.ts
10
10
  function _array_like_to_array(arr, len) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var cart = require('./cart-CiXlehwQ.js');
3
+ var cart = require('./cart-BJpqPdFU.js');
4
4
 
5
5
  /**
6
6
  * Minimum number of characters we treat as a valid postal code. Mirrors the
@@ -2,18 +2,6 @@
2
2
 
3
3
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
4
4
 
5
- const logError = (message, ...rest) => {
6
- VarianceTest.log(message, 'error', ...rest);
7
- };
8
-
9
- const getIsStagingMode = () => window.location.search.includes('zonosStagingMode=1');
10
-
11
- const getIsTestMode = () => {
12
- var _a;
13
- return ((_a = window.Zonos.zonosApiKey) === null || _a === void 0 ? void 0 : _a.includes('test')) ||
14
- window.location.search.includes('zonosTestMode=1');
15
- };
16
-
17
5
  const fallbackApiType = ['cloudflare', 'vercel'];
18
6
  const MAIN_BASE_API_TYPE = fallbackApiType[0];
19
7
  const fallbackApiList = {
@@ -33,6 +21,164 @@ const getNextFallbackApiType = (currentApiType = MAIN_BASE_API_TYPE) => {
33
21
  return nextFallbackApiType;
34
22
  };
35
23
 
24
+ /**
25
+ * This is the time in milliseconds after release time that we will start sending error logs to the new API
26
+ * @default 1 hour
27
+ */
28
+ const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
29
+ const loggedHref = () => {
30
+ const url = new URL(window.location.href);
31
+ url.searchParams.delete('payment_intent');
32
+ url.searchParams.delete('payment_intent_client_secret');
33
+ url.searchParams.delete('redirect_status');
34
+ return url.toString();
35
+ };
36
+ const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
37
+ VarianceTest.log('sendErrorLog', 'warn', endpoint, metadata, errors);
38
+ if (shouldPostReleaseErrorReporting) {
39
+ // We only want to report errors that happened if current time is less than 2 hours after release time
40
+ const releaseTime = Number(window.Zonos.releaseDate);
41
+ const currentTime = new Date().getTime();
42
+ if (currentTime - releaseTime > postReleaseReportingDuration) {
43
+ return;
44
+ }
45
+ }
46
+ const userAgentData = 'userAgentData' in window.navigator
47
+ ? // userAgentData is not yet supported in all browsers
48
+ window.navigator.userAgentData
49
+ : null;
50
+ const errorObject = {
51
+ endpoint,
52
+ errors,
53
+ href: loggedHref(),
54
+ metadata: Object.assign({ appVersion: window.Zonos.version, domain: window.Zonos.domain, publicCredential: window.Zonos.zonosApiKey, userAgent: userAgentData && userAgentData.brands.length > 0
55
+ ? userAgentData
56
+ : window.navigator.userAgent }, metadata),
57
+ };
58
+ try {
59
+ // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
60
+ void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
61
+ body: JSON.stringify(errorObject),
62
+ headers: {
63
+ 'Zonos-Referer': window.location.hostname,
64
+ },
65
+ method: 'POST',
66
+ });
67
+ }
68
+ catch (_a) {
69
+ const nextFallbackApi = getNextFallbackApiType();
70
+ if (!nextFallbackApi) {
71
+ return;
72
+ }
73
+ // request to the fallback API if the first one fails
74
+ void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
75
+ body: JSON.stringify(errorObject),
76
+ method: 'POST',
77
+ });
78
+ }
79
+ };
80
+
81
+ const thrownMessage = (error, fallback) => {
82
+ if (typeof error === 'string' && error) {
83
+ return error;
84
+ }
85
+ if (error instanceof Error && error.message) {
86
+ return error.message;
87
+ }
88
+ if (typeof error === 'object' &&
89
+ error !== null &&
90
+ 'message' in error &&
91
+ typeof error.message === 'string' &&
92
+ error.message) {
93
+ return error.message;
94
+ }
95
+ return fallback;
96
+ };
97
+
98
+ const logError = (message, ...rest) => {
99
+ VarianceTest.log(message, 'error', ...rest);
100
+ };
101
+
102
+ const reportedIds = () => {
103
+ if (!window.__zonosReportedBlockedStorage) {
104
+ window.__zonosReportedBlockedStorage = new Set();
105
+ }
106
+ return window.__zonosReportedBlockedStorage;
107
+ };
108
+ /**
109
+ * Record a blocked storage read or write on the existing error log.
110
+ * A throw before `window.Zonos` exists is swallowed and does not use up
111
+ * the per-page dedupe slot, so the later startup read can still report it.
112
+ */
113
+ const reportBlockedStorage = (area, operation, key, error) => {
114
+ if (typeof window.Zonos === 'undefined') {
115
+ return;
116
+ }
117
+ const dedupeId = `${area}\u0000${operation}\u0000${key}`;
118
+ const reported = reportedIds();
119
+ if (reported.has(dedupeId)) {
120
+ return;
121
+ }
122
+ reported.add(dedupeId);
123
+ void sendErrorLog({
124
+ endpoint: `storage://${area}/${key}`,
125
+ errors: [thrownMessage(error, 'SecurityError')],
126
+ metadata: {
127
+ area,
128
+ key,
129
+ operation,
130
+ shape: 'blocked-storage',
131
+ },
132
+ });
133
+ };
134
+
135
+ /**
136
+ * Touch `window.localStorage` / `window.sessionStorage` inside the try.
137
+ * Safari throws SecurityError on the getter itself when storage is blocked.
138
+ * A missing storage object is the same failure: calling `getItem` on it
139
+ * would report a TypeError instead of blocked storage.
140
+ */
141
+ const storageFor = (area) => {
142
+ const storage = area === 'local' ? window.localStorage : window.sessionStorage;
143
+ if (!storage) {
144
+ throw new DOMException('', 'SecurityError');
145
+ }
146
+ return storage;
147
+ };
148
+ const safeGetItem = (area, key) => {
149
+ try {
150
+ return storageFor(area).getItem(key);
151
+ }
152
+ catch (error) {
153
+ reportBlockedStorage(area, 'getItem', key, error);
154
+ return null;
155
+ }
156
+ };
157
+ const safeRemoveItem = (area, key) => {
158
+ try {
159
+ storageFor(area).removeItem(key);
160
+ }
161
+ catch (error) {
162
+ reportBlockedStorage(area, 'removeItem', key, error);
163
+ }
164
+ };
165
+ const safeSetItem = (area, key, value) => {
166
+ try {
167
+ storageFor(area).setItem(key, value);
168
+ }
169
+ catch (error) {
170
+ reportBlockedStorage(area, 'setItem', key, error);
171
+ }
172
+ };
173
+
174
+ const getIsStagingMode = () => window.location.search.includes('zonosStagingMode=1');
175
+
176
+ const getIsTestMode = () => {
177
+ var _a;
178
+ return ((_a = window.Zonos.zonosApiKey) === null || _a === void 0 ? void 0 : _a.includes('test')) ||
179
+ window.location.search.includes('zonosTestMode=1');
180
+ };
181
+
36
182
  const jsonParse = (_data) => {
37
183
  if (typeof _data === 'string') {
38
184
  try {
@@ -135,56 +281,6 @@ const prepLoadTimeApiLog = ({ apiPath, apiType, loadTimeInternal, loadTimeTotal,
135
281
  window.Zonos.loadTimeApiInfoList.push(bulkLoadLogBody);
136
282
  };
137
283
 
138
- /**
139
- * This is the time in milliseconds after release time that we will start sending error logs to the new API
140
- * @default 1 hour
141
- */
142
- const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
143
- const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
144
- VarianceTest.log('sendErrorLog', 'warn', endpoint, metadata, errors);
145
- if (shouldPostReleaseErrorReporting) {
146
- // We only want to report errors that happened if current time is less than 2 hours after release time
147
- const releaseTime = Number(window.Zonos.releaseDate);
148
- const currentTime = new Date().getTime();
149
- if (currentTime - releaseTime > postReleaseReportingDuration) {
150
- return;
151
- }
152
- }
153
- const userAgentData = 'userAgentData' in window.navigator
154
- ? // userAgentData is not yet supported in all browsers
155
- window.navigator.userAgentData
156
- : null;
157
- const errorObject = {
158
- endpoint,
159
- errors,
160
- href: window.location.href,
161
- metadata: Object.assign({ appVersion: window.Zonos.version, domain: window.Zonos.domain, publicCredential: window.Zonos.zonosApiKey, userAgent: userAgentData && userAgentData.brands.length > 0
162
- ? userAgentData
163
- : window.navigator.userAgent }, metadata),
164
- };
165
- try {
166
- // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
167
- void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
168
- body: JSON.stringify(errorObject),
169
- headers: {
170
- 'Zonos-Referer': window.location.hostname,
171
- },
172
- method: 'POST',
173
- });
174
- }
175
- catch (_a) {
176
- const nextFallbackApi = getNextFallbackApiType();
177
- if (!nextFallbackApi) {
178
- return;
179
- }
180
- // request to the fallback API if the first one fails
181
- void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
182
- body: JSON.stringify(errorObject),
183
- method: 'POST',
184
- });
185
- }
186
- };
187
-
188
284
  var __rest = (undefined && undefined.__rest) || function (s, e) {
189
285
  var t = {};
190
286
  for (var p in s)
@@ -197,6 +293,7 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
197
293
  }
198
294
  return t;
199
295
  };
296
+ const isGatewayStatus = (status) => status === 502 || status === 503 || status === 504;
200
297
  const getResponseBody = async ({ response, shouldLog = true, shouldThrow = false, }) => {
201
298
  try {
202
299
  const text = await response.text();
@@ -317,28 +414,31 @@ const handleRequest = async ({ basePathType, options, path, }) => {
317
414
  }
318
415
  catch (_a) {
319
416
  const message = 'Unknown error';
417
+ // A gateway HTML or empty body still carries a status a GET can fail over
418
+ // on. Other non-JSON statuses, including 404 and 500, keep the previous
419
+ // null response so they do not fail over.
320
420
  return {
321
421
  baseUrl,
322
422
  errors: [{ message: `${status}: ${message}`, type: status }],
323
423
  json: null,
324
- response: null,
424
+ response: isGatewayStatus(response.status) ? response : null,
325
425
  zonosMode,
326
426
  };
327
427
  }
328
428
  };
329
429
  const handleRequestWithFallback = async ({ basePathType: _basePathType, options, path, }) => {
330
- var _a, _b;
430
+ var _a, _b, _c;
331
431
  // use vercel API if the path is `/api/bigcommerce`
332
432
  const isBigcommerceEndpoint = path.startsWith('/api/bigcommerce');
333
433
  const basePathType = isBigcommerceEndpoint
334
434
  ? 'vercel'
335
435
  : _basePathType;
336
436
  const startTime = performance.now();
337
- const _c = await handleRequest({
437
+ const _d = await handleRequest({
338
438
  basePathType,
339
439
  options,
340
440
  path,
341
- }), { errors, response } = _c, rest = __rest(_c, ["errors", "response"]);
441
+ }), { errors, response } = _d, rest = __rest(_d, ["errors", "response"]);
342
442
  const endTime = performance.now();
343
443
  const duration = endTime - startTime;
344
444
  // Send the load time api log
@@ -360,10 +460,16 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
360
460
  (message.includes('signal is aborted') ||
361
461
  message.includes('The operation was aborted') ||
362
462
  message.includes('Fetch is aborted')));
363
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
364
- const shouldCallFallback =
365
- // If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
366
- nextFallbackApiType && isUnknownError;
463
+ const statusCode = response === null || response === void 0 ? void 0 : response.status;
464
+ const gateway = statusCode !== undefined && isGatewayStatus(statusCode);
465
+ // handleFetch sets method, and a missing method is a GET.
466
+ const isIdempotentGet = ((_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : 'GET').toUpperCase() === 'GET';
467
+ const failedWithoutGateway = !!unknownError || statusCode === 404 || statusCode === 500;
468
+ const isUnknownError = failedWithoutGateway || gateway;
469
+ // Replay 502, 503, and 504 only for GET. A gateway timeout on a POST can
470
+ // mean the first host is still finishing a payment or order write.
471
+ const shouldCallFallback = nextFallbackApiType &&
472
+ (failedWithoutGateway || (gateway && isIdempotentGet));
367
473
  // Should log the error if it's unknown error
368
474
  if (isUnknownError && !isAbortError) {
369
475
  void sendErrorLog({
@@ -373,7 +479,7 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
373
479
  currentBasePath: basePathType,
374
480
  nextFallbackApiType,
375
481
  requestHeaders: options === null || options === void 0 ? void 0 : options.headers,
376
- requestPayload: jsonParse((_a = options === null || options === void 0 ? void 0 : options.body) === null || _a === void 0 ? void 0 : _a.toString()) || ((_b = options === null || options === void 0 ? void 0 : options.body) === null || _b === void 0 ? void 0 : _b.toString()),
482
+ requestPayload: jsonParse((_b = options === null || options === void 0 ? void 0 : options.body) === null || _b === void 0 ? void 0 : _b.toString()) || ((_c = options === null || options === void 0 ? void 0 : options.body) === null || _c === void 0 ? void 0 : _c.toString()),
377
483
  shouldCallFallback,
378
484
  status: response === null || response === void 0 ? void 0 : response.status,
379
485
  statusText: response === null || response === void 0 ? void 0 : response.statusText,
@@ -425,4 +531,8 @@ exports.handleFetch = handleFetch;
425
531
  exports.isCheckoutMobile = isCheckoutMobile;
426
532
  exports.jsonParse = jsonParse;
427
533
  exports.logError = logError;
534
+ exports.safeGetItem = safeGetItem;
535
+ exports.safeRemoveItem = safeRemoveItem;
536
+ exports.safeSetItem = safeSetItem;
428
537
  exports.sendErrorLog = sendErrorLog;
538
+ exports.thrownMessage = thrownMessage;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var localization = require('./localization-B2mjW0Xa.js');
3
+ var localization = require('./localization-BhNVhLZs.js');
4
4
 
5
5
  /**
6
6
  * Since the backend and the frontend are using the same keys,
@@ -3,12 +3,103 @@
3
3
  var taxIdRules = require('./taxIdRules-BBj8kQxJ.js');
4
4
  var createCustomEvent = require('./createCustomEvent-Cs5zGImL.js');
5
5
  var getGenericSettingsOverride = require('./getGenericSettingsOverride-CL6l6wvX.js');
6
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
6
7
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
7
- var handleFetch = require('./handleFetch-DQLhurnE.js');
8
8
  var CheckoutConfig = require('./CheckoutConfig-B7JRM7yr.js');
9
9
  var ShortAddressCode = require('./ShortAddressCode-C5l520-F.js');
10
10
  var TaxId = require('./TaxId-ChhNwG04.js');
11
11
 
12
+ const constructorNotFound = /^Constructor for .+ was not found/;
13
+ const constructorTag = /^Constructor for "?([^#"]+)#/;
14
+ const recordConstructorFailure = (value) => {
15
+ var _a;
16
+ const message = handleFetch.thrownMessage(value, '');
17
+ if (!message || !constructorNotFound.test(message)) {
18
+ return;
19
+ }
20
+ if (typeof window.Zonos === 'undefined') {
21
+ return;
22
+ }
23
+ const capture = window.__zonosConstructorCapture;
24
+ if (!capture) {
25
+ return;
26
+ }
27
+ const tagMatch = constructorTag.exec(message);
28
+ const tag = (_a = tagMatch === null || tagMatch === void 0 ? void 0 : tagMatch[1]) !== null && _a !== void 0 ? _a : '';
29
+ if (capture.reported.has(tag)) {
30
+ return;
31
+ }
32
+ capture.reported.add(tag);
33
+ void handleFetch.sendErrorLog({
34
+ endpoint: 'stencil://constructor',
35
+ errors: [message],
36
+ metadata: {
37
+ shape: 'constructor-not-found',
38
+ tag,
39
+ },
40
+ });
41
+ };
42
+ /**
43
+ * Copy a missing-constructor failure onto the existing error log.
44
+ * Stencil catches `Constructor for "tag#mode" was not found` and passes that
45
+ * Error to `console.error`. One report is sent per tag, then the original
46
+ * console.error still runs. This does not request the chunk again.
47
+ */
48
+ const installConstructorCapture = () => {
49
+ if (window.__zonosConstructorCapture) {
50
+ return;
51
+ }
52
+ const listener = (event) => {
53
+ recordConstructorFailure(event.reason);
54
+ };
55
+ window.__zonosConstructorCapture = {
56
+ listener,
57
+ reported: new Set(),
58
+ };
59
+ window.addEventListener('unhandledrejection', listener);
60
+ // eslint-disable-next-line no-console -- Stencil reports the missing constructor here
61
+ const originalError = console.error.bind(console);
62
+ // eslint-disable-next-line no-console -- record the Stencil diagnostic, then forward it
63
+ console.error = (...data) => {
64
+ recordConstructorFailure(data[0]);
65
+ originalError(...data);
66
+ };
67
+ };
68
+
69
+ const reportInitRejection = (error) => {
70
+ // sendErrorLog prints only when zonosDebug is on. Keep the failure in the
71
+ // merchant console without leaving an unhandled rejection.
72
+ // eslint-disable-next-line no-console -- the page console is the support signal
73
+ console.error(error);
74
+ if (typeof window.Zonos === 'undefined') {
75
+ return;
76
+ }
77
+ void handleFetch.sendErrorLog({
78
+ endpoint: 'zonos://init',
79
+ errors: [handleFetch.thrownMessage(error, 'Unknown init rejection')],
80
+ metadata: {
81
+ shape: 'init-rejection',
82
+ },
83
+ });
84
+ };
85
+ /**
86
+ * Run an init that the caller is not waiting on. The rejection is recorded
87
+ * and not rethrown, so startup does not become an unhandled rejection.
88
+ */
89
+ const startZonosInit = (start) => {
90
+ let pending;
91
+ try {
92
+ pending = start();
93
+ }
94
+ catch (error) {
95
+ reportInitRejection(error);
96
+ return;
97
+ }
98
+ void pending.catch((error) => {
99
+ reportInitRejection(error);
100
+ });
101
+ };
102
+
12
103
  /**
13
104
  * Get the load version and url based on the loadScriptSrc and version
14
105
  * @returns
@@ -132,7 +223,7 @@ const getZonosQaUrl = () => {
132
223
  return null;
133
224
  }
134
225
  const qaUrl = extractZonosQaUrl(window.location.href);
135
- const cdnUrl = "https://v1.5.1.js.zonos.com";
226
+ const cdnUrl = "https://v1.5.2.js.zonos.com";
136
227
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
137
228
  if (!qaUrl &&
138
229
  (cdnUrl.includes('test.') ||
@@ -167,8 +258,8 @@ const getZonosQaUrl = () => {
167
258
  void fetch(fullUrl)
168
259
  .then(() => {
169
260
  // cleanup checkout session to avoid using the prod session in preview domain
170
- window.sessionStorage.removeItem('zonos--checkout-session-id');
171
- window.sessionStorage.removeItem('zonos--client-secret');
261
+ handleFetch.safeRemoveItem('session', 'zonos--checkout-session-id');
262
+ handleFetch.safeRemoveItem('session', 'zonos--client-secret');
172
263
  })
173
264
  .catch(() => {
174
265
  alert(`[ZONOS-WARNING] '${fullUrl}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);
@@ -421,10 +512,10 @@ const zonosLoadUrl = (() => {
421
512
  return null;
422
513
  })();
423
514
  const startLoadTime = Date.now();
424
- const ZONOS_URL = "https://v1.5.1.js.zonos.com";
425
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.1";
426
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.5.1";
427
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.1";
515
+ const ZONOS_URL = "https://v1.5.2.js.zonos.com";
516
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.2";
517
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.5.2";
518
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.2";
428
519
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
429
520
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
430
521
  class Zonos {
@@ -442,7 +533,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
442
533
  ? new URLSearchParams(window.location.search).get('iframeLogType')
443
534
  : null;
444
535
  Zonos.isBigCommerce = false;
445
- Zonos.releaseDate = "1793041426949";
536
+ Zonos.releaseDate = "1793899893283";
446
537
  Zonos.isLegacyCheckout = false;
447
538
  Zonos.googleAnalyticId = null;
448
539
  Zonos.googleAnalyticReady = false;
@@ -467,7 +558,7 @@ Zonos.isNpm = true;
467
558
  Zonos.zonosQaUrl = null;
468
559
  Zonos.zonosQaUrlApi = null;
469
560
  Zonos.trackEventLogs = [];
470
- Zonos.version = `v${"1.5.1"}`;
561
+ Zonos.version = `v${"1.5.2"}`;
471
562
  Zonos.modeAlerted = false;
472
563
  Zonos.cartData = null;
473
564
  Zonos.paypal = null;
@@ -478,6 +569,7 @@ Zonos.zonosController = null;
478
569
  Zonos.loadTimeApiInfoList = [];
479
570
  Zonos.logIntervalId = null;
480
571
  Zonos.init = async (params) => {
572
+ installConstructorCapture();
481
573
  const { appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, } = params;
482
574
  _a.cartId = getCartIdFromQueryParam();
483
575
  // Expose the checkout cart callbacks on the global so Stripe loading can be
@@ -513,7 +605,7 @@ Zonos.init = async (params) => {
513
605
  window.Zonos.isLegacyCheckout = _a.isLegacyCheckout;
514
606
  window.Zonos.zonosMode = _a.zonosMode;
515
607
  // call init again after the script is loaded
516
- void window.Zonos.init(params);
608
+ startZonosInit(() => window.Zonos.init(params));
517
609
  });
518
610
  script.addEventListener('error', () => {
519
611
  alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${zonosQaUrl}`);
@@ -549,7 +641,7 @@ Zonos.init = async (params) => {
549
641
  }
550
642
  }
551
643
  // Check if the stripe client secret is available in the url or session storage, inject hidden button to trigger checkout right away to check status of client secret
552
- const clientSecretUrlParam = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || sessionStorage.getItem('zonos--client-secret');
644
+ const clientSecretUrlParam = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || handleFetch.safeGetItem('session', 'zonos--client-secret');
553
645
  const shouldAttemptImmediatelyOpenCheckout = (_a.cartId && _a.cartData) || !!clientSecretUrlParam;
554
646
  // inject hidden button to body to trigger checkout right away if we have cartData or stripe client secret
555
647
  if (shouldAttemptImmediatelyOpenCheckout) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var zonosStore = require('./zonosStore-CDV83QyK.js');
4
- var cart = require('./cart-CiXlehwQ.js');
5
- var localization = require('./localization-B2mjW0Xa.js');
6
- var handleFetch = require('./handleFetch-DQLhurnE.js');
4
+ var cart = require('./cart-BJpqPdFU.js');
5
+ var localization = require('./localization-BhNVhLZs.js');
6
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
7
7
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
8
8
 
9
9
  const { state: invoiceStore } = zonosStore.createStore(() => ({