@zonos/elements 1.3.102 → 1.3.103

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 (99) hide show
  1. package/dist/cjs/{CheckoutConfig-704147ec.js → CheckoutConfig-090e2b05.js} +1 -1
  2. package/dist/cjs/{cart-213f42f0.js → cart-207f884e.js} +1 -1
  3. package/dist/cjs/{createCustomEvent-f2792ab7.js → createCustomEvent-16d055b8.js} +2 -2
  4. package/dist/cjs/{handleFetch-5a16f2bc.js → handleFetch-b0bbc10b.js} +12 -5
  5. package/dist/cjs/index.cjs.js +9 -9
  6. package/dist/cjs/{paypal-d881282c.js → paypal-8f5dccc8.js} +2 -2
  7. package/dist/cjs/zonos-address_7.cjs.entry.js +2 -2
  8. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +4 -4
  9. package/dist/cjs/zonos-checkout.cjs.entry.js +60 -5
  10. package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
  13. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
  15. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  16. package/dist/cjs/zonos-notification_3.cjs.entry.js +3 -3
  17. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +4 -0
  18. package/dist/collection/components/utils/logging/log.js +11 -5
  19. package/dist/collection/components/utils/logging/sendLoadCheckoutFacadeLog.js +24 -0
  20. package/dist/collection/components/utils/logging/sendLoadScriptLog.js +17 -8
  21. package/dist/esm/{CheckoutConfig-d237227e.js → CheckoutConfig-9cdb7beb.js} +1 -1
  22. package/dist/esm/{cart-9a4c155b.js → cart-90943a07.js} +1 -1
  23. package/dist/esm/{createCustomEvent-65611cd0.js → createCustomEvent-3ea6c7c5.js} +2 -2
  24. package/dist/esm/{handleFetch-ce924688.js → handleFetch-41e3d2b2.js} +12 -6
  25. package/dist/esm/index.js +10 -10
  26. package/dist/esm/{paypal-63e83a4a.js → paypal-417c64a1.js} +2 -2
  27. package/dist/esm/zonos-address_7.entry.js +2 -2
  28. package/dist/esm/zonos-cart-items_13.entry.js +4 -4
  29. package/dist/esm/zonos-checkout.entry.js +60 -5
  30. package/dist/esm/zonos-controller.entry.js +2 -2
  31. package/dist/esm/zonos-country-flag.entry.js +2 -2
  32. package/dist/esm/zonos-country-select_4.entry.js +2 -2
  33. package/dist/esm/zonos-hello-dialog.entry.js +2 -2
  34. package/dist/esm/zonos-hello.entry.js +2 -2
  35. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  36. package/dist/esm/zonos-notification_3.entry.js +3 -3
  37. package/dist/esm-es5/{CheckoutConfig-d237227e.js → CheckoutConfig-9cdb7beb.js} +1 -1
  38. package/dist/esm-es5/{cart-9a4c155b.js → cart-90943a07.js} +1 -1
  39. package/dist/esm-es5/{createCustomEvent-65611cd0.js → createCustomEvent-3ea6c7c5.js} +1 -1
  40. package/dist/esm-es5/handleFetch-41e3d2b2.js +1 -0
  41. package/dist/esm-es5/index.js +1 -1
  42. package/dist/esm-es5/{paypal-63e83a4a.js → paypal-417c64a1.js} +1 -1
  43. package/dist/esm-es5/zonos-address_7.entry.js +1 -1
  44. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  45. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  46. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  47. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  48. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  49. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  50. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  51. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  52. package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
  53. package/dist/scripts/index.js +1 -1
  54. package/dist/scripts/loadZonos.js +1 -1
  55. package/dist/scripts/zonos.js +1 -1
  56. package/dist/types/components/utils/logging/log.d.ts +4 -0
  57. package/dist/types/components/utils/logging/sendLoadCheckoutFacadeLog.d.ts +1 -0
  58. package/dist/types/components/utils/logging/sendLoadScriptLog.d.ts +12 -0
  59. package/dist/zonos-elements/index.esm.js +1 -1
  60. package/dist/zonos-elements/{p-6b1aee83.entry.js → p-0d42fb2f.entry.js} +1 -1
  61. package/dist/zonos-elements/{p-481a5dde.system.entry.js → p-105e5a07.system.entry.js} +1 -1
  62. package/dist/zonos-elements/p-1fc16bee.system.js +1 -0
  63. package/dist/zonos-elements/{p-4814d204.system.js → p-21f04cb8.system.js} +1 -1
  64. package/dist/zonos-elements/p-27b6bbc2.system.js +1 -0
  65. package/dist/zonos-elements/{p-daec1676.system.entry.js → p-317066a3.system.entry.js} +1 -1
  66. package/dist/zonos-elements/{p-3deca7bd.system.js → p-32ff2c95.system.js} +1 -1
  67. package/dist/zonos-elements/{p-d2da5f75.system.entry.js → p-3b19daa3.system.entry.js} +1 -1
  68. package/dist/zonos-elements/{p-4f97ab5c.system.entry.js → p-3f897fc1.system.entry.js} +1 -1
  69. package/dist/zonos-elements/{p-ad7d949c.entry.js → p-4813b1f8.entry.js} +1 -1
  70. package/dist/zonos-elements/{p-5900a867.entry.js → p-4e697c43.entry.js} +1 -1
  71. package/dist/zonos-elements/{p-203d901c.system.entry.js → p-55f68290.system.entry.js} +1 -1
  72. package/dist/zonos-elements/p-574495ac.system.entry.js +1 -0
  73. package/dist/zonos-elements/{p-1c9972d5.system.entry.js → p-57de792d.system.entry.js} +1 -1
  74. package/dist/zonos-elements/{p-d17fc7b5.js → p-591cf960.js} +1 -1
  75. package/dist/zonos-elements/{p-419c27c5.system.js → p-598cfc03.system.js} +1 -1
  76. package/dist/zonos-elements/{p-38b8a13d.system.js → p-61b1aa56.system.js} +1 -1
  77. package/dist/zonos-elements/{p-8a384947.entry.js → p-6772ace5.entry.js} +1 -1
  78. package/dist/zonos-elements/{p-0af4e659.entry.js → p-714241c8.entry.js} +1 -1
  79. package/dist/zonos-elements/{p-bce83a4e.js → p-7dfc395b.js} +1 -1
  80. package/dist/zonos-elements/p-8de25afe.js +1 -0
  81. package/dist/zonos-elements/{p-0ba0151f.system.entry.js → p-9209614f.system.entry.js} +1 -1
  82. package/dist/zonos-elements/{p-06b63d33.system.entry.js → p-a017dfc8.system.entry.js} +1 -1
  83. package/dist/zonos-elements/{p-ee48a87e.system.entry.js → p-a7b75673.system.entry.js} +1 -1
  84. package/dist/zonos-elements/p-c78dd680.system.js +1 -1
  85. package/dist/zonos-elements/{p-c64a74bc.js → p-cc652908.js} +1 -1
  86. package/dist/zonos-elements/{p-aad51da3.js → p-d0a6b588.js} +1 -1
  87. package/dist/zonos-elements/p-d4e524de.entry.js +1 -0
  88. package/dist/zonos-elements/{p-86afd38a.entry.js → p-da2183ab.entry.js} +1 -1
  89. package/dist/zonos-elements/{p-ca02bd48.entry.js → p-e0da243f.entry.js} +1 -1
  90. package/dist/zonos-elements/{p-2d77afbc.entry.js → p-e9614eb2.entry.js} +1 -1
  91. package/dist/zonos-elements/{p-076413a3.entry.js → p-fcd593bd.entry.js} +1 -1
  92. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  93. package/package.json +1 -1
  94. package/dist/esm-es5/handleFetch-ce924688.js +0 -1
  95. package/dist/zonos-elements/p-480556ea.system.js +0 -1
  96. package/dist/zonos-elements/p-5036a49f.system.js +0 -1
  97. package/dist/zonos-elements/p-539cc913.js +0 -1
  98. package/dist/zonos-elements/p-762a00e2.system.entry.js +0 -1
  99. package/dist/zonos-elements/p-92b0a91c.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const handleFetch = require('./handleFetch-5a16f2bc.js');
