@zonos/elements 1.3.115 → 1.3.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{CheckoutConfig-5d7cf0c0.js → CheckoutConfig-f2622b6b.js} +1 -1
- package/dist/cjs/{cart-95119cd0.js → cart-b3f6a451.js} +124 -30
- package/dist/cjs/index.cjs.js +36 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-eb9670e2.js → paypal-aab541fd.js} +1 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +9 -9
- package/dist/cjs/zonos-badge.cjs.entry.js +3 -3
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card.cjs.entry.js +4 -4
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +27 -17
- package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
- package/dist/cjs/zonos-collapse.cjs.entry.js +2 -2
- package/dist/cjs/zonos-component.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +9 -9
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-input.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-link.cjs.entry.js +1 -1
- package/dist/cjs/zonos-logo.cjs.entry.js +2 -2
- package/dist/cjs/zonos-notification_3.cjs.entry.js +4 -4
- package/dist/cjs/zonos-toggle.cjs.entry.js +2 -2
- package/dist/cjs/zonos-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +13 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +2 -2
- package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.js +3 -3
- package/dist/collection/components/common/zonos-card/zonos-card.js +4 -4
- package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +3 -3
- package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
- package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
- package/dist/collection/components/common/zonos-confirm-dialog/zonos-confirm-dialog.js +3 -3
- package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +2 -2
- package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
- package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +3 -3
- package/dist/collection/components/common/zonos-input/zonos-input.js +4 -4
- package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
- package/dist/collection/components/common/zonos-link/zonos-link.js +1 -1
- package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
- package/dist/collection/components/common/zonos-rest-state/zonos-rest-state.js +3 -3
- package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
- package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +2 -2
- package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
- package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
- package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
- package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
- package/dist/collection/components/main/zonos-controller.js +1 -1
- package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
- package/dist/collection/components/store/checkout/stripe.js +36 -1
- package/dist/collection/components/store/hello/localization.js +28 -29
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
- package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
- package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
- package/dist/collection/scripts/_getTempCartById.js +1 -1
- package/dist/collection/scripts/_zonosBase.js +28 -5
- package/dist/esm/{CheckoutConfig-32f33d8b.js → CheckoutConfig-018263e2.js} +1 -1
- package/dist/esm/{cart-6f978504.js → cart-fdaeeb8d.js} +124 -30
- package/dist/esm/index.js +37 -14
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-ce731a62.js → paypal-fb68deeb.js} +1 -1
- package/dist/esm/zonos-address_7.entry.js +9 -9
- package/dist/esm/zonos-badge.entry.js +3 -3
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card.entry.js +4 -4
- package/dist/esm/zonos-cart-items_13.entry.js +27 -17
- package/dist/esm/zonos-checkout.entry.js +3 -3
- package/dist/esm/zonos-collapse.entry.js +2 -2
- package/dist/esm/zonos-component.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +9 -9
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +5 -5
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-input.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +5 -5
- package/dist/esm/zonos-link.entry.js +1 -1
- package/dist/esm/zonos-logo.entry.js +2 -2
- package/dist/esm/zonos-notification_3.entry.js +4 -4
- package/dist/esm/zonos-toggle.entry.js +2 -2
- package/dist/esm/zonos-tooltip.entry.js +2 -2
- package/dist/esm/zonos-v-stack.entry.js +2 -2
- package/dist/esm-es5/{CheckoutConfig-32f33d8b.js → CheckoutConfig-018263e2.js} +1 -1
- package/dist/esm-es5/cart-fdaeeb8d.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-ce731a62.js → paypal-fb68deeb.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-component.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-link.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/scripts/index.d.ts +10 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +5 -0
- package/dist/types/components/store/hello/localization.d.ts +1 -1
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/scripts/_zonosBase.d.ts +1 -1
- package/dist/types/types/checkout/CheckoutConfig.d.ts +5 -0
- package/dist/types/types/global.d.ts +4 -0
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-0b4a06cc.entry.js +1 -0
- package/dist/zonos-elements/{p-bd787506.system.entry.js → p-0c57d568.system.entry.js} +1 -1
- package/dist/zonos-elements/p-0c868b63.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1c6ab0ff.system.entry.js → p-0cedb17a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c652212b.entry.js → p-149612d6.entry.js} +1 -1
- package/dist/zonos-elements/{p-61219278.entry.js → p-15fbb3a5.entry.js} +1 -1
- package/dist/zonos-elements/{p-5c30289f.system.entry.js → p-1aed6403.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-1c1ab3c8.system.entry.js → p-1e4f7997.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2628189b.js +1 -0
- package/dist/zonos-elements/{p-0651fcb2.entry.js → p-26be7ea7.entry.js} +1 -1
- package/dist/zonos-elements/{p-b25964f0.entry.js → p-2c9b4d6f.entry.js} +1 -1
- package/dist/zonos-elements/{p-e0a3dc73.entry.js → p-30b1eae9.entry.js} +1 -1
- package/dist/zonos-elements/{p-51a6f7b9.system.entry.js → p-383f6e8c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4f3a0185.system.entry.js → p-3a410b06.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c0343f7e.system.entry.js → p-3dacae53.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-92cc93c2.system.entry.js → p-3f5b6e7a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-909017d9.entry.js → p-46d96a0d.entry.js} +1 -1
- package/dist/zonos-elements/{p-8a4cf7ec.system.entry.js → p-48b42c33.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c5a67d85.system.entry.js → p-55d26aaa.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-46395a15.system.js → p-579932dc.system.js} +1 -1
- package/dist/zonos-elements/p-5c37e64d.entry.js +1 -0
- package/dist/zonos-elements/{p-6951f071.system.entry.js → p-60e5a6a2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-20c72ca4.system.entry.js → p-66303c89.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5ba975aa.entry.js → p-6b52ae05.entry.js} +1 -1
- package/dist/zonos-elements/{p-1c7e19f7.entry.js → p-6de38759.entry.js} +1 -1
- package/dist/zonos-elements/{p-33b57fab.system.js → p-6e2f4ea1.system.js} +1 -1
- package/dist/zonos-elements/{p-019028d5.entry.js → p-7a4170ba.entry.js} +1 -1
- package/dist/zonos-elements/{p-a287f192.system.entry.js → p-86f0d69c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-99b3759b.entry.js → p-93626c76.entry.js} +1 -1
- package/dist/zonos-elements/{p-a84cca94.entry.js → p-99ab4440.entry.js} +1 -1
- package/dist/zonos-elements/{p-a1d7f205.system.entry.js → p-9a89de05.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-15d4dccb.system.entry.js → p-9e757bf5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-56d405d0.js → p-9eae2294.js} +1 -1
- package/dist/zonos-elements/{p-3c90f724.system.entry.js → p-b31095d5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5cbddbe5.entry.js → p-b82e527a.entry.js} +1 -1
- package/dist/zonos-elements/{p-4de83ee5.entry.js → p-c325fd7b.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-2578b7b7.system.entry.js → p-d3472a00.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-438f65db.entry.js → p-d91da318.entry.js} +1 -1
- package/dist/zonos-elements/{p-f18ce1da.js → p-dd8fb969.js} +1 -1
- package/dist/zonos-elements/{p-910b7ea8.entry.js → p-de2fe7f5.entry.js} +1 -1
- package/dist/zonos-elements/p-e096a65f.system.js +1 -0
- package/dist/zonos-elements/{p-434cab4e.entry.js → p-e46bd90a.entry.js} +1 -1
- package/dist/zonos-elements/{p-4be91172.system.entry.js → p-e47cba8e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-352d1b18.entry.js → p-ebb97202.entry.js} +1 -1
- package/dist/zonos-elements/{p-442a308c.system.entry.js → p-eeb2c2f4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-196258ad.system.entry.js → p-f1a5d662.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ccd96dca.entry.js → p-f8c88d80.entry.js} +1 -1
- package/dist/zonos-elements/p-fbedb337.system.js +1 -0
- package/dist/zonos-elements/{p-3e50ba67.entry.js → p-ff6e4ea6.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-6f978504.js +0 -1
- package/dist/zonos-elements/p-2db740f1.js +0 -1
- package/dist/zonos-elements/p-41109a49.system.entry.js +0 -1
- package/dist/zonos-elements/p-491f7d74.system.js +0 -1
- package/dist/zonos-elements/p-793a5064.entry.js +0 -1
- package/dist/zonos-elements/p-804eaa0a.entry.js +0 -1
- package/dist/zonos-elements/p-fdffc1ce.system.js +0 -1
package/dist/scripts/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const t=performance.now()-e,o=t>1e3?`${(t/1e3).toFixed(2)}s`:`${t.toFixed(2)}ms`;return{elapsedTime:t,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...l);break;case"info":d.info(o,...l);break;case"error":d.error(o,...l);break;default:d.groupCollapsed(o,...l),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.115.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${l}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],g=w[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:t,path:n}),{errors:l,response:c}=a,d=y(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${f[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:t})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&t?(o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,1e3))),C({cartId:e,retries:t-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),A=async e=>{const{isDgsCartId:t,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!t)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return o("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var Z;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),U="https://v1.3.115.js.zonos.com",$=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.115",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}Z=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1730744013932",N.isLegacyCheckout=!1,N.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.115",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{if(Z.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!Z.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${Z.version}) ======`),Z.zonosApiKey=c,Z.storeId=l,Z.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!Z.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!Z.cartData&&Z.cartId){o("Initialize cart data");const e=await A(Z.cartId);if(!e)return void n("Failed to get cart data");Z.cartData=e.cartData,Z.zonosApiKey=e.zonosApiKey}}if(Z.cartId&&Z.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),Z.injectZonosCdn(),Z.injectZonosCss(),Z.injectFonts(),Z.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a}}),Z.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=Z.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=Z.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;Z.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{Z.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=Z.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),Z.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${Z.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");t?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const o=i(e);o&&Z.injectScript({cdnType:o,isModule:t,theRestUrl:r})},a.appendChild(l)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return $;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.115";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.115";case"vercel":return U}};if(Z.isNpm){return a()||t()}return t()},N.injectZonosCdn=()=>{Z.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),Z.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=Z.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${o}/${t}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const o=i(e);o&&Z.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(a)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(Z.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!D.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=L,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=Z.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},exports.Zonos=N})();
|
|
1
|
+
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(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),n="https://v1.3.117.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),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&&c.test(t.src))return t}return null})();r&&e?console.warn(d):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),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function w(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}"function"==typeof SuppressedError&&SuppressedError;const y=["cloudflare","vercel"],g=y[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const o=y.indexOf(e),t=y[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=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}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+t);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:o,path:n}),{errors:l,response:c}=a,d=w(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${f[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,o)=>{const n=w(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,Z=new RegExp(`^${E.source}$`),k=new RegExp(`^cart_${E.source}$`),I=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?k.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:Z.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var A;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),U="https://v1.3.117.js.zonos.com",L=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.117",$="https://rsms.me",P="https://fonts.googleapis.com",N=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class D{}A=D,D.doneInit=!1,D.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),D.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),D._paypalMockResponse=null,D.isBigCommerce=!1,D.releaseDate="1730759431065",D.isLegacyCheckout=!1,D.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),D.isNpm=!0,D.zonosQaUrl=null,D.zonosQaUrlApi=null,D.version="v1.3.117",D.modeAlerted=!1,D.cartData=null,D.paypal=null,D.getCurrentTimestamp=()=>(new Date).getTime(),D.zonosController=null,D.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c,storeId:d,zonosApiKey:u}=e;if(A.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!A.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${A.version}) ======`),A.zonosApiKey=u,A.storeId=d,A.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=a();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=A.isNpm,window.Zonos.isBigCommerce=A.isBigCommerce,window.Zonos.isLegacyCheckout=A.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!u&&!A.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!A.cartData&&A.cartId){t("Initialize cart data");const e=await I(A.cartId);if(!e)return void n("Failed to get cart data");A.cartData=e.cartData,A.zonosApiKey=e.zonosApiKey}}if(A.cartId&&A.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),A.injectZonosCdn(),A.injectZonosCss(),A.injectFonts(),A.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c}}),A.doneInit=!0}},D.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},D.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},D.showNotification=e=>{var o;null===(o=A.zonosController)||void 0===o||o.showNotification(e)},D.updateOrganizationName=e=>{var o;null===(o=A.zonosController)||void 0===o||o.updateOrganizationName(e)},D.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&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)}},D.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=A.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{h=!0;const o=Date.now();return m.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);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),A.zonosController=r,t("Zonos controller injected!")},D.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${A.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&A.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},D.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return L;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.117";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.117";case"vercel":return U}};if(A.isNpm){return a()||o()}return o()},D.injectZonosCdn=()=>{A.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),A.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},D.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=A.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&A.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},D.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(A.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},D.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${$}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!N.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=$,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${$}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},D.setupGoogleFont=e=>{var o;null===(o=A.zonosController)||void 0===o||o.setupGoogleFont(e)},D.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^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void 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!`)},exports.Zonos=D})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function e(e,o){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)o.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(n[r[t]]=e[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],n=o[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=r[n],s=(e=n)=>{const r=o.indexOf(e),t=o[r+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=performance.now(),c=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},l=(e,o,...n)=>{var r,t;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...i));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(t=l.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":d.warn(e,...i);break;case"info":d.info(e,...i);break;case"error":d.error(e,...i);break;default:d.groupCollapsed(e,...i),d.trace(),d.groupEnd()}},d=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(l("sendErrorLog","warn",e,n,o),i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}},u=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:c}}const d=s.status.toString();try{const e=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:d}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:c}}},m=async({basePathType:o,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":o,g=await u({basePathType:p,options:n,path:t}),{errors:w,response:f}=g,y=e(g,["errors","response"]),h=s(p),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==f?void 0:f.status),S=h&&v;return v&&d({endpoint:r[p]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:p,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(l(`=== "${t}" failed to fetch, trying next fallback ${h}`),m({basePathType:h,options:n,path:t})):Object.assign({errors:w,response:f},y)},g=async(o,r)=>{const t=e(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return l(o,"info"),m({basePathType:d||n,options:c,path:o})},w=(e,...o)=>{l(e,"error",...o)},f=["jsdelivr","cdnjs","unpkg","vercel"],y=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},h=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${h.source}$`),S=new RegExp(`^cart_${h.source}$`),z=e=>e?S.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},L=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:t}=await g("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),s=!t||r.length;return s&&o?(l("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,1e3))),L({cartId:e,retries:o-1})):s?null:t};var O;const Z=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=y(window.location.href),n="https://v1.3.115.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),b=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=y(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const r=`https://${e}.route.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class U{static get isNpm(){return!1}}O=U,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1730744013932",U.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},r)))}catch(e){}},U.loadScriptLogParallelHandler=async e=>{try{if(O.parallelLoadTimes.push(e),2===O.parallelLoadTimes.length){const e=O.parallelLoadTimes.find((e=>"vercel"===e.type)),o=O.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void d({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});O.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},U.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{w(`[ZONOS - loadZonos] ${e}`),d({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:O.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},U.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.115";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.115":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.115");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},U.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;const i="vercel"===e?r:O.getGithubCdn({type:e,version:t}),a=Z||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,l(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n})())||void 0===s?void 0:s.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=f[0]===e,y=f[1],h="on"===O.parallelLoadState&&m&&w&&y&&!g;h&&O.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:r,version:t});const v=performance.now();p.addEventListener("load",(()=>{var r;if(h||n?O.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:O.storeId,type:e}):O.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:O.storeId,type:e}),O.isBigCommerce||(O.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=Z,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=O.isBigCommerce,O.cartId){if(!O.zonosApiKey)throw O.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!O.cartData)throw O.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(O.legacyStoreFavicon&&O.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=O.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=O.cartData,window.Zonos.isLegacyCheckout=O.isLegacyCheckout;const e=O.isLegacyCheckout&&"CLOSE_MODAL"===(null===(r=o.checkoutSettings)||void 0===r?void 0:r.successBehavior),n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:O.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:e?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:e?O.cartData.storeBaseUrl:void 0}),zonosApiKey:O.zonosApiKey});o=n}window.Zonos.version&&(l(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=f.indexOf(e);return f[o+1]||null})(e);if(!h&&!n){if(!s)return;O.injectZonos({cdnType:s,initConfig:o,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||Z)return;if(h||n)return void O.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:O.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?d({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):d({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async e=>{var o;const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:r,isLegacyCartId:t}=z(n);if(n&&!t&&!r)return void O.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});O.cartId=n;const s="https://v1.3.115.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src;l(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=Z,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&l(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&l(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(O.isNpm||a&&c))return void w("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||O.requested)return void l("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!O.cartId)return O.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void w("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(O.requested=!0,O.zonosApiKey=e.zonosApiKey,O.storeId=e.storeId,O.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=z(e);if(!n&&!o)return w("[ZONOS - loadZonos] invalid cart id"),null;const r=await L({cartId:e,retries:5});return l("[ZONOS - loadZonos] getting temp cart data","info",r),r?{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}:(w("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!e)throw O.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");O.cartData=e.cartData,O.zonosApiKey=e.zonosApiKey,O.legacyStoreLogo=e.storeLogo,O.legacyStoreFavicon=e.storeFavicon,O.storeId=e.storeId,O.zonosApiKey=e.zonosApiKey}if(!O.zonosApiKey)return void w('"zonosApiKey" is required to initialize Zonos');if(!O.storeId)return l("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void O.injectZonos({initConfig:e,vercelUrl:s,version:null});const d=O.storeId||e.storeId;l(`[ZONOS - loadZonos] Store ID: ${d}`,"info");const p=new URLSearchParams;p.set("storeId",d.toString());const{errors:u,json:m}=await g(`/api/get-store-version?${p.toString()}`);if(u.length||!m)return l("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void O.injectZonos({initConfig:e,vercelUrl:s,version:null});const{isDifferent:f,source:y,version:h}=m;if(l(`[ZONOS - loadZonos] Store version: ${h}, source: ${y}`,"info"),f){l(`[ZONOS - loadZonos] Updating saved store version to ${h}`,"info");const e={storeId:d,version:h};g(`/api/set-store-version?${p.toString()}`,{body:e,method:"POST"}).catch((e=>w("Unable to save store's vesrion",e)))}if(!i){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:a}),t=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,s=r&&!n?null:h;l("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:t,loadVersion:s,version:h}),O.injectZonos({initConfig:e,vercelUrl:t,version:s})}},void 0===window.Zonos&&(window.Zonos=U)})();
|
|
1
|
+
(function(){"use strict";function e(e,o){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)o.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(n[r[t]]=e[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],n=o[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=r[n],s=(e=n)=>{const r=o.indexOf(e),t=o[r+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=performance.now(),c=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},d=(e,o,...n)=>{var r,t;const{elapsedTimePretty:s}=(()=>{const e=performance.now()-a,o=e>1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(2)}ms`;return{elapsedTime:e,elapsedTimePretty:o}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(r=window.Zonos)||void 0===r?void 0:r.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...i));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const l=(null===(t=d.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":l.warn(e,...i);break;case"info":l.info(e,...i);break;case"error":l.error(e,...i);break;default:l.groupCollapsed(e,...i),l.trace(),l.groupEnd()}},l=async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(d("sendErrorLog","warn",e,n,o),i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}},u=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:c}}const l=s.status.toString();try{const e=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:l}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:c}}},m=async({basePathType:o,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":o,g=await u({basePathType:p,options:n,path:t}),{errors:w,response:f}=g,y=e(g,["errors","response"]),h=s(p),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==f?void 0:f.status),S=h&&v;return v&&l({endpoint:r[p]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:p,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(d(`=== "${t}" failed to fetch, trying next fallback ${h}`),m({basePathType:h,options:n,path:t})):Object.assign({errors:w,response:f},y)},g=async(o,r)=>{const t=e(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return d(o,"info"),m({basePathType:l||n,options:c,path:o})},w=(e,...o)=>{d(e,"error",...o)},f=["jsdelivr","cdnjs","unpkg","vercel"],y=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},h=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${h.source}$`),S=new RegExp(`^cart_${h.source}$`),Z=e=>e?S.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},L=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:t}=await g("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),s=!t||r.length;return s&&o?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),L({cartId:e,retries:o-1})):s?null:t};var z;const O=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=y(window.location.href),n="https://v1.3.117.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),b=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=y(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const r=`https://${e}.route.js.zonos.com`;return d(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class U{}z=U,U.isNpm=!1,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1730759431065",U.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},r)))}catch(e){}},U.loadScriptLogParallelHandler=async e=>{try{if(z.parallelLoadTimes.push(e),2===z.parallelLoadTimes.length){const e=z.parallelLoadTimes.find((e=>"vercel"===e.type)),o=z.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void l({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}});z.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},U.legacyCheckoutErrorHandler=({message:e,metadata:o})=>{w(`[ZONOS - loadZonos] ${e}`),l({endpoint:"LegacyCheckoutInit",errors:[e],metadata:Object.assign(Object.assign({},o),{tempCartUUID:z.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},U.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.117";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.117":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.117");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},U.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;t&&(window.Zonos.version=t);const i="vercel"===e?r:z.getGithubCdn({type:e,version:t}),a=O||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,d(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n})())||void 0===s?void 0:s.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=f[0]===e,y=f[1],h="on"===z.parallelLoadState&&m&&w&&y&&!g;h&&z.injectZonos({cdnType:y,initConfig:o,parallelLoaded:!0,vercelUrl:r,version:t});const v=performance.now();p.addEventListener("load",(()=>{var r;if(h||n?z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:e}):z.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:e}),z.isBigCommerce||(z.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=O,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=z.isBigCommerce,z.cartId){if(!z.zonosApiKey)throw z.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!z.cartData)throw z.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(z.legacyStoreFavicon&&z.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=z.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=z.cartData,window.Zonos.isLegacyCheckout=z.isLegacyCheckout;const e=z.isLegacyCheckout&&"CLOSE_MODAL"===(null===(r=o.checkoutSettings)||void 0===r?void 0:r.successBehavior),n=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:z.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:e?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:e?z.cartData.storeBaseUrl:void 0}),zonosApiKey:z.zonosApiKey});o=n}window.Zonos.version&&(d(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=f.indexOf(e);return f[o+1]||null})(e);if(!h&&!n){if(!s)return;z.injectZonos({cdnType:s,initConfig:o,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||O)return;if(h||n)return void z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:z.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?l({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:e,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):l({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async e=>{var o;if(O&&!window.isZonosPreview){d(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${O}`,"info");const o=document.createElement("script");return o.src=`${O}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=z.isBigCommerce,window.Zonos.isLegacyCheckout=z.isLegacyCheckout,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${O}`)})),void(window.isZonosPreview=!0)}const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:r,isLegacyCartId:t}=Z(n);if(n&&!t&&!r)return void z.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});z.cartId=n;const s="https://v1.3.117.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src;d(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=O,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&d(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&d(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(z.isNpm||a&&c))return void w("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||z.requested)return void d("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!z.cartId)return z.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void w("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(z.requested=!0,z.zonosApiKey=e.zonosApiKey,z.storeId=e.storeId,z.cartId){const e=await(async e=>{const{isDgsCartId:o,isLegacyCartId:n}=Z(e);if(!n&&!o)return w("[ZONOS - loadZonos] invalid cart id"),null;const r=await L({cartId:e,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",r),r?{cartData:r.cartData,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}:(w("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(z.cartId);if(!e)throw z.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");z.cartData=e.cartData,z.zonosApiKey=e.zonosApiKey,z.legacyStoreLogo=e.storeLogo,z.legacyStoreFavicon=e.storeFavicon,z.storeId=e.storeId,z.zonosApiKey=e.zonosApiKey}if(!z.zonosApiKey)return void w('"zonosApiKey" is required to initialize Zonos');if(!z.storeId)return d("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void z.injectZonos({initConfig:e,vercelUrl:s,version:null});const l=z.storeId||e.storeId;d(`[ZONOS - loadZonos] Store ID: ${l}`,"info");const p=new URLSearchParams;p.set("storeId",l.toString());const{errors:u,json:m}=await g(`/api/get-store-version?${p.toString()}`);if(u.length||!m)return d("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void z.injectZonos({initConfig:e,vercelUrl:s,version:null});const{isDifferent:f,source:y,version:h}=m;if(d(`[ZONOS - loadZonos] Store version: ${h}, source: ${y}`,"info"),f){d(`[ZONOS - loadZonos] Updating saved store version to ${h}`,"info");const e={storeId:l,version:h};g(`/api/set-store-version?${p.toString()}`,{body:e,method:"POST"}).catch((e=>w("Unable to save store's vesrion",e)))}if(!i){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:a}),t=r&&!n?o:`${"alpha"===h?"alpha":`v${h}`}.js.zonos.com`,s=r&&!n?null:h;d("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:t,loadVersion:s,version:h}),z.injectZonos({initConfig:e,vercelUrl:t,version:s})}},void 0===window.Zonos&&(window.Zonos=U)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const t=performance.now()-e,o=t>1e3?`${(t/1e3).toFixed(2)}s`:`${t.toFixed(2)}ms`;return{elapsedTime:t,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...l);break;case"info":d.info(o,...l);break;case"error":d.error(o,...l);break;default:d.groupCollapsed(o,...l),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.115.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${l}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],g=w[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:t,path:n}),{errors:l,response:c}=a,d=y(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${f[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:t})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&t?(o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,1e3))),C({cartId:e,retries:t-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),Z=async e=>{const{isDgsCartId:t,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!t)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return o("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var A;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),U="https://v1.3.115.js.zonos.com",$=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.115",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}A=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1730744013932",N.isLegacyCheckout=!1,N.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.115",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{if(A.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!A.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${A.version}) ======`),A.zonosApiKey=c,A.storeId=l,A.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!A.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!A.cartData&&A.cartId){o("Initialize cart data");const e=await Z(A.cartId);if(!e)return void n("Failed to get cart data");A.cartData=e.cartData,A.zonosApiKey=e.zonosApiKey}}if(A.cartId&&A.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),A.injectZonosCdn(),A.injectZonosCss(),A.injectFonts(),A.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a}}),A.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=A.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=A.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=A.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),A.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${A.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");t?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const o=i(e);o&&A.injectScript({cdnType:o,isModule:t,theRestUrl:r})},a.appendChild(l)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return $;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.115";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.115";case"vercel":return U}};if(A.isNpm){return a()||t()}return t()},N.injectZonosCdn=()=>{A.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),A.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=A.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${o}/${t}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const o=i(e);o&&A.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(a)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(A.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!D.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=L,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=A.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=N)})();
|
|
1
|
+
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(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),n="https://v1.3.117.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),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&&c.test(t.src))return t}return null})();r&&e?console.warn(d):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),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function w(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}"function"==typeof SuppressedError&&SuppressedError;const y=["cloudflare","vercel"],g=y[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const o=y.indexOf(e),t=y[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=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}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+t);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:o,path:n}),{errors:l,response:c}=a,d=w(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${f[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,o)=>{const n=w(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},Z=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${Z.source}$`),k=new RegExp(`^cart_${Z.source}$`),I=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?k.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var A;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),U="https://v1.3.117.js.zonos.com",L=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.117",$="https://rsms.me",P="https://fonts.googleapis.com",N=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class D{}A=D,D.doneInit=!1,D.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),D.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),D._paypalMockResponse=null,D.isBigCommerce=!1,D.releaseDate="1730759431065",D.isLegacyCheckout=!1,D.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),D.isNpm=!0,D.zonosQaUrl=null,D.zonosQaUrlApi=null,D.version="v1.3.117",D.modeAlerted=!1,D.cartData=null,D.paypal=null,D.getCurrentTimestamp=()=>(new Date).getTime(),D.zonosController=null,D.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c,storeId:d,zonosApiKey:u}=e;if(A.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!A.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${A.version}) ======`),A.zonosApiKey=u,A.storeId=d,A.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=a();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=A.isNpm,window.Zonos.isBigCommerce=A.isBigCommerce,window.Zonos.isLegacyCheckout=A.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!u&&!A.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!A.cartData&&A.cartId){t("Initialize cart data");const e=await I(A.cartId);if(!e)return void n("Failed to get cart data");A.cartData=e.cartData,A.zonosApiKey=e.zonosApiKey}}if(A.cartId&&A.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),A.injectZonosCdn(),A.injectZonosCss(),A.injectFonts(),A.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:c}}),A.doneInit=!0}},D.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},D.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},D.showNotification=e=>{var o;null===(o=A.zonosController)||void 0===o||o.showNotification(e)},D.updateOrganizationName=e=>{var o;null===(o=A.zonosController)||void 0===o||o.updateOrganizationName(e)},D.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&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)}},D.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=A.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{h=!0;const o=Date.now();return m.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);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),A.zonosController=r,t("Zonos controller injected!")},D.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${A.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&A.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},D.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return L;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.117";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.117";case"vercel":return U}};if(A.isNpm){return a()||o()}return o()},D.injectZonosCdn=()=>{A.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),A.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},D.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=A.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&A.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},D.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(A.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},D.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${$}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!N.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=$,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${$}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},D.setupGoogleFont=e=>{var o;null===(o=A.zonosController)||void 0===o||o.setupGoogleFont(e)},D.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^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void 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!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=D)})();
|
|
@@ -28,9 +28,14 @@ export declare class ZonosCheckoutFinish {
|
|
|
28
28
|
notificationType: 'success' | 'error';
|
|
29
29
|
notificationTitle: string;
|
|
30
30
|
notificationMessages: string[];
|
|
31
|
+
notificationActionText: string;
|
|
31
32
|
order: ZonosOrder | null;
|
|
32
33
|
private pullOrder;
|
|
33
34
|
private redirectToUrl;
|
|
35
|
+
/**
|
|
36
|
+
* It would make more sense to have keep shopping button if the success behavior is not redirecting to a different page
|
|
37
|
+
*/
|
|
38
|
+
private shouldRenderKeepShoppingButton;
|
|
34
39
|
private handleSuccessBehavior;
|
|
35
40
|
private getPullOrder;
|
|
36
41
|
private useOverrideSuccessNotification;
|
|
@@ -31,6 +31,6 @@ type ILocaleMessageForUse = {
|
|
|
31
31
|
declare const localizationDispose: () => void, localizationStoreOnUpdate: import("@stencil/store/dist/types").OnChangeHandler<LocalizationStore>, localizationStore: LocalizationStore;
|
|
32
32
|
export declare const getFallbackDefaultCountryCode: (allowedCountries: CountryCode[]) => CountryCode;
|
|
33
33
|
declare const localizationStoreUpdateSelectedCountryCode: (newSelectedCountryCode: CountryCode | null) => void;
|
|
34
|
-
declare const initLocalizationStore: () => Promise<void>;
|
|
35
34
|
declare const localizationStoreUpdateSelectedLocale: (newSelectedLocale: Locale_ElementsSupportedLocationCode_Enum) => void;
|
|
35
|
+
declare const initLocalizationStore: () => Promise<void>;
|
|
36
36
|
export { initLocalizationStore, localizationDispose, localizationStore, localizationStoreOnUpdate, localizationStoreUpdateSelectedCountryCode, localizationStoreUpdateSelectedLocale, };
|
|
@@ -149,6 +149,9 @@ export declare const stringsArabic: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsBase: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsChinese: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsDanish: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsDutch: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsFrench: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsGerman: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsHebrew: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsIndonesian: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsItalian: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsJapanese: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsKorean: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsNorwegian: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsPolish: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsPortuguese: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsRussian: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsSpanish: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsSwedish: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsTurkish: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -149,6 +149,9 @@ export declare const stringsVietnamese: {
|
|
|
149
149
|
'It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?': {
|
|
150
150
|
value: string;
|
|
151
151
|
};
|
|
152
|
+
'Keep shopping': {
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
152
155
|
'Know about duties and taxes before you buy. Shop with confidence!': {
|
|
153
156
|
value: string;
|
|
154
157
|
};
|
|
@@ -32,4 +32,4 @@ export type ITranslationKey = keyof typeof stringsBase;
|
|
|
32
32
|
* // No variables:
|
|
33
33
|
* translate('Above de minimis threshold for')
|
|
34
34
|
*/
|
|
35
|
-
export declare const translate: <T extends "Shipping" | "Email" | "Name" | "Quantity" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "Delivery" | "Payment" | " (Duties due at door)" | " (Duties prepaid)" | "Above de minimis threshold for" | "Add promotional code" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Apply" | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery options" | "Discounts" | "Don't close" | "Due at delivery" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties and taxes will be charged upon delivery." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Estimated" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Hide non-prepaid options" | "Invalid promo code" | "It looks like you placed an order just a few minutes ago ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?" | "It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at delivery" | "Nothing due at the door" | "Order complete!" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Proceed with order" | "Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions." | "Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions." | "Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions." | "Product prices already include duties. No additional duties will be added at checkout, with rare exceptions." | "Product prices already include fees. No additional fees will be added at checkout, with rare exceptions." | "Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions." | "Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Return to merchant site" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Show" | "Show non-prepaid options" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You may incur additional fees from the shipping carrier by not prepaying." | "You will be redirected back to the merchant's site in a few seconds." | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "Your order has been successfully placed." | "Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "days" | "restricted items" | "weeks">(...[key, replacement]: TranslateParams<T>) => string;
|
|
35
|
+
export declare const translate: <T extends "Shipping" | "Email" | "Name" | "Quantity" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "Delivery" | "Payment" | " (Duties due at door)" | " (Duties prepaid)" | "Above de minimis threshold for" | "Add promotional code" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Apply" | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery options" | "Discounts" | "Don't close" | "Due at delivery" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties and taxes will be charged upon delivery." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Estimated" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Hide non-prepaid options" | "Invalid promo code" | "It looks like you placed an order just a few minutes ago ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?" | "It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?" | "Keep shopping" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at delivery" | "Nothing due at the door" | "Order complete!" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Proceed with order" | "Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions." | "Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions." | "Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions." | "Product prices already include duties. No additional duties will be added at checkout, with rare exceptions." | "Product prices already include fees. No additional fees will be added at checkout, with rare exceptions." | "Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions." | "Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Return to merchant site" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Show" | "Show non-prepaid options" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You may incur additional fees from the shipping carrier by not prepaying." | "You will be redirected back to the merchant's site in a few seconds." | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "Your order has been successfully placed." | "Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "days" | "restricted items" | "weeks">(...[key, replacement]: TranslateParams<T>) => string;
|
|
@@ -252,7 +252,7 @@ export declare abstract class Zonos {
|
|
|
252
252
|
static getCurrentTimestamp: () => number;
|
|
253
253
|
static cartId: string | null;
|
|
254
254
|
private static zonosController;
|
|
255
|
-
static init: (
|
|
255
|
+
static init: (params: LoadZonosParams) => Promise<void>;
|
|
256
256
|
static displayCurrency: () => void;
|
|
257
257
|
static openHelloDialog: (value?: boolean) => void;
|
|
258
258
|
static showNotification: (notification: NotificationInit) => void;
|
|
@@ -64,6 +64,11 @@ export type CheckoutConfig = {
|
|
|
64
64
|
*/
|
|
65
65
|
subscriptionStatus: CheckoutSubscriptionStatus;
|
|
66
66
|
successBehavior: CheckoutSuccessBehavior;
|
|
67
|
+
/**
|
|
68
|
+
* The success page action text for checkout.
|
|
69
|
+
* @note Default text supports translation automatically, but any custom text will not be translated.
|
|
70
|
+
*/
|
|
71
|
+
successPageActionText?: string;
|
|
67
72
|
/**
|
|
68
73
|
* The success page subtitle text for checkout. Each item in the array will appear on a new line.
|
|
69
74
|
* @note Default text supports translation automatically, but any custom text will not be translated.
|