@zonos/elements 1.3.121 → 1.3.123
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-222be92b.js → CheckoutConfig-00c7333a.js} +1 -1
- package/dist/cjs/{cart-b2ba04a6.js → cart-d2676914.js} +38 -16
- package/dist/cjs/{handleFetch-bd39d5cc.js → handleFetch-83c97d08.js} +1 -1
- package/dist/cjs/index.cjs.js +9 -9
- package/dist/cjs/{paypal-1209340d.js → paypal-617669c3.js} +2 -2
- package/dist/cjs/zonos-address_7.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +3 -3
- package/dist/cjs/zonos-checkout.cjs.entry.js +5 -4
- 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/__tests__/build-utils/urlCheckOne.js +7 -15
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +2 -1
- package/dist/collection/components/store/checkout/stripe.js +37 -15
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +37 -4
- package/dist/collection/utils/formattedUrl.js +2 -1
- package/dist/esm/{CheckoutConfig-f3f1d468.js → CheckoutConfig-5cde3ee4.js} +1 -1
- package/dist/esm/{cart-c2a7dbf4.js → cart-5346e4d9.js} +38 -17
- package/dist/esm/{handleFetch-752697c2.js → handleFetch-7424d200.js} +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/{paypal-47ce80b4.js → paypal-db99e15a.js} +2 -2
- package/dist/esm/zonos-address_7.entry.js +2 -2
- package/dist/esm/zonos-cart-items_13.entry.js +3 -3
- package/dist/esm/zonos-checkout.entry.js +5 -4
- 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-f3f1d468.js → CheckoutConfig-5cde3ee4.js} +1 -1
- package/dist/esm-es5/cart-5346e4d9.js +1 -0
- package/dist/esm-es5/handleFetch-7424d200.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-47ce80b4.js → paypal-db99e15a.js} +1 -1
- package/dist/esm-es5/zonos-address_7.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-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.d.ts +2 -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/__tests__/build-utils/urlCheckOne.d.ts +1 -3
- package/dist/types/components/store/checkout/cart.d.ts +1 -0
- package/dist/types/components/store/checkout/stripe.d.ts +2 -1
- package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +1 -1
- package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +2 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +47 -7
- package/dist/types/types/generated/graphql.internal.types.ts +60 -8
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-02495901.entry.js → p-06636f62.entry.js} +1 -1
- package/dist/zonos-elements/{p-76251f26.system.entry.js → p-20411dc5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-3a3dd0a7.entry.js +1 -0
- package/dist/zonos-elements/p-3ef38f02.system.js +1 -0
- package/dist/zonos-elements/{p-2251fc7e.entry.js → p-4f5da154.entry.js} +1 -1
- package/dist/zonos-elements/{p-d4ae2bd4.system.js → p-5fe1e3f6.system.js} +2 -2
- package/dist/zonos-elements/{p-34fb869f.js → p-62384488.js} +1 -1
- package/dist/zonos-elements/{p-9af218f8.entry.js → p-6efffc06.entry.js} +1 -1
- package/dist/zonos-elements/p-81055154.system.js +1 -0
- package/dist/zonos-elements/p-8231711f.js +1 -0
- package/dist/zonos-elements/{p-0af2a53c.entry.js → p-860716a1.entry.js} +1 -1
- package/dist/zonos-elements/{p-b8e00fdf.system.js → p-8c7715aa.system.js} +1 -1
- package/dist/zonos-elements/{p-c0fc4490.js → p-8e317f73.js} +1 -1
- package/dist/zonos-elements/{p-f4b06db0.system.entry.js → p-8f7935f6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b1b7ac58.system.entry.js → p-97334e5a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d8e4b363.entry.js → p-9afea72c.entry.js} +1 -1
- package/dist/zonos-elements/{p-8a64b0c4.system.entry.js → p-9ea5037d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3a70faa7.system.entry.js → p-b00508d3.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-81dbd74c.entry.js → p-b3b1c105.entry.js} +1 -1
- package/dist/zonos-elements/p-b98e54b2.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9b5f28ba.system.js → p-bc2efe24.system.js} +1 -1
- package/dist/zonos-elements/{p-b1373482.system.entry.js → p-c504e50e.system.entry.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-addf0048.entry.js → p-c97b9a45.entry.js} +1 -1
- package/dist/zonos-elements/{p-9143b174.entry.js → p-ccfd1d50.entry.js} +1 -1
- package/dist/zonos-elements/{p-3f464965.entry.js → p-cfaac5aa.entry.js} +1 -1
- package/dist/zonos-elements/{p-14b0dc71.system.entry.js → p-d1f1f84d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d5bd3c3a.system.entry.js → p-d5cf05b7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-63e67e78.system.entry.js → p-eb94b8c5.system.entry.js} +1 -1
- package/dist/zonos-elements/p-f3cdaa23.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-c2a7dbf4.js +0 -1
- package/dist/esm-es5/handleFetch-752697c2.js +0 -1
- package/dist/zonos-elements/p-1cdec61a.system.js +0 -1
- package/dist/zonos-elements/p-6cbcdee3.system.js +0 -1
- package/dist/zonos-elements/p-7780ded7.entry.js +0 -1
- package/dist/zonos-elements/p-a70da456.system.entry.js +0 -1
- package/dist/zonos-elements/p-d4110fa4.js +0 -1
- package/dist/zonos-elements/p-ee89e172.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
4
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
5
5
|
const isDarkColor = require('./isDarkColor-d206c6fa.js');
|
|
6
6
|
const getBorderRadius = require('./getBorderRadius-61ed5601.js');
|
|
7
7
|
|
|
@@ -9640,7 +9640,7 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
|
|
|
9640
9640
|
const themeBasedColor = primaryColor && isDarkColor.isDarkColor(primaryColor) ? 'night' : 'flat';
|
|
9641
9641
|
// if overrideTheme is provided, use it. Otherwise, use theme based on primary color
|
|
9642
9642
|
const theme = overrideTheme === 'DARK' ? 'night' : 'flat';
|
|
9643
|
-
const
|
|
9643
|
+
const paypalPaymentType = paypalEnabled ? ['external_paypal'] : [];
|
|
9644
9644
|
return {
|
|
9645
9645
|
appearance: {
|
|
9646
9646
|
labels: 'floating',
|
|
@@ -9655,7 +9655,7 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
|
|
|
9655
9655
|
colorPrimary: secondaryColor }),
|
|
9656
9656
|
},
|
|
9657
9657
|
clientSecret,
|
|
9658
|
-
externalPaymentMethodTypes: [...
|
|
9658
|
+
externalPaymentMethodTypes: [...paypalPaymentType],
|
|
9659
9659
|
locale: localizationStore.selectedLocale,
|
|
9660
9660
|
};
|
|
9661
9661
|
};
|
|
@@ -9789,7 +9789,7 @@ const stripeCalculateLandedCost = async () => {
|
|
|
9789
9789
|
}
|
|
9790
9790
|
};
|
|
9791
9791
|
const stripeStorePrefetchLandedCost = async (params) => {
|
|
9792
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
9792
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9793
9793
|
const applyingPromocode = !!(params === null || params === void 0 ? void 0 : params.applyingPromocode);
|
|
9794
9794
|
const stripeAddressReady = !!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete);
|
|
9795
9795
|
const stripeLinkReady = !!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
|
|
@@ -9842,6 +9842,22 @@ const stripeStorePrefetchLandedCost = async (params) => {
|
|
|
9842
9842
|
// default to empty array if we failed to fetch landed cost, so we can show the error message
|
|
9843
9843
|
cartStore.landedCostData = [];
|
|
9844
9844
|
cartStore.shippingData = [];
|
|
9845
|
+
const excludeErrors = [
|
|
9846
|
+
'The landed cost calculation request was aborted to initiate a new one.',
|
|
9847
|
+
];
|
|
9848
|
+
if (err instanceof Error &&
|
|
9849
|
+
err.message &&
|
|
9850
|
+
!excludeErrors.includes(err.message)) {
|
|
9851
|
+
const shipToAddress = (_h = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _h === void 0 ? void 0 : _h.value;
|
|
9852
|
+
void handleFetch.sendErrorLog({
|
|
9853
|
+
endpoint: 'Failed to fetch landed cost',
|
|
9854
|
+
errors: [err.message],
|
|
9855
|
+
metadata: {
|
|
9856
|
+
cartId: window.Zonos.cartId,
|
|
9857
|
+
shipToAddress,
|
|
9858
|
+
},
|
|
9859
|
+
});
|
|
9860
|
+
}
|
|
9845
9861
|
handleFetch.logError(err);
|
|
9846
9862
|
}
|
|
9847
9863
|
stripeStore.isFetchingLandedCost = false;
|
|
@@ -10042,18 +10058,9 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
10042
10058
|
}
|
|
10043
10059
|
}
|
|
10044
10060
|
};
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
* @returns {boolean} whether or not the checkout session is successfully created
|
|
10048
|
-
*/
|
|
10049
|
-
const stripeStoreInitCheckoutSession = async () => {
|
|
10050
|
-
var _a, _b;
|
|
10061
|
+
const getCheckoutSessionBody = () => {
|
|
10062
|
+
var _a;
|
|
10051
10063
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
10052
|
-
if (!localizationStore.targetCurrency) {
|
|
10053
|
-
handleFetch.logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
10054
|
-
return false;
|
|
10055
|
-
}
|
|
10056
|
-
stripeStore.isFetchingSession = true;
|
|
10057
10064
|
const body = {
|
|
10058
10065
|
adjustmentsAmount: cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0),
|
|
10059
10066
|
cartId: window.Zonos.cartId,
|
|
@@ -10079,6 +10086,20 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
10079
10086
|
],
|
|
10080
10087
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
10081
10088
|
};
|
|
10089
|
+
return body;
|
|
10090
|
+
};
|
|
10091
|
+
/**
|
|
10092
|
+
* Init checkout session
|
|
10093
|
+
* @returns {boolean} whether or not the checkout session is successfully created
|
|
10094
|
+
*/
|
|
10095
|
+
const stripeStoreInitCheckoutSession = async () => {
|
|
10096
|
+
var _a;
|
|
10097
|
+
if (!localizationStore.targetCurrency) {
|
|
10098
|
+
handleFetch.logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
10099
|
+
return false;
|
|
10100
|
+
}
|
|
10101
|
+
stripeStore.isFetchingSession = true;
|
|
10102
|
+
const body = getCheckoutSessionBody();
|
|
10082
10103
|
handleFetch.log('Checkout session body', 'info', body);
|
|
10083
10104
|
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/create-checkout-session', {
|
|
10084
10105
|
body,
|
|
@@ -10094,7 +10115,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
10094
10115
|
cartStoreSetCheckoutSession(result);
|
|
10095
10116
|
stripeStore.clientSecret = result.clientSecret;
|
|
10096
10117
|
cartStoreApplySubtotals({
|
|
10097
|
-
method: ((
|
|
10118
|
+
method: ((_a = result.landedCost) === null || _a === void 0 ? void 0 : _a.method) || 'DDP',
|
|
10098
10119
|
subtotals: result.subtotals,
|
|
10099
10120
|
});
|
|
10100
10121
|
handleFetch.log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
@@ -10673,6 +10694,7 @@ exports.currencyConvert = currencyConvert;
|
|
|
10673
10694
|
exports.currencyConvertAndFormat = currencyConvertAndFormat;
|
|
10674
10695
|
exports.currencyDisplay = currencyDisplay;
|
|
10675
10696
|
exports.currencyFormat = currencyFormat;
|
|
10697
|
+
exports.getCheckoutSessionBody = getCheckoutSessionBody;
|
|
10676
10698
|
exports.getFallbackDefaultCountryCode = getFallbackDefaultCountryCode;
|
|
10677
10699
|
exports.getZCountryUrlParam = getZCountryUrlParam;
|
|
10678
10700
|
exports.initLocalizationStore = initLocalizationStore;
|
|
@@ -89,7 +89,7 @@ const fallbackApiType = ['cloudflare', 'vercel'];
|
|
|
89
89
|
const MAIN_BASE_API_TYPE = fallbackApiType[0];
|
|
90
90
|
const fallbackApiList = {
|
|
91
91
|
cloudflare: "https://route.elements.zonos.com",
|
|
92
|
-
vercel: "https://
|
|
92
|
+
vercel: "https://route.js.zonos.com",
|
|
93
93
|
};
|
|
94
94
|
const MAIN_BASE_API = fallbackApiList[MAIN_BASE_API_TYPE];
|
|
95
95
|
/**
|
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-83c97d08.js');
|
|
6
|
+
const CheckoutConfig = require('./CheckoutConfig-00c7333a.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.123.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.
|
|
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.123.js.zonos.com";
|
|
285
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.123";
|
|
286
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.123";
|
|
287
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.123";
|
|
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 = "1730930859534";
|
|
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.
|
|
312
|
+
Zonos.version = `v${"1.3.123"}`;
|
|
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-e12d459c.js');
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const cart = require('./cart-d2676914.js');
|
|
5
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-d206c6fa.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-d2676914.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-e12d459c.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-
|
|
6
|
+
const cart = require('./cart-d2676914.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
8
|
+
const paypal = require('./paypal-617669c3.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
10
10
|
const createCustomEvent = require('./createCustomEvent-3e982e57.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-61ed5601.js');
|
|
12
|
-
const handleFetch = require('./handleFetch-
|
|
12
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
15
|
const isDarkColor = require('./isDarkColor-d206c6fa.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-d2676914.js');
|
|
7
|
+
const paypal = require('./paypal-617669c3.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
10
10
|
const createCustomEvent = require('./createCustomEvent-3e982e57.js');
|
|
11
11
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
12
12
|
const classes = require('./classes-b7918f56.js');
|
|
13
13
|
const getBorderRadius = require('./getBorderRadius-61ed5601.js');
|
|
14
14
|
const isDarkColor = require('./isDarkColor-d206c6fa.js');
|
|
15
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
15
|
+
const CheckoutConfig = require('./CheckoutConfig-00c7333a.js');
|
|
16
16
|
const RemoveIcon = require('./RemoveIcon-081ac073.js');
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -534,6 +534,7 @@ const ZonosCheckout = class {
|
|
|
534
534
|
metadata: {
|
|
535
535
|
allLogs: handleFetch.allLogs,
|
|
536
536
|
cartId: window.Zonos.cartId,
|
|
537
|
+
checkoutSessionBody: cart.getCheckoutSessionBody(),
|
|
537
538
|
href: window.location.href,
|
|
538
539
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
539
540
|
},
|
|
@@ -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-d2676914.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
8
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
9
9
|
require('./isDarkColor-d206c6fa.js');
|
|
10
10
|
require('./getBorderRadius-61ed5601.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-d2676914.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-83c97d08.js');
|
|
10
10
|
require('./isDarkColor-d206c6fa.js');
|
|
11
11
|
require('./getBorderRadius-61ed5601.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-d2676914.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-d206c6fa.js');
|
|
10
10
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
11
|
-
require('./handleFetch-
|
|
11
|
+
require('./handleFetch-83c97d08.js');
|
|
12
12
|
require('./getBorderRadius-61ed5601.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-d2676914.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-e12d459c.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-83c97d08.js');
|
|
12
12
|
require('./isDarkColor-d206c6fa.js');
|
|
13
13
|
require('./getBorderRadius-61ed5601.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-e12d459c.js');
|
|
7
|
-
const cart = require('./cart-
|
|
7
|
+
const cart = require('./cart-d2676914.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
const handleFetch = require('./handleFetch-
|
|
9
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
11
|
require('./isDarkColor-d206c6fa.js');
|
|
12
12
|
require('./getBorderRadius-61ed5601.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-d2676914.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-e12d459c.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-83c97d08.js');
|
|
10
10
|
require('./isDarkColor-d206c6fa.js');
|
|
11
11
|
require('./getBorderRadius-61ed5601.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-e12d459c.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-d2676914.js');
|
|
9
|
+
const handleFetch = require('./handleFetch-83c97d08.js');
|
|
10
|
+
const paypal = require('./paypal-617669c3.js');
|
|
11
11
|
require('./isDarkColor-d206c6fa.js');
|
|
12
12
|
require('./getBorderRadius-61ed5601.js');
|
|
13
13
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readFileSync } from "fs";
|
|
2
|
-
export const urlCheckOne = async ({
|
|
3
|
-
const majorVersion = packageVersion === null || packageVersion === void 0 ? void 0 : packageVersion.split('.')[0];
|
|
2
|
+
export const urlCheckOne = async ({ filePath, packageVersion, }) => {
|
|
4
3
|
const fileContent = readFileSync(filePath, { encoding: 'utf-8' });
|
|
5
4
|
const zonosUrlRegexResult = fileContent.matchAll(/https:\/\/[a-zA-Z0-9-\.]+?(.js.zonos.com)/g);
|
|
6
5
|
if (!zonosUrlRegexResult) {
|
|
@@ -17,7 +16,7 @@ export const urlCheckOne = async ({ branch, filePath, packageVersion, }) => {
|
|
|
17
16
|
];
|
|
18
17
|
// these files are load file, no need to check version url here
|
|
19
18
|
const excludeFiles = ['zonosBase', 'zonos', 'loadZonos'];
|
|
20
|
-
result.
|
|
19
|
+
result.some(([fullUrl]) => {
|
|
21
20
|
if (fullUrl.includes('.js.zonos.com') &&
|
|
22
21
|
!excludeDomainPattern.includes(fullUrl) &&
|
|
23
22
|
!excludeFiles.some(file => filePath.includes(file))) {
|
|
@@ -25,6 +24,11 @@ export const urlCheckOne = async ({ branch, filePath, packageVersion, }) => {
|
|
|
25
24
|
const versioned =
|
|
26
25
|
// @ts-ignore ts v5.5 requires target to be ES2017 to use group, but we run this in node and not in compiled version, so it should work with current target ES2017
|
|
27
26
|
/(v(?<major>\d+)(?<patch>\.\d+(\-alpha\.\d+)*)*)\.*(.*?js\.zonos\.com)/g.exec(fullUrl);
|
|
27
|
+
// if it's the route js, no need to version as API is versionless
|
|
28
|
+
const isRouteUrl = fullUrl === null || fullUrl === void 0 ? void 0 : fullUrl.includes('route.js.zonos.com');
|
|
29
|
+
if (isRouteUrl) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
28
32
|
if (!versioned) {
|
|
29
33
|
throw new Error(`${filePath}: url in the file is not versioned for url "${fullUrl}"`);
|
|
30
34
|
}
|
|
@@ -35,18 +39,6 @@ export const urlCheckOne = async ({ branch, filePath, packageVersion, }) => {
|
|
|
35
39
|
if (!version) {
|
|
36
40
|
throw new Error(`${filePath}: no version found after the regex for url "${fullUrl}"`);
|
|
37
41
|
}
|
|
38
|
-
const isRouteUrl = url.includes('route.js.zonos.com');
|
|
39
|
-
// if it's the route js, the version would be just major version
|
|
40
|
-
if (isRouteUrl) {
|
|
41
|
-
if (branch === 'qa') {
|
|
42
|
-
// qa branch is not versioned, should always use the latest version
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (version !== `v${majorVersion}`) {
|
|
46
|
-
throw new Error(`[ROUTE] ${filePath}: found version (${version}) is not the expected major version (${majorVersion}) for url "${fullUrl}"`);
|
|
47
|
-
}
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
42
|
if (version !== `v${packageVersion}`) {
|
|
51
43
|
// now the rest would be just `js.zonos.com`, the version prefix should be full version
|
|
52
44
|
throw new Error(`[CDN] ${filePath}: found version (${version}) is not the expected full version (${packageVersion}) for url "${fullUrl}"`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, h, Host, } from "@stencil/core";
|
|
2
2
|
import { cartStore, cartStoreClearCheckoutInterval, cartStoreNextStep, cartStoreReset, cartStoreResetTabItems, cartStoreSetCheckoutSession, cartStoreStartCheckoutInterval, cartStoreUpdateItems, cartStoreUpdateToErrorState, } from "../../store/checkout/cart";
|
|
3
3
|
import { paypalInitScript, paypalStoreHasPaypalEnabled, } from "../../store/checkout/paypal";
|
|
4
|
-
import { initStripeElements, stripeStore, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStorePrefetchLandedCost, stripeStoreReset, } from "../../store/checkout/stripe";
|
|
4
|
+
import { getCheckoutSessionBody, initStripeElements, stripeStore, stripeStoreCleanupDomesticShippingSession, stripeStoreConfirmPayment, stripeStoreHandleInventoryCheck, stripeStoreHandleInventoryRefund, stripeStoreInitCheckoutSession, stripeStorePrefetchLandedCost, stripeStoreReset, } from "../../store/checkout/stripe";
|
|
5
5
|
import { localizationStore, localizationStoreOnUpdate, } from "../../store/hello/localization";
|
|
6
6
|
import { translate } from "../../store/translationStore";
|
|
7
7
|
import { getZonosStoreTheme, zonosStore, } from "../../store/zonosStore";
|
|
@@ -321,6 +321,7 @@ export class ZonosCheckout {
|
|
|
321
321
|
metadata: {
|
|
322
322
|
allLogs,
|
|
323
323
|
cartId: window.Zonos.cartId,
|
|
324
|
+
checkoutSessionBody: getCheckoutSessionBody(),
|
|
324
325
|
href: window.location.href,
|
|
325
326
|
storeBaseUrl: (_a = window.Zonos.cartData) === null || _a === void 0 ? void 0 : _a.storeBaseUrl,
|
|
326
327
|
},
|
|
@@ -12,6 +12,7 @@ import { isDarkColor } from "../../utils/isDarkColor";
|
|
|
12
12
|
import { jsonParse } from "../../utils/jsonParse";
|
|
13
13
|
import { log } from "../../utils/logging/log";
|
|
14
14
|
import { logError } from "../../utils/logging/logError";
|
|
15
|
+
import { sendErrorLog } from "../../utils/logging/sendErrorLog";
|
|
15
16
|
import { addressRuleStyle } from "../../../styles/stripe/addressRuleStyle";
|
|
16
17
|
import { defaultVariable } from "../../../styles/stripe/defaultVariable";
|
|
17
18
|
const { onChange, reset, state: stripeStore, } = createStore(() => ({
|
|
@@ -53,7 +54,7 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
|
|
|
53
54
|
const themeBasedColor = primaryColor && isDarkColor(primaryColor) ? 'night' : 'flat';
|
|
54
55
|
// if overrideTheme is provided, use it. Otherwise, use theme based on primary color
|
|
55
56
|
const theme = overrideTheme === 'DARK' ? 'night' : 'flat';
|
|
56
|
-
const
|
|
57
|
+
const paypalPaymentType = paypalEnabled ? ['external_paypal'] : [];
|
|
57
58
|
return {
|
|
58
59
|
appearance: {
|
|
59
60
|
labels: 'floating',
|
|
@@ -69,7 +70,7 @@ const getStripeOptions = ({ clientSecret, overrideBorderRadius, overridePrimaryC
|
|
|
69
70
|
}),
|
|
70
71
|
},
|
|
71
72
|
clientSecret,
|
|
72
|
-
externalPaymentMethodTypes: [...
|
|
73
|
+
externalPaymentMethodTypes: [...paypalPaymentType],
|
|
73
74
|
locale: localizationStore.selectedLocale,
|
|
74
75
|
};
|
|
75
76
|
};
|
|
@@ -203,7 +204,7 @@ const stripeCalculateLandedCost = async () => {
|
|
|
203
204
|
}
|
|
204
205
|
};
|
|
205
206
|
const stripeStorePrefetchLandedCost = async (params) => {
|
|
206
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
207
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
207
208
|
const applyingPromocode = !!(params === null || params === void 0 ? void 0 : params.applyingPromocode);
|
|
208
209
|
const stripeAddressReady = !!((_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.complete);
|
|
209
210
|
const stripeLinkReady = !!((_b = stripeStore.stripeLinkEventData) === null || _b === void 0 ? void 0 : _b.complete);
|
|
@@ -256,6 +257,22 @@ const stripeStorePrefetchLandedCost = async (params) => {
|
|
|
256
257
|
// default to empty array if we failed to fetch landed cost, so we can show the error message
|
|
257
258
|
cartStore.landedCostData = [];
|
|
258
259
|
cartStore.shippingData = [];
|
|
260
|
+
const excludeErrors = [
|
|
261
|
+
'The landed cost calculation request was aborted to initiate a new one.',
|
|
262
|
+
];
|
|
263
|
+
if (err instanceof Error &&
|
|
264
|
+
err.message &&
|
|
265
|
+
!excludeErrors.includes(err.message)) {
|
|
266
|
+
const shipToAddress = (_h = stripeStore.stripeAddressUsedWhenFetchingLC) === null || _h === void 0 ? void 0 : _h.value;
|
|
267
|
+
void sendErrorLog({
|
|
268
|
+
endpoint: 'Failed to fetch landed cost',
|
|
269
|
+
errors: [err.message],
|
|
270
|
+
metadata: {
|
|
271
|
+
cartId: window.Zonos.cartId,
|
|
272
|
+
shipToAddress,
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
}
|
|
259
276
|
logError(err);
|
|
260
277
|
}
|
|
261
278
|
stripeStore.isFetchingLandedCost = false;
|
|
@@ -456,18 +473,9 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
456
473
|
}
|
|
457
474
|
}
|
|
458
475
|
};
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
* @returns {boolean} whether or not the checkout session is successfully created
|
|
462
|
-
*/
|
|
463
|
-
const stripeStoreInitCheckoutSession = async () => {
|
|
464
|
-
var _a, _b;
|
|
476
|
+
export const getCheckoutSessionBody = () => {
|
|
477
|
+
var _a;
|
|
465
478
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
466
|
-
if (!localizationStore.targetCurrency) {
|
|
467
|
-
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
468
|
-
return false;
|
|
469
|
-
}
|
|
470
|
-
stripeStore.isFetchingSession = true;
|
|
471
479
|
const body = {
|
|
472
480
|
adjustmentsAmount: cartStore.adjustments.reduce((prev, adj) => prev + adj.amount, 0),
|
|
473
481
|
cartId: window.Zonos.cartId,
|
|
@@ -493,6 +501,20 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
493
501
|
],
|
|
494
502
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
495
503
|
};
|
|
504
|
+
return body;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Init checkout session
|
|
508
|
+
* @returns {boolean} whether or not the checkout session is successfully created
|
|
509
|
+
*/
|
|
510
|
+
const stripeStoreInitCheckoutSession = async () => {
|
|
511
|
+
var _a;
|
|
512
|
+
if (!localizationStore.targetCurrency) {
|
|
513
|
+
logError(`Failed to create checkout session - missing localizationStore.targetCurrency`);
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
stripeStore.isFetchingSession = true;
|
|
517
|
+
const body = getCheckoutSessionBody();
|
|
496
518
|
log('Checkout session body', 'info', body);
|
|
497
519
|
const { errors, json } = await handleFetch('/api/zonos-elements/create-checkout-session', {
|
|
498
520
|
body,
|
|
@@ -508,7 +530,7 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
508
530
|
cartStoreSetCheckoutSession(result);
|
|
509
531
|
stripeStore.clientSecret = result.clientSecret;
|
|
510
532
|
cartStoreApplySubtotals({
|
|
511
|
-
method: ((
|
|
533
|
+
method: ((_a = result.landedCost) === null || _a === void 0 ? void 0 : _a.method) || 'DDP',
|
|
512
534
|
subtotals: result.subtotals,
|
|
513
535
|
});
|
|
514
536
|
log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
@@ -23,6 +23,7 @@ export const featureAspectKeyEnum = {
|
|
|
23
23
|
ExploreFrontendMutation: 'explore_frontend_mutation',
|
|
24
24
|
ExploreWeaviateMutation: 'explore_weaviate_mutation',
|
|
25
25
|
FeatureAspect: 'feature_aspect',
|
|
26
|
+
FeatureFlagManagement: 'feature_flag_management',
|
|
26
27
|
LocaleMessage: 'locale_message',
|
|
27
28
|
NewCheckoutBeta: 'new_checkout_beta',
|
|
28
29
|
NewPayoutReport: 'new_payout_report',
|
|
@@ -41,6 +42,7 @@ export const featureAudienceNameEnum = {
|
|
|
41
42
|
DocsContributor: 'docs_contributor',
|
|
42
43
|
Executive: 'executive',
|
|
43
44
|
ExecutiveAssistant: 'executive_assistant',
|
|
45
|
+
FeatureFlagAdmin: 'feature_flag_admin',
|
|
44
46
|
Finance: 'finance',
|
|
45
47
|
FrontendEngineer: 'frontend_engineer',
|
|
46
48
|
I18nKnownLanguage: 'i18n_known_language',
|