@zonos/elements 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-CiXlehwQ.js → cart-BJpqPdFU.js} +13 -13
- package/dist/cjs/{collect-Drr8fY-q.js → collect-CyUttsvB.js} +3 -3
- package/dist/cjs/{getMissingRequiredShippingFields-DI6qF1z3.js → getMissingRequiredShippingFields-DEbNbRAZ.js} +1 -1
- package/dist/cjs/{handleFetch-DQLhurnE.js → handleFetch-DVfjFTYO.js} +181 -71
- package/dist/cjs/{hasInclusivePrice-84KS94yH.js → hasInclusivePrice-CEPf3_FG.js} +1 -1
- package/dist/cjs/index.cjs.js +104 -12
- package/dist/cjs/{invoice-5hVfSXpb.js → invoice-DzRkkpLu.js} +3 -3
- package/dist/cjs/{localization-B2mjW0Xa.js → localization-BhNVhLZs.js} +24 -48
- package/dist/cjs/{paypal-pd8Nz_R_.js → paypal-DCSqbdjW.js} +4 -4
- package/dist/cjs/{placeTestOrder-DrI8rD9o.js → placeTestOrder-Bkip4PUT.js} +3 -3
- package/dist/cjs/{renderCheckoutCurrency-u5q8YdUb.js → renderCheckoutCurrency-BDvEZ3Hv.js} +2 -2
- package/dist/cjs/{shouldShowLanguageSelect-gBg4KeTQ.js → shouldShowLanguageSelect-NOVWOU53.js} +1 -1
- package/dist/cjs/{submitGtag-Rc-S3PnH.js → submitGtag-D4sB7w4z.js} +1 -1
- package/dist/cjs/{taxIdFields-BrIaPTcd.js → taxIdFields-e4OCgr8K.js} +2 -2
- package/dist/cjs/{updateCheckoutSessionAttributes-d0IKpwW8.js → updateCheckoutSessionAttributes-KxwcsKhM.js} +1 -1
- package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +5 -5
- package/dist/cjs/zonos-address-display_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +4 -4
- package/dist/cjs/zonos-card_5.cjs.entry.js +5 -5
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +18 -18
- package/dist/cjs/zonos-checkout.cjs.entry.js +9 -9
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +9 -9
- package/dist/cjs/zonos-collect.cjs.entry.js +6 -6
- package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +3 -3
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +9 -9
- package/dist/cjs/zonos-invoice.cjs.entry.js +6 -6
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +4 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +8 -7
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -3
- package/dist/collection/components/main/zonos-controller.js +3 -2
- package/dist/collection/components/store/checkout/cart.js +3 -2
- package/dist/collection/components/store/checkout/stripe.js +10 -9
- package/dist/collection/components/store/storageStore.js +7 -6
- package/dist/collection/components/utils/__tests__/helpers/blockStorage.js +24 -0
- package/dist/collection/components/utils/api/getExchangeRate.js +2 -1
- package/dist/collection/components/utils/handleFetch.js +19 -9
- package/dist/collection/components/utils/hello/countryOverrideStorage.js +17 -40
- package/dist/collection/components/utils/logging/installConstructorCapture.js +58 -0
- package/dist/collection/components/utils/logging/reportBlockedStorage.js +34 -0
- package/dist/collection/components/utils/logging/sendErrorLog.js +8 -1
- package/dist/collection/components/utils/logging/startZonosInit.js +35 -0
- package/dist/collection/components/utils/logging/thrownMessage.js +16 -0
- package/dist/collection/components/utils/safeStorage.js +39 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +3 -2
- package/dist/collection/scripts/_zonosBase.js +6 -2
- package/dist/collection/types/generated/graphql.frontend.types.js +0 -16
- package/dist/collection/types/generated/graphql.internal.types.js +215 -1
- package/dist/esm/{cart-DmJkjiDE.js → cart-BS5mSI8x.js} +13 -13
- package/dist/esm/{collect-BV5GTPmh.js → collect-B9ZxDDl7.js} +3 -3
- package/dist/esm/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
- package/dist/esm/{handleFetch-D5GYDF-O.js → handleFetch-BFVO7oAR.js} +178 -72
- package/dist/esm/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-zSvDReDb.js} +1 -1
- package/dist/esm/index.js +104 -12
- package/dist/esm/{invoice-CO-iqlni.js → invoice-6iTuS6ek.js} +3 -3
- package/dist/esm/{localization-DHM91diu.js → localization-CXHiWcJp.js} +24 -48
- package/dist/esm/{paypal-BfW5aLJw.js → paypal-BE_NVBoy.js} +4 -4
- package/dist/esm/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BXA9K9Iy.js} +3 -3
- package/dist/esm/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
- package/dist/esm/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
- package/dist/esm/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
- package/dist/esm/{taxIdFields-ByEYfsO5.js → taxIdFields-BUKnHMaL.js} +2 -2
- package/dist/esm/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
- package/dist/esm/zonos-address-completion-dialog_7.entry.js +5 -5
- package/dist/esm/zonos-address-display_2.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +4 -4
- package/dist/esm/zonos-airwallex-payment.entry.js +4 -4
- package/dist/esm/zonos-card_5.entry.js +5 -5
- package/dist/esm/zonos-cart-items_12.entry.js +18 -18
- package/dist/esm/zonos-checkout.entry.js +9 -9
- package/dist/esm/zonos-collect-cart-items_3.entry.js +3 -3
- package/dist/esm/zonos-collect-finish_6.entry.js +9 -9
- package/dist/esm/zonos-collect.entry.js +6 -6
- package/dist/esm/zonos-controller.entry.js +6 -6
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +3 -3
- package/dist/esm/zonos-hello-dialog.entry.js +3 -3
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +5 -5
- package/dist/esm/zonos-invoice-finish_5.entry.js +9 -9
- package/dist/esm/zonos-invoice.entry.js +6 -6
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-policy-consent_2.entry.js +4 -4
- package/dist/esm-es5/{cart-DmJkjiDE.js → cart-BS5mSI8x.js} +58 -58
- package/dist/esm-es5/{collect-BV5GTPmh.js → collect-B9ZxDDl7.js} +1 -1
- package/dist/esm-es5/{getMissingRequiredShippingFields-DljgpDZe.js → getMissingRequiredShippingFields-BkEV865q.js} +1 -1
- package/dist/esm-es5/handleFetch-BFVO7oAR.js +73 -0
- package/dist/esm-es5/{hasInclusivePrice-DhGXpH2D.js → hasInclusivePrice-zSvDReDb.js} +1 -1
- package/dist/esm-es5/index.js +26 -8
- package/dist/esm-es5/{invoice-CO-iqlni.js → invoice-6iTuS6ek.js} +1 -1
- package/dist/esm-es5/{localization-DHM91diu.js → localization-CXHiWcJp.js} +6 -9
- package/dist/esm-es5/{paypal-BfW5aLJw.js → paypal-BE_NVBoy.js} +1 -1
- package/dist/esm-es5/{placeTestOrder-CyWUFhxD.js → placeTestOrder-BXA9K9Iy.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-B31ZNkUv.js → renderCheckoutCurrency-KMa4HlAf.js} +2 -2
- package/dist/esm-es5/{shouldShowLanguageSelect-DwSfSHar.js → shouldShowLanguageSelect-BI_ApEsQ.js} +1 -1
- package/dist/esm-es5/{submitGtag-BEFrutel.js → submitGtag-C5xzFHjG.js} +1 -1
- package/dist/esm-es5/{taxIdFields-ByEYfsO5.js → taxIdFields-BUKnHMaL.js} +2 -2
- package/dist/esm-es5/{updateCheckoutSessionAttributes-B0bQH0uw.js → updateCheckoutSessionAttributes-C9bMKTjz.js} +1 -1
- package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
- package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.entry.js +6 -6
- package/dist/esm-es5/zonos-cart-items_12.entry.js +127 -127
- package/dist/esm-es5/zonos-checkout.entry.js +3 -3
- package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.entry.js +6 -6
- package/dist/esm-es5/zonos-controller.entry.js +5 -5
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +3 -3
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
- package/dist/scripts/index.d.ts +6 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/utils/__tests__/helpers/blockStorage.d.ts +3 -0
- package/dist/types/components/utils/logging/installConstructorCapture.d.ts +20 -0
- package/dist/types/components/utils/logging/reportBlockedStorage.d.ts +16 -0
- package/dist/types/components/utils/logging/startZonosInit.d.ts +5 -0
- package/dist/types/components/utils/logging/thrownMessage.d.ts +1 -0
- package/dist/types/components/utils/safeStorage.d.ts +4 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +5 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +0 -22
- package/dist/types/types/generated/graphql.frontend.types.ts +0 -51
- package/dist/types/types/generated/graphql.internal.types.d.ts +270 -1
- package/dist/types/types/generated/graphql.internal.types.ts +341 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-8fa6cfff.entry.js → p-08b01c96.entry.js} +1 -1
- package/dist/zonos-elements/{p-3e705c9b.entry.js → p-0909ef77.entry.js} +1 -1
- package/dist/zonos-elements/{p-2b63865a.system.entry.js → p-13015d34.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d513aa3.entry.js → p-13d5b2f9.entry.js} +1 -1
- package/dist/zonos-elements/{p-46a839d2.system.entry.js → p-150047b3.system.entry.js} +16 -16
- package/dist/zonos-elements/{p-6e691736.entry.js → p-1986cc37.entry.js} +1 -1
- package/dist/zonos-elements/{p-vTIygnHq.system.js → p-1OG3IJgY.system.js} +1 -1
- package/dist/zonos-elements/{p-189cc594.system.entry.js → p-30bf4700.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4917b74d.entry.js → p-3466bcba.entry.js} +1 -1
- package/dist/zonos-elements/{p-12b24ebb.entry.js → p-383343c7.entry.js} +1 -1
- package/dist/zonos-elements/{p-5585db86.system.entry.js → p-3a506614.system.entry.js} +36 -36
- package/dist/zonos-elements/{p-46b9f0cf.entry.js → p-43c0ebe9.entry.js} +1 -1
- package/dist/zonos-elements/{p-84e76348.entry.js → p-4b65f192.entry.js} +1 -1
- package/dist/zonos-elements/{p-216a908d.system.entry.js → p-573a4e7c.system.entry.js} +6 -6
- package/dist/zonos-elements/{p-1fda4aec.system.entry.js → p-5a296dbc.system.entry.js} +87 -87
- package/dist/zonos-elements/{p-960070d0.system.entry.js → p-68325c5a.system.entry.js} +4 -4
- package/dist/zonos-elements/{p-53eac12f.system.entry.js → p-6db7317a.system.entry.js} +13 -13
- package/dist/zonos-elements/{p-1199baef.system.entry.js → p-709d1561.system.entry.js} +1 -1
- package/dist/zonos-elements/p-71d29603.entry.js +1 -0
- package/dist/zonos-elements/{p-064d8829.system.entry.js → p-7214c953.system.entry.js} +23 -23
- package/dist/zonos-elements/{p-65817880.entry.js → p-7fe83919.entry.js} +1 -1
- package/dist/zonos-elements/p-8ac26831.entry.js +1 -0
- package/dist/zonos-elements/{p-cccaad60.system.entry.js → p-8f9f859f.system.entry.js} +9 -9
- package/dist/zonos-elements/{p-f5f95990.system.entry.js → p-96b250d8.system.entry.js} +14 -14
- package/dist/zonos-elements/{p-678b9214.entry.js → p-97729873.entry.js} +1 -1
- package/dist/zonos-elements/{p-f3d9a380.system.entry.js → p-9b3668a4.system.entry.js} +144 -144
- package/dist/zonos-elements/{p-d8f375da.system.entry.js → p-9df31243.system.entry.js} +1 -1
- package/dist/zonos-elements/p-BI6VAB5B.js +1 -0
- package/dist/zonos-elements/p-BJFa5RwX.js +1 -0
- package/dist/zonos-elements/p-BJ_kE5rM.js +1 -0
- package/dist/zonos-elements/{p-XoQH3S7Z.system.js → p-BKUlQxBd.system.js} +1 -1
- package/dist/zonos-elements/{p-DprOoI2W.system.js → p-BUfCTQXY.system.js} +154 -154
- package/dist/zonos-elements/{p-CBUz18kA.system.js → p-BnQyot7Y.system.js} +23 -23
- package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
- package/dist/zonos-elements/{p-CMo3ZweU.js → p-C-zdj7MK.js} +1 -1
- package/dist/zonos-elements/{p-iAIzUA4k.js → p-C5fs3rIR.js} +1 -1
- package/dist/zonos-elements/{p-D1e9zNDA.js → p-CJmWr75U.js} +1 -1
- package/dist/zonos-elements/{p-Dtu_Japy.system.js → p-CMneHjck.system.js} +39 -39
- package/dist/zonos-elements/p-CP7KnfR3.system.js +245 -0
- package/dist/zonos-elements/p-CVRbGFV3.js +1 -0
- package/dist/zonos-elements/p-Cl5yV0ak.js +1 -0
- package/dist/zonos-elements/{p-CGNVm52g.system.js → p-Cp1IAJvW.system.js} +5 -5
- package/dist/zonos-elements/{p-6vSUiBfr.system.js → p-D-Lnf8mS.system.js} +50 -53
- package/dist/zonos-elements/p-D0DkOoAw.system.js +73 -0
- package/dist/zonos-elements/p-D4xpkSsK.js +1 -0
- package/dist/zonos-elements/p-DATNIakn.js +1 -0
- package/dist/zonos-elements/{p-CbhN65lj.system.js → p-DC1OPJDq.system.js} +1 -1
- package/dist/zonos-elements/{p-CHKKvuiz.js → p-DKnphvmJ.js} +1 -1
- package/dist/zonos-elements/{p-ojtNq-r5.system.js → p-DXlojp_Y.system.js} +1 -1
- package/dist/zonos-elements/{p-C9XLkmmb.system.js → p-DrS-0mk7.system.js} +1 -1
- package/dist/zonos-elements/{p-DpwmHU8R.js → p-DrbN3rPL.js} +2 -2
- package/dist/zonos-elements/{p-BrQ8n8NS.system.js → p-Dv5a-V6w.system.js} +3 -3
- package/dist/zonos-elements/{p-55813e9f.system.entry.js → p-a3c147d2.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-DiMEP3mh.js → p-aK18R41t.js} +1 -1
- package/dist/zonos-elements/p-af4ad54b.entry.js +1 -0
- package/dist/zonos-elements/{p-1e6db427.entry.js → p-af741506.entry.js} +1 -1
- package/dist/zonos-elements/{p-2ca826b9.system.entry.js → p-b540c636.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-636b71d4.entry.js → p-bac94956.entry.js} +1 -1
- package/dist/zonos-elements/{p-941a95a1.system.entry.js → p-bb1b414a.system.entry.js} +5 -5
- package/dist/zonos-elements/{p-e7fdb2c9.entry.js → p-bfa9e32a.entry.js} +1 -1
- package/dist/zonos-elements/p-cf6bf7a4.entry.js +1 -0
- package/dist/zonos-elements/p-dJcbnNlE.system.js +7 -0
- package/dist/zonos-elements/{p-7dc7f328.entry.js → p-db40b9c3.entry.js} +1 -1
- package/dist/zonos-elements/{p-d3345b2c.entry.js → p-dd003161.entry.js} +1 -1
- package/dist/zonos-elements/{p-ef5344ea.entry.js → p-e374aaa4.entry.js} +1 -1
- package/dist/zonos-elements/{p-6410fa11.system.entry.js → p-e43470f7.system.entry.js} +22 -22
- package/dist/zonos-elements/{p-fda89981.system.entry.js → p-ebc7ea54.system.entry.js} +3 -3
- package/dist/zonos-elements/{p-1cc42a98.system.entry.js → p-f2ed52bc.system.entry.js} +16 -16
- package/dist/zonos-elements/p-gEViRqvf.js +1 -0
- package/dist/zonos-elements/{p-DgUrB-1a.system.js → p-yv7ekcdG.system.js} +2 -2
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/handleFetch-D5GYDF-O.js +0 -60
- package/dist/zonos-elements/p-107f287b.entry.js +0 -1
- package/dist/zonos-elements/p-25eb99d4.entry.js +0 -1
- package/dist/zonos-elements/p-8f9d8795.entry.js +0 -1
- package/dist/zonos-elements/p-BMPYH-LT.js +0 -1
- package/dist/zonos-elements/p-C70h5mKA.js +0 -1
- package/dist/zonos-elements/p-CTiqplrr.js +0 -1
- package/dist/zonos-elements/p-Ch1w0Lr7.js +0 -1
- package/dist/zonos-elements/p-D1SmY_fZ.js +0 -1
- package/dist/zonos-elements/p-D6xXnsM_.js +0 -1
- package/dist/zonos-elements/p-DE4a-QD5.js +0 -1
- package/dist/zonos-elements/p-DQrMfUzi.system.js +0 -227
- package/dist/zonos-elements/p-DZdkJHK9.system.js +0 -7
- package/dist/zonos-elements/p-U33isUJG.js +0 -1
- package/dist/zonos-elements/p-ebe157b5.entry.js +0 -1
- package/dist/zonos-elements/p-zVLAvre1.system.js +0 -60
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(o,e,n,i){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,t){function c(o){try{a(i.next(o))}catch(o){t(o)}}function r(o){try{a(i["throw"](o))}catch(o){t(o)}}function a(o){o.done?n(o.value):s(o.value).then(c,r)}a((i=i.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,s,t,c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=r(0),c["throw"]=r(1),c["return"]=r(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(e){return a([o,e])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(n=0)),n)try{if(i=1,s&&(t=r[0]&2?s["return"]:r[0]?s["throw"]||((t=s["return"])&&t.call(s),0):s.next)&&!(t=t.call(s,r[1])).done)return t;if(s=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:n.label++;return{value:r[1],done:false};case 5:n.label++;s=r[1];r=[0];continue;case 7:r=n.ops.pop();n.trys.pop();continue;default:if(!(t=n.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){n=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){n.label=r[1];break}if(r[0]===6&&n.label<t[1]){n.label=t[1];t=r;break}if(t&&n.label<t[2]){n.label=t[2];n.ops.push(r);break}if(t[2])n.ops.pop();n.trys.pop();continue}r=e.call(o,n)}catch(o){r=[6,o];s=0}finally{i=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,h,a as Host,F as Fragment}from"./index-_lt63o7c.js";import{b as stripeStore,i as initStripeElements,c as stripeStoreRetrievePayment,d as cartStore,r as cartStoreUpdateToErrorState,e as cartStoreUpdateItems,k as stripeStoreInitCheckoutSession,l as stripeStoreGetPaymentIntent,z as stripeStoreUpdateCheckoutSessionBaseCurrency,E as stripeStoreConfirmPayment,J as stripeStoreOnChange,H as stripeStoreReset,f as cartStoreReset}from"./cart-DmJkjiDE.js";import{i as invoiceStoreUpdateSelectedShippingOption,a as invoiceStoreInitShippingInfo,b as invoiceStoreAsyncAddressUpdate,c as invoiceStore}from"./invoice-CO-iqlni.js";import{p as paypalStoreHasPaypalEnabled,a as paypalStore}from"./paypal-BfW5aLJw.js";import{s as storageStore,t as translate,h as localizationStoreOnChange,j as currencyFormat,k as languages,l as localizationStore}from"./localization-DHM91diu.js";import{z as zonosStore}from"./zonosStore-BXP9FvIt.js";import{b as buildCartItemsByTempCart}from"./buildCartItemsByTempCart-BycjkdlE.js";import{h as handleFetch,s as sendErrorLog,l as logError,g as getIsTestMode}from"./handleFetch-D5GYDF-O.js";import{i as isInvoiceMobile,a as isInvoiceTablet}from"./isInvoiceMobileTablet-Clej0Ffe.js";import{c as classes}from"./classes-BJHSB96f.js";import{l as log}from"./VarianceTest-BJmZPrZl.js";import"./taxIdRules-xYlx7ZXW.js";import"./TaxId-DMIgN_sT.js";import"./isDarkColor-YdrG78th.js";import"./getBorderRadius-BiGd45jw.js";import"./isContrastColor-CWLU13s9.js";import"./submitGtag-BEFrutel.js";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>';var zonosInvoiceCss=function(){return".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}"};var ZonosInvoice=/** @class */function(){function o(o){var e=this;registerInstance(this,o);this.storeUnsubscribeList=[];
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,e,n,i){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,t){function c(o){try{a(i.next(o))}catch(o){t(o)}}function r(o){try{a(i["throw"](o))}catch(o){t(o)}}function a(o){o.done?n(o.value):s(o.value).then(c,r)}a((i=i.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},i,s,t,c=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return c.next=r(0),c["throw"]=r(1),c["return"]=r(2),typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function r(o){return function(e){return a([o,e])}}function a(r){if(i)throw new TypeError("Generator is already executing.");while(c&&(c=0,r[0]&&(n=0)),n)try{if(i=1,s&&(t=r[0]&2?s["return"]:r[0]?s["throw"]||((t=s["return"])&&t.call(s),0):s.next)&&!(t=t.call(s,r[1])).done)return t;if(s=0,t)r=[r[0]&2,t.value];switch(r[0]){case 0:case 1:t=r;break;case 4:n.label++;return{value:r[1],done:false};case 5:n.label++;s=r[1];r=[0];continue;case 7:r=n.ops.pop();n.trys.pop();continue;default:if(!(t=n.trys,t=t.length>0&&t[t.length-1])&&(r[0]===6||r[0]===2)){n=0;continue}if(r[0]===3&&(!t||r[1]>t[0]&&r[1]<t[3])){n.label=r[1];break}if(r[0]===6&&n.label<t[1]){n.label=t[1];t=r;break}if(t&&n.label<t[2]){n.label=t[2];n.ops.push(r);break}if(t[2])n.ops.pop();n.trys.pop();continue}r=e.call(o,n)}catch(o){r=[6,o];s=0}finally{i=t=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,h,a as Host,F as Fragment}from"./index-_lt63o7c.js";import{b as stripeStore,i as initStripeElements,c as stripeStoreRetrievePayment,d as cartStore,r as cartStoreUpdateToErrorState,e as cartStoreUpdateItems,k as stripeStoreInitCheckoutSession,l as stripeStoreGetPaymentIntent,z as stripeStoreUpdateCheckoutSessionBaseCurrency,E as stripeStoreConfirmPayment,J as stripeStoreOnChange,H as stripeStoreReset,f as cartStoreReset}from"./cart-BS5mSI8x.js";import{i as invoiceStoreUpdateSelectedShippingOption,a as invoiceStoreInitShippingInfo,b as invoiceStoreAsyncAddressUpdate,c as invoiceStore}from"./invoice-6iTuS6ek.js";import{p as paypalStoreHasPaypalEnabled,a as paypalStore}from"./paypal-BE_NVBoy.js";import{s as storageStore,t as translate,h as localizationStoreOnChange,j as currencyFormat,k as languages,l as localizationStore}from"./localization-CXHiWcJp.js";import{z as zonosStore}from"./zonosStore-BXP9FvIt.js";import{b as buildCartItemsByTempCart}from"./buildCartItemsByTempCart-BycjkdlE.js";import{h as handleFetch,s as sendErrorLog,l as logError,g as getIsTestMode}from"./handleFetch-BFVO7oAR.js";import{i as isInvoiceMobile,a as isInvoiceTablet}from"./isInvoiceMobileTablet-Clej0Ffe.js";import{c as classes}from"./classes-BJHSB96f.js";import{l as log}from"./VarianceTest-BJmZPrZl.js";import"./taxIdRules-xYlx7ZXW.js";import"./TaxId-DMIgN_sT.js";import"./isDarkColor-YdrG78th.js";import"./getBorderRadius-BiGd45jw.js";import"./isContrastColor-CWLU13s9.js";import"./submitGtag-C5xzFHjG.js";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>';var zonosInvoiceCss=function(){return".sc-zonos-invoice-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-invoice-h *.sc-zonos-invoice{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-invoice-h img.sc-zonos-invoice{max-width:100%}.sc-zonos-invoice-h dl.sc-zonos-invoice,.sc-zonos-invoice-h dd.sc-zonos-invoice,.sc-zonos-invoice-h h1.sc-zonos-invoice,.sc-zonos-invoice-h h2.sc-zonos-invoice,.sc-zonos-invoice-h h3.sc-zonos-invoice,.sc-zonos-invoice-h h4.sc-zonos-invoice,.sc-zonos-invoice-h h5.sc-zonos-invoice,.sc-zonos-invoice-h h6.sc-zonos-invoice,.sc-zonos-invoice-h hr.sc-zonos-invoice,.sc-zonos-invoice-h figure.sc-zonos-invoice,.sc-zonos-invoice-h p.sc-zonos-invoice,.sc-zonos-invoice-h pre.sc-zonos-invoice{margin:0}.sc-zonos-invoice-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-invoice-h{z-index:2147483647;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;top:0;left:0;width:100%;height:100%;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h *.sc-zonos-invoice{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar{width:10px}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-invoice-h *.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;width:100%;-ms-flex-pack:center;justify-content:center}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex:1;flex:1;padding:56px 80px 60px;max-width:800px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200);overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:32px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{background-color:var(--zonos-elements-gray-0)}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:100%;max-width:1400px;max-height:100%;height:calc(100% - 100px);overflow:hidden;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--header.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice .zonos--logo.sc-zonos-invoice{margin-bottom:0}.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice zonos-checkout-finish.sc-zonos-invoice{-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{padding:0 8px 8px}.sc-zonos-invoice-h .zonos--left.sc-zonos-invoice .zonos--payment-error-banner.sc-zonos-invoice{margin-top:24px}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.sc-zonos-invoice-h .zonos--right.sc-zonos-invoice .zonos--order-details-container.sc-zonos-invoice{overflow:auto}.sc-zonos-invoice-h .zonos--wrapper.sc-zonos-invoice{overflow:auto;max-height:100%;position:relative}.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;-ms-flex:1;flex:1}.sc-zonos-invoice-h .zonos--logo-wrapper.sc-zonos-invoice>*.sc-zonos-invoice{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-invoice-h .zonos--header-right.sc-zonos-invoice{display:none}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-invoice-h .zonos--logo.sc-zonos-invoice img.sc-zonos-invoice{max-height:70px;-o-object-position:left center;object-position:left center;-o-object-fit:contain;object-fit:contain}.sc-zonos-invoice-h .zonos--invoice-container.sc-zonos-invoice{overflow:visible}.mobile.sc-zonos-invoice-h,.tablet.sc-zonos-invoice-h{min-width:auto}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{padding-bottom:0}}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--review.sc-zonos-invoice{margin-bottom:0}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice .zonos--cart-items.sc-zonos-invoice{margin-top:8px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice zonos-checkout-footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--wrapper.sc-zonos-invoice{max-height:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--footer.sc-zonos-invoice{-ms-flex-order:3;order:3}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--done.sc-zonos-invoice{width:auto}.mobile.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--cart-subtotal.sc-zonos-invoice{margin:0}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{position:-webkit-sticky;position:sticky;top:0;width:100%;padding:16px;background-color:var(--zonos-elements-gray-0);z-index:3}.mobile.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-title.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{max-width:800px;padding:0 16px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{overflow:auto;-ms-flex-pack:unset;justify-content:unset;-ms-flex-align:center;align-items:center;gap:24px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--left.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{overflow:visible;width:100%}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--right.sc-zonos-invoice{gap:32px}.mobile.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice,.tablet.sc-zonos-invoice-h .flex--wrapper.sc-zonos-invoice{margin-top:0}.mobile.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice,.tablet.sc-zonos-invoice-h zonos-collect-footer.sc-zonos-invoice{-ms-flex-order:3;order:3;left:0}.tablet.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:56px;top:-56px}.mobile.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice .zonos--header-right.sc-zonos-invoice{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.mobile.sc-zonos-invoice-h .zonos--header-wrapper.sc-zonos-invoice{padding-top:28px;top:-28px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice{position:fixed;left:0;right:0;bottom:0;-webkit-transform-origin:bottom center;transform-origin:bottom center;width:100vw;background:var(--zonos-elements-surface-color);-webkit-box-shadow:var(--zonos-elements-v3-shadow-xl);box-shadow:var(--zonos-elements-v3-shadow-xl);border-radius:var(--zonos-elements-radius-12);max-width:100vw;max-height:500px;z-index:2147483011;overflow:auto;-webkit-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out;transition:transform 0.3s ease-out, opacity 0.3s ease-out, -webkit-transform 0.3s ease-out;-ms-scroll-chaining:none;overscroll-behavior:contain}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar{width:10px}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.sc-zonos-invoice::-webkit-scrollbar-track{border-top-right-radius:var(--zonos-elements-radius-12);border-bottom-right-radius:var(--zonos-elements-radius-12)}.mobile.sc-zonos-invoice-h .zonos--invoice-language-dialog.zonos--invoice-language-dialog-open.sc-zonos-invoice{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.iframed.sc-zonos-invoice-h .zonos--content.sc-zonos-invoice{-ms-scroll-chaining:chained;overscroll-behavior:auto}"};var ZonosInvoice=/** @class */function(){function o(o){var e=this;registerInstance(this,o);this.storeUnsubscribeList=[];
|
|
2
2
|
/**
|
|
3
3
|
* Listener for locale change in localization store
|
|
4
4
|
*/this.onChangeLocaleListener=function(){};
|
|
@@ -54,11 +54,11 @@ if(!i){log("No stripe client secret found in the URL, proceed to order if cart d
|
|
|
54
54
|
*/o.prototype.resizeListener=function(){this.isMobile=isInvoiceMobile(this.mobile);this.isTablet=isInvoiceTablet(this.tablet)};
|
|
55
55
|
/**
|
|
56
56
|
* For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
|
|
57
|
-
*/o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){stripeStore.stripe=window.Zonos.stripe;cartStore.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2/*return*/]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a,l,v,d,z,h,u,f,m,
|
|
57
|
+
*/o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){stripeStore.stripe=window.Zonos.stripe;cartStore.step="finish";this.storybookPaymentStatusOverride=o;this.isOverlayLoading=false;return[2/*return*/]}))}))};o.prototype.initInvoiceCart=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,i,s,t,c,r,a,l,v,d,z,h,u,f,p,m,g,b,w,x,S;return __generator(this,(function(y){switch(y.label){case 0:
|
|
58
58
|
// Should not happen since we will throw error way earlier if cartData is not available
|
|
59
59
|
if(!window.Zonos.cartData){return[2/*return*/]}d=(e=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.items[0])===null||e===void 0?void 0:e.currencyCode;if(d){cartStore.currency=d}z=(i=(n=window.Zonos.cartData)===null||n===void 0?void 0:n.references)===null||i===void 0?void 0:i.checkoutSessionId;h=(t=(s=window.Zonos.cartData)===null||s===void 0?void 0:s.references)===null||t===void 0?void 0:t.landedCostId;if(!h){cartStoreUpdateToErrorState({messages:[translate("Session does not have valid landed cost. Please contact [organizationName] for assistance.",{organizationName:zonosStore.organizationName})],title:translate("Invalid session")});return[2/*return*/]}
|
|
60
60
|
// Override checkout session id for invoice if we found one in the cart reference
|
|
61
|
-
if(z){log("Setting checkout session id from cart reference","info",z);storageStore.checkoutSessionId=z}else{log("Clear checkout session id from storage so we start from a fresh session for the invoice cart");storageStore.checkoutSessionId=null}return[4/*yield*/,this.checkStripePaymentIntentStatus()];case 1:u=y.sent().shouldAllowOrder;if(!u){return[2/*return*/]}y.label=2;case 2:y.trys.push([2,11,,12]);f=buildCartItemsByTempCart(window.Zonos.cartData),
|
|
61
|
+
if(z){log("Setting checkout session id from cart reference","info",z);storageStore.checkoutSessionId=z}else{log("Clear checkout session id from storage so we start from a fresh session for the invoice cart");storageStore.checkoutSessionId=null}return[4/*yield*/,this.checkStripePaymentIntentStatus()];case 1:u=y.sent().shouldAllowOrder;if(!u){return[2/*return*/]}y.label=2;case 2:y.trys.push([2,11,,12]);f=buildCartItemsByTempCart(window.Zonos.cartData),p=f.adjustments,m=f.cartItems;return[4/*yield*/,cartStoreUpdateItems({adjustments:p,cartItems:m,landedCostId:h,
|
|
62
62
|
// No need to init session on failure since we will always create a new one if there is no checkout session id in the cart references
|
|
63
63
|
shouldInitSessionOnFailure:false})];case 3:y.sent();if(!(!storageStore.checkoutSessionId&&!z))return[3/*break*/,5];return[4/*yield*/,stripeStoreInitCheckoutSession()];case 4:g=y.sent();log("stripeStoreInitCheckoutSession: ".concat(g));if(!g){throw new Error("Failed to initialize checkout session! The cart might be created with LIVE Invoice quote but being used with sandbox credential")}y.label=5;case 5:if(!((!cartStore.checkoutSession||((c=cartStore.checkoutSession)===null||c===void 0?void 0:c.completedAt))&&z))return[3/*break*/,9];return[4/*yield*/,this.fetchCheckoutSession(z)];case 6:b=y.sent();
|
|
64
64
|
// Some merchants use landed cost id as the confirmation id
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as registerInstance,h,a as Host}from"./index-_lt63o7c.js";import{D as localizationStoreUpdateSelectedLocale,t as translate,A as getSupportedLanguages,l as localizationStore}from"./localization-
|
|
1
|
+
import{r as registerInstance,h,a as Host}from"./index-_lt63o7c.js";import{D as localizationStoreUpdateSelectedLocale,t as translate,A as getSupportedLanguages,l as localizationStore}from"./localization-CXHiWcJp.js";import{a as zonosStoreFontFamily}from"./zonosStore-BXP9FvIt.js";import"./handleFetch-BFVO7oAR.js";import"./VarianceTest-BJmZPrZl.js";var GreenCheckDuotoneIcon='<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.99996 2.6665C5.05444 2.6665 2.66663 5.05432 2.66663 7.99984C2.66663 10.9454 5.05444 13.3332 7.99996 13.3332C10.9455 13.3332 13.3333 10.9454 13.3333 7.99984C13.3333 5.05432 10.9455 2.6665 7.99996 2.6665Z" fill="#AFF8C3"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1403 6.10535C10.3582 6.27488 10.3975 6.58902 10.228 6.80699L8.01055 9.65797C7.76436 9.97449 7.29646 10.0036 7.01291 9.72008L5.81307 8.52024C5.61781 8.32498 5.61781 8.0084 5.81307 7.81314C6.00833 7.61787 6.32492 7.61787 6.52018 7.81314L7.45301 8.74597L9.43862 6.19305C9.60815 5.97508 9.92229 5.93581 10.1403 6.10535Z" fill="#246627"/>\n</svg>\n';var zonosLanguageSelectCss=function(){return":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 .zonos--language-select{width:100%}:host .zonos--language-select .zonos--language-select-content{display:grid;grid-template-columns:repeat(3, minmax(-webkit-max-content, 1fr));grid-template-columns:repeat(3, minmax(max-content, 1fr));padding:16px;padding-top:0px}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button{display:-ms-flexbox;display:flex;padding:8px;gap:4px;-ms-flex-align:center;align-items:center;border-radius:var(--zonos-elements-radius-4);cursor:pointer;width:100%;border:none;background:none}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button:hover{background:var(--zonos-elements-gray-100)}@media (max-width: 400px){:host .zonos--language-select .zonos--language-select-content{grid-template-columns:1fr 1fr}}"};var ZonosLanguageSelect=/** @class */function(){function e(e){var o=this;registerInstance(this,e);
|
|
2
2
|
/**
|
|
3
3
|
* Function to close the language select
|
|
4
4
|
* @default () => {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,o,t,r){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function i(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r["throw"](e))}catch(e){s(e)}}function l(e){e.done?t(e.value):n(e.value).then(i,a)}l((r=r.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=a(0),i["throw"]=a(1),i["return"]=a(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(o){return l([e,o])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,a[0]&&(t=0)),t)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1];s=a;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(a);break}if(s[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,F as Fragment,a as Host,g as getElement}from"./index-_lt63o7c.js";import{a2 as getEnabledPolicies,G as policyConsentStore,a3 as storeCreditStoreSetEnabled,a4 as storeCreditStoreSetUseFullBalance,a5 as cartStoreUpdateStoreCredit,R as storeCreditStore,a6 as storeCreditStoreSetAmount,a7 as storeCreditStoreRefreshBalance,K as storeCreditStoreGetEffectiveAmount}from"./cart-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,o,t,r){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,s){function i(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r["throw"](e))}catch(e){s(e)}}function l(e){e.done?t(e.value):n(e.value).then(i,a)}l((r=r.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=a(0),i["throw"]=a(1),i["return"]=a(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(o){return l([e,o])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(i&&(i=0,a[0]&&(t=0)),t)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(s=t.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1];s=a;break}if(s&&t.label<s[2]){t.label=s[2];t.ops.push(a);break}if(s[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,F as Fragment,a as Host,g as getElement}from"./index-_lt63o7c.js";import{a2 as getEnabledPolicies,G as policyConsentStore,a3 as storeCreditStoreSetEnabled,a4 as storeCreditStoreSetUseFullBalance,a5 as cartStoreUpdateStoreCredit,R as storeCreditStore,a6 as storeCreditStoreSetAmount,a7 as storeCreditStoreRefreshBalance,K as storeCreditStoreGetEffectiveAmount}from"./cart-BS5mSI8x.js";import{l as localizationStore,t as translate}from"./localization-CXHiWcJp.js";import{z as zonosStore,a as zonosStoreFontFamily}from"./zonosStore-BXP9FvIt.js";import{r as renderCheckoutCurrency}from"./renderCheckoutCurrency-KMa4HlAf.js";import{g as getBorderRadius}from"./getBorderRadius-BiGd45jw.js";import"./taxIdRules-xYlx7ZXW.js";import"./TaxId-DMIgN_sT.js";import"./VarianceTest-BJmZPrZl.js";import"./handleFetch-BFVO7oAR.js";import"./isDarkColor-YdrG78th.js";var zonosPolicyConsentCss=function(){return":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}"};var POLICIES_SENTINEL="POLICIES";var ZonosPolicyConsent=/** @class */function(){function e(e){registerInstance(this,e)}e.prototype.render=function(){var e=getEnabledPolicies();if(!e.length){return null}
|
|
2
2
|
// Build the locale-aware joined list ("X, Y, and Z" in English, equivalent in other locales).
|
|
3
3
|
var o=Intl.ListFormat;var t=o?new o(localizationStore.selectedLocale,{style:"long",type:"conjunction"}).formatToParts(e.map((function(e){return e.name}))):// Fallback for environments without Intl.ListFormat: simple ", "-joined list.
|
|
4
4
|
e.flatMap((function(e,o){return o===0?[{type:"element",value:e.name}]:[{type:"literal",value:", "},{type:"element",value:e.name}]}));var r=t.map((function(o){if(o.type==="literal"){return o.value}
|
package/dist/scripts/index.d.ts
CHANGED
|
@@ -1317,6 +1317,11 @@ type CartCheckoutWorkflowQuery = {
|
|
|
1317
1317
|
variantKey: string;
|
|
1318
1318
|
}>;
|
|
1319
1319
|
}> | null;
|
|
1320
|
+
plugins: {
|
|
1321
|
+
bigcommerce: {
|
|
1322
|
+
allowBypassQuery: boolean;
|
|
1323
|
+
};
|
|
1324
|
+
};
|
|
1320
1325
|
};
|
|
1321
1326
|
onlineStoreSettings: {
|
|
1322
1327
|
allowedDomains: Array<string>;
|
|
@@ -1545,6 +1550,7 @@ type GetOrderQuery = {
|
|
|
1545
1550
|
createdAt: string;
|
|
1546
1551
|
amount: number;
|
|
1547
1552
|
itemType: ItemType | null;
|
|
1553
|
+
parentProductId: string | null;
|
|
1548
1554
|
description: string | null;
|
|
1549
1555
|
hsCode: string | null;
|
|
1550
1556
|
countryOfOrigin: CountryCode | null;
|
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=performance.now(),n=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},r=(e,o,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const e=performance.now()-t,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(n).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(i=d.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(o){case"warn":c.warn(e,...l);break;case"info":c.info(e,...l);break;case"error":c.error(e,...l);break;default:c.groupCollapsed(e,...l),c.trace(),c.groupEnd()}},s=(e,...o)=>{r(e,"error",...o)},i=["jsdelivr","cdnjs","unpkg","vercel"],a="jsdelivr",l=e=>{const o=i.indexOf(e);return i[o+1]||null},d=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function u(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const p=["cloudflare","vercel"],m=p[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},y=w[m],h=(e=m)=>{const o=p.indexOf(e),t=p[o+1];return t||null},g=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},f=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},v=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=g(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},S=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||w[e]||m,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:a}}const d=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:d}:e),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:d}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:a}}},C=async({basePathType:e,options:o,path:t})=>{var n,s;const i=t.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),l=await S({basePathType:i,options:o,path:t}),{errors:d,response:c}=l,p=u(l,["errors","response"]),m=performance.now()-a;r(`${t} (${m.toFixed(2)}ms)`,"info");const b=null==c?void 0:c.headers.get("Zonos-Duration");200===(null==c?void 0:c.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(v.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=f(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:i,loadTimeInternal:b?Number(b):0,loadTimeTotal:m});const z=h(i),k=d.find(({type:e})=>"unknown"===e),Z=d.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!k||404===(null==c?void 0:c.status)||500===(null==c?void 0:c.status),j=z&&I;return I&&!Z&&(async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{r("sendErrorLog","warn",e,t,o);{const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},t)};try{fetch(`${y}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=h();if(!o)return;fetch(`${w[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:w[i]+t,errors:d.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:z,requestHeaders:null==o?void 0:o.headers,requestPayload:g(null===(n=null==o?void 0:o.body)||void 0===n?void 0:n.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:j,status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),j?(r(`=== "${t}" failed to fetch, trying next fallback ${z}`),C({basePathType:z,options:o,path:t})):Object.assign({errors:d,response:c},p)},z=async(e,o)=>{const t=u(o||{},[]),n=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",s=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":d()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(s).forEach(e=>void 0===s[e]&&delete s[e]);const i=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:n,headers:s,method:r}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return C({basePathType:a||m,options:i,path:e})},k=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.5.1.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const n=`https://${o}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},Z="https://js.stripe.com/v3",I=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let j=null;const O=e=>(null!==j||(j=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&I.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${Z}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(s("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),j),A=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?O(null):null);let E=!1;A.catch(e=>{E||console.warn(e)});const T=async(...e)=>{var o;E=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const[n,r]=o,s=Object.assign({},r),i=(e=>{if(!("version"in e))return;const{version:o}=e;return"number"==typeof o||"string"==typeof o?o:void 0})(e);"string"==typeof i&&i!==3..toString()?delete s.apiVersion:s.apiVersion="2025-02-24.acacia";const a=e(n,s);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(a,t),a})(null!==(o=await A)&&void 0!==o?o:await O(null),e,t)},L=async({cartId:e,retries:o})=>{const t=c(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:a,json:l,zonosMode:d}=await z(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||a.length;return u&&o?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),L({cartId:e,retries:o-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:d})},P=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,$=new RegExp(`^${P.source}$`),D=new RegExp(`^cart_${P.source}$`),U=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,R=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:D.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return s("[ZONOS - loadZonos] invalid cart id"),null;const n=await L({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},F="zonos--checkout-hidden-international-button";var x;const M=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),B=Date.now(),q="https://v1.5.1.js.zonos.com",W=M||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.1",K="https://fonts.googleapis.com",G=/^https:\/\/fonts\.googleapis\.com/;class H{}x=H,H.doneInit=!1,H.cartSettings=null,H.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),H.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),H._paypalMockResponse=null,H.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,H.isBigCommerce=!1,H.releaseDate="1793041468334",H.isLegacyCheckout=!1,H.googleAnalyticId=null,H.googleAnalyticReady=!1,H.facebookPixelId=null,H.facebookPixelReady=!1,H.startLoadTime=B,H.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",H.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),H.overrideUseCustomAddressForm=!1,H.isCollect=!1,H.isInvoice=!1,H.isNpm=!0,H.zonosQaUrl=null,H.zonosQaUrlApi=null,H.trackEventLogs=[],H.version="v1.5.1",H.modeAlerted=!1,H.cartData=null,H.paypal=null,H.zonosMode=null,H.IframeService=o,H.getCurrentTimestamp=()=>(new Date).getTime(),H.zonosController=null,H.loadTimeApiInfoList=[],H.logIntervalId=null,H.init=async e=>{const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:u,zonosApiKey:p}=e;if(x.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),x.createCartId=null==t?void 0:t.createCartId,x.buildCartDetail=null==t?void 0:t.buildCartDetail,x.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${x.version}) ======`),x.zonosApiKey=p,x.storeId=u,"undefined"!=typeof window&&window.parent===window&&(x.googleAnalyticReady=!0,x.facebookPixelReady=!0),x.isNpm){r("====== ZONOS LOADING FROM NPM ======");const o=k();if(o&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=x.isNpm,window.Zonos.isBigCommerce=x.isBigCommerce,window.Zonos.isLegacyCheckout=x.isLegacyCheckout,window.Zonos.zonosMode=x.zonosMode,window.Zonos.init(e)}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!p&&!x.cartId)return void s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!x.cartData&&x.cartId){r("Initialize cart data");const e=await R(x.cartId);if(!e)return void s("Failed to get cart data");x.cartData=e.cartData,x.zonosApiKey=e.zonosApiKey,x.cartSettings=e.settings}const t=await(async()=>{const e=c(),o=d();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await z("/api/get-test-public-credential");if(t.length||!n)return s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const i=n.publicCredential;return i?(r(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(s("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(x.zonosApiKey=t)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(x.cartId&&x.cartData||!!m){r("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}r("init zonos"),x.restoreNativeBrowserFunctions(),x.injectCustomScriptForHostedCheckout(),x.injectZonosCdn(),x.injectZonosCss(),x.injectFonts(),x.injectCheckoutInternationalButton(),x.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),x.doneInit=!0},H.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${F}`)){const e=document.createElement("button");e.id=F,e.style.display="none",document.body.appendChild(e)}},H.injectCustomScriptForHostedCheckout=()=>{const e=x.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){r("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},H.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},H.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${F}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},H.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},H.showNotification=e=>{var o;null===(o=x.zonosController)||void 0===o||o.showNotification(e)},H.updateOrganizationName=e=>{var o;null===(o=x.zonosController)||void 0===o||o.updateOrganizationName(e)},H.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},H.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},H.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{x.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=x.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;r("loading Stripe");const t=await T(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):s("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),x.zonosController=n,r("Zonos controller injected!")},H.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${x.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void r(`Zonos script "${n}" already exists in the document`,"warn");const i=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=n,a.crossOrigin="anonymous",a.onerror=()=>{s(`Failed to load ${a.src}`);const n=l(e);n&&x.injectScript({cdnType:n,isModule:o,theRestUrl:t})},i.appendChild(a)},H.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return W;case"unpkg":return"https://unpkg.com/@zonos/elements@1.5.1";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.1";case"vercel":return q}};if(x.isNpm){return k()||o()}return o()},H.injectZonosCdn=()=>{x.injectScript({cdnType:a,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),x.injectScript({cdnType:a,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},H.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=x.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${q}/`,n.appendChild(r);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{s(`Failed to load ${i.href}`);const t=l(e);t&&x.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(i)},H.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(x.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},H.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${K}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!G.test(t.href))return t}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=K,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${K}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),r("Zonos font injected!")},H.setupGoogleFont=e=>{var o;null===(o=x.zonosController)||void 0===o||o.setupGoogleFont(e)},H.injectSupportGoogleFont=e=>{var o;r(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${K}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=K,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${t} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,n.appendChild(s),r(`[FONT] ${t} font injected!`)},exports.Zonos=H})();
|
|
1
|
+
(function(){"use strict";const e=({id:e,payload:o,target:t,type:n})=>{var r;t instanceof HTMLIFrameElement?null===(r=t.contentWindow)||void 0===r||r.postMessage({id:e,payload:o,type:n},"*"):t.postMessage({id:e,payload:o,type:n},"*")};class o{constructor(o,t){this.targetElement=o,this.targetId=t,this.sendMessage=(o,t)=>{e({id:this.targetId,payload:t,target:this.targetElement,type:o})}}}o.iframeServices={GOOGLE_PLACES:"zonos--private-iframe-google-places-service-m9bmuh7g"},o.sendMessage=e,o.injectPrivateIframe=({id:e,onload:o,src:t})=>{const n=document.createElement("iframe");return n.src=t,n.id=e,n.style.display="none",n.role="presentation",n.ariaHidden="true",n.tabIndex=-1,n.style.border="none !important",n.style.margin="0px !important",n.style.padding="0px !important",n.style.width="1px !important",n.style.minWidth="100% !important",n.style.overflow="hidden !important",n.style.display="block !important",n.style.visibility="hidden !important",n.style.position="fixed !important",n.style.pointerEvents="none !important",n.style.userSelect="none !important",n.style.height="1px !important",n.onload=()=>o(n),document.body.appendChild(n),n};const t=["cloudflare","vercel"],n=t[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},s=r[n],i=(e=n)=>{const o=t.indexOf(e),r=t[o+1];return r||null},a=performance.now(),l=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},d=(e,o,...t)=>{var n,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...t];i.map(l).join(" ");if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const c=(null===(r=d.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":c.warn(e,...i);break;case"info":c.info(e,...i);break;case"error":c.error(e,...i);break;default:c.groupCollapsed(e,...i),c.trace(),c.groupEnd()}},c=()=>{const e=new URL(window.location.href);return e.searchParams.delete("payment_intent"),e.searchParams.delete("payment_intent_client_secret"),e.searchParams.delete("redirect_status"),e.toString()},u=async({endpoint:e,errors:o,metadata:t,shouldPostReleaseErrorReporting:n})=>{if(d("sendErrorLog","warn",e,t,o),n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,l={endpoint:e,errors:o,href:c(),metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},t)};try{fetch(`${s}/api/zonos-elements/log-error`,{body:JSON.stringify(l),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=i();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(l),method:"POST"})}},p=(e,o)=>"string"==typeof e&&e?e:e instanceof Error&&e.message||"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message&&e.message?e.message:o,m=/^Constructor for .+ was not found/,w=/^Constructor for "?([^#"]+)#/,h=e=>{var o;const t=p(e,"");if(!t||!m.test(t))return;if(void 0===window.Zonos)return;const n=window.__zonosConstructorCapture;if(!n)return;const r=w.exec(t),s=null!==(o=null==r?void 0:r[1])&&void 0!==o?o:"";n.reported.has(s)||(n.reported.add(s),u({endpoint:"stencil://constructor",errors:[t],metadata:{shape:"constructor-not-found",tag:s}}))},y=(e,...o)=>{d(e,"error",...o)},g=e=>{console.error(e),void 0!==window.Zonos&&u({endpoint:"zonos://init",errors:[p(e,"Unknown init rejection")],metadata:{shape:"init-rejection"}})},f=(e,o,t,n)=>{if(void 0===window.Zonos)return;const r=`${e}\0${o}\0${t}`,s=(window.__zonosReportedBlockedStorage||(window.__zonosReportedBlockedStorage=new Set),window.__zonosReportedBlockedStorage);s.has(r)||(s.add(r),u({endpoint:`storage://${e}/${t}`,errors:[p(n,"SecurityError")],metadata:{area:e,key:t,operation:o,shape:"blocked-storage"}}))},v=e=>{const o="local"===e?window.localStorage:window.sessionStorage;if(!o)throw new DOMException("","SecurityError");return o},b=(e,o)=>{try{v(e).removeItem(o)}catch(t){f(e,"removeItem",o,t)}},S=["jsdelivr","cdnjs","unpkg","vercel"],C="jsdelivr",z=e=>{const o=S.indexOf(e);return S[o+1]||null},k=()=>window.location.search.includes("zonosStagingMode=1"),Z=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function j(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const I=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},O=()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}},E=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],A=e=>502===e||503===e||504===e,T=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=I(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},L=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t),l=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(l));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const d=s.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&c&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await T({response:s}),response:s,zonosMode:d}}const u=s.status.toString();try{const e=await T({response:s,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:i,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:s,zonosMode:d}}return{baseUrl:i,errors:[{message:JSON.stringify(e),type:u}],json:null,response:s,zonosMode:d}}catch(e){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:A(s.status)?s:null,zonosMode:d}}},P=async({basePathType:e,options:o,path:t})=>{var n,s,a;const l=t.startsWith("/api/bigcommerce")?"vercel":e,c=performance.now(),p=await L({basePathType:l,options:o,path:t}),{errors:m,response:w}=p,h=j(p,["errors","response"]),y=performance.now()-c;d(`${t} (${y.toFixed(2)}ms)`,"info");const g=null==w?void 0:w.headers.get("Zonos-Duration");200===(null==w?void 0:w.status)&&(({apiPath:e,apiType:o,loadTimeInternal:t,loadTimeTotal:n})=>{if(E.includes(e))return;const r=n-t;if(r<0)return;const s=e.split("?")[0]||e,i=O(),a="object"==typeof i.userAgent&&i.userAgent.mobile,l={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(d=a,d||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:t,loadTimeTotal:n,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var d;window.Zonos.loadTimeApiInfoList.push(l)})({apiPath:t,apiType:l,loadTimeInternal:g?Number(g):0,loadTimeTotal:y});const f=i(l),v=m.find(({type:e})=>"unknown"===e),b=m.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),S=null==w?void 0:w.status,C=void 0!==S&&A(S),z="GET"===(null!==(n=null==o?void 0:o.method)&&void 0!==n?n:"GET").toUpperCase(),k=!!v||404===S||500===S,Z=f&&(k||C&&z);return(k||C)&&!b&&u({endpoint:r[l]+t,errors:m.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:l,nextFallbackApiType:f,requestHeaders:null==o?void 0:o.headers,requestPayload:I(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString())||(null===(a=null==o?void 0:o.body)||void 0===a?void 0:a.toString()),shouldCallFallback:Z,status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),Z?(d(`=== "${t}" failed to fetch, trying next fallback ${f}`),P({basePathType:f,options:o,path:t})):Object.assign({errors:m,response:w},h)},$=async(e,o)=>{const t=j(o||{},[]),r=t.body?JSON.stringify(t.body):void 0,s=t.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":k()?"1":void 0,"Zonos-Test-Mode":Z()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers);Object.keys(i).forEach(e=>void 0===i[e]&&delete i[e]);const a=Object.assign(Object.assign({},t),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return P({basePathType:l||n,options:a,path:e})},U=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),t="https://v1.5.2.js.zonos.com";if(!o&&(t.includes("test.")||t.includes("test-")))return t;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const n=`https://${o}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${n}' for loading elements script`,"warn"),fetch(n).then(()=>{b("session","zonos--checkout-session-id"),b("session","zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null}),n},D="https://js.stripe.com/v3",N=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;let R=null;const x=e=>(null!==R||(R=new Promise((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe)o(window.Stripe);else try{let n=(()=>{const e=document.querySelectorAll(`script[src^="${D}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&N.test(t.src))return t}return null})();n&&e?console.warn("loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used"):n||(n=(()=>{const e=document.createElement("script");e.src=`${D}`;const o=document.head||document.body;return o?(o.appendChild(e),e):(y("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==n||n.addEventListener("load",()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))}),null==n||n.addEventListener("error",()=>{t(new Error("Failed to load Stripe.js"))})}catch(e){return void t(e)}else o(null)})),R),F=Promise.resolve().then(()=>(()=>{var e,o;return"undefined"!=typeof window&&("function"==typeof(null===(e=window.Zonos)||void 0===e?void 0:e.createCartId)||"function"==typeof(null===(o=window.Zonos)||void 0===o?void 0:o.buildCartDetail))})()?x(null):null);let M=!1;F.catch(e=>{M||console.warn(e)});const B=async(...e)=>{var o;M=!0;const t=Date.now();return((e,o,t)=>{if(null===e)return null;const[n,r]=o,s=Object.assign({},r),i=(e=>{if(!("version"in e))return;const{version:o}=e;return"number"==typeof o||"string"==typeof o?o:void 0})(e);"string"==typeof i&&i!==3..toString()?delete s.apiVersion:s.apiVersion="2025-02-24.acacia";const a=e(n,s);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(a,t),a})(null!==(o=await F)&&void 0!==o?o:await x(null),e,t)},_=async({cartId:e,retries:o})=>{const t=Z(),n=(()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}})(),r=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,s=new URLSearchParams;n.overrideShouldEnabledCustomAddress&&s.set("overrideShouldEnabledCustomAddress",n.overrideShouldEnabledCustomAddress);const{errors:i,json:a,zonosMode:l}=await $(`/api/zonos-elements/get-cart?${s.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:r,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),c=!a||i.length;return c&&o?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise(e=>setTimeout(e,500)),_({cartId:e,retries:o-1})):c?null:Object.assign(Object.assign({},a),{zonosMode:l})},q=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,W=new RegExp(`^${q.source}$`),G=new RegExp(`^cart_${q.source}$`),K=/^[a-zA-Z0-9]{2,}$/,H=/^cart_[a-zA-Z0-9]{2,}$/,V=async e=>{const{isDgsCartId:o,isLegacyCartId:t}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:H.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:K.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:G.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:W.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!t&&!o)return y("[ZONOS - loadZonos] invalid cart id"),null;const n=await _({cartId:e,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",n),n?(window.Zonos.storeId=n.cartData.storeId,window.Zonos.zonosApiKey=n.cartData.credentialToken,window.Zonos.zonosMode=n.zonosMode,{cartData:n.cartData,settings:n.settings,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}):(y("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},Q="zonos--checkout-hidden-international-button";var J;const X=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),n=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),Y=Date.now(),ee="https://v1.5.2.js.zonos.com",oe=X||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.2",te="https://fonts.googleapis.com",ne=/^https:\/\/fonts\.googleapis\.com/;class re{}J=re,re.doneInit=!1,re.cartSettings=null,re.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),re.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),re._paypalMockResponse=null,re.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,re.isBigCommerce=!1,re.releaseDate="1793899943651",re.isLegacyCheckout=!1,re.googleAnalyticId=null,re.googleAnalyticReady=!1,re.facebookPixelId=null,re.facebookPixelReady=!1,re.startLoadTime=Y,re.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",re.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),re.overrideUseCustomAddressForm=!1,re.isCollect=!1,re.isInvoice=!1,re.isNpm=!0,re.zonosQaUrl=null,re.zonosQaUrlApi=null,re.trackEventLogs=[],re.version="v1.5.2",re.modeAlerted=!1,re.cartData=null,re.paypal=null,re.zonosMode=null,re.IframeService=o,re.getCurrentTimestamp=()=>(new Date).getTime(),re.zonosController=null,re.loadTimeApiInfoList=[],re.logIntervalId=null,re.init=async e=>{(()=>{if(window.__zonosConstructorCapture)return;const e=e=>{h(e.reason)};window.__zonosConstructorCapture={listener:e,reported:new Set},window.addEventListener("unhandledrejection",e);const o=console.error.bind(console);console.error=(...e)=>{h(e[0]),o(...e)}})();const{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:r,onCountryChange:s,overrideCurrencyFormat:i,storeId:a,zonosApiKey:l}=e;if(J.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),J.createCartId=null==t?void 0:t.createCartId,J.buildCartDetail=null==t?void 0:t.buildCartDetail,J.doneInit)return;if(d(`====== ZONOS DEBUG MODE: on (${J.version}) ======`),J.zonosApiKey=l,J.storeId=a,"undefined"!=typeof window&&window.parent===window&&(J.googleAnalyticReady=!0,J.facebookPixelReady=!0),J.isNpm){d("====== ZONOS LOADING FROM NPM ======");const o=U();if(o&&!window.isZonosPreview){d(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const t=document.createElement("script");return t.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(t),t.addEventListener("load",()=>{window.Zonos.isNpm=J.isNpm,window.Zonos.isBigCommerce=J.isBigCommerce,window.Zonos.isLegacyCheckout=J.isLegacyCheckout,window.Zonos.zonosMode=J.zonosMode,(e=>{let o;try{o=e()}catch(e){return void g(e)}o.catch(e=>{g(e)})})(()=>window.Zonos.init(e))}),t.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)}),void(window.isZonosPreview=!0)}if(!l&&!J.cartId)return void y("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!J.cartData&&J.cartId){d("Initialize cart data");const e=await V(J.cartId);if(!e)return void y("Failed to get cart data");J.cartData=e.cartData,J.zonosApiKey=e.zonosApiKey,J.cartSettings=e.settings}const t=await(async()=>{const e=Z(),o=k();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(d("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return d("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:t,json:n}=await $("/api/get-test-public-credential");if(t.length||!n)return y("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t),null;const r=n.publicCredential;return r?(d(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(y("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();t&&(J.zonosApiKey=t)}const c=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||((e,o)=>{try{return v(e).getItem(o)}catch(t){return f(e,"getItem",o,t),null}})("session","zonos--client-secret");if(J.cartId&&J.cartData||!!c){d("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}d("init zonos"),J.restoreNativeBrowserFunctions(),J.injectCustomScriptForHostedCheckout(),J.injectZonosCdn(),J.injectZonosCss(),J.injectFonts(),J.injectCheckoutInternationalButton(),J.injectController({config:{appearance:o,checkoutSettings:t,currencyConverter:n,helloSettings:r,onCountryChange:s,overrideCurrencyFormat:i}}),J.doneInit=!0},re.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${Q}`)){const e=document.createElement("button");e.id=Q,e.style.display="none",document.body.appendChild(e)}},re.injectCustomScriptForHostedCheckout=()=>{const e=J.cartData,o=(null==e?void 0:e.metadata)||[],t=o.find(e=>"customHeaderScript"===e.key),n=o.find(e=>"customFooterScript"===e.key);if(window.Zonos.isLegacyCheckout&&(t||n)){if(t){d("Injecting custom header script");const e=document.createElement("script");e.textContent=t.value,document.head.appendChild(e)}if(n){d("Injecting custom footer script");const e=document.createElement("script");e.textContent=n.value,document.body.appendChild(e)}}else d("Skip injecting custom script for hosted checkout","info",{footerScript:n,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout})},re.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},re.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${Q}`);setTimeout(()=>{var o;e&&e.dispatchEvent(new CustomEvent("click",{detail:o}))},10)},re.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},re.showNotification=e=>{var o;null===(o=J.zonosController)||void 0===o||o.showNotification(e)},re.updateOrganizationName=e=>{var o;null===(o=J.zonosController)||void 0===o||o.updateOrganizationName(e)},re.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach(e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))}),e&&t&&setTimeout(()=>{o.forEach(e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)})},5e3)}},re.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},re.injectController=({config:e})=>{var o,t;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.alwaysTriggerInternationalCheckoutSelector){const o=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver(()=>{J.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})}).observe(document.body,{childList:!0,subtree:!0})}const n=document.createElement("zonos-controller");n.config=e,n.zonosApiKey=J.zonosApiKey||"",n.addEventListener("stripeInitEvent",async e=>{const{detail:o}=e;d("loading Stripe");const t=await B(o.publishableKey);t?(window.Zonos.stripe=t,window.Zonos.isCollect?n.initCollectElement(t):window.Zonos.isInvoice?n.initInvoiceElement(t):n.initCheckoutElement(t)):y("API seems to be invalid or missing. Failed to load Stripe")}),document.body.appendChild(n),J.zonosController=n,d("Zonos controller injected!")},re.injectScript=({cdnType:e,isModule:o,theRestUrl:t})=>{const n=`${J.getZonosUrl(e)}/${t}`;if(document.querySelector(`script[src="${n}"]`))return void d(`Zonos script "${n}" already exists in the document`,"warn");const r=document.head||document.body,s=document.createElement("script");o?s.type="module":s.noModule=!0,s.src=n,s.crossOrigin="anonymous",s.onerror=()=>{y(`Failed to load ${s.src}`);const n=z(e);n&&J.injectScript({cdnType:n,isModule:o,theRestUrl:t})},r.appendChild(s)},re.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return oe;case"unpkg":return"https://unpkg.com/@zonos/elements@1.5.2";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.2";case"vercel":return ee}};if(J.isNpm){return U()||o()}return o()},re.injectZonosCdn=()=>{J.injectScript({cdnType:C,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),J.injectScript({cdnType:C,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),d("Zonos cdn script injected!")},re.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=J.getZonosUrl(e),n=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${ee}/`,n.appendChild(r);const s=document.createElement("link");s.rel="stylesheet",s.href=`${t}/${o}`,s.onerror=()=>{y(`Failed to load ${s.href}`);const t=z(e);t&&J.injectStylesheet({cdnType:t,theRestUrl:o})},n.appendChild(s)},re.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?d("Zonos style links already injected","warn"):(J.injectStylesheet({cdnType:C,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),d("Zonos style css injected!"))},re.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void d("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${te}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!ne.test(t.href))return t}return null})())return void d("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=te,e.appendChild(o);const t=document.createElement("link");t.rel="stylesheet",t.href=`${te}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(t),d("Zonos font injected!")},re.setupGoogleFont=e=>{var o;null===(o=J.zonosController)||void 0===o||o.setupGoogleFont(e)},re.injectSupportGoogleFont=e=>{var o;d(`[FONT] injecting ${e}`);const t=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],n=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${te}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=te,n.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void d(`[FONT] ${t} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,n.appendChild(r),d(`[FONT] ${t} font injected!`)},exports.Zonos=re})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=e=>/^[A-Z]{2}$/.test(e),n=e=>{try{const n=e.getItem("zonos--country");return n&&o(n)?n:null}catch(e){return null}},t=()=>(e=>{const n=new URLSearchParams(e||window.location.search),t=e=>{const t=n.get(e);return t&&o(t)?t:null},r=t("zCountry"),s=t("country"),i=t("customerCountry");return r||s||i})(new URL(window.location.href).searchParams)||(()=>{var e;return null!==(e=n(window.localStorage))&&void 0!==e?e:n(window.sessionStorage)})();function r(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const s=()=>window.location.search.includes("zonosStagingMode=1"),i=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},a=["cloudflare","vercel"],d=a[0],l={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},c=l[d],u=(e=d)=>{const o=a.indexOf(e),n=a[o+1];return n||null},p=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},w=performance.now(),g=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},m=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-w,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(g).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let a=document.querySelector("iframe#zonos---debug-logging-iframe");a||(a=document.createElement("iframe"),a.id="zonos---debug-logging-iframe",a.style.display="none",a.style.opacity="0",a.style.position="absolute",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.border="none",a.style.overflow="hidden",a.style.visibility="hidden",document.body.appendChild(a));const d=(null===(r=a.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},y=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},f=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],h=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(f.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=y();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(l=a,l||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var l;window.Zonos.loadTimeApiInfoList.push(d)},v=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(m("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};try{fetch(`${c}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=u();if(!o)return;fetch(`${l[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}},S=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=p(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},z=async({basePathType:e,options:o,path:n})=>{let t;const r=window.Zonos.zonosQaUrlApi||l[e]||d,s=new URL(r+n),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{t=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=t.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),t.ok){return{baseUrl:r,errors:[],json:await S({response:t}),response:t,zonosMode:a}}const u=t.status.toString();try{const e=await S({response:t,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:t,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:t,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:a}}},Z=async({basePathType:e,options:o,path:n})=>{var t,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=performance.now(),d=await z({basePathType:i,options:o,path:n}),{errors:c,response:w}=d,g=r(d,["errors","response"]),y=performance.now()-a;m(`${n} (${y.toFixed(2)}ms)`,"info");const f=null==w?void 0:w.headers.get("Zonos-Duration");200===(null==w?void 0:w.status)&&h({apiPath:n,apiType:i,loadTimeInternal:f?Number(f):0,loadTimeTotal:y});const S=u(i),C=c.find(({type:e})=>"unknown"===e),b=c.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),I=!!C||404===(null==w?void 0:w.status)||500===(null==w?void 0:w.status),L=S&&I;return I&&!b&&v({endpoint:l[i]+n,errors:c.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:i,nextFallbackApiType:S,requestHeaders:null==o?void 0:o.headers,requestPayload:p(null===(t=null==o?void 0:o.body)||void 0===t?void 0:t.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),shouldCallFallback:L,status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),L?(m(`=== "${n}" failed to fetch, trying next fallback ${S}`),Z({basePathType:S,options:o,path:n})):Object.assign({errors:c,response:w},g)},C=async(e,o)=>{const n=r(o||{},[]),t=n.body?JSON.stringify(n.body):void 0,a=n.method||"GET",l=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":s()?"1":void 0,"Zonos-Test-Mode":i()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(l).forEach(e=>void 0===l[e]&&delete l[e]);const c=Object.assign(Object.assign({},n),{body:"GET"===a?void 0:t,headers:l,method:a}),u=new URLSearchParams(window.location.search).get("useFallbackApi");return Z({basePathType:u||d,options:c,path:e})},b=(e,...o)=>{m(e,"error",...o)},I=["jsdelivr","cdnjs","unpkg","vercel"],L=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},O=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${O.source}$`),T=new RegExp(`^cart_${O.source}$`),k=/^[a-zA-Z0-9]{2,}$/,U=/^cart_[a-zA-Z0-9]{2,}$/,j=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:U.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:k.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},E=async({cartId:o,retries:n})=>{const t=i(),r=e(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,a=new URLSearchParams;r.overrideShouldEnabledCustomAddress&&a.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress);const{errors:d,json:l,zonosMode:c}=await C(`/api/zonos-elements/get-cart?${a.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!l||d.length;return u&&n?(m("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise(e=>setTimeout(e,500)),E({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},l),{zonosMode:c})},$="z--blur",P=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise(e=>setTimeout(e,500)),clearInterval(e);document.querySelectorAll(`.${$}`).forEach(e=>{e.classList.remove($)}),window.zonosBlurCurrencyOnInitIntervalId=void 0},N=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add($);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach(e=>{e.classList.add($)})}};var D;const R=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=L(window.location.href),n="https://v1.5.1.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const t=`https://${o}.preview.js.zonos.com`;return m(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then(()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null}),t})(),F=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=L(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if("worker"===n)return"https://worker.iglobalstores.com";if(!e)return null;const t=`https://${e}.route.js.zonos.com`;return m(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),B=Date.now();class M{}D=M,M.isNpm=!1,M.isBigCommerce=!1,M.googleAnalyticId=null,M.googleAnalyticReady=!1,M.facebookPixelId=null,M.facebookPixelReady=!1,M.requested=!1,M.zonosMode=null,M.cartData=null,M.startLoadTime=B,M.overrideUseCustomAddressForm=!1,M.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,M.version="v1.5.1",M.isLegacyCheckout=!1,M.isCollect=!1,M.isInvoice=!1,M.legacyStoreLogo=null,M.legacyStoreFavicon=null,M.parallelLoadTimes=[],M.parallelLoadState="off",M.releaseDate="1793041468334",M.loadTimeApiInfoList=[],M.cartSettings=null,M.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find(e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType});null==e||e.transferSize;(async()=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},M.loadScriptLogParallelHandler=async e=>{try{if(D.parallelLoadTimes.push(e),2===D.parallelLoadTimes.length){const e=D.parallelLoadTimes.find(e=>"vercel"===e.type),o=D.parallelLoadTimes.find(e=>"jsdelivr"===e.type);if(!e||!o)return;if(e.isError&&o.isError)return void v({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});D.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},M.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{b(`[ZONOS - loadZonos] ${e}`),v({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:D.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},M.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.1";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.1":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.5.1");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},M.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:D.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:D.getGithubCdn({type:e,version:r}),a=R||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),c=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${c}?timestamp=${Date.now()}`,m(`[ZONOS - loadZonos] Injecting "${c}" from "${d}"`,"info");const u="4g"===(null===(s=y())||void 0===s?void 0:s.effectiveType),p=["dev.elements.zonos.com","zonos.com"].some(e=>window.location.href.includes(e)),w=I[0]===e,g=I[1],f="on"===D.parallelLoadState&&u&&w&&g&&!p;f&&D.injectZonos({cdnType:g,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const h=performance.now();l.addEventListener("load",async()=>{if(f||n?D.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:D.storeId||0,type:e}):D.loadScriptLogHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:D.storeId||0,type:e}),D.isBigCommerce||(D.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=R,window.Zonos.zonosQaUrlApi=F,window.Zonos.zonosMode=D.zonosMode,window.Zonos.isBigCommerce=D.isBigCommerce,window.Zonos.loadTimeApiInfoList=D.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=D.overrideUseCustomAddressForm,window.Zonos.startLoadTime=D.startLoadTime,D.cartSettings&&(window.Zonos.cartSettings=D.cartSettings),D.cartId){const e=D.isCollect?"Collect":"hosted Checkout";if(!D.zonosApiKey)throw D.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!D.cartData)throw D.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(D.legacyStoreFavicon&&D.isLegacyCheckout&&!D.isCollect)try{if(200!==(await fetch(D.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=D.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=D.cartData,window.Zonos.isLegacyCheckout=D.isLegacyCheckout,window.Zonos.cartSettings=D.cartSettings,window.Zonos.isCollect=D.isCollect,window.Zonos.isInvoice=D.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:D.isLegacyCheckout&&!D.isCollect&&D.legacyStoreLogo?D.legacyStoreLogo:void 0}),zonosApiKey:D.zonosApiKey});o=n}window.Zonos.version&&(m(`[ZONOS - loadZonos] Execute "Zonos.init" from "${c}" from "${d}"`,"info"),window.Zonos.init(o))}),l.addEventListener("error",async()=>{const s=(e=>{const o=I.indexOf(e);return I[o+1]||null})(e);if(!f&&!n){if(!s)return;D.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some(e=>window.location.href.includes(e))||R)return;if(f||n)return void D.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,isError:!0,scriptLoadUrl:l.src,storeId:D.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?v({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-h,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):v({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-h}})}),document.head.appendChild(l)},M.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=D.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?P():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=D.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;N({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval(()=>{N({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})},10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout(()=>{P()},7e3)})())},M.init=async o=>{var n,r;if(m("=== Init zonos script release date","info",D.releaseDate),R&&!window.isZonosPreview){m(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${R}`,"info");const e=document.createElement("script");return e.src=`${R}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=D.isBigCommerce,window.Zonos.isLegacyCheckout=D.isLegacyCheckout,window.Zonos.startLoadTime=D.startLoadTime,window.Zonos.init(o)}),e.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${R}`)}),void(window.isZonosPreview=!0)}const a=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:d,isLegacyCartId:l}=j(a);if(a&&!l&&!d)return void D.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${a}`,metadata:{invalidCartId:!0}});D.cartId=a;const c=document.querySelector('script[src*="/zonos.js"]'),u=null===(n=document.querySelector("script[src*='/loadZonos.js']"))||void 0===n?void 0:n.src;m(`[ZONOS - init] first load script src: ${u}`,"info"),window.Zonos.zonosQaUrl=R,window.Zonos.zonosQaUrlApi=F,window.Zonos.zonosQaUrl&&m(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&m(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const p=null==u?void 0:u.includes("timestamp=");if(!(D.isNpm||u&&p))return void b("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(c||!u||D.requested)return void m("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!D.cartId)return D.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void b("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(D.requested=!0,D.zonosApiKey=o.zonosApiKey,D.storeId=o.storeId,D.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=j(e);if(!n&&!o)return b("[ZONOS - loadZonos] invalid cart id"),null;const t=await E({cartId:e,retries:5});return m("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(b("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(D.cartId);if(!e)throw D.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");D.cartData=e.cartData,D.cartSettings=e.settings,D.legacyStoreLogo=e.storeLogo,D.legacyStoreFavicon=e.storeFavicon,D.storeId=e.storeId,D.zonosApiKey=e.zonosApiKey,D.isCollect=e.cartData.type.includes("COLLECT"),D.isInvoice="INVOICE"===e.cartData.type}if(!D.zonosApiKey)return void b('"zonosApiKey" is required to initialize Zonos');const w=await(async()=>{const e=i(),o=s();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(m("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return m("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:t}=await C("/api/get-test-public-credential");if(n.length||!t)return b("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const r=t.publicCredential;return r?(m(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(b("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(w&&(m(`[ZONOS - loadZonos] Using test API key: ${w} for test mode`,"info"),D.zonosApiKey=w),!D.cartId){const{json:o,zonosMode:n}=await(async()=>{if(window.Zonos.cartSettings)return m("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const o=e(),n=new URLSearchParams;o.overrideShouldEnabledCustomAddress&&n.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress);const r=t();r&&n.set("zCountry",r);const{errors:s,json:i,zonosMode:a}=await C(`/api/zonos-elements/zonos-settings?${n.toString()}`);return s.length?(b("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:s,json:null,zonosMode:a}):{errors:[],json:i,zonosMode:a}})();(null==o?void 0:o.appearanceSettings)&&(null==o?void 0:o.checkoutSettings)&&(null==o?void 0:o.helloSettings)&&(null==o?void 0:o.organization)&&(m("[ZONOS - loadZonos] Prefetching zonos settings","info"),D.cartSettings={appearanceSettings:o.appearanceSettings,checkoutSettings:o.checkoutSettings,credentialTokenId:D.zonosApiKey,genericSettings:o.genericSettings,helloSettings:o.helloSettings,inclusivePriceConfigurations:o.inclusivePriceConfigurations,landedCostSettings:o.landedCostSettings,onlineStoreSettings:o.onlineStoreSettings,organization:o.organization,organizationId:(null===(r=o.organization)||void 0===r?void 0:r.id)||"",shippingZones:o.shippingZones},D.zonosMode=n)}D.handlePerformBlurCurrency();const g=D.storeId||o.storeId||0;m(`[ZONOS - loadZonos] Store ID: ${g}`,"info");const y=new URLSearchParams;y.set("storeId",g.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&y.set("_enableStoreVersionPinned","1");const{errors:f,json:h}=await C(`/api/get-store-version?${y.toString()}`);if(f.length||!h)return m("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void D.injectZonos({initConfig:o,vercelUrl:"https://v1.5.1.js.zonos.com",version:null});const{isDifferent:v,source:S,version:z}=h;if(m(`[ZONOS - loadZonos] Store version: ${z}, source: ${S}`,"info"),v){m(`[ZONOS - loadZonos] Updating saved store version to ${z}`,"info");const e={storeId:g,version:z};C(`/api/set-store-version?${y.toString()}`,{body:e,method:"POST"}).catch(e=>b("Unable to save store's vesrion",e))}if(!c){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),t=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:u}),r=t&&!n?e:`${"alpha"===z?"alpha":`v${z}`}.js.zonos.com`,s=t&&!n?null:z;m("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:z}),D.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=M)})();
|
|
1
|
+
(function(){"use strict";const e=()=>{const e=new URLSearchParams(window.location.search);return{overrideShouldEnabledCustomAddress:window.Zonos.overrideUseCustomAddressForm?"1":e.get("overrideShouldEnabledCustomAddress")}},o=e=>/^[A-Z]{2}$/.test(e),n=["cloudflare","vercel"],t=n[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},s=r[t],i=(e=t)=>{const o=n.indexOf(e),r=n[o+1];return r||null},a=performance.now(),d=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},c=(e,o,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(d).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return;let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const l=(null===(r=c.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":l.warn(e,...i);break;case"info":l.info(e,...i);break;case"error":l.error(e,...i);break;default:l.groupCollapsed(e,...i),l.trace(),l.groupEnd()}},l=()=>{const e=new URL(window.location.href);return e.searchParams.delete("payment_intent"),e.searchParams.delete("payment_intent_client_secret"),e.searchParams.delete("redirect_status"),e.toString()},u=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:t})=>{if(c("sendErrorLog","warn",e,n,o),t){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,d={endpoint:e,errors:o,href:l(),metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${s}/api/zonos-elements/log-error`,{body:JSON.stringify(d),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=i();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(d),method:"POST"})}},p=(e,o)=>"string"==typeof e&&e?e:e instanceof Error&&e.message||"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message&&e.message?e.message:o,w=(e,o,n,t)=>{if(void 0===window.Zonos)return;const r=`${e}\0${o}\0${n}`,s=(window.__zonosReportedBlockedStorage||(window.__zonosReportedBlockedStorage=new Set),window.__zonosReportedBlockedStorage);s.has(r)||(s.add(r),u({endpoint:`storage://${e}/${n}`,errors:[p(t,"SecurityError")],metadata:{area:e,key:n,operation:o,shape:"blocked-storage"}}))},m=e=>{const o="local"===e?window.localStorage:window.sessionStorage;if(!o)throw new DOMException("","SecurityError");return o},g=(e,o)=>{try{m(e).removeItem(o)}catch(n){w(e,"removeItem",o,n)}},y=e=>{const n=((e,o)=>{try{return m(e).getItem(o)}catch(n){return w(e,"getItem",o,n),null}})(e,"zonos--country");return n&&o(n)?n:null},f=()=>(e=>{const n=new URLSearchParams(e||window.location.search),t=e=>{const t=n.get(e);return t&&o(t)?t:null},r=t("zCountry"),s=t("country"),i=t("customerCountry");return r||s||i})(new URL(window.location.href).searchParams)||(()=>{var e;return null!==(e=y("local"))&&void 0!==e?e:y("session")})();function h(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(e);r<t.length;r++)o.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(e,t[r])&&(n[t[r]]=e[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const v=()=>window.location.search.includes("zonosStagingMode=1"),S=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")},z=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},Z=()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n},C=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"],b=({apiPath:e,apiType:o,loadTimeInternal:n,loadTimeTotal:t})=>{if(C.includes(e))return;const r=t-n;if(r<0)return;const s=e.split("?")[0]||e,i=(()=>{const e="userAgentData"in window.navigator?window.navigator.userAgentData:null,o=Z();return{connectionDownlink:null==o?void 0:o.downlink,connectionEffectiveType:null==o?void 0:o.effectiveType,connectionRtt:null==o?void 0:o.rtt,connectionSaveData:null==o?void 0:o.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}})(),a="object"==typeof i.userAgent&&i.userAgent.mobile,d={apiType:o,connectionType:i.connectionEffectiveType,href:s,isHostedCheckout:window.Zonos.isLegacyCheckout,isMobile:(c=a,c||window.innerWidth<890),loadTimeBrowserApi:r,loadTimeInternal:n,loadTimeTotal:t,metadata:Object.assign({},i),screenHeight:i.screenHeight,screenWidth:i.screenWidth,userAgent:"string"==typeof i.userAgent?i.userAgent:i.userAgent.brands.map(e=>e.brand).filter(e=>!/Not.*A.*Brand.*/.test(e)).join(",")};var c;window.Zonos.loadTimeApiInfoList.push(d)},I=e=>502===e||503===e||504===e,L=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{const o=await e.text(),n=z(o);if(!n)throw new Error(`Failed to parse content: ${o}`);return n}catch(e){if(n)throw e;return o&&console.error(e),null}},O=async({basePathType:e,options:o,path:n})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||t,a=new URL(i+n),d=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(d));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await L({response:s}),response:s,zonosMode:c}}const u=s.status.toString();try{const e=await L({response:s,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:i,errors:o.map(e=>"string"==typeof e?{message:e,type:u}:e),json:null,response:s,zonosMode:c}}return{baseUrl:i,errors:[{message:JSON.stringify(e),type:u}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:I(s.status)?s:null,zonosMode:c}}},T=async({basePathType:e,options:o,path:n})=>{var t,s,a;const d=n.startsWith("/api/bigcommerce")?"vercel":e,l=performance.now(),p=await O({basePathType:d,options:o,path:n}),{errors:w,response:m}=p,g=h(p,["errors","response"]),y=performance.now()-l;c(`${n} (${y.toFixed(2)}ms)`,"info");const f=null==m?void 0:m.headers.get("Zonos-Duration");200===(null==m?void 0:m.status)&&b({apiPath:n,apiType:d,loadTimeInternal:f?Number(f):0,loadTimeTotal:y});const v=i(d),S=w.find(({type:e})=>"unknown"===e),Z=w.find(({message:e})=>"string"==typeof e&&(e.includes("signal is aborted")||e.includes("The operation was aborted")||e.includes("Fetch is aborted"))),C=null==m?void 0:m.status,L=void 0!==C&&I(C),A="GET"===(null!==(t=null==o?void 0:o.method)&&void 0!==t?t:"GET").toUpperCase(),k=!!S||404===C||500===C,U=v&&(k||L&&A);return(k||L)&&!Z&&u({endpoint:r[d]+n,errors:w.map(({message:e})=>`API: ${e}`),metadata:{currentBasePath:d,nextFallbackApiType:v,requestHeaders:null==o?void 0:o.headers,requestPayload:z(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString())||(null===(a=null==o?void 0:o.body)||void 0===a?void 0:a.toString()),shouldCallFallback:U,status:null==m?void 0:m.status,statusText:null==m?void 0:m.statusText},shouldPostReleaseErrorReporting:!0}),U?(c(`=== "${n}" failed to fetch, trying next fallback ${v}`),T({basePathType:v,options:o,path:n})):Object.assign({errors:w,response:m},g)},A=async(e,o)=>{const n=h(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":v()?"1":void 0,"Zonos-Test-Mode":S()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach(e=>void 0===i[e]&&delete i[e]);const a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return T({basePathType:d||t,options:a,path:e})},k=(e,...o)=>{c(e,"error",...o)},U=/^Constructor for .+ was not found/,j=/^Constructor for "?([^#"]+)#/,E=e=>{var o;const n=p(e,"");if(!n||!U.test(n))return;if(void 0===window.Zonos)return;const t=window.__zonosConstructorCapture;if(!t)return;const r=j.exec(n),s=null!==(o=null==r?void 0:r[1])&&void 0!==o?o:"";t.reported.has(s)||(t.reported.add(s),u({endpoint:"stencil://constructor",errors:[n],metadata:{shape:"constructor-not-found",tag:s}}))},$=e=>{console.error(e),void 0!==window.Zonos&&u({endpoint:"zonos://init",errors:[p(e,"Unknown init rejection")],metadata:{shape:"init-rejection"}})},P=e=>{let o;try{o=e()}catch(e){return void $(e)}o.catch(e=>{$(e)})},D=["jsdelivr","cdnjs","unpkg","vercel"],N=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},R=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,F=new RegExp(`^${R.source}$`),B=new RegExp(`^cart_${R.source}$`),M=/^[a-zA-Z0-9]{2,}$/,x=/^cart_[a-zA-Z0-9]{2,}$/,K=e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:x.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:M.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:B.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:F.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},_=async({cartId:o,retries:n})=>{const t=S(),r=e(),s=(()=>{const e=new URLSearchParams(window.location.search).get("validityToken");if(!e||!/^[A-Za-z0-9+/]+={0,2}$/.test(e)||e.length%4!=0)return null;try{return atob(e),e}catch(e){return null}})()||void 0,i=new URLSearchParams;r.overrideShouldEnabledCustomAddress&&i.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress);const{errors:a,json:d,zonosMode:l}=await A(`/api/zonos-elements/get-cart?${i.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:s,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),u=!d||a.length;return u&&n?(c("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise(e=>setTimeout(e,500)),_({cartId:o,retries:n-1})):u?null:Object.assign(Object.assign({},d),{zonosMode:l})},q="z--blur",H=async()=>{const e=window.zonosBlurCurrencyOnInitIntervalId;if(!e)return;await new Promise(e=>setTimeout(e,500)),clearInterval(e);document.querySelectorAll(`.${q}`).forEach(e=>{e.classList.remove(q)}),window.zonosBlurCurrencyOnInitIntervalId=void 0},Q=({currencySelector:e,specificSelector:o})=>{if(e||o)if(o)o.classList.add(q);else{document.querySelectorAll([e].filter(Boolean).join(",")).forEach(e=>{e.classList.add(q)})}};var W;const G=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=N(window.location.href),n="https://v1.5.2.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";if("worker"===o)return null;const t=`https://${o}.preview.js.zonos.com`;return c(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then(()=>{g("session","zonos--checkout-session-id"),g("session","zonos--client-secret")}).catch(()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null}),t})(),V=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=N(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if("worker"===n)return"https://worker.iglobalstores.com";if(!e)return null;const t=`https://${e}.route.js.zonos.com`;return c(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})(),J=Date.now();class X{}W=X,X.isNpm=!1,X.isBigCommerce=!1,X.googleAnalyticId=null,X.googleAnalyticReady=!1,X.facebookPixelId=null,X.facebookPixelReady=!1,X.requested=!1,X.zonosMode=null,X.cartData=null,X.startLoadTime=J,X.overrideUseCustomAddressForm=!1,X.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,X.version="v1.5.2",X.isLegacyCheckout=!1,X.isCollect=!1,X.isInvoice=!1,X.legacyStoreLogo=null,X.legacyStoreFavicon=null,X.parallelLoadTimes=[],X.parallelLoadState="off",X.releaseDate="1793899943651",X.loadTimeApiInfoList=[],X.cartSettings=null,X.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find(e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType});null==e||e.transferSize;(async()=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},t)))}catch(e){}},X.loadScriptLogParallelHandler=async e=>{try{if(W.parallelLoadTimes.push(e),2===W.parallelLoadTimes.length){const e=W.parallelLoadTimes.find(e=>"vercel"===e.type),o=W.parallelLoadTimes.find(e=>"jsdelivr"===e.type);if(!e||!o)return;if(e.isError&&o.isError)return void u({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});W.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},X.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{k(`[ZONOS - loadZonos] ${e}`),u({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:W.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},X.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.2";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.2":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.5.2");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},X.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;o=Object.assign(Object.assign({},o),{zonosApiKey:W.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===e?t:W.getGithubCdn({type:e,version:r}),a=G||i,d=a.replace("https://","").replace("http://",""),l=document.createElement("script"),p=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";l.src=`https://${d}/dist/scripts/${p}?timestamp=${Date.now()}`,c(`[ZONOS - loadZonos] Injecting "${p}" from "${d}"`,"info");const w="4g"===(null===(s=Z())||void 0===s?void 0:s.effectiveType),m=["dev.elements.zonos.com","zonos.com"].some(e=>window.location.href.includes(e)),g=D[0]===e,y=D[1],f="on"===W.parallelLoadState&&w&&g&&y&&!m;f&&W.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:t,version:r});const h=performance.now();l.addEventListener("load",async()=>{if(f||n?W.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:W.storeId||0,type:e}):W.loadScriptLogHandler({fallbackLoadTime:performance.now()-h,scriptLoadUrl:l.src,storeId:W.storeId||0,type:e}),W.isBigCommerce||(W.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=G,window.Zonos.zonosQaUrlApi=V,window.Zonos.zonosMode=W.zonosMode,window.Zonos.isBigCommerce=W.isBigCommerce,window.Zonos.loadTimeApiInfoList=W.loadTimeApiInfoList,window.Zonos.overrideUseCustomAddressForm=W.overrideUseCustomAddressForm,window.Zonos.startLoadTime=W.startLoadTime,W.cartSettings&&(window.Zonos.cartSettings=W.cartSettings),W.cartId){const e=W.isCollect?"Collect":"hosted Checkout";if(!W.zonosApiKey)throw W.legacyCheckoutErrorHandler({message:`zonosApiKey is missing to initiate ${e}`}),new Error(`zonosApiKey is required for ${e}`);if(!W.cartData)throw W.legacyCheckoutErrorHandler({message:`cartData is missing to initiate ${e}`}),new Error(`cartData is required for ${e}`);if(W.legacyStoreFavicon&&W.isLegacyCheckout&&!W.isCollect)try{if(200!==(await fetch(W.legacyStoreFavicon)).status)throw new Error("Custom favicon is not available");const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=W.legacyStoreFavicon,document.head.appendChild(e)}catch(e){}window.Zonos.cartData=W.cartData,window.Zonos.isLegacyCheckout=W.isLegacyCheckout,window.Zonos.cartSettings=W.cartSettings,window.Zonos.isCollect=W.isCollect,window.Zonos.isInvoice=W.isInvoice;const n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:W.isLegacyCheckout&&!W.isCollect&&W.legacyStoreLogo?W.legacyStoreLogo:void 0}),zonosApiKey:W.zonosApiKey});o=n}window.Zonos.version&&(c(`[ZONOS - loadZonos] Execute "Zonos.init" from "${p}" from "${d}"`,"info"),P(()=>window.Zonos.init(o)))}),l.addEventListener("error",async()=>{const s=(e=>{const o=D.indexOf(e);return D[o+1]||null})(e);if(!f&&!n){if(!s)return;W.injectZonos({cdnType:s,initConfig:o,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some(e=>window.location.href.includes(e))||G)return;if(f||n)return void W.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-h,isError:!0,scriptLoadUrl:l.src,storeId:W.storeId||0,type:e});["unpkg","cdnjs","vercel"].includes(e)?u({endpoint:l.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-h,cdnType:e,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):u({endpoint:l.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-h}})}),document.head.appendChild(l)},X.handlePerformBlurCurrency=()=>{var e,o,n;!(null===(o=null===(e=W.cartSettings)||void 0===e?void 0:e.genericSettings)||void 0===o?void 0:o.blurCurrencyOnInit)?H():(window.zonosBlurCurrencyOnInitCurrencySelector=window.zonosBlurCurrencyOnInitCurrencySelector||(null===(n=W.cartSettings)||void 0===n?void 0:n.helloSettings.currencyElementSelector),(()=>{if("undefined"==typeof window)return;if(window.zonosBlurCurrencyOnInitIntervalId)return;Q({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector});const e=setInterval(()=>{Q({currencySelector:window.zonosBlurCurrencyOnInitCurrencySelector})},10);window.zonosBlurCurrencyOnInitIntervalId=e,setTimeout(()=>{H()},7e3)})())},X.init=async o=>{var n,t;if((()=>{if(window.__zonosConstructorCapture)return;const e=e=>{E(e.reason)};window.__zonosConstructorCapture={listener:e,reported:new Set},window.addEventListener("unhandledrejection",e);const o=console.error.bind(console);console.error=(...e)=>{E(e[0]),o(...e)}})(),c("=== Init zonos script release date","info",W.releaseDate),G&&!window.isZonosPreview){c(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${G}`,"info");const e=document.createElement("script");return e.src=`${G}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=W.isBigCommerce,window.Zonos.isLegacyCheckout=W.isLegacyCheckout,window.Zonos.startLoadTime=W.startLoadTime,P(()=>window.Zonos.init(o))}),e.addEventListener("error",()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${G}`)}),void(window.isZonosPreview=!0)}const r=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:s,isLegacyCartId:i}=K(r);if(r&&!i&&!s)return void W.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${r}`,metadata:{invalidCartId:!0}});W.cartId=r;const a=document.querySelector('script[src*="/zonos.js"]'),d=null===(n=document.querySelector("script[src*='/loadZonos.js']"))||void 0===n?void 0:n.src;c(`[ZONOS - init] first load script src: ${d}`,"info"),window.Zonos.zonosQaUrl=G,window.Zonos.zonosQaUrlApi=V,window.Zonos.zonosQaUrl&&c(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&c(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const l=null==d?void 0:d.includes("timestamp=");if(!(W.isNpm||d&&l))return void k("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(a||!d||W.requested)return void c("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!W.cartId)return W.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void k("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(W.requested=!0,W.zonosApiKey=o.zonosApiKey,W.storeId=o.storeId,W.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=K(e);if(!n&&!o)return k("[ZONOS - loadZonos] invalid cart id"),null;const t=await _({cartId:e,retries:5});return c("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(k("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(W.cartId);if(!e)throw W.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");W.cartData=e.cartData,W.cartSettings=e.settings,W.legacyStoreLogo=e.storeLogo,W.legacyStoreFavicon=e.storeFavicon,W.storeId=e.storeId,W.zonosApiKey=e.zonosApiKey,W.isCollect=e.cartData.type.includes("COLLECT"),W.isInvoice="INVOICE"===e.cartData.type}if(!W.zonosApiKey)return void k('"zonosApiKey" is required to initialize Zonos');const u=await(async()=>{const e=S(),o=v();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(c("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return c("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:n,json:t}=await A("/api/get-test-public-credential");if(n.length||!t)return k("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",n),null;const r=t.publicCredential;return r?(c(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(k("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(u&&(c(`[ZONOS - loadZonos] Using test API key: ${u} for test mode`,"info"),W.zonosApiKey=u),!W.cartId){const{json:o,zonosMode:n}=await(async()=>{if(window.Zonos.cartSettings)return c("Reusing cached zonos settings"),{errors:[],json:window.Zonos.cartSettings,zonosMode:window.Zonos.zonosMode};const o=e(),n=new URLSearchParams;o.overrideShouldEnabledCustomAddress&&n.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress);const t=f();t&&n.set("zCountry",t);const{errors:r,json:s,zonosMode:i}=await A(`/api/zonos-elements/zonos-settings?${n.toString()}`);return r.length?(k("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:r,json:null,zonosMode:i}):{errors:[],json:s,zonosMode:i}})();(null==o?void 0:o.appearanceSettings)&&(null==o?void 0:o.checkoutSettings)&&(null==o?void 0:o.helloSettings)&&(null==o?void 0:o.organization)&&(c("[ZONOS - loadZonos] Prefetching zonos settings","info"),W.cartSettings={appearanceSettings:o.appearanceSettings,checkoutSettings:o.checkoutSettings,credentialTokenId:W.zonosApiKey,genericSettings:o.genericSettings,helloSettings:o.helloSettings,inclusivePriceConfigurations:o.inclusivePriceConfigurations,landedCostSettings:o.landedCostSettings,onlineStoreSettings:o.onlineStoreSettings,organization:o.organization,organizationId:(null===(t=o.organization)||void 0===t?void 0:t.id)||"",shippingZones:o.shippingZones},W.zonosMode=n)}W.handlePerformBlurCurrency();const p=W.storeId||o.storeId||0;c(`[ZONOS - loadZonos] Store ID: ${p}`,"info");const w=new URLSearchParams;w.set("storeId",p.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&w.set("_enableStoreVersionPinned","1");const{errors:m,json:g}=await A(`/api/get-store-version?${w.toString()}`);if(m.length||!g)return c("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void W.injectZonos({initConfig:o,vercelUrl:"https://v1.5.2.js.zonos.com",version:null});const{isDifferent:y,source:h,version:z}=g;if(c(`[ZONOS - loadZonos] Store version: ${z}, source: ${h}`,"info"),y){c(`[ZONOS - loadZonos] Updating saved store version to ${z}`,"info");const e={storeId:p,version:z};A(`/api/set-store-version?${w.toString()}`,{body:e,method:"POST"}).catch(e=>k("Unable to save store's vesrion",e))}if(!a){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some(e=>o.includes(e)),t=["qa.js.zonos.com"].some(e=>o.includes(e));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:d}),r=t&&!n?e:`${"alpha"===z?"alpha":`v${z}`}.js.zonos.com`,s=t&&!n?null:z;c("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:z}),W.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview&&!window.Zonos.doneInit)&&(window.Zonos=X)})();
|