@zonos/elements 1.3.85 → 1.3.86
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/{cart-fc426d98.js → cart-c5152dfc.js} +37 -21
- package/dist/cjs/{createCustomEvent-354c8e63.js → createCustomEvent-557f8120.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{paypal-1fe5ed0c.js → paypal-922c7e45.js} +1 -1
- package/dist/cjs/zonos-address_7.cjs.entry.js +1 -1
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +8 -8
- package/dist/cjs/zonos-checkout.cjs.entry.js +3 -3
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification_3.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -3
- package/dist/collection/components/store/checkout/cart.js +22 -12
- package/dist/collection/components/store/checkout/stripe.js +15 -9
- package/dist/collection/types/generated/graphql.frontend.types.js +5 -5
- package/dist/esm/{cart-6c44367a.js → cart-9d7e0950.js} +37 -21
- package/dist/esm/{createCustomEvent-ec15a4a7.js → createCustomEvent-e93c38eb.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{paypal-a562a640.js → paypal-6c55d504.js} +1 -1
- package/dist/esm/zonos-address_7.entry.js +1 -1
- package/dist/esm/zonos-cart-items_12.entry.js +8 -8
- package/dist/esm/zonos-checkout.entry.js +3 -3
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-notification_3.entry.js +2 -2
- package/dist/esm-es5/{cart-6c44367a.js → cart-9d7e0950.js} +1 -1
- package/dist/esm-es5/{createCustomEvent-ec15a4a7.js → createCustomEvent-e93c38eb.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{paypal-a562a640.js → paypal-6c55d504.js} +1 -1
- package/dist/esm-es5/zonos-address_7.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_12.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 +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/store/checkout/cart.d.ts +7 -3
- package/dist/types/types/generated/graphql.frontend.types.d.ts +28 -29
- package/dist/types/types/generated/graphql.frontend.types.ts +43 -44
- package/dist/types/types/generated/graphql.internal.types.d.ts +3 -3
- package/dist/types/types/generated/graphql.internal.types.ts +3 -3
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-95241447.entry.js → p-04781437.entry.js} +1 -1
- package/dist/zonos-elements/{p-01604d44.entry.js → p-077a6d1e.entry.js} +1 -1
- package/dist/zonos-elements/{p-1eb59b7c.system.entry.js → p-0c2c5edf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-710ac059.js → p-1161bb85.js} +1 -1
- package/dist/zonos-elements/{p-76013796.system.entry.js → p-217e862c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5ebde561.system.entry.js → p-21becaac.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ee8b5e53.js → p-28f00b59.js} +1 -1
- package/dist/zonos-elements/{p-a858a304.entry.js → p-2ee020dd.entry.js} +1 -1
- package/dist/zonos-elements/{p-e78c2429.entry.js → p-3c6503d0.entry.js} +1 -1
- package/dist/zonos-elements/{p-35b6b151.system.entry.js → p-423aa2cd.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c37b99dd.system.entry.js → p-5348f8f4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b7fa35e.system.js → p-5bdfdced.system.js} +1 -1
- package/dist/zonos-elements/{p-64b67900.entry.js → p-5f51136c.entry.js} +1 -1
- package/dist/zonos-elements/{p-08fee913.system.js → p-8161254a.system.js} +1 -1
- package/dist/zonos-elements/{p-cbb742ab.js → p-82034a27.js} +1 -1
- package/dist/zonos-elements/{p-3b3cb2a4.entry.js → p-84adf4cf.entry.js} +1 -1
- package/dist/zonos-elements/{p-5ba198b3.entry.js → p-8e210b51.entry.js} +1 -1
- package/dist/zonos-elements/{p-b9645c27.system.js → p-9821d158.system.js} +2 -2
- package/dist/zonos-elements/p-af49128f.entry.js +1 -0
- package/dist/zonos-elements/{p-092961f1.system.js → p-baccbe8c.system.js} +1 -1
- package/dist/zonos-elements/p-c78dd680.system.js +1 -1
- package/dist/zonos-elements/{p-51e2df70.entry.js → p-cdbd5532.entry.js} +1 -1
- package/dist/zonos-elements/{p-63a33354.system.entry.js → p-de99079d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-133595ff.system.entry.js → p-ed846c78.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d7b341e3.system.entry.js → p-f00bb583.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b5316c2c.entry.js → p-f2860f7d.entry.js} +1 -1
- package/dist/zonos-elements/{p-7b4a5b9b.system.entry.js → p-f45d19ab.system.entry.js} +1 -1
- package/dist/zonos-elements/p-fa36817b.system.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-a26a8ca5.system.entry.js +0 -1
- package/dist/zonos-elements/p-de6c2a4a.entry.js +0 -1
|
@@ -9297,13 +9297,16 @@ const stripeStorePrefetchLandedCost = async (params) => {
|
|
|
9297
9297
|
if (subtotals) {
|
|
9298
9298
|
// prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
|
|
9299
9299
|
cartStoreApplySubtotals({
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9300
|
+
method: (matchLandedCost === null || matchLandedCost === void 0 ? void 0 : matchLandedCost.landedCost.method) || 'DDP',
|
|
9301
|
+
subtotals: {
|
|
9302
|
+
adjustments: subtotals.adjustments,
|
|
9303
|
+
exchangeRate: subtotals.exchangeRate,
|
|
9304
|
+
items: subtotals.items,
|
|
9305
|
+
landedCostTotal: subtotals.landedCostTotal,
|
|
9306
|
+
presentmentCurrencyCode: subtotals.presentmentCurrencyCode,
|
|
9307
|
+
shipping: subtotals.shipping,
|
|
9308
|
+
total: subtotals.total,
|
|
9309
|
+
},
|
|
9307
9310
|
});
|
|
9308
9311
|
}
|
|
9309
9312
|
}
|
|
@@ -9461,7 +9464,7 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
9461
9464
|
* @returns {boolean} whether or not the checkout session is successfully created
|
|
9462
9465
|
*/
|
|
9463
9466
|
const stripeStoreInitCheckoutSession = async () => {
|
|
9464
|
-
var _a;
|
|
9467
|
+
var _a, _b;
|
|
9465
9468
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
9466
9469
|
if (!total || !localizationStore.targetCurrency) {
|
|
9467
9470
|
handleFetch.logError('Failed to create checkout session - invalid total or currency');
|
|
@@ -9489,7 +9492,10 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
9489
9492
|
// update cart store with updated information
|
|
9490
9493
|
cartStoreSetCheckoutSession(result);
|
|
9491
9494
|
stripeStore.clientSecret = result.clientSecret;
|
|
9492
|
-
cartStoreApplySubtotals(
|
|
9495
|
+
cartStoreApplySubtotals({
|
|
9496
|
+
method: ((_b = result.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
9497
|
+
subtotals: Object.assign(Object.assign({}, result.subtotals), { landedCostTotal: 0, shipping: 0, total: result.subtotals.items }),
|
|
9498
|
+
});
|
|
9493
9499
|
handleFetch.log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
9494
9500
|
handleFetch.log('done-init-checkout-session');
|
|
9495
9501
|
return true;
|
|
@@ -9656,8 +9662,8 @@ const { onChange, reset, state: cartStore, } = zonosStore.createStore(() => ({
|
|
|
9656
9662
|
checkoutTimeoutInterval: null,
|
|
9657
9663
|
currency: 'USD',
|
|
9658
9664
|
doneSteps: [],
|
|
9659
|
-
dutiesTaxesFees:
|
|
9660
|
-
dutiesTaxesFeesEstimate:
|
|
9665
|
+
dutiesTaxesFees: null,
|
|
9666
|
+
dutiesTaxesFeesEstimate: null,
|
|
9661
9667
|
error: null,
|
|
9662
9668
|
exchangeRate: null,
|
|
9663
9669
|
externalConfirmationPageURL: null,
|
|
@@ -9781,15 +9787,16 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
|
9781
9787
|
title,
|
|
9782
9788
|
};
|
|
9783
9789
|
};
|
|
9784
|
-
const cartStoreApplySubtotals = (subtotals,
|
|
9790
|
+
const cartStoreApplySubtotals = ({ dutiesTaxesFeesEstimate, method, subtotals, }) => {
|
|
9785
9791
|
// update exchange rate so we can use it to display cart items
|
|
9786
9792
|
cartStore.exchangeRate = subtotals.exchangeRate;
|
|
9787
9793
|
cartStore.adjustmentTotal = subtotals.adjustments;
|
|
9788
|
-
cartStore.dutiesTaxesFees =
|
|
9794
|
+
cartStore.dutiesTaxesFees =
|
|
9795
|
+
method === 'DAP' ? null : subtotals.landedCostTotal;
|
|
9789
9796
|
cartStore.subtotal = subtotals.items;
|
|
9790
9797
|
cartStore.total = subtotals.total;
|
|
9791
9798
|
cartStore.currency = subtotals.presentmentCurrencyCode;
|
|
9792
|
-
cartStore.dutiesTaxesFeesEstimate = dutiesTaxesFeesEstimate ||
|
|
9799
|
+
cartStore.dutiesTaxesFeesEstimate = dutiesTaxesFeesEstimate || null;
|
|
9793
9800
|
};
|
|
9794
9801
|
/**
|
|
9795
9802
|
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
@@ -9813,10 +9820,15 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
9813
9820
|
}
|
|
9814
9821
|
};
|
|
9815
9822
|
const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency, dutiesTaxesFeesEstimate, itemsAmount, landedCostId, }) => {
|
|
9823
|
+
var _a;
|
|
9816
9824
|
if (landedCostId && cartStore.selectedLandedCost) {
|
|
9817
9825
|
// update cart total right away if we have landed cost id to avoid order total flickering
|
|
9818
9826
|
const subtotals = cartStore.selectedLandedCost.subtotals;
|
|
9819
|
-
cartStoreApplySubtotals(
|
|
9827
|
+
cartStoreApplySubtotals({
|
|
9828
|
+
dutiesTaxesFeesEstimate,
|
|
9829
|
+
method: cartStore.landedCostMethod,
|
|
9830
|
+
subtotals,
|
|
9831
|
+
});
|
|
9820
9832
|
handleFetch.log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
|
|
9821
9833
|
}
|
|
9822
9834
|
// update checkout session
|
|
@@ -9847,7 +9859,10 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
9847
9859
|
if (!landedCostId) {
|
|
9848
9860
|
// This is when we first open the checkout modal and we just want to get info from the old cart session.
|
|
9849
9861
|
// use subtotals from checkout session to update cart total
|
|
9850
|
-
cartStoreApplySubtotals(
|
|
9862
|
+
cartStoreApplySubtotals({
|
|
9863
|
+
method: ((_a = json.checkoutSessionUpdate.landedCost) === null || _a === void 0 ? void 0 : _a.method) || 'DDP',
|
|
9864
|
+
subtotals: json.checkoutSessionUpdate.subtotals,
|
|
9865
|
+
});
|
|
9851
9866
|
handleFetch.log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
|
|
9852
9867
|
}
|
|
9853
9868
|
cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
|
|
@@ -9872,12 +9887,13 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
|
|
|
9872
9887
|
// do nothing if we can't find landed cost for selected shipping option
|
|
9873
9888
|
return false;
|
|
9874
9889
|
}
|
|
9875
|
-
// If the quote is DAP,
|
|
9876
|
-
const
|
|
9877
|
-
|
|
9878
|
-
const
|
|
9890
|
+
// If the quote is DAP, then convert manually.
|
|
9891
|
+
const landedCostAmount = ((_b = selectedLandedCost.landedCost.amountSubtotals) === null || _b === void 0 ? void 0 : _b.landedCostTotal) || 0;
|
|
9892
|
+
// Convert using checkout presentment exchange rate
|
|
9893
|
+
const exchangeRate = selectedLandedCost.subtotals.exchangeRate.rate;
|
|
9894
|
+
const dutiesTaxesFeesEstimate = landedCostAmount * exchangeRate;
|
|
9879
9895
|
if (dutiesTaxesFeesEstimate) {
|
|
9880
|
-
handleFetch.log(`DAP quote, using estimate
|
|
9896
|
+
handleFetch.log(`DAP quote, using estimate: ${dutiesTaxesFeesEstimate}`, 'info');
|
|
9881
9897
|
}
|
|
9882
9898
|
cartStore.landedCostMethod = selectedLandedCost.landedCost.method || 'DDP';
|
|
9883
9899
|
// update shipping value and dutiesTaxFees on selectedShippingOption change
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -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.86.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.86.js.zonos.com";
|
|
285
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.86";
|
|
286
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.86";
|
|
287
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.86";
|
|
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 = "1728763184534";
|
|
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.86"}`;
|
|
311
311
|
Zonos.modeAlerted = false;
|
|
312
312
|
Zonos.cartData = null;
|
|
313
313
|
Zonos.paypal = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
4
|
-
const cart = require('./cart-
|
|
4
|
+
const cart = require('./cart-c5152dfc.js');
|
|
5
5
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-5efc8367.js');
|
|
7
7
|
|
|
@@ -3,7 +3,7 @@
|
|
|
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-c5152dfc.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
8
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
@@ -3,11 +3,11 @@
|
|
|
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-c5152dfc.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const paypal = require('./paypal-
|
|
8
|
+
const paypal = require('./paypal-922c7e45.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
10
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
10
|
+
const createCustomEvent = require('./createCustomEvent-557f8120.js');
|
|
11
11
|
const getBorderRadius = require('./getBorderRadius-5a64574c.js');
|
|
12
12
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
13
13
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
@@ -172,14 +172,14 @@ const ZonosCartSubtotal = class {
|
|
|
172
172
|
};
|
|
173
173
|
const renderLandedCost = () => {
|
|
174
174
|
if (cart.cartStore.landedCostMethod === 'DAP') {
|
|
175
|
-
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.translate('Duties, taxes, and fees')), cart.cartStore.dutiesTaxesFeesEstimate
|
|
175
|
+
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.translate('Duties, taxes, and fees')), cart.cartStore.dutiesTaxesFeesEstimate !== null
|
|
176
176
|
? `${cart.translate('Estimated')} ${cart.currencyFormat({
|
|
177
177
|
amount: cart.cartStore.dutiesTaxesFeesEstimate,
|
|
178
178
|
currency: cart.cartStore.currency,
|
|
179
179
|
})}`
|
|
180
180
|
: '-'), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" }, cart.translate('Due at delivery')))));
|
|
181
181
|
}
|
|
182
|
-
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.translate('Duties, taxes, and fees')), index.h("zonos-text", { class: "zonos--caption", type: "caption" }, cart.translate('Nothing due at the door'))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" }, cart.cartStore.dutiesTaxesFees
|
|
182
|
+
return (index.h(index.Fragment, null, index.h("td", { class: "zonos--column zonos--cart-subtotal-title" }, index.h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, cart.translate('Duties, taxes, and fees')), index.h("zonos-text", { class: "zonos--caption", type: "caption" }, cart.translate('Nothing due at the door'))), index.h("td", { class: "zonos--column zonos--cart-subtotal-price" }, index.h("div", { class: "zonos--cart-duty-tax-price" }, cart.cartStore.dutiesTaxesFees !== null
|
|
183
183
|
? cart.currencyFormat({
|
|
184
184
|
amount: cart.cartStore.dutiesTaxesFees,
|
|
185
185
|
currency: cart.cartStore.currency,
|
|
@@ -1228,13 +1228,13 @@ const ZonosShipping = class {
|
|
|
1228
1228
|
if (this.showErrorBanner) {
|
|
1229
1229
|
this.showErrorBanner = !this.handleValidate();
|
|
1230
1230
|
}
|
|
1231
|
-
return (index.h(index.Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, index.h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, index.h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (index.h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, cart.translate('No shipping method selected'))), index.h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, cart.translate('Shipping method')), !allServiceLevels.length ? (index.h("zonos-banner", { bannerTitle: cart.translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (index.h("div", { class: "zonos--shipping-options-wrapper" }, index.h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }),
|
|
1232
|
-
|
|
1231
|
+
return (index.h(index.Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, index.h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, index.h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, cart.translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (index.h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, cart.translate('No shipping method selected'))), index.h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, cart.translate('Shipping method')), !allServiceLevels.length ? (index.h("zonos-banner", { bannerTitle: cart.translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (index.h("div", { class: "zonos--shipping-options-wrapper" }, index.h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length &&
|
|
1232
|
+
!!this.serviceLevelsDAP.length && (index.h("button", { class: classes.classes([
|
|
1233
1233
|
'zonos--shipping-options-collapse-trigger',
|
|
1234
1234
|
this.collapsedDAPOptions && 'collapsed',
|
|
1235
1235
|
]), onClick: () => {
|
|
1236
1236
|
this.collapsedDAPOptions = !this.collapsedDAPOptions;
|
|
1237
|
-
} }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { type: "label" }, `${cart.translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), index.h("zonos-icon", { content: ChevronUpIcon })))), index.h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, index.h("div", { class: "zonos--dap-wrapper" }, index.h("zonos-banner", { bannerTitle: cart.translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, cart.translate('You may incur additional fees from the shipping carrier by not prepaying.')), index.h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), index.h("div", { key: '
|
|
1237
|
+
} }, index.h("div", { class: "zonos--title-wrapper" }, index.h("zonos-text", { type: "label" }, `${cart.translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), index.h("zonos-icon", { content: ChevronUpIcon })))), index.h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, index.h("div", { class: "zonos--dap-wrapper" }, index.h("zonos-banner", { bannerTitle: cart.translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, cart.translate('You may incur additional fees from the shipping carrier by not prepaying.')), index.h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), index.h("div", { key: '2dded1f7168a16ed6432ea0b147b8ec78fd774a6', class: "zonos--group-btn" }, index.h("zonos-button", { key: '54c05db9336209c34a7c7c518bbdf859e97b51f1', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
|
|
1238
1238
|
// use primary type when on mobile mode
|
|
1239
1239
|
variant: this.submitBtnType }, cart.translate('Go to payment'))))));
|
|
1240
1240
|
}
|
|
@@ -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-
|
|
7
|
-
const paypal = require('./paypal-
|
|
6
|
+
const cart = require('./cart-c5152dfc.js');
|
|
7
|
+
const paypal = require('./paypal-922c7e45.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
9
|
-
const createCustomEvent = require('./createCustomEvent-
|
|
9
|
+
const createCustomEvent = require('./createCustomEvent-557f8120.js');
|
|
10
10
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
11
11
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
12
12
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-c5152dfc.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
9
9
|
require('./isDarkColor-5efc8367.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-c5152dfc.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
require('./handleFetch-45e76490.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-c5152dfc.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');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-c5152dfc.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');
|
|
@@ -4,7 +4,7 @@ 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-c5152dfc.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
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-c5152dfc.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-a4395972.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
9
|
require('./handleFetch-45e76490.js');
|
|
@@ -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-
|
|
8
|
+
const cart = require('./cart-c5152dfc.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-45e76490.js');
|
|
10
|
-
const paypal = require('./paypal-
|
|
10
|
+
const paypal = require('./paypal-922c7e45.js');
|
|
11
11
|
require('./isDarkColor-5efc8367.js');
|
|
12
12
|
require('./getBorderRadius-5a64574c.js');
|
|
13
13
|
|
|
@@ -40,14 +40,14 @@ export class ZonosCartSubtotal {
|
|
|
40
40
|
};
|
|
41
41
|
const renderLandedCost = () => {
|
|
42
42
|
if (cartStore.landedCostMethod === 'DAP') {
|
|
43
|
-
return (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), cartStore.dutiesTaxesFeesEstimate
|
|
43
|
+
return (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), cartStore.dutiesTaxesFeesEstimate !== null
|
|
44
44
|
? `${translate('Estimated')} ${currencyFormat({
|
|
45
45
|
amount: cartStore.dutiesTaxesFeesEstimate,
|
|
46
46
|
currency: cartStore.currency,
|
|
47
47
|
})}`
|
|
48
48
|
: '-'), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, translate('Due at delivery')))));
|
|
49
49
|
}
|
|
50
|
-
return (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('Nothing due at the door'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxesFees
|
|
50
|
+
return (h(Fragment, null, h("td", { class: "zonos--column zonos--cart-subtotal-title" }, h("zonos-text", { class: "zonos--title", type: "semiBoldLabel" }, translate('Duties, taxes, and fees')), h("zonos-text", { class: "zonos--caption", type: "caption" }, translate('Nothing due at the door'))), h("td", { class: "zonos--column zonos--cart-subtotal-price" }, h("div", { class: "zonos--cart-duty-tax-price" }, cartStore.dutiesTaxesFees !== null
|
|
51
51
|
? currencyFormat({
|
|
52
52
|
amount: cartStore.dutiesTaxesFees,
|
|
53
53
|
currency: cartStore.currency,
|
|
@@ -146,13 +146,13 @@ export class ZonosShipping {
|
|
|
146
146
|
if (this.showErrorBanner) {
|
|
147
147
|
this.showErrorBanner = !this.handleValidate();
|
|
148
148
|
}
|
|
149
|
-
return (h(Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !allServiceLevels.length ? (h("zonos-banner", { bannerTitle: translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (h("div", { class: "zonos--shipping-options-wrapper" }, h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }),
|
|
150
|
-
|
|
149
|
+
return (h(Host, { key: 'e376545666893a373bca1591083a868892804fb1', class: "zonos--shipping zonos--elements" }, h("div", { key: 'f8901d3d8fbeb6a285a7a33b9cea940476413c68', class: "zonos--group" }, h("zonos-text", { key: '83e02010c5e11647064ebf28468def163dd3395a', class: "zonos--title", type: "semiBoldSubheader" }, translate('Delivery options')), this.showErrorBanner && !!allServiceLevels.length && (h("zonos-banner", { key: 'e65f0ce2e968612bd7c1efeca8309e69a03a8c65', class: "zonos--error-banner", intent: "error" }, translate('No shipping method selected'))), h("zonos-text", { key: 'cdae794614c6879477e96de435d5c4e59f469fe9', class: "zonos--shipping-method-title", type: "semiBoldLabel" }, translate('Shipping method')), !allServiceLevels.length ? (h("zonos-banner", { bannerTitle: translate('No shipping methods found - please review and update your address details by selecting the "Customer" tab above. If you continue to encounter issues, contact our support team for assistance.'), class: "zonos--shipping-method-error", intent: "error" })) : (h("div", { class: "zonos--shipping-options-wrapper" }, h("zonos-shipping-rich-radio", { items: defaultShownServiceLevels, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }), !!defaultShownServiceLevels.length &&
|
|
150
|
+
!!this.serviceLevelsDAP.length && (h("button", { class: classes([
|
|
151
151
|
'zonos--shipping-options-collapse-trigger',
|
|
152
152
|
this.collapsedDAPOptions && 'collapsed',
|
|
153
153
|
]), onClick: () => {
|
|
154
154
|
this.collapsedDAPOptions = !this.collapsedDAPOptions;
|
|
155
|
-
} }, h("div", { class: "zonos--title-wrapper" }, h("zonos-text", { type: "label" }, `${translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), h("zonos-icon", { content: ChevronUpIcon })))), h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, h("div", { class: "zonos--dap-wrapper" }, h("zonos-banner", { bannerTitle: translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translate('You may incur additional fees from the shipping carrier by not prepaying.')), h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), h("div", { key: '
|
|
155
|
+
} }, h("div", { class: "zonos--title-wrapper" }, h("zonos-text", { type: "label" }, `${translate(this.collapsedDAPOptions ? 'Show non-prepaid options' : 'Hide non-prepaid options')} `), h("zonos-icon", { content: ChevronUpIcon })))), h("zonos-collapse", { collapsed: this.collapsedDAPOptions }, h("div", { class: "zonos--dap-wrapper" }, h("zonos-banner", { bannerTitle: translate('Duties and taxes will be charged upon delivery.'), intent: "warning" }, translate('You may incur additional fees from the shipping carrier by not prepaying.')), h("zonos-shipping-rich-radio", { items: this.serviceLevelsDAP, onRadioSelected: e => this.handleRadioSelected(e), selectedItem: this.selectedShippingMethod }))))), h("div", { key: '2dded1f7168a16ed6432ea0b147b8ec78fd774a6', class: "zonos--group-btn" }, h("zonos-button", { key: '54c05db9336209c34a7c7c518bbdf859e97b51f1', backgroundColor: this.submitBtnColor, loading: this.continueLoading || this.isSelecting, onClick: () => this.continueClickHandler(), size: "lg",
|
|
156
156
|
// use primary type when on mobile mode
|
|
157
157
|
variant: this.submitBtnType }, translate('Go to payment'))))));
|
|
158
158
|
}
|
|
@@ -13,8 +13,8 @@ const { onChange, reset, state: cartStore, } = createStore(() => ({
|
|
|
13
13
|
checkoutTimeoutInterval: null,
|
|
14
14
|
currency: 'USD',
|
|
15
15
|
doneSteps: [],
|
|
16
|
-
dutiesTaxesFees:
|
|
17
|
-
dutiesTaxesFeesEstimate:
|
|
16
|
+
dutiesTaxesFees: null,
|
|
17
|
+
dutiesTaxesFeesEstimate: null,
|
|
18
18
|
error: null,
|
|
19
19
|
exchangeRate: null,
|
|
20
20
|
externalConfirmationPageURL: null,
|
|
@@ -138,15 +138,16 @@ const cartStoreUpdateToErrorState = ({ messages, title, }) => {
|
|
|
138
138
|
title,
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
|
-
const cartStoreApplySubtotals = (subtotals,
|
|
141
|
+
const cartStoreApplySubtotals = ({ dutiesTaxesFeesEstimate, method, subtotals, }) => {
|
|
142
142
|
// update exchange rate so we can use it to display cart items
|
|
143
143
|
cartStore.exchangeRate = subtotals.exchangeRate;
|
|
144
144
|
cartStore.adjustmentTotal = subtotals.adjustments;
|
|
145
|
-
cartStore.dutiesTaxesFees =
|
|
145
|
+
cartStore.dutiesTaxesFees =
|
|
146
|
+
method === 'DAP' ? null : subtotals.landedCostTotal;
|
|
146
147
|
cartStore.subtotal = subtotals.items;
|
|
147
148
|
cartStore.total = subtotals.total;
|
|
148
149
|
cartStore.currency = subtotals.presentmentCurrencyCode;
|
|
149
|
-
cartStore.dutiesTaxesFeesEstimate = dutiesTaxesFeesEstimate ||
|
|
150
|
+
cartStore.dutiesTaxesFeesEstimate = dutiesTaxesFeesEstimate || null;
|
|
150
151
|
};
|
|
151
152
|
/**
|
|
152
153
|
* Detect if there are any items in cart that are not restricted and have positive amount, exclude negative amount items
|
|
@@ -170,10 +171,15 @@ const cartStoreSetCheckoutSession = (checkoutSession) => {
|
|
|
170
171
|
}
|
|
171
172
|
};
|
|
172
173
|
const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency, dutiesTaxesFeesEstimate, itemsAmount, landedCostId, }) => {
|
|
174
|
+
var _a;
|
|
173
175
|
if (landedCostId && cartStore.selectedLandedCost) {
|
|
174
176
|
// update cart total right away if we have landed cost id to avoid order total flickering
|
|
175
177
|
const subtotals = cartStore.selectedLandedCost.subtotals;
|
|
176
|
-
cartStoreApplySubtotals(
|
|
178
|
+
cartStoreApplySubtotals({
|
|
179
|
+
dutiesTaxesFeesEstimate,
|
|
180
|
+
method: cartStore.landedCostMethod,
|
|
181
|
+
subtotals,
|
|
182
|
+
});
|
|
177
183
|
log('Exchange rate updated for cart items (landed cost subtotal)', 'info', cartStore.exchangeRate);
|
|
178
184
|
}
|
|
179
185
|
// update checkout session
|
|
@@ -204,7 +210,10 @@ const cartStoreReCalculateTotal = async ({ adjustmentsAmount, cartId, currency,
|
|
|
204
210
|
if (!landedCostId) {
|
|
205
211
|
// This is when we first open the checkout modal and we just want to get info from the old cart session.
|
|
206
212
|
// use subtotals from checkout session to update cart total
|
|
207
|
-
cartStoreApplySubtotals(
|
|
213
|
+
cartStoreApplySubtotals({
|
|
214
|
+
method: ((_a = json.checkoutSessionUpdate.landedCost) === null || _a === void 0 ? void 0 : _a.method) || 'DDP',
|
|
215
|
+
subtotals: json.checkoutSessionUpdate.subtotals,
|
|
216
|
+
});
|
|
208
217
|
log('Exchange rate updated for cart items (checkout session update)', 'info', cartStore.exchangeRate);
|
|
209
218
|
}
|
|
210
219
|
cartStoreSetCheckoutSession(json.checkoutSessionUpdate);
|
|
@@ -229,12 +238,13 @@ const cartStoreUpdateSelectedShippingOption = async (selectedShippingOption, lan
|
|
|
229
238
|
// do nothing if we can't find landed cost for selected shipping option
|
|
230
239
|
return false;
|
|
231
240
|
}
|
|
232
|
-
// If the quote is DAP,
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
const
|
|
241
|
+
// If the quote is DAP, then convert manually.
|
|
242
|
+
const landedCostAmount = ((_b = selectedLandedCost.landedCost.amountSubtotals) === null || _b === void 0 ? void 0 : _b.landedCostTotal) || 0;
|
|
243
|
+
// Convert using checkout presentment exchange rate
|
|
244
|
+
const exchangeRate = selectedLandedCost.subtotals.exchangeRate.rate;
|
|
245
|
+
const dutiesTaxesFeesEstimate = landedCostAmount * exchangeRate;
|
|
236
246
|
if (dutiesTaxesFeesEstimate) {
|
|
237
|
-
log(`DAP quote, using estimate
|
|
247
|
+
log(`DAP quote, using estimate: ${dutiesTaxesFeesEstimate}`, 'info');
|
|
238
248
|
}
|
|
239
249
|
cartStore.landedCostMethod = selectedLandedCost.landedCost.method || 'DDP';
|
|
240
250
|
// update shipping value and dutiesTaxFees on selectedShippingOption change
|
|
@@ -243,13 +243,16 @@ const stripeStorePrefetchLandedCost = async (params) => {
|
|
|
243
243
|
if (subtotals) {
|
|
244
244
|
// prefetch landed cost will not update shipping and taxes since we haven't selected shipping method yet
|
|
245
245
|
cartStoreApplySubtotals({
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
246
|
+
method: (matchLandedCost === null || matchLandedCost === void 0 ? void 0 : matchLandedCost.landedCost.method) || 'DDP',
|
|
247
|
+
subtotals: {
|
|
248
|
+
adjustments: subtotals.adjustments,
|
|
249
|
+
exchangeRate: subtotals.exchangeRate,
|
|
250
|
+
items: subtotals.items,
|
|
251
|
+
landedCostTotal: subtotals.landedCostTotal,
|
|
252
|
+
presentmentCurrencyCode: subtotals.presentmentCurrencyCode,
|
|
253
|
+
shipping: subtotals.shipping,
|
|
254
|
+
total: subtotals.total,
|
|
255
|
+
},
|
|
253
256
|
});
|
|
254
257
|
}
|
|
255
258
|
}
|
|
@@ -407,7 +410,7 @@ const stripeStoreConfirmPayment = async () => {
|
|
|
407
410
|
* @returns {boolean} whether or not the checkout session is successfully created
|
|
408
411
|
*/
|
|
409
412
|
const stripeStoreInitCheckoutSession = async () => {
|
|
410
|
-
var _a;
|
|
413
|
+
var _a, _b;
|
|
411
414
|
const total = cartStore.items.reduce((amount, item) => amount + item.amount * item.quantity, 0);
|
|
412
415
|
if (!total || !localizationStore.targetCurrency) {
|
|
413
416
|
logError('Failed to create checkout session - invalid total or currency');
|
|
@@ -435,7 +438,10 @@ const stripeStoreInitCheckoutSession = async () => {
|
|
|
435
438
|
// update cart store with updated information
|
|
436
439
|
cartStoreSetCheckoutSession(result);
|
|
437
440
|
stripeStore.clientSecret = result.clientSecret;
|
|
438
|
-
cartStoreApplySubtotals(
|
|
441
|
+
cartStoreApplySubtotals({
|
|
442
|
+
method: ((_b = result.landedCost) === null || _b === void 0 ? void 0 : _b.method) || 'DDP',
|
|
443
|
+
subtotals: Object.assign(Object.assign({}, result.subtotals), { landedCostTotal: 0, shipping: 0, total: result.subtotals.items }),
|
|
444
|
+
});
|
|
439
445
|
log('Exchange rate updated for cart items (checkout session create)', 'info', cartStore.exchangeRate);
|
|
440
446
|
log('done-init-checkout-session');
|
|
441
447
|
return true;
|
|
@@ -466,6 +466,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
466
466
|
createScriptLoadEvent(variables, requestHeaders) {
|
|
467
467
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'createScriptLoadEvent', 'mutation');
|
|
468
468
|
},
|
|
469
|
+
createStoreVersionSetting(variables, requestHeaders) {
|
|
470
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'createStoreVersionSetting', 'mutation');
|
|
471
|
+
},
|
|
469
472
|
deleteAllStoreReserveOrders(variables, requestHeaders) {
|
|
470
473
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'deleteAllStoreReserveOrders', 'mutation');
|
|
471
474
|
},
|
|
@@ -514,8 +517,8 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
514
517
|
localeCountryMessages(variables, requestHeaders) {
|
|
515
518
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'localeCountryMessages', 'query');
|
|
516
519
|
},
|
|
517
|
-
|
|
518
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), '
|
|
520
|
+
storeVersionSetting(variables, requestHeaders) {
|
|
521
|
+
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'storeVersionSetting', 'query');
|
|
519
522
|
},
|
|
520
523
|
updateReserveOrder(variables, requestHeaders) {
|
|
521
524
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'updateReserveOrder', 'mutation');
|
|
@@ -523,8 +526,5 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
523
526
|
upsertBigCommerceSettings(variables, requestHeaders) {
|
|
524
527
|
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'upsertBigCommerceSettings', 'mutation');
|
|
525
528
|
},
|
|
526
|
-
zonosElementsSetting(variables, requestHeaders) {
|
|
527
|
-
return withWrapper(wrappedRequestHeaders => client.request('', variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'zonosElementsSetting', 'query');
|
|
528
|
-
},
|
|
529
529
|
};
|
|
530
530
|
}
|