@zonos/elements 1.3.134 → 1.3.136

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 (41) hide show
  1. package/dist/cjs/index.cjs.js +41 -38
  2. package/dist/cjs/{paypal-045033fb.js → paypal-fd50c7d5.js} +0 -1
  3. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +1 -1
  4. package/dist/cjs/zonos-checkout.cjs.entry.js +33 -3
  5. package/dist/cjs/zonos-notification_3.cjs.entry.js +1 -1
  6. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +32 -2
  7. package/dist/collection/components/store/checkout/paypal.js +0 -1
  8. package/dist/collection/scripts/{_overrideWithTestPublicCredential.js → _getWithTestPublicCredential.js} +9 -9
  9. package/dist/collection/scripts/_zonosBase.js +5 -2
  10. package/dist/esm/index.js +42 -39
  11. package/dist/esm/{paypal-7f41ff20.js → paypal-b4af6cc0.js} +0 -1
  12. package/dist/esm/zonos-cart-items_13.entry.js +1 -1
  13. package/dist/esm/zonos-checkout.entry.js +33 -3
  14. package/dist/esm/zonos-notification_3.entry.js +1 -1
  15. package/dist/esm-es5/index.js +1 -1
  16. package/dist/esm-es5/{paypal-7f41ff20.js → paypal-b4af6cc0.js} +1 -1
  17. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  18. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  19. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  20. package/dist/scripts/index.js +1 -1
  21. package/dist/scripts/loadZonos.js +1 -1
  22. package/dist/scripts/zonos.js +1 -1
  23. package/dist/types/scripts/_getWithTestPublicCredential.d.ts +4 -0
  24. package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
  25. package/dist/zonos-elements/index.esm.js +1 -1
  26. package/dist/zonos-elements/{p-1856c3fa.system.js → p-18cb1aee.system.js} +1 -1
  27. package/dist/zonos-elements/{p-b1bb00a8.entry.js → p-37991f24.entry.js} +1 -1
  28. package/dist/zonos-elements/{p-a0de6e0f.system.entry.js → p-af3ecd9d.system.entry.js} +1 -1
  29. package/dist/zonos-elements/p-b776e39e.system.js +1 -0
  30. package/dist/zonos-elements/{p-aaa3addd.system.entry.js → p-c52a8369.system.entry.js} +1 -1
  31. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  32. package/dist/zonos-elements/{p-acb45eb6.system.entry.js → p-c8927b27.system.entry.js} +1 -1
  33. package/dist/zonos-elements/p-caddd067.entry.js +1 -0
  34. package/dist/zonos-elements/p-e1ac8cd8.js +17 -0
  35. package/dist/zonos-elements/{p-fb7d8b52.entry.js → p-e9862f66.entry.js} +1 -1
  36. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  37. package/package.json +1 -1
  38. package/dist/types/scripts/_overrideWithTestPublicCredential.d.ts +0 -4
  39. package/dist/zonos-elements/p-798bb828.system.js +0 -1
  40. package/dist/zonos-elements/p-8759f66b.js +0 -17
  41. package/dist/zonos-elements/p-99d47e1c.entry.js +0 -1
@@ -56,6 +56,36 @@ const getNextFallbackUrl = (currentCdnType) => {
56
56
  return nextFallbackCdnType || null;
57
57
  };
58
58
 
