@zonos/elements 1.3.194 → 1.3.195

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.
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,e,t,r){function o(n){return n instanceof t?n:new t((function(e){e(n)}))}return new(t||(t=Promise))((function(t,i){function u(n){try{s(r.next(n))}catch(n){i(n)}}function a(n){try{s(r["throw"](n))}catch(n){i(n)}}function s(n){n.done?t(n.value):o(n.value).then(u,a)}s((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(e){return s([n,e])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=e.call(n,t)}catch(n){a=[6,n];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-1b75aa35.system.js","./p-5e1b2654.system.js","./p-2b8345d8.system.js"],(function(n){"use strict";var e,t,r,o,i,u,a,s,c,d,l;return{setters:[function(n){e=n.c},function(n){t=n.g;r=n.I},function(n){o=n.g;i=n.a;u=n.l;a=n.h;s=n.b},function(e){c=e._;d=e.c;l=e.a;var t={};t.checkoutHiddenBtnSelector=e.c;t.checkoutHiddenInternationalBtnSelector=e.a;t.domesticRedirectedBtnSelector=e.d;n(t)},function(e){var t={};t.countryRequireTaxId=e.c;t.euCountryCodes=e.e;t.shipToTaxIdLabels=e.s;n(t)}],execute:function(){var f=this;var v=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var o=new URL(e).origin;var i=t.some((function(n){return o.includes(n)}));var u=r.some((function(n){return o.includes(n)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var m=["jsdelivr","cdnjs","unpkg","vercel"];var w="jsdelivr";var p=function(n){var e=m.indexOf(n);var t=m[e+1];return t||null};var h=function(){return __awaiter(f,void 0,void 0,(function(){var n,e,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:n=o();e=i();if(!n&&!e||!window.Zonos.zonosApiKey){return[2,null]}u("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}u("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var y=function(n){if(!n){return null}var e=new URL(n).searchParams;var t=e.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var e=y(window.location.href);var t="https://v1.3.194.js.zonos.com";if(!e&&(t.includes("test.")||t.includes("test-"))){return t}if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!e){return null}if(e==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var o="https://".concat(e,".").concat(r);u("[ZONOS-WARNING] using '".concat(o,"' for loading elements script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var t="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return o};var b="https://js.stripe.com/v3";var z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var O=function(){var n=document.querySelectorAll('script[src^="'.concat(b,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!z.test(t.src)){continue}return t}return null};var j=null;var k=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(b).concat(e);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var _=function(n){if(j!==null){return j}j=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(S)}if(window.Stripe){e(window.Stripe);return}try{var r=O();if(r&&n){console.warn(S)}else if(!r){r=k(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(n){t(n);return}}));return j};var Z=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var N=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);Z(r,t);return r};var I=Promise.resolve().then((function(){return _(null)}));var L=false;I.catch((function(n){if(!L){console.warn(n)}}));var U=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(f,void 0,void 0,(function(){var e;return __generator(this,(function(t){L=true;e=Date.now();return[2,I.then((function(t){return N(t,n,e)}))]}))}))};var R="tempCartUUID";var T=function(){var n=new URLSearchParams(window.location.search);var e=n.get(R);return e};var A=function(n){return __awaiter(f,[n],void 0,(function(n){var e,r,i,s,c,d,l,f;var v=n.cartId,m=n.retries;return __generator(this,(function(n){switch(n.label){case 0:e=o();r=t();i=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){i.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(i.toString()),{body:{isTestMode:e,tempCartUUID:v},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:s=n.sent(),c=s.errors,d=s.json,l=s.zonosMode;f=!d||c.length;if(!(f&&m))return[3,3];u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:m});return[4,new Promise((function(n){return setTimeout(n,500)}))];case 2:n.sent();return[2,A({cartId:v,retries:m-1})];case 3:if(f){return[2,null]}return[2,Object.assign(Object.assign({},d),{zonosMode:l})]}}))}))};var F=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=c(n),t=e.isDgsCartId,r=e.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,A({cartId:n,retries:5})];case 1:o=i.sent();u("[ZONOS - loadZonos] getting temp cart data","info",o);if(!o){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=o.cartData.storeId;window.Zonos.zonosApiKey=o.cartData.credentialToken;window.Zonos.zonosMode=o.zonosMode;return[2,{cartData:o.cartData,settings:o.settings,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}]}}))}))};var E;var P=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=v({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var C="https://v1.3.194.js.zonos.com";var D=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.194";var M="https://unpkg.com/@zonos/elements@1.3.194";var x="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.194";var G="https://fonts.googleapis.com";var B=/^https:\/\/fonts\.googleapis\.com/;var V=function(){function n(){}return n}();n("Zonos",V);E=V;V.doneInit=false;V.cartSettings=null;V.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);V.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);V._paypalMockResponse=null;V.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;V.isBigCommerce=false;V.releaseDate="1746221316172";V.isLegacyCheckout=false;V.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";V.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");V.overrideUseCustomAddressForm=false;V.isNpm=true;V.zonosQaUrl=null;V.zonosQaUrlApi=null;V.trackEventLogs=[];V.version="v".concat("1.3.194");V.modeAlerted=false;V.cartData=null;V.paypal=null;V.zonosMode=null;V.IframeService=r;V.getCurrentTimestamp=function(){return(new Date).getTime()};V.zonosController=null;V.loadTimeApiInfoList=[];V.logIntervalId=null;V.init=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o,i,a,c,l,f,v,m,w,p,y,b;return __generator(this,(function(z){switch(z.label){case 0:e=n.appearance,t=n.checkoutSettings,r=n.currencyConverter,o=n.helloSettings,i=n.onCountryChange,a=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;E.cartId=T();if(E.doneInit){return[2]}u("====== ZONOS DEBUG MODE: on (".concat(E.version,") ======"));E.zonosApiKey=l;E.storeId=c;if(!E.isNpm)return[3,4];u("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){u('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=E.isNpm;window.Zonos.isBigCommerce=E.isBigCommerce;window.Zonos.isLegacyCheckout=E.isLegacyCheckout;void window.Zonos.init(n)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!l&&!E.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!E.cartData&&E.cartId))return[3,2];u("Initialize cart data");return[4,F(E.cartId)];case 1:m=z.sent();if(!m){s("Failed to get cart data");return[2]}E.cartData=m.cartData;E.zonosApiKey=m.zonosApiKey;E.cartSettings=m.settings;z.label=2;case 2:return[4,h()];case 3:w=z.sent();if(w){E.zonosApiKey=w}z.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");y=E.cartId&&E.cartData||!!p;if(y){u("Cart data or stripe client secret is available, inject hidden button and trigger checkout");b=document.createElement("button");b.style.display="none";b.id="".concat(d);document.body.appendChild(b)}u("init zonos");E.restoreNativeBrowserFunctions();E.injectCustomScriptForHostedCheckout();E.injectZonosCdn();E.injectZonosCss();E.injectFonts();E.injectCheckoutInternationalButton();E.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:o,onCountryChange:i,overrideCurrencyFormat:a}});E.doneInit=true;return[2]}}))}))};V.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(l))){var n=document.createElement("button");n.id=l;n.style.display="none";document.body.appendChild(n)}};V.injectCustomScriptForHostedCheckout=function(){var n=E.cartData;var e=(n===null||n===void 0?void 0:n.metadata)||[];var t=e.find((function(n){return n.key==="customHeaderScript"}));var r=e.find((function(n){return n.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){u("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){u("Injecting custom header script");var o=document.createElement("script");o.textContent=t.value;document.head.appendChild(o)}if(r){u("Injecting custom footer script");var o=document.createElement("script");o.textContent=r.value;document.body.appendChild(o)}};V.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};V.triggerCheckoutInternational=function(){return __awaiter(f,void 0,void 0,(function(){var n;return __generator(this,(function(t){n=document.querySelector("#".concat(l));setTimeout((function(){if(n){n.dispatchEvent(e("click"))}}),10);return[2]}))}))};V.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};V.showNotification=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.showNotification(n))};V.updateOrganizationName=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};V.disablePlaceOrderButtons=function(n){var e=n.autoEnable,t=e===void 0?true:e,r=n.config,o=n.disable,i=n.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};a.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(o){n.setAttribute("disabled","true");n.addEventListener("click",s)}else{n.removeAttribute("disabled");n.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",s)}))}),5e3)}}};V.restoreNativeBrowserFunctions=function(){var n;var e=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(e){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((n=r.contentWindow)===null||n===void 0?void 0:n.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};V.injectController=function(n){var e=n.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=e.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var o=e.checkoutSettings.placeOrderButtonSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o})}));i.observe(document.body,{childList:true,subtree:true})}if((r=e.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=e;c.zonosApiKey=E.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(n){return __awaiter(f,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;u("loading Stripe");return[4,U(e.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void c.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(c);E.zonosController=c;u("Zonos controller injected!")};V.injectScript=function(n){var e=n.cdnType,t=n.isModule,r=n.theRestUrl;var o=E.getZonosUrl(e);var i="".concat(o,"/").concat(r);var a=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(a()){u('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=i;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var n=p(e);if(!n){return}E.injectScript({cdnType:n,isModule:t,theRestUrl:r})};c.appendChild(d)};V.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return D;case"unpkg":return M;case"cdnjs":return x;case"vercel":return C}};if(E.isNpm){var t=g();return t||e()}return e()};V.injectZonosCdn=function(){E.injectScript({cdnType:w,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});E.injectScript({cdnType:w,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});u("Zonos cdn script injected!")};V.injectStylesheet=function(n){var e=n.cdnType,t=n.theRestUrl;var r=E.getZonosUrl(e);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(C,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var n=p(e);if(!n){return}E.injectStylesheet({cdnType:n,theRestUrl:t})};o.appendChild(u)};V.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){u("Zonos style links already injected","warn");return}E.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"});u("Zonos style css injected!")};V.injectFonts=function(){var n=function(){var n=document.fonts.check("1em Inter");if(n){u("Inter font already loaded","warn");return}var e=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(G,'"]'));for(var t=0;t<e.length;t++){var r=e[t];if(!r){continue}if(B.test(r.href)){continue}return r}return null};if(n()){u("Inter font already injected","warn");return}var e=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=G;e.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(G,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");e.appendChild(r);u("Zonos font injected!")};V.setupGoogleFont=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};V.injectSupportGoogleFont=function(n){var e;u("[FONT] injecting ".concat(n));var t=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(G,'"]'))){var o=document.createElement("link");o.rel="preconnect";o.href=G;r.appendChild(o)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){u("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);u("[FONT] ".concat(t," font injected!"))}}}}));
1
+ var __awaiter=this&&this.__awaiter||function(n,e,t,r){function o(n){return n instanceof t?n:new t((function(e){e(n)}))}return new(t||(t=Promise))((function(t,i){function u(n){try{s(r.next(n))}catch(n){i(n)}}function a(n){try{s(r["throw"](n))}catch(n){i(n)}}function s(n){n.done?t(n.value):o(n.value).then(u,a)}s((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,o,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(e){return s([n,e])}}function s(a){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(t=0)),t)try{if(r=1,o&&(i=a[0]&2?o["return"]:a[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;if(o=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;o=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1];i=a;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(a);break}if(i[2])t.ops.pop();t.trys.pop();continue}a=e.call(n,t)}catch(n){a=[6,n];o=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-bf37ccc7.system.js","./p-4160bbc2.system.js","./p-1b75aa35.system.js","./p-5e1b2654.system.js","./p-2b8345d8.system.js"],(function(n){"use strict";var e,t,r,o,i,u,a,s,c,d,l;return{setters:[function(n){e=n.c},function(n){t=n.g;r=n.I},function(n){o=n.g;i=n.a;u=n.l;a=n.h;s=n.b},function(e){c=e._;d=e.c;l=e.a;var t={};t.checkoutHiddenBtnSelector=e.c;t.checkoutHiddenInternationalBtnSelector=e.a;t.domesticRedirectedBtnSelector=e.d;n(t)},function(e){var t={};t.countryRequireTaxId=e.c;t.euCountryCodes=e.e;t.shipToTaxIdLabels=e.s;n(t)}],execute:function(){var f=this;var v=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var o=new URL(e).origin;var i=t.some((function(n){return o.includes(n)}));var u=r.some((function(n){return o.includes(n)}));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:u,isWhiteListed:i}};var m=["jsdelivr","cdnjs","unpkg","vercel"];var w="jsdelivr";var p=function(n){var e=m.indexOf(n);var t=m[e+1];return t||null};var h=function(){return __awaiter(f,void 0,void 0,(function(){var n,e,t,r,c,d;return __generator(this,(function(l){switch(l.label){case 0:n=o();e=i();if(!n&&!e||!window.Zonos.zonosApiKey){return[2,null]}u("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){u("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,a("/api/get-test-public-credential")];case 1:t=l.sent(),r=t.errors,c=t.json;if(r.length||!c){s("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r);return[2,null]}d=c.publicCredential;if(!d){s("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}u("[ZONOS - loadZonos] Retrieve new test public token ".concat(d),"info");return[2,d]}}))}))};var y=function(n){if(!n){return null}var e=new URL(n).searchParams;var t=e.get("zonosQaUrl");if(!t){return null}var r=/[^a-zA-Z0-9-_]+/.test(t);if(!!r){return null}return t};var g=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var e=y(window.location.href);var t="https://v1.3.195.js.zonos.com";if(!e&&(t.includes("test.")||t.includes("test-"))){return t}if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!e){return null}if(e==="dev-elements"){return"https://dev.elements.zonos.com"}var r="preview.js.zonos.com";var o="https://".concat(e,".").concat(r);u("[ZONOS-WARNING] using '".concat(o,"' for loading elements script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var t="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",t);window.location.reload();return null}));return o};var b="https://js.stripe.com/v3";var z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var O=function(){var n=document.querySelectorAll('script[src^="'.concat(b,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!z.test(t.src)){continue}return t}return null};var j=null;var k=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var t=document.createElement("script");t.src="".concat(b).concat(e);var r=document.head||document.body;if(!r){s("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(t);return t};var _=function(n){if(j!==null){return j}j=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(S)}if(window.Stripe){e(window.Stripe);return}try{var r=O();if(r&&n){console.warn(S)}else if(!r){r=k(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{t(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(n){t(n);return}}));return j};var Z=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var N=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);Z(r,t);return r};var I=Promise.resolve().then((function(){return _(null)}));var L=false;I.catch((function(n){if(!L){console.warn(n)}}));var U=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(f,void 0,void 0,(function(){var e;return __generator(this,(function(t){L=true;e=Date.now();return[2,I.then((function(t){return N(t,n,e)}))]}))}))};var R="tempCartUUID";var T=function(){var n=new URLSearchParams(window.location.search);var e=n.get(R);return e};var A=function(n){return __awaiter(f,[n],void 0,(function(n){var e,r,i,s,c,d,l,f;var v=n.cartId,m=n.retries;return __generator(this,(function(n){switch(n.label){case 0:e=o();r=t();i=new URLSearchParams;if(r.overrideShouldEnabledCustomAddress){i.set("overrideShouldEnabledCustomAddress",r.overrideShouldEnabledCustomAddress)}return[4,a("/api/zonos-elements/get-cart?".concat(i.toString()),{body:{isTestMode:e,tempCartUUID:v},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:s=n.sent(),c=s.errors,d=s.json,l=s.zonosMode;f=!d||c.length;if(!(f&&m))return[3,3];u("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:m});return[4,new Promise((function(n){return setTimeout(n,500)}))];case 2:n.sent();return[2,A({cartId:v,retries:m-1})];case 3:if(f){return[2,null]}return[2,Object.assign(Object.assign({},d),{zonosMode:l})]}}))}))};var F=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o;return __generator(this,(function(i){switch(i.label){case 0:e=c(n),t=e.isDgsCartId,r=e.isLegacyCartId;if(!r&&!t){s("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,A({cartId:n,retries:5})];case 1:o=i.sent();u("[ZONOS - loadZonos] getting temp cart data","info",o);if(!o){s("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=o.cartData.storeId;window.Zonos.zonosApiKey=o.cartData.credentialToken;window.Zonos.zonosMode=o.zonosMode;return[2,{cartData:o.cartData,settings:o.settings,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}]}}))}))};var E;var P=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=v({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var C="https://v1.3.195.js.zonos.com";var D=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.195";var M="https://unpkg.com/@zonos/elements@1.3.195";var x="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.195";var G="https://fonts.googleapis.com";var B=/^https:\/\/fonts\.googleapis\.com/;var V=function(){function n(){}return n}();n("Zonos",V);E=V;V.doneInit=false;V.cartSettings=null;V.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);V.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);V._paypalMockResponse=null;V.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;V.isBigCommerce=false;V.releaseDate="1746235369220";V.isLegacyCheckout=false;V.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";V.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");V.overrideUseCustomAddressForm=false;V.isNpm=true;V.zonosQaUrl=null;V.zonosQaUrlApi=null;V.trackEventLogs=[];V.version="v".concat("1.3.195");V.modeAlerted=false;V.cartData=null;V.paypal=null;V.zonosMode=null;V.IframeService=r;V.getCurrentTimestamp=function(){return(new Date).getTime()};V.zonosController=null;V.loadTimeApiInfoList=[];V.logIntervalId=null;V.init=function(n){return __awaiter(f,void 0,void 0,(function(){var e,t,r,o,i,a,c,l,f,v,m,w,p,y,b;return __generator(this,(function(z){switch(z.label){case 0:e=n.appearance,t=n.checkoutSettings,r=n.currencyConverter,o=n.helloSettings,i=n.onCountryChange,a=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;E.cartId=T();if(E.doneInit){return[2]}u("====== ZONOS DEBUG MODE: on (".concat(E.version,") ======"));E.zonosApiKey=l;E.storeId=c;if(!E.isNpm)return[3,4];u("====== ZONOS LOADING FROM NPM ======");f=g();if(f&&!window.isZonosPreview){u('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(f," ======"),"info");v=document.createElement("script");v.src="".concat(f,"/dist/scripts/zonos.js");document.head.appendChild(v);v.addEventListener("load",(function(){window.Zonos.isNpm=E.isNpm;window.Zonos.isBigCommerce=E.isBigCommerce;window.Zonos.isLegacyCheckout=E.isLegacyCheckout;void window.Zonos.init(n)}));v.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(f))}));window.isZonosPreview=true;return[2]}if(!l&&!E.cartId){s("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!E.cartData&&E.cartId))return[3,2];u("Initialize cart data");return[4,F(E.cartId)];case 1:m=z.sent();if(!m){s("Failed to get cart data");return[2]}E.cartData=m.cartData;E.zonosApiKey=m.zonosApiKey;E.cartSettings=m.settings;z.label=2;case 2:return[4,h()];case 3:w=z.sent();if(w){E.zonosApiKey=w}z.label=4;case 4:p=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");y=E.cartId&&E.cartData||!!p;if(y){u("Cart data or stripe client secret is available, inject hidden button and trigger checkout");b=document.createElement("button");b.style.display="none";b.id="".concat(d);document.body.appendChild(b)}u("init zonos");E.restoreNativeBrowserFunctions();E.injectCustomScriptForHostedCheckout();E.injectZonosCdn();E.injectZonosCss();E.injectFonts();E.injectCheckoutInternationalButton();E.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:o,onCountryChange:i,overrideCurrencyFormat:a}});E.doneInit=true;return[2]}}))}))};V.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(l))){var n=document.createElement("button");n.id=l;n.style.display="none";document.body.appendChild(n)}};V.injectCustomScriptForHostedCheckout=function(){var n=E.cartData;var e=(n===null||n===void 0?void 0:n.metadata)||[];var t=e.find((function(n){return n.key==="customHeaderScript"}));var r=e.find((function(n){return n.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!t&&!r){u("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:t,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(t){u("Injecting custom header script");var o=document.createElement("script");o.textContent=t.value;document.head.appendChild(o)}if(r){u("Injecting custom footer script");var o=document.createElement("script");o.textContent=r.value;document.body.appendChild(o)}};V.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};V.triggerCheckoutInternational=function(){return __awaiter(f,void 0,void 0,(function(){var n;return __generator(this,(function(t){n=document.querySelector("#".concat(l));setTimeout((function(){if(n){n.dispatchEvent(e("click"))}}),10);return[2]}))}))};V.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};V.showNotification=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.showNotification(n))};V.updateOrganizationName=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};V.disablePlaceOrderButtons=function(n){var e=n.autoEnable,t=e===void 0?true:e,r=n.config,o=n.disable,i=n.placeOrderButtonSelector;var u;if((u=r.checkoutSettings)===null||u===void 0?void 0:u.disablePlaceOrderButtonActivation){return}if(i){var a=document.querySelectorAll(i);var s=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};a.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(o){n.setAttribute("disabled","true");n.addEventListener("click",s)}else{n.removeAttribute("disabled");n.removeEventListener("click",s)}}));if(t&&o){setTimeout((function(){a.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",s)}))}),5e3)}}};V.restoreNativeBrowserFunctions=function(){var n;var e=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(e){return}var t="zonos---native-browser";var r=document.querySelector("iframe#".concat(t));if(!r){r=document.createElement("iframe");r.id=t;r.style.display="none";r.style.opacity="0";r.style.position="absolute";r.style.top="-9999px";r.style.left="-9999px";r.style.width="1px";r.style.height="1px";r.style.border="none";r.style.overflow="hidden";r.style.visibility="hidden";document.body.appendChild(r)}var o=((n=r.contentWindow)===null||n===void 0?void 0:n.window.Array.from)||Array.from;Array.from=o;document.body.removeChild(r)};V.injectController=function(n){var e=n.config;var t,r;if(document.querySelector("zonos-controller")){return}if((t=e.checkoutSettings)===null||t===void 0?void 0:t.placeOrderButtonSelector){var o=e.checkoutSettings.placeOrderButtonSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:o})}));i.observe(document.body,{childList:true,subtree:true})}if((r=e.checkoutSettings)===null||r===void 0?void 0:r.alwaysTriggerInternationalCheckoutSelector){var a=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){E.disablePlaceOrderButtons({config:e,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=e;c.zonosApiKey=E.zonosApiKey||"";c.addEventListener("stripeInitEvent",(function(n){return __awaiter(f,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;u("loading Stripe");return[4,U(e.publishableKey)];case 1:t=r.sent();if(!t){s("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=t;void c.initCheckoutElement(t);return[2]}}))}))}));document.body.appendChild(c);E.zonosController=c;u("Zonos controller injected!")};V.injectScript=function(n){var e=n.cdnType,t=n.isModule,r=n.theRestUrl;var o=E.getZonosUrl(e);var i="".concat(o,"/").concat(r);var a=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(a()){u('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var c=document.head||document.body;var d=document.createElement("script");if(!!t){d.type="module"}else{d.noModule=true}d.src=i;d.crossOrigin="anonymous";d.onerror=function(){s("Failed to load ".concat(d.src));var n=p(e);if(!n){return}E.injectScript({cdnType:n,isModule:t,theRestUrl:r})};c.appendChild(d)};V.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return D;case"unpkg":return M;case"cdnjs":return x;case"vercel":return C}};if(E.isNpm){var t=g();return t||e()}return e()};V.injectZonosCdn=function(){E.injectScript({cdnType:w,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});E.injectScript({cdnType:w,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});u("Zonos cdn script injected!")};V.injectStylesheet=function(n){var e=n.cdnType,t=n.theRestUrl;var r=E.getZonosUrl(e);var o=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(C,"/");o.appendChild(i);var u=document.createElement("link");u.rel="stylesheet";u.href="".concat(r,"/").concat(t);u.onerror=function(){s("Failed to load ".concat(u.href));var n=p(e);if(!n){return}E.injectStylesheet({cdnType:n,theRestUrl:t})};o.appendChild(u)};V.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){u("Zonos style links already injected","warn");return}E.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"});u("Zonos style css injected!")};V.injectFonts=function(){var n=function(){var n=document.fonts.check("1em Inter");if(n){u("Inter font already loaded","warn");return}var e=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(G,'"]'));for(var t=0;t<e.length;t++){var r=e[t];if(!r){continue}if(B.test(r.href)){continue}return r}return null};if(n()){u("Inter font already injected","warn");return}var e=document.head||document.body;var t=document.createElement("link");t.rel="preconnect";t.href=G;e.appendChild(t);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(G,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");e.appendChild(r);u("Zonos font injected!")};V.setupGoogleFont=function(n){var e;void((e=E.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};V.injectSupportGoogleFont=function(n){var e;u("[FONT] injecting ".concat(n));var t=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(G,'"]'))){var o=document.createElement("link");o.rel="preconnect";o.href=G;r.appendChild(o)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){u("[FONT] ".concat(t," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);u("[FONT] ".concat(t," font injected!"))}}}}));