@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,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
- var localization = require('./localization-B2mjW0Xa.js');
4
+ var localization = require('./localization-BhNVhLZs.js');
5
5
  var zonosStore = require('./zonosStore-CDV83QyK.js');
6
6
  var classes = require('./classes-D_DL168u.js');
7
7
  var formatStringWithLinks = require('./formatStringWithLinks-vOVkAjlu.js');
8
- var hasInclusivePrice = require('./hasInclusivePrice-84KS94yH.js');
8
+ var hasInclusivePrice = require('./hasInclusivePrice-CEPf3_FG.js');
9
9
  var getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-Cl50u1mb.js');
10
10
  var TaxId = require('./TaxId-ChhNwG04.js');
11
- require('./handleFetch-DQLhurnE.js');
11
+ require('./handleFetch-DVfjFTYO.js');
12
12
  require('./VarianceTest-C98whVgO.js');
13
13
  require('./isSameHostCheckoutLink-DbmQ7Ha4.js');
14
14
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
4
  var debounce = require('./debounce-BhgA8_3W.js');
5
- var localization = require('./localization-B2mjW0Xa.js');
5
+ var localization = require('./localization-BhNVhLZs.js');
6
6
  var zonosStore = require('./zonosStore-CDV83QyK.js');
7
7
  var classes = require('./classes-D_DL168u.js');
8
- var handleFetch = require('./handleFetch-DQLhurnE.js');
8
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
9
9
  var getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-Cl50u1mb.js');
10
10
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
11
11
  require('./debounce-DRPMxNew.js');
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
- var cart = require('./cart-CiXlehwQ.js');
5
- var localization = require('./localization-B2mjW0Xa.js');
6
- var renderCheckoutCurrency = require('./renderCheckoutCurrency-u5q8YdUb.js');
4
+ var cart = require('./cart-BJpqPdFU.js');
5
+ var localization = require('./localization-BhNVhLZs.js');
6
+ var renderCheckoutCurrency = require('./renderCheckoutCurrency-BDvEZ3Hv.js');
7
7
  var classes = require('./classes-D_DL168u.js');
8
- var invoice = require('./invoice-5hVfSXpb.js');
8
+ var invoice = require('./invoice-DzRkkpLu.js');
9
9
  var renderFallback = require('./renderFallback-Bme86uk8.js');
10
10
  require('./zonosStore-CDV83QyK.js');
11
11
  require('./VarianceTest-C98whVgO.js');
12
12
  require('./taxIdRules-BBj8kQxJ.js');
13
13
  require('./TaxId-ChhNwG04.js');
14
- require('./handleFetch-DQLhurnE.js');
14
+ require('./handleFetch-DVfjFTYO.js');
15
15
  require('./isDarkColor-f-fD9c2l.js');
16
16
  require('./getBorderRadius-CJ_95w3o.js');
17
17
 
@@ -1,26 +1,26 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
- var cart = require('./cart-CiXlehwQ.js');
5
- var paypal = require('./paypal-pd8Nz_R_.js');
6
- var localization = require('./localization-B2mjW0Xa.js');
4
+ var cart = require('./cart-BJpqPdFU.js');
5
+ var paypal = require('./paypal-DCSqbdjW.js');
6
+ var localization = require('./localization-BhNVhLZs.js');
7
7
  var zonosStore = require('./zonosStore-CDV83QyK.js');
8
- var handleFetch = require('./handleFetch-DQLhurnE.js');
8
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
9
9
  var createCustomEvent = require('./createCustomEvent-Cs5zGImL.js');
10
10
  var getBorderRadius = require('./getBorderRadius-CJ_95w3o.js');
11
11
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
12
12
  var isInvoiceMobileTablet = require('./isInvoiceMobileTablet-CCqFYV6m.js');
13
13
  var classes = require('./classes-D_DL168u.js');
14
- var shouldShowLanguageSelect = require('./shouldShowLanguageSelect-gBg4KeTQ.js');
15
- var invoice = require('./invoice-5hVfSXpb.js');
16
- var renderCheckoutCurrency = require('./renderCheckoutCurrency-u5q8YdUb.js');
17
- var placeTestOrder = require('./placeTestOrder-DrI8rD9o.js');
14
+ var shouldShowLanguageSelect = require('./shouldShowLanguageSelect-NOVWOU53.js');
15
+ var invoice = require('./invoice-DzRkkpLu.js');
16
+ var renderCheckoutCurrency = require('./renderCheckoutCurrency-BDvEZ3Hv.js');
17
+ var placeTestOrder = require('./placeTestOrder-Bkip4PUT.js');
18
18
  var renderFallback = require('./renderFallback-Bme86uk8.js');
19
19
  require('./taxIdRules-BBj8kQxJ.js');
20
20
  require('./TaxId-ChhNwG04.js');
21
21
  require('./isDarkColor-f-fD9c2l.js');
22
22
  require('./isContrastColor-B9ldIdpa.js');
