@zonos/elements 1.5.1 → 1.5.3

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 (250) hide show
  1. package/dist/cjs/_isBigCommerceNativeCheckout-3-xbKbAO.js +133 -0
  2. package/dist/cjs/{cart-CiXlehwQ.js → cart-C39TMSgB.js} +27 -13
  3. package/dist/cjs/{collect-Drr8fY-q.js → collect-lF9DenLk.js} +4 -4
  4. package/dist/cjs/{getMissingRequiredShippingFields-DI6qF1z3.js → getMissingRequiredShippingFields-svcnpumn.js} +1 -1
  5. package/dist/cjs/{handleFetch-DQLhurnE.js → handleFetch-DVfjFTYO.js} +181 -71
  6. package/dist/cjs/{hasInclusivePrice-84KS94yH.js → hasInclusivePrice-CEPf3_FG.js} +1 -1
  7. package/dist/cjs/index.cjs.js +158 -47
  8. package/dist/cjs/{invoice-5hVfSXpb.js → invoice-BD3pCr8P.js} +3 -3
  9. package/dist/cjs/{localization-B2mjW0Xa.js → localization-BhNVhLZs.js} +24 -48
  10. package/dist/cjs/{paypal-pd8Nz_R_.js → paypal-Bd1qmwiv.js} +4 -4
  11. package/dist/cjs/{placeTestOrder-DrI8rD9o.js → placeTestOrder-BMQRvX2q.js} +3 -3
  12. package/dist/cjs/{renderCheckoutCurrency-u5q8YdUb.js → renderCheckoutCurrency-DE2p8CT8.js} +2 -2
  13. package/dist/cjs/{shouldShowLanguageSelect-gBg4KeTQ.js → shouldShowLanguageSelect-NOVWOU53.js} +1 -1
  14. package/dist/cjs/{submitGtag-Rc-S3PnH.js → submitGtag-D4sB7w4z.js} +1 -1
  15. package/dist/cjs/{taxIdFields-BrIaPTcd.js → taxIdFields-BKbk2bhi.js} +2 -2
  16. package/dist/cjs/{updateCheckoutSessionAttributes-d0IKpwW8.js → updateCheckoutSessionAttributes-KxwcsKhM.js} +1 -1
  17. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +6 -6
  18. package/dist/cjs/zonos-address-display_2.cjs.entry.js +2 -2
  19. package/dist/cjs/zonos-address_4.cjs.entry.js +4 -4
  20. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +4 -4
  21. package/dist/cjs/zonos-card_5.cjs.entry.js +5 -5
  22. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +18 -18
  23. package/dist/cjs/zonos-checkout.cjs.entry.js +48 -22
  24. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +3 -3
  25. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +9 -9
  26. package/dist/cjs/zonos-collect.cjs.entry.js +6 -6
  27. package/dist/cjs/zonos-controller.cjs.entry.js +65 -40
  28. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  29. package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
  30. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
  31. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  32. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +5 -5
  33. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +9 -9
  34. package/dist/cjs/zonos-invoice.cjs.entry.js +6 -6
  35. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  36. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +4 -4
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +8 -7
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +14 -4
  39. package/dist/collection/components/main/mountCheckoutWithoutStripe.js +12 -0
  40. package/dist/collection/components/main/zonos-controller.js +26 -10
  41. package/dist/collection/components/store/checkout/cart.js +3 -2
  42. package/dist/collection/components/store/checkout/stripe.js +23 -10
  43. package/dist/collection/components/store/storageStore.js +7 -6
  44. package/dist/collection/components/utils/__tests__/helpers/blockStorage.js +24 -0
  45. package/dist/collection/components/utils/api/getExchangeRate.js +2 -1
  46. package/dist/collection/components/utils/checkout/isBigCommerceCheckoutBypassEnabled.js +2 -1
  47. package/dist/collection/components/utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect.js +32 -12
  48. package/dist/collection/components/utils/handleFetch.js +19 -9
  49. package/dist/collection/components/utils/hello/countryOverrideStorage.js +17 -40
  50. package/dist/collection/components/utils/logging/installConstructorCapture.js +58 -0
  51. package/dist/collection/components/utils/logging/reportBlockedStorage.js +34 -0
  52. package/dist/collection/components/utils/logging/sendErrorLog.js +8 -1
  53. package/dist/collection/components/utils/logging/startZonosInit.js +35 -0
  54. package/dist/collection/components/utils/logging/thrownMessage.js +16 -0
  55. package/dist/collection/components/utils/safeStorage.js +39 -0
  56. package/dist/collection/scripts/_bigcommerceCheckoutPath.js +16 -0
  57. package/dist/collection/scripts/_detectBigCommerceHost.js +12 -0
  58. package/dist/collection/scripts/_getZonosQaUrl.js +3 -2
  59. package/dist/collection/scripts/_isBigCommerceNativeCheckout.js +107 -0
  60. package/dist/collection/scripts/_loadStripe.js +15 -4
  61. package/dist/collection/scripts/_zonosBase.js +46 -33
  62. package/dist/collection/types/generated/graphql.frontend.types.js +0 -16
  63. package/dist/collection/types/generated/graphql.internal.types.js +215 -1
  64. package/dist/esm/_isBigCommerceNativeCheckout-Bb90IMVt.js +128 -0
  65. package/dist/esm/{cart-DmJkjiDE.js → cart-b84n0nhi.js} +26 -14
  66. package/dist/esm/{collect-BV5GTPmh.js → collect-B_AEVONL.js} +4 -4
  67. package/dist/esm/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-EY10c34-.js} +1 -1
  68. package/dist/esm/{handleFetch-D5GYDF-O.js → handleFetch-BFVO7oAR.js} +178 -72
  69. package/dist/esm/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-DfEiyzw7.js} +1 -1
  70. package/dist/esm/index.js +158 -47
  71. package/dist/esm/{invoice-CO-iqlni.js → invoice-dQ0ONK5Q.js} +3 -3
  72. package/dist/esm/{localization-DHM91diu.js → localization-B5CRzthT.js} +25 -49
  73. package/dist/esm/{paypal-BfW5aLJw.js → paypal-CF_oM0B6.js} +4 -4
  74. package/dist/esm/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BTpfyqPL.js} +3 -3
  75. package/dist/esm/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-CpeuDWx-.js} +2 -2
  76. package/dist/esm/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-CJinx9-m.js} +1 -1
  77. package/dist/esm/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
  78. package/dist/esm/{taxIdFields-ByEYfsO5.js → taxIdFields-BCyXnc9O.js} +2 -2
  79. package/dist/esm/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
  80. package/dist/esm/zonos-address-completion-dialog_7.entry.js +6 -6
  81. package/dist/esm/zonos-address-display_2.entry.js +2 -2
  82. package/dist/esm/zonos-address_4.entry.js +4 -4
  83. package/dist/esm/zonos-airwallex-payment.entry.js +4 -4
  84. package/dist/esm/zonos-card_5.entry.js +5 -5
  85. package/dist/esm/zonos-cart-items_12.entry.js +18 -18
  86. package/dist/esm/zonos-checkout.entry.js +48 -22
  87. package/dist/esm/zonos-collect-cart-items_3.entry.js +3 -3
  88. package/dist/esm/zonos-collect-finish_6.entry.js +9 -9
  89. package/dist/esm/zonos-collect.entry.js +6 -6
  90. package/dist/esm/zonos-controller.entry.js +65 -40
  91. package/dist/esm/zonos-country-flag.entry.js +2 -2
  92. package/dist/esm/zonos-country-select_4.entry.js +3 -3
  93. package/dist/esm/zonos-hello-dialog.entry.js +3 -3
  94. package/dist/esm/zonos-hello.entry.js +2 -2
  95. package/dist/esm/zonos-invoice-cart-items_2.entry.js +5 -5
  96. package/dist/esm/zonos-invoice-finish_5.entry.js +9 -9
  97. package/dist/esm/zonos-invoice.entry.js +6 -6
  98. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  99. package/dist/esm/zonos-policy-consent_2.entry.js +4 -4
  100. package/dist/esm-es5/_isBigCommerceNativeCheckout-Bb90IMVt.js +40 -0
  101. package/dist/esm-es5/{cart-DmJkjiDE.js → cart-b84n0nhi.js} +59 -59
  102. package/dist/esm-es5/{collect-BV5GTPmh.js → collect-B_AEVONL.js} +2 -2
  103. package/dist/esm-es5/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-EY10c34-.js} +3 -3
  104. package/dist/esm-es5/handleFetch-BFVO7oAR.js +73 -0
  105. package/dist/esm-es5/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-DfEiyzw7.js} +1 -1
  106. package/dist/esm-es5/index.js +94 -65
  107. package/dist/esm-es5/{invoice-CO-iqlni.js → invoice-dQ0ONK5Q.js} +1 -1
  108. package/dist/esm-es5/{localization-DHM91diu.js → localization-B5CRzthT.js} +7 -10
  109. package/dist/esm-es5/{paypal-BfW5aLJw.js → paypal-CF_oM0B6.js} +1 -1
  110. package/dist/esm-es5/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BTpfyqPL.js} +1 -1
  111. package/dist/esm-es5/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-CpeuDWx-.js} +5 -5
  112. package/dist/esm-es5/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-CJinx9-m.js} +1 -1
  113. package/dist/esm-es5/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
  114. package/dist/esm-es5/{taxIdFields-ByEYfsO5.js → taxIdFields-BCyXnc9O.js} +1 -1
  115. package/dist/esm-es5/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
  116. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +2 -2
  117. package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
  118. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  119. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  120. package/dist/esm-es5/zonos-card_5.entry.js +6 -6
  121. package/dist/esm-es5/zonos-cart-items_12.entry.js +127 -127
  122. package/dist/esm-es5/zonos-checkout.entry.js +22 -11
  123. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  124. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  125. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  126. package/dist/esm-es5/zonos-controller.entry.js +21 -12
  127. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  128. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  129. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  130. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  131. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  132. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  133. package/dist/esm-es5/zonos-invoice.entry.js +3 -3
  134. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  135. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  136. package/dist/scripts/index.d.ts +22 -0
  137. package/dist/scripts/index.js +1 -1
  138. package/dist/scripts/loadZonos.js +1 -1
  139. package/dist/scripts/zonos.js +1 -1
  140. package/dist/types/components/main/mountCheckoutWithoutStripe.d.ts +8 -0
  141. package/dist/types/components/store/checkout/stripe.d.ts +4 -1
  142. package/dist/types/components/utils/__tests__/helpers/blockStorage.d.ts +3 -0
  143. package/dist/types/components/utils/logging/installConstructorCapture.d.ts +20 -0
  144. package/dist/types/components/utils/logging/reportBlockedStorage.d.ts +16 -0
  145. package/dist/types/components/utils/logging/startZonosInit.d.ts +5 -0
  146. package/dist/types/components/utils/logging/thrownMessage.d.ts +1 -0
  147. package/dist/types/components/utils/safeStorage.d.ts +4 -0
  148. package/dist/types/scripts/_bigcommerceCheckoutPath.d.ts +12 -0
  149. package/dist/types/scripts/_detectBigCommerceHost.d.ts +5 -0
  150. package/dist/types/scripts/_isBigCommerceNativeCheckout.d.ts +21 -0
  151. package/dist/types/scripts/_zonosBase.d.ts +16 -0
  152. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
  153. package/dist/types/types/generated/graphql.frontend.types.d.ts +0 -22
  154. package/dist/types/types/generated/graphql.frontend.types.ts +0 -51
  155. package/dist/types/types/generated/graphql.internal.types.d.ts +270 -1
  156. package/dist/types/types/generated/graphql.internal.types.ts +341 -1
  157. package/dist/zonos-elements/index.esm.js +1 -1
  158. package/dist/zonos-elements/{p-8fa6cfff.entry.js → p-02faff47.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-216a908d.system.entry.js → p-0c68cbbb.system.entry.js} +2 -2
  160. package/dist/zonos-elements/{p-vTIygnHq.system.js → p-1OG3IJgY.system.js} +1 -1
  161. package/dist/zonos-elements/{p-960070d0.system.entry.js → p-1cd2d097.system.entry.js} +3 -3
  162. package/dist/zonos-elements/{p-1e6db427.entry.js → p-255e411a.entry.js} +1 -1
  163. package/dist/zonos-elements/p-2c_UqKJL.system.js +7 -0
  164. package/dist/zonos-elements/{p-DprOoI2W.system.js → p-3AUMK-5E.system.js} +154 -154
  165. package/dist/zonos-elements/{p-d3345b2c.entry.js → p-3ee87d8b.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-cccaad60.system.entry.js → p-42fa5694.system.entry.js} +10 -10
  167. package/dist/zonos-elements/p-49eaaab8.entry.js +1 -0
  168. package/dist/zonos-elements/{p-fda89981.system.entry.js → p-4ce4c49f.system.entry.js} +3 -3
  169. package/dist/zonos-elements/{p-f3d9a380.system.entry.js → p-5622fc50.system.entry.js} +263 -252
  170. package/dist/zonos-elements/{p-5585db86.system.entry.js → p-59457fd9.system.entry.js} +73 -64
  171. package/dist/zonos-elements/{p-65817880.entry.js → p-66398133.entry.js} +1 -1
  172. package/dist/zonos-elements/{p-d8f375da.system.entry.js → p-674323ac.system.entry.js} +1 -1
  173. package/dist/zonos-elements/{p-678b9214.entry.js → p-71d9a5b7.entry.js} +1 -1
  174. package/dist/zonos-elements/{p-189cc594.system.entry.js → p-81780f8f.system.entry.js} +2 -2
  175. package/dist/zonos-elements/{p-6e691736.entry.js → p-821b83a2.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-1fda4aec.system.entry.js → p-877a82d2.system.entry.js} +94 -94
  177. package/dist/zonos-elements/p-8daec112.entry.js +1 -0
  178. package/dist/zonos-elements/{p-46a839d2.system.entry.js → p-93bc75fd.system.entry.js} +13 -13
  179. package/dist/zonos-elements/{p-2ca826b9.system.entry.js → p-976b3bf3.system.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-84e76348.entry.js → p-9a4947a5.entry.js} +1 -1
  181. package/dist/zonos-elements/p-9f7693bf.entry.js +1 -0
  182. package/dist/zonos-elements/p-BIJM2Kj-.js +1 -0
  183. package/dist/zonos-elements/p-BJFa5RwX.js +1 -0
  184. package/dist/zonos-elements/{p-6vSUiBfr.system.js → p-BOh4ifdL.system.js} +51 -54
  185. package/dist/zonos-elements/p-BZAX-HmS.js +1 -0
  186. package/dist/zonos-elements/p-Bb90IMVt.js +1 -0
  187. package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
  188. package/dist/zonos-elements/{p-CbhN65lj.system.js → p-BvoPE_nb.system.js} +1 -1
  189. package/dist/zonos-elements/{p-iAIzUA4k.js → p-C3E55OqH.js} +1 -1
  190. package/dist/zonos-elements/{p-CBUz18kA.system.js → p-C3gF3UV5.system.js} +23 -23
  191. package/dist/zonos-elements/{p-XoQH3S7Z.system.js → p-CD2ahEZn.system.js} +1 -1
  192. package/dist/zonos-elements/p-CEBBLbvF.js +1 -0
  193. package/dist/zonos-elements/{p-CGNVm52g.system.js → p-CEV0O_IQ.system.js} +5 -5
  194. package/dist/zonos-elements/{p-D1e9zNDA.js → p-CJmWr75U.js} +1 -1
  195. package/dist/zonos-elements/{p-DgUrB-1a.system.js → p-CZ-uYiCo.system.js} +1 -1
  196. package/dist/zonos-elements/p-Cn2xE-9t.system.js +256 -0
  197. package/dist/zonos-elements/p-CtvXi9wL.system.js +41 -0
  198. package/dist/zonos-elements/{p-BrQ8n8NS.system.js → p-Cw_Qnyow.system.js} +3 -3
  199. package/dist/zonos-elements/p-CzXNXgyI.js +1 -0
  200. package/dist/zonos-elements/p-D0DkOoAw.system.js +73 -0
  201. package/dist/zonos-elements/p-D9OPKqLg.js +1 -0
  202. package/dist/zonos-elements/{p-ojtNq-r5.system.js → p-DXlojp_Y.system.js} +1 -1
  203. package/dist/zonos-elements/{p-DpwmHU8R.js → p-Df62LRNs.js} +2 -2
  204. package/dist/zonos-elements/{p-CHKKvuiz.js → p-Lsqrpzc5.js} +1 -1
  205. package/dist/zonos-elements/{p-C9XLkmmb.system.js → p-YQFbWtjn.system.js} +1 -1
  206. package/dist/zonos-elements/p-a27f48e4.entry.js +1 -0
  207. package/dist/zonos-elements/{p-941a95a1.system.entry.js → p-a6bb296c.system.entry.js} +7 -7
  208. package/dist/zonos-elements/{p-2b63865a.system.entry.js → p-abb85879.system.entry.js} +3 -3
  209. package/dist/zonos-elements/{p-12b24ebb.entry.js → p-b8653024.entry.js} +1 -1
  210. package/dist/zonos-elements/p-b9d7a3b6.entry.js +1 -0
  211. package/dist/zonos-elements/{p-f5f95990.system.entry.js → p-be067e12.system.entry.js} +15 -15
  212. package/dist/zonos-elements/p-bmrOH9oh.js +1 -0
  213. package/dist/zonos-elements/p-c185bc23.entry.js +1 -0
  214. package/dist/zonos-elements/{p-2d513aa3.entry.js → p-c6e78de2.entry.js} +1 -1
  215. package/dist/zonos-elements/{p-55813e9f.system.entry.js → p-ca97a1cd.system.entry.js} +3 -3
  216. package/dist/zonos-elements/{p-3e705c9b.entry.js → p-cbb96382.entry.js} +1 -1
  217. package/dist/zonos-elements/{p-53eac12f.system.entry.js → p-dbf4d156.system.entry.js} +14 -14
  218. package/dist/zonos-elements/{p-6410fa11.system.entry.js → p-df240119.system.entry.js} +16 -16
  219. package/dist/zonos-elements/{p-1cc42a98.system.entry.js → p-e16e4db6.system.entry.js} +17 -17
  220. package/dist/zonos-elements/{p-064d8829.system.entry.js → p-eb016dd8.system.entry.js} +20 -20
  221. package/dist/zonos-elements/{p-1199baef.system.entry.js → p-eb5c67a0.system.entry.js} +1 -1
  222. package/dist/zonos-elements/{p-ef5344ea.entry.js → p-ed8a7a7f.entry.js} +1 -1
  223. package/dist/zonos-elements/{p-4917b74d.entry.js → p-ef932fda.entry.js} +1 -1
  224. package/dist/zonos-elements/{p-e7fdb2c9.entry.js → p-f792ba5f.entry.js} +1 -1
  225. package/dist/zonos-elements/{p-DiMEP3mh.js → p-fZcKMzE-.js} +1 -1
  226. package/dist/zonos-elements/{p-CMo3ZweU.js → p-fdritVtG.js} +1 -1
  227. package/dist/zonos-elements/p-fffe6376.entry.js +1 -0
  228. package/dist/zonos-elements/p-gEViRqvf.js +1 -0
  229. package/dist/zonos-elements/{p-Dtu_Japy.system.js → p-v8IEjQ2z.system.js} +39 -39
  230. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  231. package/package.json +10 -10
  232. package/dist/esm-es5/handleFetch-D5GYDF-O.js +0 -60
  233. package/dist/zonos-elements/p-107f287b.entry.js +0 -1
  234. package/dist/zonos-elements/p-25eb99d4.entry.js +0 -1
  235. package/dist/zonos-elements/p-46b9f0cf.entry.js +0 -1
  236. package/dist/zonos-elements/p-636b71d4.entry.js +0 -1
  237. package/dist/zonos-elements/p-7dc7f328.entry.js +0 -1
  238. package/dist/zonos-elements/p-8f9d8795.entry.js +0 -1
  239. package/dist/zonos-elements/p-BMPYH-LT.js +0 -1
  240. package/dist/zonos-elements/p-C70h5mKA.js +0 -1
  241. package/dist/zonos-elements/p-CTiqplrr.js +0 -1
  242. package/dist/zonos-elements/p-Ch1w0Lr7.js +0 -1
  243. package/dist/zonos-elements/p-D1SmY_fZ.js +0 -1
  244. package/dist/zonos-elements/p-D6xXnsM_.js +0 -1
  245. package/dist/zonos-elements/p-DE4a-QD5.js +0 -1
  246. package/dist/zonos-elements/p-DQrMfUzi.system.js +0 -227
  247. package/dist/zonos-elements/p-DZdkJHK9.system.js +0 -7
  248. package/dist/zonos-elements/p-U33isUJG.js +0 -1
  249. package/dist/zonos-elements/p-ebe157b5.entry.js +0 -1
  250. package/dist/zonos-elements/p-zVLAvre1.system.js +0 -60
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Two checkout-path rules, kept together so they cannot drift in separate files.
3
+ *
4
+ * `pathContainsCheckout` is the broad rule for zBypass and address detection.
5
+ * It still matches paths such as `checkout-page`.
6
+ *
7
+ * `hasExactCheckoutSegment` is the strict rule for the Stripe.js skip. Only a
8
+ * segment exactly equal to `checkout` counts, so a slug does not drop the
9
+ * payment script.
10
+ */
11
+ const pathContainsCheckout = (pathname) => {
12
+ return pathname.includes('/checkout');
13
+ };
14
+ const hasExactCheckoutSegment = (pathname) => {
15
+ return pathname.split('/').some(segment => segment === 'checkout');
16
+ };
17
+
18
+ /**
19
+ * Storefront signals BigCommerce sets before Zonos copies `isBigCommerce`.
20
+ * Shared by the loader script and the Stripe skip so the two cannot drift.
21
+ */
22
+ const detectBigCommerceHost = () => {
23
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
24
+ return false;
25
+ }
26
+ return (!!window.stencilBootstrap ||
27
+ !!window.bcConfig ||
28
+ !!document.querySelector('script[src*="bigcommerce.com"]'));
29
+ };
30
+
31
+ const hasCheckoutSegment = () => hasExactCheckoutSegment(window.location.pathname);
32
+ const sharedZonos = () => {
33
+ if (typeof window === 'undefined' || !('Zonos' in window)) {
34
+ return undefined;
35
+ }
36
+ return window.Zonos;
37
+ };
38
+ const isFlaggedBigCommerce = () => {
39
+ var _a;
40
+ return ((_a = sharedZonos()) === null || _a === void 0 ? void 0 : _a.isBigCommerce) === true;
41
+ };
42
+ /**
43
+ * The settled answer lives on `window.Zonos`, the object loadZonos.js,
44
+ * zonos.js, and the component bundle already share.
45
+ *
46
+ * A `true` result sticks for that pathname. A `false` result sticks once
47
+ * the path is not checkout, or once host detection has finished. A checkout
48
+ * path whose BigCommerce signals are not in the page yet stays unset, so a
49
+ * later signal can still settle it.
50
+ */
51
+ const readSettled = () => {
52
+ const zonos = sharedZonos();
53
+ if (zonos === undefined) {
54
+ return undefined;
55
+ }
56
+ if (zonos.isBigCommerceNativeCheckoutPath !== window.location.pathname) {
57
+ return undefined;
58
+ }
59
+ const value = zonos.isBigCommerceNativeCheckout;
60
+ if (value === true || value === false) {
61
+ return value;
62
+ }
63
+ return undefined;
64
+ };
65
+ const writeSettled = (value) => {
66
+ const zonos = sharedZonos();
67
+ if (zonos !== undefined) {
68
+ zonos.isBigCommerceNativeCheckout = value;
69
+ zonos.isBigCommerceNativeCheckoutPath = window.location.pathname;
70
+ }
71
+ return value;
72
+ };
73
+ /**
74
+ * Call after `isBigCommerce` has been copied from host detection. Writes the
75
+ * settled boolean onto `window.Zonos` for this pathname.
76
+ */
77
+ const markBigCommerceHostChecked = () => {
78
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
79
+ return;
80
+ }
81
+ const zonos = sharedZonos();
82
+ if (zonos === undefined) {
83
+ return;
84
+ }
85
+ const native = hasCheckoutSegment() && (detectBigCommerceHost() || isFlaggedBigCommerce());
86
+ zonos.isBigCommerceNativeCheckout = native;
87
+ zonos.isBigCommerceNativeCheckoutPath = window.location.pathname;
88
+ };
89
+ const decide = () => {
90
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
91
+ return false;
92
+ }
93
+ const settled = readSettled();
94
+ if (settled !== undefined) {
95
+ return settled;
96
+ }
97
+ if (!hasCheckoutSegment()) {
98
+ return writeSettled(false);
99
+ }
100
+ if (detectBigCommerceHost() || isFlaggedBigCommerce()) {
101
+ return writeSettled(true);
102
+ }
103
+ return undefined;
104
+ };
105
+ /**
106
+ * True when this document is BigCommerce native checkout.
107
+ * Stripe.js injection is owned by `loadStripeScript` in `_loadStripe.ts`.
108
+ * Other callers use this for a different job: skip `attachCheckout`, leave
109
+ * the store's buttons enabled, or hand a leftover domestic session to `/`.
110
+ * An undecided checkout path returns false and is not stored.
111
+ */
112
+ const isBigCommerceNativeCheckout = () => {
113
+ return decide() === true;
114
+ };
115
+ /**
116
+ * True when Stripe.js must not be injected. An undecided checkout path
117
+ * holds the script until host detection finishes, instead of storing "not
118
+ * native checkout" and injecting v3 early.
119
+ */
120
+ const holdStripeForNativeCheckout = () => {
121
+ const decision = decide();
122
+ if (decision === undefined) {
123
+ return true;
124
+ }
125
+ return decision;
126
+ };
127
+
128
+ export { holdStripeForNativeCheckout as h, isBigCommerceNativeCheckout as i, markBigCommerceHostChecked as m, pathContainsCheckout as p };
@@ -1,9 +1,9 @@
1
1
  import { c as createStore, z as zonosStore, e as getShouldRequirePeruTaxId } from './zonosStore-BXP9FvIt.js';
