@zonos/elements 1.3.82 → 1.3.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-ba540c8e.js → cart-4de3faca.js} +455 -16
- package/dist/cjs/{createCustomEvent-1fd24ad8.js → createCustomEvent-65331eae.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-6bbe55a7.js → paypal-370b3a10.js} +1 -1
- package/dist/cjs/{zonos-address_8.cjs.entry.js → zonos-address_7.cjs.entry.js} +1 -56
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +99 -29
- package/dist/cjs/zonos-checkout.cjs.entry.js +4 -4
- package/dist/cjs/zonos-collapse.cjs.entry.js +62 -0
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +1 -11
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +17 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +3 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/assets/ChevronUpIcon.svg +23 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +55 -9
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +57 -16
- package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +20 -27
- package/dist/collection/components/store/checkout/cart.js +29 -11
- package/dist/collection/components/store/checkout/stripe.js +2 -2
- package/dist/collection/components/store/translationStore/strings.arabic.js +21 -0
- package/dist/collection/components/store/translationStore/strings.base.js +21 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +21 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +21 -0
- package/dist/collection/components/store/translationStore/strings.french.js +22 -1
- package/dist/collection/components/store/translationStore/strings.german.js +22 -1
- package/dist/collection/components/store/translationStore/strings.hebrew.js +22 -1
- package/dist/collection/components/store/translationStore/strings.indonesian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +21 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +21 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +21 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +21 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +22 -1
- package/dist/collection/components/store/translationStore/strings.spanish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +21 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +21 -0
- package/dist/collection/components/utils/checkout/{sortServiceLevelOptions.js → sortServiceLevelOptionsByAmount.js} +1 -1
- package/dist/esm/{cart-7df78f9f.js → cart-bdc45f59.js} +455 -17
- package/dist/esm/{createCustomEvent-fcec608e.js → createCustomEvent-4db13122.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-a27aad03.js → paypal-1b29d424.js} +1 -1
- package/dist/esm/{zonos-address_8.entry.js → zonos-address_7.entry.js} +2 -56
- package/dist/esm/zonos-cart-items_12.entry.js +99 -29
- package/dist/esm/zonos-checkout.entry.js +4 -4
- package/dist/esm/zonos-collapse.entry.js +58 -0
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +2 -2
- package/dist/esm/zonos-shipping-rich-radio.entry.js +1 -11
- package/dist/esm-es5/cart-bdc45f59.js +1 -0
- package/dist/esm-es5/{createCustomEvent-fcec608e.js → createCustomEvent-4db13122.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-a27aad03.js → paypal-1b29d424.js} +1 -1
- package/dist/esm-es5/{zonos-address_8.entry.js → zonos-address_7.entry.js} +1 -1
- package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -0
- 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-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/scripts/index.d.ts +499 -496
- 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-shipping/zonos-shipping.d.ts +4 -1
- package/dist/types/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.d.ts +2 -6
- package/dist/types/components/store/checkout/cart.d.ts +9 -7
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +21 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +21 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/checkout/{sortServiceLevelOptions.d.ts → sortServiceLevelOptionsByAmount.d.ts} +1 -1
- package/dist/types/components.d.ts +10 -8
- package/dist/zonos-elements/assets/ChevronUpIcon.svg +23 -1
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-270cc182.system.entry.js → p-00bb8221.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b09c3702.entry.js → p-017bf338.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d2edb5a.system.entry.js → p-01d11845.system.entry.js} +1 -1
- package/dist/zonos-elements/p-0cc8c6a3.system.js +1 -0
- package/dist/zonos-elements/{p-43e2de45.system.entry.js → p-2140ccb4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4e06a2bb.system.entry.js → p-2183128a.system.entry.js} +1 -1
- package/dist/zonos-elements/p-278d61ed.js +1 -0
- package/dist/zonos-elements/p-2b60faf8.entry.js +1 -0
- package/dist/zonos-elements/{p-8dd38974.entry.js → p-3347e142.entry.js} +1 -1
- package/dist/zonos-elements/{p-4097a25b.system.entry.js → p-3457c5e8.system.entry.js} +1 -1
- package/dist/zonos-elements/p-4abca0e9.system.entry.js +1 -0
- package/dist/zonos-elements/{p-15651b06.system.js → p-4ec7afc5.system.js} +1 -1
- package/dist/zonos-elements/{p-bf84416a.entry.js → p-5fb337a0.entry.js} +1 -1
- package/dist/zonos-elements/{p-a4cdd4f2.entry.js → p-6aa35f18.entry.js} +1 -1
- package/dist/zonos-elements/{p-cfd53396.entry.js → p-771e2623.entry.js} +1 -1
- package/dist/zonos-elements/{p-acabfc47.js → p-7cc5e325.js} +1 -1
- package/dist/zonos-elements/p-7f3aeb53.system.entry.js +1 -0
- package/dist/zonos-elements/p-844ec9f9.system.entry.js +1 -0
- package/dist/zonos-elements/p-9931bea7.system.entry.js +1 -0
- package/dist/zonos-elements/{p-cd17565d.entry.js → p-9b911f6f.entry.js} +1 -1
- package/dist/zonos-elements/{p-59806a8e.system.entry.js → p-9cfa3736.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-957b1c1b.system.js → p-a1fa0a1c.system.js} +1 -1
- package/dist/zonos-elements/{p-df83e30b.entry.js → p-a34f0674.entry.js} +1 -1
- package/dist/zonos-elements/{p-4683797b.system.js → p-a6cff57f.system.js} +1 -1
- package/dist/zonos-elements/{p-112a969c.entry.js → p-b0303b0e.entry.js} +1 -1
- package/dist/zonos-elements/{p-2c5e2163.entry.js → p-c6350880.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-2024313c.js → p-ce41cbde.js} +1 -1
- package/dist/zonos-elements/p-cec3e1ed.entry.js +1 -0
- package/dist/zonos-elements/{p-d48f3bd3.system.entry.js → p-e3df5ff6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5d4bde9c.system.entry.js → p-f1d043ad.system.entry.js} +1 -1
- package/dist/zonos-elements/p-f1e452e1.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-7df78f9f.js +0 -1
- package/dist/zonos-elements/p-85600e22.system.entry.js +0 -1
- package/dist/zonos-elements/p-8fd6ae63.js +0 -1
- package/dist/zonos-elements/p-a1c5c1a2.entry.js +0 -1
- package/dist/zonos-elements/p-aa899bf7.entry.js +0 -1
- package/dist/zonos-elements/p-cffe7cc8.system.entry.js +0 -1
- package/dist/zonos-elements/p-e7eb0a92.system.js +0 -1
- package/dist/zonos-elements/p-f4667002.system.entry.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 l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.82.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const{errors:t,json:n}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.82.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.82",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}k=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="1728680923405",N.isLegacyCheckout=!1,N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.82",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:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},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=k.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=k.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;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.82";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.82";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},N.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.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=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=k.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^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,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(),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 l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.83.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const{errors:t,json:n}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.83.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.83",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}k=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="1728684733949",N.isLegacyCheckout=!1,N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.83",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:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},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=k.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=k.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;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.83";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.83";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},N.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.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=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=k.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^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,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 +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 s=performance.now()-a,i=[`(${s>1e3?`${(s/1e3).toFixed(2)}s`:`${s.toFixed(2)}ms`})`,...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,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}},u=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:c}}const d=s.status.toString();try{const e=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:d}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:c}}},m=async({basePathType:o,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":o,g=await u({basePathType:p,options:n,path:t}),{errors:w,response:f}=g,h=e(g,["errors","response"]),y=s(p),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==f?void 0:f.status),S=y&&v;return v&&d({endpoint:r[p]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:p,nextFallbackApiType:y,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(l(`=== "${t}" failed to fetch, trying next fallback ${y}`),m({basePathType:y,options:n,path:t})):Object.assign({errors:w,response:f},h)},g=async(o,r)=>{const t=e(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return l(o,"info"),m({basePathType:d||n,options:c,path:o})},w=(e,...o)=>{l(e,"error",...o)},f=["jsdelivr","cdnjs","unpkg","vercel"],h=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},y=async e=>{const o=await(async e=>{const{errors:o,json:n}=await g("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||o.length?null:n})(e);return l("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(w("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var v;const S=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=h(window.location.href),n="https://v1.3.82.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),z=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=h(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const r=`https://${e}.route.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class L{static get isNpm(){return!1}}v=L,L.isBigCommerce=!1,L.requested=!1,L.cartData=null,L.isLegacyCheckout=!1,L.legacyStoreLogo=null,L.legacyStoreFavicon=null,L.parallelLoadTimes=[],L.parallelLoadState="off",L.releaseDate="1728680923405",L.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},r)))}catch(e){}},L.loadScriptLogParallelHandler=async e=>{try{if(v.parallelLoadTimes.push(e),2===v.parallelLoadTimes.length){const e=v.parallelLoadTimes.find((e=>"vercel"===e.type)),o=v.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void d({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});v.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},L.legacyCheckoutErrorHandler=({message:e})=>{w(`[ZONOS - loadZonos] ${e}`),d({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:v.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},L.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.82";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.82":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.82");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},L.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;const i="vercel"===e?r:v.getGithubCdn({type:e,version:t}),a=S||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,l(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n})())||void 0===s?void 0:s.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=f[0]===e,h=f[1],y="on"===v.parallelLoadState&&m&&w&&h&&!g;y&&v.injectZonos({cdnType:h,initConfig:o,parallelLoaded:!0,vercelUrl:r,version:t});const L=performance.now();p.addEventListener("load",(()=>{if(y||n?v.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-L,scriptLoadUrl:p.src,storeId:v.storeId,type:e}):v.loadScriptLogHandler({fallbackLoadTime:performance.now()-L,scriptLoadUrl:p.src,storeId:v.storeId,type:e}),v.isBigCommerce||(v.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=S,window.Zonos.zonosQaUrlApi=z,window.Zonos.isBigCommerce=v.isBigCommerce,v.cartId){if(!v.zonosApiKey)throw v.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!v.cartData)throw v.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(v.legacyStoreFavicon&&v.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=v.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=v.cartData,window.Zonos.isLegacyCheckout=v.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:v.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:v.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:v.isLegacyCheckout?v.cartData.storeBaseUrl:void 0}),zonosApiKey:v.zonosApiKey});o=e}window.Zonos.version&&(l(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=f.indexOf(e);return f[o+1]||null})(e);if(!y&&!n){if(!s)return;v.injectZonos({cdnType:s,initConfig:o,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||S)return;if(y||n)return void v.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-L,isError:!0,scriptLoadUrl:p.src,storeId:v.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?d({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-L,cdnType:e,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):d({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-L}})})),document.head.appendChild(p)},L.init=async e=>{var o;v.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const n="https://v1.3.82.js.zonos.com",r=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src;l(`[ZONOS - init] first load script src: ${t}`,"info"),window.Zonos.zonosQaUrl=S,window.Zonos.zonosQaUrlApi=z,window.Zonos.zonosQaUrl&&l(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&l(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const s=null==t?void 0:t.includes("timestamp=");if(!(v.isNpm||t&&s))return void w("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(r||!t||v.requested)return void l("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!v.cartId)return v.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void w("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(v.requested=!0,v.zonosApiKey=e.zonosApiKey,v.storeId=e.storeId,v.cartId){const e=await y(v.cartId);if(!e)throw v.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");v.cartData=e.cartData,v.zonosApiKey=e.zonosApiKey,v.legacyStoreLogo=e.storeLogo,v.legacyStoreFavicon=e.storeFavicon,v.storeId=e.storeId,v.zonosApiKey=e.zonosApiKey}if(!v.zonosApiKey)return void w('"zonosApiKey" is required to initialize Zonos');if(!v.storeId)return l("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void v.injectZonos({initConfig:e,vercelUrl:n,version:null});const i=v.storeId||e.storeId;l(`[ZONOS - loadZonos] Store ID: ${i}`,"info");const a=new URLSearchParams;a.set("storeId",i.toString());const{errors:c,json:d}=await g(`/api/get-store-version?${a.toString()}`);if(c.length||!d)return l("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void v.injectZonos({initConfig:e,vercelUrl:n,version:null});const{isDifferent:p,source:u,version:m}=d;if(l(`[ZONOS - loadZonos] Store version: ${m}, source: ${u}`,"info"),p){l(`[ZONOS - loadZonos] Updating saved store version to ${m}`,"info");const e={storeId:i,version:m};g(`/api/set-store-version?${a.toString()}`,{body:e,method:"POST"}).catch((e=>w("Unable to save store's vesrion",e)))}if(!r){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:t}),s=r&&!n?o:`${"alpha"===m?"alpha":`v${m}`}.js.zonos.com`,i=r&&!n?null:m;l("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:s,loadVersion:i,version:m}),v.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=L)})();
|
|
1
|
+
(function(){"use strict";function e(e,o){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(r=Object.getOwnPropertySymbols(e);t<r.length;t++)o.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(n[r[t]]=e[r[t]])}return n}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],n=o[0],r={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=r[n],s=(e=n)=>{const r=o.indexOf(e),t=o[r+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=performance.now(),c=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},l=(e,o,...n)=>{var r,t;const s=performance.now()-a,i=[`(${s>1e3?`${(s/1e3).toFixed(2)}s`:`${s.toFixed(2)}ms`})`,...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,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${r[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}},u=async({basePathType:e,options:o,path:t})=>{let s;const i=window.Zonos.zonosQaUrlApi||r[e]||n,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:c}}const d=s.status.toString();try{const e=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:d}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${d}: ${"Unknown error"}`,type:d}],json:null,response:null,zonosMode:c}}},m=async({basePathType:o,options:n,path:t})=>{var a,c;const p=t.startsWith("/api/bigcommerce")?"vercel":o,g=await u({basePathType:p,options:n,path:t}),{errors:w,response:f}=g,h=e(g,["errors","response"]),y=s(p),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==f?void 0:f.status),S=y&&v;return v&&d({endpoint:r[p]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:p,nextFallbackApiType:y,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),S?(l(`=== "${t}" failed to fetch, trying next fallback ${y}`),m({basePathType:y,options:n,path:t})):Object.assign({errors:w,response:f},h)},g=async(o,r)=>{const t=e(r||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return l(o,"info"),m({basePathType:d||n,options:c,path:o})},w=(e,...o)=>{l(e,"error",...o)},f=["jsdelivr","cdnjs","unpkg","vercel"],h=e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");if(!o)return null;return/[^a-zA-Z0-9-_]+/.test(o)?null:o},y=async e=>{const o=await(async e=>{const{errors:o,json:n}=await g("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||o.length?null:n})(e);return l("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(w("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var v;const S=(()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=h(window.location.href),n="https://v1.3.83.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,n=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),r})(),z=(()=>{const e=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrlApi");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),o=h(window.location.href),n=e||o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.demo.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.demo.elements.zonos.com";if(!e)return null;const r=`https://${e}.route.js.zonos.com`;return l(`[ZONOS-WARNING] using '${r}' for serverless API`,"warn"),r})();class L{static get isNpm(){return!1}}v=L,L.isBigCommerce=!1,L.requested=!1,L.cartData=null,L.isLegacyCheckout=!1,L.legacyStoreLogo=null,L.legacyStoreFavicon=null,L.parallelLoadTimes=[],L.parallelLoadState="off",L.releaseDate="1728684733949",L.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:n,metadata:r,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!n},r)))}catch(e){}},L.loadScriptLogParallelHandler=async e=>{try{if(v.parallelLoadTimes.push(e),2===v.parallelLoadTimes.length){const e=v.parallelLoadTimes.find((e=>"vercel"===e.type)),o=v.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void d({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});v.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},L.legacyCheckoutErrorHandler=({message:e})=>{w(`[ZONOS - loadZonos] ${e}`),d({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:v.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},L.getGithubCdn=({type:e,version:o})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.83";"cdnjs"===e?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.83":"unpkg"===e&&(n="https://unpkg.com/@zonos/elements@1.3.83");return o&&"alpha"!==o?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):n},L.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:n,vercelUrl:r,version:t})=>{var s;const i="vercel"===e?r:v.getGithubCdn({type:e,version:t}),a=S||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,l(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||n})())||void 0===s?void 0:s.effectiveType),g=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),w=f[0]===e,h=f[1],y="on"===v.parallelLoadState&&m&&w&&h&&!g;y&&v.injectZonos({cdnType:h,initConfig:o,parallelLoaded:!0,vercelUrl:r,version:t});const L=performance.now();p.addEventListener("load",(()=>{if(y||n?v.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-L,scriptLoadUrl:p.src,storeId:v.storeId,type:e}):v.loadScriptLogHandler({fallbackLoadTime:performance.now()-L,scriptLoadUrl:p.src,storeId:v.storeId,type:e}),v.isBigCommerce||(v.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=S,window.Zonos.zonosQaUrlApi=z,window.Zonos.isBigCommerce=v.isBigCommerce,v.cartId){if(!v.zonosApiKey)throw v.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!v.cartData)throw v.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(v.legacyStoreFavicon&&v.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=v.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=v.cartData,window.Zonos.isLegacyCheckout=v.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:v.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:v.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:v.isLegacyCheckout?v.cartData.storeBaseUrl:void 0}),zonosApiKey:v.zonosApiKey});o=e}window.Zonos.version&&(l(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=f.indexOf(e);return f[o+1]||null})(e);if(!y&&!n){if(!s)return;v.injectZonos({cdnType:s,initConfig:o,vercelUrl:r,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||S)return;if(y||n)return void v.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-L,isError:!0,scriptLoadUrl:p.src,storeId:v.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?d({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-L,cdnType:e,loadUrl:a,version:t},shouldPostReleaseErrorReporting:!!s}):d({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-L}})})),document.head.appendChild(p)},L.init=async e=>{var o;v.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const n="https://v1.3.83.js.zonos.com",r=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src;l(`[ZONOS - init] first load script src: ${t}`,"info"),window.Zonos.zonosQaUrl=S,window.Zonos.zonosQaUrlApi=z,window.Zonos.zonosQaUrl&&l(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&l(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const s=null==t?void 0:t.includes("timestamp=");if(!(v.isNpm||t&&s))return void w("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(r||!t||v.requested)return void l("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!v.cartId)return v.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void w("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(v.requested=!0,v.zonosApiKey=e.zonosApiKey,v.storeId=e.storeId,v.cartId){const e=await y(v.cartId);if(!e)throw v.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");v.cartData=e.cartData,v.zonosApiKey=e.zonosApiKey,v.legacyStoreLogo=e.storeLogo,v.legacyStoreFavicon=e.storeFavicon,v.storeId=e.storeId,v.zonosApiKey=e.zonosApiKey}if(!v.zonosApiKey)return void w('"zonosApiKey" is required to initialize Zonos');if(!v.storeId)return l("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void v.injectZonos({initConfig:e,vercelUrl:n,version:null});const i=v.storeId||e.storeId;l(`[ZONOS - loadZonos] Store ID: ${i}`,"info");const a=new URLSearchParams;a.set("storeId",i.toString());const{errors:c,json:d}=await g(`/api/get-store-version?${a.toString()}`);if(c.length||!d)return l("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void v.injectZonos({initConfig:e,vercelUrl:n,version:null});const{isDifferent:p,source:u,version:m}=d;if(l(`[ZONOS - loadZonos] Store version: ${m}, source: ${u}`,"info"),p){l(`[ZONOS - loadZonos] Updating saved store version to ${m}`,"info");const e={storeId:i,version:m};g(`/api/set-store-version?${a.toString()}`,{body:e,method:"POST"}).catch((e=>w("Unable to save store's vesrion",e)))}if(!r){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),r=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}})({loadScriptSrc:t}),s=r&&!n?o:`${"alpha"===m?"alpha":`v${m}`}.js.zonos.com`,i=r&&!n?null:m;l("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r,loadUrl:s,loadVersion:i,version:m}),v.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=L)})();
|
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 l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.82.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const{errors:t,json:n}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.82.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.82",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}k=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="1728680923405",N.isLegacyCheckout=!1,N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.82",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:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},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=k.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=k.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;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.82";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.82";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},N.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.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=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=k.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^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,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(),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 l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.83.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const{errors:t,json:n}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!n||t.length?null:n};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.83.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.83",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}k=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="1728684733949",N.isLegacyCheckout=!1,N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.83",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:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},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=k.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=k.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;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.83";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.83";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},N.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.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=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=k.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^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,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)})();
|
|
@@ -18,6 +18,7 @@ export declare class ZonosShipping {
|
|
|
18
18
|
*/
|
|
19
19
|
continueClicked: EventEmitter<void>;
|
|
20
20
|
selectedShippingMethod: ShippingRichRadioItem | null;
|
|
21
|
+
collapsedDAPOptions: boolean;
|
|
21
22
|
/**
|
|
22
23
|
* Whether or not the user is selecting a shipping method
|
|
23
24
|
*/
|
|
@@ -27,7 +28,9 @@ export declare class ZonosShipping {
|
|
|
27
28
|
* @default false
|
|
28
29
|
*/
|
|
29
30
|
showErrorBanner: boolean;
|
|
30
|
-
|
|
31
|
+
serviceLevelsDDP: ShippingRichRadioItem[];
|
|
32
|
+
serviceLevelsDAP: ShippingRichRadioItem[];
|
|
33
|
+
serviceLevelsOther: ShippingRichRadioItem[];
|
|
31
34
|
private handleRadioSelected;
|
|
32
35
|
private handleValidate;
|
|
33
36
|
/**
|
package/dist/types/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { type EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
-
import type { ElementsUiStyle, ElementsUiTheme } from "../../../types/generated/graphql.internal.types";
|
|
2
|
+
import type { ElementsUiStyle, ElementsUiTheme, IncotermCode } from "../../../types/generated/graphql.internal.types";
|
|
3
3
|
import type { Color } from "../../../types/styles/Color";
|
|
4
4
|
export type ShippingRichRadioItem = {
|
|
5
5
|
amount: number;
|
|
6
6
|
caption?: string;
|
|
7
7
|
label: string;
|
|
8
8
|
landedCostId: string;
|
|
9
|
+
method: IncotermCode;
|
|
9
10
|
price: string;
|
|
10
11
|
shipmentRatingId: string;
|
|
11
12
|
sublabel?: string;
|
|
@@ -30,10 +31,6 @@ export declare class ZonosShippingRichRadio {
|
|
|
30
31
|
* Theme of the radio item
|
|
31
32
|
*/
|
|
32
33
|
theme?: ElementsUiTheme;
|
|
33
|
-
/**
|
|
34
|
-
* Initial selected value
|
|
35
|
-
*/
|
|
36
|
-
initialSelectedValue?: string | number;
|
|
37
34
|
/**
|
|
38
35
|
* Selected item
|
|
39
36
|
* @default {null|firstItem}
|
|
@@ -45,6 +42,5 @@ export declare class ZonosShippingRichRadio {
|
|
|
45
42
|
radioSelected?: EventEmitter<ShippingRichRadioItem>;
|
|
46
43
|
private handleRichRadioSelect;
|
|
47
44
|
private getRadioItemStyleVariables;
|
|
48
|
-
componentWillLoad(): void;
|
|
49
45
|
render(): any;
|
|
50
46
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
3
|
-
import type { CalculateLandedCostMutation, CartQuery, CheckoutPresentmentFragment, CheckoutSessionDetailsFragment, CountryCode, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure, LandedCostFragment, ShipmentRatingFragment } from "../../../types/generated/graphql.internal.types";
|
|
2
|
+
import type { CalculateLandedCostMutation, CartQuery, CheckoutPresentmentFragment, CheckoutSessionDetailsFragment, CountryCode, CurrencyCode, IncotermCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure, LandedCostFragment, ShipmentRatingFragment } from "../../../types/generated/graphql.internal.types";
|
|
4
3
|
type Step = 'customer-info' | 'shipping' | 'payment' | 'finish' | 'error';
|
|
5
4
|
export type TabItem = {
|
|
6
5
|
index: number;
|
|
@@ -68,7 +67,11 @@ type CartStore = {
|
|
|
68
67
|
checkoutSessionTimeoutShow: boolean;
|
|
69
68
|
checkoutTimeoutInterval: NodeJS.Timeout | null;
|
|
70
69
|
currency: CurrencyCode;
|
|
71
|
-
|
|
70
|
+
dutiesTaxesFees: number;
|
|
71
|
+
/**
|
|
72
|
+
* For DAP
|
|
73
|
+
*/
|
|
74
|
+
dutiesTaxesFeesEstimate: number;
|
|
72
75
|
error: {
|
|
73
76
|
messages: string[];
|
|
74
77
|
title: string;
|
|
@@ -89,6 +92,7 @@ type CartStore = {
|
|
|
89
92
|
isSelectedShippingGuarantee: boolean;
|
|
90
93
|
items: CartItemToUse[];
|
|
91
94
|
landedCostData: MappedCheckoutLandedCost[] | null;
|
|
95
|
+
landedCostMethod: IncotermCode;
|
|
92
96
|
promoCode: string;
|
|
93
97
|
/**
|
|
94
98
|
* Only show promo code error when promo code applied clicked by user
|
|
@@ -163,14 +167,12 @@ type CartSubtotals = {
|
|
|
163
167
|
shipping: number;
|
|
164
168
|
total: number;
|
|
165
169
|
};
|
|
166
|
-
declare const cartStoreApplySubtotals: (subtotals: CartSubtotals) => void;
|
|
167
|
-
type CartStoreRecalculateTotalParams = Omit<Parameters<typeof stripeStoreUpdateCheckoutSession>[0], 'id' | 'presentmentCountryCode'>;
|
|
170
|
+
declare const cartStoreApplySubtotals: (subtotals: CartSubtotals, dutiesTaxesFeesEstimate?: number) => void;
|
|
168
171
|
/**
|
|
169
172
|
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
170
173
|
*/
|
|
171
174
|
declare const cartStoreHasOneEligibleItem: () => boolean;
|
|
172
175
|
declare const cartStoreSetCheckoutSession: (checkoutSession: CheckoutSessionDetailsFragment) => void;
|
|
173
|
-
declare const cartStoreReCalculateTotal: ({ adjustmentsAmount, cartId, currency, itemsAmount, landedCostId, }: CartStoreRecalculateTotalParams) => Promise<boolean>;
|
|
174
176
|
declare const cartStoreUpdateSelectedShippingOption: (selectedShippingOption: ShipmentRatingFragment, landedCostId: string) => Promise<boolean>;
|
|
175
177
|
declare const cartStoreStartCheckoutInterval: ({ isPreview, sessionTimeout, }: {
|
|
176
178
|
isPreview: boolean;
|
|
@@ -188,4 +190,4 @@ declare const cartStoreUpdateItems: ({ adjustments, cartItems, }: {
|
|
|
188
190
|
declare const cartStorePreviousStep: () => void;
|
|
189
191
|
declare const cartStoreNextStep: () => void;
|
|
190
192
|
declare const cartStoreResetTabItems: () => void;
|
|
191
|
-
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStorePreviousStep,
|
|
193
|
+
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStorePreviousStep, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateToErrorState, };
|
|
@@ -86,12 +86,18 @@ export declare const stringsArabic: {
|
|
|
86
86
|
"Don't close": {
|
|
87
87
|
value: string;
|
|
88
88
|
};
|
|
89
|
+
'Due at delivery': {
|
|
90
|
+
value: string;
|
|
91
|
+
};
|
|
89
92
|
'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
|
|
90
93
|
value: string;
|
|
91
94
|
};
|
|
92
95
|
'Duties and taxes will be applied to items and shipping.': {
|
|
93
96
|
value: string;
|
|
94
97
|
};
|
|
98
|
+
'Duties and taxes will be charged upon delivery.': {
|
|
99
|
+
value: string;
|
|
100
|
+
};
|
|
95
101
|
'Duties will apply to all orders.': {
|
|
96
102
|
value: string;
|
|
97
103
|
};
|
|
@@ -107,6 +113,9 @@ export declare const stringsArabic: {
|
|
|
107
113
|
'Error updating Checkout': {
|
|
108
114
|
value: string;
|
|
109
115
|
};
|
|
116
|
+
Estimated: {
|
|
117
|
+
value: string;
|
|
118
|
+
};
|
|
110
119
|
'Expected delivery': {
|
|
111
120
|
value: string;
|
|
112
121
|
};
|
|
@@ -128,6 +137,9 @@ export declare const stringsArabic: {
|
|
|
128
137
|
Hide: {
|
|
129
138
|
value: string;
|
|
130
139
|
};
|
|
140
|
+
'Hide non prepaid methods': {
|
|
141
|
+
value: string;
|
|
142
|
+
};
|
|
131
143
|
'Invalid promo code': {
|
|
132
144
|
value: string;
|
|
133
145
|
};
|
|
@@ -161,6 +173,9 @@ export declare const stringsArabic: {
|
|
|
161
173
|
'No shipping methods found - try editing your address or contacting support if the error persists': {
|
|
162
174
|
value: string;
|
|
163
175
|
};
|
|
176
|
+
'Nothing due at delivery': {
|
|
177
|
+
value: string;
|
|
178
|
+
};
|
|
164
179
|
'Nothing due at the door': {
|
|
165
180
|
value: string;
|
|
166
181
|
};
|
|
@@ -269,6 +284,9 @@ export declare const stringsArabic: {
|
|
|
269
284
|
Show: {
|
|
270
285
|
value: string;
|
|
271
286
|
};
|
|
287
|
+
'Show non prepaid methods': {
|
|
288
|
+
value: string;
|
|
289
|
+
};
|
|
272
290
|
'Something went wrong.': {
|
|
273
291
|
value: string;
|
|
274
292
|
};
|
|
@@ -341,6 +359,9 @@ export declare const stringsArabic: {
|
|
|
341
359
|
'Would you like to close checkout and return to the site?': {
|
|
342
360
|
value: string;
|
|
343
361
|
};
|
|
362
|
+
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
363
|
+
value: string;
|
|
364
|
+
};
|
|
344
365
|
"You're all set!": {
|
|
345
366
|
value: string;
|
|
346
367
|
};
|
|
@@ -86,12 +86,18 @@ export declare const stringsBase: {
|
|
|
86
86
|
"Don't close": {
|
|
87
87
|
value: string;
|
|
88
88
|
};
|
|
89
|
+
'Due at delivery': {
|
|
90
|
+
value: string;
|
|
91
|
+
};
|
|
89
92
|
'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
|
|
90
93
|
value: string;
|
|
91
94
|
};
|
|
92
95
|
'Duties and taxes will be applied to items and shipping.': {
|
|
93
96
|
value: string;
|
|
94
97
|
};
|
|
98
|
+
'Duties and taxes will be charged upon delivery.': {
|
|
99
|
+
value: string;
|
|
100
|
+
};
|
|
95
101
|
'Duties will apply to all orders.': {
|
|
96
102
|
value: string;
|
|
97
103
|
};
|
|
@@ -107,6 +113,9 @@ export declare const stringsBase: {
|
|
|
107
113
|
'Error updating Checkout': {
|
|
108
114
|
value: string;
|
|
109
115
|
};
|
|
116
|
+
Estimated: {
|
|
117
|
+
value: string;
|
|
118
|
+
};
|
|
110
119
|
'Expected delivery': {
|
|
111
120
|
value: string;
|
|
112
121
|
};
|
|
@@ -128,6 +137,9 @@ export declare const stringsBase: {
|
|
|
128
137
|
Hide: {
|
|
129
138
|
value: string;
|
|
130
139
|
};
|
|
140
|
+
'Hide non prepaid methods': {
|
|
141
|
+
value: string;
|
|
142
|
+
};
|
|
131
143
|
'Invalid promo code': {
|
|
132
144
|
value: string;
|
|
133
145
|
};
|
|
@@ -161,6 +173,9 @@ export declare const stringsBase: {
|
|
|
161
173
|
'No shipping methods found - try editing your address or contacting support if the error persists': {
|
|
162
174
|
value: string;
|
|
163
175
|
};
|
|
176
|
+
'Nothing due at delivery': {
|
|
177
|
+
value: string;
|
|
178
|
+
};
|
|
164
179
|
'Nothing due at the door': {
|
|
165
180
|
value: string;
|
|
166
181
|
};
|
|
@@ -269,6 +284,9 @@ export declare const stringsBase: {
|
|
|
269
284
|
Show: {
|
|
270
285
|
value: string;
|
|
271
286
|
};
|
|
287
|
+
'Show non prepaid methods': {
|
|
288
|
+
value: string;
|
|
289
|
+
};
|
|
272
290
|
'Something went wrong.': {
|
|
273
291
|
value: string;
|
|
274
292
|
};
|
|
@@ -341,6 +359,9 @@ export declare const stringsBase: {
|
|
|
341
359
|
'Would you like to close checkout and return to the site?': {
|
|
342
360
|
value: string;
|
|
343
361
|
};
|
|
362
|
+
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
363
|
+
value: string;
|
|
364
|
+
};
|
|
344
365
|
"You're all set!": {
|
|
345
366
|
value: string;
|
|
346
367
|
};
|
|
@@ -86,12 +86,18 @@ export declare const stringsChinese: {
|
|
|
86
86
|
"Don't close": {
|
|
87
87
|
value: string;
|
|
88
88
|
};
|
|
89
|
+
'Due at delivery': {
|
|
90
|
+
value: string;
|
|
91
|
+
};
|
|
89
92
|
'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
|
|
90
93
|
value: string;
|
|
91
94
|
};
|
|
92
95
|
'Duties and taxes will be applied to items and shipping.': {
|
|
93
96
|
value: string;
|
|
94
97
|
};
|
|
98
|
+
'Duties and taxes will be charged upon delivery.': {
|
|
99
|
+
value: string;
|
|
100
|
+
};
|
|
95
101
|
'Duties will apply to all orders.': {
|
|
96
102
|
value: string;
|
|
97
103
|
};
|
|
@@ -107,6 +113,9 @@ export declare const stringsChinese: {
|
|
|
107
113
|
'Error updating Checkout': {
|
|
108
114
|
value: string;
|
|
109
115
|
};
|
|
116
|
+
Estimated: {
|
|
117
|
+
value: string;
|
|
118
|
+
};
|
|
110
119
|
'Expected delivery': {
|
|
111
120
|
value: string;
|
|
112
121
|
};
|
|
@@ -128,6 +137,9 @@ export declare const stringsChinese: {
|
|
|
128
137
|
Hide: {
|
|
129
138
|
value: string;
|
|
130
139
|
};
|
|
140
|
+
'Hide non prepaid methods': {
|
|
141
|
+
value: string;
|
|
142
|
+
};
|
|
131
143
|
'Invalid promo code': {
|
|
132
144
|
value: string;
|
|
133
145
|
};
|
|
@@ -161,6 +173,9 @@ export declare const stringsChinese: {
|
|
|
161
173
|
'No shipping methods found - try editing your address or contacting support if the error persists': {
|
|
162
174
|
value: string;
|
|
163
175
|
};
|
|
176
|
+
'Nothing due at delivery': {
|
|
177
|
+
value: string;
|
|
178
|
+
};
|
|
164
179
|
'Nothing due at the door': {
|
|
165
180
|
value: string;
|
|
166
181
|
};
|
|
@@ -269,6 +284,9 @@ export declare const stringsChinese: {
|
|
|
269
284
|
Show: {
|
|
270
285
|
value: string;
|
|
271
286
|
};
|
|
287
|
+
'Show non prepaid methods': {
|
|
288
|
+
value: string;
|
|
289
|
+
};
|
|
272
290
|
'Something went wrong.': {
|
|
273
291
|
value: string;
|
|
274
292
|
};
|
|
@@ -341,6 +359,9 @@ export declare const stringsChinese: {
|
|
|
341
359
|
'Would you like to close checkout and return to the site?': {
|
|
342
360
|
value: string;
|
|
343
361
|
};
|
|
362
|
+
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
363
|
+
value: string;
|
|
364
|
+
};
|
|
344
365
|
"You're all set!": {
|
|
345
366
|
value: string;
|
|
346
367
|
};
|
|
@@ -86,12 +86,18 @@ export declare const stringsDanish: {
|
|
|
86
86
|
"Don't close": {
|
|
87
87
|
value: string;
|
|
88
88
|
};
|
|
89
|
+
'Due at delivery': {
|
|
90
|
+
value: string;
|
|
91
|
+
};
|
|
89
92
|
'Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders.': {
|
|
90
93
|
value: string;
|
|
91
94
|
};
|
|
92
95
|
'Duties and taxes will be applied to items and shipping.': {
|
|
93
96
|
value: string;
|
|
94
97
|
};
|
|
98
|
+
'Duties and taxes will be charged upon delivery.': {
|
|
99
|
+
value: string;
|
|
100
|
+
};
|
|
95
101
|
'Duties will apply to all orders.': {
|
|
96
102
|
value: string;
|
|
97
103
|
};
|
|
@@ -107,6 +113,9 @@ export declare const stringsDanish: {
|
|
|
107
113
|
'Error updating Checkout': {
|
|
108
114
|
value: string;
|
|
109
115
|
};
|
|
116
|
+
Estimated: {
|
|
117
|
+
value: string;
|
|
118
|
+
};
|
|
110
119
|
'Expected delivery': {
|
|
111
120
|
value: string;
|
|
112
121
|
};
|
|
@@ -128,6 +137,9 @@ export declare const stringsDanish: {
|
|
|
128
137
|
Hide: {
|
|
129
138
|
value: string;
|
|
130
139
|
};
|
|
140
|
+
'Hide non prepaid methods': {
|
|
141
|
+
value: string;
|
|
142
|
+
};
|
|
131
143
|
'Invalid promo code': {
|
|
132
144
|
value: string;
|
|
133
145
|
};
|
|
@@ -161,6 +173,9 @@ export declare const stringsDanish: {
|
|
|
161
173
|
'No shipping methods found - try editing your address or contacting support if the error persists': {
|
|
162
174
|
value: string;
|
|
163
175
|
};
|
|
176
|
+
'Nothing due at delivery': {
|
|
177
|
+
value: string;
|
|
178
|
+
};
|
|
164
179
|
'Nothing due at the door': {
|
|
165
180
|
value: string;
|
|
166
181
|
};
|
|
@@ -269,6 +284,9 @@ export declare const stringsDanish: {
|
|
|
269
284
|
Show: {
|
|
270
285
|
value: string;
|
|
271
286
|
};
|
|
287
|
+
'Show non prepaid methods': {
|
|
288
|
+
value: string;
|
|
289
|
+
};
|
|
272
290
|
'Something went wrong.': {
|
|
273
291
|
value: string;
|
|
274
292
|
};
|
|
@@ -341,6 +359,9 @@ export declare const stringsDanish: {
|
|
|
341
359
|
'Would you like to close checkout and return to the site?': {
|
|
342
360
|
value: string;
|
|
343
361
|
};
|
|
362
|
+
'You may incur additional fees from the shipping carrier by not prepaying.': {
|
|
363
|
+
value: string;
|
|
364
|
+
};
|
|
344
365
|
"You're all set!": {
|
|
345
366
|
value: string;
|
|
346
367
|
};
|