23
- require('./submitGtag-Rc-S3PnH.js');
23
+ require('./submitGtag-D4sB7w4z.js');
24
24
 
25
25
  var RemoveIcon = `<svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>`;
26
26
 
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
- var cart = require('./cart-CiXlehwQ.js');
5
- var invoice = require('./invoice-5hVfSXpb.js');
6
- var paypal = require('./paypal-pd8Nz_R_.js');
7
- var localization = require('./localization-B2mjW0Xa.js');
4
+ var cart = require('./cart-BJpqPdFU.js');
5
+ var invoice = require('./invoice-DzRkkpLu.js');
6
+ var paypal = require('./paypal-DCSqbdjW.js');
7
+ var localization = require('./localization-BhNVhLZs.js');
8
8
  var zonosStore = require('./zonosStore-CDV83QyK.js');
9
9
  var buildCartItemsByTempCart = require('./buildCartItemsByTempCart-ILzonEjb.js');
10
- var handleFetch = require('./handleFetch-DQLhurnE.js');
10
+ var handleFetch = require('./handleFetch-DVfjFTYO.js');
11
11
  var isInvoiceMobileTablet = require('./isInvoiceMobileTablet-CCqFYV6m.js');
12
12
  var classes = require('./classes-D_DL168u.js');
13
13
  var VarianceTest = require('./VarianceTest-C98whVgO.js');
@@ -16,7 +16,7 @@ require('./TaxId-ChhNwG04.js');
16
16
  require('./isDarkColor-f-fD9c2l.js');
17
17
  require('./getBorderRadius-CJ_95w3o.js');
18
18
  require('./isContrastColor-B9ldIdpa.js');
19
- require('./submitGtag-Rc-S3PnH.js');
19
+ require('./submitGtag-D4sB7w4z.js');
20
20
 
21
21
  var ChevronDownIcon = `<svg color="var(--zonos-elements-gray-400)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M6.293 9.293a1 1 0 0 1 1.414 0L12 13.586l4.293-4.293a1 1 0 0 1 1.414 1.414l-4.93 4.93a1.1 1.1 0 0 1-1.555 0l-4.93-4.93a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>`;
22
22
 
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
- var localization = require('./localization-B2mjW0Xa.js');
4
+ var localization = require('./localization-BhNVhLZs.js');
5
5
  var zonosStore = require('./zonosStore-CDV83QyK.js');
6
- require('./handleFetch-DQLhurnE.js');
6
+ require('./handleFetch-DVfjFTYO.js');
7
7
  require('./VarianceTest-C98whVgO.js');
8
8
 
9
9
  var GreenCheckDuotoneIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-DAAr465v.js');
4
- var cart = require('./cart-CiXlehwQ.js');
5
- var localization = require('./localization-B2mjW0Xa.js');
4
+ var cart = require('./cart-BJpqPdFU.js');
5
+ var localization = require('./localization-BhNVhLZs.js');
6
6
  var zonosStore = require('./zonosStore-CDV83QyK.js');
7
- var renderCheckoutCurrency = require('./renderCheckoutCurrency-u5q8YdUb.js');
7
+ var renderCheckoutCurrency = require('./renderCheckoutCurrency-BDvEZ3Hv.js');
8
8
  var getBorderRadius = require('./getBorderRadius-CJ_95w3o.js');
9
9
  require('./taxIdRules-BBj8kQxJ.js');
10
10
  require('./TaxId-ChhNwG04.js');
11
11
  require('./VarianceTest-C98whVgO.js');
12
- require('./handleFetch-DQLhurnE.js');
12
+ require('./handleFetch-DVfjFTYO.js');
13
13
  require('./isDarkColor-f-fD9c2l.js');
14
14
 
15
15
  const zonosPolicyConsentCss = () => `:host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:block;margin-top:20px}.zonos--policy-consent{background-color:var(--zonos-elements-gray-50);border:1px solid var(--zonos-elements-gray-200);border-radius:8px;padding:12px 14px;-webkit-transition:border-color 0.15s ease, background-color 0.15s ease;transition:border-color 0.15s ease, background-color 0.15s ease}.zonos--policy-consent:hover{border-color:var(--zonos-elements-gray-300)}.zonos--policy-consent--error{background-color:var(--zonos-elements-red-50);border-color:var(--zonos-elements-red-400)}.zonos--policy-consent-label{-ms-flex-align:center;align-items:center;cursor:pointer;display:-ms-flexbox;display:flex;gap:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.zonos--policy-consent-checkbox{accent-color:var(--zonos-elements-blue-600);cursor:pointer;-ms-flex-negative:0;flex-shrink:0;height:18px;margin:0;width:18px}.zonos--policy-consent-text{color:var(--zonos-elements-gray-800);font-size:14px;line-height:1.45}.zonos--policy-consent-text a{color:var(--zonos-elements-blue-600);text-decoration:underline;text-underline-offset:2px}.zonos--policy-consent-text a:hover{color:var(--zonos-elements-blue-700)}.zonos--policy-consent-error{color:var(--zonos-elements-red-600);font-size:13px;line-height:1.4;margin-top:8px;padding:0 4px}`;
