@zonos/elements 1.3.30 → 1.3.31

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.
@@ -249,9 +249,9 @@ const zonosLoadUrl = (() => {
249
249
  }
250
250
  return null;
251
251
  })();
252
- const ZONOS_URL = "https://v1.3.30.js.zonos.com";
253
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30";
254
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.30";
252
+ const ZONOS_URL = "https://v1.3.31.js.zonos.com";
253
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31";
254
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.31";
255
255
  const MAIN_LOAD_CDN_TYPE = 'jsdelivr';
256
256
  const INTER_FONT_URL = 'https://rsms.me';
257
257
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
@@ -271,7 +271,7 @@ Zonos.isBigCommerce = false;
271
271
  */
272
272
  Zonos.isNpm = true;
273
273
  Zonos.zonosQaUrl = null;
274
- Zonos.version = `v${"1.3.30"}`;
274
+ Zonos.version = `v${"1.3.31"}`;
275
275
  Zonos.modeAlerted = false;
276
276
  Zonos.tempCartData = null;
277
277
  Zonos.getCurrentTimestamp = () => new Date().getTime();
package/dist/esm/index.js CHANGED
@@ -245,9 +245,9 @@ const zonosLoadUrl = (() => {
245
245
  }
246
246
  return null;
247
247
  })();
248
- const ZONOS_URL = "https://v1.3.30.js.zonos.com";
249
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30";
250
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.30";
248
+ const ZONOS_URL = "https://v1.3.31.js.zonos.com";
249
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31";
250
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.31";
251
251
  const MAIN_LOAD_CDN_TYPE = 'jsdelivr';
252
252
  const INTER_FONT_URL = 'https://rsms.me';
253
253
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
@@ -267,7 +267,7 @@ Zonos.isBigCommerce = false;
267
267
  */
268
268
  Zonos.isNpm = true;
269
269
  Zonos.zonosQaUrl = null;
270
- Zonos.version = `v${"1.3.30"}`;
270
+ Zonos.version = `v${"1.3.31"}`;
271
271
  Zonos.modeAlerted = false;
272
272
  Zonos.tempCartData = null;
