@zonos/elements 1.3.252 → 1.3.254

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 (26) hide show
  1. package/dist/cjs/index.cjs.js +7 -7
  2. package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
  3. package/dist/cjs/zonos-checkout.cjs.entry.js +8 -0
  4. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +1 -1
  5. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.css +3 -0
  6. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +8 -0
  7. package/dist/esm/index.js +7 -7
  8. package/dist/esm/zonos-address-display_8.entry.js +2 -2
  9. package/dist/esm/zonos-checkout.entry.js +8 -0
  10. package/dist/esm-es5/index.js +1 -1
  11. package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
  12. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  13. package/dist/scripts/index.js +1 -1
  14. package/dist/scripts/loadZonos.js +1 -1
  15. package/dist/scripts/zonos.js +1 -1
  16. package/dist/zonos-elements/index.esm.js +1 -1
  17. package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
  18. package/dist/zonos-elements/p-4a38ea5e.system.entry.js +1 -0
  19. package/dist/zonos-elements/{p-983914b9.entry.js → p-4df85216.entry.js} +1 -1
  20. package/dist/zonos-elements/p-93dec11b.entry.js +1 -0
  21. package/dist/zonos-elements/{p-995cd293.system.entry.js → p-cc9620e5.system.entry.js} +1 -1
  22. package/dist/zonos-elements/{p-1872aa66.system.js → p-dcef3647.system.js} +1 -1
  23. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  24. package/package.json +1 -1
  25. package/dist/zonos-elements/p-0af96b5b.system.entry.js +0 -1
  26. package/dist/zonos-elements/p-785111e7.entry.js +0 -1
@@ -133,7 +133,7 @@ const getZonosQaUrl = () => {
133
133
  return null;
134
134
  }
135
135
  const qaUrl = extractZonosQaUrl(window.location.href);
136
- const cdnUrl = "https://v1.3.252.js.zonos.com";
136
+ const cdnUrl = "https://v1.3.254.js.zonos.com";
137
137
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
138
138
  if (!qaUrl &&
139
139
  (cdnUrl.includes('test.') ||
@@ -381,10 +381,10 @@ const zonosLoadUrl = (() => {
381
381
  return null;
382
382
  })();
383
383
  const startLoadTime = Date.now();
384
- const ZONOS_URL = "https://v1.3.252.js.zonos.com";
385
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.252";
386
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.252";
387
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.252";
384
+ const ZONOS_URL = "https://v1.3.254.js.zonos.com";
385
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.254";
386
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.254";
387
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.254";
388
388
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
389
389
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
390
390
  class Zonos {
@@ -402,7 +402,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
402
402
  ? new URLSearchParams(window.location.search).get('iframeLogType')
403
403
  : null;
404
404
  Zonos.isBigCommerce = false;
405
- Zonos.releaseDate = "1775682510484";
405
+ Zonos.releaseDate = "1776274345662";
406
406
  Zonos.isLegacyCheckout = false;
407
407
  Zonos.googleAnalyticId = null;
408
408
  Zonos.googleAnalyticReady = false;
@@ -425,7 +425,7 @@ Zonos.isNpm = true;
425
425
  Zonos.zonosQaUrl = null;
426
426
  Zonos.zonosQaUrlApi = null;
427
427
  Zonos.trackEventLogs = [];
428
- Zonos.version = `v${"1.3.252"}`;
428
+ Zonos.version = `v${"1.3.254"}`;
429
429
  Zonos.modeAlerted = false;
430
430
  Zonos.cartData = null;
431
431
  Zonos.paypal = null;
@@ -84,7 +84,7 @@ const ZonosAddressForm = class {
84
84
  }) }), index.h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: localization.translate('Last name'), inputValue: lastName, isError: containsNonLatinChars.isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
85
85
  key: 'name',
86
86
  value: `${firstName} ${e.detail}`,
