@zonos/elements 1.3.100 → 1.3.102

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 (190) hide show
  1. package/dist/cjs/{cart-ba56e884.js → cart-213f42f0.js} +2 -1
  2. package/dist/cjs/{createCustomEvent-56d8ca50.js → createCustomEvent-f2792ab7.js} +1 -1
  3. package/dist/cjs/index.cjs.js +9 -7
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{paypal-184805ac.js → paypal-d881282c.js} +1 -1
  6. package/dist/cjs/zonos-address_7.cjs.entry.js +5 -5
  7. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  8. package/dist/cjs/zonos-button_3.cjs.entry.js +2 -2
  9. package/dist/cjs/{zonos-cart-items_12.cjs.entry.js → zonos-cart-items_13.cjs.entry.js} +128 -38
  10. package/dist/cjs/zonos-checkout.cjs.entry.js +20 -6
  11. package/dist/cjs/zonos-component.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-country-select_4.cjs.entry.js +7 -7
  15. package/dist/cjs/zonos-elements.cjs.js +1 -1
  16. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  17. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  18. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  19. package/dist/cjs/zonos-notification_3.cjs.entry.js +4 -4
  20. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-toggle.cjs.entry.js +32 -0
  22. package/dist/cjs/zonos-tooltip.cjs.entry.js +3 -3
  23. package/dist/cjs/zonos-v-stack.cjs.entry.js +2 -2
  24. package/dist/collection/collection-manifest.json +2 -0
  25. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.css +1 -1
  26. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +1 -1
  27. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +6 -7
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +3 -3
  29. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +20 -14
  30. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +1 -1
  31. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/assets/globe.svg +1 -1
  32. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/assets/zonosIcon.svg +1 -1
  33. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +1 -1
  34. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +3 -3
  35. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +3 -1
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +5 -1
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-currency-toggle/zonos-currency-toggle.js +41 -0
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +4 -4
  39. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +19 -6
  40. package/dist/collection/components/common/zonos-banner/zonos-banner.js +1 -1
  41. package/dist/collection/components/common/zonos-button/zonos-button.css +2 -2
  42. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +1 -1
  43. package/dist/collection/components/common/zonos-icon/zonos-icon.js +3 -3
  44. package/dist/collection/components/common/zonos-text/zonos-text.js +2 -2
  45. package/dist/collection/components/common/zonos-toggle/zonos-toggle.css +79 -0
  46. package/dist/collection/components/common/zonos-toggle/zonos-toggle.js +92 -0
  47. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.css +1 -1
  48. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  49. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  50. package/dist/collection/components/common/zonos-virtual-scroll/zonos-virtual-scroll.js +2 -2
  51. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  52. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/globe.svg +1 -1
  53. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/assets/zonosIcon.svg +1 -1
  54. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  55. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  56. package/dist/collection/components/main/zonos-controller.js +1 -1
  57. package/dist/collection/components/paypal/zonos-paypal-payment.js +1 -1
  58. package/dist/collection/components/store/checkout/cart.js +2 -1
  59. package/dist/collection/components/stripe/zonos-address/zonos-address.js +1 -1
  60. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
  61. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  62. package/dist/collection/components/utils/api/isStoreDiscountEnabled.js +11 -0
  63. package/dist/collection/components/utils/checkout/getDisplayCurrency.js +9 -0
  64. package/dist/collection/components/utils/checkout/renderCheckoutCurrency.js +31 -0
  65. package/dist/collection/scripts/_zonosBase.js +2 -0
  66. package/dist/collection/types/checkout/api/StoreDiscountEnabled.js +1 -0
  67. package/dist/collection/types/common-ui/Toggle.js +1 -0
  68. package/dist/collection/types/generated/graphql.internal.types.js +8 -4
  69. package/dist/collection/types/index.js +1 -0
  70. package/dist/collection/types/styles/Color.js +2 -1
  71. package/dist/esm/{cart-b7bbf95b.js → cart-9a4c155b.js} +2 -1
  72. package/dist/esm/{createCustomEvent-4bfd1290.js → createCustomEvent-65611cd0.js} +1 -1
  73. package/dist/esm/index.js +9 -7
  74. package/dist/esm/loader.js +1 -1
  75. package/dist/esm/{paypal-5eaa95d4.js → paypal-63e83a4a.js} +1 -1
  76. package/dist/esm/zonos-address_7.entry.js +5 -5
  77. package/dist/esm/zonos-banner.entry.js +1 -1
  78. package/dist/esm/zonos-button_3.entry.js +2 -2
  79. package/dist/esm/{zonos-cart-items_12.entry.js → zonos-cart-items_13.entry.js} +128 -39
  80. package/dist/esm/zonos-checkout.entry.js +20 -6
  81. package/dist/esm/zonos-component.entry.js +1 -1
  82. package/dist/esm/zonos-controller.entry.js +2 -2
  83. package/dist/esm/zonos-country-flag.entry.js +1 -1
  84. package/dist/esm/zonos-country-select_4.entry.js +7 -7
  85. package/dist/esm/zonos-elements.js +1 -1
  86. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  87. package/dist/esm/zonos-hello.entry.js +1 -1
  88. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  89. package/dist/esm/zonos-notification_3.entry.js +4 -4
  90. package/dist/esm/zonos-text.entry.js +1 -1
  91. package/dist/esm/zonos-toggle.entry.js +28 -0
  92. package/dist/esm/zonos-tooltip.entry.js +3 -3
  93. package/dist/esm/zonos-v-stack.entry.js +2 -2
  94. package/dist/esm-es5/{cart-b7bbf95b.js → cart-9a4c155b.js} +1 -1
  95. package/dist/esm-es5/{createCustomEvent-4bfd1290.js → createCustomEvent-65611cd0.js} +1 -1
  96. package/dist/esm-es5/index.js +1 -1
  97. package/dist/esm-es5/loader.js +1 -1
  98. package/dist/esm-es5/{paypal-5eaa95d4.js → paypal-63e83a4a.js} +1 -1
  99. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  100. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  101. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  102. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -0
  103. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  104. package/dist/esm-es5/zonos-component.entry.js +1 -1
  105. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  106. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  107. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  108. package/dist/esm-es5/zonos-elements.js +1 -1
  109. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  110. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  111. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  112. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  113. package/dist/esm-es5/zonos-text.entry.js +1 -1
  114. package/dist/esm-es5/zonos-toggle.entry.js +1 -0
  115. package/dist/esm-es5/zonos-tooltip.entry.js +1 -1
  116. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  117. package/dist/scripts/index.d.ts +78 -4
  118. package/dist/scripts/index.js +1 -1
  119. package/dist/scripts/loadZonos.js +1 -1
  120. package/dist/scripts/zonos.js +1 -1
  121. package/dist/types/components/checkout/zonos-checkout/zonos-currency-toggle/zonos-currency-toggle.d.ts +5 -0
  122. package/dist/types/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.d.ts +2 -0
  123. package/dist/types/components/common/zonos-icon/zonos-icon.d.ts +1 -1
  124. package/dist/types/components/common/zonos-toggle/zonos-toggle.d.ts +17 -0
  125. package/dist/types/components/store/checkout/cart.d.ts +8 -0
  126. package/dist/types/components/utils/api/isStoreDiscountEnabled.d.ts +6 -0
  127. package/dist/types/components/utils/checkout/getDisplayCurrency.d.ts +1 -0
  128. package/dist/types/components/utils/checkout/renderCheckoutCurrency.d.ts +10 -0
  129. package/dist/types/components.d.ts +65 -2
  130. package/dist/types/scripts/_zonosBase.d.ts +7 -0
  131. package/dist/types/types/checkout/api/StoreDiscountEnabled.d.ts +3 -0
  132. package/dist/types/types/common-ui/Toggle.d.ts +5 -0
  133. package/dist/types/types/generated/graphql.internal.types.d.ts +14 -5
  134. package/dist/types/types/generated/graphql.internal.types.ts +24 -8
  135. package/dist/types/types/index.d.ts +1 -0
  136. package/dist/types/types/styles/Color.d.ts +2 -2
  137. package/dist/zonos-elements/index.esm.js +1 -1
  138. package/dist/zonos-elements/{p-93e2a2ed.system.entry.js → p-06b63d33.system.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-c60675df.entry.js → p-076413a3.entry.js} +1 -1
  140. package/dist/zonos-elements/{p-5400d785.entry.js → p-0af4e659.entry.js} +1 -1
  141. package/dist/zonos-elements/{p-01cb4d70.system.entry.js → p-0ba0151f.system.entry.js} +1 -1
  142. package/dist/zonos-elements/{p-afad2fae.entry.js → p-1a9a51bf.entry.js} +1 -1
  143. package/dist/zonos-elements/p-1b1f2e33.system.entry.js +1 -0
  144. package/dist/zonos-elements/{p-2b62fe10.system.entry.js → p-1c9972d5.system.entry.js} +1 -1
  145. package/dist/zonos-elements/{p-7aa41ee0.system.entry.js → p-203d901c.system.entry.js} +1 -1
  146. package/dist/zonos-elements/{p-e3e9983b.entry.js → p-2aa5575f.entry.js} +1 -1
  147. package/dist/zonos-elements/p-2d77afbc.entry.js +1 -0
  148. package/dist/zonos-elements/{p-22e81fee.system.entry.js → p-32c29205.system.entry.js} +1 -1
  149. package/dist/zonos-elements/{p-10392331.entry.js → p-36eaad7e.entry.js} +1 -1
  150. package/dist/zonos-elements/{p-6df9bd63.system.js → p-38b8a13d.system.js} +2 -2
  151. package/dist/zonos-elements/p-3deca7bd.system.js +1 -0
  152. package/dist/zonos-elements/{p-c1494500.system.js → p-419c27c5.system.js} +1 -1
  153. package/dist/zonos-elements/{p-c5bd3dd0.system.js → p-4814d204.system.js} +1 -1
  154. package/dist/zonos-elements/{p-3e29a09d.system.entry.js → p-481a5dde.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-4c06d4d9.system.entry.js → p-489029d9.system.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-ea68ee1f.entry.js → p-4eb3e354.entry.js} +1 -1
  157. package/dist/zonos-elements/{p-8615f779.system.entry.js → p-4f97ab5c.system.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-3b1e79e6.system.entry.js → p-514b42a4.system.entry.js} +1 -1
  159. package/dist/zonos-elements/{p-ff3bd453.entry.js → p-5900a867.entry.js} +1 -1
  160. package/dist/zonos-elements/{p-b3c1a516.entry.js → p-6b1aee83.entry.js} +1 -1
  161. package/dist/zonos-elements/p-71fe8da9.entry.js +1 -0
  162. package/dist/zonos-elements/p-762a00e2.system.entry.js +1 -0
  163. package/dist/zonos-elements/{p-50d86fbe.system.entry.js → p-7cb4523f.system.entry.js} +1 -1
  164. package/dist/zonos-elements/p-86afd38a.entry.js +1 -0
  165. package/dist/zonos-elements/{p-2156c4b3.entry.js → p-8a384947.entry.js} +1 -1
  166. package/dist/zonos-elements/p-92b0a91c.entry.js +1 -0
  167. package/dist/zonos-elements/{p-74014018.system.entry.js → p-939d363c.system.entry.js} +1 -1
  168. package/dist/zonos-elements/{p-d249a632.entry.js → p-ad733913.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-5657fa8b.entry.js → p-ad7d949c.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-f6dad0d3.entry.js → p-b8850092.entry.js} +1 -1
  171. package/dist/zonos-elements/{p-7ac03155.js → p-bce83a4e.js} +1 -1
  172. package/dist/zonos-elements/{p-38886017.system.entry.js → p-bfd73737.system.entry.js} +1 -1
  173. package/dist/zonos-elements/p-c64a74bc.js +1 -0
  174. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  175. package/dist/zonos-elements/{p-32bc9718.entry.js → p-ca02bd48.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-0450d72d.js → p-d17fc7b5.js} +1 -1
  177. package/dist/zonos-elements/{p-fe6d226f.system.entry.js → p-d2da5f75.system.entry.js} +1 -1
  178. package/dist/zonos-elements/p-daec1676.system.entry.js +1 -0
  179. package/dist/zonos-elements/{p-10b7320c.system.entry.js → p-ee48a87e.system.entry.js} +1 -1
  180. package/dist/zonos-elements/zonos-elements.css +22 -22
  181. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  182. package/package.json +1 -1
  183. package/dist/esm-es5/zonos-cart-items_12.entry.js +0 -1
  184. package/dist/zonos-elements/p-38c109e5.system.entry.js +0 -1
  185. package/dist/zonos-elements/p-89ba9d89.entry.js +0 -1
  186. package/dist/zonos-elements/p-9bf95d37.system.entry.js +0 -1
  187. package/dist/zonos-elements/p-bcbf4821.entry.js +0 -1
  188. package/dist/zonos-elements/p-d3dfda31.system.js +0 -1
  189. package/dist/zonos-elements/p-d8cbd4ea.js +0 -1
  190. package/dist/zonos-elements/p-ecb8676d.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 l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(t).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(o,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(o,...a);break;case"info":d.info(o,...a);break;case"error":d.error(o,...a);break;default:d.groupCollapsed(o,...a),d.trace(),d.groupEnd()}},n=(e,...t)=>{o(e,"error",...t)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const t=r.indexOf(e);return r[t+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const t=(e=>{if(!e)return null;const t=new URL(e).searchParams.get("zonosQaUrl");return t?/[^a-zA-Z0-9-_]+/.test(t)?null:t:null})(window.location.href),n="https://v1.3.100.js.zonos.com";if(!t&&(n.includes("test.")||n.includes("test-")))return n;if(!t&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!t)return null;if("dev-elements"===t)return"https://dev.elements.zonos.com";const r=`https://${t}.preview.js.zonos.com`;return o(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:t}=window.location,o=`${t}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)t(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&c.test(o.src))return o}return null})();r&&e?console.warn(d):r||(r=(e=>{const t=document.createElement("script");t.src=`${a}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const t=w.indexOf(e),o=w[t+1];return o||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:t=!0,shouldThrow:o=!1})=>{try{return await e.json()}catch(e){if(o)throw e;return t&&console.error(e),null}},j=async({basePathType:e,options:t,path:o})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+o);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(t){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),t)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:t,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:t,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:t,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(o("sendErrorLog","warn",e,n,t),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:t,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const t=b();if(!t)return;fetch(`${g[t]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==t?void 0:t.headers,requestPayload:S(null===(r=null==t?void 0:t.body)||void 0===r?void 0:r.toString())||(null===(s=null==t?void 0:t.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(o(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:t,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const t="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:n,json:r}=await(async(e,t)=>{const n=y(t||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return o(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:t,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||n.length?null:r};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:t,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const t=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>t.includes(e))),n=["qa.js.zonos.com"].some((e=>t.includes(e)));return{currentLoadScriptUrl:t,isForceLoadVersionDomain:n,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?t:null})(),A="https://v1.3.100.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.100",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class P{}k=P,P.doneInit=!1,P.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),P.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),P._paypalMockResponse=null,P.isBigCommerce=!1,P.releaseDate="1729193940551",P.isLegacyCheckout=!1,P.isNpm=!0,P.zonosQaUrl=null,P.zonosQaUrlApi=null,P.version="v1.3.100",P.modeAlerted=!1,P.cartData=null,P.paypal=null,P.getCurrentTimestamp=()=>(new Date).getTime(),P.zonosController=null,P.init=async({appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(o(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(o("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){o("Initialize cart data");const e=await(async e=>{const t=await C(e);return o("[ZONOS - loadZonos] getting temp cart data","info",t),t?{cartData:t.cartData,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){o("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}o("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:t,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},P.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},P.openHelloDialog=e=>{const t=document.querySelector("zonos-hello");t&&t.openHelloDialog(null==e||e)},P.showNotification=e=>{var t;null===(t=k.zonosController)||void 0===t||t.showNotification(e)},P.updateOrganizationName=e=>{var t;null===(t=k.zonosController)||void 0===t||t.updateOrganizationName(e)},P.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)}},P.injectController=({config:e})=>{var t;if(document.querySelector("zonos-controller"))return;if(null===(t=e.checkoutSettings)||void 0===t?void 0:t.placeOrderButtonSelector){const t=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:t})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:t}=e;o("loading Stripe");const s=await(async(...e)=>{h=!0;const t=Date.now();return m.then((o=>((e,t,o)=>{if(null===e)return null;const n=e.apply(void 0,t);return((e,t)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:t})})(n,o),n})(o,e,t)))})(t.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,o("Zonos controller injected!")},P.injectScript=({cdnType:e,isModule:t,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void o(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");t?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const o=i(e);o&&k.injectScript({cdnType:o,isModule:t,theRestUrl:r})},l.appendChild(a)},P.getZonosUrl=e=>{const t=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.100";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.100";case"vercel":return A}};if(k.isNpm){return l()||t()}return t()},P.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),o("Zonos cdn script injected!")},P.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const o=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${o}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const o=i(e);o&&k.injectStylesheet({cdnType:o,theRestUrl:t})},r.appendChild(l)},P.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?o("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),o("Zonos style css injected!"))},P.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let t=0;t<e.length;t++){const o=e[t];if(o&&!$.test(o.href))return o}return null})())return void o("Inter font already injected","warn");const e=document.head||document.body,t=document.createElement("link");t.rel="preconnect",t.href=Z,e.appendChild(t);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),o("Zonos font injected!")},P.setupGoogleFont=e=>{var t;null===(t=k.zonosController)||void 0===t||t.setupGoogleFont(e)},P.injectSupportGoogleFont=e=>{var t;o(`[FONT] injecting ${e}`);const n=null===(t=e.match(/family=(.*?):/))||void 0===t?void 0:t[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void o(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),o(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=P)})();
1
+ (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const l=performance.now()-e,a=[`(${l>1e3?`${(l/1e3).toFixed(2)}s`:`${l.toFixed(2)}ms`})`,...r];a.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...a));let c=document.querySelector("iframe#zonos---debug-logging-iframe");c||(c=document.createElement("iframe"),c.id="zonos---debug-logging-iframe",c.style.display="none",c.style.opacity="0",c.style.position="absolute",c.style.top="-9999px",c.style.left="-9999px",c.style.width="1px",c.style.height="1px",c.style.border="none",c.style.overflow="hidden",c.style.visibility="hidden",document.body.appendChild(c));const d=(null===(i=c.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...a);break;case"info":d.info(t,...a);break;case"error":d.error(t,...a);break;default:d.groupCollapsed(t,...a),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},l=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.102.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},a="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,d="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let u=null;const p=e=>(null!==u||(u=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(d),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${a}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&c.test(t.src))return t}return null})();r&&e?console.warn(d):r||(r=(e=>{const o=document.createElement("script");o.src=`${a}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),u),m=Promise.resolve().then((()=>p(null)));let h=!1;m.catch((e=>{h||console.warn(e)}));function y(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const w=["cloudflare","vercel"],f=w[0],g={cloudflare:"https://route.elements.zonos.com",vercel:"https://v1.route.js.zonos.com"},v=g[f],b=(e=f)=>{const o=w.indexOf(e),t=w[o+1];return t||null},S=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},z=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{return await e.json()}catch(e){if(t)throw e;return o&&console.error(e),null}},j=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||g[e]||f,s=new URL(r+t);s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(window.location.hostname));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const i=n.headers.get("Zonos-Mode"),l=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&i&&l&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await z({response:n}),response:n,zonosMode:i}}const a=n.status.toString();try{const e=await z({response:n,shouldThrow:!0});return{baseUrl:r,errors:[{message:JSON.stringify(e),type:a}],json:null,response:n,zonosMode:i}}catch(e){return{baseUrl:r,errors:[{message:`${a}: ${"Unknown error"}`,type:a}],json:null,response:null,zonosMode:i}}},O=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,l=await j({basePathType:i,options:o,path:n}),{errors:a,response:c}=l,d=y(l,["errors","response"]),u=b(i),p=!!a.find((({type:e})=>"unknown"===e))||404===(null==c?void 0:c.status),m=u&&p;return p&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,metadata:Object.assign({href:window.location.href,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${v}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=b();if(!o)return;fetch(`${g[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:g[i]+n,errors:a.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:u,requestHeaders:null==o?void 0:o.headers,requestPayload:S(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==c?void 0:c.status,statusText:null==c?void 0:c.statusText},shouldPostReleaseErrorReporting:!0}),m?(t(`=== "${n}" failed to fetch, trying next fallback ${u}`),O({basePathType:u,options:o,path:n})):Object.assign({errors:a,response:c},d)},C=async e=>{const o="1"===new URLSearchParams(window.location.search).get("zonosTestMode"),{errors:n,json:r}=await(async(e,o)=>{const n=y(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers),l=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),a=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),O({basePathType:a||f,options:l,path:e})})("/api/zonos-elements/get-temp-cart",{body:{isTestMode:o,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"});return!r||n.length?null:r};var k;const E=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),A="https://v1.3.102.js.zonos.com",U=E||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.102",Z="https://rsms.me",T="https://fonts.googleapis.com",$=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class P{}k=P,P.doneInit=!1,P.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),P.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),P._paypalMockResponse=null,P.isBigCommerce=!1,P.releaseDate="1729271115577",P.isLegacyCheckout=!1,P.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),P.isNpm=!0,P.zonosQaUrl=null,P.zonosQaUrlApi=null,P.version="v1.3.102",P.modeAlerted=!1,P.cartData=null,P.paypal=null,P.getCurrentTimestamp=()=>(new Date).getTime(),P.zonosController=null,P.init=async({appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l,storeId:a,zonosApiKey:c})=>{if(k.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!k.doneInit){if(t(`====== ZONOS DEBUG MODE: on (${k.version}) ======`),k.zonosApiKey=c,k.storeId=a,k.isNpm){if(t("====== ZONOS LOADING FROM NPM ======"),!c&&!k.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!k.cartData&&k.cartId){t("Initialize cart data");const e=await(async e=>{const o=await C(e);return t("[ZONOS - loadZonos] getting temp cart data","info",o),o?{cartData:o.cartData,storeFavicon:o.storeFaviconUrl,storeId:o.cartData.storeId,storeLogo:o.storeLogoUrl,zonosApiKey:o.cartData.credentialToken}:(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(k.cartId);if(!e)return void n("Failed to get cart data");k.cartData=e.cartData,k.zonosApiKey=e.zonosApiKey}}if(k.cartId&&k.cartData){t("Cart data is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),k.injectZonosCdn(),k.injectZonosCss(),k.injectFonts(),k.injectController({config:{appearance:e,checkoutSettings:o,currencyConverter:r,helloSettings:s,onCountryChange:i,overrideCurrencyFormat:l}}),k.doneInit=!0}},P.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},P.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},P.showNotification=e=>{var o;null===(o=k.zonosController)||void 0===o||o.showNotification(e)},P.updateOrganizationName=e=>{var o;null===(o=k.zonosController)||void 0===o||o.updateOrganizationName(e)},P.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},P.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{k.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=k.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{h=!0;const o=Date.now();return m.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),k.zonosController=r,t("Zonos controller injected!")},P.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${k.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const l=document.head||document.body,a=document.createElement("script");o?a.type="module":a.noModule=!0,a.src=s,a.crossOrigin="anonymous",a.onerror=()=>{n(`Failed to load ${a.src}`);const t=i(e);t&&k.injectScript({cdnType:t,isModule:o,theRestUrl:r})},l.appendChild(a)},P.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return U;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.102";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.102";case"vercel":return A}};if(k.isNpm){return l()||o()}return o()},P.injectZonosCdn=()=>{k.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),k.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},P.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=k.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${A}/`,r.appendChild(s);const l=document.createElement("link");l.rel="stylesheet",l.href=`${t}/${o}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const t=i(e);t&&k.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(l)},P.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(k.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},P.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${Z}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!$.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=Z,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${Z}/inter/inter.css`,e.appendChild(n),t("Zonos font injected!")},P.setupGoogleFont=e=>{var o;null===(o=k.zonosController)||void 0===o||o.setupGoogleFont(e)},P.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${T}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=T,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},window.Zonos&&window.Zonos.doneInit||(window.Zonos=P)})();
@@ -0,0 +1,5 @@
1
+ export declare class ZonosCurrencyToggle {
2
+ errorImages: string[];
3
+ private handleToggleChanged;
4
+ render(): any;
5
+ }
@@ -32,6 +32,7 @@ export declare class ZonosShipping {
32
32
  serviceLevelsDAP: ShippingRichRadioItem[];
33
33
  serviceLevelsOther: ShippingRichRadioItem[];
34
34
  serviceLevelsAll: ShippingRichRadioItem[];
35
+ displayBaseCurrency: boolean;
35
36
  private handleRadioSelected;
36
37
  private handleValidate;
37
38
  private isOutdatedShippingData;
@@ -41,6 +42,7 @@ export declare class ZonosShipping {
41
42
  private continueClickHandler;
42
43
  private getLandedCostMethodLabelSuffix;
43
44
  private initServiceLevels;
45
+ private isCurrencyToggled;
44
46
  private preselectFirstShippingMethod;
45
47
  componentWillLoad(): void;
46
48
  render(): any;
@@ -7,7 +7,7 @@ export declare class ZonosIcon {
7
7
  autoHeight: boolean;
8
8
  /**
9
9
  * Color of the SVG
10
- * @default 'gray-1200'
10
+ * @default 'gray-1000'
11
11
  */
12
12
  iconColor: Color | (string & {
13
13
  _placeholder?: never;
@@ -0,0 +1,17 @@
1
+ import { type EventEmitter } from '../../../stencil-public-runtime';
2
+ import type { ToggleItem } from "../../../types/common-ui/Toggle";
3
+ export declare class ZonosToggle {
4
+ /**
5
+ * Options for the toggle
6
+ */
7
+ options: ToggleItem<string>[];
8
+ /**
9
+ * The selected option
10
+ */
11
+ value: string;
12
+ /**
13
+ * Event emitted when the toggle changes
14
+ */
15
+ toggleChanged: EventEmitter<string>;
16
+ render(): any;
17
+ }
@@ -67,6 +67,10 @@ type CartStore = {
67
67
  checkoutSessionTimeoutShow: boolean;
68
68
  checkoutTimeoutInterval: NodeJS.Timeout | null;
69
69
  currency: CurrencyCode;
70
+ /**
71
+ * Toggle to show the amount in base currency instead. Only applicable when url param `zonosShowBaseForeign` is set
72
+ */
73
+ displayBaseCurrency: boolean;
70
74
  dutiesTaxesFees: number | null;
71
75
  /**
72
76
  * For DAP
@@ -105,6 +109,10 @@ type CartStore = {
105
109
  selectedShippingOptionTransitTime: string;
106
110
  shipping: number;
107
111
  shippingData: ShipmentRatingFragment[] | null;
112
+ /**
113
+ * Hide discount input or not
114
+ */
115
+ shouldHideDiscountInput: boolean;
108
116
  step: Step;
109
117
  subtotal: number;
110
118
  tabItems: TabItems;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Check if store discount is enabled
3
+ */
4
+ export declare const isStoreDiscountEnabled: () => Promise<{
5
+ enabled: boolean;
6
+ }>;
@@ -0,0 +1 @@
1
+ export declare const getDisplayCurrency: () => import("../../../types/generated/graphql.internal.types").CurrencyCode;
@@ -0,0 +1,10 @@
1
+ type Params = {
2
+ amount: number;
3
+ isForeign: boolean;
4
+ };
5
+ /**
6
+ * Unified currency rendering for checkout amounts.
7
+ * @note This is only to display, not for calculations.
8
+ */
9
+ export declare const renderCheckoutCurrency: ({ amount, isForeign }: Params) => string;
10
+ export {};
@@ -24,6 +24,7 @@ import { AppearanceConfig as AppearanceConfig1 } from "./components.d";
24
24
  import { RestStateType } from "./components/utils/restStateType";
25
25
  import { ShippingRichRadioItem } from "./components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio";
26
26
  import { SpinnerColor } from "./components/common/zonos-spinner/zonos-spinner";
27
+ import { ToggleItem } from "./types/common-ui/Toggle";
27
28
  import { GridSpacing } from "./types/styles/GridSpacing";
28
29
  export { ContactOption, PaymentIntent, Stripe } from "@stripe/stripe-js";
29
30
  export { EnteredInfo, TranslatedAddressObject } from "./types/checkout/TranslatedText";
@@ -44,6 +45,7 @@ export { AppearanceConfig as AppearanceConfig1 } from "./components.d";
44
45
  export { RestStateType } from "./components/utils/restStateType";
45
46
  export { ShippingRichRadioItem } from "./components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio";
46
47
  export { SpinnerColor } from "./components/common/zonos-spinner/zonos-spinner";
48
+ export { ToggleItem } from "./types/common-ui/Toggle";
47
49
  export { GridSpacing } from "./types/styles/GridSpacing";
48
50
  export namespace Components {
49
51
  interface ZonosAddress {
@@ -573,6 +575,8 @@ export namespace Components {
573
575
  */
574
576
  "handleOnClose": () => void;
575
577
  }
578
+ interface ZonosCurrencyToggle {
579
+ }
576
580
  interface ZonosCustomMessage {
577
581
  /**
578
582
  * The custom message icon
@@ -771,7 +775,7 @@ export namespace Components {
771
775
  "content": string;
772
776
  /**
773
777
  * Color of the SVG
774
- * @default 'gray-1200'
778
+ * @default 'gray-1000'
775
779
  */
776
780
  "iconColor": Color | (string & { _placeholder?: never });
777
781
  /**
@@ -966,6 +970,16 @@ export namespace Components {
966
970
  */
967
971
  "weight"?: FontWeight;
968
972
  }
973
+ interface ZonosToggle {
974
+ /**
975
+ * Options for the toggle
976
+ */
977
+ "options": ToggleItem<string>[];
978
+ /**
979
+ * The selected option
980
+ */
981
+ "value": string;
982
+ }
969
983
  interface ZonosTooltip {
970
984
  /**
971
985
  * The title of the tooltip
@@ -1074,6 +1088,10 @@ export interface ZonosShippingRichRadioCustomEvent<T> extends CustomEvent<T> {
1074
1088
  detail: T;
1075
1089
  target: HTMLZonosShippingRichRadioElement;
1076
1090
  }
1091
+ export interface ZonosToggleCustomEvent<T> extends CustomEvent<T> {
1092
+ detail: T;
1093
+ target: HTMLZonosToggleElement;
1094
+ }
1077
1095
  declare global {
1078
1096
  interface HTMLZonosAddressElementEventMap {
1079
1097
  "invalidCharacters": boolean;
@@ -1306,6 +1324,12 @@ declare global {
1306
1324
  prototype: HTMLZonosCountrySelectElement;
1307
1325
  new (): HTMLZonosCountrySelectElement;
1308
1326
  };
1327
+ interface HTMLZonosCurrencyToggleElement extends Components.ZonosCurrencyToggle, HTMLStencilElement {
1328
+ }
1329
+ var HTMLZonosCurrencyToggleElement: {
1330
+ prototype: HTMLZonosCurrencyToggleElement;
1331
+ new (): HTMLZonosCurrencyToggleElement;
1332
+ };
1309
1333
  interface HTMLZonosCustomMessageElement extends Components.ZonosCustomMessage, HTMLStencilElement {
1310
1334
  }
1311
1335
  var HTMLZonosCustomMessageElement: {
@@ -1516,6 +1540,23 @@ declare global {
1516
1540
  prototype: HTMLZonosTextElement;
1517
1541
  new (): HTMLZonosTextElement;
1518
1542
  };
1543
+ interface HTMLZonosToggleElementEventMap {
1544
+ "toggleChanged": string;
1545
+ }
1546
+ interface HTMLZonosToggleElement extends Components.ZonosToggle, HTMLStencilElement {
1547
+ addEventListener<K extends keyof HTMLZonosToggleElementEventMap>(type: K, listener: (this: HTMLZonosToggleElement, ev: ZonosToggleCustomEvent<HTMLZonosToggleElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
1548
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1549
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1550
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
1551
+ removeEventListener<K extends keyof HTMLZonosToggleElementEventMap>(type: K, listener: (this: HTMLZonosToggleElement, ev: ZonosToggleCustomEvent<HTMLZonosToggleElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
1552
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1553
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
1554
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
1555
+ }
1556
+ var HTMLZonosToggleElement: {
1557
+ prototype: HTMLZonosToggleElement;
1558
+ new (): HTMLZonosToggleElement;
1559
+ };
1519
1560
  interface HTMLZonosTooltipElement extends Components.ZonosTooltip, HTMLStencilElement {
1520
1561
  }
1521
1562
  var HTMLZonosTooltipElement: {
@@ -1563,6 +1604,7 @@ declare global {
1563
1604
  "zonos-controller": HTMLZonosControllerElement;
1564
1605
  "zonos-country-flag": HTMLZonosCountryFlagElement;
1565
1606
  "zonos-country-select": HTMLZonosCountrySelectElement;
1607
+ "zonos-currency-toggle": HTMLZonosCurrencyToggleElement;
1566
1608
  "zonos-custom-message": HTMLZonosCustomMessageElement;
1567
1609
  "zonos-customer-info": HTMLZonosCustomerInfoElement;
1568
1610
  "zonos-dialog": HTMLZonosDialogElement;
@@ -1585,6 +1627,7 @@ declare global {
1585
1627
  "zonos-shipping-rich-radio": HTMLZonosShippingRichRadioElement;
1586
1628
  "zonos-spinner": HTMLZonosSpinnerElement;
1587
1629
  "zonos-text": HTMLZonosTextElement;
1630
+ "zonos-toggle": HTMLZonosToggleElement;
1588
1631
  "zonos-tooltip": HTMLZonosTooltipElement;
1589
1632
  "zonos-v-stack": HTMLZonosVStackElement;
1590
1633
  "zonos-virtual-scroll": HTMLZonosVirtualScrollElement;
@@ -2113,6 +2156,8 @@ declare namespace LocalJSX {
2113
2156
  */
2114
2157
  "handleOnClose"?: () => void;
2115
2158
  }
2159
+ interface ZonosCurrencyToggle {
2160
+ }
2116
2161
  interface ZonosCustomMessage {
2117
2162
  /**
2118
2163
  * The custom message icon
@@ -2294,7 +2339,7 @@ declare namespace LocalJSX {
2294
2339
  "content": string;
2295
2340
  /**
2296
2341
  * Color of the SVG
2297
- * @default 'gray-1200'
2342
+ * @default 'gray-1000'
2298
2343
  */
2299
2344
  "iconColor"?: Color | (string & { _placeholder?: never });
2300
2345
  /**
@@ -2505,6 +2550,20 @@ declare namespace LocalJSX {
2505
2550
  */
2506
2551
  "weight"?: FontWeight;
2507
2552
  }
2553
+ interface ZonosToggle {
2554
+ /**
2555
+ * Event emitted when the toggle changes
2556
+ */
2557
+ "onToggleChanged"?: (event: ZonosToggleCustomEvent<string>) => void;
2558
+ /**
2559
+ * Options for the toggle
2560
+ */
2561
+ "options"?: ToggleItem<string>[];
2562
+ /**
2563
+ * The selected option
2564
+ */
2565
+ "value": string;
2566
+ }
2508
2567
  interface ZonosTooltip {
2509
2568
  /**
2510
2569
  * The title of the tooltip
@@ -2576,6 +2635,7 @@ declare namespace LocalJSX {
2576
2635
  "zonos-controller": ZonosController;
2577
2636
  "zonos-country-flag": ZonosCountryFlag;
2578
2637
  "zonos-country-select": ZonosCountrySelect;
2638
+ "zonos-currency-toggle": ZonosCurrencyToggle;
2579
2639
  "zonos-custom-message": ZonosCustomMessage;
2580
2640
  "zonos-customer-info": ZonosCustomerInfo;
2581
2641
  "zonos-dialog": ZonosDialog;
@@ -2598,6 +2658,7 @@ declare namespace LocalJSX {
2598
2658
  "zonos-shipping-rich-radio": ZonosShippingRichRadio;
2599
2659
  "zonos-spinner": ZonosSpinner;
2600
2660
  "zonos-text": ZonosText;
2661
+ "zonos-toggle": ZonosToggle;
2601
2662
  "zonos-tooltip": ZonosTooltip;
2602
2663
  "zonos-v-stack": ZonosVStack;
2603
2664
  "zonos-virtual-scroll": ZonosVirtualScroll;
@@ -2630,6 +2691,7 @@ declare module "@stencil/core" {
2630
2691
  "zonos-controller": LocalJSX.ZonosController & JSXBase.HTMLAttributes<HTMLZonosControllerElement>;
2631
2692
  "zonos-country-flag": LocalJSX.ZonosCountryFlag & JSXBase.HTMLAttributes<HTMLZonosCountryFlagElement>;
2632
2693
  "zonos-country-select": LocalJSX.ZonosCountrySelect & JSXBase.HTMLAttributes<HTMLZonosCountrySelectElement>;
2694
+ "zonos-currency-toggle": LocalJSX.ZonosCurrencyToggle & JSXBase.HTMLAttributes<HTMLZonosCurrencyToggleElement>;
2633
2695
  "zonos-custom-message": LocalJSX.ZonosCustomMessage & JSXBase.HTMLAttributes<HTMLZonosCustomMessageElement>;
2634
2696
  "zonos-customer-info": LocalJSX.ZonosCustomerInfo & JSXBase.HTMLAttributes<HTMLZonosCustomerInfoElement>;
2635
2697
  "zonos-dialog": LocalJSX.ZonosDialog & JSXBase.HTMLAttributes<HTMLZonosDialogElement>;
@@ -2652,6 +2714,7 @@ declare module "@stencil/core" {
2652
2714
  "zonos-shipping-rich-radio": LocalJSX.ZonosShippingRichRadio & JSXBase.HTMLAttributes<HTMLZonosShippingRichRadioElement>;
2653
2715
  "zonos-spinner": LocalJSX.ZonosSpinner & JSXBase.HTMLAttributes<HTMLZonosSpinnerElement>;
2654
2716
  "zonos-text": LocalJSX.ZonosText & JSXBase.HTMLAttributes<HTMLZonosTextElement>;
2717
+ "zonos-toggle": LocalJSX.ZonosToggle & JSXBase.HTMLAttributes<HTMLZonosToggleElement>;
2655
2718
  "zonos-tooltip": LocalJSX.ZonosTooltip & JSXBase.HTMLAttributes<HTMLZonosTooltipElement>;
2656
2719
  "zonos-v-stack": LocalJSX.ZonosVStack & JSXBase.HTMLAttributes<HTMLZonosVStackElement>;
2657
2720
  /**
@@ -201,6 +201,12 @@ export interface Zonos {
201
201
  * Version release timestamp
202
202
  */
203
203
  releaseDate: string;
204
+ /**
205
+ * Show toggle on checkout modal to show amount in base or foreign currency.
206
+ * Set this to true or set param `zonosShowBaseForeign=1` in url to show the toggle
207
+ * @default false
208
+ */
209
+ showBaseForeign: boolean;
204
210
  storeId: number;
205
211
  /** Stripe instance */
206
212
  stripe: Stripe;
@@ -232,6 +238,7 @@ export declare abstract class Zonos {
232
238
  static isBigCommerce: boolean;
233
239
  static releaseDate: string;
234
240
  static isLegacyCheckout: boolean;
241
+ static showBaseForeign: boolean;
235
242
  /**
236
243
  * By default, the package will load from npm
237
244
  */
@@ -0,0 +1,3 @@
1
+ export type StoreDiscountEnabledResult = {
2
+ enabled: boolean;
3
+ };
@@ -0,0 +1,5 @@
1
+ export type ToggleItem<TValue> = {
2
+ isDisabled?: boolean;
3
+ label: string;
4
+ value: TValue;
5
+ };
@@ -161,11 +161,6 @@ export declare const apiUsageRecordType: {
161
161
  readonly ShipmentRating: "SHIPMENT_RATING";
162
162
  };
163
163
  export type ApiUsageRecordType = (typeof apiUsageRecordType)[keyof typeof apiUsageRecordType];
164
- export declare const bankAccountType: {
165
- readonly Checking: "CHECKING";
166
- readonly Savings: "SAVINGS";
167
- };
168
- export type BankAccountType = (typeof bankAccountType)[keyof typeof bankAccountType];
169
164
  export declare const batteryMaterialType: {
170
165
  readonly LithiumIon: "LITHIUM_ION";
171
166
  readonly LithiumMetal: "LITHIUM_METAL";
@@ -2456,6 +2451,7 @@ export declare const stripeConnectBusinessType: {
2456
2451
  readonly GovernmentEntity: "GOVERNMENT_ENTITY";
2457
2452
  readonly Individual: "INDIVIDUAL";
2458
2453
  readonly NonProfit: "NON_PROFIT";
2454
+ readonly PubliclyTraded: "PUBLICLY_TRADED";
2459
2455
  };
2460
2456
  export type StripeConnectBusinessType = (typeof stripeConnectBusinessType)[keyof typeof stripeConnectBusinessType];
2461
2457
  export declare const stripeConnectCapabilityStatus: {
@@ -2576,6 +2572,11 @@ export declare const transitTypeCode: {
2576
2572
  readonly Weeks: "WEEKS";
2577
2573
  };
2578
2574
  export type TransitTypeCode = (typeof transitTypeCode)[keyof typeof transitTypeCode];
2575
+ export declare const usBankAccountType: {
2576
+ readonly Checking: "CHECKING";
2577
+ readonly Savings: "SAVINGS";
2578
+ };
2579
+ export type UsBankAccountType = (typeof usBankAccountType)[keyof typeof usBankAccountType];
2579
2580
  export declare const usageRecordTypeCode: {
2580
2581
  readonly ApiUsage: "API_USAGE";
2581
2582
  readonly LcgInvoicing: "LCG_INVOICING";
@@ -3134,6 +3135,11 @@ export type GetCheckoutSessionQuery = {
3134
3135
  } | null;
3135
3136
  };
3136
3137
  };
3138
+ export type ActiveDiscountsQuery = {
3139
+ rules: {
3140
+ totalCount: number;
3141
+ } | null;
3142
+ };
3137
3143
  export type InclusivePriceSettingFieldsFragment = {
3138
3144
  duty: {
3139
3145
  status: InclusivePriceSettingAdjustmentStatus;
@@ -3741,6 +3747,9 @@ export type CartCreateMutation = {
3741
3747
  };
3742
3748
  export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string) => Promise<T>;
3743
3749
  export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {
3750
+ activeDiscounts(variables?: {
3751
+ [x: string]: never;
3752
+ }, requestHeaders?: GraphQLClientRequestHeaders): Promise<ActiveDiscountsQuery>;
3744
3753
  addTrackingNumber(variables?: {
3745
3754
  [x: string]: never;
3746
3755
  }, requestHeaders?: GraphQLClientRequestHeaders): Promise<AddTrackingNumberMutation>;
@@ -166,14 +166,6 @@ export const apiUsageRecordType = {
166
166
  export type ApiUsageRecordType =
167
167
  (typeof apiUsageRecordType)[keyof typeof apiUsageRecordType];
168
168
 
169
- export const bankAccountType = {
170
- Checking: 'CHECKING',
171
- Savings: 'SAVINGS',
172
- } as const;
173
-
174
- export type BankAccountType =
175
- (typeof bankAccountType)[keyof typeof bankAccountType];
176
-
177
169
  export const batteryMaterialType = {
178
170
  LithiumIon: 'LITHIUM_ION',
179
171
  LithiumMetal: 'LITHIUM_METAL',
@@ -3002,6 +2994,7 @@ export const stripeConnectBusinessType = {
3002
2994
  GovernmentEntity: 'GOVERNMENT_ENTITY',
3003
2995
  Individual: 'INDIVIDUAL',
3004
2996
  NonProfit: 'NON_PROFIT',
2997
+ PubliclyTraded: 'PUBLICLY_TRADED',
3005
2998
  } as const;
3006
2999
 
3007
3000
  export type StripeConnectBusinessType =
@@ -3157,6 +3150,13 @@ export const transitTypeCode = {
3157
3150
  export type TransitTypeCode =
3158
3151
  (typeof transitTypeCode)[keyof typeof transitTypeCode];
3159
3152
 
3153
+ export const usBankAccountType = {
3154
+ Checking: 'CHECKING',
3155
+ Savings: 'SAVINGS',
3156
+ } as const;
3157
+
3158
+ export type UsBankAccountType =
3159
+ (typeof usBankAccountType)[keyof typeof usBankAccountType];
3160
3160
  export const usageRecordTypeCode = {
3161
3161
  ApiUsage: 'API_USAGE',
3162
3162
  LcgInvoicing: 'LCG_INVOICING',
@@ -3664,6 +3664,8 @@ export type GetCheckoutSessionQuery = {
3664
3664
  checkoutSession: { order: { id: string } | null };
3665
3665
  };
3666
3666
 
3667
+ export type ActiveDiscountsQuery = { rules: { totalCount: number } | null };
3668
+
3667
3669
  export type InclusivePriceSettingFieldsFragment = {
3668
3670
  duty: { status: InclusivePriceSettingAdjustmentStatus };
3669
3671
  fee: { status: InclusivePriceSettingAdjustmentStatus };
@@ -4244,6 +4246,20 @@ export function getSdk(
4244
4246
  withWrapper: SdkFunctionWrapper = defaultWrapper,
4245
4247
  ) {
4246
4248
  return {
4249
+ activeDiscounts(
4250
+ variables?: { [x: string]: never },
4251
+ requestHeaders?: GraphQLClientRequestHeaders,
4252
+ ): Promise<ActiveDiscountsQuery> {
4253
+ return withWrapper(
4254
+ wrappedRequestHeaders =>
4255
+ client.request<ActiveDiscountsQuery>('', variables, {
4256
+ ...requestHeaders,
4257
+ ...wrappedRequestHeaders,
4258
+ }),
4259
+ 'activeDiscounts',
4260
+ 'query',
4261
+ );
4262
+ },
4247
4263
  addTrackingNumber(
4248
4264
  variables?: { [x: string]: never },
4249
4265
  requestHeaders?: GraphQLClientRequestHeaders,
@@ -5,6 +5,7 @@ export * from './checkout/api/CalculateLandedCost';
5
5
  export * from './checkout/api/CheckoutSession';
6
6
  export * from './checkout/api/NormalizedTempCart';
7
7
  export * from './checkout/api/Paypal';
8
+ export * from './checkout/api/StoreDiscountEnabled';
8
9
  export * from './checkout/api/ValidateAddress';
9
10
  export * from './checkout/CheckoutConfig';
10
11
  export * from './ConversionEvent';
@@ -1,7 +1,7 @@
1
1
  export declare const colorPrefixes: readonly ["blue", "cyan", "green", "orange", "purple", "red", "gray", "glass"];
2
- export declare const colorContrasts: readonly ["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000"];
2
+ export declare const colorContrasts: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
3
3
  export type ColorContrast = (typeof colorContrasts)[number];
4
4
  export type ColorPrefix = (typeof colorPrefixes)[number];
5
- export type Color = 'gray-0' | 'gray-50' | 'glass-0' | 'glass-50' | `${ColorPrefix}-${ColorContrast}` | 'gray-1100' | 'gray-1200' | 'glass-1100' | 'glass-1200';
5
+ export type Color = 'gray-0' | 'gray-50' | 'glass-0' | 'glass-50' | `${ColorPrefix}-${ColorContrast}` | 'gray-1000' | 'glass-1100' | 'glass-1200';
6
6
  export declare const checkboxColorPrefix: readonly ["blue", "cyan", "green", "orange", "purple", "red", "gray"];
7
7
  export type CheckboxColorPrefix = (typeof checkboxColorPrefix)[number];
@@ -1 +1 @@
1
- import{l as e,a as n}from"./p-539cc913.js";import{s as t,c as o}from"./p-aad51da3.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-aad51da3.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",a=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,u="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(u),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&&a.test(t.src))return t}return null})();s&&e?console.warn(u):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.100.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.100",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="1729193896484",g.isLegacyCheckout=!1,g.isNpm=!0,g.zonosQaUrl=null,g.zonosQaUrlApi=null,g.version="v1.3.100",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:a,zonosApiKey:u})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=u,f.storeId=a,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!u&&!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.100";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.100";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.100.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-539cc913.js";import{s as t,c as o}from"./p-aad51da3.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-aad51da3.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",a=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,u="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(u),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&&a.test(t.src))return t}return null})();s&&e?console.warn(u):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.102.js.zonos.com",y=h||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.102",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="1729271071643",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.102",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:a,zonosApiKey:u})=>{if(f.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),!f.doneInit){if(e(`====== ZONOS DEBUG MODE: on (${f.version}) ======`),f.zonosApiKey=u,f.storeId=a,f.isNpm){if(e("====== ZONOS LOADING FROM NPM ======"),!u&&!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.102";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.102";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.102.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}