@@ -14,6 +14,7 @@ import { handleFetch } from "../../../utils/handleFetch";
14
14
  import { jsonParse } from "../../../utils/jsonParse";
15
15
  import { allLogs, log } from "../../../utils/logging/log";
16
16
  import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
17
+ import { safeGetItem, safeRemoveItem, safeSetItem, } from "../../../utils/safeStorage";
17
18
  import { submitAnalytics } from "../../../utils/submitAnalytics";
18
19
  // eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
19
20
  import RemoveIcon from "./assets/RemoveIcon.svg";
@@ -544,7 +545,7 @@ export class ZonosCheckoutFinish {
544
545
  };
545
546
  this.saveOrderIdForDuplicationIssue = () => {
546
547
  var _a, _b, _c, _d;
547
- const existingPlacedOrderInfo = jsonParse(localStorage.getItem('zonos--placed-order-info'));
548
+ const existingPlacedOrderInfo = jsonParse(safeGetItem('local', 'zonos--placed-order-info'));
548
549
  const placedOrderTime = {
549
550
  cartId: window.Zonos.cartId || null,
550
551
  checkoutSessionId: (existingPlacedOrderInfo === null || existingPlacedOrderInfo === void 0 ? void 0 : existingPlacedOrderInfo.checkoutSessionId) ||
@@ -554,12 +555,12 @@ export class ZonosCheckoutFinish {
554
555
  time: (existingPlacedOrderInfo === null || existingPlacedOrderInfo === void 0 ? void 0 : existingPlacedOrderInfo.time) || Date.now(),
555
556
  zonosOrderNumber: ((_d = (_c = (_b = this.order) === null || _b === void 0 ? void 0 : _b.references) === null || _c === void 0 ? void 0 : _c.find(ref => ref.key === 'zonosOrderNumber')) === null || _d === void 0 ? void 0 : _d.value) || null,
556
557
  };
557
- localStorage.setItem('zonos--placed-order-info', JSON.stringify(placedOrderTime));
558
+ safeSetItem('local', 'zonos--placed-order-info', JSON.stringify(placedOrderTime));
558
559
  };
559
560
  }
