@zonos/elements 1.3.34-alpha.0 → 1.3.35

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 (95) hide show
  1. package/dist/cjs/{cart-42cc98d9.js → cart-401b6d32.js} +51 -19
  2. package/dist/cjs/index.cjs.js +4 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{submitGtag-09f2e437.js → submitGtag-bc6af393.js} +1 -1
  5. package/dist/cjs/zonos-address_8.cjs.entry.js +18 -17
  6. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +10 -4
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  8. package/dist/cjs/zonos-controller.cjs.entry.js +9 -2
  9. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-select_3.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-elements.cjs.js +1 -1
  12. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
  13. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  14. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-notification_2.cjs.entry.js +1 -1
  16. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +6 -5
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +8 -8
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +8 -2
  19. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +4 -4
  20. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +4 -4
  21. package/dist/collection/components/main/zonos-controller.js +26 -1
  22. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +51 -19
  23. package/dist/esm/{cart-b9f15a63.js → cart-f29968a8.js} +51 -19
  24. package/dist/esm/index.js +4 -4
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/{submitGtag-8b52cfdd.js → submitGtag-fcfd5cf4.js} +1 -1
  27. package/dist/esm/zonos-address_8.entry.js +18 -17
  28. package/dist/esm/zonos-cart-items_12.entry.js +10 -4
  29. package/dist/esm/zonos-checkout.entry.js +2 -2
  30. package/dist/esm/zonos-controller.entry.js +9 -2
  31. package/dist/esm/zonos-country-flag.entry.js +1 -1
  32. package/dist/esm/zonos-country-select_3.entry.js +1 -1
  33. package/dist/esm/zonos-elements.js +1 -1
  34. package/dist/esm/zonos-hello-dialog.entry.js +5 -5
  35. package/dist/esm/zonos-hello.entry.js +1 -1
  36. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  37. package/dist/esm/zonos-notification_2.entry.js +1 -1
  38. package/dist/esm-es5/{cart-b9f15a63.js → cart-f29968a8.js} +1 -1
  39. package/dist/esm-es5/index.js +1 -1
  40. package/dist/esm-es5/loader.js +1 -1
  41. package/dist/esm-es5/{submitGtag-8b52cfdd.js → submitGtag-fcfd5cf4.js} +1 -1
  42. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  43. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  44. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  45. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  46. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  47. package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
  48. package/dist/esm-es5/zonos-elements.js +1 -1
  49. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  50. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  51. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  52. package/dist/esm-es5/zonos-notification_2.entry.js +1 -1
  53. package/dist/scripts/index.d.ts +6 -2
  54. package/dist/scripts/index.js +1 -1
  55. package/dist/scripts/loadZonos.js +1 -1
  56. package/dist/scripts/zonos.js +1 -1
  57. package/dist/types/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.d.ts +2 -2
  58. package/dist/types/components/main/zonos-controller.d.ts +4 -0
  59. package/dist/types/components.d.ts +6 -2
  60. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  61. package/dist/zonos-elements/index.esm.js +1 -1
  62. package/dist/zonos-elements/{p-b65cc2cf.system.js → p-1fbf0527.system.js} +1 -1
  63. package/dist/zonos-elements/{p-b5f769ba.js → p-2947c138.js} +1 -1
  64. package/dist/zonos-elements/{p-0f58c8ab.entry.js → p-297bf223.entry.js} +1 -1
  65. package/dist/zonos-elements/p-2cee5f3a.system.entry.js +1 -0
  66. package/dist/zonos-elements/{p-af5fc5f7.system.entry.js → p-38f882ea.system.entry.js} +1 -1
  67. package/dist/zonos-elements/p-4d95b4f4.system.entry.js +1 -0
  68. package/dist/zonos-elements/{p-3bc94271.js → p-5b723a1d.js} +1 -1
  69. package/dist/zonos-elements/{p-fdf79bff.system.entry.js → p-5ce19bce.system.entry.js} +1 -1
  70. package/dist/zonos-elements/{p-4c49eb9b.entry.js → p-60f7bcee.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-7a3bf998.system.entry.js → p-62e21e2b.system.entry.js} +1 -1
  72. package/dist/zonos-elements/p-6b06ac3d.entry.js +1 -0
  73. package/dist/zonos-elements/{p-9b525aaa.system.entry.js → p-6e14560d.system.entry.js} +1 -1
  74. package/dist/zonos-elements/{p-09f89949.entry.js → p-6ec40c8f.entry.js} +1 -1
  75. package/dist/zonos-elements/{p-6f51a7ee.entry.js → p-8363436f.entry.js} +1 -1
  76. package/dist/zonos-elements/{p-829bac92.system.entry.js → p-891d2c76.system.entry.js} +1 -1
  77. package/dist/zonos-elements/{p-679e42d8.system.js → p-91635589.system.js} +1 -1
  78. package/dist/zonos-elements/p-9194145f.system.js +1 -0
  79. package/dist/zonos-elements/p-952e331c.entry.js +1 -0
  80. package/dist/zonos-elements/p-bf9578d3.entry.js +1 -0
  81. package/dist/zonos-elements/{p-3143bbf8.system.entry.js → p-c0efa3a3.system.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-f64ac752.system.entry.js → p-d410ef50.system.entry.js} +1 -1
  83. package/dist/zonos-elements/{p-1b33ed3b.entry.js → p-e0709be2.entry.js} +1 -1
  84. package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
  85. package/dist/zonos-elements/{p-1a67d86d.entry.js → p-e4ef71bd.entry.js} +1 -1
  86. package/dist/zonos-elements/{p-6a42fa2a.entry.js → p-eea3ec17.entry.js} +1 -1
  87. package/dist/zonos-elements/{p-210f3405.system.entry.js → p-f9931ad1.system.entry.js} +1 -1
  88. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  89. package/package.json +1 -1
  90. package/dist/zonos-elements/p-0a07379c.system.js +0 -1
  91. package/dist/zonos-elements/p-27538d28.system.entry.js +0 -1
  92. package/dist/zonos-elements/p-290bd010.entry.js +0 -1
  93. package/dist/zonos-elements/p-4ff5c708.entry.js +0 -1
  94. package/dist/zonos-elements/p-83e265cf.entry.js +0 -1
  95. package/dist/zonos-elements/p-c84f90b9.system.entry.js +0 -1
