@zonos/elements 1.3.187 → 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.
Files changed (156) hide show
  1. package/dist/cjs/TaxId-12acedde.js +94 -0
  2. package/dist/cjs/{cart-f9df3ac8.js → cart-27f6c7a4.js} +60 -0
  3. package/dist/cjs/index.cjs.js +9 -8
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/{paypal-5e73c8f5.js → paypal-84d83a76.js} +1 -1
  6. package/dist/cjs/zonos-address_11.cjs.entry.js +61 -4
  7. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +37 -31
  8. package/dist/cjs/zonos-checkout.cjs.entry.js +2 -2
  9. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  10. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-elements.cjs.js +1 -1
  13. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  14. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  15. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  17. package/dist/cjs/zonos-stripe-input.cjs.entry.js +2 -2
  18. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +14 -28
  19. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.css +1 -0
  20. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +1 -1
  21. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
  22. package/dist/collection/components/store/translationStore/strings.base.js +3 -0
  23. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
  24. package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
  25. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
  26. package/dist/collection/components/store/translationStore/strings.french.js +3 -0
  27. package/dist/collection/components/store/translationStore/strings.german.js +3 -0
  28. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
  29. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
  30. package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
  31. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
  32. package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
  33. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
  34. package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
  35. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
  36. package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
  37. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
  38. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
  39. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
  40. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
  41. package/dist/collection/components/stripe/zonos-address/zonos-address.js +65 -1
  42. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +50 -2
  43. package/dist/collection/components/utils/taxIdValidationResult.js +23 -2
  44. package/dist/collection/types/checkout/TaxId.js +64 -0
  45. package/dist/esm/TaxId-50d72254.js +90 -0
  46. package/dist/esm/{cart-4725a63b.js → cart-f5c12be6.js} +60 -0
  47. package/dist/esm/index.js +8 -8
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/esm/{paypal-a09943f4.js → paypal-594f49e9.js} +1 -1
  50. package/dist/esm/zonos-address_11.entry.js +61 -4
  51. package/dist/esm/zonos-cart-items_13.entry.js +37 -31
  52. package/dist/esm/zonos-checkout.entry.js +2 -2
  53. package/dist/esm/zonos-controller.entry.js +1 -1
  54. package/dist/esm/zonos-country-flag.entry.js +1 -1
  55. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  56. package/dist/esm/zonos-elements.js +1 -1
  57. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  58. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  59. package/dist/esm/zonos-hello.entry.js +1 -1
  60. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  61. package/dist/esm/zonos-stripe-input.entry.js +2 -2
  62. package/dist/esm-es5/TaxId-50d72254.js +1 -0
  63. package/dist/esm-es5/cart-f5c12be6.js +1 -0
  64. package/dist/esm-es5/index.js +1 -1
  65. package/dist/esm-es5/loader.js +1 -1
  66. package/dist/esm-es5/{paypal-a09943f4.js → paypal-594f49e9.js} +1 -1
  67. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  68. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  69. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  70. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  71. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  72. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  73. package/dist/esm-es5/zonos-elements.js +1 -1
  74. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  75. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  76. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  77. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  78. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  79. package/dist/scripts/index.d.ts +21 -0
  80. package/dist/scripts/index.js +1 -1
  81. package/dist/scripts/loadZonos.js +1 -1
  82. package/dist/scripts/zonos.js +1 -1
  83. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +4 -5
  84. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
  85. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
  86. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
  87. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
  88. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
  89. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
  90. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
  91. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
  92. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
  93. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
  94. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
  95. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
  96. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
  97. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
  98. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
  99. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
  100. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
  101. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
  102. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
  103. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
  104. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +13 -0
  105. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +9 -0
  106. package/dist/types/components/utils/taxIdValidationResult.d.ts +2 -1
  107. package/dist/types/components.d.ts +21 -0
  108. package/dist/types/types/checkout/TaxId.d.ts +123 -1
  109. package/dist/zonos-elements/index.esm.js +1 -1
  110. package/dist/zonos-elements/p-01eda7f2.entry.js +1 -0
  111. package/dist/zonos-elements/p-0252b8e9.system.js +1 -0
  112. package/dist/zonos-elements/p-03bbd1af.entry.js +1 -0
  113. package/dist/zonos-elements/p-04a0e38b.system.entry.js +1 -0
  114. package/dist/zonos-elements/{p-e90cb997.entry.js → p-0dae66d2.entry.js} +1 -1
  115. package/dist/zonos-elements/{p-aaff5dcc.entry.js → p-1146b6e0.entry.js} +1 -1
  116. package/dist/zonos-elements/p-23975acb.system.entry.js +1 -0
  117. package/dist/zonos-elements/p-2b8345d8.system.js +1 -0
  118. package/dist/zonos-elements/{p-04303b56.system.entry.js → p-315d8e78.system.entry.js} +1 -1
  119. package/dist/zonos-elements/{p-175e242e.entry.js → p-3707564c.entry.js} +1 -1
  120. package/dist/zonos-elements/p-3831dab5.system.js +1 -0
  121. package/dist/zonos-elements/{p-341f40c2.system.entry.js → p-3d130579.system.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-0104d3ba.entry.js → p-4d1269a7.entry.js} +1 -1
  123. package/dist/zonos-elements/p-54fdf40b.entry.js +1 -0
  124. package/dist/zonos-elements/{p-de462b9b.js → p-657390e6.js} +2 -2
  125. package/dist/zonos-elements/p-6b361d2b.js +1 -0
  126. package/dist/zonos-elements/{p-fd348fd4.system.entry.js → p-751bfce8.system.entry.js} +1 -1
  127. package/dist/zonos-elements/{p-9a7a9b1c.entry.js → p-77654589.entry.js} +1 -1
  128. package/dist/zonos-elements/{p-e5d081d8.entry.js → p-7bed199d.entry.js} +1 -1
  129. package/dist/zonos-elements/{p-995761ea.system.entry.js → p-83a7ece6.system.entry.js} +1 -1
  130. package/dist/zonos-elements/p-86d29d50.system.entry.js +1 -0
  131. package/dist/zonos-elements/{p-98e4a965.system.entry.js → p-9aa94d71.system.entry.js} +1 -1
  132. package/dist/zonos-elements/{p-818d6f17.entry.js → p-a09f64e1.entry.js} +1 -1
  133. package/dist/zonos-elements/p-d7b5b237.js +1 -0
  134. package/dist/zonos-elements/{p-6fd6af48.system.entry.js → p-db3f6d6e.system.entry.js} +1 -1
  135. package/dist/zonos-elements/{p-70d4d436.entry.js → p-ddc464c4.entry.js} +1 -1
  136. package/dist/zonos-elements/{p-9913c186.system.js → p-e2d45b2e.system.js} +1 -1
  137. package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
  138. package/dist/zonos-elements/{p-64ea232c.system.entry.js → p-ee99cf66.system.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-9f7b9d66.system.entry.js → p-eeaff898.system.entry.js} +1 -1
  140. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  141. package/package.json +1 -1
  142. package/dist/cjs/TaxId-4632639d.js +0 -29
  143. package/dist/esm/TaxId-915ef042.js +0 -26
  144. package/dist/esm-es5/TaxId-915ef042.js +0 -1
  145. package/dist/esm-es5/cart-4725a63b.js +0 -1
  146. package/dist/zonos-elements/p-12a6b7bd.system.js +0 -1
  147. package/dist/zonos-elements/p-25c47bf9.system.entry.js +0 -1
  148. package/dist/zonos-elements/p-33bdbcfd.entry.js +0 -1
  149. package/dist/zonos-elements/p-36bb3cbb.entry.js +0 -1
  150. package/dist/zonos-elements/p-56b56caa.system.entry.js +0 -1
  151. package/dist/zonos-elements/p-5bd927f2.js +0 -1
  152. package/dist/zonos-elements/p-6b40da70.system.js +0 -1
  153. package/dist/zonos-elements/p-92d83e23.system.entry.js +0 -1
  154. package/dist/zonos-elements/p-961620ae.entry.js +0 -1
  155. package/dist/zonos-elements/p-d6a43167.system.js +0 -1
  156. package/dist/zonos-elements/p-fa6de0f3.js +0 -1
