@zonos/elements 1.3.269 → 1.3.272

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 (207) hide show
  1. package/dist/cjs/{cart-87fbbb5a.js → cart-f1374a56.js} +1 -1
  2. package/dist/cjs/{hasInclusivePrice-c86ed1f5.js → hasInclusivePrice-2f1232e3.js} +1 -1
  3. package/dist/cjs/index.cjs.js +7 -7
  4. package/dist/cjs/{invoice-952f32c4.js → invoice-3760bec0.js} +2 -2
  5. package/dist/cjs/{isCollectMobileTablet-1cb21c59.js → isCollectMobileTablet-d5c1a9ea.js} +2 -2
  6. package/dist/cjs/{localization-a969f224.js → localization-503c8477.js} +131 -3
  7. package/dist/cjs/{paypal-cfe1e8e9.js → paypal-5e9b8224.js} +2 -2
  8. package/dist/cjs/{placeTestOrder-613878fb.js → placeTestOrder-d1be2c8e.js} +2 -2
  9. package/dist/cjs/{renderCheckoutCurrency-5a333d29.js → renderCheckoutCurrency-4486b06e.js} +2 -2
  10. package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +117 -7
  14. package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
  15. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
  17. package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
  18. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  19. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  20. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  21. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  22. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  23. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
  24. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
  25. package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
  26. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  27. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +3 -3
  28. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +4 -1
  29. package/dist/collection/components/common/zonos-stripe-phone-input/zonos-stripe-phone-input.js +1 -1
  30. package/dist/collection/components/main/zonos-controller.js +1 -1
  31. package/dist/collection/components/store/checkout/euWithdrawalRate.js +40 -0
  32. package/dist/collection/components/store/hello/localization.js +3 -1
  33. package/dist/collection/components/store/translationStore/strings.arabic.js +6 -0
  34. package/dist/collection/components/store/translationStore/strings.base.js +6 -0
  35. package/dist/collection/components/store/translationStore/strings.chinese.js +6 -0
  36. package/dist/collection/components/store/translationStore/strings.danish.js +6 -0
  37. package/dist/collection/components/store/translationStore/strings.dutch.js +6 -0
  38. package/dist/collection/components/store/translationStore/strings.french.js +6 -0
  39. package/dist/collection/components/store/translationStore/strings.german.js +6 -0
  40. package/dist/collection/components/store/translationStore/strings.hebrew.js +6 -0
  41. package/dist/collection/components/store/translationStore/strings.indonesian.js +6 -0
  42. package/dist/collection/components/store/translationStore/strings.italian.js +6 -0
  43. package/dist/collection/components/store/translationStore/strings.japanese.js +6 -0
  44. package/dist/collection/components/store/translationStore/strings.korean.js +6 -0
  45. package/dist/collection/components/store/translationStore/strings.norwegian.js +6 -0
  46. package/dist/collection/components/store/translationStore/strings.polish.js +6 -0
  47. package/dist/collection/components/store/translationStore/strings.portuguese.js +6 -0
  48. package/dist/collection/components/store/translationStore/strings.russian.js +6 -0
  49. package/dist/collection/components/store/translationStore/strings.spanish.js +6 -0
  50. package/dist/collection/components/store/translationStore/strings.swedish.js +6 -0
  51. package/dist/collection/components/store/translationStore/strings.turkish.js +6 -0
  52. package/dist/collection/components/store/translationStore/strings.vietnamese.js +6 -0
  53. package/dist/collection/components/utils/checkout/euWithdrawalNotice.js +74 -0
  54. package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +6 -2
  55. package/dist/collection/types/generated/graphql.internal.types.js +315 -182
  56. package/dist/esm/{cart-663ef7d5.js → cart-1415dcf0.js} +1 -1
  57. package/dist/esm/{hasInclusivePrice-f8bd057d.js → hasInclusivePrice-a3b0f71c.js} +1 -1
  58. package/dist/esm/index.js +7 -7
  59. package/dist/esm/{invoice-db7211a6.js → invoice-117efa2c.js} +2 -2
  60. package/dist/esm/{isCollectMobileTablet-24c912b1.js → isCollectMobileTablet-2c62fdaa.js} +2 -2
  61. package/dist/esm/{localization-dc19e8bb.js → localization-29723d89.js} +130 -4
  62. package/dist/esm/{paypal-cdbe69ef.js → paypal-cb5559d4.js} +2 -2
  63. package/dist/esm/{placeTestOrder-ba67e208.js → placeTestOrder-443376eb.js} +2 -2
  64. package/dist/esm/{renderCheckoutCurrency-fb1cbd28.js → renderCheckoutCurrency-8390b5bf.js} +2 -2
  65. package/dist/esm/zonos-address-display_8.entry.js +2 -2
  66. package/dist/esm/zonos-address_4.entry.js +2 -2
  67. package/dist/esm/zonos-card_5.entry.js +3 -3
  68. package/dist/esm/zonos-cart-items_12.entry.js +118 -8
  69. package/dist/esm/zonos-checkout.entry.js +3 -3
  70. package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
  71. package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
  72. package/dist/esm/zonos-collect.entry.js +4 -4
  73. package/dist/esm/zonos-controller.entry.js +2 -2
  74. package/dist/esm/zonos-country-flag.entry.js +1 -1
  75. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  76. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  77. package/dist/esm/zonos-hello.entry.js +1 -1
  78. package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
  79. package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
  80. package/dist/esm/zonos-invoice.entry.js +4 -4
  81. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  82. package/dist/esm/zonos-policy-consent_2.entry.js +3 -3
  83. package/dist/esm-es5/{cart-663ef7d5.js → cart-1415dcf0.js} +1 -1
  84. package/dist/esm-es5/{hasInclusivePrice-f8bd057d.js → hasInclusivePrice-a3b0f71c.js} +1 -1
  85. package/dist/esm-es5/index.js +1 -1
  86. package/dist/esm-es5/{invoice-db7211a6.js → invoice-117efa2c.js} +1 -1
  87. package/dist/esm-es5/{isCollectMobileTablet-24c912b1.js → isCollectMobileTablet-2c62fdaa.js} +1 -1
  88. package/dist/esm-es5/localization-29723d89.js +1 -0
  89. package/dist/esm-es5/{paypal-cdbe69ef.js → paypal-cb5559d4.js} +1 -1
  90. package/dist/esm-es5/{placeTestOrder-ba67e208.js → placeTestOrder-443376eb.js} +1 -1
  91. package/dist/esm-es5/{renderCheckoutCurrency-fb1cbd28.js → renderCheckoutCurrency-8390b5bf.js} +1 -1
  92. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  93. package/dist/esm-es5/zonos-address_4.entry.js +1 -1
  94. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  95. package/dist/esm-es5/zonos-cart-items_12.entry.js +1 -1
  96. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  97. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  98. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  99. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  100. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  101. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  102. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  103. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  104. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  105. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +1 -1
  106. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  107. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  108. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  109. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  110. package/dist/scripts/index.d.ts +38 -3
  111. package/dist/scripts/index.js +1 -1
  112. package/dist/scripts/loadZonos.js +1 -1
  113. package/dist/scripts/zonos.js +1 -1
  114. package/dist/types/components/store/checkout/euWithdrawalRate.d.ts +19 -0
  115. package/dist/types/components/store/translationStore/strings.arabic.d.ts +6 -0
  116. package/dist/types/components/store/translationStore/strings.base.d.ts +6 -0
  117. package/dist/types/components/store/translationStore/strings.chinese.d.ts +6 -0
  118. package/dist/types/components/store/translationStore/strings.danish.d.ts +6 -0
  119. package/dist/types/components/store/translationStore/strings.dutch.d.ts +6 -0
  120. package/dist/types/components/store/translationStore/strings.french.d.ts +6 -0
  121. package/dist/types/components/store/translationStore/strings.german.d.ts +6 -0
  122. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +6 -0
  123. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +6 -0
  124. package/dist/types/components/store/translationStore/strings.italian.d.ts +6 -0
  125. package/dist/types/components/store/translationStore/strings.japanese.d.ts +6 -0
  126. package/dist/types/components/store/translationStore/strings.korean.d.ts +6 -0
  127. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +6 -0
  128. package/dist/types/components/store/translationStore/strings.polish.d.ts +6 -0
  129. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +6 -0
  130. package/dist/types/components/store/translationStore/strings.russian.d.ts +6 -0
  131. package/dist/types/components/store/translationStore/strings.spanish.d.ts +6 -0
  132. package/dist/types/components/store/translationStore/strings.swedish.d.ts +6 -0
  133. package/dist/types/components/store/translationStore/strings.turkish.d.ts +6 -0
  134. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +6 -0
  135. package/dist/types/components/utils/checkout/euWithdrawalNotice.d.ts +9 -0
  136. package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +8 -3
  137. package/dist/types/types/checkout/CheckoutConfig.d.ts +10 -0
  138. package/dist/types/types/generated/graphql.internal.types.d.ts +396 -218
  139. package/dist/types/types/generated/graphql.internal.types.ts +508 -258
  140. package/dist/types/types/utils/ZonosSettings.d.ts +9 -0
  141. package/dist/zonos-elements/index.esm.js +1 -1
  142. package/dist/zonos-elements/p-0fa932e6.system.js +1 -0
  143. package/dist/zonos-elements/{p-680da401.entry.js → p-15c2dfea.entry.js} +1 -1
  144. package/dist/zonos-elements/{p-d932973f.system.js → p-17c7a727.system.js} +1 -1
  145. package/dist/zonos-elements/{p-09d32e53.system.entry.js → p-18c9565b.system.entry.js} +1 -1
  146. package/dist/zonos-elements/p-24aa6708.js +1 -0
  147. package/dist/zonos-elements/{p-a237429e.entry.js → p-2585034d.entry.js} +1 -1
  148. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  149. package/dist/zonos-elements/p-2cda42d5.system.js +1 -0
  150. package/dist/zonos-elements/{p-513e8278.entry.js → p-2d1055d5.entry.js} +1 -1
  151. package/dist/zonos-elements/{p-f5684fc2.system.js → p-318e704a.system.js} +1 -1
  152. package/dist/zonos-elements/{p-699276f2.system.js → p-3b600b89.system.js} +1 -1
  153. package/dist/zonos-elements/{p-9092f655.entry.js → p-3efe0875.entry.js} +1 -1
  154. package/dist/zonos-elements/{p-c62293d5.system.entry.js → p-48f3e2d2.system.entry.js} +1 -1
  155. package/dist/zonos-elements/{p-488c1af1.entry.js → p-4c94cfd3.entry.js} +1 -1
  156. package/dist/zonos-elements/{p-243dda5f.js → p-53b65b80.js} +1 -1
  157. package/dist/zonos-elements/{p-be64a52e.entry.js → p-53be08c8.entry.js} +1 -1
  158. package/dist/zonos-elements/{p-0581cfc9.system.entry.js → p-54a9c772.system.entry.js} +1 -1
  159. package/dist/zonos-elements/p-58521b25.js +1 -0
  160. package/dist/zonos-elements/{p-48ec0b61.system.entry.js → p-5bd47a30.system.entry.js} +1 -1
  161. package/dist/zonos-elements/{p-57b55808.entry.js → p-60f0ff42.entry.js} +1 -1
  162. package/dist/zonos-elements/{p-ba127f51.entry.js → p-6609467e.entry.js} +1 -1
  163. package/dist/zonos-elements/{p-9ea67d63.system.entry.js → p-6b87101d.system.entry.js} +1 -1
  164. package/dist/zonos-elements/{p-8f0bdb87.system.entry.js → p-73730eb9.system.entry.js} +1 -1
  165. package/dist/zonos-elements/{p-82ce355d.system.entry.js → p-7536cf94.system.entry.js} +1 -1
  166. package/dist/zonos-elements/{p-263d14da.system.entry.js → p-792fce17.system.entry.js} +1 -1
  167. package/dist/zonos-elements/p-7ce6b8f7.system.entry.js +1 -0
  168. package/dist/zonos-elements/{p-4af88255.entry.js → p-7d859914.entry.js} +1 -1
  169. package/dist/zonos-elements/{p-accccb9c.entry.js → p-831bcfb6.entry.js} +1 -1
  170. package/dist/zonos-elements/{p-0daed059.system.entry.js → p-9259e19b.system.entry.js} +1 -1
  171. package/dist/zonos-elements/p-93324ee5.entry.js +1 -0
  172. package/dist/zonos-elements/p-99ef86c3.js +1 -0
  173. package/dist/zonos-elements/{p-9a509268.entry.js → p-a956e28f.entry.js} +1 -1
  174. package/dist/zonos-elements/{p-bbef037c.js → p-aa3a7538.js} +1 -1
  175. package/dist/zonos-elements/{p-c4ef873a.system.entry.js → p-aafc2155.system.entry.js} +1 -1
  176. package/dist/zonos-elements/{p-9377b5c2.entry.js → p-b1b7d786.entry.js} +1 -1
  177. package/dist/zonos-elements/{p-84d4f04d.entry.js → p-b375372e.entry.js} +1 -1
  178. package/dist/zonos-elements/{p-8f817a47.system.js → p-b453ae2b.system.js} +1 -1
  179. package/dist/zonos-elements/{p-049fc407.entry.js → p-bd2daace.entry.js} +1 -1
  180. package/dist/zonos-elements/{p-9799193c.entry.js → p-c16c7978.entry.js} +1 -1
  181. package/dist/zonos-elements/{p-44147850.js → p-c425d3d9.js} +1 -1
  182. package/dist/zonos-elements/{p-fc270539.system.entry.js → p-c45df586.system.entry.js} +1 -1
  183. package/dist/zonos-elements/p-c935390d.js +1 -0
  184. package/dist/zonos-elements/{p-1bde60d5.system.entry.js → p-ccc8d669.system.entry.js} +1 -1
  185. package/dist/zonos-elements/{p-cd5444b0.js → p-cdea0f7d.js} +1 -1
  186. package/dist/zonos-elements/{p-8a24701c.system.entry.js → p-d2ba9e3c.system.entry.js} +1 -1
  187. package/dist/zonos-elements/{p-c2023a08.system.js → p-e77dd304.system.js} +1 -1
  188. package/dist/zonos-elements/{p-57c3c68f.entry.js → p-ea91600a.entry.js} +1 -1
  189. package/dist/zonos-elements/{p-882fb843.system.entry.js → p-eb254a96.system.entry.js} +1 -1
  190. package/dist/zonos-elements/{p-7662d32a.system.js → p-eb77dd11.system.js} +1 -1
  191. package/dist/zonos-elements/{p-858103a0.entry.js → p-ee00f232.entry.js} +1 -1
  192. package/dist/zonos-elements/{p-b0ed0fe7.system.entry.js → p-f4be6ce5.system.entry.js} +1 -1
  193. package/dist/zonos-elements/{p-df0c8fb6.system.entry.js → p-f5d9e5e5.system.entry.js} +1 -1
  194. package/dist/zonos-elements/{p-71528303.system.entry.js → p-f98cdb98.system.entry.js} +1 -1
  195. package/dist/zonos-elements/p-fd849c69.system.js +1 -0
  196. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  197. package/package.json +1 -1
  198. package/dist/esm-es5/localization-dc19e8bb.js +0 -1
  199. package/dist/zonos-elements/p-097d7819.js +0 -1
  200. package/dist/zonos-elements/p-2be4335f.js +0 -1
  201. package/dist/zonos-elements/p-33a37c42.system.entry.js +0 -1
  202. package/dist/zonos-elements/p-4b6e367d.system.js +0 -1
  203. package/dist/zonos-elements/p-56711a61.js +0 -1
  204. package/dist/zonos-elements/p-a3a79b2f.system.js +0 -1
  205. package/dist/zonos-elements/p-c5caf47b.system.js +0 -1
  206. package/dist/zonos-elements/p-d437bc28.js +0 -1
  207. package/dist/zonos-elements/p-e05e5825.entry.js +0 -1
