@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
@@ -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-C39TMSgB.js');
5
+ var localization = require('./localization-BhNVhLZs.js');
6
+ var renderCheckoutCurrency = require('./renderCheckoutCurrency-DE2p8CT8.js');
7
7
  var classes = require('./classes-D_DL168u.js');
8
- var invoice = require('./invoice-5hVfSXpb.js');
8
+ var invoice = require('./invoice-BD3pCr8P.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-C39TMSgB.js');
5
+ var paypal = require('./paypal-Bd1qmwiv.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-BD3pCr8P.js');
16
+ var renderCheckoutCurrency = require('./renderCheckoutCurrency-DE2p8CT8.js');
17
+ var placeTestOrder = require('./placeTestOrder-BMQRvX2q.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-C39TMSgB.js');
5
+ var invoice = require('./invoice-BD3pCr8P.js');
6
+ var paypal = require('./paypal-Bd1qmwiv.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-C39TMSgB.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-DE2p8CT8.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";
@@ -52,6 +53,8 @@ import { filterExpiredTests } from "../../utils/varianceTest/filterExpiredTests"
52
53
  import { getSelectedTestVariant } from "../../utils/varianceTest/getSelectedTestVariant";
53
54
  import { isTestEnabled } from "../../utils/varianceTest/isTestEnabled";
54
55
  import { mergeTest } from "../../utils/varianceTest/mergeTest";
56
+ import { pathContainsCheckout } from "../../../scripts/_bigcommerceCheckoutPath";
57
+ import { isBigCommerceNativeCheckout } from "../../../scripts/_isBigCommerceNativeCheckout";
55
58
  import { setupCartData } from "../../../scripts/cart/_setupCartData";
56
59
  import { checkoutHiddenBtnSelector, checkoutHiddenInternationalBtnSelector, domesticRedirectedBtnSelector, } from "../../../types/checkout/CheckoutConfig";
57
60
  /** These assets need to be in relative path as https://www.npmjs.com/package/stencil-inline-svg suggested */
@@ -752,9 +755,9 @@ export class ZonosCheckout {
752
755
  window.location.reload();
753
756
  }
754
757
  handleOrderDuplication() {
755
- const existingPlacedOrderInfo = jsonParse(localStorage.getItem('zonos--placed-order-info'));
758
+ const existingPlacedOrderInfo = jsonParse(safeGetItem('local', 'zonos--placed-order-info'));
756
759
  if (!existingPlacedOrderInfo) {
757
- localStorage.removeItem('zonos--placed-order-info');
760
+ safeRemoveItem('local', 'zonos--placed-order-info');
758
761
  return;
759
762
  }
760
763
  const elapsed = Date.now() - existingPlacedOrderInfo.time;
@@ -766,7 +769,7 @@ export class ZonosCheckout {
766
769
  if (elapsed > overrideExpiredDuplication) {
767
770
  log(`=== Existing placed order info is older than ${overrideExpiredDuplication}ms, cleaning localStorage`, 'warn');
768
771
  // remove the placed order info if it's older than 5 minutes and do nothing.
769
- localStorage.removeItem('zonos--placed-order-info');
772
+ safeRemoveItem('local', 'zonos--placed-order-info');
770
773
  return;
771
774
  }
772
775
  // Set placed order info to show the confirm notification to the user
@@ -1305,6 +1308,13 @@ export class ZonosCheckout {
1305
1308
  if (window.Zonos) {
1306
1309
  this.useLegacyQueryParams();
1307
1310
  }
1311
+ // Native BigCommerce checkout never loads Stripe.js. The address watcher
1312
+ // above still has to run. Skip the poll so checkout does not wait 10s
1313
+ // for a Stripe instance that will not arrive, and so attachCheckout
1314
+ // cannot bind the store's place-order buttons.
1315
+ if (isBigCommerceNativeCheckout()) {
1316
+ return;
1317
+ }
1308
1318
  // only initialize checkout if visitor's country is in the shipping zones.
1309
1319
  const interval = setInterval(() => {
1310
1320
  stripeStore.stripe = window.Zonos.stripe;
@@ -1832,7 +1842,7 @@ export class ZonosCheckout {
1832
1842
  return;
1833
1843
  }
1834
1844
  // Check if the page is checkout page, if so, do nothing since they're already at the right page
1835
- if (window.location.pathname.includes('/checkout')) {
1845
+ if (pathContainsCheckout(window.location.pathname)) {
1836
1846
  return;
1837
1847
  }
1838
1848
  const shippingCountry = addressEventData.value.address.country;
@@ -0,0 +1,12 @@
1
+ import { zonosStore } from "../store/zonosStore";
2
+ import { initCheckout } from "../utils/checkout/initCheckout";
3
+ /**
4
+ * Mount `<zonos-checkout>` without a Stripe instance.
5
+ *
6
+ * Native BigCommerce checkout must not receive Stripe.js. Creating the
7
+ * element still runs `zonos-checkout.init()`, which registers the
8
+ * international-address watcher and then returns before the Stripe poll.
9
+ */
10
+ export const mountCheckoutWithoutStripe = () => {
11
+ initCheckout(zonosStore.checkoutSettings);
12
+ };
@@ -1,4 +1,5 @@
1
1
  import { h, Host, } from "@stencil/core";
2
+ import { mountCheckoutWithoutStripe } from "./mountCheckoutWithoutStripe";
2
3
  import { stripeStore } from "../store/checkout/stripe";
3
4
  import { initLocalizationStore, localizationStoreUpdateSelectedCountryCode, } from "../store/hello/localization";
4
5
  import { storageStore } from "../store/storageStore";
@@ -13,7 +14,9 @@ import { initHello } from "../utils/hello/initHello";
13
14
  import { CheckoutAddressService } from "../utils/iframe/CheckoutAddressService";
14
15
  import { iframeServices, injectPrivateIframe, } from "../utils/iframe/IframeHelpers";
15
16
  import { log } from "../utils/logging/log";
17
+ import { safeGetItem } from "../utils/safeStorage";
16
18
  import { ensureAnalyticsRelayPing } from "../utils/submitGtag";
19
+ import { isBigCommerceNativeCheckout } from "../../scripts/_isBigCommerceNativeCheckout";
17
20
  export class ZonosController {
18
21
  /**
19
22
  * Method to initialize checkout element
@@ -257,11 +260,17 @@ export class ZonosController {
257
260
  log('Checkout failed to load -- missing publishable key', 'warn');
258
261
  return;
259
262
  }
263
+ // `_loadStripe.ts` is the only module that injects Stripe.js. This
264
+ // method only chooses whether to ask for it or to mount checkout
265
+ // without it.
266
+ const nativeBigCommerceCheckout = isBigCommerceNativeCheckout();
260
267
  if (window.Zonos.isCollect || window.Zonos.isInvoice) {
261
- // send publishable key out to load stripe
262
- this.stripeInitEvent.emit({
263
- publishableKey: publishableKey.token,
264
- });
268
+ // Collect and Invoice off native checkout still ask for Stripe.
269
+ if (!nativeBigCommerceCheckout) {
270
+ this.stripeInitEvent.emit({
271
+ publishableKey: publishableKey.token,
272
+ });
273
+ }
265
274
  // init google places service
266
275
  void this.initGooglePlacesService(json);
267
276
  return;
@@ -283,16 +292,23 @@ export class ZonosController {
283
292
  // Checkout also runs without merchant cart callbacks when a cart is
284
293
  // prefetched (e.g. `tempCartUUID` -> `cartData`) or when resuming a
285
294
  // 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');
295
+ const clientSecret = new URL(window.location.href).searchParams.get('payment_intent_client_secret') || safeGetItem('session', 'zonos--client-secret');
287
296
  const hasPrefetchedCheckoutContext = !!(window.Zonos.cartId && window.Zonos.cartData) || !!clientSecret;
288
297
  if (!hasCartCallback && !hasPrefetchedCheckoutContext) {
289
298
  log(`Skip loading Stripe because no cart callback (buildCartDetail/createCartId), prefetched cart, or payment client secret is present`, 'warn');
290
299
  return;
291
300
  }
292
- // send publishable key out to load stripe
293
- this.stripeInitEvent.emit({
294
- publishableKey: publishableKey.token,
295
- });
301
+ // Cart callbacks, a prefetched cart, and a client secret do not override
302
+ // the native BigCommerce checkout skip. Mount checkout anyway so the
303
+ // international-address watcher runs, without Stripe.js.
304
+ if (nativeBigCommerceCheckout) {
305
+ mountCheckoutWithoutStripe();
306
+ }
307
+ else {
308
+ this.stripeInitEvent.emit({
309
+ publishableKey: publishableKey.token,
310
+ });
311
+ }
296
312
  // init google places service
297
313
  void this.initGooglePlacesService(json);
298
314
  })();
@@ -348,7 +364,7 @@ export class ZonosController {
348
364
  zonosStore.organizationName = organizationName;
349
365
  }
350
366
  render() {
351
- return h(Host, { key: '1714865012d806892f03e03896ee2f04aa1a729d', class: "zonos--elements" });
367
+ return h(Host, { key: '0d8bcffcb7e22891c082a4916b00b87bdf5fc2e8', class: "zonos--elements" });
352
368
  }
353
369
  static get is() { return "zonos-controller"; }
354
370
  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: {
@@ -133,15 +134,27 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
133
134
  locale: localizationStore.selectedLocale,
134
135
  };
135
136
  };
137
+ const DOMESTIC_SESSION_REDIRECT_MARKER = 'zonos--bc-domestic-session-redirected';
138
+ const clearDomesticSessionRedirectMarker = () => {
139
+ safeRemoveItem('session', DOMESTIC_SESSION_REDIRECT_MARKER);
140
+ };
141
+ const stripeStoreHasDomesticSessionRedirectMarker = () => {
142
+ return safeGetItem('session', DOMESTIC_SESSION_REDIRECT_MARKER) === '1';
143
+ };
144
+ const stripeStoreMarkDomesticSessionRedirected = () => {
145
+ safeSetItem('session', DOMESTIC_SESSION_REDIRECT_MARKER, '1');
146
+ };
136
147
  const stripeStoreCleanupDomesticShippingSession = () => {
137
- window.sessionStorage.removeItem('zonos--bigcommerce-domestic-checkout-shipping');
148
+ safeRemoveItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
149
+ clearDomesticSessionRedirectMarker();
138
150
  };
139
151
  // Save shipping address to session storage
140
152
  const stripeStoreSaveDomesticShippingSession = (props) => {
141
- window.sessionStorage.setItem('zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
153
+ clearDomesticSessionRedirectMarker();
154
+ safeSetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping', JSON.stringify(props));
142
155
  };
143
156
  const stripeStoreGetDomesticShippingSession = () => {
144
- const session = window.sessionStorage.getItem('zonos--bigcommerce-domestic-checkout-shipping');
157
+ const session = safeGetItem('session', 'zonos--bigcommerce-domestic-checkout-shipping');
145
158
  return jsonParse(session);
146
159
  };
147
160
  const initStripeElements = async (props) => {
@@ -188,7 +201,7 @@ const initStripeElements = async (props) => {
188
201
  };
189
202
  const stripeStoreReset = () => {
190
203
  // clean clientSecret so that we can start the new one.
191
- sessionStorage.removeItem('zonos--client-secret');
204
+ safeRemoveItem('session', 'zonos--client-secret');
192
205
  // cleanup stripe elements
193
206
  reset();
194
207
  // set stripe back to window.Zonos.stripe
@@ -521,7 +534,7 @@ const stripeCalculateLandedCost = async () => {
521
534
  cartStore.promoCodeError = isInvalidPromoCode;
522
535
  // When promocode is valid, set promoCode to session storage so if user close the modal, we can still reapply for them
523
536
  if (!isInvalidPromoCode) {
524
- sessionStorage.setItem('zonos--promo-code', cartStore.promoCode);
537
+ safeSetItem('session', 'zonos--promo-code', cartStore.promoCode);
525
538
  }
526
539
  };
527
540
  const stripeStorePrefetchLandedCost = async (params) => {
@@ -653,7 +666,7 @@ const stripeStoreApplyPromoCode = async () => {
653
666
  };
654
667
  const stripeStoreResetPromoCode = () => {
655
668
  cartStore.promoCode = '';
656
- sessionStorage.removeItem('zonos--promo-code');
669
+ safeRemoveItem('session', 'zonos--promo-code');
657
670
  // reset promocode error state
658
671
  cartStore.promoCodeError = false;
659
672
  cartStore.promoCodeApplied = false;
@@ -1275,10 +1288,10 @@ const stripeStoreTranslateAddressToLatin = async ({ addressInvalidCharactersList
1275
1288
  stripeStoreOnChange('clientSecret', clientSecret => {
1276
1289
  // update stripe elements when client secret changes
1277
1290
  if (clientSecret && stripeStore.stripe) {
1278
- sessionStorage.setItem('zonos--client-secret', clientSecret);
1291
+ safeSetItem('session', 'zonos--client-secret', clientSecret);
1279
1292
  }
1280
1293
  if (!clientSecret) {
1281
- sessionStorage.removeItem('zonos--client-secret');
1294
+ safeRemoveItem('session', 'zonos--client-secret');
1282
1295
  }
1283
1296
  });
1284
- 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, };
1297
+ export { DOMESTIC_SESSION_REDIRECT_MARKER, initStripeElements, stripeCalculateLandedCost, stripeStore, stripeStoreApplyPromoCode, stripeStoreAsyncAddressUpdate, stripeStoreBuildAddressForPartyCreate, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreGetDomesticShippingSession, stripeStoreGetPaymentIntent, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreHasDomesticSessionRedirectMarker, stripeStoreInitCheckoutSession, stripeStoreMarkDomesticSessionRedirected, 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
  }
@@ -1,4 +1,5 @@
1
1
  import { zonosStore } from "../../store/zonosStore";
2
+ import { pathContainsCheckout } from "../../../scripts/_bigcommerceCheckoutPath";
2
3
  const ZBYPASS_ON_VALUES = ['1', 'true', 'yes'];
3
4
  /**
4
5
  * Page-load result of reading the checkout `zBypass` query. Later calls on the
@@ -7,7 +8,7 @@ const ZBYPASS_ON_VALUES = ['1', 'true', 'yes'];
7
8
  */
8
9
  let consumedZBypassQuery = null;
9
10
  const isCheckoutPage = () => {
10
- return window.location.pathname.includes('/checkout');
11
+ return pathContainsCheckout(window.location.pathname);
11
12
  };
12
13
  const isAcceptedZBypassQuery = (rawValue) => {
13
14
  if (rawValue === null) {
@@ -1,4 +1,4 @@
1
- import { stripeStoreGetDomesticShippingSession, stripeStoreSaveDomesticShippingSession, } from "../../store/checkout/stripe";
1
+ import { stripeStoreCleanupDomesticShippingSession, stripeStoreGetDomesticShippingSession, stripeStoreHasDomesticSessionRedirectMarker, stripeStoreMarkDomesticSessionRedirected, stripeStoreSaveDomesticShippingSession, } from "../../store/checkout/stripe";
2
2
  import { localizationStoreUpdateSelectedCountryCode } from "../../store/hello/localization";
3
3
  import { zonosStore } from "../../store/zonosStore";
4
4
  import { fetchBigCommerceCheckout, fetchCheckoutId, } from "./bigcommerceStorefrontApi";
@@ -9,6 +9,8 @@ import { isBigCommerceCheckoutBypassEnabled } from "./isBigCommerceCheckoutBypas
9
9
  import { isShippableCountry } from "./isShippableCountry";
10
10
  import { log } from "../logging/log";
11
11
  import { logError } from "../logging/logError";
12
+ import { pathContainsCheckout } from "../../../scripts/_bigcommerceCheckoutPath";
13
+ import { isBigCommerceNativeCheckout } from "../../../scripts/_isBigCommerceNativeCheckout";
12
14
  const FALLBACK_SHIP_TO_COUNTRY_SELECTOR = 'select[name="shippingAddress.countryCode"]';
13
15
  /**
14
16
  * Native BigCommerce shipping-step "Continue" button. Clicking it commits the
@@ -112,7 +114,7 @@ export const watchImmediateBigcommerceDomesticCheckoutRedirect = ({ domesticRedi
112
114
  // Only the native checkout page skips address detection. Storefront pages
113
115
  // still run the domestic-session handoff below, and they do not consume
114
116
  // a `zBypass` query, so the parameter can survive until `/checkout`.
115
- if (window.location.pathname.includes('/checkout') &&
117
+ if (pathContainsCheckout(window.location.pathname) &&
116
118
  isBigCommerceCheckoutBypassEnabled()) {
117
119
  return;
118
120
  }
@@ -365,17 +367,35 @@ export const watchImmediateBigcommerceDomesticCheckoutRedirect = ({ domesticRedi
365
367
  const shippingAddressSession = stripeStoreGetDomesticShippingSession();
366
368
  // append a hidden button to the body if the shipping address session is found
367
369
  if (!domesticRedirectedButton && shippingAddressSession) {
368
- // create a hidden button to trigger the click event
369
- const button = document.createElement('button');
370
- button.style.display = 'none';
371
- button.id = 'zonos--domestic-redirected-checkout-button';
372
- document.body.appendChild(button);
373
- onShippingAddressSessionFound === null || onShippingAddressSessionFound === void 0 ? void 0 : onShippingAddressSessionFound(shippingAddressSession);
374
- // disconnect the observer after we found the shipping continue button
375
- observer.disconnect();
376
- return;
370
+ // Stripe.js is not loaded on native checkout, so nothing here can click
371
+ // a hidden button or clear this session. Send the shopper to `/` once.
372
+ // Saving or clearing the session drops that hop marker, so a later
373
+ // leftover session still gets its own redirect. If they come back and
374
+ // the session is still set, drop it and keep watching the address.
375
+ if (isBigCommerceNativeCheckout()) {
376
+ if (stripeStoreHasDomesticSessionRedirectMarker()) {
377
+ stripeStoreCleanupDomesticShippingSession();
378
+ }
379
+ else {
380
+ stripeStoreMarkDomesticSessionRedirected();
381
+ observer.disconnect();
382
+ window.location.href = buildBigcommerceRedirectUrl('/');
383
+ return;
384
+ }
385
+ }
386
+ else {
387
+ // create a hidden button to trigger the click event
388
+ const button = document.createElement('button');
389
+ button.style.display = 'none';
390
+ button.id = 'zonos--domestic-redirected-checkout-button';
391
+ document.body.appendChild(button);
392
+ onShippingAddressSessionFound === null || onShippingAddressSessionFound === void 0 ? void 0 : onShippingAddressSessionFound(shippingAddressSession);
393
+ // disconnect the observer after we found the shipping continue button
394
+ observer.disconnect();
395
+ return;
396
+ }
377
397
  }
378
- const isBigcommerceDomesticCheckoutPage = window.location.pathname.includes('/checkout') &&
398
+ const isBigcommerceDomesticCheckoutPage = pathContainsCheckout(window.location.pathname) &&
379
399
  window.Zonos.isBigCommerce;
380
400
  // Should just disconnect the observer if it's not bigcommerce domestic checkout page
381
401
  if (!isBigcommerceDomesticCheckoutPage) {