@zonos/elements 1.3.188 → 1.3.190

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 (168) hide show
  1. package/dist/cjs/{CheckoutConfig-f1442a60.js → CheckoutConfig-4afc683b.js} +2 -0
  2. package/dist/cjs/TaxId-12acedde.js +94 -0
  3. package/dist/cjs/{cart-f9df3ac8.js → cart-27f6c7a4.js} +60 -0
  4. package/dist/cjs/index.cjs.js +35 -9
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/{paypal-5e73c8f5.js → paypal-84d83a76.js} +1 -1
  7. package/dist/cjs/zonos-address_11.cjs.entry.js +61 -4
  8. package/dist/cjs/zonos-cart-items_13.cjs.entry.js +37 -31
  9. package/dist/cjs/zonos-checkout.cjs.entry.js +16 -3
  10. package/dist/cjs/zonos-controller.cjs.entry.js +1 -1
  11. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  12. package/dist/cjs/zonos-country-select_4.cjs.entry.js +1 -1
  13. package/dist/cjs/zonos-elements.cjs.js +1 -1
  14. package/dist/cjs/zonos-empty-state-payment_4.cjs.entry.js +2 -2
  15. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +1 -1
  16. package/dist/cjs/zonos-hello.cjs.entry.js +1 -1
  17. package/dist/cjs/zonos-language-select_2.cjs.entry.js +1 -1
  18. package/dist/cjs/zonos-stripe-input.cjs.entry.js +1 -1
  19. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +31 -1
  20. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +14 -28
  21. package/dist/collection/components/common/zonos-stripe-input/zonos-stripe-input.js +1 -1
  22. package/dist/collection/components/store/translationStore/strings.arabic.js +3 -0
  23. package/dist/collection/components/store/translationStore/strings.base.js +3 -0
  24. package/dist/collection/components/store/translationStore/strings.chinese.js +3 -0
  25. package/dist/collection/components/store/translationStore/strings.danish.js +3 -0
  26. package/dist/collection/components/store/translationStore/strings.dutch.js +3 -0
  27. package/dist/collection/components/store/translationStore/strings.french.js +3 -0
  28. package/dist/collection/components/store/translationStore/strings.german.js +3 -0
  29. package/dist/collection/components/store/translationStore/strings.hebrew.js +3 -0
  30. package/dist/collection/components/store/translationStore/strings.indonesian.js +3 -0
  31. package/dist/collection/components/store/translationStore/strings.italian.js +3 -0
  32. package/dist/collection/components/store/translationStore/strings.japanese.js +3 -0
  33. package/dist/collection/components/store/translationStore/strings.korean.js +3 -0
  34. package/dist/collection/components/store/translationStore/strings.norwegian.js +3 -0
  35. package/dist/collection/components/store/translationStore/strings.polish.js +3 -0
  36. package/dist/collection/components/store/translationStore/strings.portuguese.js +3 -0
  37. package/dist/collection/components/store/translationStore/strings.russian.js +3 -0
  38. package/dist/collection/components/store/translationStore/strings.spanish.js +3 -0
  39. package/dist/collection/components/store/translationStore/strings.swedish.js +3 -0
  40. package/dist/collection/components/store/translationStore/strings.turkish.js +3 -0
  41. package/dist/collection/components/store/translationStore/strings.vietnamese.js +3 -0
  42. package/dist/collection/components/stripe/zonos-address/zonos-address.js +65 -1
  43. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +50 -2
  44. package/dist/collection/components/utils/taxIdValidationResult.js +23 -2
  45. package/dist/collection/scripts/_zonosBase.js +25 -1
  46. package/dist/collection/types/checkout/CheckoutConfig.js +1 -0
  47. package/dist/collection/types/checkout/TaxId.js +64 -0
  48. package/dist/esm/{CheckoutConfig-5479d192.js → CheckoutConfig-eb7d6954.js} +2 -1
  49. package/dist/esm/TaxId-50d72254.js +90 -0
  50. package/dist/esm/{cart-4725a63b.js → cart-f5c12be6.js} +60 -0
  51. package/dist/esm/index.js +34 -10
  52. package/dist/esm/loader.js +1 -1
  53. package/dist/esm/{paypal-a09943f4.js → paypal-594f49e9.js} +1 -1
  54. package/dist/esm/zonos-address_11.entry.js +61 -4
  55. package/dist/esm/zonos-cart-items_13.entry.js +37 -31
  56. package/dist/esm/zonos-checkout.entry.js +16 -3
  57. package/dist/esm/zonos-controller.entry.js +1 -1
  58. package/dist/esm/zonos-country-flag.entry.js +1 -1
  59. package/dist/esm/zonos-country-select_4.entry.js +1 -1
  60. package/dist/esm/zonos-elements.js +1 -1
  61. package/dist/esm/zonos-empty-state-payment_4.entry.js +2 -2
  62. package/dist/esm/zonos-hello-dialog.entry.js +1 -1
  63. package/dist/esm/zonos-hello.entry.js +1 -1
  64. package/dist/esm/zonos-language-select_2.entry.js +1 -1
  65. package/dist/esm/zonos-stripe-input.entry.js +1 -1
  66. package/dist/esm-es5/{CheckoutConfig-5479d192.js → CheckoutConfig-eb7d6954.js} +1 -1
  67. package/dist/esm-es5/TaxId-50d72254.js +1 -0
  68. package/dist/esm-es5/cart-f5c12be6.js +1 -0
  69. package/dist/esm-es5/index.js +1 -1
  70. package/dist/esm-es5/loader.js +1 -1
  71. package/dist/esm-es5/{paypal-a09943f4.js → paypal-594f49e9.js} +1 -1
  72. package/dist/esm-es5/zonos-address_11.entry.js +1 -1
  73. package/dist/esm-es5/zonos-cart-items_13.entry.js +1 -1
  74. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  75. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  76. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  77. package/dist/esm-es5/zonos-country-select_4.entry.js +1 -1
  78. package/dist/esm-es5/zonos-elements.js +1 -1
  79. package/dist/esm-es5/zonos-empty-state-payment_4.entry.js +1 -1
  80. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  81. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  82. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  83. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  84. package/dist/scripts/index.d.ts +34 -0
  85. package/dist/scripts/index.js +1 -1
  86. package/dist/scripts/loadZonos.js +1 -1
  87. package/dist/scripts/zonos.js +1 -1
  88. package/dist/types/components/checkout/zonos-checkout/zonos-checkout.d.ts +4 -0
  89. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +4 -5
  90. package/dist/types/components/store/translationStore/strings.arabic.d.ts +3 -0
  91. package/dist/types/components/store/translationStore/strings.base.d.ts +3 -0
  92. package/dist/types/components/store/translationStore/strings.chinese.d.ts +3 -0
  93. package/dist/types/components/store/translationStore/strings.danish.d.ts +3 -0
  94. package/dist/types/components/store/translationStore/strings.dutch.d.ts +3 -0
  95. package/dist/types/components/store/translationStore/strings.french.d.ts +3 -0
  96. package/dist/types/components/store/translationStore/strings.german.d.ts +3 -0
  97. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +3 -0
  98. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +3 -0
  99. package/dist/types/components/store/translationStore/strings.italian.d.ts +3 -0
  100. package/dist/types/components/store/translationStore/strings.japanese.d.ts +3 -0
  101. package/dist/types/components/store/translationStore/strings.korean.d.ts +3 -0
  102. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +3 -0
  103. package/dist/types/components/store/translationStore/strings.polish.d.ts +3 -0
  104. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +3 -0
  105. package/dist/types/components/store/translationStore/strings.russian.d.ts +3 -0
  106. package/dist/types/components/store/translationStore/strings.spanish.d.ts +3 -0
  107. package/dist/types/components/store/translationStore/strings.swedish.d.ts +3 -0
  108. package/dist/types/components/store/translationStore/strings.turkish.d.ts +3 -0
  109. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +3 -0
  110. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +13 -0
  111. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +9 -0
  112. package/dist/types/components/utils/taxIdValidationResult.d.ts +2 -1
  113. package/dist/types/components.d.ts +25 -0
  114. package/dist/types/scripts/_zonosBase.d.ts +9 -0
  115. package/dist/types/types/checkout/CheckoutConfig.d.ts +1 -0
  116. package/dist/types/types/checkout/TaxId.d.ts +123 -1
  117. package/dist/zonos-elements/index.esm.js +1 -1
  118. package/dist/zonos-elements/p-01eda7f2.entry.js +1 -0
  119. package/dist/zonos-elements/p-03bbd1af.entry.js +1 -0
  120. package/dist/zonos-elements/p-04a0e38b.system.entry.js +1 -0
  121. package/dist/zonos-elements/{p-e90cb997.entry.js → p-0dae66d2.entry.js} +1 -1
  122. package/dist/zonos-elements/{p-aaff5dcc.entry.js → p-1146b6e0.entry.js} +1 -1
  123. package/dist/zonos-elements/{p-8721bd47.system.entry.js → p-23975acb.system.entry.js} +1 -1
  124. package/dist/zonos-elements/p-2b8345d8.system.js +1 -0
  125. package/dist/zonos-elements/{p-04303b56.system.entry.js → p-315d8e78.system.entry.js} +1 -1
  126. package/dist/zonos-elements/{p-175e242e.entry.js → p-3707564c.entry.js} +1 -1
  127. package/dist/zonos-elements/p-3831dab5.system.js +1 -0
  128. package/dist/zonos-elements/{p-341f40c2.system.entry.js → p-3d130579.system.entry.js} +1 -1
  129. package/dist/zonos-elements/p-3f1a2d31.js +1 -0
  130. package/dist/zonos-elements/{p-0104d3ba.entry.js → p-4d1269a7.entry.js} +1 -1
  131. package/dist/zonos-elements/p-54fdf40b.entry.js +1 -0
  132. package/dist/zonos-elements/{p-8ee34712.system.js → p-5e1b2654.system.js} +1 -1
  133. package/dist/zonos-elements/{p-de462b9b.js → p-657390e6.js} +2 -2
  134. package/dist/zonos-elements/p-682e09fc.system.entry.js +1 -0
  135. package/dist/zonos-elements/p-6b361d2b.js +1 -0
  136. package/dist/zonos-elements/{p-fd348fd4.system.entry.js → p-751bfce8.system.entry.js} +1 -1
  137. package/dist/zonos-elements/{p-9a7a9b1c.entry.js → p-77654589.entry.js} +1 -1
  138. package/dist/zonos-elements/{p-e5d081d8.entry.js → p-7bed199d.entry.js} +1 -1
  139. package/dist/zonos-elements/{p-995761ea.system.entry.js → p-83a7ece6.system.entry.js} +1 -1
  140. package/dist/zonos-elements/p-86d29d50.system.entry.js +1 -0
  141. package/dist/zonos-elements/p-97e330cd.entry.js +1 -0
  142. package/dist/zonos-elements/{p-98e4a965.system.entry.js → p-9aa94d71.system.entry.js} +1 -1
  143. package/dist/zonos-elements/{p-818d6f17.entry.js → p-a09f64e1.entry.js} +1 -1
  144. package/dist/zonos-elements/p-c1458d16.system.js +1 -0
  145. package/dist/zonos-elements/p-d7b5b237.js +1 -0
  146. package/dist/zonos-elements/{p-6fd6af48.system.entry.js → p-db3f6d6e.system.entry.js} +1 -1
  147. package/dist/zonos-elements/{p-9913c186.system.js → p-e2d45b2e.system.js} +1 -1
  148. package/dist/zonos-elements/p-ea6d87a1.system.js +1 -1
  149. package/dist/zonos-elements/{p-9f7b9d66.system.entry.js → p-eeaff898.system.entry.js} +1 -1
  150. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  151. package/package.json +1 -1
  152. package/dist/cjs/TaxId-4632639d.js +0 -29
  153. package/dist/esm/TaxId-915ef042.js +0 -26
  154. package/dist/esm-es5/TaxId-915ef042.js +0 -1
  155. package/dist/esm-es5/cart-4725a63b.js +0 -1
  156. package/dist/zonos-elements/p-12a6b7bd.system.js +0 -1
  157. package/dist/zonos-elements/p-25c47bf9.system.entry.js +0 -1
  158. package/dist/zonos-elements/p-33bdbcfd.entry.js +0 -1
  159. package/dist/zonos-elements/p-36bb3cbb.entry.js +0 -1
  160. package/dist/zonos-elements/p-5bd927f2.js +0 -1
  161. package/dist/zonos-elements/p-64ea232c.system.entry.js +0 -1
  162. package/dist/zonos-elements/p-6b40da70.system.js +0 -1
  163. package/dist/zonos-elements/p-70d4d436.entry.js +0 -1
  164. package/dist/zonos-elements/p-92d83e23.system.entry.js +0 -1
  165. package/dist/zonos-elements/p-f6038af5.entry.js +0 -1
  166. package/dist/zonos-elements/p-f927fd7a.system.js +0 -1
  167. package/dist/zonos-elements/p-fa6de0f3.js +0 -1
  168. package/dist/zonos-elements/p-fe253cc1.js +0 -1