3
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
4
4
 
5
5
  const getTempCartById = async (cartId) => {
6
6
  const urlParams = new URLSearchParams(window.location.search);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-b18fe6b6.js');
4
- const handleFetch = require('./handleFetch-5a16f2bc.js');
4
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
5
5
  const isDarkColor = require('./isDarkColor-87ee1eb7.js');
6
6
  const getBorderRadius = require('./getBorderRadius-53c35cd1.js');
7
7
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const cart = require('./cart-213f42f0.js');
3
+ const cart = require('./cart-207f884e.js');
4
4
  const zonosStore = require('./zonosStore-b18fe6b6.js');
5
- const handleFetch = require('./handleFetch-5a16f2bc.js');
5
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
6
6
 
7
7
  const trackConversionEvent = async (eventName, metadata) => {
8
8
  var _a, _b;
@@ -2,6 +2,15 @@
2
2
 
3
3
  const startTime = performance.now();
4
4
  const allLogs = [];
5
+ const getElapsedTime = () => {
6
+ const elapsedTime = performance.now() - startTime;
7
+ const elapsedTimePretty =
8
+ // format the time to seconds if over 1 second
9
+ elapsedTime > 1000
10
+ ? `${(elapsedTime / 1000).toFixed(2)}s`
11
+ : `${elapsedTime.toFixed(2)}ms`;
12
+ return { elapsedTime, elapsedTimePretty };
13
+ };
5
14
  const prepInfo = (info) => {
6
15
  if (typeof info === 'string') {
7
16
  return info;
@@ -20,11 +29,8 @@ const prepInfo = (info) => {
20
29
  };
21
30
  const log = (message, type, ..._additionalInfo) => {
22
31
  var _a, _b;
23
- const time = performance.now() - startTime;
24
- const elapsedTime =
25
- // format the time to seconds if over 1 second
26
- time > 1000 ? `${(time / 1000).toFixed(2)}s` : `${time.toFixed(2)}ms`;
27
- const additionalInfo = [`(${elapsedTime})`, ..._additionalInfo];
32
+ const { elapsedTimePretty } = getElapsedTime();
33
+ const additionalInfo = [`(${elapsedTimePretty})`, ..._additionalInfo];
28
34
  const preppedInfo = additionalInfo.map(prepInfo).join(' ');
29
35
  allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
30
36
  const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
@@ -348,6 +354,7 @@ const handleFetch = async (path, _opts) => {
348
354
 
349
355
  exports.allLogs = allLogs;
350
356
  exports.fallbackApiList = fallbackApiList;
357
+ exports.getElapsedTime = getElapsedTime;
351
358
  exports.handleFetch = handleFetch;
352
359
  exports.jsonParse = jsonParse;
353
360
  exports.log = log;
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const handleFetch = require('./handleFetch-5a16f2bc.js');
6
- const CheckoutConfig = require('./CheckoutConfig-704147ec.js');
5
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
6
+ const CheckoutConfig = require('./CheckoutConfig-090e2b05.js');
7
7
 
8
8
  /**
9
9
  * Get the load version and url based on the loadScriptSrc and version
@@ -97,7 +97,7 @@ const getZonosQaUrl = () => {
97
97
  return null;
98
98
  }
99
99
  const qaUrl = extractZonosQaUrl(window.location.href);
100
- const cdnUrl = "https://v1.3.102.js.zonos.com";
100
+ const cdnUrl = "https://v1.3.103.js.zonos.com";
101
101
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
102
102
  if (!qaUrl &&
103
103
  (cdnUrl.includes('test.') ||
@@ -281,10 +281,10 @@ const zonosLoadUrl = (() => {
281
281
  }
282
282
  return null;
283
283
  })();
284
- const ZONOS_URL = "https://v1.3.102.js.zonos.com";
285
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.102";
286
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.102";
287
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.102";
284
+ const ZONOS_URL = "https://v1.3.103.js.zonos.com";
285
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.103";
286
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.103";
287
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.103";
288
288
  const INTER_FONT_URL = 'https://rsms.me';
289
289
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
290
290
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -299,7 +299,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
299
299
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
300
300
  Zonos._paypalMockResponse = null;
301
301
  Zonos.isBigCommerce = false;
302
- Zonos.releaseDate = "1729271071643";
302
+ Zonos.releaseDate = "1729277584379";
303
303
  Zonos.isLegacyCheckout = false;
304
304
  Zonos.showBaseForeign = typeof window !== 'undefined' &&
305
305
  window.location.search.includes('zonosShowBaseForeign');
@@ -309,7 +309,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
309
309
  Zonos.isNpm = true;
310
310
  Zonos.zonosQaUrl = null;
311
311
  Zonos.zonosQaUrlApi = null;
312
- Zonos.version = `v${"1.3.102"}`;
312
+ Zonos.version = `v${"1.3.103"}`;
313
313
  Zonos.modeAlerted = false;
314
314
  Zonos.cartData = null;
315
315
  Zonos.paypal = null;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  const zonosStore = require('./zonosStore-b18fe6b6.js');
4
- const cart = require('./cart-213f42f0.js');
5
- const handleFetch = require('./handleFetch-5a16f2bc.js');
4
+ const cart = require('./cart-207f884e.js');
5
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
6
6
  const isDarkColor = require('./isDarkColor-87ee1eb7.js');
7
7
 
8
8
  /*!
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
8
- const handleFetch = require('./handleFetch-5a16f2bc.js');
8
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
9
9
  const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
10
10
  const zonosStore = require('./zonosStore-b18fe6b6.js');
11
11
  const classes = require('./classes-b7918f56.js');
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const paypal = require('./paypal-d881282c.js');
8
+ const paypal = require('./paypal-8f5dccc8.js');
9
9
  const zonosStore = require('./zonosStore-b18fe6b6.js');
10
- const createCustomEvent = require('./createCustomEvent-f2792ab7.js');
10
+ const createCustomEvent = require('./createCustomEvent-16d055b8.js');
11
11
  const getBorderRadius = require('./getBorderRadius-53c35cd1.js');
12
- const handleFetch = require('./handleFetch-5a16f2bc.js');
12
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
13
13
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
14
14
  const ILanguage = require('./ILanguage-98b04442.js');
15
15
  const isDarkColor = require('./isDarkColor-87ee1eb7.js');
@@ -3,16 +3,16 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
7
- const paypal = require('./paypal-d881282c.js');
6
+ const cart = require('./cart-207f884e.js');
7
+ const paypal = require('./paypal-8f5dccc8.js');
8
8
  const zonosStore = require('./zonosStore-b18fe6b6.js');
9
- const handleFetch = require('./handleFetch-5a16f2bc.js');
10
- const createCustomEvent = require('./createCustomEvent-f2792ab7.js');
9
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
10
+ const createCustomEvent = require('./createCustomEvent-16d055b8.js');
11
11
  const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
12
12
  const classes = require('./classes-b7918f56.js');
13
13
  const getBorderRadius = require('./getBorderRadius-53c35cd1.js');
14
14
  const isDarkColor = require('./isDarkColor-87ee1eb7.js');
15
- const CheckoutConfig = require('./CheckoutConfig-704147ec.js');
15
+ const CheckoutConfig = require('./CheckoutConfig-090e2b05.js');
16
16
  const RemoveIcon = require('./RemoveIcon-081ac073.js');
17
17
 
18
18
  /**
@@ -184,6 +184,58 @@ const watchBigcommerceDomesticCheckout = ({ domesticRedirectedBtnSelector, onShi
184
184
  });
185
185
  };
186
186
 
187
+ const getNavigatorConnection = () => {
188
+ const connection = 'connection' in window.navigator
189
+ ? // connection is not yet supported in all browsers
190
+ window.navigator.connection
191
+ : null;
192
+ const mozConnection = 'mozConnection' in window.navigator
193
+ ? // mozConnection is not yet supported in all browsers
194
+ window.navigator.mozConnection
195
+ : null;
196
+ const webkitConnection = 'webkitConnection' in window.navigator
197
+ ? // webkitConnection is not yet supported in all browsers
198
+ window.navigator.webkitConnection
199
+ : null;
200
+ const baseConnection = connection || mozConnection || webkitConnection;
201
+ return baseConnection;
202
+ };
203
+
204
+ const getAdditionalLogMetadata = () => {
205
+ const userAgentData = 'userAgentData' in window.navigator
206
+ ? // userAgentData is not yet supported in all browsers
207
+ window.navigator.userAgentData
208
+ : null;
209
+ const baseConnection = getNavigatorConnection();
210
+ return {
211
+ connectionDownlink: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.downlink,
212
+ connectionEffectiveType: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.effectiveType,
213
+ connectionRtt: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.rtt,
214
+ connectionSaveData: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.saveData,
215
+ userAgent: userAgentData && userAgentData.brands.length > 0
216
+ ? userAgentData
217
+ : window.navigator.userAgent,
218
+ };
219
+ };
220
+
221
+ const sendLoadCheckoutFacadeLog = async () => {
222
+ const { elapsedTime } = handleFetch.getElapsedTime();
223
+ const scriptLoadLogBody = {
224
+ cache: 'miss',
225
+ eventName: 'jsdelivr',
226
+ flag: 'LOG_CHECKOUT_FACADE_LOAD',
227
+ href: window.location.href,
228
+ loadTime: elapsedTime,
229
+ metadata: Object.assign({ allLogs: handleFetch.allLogs }, getAdditionalLogMetadata()),
230
+ scriptLoadUrl: 'checkoutFacade',
231
+ storeId: window.Zonos.storeId,
232
+ };
233
+ void handleFetch.handleFetch('/api/zonos-elements/log-script-load', {
234
+ body: scriptLoadLogBody,
235
+ method: 'POST',
236
+ });
237
+ };
238
+
187
239
  const MessageIcon = `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">
188
240
  <path fill-rule="evenodd" clip-rule="evenodd" d="M2.25 4.5C2.25 3.25736 3.25736 2.25 4.5 2.25H13.5C14.7426 2.25 15.75 3.25736 15.75 4.5V10.5C15.75 11.7426 14.7426 12.75 13.5 12.75H8.25C8.01393 12.75 7.79164 12.8611 7.65 13.05L6.3 14.85C5.87508 15.4166 5.2082 15.75 4.5 15.75C3.25736 15.75 2.25 14.7426 2.25 13.5V4.5ZM4.5 3.75C4.08579 3.75 3.75 4.08579 3.75 4.5V13.5C3.75 13.9142 4.08579 14.25 4.5 14.25C4.73607 14.25 4.95836 14.1389 5.1 13.95L6.45 12.15C6.87492 11.5834 7.5418 11.25 8.25 11.25H13.5C13.9142 11.25 14.25 10.9142 14.25 10.5V4.5C14.25 4.08579 13.9142 3.75 13.5 3.75H4.5ZM5.25 6C5.25 5.58579 5.58579 5.25 6 5.25H12C12.4142 5.25 12.75 5.58579 12.75 6C12.75 6.41421 12.4142 6.75 12 6.75H6C5.58579 6.75 5.25 6.41421 5.25 6ZM5.25 9C5.25 8.58579 5.58579 8.25 6 8.25H8.25C8.66421 8.25 9 8.58579 9 9C9 9.41421 8.66421 9.75 8.25 9.75H6C5.58579 9.75 5.25 9.41421 5.25 9Z" fill="#4D505A"/>
189
241
  </svg>
@@ -390,6 +442,9 @@ const ZonosCheckout = class {
390
442
  cart.cartStore.shouldHideDiscountInput = !enabled;
391
443
  paypal.submitGtag('zonos-checkout-start');
392
444
  void createCustomEvent.trackConversionEvent('checkout_open');
445
+ if (window.Zonos.isLegacyCheckout) {
446
+ void sendLoadCheckoutFacadeLog();
447
+ }
393
448
  }
394
449
  catch (err) {
395
450
  // stop loading
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const zonosStore = require('./zonosStore-b18fe6b6.js');
8
- const handleFetch = require('./handleFetch-5a16f2bc.js');
8
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
9
9
  require('./isDarkColor-87ee1eb7.js');
10
10
  require('./getBorderRadius-53c35cd1.js');
11
11
 
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const zonosStore = require('./zonosStore-b18fe6b6.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
- require('./handleFetch-5a16f2bc.js');
9
+ require('./handleFetch-b0bbc10b.js');
10
10
  require('./isDarkColor-87ee1eb7.js');
11
11
  require('./getBorderRadius-53c35cd1.js');
12
12
 
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const zonosStore = require('./zonosStore-b18fe6b6.js');
8
8
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
9
9
  const isDarkColor = require('./isDarkColor-87ee1eb7.js');
10
10
  const ILanguage = require('./ILanguage-98b04442.js');
11
- require('./handleFetch-5a16f2bc.js');
11
+ require('./handleFetch-b0bbc10b.js');
12
12
  require('./getBorderRadius-53c35cd1.js');
13
13
 
14
14
  /**
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const zonosStore = require('./zonosStore-b18fe6b6.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
9
  const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
11
- require('./handleFetch-5a16f2bc.js');
11
+ require('./handleFetch-b0bbc10b.js');
12
12
  require('./isDarkColor-87ee1eb7.js');
13
13
  require('./getBorderRadius-53c35cd1.js');
14
14
 
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const zonosStore = require('./zonosStore-b18fe6b6.js');
7
- const cart = require('./cart-213f42f0.js');
7
+ const cart = require('./cart-207f884e.js');
8
8
  const classes = require('./classes-b7918f56.js');
9
- const handleFetch = require('./handleFetch-5a16f2bc.js');
9
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
10
10
  const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
11
11
  require('./isDarkColor-87ee1eb7.js');
12
12
  require('./getBorderRadius-53c35cd1.js');
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-d56e0a8b.js');
6
- const cart = require('./cart-213f42f0.js');
6
+ const cart = require('./cart-207f884e.js');
7
7
  const zonosStore = require('./zonosStore-b18fe6b6.js');
8
8
  const ILanguage = require('./ILanguage-98b04442.js');
9
- require('./handleFetch-5a16f2bc.js');
9
+ require('./handleFetch-b0bbc10b.js');
10
10
  require('./isDarkColor-87ee1eb7.js');
11
11
  require('./getBorderRadius-53c35cd1.js');
12
12
 
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-d56e0a8b.js');
6
6
  const zonosStore = require('./zonosStore-b18fe6b6.js');
7
7
  const classes = require('./classes-b7918f56.js');
8
- const cart = require('./cart-213f42f0.js');
9
- const handleFetch = require('./handleFetch-5a16f2bc.js');
10
- const paypal = require('./paypal-d881282c.js');
8
+ const cart = require('./cart-207f884e.js');
9
+ const handleFetch = require('./handleFetch-b0bbc10b.js');
10
+ const paypal = require('./paypal-8f5dccc8.js');
11
11
  require('./isDarkColor-87ee1eb7.js');
12
12
  require('./getBorderRadius-53c35cd1.js');
13
13
 
@@ -21,6 +21,7 @@ import { isDarkColor } from "../../utils/isDarkColor";
21
21
  import { allLogs, log } from "../../utils/logging/log";
22
22
  import { logError } from "../../utils/logging/logError";
23
23
  import { sendErrorLog } from "../../utils/logging/sendErrorLog";
24
+ import { sendLoadCheckoutFacadeLog } from "../../utils/logging/sendLoadCheckoutFacadeLog";
24
25
  import { mergeConfig } from "../../utils/mergeConfig";
25
26
  import { submitGtag } from "../../utils/submitGtag";
26
27
  import { setupCartData } from "../../../scripts/cart/_setupCartData";
@@ -227,6 +228,9 @@ export class ZonosCheckout {
227
228
  cartStore.shouldHideDiscountInput = !enabled;
228
229
  submitGtag('zonos-checkout-start');
229
230
  void trackConversionEvent('checkout_open');
231
+ if (window.Zonos.isLegacyCheckout) {
232
+ void sendLoadCheckoutFacadeLog();
233
+ }
230
234
  }
231
235
  catch (err) {
232
236
  // stop loading
@@ -1,5 +1,14 @@
1
1
  const startTime = performance.now();
2
2
  export const allLogs = [];
3
+ export const getElapsedTime = () => {
4
+ const elapsedTime = performance.now() - startTime;
5
+ const elapsedTimePretty =
6
+ // format the time to seconds if over 1 second
7
+ elapsedTime > 1000
8
+ ? `${(elapsedTime / 1000).toFixed(2)}s`
9
+ : `${elapsedTime.toFixed(2)}ms`;
10
+ return { elapsedTime, elapsedTimePretty };
11
+ };
3
12
  const prepInfo = (info) => {
4
13
  if (typeof info === 'string') {
5
14
  return info;
@@ -18,11 +27,8 @@ const prepInfo = (info) => {
18
27
  };
19
28
  export const log = (message, type, ..._additionalInfo) => {
20
29
  var _a, _b;
21
- const time = performance.now() - startTime;
22
- const elapsedTime =
23
- // format the time to seconds if over 1 second
24
- time > 1000 ? `${(time / 1000).toFixed(2)}s` : `${time.toFixed(2)}ms`;
25
- const additionalInfo = [`(${elapsedTime})`, ..._additionalInfo];
30
+ const { elapsedTimePretty } = getElapsedTime();
31
+ const additionalInfo = [`(${elapsedTimePretty})`, ..._additionalInfo];
26
32
  const preppedInfo = additionalInfo.map(prepInfo).join(' ');
27
33
  allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
28
34
  const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
@@ -0,0 +1,24 @@
1
+ import { handleFetch } from "../handleFetch";
2
+ import { allLogs, getElapsedTime } from "./log";
3
+ import { getAdditionalLogMetadata } from "./sendLoadScriptLog";
4
+ const disabled = false;
5
+ export const sendLoadCheckoutFacadeLog = async () => {
6
+ if (disabled) {
7
+ return;
8
+ }
9
+ const { elapsedTime } = getElapsedTime();
10
+ const scriptLoadLogBody = {
11
+ cache: 'miss',
12
+ eventName: 'jsdelivr',
13
+ flag: 'LOG_CHECKOUT_FACADE_LOAD',
14
+ href: window.location.href,
15
+ loadTime: elapsedTime,
16
+ metadata: Object.assign({ allLogs }, getAdditionalLogMetadata()),
17
+ scriptLoadUrl: 'checkoutFacade',
18
+ storeId: window.Zonos.storeId,
19
+ };
20
+ void handleFetch('/api/zonos-elements/log-script-load', {
21
+ body: scriptLoadLogBody,
22
+ method: 'POST',
23
+ });
24
+ };
@@ -1,19 +1,28 @@
1
1
  import { handleFetch } from "../handleFetch";
2
2
  import { getNavigatorConnection } from "./getNavigatorConnection";
3
+ export const getAdditionalLogMetadata = () => {
4
+ const userAgentData = 'userAgentData' in window.navigator
5
+ ? // userAgentData is not yet supported in all browsers
6
+ window.navigator.userAgentData
7
+ : null;
8
+ const baseConnection = getNavigatorConnection();
9
+ return {
10
+ connectionDownlink: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.downlink,
11
+ connectionEffectiveType: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.effectiveType,
12
+ connectionRtt: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.rtt,
13
+ connectionSaveData: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.saveData,
14
+ userAgent: userAgentData && userAgentData.brands.length > 0
15
+ ? userAgentData
16
+ : window.navigator.userAgent,
17
+ };
18
+ };
3
19
  const disabled = true;
4
20
  export const sendLoadScriptLog = async (params) => {
5
21
  // turn off for now
6
22
  if (disabled) {
7
23
  return;
8
24
  }
9
- const userAgentData = 'userAgentData' in window.navigator
10
- ? // userAgentData is not yet supported in all browsers
11
- window.navigator.userAgentData
12
- : null;
13
- const baseConnection = getNavigatorConnection();
14
- const scriptLoadLogBody = Object.assign(Object.assign({ href: window.location.href }, params), { metadata: Object.assign({ connectionDownlink: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.downlink, connectionEffectiveType: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.effectiveType, connectionRtt: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.rtt, connectionSaveData: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.saveData, userAgent: userAgentData && userAgentData.brands.length > 0
15
- ? userAgentData
16
- : window.navigator.userAgent }, params.metadata) });
25
+ const scriptLoadLogBody = Object.assign(Object.assign({ href: window.location.href }, params), { metadata: Object.assign(Object.assign({}, getAdditionalLogMetadata()), params.metadata) });
17
26
  void handleFetch('/api/zonos-elements/log-script-load', {
18
27
  body: scriptLoadLogBody,
19
28
  method: 'POST',
@@ -1,4 +1,4 @@
1
- import { h as handleFetch, l as log, a as logError } from './handleFetch-ce924688.js';
1
+ import { h as handleFetch, l as log, a as logError } from './handleFetch-41e3d2b2.js';
2
2
 
3
3
  const getTempCartById = async (cartId) => {
4
4
  const urlParams = new URLSearchParams(window.location.search);
@@ -1,5 +1,5 @@
1
1
  import { c as createStore, z as zonosStore } from './zonosStore-7798ac16.js';
2
- import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-ce924688.js';
2
+ import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-41e3d2b2.js';
3
3
  import { i as isDarkColor } from './isDarkColor-4261bc3c.js';
4
4
  import { g as getBorderRadius } from './getBorderRadius-e55a9df1.js';
5
5
 
@@ -1,6 +1,6 @@
1
- import { d as cartStore, l as localizationStore } from './cart-9a4c155b.js';
1
+ import { d as cartStore, l as localizationStore } from './cart-90943a07.js';
2
2
  import { z as zonosStore } from './zonosStore-7798ac16.js';
3
- import { h as handleFetch } from './handleFetch-ce924688.js';
3
+ import { h as handleFetch } from './handleFetch-41e3d2b2.js';
4
4
 
5
5
  const trackConversionEvent = async (eventName, metadata) => {
6
6
  var _a, _b;
@@ -1,5 +1,14 @@
1
1
  const startTime = performance.now();
2
2
  const allLogs = [];
3
+ const getElapsedTime = () => {
4
+ const elapsedTime = performance.now() - startTime;
5
+ const elapsedTimePretty =
6
+ // format the time to seconds if over 1 second
7
+ elapsedTime > 1000
8
+ ? `${(elapsedTime / 1000).toFixed(2)}s`
9
+ : `${elapsedTime.toFixed(2)}ms`;
10
+ return { elapsedTime, elapsedTimePretty };
11
+ };
3
12
  const prepInfo = (info) => {
4
13
  if (typeof info === 'string') {
5
14
  return info;
@@ -18,11 +27,8 @@ const prepInfo = (info) => {
18
27
  };
19
28
  const log = (message, type, ..._additionalInfo) => {
20
29
  var _a, _b;
21
- const time = performance.now() - startTime;
22
- const elapsedTime =
23
- // format the time to seconds if over 1 second
24
- time > 1000 ? `${(time / 1000).toFixed(2)}s` : `${time.toFixed(2)}ms`;
25
- const additionalInfo = [`(${elapsedTime})`, ..._additionalInfo];
30
+ const { elapsedTimePretty } = getElapsedTime();
31
+ const additionalInfo = [`(${elapsedTimePretty})`, ..._additionalInfo];
26
32
  const preppedInfo = additionalInfo.map(prepInfo).join(' ');
27
33
  allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
28
34
  const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
@@ -344,4 +350,4 @@ const handleFetch = async (path, _opts) => {
344
350
  });
345
351
  };
346
352
 
347
- export { logError as a, allLogs as b, fallbackApiList as f, handleFetch as h, jsonParse as j, log as l, sendErrorLog as s };
353
+ export { logError as a, allLogs as b, fallbackApiList as f, getElapsedTime as g, handleFetch as h, jsonParse as j, log as l, sendErrorLog as s };
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { l as log, a as logError } from './handleFetch-ce924688.js';
2
- import { s as setupCartData, c as checkoutHiddenBtnSelector } from './CheckoutConfig-d237227e.js';
3
- export { c as checkoutHiddenBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-d237227e.js';
1
+ import { l as log, a as logError } from './handleFetch-41e3d2b2.js';
2
+ import { s as setupCartData, c as checkoutHiddenBtnSelector } from './CheckoutConfig-9cdb7beb.js';
3
+ export { c as checkoutHiddenBtnSelector, d as domesticRedirectedBtnSelector } from './CheckoutConfig-9cdb7beb.js';
4
4
 
5
5
  /**
6
6
  * Get the load version and url based on the loadScriptSrc and version
@@ -94,7 +94,7 @@ const getZonosQaUrl = () => {
94
94
  return null;
95
95
  }
96
96
  const qaUrl = extractZonosQaUrl(window.location.href);
97
- const cdnUrl = "https://v1.3.102.js.zonos.com";
97
+ const cdnUrl = "https://v1.3.103.js.zonos.com";
98
98
  // when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
99
99
  if (!qaUrl &&
100
100
  (cdnUrl.includes('test.') ||
@@ -278,10 +278,10 @@ const zonosLoadUrl = (() => {
278
278
  }
279
279
  return null;
280
280
  })();
281
- const ZONOS_URL = "https://v1.3.102.js.zonos.com";
282
- const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.102";
283
- const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.102";
284
- const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.102";
281
+ const ZONOS_URL = "https://v1.3.103.js.zonos.com";
282
+ const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.103";
283
+ const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.103";
284
+ const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.103";
285
285
  const INTER_FONT_URL = 'https://rsms.me';
286
286
  const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
287
287
  const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
@@ -296,7 +296,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
296
296
  !!window.location.search.match(/\?.*(&*)zonosConversionTest/);
297
297
  Zonos._paypalMockResponse = null;
298
298
  Zonos.isBigCommerce = false;
299
- Zonos.releaseDate = "1729271071643";
299
+ Zonos.releaseDate = "1729277584379";
300
300
  Zonos.isLegacyCheckout = false;
301
301
  Zonos.showBaseForeign = typeof window !== 'undefined' &&
302
302
  window.location.search.includes('zonosShowBaseForeign');
@@ -306,7 +306,7 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
306
306
  Zonos.isNpm = true;
307
307
  Zonos.zonosQaUrl = null;
308
308
  Zonos.zonosQaUrlApi = null;
309
- Zonos.version = `v${"1.3.102"}`;
309
+ Zonos.version = `v${"1.3.103"}`;
310
310
  Zonos.modeAlerted = false;
311
311
  Zonos.cartData = null;
312
312
  Zonos.paypal = null;
@@ -1,6 +1,6 @@
1
1
  import { z as zonosStore, c as createStore } from './zonosStore-7798ac16.js';
2
- import { d as cartStore, u as stripeStoreHandleInventoryCheck, t as translate, r as cartStoreNextStep, h as cartStoreClearCheckoutInterval } from './cart-9a4c155b.js';
3
- import { h as handleFetch, l as log, a as logError, j as jsonParse } from './handleFetch-ce924688.js';
2
+ import { d as cartStore, u as stripeStoreHandleInventoryCheck, t as translate, r as cartStoreNextStep, h as cartStoreClearCheckoutInterval } from './cart-90943a07.js';
3
+ import { h as handleFetch, l as log, a as logError, j as jsonParse } from './handleFetch-41e3d2b2.js';
4
4
  import { t as tinycolor } from './isDarkColor-4261bc3c.js';
5
5
 
6
6
  /*!
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, d as getElement } from './index-86b8247e.js';
2
- import { j as stripeStore, P as getFallbackDefaultCountryCode, l as localizationStore, t as translate } from './cart-9a4c155b.js';
2
+ import { j as stripeStore, P as getFallbackDefaultCountryCode, l as localizationStore, t as translate } from './cart-90943a07.js';
3
3
  import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
4
- import { a as logError, l as log } from './handleFetch-ce924688.js';
4
+ import { a as logError, l as log } from './handleFetch-41e3d2b2.js';
5
5
  import { i as isTextContainsNonLatinChars, c as containsNonLatinChars } from './containsNonLatinChars-2d8810c3.js';
6
6
  import { z as zonosStore, d as zonosStoreFontFamily } from './zonosStore-7798ac16.js';
7
7
  import { c as classes } from './classes-0d95c529.js';
@@ -1,11 +1,11 @@
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
- import { d as cartStore, E as currencyFormat, t as translate, F as cartStoreHasOneEligibleItem, G as stripeStoreApplyPromoCode, H as stripeStoreRemovePromoCode, w as stripeStoreReset, j as stripeStore, I as stripeStoreRetrievePayment, J as stripeStoreMessageBasedOnStatus, K as stripeStoreResetPromoCode, l as localizationStore, L as stripeStoreTranslateAddressToLatin, M as cartStoreUpdateSelectedShippingOption, N as cartStoreGetShippingTransitInfo, O as sortServiceLevelOptionsByAmount } from './cart-9a4c155b.js';
2
+ import { d as cartStore, E as currencyFormat, t as translate, F as cartStoreHasOneEligibleItem, G as stripeStoreApplyPromoCode, H as stripeStoreRemovePromoCode, w as stripeStoreReset, j as stripeStore, I as stripeStoreRetrievePayment, J as stripeStoreMessageBasedOnStatus, K as stripeStoreResetPromoCode, l as localizationStore, L as stripeStoreTranslateAddressToLatin, M as cartStoreUpdateSelectedShippingOption, N as cartStoreGetShippingTransitInfo, O as sortServiceLevelOptionsByAmount } from './cart-90943a07.js';
3
3
  import { c as classes } from './classes-0d95c529.js';
4
- import { s as submitGtag, a as paypalStore, b as paypalStoreReset, i as isContrastColor } from './paypal-63e83a4a.js';
4
+ import { s as submitGtag, a as paypalStore, b as paypalStoreReset, i as isContrastColor } from './paypal-417c64a1.js';
5
5
  import { z as zonosStore, g as getZonosStoreTheme, d as zonosStoreFontFamily } from './zonosStore-7798ac16.js';
6
- import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-65611cd0.js';
6
+ import { t as trackConversionEvent, c as createCustomEvent, g as getIsTestMode } from './createCustomEvent-3ea6c7c5.js';
7
7
  import { g as getBorderRadius } from './getBorderRadius-e55a9df1.js';
8
- import { h as handleFetch, s as sendErrorLog } from './handleFetch-ce924688.js';
8
+ import { h as handleFetch, s as sendErrorLog } from './handleFetch-41e3d2b2.js';
9
9
  import { i as isCheckoutMobile } from './isCheckoutMobile-8846dccb.js';
10
10
  import { l as languages } from './ILanguage-cd6acb72.js';
11
11
  import { i as isDarkColor, t as tinycolor } from './isDarkColor-4261bc3c.js';