59
+ /**
60
+ * Attempt to get test public credential to window.Zonos.zonosApiKey if needed
61
+ */
62
+ const getWithTestPublicCredential = async () => {
63
+ const isTestMode = window.location.search.includes('zonosTestMode=1');
64
+ // Do nothing if the test mode is not enabled or the public credential
65
+ if (!isTestMode || !window.Zonos.zonosApiKey) {
66
+ return null;
67
+ }
68
+ handleFetch.log('[ZONOS - loadZonos] Attempt test public credential', 'info');
69
+ // Try to get the test public credential if the test mode is enabled and the public credential key is not a test key
70
+ if (!!window.Zonos.zonosApiKey.includes('credential_test')) {
71
+ handleFetch.log('[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key', 'info');
72
+ return null;
73
+ }
74
+ const { errors: testPublicCredErrors, json: testPublicCredResult } = await handleFetch.handleFetch('/api/get-test-public-credential');
75
+ if (testPublicCredErrors.length || !testPublicCredResult) {
76
+ handleFetch.logError(`[ZONOS - loadZonos] Failed to get test public credential. Keep using production key`, testPublicCredErrors);
77
+ return null;
78
+ }
79
+ const testPublicCredential = testPublicCredResult.publicCredential;
80
+ if (!testPublicCredential) {
81
+ handleFetch.logError('[ZONOS - loadZonos] No test public key credential. Keep using production key');
82
+ return null;
83
+ }
84
+ // Set the test public credential to the window object
85
+ handleFetch.log(`[ZONOS - loadZonos] Retrieve new test public token ${testPublicCredential}`, 'info');
86
+ return testPublicCredential;
87
+ };
88
+
59
89
  /**
60
90
  * Extracts the zonosQaUrl from the url
61
91
  *
@@ -97,7 +127,7 @@ const getZonosQaUrl = () => {
97
127
  return null;
98
128
  }
99
129
  const qaUrl = extractZonosQaUrl(window.location.href);
100
- const cdnUrl = "https://v1.3.134.js.zonos.com";
130
+ const cdnUrl = "https://v1.3.136.js.zonos.com";
101
131
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
102
132
  if (!qaUrl &&
103
133
  (cdnUrl.includes('test.') ||
@@ -254,36 +284,6 @@ const zonosLoadStripe = async (...args) => {
254
284
  return stripePromise.then(maybeStripe => initStripe(maybeStripe, args, startTime));
255
285
  };
256
286
 
257
- /**
258
- * Attempt to get and override test public credential to window.Zonos.zonosApiKey if needed
259
- */
260
- const overrideWithTestPublicCredential = async () => {
261
- const isTestMode = window.location.search.includes('zonosTestMode=1');
262
- // Do nothing if the test mode is not enabled or the public credential
263
- if (!isTestMode || !window.Zonos.zonosApiKey) {
264
- return;
265
- }
266
- handleFetch.log('[ZONOS - loadZonos] Attempt test public credential', 'info');
267
- // Try to get the test public credential if the test mode is enabled and the public credential key is not a test key
268
- if (!!window.Zonos.zonosApiKey.includes('test')) {
269
- handleFetch.log('[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key', 'info');
270
- return;
271
- }
272
- const { errors: testPublicCredErrors, json: testPublicCredResult } = await handleFetch.handleFetch('/api/get-test-public-credential');
273
- if (testPublicCredErrors.length || !testPublicCredResult) {
274
- handleFetch.logError(`[ZONOS - loadZonos] Failed to get test public credential. Keep using production key`, testPublicCredErrors);
275
- return;
276
- }
277
- const testPublicCredential = testPublicCredResult.publicCredential;
278
- if (!testPublicCredential) {
279
- handleFetch.logError('[ZONOS - loadZonos] No test public key credential. Keep using production key');
280
- return;
281
- }
282
- handleFetch.log(`[ZONOS - loadZonos] Using test API key: ${testPublicCredential} for test mode`, 'info');
283
- // Set the test public credential to the window object
284
- window.Zonos.zonosApiKey = testPublicCredential;
285
- };
286
-
287
287
  const TEMP_CART_ID_QUERY_PARAM = 'tempCartUUID';
