@zonos/elements 1.3.110 → 1.3.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cjs/{CheckoutConfig-c97f0f83.js → CheckoutConfig-5d7cf0c0.js} +19 -2
  2. package/dist/cjs/index.cjs.js +8 -8
  3. package/dist/cjs/zonos-checkout.cjs.entry.js +1 -1
  4. package/dist/collection/scripts/cart/_getIsValidCartId.js +15 -0
  5. package/dist/collection/scripts/cart/_setupCartData.js +4 -2
  6. package/dist/esm/{CheckoutConfig-4d2a508c.js → CheckoutConfig-32f33d8b.js} +19 -2
  7. package/dist/esm/index.js +9 -9
  8. package/dist/esm/zonos-checkout.entry.js +1 -1
  9. package/dist/esm-es5/CheckoutConfig-32f33d8b.js +1 -0
  10. package/dist/esm-es5/index.js +1 -1
  11. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  12. package/dist/scripts/index.js +1 -1
  13. package/dist/scripts/loadZonos.js +1 -1
  14. package/dist/scripts/zonos.js +1 -1
  15. package/dist/types/scripts/cart/_getIsValidCartId.d.ts +4 -0
  16. package/dist/zonos-elements/index.esm.js +1 -1
  17. package/dist/zonos-elements/p-33b57fab.system.js +1 -0
  18. package/dist/zonos-elements/p-56d405d0.js +1 -0
  19. package/dist/zonos-elements/{p-281e9a06.system.js → p-5929ba9e.system.js} +1 -1
  20. package/dist/zonos-elements/{p-cf69d8c2.system.entry.js → p-a828799f.system.entry.js} +1 -1
  21. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  22. package/dist/zonos-elements/{p-505f92e7.entry.js → p-ddcbf41d.entry.js} +1 -1
  23. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  24. package/package.json +1 -1
  25. package/dist/esm-es5/CheckoutConfig-4d2a508c.js +0 -1
  26. package/dist/zonos-elements/p-272121e2.js +0 -1
  27. package/dist/zonos-elements/p-64f0fcce.system.js +0 -1
