@zonos/elements 1.3.182 → 1.3.183

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 (125) hide show
  1. package/dist/cjs/{cart-dcd068d1.js → cart-3d0c0f0b.js} +60 -0
  2. package/dist/cjs/index.cjs.js +7 -7
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{paypal-4bbc4779.js → paypal-9eaa9196.js} +1 -1
  5. package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +50 -15
  7. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  8. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  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-customer-info/zonos-customer-info.js +11 -14
  17. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
  18. package/dist/collection/components/store/translationStore/strings.base.js +3 -0
  19. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
  20. package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
  21. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
  22. package/dist/collection/components/store/translationStore/strings.french.js +3 -0
  23. package/dist/collection/components/store/translationStore/strings.german.js +3 -0
  24. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
  25. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
  26. package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
  27. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
  28. package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
  29. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
  30. package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
  31. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
  32. package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
  33. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
  34. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
  35. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
  36. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
  37. package/dist/collection/components/utils/taxIdValidationResult.js +38 -0
  38. package/dist/esm/{cart-d2c86d90.js → cart-3fb04f1f.js} +60 -0
  39. package/dist/esm/index.js +7 -7
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/{paypal-5c0d6407.js → paypal-1f2e863c.js} +1 -1
  42. package/dist/esm/zonos-address_7.entry.js +1 -1
  43. package/dist/esm/zonos-cart-items_13.entry.js +50 -15
  44. package/dist/esm/zonos-checkout.entry.js +2 -2
  45. package/dist/esm/zonos-controller.entry.js +1 -1
  46. package/dist/esm/zonos-country-flag.entry.js +1 -1
  47. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  48. package/dist/esm/zonos-elements.js +1 -1
  49. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  50. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  51. package/dist/esm/zonos-hello.entry.js +1 -1
  52. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  53. package/dist/esm-es5/cart-3fb04f1f.js +1 -0
  54. package/dist/esm-es5/index.js +1 -1
  55. package/dist/esm-es5/loader.js +1 -1
  56. package/dist/esm-es5/{paypal-5c0d6407.js → paypal-1f2e863c.js} +1 -1
  57. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  58. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  59. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  60. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  61. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  62. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  63. package/dist/esm-es5/zonos-elements.js +1 -1
  64. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  65. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  66. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  67. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  68. package/dist/scripts/index.js +1 -1
  69. package/dist/scripts/loadZonos.js +1 -1
  70. package/dist/scripts/zonos.js +1 -1
  71. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +1 -2
  72. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
  73. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
  74. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
  75. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
  76. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
  77. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
  78. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
  79. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
  80. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
  81. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
  82. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
  83. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
  84. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
  85. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
  86. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
  87. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
  88. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
  89. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
  90. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
  91. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
  92. package/dist/types/components/utils/taxIdValidationResult.d.ts +12 -0
  93. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  94. package/dist/zonos-elements/index.esm.js +1 -1
  95. package/dist/zonos-elements/{p-5c695748.entry.js → p-107b08c1.entry.js} +1 -1
  96. package/dist/zonos-elements/{p-a43fba41.js → p-112aecac.js} +1 -1
  97. package/dist/zonos-elements/{p-5957eff5.system.entry.js → p-29e8c9e8.system.entry.js} +1 -1
  98. package/dist/zonos-elements/{p-a2368c1c.system.entry.js → p-358043a2.system.entry.js} +1 -1
  99. package/dist/zonos-elements/{p-09fbafe4.entry.js → p-43feb95e.entry.js} +1 -1
  100. package/dist/zonos-elements/{p-e42e0cdb.entry.js → p-4622cca6.entry.js} +1 -1
  101. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  102. package/dist/zonos-elements/{p-1b1cdb4c.system.entry.js → p-4aca92c5.system.entry.js} +1 -1
  103. package/dist/zonos-elements/{p-9d014d94.system.entry.js → p-4ca666ea.system.entry.js} +1 -1
  104. package/dist/zonos-elements/{p-753811b7.system.entry.js → p-4eff2f8a.system.entry.js} +1 -1
  105. package/dist/zonos-elements/{p-5a71d418.entry.js → p-587568b5.entry.js} +1 -1
  106. package/dist/zonos-elements/{p-00e5d2be.system.js → p-59e31080.system.js} +1 -1
  107. package/dist/zonos-elements/{p-99f50bf3.system.js → p-5bebcfc2.system.js} +1 -1
  108. package/dist/zonos-elements/{p-1cebd67c.entry.js → p-64dbc282.entry.js} +1 -1
  109. package/dist/zonos-elements/{p-5be6b837.system.entry.js → p-7cb87ea7.system.entry.js} +1 -1
  110. package/dist/zonos-elements/{p-57af5f9c.entry.js → p-7decb19b.entry.js} +1 -1
  111. package/dist/zonos-elements/{p-99f17671.entry.js → p-8f640b28.entry.js} +1 -1
  112. package/dist/zonos-elements/p-a69dbe14.js +1 -0
  113. package/dist/zonos-elements/{p-ff8d9f3a.entry.js → p-ac889f52.entry.js} +1 -1
  114. package/dist/zonos-elements/{p-d00049db.entry.js → p-b998494a.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-79e43df6.system.entry.js → p-bc0f885e.system.entry.js} +1 -1
  116. package/dist/zonos-elements/{p-5e1a782a.system.entry.js → p-c5c8f803.system.entry.js} +1 -1
  117. package/dist/zonos-elements/p-c6d96a42.system.js +1 -0
  118. package/dist/zonos-elements/{p-33de55b8.system.entry.js → p-d367c9ae.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-42abd4dd.system.entry.js → p-f66a5c7c.system.entry.js} +1 -1
  120. package/dist/zonos-elements/{p-c3f2b86c.entry.js → p-fa65b53d.entry.js} +1 -1
  121. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  122. package/package.json +1 -1
  123. package/dist/esm-es5/cart-d2c86d90.js +0 -1
  124. package/dist/zonos-elements/p-18ec705b.js +0 -1
  125. package/dist/zonos-elements/p-91bc2187.system.js +0 -1
