@zonos/elements 1.3.257 → 1.3.259
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-cd0a054b.js → cart-c618fd5b.js} +1 -1
- package/dist/cjs/{hasInclusivePrice-3650109c.js → hasInclusivePrice-58a9f15d.js} +1 -1
- package/dist/cjs/index.cjs.js +7 -7
- package/dist/cjs/{invoice-1cea739b.js → invoice-c9cb6683.js} +2 -2
- package/dist/cjs/{isCollectMobileTablet-65c71740.js → isCollectMobileTablet-93a5194a.js} +2 -2
- package/dist/cjs/{localization-adaab93f.js → localization-5994d4de.js} +25 -3
- package/dist/cjs/{paypal-326d7bc5.js → paypal-091e089e.js} +2 -2
- package/dist/cjs/{placeTestOrder-53f2fe97.js → placeTestOrder-b07f8edb.js} +2 -2
- package/dist/cjs/{renderCheckoutCurrency-cf2e3b93.js → renderCheckoutCurrency-7876a1d4.js} +2 -2
- package/dist/cjs/zonos-address-display_8.cjs.entry.js +2 -2
- package/dist/cjs/zonos-address_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-card_5.cjs.entry.js +3 -3
- package/dist/cjs/zonos-cart-items_12.cjs.entry.js +6 -6
- package/dist/cjs/zonos-checkout.cjs.entry.js +442 -17
- package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +2 -2
- package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +6 -6
- package/dist/cjs/zonos-collect.cjs.entry.js +4 -4
- package/dist/cjs/zonos-controller.cjs.entry.js +2 -2
- 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 +45 -12
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +6 -6
- package/dist/cjs/zonos-invoice.cjs.entry.js +4 -4
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-store-credit.cjs.entry.js +3 -3
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +72 -0
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +43 -10
- package/dist/collection/components/store/hello/localization.js +25 -3
- package/dist/collection/components/utils/checkout/bigcommerceStorefrontApi.js +6 -0
- package/dist/collection/components/utils/checkout/buildBigcommerceLoginUrl.js +65 -0
- package/dist/collection/components/utils/checkout/checkBigCommerceBypassCustomerGroup.js +12 -7
- package/dist/collection/components/utils/checkout/checkBigCommerceForceLogin.js +116 -0
- package/dist/collection/components/utils/checkout/fetchBigCommerceCheckoutSettings.js +92 -0
- package/dist/collection/components/utils/checkout/fixBigCommerceLoginCreateAccountLink.js +53 -0
- package/dist/collection/components/utils/checkout/watchImmediateBigcommerceDomesticCheckoutRedirect.js +40 -7
- package/dist/collection/types/checkout/api/BigCommerceCheckoutSettings.js +1 -0
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +39 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/esm/{cart-4cd47a1b.js → cart-76fb528f.js} +1 -1
- package/dist/esm/{hasInclusivePrice-7a3dc4c3.js → hasInclusivePrice-275b1048.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{invoice-03ff7bbb.js → invoice-9efcb941.js} +2 -2
- package/dist/esm/{isCollectMobileTablet-9eb77c9a.js → isCollectMobileTablet-a7e5b909.js} +2 -2
- package/dist/esm/{localization-79e08480.js → localization-76ce3e29.js} +25 -3
- package/dist/esm/{paypal-67c86683.js → paypal-75c5c66d.js} +2 -2
- package/dist/esm/{placeTestOrder-e81fff15.js → placeTestOrder-22633bf2.js} +2 -2
- package/dist/esm/{renderCheckoutCurrency-1fc00db4.js → renderCheckoutCurrency-d27b0082.js} +2 -2
- package/dist/esm/zonos-address-display_8.entry.js +2 -2
- package/dist/esm/zonos-address_4.entry.js +2 -2
- package/dist/esm/zonos-card_5.entry.js +3 -3
- package/dist/esm/zonos-cart-items_12.entry.js +6 -6
- package/dist/esm/zonos-checkout.entry.js +443 -18
- package/dist/esm/zonos-collect-cart-items_3.entry.js +2 -2
- package/dist/esm/zonos-collect-finish_6.entry.js +6 -6
- package/dist/esm/zonos-collect.entry.js +4 -4
- package/dist/esm/zonos-controller.entry.js +2 -2
- 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 +45 -12
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-invoice-cart-items_2.entry.js +4 -4
- package/dist/esm/zonos-invoice-finish_5.entry.js +6 -6
- package/dist/esm/zonos-invoice.entry.js +4 -4
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-store-credit.entry.js +3 -3
- package/dist/esm-es5/{cart-4cd47a1b.js → cart-76fb528f.js} +1 -1
- package/dist/esm-es5/{hasInclusivePrice-7a3dc4c3.js → hasInclusivePrice-275b1048.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{invoice-03ff7bbb.js → invoice-9efcb941.js} +1 -1
- package/dist/esm-es5/{isCollectMobileTablet-9eb77c9a.js → isCollectMobileTablet-a7e5b909.js} +1 -1
- package/dist/esm-es5/{localization-79e08480.js → localization-76ce3e29.js} +1 -1
- package/dist/esm-es5/{paypal-67c86683.js → paypal-75c5c66d.js} +2 -2
- package/dist/esm-es5/{placeTestOrder-e81fff15.js → placeTestOrder-22633bf2.js} +1 -1
- package/dist/esm-es5/{renderCheckoutCurrency-1fc00db4.js → renderCheckoutCurrency-d27b0082.js} +1 -1
- package/dist/esm-es5/zonos-address-display_8.entry.js +1 -1
- package/dist/esm-es5/zonos-address_4.entry.js +1 -1
- package/dist/esm-es5/zonos-card_5.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-collect-cart-items_3.entry.js +1 -1
- package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
- package/dist/esm-es5/zonos-collect.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-invoice-cart-items_2.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
- package/dist/esm-es5/zonos-invoice.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-store-credit.entry.js +1 -1
- package/dist/scripts/index.d.ts +21 -5
- 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/checkout/zonos-checkout/zonos-checkout.d.ts +16 -0
- package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog.d.ts +6 -0
- package/dist/types/components/utils/api/getLocaleMessages.d.ts +1 -1
- package/dist/types/components/utils/checkout/bigcommerceStorefrontApi.d.ts +6 -0
- package/dist/types/components/utils/checkout/buildBigcommerceLoginUrl.d.ts +27 -0
- package/dist/types/components/utils/checkout/checkBigCommerceBypassCustomerGroup.d.ts +12 -0
- package/dist/types/components/utils/checkout/checkBigCommerceForceLogin.d.ts +50 -0
- package/dist/types/components/utils/checkout/fetchBigCommerceCheckoutSettings.d.ts +18 -0
- package/dist/types/components/utils/checkout/fixBigCommerceLoginCreateAccountLink.d.ts +17 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +6 -5
- package/dist/types/types/checkout/CheckoutConfig.d.ts +9 -0
- package/dist/types/types/checkout/api/BigCommerceCheckoutSettings.d.ts +12 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +3 -1
- package/dist/types/types/generated/graphql.frontend.types.ts +3 -1
- package/dist/types/types/generated/graphql.internal.types.d.ts +58 -9
- package/dist/types/types/generated/graphql.internal.types.ts +69 -9
- package/dist/types/types/index.d.ts +1 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-aa3e3438.system.entry.js → p-055c8d6c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ce2fd652.entry.js → p-0a9741f7.entry.js} +1 -1
- package/dist/zonos-elements/{p-3fc43187.system.entry.js → p-10da499b.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2c1c6d60.system.entry.js → p-14d35979.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-271eebd3.system.js → p-1523f6a8.system.js} +1 -1
- package/dist/zonos-elements/{p-c585d169.entry.js → p-1661f938.entry.js} +1 -1
- package/dist/zonos-elements/{p-3092ec40.system.entry.js → p-1e9e284e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7559c494.js → p-1ebb59a3.js} +1 -1
- package/dist/zonos-elements/{p-4e2262e8.js → p-24f41959.js} +1 -1
- package/dist/zonos-elements/p-29b60bf3.system.js +1 -1
- package/dist/zonos-elements/{p-0ca6ee9b.entry.js → p-29d16ad0.entry.js} +1 -1
- package/dist/zonos-elements/{p-0f4822cc.system.entry.js → p-2b2b1c8c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-91eeccaa.entry.js → p-2d854a75.entry.js} +1 -1
- package/dist/zonos-elements/{p-a90c977a.system.js → p-2ec799e4.system.js} +1 -1
- package/dist/zonos-elements/{p-d0690cdc.system.js → p-3600280d.system.js} +1 -1
- package/dist/zonos-elements/p-3ee8496e.js +1 -0
- package/dist/zonos-elements/{p-21519ebe.entry.js → p-425f747b.entry.js} +1 -1
- package/dist/zonos-elements/p-439dc620.system.entry.js +1 -0
- package/dist/zonos-elements/{p-9f3aab4e.system.entry.js → p-4b138a6e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7aeb496e.entry.js → p-5262f6e8.entry.js} +1 -1
- package/dist/zonos-elements/{p-b53856bf.system.js → p-567abb43.system.js} +1 -1
- package/dist/zonos-elements/{p-9d435f12.system.entry.js → p-5fa3d1c8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e9f36d6b.system.entry.js → p-6cf8fe49.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8adc0a13.system.js → p-6d36b307.system.js} +1 -1
- package/dist/zonos-elements/{p-380143db.entry.js → p-6e50f6f5.entry.js} +1 -1
- package/dist/zonos-elements/{p-80ba5f70.entry.js → p-7157a5a3.entry.js} +1 -1
- package/dist/zonos-elements/{p-3675766a.entry.js → p-788c6839.entry.js} +1 -1
- package/dist/zonos-elements/{p-a7b0345b.entry.js → p-791e13e7.entry.js} +1 -1
- package/dist/zonos-elements/{p-e173fbd1.system.entry.js → p-8585c761.system.entry.js} +1 -1
- package/dist/zonos-elements/p-868a8667.js +1 -0
- package/dist/zonos-elements/{p-c2139758.entry.js → p-9460919d.entry.js} +1 -1
- package/dist/zonos-elements/{p-6b83ac7f.entry.js → p-99d92a84.entry.js} +1 -1
- package/dist/zonos-elements/{p-0740f8a4.system.entry.js → p-9a9c9441.system.entry.js} +1 -1
- package/dist/zonos-elements/p-9cbac993.entry.js +1 -0
- package/dist/zonos-elements/{p-a60544cc.entry.js → p-9cff66a7.entry.js} +1 -1
- package/dist/zonos-elements/{p-b3824361.entry.js → p-a0f6910c.entry.js} +1 -1
- package/dist/zonos-elements/{p-7caa75bb.js → p-a18adf27.js} +1 -1
- package/dist/zonos-elements/{p-8b35e475.system.entry.js → p-a4b6865d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c23e2501.system.entry.js → p-a89096d6.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e3f9779a.system.entry.js → p-afca19b0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-429c1d0c.entry.js → p-afdb4445.entry.js} +1 -1
- package/dist/zonos-elements/{p-4a84387a.system.entry.js → p-b34f1336.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5818f4a7.entry.js → p-bba9af4c.entry.js} +1 -1
- package/dist/zonos-elements/{p-e62342c3.js → p-bd938f80.js} +1 -1
- package/dist/zonos-elements/{p-8ed0fad5.js → p-bdb3f7a2.js} +2 -2
- package/dist/zonos-elements/p-c85e988d.system.js +1 -0
- package/dist/zonos-elements/{p-e5f5b086.system.js → p-cc645667.system.js} +1 -1
- package/dist/zonos-elements/p-d13120f6.entry.js +1 -0
- package/dist/zonos-elements/{p-e80832cb.system.entry.js → p-e5f48239.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-22bb7836.system.js → p-e6168c82.system.js} +1 -1
- package/dist/zonos-elements/{p-e56f5954.system.js → p-e8a68ce7.system.js} +1 -1
- package/dist/zonos-elements/p-ed03b7fd.js +1 -0
- package/dist/zonos-elements/{p-b414b484.system.entry.js → p-edb0306c.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e6feafc1.system.entry.js → p-f4e54f09.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/zonos-elements/p-0e83d193.js +0 -1
- package/dist/zonos-elements/p-6bcbe651.js +0 -1
- package/dist/zonos-elements/p-7cbbf483.system.js +0 -1
- package/dist/zonos-elements/p-ac7b93c9.js +0 -1
- package/dist/zonos-elements/p-da7e1143.system.entry.js +0 -1
- package/dist/zonos-elements/p-ddb27b4a.entry.js +0 -1
- package/dist/zonos-elements/p-fed19033.entry.js +0 -1
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-5994d4de.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-1c517e55.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
10
|
-
const hasInclusivePrice = require('./hasInclusivePrice-
|
|
10
|
+
const hasInclusivePrice = require('./hasInclusivePrice-58a9f15d.js');
|
|
11
11
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
12
12
|
const TaxId = require('./TaxId-12acedde.js');
|
|
13
13
|
require('./handleFetch-954f30e1.js');
|
|
@@ -112,6 +112,17 @@ const ZonosHelloDialog = class {
|
|
|
112
112
|
var _a;
|
|
113
113
|
return (_a = localization.localizationStore.countryLandedCost) === null || _a === void 0 ? void 0 : _a.hasTaxId;
|
|
114
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Selected country is configured as a domestic country for the merchant,
|
|
117
|
+
* meaning the order ships within the merchant's origin country and no
|
|
118
|
+
* duty will be assessed on it.
|
|
119
|
+
*/
|
|
120
|
+
this.isDomesticCountry = () => {
|
|
121
|
+
var _a, _b;
|
|
122
|
+
const { selectedCountryCode } = localization.localizationStore;
|
|
123
|
+
return (!!selectedCountryCode &&
|
|
124
|
+
!!((_b = (_a = zonosStore.zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.domesticCountries) === null || _b === void 0 ? void 0 : _b.includes(selectedCountryCode)));
|
|
125
|
+
};
|
|
115
126
|
/**
|
|
116
127
|
* Some countries don't have threshold. So we need to show generic message for them
|
|
117
128
|
*/
|
|
@@ -131,6 +142,11 @@ const ZonosHelloDialog = class {
|
|
|
131
142
|
return countryCodes.includes(countryCode);
|
|
132
143
|
};
|
|
133
144
|
this.getDutyMessage = () => {
|
|
145
|
+
// Domestic orders stay within the merchant's origin country, so no
|
|
146
|
+
// duty is ever assessed — skip the de minimis message.
|
|
147
|
+
if (this.isDomesticCountry()) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
134
150
|
const countryLandedCost = localization.localizationStore.countryLandedCost;
|
|
135
151
|
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that duties will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
136
152
|
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
@@ -150,6 +166,11 @@ const ZonosHelloDialog = class {
|
|
|
150
166
|
};
|
|
151
167
|
this.getTaxMessage = () => {
|
|
152
168
|
const { countryLandedCost } = localization.localizationStore;
|
|
169
|
+
// Domestic orders stay within the merchant's origin country, so no
|
|
170
|
+
// import tax is ever assessed — skip the de minimis message.
|
|
171
|
+
if (this.isDomesticCountry()) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
153
174
|
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that taxes will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
154
175
|
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
155
176
|
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
@@ -277,12 +298,7 @@ const ZonosHelloDialog = class {
|
|
|
277
298
|
}
|
|
278
299
|
return null;
|
|
279
300
|
};
|
|
280
|
-
this.renderHelloMessage = () => {
|
|
281
|
-
// If deminimis is undefined or null, assume it's $0
|
|
282
|
-
const dutyDeMinimisMessage = this.getDutyMessage();
|
|
283
|
-
// If deminimis is undefined or null, assume it's $0
|
|
284
|
-
const taxDeMinimisMessage = this.getTaxMessage();
|
|
285
|
-
const inclusivePriceMessage = this.getInclusivePriceMessage();
|
|
301
|
+
this.renderHelloMessage = ({ dutyDeMinimisMessage, inclusivePriceMessage, taxDeMinimisMessage, }) => {
|
|
286
302
|
if (hasInclusivePrice.hasInclusivePrice() && inclusivePriceMessage) {
|
|
287
303
|
switch (inclusivePriceMessage.inclusiveType) {
|
|
288
304
|
case 'DUTIES_FEES': {
|
|
@@ -306,6 +322,11 @@ const ZonosHelloDialog = class {
|
|
|
306
322
|
if (!localization.localizationStore.countryLandedCost) {
|
|
307
323
|
return null;
|
|
308
324
|
}
|
|
325
|
+
// Domestic orders aren't subject to the foreign import-tax regimes these
|
|
326
|
+
// additional messages describe (e.g., UK/EU IOSS, AU/NZ/SG GST).
|
|
327
|
+
if (this.isDomesticCountry()) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
309
330
|
// only show the message if the store has a tax id for selected country
|
|
310
331
|
if (!this.hasTaxId()) {
|
|
311
332
|
return null;
|
|
@@ -357,18 +378,30 @@ const ZonosHelloDialog = class {
|
|
|
357
378
|
const defaultMessage = formatStringWithLinks.formatStringWithLinks(defaultMessageStr);
|
|
358
379
|
const currentPage = this.getCurrentPageEnum();
|
|
359
380
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
360
|
-
|
|
381
|
+
// If deminimis is undefined or null, assume it's $0
|
|
382
|
+
const dutyDeMinimisMessage = this.getDutyMessage();
|
|
383
|
+
// If deminimis is undefined or null, assume it's $0
|
|
384
|
+
const taxDeMinimisMessage = this.getTaxMessage();
|
|
385
|
+
const inclusivePriceMessage = this.getInclusivePriceMessage();
|
|
386
|
+
return (index.h(index.Host, { key: '910b2b5600107a097fa4cdc77ec487e03fe6a8d2', class: "zonos--elements" }, index.h("div", { key: 'edf1d9b554807db1c973a1ccdb6e20a647c24204', class: classes.classes([
|
|
361
387
|
'zonos--hello-dialog',
|
|
362
388
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
363
389
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
364
390
|
!!this.mobileLocationOverride &&
|
|
365
391
|
'zonos--hello-dialog-mobile-override',
|
|
366
392
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
367
|
-
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (index.h("div", { key: '
|
|
393
|
+
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (index.h("div", { key: 'f5316102d12d07e1a3c701ad641995413ee445b2' }, index.h("div", { key: 'c11cc7e8d11f733c82435a531d7d8595b0237eae', class: "zonos--hello-dialog-content" }, index.h("zonos-button", { key: 'a2aa2802331e9ed5c40d877fcb7ffb0cebd318c5', class: "zonos--close-button", icon: index.h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), index.h("zonos-v-stack", { key: 'f6df6e6562b8ddebb0e910d669a6a263114f6407', spacing: 24 }, index.h("zonos-country-flag", { key: '71c320b3364deee7c545284a2fc639cef3a3ba27', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), index.h("zonos-v-stack", { key: '9603247163d334db33fe00428190fafdd6ef6c42', class: "zonos--hello-dialog-header", spacing: 4 }, index.h("zonos-text", { key: 'aad7fd909092a9fad15ce88a3f43ad5115bca1f9', type: "boldSubheader" }, welcomeMessage), index.h("zonos-text", { key: 'c3c9c5d5f9e1000b2b6c6aebc73f18c6653f9de2', innerHTML: defaultMessage, textColor: "gray-800" })), index.h("zonos-v-stack", { key: 'c34b1b9debb507ce6f230bd13b493a14af12e880', spacing: 8 }, this.restrictedItems.map(item => {
|
|
368
394
|
var _a;
|
|
369
395
|
return item && (index.h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (index.h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
370
|
-
}),
|
|
371
|
-
|
|
396
|
+
}), (dutyDeMinimisMessage ||
|
|
397
|
+
taxDeMinimisMessage ||
|
|
398
|
+
inclusivePriceMessage ||
|
|
399
|
+
!!(additionalInformation === null || additionalInformation === void 0 ? void 0 : additionalInformation.length)) && (index.h("zonos-card", { key: '5dc5af9af7263333433b8a0382a30ccf9f28056d', spacing: "12px" }, index.h("zonos-v-stack", { key: '725669eaca664abc90f5ec8181c3b81c05cc3b52', spacing: 12 }, this.renderHelloMessage({
|
|
400
|
+
dutyDeMinimisMessage,
|
|
401
|
+
inclusivePriceMessage,
|
|
402
|
+
taxDeMinimisMessage,
|
|
403
|
+
}), additionalInformation === null || additionalInformation === void 0 ? void 0 :
|
|
404
|
+
additionalInformation.map(info => (index.h("div", { class: "zonos--flex-message" }, index.h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), index.h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info }))))))), filteredMessages.map(x => (index.h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), index.h("zonos-hello-dialog-footer", { key: '077adfd58b2d7d95d5f352a09783089a1e91c99f', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (index.h("div", { key: '8c2dd5d73a649eebf1517a9b359d3ecc93b12620' }, index.h("zonos-country-select", { key: 'e2f64c73efe1e931808fdfe6aa5f8545d6f39c93', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (index.h("div", { key: '0b9ba684ac67fa652a34e6fbad8e966970f391ce' }, index.h("zonos-language-select", { key: '2e03e02459b0f31bc69376bc154ed8bb2d96ef56', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
|
|
372
405
|
}
|
|
373
406
|
static get assetsDirs() { return ["assets"]; }
|
|
374
407
|
static get watchers() { return {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
6
|
const debounce = require('./debounce-3e17b4e9.js');
|
|
7
|
-
const localization = require('./localization-
|
|
7
|
+
const localization = require('./localization-5994d4de.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-1c517e55.js');
|
|
9
9
|
const classes = require('./classes-b7918f56.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-954f30e1.js');
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
8
|
-
const renderCheckoutCurrency = require('./renderCheckoutCurrency-
|
|
6
|
+
const cart = require('./cart-c618fd5b.js');
|
|
7
|
+
const localization = require('./localization-5994d4de.js');
|
|
8
|
+
const renderCheckoutCurrency = require('./renderCheckoutCurrency-7876a1d4.js');
|
|
9
9
|
const classes = require('./classes-b7918f56.js');
|
|
10
|
-
const invoice = require('./invoice-
|
|
10
|
+
const invoice = require('./invoice-c9cb6683.js');
|
|
11
11
|
const renderFallback = require('./renderFallback-bc20ee20.js');
|
|
12
12
|
require('./zonosStore-1c517e55.js');
|
|
13
13
|
require('./VarianceTest-bec00ea8.js');
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
8
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-c618fd5b.js');
|
|
7
|
+
const paypal = require('./paypal-091e089e.js');
|
|
8
|
+
const localization = require('./localization-5994d4de.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-1c517e55.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-954f30e1.js');
|
|
11
11
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
@@ -15,9 +15,9 @@ const submitGtag = require('./submitGtag-9ac5a42e.js');
|
|
|
15
15
|
const isInvoiceMobileTablet = require('./isInvoiceMobileTablet-dde41e4e.js');
|
|
16
16
|
const classes = require('./classes-b7918f56.js');
|
|
17
17
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
18
|
-
const invoice = require('./invoice-
|
|
19
|
-
const renderCheckoutCurrency = require('./renderCheckoutCurrency-
|
|
20
|
-
const placeTestOrder = require('./placeTestOrder-
|
|
18
|
+
const invoice = require('./invoice-c9cb6683.js');
|
|
19
|
+
const renderCheckoutCurrency = require('./renderCheckoutCurrency-7876a1d4.js');
|
|
20
|
+
const placeTestOrder = require('./placeTestOrder-b07f8edb.js');
|
|
21
21
|
const renderFallback = require('./renderFallback-bc20ee20.js');
|
|
22
22
|
require('./isDarkColor-bfe6d1eb.js');
|
|
23
23
|
require('./isContrastColor-6a17f408.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const invoice = require('./invoice-
|
|
8
|
-
const paypal = require('./paypal-
|
|
9
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-c618fd5b.js');
|
|
7
|
+
const invoice = require('./invoice-c9cb6683.js');
|
|
8
|
+
const paypal = require('./paypal-091e089e.js');
|
|
9
|
+
const localization = require('./localization-5994d4de.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-1c517e55.js');
|
|
11
11
|
const buildCartItemsByTempCart = require('./buildCartItemsByTempCart-edddbf4b.js');
|
|
12
12
|
const handleFetch = require('./handleFetch-954f30e1.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-5994d4de.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-1c517e55.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
9
|
require('./handleFetch-954f30e1.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b1f95d96.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-c618fd5b.js');
|
|
7
|
+
const localization = require('./localization-5994d4de.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-1c517e55.js');
|
|
9
|
-
const renderCheckoutCurrency = require('./renderCheckoutCurrency-
|
|
9
|
+
const renderCheckoutCurrency = require('./renderCheckoutCurrency-7876a1d4.js');
|
|
10
10
|
const getBorderRadius = require('./getBorderRadius-db55a464.js');
|
|
11
11
|
require('./VarianceTest-bec00ea8.js');
|
|
12
12
|
require('./handleFetch-954f30e1.js');
|
|
@@ -13,8 +13,11 @@ import { selectVarianceTest } from "../../utils/api/selectVarianceTest";
|
|
|
13
13
|
import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
|
|
14
14
|
import { updateCheckoutSessionAttributes } from "../../utils/api/updateCheckoutSessionAttributes";
|
|
15
15
|
import { buildCartUrl } from "../../utils/buildCartUrl";
|
|
16
|
+
import { BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG } from "../../utils/checkout/buildBigcommerceLoginUrl";
|
|
16
17
|
import { buildBigcommerceRedirectUrl } from "../../utils/checkout/buildBigcommerceRedirectUrl";
|
|
17
18
|
import { checkBigCommerceBypassCustomerGroup, initBigCommerceBypassCheck, } from "../../utils/checkout/checkBigCommerceBypassCustomerGroup";
|
|
19
|
+
import { checkBigCommerceForceLogin, initBigCommerceForceLoginCheck, } from "../../utils/checkout/checkBigCommerceForceLogin";
|
|
20
|
+
import { fixBigCommerceLoginCreateAccountLink } from "../../utils/checkout/fixBigCommerceLoginCreateAccountLink";
|
|
18
21
|
import { getAbandonedCartRenewTokenValue } from "../../utils/checkout/getAbandonedCartRenewTokenValue";
|
|
19
22
|
import { getIsStagingMode } from "../../utils/checkout/getIsStagingMode";
|
|
20
23
|
import { getIsTestMode } from "../../utils/checkout/getIsTestMode";
|
|
@@ -790,6 +793,15 @@ export class ZonosCheckout {
|
|
|
790
793
|
window.location.href = buildBigcommerceRedirectUrl('/checkout');
|
|
791
794
|
return;
|
|
792
795
|
}
|
|
796
|
+
// Merchants who disable BC guest checkout need the shopper
|
|
797
|
+
// signed in before we open the Zonos international checkout.
|
|
798
|
+
// Redirecting here keeps the dialog from flashing before the
|
|
799
|
+
// login bounce.
|
|
800
|
+
const forceLogin = await checkBigCommerceForceLogin();
|
|
801
|
+
if (forceLogin.shouldForceLogin && forceLogin.redirectUrl) {
|
|
802
|
+
window.location.href = forceLogin.redirectUrl;
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
793
805
|
}
|
|
794
806
|
// start loading
|
|
795
807
|
stripeStore.isFetchingSession = true;
|
|
@@ -1042,6 +1054,19 @@ export class ZonosCheckout {
|
|
|
1042
1054
|
// Start fetching BigCommerce customer group on page load so the bypass
|
|
1043
1055
|
// result is ready by the time checkout opens or the BC watcher fires
|
|
1044
1056
|
initBigCommerceBypassCheck();
|
|
1057
|
+
// Warm the BigCommerce `/checkouts/settings` fetch (merchant's
|
|
1058
|
+
// `guest_checkout_type`) so force-login gating resolves instantly when
|
|
1059
|
+
// the shopper clicks checkout — otherwise the first checkout open
|
|
1060
|
+
// would block on a proxy round trip.
|
|
1061
|
+
initBigCommerceForceLoginCheck();
|
|
1062
|
+
// On BC's `/login.php`, rewrite the "Create account" button href so
|
|
1063
|
+
// the post-signup round trip preserves the `from=cart.php?...` flag
|
|
1064
|
+
// that carries the shopper back into Zonos international checkout.
|
|
1065
|
+
fixBigCommerceLoginCreateAccountLink();
|
|
1066
|
+
// If BC redirected the shopper back here after login with the Zonos
|
|
1067
|
+
// resume flag, auto-open the international checkout. Strip the flag
|
|
1068
|
+
// from the URL so a refresh doesn't keep re-triggering the dialog.
|
|
1069
|
+
this.handleBigcommerceInternationalResumeFlag();
|
|
1045
1070
|
// check if bigcommerce, if user enters the shipping address that's in the shipping zone at bigcommerce checkout
|
|
1046
1071
|
watchImmediateBigcommerceDomesticCheckoutRedirect({
|
|
1047
1072
|
domesticRedirectedBtnSelector: domesticRedirectedBtnSelector,
|
|
@@ -1123,6 +1148,53 @@ export class ZonosCheckout {
|
|
|
1123
1148
|
clearInterval(interval);
|
|
1124
1149
|
}, 10000);
|
|
1125
1150
|
}
|
|
1151
|
+
/**
|
|
1152
|
+
* After BigCommerce's `/login.php` round trip, the shopper lands back on
|
|
1153
|
+
* `cart.php?isInternationalCheckout=true`. Detect the flag, strip it from
|
|
1154
|
+
* the URL (so refreshing doesn't re-open the dialog), then fire the
|
|
1155
|
+
* international-checkout trigger once three preconditions are all met:
|
|
1156
|
+
* 1. Hello localization finished loading (`localizationLoaded`).
|
|
1157
|
+
* 2. A country code is selected — otherwise `buildCartDetail` runs
|
|
1158
|
+
* without a `countryCode` / `currencyCode` and never builds a cart.
|
|
1159
|
+
* 3. The hidden trigger button has mounted.
|
|
1160
|
+
*
|
|
1161
|
+
* Without the first two gates we race Hello's own init and the click
|
|
1162
|
+
* fires against a half-initialized store, which is what happens when
|
|
1163
|
+
* the shopper refreshes back into cart.php straight from the login
|
|
1164
|
+
* round trip.
|
|
1165
|
+
*/
|
|
1166
|
+
handleBigcommerceInternationalResumeFlag() {
|
|
1167
|
+
if (!window.Zonos.isBigCommerce) {
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
const url = new URL(window.location.href);
|
|
1171
|
+
if (url.searchParams.get(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG) !== 'true') {
|
|
1172
|
+
return;
|
|
1173
|
+
}
|
|
1174
|
+
url.searchParams.delete(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG);
|
|
1175
|
+
window.history.replaceState({}, '', url.toString());
|
|
1176
|
+
const start = Date.now();
|
|
1177
|
+
const interval = setInterval(() => {
|
|
1178
|
+
if (!localizationStore.localizationLoaded ||
|
|
1179
|
+
!localizationStore.selectedCountryCode) {
|
|
1180
|
+
if (Date.now() - start > 15000) {
|
|
1181
|
+
clearInterval(interval);
|
|
1182
|
+
log('BigCommerce international checkout resume flag: localization did not initialize within 15s', 'info');
|
|
1183
|
+
}
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
const btn = document.querySelector(`#${checkoutHiddenInternationalBtnSelector}`);
|
|
1187
|
+
if (btn) {
|
|
1188
|
+
clearInterval(interval);
|
|
1189
|
+
btn.dispatchEvent(createCustomEvent('click'));
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
if (Date.now() - start > 15000) {
|
|
1193
|
+
clearInterval(interval);
|
|
1194
|
+
log('BigCommerce international checkout resume flag: trigger button did not mount within 15s', 'info');
|
|
1195
|
+
}
|
|
1196
|
+
}, 200);
|
|
1197
|
+
}
|
|
1126
1198
|
/**
|
|
1127
1199
|
* For storybook to set to finish step, this is to trigger in the story for zonos-checkout-finish
|
|
1128
1200
|
*/
|
|
@@ -74,6 +74,17 @@ export class ZonosHelloDialog {
|
|
|
74
74
|
var _a;
|
|
75
75
|
return (_a = localizationStore.countryLandedCost) === null || _a === void 0 ? void 0 : _a.hasTaxId;
|
|
76
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Selected country is configured as a domestic country for the merchant,
|
|
79
|
+
* meaning the order ships within the merchant's origin country and no
|
|
80
|
+
* duty will be assessed on it.
|
|
81
|
+
*/
|
|
82
|
+
this.isDomesticCountry = () => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
const { selectedCountryCode } = localizationStore;
|
|
85
|
+
return (!!selectedCountryCode &&
|
|
86
|
+
!!((_b = (_a = zonosStore.genericSettings) === null || _a === void 0 ? void 0 : _a.domesticCountries) === null || _b === void 0 ? void 0 : _b.includes(selectedCountryCode)));
|
|
87
|
+
};
|
|
77
88
|
/**
|
|
78
89
|
* Some countries don't have threshold. So we need to show generic message for them
|
|
79
90
|
*/
|
|
@@ -93,6 +104,11 @@ export class ZonosHelloDialog {
|
|
|
93
104
|
return countryCodes.includes(countryCode);
|
|
94
105
|
};
|
|
95
106
|
this.getDutyMessage = () => {
|
|
107
|
+
// Domestic orders stay within the merchant's origin country, so no
|
|
108
|
+
// duty is ever assessed — skip the de minimis message.
|
|
109
|
+
if (this.isDomesticCountry()) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
96
112
|
const countryLandedCost = localizationStore.countryLandedCost;
|
|
97
113
|
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that duties will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
98
114
|
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
@@ -112,6 +128,11 @@ export class ZonosHelloDialog {
|
|
|
112
128
|
};
|
|
113
129
|
this.getTaxMessage = () => {
|
|
114
130
|
const { countryLandedCost } = localizationStore;
|
|
131
|
+
// Domestic orders stay within the merchant's origin country, so no
|
|
132
|
+
// import tax is ever assessed — skip the de minimis message.
|
|
133
|
+
if (this.isDomesticCountry()) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
115
136
|
// For GB, if the store doesn't allow low value orders, we would like to tell shopper that taxes will always apply as there would be a custom message saying "Orders to United Kingdom must be over .* to ship."
|
|
116
137
|
if (!(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.allowLowValueOrders) &&
|
|
117
138
|
(countryLandedCost === null || countryLandedCost === void 0 ? void 0 : countryLandedCost.countryCode) === 'GB') {
|
|
@@ -239,12 +260,7 @@ export class ZonosHelloDialog {
|
|
|
239
260
|
}
|
|
240
261
|
return null;
|
|
241
262
|
};
|
|
242
|
-
this.renderHelloMessage = () => {
|
|
243
|
-
// If deminimis is undefined or null, assume it's $0
|
|
244
|
-
const dutyDeMinimisMessage = this.getDutyMessage();
|
|
245
|
-
// If deminimis is undefined or null, assume it's $0
|
|
246
|
-
const taxDeMinimisMessage = this.getTaxMessage();
|
|
247
|
-
const inclusivePriceMessage = this.getInclusivePriceMessage();
|
|
263
|
+
this.renderHelloMessage = ({ dutyDeMinimisMessage, inclusivePriceMessage, taxDeMinimisMessage, }) => {
|
|
248
264
|
if (hasInclusivePrice() && inclusivePriceMessage) {
|
|
249
265
|
switch (inclusivePriceMessage.inclusiveType) {
|
|
250
266
|
case 'DUTIES_FEES': {
|
|
@@ -268,6 +284,11 @@ export class ZonosHelloDialog {
|
|
|
268
284
|
if (!localizationStore.countryLandedCost) {
|
|
269
285
|
return null;
|
|
270
286
|
}
|
|
287
|
+
// Domestic orders aren't subject to the foreign import-tax regimes these
|
|
288
|
+
// additional messages describe (e.g., UK/EU IOSS, AU/NZ/SG GST).
|
|
289
|
+
if (this.isDomesticCountry()) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
271
292
|
// only show the message if the store has a tax id for selected country
|
|
272
293
|
if (!this.hasTaxId()) {
|
|
273
294
|
return null;
|
|
@@ -319,18 +340,30 @@ export class ZonosHelloDialog {
|
|
|
319
340
|
const defaultMessage = formatStringWithLinks(defaultMessageStr);
|
|
320
341
|
const currentPage = this.getCurrentPageEnum();
|
|
321
342
|
const filteredMessages = customMessages.filter(x => x.pageName === currentPage);
|
|
322
|
-
|
|
343
|
+
// If deminimis is undefined or null, assume it's $0
|
|
344
|
+
const dutyDeMinimisMessage = this.getDutyMessage();
|
|
345
|
+
// If deminimis is undefined or null, assume it's $0
|
|
346
|
+
const taxDeMinimisMessage = this.getTaxMessage();
|
|
347
|
+
const inclusivePriceMessage = this.getInclusivePriceMessage();
|
|
348
|
+
return (h(Host, { key: '910b2b5600107a097fa4cdc77ec487e03fe6a8d2', class: "zonos--elements" }, h("div", { key: 'edf1d9b554807db1c973a1ccdb6e20a647c24204', class: classes([
|
|
323
349
|
'zonos--hello-dialog',
|
|
324
350
|
animateLeft && 'zonos--hello-dialog-animate-from-left',
|
|
325
351
|
animateFromBottom && 'zonos--hello-dialog-animate-from-bottom',
|
|
326
352
|
!!this.mobileLocationOverride &&
|
|
327
353
|
'zonos--hello-dialog-mobile-override',
|
|
328
354
|
this.isOpen && 'zonos--hello-dialog-open',
|
|
329
|
-
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: '
|
|
355
|
+
]), inert: !this.isOpen, ref: el => el && (this.dialogRef = el) }, !this.showCountrySelect && !this.showLanguageSelect && (h("div", { key: 'f5316102d12d07e1a3c701ad641995413ee445b2' }, h("div", { key: 'c11cc7e8d11f733c82435a531d7d8595b0237eae', class: "zonos--hello-dialog-content" }, h("zonos-button", { key: 'a2aa2802331e9ed5c40d877fcb7ffb0cebd318c5', class: "zonos--close-button", icon: h("zonos-icon", { "aria-label": "Close Zonos Hello dialog", content: RemoveIcon }), noBackground: true, onClick: () => this.setIsOpen(false) }), h("zonos-v-stack", { key: 'f6df6e6562b8ddebb0e910d669a6a263114f6407', spacing: 24 }, h("zonos-country-flag", { key: '71c320b3364deee7c545284a2fc639cef3a3ba27', class: "zonos--hello-country-flag", countryCode: selectedCountryCode }), h("zonos-v-stack", { key: '9603247163d334db33fe00428190fafdd6ef6c42', class: "zonos--hello-dialog-header", spacing: 4 }, h("zonos-text", { key: 'aad7fd909092a9fad15ce88a3f43ad5115bca1f9', type: "boldSubheader" }, welcomeMessage), h("zonos-text", { key: 'c3c9c5d5f9e1000b2b6c6aebc73f18c6653f9de2', innerHTML: defaultMessage, textColor: "gray-800" })), h("zonos-v-stack", { key: 'c34b1b9debb507ce6f230bd13b493a14af12e880', spacing: 8 }, this.restrictedItems.map(item => {
|
|
330
356
|
var _a;
|
|
331
357
|
return item && (h("zonos-banner", { bannerTitle: item.name, intent: "error" }, (_a = item.itemRestrictions) === null || _a === void 0 ? void 0 : _a.map(x => (h("zonos-text", { textColor: "red-800" }, x === null || x === void 0 ? void 0 : x.note)))));
|
|
332
|
-
}),
|
|
333
|
-
|
|
358
|
+
}), (dutyDeMinimisMessage ||
|
|
359
|
+
taxDeMinimisMessage ||
|
|
360
|
+
inclusivePriceMessage ||
|
|
361
|
+
!!(additionalInformation === null || additionalInformation === void 0 ? void 0 : additionalInformation.length)) && (h("zonos-card", { key: '5dc5af9af7263333433b8a0382a30ccf9f28056d', spacing: "12px" }, h("zonos-v-stack", { key: '725669eaca664abc90f5ec8181c3b81c05cc3b52', spacing: 12 }, this.renderHelloMessage({
|
|
362
|
+
dutyDeMinimisMessage,
|
|
363
|
+
inclusivePriceMessage,
|
|
364
|
+
taxDeMinimisMessage,
|
|
365
|
+
}), additionalInformation === null || additionalInformation === void 0 ? void 0 :
|
|
366
|
+
additionalInformation.map(info => (h("div", { class: "zonos--flex-message" }, h("zonos-icon", { "aria-label": "Additional information for buying goods from selected country icon", content: BagIcon }), h("zonos-text", { "aria-label": `Additional information for buying goods from selected country message`, innerHTML: info }))))))), filteredMessages.map(x => (h("zonos-custom-message", { icon: MessageIcon, message: x.message })))))), h("zonos-hello-dialog-footer", { key: '077adfd58b2d7d95d5f352a09783089a1e91c99f', appearanceSettings: this.appearanceSettings, setShowCountrySelect: value => this.setShowCountrySelect(value), setShowLanguageSelect: value => this.setShowLanguageSelect(value) }))), this.showCountrySelect && (h("div", { key: '8c2dd5d73a649eebf1517a9b359d3ecc93b12620' }, h("zonos-country-select", { key: 'e2f64c73efe1e931808fdfe6aa5f8545d6f39c93', handleOnClose: () => this.setShowCountrySelect(false) }))), this.showLanguageSelect && (h("div", { key: '0b9ba684ac67fa652a34e6fbad8e966970f391ce' }, h("zonos-language-select", { key: '2e03e02459b0f31bc69376bc154ed8bb2d96ef56', handleOnClose: () => this.setShowLanguageSelect(false) }))))));
|
|
334
367
|
}
|
|
335
368
|
static get is() { return "zonos-hello-dialog"; }
|
|
336
369
|
static get encapsulation() { return "shadow"; }
|
|
@@ -191,9 +191,31 @@ const localizationStoreUpdateSelectedCountryCode = ({ isInitializing, newSelecte
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
if (!currencyCode) {
|
|
194
|
-
// Non-shippable country:
|
|
195
|
-
//
|
|
196
|
-
|
|
194
|
+
// Non-shippable country: revert any previously-converted international
|
|
195
|
+
// prices back to the merchant's domestic (source) currency before bailing.
|
|
196
|
+
if (localizationStore.exchangeRateTimeout) {
|
|
197
|
+
clearTimeout(localizationStore.exchangeRateTimeout);
|
|
198
|
+
localizationStore.exchangeRateTimeout = undefined;
|
|
199
|
+
}
|
|
200
|
+
const sourceCurrency = zonosStore.sourceCurrency;
|
|
201
|
+
localizationStore.targetCurrency = sourceCurrency;
|
|
202
|
+
localizationStore.exchangeRate = {
|
|
203
|
+
rate: 1,
|
|
204
|
+
targetFormat: {
|
|
205
|
+
currencyCode: sourceCurrency,
|
|
206
|
+
decimalDelimiter: '.',
|
|
207
|
+
scale: 2,
|
|
208
|
+
symbol: '',
|
|
209
|
+
symbolLocation: 'before',
|
|
210
|
+
thousandsDelimiter: ',',
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
localizationStore.countryLandedCost = null;
|
|
214
|
+
localizationStore.inclusivePricingConfigurations = [];
|
|
215
|
+
currencyDisplay();
|
|
216
|
+
// Clear session so the next visit falls back to geolocation, but keep
|
|
217
|
+
// the current shopper's explicit selection visible in the URL (so a
|
|
218
|
+
// same-tab reload still honors it) and on the hello element.
|
|
197
219
|
window.sessionStorage.removeItem('zonos--country');
|
|
198
220
|
setZCountryUrlParam(selectedCountryCode);
|
|
199
221
|
(_b = document
|
|
@@ -50,3 +50,9 @@ export const fetchBigCommerceCheckout = async (checkoutId) => {
|
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Whether the BigCommerce shopper is already logged in. We key off the
|
|
55
|
+
* customer's numeric `id` since the storefront API populates it only for
|
|
56
|
+
* authenticated sessions (guest checkouts have an empty `customer` object).
|
|
57
|
+
*/
|
|
58
|
+
export const isBigCommerceCustomerLoggedIn = (checkout) => { var _a; return !!((_a = checkout === null || checkout === void 0 ? void 0 : checkout.customer) === null || _a === void 0 ? void 0 : _a.id); };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { getIsTestMode } from "./getIsTestMode";
|
|
2
|
+
/**
|
|
3
|
+
* The query flag that BigCommerce carries back to `cart.php` after the
|
|
4
|
+
* shopper logs in. When present, Zonos-elements knows to resume the
|
|
5
|
+
* international checkout flow instead of letting BC's native cart UX
|
|
6
|
+
* take over.
|
|
7
|
+
*/
|
|
8
|
+
export const BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG = 'isInternationalCheckout';
|
|
9
|
+
/**
|
|
10
|
+
* Build the `from` query value handed to BigCommerce's `/login.php` so that
|
|
11
|
+
* after a successful login the shopper lands back on `cart.php` with the
|
|
12
|
+
* `isInternationalCheckout=true` flag set (plus any `zonosTestMode` /
|
|
13
|
+
* `zonosQaUrl` / `zonosQaUrlApi` that were on the current URL, so the
|
|
14
|
+
* preview build / API host / test credentials carry through the round trip).
|
|
15
|
+
*/
|
|
16
|
+
const buildFromCartPath = () => {
|
|
17
|
+
const params = new URLSearchParams();
|
|
18
|
+
params.set(BIGCOMMERCE_INTERNATIONAL_CHECKOUT_FLAG, 'true');
|
|
19
|
+
const currentParams = new URLSearchParams(window.location.search);
|
|
20
|
+
const zonosQaUrl = currentParams.get('zonosQaUrl');
|
|
21
|
+
if (zonosQaUrl) {
|
|
22
|
+
params.set('zonosQaUrl', zonosQaUrl);
|
|
23
|
+
}
|
|
24
|
+
const zonosQaUrlApi = currentParams.get('zonosQaUrlApi');
|
|
25
|
+
if (zonosQaUrlApi) {
|
|
26
|
+
params.set('zonosQaUrlApi', zonosQaUrlApi);
|
|
27
|
+
}
|
|
28
|
+
if (getIsTestMode()) {
|
|
29
|
+
params.set('zonosTestMode', '1');
|
|
30
|
+
}
|
|
31
|
+
return `cart.php?${params.toString()}`;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Build an absolute URL to BigCommerce's `/login.php` with the
|
|
35
|
+
* `from=cart.php?isInternationalCheckout=true` round-trip encoded so the
|
|
36
|
+
* shopper resumes Zonos international checkout after authenticating.
|
|
37
|
+
*
|
|
38
|
+
* Preserves `zonosTestMode` / `zonosQaUrl` / `zonosQaUrlApi` from the current
|
|
39
|
+
* URL across the redirect — the login round trip leaves BC's frontend, so
|
|
40
|
+
* without this the returning `cart.php` would drop back to the production
|
|
41
|
+
* build / API host.
|
|
42
|
+
*/
|
|
43
|
+
export const buildBigcommerceLoginUrl = ({ action } = {}) => {
|
|
44
|
+
const url = new URL('/login.php', window.location.origin);
|
|
45
|
+
if (action) {
|
|
46
|
+
url.searchParams.set('action', action);
|
|
47
|
+
}
|
|
48
|
+
const currentParams = new URLSearchParams(window.location.search);
|
|
49
|
+
// set zonosQaUrl from the current URL
|
|
50
|
+
const zonosQaUrl = currentParams.get('zonosQaUrl');
|
|
51
|
+
if (zonosQaUrl) {
|
|
52
|
+
url.searchParams.set('zonosQaUrl', zonosQaUrl);
|
|
53
|
+
}
|
|
54
|
+
// set zonosQaUrlApi from the current URL
|
|
55
|
+
const zonosQaUrlApi = currentParams.get('zonosQaUrlApi');
|
|
56
|
+
if (zonosQaUrlApi) {
|
|
57
|
+
url.searchParams.set('zonosQaUrlApi', zonosQaUrlApi);
|
|
58
|
+
}
|
|
59
|
+
// set zonosTestMode from the current URL
|
|
60
|
+
if (getIsTestMode()) {
|
|
61
|
+
url.searchParams.set('zonosTestMode', '1');
|
|
62
|
+
}
|
|
63
|
+
url.searchParams.set('from', buildFromCartPath());
|
|
64
|
+
return url.toString();
|
|
65
|
+
};
|
|
@@ -9,7 +9,7 @@ const DEFAULT_RESULT = {
|
|
|
9
9
|
* Performs the actual fetch logic to determine if the customer
|
|
10
10
|
* belongs to a bypass group.
|
|
11
11
|
*/
|
|
12
|
-
const fetchBypassOutcome = async () => {
|
|
12
|
+
const fetchBypassOutcome = async (preFetched) => {
|
|
13
13
|
var _a, _b, _c, _d;
|
|
14
14
|
// Only relevant for BigCommerce stores — permanent no-op on other platforms
|
|
15
15
|
if (!window.Zonos.isBigCommerce) {
|
|
@@ -26,8 +26,11 @@ const fetchBypassOutcome = async () => {
|
|
|
26
26
|
// Mark as inconclusive so a later caller retries after config loads.
|
|
27
27
|
return { conclusive: false, result: DEFAULT_RESULT };
|
|
28
28
|
}
|
|
29
|
-
// Fetch customer group from BigCommerce Storefront API
|
|
30
|
-
|
|
29
|
+
// Fetch customer group from BigCommerce Storefront API — or reuse
|
|
30
|
+
// caller-supplied data when available.
|
|
31
|
+
const checkoutId = preFetched
|
|
32
|
+
? preFetched.checkoutId
|
|
33
|
+
: await fetchCheckoutId();
|
|
31
34
|
if (!checkoutId) {
|
|
32
35
|
// No active cart yet — inconclusive. Common on fresh sessions where
|
|
33
36
|
// `initBigCommerceBypassCheck` runs before the user has added anything
|
|
@@ -35,7 +38,9 @@ const fetchBypassOutcome = async () => {
|
|
|
35
38
|
log('BigCommerce bypass check: no active cart yet, will retry on next call', 'info');
|
|
36
39
|
return { conclusive: false, result: DEFAULT_RESULT };
|
|
37
40
|
}
|
|
38
|
-
const checkout =
|
|
41
|
+
const checkout = preFetched
|
|
42
|
+
? preFetched.checkout
|
|
43
|
+
: await fetchBigCommerceCheckout(checkoutId);
|
|
39
44
|
if (!checkout) {
|
|
40
45
|
// API call failed (network error, non-200, etc.) — inconclusive.
|
|
41
46
|
// Caching this would permanently disable bypass for the session if
|
|
@@ -69,8 +74,8 @@ const fetchBypassOutcome = async () => {
|
|
|
69
74
|
* cart or after settings finish loading).
|
|
70
75
|
*/
|
|
71
76
|
let bypassCheckPromise = null;
|
|
72
|
-
const startBypassCheck = () => {
|
|
73
|
-
const outcomePromise = fetchBypassOutcome();
|
|
77
|
+
const startBypassCheck = (preFetched) => {
|
|
78
|
+
const outcomePromise = fetchBypassOutcome(preFetched);
|
|
74
79
|
const resultPromise = outcomePromise.then(({ conclusive, result }) => {
|
|
75
80
|
if (!conclusive && bypassCheckPromise === resultPromise) {
|
|
76
81
|
// Invalidate cache so the next caller performs a fresh fetch.
|
|
@@ -116,7 +121,7 @@ export const initBigCommerceBypassCheck = () => {
|
|
|
116
121
|
*/
|
|
117
122
|
export const checkBigCommerceBypassCustomerGroup = async (options = {}) => {
|
|
118
123
|
if (options.forceRefresh || !bypassCheckPromise) {
|
|
119
|
-
return startBypassCheck();
|
|
124
|
+
return startBypassCheck(options.preFetched);
|
|
120
125
|
}
|
|
121
126
|
return bypassCheckPromise;
|
|
122
127
|
};
|