@zonos/elements 1.3.145 → 1.3.147

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 (134) hide show
  1. package/dist/cjs/{cart-9d5e2816.js → cart-ff5887f0.js} +63 -1
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{paypal-f9015045.js → paypal-dd767dbc.js} +1 -1
  5. package/dist/cjs/zonos-address_8.cjs.entry.js +2 -2
  6. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +17 -6
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +68 -12
  8. package/dist/cjs/zonos-controller.cjs.entry.js +9 -3
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-elements.cjs.js +1 -1
  12. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +66 -10
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +1 -0
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +15 -3
  19. package/dist/collection/components/main/zonos-controller.js +8 -2
  20. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
  21. package/dist/collection/components/store/translationStore/strings.base.js +3 -0
  22. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
  23. package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
  24. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
  25. package/dist/collection/components/store/translationStore/strings.french.js +3 -0
  26. package/dist/collection/components/store/translationStore/strings.german.js +3 -0
  27. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
  28. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
  29. package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
  30. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
  31. package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
  32. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
  33. package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
  34. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
  35. package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
  36. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
  37. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
  38. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
  39. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
  40. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +1 -1
  41. package/dist/collection/components/utils/hello/getZCountryUrlParam.js +3 -1
  42. package/dist/esm/{cart-887f7d66.js → cart-9de02093.js} +63 -1
  43. package/dist/esm/index.js +7 -7
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/{paypal-6fd5749b.js → paypal-1efe64a0.js} +1 -1
  46. package/dist/esm/zonos-address_8.entry.js +2 -2
  47. package/dist/esm/zonos-cart-items_13.entry.js +17 -6
  48. package/dist/esm/zonos-checkout.entry.js +68 -12
  49. package/dist/esm/zonos-controller.entry.js +9 -3
  50. package/dist/esm/zonos-country-flag.entry.js +1 -1
  51. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  52. package/dist/esm/zonos-elements.js +1 -1
  53. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  54. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  55. package/dist/esm/zonos-hello.entry.js +1 -1
  56. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  57. package/dist/esm-es5/cart-9de02093.js +1 -0
  58. package/dist/esm-es5/index.js +1 -1
  59. package/dist/esm-es5/loader.js +1 -1
  60. package/dist/esm-es5/{paypal-6fd5749b.js → paypal-1efe64a0.js} +1 -1
  61. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  62. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  63. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  64. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  65. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  66. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  67. package/dist/esm-es5/zonos-elements.js +1 -1
  68. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  69. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  70. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  71. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  72. package/dist/scripts/index.d.ts +20 -1
  73. package/dist/scripts/index.js +1 -1
  74. package/dist/scripts/loadZonos.js +1 -1
  75. package/dist/scripts/zonos.js +1 -1
  76. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -0
  77. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +5 -0
  78. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
  79. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
  80. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
  81. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
  82. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
  83. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
  84. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
  85. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
  86. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
  87. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
  88. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
  89. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
  90. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
  91. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
  92. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
  93. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
  94. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
  95. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
  96. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
  97. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
  98. package/dist/types/types/checkout/CheckoutConfig.d.ts +20 -1
  99. package/dist/zonos-elements/index.esm.js +1 -1
  100. package/dist/zonos-elements/{p-b4823b13.entry.js → p-00182783.entry.js} +1 -1
  101. package/dist/zonos-elements/{p-896dca32.entry.js → p-056e1930.entry.js} +1 -1
  102. package/dist/zonos-elements/{p-98db517b.entry.js → p-0a0eccae.entry.js} +1 -1
  103. package/dist/zonos-elements/p-36cd38ba.system.js +1 -0
  104. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  105. package/dist/zonos-elements/{p-9024f5a1.entry.js → p-4b0cb1ce.entry.js} +1 -1
  106. package/dist/zonos-elements/p-4f398271.entry.js +1 -0
  107. package/dist/zonos-elements/{p-826b5d0c.system.js → p-5831e9ba.system.js} +1 -1
  108. package/dist/zonos-elements/{p-fec7bdd4.system.entry.js → p-5d570a00.system.entry.js} +1 -1
  109. package/dist/zonos-elements/{p-4d353108.entry.js → p-6adea6aa.entry.js} +1 -1
  110. package/dist/zonos-elements/{p-b7a40db9.system.entry.js → p-8455a72e.system.entry.js} +1 -1
  111. package/dist/zonos-elements/p-8dc3edd5.system.entry.js +1 -0
  112. package/dist/zonos-elements/{p-9ae29c27.system.entry.js → p-9c6ed828.system.entry.js} +1 -1
  113. package/dist/zonos-elements/{p-1d466ac6.entry.js → p-9dd24661.entry.js} +1 -1
  114. package/dist/zonos-elements/p-9f5789a5.js +17 -0
  115. package/dist/zonos-elements/{p-0e9826d2.system.entry.js → p-afd32c67.system.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-5e76c269.entry.js → p-c8fb55dc.entry.js} +1 -1
  117. package/dist/zonos-elements/{p-fdb592a8.system.js → p-ce4e9134.system.js} +1 -1
  118. package/dist/zonos-elements/{p-3bd17598.system.entry.js → p-cfce4fa3.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-e3abf96c.system.entry.js → p-da6d01bc.system.entry.js} +1 -1
  120. package/dist/zonos-elements/p-e3131c5e.system.entry.js +1 -0
  121. package/dist/zonos-elements/p-e99dec7d.js +1 -0
  122. package/dist/zonos-elements/{p-e8926f59.entry.js → p-f4929b6e.entry.js} +1 -1
  123. package/dist/zonos-elements/{p-2e6265cc.system.entry.js → p-f4958bec.system.entry.js} +1 -1
  124. package/dist/zonos-elements/{p-794b2d24.system.entry.js → p-f70b072b.system.entry.js} +1 -1
  125. package/dist/zonos-elements/{p-e4d509be.entry.js → p-fd26a3cc.entry.js} +1 -1
  126. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  127. package/package.json +1 -1
  128. package/dist/esm-es5/cart-887f7d66.js +0 -1
  129. package/dist/zonos-elements/p-3f282167.system.entry.js +0 -1
  130. package/dist/zonos-elements/p-49b8760c.system.entry.js +0 -1
  131. package/dist/zonos-elements/p-5e4b6b77.js +0 -17
  132. package/dist/zonos-elements/p-b0ced00a.system.js +0 -1
  133. package/dist/zonos-elements/p-b18c4d1d.js +0 -1
  134. package/dist/zonos-elements/p-f824a75f.entry.js +0 -1