@@ -167,6 +167,9 @@ export const stringsHebrew = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'מכס, מסים ועמלות',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'מספר EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'דוא"ל',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsIndonesian = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Bea masuk, pajak, dan biaya',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Nomor EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Email',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsItalian = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Dazi, tasse e spese',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Numero EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Email',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsJapanese = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: '関税、税金、手数料',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI番号',
172
+ },
170
173
  Email: {
171
174
  value: 'メール',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsKorean = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: '관세, 세금 및 수수료',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI 번호',
172
+ },
170
173
  Email: {
171
174
  value: '이메일',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsNorwegian = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Avgifter, skatter og gebyrer',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI-nummer',
172
+ },
170
173
  Email: {
171
174
  value: 'E-post',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsPolish = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Cła, podatki i opłaty',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Numer EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Email',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsPortuguese = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Impostos, taxas e emolumentos',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Número EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Email',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsRussian = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Пошлины, налоги и сборы',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Номер EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Электронная почта',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsSpanish = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Aranceles, impuestos y cuotas',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Número EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Correo electrónico',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsSwedish = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Tull, skatter och avgifter',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI-nummer',
172
+ },
170
173
  Email: {
171
174
  value: 'E-post',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsTurkish = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Gümrük vergisi, vergiler ve ücretler',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI numarası',
172
+ },
170
173
  Email: {
171
174
  value: 'E-posta',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsVietnamese = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Thuế, phí và lệ phí',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Số EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Email',
172
175
  },
@@ -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: '89bb6f1ba14507b1e40ae8fff9a01050c3ac4686', class: "zonos--address zonos--elements" }, h("zonos-text", { key: 'd93eb2a0fd3b7aeadfd9c8cdf9190d769042533a', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), h("div", { key: '3d72d447b9ae884c1ec7b6f412a1cad0e78c989c', class: "zonos--address-component" })));
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: '9e681487105fcb1b24173a72d491d874b66a51bb', class: classes([
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: '4712893040c7b88590048c0d1d636fa331cdcc66', class: "zonos--title", type: "semiBoldLabel" }, this.titleText), this.renderCompanyNameInput(), this.renderCustomAddressForm()));
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 };