@zonos/elements 1.3.167 → 1.3.169
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-626b48e5.js → CheckoutConfig-f5e68e14.js} +1 -1
- package/dist/cjs/{cart-dbeee1e9.js → cart-36799bbe.js} +4 -4
- package/dist/cjs/{getBorderRadius-d184b623.js → getBorderRadius-94ef609c.js} +1 -1
- package/dist/cjs/{handleFetch-3673a0c2.js → handleFetch-7b7f9f7c.js} +79 -1
- package/dist/cjs/index.cjs.js +46 -9
- package/dist/cjs/{isDarkColor-08d92ed7.js → isDarkColor-ec4a4e7d.js} +1 -1
- package/dist/cjs/{paypal-38ab2263.js → paypal-3eae38bd.js} +14 -6
- package/dist/cjs/zonos-address_7.cjs.entry.js +5 -5
- package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +3 -3
- package/dist/cjs/zonos-card.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +6 -6
- package/dist/cjs/zonos-checkout.cjs.entry.js +32 -42
- package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
- package/dist/cjs/zonos-controller.cjs.entry.js +8 -6
- package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +5 -5
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +6 -6
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +5 -5
- package/dist/cjs/zonos-hello.cjs.entry.js +5 -5
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +5 -5
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +3 -3
- package/dist/cjs/zonos-text.cjs.entry.js +1 -1
- package/dist/cjs/zonos-toggle.cjs.entry.js +1 -1
- package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
- package/dist/cjs/{zonosStore-7975e4b6.js → zonosStore-3812b318.js} +3 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +8 -0
- package/dist/collection/components/main/zonos-controller.js +3 -1
- package/dist/collection/components/store/checkout/paypal.js +8 -0
- package/dist/collection/components/store/zonosStore.js +3 -0
- package/dist/collection/components/utils/api/paypalCreateOrder.js +2 -2
- package/dist/collection/components/utils/handleFetch.js +14 -1
- package/dist/collection/components/utils/logging/getAdditionalLogMetadata.js +19 -0
- package/dist/collection/components/utils/logging/prepLoadTimeApiLog.js +29 -0
- package/dist/collection/components/utils/logging/sendBulkLoadTimeApiLog.js +30 -0
- package/dist/collection/components/utils/logging/sendLoadCheckoutFacadeLog.js +1 -1
- package/dist/collection/components/utils/logging/sendLoadNativeCheckoutLog.js +23 -0
- package/dist/collection/components/utils/logging/sendLoadScriptLog.js +1 -17
- package/dist/collection/scripts/_zonosBase.js +9 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +3 -0
- package/dist/collection/types/generated/graphql.internal.types.js +35 -0
- package/dist/esm/{CheckoutConfig-646aae20.js → CheckoutConfig-2994efd9.js} +1 -1
- package/dist/esm/{cart-f2f5f13f.js → cart-b2e57589.js} +4 -4
- package/dist/esm/{getBorderRadius-740610fb.js → getBorderRadius-ada3ccad.js} +1 -1
- package/dist/esm/{handleFetch-b4633675.js → handleFetch-8d72c8cd.js} +79 -2
- package/dist/esm/index.js +47 -10
- package/dist/esm/{isDarkColor-2f59d721.js → isDarkColor-446fccb7.js} +1 -1
- package/dist/esm/{paypal-7d253663.js → paypal-38da5d52.js} +14 -6
- package/dist/esm/zonos-address_7.entry.js +5 -5
- package/dist/esm/zonos-badge.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card.entry.js +2 -2
- package/dist/esm/zonos-cart-items_13.entry.js +6 -6
- package/dist/esm/zonos-checkout.entry.js +31 -41
- package/dist/esm/zonos-collapse.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +8 -6
- package/dist/esm/zonos-country-flag.entry.js +5 -5
- package/dist/esm/zonos-country-select_4.entry.js +5 -5
- package/dist/esm/zonos-empty-state-payment_4.entry.js +6 -6
- package/dist/esm/zonos-hello-dialog.entry.js +5 -5
- package/dist/esm/zonos-hello.entry.js +5 -5
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +5 -5
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-stripe-input.entry.js +3 -3
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-toggle.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-71d7e02f.js → zonosStore-d3c5a0a5.js} +3 -0
- package/dist/esm-es5/{CheckoutConfig-646aae20.js → CheckoutConfig-2994efd9.js} +1 -1
- package/dist/esm-es5/{cart-f2f5f13f.js → cart-b2e57589.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-740610fb.js → getBorderRadius-ada3ccad.js} +1 -1
- package/dist/esm-es5/handleFetch-8d72c8cd.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-2f59d721.js → isDarkColor-446fccb7.js} +1 -1
- package/dist/esm-es5/paypal-38da5d52.js +17 -0
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.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-empty-state-payment_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-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-71d7e02f.js → zonosStore-d3c5a0a5.js} +1 -1
- package/dist/scripts/index.d.ts +24 -0
- 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/store/checkout/paypal.d.ts +2 -0
- package/dist/types/components/utils/api/paypalCreateOrder.d.ts +1 -1
- package/dist/types/components/utils/logging/getAdditionalLogMetadata.d.ts +15 -0
- package/dist/types/components/utils/logging/prepLoadTimeApiLog.d.ts +23 -0
- package/dist/types/components/utils/logging/sendBulkLoadTimeApiLog.d.ts +1 -0
- package/dist/types/components/utils/logging/sendLoadNativeCheckoutLog.d.ts +3 -0
- package/dist/types/components/utils/logging/sendLoadScriptLog.d.ts +0 -12
- package/dist/types/scripts/_getNextFallbackUrl.d.ts +1 -1
- package/dist/types/scripts/_zonosBase.d.ts +5 -0
- package/dist/types/types/LogLoadScript.d.ts +1 -0
- package/dist/types/types/checkout/CheckoutConfig.d.ts +4 -0
- package/dist/types/types/checkout/api/Paypal.d.ts +3 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +11 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +21 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +51 -5
- package/dist/types/types/generated/graphql.internal.types.ts +68 -5
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-68584880.entry.js → p-00ad3c73.entry.js} +1 -1
- package/dist/zonos-elements/{p-25ad92dc.system.entry.js → p-0bfca3a9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-82a0fcb7.system.entry.js → p-0def1397.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-09e4f412.system.entry.js → p-0e63259c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-466de014.system.entry.js → p-1a20922f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-16413274.system.entry.js → p-1edbfb1f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c7219337.system.entry.js → p-236f32c8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-dd999b44.js → p-30fdcbee.js} +1 -1
- package/dist/zonos-elements/{p-acabfba5.entry.js → p-3731e7f5.entry.js} +1 -1
- package/dist/zonos-elements/{p-6549915d.entry.js → p-3eac4b10.entry.js} +1 -1
- package/dist/zonos-elements/{p-7c028742.entry.js → p-41dfc828.entry.js} +1 -1
- package/dist/zonos-elements/{p-163425d9.entry.js → p-461ca324.entry.js} +1 -1
- package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
- package/dist/zonos-elements/{p-c9035262.js → p-47f79a6d.js} +1 -1
- package/dist/zonos-elements/p-48173901.js +17 -0
- package/dist/zonos-elements/{p-a9a95fae.system.js → p-5187ba8f.system.js} +1 -1
- package/dist/zonos-elements/{p-669a7b5d.system.entry.js → p-53cb8867.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8654b135.system.entry.js → p-56758218.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3edccfff.system.entry.js → p-56a8b1f6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0febd074.system.entry.js → p-58f660d4.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5ac76fa9.system.entry.js +1 -0
- package/dist/zonos-elements/p-677e7b4b.entry.js +1 -0
- package/dist/zonos-elements/{p-b6fdbbf4.system.js → p-69255ed2.system.js} +1 -1
- package/dist/zonos-elements/{p-57281d6c.system.entry.js → p-6c0c8722.system.entry.js} +1 -1
- package/dist/zonos-elements/p-71539c8a.js +1 -0
- package/dist/zonos-elements/{p-ed74742d.system.entry.js → p-739014f8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-073bc210.entry.js → p-8048932d.entry.js} +1 -1
- package/dist/zonos-elements/{p-77581c1c.entry.js → p-829f6a40.entry.js} +1 -1
- package/dist/zonos-elements/{p-7011d8e2.entry.js → p-864c7c7d.entry.js} +1 -1
- package/dist/zonos-elements/{p-73e9a8f5.entry.js → p-90633d63.entry.js} +1 -1
- package/dist/zonos-elements/p-9261869c.system.js +1 -0
- package/dist/zonos-elements/{p-672707ce.js → p-98aa88b1.js} +1 -1
- package/dist/zonos-elements/{p-e4a52de7.entry.js → p-9f9e4f74.entry.js} +1 -1
- package/dist/zonos-elements/{p-98e9c9cf.js → p-a1cfbd0a.js} +1 -1
- package/dist/zonos-elements/{p-3bff5a9f.system.js → p-a3888f1d.system.js} +1 -1
- package/dist/zonos-elements/{p-405f70b1.entry.js → p-b0c39400.entry.js} +1 -1
- package/dist/zonos-elements/{p-72319b4d.entry.js → p-b5b9aa6c.entry.js} +1 -1
- package/dist/zonos-elements/{p-20ca31fd.system.entry.js → p-be9e1818.system.entry.js} +1 -1
- package/dist/zonos-elements/p-bf113a46.system.js +17 -0
- package/dist/zonos-elements/{p-0150bb1e.entry.js → p-bfa028a2.entry.js} +1 -1
- package/dist/zonos-elements/{p-85235fa0.system.entry.js → p-c4fa8524.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-73a3e5bb.system.js → p-c5c2976f.system.js} +1 -1
- package/dist/zonos-elements/{p-41688151.system.entry.js → p-c82f488b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ab699c84.entry.js → p-cb52cfdf.entry.js} +1 -1
- package/dist/zonos-elements/{p-75a8e67d.entry.js → p-cc6d9f7d.entry.js} +1 -1
- package/dist/zonos-elements/{p-82166888.system.entry.js → p-ce853f8f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-15971b78.entry.js → p-cedf08f0.entry.js} +1 -1
- package/dist/zonos-elements/{p-e174b37b.system.entry.js → p-d0944cc8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-eb5835d1.system.entry.js → p-d49c6a3e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c556ff98.js → p-dd0259f4.js} +1 -1
- package/dist/zonos-elements/{p-20802055.entry.js → p-e09cea9c.entry.js} +1 -1
- package/dist/zonos-elements/p-e4f8114a.system.js +1 -0
- package/dist/zonos-elements/{p-c371558a.system.entry.js → p-e99e75dd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-83645bb4.entry.js → p-eb294265.entry.js} +1 -1
- package/dist/zonos-elements/p-ef4bad3a.system.js +1 -0
- package/dist/zonos-elements/{p-8addb07b.system.entry.js → p-f378b4d3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-718c9603.system.entry.js → p-fd352222.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fa15b9b5.entry.js → p-fe2c27c4.entry.js} +1 -1
- package/dist/zonos-elements/{p-607a6750.entry.js → p-febb90e0.entry.js} +1 -1
- package/dist/zonos-elements/{p-93499c9b.entry.js → p-ff1c6d9a.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/handleFetch-b4633675.js +0 -1
- package/dist/esm-es5/paypal-7d253663.js +0 -17
- package/dist/zonos-elements/p-18e5b741.system.js +0 -1
- package/dist/zonos-elements/p-4508c22b.entry.js +0 -1
- package/dist/zonos-elements/p-4a0d1e3c.system.js +0 -17
- package/dist/zonos-elements/p-6658cc02.system.js +0 -1
- package/dist/zonos-elements/p-d0adc1b5.system.entry.js +0 -1
- package/dist/zonos-elements/p-d9b0094e.system.js +0 -1
- package/dist/zonos-elements/p-e97f9606.js +0 -17
- package/dist/zonos-elements/p-f0c8150e.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const zonosStore = require('./zonosStore-
|
|
4
|
-
const handleFetch = require('./handleFetch-
|
|
5
|
-
const isDarkColor = require('./isDarkColor-
|
|
6
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
3
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
4
|
+
const handleFetch = require('./handleFetch-7b7f9f7c.js');
|
|
5
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
6
|
+
const getBorderRadius = require('./getBorderRadius-94ef609c.js');
|
|
7
7
|
|
|
8
8
|
const stringsArabic = {
|
|
9
9
|
' (Duties due at door)': {
|
|
@@ -126,6 +126,71 @@ const jsonParse = (_data) => {
|
|
|
126
126
|
return null;
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
const getNavigatorConnection = () => {
|
|
130
|
+
const connection = 'connection' in window.navigator
|
|
131
|
+
? // connection is not yet supported in all browsers
|
|
132
|
+
window.navigator.connection
|
|
133
|
+
: null;
|
|
134
|
+
const mozConnection = 'mozConnection' in window.navigator
|
|
135
|
+
? // mozConnection is not yet supported in all browsers
|
|
136
|
+
window.navigator.mozConnection
|
|
137
|
+
: null;
|
|
138
|
+
const webkitConnection = 'webkitConnection' in window.navigator
|
|
139
|
+
? // webkitConnection is not yet supported in all browsers
|
|
140
|
+
window.navigator.webkitConnection
|
|
141
|
+
: null;
|
|
142
|
+
const baseConnection = connection || mozConnection || webkitConnection;
|
|
143
|
+
return baseConnection;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const getAdditionalLogMetadata = () => {
|
|
147
|
+
const userAgentData = 'userAgentData' in window.navigator
|
|
148
|
+
? // userAgentData is not yet supported in all browsers
|
|
149
|
+
window.navigator.userAgentData
|
|
150
|
+
: null;
|
|
151
|
+
const baseConnection = getNavigatorConnection();
|
|
152
|
+
return {
|
|
153
|
+
connectionDownlink: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.downlink,
|
|
154
|
+
connectionEffectiveType: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.effectiveType,
|
|
155
|
+
connectionRtt: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.rtt,
|
|
156
|
+
connectionSaveData: baseConnection === null || baseConnection === void 0 ? void 0 : baseConnection.saveData,
|
|
157
|
+
screenHeight: window.screen.height,
|
|
158
|
+
screenWidth: window.screen.width,
|
|
159
|
+
userAgent: userAgentData && userAgentData.brands.length > 0
|
|
160
|
+
? userAgentData
|
|
161
|
+
: window.navigator.userAgent,
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const blackListPaths = [
|
|
166
|
+
'/api/zonos-elements/log-script-load',
|
|
167
|
+
'/api/zonos-elements/log-bulk-load',
|
|
168
|
+
];
|
|
169
|
+
/**
|
|
170
|
+
* Prepares the load time api log for the given API call to send to the server later
|
|
171
|
+
* This function is used to prepare the load time api log for the given API call.
|
|
172
|
+
* It adds the load time api log to the loadTimeApiInfoList.
|
|
173
|
+
*/
|
|
174
|
+
const prepLoadTimeApiLog = ({ apiPath, apiType, loadTimeInternal, loadTimeTotal, }) => {
|
|
175
|
+
if (blackListPaths.includes(apiPath)) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const apiPathWithoutParams = apiPath.split('?')[0] || apiPath;
|
|
179
|
+
const scriptLoadLogBody = {
|
|
180
|
+
cache: 'miss',
|
|
181
|
+
cdnLoadTime: loadTimeTotal - loadTimeInternal,
|
|
182
|
+
eventName: 'jsdelivr',
|
|
183
|
+
flag: 'LOG_LOAD_TIME_API',
|
|
184
|
+
href: apiPathWithoutParams,
|
|
185
|
+
loadTime: loadTimeInternal,
|
|
186
|
+
metadata: Object.assign(Object.assign({ apiType }, getAdditionalLogMetadata()), { loadTimeClientMiddleware: loadTimeTotal - loadTimeInternal, loadTimeInternal,
|
|
187
|
+
loadTimeTotal }),
|
|
188
|
+
scriptLoadUrl: apiType,
|
|
189
|
+
storeId: window.Zonos.storeId,
|
|
190
|
+
};
|
|
191
|
+
window.Zonos.loadTimeApiInfoList.push(scriptLoadLogBody);
|
|
192
|
+
};
|
|
193
|
+
|
|
129
194
|
/**
|
|
130
195
|
* This is the time in milliseconds after release time that we will start sending error logs to the new API
|
|
131
196
|
* @default 1 hour
|
|
@@ -323,11 +388,24 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
|
|
|
323
388
|
const basePathType = isBigcommerceEndpoint
|
|
324
389
|
? 'vercel'
|
|
325
390
|
: _basePathType;
|
|
391
|
+
const startTime = performance.now();
|
|
326
392
|
const _c = await handleRequest({
|
|
327
393
|
basePathType,
|
|
328
394
|
options,
|
|
329
395
|
path,
|
|
330
396
|
}), { errors, response } = _c, rest = __rest(_c, ["errors", "response"]);
|
|
397
|
+
const endTime = performance.now();
|
|
398
|
+
const duration = endTime - startTime;
|
|
399
|
+
// Send the load time api log
|
|
400
|
+
log(`${path} (${duration.toFixed(2)}ms)`, 'info');
|
|
401
|
+
// No need to send the load time api log for the log-script-load endpoint
|
|
402
|
+
const internalDuration = response === null || response === void 0 ? void 0 : response.headers.get('Zonos-Duration');
|
|
403
|
+
prepLoadTimeApiLog({
|
|
404
|
+
apiPath: path,
|
|
405
|
+
apiType: basePathType,
|
|
406
|
+
loadTimeInternal: internalDuration ? Number(internalDuration) : 0,
|
|
407
|
+
loadTimeTotal: duration,
|
|
408
|
+
});
|
|
331
409
|
const nextFallbackApiType = getNextFallbackApiType(basePathType);
|
|
332
410
|
const unknownError = errors.find(({ type }) => type === 'unknown');
|
|
333
411
|
const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
|
|
@@ -379,7 +457,6 @@ const handleFetch = async (path, _opts) => {
|
|
|
379
457
|
method });
|
|
380
458
|
// This is for testing fallback API, set fallback API type to start with
|
|
381
459
|
const useFallbackApi = new URLSearchParams(window.location.search).get('useFallbackApi');
|
|
382
|
-
log(path, 'info');
|
|
383
460
|
return handleRequestWithFallback({
|
|
384
461
|
basePathType: useFallbackApi || MAIN_BASE_API_TYPE,
|
|
385
462
|
options,
|
|
@@ -389,6 +466,7 @@ const handleFetch = async (path, _opts) => {
|
|
|
389
466
|
|
|
390
467
|
exports.allLogs = allLogs;
|
|
391
468
|
exports.fallbackApiList = fallbackApiList;
|
|
469
|
+
exports.getAdditionalLogMetadata = getAdditionalLogMetadata;
|
|
392
470
|
exports.getElapsedTime = getElapsedTime;
|
|
393
471
|
exports.getIsStagingMode = getIsStagingMode;
|
|
394
472
|
exports.getIsTestMode = getIsTestMode;
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -2,10 +2,39 @@
|
|
|
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-7b7f9f7c.js');
|
|
6
|
+
const CheckoutConfig = require('./CheckoutConfig-f5e68e14.js');
|
|
7
7
|
const TaxId = require('./TaxId-4632639d.js');
|
|
8
8
|
|
|
9
|
+
let numberOfFailures = 0;
|
|
10
|
+
const sendBulkLoadTimeApiLog = async () => {
|
|
11
|
+
// Don't send the log if there are no API calls to send
|
|
12
|
+
if (window.Zonos.loadTimeApiInfoList.length === 0) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
handleFetch.log('Sending bulk load time api log', 'info', {
|
|
16
|
+
loadTimeApiInfoList: window.Zonos.loadTimeApiInfoList,
|
|
17
|
+
});
|
|
18
|
+
// Clone the list so we can clear it after sending the log
|
|
19
|
+
const loadTimeApiInfoListArray = [...window.Zonos.loadTimeApiInfoList];
|
|
20
|
+
// Clear the list after sending the log successfully
|
|
21
|
+
window.Zonos.loadTimeApiInfoList.length = 0;
|
|
22
|
+
// Clear the list after sending the log successfully
|
|
23
|
+
const { errors } = await handleFetch.handleFetch('/api/zonos-elements/log-bulk-load', {
|
|
24
|
+
body: loadTimeApiInfoListArray,
|
|
25
|
+
method: 'POST',
|
|
26
|
+
});
|
|
27
|
+
if (errors.length) {
|
|
28
|
+
// If there are errors, add the logs back to the list so we can try again later
|
|
29
|
+
window.Zonos.loadTimeApiInfoList.push(...loadTimeApiInfoListArray);
|
|
30
|
+
numberOfFailures++;
|
|
31
|
+
if (numberOfFailures > 5 && window.Zonos.logIntervalId) {
|
|
32
|
+
// If there are more than 3 failures, stop the interval
|
|
33
|
+
clearInterval(window.Zonos.logIntervalId);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
9
38
|
/**
|
|
10
39
|
* Get the load version and url based on the loadScriptSrc and version
|
|
11
40
|
* @returns
|
|
@@ -129,7 +158,7 @@ const getZonosQaUrl = () => {
|
|
|
129
158
|
return null;
|
|
130
159
|
}
|
|
131
160
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
132
|
-
const cdnUrl = "https://v1.3.
|
|
161
|
+
const cdnUrl = "https://v1.3.169.js.zonos.com";
|
|
133
162
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
134
163
|
if (!qaUrl &&
|
|
135
164
|
(cdnUrl.includes('test.') ||
|
|
@@ -313,10 +342,10 @@ const zonosLoadUrl = (() => {
|
|
|
313
342
|
}
|
|
314
343
|
return null;
|
|
315
344
|
})();
|
|
316
|
-
const ZONOS_URL = "https://v1.3.
|
|
317
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
318
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
319
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
345
|
+
const ZONOS_URL = "https://v1.3.169.js.zonos.com";
|
|
346
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.169";
|
|
347
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.169";
|
|
348
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.169";
|
|
320
349
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
321
350
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
322
351
|
class Zonos {
|
|
@@ -330,7 +359,7 @@ Zonos.zonosConversionTest = typeof window !== 'undefined' &&
|
|
|
330
359
|
!!window.location.search.match(/\?.*(&*)zonosConversionTest/);
|
|
331
360
|
Zonos._paypalMockResponse = null;
|
|
332
361
|
Zonos.isBigCommerce = false;
|
|
333
|
-
Zonos.releaseDate = "
|
|
362
|
+
Zonos.releaseDate = "1741966456733";
|
|
334
363
|
Zonos.isLegacyCheckout = false;
|
|
335
364
|
Zonos.domain = typeof window !== 'undefined'
|
|
336
365
|
? // domain that embeds the iframe
|
|
@@ -346,12 +375,14 @@ Zonos.showBaseForeign = typeof window !== 'undefined' &&
|
|
|
346
375
|
Zonos.isNpm = true;
|
|
347
376
|
Zonos.zonosQaUrl = null;
|
|
348
377
|
Zonos.zonosQaUrlApi = null;
|
|
349
|
-
Zonos.version = `v${"1.3.
|
|
378
|
+
Zonos.version = `v${"1.3.169"}`;
|
|
350
379
|
Zonos.modeAlerted = false;
|
|
351
380
|
Zonos.cartData = null;
|
|
352
381
|
Zonos.paypal = null;
|
|
353
382
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
354
383
|
Zonos.zonosController = null;
|
|
384
|
+
Zonos.loadTimeApiInfoList = [];
|
|
385
|
+
Zonos.logIntervalId = null;
|
|
355
386
|
Zonos.init = async (params) => {
|
|
356
387
|
const { appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, } = params;
|
|
357
388
|
_a.cartId = getCartIdFromQueryParam();
|
|
@@ -444,6 +475,12 @@ Zonos.init = async (params) => {
|
|
|
444
475
|
},
|
|
445
476
|
});
|
|
446
477
|
_a.doneInit = true;
|
|
478
|
+
if (!_a.logIntervalId) {
|
|
479
|
+
// log the load time of all API calls every 2 seconds
|
|
480
|
+
_a.logIntervalId = setInterval(() => {
|
|
481
|
+
void sendBulkLoadTimeApiLog();
|
|
482
|
+
}, 2000);
|
|
483
|
+
}
|
|
447
484
|
};
|
|
448
485
|
Zonos.injectCustomScriptForHostedCheckout = () => {
|
|
449
486
|
const cartData = _a.cartData;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const zonosStore = require('./zonosStore-
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
6
|
-
const isDarkColor = require('./isDarkColor-
|
|
3
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
4
|
+
const cart = require('./cart-36799bbe.js');
|
|
5
|
+
const handleFetch = require('./handleFetch-7b7f9f7c.js');
|
|
6
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
7
7
|
|
|
8
8
|
/*!
|
|
9
9
|
* paypal-js v8.1.0 (2024-06-07T16:55:00.122Z)
|
|
@@ -216,9 +216,9 @@ const paypalCaptureOrder = async ({ checkoutSessionId, paypalMockResponse, }) =>
|
|
|
216
216
|
return { errors, json };
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
const paypalCreateOrder = async ({ checkoutSessionId, }) => {
|
|
219
|
+
const paypalCreateOrder = async ({ checkoutSessionId, intent, }) => {
|
|
220
220
|
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/create-paypal-order', {
|
|
221
|
-
body: { checkoutSessionId },
|
|
221
|
+
body: { checkoutSessionId, intent },
|
|
222
222
|
method: 'POST',
|
|
223
223
|
});
|
|
224
224
|
return { errors, json };
|
|
@@ -247,6 +247,7 @@ const submitGtag = (event) => {
|
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
const { reset: paypalStoreReset, state: paypalStore } = zonosStore.createStore(() => ({
|
|
250
|
+
intent: 'capture',
|
|
250
251
|
orderIdCreated: null,
|
|
251
252
|
paypalButtons: [],
|
|
252
253
|
paypalClientId: '',
|
|
@@ -254,8 +255,10 @@ const { reset: paypalStoreReset, state: paypalStore } = zonosStore.createStore((
|
|
|
254
255
|
}));
|
|
255
256
|
const paypalStoreCreaterOrder = async ({ checkoutSessionId, }) => {
|
|
256
257
|
var _a, _b;
|
|
258
|
+
const uppercaseIntent = paypalStore.intent.toUpperCase();
|
|
257
259
|
const { errors, json } = await paypalCreateOrder({
|
|
258
260
|
checkoutSessionId,
|
|
261
|
+
intent: uppercaseIntent,
|
|
259
262
|
});
|
|
260
263
|
const paypalOrderId = (_a = json === null || json === void 0 ? void 0 : json.paypalOrderCreate) === null || _a === void 0 ? void 0 : _a.paypalOrderId;
|
|
261
264
|
if (errors.length || !paypalOrderId) {
|
|
@@ -415,11 +418,16 @@ const paypalInitScript = async ({ currency }) => {
|
|
|
415
418
|
zonosStore.zonosStore.checkoutSettings.mode === 'LIVE'
|
|
416
419
|
? 'production'
|
|
417
420
|
: 'sandbox';
|
|
421
|
+
const hasAuthorizeSettingSet = zonosStore.zonosStore.checkoutSettings.captureDelay &&
|
|
422
|
+
zonosStore.zonosStore.checkoutSettings.captureDelay > 0;
|
|
423
|
+
paypalStore.intent = hasAuthorizeSettingSet ? 'authorize' : 'capture';
|
|
424
|
+
handleFetch.log('==== Paypal order intent', 'info', paypalStore.intent);
|
|
418
425
|
// send paypal publishable key out to load paypal
|
|
419
426
|
window.Zonos.paypal = await loadScript({
|
|
420
427
|
clientId: paypalClientId.token,
|
|
421
428
|
currency,
|
|
422
429
|
environment,
|
|
430
|
+
intent: paypalStore.intent,
|
|
423
431
|
});
|
|
424
432
|
handleFetch.log('==== Paypal script loaded');
|
|
425
433
|
};
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const cart = require('./cart-36799bbe.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
8
8
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
+
const handleFetch = require('./handleFetch-7b7f9f7c.js');
|
|
10
10
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
12
12
|
const RemoveIcon$1 = require('./RemoveIcon-081ac073.js');
|
|
13
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
14
|
-
const isDarkColor = require('./isDarkColor-
|
|
13
|
+
const getBorderRadius = require('./getBorderRadius-94ef609c.js');
|
|
14
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
15
15
|
|
|
16
16
|
const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h .zonos--company-name-input.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";
|
|
17
17
|
const ZonosAddressStyle0 = zonosAddressCss;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
|
|
9
9
|
const RemoveLineIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
|
|
9
9
|
const zonosBannerCss = ":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{border-radius:var(--zonos-elements-radius-10);padding:16px;background:var(--zonos-elements-gray-100)}:host .zonos--container{display:grid;-ms-flex-align:center;align-items:center;grid-template-areas:\"icon header\" \". content\";grid-template-columns:32px auto 0}:host .zonos--icon-wrapper{grid-area:icon;display:-ms-flexbox;display:flex;justify-self:start}:host .zonos--header-wrapper{margin-top:0px;grid-area:header}:host .zonos--content-wrapper{grid-area:content;margin-top:4px}:host(.info){background-color:var(--zonos-elements-blue-100);border:1px solid var(--zonos-elements-blue-200)}:host(.success){background-color:var(--zonos-elements-green-100);border:1px solid var(--zonos-elements-green-200)}:host(.error){background-color:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host(.warning){background-color:var(--zonos-elements-orange-100);border:1px solid var(--zonos-elements-orange-200)}";
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
8
|
+
const getBorderRadius = require('./getBorderRadius-94ef609c.js');
|
|
9
9
|
const isColorVariable = require('./isColorVariable-525dbfa7.js');
|
|
10
|
-
const isDarkColor = require('./isDarkColor-
|
|
10
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
11
11
|
const styles = require('./styles-d1e64fb9.js');
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
8
|
+
const getBorderRadius = require('./getBorderRadius-94ef609c.js');
|
|
9
9
|
|
|
10
10
|
const zonosCardCss = ":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 .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-6));padding:var(--spacing, 24px);text-align:left;background-color:var(--zonos--background-color);overflow:hidden}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";
|
|
11
11
|
const ZonosCardStyle0 = zonosCardCss;
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-36799bbe.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
9
|
-
const zonosStore = require('./zonosStore-
|
|
10
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const paypal = require('./paypal-3eae38bd.js');
|
|
9
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
10
|
+
const handleFetch = require('./handleFetch-7b7f9f7c.js');
|
|
11
11
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
12
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
12
|
+
const getBorderRadius = require('./getBorderRadius-94ef609c.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
|
-
const isDarkColor = require('./isDarkColor-
|
|
15
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
16
16
|
const isColorVariable = require('./isColorVariable-525dbfa7.js');
|
|
17
17
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
18
18
|
const TaxId = require('./TaxId-4632639d.js');
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
8
|
-
const zonosStore = require('./zonosStore-
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
6
|
+
const cart = require('./cart-36799bbe.js');
|
|
7
|
+
const paypal = require('./paypal-3eae38bd.js');
|
|
8
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
9
|
+
const handleFetch = require('./handleFetch-7b7f9f7c.js');
|
|
10
10
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
12
12
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
13
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
14
|
-
const isDarkColor = require('./isDarkColor-
|
|
13
|
+
const getBorderRadius = require('./getBorderRadius-94ef609c.js');
|
|
14
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
15
15
|
const styles = require('./styles-d1e64fb9.js');
|
|
16
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
16
|
+
const CheckoutConfig = require('./CheckoutConfig-f5e68e14.js');
|
|
17
17
|
const RemoveIcon = require('./RemoveIcon-081ac073.js');
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -184,40 +184,6 @@ 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
187
|
const sendLoadCheckoutFacadeLog = async () => {
|
|
222
188
|
const { elapsedTime } = handleFetch.getElapsedTime();
|
|
223
189
|
const scriptLoadLogBody = {
|
|
@@ -226,7 +192,7 @@ const sendLoadCheckoutFacadeLog = async () => {
|
|
|
226
192
|
flag: 'LOG_CHECKOUT_FACADE_LOAD',
|
|
227
193
|
href: window.location.href,
|
|
228
194
|
loadTime: elapsedTime,
|
|
229
|
-
metadata: Object.assign({ allLogs: handleFetch.allLogs }, getAdditionalLogMetadata()),
|
|
195
|
+
metadata: Object.assign({ allLogs: handleFetch.allLogs }, handleFetch.getAdditionalLogMetadata()),
|
|
230
196
|
scriptLoadUrl: 'checkoutFacade',
|
|
231
197
|
storeId: window.Zonos.storeId,
|
|
232
198
|
};
|
|
@@ -236,6 +202,23 @@ const sendLoadCheckoutFacadeLog = async () => {
|
|
|
236
202
|
});
|
|
237
203
|
};
|
|
238
204
|
|
|
205
|
+
const sendLoadNativeCheckoutLog = async ({ loadTime, }) => {
|
|
206
|
+
const scriptLoadLogBody = {
|
|
207
|
+
cache: 'miss',
|
|
208
|
+
eventName: 'jsdelivr',
|
|
209
|
+
flag: 'LOG_NATIVE_CHECKOUT_LOAD',
|
|
210
|
+
href: window.location.href,
|
|
211
|
+
loadTime,
|
|
212
|
+
metadata: Object.assign({ allLogs: handleFetch.allLogs }, handleFetch.getAdditionalLogMetadata()),
|
|
213
|
+
scriptLoadUrl: 'nativeCheckout',
|
|
214
|
+
storeId: window.Zonos.storeId,
|
|
215
|
+
};
|
|
216
|
+
void handleFetch.handleFetch('/api/zonos-elements/log-script-load', {
|
|
217
|
+
body: scriptLoadLogBody,
|
|
218
|
+
method: 'POST',
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
239
222
|
const MessageIcon = `<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="https://www.w3.org/2000/svg">
|
|
240
223
|
<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"/>
|
|
241
224
|
</svg>
|
|
@@ -633,6 +616,8 @@ const ZonosCheckout = class {
|
|
|
633
616
|
});
|
|
634
617
|
button.addEventListener('click', async (e) => {
|
|
635
618
|
var _a;
|
|
619
|
+
// Start tracking load time
|
|
620
|
+
const startTime = performance.now();
|
|
636
621
|
// Allow no country set for legacy facades. Otherwise enforce it being a shippable country and not disabled.
|
|
637
622
|
if (!window.Zonos.isLegacyCheckout &&
|
|
638
623
|
(!isShippableCountry() || isDisabledCountry())) {
|
|
@@ -681,6 +666,11 @@ const ZonosCheckout = class {
|
|
|
681
666
|
if (window.Zonos.isLegacyCheckout) {
|
|
682
667
|
void sendLoadCheckoutFacadeLog();
|
|
683
668
|
}
|
|
669
|
+
else {
|
|
670
|
+
const endTime = performance.now();
|
|
671
|
+
const loadTime = endTime - startTime;
|
|
672
|
+
void sendLoadNativeCheckoutLog({ loadTime });
|
|
673
|
+
}
|
|
684
674
|
}
|
|
685
675
|
catch (err) {
|
|
686
676
|
// stop loading
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
7
7
|
|
|
8
8
|
const zonosCollapseCss = ":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{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;overflow:hidden}:host div{position:relative}:host iframe{width:0;height:100%;position:absolute;top:0;border:0}";
|
|
9
9
|
const ZonosCollapseStyle0 = zonosCollapseCss;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const zonosStore = require('./zonosStore-
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
-
require('./isDarkColor-
|
|
10
|
-
require('./getBorderRadius-
|
|
6
|
+
const cart = require('./cart-36799bbe.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
8
|
+
const handleFetch = require('./handleFetch-7b7f9f7c.js');
|
|
9
|
+
require('./isDarkColor-ec4a4e7d.js');
|
|
10
|
+
require('./getBorderRadius-94ef609c.js');
|
|
11
11
|
|
|
12
12
|
const getZonosSettings = async () => {
|
|
13
13
|
const { errors, json, zonosMode } = await handleFetch.handleFetch('/api/zonos-elements/zonos-settings');
|
|
@@ -300,6 +300,8 @@ const ZonosController = class {
|
|
|
300
300
|
? Object.assign(Object.assign({}, this.config.checkoutSettings), {
|
|
301
301
|
// Don't allow to override settlement currencies setting. This setting is only configured by Zonos
|
|
302
302
|
allowedSettlementCurrencies: undefined,
|
|
303
|
+
// Don't allow to override capture delay setting. This setting is only configured by Zonos
|
|
304
|
+
captureDelay: undefined,
|
|
303
305
|
// Don't allow to override subscription status
|
|
304
306
|
subscriptionStatus: undefined,
|
|
305
307
|
// Set success redirect url to store url if it's legacy checkout.
|
|
@@ -400,7 +402,7 @@ const ZonosController = class {
|
|
|
400
402
|
zonosStore.zonosStore.organizationName = organizationName;
|
|
401
403
|
}
|
|
402
404
|
render() {
|
|
403
|
-
return index.h(index.Host, { key: '
|
|
405
|
+
return index.h(index.Host, { key: 'eed6d0d8b034a43bb4bccf5937b8eccc5d5744c9', class: "zonos--elements" });
|
|
404
406
|
}
|
|
405
407
|
};
|
|
406
408
|
ZonosController.style = ZonosControllerStyle0;
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const cart = require('./cart-36799bbe.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
require('./handleFetch-
|
|
10
|
-
require('./isDarkColor-
|
|
11
|
-
require('./getBorderRadius-
|
|
9
|
+
require('./handleFetch-7b7f9f7c.js');
|
|
10
|
+
require('./isDarkColor-ec4a4e7d.js');
|
|
11
|
+
require('./getBorderRadius-94ef609c.js');
|
|
12
12
|
|
|
13
13
|
const zonosCountryFlagCss = ":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-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";
|
|
14
14
|
const ZonosCountryFlagStyle0 = zonosCountryFlagCss;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-2f90486e.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const cart = require('./cart-36799bbe.js');
|
|
7
|
+
const zonosStore = require('./zonosStore-3812b318.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
|
-
const isDarkColor = require('./isDarkColor-
|
|
9
|
+
const isDarkColor = require('./isDarkColor-ec4a4e7d.js');
|
|
10
10
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
11
|
-
require('./handleFetch-
|
|
12
|
-
require('./getBorderRadius-
|
|
11
|
+
require('./handleFetch-7b7f9f7c.js');
|
|
12
|
+
require('./getBorderRadius-94ef609c.js');
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Fuse.js v7.0.0 - Lightweight fuzzy-search (http://fusejs.io)
|