@@ -1 +1 @@
1
- import{r as o,c as t,h as n,H as e}from"./p-ab68ad11.js";import{D as i,f as s,E as r,e as c,a}from"./p-b18c4d1d.js";import{z as l,b as d,d as h}from"./p-b0616716.js";import{h as u,b as f,l as m}from"./p-f0c8150e.js";import"./p-6c578d26.js";import"./p-e02fd9ae.js";const p=o=>{const t=document.querySelector(o);if(!document.querySelector("zonos-hello")&&t){const o=document.createElement("zonos-hello");return t.appendChild(o),!0}return!1},w=o=>{switch(o){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},v=({position:o="bottom-right"})=>{const t=".zonos--hello-mobile-wrapper";if(document.querySelector(t))return t;const n=document.createElement("div");return n.className="zonos--hello-mobile-wrapper",n.style.position="fixed","top-right"===o&&(n.style.top="72px",n.style.right="24px"),"top-left"===o&&(n.style.top="72px",n.style.left="24px"),"bottom-right"===o&&(n.style.bottom="72px",n.style.right="24px"),"bottom-left"===o&&(n.style.bottom="72px",n.style.left="24px"),n.style.zIndex="2147483007",document.body.appendChild(n),t},b=async o=>{if(window.Zonos.isLegacyCheckout)return void m("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:t}=o;let n=t;if(!o.anchorElementSelector&&o.desktopLocation){const o=v({position:"bottom-right"});n=o}if(n&&i(n)){if(m("Hello init complete"),!p(n)){const t=new MutationObserver((()=>{p(n)&&t.disconnect()}));t.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{p(n)}),1e3),setTimeout((()=>{if(o.notFoundElementFallback){m(`Hello anchor selector ${o.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${o.notFoundElementFallback}`,"info");const t=v({position:w(o.notFoundElementFallback)});p(t)}}),3e3)}}else f(`Selector anchorElementSelector "${o.anchorElementSelector}" is not a valid selector.`)},g=class{constructor(n){o(this,n),this.paypalInitEvent=t(this,"paypalInitEvent",7),this.stripeInitEvent=t(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(o){var t;o?(s.stripe=o,((t=l.checkoutSettings).placeOrderButtonSelector||window.Zonos.cartData)&&(!t.placeOrderButtonSelector||i(t.placeOrderButtonSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const o=document.createElement("zonos-checkout");document.body.appendChild(o)}})():f(`Selector checkoutButtonAnchor "${t.placeOrderButtonSelector}" is not a valid selector`)),m("init checkout element")):m("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const o=document.createElement("zonos-notification");document.body.appendChild(o)}async setupGoogleFont(o){var t,n;const e=o||h();if("Inter"===e){if(!o)return;m("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o})}const i=new URLSearchParams;i.set("family",e);const{errors:s,json:r}=await u(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0)return m(`Failed to load font ${e}`,"warn"),void(l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(n=(t=window.Zonos).injectSupportGoogleFont)||void 0===n||n.call(t,c)),o&&(m(`[FONT] ${o} font override applied`),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o}))}handleLocationChange(){b(l.helloSettings)}initHistoryListener(){const o=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),o.apply(this,arguments)};const t=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)}}injectCustomHTML(o){if(!o)return;if(!window.Zonos.isLegacyCheckout)return void m("=== Skip injecting custom HTML for hosted checkout","info");m("=== Injecting custom HTML for hosted checkout");const t=document.createElement("template");t.innerHTML=o,t.content.querySelectorAll("script").forEach((o=>{const t=document.createElement("script");t.textContent=o.innerHTML,document.body.appendChild(t)}))}async componentWillLoad(){this.initHistoryListener(),l.zonosApiKey=this.zonosApiKey,(async()=>{var o,t,n;const{errors:e,json:i,zonosMode:s}=await(async()=>{const{errors:o,json:t,zonosMode:n}=await u("/api/zonos-elements/zonos-settings");return o.length?(f("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:t,zonosMode:n}})();if("403"===(null===(o=e[0])||void 0===o?void 0:o.type.toString()))return void m("Failed to load zonos settings. This domain may not have access","warn");const c=(null===(t=null==i?void 0:i.checkoutSettings)||void 0===t?void 0:t.customHTML)||"";this.injectCustomHTML(c),this.initZonosNotification();const a=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var o,t,n;return window.Zonos.isLegacyCheckout?(null===(o=null==i?void 0:i.appearanceSettings)||void 0===o?void 0:o.logoUrl)||(null===(t=this.config.appearance)||void 0===t?void 0:t.logoUrl):null===(n=this.config.appearance)||void 0===n?void 0:n.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{subscriptionStatus:void 0}):void 0});d({overrideSettings:a,zonosSettings:i}),l.zonosMode=s,this.setupGoogleFont(),"DISABLED"===l.helloSettings.visibilityStatus&&m("=== Hello is disabled by store owner ===","warn"),l.helloSettings&&"ENABLED"===l.helloSettings.visibilityStatus&&(m("Initializing hello"),b(l.helloSettings)),await r();const h=(null===(n=null==i?void 0:i.checkoutSettings)||void 0===n?void 0:n.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(h&&this.stripeInitEvent)return"INACTIVE"===l.checkoutSettings.subscriptionStatus?(m('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void m("zonos controller loaded")):"DISABLED"===l.checkoutSettings.visibilityStatus?(m("=== Checkout is disabled by store owner ===","warn"),void m("zonos controller loaded")):void this.stripeInitEvent.emit({publishableKey:h.token});m("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(o){const t=document.querySelector("zonos-notification");t?t.showNotification(o):m("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,s.clientSecret=""}async overrideConfig(o){d({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){m(`Override country code to ${o}`),a(o)}async getAppearanceSetting(){return l.appearance}async updateOrganizationName(o){l.organizationName=o}render(){return n(e,{key:"f59eff8c088135e8fc791d03f668e787ec0d0912",class:"zonos--elements"})}};g.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";export{g as zonos_controller}
1
+ import{r as o,c as t,h as n,H as e}from"./p-ab68ad11.js";import{D as i,f as s,E as r,e as c,a}from"./p-e99dec7d.js";import{z as l,b as d,d as h}from"./p-b0616716.js";import{h as u,b as f,l as m}from"./p-f0c8150e.js";import"./p-6c578d26.js";import"./p-e02fd9ae.js";const p=o=>{const t=document.querySelector(o);if(!document.querySelector("zonos-hello")&&t){const o=document.createElement("zonos-hello");return t.appendChild(o),!0}return!1},w=o=>{switch(o){case"BOTTOM_RIGHT":default:return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right"}},v=({position:o="bottom-right"})=>{const t=".zonos--hello-mobile-wrapper";if(document.querySelector(t))return t;const n=document.createElement("div");return n.className="zonos--hello-mobile-wrapper",n.style.position="fixed","top-right"===o&&(n.style.top="72px",n.style.right="24px"),"top-left"===o&&(n.style.top="72px",n.style.left="24px"),"bottom-right"===o&&(n.style.bottom="72px",n.style.right="24px"),"bottom-left"===o&&(n.style.bottom="72px",n.style.left="24px"),n.style.zIndex="2147483007",document.body.appendChild(n),t},b=async o=>{if(window.Zonos.isLegacyCheckout)return void m("Hello is disabled when isLegacyCheckout","info");const{anchorElementSelector:t}=o;let n=t;if(!o.anchorElementSelector&&o.desktopLocation){const o=v({position:"bottom-right"});n=o}if(n&&i(n)){if(m("Hello init complete"),!p(n)){const t=new MutationObserver((()=>{p(n)&&t.disconnect()}));t.observe(document.body,{childList:!0,subtree:!0}),setTimeout((()=>{p(n)}),1e3),setTimeout((()=>{if(o.notFoundElementFallback){m(`Hello anchor selector ${o.anchorElementSelector} not found after 3 seconds, falling back to 'notFoundElementFallback': ${o.notFoundElementFallback}`,"info");const t=v({position:w(o.notFoundElementFallback)});p(t)}}),3e3)}}else f(`Selector anchorElementSelector "${o.anchorElementSelector}" is not a valid selector.`)},g=class{constructor(n){o(this,n),this.paypalInitEvent=t(this,"paypalInitEvent",7),this.stripeInitEvent=t(this,"stripeInitEvent",7),this.config=void 0,this.zonosApiKey=void 0}async initCheckoutElement(o){var t;o?(s.stripe=o,((t=l.checkoutSettings).placeOrderButtonSelector||window.Zonos.cartData)&&(!t.placeOrderButtonSelector||i(t.placeOrderButtonSelector)?(()=>{if(!document.querySelector("zonos-checkout")){const o=document.createElement("zonos-checkout");document.body.appendChild(o)}})():f(`Selector checkoutButtonAnchor "${t.placeOrderButtonSelector}" is not a valid selector`)),m("init checkout element")):m("Stripe is not loaded yet - cannot init checkout element","warn")}initZonosNotification(){if(document.querySelector("zonos-notification"))return;const o=document.createElement("zonos-notification");document.body.appendChild(o)}async setupGoogleFont(o){var t,n;const e=o||h();if("Inter"===e){if(!o)return;m("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn"),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o})}const i=new URLSearchParams;i.set("family",e);const{errors:s,json:r}=await u(`/api/zonos-elements/get-font-detail?${i.toString()}`);if(s.length>0)return m(`Failed to load font ${e}`,"warn"),void(l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:"Inter"}));const c=null==r?void 0:r.fontUrl;c&&(null===(n=(t=window.Zonos).injectSupportGoogleFont)||void 0===n||n.call(t,c)),o&&(m(`[FONT] ${o} font override applied`),l.appearance=Object.assign(Object.assign({},l.appearance),{fontFamily:o}))}handleLocationChange(){b(l.helloSettings)}initHistoryListener(){const o=history.pushState;history.pushState=function(){return window.dispatchEvent(new window.Event("pushstate")),window.dispatchEvent(new window.Event("locationchange")),o.apply(this,arguments)};const t=history.replaceState;history.replaceState=function(){return window.dispatchEvent(new window.Event("replacestate")),window.dispatchEvent(new window.Event("locationchange")),t.apply(this,arguments)}}injectCustomHTML(o){if(!o)return;if(!window.Zonos.isLegacyCheckout)return void m("=== Skip injecting custom HTML for hosted checkout","info");m("=== Injecting custom HTML for hosted checkout");const t=document.createElement("template");t.innerHTML=o,t.content.querySelectorAll("script").forEach((o=>{const t=document.createElement("script");o.src?(t.src=o.src,t.async=o.async):t.textContent=o.innerHTML,document.body.appendChild(t)}))}async componentWillLoad(){this.initHistoryListener(),l.zonosApiKey=this.zonosApiKey,(async()=>{var o,t,n;const{errors:e,json:i,zonosMode:s}=await(async()=>{const{errors:o,json:t,zonosMode:n}=await u("/api/zonos-elements/zonos-settings");return o.length?(f("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings"),{errors:o,json:null,zonosMode:n}):{errors:[],json:t,zonosMode:n}})();if("403"===(null===(o=e[0])||void 0===o?void 0:o.type.toString()))return void m("Failed to load zonos settings. This domain may not have access","warn");const c=(null===(t=null==i?void 0:i.checkoutSettings)||void 0===t?void 0:t.customHTML)||"";this.injectCustomHTML(c),this.initZonosNotification();const a=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:(()=>{var o,t,n;return window.Zonos.isLegacyCheckout?(null===(o=null==i?void 0:i.appearanceSettings)||void 0===o?void 0:o.logoUrl)||(null===(t=this.config.appearance)||void 0===t?void 0:t.logoUrl):null===(n=this.config.appearance)||void 0===n?void 0:n.logoUrl})()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{subscriptionStatus:void 0}):void 0});d({overrideSettings:a,zonosSettings:i}),l.zonosMode=s,this.setupGoogleFont(),"DISABLED"===l.helloSettings.visibilityStatus&&m("=== Hello is disabled by store owner ===","warn"),l.helloSettings&&"ENABLED"===l.helloSettings.visibilityStatus&&(m("Initializing hello"),b(l.helloSettings)),await r();const h=(null===(n=null==i?void 0:i.checkoutSettings)||void 0===n?void 0:n.externalServiceTokens.find((o=>"STRIPE_PUBLISHABLE_TOKEN"===o.type)))||null;if(h&&this.stripeInitEvent)return"INACTIVE"===l.checkoutSettings.subscriptionStatus?(m('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn"),void m("zonos controller loaded")):"DISABLED"===l.checkoutSettings.visibilityStatus?(m("=== Checkout is disabled by store owner ===","warn"),void m("zonos controller loaded")):void this.stripeInitEvent.emit({publishableKey:h.token});m("Checkout failed to load -- missing publishable key","warn")})()}async showNotification(o){const t=document.querySelector("zonos-notification");t?t.showNotification(o):m("Failed to show notification - zonos-notification not found","warn")}async reset(){c.checkoutSessionId=null,s.clientSecret=""}async overrideConfig(o){d({overrideSettings:o,zonosSettings:null})}async overrideCountry(o){m(`Override country code to ${o}`),a(o)}async getAppearanceSetting(){return l.appearance}async updateOrganizationName(o){l.organizationName=o}render(){return n(e,{key:"001f728dc41550b734fd1b5c9cf15f43c0c4cbdb",class:"zonos--elements"})}};g.style=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";export{g as zonos_controller}