273
273
  Zonos.getCurrentTimestamp = () => new Date().getTime();
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,e,o,r){function t(n){return n instanceof o?n:new o((function(e){e(n)}))}return new(o||(o=Promise))((function(o,i){function s(n){try{u(r.next(n))}catch(n){i(n)}}function a(n){try{u(r["throw"](n))}catch(n){i(n)}}function u(n){n.done?o(n.value):t(n.value).then(s,a)}u((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,t,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(n){return function(e){return u([n,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(o=0)),o)try{if(r=1,t&&(i=a[0]&2?t["return"]:a[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,a[1])).done)return i;if(t=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;t=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=e.call(n,o)}catch(n){a=[6,n];t=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{l as log,a as logError}from"./logError-c456c092.js";var checkIfLoadVersionDomain=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var t=new URL(e).origin;var i=o.some((function(n){return t.includes(n)}));var s=r.some((function(n){return t.includes(n)}));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:s,isWhiteListed:i}};var fallbackList=["jsdelivr","unpkg","vercel"];var getNextFallbackUrl=function(n){var e=fallbackList.indexOf(n);var o=fallbackList[e+1];return o||null};var extractZonosQaUrl=function(n){if(!n){return null}var e=new URL(n).searchParams;var o=e.get("zonosQaUrl");if(!o){return null}var r=/[^a-zA-Z0-9-_]+/.test(o);if(!!r){return null}return o};var getZonosQaUrl=function(){if(typeof window==="undefined"){return null}var n=extractZonosQaUrl(window.location.href);if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var e="preview.js.zonos.com";var o="https://".concat(n,".").concat(e);log("[ZONOS-WARNING] using '".concat(o,"' for loading script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var r="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",r);window.location.reload();return null}));return o};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var n=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(e);var r=document.head||document.body;if(!r){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(o);return o};var zonosStripeLoadScript=function(n){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(e,o){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){e(window.Stripe);return}try{var r=zonosStripeFindScript();if(r&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!r){r=injectScript(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(n){o(n);return}}));return stripePromise$1};var registerWrapper=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var initStripe=function(n,e,o){if(n===null){return null}var r=n.apply(undefined,e);registerWrapper(r,o);return r};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(n){if(!loadCalled){console.warn(n)}}));var zonosLoadStripe=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(o){loadCalled=true;e=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,n,e)}))]}))}))};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=checkIfLoadVersionDomain({loadScriptSrc:n===null||n===void 0?void 0:n.src}),o=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return o}return null}();var ZONOS_URL="https://v1.3.30.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.30";var MAIN_LOAD_CDN_TYPE="jsdelivr";var INTER_FONT_URL="https://rsms.me";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var INTER_FONT_REGEX=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var Zonos=function(){function n(){}return n}();_a=Zonos;Zonos.doneInit=false;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos.isBigCommerce=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.version="v".concat("1.3.30");Zonos.modeAlerted=false;Zonos.tempCartData=null;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.init=function(n){return __awaiter(void 0,[n],void 0,(function(n){var e=n.appearance,o=n.checkoutSettings,r=n.currencyConverter,t=n.helloSettings,i=n.onCountryChange,s=n.overrideCurrencyFormat,a=n.storeId,u=n.zonosApiKey;return __generator(this,(function(n){if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));if(!u){logError("Missing Zonos API key");return[2]}_a.zonosApiKey=u;_a.storeId=a;log("init zonos");_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:t,onCountryChange:i,overrideCurrencyFormat:s},zonosApiKey:u});_a.doneInit=true;return[2]}))}))};Zonos.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};Zonos.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};Zonos.showNotification=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.showNotification(n))};Zonos.updateOrganizationName=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};Zonos.disablePlaceOrderButtons=function(n){var e=n.autoEnable,o=e===void 0?true:e,r=n.disable,t=n.placeOrderButtonSelector;if(t){var i=document.querySelectorAll(t);var s=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};i.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(r){n.setAttribute("disabled","true");n.addEventListener("click",s)}else{n.removeAttribute("disabled");n.removeEventListener("click",s)}}));if(o&&r){setTimeout((function(){i.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",s)}))}),5e3)}}};Zonos.injectController=function(n){var e=n.config,o=n.zonosApiKey;var r;if(document.querySelector("zonos-controller")){return}if((r=e.checkoutSettings)===null||r===void 0?void 0:r.placeOrderButtonSelector){var t=e.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:t});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:t})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=e;s.zonosApiKey=o;s.addEventListener("stripeInitEvent",(function(n){return __awaiter(void 0,void 0,void 0,(function(){var e,o;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;log("loading Stripe");return[4,zonosLoadStripe(e.publishableKey)];case 1:o=r.sent();if(!o){logError("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);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(n){var e=n.cdnType,o=n.isModule,r=n.theRestUrl;var t=_a.getZonosUrl(e);var i="".concat(t,"/").concat(r);var s=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(s()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var a=document.head||document.body;var u=document.createElement("script");if(!!o){u.type="module"}else{u.noModule=true}u.src=i;u.crossOrigin="anonymous";u.onerror=function(){logError("Failed to load ".concat(u.src));var n=getNextFallbackUrl(e);if(!n){return}_a.injectScript({cdnType:n,isModule:o,theRestUrl:r})};a.appendChild(u)};Zonos.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;default:return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||e()}return e()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(n){var e=n.cdnType,o=n.theRestUrl;var r=_a.getZonosUrl(e);var t=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");t.appendChild(i);var s=document.createElement("link");s.rel="stylesheet";s.href="".concat(r,"/").concat(o);s.onerror=function(){logError("Failed to load ".concat(s.href));var n=getNextFallbackUrl(e);if(!n){return}_a.injectStylesheet({cdnType:n,theRestUrl:o})};t.appendChild(s)};Zonos.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(INTER_FONT_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(INTER_FONT_REGEX.test(o.href)){continue}return o}return null};if(n()){log("Inter font already injected","warn");return}var e=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=INTER_FONT_URL;e.appendChild(o);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(INTER_FONT_URL,"/inter/inter.css");e.appendChild(r);log("Zonos font injected!")};Zonos.setupGoogleFont=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};Zonos.injectSupportGoogleFont=function(n){var e;log("[FONT] injecting ".concat(n));var o=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var t=document.createElement("link");t.rel="preconnect";t.href=GOOGLE_FONT_URL;r.appendChild(t)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);log("[FONT] ".concat(o," font injected!"))};export{Zonos};
1
+ var __awaiter=this&&this.__awaiter||function(n,e,o,r){function t(n){return n instanceof o?n:new o((function(e){e(n)}))}return new(o||(o=Promise))((function(o,i){function s(n){try{u(r.next(n))}catch(n){i(n)}}function a(n){try{u(r["throw"](n))}catch(n){i(n)}}function u(n){n.done?o(n.value):t(n.value).then(s,a)}u((r=r.apply(n,e||[])).next())}))};var __generator=this&&this.__generator||function(n,e){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,t,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(n){return function(e){return u([n,e])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(o=0)),o)try{if(r=1,t&&(i=a[0]&2?t["return"]:a[0]?t["throw"]||((i=t["return"])&&i.call(t),0):t.next)&&!(i=i.call(t,a[1])).done)return i;if(t=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;t=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1];i=a;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(a);break}if(i[2])o.ops.pop();o.trys.pop();continue}a=e.call(n,o)}catch(n){a=[6,n];t=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{l as log,a as logError}from"./logError-c456c092.js";var checkIfLoadVersionDomain=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var r=["qa.js.zonos.com"];var t=new URL(e).origin;var i=o.some((function(n){return t.includes(n)}));var s=r.some((function(n){return t.includes(n)}));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:s,isWhiteListed:i}};var fallbackList=["jsdelivr","unpkg","vercel"];var getNextFallbackUrl=function(n){var e=fallbackList.indexOf(n);var o=fallbackList[e+1];return o||null};var extractZonosQaUrl=function(n){if(!n){return null}var e=new URL(n).searchParams;var o=e.get("zonosQaUrl");if(!o){return null}var r=/[^a-zA-Z0-9-_]+/.test(o);if(!!r){return null}return o};var getZonosQaUrl=function(){if(typeof window==="undefined"){return null}var n=extractZonosQaUrl(window.location.href);if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var e="preview.js.zonos.com";var o="https://".concat(n,".").concat(e);log("[ZONOS-WARNING] using '".concat(o,"' for loading script"),"warn");void fetch(o).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(o,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var n=new URLSearchParams(window.location.search);n.delete("zonosQaUrl");var e=window.location.pathname;var r="".concat(e,"?").concat(n.toString());window.history.replaceState(window.history.state,"",r);window.location.reload();return null}));return o};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var n=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(e);var r=document.head||document.body;if(!r){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}r.appendChild(o);return o};var zonosStripeLoadScript=function(n){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(e,o){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){e(window.Stripe);return}try{var r=zonosStripeFindScript();if(r&&n){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!r){r=injectScript(n)}r===null||r===void 0?void 0:r.addEventListener("load",(function(){if(window.Stripe){e(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));r===null||r===void 0?void 0:r.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(n){o(n);return}}));return stripePromise$1};var registerWrapper=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var initStripe=function(n,e,o){if(n===null){return null}var r=n.apply(undefined,e);registerWrapper(r,o);return r};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(n){if(!loadCalled){console.warn(n)}}));var zonosLoadStripe=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(o){loadCalled=true;e=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,n,e)}))]}))}))};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=checkIfLoadVersionDomain({loadScriptSrc:n===null||n===void 0?void 0:n.src}),o=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return o}return null}();var ZONOS_URL="https://v1.3.31.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.31";var MAIN_LOAD_CDN_TYPE="jsdelivr";var INTER_FONT_URL="https://rsms.me";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var INTER_FONT_REGEX=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var Zonos=function(){function n(){}return n}();_a=Zonos;Zonos.doneInit=false;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos.isBigCommerce=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.version="v".concat("1.3.31");Zonos.modeAlerted=false;Zonos.tempCartData=null;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.init=function(n){return __awaiter(void 0,[n],void 0,(function(n){var e=n.appearance,o=n.checkoutSettings,r=n.currencyConverter,t=n.helloSettings,i=n.onCountryChange,s=n.overrideCurrencyFormat,a=n.storeId,u=n.zonosApiKey;return __generator(this,(function(n){if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));if(!u){logError("Missing Zonos API key");return[2]}_a.zonosApiKey=u;_a.storeId=a;log("init zonos");_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:t,onCountryChange:i,overrideCurrencyFormat:s},zonosApiKey:u});_a.doneInit=true;return[2]}))}))};Zonos.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};Zonos.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};Zonos.showNotification=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.showNotification(n))};Zonos.updateOrganizationName=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};Zonos.disablePlaceOrderButtons=function(n){var e=n.autoEnable,o=e===void 0?true:e,r=n.disable,t=n.placeOrderButtonSelector;if(t){var i=document.querySelectorAll(t);var s=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};i.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(r){n.setAttribute("disabled","true");n.addEventListener("click",s)}else{n.removeAttribute("disabled");n.removeEventListener("click",s)}}));if(o&&r){setTimeout((function(){i.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",s)}))}),5e3)}}};Zonos.injectController=function(n){var e=n.config,o=n.zonosApiKey;var r;if(document.querySelector("zonos-controller")){return}if((r=e.checkoutSettings)===null||r===void 0?void 0:r.placeOrderButtonSelector){var t=e.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:t});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:t})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=e;s.zonosApiKey=o;s.addEventListener("stripeInitEvent",(function(n){return __awaiter(void 0,void 0,void 0,(function(){var e,o;return __generator(this,(function(r){switch(r.label){case 0:e=n.detail;log("loading Stripe");return[4,zonosLoadStripe(e.publishableKey)];case 1:o=r.sent();if(!o){logError("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);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(n){var e=n.cdnType,o=n.isModule,r=n.theRestUrl;var t=_a.getZonosUrl(e);var i="".concat(t,"/").concat(r);var s=function(){var n=document.querySelector('script[src="'.concat(i,'"]'));return!!n};if(s()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var a=document.head||document.body;var u=document.createElement("script");if(!!o){u.type="module"}else{u.noModule=true}u.src=i;u.crossOrigin="anonymous";u.onerror=function(){logError("Failed to load ".concat(u.src));var n=getNextFallbackUrl(e);if(!n){return}_a.injectScript({cdnType:n,isModule:o,theRestUrl:r})};a.appendChild(u)};Zonos.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;default:return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||e()}return e()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(n){var e=n.cdnType,o=n.theRestUrl;var r=_a.getZonosUrl(e);var t=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");t.appendChild(i);var s=document.createElement("link");s.rel="stylesheet";s.href="".concat(r,"/").concat(o);s.onerror=function(){logError("Failed to load ".concat(s.href));var n=getNextFallbackUrl(e);if(!n){return}_a.injectStylesheet({cdnType:n,theRestUrl:o})};t.appendChild(s)};Zonos.injectZonosCss=function(){var n=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(n()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(INTER_FONT_URL,'"]'));for(var e=0;e<n.length;e++){var o=n[e];if(!o){continue}if(INTER_FONT_REGEX.test(o.href)){continue}return o}return null};if(n()){log("Inter font already injected","warn");return}var e=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=INTER_FONT_URL;e.appendChild(o);var r=document.createElement("link");r.rel="stylesheet";r.href="".concat(INTER_FONT_URL,"/inter/inter.css");e.appendChild(r);log("Zonos font injected!")};Zonos.setupGoogleFont=function(n){var e;void((e=_a.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};Zonos.injectSupportGoogleFont=function(n){var e;log("[FONT] injecting ".concat(n));var o=(e=n.match(/family=(.*?):/))===null||e===void 0?void 0:e[1];var r=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var t=document.createElement("link");t.rel="preconnect";t.href=GOOGLE_FONT_URL;r.appendChild(t)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(n,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=n;r.appendChild(i);log("[FONT] ".concat(o," font injected!"))};export{Zonos};
@@ -1 +1 @@
1
- (function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(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 n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.30.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30",w="jsdelivr",f="https://rsms.me",g="https://fonts.googleapis.com",v=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S.isBigCommerce=!1,S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.30",S.modeAlerted=!1,S.tempCartData=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:n})=>{if(n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.30";default:return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!v.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${g}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=g,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},exports.Zonos=S})();
1
+ (function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(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 n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.31.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31",w="jsdelivr",f="https://rsms.me",g="https://fonts.googleapis.com",v=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S.isBigCommerce=!1,S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.31",S.modeAlerted=!1,S.tempCartData=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:n})=>{if(n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.31";default:return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!v.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${g}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=g,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},exports.Zonos=S})();
@@ -1 +1 @@
1
- (function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{return await e.json()}catch(e){if(t)throw e;return o&&console.error(e),null}};const o=async(o,t)=>{const n=(function(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t})(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const 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"},n.headers),c=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:a,method:s});return(async(o,t)=>{let n;try{n=await fetch(o,t)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null}}const r=n.headers.get("Zonos-Mode"),s=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&r&&s&&("production"===r&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===r&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),n.ok)return{errors:[],json:await e({response:n}),response:n};const i=n.status.toString();try{const o=await e({response:n,shouldThrow:!0});return{errors:[{message:`${i}: ${JSON.stringify(o)}`,type:i}],json:null,response:n}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null}}})(i.toString(),c)},t=(e,o,...t)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...t));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":i.warn(e,...t);break;case"info":i.info(e,...t);break;case"error":i.error(e,...t);break;default:i.groupCollapsed(e,...t),i.trace(),i.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=async({endpoint:e,errors:t,metadata:n})=>{const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};o("https://v1.route.js.zonos.com/api/zonos-elements/log-error",{body:s,method:"POST"})},s=({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}},i=["jsdelivr","unpkg","vercel"],a=e=>{const o=i.indexOf(e);return i[o+1]||null},c=()=>{if("undefined"==typeof window)return null;const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href);if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const o=`https://${e}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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,n=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),o},l="https://js.stripe.com/v3",d=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,p="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 m=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(p),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&d.test(t.src))return t}return null})();r&&e?console.warn(p):r||(r=(e=>{const o=document.createElement("script");o.src=`${l}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),h=Promise.resolve().then((()=>m(null)));let y=!1;h.catch((e=>{y||console.warn(e)}));var g;const w=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=s({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),f="https://v1.3.30.js.zonos.com",v=w||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30",S="jsdelivr",C="https://rsms.me",b="https://fonts.googleapis.com",z=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;let j=class{};var L;g=j,j.doneInit=!1,j.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),j.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),j.isBigCommerce=!1,j.isNpm=!0,j.zonosQaUrl=null,j.version="v1.3.30",j.modeAlerted=!1,j.tempCartData=null,j.getCurrentTimestamp=()=>(new Date).getTime(),j.zonosController=null,j.init=async({appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:c,zonosApiKey:l})=>{g.doneInit||(t(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),l?(g.zonosApiKey=l,g.storeId=c,t("init zonos"),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a},zonosApiKey:l}),g.doneInit=!0):n("Missing Zonos API key"))},j.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},j.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},j.showNotification=e=>{var o;null===(o=g.zonosController)||void 0===o||o.showNotification(e)},j.updateOrganizationName=e=>{var o;null===(o=g.zonosController)||void 0===o||o.updateOrganizationName(e)},j.disablePlaceOrderButtons=({autoEnable:e=!0,disable:o,placeOrderButtonSelector:t})=>{if(t){const n=document.querySelectorAll(t),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.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((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},j.injectController=({config:e,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=e.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{g.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=e,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const r=await(async(...e)=>{y=!0;const o=Date.now();return h.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(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),g.zonosController=s,t("Zonos controller injected!")},j.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${g.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=a(e);t&&g.injectScript({cdnType:t,isModule:o,theRestUrl:r})},i.appendChild(c)},j.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return v;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.30";default:return f}};if(g.isNpm){return c()||o()}return o()},j.injectZonosCdn=()=>{g.injectScript({cdnType:S,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:S,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},j.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=g.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${f}/`,r.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{n(`Failed to load ${i.href}`);const t=a(e);t&&g.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(i)},j.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:S,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},j.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${C}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!z.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=C,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${C}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},j.setupGoogleFont=e=>{var o;null===(o=g.zonosController)||void 0===o||o.setupGoogleFont(e)},j.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${b}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=b,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)};const U=c();class O{static get isNpm(){return!1}}L=O,O.isBigCommerce=!1,O.requested=!1,O.zonosQaUrl=null,O.tempCartData=null,O.zonosApiKey=null,O.isLegacyCheckout=!1,O.legacyStoreLogo=null,O.legacyStoreFavicon=null,O.parallelLoadTimes=[],O.paralellLoadState="off",O.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:n,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((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:!!t},n)))}catch(e){}},O.loadScriptLogParallelHandler=async e=>{try{if(L.parallelLoadTimes.push(e),2===L.parallelLoadTimes.length){const e=L.parallelLoadTimes.find((e=>"vercel"===e.type)),o=L.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void r({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}});L.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){}},O.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{n(`[ZONOS - loadZonos] ${e}`),r({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},O.getGithubCdn=({type:e,version:o})=>{let t="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30";"unpkg"===e&&(t="https://unpkg.com/@zonos/elements@1.3.30");return o?t.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`):t},O.injectZonos=({cdnType:e=S,initConfig:o,parallelLoaded:n,vercelUrl:s,version:c})=>{var l;const d="vercel"===e?s:L.getGithubCdn({type:e,version:c}),p=U||d,u=p.replace("https://","").replace("http://",""),m=document.createElement("script"),h=c&&c<"1.2.5"?"loadZonos.js":"zonos.js";m.src=`https://${u}/dist/scripts/${h}`,t(`[ZONOS - loadZonos] Injecting "${h}" from "${u}"`,"info");const y="4g"===(null===(l=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})())||void 0===l?void 0:l.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=i[0]===e,f=i[1],v="on"===L.paralellLoadState&&y&&w&&f&&!g;v&&L.injectZonos({cdnType:f,initConfig:o,parallelLoaded:!0,vercelUrl:s,version:c});const C=performance.now();m.addEventListener("load",(()=>{if(v||n?L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-C,scriptLoadUrl:m.src,storeId:L.storeId,type:e}):L.loadScriptLogHandler({fallbackLoadTime:performance.now()-C,scriptLoadUrl:m.src,storeId:L.storeId,type:e}),L.isBigCommerce||(L.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=U,window.Zonos.isBigCommerce=L.isBigCommerce,L.isLegacyCheckout){if(!L.zonosApiKey)throw L.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!L.tempCartData)throw L.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(L.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=L.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=L.tempCartData;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:L.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:L.tempCartData.contShoppingURL}),zonosApiKey:L.zonosApiKey});o=e}window.Zonos.version&&(t(`[ZONOS - loadZonos] Execute "Zonos.init" from "${h}" from "${u}"`,"info"),window.Zonos.init(o))})),m.addEventListener("error",(async()=>{if(!v&&!n){const t=a(e);if(!t)return;L.injectZonos({cdnType:t,initConfig:o,vercelUrl:s,version:c})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||U)return;if(v||n)return void L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-C,isError:!0,scriptLoadUrl:m.src,storeId:L.storeId,type:e});["unpkg","vercel"].includes(e)?r({endpoint:m.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-C,cdnType:e,loadUrl:p,version:c}}):r({endpoint:m.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-C}})})),document.head.appendChild(m)},O.setupCartData=async e=>{const r=await(async e=>{const{errors:t,json:n}=await o("https://v1.route.js.zonos.com/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n})(e);if(t("[ZONOS - loadZonos] getting temp cart data","info",r),!r)throw n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),L.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return L.tempCartData=r.tempCart,L.legacyStoreLogo=r.storeLogoUrl,L.legacyStoreFavicon=r.storeFaviconUrl,{storeId:r.tempCart.storeId,zonosApiKey:r.zonosApiKey}},O.init=async e=>{var r;const i="https://v1.3.30.js.zonos.com",a=document.querySelector('script[src*="/zonos.js"]'),c=null===(r=document.querySelector("script[src*='/loadZonos.js']"))||void 0===r?void 0:r.src,l=null==c?void 0:c.includes("timestamp=");if(!(L.isNpm||c&&l))return void n("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(a||!c||L.requested)return void t("[ZONOS - loadZonos] script is already loaded or requested","info");L.requested=!0;let d=e.storeId;if(e.tempCartUUID){const o=await L.setupCartData(e.tempCartUUID);d=o.storeId,L.zonosApiKey=o.zonosApiKey,L.isLegacyCheckout=!0}if(!d)return t("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});L.storeId=d;const p=new URL("https://v1.route.js.zonos.com/api/get-store-version");p.searchParams.set("storeId",e.storeId.toString());const{errors:u,json:m}=await o(p.toString());if(u.length||!m)return t("[ZONOS - loadZonos] Error getting store version, loadding the latest version.","error"),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});const{version:h}=m;if(!a){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=s({loadScriptSrc:c}),i=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,a=r&&!n?null:h;t("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:i,loadVersion:a,version:h}),L.injectZonos({initConfig:e,vercelUrl:i,version:a})}},void 0===window.Zonos&&(window.Zonos=O)})();
1
+ (function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{return await e.json()}catch(e){if(t)throw e;return o&&console.error(e),null}};const o=async(o,t)=>{const n=(function(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t})(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const 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"},n.headers),c=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:a,method:s});return(async(o,t)=>{let n;try{n=await fetch(o,t)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null}}const r=n.headers.get("Zonos-Mode"),s=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&r&&s&&("production"===r&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===r&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),n.ok)return{errors:[],json:await e({response:n}),response:n};const i=n.status.toString();try{const o=await e({response:n,shouldThrow:!0});return{errors:[{message:`${i}: ${JSON.stringify(o)}`,type:i}],json:null,response:n}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null}}})(i.toString(),c)},t=(e,o,...t)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...t));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(o){case"warn":i.warn(e,...t);break;case"info":i.info(e,...t);break;case"error":i.error(e,...t);break;default:i.groupCollapsed(e,...t),i.trace(),i.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=async({endpoint:e,errors:t,metadata:n})=>{const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},n)};o("https://v1.route.js.zonos.com/api/zonos-elements/log-error",{body:s,method:"POST"})},s=({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}},i=["jsdelivr","unpkg","vercel"],a=e=>{const o=i.indexOf(e);return i[o+1]||null},c=()=>{if("undefined"==typeof window)return null;const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href);if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const o=`https://${e}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${o}' for loading script`,"warn"),fetch(o).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${o}' 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,n=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),o},l="https://js.stripe.com/v3",d=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,p="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 m=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(p),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&d.test(t.src))return t}return null})();r&&e?console.warn(p):r||(r=(e=>{const o=document.createElement("script");o.src=`${l}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),h=Promise.resolve().then((()=>m(null)));let y=!1;h.catch((e=>{y||console.warn(e)}));var g;const w=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=s({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),f="https://v1.3.31.js.zonos.com",v=w||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31",S="jsdelivr",C="https://rsms.me",b="https://fonts.googleapis.com",z=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;let j=class{};var L;g=j,j.doneInit=!1,j.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),j.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),j.isBigCommerce=!1,j.isNpm=!0,j.zonosQaUrl=null,j.version="v1.3.31",j.modeAlerted=!1,j.tempCartData=null,j.getCurrentTimestamp=()=>(new Date).getTime(),j.zonosController=null,j.init=async({appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:c,zonosApiKey:l})=>{g.doneInit||(t(`====== ZONOS DEBUG MODE: on (${g.version}) ======`),l?(g.zonosApiKey=l,g.storeId=c,t("init zonos"),g.injectZonosCdn(),g.injectZonosCss(),g.injectFonts(),g.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a},zonosApiKey:l}),g.doneInit=!0):n("Missing Zonos API key"))},j.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},j.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},j.showNotification=e=>{var o;null===(o=g.zonosController)||void 0===o||o.showNotification(e)},j.updateOrganizationName=e=>{var o;null===(o=g.zonosController)||void 0===o||o.updateOrganizationName(e)},j.disablePlaceOrderButtons=({autoEnable:e=!0,disable:o,placeOrderButtonSelector:t})=>{if(t){const n=document.querySelectorAll(t),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.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((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},j.injectController=({config:e,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=e.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{g.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=e,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const r=await(async(...e)=>{y=!0;const o=Date.now();return h.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(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),g.zonosController=s,t("Zonos controller injected!")},j.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${g.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=a(e);t&&g.injectScript({cdnType:t,isModule:o,theRestUrl:r})},i.appendChild(c)},j.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return v;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.31";default:return f}};if(g.isNpm){return c()||o()}return o()},j.injectZonosCdn=()=>{g.injectScript({cdnType:S,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),g.injectScript({cdnType:S,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},j.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=g.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${f}/`,r.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${o}`,i.onerror=()=>{n(`Failed to load ${i.href}`);const t=a(e);t&&g.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(i)},j.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(g.injectStylesheet({cdnType:S,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},j.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${C}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!z.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=C,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${C}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},j.setupGoogleFont=e=>{var o;null===(o=g.zonosController)||void 0===o||o.setupGoogleFont(e)},j.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${b}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=b,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)};const U=c();class O{static get isNpm(){return!1}}L=O,O.isBigCommerce=!1,O.requested=!1,O.zonosQaUrl=null,O.tempCartData=null,O.zonosApiKey=null,O.isLegacyCheckout=!1,O.legacyStoreLogo=null,O.legacyStoreFavicon=null,O.parallelLoadTimes=[],O.paralellLoadState="off",O.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:t,metadata:n,scriptLoadUrl:r,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(r)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((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:!!t},n)))}catch(e){}},O.loadScriptLogParallelHandler=async e=>{try{if(L.parallelLoadTimes.push(e),2===L.parallelLoadTimes.length){const e=L.parallelLoadTimes.find((e=>"vercel"===e.type)),o=L.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void r({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}});L.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){}},O.legacyCheckoutErrorHandler=({message:e,tempCartUUID:o})=>{n(`[ZONOS - loadZonos] ${e}`),r({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:o}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},O.getGithubCdn=({type:e,version:o})=>{let t="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31";"unpkg"===e&&(t="https://unpkg.com/@zonos/elements@1.3.31");return o&&"alpha"!==o?t.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`):t},O.injectZonos=({cdnType:e=S,initConfig:o,parallelLoaded:n,vercelUrl:s,version:c})=>{var l;const d="vercel"===e?s:L.getGithubCdn({type:e,version:c}),p=U||d,u=p.replace("https://","").replace("http://",""),m=document.createElement("script"),h=c&&c<"1.2.5"?"loadZonos.js":"zonos.js";m.src=`https://${u}/dist/scripts/${h}`,t(`[ZONOS - loadZonos] Injecting "${h}" from "${u}"`,"info");const y="4g"===(null===(l=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,t="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||t})())||void 0===l?void 0:l.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=i[0]===e,f=i[1],v="on"===L.paralellLoadState&&y&&w&&f&&!g;v&&L.injectZonos({cdnType:f,initConfig:o,parallelLoaded:!0,vercelUrl:s,version:c});const C=performance.now();m.addEventListener("load",(()=>{if(v||n?L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-C,scriptLoadUrl:m.src,storeId:L.storeId,type:e}):L.loadScriptLogHandler({fallbackLoadTime:performance.now()-C,scriptLoadUrl:m.src,storeId:L.storeId,type:e}),L.isBigCommerce||(L.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=U,window.Zonos.isBigCommerce=L.isBigCommerce,L.isLegacyCheckout){if(!L.zonosApiKey)throw L.legacyCheckoutErrorHandler({message:"zonosApiKey is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(!L.tempCartData)throw L.legacyCheckoutErrorHandler({message:"tempCartData is required for legacy checkout",tempCartUUID:o.tempCartUUID}),new Error("zonosApiKey is required for legacy checkout");if(L.legacyStoreFavicon){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=L.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.tempCartData=L.tempCartData;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:L.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:"ZONOS_SUCCESS_PAGE",successRedirectUrl:L.tempCartData.contShoppingURL}),zonosApiKey:L.zonosApiKey});o=e}window.Zonos.version&&(t(`[ZONOS - loadZonos] Execute "Zonos.init" from "${h}" from "${u}"`,"info"),window.Zonos.init(o))})),m.addEventListener("error",(async()=>{if(!v&&!n){const t=a(e);if(!t)return;L.injectZonos({cdnType:t,initConfig:o,vercelUrl:s,version:c})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||U)return;if(v||n)return void L.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-C,isError:!0,scriptLoadUrl:m.src,storeId:L.storeId,type:e});["unpkg","vercel"].includes(e)?r({endpoint:m.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-C,cdnType:e,loadUrl:p,version:c}}):r({endpoint:m.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-C}})})),document.head.appendChild(m)},O.setupCartData=async e=>{const r=await(async e=>{const{errors:t,json:n}=await o("https://v1.route.js.zonos.com/api/bigcommerce/legacy-migration/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n})(e);if(t("[ZONOS - loadZonos] getting temp cart data","info",r),!r)throw n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),L.legacyCheckoutErrorHandler({message:"Error getting temp cart data",tempCartUUID:e}),new Error("Error getting temp cart data");return L.tempCartData=r.tempCart,L.legacyStoreLogo=r.storeLogoUrl,L.legacyStoreFavicon=r.storeFaviconUrl,{storeId:r.tempCart.storeId,zonosApiKey:r.zonosApiKey}},O.init=async e=>{var r;const i="https://v1.3.31.js.zonos.com",a=document.querySelector('script[src*="/zonos.js"]'),c=null===(r=document.querySelector("script[src*='/loadZonos.js']"))||void 0===r?void 0:r.src,l=null==c?void 0:c.includes("timestamp=");if(!(L.isNpm||c&&l))return void n("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(a||!c||L.requested)return void t("[ZONOS - loadZonos] script is already loaded or requested","info");L.requested=!0;let d=e.storeId;if(e.tempCartUUID){const o=await L.setupCartData(e.tempCartUUID);d=o.storeId,L.zonosApiKey=o.zonosApiKey,L.isLegacyCheckout=!0}if(!d)return t("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});L.storeId=d;const p=new URL("https://v1.route.js.zonos.com/api/get-store-version");p.searchParams.set("storeId",e.storeId.toString());const{errors:u,json:m}=await o(p.toString());if(u.length||!m)return t("[ZONOS - loadZonos] Error getting store version, loadding the latest version.","error"),void L.injectZonos({initConfig:e,vercelUrl:i,version:null});const{version:h}=m;if(!a){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=s({loadScriptSrc:c}),i=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,a=r&&!n?null:h;t("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:i,loadVersion:a,version:h}),L.injectZonos({initConfig:e,vercelUrl:i,version:a})}},void 0===window.Zonos&&(window.Zonos=O)})();
@@ -1 +1 @@
1
- (function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(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 n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.30.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30",w="jsdelivr",f="https://rsms.me",g="https://fonts.googleapis.com",v=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S.isBigCommerce=!1,S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.30",S.modeAlerted=!1,S.tempCartData=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:n})=>{if(n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.30";default:return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!v.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${g}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=g,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=S)})();
1
+ (function(){"use strict";const e=(e,t,...n)=>{var o,r;if(!(!!(null===(o=window.Zonos)||void 0===o?void 0:o.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...n));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...n);break;case"info":i.info(e,...n);break;case"error":i.error(e,...n);break;default:i.groupCollapsed(e,...n),i.trace(),i.groupEnd()}},t=(t,...n)=>{e(t,"error",...n)},n=["jsdelivr","unpkg","vercel"],o=e=>{const t=n.indexOf(e);return n[t+1]||null},r=()=>{if("undefined"==typeof window)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);if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const n=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),n},s="https://js.stripe.com/v3",i=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,l="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(l),window.Stripe)n(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&i.test(n.src))return n}return null})();r&&e?console.warn(l):r||(r=(e=>{const n=document.createElement("script");n.src=`${s}`;const o=document.head||document.body;return o?(o.appendChild(n),n):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?n(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 n(null)}))),c),a=Promise.resolve().then((()=>d(null)));let u=!1;a.catch((e=>{u||console.warn(e)}));var p;const m=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,n=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),o=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:o,isWhiteListed:n}})({loadScriptSrc:null==e?void 0:e.src});return n?t:null})(),h="https://v1.3.31.js.zonos.com",y=m||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31",w="jsdelivr",f="https://rsms.me",g="https://fonts.googleapis.com",v=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class S{}p=S,S.doneInit=!1,S.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),S.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),S.isBigCommerce=!1,S.isNpm=!0,S.zonosQaUrl=null,S.version="v1.3.31",S.modeAlerted=!1,S.tempCartData=null,S.getCurrentTimestamp=()=>(new Date).getTime(),S.zonosController=null,S.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{p.doneInit||(e(`====== ZONOS DEBUG MODE: on (${p.version}) ======`),d?(p.zonosApiKey=d,p.storeId=c,e("init zonos"),p.injectZonosCdn(),p.injectZonosCss(),p.injectFonts(),p.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),p.doneInit=!0):t("Missing Zonos API key"))},S.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},S.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},S.showNotification=e=>{var t;null===(t=p.zonosController)||void 0===t||t.showNotification(e)},S.updateOrganizationName=e=>{var t;null===(t=p.zonosController)||void 0===t||t.updateOrganizationName(e)},S.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:n})=>{if(n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},S.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{p.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{u=!0;const t=Date.now();return a.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),p.zonosController=s,e("Zonos controller injected!")},S.injectScript=({cdnType:n,isModule:r,theRestUrl:s})=>{const i=`${p.getZonosUrl(n)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");r?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{t(`Failed to load ${c.src}`);const e=o(n);e&&p.injectScript({cdnType:e,isModule:r,theRestUrl:s})},l.appendChild(c)},S.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.31";default:return h}};if(p.isNpm){return r()||t()}return t()},S.injectZonosCdn=()=>{p.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),p.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},S.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const r=p.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${h}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${r}/${n}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const r=o(e);r&&p.injectStylesheet({cdnType:r,theRestUrl:n})},s.appendChild(l)},S.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(p.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},S.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!v.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=f,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},S.setupGoogleFont=e=>{var t;null===(t=p.zonosController)||void 0===t||t.setupGoogleFont(e)},S.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${g}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=g,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=S)})();
@@ -1 +1 @@
1
- import{l as e,a as n}from"./p-eaa335e1.js";const t=["jsdelivr","unpkg","vercel"],o=e=>{const n=t.indexOf(e);return t[n+1]||null},s="https://js.stripe.com/v3",r=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let l=null;const c=Promise.resolve().then((()=>{return e=null,null!==l||(l=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&r.test(t.src))return t}return null})();l&&e?console.warn(i):l||(l=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${s}${t}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),l;var e}));let d=!1;var u;c.catch((e=>{d||console.warn(e)}));const a=(()=>{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",".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})(),m="https://v1.3.30.js.zonos.com",p=a||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30",w="jsdelivr",f="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class v{}u=v,v.doneInit=!1,v.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),v.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),v.isBigCommerce=!1,v.isNpm=!0,v.zonosQaUrl=null,v.version="v1.3.30",v.modeAlerted=!1,v.tempCartData=null,v.getCurrentTimestamp=()=>(new Date).getTime(),v.zonosController=null,v.init=async({appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{u.doneInit||(e(`====== ZONOS DEBUG MODE: on (${u.version}) ======`),d?(u.zonosApiKey=d,u.storeId=c,e("init zonos"),u.injectZonosCdn(),u.injectZonosCss(),u.injectFonts(),u.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),u.doneInit=!0):n("Missing Zonos API key"))},v.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},v.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},v.showNotification=e=>{var n;null===(n=u.zonosController)||void 0===n||n.showNotification(e)},v.updateOrganizationName=e=>{var n;null===(n=u.zonosController)||void 0===n||n.updateOrganizationName(e)},v.disablePlaceOrderButtons=({autoEnable:e=!0,disable:n,placeOrderButtonSelector:t})=>{if(t){const o=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(n?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&n&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},v.injectController=({config:t,zonosApiKey:o})=>{var s;if(document.querySelector("zonos-controller"))return;if(null===(s=t.checkoutSettings)||void 0===s?void 0:s.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;u.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{u.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=t,r.zonosApiKey=o,r.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const s=await(async(...e)=>{d=!0;const n=Date.now();return c.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);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),u.zonosController=r,e("Zonos controller injected!")},v.injectScript=({cdnType:t,isModule:s,theRestUrl:r})=>{const i=`${u.getZonosUrl(t)}/${r}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");s?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const e=o(t);e&&u.injectScript({cdnType:e,isModule:s,theRestUrl:r})},l.appendChild(c)},v.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return p;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.30";default:return m}};return u.isNpm&&(()=>{if("undefined"==typeof window)return null;const n=(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);if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${t}' for loading script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t})()||t()},v.injectZonosCdn=()=>{u.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),u.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},v.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const s=u.getZonosUrl(e),r=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${m}/`,r.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${s}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const s=o(e);s&&u.injectStylesheet({cdnType:s,theRestUrl:t})},r.appendChild(l)},v.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(u.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},v.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!y.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=f,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},v.setupGoogleFont=e=>{var n;null===(n=u.zonosController)||void 0===n||n.setupGoogleFont(e)},v.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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{v as Zonos}
1
+ import{l as e,a as n}from"./p-eaa335e1.js";const t=["jsdelivr","unpkg","vercel"],o=e=>{const n=t.indexOf(e);return t[n+1]||null},s="https://js.stripe.com/v3",r=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let l=null;const c=Promise.resolve().then((()=>{return e=null,null!==l||(l=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&r.test(t.src))return t}return null})();l&&e?console.warn(i):l||(l=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${s}${t}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),l;var e}));let d=!1;var u;c.catch((e=>{d||console.warn(e)}));const a=(()=>{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",".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})(),m="https://v1.3.31.js.zonos.com",p=a||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31",w="jsdelivr",f="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class v{}u=v,v.doneInit=!1,v.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),v.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),v.isBigCommerce=!1,v.isNpm=!0,v.zonosQaUrl=null,v.version="v1.3.31",v.modeAlerted=!1,v.tempCartData=null,v.getCurrentTimestamp=()=>(new Date).getTime(),v.zonosController=null,v.init=async({appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{u.doneInit||(e(`====== ZONOS DEBUG MODE: on (${u.version}) ======`),d?(u.zonosApiKey=d,u.storeId=c,e("init zonos"),u.injectZonosCdn(),u.injectZonosCss(),u.injectFonts(),u.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),u.doneInit=!0):n("Missing Zonos API key"))},v.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},v.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},v.showNotification=e=>{var n;null===(n=u.zonosController)||void 0===n||n.showNotification(e)},v.updateOrganizationName=e=>{var n;null===(n=u.zonosController)||void 0===n||n.updateOrganizationName(e)},v.disablePlaceOrderButtons=({autoEnable:e=!0,disable:n,placeOrderButtonSelector:t})=>{if(t){const o=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(n?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&n&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},v.injectController=({config:t,zonosApiKey:o})=>{var s;if(document.querySelector("zonos-controller"))return;if(null===(s=t.checkoutSettings)||void 0===s?void 0:s.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;u.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{u.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=t,r.zonosApiKey=o,r.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const s=await(async(...e)=>{d=!0;const n=Date.now();return c.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);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),u.zonosController=r,e("Zonos controller injected!")},v.injectScript=({cdnType:t,isModule:s,theRestUrl:r})=>{const i=`${u.getZonosUrl(t)}/${r}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");s?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const e=o(t);e&&u.injectScript({cdnType:e,isModule:s,theRestUrl:r})},l.appendChild(c)},v.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return p;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.31";default:return m}};return u.isNpm&&(()=>{if("undefined"==typeof window)return null;const n=(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);if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${t}' for loading script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t})()||t()},v.injectZonosCdn=()=>{u.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),u.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},v.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const s=u.getZonosUrl(e),r=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${m}/`,r.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${s}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const s=o(e);s&&u.injectStylesheet({cdnType:s,theRestUrl:t})},r.appendChild(l)},v.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(u.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},v.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!y.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=f,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},v.setupGoogleFont=e=>{var n;null===(n=u.zonosController)||void 0===n||n.setupGoogleFont(e)},v.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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{v as Zonos}
@@ -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-63db40b9.system.js"],(function(n){"use strict";var e,t;return{setters:[function(n){e=n.l;t=n.a}],execute:function(){var r=this;var o=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.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 i=["jsdelivr","unpkg","vercel"];var u=function(n){var e=i.indexOf(n);var t=i[e+1];return t||null};var s=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 a=function(){if(typeof window==="undefined"){return null}var n=s(window.location.href);if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var t="preview.js.zonos.com";var r="https://".concat(n,".").concat(t);e("[ZONOS-WARNING] using '".concat(r,"' for loading script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' 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 r};var c="https://js.stripe.com/v3";var l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var f=function(){var n=document.querySelectorAll('script[src^="'.concat(c,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!l.test(t.src)){continue}return t}return null};var v=null;var m=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var r=document.createElement("script");r.src="".concat(c).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 w=function(n){if(v!==null){return v}v=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(d)}if(window.Stripe){e(window.Stripe);return}try{var r=f();if(r&&n){console.warn(d)}else if(!r){r=m(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 v};var p=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var h=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);p(r,t);return r};var y=Promise.resolve().then((function(){return w(null)}));var z=false;y.catch((function(n){if(!z){console.warn(n)}}));var j=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(r,void 0,void 0,(function(){var e;return __generator(this,(function(t){z=true;e=Date.now();return[2,y.then((function(t){return h(t,n,e)}))]}))}))};var g;var b=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=o({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var k="https://v1.3.30.js.zonos.com";var S=b||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.30";var O="https://unpkg.com/@zonos/elements@1.3.30";var _="jsdelivr";var L="https://rsms.me";var N="https://fonts.googleapis.com";var A=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var R=function(){function n(){}return n}();n("Zonos",R);g=R;R.doneInit=false;R.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);R.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);R.isBigCommerce=false;R.isNpm=true;R.zonosQaUrl=null;R.version="v".concat("1.3.30");R.modeAlerted=false;R.tempCartData=null;R.getCurrentTimestamp=function(){return(new Date).getTime()};R.zonosController=null;R.init=function(n){return __awaiter(r,[n],void 0,(function(n){var r=n.appearance,o=n.checkoutSettings,i=n.currencyConverter,u=n.helloSettings,s=n.onCountryChange,a=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;return __generator(this,(function(n){if(g.doneInit){return[2]}e("====== ZONOS DEBUG MODE: on (".concat(g.version,") ======"));if(!l){t("Missing Zonos API key");return[2]}g.zonosApiKey=l;g.storeId=c;e("init zonos");g.injectZonosCdn();g.injectZonosCss();g.injectFonts();g.injectController({config:{appearance:r,checkoutSettings:o,currencyConverter:i,helloSettings:u,onCountryChange:s,overrideCurrencyFormat:a},zonosApiKey:l});g.doneInit=true;return[2]}))}))};R.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};R.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};R.showNotification=function(n){var e;void((e=g.zonosController)===null||e===void 0?void 0:e.showNotification(n))};R.updateOrganizationName=function(n){var e;void((e=g.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};R.disablePlaceOrderButtons=function(n){var e=n.autoEnable,t=e===void 0?true:e,r=n.disable,o=n.placeOrderButtonSelector;if(o){var i=document.querySelectorAll(o);var u=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};i.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(r){n.setAttribute("disabled","true");n.addEventListener("click",u)}else{n.removeAttribute("disabled");n.removeEventListener("click",u)}}));if(t&&r){setTimeout((function(){i.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",u)}))}),5e3)}}};R.injectController=function(n){var o=n.config,i=n.zonosApiKey;var u;if(document.querySelector("zonos-controller")){return}if((u=o.checkoutSettings)===null||u===void 0?void 0:u.placeOrderButtonSelector){var s=o.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:s});var a=new MutationObserver((function(){g.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:s})}));a.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=o;c.zonosApiKey=i;c.addEventListener("stripeInitEvent",(function(n){return __awaiter(r,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,j(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 c.initCheckoutElement(o);return[2]}}))}))}));document.body.appendChild(c);g.zonosController=c;e("Zonos controller injected!")};R.injectScript=function(n){var r=n.cdnType,o=n.isModule,i=n.theRestUrl;var s=g.getZonosUrl(r);var a="".concat(s,"/").concat(i);var c=function(){var n=document.querySelector('script[src="'.concat(a,'"]'));return!!n};if(c()){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=u(r);if(!n){return}g.injectScript({cdnType:n,isModule:o,theRestUrl:i})};l.appendChild(d)};R.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return S;case"unpkg":return O;default:return k}};if(g.isNpm){var t=a();return t||e()}return e()};R.injectZonosCdn=function(){g.injectScript({cdnType:_,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});g.injectScript({cdnType:_,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});e("Zonos cdn script injected!")};R.injectStylesheet=function(n){var e=n.cdnType,r=n.theRestUrl;var o=g.getZonosUrl(e);var i=document.head||document.body;var s=document.createElement("link");s.rel="preconnect";s.href="".concat(k,"/");i.appendChild(s);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=u(e);if(!n){return}g.injectStylesheet({cdnType:n,theRestUrl:r})};i.appendChild(a)};R.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}g.injectStylesheet({cdnType:_,theRestUrl:"dist/zonos-elements/zonos-elements.css"});e("Zonos style css injected!")};R.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(L,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(A.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=L;t.appendChild(r);var o=document.createElement("link");o.rel="stylesheet";o.href="".concat(L,"/inter/inter.css");t.appendChild(o);e("Zonos font injected!")};R.setupGoogleFont=function(n){var e;void((e=g.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};R.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(N,'"]'))){var i=document.createElement("link");i.rel="preconnect";i.href=N;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{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-63db40b9.system.js"],(function(n){"use strict";var e,t;return{setters:[function(n){e=n.l;t=n.a}],execute:function(){var r=this;var o=function(n){var e=n.loadScriptSrc;if(!e){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var t=["dev.elements.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 i=["jsdelivr","unpkg","vercel"];var u=function(n){var e=i.indexOf(n);var t=i[e+1];return t||null};var s=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 a=function(){if(typeof window==="undefined"){return null}var n=s(window.location.href);if(!n){return null}if(n==="dev-elements"){return"https://dev.elements.zonos.com"}var t="preview.js.zonos.com";var r="https://".concat(n,".").concat(t);e("[ZONOS-WARNING] using '".concat(r,"' for loading script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' 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 r};var c="https://js.stripe.com/v3";var l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var f=function(){var n=document.querySelectorAll('script[src^="'.concat(c,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(!l.test(t.src)){continue}return t}return null};var v=null;var m=function(n){var e=n&&!n.advancedFraudSignals?"?advancedFraudSignals=false":"";var r=document.createElement("script");r.src="".concat(c).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 w=function(n){if(v!==null){return v}v=new Promise((function(e,t){if(typeof window==="undefined"||typeof document==="undefined"){e(null);return}if(window.Stripe&&n){console.warn(d)}if(window.Stripe){e(window.Stripe);return}try{var r=f();if(r&&n){console.warn(d)}else if(!r){r=m(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 v};var p=function(n,e){if(!n||!n._registerWrapper){return}n._registerWrapper({name:"stripe-js",startTime:e})};var h=function(n,e,t){if(n===null){return null}var r=n.apply(undefined,e);p(r,t);return r};var y=Promise.resolve().then((function(){return w(null)}));var z=false;y.catch((function(n){if(!z){console.warn(n)}}));var j=function(){var n=[];for(var e=0;e<arguments.length;e++){n[e]=arguments[e]}return __awaiter(r,void 0,void 0,(function(){var e;return __generator(this,(function(t){z=true;e=Date.now();return[2,y.then((function(t){return h(t,n,e)}))]}))}))};var g;var b=function(){if(typeof document==="undefined"){return null}var n=document.querySelector('script[src*="/zonos.js"]');var e=o({loadScriptSrc:n===null||n===void 0?void 0:n.src}),t=e.currentLoadScriptUrl,r=e.isWhiteListed;if(r){return t}return null}();var k="https://v1.3.31.js.zonos.com";var S=b||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.31";var O="https://unpkg.com/@zonos/elements@1.3.31";var _="jsdelivr";var L="https://rsms.me";var N="https://fonts.googleapis.com";var A=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;var R=function(){function n(){}return n}();n("Zonos",R);g=R;R.doneInit=false;R.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);R.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);R.isBigCommerce=false;R.isNpm=true;R.zonosQaUrl=null;R.version="v".concat("1.3.31");R.modeAlerted=false;R.tempCartData=null;R.getCurrentTimestamp=function(){return(new Date).getTime()};R.zonosController=null;R.init=function(n){return __awaiter(r,[n],void 0,(function(n){var r=n.appearance,o=n.checkoutSettings,i=n.currencyConverter,u=n.helloSettings,s=n.onCountryChange,a=n.overrideCurrencyFormat,c=n.storeId,l=n.zonosApiKey;return __generator(this,(function(n){if(g.doneInit){return[2]}e("====== ZONOS DEBUG MODE: on (".concat(g.version,") ======"));if(!l){t("Missing Zonos API key");return[2]}g.zonosApiKey=l;g.storeId=c;e("init zonos");g.injectZonosCdn();g.injectZonosCss();g.injectFonts();g.injectController({config:{appearance:r,checkoutSettings:o,currencyConverter:i,helloSettings:u,onCountryChange:s,overrideCurrencyFormat:a},zonosApiKey:l});g.doneInit=true;return[2]}))}))};R.displayCurrency=function(){var n=document.querySelector("zonos-hello");if(n){void n.displayCurrency()}};R.openHelloDialog=function(n){var e=document.querySelector("zonos-hello");if(e){void e.openHelloDialog(n!==null&&n!==void 0?n:true)}};R.showNotification=function(n){var e;void((e=g.zonosController)===null||e===void 0?void 0:e.showNotification(n))};R.updateOrganizationName=function(n){var e;void((e=g.zonosController)===null||e===void 0?void 0:e.updateOrganizationName(n))};R.disablePlaceOrderButtons=function(n){var e=n.autoEnable,t=e===void 0?true:e,r=n.disable,o=n.placeOrderButtonSelector;if(o){var i=document.querySelectorAll(o);var u=function(n){var e=n.target;if(e.getAttribute("disabled")){n.preventDefault();n.stopPropagation()}};i.forEach((function(n){var e=n.getAttribute("data-zonos-checkout-attached");if(e){return}if(r){n.setAttribute("disabled","true");n.addEventListener("click",u)}else{n.removeAttribute("disabled");n.removeEventListener("click",u)}}));if(t&&r){setTimeout((function(){i.forEach((function(n){n.removeAttribute("disabled");n.removeEventListener("click",u)}))}),5e3)}}};R.injectController=function(n){var o=n.config,i=n.zonosApiKey;var u;if(document.querySelector("zonos-controller")){return}if((u=o.checkoutSettings)===null||u===void 0?void 0:u.placeOrderButtonSelector){var s=o.checkoutSettings.placeOrderButtonSelector;g.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:s});var a=new MutationObserver((function(){g.disablePlaceOrderButtons({disable:true,placeOrderButtonSelector:s})}));a.observe(document.body,{childList:true,subtree:true})}var c=document.createElement("zonos-controller");c.config=o;c.zonosApiKey=i;c.addEventListener("stripeInitEvent",(function(n){return __awaiter(r,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,j(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 c.initCheckoutElement(o);return[2]}}))}))}));document.body.appendChild(c);g.zonosController=c;e("Zonos controller injected!")};R.injectScript=function(n){var r=n.cdnType,o=n.isModule,i=n.theRestUrl;var s=g.getZonosUrl(r);var a="".concat(s,"/").concat(i);var c=function(){var n=document.querySelector('script[src="'.concat(a,'"]'));return!!n};if(c()){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=u(r);if(!n){return}g.injectScript({cdnType:n,isModule:o,theRestUrl:i})};l.appendChild(d)};R.getZonosUrl=function(n){var e=function(){switch(n){case"jsdelivr":return S;case"unpkg":return O;default:return k}};if(g.isNpm){var t=a();return t||e()}return e()};R.injectZonosCdn=function(){g.injectScript({cdnType:_,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});g.injectScript({cdnType:_,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});e("Zonos cdn script injected!")};R.injectStylesheet=function(n){var e=n.cdnType,r=n.theRestUrl;var o=g.getZonosUrl(e);var i=document.head||document.body;var s=document.createElement("link");s.rel="preconnect";s.href="".concat(k,"/");i.appendChild(s);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=u(e);if(!n){return}g.injectStylesheet({cdnType:n,theRestUrl:r})};i.appendChild(a)};R.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}g.injectStylesheet({cdnType:_,theRestUrl:"dist/zonos-elements/zonos-elements.css"});e("Zonos style css injected!")};R.injectFonts=function(){var n=function(){var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(L,'"]'));for(var e=0;e<n.length;e++){var t=n[e];if(!t){continue}if(A.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=L;t.appendChild(r);var o=document.createElement("link");o.rel="stylesheet";o.href="".concat(L,"/inter/inter.css");t.appendChild(o);e("Zonos font injected!")};R.setupGoogleFont=function(n){var e;void((e=g.zonosController)===null||e===void 0?void 0:e.setupGoogleFont(n))};R.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(N,'"]'))){var i=document.createElement("link");i.rel="preconnect";i.href=N;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!"))}}}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonos/elements",
3
- "version": "1.3.30",
3
+ "version": "1.3.31",
4
4
  "description": "Zonos component UI for Stripe elements",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs.js",