@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,n,r,t){function o(e){return e instanceof r?e:new r((function(n){n(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?r(e.value):o(e.value).then(a,s)}u((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return u([e,n])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(t=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=n.call(e,r)}catch(e){s=[6,e];o=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,r){if(r||arguments.length===2)for(var t=0,o=n.length,i;t<o;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};import{l as log}from"./VarianceTest-BJmZPrZl.js";var fallbackApiType=["cloudflare","vercel"];var MAIN_BASE_API_TYPE=fallbackApiType[0];var fallbackApiList={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"};var MAIN_BASE_API=fallbackApiList[MAIN_BASE_API_TYPE];
|
|
2
|
+
/**
|
|
3
|
+
* Next available fallback api type
|
|
4
|
+
*/var getNextFallbackApiType=function(e){if(e===void 0){e=MAIN_BASE_API_TYPE}var n=fallbackApiType.indexOf(e);var r=fallbackApiType[n+1];if(!r){return null}return r};
|
|
5
|
+
/**
|
|
6
|
+
* This is the time in milliseconds after release time that we will start sending error logs to the new API
|
|
7
|
+
* @default 1 hour
|
|
8
|
+
*/var postReleaseReportingDuration=1*3600*1e3;// 1 hour
|
|
9
|
+
var loggedHref=function(){var e=new URL(window.location.href);e.searchParams.delete("payment_intent");e.searchParams.delete("payment_intent_client_secret");e.searchParams.delete("redirect_status");return e.toString()};var sendErrorLog=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,t,o,i;var a=e.endpoint,s=e.errors,u=e.metadata,d=e.shouldPostReleaseErrorReporting;return __generator(this,(function(e){log("sendErrorLog","warn",a,u,s);if(d){n=Number(window.Zonos.releaseDate);r=(new Date).getTime();if(r-n>postReleaseReportingDuration){return[2/*return*/]}}t="userAgentData"in window.navigator?// userAgentData is not yet supported in all browsers
|
|
10
|
+
window.navigator.userAgentData:null;o={endpoint:a,errors:s,href:loggedHref(),metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:t&&t.brands.length>0?t:window.navigator.userAgent},u)};try{
|
|
11
|
+
// use native fetch because in handleFetch also calls sendErrorLog and it will possibly cause circular dependencies issue
|
|
12
|
+
void fetch("".concat(MAIN_BASE_API,"/api/zonos-elements/log-error"),{body:JSON.stringify(o),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){i=getNextFallbackApiType();if(!i){return[2/*return*/]}
|
|
13
|
+
// request to the fallback API if the first one fails
|
|
14
|
+
void fetch("".concat(fallbackApiList[i],"/api/zonos-elements/log-error"),{body:JSON.stringify(o),method:"POST"})}return[2/*return*/]}))}))};var thrownMessage=function(e,n){if(typeof e==="string"&&e){return e}if(e instanceof Error&&e.message){return e.message}if(typeof e==="object"&&e!==null&&"message"in e&&typeof e.message==="string"&&e.message){return e.message}return n};var logError=function(e){var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}log.apply(void 0,__spreadArray([e,"error"],n,false))};var reportedIds=function(){if(!window.__zonosReportedBlockedStorage){window.__zonosReportedBlockedStorage=new Set}return window.__zonosReportedBlockedStorage};
|
|
15
|
+
/**
|
|
16
|
+
* Record a blocked storage read or write on the existing error log.
|
|
17
|
+
* A throw before `window.Zonos` exists is swallowed and does not use up
|
|
18
|
+
* the per-page dedupe slot, so the later startup read can still report it.
|
|
19
|
+
*/var reportBlockedStorage=function(e,n,r,t){if(typeof window.Zonos==="undefined"){return}var o="".concat(e,"\0").concat(n,"\0").concat(r);var i=reportedIds();if(i.has(o)){return}i.add(o);void sendErrorLog({endpoint:"storage://".concat(e,"/").concat(r),errors:[thrownMessage(t,"SecurityError")],metadata:{area:e,key:r,operation:n,shape:"blocked-storage"}})};
|
|
20
|
+
/**
|
|
21
|
+
* Touch `window.localStorage` / `window.sessionStorage` inside the try.
|
|
22
|
+
* Safari throws SecurityError on the getter itself when storage is blocked.
|
|
23
|
+
* A missing storage object is the same failure: calling `getItem` on it
|
|
24
|
+
* would report a TypeError instead of blocked storage.
|
|
25
|
+
*/var storageFor=function(e){var n=e==="local"?window.localStorage:window.sessionStorage;if(!n){throw new DOMException("","SecurityError")}return n};var safeGetItem=function(e,n){try{return storageFor(e).getItem(n)}catch(r){reportBlockedStorage(e,"getItem",n,r);return null}};var safeRemoveItem=function(e,n){try{storageFor(e).removeItem(n)}catch(r){reportBlockedStorage(e,"removeItem",n,r)}};var safeSetItem=function(e,n,r){try{storageFor(e).setItem(n,r)}catch(r){reportBlockedStorage(e,"setItem",n,r)}};var getIsStagingMode=function(){return window.location.search.includes("zonosStagingMode=1")};var getIsTestMode=function(){var e;return((e=window.Zonos.zonosApiKey)===null||e===void 0?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};var jsonParse=function(e){if(typeof e==="string"){try{
|
|
26
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
27
|
+
var n=JSON.parse(e);return n}catch(e){return null}}return null};var checkoutBreakpoint=890;var isCheckoutMobile=function(e){return e||window.innerWidth<checkoutBreakpoint};var getNavigatorConnection=function(){var e="connection"in window.navigator?// connection is not yet supported in all browsers
|
|
28
|
+
window.navigator.connection:null;var n="mozConnection"in window.navigator?// mozConnection is not yet supported in all browsers
|
|
29
|
+
window.navigator.mozConnection:null;var r="webkitConnection"in window.navigator?// webkitConnection is not yet supported in all browsers
|
|
30
|
+
window.navigator.webkitConnection:null;var t=e||n||r;return t};var getAdditionalLogMetadata=function(){var e="userAgentData"in window.navigator?// userAgentData is not yet supported in all browsers
|
|
31
|
+
window.navigator.userAgentData:null;var n=getNavigatorConnection();return{connectionDownlink:n===null||n===void 0?void 0:n.downlink,connectionEffectiveType:n===null||n===void 0?void 0:n.effectiveType,connectionRtt:n===null||n===void 0?void 0:n.rtt,connectionSaveData:n===null||n===void 0?void 0:n.saveData,isHostedCheckout:window.Zonos.isLegacyCheckout,screenHeight:window.screen.height,screenWidth:window.innerWidth,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent}};var blackListPaths=["/api/zonos-elements/log-script-load","/api/zonos-elements/log-bulk-load-data"];
|
|
32
|
+
/**
|
|
33
|
+
* Prepares the load time api log for the given API call to send to the server later
|
|
34
|
+
* This function is used to prepare the load time api log for the given API call.
|
|
35
|
+
* It adds the load time api log to the loadTimeApiInfoList.
|
|
36
|
+
*/var prepLoadTimeApiLog=function(e){var n=e.apiPath,r=e.apiType,t=e.loadTimeInternal,o=e.loadTimeTotal;if(blackListPaths.includes(n)){return}var i=o-t;
|
|
37
|
+
// No need to record if the browser API load time is negative (cached)
|
|
38
|
+
if(i<0){return}
|
|
39
|
+
// e.g. /api/zonos-elements/log-script-load?zonosDebug=1 -> /api/zonos-elements/log-script-load
|
|
40
|
+
var a=n.split("?")[0]||n;var s=getAdditionalLogMetadata();var u=typeof s.userAgent==="object"&&s.userAgent.mobile;var d={apiType:r,connectionType:s.connectionEffectiveType,href:a,isHostedCheckout:window.Zonos.isLegacyCheckout,
|
|
41
|
+
// Use the isMobileAgent to determine if the checkout is mobile, if it's not availabe, use the logic from isCheckoutMobile
|
|
42
|
+
isMobile:isCheckoutMobile(u),loadTimeBrowserApi:i,loadTimeInternal:t,loadTimeTotal:o,metadata:Object.assign({},s),screenHeight:s.screenHeight,screenWidth:s.screenWidth,userAgent:typeof s.userAgent==="string"?s.userAgent:s.userAgent["brands"].map((function(e){return e.brand})).filter((function(e){return!/Not.*A.*Brand.*/.test(e)})).join(",")};window.Zonos.loadTimeApiInfoList.push(d)};var __rest=undefined&&undefined.__rest||function(e,n){var r={};for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0)r[t]=e[t];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++){if(n.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o]))r[t[o]]=e[t[o]]}return r};var isGatewayStatus=function(e){return e===502||e===503||e===504};var getResponseBody=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,t;var o=e.response,i=e.shouldLog,a=i===void 0?true:i,s=e.shouldThrow,u=s===void 0?false:s;return __generator(this,(function(e){switch(e.label){case 0:e.trys.push([0,2,,3]);return[4/*yield*/,o.text()];case 1:n=e.sent();r=jsonParse(n);if(!r){throw new Error("Failed to parse content: ".concat(n))}return[2/*return*/,r];case 2:t=e.sent();if(u){throw t}if(a){
|
|
43
|
+
// eslint-disable-next-line
|
|
44
|
+
console.error(t)}return[2/*return*/,null];case 3:return[2/*return*/]}}))}))};var encodeString=function(e){try{
|
|
45
|
+
// encode the string, remove the "=" at the end of the encoded string
|
|
46
|
+
var n=btoa(e).replace(/=/g,"");return n}catch(n){
|
|
47
|
+
// return the reverse string if the encoding failed
|
|
48
|
+
return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}};var handleRequest=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,t,o,i,a,s,u,d,l,c,l,f,v,s,w,s;var p=e.basePathType,g=e.options,h=e.path;return __generator(this,(function(e){switch(e.label){case 0:r=window.Zonos.zonosQaUrlApi||fallbackApiList[p]||MAIN_BASE_API_TYPE;t=r+h;o=new URL(t);i=window.Zonos.cartId?"".concat(window.location.hostname,"-").concat(window.Zonos.cartId):window.location.hostname;o.searchParams.set("zToken",encodeString(i));e.label=1;case 1:e.trys.push([1,3,,4]);return[4/*yield*/,fetch(o.toString(),g)];case 2:n=e.sent();return[3/*break*/,4];case 3:a=e.sent();if(a instanceof Error){return[2/*return*/,{baseUrl:r,errors:[{message:a.message,type:"unknown"}],json:null,response:null,zonosMode:null}]}s="Failed to fetch";return[2/*return*/,{baseUrl:r,errors:[{message:s,type:"unknown"}],json:null,response:null,zonosMode:null}];case 4:u=n.headers.get("Zonos-Mode");d=window.Zonos.zonosQaUrl;
|
|
49
|
+
// We only want to alert once if the user is in preview mode and it's also using production environment
|
|
50
|
+
if(!window.Zonos.modeAlerted&&u&&d){window.Zonos.modeAlerted=true}if(!n.ok)return[3/*break*/,6];return[4/*yield*/,getResponseBody({response:n})];case 5:l=e.sent();return[2/*return*/,{baseUrl:r,errors:[],json:l,response:n,zonosMode:u}];case 6:c=n.status.toString();e.label=7;case 7:e.trys.push([7,9,,10]);return[4/*yield*/,getResponseBody({response:n,shouldThrow:true})];case 8:l=e.sent();
|
|
51
|
+
// Parse and access "errors" from the response if possible
|
|
52
|
+
if(l&&"errors"in l&&Array.isArray(l.errors)){f=l.errors;v=f.map((function(e){if(typeof e==="string"){return{message:e,type:c}}return e}));return[2/*return*/,{baseUrl:r,errors:v,json:null,response:n,zonosMode:u}]}s=JSON.stringify(l);return[2/*return*/,{baseUrl:r,errors:[{message:s,type:c}],json:null,response:n,zonosMode:u}];case 9:w=e.sent();s="Unknown error";
|
|
53
|
+
// A gateway HTML or empty body still carries a status a GET can fail over
|
|
54
|
+
// on. Other non-JSON statuses, including 404 and 500, keep the previous
|
|
55
|
+
// null response so they do not fail over.
|
|
56
|
+
return[2/*return*/,{baseUrl:r,errors:[{message:"".concat(c,": ").concat(s),type:c}],json:null,response:isGatewayStatus(n.status)?n:null,zonosMode:u}];case 10:return[2/*return*/]}}))}))};var handleRequestWithFallback=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,r,t,o,i,a,s,u,d,l,c,f,v,w,p,g,h,b,y,m,_,A;var k=e.basePathType,T=e.options,I=e.path;return __generator(this,(function(e){switch(e.label){case 0:o=I.startsWith("/api/bigcommerce");i=o?"vercel":k;a=performance.now();return[4/*yield*/,handleRequest({basePathType:i,options:T,path:I})];case 1:s=e.sent(),u=s.errors,d=s.response,l=__rest(s,["errors","response"]);c=performance.now();f=c-a;
|
|
57
|
+
// Send the load time api log
|
|
58
|
+
log("".concat(I," (").concat(f.toFixed(2),"ms)"),"info");v=d===null||d===void 0?void 0:d.headers.get("Zonos-Duration");
|
|
59
|
+
// Only record if the response status is 200, some endpoint will return 200 with error
|
|
60
|
+
if((d===null||d===void 0?void 0:d.status)===200){prepLoadTimeApiLog({apiPath:I,apiType:i,loadTimeInternal:v?Number(v):0,loadTimeTotal:f})}w=getNextFallbackApiType(i);p=u.find((function(e){var n=e.type;return n==="unknown"}));g=u.find((function(e){var n=e.message;return typeof n==="string"&&(n.includes("signal is aborted")||n.includes("The operation was aborted")||n.includes("Fetch is aborted"))}));h=d===null||d===void 0?void 0:d.status;b=h!==undefined&&isGatewayStatus(h);y=((n=T===null||T===void 0?void 0:T.method)!==null&&n!==void 0?n:"GET").toUpperCase()==="GET";m=!!p||h===404||h===500;_=m||b;A=w&&(m||b&&y);
|
|
61
|
+
// Should log the error if it's unknown error
|
|
62
|
+
if(_&&!g){void sendErrorLog({endpoint:fallbackApiList[i]+I,errors:u.map((function(e){var n=e.message;return"API: ".concat(n)})),metadata:{currentBasePath:i,nextFallbackApiType:w,requestHeaders:T===null||T===void 0?void 0:T.headers,requestPayload:jsonParse((r=T===null||T===void 0?void 0:T.body)===null||r===void 0?void 0:r.toString())||((t=T===null||T===void 0?void 0:T.body)===null||t===void 0?void 0:t.toString()),shouldCallFallback:A,status:d===null||d===void 0?void 0:d.status,statusText:d===null||d===void 0?void 0:d.statusText},
|
|
63
|
+
// When the error is unknown, error reporting should be enabled for period of time after release, so we can monitor the error.
|
|
64
|
+
shouldPostReleaseErrorReporting:true})}if(A){log('=== "'.concat(I,'" failed to fetch, trying next fallback ').concat(w));return[2/*return*/,handleRequestWithFallback({basePathType:w,options:T,path:I})]}
|
|
65
|
+
// No more fallbacks, just return the result
|
|
66
|
+
return[2/*return*/,Object.assign({errors:u,response:d},l)]}}))}))};
|
|
67
|
+
/**
|
|
68
|
+
* Fetch request and will request to fallback API when the first one fails
|
|
69
|
+
* @param path Path name of the request (e.g. /api/something/com).
|
|
70
|
+
* @param _opts fetch options
|
|
71
|
+
*/var handleFetch=function(e,n){return __awaiter(void 0,void 0,void 0,(function(){var r,t,o,i,a,s;return __generator(this,(function(u){r=__rest(n||{},[]);t=r.body?JSON.stringify(r.body):undefined;o=r.method||"GET";i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":getIsStagingMode()?"1":undefined,"Zonos-Test-Mode":getIsTestMode()?"1":undefined,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},r.headers);
|
|
72
|
+
// filter all underfined headers
|
|
73
|
+
Object.keys(i).forEach((function(e){return i[e]===undefined&&delete i[e]}));a=Object.assign(Object.assign({},r),{body:o==="GET"?undefined:t,headers:i,method:o});s=new URLSearchParams(window.location.search).get("useFallbackApi");return[2/*return*/,handleRequestWithFallback({basePathType:s||MAIN_BASE_API_TYPE,options:a,path:e})]}))}))};export{getIsStagingMode as a,safeRemoveItem as b,safeGetItem as c,getAdditionalLogMetadata as d,safeSetItem as e,fallbackApiList as f,getIsTestMode as g,handleFetch as h,isCheckoutMobile as i,jsonParse as j,logError as l,sendErrorLog as s,thrownMessage as t};
|
package/dist/esm-es5/index.js
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,n,o,t){function r(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?o(e.value):r(e.value).then(a,s)}u((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,r,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return u([e,n])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(t=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=n.call(e,o)}catch(e){s=[6,e];r=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,o){if(o||arguments.length===2)for(var t=0,r=n.length,i;t<r;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};export{c as curpRegex,i as isMexicoTaxIdType,a as isPeruTaxIdType,p as peruTaxIdTypeFromValue,s as stripTaxIdSeparators}from"./taxIdRules-xYlx7ZXW.js";import{c as createCustomEvent}from"./createCustomEvent-XQfWgQLB.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-HeAZDwVW.js";import{l as
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,n,o,t){function r(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,i){function a(e){try{u(t.next(e))}catch(e){i(e)}}function s(e){try{u(t["throw"](e))}catch(e){i(e)}}function u(e){e.done?o(e.value):r(e.value).then(a,s)}u((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,r,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return u([e,n])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(t=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=n.call(e,o)}catch(e){s=[6,e];r=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,o){if(o||arguments.length===2)for(var t=0,r=n.length,i;t<r;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};export{c as curpRegex,i as isMexicoTaxIdType,a as isPeruTaxIdType,p as peruTaxIdTypeFromValue,s as stripTaxIdSeparators}from"./taxIdRules-xYlx7ZXW.js";import{c as createCustomEvent}from"./createCustomEvent-XQfWgQLB.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-HeAZDwVW.js";import{t as thrownMessage,s as sendErrorLog,g as getIsTestMode,a as getIsStagingMode,h as handleFetch,l as logError,b as safeRemoveItem,c as safeGetItem}from"./handleFetch-BFVO7oAR.js";import{l as log}from"./VarianceTest-BJmZPrZl.js";export{a as availableTestKeys}from"./VarianceTest-BJmZPrZl.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-D5SpFsQJ.js";export{d as domesticRedirectedBtnSelector}from"./CheckoutConfig-D5SpFsQJ.js";export{c as countryRequireShortAddressCode}from"./ShortAddressCode-nJ6oI8-n.js";export{a as checkoutTaxIdTypeValues,c as countryRequireTaxId,e as euCountryCodes,i as isCountryRequireTaxId,p as peruTaxIdDigitLength,b as peruTaxIdFormatError,s as shipToTaxIdLabels,t as taxIdTypeOptions}from"./TaxId-DMIgN_sT.js";var constructorNotFound=/^Constructor for .+ was not found/;var constructorTag=/^Constructor for "?([^#"]+)#/;var recordConstructorFailure=function(e){var n;var o=thrownMessage(e,"");if(!o||!constructorNotFound.test(o)){return}if(typeof window.Zonos==="undefined"){return}var t=window.__zonosConstructorCapture;if(!t){return}var r=constructorTag.exec(o);var i=(n=r===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:"";if(t.reported.has(i)){return}t.reported.add(i);void sendErrorLog({endpoint:"stencil://constructor",errors:[o],metadata:{shape:"constructor-not-found",tag:i}})};
|
|
2
|
+
/**
|
|
3
|
+
* Copy a missing-constructor failure onto the existing error log.
|
|
4
|
+
* Stencil catches `Constructor for "tag#mode" was not found` and passes that
|
|
5
|
+
* Error to `console.error`. One report is sent per tag, then the original
|
|
6
|
+
* console.error still runs. This does not request the chunk again.
|
|
7
|
+
*/var installConstructorCapture=function(){if(window.__zonosConstructorCapture){return}var e=function(e){recordConstructorFailure(e.reason)};window.__zonosConstructorCapture={listener:e,reported:new Set};window.addEventListener("unhandledrejection",e);
|
|
8
|
+
// eslint-disable-next-line no-console -- Stencil reports the missing constructor here
|
|
9
|
+
var n=console.error.bind(console);
|
|
10
|
+
// eslint-disable-next-line no-console -- record the Stencil diagnostic, then forward it
|
|
11
|
+
console.error=function(){var e=[];for(var o=0;o<arguments.length;o++){e[o]=arguments[o]}recordConstructorFailure(e[0]);n.apply(void 0,e)}};var reportInitRejection=function(e){
|
|
12
|
+
// sendErrorLog prints only when zonosDebug is on. Keep the failure in the
|
|
13
|
+
// merchant console without leaving an unhandled rejection.
|
|
14
|
+
// eslint-disable-next-line no-console -- the page console is the support signal
|
|
15
|
+
console.error(e);if(typeof window.Zonos==="undefined"){return}void sendErrorLog({endpoint:"zonos://init",errors:[thrownMessage(e,"Unknown init rejection")],metadata:{shape:"init-rejection"}})};
|
|
16
|
+
/**
|
|
17
|
+
* Run an init that the caller is not waiting on. The rejection is recorded
|
|
18
|
+
* and not rethrown, so startup does not become an unhandled rejection.
|
|
19
|
+
*/var startZonosInit=function(e){var n;try{n=e()}catch(e){reportInitRejection(e);return}void n.catch((function(e){reportInitRejection(e)}))};
|
|
2
20
|
/**
|
|
3
21
|
* Get the load version and url based on the loadScriptSrc and version
|
|
4
22
|
* @returns
|
|
@@ -54,7 +72,7 @@ var n=new URL(e).searchParams;var o=n.get("zonosQaUrl");if(!o){return null}var t
|
|
|
54
72
|
* When developing, if the script load is from `dev.elements.zonos.com`,
|
|
55
73
|
* it would load script from that same domain instead of loading from cdn
|
|
56
74
|
*/
|
|
57
|
-
var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.5.
|
|
75
|
+
var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.5.2.js.zonos.com";
|
|
58
76
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
59
77
|
if(!n&&(o.includes("test.")||
|
|
60
78
|
// Vercel git domain
|
|
@@ -68,7 +86,7 @@ if(n==="worker"){return null}var t="preview.js.zonos.com";var r="https://".conca
|
|
|
68
86
|
// request to the url and check if the request has an error
|
|
69
87
|
void fetch(r).then((function(){
|
|
70
88
|
// cleanup checkout session to avoid using the prod session in preview domain
|
|
71
|
-
|
|
89
|
+
safeRemoveItem("session","zonos--checkout-session-id");safeRemoveItem("session","zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));
|
|
72
90
|
// remove the zonosQaUrl param from url
|
|
73
91
|
var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var o="".concat(n,"?").concat(e.toString());
|
|
74
92
|
/**
|
|
@@ -99,15 +117,15 @@ return[4/*yield*/,new Promise((function(e){return setTimeout(e,500)}))];case 2:
|
|
|
99
117
|
e.sent();return[2/*return*/,getCartInfoById({cartId:d,retries:l-1})];case 3:if(c){return[2/*return*/,null]}return[2/*return*/,Object.assign(Object.assign({},s),{zonosMode:u})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),o=n.isDgsCartId,t=n.isLegacyCartId;if(!t&&!o){logError("[ZONOS - loadZonos] invalid cart id");return[2/*return*/,null]}return[4/*yield*/,getCartInfoById({cartId:e,retries:5})];case 1:r=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2/*return*/,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2/*return*/,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;
|
|
100
118
|
/**
|
|
101
119
|
* Get the load version and url based on the loadScriptSrc, if the domain that used to load `zonos.js` is in white listed domains, use currentLoadScriptUrl as the load url instead, if zonosQaUrl exists, it would also fall under the white listed domain
|
|
102
|
-
*/var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.5.
|
|
120
|
+
*/var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.5.2.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.5.2";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.5.2";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.5.2";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=/** @class */function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;
|
|
103
121
|
// if query 'zonosDebug=1' param from url, debug mode is on
|
|
104
|
-
Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="
|
|
122
|
+
Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="1793899893283";Zonos.isLegacyCheckout=false;Zonos.googleAnalyticId=null;Zonos.googleAnalyticReady=false;Zonos.facebookPixelId=null;Zonos.facebookPixelReady=false;Zonos.startLoadTime=startLoadTime;Zonos.domain=typeof window!=="undefined"?// domain that embeds the iframe
|
|
105
123
|
window.location!=window.parent.location&&document.referrer||
|
|
106
124
|
// current domain
|
|
107
125
|
document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isCollect=false;Zonos.isInvoice=false;
|
|
108
126
|
/**
|
|
109
127
|
* By default, the package will load from npm
|
|
110
|
-
*/Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.5.
|
|
128
|
+
*/Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.5.2");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.zonosMode=null;Zonos.IframeService=IframeService;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.loadTimeApiInfoList=[];Zonos.logIntervalId=null;Zonos.init=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r,i,a,s,u,c,d,l,f,v,m,p;return __generator(this,(function(_){switch(_.label){case 0:installConstructorCapture();n=e.appearance,o=e.checkoutSettings,t=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,u=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();
|
|
111
129
|
// Expose the checkout cart callbacks on the global so Stripe loading can be
|
|
112
130
|
// gated on whether at least one of them is configured.
|
|
113
131
|
_a.createCartId=o===null||o===void 0?void 0:o.createCartId;
|
|
@@ -120,11 +138,11 @@ if(typeof window!=="undefined"&&window.parent===window){_a.googleAnalyticReady=t
|
|
|
120
138
|
// if zonosQaUrl is available, inject the script from the zonosQaUrl and then call init again
|
|
121
139
|
if(c&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(c," ======"),"info");d=document.createElement("script");d.src="".concat(c,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;window.Zonos.zonosMode=_a.zonosMode;
|
|
122
140
|
// call init again after the script is loaded
|
|
123
|
-
|
|
141
|
+
startZonosInit((function(){return window.Zonos.init(e)}))}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(c))}));
|
|
124
142
|
// Set so won't inject the preview script again
|
|
125
143
|
window.isZonosPreview=true;return[2/*return*/]}
|
|
126
144
|
// zonosApiKey is required if tempCartUUID in query params are not provided
|
|
127
|
-
if(!u&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2/*return*/]}if(!(!_a.cartData&&_a.cartId))return[3/*break*/,2];log("Initialize cart data");return[4/*yield*/,setupCartDataWithSettings(_a.cartId)];case 1:l=_.sent();if(!l){logError("Failed to get cart data");return[2/*return*/]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;_.label=2;case 2:return[4/*yield*/,getWithTestPublicCredential()];case 3:f=_.sent();if(f){_a.zonosApiKey=f}_.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||
|
|
145
|
+
if(!u&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2/*return*/]}if(!(!_a.cartData&&_a.cartId))return[3/*break*/,2];log("Initialize cart data");return[4/*yield*/,setupCartDataWithSettings(_a.cartId)];case 1:l=_.sent();if(!l){logError("Failed to get cart data");return[2/*return*/]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;_.label=2;case 2:return[4/*yield*/,getWithTestPublicCredential()];case 3:f=_.sent();if(f){_a.zonosApiKey=f}_.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||safeGetItem("session","zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;
|
|
128
146
|
// inject hidden button to body to trigger checkout right away if we have cartData or stripe client secret
|
|
129
147
|
if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");p=document.createElement("button");p.style.display="none";p.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(p)}log("init zonos");_a.restoreNativeBrowserFunctions();
|
|
130
148
|
// inject custom script for hosted checkout if can find it in metadata
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):n(e.value).then(a,s)}d((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return d([e,t])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-BXP9FvIt.js";import{d as cartStore,Z as cartStoreUpdateSelectedShippingOption,b as stripeStore,a1 as stripeStoreBuildAddressForPartyCreate}from"./cart-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,r,o){function n(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function s(e){try{d(o["throw"](e))}catch(e){i(e)}}function d(e){e.done?r(e.value):n(e.value).then(a,s)}d((o=o.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=s(0),a["throw"]=s(1),a["return"]=s(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return d([e,t])}}function d(s){if(o)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(r=0)),r)try{if(o=1,n&&(i=s[0]&2?n["return"]:s[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;if(n=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;n=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];n=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{c as createStore,z as zonosStore}from"./zonosStore-BXP9FvIt.js";import{d as cartStore,Z as cartStoreUpdateSelectedShippingOption,b as stripeStore,a1 as stripeStoreBuildAddressForPartyCreate}from"./cart-BS5mSI8x.js";import{s as storageStore}from"./localization-CXHiWcJp.js";import{h as handleFetch,s as sendErrorLog,l as logError}from"./handleFetch-BFVO7oAR.js";import{b as allLogs}from"./VarianceTest-BJmZPrZl.js";var invoiceStore=createStore((function(){return{amountTotalDue:null,isFetchingPayorInfo:true,landedCostShortId:null,partyBillingId:null,payorAddress:null}})).state;var invoiceStoreInitShippingInfo=function(e){return __awaiter(void 0,[e],void 0,(function(e){var t,r,o,n,i;var a=e.landedCostId,s=e.retries,d=s===void 0?5:s;return __generator(this,(function(e){switch(e.label){case 0:invoiceStore.isFetchingPayorInfo=true;return[4/*yield*/,handleFetch("/api/zonos-elements/invoice/get-payor-info-by-lc-id",{body:{landedCostId:a},method:"POST"})];case 1:n=e.sent();if(!n.errors.length)return[3/*break*/,4];if(!(d>0))return[3/*break*/,3];
|
|
2
2
|
// Wait for 1 second before retrying
|
|
3
3
|
return[4/*yield*/,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:
|
|
4
4
|
// Wait for 1 second before retrying
|