@@ -167,6 +167,9 @@ export const stringsChinese = {
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 stringsDanish = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Told, skatter og gebyrer',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI-nummer',
172
+ },
170
173
  Email: {
171
174
  value: 'E-mail',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsDutch = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Heffingen, belastingen en kosten',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI-nummer',
172
+ },
170
173
  Email: {
171
174
  value: 'E-mail',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsFrench = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Droits, taxes et frais',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'Numéro EORI',
172
+ },
170
173
  Email: {
171
174
  value: 'Courriel',
172
175
  },
@@ -167,6 +167,9 @@ export const stringsGerman = {
167
167
  'Duties, taxes, and fees': {
168
168
  value: 'Zölle, Steuern und Gebühren',
169
169
  },
170
+ 'EORI number': {
171
+ value: 'EORI-Nummer',
172
+ },
170
173
  Email: {
171
174
  value: 'E-Mail',
172
175
  },
@@ -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,4 +1,5 @@
1
1
  var _a;
2
+ import { createCustomEvent } from "../components/utils/createCustomEvent";
2
3
  import { IframeService } from "../components/utils/iframe/IframeHelpers";
3
4
  import { log } from "../components/utils/logging/log";
4
5
  import { logError } from "../components/utils/logging/logError";
@@ -9,7 +10,7 @@ import { getZonosQaUrl } from "./_getZonosQaUrl";
9
10
  import { zonosLoadStripe } from "./_loadStripe";
10
11
  import { getCartIdFromQueryParam } from "./cart/_getCartIdFromParam";
11
12
  import { setupCartDataWithSettings } from "./cart/_setupCartDataWithSettings";
12
- import { checkoutHiddenBtnSelector, } from "../types/checkout/CheckoutConfig";
13
+ import { checkoutHiddenBtnSelector, checkoutHiddenInternationalBtnSelector, } from "../types/checkout/CheckoutConfig";
13
14
  /**
14
15
  * Get the load version and url based on the loadScriptSrc, if the domain that used to load `zonos.js` is in white listed domains, use currentLoadScriptUrl as the load url instead, if zonosQaUrl exists, it would also fall under the white listed domain
15
16
  */
@@ -156,6 +157,8 @@ Zonos.init = async (params) => {
156
157
  _a.injectZonosCss();
157
158
  // inject fonts for zonos elements
158
159
  _a.injectFonts();
160
+ // inject checkout international button
161
+ _a.injectCheckoutInternationalButton();
159
162
  // init zonos controller
160
163
  _a.injectController({
161
164
  config: {
@@ -169,6 +172,18 @@ Zonos.init = async (params) => {
169
172
  });
170
173
  _a.doneInit = true;
171
174
  };
175
+ /**
176
+ * Inject the hidden international checkout button to trigger checkout regardless of shipping zones
177
+ */
178
+ Zonos.injectCheckoutInternationalButton = () => {
179
+ if (!document.querySelector(`#${checkoutHiddenInternationalBtnSelector}`)) {
180
+ // inject the hidden international checkout button
181
+ const checkoutInternationalBtn = document.createElement('button');
182
+ checkoutInternationalBtn.id = checkoutHiddenInternationalBtnSelector;
183
+ checkoutInternationalBtn.style.display = 'none';
184
+ document.body.appendChild(checkoutInternationalBtn);
185
+ }
186
+ };
172
187
  Zonos.injectCustomScriptForHostedCheckout = () => {
173
188
  const cartData = _a.cartData;
174
189
  const metadata = (cartData === null || cartData === void 0 ? void 0 : cartData.metadata) || [];
@@ -202,6 +217,15 @@ Zonos.displayCurrency = () => {
202
217
  void zonosHello.displayCurrency();
203
218
  }
204
219
  };
220
+ Zonos.triggerCheckoutInternational = async () => {
221
+ // wait for the button to be visible and attached to the event
222
+ const checkoutInternationalBtn = document.querySelector(`#${checkoutHiddenInternationalBtnSelector}`);
223
+ setTimeout(() => {
224
+ if (checkoutInternationalBtn) {
225
+ checkoutInternationalBtn.dispatchEvent(createCustomEvent('click'));
226
+ }
227
+ }, 10);
228
+ };
205
229
  // Called openHelloDialog because the main use case is to simply open the dialog
206
230
  Zonos.openHelloDialog = (value) => {
207
231
  const zonosHello = document.querySelector('zonos-hello');
@@ -1,2 +1,3 @@
1
1
  export const checkoutHiddenBtnSelector = 'zonos--checkout-hidden-button';
2
+ export const checkoutHiddenInternationalBtnSelector = 'zonos--checkout-hidden-international-button';
2
3
  export const domesticRedirectedBtnSelector = 'zonos--domestic-redirected-checkout-button';
@@ -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
  };
@@ -26,6 +26,7 @@ const _getIsValidCartId = (cartId) => {
26
26
  };
27
27
 
28
28
  const checkoutHiddenBtnSelector = 'zonos--checkout-hidden-button';
29
+ const checkoutHiddenInternationalBtnSelector = 'zonos--checkout-hidden-international-button';
29
30
  const domesticRedirectedBtnSelector = 'zonos--domestic-redirected-checkout-button';
30
31
 
31
- export { _getIsValidCartId as _, checkoutHiddenBtnSelector as c, domesticRedirectedBtnSelector as d };
32
+ export { _getIsValidCartId as _, checkoutHiddenInternationalBtnSelector as a, checkoutHiddenBtnSelector as c, domesticRedirectedBtnSelector as d };