@zonos/elements 1.3.3-alpha.0 → 1.3.4-alpha.0
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/collection/types/generated/graphql.customer.types.js +4 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +3 -0
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/scripts/zonosBase.js +1 -1
- package/dist/types/types/generated/graphql.customer.types.d.ts +21 -0
- package/dist/types/types/generated/graphql.customer.types.ts +33 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +14 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +26 -0
- package/package.json +1 -1
|
@@ -1256,6 +1256,7 @@ export const itemValueSource = {
|
|
|
1256
1256
|
OrganizationSetting: 'ORGANIZATION_SETTING',
|
|
1257
1257
|
};
|
|
1258
1258
|
export const labelAmountType = {
|
|
1259
|
+
Fee: 'FEE',
|
|
1259
1260
|
Insurance: 'INSURANCE',
|
|
1260
1261
|
Quote: 'QUOTE',
|
|
1261
1262
|
};
|
|
@@ -1868,6 +1869,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
1868
1869
|
GetOrder(variables, requestHeaders) {
|
|
1869
1870
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetOrder', 'query');
|
|
1870
1871
|
},
|
|
1872
|
+
GetOrders(variables, requestHeaders) {
|
|
1873
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetOrders', 'query');
|
|
1874
|
+
},
|
|
1871
1875
|
OnlineStoreSettings(variables, requestHeaders) {
|
|
1872
1876
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'OnlineStoreSettings', 'query');
|
|
1873
1877
|
},
|
|
@@ -417,6 +417,9 @@ export const promptBulkJobStatusEnum = {
|
|
|
417
417
|
const defaultWrapper = (action, _operationName, _operationType) => action();
|
|
418
418
|
export function getSdk(client, withWrapper = defaultWrapper) {
|
|
419
419
|
return {
|
|
420
|
+
AllSettings(variables, requestHeaders) {
|
|
421
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'AllSettings', 'query');
|
|
422
|
+
},
|
|
420
423
|
CreateErrorEvent(variables, requestHeaders) {
|
|
421
424
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'CreateErrorEvent', 'mutation');
|
|
422
425
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}};const o=async(o,n)=>{const t=(function(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(t=Object.getOwnPropertySymbols(e);s<t.length;s++)o.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(n[t[s]]=e[t[s]])}return n})(n||{},[]),s=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const c=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},t.headers),a=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:s,headers:c,method:r});return(async(o,n)=>{let t;try{t=await fetch(o,n)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null}}const s=t.headers.get("Zonos-Mode"),r=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&s&&r&&("production"===s&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===s&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),t.ok)return{errors:[],json:await e({response:t}),response:t};const i=t.status.toString();try{const o=await e({response:t,shouldThrow:!0});return{errors:[{message:`${i}: ${JSON.stringify(o)}`,type:i}],json:null,response:t}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null}}})(i.toString(),a)};var n;class t{}n=t,t.isBigCommerce=!1,t.requested=!1,t.internationalHideSelector="",t.injectZonos=({initConfig:e,url:o,version:t})=>{const s=o.replace("https://","").replace("http://",""),r=document.createElement("script"),i=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";r.src=`https://${s}/dist/scripts/${i}`,r.addEventListener("load",(()=>{n.isBigCommerce||(n.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.internationalHideSelector=n.internationalHideSelector,window.Zonos.isBigCommerce=n.isBigCommerce,window.Zonos.version&&window.Zonos.init(e)})),document.head.appendChild(r)},t.init=async e=>{const
|
|
1
|
+
(function(){"use strict";"function"==typeof SuppressedError&&SuppressedError;const e=async({response:e,shouldLog:o=!0,shouldThrow:n=!1})=>{try{return await e.json()}catch(e){if(n)throw e;return o&&console.error(e),null}};const o=async(o,n)=>{const t=(function(e,o){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&o.indexOf(t)<0&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(t=Object.getOwnPropertySymbols(e);s<t.length;s++)o.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(n[t[s]]=e[t[s]])}return n})(n||{},[]),s=t.body?JSON.stringify(t.body):void 0,r=t.method||"GET",i=new URL(o);i.searchParams.set("zToken",(function(e){try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));const c=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},t.headers),a=Object.assign(Object.assign({},t),{body:"GET"===r?void 0:s,headers:c,method:r});return(async(o,n)=>{let t;try{t=await fetch(o,n)}catch(e){return e instanceof Error?{errors:[{message:e.message,type:"unknown"}],json:null,response:null}:{errors:[{message:"Fail to fetch",type:"unknown"}],json:null,response:null}}const s=t.headers.get("Zonos-Mode"),r=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&s&&r&&("production"===s&&alert("Please be aware that you are currently operating in the production environment. Any interactions with the customer store, including payments, will be processed as real transactions!"),"test"===s&&alert("For testing payments, you can utilize the test payment information provided at this link: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-test-the-integration"),window.Zonos.modeAlerted=!0),t.ok)return{errors:[],json:await e({response:t}),response:t};const i=t.status.toString();try{const o=await e({response:t,shouldThrow:!0});return{errors:[{message:`${i}: ${JSON.stringify(o)}`,type:i}],json:null,response:t}}catch(e){return{errors:[{message:`${i}: Unknown error`,type:i}],json:null,response:null}}})(i.toString(),a)};var n;class t{}n=t,t.isBigCommerce=!1,t.requested=!1,t.internationalHideSelector="",t.injectZonos=({initConfig:e,url:o,version:t})=>{const s=o.replace("https://","").replace("http://",""),r=document.createElement("script"),i=t&&t<"1.2.5"?"loadZonos.js":"zonos.js";r.src=`https://${s}/dist/scripts/${i}`,r.addEventListener("load",(()=>{n.isBigCommerce||(n.isBigCommerce=!!window.stencilBootstrap||!!window.bcConfig||!!document.querySelector('script[src*="bigcommerce.com"]')),window.Zonos.internationalHideSelector=n.internationalHideSelector,window.Zonos.isBigCommerce=n.isBigCommerce,window.Zonos.version&&window.Zonos.init(e)})),document.head.appendChild(r)},t.init=async e=>{var t;const s="https://v1.3.4-alpha.0.js.zonos.com",r=null===(t=document.querySelector("script[src*='/loadZonos.js']"))||void 0===t?void 0:t.src,i=document.querySelector('script[src*="/zonos.js"]'),c=null==r?void 0:r.includes("timestamp=");if(!r||!c)return void console.error("[ZONOS] 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||!r||n.requested)return;if(n.requested=!0,!e.storeId)return console.log("[ZONOS] loading latest script since storeId is not provided."),void n.injectZonos({initConfig:e,url:s,version:null});const a=new URL("https://v1.route.js.zonos.com/api/get-store-version");a.searchParams.set("storeId",e.storeId.toString());const{errors:l,json:d}=await o(a.toString());if(l.length||!d)return void n.injectZonos({initConfig:e,url:s,version:null});const{version:u}=d;if(!i){const o=["dev.elements.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"],t=new URL(r).origin,s=o.some((e=>t.includes(e))),i=s?t:`v${u}.js.zonos.com`,c=s?null:u;n.injectZonos({initConfig:e,url:i,version:c})}},void 0===window.Zonos&&(window.Zonos=t)})();
|
package/dist/scripts/zonos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...n)=>{var o;if(!window.Zonos.debug)return;let r=document.querySelector("iframe#zonos---debug-logging-iframe");r||(r=document.createElement("iframe"),r.id="zonos---debug-logging-iframe",r.style.display="none",r.style.opacity="0",r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.border="none",r.style.overflow="hidden",r.style.visibility="hidden",document.body.appendChild(r));const s=(null===(o=r.contentWindow)||void 0===o?void 0:o.window.console)||window.console;switch(t){case"warn":s.warn(e,...n);break;case"info":s.info(e,...n);break;default:s.groupCollapsed(e,...n),s.trace(),s.groupEnd()}},t=(e,...t)=>{console.error(e,...t)},n="https://js.stripe.com/v3",o=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,r="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let s=null;const i=e=>(null!==s||(s=new Promise(((s,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(r),window.Stripe)s(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&o.test(n.src))return n}return null})();l&&e?console.warn(r):l||(l=(e=>{const o=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src=`${n}${o}`;const s=document.head||document.body;return s?(s.appendChild(r),r):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?s(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else s(null)}))),s),l=Promise.resolve().then((()=>i(null)));let c=!1;l.catch((e=>{c||console.warn(e)}));var a;const d=(()=>{const e=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!e)return null;const t=`https://${e}.preview.js.zonos.com`;return console.warn(`[ZONOS-WARNING] using '${t}' for loading script`),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState({},"",o),window.location.reload(),null})),t})(),u=d||"https://v1.3.
|
|
1
|
+
(function(){"use strict";const e=(e,t,...n)=>{var o;if(!window.Zonos.debug)return;let r=document.querySelector("iframe#zonos---debug-logging-iframe");r||(r=document.createElement("iframe"),r.id="zonos---debug-logging-iframe",r.style.display="none",r.style.opacity="0",r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.border="none",r.style.overflow="hidden",r.style.visibility="hidden",document.body.appendChild(r));const s=(null===(o=r.contentWindow)||void 0===o?void 0:o.window.console)||window.console;switch(t){case"warn":s.warn(e,...n);break;case"info":s.info(e,...n);break;default:s.groupCollapsed(e,...n),s.trace(),s.groupEnd()}},t=(e,...t)=>{console.error(e,...t)},n="https://js.stripe.com/v3",o=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,r="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let s=null;const i=e=>(null!==s||(s=new Promise(((s,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(r),window.Stripe)s(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&o.test(n.src))return n}return null})();l&&e?console.warn(r):l||(l=(e=>{const o=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src=`${n}${o}`;const s=document.head||document.body;return s?(s.appendChild(r),r):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?s(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else s(null)}))),s),l=Promise.resolve().then((()=>i(null)));let c=!1;l.catch((e=>{c||console.warn(e)}));var a;const d=(()=>{const e=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!e)return null;const t=`https://${e}.preview.js.zonos.com`;return console.warn(`[ZONOS-WARNING] using '${t}' for loading script`),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState({},"",o),window.location.reload(),null})),t})(),u=d||"https://v1.3.4-alpha.0.js.zonos.com",p="https://unpkg.com/@zonos/elements@1.3.4-alpha.0",m="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class w{}a=w,w.doneInit=!1,w.debug=!!window.location.search.match(/\?.*(&*)zonosDebug=1/),w.isBigCommerce=!1,w.internationalHideSelector="",w.zonosQaUrl=d,w.version="v1.3.4-alpha.0",w.modeAlerted=!1,w.getCurrentTimestamp=()=>(new Date).getTime(),w.zonosController=null,w.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,storeId:i,zonosApiKey:l})=>{a.doneInit||(e(`====== ZONOS DEBUG MODE: on (${a.version}) ======`),l?(a.zonosApiKey=l,a.storeId=i,e("init zonos"),a.injectSentryScript(),a.injectZonosCdn(),a.injectZonosCss(),a.injectFonts(),a.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s},zonosApiKey:l}),a.doneInit=!0):t("Missing Zonos API key"))},w.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},w.showNotification=e=>{var t;null===(t=a.zonosController)||void 0===t||t.showNotification(e)},w.updateOrganizationName=e=>{var t;null===(t=a.zonosController)||void 0===t||t.updateOrganizationName(e)},w.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:n})=>{if(n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},w.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{c=!0;const t=Date.now();return l.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),a.zonosController=s,e("Zonos controller injected!")},w.injectSentryScript=()=>{const n="https://browser.sentry-cdn.com/7.88.0/bundle.tracing.min.js";if(document.querySelector(`script[src="${n}"]`))return void e("Sentry script already exists in the document","warn");const o=document.head||document.body,r=document.createElement("script");r.crossOrigin="anonymous",r.src=n,r.integrity="sha384-z/aQww1Fr6Mes0MO/2wlzQd2nXBCdDcKPXDTsMDMNPgTGRPqii3a4bzH79I+Vo8l",r.setAttribute("data-lazy","no"),r.onerror=()=>{t(`Failed to load ${r.src}`)},r.onload=()=>{var e;null===(e=window.Sentry)||void 0===e||e.init({allowUrls:[/js.zonos.com/],dsn:"https://19168bd05af0e2e0e7520ad58953e4f2@o446983.ingest.sentry.io/4506400622837760",release:`zonos-elements@${a.version}`})},o.appendChild(r)},w.injectScript=({fallBackDomain:n,isModule:o,scriptDomain:r,theRestUrl:s})=>{const i=`${r}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{/\/\/v\d+\./g.test(r)?(n&&a.injectScript({isModule:o,scriptDomain:n,theRestUrl:s}),t(`Failed to load ${c.src}`)):e("No need to fallback since this is not a versioned domain","warn")},l.appendChild(c)},w.injectZonosCdn=()=>{a.injectScript({fallBackDomain:p,isModule:!0,scriptDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),a.injectScript({fallBackDomain:p,isModule:!1,scriptDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},w.injectStylesheet=({fallBackDomain:n,stylesheetDomain:o,theRestUrl:r})=>{const s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${u}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${r}`,l.onerror=()=>{const s=/\/\/v\d+\./g.test(o);s?(n&&s&&a.injectStylesheet({stylesheetDomain:n,theRestUrl:r}),t(`Failed to load ${l.href}`)):e("No need to fallback since this is not a versioned domain","warn")},s.appendChild(l)},w.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(a.injectStylesheet({fallBackDomain:p,stylesheetDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},w.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${m}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!y.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=m,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${m}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},w.setupGoogleFont=e=>{var t;null===(t=a.zonosController)||void 0===t||t.setupGoogleFont(e)},w.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},window.Zonos=w})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";const e=(e,t,...n)=>{var o;if(!window.Zonos.debug)return;let r=document.querySelector("iframe#zonos---debug-logging-iframe");r||(r=document.createElement("iframe"),r.id="zonos---debug-logging-iframe",r.style.display="none",r.style.opacity="0",r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.border="none",r.style.overflow="hidden",r.style.visibility="hidden",document.body.appendChild(r));const s=(null===(o=r.contentWindow)||void 0===o?void 0:o.window.console)||window.console;switch(t){case"warn":s.warn(e,...n);break;case"info":s.info(e,...n);break;default:s.groupCollapsed(e,...n),s.trace(),s.groupEnd()}},t=(e,...t)=>{console.error(e,...t)},n="https://js.stripe.com/v3",o=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,r="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let s=null;const i=e=>(null!==s||(s=new Promise(((s,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(r),window.Stripe)s(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&o.test(n.src))return n}return null})();l&&e?console.warn(r):l||(l=(e=>{const o=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src=`${n}${o}`;const s=document.head||document.body;return s?(s.appendChild(r),r):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?s(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else s(null)}))),s),l=Promise.resolve().then((()=>i(null)));let c=!1;l.catch((e=>{c||console.warn(e)}));var a;const d=(()=>{const e=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!e)return null;const t=`https://${e}.preview.js.zonos.com`;return console.warn(`[ZONOS-WARNING] using '${t}' for loading script`),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState({},"",o),window.location.reload(),null})),t})(),u=d||"https://v1.3.
|
|
1
|
+
(function(){"use strict";const e=(e,t,...n)=>{var o;if(!window.Zonos.debug)return;let r=document.querySelector("iframe#zonos---debug-logging-iframe");r||(r=document.createElement("iframe"),r.id="zonos---debug-logging-iframe",r.style.display="none",r.style.opacity="0",r.style.position="absolute",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.border="none",r.style.overflow="hidden",r.style.visibility="hidden",document.body.appendChild(r));const s=(null===(o=r.contentWindow)||void 0===o?void 0:o.window.console)||window.console;switch(t){case"warn":s.warn(e,...n);break;case"info":s.info(e,...n);break;default:s.groupCollapsed(e,...n),s.trace(),s.groupEnd()}},t=(e,...t)=>{console.error(e,...t)},n="https://js.stripe.com/v3",o=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,r="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let s=null;const i=e=>(null!==s||(s=new Promise(((s,i)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(r),window.Stripe)s(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${n}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&o.test(n.src))return n}return null})();l&&e?console.warn(r):l||(l=(e=>{const o=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src=`${n}${o}`;const s=document.head||document.body;return s?(s.appendChild(r),r):(t("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?s(window.Stripe):i(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{i(new Error("Failed to load Stripe.js"))}))}catch(e){return void i(e)}else s(null)}))),s),l=Promise.resolve().then((()=>i(null)));let c=!1;l.catch((e=>{c||console.warn(e)}));var a;const d=(()=>{const e=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href);if(!e)return null;const t=`https://${e}.preview.js.zonos.com`;return console.warn(`[ZONOS-WARNING] using '${t}' for loading script`),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState({},"",o),window.location.reload(),null})),t})(),u=d||"https://v1.3.4-alpha.0.js.zonos.com",p="https://unpkg.com/@zonos/elements@1.3.4-alpha.0",m="https://rsms.me",h="https://fonts.googleapis.com",y=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class w{}a=w,w.doneInit=!1,w.debug=!!window.location.search.match(/\?.*(&*)zonosDebug=1/),w.isBigCommerce=!1,w.internationalHideSelector="",w.zonosQaUrl=d,w.version="v1.3.4-alpha.0",w.modeAlerted=!1,w.getCurrentTimestamp=()=>(new Date).getTime(),w.zonosController=null,w.init=async({appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s,storeId:i,zonosApiKey:l})=>{a.doneInit||(e(`====== ZONOS DEBUG MODE: on (${a.version}) ======`),l?(a.zonosApiKey=l,a.storeId=i,e("init zonos"),a.injectSentryScript(),a.injectZonosCdn(),a.injectZonosCss(),a.injectFonts(),a.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:r,helloSettings:s},zonosApiKey:l}),a.doneInit=!0):t("Missing Zonos API key"))},w.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},w.showNotification=e=>{var t;null===(t=a.zonosController)||void 0===t||t.showNotification(e)},w.updateOrganizationName=e=>{var t;null===(t=a.zonosController)||void 0===t||t.updateOrganizationName(e)},w.disablePlaceOrderButtons=({autoEnable:e=!0,disable:t,placeOrderButtonSelector:n})=>{if(n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},w.injectController=({config:n,zonosApiKey:o})=>{var r;if(document.querySelector("zonos-controller"))return;if(null===(r=n.checkoutSettings)||void 0===r?void 0:r.placeOrderButtonSelector){const e=n.checkoutSettings.placeOrderButtonSelector;a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e});new MutationObserver((()=>{a.disablePlaceOrderButtons({disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=n,s.zonosApiKey=o,s.addEventListener("stripeInitEvent",(async n=>{const{detail:o}=n;e("loading Stripe");const r=await(async(...e)=>{c=!0;const t=Date.now();return l.then((n=>((e,t,n)=>{if(null===e)return null;const o=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(o,n),o})(n,e,t)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):t("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),a.zonosController=s,e("Zonos controller injected!")},w.injectSentryScript=()=>{const n="https://browser.sentry-cdn.com/7.88.0/bundle.tracing.min.js";if(document.querySelector(`script[src="${n}"]`))return void e("Sentry script already exists in the document","warn");const o=document.head||document.body,r=document.createElement("script");r.crossOrigin="anonymous",r.src=n,r.integrity="sha384-z/aQww1Fr6Mes0MO/2wlzQd2nXBCdDcKPXDTsMDMNPgTGRPqii3a4bzH79I+Vo8l",r.setAttribute("data-lazy","no"),r.onerror=()=>{t(`Failed to load ${r.src}`)},r.onload=()=>{var e;null===(e=window.Sentry)||void 0===e||e.init({allowUrls:[/js.zonos.com/],dsn:"https://19168bd05af0e2e0e7520ad58953e4f2@o446983.ingest.sentry.io/4506400622837760",release:`zonos-elements@${a.version}`})},o.appendChild(r)},w.injectScript=({fallBackDomain:n,isModule:o,scriptDomain:r,theRestUrl:s})=>{const i=`${r}/${s}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{/\/\/v\d+\./g.test(r)?(n&&a.injectScript({isModule:o,scriptDomain:n,theRestUrl:s}),t(`Failed to load ${c.src}`)):e("No need to fallback since this is not a versioned domain","warn")},l.appendChild(c)},w.injectZonosCdn=()=>{a.injectScript({fallBackDomain:p,isModule:!0,scriptDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),a.injectScript({fallBackDomain:p,isModule:!1,scriptDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},w.injectStylesheet=({fallBackDomain:n,stylesheetDomain:o,theRestUrl:r})=>{const s=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${u}/`,s.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${r}`,l.onerror=()=>{const s=/\/\/v\d+\./g.test(o);s?(n&&s&&a.injectStylesheet({stylesheetDomain:n,theRestUrl:r}),t(`Failed to load ${l.href}`)):e("No need to fallback since this is not a versioned domain","warn")},s.appendChild(l)},w.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(a.injectStylesheet({fallBackDomain:p,stylesheetDomain:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},w.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${m}"]`);for(let t=0;t<e.length;t++){const n=e[t];if(n&&!y.test(n.href))return n}return null})())return void e("Inter font already injected","warn");const t=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=m,t.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${m}/inter/inter.css`,t.appendChild(o),e("Zonos font injected!")},w.setupGoogleFont=e=>{var t;null===(t=a.zonosController)||void 0===t||t.setupGoogleFont(e)},w.injectSupportGoogleFont=t=>{var n;e(`[FONT] injecting ${t}`);const o=null===(n=t.match(/family=(.*?):/))||void 0===n?void 0:n[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=t,r.appendChild(s),e(`[FONT] ${o} font injected!`)},exports.Zonos=w})();
|
|
@@ -1432,6 +1432,7 @@ export declare const itemValueSource: {
|
|
|
1432
1432
|
};
|
|
1433
1433
|
export type ItemValueSource = (typeof itemValueSource)[keyof typeof itemValueSource];
|
|
1434
1434
|
export declare const labelAmountType: {
|
|
1435
|
+
readonly Fee: "FEE";
|
|
1435
1436
|
readonly Insurance: "INSURANCE";
|
|
1436
1437
|
readonly Quote: "QUOTE";
|
|
1437
1438
|
};
|
|
@@ -2846,6 +2847,23 @@ export type OrderUpdateAccountOrderNumberMutation = {
|
|
|
2846
2847
|
accountOrderNumber: string | null;
|
|
2847
2848
|
};
|
|
2848
2849
|
};
|
|
2850
|
+
export type GetOrdersQuery = {
|
|
2851
|
+
orders: {
|
|
2852
|
+
edges: Array<{
|
|
2853
|
+
node: {
|
|
2854
|
+
accountOrderNumber: string | null;
|
|
2855
|
+
id: string;
|
|
2856
|
+
organization: string;
|
|
2857
|
+
} | null;
|
|
2858
|
+
} | null> | null;
|
|
2859
|
+
pageInfo: {
|
|
2860
|
+
endCursor: string | null;
|
|
2861
|
+
hasNextPage: boolean;
|
|
2862
|
+
hasPreviousPage: boolean;
|
|
2863
|
+
startCursor: string | null;
|
|
2864
|
+
} | null;
|
|
2865
|
+
} | null;
|
|
2866
|
+
};
|
|
2849
2867
|
export type GetCheckoutPlaceOrderButtonSelectorQuery = {
|
|
2850
2868
|
checkoutSettings: {
|
|
2851
2869
|
placeOrderButtonSelector: string | null;
|
|
@@ -2880,6 +2898,9 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
2880
2898
|
GetOrder(variables?: {
|
|
2881
2899
|
[x: string]: never;
|
|
2882
2900
|
} | undefined, requestHeaders?: GraphQLClientRequestHeaders): Promise<GetOrderQuery>;
|
|
2901
|
+
GetOrders(variables?: {
|
|
2902
|
+
[x: string]: never;
|
|
2903
|
+
} | undefined, requestHeaders?: GraphQLClientRequestHeaders): Promise<GetOrdersQuery>;
|
|
2883
2904
|
OnlineStoreSettings(variables?: {
|
|
2884
2905
|
[x: string]: never;
|
|
2885
2906
|
} | undefined, requestHeaders?: GraphQLClientRequestHeaders): Promise<OnlineStoreSettingsQuery>;
|
|
@@ -1653,6 +1653,7 @@ export type ItemValueSource =
|
|
|
1653
1653
|
(typeof itemValueSource)[keyof typeof itemValueSource];
|
|
1654
1654
|
|
|
1655
1655
|
export const labelAmountType = {
|
|
1656
|
+
Fee: 'FEE',
|
|
1656
1657
|
Insurance: 'INSURANCE',
|
|
1657
1658
|
Quote: 'QUOTE',
|
|
1658
1659
|
} as const;
|
|
@@ -3176,6 +3177,24 @@ export type OrderUpdateAccountOrderNumberMutation = {
|
|
|
3176
3177
|
orderUpdateAccountOrderNumber: { accountOrderNumber: string | null };
|
|
3177
3178
|
};
|
|
3178
3179
|
|
|
3180
|
+
export type GetOrdersQuery = {
|
|
3181
|
+
orders: {
|
|
3182
|
+
edges: Array<{
|
|
3183
|
+
node: {
|
|
3184
|
+
accountOrderNumber: string | null;
|
|
3185
|
+
id: string;
|
|
3186
|
+
organization: string;
|
|
3187
|
+
} | null;
|
|
3188
|
+
} | null> | null;
|
|
3189
|
+
pageInfo: {
|
|
3190
|
+
endCursor: string | null;
|
|
3191
|
+
hasNextPage: boolean;
|
|
3192
|
+
hasPreviousPage: boolean;
|
|
3193
|
+
startCursor: string | null;
|
|
3194
|
+
} | null;
|
|
3195
|
+
} | null;
|
|
3196
|
+
};
|
|
3197
|
+
|
|
3179
3198
|
export type GetCheckoutPlaceOrderButtonSelectorQuery = {
|
|
3180
3199
|
checkoutSettings: { placeOrderButtonSelector: string | null } | null;
|
|
3181
3200
|
};
|
|
@@ -3323,6 +3342,20 @@ export function getSdk(
|
|
|
3323
3342
|
'query',
|
|
3324
3343
|
);
|
|
3325
3344
|
},
|
|
3345
|
+
GetOrders(
|
|
3346
|
+
variables?: { [x: string]: never },
|
|
3347
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
3348
|
+
): Promise<GetOrdersQuery> {
|
|
3349
|
+
return withWrapper(
|
|
3350
|
+
wrappedRequestHeaders =>
|
|
3351
|
+
client.request<GetOrdersQuery>('', variables, {
|
|
3352
|
+
...requestHeaders,
|
|
3353
|
+
...wrappedRequestHeaders,
|
|
3354
|
+
}),
|
|
3355
|
+
'GetOrders',
|
|
3356
|
+
'query',
|
|
3357
|
+
);
|
|
3358
|
+
},
|
|
3326
3359
|
OnlineStoreSettings(
|
|
3327
3360
|
variables?: { [x: string]: never },
|
|
3328
3361
|
requestHeaders?: GraphQLClientRequestHeaders,
|
|
@@ -556,6 +556,17 @@ export type CreateErrorEventMutation = {
|
|
|
556
556
|
}>;
|
|
557
557
|
} | null;
|
|
558
558
|
};
|
|
559
|
+
export type AllSettingsQuery = {
|
|
560
|
+
bigcommerce_settings: Array<{
|
|
561
|
+
authToken: string;
|
|
562
|
+
domain: string;
|
|
563
|
+
id: number;
|
|
564
|
+
storeHash: string;
|
|
565
|
+
zonosCredentialToken: string | null;
|
|
566
|
+
zonosIsNewVersion: boolean;
|
|
567
|
+
zonosStoreId: number | null;
|
|
568
|
+
}>;
|
|
569
|
+
};
|
|
559
570
|
export type InsertOrderImportLockMutation = {
|
|
560
571
|
insert_bigcommerce_orderImportLock_one: {
|
|
561
572
|
id: number;
|
|
@@ -673,6 +684,9 @@ export type InsertBigCommerceSettingsEventMutation = {
|
|
|
673
684
|
};
|
|
674
685
|
export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string) => Promise<T>;
|
|
675
686
|
export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {
|
|
687
|
+
AllSettings(variables?: {
|
|
688
|
+
[x: string]: never;
|
|
689
|
+
} | undefined, requestHeaders?: GraphQLClientRequestHeaders): Promise<AllSettingsQuery>;
|
|
676
690
|
CreateErrorEvent(variables?: {
|
|
677
691
|
[x: string]: never;
|
|
678
692
|
} | undefined, requestHeaders?: GraphQLClientRequestHeaders): Promise<CreateErrorEventMutation>;
|
|
@@ -548,6 +548,18 @@ export type CreateErrorEventMutation = {
|
|
|
548
548
|
} | null;
|
|
549
549
|
};
|
|
550
550
|
|
|
551
|
+
export type AllSettingsQuery = {
|
|
552
|
+
bigcommerce_settings: Array<{
|
|
553
|
+
authToken: string;
|
|
554
|
+
domain: string;
|
|
555
|
+
id: number;
|
|
556
|
+
storeHash: string;
|
|
557
|
+
zonosCredentialToken: string | null;
|
|
558
|
+
zonosIsNewVersion: boolean;
|
|
559
|
+
zonosStoreId: number | null;
|
|
560
|
+
}>;
|
|
561
|
+
};
|
|
562
|
+
|
|
551
563
|
export type InsertOrderImportLockMutation = {
|
|
552
564
|
insert_bigcommerce_orderImportLock_one: {
|
|
553
565
|
id: number;
|
|
@@ -669,6 +681,20 @@ export function getSdk(
|
|
|
669
681
|
withWrapper: SdkFunctionWrapper = defaultWrapper,
|
|
670
682
|
) {
|
|
671
683
|
return {
|
|
684
|
+
AllSettings(
|
|
685
|
+
variables?: { [x: string]: never },
|
|
686
|
+
requestHeaders?: GraphQLClientRequestHeaders,
|
|
687
|
+
): Promise<AllSettingsQuery> {
|
|
688
|
+
return withWrapper(
|
|
689
|
+
wrappedRequestHeaders =>
|
|
690
|
+
client.request<AllSettingsQuery>('', variables, {
|
|
691
|
+
...requestHeaders,
|
|
692
|
+
...wrappedRequestHeaders,
|
|
693
|
+
}),
|
|
694
|
+
'AllSettings',
|
|
695
|
+
'query',
|
|
696
|
+
);
|
|
697
|
+
},
|
|
672
698
|
CreateErrorEvent(
|
|
673
699
|
variables?: { [x: string]: never },
|
|
674
700
|
requestHeaders?: GraphQLClientRequestHeaders,
|