@zonos/elements 1.3.215 → 1.3.216
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-e0b62259.js → cart-96520eab.js} +51 -22
- package/dist/cjs/{handleFetch-7cf3752e.js → handleFetch-b821ed5d.js} +2 -2
- package/dist/cjs/index.cjs.js +8 -8
- package/dist/cjs/{localization-91bcde0e.js → localization-e241e025.js} +1 -1
- package/dist/cjs/{paypal-93e5de01.js → paypal-97ac0999.js} +3 -3
- package/dist/cjs/{updateCheckoutSessionAttributes-047bc0cb.js → updateCheckoutSessionAttributes-5f794550.js} +1 -1
- package/dist/cjs/zonos-address_11.cjs.entry.js +25 -16
- package/dist/cjs/zonos-cart-items_14.cjs.entry.js +10 -7
- package/dist/cjs/zonos-checkout.cjs.entry.js +5 -5
- package/dist/cjs/zonos-controller.cjs.entry.js +3 -3
- package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +4 -4
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello.cjs.entry.js +2 -2
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +8 -7
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +6 -2
- package/dist/collection/components/store/checkout/stripe.js +6 -2
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +9 -2
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +8 -4
- package/dist/collection/components/utils/api/prepCalculateLandedCost.js +13 -8
- package/dist/collection/components/utils/checkout/buildTranslateRequest.js +14 -10
- package/dist/collection/components/utils/extractName.js +17 -0
- package/dist/collection/components/utils/handleFetch.js +2 -2
- package/dist/esm/{cart-c3540cd7.js → cart-011aa510.js} +51 -23
- package/dist/esm/{handleFetch-dd74bbb1.js → handleFetch-bb221e63.js} +2 -2
- package/dist/esm/index.js +8 -8
- package/dist/esm/{localization-cf31c728.js → localization-b3bdf691.js} +1 -1
- package/dist/esm/{paypal-5963c1ab.js → paypal-8af04edf.js} +3 -3
- package/dist/esm/{updateCheckoutSessionAttributes-7babf0f2.js → updateCheckoutSessionAttributes-fa58ba66.js} +1 -1
- package/dist/esm/zonos-address_11.entry.js +25 -16
- package/dist/esm/zonos-cart-items_14.entry.js +10 -7
- package/dist/esm/zonos-checkout.entry.js +5 -5
- package/dist/esm/zonos-controller.entry.js +3 -3
- package/dist/esm/zonos-country-flag.entry.js +2 -2
- package/dist/esm/zonos-country-select_4.entry.js +2 -2
- package/dist/esm/zonos-empty-state-payment_4.entry.js +4 -4
- package/dist/esm/zonos-hello-dialog.entry.js +2 -2
- package/dist/esm/zonos-hello.entry.js +2 -2
- package/dist/esm/zonos-language-select_2.entry.js +2 -2
- package/dist/esm-es5/cart-011aa510.js +1 -0
- package/dist/esm-es5/{handleFetch-dd74bbb1.js → handleFetch-bb221e63.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{localization-cf31c728.js → localization-b3bdf691.js} +1 -1
- package/dist/esm-es5/{paypal-5963c1ab.js → paypal-8af04edf.js} +1 -1
- package/dist/esm-es5/{updateCheckoutSessionAttributes-7babf0f2.js → updateCheckoutSessionAttributes-fa58ba66.js} +1 -1
- package/dist/esm-es5/zonos-address_11.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-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-language-select_2.entry.js +1 -1
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/utils/extractName.d.ts +14 -0
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/{p-c34645cb.js → p-0627d793.js} +1 -1
- package/dist/zonos-elements/{p-6c69c5fa.system.entry.js → p-24043e4f.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-e72b61c1.system.entry.js → p-2fa8f2b8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-41ec9531.entry.js → p-3940f15d.entry.js} +1 -1
- package/dist/zonos-elements/p-48b2fbb7.entry.js +1 -0
- package/dist/zonos-elements/{p-ac784ab8.system.entry.js → p-4ec7abf7.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-6e8354c1.system.entry.js → p-4f2994f9.system.entry.js} +1 -1
- package/dist/zonos-elements/p-547babdd.entry.js +1 -0
- package/dist/zonos-elements/{p-4444bb4e.system.js → p-54fd7799.system.js} +1 -1
- package/dist/zonos-elements/{p-755cf8bc.system.js → p-56a2d942.system.js} +1 -1
- package/dist/zonos-elements/{p-b22fcbda.system.entry.js → p-573b0565.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-8d37bb03.entry.js → p-592cdd54.entry.js} +1 -1
- package/dist/zonos-elements/p-5a7130da.entry.js +1 -0
- package/dist/zonos-elements/p-62cb568d.system.entry.js +1 -0
- package/dist/zonos-elements/p-6cd4160d.system.js +1 -0
- package/dist/zonos-elements/{p-fb898c4f.system.js → p-801919e5.system.js} +1 -1
- package/dist/zonos-elements/p-8037d54c.entry.js +1 -0
- package/dist/zonos-elements/p-81b357f7.system.js +1 -1
- package/dist/zonos-elements/{p-1d0e40b7.entry.js → p-8cafb9a4.entry.js} +1 -1
- package/dist/zonos-elements/{p-f99c254c.system.js → p-9d717d8d.system.js} +1 -1
- package/dist/zonos-elements/{p-a1cd5572.system.entry.js → p-a3e6cf3e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-a45a15a0.js → p-b6dfa589.js} +1 -1
- package/dist/zonos-elements/{p-137ee43a.system.entry.js → p-c4b7b1a4.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-a537a179.system.entry.js → p-cd62465e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c8433f89.js → p-da079b20.js} +1 -1
- package/dist/zonos-elements/{p-79a3756e.entry.js → p-db07e61c.entry.js} +1 -1
- package/dist/zonos-elements/{p-2eec2d7c.js → p-e4d475c3.js} +1 -1
- package/dist/zonos-elements/p-ef76be6f.system.js +1 -0
- package/dist/zonos-elements/p-f04bad33.system.entry.js +1 -0
- package/dist/zonos-elements/p-f08d180a.js +1 -0
- package/dist/zonos-elements/{p-752220fe.entry.js → p-f1ba6a31.entry.js} +1 -1
- package/dist/zonos-elements/{p-6a157c84.entry.js → p-f530cb04.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/esm-es5/cart-c3540cd7.js +0 -1
- package/dist/zonos-elements/p-0707379c.entry.js +0 -1
- package/dist/zonos-elements/p-2820aff2.system.js +0 -1
- package/dist/zonos-elements/p-299efbcf.system.entry.js +0 -1
- package/dist/zonos-elements/p-6d7e45f3.entry.js +0 -1
- package/dist/zonos-elements/p-9004bdda.entry.js +0 -1
- package/dist/zonos-elements/p-9e037920.system.entry.js +0 -1
- package/dist/zonos-elements/p-adbc4643.system.js +0 -1
- package/dist/zonos-elements/p-c9c96740.entry.js +0 -1
- package/dist/zonos-elements/p-f979a131.js +0 -1
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
4
|
-
const localization = require('./localization-
|
|
5
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const localization = require('./localization-e241e025.js');
|
|
5
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
6
6
|
const isDarkColor = require('./isDarkColor-428965f4.js');
|
|
7
7
|
const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Extract first name and last name from the name string
|
|
11
|
+
* If first name and last name are provided, use them
|
|
12
|
+
* If name is provided, extract and return the first and last name from the name string
|
|
13
|
+
* If neither are provided, return an empty object
|
|
14
|
+
*/
|
|
15
|
+
const extractName = ({ firstName, lastName, name, }) => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (!name && !firstName && !lastName) {
|
|
18
|
+
return { firstName: '', lastName: '' };
|
|
19
|
+
}
|
|
20
|
+
// Use first name and last name if they are provided
|
|
21
|
+
const nameParts = (name === null || name === void 0 ? void 0 : name.split(/\s+/)) || [];
|
|
22
|
+
const _firstName = (firstName === null || firstName === void 0 ? void 0 : firstName.trim()) || ((_a = nameParts[0]) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
23
|
+
const _lastName = (lastName === null || lastName === void 0 ? void 0 : lastName.trim()) || nameParts.slice(1).join(' ').trim() || '';
|
|
24
|
+
return { firstName: _firstName, lastName: _lastName };
|
|
25
|
+
};
|
|
26
|
+
|
|
9
27
|
/**
|
|
10
28
|
* Extract value from translated object
|
|
11
29
|
*/
|
|
@@ -45,14 +63,16 @@ const prepCartCalculateLandedCost = (cartId) => {
|
|
|
45
63
|
currentAddress: stripeAddressData,
|
|
46
64
|
translatedAddress: stripeStore.translatedAddress.address,
|
|
47
65
|
});
|
|
48
|
-
const shippingFirstName
|
|
49
|
-
|
|
66
|
+
const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
|
|
67
|
+
name: translatedShippingAddress.name,
|
|
68
|
+
});
|
|
50
69
|
const translatedBillingAddress = getTranslatedAddress({
|
|
51
70
|
currentAddress: stripeBillingAddressData,
|
|
52
71
|
translatedAddress: stripeStore.translatedAddress.address,
|
|
53
72
|
});
|
|
54
|
-
const billingFirstName
|
|
55
|
-
|
|
73
|
+
const { firstName: billingFirstName, lastName: billingLastName } = extractName({
|
|
74
|
+
name: translatedBillingAddress.name,
|
|
75
|
+
});
|
|
56
76
|
return {
|
|
57
77
|
billingAddress: {
|
|
58
78
|
addressLine1: translatedBillingAddress.line1,
|
|
@@ -122,14 +142,16 @@ const prepCalculateLandedCost = () => {
|
|
|
122
142
|
currentAddress: stripeAddressData,
|
|
123
143
|
translatedAddress: stripeStore.translatedAddress.address,
|
|
124
144
|
});
|
|
125
|
-
const shippingFirstName
|
|
126
|
-
|
|
145
|
+
const { firstName: shippingFirstName, lastName: shippingLastName } = extractName({
|
|
146
|
+
name: translatedShippingAddress.name,
|
|
147
|
+
});
|
|
127
148
|
const translatedBillingAddress = getTranslatedAddress({
|
|
128
149
|
currentAddress: stripeBillingAddressData,
|
|
129
150
|
translatedAddress: stripeStore.translatedAddress.address,
|
|
130
151
|
});
|
|
131
|
-
const billingFirstName
|
|
132
|
-
|
|
152
|
+
const { firstName: billingFirstName, lastName: billingLastName } = extractName({
|
|
153
|
+
name: translatedBillingAddress.name,
|
|
154
|
+
});
|
|
133
155
|
const convertedCartAdjuments = cartStore.adjustments.map(adjustment => ({
|
|
134
156
|
amount: adjustment.amount,
|
|
135
157
|
name: adjustment.description || null,
|
|
@@ -424,7 +446,6 @@ const getExcludeAddressFieldsObject = ({ address, invalidAdddressList, }) => {
|
|
|
424
446
|
* @returns {ValidateAddressRequest | null} - An object that contains the address fields that have invalid characters, the destination country, and the first and last name. If the conditions are not met, the function returns null.
|
|
425
447
|
*/
|
|
426
448
|
const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInvalidCharactersList, stripeAddressEventData, stripeBillingAddressEventData, stripeShippingSameAsBilling, }) => {
|
|
427
|
-
var _a, _b, _c, _d;
|
|
428
449
|
const isStripeAddressReady = !!(stripeAddressEventData === null || stripeAddressEventData === void 0 ? void 0 : stripeAddressEventData.complete);
|
|
429
450
|
const isStripeBillingAddressReady = stripeShippingSameAsBilling
|
|
430
451
|
? isStripeAddressReady
|
|
@@ -440,15 +461,19 @@ const buildTranslateRequest = ({ addressInvalidCharactersList, billingAddressInv
|
|
|
440
461
|
const stripeAddressValue = stripeAddressEventData.value;
|
|
441
462
|
const stripeBillingAddressValue = (stripeBillingAddressEventData === null || stripeBillingAddressEventData === void 0 ? void 0 : stripeBillingAddressEventData.value) || null;
|
|
442
463
|
// Returns undefined if the name is Latin so it won't be included in the request body
|
|
443
|
-
const firstName
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
?
|
|
464
|
+
const { firstName: stripeShippingFirstName, lastName: stripeShippingLastName, } = extractName({
|
|
465
|
+
firstName: stripeAddressValue.firstName,
|
|
466
|
+
lastName: stripeAddressValue.lastName,
|
|
467
|
+
name: stripeAddressValue.name,
|
|
468
|
+
});
|
|
469
|
+
const name = `${stripeShippingFirstName} ${stripeShippingLastName}`;
|
|
470
|
+
const { firstName: stripeBillingFirstName, lastName: stripeBillingLastName } = extractName({
|
|
471
|
+
firstName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.firstName,
|
|
472
|
+
lastName: stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.lastName,
|
|
473
|
+
name: (stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.name) || '',
|
|
474
|
+
});
|
|
475
|
+
const billingName = stripeBillingFirstName && stripeBillingLastName
|
|
476
|
+
? `${stripeBillingFirstName} ${stripeBillingLastName}`
|
|
452
477
|
: '';
|
|
453
478
|
const address = stripeAddressValue.address;
|
|
454
479
|
const billingAddress = stripeBillingAddressValue === null || stripeBillingAddressValue === void 0 ? void 0 : stripeBillingAddressValue.address;
|
|
@@ -785,8 +810,11 @@ const checkIsAddressOutdatedForAsyncAddressUpdate = () => {
|
|
|
785
810
|
isCompanyNameDirty);
|
|
786
811
|
};
|
|
787
812
|
const buildAddressForPartyCreate = ({ address, firstName, lastName, name, phone, }) => {
|
|
788
|
-
const
|
|
789
|
-
|
|
813
|
+
const { firstName: _firstName, lastName: _lastName } = extractName({
|
|
814
|
+
firstName,
|
|
815
|
+
lastName,
|
|
816
|
+
name,
|
|
817
|
+
});
|
|
790
818
|
if (!_firstName || !_lastName) {
|
|
791
819
|
void handleFetch.sendErrorLog({
|
|
792
820
|
endpoint: 'PARTY_CREATE_NO_NAME_FOUND',
|
|
@@ -2163,6 +2191,7 @@ exports.cartStoreStartCheckoutInterval = cartStoreStartCheckoutInterval;
|
|
|
2163
2191
|
exports.cartStoreUpdateItems = cartStoreUpdateItems;
|
|
2164
2192
|
exports.cartStoreUpdateSelectedShippingOption = cartStoreUpdateSelectedShippingOption;
|
|
2165
2193
|
exports.cartStoreUpdateToErrorState = cartStoreUpdateToErrorState;
|
|
2194
|
+
exports.extractName = extractName;
|
|
2166
2195
|
exports.getCheckoutSessionBody = getCheckoutSessionBody;
|
|
2167
2196
|
exports.initStripeElements = initStripeElements;
|
|
2168
2197
|
exports.sortServiceLevelOptionsByAmount = sortServiceLevelOptionsByAmount;
|
|
@@ -433,9 +433,9 @@ const handleRequestWithFallback = async ({ basePathType: _basePathType, options,
|
|
|
433
433
|
(message.includes('signal is aborted') ||
|
|
434
434
|
message.includes('The operation was aborted') ||
|
|
435
435
|
message.includes('Fetch is aborted')));
|
|
436
|
-
const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404;
|
|
436
|
+
const isUnknownError = !!unknownError || (response === null || response === void 0 ? void 0 : response.status) === 404 || (response === null || response === void 0 ? void 0 : response.status) === 500;
|
|
437
437
|
const shouldCallFallback =
|
|
438
|
-
// If next fallback is available, and the error is unknown (Failed to fetch) or 404
|
|
438
|
+
// If next fallback is available, and the error is unknown (Failed to fetch) or 404 or 500 (server error)
|
|
439
439
|
nextFallbackApiType && isUnknownError;
|
|
440
440
|
// Should log the error if it's unknown error
|
|
441
441
|
if (isUnknownError && !isAbortError) {
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
6
6
|
const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
|
|
7
|
-
const handleFetch = require('./handleFetch-
|
|
7
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
8
8
|
const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
|
|
9
9
|
const VarianceTest = require('./VarianceTest-0cb1e118.js');
|
|
10
10
|
const TaxId = require('./TaxId-12acedde.js');
|
|
@@ -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.216.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.') ||
|
|
@@ -375,10 +375,10 @@ const zonosLoadUrl = (() => {
|
|
|
375
375
|
}
|
|
376
376
|
return null;
|
|
377
377
|
})();
|
|
378
|
-
const ZONOS_URL = "https://v1.3.
|
|
379
|
-
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
380
|
-
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.
|
|
381
|
-
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.
|
|
378
|
+
const ZONOS_URL = "https://v1.3.216.js.zonos.com";
|
|
379
|
+
const JS_DELIVR_ZONOS_URL = zonosLoadUrl || "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.216";
|
|
380
|
+
const UNPKG_ZONOS_URL = "https://unpkg.com/@zonos/elements@1.3.216";
|
|
381
|
+
const CDNJS_ZONOS_URL = "https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.216";
|
|
382
382
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
383
383
|
const GOOGLE_FONT_REGEX = /^https:\/\/fonts\.googleapis\.com/;
|
|
384
384
|
class Zonos {
|
|
@@ -396,7 +396,7 @@ Zonos.iframeLogType = typeof window !== 'undefined'
|
|
|
396
396
|
? new URLSearchParams(window.location.search).get('iframeLogType')
|
|
397
397
|
: null;
|
|
398
398
|
Zonos.isBigCommerce = false;
|
|
399
|
-
Zonos.releaseDate = "
|
|
399
|
+
Zonos.releaseDate = "1749769356368";
|
|
400
400
|
Zonos.isLegacyCheckout = false;
|
|
401
401
|
Zonos.domain = typeof window !== 'undefined'
|
|
402
402
|
? // domain that embeds the iframe
|
|
@@ -414,7 +414,7 @@ Zonos.isNpm = true;
|
|
|
414
414
|
Zonos.zonosQaUrl = null;
|
|
415
415
|
Zonos.zonosQaUrlApi = null;
|
|
416
416
|
Zonos.trackEventLogs = [];
|
|
417
|
-
Zonos.version = `v${"1.3.
|
|
417
|
+
Zonos.version = `v${"1.3.216"}`;
|
|
418
418
|
Zonos.modeAlerted = false;
|
|
419
419
|
Zonos.cartData = null;
|
|
420
420
|
Zonos.paypal = null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
4
|
-
const cart = require('./cart-
|
|
5
|
-
const localization = require('./localization-
|
|
6
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const cart = require('./cart-96520eab.js');
|
|
5
|
+
const localization = require('./localization-e241e025.js');
|
|
6
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
7
7
|
const isDarkColor = require('./isDarkColor-428965f4.js');
|
|
8
8
|
|
|
9
9
|
/*!
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const debounce = require('./debounce-465a4328.js');
|
|
4
|
-
const handleFetch = require('./handleFetch-
|
|
4
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
5
5
|
|
|
6
6
|
const attributesToUpdate = {};
|
|
7
7
|
// Store debounced functions per session to ensure proper debouncing
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
6
|
const debounce$1 = require('./debounce-465a4328.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
8
|
-
const cart = require('./cart-
|
|
9
|
-
const localization = require('./localization-
|
|
10
|
-
const handleFetch = require('./handleFetch-
|
|
8
|
+
const cart = require('./cart-96520eab.js');
|
|
9
|
+
const localization = require('./localization-e241e025.js');
|
|
10
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
11
11
|
const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
|
|
12
12
|
const TaxId = require('./TaxId-12acedde.js');
|
|
13
13
|
const classes = require('./classes-b7918f56.js');
|
|
@@ -273,8 +273,14 @@ const ZonosAddress$1 = class {
|
|
|
273
273
|
}
|
|
274
274
|
}, 600);
|
|
275
275
|
}
|
|
276
|
+
const { firstName, lastName } = cart.extractName({
|
|
277
|
+
firstName: eventValue.firstName,
|
|
278
|
+
lastName: eventValue.lastName,
|
|
279
|
+
name: eventValue.name,
|
|
280
|
+
});
|
|
276
281
|
this.updateAddressEventData({
|
|
277
|
-
event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName
|
|
282
|
+
event: Object.assign(Object.assign({}, event), { elementMode: this.type, elementType: 'address', value: Object.assign(Object.assign({}, eventValue), { firstName,
|
|
283
|
+
lastName }) }),
|
|
278
284
|
type: this.type,
|
|
279
285
|
});
|
|
280
286
|
});
|
|
@@ -378,7 +384,7 @@ const ZonosAddress$1 = class {
|
|
|
378
384
|
this.isAddressFilled = true;
|
|
379
385
|
}
|
|
380
386
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
381
|
-
return (index.h(index.Host, { key: '
|
|
387
|
+
return (index.h(index.Host, { key: '13b9fdc214b7ffeacaa180f1ba0d49032b417b6f', class: "zonos--address zonos--elements" }, index.h("zonos-text", { key: '7a6ec3c462293e85926b0f379860d8d4edfe6120', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), index.h("div", { key: '36c094186e6ce2ce1d1c4e8f56823fd032b3ad9e', class: "zonos--address-component" })));
|
|
382
388
|
}
|
|
383
389
|
get el() { return index.getElement(this); }
|
|
384
390
|
static get watchers() { return {
|
|
@@ -443,18 +449,18 @@ const ZonosAddressForm = class {
|
|
|
443
449
|
}
|
|
444
450
|
render() {
|
|
445
451
|
const { city, country, line1, line2, name, phone, postal_code, state } = this.localAddress;
|
|
446
|
-
const firstName =
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
return (index.h(index.Host, { key: '
|
|
452
|
+
const { firstName, lastName } = cart.extractName({
|
|
453
|
+
name,
|
|
454
|
+
});
|
|
455
|
+
return (index.h(index.Host, { key: '22d085e462e69a4100a8cb1763367f53b933ed1d', class: "zonos--address-form zonos--elements" }, index.h("div", { key: '17d6c92370343ffbd1b4a85b3c49055a5a7f9d72', class: "zonos--title" }, index.h("zonos-text", { key: 'a4cb01bd8fed154567e0b7ade87777a1552ea815', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
|
|
450
456
|
? localization.translate('Shipping')
|
|
451
|
-
: localization.translate('Billing'))), index.h("div", { key: '
|
|
457
|
+
: localization.translate('Billing'))), index.h("div", { key: '4a1dddabc011e465d295b5c2994fda3a2531c96e', class: "zonos--address-group" }, index.h("div", { key: '60df882b5717b2f557a5051f492b2c838f938cd9', class: "zonos--contact" }, index.h("zonos-text", { key: '90b6613ccf1b2a445baae5f700f392d195924688', type: "label" }, localization.translate('Contact')), index.h("zonos-input", { key: '125815769a366e113b61d5581578ef6ecbdffa79', class: "zonos--form-email", inputLabel: localization.translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), index.h("div", { key: 'd0d331fb33f40243ce23824db5ba9551fd5636f8', class: "zonos--name zonos--address-row" }, index.h("zonos-input", { key: '46323db8f305e491215df03ef2092e76eec38355', class: "zonos--form-first-name", inputLabel: localization.translate('First name'), inputValue: firstName, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
|
|
452
458
|
key: 'name',
|
|
453
459
|
value: `${e.detail} ${lastName}`,
|
|
454
|
-
}) }), index.h("zonos-input", { key: '
|
|
460
|
+
}) }), index.h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: localization.translate('Last name'), inputValue: lastName, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
|
|
455
461
|
key: 'name',
|
|
456
462
|
value: `${firstName} ${e.detail}`,
|
|
457
|
-
}) }))), index.h("div", { key: '
|
|
463
|
+
}) }))), index.h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, index.h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, localization.translate('Address')), index.h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: localization.translate('Country'), inputValue: country, isDisabled: true }), index.h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: localization.translate('Address line 1'), inputValue: line1, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), index.h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: localization.translate('Address line 2'), inputValue: line2, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), index.h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, index.h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: localization.translate('City'), inputValue: city, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), index.h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: localization.translate('State/Province'), inputValue: state, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), index.h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: localization.translate('Postal code'), inputValue: postal_code, isError: shouldRenderTaxIdInput.isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), index.h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: localization.translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
|
|
458
464
|
}
|
|
459
465
|
static get watchers() { return {
|
|
460
466
|
"translatedAddress": ["watchCurrentAddress"]
|
|
@@ -1254,14 +1260,17 @@ const ZonosAddress = class {
|
|
|
1254
1260
|
// Use data from default address if it's available
|
|
1255
1261
|
const firstDefaultAddress = this.defaultAddress[0];
|
|
1256
1262
|
if (firstDefaultAddress) {
|
|
1263
|
+
const { firstName, lastName } = cart.extractName({
|
|
1264
|
+
name: firstDefaultAddress.name,
|
|
1265
|
+
});
|
|
1257
1266
|
const countryCode = firstDefaultAddress.address.country ||
|
|
1258
1267
|
localization.localizationStore.selectedCountryCode ||
|
|
1259
1268
|
'US';
|
|
1260
1269
|
this.setFormValues({
|
|
1261
1270
|
city: firstDefaultAddress.address.city,
|
|
1262
1271
|
country: countryCode,
|
|
1263
|
-
firstName
|
|
1264
|
-
lastName
|
|
1272
|
+
firstName,
|
|
1273
|
+
lastName,
|
|
1265
1274
|
line1: firstDefaultAddress.address.line1,
|
|
1266
1275
|
line2: firstDefaultAddress.address.line2 || '',
|
|
1267
1276
|
phone: firstDefaultAddress.phone || '',
|
|
@@ -1729,10 +1738,10 @@ const ZonosAddress = class {
|
|
|
1729
1738
|
this.country = localization.localizationStore.selectedCountryCode;
|
|
1730
1739
|
}
|
|
1731
1740
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
1732
|
-
return (index.h(index.Host, { key: '
|
|
1741
|
+
return (index.h(index.Host, { key: '9e1d9e1ed3fca30876ba8310510873a5b10c6552', class: classes.classes([
|
|
1733
1742
|
'zonos--address zonos--elements',
|
|
1734
1743
|
`zonos--${this.type}-address`,
|
|
1735
|
-
]) }, index.h("zonos-text", { key: '
|
|
1744
|
+
]) }, index.h("zonos-text", { key: '2356d42946b3ed93c4670fb876101a1371ac5c14', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
|
|
1736
1745
|
}
|
|
1737
1746
|
get el() { return index.getElement(this); }
|
|
1738
1747
|
static get watchers() { return {
|
|
@@ -3,18 +3,18 @@
|
|
|
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-96520eab.js');
|
|
7
|
+
const localization = require('./localization-e241e025.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
10
|
-
const paypal = require('./paypal-
|
|
11
|
-
const handleFetch = require('./handleFetch-
|
|
10
|
+
const paypal = require('./paypal-97ac0999.js');
|
|
11
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
12
12
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
13
13
|
const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
|
|
14
14
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
15
15
|
const isDarkColor = require('./isDarkColor-428965f4.js');
|
|
16
16
|
const isColorVariable = require('./isColorVariable-525dbfa7.js');
|
|
17
|
-
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-
|
|
17
|
+
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-5f794550.js');
|
|
18
18
|
const shouldRenderTaxIdInput = require('./shouldRenderTaxIdInput-9b8a8de1.js');
|
|
19
19
|
const TaxId = require('./TaxId-12acedde.js');
|
|
20
20
|
require('./VarianceTest-0cb1e118.js');
|
|
@@ -2448,11 +2448,14 @@ const ZonosCustomerInfo = class {
|
|
|
2448
2448
|
if (!stripeEventDataObj || !submitDataByKey) {
|
|
2449
2449
|
return;
|
|
2450
2450
|
}
|
|
2451
|
+
const { firstName, lastName } = cart.extractName({
|
|
2452
|
+
name: submitDataByKey.name,
|
|
2453
|
+
});
|
|
2451
2454
|
const updateData = Object.assign(Object.assign({}, stripeEventDataObj), { complete: true, value: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value), { address: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address), { city: submitDataByKey.city ||
|
|
2452
2455
|
(stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address.city) ||
|
|
2453
|
-
'', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName
|
|
2456
|
+
'', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName,
|
|
2454
2457
|
// get all the names after
|
|
2455
|
-
lastName
|
|
2458
|
+
lastName, name: submitDataByKey.name }) });
|
|
2456
2459
|
// overwrite the address object with the new data
|
|
2457
2460
|
if (type === 'shippingAddress') {
|
|
2458
2461
|
cart.stripeStore.stripeAddressEventData = updateData;
|
|
@@ -3,12 +3,12 @@
|
|
|
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-96520eab.js');
|
|
7
|
+
const paypal = require('./paypal-97ac0999.js');
|
|
8
|
+
const localization = require('./localization-e241e025.js');
|
|
9
9
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
10
|
-
const handleFetch = require('./handleFetch-
|
|
11
|
-
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-
|
|
10
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
11
|
+
const updateCheckoutSessionAttributes = require('./updateCheckoutSessionAttributes-5f794550.js');
|
|
12
12
|
const CheckoutConfig = require('./CheckoutConfig-27c82f94.js');
|
|
13
13
|
const classes = require('./classes-b7918f56.js');
|
|
14
14
|
const createCustomEvent = require('./createCustomEvent-7b6fad95.js');
|
|
@@ -3,11 +3,11 @@
|
|
|
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-96520eab.js');
|
|
7
|
+
const localization = require('./localization-e241e025.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
9
9
|
const getGenericSettingsOverride = require('./getGenericSettingsOverride-c0ca32b9.js');
|
|
10
|
-
const handleFetch = require('./handleFetch-
|
|
10
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
11
11
|
require('./isDarkColor-428965f4.js');
|
|
12
12
|
require('./getBorderRadius-1b5e33cf.js');
|
|
13
13
|
require('./VarianceTest-0cb1e118.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 localization = require('./localization-
|
|
6
|
+
const localization = require('./localization-e241e025.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-b821ed5d.js');
|
|
10
10
|
require('./VarianceTest-0cb1e118.js');
|
|
11
11
|
|
|
12
12
|
const zonosCountryFlagCss = ":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .flag-container{position:relative;overflow:hidden;width:100%;height:100%}:host .flag-icon{position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-repeat:no-repeat;background-size:cover}";
|
|
@@ -3,13 +3,13 @@
|
|
|
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-e241e025.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
8
8
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
9
9
|
const isDarkColor = require('./isDarkColor-428965f4.js');
|
|
10
10
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
12
|
-
require('./handleFetch-
|
|
12
|
+
require('./handleFetch-b821ed5d.js');
|
|
13
13
|
require('./VarianceTest-0cb1e118.js');
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -6,10 +6,10 @@ const index = require('./index-1c710d00.js');
|
|
|
6
6
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
const getBorderRadius = require('./getBorderRadius-1b5e33cf.js');
|
|
9
|
-
const cart = require('./cart-
|
|
10
|
-
const localization = require('./localization-
|
|
11
|
-
const handleFetch = require('./handleFetch-
|
|
12
|
-
const paypal = require('./paypal-
|
|
9
|
+
const cart = require('./cart-96520eab.js');
|
|
10
|
+
const localization = require('./localization-e241e025.js');
|
|
11
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
12
|
+
const paypal = require('./paypal-97ac0999.js');
|
|
13
13
|
require('./VarianceTest-0cb1e118.js');
|
|
14
14
|
require('./isDarkColor-428965f4.js');
|
|
15
15
|
|
|
@@ -3,13 +3,13 @@
|
|
|
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-e241e025.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
8
8
|
const classes = require('./classes-b7918f56.js');
|
|
9
9
|
const formatStringWithLinks = require('./formatStringWithLinks-52341fc7.js');
|
|
10
10
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
11
11
|
const TaxId = require('./TaxId-12acedde.js');
|
|
12
|
-
require('./handleFetch-
|
|
12
|
+
require('./handleFetch-b821ed5d.js');
|
|
13
13
|
require('./VarianceTest-0cb1e118.js');
|
|
14
14
|
|
|
15
15
|
const getHasMoreSpaceAbove = (ref) => {
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1c710d00.js');
|
|
6
6
|
const debounce = require('./debounce-465a4328.js');
|
|
7
|
-
const localization = require('./localization-
|
|
7
|
+
const localization = require('./localization-e241e025.js');
|
|
8
8
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
9
9
|
const classes = require('./classes-b7918f56.js');
|
|
10
|
-
const handleFetch = require('./handleFetch-
|
|
10
|
+
const handleFetch = require('./handleFetch-b821ed5d.js');
|
|
11
11
|
const getHasMoreSpaceOnRight = require('./getHasMoreSpaceOnRight-4c94667f.js');
|
|
12
12
|
require('./VarianceTest-0cb1e118.js');
|
|
13
13
|
|
|
@@ -3,10 +3,10 @@
|
|
|
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-e241e025.js');
|
|
7
7
|
const zonosStore = require('./zonosStore-f8ee56aa.js');
|
|
8
8
|
const ILanguage = require('./ILanguage-98b04442.js');
|
|
9
|
-
require('./handleFetch-
|
|
9
|
+
require('./handleFetch-b821ed5d.js');
|
|
10
10
|
require('./VarianceTest-0cb1e118.js');
|
|
11
11
|
|
|
12
12
|
const GreenCheckDuotoneIcon = `<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import { translate } from "../../../../store/translationStore";
|
|
3
3
|
import { isTextContainsNonLatinChars } from "../../../../utils/containsNonLatinChars";
|
|
4
|
+
import { extractName } from "../../../../utils/extractName";
|
|
4
5
|
export class ZonosAddressForm {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -23,18 +24,18 @@ export class ZonosAddressForm {
|
|
|
23
24
|
}
|
|
24
25
|
render() {
|
|
25
26
|
const { city, country, line1, line2, name, phone, postal_code, state } = this.localAddress;
|
|
26
|
-
const firstName =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (h(Host, { key: '
|
|
27
|
+
const { firstName, lastName } = extractName({
|
|
28
|
+
name,
|
|
29
|
+
});
|
|
30
|
+
return (h(Host, { key: '22d085e462e69a4100a8cb1763367f53b933ed1d', class: "zonos--address-form zonos--elements" }, h("div", { key: '17d6c92370343ffbd1b4a85b3c49055a5a7f9d72', class: "zonos--title" }, h("zonos-text", { key: 'a4cb01bd8fed154567e0b7ade87777a1552ea815', textColor: "gray-700", type: "smallHeader" }, this.addressType === 'shipping'
|
|
30
31
|
? translate('Shipping')
|
|
31
|
-
: translate('Billing'))), h("div", { key: '
|
|
32
|
+
: translate('Billing'))), h("div", { key: '4a1dddabc011e465d295b5c2994fda3a2531c96e', class: "zonos--address-group" }, h("div", { key: '60df882b5717b2f557a5051f492b2c838f938cd9', class: "zonos--contact" }, h("zonos-text", { key: '90b6613ccf1b2a445baae5f700f392d195924688', type: "label" }, translate('Contact')), h("zonos-input", { key: '125815769a366e113b61d5581578ef6ecbdffa79', class: "zonos--form-email", inputLabel: translate('Email'), inputValue: this.currentAddress.email, isDisabled: true }), h("div", { key: 'd0d331fb33f40243ce23824db5ba9551fd5636f8', class: "zonos--name zonos--address-row" }, h("zonos-input", { key: '46323db8f305e491215df03ef2092e76eec38355', class: "zonos--form-first-name", inputLabel: translate('First name'), inputValue: firstName, isError: isTextContainsNonLatinChars(firstName), onInputChange: e => this.onInputChange({
|
|
32
33
|
key: 'name',
|
|
33
34
|
value: `${e.detail} ${lastName}`,
|
|
34
|
-
}) }), h("zonos-input", { key: '
|
|
35
|
+
}) }), h("zonos-input", { key: '3c055ee2f1fcaf93ebcbd8f11ad6609cd33e9e14', class: "zonos--form-last-name", inputLabel: translate('Last name'), inputValue: lastName, isError: isTextContainsNonLatinChars(lastName), onInputChange: e => this.onInputChange({
|
|
35
36
|
key: 'name',
|
|
36
37
|
value: `${firstName} ${e.detail}`,
|
|
37
|
-
}) }))), h("div", { key: '
|
|
38
|
+
}) }))), h("div", { key: 'ce30f816d03b497eb4491d2554eb63c0aabf110c', class: "zonos--address" }, h("zonos-text", { key: '304867c5354ac55071c88944a63bba88ea3fb86f', type: "label" }, translate('Address')), h("zonos-input", { key: 'f0efe937603a38761643af1486b53359a19593e5', class: "zonos--form-country", inputLabel: translate('Country'), inputValue: country, isDisabled: true }), h("zonos-input", { key: '8360a4ae65c8963e886a3fb8322e0e539d121142', class: "zonos--form-line1", inputLabel: translate('Address line 1'), inputValue: line1, isError: isTextContainsNonLatinChars(line1), onInputChange: e => this.onInputChange({ key: 'line1', value: e.detail }) }), h("zonos-input", { key: '2c9374917b705c2c9306d3d4d7fc4b4043c2b73b', class: "zonos--form-line2", inputLabel: translate('Address line 2'), inputValue: line2, isError: isTextContainsNonLatinChars(line2), onInputChange: e => this.onInputChange({ key: 'line2', value: e.detail }) }), h("div", { key: 'fd067074070cadba3d895503f35c344ff817fec2', class: "zonos--address-row" }, h("zonos-input", { key: 'a565bee68e2498403df2801eb90005e8cb2d6f44', class: "zonos--form-city", inputLabel: translate('City'), inputValue: city, isError: isTextContainsNonLatinChars(city), onInputChange: e => this.onInputChange({ key: 'city', value: e.detail }) }), h("zonos-input", { key: '89bae75b691aacdd62b624f65eee303bfb3fc811', class: "zonos--form-state", inputLabel: translate('State/Province'), inputValue: state, isError: isTextContainsNonLatinChars(state), onInputChange: e => this.onInputChange({ key: 'state', value: e.detail }) })), h("zonos-input", { key: '9a851b9f449ed135859b7b828bf362168caf76fb', class: "zonos--form-postal-code", inputLabel: translate('Postal code'), inputValue: postal_code, isError: isTextContainsNonLatinChars(postal_code), onInputChange: e => this.onInputChange({ key: 'postal_code', value: e.detail }) }), h("zonos-input", { key: 'a51b8ba1e22d5a12eac9021abe83fdc20f8eb1a6', class: "zonos--form-phone", inputLabel: translate('Phone number'), inputValue: phone, onInputChange: e => this.onInputChange({ key: 'phone', value: e.detail }) })))));
|
|
38
39
|
}
|
|
39
40
|
static get is() { return "zonos-address-form"; }
|
|
40
41
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,6 +7,7 @@ import { translate } from "../../../store/translationStore";
|
|
|
7
7
|
import { getZonosStoreTheme, zonosStore, zonosStoreOnChange, } from "../../../store/zonosStore";
|
|
8
8
|
import { updateCheckoutSessionAttributes } from "../../../utils/api/updateCheckoutSessionAttributes";
|
|
9
9
|
import { containsNonLatinChars } from "../../../utils/containsNonLatinChars";
|
|
10
|
+
import { extractName } from "../../../utils/extractName";
|
|
10
11
|
import { log } from "../../../utils/logging/log";
|
|
11
12
|
import { sendErrorLog } from "../../../utils/logging/sendErrorLog";
|
|
12
13
|
import { taxIdValidationResult } from "../../../utils/taxIdValidationResult";
|
|
@@ -105,11 +106,14 @@ export class ZonosCustomerInfo {
|
|
|
105
106
|
if (!stripeEventDataObj || !submitDataByKey) {
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
109
|
+
const { firstName, lastName } = extractName({
|
|
110
|
+
name: submitDataByKey.name,
|
|
111
|
+
});
|
|
108
112
|
const updateData = Object.assign(Object.assign({}, stripeEventDataObj), { complete: true, value: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value), { address: Object.assign(Object.assign({}, stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address), { city: submitDataByKey.city ||
|
|
109
113
|
(stripeEventDataObj === null || stripeEventDataObj === void 0 ? void 0 : stripeEventDataObj.value.address.city) ||
|
|
110
|
-
'', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName
|
|
114
|
+
'', line1: submitDataByKey.line1, line2: submitDataByKey.line2, postal_code: submitDataByKey.postal_code, state: submitDataByKey.state }), firstName,
|
|
111
115
|
// get all the names after
|
|
112
|
-
lastName
|
|
116
|
+
lastName, name: submitDataByKey.name }) });
|
|
113
117
|
// overwrite the address object with the new data
|
|
114
118
|
if (type === 'shippingAddress') {
|
|
115
119
|
stripeStore.stripeAddressEventData = updateData;
|