@@ -69,6 +69,15 @@ export type GenericZonosSettings = {
69
69
  * List of countries that are allowed to use USD denominated cards for settlement.
70
70
  */
71
71
  usdSettlementCountryEnabled?: CountryCode[];
72
+ /**
73
+ * Ship-to countries affected by the EU right-of-withdrawal regulation. When the
74
+ * buyer's destination is in this list (and the merchant has opted into the EU
75
+ * withdrawal policy), the withdrawal notice is shown above the Pay button.
76
+ * Sourced from the API so the affected-country list is controlled centrally
77
+ * rather than hardcoded in the storefront; an absent/empty list shows it for no
78
+ * country.
79
+ */
80
+ withdrawalCountryEnabled?: CountryCode[];
72
81
  };
73
82
  export type ZonosSettingsBase = AppearanceSettingsQuery & CheckoutSettingsQuery & HelloSettingsQuery & OnlineStoreSettingsQuery & OrganizationQuery & ShippingZonesQuery & {
74
83
  inclusivePriceConfigurations: InclusivePriceConfigurationResponse;
@@ -1 +1 @@
1
- import{c as n}from"./p-595f5dd2.js";import{g as o,I as t}from"./p-e7b0c156.js";import{l as r}from"./p-0a377722.js";export{a as availableTestKeys}from"./p-0a377722.js";import{g as i,a as l,h as u,l as m}from"./p-41dd1cb8.js";import{g as p,_ as w,c as f,a as h}from"./p-b2d81c98.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b2d81c98.js";export{c as countryRequireShortAddressCode}from"./p-1d42cd20.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./p-6b361d2b.js";const y=["jsdelivr","cdnjs","unpkg","vercel"],v="jsdelivr",O=e=>{const n=y.indexOf(e);return y[n+1]||null},S=()=>{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.269.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 t=`https://${n}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${t}' for loading elements 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},g="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,z="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let b=null;const N=Promise.resolve().then((()=>{return e=null,null!==b||(b=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(z),window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${g}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&j.test(o.src))return o}return null})();t&&e?console.warn(z):t||(t=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${g}${n}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),b;var e}));let I=!1;N.catch((e=>{I||console.warn(e)}));const k=async({cartId:e,retries:n})=>{const t=i(),s=o(),c=p()||void 0,d=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&d.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:l,json:a,zonosMode:m}=await u(`/api/zonos-elements/get-cart?${d.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:c,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),w=!a||l.length;return w&&n?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),k({cartId:e,retries:n-1})):w?null:Object.assign(Object.assign({},a),{zonosMode:m})};var R;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),$=Date.now(),Z="https://v1.3.269.js.zonos.com",A=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.269",L="https://fonts.googleapis.com",U=/^https:\/\/fonts\.googleapis\.com/;class C{}R=C,C.doneInit=!1,C.cartSettings=null,C.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),C.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),C._paypalMockResponse=null,C.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,C.isBigCommerce=!1,C.releaseDate="1781282532525",C.isLegacyCheckout=!1,C.googleAnalyticId=null,C.googleAnalyticReady=!1,C.facebookPixelId=null,C.facebookPixelReady=!1,C.startLoadTime=$,C.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",C.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),C.overrideUseCustomAddressForm=!1,C.isCollect=!1,C.isInvoice=!1,C.isNpm=!0,C.zonosQaUrl=null,C.zonosQaUrlApi=null,C.trackEventLogs=[],C.version="v1.3.269",C.modeAlerted=!1,C.cartData=null,C.paypal=null,C.zonosMode=null,C.IframeService=t,C.getCurrentTimestamp=()=>(new Date).getTime(),C.zonosController=null,C.loadTimeApiInfoList=[],C.logIntervalId=null,C.init=async e=>{const{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d,storeId:a,zonosApiKey:p}=e;if(R.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),R.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${R.version}) ======`),R.zonosApiKey=p,R.storeId=a,"undefined"!=typeof window&&window.parent===window&&(R.googleAnalyticReady=!0,R.facebookPixelReady=!0),R.isNpm){r("====== ZONOS LOADING FROM NPM ======");const n=S();if(n&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${n} ======`,"info");const o=document.createElement("script");return o.src=`${n}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.zonosMode=R.zonosMode,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${n}`)})),void(window.isZonosPreview=!0)}if(!p&&!R.cartId)return void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!R.cartData&&R.cartId){r("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=w(e);if(!o&&!n)return m("[ZONOS - loadZonos] invalid cart id"),null;const t=await k({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(R.cartId);if(!e)return void m("Failed to get cart data");R.cartData=e.cartData,R.zonosApiKey=e.zonosApiKey,R.cartSettings=e.settings}const o=await(async()=>{const e=i(),n=l();if(!e&&!n||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:t}=await u("/api/get-test-public-credential");if(o.length||!t)return m("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const s=t.publicCredential;return s?(r(`[ZONOS - loadZonos] Retrieve new test public token ${s}`,"info"),s):(m("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(R.zonosApiKey=o)}const h=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(R.cartId&&R.cartData||h){r("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=`${f}`,document.body.appendChild(e)}r("init zonos"),R.restoreNativeBrowserFunctions(),R.injectCustomScriptForHostedCheckout(),R.injectZonosCdn(),R.injectZonosCss(),R.injectFonts(),R.injectCheckoutInternationalButton(),R.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d}}),R.doneInit=!0},C.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${h}`)){const e=document.createElement("button");e.id=h,e.style.display="none",document.body.appendChild(e)}},C.injectCustomScriptForHostedCheckout=()=>{const e=R.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),t=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||t)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(t){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=t.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},C.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},C.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${h}`);setTimeout((()=>{e&&e.dispatchEvent(n("click"))}),10)},C.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},C.showNotification=e=>{var n;null===(n=R.zonosController)||void 0===n||n.showNotification(e)},C.updateOrganizationName=e=>{var n;null===(n=R.zonosController)||void 0===n||n.updateOrganizationName(e)},C.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},C.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},C.injectController=({config:e})=>{var n,o;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const n=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=R.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;r("loading Stripe");const o=await(async(...e)=>{I=!0;const n=Date.now();return N.then((o=>((e,n,o)=>{if(null===e)return null;const t=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(t,o),t})(o,e,n)))})(n.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?t.initCollectElement(o):window.Zonos.isInvoice?t.initInvoiceElement(o):t.initCheckoutElement(o)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),R.zonosController=t,r("Zonos controller injected!")},C.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const t=`${R.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${t}"]`))return void r(`Zonos script "${t}" already exists in the document`,"warn");const s=document.head||document.body,i=document.createElement("script");n?i.type="module":i.noModule=!0,i.src=t,i.crossOrigin="anonymous",i.onerror=()=>{m(`Failed to load ${i.src}`);const t=O(e);t&&R.injectScript({cdnType:t,isModule:n,theRestUrl:o})},s.appendChild(i)},C.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return A;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.269";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.269";case"vercel":return Z}};return R.isNpm&&S()||n()},C.injectZonosCdn=()=>{R.injectScript({cdnType:v,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),R.injectScript({cdnType:v,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},C.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=R.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${Z}/`,t.appendChild(s);const r=document.createElement("link");r.rel="stylesheet",r.href=`${o}/${n}`,r.onerror=()=>{m(`Failed to load ${r.href}`);const o=O(e);o&&R.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(r)},C.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(R.injectStylesheet({cdnType:v,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},C.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!U.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=L,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${L}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},C.setupGoogleFont=e=>{var n;null===(n=R.zonosController)||void 0===n||n.setupGoogleFont(e)},C.injectSupportGoogleFont=e=>{var n;r(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],t=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${L}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=L,t.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,t.appendChild(s),r(`[FONT] ${o} font injected!`)};const E=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"],P=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"],F=[...E,...P];export{C as Zonos,F as checkoutSessionAttributeKeys,P as checkoutSessionImmutableAttributeKeys,E as checkoutSessionMutableAttributeKeys}
1
+ import{c as n}from"./p-595f5dd2.js";import{g as o,I as t}from"./p-e7b0c156.js";import{l as r}from"./p-0a377722.js";export{a as availableTestKeys}from"./p-0a377722.js";import{g as i,a as l,h as u,l as m}from"./p-41dd1cb8.js";import{g as p,_ as w,c as f,a as h}from"./p-b2d81c98.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./p-b2d81c98.js";export{c as countryRequireShortAddressCode}from"./p-1d42cd20.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./p-6b361d2b.js";const y=["jsdelivr","cdnjs","unpkg","vercel"],v="jsdelivr",O=e=>{const n=y.indexOf(e);return y[n+1]||null},S=()=>{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.272.js.zonos.com";if(!n&&(o.includes("test.")||o.includes("test-")))return o;if(!n&&["dev.demo.elements.zonos.com","dev.checkout.elements.zonos.com","dev.storybook.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 t=`https://${n}.preview.js.zonos.com`;return r(`[ZONOS-WARNING] using '${t}' for loading elements 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},g="https://js.stripe.com/v3",j=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,z="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let b=null;const N=Promise.resolve().then((()=>{return e=null,null!==b||(b=new Promise(((n,o)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(z),window.Stripe)n(window.Stripe);else try{let t=(()=>{const e=document.querySelectorAll(`script[src^="${g}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&j.test(o.src))return o}return null})();t&&e?console.warn(z):t||(t=(e=>{const n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",o=document.createElement("script");o.src=`${g}${n}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(m("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})(e)),null==t||t.addEventListener("load",(()=>{window.Stripe?n(window.Stripe):o(new Error("Stripe.js not available"))})),null==t||t.addEventListener("error",(()=>{o(new Error("Failed to load Stripe.js"))}))}catch(e){return void o(e)}else n(null)}))),b;var e}));let I=!1;N.catch((e=>{I||console.warn(e)}));const k=async({cartId:e,retries:n})=>{const t=i(),s=o(),c=p()||void 0,d=new URLSearchParams;s.overrideShouldEnabledCustomAddress&&d.set("overrideShouldEnabledCustomAddress",s.overrideShouldEnabledCustomAddress);const{errors:l,json:a,zonosMode:m}=await u(`/api/zonos-elements/get-cart?${d.toString()}`,{body:{isTestMode:t,renewCartExpirationToken:c,tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),w=!a||l.length;return w&&n?(r("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:n}),await new Promise((e=>setTimeout(e,500))),k({cartId:e,retries:n-1})):w?null:Object.assign(Object.assign({},a),{zonosMode:m})};var R;const T=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:n,isWhiteListed:o}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const n=new URL(e).origin,o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>n.includes(e))),t=["qa.js.zonos.com"].some((e=>n.includes(e)));return{currentLoadScriptUrl:n,isForceLoadVersionDomain:t,isWhiteListed:o}})({loadScriptSrc:null==e?void 0:e.src});return o?n:null})(),$=Date.now(),Z="https://v1.3.272.js.zonos.com",A=T||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.272",L="https://fonts.googleapis.com",U=/^https:\/\/fonts\.googleapis\.com/;class C{}R=C,C.doneInit=!1,C.cartSettings=null,C.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),C.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),C._paypalMockResponse=null,C.iframeLogType="undefined"!=typeof window?new URLSearchParams(window.location.search).get("iframeLogType"):null,C.isBigCommerce=!1,C.releaseDate="1782316398188",C.isLegacyCheckout=!1,C.googleAnalyticId=null,C.googleAnalyticReady=!1,C.facebookPixelId=null,C.facebookPixelReady=!1,C.startLoadTime=$,C.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",C.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),C.overrideUseCustomAddressForm=!1,C.isCollect=!1,C.isInvoice=!1,C.isNpm=!0,C.zonosQaUrl=null,C.zonosQaUrlApi=null,C.trackEventLogs=[],C.version="v1.3.272",C.modeAlerted=!1,C.cartData=null,C.paypal=null,C.zonosMode=null,C.IframeService=t,C.getCurrentTimestamp=()=>(new Date).getTime(),C.zonosController=null,C.loadTimeApiInfoList=[],C.logIntervalId=null,C.init=async e=>{const{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d,storeId:a,zonosApiKey:p}=e;if(R.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),R.doneInit)return;if(r(`====== ZONOS DEBUG MODE: on (${R.version}) ======`),R.zonosApiKey=p,R.storeId=a,"undefined"!=typeof window&&window.parent===window&&(R.googleAnalyticReady=!0,R.facebookPixelReady=!0),R.isNpm){r("====== ZONOS LOADING FROM NPM ======");const n=S();if(n&&!window.isZonosPreview){r(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${n} ======`,"info");const o=document.createElement("script");return o.src=`${n}/dist/scripts/zonos.js`,document.head.appendChild(o),o.addEventListener("load",(()=>{window.Zonos.isNpm=R.isNpm,window.Zonos.isBigCommerce=R.isBigCommerce,window.Zonos.isLegacyCheckout=R.isLegacyCheckout,window.Zonos.zonosMode=R.zonosMode,window.Zonos.init(e)})),o.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${n}`)})),void(window.isZonosPreview=!0)}if(!p&&!R.cartId)return void m("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!R.cartData&&R.cartId){r("Initialize cart data");const e=await(async e=>{const{isDgsCartId:n,isLegacyCartId:o}=w(e);if(!o&&!n)return m("[ZONOS - loadZonos] invalid cart id"),null;const t=await k({cartId:e,retries:5});return r("[ZONOS - loadZonos] getting temp cart data","info",t),t?(window.Zonos.storeId=t.cartData.storeId,window.Zonos.zonosApiKey=t.cartData.credentialToken,window.Zonos.zonosMode=t.zonosMode,{cartData:t.cartData,settings:t.settings,storeFavicon:t.storeFaviconUrl,storeId:t.cartData.storeId,storeLogo:t.storeLogoUrl,zonosApiKey:t.cartData.credentialToken}):(m("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)})(R.cartId);if(!e)return void m("Failed to get cart data");R.cartData=e.cartData,R.zonosApiKey=e.zonosApiKey,R.cartSettings=e.settings}const o=await(async()=>{const e=i(),n=l();if(!e&&!n||!window.Zonos.zonosApiKey)return null;if(r("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return r("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:o,json:t}=await u("/api/get-test-public-credential");if(o.length||!t)return m("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",o),null;const s=t.publicCredential;return s?(r(`[ZONOS - loadZonos] Retrieve new test public token ${s}`,"info"),s):(m("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();o&&(R.zonosApiKey=o)}const h=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(R.cartId&&R.cartData||h){r("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=`${f}`,document.body.appendChild(e)}r("init zonos"),R.restoreNativeBrowserFunctions(),R.injectCustomScriptForHostedCheckout(),R.injectZonosCdn(),R.injectZonosCss(),R.injectFonts(),R.injectCheckoutInternationalButton(),R.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:s,onCountryChange:c,overrideCurrencyFormat:d}}),R.doneInit=!0},C.injectCheckoutInternationalButton=()=>{if(!document.querySelector(`#${h}`)){const e=document.createElement("button");e.id=h,e.style.display="none",document.body.appendChild(e)}},C.injectCustomScriptForHostedCheckout=()=>{const e=R.cartData,n=(null==e?void 0:e.metadata)||[],o=n.find((e=>"customHeaderScript"===e.key)),t=n.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(o||t)){if(o){r("Injecting custom header script");const e=document.createElement("script");e.textContent=o.value,document.head.appendChild(e)}if(t){r("Injecting custom footer script");const e=document.createElement("script");e.textContent=t.value,document.body.appendChild(e)}}else r("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout})},C.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},C.triggerCheckoutInternational=async()=>{const e=document.querySelector(`#${h}`);setTimeout((()=>{e&&e.dispatchEvent(n("click"))}),10)},C.openHelloDialog=e=>{const n=document.querySelector("zonos-hello");n&&n.openHelloDialog(null==e||e)},C.showNotification=e=>{var n;null===(n=R.zonosController)||void 0===n||n.showNotification(e)},C.updateOrganizationName=e=>{var n;null===(n=R.zonosController)||void 0===n||n.updateOrganizationName(e)},C.disablePlaceOrderButtons=({autoEnable:e=!0,config:n,disable:o,placeOrderButtonSelector:t})=>{var s;if(!(null===(s=n.checkoutSettings)||void 0===s?void 0:s.disablePlaceOrderButtonActivation)&&t){const n=document.querySelectorAll(t),s=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};n.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(o?(e.setAttribute("disabled","true"),e.addEventListener("click",s)):(e.removeAttribute("disabled"),e.removeEventListener("click",s)))})),e&&o&&setTimeout((()=>{n.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",s)}))}),5e3)}},C.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const n="zonos---native-browser";let o=document.querySelector(`iframe#${n}`);o||(o=document.createElement("iframe"),o.id=n,o.style.display="none",o.style.opacity="0",o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.width="1px",o.style.height="1px",o.style.border="none",o.style.overflow="hidden",o.style.visibility="hidden",document.body.appendChild(o));const t=(null===(e=o.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=t,document.body.removeChild(o)},C.injectController=({config:e})=>{var n,o;if(document.querySelector("zonos-controller"))return;if(null===(n=e.checkoutSettings)||void 0===n?void 0:n.placeOrderButtonSelector){const n=e.checkoutSettings.placeOrderButtonSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.alwaysTriggerInternationalCheckoutSelector){const n=e.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n}),new MutationObserver((()=>{R.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:n})})).observe(document.body,{childList:!0,subtree:!0})}const t=document.createElement("zonos-controller");t.config=e,t.zonosApiKey=R.zonosApiKey||"",t.addEventListener("stripeInitEvent",(async e=>{const{detail:n}=e;r("loading Stripe");const o=await(async(...e)=>{I=!0;const n=Date.now();return N.then((o=>((e,n,o)=>{if(null===e)return null;const t=e.apply(void 0,n);return((e,n)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:n})})(t,o),t})(o,e,n)))})(n.publishableKey);o?(window.Zonos.stripe=o,window.Zonos.isCollect?t.initCollectElement(o):window.Zonos.isInvoice?t.initInvoiceElement(o):t.initCheckoutElement(o)):m("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(t),R.zonosController=t,r("Zonos controller injected!")},C.injectScript=({cdnType:e,isModule:n,theRestUrl:o})=>{const t=`${R.getZonosUrl(e)}/${o}`;if(document.querySelector(`script[src="${t}"]`))return void r(`Zonos script "${t}" already exists in the document`,"warn");const s=document.head||document.body,i=document.createElement("script");n?i.type="module":i.noModule=!0,i.src=t,i.crossOrigin="anonymous",i.onerror=()=>{m(`Failed to load ${i.src}`);const t=O(e);t&&R.injectScript({cdnType:t,isModule:n,theRestUrl:o})},s.appendChild(i)},C.getZonosUrl=e=>{const n=()=>{switch(e){case"jsdelivr":return A;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.272";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.272";case"vercel":return Z}};return R.isNpm&&S()||n()},C.injectZonosCdn=()=>{R.injectScript({cdnType:v,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),R.injectScript({cdnType:v,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),r("Zonos cdn script injected!")},C.injectStylesheet=({cdnType:e,theRestUrl:n})=>{const o=R.getZonosUrl(e),t=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${Z}/`,t.appendChild(s);const r=document.createElement("link");r.rel="stylesheet",r.href=`${o}/${n}`,r.onerror=()=>{m(`Failed to load ${r.href}`);const o=O(e);o&&R.injectStylesheet({cdnType:o,theRestUrl:n})},t.appendChild(r)},C.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?r("Zonos style links already injected","warn"):(R.injectStylesheet({cdnType:v,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),r("Zonos style css injected!"))},C.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void r("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${L}"]`);for(let n=0;n<e.length;n++){const o=e[n];if(o&&!U.test(o.href))return o}return null})())return void r("Inter font already injected","warn");const e=document.head||document.body,n=document.createElement("link");n.rel="preconnect",n.href=L,e.appendChild(n);const o=document.createElement("link");o.rel="stylesheet",o.href=`${L}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(o),r("Zonos font injected!")},C.setupGoogleFont=e=>{var n;null===(n=R.zonosController)||void 0===n||n.setupGoogleFont(e)},C.injectSupportGoogleFont=e=>{var n;r(`[FONT] injecting ${e}`);const o=null===(n=e.match(/family=(.*?):/))||void 0===n?void 0:n[1],t=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${L}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=L,t.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void r(`[FONT] ${o} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,t.appendChild(s),r(`[FONT] ${o} font injected!`)};const E=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"],P=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"],F=[...E,...P];export{C as Zonos,F as checkoutSessionAttributeKeys,P as checkoutSessionImmutableAttributeKeys,E as checkoutSessionMutableAttributeKeys}