@zonos/elements 1.3.199 → 1.3.201
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-2e3968e9.js → cart-e73cde62.js} +77 -2
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{paypal-b5c80f16.js → paypal-39bbbd1a.js} +1 -1
- package/dist/cjs/zonos-address_11.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +4 -4
- package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +2 -2
- package/dist/collection/components/store/checkout/stripe.js +17 -2
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/esm/{cart-006b6633.js → cart-f79c8021.js} +77 -2
- package/dist/esm/index.js +7 -7
- package/dist/esm/{paypal-86483f34.js → paypal-6d4667d1.js} +1 -1
- package/dist/esm/zonos-address_11.entry.js +1 -1
- package/dist/esm/zonos-cart-items_13.entry.js +4 -4
- package/dist/esm/zonos-checkout.entry.js +2 -2
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/cart-f79c8021.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-86483f34.js → paypal-6d4667d1.js} +1 -1
- package/dist/esm-es5/zonos-address_11.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- 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-empty-state-payment_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-language-select_2.entry.js +1 -1
- 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/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-cd86baf3.entry.js → p-0302a254.entry.js} +1 -1
- package/dist/zonos-elements/{p-63135403.entry.js → p-1998d8b3.entry.js} +1 -1
- package/dist/zonos-elements/{p-76d6ddf4.system.js → p-20030bf5.system.js} +1 -1
- package/dist/zonos-elements/{p-3febb54a.entry.js → p-264f46a5.entry.js} +1 -1
- package/dist/zonos-elements/{p-06547c8c.system.entry.js → p-2c915112.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8558486d.entry.js → p-327aebf5.entry.js} +1 -1
- package/dist/zonos-elements/{p-1383ab6b.entry.js → p-4300d944.entry.js} +1 -1
- package/dist/zonos-elements/{p-bde07ab8.system.entry.js → p-49a31b14.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4cd867d5.js +1 -0
- package/dist/zonos-elements/{p-f57b0170.js → p-5de59662.js} +1 -1
- package/dist/zonos-elements/{p-9350f23a.entry.js → p-65a8f19d.entry.js} +1 -1
- package/dist/zonos-elements/{p-49e78ccc.system.entry.js → p-6cd9b6a1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e5d4705e.system.entry.js → p-7831b52c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7b1e8a42.entry.js → p-79070ee6.entry.js} +1 -1
- package/dist/zonos-elements/{p-c69c3219.system.js → p-7d5d89f2.system.js} +1 -1
- package/dist/zonos-elements/{p-81bf423c.system.entry.js → p-82aa4f9f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-76468d91.system.entry.js → p-8540f3e2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-670d7ffb.system.entry.js → p-932bed54.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0d5fe109.system.entry.js → p-b66b3306.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2abcaaa1.system.entry.js → p-d6c3aec8.system.entry.js} +1 -1
- package/dist/zonos-elements/p-daf73a4c.system.js +1 -0
- package/dist/zonos-elements/{p-c1173557.entry.js → p-de388ea0.entry.js} +1 -1
- package/dist/zonos-elements/{p-a35aab84.entry.js → p-e14d89de.entry.js} +1 -1
- package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
- package/dist/zonos-elements/{p-ddbeb2ec.entry.js → p-f818bdf5.entry.js} +1 -1
- package/dist/zonos-elements/{p-d319e084.system.entry.js → p-fce6bffe.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-006b6633.js +0 -1
- package/dist/zonos-elements/p-3bcf2091.system.js +0 -1
- package/dist/zonos-elements/p-63bfe67c.js +0 -1
|
@@ -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.199.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.199.js.zonos.com";var D=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.199";var M="https://unpkg.com/@zonos/elements@1.3.199";var x="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.199";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="1746824841287";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.199");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.201.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.201.js.zonos.com";var D=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.201";var M="https://unpkg.com/@zonos/elements@1.3.201";var x="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.201";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="1747060228170";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.201");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 +1 @@
|
|
|
1
|
-
import{r as o,h as e,H as t,F as s}from"./p-c137dc82.js";import{l as n,s as i,a as c,b as r,c as a,i as d,d as l,e as h,f as u,g as m,h as p,j as z,k as g,m as k,n as f,o as w,t as y,p as b,q as v,r as C,u as x,v as S,w as O,x as I,y as A,z as T,A as P,B as j,C as D,D as L,E as B}from"./p-63bfe67c.js";import{p as E,s as U,a as _,b as $}from"./p-f57b0170.js";import{z as N,g as R,m as H}from"./p-337fab4e.js";import{h as M,l as Z,b as F,s as W,c as K,d as G,e as V,g as q,j as Y,a as Q,i as J}from"./p-0fc02cde.js";import{c as X}from"./p-b4b7f705.js";import{c as oo}from"./p-595f5dd2.js";import{g as eo}from"./p-b8d87932.js";import{i as to}from"./p-4593324c.js";import{s as so}from"./p-96d77739.js";import{_ as no,c as io,a as co,d as ro}from"./p-3f1a2d31.js";import{R as ao}from"./p-08e7107d.js";const lo=o=>{const e=o.items.map((o=>({amount:o.amount,attributes:o.attributes||[],countryOfOrigin:o.countryOfOrigin||void 0,currencyCode:o.currencyCode,description:o.description||"",imageUrl:o.imageUrl||"",itemType:o.itemType||"PHYSICAL_GOOD",measurements:o.measurements||[],name:o.name||o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""})))||[];return{adjustments:o.adjustments,cartItems:e}},ho=(o=!0)=>!(!n.localizationLoaded||!n.isShippableCountry&&(o&&Z("Checkout: not shippable country"),1));let uo=0;const mo=async({cartId:o,retries:e})=>{const t=q(),{errors:s,json:n}=await M("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:!0},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),i=!n||s.length;return i&&e?(Z("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),mo({cartId:o,retries:e-1})):i?null:n},po='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n',zo=class{constructor(e){o(this,e),this.onChangeLocaleListener=()=>{},this.isRedirectAfterOrder=!1,this.applyStripeTheme=async()=>{var o,e,t,s;const n=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||N.appearance.theme;await d({overrideBorderRadius:null===(e=this.appearanceSettingsOverride)||void 0===e?void 0:e.style,overridePrimaryColor:null===(t=this.appearanceSettingsOverride)||void 0===t?void 0:t.colorPrimary,overrideSecondaryColor:null===(s=this.appearanceSettingsOverride)||void 0===s?void 0:s.colorSecondary,overrideTheme:this.isMobile?n:void 0,paypalEnabled:E()})},this.checkStripePaymentIntentStatus=async({triggeredButton:o})=>{const e=null==o?void 0:o.matches(`#${io}`),t=!!window.Zonos.cartData,s=new URL(window.location.href).searchParams,n=s.get("payment_intent_client_secret"),i=s.get("zonosCheckoutSessionId");if(!e)return Z("Checkout is triggered by user, no need to check stripe payment intent status"),{shouldAllowOrder:!0};if(Z("Payment intent exist, checking stripe payment intent status"),!n)return Z("No stripe client secret found in the URL, proceed to order if cart data is available"),{shouldAllowOrder:t};const{error:c,status:r}=await l({clientSecret:n});return new URLSearchParams(window.location.search).get("redirect_status")?(Z(c?"Payment intent failed, show status from error":"Payment intent is succeeded or in a good state to move forward, show success screen"),this.open=!0,h.checkoutSessionId=i,u.clientSecret=n,this.setToFinishStep(r),{shouldAllowOrder:!1}):t?(Z("Payment intent is not succeeded, proceed to order"),{shouldAllowOrder:!0}):(Z("Cart data is not available, only check payment intent status, skip order."),{shouldAllowOrder:!1})},this.formatDate=o=>o?new Date(o).toLocaleDateString():"",this.formatTime=o=>o?new Date(o).toLocaleTimeString():"",this.getCurrentLocalePageEnum=()=>{switch(h.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}},this.getBaseCurrencySettlementInfo=()=>{const o=h.selectedLandedCost;if(!o)return null;const{landedCost:{amountSubtotals:e}}=o;return e?{settlementAmount:(e.discounts||0)+e.items+e.landedCostTotal+e.shipping}:null},this.getDefaultAddress=()=>this.defaultCustomerProfileAddress.length?this.defaultCustomerProfileAddress:Array.isArray(this.defaultAddress)&&this.defaultAddress.length?this.defaultAddress:Array.isArray(this.defaultAddress)||"object"!=typeof this.defaultAddress?this.defaultAddressParams:[this.defaultAddress],this.appearanceSettingsOverride=void 0,this.preview=!1,this.hiddenMode=!1,this.mobile=!1,this.overrideStagingMode=void 0,this.defaultAddress=[],this.forceDialogOpen=!1,this.defaultAddressParams=[],this.defaultCustomerProfileAddress=[],this.customerProfile=null,this.open=this.forceDialogOpen,this.stripe=window.Zonos.stripe,this.submitLoading=!1,this.collapseReviewMobile=!0,this.isAttachError=!1,this.isMobile=!1,this.isIframed=!1,this.zonosReviewRef=void 0,this.storybookPaymentStatusOverride=void 0,this.isLegacyCheckout=window.Zonos.isLegacyCheckout,this.confirmDialogOpen=!1,this.isCartExpired=!1,this.payInUsdConfirmDialogOpen=!1,this.inventoryCheckErrorMessage=null,this.placedOrderInfo=null,this.clientSecret=u.clientSecret,this.stripeCustomerSessionClientSecret=u.stripeCustomerSessionClientSecret}async initCartInfoHandler(o){m({adjustments:h.adjustments,cartItems:o.detail})}async handleKeyPress(o){"Escape"===o.key&&this.closeDialogHandler()}async closeDialogHandler(o){var e,t;this.open&&((null==o?void 0:o.confirmed)?(this.confirmDialogOpen=!1,U("zonos-checkout-close"),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==h.step||p(),h.step="customer-info",z(),g(),null===(t=(e=N.checkoutSettings).onClose)||void 0===t||t.call(e)):this.confirmDialogOpen=!0)}async buildCartAndInit(){if("function"==typeof N.checkoutSettings.createCartId){Z('"createCartId" is provided, start building cart');const o=await N.checkoutSettings.createCartId();let e;"object"==typeof o?(Z("object detected, use cartId and prefill address from createCartId"),e=o.cartId,this.useShippingDataFromCreateCartId(o.shippingData),h.customerAuthenticationToken=o.customerAuthenticationToken||null):e=o,window.Zonos.cartId=e;const t=await(async o=>{const{isDgsCartId:e,isLegacyCartId:t}=no(o);if(!t&&!e)return F("[ZONOS - loadZonos] invalid cart id"),null;const s=await mo({cartId:o,retries:5});return Z("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(F("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(e),s=null==t?void 0:t.cartData;if(!s)return F("Failed to build cart, please try again."),!1;window.Zonos.cartData=s;const{adjustments:n,cartItems:i}=lo(s);await m({adjustments:n,cartItems:i})}else if(window.Zonos.cartData){Z("tempCartUUID is provided, start building cart");const{adjustments:o,cartItems:e}=lo(window.Zonos.cartData);await m({adjustments:o,cartItems:e})}else if(N.checkoutSettings.buildCartDetail&&n.selectedCountryCode){Z("build cart detail");const o=await N.checkoutSettings.buildCartDetail({countryCode:n.selectedCountryCode,currencyCode:n.targetCurrency}),e=o.filter((o=>o.amount>=0)),t=o.filter((o=>o.amount<0)).map((o=>({amount:o.amount,currencyCode:o.currencyCode,description:o.name||o.description||"",productId:o.productId||null,sku:o.sku||null,type:"CART_TOTAL"})));await m({adjustments:t,cartItems:e})}if(!h.checkoutSessionId){const o=await k();if(Z(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}return h.isStagingMode||f(),await this.applyStripeTheme(),this.isRedirectAfterOrder="REDIRECT_TO_SUCCESS_PAGE"===N.checkoutSettings.successBehavior||!!h.externalConfirmationPageURL,!0}reloadCheckoutSession(){window.location.reload()}handleOrderDuplication(){const o=Y(localStorage.getItem("zonos--placed-order-info"));if(!o)return void localStorage.removeItem("zonos--placed-order-info");const e=Date.now()-o.time;Z(`=== Existing placed order info: ${o.orderId} - ${this.formatDate(o.time)} - elapsed in hh:ss format: ${new Date(e).toISOString().substring(11,8)}`,"warn");const t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||216e5;if(e>t)return Z(`=== Existing placed order info is older than ${t}ms, cleaning localStorage`,"warn"),void localStorage.removeItem("zonos--placed-order-info");this.placedOrderInfo=o,Z("=== Showing order duplication confirmation","warn")}confirmProceedWithOrderDuplication(){this.placedOrderInfo=null,h.checkoutSessionId&&M("/api/zonos-elements/update-checkout-session-metadata",{body:{id:h.checkoutSessionId,metadata:[{key:"orderDuplicationConsent",value:"1"}]},method:"POST"})}handleCancelOrderDuplication(){var o;if(this.placedOrderInfo=null,this.isLegacyCheckout){const e=(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||N.onlineStoreSettings.url;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}this.closeDialogHandler({confirmed:!0})}attachCheckout(){const o=N.checkoutSettings.placeOrderButtonSelector,e=N.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;if(Z(`attach checkout ${o}`),Z(`attach checkout to always trigger international checkout selector: ${e}`),!o&&!e&&!window.Zonos.cartData)return;const t=[o,e,`#${ro}`,`#${io}`,`#${co}`].filter(Boolean);document.querySelectorAll(t.join(",")).forEach((t=>{t.getAttribute("data-zonos-checkout-attached")||(Z(`attached event to button ${o}`,"info",{button:t}),t.addEventListener("click",(async o=>{var s;const i=performance.now(),c=e&&t.matches(e),r=t.matches(`#${co}`),a=t.matches(`#${ro}`)||t.matches(`#${io}`);if(!window.Zonos.isLegacyCheckout&&(!ho()||((o=!0)=>!n.localizationLoaded||!!n.isDisabledCountry&&(o&&Z("Checkout: disabled country"),!0))())&&!c&&!r&&!a)return;o.preventDefault(),o.stopPropagation(),Z("zonos checkout button clicked");const{shouldAllowOrder:d}=await this.checkStripePaymentIntentStatus({triggeredButton:o.target});if(d){window.Zonos.logIntervalId||(window.Zonos.logIntervalId=setInterval((()=>{(async()=>{if(0===window.Zonos.loadTimeApiInfoList.length)return;Z("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});const o={data:[...window.Zonos.loadTimeApiInfoList],storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;const{errors:e}=await M("/api/zonos-elements/log-bulk-load-data",{body:o,method:"POST"});e.length&&(window.Zonos.loadTimeApiInfoList.push(...o.data),uo++,uo>5&&window.Zonos.logIntervalId&&clearInterval(window.Zonos.logIntervalId))})()}),2e3)),u.isFetchingSession=!0,this.open=!0;try{if(!await this.buildCartAndInit())throw new Error("Error building cart");w({isPreview:this.preview,sessionTimeout:54e5}),U("zonos-checkout-start"),y({checkoutSessionId:h.checkoutSessionId,eventName:"checkout_open"});const{enabled:o}=await(async()=>{const{errors:o,json:e}=await M("/api/zonos-elements/get-store-discount-enabled-status");return o.length||!(null==e?void 0:e.enabled)?{enabled:!1}:{enabled:!0}})();if(h.shouldHideDiscountInput=!o,this.handleOrderDuplication(),window.Zonos.isLegacyCheckout)(async()=>{const{elapsedTime:o}=K(),e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:G},V()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};M("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})();else{(async({loadTime:o})=>{const e={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:G},V()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};M("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})({loadTime:performance.now()-i})}}catch(o){if(o instanceof Error&&"Cart is expired."===o.message)return void(this.isCartExpired=!0);if(u.isFetchingSession=!1,F(o),this.isCartExpired)return;W({endpoint:"Error creating Checkout",errors:[o instanceof Error?o.toString():"Unknown error"],metadata:{allLogs:G,cartId:window.Zonos.cartId,checkoutSessionBody:b(),href:window.location.href,storeBaseUrl:(null===(s=window.Zonos.cartData)||void 0===s?void 0:s.storeBaseUrl)||N.onlineStoreSettings.url}}),v({messages:[C("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:C("Error creating Checkout")})}}}),{capture:!0,passive:!1}),N.checkoutSettings.disablePlaceOrderButtonActivation||t.removeAttribute("disabled"),t.setAttribute("data-zonos-checkout-attached","true"),t.matches(`#${ro}`)&&(t.dispatchEvent(oo("click")),r(),t.remove()),t.matches(`#${io}`)&&(t.dispatchEvent(oo("click")),t.remove()))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}useShippingDataFromCreateCartId(o){if(!o)return;Z("shipping data from createCartId result","info",Object.entries(o));const{customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:i,customerEmail:c,customerName:r,customerPhone:a,customerState:d,customerZip:l}=o,h=new URLSearchParams(window.location.search),u=i||x(h)||n.selectedCountryCode;this.applyPrefillAddress({customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:u,customerEmail:c,customerName:r,customerPhone:a,customerState:d,customerZip:l})}useLegacyQueryParams(){const o=new URLSearchParams(window.location.search);Z("legacy urlParams","info",Object.fromEntries(o.entries()));const e=e=>{const t=o.get(e);return t&&"undefined"!==t?t:null},t=x(o)||n.selectedCountryCode,s=e("customerCity"),i=e("customerEmail"),c=e("customerAddress1"),r=e("customerAddress2"),a=e("customerName"),d=e("customerPhone"),l=e("customerZip"),h=e("customerState");this.applyPrefillAddress({customerAddress1:c,customerAddress2:r,customerCity:s,customerCountry:t,customerEmail:i,customerName:a,customerPhone:d,customerState:h,customerZip:l})}applyPrefillAddress(o){const e=o.customerAddress1||"",t=o.customerCountry||"",s=o.customerAddress2||"",i=o.customerCity||"",c=o.customerEmail||"",r=o.customerName||"",a=o.customerPhone||"",d=o.customerZip||"",l=o.customerState||"";e&&r&&a&&t?t&&n.shippingZoneCountries&&!(t in n.shippingZoneCountries)?Z(`Country "${t}" is not in the shipping zone, so it can not be prefilled`,"warn"):(this.defaultAddressParams=[{address:{city:i||"",country:t,line1:e,line2:s,postal_code:d,state:l},email:c,name:r,phone:a}],Z("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:o})):Z("Missing required query params so it can not be prefilled","info",[!e&&"line1",!r&&"name",!a&&"phone",!t&&"country"].filter(Boolean).join(", "))}overrideStagingModeChanged(){h.isStagingMode=!!this.overrideStagingMode}async init(){u.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,h.isStagingMode=Q(),void 0!==this.overrideStagingMode&&(h.isStagingMode=this.overrideStagingMode),(({domesticRedirectedBtnSelector:o,onShippingAddressSessionFound:e})=>{if(!window.Zonos.isBigCommerce)return;const t=new MutationObserver((async()=>{const s=document.querySelector(o),n=i();if(!s&&n){const o=document.createElement("button");return o.style.display="none",o.id="zonos--domestic-redirected-checkout-button",document.body.appendChild(o),null==e||e(n),void t.disconnect()}const d=document.querySelector('select[name="shippingAddress.countryCode"]'),l=document.querySelector("#checkout-shipping-continue");d&&l&&(t.disconnect(),l.addEventListener("click",(async o=>{var e,t;const s=d.value;if(!s)return;if(c(s),!ho(!1))return void r();const n=document.querySelector("form");if(!n)return;const i=new FormData(n),l=document.querySelector("input#addressLine1Input"),h={address1:null!==(e=i.get("shippingAddress.address1"))&&void 0!==e?e:l&&l.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:null!==(t=i.get("shippingAddress.stateOrProvince"))&&void 0!==t?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(h).some((o=>null==o)))return F("One or more shipping address field is missing",Object.entries(h)),void W({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(h))],metadata:{storeId:N.storeId}});a({address1:h.address1,address2:h.address2,city:h.city,countryCode:h.countryCode,firstName:h.firstName,lastName:h.lastName,phone:h.phone,postalCode:h.postalCode,state:h.stateOrProvince}),o.preventDefault(),o.stopPropagation(),window.location.href="/"})))}));t.observe(document.body,{childList:!0,subtree:!0})})({domesticRedirectedBtnSelector:ro,onShippingAddressSessionFound:o=>{this.defaultAddress=[{address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:`${o.firstName} ${o.lastName}`,phone:o.phone}]}}),window.Zonos&&this.useLegacyQueryParams();const o=setInterval((()=>{u.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(Z("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():window.Zonos.isLegacyCheckout?this.attachCheckout():window&&(this.attachCheckout(),new MutationObserver((()=>{this.attachCheckout()})).observe(document.body,{childList:!0,subtree:!0}))),clearInterval(o)):Z("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(o)}),1e4)}async setToFinishStep(o){h.step="finish",this.storybookPaymentStatusOverride=o}async mockCheckoutSession(o){S(o)}async triggerCheckoutInternational(){const o=document.querySelector(`#${co}`);o&&o.dispatchEvent(oo("click"))}async handleCustomerInfoContinue(){U("zonos-checkout-customer-info"),y({checkoutSessionId:h.checkoutSessionId,eventName:"checkout_customerInfoCompleted"}),this.submitLoading=!0,await O();const o=setInterval((()=>{!h.landedCostData&&u.isFetchingLandedCost||(h.landedCostData&&(_({currency:h.currency}),I()),this.submitLoading=!1,clearInterval(o))}),500)}async handleShippingContinue(){this.submitLoading=!0,setTimeout((()=>{I(),this.submitLoading=!1}),500)}handleInventoryCheckDialogConfirm(){h.inventoryCheckErrorMessage=null,this.isLegacyCheckout||this.closeDialogHandler({confirmed:!0})}handleCartExpiredDialogConfirm(){var o;if(this.isCartExpired=!1,this.isLegacyCheckout){const e=null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}window.parent&&(window.parent.location.href=window.location.href),window.location.reload()}async handleStripePaymentContinue(){if("USD"!==u.checkoutSettlementCurrency||!u.shouldRenderPayInUsdButton||this.payInUsdConfirmDialogOpen){if(this.payInUsdConfirmDialogOpen=!1,$.paypalErrorMessage=null,u.hasPaymentError=!1,this.submitLoading=!0,h.inventoryCheckErrorMessage=null,!await A())return u.hasPaymentError=!0,u.customErrorMessage=C("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:u.checkoutSettlementCurrency}),void(this.submitLoading=!1);try{h.inventoryCheckErrorMessage=await T()}catch(o){h.inventoryCheckErrorMessage=C("Unable to check inventory. Please try again.")}if(h.inventoryCheckErrorMessage)this.submitLoading=!1;else{try{await P(),I(),g()}catch(o){F(o),U("zonos-checkout-payment-fail"),u.hasPaymentError=!0,u.shouldInventoryRefund&&(j(),u.shouldInventoryRefund=!1)}this.submitLoading=!1}}else this.payInUsdConfirmDialogOpen=!0}async handleFinishClick(){if(D(),this.preview)return h.step="customer-info",void await this.init();if(p(),window.Zonos.isLegacyCheckout&&window.Zonos.cartData){const o=window.Zonos.cartData.storeBaseUrl||N.onlineStoreSettings.url;return window.parent&&(window.parent.location.href=o),void(window.location.href=o)}const o=window.location.href.split("?")[0];this.open=!1,window.location.hostname.includes("dashboard.zonos.com")||(window.history.replaceState(window.history.state,document.title,o),window.location.reload())}handleWindowResize(){this.isMobile=J(this.mobile),this.applyStripeTheme(),Z(`mobile: ${this.isMobile}`)}handleMobileChange(){this.isMobile=J(this.mobile),this.applyStripeTheme(),Z(`mobile: ${this.isMobile}`)}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=R(this.appearanceSettingsOverride.theme))}handleAddressChange(){D()}handleCustomerProfileChange(){var o,e;if(!this.customerProfile)return Z("No customer profile","info"),void(this.defaultCustomerProfileAddress=[]);Z("Customer profile found","info",{customerProfile:this.customerProfile}),this.defaultCustomerProfileAddress=(null===(e=null===(o=u.customerProfile)||void 0===o?void 0:o.locations)||void 0===e?void 0:e.map((o=>{var e;return{address:{city:o.locality,country:o.countryCode,line1:o.line1,line2:o.line2||"",postal_code:o.postalCode,state:o.administrativeArea},email:o.email||(null===(e=u.customerProfile)||void 0===e?void 0:e.email)||"",name:o.name||"",phone:o.phone||""}})))||[]}handleClientSecretChange(){Z("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret}),this.applyStripeTheme()}handleOpenChange(){const o="data-zonos-overflow-origin",e=document.body,t=document.documentElement;if(this.open)e.style.overflow&&e.setAttribute(o,e.style.overflow),e.style.overflow="hidden",t.style.overflow&&t.setAttribute(o,t.style.overflow),t.style.overflow="hidden";else{this.stripeCustomerSessionClientSecret=null;const s=e.getAttribute(o),n=t.getAttribute(o);s?(e.removeAttribute(o),e.style.overflow=s):e.style.removeProperty("overflow"),n?(t.removeAttribute(o),t.style.overflow=n):t.style.removeProperty("overflow")}}componentWillLoad(){this.init(),this.isMobile=J(this.mobile),this.isIframed=window.self!==window.top,Z(`iframed: ${this.isIframed}`),this.handleAppearanceSettingsOverrideChange(),this.onChangeLocaleListener=L("selectedLocale",(()=>{this.applyStripeTheme()})),Z(`mobile: ${this.isMobile}`)}disconnectedCallback(){D(),p(),this.onChangeLocaleListener()}render(){var o,i,c,r;this.customerProfile=u.customerProfile,this.clientSecret=u.clientSecret,u.stripeCustomerSessionClientSecret&&(this.stripeCustomerSessionClientSecret=u.stripeCustomerSessionClientSecret);const a="finish"!==h.step&&"error"!==h.step&&!u.stripeElements||u.isFetchingSession,{colorPrimary:d,colorSecondary:l,logoUrl:m,style:p}=H(N.appearance,this.appearanceSettingsOverride||null),z="ENABLED"===N.appearance.zonosAttribution,g=N.appearance.theme,k=d&&to(d)?"DARK":"LIGHT",f=this.isMobile?g:k,w=this.isMobile?void 0:l,{customMessages:y}=n,b=null===(o=y.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message,v=this.getCurrentLocalePageEnum(),x=y.filter((o=>o.pageName===v)),S=this.getBaseCurrencySettlementInfo(),O=()=>{const o=this.preview?`${m}?timestamp=${Date.now()}`:m;return e("div",{class:"zonos--logo"},o&&e("img",{alt:`${N.organizationName} logo`,src:o}))},I=q(),A=()=>{const o=new URLSearchParams(window.location.search),t=o.get("zonosQaUrl"),s=o.get("zonosDebug"),n=o.get("zonosE2ETest"),i=this.overrideStagingMode||Q();return e("zonos-v-stack",null,e("div",{class:"zonos--logo-wrapper"},O(),I&&e("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),i&&e("zonos-badge",{badgeColor:"red",size:"small"},C("Staging mode")),"1"===s&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t),n&&e("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),e("zonos-checkout-progress-tabs",{backgroundColor:this.isMobile?"--zonos-elements-gray-0":null}),x.map((o=>e("zonos-custom-message",{icon:po,message:o.message}))))},T=()=>h.checkoutSessionTimeoutShow?e("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:C("Your checkout session has expired. Please reload the page to continue."),restStateTitle:C("Session timed out"),restStateType:"Warning"},e("zonos-button",{onClick:()=>this.reloadCheckoutSession(),variant:"primary"},C("Reload"))):e("div",{class:"zonos--content",style:{"--zonos--border-radius":eo({overrideBorderStyle:p})}},"finish"!==h.step&&"error"!==h.step&&e(s,null,e("div",{class:"zonos--left","data-theme":f,style:so({"--zonos--primary-color":this.isMobile?void 0:d})},!this.isMobile&&A(),"customer-info"===h.step&&e("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.getDefaultAddress(),isMobile:this.isMobile,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:w}),"shipping"===h.step&&e("zonos-shipping",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:w}),"payment"===h.step&&e("zonos-checkout-payment",{continueLoading:this.submitLoading,isMobile:this.isMobile,onContinueClicked:async()=>{await this.handleStripePaymentContinue()},submitBtnColor:w})),e("div",{class:"zonos--right","data-theme":g},this.isMobile&&A(),e("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&e("zonos-currency-toggle",null),!this.isLegacyCheckout&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:ao}),noBackground:!0,onClick:()=>this.closeDialogHandler()})),e("div",{class:"flex--wrapper"},e("div",{class:"zonos--wrapper"},e("zonos-review",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onClick:()=>{this.isMobile&&(this.collapseReviewMobile=!this.collapseReviewMobile)}}),e("zonos-collapse",{collapsed:this.collapseReviewMobile&&this.isMobile},e("zonos-cart-items",null),this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",{submitBtnColor:w}),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:po,message:b})))),e("zonos-cart-restricted-items",null),!this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",null),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:po,message:b}))))),("finish"===h.step||"error"===h.step)&&e("div",{class:"zonos--done","data-theme":g},e("div",{class:"zonos--header"},O(),!this.isRedirectAfterOrder&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:ao}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:g})),e("zonos-checkout-finish",{borderRadius:p,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===h.step&&h.error?Object.assign(Object.assign({},h.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),e("zonos-checkout-footer",{"data-theme":g,mobile:this.isMobile,slot:this.isMobile?void 0:"dialog-footer"}));return e(t,{class:X(["zonos--checkout zonos--elements",z&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?T():e("zonos-dialog",{borderStyle:p,"data-theme":g,height:"980px",isLoading:a,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},T()),e("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:C("Don't close"),dialogConfirmBtnText:C("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:C("Would you like to close checkout and return to the site?"),dialogTitle:C("Are you sure?"),onCancelClicked:()=>{this.confirmDialogOpen=!1},onConfirmClicked:()=>this.closeDialogHandler({confirmed:!0})}),e("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:C("Return to merchant site"),dialogConfirmBtnText:C("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:(null===(i=this.placedOrderInfo)||void 0===i?void 0:i.zonosOrderNumber)?C("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):C("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate((null===(c=this.placedOrderInfo)||void 0===c?void 0:c.time)||null),time:this.formatTime((null===(r=this.placedOrderInfo)||void 0===r?void 0:r.time)||null)}),dialogTitle:C("Are you sure?"),dialogWidth:530,onCancelClicked:()=>{this.handleCancelOrderDuplication()},onConfirmClicked:()=>{this.confirmProceedWithOrderDuplication()}}),e("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:C("Return to cart"),dialogIntent:"danger",dialogOpen:!!h.inventoryCheckErrorMessage,dialogSubtitle:h.inventoryCheckErrorMessage,dialogTitle:C("Couldn't place order"),dialogType:"alert",onConfirmClicked:()=>this.handleInventoryCheckDialogConfirm()}),S&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:B({amount:S.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:()=>{this.payInUsdConfirmDialogOpen=!1},onConfirmClicked:()=>this.handleStripePaymentContinue()}),e("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:C("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:C("You are being sent back to the shop to re-add items to your cart."),dialogTitle:C("Shopping cart expired"),dialogType:"alert",onConfirmClicked:()=>this.handleCartExpiredDialogConfirm()}))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}}};zo.style=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";export{zo as zonos_checkout}
|
|
1
|
+
import{r as o,h as e,H as t,F as s}from"./p-c137dc82.js";import{l as n,s as i,a as c,b as r,c as a,i as d,d as l,e as h,f as u,g as m,h as p,j as z,k as g,m as k,n as f,o as w,t as y,p as b,q as v,r as C,u as x,v as S,w as O,x as I,y as A,z as T,A as P,B as j,C as D,D as L,E as B}from"./p-4cd867d5.js";import{p as E,s as U,a as _,b as $}from"./p-5de59662.js";import{z as N,g as R,m as H}from"./p-337fab4e.js";import{h as M,l as Z,b as F,s as W,c as K,d as G,e as V,g as q,j as Y,a as Q,i as J}from"./p-0fc02cde.js";import{c as X}from"./p-b4b7f705.js";import{c as oo}from"./p-595f5dd2.js";import{g as eo}from"./p-b8d87932.js";import{i as to}from"./p-4593324c.js";import{s as so}from"./p-96d77739.js";import{_ as no,c as io,a as co,d as ro}from"./p-3f1a2d31.js";import{R as ao}from"./p-08e7107d.js";const lo=o=>{const e=o.items.map((o=>({amount:o.amount,attributes:o.attributes||[],countryOfOrigin:o.countryOfOrigin||void 0,currencyCode:o.currencyCode,description:o.description||"",imageUrl:o.imageUrl||"",itemType:o.itemType||"PHYSICAL_GOOD",measurements:o.measurements||[],name:o.name||o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""})))||[];return{adjustments:o.adjustments,cartItems:e}},ho=(o=!0)=>!(!n.localizationLoaded||!n.isShippableCountry&&(o&&Z("Checkout: not shippable country"),1));let uo=0;const mo=async({cartId:o,retries:e})=>{const t=q(),{errors:s,json:n}=await M("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,options:{noOnlineStoreSettings:!0},tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),i=!n||s.length;return i&&e?(Z("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),mo({cartId:o,retries:e-1})):i?null:n},po='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n',zo=class{constructor(e){o(this,e),this.onChangeLocaleListener=()=>{},this.isRedirectAfterOrder=!1,this.applyStripeTheme=async()=>{var o,e,t,s;const n=(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)||N.appearance.theme;await d({overrideBorderRadius:null===(e=this.appearanceSettingsOverride)||void 0===e?void 0:e.style,overridePrimaryColor:null===(t=this.appearanceSettingsOverride)||void 0===t?void 0:t.colorPrimary,overrideSecondaryColor:null===(s=this.appearanceSettingsOverride)||void 0===s?void 0:s.colorSecondary,overrideTheme:this.isMobile?n:void 0,paypalEnabled:E()})},this.checkStripePaymentIntentStatus=async({triggeredButton:o})=>{const e=null==o?void 0:o.matches(`#${io}`),t=!!window.Zonos.cartData,s=new URL(window.location.href).searchParams,n=s.get("payment_intent_client_secret"),i=s.get("zonosCheckoutSessionId");if(!e)return Z("Checkout is triggered by user, no need to check stripe payment intent status"),{shouldAllowOrder:!0};if(Z("Payment intent exist, checking stripe payment intent status"),!n)return Z("No stripe client secret found in the URL, proceed to order if cart data is available"),{shouldAllowOrder:t};const{error:c,status:r}=await l({clientSecret:n});return new URLSearchParams(window.location.search).get("redirect_status")?(Z(c?"Payment intent failed, show status from error":"Payment intent is succeeded or in a good state to move forward, show success screen"),this.open=!0,h.checkoutSessionId=i,u.clientSecret=n,this.setToFinishStep(r),{shouldAllowOrder:!1}):t?(Z("Payment intent is not succeeded, proceed to order"),{shouldAllowOrder:!0}):(Z("Cart data is not available, only check payment intent status, skip order."),{shouldAllowOrder:!1})},this.formatDate=o=>o?new Date(o).toLocaleDateString():"",this.formatTime=o=>o?new Date(o).toLocaleTimeString():"",this.getCurrentLocalePageEnum=()=>{switch(h.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}},this.getBaseCurrencySettlementInfo=()=>{const o=h.selectedLandedCost;if(!o)return null;const{landedCost:{amountSubtotals:e}}=o;return e?{settlementAmount:(e.discounts||0)+e.items+e.landedCostTotal+e.shipping}:null},this.getDefaultAddress=()=>this.defaultCustomerProfileAddress.length?this.defaultCustomerProfileAddress:Array.isArray(this.defaultAddress)&&this.defaultAddress.length?this.defaultAddress:Array.isArray(this.defaultAddress)||"object"!=typeof this.defaultAddress?this.defaultAddressParams:[this.defaultAddress],this.appearanceSettingsOverride=void 0,this.preview=!1,this.hiddenMode=!1,this.mobile=!1,this.overrideStagingMode=void 0,this.defaultAddress=[],this.forceDialogOpen=!1,this.defaultAddressParams=[],this.defaultCustomerProfileAddress=[],this.customerProfile=null,this.open=this.forceDialogOpen,this.stripe=window.Zonos.stripe,this.submitLoading=!1,this.collapseReviewMobile=!0,this.isAttachError=!1,this.isMobile=!1,this.isIframed=!1,this.zonosReviewRef=void 0,this.storybookPaymentStatusOverride=void 0,this.isLegacyCheckout=window.Zonos.isLegacyCheckout,this.confirmDialogOpen=!1,this.isCartExpired=!1,this.payInUsdConfirmDialogOpen=!1,this.inventoryCheckErrorMessage=null,this.placedOrderInfo=null,this.clientSecret=u.clientSecret,this.stripeCustomerSessionClientSecret=u.stripeCustomerSessionClientSecret}async initCartInfoHandler(o){m({adjustments:h.adjustments,cartItems:o.detail})}async handleKeyPress(o){"Escape"===o.key&&this.closeDialogHandler()}async closeDialogHandler(o){var e,t;this.open&&((null==o?void 0:o.confirmed)?(this.confirmDialogOpen=!1,U("zonos-checkout-close"),this.open=this.forceDialogOpen||!1,this.preview||"finish"!==h.step||p(),h.step="customer-info",z(),g(),null===(t=(e=N.checkoutSettings).onClose)||void 0===t||t.call(e)):this.confirmDialogOpen=!0)}async buildCartAndInit(){if("function"==typeof N.checkoutSettings.createCartId){Z('"createCartId" is provided, start building cart');const o=await N.checkoutSettings.createCartId();let e;"object"==typeof o?(Z("object detected, use cartId and prefill address from createCartId"),e=o.cartId,this.useShippingDataFromCreateCartId(o.shippingData),h.customerAuthenticationToken=o.customerAuthenticationToken||null):e=o,window.Zonos.cartId=e;const t=await(async o=>{const{isDgsCartId:e,isLegacyCartId:t}=no(o);if(!t&&!e)return F("[ZONOS - loadZonos] invalid cart id"),null;const s=await mo({cartId:o,retries:5});return Z("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(F("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(e),s=null==t?void 0:t.cartData;if(!s)return F("Failed to build cart, please try again."),!1;window.Zonos.cartData=s;const{adjustments:n,cartItems:i}=lo(s);await m({adjustments:n,cartItems:i})}else if(window.Zonos.cartData){Z("tempCartUUID is provided, start building cart");const{adjustments:o,cartItems:e}=lo(window.Zonos.cartData);await m({adjustments:o,cartItems:e})}else if(N.checkoutSettings.buildCartDetail&&n.selectedCountryCode){Z("build cart detail");const o=await N.checkoutSettings.buildCartDetail({countryCode:n.selectedCountryCode,currencyCode:n.targetCurrency}),e=o.filter((o=>o.amount>=0)),t=o.filter((o=>o.amount<0)).map((o=>({amount:o.amount,currencyCode:o.currencyCode,description:o.name||o.description||"",productId:o.productId||null,sku:o.sku||null,type:"CART_TOTAL"})));await m({adjustments:t,cartItems:e})}if(!h.checkoutSessionId){const o=await k();if(Z(`stripeStoreInitCheckoutSession: ${o}`),!o)return!1}return h.isStagingMode||f(),await this.applyStripeTheme(),this.isRedirectAfterOrder="REDIRECT_TO_SUCCESS_PAGE"===N.checkoutSettings.successBehavior||!!h.externalConfirmationPageURL,!0}reloadCheckoutSession(){window.location.reload()}handleOrderDuplication(){const o=Y(localStorage.getItem("zonos--placed-order-info"));if(!o)return void localStorage.removeItem("zonos--placed-order-info");const e=Date.now()-o.time;Z(`=== Existing placed order info: ${o.orderId} - ${this.formatDate(o.time)} - elapsed in hh:ss format: ${new Date(e).toISOString().substring(11,8)}`,"warn");const t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||216e5;if(e>t)return Z(`=== Existing placed order info is older than ${t}ms, cleaning localStorage`,"warn"),void localStorage.removeItem("zonos--placed-order-info");this.placedOrderInfo=o,Z("=== Showing order duplication confirmation","warn")}confirmProceedWithOrderDuplication(){this.placedOrderInfo=null,h.checkoutSessionId&&M("/api/zonos-elements/update-checkout-session-metadata",{body:{id:h.checkoutSessionId,metadata:[{key:"orderDuplicationConsent",value:"1"}]},method:"POST"})}handleCancelOrderDuplication(){var o;if(this.placedOrderInfo=null,this.isLegacyCheckout){const e=(null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl)||N.onlineStoreSettings.url;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}this.closeDialogHandler({confirmed:!0})}attachCheckout(){const o=N.checkoutSettings.placeOrderButtonSelector,e=N.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;if(Z(`attach checkout ${o}`),Z(`attach checkout to always trigger international checkout selector: ${e}`),!o&&!e&&!window.Zonos.cartData)return;const t=[o,e,`#${ro}`,`#${io}`,`#${co}`].filter(Boolean);document.querySelectorAll(t.join(",")).forEach((t=>{t.getAttribute("data-zonos-checkout-attached")||(Z(`attached event to button ${o}`,"info",{button:t}),t.addEventListener("click",(async o=>{var s;const i=performance.now(),c=e&&t.matches(e),r=t.matches(`#${co}`),a=t.matches(`#${ro}`)||t.matches(`#${io}`);if(!window.Zonos.isLegacyCheckout&&(!ho()||((o=!0)=>!n.localizationLoaded||!!n.isDisabledCountry&&(o&&Z("Checkout: disabled country"),!0))())&&!c&&!r&&!a)return;o.preventDefault(),o.stopPropagation(),Z("zonos checkout button clicked");const{shouldAllowOrder:d}=await this.checkStripePaymentIntentStatus({triggeredButton:o.target});if(d){window.Zonos.logIntervalId||(window.Zonos.logIntervalId=setInterval((()=>{(async()=>{if(0===window.Zonos.loadTimeApiInfoList.length)return;Z("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});const o={data:[...window.Zonos.loadTimeApiInfoList],storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;const{errors:e}=await M("/api/zonos-elements/log-bulk-load-data",{body:o,method:"POST"});e.length&&(window.Zonos.loadTimeApiInfoList.push(...o.data),uo++,uo>5&&window.Zonos.logIntervalId&&clearInterval(window.Zonos.logIntervalId))})()}),2e3)),u.isFetchingSession=!0,this.open=!0;try{if(!await this.buildCartAndInit())throw new Error("Error building cart");w({isPreview:this.preview,sessionTimeout:54e5}),U("zonos-checkout-start"),y({checkoutSessionId:h.checkoutSessionId,eventName:"checkout_open"});const{enabled:o}=await(async()=>{const{errors:o,json:e}=await M("/api/zonos-elements/get-store-discount-enabled-status");return o.length||!(null==e?void 0:e.enabled)?{enabled:!1}:{enabled:!0}})();if(h.shouldHideDiscountInput=!o,this.handleOrderDuplication(),window.Zonos.isLegacyCheckout)(async()=>{const{elapsedTime:o}=K(),e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:G},V()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};M("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})();else{(async({loadTime:o})=>{const e={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:G},V()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};M("/api/zonos-elements/log-script-load",{body:e,method:"POST"})})({loadTime:performance.now()-i})}}catch(o){if(o instanceof Error&&"Cart is expired."===o.message)return void(this.isCartExpired=!0);if(u.isFetchingSession=!1,F(o),this.isCartExpired)return;W({endpoint:"Error creating Checkout",errors:[o instanceof Error?o.toString():"Unknown error"],metadata:{allLogs:G,cartId:window.Zonos.cartId,checkoutSessionBody:b(),href:window.location.href,storeBaseUrl:(null===(s=window.Zonos.cartData)||void 0===s?void 0:s.storeBaseUrl)||N.onlineStoreSettings.url}}),v({messages:[C("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:C("Error creating Checkout")})}}}),{capture:!0,passive:!1}),N.checkoutSettings.disablePlaceOrderButtonActivation||t.removeAttribute("disabled"),t.setAttribute("data-zonos-checkout-attached","true"),t.matches(`#${ro}`)&&(t.dispatchEvent(oo("click")),r(),t.remove()),t.matches(`#${io}`)&&(t.dispatchEvent(oo("click")),t.remove()))}))}appearanceSettingsOverrideChanged(){this.appearanceSettingsOverride&&this.applyStripeTheme()}useShippingDataFromCreateCartId(o){if(!o)return;Z("shipping data from createCartId result","info",Object.entries(o));const{customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:i,customerEmail:c,customerName:r,customerPhone:a,customerState:d,customerZip:l}=o,h=new URLSearchParams(window.location.search),u=i||x(h)||n.selectedCountryCode;this.applyPrefillAddress({customerAddress1:e,customerAddress2:t,customerCity:s,customerCountry:u,customerEmail:c,customerName:r,customerPhone:a,customerState:d,customerZip:l})}useLegacyQueryParams(){const o=new URLSearchParams(window.location.search);Z("legacy urlParams","info",Object.fromEntries(o.entries()));const e=e=>{const t=o.get(e);return t&&"undefined"!==t?t:null},t=x(o)||n.selectedCountryCode,s=e("customerCity"),i=e("customerEmail"),c=e("customerAddress1"),r=e("customerAddress2"),a=e("customerName"),d=e("customerPhone"),l=e("customerZip"),h=e("customerState");this.applyPrefillAddress({customerAddress1:c,customerAddress2:r,customerCity:s,customerCountry:t,customerEmail:i,customerName:a,customerPhone:d,customerState:h,customerZip:l})}applyPrefillAddress(o){const e=o.customerAddress1||"",t=o.customerCountry||"",s=o.customerAddress2||"",i=o.customerCity||"",c=o.customerEmail||"",r=o.customerName||"",a=o.customerPhone||"",d=o.customerZip||"",l=o.customerState||"";e&&r&&a&&t?t&&n.shippingZoneCountries&&!(t in n.shippingZoneCountries)?Z(`Country "${t}" is not in the shipping zone, so it can not be prefilled`,"warn"):(this.defaultAddressParams=[{address:{city:i||"",country:t,line1:e,line2:s,postal_code:d,state:l},email:c,name:r,phone:a}],Z("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:o})):Z("Missing required query params so it can not be prefilled","info",[!e&&"line1",!r&&"name",!a&&"phone",!t&&"country"].filter(Boolean).join(", "))}overrideStagingModeChanged(){h.isStagingMode=!!this.overrideStagingMode}async init(){u.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,h.isStagingMode=Q(),void 0!==this.overrideStagingMode&&(h.isStagingMode=this.overrideStagingMode),(({domesticRedirectedBtnSelector:o,onShippingAddressSessionFound:e})=>{if(!window.Zonos.isBigCommerce)return;const t=new MutationObserver((async()=>{const s=document.querySelector(o),n=i();if(!s&&n){const o=document.createElement("button");return o.style.display="none",o.id="zonos--domestic-redirected-checkout-button",document.body.appendChild(o),null==e||e(n),void t.disconnect()}const d=document.querySelector('select[name="shippingAddress.countryCode"]'),l=document.querySelector("#checkout-shipping-continue");d&&l&&(t.disconnect(),l.addEventListener("click",(async o=>{var e,t;const s=d.value;if(!s)return;if(c(s),!ho(!1))return void r();const n=document.querySelector("form");if(!n)return;const i=new FormData(n),l=document.querySelector("input#addressLine1Input"),h={address1:null!==(e=i.get("shippingAddress.address1"))&&void 0!==e?e:l&&l.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:null!==(t=i.get("shippingAddress.stateOrProvince"))&&void 0!==t?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(h).some((o=>null==o)))return F("One or more shipping address field is missing",Object.entries(h)),void W({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(h))],metadata:{storeId:N.storeId}});a({address1:h.address1,address2:h.address2,city:h.city,countryCode:h.countryCode,firstName:h.firstName,lastName:h.lastName,phone:h.phone,postalCode:h.postalCode,state:h.stateOrProvince}),o.preventDefault(),o.stopPropagation(),window.location.href="/"})))}));t.observe(document.body,{childList:!0,subtree:!0})})({domesticRedirectedBtnSelector:ro,onShippingAddressSessionFound:o=>{this.defaultAddress=[{address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:`${o.firstName} ${o.lastName}`,phone:o.phone}]}}),window.Zonos&&this.useLegacyQueryParams();const o=setInterval((()=>{u.stripe=window.Zonos.stripe,this.stripe=window.Zonos.stripe,this.stripe?(this.storybookPaymentStatusOverride||(Z("init checkout"),this.preview||this.forceDialogOpen?this.buildCartAndInit():window.Zonos.isLegacyCheckout?this.attachCheckout():window&&(this.attachCheckout(),new MutationObserver((()=>{this.attachCheckout()})).observe(document.body,{childList:!0,subtree:!0}))),clearInterval(o)):Z("waiting for stripe to be loaded")}),50);setTimeout((()=>{clearInterval(o)}),1e4)}async setToFinishStep(o){h.step="finish",this.storybookPaymentStatusOverride=o}async mockCheckoutSession(o){S(o)}async triggerCheckoutInternational(){const o=document.querySelector(`#${co}`);o&&o.dispatchEvent(oo("click"))}async handleCustomerInfoContinue(){U("zonos-checkout-customer-info"),y({checkoutSessionId:h.checkoutSessionId,eventName:"checkout_customerInfoCompleted"}),this.submitLoading=!0,await O();const o=setInterval((()=>{!h.landedCostData&&u.isFetchingLandedCost||(h.landedCostData&&(_({currency:h.currency}),I()),this.submitLoading=!1,clearInterval(o))}),500)}async handleShippingContinue(){this.submitLoading=!0,setTimeout((()=>{I(),this.submitLoading=!1}),500)}handleInventoryCheckDialogConfirm(){h.inventoryCheckErrorMessage=null,this.isLegacyCheckout||this.closeDialogHandler({confirmed:!0})}handleCartExpiredDialogConfirm(){var o;if(this.isCartExpired=!1,this.isLegacyCheckout){const e=null===(o=window.Zonos.cartData)||void 0===o?void 0:o.storeBaseUrl;if(!e)return;return window.parent&&(window.parent.location.href=e),void(window.location.href=e)}window.parent&&(window.parent.location.href=window.location.href),window.location.reload()}async handleStripePaymentContinue(){if("USD"!==u.checkoutSettlementCurrency||!u.shouldRenderPayInUsdButton||this.payInUsdConfirmDialogOpen){if(this.payInUsdConfirmDialogOpen=!1,$.paypalErrorMessage=null,u.hasPaymentError=!1,this.submitLoading=!0,h.inventoryCheckErrorMessage=null,!await A())return u.hasPaymentError=!0,u.customErrorMessage=C("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:u.checkoutSettlementCurrency}),void(this.submitLoading=!1);try{h.inventoryCheckErrorMessage=await T()}catch(o){h.inventoryCheckErrorMessage=C("Unable to check inventory. Please try again.")}if(h.inventoryCheckErrorMessage)this.submitLoading=!1;else{try{await P(),I(),g()}catch(o){F(o),U("zonos-checkout-payment-fail"),u.hasPaymentError=!0,u.shouldInventoryRefund&&(j(),u.shouldInventoryRefund=!1)}this.submitLoading=!1}}else this.payInUsdConfirmDialogOpen=!0}async handleFinishClick(){if(D(),this.preview)return h.step="customer-info",void await this.init();if(p(),window.Zonos.isLegacyCheckout&&window.Zonos.cartData){const o=window.Zonos.cartData.storeBaseUrl||N.onlineStoreSettings.url;return window.parent&&(window.parent.location.href=o),void(window.location.href=o)}const o=window.location.href.split("?")[0];this.open=!1,window.location.hostname.includes("dashboard.zonos.com")||(window.history.replaceState(window.history.state,document.title,o),window.location.reload())}handleWindowResize(){this.isMobile=J(this.mobile),this.applyStripeTheme(),Z(`mobile: ${this.isMobile}`)}handleMobileChange(){this.isMobile=J(this.mobile),this.applyStripeTheme(),Z(`mobile: ${this.isMobile}`)}handleAppearanceSettingsOverrideChange(){var o;(null===(o=this.appearanceSettingsOverride)||void 0===o?void 0:o.theme)&&(this.appearanceSettingsOverride.theme=R(this.appearanceSettingsOverride.theme))}handleAddressChange(){D()}handleCustomerProfileChange(){var o,e;if(!this.customerProfile)return Z("No customer profile","info"),void(this.defaultCustomerProfileAddress=[]);Z("Customer profile found","info",{customerProfile:this.customerProfile}),this.defaultCustomerProfileAddress=(null===(e=null===(o=u.customerProfile)||void 0===o?void 0:o.locations)||void 0===e?void 0:e.map((o=>{var e;return{address:{city:o.locality,country:o.countryCode,line1:o.line1,line2:o.line2||"",postal_code:o.postalCode,state:o.administrativeArea},email:o.email||(null===(e=u.customerProfile)||void 0===e?void 0:e.email)||"",name:o.name||"",phone:o.phone||""}})))||[]}handleClientSecretChange(){Z("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret}),this.applyStripeTheme()}handleOpenChange(){const o="data-zonos-overflow-origin",e=document.body,t=document.documentElement;if(this.open)e.style.overflow&&e.setAttribute(o,e.style.overflow),e.style.overflow="hidden",t.style.overflow&&t.setAttribute(o,t.style.overflow),t.style.overflow="hidden";else{this.stripeCustomerSessionClientSecret=null;const s=e.getAttribute(o),n=t.getAttribute(o);s?(e.removeAttribute(o),e.style.overflow=s):e.style.removeProperty("overflow"),n?(t.removeAttribute(o),t.style.overflow=n):t.style.removeProperty("overflow")}}componentWillLoad(){this.init(),this.isMobile=J(this.mobile),this.isIframed=window.self!==window.top,Z(`iframed: ${this.isIframed}`),this.handleAppearanceSettingsOverrideChange(),this.onChangeLocaleListener=L("selectedLocale",(()=>{this.applyStripeTheme()})),Z(`mobile: ${this.isMobile}`)}disconnectedCallback(){D(),p(),this.onChangeLocaleListener()}render(){var o,i,c,r;this.customerProfile=u.customerProfile,this.clientSecret=u.clientSecret,u.stripeCustomerSessionClientSecret&&(this.stripeCustomerSessionClientSecret=u.stripeCustomerSessionClientSecret);const a="finish"!==h.step&&"error"!==h.step&&!u.stripeElements||u.isFetchingSession,{colorPrimary:d,colorSecondary:l,logoUrl:m,style:p}=H(N.appearance,this.appearanceSettingsOverride||null),z="ENABLED"===N.appearance.zonosAttribution,g=N.appearance.theme,k=d&&to(d)?"DARK":"LIGHT",f=this.isMobile?g:k,w=this.isMobile?void 0:l,{customMessages:y}=n,b=null===(o=y.find((o=>"checkout_default"===o.pageName)))||void 0===o?void 0:o.message,v=this.getCurrentLocalePageEnum(),x=y.filter((o=>o.pageName===v)),S=this.getBaseCurrencySettlementInfo(),O=()=>{const o=this.preview?`${m}?timestamp=${Date.now()}`:m;return e("div",{class:"zonos--logo"},o&&e("img",{alt:`${N.organizationName} logo`,src:o}))},I=q(),A=()=>{const o=new URLSearchParams(window.location.search),t=o.get("zonosQaUrl"),s=o.get("zonosDebug"),n=o.get("zonosE2ETest"),i=this.overrideStagingMode||Q();return e("zonos-v-stack",null,e("div",{class:"zonos--logo-wrapper"},O(),I&&e("zonos-badge",{badgeColor:"orange",size:"small"},C("Test mode")),i&&e("zonos-badge",{badgeColor:"red",size:"small"},C("Staging mode")),"1"===s&&e("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&e("zonos-badge",{badgeColor:"purple",size:"small"},t),n&&e("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),e("zonos-checkout-progress-tabs",{backgroundColor:this.isMobile?"--zonos-elements-gray-0":null}),x.map((o=>e("zonos-custom-message",{icon:po,message:o.message}))))},T=()=>h.checkoutSessionTimeoutShow?e("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:C("Your checkout session has expired. Please reload the page to continue."),restStateTitle:C("Session timed out"),restStateType:"Warning"},e("zonos-button",{onClick:()=>this.reloadCheckoutSession(),variant:"primary"},C("Reload"))):e("div",{class:"zonos--content",style:{"--zonos--border-radius":eo({overrideBorderStyle:p})}},"finish"!==h.step&&"error"!==h.step&&e(s,null,e("div",{class:"zonos--left","data-theme":f,style:so({"--zonos--primary-color":this.isMobile?void 0:d})},!this.isMobile&&A(),"customer-info"===h.step&&e("zonos-customer-info",{continueLoading:this.submitLoading,defaultAddress:this.getDefaultAddress(),isMobile:this.isMobile,onContinueClicked:()=>this.handleCustomerInfoContinue(),submitBtnColor:w}),"shipping"===h.step&&e("zonos-shipping",{continueLoading:this.submitLoading,onContinueClicked:()=>this.handleShippingContinue(),submitBtnColor:w}),"payment"===h.step&&e("zonos-checkout-payment",{continueLoading:this.submitLoading,isMobile:this.isMobile,onContinueClicked:async()=>{await this.handleStripePaymentContinue()},submitBtnColor:w})),e("div",{class:"zonos--right","data-theme":g},this.isMobile&&A(),e("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&e("zonos-currency-toggle",null),!this.isLegacyCheckout&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:ao}),noBackground:!0,onClick:()=>this.closeDialogHandler()})),e("div",{class:"flex--wrapper"},e("div",{class:"zonos--wrapper"},e("zonos-review",{collapsed:this.collapseReviewMobile,mobile:this.isMobile,onClick:()=>{this.isMobile&&(this.collapseReviewMobile=!this.collapseReviewMobile)}}),e("zonos-collapse",{collapsed:this.collapseReviewMobile&&this.isMobile},e("zonos-cart-items",null),this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",{submitBtnColor:w}),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:po,message:b})))),e("zonos-cart-restricted-items",null),!this.isMobile&&e("zonos-v-stack",{spacing:16},e("zonos-cart-subtotal",null),e("zonos-custom-message",{class:"zonos--checkout-default-message",icon:po,message:b}))))),("finish"===h.step||"error"===h.step)&&e("div",{class:"zonos--done","data-theme":g},e("div",{class:"zonos--header"},O(),!this.isRedirectAfterOrder&&e("zonos-button",{class:"zonos--close-button",icon:e("zonos-icon",{"aria-label":"Close checkout dialog",content:ao}),noBackground:!0,onClick:()=>this.handleFinishClick(),theme:g})),e("zonos-checkout-finish",{borderRadius:p,onCloseClick:()=>this.handleFinishClick(),overrideNotification:"error"===h.step&&h.error?Object.assign(Object.assign({},h.error),{type:"error"}):void 0,storybookForceStatus:this.storybookPaymentStatusOverride})),e("zonos-checkout-footer",{"data-theme":g,mobile:this.isMobile,slot:this.isMobile?void 0:"dialog-footer"}));return e(t,{class:X(["zonos--checkout zonos--elements",z&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?T():e("zonos-dialog",{borderStyle:p,"data-theme":g,height:"980px",isLoading:a,mobile:this.isMobile,noBodyPadding:!0,noBorder:!0,noClickOutside:!0,noCloseButton:!0,onCloseDialog:()=>this.closeDialogHandler(),open:this.open,width:"1200px"},T()),e("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:C("Don't close"),dialogConfirmBtnText:C("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:C("Would you like to close checkout and return to the site?"),dialogTitle:C("Are you sure?"),onCancelClicked:()=>{this.confirmDialogOpen=!1},onConfirmClicked:()=>this.closeDialogHandler({confirmed:!0})}),e("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:C("Return to merchant site"),dialogConfirmBtnText:C("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:(null===(i=this.placedOrderInfo)||void 0===i?void 0:i.zonosOrderNumber)?C("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):C("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate((null===(c=this.placedOrderInfo)||void 0===c?void 0:c.time)||null),time:this.formatTime((null===(r=this.placedOrderInfo)||void 0===r?void 0:r.time)||null)}),dialogTitle:C("Are you sure?"),dialogWidth:530,onCancelClicked:()=>{this.handleCancelOrderDuplication()},onConfirmClicked:()=>{this.confirmProceedWithOrderDuplication()}}),e("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:C("Return to cart"),dialogIntent:"danger",dialogOpen:!!h.inventoryCheckErrorMessage,dialogSubtitle:h.inventoryCheckErrorMessage,dialogTitle:C("Couldn't place order"),dialogType:"alert",onConfirmClicked:()=>this.handleInventoryCheckDialogConfirm()}),S&&e("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:C("Cancel"),dialogConfirmBtnText:C("Pay [orderTotal]",{orderTotal:B({amount:S.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:C("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:C("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:()=>{this.payInUsdConfirmDialogOpen=!1},onConfirmClicked:()=>this.handleStripePaymentContinue()}),e("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:C("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:C("You are being sent back to the shop to re-add items to your cart."),dialogTitle:C("Shopping cart expired"),dialogType:"alert",onConfirmClicked:()=>this.handleCartExpiredDialogConfirm()}))}static get assetsDirs(){return["assets"]}static get watchers(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}}};zo.style=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";export{zo as zonos_checkout}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(o,e,t,n){function r(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,i){function s(o){try{a(n.next(o))}catch(o){i(o)}}function c(o){try{a(n["throw"](o))}catch(o){i(o)}}function a(o){o.done?t(o.value):r(o.value).then(s,c)}a((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(o){return function(e){return a([o,e])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=e.call(o,t)}catch(o){c=[6,o];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(o,e,t){if(t||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++){if(i||!(n in e)){if(!i)i=Array.prototype.slice.call(e,0,n);i[n]=e[n]}}return o.concat(i||Array.prototype.slice.call(e))};System.register(["./p-43633269.system.js","./p-3bcf2091.system.js","./p-c69c3219.system.js","./p-06ed3582.system.js","./p-1b75aa35.system.js","./p-23e7c655.system.js","./p-bf37ccc7.system.js","./p-af6af82e.system.js","./p-f28eb1dd.system.js","./p-1aa93d1e.system.js","./p-5e1b2654.system.js","./p-2770ba48.system.js"],(function(o){"use strict";var e,t,n,r,i,s,c,a,u,d,l,h,f,m,v,z,p,g,k,w,b,y,C,_,x,S,O,A,I,T,P,j,L,E,B,D,U,N,R,Z,H,M,F,G,K,V,W,q,Y,J,Q,X,$,oo,eo,to,no,ro,io,so,co,ao,uo;return{setters:[function(o){e=o.r;t=o.h;n=o.H;r=o.F},function(o){i=o.l;s=o.s;c=o.a;a=o.b;u=o.c;d=o.i;l=o.d;h=o.e;f=o.f;m=o.g;v=o.h;z=o.j;p=o.k;g=o.m;k=o.n;w=o.o;b=o.t;y=o.p;C=o.q;_=o.r;x=o.u;S=o.v;O=o.w;A=o.x;I=o.y;T=o.z;P=o.A;j=o.B;L=o.C;E=o.D;B=o.E},function(o){D=o.p;U=o.s;N=o.a;R=o.b},function(o){Z=o.z;H=o.g;M=o.m},function(o){F=o.h;G=o.l;K=o.b;V=o.s;W=o.c;q=o.d;Y=o.e;J=o.g;Q=o.j;X=o.a;$=o.i},function(o){oo=o.c},function(o){eo=o.c},function(o){to=o.g},function(o){no=o.i},function(o){ro=o.s},function(o){io=o._;so=o.c;co=o.a;ao=o.d},function(o){uo=o.R}],execute:function(){var lo=this;var ho=function(o){var e=o.items.map((function(o){return{amount:o.amount,attributes:o.attributes||[],countryOfOrigin:o.countryOfOrigin||undefined,currencyCode:o.currencyCode,description:o.description||"",imageUrl:o.imageUrl||"",itemType:o.itemType||"PHYSICAL_GOOD",measurements:o.measurements||[],name:o.name||o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""}}))||[];return{adjustments:o.adjustments,cartItems:e}};var fo=function(){return __awaiter(lo,void 0,void 0,(function(){var o,e,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,F("/api/zonos-elements/get-store-discount-enabled-status")];case 1:o=n.sent(),e=o.errors,t=o.json;if(e.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var mo=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return true}if(i.isDisabledCountry){if(o){G("Checkout: disabled country")}return true}return false};var vo=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return false}if(!i.isShippableCountry){if(o){G("Checkout: not shippable country")}return false}return true};var zo=function(o){var e=o.domesticRedirectedBtnSelector,t=o.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(lo,void 0,void 0,(function(){var o,r,i,d,l;var h=this;return __generator(this,(function(f){o=document.querySelector(e);r=s();if(!o&&r){i=document.createElement("button");i.style.display="none";i.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(i);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}d=document.querySelector('select[name="shippingAddress.countryCode"]');l=document.querySelector("#checkout-shipping-continue");if(!d||!l){return[2]}n.disconnect();l.addEventListener("click",(function(o){return __awaiter(h,void 0,void 0,(function(){var e,t,n,r,i,s,l;return __generator(this,(function(h){n=d.value;if(!n){return[2]}c(n);if(!vo(false)){a();return[2]}r=document.querySelector("form");if(!r){return[2]}i=new FormData(r);s=document.querySelector("input#addressLine1Input");l={address1:(e=i.get("shippingAddress.address1"))!==null&&e!==void 0?e:s&&s.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:(t=i.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(l).some((function(o){return o===undefined||o===null}))){K("One or more shipping address field is missing",Object.entries(l));void V({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(l))],metadata:{storeId:Z.storeId}});return[2]}u({address1:l.address1,address2:l.address2,city:l.city,countryCode:l.countryCode,firstName:l.firstName,lastName:l.lastName,phone:l.phone,postalCode:l.postalCode,state:l.stateOrProvince});o.preventDefault();o.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var po=0;var go=function(){return __awaiter(lo,void 0,void 0,(function(){var o,e;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}G("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});o={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,F("/api/zonos-elements/log-bulk-load-data",{body:o,method:"POST"})];case 1:e=n.sent().errors;if(e.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,o.data);po++;if(po>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var ko=function(){return __awaiter(lo,void 0,void 0,(function(){var o,e;return __generator(this,(function(t){o=W().elapsedTime;e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:q},Y()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void F("/api/zonos-elements/log-script-load",{body:e,method:"POST"});return[2]}))}))};var wo=function(o){return __awaiter(lo,[o],void 0,(function(o){var e;var t=o.loadTime;return __generator(this,(function(o){e={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:q},Y()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};void F("/api/zonos-elements/log-script-load",{body:e,method:"POST"});return[2]}))}))};var bo=function(o){return __awaiter(lo,[o],void 0,(function(o){var e,t,n,r,i;var s=o.cartId,c=o.retries;return __generator(this,(function(o){switch(o.label){case 0:e=J();return[4,F("/api/zonos-elements/get-temp-cart",{body:{isTestMode:e,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=o.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3,3];G("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(o){return setTimeout(o,500)}))];case 2:o.sent();return[2,bo({cartId:s,retries:c-1})];case 3:if(i){return[2,null]}return[2,r]}}))}))};var yo=function(o){return __awaiter(lo,void 0,void 0,(function(){var e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=io(o),t=e.isDgsCartId,n=e.isLegacyCartId;if(!n&&!t){K("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,bo({cartId:o,retries:5})];case 1:r=i.sent();G("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){K("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Co='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var _o=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var xo=_o;var So=90*60*1e3;var Oo=6*60*60*1e3;var Ao=o("zonos_checkout",function(){function o(o){var t=this;e(this,o);this.onChangeLocaleListener=function(){};this.isRedirectAfterOrder=false;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var o,e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||Z.appearance.theme;return[4,d({overrideBorderRadius:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:D()})];case 1:i.sent();return[2]}}))}))};this.checkStripePaymentIntentStatus=function(o){return __awaiter(t,[o],void 0,(function(o){var e,t,n,r,i,s,c,a,u;var d=o.triggeredButton;return __generator(this,(function(o){switch(o.label){case 0:e=d===null||d===void 0?void 0:d.matches("#".concat(so));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");if(!e){G("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}G("Payment intent exist, checking stripe payment intent status");if(!r){G("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,l({clientSecret:r})];case 1:s=o.sent(),c=s.error,a=s.status;u=new URLSearchParams(window.location.search).get("redirect_status");if(u){if(!c){G("Payment intent is succeeded or in a good state to move forward, show success screen")}else{G("Payment intent failed, show status from error")}this.open=true;h.checkoutSessionId=i;f.clientSecret=r;void this.setToFinishStep(a);return[2,{shouldAllowOrder:false}]}if(!t){G("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}G("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.formatDate=function(o){if(!o){return""}var e=new Date(o);return e.toLocaleDateString()};this.formatTime=function(o){if(!o){return""}var e=new Date(o);return e.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(h.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var o=h.selectedLandedCost;if(!o){return null}var e=o.landedCost.amountSubtotals;if(!e){return null}var t=(e.discounts||0)+e.items+e.landedCostTotal+e.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};this.appearanceSettingsOverride=undefined;this.preview=false;this.hiddenMode=false;this.mobile=false;this.overrideStagingMode=undefined;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.clientSecret=f.clientSecret;this.stripeCustomerSessionClientSecret=f.stripeCustomerSessionClientSecret}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=o.detail;void m({adjustments:h.adjustments,cartItems:e});return[2]}))}))};o.prototype.handleKeyPress=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(o.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};o.prototype.closeDialogHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(o===null||o===void 0?void 0:o.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;U("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&h.step==="finish"){v()}h.step="customer-info";z();p();(t=(e=Z.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(e);return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n,r,s,c,a,s,c,c,u,d,s,l;return __generator(this,(function(f){switch(f.label){case 0:if(!(typeof Z.checkoutSettings.createCartId==="function"))return[3,4];G('"createCartId" is provided, start building cart');return[4,Z.checkoutSettings.createCartId()];case 1:o=f.sent();e=void 0;if(typeof o==="object"){G("object detected, use cartId and prefill address from createCartId");e=o.cartId;this.useShippingDataFromCreateCartId(o.shippingData);h.customerAuthenticationToken=o.customerAuthenticationToken||null}else{e=o}window.Zonos.cartId=e;return[4,yo(e)];case 2:t=f.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){K("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=ho(n),s=r.adjustments,c=r.cartItems;return[4,m({adjustments:s,cartItems:c})];case 3:f.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];G("tempCartUUID is provided, start building cart");a=ho(window.Zonos.cartData),s=a.adjustments,c=a.cartItems;return[4,m({adjustments:s,cartItems:c})];case 5:f.sent();return[3,9];case 6:if(!(Z.checkoutSettings.buildCartDetail&&i.selectedCountryCode))return[3,9];G("build cart detail");return[4,Z.checkoutSettings.buildCartDetail({countryCode:i.selectedCountryCode,currencyCode:i.targetCurrency})];case 7:c=f.sent();u=c.filter((function(o){return o.amount>=0}));d=c.filter((function(o){return o.amount<0}));s=d.map((function(o){return{amount:o.amount,currencyCode:o.currencyCode,description:o.name||o.description||"",productId:o.productId||null,sku:o.sku||null,type:"CART_TOTAL"}}));return[4,m({adjustments:s,cartItems:u})];case 8:f.sent();f.label=9;case 9:if(!!h.checkoutSessionId)return[3,11];return[4,g()];case 10:l=f.sent();G("stripeStoreInitCheckoutSession: ".concat(l));if(!l){return[2,false]}f.label=11;case 11:if(!h.isStagingMode){void k()}return[4,this.applyStripeTheme()];case 12:f.sent();this.isRedirectAfterOrder=Z.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!h.externalConfirmationPageURL;return[2,true]}}))}))};o.prototype.reloadCheckoutSession=function(){window.location.reload()};o.prototype.handleOrderDuplication=function(){var o=Q(localStorage.getItem("zonos--placed-order-info"));if(!o){localStorage.removeItem("zonos--placed-order-info");return}var e=Date.now()-o.time;G("=== Existing placed order info: ".concat(o.orderId," - ").concat(this.formatDate(o.time)," - elapsed in hh:ss format: ").concat(new Date(e).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Oo;if(e>t){G("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=o;G("=== Showing order duplication confirmation","warn")};o.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!h.checkoutSessionId){return}void F("/api/zonos-elements/update-checkout-session-metadata",{body:{id:h.checkoutSessionId,metadata:[{key:"orderDuplicationConsent",value:"1"}]},method:"POST"})};o.prototype.handleCancelOrderDuplication=function(){var o;this.placedOrderInfo=null;if(this.isLegacyCheckout){var e=((o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl)||Z.onlineStoreSettings.url;if(!e){return}if(window.parent){window.parent.location.href=e}window.location.href=e;return}void this.closeDialogHandler({confirmed:true})};o.prototype.attachCheckout=function(){var o=this;var e=Z.checkoutSettings.placeOrderButtonSelector;var t=Z.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;G("attach checkout ".concat(e));G("attach checkout to always trigger international checkout selector: ".concat(t));if(!e&&!t&&!window.Zonos.cartData){return}var n=[e,t,"#".concat(ao),"#".concat(so),"#".concat(co)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}G("attached event to button ".concat(e),"info",{button:n});n.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,r,i,s,c,a,u,d,l,m,v,z,p;return __generator(this,(function(g){switch(g.label){case 0:r=performance.now();i=t&&n.matches(t);s=n.matches("#".concat(co));c=n.matches("#".concat(ao))||n.matches("#".concat(so));if(!window.Zonos.isLegacyCheckout&&(!vo()||mo())&&!i&&!s&&!c){return[2]}e.preventDefault();e.stopPropagation();G("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:e.target})];case 1:a=g.sent().shouldAllowOrder;if(!a){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void go()}),2e3)}f.isFetchingSession=true;this.open=true;g.label=2;case 2:g.trys.push([2,5,,6]);return[4,this.buildCartAndInit()];case 3:u=g.sent();if(!u){throw new Error("Error building cart")}w({isPreview:this.preview,sessionTimeout:So});U("zonos-checkout-start");d=h.checkoutSessionId;void b({checkoutSessionId:d,eventName:"checkout_open"});return[4,fo()];case 4:l=g.sent().enabled;h.shouldHideDiscountInput=!l;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void ko()}else{m=performance.now();v=m-r;void wo({loadTime:v})}return[3,6];case 5:z=g.sent();if(z instanceof Error){p=z.message;if(p==="Cart is expired."){this.isCartExpired=true;return[2]}}f.isFetchingSession=false;K(z);if(this.isCartExpired){return[2]}void V({endpoint:"Error creating Checkout",errors:[z instanceof Error?z.toString():"Unknown error"],metadata:{allLogs:q,cartId:window.Zonos.cartId,checkoutSessionBody:y(),href:window.location.href,storeBaseUrl:((o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl)||Z.onlineStoreSettings.url}});C({messages:[_("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:_("Error creating Checkout")});return[3,6];case 6:return[2]}}))}))}),{capture:true,passive:false});if(!Z.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(ao))){n.dispatchEvent(eo("click"));a();n.remove()}if(n.matches("#".concat(so))){n.dispatchEvent(eo("click"));n.remove()}}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.useShippingDataFromCreateCartId=function(o){if(!o){return}G("shipping data from createCartId result","info",Object.entries(o));var e=o.customerAddress1,t=o.customerAddress2,n=o.customerCity,r=o.customerCountry,s=o.customerEmail,c=o.customerName,a=o.customerPhone,u=o.customerState,d=o.customerZip;var l=new URLSearchParams(window.location.search);var h=r||x(l)||i.selectedCountryCode;this.applyPrefillAddress({customerAddress1:e,customerAddress2:t,customerCity:n,customerCountry:h,customerEmail:s,customerName:c,customerPhone:a,customerState:u,customerZip:d})};o.prototype.useLegacyQueryParams=function(){var o=new URLSearchParams(window.location.search);G("legacy urlParams","info",Object.fromEntries(o.entries()));var e=function(e){var t=o.get(e);if(!t||t==="undefined"){return null}return t};var t=x(o)||i.selectedCountryCode;var n=e("customerCity");var r=e("customerEmail");var s=e("customerAddress1");var c=e("customerAddress2");var a=e("customerName");var u=e("customerPhone");var d=e("customerZip");var l=e("customerState");this.applyPrefillAddress({customerAddress1:s,customerAddress2:c,customerCity:n,customerCountry:t,customerEmail:r,customerName:a,customerPhone:u,customerState:l,customerZip:d})};o.prototype.applyPrefillAddress=function(o){var e=o.customerAddress1||"";var t=o.customerCountry||"";var n=o.customerAddress2||"";var r=o.customerCity||"";var s=o.customerEmail||"";var c=o.customerName||"";var a=o.customerPhone||"";var u=o.customerZip||"";var d=o.customerState||"";if(!e||!c||!a||!t){G("Missing required query params so it can not be prefilled","info",[!e&&"line1",!c&&"name",!a&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&i.shippingZoneCountries&&!(t in i.shippingZoneCountries)){G('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:e,line2:n,postal_code:u,state:d},email:s,name:c,phone:a}];G("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:o})};o.prototype.overrideStagingModeChanged=function(){h.isStagingMode=!!this.overrideStagingMode};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(t){f.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;h.isStagingMode=X();if(typeof this.overrideStagingMode!=="undefined"){h.isStagingMode=this.overrideStagingMode}zo({domesticRedirectedBtnSelector:ao,onShippingAddressSessionFound:function(o){e.defaultAddress=[{address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:"".concat(o.firstName," ").concat(o.lastName),phone:o.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}o=setInterval((function(){f.stripe=window.Zonos.stripe;e.stripe=window.Zonos.stripe;if(!e.stripe){G("waiting for stripe to be loaded");return}if(e.storybookPaymentStatusOverride){clearInterval(o);return}G("init checkout");if(e.preview||e.forceDialogOpen){void e.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){e.attachCheckout()}else if(window){e.attachCheckout();var t=new MutationObserver((function(){e.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(o)}),50);setTimeout((function(){clearInterval(o)}),1e4);return[2]}))}))};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){h.step="finish";this.storybookPaymentStatusOverride=o;return[2]}))}))};o.prototype.mockCheckoutSession=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){S(o);return[2]}))}))};o.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(e){o=document.querySelector("#".concat(co));if(o){o.dispatchEvent(eo("click"))}return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;var t=this;return __generator(this,(function(n){switch(n.label){case 0:U("zonos-checkout-customer-info");o=h.checkoutSessionId;void b({checkoutSessionId:o,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,O()];case 1:n.sent();e=setInterval((function(){if(h.landedCostData||!f.isFetchingLandedCost){if(h.landedCostData){void N({currency:h.currency});A()}t.submitLoading=false;clearInterval(e)}}),500);return[2]}}))}))};o.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(e){this.submitLoading=true;setTimeout((function(){A();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleInventoryCheckDialogConfirm=function(){h.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};o.prototype.handleCartExpiredDialogConfirm=function(){var o;this.isCartExpired=false;if(this.isLegacyCheckout){var e=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl;if(!e){return}if(window.parent){window.parent.location.href=e}window.location.href=e;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=f.checkoutSettlementCurrency==="USD";if(o&&f.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;R.paypalErrorMessage=null;f.hasPaymentError=false;this.submitLoading=true;h.inventoryCheckErrorMessage=null;return[4,I()];case 1:e=i.sent();if(!e){f.hasPaymentError=true;f.customErrorMessage=_("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:f.checkoutSettlementCurrency});this.submitLoading=false;return[2]}i.label=2;case 2:i.trys.push([2,4,,5]);t=h;return[4,T()];case 3:t.inventoryCheckErrorMessage=i.sent();return[3,5];case 4:n=i.sent();h.inventoryCheckErrorMessage=_("Unable to check inventory. Please try again.");return[3,5];case 5:if(h.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}i.label=6;case 6:i.trys.push([6,8,,9]);return[4,P()];case 7:i.sent();A();p();return[3,9];case 8:r=i.sent();K(r);U("zonos-checkout-payment-fail");f.hasPaymentError=true;if(f.shouldInventoryRefund){void j();f.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n;return __generator(this,(function(r){switch(r.label){case 0:L();if(!this.preview)return[3,2];h.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:v();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){o=window.Zonos.cartData.storeBaseUrl||Z.onlineStoreSettings.url;if(window.parent){window.parent.location.href=o}window.location.href=o;return[2]}e=window.location.href;t=e.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=$(this.mobile);void this.applyStripeTheme();G("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=$(this.mobile);void this.applyStripeTheme();G("mobile: ".concat(this.isMobile))};o.prototype.handleAppearanceSettingsOverrideChange=function(){var o;if((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme){this.appearanceSettingsOverride.theme=H(this.appearanceSettingsOverride.theme)}};o.prototype.handleAddressChange=function(){L()};o.prototype.handleCustomerProfileChange=function(){var o,e;if(!this.customerProfile){G("No customer profile","info");this.defaultCustomerProfileAddress=[];return}G("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((e=(o=f.customerProfile)===null||o===void 0?void 0:o.locations)===null||e===void 0?void 0:e.map((function(o){var e;return{address:{city:o.locality,country:o.countryCode,line1:o.line1,line2:o.line2||"",postal_code:o.postalCode,state:o.administrativeArea},email:o.email||((e=f.customerProfile)===null||e===void 0?void 0:e.email)||"",name:o.name||"",phone:o.phone||""}})))||[]};o.prototype.handleClientSecretChange=function(){G("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};o.prototype.handleOpenChange=function(){var o="data-zonos-overflow-origin";var e=document.body;var t=document.documentElement;if(this.open){if(e.style.overflow){e.setAttribute(o,e.style.overflow)}e.style.overflow="hidden";if(t.style.overflow){t.setAttribute(o,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=e.getAttribute(o);var r=t.getAttribute(o);if(n){e.removeAttribute(o);e.style.overflow=n}else{e.style.removeProperty("overflow")}if(r){t.removeAttribute(o);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};o.prototype.componentWillLoad=function(){var o=this;void this.init();this.isMobile=$(this.mobile);this.isIframed=window.self!==window.top;G("iframed: ".concat(this.isIframed));this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=E("selectedLocale",(function(){void o.applyStripeTheme()}));G("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){L();v();this.onChangeLocaleListener()};o.prototype.render=function(){var o=this;var e,s,c,a;this.customerProfile=f.customerProfile;this.clientSecret=f.clientSecret;if(f.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=f.stripeCustomerSessionClientSecret}var u=h.step!=="finish"&&h.step!=="error"&&!f.stripeElements||f.isFetchingSession;var d=M(Z.appearance,this.appearanceSettingsOverride||null),l=d.colorPrimary,m=d.colorSecondary,v=d.logoUrl,z=d.style;var p=Z.appearance.zonosAttribution==="ENABLED";var g=Z.appearance.theme;var k=l&&no(l)?"DARK":"LIGHT";var w=this.isMobile?g:k;var b=!this.isMobile?m:undefined;var y=i.customMessages;var C=(e=y.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message;var x=this.getCurrentLocalePageEnum();var S=y.filter((function(o){return o.pageName===x}));var O=this.getBaseCurrencySettlementInfo();var A=function(){var e=o.preview?"".concat(v,"?timestamp=").concat(Date.now()):v;return t("div",{class:"zonos--logo"},e&&t("img",{alt:"".concat(Z.organizationName," logo"),src:e}))};var I=J();var T=function(){var e=new URLSearchParams(window.location.search);var n=e.get("zonosQaUrl");var r=e.get("zonosDebug");var i=e.get("zonosE2ETest");var s=o.overrideStagingMode||X();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},A(),I&&t("zonos-badge",{badgeColor:"orange",size:"small"},_("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},_("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),t("zonos-checkout-progress-tabs",{backgroundColor:o.isMobile?"--zonos-elements-gray-0":null}),S.map((function(o){return t("zonos-custom-message",{icon:Co,message:o.message})})))};var P=function(){if(h.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:_("Your checkout session has expired. Please reload the page to continue."),restStateTitle:_("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return o.reloadCheckoutSession()},variant:"primary"},_("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":to({overrideBorderStyle:z})}},h.step!=="finish"&&h.step!=="error"&&t(r,null,t("div",{class:"zonos--left","data-theme":w,style:ro({"--zonos--primary-color":!o.isMobile?l:undefined})},!o.isMobile&&T(),h.step==="customer-info"&&t("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.getDefaultAddress(),isMobile:o.isMobile,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:b}),h.step==="shipping"&&t("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:b}),h.step==="payment"&&t("zonos-checkout-payment",{continueLoading:o.submitLoading,isMobile:o.isMobile,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))},submitBtnColor:b})),t("div",{class:"zonos--right","data-theme":g},o.isMobile&&T(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!o.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:uo}),noBackground:true,onClick:function(){return o.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile}}),t("zonos-collapse",{collapsed:o.collapseReviewMobile&&o.isMobile},t("zonos-cart-items",null),o.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:b}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Co,message:C})))),t("zonos-cart-restricted-items",null),!o.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Co,message:C}))))),(h.step==="finish"||h.step==="error")&&t("div",{class:"zonos--done","data-theme":g},t("div",{class:"zonos--header"},A(),!o.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:uo}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:g})),t("zonos-checkout-finish",{borderRadius:z,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:h.step==="error"&&!!h.error?Object.assign(Object.assign({},h.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":g,mobile:o.isMobile,slot:!o.isMobile?"dialog-footer":undefined}))};return t(n,{class:oo(["zonos--checkout zonos--elements",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?P():t("zonos-dialog",{borderStyle:z,"data-theme":g,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeDialogHandler()},open:this.open,width:"1200px"},P()),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:_("Don't close"),dialogConfirmBtnText:_("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:_("Would you like to close checkout and return to the site?"),dialogTitle:_("Are you sure?"),onCancelClicked:function(){o.confirmDialogOpen=false},onConfirmClicked:function(){return o.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:_("Return to merchant site"),dialogConfirmBtnText:_("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((s=this.placedOrderInfo)===null||s===void 0?void 0:s.zonosOrderNumber)?_("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):_("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((c=this.placedOrderInfo)===null||c===void 0?void 0:c.time)||null),time:this.formatTime(((a=this.placedOrderInfo)===null||a===void 0?void 0:a.time)||null)}),dialogTitle:_("Are you sure?"),dialogWidth:530,onCancelClicked:function(){o.handleCancelOrderDuplication()},onConfirmClicked:function(){o.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:_("Return to cart"),dialogIntent:"danger",dialogOpen:!!h.inventoryCheckErrorMessage,dialogSubtitle:h.inventoryCheckErrorMessage,dialogTitle:_("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return o.handleInventoryCheckDialogConfirm()}}),O&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:_("Cancel"),dialogConfirmBtnText:_("Pay [orderTotal]",{orderTotal:B({amount:O.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:_("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:_("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:_("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:_("You are being sent back to the shop to re-add items to your cart."),dialogTitle:_("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return o.handleCartExpiredDialogConfirm()}}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return o}());Ao.style=xo}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(o,e,t,n){function r(o){return o instanceof t?o:new t((function(e){e(o)}))}return new(t||(t=Promise))((function(t,i){function s(o){try{a(n.next(o))}catch(o){i(o)}}function c(o){try{a(n["throw"](o))}catch(o){i(o)}}function a(o){o.done?t(o.value):r(o.value).then(s,c)}a((n=n.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,r,i,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(o){return function(e){return a([o,e])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,c[0]&&(t=0)),t)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:t.label++;return{value:c[1],done:false};case 5:t.label++;r=c[1];c=[0];continue;case 7:c=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1];i=c;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(c);break}if(i[2])t.ops.pop();t.trys.pop();continue}c=e.call(o,t)}catch(o){c=[6,o];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(o,e,t){if(t||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++){if(i||!(n in e)){if(!i)i=Array.prototype.slice.call(e,0,n);i[n]=e[n]}}return o.concat(i||Array.prototype.slice.call(e))};System.register(["./p-43633269.system.js","./p-daf73a4c.system.js","./p-7d5d89f2.system.js","./p-06ed3582.system.js","./p-1b75aa35.system.js","./p-23e7c655.system.js","./p-bf37ccc7.system.js","./p-af6af82e.system.js","./p-f28eb1dd.system.js","./p-1aa93d1e.system.js","./p-5e1b2654.system.js","./p-2770ba48.system.js"],(function(o){"use strict";var e,t,n,r,i,s,c,a,u,d,l,h,f,m,v,z,p,g,k,w,b,y,C,_,x,S,O,A,I,T,P,j,L,E,B,D,U,N,R,Z,H,M,F,G,K,V,W,q,Y,J,Q,X,$,oo,eo,to,no,ro,io,so,co,ao,uo;return{setters:[function(o){e=o.r;t=o.h;n=o.H;r=o.F},function(o){i=o.l;s=o.s;c=o.a;a=o.b;u=o.c;d=o.i;l=o.d;h=o.e;f=o.f;m=o.g;v=o.h;z=o.j;p=o.k;g=o.m;k=o.n;w=o.o;b=o.t;y=o.p;C=o.q;_=o.r;x=o.u;S=o.v;O=o.w;A=o.x;I=o.y;T=o.z;P=o.A;j=o.B;L=o.C;E=o.D;B=o.E},function(o){D=o.p;U=o.s;N=o.a;R=o.b},function(o){Z=o.z;H=o.g;M=o.m},function(o){F=o.h;G=o.l;K=o.b;V=o.s;W=o.c;q=o.d;Y=o.e;J=o.g;Q=o.j;X=o.a;$=o.i},function(o){oo=o.c},function(o){eo=o.c},function(o){to=o.g},function(o){no=o.i},function(o){ro=o.s},function(o){io=o._;so=o.c;co=o.a;ao=o.d},function(o){uo=o.R}],execute:function(){var lo=this;var ho=function(o){var e=o.items.map((function(o){return{amount:o.amount,attributes:o.attributes||[],countryOfOrigin:o.countryOfOrigin||undefined,currencyCode:o.currencyCode,description:o.description||"",imageUrl:o.imageUrl||"",itemType:o.itemType||"PHYSICAL_GOOD",measurements:o.measurements||[],name:o.name||o.description||"",productId:o.productId||"",quantity:o.quantity||0,sku:o.sku||""}}))||[];return{adjustments:o.adjustments,cartItems:e}};var fo=function(){return __awaiter(lo,void 0,void 0,(function(){var o,e,t;return __generator(this,(function(n){switch(n.label){case 0:return[4,F("/api/zonos-elements/get-store-discount-enabled-status")];case 1:o=n.sent(),e=o.errors,t=o.json;if(e.length||!(t===null||t===void 0?void 0:t.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var mo=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return true}if(i.isDisabledCountry){if(o){G("Checkout: disabled country")}return true}return false};var vo=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return false}if(!i.isShippableCountry){if(o){G("Checkout: not shippable country")}return false}return true};var zo=function(o){var e=o.domesticRedirectedBtnSelector,t=o.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var n=new MutationObserver((function(){return __awaiter(lo,void 0,void 0,(function(){var o,r,i,d,l;var h=this;return __generator(this,(function(f){o=document.querySelector(e);r=s();if(!o&&r){i=document.createElement("button");i.style.display="none";i.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(i);t===null||t===void 0?void 0:t(r);n.disconnect();return[2]}d=document.querySelector('select[name="shippingAddress.countryCode"]');l=document.querySelector("#checkout-shipping-continue");if(!d||!l){return[2]}n.disconnect();l.addEventListener("click",(function(o){return __awaiter(h,void 0,void 0,(function(){var e,t,n,r,i,s,l;return __generator(this,(function(h){n=d.value;if(!n){return[2]}c(n);if(!vo(false)){a();return[2]}r=document.querySelector("form");if(!r){return[2]}i=new FormData(r);s=document.querySelector("input#addressLine1Input");l={address1:(e=i.get("shippingAddress.address1"))!==null&&e!==void 0?e:s&&s.value,address2:i.get("shippingAddress.address2"),city:i.get("shippingAddress.city"),countryCode:i.get("shippingAddress.countryCode"),firstName:i.get("shippingAddress.firstName"),lastName:i.get("shippingAddress.lastName"),phone:i.get("shippingAddress.phone"),postalCode:i.get("shippingAddress.postalCode"),stateOrProvince:(t=i.get("shippingAddress.stateOrProvince"))!==null&&t!==void 0?t:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(l).some((function(o){return o===undefined||o===null}))){K("One or more shipping address field is missing",Object.entries(l));void V({endpoint:"No endpoint, domestic checkout form missing fields",errors:["Bigcommerce: One or more shipping address field is missing in the domestic checkout form",JSON.stringify(Object.entries(l))],metadata:{storeId:Z.storeId}});return[2]}u({address1:l.address1,address2:l.address2,city:l.city,countryCode:l.countryCode,firstName:l.firstName,lastName:l.lastName,phone:l.phone,postalCode:l.postalCode,state:l.stateOrProvince});o.preventDefault();o.stopPropagation();window.location.href="/";return[2]}))}))}));return[2]}))}))}));n.observe(document.body,{childList:true,subtree:true})};var po=0;var go=function(){return __awaiter(lo,void 0,void 0,(function(){var o,e;var t;return __generator(this,(function(n){switch(n.label){case 0:if(window.Zonos.loadTimeApiInfoList.length===0){return[2]}G("Sending bulk load time api log","info",{loadTimeApiInfoList:window.Zonos.loadTimeApiInfoList});o={data:__spreadArray([],window.Zonos.loadTimeApiInfoList,true),storeId:window.Zonos.storeId||0};window.Zonos.loadTimeApiInfoList.length=0;return[4,F("/api/zonos-elements/log-bulk-load-data",{body:o,method:"POST"})];case 1:e=n.sent().errors;if(e.length){(t=window.Zonos.loadTimeApiInfoList).push.apply(t,o.data);po++;if(po>5&&window.Zonos.logIntervalId){clearInterval(window.Zonos.logIntervalId)}}return[2]}}))}))};var ko=function(){return __awaiter(lo,void 0,void 0,(function(){var o,e;return __generator(this,(function(t){o=W().elapsedTime;e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:q},Y()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void F("/api/zonos-elements/log-script-load",{body:e,method:"POST"});return[2]}))}))};var wo=function(o){return __awaiter(lo,[o],void 0,(function(o){var e;var t=o.loadTime;return __generator(this,(function(o){e={cache:"miss",eventName:"jsdelivr",flag:"LOG_NATIVE_CHECKOUT_LOAD",href:window.location.href,loadTime:t,metadata:Object.assign({allLogs:q},Y()),scriptLoadUrl:"nativeCheckout",storeId:window.Zonos.storeId};void F("/api/zonos-elements/log-script-load",{body:e,method:"POST"});return[2]}))}))};var bo=function(o){return __awaiter(lo,[o],void 0,(function(o){var e,t,n,r,i;var s=o.cartId,c=o.retries;return __generator(this,(function(o){switch(o.label){case 0:e=J();return[4,F("/api/zonos-elements/get-temp-cart",{body:{isTestMode:e,options:{noOnlineStoreSettings:true},tempCartUUID:s},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:t=o.sent(),n=t.errors,r=t.json;i=!r||n.length;if(!(i&&c))return[3,3];G("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:c});return[4,new Promise((function(o){return setTimeout(o,500)}))];case 2:o.sent();return[2,bo({cartId:s,retries:c-1})];case 3:if(i){return[2,null]}return[2,r]}}))}))};var yo=function(o){return __awaiter(lo,void 0,void 0,(function(){var e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:e=io(o),t=e.isDgsCartId,n=e.isLegacyCartId;if(!n&&!t){K("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,bo({cartId:o,retries:5})];case 1:r=i.sent();G("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){K("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;return[2,{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var Co='<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>\n</svg>\n';var _o=".sc-zonos-checkout-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-checkout-h img.sc-zonos-checkout{max-width:100%}.sc-zonos-checkout-h dl.sc-zonos-checkout,.sc-zonos-checkout-h dd.sc-zonos-checkout,.sc-zonos-checkout-h h1.sc-zonos-checkout,.sc-zonos-checkout-h h2.sc-zonos-checkout,.sc-zonos-checkout-h h3.sc-zonos-checkout,.sc-zonos-checkout-h h4.sc-zonos-checkout,.sc-zonos-checkout-h h5.sc-zonos-checkout,.sc-zonos-checkout-h h6.sc-zonos-checkout,.sc-zonos-checkout-h hr.sc-zonos-checkout,.sc-zonos-checkout-h figure.sc-zonos-checkout,.sc-zonos-checkout-h p.sc-zonos-checkout,.sc-zonos-checkout-h pre.sc-zonos-checkout{margin:0}.sc-zonos-checkout-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-checkout-h *.sc-zonos-checkout{-ms-scroll-chaining:none;overscroll-behavior:contain}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar{width:10px}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}.sc-zonos-checkout-h *.sc-zonos-checkout::-webkit-scrollbar-thumb:hover{background:#d6d6d6}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;height:100%;overflow:hidden;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex:1;flex:1;padding:32px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{background-color:var(--zonos--primary-color, var(--zonos-elements-gray-0));border-right:1px solid var(--zonos-elements-gray-200)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{background-color:var(--zonos-elements-gray-0)}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:100%;max-height:100%;height:100%;overflow:auto;-ms-flex-direction:column;flex-direction:column;background-color:var(--zonos-elements-gray-0);-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding:24px;padding-bottom:50px}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--header.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;width:100%}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout .zonos--logo.sc-zonos-checkout{margin-bottom:0}.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout zonos-checkout-finish.sc-zonos-checkout{-ms-flex:1;flex:1}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{padding:0 8px 8px}.sc-zonos-checkout-h .zonos--left.sc-zonos-checkout .zonos--payment-error-banner.sc-zonos-checkout{margin-top:24px}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout{position:relative}.sc-zonos-checkout-h .zonos--right.sc-zonos-checkout .zonos--right-actions.sc-zonos-checkout{position:absolute;right:24px;top:24px;z-index:2;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--wrapper.sc-zonos-checkout{overflow:auto;max-height:100%;position:relative}.sc-zonos-checkout-h .flex--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-height:100%}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo-wrapper.sc-zonos-checkout>*.sc-zonos-checkout{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.sc-zonos-checkout-h .zonos--logo.sc-zonos-checkout img.sc-zonos-checkout{max-height:72px}.sc-zonos-checkout-h .zonos--checkout-default-message.sc-zonos-checkout{margin-left:76px;margin-bottom:8px}.zonos--close-button.sc-zonos-checkout{-ms-flex-item-align:start;align-self:flex-start}.preview.sc-zonos-checkout-h{min-width:500px;margin:auto;position:relative}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{border:var(--zonos-elements-border)}.preview.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{padding:32px}.hidden-mode.sc-zonos-checkout-h{height:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden;width:0;z-index:-1}.mobile.sc-zonos-checkout-h{min-width:auto}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:auto;border-radius:0;max-height:100%;height:100%;border:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding:12px;padding-bottom:76px}@media (max-width: 768px){.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout,.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{padding-bottom:0}}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--left.sc-zonos-checkout{-ms-flex-order:2;order:2;border-right:none}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout{-ms-flex-order:1;order:1;padding-top:16px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));background-color:var(--zonos-elements-gray-50);padding:12px;margin-top:32px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--review.sc-zonos-checkout{margin-bottom:0}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--right.sc-zonos-checkout .zonos--cart-items.sc-zonos-checkout{margin-top:8px}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout zonos-checkout-footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--wrapper.sc-zonos-checkout{max-height:100%}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--footer.sc-zonos-checkout{-ms-flex-order:3;order:3}.mobile.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout .zonos--done.sc-zonos-checkout{width:auto}.mobile.sc-zonos-checkout-h .zonos--cart-subtotal.sc-zonos-checkout{margin:0}.iframed.sc-zonos-checkout-h .zonos--content.sc-zonos-checkout{-ms-scroll-chaining:chained;overscroll-behavior:auto}";var xo=_o;var So=90*60*1e3;var Oo=6*60*60*1e3;var Ao=o("zonos_checkout",function(){function o(o){var t=this;e(this,o);this.onChangeLocaleListener=function(){};this.isRedirectAfterOrder=false;this.applyStripeTheme=function(){return __awaiter(t,void 0,void 0,(function(){var o,e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:r=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||Z.appearance.theme;return[4,d({overrideBorderRadius:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorPrimary,overrideSecondaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorSecondary,overrideTheme:this.isMobile?r:undefined,paypalEnabled:D()})];case 1:i.sent();return[2]}}))}))};this.checkStripePaymentIntentStatus=function(o){return __awaiter(t,[o],void 0,(function(o){var e,t,n,r,i,s,c,a,u;var d=o.triggeredButton;return __generator(this,(function(o){switch(o.label){case 0:e=d===null||d===void 0?void 0:d.matches("#".concat(so));t=!!window.Zonos.cartData;n=new URL(window.location.href).searchParams;r=n.get("payment_intent_client_secret");i=n.get("zonosCheckoutSessionId");if(!e){G("Checkout is triggered by user, no need to check stripe payment intent status");return[2,{shouldAllowOrder:true}]}G("Payment intent exist, checking stripe payment intent status");if(!r){G("No stripe client secret found in the URL, proceed to order if cart data is available");return[2,{shouldAllowOrder:t}]}return[4,l({clientSecret:r})];case 1:s=o.sent(),c=s.error,a=s.status;u=new URLSearchParams(window.location.search).get("redirect_status");if(u){if(!c){G("Payment intent is succeeded or in a good state to move forward, show success screen")}else{G("Payment intent failed, show status from error")}this.open=true;h.checkoutSessionId=i;f.clientSecret=r;void this.setToFinishStep(a);return[2,{shouldAllowOrder:false}]}if(!t){G("Cart data is not available, only check payment intent status, skip order.");return[2,{shouldAllowOrder:false}]}G("Payment intent is not succeeded, proceed to order");return[2,{shouldAllowOrder:true}]}}))}))};this.formatDate=function(o){if(!o){return""}var e=new Date(o);return e.toLocaleDateString()};this.formatTime=function(o){if(!o){return""}var e=new Date(o);return e.toLocaleTimeString()};this.getCurrentLocalePageEnum=function(){switch(h.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.getBaseCurrencySettlementInfo=function(){var o=h.selectedLandedCost;if(!o){return null}var e=o.landedCost.amountSubtotals;if(!e){return null}var t=(e.discounts||0)+e.items+e.landedCostTotal+e.shipping;return{settlementAmount:t}};this.getDefaultAddress=function(){if(t.defaultCustomerProfileAddress.length){return t.defaultCustomerProfileAddress}if(Array.isArray(t.defaultAddress)&&t.defaultAddress.length){return t.defaultAddress}if(!Array.isArray(t.defaultAddress)&&typeof t.defaultAddress==="object"){return[t.defaultAddress]}return t.defaultAddressParams};this.appearanceSettingsOverride=undefined;this.preview=false;this.hiddenMode=false;this.mobile=false;this.overrideStagingMode=undefined;this.defaultAddress=[];this.forceDialogOpen=false;this.defaultAddressParams=[];this.defaultCustomerProfileAddress=[];this.customerProfile=null;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.isIframed=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.isCartExpired=false;this.payInUsdConfirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null;this.clientSecret=f.clientSecret;this.stripeCustomerSessionClientSecret=f.stripeCustomerSessionClientSecret}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){e=o.detail;void m({adjustments:h.adjustments,cartItems:e});return[2]}))}))};o.prototype.handleKeyPress=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(o.key==="Escape"){void this.closeDialogHandler()}return[2]}))}))};o.prototype.closeDialogHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(n){if(!this.open){return[2]}if(!(o===null||o===void 0?void 0:o.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;U("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&h.step==="finish"){v()}h.step="customer-info";z();p();(t=(e=Z.checkoutSettings).onClose)===null||t===void 0?void 0:t.call(e);return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n,r,s,c,a,s,c,c,u,d,s,l;return __generator(this,(function(f){switch(f.label){case 0:if(!(typeof Z.checkoutSettings.createCartId==="function"))return[3,4];G('"createCartId" is provided, start building cart');return[4,Z.checkoutSettings.createCartId()];case 1:o=f.sent();e=void 0;if(typeof o==="object"){G("object detected, use cartId and prefill address from createCartId");e=o.cartId;this.useShippingDataFromCreateCartId(o.shippingData);h.customerAuthenticationToken=o.customerAuthenticationToken||null}else{e=o}window.Zonos.cartId=e;return[4,yo(e)];case 2:t=f.sent();n=t===null||t===void 0?void 0:t.cartData;if(!n){K("Failed to build cart, please try again.");return[2,false]}window.Zonos.cartData=n;r=ho(n),s=r.adjustments,c=r.cartItems;return[4,m({adjustments:s,cartItems:c})];case 3:f.sent();return[3,9];case 4:if(!window.Zonos.cartData)return[3,6];G("tempCartUUID is provided, start building cart");a=ho(window.Zonos.cartData),s=a.adjustments,c=a.cartItems;return[4,m({adjustments:s,cartItems:c})];case 5:f.sent();return[3,9];case 6:if(!(Z.checkoutSettings.buildCartDetail&&i.selectedCountryCode))return[3,9];G("build cart detail");return[4,Z.checkoutSettings.buildCartDetail({countryCode:i.selectedCountryCode,currencyCode:i.targetCurrency})];case 7:c=f.sent();u=c.filter((function(o){return o.amount>=0}));d=c.filter((function(o){return o.amount<0}));s=d.map((function(o){return{amount:o.amount,currencyCode:o.currencyCode,description:o.name||o.description||"",productId:o.productId||null,sku:o.sku||null,type:"CART_TOTAL"}}));return[4,m({adjustments:s,cartItems:u})];case 8:f.sent();f.label=9;case 9:if(!!h.checkoutSessionId)return[3,11];return[4,g()];case 10:l=f.sent();G("stripeStoreInitCheckoutSession: ".concat(l));if(!l){return[2,false]}f.label=11;case 11:if(!h.isStagingMode){void k()}return[4,this.applyStripeTheme()];case 12:f.sent();this.isRedirectAfterOrder=Z.checkoutSettings.successBehavior==="REDIRECT_TO_SUCCESS_PAGE"||!!h.externalConfirmationPageURL;return[2,true]}}))}))};o.prototype.reloadCheckoutSession=function(){window.location.reload()};o.prototype.handleOrderDuplication=function(){var o=Q(localStorage.getItem("zonos--placed-order-info"));if(!o){localStorage.removeItem("zonos--placed-order-info");return}var e=Date.now()-o.time;G("=== Existing placed order info: ".concat(o.orderId," - ").concat(this.formatDate(o.time)," - elapsed in hh:ss format: ").concat(new Date(e).toISOString().substring(11,8)),"warn");var t=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||Oo;if(e>t){G("=== Existing placed order info is older than ".concat(t,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=o;G("=== Showing order duplication confirmation","warn")};o.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null;if(!h.checkoutSessionId){return}void F("/api/zonos-elements/update-checkout-session-metadata",{body:{id:h.checkoutSessionId,metadata:[{key:"orderDuplicationConsent",value:"1"}]},method:"POST"})};o.prototype.handleCancelOrderDuplication=function(){var o;this.placedOrderInfo=null;if(this.isLegacyCheckout){var e=((o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl)||Z.onlineStoreSettings.url;if(!e){return}if(window.parent){window.parent.location.href=e}window.location.href=e;return}void this.closeDialogHandler({confirmed:true})};o.prototype.attachCheckout=function(){var o=this;var e=Z.checkoutSettings.placeOrderButtonSelector;var t=Z.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;G("attach checkout ".concat(e));G("attach checkout to always trigger international checkout selector: ".concat(t));if(!e&&!t&&!window.Zonos.cartData){return}var n=[e,t,"#".concat(ao),"#".concat(so),"#".concat(co)].filter(Boolean);var r=document.querySelectorAll(n.join(","));r.forEach((function(n){var r=n.getAttribute("data-zonos-checkout-attached");if(r){return}G("attached event to button ".concat(e),"info",{button:n});n.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,r,i,s,c,a,u,d,l,m,v,z,p;return __generator(this,(function(g){switch(g.label){case 0:r=performance.now();i=t&&n.matches(t);s=n.matches("#".concat(co));c=n.matches("#".concat(ao))||n.matches("#".concat(so));if(!window.Zonos.isLegacyCheckout&&(!vo()||mo())&&!i&&!s&&!c){return[2]}e.preventDefault();e.stopPropagation();G("zonos checkout button clicked");return[4,this.checkStripePaymentIntentStatus({triggeredButton:e.target})];case 1:a=g.sent().shouldAllowOrder;if(!a){return[2]}if(!window.Zonos.logIntervalId){window.Zonos.logIntervalId=setInterval((function(){void go()}),2e3)}f.isFetchingSession=true;this.open=true;g.label=2;case 2:g.trys.push([2,5,,6]);return[4,this.buildCartAndInit()];case 3:u=g.sent();if(!u){throw new Error("Error building cart")}w({isPreview:this.preview,sessionTimeout:So});U("zonos-checkout-start");d=h.checkoutSessionId;void b({checkoutSessionId:d,eventName:"checkout_open"});return[4,fo()];case 4:l=g.sent().enabled;h.shouldHideDiscountInput=!l;this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void ko()}else{m=performance.now();v=m-r;void wo({loadTime:v})}return[3,6];case 5:z=g.sent();if(z instanceof Error){p=z.message;if(p==="Cart is expired."){this.isCartExpired=true;return[2]}}f.isFetchingSession=false;K(z);if(this.isCartExpired){return[2]}void V({endpoint:"Error creating Checkout",errors:[z instanceof Error?z.toString():"Unknown error"],metadata:{allLogs:q,cartId:window.Zonos.cartId,checkoutSessionBody:y(),href:window.location.href,storeBaseUrl:((o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl)||Z.onlineStoreSettings.url}});C({messages:[_("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:_("Error creating Checkout")});return[3,6];case 6:return[2]}}))}))}),{capture:true,passive:false});if(!Z.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches("#".concat(ao))){n.dispatchEvent(eo("click"));a();n.remove()}if(n.matches("#".concat(so))){n.dispatchEvent(eo("click"));n.remove()}}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.useShippingDataFromCreateCartId=function(o){if(!o){return}G("shipping data from createCartId result","info",Object.entries(o));var e=o.customerAddress1,t=o.customerAddress2,n=o.customerCity,r=o.customerCountry,s=o.customerEmail,c=o.customerName,a=o.customerPhone,u=o.customerState,d=o.customerZip;var l=new URLSearchParams(window.location.search);var h=r||x(l)||i.selectedCountryCode;this.applyPrefillAddress({customerAddress1:e,customerAddress2:t,customerCity:n,customerCountry:h,customerEmail:s,customerName:c,customerPhone:a,customerState:u,customerZip:d})};o.prototype.useLegacyQueryParams=function(){var o=new URLSearchParams(window.location.search);G("legacy urlParams","info",Object.fromEntries(o.entries()));var e=function(e){var t=o.get(e);if(!t||t==="undefined"){return null}return t};var t=x(o)||i.selectedCountryCode;var n=e("customerCity");var r=e("customerEmail");var s=e("customerAddress1");var c=e("customerAddress2");var a=e("customerName");var u=e("customerPhone");var d=e("customerZip");var l=e("customerState");this.applyPrefillAddress({customerAddress1:s,customerAddress2:c,customerCity:n,customerCountry:t,customerEmail:r,customerName:a,customerPhone:u,customerState:l,customerZip:d})};o.prototype.applyPrefillAddress=function(o){var e=o.customerAddress1||"";var t=o.customerCountry||"";var n=o.customerAddress2||"";var r=o.customerCity||"";var s=o.customerEmail||"";var c=o.customerName||"";var a=o.customerPhone||"";var u=o.customerZip||"";var d=o.customerState||"";if(!e||!c||!a||!t){G("Missing required query params so it can not be prefilled","info",[!e&&"line1",!c&&"name",!a&&"phone",!t&&"country"].filter(Boolean).join(", "));return}if(t&&i.shippingZoneCountries&&!(t in i.shippingZoneCountries)){G('Country "'.concat(t,'" is not in the shipping zone, so it can not be prefilled'),"warn");return}this.defaultAddressParams=[{address:{city:r||"",country:t,line1:e,line2:n,postal_code:u,state:d},email:s,name:c,phone:a}];G("Prefill address applied","info",{prefillAddress:this.defaultAddressParams,providedAddress:o})};o.prototype.overrideStagingModeChanged=function(){h.isStagingMode=!!this.overrideStagingMode};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(t){f.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;h.isStagingMode=X();if(typeof this.overrideStagingMode!=="undefined"){h.isStagingMode=this.overrideStagingMode}zo({domesticRedirectedBtnSelector:ao,onShippingAddressSessionFound:function(o){e.defaultAddress=[{address:{city:o.city,country:o.countryCode,line1:o.address1,line2:o.address2,postal_code:o.postalCode,state:o.state},email:"",name:"".concat(o.firstName," ").concat(o.lastName),phone:o.phone}]}});if(window.Zonos){this.useLegacyQueryParams()}o=setInterval((function(){f.stripe=window.Zonos.stripe;e.stripe=window.Zonos.stripe;if(!e.stripe){G("waiting for stripe to be loaded");return}if(e.storybookPaymentStatusOverride){clearInterval(o);return}G("init checkout");if(e.preview||e.forceDialogOpen){void e.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){e.attachCheckout()}else if(window){e.attachCheckout();var t=new MutationObserver((function(){e.attachCheckout()}));t.observe(document.body,{childList:true,subtree:true})}clearInterval(o)}),50);setTimeout((function(){clearInterval(o)}),1e4);return[2]}))}))};o.prototype.setToFinishStep=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){h.step="finish";this.storybookPaymentStatusOverride=o;return[2]}))}))};o.prototype.mockCheckoutSession=function(o){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){S(o);return[2]}))}))};o.prototype.triggerCheckoutInternational=function(){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(e){o=document.querySelector("#".concat(co));if(o){o.dispatchEvent(eo("click"))}return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e;var t=this;return __generator(this,(function(n){switch(n.label){case 0:U("zonos-checkout-customer-info");o=h.checkoutSessionId;void b({checkoutSessionId:o,eventName:"checkout_customerInfoCompleted"});this.submitLoading=true;return[4,O()];case 1:n.sent();e=setInterval((function(){if(h.landedCostData||!f.isFetchingLandedCost){if(h.landedCostData){void N({currency:h.currency});A()}t.submitLoading=false;clearInterval(e)}}),500);return[2]}}))}))};o.prototype.handleShippingContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o=this;return __generator(this,(function(e){this.submitLoading=true;setTimeout((function(){A();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleInventoryCheckDialogConfirm=function(){h.inventoryCheckErrorMessage=null;if(!this.isLegacyCheckout){void this.closeDialogHandler({confirmed:true})}};o.prototype.handleCartExpiredDialogConfirm=function(){var o;this.isCartExpired=false;if(this.isLegacyCheckout){var e=(o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl;if(!e){return}if(window.parent){window.parent.location.href=e}window.location.href=e;return}if(window.parent){window.parent.location.href=window.location.href}window.location.reload()};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n,r;return __generator(this,(function(i){switch(i.label){case 0:o=f.checkoutSettlementCurrency==="USD";if(o&&f.shouldRenderPayInUsdButton&&!this.payInUsdConfirmDialogOpen){this.payInUsdConfirmDialogOpen=true;return[2]}this.payInUsdConfirmDialogOpen=false;R.paypalErrorMessage=null;f.hasPaymentError=false;this.submitLoading=true;h.inventoryCheckErrorMessage=null;return[4,I()];case 1:e=i.sent();if(!e){f.hasPaymentError=true;f.customErrorMessage=_("Unable to complete payment in [currency]. Please try again or select a different currency. If the issue persists, contact our support team for assistance.",{currency:f.checkoutSettlementCurrency});this.submitLoading=false;return[2]}i.label=2;case 2:i.trys.push([2,4,,5]);t=h;return[4,T()];case 3:t.inventoryCheckErrorMessage=i.sent();return[3,5];case 4:n=i.sent();h.inventoryCheckErrorMessage=_("Unable to check inventory. Please try again.");return[3,5];case 5:if(h.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}i.label=6;case 6:i.trys.push([6,8,,9]);return[4,P()];case 7:i.sent();A();p();return[3,9];case 8:r=i.sent();K(r);U("zonos-checkout-payment-fail");f.hasPaymentError=true;if(f.shouldInventoryRefund){void j();f.shouldInventoryRefund=false}return[3,9];case 9:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,t,n;return __generator(this,(function(r){switch(r.label){case 0:L();if(!this.preview)return[3,2];h.step="customer-info";return[4,this.init()];case 1:r.sent();return[2];case 2:v();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){o=window.Zonos.cartData.storeBaseUrl||Z.onlineStoreSettings.url;if(window.parent){window.parent.location.href=o}window.location.href=o;return[2]}e=window.location.href;t=e.split("?")[0];this.open=false;n=window.location.hostname.includes("dashboard.zonos.com");if(!n){window.history.replaceState(window.history.state,document.title,t);window.location.reload()}return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=$(this.mobile);void this.applyStripeTheme();G("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=$(this.mobile);void this.applyStripeTheme();G("mobile: ".concat(this.isMobile))};o.prototype.handleAppearanceSettingsOverrideChange=function(){var o;if((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme){this.appearanceSettingsOverride.theme=H(this.appearanceSettingsOverride.theme)}};o.prototype.handleAddressChange=function(){L()};o.prototype.handleCustomerProfileChange=function(){var o,e;if(!this.customerProfile){G("No customer profile","info");this.defaultCustomerProfileAddress=[];return}G("Customer profile found","info",{customerProfile:this.customerProfile});this.defaultCustomerProfileAddress=((e=(o=f.customerProfile)===null||o===void 0?void 0:o.locations)===null||e===void 0?void 0:e.map((function(o){var e;return{address:{city:o.locality,country:o.countryCode,line1:o.line1,line2:o.line2||"",postal_code:o.postalCode,state:o.administrativeArea},email:o.email||((e=f.customerProfile)===null||e===void 0?void 0:e.email)||"",name:o.name||"",phone:o.phone||""}})))||[]};o.prototype.handleClientSecretChange=function(){G("==== Client secret changed","info",{clientSecret:this.clientSecret,stripeCustomerSessionClientSecret:this.stripeCustomerSessionClientSecret});void this.applyStripeTheme()};o.prototype.handleOpenChange=function(){var o="data-zonos-overflow-origin";var e=document.body;var t=document.documentElement;if(this.open){if(e.style.overflow){e.setAttribute(o,e.style.overflow)}e.style.overflow="hidden";if(t.style.overflow){t.setAttribute(o,t.style.overflow)}t.style.overflow="hidden"}else{this.stripeCustomerSessionClientSecret=null;var n=e.getAttribute(o);var r=t.getAttribute(o);if(n){e.removeAttribute(o);e.style.overflow=n}else{e.style.removeProperty("overflow")}if(r){t.removeAttribute(o);t.style.overflow=r}else{t.style.removeProperty("overflow")}}};o.prototype.componentWillLoad=function(){var o=this;void this.init();this.isMobile=$(this.mobile);this.isIframed=window.self!==window.top;G("iframed: ".concat(this.isIframed));this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=E("selectedLocale",(function(){void o.applyStripeTheme()}));G("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){L();v();this.onChangeLocaleListener()};o.prototype.render=function(){var o=this;var e,s,c,a;this.customerProfile=f.customerProfile;this.clientSecret=f.clientSecret;if(f.stripeCustomerSessionClientSecret){this.stripeCustomerSessionClientSecret=f.stripeCustomerSessionClientSecret}var u=h.step!=="finish"&&h.step!=="error"&&!f.stripeElements||f.isFetchingSession;var d=M(Z.appearance,this.appearanceSettingsOverride||null),l=d.colorPrimary,m=d.colorSecondary,v=d.logoUrl,z=d.style;var p=Z.appearance.zonosAttribution==="ENABLED";var g=Z.appearance.theme;var k=l&&no(l)?"DARK":"LIGHT";var w=this.isMobile?g:k;var b=!this.isMobile?m:undefined;var y=i.customMessages;var C=(e=y.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message;var x=this.getCurrentLocalePageEnum();var S=y.filter((function(o){return o.pageName===x}));var O=this.getBaseCurrencySettlementInfo();var A=function(){var e=o.preview?"".concat(v,"?timestamp=").concat(Date.now()):v;return t("div",{class:"zonos--logo"},e&&t("img",{alt:"".concat(Z.organizationName," logo"),src:e}))};var I=J();var T=function(){var e=new URLSearchParams(window.location.search);var n=e.get("zonosQaUrl");var r=e.get("zonosDebug");var i=e.get("zonosE2ETest");var s=o.overrideStagingMode||X();return t("zonos-v-stack",null,t("div",{class:"zonos--logo-wrapper"},A(),I&&t("zonos-badge",{badgeColor:"orange",size:"small"},_("Test mode")),s&&t("zonos-badge",{badgeColor:"red",size:"small"},_("Staging mode")),r==="1"&&t("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),n&&t("zonos-badge",{badgeColor:"purple",size:"small"},n),i&&t("zonos-badge",{badgeColor:"gray",size:"small"},"E2E Test")),t("zonos-checkout-progress-tabs",{backgroundColor:o.isMobile?"--zonos-elements-gray-0":null}),S.map((function(o){return t("zonos-custom-message",{icon:Co,message:o.message})})))};var P=function(){if(h.checkoutSessionTimeoutShow){return t("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:_("Your checkout session has expired. Please reload the page to continue."),restStateTitle:_("Session timed out"),restStateType:"Warning"},t("zonos-button",{onClick:function(){return o.reloadCheckoutSession()},variant:"primary"},_("Reload")))}return t("div",{class:"zonos--content",style:{"--zonos--border-radius":to({overrideBorderStyle:z})}},h.step!=="finish"&&h.step!=="error"&&t(r,null,t("div",{class:"zonos--left","data-theme":w,style:ro({"--zonos--primary-color":!o.isMobile?l:undefined})},!o.isMobile&&T(),h.step==="customer-info"&&t("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.getDefaultAddress(),isMobile:o.isMobile,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:b}),h.step==="shipping"&&t("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:b}),h.step==="payment"&&t("zonos-checkout-payment",{continueLoading:o.submitLoading,isMobile:o.isMobile,onContinueClicked:function(){return __awaiter(o,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,this.handleStripePaymentContinue()];case 1:o.sent();return[2]}}))}))},submitBtnColor:b})),t("div",{class:"zonos--right","data-theme":g},o.isMobile&&T(),t("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&t("zonos-currency-toggle",null),!o.isLegacyCheckout&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:uo}),noBackground:true,onClick:function(){return o.closeDialogHandler()}})),t("div",{class:"flex--wrapper"},t("div",{class:"zonos--wrapper"},t("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile}}),t("zonos-collapse",{collapsed:o.collapseReviewMobile&&o.isMobile},t("zonos-cart-items",null),o.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",{submitBtnColor:b}),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Co,message:C})))),t("zonos-cart-restricted-items",null),!o.isMobile&&t("zonos-v-stack",{spacing:16},t("zonos-cart-subtotal",null),t("zonos-custom-message",{class:"zonos--checkout-default-message",icon:Co,message:C}))))),(h.step==="finish"||h.step==="error")&&t("div",{class:"zonos--done","data-theme":g},t("div",{class:"zonos--header"},A(),!o.isRedirectAfterOrder&&t("zonos-button",{class:"zonos--close-button",icon:t("zonos-icon",{"aria-label":"Close checkout dialog",content:uo}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:g})),t("zonos-checkout-finish",{borderRadius:z,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:h.step==="error"&&!!h.error?Object.assign(Object.assign({},h.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),t("zonos-checkout-footer",{"data-theme":g,mobile:o.isMobile,slot:!o.isMobile?"dialog-footer":undefined}))};return t(n,{class:oo(["zonos--checkout zonos--elements",p&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile",this.isIframed&&"iframed",this.hiddenMode&&"hidden-mode"])},this.preview?P():t("zonos-dialog",{borderStyle:z,"data-theme":g,height:"980px",isLoading:u,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeDialogHandler()},open:this.open,width:"1200px"},P()),t("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:_("Don't close"),dialogConfirmBtnText:_("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:_("Would you like to close checkout and return to the site?"),dialogTitle:_("Are you sure?"),onCancelClicked:function(){o.confirmDialogOpen=false},onConfirmClicked:function(){return o.closeDialogHandler({confirmed:true})}}),t("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:_("Return to merchant site"),dialogConfirmBtnText:_("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((s=this.placedOrderInfo)===null||s===void 0?void 0:s.zonosOrderNumber)?_("It looks like you placed an order recently ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?",{date:this.formatDate(this.placedOrderInfo.time),orderNumber:this.placedOrderInfo.zonosOrderNumber,time:this.formatTime(this.placedOrderInfo.time)}):_("It looks like you placed an order recently ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?",{date:this.formatDate(((c=this.placedOrderInfo)===null||c===void 0?void 0:c.time)||null),time:this.formatTime(((a=this.placedOrderInfo)===null||a===void 0?void 0:a.time)||null)}),dialogTitle:_("Are you sure?"),dialogWidth:530,onCancelClicked:function(){o.handleCancelOrderDuplication()},onConfirmClicked:function(){o.confirmProceedWithOrderDuplication()}}),t("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:_("Return to cart"),dialogIntent:"danger",dialogOpen:!!h.inventoryCheckErrorMessage,dialogSubtitle:h.inventoryCheckErrorMessage,dialogTitle:_("Couldn't place order"),dialogType:"alert",onConfirmClicked:function(){return o.handleInventoryCheckDialogConfirm()}}),O&&t("zonos-confirm-dialog",{class:"zonos--pay-in-usd-dialog",dialogCancelBtnText:_("Cancel"),dialogConfirmBtnText:_("Pay [orderTotal]",{orderTotal:B({amount:O.settlementAmount,currency:"USD"})}),dialogIntent:"warn",dialogOpen:this.payInUsdConfirmDialogOpen,dialogSubtitle:_("By paying in USD, your card will be charged directly with no currency conversion. However, using a non-USD based card may result in additional currency conversion fees at the bank level."),dialogTitle:_("Pay in USD (United States Dollar)?"),dialogType:"confirm",dialogWidth:480,onCancelClicked:function(){o.payInUsdConfirmDialogOpen=false},onConfirmClicked:function(){return o.handleStripePaymentContinue()}}),t("zonos-confirm-dialog",{class:"zonos--shopping-cart-expired-dialog",dialogConfirmBtnText:_("OK"),dialogIntent:"danger",dialogOpen:this.isCartExpired,dialogSubtitle:_("You are being sent back to the shop to re-add items to your cart."),dialogTitle:_("Shopping cart expired"),dialogType:"alert",onConfirmClicked:function(){return o.handleCartExpiredDialogConfirm()}}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],overrideStagingMode:["overrideStagingModeChanged"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"],customerProfile:["handleCustomerProfileChange"],clientSecret:["handleClientSecretChange"],stripeCustomerSessionClientSecret:["handleClientSecretChange"],open:["handleOpenChange"]}},enumerable:false,configurable:true});return o}());Ao.style=xo}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as o,H as s}from"./p-c137dc82.js";import{W as t,r as a,l as n}from"./p-
|
|
1
|
+
import{r as e,h as o,H as s}from"./p-c137dc82.js";import{W as t,r as a,l as n}from"./p-4cd867d5.js";import{d as l}from"./p-337fab4e.js";import{l as i}from"./p-97aceb11.js";import"./p-0fc02cde.js";import"./p-4593324c.js";import"./p-b8d87932.js";const c=class{constructor(o){e(this,o),this.languageSelected=e=>{t(e),this.handleOnClose()},this.handleOnClose=()=>{}}render(){const{selectedLocale:e}=n;return o(s,{key:"cc711dba7371852eab6e20994389ae3b95bb3be7",class:"zonos--elements",style:{"--zonos--font-family":l()}},o("div",{key:"47135e2b7363a3179139a7b8e23cb22435ce3299",class:"zonos--language-select"},o("zonos-select-dialog-header",{key:"3bf830e585fa6478f560c57dfa978721af47ad19",handleOnClose:()=>this.handleOnClose(),label:a("Select a language")}),o("div",{key:"f693b231755087ec849f5a759b2dc43e2695b24f",class:"zonos--language-select-content"},i.map((s=>o("button",{class:"zonos--language-select-button",onClick:()=>this.languageSelected(s.code)},o("zonos-text",{textColor:"gray-800"},s.translatedLabel),s.code===e&&o("zonos-icon",{content:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.99996 2.6665C5.05444 2.6665 2.66663 5.05432 2.66663 7.99984C2.66663 10.9454 5.05444 13.3332 7.99996 13.3332C10.9455 13.3332 13.3333 10.9454 13.3333 7.99984C13.3333 5.05432 10.9455 2.6665 7.99996 2.6665Z" fill="#AFF8C3"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M10.1403 6.10535C10.3582 6.27488 10.3975 6.58902 10.228 6.80699L8.01055 9.65797C7.76436 9.97449 7.29646 10.0036 7.01291 9.72008L5.81307 8.52024C5.61781 8.32498 5.61781 8.0084 5.81307 7.81314C6.00833 7.61787 6.32492 7.61787 6.52018 7.81314L7.45301 8.74597L9.43862 6.19305C9.60815 5.97508 9.92229 5.93581 10.1403 6.10535Z" fill="#246627"/>\n</svg>\n',size:16})))))))}};c.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--language-select{width:100%}:host .zonos--language-select .zonos--language-select-content{display:grid;grid-template-columns:repeat(3, minmax(-webkit-max-content, 1fr));grid-template-columns:repeat(3, minmax(max-content, 1fr));padding:16px;padding-top:0px}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button{display:-ms-flexbox;display:flex;padding:8px;gap:4px;-ms-flex-align:center;align-items:center;border-radius:var(--zonos-elements-radius-4);cursor:pointer;width:100%;border:none;background:none}:host .zonos--language-select .zonos--language-select-content .zonos--language-select-button:hover{background:var(--zonos-elements-gray-100)}@media (max-width: 400px){:host .zonos--language-select .zonos--language-select-content{grid-template-columns:1fr 1fr}}";const d=class{constructor(o){e(this,o),this.handleOnClose=()=>{},this.label=""}render(){return o(s,{key:"15035421483b079dde47eeb3ddcb4dcc6edffae4",class:"zonos--elements",style:{"--zonos--font-family":l()}},o("zonos-v-stack",{key:"bf1bbdb1bb8a62841616893d8e9005002772adc4",class:"zonos--select-dialog-header-wrapper",spacing:8},o("div",{key:"a2593795816ceb851489c386231a1b90e6dd6261",class:"zonos--select-dialog-header"},o("zonos-text",{key:"e91d4a54ac0deb073c30272c5e9626168fea52b7",type:"boldLabel"},this.label),o("zonos-button",{key:"e8fdf75686b33e9958f64925ddf95fb5c89d74bb",class:"zonos--close-button",icon:o("zonos-icon",{"aria-label":"Close select dialog",content:'<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>',size:20}),noBackground:!0,onClick:()=>this.handleOnClose()})),o("slot",{key:"ede6d09a4f6900419bf16df0ca8a2b79882bf266"})))}};d.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--select-dialog-header-wrapper{position:-webkit-sticky;position:sticky;top:0;background:var(--zonos-elements-surface-color);padding:16px}:host .zonos--select-dialog-header-wrapper .zonos--select-dialog-header{position:relative;-ms-flex-pack:justify;justify-content:space-between;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}";export{c as zonos_language_select,d as zonos_select_dialog_header}
|