2
- import { s as storageStore, t as translate, m as getOverridenZCountry, l as localizationStore, f as filterValidTests, e as storageStoreSetEnabledVariantTestKeys } from './localization-DHM91diu.js';
2
+ import { s as storageStore, t as translate, n as getOverridenZCountry, l as localizationStore, f as filterValidTests, e as storageStoreSetEnabledVariantTestKeys } from './localization-B5CRzthT.js';
3
3
  import { b as isPeruTaxIdActive, e as taxIdTypeOptionsForCheckout } from './taxIdRules-xYlx7ZXW.js';
4
4
  import { e as euCountryCodes, i as isCountryRequireTaxId } from './TaxId-DMIgN_sT.js';
5
5
  import { l as log, b as allLogs } from './VarianceTest-BJmZPrZl.js';
6
- import { h as handleFetch, l as logError, f as fallbackApiList, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, j as jsonParse } from './handleFetch-D5GYDF-O.js';
6
+ import { h as handleFetch, l as logError, f as fallbackApiList, g as getIsTestMode, a as getIsStagingMode, s as sendErrorLog, c as safeGetItem, e as safeSetItem, b as safeRemoveItem, j as jsonParse } from './handleFetch-BFVO7oAR.js';
7
7
  import { i as isDarkColor } from './isDarkColor-YdrG78th.js';
