@zonos/elements 1.3.79 → 1.3.81
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.
- package/dist/cjs/{CheckoutConfig-2fef694e.js → CheckoutConfig-850071ae.js} +1 -1
- package/dist/cjs/{cart-977c9d4c.js → cart-97e693e4.js} +4 -5
- package/dist/cjs/{createCustomEvent-2b19361e.js → createCustomEvent-777b3fa7.js} +2 -2
- package/dist/cjs/{handleFetch-661a8225.js → handleFetch-45e76490.js} +29 -1
- package/dist/cjs/index.cjs.js +10 -10
- package/dist/cjs/{paypal-3008c89e.js → paypal-16029169.js} +2 -2
- package/dist/cjs/zonos-address_8.cjs.entry.js +2 -2
- package/dist/cjs/zonos-badge_13.cjs.entry.js +4 -4
- package/dist/cjs/zonos-checkout.cjs.entry.js +17 -5
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/cjs/zonos-notification_3.cjs.entry.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +14 -1
- package/dist/collection/components/store/checkout/stripe.js +1 -1
- package/dist/collection/components/store/hello/localization.js +2 -3
- package/dist/collection/components/utils/handleFetch.js +1 -0
- package/dist/collection/components/utils/logging/log.js +26 -1
- package/dist/collection/components/utils/logging/sendErrorLog.js +2 -0
- package/dist/collection/scripts/_extractZonosQaUrl.js +16 -0
- package/dist/collection/scripts/_getZonosQaUrl.js +13 -4
- package/dist/esm/{CheckoutConfig-c7954c2a.js → CheckoutConfig-c0ec120d.js} +1 -1
- package/dist/esm/{cart-414322dc.js → cart-9bf6dece.js} +4 -5
- package/dist/esm/{createCustomEvent-fcd6d294.js → createCustomEvent-a18e45a2.js} +2 -2
- package/dist/esm/{handleFetch-80ecfb91.js → handleFetch-0133265e.js} +29 -2
- package/dist/esm/index.js +11 -11
- package/dist/esm/{paypal-3fecd52f.js → paypal-edab4cee.js} +2 -2
- package/dist/esm/zonos-address_8.entry.js +2 -2
- package/dist/esm/zonos-badge_13.entry.js +4 -4
- package/dist/esm/zonos-checkout.entry.js +17 -5
- package/dist/esm/zonos-controller.entry.js +2 -2
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-notification_3.entry.js +3 -3
- package/dist/esm-es5/{CheckoutConfig-c7954c2a.js → CheckoutConfig-c0ec120d.js} +1 -1
- package/dist/esm-es5/{cart-414322dc.js → cart-9bf6dece.js} +1 -1
- package/dist/esm-es5/{createCustomEvent-fcd6d294.js → createCustomEvent-a18e45a2.js} +1 -1
- package/dist/esm-es5/handleFetch-0133265e.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-3fecd52f.js → paypal-edab4cee.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-notification_3.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/utils/logging/log.d.ts +2 -1
- package/dist/types/scripts/_extractZonosQaUrl.d.ts +1 -0
- package/dist/types/scripts/_getZonosQaUrl.d.ts +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-197c5707.system.js +1 -0
- package/dist/zonos-elements/{p-ced3aa4f.system.entry.js → p-1b8c8e0c.system.entry.js} +1 -1
- package/dist/zonos-elements/p-214724f8.system.entry.js +1 -0
- package/dist/zonos-elements/{p-d5818f0a.js → p-23358611.js} +1 -1
- package/dist/zonos-elements/{p-0290df9c.entry.js → p-264fbd27.entry.js} +1 -1
- package/dist/zonos-elements/{p-9c02a170.system.js → p-49478dba.system.js} +1 -1
- package/dist/zonos-elements/{p-0a1db77d.system.entry.js → p-51f8c3d5.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0f640802.system.js → p-62044821.system.js} +1 -1
- package/dist/zonos-elements/{p-75fd8895.js → p-6b4fec5a.js} +1 -1
- package/dist/zonos-elements/{p-a725574a.entry.js → p-6f821997.entry.js} +1 -1
- package/dist/zonos-elements/{p-c2920074.js → p-7ca0622f.js} +1 -1
- package/dist/zonos-elements/{p-cce51fa5.system.entry.js → p-811ed9bf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-81cdd0d5.system.js → p-8c0ff373.system.js} +1 -1
- package/dist/zonos-elements/{p-f8dace42.system.entry.js → p-8cbbdd53.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-86bfda32.system.entry.js → p-8dae668f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bbabc829.system.entry.js → p-92ba4082.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e68941ce.system.entry.js → p-95f0ffd1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-982aa677.entry.js → p-97f0d9d2.entry.js} +1 -1
- package/dist/zonos-elements/{p-72f0641d.entry.js → p-a2fedd1c.entry.js} +1 -1
- package/dist/zonos-elements/{p-3d01ac9a.entry.js → p-a3200d5c.entry.js} +1 -1
- package/dist/zonos-elements/p-ad7ce197.js +1 -0
- package/dist/zonos-elements/{p-6b3fd741.js → p-b8e85bf5.js} +1 -1
- package/dist/zonos-elements/p-bc4a147d.entry.js +1 -0
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-acbec292.system.entry.js → p-d08ed3ea.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d466263.system.js → p-d26d827d.system.js} +1 -1
- package/dist/zonos-elements/{p-1047233d.entry.js → p-d775bd42.entry.js} +1 -1
- package/dist/zonos-elements/{p-4032de50.entry.js → p-df4deb97.entry.js} +1 -1
- package/dist/zonos-elements/p-e3cb74fd.system.js +1 -0
- package/dist/zonos-elements/{p-166b3181.entry.js → p-e468f85e.entry.js} +1 -1
- package/dist/zonos-elements/{p-f0d6f027.system.entry.js → p-f7b5ae86.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c1400636.entry.js → p-fac38f60.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/handleFetch-80ecfb91.js +0 -1
- package/dist/zonos-elements/p-2ec2e9d3.js +0 -1
- package/dist/zonos-elements/p-502d5e52.system.entry.js +0 -1
- package/dist/zonos-elements/p-5880738e.system.js +0 -1
- package/dist/zonos-elements/p-c4957e35.system.js +0 -1
- package/dist/zonos-elements/p-e6ec9f12.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const handleFetch = require('./handleFetch-
|
|
3
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
4
4
|
|
|
5
5
|
const getTempCartById = async (cartId) => {
|
|
6
6
|
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/get-temp-cart', {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
5
5
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
6
6
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
7
7
|
|
|
@@ -8035,7 +8035,7 @@ const initLocalizationStore = async () => {
|
|
|
8035
8035
|
initHelloCountryList(allCountries || {});
|
|
8036
8036
|
const { country, locale } = localization;
|
|
8037
8037
|
// update selected country code in store
|
|
8038
|
-
|
|
8038
|
+
localizationStoreUpdateSelectedCountryCode(country);
|
|
8039
8039
|
// use locale from params if it exists, otherwise use locale from localization
|
|
8040
8040
|
const overrideLocale = getOverrideLocale();
|
|
8041
8041
|
localizationStore.selectedLocale = overrideLocale || locale || 'en';
|
|
@@ -8050,10 +8050,9 @@ const initLocalizationStore = async () => {
|
|
|
8050
8050
|
if (!localizationStore.selectedCountryCode &&
|
|
8051
8051
|
devSites.some(site => window.location.origin.includes(site))) {
|
|
8052
8052
|
// update selected country code in store
|
|
8053
|
-
|
|
8053
|
+
localizationStoreUpdateSelectedCountryCode('US');
|
|
8054
8054
|
}
|
|
8055
8055
|
localizationStore.localizationLoaded = true;
|
|
8056
|
-
void getCustomMessages();
|
|
8057
8056
|
};
|
|
8058
8057
|
const updateCheckoutSessionLanguage = async () => {
|
|
8059
8058
|
if (!cartStore.checkoutSessionId) {
|
|
@@ -8847,7 +8846,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
8847
8846
|
});
|
|
8848
8847
|
stripeStore.isFetchingSession = false;
|
|
8849
8848
|
if (errors.length || !json) {
|
|
8850
|
-
handleFetch.logError('Error
|
|
8849
|
+
handleFetch.logError('Error occurred when creating checkout session', JSON.stringify(errors, null, 2));
|
|
8851
8850
|
return false;
|
|
8852
8851
|
}
|
|
8853
8852
|
const result = json.checkoutSessionCreate;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const cart = require('./cart-
|
|
3
|
+
const cart = require('./cart-97e693e4.js');
|
|
4
4
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
5
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
6
6
|
|
|
7
7
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
8
8
|
var _a, _b;
|
|
@@ -1,7 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const startTime = performance.now();
|
|
4
|
+
const allLogs = [];
|
|
5
|
+
const prepInfo = (info) => {
|
|
6
|
+
if (typeof info === 'string') {
|
|
7
|
+
return info;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const infoToJson = JSON.stringify(info);
|
|
11
|
+
return infoToJson;
|
|
12
|
+
}
|
|
13
|
+
catch (e1) {
|
|
14
|
+
if (info && typeof info.toString === 'function') {
|
|
15
|
+
const infoToString = info.toString();
|
|
16
|
+
return infoToString;
|
|
17
|
+
}
|
|
18
|
+
return 'Unable to stringify info';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const log = (message, type, ..._additionalInfo) => {
|
|
4
22
|
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];
|
|
28
|
+
const preppedInfo = additionalInfo.map(prepInfo).join(' ');
|
|
29
|
+
allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
|
|
5
30
|
const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
6
31
|
!!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
7
32
|
// if debug is false, do not log
|
|
@@ -93,6 +118,7 @@ const jsonParse = (_data) => {
|
|
|
93
118
|
*/
|
|
94
119
|
const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
|
|
95
120
|
const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
|
|
121
|
+
log('sendErrorLog', 'warn', endpoint, metadata, errors);
|
|
96
122
|
if (shouldPostReleaseErrorReporting) {
|
|
97
123
|
// We only want to report errors that happened if current time is less than 2 hours after release time
|
|
98
124
|
const releaseTime = Number(window.Zonos.releaseDate);
|
|
@@ -312,6 +338,7 @@ const handleFetch = async (path, _opts) => {
|
|
|
312
338
|
method });
|
|
313
339
|
// This is for testing fallback API, set fallback API type to start with
|
|
314
340
|
const useFallbackApi = new URLSearchParams(window.location.search).get('useFallbackApi');
|
|
341
|
+
log(path, 'info');
|
|
315
342
|
return handleRequestWithFallback({
|
|
316
343
|
basePathType: useFallbackApi || MAIN_BASE_API_TYPE,
|
|
317
344
|
options,
|
|
@@ -319,6 +346,7 @@ const handleFetch = async (path, _opts) => {
|
|
|
319
346
|
});
|
|
320
347
|
};
|
|
321
348
|
|
|
349
|
+
exports.allLogs = allLogs;
|
|
322
350
|
exports.fallbackApiList = fallbackApiList;
|
|
323
351
|
exports.handleFetch = handleFetch;
|
|
324
352
|
exports.jsonParse = jsonParse;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
6
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
5
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
6
|
+
const CheckoutConfig = require('./CheckoutConfig-850071ae.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.
|
|
100
|
+
const cdnUrl = "https://v1.3.81.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.') ||
|
|
@@ -119,7 +119,7 @@ const getZonosQaUrl = () => {
|
|
|
119
119
|
}
|
|
120
120
|
const suffixDomain = 'preview.js.zonos.com';
|
|
121
121
|
const fullUrl = `https://${qaUrl}.${suffixDomain}`;
|
|
122
|
-
handleFetch.log(`[ZONOS-WARNING] using '${fullUrl}' for loading script`, 'warn');
|
|
122
|
+
handleFetch.log(`[ZONOS-WARNING] using '${fullUrl}' for loading elements script`, 'warn');
|
|
123
123
|
// request to the url and check if the request has an error
|
|
124
124
|
void fetch(fullUrl)
|
|
125
125
|
.then(() => {
|
|
@@ -281,10 +281,10 @@ const zonosLoadUrl = (() => {
|
|
|
281
281
|
}
|
|
282
282
|
return null;
|
|
283
283
|
})();
|
|
284
|
-
const ZONOS_URL = "https://v1.3.
|
|
285
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
286
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
287
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
284
|
+
const ZONOS_URL = "https://v1.3.81.js.zonos.com";
|
|
285
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.81";
|
|
286
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.81";
|
|
287
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.81";
|
|
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 = "
|
|
302
|
+
Zonos.releaseDate = "1728674078511";
|
|
303
303
|
Zonos.isLegacyCheckout = false;
|
|
304
304
|
/**
|
|
305
305
|
* By default, the package will load from npm
|
|
@@ -307,7 +307,7 @@ Zonos.isLegacyCheckout = false;
|
|
|
307
307
|
Zonos.isNpm = true;
|
|
308
308
|
Zonos.zonosQaUrl = null;
|
|
309
309
|
Zonos.zonosQaUrlApi = null;
|
|
310
|
-
Zonos.version = `v${"1.3.
|
|
310
|
+
Zonos.version = `v${"1.3.81"}`;
|
|
311
311
|
Zonos.modeAlerted = false;
|
|
312
312
|
Zonos.cartData = null;
|
|
313
313
|
Zonos.paypal = null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const cart = require('./cart-97e693e4.js');
|
|
5
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-5efc8367.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-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-d56e0a8b.js');
|
|
6
6
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const cart = require('./cart-
|
|
9
|
-
const paypal = require('./paypal-
|
|
10
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
8
|
+
const cart = require('./cart-97e693e4.js');
|
|
9
|
+
const paypal = require('./paypal-16029169.js');
|
|
10
|
+
const createCustomEvent = require('./createCustomEvent-777b3fa7.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
12
|
-
const handleFetch = require('./handleFetch-
|
|
12
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
15
|
const isDarkColor = require('./isDarkColor-5efc8367.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-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
|
+
const paypal = require('./paypal-16029169.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
9
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
9
|
+
const createCustomEvent = require('./createCustomEvent-777b3fa7.js');
|
|
10
10
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
11
|
-
const handleFetch = require('./handleFetch-
|
|
11
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
12
12
|
const classes = require('./classes-b7918f56.js');
|
|
13
13
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
14
14
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
15
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
15
|
+
const CheckoutConfig = require('./CheckoutConfig-850071ae.js');
|
|
16
16
|
const RemoveIcon = require('./RemoveIcon-081ac073.js');
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -353,6 +353,7 @@ const ZonosCheckout = class {
|
|
|
353
353
|
button,
|
|
354
354
|
});
|
|
355
355
|
button.addEventListener('click', async (e) => {
|
|
356
|
+
var _a;
|
|
356
357
|
if (!isShippableCountry() || isDisabledCountry()) {
|
|
357
358
|
return;
|
|
358
359
|
}
|
|
@@ -385,6 +386,17 @@ const ZonosCheckout = class {
|
|
|
385
386
|
],
|
|
386
387
|
title: cart.translate('Error creating Checkout'),
|
|
387
388
|
});
|
|
389
|
+
// We want to log the error anytime we fail to create a checkout session
|
|
390
|
+
void handleFetch.sendErrorLog({
|
|
391
|
+
endpoint: 'Error creating Checkout',
|
|
392
|
+
errors: [err instanceof Error ? err.toString() : 'Unknown error'],
|
|
393
|
+
metadata: {
|
|
394
|
+
allLogs: handleFetch.allLogs,
|
|
395
|
+
cartId: window.Zonos.cartId,
|
|
396
|
+
href: window.location.href,
|
|
397
|
+
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
398
|
+
},
|
|
399
|
+
});
|
|
388
400
|
}
|
|
389
401
|
}, {
|
|
390
402
|
// Trigger this event before any other event
|
|
@@ -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-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
9
9
|
require('./isDarkColor-5efc8367.js');
|
|
10
10
|
require('./getBorderRadius-5a64574c.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-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-45e76490.js');
|
|
10
10
|
require('./isDarkColor-5efc8367.js');
|
|
11
11
|
require('./getBorderRadius-5a64574c.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-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
10
10
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
11
|
-
require('./handleFetch-
|
|
11
|
+
require('./handleFetch-45e76490.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.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-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.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-
|
|
11
|
+
require('./handleFetch-45e76490.js');
|
|
12
12
|
require('./isDarkColor-5efc8367.js');
|
|
13
13
|
require('./getBorderRadius-5a64574c.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-a4395972.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-97e693e4.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.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-
|
|
6
|
+
const cart = require('./cart-97e693e4.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-45e76490.js');
|
|
10
10
|
require('./isDarkColor-5efc8367.js');
|
|
11
11
|
require('./getBorderRadius-5a64574c.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-a4395972.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const cart = require('./cart-
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
10
|
-
const paypal = require('./paypal-
|
|
8
|
+
const cart = require('./cart-97e693e4.js');
|
|
9
|
+
const handleFetch = require('./handleFetch-45e76490.js');
|
|
10
|
+
const paypal = require('./paypal-16029169.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
13
13
|
|
|
@@ -16,8 +16,9 @@ import { classes } from "../../utils/classes";
|
|
|
16
16
|
import { createCustomEvent } from "../../utils/createCustomEvent";
|
|
17
17
|
import { getBorderRadius } from "../../utils/getBorderRadius";
|
|
18
18
|
import { isDarkColor } from "../../utils/isDarkColor";
|
|
19
|
-
import { log } from "../../utils/logging/log";
|
|
19
|
+
import { allLogs, log } from "../../utils/logging/log";
|
|
20
20
|
import { logError } from "../../utils/logging/logError";
|
|
21
|
+
import { sendErrorLog } from "../../utils/logging/sendErrorLog";
|
|
21
22
|
import { mergeConfig } from "../../utils/mergeConfig";
|
|
22
23
|
import { submitGtag } from "../../utils/submitGtag";
|
|
23
24
|
import { setupCartData } from "../../../scripts/cart/_setupCartData";
|
|
@@ -196,6 +197,7 @@ export class ZonosCheckout {
|
|
|
196
197
|
button,
|
|
197
198
|
});
|
|
198
199
|
button.addEventListener('click', async (e) => {
|
|
200
|
+
var _a;
|
|
199
201
|
if (!isShippableCountry() || isDisabledCountry()) {
|
|
200
202
|
return;
|
|
201
203
|
}
|
|
@@ -228,6 +230,17 @@ export class ZonosCheckout {
|
|
|
228
230
|
],
|
|
229
231
|
title: translate('Error creating Checkout'),
|
|
230
232
|
});
|
|
233
|
+
// We want to log the error anytime we fail to create a checkout session
|
|
234
|
+
void sendErrorLog({
|
|
235
|
+
endpoint: 'Error creating Checkout',
|
|
236
|
+
errors: [err instanceof Error ? err.toString() : 'Unknown error'],
|
|
237
|
+
metadata: {
|
|
238
|
+
allLogs,
|
|
239
|
+
cartId: window.Zonos.cartId,
|
|
240
|
+
href: window.location.href,
|
|
241
|
+
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
242
|
+
},
|
|
243
|
+
});
|
|
231
244
|
}
|
|
232
245
|
}, {
|
|
233
246
|
// Trigger this event before any other event
|
|
@@ -372,7 +372,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
372
372
|
});
|
|
373
373
|
stripeStore.isFetchingSession = false;
|
|
374
374
|
if (errors.length || !json) {
|
|
375
|
-
logError('Error
|
|
375
|
+
logError('Error occurred when creating checkout session', JSON.stringify(errors, null, 2));
|
|
376
376
|
return false;
|
|
377
377
|
}
|
|
378
378
|
const result = json.checkoutSessionCreate;
|
|
@@ -191,7 +191,7 @@ const initLocalizationStore = async () => {
|
|
|
191
191
|
initHelloCountryList(allCountries || {});
|
|
192
192
|
const { country, locale } = localization;
|
|
193
193
|
// update selected country code in store
|
|
194
|
-
|
|
194
|
+
localizationStoreUpdateSelectedCountryCode(country);
|
|
195
195
|
// use locale from params if it exists, otherwise use locale from localization
|
|
196
196
|
const overrideLocale = getOverrideLocale();
|
|
197
197
|
localizationStore.selectedLocale = overrideLocale || locale || 'en';
|
|
@@ -206,10 +206,9 @@ const initLocalizationStore = async () => {
|
|
|
206
206
|
if (!localizationStore.selectedCountryCode &&
|
|
207
207
|
devSites.some(site => window.location.origin.includes(site))) {
|
|
208
208
|
// update selected country code in store
|
|
209
|
-
|
|
209
|
+
localizationStoreUpdateSelectedCountryCode('US');
|
|
210
210
|
}
|
|
211
211
|
localizationStore.localizationLoaded = true;
|
|
212
|
-
void getCustomMessages();
|
|
213
212
|
};
|
|
214
213
|
const updateCheckoutSessionLanguage = async () => {
|
|
215
214
|
if (!cartStore.checkoutSessionId) {
|
|
@@ -180,6 +180,7 @@ export const handleFetch = async (path, _opts) => {
|
|
|
180
180
|
method });
|
|
181
181
|
// This is for testing fallback API, set fallback API type to start with
|
|
182
182
|
const useFallbackApi = new URLSearchParams(window.location.search).get('useFallbackApi');
|
|
183
|
+
log(path, 'info');
|
|
183
184
|
return handleRequestWithFallback({
|
|
184
185
|
basePathType: useFallbackApi || MAIN_BASE_API_TYPE,
|
|
185
186
|
options,
|
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
const startTime = performance.now();
|
|
2
|
+
export const allLogs = [];
|
|
3
|
+
const prepInfo = (info) => {
|
|
4
|
+
if (typeof info === 'string') {
|
|
5
|
+
return info;
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
const infoToJson = JSON.stringify(info);
|
|
9
|
+
return infoToJson;
|
|
10
|
+
}
|
|
11
|
+
catch (e1) {
|
|
12
|
+
if (info && typeof info.toString === 'function') {
|
|
13
|
+
const infoToString = info.toString();
|
|
14
|
+
return infoToString;
|
|
15
|
+
}
|
|
16
|
+
return 'Unable to stringify info';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const log = (message, type, ..._additionalInfo) => {
|
|
2
20
|
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];
|
|
26
|
+
const preppedInfo = additionalInfo.map(prepInfo).join(' ');
|
|
27
|
+
allLogs.push([type, message, preppedInfo].filter(Boolean).join(' '));
|
|
3
28
|
const isDebug = !!((_a = window.Zonos) === null || _a === void 0 ? void 0 : _a.debug) ||
|
|
4
29
|
!!window.location.search.match(/\?.*(&*)zonosDebug=1/);
|
|
5
30
|
// if debug is false, do not log
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { fallbackApiList, getNextFallbackApiType, MAIN_BASE_API, } from "../getNextFallbackApi";
|
|
2
|
+
import { log } from "./log";
|
|
2
3
|
/**
|
|
3
4
|
* This is the time in milliseconds after release time that we will start sending error logs to the new API
|
|
4
5
|
* @default 1 hour
|
|
5
6
|
*/
|
|
6
7
|
const postReleaseReportingDuration = 1 * 3600 * 1000; // 1 hour
|
|
7
8
|
export const sendErrorLog = async ({ endpoint, errors, metadata, shouldPostReleaseErrorReporting, }) => {
|
|
9
|
+
log('sendErrorLog', 'warn', endpoint, metadata, errors);
|
|
8
10
|
if (shouldPostReleaseErrorReporting) {
|
|
9
11
|
// We only want to report errors that happened if current time is less than 2 hours after release time
|
|
10
12
|
const releaseTime = Number(window.Zonos.releaseDate);
|
|
@@ -24,3 +24,19 @@ export const extractZonosQaUrl = (url) => {
|
|
|
24
24
|
}
|
|
25
25
|
return zonosQaUrl;
|
|
26
26
|
};
|
|
27
|
+
export const extractZonosQaUrlApi = (url) => {
|
|
28
|
+
if (!url) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
// get params from url
|
|
32
|
+
const param = new URL(url).searchParams;
|
|
33
|
+
const zonosQaUrl = param.get('zonosQaUrlApi');
|
|
34
|
+
if (!zonosQaUrl) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const hasInvalidCharacters = /[^a-zA-Z0-9-_]+/.test(zonosQaUrl);
|
|
38
|
+
if (!!hasInvalidCharacters) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return zonosQaUrl;
|
|
42
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from "../components/utils/logging/log";
|
|
2
|
-
import { extractZonosQaUrl } from "./_extractZonosQaUrl";
|
|
2
|
+
import { extractZonosQaUrl, extractZonosQaUrlApi, } from "./_extractZonosQaUrl";
|
|
3
3
|
/**
|
|
4
4
|
* Get the Zonos QA URL and return it. Will remove `zonosQaUrl` from the url query if it doesn't exists.
|
|
5
5
|
*/
|
|
@@ -36,7 +36,7 @@ export const getZonosQaUrl = () => {
|
|
|
36
36
|
}
|
|
37
37
|
const suffixDomain = 'preview.js.zonos.com';
|
|
38
38
|
const fullUrl = `https://${qaUrl}.${suffixDomain}`;
|
|
39
|
-
log(`[ZONOS-WARNING] using '${fullUrl}' for loading script`, 'warn');
|
|
39
|
+
log(`[ZONOS-WARNING] using '${fullUrl}' for loading elements script`, 'warn');
|
|
40
40
|
// request to the url and check if the request has an error
|
|
41
41
|
void fetch(fullUrl)
|
|
42
42
|
.then(() => {
|
|
@@ -65,7 +65,9 @@ export const getZonosQaUrl = () => {
|
|
|
65
65
|
* Get the Zonos QA URL and return it. Will remove `zonosQaUrl` from the url query if it doesn't exists.
|
|
66
66
|
*/
|
|
67
67
|
export const getZonosQaUrlApi = () => {
|
|
68
|
-
const
|
|
68
|
+
const _qaUrlApi = extractZonosQaUrlApi(window.location.href);
|
|
69
|
+
const _qaUrl = extractZonosQaUrl(window.location.href);
|
|
70
|
+
const qaUrl = _qaUrlApi || _qaUrl;
|
|
69
71
|
// when local demo app is running, it needs to use the local dev script unless the qaUrl is set
|
|
70
72
|
if (!qaUrl &&
|
|
71
73
|
['dev.demo.elements.zonos.com'].includes(window.location.hostname)) {
|
|
@@ -78,5 +80,12 @@ export const getZonosQaUrlApi = () => {
|
|
|
78
80
|
if (qaUrl === 'dev-elements') {
|
|
79
81
|
return 'https://dev.demo.elements.zonos.com';
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
// Only do this if `zonosQaUrlApi` is set, don't use zonosQaUrl
|
|
84
|
+
if (!_qaUrlApi) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const suffixDomain = 'route.js.zonos.com';
|
|
88
|
+
const fullUrl = `https://${_qaUrlApi}.${suffixDomain}`;
|
|
89
|
+
log(`[ZONOS-WARNING] using '${fullUrl}' for serverless API`, 'warn');
|
|
90
|
+
return fullUrl;
|
|
82
91
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as handleFetch, l as log, a as logError } from './handleFetch-
|
|
1
|
+
import { h as handleFetch, l as log, a as logError } from './handleFetch-0133265e.js';
|
|
2
2
|
|
|
3
3
|
const getTempCartById = async (cartId) => {
|
|
4
4
|
const { errors, json } = await handleFetch('/api/zonos-elements/get-temp-cart', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as createStore, z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
2
|
-
import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-
|
|
2
|
+
import { h as handleFetch, a as logError, l as log, f as fallbackApiList, j as jsonParse } from './handleFetch-0133265e.js';
|
|
3
3
|
import { i as isDarkColor } from './isDarkColor-b3afa948.js';
|
|
4
4
|
import { g as getBorderRadius } from './getBorderRadius-cff1e39b.js';
|
|
5
5
|
|
|
@@ -8033,7 +8033,7 @@ const initLocalizationStore = async () => {
|
|
|
8033
8033
|
initHelloCountryList(allCountries || {});
|
|
8034
8034
|
const { country, locale } = localization;
|
|
8035
8035
|
// update selected country code in store
|
|
8036
|
-
|
|
8036
|
+
localizationStoreUpdateSelectedCountryCode(country);
|
|
8037
8037
|
// use locale from params if it exists, otherwise use locale from localization
|
|
8038
8038
|
const overrideLocale = getOverrideLocale();
|
|
8039
8039
|
localizationStore.selectedLocale = overrideLocale || locale || 'en';
|
|
@@ -8048,10 +8048,9 @@ const initLocalizationStore = async () => {
|
|
|
8048
8048
|
if (!localizationStore.selectedCountryCode &&
|
|
8049
8049
|
devSites.some(site => window.location.origin.includes(site))) {
|
|
8050
8050
|
// update selected country code in store
|
|
8051
|
-
|
|
8051
|
+
localizationStoreUpdateSelectedCountryCode('US');
|
|
8052
8052
|
}
|
|
8053
8053
|
localizationStore.localizationLoaded = true;
|
|
8054
|
-
void getCustomMessages();
|
|
8055
8054
|
};
|
|
8056
8055
|
const updateCheckoutSessionLanguage = async () => {
|
|
8057
8056
|
if (!cartStore.checkoutSessionId) {
|
|
@@ -8845,7 +8844,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
8845
8844
|
});
|
|
8846
8845
|
stripeStore.isFetchingSession = false;
|
|
8847
8846
|
if (errors.length || !json) {
|
|
8848
|
-
logError('Error
|
|
8847
|
+
logError('Error occurred when creating checkout session', JSON.stringify(errors, null, 2));
|
|
8849
8848
|
return false;
|
|
8850
8849
|
}
|
|
8851
8850
|
const result = json.checkoutSessionCreate;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as cartStore, l as localizationStore } from './cart-
|
|
1
|
+
import { d as cartStore, l as localizationStore } from './cart-9bf6dece.js';
|
|
2
2
|
import { z as zonosStore } from './zonosStore-0dc7a947.js';
|
|
3
|
-
import { h as handleFetch } from './handleFetch-
|
|
3
|
+
import { h as handleFetch } from './handleFetch-0133265e.js';
|
|
4
4
|
|
|
5
5
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
6
6
|
var _a, _b;
|