@zonos/elements 1.3.135 → 1.3.137
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-0f32f556.js → cart-dea3242e.js} +75 -2
- package/dist/cjs/index.cjs.js +13 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-045033fb.js → paypal-729f9ed3.js} +1 -2
- package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +21 -8
- package/dist/cjs/zonos-checkout.cjs.entry.js +108 -11
- 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/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +19 -6
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +108 -10
- package/dist/collection/components/store/checkout/paypal.js +0 -1
- package/dist/collection/components/store/checkout/stripe.js +15 -2
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/collection/scripts/_zonosBase.js +6 -3
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -3
- package/dist/collection/types/generated/graphql.internal.types.js +1 -0
- package/dist/esm/{cart-3e0e4d5c.js → cart-c15cb7dd.js} +76 -3
- package/dist/esm/index.js +13 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-7f41ff20.js → paypal-de439a93.js} +1 -2
- package/dist/esm/zonos-address_7.entry.js +1 -1
- package/dist/esm/zonos-cart-items_13.entry.js +21 -8
- package/dist/esm/zonos-checkout.entry.js +109 -12
- 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-es5/cart-c15cb7dd.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-7f41ff20.js → paypal-de439a93.js} +2 -2
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-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/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.d.ts +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +5 -0
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/types/components/store/translationStore.d.ts +1 -1
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -23
- package/dist/types/types/generated/graphql.frontend.types.ts +3 -36
- package/dist/types/types/generated/graphql.internal.types.d.ts +1 -0
- package/dist/types/types/generated/graphql.internal.types.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-3f2ea446.entry.js → p-0867e94a.entry.js} +1 -1
- package/dist/zonos-elements/p-1af38265.system.js +1 -0
- package/dist/zonos-elements/{p-887b05eb.system.entry.js → p-1faa4294.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2de631c4.system.entry.js +1 -0
- package/dist/zonos-elements/{p-49cecdf9.system.entry.js → p-3039f460.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3a5fb01a.system.entry.js → p-35ccf9d8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-aaa3addd.system.entry.js → p-374680fd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-897c809a.entry.js → p-43ac026b.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b8db2d3.entry.js → p-4aecf7fc.entry.js} +1 -1
- package/dist/zonos-elements/{p-b1bb00a8.entry.js → p-51f8719d.entry.js} +1 -1
- package/dist/zonos-elements/{p-b6fea87a.entry.js → p-56e63659.entry.js} +1 -1
- package/dist/zonos-elements/p-611842b5.entry.js +1 -0
- package/dist/zonos-elements/{p-4b680c1e.system.entry.js → p-765ddab5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-85fbb5f0.entry.js → p-77b2acf4.entry.js} +1 -1
- package/dist/zonos-elements/p-7838aa96.entry.js +1 -0
- package/dist/zonos-elements/p-7c08bf7d.system.js +1 -0
- package/dist/zonos-elements/{p-a28f3298.system.entry.js → p-7eceaa3a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-05826697.system.entry.js → p-910c1247.system.entry.js} +1 -1
- package/dist/zonos-elements/p-938b2b70.js +17 -0
- package/dist/zonos-elements/p-940e327f.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e9db73d9.entry.js → p-a5d35e84.entry.js} +1 -1
- package/dist/zonos-elements/p-afa5c13c.js +1 -0
- package/dist/zonos-elements/{p-16e5df29.system.entry.js → p-c710bde9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-bec4d2c7.entry.js → p-cb6baa14.entry.js} +1 -1
- package/dist/zonos-elements/{p-1856c3fa.system.js → p-e9b39df1.system.js} +2 -2
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-3e0e4d5c.js +0 -1
- package/dist/zonos-elements/p-69045ca3.js +0 -1
- package/dist/zonos-elements/p-8759f66b.js +0 -17
- package/dist/zonos-elements/p-99d47e1c.entry.js +0 -1
- package/dist/zonos-elements/p-a0de6e0f.system.entry.js +0 -1
- package/dist/zonos-elements/p-acb45eb6.system.entry.js +0 -1
- package/dist/zonos-elements/p-fa41d3e4.system.js +0 -1
- package/dist/zonos-elements/p-fa790aaf.system.js +0 -1
- package/dist/zonos-elements/p-fb7d8b52.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function o(o,e){var n={};for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&e.indexOf(t)<0&&(n[t]=o[t]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(o);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(o,t[r])&&(n[t[r]]=o[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=["cloudflare","vercel"],n=e[0],t={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},r=t[n],s=(o=n)=>{const t=e.indexOf(o),r=e[t+1];return r||null},i=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},a=performance.now(),c=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},d=(o,e,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-a,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const l=(null===(r=d.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(e){case"warn":l.warn(o,...i);break;case"info":l.info(o,...i);break;case"error":l.error(o,...i);break;default:l.groupCollapsed(o,...i),l.trace(),l.groupEnd()}},l=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(d("sendErrorLog","warn",o,n,e),i){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:o,errors:e,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${r}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=s();if(!e)return;fetch(`${t[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=i(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},u=async({basePathType:o,options:e,path:r})=>{let s;const i=window.Zonos.zonosQaUrlApi||t[o]||n,a=new URL(i+r),c=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(c));try{s=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.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 d=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:d}}const u=s.status.toString();try{const o=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(o),type:u}],json:null,response:s,zonosMode:d}}catch(o){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:d}}},m=async({basePathType:e,options:n,path:r})=>{var a,c;const p=r.startsWith("/api/bigcommerce")?"vercel":e,w=await u({basePathType:p,options:n,path:r}),{errors:g,response:f}=w,y=o(w,["errors","response"]),h=s(p),v=!!g.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),Z=h&&v;return v&&l({endpoint:t[p]+r,errors:g.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:p,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),Z?(d(`=== "${r}" failed to fetch, trying next fallback ${h}`),m({basePathType:h,options:n,path:r})):Object.assign({errors:g,response:f},y)},w=async(e,t)=>{const r=o(t||{},[]),s=r.body?JSON.stringify(r.body):void 0,i=r.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"},r.headers),c=Object.assign(Object.assign({},r),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return d(e,"info"),m({basePathType:l||n,options:c,path:e})},g=(o,...e)=>{d(o,"error",...e)},f=["jsdelivr","cdnjs","unpkg","vercel"],y=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},h=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${h.source}$`),Z=new RegExp(`^cart_${h.source}$`),S=o=>o?Z.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},O=async({cartId:o,retries:e})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:t,json:r}=await w("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),s=!r||t.length;return s&&e?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),O({cartId:o,retries:e-1})):s?null:r};var z;const L=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=y(window.location.href),n="https://v1.3.135.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const t=`https://${e}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),b=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=y(window.location.href),n=o||e;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(!o)return null;const t=`https://${o}.route.js.zonos.com`;return d(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})();class U{}z=U,U.isNpm=!1,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,U.version="v1.3.135",U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1732640595058",U.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(r)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},t)))}catch(o){}},U.loadScriptLogParallelHandler=async o=>{try{if(z.parallelLoadTimes.push(o),2===z.parallelLoadTimes.length){const o=z.parallelLoadTimes.find((o=>"vercel"===o.type)),e=z.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void l({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});z.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},U.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{g(`[ZONOS - loadZonos] ${o}`),l({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:z.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},U.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.135";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.135":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.135");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},U.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;e=Object.assign(Object.assign({},e),{zonosApiKey:z.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===o?t:z.getGithubCdn({type:o,version:r}),a=L||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,d(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),g=f[0]===o,y=f[1],h="on"===z.parallelLoadState&&m&&g&&y&&!w;h&&z.injectZonos({cdnType:y,initConfig:e,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();p.addEventListener("load",(()=>{var t;if(h||n?z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:o}):z.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:o}),z.isBigCommerce||(z.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=L,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=z.isBigCommerce,z.cartId){if(!z.zonosApiKey)throw z.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!z.cartData)throw z.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(z.legacyStoreFavicon&&z.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=z.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=z.cartData,window.Zonos.isLegacyCheckout=z.isLegacyCheckout;const o=z.isLegacyCheckout&&"CLOSE_MODAL"===(null===(t=e.checkoutSettings)||void 0===t?void 0:t.successBehavior),n=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:z.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},e.checkoutSettings),{successBehavior:o?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:o?z.cartData.storeBaseUrl:void 0}),zonosApiKey:z.zonosApiKey});e=n}window.Zonos.version&&(d(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(e))})),p.addEventListener("error",(async()=>{const s=(o=>{const e=f.indexOf(o);return f[e+1]||null})(o);if(!h&&!n){if(!s)return;z.injectZonos({cdnType:s,initConfig:e,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||L)return;if(h||n)return void z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:z.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?l({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):l({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async o=>{var e;if(d("=== Init zonos script release date","info",z.releaseDate),L&&!window.isZonosPreview){d(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${L}`,"info");const e=document.createElement("script");return e.src=`${L}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=z.isBigCommerce,window.Zonos.isLegacyCheckout=z.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${L}`)})),void(window.isZonosPreview=!0)}const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:t,isLegacyCartId:r}=S(n);if(n&&!r&&!t)return void z.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});z.cartId=n;const s="https://v1.3.135.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(e=document.querySelector("script[src*='/loadZonos.js']"))||void 0===e?void 0:e.src;d(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=L,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&d(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&d(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(z.isNpm||a&&c))return void g("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||z.requested)return void d("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!z.cartId)return z.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void g("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(z.requested=!0,z.zonosApiKey=o.zonosApiKey,z.storeId=o.storeId,z.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=S(o);if(!n&&!e)return g("[ZONOS - loadZonos] invalid cart id"),null;const t=await O({cartId:o,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(g("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(z.cartId);if(!o)throw z.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");z.cartData=o.cartData,z.legacyStoreLogo=o.storeLogo,z.legacyStoreFavicon=o.storeFavicon,z.storeId=o.storeId,z.zonosApiKey=o.zonosApiKey}if(!z.zonosApiKey)return void g('"zonosApiKey" is required to initialize Zonos');const l=await(async()=>{if(!window.location.search.includes("zonosTestMode=1")||!window.Zonos.zonosApiKey)return null;if(d("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return d("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:e}=await w("/api/get-test-public-credential");if(o.length||!e)return g("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const n=e.publicCredential;return n?(d(`[ZONOS - loadZonos] Retrieve new test public token ${n}`,"info"),n):(g("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(l&&(d(`[ZONOS - loadZonos] Using test API key: ${l} for test mode`,"info"),z.zonosApiKey=l),!z.storeId)return d("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void z.injectZonos({initConfig:o,vercelUrl:s,version:null});const p=z.storeId||o.storeId;d(`[ZONOS - loadZonos] Store ID: ${p}`,"info");const u=new URLSearchParams;u.set("storeId",p.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&u.set("_enableStoreVersionPinned","1");const{errors:m,json:f}=await w(`/api/get-store-version?${u.toString()}`);if(m.length||!f)return d("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void z.injectZonos({initConfig:o,vercelUrl:s,version:null});const{isDifferent:y,source:h,version:v}=f;if(d(`[ZONOS - loadZonos] Store version: ${v}, source: ${h}`,"info"),y){d(`[ZONOS - loadZonos] Updating saved store version to ${v}`,"info");const o={storeId:p,version:v};w(`/api/set-store-version?${u.toString()}`,{body:o,method:"POST"}).catch((o=>g("Unable to save store's vesrion",o)))}if(!i){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),t=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:a}),r=t&&!n?e:`${"alpha"===v?"alpha":`v${v}`}.js.zonos.com`,s=t&&!n?null:v;d("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:v}),z.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview)&&(window.Zonos=U)})();
|
|
1
|
+
(function(){"use strict";function o(o,e){var n={};for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&e.indexOf(t)<0&&(n[t]=o[t]);if(null!=o&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(t=Object.getOwnPropertySymbols(o);r<t.length;r++)e.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(o,t[r])&&(n[t[r]]=o[t[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const e=["cloudflare","vercel"],n=e[0],t={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},r=t[n],s=(o=n)=>{const t=e.indexOf(o),r=e[t+1];return r||null},i=o=>{if("string"==typeof o)try{return JSON.parse(o)}catch(o){return null}return null},a=performance.now(),c=o=>{if("string"==typeof o)return o;try{return JSON.stringify(o)}catch(e){if(o&&"function"==typeof o.toString){return o.toString()}return"Unable to stringify info"}},d=(o,e,...n)=>{var t,r;const{elapsedTimePretty:s}=(()=>{const o=performance.now()-a,e=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:e}})(),i=[`(${s})`,...n];i.map(c).join(" ");if(!(!!(null===(t=window.Zonos)||void 0===t?void 0:t.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===e&&console.error(o,...i));let d=document.querySelector("iframe#zonos---debug-logging-iframe");d||(d=document.createElement("iframe"),d.id="zonos---debug-logging-iframe",d.style.display="none",d.style.opacity="0",d.style.position="absolute",d.style.top="-9999px",d.style.left="-9999px",d.style.width="1px",d.style.height="1px",d.style.border="none",d.style.overflow="hidden",d.style.visibility="hidden",document.body.appendChild(d));const l=(null===(r=d.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(e){case"warn":l.warn(o,...i);break;case"info":l.info(o,...i);break;case"error":l.error(o,...i);break;default:l.groupCollapsed(o,...i),l.trace(),l.groupEnd()}},l=async({endpoint:o,errors:e,metadata:n,shouldPostReleaseErrorReporting:i})=>{if(d("sendErrorLog","warn",o,n,e),i){const o=Number(window.Zonos.releaseDate);if((new Date).getTime()-o>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:o,errors:e,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},n)};try{fetch(`${r}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(o){const e=s();if(!e)return;fetch(`${t[e]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},p=async({response:o,shouldLog:e=!0,shouldThrow:n=!1})=>{try{const e=await o.text(),n=i(e);if(!n)throw new Error(`Failed to parse content: ${e}`);return n}catch(o){if(n)throw o;return e&&console.error(o),null}},u=async({basePathType:o,options:e,path:r})=>{let s;const i=window.Zonos.zonosQaUrlApi||t[o]||n,a=new URL(i+r),c=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;a.searchParams.set("zToken",(o=>{try{return btoa(o).replace(/=/g,"")}catch(e){return o.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(c));try{s=await fetch(a.toString(),e)}catch(o){if(o instanceof Error)return{baseUrl:i,errors:[{message:o.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 d=s.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&d&&l&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await p({response:s}),response:s,zonosMode:d}}const u=s.status.toString();try{const o=await p({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(o),type:u}],json:null,response:s,zonosMode:d}}catch(o){return{baseUrl:i,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:d}}},m=async({basePathType:e,options:n,path:r})=>{var a,c;const p=r.startsWith("/api/bigcommerce")?"vercel":e,w=await u({basePathType:p,options:n,path:r}),{errors:g,response:f}=w,y=o(w,["errors","response"]),h=s(p),v=!!g.find((({type:o})=>"unknown"===o))||404===(null==f?void 0:f.status),Z=h&&v;return v&&l({endpoint:t[p]+r,errors:g.map((({message:o})=>`API: ${o}`)),metadata:{currentBasePath:p,nextFallbackApiType:h,requestHeaders:null==n?void 0:n.headers,requestPayload:i(null===(a=null==n?void 0:n.body)||void 0===a?void 0:a.toString())||(null===(c=null==n?void 0:n.body)||void 0===c?void 0:c.toString()),status:null==f?void 0:f.status,statusText:null==f?void 0:f.statusText},shouldPostReleaseErrorReporting:!0}),Z?(d(`=== "${r}" failed to fetch, trying next fallback ${h}`),m({basePathType:h,options:n,path:r})):Object.assign({errors:g,response:f},y)},w=async(e,t)=>{const r=o(t||{},[]),s=r.body?JSON.stringify(r.body):void 0,i=r.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"},r.headers),c=Object.assign(Object.assign({},r),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return d(e,"info"),m({basePathType:l||n,options:c,path:e})},g=(o,...e)=>{d(o,"error",...e)},f=["jsdelivr","cdnjs","unpkg","vercel"],y=o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrl");if(!e)return null;return/[^a-zA-Z0-9-_]+/.test(e)?null:e},h=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,v=new RegExp(`^${h.source}$`),Z=new RegExp(`^cart_${h.source}$`),S=o=>o?Z.test(o)?{isDgsCartId:!0,isLegacyCartId:!1}:v.test(o)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1},O=async({cartId:o,retries:e})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:t,json:r}=await w("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:o},headers:{"Content-Type":"application/json"},method:"POST"}),s=!r||t.length;return s&&e?(d("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:e}),await new Promise((o=>setTimeout(o,500))),O({cartId:o,retries:e-1})):s?null:r};var z;const L=(()=>{const o=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||o)return null;const e=y(window.location.href),n="https://v1.3.137.js.zonos.com";if(!e&&(n.includes("test.")||n.includes("test-")))return n;if(!e&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!e)return null;if("dev-elements"===e)return"https://dev.elements.zonos.com";const t=`https://${e}.preview.js.zonos.com`;return d(`[ZONOS-WARNING] using '${t}' for loading elements script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const o=new URLSearchParams(window.location.search);o.delete("zonosQaUrl");const{pathname:e}=window.location,n=`${e}?${o.toString()}`;return window.history.replaceState(window.history.state,"",n),window.location.reload(),null})),t})(),b=(()=>{const o=(o=>{if(!o)return null;const e=new URL(o).searchParams.get("zonosQaUrlApi");return e?/[^a-zA-Z0-9-_]+/.test(e)?null:e:null})(window.location.href),e=y(window.location.href),n=o||e;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(!o)return null;const t=`https://${o}.route.js.zonos.com`;return d(`[ZONOS-WARNING] using '${t}' for serverless API`,"warn"),t})();class U{}z=U,U.isNpm=!1,U.isBigCommerce=!1,U.requested=!1,U.cartData=null,U.domain=window.location!=window.parent.location?document.referrer:document.location.hostname,U.version="v1.3.137",U.isLegacyCheckout=!1,U.legacyStoreLogo=null,U.legacyStoreFavicon=null,U.parallelLoadTimes=[],U.parallelLoadState="off",U.releaseDate="1733521631578",U.loadScriptLogHandler=async({cdnLoadTime:o,fallbackLoadTime:e,isError:n,metadata:t,scriptLoadUrl:r,storeId:s,type:i})=>{try{const o=window.performance.getEntriesByType("resource").find((o=>{const e=o;return e.name.includes(r)&&"script"===e.initiatorType}));null==o||o.transferSize;(async o=>{})((o&&(null==o?void 0:o.duration)>0?parseFloat(o.duration.toFixed(2)):parseFloat(e.toFixed(2)),Object.assign({decodedBodySize:null==o?void 0:o.decodedBodySize,encodedBodySize:null==o?void 0:o.encodedBodySize,fallbackLoadTime:e,isError:!!n},t)))}catch(o){}},U.loadScriptLogParallelHandler=async o=>{try{if(z.parallelLoadTimes.push(o),2===z.parallelLoadTimes.length){const o=z.parallelLoadTimes.find((o=>"vercel"===o.type)),e=z.parallelLoadTimes.find((o=>"jsdelivr"===o.type));if(!o||!e)return;if(o.isError&&e.isError)return void l({endpoint:`<${o.scriptLoadUrl}> <${e.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:e.fallbackLoadTime,cdnType:e.type,vercelLoadTime:o.fallbackLoadTime}});z.loadScriptLogHandler({cdnLoadTime:e.fallbackLoadTime,fallbackLoadTime:o.fallbackLoadTime,isError:o.isError,metadata:{cdnScriptFallbackTime:e.fallbackLoadTime,cdnScriptIsError:!!e.isError,cdnScriptLoadUrl:e.scriptLoadUrl,cdnScriptType:e.type},scriptLoadUrl:o.scriptLoadUrl,storeId:o.storeId,type:o.type})}}catch(o){}},U.legacyCheckoutErrorHandler=({message:o,metadata:e})=>{g(`[ZONOS - loadZonos] ${o}`),l({endpoint:"LegacyCheckoutInit",errors:[o],metadata:Object.assign(Object.assign({},e),{tempCartUUID:z.cartId})}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:o}))},U.getGithubCdn=({type:o,version:e})=>{let n="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.137";"cdnjs"===o?n="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.137":"unpkg"===o&&(n="https://unpkg.com/@zonos/elements@1.3.137");return e&&"alpha"!==e?n.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${e}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${e}`):n},U.injectZonos=({cdnType:o="jsdelivr",initConfig:e,parallelLoaded:n,vercelUrl:t,version:r})=>{var s;e=Object.assign(Object.assign({},e),{zonosApiKey:z.zonosApiKey}),r&&(window.Zonos.version=`v${r}`);const i="vercel"===o?t:z.getGithubCdn({type:o,version:r}),a=L||i,c=a.replace("https://","").replace("http://",""),p=document.createElement("script"),u=r&&r<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${c}/dist/scripts/${u}`,d(`[ZONOS - loadZonos] Injecting "${u}" from "${c}"`,"info");const m="4g"===(null===(s=(()=>{const o="connection"in window.navigator?window.navigator.connection:null,e="mozConnection"in window.navigator?window.navigator.mozConnection:null,n="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return o||e||n})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((o=>window.location.href.includes(o))),g=f[0]===o,y=f[1],h="on"===z.parallelLoadState&&m&&g&&y&&!w;h&&z.injectZonos({cdnType:y,initConfig:e,parallelLoaded:!0,vercelUrl:t,version:r});const v=performance.now();p.addEventListener("load",(()=>{var t;if(h||n?z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:o}):z.loadScriptLogHandler({fallbackLoadTime:performance.now()-v,scriptLoadUrl:p.src,storeId:z.storeId,type:o}),z.isBigCommerce||(z.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=L,window.Zonos.zonosQaUrlApi=b,window.Zonos.isBigCommerce=z.isBigCommerce,z.cartId){if(!z.zonosApiKey)throw z.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!z.cartData)throw z.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(z.legacyStoreFavicon&&z.isLegacyCheckout){const o=document.createElement("link");o.rel="shortcut icon",o.type="image/x-icon",o.href=z.legacyStoreFavicon,document.head.appendChild(o)}window.Zonos.cartData=z.cartData,window.Zonos.isLegacyCheckout=z.isLegacyCheckout;const o=z.isLegacyCheckout&&"CLOSE_MODAL"===(null===(t=e.checkoutSettings)||void 0===t?void 0:t.successBehavior),n=Object.assign(Object.assign({},e),{appearance:Object.assign(Object.assign({},e.appearance),{logoUrl:z.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},e.checkoutSettings),{successBehavior:o?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:o?z.cartData.storeBaseUrl:void 0}),zonosApiKey:z.zonosApiKey});e=n}window.Zonos.version&&(d(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${c}"`,"info"),window.Zonos.init(e))})),p.addEventListener("error",(async()=>{const s=(o=>{const e=f.indexOf(o);return f[e+1]||null})(o);if(!h&&!n){if(!s)return;z.injectZonos({cdnType:s,initConfig:e,vercelUrl:t,version:r})}if(["localhost",".zonos.com"].some((o=>window.location.href.includes(o)))||L)return;if(h||n)return void z.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-v,isError:!0,scriptLoadUrl:p.src,storeId:z.storeId,type:o});["unpkg","cdnjs","vercel"].includes(o)?l({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${o} CDN.`],metadata:{cdnLoadTime:performance.now()-v,cdnType:o,loadUrl:a,version:r},shouldPostReleaseErrorReporting:!!s}):l({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:o,vercelLoadTime:performance.now()-v}})})),document.head.appendChild(p)},U.init=async o=>{var e;if(d("=== Init zonos script release date","info",z.releaseDate),L&&!window.isZonosPreview){d(`[ZONOS - loadZonos] Re-inject "loadZonos.js" from zonosQaUrl: ${L}`,"info");const e=document.createElement("script");return e.src=`${L}/dist/scripts/loadZonos.js?timestamp=${Date.now()}`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=!1,window.Zonos.isBigCommerce=z.isBigCommerce,window.Zonos.isLegacyCheckout=z.isLegacyCheckout,window.Zonos.init(o)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${L}`)})),void(window.isZonosPreview=!0)}const n=new URLSearchParams(window.location.search).get("tempCartUUID"),{isDgsCartId:t,isLegacyCartId:r}=S(n);if(n&&!r&&!t)return void z.legacyCheckoutErrorHandler({message:`[ZONOS - loadZonos] invalid &tempCartUUID=${n}`,metadata:{invalidCartId:!0}});z.cartId=n;const s="https://v1.3.137.js.zonos.com",i=document.querySelector('script[src*="/zonos.js"]'),a=null===(e=document.querySelector("script[src*='/loadZonos.js']"))||void 0===e?void 0:e.src;d(`[ZONOS - init] first load script src: ${a}`,"info"),window.Zonos.zonosQaUrl=L,window.Zonos.zonosQaUrlApi=b,window.Zonos.zonosQaUrl&&d(`[ZONOS - init] using zonosQaUrl: ${window.Zonos.zonosQaUrl}`,"info"),window.Zonos.zonosQaUrlApi&&d(`[ZONOS - init] using zonosQaUrlApi: ${window.Zonos.zonosQaUrlApi}`,"info");const c=null==a?void 0:a.includes("timestamp=");if(!(z.isNpm||a&&c))return void g("[ZONOS - loadZonos] A timestamp is required as a query parameter in the loadZonos.js script source. This timestamp ensures that you are loading the most recent version of the script, avoiding any cached versions.");if(i||!a||z.requested)return void d("[ZONOS - loadZonos] script is already loaded or requested","info");if(!o.zonosApiKey&&!z.cartId)return z.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void g("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(z.requested=!0,z.zonosApiKey=o.zonosApiKey,z.storeId=o.storeId,z.cartId){const o=await(async o=>{const{isDgsCartId:e,isLegacyCartId:n}=S(o);if(!n&&!e)return g("[ZONOS - loadZonos] invalid cart id"),null;const t=await O({cartId:o,retries:5});return d("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(g("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(z.cartId);if(!o)throw z.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");z.cartData=o.cartData,z.legacyStoreLogo=o.storeLogo,z.legacyStoreFavicon=o.storeFavicon,z.storeId=o.storeId,z.zonosApiKey=o.zonosApiKey}if(!z.zonosApiKey)return void g('"zonosApiKey" is required to initialize Zonos');const l=await(async()=>{if(!window.location.search.includes("zonosTestMode=1")||!window.Zonos.zonosApiKey)return null;if(d("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return d("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:e}=await w("/api/get-test-public-credential");if(o.length||!e)return g("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const n=e.publicCredential;return n?(d(`[ZONOS - loadZonos] Retrieve new test public token ${n}`,"info"),n):(g("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();if(l&&(d(`[ZONOS - loadZonos] Using test API key: ${l} for test mode`,"info"),z.zonosApiKey=l),!z.storeId)return d("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void z.injectZonos({initConfig:o,vercelUrl:s,version:null});const p=z.storeId||o.storeId;d(`[ZONOS - loadZonos] Store ID: ${p}`,"info");const u=new URLSearchParams;u.set("storeId",p.toString()),window.location.search.includes("_enableStoreVersionPinned=1")&&u.set("_enableStoreVersionPinned","1");const{errors:m,json:f}=await w(`/api/get-store-version?${u.toString()}`);if(m.length||!f)return d("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void z.injectZonos({initConfig:o,vercelUrl:s,version:null});const{isDifferent:y,source:h,version:v}=f;if(d(`[ZONOS - loadZonos] Store version: ${v}, source: ${h}`,"info"),y){d(`[ZONOS - loadZonos] Updating saved store version to ${v}`,"info");const o={storeId:p,version:v};w(`/api/set-store-version?${u.toString()}`,{body:o,method:"POST"}).catch((o=>g("Unable to save store's vesrion",o)))}if(!i){const{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t}=(({loadScriptSrc:o})=>{if(!o)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const e=new URL(o).origin,n=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((o=>e.includes(o))),t=["qa.js.zonos.com"].some((o=>e.includes(o)));return{currentLoadScriptUrl:e,isForceLoadVersionDomain:t,isWhiteListed:n}})({loadScriptSrc:a}),r=t&&!n?e:`${"alpha"===v?"alpha":`v${v}`}.js.zonos.com`,s=t&&!n?null:v;d("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:e,isForceLoadVersionDomain:n,isWhiteListed:t,loadUrl:r,loadVersion:s,version:v}),z.injectZonos({initConfig:o,vercelUrl:r,version:s})}},(void 0===window.Zonos||window.isZonosPreview)&&(window.Zonos=U)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null};function a(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const l=["cloudflare","vercel"],c=l[0],d={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},u=d[c],p=(e=c)=>{const o=l.indexOf(e),t=l[o+1];return t||null},m=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},w=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=m(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},h=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||d[e]||c,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await w({response:n}),response:n,zonosMode:a}}const u=n.status.toString();try{const e=await w({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:a}}},y=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await h({basePathType:i,options:o,path:n}),{errors:c,response:w}=l,f=a(l,["errors","response"]),g=p(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==w?void 0:w.status),b=g&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${u}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=p();if(!o)return;fetch(`${d[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:d[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:g,requestHeaders:null==o?void 0:o.headers,requestPayload:m(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),b?(t(`=== "${n}" failed to fetch, trying next fallback ${g}`),y({basePathType:g,options:o,path:n})):Object.assign({errors:c,response:w},f)},f=async(e,o)=>{const n=a(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),y({basePathType:d||c,options:l,path:e})},g=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.135.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},v="https://js.stripe.com/v3",b=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let z=null;const O=e=>(null!==z||(z=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(S),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${v}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&b.test(t.src))return t}return null})();r&&e?console.warn(S):r||(r=(e=>{const o=document.createElement("script");o.src=`${v}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),z),Z=Promise.resolve().then((()=>O(null)));let j=!1;Z.catch((e=>{j||console.warn(e)}));const C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await f("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),A=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var T;const $=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),N="https://v1.3.135.js.zonos.com",U=$||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.135",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class R{}T=R,R.doneInit=!1,R.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),R.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),R._paypalMockResponse=null,R.isBigCommerce=!1,R.releaseDate="1732640595058",R.isLegacyCheckout=!1,R.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",R.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),R.isNpm=!0,R.zonosQaUrl=null,R.zonosQaUrlApi=null,R.version="v1.3.135",R.modeAlerted=!1,R.cartData=null,R.paypal=null,R.getCurrentTimestamp=()=>(new Date).getTime(),R.zonosController=null,R.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d}=e;if(T.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!T.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${T.version}) ======`),T.zonosApiKey=d,T.storeId=c,T.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=g();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=T.isNpm,window.Zonos.isBigCommerce=T.isBigCommerce,window.Zonos.isLegacyCheckout=T.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!d&&!T.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!T.cartData&&T.cartId){t("Initialize cart data");const e=await A(T.cartId);if(!e)return void n("Failed to get cart data");T.cartData=e.cartData,T.zonosApiKey=e.zonosApiKey}const r=await(async()=>{if(!window.location.search.includes("zonosTestMode=1")||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:e,json:o}=await f("/api/get-test-public-credential");if(e.length||!o)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",e),null;const r=o.publicCredential;return r?(t(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(T.zonosApiKey=r)}if(T.cartId&&T.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),T.injectZonosCdn(),T.injectZonosCss(),T.injectFonts(),T.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),T.doneInit=!0}},R.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},R.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},R.showNotification=e=>{var o;null===(o=T.zonosController)||void 0===o||o.showNotification(e)},R.updateOrganizationName=e=>{var o;null===(o=T.zonosController)||void 0===o||o.updateOrganizationName(e)},R.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},R.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=T.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{j=!0;const o=Date.now();return Z.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),T.zonosController=r,t("Zonos controller injected!")},R.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${T.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&T.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},R.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.135";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.135";case"vercel":return N}};if(T.isNpm){return g()||o()}return o()},R.injectZonosCdn=()=>{T.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),T.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},R.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=T.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${N}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&T.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},R.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(T.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},R.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!D.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=L,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},R.setupGoogleFont=e=>{var o;null===(o=T.zonosController)||void 0===o||o.setupGoogleFont(e)},R.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=R)})();
|
|
1
|
+
(function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),l=[`(${a})`,...r];l.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...l);break;case"info":d.info(t,...l);break;case"error":d.error(t,...l);break;default:d.groupCollapsed(t,...l),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null};function a(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const l=["cloudflare","vercel"],c=l[0],d={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},u=d[c],p=(e=c)=>{const o=l.indexOf(e),t=l[o+1];return t||null},m=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},w=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=m(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},h=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||d[e]||c,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await w({response:n}),response:n,zonosMode:a}}const u=n.status.toString();try{const e=await w({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:u}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${u}: ${"Unknown error"}`,type:u}],json:null,response:null,zonosMode:a}}},y=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await h({basePathType:i,options:o,path:n}),{errors:c,response:w}=l,g=a(l,["errors","response"]),f=p(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==w?void 0:w.status),b=f&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${u}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=p();if(!o)return;fetch(`${d[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:d[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:f,requestHeaders:null==o?void 0:o.headers,requestPayload:m(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==w?void 0:w.status,statusText:null==w?void 0:w.statusText},shouldPostReleaseErrorReporting:!0}),b?(t(`=== "${n}" failed to fetch, trying next fallback ${f}`),y({basePathType:f,options:o,path:n})):Object.assign({errors:c,response:w},g)},g=async(e,o)=>{const n=a(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),d=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),y({basePathType:d||c,options:l,path:e})},f=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.137.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},v="https://js.stripe.com/v3",b=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,S="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let z=null;const O=e=>(null!==z||(z=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(S),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${v}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&b.test(t.src))return t}return null})();r&&e?console.warn(S):r||(r=(e=>{const o=document.createElement("script");o.src=`${v}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),z),Z=Promise.resolve().then((()=>O(null)));let j=!1;Z.catch((e=>{j||console.warn(e)}));const C=async({cartId:e,retries:o})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await g("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),C({cartId:e,retries:o-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),A=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var T;const $=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),N="https://v1.3.137.js.zonos.com",U=$||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.137",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class R{}T=R,R.doneInit=!1,R.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),R.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),R._paypalMockResponse=null,R.isBigCommerce=!1,R.releaseDate="1733521631578",R.isLegacyCheckout=!1,R.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",R.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),R.isNpm=!0,R.zonosQaUrl=null,R.zonosQaUrlApi=null,R.version="v1.3.137",R.modeAlerted=!1,R.cartData=null,R.paypal=null,R.getCurrentTimestamp=()=>(new Date).getTime(),R.zonosController=null,R.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d}=e;if(T.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),T.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${T.version}) ======`),T.zonosApiKey=d,T.storeId=c,T.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=f();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=T.isNpm,window.Zonos.isBigCommerce=T.isBigCommerce,window.Zonos.isLegacyCheckout=T.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!d&&!T.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!T.cartData&&T.cartId){t("Initialize cart data");const e=await A(T.cartId);if(!e)return void n("Failed to get cart data");T.cartData=e.cartData,T.zonosApiKey=e.zonosApiKey}const r=await(async()=>{if(!window.location.search.includes("zonosTestMode=1")||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:e,json:o}=await g("/api/get-test-public-credential");if(e.length||!o)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",e),null;const r=o.publicCredential;return r?(t(`[ZONOS - loadZonos] Retrieve new test public token ${r}`,"info"),r):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(T.zonosApiKey=r)}const u=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(T.cartId&&T.cartData||!!u){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),T.injectZonosCdn(),T.injectZonosCss(),T.injectFonts(),T.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:a,overrideCurrencyFormat:l}}),T.doneInit=!0},R.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},R.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},R.showNotification=e=>{var o;null===(o=T.zonosController)||void 0===o||o.showNotification(e)},R.updateOrganizationName=e=>{var o;null===(o=T.zonosController)||void 0===o||o.updateOrganizationName(e)},R.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},R.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{T.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=T.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{j=!0;const o=Date.now();return Z.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),T.zonosController=r,t("Zonos controller injected!")},R.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${T.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const t=i(e);t&&T.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(l)},R.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.137";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.137";case"vercel":return N}};if(T.isNpm){return f()||o()}return o()},R.injectZonosCdn=()=>{T.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),T.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},R.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=T.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${N}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&T.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},R.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(T.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},R.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!D.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=L,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},R.setupGoogleFont=e=>{var o;null===(o=T.zonosController)||void 0===o||o.setupGoogleFont(e)},R.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=R)})();
|
|
@@ -42,7 +42,7 @@ export declare class ZonosCheckoutFinish {
|
|
|
42
42
|
*/
|
|
43
43
|
private shouldRenderKeepShoppingButton;
|
|
44
44
|
/**
|
|
45
|
-
* Should render close button for redirect behavior when the success behavior is redirecting to a different page
|
|
45
|
+
* Should render close button for redirect behavior when the success behavior is redirecting to a different page or when it's an error screen
|
|
46
46
|
*/
|
|
47
47
|
private shouldRenderCloseButtonForRedirectBehavior;
|
|
48
48
|
private handleSuccessBehavior;
|
|
@@ -30,6 +30,7 @@ export declare class ZonosCheckout {
|
|
|
30
30
|
* Force dialog to be open
|
|
31
31
|
*/
|
|
32
32
|
forceDialogOpen: boolean;
|
|
33
|
+
defaultAddressParams: StripeStoreContactOption | null;
|
|
33
34
|
/**
|
|
34
35
|
* Whether or not the dialog is open
|
|
35
36
|
*/
|
|
@@ -88,6 +89,10 @@ export declare class ZonosCheckout {
|
|
|
88
89
|
* Check if the cart is expired, return `true` if the cart is expired
|
|
89
90
|
*/
|
|
90
91
|
private handleCartExpiredCheck;
|
|
92
|
+
/**
|
|
93
|
+
* Check if stripe payment intent is succeeded or in a good state to move forward
|
|
94
|
+
*/
|
|
95
|
+
private checkStripePaymentIntentStatus;
|
|
91
96
|
private buildCartAndInit;
|
|
92
97
|
private reloadCheckoutSession;
|
|
93
98
|
private handleOrderDuplication;
|
|
@@ -407,6 +407,9 @@ export declare const stringsArabic: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsBase: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsChinese: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsDanish: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsDutch: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsFrench: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsGerman: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsHebrew: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsIndonesian: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsItalian: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsJapanese: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsKorean: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsNorwegian: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsPolish: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsPortuguese: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsRussian: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsSpanish: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsSwedish: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsTurkish: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -407,6 +407,9 @@ export declare const stringsVietnamese: {
|
|
|
407
407
|
'Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us.': {
|
|
408
408
|
value: string;
|
|
409
409
|
};
|
|
410
|
+
'Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction.': {
|
|
411
|
+
value: string;
|
|
412
|
+
};
|
|
410
413
|
'[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy.': {
|
|
411
414
|
value: string;
|
|
412
415
|
};
|
|
@@ -32,4 +32,4 @@ export type ITranslationKey = keyof typeof stringsBase;
|
|
|
32
32
|
* // No variables:
|
|
33
33
|
* translate('Above de minimis threshold for')
|
|
34
34
|
*/
|
|
35
|
-
export declare const translate: <T extends "Shipping" | "Email" | "Name" | "Quantity" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "Payment" | " (Duties due at door)" | " (Duties prepaid)" | "Above de minimis threshold for" | "Add promotional code" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Apply" | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery" | "Delivery options" | "Discounts" | "Don't close" | "Due at delivery" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties and taxes will be charged upon delivery." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Estimated" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Hide non-prepaid options" | "Invalid promo code" | "It looks like you placed an order just a few minutes ago ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?" | "It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?" | "Keep shopping" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at delivery" | "Nothing due at the door" | "OK" | "Order complete!" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Please enter a valid email address." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Proceed with order" | "Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions." | "Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions." | "Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions." | "Product prices already include duties. No additional duties will be added at checkout, with rare exceptions." | "Product prices already include fees. No additional fees will be added at checkout, with rare exceptions." | "Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions." | "Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Return to merchant site" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Shopping cart expired" | "Show" | "Show non-prepaid options" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You are being sent back to the shop to re-add items to your cart." | "You may incur additional fees from the shipping carrier by not prepaying." | "You will be redirected back to the merchant's site in a few seconds." | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "Your order has been successfully placed." | "Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "days" | "restricted items" | "weeks">(...[key, replacement]: TranslateParams<T>) => string;
|
|
35
|
+
export declare const translate: <T extends "Shipping" | "Email" | "Name" | "Quantity" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "Payment" | " (Duties due at door)" | " (Duties prepaid)" | "Above de minimis threshold for" | "Add promotional code" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Apply" | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery" | "Delivery options" | "Discounts" | "Don't close" | "Due at delivery" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties and taxes will be charged upon delivery." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Estimated" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Hide non-prepaid options" | "Invalid promo code" | "It looks like you placed an order just a few minutes ago ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?" | "It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?" | "Keep shopping" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at delivery" | "Nothing due at the door" | "OK" | "Order complete!" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Please enter a valid email address." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Proceed with order" | "Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions." | "Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions." | "Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions." | "Product prices already include duties. No additional duties will be added at checkout, with rare exceptions." | "Product prices already include fees. No additional fees will be added at checkout, with rare exceptions." | "Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions." | "Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Return to merchant site" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Shopping cart expired" | "Show" | "Show non-prepaid options" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You are being sent back to the shop to re-add items to your cart." | "You may incur additional fees from the shipping carrier by not prepaying." | "You will be redirected back to the merchant's site in a few seconds." | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "Your order has been successfully placed." | "Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us." | "Your selected payment method requires additional verification. Please follow the instructions provided by your payment provider to complete the transaction." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "days" | "restricted items" | "weeks">(...[key, replacement]: TranslateParams<T>) => string;
|
|
@@ -100,6 +100,7 @@ export declare const featureAspectKeyEnum: {
|
|
|
100
100
|
readonly NewPayoutReport: "new_payout_report";
|
|
101
101
|
readonly PageAuditor: "page_auditor";
|
|
102
102
|
readonly PromptExplorer: "prompt_explorer";
|
|
103
|
+
readonly RulesUiCreate: "rules_ui_create";
|
|
103
104
|
readonly SupportTicketSystem: "support_ticket_system";
|
|
104
105
|
readonly TeamAuditor: "team_auditor";
|
|
105
106
|
};
|
|
@@ -127,6 +128,7 @@ export declare const featureAudienceNameEnum: {
|
|
|
127
128
|
readonly PrincipalEngineer: "principal_engineer";
|
|
128
129
|
readonly ProServeHead: "pro_serve_head";
|
|
129
130
|
readonly ProductManager: "product_manager";
|
|
131
|
+
readonly RulesUiCreateMerchant: "rules_ui_create_merchant";
|
|
130
132
|
readonly SupportTicketMerchants: "support_ticket_merchants";
|
|
131
133
|
readonly TechLead: "tech_lead";
|
|
132
134
|
};
|
|
@@ -553,28 +555,9 @@ export type FailToGetQuoteErrorsQuery = {
|
|
|
553
555
|
}>;
|
|
554
556
|
};
|
|
555
557
|
};
|
|
556
|
-
export type FailedToGetOrderQuery = {
|
|
557
|
-
error_event_aggregate: {
|
|
558
|
-
aggregate: {
|
|
559
|
-
count: number;
|
|
560
|
-
} | null;
|
|
561
|
-
nodes: Array<{
|
|
562
|
-
allLogs: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
563
|
-
createdAt: string;
|
|
564
|
-
endpoint: string;
|
|
565
|
-
errors: Record<string, unknown> | Record<string, unknown>[];
|
|
566
|
-
id: number;
|
|
567
|
-
metadata: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
568
|
-
publicCredential: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
569
|
-
requestPayload: Record<string, unknown> | Record<string, unknown>[];
|
|
570
|
-
responseBody: Record<string, unknown> | Record<string, unknown>[] | null;
|
|
571
|
-
status: number;
|
|
572
|
-
}>;
|
|
573
|
-
};
|
|
574
|
-
};
|
|
575
558
|
export type LocaleCountryMessagesQuery = {
|
|
576
559
|
locale_countryCodesPage: Array<{
|
|
577
|
-
countryCodes: Array<string
|
|
560
|
+
countryCodes: Array<string> | null;
|
|
578
561
|
countryCodesPageMessageLinks: Array<{
|
|
579
562
|
id: number;
|
|
580
563
|
message: {
|
|
@@ -831,9 +814,6 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
831
814
|
failToGetQuoteErrors(variables?: {
|
|
832
815
|
[x: string]: never;
|
|
833
816
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<FailToGetQuoteErrorsQuery>;
|
|
834
|
-
failedToGetOrder(variables?: {
|
|
835
|
-
[x: string]: never;
|
|
836
|
-
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<FailedToGetOrderQuery>;
|
|
837
817
|
getAudienceByAspectKey(variables?: {
|
|
838
818
|
[x: string]: never;
|
|
839
819
|
}, requestHeaders?: GraphQLClientRequestHeaders): Promise<GetAudienceByAspectKeyQuery>;
|