560
561
  componentDidLoad() {
561
562
  // Reset local storage for placed order info
562
- localStorage.removeItem('zonos--placed-order-info');
563
+ safeRemoveItem('local', 'zonos--placed-order-info');
563
564
  if (this.overrideNotification) {
564
565
  // just show the notification and don't check any of the payment status
565
566
  this.notificationType = this.overrideNotification.type;
@@ -583,11 +584,11 @@ export class ZonosCheckoutFinish {
583
584
  }
584
585
  render() {
585
586
  const isTestMode = getIsTestMode();
586
- return (h(Host, { key: '76a3503d5c41cf3138e71b071fdb5e341fad1781', class: "zonos--checkout-finish zonos--elements", style: {
587
+ return (h(Host, { key: 'd0e01955edb2c23678d39ef14a18a3b8cd0e2b28', class: "zonos--checkout-finish zonos--elements", style: {
587
588
  '--zonos--border-radius': getBorderRadius({
588
589
  overrideBorderStyle: this.borderRadius,
589
590
  }),
590
- } }, this.isImmediateRedirecting && (h("div", { key: 'aab29e86b7d17dde74d873fe97f342e419e1b5cb', class: "loading-wrapper" }, h("zonos-spinner", { key: '29526f5d056c117ccd65bd1ed303761c04fdbdf3', size: 48 }))), !this.isLoading && !this.isImmediateRedirecting && (h("div", { key: '438b210be5c4c78c74d37e5fde8de994e379afa0', class: "zonos--finish-details" }, h("div", { key: '1cb133c14660035ea6395adb74d30790b69715f3', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '4e5a66524f7833916829c9dd7172225e872bb329', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '773a548cd7757af62b26bbe119e7dd078ab4df5b', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: 'ea8c30af05aa57c05155f68b416668db16cfcd1c',
591
+ } }, this.isImmediateRedirecting && (h("div", { key: 'fdd0468df80703543b942e729a3d90dd2d9f3eee', class: "loading-wrapper" }, h("zonos-spinner", { key: '82f8cb7f62ab073a4b39bf6fca67c7e37db94f5e', size: 48 }))), !this.isLoading && !this.isImmediateRedirecting && (h("div", { key: '1ad8c9a98307a017aca8493404fb9575b9f8eaa0', class: "zonos--finish-details" }, h("div", { key: '474a8780c96fbaf2ebb2e7db7f6a6734cb630baa', class: "zonos--group" }, this.notificationType === 'success' ? (h("zonos-icon", { "aria-label": "Order success", content: SuccessIcon, iconColor: 'blue-800', size: 50 })) : (h("zonos-icon", { "aria-label": "Order failed", content: RemoveIcon, iconColor: 'red-800', size: 50 })), h("zonos-text", { key: '4f8ce6ac8ca854cd400db16345433cef732ba9de', class: "zonos--title", type: "semiBoldSubheader" }, this.notificationTitle), h("zonos-text", { key: '5ccf3054ba802e69692ba0154390c4fb24e051e6', class: "zonos--subtitle", textColor: "gray-600" }, this.notificationMessages.map(message => (h(Fragment, null, message, h("br", null))))), this.shouldRenderCloseButtonForRedirectBehavior() && (h("zonos-button", { key: '813fec3a2d1e77487935203baf92010e5d28392d',
591
592
  // Only show loading spinner if it's not an error notification
592
593
  loading: this.isWaitingToRedirect &&
593
594
  this.notificationType !== 'error', onClick: () => {
@@ -599,9 +600,9 @@ export class ZonosCheckoutFinish {
599
600
  }
600
601
  this.closeClickHandler();
601
602
  }, size: "md", variant: "primary" }, translate('Close'))), !window.Zonos.isLegacyCheckout &&
602
- this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: '50120bf3a405a2b6e5433fe1bb744f0b836ac49f', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
603
+ this.shouldRenderKeepShoppingButton() && (h("zonos-button", { key: 'ad9969e7e07881f872fa599e1dbfe481df03d51e', onClick: () => this.closeClickHandler(), size: "md", variant: "primary" }, this.notificationActionText))), isTestMode &&
603
604
  cartStore.step === 'finish' &&
604
- this.notificationType === 'success' && (h("div", { key: '2794f9deea56b65de81ad92285270388a7089a73', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '2ba2ef7a26f78cf484d1625428d866cdfadd1b2f', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: 'fc689ad6192fb0cc86a9fcaf164660a056df8bc5', onClick: () => {
605
+ this.notificationType === 'success' && (h("div", { key: '6b520c1b13cb036c15f798557b44f9f386a55d68', class: "zonos--finish-button-wrapper" }, h("zonos-button", { key: '4ef2807d00be47ba87c4bf4223505923ab6e194a', backgroundColor: "gray-0", buttonColor: "gray-1000", onClick: () => this.closeClickHandler(), size: "lg", variant: "outline" }, "New test cart"), h("zonos-button", { key: '7db0f58fb43aefabd168f4a82be7daeef843d7cc', onClick: () => {
605
606
  const isZonosDashboard = window.location.hostname.includes('dashboard.zonos.com');
606
607
  this.redirectToUrl(isZonosDashboard
607
608
  ? '/orders/all'
@@ -45,6 +45,7 @@ import { sendErrorLog } from "../../utils/logging/sendErrorLog";
45
45
  import { sendLoadCheckoutFacadeLog } from "../../utils/logging/sendLoadCheckoutFacadeLog";
46
46
  import { sendLoadNativeCheckoutLog } from "../../utils/logging/sendLoadNativeCheckoutLog";
47
47
  import { mergeConfig } from "../../utils/mergeConfig";
48
+ import { safeGetItem, safeRemoveItem } from "../../utils/safeStorage";
48
49
  import { styles } from "../../utils/styles";
49
50
  import { submitAnalytics } from "../../utils/submitAnalytics";
50
51
  import { validateCheckoutSession } from "../../utils/validateCheckoutSession";
@@ -752,9 +753,9 @@ export class ZonosCheckout {
752
753
  window.location.reload();
753
754
  }
754
755
  handleOrderDuplication() {
755
- const existingPlacedOrderInfo = jsonParse(localStorage.getItem('zonos--placed-order-info'));
756
+ const existingPlacedOrderInfo = jsonParse(safeGetItem('local', 'zonos--placed-order-info'));
756
757
  if (!existingPlacedOrderInfo) {
757
- localStorage.removeItem('zonos--placed-order-info');
758
+ safeRemoveItem('local', 'zonos--placed-order-info');
758
759
  return;
759
760
  }
760
761
  const elapsed = Date.now() - existingPlacedOrderInfo.time;
@@ -766,7 +767,7 @@ export class ZonosCheckout {
766
767
  if (elapsed > overrideExpiredDuplication) {
767
768
  log(`=== Existing placed order info is older than ${overrideExpiredDuplication}ms, cleaning localStorage`, 'warn');
768
769
  // remove the placed order info if it's older than 5 minutes and do nothing.
769
- localStorage.removeItem('zonos--placed-order-info');
770
+ safeRemoveItem('local', 'zonos--placed-order-info');
770
771
  return;
771
772
  }
772
773
  // Set placed order info to show the confirm notification to the user
@@ -13,6 +13,7 @@ import { initHello } from "../utils/hello/initHello";
13
13
  import { CheckoutAddressService } from "../utils/iframe/CheckoutAddressService";
14
14
  import { iframeServices, injectPrivateIframe, } from "../utils/iframe/IframeHelpers";
15
15
  import { log } from "../utils/logging/log";
16
+ import { safeGetItem } from "../utils/safeStorage";
16
17
  import { ensureAnalyticsRelayPing } from "../utils/submitGtag";
17
18
  export class ZonosController {
18
19
  /**
@@ -283,7 +284,7 @@ export class ZonosController {
283
284
  // Checkout also runs without merchant cart callbacks when a cart is
284
285
  // prefetched (e.g. `tempCartUUID` -> `cartData`) or when resuming a
285
286
  // payment via the Stripe client secret. Stripe must still load for those.
286
- const clientSecret = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || sessionStorage.getItem('zonos--client-secret');
287
+ const clientSecret = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || safeGetItem('session', 'zonos--client-secret');
287
288
  const hasPrefetchedCheckoutContext = !!(window.Zonos.cartId && window.Zonos.cartData) || !!clientSecret;
288
289
  if (!hasCartCallback && !hasPrefetchedCheckoutContext) {
289
290
  log(`Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present`, 'warn');
@@ -348,7 +349,7 @@ export class ZonosController {
348
349
  zonosStore.organizationName = organizationName;
349
350
  }
350
351
  render() {
351
- return h(Host, { key: '1714865012d806892f03e03896ee2f04aa1a729d', class: "zonos--elements" });
352
+ return h(Host, { key: 'a72ab4fb14df090eb24520fd5821746caa61e318', class: "zonos--elements" });
352
353
  }
353
354
  static get is() { return "zonos-controller"; }
354
355
  static get encapsulation() { return "shadow"; }
@@ -10,6 +10,7 @@ import { isEuDapRemittance } from "../../utils/checkout/isEuDapRemittance";
10
10
  import { allLogs, log } from "../../utils/logging/log";
11
11
  import { logError } from "../../utils/logging/logError";
12
12
  import { sendErrorLog } from "../../utils/logging/sendErrorLog";
13
+ import { safeGetItem } from "../../utils/safeStorage";
13
14
  import { filterValidTests } from "../../utils/varianceTest/filterValidTests";
14
15
  const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(() => ({
15
16
  addressFormRenderType: 'stripe',
@@ -36,9 +37,9 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(()
36
37
  landedCostData: null,
37
38
  landedCostMethod: 'DDP',
38
39
  partiesData: [],
39
- promoCode: sessionStorage.getItem('zonos--promo-code') || '',
40
+ promoCode: safeGetItem('session', 'zonos--promo-code') || '',
40
41
  // When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
41
- promoCodeApplied: !!sessionStorage.getItem('zonos--promo-code'),
42
+ promoCodeApplied: !!safeGetItem('session', 'zonos--promo-code'),
42
43
  promoCodeError: false,
43
44
  restrictedItems: [],
44
45
  selectedLandedCost: null,
@@ -18,13 +18,14 @@ import { jsonParse } from "../../utils/jsonParse";
18
18
  import { allLogs, log } from "../../utils/logging/log";
19
19
  import { logError } from "../../utils/logging/logError";
20
20
  import { sendErrorLog } from "../../utils/logging/sendErrorLog";
21
+ import { safeGetItem, safeRemoveItem, safeSetItem, } from "../../utils/safeStorage";
21
22
  import { validateCheckoutSession } from "../../utils/validateCheckoutSession";
22
23
  import { addressRuleStyle } from "../../../styles/stripe/addressRuleStyle";
23
24
  import { defaultVariable } from "../../../styles/stripe/defaultVariable";
24
25
  import { checkoutPaymentProcessorType, } from "../../../types/generated/graphql.internal.types";
25
26
  const { onChange: stripeStoreOnChange, reset, state: stripeStore, } = createStore(() => ({
26
27
  checkoutSettlementCurrency: 'USD',
27
- clientSecret: sessionStorage.getItem('zonos--client-secret') || '',
28
+ clientSecret: safeGetItem('session', 'zonos--client-secret') || '',
28
29
  companyName: '',
29
30
  companyNameUsedWhenAsyncAddressUpdate: '',
30
31
  customAddressErrors: {
@@ -134,14 +135,14 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
134
135
  };
135
136
  };
136
137
  const stripeStoreCleanupDomesticShippingSession = () => {
137
- window.sessionStorage.removeItem('zonos--bigcommerce-domestic-checkout-shipping');
138
+ safeRemoveItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
138
139
  };
139
140
  // Save shipping address to session storage
140
141
  const stripeStoreSaveDomesticShippingSession = (props) => {
141
- window.sessionStorage.setItem('zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
142
+ safeSetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
142
143
  };
143
144
  const stripeStoreGetDomesticShippingSession = () => {
144
- const session = window.sessionStorage.getItem('zonos--bigcommerce-domestic-checkout-shipping');
145
+ const session = safeGetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
145
146
  return jsonParse(session);
146
147
  };
147
148
  const initStripeElements = async (props) => {
@@ -188,7 +189,7 @@ const initStripeElements = async (props) => {
188
189
  };
189
190
  const stripeStoreReset = () => {
190
191
  // clean clientSecret so that we can start the new one.
191
- sessionStorage.removeItem('zonos--client-secret');
192
+ safeRemoveItem('session', 'zonos--client-secret');
192
193
  // cleanup stripe elements
193
194
  reset();
194
195
  // set stripe back to window.Zonos.stripe
@@ -521,7 +522,7 @@ const stripeCalculateLandedCost = async () => {
521
522
  cartStore.promoCodeError = isInvalidPromoCode;
522
523
  // When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
523
524
  if (!isInvalidPromoCode) {
524
- sessionStorage.setItem('zonos--promo-code', cartStore.promoCode);
525
+ safeSetItem('session', 'zonos--promo-code', cartStore.promoCode);
525
526
  }
526
527
  };
527
528
  const stripeStorePrefetchLandedCost = async (params) => {
@@ -653,7 +654,7 @@ const stripeStoreApplyPromoCode = async () => {
653
654
  };
654
655
  const stripeStoreResetPromoCode = () => {
655
656
  cartStore.promoCode = '';
656
- sessionStorage.removeItem('zonos--promo-code');
657
+ safeRemoveItem('session', 'zonos--promo-code');
657
658
  // reset promocode error state
658
659
  cartStore.promoCodeError = false;
659
660
  cartStore.promoCodeApplied = false;
@@ -1275,10 +1276,10 @@ const stripeStoreTranslateAddressToLatin = async ({ addressInvalidCharactersList
1275
1276
  stripeStoreOnChange('clientSecret', clientSecret => {
1276
1277
  // update stripe elements when client secret changes
1277
1278
  if (clientSecret && stripeStore.stripe) {
1278
- sessionStorage.setItem('zonos--client-secret', clientSecret);
1279
+ safeSetItem('session', 'zonos--client-secret', clientSecret);
1279
1280
  }
1280
1281
  if (!clientSecret) {
1281
- sessionStorage.removeItem('zonos--client-secret');
1282
+ safeRemoveItem('session', 'zonos--client-secret');
1282
1283
  }
1283
1284
  });
1284
1285
  export { initStripeElements, stripeCalculateLandedCost, stripeStore, stripeStoreApplyPromoCode, stripeStoreAsyncAddressUpdate, stripeStoreBuildAddressForPartyCreate, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreGetDomesticShippingSession, stripeStoreGetPaymentIntent, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStoreMessageBasedOnStatus, stripeStoreOnChange, stripeStorePrefetchLandedCost, stripeStoreRemovePromoCode, stripeStoreReset, stripeStoreResetPromoCode, stripeStoreRetrievePayment, stripeStoreSaveDomesticShippingSession, stripeStoreTranslateAddressToLatin, stripeStoreUpdateCheckoutSession, stripeStoreUpdateCheckoutSessionBaseCurrency, };
@@ -1,5 +1,6 @@
1
1
  import { createStore } from "@stencil/store";
2
2
  import { jsonParse } from "../utils/jsonParse";
3
+ import { safeGetItem, safeRemoveItem, safeSetItem, } from "../utils/safeStorage";
3
4
  import { filterValidTests } from "../utils/varianceTest/filterValidTests";
4
5
  /**
5
6
  * Expiration time for variant test keys in milliseconds
@@ -7,24 +8,24 @@ import { filterValidTests } from "../utils/varianceTest/filterValidTests";
7
8
  */
8
9
  export const VARIANT_TEST_KEY_EXPIRATION = 60 * 60 * 24 * 1000;
9
10
  const { onChange: storageStoreOnChange, state: storageStore } = createStore({
10
- checkoutSessionId: sessionStorage.getItem('zonos--checkout-session-id'),
11
- enabledVariantTestKeys: jsonParse(localStorage.getItem('zonos--enabled-variant-test-keys')),
11
+ checkoutSessionId: safeGetItem('session', 'zonos--checkout-session-id'),
12
+ enabledVariantTestKeys: jsonParse(safeGetItem('local', 'zonos--enabled-variant-test-keys')),
12
13
  });
13
14
  storageStoreOnChange('enabledVariantTestKeys', () => {
14
15
  var _a;
15
16
  // This should be set in localStorage so we don't have multiple tests for the same user in short period of time
16
17
  if (!((_a = storageStore.enabledVariantTestKeys) === null || _a === void 0 ? void 0 : _a.length)) {
17
- localStorage.removeItem('zonos--enabled-variant-test-keys');
18
+ safeRemoveItem('local', 'zonos--enabled-variant-test-keys');
18
19
  return;
19
20
  }
20
- localStorage.setItem('zonos--enabled-variant-test-keys', JSON.stringify(storageStore.enabledVariantTestKeys));
21
+ safeSetItem('local', 'zonos--enabled-variant-test-keys', JSON.stringify(storageStore.enabledVariantTestKeys));
21
22
  });
22
23
  storageStoreOnChange('checkoutSessionId', () => {
23
24
  if (!storageStore.checkoutSessionId) {
24
- sessionStorage.removeItem('zonos--checkout-session-id');
25
+ safeRemoveItem('session', 'zonos--checkout-session-id');
25
26
  return;
26
27
  }
27
- sessionStorage.setItem('zonos--checkout-session-id', storageStore.checkoutSessionId);
28
+ safeSetItem('session', 'zonos--checkout-session-id', storageStore.checkoutSessionId);
28
29
  });
29
30
  const storageStoreSetEnabledVariantTestKeys = (testKeys) => {
30
31
  storageStore.enabledVariantTestKeys = filterValidTests(testKeys);
@@ -0,0 +1,24 @@
1
+ const restores = [];
2
+ /** Replace a storage getter so the next read throws SecurityError. */
3
+ export const blockStorage = (area) => {
4
+ const descriptor = Object.getOwnPropertyDescriptor(window, area);
5
+ Object.defineProperty(window, area, {
6
+ configurable: true,
7
+ get() {
8
+ throw new DOMException('The operation is insecure', 'SecurityError');
9
+ },
10
+ });
11
+ restores.push(() => {
12
+ if (descriptor) {
13
+ Object.defineProperty(window, area, descriptor);
14
+ return;
15
+ }
16
+ Reflect.deleteProperty(window, area);
17
+ });
18
+ };
19
+ export const restoreBlockedStorage = () => {
20
+ var _a;
21
+ while (restores.length > 0) {
22
+ (_a = restores.pop()) === null || _a === void 0 ? void 0 : _a();
23
+ }
24
+ };
@@ -1,5 +1,6 @@
1
1
  import { handleFetch } from "../handleFetch";
2
2
  import { logError } from "../logging/logError";
3
+ import { safeSetItem } from "../safeStorage";
3
4
  const defaultUsExchangeRate = {
4
5
  exchangeRate: {
5
6
  rate: 1,
@@ -33,7 +34,7 @@ export const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, t
33
34
  const { rate, targetFormat } = json.exchangeRateCreate;
34
35
  const maxAge = json.maxAge;
35
36
  if (rate) {
36
- sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
37
+ safeSetItem('session', `${country}_rate`, JSON.stringify(rate));
37
38
  const exchangeRate = { rate, targetFormat };
38
39
  return { exchangeRate, maxAge };
39
40
  }
@@ -17,6 +17,7 @@ import { jsonParse } from "./jsonParse";
17
17
  import { log } from "./logging/log";
18
18
  import { prepLoadTimeApiLog } from "./logging/prepLoadTimeApiLog";
19
19
  import { sendErrorLog } from "./logging/sendErrorLog";
20
+ const isGatewayStatus = (status) => status === 502 || status === 503 || status === 504;
20
21
  const getResponseBody = async ({ response, shouldLog = true, shouldThrow = false, }) => {
21
22
  try {
22
23
  const text = await response.text();
@@ -137,28 +138,31 @@ const handleRequest = async ({ basePathType, options, path, }) => {
137
138
  }
138
139
  catch (_a) {
139
140
  const message = 'Unknown error';
141
+ // A gateway HTML or empty body still carries a status a GET can fail over
142
+ // on. Other non-JSON statuses, including 404 and 500, keep the previous
143
+ // null response so they do not fail over.
140
144
  return {
141
145
  baseUrl,
142
146
  errors: [{ message: `${status}: ${message}`, type: status }],
143
147
  json: null,
144
- response: null,
148
+ response: isGatewayStatus(response.status) ? response : null,
145
149
  zonosMode,
146
150
  };
147
151
  }
148
152
  };
149
153
  const handleRequestWithFallback = async ({ basePathType: _basePathType, options, path, }) => {
150
- var _a, _b;
154
+ var _a, _b, _c;
151
155
  // use vercel API if the path is `/api/bigcommerce`
152
156
  const isBigcommerceEndpoint = path.startsWith('/api/bigcommerce');
153
157
  const basePathType = isBigcommerceEndpoint
154
158
  ? 'vercel'
155
159
  : _basePathType;
156
160
  const startTime = performance.now();
157
- const _c = await handleRequest({
161
+ const _d = await handleRequest({
158
162
  basePathType,
159
163
  options,
160
164
  path,
161
- }), { errors, response } = _c, rest = __rest(_c, ["errors", "response"]);
165
+ }), { errors, response } = _d, rest = __rest(_d, ["errors", "response"]);
162
166
  const endTime = performance.now();
163
167
  const duration = endTime - startTime;
164
168
  // Send the load time api log
@@ -180,10 +184,16 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
180
184
  (message.includes('signal is aborted') ||
181
185
  message.includes('The operation was aborted') ||
182
186
  message.includes('Fetch is aborted')));
183
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
184
- const shouldCallFallback =
185
- // If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
186
- nextFallbackApiType && isUnknownError;
187
+ const statusCode = response === null || response === void 0 ? void 0 : response.status;
188
+ const gateway = statusCode !== undefined && isGatewayStatus(statusCode);
189
+ // handleFetch sets method, and a missing method is a GET.
190
+ const isIdempotentGet = ((_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : 'GET').toUpperCase() === 'GET';
191
+ const failedWithoutGateway = !!unknownError || statusCode === 404 || statusCode === 500;
192
+ const isUnknownError = failedWithoutGateway || gateway;
193
+ // Replay 502, 503, and 504 only for GET. A gateway timeout on a POST can
194
+ // mean the first host is still finishing a payment or order write.
195
+ const shouldCallFallback = nextFallbackApiType &&
196
+ (failedWithoutGateway || (gateway && isIdempotentGet));
187
197
  // Should log the error if it's unknown error
188
198
  if (isUnknownError && !isAbortError) {
189
199
  void sendErrorLog({
@@ -193,7 +203,7 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
193
203
  currentBasePath: basePathType,
194
204
  nextFallbackApiType,
195
205
  requestHeaders: options === null || options === void 0 ? void 0 : options.headers,
196
- 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()),
206
+ 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()),
197
207
  shouldCallFallback,
198
208
  status: response === null || response === void 0 ? void 0 : response.status,
199
209
  statusText: response === null || response === void 0 ? void 0 : response.statusText,
@@ -1,55 +1,32 @@
1
1
  import { isCountryCode } from "./isCountryCode";
2
+ import { safeGetItem, safeRemoveItem, safeSetItem, } from "../safeStorage";
2
3
  const COUNTRY_OVERRIDE_KEY = 'zonos--country';
3
- const withBlockedStorage = (run) => {
4
- try {
5
- run();
6
- }
7
- catch (_a) {
8
- // localStorage/sessionStorage can throw in blocked-storage contexts
9
- // (Safari private mode, cross-origin iframes).
10
- }
11
- };
12
- const readStoredCountry = (storage) => {
13
- try {
14
- const value = storage.getItem(COUNTRY_OVERRIDE_KEY);
15
- if (!value || !isCountryCode(value)) {
16
- return null;
17
- }
18
- return value;
19
- }
20
- catch (_a) {
4
+ const readStoredCountry = (area) => {
5
+ const value = safeGetItem(area, COUNTRY_OVERRIDE_KEY);
6
+ if (!value || !isCountryCode(value)) {
21
7
  return null;
22
8
  }
9
+ return value;
23
10
  };
24
- const writeOverride = (storage, countryCode) => {
25
- storage.setItem(COUNTRY_OVERRIDE_KEY, countryCode);
26
- };
27
- const withEachStorage = (run) => {
28
- withBlockedStorage(() => run(window.localStorage));
29
- withBlockedStorage(() => run(window.sessionStorage));
30
- };
31
- export const getCountryOverrideStorage = () => {
32
- var _a;
33
- return (_a = readStoredCountry(window.localStorage)) !== null && _a !== void 0 ? _a : readStoredCountry(window.sessionStorage);
34
- };
11
+ export const getCountryOverrideStorage = () => { var _a; return (_a = readStoredCountry('local')) !== null && _a !== void 0 ? _a : readStoredCountry('session'); };
35
12
  export const migrateCountryOverrideStorage = (selectedCountryCode) => {
36
13
  if (!selectedCountryCode) {
37
14
  return;
38
15
  }
39
- withBlockedStorage(() => {
40
- const localCountry = readStoredCountry(window.localStorage);
41
- // Only mirror the country Hello actually kept. A failed localStorage
42
- // clear can leave a discarded country in local; never copy that to
43
- // session for older Elements. Never copy session → local.
44
- if (localCountry === selectedCountryCode) {
45
- writeOverride(window.sessionStorage, localCountry);
46
- }
47
- });
16
+ const localCountry = readStoredCountry('local');
17
+ // Only mirror the country Hello actually kept. A failed localStorage
18
+ // clear can leave a discarded country in local; never copy that to
19
+ // session for older Elements. Never copy session → local.
20
+ if (localCountry === selectedCountryCode) {
21
+ safeSetItem('session', COUNTRY_OVERRIDE_KEY, localCountry);
22
+ }
48
23
  };
49
24
  export const setCountryOverrideStorage = (countryCode) => {
50
25
  // Dual-write so older Elements that only read sessionStorage see the pick.
51
- withEachStorage(storage => writeOverride(storage, countryCode));
26
+ safeSetItem('local', COUNTRY_OVERRIDE_KEY, countryCode);
27
+ safeSetItem('session', COUNTRY_OVERRIDE_KEY, countryCode);
52
28
  };
53
29
  export const clearCountryOverrideStorage = () => {
54
- withEachStorage(storage => storage.removeItem(COUNTRY_OVERRIDE_KEY));
30
+ safeRemoveItem('local', COUNTRY_OVERRIDE_KEY);
31
+ safeRemoveItem('session', COUNTRY_OVERRIDE_KEY);
55
32
  };