8
8
  import { g as getBorderRadius } from './getBorderRadius-BiGd45jw.js';
9
9
 
@@ -972,7 +972,7 @@ const checkoutPaymentProcessorType = {
972
972
 
973
973
  const { onChange: stripeStoreOnChange, reset: reset$1, state: stripeStore, } = createStore(() => ({
974
974
  checkoutSettlementCurrency: 'USD',
975
- clientSecret: sessionStorage.getItem('zonos--client-secret') || '',
975
+ clientSecret: safeGetItem('session', 'zonos--client-secret') || '',
976
976
  companyName: '',
977
977
  companyNameUsedWhenAsyncAddressUpdate: '',
978
978
  customAddressErrors: {
@@ -1081,15 +1081,27 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
1081
1081
  locale: localizationStore.selectedLocale,
1082
1082
  };
1083
1083
  };
1084
+ const DOMESTIC_SESSION_REDIRECT_MARKER = 'zonos--bc-domestic-session-redirected';
1085
+ const clearDomesticSessionRedirectMarker = () => {
1086
+ safeRemoveItem('session', DOMESTIC_SESSION_REDIRECT_MARKER);
1087
+ };
1088
+ const stripeStoreHasDomesticSessionRedirectMarker = () => {
1089
+ return safeGetItem('session', DOMESTIC_SESSION_REDIRECT_MARKER) === '1';
1090
+ };
1091
+ const stripeStoreMarkDomesticSessionRedirected = () => {
1092
+ safeSetItem('session', DOMESTIC_SESSION_REDIRECT_MARKER, '1');
1093
+ };
1084
1094
  const stripeStoreCleanupDomesticShippingSession = () => {
1085
- window.sessionStorage.removeItem('zonos--bigcommerce-domestic-checkout-shipping');
1095
+ safeRemoveItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
1096
+ clearDomesticSessionRedirectMarker();
1086
1097
  };
1087
1098
  // Save shipping address to session storage
1088
1099
  const stripeStoreSaveDomesticShippingSession = (props) => {
1089
- window.sessionStorage.setItem('zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
1100
+ clearDomesticSessionRedirectMarker();
1101
+ safeSetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
1090
1102
  };
1091
1103
  const stripeStoreGetDomesticShippingSession = () => {
1092
- const session = window.sessionStorage.getItem('zonos--bigcommerce-domestic-checkout-shipping');
1104
+ const session = safeGetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
1093
1105
  return jsonParse(session);
1094
1106
  };
1095
1107
  const initStripeElements = async (props) => {
@@ -1136,7 +1148,7 @@ const initStripeElements = async (props) => {
1136
1148
  };
1137
1149
  const stripeStoreReset = () => {
1138
1150
  // clean clientSecret so that we can start the new one.
1139
- sessionStorage.removeItem('zonos--client-secret');
1151
+ safeRemoveItem('session', 'zonos--client-secret');
1140
1152
  // cleanup stripe elements
1141
1153
  reset$1();
1142
1154
  // set stripe back to window.Zonos.stripe
@@ -1469,7 +1481,7 @@ const stripeCalculateLandedCost = async () => {
1469
1481
  cartStore.promoCodeError = isInvalidPromoCode;
1470
1482
  // When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
1471
1483
  if (!isInvalidPromoCode) {
1472
- sessionStorage.setItem('zonos--promo-code', cartStore.promoCode);
1484
+ safeSetItem('session', 'zonos--promo-code', cartStore.promoCode);
1473
1485
  }
1474
1486
  };
1475
1487
  const stripeStorePrefetchLandedCost = async (params) => {
@@ -1601,7 +1613,7 @@ const stripeStoreApplyPromoCode = async () => {
1601
1613
  };
1602
1614
  const stripeStoreResetPromoCode = () => {
1603
1615
  cartStore.promoCode = '';
1604
- sessionStorage.removeItem('zonos--promo-code');
1616
+ safeRemoveItem('session', 'zonos--promo-code');
1605
1617
  // reset promocode error state
1606
1618
  cartStore.promoCodeError = false;
1607
1619
  cartStore.promoCodeApplied = false;
@@ -2223,10 +2235,10 @@ const stripeStoreTranslateAddressToLatin = async ({ addressInvalidCharactersList
2223
2235
  stripeStoreOnChange('clientSecret', clientSecret => {
2224
2236
  // update stripe elements when client secret changes
2225
2237
  if (clientSecret && stripeStore.stripe) {
2226
- sessionStorage.setItem('zonos--client-secret', clientSecret);
2238
+ safeSetItem('session', 'zonos--client-secret', clientSecret);
2227
2239
  }
2228
2240
  if (!clientSecret) {
2229
- sessionStorage.removeItem('zonos--client-secret');
2241
+ safeRemoveItem('session', 'zonos--client-secret');
2230
2242
  }
2231
2243
  });
2232
2244
 
@@ -2270,9 +2282,9 @@ const { onChange: cartStoreOnChange, reset, state: cartStore, } = createStore(()
2270
2282
  landedCostData: null,
2271
2283
  landedCostMethod: 'DDP',
2272
2284
  partiesData: [],
2273
- promoCode: sessionStorage.getItem('zonos--promo-code') || '',
2285
+ promoCode: safeGetItem('session', 'zonos--promo-code') || '',
2274
2286
  // When user clicked applied button, save promocode into session storage for later use. So if session has promocode, applied button is clicked
2275
- promoCodeApplied: !!sessionStorage.getItem('zonos--promo-code'),
2287
+ promoCodeApplied: !!safeGetItem('session', 'zonos--promo-code'),
2276
2288
  promoCodeError: false,
2277
2289
  restrictedItems: [],
2278
2290
  selectedLandedCost: null,
@@ -2775,4 +2787,4 @@ const cartStoreUpdateStoreCredit = () => {
2775
2787
  }, 300);
2776
2788
  };
2777
2789
 
2778
- export { cartStoreGetMethod as $, storeCreditStoreApplyCredit as A, storeCreditStoreCoversFullAmount as B, validateCheckoutSession as C, storeCreditStoreCreateOrder as D, stripeStoreConfirmPayment as E, stripeStoreHandleInventoryRefund as F, policyConsentStore as G, stripeStoreReset as H, cartStoreOnChange as I, stripeStoreOnChange as J, storeCreditStoreGetEffectiveAmount as K, cartStoreHasOneEligibleItem as L, isEuDapRemittance as M, stripeStoreApplyPromoCode as N, stripeStoreRemovePromoCode as O, stripeStoreResetPromoCode as P, stripeStoreMessageBasedOnStatus as Q, storeCreditStore as R, storeCreditStoreReset as S, stripeStoreRecordPolicyConsent as T, extractName as U, resolveTaxIdSelection as V, stripeStoreTranslateAddressToLatin as W, getCountryField as X, stripeStoreAsyncAddressUpdate as Y, cartStoreUpdateSelectedShippingOption as Z, cartStoreGetShippingTransitInfo as _, stripeStoreSaveDomesticShippingSession as a, sortServiceLevelOptionsByAmount as a0, stripeStoreBuildAddressForPartyCreate as a1, getEnabledPolicies as a2, storeCreditStoreSetEnabled as a3, storeCreditStoreSetUseFullBalance as a4, cartStoreUpdateStoreCredit as a5, storeCreditStoreSetAmount as a6, storeCreditStoreRefreshBalance as a7, stripeStore as b, stripeStoreRetrievePayment as c, cartStore as d, cartStoreUpdateItems as e, cartStoreReset as f, getCheckoutSession as g, cartStoreResetTabItems as h, initStripeElements as i, cartStoreClearCheckoutInterval as j, stripeStoreInitCheckoutSession as k, stripeStoreGetPaymentIntent as l, cartStoreIsOrderModificationPaymentOnlySession as m, stripeStoreHandleInventoryCheck as n, cartStoreStartCheckoutInterval as o, policyConsentStoreReset as p, getCheckoutSessionBody as q, cartStoreUpdateToErrorState as r, stripeStoreGetDomesticShippingSession as s, trackConversionEvent as t, stripeStoreCleanupDomesticShippingSession as u, cartStoreSetCheckoutSession as v, stripeStorePrefetchLandedCost as w, cartStoreNextStep as x, isPolicyConsentRequired as y, stripeStoreUpdateCheckoutSessionBaseCurrency as z };
2790
+ export { cartStoreUpdateSelectedShippingOption as $, isPolicyConsentRequired as A, stripeStoreUpdateCheckoutSessionBaseCurrency as B, storeCreditStoreApplyCredit as C, storeCreditStoreCoversFullAmount as D, validateCheckoutSession as E, storeCreditStoreCreateOrder as F, stripeStoreConfirmPayment as G, stripeStoreHandleInventoryRefund as H, policyConsentStore as I, stripeStoreReset as J, cartStoreOnChange as K, stripeStoreOnChange as L, storeCreditStoreGetEffectiveAmount as M, cartStoreHasOneEligibleItem as N, isEuDapRemittance as O, stripeStoreApplyPromoCode as P, stripeStoreRemovePromoCode as Q, stripeStoreResetPromoCode as R, stripeStoreMessageBasedOnStatus as S, storeCreditStore as T, storeCreditStoreReset as U, stripeStoreRecordPolicyConsent as V, extractName as W, resolveTaxIdSelection as X, stripeStoreTranslateAddressToLatin as Y, getCountryField as Z, stripeStoreAsyncAddressUpdate as _, stripeStoreHasDomesticSessionRedirectMarker as a, cartStoreGetShippingTransitInfo as a0, cartStoreGetMethod as a1, sortServiceLevelOptionsByAmount as a2, stripeStoreBuildAddressForPartyCreate as a3, getEnabledPolicies as a4, storeCreditStoreSetEnabled as a5, storeCreditStoreSetUseFullBalance as a6, cartStoreUpdateStoreCredit as a7, storeCreditStoreSetAmount as a8, storeCreditStoreRefreshBalance as a9, stripeStoreCleanupDomesticShippingSession as b, stripeStoreMarkDomesticSessionRedirected as c, stripeStoreSaveDomesticShippingSession as d, stripeStore as e, stripeStoreRetrievePayment as f, getCheckoutSession as g, cartStore as h, initStripeElements as i, cartStoreUpdateItems as j, cartStoreReset as k, cartStoreResetTabItems as l, cartStoreClearCheckoutInterval as m, stripeStoreInitCheckoutSession as n, stripeStoreGetPaymentIntent as o, policyConsentStoreReset as p, cartStoreIsOrderModificationPaymentOnlySession as q, stripeStoreHandleInventoryCheck as r, stripeStoreGetDomesticShippingSession as s, cartStoreStartCheckoutInterval as t, trackConversionEvent as u, getCheckoutSessionBody as v, cartStoreUpdateToErrorState as w, cartStoreSetCheckoutSession as x, stripeStorePrefetchLandedCost as y, cartStoreNextStep as z };
@@ -1,8 +1,8 @@
1
1
  import { c as createStore, z as zonosStore } from './zonosStore-BXP9FvIt.js';
2
- import { t as translate, l as localizationStore, s as storageStore } from './localization-DHM91diu.js';
3
- import { l as logError$1, h as handleFetch, s as sendErrorLog } from './handleFetch-D5GYDF-O.js';
2
+ import { t as translate, l as localizationStore, s as storageStore } from './localization-B5CRzthT.js';
3
+ import { l as logError$1, h as handleFetch, s as sendErrorLog } from './handleFetch-BFVO7oAR.js';
4
4
  import { l as log, b as allLogs } from './VarianceTest-BJmZPrZl.js';
5
- import { d as cartStore, Z as cartStoreUpdateSelectedShippingOption, b as stripeStore, a1 as stripeStoreBuildAddressForPartyCreate } from './cart-DmJkjiDE.js';
5
+ import { h as cartStore, $ as cartStoreUpdateSelectedShippingOption, e as stripeStore, a3 as stripeStoreBuildAddressForPartyCreate } from './cart-b84n0nhi.js';
6
6
 
7
7
  // src/constant/common.ts
8
8
  function _array_like_to_array(arr, len) {
@@ -2045,7 +2045,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
2045
2045
  var e = new Error(message);
2046
2046
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2047
2047
  };
2048
- var version = "1.35.1";
2048
+ var version = "1.35.2";
2049
2049
  var packageJson = {
2050
2050
  version: version};
2051
2051
 
@@ -1,4 +1,4 @@
1
- import { U as extractName } from './cart-DmJkjiDE.js';
1
+ import { W as extractName } from './cart-b84n0nhi.js';
2
2
 
3
3
  /**
4
4
  * Minimum number of characters we treat as a valid postal code. Mirrors the
@@ -1,17 +1,5 @@
1
1
  import { l as log } from './VarianceTest-BJmZPrZl.js';
2
2
 
3
- const logError = (message, ...rest) => {
4
- log(message, 'error', ...rest);
5
- };
6
-
7
- const getIsStagingMode = () => window.location.search.includes('zonosStagingMode=1');
8
-
9
- const getIsTestMode = () => {
10
- var _a;
11
- return ((_a = window.Zonos.zonosApiKey) === null || _a === void 0 ? void 0 : _a.includes('test')) ||
12
- window.location.search.includes('zonosTestMode=1');
13
- };
14
-
15
3
  const fallbackApiType = ['cloudflare', 'vercel'];
16
4
  const MAIN_BASE_API_TYPE = fallbackApiType[0];
17
5
  const fallbackApiList = {
@@ -31,6 +19,164 @@ const getNextFallbackApiType = (currentApiType = MAIN_BASE_API_TYPE) => {
31
19
  return nextFallbackApiType;
32
20
  };
33
21
 
22
+ /**
23
+ * This is the time in milliseconds after release time that we will start sending error logs to the new API
24
+ * @default 1 hour
25
+ */
26
+ const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
27
+ const loggedHref = () => {
28
+ const url = new URL(window.location.href);
29
+ url.searchParams.delete('payment_intent');
30
+ url.searchParams.delete('payment_intent_client_secret');
31
+ url.searchParams.delete('redirect_status');
32
+ return url.toString();
33
+ };
34
+ const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
35
+ log('sendErrorLog', 'warn', endpoint, metadata, errors);
36
+ if (shouldPostReleaseErrorReporting) {
37
+ // We only want to report errors that happened if current time is less than 2 hours after release time
38
+ const releaseTime = Number(window.Zonos.releaseDate);
39
+ const currentTime = new Date().getTime();
40
+ if (currentTime - releaseTime > postReleaseReportingDuration) {
41
+ return;
42
+ }
43
+ }
44
+ const userAgentData = 'userAgentData' in window.navigator
45
+ ? // userAgentData is not yet supported in all browsers
46
+ window.navigator.userAgentData
47
+ : null;
48
+ const errorObject = {
49
+ endpoint,
50
+ errors,
51
+ href: loggedHref(),
52
+ metadata: Object.assign({ appVersion: window.Zonos.version, domain: window.Zonos.domain, publicCredential: window.Zonos.zonosApiKey, userAgent: userAgentData && userAgentData.brands.length > 0
53
+ ? userAgentData
54
+ : window.navigator.userAgent }, metadata),
55
+ };
56
+ try {
57
+ // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
58
+ void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
59
+ body: JSON.stringify(errorObject),
60
+ headers: {
61
+ 'Zonos-Referer': window.location.hostname,
62
+ },
63
+ method: 'POST',
64
+ });
65
+ }
66
+ catch (_a) {
67
+ const nextFallbackApi = getNextFallbackApiType();
68
+ if (!nextFallbackApi) {
69
+ return;
70
+ }
71
+ // request to the fallback API if the first one fails
72
+ void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
73
+ body: JSON.stringify(errorObject),
74
+ method: 'POST',
75
+ });
76
+ }
77
+ };
78
+
79
+ const thrownMessage = (error, fallback) => {
80
+ if (typeof error === 'string' && error) {
81
+ return error;
82
+ }
83
+ if (error instanceof Error && error.message) {
84
+ return error.message;
85
+ }
86
+ if (typeof error === 'object' &&
87
+ error !== null &&
88
+ 'message' in error &&
89
+ typeof error.message === 'string' &&
90
+ error.message) {
91
+ return error.message;
92
+ }
93
+ return fallback;
94
+ };
95
+
96
+ const logError = (message, ...rest) => {
97
+ log(message, 'error', ...rest);
98
+ };
99
+
100
+ const reportedIds = () => {
101
+ if (!window.__zonosReportedBlockedStorage) {
102
+ window.__zonosReportedBlockedStorage = new Set();
103
+ }
104
+ return window.__zonosReportedBlockedStorage;
105
+ };
106
+ /**
107
+ * Record a blocked storage read or write on the existing error log.
108
+ * A throw before `window.Zonos` exists is swallowed and does not use up
109
+ * the per-page dedupe slot, so the later startup read can still report it.
110
+ */
111
+ const reportBlockedStorage = (area, operation, key, error) => {
112
+ if (typeof window.Zonos === 'undefined') {
113
+ return;
114
+ }
115
+ const dedupeId = `${area}\u0000${operation}\u0000${key}`;
116
+ const reported = reportedIds();
117
+ if (reported.has(dedupeId)) {
118
+ return;
119
+ }
120
+ reported.add(dedupeId);
121
+ void sendErrorLog({
122
+ endpoint: `storage://${area}/${key}`,
123
+ errors: [thrownMessage(error, 'SecurityError')],
124
+ metadata: {
125
+ area,
126
+ key,
127
+ operation,
128
+ shape: 'blocked-storage',
129
+ },
130
+ });
131
+ };
132
+
133
+ /**
134
+ * Touch `window.localStorage` / `window.sessionStorage` inside the try.
135
+ * Safari throws SecurityError on the getter itself when storage is blocked.
136
+ * A missing storage object is the same failure: calling `getItem` on it
137
+ * would report a TypeError instead of blocked storage.
138
+ */
139
+ const storageFor = (area) => {
140
+ const storage = area === 'local' ? window.localStorage : window.sessionStorage;
141
+ if (!storage) {
142
+ throw new DOMException('', 'SecurityError');
143
+ }
144
+ return storage;
145
+ };
146
+ const safeGetItem = (area, key) => {
147
+ try {
148
+ return storageFor(area).getItem(key);
149
+ }
150
+ catch (error) {
151
+ reportBlockedStorage(area, 'getItem', key, error);
152
+ return null;
153
+ }
154
+ };
155
+ const safeRemoveItem = (area, key) => {
156
+ try {
157
+ storageFor(area).removeItem(key);
158
+ }
159
+ catch (error) {
160
+ reportBlockedStorage(area, 'removeItem', key, error);
161
+ }
162
+ };
163
+ const safeSetItem = (area, key, value) => {
164
+ try {
165
+ storageFor(area).setItem(key, value);
166
+ }
167
+ catch (error) {
168
+ reportBlockedStorage(area, 'setItem', key, error);
169
+ }
170
+ };
171
+
172
+ const getIsStagingMode = () => window.location.search.includes('zonosStagingMode=1');
173
+
174
+ const getIsTestMode = () => {
175
+ var _a;
176
+ return ((_a = window.Zonos.zonosApiKey) === null || _a === void 0 ? void 0 : _a.includes('test')) ||
177
+ window.location.search.includes('zonosTestMode=1');
178
+ };
179
+
34
180
  const jsonParse = (_data) => {
35
181
  if (typeof _data === 'string') {
36
182
  try {
@@ -133,56 +279,6 @@ const prepLoadTimeApiLog = ({ apiPath, apiType, loadTimeInternal, loadTimeTotal,
133
279
  window.Zonos.loadTimeApiInfoList.push(bulkLoadLogBody);
134
280
  };
135
281
 
136
- /**
137
- * This is the time in milliseconds after release time that we will start sending error logs to the new API
138
- * @default 1 hour
139
- */
140
- const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
141
- const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
142
- log('sendErrorLog', 'warn', endpoint, metadata, errors);
143
- if (shouldPostReleaseErrorReporting) {
144
- // We only want to report errors that happened if current time is less than 2 hours after release time
145
- const releaseTime = Number(window.Zonos.releaseDate);
146
- const currentTime = new Date().getTime();
147
- if (currentTime - releaseTime > postReleaseReportingDuration) {
148
- return;
149
- }
150
- }
151
- const userAgentData = 'userAgentData' in window.navigator
152
- ? // userAgentData is not yet supported in all browsers
153
- window.navigator.userAgentData
154
- : null;
155
- const errorObject = {
156
- endpoint,
157
- errors,
158
- href: window.location.href,
159
- metadata: Object.assign({ appVersion: window.Zonos.version, domain: window.Zonos.domain, publicCredential: window.Zonos.zonosApiKey, userAgent: userAgentData && userAgentData.brands.length > 0
160
- ? userAgentData
161
- : window.navigator.userAgent }, metadata),
162
- };
163
- try {
164
- // use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
165
- void fetch(`${MAIN_BASE_API}/api/zonos-elements/log-error`, {
166
- body: JSON.stringify(errorObject),
167
- headers: {
168
- 'Zonos-Referer': window.location.hostname,
169
- },
170
- method: 'POST',
171
- });
172
- }
173
- catch (_a) {
174
- const nextFallbackApi = getNextFallbackApiType();
175
- if (!nextFallbackApi) {
176
- return;
177
- }
178
- // request to the fallback API if the first one fails
179
- void fetch(`${fallbackApiList[nextFallbackApi]}/api/zonos-elements/log-error`, {
180
- body: JSON.stringify(errorObject),
181
- method: 'POST',
182
- });
183
- }
184
- };
185
-
186
282
  var __rest = (undefined && undefined.__rest) || function (s, e) {
187
283
  var t = {};
188
284
  for (var p in s)
@@ -195,6 +291,7 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
195
291
  }
196
292
  return t;
197
293
  };
294
+ const isGatewayStatus = (status) => status === 502 || status === 503 || status === 504;
198
295
  const getResponseBody = async ({ response, shouldLog = true, shouldThrow = false, }) => {
199
296
  try {
200
297
  const text = await response.text();
@@ -315,28 +412,31 @@ const handleRequest = async ({ basePathType, options, path, }) => {
315
412
  }
316
413
  catch (_a) {
317
414
  const message = 'Unknown error';
415
+ // A gateway HTML or empty body still carries a status a GET can fail over
416
+ // on. Other non-JSON statuses, including 404 and 500, keep the previous
417
+ // null response so they do not fail over.
318
418
  return {
319
419
  baseUrl,
320
420
  errors: [{ message: `${status}: ${message}`, type: status }],
321
421
  json: null,
322
- response: null,
422
+ response: isGatewayStatus(response.status) ? response : null,
323
423
  zonosMode,
324
424
  };
325
425
  }
326
426
  };
327
427
  const handleRequestWithFallback = async ({ basePathType: _basePathType, options, path, }) => {
328
- var _a, _b;
428
+ var _a, _b, _c;
329
429
  // use vercel API if the path is `/api/bigcommerce`
330
430
  const isBigcommerceEndpoint = path.startsWith('/api/bigcommerce');
331
431
  const basePathType = isBigcommerceEndpoint
332
432
  ? 'vercel'
333
433
  : _basePathType;
334
434
  const startTime = performance.now();
335
- const _c = await handleRequest({
435
+ const _d = await handleRequest({
336
436
  basePathType,
337
437
  options,
338
438
  path,
339
- }), { errors, response } = _c, rest = __rest(_c, ["errors", "response"]);
439
+ }), { errors, response } = _d, rest = __rest(_d, ["errors", "response"]);
340
440
  const endTime = performance.now();
341
441
  const duration = endTime - startTime;
342
442
  // Send the load time api log
@@ -358,10 +458,16 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
358
458
  (message.includes('signal is aborted') ||
359
459
  message.includes('The operation was aborted') ||
360
460
  message.includes('Fetch is aborted')));
361
- const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
362
- const shouldCallFallback =
363
- // If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
364
- nextFallbackApiType && isUnknownError;
461
+ const statusCode = response === null || response === void 0 ? void 0 : response.status;
462
+ const gateway = statusCode !== undefined && isGatewayStatus(statusCode);
463
+ // handleFetch sets method, and a missing method is a GET.
464
+ const isIdempotentGet = ((_a = options === null || options === void 0 ? void 0 : options.method) !== null && _a !== void 0 ? _a : 'GET').toUpperCase() === 'GET';
465
+ const failedWithoutGateway = !!unknownError || statusCode === 404 || statusCode === 500;
466
+ const isUnknownError = failedWithoutGateway || gateway;
467
+ // Replay 502, 503, and 504 only for GET. A gateway timeout on a POST can
468
+ // mean the first host is still finishing a payment or order write.
469
+ const shouldCallFallback = nextFallbackApiType &&
470
+ (failedWithoutGateway || (gateway && isIdempotentGet));
365
471
  // Should log the error if it's unknown error
366
472
  if (isUnknownError && !isAbortError) {
367
473
  void sendErrorLog({
@@ -371,7 +477,7 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
371
477
  currentBasePath: basePathType,
372
478
  nextFallbackApiType,
373
479
  requestHeaders: options === null || options === void 0 ? void 0 : options.headers,
374
- 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()),
480
+ 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()),
375
481
  shouldCallFallback,
376
482
  status: response === null || response === void 0 ? void 0 : response.status,
377
483
  statusText: response === null || response === void 0 ? void 0 : response.statusText,
@@ -415,4 +521,4 @@ const handleFetch = async (path, _opts) => {
415
521
  });
416
522
  };
417
523
 
418
- export { getIsStagingMode as a, getAdditionalLogMetadata as b, fallbackApiList as f, getIsTestMode as g, handleFetch as h, isCheckoutMobile as i, jsonParse as j, logError as l, sendErrorLog as s };
524
+ export { getIsStagingMode as a, safeRemoveItem as b, safeGetItem as c, getAdditionalLogMetadata as d, safeSetItem as e, fallbackApiList as f, getIsTestMode as g, handleFetch as h, isCheckoutMobile as i, jsonParse as j, logError as l, sendErrorLog as s, thrownMessage as t };
@@ -1,4 +1,4 @@
1
- import { l as localizationStore } from './localization-DHM91diu.js';
1
+ import { l as localizationStore } from './localization-B5CRzthT.js';
2
2
 
3
3
  /**
4
4
  * Since the backend and the frontend are using the same keys,