@zonos/elements 1.3.111 → 1.3.112

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.
Files changed (128) hide show
  1. package/dist/cjs/{cart-a3eab220.js → cart-6d966eea.js} +114 -2
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/{paypal-ca479c4b.js → paypal-ae7bd9f2.js} +1 -1
  4. package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
  5. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +2 -2
  6. package/dist/cjs/zonos-checkout.cjs.entry.js +13 -11
  7. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  9. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
  14. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +12 -10
  15. package/dist/collection/components/store/checkout/cart.js +6 -2
  16. package/dist/collection/components/store/checkout/stripe.js +48 -1
  17. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
  18. package/dist/collection/components/store/translationStore/strings.base.js +3 -0
  19. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
  20. package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
  21. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
  22. package/dist/collection/components/store/translationStore/strings.french.js +3 -0
  23. package/dist/collection/components/store/translationStore/strings.german.js +3 -0
  24. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
  25. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
  26. package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
  27. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
  28. package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
  29. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
  30. package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
  31. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
  32. package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
  33. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
  34. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
  35. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
  36. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
  37. package/dist/collection/types/checkout/api/legacy/InventoryCheck.js +1 -0
  38. package/dist/collection/types/index.js +1 -0
  39. package/dist/esm/{cart-163f4dd9.js → cart-89bc298d.js} +114 -3
  40. package/dist/esm/index.js +7 -7
  41. package/dist/esm/{paypal-77e8eef2.js → paypal-804a4bcb.js} +1 -1
  42. package/dist/esm/zonos-address_7.entry.js +1 -1
  43. package/dist/esm/zonos-cart-items_13.entry.js +2 -2
  44. package/dist/esm/zonos-checkout.entry.js +13 -11
  45. package/dist/esm/zonos-controller.entry.js +1 -1
  46. package/dist/esm/zonos-country-flag.entry.js +1 -1
  47. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  48. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  49. package/dist/esm/zonos-hello.entry.js +1 -1
  50. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  51. package/dist/esm/zonos-notification_3.entry.js +2 -2
  52. package/dist/esm-es5/cart-89bc298d.js +1 -0
  53. package/dist/esm-es5/index.js +1 -1
  54. package/dist/esm-es5/{paypal-77e8eef2.js → paypal-804a4bcb.js} +1 -1
  55. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  56. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  57. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  58. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  59. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  60. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  61. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  62. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  63. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  64. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  65. package/dist/scripts/index.d.ts +11 -4
  66. package/dist/scripts/index.js +1 -1
  67. package/dist/scripts/loadZonos.js +1 -1
  68. package/dist/scripts/zonos.js +1 -1
  69. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +0 -1
  70. package/dist/types/components/store/checkout/stripe.d.ts +10 -2
  71. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
  72. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
  73. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
  74. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
  75. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
  76. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
  77. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
  78. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
  79. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
  80. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
  81. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
  82. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
  83. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
  84. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
  85. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
  86. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
  87. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
  88. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
  89. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
  90. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
  91. package/dist/types/components/store/translationStore.d.ts +1 -1
  92. package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +11 -4
  93. package/dist/types/types/checkout/api/legacy/InventoryCheck.d.ts +9 -0
  94. package/dist/types/types/index.d.ts +1 -0
  95. package/dist/zonos-elements/index.esm.js +1 -1
  96. package/dist/zonos-elements/p-007c64dc.system.js +1 -0
  97. package/dist/zonos-elements/{p-bcfc229f.entry.js → p-05d558c2.entry.js} +1 -1
  98. package/dist/zonos-elements/{p-8cafdbc9.entry.js → p-0c7d7aec.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-0ad85ec6.entry.js → p-1769c0d2.entry.js} +1 -1
  100. package/dist/zonos-elements/p-19433a7d.entry.js +1 -0
  101. package/dist/zonos-elements/{p-8acdac29.entry.js → p-347c0756.entry.js} +1 -1
  102. package/dist/zonos-elements/{p-46a71949.system.entry.js → p-3c326d01.system.entry.js} +1 -1
  103. package/dist/zonos-elements/{p-06e3c94f.entry.js → p-3cfa837c.entry.js} +1 -1
  104. package/dist/zonos-elements/{p-8e85c28f.system.entry.js → p-45214b34.system.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-a45bd823.system.entry.js → p-55735806.system.entry.js} +1 -1
  106. package/dist/zonos-elements/{p-49135023.system.js → p-8f9198f2.system.js} +1 -1
  107. package/dist/zonos-elements/p-97114032.js +1 -0
  108. package/dist/zonos-elements/p-a43eacf3.system.entry.js +1 -0
  109. package/dist/zonos-elements/{p-d8a45014.system.entry.js → p-b35e67f7.system.entry.js} +1 -1
  110. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  111. package/dist/zonos-elements/{p-2a0c4426.system.entry.js → p-d01cfb8b.system.entry.js} +1 -1
  112. package/dist/zonos-elements/{p-932cbdd7.system.entry.js → p-d0ccf2af.system.entry.js} +1 -1
  113. package/dist/zonos-elements/{p-abc6b881.system.entry.js → p-d1f334d8.system.entry.js} +1 -1
  114. package/dist/zonos-elements/{p-0810568b.system.entry.js → p-d49cdf77.system.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-5929ba9e.system.js → p-dc5acdd3.system.js} +1 -1
  116. package/dist/zonos-elements/{p-1dcaf64f.js → p-e132bc3d.js} +1 -1
  117. package/dist/zonos-elements/{p-58e6386b.entry.js → p-ead95c3b.entry.js} +1 -1
  118. package/dist/zonos-elements/{p-189aa06e.system.entry.js → p-ece0b7ab.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-605473a3.entry.js → p-ed222a50.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-124f5c21.entry.js → p-f26c4392.entry.js} +1 -1
  121. package/dist/zonos-elements/{p-110ee9ab.entry.js → p-fe781493.entry.js} +1 -1
  122. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  123. package/package.json +1 -1
  124. package/dist/esm-es5/cart-163f4dd9.js +0 -1
  125. package/dist/zonos-elements/p-5a011a47.system.js +0 -1
  126. package/dist/zonos-elements/p-a828799f.system.entry.js +0 -1
  127. package/dist/zonos-elements/p-c44f27be.js +0 -1
  128. package/dist/zonos-elements/p-ddcbf41d.entry.js +0 -1
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const t=performance.now()-e,o=t>1e3?`${(t/1e3).toFixed(2)}s`:`${t.toFixed(2)}ms`;return{elapsedTime:t,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...l);break;case"info":d.info(o,...l);break;case"error":d.error(o,...l);break;default:d.groupCollapsed(o,...l),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.111.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${l}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],g=w[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:t,path:n}),{errors:l,response:c}=a,d=y(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${f[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:t})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&t?(o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,1e3))),C({cartId:e,retries:t-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),Z=async e=>{const{isDgsCartId:t,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!t)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return o("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var A;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),U="https://v1.3.111.js.zonos.com",$=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.111",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}A=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1730241963457",N.isLegacyCheckout=!1,N.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.111",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{if(A.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!A.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${A.version}) ======`),A.zonosApiKey=c,A.storeId=l,A.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!A.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!A.cartData&&A.cartId){o("Initialize cart data");const e=await Z(A.cartId);if(!e)return void n("Failed to get cart data");A.cartData=e.cartData,A.zonosApiKey=e.zonosApiKey}}if(A.cartId&&A.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),A.injectZonosCdn(),A.injectZonosCss(),A.injectFonts(),A.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a}}),A.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=A.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=A.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=A.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),A.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${A.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");t?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const o=i(e);o&&A.injectScript({cdnType:o,isModule:t,theRestUrl:r})},a.appendChild(l)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return $;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.111";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.111";case"vercel":return U}};if(A.isNpm){return a()||t()}return t()},N.injectZonosCdn=()=>{A.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),A.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=A.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${o}/${t}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const o=i(e);o&&A.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(a)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(A.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!D.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=L,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=A.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=N)})();
1
+ (function(){"use strict";const e=performance.now(),t=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},o=(o,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const t=performance.now()-e,o=t>1e3?`${(t/1e3).toFixed(2)}s`:`${t.toFixed(2)}ms`;return{elapsedTime:t,elapsedTimePretty:o}})(),l=[`(${a})`,...r];l.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...l));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...l);break;case"info":d.info(o,...l);break;case"error":d.error(o,...l);break;default:d.groupCollapsed(o,...l),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},a=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.112.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},l="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${l}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],g=w[0],f={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=f[g],b=(e=g)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||f[e]||g,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),a=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&a&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const l=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await j({basePathType:i,options:t,path:n}),{errors:l,response:c}=a,d=y(a,["errors","response"]),u=b(i),p=!!l.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,href:window.location.href,metadata:Object.assign({userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${f[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:f[i]+n,errors:l.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:l,response:c},d)},C=async({cartId:e,retries:t})=>{const n="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:r,json:s}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),a=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),l=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:l||g,options:a,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&t?(o("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:t}),await new Promise((e=>setTimeout(e,1e3))),C({cartId:e,retries:t-1})):i?null:s},k=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${k.source}$`),I=new RegExp(`^cart_${k.source}$`),Z=async e=>{const{isDgsCartId:t,isLegacyCartId:r}=(e=>e?I.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!t)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await C({cartId:e,retries:5});return o("[ZONOS - loadZonos] getting temp cart data","info",s),s?{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var A;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),U="https://v1.3.112.js.zonos.com",$=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.112",L="https://rsms.me",P="https://fonts.googleapis.com",D=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class N{}A=N,N.doneInit=!1,N.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),N.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),N._paypalMockResponse=null,N.isBigCommerce=!1,N.releaseDate="1730313650840",N.isLegacyCheckout=!1,N.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),N.isNpm=!0,N.zonosQaUrl=null,N.zonosQaUrlApi=null,N.version="v1.3.112",N.modeAlerted=!1,N.cartData=null,N.paypal=null,N.getCurrentTimestamp=()=>(new Date).getTime(),N.zonosController=null,N.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a,storeId:l,zonosApiKey:c})=>{if(A.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!A.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${A.version}) ======`),A.zonosApiKey=c,A.storeId=l,A.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!A.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!A.cartData&&A.cartId){o("Initialize cart data");const e=await Z(A.cartId);if(!e)return void n("Failed to get cart data");A.cartData=e.cartData,A.zonosApiKey=e.zonosApiKey}}if(A.cartId&&A.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),A.injectZonosCdn(),A.injectZonosCss(),A.injectFonts(),A.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:a}}),A.doneInit=!0}},N.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},N.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},N.showNotification=e=>{var t;null===(t=A.zonosController)||void 0===t||t.showNotification(e)},N.updateOrganizationName=e=>{var t;null===(t=A.zonosController)||void 0===t||t.updateOrganizationName(e)},N.disablePlaceOrderButtons=({autoEnable:e=!0,config:t,disable:o,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=t.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const t=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};t.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&o&&setTimeout((()=>{t.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},N.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{A.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=A.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),A.zonosController=r,o("Zonos controller injected!")},N.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${A.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,l=document.createElement("script");t?l.type="module":l.noModule=!0,l.src=s,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const o=i(e);o&&A.injectScript({cdnType:o,isModule:t,theRestUrl:r})},a.appendChild(l)},N.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return $;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.112";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.112";case"vercel":return U}};if(A.isNpm){return a()||t()}return t()},N.injectZonosCdn=()=>{A.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),A.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},N.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=A.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${U}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${o}/${t}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const o=i(e);o&&A.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(a)},N.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(A.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},N.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!D.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=L,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${L}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},N.setupGoogleFont=e=>{var t;null===(t=A.zonosController)||void 0===t||t.setupGoogleFont(e)},N.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${P}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=P,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=N)})();
@@ -105,7 +105,6 @@ export declare class ZonosCheckout {
105
105
  mockCheckoutSession(session: CheckoutSessionDetailsFragment): Promise<void>;
106
106
  private handleCustomerInfoContinue;
107
107
  private handleShippingContinue;
108
- private handleInventoryCheckDialogCancel;
109
108
  private handleInventoryCheckDialogConfirm;
110
109
  private handleStripePaymentContinue;
111
110
  private handleFinishClick;
@@ -22,6 +22,10 @@ type StripeStore = {
22
22
  hasPaymentError: boolean;
23
23
  isFetchingLandedCost: boolean;
24
24
  isFetchingSession: boolean;
25
+ /**
26
+ * Toggle to indicate if we should refund the inventory when the payment is failed
27
+ */
28
+ shouldInventoryRefund: boolean;
25
29
  stripe: Stripe | null;
26
30
  stripeAddressElement: StripeAddressElement | null;
27
31
  stripeAddressEventData: StripeAddressElementChangeEvent | null;
@@ -91,6 +95,10 @@ declare const stripeStoreMessageBasedOnStatus: (status?: PaymentIntent['status']
91
95
  * Handle inventory check and returns error message if the callback provided.
92
96
  */
93
97
  declare const stripeStoreHandleInventoryCheck: () => Promise<string | null>;
98
+ /**
99
+ * Handle inventory check and returns error message if the callback provided.
100
+ */
101
+ declare const stripeStoreHandleInventoryRefund: () => Promise<void>;
94
102
  declare const stripeStoreRetrievePayment: ({ clientSecret: _clientSecret, storybookForceStatus, }: {
95
103
  clientSecret: string | null;
96
104
  storybookForceStatus?: PaymentIntent['status'];
@@ -126,7 +134,7 @@ declare const stripeStoreInitCheckoutSession: () => Promise<boolean>;
126
134
  * Update checkout session. Use for updating amount with landed cost id, or update session when cart items change
127
135
  */
128
136
  declare const stripeStoreUpdateCheckoutSession: ({ adjustmentsAmount, cartId, currency, id, itemsAmount, landedCostId, presentmentCountryCode, }: CheckoutSessionUpdateRequest) => Promise<{
129
- errors: import("../../..").JsonError[];
137
+ errors: import("src/types").JsonError[];
130
138
  json: CheckoutSessionUpdateMutation | null;
131
139
  }>;
132
140
  /**
@@ -144,4 +152,4 @@ declare const stripeStoreTranslateAddressToLatin: ({ addressInvalidCharactersLis
144
152
  addressInvalidCharactersList: ReturnType<typeof containsNonLatinChars> | null;
145
153
  billingAddressInvalidCharactersList: ReturnType<typeof containsNonLatinChars> | null;
146
154
  }) => Promise<void>;
147
- export { initStripeElements, stripeCalculateLandedCost, stripeStore, stripeStoreApplyPromoCode, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreGetDomesticShippingSession, stripeStoreHandleInventoryCheck, stripeStoreInitCheckoutSession, stripeStoreMessageBasedOnStatus, stripeStorePrefetchLandedCost, stripeStoreRemovePromoCode, stripeStoreReset, stripeStoreResetPromoCode, stripeStoreRetrievePayment, stripeStoreSaveDomesticShippingSession, stripeStoreTranslateAddressToLatin, stripeStoreUpdateCheckoutSession, };
155
+ export { initStripeElements, stripeCalculateLandedCost, stripeStore, stripeStoreApplyPromoCode, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreGetDomesticShippingSession, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStoreMessageBasedOnStatus, stripeStorePrefetchLandedCost, stripeStoreRemovePromoCode, stripeStoreReset, stripeStoreResetPromoCode, stripeStoreRetrievePayment, stripeStoreSaveDomesticShippingSession, stripeStoreTranslateAddressToLatin, stripeStoreUpdateCheckoutSession, };
@@ -329,6 +329,9 @@ export declare const stringsArabic: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsBase: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsChinese: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsDanish: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsDutch: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsFrench: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsGerman: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsHebrew: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsIndonesian: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsItalian: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsJapanese: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsKorean: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsNorwegian: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsPolish: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsPortuguese: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsRussian: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsSpanish: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsSwedish: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsTurkish: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -329,6 +329,9 @@ export declare const stringsVietnamese: {
329
329
  'The following items are unable to be shipped to your country and are not included in your cart total.': {
330
330
  value: string;
331
331
  };
332
+ "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability.": {
333
+ value: string;
334
+ };
332
335
  'The low-value GST law passed July 1st, 2018 applies to this retailer.': {
333
336
  value: string;
334
337
  };
@@ -32,4 +32,4 @@ export type ITranslationKey = keyof typeof stringsBase;
32
32
  * // No variables:
33
33
  * translate('Above de minimis threshold for')
34
34
  */
35
- export declare const translate: <T extends "Shipping" | "Email" | "Name" | "Quantity" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "Delivery" | "Payment" | " (Duties due at door)" | " (Duties prepaid)" | "Above de minimis threshold for" | "Add promotional code" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Apply" | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery options" | "Discounts" | "Don't close" | "Due at delivery" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties and taxes will be charged upon delivery." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Estimated" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Hide non-prepaid options" | "Invalid promo code" | "It looks like you placed an order just a few minutes ago ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?" | "It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at delivery" | "Nothing due at the door" | "Order complete!" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Proceed with order" | "Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions." | "Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions." | "Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions." | "Product prices already include duties. No additional duties will be added at checkout, with rare exceptions." | "Product prices already include fees. No additional fees will be added at checkout, with rare exceptions." | "Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions." | "Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Return to merchant site" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Show" | "Show non-prepaid options" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You may incur additional fees from the shipping carrier by not prepaying." | "You will be redirected back to the merchant's site in a few seconds." | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "Your order has been successfully placed." | "Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "days" | "restricted items" | "weeks">(...[key, replacement]: TranslateParams<T>) => string;
35
+ export declare const translate: <T extends "Shipping" | "Email" | "Name" | "Quantity" | "Guaranteed" | "Customer" | "Country" | "Failure" | "Success" | "Hide" | "Delivery" | "Payment" | " (Duties due at door)" | " (Duties prepaid)" | "Above de minimis threshold for" | "Add promotional code" | "Address" | "Address line 1" | "Address line 2" | "An unexpected error occurred when processing PayPal order." | "Apply" | "Are you sure?" | "Back" | "Billing" | "Billing address" | "Cancel" | "Card number copied to clipboard" | "Cart subtotal" | "City" | "Click to copy the card number. Use any future expiration date and three number CVC." | "Close" | "Contact" | "Continue to shipping" | "Couldn't place order" | "Customer information" | "Delivery options" | "Discounts" | "Don't close" | "Due at delivery" | "Duties & taxes in Australia, VAT or GST is [percentage] and is due on all orders." | "Duties and taxes will be applied to items and shipping." | "Duties and taxes will be charged upon delivery." | "Duties will apply to all orders." | "Duties, taxes, and fees" | "Error creating Checkout" | "Error updating Checkout" | "Estimated" | "Expected delivery" | "Failed to create PayPal order. Please try again, or consider using an alternative method." | "First name" | "Go to payment" | "Hide non-prepaid options" | "Invalid promo code" | "It looks like you placed an order just a few minutes ago ([date] at [time]) under order number #[orderNumber]. Check your email for the order confirmation. Are you sure you want to place another order?" | "It looks like you placed an order just a few minutes ago ([date] at [time]). Check your email for the order confirmation. Are you sure you want to place another one?" | "Know about duties and taxes before you buy. Shop with confidence!" | "Last name" | "Learn more." | "Missing required fields. Make sure all fields are completed." | "No countries found" | "No shipping method selected" | "No shipping methods found - please review and update your address details by selecting the \"Customer\" tab above. If you continue to encounter issues, contact our support team for assistance." | "No shipping methods found - try editing your address or contacting support if the error persists" | "Nothing due at delivery" | "Nothing due at the door" | "Order complete!" | "Order total" | "Orders to [countryName] must be over [threshold] to ship." | "Pay [orderTotal]" | "Pay [organizationName]" | "Payment failed" | "Payment failed. Please try another payment method." | "Payment method" | "Payment processing. We'll update you when payment is received." | "Phone number" | "Please ensure your text uses the Latin alphabet only (A-Z, a-z)." | "Postal code" | "Powered by" | "Prepay duties and taxes at checkout" | "Proceed with order" | "Product prices already include duties and fees. No additional duties or fees will be added at checkout, with rare exceptions." | "Product prices already include duties and taxes. No additional duties or taxes will be added at checkout, with rare exceptions." | "Product prices already include duties, taxes, and fees. No additional duties, taxes, or fees will be added at checkout, with rare exceptions." | "Product prices already include duties. No additional duties will be added at checkout, with rare exceptions." | "Product prices already include fees. No additional fees will be added at checkout, with rare exceptions." | "Product prices already include taxes and fees. No additional taxes or fees will be added at checkout, with rare exceptions." | "Product prices already include taxes. No additional taxes will be added at checkout, with rare exceptions." | "Reload" | "Restricted item" | "Restricted items found" | "Return to cart" | "Return to merchant site" | "Search countries" | "See duty and tax thresholds" | "Select a country" | "Select a language" | "Session timed out" | "Shipping address same as billing" | "Shipping method" | "Show" | "Show non-prepaid options" | "Something went wrong." | "Spend [threshold] duty free." | "Spend [threshold] tax free." | "State" | "State/Province" | "Taxes will apply to all orders." | "Test cards" | "Test mode" | "The following items are unable to be shipped to your country and are not included in your cart total." | "The item you're looking for is currently unavailable in our inventory. Please check back later or contact support for assistance with availability." | "The low-value GST law passed July 1st, 2018 applies to this retailer." | "There's been an error creating your checkout session. Please reload and try again or contact support if the error persists" | "There's been an error updating your checkout session. Please reload and try again or contact support if the error persists" | "To ensure delivery all address details must be in Latin characters." | "Translated address" | "Unable to check inventory. Please try again." | "Update address" | "Update your address" | "We couldn't complete your payment. Please verify the payment details and try again." | "We've sent an email confirmation of the order details for your review. And our team is carefully preparing your order so it arrives on time." | "Welcome to [storeName]" | "Welcome!" | "What you entered" | "Would you like to close checkout and return to the site?" | "You may incur additional fees from the shipping carrier by not prepaying." | "You will be redirected back to the merchant's site in a few seconds." | "You're all set!" | "Your checkout session has expired. Please reload the page to continue." | "Your order has been successfully placed." | "Your payment went through successfully! Thank you for shopping with us! We hope you had an enjoyable experience and your support means the world to us." | "[percentage] GST due on any order above [threshold] along with an import entry transaction fee and MPI levy." | "[percentage] GST due on any order above [threshold]." | "business days" | "click to learn more" | "days" | "restricted items" | "weeks">(...[key, replacement]: TranslateParams<T>) => string;
@@ -1,10 +1,11 @@
1
1
  import type { CartAdjustmentType, CountryCode, CurrencyCode, ItemMeasurementType, ItemType, ItemUnitOfMeasure } from "../../generated/graphql.internal.types";
2
+ export type NormalizedItemAttribute = {
3
+ key: string;
4
+ value: string;
5
+ };
2
6
  export type NormalizedTempCartItem = {
3
7
  amount: number;
4
- attributes: {
5
- key: string;
6
- value: string;
7
- }[];
8
+ attributes: NormalizedItemAttribute[];
8
9
  countryOfOrigin: CountryCode | null;
9
10
  currencyCode: CurrencyCode;
10
11
  description: string | null;
@@ -27,11 +28,17 @@ export type NormalizedTempCart = {
27
28
  currencyCode: CurrencyCode;
28
29
  description: string;
29
30
  productId: string | null;
31
+ promoCode?: string | null;
30
32
  sku: string | null;
31
33
  type: CartAdjustmentType;
32
34
  }[];
33
35
  credentialToken: string;
36
+ id: string;
34
37
  items: NormalizedTempCartItem[];
38
+ metadata: {
39
+ key: string;
40
+ value: string;
41
+ }[];
35
42
  storeBaseUrl: string;
36
43
  storeId: number;
37
44
  };
@@ -0,0 +1,9 @@
1
+ import type { NormalizedTempCart } from "../NormalizedTempCart";
2
+ export type LegacyInventoryCheckPayload = {
3
+ cartData: NormalizedTempCart;
4
+ };
5
+ export type LegacyInventoryCheckResponse = {
6
+ available: boolean;
7
+ errors: unknown[];
8
+ status: number;
9
+ };
@@ -3,6 +3,7 @@ export * from '../components.d';
3
3
  export type { CartItem, ItemMeasurement, } from '../components/store/checkout/cart';
4
4
  export * from './checkout/api/CalculateLandedCost';
5
5
  export * from './checkout/api/CheckoutSession';
6
+ export * from './checkout/api/legacy/InventoryCheck';
6
7
  export * from './checkout/api/NormalizedTempCart';
7
8
  export * from './checkout/api/Paypal';
8
9
  export * from './checkout/api/StoreDiscountEnabled';
@@ -1 +1 @@
1
- import{l as e,a as n}from"./p-970fa103.js";import{s as t,c as o}from"./p-56d405d0.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-56d405d0.js";const s=["jsdelivr","cdnjs","unpkg","vercel"],r="jsdelivr",i=e=>{const n=s.indexOf(e);return s[n+1]||null},l="https://js.stripe.com/v3",u=/^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 m=null;const p=Promise.resolve().then((()=>{return e=null,null!==m||(m=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)t(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&u.test(t.src))return t}return null})();s&&e?console.warn(a):s||(s=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${l}${t}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),m;var e}));let w=!1;var f;p.catch((e=>{w||console.warn(e)}));const h=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),v="https://v1.3.111.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.111",z="https://rsms.me",j="https://fonts.googleapis.com",S=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class g{}f=g,g.doneInit=!1,g.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),g.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),g._paypalMockResponse=null,g.isBigCommerce=!1,g.releaseDate="1730241918819",g.isLegacyCheckout=!1,g.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.111",g.modeAlerted=!1,g.cartData=null,g.paypal=null,g.getCurrentTimestamp=()=>(new Date).getTime(),g.zonosController=null,g.init=async({appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:a})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=a,f.storeId=u,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!a&&!f.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!f.cartData&&f.cartId){e("Initialize cart data");const o=await t(f.cartId);if(!o)return void n("Failed to get cart data");f.cartData=o.cartData,f.zonosApiKey=o.zonosApiKey}}if(f.cartId&&f.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${o}`,document.body.appendChild(n)}e("init zonos"),f.injectZonosCdn(),f.injectZonosCss(),f.injectFonts(),f.injectController({config:{appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d}}),f.doneInit=!0}},g.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},g.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},g.showNotification=e=>{var n;null===(n=f.zonosController)||void 0===n||n.showNotification(e)},g.updateOrganizationName=e=>{var n;null===(n=f.zonosController)||void 0===n||n.updateOrganizationName(e)},g.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},g.injectController=({config:t})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=t.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=t,s.zonosApiKey=f.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const r=await(async(...e)=>{w=!0;const n=Date.now();return p.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),f.zonosController=s,e("Zonos controller injected!")},g.injectScript=({cdnType:t,isModule:o,theRestUrl:s})=>{const r=`${f.getZonosUrl(t)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const c=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=r,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const e=i(t);e&&f.injectScript({cdnType:e,isModule:o,theRestUrl:s})},c.appendChild(l)},g.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.111";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.111";case"vercel":return v}};return f.isNpm&&(()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.111.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' 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,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s})()||t()},g.injectZonosCdn=()=>{f.injectScript({cdnType:r,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),f.injectScript({cdnType:r,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},g.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=f.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${v}/`,s.appendChild(r);const c=document.createElement("link");c.rel="stylesheet",c.href=`${o}/${t}`,c.onerror=()=>{n(`Failed to load ${c.href}`);const o=i(e);o&&f.injectStylesheet({cdnType:o,theRestUrl:t})},s.appendChild(c)},g.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(f.injectStylesheet({cdnType:r,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},g.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!S.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=z,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${z}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},g.setupGoogleFont=e=>{var n;null===(n=f.zonosController)||void 0===n||n.setupGoogleFont(e)},g.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${j}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=j,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{g as Zonos}
1
+ import{l as e,a as n}from"./p-970fa103.js";import{s as t,c as o}from"./p-56d405d0.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-56d405d0.js";const s=["jsdelivr","cdnjs","unpkg","vercel"],r="jsdelivr",i=e=>{const n=s.indexOf(e);return s[n+1]||null},l="https://js.stripe.com/v3",u=/^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 m=null;const p=Promise.resolve().then((()=>{return e=null,null!==m||(m=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(a),window.Stripe)t(window.Stripe);else try{let s=(()=>{const e=document.querySelectorAll(`script[src^="${l}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&u.test(t.src))return t}return null})();s&&e?console.warn(a):s||(s=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${l}${t}`;const s=document.head||document.body;return s?(s.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==s||s.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==s||s.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),m;var e}));let w=!1;var f;p.catch((e=>{w||console.warn(e)}));const h=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),o=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:o,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?n:null})(),v="https://v1.3.112.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.112",z="https://rsms.me",j="https://fonts.googleapis.com",S=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class g{}f=g,g.doneInit=!1,g.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),g.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),g._paypalMockResponse=null,g.isBigCommerce=!1,g.releaseDate="1730313605923",g.isLegacyCheckout=!1,g.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.112",g.modeAlerted=!1,g.cartData=null,g.paypal=null,g.getCurrentTimestamp=()=>(new Date).getTime(),g.zonosController=null,g.init=async({appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:a})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=a,f.storeId=u,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!a&&!f.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!f.cartData&&f.cartId){e("Initialize cart data");const o=await t(f.cartId);if(!o)return void n("Failed to get cart data");f.cartData=o.cartData,f.zonosApiKey=o.zonosApiKey}}if(f.cartId&&f.cartData){e("Cart data is available, inject hidden button and trigger checkout");const n=document.createElement("button");n.style.display="none",n.id=`${o}`,document.body.appendChild(n)}e("init zonos"),f.injectZonosCdn(),f.injectZonosCss(),f.injectFonts(),f.injectController({config:{appearance:s,checkoutSettings:r,currencyConverter:i,helloSettings:c,onCountryChange:l,overrideCurrencyFormat:d}}),f.doneInit=!0}},g.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},g.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},g.showNotification=e=>{var n;null===(n=f.zonosController)||void 0===n||n.showNotification(e)},g.updateOrganizationName=e=>{var n;null===(n=f.zonosController)||void 0===n||n.updateOrganizationName(e)},g.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:t,placeOrderButtonSelector:o})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&o){const n=document.querySelectorAll(o),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&t&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},g.injectController=({config:t})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=t.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{f.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const s=document.createElement("zonos-controller");s.config=t,s.zonosApiKey=f.zonosApiKey||"",s.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const r=await(async(...e)=>{w=!0;const n=Date.now();return p.then((t=>((e,n,t)=>{if(null===e)return null;const o=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(o,t),o})(t,e,n)))})(o.publishableKey);r?(window.Zonos.stripe=r,s.initCheckoutElement(r)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(s),f.zonosController=s,e("Zonos controller injected!")},g.injectScript=({cdnType:t,isModule:o,theRestUrl:s})=>{const r=`${f.getZonosUrl(t)}/${s}`;if(document.querySelector(`script[src="${r}"]`))return void e(`Zonos script "${r}" already exists in the document`,"warn");const c=document.head||document.body,l=document.createElement("script");o?l.type="module":l.noModule=!0,l.src=r,l.crossOrigin="anonymous",l.onerror=()=>{n(`Failed to load ${l.src}`);const e=i(t);e&&f.injectScript({cdnType:e,isModule:o,theRestUrl:s})},c.appendChild(l)},g.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return y;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.112";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.112";case"vercel":return v}};return f.isNpm&&(()=>{const n=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||n)return null;const t=(e=>{if(!e)return null;const n=new URL(e).searchParams.get("zonosQaUrl");return n?/[^a-zA-Z0-9-_]+/.test(n)?null:n:null})(window.location.href),o="https://v1.3.112.js.zonos.com";if(!t&&(o.includes("test.")||o.includes("test-")))return o;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const s=`https://${t}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${s}' for loading elements script`,"warn"),fetch(s).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${s}' 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,t=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),s})()||t()},g.injectZonosCdn=()=>{f.injectScript({cdnType:r,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),f.injectScript({cdnType:r,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},g.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=f.getZonosUrl(e),s=document.head||document.body,r=document.createElement("link");r.rel="preconnect",r.href=`${v}/`,s.appendChild(r);const c=document.createElement("link");c.rel="stylesheet",c.href=`${o}/${t}`,c.onerror=()=>{n(`Failed to load ${c.href}`);const o=i(e);o&&f.injectStylesheet({cdnType:o,theRestUrl:t})},s.appendChild(c)},g.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(f.injectStylesheet({cdnType:r,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},g.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${z}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!S.test(t.href))return t}return null})())return void e("Inter font already injected","warn");const n=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=z,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${z}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},g.setupGoogleFont=e=>{var n;null===(n=f.zonosController)||void 0===n||n.setupGoogleFont(e)},g.injectSupportGoogleFont=n=>{var t;e(`[FONT] injecting ${n}`);const o=null===(t=n.match(/family=(.*?):/))||void 0===t?void 0:t[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${j}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=j,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${n}"]`))return void e(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=n,s.appendChild(r),e(`[FONT] ${o} font injected!`)};export{g as Zonos}