@zonos/elements 1.3.58 → 1.3.60
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-6c7bf457.js → cart-9318a592.js} +18 -8
- package/dist/cjs/{createCustomEvent-a10ed604.js → createCustomEvent-22ab3823.js} +2 -2
- package/dist/cjs/{getBorderRadius-a6a3b35e.js → getBorderRadius-5a64574c.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{isDarkColor-7a056d05.js → isDarkColor-5efc8367.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-ec9ebaf5.js → paypal-c4c5c59c.js} +3 -3
- package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
- package/dist/cjs/zonos-badge_13.cjs.entry.js +23 -11
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card.cjs.entry.js +2 -2
- package/dist/cjs/zonos-checkout.cjs.entry.js +12 -6
- package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
- package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +5 -5
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-67139f0e.js → zonosStore-a4395972.js} +7 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +17 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +33 -1
- package/dist/collection/components/store/checkout/cart.js +10 -3
- package/dist/collection/components/store/checkout/stripe.js +3 -3
- package/dist/collection/components/store/hello/localization.js +3 -1
- package/dist/collection/components/store/zonosStore.js +7 -4
- package/dist/collection/types/generated/graphql.customer.types.js +27 -5
- package/dist/esm/{cart-a845a902.js → cart-9e089cda.js} +18 -9
- package/dist/esm/{createCustomEvent-0797e187.js → createCustomEvent-a7cec0a2.js} +2 -2
- package/dist/esm/{getBorderRadius-23398fc6.js → getBorderRadius-cff1e39b.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{isDarkColor-c927f77d.js → isDarkColor-b3afa948.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-6d80dfd9.js → paypal-34af4a06.js} +3 -3
- package/dist/esm/zonos-address_8.entry.js +4 -4
- package/dist/esm/zonos-badge_13.entry.js +23 -11
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card.entry.js +2 -2
- package/dist/esm/zonos-checkout.entry.js +12 -6
- package/dist/esm/zonos-controller.entry.js +4 -4
- package/dist/esm/zonos-country-flag.entry.js +4 -4
- package/dist/esm/zonos-country-select_4.entry.js +4 -4
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +4 -4
- package/dist/esm/zonos-hello.entry.js +4 -4
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +4 -4
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +5 -5
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-473f4654.js → zonosStore-0dc7a947.js} +7 -4
- package/dist/esm-es5/{cart-a845a902.js → cart-9e089cda.js} +1 -1
- package/dist/esm-es5/{createCustomEvent-0797e187.js → createCustomEvent-a7cec0a2.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-23398fc6.js → getBorderRadius-cff1e39b.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-c927f77d.js → isDarkColor-b3afa948.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-6d80dfd9.js → paypal-34af4a06.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_13.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.entry.js +1 -1
- package/dist/esm-es5/zonos-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-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-473f4654.js → zonosStore-0dc7a947.js} +1 -1
- package/dist/scripts/index.d.ts +54 -0
- 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.d.ts +5 -0
- package/dist/types/components/store/checkout/cart.d.ts +4 -2
- package/dist/types/components/store/zonosStore.d.ts +5 -1
- package/dist/types/components.d.ts +6 -2
- package/dist/types/types/generated/graphql.customer.types.d.ts +87 -101
- package/dist/types/types/generated/graphql.customer.types.ts +91 -96
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-7ef2737b.system.entry.js → p-04553c97.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9dd6b00d.js → p-1086aac3.js} +1 -1
- package/dist/zonos-elements/{p-1c72e53f.system.entry.js → p-19fc5e11.system.entry.js} +1 -1
- package/dist/zonos-elements/p-1ca5696d.js +1 -0
- package/dist/zonos-elements/p-1dcccfc4.entry.js +1 -0
- package/dist/zonos-elements/{p-d067bb64.system.js → p-1ea34c87.system.js} +2 -2
- package/dist/zonos-elements/{p-d42018fc.entry.js → p-2c81d7c0.entry.js} +1 -1
- package/dist/zonos-elements/{p-556d4ddb.entry.js → p-2cd7b878.entry.js} +1 -1
- package/dist/zonos-elements/{p-40f73fb4.system.entry.js → p-2eeb7fc4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5f7f51bd.entry.js → p-30470eb7.entry.js} +1 -1
- package/dist/zonos-elements/{p-4b205b2f.entry.js → p-3924ca23.entry.js} +1 -1
- package/dist/zonos-elements/{p-a4309beb.entry.js → p-41f42a5c.entry.js} +1 -1
- package/dist/zonos-elements/p-455b7545.system.js +1 -0
- package/dist/zonos-elements/{p-d20f6cf1.js → p-5aeab723.js} +1 -1
- package/dist/zonos-elements/{p-95a18511.entry.js → p-5eb27803.entry.js} +1 -1
- package/dist/zonos-elements/{p-921d3603.entry.js → p-61bf769f.entry.js} +1 -1
- package/dist/zonos-elements/{p-89d8c1ad.system.entry.js → p-698f7fd8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-298df70c.system.entry.js → p-722bcca3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6f87b869.entry.js → p-73e01294.entry.js} +1 -1
- package/dist/zonos-elements/{p-4b59ada6.system.entry.js → p-76faa16f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-cf9a46e8.entry.js → p-7a4fc640.entry.js} +1 -1
- package/dist/zonos-elements/{p-70bb4a25.entry.js → p-7be7bd28.entry.js} +1 -1
- package/dist/zonos-elements/{p-6dcef5ce.entry.js → p-8894c902.entry.js} +1 -1
- package/dist/zonos-elements/p-8d4e78b1.js +1 -0
- package/dist/zonos-elements/{p-0954e8fe.system.entry.js → p-8edfcbf0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-29814fd7.system.js → p-91462d96.system.js} +1 -1
- package/dist/zonos-elements/{p-206cf031.system.js → p-97a99ee5.system.js} +1 -1
- package/dist/zonos-elements/{p-3492c75f.system.entry.js → p-9b951ff8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2fc19941.system.js → p-9b9a4320.system.js} +1 -1
- package/dist/zonos-elements/{p-a3547b34.system.entry.js → p-a033685e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-23a84835.js → p-a1b755bf.js} +1 -1
- package/dist/zonos-elements/p-a3c1c14c.system.entry.js +1 -0
- package/dist/zonos-elements/{p-b65b3e7b.system.entry.js → p-a86d5244.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-324a8c0d.system.entry.js → p-aa8fd7d9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-acae065f.entry.js +1 -0
- package/dist/zonos-elements/{p-35ca4dcc.entry.js → p-b227910d.entry.js} +1 -1
- package/dist/zonos-elements/p-b3ab9695.system.entry.js +1 -0
- package/dist/zonos-elements/{p-8e8defdc.system.js → p-b74ff880.system.js} +1 -1
- package/dist/zonos-elements/{p-f3811c4c.system.entry.js → p-ba05f1d6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4dd2f617.system.entry.js → p-bcb129de.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-ecd6a58a.system.entry.js → p-d56f87ab.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-17ea3429.system.entry.js → p-d5bd2da0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5a59ed7f.system.entry.js → p-de93cc65.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8260b820.system.js → p-e7e0755f.system.js} +1 -1
- package/dist/zonos-elements/p-e9390710.entry.js +1 -0
- package/dist/zonos-elements/{p-54f66cd1.entry.js → p-f3fc05a8.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb3520e7.entry.js → p-f4765417.entry.js} +1 -1
- package/dist/zonos-elements/{p-8e9dcaa3.entry.js → p-fca6f444.entry.js} +1 -1
- package/dist/zonos-elements/{p-9fd3995f.js → p-fe943837.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-15599089.system.entry.js +0 -1
- package/dist/zonos-elements/p-173f8e5b.entry.js +0 -1
- package/dist/zonos-elements/p-35122d9c.system.entry.js +0 -1
- package/dist/zonos-elements/p-472a6c19.js +0 -1
- package/dist/zonos-elements/p-51d82a07.entry.js +0 -1
- package/dist/zonos-elements/p-c043ec95.entry.js +0 -1
- package/dist/zonos-elements/p-e97793ce.system.js +0 -1
- package/dist/zonos-elements/p-f05f3e27.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function e(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]])}return r}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],r=o[0],n={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=n[r],s=(e=r)=>{const n=o.indexOf(e),t=o[n+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=(e,o,...r)=>{var n,t;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...r));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(t=s.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":i.warn(e,...r);break;case"info":i.info(e,...r);break;case"error":i.error(e,...r);break;default:i.groupCollapsed(e,...r),i.trace(),i.groupEnd()}},c=async({endpoint:e,errors:o,metadata:r,shouldPostReleaseErrorReporting:i})=>{if(i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},r)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${n[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},l=async({response:e,shouldLog:o=!0,shouldThrow:r=!1})=>{try{return await e.json()}catch(e){if(r)throw e;return o&&console.error(e),null}},d=async({basePathType:e,options:o,path:t})=>{let s;const i=n[e]||r,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await l({response:s}),response:s,zonosMode:c}}const p=s.status.toString();try{const e=await l({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:p}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},p=async({basePathType:o,options:r,path:t})=>{var l,u;const m=t.startsWith("/api/bigcommerce")?"vercel":o,g=await d({basePathType:m,options:r,path:t}),{errors:w,response:y}=g,h=e(g,["errors","response"]),f=s(m),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==y?void 0:y.status),L=f&&v;return v&&c({endpoint:n[m]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:m,nextFallbackApiType:f,requestHeaders:null==r?void 0:r.headers,requestPayload:i(null===(l=null==r?void 0:r.body)||void 0===l?void 0:l.toString())||(null===(u=null==r?void 0:r.body)||void 0===u?void 0:u.toString()),status:null==y?void 0:y.status,statusText:null==y?void 0:y.statusText},shouldPostReleaseErrorReporting:!0}),L?(a(`=== "${t}" failed to fetch, trying next fallback ${f}`),p({basePathType:f,options:r,path:t})):Object.assign({errors:w,response:y},h)},u=async(o,n)=>{const t=e(n||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return p({basePathType:l||r,options:c,path:o})},m=(e,...o)=>{a(e,"error",...o)},g=["jsdelivr","cdnjs","unpkg","vercel"],w=async e=>{const o=await(async e=>{const{errors:o,json:r}=await u("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||o.length?null:r})(e);return a("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var y;const h=(()=>{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),r="https://v1.3.58.js.zonos.com";if(!o&&(r.includes("test.")||r.includes("test-")))return r;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 n=`https://${o}.preview.js.zonos.com`;return a(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,r=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),n})();class f{static get isNpm(){return!1}}y=f,f.isBigCommerce=!1,f.requested=!1,f.zonosQaUrl=null,f.cartData=null,f.isLegacyCheckout=!1,f.legacyStoreLogo=null,f.legacyStoreFavicon=null,f.parallelLoadTimes=[],f.paralellLoadState="off",f.releaseDate="1727735671239",f.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:r,metadata:n,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!r},n)))}catch(e){}},f.loadScriptLogParallelHandler=async e=>{try{if(y.parallelLoadTimes.push(e),2===y.parallelLoadTimes.length){const e=y.parallelLoadTimes.find((e=>"vercel"===e.type)),o=y.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void c({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});y.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},f.legacyCheckoutErrorHandler=({message:e})=>{m(`[ZONOS - loadZonos] ${e}`),c({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:y.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},f.getGithubCdn=({type:e,version:o})=>{let r="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.58";"cdnjs"===e?r="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.58":"unpkg"===e&&(r="https://unpkg.com/@zonos/elements@1.3.58");return o&&"alpha"!==o?r.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):r},f.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:r,vercelUrl:n,version:t})=>{var s;const i="vercel"===e?n:y.getGithubCdn({type:e,version:t}),l=h||i,d=l.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${d}/dist/scripts/${u}`,a(`[ZONOS - loadZonos] Injecting "${u}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||r})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),f=g[0]===e,v=g[1],L="on"===y.paralellLoadState&&m&&f&&v&&!w;L&&y.injectZonos({cdnType:v,initConfig:o,parallelLoaded:!0,vercelUrl:n,version:t});const S=performance.now();p.addEventListener("load",(()=>{if(L||r?y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}):y.loadScriptLogHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}),y.isBigCommerce||(y.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=h,window.Zonos.isBigCommerce=y.isBigCommerce,y.cartId){if(!y.zonosApiKey)throw y.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!y.cartData)throw y.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(y.legacyStoreFavicon&&y.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=y.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=y.cartData,window.Zonos.isLegacyCheckout=y.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:y.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:y.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:y.isLegacyCheckout?y.cartData.storeBaseUrl:void 0}),zonosApiKey:y.zonosApiKey});o=e}window.Zonos.version&&(a(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${d}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=g.indexOf(e);return g[o+1]||null})(e);if(!L&&!r){if(!s)return;y.injectZonos({cdnType:s,initConfig:o,vercelUrl:n,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||h)return;if(L||r)return void y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,isError:!0,scriptLoadUrl:p.src,storeId:y.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?c({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-S,cdnType:e,loadUrl:l,version:t},shouldPostReleaseErrorReporting:!!s}):c({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-S}})})),document.head.appendChild(p)},f.init=async e=>{var o;y.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const r="https://v1.3.58.js.zonos.com",n=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src,s=null==t?void 0:t.includes("timestamp=");if(!(y.isNpm||t&&s))return void m("[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(n||!t||y.requested)return void a("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!y.cartId)return y.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(y.requested=!0,y.zonosApiKey=e.zonosApiKey,y.storeId=e.storeId,y.cartId){const e=await w(y.cartId);if(!e)throw y.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");y.cartData=e.cartData,y.zonosApiKey=e.zonosApiKey,y.legacyStoreLogo=e.storeLogo,y.legacyStoreFavicon=e.storeFavicon,y.storeId=e.storeId,y.zonosApiKey=e.zonosApiKey}if(!y.zonosApiKey)return void m('"zonosApiKey" is required to initialize Zonos');if(!y.storeId)return a("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const i=new URLSearchParams;i.set("storeId",e.storeId.toString());const c=`/api/get-store-version?${i.toString()}`,{errors:l,json:d}=await u(c);if(l.length||!d)return a("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const{version:p}=d;if(!n){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,r=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}})({loadScriptSrc:t}),s=n&&!r?o:`${"alpha"===p?"alpha":`v${p}`}.js.zonos.com`,i=n&&!r?null:p;a("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:s,loadVersion:i,version:p}),y.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=f)})();
|
|
1
|
+
(function(){"use strict";function e(e,o){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(n=Object.getOwnPropertySymbols(e);t<n.length;t++)o.indexOf(n[t])<0&&Object.prototype.propertyIsEnumerable.call(e,n[t])&&(r[n[t]]=e[n[t]])}return r}"function"==typeof SuppressedError&&SuppressedError;const o=["cloudflare","vercel"],r=o[0],n={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},t=n[r],s=(e=r)=>{const n=o.indexOf(e),t=o[n+1];return t||null},i=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},a=(e,o,...r)=>{var n,t;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===o&&console.error(e,...r));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(t=s.contentWindow)||void 0===t?void 0:t.window.console)||window.console;switch(o){case"warn":i.warn(e,...r);break;case"info":i.info(e,...r);break;case"error":i.error(e,...r);break;default:i.groupCollapsed(e,...r),i.trace(),i.groupEnd()}},c=async({endpoint:e,errors:o,metadata:r,shouldPostReleaseErrorReporting:i})=>{if(i){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const a="userAgentData"in window.navigator?window.navigator.userAgentData:null,c={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:a&&a.brands.length>0?a:window.navigator.userAgent},r)};try{fetch(`${t}/api/zonos-elements/log-error`,{body:JSON.stringify(c),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=s();if(!o)return;fetch(`${n[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(c),method:"POST"})}},l=async({response:e,shouldLog:o=!0,shouldThrow:r=!1})=>{try{return await e.json()}catch(e){if(r)throw e;return o&&console.error(e),null}},d=async({basePathType:e,options:o,path:t})=>{let s;const i=n[e]||r,a=new URL(i+t);a.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{s=await fetch(a.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:i,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:i,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const c=s.headers.get("Zonos-Mode"),d=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&c&&d&&(window.Zonos.modeAlerted=!0),s.ok){return{baseUrl:i,errors:[],json:await l({response:s}),response:s,zonosMode:c}}const p=s.status.toString();try{const e=await l({response:s,shouldThrow:!0});return{baseUrl:i,errors:[{message:JSON.stringify(e),type:p}],json:null,response:s,zonosMode:c}}catch(e){return{baseUrl:i,errors:[{message:`${p}: ${"Unknown error"}`,type:p}],json:null,response:null,zonosMode:c}}},p=async({basePathType:o,options:r,path:t})=>{var l,u;const m=t.startsWith("/api/bigcommerce")?"vercel":o,g=await d({basePathType:m,options:r,path:t}),{errors:w,response:y}=g,h=e(g,["errors","response"]),f=s(m),v=!!w.find((({type:e})=>"unknown"===e))||404===(null==y?void 0:y.status),L=f&&v;return v&&c({endpoint:n[m]+t,errors:w.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:m,nextFallbackApiType:f,requestHeaders:null==r?void 0:r.headers,requestPayload:i(null===(l=null==r?void 0:r.body)||void 0===l?void 0:l.toString())||(null===(u=null==r?void 0:r.body)||void 0===u?void 0:u.toString()),status:null==y?void 0:y.status,statusText:null==y?void 0:y.statusText},shouldPostReleaseErrorReporting:!0}),L?(a(`=== "${t}" failed to fetch, trying next fallback ${f}`),p({basePathType:f,options:r,path:t})):Object.assign({errors:w,response:y},h)},u=async(o,n)=>{const t=e(n||{},[]),s=t.body?JSON.stringify(t.body):void 0,i=t.method||"GET",a=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},t.headers),c=Object.assign(Object.assign({},t),{body:"GET"===i?void 0:s,headers:a,method:i}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return p({basePathType:l||r,options:c,path:o})},m=(e,...o)=>{a(e,"error",...o)},g=["jsdelivr","cdnjs","unpkg","vercel"],w=async e=>{const o=await(async e=>{const{errors:o,json:r}=await u("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||o.length?null:r})(e);return a("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var y;const h=(()=>{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),r="https://v1.3.60.js.zonos.com";if(!o&&(r.includes("test.")||r.includes("test-")))return r;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 n=`https://${o}.preview.js.zonos.com`;return a(`[ZONOS-WARNING] using '${n}' for loading script`,"warn"),fetch(n).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${n}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,r=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",r),window.location.reload(),null})),n})();class f{static get isNpm(){return!1}}y=f,f.isBigCommerce=!1,f.requested=!1,f.zonosQaUrl=null,f.cartData=null,f.isLegacyCheckout=!1,f.legacyStoreLogo=null,f.legacyStoreFavicon=null,f.parallelLoadTimes=[],f.paralellLoadState="off",f.releaseDate="1727800216541",f.loadScriptLogHandler=async({cdnLoadTime:e,fallbackLoadTime:o,isError:r,metadata:n,scriptLoadUrl:t,storeId:s,type:i})=>{try{const e=window.performance.getEntriesByType("resource").find((e=>{const o=e;return o.name.includes(t)&&"script"===o.initiatorType}));null==e||e.transferSize;(async e=>{})((e&&(null==e?void 0:e.duration)>0?parseFloat(e.duration.toFixed(2)):parseFloat(o.toFixed(2)),Object.assign({decodedBodySize:null==e?void 0:e.decodedBodySize,encodedBodySize:null==e?void 0:e.encodedBodySize,fallbackLoadTime:o,isError:!!r},n)))}catch(e){}},f.loadScriptLogParallelHandler=async e=>{try{if(y.parallelLoadTimes.push(e),2===y.parallelLoadTimes.length){const e=y.parallelLoadTimes.find((e=>"vercel"===e.type)),o=y.parallelLoadTimes.find((e=>"jsdelivr"===e.type));if(!e||!o)return;if(e.isError&&o.isError)return void c({endpoint:`<${e.scriptLoadUrl}> <${o.scriptLoadUrl}>`,errors:["Failed to fetch both Vercel and jsdelivr CDN. Perhaps network issue on customer site."],metadata:{cdnLoadTime:o.fallbackLoadTime,cdnType:o.type,vercelLoadTime:e.fallbackLoadTime}});y.loadScriptLogHandler({cdnLoadTime:o.fallbackLoadTime,fallbackLoadTime:e.fallbackLoadTime,isError:e.isError,metadata:{cdnScriptFallbackTime:o.fallbackLoadTime,cdnScriptIsError:!!o.isError,cdnScriptLoadUrl:o.scriptLoadUrl,cdnScriptType:o.type},scriptLoadUrl:e.scriptLoadUrl,storeId:e.storeId,type:e.type})}}catch(e){}},f.legacyCheckoutErrorHandler=({message:e})=>{m(`[ZONOS - loadZonos] ${e}`),c({endpoint:"LegacyCheckoutInit",errors:[e],metadata:{tempCartUUID:y.cartId}}),document.dispatchEvent(new CustomEvent("legacyCheckoutError",{detail:e}))},f.getGithubCdn=({type:e,version:o})=>{let r="https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.60";"cdnjs"===e?r="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.60":"unpkg"===e&&(r="https://unpkg.com/@zonos/elements@1.3.60");return o&&"alpha"!==o?r.replace(/@zonos\/elements@(.+)/,`@zonos/elements@${o}`).replace(/\/zonos-elements\/(.+)/,`/zonos-elements/${o}`):r},f.injectZonos=({cdnType:e="jsdelivr",initConfig:o,parallelLoaded:r,vercelUrl:n,version:t})=>{var s;const i="vercel"===e?n:y.getGithubCdn({type:e,version:t}),l=h||i,d=l.replace("https://","").replace("http://",""),p=document.createElement("script"),u=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";p.src=`https://${d}/dist/scripts/${u}`,a(`[ZONOS - loadZonos] Injecting "${u}" from "${d}"`,"info");const m="4g"===(null===(s=(()=>{const e="connection"in window.navigator?window.navigator.connection:null,o="mozConnection"in window.navigator?window.navigator.mozConnection:null,r="webkitConnection"in window.navigator?window.navigator.webkitConnection:null;return e||o||r})())||void 0===s?void 0:s.effectiveType),w=["dev.elements.zonos.com","zonos.com"].some((e=>window.location.href.includes(e))),f=g[0]===e,v=g[1],L="on"===y.paralellLoadState&&m&&f&&v&&!w;L&&y.injectZonos({cdnType:v,initConfig:o,parallelLoaded:!0,vercelUrl:n,version:t});const S=performance.now();p.addEventListener("load",(()=>{if(L||r?y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}):y.loadScriptLogHandler({fallbackLoadTime:performance.now()-S,scriptLoadUrl:p.src,storeId:y.storeId,type:e}),y.isBigCommerce||(y.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.isNpm=!1,window.Zonos.zonosQaUrl=h,window.Zonos.isBigCommerce=y.isBigCommerce,y.cartId){if(!y.zonosApiKey)throw y.legacyCheckoutErrorHandler({message:"zonosApiKey is missing to initiate checkout"}),new Error("zonosApiKey is required for legacy checkout");if(!y.cartData)throw y.legacyCheckoutErrorHandler({message:"cartData is missing to initiate legacy checkout"}),new Error("cartData is required for legacy checkout");if(y.legacyStoreFavicon&&y.isLegacyCheckout){const e=document.createElement("link");e.rel="shortcut icon",e.type="image/x-icon",e.href=y.legacyStoreFavicon,document.head.appendChild(e)}window.Zonos.cartData=y.cartData,window.Zonos.isLegacyCheckout=y.isLegacyCheckout;const e=Object.assign(Object.assign({},o),{appearance:Object.assign(Object.assign({},o.appearance),{logoUrl:y.legacyStoreLogo||""}),checkoutSettings:Object.assign(Object.assign({},o.checkoutSettings),{successBehavior:y.isLegacyCheckout?"ZONOS_SUCCESS_PAGE":void 0,successRedirectUrl:y.isLegacyCheckout?y.cartData.storeBaseUrl:void 0}),zonosApiKey:y.zonosApiKey});o=e}window.Zonos.version&&(a(`[ZONOS - loadZonos] Execute "Zonos.init" from "${u}" from "${d}"`,"info"),window.Zonos.init(o))})),p.addEventListener("error",(async()=>{const s=(e=>{const o=g.indexOf(e);return g[o+1]||null})(e);if(!L&&!r){if(!s)return;y.injectZonos({cdnType:s,initConfig:o,vercelUrl:n,version:t})}if(["localhost",".zonos.com"].some((e=>window.location.href.includes(e)))||h)return;if(L||r)return void y.loadScriptLogParallelHandler({fallbackLoadTime:performance.now()-S,isError:!0,scriptLoadUrl:p.src,storeId:y.storeId,type:e});["unpkg","cdnjs","vercel"].includes(e)?c({endpoint:p.src,errors:[`zonos.js - Failed to fetch ${e} CDN.`],metadata:{cdnLoadTime:performance.now()-S,cdnType:e,loadUrl:l,version:t},shouldPostReleaseErrorReporting:!!s}):c({endpoint:p.src,errors:["[Info] Using alternative CDN. Failed to fetch script"],metadata:{cdnType:e,vercelLoadTime:performance.now()-S}})})),document.head.appendChild(p)},f.init=async e=>{var o;y.cartId=new URLSearchParams(window.location.search).get("tempCartUUID");const r="https://v1.3.60.js.zonos.com",n=document.querySelector('script[src*="/zonos.js"]'),t=null===(o=document.querySelector("script[src*='/loadZonos.js']"))||void 0===o?void 0:o.src,s=null==t?void 0:t.includes("timestamp=");if(!(y.isNpm||t&&s))return void m("[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(n||!t||y.requested)return void a("[ZONOS - loadZonos] script is already loaded or requested","info");if(!e.zonosApiKey&&!y.cartId)return y.legacyCheckoutErrorHandler({message:"Zonos API key is required unless `tempCartUUID` is provided in url query params."}),void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(y.requested=!0,y.zonosApiKey=e.zonosApiKey,y.storeId=e.storeId,y.cartId){const e=await w(y.cartId);if(!e)throw y.legacyCheckoutErrorHandler({message:"Error getting cart data"}),new Error("Error getting cart data");y.cartData=e.cartData,y.zonosApiKey=e.zonosApiKey,y.legacyStoreLogo=e.storeLogo,y.legacyStoreFavicon=e.storeFavicon,y.storeId=e.storeId,y.zonosApiKey=e.zonosApiKey}if(!y.zonosApiKey)return void m('"zonosApiKey" is required to initialize Zonos');if(!y.storeId)return a("[ZONOS - loadZonos] loading latest script since storeId is not provided."),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const i=new URLSearchParams;i.set("storeId",e.storeId.toString());const c=`/api/get-store-version?${i.toString()}`,{errors:l,json:d}=await u(c);if(l.length||!d)return a("[ZONOS - loadZonos] Error getting store version, loading the latest version.","error"),void y.injectZonos({initConfig:e,vercelUrl:r,version:null});const{version:p}=d;if(!n){const{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,r=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:r}})({loadScriptSrc:t}),s=n&&!r?o:`${"alpha"===p?"alpha":`v${p}`}.js.zonos.com`,i=n&&!r?null:p;a("[ZONOS - loadZonos] injecting zonos script","info",{currentLoadScriptUrl:o,isForceLoadVersionDomain:r,isWhiteListed:n,loadUrl:s,loadVersion:i,version:p}),y.injectZonos({initConfig:e,vercelUrl:s,version:i})}},void 0===window.Zonos&&(window.Zonos=f)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.58.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 e(`[ZONOS-WARNING] using '${r}' for loading script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=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"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.58.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.58",A="https://rsms.me",Z="https://fonts.googleapis.com",U=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1727735671239",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.58",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.58";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.58";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!U.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${Z}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=Z,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=T)})();
|
|
1
|
+
(function(){"use strict";const e=(e,t,...o)=>{var n,r;if(!(!!(null===(n=window.Zonos)||void 0===n?void 0:n.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===t&&console.error(e,...o));let s=document.querySelector("iframe#zonos---debug-logging-iframe");s||(s=document.createElement("iframe"),s.id="zonos---debug-logging-iframe",s.style.display="none",s.style.opacity="0",s.style.position="absolute",s.style.top="-9999px",s.style.left="-9999px",s.style.width="1px",s.style.height="1px",s.style.border="none",s.style.overflow="hidden",s.style.visibility="hidden",document.body.appendChild(s));const i=(null===(r=s.contentWindow)||void 0===r?void 0:r.window.console)||window.console;switch(t){case"warn":i.warn(e,...o);break;case"info":i.info(e,...o);break;case"error":i.error(e,...o);break;default:i.groupCollapsed(e,...o),i.trace(),i.groupEnd()}},t=(t,...o)=>{e(t,"error",...o)},o=["jsdelivr","cdnjs","unpkg","vercel"],n="jsdelivr",r=e=>{const t=o.indexOf(e);return o[t+1]||null},s=()=>{const t=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||t)return null;const o=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.60.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 e(`[ZONOS-WARNING] using '${r}' for loading script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},i="https://js.stripe.com/v3",l=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,a="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let c=null;const d=e=>(null!==c||(c=new Promise(((o,n)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${i}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&l.test(o.src))return o}return null})();r&&e?console.warn(a):r||(r=(e=>{const o=document.createElement("script");o.src=`${i}`;const n=document.head||document.body;return n?(n.appendChild(o),o):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):n(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else o(null)}))),c),u=Promise.resolve().then((()=>d(null)));let p=!1;u.catch((e=>{p||console.warn(e)}));function m(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const h=["cloudflare","vercel"],y=h[0],w={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},g=w[y],f=(e=y)=>{const t=h.indexOf(e),o=h[t+1];return o||null},v=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},b=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},S=async({basePathType:e,options:t,path:o})=>{let n;const r=w[e]||y,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await b({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await b({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},z=async({basePathType:t,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":t,l=await S({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=m(l,["errors","response"]),u=f(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),h=u&&p;return p&&(async({endpoint:e,errors:t,metadata:o,shouldPostReleaseErrorReporting:n})=>{if(n){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const r="userAgentData"in window.navigator?window.navigator.userAgentData:null,s={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:r&&r.brands.length>0?r:window.navigator.userAgent},o)};try{fetch(`${g}/api/zonos-elements/log-error`,{body:JSON.stringify(s),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=f();if(!t)return;fetch(`${w[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(s),method:"POST"})}})({endpoint:w[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:v(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),h?(e(`=== "${n}" failed to fetch, trying next fallback ${u}`),z({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},j=async e=>{const{errors:t,json:o}=await(async(e,t)=>{const o=m(t||{},[]),n=o.body?JSON.stringify(o.body):void 0,r=o.method||"GET",s=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"},o.headers),i=Object.assign(Object.assign({},o),{body:"GET"===r?void 0:n,headers:s,method:r}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return z({basePathType:l||y,options:i,path:e})})("/api/zonos-elements/get-temp-cart",{body:{tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!o||t.length?null:o};var O;const C=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),k="https://v1.3.60.js.zonos.com",E=C||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.60",A="https://rsms.me",Z="https://fonts.googleapis.com",U=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class T{}O=T,T.doneInit=!1,T.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),T.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),T._paypalMockResponse=null,T.isBigCommerce=!1,T.releaseDate="1727800216541",T.isLegacyCheckout=!1,T.isNpm=!0,T.zonosQaUrl=null,T.version="v1.3.60",T.modeAlerted=!1,T.cartData=null,T.paypal=null,T.getCurrentTimestamp=()=>(new Date).getTime(),T.zonosController=null,T.init=async({appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(O.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!O.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${O.version}) ======`),O.zonosApiKey=c,O.storeId=a,O.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!c&&!O.cartId)return void t("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!O.cartData&&O.cartId){e("Initialize cart data");const o=await(async o=>{const n=await j(o);return e("[ZONOS - loadZonos] getting temp cart data","info",n),n?{cartData:n.cartData,storeFavicon:n.storeFaviconUrl,storeId:n.cartData.storeId,storeLogo:n.storeLogoUrl,zonosApiKey:n.cartData.credentialToken}:(t("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(O.cartId);if(!o)return void t("Failed to get cart data");O.cartData=o.cartData,O.zonosApiKey=o.zonosApiKey}}if(O.cartId&&O.cartData){e("Cart data is available, inject hidden button and trigger checkout");const t=document.createElement("button");t.style.display="none",t.id="zonos--checkout-hidden-button",document.body.appendChild(t)}e("init zonos"),O.injectZonosCdn(),O.injectZonosCss(),O.injectFonts(),O.injectController({config:{appearance:o,checkoutSettings:n,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),O.doneInit=!0}},T.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},T.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},T.showNotification=e=>{var t;null===(t=O.zonosController)||void 0===t||t.showNotification(e)},T.updateOrganizationName=e=>{var t;null===(t=O.zonosController)||void 0===t||t.updateOrganizationName(e)},T.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},T.injectController=({config:o})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=o.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const e=o.checkoutSettings.placeOrderButtonSelector;O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{O.disablePlaceOrderButtons({config:o,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=o,r.zonosApiKey=O.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async o=>{const{detail:n}=o;e("loading Stripe");const s=await(async(...e)=>{p=!0;const t=Date.now();return u.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(n.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),O.zonosController=r,e("Zonos controller injected!")},T.injectScript=({cdnType:o,isModule:n,theRestUrl:s})=>{const i=`${O.getZonosUrl(o)}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");n?a.type="module":a.noModule=!0,a.src=i,a.crossOrigin="anonymous",a.onerror=()=>{t(`Failed to load ${a.src}`);const e=r(o);e&&O.injectScript({cdnType:e,isModule:n,theRestUrl:s})},l.appendChild(a)},T.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return E;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.60";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.60";case"vercel":return k}};if(O.isNpm){return s()||t()}return t()},T.injectZonosCdn=()=>{O.injectScript({cdnType:n,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),O.injectScript({cdnType:n,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},T.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const n=O.getZonosUrl(e),s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${k}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${n}/${o}`,l.onerror=()=>{t(`Failed to load ${l.href}`);const n=r(e);n&&O.injectStylesheet({cdnType:n,theRestUrl:o})},s.appendChild(l)},T.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(O.injectStylesheet({cdnType:n,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},T.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${A}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!U.test(o.href))return o}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=A,t.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${A}/inter/inter.css`,t.appendChild(n),e("Zonos font injected!")},T.setupGoogleFont=e=>{var t;null===(t=O.zonosController)||void 0===t||t.setupGoogleFont(e)},T.injectSupportGoogleFont=t=>{var o;e(`[FONT] injecting ${t}`);const n=null===(o=t.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${Z}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=Z,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=T)})();
|
|
@@ -2,6 +2,7 @@ import type { PaymentIntent, Stripe } from '@stripe/stripe-js';
|
|
|
2
2
|
import { type CartItem } from "../../store/checkout/cart";
|
|
3
3
|
import { type StripeStoreContactOption } from "../../store/checkout/stripe";
|
|
4
4
|
import { type AppearanceConfig } from "../../store/zonosStore";
|
|
5
|
+
import type { CheckoutSessionDetailsFragment } from "../../../types/generated/graphql.customer.types";
|
|
5
6
|
export declare class ZonosCheckout {
|
|
6
7
|
/**
|
|
7
8
|
* Listener for locale change in localization store
|
|
@@ -88,6 +89,10 @@ export declare class ZonosCheckout {
|
|
|
88
89
|
* For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
|
|
89
90
|
*/
|
|
90
91
|
setToFinishStep(forcePaymentStatus?: PaymentIntent['status']): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* For usage in storybook for a mocked flow.
|
|
94
|
+
*/
|
|
95
|
+
mockCheckoutSession(session: CheckoutSessionDetailsFragment): Promise<void>;
|
|
91
96
|
private handleCustomerInfoContinue;
|
|
92
97
|
private handleShippingContinue;
|
|
93
98
|
private handleInventoryCheckDialogCancel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { stripeStoreUpdateCheckoutSession } from "./stripe";
|
|
3
|
-
import type { CalculateLandedCostMutation, CartQuery, CheckoutPresentmentFragment, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure, LandedCostFragment, ShipmentRatingFragment } from "../../../types/generated/graphql.customer.types";
|
|
3
|
+
import type { CalculateLandedCostMutation, CartQuery, CheckoutPresentmentFragment, CheckoutSessionDetailsFragment, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure, LandedCostFragment, ShipmentRatingFragment } from "../../../types/generated/graphql.customer.types";
|
|
4
4
|
type Step = 'customer-info' | 'shipping' | 'payment' | 'finish' | 'error';
|
|
5
5
|
export type TabItem = {
|
|
6
6
|
index: number;
|
|
@@ -57,6 +57,7 @@ type CartStore = {
|
|
|
57
57
|
* Adjustments from cart
|
|
58
58
|
*/
|
|
59
59
|
adjustments: CartAdjustment[];
|
|
60
|
+
checkoutSession: CheckoutSessionDetailsFragment | null;
|
|
60
61
|
checkoutSessionId: string | null;
|
|
61
62
|
/**
|
|
62
63
|
* Checkout session timeout
|
|
@@ -159,6 +160,7 @@ type CartStoreRecalculateTotalParams = Omit<Parameters<typeof stripeStoreUpdateC
|
|
|
159
160
|
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
160
161
|
*/
|
|
161
162
|
declare const cartStoreHasOneEligibleItem: () => boolean;
|
|
163
|
+
declare const cartStoreSetCheckoutSession: (checkoutSession: CheckoutSessionDetailsFragment) => void;
|
|
162
164
|
declare const cartStoreReCalculateTotal: ({ adjustmentAmount, cartId, currency, itemsAmount, landedCostId, }: CartStoreRecalculateTotalParams) => Promise<boolean>;
|
|
163
165
|
declare const cartStoreUpdateSelectedShippingOption: (selectedShippingOption: ShipmentRatingFragment) => Promise<boolean>;
|
|
164
166
|
declare const cartStoreStartCheckoutInterval: ({ isPreview, sessionTimeout, }: {
|
|
@@ -176,4 +178,4 @@ declare const cartStoreUpdateItems: ({ adjustments, cartItems, }: {
|
|
|
176
178
|
}) => Promise<void>;
|
|
177
179
|
declare const cartStoreNextStep: () => void;
|
|
178
180
|
declare const cartStoreResetTabItems: () => void;
|
|
179
|
-
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateToErrorState, };
|
|
181
|
+
export { cartStore, cartStoreApplySubtotals, cartStoreCheckItemRestrictions, cartStoreClearCheckoutInterval, cartStoreGetShippingTransitInfo, cartStoreHasOneEligibleItem, cartStoreNextStep, cartStoreReCalculateTotal, cartStoreReset, cartStoreResetCartItems, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateSelectedShippingOption, cartStoreUpdateToErrorState, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CurrencyConverter, LoadZonosParamsConfig } from "../../scripts/_zonosBase";
|
|
2
2
|
import type { CheckoutConfig } from "../../types/checkout/CheckoutConfig";
|
|
3
|
-
import type { ElementsUiStyle, ElementsUiTheme, ZonosAttribution, ZonosSettingsQuery } from "../../types/generated/graphql.customer.types";
|
|
3
|
+
import type { CountryCode, ElementsUiStyle, ElementsUiTheme, ZonosAttribution, ZonosSettingsQuery } from "../../types/generated/graphql.customer.types";
|
|
4
4
|
import type { HelloConfig } from "../../types/hello/HelloConfig";
|
|
5
5
|
export type AppearanceConfig = {
|
|
6
6
|
colorPrimary?: string;
|
|
@@ -17,6 +17,10 @@ export type ZonosConfig = {
|
|
|
17
17
|
checkoutSettings: CheckoutConfig;
|
|
18
18
|
currencyConverter?: CurrencyConverter;
|
|
19
19
|
currentHelloPage: Page | '';
|
|
20
|
+
/**
|
|
21
|
+
* List of countries that are disabled in the checkout, will also be disabled for hello
|
|
22
|
+
*/
|
|
23
|
+
disabledCountries: CountryCode[];
|
|
20
24
|
helloSettings: HelloConfig;
|
|
21
25
|
/**
|
|
22
26
|
* Callback to be called when the country is changed
|
|
@@ -10,7 +10,7 @@ import { EnteredInfo, TranslatedAddressObject } from "./types/checkout/Translate
|
|
|
10
10
|
import { SubmitEventData } from "./components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog";
|
|
11
11
|
import { CheckboxColorPrefix, Color, ColorPrefix } from "./types/styles/Color";
|
|
12
12
|
import { BannerIntent } from "./components/common/zonos-banner/zonos-banner";
|
|
13
|
-
import { CountryCode, ElementsUiStyle, ElementsUiTheme, HelloMobileLocation } from "./types/generated/graphql.customer.types";
|
|
13
|
+
import { CheckoutSessionDetailsFragment, CountryCode, ElementsUiStyle, ElementsUiTheme, HelloMobileLocation } from "./types/generated/graphql.customer.types";
|
|
14
14
|
import { Color as Color1 } from "./types/index";
|
|
15
15
|
import { FontWeight, Size, Type } from "./types/styles/Text";
|
|
16
16
|
import { AppearanceConfig } from "./components/store/zonosStore";
|
|
@@ -30,7 +30,7 @@ export { EnteredInfo, TranslatedAddressObject } from "./types/checkout/Translate
|
|
|
30
30
|
export { SubmitEventData } from "./components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog";
|
|
31
31
|
export { CheckboxColorPrefix, Color, ColorPrefix } from "./types/styles/Color";
|
|
32
32
|
export { BannerIntent } from "./components/common/zonos-banner/zonos-banner";
|
|
33
|
-
export { CountryCode, ElementsUiStyle, ElementsUiTheme, HelloMobileLocation } from "./types/generated/graphql.customer.types";
|
|
33
|
+
export { CheckoutSessionDetailsFragment, CountryCode, ElementsUiStyle, ElementsUiTheme, HelloMobileLocation } from "./types/generated/graphql.customer.types";
|
|
34
34
|
export { Color as Color1 } from "./types/index";
|
|
35
35
|
export { FontWeight, Size, Type } from "./types/styles/Text";
|
|
36
36
|
export { AppearanceConfig } from "./components/store/zonosStore";
|
|
@@ -350,6 +350,10 @@ export namespace Components {
|
|
|
350
350
|
* Flag to determine if the checkout is on mobile
|
|
351
351
|
*/
|
|
352
352
|
"mobile": boolean;
|
|
353
|
+
/**
|
|
354
|
+
* For usage in storybook for a mocked flow.
|
|
355
|
+
*/
|
|
356
|
+
"mockCheckoutSession": (session: CheckoutSessionDetailsFragment) => Promise<void>;
|
|
353
357
|
/**
|
|
354
358
|
* Preview checkout without needing to click on the button. This would be useful for demo purpose
|
|
355
359
|
*/
|
|
@@ -135,6 +135,22 @@ export declare const analyticsProviderType: {
|
|
|
135
135
|
readonly GoogleAnalytics: "GOOGLE_ANALYTICS";
|
|
136
136
|
};
|
|
137
137
|
export type AnalyticsProviderType = (typeof analyticsProviderType)[keyof typeof analyticsProviderType];
|
|
138
|
+
export declare const apiUsageRecordStatus: {
|
|
139
|
+
readonly Failed: "FAILED";
|
|
140
|
+
readonly ManualIntervention: "MANUAL_INTERVENTION";
|
|
141
|
+
readonly Pending: "PENDING";
|
|
142
|
+
readonly Processed: "PROCESSED";
|
|
143
|
+
};
|
|
144
|
+
export type ApiUsageRecordStatus = (typeof apiUsageRecordStatus)[keyof typeof apiUsageRecordStatus];
|
|
145
|
+
export declare const apiUsageRecordType: {
|
|
146
|
+
readonly Classify: "CLASSIFY";
|
|
147
|
+
readonly DeniedParty: "DENIED_PARTY";
|
|
148
|
+
readonly LandedCost: "LANDED_COST";
|
|
149
|
+
readonly OrderComplete: "ORDER_COMPLETE";
|
|
150
|
+
readonly RestrictedItem: "RESTRICTED_ITEM";
|
|
151
|
+
readonly ShipmentRating: "SHIPMENT_RATING";
|
|
152
|
+
};
|
|
153
|
+
export type ApiUsageRecordType = (typeof apiUsageRecordType)[keyof typeof apiUsageRecordType];
|
|
138
154
|
export declare const bankAccountType: {
|
|
139
155
|
readonly Checking: "CHECKING";
|
|
140
156
|
readonly Savings: "SAVINGS";
|
|
@@ -432,6 +448,11 @@ export declare const classificationRequestField: {
|
|
|
432
448
|
readonly Name: "NAME";
|
|
433
449
|
};
|
|
434
450
|
export type ClassificationRequestField = (typeof classificationRequestField)[keyof typeof classificationRequestField];
|
|
451
|
+
export declare const classifyMissingHsCodesStatus: {
|
|
452
|
+
readonly Disabled: "DISABLED";
|
|
453
|
+
readonly Enabled: "ENABLED";
|
|
454
|
+
};
|
|
455
|
+
export type ClassifyMissingHsCodesStatus = (typeof classifyMissingHsCodesStatus)[keyof typeof classifyMissingHsCodesStatus];
|
|
435
456
|
export declare const clearanceType: {
|
|
436
457
|
readonly Commercial: "COMMERCIAL";
|
|
437
458
|
readonly Postal: "POSTAL";
|
|
@@ -1178,8 +1199,16 @@ export declare const currencySymbolLocation: {
|
|
|
1178
1199
|
readonly Before: "BEFORE";
|
|
1179
1200
|
};
|
|
1180
1201
|
export type CurrencySymbolLocation = (typeof currencySymbolLocation)[keyof typeof currencySymbolLocation];
|
|
1202
|
+
export declare const customsDocumentCarrier: {
|
|
1203
|
+
readonly Dhl: "DHL";
|
|
1204
|
+
readonly Fedex: "FEDEX";
|
|
1205
|
+
readonly Ups: "UPS";
|
|
1206
|
+
};
|
|
1207
|
+
export type CustomsDocumentCarrier = (typeof customsDocumentCarrier)[keyof typeof customsDocumentCarrier];
|
|
1181
1208
|
export declare const customsDocumentFileType: {
|
|
1209
|
+
readonly Jpg: "JPG";
|
|
1182
1210
|
readonly Pdf: "PDF";
|
|
1211
|
+
readonly Png: "PNG";
|
|
1183
1212
|
readonly Txt: "TXT";
|
|
1184
1213
|
};
|
|
1185
1214
|
export type CustomsDocumentFileType = (typeof customsDocumentFileType)[keyof typeof customsDocumentFileType];
|
|
@@ -1320,12 +1349,6 @@ export declare const elementsUiTheme: {
|
|
|
1320
1349
|
readonly System: "SYSTEM";
|
|
1321
1350
|
};
|
|
1322
1351
|
export type ElementsUiTheme = (typeof elementsUiTheme)[keyof typeof elementsUiTheme];
|
|
1323
|
-
export declare const emailSenderStatus: {
|
|
1324
|
-
readonly NotVerified: "NOT_VERIFIED";
|
|
1325
|
-
readonly Pending: "PENDING";
|
|
1326
|
-
readonly Verified: "VERIFIED";
|
|
1327
|
-
};
|
|
1328
|
-
export type EmailSenderStatus = (typeof emailSenderStatus)[keyof typeof emailSenderStatus];
|
|
1329
1352
|
export declare const emailTemplateProviderType: {
|
|
1330
1353
|
readonly Sendgrid: "SENDGRID";
|
|
1331
1354
|
};
|
|
@@ -1725,6 +1748,7 @@ export type LabelStatusType = (typeof labelStatusType)[keyof typeof labelStatusT
|
|
|
1725
1748
|
export declare const landedCostAdjustmentType: {
|
|
1726
1749
|
readonly CartTotal: "CART_TOTAL";
|
|
1727
1750
|
readonly Item: "ITEM";
|
|
1751
|
+
readonly PromoCode: "PROMO_CODE";
|
|
1728
1752
|
readonly Shipping: "SHIPPING";
|
|
1729
1753
|
};
|
|
1730
1754
|
export type LandedCostAdjustmentType = (typeof landedCostAdjustmentType)[keyof typeof landedCostAdjustmentType];
|
|
@@ -2511,6 +2535,7 @@ export type TransitTypeCode = (typeof transitTypeCode)[keyof typeof transitTypeC
|
|
|
2511
2535
|
export declare const usageRecordTypeCode: {
|
|
2512
2536
|
readonly ApiUsage: "API_USAGE";
|
|
2513
2537
|
readonly LcgInvoicing: "LCG_INVOICING";
|
|
2538
|
+
readonly MeterUsage: "METER_USAGE";
|
|
2514
2539
|
readonly OrderComplete: "ORDER_COMPLETE";
|
|
2515
2540
|
readonly OrderTransactionInvoicing: "ORDER_TRANSACTION_INVOICING";
|
|
2516
2541
|
};
|
|
@@ -3032,51 +3057,6 @@ export type CheckoutSessionCreateMutation = {
|
|
|
3032
3057
|
};
|
|
3033
3058
|
};
|
|
3034
3059
|
};
|
|
3035
|
-
export type CheckoutDetailsFragment = {
|
|
3036
|
-
cartId: string | null;
|
|
3037
|
-
clientSecret: string;
|
|
3038
|
-
id: string;
|
|
3039
|
-
landedCost: {
|
|
3040
|
-
amountSubtotals: {
|
|
3041
|
-
discounts: number | null;
|
|
3042
|
-
duties: number;
|
|
3043
|
-
fees: number;
|
|
3044
|
-
items: number;
|
|
3045
|
-
landedCostTotal: number;
|
|
3046
|
-
shipping: number;
|
|
3047
|
-
taxes: number;
|
|
3048
|
-
} | null;
|
|
3049
|
-
id: string;
|
|
3050
|
-
landedCostGuaranteeCode: LandedCostGuaranteeCode;
|
|
3051
|
-
method: IncotermCode;
|
|
3052
|
-
shipmentRating: {
|
|
3053
|
-
displayName: string;
|
|
3054
|
-
};
|
|
3055
|
-
} | null;
|
|
3056
|
-
metadata: Array<{
|
|
3057
|
-
key: string;
|
|
3058
|
-
value: string;
|
|
3059
|
-
} | null> | null;
|
|
3060
|
-
organizationId: string;
|
|
3061
|
-
subtotals: {
|
|
3062
|
-
adjustments: number;
|
|
3063
|
-
duties: number;
|
|
3064
|
-
exchangeRate: {
|
|
3065
|
-
id: string;
|
|
3066
|
-
rate: number;
|
|
3067
|
-
sourceCurrencyCode: CurrencyCode;
|
|
3068
|
-
targetCurrencyCode: CurrencyCode;
|
|
3069
|
-
type: ExchangeRateType;
|
|
3070
|
-
};
|
|
3071
|
-
fees: number;
|
|
3072
|
-
items: number;
|
|
3073
|
-
landedCostTotal: number;
|
|
3074
|
-
presentmentCurrencyCode: CurrencyCode;
|
|
3075
|
-
shipping: number;
|
|
3076
|
-
taxes: number;
|
|
3077
|
-
total: number;
|
|
3078
|
-
};
|
|
3079
|
-
};
|
|
3080
3060
|
export type PaypalOrderCreateMutation = {
|
|
3081
3061
|
paypalOrderCreate: {
|
|
3082
3062
|
paypalOrderId: string | null;
|
|
@@ -3150,6 +3130,51 @@ export type CheckoutSessionUpdateMetadataMutation = {
|
|
|
3150
3130
|
} | null> | null;
|
|
3151
3131
|
};
|
|
3152
3132
|
};
|
|
3133
|
+
export type CheckoutSessionDetailsFragment = {
|
|
3134
|
+
cartId: string | null;
|
|
3135
|
+
clientSecret: string;
|
|
3136
|
+
id: string;
|
|
3137
|
+
landedCost: {
|
|
3138
|
+
amountSubtotals: {
|
|
3139
|
+
discounts: number | null;
|
|
3140
|
+
duties: number;
|
|
3141
|
+
fees: number;
|
|
3142
|
+
items: number;
|
|
3143
|
+
landedCostTotal: number;
|
|
3144
|
+
shipping: number;
|
|
3145
|
+
taxes: number;
|
|
3146
|
+
} | null;
|
|
3147
|
+
id: string;
|
|
3148
|
+
landedCostGuaranteeCode: LandedCostGuaranteeCode;
|
|
3149
|
+
method: IncotermCode;
|
|
3150
|
+
shipmentRating: {
|
|
3151
|
+
displayName: string;
|
|
3152
|
+
};
|
|
3153
|
+
} | null;
|
|
3154
|
+
metadata: Array<{
|
|
3155
|
+
key: string;
|
|
3156
|
+
value: string;
|
|
3157
|
+
} | null> | null;
|
|
3158
|
+
organizationId: string;
|
|
3159
|
+
subtotals: {
|
|
3160
|
+
adjustments: number;
|
|
3161
|
+
duties: number;
|
|
3162
|
+
exchangeRate: {
|
|
3163
|
+
id: string;
|
|
3164
|
+
rate: number;
|
|
3165
|
+
sourceCurrencyCode: CurrencyCode;
|
|
3166
|
+
targetCurrencyCode: CurrencyCode;
|
|
3167
|
+
type: ExchangeRateType;
|
|
3168
|
+
};
|
|
3169
|
+
fees: number;
|
|
3170
|
+
items: number;
|
|
3171
|
+
landedCostTotal: number;
|
|
3172
|
+
presentmentCurrencyCode: CurrencyCode;
|
|
3173
|
+
shipping: number;
|
|
3174
|
+
taxes: number;
|
|
3175
|
+
total: number;
|
|
3176
|
+
};
|
|
3177
|
+
};
|
|
3153
3178
|
export type CheckoutSessionUpdateMutation = {
|
|
3154
3179
|
checkoutSessionUpdate: {
|
|
3155
3180
|
cartId: string | null;
|
|
@@ -3197,51 +3222,6 @@ export type CheckoutSessionUpdateMutation = {
|
|
|
3197
3222
|
};
|
|
3198
3223
|
};
|
|
3199
3224
|
};
|
|
3200
|
-
export type CheckoutSessionUpdateDetailsFragment = {
|
|
3201
|
-
cartId: string | null;
|
|
3202
|
-
clientSecret: string;
|
|
3203
|
-
id: string;
|
|
3204
|
-
landedCost: {
|
|
3205
|
-
amountSubtotals: {
|
|
3206
|
-
discounts: number | null;
|
|
3207
|
-
duties: number;
|
|
3208
|
-
fees: number;
|
|
3209
|
-
items: number;
|
|
3210
|
-
landedCostTotal: number;
|
|
3211
|
-
shipping: number;
|
|
3212
|
-
taxes: number;
|
|
3213
|
-
} | null;
|
|
3214
|
-
id: string;
|
|
3215
|
-
landedCostGuaranteeCode: LandedCostGuaranteeCode;
|
|
3216
|
-
method: IncotermCode;
|
|
3217
|
-
shipmentRating: {
|
|
3218
|
-
displayName: string;
|
|
3219
|
-
};
|
|
3220
|
-
} | null;
|
|
3221
|
-
metadata: Array<{
|
|
3222
|
-
key: string;
|
|
3223
|
-
value: string;
|
|
3224
|
-
} | null> | null;
|
|
3225
|
-
organizationId: string;
|
|
3226
|
-
subtotals: {
|
|
3227
|
-
adjustments: number;
|
|
3228
|
-
duties: number;
|
|
3229
|
-
exchangeRate: {
|
|
3230
|
-
id: string;
|
|
3231
|
-
rate: number;
|
|
3232
|
-
sourceCurrencyCode: CurrencyCode;
|
|
3233
|
-
targetCurrencyCode: CurrencyCode;
|
|
3234
|
-
type: ExchangeRateType;
|
|
3235
|
-
};
|
|
3236
|
-
fees: number;
|
|
3237
|
-
items: number;
|
|
3238
|
-
landedCostTotal: number;
|
|
3239
|
-
presentmentCurrencyCode: CurrencyCode;
|
|
3240
|
-
shipping: number;
|
|
3241
|
-
taxes: number;
|
|
3242
|
-
total: number;
|
|
3243
|
-
};
|
|
3244
|
-
};
|
|
3245
3225
|
export type ZonosSettingsQuery = {
|
|
3246
3226
|
appearanceSettings: {
|
|
3247
3227
|
colorPrimary: string;
|
|
@@ -3268,14 +3248,12 @@ export type ZonosSettingsQuery = {
|
|
|
3268
3248
|
}>;
|
|
3269
3249
|
createdAt: string;
|
|
3270
3250
|
createdBy: string;
|
|
3251
|
+
disabledCountries: Array<CountryCode> | null;
|
|
3271
3252
|
externalPaymentMethods: Array<{
|
|
3272
3253
|
status: ExternalPaymentMethodStatus;
|
|
3273
3254
|
type: ExternalPaymentMethodType;
|
|
3274
3255
|
}> | null;
|
|
3275
|
-
|
|
3276
|
-
token: string;
|
|
3277
|
-
type: ExternalServiceTokenType;
|
|
3278
|
-
}>;
|
|
3256
|
+
organization: string;
|
|
3279
3257
|
id: string;
|
|
3280
3258
|
mode: Mode;
|
|
3281
3259
|
orderNotifications: {
|
|
@@ -3300,7 +3278,10 @@ export type ZonosSettingsQuery = {
|
|
|
3300
3278
|
sendCopiesTo: Array<string>;
|
|
3301
3279
|
};
|
|
3302
3280
|
};
|
|
3303
|
-
|
|
3281
|
+
externalServiceTokens: Array<{
|
|
3282
|
+
token: string;
|
|
3283
|
+
type: ExternalServiceTokenType;
|
|
3284
|
+
}>;
|
|
3304
3285
|
placeOrderButtonSelector: string | null;
|
|
3305
3286
|
status: CheckoutStatus;
|
|
3306
3287
|
subscriptionStatus: CheckoutSubscriptionStatus;
|
|
@@ -3358,6 +3339,7 @@ export type CheckoutSettingFragment = {
|
|
|
3358
3339
|
}>;
|
|
3359
3340
|
createdAt: string;
|
|
3360
3341
|
createdBy: string;
|
|
3342
|
+
disabledCountries: Array<CountryCode> | null;
|
|
3361
3343
|
externalPaymentMethods: Array<{
|
|
3362
3344
|
status: ExternalPaymentMethodStatus;
|
|
3363
3345
|
type: ExternalPaymentMethodType;
|
|
@@ -3547,6 +3529,10 @@ export type GetOrderQuery = {
|
|
|
3547
3529
|
} | null;
|
|
3548
3530
|
type: PartyType | null;
|
|
3549
3531
|
}> | null;
|
|
3532
|
+
references: Array<{
|
|
3533
|
+
key: string | null;
|
|
3534
|
+
value: string | null;
|
|
3535
|
+
}> | null;
|
|
3550
3536
|
root: {
|
|
3551
3537
|
exchangeRates: Array<{
|
|
3552
3538
|
rate: number;
|