@@ -1 +1 @@
1
- (function(){"use strict";function e(e,o){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)o.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(n[r[t]]=e[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],n=o[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=r[n],s=(e=n)=>{const r=o.indexOf(e),t=o[r+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=performance.now(),c=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},l=(e,o,...n)=>{var r,t;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...i));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(t=l.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},d=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(l("sendErrorLog","warn",e,n,o),i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}},u=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:c}}const d=s.status.toString();try{const e=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:d}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:c}}},m=async({basePathType:o,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":o,g=await u({basePathType:p,options:n,path:t}),{errors:w,response:f}=g,h=e(g,["errors","response"]),y=s(p),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==f?void 0:f.status),S=y&&v;return v&&d({endpoint:r[p]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:p,nextFallbackApiType:y,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(l(`=== "${t}" failed to fetch, trying next fallback ${y}`),m({basePathType:y,options:n,path:t})):Object.assign({errors:w,response:f},h)},g=async(o,r)=>{const t=e(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return l(o,"info"),m({basePathType:d||n,options:c,path:o})},w=(e,...o)=>{l(e,"error",...o)},f=["jsdelivr","cdnjs","unpkg","vercel"],h=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},y=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:t}=await g("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),s=!t||r.length;return s&&o?(l("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,1e3))),y({cartId:e,retries:o-1})):s?null:t};var v;const S=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=h(window.location.href),n="https://v1.3.110.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),z=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=h(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const r=`https://${e}.route.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class L{static get isNpm(){return!1}}v=L,L.isBigCommerce=!1,L.requested=!1,L.cartData=null,L.isLegacyCheckout=!1,L.legacyStoreLogo=null,L.legacyStoreFavicon=null,L.parallelLoadTimes=[],L.parallelLoadState="off",L.releaseDate="1730134797438",L.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},r)))}catch(e){}},L.loadScriptLogParallelHandler=async e=>{try{if(v.parallelLoadTimes.push(e),2===v.parallelLoadTimes.length){const e=v.parallelLoadTimes.find((e=>"vercel"===e.type)),o=v.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void d({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});v.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},L.legacyCheckoutErrorHandler=({message:e})=>{w(`[ZONOS - loadZonos] ${e}`),d({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:v.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},L.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.110";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.110":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.110");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},L.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;const i="vercel"===e?r:v.getGithubCdn({type:e,version:t}),a=S||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,l(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n})())||void 0===s?void 0:s.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=f[0]===e,h=f[1],y="on"===v.parallelLoadState&&m&&w&&h&&!g;y&&v.injectZonos({cdnType:h,initConfig:o,parallelLoaded:!0,vercelUrl:r,version:t});const L=performance.now();p.addEventListener("load",(()=>{var r;if(y||n?v.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-L,scriptLoadUrl:p.src,storeId:v.storeId,type:e}):v.loadScriptLogHandler({fallbackLoadTime:performance.now()-L,scriptLoadUrl:p.src,storeId:v.storeId,type:e}),v.isBigCommerce||(v.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=S,window.Zonos.zonosQaUrlApi=z,window.Zonos.isBigCommerce=v.isBigCommerce,v.cartId){if(!v.zonosApiKey)throw v.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!v.cartData)throw v.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(v.legacyStoreFavicon&&v.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=v.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=v.cartData,window.Zonos.isLegacyCheckout=v.isLegacyCheckout;const e=v.isLegacyCheckout&&"CLOSE_MODAL"===(null===(r=o.checkoutSettings)||void 0===r?void 0:r.successBehavior),n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:v.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:e?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:e?v.cartData.storeBaseUrl:void 0}),zonosApiKey:v.zonosApiKey});o=n}window.Zonos.version&&(l(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=f.indexOf(e);return f[o+1]||null})(e);if(!y&&!n){if(!s)return;v.injectZonos({cdnType:s,initConfig:o,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||S)return;if(y||n)return void v.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-L,isError:!0,scriptLoadUrl:p.src,storeId:v.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?d({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-L,cdnType:e,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):d({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-L}})})),document.head.appendChild(p)},L.init=async e=>{var o;v.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const n="https://v1.3.110.js.zonos.com",r=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src;l(`[ZONOS - init] first load script src: ${t}`,"info"),window.Zonos.zonosQaUrl=S,window.Zonos.zonosQaUrlApi=z,window.Zonos.zonosQaUrl&&l(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&l(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const s=null==t?void 0:t.includes("timestamp=");if(!(v.isNpm||t&&s))return void w("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(r||!t||v.requested)return void l("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!v.cartId)return v.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void w("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(v.requested=!0,v.zonosApiKey=e.zonosApiKey,v.storeId=e.storeId,v.cartId){const e=await(async e=>{if("cart_"===e||!e)return w("[ZONOS - loadZonos] Error due to bad cart id"),null;const o=await y({cartId:e,retries:5});return l("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(w("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(v.cartId);if(!e)throw v.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");v.cartData=e.cartData,v.zonosApiKey=e.zonosApiKey,v.legacyStoreLogo=e.storeLogo,v.legacyStoreFavicon=e.storeFavicon,v.storeId=e.storeId,v.zonosApiKey=e.zonosApiKey}if(!v.zonosApiKey)return void w('"zonosApiKey" is required to initialize Zonos');if(!v.storeId)return l("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void v.injectZonos({initConfig:e,vercelUrl:n,version:null});const i=v.storeId||e.storeId;l(`[ZONOS - loadZonos] Store ID: ${i}`,"info");const a=new URLSearchParams;a.set("storeId",i.toString());const{errors:c,json:d}=await g(`/api/get-store-version?${a.toString()}`);if(c.length||!d)return l("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void v.injectZonos({initConfig:e,vercelUrl:n,version:null});const{isDifferent:p,source:u,version:m}=d;if(l(`[ZONOS - loadZonos] Store version: ${m}, source: ${u}`,"info"),p){l(`[ZONOS - loadZonos] Updating saved store version to ${m}`,"info");const e={storeId:i,version:m};g(`/api/set-store-version?${a.toString()}`,{body:e,method:"POST"}).catch((e=>w("Unable to save store's vesrion",e)))}if(!r){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:t}),s=r&&!n?o:`${"alpha"===m?"alpha":`v${m}`}.js.zonos.com`,i=r&&!n?null:m;l("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:s,loadVersion:i,version:m}),v.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=L)})();
1
+ (function(){"use strict";function e(e,o){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)o.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(n[r[t]]=e[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],n=o[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=r[n],s=(e=n)=>{const r=o.indexOf(e),t=o[r+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=performance.now(),c=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},l=(e,o,...n)=>{var r,t;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...i));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(t=l.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},d=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(l("sendErrorLog","warn",e,n,o),i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}},u=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:c}}const d=s.status.toString();try{const e=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:d}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:c}}},m=async({basePathType:o,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":o,g=await u({basePathType:p,options:n,path:t}),{errors:w,response:f}=g,y=e(g,["errors","response"]),h=s(p),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==f?void 0:f.status),S=h&&v;return v&&d({endpoint:r[p]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:p,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(l(`=== "${t}" failed to fetch, trying next fallback ${h}`),m({basePathType:h,options:n,path:t})):Object.assign({errors:w,response:f},y)},g=async(o,r)=>{const t=e(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return l(o,"info"),m({basePathType:d||n,options:c,path:o})},w=(e,...o)=>{l(e,"error",...o)},f=["jsdelivr","cdnjs","unpkg","vercel"],y=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},h=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${h.source}$`),S=new RegExp(`^cart_${h.source}$`),z=e=>e?S.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},L=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:t}=await g("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),s=!t||r.length;return s&&o?(l("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,1e3))),L({cartId:e,retries:o-1})):s?null:t};var O;const Z=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=y(window.location.href),n="https://v1.3.111.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),b=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=y(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const r=`https://${e}.route.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class U{static get isNpm(){return!1}}O=U,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1730241963457",U.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},r)))}catch(e){}},U.loadScriptLogParallelHandler=async e=>{try{if(O.parallelLoadTimes.push(e),2===O.parallelLoadTimes.length){const e=O.parallelLoadTimes.find((e=>"vercel"===e.type)),o=O.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void d({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});O.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},U.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{w(`[ZONOS - loadZonos] ${e}`),d({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:O.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},U.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.111";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.111":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.111");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},U.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;const i="vercel"===e?r:O.getGithubCdn({type:e,version:t}),a=Z||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,l(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n})())||void 0===s?void 0:s.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=f[0]===e,y=f[1],h="on"===O.parallelLoadState&&m&&w&&y&&!g;h&&O.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:r,version:t});const v=performance.now();p.addEventListener("load",(()=>{var r;if(h||n?O.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:O.storeId,type:e}):O.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:O.storeId,type:e}),O.isBigCommerce||(O.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=Z,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=O.isBigCommerce,O.cartId){if(!O.zonosApiKey)throw O.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!O.cartData)throw O.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(O.legacyStoreFavicon&&O.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=O.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=O.cartData,window.Zonos.isLegacyCheckout=O.isLegacyCheckout;const e=O.isLegacyCheckout&&"CLOSE_MODAL"===(null===(r=o.checkoutSettings)||void 0===r?void 0:r.successBehavior),n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:O.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:e?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:e?O.cartData.storeBaseUrl:void 0}),zonosApiKey:O.zonosApiKey});o=n}window.Zonos.version&&(l(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=f.indexOf(e);return f[o+1]||null})(e);if(!h&&!n){if(!s)return;O.injectZonos({cdnType:s,initConfig:o,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||Z)return;if(h||n)return void O.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:O.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?d({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):d({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async e=>{var o;const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:r,isLegacyCartId:t}=z(n);if(n&&!t&&!r)return void O.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});O.cartId=n;const s="https://v1.3.111.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src;l(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=Z,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&l(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&l(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(O.isNpm||a&&c))return void w("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||O.requested)return void l("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!O.cartId)return O.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void w("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(O.requested=!0,O.zonosApiKey=e.zonosApiKey,O.storeId=e.storeId,O.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=z(e);if(!n&&!o)return w("[ZONOS - loadZonos] invalid cart id"),null;const r=await L({cartId:e,retries:5});return l("[ZONOS - loadZonos] getting temp cart data","info",r),r?{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}:(w("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!e)throw O.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");O.cartData=e.cartData,O.zonosApiKey=e.zonosApiKey,O.legacyStoreLogo=e.storeLogo,O.legacyStoreFavicon=e.storeFavicon,O.storeId=e.storeId,O.zonosApiKey=e.zonosApiKey}if(!O.zonosApiKey)return void w('"zonosApiKey" is required to initialize Zonos');if(!O.storeId)return l("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void O.injectZonos({initConfig:e,vercelUrl:s,version:null});const d=O.storeId||e.storeId;l(`[ZONOS - loadZonos] Store ID: ${d}`,"info");const p=new URLSearchParams;p.set("storeId",d.toString());const{errors:u,json:m}=await g(`/api/get-store-version?${p.toString()}`);if(u.length||!m)return l("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void O.injectZonos({initConfig:e,vercelUrl:s,version:null});const{isDifferent:f,source:y,version:h}=m;if(l(`[ZONOS - loadZonos] Store version: ${h}, source: ${y}`,"info"),f){l(`[ZONOS - loadZonos] Updating saved store version to ${h}`,"info");const e={storeId:d,version:h};g(`/api/set-store-version?${p.toString()}`,{body:e,method:"POST"}).catch((e=>w("Unable to save store's vesrion",e)))}if(!i){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:a}),t=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,s=r&&!n?null:h;l("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:t,loadVersion:s,version:h}),O.injectZonos({initConfig:e,vercelUrl:t,version:s})}},void 0===window.Zonos&&(window.Zonos=U)})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const{elapsedTimePretty:l}=(()=>{const t=performance.now()-e,o=t>1e3?`${(t/1e3).toFixed(2)}s`:`${t.toFixed(2)}ms`;return{elapsedTime:t,elapsedTimePretty:o}})(),a=[`(${l})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.110.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async({cartId:e,retries:t})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&t?(o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,1e3))),C({cartId:e,retries:t-1})):i?null:s};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),Z="https://v1.3.110.js.zonos.com",A=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.110",T="https://rsms.me",U="https://fonts.googleapis.com",P=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class I{}k=I,I.doneInit=!1,I.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),I.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),I._paypalMockResponse=null,I.isBigCommerce=!1,I.releaseDate="1730134797438",I.isLegacyCheckout=!1,I.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),I.isNpm=!0,I.zonosQaUrl=null,I.zonosQaUrlApi=null,I.version="v1.3.110",I.modeAlerted=!1,I.cartData=null,I.paypal=null,I.getCurrentTimestamp=()=>(new Date).getTime(),I.zonosController=null,I.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{if("cart_"===e||!e)return n("[ZONOS - loadZonos] Error due to bad cart id"),null;const t=await C({cartId:e,retries:5});return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},I.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},I.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},I.showNotification=e=>{var t;null===(t=k.zonosController)||void 0===t||t.showNotification(e)},I.updateOrganizationName=e=>{var t;null===(t=k.zonosController)||void 0===t||t.updateOrganizationName(e)},I.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},I.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},I.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},I.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return A;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.110";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.110";case"vercel":return Z}};if(k.isNpm){return l()||t()}return t()},I.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},I.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${Z}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},I.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},I.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${T}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!P.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=T,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${T}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},I.setupGoogleFont=e=>{var t;null===(t=k.zonosController)||void 0===t||t.setupGoogleFont(e)},I.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${U}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=U,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=I)})();
1
+ (function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const t=performance.now()-e,o=t>1e3?`${(t/1e3).toFixed(2)}s`:`${t.toFixed(2)}ms`;return{elapsedTime:t,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...l);break;case"info":d.info(o,...l);break;case"error":d.error(o,...l);break;default:d.groupCollapsed(o,...l),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.111.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${l}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],g=w[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:t,path:n}),{errors:l,response:c}=a,d=y(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${f[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:t})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&t?(o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,1e3))),C({cartId:e,retries:t-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),Z=async e=>{const{isDgsCartId:t,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!t)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return o("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var A;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),U="https://v1.3.111.js.zonos.com",$=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.111",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}A=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1730241963457",N.isLegacyCheckout=!1,N.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.111",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{if(A.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!A.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${A.version}) ======`),A.zonosApiKey=c,A.storeId=l,A.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!A.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!A.cartData&&A.cartId){o("Initialize cart data");const e=await Z(A.cartId);if(!e)return void n("Failed to get cart data");A.cartData=e.cartData,A.zonosApiKey=e.zonosApiKey}}if(A.cartId&&A.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),A.injectZonosCdn(),A.injectZonosCss(),A.injectFonts(),A.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a}}),A.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=A.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=A.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=A.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),A.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${A.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");t?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const o=i(e);o&&A.injectScript({cdnType:o,isModule:t,theRestUrl:r})},a.appendChild(l)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return $;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.111";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.111";case"vercel":return U}};if(A.isNpm){return a()||t()}return t()},N.injectZonosCdn=()=>{A.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),A.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=A.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${o}/${t}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const o=i(e);o&&A.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(a)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(A.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!D.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=L,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=A.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=N)})();
@@ -0,0 +1,4 @@
1
+ export declare const _getIsValidCartId: (cartId: string | null) => {
2
+ isDgsCartId: boolean;
3
+ isLegacyCartId: boolean;
4
+ };
@@ -1 +1 @@
1
- import{l as e,a as n}from"./p-970fa103.js";import{s as t,c as o}from"./p-272121e2.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-272121e2.js";const s=["jsdelivr","cdnjs","unpkg","vercel"],r="jsdelivr",i=e=>{const n=s.indexOf(e);return s[n+1]||null},l="https://js.stripe.com/v3",u=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let m=null;const p=Promise.resolve().then((()=>{return e=null,null!==m||(m=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)t(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&u.test(t.src))return t}return null})();s&&e?console.warn(a):s||(s=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${l}${t}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),m;var e}));let w=!1;var f;p.catch((e=>{w||console.warn(e)}));const h=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),v="https://v1.3.110.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.110",z="https://rsms.me",j="https://fonts.googleapis.com",S=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class g{}f=g,g.doneInit=!1,g.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),g.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),g._paypalMockResponse=null,g.isBigCommerce=!1,g.releaseDate="1730134751797",g.isLegacyCheckout=!1,g.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.110",g.modeAlerted=!1,g.cartData=null,g.paypal=null,g.getCurrentTimestamp=()=>(new Date).getTime(),g.zonosController=null,g.init=async({appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:a})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=a,f.storeId=u,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!a&&!f.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!f.cartData&&f.cartId){e("Initialize cart data");const o=await t(f.cartId);if(!o)return void n("Failed to get cart data");f.cartData=o.cartData,f.zonosApiKey=o.zonosApiKey}}if(f.cartId&&f.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${o}`,document.body.appendChild(n)}e("init zonos"),f.injectZonosCdn(),f.injectZonosCss(),f.injectFonts(),f.injectController({config:{appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d}}),f.doneInit=!0}},g.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},g.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},g.showNotification=e=>{var n;null===(n=f.zonosController)||void 0===n||n.showNotification(e)},g.updateOrganizationName=e=>{var n;null===(n=f.zonosController)||void 0===n||n.updateOrganizationName(e)},g.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},g.injectController=({config:t})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=t.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=t,s.zonosApiKey=f.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const r=await(async(...e)=>{w=!0;const n=Date.now();return p.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),f.zonosController=s,e("Zonos controller injected!")},g.injectScript=({cdnType:t,isModule:o,theRestUrl:s})=>{const r=`${f.getZonosUrl(t)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const c=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=r,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const e=i(t);e&&f.injectScript({cdnType:e,isModule:o,theRestUrl:s})},c.appendChild(l)},g.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.110";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.110";case"vercel":return v}};return f.isNpm&&(()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.110.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s})()||t()},g.injectZonosCdn=()=>{f.injectScript({cdnType:r,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),f.injectScript({cdnType:r,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},g.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=f.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${v}/`,s.appendChild(r);const c=document.createElement("link");c.rel="stylesheet",c.href=`${o}/${t}`,c.onerror=()=>{n(`Failed to load ${c.href}`);const o=i(e);o&&f.injectStylesheet({cdnType:o,theRestUrl:t})},s.appendChild(c)},g.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(f.injectStylesheet({cdnType:r,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},g.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!S.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=z,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${z}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},g.setupGoogleFont=e=>{var n;null===(n=f.zonosController)||void 0===n||n.setupGoogleFont(e)},g.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${j}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=j,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{g as Zonos}
1
+ import{l as e,a as n}from"./p-970fa103.js";import{s as t,c as o}from"./p-56d405d0.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-56d405d0.js";const s=["jsdelivr","cdnjs","unpkg","vercel"],r="jsdelivr",i=e=>{const n=s.indexOf(e);return s[n+1]||null},l="https://js.stripe.com/v3",u=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let m=null;const p=Promise.resolve().then((()=>{return e=null,null!==m||(m=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)t(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&u.test(t.src))return t}return null})();s&&e?console.warn(a):s||(s=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${l}${t}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),m;var e}));let w=!1;var f;p.catch((e=>{w||console.warn(e)}));const h=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),v="https://v1.3.111.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.111",z="https://rsms.me",j="https://fonts.googleapis.com",S=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class g{}f=g,g.doneInit=!1,g.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),g.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),g._paypalMockResponse=null,g.isBigCommerce=!1,g.releaseDate="1730241918819",g.isLegacyCheckout=!1,g.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.111",g.modeAlerted=!1,g.cartData=null,g.paypal=null,g.getCurrentTimestamp=()=>(new Date).getTime(),g.zonosController=null,g.init=async({appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:a})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=a,f.storeId=u,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!a&&!f.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!f.cartData&&f.cartId){e("Initialize cart data");const o=await t(f.cartId);if(!o)return void n("Failed to get cart data");f.cartData=o.cartData,f.zonosApiKey=o.zonosApiKey}}if(f.cartId&&f.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${o}`,document.body.appendChild(n)}e("init zonos"),f.injectZonosCdn(),f.injectZonosCss(),f.injectFonts(),f.injectController({config:{appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d}}),f.doneInit=!0}},g.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},g.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},g.showNotification=e=>{var n;null===(n=f.zonosController)||void 0===n||n.showNotification(e)},g.updateOrganizationName=e=>{var n;null===(n=f.zonosController)||void 0===n||n.updateOrganizationName(e)},g.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},g.injectController=({config:t})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=t.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=t,s.zonosApiKey=f.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const r=await(async(...e)=>{w=!0;const n=Date.now();return p.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),f.zonosController=s,e("Zonos controller injected!")},g.injectScript=({cdnType:t,isModule:o,theRestUrl:s})=>{const r=`${f.getZonosUrl(t)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const c=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=r,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const e=i(t);e&&f.injectScript({cdnType:e,isModule:o,theRestUrl:s})},c.appendChild(l)},g.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.111";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.111";case"vercel":return v}};return f.isNpm&&(()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.111.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s})()||t()},g.injectZonosCdn=()=>{f.injectScript({cdnType:r,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),f.injectScript({cdnType:r,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},g.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=f.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${v}/`,s.appendChild(r);const c=document.createElement("link");c.rel="stylesheet",c.href=`${o}/${t}`,c.onerror=()=>{n(`Failed to load ${c.href}`);const o=i(e);o&&f.injectStylesheet({cdnType:o,theRestUrl:t})},s.appendChild(c)},g.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(f.injectStylesheet({cdnType:r,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},g.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!S.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=z,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${z}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},g.setupGoogleFont=e=>{var n;null===(n=f.zonosController)||void 0===n||n.setupGoogleFont(e)},g.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${j}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=j,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{g as Zonos}
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(t,e,r,n){function a(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,i){function o(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n["throw"](t))}catch(t){i(t)}}function c(t){t.done?r(t.value):a(t.value).then(o,s)}c((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(t){return function(e){return c([t,e])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(r=0)),r)try{if(n=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;a=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(s[0]===6&&r.label<i[1]){r.label=i[1];i=s;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(s);break}if(i[2])r.ops.pop();r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t];a=0}finally{n=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-43b3c2ae.system.js"],(function(t){"use strict";var e,r,n;return{setters:[function(t){e=t.h;r=t.l;n=t.a}],execute:function(){var a=this;var i=function(t){return __awaiter(a,[t],void 0,(function(t){var n,a,o,s,c,u;var f=t.cartId,d=t.retries;return __generator(this,(function(t){switch(t.label){case 0:n=new URLSearchParams(window.location.search);a=n.get("zonosTestMode")==="1";return[4,e("/api/zonos-elements/get-temp-cart",{body:{isTestMode:a,tempCartUUID:f},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:o=t.sent(),s=o.errors,c=o.json;u=!c||s.length;if(!(u&&d))return[3,3];r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:d});return[4,new Promise((function(t){return setTimeout(t,1e3)}))];case 2:t.sent();return[2,i({cartId:f,retries:d-1})];case 3:if(u){return[2,null]}return[2,c]}}))}))};var o=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;var s=new RegExp("^".concat(o.source,"$"));var c=new RegExp("^cart_".concat(o.source,"$"));var u=function(t){if(!t){return{isDgsCartId:false,isLegacyCartId:false}}if(c.test(t)){return{isDgsCartId:true,isLegacyCartId:false}}if(s.test(t)){return{isDgsCartId:false,isLegacyCartId:true}}return{isDgsCartId:false,isLegacyCartId:false}};var f=t("s",(function(t){return __awaiter(a,void 0,void 0,(function(){var e,a,o,s;return __generator(this,(function(c){switch(c.label){case 0:e=u(t),a=e.isDgsCartId,o=e.isLegacyCartId;if(!o&&!a){n("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,i({cartId:t,retries:5})];case 1:s=c.sent();r("[ZONOS - loadZonos] getting temp cart data","info",s);if(!s){n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}return[2,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}]}}))}))}));var d=t("c","zonos--checkout-hidden-button");var l=t("d","zonos--domestic-redirected-checkout-button")}}}));
@@ -0,0 +1 @@
1
+ import{h as t,l as a,a as e}from"./p-970fa103.js";const s=async({cartId:e,retries:o})=>{const r="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:n,json:i}=await t("/api/zonos-elements/get-temp-cart",{body:{isTestMode:r,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),d=!i||n.length;return d&&o?(a("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((t=>setTimeout(t,1e3))),s({cartId:e,retries:o-1})):d?null:i},o=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,r=new RegExp(`^${o.source}$`),n=new RegExp(`^cart_${o.source}$`),i=async t=>{const{isDgsCartId:o,isLegacyCartId:i}=(t=>t?n.test(t)?{isDgsCartId:!0,isLegacyCartId:!1}:r.test(t)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(t);if(!i&&!o)return e("[ZONOS - loadZonos] invalid cart id"),null;const d=await s({cartId:t,retries:5});return a("[ZONOS - loadZonos] getting temp cart data","info",d),d?{cartData:d.cartData,storeFavicon:d.storeFaviconUrl,storeId:d.cartData.storeId,storeLogo:d.storeLogoUrl,zonosApiKey:d.cartData.credentialToken}:(e("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)},d="zonos--checkout-hidden-button",c="zonos--domestic-redirected-checkout-button";export{d as c,c as d,i as s}
@@ -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{a(r.next(n))}catch(n){i(n)}}function s(n){try{a(r["throw"](n))}catch(n){i(n)}}function a(n){n.done?t(n.value):o(n.value).then(u,s)}a((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:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(n){return function(e){return a([n,e])}}function a(s){if(r)throw new TypeError("Generator is already executing.");while(u&&(u=0,s[0]&&(t=0)),t)try{if(r=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:t.label++;return{value:s[1],done:false};case 5:t.label++;o=s[1];s=[0];continue;case 7:s=t.ops.pop();t.trys.pop();continue;default:if(!(i=t.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){t.label=s[1];break}if(s[0]===6&&t.label<i[1]){t.label=i[1];i=s;break}if(i&&t.label<i[2]){t.label=i[2];t.ops.push(s);break}if(i[2])t.ops.pop();t.trys.pop();continue}s=e.call(n,t)}catch(n){s=[6,n];o=0}finally{r=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-43b3c2ae.system.js","./p-64f0fcce.system.js"],(function(n){"use strict";var e,t,r,o;return{setters:[function(n){e=n.l;t=n.a},function(e){r=e.s;o=e.c;var t={};t.checkoutHiddenBtnSelector=e.c;t.domesticRedirectedBtnSelector=e.d;n(t)}],execute:function(){var i=this;var u=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 s=["jsdelivr","cdnjs","unpkg","vercel"];var a="jsdelivr";var c=function(n){var e=s.indexOf(n);var t=s[e+1];return t||null};var l=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 d=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var t=l(window.location.href);var r="https://v1.3.110.js.zonos.com";if(!t&&(r.includes("test.")||r.includes("test-"))){return r}if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!t){return null}if(t==="dev-elements"){return"https://dev.elements.zonos.com"}var o="preview.js.zonos.com";var i="https://".concat(t,".").concat(o);e("[ZONOS-WARNING] using '".concat(i,"' for loading elements script"),"warn");void fetch(i).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(i,"' 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 i};var f="https://js.stripe.com/v3";var v=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var m="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var w=function(){var n=document.querySelectorAll('script[src^="'.concat(f,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!v.test(t.src)){continue}return t}return null};var p=null;var h=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var r=document.createElement("script");r.src="".concat(f).concat(e);var o=document.head||document.body;if(!o){t("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}o.appendChild(r);return r};var y=function(n){if(p!==null){return p}p=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(m)}if(window.Stripe){e(window.Stripe);return}try{var r=w();if(r&&n){console.warn(m)}else if(!r){r=h(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 p};var z=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var j=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);z(r,t);return r};var g=Promise.resolve().then((function(){return y(null)}));var b=false;g.catch((function(n){if(!b){console.warn(n)}}));var k=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(i,void 0,void 0,(function(){var e;return __generator(this,(function(t){b=true;e=Date.now();return[2,g.then((function(t){return j(t,n,e)}))]}))}))};var S="tempCartUUID";var O=function(){var n=new URLSearchParams(window.location.search);var e=n.get(S);return e};var U;var L=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=u({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var N="https://v1.3.110.js.zonos.com";var _=L||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.110";var R="https://unpkg.com/@zonos/elements@1.3.110";var A="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.110";var F="https://rsms.me";var I="https://fonts.googleapis.com";var E=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var T=function(){function n(){}return n}();n("Zonos",T);U=T;T.doneInit=false;T.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);T.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);T._paypalMockResponse=null;T.isBigCommerce=false;T.releaseDate="1730134751797";T.isLegacyCheckout=false;T.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");T.isNpm=true;T.zonosQaUrl=null;T.zonosQaUrlApi=null;T.version="v".concat("1.3.110");T.modeAlerted=false;T.cartData=null;T.paypal=null;T.getCurrentTimestamp=function(){return(new Date).getTime()};T.zonosController=null;T.init=function(n){return __awaiter(i,[n],void 0,(function(n){var i,u;var s=n.appearance,a=n.checkoutSettings,c=n.currencyConverter,l=n.helloSettings,d=n.onCountryChange,f=n.overrideCurrencyFormat,v=n.storeId,m=n.zonosApiKey;return __generator(this,(function(n){switch(n.label){case 0:U.cartId=O();if(U.doneInit){return[2]}e("====== ZONOS DEBUG MODE: on (".concat(U.version,") ======"));U.zonosApiKey=m;U.storeId=v;if(!U.isNpm)return[3,2];e("====== ZONOS LOADING FROM NPM ======");if(!m&&!U.cartId){t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!U.cartData&&U.cartId))return[3,2];e("Initialize cart data");return[4,r(U.cartId)];case 1:i=n.sent();if(!i){t("Failed to get cart data");return[2]}U.cartData=i.cartData;U.zonosApiKey=i.zonosApiKey;n.label=2;case 2:if(U.cartId&&U.cartData){e("Cart data is available, inject hidden button and trigger checkout");u=document.createElement("button");u.style.display="none";u.id="".concat(o);document.body.appendChild(u)}e("init zonos");U.injectZonosCdn();U.injectZonosCss();U.injectFonts();U.injectController({config:{appearance:s,checkoutSettings:a,currencyConverter:c,helloSettings:l,onCountryChange:d,overrideCurrencyFormat:f}});U.doneInit=true;return[2]}}))}))};T.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};T.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};T.showNotification=function(n){var e;void((e=U.zonosController)===null||e===void 0?void 0:e.showNotification(n))};T.updateOrganizationName=function(n){var e;void((e=U.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};T.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 s=document.querySelectorAll(i);var a=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};s.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(o){n.setAttribute("disabled","true");n.addEventListener("click",a)}else{n.removeAttribute("disabled");n.removeEventListener("click",a)}}));if(t&&o){setTimeout((function(){s.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",a)}))}),5e3)}}};T.injectController=function(n){var r=n.config;var o;if(document.querySelector("zonos-controller")){return}if((o=r.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var u=r.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:r,disable:true,placeOrderButtonSelector:u});var s=new MutationObserver((function(){U.disablePlaceOrderButtons({config:r,disable:true,placeOrderButtonSelector:u})}));s.observe(document.body,{childList:true,subtree:true})}var a=document.createElement("zonos-controller");a.config=r;a.zonosApiKey=U.zonosApiKey||"";a.addEventListener("stripeInitEvent",(function(n){return __awaiter(i,void 0,void 0,(function(){var r,o;return __generator(this,(function(i){switch(i.label){case 0:r=n.detail;e("loading Stripe");return[4,k(r.publishableKey)];case 1:o=i.sent();if(!o){t("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;void a.initCheckoutElement(o);return[2]}}))}))}));document.body.appendChild(a);U.zonosController=a;e("Zonos controller injected!")};T.injectScript=function(n){var r=n.cdnType,o=n.isModule,i=n.theRestUrl;var u=U.getZonosUrl(r);var s="".concat(u,"/").concat(i);var a=function(){var n=document.querySelector('script[src="'.concat(s,'"]'));return!!n};if(a()){e('Zonos script "'.concat(s,'" already exists in the document'),"warn");return}var l=document.head||document.body;var d=document.createElement("script");if(!!o){d.type="module"}else{d.noModule=true}d.src=s;d.crossOrigin="anonymous";d.onerror=function(){t("Failed to load ".concat(d.src));var n=c(r);if(!n){return}U.injectScript({cdnType:n,isModule:o,theRestUrl:i})};l.appendChild(d)};T.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return _;case"unpkg":return R;case"cdnjs":return A;case"vercel":return N}};if(U.isNpm){var t=d();return t||e()}return e()};T.injectZonosCdn=function(){U.injectScript({cdnType:a,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});U.injectScript({cdnType:a,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});e("Zonos cdn script injected!")};T.injectStylesheet=function(n){var e=n.cdnType,r=n.theRestUrl;var o=U.getZonosUrl(e);var i=document.head||document.body;var u=document.createElement("link");u.rel="preconnect";u.href="".concat(N,"/");i.appendChild(u);var s=document.createElement("link");s.rel="stylesheet";s.href="".concat(o,"/").concat(r);s.onerror=function(){t("Failed to load ".concat(s.href));var n=c(e);if(!n){return}U.injectStylesheet({cdnType:n,theRestUrl:r})};i.appendChild(s)};T.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){e("Zonos style links already injected","warn");return}U.injectStylesheet({cdnType:a,theRestUrl:"dist/zonos-elements/zonos-elements.css"});e("Zonos style css injected!")};T.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(F,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(E.test(t.href)){continue}return t}return null};if(n()){e("Inter font already injected","warn");return}var t=document.head||document.body;var r=document.createElement("link");r.rel="preconnect";r.href=F;t.appendChild(r);var o=document.createElement("link");o.rel="stylesheet";o.href="".concat(F,"/inter/inter.css");t.appendChild(o);e("Zonos font injected!")};T.setupGoogleFont=function(n){var e;void((e=U.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};T.injectSupportGoogleFont=function(n){var t;e("[FONT] injecting ".concat(n));var r=(t=n.match(/family=(.*?):/))===null||t===void 0?void 0:t[1];var o=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(I,'"]'))){var i=document.createElement("link");i.rel="preconnect";i.href=I;o.appendChild(i)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){e("[FONT] ".concat(r," font already injected"),"warn");return}var u=document.createElement("link");u.rel="stylesheet";u.href=n;o.appendChild(u);e("[FONT] ".concat(r," 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-43b3c2ae.system.js","./p-33b57fab.system.js"],(function(n){"use strict";var e,t,r,o;return{setters:[function(n){e=n.l;t=n.a},function(e){r=e.s;o=e.c;var t={};t.checkoutHiddenBtnSelector=e.c;t.domesticRedirectedBtnSelector=e.d;n(t)}],execute:function(){var i=this;var u=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 a=["jsdelivr","cdnjs","unpkg","vercel"];var s="jsdelivr";var c=function(n){var e=a.indexOf(n);var t=a[e+1];return t||null};var l=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 d=function(){var n=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||n){return null}var t=l(window.location.href);var r="https://v1.3.111.js.zonos.com";if(!t&&(r.includes("test.")||r.includes("test-"))){return r}if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname)){return"https://dev.elements.zonos.com"}if(!t){return null}if(t==="dev-elements"){return"https://dev.elements.zonos.com"}var o="preview.js.zonos.com";var i="https://".concat(t,".").concat(o);e("[ZONOS-WARNING] using '".concat(i,"' for loading elements script"),"warn");void fetch(i).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(i,"' 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 i};var f="https://js.stripe.com/v3";var v=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var m="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var w=function(){var n=document.querySelectorAll('script[src^="'.concat(f,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!v.test(t.src)){continue}return t}return null};var p=null;var h=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var r=document.createElement("script");r.src="".concat(f).concat(e);var o=document.head||document.body;if(!o){t("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}o.appendChild(r);return r};var y=function(n){if(p!==null){return p}p=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(m)}if(window.Stripe){e(window.Stripe);return}try{var r=w();if(r&&n){console.warn(m)}else if(!r){r=h(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 p};var z=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var j=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);z(r,t);return r};var g=Promise.resolve().then((function(){return y(null)}));var b=false;g.catch((function(n){if(!b){console.warn(n)}}));var k=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(i,void 0,void 0,(function(){var e;return __generator(this,(function(t){b=true;e=Date.now();return[2,g.then((function(t){return j(t,n,e)}))]}))}))};var S="tempCartUUID";var O=function(){var n=new URLSearchParams(window.location.search);var e=n.get(S);return e};var U;var L=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=u({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var N="https://v1.3.111.js.zonos.com";var _=L||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.111";var R="https://unpkg.com/@zonos/elements@1.3.111";var A="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.111";var F="https://rsms.me";var I="https://fonts.googleapis.com";var E=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var T=function(){function n(){}return n}();n("Zonos",T);U=T;T.doneInit=false;T.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);T.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);T._paypalMockResponse=null;T.isBigCommerce=false;T.releaseDate="1730241918819";T.isLegacyCheckout=false;T.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");T.isNpm=true;T.zonosQaUrl=null;T.zonosQaUrlApi=null;T.version="v".concat("1.3.111");T.modeAlerted=false;T.cartData=null;T.paypal=null;T.getCurrentTimestamp=function(){return(new Date).getTime()};T.zonosController=null;T.init=function(n){return __awaiter(i,[n],void 0,(function(n){var i,u;var a=n.appearance,s=n.checkoutSettings,c=n.currencyConverter,l=n.helloSettings,d=n.onCountryChange,f=n.overrideCurrencyFormat,v=n.storeId,m=n.zonosApiKey;return __generator(this,(function(n){switch(n.label){case 0:U.cartId=O();if(U.doneInit){return[2]}e("====== ZONOS DEBUG MODE: on (".concat(U.version,") ======"));U.zonosApiKey=m;U.storeId=v;if(!U.isNpm)return[3,2];e("====== ZONOS LOADING FROM NPM ======");if(!m&&!U.cartId){t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!U.cartData&&U.cartId))return[3,2];e("Initialize cart data");return[4,r(U.cartId)];case 1:i=n.sent();if(!i){t("Failed to get cart data");return[2]}U.cartData=i.cartData;U.zonosApiKey=i.zonosApiKey;n.label=2;case 2:if(U.cartId&&U.cartData){e("Cart data is available, inject hidden button and trigger checkout");u=document.createElement("button");u.style.display="none";u.id="".concat(o);document.body.appendChild(u)}e("init zonos");U.injectZonosCdn();U.injectZonosCss();U.injectFonts();U.injectController({config:{appearance:a,checkoutSettings:s,currencyConverter:c,helloSettings:l,onCountryChange:d,overrideCurrencyFormat:f}});U.doneInit=true;return[2]}}))}))};T.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};T.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};T.showNotification=function(n){var e;void((e=U.zonosController)===null||e===void 0?void 0:e.showNotification(n))};T.updateOrganizationName=function(n){var e;void((e=U.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};T.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)}}};T.injectController=function(n){var r=n.config;var o;if(document.querySelector("zonos-controller")){return}if((o=r.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var u=r.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:r,disable:true,placeOrderButtonSelector:u});var a=new MutationObserver((function(){U.disablePlaceOrderButtons({config:r,disable:true,placeOrderButtonSelector:u})}));a.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=r;s.zonosApiKey=U.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(n){return __awaiter(i,void 0,void 0,(function(){var r,o;return __generator(this,(function(i){switch(i.label){case 0:r=n.detail;e("loading Stripe");return[4,k(r.publishableKey)];case 1:o=i.sent();if(!o){t("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;void s.initCheckoutElement(o);return[2]}}))}))}));document.body.appendChild(s);U.zonosController=s;e("Zonos controller injected!")};T.injectScript=function(n){var r=n.cdnType,o=n.isModule,i=n.theRestUrl;var u=U.getZonosUrl(r);var a="".concat(u,"/").concat(i);var s=function(){var n=document.querySelector('script[src="'.concat(a,'"]'));return!!n};if(s()){e('Zonos script "'.concat(a,'" already exists in the document'),"warn");return}var l=document.head||document.body;var d=document.createElement("script");if(!!o){d.type="module"}else{d.noModule=true}d.src=a;d.crossOrigin="anonymous";d.onerror=function(){t("Failed to load ".concat(d.src));var n=c(r);if(!n){return}U.injectScript({cdnType:n,isModule:o,theRestUrl:i})};l.appendChild(d)};T.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return _;case"unpkg":return R;case"cdnjs":return A;case"vercel":return N}};if(U.isNpm){var t=d();return t||e()}return e()};T.injectZonosCdn=function(){U.injectScript({cdnType:s,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});U.injectScript({cdnType:s,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});e("Zonos cdn script injected!")};T.injectStylesheet=function(n){var e=n.cdnType,r=n.theRestUrl;var o=U.getZonosUrl(e);var i=document.head||document.body;var u=document.createElement("link");u.rel="preconnect";u.href="".concat(N,"/");i.appendChild(u);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(o,"/").concat(r);a.onerror=function(){t("Failed to load ".concat(a.href));var n=c(e);if(!n){return}U.injectStylesheet({cdnType:n,theRestUrl:r})};i.appendChild(a)};T.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){e("Zonos style links already injected","warn");return}U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"});e("Zonos style css injected!")};T.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(F,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(E.test(t.href)){continue}return t}return null};if(n()){e("Inter font already injected","warn");return}var t=document.head||document.body;var r=document.createElement("link");r.rel="preconnect";r.href=F;t.appendChild(r);var o=document.createElement("link");o.rel="stylesheet";o.href="".concat(F,"/inter/inter.css");t.appendChild(o);e("Zonos font injected!")};T.setupGoogleFont=function(n){var e;void((e=U.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};T.injectSupportGoogleFont=function(n){var t;e("[FONT] injecting ".concat(n));var r=(t=n.match(/family=(.*?):/))===null||t===void 0?void 0:t[1];var o=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(I,'"]'))){var i=document.createElement("link");i.rel="preconnect";i.href=I;o.appendChild(i)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){e("[FONT] ".concat(r," font already injected"),"warn");return}var u=document.createElement("link");u.rel="stylesheet";u.href=n;o.appendChild(u);e("[FONT] ".concat(r," font injected!"))}}}}));
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(o,e,n,t){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,i){function r(o){try{a(t.next(o))}catch(o){i(o)}}function c(o){try{a(t["throw"](o))}catch(o){i(o)}}function a(o){o.done?n(o.value):s(o.value).then(r,c)}a((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,s,i,r;return r={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function c(o){return function(e){return a([o,e])}}function a(c){if(t)throw new TypeError("Generator is already executing.");while(r&&(r=0,c[0]&&(n=0)),n)try{if(t=1,s&&(i=c[0]&2?s["return"]:c[0]?s["throw"]||((i=s["return"])&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;if(s=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:n.label++;return{value:c[1],done:false};case 5:n.label++;s=c[1];c=[0];continue;case 7:c=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1];i=c;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(c);break}if(i[2])n.ops.pop();n.trys.pop();continue}c=e.call(o,n)}catch(o){c=[6,o];s=0}finally{t=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};System.register(["./p-fd061229.system.js","./p-5a011a47.system.js","./p-49135023.system.js","./p-15750a04.system.js","./p-43b3c2ae.system.js","./p-64372f93.system.js","./p-aed0098c.system.js","./p-23e7c655.system.js","./p-2cce0f21.system.js","./p-daab619c.system.js","./p-64f0fcce.system.js","./p-2770ba48.system.js"],(function(o){"use strict";var e,n,t,s,i,r,c,a,u,d,l,h,f,z,m,v,k,g,p,w,b,y,x,C,_,S,O,j,A,I,T,B,D,L,P,E,N,U,H,R,M,F,Z,G,V,q,W,K,Y,J,Q,X;return{setters:[function(o){e=o.r;n=o.h;t=o.H;s=o.F},function(o){i=o.l;r=o.s;c=o.a;a=o.b;u=o.c;d=o.i;l=o.d;h=o.e;f=o.f;z=o.g;m=o.h;v=o.j;k=o.k;g=o.m;p=o.t;w=o.n;b=o.o;y=o.p;x=o.q;C=o.r;_=o.u;S=o.v;O=o.w;j=o.x;A=o.y},function(o){I=o.p;T=o.s;B=o.a},function(o){D=o.z;L=o.g;P=o.m},function(o){E=o.h;N=o.l;U=o.a;H=o.s;R=o.g;M=o.b;F=o.j},function(o){Z=o.c;G=o.g},function(o){V=o.i},function(o){q=o.c},function(o){W=o.g},function(o){K=o.i},function(o){Y=o.s;J=o.d;Q=o.c},function(o){X=o.R}],execute:function(){var $=this;var oo=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 eo=function(){return __awaiter($,void 0,void 0,(function(){var o,e,n;return __generator(this,(function(t){switch(t.label){case 0:return[4,E("/api/zonos-elements/get-store-discount-enabled-status")];case 1:o=t.sent(),e=o.errors,n=o.json;if(e.length||!(n===null||n===void 0?void 0:n.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var no=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return true}if(i.isDisabledCountry){if(o){N("Checkout: disabled country")}return true}return false};var to=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return false}if(!i.isShippableCountry){if(o){N("Checkout: not shippable country")}return false}return true};var so=function(o){var e=o.domesticRedirectedBtnSelector,n=o.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var t=new MutationObserver((function(){return __awaiter($,void 0,void 0,(function(){var o,s,i,d,l;var h=this;return __generator(this,(function(f){o=document.querySelector(e);s=r();if(!o&&s){i=document.createElement("button");i.style.display="none";i.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(i);n===null||n===void 0?void 0:n(s);t.disconnect();return[2]}d=document.querySelector('select[name="shippingAddress.countryCode"]');l=document.querySelector("#checkout-shipping-continue");if(!d||!l){return[2]}t.disconnect();l.addEventListener("click",(function(o){return __awaiter(h,void 0,void 0,(function(){var e,n,t,s,i,r,l;return __generator(this,(function(h){t=d.value;if(!t){return[2]}c(t);if(!to(false)){a();return[2]}s=document.querySelector("form");if(!s){return[2]}i=new FormData(s);r=document.querySelector("input#addressLine1Input");l={address1:(e=i.get("shippingAddress.address1"))!==null&&e!==void 0?e:r&&r.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:(n=i.get("shippingAddress.stateOrProvince"))!==null&&n!==void 0?n:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(l).some((function(o){return o===undefined||o===null}))){U("One or more shipping address field is missing",Object.entries(l));void H({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:{domain:window.location.hostname,storeId:D.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]}))}))}));t.observe(document.body,{childList:true,subtree:true})};var io=function(){var o="connection"in window.navigator?window.navigator.connection:null;var e="mozConnection"in window.navigator?window.navigator.mozConnection:null;var n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;var t=o||e||n;return t};var ro=function(){var o="userAgentData"in window.navigator?window.navigator.userAgentData:null;var e=io();return{connectionDownlink:e===null||e===void 0?void 0:e.downlink,connectionEffectiveType:e===null||e===void 0?void 0:e.effectiveType,connectionRtt:e===null||e===void 0?void 0:e.rtt,connectionSaveData:e===null||e===void 0?void 0:e.saveData,userAgent:o&&o.brands.length>0?o:window.navigator.userAgent}};var co=function(){return __awaiter($,void 0,void 0,(function(){var o,e;return __generator(this,(function(n){o=R().elapsedTime;e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:M},ro()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void E("/api/zonos-elements/log-script-load",{body:e,method:"POST"});return[2]}))}))};var ao='<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 uo=".sc-zonos-checkout-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--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(--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(--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--header.sc-zonos-checkout img.sc-zonos-checkout{width:150px;min-width:150px}.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}.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}.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(--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}";var lo=uo;var ho=90*60*1e3;var fo=6*60*60*1e3;var zo=o("zonos_checkout",function(){function o(o){var n=this;e(this,o);this.onChangeLocaleListener=function(){};this.applyStripeTheme=function(){return __awaiter(n,void 0,void 0,(function(){var o,e,n,t,s;return __generator(this,(function(i){switch(i.label){case 0:s=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||D.appearance.theme;return[4,d({overrideBorderRadius:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorPrimary,overrideSecondaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorSecondary,overrideTheme:this.isMobile?s:undefined,paypalEnabled:I()})];case 1:i.sent();return[2]}}))}))};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(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.appearanceSettingsOverride=undefined;this.preview=false;this.mobile=false;this.defaultAddress=null;this.forceDialogOpen=false;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=o.detail;void h({adjustments:l.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,n;return __generator(this,(function(t){if(!this.open){return[2]}if(!(o===null||o===void 0?void 0:o.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;T("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){f()}l.step="customer-info";z();m();(n=(e=D.checkoutSettings).onClose)===null||n===void 0?void 0:n.call(e);return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,t,s,r,c,e,n,n,a;return __generator(this,(function(u){switch(u.label){case 0:if(!window.Zonos.cartData)return[3,2];N("tempCartUUID is provided, start building cart");o=oo(window.Zonos.cartData),e=o.adjustments,n=o.cartItems;return[4,h({adjustments:e,cartItems:n})];case 1:u.sent();return[3,9];case 2:if(!(typeof D.checkoutSettings.createCartId==="function"))return[3,6];N('"createCartId" is provided, start building cart');return[4,D.checkoutSettings.createCartId()];case 3:t=u.sent();window.Zonos.cartId=t;return[4,Y(t)];case 4:s=u.sent();r=s===null||s===void 0?void 0:s.cartData;if(!r){U("Failed to build cart, please try again.");return[2]}c=oo(r),e=c.adjustments,n=c.cartItems;return[4,h({adjustments:e,cartItems:n})];case 5:u.sent();return[3,9];case 6:if(!(D.checkoutSettings.buildCartDetail&&i.selectedCountryCode))return[3,9];N("build cart detail");return[4,D.checkoutSettings.buildCartDetail({countryCode:i.selectedCountryCode,currencyCode:i.targetCurrency})];case 7:n=u.sent();return[4,h({adjustments:[],cartItems:n})];case 8:u.sent();u.label=9;case 9:if(!!v.clientSecret)return[3,11];return[4,k()];case 10:a=u.sent();N("stripeStoreInitCheckoutSession: ".concat(a));if(!a){return[2,false]}u.label=11;case 11:return[4,this.applyStripeTheme()];case 12:u.sent();return[2,true]}}))}))};o.prototype.reloadCheckoutSession=function(){window.location.reload()};o.prototype.handleOrderDuplication=function(){var o=F(localStorage.getItem("zonos--placed-order-info"));if(!o){localStorage.removeItem("zonos--placed-order-info");return}var e=Date.now()-o.time;N("=== 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 n=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||fo;if(e>n){N("=== Existing placed order info is older than ".concat(n,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=o;N("=== Showing order duplication confirmation","warn")};o.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null};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;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=D.checkoutSettings.placeOrderButtonSelector;N("attach checkout ".concat(e));if(!e&&!window.Zonos.cartData){return}var n=[e,"#".concat(J),"#".concat(Q)].filter(Boolean);var t=document.querySelectorAll(n.join(","));t.forEach((function(n){var t=n.getAttribute("data-zonos-checkout-attached");if(t){return}N("attached event to button ".concat(e),"info",{button:n});n.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,n,t,s;return __generator(this,(function(i){switch(i.label){case 0:if(!window.Zonos.isLegacyCheckout&&(!to()||no())){return[2]}e.preventDefault();e.stopPropagation();N("zonos checkout button clicked");v.isFetchingSession=true;this.open=true;i.label=1;case 1:i.trys.push([1,4,,5]);return[4,this.buildCartAndInit()];case 2:n=i.sent();if(!n){throw new Error("Error building cart")}g({isPreview:this.preview,sessionTimeout:ho});return[4,eo()];case 3:t=i.sent().enabled;l.shouldHideDiscountInput=!t;T("zonos-checkout-start");void p("checkout_open");this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void co()}return[3,5];case 4:s=i.sent();v.isFetchingSession=false;void H({endpoint:"Error creating Checkout",errors:[s instanceof Error?s.toString():"Unknown error"],metadata:{allLogs:M,cartId:window.Zonos.cartId,href:window.location.href,storeBaseUrl:(o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl}});w({messages:[b("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:b("Error creating Checkout")});return[3,5];case 5:return[2]}}))}))}),{capture:true,passive:false});if(!D.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches(J)){n.dispatchEvent(Z("click"));a();n.remove()}if(n.matches("#".concat(Q))){n.dispatchEvent(Z("click"));n.remove()}}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.useLegacyQueryParams=function(){var o=new URLSearchParams(window.location.search);N("legacy urlParams","info",Object.fromEntries(o.entries()));var e=function(e){var n=o.get(e);if(!n||n==="undefined"){return null}return n};var n=y(o)||i.selectedCountryCode;var t=e("customerCity");var s=e("customerEmail")||"";var r=e("customerAddress1");var c=e("customerAddress2")||"";var a=e("customerName");var u=e("customerPhone");var d=e("customerZip")||"";var l=e("customerState")||"";if(!r||!t&&!l||!a||!u||!n){N("Missing required query params so it can not be prefilled","info",[!r&&"line1",!t&&"city",!a&&"name",!u&&"phone",!n&&"country"].filter(Boolean).join(", "));return}this.defaultAddress={address:{city:t||"",country:n,line1:r,line2:c,postal_code:d,state:l},email:s,name:a,phone:u}};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(n){v.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;so({domesticRedirectedBtnSelector:J,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(){v.stripe=window.Zonos.stripe;e.stripe=window.Zonos.stripe;if(!e.stripe){N("waiting for stripe to be loaded");return}if(e.storybookPaymentStatusOverride){clearInterval(o);return}N("init checkout");if(e.preview||e.forceDialogOpen){void e.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){e.attachCheckout()}else if(window){e.attachCheckout();var n=new MutationObserver((function(){e.attachCheckout()}));n.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){l.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){x(o);return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(n){switch(n.label){case 0:this.submitLoading=true;return[4,C()];case 1:n.sent();o=setInterval((function(){if(l.landedCostData||!v.isFetchingLandedCost){if(l.landedCostData){void B({currency:l.currency});_()}e.submitLoading=false;clearInterval(o)}}),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(){_();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleInventoryCheckDialogCancel=function(){l.inventoryCheckErrorMessage=null};o.prototype.handleInventoryCheckDialogConfirm=function(){l.inventoryCheckErrorMessage=null;void this.closeDialogHandler({confirmed:true})};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n;return __generator(this,(function(t){switch(t.label){case 0:v.hasPaymentError=false;this.submitLoading=true;l.inventoryCheckErrorMessage=null;t.label=1;case 1:t.trys.push([1,3,,4]);o=l;return[4,S()];case 2:o.inventoryCheckErrorMessage=t.sent();return[3,4];case 3:e=t.sent();l.inventoryCheckErrorMessage=b("Unable to check inventory. Please try again.");return[3,4];case 4:if(l.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}t.label=5;case 5:t.trys.push([5,7,,8]);return[4,O()];case 6:t.sent();_();m();return[3,8];case 7:n=t.sent();U(n);v.hasPaymentError=true;return[3,8];case 8:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,t;return __generator(this,(function(s){switch(s.label){case 0:j();if(!this.preview)return[3,2];l.step="customer-info";return[4,this.init()];case 1:s.sent();return[2];case 2:f();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){o=window.Zonos.cartData.storeBaseUrl;window.location.href=o;return[2]}e=window.location.href;n=e.split("?")[0];t=G();this.open=false;if(!t){window.history.replaceState(window.history.state,document.title,n);window.location.reload()}return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=V(this.mobile);void this.applyStripeTheme();N("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=V(this.mobile);void this.applyStripeTheme();N("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=L(this.appearanceSettingsOverride.theme)}};o.prototype.handleAddressChange=function(){j()};o.prototype.componentWillLoad=function(){var o=this;void this.init();this.isMobile=V(this.mobile);this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=A("selectedLocale",(function(){void o.applyStripeTheme()}));N("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){j();f();this.onChangeLocaleListener()};o.prototype.render=function(){var o=this;var e,r,c,a;var u=l.step!=="finish"&&l.step!=="error"&&!v.stripeElements||v.isFetchingSession;var d=P(D.appearance,this.appearanceSettingsOverride),h=d.colorPrimary,f=d.colorSecondary,z=d.logoUrl,m=d.style;var k=D.appearance.zonosAttribution==="ENABLED";var g=D.appearance.theme;var p=h&&K(h)?"DARK":"LIGHT";var w=this.isMobile?g:p;var y=!this.isMobile?f:undefined;var x=i.customMessages;var C=(e=x.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message;var _=this.getCurrentLocalePageEnum();var S=x.filter((function(o){return o.pageName===_}));var O=function(){var e=o.preview?"".concat(z,"?timestamp=").concat(Date.now()):z;return n("div",{class:"zonos--logo"},e&&n("img",{alt:"".concat(D.organizationName," logo"),src:e}))};var j=G();var A=function(){var e=new URLSearchParams(window.location.search);var t=e.get("zonosQaUrl");var s=e.get("zonosDebug");return n("zonos-v-stack",null,n("div",{class:"zonos--logo-wrapper"},O(),j&&n("zonos-badge",{badgeColor:"orange",size:"small"},b("Test mode")),s==="1"&&n("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&n("zonos-badge",{badgeColor:"purple",size:"small"},t)),n("zonos-checkout-progress-tabs",{backgroundColor:o.isMobile?"--zonos-elements-gray-0":null}),S.map((function(o){return n("zonos-custom-message",{icon:ao,message:o.message})})))};var I=function(){if(l.checkoutSessionTimeoutShow){return n("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:b("Your checkout session has expired. Please reload the page to continue."),restStateTitle:b("Session timed out"),restStateType:"Warning"},n("zonos-button",{onClick:function(){return o.reloadCheckoutSession()},variant:"primary"},b("Reload")))}return n("div",{class:"zonos--content",style:{"--border-radius":W({overrideBorderStyle:m})}},l.step!=="finish"&&l.step!=="error"&&n(s,null,n("div",{class:"zonos--left","data-theme":w,style:{"--primary-color":!o.isMobile?h:""}},!o.isMobile&&A(),l.step==="customer-info"&&n("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.defaultAddress,isMobile:o.isMobile,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:y}),l.step==="shipping"&&n("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:y}),l.step==="payment"&&n("zonos-checkout-payment",{continueLoading:o.submitLoading,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:y})),n("div",{class:"zonos--right","data-theme":g},o.isMobile&&A(),n("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&n("zonos-currency-toggle",null),!o.isLegacyCheckout&&n("zonos-button",{class:"zonos--close-button",icon:n("zonos-icon",{"aria-label":"Close checkout dialog",content:X}),noBackground:true,onClick:function(){return o.closeDialogHandler()}})),n("div",{class:"flex--wrapper"},n("div",{class:"zonos--wrapper"},n("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile}}),n("zonos-collapse",{collapsed:o.collapseReviewMobile&&o.isMobile},n("zonos-cart-items",null),o.isMobile&&n("zonos-v-stack",{spacing:16},n("zonos-cart-subtotal",{submitBtnColor:y}),n("zonos-custom-message",{class:"zonos--checkout-default-message",icon:ao,message:C})))),n("zonos-cart-restricted-items",null),!o.isMobile&&n("zonos-v-stack",{spacing:16},n("zonos-cart-subtotal",null),n("zonos-custom-message",{class:"zonos--checkout-default-message",icon:ao,message:C}))))),(l.step==="finish"||l.step==="error")&&n("div",{class:"zonos--done","data-theme":g},n("div",{class:"zonos--header"},O(),n("zonos-button",{class:"zonos--close-button",icon:n("zonos-icon",{"aria-label":"Close checkout dialog",content:X}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:g})),n("zonos-checkout-finish",{borderRadius:m,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),n("zonos-checkout-footer",{"data-theme":g,mobile:o.isMobile,slot:!o.isMobile?"dialog-footer":undefined}))};return n(t,{class:q(["zonos--checkout zonos--elements",k&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?I():n("zonos-dialog",{borderStyle:m,"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"},I()),n("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:b("Don't close"),dialogConfirmBtnText:b("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:b("Would you like to close checkout and return to the site?"),dialogTitle:b("Are you sure?"),onCancelClicked:function(){o.confirmDialogOpen=false},onConfirmClicked:function(){return o.closeDialogHandler({confirmed:true})}}),n("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:b("Return to merchant site"),dialogConfirmBtnText:b("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((r=this.placedOrderInfo)===null||r===void 0?void 0:r.zonosOrderNumber)?b("It looks like you placed an order just a few minutes ago ([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)}):b("It looks like you placed an order just a few minutes ago ([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:b("Are you sure?"),dialogWidth:450,onCancelClicked:function(){o.handleCancelOrderDuplication()},onConfirmClicked:function(){o.confirmProceedWithOrderDuplication()}}),n("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:b("Return to cart"),dialogIntent:"danger",dialogOpen:!!l.inventoryCheckErrorMessage,dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:b("Couldn't place order"),dialogType:"alert",onCancelClicked:function(){o.handleInventoryCheckDialogCancel()},onConfirmClicked:function(){return o.handleInventoryCheckDialogConfirm()}}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"]}},enumerable:false,configurable:true});return o}());zo.style=lo}}}));
1
+ var __awaiter=this&&this.__awaiter||function(o,e,n,t){function s(o){return o instanceof n?o:new n((function(e){e(o)}))}return new(n||(n=Promise))((function(n,i){function r(o){try{a(t.next(o))}catch(o){i(o)}}function c(o){try{a(t["throw"](o))}catch(o){i(o)}}function a(o){o.done?n(o.value):s(o.value).then(r,c)}a((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,s,i,r;return r={next:c(0),throw:c(1),return:c(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function c(o){return function(e){return a([o,e])}}function a(c){if(t)throw new TypeError("Generator is already executing.");while(r&&(r=0,c[0]&&(n=0)),n)try{if(t=1,s&&(i=c[0]&2?s["return"]:c[0]?s["throw"]||((i=s["return"])&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;if(s=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:n.label++;return{value:c[1],done:false};case 5:n.label++;s=c[1];c=[0];continue;case 7:c=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){n.label=c[1];break}if(c[0]===6&&n.label<i[1]){n.label=i[1];i=c;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(c);break}if(i[2])n.ops.pop();n.trys.pop();continue}c=e.call(o,n)}catch(o){c=[6,o];s=0}finally{t=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}};System.register(["./p-fd061229.system.js","./p-5a011a47.system.js","./p-49135023.system.js","./p-15750a04.system.js","./p-43b3c2ae.system.js","./p-64372f93.system.js","./p-aed0098c.system.js","./p-23e7c655.system.js","./p-2cce0f21.system.js","./p-daab619c.system.js","./p-33b57fab.system.js","./p-2770ba48.system.js"],(function(o){"use strict";var e,n,t,s,i,r,c,a,u,d,l,h,f,z,m,v,k,g,p,w,b,y,x,C,_,S,O,j,A,I,T,B,D,L,P,E,N,U,H,R,M,F,Z,G,V,q,W,K,Y,J,Q,X;return{setters:[function(o){e=o.r;n=o.h;t=o.H;s=o.F},function(o){i=o.l;r=o.s;c=o.a;a=o.b;u=o.c;d=o.i;l=o.d;h=o.e;f=o.f;z=o.g;m=o.h;v=o.j;k=o.k;g=o.m;p=o.t;w=o.n;b=o.o;y=o.p;x=o.q;C=o.r;_=o.u;S=o.v;O=o.w;j=o.x;A=o.y},function(o){I=o.p;T=o.s;B=o.a},function(o){D=o.z;L=o.g;P=o.m},function(o){E=o.h;N=o.l;U=o.a;H=o.s;R=o.g;M=o.b;F=o.j},function(o){Z=o.c;G=o.g},function(o){V=o.i},function(o){q=o.c},function(o){W=o.g},function(o){K=o.i},function(o){Y=o.s;J=o.d;Q=o.c},function(o){X=o.R}],execute:function(){var $=this;var oo=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 eo=function(){return __awaiter($,void 0,void 0,(function(){var o,e,n;return __generator(this,(function(t){switch(t.label){case 0:return[4,E("/api/zonos-elements/get-store-discount-enabled-status")];case 1:o=t.sent(),e=o.errors,n=o.json;if(e.length||!(n===null||n===void 0?void 0:n.enabled)){return[2,{enabled:false}]}return[2,{enabled:true}]}}))}))};var no=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return true}if(i.isDisabledCountry){if(o){N("Checkout: disabled country")}return true}return false};var to=function(o){if(o===void 0){o=true}if(!i.localizationLoaded){return false}if(!i.isShippableCountry){if(o){N("Checkout: not shippable country")}return false}return true};var so=function(o){var e=o.domesticRedirectedBtnSelector,n=o.onShippingAddressSessionFound;if(!window.Zonos.isBigCommerce){return}var t=new MutationObserver((function(){return __awaiter($,void 0,void 0,(function(){var o,s,i,d,l;var h=this;return __generator(this,(function(f){o=document.querySelector(e);s=r();if(!o&&s){i=document.createElement("button");i.style.display="none";i.id="zonos--domestic-redirected-checkout-button";document.body.appendChild(i);n===null||n===void 0?void 0:n(s);t.disconnect();return[2]}d=document.querySelector('select[name="shippingAddress.countryCode"]');l=document.querySelector("#checkout-shipping-continue");if(!d||!l){return[2]}t.disconnect();l.addEventListener("click",(function(o){return __awaiter(h,void 0,void 0,(function(){var e,n,t,s,i,r,l;return __generator(this,(function(h){t=d.value;if(!t){return[2]}c(t);if(!to(false)){a();return[2]}s=document.querySelector("form");if(!s){return[2]}i=new FormData(s);r=document.querySelector("input#addressLine1Input");l={address1:(e=i.get("shippingAddress.address1"))!==null&&e!==void 0?e:r&&r.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:(n=i.get("shippingAddress.stateOrProvince"))!==null&&n!==void 0?n:i.get("shippingAddress.stateOrProvinceCode")};if(Object.values(l).some((function(o){return o===undefined||o===null}))){U("One or more shipping address field is missing",Object.entries(l));void H({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:{domain:window.location.hostname,storeId:D.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]}))}))}));t.observe(document.body,{childList:true,subtree:true})};var io=function(){var o="connection"in window.navigator?window.navigator.connection:null;var e="mozConnection"in window.navigator?window.navigator.mozConnection:null;var n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;var t=o||e||n;return t};var ro=function(){var o="userAgentData"in window.navigator?window.navigator.userAgentData:null;var e=io();return{connectionDownlink:e===null||e===void 0?void 0:e.downlink,connectionEffectiveType:e===null||e===void 0?void 0:e.effectiveType,connectionRtt:e===null||e===void 0?void 0:e.rtt,connectionSaveData:e===null||e===void 0?void 0:e.saveData,userAgent:o&&o.brands.length>0?o:window.navigator.userAgent}};var co=function(){return __awaiter($,void 0,void 0,(function(){var o,e;return __generator(this,(function(n){o=R().elapsedTime;e={cache:"miss",eventName:"jsdelivr",flag:"LOG_CHECKOUT_FACADE_LOAD",href:window.location.href,loadTime:o,metadata:Object.assign({allLogs:M},ro()),scriptLoadUrl:"checkoutFacade",storeId:window.Zonos.storeId};void E("/api/zonos-elements/log-script-load",{body:e,method:"POST"});return[2]}))}))};var ao='<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 uo=".sc-zonos-checkout-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-checkout-h *.sc-zonos-checkout{font-family:var(--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(--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(--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--header.sc-zonos-checkout img.sc-zonos-checkout{width:150px;min-width:150px}.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}.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}.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(--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}";var lo=uo;var ho=90*60*1e3;var fo=6*60*60*1e3;var zo=o("zonos_checkout",function(){function o(o){var n=this;e(this,o);this.onChangeLocaleListener=function(){};this.applyStripeTheme=function(){return __awaiter(n,void 0,void 0,(function(){var o,e,n,t,s;return __generator(this,(function(i){switch(i.label){case 0:s=((o=this.appearanceSettingsOverride)===null||o===void 0?void 0:o.theme)||D.appearance.theme;return[4,d({overrideBorderRadius:(e=this.appearanceSettingsOverride)===null||e===void 0?void 0:e.style,overridePrimaryColor:(n=this.appearanceSettingsOverride)===null||n===void 0?void 0:n.colorPrimary,overrideSecondaryColor:(t=this.appearanceSettingsOverride)===null||t===void 0?void 0:t.colorSecondary,overrideTheme:this.isMobile?s:undefined,paypalEnabled:I()})];case 1:i.sent();return[2]}}))}))};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(l.step){case"customer-info":return"checkout_customer_info";case"shipping":return"checkout_shipping_info";case"payment":return"checkout_payment_info";default:return null}};this.appearanceSettingsOverride=undefined;this.preview=false;this.mobile=false;this.defaultAddress=null;this.forceDialogOpen=false;this.open=this.forceDialogOpen;this.stripe=window.Zonos.stripe;this.submitLoading=false;this.collapseReviewMobile=true;this.isAttachError=false;this.isMobile=false;this.zonosReviewRef=undefined;this.storybookPaymentStatusOverride=undefined;this.isLegacyCheckout=window.Zonos.isLegacyCheckout;this.confirmDialogOpen=false;this.inventoryCheckErrorMessage=null;this.placedOrderInfo=null}o.prototype.initCartInfoHandler=function(o){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=o.detail;void h({adjustments:l.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,n;return __generator(this,(function(t){if(!this.open){return[2]}if(!(o===null||o===void 0?void 0:o.confirmed)){this.confirmDialogOpen=true;return[2]}this.confirmDialogOpen=false;T("zonos-checkout-close");this.open=this.forceDialogOpen||false;if(!this.preview&&l.step==="finish"){f()}l.step="customer-info";z();m();(n=(e=D.checkoutSettings).onClose)===null||n===void 0?void 0:n.call(e);return[2]}))}))};o.prototype.buildCartAndInit=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,t,s,r,c,e,n,n,a;return __generator(this,(function(u){switch(u.label){case 0:if(!window.Zonos.cartData)return[3,2];N("tempCartUUID is provided, start building cart");o=oo(window.Zonos.cartData),e=o.adjustments,n=o.cartItems;return[4,h({adjustments:e,cartItems:n})];case 1:u.sent();return[3,9];case 2:if(!(typeof D.checkoutSettings.createCartId==="function"))return[3,6];N('"createCartId" is provided, start building cart');return[4,D.checkoutSettings.createCartId()];case 3:t=u.sent();window.Zonos.cartId=t;return[4,Y(t)];case 4:s=u.sent();r=s===null||s===void 0?void 0:s.cartData;if(!r){U("Failed to build cart, please try again.");return[2]}c=oo(r),e=c.adjustments,n=c.cartItems;return[4,h({adjustments:e,cartItems:n})];case 5:u.sent();return[3,9];case 6:if(!(D.checkoutSettings.buildCartDetail&&i.selectedCountryCode))return[3,9];N("build cart detail");return[4,D.checkoutSettings.buildCartDetail({countryCode:i.selectedCountryCode,currencyCode:i.targetCurrency})];case 7:n=u.sent();return[4,h({adjustments:[],cartItems:n})];case 8:u.sent();u.label=9;case 9:if(!!v.clientSecret)return[3,11];return[4,k()];case 10:a=u.sent();N("stripeStoreInitCheckoutSession: ".concat(a));if(!a){return[2,false]}u.label=11;case 11:return[4,this.applyStripeTheme()];case 12:u.sent();return[2,true]}}))}))};o.prototype.reloadCheckoutSession=function(){window.location.reload()};o.prototype.handleOrderDuplication=function(){var o=F(localStorage.getItem("zonos--placed-order-info"));if(!o){localStorage.removeItem("zonos--placed-order-info");return}var e=Date.now()-o.time;N("=== 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 n=parseFloat(new URLSearchParams(window.location.search).get("zonosOverrideExpiredDuplication")||"0")||fo;if(e>n){N("=== Existing placed order info is older than ".concat(n,"ms, cleaning localStorage"),"warn");localStorage.removeItem("zonos--placed-order-info");return}this.placedOrderInfo=o;N("=== Showing order duplication confirmation","warn")};o.prototype.confirmProceedWithOrderDuplication=function(){this.placedOrderInfo=null};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;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=D.checkoutSettings.placeOrderButtonSelector;N("attach checkout ".concat(e));if(!e&&!window.Zonos.cartData){return}var n=[e,"#".concat(J),"#".concat(Q)].filter(Boolean);var t=document.querySelectorAll(n.join(","));t.forEach((function(n){var t=n.getAttribute("data-zonos-checkout-attached");if(t){return}N("attached event to button ".concat(e),"info",{button:n});n.addEventListener("click",(function(e){return __awaiter(o,void 0,void 0,(function(){var o,n,t,s;return __generator(this,(function(i){switch(i.label){case 0:if(!window.Zonos.isLegacyCheckout&&(!to()||no())){return[2]}e.preventDefault();e.stopPropagation();N("zonos checkout button clicked");v.isFetchingSession=true;this.open=true;i.label=1;case 1:i.trys.push([1,4,,5]);return[4,this.buildCartAndInit()];case 2:n=i.sent();if(!n){throw new Error("Error building cart")}g({isPreview:this.preview,sessionTimeout:ho});return[4,eo()];case 3:t=i.sent().enabled;l.shouldHideDiscountInput=!t;T("zonos-checkout-start");void p("checkout_open");this.handleOrderDuplication();if(window.Zonos.isLegacyCheckout){void co()}return[3,5];case 4:s=i.sent();v.isFetchingSession=false;void H({endpoint:"Error creating Checkout",errors:[s instanceof Error?s.toString():"Unknown error"],metadata:{allLogs:M,cartId:window.Zonos.cartId,href:window.location.href,storeBaseUrl:(o=window.Zonos.cartData)===null||o===void 0?void 0:o.storeBaseUrl}});w({messages:[b("There's been an error creating your checkout session. Please reload and try again or contact support if the error persists")],title:b("Error creating Checkout")});return[3,5];case 5:return[2]}}))}))}),{capture:true,passive:false});if(!D.checkoutSettings.disablePlaceOrderButtonActivation){n.removeAttribute("disabled")}n.setAttribute("data-zonos-checkout-attached","true");if(n.matches(J)){n.dispatchEvent(Z("click"));a();n.remove()}if(n.matches("#".concat(Q))){n.dispatchEvent(Z("click"));n.remove()}}))};o.prototype.appearanceSettingsOverrideChanged=function(){if(!this.appearanceSettingsOverride){return}void this.applyStripeTheme()};o.prototype.useLegacyQueryParams=function(){var o=new URLSearchParams(window.location.search);N("legacy urlParams","info",Object.fromEntries(o.entries()));var e=function(e){var n=o.get(e);if(!n||n==="undefined"){return null}return n};var n=y(o)||i.selectedCountryCode;var t=e("customerCity");var s=e("customerEmail")||"";var r=e("customerAddress1");var c=e("customerAddress2")||"";var a=e("customerName");var u=e("customerPhone");var d=e("customerZip")||"";var l=e("customerState")||"";if(!r||!t&&!l||!a||!u||!n){N("Missing required query params so it can not be prefilled","info",[!r&&"line1",!t&&"city",!a&&"name",!u&&"phone",!n&&"country"].filter(Boolean).join(", "));return}this.defaultAddress={address:{city:t||"",country:n,line1:r,line2:c,postal_code:d,state:l},email:s,name:a,phone:u}};o.prototype.init=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(n){v.stripe=window.Zonos.stripe;this.stripe=window.Zonos.stripe;so({domesticRedirectedBtnSelector:J,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(){v.stripe=window.Zonos.stripe;e.stripe=window.Zonos.stripe;if(!e.stripe){N("waiting for stripe to be loaded");return}if(e.storybookPaymentStatusOverride){clearInterval(o);return}N("init checkout");if(e.preview||e.forceDialogOpen){void e.buildCartAndInit()}else if(window.Zonos.isLegacyCheckout){e.attachCheckout()}else if(window){e.attachCheckout();var n=new MutationObserver((function(){e.attachCheckout()}));n.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){l.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){x(o);return[2]}))}))};o.prototype.handleCustomerInfoContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o;var e=this;return __generator(this,(function(n){switch(n.label){case 0:this.submitLoading=true;return[4,C()];case 1:n.sent();o=setInterval((function(){if(l.landedCostData||!v.isFetchingLandedCost){if(l.landedCostData){void B({currency:l.currency});_()}e.submitLoading=false;clearInterval(o)}}),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(){_();o.submitLoading=false}),500);return[2]}))}))};o.prototype.handleInventoryCheckDialogCancel=function(){l.inventoryCheckErrorMessage=null};o.prototype.handleInventoryCheckDialogConfirm=function(){l.inventoryCheckErrorMessage=null;void this.closeDialogHandler({confirmed:true})};o.prototype.handleStripePaymentContinue=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n;return __generator(this,(function(t){switch(t.label){case 0:v.hasPaymentError=false;this.submitLoading=true;l.inventoryCheckErrorMessage=null;t.label=1;case 1:t.trys.push([1,3,,4]);o=l;return[4,S()];case 2:o.inventoryCheckErrorMessage=t.sent();return[3,4];case 3:e=t.sent();l.inventoryCheckErrorMessage=b("Unable to check inventory. Please try again.");return[3,4];case 4:if(l.inventoryCheckErrorMessage){this.submitLoading=false;return[2]}t.label=5;case 5:t.trys.push([5,7,,8]);return[4,O()];case 6:t.sent();_();m();return[3,8];case 7:n=t.sent();U(n);v.hasPaymentError=true;return[3,8];case 8:this.submitLoading=false;return[2]}}))}))};o.prototype.handleFinishClick=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,n,t;return __generator(this,(function(s){switch(s.label){case 0:j();if(!this.preview)return[3,2];l.step="customer-info";return[4,this.init()];case 1:s.sent();return[2];case 2:f();if(window.Zonos.isLegacyCheckout&&window.Zonos.cartData){o=window.Zonos.cartData.storeBaseUrl;window.location.href=o;return[2]}e=window.location.href;n=e.split("?")[0];t=G();this.open=false;if(!t){window.history.replaceState(window.history.state,document.title,n);window.location.reload()}return[2]}}))}))};o.prototype.handleWindowResize=function(){this.isMobile=V(this.mobile);void this.applyStripeTheme();N("mobile: ".concat(this.isMobile))};o.prototype.handleMobileChange=function(){this.isMobile=V(this.mobile);void this.applyStripeTheme();N("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=L(this.appearanceSettingsOverride.theme)}};o.prototype.handleAddressChange=function(){j()};o.prototype.componentWillLoad=function(){var o=this;void this.init();this.isMobile=V(this.mobile);this.handleAppearanceSettingsOverrideChange();this.onChangeLocaleListener=A("selectedLocale",(function(){void o.applyStripeTheme()}));N("mobile: ".concat(this.isMobile))};o.prototype.disconnectedCallback=function(){j();f();this.onChangeLocaleListener()};o.prototype.render=function(){var o=this;var e,r,c,a;var u=l.step!=="finish"&&l.step!=="error"&&!v.stripeElements||v.isFetchingSession;var d=P(D.appearance,this.appearanceSettingsOverride),h=d.colorPrimary,f=d.colorSecondary,z=d.logoUrl,m=d.style;var k=D.appearance.zonosAttribution==="ENABLED";var g=D.appearance.theme;var p=h&&K(h)?"DARK":"LIGHT";var w=this.isMobile?g:p;var y=!this.isMobile?f:undefined;var x=i.customMessages;var C=(e=x.find((function(o){return o.pageName==="checkout_default"})))===null||e===void 0?void 0:e.message;var _=this.getCurrentLocalePageEnum();var S=x.filter((function(o){return o.pageName===_}));var O=function(){var e=o.preview?"".concat(z,"?timestamp=").concat(Date.now()):z;return n("div",{class:"zonos--logo"},e&&n("img",{alt:"".concat(D.organizationName," logo"),src:e}))};var j=G();var A=function(){var e=new URLSearchParams(window.location.search);var t=e.get("zonosQaUrl");var s=e.get("zonosDebug");return n("zonos-v-stack",null,n("div",{class:"zonos--logo-wrapper"},O(),j&&n("zonos-badge",{badgeColor:"orange",size:"small"},b("Test mode")),s==="1"&&n("zonos-badge",{badgeColor:"cyan",size:"small"},"debug"),t&&n("zonos-badge",{badgeColor:"purple",size:"small"},t)),n("zonos-checkout-progress-tabs",{backgroundColor:o.isMobile?"--zonos-elements-gray-0":null}),S.map((function(o){return n("zonos-custom-message",{icon:ao,message:o.message})})))};var I=function(){if(l.checkoutSessionTimeoutShow){return n("zonos-rest-state",{class:"zonos--session-timeout",restStateSubtitle:b("Your checkout session has expired. Please reload the page to continue."),restStateTitle:b("Session timed out"),restStateType:"Warning"},n("zonos-button",{onClick:function(){return o.reloadCheckoutSession()},variant:"primary"},b("Reload")))}return n("div",{class:"zonos--content",style:{"--border-radius":W({overrideBorderStyle:m})}},l.step!=="finish"&&l.step!=="error"&&n(s,null,n("div",{class:"zonos--left","data-theme":w,style:{"--primary-color":!o.isMobile?h:""}},!o.isMobile&&A(),l.step==="customer-info"&&n("zonos-customer-info",{continueLoading:o.submitLoading,defaultAddress:o.defaultAddress,isMobile:o.isMobile,onContinueClicked:function(){return o.handleCustomerInfoContinue()},submitBtnColor:y}),l.step==="shipping"&&n("zonos-shipping",{continueLoading:o.submitLoading,onContinueClicked:function(){return o.handleShippingContinue()},submitBtnColor:y}),l.step==="payment"&&n("zonos-checkout-payment",{continueLoading:o.submitLoading,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:y})),n("div",{class:"zonos--right","data-theme":g},o.isMobile&&A(),n("div",{class:"zonos--right-actions"},window.Zonos.showBaseForeign&&n("zonos-currency-toggle",null),!o.isLegacyCheckout&&n("zonos-button",{class:"zonos--close-button",icon:n("zonos-icon",{"aria-label":"Close checkout dialog",content:X}),noBackground:true,onClick:function(){return o.closeDialogHandler()}})),n("div",{class:"flex--wrapper"},n("div",{class:"zonos--wrapper"},n("zonos-review",{collapsed:o.collapseReviewMobile,mobile:o.isMobile,onClick:function(){if(!o.isMobile){return}o.collapseReviewMobile=!o.collapseReviewMobile}}),n("zonos-collapse",{collapsed:o.collapseReviewMobile&&o.isMobile},n("zonos-cart-items",null),o.isMobile&&n("zonos-v-stack",{spacing:16},n("zonos-cart-subtotal",{submitBtnColor:y}),n("zonos-custom-message",{class:"zonos--checkout-default-message",icon:ao,message:C})))),n("zonos-cart-restricted-items",null),!o.isMobile&&n("zonos-v-stack",{spacing:16},n("zonos-cart-subtotal",null),n("zonos-custom-message",{class:"zonos--checkout-default-message",icon:ao,message:C}))))),(l.step==="finish"||l.step==="error")&&n("div",{class:"zonos--done","data-theme":g},n("div",{class:"zonos--header"},O(),n("zonos-button",{class:"zonos--close-button",icon:n("zonos-icon",{"aria-label":"Close checkout dialog",content:X}),noBackground:true,onClick:function(){return o.handleFinishClick()},theme:g})),n("zonos-checkout-finish",{borderRadius:m,onCloseClick:function(){return o.handleFinishClick()},overrideNotification:l.step==="error"&&!!l.error?Object.assign(Object.assign({},l.error),{type:"error"}):undefined,storybookForceStatus:o.storybookPaymentStatusOverride})),n("zonos-checkout-footer",{"data-theme":g,mobile:o.isMobile,slot:!o.isMobile?"dialog-footer":undefined}))};return n(t,{class:q(["zonos--checkout zonos--elements",k&&"has-footer",this.preview&&"preview",this.isMobile&&"mobile"])},this.preview?I():n("zonos-dialog",{borderStyle:m,"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"},I()),n("zonos-confirm-dialog",{class:"zonos--close-confirm-dialog",dialogCancelBtnText:b("Don't close"),dialogConfirmBtnText:b("Close"),dialogIntent:"warn",dialogOpen:this.confirmDialogOpen,dialogSubtitle:b("Would you like to close checkout and return to the site?"),dialogTitle:b("Are you sure?"),onCancelClicked:function(){o.confirmDialogOpen=false},onConfirmClicked:function(){return o.closeDialogHandler({confirmed:true})}}),n("zonos-confirm-dialog",{class:"zonos--order-duplication-dialog",dialogCancelBtnText:b("Return to merchant site"),dialogConfirmBtnText:b("Proceed with order"),dialogIntent:"warn",dialogOpen:!!this.placedOrderInfo,dialogSubtitle:((r=this.placedOrderInfo)===null||r===void 0?void 0:r.zonosOrderNumber)?b("It looks like you placed an order just a few minutes ago ([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)}):b("It looks like you placed an order just a few minutes ago ([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:b("Are you sure?"),dialogWidth:450,onCancelClicked:function(){o.handleCancelOrderDuplication()},onConfirmClicked:function(){o.confirmProceedWithOrderDuplication()}}),n("zonos-confirm-dialog",{class:"zonos--inventory-check-failure-dialog",dialogConfirmBtnText:b("Return to cart"),dialogIntent:"danger",dialogOpen:!!l.inventoryCheckErrorMessage,dialogSubtitle:l.inventoryCheckErrorMessage,dialogTitle:b("Couldn't place order"),dialogType:"alert",onCancelClicked:function(){o.handleInventoryCheckDialogCancel()},onConfirmClicked:function(){return o.handleInventoryCheckDialogConfirm()}}))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{appearanceSettingsOverride:["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],mobile:["handleMobileChange"],defaultAddress:["handleAddressChange"]}},enumerable:false,configurable:true});return o}());zo.style=lo}}}));