@@ -152,6 +152,9 @@ export declare const stringsDutch: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsFrench: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsGerman: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsHebrew: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsIndonesian: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsItalian: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsJapanese: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsKorean: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsNorwegian: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsPolish: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsPortuguese: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsRussian: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsSpanish: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsSwedish: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsTurkish: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -152,6 +152,9 @@ export declare const stringsVietnamese: {
152
152
  'Hide non-prepaid options': {
153
153
  value: string;
154
154
  };
155
+ 'Invalid RFC format. Must be 12\u201313 uppercase letters and numbers only.': {
156
+ value: string;
157
+ };
155
158
  'Invalid promo code': {
156
159
  value: string;
157
160
  };
@@ -0,0 +1,12 @@
1
+ type TaxIdValidationResult = {
2
+ error: 'Tax id is required' | 'Invalid RFC format. Must be 12–13 uppercase letters and numbers only.';
3
+ valid: false;
4
+ } | {
5
+ error: null;
6
+ valid: true;
7
+ };
8
+ export declare const taxIdValidationResult: ({ shippingCountry, taxId, }: {
9
+ shippingCountry: string;
10
+ taxId: string;
11
+ }) => TaxIdValidationResult;
12
+ export {};
@@ -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-gray-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-gray-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 +1 @@
1
- import{g as e,a as n,l as t,h as o,b as r}from"./p-0fc02cde.js";import{_ as i,c as l}from"./p-fe253cc1.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-fe253cc1.js";export{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./p-5bd927f2.js";const a=["jsdelivr","cdnjs","unpkg","vercel"],u="jsdelivr",m=e=>{const n=a.indexOf(e);return a[n+1]||null},p=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)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),o="https://v1.3.182.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const s=`https://${n}.preview.js.zonos.com`;return t(`[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},w="https://js.stripe.com/v3",f=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,h="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let y=null;const v=Promise.resolve().then((()=>{return e=null,null!==y||(y=new Promise(((n,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(h),window.Stripe)n(window.Stripe);else try{let o=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&f.test(t.src))return t}return null})();o&&e?console.warn(h):o||(o=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",t=document.createElement("script");t.src=`${w}${n}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(r("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==o||o.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):t(new Error("Stripe.js not available"))})),null==o||o.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else n(null)}))),y;var e}));let g=!1;v.catch((e=>{g||console.warn(e)}));const z=async({cartId:n,retries:s})=>{const r=e(),{errors:i,json:c,zonosMode:d}=await o("/api/zonos-elements/get-cart",{body:{isTestMode:r,tempCartUUID:n},headers:{"Content-Type":"application/json"},method:"POST"}),l=!c||i.length;return l&&s?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:s}),await new Promise((e=>setTimeout(e,500))),z({cartId:n,retries:s-1})):l?null:Object.assign(Object.assign({},c),{zonosMode:d})};var S;const j=(()=>{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})(),O="https://v1.3.182.js.zonos.com",b=j||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.182",k="https://fonts.googleapis.com",Z=/^https:\/\/fonts\.googleapis\.com/;class I{}S=I,I.doneInit=!1,I.cartSettings=null,I.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),I.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),I._paypalMockResponse=null,I.isBigCommerce=!1,I.releaseDate="1744123643641",I.isLegacyCheckout=!1,I.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",I.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),I.isNpm=!0,I.zonosQaUrl=null,I.zonosQaUrlApi=null,I.trackEventLogs=[],I.version="v1.3.182",I.modeAlerted=!1,I.cartData=null,I.paypal=null,I.zonosMode=null,I.getCurrentTimestamp=()=>(new Date).getTime(),I.zonosController=null,I.loadTimeApiInfoList=[],I.logIntervalId=null,I.init=async s=>{const{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w,storeId:f,zonosApiKey:h}=s;if(S.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),S.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${S.version}) ======`),S.zonosApiKey=h,S.storeId=f,S.isNpm){t("====== ZONOS LOADING FROM NPM ======");const c=p();if(c&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${c} ======`,"info");const e=document.createElement("script");return e.src=`${c}/dist/scripts/zonos.js`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=S.isNpm,window.Zonos.isBigCommerce=S.isBigCommerce,window.Zonos.isLegacyCheckout=S.isLegacyCheckout,window.Zonos.init(s)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${c}`)})),void(window.isZonosPreview=!0)}if(!h&&!S.cartId)return void r("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!S.cartData&&S.cartId){t("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=i(e);if(!o&&!n)return r("[ZONOS - loadZonos] invalid cart id"),null;const s=await z({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,window.Zonos.zonosMode=s.zonosMode,{cartData:s.cartData,settings:s.settings,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(r("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(S.cartId);if(!e)return void r("Failed to get cart data");S.cartData=e.cartData,S.zonosApiKey=e.zonosApiKey,S.cartSettings=e.settings}const d=await(async()=>{const s=e(),i=n();if(!s&&!i||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:c,json:d}=await o("/api/get-test-public-credential");if(c.length||!d)return r("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",c),null;const l=d.publicCredential;return l?(t(`[ZONOS - loadZonos] Retrieve new test public token ${l}`,"info"),l):(r("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();d&&(S.zonosApiKey=d)}const y=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(S.cartId&&S.cartData||y){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${l}`,document.body.appendChild(e)}t("init zonos"),S.restoreNativeBrowserFunctions(),S.injectCustomScriptForHostedCheckout(),S.injectZonosCdn(),S.injectZonosCss(),S.injectFonts(),S.injectController({config:{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w}}),S.doneInit=!0},I.injectCustomScriptForHostedCheckout=()=>{const e=S.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),s=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||s)){if(o){t("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(s){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=s.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:s,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},I.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},I.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},I.showNotification=e=>{var n;null===(n=S.zonosController)||void 0===n||n.showNotification(e)},I.updateOrganizationName=e=>{var n;null===(n=S.zonosController)||void 0===n||n.updateOrganizationName(e)},I.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)}},I.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let t=document.querySelector(`iframe#${n}`);t||(t=document.createElement("iframe"),t.id=n,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const o=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=o,document.body.removeChild(t)},I.injectController=({config:e})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;S.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{S.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const o=document.createElement("zonos-controller");o.config=e,o.zonosApiKey=S.zonosApiKey||"",o.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;t("loading Stripe");const s=await(async(...e)=>{g=!0;const n=Date.now();return v.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)))})(n.publishableKey);s?(window.Zonos.stripe=s,o.initCheckoutElement(s)):r("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(o),S.zonosController=o,t("Zonos controller injected!")},I.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const s=`${S.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");n?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{r(`Failed to load ${c.src}`);const t=m(e);t&&S.injectScript({cdnType:t,isModule:n,theRestUrl:o})},i.appendChild(c)},I.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return b;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.182";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.182";case"vercel":return O}};return S.isNpm&&p()||n()},I.injectZonosCdn=()=>{S.injectScript({cdnType:u,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),S.injectScript({cdnType:u,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},I.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const t=S.getZonosUrl(e),o=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${O}/`,o.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${n}`,i.onerror=()=>{r(`Failed to load ${i.href}`);const t=m(e);t&&S.injectStylesheet({cdnType:t,theRestUrl:n})},o.appendChild(i)},I.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(S.injectStylesheet({cdnType:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},I.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${k}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!Z.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=k,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${k}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),t("Zonos font injected!")},I.setupGoogleFont=e=>{var n;null===(n=S.zonosController)||void 0===n||n.setupGoogleFont(e)},I.injectSupportGoogleFont=e=>{var n;t(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${k}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=k,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,s.appendChild(r),t(`[FONT] ${o} font injected!`)};export{I as Zonos}
1
+ import{g as e,a as n,l as t,h as o,b as r}from"./p-0fc02cde.js";import{_ as i,c as l}from"./p-fe253cc1.js";export{c as checkoutHiddenBtnSelector,d as domesticRedirectedBtnSelector}from"./p-fe253cc1.js";export{c as countryRequireTaxId,s as shipToTaxIdLabels}from"./p-5bd927f2.js";const a=["jsdelivr","cdnjs","unpkg","vercel"],u="jsdelivr",m=e=>{const n=a.indexOf(e);return a[n+1]||null},p=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)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),o="https://v1.3.183.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!n)return null;if("dev-elements"===n)return"https://dev.elements.zonos.com";const s=`https://${n}.preview.js.zonos.com`;return t(`[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},w="https://js.stripe.com/v3",f=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,h="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let y=null;const v=Promise.resolve().then((()=>{return e=null,null!==y||(y=new Promise(((n,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(h),window.Stripe)n(window.Stripe);else try{let o=(()=>{const e=document.querySelectorAll(`script[src^="${w}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&f.test(t.src))return t}return null})();o&&e?console.warn(h):o||(o=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",t=document.createElement("script");t.src=`${w}${n}`;const o=document.head||document.body;return o?(o.appendChild(t),t):(r("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==o||o.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):t(new Error("Stripe.js not available"))})),null==o||o.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else n(null)}))),y;var e}));let g=!1;v.catch((e=>{g||console.warn(e)}));const z=async({cartId:n,retries:s})=>{const r=e(),{errors:i,json:c,zonosMode:d}=await o("/api/zonos-elements/get-cart",{body:{isTestMode:r,tempCartUUID:n},headers:{"Content-Type":"application/json"},method:"POST"}),l=!c||i.length;return l&&s?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:s}),await new Promise((e=>setTimeout(e,500))),z({cartId:n,retries:s-1})):l?null:Object.assign(Object.assign({},c),{zonosMode:d})};var S;const j=(()=>{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})(),O="https://v1.3.183.js.zonos.com",b=j||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.183",k="https://fonts.googleapis.com",Z=/^https:\/\/fonts\.googleapis\.com/;class I{}S=I,I.doneInit=!1,I.cartSettings=null,I.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),I.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),I._paypalMockResponse=null,I.isBigCommerce=!1,I.releaseDate="1744403359888",I.isLegacyCheckout=!1,I.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",I.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),I.isNpm=!0,I.zonosQaUrl=null,I.zonosQaUrlApi=null,I.trackEventLogs=[],I.version="v1.3.183",I.modeAlerted=!1,I.cartData=null,I.paypal=null,I.zonosMode=null,I.getCurrentTimestamp=()=>(new Date).getTime(),I.zonosController=null,I.loadTimeApiInfoList=[],I.logIntervalId=null,I.init=async s=>{const{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w,storeId:f,zonosApiKey:h}=s;if(S.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),S.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${S.version}) ======`),S.zonosApiKey=h,S.storeId=f,S.isNpm){t("====== ZONOS LOADING FROM NPM ======");const c=p();if(c&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${c} ======`,"info");const e=document.createElement("script");return e.src=`${c}/dist/scripts/zonos.js`,document.head.appendChild(e),e.addEventListener("load",(()=>{window.Zonos.isNpm=S.isNpm,window.Zonos.isBigCommerce=S.isBigCommerce,window.Zonos.isLegacyCheckout=S.isLegacyCheckout,window.Zonos.init(s)})),e.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${c}`)})),void(window.isZonosPreview=!0)}if(!h&&!S.cartId)return void r("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!S.cartData&&S.cartId){t("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=i(e);if(!o&&!n)return r("[ZONOS - loadZonos] invalid cart id"),null;const s=await z({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,window.Zonos.zonosMode=s.zonosMode,{cartData:s.cartData,settings:s.settings,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(r("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(S.cartId);if(!e)return void r("Failed to get cart data");S.cartData=e.cartData,S.zonosApiKey=e.zonosApiKey,S.cartSettings=e.settings}const d=await(async()=>{const s=e(),i=n();if(!s&&!i||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:c,json:d}=await o("/api/get-test-public-credential");if(c.length||!d)return r("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",c),null;const l=d.publicCredential;return l?(t(`[ZONOS - loadZonos] Retrieve new test public token ${l}`,"info"),l):(r("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();d&&(S.zonosApiKey=d)}const y=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(S.cartId&&S.cartData||y){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id=`${l}`,document.body.appendChild(e)}t("init zonos"),S.restoreNativeBrowserFunctions(),S.injectCustomScriptForHostedCheckout(),S.injectZonosCdn(),S.injectZonosCss(),S.injectFonts(),S.injectController({config:{appearance:c,checkoutSettings:d,currencyConverter:a,helloSettings:u,onCountryChange:m,overrideCurrencyFormat:w}}),S.doneInit=!0},I.injectCustomScriptForHostedCheckout=()=>{const e=S.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),s=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||s)){if(o){t("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(s){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=s.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:s,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},I.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},I.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},I.showNotification=e=>{var n;null===(n=S.zonosController)||void 0===n||n.showNotification(e)},I.updateOrganizationName=e=>{var n;null===(n=S.zonosController)||void 0===n||n.updateOrganizationName(e)},I.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)}},I.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let t=document.querySelector(`iframe#${n}`);t||(t=document.createElement("iframe"),t.id=n,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const o=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=o,document.body.removeChild(t)},I.injectController=({config:e})=>{var n;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;S.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{S.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const o=document.createElement("zonos-controller");o.config=e,o.zonosApiKey=S.zonosApiKey||"",o.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;t("loading Stripe");const s=await(async(...e)=>{g=!0;const n=Date.now();return v.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)))})(n.publishableKey);s?(window.Zonos.stripe=s,o.initCheckoutElement(s)):r("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(o),S.zonosController=o,t("Zonos controller injected!")},I.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const s=`${S.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const i=document.head||document.body,c=document.createElement("script");n?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{r(`Failed to load ${c.src}`);const t=m(e);t&&S.injectScript({cdnType:t,isModule:n,theRestUrl:o})},i.appendChild(c)},I.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return b;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.183";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.183";case"vercel":return O}};return S.isNpm&&p()||n()},I.injectZonosCdn=()=>{S.injectScript({cdnType:u,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),S.injectScript({cdnType:u,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},I.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const t=S.getZonosUrl(e),o=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${O}/`,o.appendChild(s);const i=document.createElement("link");i.rel="stylesheet",i.href=`${t}/${n}`,i.onerror=()=>{r(`Failed to load ${i.href}`);const t=m(e);t&&S.injectStylesheet({cdnType:t,theRestUrl:n})},o.appendChild(i)},I.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(S.injectStylesheet({cdnType:u,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},I.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${k}"]`);for(let n=0;n<e.length;n++){const t=e[n];if(t&&!Z.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=k,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${k}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),t("Zonos font injected!")},I.setupGoogleFont=e=>{var n;null===(n=S.zonosController)||void 0===n||n.setupGoogleFont(e)},I.injectSupportGoogleFont=e=>{var n;t(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],s=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${k}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=k,s.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${o} font already injected`,"warn");const r=document.createElement("link");r.rel="stylesheet",r.href=e,s.appendChild(r),t(`[FONT] ${o} font injected!`)};export{I as Zonos}
@@ -1 +1 @@
1
- import{r as o,h as s,H as t,d as i}from"./p-ab68ad11.js";import{l as a}from"./p-18ec705b.js";import{d as e}from"./p-30fdcbee.js";import{c as n}from"./p-b4b7f705.js";import"./p-0fc02cde.js";import"./p-98aa88b1.js";import"./p-a1cfbd0a.js";const h=class{constructor(s){o(this,s),this.countryCode=a.selectedCountryCode,this.size=void 0}render(){if(!this.el.shadowRoot||!this.countryCode)return null;const o=`https://zonos-store-assets.s3.amazonaws.com/images/elements-flags/${this.countryCode}.svg`,i=e();return s(t,{class:"zonos--elements",style:this.size?{"--zonos--font-family":i,height:`${this.size}px`,width:`${this.size}px`}:{"--zonos--font-family":i}},s("div",{class:n(["flag-container"])},s("div",{class:"flag-icon",style:{backgroundImage:`url(${o})`}})))}get el(){return i(this)}};h.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{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";export{h as zonos_country_flag}
1
+ import{r as o,h as s,H as t,d as i}from"./p-ab68ad11.js";import{l as a}from"./p-a69dbe14.js";import{d as e}from"./p-30fdcbee.js";import{c as n}from"./p-b4b7f705.js";import"./p-0fc02cde.js";import"./p-98aa88b1.js";import"./p-a1cfbd0a.js";const h=class{constructor(s){o(this,s),this.countryCode=a.selectedCountryCode,this.size=void 0}render(){if(!this.el.shadowRoot||!this.countryCode)return null;const o=`https://zonos-store-assets.s3.amazonaws.com/images/elements-flags/${this.countryCode}.svg`,i=e();return s(t,{class:"zonos--elements",style:this.size?{"--zonos--font-family":i,height:`${this.size}px`,width:`${this.size}px`}:{"--zonos--font-family":i}},s("div",{class:n(["flag-container"])},s("div",{class:"flag-icon",style:{backgroundImage:`url(${o})`}})))}get el(){return i(this)}};h.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{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";export{h as zonos_country_flag}
@@ -1,4 +1,4 @@
1
- import{z as o,c as e}from"./p-30fdcbee.js";import{t as n,F as r,f as t,e as a,z as i,r as s,x as c,k as l}from"./p-18ec705b.js";import{h as u,l as d,b as p,j as v}from"./p-0fc02cde.js";import{t as y}from"./p-98aa88b1.js";
1
+ import{z as o,c as e}from"./p-30fdcbee.js";import{t as n,F as r,f as t,e as a,z as i,r as s,x as c,k as l}from"./p-a69dbe14.js";import{h as u,l as d,b as p,j as v}from"./p-0fc02cde.js";import{t as y}from"./p-98aa88b1.js";
2
2
  /*!
3
3
  * paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
4
4
  * Copyright 2020-present, PayPal, Inc. All rights reserved.