@@ -41,6 +41,10 @@ export declare class ZonosController {
41
41
  * Show notification
42
42
  */
43
43
  showNotification(notification: NotificationInit): Promise<void>;
44
+ /**
45
+ * Reset the Checkout session id and client secret (required for dashboard store switching)
46
+ */
47
+ reset(): Promise<void>;
44
48
  /**
45
49
  * Override the setting
46
50
  * @param config config that need to override the default setting
@@ -514,6 +514,10 @@ export namespace Components {
514
514
  * Override country code for storybook
515
515
  */
516
516
  "overrideCountry": (countryCode: CountryCode) => Promise<void>;
517
+ /**
518
+ * Reset the Checkout session id and client secret (required for dashboard store switching)
519
+ */
520
+ "reset": () => Promise<void>;
517
521
  /**
518
522
  * Setup google font
519
523
  */
@@ -1052,7 +1056,7 @@ declare global {
1052
1056
  new (): HTMLZonosAddressFormElement;
1053
1057
  };
1054
1058
  interface HTMLZonosAddressUpdateDialogElementEventMap {
1055
- "closeDialog": void;
1059
+ "closeUpdateDialog": void;
1056
1060
  "continueClicked": SubmitEventData;
1057
1061
  }
1058
1062
  interface HTMLZonosAddressUpdateDialogElement extends Components.ZonosAddressUpdateDialog, HTMLStencilElement {
@@ -1563,7 +1567,7 @@ declare namespace LocalJSX {
1563
1567
  /**
1564
1568
  * Close dialog button click
1565
1569
  */
1566
- "onCloseDialog"?: (event: ZonosAddressUpdateDialogCustomEvent<void>) => void;
1570
+ "onCloseUpdateDialog"?: (event: ZonosAddressUpdateDialogCustomEvent<void>) => void;
1567
1571
  /**
1568
1572
  * Event to emit when the continue button is clicked
1569
1573
  */
@@ -1 +1 @@
1
- <svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>
1
+ <svg color="var(--zonos-elements-red-800)" fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="https://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" data-is-secondary-color="true" fill="var(--zonos-elements-red-200)" fill-rule="evenodd"></path><path clip-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" fill="currentColor" fill-rule="evenodd"></path></svg>g>
@@ -1 +1 @@
1
- import{l as e,a as n}from"./p-eaa335e1.js";const t=["jsdelivr","unpkg","vercel"],o=e=>{const n=t.indexOf(e);return t[n+1]||null},s="https://js.stripe.com/v3",r=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let l=null;const c=Promise.resolve().then((()=>{return e=null,null!==l||(l=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&r.test(t.src))return t}return null})();l&&e?console.warn(i):l||(l=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${s}${t}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),l;var e}));let d=!1;var u;c.catch((e=>{d||console.warn(e)}));const a=(()=>{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",".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})(),m="https://v1.3.34-alpha.0.js.zonos.com",p=a||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.34-alpha.0",w="jsdelivr",h="https://rsms.me",f="https://fonts.googleapis.com",v=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class y{}u=y,y.doneInit=!1,y.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),y.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),y.isBigCommerce=!1,y.isNpm=!0,y.zonosQaUrl=null,y.version="v1.3.34-alpha.0",y.modeAlerted=!1,y.tempCartData=null,y.getCurrentTimestamp=()=>(new Date).getTime(),y.zonosController=null,y.init=async({appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{u.doneInit||(e(`====== ZONOS DEBUG MODE: on (${u.version}) ======`),d?(u.zonosApiKey=d,u.storeId=c,e("init zonos"),u.injectZonosCdn(),u.injectZonosCss(),u.injectFonts(),u.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),u.doneInit=!0):n("Missing Zonos API key"))},y.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},y.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},y.showNotification=e=>{var n;null===(n=u.zonosController)||void 0===n||n.showNotification(e)},y.updateOrganizationName=e=>{var n;null===(n=u.zonosController)||void 0===n||n.updateOrganizationName(e)},y.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)}},y.injectController=({config:t,zonosApiKey:o})=>{var s;if(document.querySelector("zonos-controller"))return;if(null===(s=t.checkoutSettings)||void 0===s?void 0:s.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;u.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{u.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=t,r.zonosApiKey=o,r.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const s=await(async(...e)=>{d=!0;const n=Date.now();return c.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);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),u.zonosController=r,e("Zonos controller injected!")},y.injectScript=({cdnType:t,isModule:s,theRestUrl:r})=>{const i=`${u.getZonosUrl(t)}/${r}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");s?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const e=o(t);e&&u.injectScript({cdnType:e,isModule:s,theRestUrl:r})},l.appendChild(c)},y.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return p;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.34-alpha.0";default:return m}};return u.isNpm&&(()=>{if("undefined"==typeof window)return null;const n=(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);if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${t}' for loading script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t})()||t()},y.injectZonosCdn=()=>{u.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),u.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},y.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const s=u.getZonosUrl(e),r=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${m}/`,r.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${s}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const s=o(e);s&&u.injectStylesheet({cdnType:s,theRestUrl:t})},r.appendChild(l)},y.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(u.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},y.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${h}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!v.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=h,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${h}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},y.setupGoogleFont=e=>{var n;null===(n=u.zonosController)||void 0===n||n.setupGoogleFont(e)},y.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^="${f}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=f,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{y as Zonos}
1
+ import{l as e,a as n}from"./p-eaa335e1.js";const t=["jsdelivr","unpkg","vercel"],o=e=>{const n=t.indexOf(e);return t[n+1]||null},s="https://js.stripe.com/v3",r=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,i="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let l=null;const c=Promise.resolve().then((()=>{return e=null,null!==l||(l=new Promise(((t,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(i),window.Stripe)t(window.Stripe);else try{let l=(()=>{const e=document.querySelectorAll(`script[src^="${s}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&r.test(t.src))return t}return null})();l&&e?console.warn(i):l||(l=(e=>{const t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${s}${t}`;const r=document.head||document.body;return r?(r.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==l||l.addEventListener("load",(()=>{window.Stripe?t(window.Stripe):o(new Error("Stripe.js not available"))})),null==l||l.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else t(null)}))),l;var e}));let d=!1;var u;c.catch((e=>{d||console.warn(e)}));const a=(()=>{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",".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})(),m="https://v1.3.35.js.zonos.com",p=a||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.35",w="jsdelivr",f="https://rsms.me",h="https://fonts.googleapis.com",v=/^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;class y{}u=y,y.doneInit=!1,y.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),y.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),y.isBigCommerce=!1,y.isNpm=!0,y.zonosQaUrl=null,y.version="v1.3.35",y.modeAlerted=!1,y.tempCartData=null,y.getCurrentTimestamp=()=>(new Date).getTime(),y.zonosController=null,y.init=async({appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l,storeId:c,zonosApiKey:d})=>{u.doneInit||(e(`====== ZONOS DEBUG MODE: on (${u.version}) ======`),d?(u.zonosApiKey=d,u.storeId=c,e("init zonos"),u.injectZonosCdn(),u.injectZonosCss(),u.injectFonts(),u.injectController({config:{appearance:t,checkoutSettings:o,currencyConverter:s,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:l},zonosApiKey:d}),u.doneInit=!0):n("Missing Zonos API key"))},y.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},y.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},y.showNotification=e=>{var n;null===(n=u.zonosController)||void 0===n||n.showNotification(e)},y.updateOrganizationName=e=>{var n;null===(n=u.zonosController)||void 0===n||n.updateOrganizationName(e)},y.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)}},y.injectController=({config:t,zonosApiKey:o})=>{var s;if(document.querySelector("zonos-controller"))return;if(null===(s=t.checkoutSettings)||void 0===s?void 0:s.placeOrderButtonSelector){const e=t.checkoutSettings.placeOrderButtonSelector;u.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e}),new MutationObserver((()=>{u.disablePlaceOrderButtons({config:t,disable:!0,placeOrderButtonSelector:e})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=t,r.zonosApiKey=o,r.addEventListener("stripeInitEvent",(async t=>{const{detail:o}=t;e("loading Stripe");const s=await(async(...e)=>{d=!0;const n=Date.now();return c.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);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),u.zonosController=r,e("Zonos controller injected!")},y.injectScript=({cdnType:t,isModule:s,theRestUrl:r})=>{const i=`${u.getZonosUrl(t)}/${r}`;if(document.querySelector(`script[src="${i}"]`))return void e(`Zonos script "${i}" already exists in the document`,"warn");const l=document.head||document.body,c=document.createElement("script");s?c.type="module":c.noModule=!0,c.src=i,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const e=o(t);e&&u.injectScript({cdnType:e,isModule:s,theRestUrl:r})},l.appendChild(c)},y.getZonosUrl=n=>{const t=()=>{switch(n){case"jsdelivr":return p;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.35";default:return m}};return u.isNpm&&(()=>{if("undefined"==typeof window)return null;const n=(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);if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const t=`https://${n}.preview.js.zonos.com`;return e(`[ZONOS-WARNING] using '${t}' for loading script`,"warn"),fetch(t).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${t}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:n}=window.location,o=`${n}?${e.toString()}`;return window.history.replaceState(window.history.state,"",o),window.location.reload(),null})),t})()||t()},y.injectZonosCdn=()=>{u.injectScript({cdnType:w,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),u.injectScript({cdnType:w,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),e("Zonos cdn script injected!")},y.injectStylesheet=({cdnType:e,theRestUrl:t})=>{const s=u.getZonosUrl(e),r=document.head||document.body,i=document.createElement("link");i.rel="preconnect",i.href=`${m}/`,r.appendChild(i);const l=document.createElement("link");l.rel="stylesheet",l.href=`${s}/${t}`,l.onerror=()=>{n(`Failed to load ${l.href}`);const s=o(e);s&&u.injectStylesheet({cdnType:s,theRestUrl:t})},r.appendChild(l)},y.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?e("Zonos style links already injected","warn"):(u.injectStylesheet({cdnType:w,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),e("Zonos style css injected!"))},y.injectFonts=()=>{if((()=>{const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${f}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!v.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=f,n.appendChild(t);const o=document.createElement("link");o.rel="stylesheet",o.href=`${f}/inter/inter.css`,n.appendChild(o),e("Zonos font injected!")},y.setupGoogleFont=e=>{var n;null===(n=u.zonosController)||void 0===n||n.setupGoogleFont(e)},y.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^="${h}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=h,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{y as Zonos}
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(n,t,e,o){function r(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,i){function u(n){try{c(o.next(n))}catch(n){i(n)}}function a(n){try{c(o["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):r(n.value).then(u,a)}c((o=o.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(t){return c([n,t])}}function c(a){if(o)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(e=0)),e)try{if(o=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;r=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){e.label=a[1];break}if(a[0]===6&&e.label<i[1]){e.label=i[1];i=a;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(a);break}if(i[2])e.ops.pop();e.trys.pop();continue}a=t.call(n,e)}catch(n){a=[6,n];r=0}finally{o=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-679e42d8.system.js","./p-0b538ed4.system.js","./p-63db40b9.system.js"],(function(n){"use strict";var t,e,o,r,i;return{setters:[function(n){t=n.r;e=n.d;o=n.l},function(n){r=n.z},function(n){i=n.l}],execute:function(){var u=this;var a=n("t",(function(n,i){return __awaiter(u,void 0,void 0,(function(){var u,a,c,s,f,d,v,w;return __generator(this,(function(l){switch(l.label){case 0:c=window.location.href.includes("zonos.com")||window.location.href.includes("checkout.iglobalstores.com")||!!((u=window.Zonos)===null||u===void 0?void 0:u.zonosQaUrl)||!!((a=window.Zonos)===null||a===void 0?void 0:a.debug);if(c&&!window.Zonos.zonosConversionTest){return[2]}s="".concat("https://v1.route.js.zonos.com","/api/zonos-elements/track-conversion-event");f=o.selectedCountryCode;d=r.organizationId;v=e.checkoutSessionId;if(!v){return[2]}w={checkoutSessionId:v,countryCode:f,eventName:n,metadata:i,organizationId:d};return[4,t(s,{body:w,method:"POST"})];case 1:l.sent();return[2]}}))}))}));var c=n("g",(function(){var n;return(n=window.Zonos.zonosApiKey)===null||n===void 0?void 0:n.includes("test")}));var s=n("c",(function(n,t){return new CustomEvent(n,{detail:t})}));var f=n("s",(function(n){return __awaiter(u,[n],void 0,(function(n){var e,o;var r=n.endpoint,i=n.errors,u=n.metadata;return __generator(this,(function(n){e="userAgentData"in window.navigator?window.navigator.userAgentData:null;o={endpoint:r,errors:i,metadata:Object.assign({href:window.location.href,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent},u)};void t("".concat("https://v1.route.js.zonos.com","/api/zonos-elements/log-error"),{body:o,method:"POST"});return[2]}))}))}));var d=n("a",(function(n){var t=r.checkoutSettings.analyticsProviders.find((function(n){return n.type==="GOOGLE_ANALYTICS"}));if(!t||(t===null||t===void 0?void 0:t.status)==="DISABLED"){return}if(typeof window.gtag==="function"){i("Zonos submits gtag event","log",n);window.gtag("event",n,{})}}))}}}));
1
+ var __awaiter=this&&this.__awaiter||function(n,t,e,o){function r(n){return n instanceof e?n:new e((function(t){t(n)}))}return new(e||(e=Promise))((function(e,i){function u(n){try{c(o.next(n))}catch(n){i(n)}}function a(n){try{c(o["throw"](n))}catch(n){i(n)}}function c(n){n.done?e(n.value):r(n.value).then(u,a)}c((o=o.apply(n,t||[])).next())}))};var __generator=this&&this.__generator||function(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(n){return function(t){return c([n,t])}}function c(a){if(o)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(e=0)),e)try{if(o=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;r=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(i=e.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){e.label=a[1];break}if(a[0]===6&&e.label<i[1]){e.label=i[1];i=a;break}if(i&&e.label<i[2]){e.label=i[2];e.ops.push(a);break}if(i[2])e.ops.pop();e.trys.pop();continue}a=t.call(n,e)}catch(n){a=[6,n];r=0}finally{o=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-91635589.system.js","./p-0b538ed4.system.js","./p-63db40b9.system.js"],(function(n){"use strict";var t,e,o,r,i;return{setters:[function(n){t=n.r;e=n.d;o=n.l},function(n){r=n.z},function(n){i=n.l}],execute:function(){var u=this;var a=n("t",(function(n,i){return __awaiter(u,void 0,void 0,(function(){var u,a,c,s,f,d,v,w;return __generator(this,(function(l){switch(l.label){case 0:c=window.location.href.includes("zonos.com")||window.location.href.includes("checkout.iglobalstores.com")||!!((u=window.Zonos)===null||u===void 0?void 0:u.zonosQaUrl)||!!((a=window.Zonos)===null||a===void 0?void 0:a.debug);if(c&&!window.Zonos.zonosConversionTest){return[2]}s="".concat("https://v1.route.js.zonos.com","/api/zonos-elements/track-conversion-event");f=o.selectedCountryCode;d=r.organizationId;v=e.checkoutSessionId;if(!v){return[2]}w={checkoutSessionId:v,countryCode:f,eventName:n,metadata:i,organizationId:d};return[4,t(s,{body:w,method:"POST"})];case 1:l.sent();return[2]}}))}))}));var c=n("g",(function(){var n;return(n=window.Zonos.zonosApiKey)===null||n===void 0?void 0:n.includes("test")}));var s=n("c",(function(n,t){return new CustomEvent(n,{detail:t})}));var f=n("s",(function(n){return __awaiter(u,[n],void 0,(function(n){var e,o;var r=n.endpoint,i=n.errors,u=n.metadata;return __generator(this,(function(n){e="userAgentData"in window.navigator?window.navigator.userAgentData:null;o={endpoint:r,errors:i,metadata:Object.assign({href:window.location.href,userAgent:e&&e.brands.length>0?e:window.navigator.userAgent},u)};void t("".concat("https://v1.route.js.zonos.com","/api/zonos-elements/log-error"),{body:o,method:"POST"});return[2]}))}))}));var d=n("a",(function(n){var t=r.checkoutSettings.analyticsProviders.find((function(n){return n.type==="GOOGLE_ANALYTICS"}));if(!t||(t===null||t===void 0?void 0:t.status)==="DISABLED"){return}if(typeof window.gtag==="function"){i("Zonos submits gtag event","log",n);window.gtag("event",n,{})}}))}}}));