288
288
  /**
289
289
  * Simple function to get the cart id from the query param.
@@ -311,10 +311,10 @@ const zonosLoadUrl = (() => {
311
311
  }
312
312
  return null;
313
313
  })();
314
- const ZONOS_URL = "https://v1.3.134.js.zonos.com";
315
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.134";
316
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.134";
317
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.134";
314
+ const ZONOS_URL = "https://v1.3.136.js.zonos.com";
315
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.136";
316
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.136";
317
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.136";
318
318
  const INTER_FONT_URL = 'https://rsms.me';
319
319
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
320
320
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -329,7 +329,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
329
329
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
330
330
  Zonos._paypalMockResponse = null;
331
331
  Zonos.isBigCommerce = false;
332
- Zonos.releaseDate = "1732554842941";
332
+ Zonos.releaseDate = "1733241504089";
333
333
  Zonos.isLegacyCheckout = false;
334
334
  Zonos.domain = typeof window !== 'undefined'
335
335
  ? // domain that embeds the iframe
@@ -345,7 +345,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
345
345
  Zonos.isNpm = true;
346
346
  Zonos.zonosQaUrl = null;
347
347
  Zonos.zonosQaUrlApi = null;
348
- Zonos.version = `v${"1.3.134"}`;
348
+ Zonos.version = `v${"1.3.136"}`;
349
349
  Zonos.modeAlerted = false;
350
350
  Zonos.cartData = null;
351
351
  Zonos.paypal = null;
@@ -405,7 +405,10 @@ Zonos.init = async (params) => {
405
405
  _a.zonosApiKey = cartinfo.zonosApiKey;
406
406
  }
407
407
  // Try to request for test API key if the API key is production but query param isTestMode is provided
408
- await overrideWithTestPublicCredential();
408
+ const testPublicCredential = await getWithTestPublicCredential();
409
+ if (testPublicCredential) {
410
+ _a.zonosApiKey = testPublicCredential;
411
+ }
409
412
  }
410
413
  // inject hidden button to body to trigger checkout right away if we have cartData
411
414
  if (_a.cartId && _a.cartData) {
@@ -266,7 +266,6 @@ const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
266
266
  };
267
267
  const paypalStoreCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) => {
268
268
  var _a, _b;
269
- new URL(window.location.href);
270
269
  const { errors, json } = await paypalCaptureOrder({
271
270
  checkoutSessionId,
272
271
  paypalMockResponse,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const cart = require('./cart-0f32f556.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-045033fb.js');
8
+ const paypal = require('./paypal-fd50c7d5.js');
9
9
  const zonosStore = require('./zonosStore-293bb3ba.js');
10
10
  const createCustomEvent = require('./createCustomEvent-3e982e57.js');
11
11
  const getBorderRadius = require('./getBorderRadius-f72d8edf.js');
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const cart = require('./cart-0f32f556.js');
7
- const paypal = require('./paypal-045033fb.js');
7
+ const paypal = require('./paypal-fd50c7d5.js');
8
8
  const zonosStore = require('./zonosStore-293bb3ba.js');
9
9
  const handleFetch = require('./handleFetch-4a90f091.js');
10
10
  const createCustomEvent = require('./createCustomEvent-3e982e57.js');
@@ -934,12 +934,42 @@ const ZonosCheckout = class {
934
934
  cart.stripeStoreReset();
935
935
  }
936
936
  handleOpenChange() {
937
+ const overflowAttrKey = 'data-zonos-overflow-origin';
938
+ const body = document.body;
939
+ const html = document.documentElement;
937
940
  // disable scroll on the body when dialog is open
938
941
  if (this.open) {
939
- document.body.style.overflow = 'hidden';
942
+ // record overflow state to data-zonos-overflow-origin in body/html element so we can reset it later
943
+ if (body.style.overflow) {
944
+ body.setAttribute(overflowAttrKey, body.style.overflow);
945
+ }
946
+ body.style.overflow = 'hidden';
947
+ if (html.style.overflow) {
948
+ html.setAttribute(overflowAttrKey, html.style.overflow);
949
+ }
950
+ html.style.overflow = 'hidden';
940
951
  }
941
952
  else {
942
- document.body.style.overflow = 'auto';
953
+ const bodyOverflow = body.getAttribute(overflowAttrKey);
954
+ const htmlOverflow = html.getAttribute(overflowAttrKey);
955
+ // reset overflow state to original state
956
+ if (bodyOverflow) {
957
+ body.removeAttribute(overflowAttrKey);
958
+ body.style.overflow = bodyOverflow;
959
+ }
960
+ else {
961
+ // just remove the overflow style if it's not set
962
+ body.style.removeProperty('overflow');
963
+ }
964
+ // reset overflow state to original state
965
+ if (htmlOverflow) {
966
+ html.removeAttribute(overflowAttrKey);
967
+ html.style.overflow = htmlOverflow;
968
+ }
969
+ else {
970
+ // just remove the overflow style if it's not set
971
+ html.style.removeProperty('overflow');
972
+ }
943
973
  }
944
974
  }
945
975
  componentWillLoad() {
@@ -8,7 +8,7 @@ const classes = require('./classes-b7918f56.js');
8
8
  const getBorderRadius = require('./getBorderRadius-f72d8edf.js');
9
9
  const cart = require('./cart-0f32f556.js');
10
10
  const handleFetch = require('./handleFetch-4a90f091.js');
11
- const paypal = require('./paypal-045033fb.js');
11
+ const paypal = require('./paypal-fd50c7d5.js');
12
12
  require('./isDarkColor-dd6d723b.js');
13
13
 
14
14
  const zonosNotificationCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";
@@ -723,12 +723,42 @@ export class ZonosCheckout {
723
723
  stripeStoreReset();
724
724
  }
725
725
  handleOpenChange() {
726
+ const overflowAttrKey = 'data-zonos-overflow-origin';
727
+ const body = document.body;
728
+ const html = document.documentElement;
726
729
  // disable scroll on the body when dialog is open
727
730
  if (this.open) {
728
- document.body.style.overflow = 'hidden';
731
+ // record overflow state to data-zonos-overflow-origin in body/html element so we can reset it later
732
+ if (body.style.overflow) {
733
+ body.setAttribute(overflowAttrKey, body.style.overflow);
734
+ }
735
+ body.style.overflow = 'hidden';
736
+ if (html.style.overflow) {
737
+ html.setAttribute(overflowAttrKey, html.style.overflow);
738
+ }
739
+ html.style.overflow = 'hidden';
729
740
  }
730
741
  else {
731
- document.body.style.overflow = 'auto';
742
+ const bodyOverflow = body.getAttribute(overflowAttrKey);
743
+ const htmlOverflow = html.getAttribute(overflowAttrKey);
744
+ // reset overflow state to original state
745
+ if (bodyOverflow) {
746
+ body.removeAttribute(overflowAttrKey);
747
+ body.style.overflow = bodyOverflow;
748
+ }
749
+ else {
750
+ // just remove the overflow style if it's not set
751
+ body.style.removeProperty('overflow');
752
+ }
753
+ // reset overflow state to original state
754
+ if (htmlOverflow) {
755
+ html.removeAttribute(overflowAttrKey);
756
+ html.style.overflow = htmlOverflow;
757
+ }
758
+ else {
759
+ // just remove the overflow style if it's not set
760
+ html.style.removeProperty('overflow');
761
+ }
732
762
  }
733
763
  }
734
764
  componentWillLoad() {
@@ -31,7 +31,6 @@ const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
31
31
  };
32
32
  const paypalStoreCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) => {
33
33
  var _a, _b;
34
- const {} = new URL(window.location.href);
35
34
  const { errors, json } = await paypalCaptureOrder({
36
35
  checkoutSessionId,
37
36
  paypalMockResponse,
@@ -2,31 +2,31 @@ import { handleFetch } from "../components/utils/handleFetch";
2
2
  import { log } from "../components/utils/logging/log";
3
3
  import { logError } from "../components/utils/logging/logError";
4
4
  /**
5
- * Attempt to get and override test public credential to window.Zonos.zonosApiKey if needed
5
+ * Attempt to get test public credential to window.Zonos.zonosApiKey if needed
6
6
  */