87
- }) }))), index.h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, index.h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, localization.translate('Address')), index.h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: localization.translate('Country'), inputValue: country, isDisabled: true }), index.h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: localization.translate('Address line 1'), inputValue: line1, isError: containsNonLatinChars.isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), index.h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: localization.translate('Address line 2'), inputValue: line2, isError: containsNonLatinChars.isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), index.h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, index.h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: localization.translate('City'), inputValue: city, isError: containsNonLatinChars.isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), index.h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: localization.translate('State/Province'), inputValue: state, isError: containsNonLatinChars.isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), index.h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: localization.translate('Postal code'), inputValue: postal_code, isError: containsNonLatinChars.isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), index.h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: localization.translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
87
+ }) }))), index.h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, index.h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, localization.translate('Address')), index.h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: localization.translate('Country'), inputValue: country, isDisabled: true }), index.h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: localization.translate('Address line 1'), inputValue: line1, isError: containsNonLatinChars.isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), index.h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: localization.translate('Address line 2'), inputValue: line2, isError: containsNonLatinChars.isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), index.h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, index.h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: localization.translate('City'), inputValue: city, isError: containsNonLatinChars.isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), this.currentAddress.state && (index.h("zonos-input", { key: 'c5a14d96cef1d48cc82dcedaef21949a77251843', class: "zonos--form-state", inputLabel: localization.translate('State/Province'), inputValue: state, isError: containsNonLatinChars.isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) }))), index.h("zonos-input", { key: 'a3359119c246a906f0c2305207b522324ccb16bf', class: "zonos--form-postal-code", inputLabel: localization.translate('Postal code'), inputValue: postal_code, isError: containsNonLatinChars.isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), index.h("zonos-input", { key: '0196f951181a52f923ffb7cd5d4395e42b86cd8a', class: "zonos--form-phone", inputLabel: localization.translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
88
88
  }
89
89
  static get watchers() { return {
90
90
  "translatedAddress": ["watchCurrentAddress"]
@@ -199,7 +199,7 @@ const ZonosAddressSuggestions = class {
199
199
  };
200
200
  ZonosAddressSuggestions.style = ZonosAddressSuggestionsStyle0;
201
201
 
202
- const zonosAddressUpdateDialogCss = ":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 .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";
202
+ const zonosAddressUpdateDialogCss = ":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 .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--group{-ms-scroll-chaining:chained;overscroll-behavior:auto}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";
203
203
  const ZonosAddressUpdateDialogStyle0 = zonosAddressUpdateDialogCss;
204
204
 
205
205
  const ZonosAddressUpdateDialog = class {
@@ -2042,6 +2042,14 @@ const ZonosCheckout = class {
2042
2042
  zonosStore.zonosStore.sourceCurrency !== 'USD') {
2043
2043
  return;
2044
2044
  }
2045
+ // Only redirect when checkout modal is opened
2046
+ if (!this.open) {
2047
+ return;
2048
+ }
2049
+ // Check if the page is checkout page, if so, do nothing since they're already at the right page
2050
+ if (window.location.pathname.includes('/checkout')) {
2051
+ return;
2052
+ }
2045
2053
  const shippingCountry = addressEventData.value.address.country;
2046
2054
  if (shippingCountry &&
2047
2055
  zonosStore.zonosStore.disabledCountries.includes(shippingCountry)) {
@@ -35,7 +35,7 @@ export class ZonosAddressForm {
35
35
  }) }), h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
36
36
  key: 'name',
37
37
  value: `${firstName} ${e.detail}`,
38
- }) }))), h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, translate('Address')), h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
38
+ }) }))), h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, translate('Address')), h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), this.currentAddress.state && (h("zonos-input", { key: 'c5a14d96cef1d48cc82dcedaef21949a77251843', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) }))), h("zonos-input", { key: 'a3359119c246a906f0c2305207b522324ccb16bf', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: '0196f951181a52f923ffb7cd5d4395e42b86cd8a', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
39
39
  }
40
40
  static get is() { return "zonos-address-form"; }
41
41
  static get encapsulation() { return "shadow"; }
@@ -71,6 +71,9 @@
71
71
  :host .zonos--group::-webkit-scrollbar-thumb:hover {
72
72
  background: #d6d6d6;
73
73
  }
74
+ :host .zonos--group {
75
+ overscroll-behavior: auto;
76
+ }
74
77
  :host .zonos--address-display-group {
75
78
  display: flex;
76
79
  gap: 8px;
@@ -1490,6 +1490,14 @@ export class ZonosCheckout {
1490
1490
  zonosStore.sourceCurrency !== 'USD') {
1491
1491
  return;
1492
1492
  }
1493
+ // Only redirect when checkout modal is opened
1494
+ if (!this.open) {
1495
+ return;
1496
+ }
1497
+ // Check if the page is checkout page, if so, do nothing since they're already at the right page
1498
+ if (window.location.pathname.includes('/checkout')) {
1499
+ return;
1500
+ }
1493
1501
  const shippingCountry = addressEventData.value.address.country;
1494
1502
  if (shippingCountry &&
1495
1503
  zonosStore.disabledCountries.includes(shippingCountry)) {
package/dist/esm/index.js CHANGED
@@ -131,7 +131,7 @@ const getZonosQaUrl = () => {
131
131
  return null;
132
132
  }
133
133
  const qaUrl = extractZonosQaUrl(window.location.href);
134
- const cdnUrl = "https://v1.3.252.js.zonos.com";
134
+ const cdnUrl = "https://v1.3.254.js.zonos.com";
135
135
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
136
136
  if (!qaUrl &&
137
137
  (cdnUrl.includes('test.') ||
@@ -379,10 +379,10 @@ const zonosLoadUrl = (() => {
379
379
  return null;
380
380
  })();
381
381
  const startLoadTime = Date.now();
382
- const ZONOS_URL = "https://v1.3.252.js.zonos.com";
383
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.252";
384
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.252";
385
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.252";
382
+ const ZONOS_URL = "https://v1.3.254.js.zonos.com";
383
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.254";
384
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.254";
385
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.254";
386
386
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
387
387
  const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
388
388
  class Zonos {
@@ -400,7 +400,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
400
400
  ? new URLSearchParams(window.location.search).get('iframeLogType')
401
401
  : null;
402
402
  Zonos.isBigCommerce = false;
403
- Zonos.releaseDate = "1775682510484";
403
+ Zonos.releaseDate = "1776274345662";
404
404
  Zonos.isLegacyCheckout = false;
405
405
  Zonos.googleAnalyticId = null;
406
406
  Zonos.googleAnalyticReady = false;
@@ -423,7 +423,7 @@ Zonos.isNpm = true;
423
423
  Zonos.zonosQaUrl = null;
424
424
  Zonos.zonosQaUrlApi = null;
425
425
  Zonos.trackEventLogs = [];
426
- Zonos.version = `v${"1.3.252"}`;
426
+ Zonos.version = `v${"1.3.254"}`;
427
427
  Zonos.modeAlerted = false;
428
428
  Zonos.cartData = null;
429
429
  Zonos.paypal = null;
@@ -80,7 +80,7 @@ const ZonosAddressForm = class {
80
80
  }) }), h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
81
81
  key: 'name',
82
82
  value: `${firstName} ${e.detail}`,
83
- }) }))), h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, translate('Address')), h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
83
+ }) }))), h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, translate('Address')), h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), this.currentAddress.state && (h("zonos-input", { key: 'c5a14d96cef1d48cc82dcedaef21949a77251843', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) }))), h("zonos-input", { key: 'a3359119c246a906f0c2305207b522324ccb16bf', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: '0196f951181a52f923ffb7cd5d4395e42b86cd8a', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
84
84
  }
85
85
  static get watchers() { return {
86
86
  "translatedAddress": ["watchCurrentAddress"]
@@ -195,7 +195,7 @@ const ZonosAddressSuggestions = class {
195
195
  };
196
196
  ZonosAddressSuggestions.style = ZonosAddressSuggestionsStyle0;
197
197
 
198
- const zonosAddressUpdateDialogCss = ":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 .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";
198
+ const zonosAddressUpdateDialogCss = ":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 .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--group{-ms-scroll-chaining:chained;overscroll-behavior:auto}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";
199
199
  const ZonosAddressUpdateDialogStyle0 = zonosAddressUpdateDialogCss;
200
200
 
201
201
  const ZonosAddressUpdateDialog = class {
@@ -2038,6 +2038,14 @@ const ZonosCheckout = class {
2038
2038
  zonosStore.sourceCurrency !== 'USD') {
2039
2039
  return;
2040
2040
  }
2041
+ // Only redirect when checkout modal is opened
2042
+ if (!this.open) {
2043
+ return;
2044
+ }
2045
+ // Check if the page is checkout page, if so, do nothing since they're already at the right page
2046
+ if (window.location.pathname.includes('/checkout')) {
2047
+ return;
2048
+ }
2041
2049
  const shippingCountry = addressEventData.value.address.country;
2042
2050
  if (shippingCountry &&
2043
2051
  zonosStore.disabledCountries.includes(shippingCountry)) {
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,n,o,t){function r(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,i){function a(e){try{c(t.next(e))}catch(e){i(e)}}function s(e){try{c(t["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):r(e.value).then(a,s)}c((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,r,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return c([e,n])}}function c(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(t=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=n.call(e,o)}catch(e){s=[6,e];r=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,o){if(o||arguments.length===2)for(var t=0,r=n.length,i;t<r;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-0bc3e118.js";import{l as log}from"./VarianceTest-572cecf5.js";export{a as availableTestKeys}from"./VarianceTest-572cecf5.js";import{g as getIsTestMode,a as getIsStagingMode,h as handleFetch,l as logError}from"./handleFetch-a844cac1.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as countryRequireShortAddressCode}from"./ShortAddressCode-7620e622.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./TaxId-50d72254.js";var checkIfLoadVersionDomain=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var t=["qa.js.zonos.com"];var r=new URL(n).origin;var i=o.some((function(e){return r.includes(e)}));var a=t.some((function(e){return r.includes(e)}));return{currentLoadScriptUrl:r,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(e){var n=fallbackList.indexOf(e);var o=fallbackList[n+1];return o||null};var getWithTestPublicCredential=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,n,o,t,r,i;return __generator(this,(function(a){switch(a.label){case 0:e=getIsTestMode();n=getIsStagingMode();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}log("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){log("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,handleFetch("/api/get-test-public-credential")];case 1:o=a.sent(),t=o.errors,r=o.json;if(t.length||!r){logError("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t);return[2,null]}i=r.publicCredential;if(!i){logError("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}log("[ZONOS - loadZonos] Retrieve new test public token ".concat(i),"info");return[2,i]}}))}))};var extractZonosQaUrl=function(e){if(!e){return null}var n=new URL(e).searchParams;var o=n.get("zonosQaUrl");if(!o){return null}var t=/[^a-zA-Z0-9-_]+/.test(o);if(!!t){return null}return o};var getZonosQaUrl=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.3.252.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(n==="dev-elements"){return"https://dev.elements.zonos.com"}var t="preview.js.zonos.com";var r="https://".concat(n,".").concat(t);log("[ZONOS-WARNING] using '".concat(r,"' for loading elements script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var o="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",o);window.location.reload();return null}));return r};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var e=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var n=0;n<e.length;n++){var o=e[n];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(n);var t=document.head||document.body;if(!t){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}t.appendChild(o);return o};var zonosStripeLoadScript=function(e){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(n,o){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){n(window.Stripe);return}try{var t=zonosStripeFindScript();if(t&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!t){t=injectScript(e)}t===null||t===void 0?void 0:t.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));t===null||t===void 0?void 0:t.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(e){o(e);return}}));return stripePromise$1};var registerWrapper=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var initStripe=function(e,n,o){if(e===null){return null}var t=e.apply(undefined,n);registerWrapper(t,o);return t};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(e){if(!loadCalled){console.warn(e)}}));var zonosLoadStripe=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(void 0,void 0,void 0,(function(){var n;return __generator(this,(function(o){loadCalled=true;n=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,e,n)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var e=new URLSearchParams(window.location.search);var n=e.get(TEMP_CART_ID_QUERY_PARAM);return n};var getCartInfoById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,o,t,r,i,a,s,c,u;var d=e.cartId,l=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=getIsTestMode();o=getGenericSettingsOverride();t=getAbandonedCartRenewTokenValue()||undefined;r=new URLSearchParams;if(o.overrideShouldEnabledCustomAddress){r.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress)}return[4,handleFetch("/api/zonos-elements/get-cart?".concat(r.toString()),{body:{isTestMode:n,renewCartExpirationToken:t,tempCartUUID:d},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:i=e.sent(),a=i.errors,s=i.json,c=i.zonosMode;u=!s||a.length;if(!(u&&l))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:l});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getCartInfoById({cartId:d,retries:l-1})];case 3:if(u){return[2,null]}return[2,Object.assign(Object.assign({},s),{zonosMode:c})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),o=n.isDgsCartId,t=n.isLegacyCartId;if(!t&&!o){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getCartInfoById({cartId:e,retries:5})];case 1:r=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.3.252.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.252";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.252";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.252";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="1775682510484";Zonos.isLegacyCheckout=false;Zonos.googleAnalyticId=null;Zonos.googleAnalyticReady=false;Zonos.startLoadTime=startLoadTime;Zonos.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isCollect=false;Zonos.isInvoice=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.3.252");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.zonosMode=null;Zonos.IframeService=IframeService;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.loadTimeApiInfoList=[];Zonos.logIntervalId=null;Zonos.init=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r,i,a,s,c,u,d,l,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,o=e.checkoutSettings,t=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,c=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=c;_a.storeId=s;if(typeof window!=="undefined"&&window.parent===window){_a.googleAnalyticReady=true}if(!_a.isNpm)return[3,4];log("====== ZONOS LOADING FROM NPM ======");u=getZonosQaUrl();if(u&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(u," ======"),"info");d=document.createElement("script");d.src="".concat(u,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;window.Zonos.zonosMode=_a.zonosMode;void window.Zonos.init(e)}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(u))}));window.isZonosPreview=true;return[2]}if(!c&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartDataWithSettings(_a.cartId)];case 1:l=p.sent();if(!l){logError("Failed to get cart data");return[2]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;p.label=2;case 2:return[4,getWithTestPublicCredential()];case 3:f=p.sent();if(f){_a.zonosApiKey=f}p.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");_=document.createElement("button");_.style.display="none";_.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(_)}log("init zonos");_a.restoreNativeBrowserFunctions();_a.injectCustomScriptForHostedCheckout();_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectCheckoutInternationalButton();_a.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:a}});_a.doneInit=true;return[2]}}))}))};Zonos.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector))){var e=document.createElement("button");e.id=checkoutHiddenInternationalBtnSelector;e.style.display="none";document.body.appendChild(e)}};Zonos.injectCustomScriptForHostedCheckout=function(){var e=_a.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var o=n.find((function(e){return e.key==="customHeaderScript"}));var t=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!o&&!t){log("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(o){log("Injecting custom header script");var r=document.createElement("script");r.textContent=o.value;document.head.appendChild(r)}if(t){log("Injecting custom footer script");var r=document.createElement("script");r.textContent=t.value;document.body.appendChild(r)}};Zonos.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};Zonos.triggerCheckoutInternational=function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));setTimeout((function(){if(e){e.dispatchEvent(createCustomEvent("click"))}}),10);return[2]}))}))};Zonos.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};Zonos.showNotification=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.showNotification(e))};Zonos.updateOrganizationName=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};Zonos.disablePlaceOrderButtons=function(e){var n=e.autoEnable,o=n===void 0?true:n,t=e.config,r=e.disable,i=e.placeOrderButtonSelector;var a;if((a=t.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var c=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};s.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(r){e.setAttribute("disabled","true");e.addEventListener("click",c)}else{e.removeAttribute("disabled");e.removeEventListener("click",c)}}));if(o&&r){setTimeout((function(){s.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",c)}))}),5e3)}}};Zonos.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var o="zonos---native-browser";var t=document.querySelector("iframe#".concat(o));if(!t){t=document.createElement("iframe");t.id=o;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)}var r=((e=t.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=r;document.body.removeChild(t)};Zonos.injectController=function(e){var n=e.config;var o,t;if(document.querySelector("zonos-controller")){return}if((o=n.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var r=n.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r})}));i.observe(document.body,{childList:true,subtree:true})}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=n;s.zonosApiKey=_a.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o;return __generator(this,(function(t){switch(t.label){case 0:n=e.detail;log("loading Stripe");return[4,zonosLoadStripe(n.publishableKey)];case 1:o=t.sent();if(!o){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;if(window.Zonos.isCollect){void s.initCollectElement(o)}else if(window.Zonos.isInvoice){void s.initInvoiceElement(o)}else{void s.initCheckoutElement(o)}return[2]}}))}))}));document.body.appendChild(s);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(e){var n=e.cdnType,o=e.isModule,t=e.theRestUrl;var r=_a.getZonosUrl(n);var i="".concat(r,"/").concat(t);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var c=document.createElement("script");if(!!o){c.type="module"}else{c.noModule=true}c.src=i;c.crossOrigin="anonymous";c.onerror=function(){logError("Failed to load ".concat(c.src));var e=getNextFallbackUrl(n);if(!e){return}_a.injectScript({cdnType:e,isModule:o,theRestUrl:t})};s.appendChild(c)};Zonos.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||n()}return n()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(e){var n=e.cdnType,o=e.theRestUrl;var t=_a.getZonosUrl(n);var r=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");r.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(t,"/").concat(o);a.onerror=function(){logError("Failed to load ".concat(a.href));var e=getNextFallbackUrl(n);if(!e){return}_a.injectStylesheet({cdnType:e,theRestUrl:o})};r.appendChild(a)};Zonos.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){log("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(GOOGLE_FONT_URL,'"]'));for(var o=0;o<n.length;o++){var t=n[o];if(!t){continue}if(GOOGLE_FONT_REGEX.test(t.href)){continue}return t}return null};if(e()){log("Inter font already injected","warn");return}var n=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=GOOGLE_FONT_URL;n.appendChild(o);var t=document.createElement("link");t.rel="stylesheet";t.href="".concat(GOOGLE_FONT_URL,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(t);log("Zonos font injected!")};Zonos.setupGoogleFont=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};Zonos.injectSupportGoogleFont=function(e){var n;log("[FONT] injecting ".concat(e));var o=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var t=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var r=document.createElement("link");r.rel="preconnect";r.href=GOOGLE_FONT_URL;t.appendChild(r)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;t.appendChild(i);log("[FONT] ".concat(o," font injected!"))};var checkoutSessionMutableAttributeKeys=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"];var checkoutSessionImmutableAttributeKeys=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"];var checkoutSessionAttributeKeys=__spreadArray(__spreadArray([],checkoutSessionMutableAttributeKeys,true),checkoutSessionImmutableAttributeKeys,true);export{Zonos,checkoutSessionAttributeKeys,checkoutSessionImmutableAttributeKeys,checkoutSessionMutableAttributeKeys};
1
+ var __awaiter=this&&this.__awaiter||function(e,n,o,t){function r(e){return e instanceof o?e:new o((function(n){n(e)}))}return new(o||(o=Promise))((function(o,i){function a(e){try{c(t.next(e))}catch(e){i(e)}}function s(e){try{c(t["throw"](e))}catch(e){i(e)}}function c(e){e.done?o(e.value):r(e.value).then(a,s)}c((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,r,i,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(n){return c([e,n])}}function c(s){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(o=0)),o)try{if(t=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1];i=s;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(s);break}if(i[2])o.ops.pop();o.trys.pop();continue}s=n.call(e,o)}catch(e){s=[6,e];r=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,n,o){if(o||arguments.length===2)for(var t=0,r=n.length,i;t<r;t++){if(i||!(t in n)){if(!i)i=Array.prototype.slice.call(n,0,t);i[t]=n[t]}}return e.concat(i||Array.prototype.slice.call(n))};import{c as createCustomEvent}from"./createCustomEvent-58159025.js";import{g as getGenericSettingsOverride,I as IframeService}from"./getGenericSettingsOverride-0bc3e118.js";import{l as log}from"./VarianceTest-572cecf5.js";export{a as availableTestKeys}from"./VarianceTest-572cecf5.js";import{g as getIsTestMode,a as getIsStagingMode,h as handleFetch,l as logError}from"./handleFetch-a844cac1.js";import{g as getAbandonedCartRenewTokenValue,_ as _getIsValidCartId,c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as checkoutHiddenBtnSelector,a as checkoutHiddenInternationalBtnSelector,d as domesticRedirectedBtnSelector}from"./CheckoutConfig-724d7bae.js";export{c as countryRequireShortAddressCode}from"./ShortAddressCode-7620e622.js";export{c as countryRequireTaxId,e as euCountryCodes,s as shipToTaxIdLabels}from"./TaxId-50d72254.js";var checkIfLoadVersionDomain=function(e){var n=e.loadScriptSrc;if(!n){return{currentLoadScriptUrl:"",isForceLoadVersionDomain:false,isWhiteListed:false}}var o=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"];var t=["qa.js.zonos.com"];var r=new URL(n).origin;var i=o.some((function(e){return r.includes(e)}));var a=t.some((function(e){return r.includes(e)}));return{currentLoadScriptUrl:r,isForceLoadVersionDomain:a,isWhiteListed:i}};var fallbackList=["jsdelivr","cdnjs","unpkg","vercel"];var MAIN_LOAD_CDN_TYPE="jsdelivr";var getNextFallbackUrl=function(e){var n=fallbackList.indexOf(e);var o=fallbackList[n+1];return o||null};var getWithTestPublicCredential=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,n,o,t,r,i;return __generator(this,(function(a){switch(a.label){case 0:e=getIsTestMode();n=getIsStagingMode();if(!e&&!n||!window.Zonos.zonosApiKey){return[2,null]}log("[ZONOS - loadZonos] Attempt test public credential","info");if(!!window.Zonos.zonosApiKey.includes("credential_test")){log("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info");return[2,null]}return[4,handleFetch("/api/get-test-public-credential")];case 1:o=a.sent(),t=o.errors,r=o.json;if(t.length||!r){logError("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",t);return[2,null]}i=r.publicCredential;if(!i){logError("[ZONOS - loadZonos] No test public key credential. Keep using production key");return[2,null]}log("[ZONOS - loadZonos] Retrieve new test public token ".concat(i),"info");return[2,i]}}))}))};var extractZonosQaUrl=function(e){if(!e){return null}var n=new URL(e).searchParams;var o=n.get("zonosQaUrl");if(!o){return null}var t=/[^a-zA-Z0-9-_]+/.test(o);if(!!t){return null}return o};var getZonosQaUrl=function(){var e=window&&window.location.href.includes("forceLoadCdn");if(typeof window==="undefined"||e){return null}var n=extractZonosQaUrl(window.location.href);var o="https://v1.3.254.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(n==="dev-elements"){return"https://dev.elements.zonos.com"}var t="preview.js.zonos.com";var r="https://".concat(n,".").concat(t);log("[ZONOS-WARNING] using '".concat(r,"' for loading elements script"),"warn");void fetch(r).then((function(){window.sessionStorage.removeItem("zonos--checkout-session-id");window.sessionStorage.removeItem("zonos--client-secret")})).catch((function(){alert("[ZONOS-WARNING] '".concat(r,"' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE"));var e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");var n=window.location.pathname;var o="".concat(n,"?").concat(e.toString());window.history.replaceState(window.history.state,"",o);window.location.reload();return null}));return r};var V3_URL="https://js.stripe.com/v3";var V3_URL_REGEX=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var EXISTING_SCRIPT_MESSAGE="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";var zonosStripeFindScript=function(){var e=document.querySelectorAll('script[src^="'.concat(V3_URL,'"]'));for(var n=0;n<e.length;n++){var o=e[n];if(!o){continue}if(!V3_URL_REGEX.test(o.src)){continue}return o}return null};var stripePromise$1=null;var injectScript=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"";var o=document.createElement("script");o.src="".concat(V3_URL).concat(n);var t=document.head||document.body;if(!t){logError("Expected document.body not to be null. Stripe.js requires a <body> element.");return null}t.appendChild(o);return o};var zonosStripeLoadScript=function(e){if(stripePromise$1!==null){return stripePromise$1}stripePromise$1=new Promise((function(n,o){if(typeof window==="undefined"||typeof document==="undefined"){n(null);return}if(window.Stripe&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}if(window.Stripe){n(window.Stripe);return}try{var t=zonosStripeFindScript();if(t&&e){console.warn(EXISTING_SCRIPT_MESSAGE)}else if(!t){t=injectScript(e)}t===null||t===void 0?void 0:t.addEventListener("load",(function(){if(window.Stripe){n(window.Stripe)}else{o(new Error("Stripe.js not available"))}}));t===null||t===void 0?void 0:t.addEventListener("error",(function(){o(new Error("Failed to load Stripe.js"))}))}catch(e){o(e);return}}));return stripePromise$1};var registerWrapper=function(e,n){if(!e||!e._registerWrapper){return}e._registerWrapper({name:"stripe-js",startTime:n})};var initStripe=function(e,n,o){if(e===null){return null}var t=e.apply(undefined,n);registerWrapper(t,o);return t};var stripePromise=Promise.resolve().then((function(){return zonosStripeLoadScript(null)}));var loadCalled=false;stripePromise.catch((function(e){if(!loadCalled){console.warn(e)}}));var zonosLoadStripe=function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return __awaiter(void 0,void 0,void 0,(function(){var n;return __generator(this,(function(o){loadCalled=true;n=Date.now();return[2,stripePromise.then((function(o){return initStripe(o,e,n)}))]}))}))};var TEMP_CART_ID_QUERY_PARAM="tempCartUUID";var getCartIdFromQueryParam=function(){var e=new URLSearchParams(window.location.search);var n=e.get(TEMP_CART_ID_QUERY_PARAM);return n};var getCartInfoById=function(e){return __awaiter(void 0,[e],void 0,(function(e){var n,o,t,r,i,a,s,c,u;var d=e.cartId,l=e.retries;return __generator(this,(function(e){switch(e.label){case 0:n=getIsTestMode();o=getGenericSettingsOverride();t=getAbandonedCartRenewTokenValue()||undefined;r=new URLSearchParams;if(o.overrideShouldEnabledCustomAddress){r.set("overrideShouldEnabledCustomAddress",o.overrideShouldEnabledCustomAddress)}return[4,handleFetch("/api/zonos-elements/get-cart?".concat(r.toString()),{body:{isTestMode:n,renewCartExpirationToken:t,tempCartUUID:d},headers:{"Content-Type":"application/json"},method:"POST"})];case 1:i=e.sent(),a=i.errors,s=i.json,c=i.zonosMode;u=!s||a.length;if(!(u&&l))return[3,3];log("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:l});return[4,new Promise((function(e){return setTimeout(e,500)}))];case 2:e.sent();return[2,getCartInfoById({cartId:d,retries:l-1})];case 3:if(u){return[2,null]}return[2,Object.assign(Object.assign({},s),{zonosMode:c})]}}))}))};var setupCartDataWithSettings=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r;return __generator(this,(function(i){switch(i.label){case 0:n=_getIsValidCartId(e),o=n.isDgsCartId,t=n.isLegacyCartId;if(!t&&!o){logError("[ZONOS - loadZonos] invalid cart id");return[2,null]}return[4,getCartInfoById({cartId:e,retries:5})];case 1:r=i.sent();log("[ZONOS - loadZonos] getting temp cart data","info",r);if(!r){logError("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process.");return[2,null]}window.Zonos.storeId=r.cartData.storeId;window.Zonos.zonosApiKey=r.cartData.credentialToken;window.Zonos.zonosMode=r.zonosMode;return[2,{cartData:r.cartData,settings:r.settings,storeFavicon:r.storeFaviconUrl,storeId:r.cartData.storeId,storeLogo:r.storeLogoUrl,zonosApiKey:r.cartData.credentialToken}]}}))}))};var _a;var zonosLoadUrl=function(){if(typeof document==="undefined"){return null}var e=document.querySelector('script[src*="/zonos.js"]');var n=checkIfLoadVersionDomain({loadScriptSrc:e===null||e===void 0?void 0:e.src}),o=n.currentLoadScriptUrl,t=n.isWhiteListed;if(t){return o}return null}();var startLoadTime=Date.now();var ZONOS_URL="https://v1.3.254.js.zonos.com";var JS_DELIVR_ZONOS_URL=zonosLoadUrl||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.254";var UNPKG_ZONOS_URL="https://unpkg.com/@zonos/elements@1.3.254";var CDNJS_ZONOS_URL="https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.254";var GOOGLE_FONT_URL="https://fonts.googleapis.com";var GOOGLE_FONT_REGEX=/^https:\/\/fonts\.googleapis\.com/;var Zonos=function(){function e(){}return e}();_a=Zonos;Zonos.doneInit=false;Zonos.cartSettings=null;Zonos.debug=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/);Zonos.zonosConversionTest=typeof window!=="undefined"&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/);Zonos._paypalMockResponse=null;Zonos.iframeLogType=typeof window!=="undefined"?new URLSearchParams(window.location.search).get("iframeLogType"):null;Zonos.isBigCommerce=false;Zonos.releaseDate="1776274345662";Zonos.isLegacyCheckout=false;Zonos.googleAnalyticId=null;Zonos.googleAnalyticReady=false;Zonos.startLoadTime=startLoadTime;Zonos.domain=typeof window!=="undefined"?window.location!=window.parent.location&&document.referrer||document.location.hostname:"";Zonos.showBaseForeign=typeof window!=="undefined"&&window.location.search.includes("zonosShowBaseForeign");Zonos.overrideUseCustomAddressForm=false;Zonos.isCollect=false;Zonos.isInvoice=false;Zonos.isNpm=true;Zonos.zonosQaUrl=null;Zonos.zonosQaUrlApi=null;Zonos.trackEventLogs=[];Zonos.version="v".concat("1.3.254");Zonos.modeAlerted=false;Zonos.cartData=null;Zonos.paypal=null;Zonos.zonosMode=null;Zonos.IframeService=IframeService;Zonos.getCurrentTimestamp=function(){return(new Date).getTime()};Zonos.zonosController=null;Zonos.loadTimeApiInfoList=[];Zonos.logIntervalId=null;Zonos.init=function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o,t,r,i,a,s,c,u,d,l,f,v,m,_;return __generator(this,(function(p){switch(p.label){case 0:n=e.appearance,o=e.checkoutSettings,t=e.currencyConverter,r=e.helloSettings,i=e.onCountryChange,a=e.overrideCurrencyFormat,s=e.storeId,c=e.zonosApiKey;_a.cartId=getCartIdFromQueryParam();if(_a.doneInit){return[2]}log("====== ZONOS DEBUG MODE: on (".concat(_a.version,") ======"));_a.zonosApiKey=c;_a.storeId=s;if(typeof window!=="undefined"&&window.parent===window){_a.googleAnalyticReady=true}if(!_a.isNpm)return[3,4];log("====== ZONOS LOADING FROM NPM ======");u=getZonosQaUrl();if(u&&!window.isZonosPreview){log('====== RE-INJECT "zonos.js" FROM PRVIEW: '.concat(u," ======"),"info");d=document.createElement("script");d.src="".concat(u,"/dist/scripts/zonos.js");document.head.appendChild(d);d.addEventListener("load",(function(){window.Zonos.isNpm=_a.isNpm;window.Zonos.isBigCommerce=_a.isBigCommerce;window.Zonos.isLegacyCheckout=_a.isLegacyCheckout;window.Zonos.zonosMode=_a.zonosMode;void window.Zonos.init(e)}));d.addEventListener("error",(function(){alert('[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: '.concat(u))}));window.isZonosPreview=true;return[2]}if(!c&&!_a.cartId){logError("Zonos API key is required unless `tempCartUUID` is provided in url query params.");return[2]}if(!(!_a.cartData&&_a.cartId))return[3,2];log("Initialize cart data");return[4,setupCartDataWithSettings(_a.cartId)];case 1:l=p.sent();if(!l){logError("Failed to get cart data");return[2]}_a.cartData=l.cartData;_a.zonosApiKey=l.zonosApiKey;_a.cartSettings=l.settings;p.label=2;case 2:return[4,getWithTestPublicCredential()];case 3:f=p.sent();if(f){_a.zonosApiKey=f}p.label=4;case 4:v=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");m=_a.cartId&&_a.cartData||!!v;if(m){log("Cart data or stripe client secret is available, inject hidden button and trigger checkout");_=document.createElement("button");_.style.display="none";_.id="".concat(checkoutHiddenBtnSelector);document.body.appendChild(_)}log("init zonos");_a.restoreNativeBrowserFunctions();_a.injectCustomScriptForHostedCheckout();_a.injectZonosCdn();_a.injectZonosCss();_a.injectFonts();_a.injectCheckoutInternationalButton();_a.injectController({config:{appearance:n,checkoutSettings:o,currencyConverter:t,helloSettings:r,onCountryChange:i,overrideCurrencyFormat:a}});_a.doneInit=true;return[2]}}))}))};Zonos.injectCheckoutInternationalButton=function(){if(!document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector))){var e=document.createElement("button");e.id=checkoutHiddenInternationalBtnSelector;e.style.display="none";document.body.appendChild(e)}};Zonos.injectCustomScriptForHostedCheckout=function(){var e=_a.cartData;var n=(e===null||e===void 0?void 0:e.metadata)||[];var o=n.find((function(e){return e.key==="customHeaderScript"}));var t=n.find((function(e){return e.key==="customFooterScript"}));if(!window.Zonos.isLegacyCheckout||!o&&!t){log("Skip injecting custom script for hosted checkout","info",{footerScript:t,headerScript:o,isLegacyCheckout:window.Zonos.isLegacyCheckout});return}if(o){log("Injecting custom header script");var r=document.createElement("script");r.textContent=o.value;document.head.appendChild(r)}if(t){log("Injecting custom footer script");var r=document.createElement("script");r.textContent=t.value;document.body.appendChild(r)}};Zonos.displayCurrency=function(){var e=document.querySelector("zonos-hello");if(e){void e.displayCurrency()}};Zonos.triggerCheckoutInternational=function(){return __awaiter(void 0,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=document.querySelector("#".concat(checkoutHiddenInternationalBtnSelector));setTimeout((function(){if(e){e.dispatchEvent(createCustomEvent("click"))}}),10);return[2]}))}))};Zonos.openHelloDialog=function(e){var n=document.querySelector("zonos-hello");if(n){void n.openHelloDialog(e!==null&&e!==void 0?e:true)}};Zonos.showNotification=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.showNotification(e))};Zonos.updateOrganizationName=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.updateOrganizationName(e))};Zonos.disablePlaceOrderButtons=function(e){var n=e.autoEnable,o=n===void 0?true:n,t=e.config,r=e.disable,i=e.placeOrderButtonSelector;var a;if((a=t.checkoutSettings)===null||a===void 0?void 0:a.disablePlaceOrderButtonActivation){return}if(i){var s=document.querySelectorAll(i);var c=function(e){var n=e.target;if(n.getAttribute("disabled")){e.preventDefault();e.stopPropagation()}};s.forEach((function(e){var n=e.getAttribute("data-zonos-checkout-attached");if(n){return}if(r){e.setAttribute("disabled","true");e.addEventListener("click",c)}else{e.removeAttribute("disabled");e.removeEventListener("click",c)}}));if(o&&r){setTimeout((function(){s.forEach((function(e){e.removeAttribute("disabled");e.removeEventListener("click",c)}))}),5e3)}}};Zonos.restoreNativeBrowserFunctions=function(){var e;var n=new URL(window.location.href).searchParams.get("useMerchantPolyfill")==="1";if(n){return}var o="zonos---native-browser";var t=document.querySelector("iframe#".concat(o));if(!t){t=document.createElement("iframe");t.id=o;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)}var r=((e=t.contentWindow)===null||e===void 0?void 0:e.window.Array.from)||Array.from;Array.from=r;document.body.removeChild(t)};Zonos.injectController=function(e){var n=e.config;var o,t;if(document.querySelector("zonos-controller")){return}if((o=n.checkoutSettings)===null||o===void 0?void 0:o.placeOrderButtonSelector){var r=n.checkoutSettings.placeOrderButtonSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:r})}));i.observe(document.body,{childList:true,subtree:true})}if((t=n.checkoutSettings)===null||t===void 0?void 0:t.alwaysTriggerInternationalCheckoutSelector){var a=n.checkoutSettings.alwaysTriggerInternationalCheckoutSelector;_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a});var i=new MutationObserver((function(){_a.disablePlaceOrderButtons({config:n,disable:true,placeOrderButtonSelector:a})}));i.observe(document.body,{childList:true,subtree:true})}var s=document.createElement("zonos-controller");s.config=n;s.zonosApiKey=_a.zonosApiKey||"";s.addEventListener("stripeInitEvent",(function(e){return __awaiter(void 0,void 0,void 0,(function(){var n,o;return __generator(this,(function(t){switch(t.label){case 0:n=e.detail;log("loading Stripe");return[4,zonosLoadStripe(n.publishableKey)];case 1:o=t.sent();if(!o){logError("API seems to be invalid or missing. Failed to load Stripe");return[2]}window.Zonos.stripe=o;if(window.Zonos.isCollect){void s.initCollectElement(o)}else if(window.Zonos.isInvoice){void s.initInvoiceElement(o)}else{void s.initCheckoutElement(o)}return[2]}}))}))}));document.body.appendChild(s);_a.zonosController=s;log("Zonos controller injected!")};Zonos.injectScript=function(e){var n=e.cdnType,o=e.isModule,t=e.theRestUrl;var r=_a.getZonosUrl(n);var i="".concat(r,"/").concat(t);var a=function(){var e=document.querySelector('script[src="'.concat(i,'"]'));return!!e};if(a()){log('Zonos script "'.concat(i,'" already exists in the document'),"warn");return}var s=document.head||document.body;var c=document.createElement("script");if(!!o){c.type="module"}else{c.noModule=true}c.src=i;c.crossOrigin="anonymous";c.onerror=function(){logError("Failed to load ".concat(c.src));var e=getNextFallbackUrl(n);if(!e){return}_a.injectScript({cdnType:e,isModule:o,theRestUrl:t})};s.appendChild(c)};Zonos.getZonosUrl=function(e){var n=function(){switch(e){case"jsdelivr":return JS_DELIVR_ZONOS_URL;case"unpkg":return UNPKG_ZONOS_URL;case"cdnjs":return CDNJS_ZONOS_URL;case"vercel":return ZONOS_URL}};if(_a.isNpm){var o=getZonosQaUrl();return o||n()}return n()};Zonos.injectZonosCdn=function(){_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:true,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"});_a.injectScript({cdnType:MAIN_LOAD_CDN_TYPE,isModule:false,theRestUrl:"dist/zonos-elements/zonos-elements.js"});log("Zonos cdn script injected!")};Zonos.injectStylesheet=function(e){var n=e.cdnType,o=e.theRestUrl;var t=_a.getZonosUrl(n);var r=document.head||document.body;var i=document.createElement("link");i.rel="preconnect";i.href="".concat(ZONOS_URL,"/");r.appendChild(i);var a=document.createElement("link");a.rel="stylesheet";a.href="".concat(t,"/").concat(o);a.onerror=function(){logError("Failed to load ".concat(a.href));var e=getNextFallbackUrl(n);if(!e){return}_a.injectStylesheet({cdnType:e,theRestUrl:o})};r.appendChild(a)};Zonos.injectZonosCss=function(){var e=function(){return!!document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')};if(e()){log("Zonos style links already injected","warn");return}_a.injectStylesheet({cdnType:MAIN_LOAD_CDN_TYPE,theRestUrl:"dist/zonos-elements/zonos-elements.css"});log("Zonos style css injected!")};Zonos.injectFonts=function(){var e=function(){var e=document.fonts.check("1em Inter");if(e){log("Inter font already loaded","warn");return}var n=document.querySelectorAll('link[rel="stylesheet"][href^="'.concat(GOOGLE_FONT_URL,'"]'));for(var o=0;o<n.length;o++){var t=n[o];if(!t){continue}if(GOOGLE_FONT_REGEX.test(t.href)){continue}return t}return null};if(e()){log("Inter font already injected","warn");return}var n=document.head||document.body;var o=document.createElement("link");o.rel="preconnect";o.href=GOOGLE_FONT_URL;n.appendChild(o);var t=document.createElement("link");t.rel="stylesheet";t.href="".concat(GOOGLE_FONT_URL,"/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap");n.appendChild(t);log("Zonos font injected!")};Zonos.setupGoogleFont=function(e){var n;void((n=_a.zonosController)===null||n===void 0?void 0:n.setupGoogleFont(e))};Zonos.injectSupportGoogleFont=function(e){var n;log("[FONT] injecting ".concat(e));var o=(n=e.match(/family=(.*?):/))===null||n===void 0?void 0:n[1];var t=document.head||document.body;if(!document.querySelector('link[rel="preconnect"][href^="'.concat(GOOGLE_FONT_URL,'"]'))){var r=document.createElement("link");r.rel="preconnect";r.href=GOOGLE_FONT_URL;t.appendChild(r)}if(document.querySelector('link[rel="stylesheet"][href="'.concat(e,'"]'))){log("[FONT] ".concat(o," font already injected"),"warn");return}var i=document.createElement("link");i.rel="stylesheet";i.href=e;t.appendChild(i);log("[FONT] ".concat(o," font injected!"))};var checkoutSessionMutableAttributeKeys=["ZONOS_FORM_TYPE_USING","APP_VERSION","APP_VERSION_NPM_INTEGRATION","LEGACY_CHECKOUT_FACADE"];var checkoutSessionImmutableAttributeKeys=["ORDER_DUPLICATION_CONSENT","WITH_ABANDONED_CART_TOKEN"];var checkoutSessionAttributeKeys=__spreadArray(__spreadArray([],checkoutSessionMutableAttributeKeys,true),checkoutSessionImmutableAttributeKeys,true);export{Zonos,checkoutSessionAttributeKeys,checkoutSessionImmutableAttributeKeys,checkoutSessionMutableAttributeKeys};