@zonos/elements 1.3.188 → 1.3.189
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/TaxId-12acedde.js +94 -0
- package/dist/cjs/{cart-f9df3ac8.js → cart-27f6c7a4.js} +60 -0
- package/dist/cjs/index.cjs.js +9 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{paypal-5e73c8f5.js → paypal-84d83a76.js} +1 -1
- package/dist/cjs/zonos-address_11.cjs.entry.js +61 -4
- package/dist/cjs/zonos-cart-items_13.cjs.entry.js +37 -31
- package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
- package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
- package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
- package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
- package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-stripe-input.cjs.entry.js +1 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +14 -28
- package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +1 -1
- package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
- package/dist/collection/components/store/translationStore/strings.base.js +3 -0
- package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
- package/dist/collection/components/store/translationStore/strings.french.js +3 -0
- package/dist/collection/components/store/translationStore/strings.german.js +3 -0
- package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
- package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
- package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
- package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
- package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
- package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
- package/dist/collection/components/stripe/zonos-address/zonos-address.js +65 -1
- package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +50 -2
- package/dist/collection/components/utils/taxIdValidationResult.js +23 -2
- package/dist/collection/types/checkout/TaxId.js +64 -0
- package/dist/esm/TaxId-50d72254.js +90 -0
- package/dist/esm/{cart-4725a63b.js → cart-f5c12be6.js} +60 -0
- package/dist/esm/index.js +8 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{paypal-a09943f4.js → paypal-594f49e9.js} +1 -1
- package/dist/esm/zonos-address_11.entry.js +61 -4
- package/dist/esm/zonos-cart-items_13.entry.js +37 -31
- package/dist/esm/zonos-checkout.entry.js +2 -2
- package/dist/esm/zonos-controller.entry.js +1 -1
- package/dist/esm/zonos-country-flag.entry.js +1 -1
- package/dist/esm/zonos-country-select_4.entry.js +1 -1
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
- package/dist/esm/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm/zonos-hello.entry.js +1 -1
- package/dist/esm/zonos-language-select_2.entry.js +1 -1
- package/dist/esm/zonos-stripe-input.entry.js +1 -1
- package/dist/esm-es5/TaxId-50d72254.js +1 -0
- package/dist/esm-es5/cart-f5c12be6.js +1 -0
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{paypal-a09943f4.js → paypal-594f49e9.js} +1 -1
- package/dist/esm-es5/zonos-address_11.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.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/esm-es5/zonos-stripe-input.entry.js +1 -1
- package/dist/scripts/index.d.ts +21 -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-customer-info/zonos-customer-info.d.ts +4 -5
- package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
- package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
- package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +13 -0
- package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +9 -0
- package/dist/types/components/utils/taxIdValidationResult.d.ts +2 -1
- package/dist/types/components.d.ts +21 -0
- package/dist/types/types/checkout/TaxId.d.ts +123 -1
- package/dist/zonos-elements/assets/RemoveIcon.svg +1 -1
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-01eda7f2.entry.js +1 -0
- package/dist/zonos-elements/p-0252b8e9.system.js +1 -0
- package/dist/zonos-elements/p-03bbd1af.entry.js +1 -0
- package/dist/zonos-elements/p-04a0e38b.system.entry.js +1 -0
- package/dist/zonos-elements/{p-e90cb997.entry.js → p-0dae66d2.entry.js} +1 -1
- package/dist/zonos-elements/{p-aaff5dcc.entry.js → p-1146b6e0.entry.js} +1 -1
- package/dist/zonos-elements/{p-8721bd47.system.entry.js → p-23975acb.system.entry.js} +1 -1
- package/dist/zonos-elements/p-2b8345d8.system.js +1 -0
- package/dist/zonos-elements/{p-04303b56.system.entry.js → p-315d8e78.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-175e242e.entry.js → p-3707564c.entry.js} +1 -1
- package/dist/zonos-elements/p-3831dab5.system.js +1 -0
- package/dist/zonos-elements/{p-341f40c2.system.entry.js → p-3d130579.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-0104d3ba.entry.js → p-4d1269a7.entry.js} +1 -1
- package/dist/zonos-elements/p-54fdf40b.entry.js +1 -0
- package/dist/zonos-elements/{p-de462b9b.js → p-657390e6.js} +2 -2
- package/dist/zonos-elements/p-6b361d2b.js +1 -0
- package/dist/zonos-elements/{p-fd348fd4.system.entry.js → p-751bfce8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9a7a9b1c.entry.js → p-77654589.entry.js} +1 -1
- package/dist/zonos-elements/{p-e5d081d8.entry.js → p-7bed199d.entry.js} +1 -1
- package/dist/zonos-elements/{p-995761ea.system.entry.js → p-83a7ece6.system.entry.js} +1 -1
- package/dist/zonos-elements/p-86d29d50.system.entry.js +1 -0
- package/dist/zonos-elements/{p-98e4a965.system.entry.js → p-9aa94d71.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-818d6f17.entry.js → p-a09f64e1.entry.js} +1 -1
- package/dist/zonos-elements/p-d7b5b237.js +1 -0
- package/dist/zonos-elements/{p-6fd6af48.system.entry.js → p-db3f6d6e.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-70d4d436.entry.js → p-ddc464c4.entry.js} +1 -1
- package/dist/zonos-elements/{p-9913c186.system.js → p-e2d45b2e.system.js} +1 -1
- package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
- package/dist/zonos-elements/{p-64ea232c.system.entry.js → p-ee99cf66.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9f7b9d66.system.entry.js → p-eeaff898.system.entry.js} +1 -1
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/TaxId-4632639d.js +0 -29
- package/dist/esm/TaxId-915ef042.js +0 -26
- package/dist/esm-es5/TaxId-915ef042.js +0 -1
- package/dist/esm-es5/cart-4725a63b.js +0 -1
- package/dist/zonos-elements/p-12a6b7bd.system.js +0 -1
- package/dist/zonos-elements/p-25c47bf9.system.entry.js +0 -1
- package/dist/zonos-elements/p-33bdbcfd.entry.js +0 -1
- package/dist/zonos-elements/p-36bb3cbb.entry.js +0 -1
- package/dist/zonos-elements/p-5bd927f2.js +0 -1
- package/dist/zonos-elements/p-6b40da70.system.js +0 -1
- package/dist/zonos-elements/p-92d83e23.system.entry.js +0 -1
- package/dist/zonos-elements/p-f6038af5.entry.js +0 -1
- package/dist/zonos-elements/p-f927fd7a.system.js +0 -1
- package/dist/zonos-elements/p-fa6de0f3.js +0 -1
|
@@ -8,6 +8,7 @@ import { trackConversionEvent } from "../../utils/api/trackConversionEvent";
|
|
|
8
8
|
import { isCheckoutMobile } from "../../utils/checkout/isCheckoutMobile";
|
|
9
9
|
import { log } from "../../utils/logging/log";
|
|
10
10
|
import { logError } from "../../utils/logging/logError";
|
|
11
|
+
import { countryRequireTaxId, shipToTaxIdLabels, } from "../../../types/checkout/Tax";
|
|
11
12
|
/**
|
|
12
13
|
* This component is a wrapper for the stripe address element that would render default style object
|
|
13
14
|
*/
|
|
@@ -24,6 +25,7 @@ export class ZonosAddress {
|
|
|
24
25
|
this.type = undefined;
|
|
25
26
|
this.titleText = undefined;
|
|
26
27
|
this.defaultAddress = [];
|
|
28
|
+
this.taxIdErrorMessage = '';
|
|
27
29
|
this.stripe = window.Zonos.stripe;
|
|
28
30
|
this.isDirtyAddress = false;
|
|
29
31
|
this.isAddressFilled = false;
|
|
@@ -183,6 +185,33 @@ export class ZonosAddress {
|
|
|
183
185
|
}
|
|
184
186
|
void this.watchInitStripe();
|
|
185
187
|
}
|
|
188
|
+
isInTaxIdCountry(countryCode) {
|
|
189
|
+
return countryRequireTaxId.includes(countryCode);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Render tax id input based on ship to country code
|
|
193
|
+
*/
|
|
194
|
+
renderTaxIdInput() {
|
|
195
|
+
var _a;
|
|
196
|
+
// No need to render tax id input for billing address
|
|
197
|
+
if (this.type === 'billing') {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
const countryCode = (_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.value.address.country;
|
|
201
|
+
// Don't render tax id input if the country is not provided
|
|
202
|
+
if (!countryCode) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
const isCountryRequireTaxId = this.isInTaxIdCountry(countryCode);
|
|
206
|
+
if (!isCountryRequireTaxId) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
const taxIdInputInfo = shipToTaxIdLabels[countryCode];
|
|
210
|
+
return (h("div", { class: "zonos--tax-id-input" }, h("zonos-stripe-input", { inputLabel: translate(taxIdInputInfo.friendlyName), inputPlaceholder: taxIdInputInfo.placeholder, inputValue: stripeStore.taxId || '', isError: !!this.taxIdErrorMessage, onInputChange: (event) => {
|
|
211
|
+
stripeStore.taxId = event.detail;
|
|
212
|
+
this.taxIdChanged.emit(event.detail);
|
|
213
|
+
} }), this.taxIdErrorMessage && (h("zonos-text", { textColor: 'red-600', type: "caption" }, this.taxIdErrorMessage))));
|
|
214
|
+
}
|
|
186
215
|
renderCompanyNameInput() {
|
|
187
216
|
var _a;
|
|
188
217
|
// No need to render company name for billing address
|
|
@@ -219,7 +248,7 @@ export class ZonosAddress {
|
|
|
219
248
|
this.isAddressFilled = true;
|
|
220
249
|
}
|
|
221
250
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
222
|
-
return (h(Host, { key: '
|
|
251
|
+
return (h(Host, { key: '603d9b20415c68a3337316d5882b931870546b91', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'bf50ebdb5d923bb0f394d021cd1bc4efbde0137e', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), h("div", { key: '8712b6649822782ec450fe040acc29eb4ca21ed3', class: "zonos--address-component" })));
|
|
223
252
|
}
|
|
224
253
|
static get is() { return "zonos-address"; }
|
|
225
254
|
static get encapsulation() { return "scoped"; }
|
|
@@ -296,6 +325,26 @@ export class ZonosAddress {
|
|
|
296
325
|
"getter": false,
|
|
297
326
|
"setter": false,
|
|
298
327
|
"defaultValue": "[]"
|
|
328
|
+
},
|
|
329
|
+
"taxIdErrorMessage": {
|
|
330
|
+
"type": "string",
|
|
331
|
+
"mutable": false,
|
|
332
|
+
"complexType": {
|
|
333
|
+
"original": "string",
|
|
334
|
+
"resolved": "string",
|
|
335
|
+
"references": {}
|
|
336
|
+
},
|
|
337
|
+
"required": false,
|
|
338
|
+
"optional": false,
|
|
339
|
+
"docs": {
|
|
340
|
+
"tags": [],
|
|
341
|
+
"text": "Error message for tax id input"
|
|
342
|
+
},
|
|
343
|
+
"getter": false,
|
|
344
|
+
"setter": false,
|
|
345
|
+
"attribute": "tax-id-error-message",
|
|
346
|
+
"reflect": false,
|
|
347
|
+
"defaultValue": "''"
|
|
299
348
|
}
|
|
300
349
|
};
|
|
301
350
|
}
|
|
@@ -323,6 +372,21 @@ export class ZonosAddress {
|
|
|
323
372
|
"resolved": "boolean",
|
|
324
373
|
"references": {}
|
|
325
374
|
}
|
|
375
|
+
}, {
|
|
376
|
+
"method": "taxIdChanged",
|
|
377
|
+
"name": "taxIdChanged",
|
|
378
|
+
"bubbles": true,
|
|
379
|
+
"cancelable": true,
|
|
380
|
+
"composed": true,
|
|
381
|
+
"docs": {
|
|
382
|
+
"tags": [],
|
|
383
|
+
"text": "Event to emit when tax id is changed"
|
|
384
|
+
},
|
|
385
|
+
"complexType": {
|
|
386
|
+
"original": "string",
|
|
387
|
+
"resolved": "string",
|
|
388
|
+
"references": {}
|
|
389
|
+
}
|
|
326
390
|
}];
|
|
327
391
|
}
|
|
328
392
|
static get elementRef() { return "el"; }
|
|
@@ -23,6 +23,7 @@ import { isCheckoutMobile } from "../../utils/checkout/isCheckoutMobile";
|
|
|
23
23
|
import { classes } from "../../utils/classes";
|
|
24
24
|
import { log } from "../../utils/logging/log";
|
|
25
25
|
import { mergeAddress } from "../../utils/mergeAddress";
|
|
26
|
+
import { countryRequireTaxId, shipToTaxIdLabels, } from "../../../types/checkout/Tax";
|
|
26
27
|
/**
|
|
27
28
|
* This component is a wrapper for the stripe address element that would render default style object
|
|
28
29
|
*/
|
|
@@ -185,6 +186,7 @@ export class ZonosAddress {
|
|
|
185
186
|
this.type = undefined;
|
|
186
187
|
this.titleText = undefined;
|
|
187
188
|
this.defaultAddress = [];
|
|
189
|
+
this.taxIdErrorMessage = '';
|
|
188
190
|
this.stripe = window.Zonos.stripe;
|
|
189
191
|
this.isDirtyAddress = false;
|
|
190
192
|
this.isAddressFilled = false;
|
|
@@ -289,6 +291,32 @@ export class ZonosAddress {
|
|
|
289
291
|
const hasErrors = line1 || postalCode || state || city || firstName || lastName || phone;
|
|
290
292
|
return !hasErrors;
|
|
291
293
|
}
|
|
294
|
+
isInTaxIdCountry(countryCode) {
|
|
295
|
+
return countryRequireTaxId.includes(countryCode);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Render tax id input based on ship to country code
|
|
299
|
+
*/
|
|
300
|
+
renderTaxIdInput() {
|
|
301
|
+
var _a;
|
|
302
|
+
// No need to render tax id input for billing address
|
|
303
|
+
if (this.type === 'billing') {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
const countryCode = (_a = stripeStore.stripeAddressEventData) === null || _a === void 0 ? void 0 : _a.value.address.country;
|
|
307
|
+
// Don't render tax id input if the country is not provided
|
|
308
|
+
if (!countryCode) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
const isCountryRequireTaxId = this.isInTaxIdCountry(countryCode);
|
|
312
|
+
if (!isCountryRequireTaxId) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
const taxIdInputInfo = shipToTaxIdLabels[countryCode];
|
|
316
|
+
return (h("div", { class: "zonos--tax-id-input" }, h("zonos-stripe-input", { error: this.taxIdErrorMessage, inputLabel: translate(taxIdInputInfo.friendlyName), inputPlaceholder: taxIdInputInfo.placeholder, inputValue: stripeStore.taxId || '', isError: !!this.taxIdErrorMessage, onInputChange: (event) => {
|
|
317
|
+
stripeStore.taxId = event.detail;
|
|
318
|
+
} })));
|
|
319
|
+
}
|
|
292
320
|
renderCompanyNameInput() {
|
|
293
321
|
var _a;
|
|
294
322
|
// No need to render company name for billing address
|
|
@@ -774,10 +802,10 @@ export class ZonosAddress {
|
|
|
774
802
|
this.country = localizationStore.selectedCountryCode;
|
|
775
803
|
}
|
|
776
804
|
// this component loads iframe from the stripe elements and puts here, so we don't need to do anything here
|
|
777
|
-
return (h(Host, { key: '
|
|
805
|
+
return (h(Host, { key: '1d80f8ffc85a27a7630fcc883d0bd9e8b7973d95', class: classes([
|
|
778
806
|
'zonos--address zonos--elements',
|
|
779
807
|
`zonos--${this.type}-address`,
|
|
780
|
-
]) }, h("zonos-text", { key: '
|
|
808
|
+
]) }, h("zonos-text", { key: '6f0bde17ecda83d01cdb8576df4a03a226921db8', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderTaxIdInput(), this.renderCustomAddressForm()));
|
|
781
809
|
}
|
|
782
810
|
static get is() { return "zonos-custom-address"; }
|
|
783
811
|
static get encapsulation() { return "scoped"; }
|
|
@@ -854,6 +882,26 @@ export class ZonosAddress {
|
|
|
854
882
|
"getter": false,
|
|
855
883
|
"setter": false,
|
|
856
884
|
"defaultValue": "[]"
|
|
885
|
+
},
|
|
886
|
+
"taxIdErrorMessage": {
|
|
887
|
+
"type": "string",
|
|
888
|
+
"mutable": false,
|
|
889
|
+
"complexType": {
|
|
890
|
+
"original": "string",
|
|
891
|
+
"resolved": "string",
|
|
892
|
+
"references": {}
|
|
893
|
+
},
|
|
894
|
+
"required": false,
|
|
895
|
+
"optional": false,
|
|
896
|
+
"docs": {
|
|
897
|
+
"tags": [],
|
|
898
|
+
"text": "Error message for tax id input"
|
|
899
|
+
},
|
|
900
|
+
"getter": false,
|
|
901
|
+
"setter": false,
|
|
902
|
+
"attribute": "tax-id-error-message",
|
|
903
|
+
"reflect": false,
|
|
904
|
+
"defaultValue": "''"
|
|
857
905
|
}
|
|
858
906
|
};
|
|
859
907
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { euCountryCodes } from "../../types/index";
|
|
1
2
|
const isTaxIdRequired = (shippingCountry) => {
|
|
2
|
-
const requireTaxIdCountry = ['MX'];
|
|
3
|
+
const requireTaxIdCountry = ['MX', ...euCountryCodes];
|
|
3
4
|
return requireTaxIdCountry.includes(shippingCountry);
|
|
4
5
|
};
|
|
5
|
-
export const taxIdValidationResult = ({ shippingCountry, taxId, }) => {
|
|
6
|
+
export const taxIdValidationResult = ({ companyName, shippingCountry, taxId, }) => {
|
|
7
|
+
// Check to see if we are required to collect tax id for the shipping country or not
|
|
6
8
|
const taxRequired = isTaxIdRequired(shippingCountry);
|
|
7
9
|
if (!taxRequired) {
|
|
8
10
|
return {
|
|
@@ -10,6 +12,25 @@ export const taxIdValidationResult = ({ shippingCountry, taxId, }) => {
|
|
|
10
12
|
valid: true,
|
|
11
13
|
};
|
|
12
14
|
}
|
|
15
|
+
// For GB, tax id is not required if company name is not filled (not business address)
|
|
16
|
+
if (shippingCountry === 'GB') {
|
|
17
|
+
if (!companyName) {
|
|
18
|
+
return {
|
|
19
|
+
error: null,
|
|
20
|
+
valid: true,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (!taxId) {
|
|
24
|
+
return {
|
|
25
|
+
error: 'Tax id is required',
|
|
26
|
+
valid: false,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
error: null,
|
|
31
|
+
valid: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
13
34
|
if (!taxId) {
|
|
14
35
|
return {
|
|
15
36
|
error: 'Tax id is required',
|
|
@@ -1,24 +1,88 @@
|
|
|
1
|
+
export const euCountryCodes = [
|
|
2
|
+
'AT',
|
|
3
|
+
'BE',
|
|
4
|
+
'BG',
|
|
5
|
+
'CY',
|
|
6
|
+
'CZ',
|
|
7
|
+
'DE',
|
|
8
|
+
'DK',
|
|
9
|
+
'EE',
|
|
10
|
+
'ES',
|
|
11
|
+
'FI',
|
|
12
|
+
'FR',
|
|
13
|
+
'GR',
|
|
14
|
+
'HR',
|
|
15
|
+
'HU',
|
|
16
|
+
'IE',
|
|
17
|
+
'IT',
|
|
18
|
+
'LT',
|
|
19
|
+
'LU',
|
|
20
|
+
'LV',
|
|
21
|
+
'MT',
|
|
22
|
+
'NL',
|
|
23
|
+
'PL',
|
|
24
|
+
'PT',
|
|
25
|
+
'RO',
|
|
26
|
+
'SE',
|
|
27
|
+
'SI',
|
|
28
|
+
'SK',
|
|
29
|
+
'CH',
|
|
30
|
+
'NO',
|
|
31
|
+
'GB',
|
|
32
|
+
];
|
|
1
33
|
export const countryRequireTaxId = [
|
|
2
34
|
'AR',
|
|
3
35
|
'BR',
|
|
4
36
|
'KR',
|
|
5
37
|
'MX',
|
|
38
|
+
// EU countries
|
|
39
|
+
...euCountryCodes,
|
|
6
40
|
];
|
|
7
41
|
export const shipToTaxIdLabels = {
|
|
8
42
|
AR: {
|
|
9
43
|
friendlyName: 'Unique Labor Identification Code',
|
|
10
44
|
placeholder: '00-00000000-0',
|
|
11
45
|
},
|
|
46
|
+
AT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
47
|
+
BE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
48
|
+
BG: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
12
49
|
BR: {
|
|
13
50
|
friendlyName: 'CPF/CNPJ number',
|
|
14
51
|
placeholder: '000.000.000-00',
|
|
15
52
|
},
|
|
53
|
+
CH: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
54
|
+
CY: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
55
|
+
CZ: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
56
|
+
DE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
57
|
+
DK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
58
|
+
EE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
59
|
+
ES: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
60
|
+
FI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
61
|
+
FR: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
62
|
+
GB: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
63
|
+
GR: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
64
|
+
HR: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
65
|
+
HU: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
66
|
+
IE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
67
|
+
IT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
16
68
|
KR: {
|
|
17
69
|
friendlyName: 'Personal Customers Clearance Code',
|
|
18
70
|
placeholder: '000-00-00000',
|
|
19
71
|
},
|
|
72
|
+
LT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
73
|
+
LU: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
74
|
+
LV: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
75
|
+
MT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
20
76
|
MX: {
|
|
21
77
|
friendlyName: 'RFC number',
|
|
22
78
|
placeholder: 'XAXX010101000',
|
|
23
79
|
},
|
|
80
|
+
NL: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
81
|
+
NO: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
82
|
+
PL: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
83
|
+
PT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
84
|
+
RO: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
85
|
+
SE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
86
|
+
SI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
87
|
+
SK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
24
88
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const euCountryCodes = [
|
|
2
|
+
'AT',
|
|
3
|
+
'BE',
|
|
4
|
+
'BG',
|
|
5
|
+
'CY',
|
|
6
|
+
'CZ',
|
|
7
|
+
'DE',
|
|
8
|
+
'DK',
|
|
9
|
+
'EE',
|
|
10
|
+
'ES',
|
|
11
|
+
'FI',
|
|
12
|
+
'FR',
|
|
13
|
+
'GR',
|
|
14
|
+
'HR',
|
|
15
|
+
'HU',
|
|
16
|
+
'IE',
|
|
17
|
+
'IT',
|
|
18
|
+
'LT',
|
|
19
|
+
'LU',
|
|
20
|
+
'LV',
|
|
21
|
+
'MT',
|
|
22
|
+
'NL',
|
|
23
|
+
'PL',
|
|
24
|
+
'PT',
|
|
25
|
+
'RO',
|
|
26
|
+
'SE',
|
|
27
|
+
'SI',
|
|
28
|
+
'SK',
|
|
29
|
+
'CH',
|
|
30
|
+
'NO',
|
|
31
|
+
'GB',
|
|
32
|
+
];
|
|
33
|
+
const countryRequireTaxId = [
|
|
34
|
+
'AR',
|
|
35
|
+
'BR',
|
|
36
|
+
'KR',
|
|
37
|
+
'MX',
|
|
38
|
+
// EU countries
|
|
39
|
+
...euCountryCodes,
|
|
40
|
+
];
|
|
41
|
+
const shipToTaxIdLabels = {
|
|
42
|
+
AR: {
|
|
43
|
+
friendlyName: 'Unique Labor Identification Code',
|
|
44
|
+
placeholder: '00-00000000-0',
|
|
45
|
+
},
|
|
46
|
+
AT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
47
|
+
BE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
48
|
+
BG: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
49
|
+
BR: {
|
|
50
|
+
friendlyName: 'CPF/CNPJ number',
|
|
51
|
+
placeholder: '000.000.000-00',
|
|
52
|
+
},
|
|
53
|
+
CH: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
54
|
+
CY: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
55
|
+
CZ: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
56
|
+
DE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
57
|
+
DK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
58
|
+
EE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
59
|
+
ES: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
60
|
+
FI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
61
|
+
FR: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
62
|
+
GB: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
63
|
+
GR: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
64
|
+
HR: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
65
|
+
HU: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
66
|
+
IE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
67
|
+
IT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
68
|
+
KR: {
|
|
69
|
+
friendlyName: 'Personal Customers Clearance Code',
|
|
70
|
+
placeholder: '000-00-00000',
|
|
71
|
+
},
|
|
72
|
+
LT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
73
|
+
LU: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
74
|
+
LV: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
75
|
+
MT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
76
|
+
MX: {
|
|
77
|
+
friendlyName: 'RFC number',
|
|
78
|
+
placeholder: 'XAXX010101000',
|
|
79
|
+
},
|
|
80
|
+
NL: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
81
|
+
NO: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
82
|
+
PL: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
83
|
+
PT: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
84
|
+
RO: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
85
|
+
SE: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
86
|
+
SI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
87
|
+
SK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { countryRequireTaxId as c, euCountryCodes as e, shipToTaxIdLabels as s };
|
|
@@ -172,6 +172,9 @@ const stringsArabic = {
|
|
|
172
172
|
'Duties, taxes, and fees': {
|
|
173
173
|
value: 'الرسوم والضرائب والرسوم',
|
|
174
174
|
},
|
|
175
|
+
'EORI number': {
|
|
176
|
+
value: 'رقم EORI',
|
|
177
|
+
},
|
|
175
178
|
Email: {
|
|
176
179
|
value: 'البريد الإلكتروني',
|
|
177
180
|
},
|
|
@@ -818,6 +821,9 @@ const stringsBase = {
|
|
|
818
821
|
'Duties, taxes, and fees': {
|
|
819
822
|
value: 'Duties, taxes, and fees',
|
|
820
823
|
},
|
|
824
|
+
'EORI number': {
|
|
825
|
+
value: 'EORI number',
|
|
826
|
+
},
|
|
821
827
|
Email: {
|
|
822
828
|
value: 'Email',
|
|
823
829
|
},
|
|
@@ -1464,6 +1470,9 @@ const stringsChinese = {
|
|
|
1464
1470
|
'Duties, taxes, and fees': {
|
|
1465
1471
|
value: '关税、税款和费用',
|
|
1466
1472
|
},
|
|
1473
|
+
'EORI number': {
|
|
1474
|
+
value: 'EORI编号',
|
|
1475
|
+
},
|
|
1467
1476
|
Email: {
|
|
1468
1477
|
value: '电子邮件',
|
|
1469
1478
|
},
|
|
@@ -2109,6 +2118,9 @@ const stringsDanish = {
|
|
|
2109
2118
|
'Duties, taxes, and fees': {
|
|
2110
2119
|
value: 'Told, skatter og gebyrer',
|
|
2111
2120
|
},
|
|
2121
|
+
'EORI number': {
|
|
2122
|
+
value: 'EORI-nummer',
|
|
2123
|
+
},
|
|
2112
2124
|
Email: {
|
|
2113
2125
|
value: 'E-mail',
|
|
2114
2126
|
},
|
|
@@ -2754,6 +2766,9 @@ const stringsDutch = {
|
|
|
2754
2766
|
'Duties, taxes, and fees': {
|
|
2755
2767
|
value: 'Heffingen, belastingen en kosten',
|
|
2756
2768
|
},
|
|
2769
|
+
'EORI number': {
|
|
2770
|
+
value: 'EORI-nummer',
|
|
2771
|
+
},
|
|
2757
2772
|
Email: {
|
|
2758
2773
|
value: 'E-mail',
|
|
2759
2774
|
},
|
|
@@ -3399,6 +3414,9 @@ const stringsFrench = {
|
|
|
3399
3414
|
'Duties, taxes, and fees': {
|
|
3400
3415
|
value: 'Droits, taxes et frais',
|
|
3401
3416
|
},
|
|
3417
|
+
'EORI number': {
|
|
3418
|
+
value: 'Numéro EORI',
|
|
3419
|
+
},
|
|
3402
3420
|
Email: {
|
|
3403
3421
|
value: 'Courriel',
|
|
3404
3422
|
},
|
|
@@ -4044,6 +4062,9 @@ const stringsGerman = {
|
|
|
4044
4062
|
'Duties, taxes, and fees': {
|
|
4045
4063
|
value: 'Zölle, Steuern und Gebühren',
|
|
4046
4064
|
},
|
|
4065
|
+
'EORI number': {
|
|
4066
|
+
value: 'EORI-Nummer',
|
|
4067
|
+
},
|
|
4047
4068
|
Email: {
|
|
4048
4069
|
value: 'E-Mail',
|
|
4049
4070
|
},
|
|
@@ -4689,6 +4710,9 @@ const stringsHebrew = {
|
|
|
4689
4710
|
'Duties, taxes, and fees': {
|
|
4690
4711
|
value: 'מכס, מסים ועמלות',
|
|
4691
4712
|
},
|
|
4713
|
+
'EORI number': {
|
|
4714
|
+
value: 'מספר EORI',
|
|
4715
|
+
},
|
|
4692
4716
|
Email: {
|
|
4693
4717
|
value: 'דוא"ל',
|
|
4694
4718
|
},
|
|
@@ -5334,6 +5358,9 @@ const stringsIndonesian = {
|
|
|
5334
5358
|
'Duties, taxes, and fees': {
|
|
5335
5359
|
value: 'Bea masuk, pajak, dan biaya',
|
|
5336
5360
|
},
|
|
5361
|
+
'EORI number': {
|
|
5362
|
+
value: 'Nomor EORI',
|
|
5363
|
+
},
|
|
5337
5364
|
Email: {
|
|
5338
5365
|
value: 'Email',
|
|
5339
5366
|
},
|
|
@@ -5979,6 +6006,9 @@ const stringsItalian = {
|
|
|
5979
6006
|
'Duties, taxes, and fees': {
|
|
5980
6007
|
value: 'Dazi, tasse e spese',
|
|
5981
6008
|
},
|
|
6009
|
+
'EORI number': {
|
|
6010
|
+
value: 'Numero EORI',
|
|
6011
|
+
},
|
|
5982
6012
|
Email: {
|
|
5983
6013
|
value: 'Email',
|
|
5984
6014
|
},
|
|
@@ -6624,6 +6654,9 @@ const stringsJapanese = {
|
|
|
6624
6654
|
'Duties, taxes, and fees': {
|
|
6625
6655
|
value: '関税、税金、手数料',
|
|
6626
6656
|
},
|
|
6657
|
+
'EORI number': {
|
|
6658
|
+
value: 'EORI番号',
|
|
6659
|
+
},
|
|
6627
6660
|
Email: {
|
|
6628
6661
|
value: 'メール',
|
|
6629
6662
|
},
|
|
@@ -7269,6 +7302,9 @@ const stringsKorean = {
|
|
|
7269
7302
|
'Duties, taxes, and fees': {
|
|
7270
7303
|
value: '관세, 세금 및 수수료',
|
|
7271
7304
|
},
|
|
7305
|
+
'EORI number': {
|
|
7306
|
+
value: 'EORI 번호',
|
|
7307
|
+
},
|
|
7272
7308
|
Email: {
|
|
7273
7309
|
value: '이메일',
|
|
7274
7310
|
},
|
|
@@ -7914,6 +7950,9 @@ const stringsNorwegian = {
|
|
|
7914
7950
|
'Duties, taxes, and fees': {
|
|
7915
7951
|
value: 'Avgifter, skatter og gebyrer',
|
|
7916
7952
|
},
|
|
7953
|
+
'EORI number': {
|
|
7954
|
+
value: 'EORI-nummer',
|
|
7955
|
+
},
|
|
7917
7956
|
Email: {
|
|
7918
7957
|
value: 'E-post',
|
|
7919
7958
|
},
|
|
@@ -8559,6 +8598,9 @@ const stringsPolish = {
|
|
|
8559
8598
|
'Duties, taxes, and fees': {
|
|
8560
8599
|
value: 'Cła, podatki i opłaty',
|
|
8561
8600
|
},
|
|
8601
|
+
'EORI number': {
|
|
8602
|
+
value: 'Numer EORI',
|
|
8603
|
+
},
|
|
8562
8604
|
Email: {
|
|
8563
8605
|
value: 'Email',
|
|
8564
8606
|
},
|
|
@@ -9204,6 +9246,9 @@ const stringsPortuguese = {
|
|
|
9204
9246
|
'Duties, taxes, and fees': {
|
|
9205
9247
|
value: 'Impostos, taxas e emolumentos',
|
|
9206
9248
|
},
|
|
9249
|
+
'EORI number': {
|
|
9250
|
+
value: 'Número EORI',
|
|
9251
|
+
},
|
|
9207
9252
|
Email: {
|
|
9208
9253
|
value: 'Email',
|
|
9209
9254
|
},
|
|
@@ -9849,6 +9894,9 @@ const stringsRussian = {
|
|
|
9849
9894
|
'Duties, taxes, and fees': {
|
|
9850
9895
|
value: 'Пошлины, налоги и сборы',
|
|
9851
9896
|
},
|
|
9897
|
+
'EORI number': {
|
|
9898
|
+
value: 'Номер EORI',
|
|
9899
|
+
},
|
|
9852
9900
|
Email: {
|
|
9853
9901
|
value: 'Электронная почта',
|
|
9854
9902
|
},
|
|
@@ -10494,6 +10542,9 @@ const stringsSpanish = {
|
|
|
10494
10542
|
'Duties, taxes, and fees': {
|
|
10495
10543
|
value: 'Aranceles, impuestos y cuotas',
|
|
10496
10544
|
},
|
|
10545
|
+
'EORI number': {
|
|
10546
|
+
value: 'Número EORI',
|
|
10547
|
+
},
|
|
10497
10548
|
Email: {
|
|
10498
10549
|
value: 'Correo electrónico',
|
|
10499
10550
|
},
|
|
@@ -11139,6 +11190,9 @@ const stringsSwedish = {
|
|
|
11139
11190
|
'Duties, taxes, and fees': {
|
|
11140
11191
|
value: 'Tull, skatter och avgifter',
|
|
11141
11192
|
},
|
|
11193
|
+
'EORI number': {
|
|
11194
|
+
value: 'EORI-nummer',
|
|
11195
|
+
},
|
|
11142
11196
|
Email: {
|
|
11143
11197
|
value: 'E-post',
|
|
11144
11198
|
},
|
|
@@ -11784,6 +11838,9 @@ const stringsTurkish = {
|
|
|
11784
11838
|
'Duties, taxes, and fees': {
|
|
11785
11839
|
value: 'Gümrük vergisi, vergiler ve ücretler',
|
|
11786
11840
|
},
|
|
11841
|
+
'EORI number': {
|
|
11842
|
+
value: 'EORI numarası',
|
|
11843
|
+
},
|
|
11787
11844
|
Email: {
|
|
11788
11845
|
value: 'E-posta',
|
|
11789
11846
|
},
|
|
@@ -12429,6 +12486,9 @@ const stringsVietnamese = {
|
|
|
12429
12486
|
'Duties, taxes, and fees': {
|
|
12430
12487
|
value: 'Thuế, phí và lệ phí',
|
|
12431
12488
|
},
|
|
12489
|
+
'EORI number': {
|
|
12490
|
+
value: 'Số EORI',
|
|
12491
|
+
},
|
|
12432
12492
|
Email: {
|
|
12433
12493
|
value: 'Email',
|
|
12434
12494
|
},
|