7
- export const overrideWithTestPublicCredential = async () => {
7
+ export const getWithTestPublicCredential = async () => {
8
8
  const isTestMode = window.location.search.includes('zonosTestMode=1');
9
9
  // Do nothing if the test mode is not enabled or the public credential
10
10
  if (!isTestMode || !window.Zonos.zonosApiKey) {
11
- return;
11
+ return null;
12
12
  }
13
13
  log('[ZONOS - loadZonos] Attempt test public credential', 'info');
14
14
  // Try to get the test public credential if the test mode is enabled and the public credential key is not a test key
15
- if (!!window.Zonos.zonosApiKey.includes('test')) {
15
+ if (!!window.Zonos.zonosApiKey.includes('credential_test')) {
16
16
  log('[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key', 'info');
17
- return;
17
+ return null;
18
18
  }
19
19
  const { errors: testPublicCredErrors, json: testPublicCredResult } = await handleFetch('/api/get-test-public-credential');
20
20
  if (testPublicCredErrors.length || !testPublicCredResult) {
21
21
  logError(`[ZONOS - loadZonos] Failed to get test public credential. Keep using production key`, testPublicCredErrors);
22
- return;
22
+ return null;
23
23
  }
24
24
  const testPublicCredential = testPublicCredResult.publicCredential;
25
25
  if (!testPublicCredential) {
26
26
  logError('[ZONOS - loadZonos] No test public key credential. Keep using production key');
27
- return;
27
+ return null;
28
28
  }
29
- log(`[ZONOS - loadZonos] Using test API key: ${testPublicCredential} for test mode`, 'info');
30
29
  // Set the test public credential to the window object
31
- window.Zonos.zonosApiKey = testPublicCredential;
30
+ log(`[ZONOS - loadZonos] Retrieve new test public token ${testPublicCredential}`, 'info');
31
+ return testPublicCredential;
32
32
  };
@@ -3,9 +3,9 @@ import { log } from "../components/utils/logging/log";
3
3
  import { logError } from "../components/utils/logging/logError";
4
4
  import { checkIfLoadVersionDomain } from "./_checkIfLoadVersionDomain";
5
5
  import { getNextFallbackUrl, MAIN_LOAD_CDN_TYPE, } from "./_getNextFallbackUrl";
6
+ import { getWithTestPublicCredential } from "./_getWithTestPublicCredential";
6
7
  import { getZonosQaUrl } from "./_getZonosQaUrl";
7
8
  import { zonosLoadStripe } from "./_loadStripe";
8
- import { overrideWithTestPublicCredential } from "./_overrideWithTestPublicCredential";
9
9
  import { getCartIdFromQueryParam } from "./cart/_getCartIdFromParam";
10
10
  import { setupCartData } from "./cart/_setupCartData";
11
11
  import { checkoutHiddenBtnSelector, } from "../types/checkout/CheckoutConfig";
@@ -119,7 +119,10 @@ Zonos.init = async (params) => {
119
119
  _a.zonosApiKey = cartinfo.zonosApiKey;
120
120
  }
121
121
  // Try to request for test API key if the API key is production but query param isTestMode is provided
122
- await overrideWithTestPublicCredential();
122
+ const testPublicCredential = await getWithTestPublicCredential();
123
+ if (testPublicCredential) {
124
+ _a.zonosApiKey = testPublicCredential;
125
+ }
123
126
  }
124
127
  // inject hidden button to body to trigger checkout right away if we have cartData
125
128
  if (_a.cartId && _a.cartData) {
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as log, a as logError, h as handleFetch } from './handleFetch-22cb914b.js';
1
+ import { l as log, h as handleFetch, a as logError } from './handleFetch-22cb914b.js';
2
2
  import { s as setupCartData, c as checkoutHiddenBtnSelector } from './CheckoutConfig-930107d4.js';
3
3
  export { c as checkoutHiddenBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-930107d4.js';
4
4
 
@@ -53,6 +53,36 @@ const getNextFallbackUrl = (currentCdnType) => {
53
53
  return nextFallbackCdnType || null;
54
54
  };
55
55
 
56
+ /**
57
+ * Attempt to get test public credential to window.Zonos.zonosApiKey if needed
58
+ */
59
+ const getWithTestPublicCredential = async () => {
60
+ const isTestMode = window.location.search.includes('zonosTestMode=1');
61
+ // Do nothing if the test mode is not enabled or the public credential
62
+ if (!isTestMode || !window.Zonos.zonosApiKey) {
63
+ return null;
64
+ }
65
+ log('[ZONOS - loadZonos] Attempt test public credential', 'info');
66
+ // Try to get the test public credential if the test mode is enabled and the public credential key is not a test key
67
+ if (!!window.Zonos.zonosApiKey.includes('credential_test')) {
68
+ log('[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key', 'info');
69
+ return null;
70
+ }
71
+ const { errors: testPublicCredErrors, json: testPublicCredResult } = await handleFetch('/api/get-test-public-credential');
72
+ if (testPublicCredErrors.length || !testPublicCredResult) {
73
+ logError(`[ZONOS - loadZonos] Failed to get test public credential. Keep using production key`, testPublicCredErrors);
74
+ return null;
75
+ }
76
+ const testPublicCredential = testPublicCredResult.publicCredential;
77
+ if (!testPublicCredential) {
78
+ logError('[ZONOS - loadZonos] No test public key credential. Keep using production key');
79
+ return null;
80
+ }
81
+ // Set the test public credential to the window object
82
+ log(`[ZONOS - loadZonos] Retrieve new test public token ${testPublicCredential}`, 'info');
83
+ return testPublicCredential;
84
+ };
85
+
56
86
  /**
57
87
  * Extracts the zonosQaUrl from the url
58
88
  *
@@ -94,7 +124,7 @@ const getZonosQaUrl = () => {
94
124
  return null;
95
125
  }
96
126
  const qaUrl = extractZonosQaUrl(window.location.href);
97
- const cdnUrl = "https://v1.3.134.js.zonos.com";
127
+ const cdnUrl = "https://v1.3.136.js.zonos.com";
98
128
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
99
129
  if (!qaUrl &&
100
130
  (cdnUrl.includes('test.') ||
@@ -251,36 +281,6 @@ const zonosLoadStripe = async (...args) => {
251
281
  return stripePromise.then(maybeStripe => initStripe(maybeStripe, args, startTime));
252
282
  };
253
283
 
254
- /**
255
- * Attempt to get and override test public credential to window.Zonos.zonosApiKey if needed
256
- */
257
- const overrideWithTestPublicCredential = async () => {
258
- const isTestMode = window.location.search.includes('zonosTestMode=1');
259
- // Do nothing if the test mode is not enabled or the public credential
260
- if (!isTestMode || !window.Zonos.zonosApiKey) {
261
- return;
262
- }
263
- log('[ZONOS - loadZonos] Attempt test public credential', 'info');
264
- // Try to get the test public credential if the test mode is enabled and the public credential key is not a test key
265
- if (!!window.Zonos.zonosApiKey.includes('test')) {
266
- log('[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key', 'info');
267
- return;
268
- }
269
- const { errors: testPublicCredErrors, json: testPublicCredResult } = await handleFetch('/api/get-test-public-credential');
270
- if (testPublicCredErrors.length || !testPublicCredResult) {
271
- logError(`[ZONOS - loadZonos] Failed to get test public credential. Keep using production key`, testPublicCredErrors);
272
- return;
273
- }
274
- const testPublicCredential = testPublicCredResult.publicCredential;
275
- if (!testPublicCredential) {
276
- logError('[ZONOS - loadZonos] No test public key credential. Keep using production key');
277
- return;
278
- }
279
- log(`[ZONOS - loadZonos] Using test API key: ${testPublicCredential} for test mode`, 'info');
280
- // Set the test public credential to the window object
281
- window.Zonos.zonosApiKey = testPublicCredential;
282
- };
283
-
284
284
  const TEMP_CART_ID_QUERY_PARAM = 'tempCartUUID';
285
285
  /**
286
286
  * Simple function to get the cart id from the query param.
@@ -308,10 +308,10 @@ const zonosLoadUrl = (() => {
308
308
  }
309
309
  return null;
310
310
  })();
311
- const ZONOS_URL = "https://v1.3.134.js.zonos.com";
312
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.134";
313
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.134";
314
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.134";
311
+ const ZONOS_URL = "https://v1.3.136.js.zonos.com";
312
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.136";
313
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.136";
314
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.136";
315
315
  const INTER_FONT_URL = 'https://rsms.me';
316
316
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
317
317
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -326,7 +326,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
326
326
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
327
327
  Zonos._paypalMockResponse = null;
328
328
  Zonos.isBigCommerce = false;
329
- Zonos.releaseDate = "1732554842941";
329
+ Zonos.releaseDate = "1733241504089";
330
330
  Zonos.isLegacyCheckout = false;
331
331
  Zonos.domain = typeof window !== 'undefined'
332
332
  ? // domain that embeds the iframe
@@ -342,7 +342,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
342
342
  Zonos.isNpm = true;
343
343
  Zonos.zonosQaUrl = null;
344
344
  Zonos.zonosQaUrlApi = null;
345
- Zonos.version = `v${"1.3.134"}`;
345
+ Zonos.version = `v${"1.3.136"}`;
346
346
  Zonos.modeAlerted = false;
347
347
  Zonos.cartData = null;
348
348
  Zonos.paypal = null;
@@ -402,7 +402,10 @@ Zonos.init = async (params) => {
402
402
  _a.zonosApiKey = cartinfo.zonosApiKey;
403
403
  }
404
404
  // Try to request for test API key if the API key is production but query param isTestMode is provided
405
- await overrideWithTestPublicCredential();
405
+ const testPublicCredential = await getWithTestPublicCredential();
406
+ if (testPublicCredential) {
407
+ _a.zonosApiKey = testPublicCredential;
408
+ }
406
409
  }
407
410
  // inject hidden button to body to trigger checkout right away if we have cartData
408
411
  if (_a.cartId && _a.cartData) {
@@ -264,7 +264,6 @@ const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
264
264
  };
265
265
  const paypalStoreCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) => {
266
266
  var _a, _b;
267
- new URL(window.location.href);
268
267
  const { errors, json } = await paypalCaptureOrder({
269
268
  checkoutSessionId,
270
269
  paypalMockResponse,
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, a as getAssetPath, h, H as Host, F as Fragment, c as createEvent, d as getElement } from './index-86b8247e.js';
2
2
  import { d as cartStore, H as currencyFormat, p as translate, I as cartStoreHasOneEligibleItem, J as stripeStoreApplyPromoCode, K as stripeStoreRemovePromoCode, z as stripeStoreReset, j as stripeStore, L as stripeStoreRetrievePayment, t as trackConversionEvent, M as stripeStoreResetPromoCode, N as stripeStoreMessageBasedOnStatus, l as localizationStore, O as stripeStoreTranslateAddressToLatin, P as cartStoreUpdateSelectedShippingOption, Q as cartStoreGetShippingTransitInfo, R as sortServiceLevelOptionsByAmount } from './cart-3e0e4d5c.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
- import { s as submitGtag, b as paypalStore, c as paypalStoreReset, i as isContrastColor } from './paypal-7f41ff20.js';
4
+ import { s as submitGtag, b as paypalStore, c as paypalStoreReset, i as isContrastColor } from './paypal-b4af6cc0.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-c493c4fe.js';
6
6
  import { c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-31a792d3.js';
7
7
  import { g as getBorderRadius } from './getBorderRadius-bdd709e7.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, h, H as Host, F as Fragment } from './index-86b8247e.js';
2
2
  import { l as localizationStore, s as stripeStoreGetDomesticShippingSession, a as localizationStoreUpdateSelectedCountryCode, b as stripeStoreCleanupDomesticShippingSession, c as stripeStoreSaveDomesticShippingSession, i as initStripeElements, d as cartStore, e as cartStoreUpdateItems, f as cartStoreReset, g as cartStoreResetTabItems, h as cartStoreClearCheckoutInterval, j as stripeStore, k as stripeStoreInitCheckoutSession, m as cartStoreStartCheckoutInterval, t as trackConversionEvent, n as getCheckoutSessionBody, o as cartStoreUpdateToErrorState, p as translate, q as getZCountryUrlParam, r as cartStoreSetCheckoutSession, u as stripeStorePrefetchLandedCost, v as cartStoreNextStep, w as stripeStoreHandleInventoryCheck, x as stripeStoreConfirmPayment, y as stripeStoreHandleInventoryRefund, z as stripeStoreReset, A as localizationStoreOnUpdate } from './cart-3e0e4d5c.js';
3
- import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript } from './paypal-7f41ff20.js';
3
+ import { p as paypalStoreHasPaypalEnabled, s as submitGtag, a as paypalInitScript } from './paypal-b4af6cc0.js';
4
4
  import { z as zonosStore, g as getZonosStoreTheme, m as mergeConfig } from './zonosStore-c493c4fe.js';
5
5
  import { h as handleFetch, l as log, a as logError, s as sendErrorLog, g as getElapsedTime, b as allLogs, j as jsonParse } from './handleFetch-22cb914b.js';
6
6
  import { g as getIsTestMode, c as createCustomEvent } from './createCustomEvent-31a792d3.js';
@@ -930,12 +930,42 @@ const ZonosCheckout = class {
930
930
  stripeStoreReset();
931
931
  }
932
932
  handleOpenChange() {
933
+ const overflowAttrKey = 'data-zonos-overflow-origin';
934
+ const body = document.body;
935
+ const html = document.documentElement;
933
936
  // disable scroll on the body when dialog is open
934
937
  if (this.open) {
935
- document.body.style.overflow = 'hidden';
938
+ // record overflow state to data-zonos-overflow-origin in body/html element so we can reset it later
939
+ if (body.style.overflow) {
940
+ body.setAttribute(overflowAttrKey, body.style.overflow);
941
+ }
942
+ body.style.overflow = 'hidden';
943
+ if (html.style.overflow) {
944
+ html.setAttribute(overflowAttrKey, html.style.overflow);
945
+ }
946
+ html.style.overflow = 'hidden';
936
947
  }
937
948
  else {
938
- document.body.style.overflow = 'auto';
949
+ const bodyOverflow = body.getAttribute(overflowAttrKey);
950
+ const htmlOverflow = html.getAttribute(overflowAttrKey);
951
+ // reset overflow state to original state
952
+ if (bodyOverflow) {
953
+ body.removeAttribute(overflowAttrKey);
954
+ body.style.overflow = bodyOverflow;
955
+ }
956
+ else {
957
+ // just remove the overflow style if it's not set
958
+ body.style.removeProperty('overflow');
959
+ }
960
+ // reset overflow state to original state
961
+ if (htmlOverflow) {
962
+ html.removeAttribute(overflowAttrKey);
963
+ html.style.overflow = htmlOverflow;
964
+ }
965
+ else {
966
+ // just remove the overflow style if it's not set
967
+ html.style.removeProperty('overflow');
968
+ }
939
969
  }
940
970
  }
941
971
  componentWillLoad() {
@@ -4,7 +4,7 @@ import { c as classes } from './classes-0d95c529.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-bdd709e7.js';
5
5
  import { j as stripeStore } from './cart-3e0e4d5c.js';
6
6
  import { a as logError, l as log } from './handleFetch-22cb914b.js';
7
- import { d as paypalStoreInitButtons } from './paypal-7f41ff20.js';
7
+ import { d as paypalStoreInitButtons } from './paypal-b4af6cc0.js';
8
8
  import './isDarkColor-c6924924.js';
9
9
 
10
10
  const zonosNotificationCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}:host .zonos--notification-items{position:fixed;z-index:9999999999;bottom:24px;gap:8px;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--notification-item{cursor:pointer;-webkit-transition:all 0.3s ease;transition:all 0.3s ease;padding:8px;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));opacity:0;-ms-flex-negative:0.0001;flex-shrink:0.0001;-webkit-transform:translateY(100%);transform:translateY(100%)}:host .zonos--notification-item+:host .zonos--notification-item{margin-top:8px}:host .zonos--notification-item.show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-flex-positive:1000;flex-grow:1000}:host .zonos--notification-item.success{background-color:var(--zonos-elements-green-700)}:host .zonos--notification-item.error{background-color:var(--zonos-elements-red-700)}:host .zonos--notification-item.warning{background-color:var(--zonos-elements-orange-700)}";