@zonos/elements 1.3.207 → 1.3.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{CheckoutConfig-4afc683b.js → CheckoutConfig-27c82f94.js} +19 -0
- package/dist/cjs/{cart-3d961c6e.js → cart-47c17ebf.js} +1 -25
- package/dist/cjs/index.cjs.js +28 -8
- package/dist/cjs/{localization-ff33875b.js → localization-e9089be5.js} +1 -0
- package/dist/cjs/{paypal-dee5c109.js → paypal-3a803d21.js} +2 -2
- package/dist/cjs/updateCheckoutSessionAttributes-d0332530.js +50 -0
- package/dist/cjs/zonos-address_11.cjs.entry.js +2 -2
- package/dist/cjs/zonos-cart-items_14.cjs.entry.js +13 -14
- package/dist/cjs/zonos-checkout.cjs.entry.js +47 -15
- 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-empty-state-payment_4.cjs.entry.js +3 -3
- 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/collection/components/checkout/zonos-checkout/zonos-checkout.js +43 -12
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +9 -12
- package/dist/collection/components/store/checkout/stripe.js +0 -24
- package/dist/collection/components/store/hello/localization.js +1 -0
- package/dist/collection/components/utils/api/updateCheckoutSessionAttributes.js +46 -0
- package/dist/collection/components/utils/checkout/getAbandonedCartRenewTokenValue.js +17 -0
- package/dist/collection/scripts/_getCartInfoById.js +3 -0
- package/dist/collection/types/checkout/api/CheckoutSession.js +14 -1
- package/dist/collection/types/generated/graphql.frontend.types.js +2 -0
- package/dist/collection/types/generated/graphql.internal.types.js +12 -0
- package/dist/esm/{CheckoutConfig-eb7d6954.js → CheckoutConfig-724d7bae.js} +19 -1
- package/dist/esm/{cart-5835676d.js → cart-5b417c0d.js} +4 -28
- package/dist/esm/{debounce-eaee3a94.js → debounce-7ebfa15b.js} +1 -1
- package/dist/esm/{getBorderRadius-b18c924f.js → getBorderRadius-174305ff.js} +1 -1
- package/dist/esm/index.js +27 -10
- package/dist/esm/{isDarkColor-d8bb8659.js → isDarkColor-915b06b8.js} +1 -1
- package/dist/esm/{localization-4c7f64e8.js → localization-669a1714.js} +2 -1
- package/dist/esm/{paypal-b4f106be.js → paypal-3a0cf86b.js} +4 -4
- package/dist/esm/updateCheckoutSessionAttributes-183ca6c1.js +48 -0
- package/dist/esm/zonos-address_11.entry.js +6 -6
- package/dist/esm/zonos-badge.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +3 -3
- package/dist/esm/zonos-card.entry.js +2 -2
- package/dist/esm/zonos-cart-items_14.entry.js +16 -17
- package/dist/esm/zonos-checkout.entry.js +50 -18
- package/dist/esm/zonos-collapse.entry.js +1 -1
- package/dist/esm/zonos-controller.entry.js +5 -5
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +3 -3
- package/dist/esm/zonos-empty-state-payment_4.entry.js +6 -6
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +3 -3
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-stripe-input.entry.js +3 -3
- package/dist/esm/zonos-text.entry.js +1 -1
- package/dist/esm/zonos-toggle.entry.js +1 -1
- package/dist/esm/zonos-v-stack.entry.js +1 -1
- package/dist/esm/{zonosStore-1e015fa5.js → zonosStore-504a7030.js} +1 -1
- package/dist/esm-es5/CheckoutConfig-724d7bae.js +1 -0
- package/dist/esm-es5/{cart-5835676d.js → cart-5b417c0d.js} +1 -1
- package/dist/esm-es5/{debounce-eaee3a94.js → debounce-7ebfa15b.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-b18c924f.js → getBorderRadius-174305ff.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-d8bb8659.js → isDarkColor-915b06b8.js} +1 -1
- package/dist/esm-es5/{localization-4c7f64e8.js → localization-669a1714.js} +1 -1
- package/dist/esm-es5/{paypal-b4f106be.js → paypal-3a0cf86b.js} +1 -1
- package/dist/esm-es5/updateCheckoutSessionAttributes-183ca6c1.js +1 -0
- package/dist/esm-es5/zonos-address_11.entry.js +1 -1
- package/dist/esm-es5/zonos-badge.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_14.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-collapse.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/zonos-toggle.entry.js +1 -1
- package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-1e015fa5.js → zonosStore-504a7030.js} +1 -1
- package/dist/scripts/index.d.ts +2 -0
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +2 -0
- package/dist/types/components/utils/api/updateCheckoutSessionAttributes.d.ts +7 -0
- package/dist/types/components/utils/checkout/getAbandonedCartRenewTokenValue.d.ts +1 -0
- package/dist/types/scripts/cart/_setupCartDataWithSettings.d.ts +1 -0
- package/dist/types/types/checkout/api/CheckoutSession.d.ts +14 -0
- package/dist/types/types/checkout/api/NormalizedTempCart.d.ts +2 -0
- package/dist/types/types/generated/graphql.frontend.types.d.ts +2 -0
- package/dist/types/types/generated/graphql.frontend.types.ts +2 -0
- package/dist/types/types/generated/graphql.internal.types.d.ts +40 -0
- package/dist/types/types/generated/graphql.internal.types.ts +79 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-265af369.system.entry.js → p-02463cc1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-eca09508.system.entry.js → p-066afca1.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-74bcb5cc.entry.js → p-0731fbba.entry.js} +1 -1
- package/dist/zonos-elements/{p-bab19e2a.entry.js → p-07905246.entry.js} +1 -1
- package/dist/zonos-elements/{p-9f78b79e.entry.js → p-0794c530.entry.js} +1 -1
- package/dist/zonos-elements/{p-019f8637.entry.js → p-081fa4a8.entry.js} +1 -1
- package/dist/zonos-elements/{p-1327b935.system.js → p-0d908c15.system.js} +1 -1
- package/dist/zonos-elements/p-0f368368.system.js +1 -0
- package/dist/zonos-elements/p-0fb14108.entry.js +1 -0
- package/dist/zonos-elements/{p-93aeba62.system.entry.js → p-1530f958.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2866fd29.system.entry.js → p-160da12a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c4e0f49a.system.entry.js → p-1b3e92ea.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4cb8b87f.system.entry.js → p-1f706fc9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2d4e0280.entry.js +1 -0
- package/dist/zonos-elements/{p-abe218ab.system.entry.js → p-39039ab7.system.entry.js} +1 -1
- package/dist/zonos-elements/p-39428328.system.js +1 -0
- package/dist/zonos-elements/{p-620deb03.system.entry.js → p-3d6f6367.system.entry.js} +1 -1
- package/dist/zonos-elements/p-3ee44728.system.js +1 -1
- package/dist/zonos-elements/{p-f9664811.js → p-40a2a649.js} +1 -1
- package/dist/zonos-elements/p-40a4c8a2.system.js +1 -0
- package/dist/zonos-elements/{p-c666d557.system.js → p-4451a598.system.js} +1 -1
- package/dist/zonos-elements/{p-ed20f2f7.js → p-4bf54953.js} +1 -1
- package/dist/zonos-elements/{p-abc83d01.entry.js → p-4f04b499.entry.js} +1 -1
- package/dist/zonos-elements/{p-f4d741de.system.entry.js → p-51d596a0.system.entry.js} +1 -1
- package/dist/zonos-elements/p-5539386e.system.entry.js +1 -0
- package/dist/zonos-elements/{p-1bc09abe.system.entry.js → p-5c772fab.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-42a9557f.entry.js → p-5d909d3d.entry.js} +1 -1
- package/dist/zonos-elements/{p-e337fa88.js → p-5f2a2ca7.js} +1 -1
- package/dist/zonos-elements/{p-1aa24297.system.entry.js → p-63ca1242.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0c4c8d63.entry.js → p-67f807bc.entry.js} +1 -1
- package/dist/zonos-elements/{p-3196bf98.entry.js → p-6b406abd.entry.js} +1 -1
- package/dist/zonos-elements/{p-9b8a5372.entry.js → p-6be43ba8.entry.js} +1 -1
- package/dist/zonos-elements/{p-536f69eb.entry.js → p-6c991320.entry.js} +1 -1
- package/dist/zonos-elements/{p-469ccc66.system.entry.js → p-7e346632.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-91c996d3.system.js → p-7f568108.system.js} +1 -1
- package/dist/zonos-elements/{p-858b7908.system.entry.js → p-803e59d2.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-666164d9.system.js → p-91553cf0.system.js} +1 -1
- package/dist/zonos-elements/{p-1ad099ec.system.entry.js → p-963fa567.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-4fb88ebc.system.entry.js → p-a09bdd20.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-edcfb3a3.js → p-a158b406.js} +1 -1
- package/dist/zonos-elements/{p-3afc27ef.entry.js → p-a3a8ba10.entry.js} +1 -1
- package/dist/zonos-elements/p-a4d995a2.system.js +1 -0
- package/dist/zonos-elements/{p-719e14a8.system.entry.js → p-a63bac79.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-22cb6880.system.entry.js → p-a958c4f0.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-7777d85f.system.entry.js → p-ab6efb03.system.entry.js} +1 -1
- package/dist/zonos-elements/p-b2d81c98.js +1 -0
- package/dist/zonos-elements/{p-16678764.js → p-b3fa7f19.js} +1 -1
- package/dist/zonos-elements/{p-658936c9.js → p-b7a5b367.js} +2 -2
- package/dist/zonos-elements/{p-848e08e8.entry.js → p-bb850bb7.entry.js} +1 -1
- package/dist/zonos-elements/{p-4e9c8f9e.system.js → p-c5455a34.system.js} +1 -1
- package/dist/zonos-elements/{p-41c1d7c4.entry.js → p-c607d026.entry.js} +1 -1
- package/dist/zonos-elements/p-c740353c.js +1 -0
- package/dist/zonos-elements/{p-eb2560b6.system.entry.js → p-cd376c7a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-5616b304.entry.js → p-d096d7f2.entry.js} +1 -1
- package/dist/zonos-elements/{p-e0587eeb.entry.js → p-d1a31577.entry.js} +1 -1
- package/dist/zonos-elements/{p-9fa17353.js → p-d35d17f3.js} +1 -1
- package/dist/zonos-elements/{p-9e9ac7a2.system.js → p-d5bdbbb3.system.js} +1 -1
- package/dist/zonos-elements/{p-18149db1.entry.js → p-da304b78.entry.js} +1 -1
- package/dist/zonos-elements/{p-12cd9d3a.entry.js → p-e1c2b8f8.entry.js} +1 -1
- package/dist/zonos-elements/p-ea30d92d.system.entry.js +1 -0
- package/dist/zonos-elements/{p-47e2cd31.entry.js → p-ef594c0c.entry.js} +1 -1
- package/dist/zonos-elements/p-f1f3a846.entry.js +1 -0
- package/dist/zonos-elements/{p-30778fde.system.entry.js → p-f49834d4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b21b0330.entry.js → p-fc3a6495.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/CheckoutConfig-eb7d6954.js +0 -1
- package/dist/zonos-elements/p-0de2c731.system.js +0 -1
- package/dist/zonos-elements/p-3a50124e.entry.js +0 -1
- package/dist/zonos-elements/p-3f1a2d31.js +0 -1
- package/dist/zonos-elements/p-5e1b2654.system.js +0 -1
- package/dist/zonos-elements/p-a2b55d11.entry.js +0 -1
- package/dist/zonos-elements/p-aafcd40f.system.entry.js +0 -1
- package/dist/zonos-elements/p-b922c441.system.js +0 -1
- package/dist/zonos-elements/p-ba027b70.system.entry.js +0 -1
- package/dist/zonos-elements/p-dbd23bea.entry.js +0 -1
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const getAbandonedCartRenewTokenValue = () => {
|
|
4
|
+
const validityToken = new URLSearchParams(window.location.search).get('validityToken');
|
|
5
|
+
// check if validityToken length is base64 encoded
|
|
6
|
+
if (!validityToken ||
|
|
7
|
+
!/^[A-Za-z0-9+/]+={0,2}$/.test(validityToken) ||
|
|
8
|
+
validityToken.length % 4 !== 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
// check if it can be decoded
|
|
13
|
+
atob(validityToken);
|
|
14
|
+
return validityToken;
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
3
21
|
const baseRe = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;
|
|
4
22
|
const uuidRe = new RegExp(`^${baseRe.source}$`);
|
|
5
23
|
const cartUuidRe = new RegExp(`^cart_${baseRe.source}$`);
|
|
@@ -35,3 +53,4 @@ exports._getIsValidCartId = _getIsValidCartId;
|
|
|
35
53
|
exports.checkoutHiddenBtnSelector = checkoutHiddenBtnSelector;
|
|
36
54
|
exports.checkoutHiddenInternationalBtnSelector = checkoutHiddenInternationalBtnSelector;
|
|
37
55
|
exports.domesticRedirectedBtnSelector = domesticRedirectedBtnSelector;
|
|
56
|
+
exports.getAbandonedCartRenewTokenValue = getAbandonedCartRenewTokenValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
4
|
-
const localization = require('./localization-
|
|
4
|
+
const localization = require('./localization-e9089be5.js');
|
|
5
5
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-35e8daec.js');
|
|
7
7
|
const getBorderRadius = require('./getBorderRadius-c424eb05.js');
|
|
@@ -1177,18 +1177,6 @@ const getCheckoutSessionBody = () => {
|
|
|
1177
1177
|
key: 'language',
|
|
1178
1178
|
value: localization.localizationStore.selectedLocale,
|
|
1179
1179
|
},
|
|
1180
|
-
{
|
|
1181
|
-
key: 'appVersion',
|
|
1182
|
-
value: window.Zonos.version,
|
|
1183
|
-
},
|
|
1184
|
-
{
|
|
1185
|
-
key: 'appVersionNpmIntegration',
|
|
1186
|
-
value: window.Zonos.isNpm ? '1' : '0',
|
|
1187
|
-
},
|
|
1188
|
-
{
|
|
1189
|
-
key: 'legacyCheckoutFacade',
|
|
1190
|
-
value: window.Zonos.isLegacyCheckout ? '1' : '0',
|
|
1191
|
-
},
|
|
1192
1180
|
],
|
|
1193
1181
|
presentmentCountryCode: localization.localizationStore.selectedCountryCode,
|
|
1194
1182
|
skipPaymentIntent: stripeStore.skipPaymentIntent,
|
|
@@ -1336,18 +1324,6 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
|
|
|
1336
1324
|
key: 'language',
|
|
1337
1325
|
value: localization.localizationStore.selectedLocale,
|
|
1338
1326
|
},
|
|
1339
|
-
{
|
|
1340
|
-
key: 'appVersion',
|
|
1341
|
-
value: window.Zonos.version,
|
|
1342
|
-
},
|
|
1343
|
-
{
|
|
1344
|
-
key: 'appVersionNpmIntegration',
|
|
1345
|
-
value: window.Zonos.isNpm ? '1' : '0',
|
|
1346
|
-
},
|
|
1347
|
-
{
|
|
1348
|
-
key: 'legacyCheckoutFacade',
|
|
1349
|
-
value: window.Zonos.isLegacyCheckout ? '1' : '0',
|
|
1350
|
-
},
|
|
1351
1327
|
],
|
|
1352
1328
|
presentmentCountryCode,
|
|
1353
1329
|
skipPaymentIntent: stripeStore.skipPaymentIntent,
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
6
6
|
const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
|
|
7
7
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
8
|
-
const CheckoutConfig = require('./CheckoutConfig-
|
|
8
|
+
const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
|
|
9
9
|
const VarianceTest = require('./VarianceTest-0cb1e118.js');
|
|
10
10
|
const TaxId = require('./TaxId-12acedde.js');
|
|
11
11
|
|
|
@@ -132,7 +132,7 @@ const getZonosQaUrl = () => {
|
|
|
132
132
|
return null;
|
|
133
133
|
}
|
|
134
134
|
const qaUrl = extractZonosQaUrl(window.location.href);
|
|
135
|
-
const cdnUrl = "https://v1.3.
|
|
135
|
+
const cdnUrl = "https://v1.3.208.js.zonos.com";
|
|
136
136
|
// when the qaUrl is not set and the built URL is from the test domain, use the test domain for testing
|
|
137
137
|
if (!qaUrl &&
|
|
138
138
|
(cdnUrl.includes('test.') ||
|
|
@@ -302,6 +302,7 @@ const getCartIdFromQueryParam = () => {
|
|
|
302
302
|
const getCartInfoById = async ({ cartId, retries, }) => {
|
|
303
303
|
const isTestMode = handleFetch.getIsTestMode();
|
|
304
304
|
const overrideSettings = getGenericSettingsOverride.getGenericSettingsOverride();
|
|
305
|
+
const renewCartExpirationToken = CheckoutConfig.getAbandonedCartRenewTokenValue() || undefined;
|
|
305
306
|
const params = new URLSearchParams();
|
|
306
307
|
if (overrideSettings.overrideShouldEnabledCustomAddress) {
|
|
307
308
|
params.set('overrideShouldEnabledCustomAddress', overrideSettings.overrideShouldEnabledCustomAddress);
|
|
@@ -309,6 +310,7 @@ const getCartInfoById = async ({ cartId, retries, }) => {
|
|
|
309
310
|
const { errors, json, zonosMode } = await handleFetch.handleFetch(`/api/zonos-elements/get-cart?${params.toString()}`, {
|
|
310
311
|
body: {
|
|
311
312
|
isTestMode,
|
|
313
|
+
renewCartExpirationToken,
|
|
312
314
|
tempCartUUID: cartId,
|
|
313
315
|
},
|
|
314
316
|
headers: {
|
|
@@ -373,10 +375,10 @@ const zonosLoadUrl = (() => {
|
|
|
373
375
|
}
|
|
374
376
|
return null;
|
|
375
377
|
})();
|
|
376
|
-
const ZONOS_URL = "https://v1.3.
|
|
377
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
378
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
379
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
378
|
+
const ZONOS_URL = "https://v1.3.208.js.zonos.com";
|
|
379
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.208";
|
|
380
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.208";
|
|
381
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.208";
|
|
380
382
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
381
383
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
382
384
|
class Zonos {
|
|
@@ -394,7 +396,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
394
396
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
395
397
|
: null;
|
|
396
398
|
Zonos.isBigCommerce = false;
|
|
397
|
-
Zonos.releaseDate = "
|
|
399
|
+
Zonos.releaseDate = "1748878470643";
|
|
398
400
|
Zonos.isLegacyCheckout = false;
|
|
399
401
|
Zonos.domain = typeof window !== 'undefined'
|
|
400
402
|
? // domain that embeds the iframe
|
|
@@ -412,7 +414,7 @@ Zonos.isNpm = true;
|
|
|
412
414
|
Zonos.zonosQaUrl = null;
|
|
413
415
|
Zonos.zonosQaUrlApi = null;
|
|
414
416
|
Zonos.trackEventLogs = [];
|
|
415
|
-
Zonos.version = `v${"1.3.
|
|
417
|
+
Zonos.version = `v${"1.3.208"}`;
|
|
416
418
|
Zonos.modeAlerted = false;
|
|
417
419
|
Zonos.cartData = null;
|
|
418
420
|
Zonos.paypal = null;
|
|
@@ -924,6 +926,21 @@ Zonos.injectSupportGoogleFont = (fontUrl) => {
|
|
|
924
926
|
handleFetch.log(`[FONT] ${fontFamily} font injected!`);
|
|
925
927
|
};
|
|
926
928
|
|
|
929
|
+
const checkoutSessionMutableAttributeKeys = [
|
|
930
|
+
'ZONOS_FORM_TYPE_USING',
|
|
931
|
+
'APP_VERSION',
|
|
932
|
+
'APP_VERSION_NPM_INTEGRATION',
|
|
933
|
+
'LEGACY_CHECKOUT_FACADE',
|
|
934
|
+
];
|
|
935
|
+
const checkoutSessionImmutableAttributeKeys = [
|
|
936
|
+
'ORDER_DUPLICATION_CONSENT',
|
|
937
|
+
'WITH_ABANDONED_CART_TOKEN',
|
|
938
|
+
];
|
|
939
|
+
const checkoutSessionAttributeKeys = [
|
|
940
|
+
...checkoutSessionMutableAttributeKeys,
|
|
941
|
+
...checkoutSessionImmutableAttributeKeys,
|
|
942
|
+
];
|
|
943
|
+
|
|
927
944
|
exports.checkoutHiddenBtnSelector = CheckoutConfig.checkoutHiddenBtnSelector;
|
|
928
945
|
exports.checkoutHiddenInternationalBtnSelector = CheckoutConfig.checkoutHiddenInternationalBtnSelector;
|
|
929
946
|
exports.domesticRedirectedBtnSelector = CheckoutConfig.domesticRedirectedBtnSelector;
|
|
@@ -932,3 +949,6 @@ exports.countryRequireTaxId = TaxId.countryRequireTaxId;
|
|
|
932
949
|
exports.euCountryCodes = TaxId.euCountryCodes;
|
|
933
950
|
exports.shipToTaxIdLabels = TaxId.shipToTaxIdLabels;
|
|
934
951
|
exports.Zonos = Zonos;
|
|
952
|
+
exports.checkoutSessionAttributeKeys = checkoutSessionAttributeKeys;
|
|
953
|
+
exports.checkoutSessionImmutableAttributeKeys = checkoutSessionImmutableAttributeKeys;
|
|
954
|
+
exports.checkoutSessionMutableAttributeKeys = checkoutSessionMutableAttributeKeys;
|
|
@@ -14009,6 +14009,7 @@ const updateCheckoutSessionLanguage = async () => {
|
|
|
14009
14009
|
body: {
|
|
14010
14010
|
id: storageStore.checkoutSessionId,
|
|
14011
14011
|
metadata: [
|
|
14012
|
+
// This is being used from the backend to determine the language of the checkout session
|
|
14012
14013
|
{
|
|
14013
14014
|
key: 'language',
|
|
14014
14015
|
value: localizationStore.selectedLocale,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const localization = require('./localization-
|
|
4
|
+
const cart = require('./cart-47c17ebf.js');
|
|
5
|
+
const localization = require('./localization-e9089be5.js');
|
|
6
6
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
7
7
|
const isDarkColor = require('./isDarkColor-35e8daec.js');
|
|
8
8
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const debounce = require('./debounce-0b9c0f8a.js');
|
|
4
|
+
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
5
|
+
|
|
6
|
+
const attributesToUpdate = {};
|
|
7
|
+
// Store debounced functions per session to ensure proper debouncing
|
|
8
|
+
const debouncedFunctions = {};
|
|
9
|
+
const createDebouncedFetch = (sessionId) => {
|
|
10
|
+
return debounce.debounce_1(async () => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
// Get latest attributes from the map
|
|
13
|
+
const latestAttributes = Array.from(((_a = attributesToUpdate[sessionId]) === null || _a === void 0 ? void 0 : _a.entries()) || []).map(([key, value]) => ({ key, value }));
|
|
14
|
+
const { errors, json } = await handleFetch.handleFetch('/api/zonos-elements/update-checkout-session-attributes', {
|
|
15
|
+
body: {
|
|
16
|
+
attributes: latestAttributes,
|
|
17
|
+
id: sessionId,
|
|
18
|
+
},
|
|
19
|
+
method: 'POST',
|
|
20
|
+
});
|
|
21
|
+
if (errors.length) {
|
|
22
|
+
handleFetch.logError('Error updating checkout session attributes', errors);
|
|
23
|
+
return { success: false };
|
|
24
|
+
}
|
|
25
|
+
(_b = attributesToUpdate[sessionId]) === null || _b === void 0 ? void 0 : _b.clear();
|
|
26
|
+
return { success: !!(json === null || json === void 0 ? void 0 : json.success) };
|
|
27
|
+
}, 1000, { maxWait: 5000 });
|
|
28
|
+
};
|
|
29
|
+
const updateCheckoutSessionAttributes = async ({ attributes, checkoutSessionId, }) => {
|
|
30
|
+
// Merge the new attributes with the attributes in the list, if key exist, override it
|
|
31
|
+
// init the map if not exist
|
|
32
|
+
attributesToUpdate[checkoutSessionId] || (attributesToUpdate[checkoutSessionId] = new Map());
|
|
33
|
+
attributes.forEach(attribute => {
|
|
34
|
+
var _a;
|
|
35
|
+
if (attribute.value) {
|
|
36
|
+
(_a = attributesToUpdate[checkoutSessionId]) === null || _a === void 0 ? void 0 : _a.set(attribute.key, attribute.value);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
if (!attributes.length) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Get or create the debounced function for this session
|
|
43
|
+
if (!debouncedFunctions[checkoutSessionId]) {
|
|
44
|
+
debouncedFunctions[checkoutSessionId] =
|
|
45
|
+
createDebouncedFetch(checkoutSessionId);
|
|
46
|
+
}
|
|
47
|
+
return debouncedFunctions[checkoutSessionId]();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.updateCheckoutSessionAttributes = updateCheckoutSessionAttributes;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-47c17ebf.js');
|
|
7
|
+
const localization = require('./localization-e9089be5.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
9
9
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
10
10
|
const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-47c17ebf.js');
|
|
7
|
+
const localization = require('./localization-e9089be5.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
const paypal = require('./paypal-
|
|
9
|
+
const paypal = require('./paypal-3a803d21.js');
|
|
10
10
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
11
11
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
12
12
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
@@ -14,9 +14,11 @@ const getBorderRadius = require('./getBorderRadius-c424eb05.js');
|
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
15
|
const isDarkColor = require('./isDarkColor-35e8daec.js');
|
|
16
16
|
const isColorVariable = require('./isColorVariable-525dbfa7.js');
|
|
17
|
+
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-d0332530.js');
|
|
17
18
|
const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
|
|
18
19
|
const TaxId = require('./TaxId-12acedde.js');
|
|
19
20
|
require('./VarianceTest-0cb1e118.js');
|
|
21
|
+
require('./debounce-0b9c0f8a.js');
|
|
20
22
|
|
|
21
23
|
const getDisplayCurrency = () => {
|
|
22
24
|
var _a, _b;
|
|
@@ -2611,17 +2613,14 @@ const ZonosCustomerInfo = class {
|
|
|
2611
2613
|
if (type === 'shipping' &&
|
|
2612
2614
|
localization.storageStore.checkoutSessionId &&
|
|
2613
2615
|
!this.recordedFormTypeUsed) {
|
|
2614
|
-
void
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
],
|
|
2623
|
-
},
|
|
2624
|
-
method: 'POST',
|
|
2616
|
+
void updateCheckoutSessionAttributes.updateCheckoutSessionAttributes({
|
|
2617
|
+
attributes: [
|
|
2618
|
+
{
|
|
2619
|
+
key: 'ZONOS_FORM_TYPE_USING',
|
|
2620
|
+
value: shouldUseCustomAddressForm ? 'custom' : 'stripe',
|
|
2621
|
+
},
|
|
2622
|
+
],
|
|
2623
|
+
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
2625
2624
|
});
|
|
2626
2625
|
this.recordedFormTypeUsed = true;
|
|
2627
2626
|
}
|
|
@@ -3,19 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const paypal = require('./paypal-
|
|
8
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-47c17ebf.js');
|
|
7
|
+
const paypal = require('./paypal-3a803d21.js');
|
|
8
|
+
const localization = require('./localization-e9089be5.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
11
|
+
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-d0332530.js');
|
|
12
|
+
const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
|
|
11
13
|
const classes = require('./classes-b7918f56.js');
|
|
12
14
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
13
15
|
const getBorderRadius = require('./getBorderRadius-c424eb05.js');
|
|
14
16
|
const isDarkColor = require('./isDarkColor-35e8daec.js');
|
|
15
17
|
const styles = require('./styles-d1e64fb9.js');
|
|
16
|
-
const CheckoutConfig = require('./CheckoutConfig-4afc683b.js');
|
|
17
18
|
const RemoveIcon = require('./RemoveIcon-081ac073.js');
|
|
18
19
|
require('./VarianceTest-0cb1e118.js');
|
|
20
|
+
require('./debounce-0b9c0f8a.js');
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Map the items from tempCart like how we do it in dgs
|
|
@@ -989,6 +991,29 @@ const ZonosCheckout = class {
|
|
|
989
991
|
this.placedOrderInfo = existingPlacedOrderInfo;
|
|
990
992
|
handleFetch.log('=== Showing order duplication confirmation', 'warn');
|
|
991
993
|
}
|
|
994
|
+
recordCheckoutInfo() {
|
|
995
|
+
if (!localization.storageStore.checkoutSessionId) {
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
999
|
+
void updateCheckoutSessionAttributes.updateCheckoutSessionAttributes({
|
|
1000
|
+
attributes: [
|
|
1001
|
+
{
|
|
1002
|
+
key: 'APP_VERSION',
|
|
1003
|
+
value: window.Zonos.version,
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
key: 'APP_VERSION_NPM_INTEGRATION',
|
|
1007
|
+
value: window.Zonos.isNpm ? '1' : '0',
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
key: 'LEGACY_CHECKOUT_FACADE',
|
|
1011
|
+
value: window.Zonos.isLegacyCheckout ? '1' : '0',
|
|
1012
|
+
},
|
|
1013
|
+
],
|
|
1014
|
+
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
992
1017
|
confirmProceedWithOrderDuplication() {
|
|
993
1018
|
// Reset the placed order info
|
|
994
1019
|
this.placedOrderInfo = null;
|
|
@@ -996,17 +1021,18 @@ const ZonosCheckout = class {
|
|
|
996
1021
|
return;
|
|
997
1022
|
}
|
|
998
1023
|
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
999
|
-
void
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1024
|
+
void updateCheckoutSessionAttributes.updateCheckoutSessionAttributes({
|
|
1025
|
+
attributes: [{ key: 'ORDER_DUPLICATION_CONSENT', value: '1' }],
|
|
1026
|
+
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
markTheSessionAsAbandonedCart() {
|
|
1030
|
+
if (!localization.storageStore.checkoutSessionId) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
void updateCheckoutSessionAttributes.updateCheckoutSessionAttributes({
|
|
1034
|
+
attributes: [{ key: 'WITH_ABANDONED_CART_TOKEN', value: '1' }],
|
|
1035
|
+
checkoutSessionId: localization.storageStore.checkoutSessionId,
|
|
1010
1036
|
});
|
|
1011
1037
|
}
|
|
1012
1038
|
handleCancelOrderDuplication() {
|
|
@@ -1153,6 +1179,12 @@ const ZonosCheckout = class {
|
|
|
1153
1179
|
const loadTime = endTime - startTime;
|
|
1154
1180
|
void sendLoadNativeCheckoutLog({ loadTime });
|
|
1155
1181
|
}
|
|
1182
|
+
this.recordCheckoutInfo();
|
|
1183
|
+
// update checkout session attribute to know the current cart is abandoned
|
|
1184
|
+
const isAbandonedCart = !!CheckoutConfig.getAbandonedCartRenewTokenValue();
|
|
1185
|
+
if (isAbandonedCart) {
|
|
1186
|
+
this.markTheSessionAsAbandonedCart();
|
|
1187
|
+
}
|
|
1156
1188
|
}
|
|
1157
1189
|
catch (err) {
|
|
1158
1190
|
if (err instanceof Error) {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const cart = require('./cart-
|
|
7
|
-
const localization = require('./localization-
|
|
6
|
+
const cart = require('./cart-47c17ebf.js');
|
|
7
|
+
const localization = require('./localization-e9089be5.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
9
9
|
const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-e9089be5.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
require('./handleFetch-969d05d8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-e9089be5.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-35e8daec.js');
|
|
@@ -6,10 +6,10 @@ const index = require('./index-1c710d00.js');
|
|
|
6
6
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
const getBorderRadius = require('./getBorderRadius-c424eb05.js');
|
|
9
|
-
const cart = require('./cart-
|
|
10
|
-
const localization = require('./localization-
|
|
9
|
+
const cart = require('./cart-47c17ebf.js');
|
|
10
|
+
const localization = require('./localization-e9089be5.js');
|
|
11
11
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
12
|
-
const paypal = require('./paypal-
|
|
12
|
+
const paypal = require('./paypal-3a803d21.js');
|
|
13
13
|
require('./VarianceTest-0cb1e118.js');
|
|
14
14
|
require('./isDarkColor-35e8daec.js');
|
|
15
15
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-e9089be5.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-7c1e1bc1.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-1c710d00.js');
|
|
6
6
|
const debounce = require('./debounce-0b9c0f8a.js');
|
|
7
|
-
const localization = require('./localization-
|
|
7
|
+
const localization = require('./localization-e9089be5.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
9
9
|
const classes = require('./classes-b7918f56.js');
|
|
10
10
|
const handleFetch = require('./handleFetch-969d05d8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
|
-
const localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-e9089be5.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-7c1e1bc1.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
9
|
require('./handleFetch-969d05d8.js');
|
|
@@ -10,7 +10,9 @@ import { buildCartItemsByTempCart } from "../../utils/api/buildCartItemsByTempCa
|
|
|
10
10
|
import { isStoreDiscountEnabled } from "../../utils/api/isStoreDiscountEnabl";
|
|
11
11
|
import { selectVarianceTest } from "../../utils/api/selectVarianceTest";
|
|
12
12
|
import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
|
|
13
|
+
import { updateCheckoutSessionAttributes } from "../../utils/api/updateCheckoutSessionAttributes";
|
|
13
14
|
import { buildCartUrl } from "../../utils/buildCartUrl";
|
|
15
|
+
import { getAbandonedCartRenewTokenValue } from "../../utils/checkout/getAbandonedCartRenewTokenValue";
|
|
14
16
|
import { getIsStagingMode } from "../../utils/checkout/getIsStagingMode";
|
|
15
17
|
import { getIsTestMode } from "../../utils/checkout/getIsTestMode";
|
|
16
18
|
import { isCheckoutMobile } from "../../utils/checkout/isCheckoutMobile";
|
|
@@ -21,7 +23,6 @@ import { classes } from "../../utils/classes";
|
|
|
21
23
|
import { createCustomEvent } from "../../utils/createCustomEvent";
|
|
22
24
|
import { getBorderRadius } from "../../utils/getBorderRadius";
|
|
23
25
|
import { getLegacyQueryParams } from "../../utils/getLegacyQueryParams";
|
|
24
|
-
import { handleFetch } from "../../utils/handleFetch";
|
|
25
26
|
import { currencyFormat } from "../../utils/hello/currencyConversion/currencyFormat";
|
|
26
27
|
import { getZCountryUrlParam } from "../../utils/hello/getZCountryUrlParam";
|
|
27
28
|
import { isDarkColor } from "../../utils/isDarkColor";
|
|
@@ -589,6 +590,29 @@ export class ZonosCheckout {
|
|
|
589
590
|
this.placedOrderInfo = existingPlacedOrderInfo;
|
|
590
591
|
log('=== Showing order duplication confirmation', 'warn');
|
|
591
592
|
}
|
|
593
|
+
recordCheckoutInfo() {
|
|
594
|
+
if (!storageStore.checkoutSessionId) {
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
597
|
+
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
598
|
+
void updateCheckoutSessionAttributes({
|
|
599
|
+
attributes: [
|
|
600
|
+
{
|
|
601
|
+
key: 'APP_VERSION',
|
|
602
|
+
value: window.Zonos.version,
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
key: 'APP_VERSION_NPM_INTEGRATION',
|
|
606
|
+
value: window.Zonos.isNpm ? '1' : '0',
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
key: 'LEGACY_CHECKOUT_FACADE',
|
|
610
|
+
value: window.Zonos.isLegacyCheckout ? '1' : '0',
|
|
611
|
+
},
|
|
612
|
+
],
|
|
613
|
+
checkoutSessionId: storageStore.checkoutSessionId,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
592
616
|
confirmProceedWithOrderDuplication() {
|
|
593
617
|
// Reset the placed order info
|
|
594
618
|
this.placedOrderInfo = null;
|
|
@@ -596,17 +620,18 @@ export class ZonosCheckout {
|
|
|
596
620
|
return;
|
|
597
621
|
}
|
|
598
622
|
// Record the order duplication consent so we know user did see the notification and proceed with the order duplication
|
|
599
|
-
void
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
623
|
+
void updateCheckoutSessionAttributes({
|
|
624
|
+
attributes: [{ key: 'ORDER_DUPLICATION_CONSENT', value: '1' }],
|
|
625
|
+
checkoutSessionId: storageStore.checkoutSessionId,
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
markTheSessionAsAbandonedCart() {
|
|
629
|
+
if (!storageStore.checkoutSessionId) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
void updateCheckoutSessionAttributes({
|
|
633
|
+
attributes: [{ key: 'WITH_ABANDONED_CART_TOKEN', value: '1' }],
|
|
634
|
+
checkoutSessionId: storageStore.checkoutSessionId,
|
|
610
635
|
});
|
|
611
636
|
}
|
|
612
637
|
handleCancelOrderDuplication() {
|
|
@@ -753,6 +778,12 @@ export class ZonosCheckout {
|
|
|
753
778
|
const loadTime = endTime - startTime;
|
|
754
779
|
void sendLoadNativeCheckoutLog({ loadTime });
|
|
755
780
|
}
|
|
781
|
+
this.recordCheckoutInfo();
|
|
782
|
+
// update checkout session attribute to know the current cart is abandoned
|
|
783
|
+
const isAbandonedCart = !!getAbandonedCartRenewTokenValue();
|
|
784
|
+
if (isAbandonedCart) {
|
|
785
|
+
this.markTheSessionAsAbandonedCart();
|
|
786
|
+
}
|
|
756
787
|
}
|
|
757
788
|
catch (err) {
|
|
758
789
|
if (err instanceof Error) {
|
|
@@ -4,8 +4,8 @@ import { localizationStore } from "../../../store/hello/localization";
|
|
|
4
4
|
import { storageStore } from "../../../store/storageStore";
|
|
5
5
|
import { translate } from "../../../store/translationStore";
|
|
6
6
|
import { getZonosStoreTheme, zonosStore, } from "../../../store/zonosStore";
|
|
7
|
+
import { updateCheckoutSessionAttributes } from "../../../utils/api/updateCheckoutSessionAttributes";
|
|
7
8
|
import { containsNonLatinChars } from "../../../utils/containsNonLatinChars";
|
|
8
|
-
import { handleFetch } from "../../../utils/handleFetch";
|
|
9
9
|
import { log } from "../../../utils/logging/log";
|
|
10
10
|
import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
|
|
11
11
|
import { taxIdValidationResult } from "../../../utils/taxIdValidationResult";
|
|
@@ -274,17 +274,14 @@ export class ZonosCustomerInfo {
|
|
|
274
274
|
if (type === 'shipping' &&
|
|
275
275
|
storageStore.checkoutSessionId &&
|
|
276
276
|
!this.recordedFormTypeUsed) {
|
|
277
|
-
void
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
],
|
|
286
|
-
},
|
|
287
|
-
method: 'POST',
|
|
277
|
+
void updateCheckoutSessionAttributes({
|
|
278
|
+
attributes: [
|
|
279
|
+
{
|
|
280
|
+
key: 'ZONOS_FORM_TYPE_USING',
|
|
281
|
+
value: shouldUseCustomAddressForm ? 'custom' : 'stripe',
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
checkoutSessionId: storageStore.checkoutSessionId,
|
|
288
285
|
});
|
|
289
286
|
this.recordedFormTypeUsed = true;
|
|
290
287
|
}
|
|
@@ -600,18 +600,6 @@ export const getCheckoutSessionBody = () => {
|
|
|
600
600
|
key: 'language',
|
|
601
601
|
value: localizationStore.selectedLocale,
|
|
602
602
|
},
|
|
603
|
-
{
|
|
604
|
-
key: 'appVersion',
|
|
605
|
-
value: window.Zonos.version,
|
|
606
|
-
},
|
|
607
|
-
{
|
|
608
|
-
key: 'appVersionNpmIntegration',
|
|
609
|
-
value: window.Zonos.isNpm ? '1' : '0',
|
|
610
|
-
},
|
|
611
|
-
{
|
|
612
|
-
key: 'legacyCheckoutFacade',
|
|
613
|
-
value: window.Zonos.isLegacyCheckout ? '1' : '0',
|
|
614
|
-
},
|
|
615
603
|
],
|
|
616
604
|
presentmentCountryCode: localizationStore.selectedCountryCode,
|
|
617
605
|
skipPaymentIntent: stripeStore.skipPaymentIntent,
|
|
@@ -759,18 +747,6 @@ const stripeStoreUpdateCheckoutSession = async ({ adjustmentsAmount, cartId, cur
|
|
|
759
747
|
key: 'language',
|
|
760
748
|
value: localizationStore.selectedLocale,
|
|
761
749
|
},
|
|
762
|
-
{
|
|
763
|
-
key: 'appVersion',
|
|
764
|
-
value: window.Zonos.version,
|
|
765
|
-
},
|
|
766
|
-
{
|
|
767
|
-
key: 'appVersionNpmIntegration',
|
|
768
|
-
value: window.Zonos.isNpm ? '1' : '0',
|
|
769
|
-
},
|
|
770
|
-
{
|
|
771
|
-
key: 'legacyCheckoutFacade',
|
|
772
|
-
value: window.Zonos.isLegacyCheckout ? '1' : '0',
|
|
773
|
-
},
|
|
774
750
|
],
|
|
775
751
|
presentmentCountryCode,
|
|
776
752
|
skipPaymentIntent: stripeStore.skipPaymentIntent,
|