@zonos/elements 1.5.0 → 1.5.1

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 (388) hide show
  1. package/dist/cjs/{TaxId-Q6aDqqWv.js → TaxId-ChhNwG04.js} +36 -0
  2. package/dist/cjs/{cart-B6Aty-21.js → cart-CiXlehwQ.js} +88 -52
  3. package/dist/cjs/{collect-DnrvaXUI.js → collect-Drr8fY-q.js} +3 -3
  4. package/dist/cjs/{debounce-Cd2emZPn.js → debounce-BhgA8_3W.js} +2 -2
  5. package/dist/cjs/{debounce-vY0QYT6o.js → debounce-DRPMxNew.js} +1 -1
  6. package/dist/cjs/{getBorderRadius-CyYZw4qq.js → getBorderRadius-CJ_95w3o.js} +1 -1
  7. package/dist/cjs/{getMissingRequiredShippingFields-D03ICqss.js → getMissingRequiredShippingFields-DI6qF1z3.js} +1 -1
  8. package/dist/cjs/{hasInclusivePrice-CPCoVeU3.js → hasInclusivePrice-84KS94yH.js} +1 -1
  9. package/dist/cjs/index.cjs.js +19 -8
  10. package/dist/cjs/{invoice-Cj8W7NW0.js → invoice-5hVfSXpb.js} +3 -3
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{localization-BzNeXeDe.js → localization-B2mjW0Xa.js} +701 -41
  13. package/dist/cjs/{paypal-CuKshRmZ.js → paypal-pd8Nz_R_.js} +4 -4
  14. package/dist/cjs/{placeTestOrder-7czjwkjm.js → placeTestOrder-DrI8rD9o.js} +2 -2
  15. package/dist/cjs/{renderCheckoutCurrency-BH8t2b2x.js → renderCheckoutCurrency-u5q8YdUb.js} +2 -2
  16. package/dist/cjs/shouldRenderShortAddressCodeInput-gpu_bMfp.js +21 -0
  17. package/dist/cjs/{shouldShowLanguageSelect-yAbtCmd8.js → shouldShowLanguageSelect-gBg4KeTQ.js} +1 -1
  18. package/dist/cjs/{submitGtag-D79e8u6s.js → submitGtag-Rc-S3PnH.js} +1 -1
  19. package/dist/cjs/{throttle-zSVRQLC0.js → taxIdFields-BrIaPTcd.js} +57 -2
  20. package/dist/cjs/taxIdRules-BBj8kQxJ.js +58 -0
  21. package/dist/cjs/{updateCheckoutSessionAttributes-jMtfOL2m.js → updateCheckoutSessionAttributes-d0IKpwW8.js} +1 -1
  22. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +25 -30
  23. package/dist/cjs/zonos-address-display_2.cjs.entry.js +3 -3
  24. package/dist/cjs/zonos-address_4.cjs.entry.js +27 -30
  25. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +7 -6
  26. package/dist/cjs/zonos-badge.cjs.entry.js +1 -1
  27. package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/zonos-button_3.cjs.entry.js +2 -2
  29. package/dist/cjs/zonos-card_5.cjs.entry.js +8 -7
  30. package/dist/cjs/zonos-cart-items_12.cjs.entry.js +83 -78
  31. package/dist/cjs/zonos-checkbox_2.cjs.entry.js +2 -2
  32. package/dist/cjs/zonos-checkout.cjs.entry.js +11 -10
  33. package/dist/cjs/zonos-collapse.cjs.entry.js +1 -1
  34. package/dist/cjs/zonos-collect-cart-items_3.cjs.entry.js +6 -5
  35. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +12 -11
  36. package/dist/cjs/zonos-collect.cjs.entry.js +9 -8
  37. package/dist/cjs/zonos-controller.cjs.entry.js +7 -6
  38. package/dist/cjs/zonos-country-flag.cjs.entry.js +2 -2
  39. package/dist/cjs/zonos-country-select_4.cjs.entry.js +3 -3
  40. package/dist/cjs/zonos-elements.cjs.js +1 -1
  41. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +4 -4
  42. package/dist/cjs/zonos-hello.cjs.entry.js +4 -4
  43. package/dist/cjs/zonos-input.cjs.entry.js +2 -2
  44. package/dist/cjs/zonos-invoice-cart-items_2.cjs.entry.js +8 -7
  45. package/dist/cjs/zonos-invoice-finish_5.cjs.entry.js +12 -11
  46. package/dist/cjs/zonos-invoice.cjs.entry.js +9 -8
  47. package/dist/cjs/zonos-language-select_2.cjs.entry.js +2 -2
  48. package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
  49. package/dist/cjs/zonos-policy-consent_2.cjs.entry.js +7 -6
  50. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
  51. package/dist/cjs/zonos-stripe-input.cjs.entry.js +2 -2
  52. package/dist/cjs/zonos-text.cjs.entry.js +1 -1
  53. package/dist/cjs/zonos-v-stack.cjs.entry.js +1 -1
  54. package/dist/cjs/{zonosStore-Bx9jK82G.js → zonosStore-CDV83QyK.js} +2 -0
  55. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +12 -4
  56. package/dist/collection/components/store/checkout/stripe.js +10 -12
  57. package/dist/collection/components/store/translationStore/strings.arabic.js +35 -2
  58. package/dist/collection/components/store/translationStore/strings.base.js +35 -2
  59. package/dist/collection/components/store/translationStore/strings.chinese.js +35 -2
  60. package/dist/collection/components/store/translationStore/strings.danish.js +35 -2
  61. package/dist/collection/components/store/translationStore/strings.dutch.js +35 -2
  62. package/dist/collection/components/store/translationStore/strings.french.js +35 -2
  63. package/dist/collection/components/store/translationStore/strings.german.js +35 -2
  64. package/dist/collection/components/store/translationStore/strings.hebrew.js +35 -2
  65. package/dist/collection/components/store/translationStore/strings.indonesian.js +35 -2
  66. package/dist/collection/components/store/translationStore/strings.italian.js +35 -2
  67. package/dist/collection/components/store/translationStore/strings.japanese.js +35 -2
  68. package/dist/collection/components/store/translationStore/strings.korean.js +35 -2
  69. package/dist/collection/components/store/translationStore/strings.norwegian.js +35 -2
  70. package/dist/collection/components/store/translationStore/strings.polish.js +35 -2
  71. package/dist/collection/components/store/translationStore/strings.portuguese.js +35 -2
  72. package/dist/collection/components/store/translationStore/strings.russian.js +35 -2
  73. package/dist/collection/components/store/translationStore/strings.spanish.js +35 -2
  74. package/dist/collection/components/store/translationStore/strings.swedish.js +35 -2
  75. package/dist/collection/components/store/translationStore/strings.turkish.js +35 -2
  76. package/dist/collection/components/store/translationStore/strings.vietnamese.js +35 -2
  77. package/dist/collection/components/store/zonosStore.js +2 -1
  78. package/dist/collection/components/stripe/zonos-address/zonos-address.css +5 -0
  79. package/dist/collection/components/stripe/zonos-address/zonos-address.js +37 -22
  80. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.css +5 -0
  81. package/dist/collection/components/stripe/zonos-custom-address/zonos-custom-address.js +34 -21
  82. package/dist/collection/components/utils/api/prepCalculateLandedCost.js +24 -35
  83. package/dist/collection/components/utils/checkout/getCheckoutTaxIdPayload.js +16 -0
  84. package/dist/collection/components/utils/checkout/getTaxIdFieldState.js +26 -0
  85. package/dist/collection/components/utils/checkout/resolveTaxIdSelection.js +23 -0
  86. package/dist/collection/components/utils/checkout/shouldRenderTaxIdInput.js +7 -11
  87. package/dist/collection/components/utils/checkout/taxIdFields.js +29 -0
  88. package/dist/collection/components/utils/taxId/taxIdRules.js +44 -0
  89. package/dist/collection/components/utils/taxIdValidationResult.js +57 -58
  90. package/dist/collection/index.js +1 -0
  91. package/dist/collection/types/checkout/TaxId.js +31 -0
  92. package/dist/esm/{TaxId-Cye-evFK.js → TaxId-DMIgN_sT.js} +32 -1
  93. package/dist/esm/{cart-BoQp8Ema.js → cart-DmJkjiDE.js} +88 -53
  94. package/dist/esm/{collect-Eo4gtyql.js → collect-BV5GTPmh.js} +3 -3
  95. package/dist/esm/{debounce-BR3PaG8X.js → debounce-DHj2iHA1.js} +1 -1
  96. package/dist/esm/{debounce-CrmpwbEE.js → debounce-DWqMT4lo.js} +2 -2
  97. package/dist/esm/{getBorderRadius-DYfkeXdx.js → getBorderRadius-BiGd45jw.js} +1 -1
  98. package/dist/esm/{getMissingRequiredShippingFields-Ks6_tpjn.js → getMissingRequiredShippingFields-DljgpDZe.js} +1 -1
  99. package/dist/esm/{hasInclusivePrice-CbEfIhI5.js → hasInclusivePrice-DhGXpH2D.js} +1 -1
  100. package/dist/esm/index.js +9 -8
  101. package/dist/esm/{invoice-S1KahJ_Z.js → invoice-CO-iqlni.js} +3 -3
  102. package/dist/esm/loader.js +1 -1
  103. package/dist/esm/{localization-BIh-4pc_.js → localization-DHM91diu.js} +701 -41
  104. package/dist/esm/{paypal-DNfvnuUU.js → paypal-BfW5aLJw.js} +4 -4
  105. package/dist/esm/{placeTestOrder-CQaMKFOg.js → placeTestOrder-CyWUFhxD.js} +2 -2
  106. package/dist/esm/{renderCheckoutCurrency-C2Tw73uR.js → renderCheckoutCurrency-B31ZNkUv.js} +2 -2
  107. package/dist/esm/shouldRenderShortAddressCodeInput-Bc8k2vN0.js +19 -0
  108. package/dist/esm/{shouldShowLanguageSelect-CCD7gpSY.js → shouldShowLanguageSelect-DwSfSHar.js} +1 -1
  109. package/dist/esm/{submitGtag-df9AQ2zL.js → submitGtag-BEFrutel.js} +1 -1
  110. package/dist/esm/taxIdFields-ByEYfsO5.js +139 -0
  111. package/dist/esm/taxIdRules-xYlx7ZXW.js +47 -0
  112. package/dist/esm/{updateCheckoutSessionAttributes-4Jq6V4pO.js → updateCheckoutSessionAttributes-B0bQH0uw.js} +1 -1
  113. package/dist/esm/zonos-address-completion-dialog_7.entry.js +23 -28
  114. package/dist/esm/zonos-address-display_2.entry.js +3 -3
  115. package/dist/esm/zonos-address_4.entry.js +25 -28
  116. package/dist/esm/zonos-airwallex-payment.entry.js +7 -6
  117. package/dist/esm/zonos-badge.entry.js +1 -1
  118. package/dist/esm/zonos-banner.entry.js +1 -1
  119. package/dist/esm/zonos-button_3.entry.js +2 -2
  120. package/dist/esm/zonos-card_5.entry.js +8 -7
  121. package/dist/esm/zonos-cart-items_12.entry.js +82 -77
  122. package/dist/esm/zonos-checkbox_2.entry.js +2 -2
  123. package/dist/esm/zonos-checkout.entry.js +11 -10
  124. package/dist/esm/zonos-collapse.entry.js +1 -1
  125. package/dist/esm/zonos-collect-cart-items_3.entry.js +6 -5
  126. package/dist/esm/zonos-collect-finish_6.entry.js +12 -11
  127. package/dist/esm/zonos-collect.entry.js +9 -8
  128. package/dist/esm/zonos-controller.entry.js +7 -6
  129. package/dist/esm/zonos-country-flag.entry.js +2 -2
  130. package/dist/esm/zonos-country-select_4.entry.js +3 -3
  131. package/dist/esm/zonos-elements.js +1 -1
  132. package/dist/esm/zonos-hello-dialog.entry.js +4 -4
  133. package/dist/esm/zonos-hello.entry.js +4 -4
  134. package/dist/esm/zonos-input.entry.js +2 -2
  135. package/dist/esm/zonos-invoice-cart-items_2.entry.js +8 -7
  136. package/dist/esm/zonos-invoice-finish_5.entry.js +12 -11
  137. package/dist/esm/zonos-invoice.entry.js +9 -8
  138. package/dist/esm/zonos-language-select_2.entry.js +2 -2
  139. package/dist/esm/zonos-logo.entry.js +1 -1
  140. package/dist/esm/zonos-policy-consent_2.entry.js +7 -6
  141. package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
  142. package/dist/esm/zonos-stripe-input.entry.js +2 -2
  143. package/dist/esm/zonos-text.entry.js +1 -1
  144. package/dist/esm/zonos-v-stack.entry.js +1 -1
  145. package/dist/esm/{zonosStore-msUlqmSD.js → zonosStore-BXP9FvIt.js} +2 -1
  146. package/dist/esm-es5/{TaxId-Cye-evFK.js → TaxId-DMIgN_sT.js} +2 -1
  147. package/dist/esm-es5/{cart-BoQp8Ema.js → cart-DmJkjiDE.js} +64 -53
  148. package/dist/esm-es5/{collect-Eo4gtyql.js → collect-BV5GTPmh.js} +1 -1
  149. package/dist/esm-es5/{debounce-BR3PaG8X.js → debounce-DHj2iHA1.js} +7 -7
  150. package/dist/esm-es5/debounce-DWqMT4lo.js +1 -0
  151. package/dist/esm-es5/getBorderRadius-BiGd45jw.js +8 -0
  152. package/dist/esm-es5/{getMissingRequiredShippingFields-Ks6_tpjn.js → getMissingRequiredShippingFields-DljgpDZe.js} +3 -3
  153. package/dist/esm-es5/{hasInclusivePrice-CbEfIhI5.js → hasInclusivePrice-DhGXpH2D.js} +1 -1
  154. package/dist/esm-es5/index.js +11 -11
  155. package/dist/esm-es5/{invoice-S1KahJ_Z.js → invoice-CO-iqlni.js} +1 -1
  156. package/dist/esm-es5/loader.js +1 -1
  157. package/dist/esm-es5/localization-DHM91diu.js +348 -0
  158. package/dist/esm-es5/{paypal-DNfvnuUU.js → paypal-BfW5aLJw.js} +1 -1
  159. package/dist/esm-es5/{placeTestOrder-CQaMKFOg.js → placeTestOrder-CyWUFhxD.js} +1 -1
  160. package/dist/esm-es5/{renderCheckoutCurrency-C2Tw73uR.js → renderCheckoutCurrency-B31ZNkUv.js} +2 -2
  161. package/dist/esm-es5/shouldRenderShortAddressCodeInput-Bc8k2vN0.js +8 -0
  162. package/dist/esm-es5/{shouldShowLanguageSelect-CCD7gpSY.js → shouldShowLanguageSelect-DwSfSHar.js} +1 -1
  163. package/dist/esm-es5/{submitGtag-df9AQ2zL.js → submitGtag-BEFrutel.js} +1 -1
  164. package/dist/esm-es5/taxIdFields-ByEYfsO5.js +46 -0
  165. package/dist/esm-es5/taxIdRules-xYlx7ZXW.js +6 -0
  166. package/dist/esm-es5/{updateCheckoutSessionAttributes-4Jq6V4pO.js → updateCheckoutSessionAttributes-B0bQH0uw.js} +1 -1
  167. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +253 -254
  168. package/dist/esm-es5/zonos-address-display_2.entry.js +1 -1
  169. package/dist/esm-es5/zonos-address_4.entry.js +8 -9
  170. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  171. package/dist/esm-es5/zonos-badge.entry.js +1 -1
  172. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  173. package/dist/esm-es5/zonos-button_3.entry.js +1 -1
  174. package/dist/esm-es5/zonos-card_5.entry.js +1 -1
  175. package/dist/esm-es5/zonos-cart-items_12.entry.js +19 -18
  176. package/dist/esm-es5/zonos-checkbox_2.entry.js +1 -1
  177. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  178. package/dist/esm-es5/zonos-collapse.entry.js +1 -1
  179. package/dist/esm-es5/zonos-collect-cart-items_3.entry.js +1 -1
  180. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  181. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  182. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  183. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  184. package/dist/esm-es5/zonos-country-select_4.entry.js +2 -2
  185. package/dist/esm-es5/zonos-elements.js +1 -1
  186. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  187. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  188. package/dist/esm-es5/zonos-input.entry.js +1 -1
  189. package/dist/esm-es5/zonos-invoice-cart-items_2.entry.js +2 -2
  190. package/dist/esm-es5/zonos-invoice-finish_5.entry.js +1 -1
  191. package/dist/esm-es5/zonos-invoice.entry.js +1 -1
  192. package/dist/esm-es5/zonos-language-select_2.entry.js +1 -1
  193. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  194. package/dist/esm-es5/zonos-policy-consent_2.entry.js +1 -1
  195. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  196. package/dist/esm-es5/zonos-stripe-input.entry.js +1 -1
  197. package/dist/esm-es5/zonos-text.entry.js +1 -1
  198. package/dist/esm-es5/zonos-v-stack.entry.js +1 -1
  199. package/dist/esm-es5/{zonosStore-msUlqmSD.js → zonosStore-BXP9FvIt.js} +1 -1
  200. package/dist/scripts/index.d.ts +97 -1
  201. package/dist/scripts/index.js +1 -1
  202. package/dist/scripts/loadZonos.js +1 -1
  203. package/dist/scripts/zonos.js +1 -1
  204. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +4 -0
  205. package/dist/types/components/store/checkout/stripe.d.ts +9 -0
  206. package/dist/types/components/store/translationStore/strings.arabic.d.ts +34 -1
  207. package/dist/types/components/store/translationStore/strings.base.d.ts +34 -1
  208. package/dist/types/components/store/translationStore/strings.chinese.d.ts +34 -1
  209. package/dist/types/components/store/translationStore/strings.danish.d.ts +34 -1
  210. package/dist/types/components/store/translationStore/strings.dutch.d.ts +34 -1
  211. package/dist/types/components/store/translationStore/strings.french.d.ts +34 -1
  212. package/dist/types/components/store/translationStore/strings.german.d.ts +34 -1
  213. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +34 -1
  214. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +34 -1
  215. package/dist/types/components/store/translationStore/strings.italian.d.ts +34 -1
  216. package/dist/types/components/store/translationStore/strings.japanese.d.ts +34 -1
  217. package/dist/types/components/store/translationStore/strings.korean.d.ts +34 -1
  218. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +34 -1
  219. package/dist/types/components/store/translationStore/strings.polish.d.ts +34 -1
  220. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +34 -1
  221. package/dist/types/components/store/translationStore/strings.russian.d.ts +34 -1
  222. package/dist/types/components/store/translationStore/strings.spanish.d.ts +34 -1
  223. package/dist/types/components/store/translationStore/strings.swedish.d.ts +34 -1
  224. package/dist/types/components/store/translationStore/strings.turkish.d.ts +34 -1
  225. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +34 -1
  226. package/dist/types/components/store/zonosStore.d.ts +2 -1
  227. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +4 -1
  228. package/dist/types/components/stripe/zonos-custom-address/zonos-custom-address.d.ts +4 -1
  229. package/dist/types/components/utils/checkout/getCheckoutTaxIdPayload.d.ts +6 -0
  230. package/dist/types/components/utils/checkout/getTaxIdFieldState.d.ts +18 -0
  231. package/dist/types/components/utils/checkout/resolveTaxIdSelection.d.ts +12 -0
  232. package/dist/types/components/utils/checkout/shouldRenderTaxIdInput.d.ts +2 -1
  233. package/dist/types/components/utils/checkout/taxIdFields.d.ts +11 -0
  234. package/dist/types/components/utils/taxId/taxIdRules.d.ts +37 -0
  235. package/dist/types/components/utils/taxIdValidationResult.d.ts +8 -2
  236. package/dist/types/components.d.ts +22 -0
  237. package/dist/types/index.d.ts +1 -0
  238. package/dist/types/types/checkout/TaxId.d.ts +45 -0
  239. package/dist/types/types/checkout/api/CalculateLandedCost.d.ts +11 -0
  240. package/dist/types/types/checkout/api/CreateParty.d.ts +2 -0
  241. package/dist/types/types/utils/ZonosSettings.d.ts +5 -0
  242. package/dist/zonos-elements/index.esm.js +1 -1
  243. package/dist/zonos-elements/{p-7bd99479.system.entry.js → p-064d8829.system.entry.js} +26 -26
  244. package/dist/zonos-elements/p-107f287b.entry.js +1 -0
  245. package/dist/zonos-elements/{p-51400242.system.entry.js → p-1199baef.system.entry.js} +3 -3
  246. package/dist/zonos-elements/p-12b24ebb.entry.js +1 -0
  247. package/dist/zonos-elements/{p-9c33f7ed.system.entry.js → p-189cc594.system.entry.js} +1 -1
  248. package/dist/zonos-elements/{p-d3d0656a.entry.js → p-1a5acbcd.entry.js} +1 -1
  249. package/dist/zonos-elements/{p-11defdca.system.entry.js → p-1cc42a98.system.entry.js} +18 -18
  250. package/dist/zonos-elements/p-1e6db427.entry.js +1 -0
  251. package/dist/zonos-elements/{p-d82fd8a9.system.entry.js → p-1fda4aec.system.entry.js} +116 -115
  252. package/dist/zonos-elements/{p-756d303f.system.entry.js → p-20eb00de.system.entry.js} +1 -1
  253. package/dist/zonos-elements/{p-5967a1c1.system.entry.js → p-216a908d.system.entry.js} +5 -5
  254. package/dist/zonos-elements/p-25eb99d4.entry.js +1 -0
  255. package/dist/zonos-elements/{p-23352709.system.entry.js → p-2b63865a.system.entry.js} +4 -4
  256. package/dist/zonos-elements/{p-6db7c0b1.system.entry.js → p-2ca826b9.system.entry.js} +2 -2
  257. package/dist/zonos-elements/{p-6c41b00c.entry.js → p-2d513aa3.entry.js} +1 -1
  258. package/dist/zonos-elements/{p-c961caaf.entry.js → p-3e705c9b.entry.js} +1 -1
  259. package/dist/zonos-elements/{p-acd50b0b.entry.js → p-4612facd.entry.js} +1 -1
  260. package/dist/zonos-elements/{p-5b80aff2.system.entry.js → p-46a839d2.system.entry.js} +24 -24
  261. package/dist/zonos-elements/p-46b9f0cf.entry.js +1 -0
  262. package/dist/zonos-elements/{p-244e0302.system.entry.js → p-4715045c.system.entry.js} +1 -1
  263. package/dist/zonos-elements/{p-d168023b.entry.js → p-4917b74d.entry.js} +1 -1
  264. package/dist/zonos-elements/{p-0b81f8b9.system.entry.js → p-53eac12f.system.entry.js} +14 -14
  265. package/dist/zonos-elements/{p-17c7ea4a.system.entry.js → p-55813e9f.system.entry.js} +3 -3
  266. package/dist/zonos-elements/{p-06030d3b.system.entry.js → p-5585db86.system.entry.js} +45 -45
  267. package/dist/zonos-elements/p-59fc32af.entry.js +1 -0
  268. package/dist/zonos-elements/{p-193d9722.entry.js → p-61312d5b.entry.js} +1 -1
  269. package/dist/zonos-elements/p-636b71d4.entry.js +1 -0
  270. package/dist/zonos-elements/{p-155ed3d3.system.entry.js → p-6410fa11.system.entry.js} +24 -24
  271. package/dist/zonos-elements/{p-0fca452b.entry.js → p-65817880.entry.js} +1 -1
  272. package/dist/zonos-elements/p-678b9214.entry.js +1 -0
  273. package/dist/zonos-elements/p-6e691736.entry.js +1 -0
  274. package/dist/zonos-elements/p-6vSUiBfr.system.js +348 -0
  275. package/dist/zonos-elements/p-74659d88.entry.js +1 -0
  276. package/dist/zonos-elements/p-7dc7f328.entry.js +1 -0
  277. package/dist/zonos-elements/{p-55916c90.entry.js → p-7f1bea9b.entry.js} +1 -1
  278. package/dist/zonos-elements/{p-1c150f26.entry.js → p-821e413a.entry.js} +1 -1
  279. package/dist/zonos-elements/{p-c403f004.system.entry.js → p-82e45d0c.system.entry.js} +1 -1
  280. package/dist/zonos-elements/p-84e76348.entry.js +1 -0
  281. package/dist/zonos-elements/{p-1409de3b.system.entry.js → p-88e20e99.system.entry.js} +1 -1
  282. package/dist/zonos-elements/{p-195f6e38.system.entry.js → p-89a3c4db.system.entry.js} +1 -1
  283. package/dist/zonos-elements/{p-4679f0ec.entry.js → p-8f9d8795.entry.js} +1 -1
  284. package/dist/zonos-elements/p-8fa6cfff.entry.js +1 -0
  285. package/dist/zonos-elements/{p-92fe9a1f.system.entry.js → p-902cca23.system.entry.js} +1 -1
  286. package/dist/zonos-elements/{p-0a4a7742.system.entry.js → p-93860183.system.entry.js} +1 -1
  287. package/dist/zonos-elements/{p-69c3e367.system.entry.js → p-941a95a1.system.entry.js} +10 -10
  288. package/dist/zonos-elements/{p-b5882fbb.system.entry.js → p-9449b4f4.system.entry.js} +1 -1
  289. package/dist/zonos-elements/{p-6abec43f.system.entry.js → p-960070d0.system.entry.js} +3 -3
  290. package/dist/zonos-elements/{p-1bac5ac1.system.entry.js → p-990fcf81.system.entry.js} +1 -1
  291. package/dist/zonos-elements/p-BD-9rD53.js +1 -0
  292. package/dist/zonos-elements/p-BMPYH-LT.js +1 -0
  293. package/dist/zonos-elements/{p-DI2vXnXc.system.js → p-BrQ8n8NS.system.js} +3 -3
  294. package/dist/zonos-elements/p-Bu9WCfUC.system.js +2 -2
  295. package/dist/zonos-elements/{p-CUaf1cEg.js → p-C70h5mKA.js} +1 -1
  296. package/dist/zonos-elements/{p-B4Ufchqh.system.js → p-C9XLkmmb.system.js} +3 -3
  297. package/dist/zonos-elements/{p-CZD8WvyY.system.js → p-CBUz18kA.system.js} +1 -1
  298. package/dist/zonos-elements/{p-kaOxUR9u.system.js → p-CGNVm52g.system.js} +6 -6
  299. package/dist/zonos-elements/p-CHKKvuiz.js +1 -0
  300. package/dist/zonos-elements/{p-0mGRBGcf.js → p-CMo3ZweU.js} +1 -1
  301. package/dist/zonos-elements/p-CTiqplrr.js +1 -0
  302. package/dist/zonos-elements/p-CYxMfUL7.system.js +1 -0
  303. package/dist/zonos-elements/{p-D4MevhAL.system.js → p-CbhN65lj.system.js} +3 -3
  304. package/dist/zonos-elements/p-Ch1w0Lr7.js +1 -0
  305. package/dist/zonos-elements/{p-W82paT5F.js → p-CqB9AfBf.js} +1 -1
  306. package/dist/zonos-elements/p-CzKlS3E-.system.js +6 -0
  307. package/dist/zonos-elements/p-D1SmY_fZ.js +1 -0
  308. package/dist/zonos-elements/{p-sz4L-ZnB.js → p-D1e9zNDA.js} +1 -1
  309. package/dist/zonos-elements/{p-c9QtIdJX.js → p-D6xXnsM_.js} +1 -1
  310. package/dist/zonos-elements/{p-8PPEbm_0.system.js → p-DIab60nK.system.js} +12 -12
  311. package/dist/zonos-elements/{p-Cye-evFK.js → p-DMIgN_sT.js} +1 -1
  312. package/dist/zonos-elements/{p-CXxvn4GX.system.js → p-DQrMfUzi.system.js} +41 -41
  313. package/dist/zonos-elements/{p-BuU_p5DP.system.js → p-DTgUqgwV.system.js} +2 -2
  314. package/dist/zonos-elements/p-DW7I0zOF.js +1 -0
  315. package/dist/zonos-elements/p-DZdkJHK9.system.js +7 -0
  316. package/dist/zonos-elements/{p-XqkqjeNV.system.js → p-DgUrB-1a.system.js} +1 -1
  317. package/dist/zonos-elements/p-DiMEP3mh.js +1 -0
  318. package/dist/zonos-elements/p-DprOoI2W.system.js +528 -0
  319. package/dist/zonos-elements/{p-7abqRc9V.js → p-DpwmHU8R.js} +2 -2
  320. package/dist/zonos-elements/p-DqVePqqx.system.js +8 -0
  321. package/dist/zonos-elements/{p-Cby4EkFu.system.js → p-DsBuZ6ob.system.js} +2 -1
  322. package/dist/zonos-elements/{p-XDxdMlQl.system.js → p-Dtu_Japy.system.js} +39 -39
  323. package/dist/zonos-elements/p-Dwg61Ft_.js +1 -0
  324. package/dist/zonos-elements/p-U33isUJG.js +1 -0
  325. package/dist/zonos-elements/{p-Be3Hpms1.system.js → p-XoQH3S7Z.system.js} +1 -1
  326. package/dist/zonos-elements/{p-474e8a92.system.entry.js → p-a1022808.system.entry.js} +1 -1
  327. package/dist/zonos-elements/{p-83aa1c8c.entry.js → p-ad04bba2.entry.js} +1 -1
  328. package/dist/zonos-elements/{p-a938c174.entry.js → p-b51010b9.entry.js} +1 -1
  329. package/dist/zonos-elements/{p-dfc87b10.system.entry.js → p-c33b8f6a.system.entry.js} +1 -1
  330. package/dist/zonos-elements/{p-a40fd99b.system.entry.js → p-cccaad60.system.entry.js} +39 -40
  331. package/dist/zonos-elements/p-d3345b2c.entry.js +1 -0
  332. package/dist/zonos-elements/{p-249c1ee1.system.entry.js → p-d8f375da.system.entry.js} +3 -3
  333. package/dist/zonos-elements/{p-2603dce0.entry.js → p-e216cc8c.entry.js} +1 -1
  334. package/dist/zonos-elements/{p-b79036fc.entry.js → p-e7fdb2c9.entry.js} +1 -1
  335. package/dist/zonos-elements/p-ebe157b5.entry.js +1 -0
  336. package/dist/zonos-elements/p-ef5344ea.entry.js +1 -0
  337. package/dist/zonos-elements/{p-7f031592.system.entry.js → p-f3d9a380.system.entry.js} +73 -73
  338. package/dist/zonos-elements/{p-31043c2e.system.entry.js → p-f5f95990.system.entry.js} +296 -297
  339. package/dist/zonos-elements/p-fda89981.system.entry.js +13 -0
  340. package/dist/zonos-elements/{p-d4d2b39e.entry.js → p-fddf3556.entry.js} +1 -1
  341. package/dist/zonos-elements/p-iAIzUA4k.js +1 -0
  342. package/dist/zonos-elements/{p-BpDCLBwW.js → p-n5PZKz1k.js} +1 -1
  343. package/dist/zonos-elements/{p-DoEHepOc.system.js → p-ojtNq-r5.system.js} +1 -1
  344. package/dist/zonos-elements/{p-C_z9WL8a.js → p-r-YGHhLa.js} +1 -1
  345. package/dist/zonos-elements/{p-CBx5nYet.system.js → p-vTIygnHq.system.js} +1 -1
  346. package/dist/zonos-elements/{p-DQZncB2d.system.js → p-zsTASoh2.system.js} +3 -3
  347. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  348. package/package.json +1 -1
  349. package/dist/cjs/shouldRenderTaxIdInput-TxekHCp7.js +0 -43
  350. package/dist/esm/shouldRenderTaxIdInput-CKyZ6Zni.js +0 -40
  351. package/dist/esm/throttle-Cvlvb-dm.js +0 -85
  352. package/dist/esm-es5/debounce-CrmpwbEE.js +0 -1
  353. package/dist/esm-es5/getBorderRadius-DYfkeXdx.js +0 -8
  354. package/dist/esm-es5/localization-BIh-4pc_.js +0 -348
  355. package/dist/esm-es5/shouldRenderTaxIdInput-CKyZ6Zni.js +0 -17
  356. package/dist/esm-es5/throttle-Cvlvb-dm.js +0 -46
  357. package/dist/zonos-elements/p-06fe2939.entry.js +0 -1
  358. package/dist/zonos-elements/p-24f3c547.entry.js +0 -1
  359. package/dist/zonos-elements/p-30b3c9d3.entry.js +0 -1
  360. package/dist/zonos-elements/p-39ee1558.entry.js +0 -1
  361. package/dist/zonos-elements/p-3a2da031.entry.js +0 -1
  362. package/dist/zonos-elements/p-4806b264.system.entry.js +0 -13
  363. package/dist/zonos-elements/p-5873ab8e.entry.js +0 -1
  364. package/dist/zonos-elements/p-725e29bb.entry.js +0 -1
  365. package/dist/zonos-elements/p-BGktDPwA.system.js +0 -1
  366. package/dist/zonos-elements/p-Bi-s0fp_.system.js +0 -17
  367. package/dist/zonos-elements/p-CEK_Wk6v.system.js +0 -7
  368. package/dist/zonos-elements/p-CFbfEmjN.js +0 -1
  369. package/dist/zonos-elements/p-CcJF6xhQ.js +0 -1
  370. package/dist/zonos-elements/p-Cxuiqv1I.js +0 -1
  371. package/dist/zonos-elements/p-D-bZg-Pc.js +0 -1
  372. package/dist/zonos-elements/p-DOD2I44l.system.js +0 -348
  373. package/dist/zonos-elements/p-DS-qw_qc.system.js +0 -517
  374. package/dist/zonos-elements/p-DZ2mevDK.js +0 -1
  375. package/dist/zonos-elements/p-DnjGkbEy.js +0 -1
  376. package/dist/zonos-elements/p-FRWZayxL.js +0 -1
  377. package/dist/zonos-elements/p-Mrz_lnC1.js +0 -1
  378. package/dist/zonos-elements/p-ad9ff14c.entry.js +0 -1
  379. package/dist/zonos-elements/p-bb3546c0.entry.js +0 -1
  380. package/dist/zonos-elements/p-c1cbfdba.entry.js +0 -1
  381. package/dist/zonos-elements/p-c47ce656.entry.js +0 -1
  382. package/dist/zonos-elements/p-c9d5d8f1.entry.js +0 -1
  383. package/dist/zonos-elements/p-clDfq9AL.js +0 -1
  384. package/dist/zonos-elements/p-d74bc3e8.entry.js +0 -1
  385. package/dist/zonos-elements/p-d8b312e5.entry.js +0 -1
  386. package/dist/zonos-elements/p-db87b0dd.entry.js +0 -1
  387. package/dist/zonos-elements/p-defc2d18.entry.js +0 -1
  388. package/dist/zonos-elements/p-rVp8hgWw.js +0 -1
@@ -2,9 +2,19 @@ import { cartStore } from "../../store/checkout/cart";
2
2
  import { stripeStore } from "../../store/checkout/stripe";
3
3
  import { localizationStore } from "../../store/hello/localization";
4
4
  import { storageStore } from "../../store/storageStore";
5
+ import { getCheckoutTaxIdPayload } from "../checkout/getCheckoutTaxIdPayload";
5
6
  import { extractName } from "../extractName";
6
7
  import { getOverridenZCountry } from "../getOverridenZCountry";
7
8
  import { log } from "../logging/log";
9
+ const shipToTaxIdFields = (countryCode) => {
10
+ const taxIdPayload = getCheckoutTaxIdPayload(countryCode);
11
+ if (!taxIdPayload) {
12
+ return {};
13
+ }
14
+ return Object.assign({ shipToTaxId: taxIdPayload.taxId }, (taxIdPayload.taxIdType
15
+ ? { shipToTaxIdType: taxIdPayload.taxIdType }
16
+ : {}));
17
+ };
8
18
  /**
9
19
  * Extract value from translated object
10
20
  */
@@ -55,16 +65,15 @@ export const prepCartCalculateLandedCost = (cartId) => {
55
65
  name: translatedBillingAddress.name,
56
66
  });
57
67
  const checkoutSessionCountry = getOverridenZCountry() || 'US';
58
- return {
59
- billingAddress: {
68
+ const shipToTaxId = shipToTaxIdFields(translatedShippingAddress.country);
69
+ return Object.assign(Object.assign({ billingAddress: {
60
70
  addressLine1: translatedBillingAddress.line1,
61
71
  addressLine2: translatedBillingAddress.line2 || '',
62
72
  city: translatedBillingAddress.city,
63
73
  country: translatedBillingAddress.country,
64
74
  postalCode: translatedBillingAddress.postal_code,
65
75
  state: translatedBillingAddress.state,
66
- },
67
- billingContact: {
76
+ }, billingContact: {
68
77
  // firstName and lastName should be valid now since stripe only mark
69
78
  // the address as complete when both fields are filled.
70
79
  firstName: billingFirstName,
@@ -72,13 +81,9 @@ export const prepCartCalculateLandedCost = (cartId) => {
72
81
  phone: translatedBillingAddress.phone,
73
82
  },
74
83
  // Use the first item's currency code
75
- cartCurrencyCode: (_a = cartStore.items[0]) === null || _a === void 0 ? void 0 : _a.currencyCode,
76
- cartId,
77
- checkoutSessionCountry: checkoutSessionCountry ||
84
+ cartCurrencyCode: (_a = cartStore.items[0]) === null || _a === void 0 ? void 0 : _a.currencyCode, cartId, checkoutSessionCountry: checkoutSessionCountry ||
78
85
  localizationStore.selectedCountryCode ||
79
- undefined,
80
- checkoutSessionId: storageStore.checkoutSessionId || '',
81
- contact: {
86
+ undefined, checkoutSessionId: storageStore.checkoutSessionId || '', contact: {
82
87
  companyName: stripeStore.companyName,
83
88
  email: stripeLinkData === null || stripeLinkData === void 0 ? void 0 : stripeLinkData.value.email,
84
89
  // firstName and lastName should be valid now since stripe only mark
@@ -86,9 +91,7 @@ export const prepCartCalculateLandedCost = (cartId) => {
86
91
  firstName: shippingFirstName,
87
92
  lastName: shippingLastName,
88
93
  phone: translatedShippingAddress.phone,
89
- },
90
- isTest: !!isE2ETest,
91
- landedCostAdjustments: cartStore.promoCode
94
+ }, isTest: !!isE2ETest, landedCostAdjustments: cartStore.promoCode
92
95
  ? [
93
96
  {
94
97
  amount: 0,
@@ -98,18 +101,14 @@ export const prepCartCalculateLandedCost = (cartId) => {
98
101
  type: 'PROMO_CODE',
99
102
  },
100
103
  ]
101
- : [],
102
- shipToShortAddressCode: stripeStore.shortAddressCode,
103
- shipToTaxId: stripeStore.taxId,
104
- shippingAddress: {
104
+ : [], shipToShortAddressCode: stripeStore.shortAddressCode }, shipToTaxId), { shippingAddress: {
105
105
  addressLine1: translatedShippingAddress.line1,
106
106
  addressLine2: translatedShippingAddress.line2,
107
107
  city: translatedShippingAddress.city,
108
108
  country: translatedShippingAddress.country,
109
109
  postalCode: translatedShippingAddress.postal_code,
110
110
  state: translatedShippingAddress.state,
111
- },
112
- };
111
+ } });
113
112
  };
114
113
  export const prepCalculateLandedCost = () => {
115
114
  const isE2ETest = new URLSearchParams(window.location.search).get('zonosE2ETest') === '1';
@@ -157,24 +156,21 @@ export const prepCalculateLandedCost = () => {
157
156
  ...convertedCartAdjuments,
158
157
  ]
159
158
  : convertedCartAdjuments;
160
- return {
161
- billingAddress: {
159
+ const shipToTaxId = shipToTaxIdFields(translatedShippingAddress.country);
160
+ return Object.assign(Object.assign({ billingAddress: {
162
161
  addressLine1: translatedBillingAddress.line1,
163
162
  addressLine2: translatedBillingAddress.line2 || '',
164
163
  city: translatedBillingAddress.city,
165
164
  country: translatedBillingAddress.country,
166
165
  postalCode: translatedBillingAddress.postal_code,
167
166
  state: translatedBillingAddress.state,
168
- },
169
- billingContact: {
167
+ }, billingContact: {
170
168
  // firstName and lastName should be valid now since stripe only mark
171
169
  // the address as complete when both fields are filled.
172
170
  firstName: billingFirstName,
173
171
  lastName: billingLastName,
174
172
  phone: translatedBillingAddress.phone,
175
- },
176
- checkoutSessionId: storageStore.checkoutSessionId || '',
177
- contact: {
173
+ }, checkoutSessionId: storageStore.checkoutSessionId || '', contact: {
178
174
  companyName: stripeStore.companyName,
179
175
  email: stripeLinkData === null || stripeLinkData === void 0 ? void 0 : stripeLinkData.value.email,
180
176
  // firstName and lastName should be valid now since stripe only mark
@@ -182,19 +178,12 @@ export const prepCalculateLandedCost = () => {
182
178
  firstName: shippingFirstName,
183
179
  lastName: shippingLastName,
184
180
  phone: translatedShippingAddress.phone,
185
- },
186
- isTest: isE2ETest,
187
- items: cartStore.items,
188
- landedCostAdjustments: adjustments,
189
- shipToShortAddressCode: stripeStore.shortAddressCode,
190
- shipToTaxId: stripeStore.taxId,
191
- shippingAddress: {
181
+ }, isTest: isE2ETest, items: cartStore.items, landedCostAdjustments: adjustments, shipToShortAddressCode: stripeStore.shortAddressCode }, shipToTaxId), { shippingAddress: {
192
182
  addressLine1: translatedShippingAddress.line1,
193
183
  addressLine2: translatedShippingAddress.line2,
194
184
  city: translatedShippingAddress.city,
195
185
  country: translatedShippingAddress.country,
196
186
  postalCode: translatedShippingAddress.postal_code,
197
187
  state: translatedShippingAddress.state,
198
- },
199
- };
188
+ } });
200
189
  };
@@ -0,0 +1,16 @@
1
+ import { stripeStore } from "../../store/checkout/stripe";
2
+ import { getShouldRequirePeruTaxId } from "../../store/zonosStore";
3
+ import { resolveTaxIdSelection } from "./resolveTaxIdSelection";
4
+ /** Tax id to send for the destination, or null while the field is hidden. */
5
+ export const getCheckoutTaxIdPayload = (countryCode) => {
6
+ const { selectedType, send } = resolveTaxIdSelection({
7
+ companyName: stripeStore.companyName,
8
+ countryCode,
9
+ shouldRequirePeruTaxId: getShouldRequirePeruTaxId(),
10
+ taxIdType: stripeStore.taxIdType,
11
+ });
12
+ if (!send) {
13
+ return null;
14
+ }
15
+ return Object.assign({ taxId: stripeStore.taxId }, (selectedType ? { taxIdType: selectedType.value } : {}));
16
+ };
@@ -0,0 +1,26 @@
1
+ import { resolveTaxIdSelection } from "./resolveTaxIdSelection";
2
+ import { taxIdLabelForCheckout } from "../taxId/taxIdRules";
3
+ export const getTaxIdFieldState = ({ companyName, countryCode, errorField, errorMessage, shouldRequirePeruTaxId, taxIdType, }) => {
4
+ var _a, _b;
5
+ const { rendered, selectedType, send, typeOptions } = resolveTaxIdSelection({
6
+ companyName,
7
+ countryCode,
8
+ shouldRequirePeruTaxId,
9
+ taxIdType,
10
+ });
11
+ if (!rendered) {
12
+ return null;
13
+ }
14
+ const singleTypeLabel = typeOptions
15
+ ? null
16
+ : taxIdLabelForCheckout(countryCode);
17
+ return {
18
+ inputLabel: (_a = selectedType === null || selectedType === void 0 ? void 0 : selectedType.label) !== null && _a !== void 0 ? _a : singleTypeLabel === null || singleTypeLabel === void 0 ? void 0 : singleTypeLabel.friendlyName,
19
+ inputPlaceholder: (_b = selectedType === null || selectedType === void 0 ? void 0 : selectedType.placeholder) !== null && _b !== void 0 ? _b : singleTypeLabel === null || singleTypeLabel === void 0 ? void 0 : singleTypeLabel.placeholder,
20
+ selectedValue: (selectedType === null || selectedType === void 0 ? void 0 : selectedType.value) || '',
21
+ showValueInput: send,
22
+ typeError: errorField === 'type' ? errorMessage : '',
23
+ typeOptions,
24
+ valueError: errorField === 'value' ? errorMessage : '',
25
+ };
26
+ };
@@ -0,0 +1,23 @@
1
+ import { shouldRenderTaxIdInput } from "./shouldRenderTaxIdInput";
2
+ import { taxIdTypeOptionsForCheckout } from "../taxId/taxIdRules";
3
+ /** Whether the field is showing, and which of this country's types is selected. */
4
+ export const resolveTaxIdSelection = ({ companyName, countryCode, shouldRequirePeruTaxId, taxIdType, }) => {
5
+ var _a;
6
+ const typeOptions = taxIdTypeOptionsForCheckout({
7
+ countryCode,
8
+ shouldRequirePeruTaxId,
9
+ });
10
+ const selectedType = (_a = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.find(option => option.value === taxIdType)) !== null && _a !== void 0 ? _a : null;
11
+ const rendered = shouldRenderTaxIdInput({
12
+ companyName,
13
+ countryCode,
14
+ shouldRequirePeruTaxId,
15
+ });
16
+ return {
17
+ rendered,
18
+ selectedType,
19
+ // A multi-type country sends a number only after the shopper picks a type.
20
+ send: rendered && (!typeOptions || !!selectedType),
21
+ typeOptions,
22
+ };
23
+ };
@@ -1,20 +1,16 @@
1
- import { countryRequireTaxId, euCountryCodes, } from "../../../types/checkout/TaxId";
2
- const isInTaxIdCountry = (countryCode) => {
3
- return countryRequireTaxId.includes(countryCode);
4
- };
1
+ import { isPeruTaxIdActive } from "../taxId/taxIdRules";
2
+ import { euCountryCodes, isCountryRequireTaxId, } from "../../../types/checkout/TaxId";
5
3
  /**
6
4
  * Checks if the tax ID input should be rendered based on the company name and country code.
7
5
  */
8
- export const shouldRenderTaxIdInput = ({ companyName, countryCode, }) => {
6
+ export const shouldRenderTaxIdInput = ({ companyName, countryCode, shouldRequirePeruTaxId, }) => {
7
+ if (isPeruTaxIdActive({ countryCode, shouldRequirePeruTaxId })) {
8
+ return true;
9
+ }
9
10
  // Only show the tax ID input if the country is in the EU and the company name is provided
10
11
  if (euCountryCodes.includes(countryCode)) {
11
12
  return companyName.trim().length > 0;
12
13
  }
13
14
  // If country require tax id, show the input
14
- const isCountryRequireTaxId = isInTaxIdCountry(countryCode);
15
- if (isCountryRequireTaxId) {
16
- return true;
17
- }
18
- // If country doesn't require tax ID, no need to show the input
19
- return false;
15
+ return isCountryRequireTaxId(countryCode);
20
16
  };
@@ -0,0 +1,29 @@
1
+ import { h } from "@stencil/core";
2
+ import { stripeStore } from "../../store/checkout/stripe";
3
+ import { translate } from "../../store/translationStore";
4
+ import { getTaxIdFieldState } from "./getTaxIdFieldState";
5
+ import { isCheckoutTaxIdTypeValue } from "../taxId/taxIdRules";
6
+ export const renderTaxIdFields = ({ companyName, countryCode, errorField, errorMessage, onTaxIdChange, shouldRequirePeruTaxId, taxId, taxIdType, }) => {
7
+ const state = getTaxIdFieldState({
8
+ companyName,
9
+ countryCode,
10
+ errorField,
11
+ errorMessage,
12
+ shouldRequirePeruTaxId,
13
+ taxIdType,
14
+ });
15
+ if (!state) {
16
+ return null;
17
+ }
18
+ return (h("div", { class: "zonos--tax-id-input" }, state.typeOptions && (h("zonos-stripe-select", { error: state.typeError, isError: !!state.typeError, onSelectChange: (event) => {
19
+ if (isCheckoutTaxIdTypeValue(event.detail)) {
20
+ stripeStore.taxIdType = event.detail;
21
+ }
22
+ }, options: state.typeOptions.map(option => ({
23
+ label: translate(option.label),
24
+ value: option.value,
25
+ })), selectLabel: translate('Tax id type'), selectedValue: state.selectedValue, value: state.selectedValue })), state.showValueInput && (h("zonos-stripe-input", { error: state.valueError, inputLabel: state.inputLabel ? translate(state.inputLabel) : '', inputPlaceholder: state.inputPlaceholder || '', inputValue: taxId, isError: !!state.valueError, onInputChange: (event) => {
26
+ stripeStore.taxId = event.detail;
27
+ onTaxIdChange === null || onTaxIdChange === void 0 ? void 0 : onTaxIdChange(event.detail);
28
+ } }))));
29
+ };
@@ -0,0 +1,44 @@
1
+ import { checkoutTaxIdTypeValues, isCountryRequireTaxId, peruTaxIdDigitLength, shipToTaxIdLabels, taxIdTypeOptions, } from "../../../types/checkout/TaxId";
2
+ export const stripTaxIdSeparators = (taxId) => taxId.replace(/[\s-]/g, '');
3
+ export const rfcRegex = /^[A-ZÑ]{3,4}[0-9]{6}[A-Z0-9]{3}$/;
4
+ export const curpRegex = /^[A-Z]{4}[0-9]{6}[HMX][A-Z]{5}[A-Z0-9][0-9]$/;
5
+ export const isMexicoTaxIdType = (taxIdType) => taxIdTypeOptions.MX.some(option => option.value === taxIdType);
6
+ export const isPeruTaxIdType = (taxIdType) => taxIdTypeOptions.PE.some(option => option.value === taxIdType);
7
+ export const isCheckoutTaxIdTypeValue = (taxIdType) => checkoutTaxIdTypeValues.some(value => value === taxIdType);
8
+ /** 8 digits are a DNI, 9 a carné, 11 an RUC. Anything else is not a Peru tax id. */
9
+ export const peruTaxIdTypeFromValue = (taxId) => {
10
+ const digits = stripTaxIdSeparators(taxId);
11
+ if (!/^\d+$/.test(digits)) {
12
+ return null;
13
+ }
14
+ if (digits.length === peruTaxIdDigitLength.DNI) {
15
+ return 'DNI';
16
+ }
17
+ if (digits.length === peruTaxIdDigitLength.CE) {
18
+ return 'CE';
19
+ }
20
+ if (digits.length === peruTaxIdDigitLength.RUC) {
21
+ return 'RUC';
22
+ }
23
+ return null;
24
+ };
25
+ export const isPeruTaxIdActive = ({ countryCode, shouldRequirePeruTaxId, }) => shouldRequirePeruTaxId && countryCode === 'PE';
26
+ /**
27
+ * Peru stays off `countryRequireTaxId`. The API flag decides which stores see it.
28
+ * Mexico and Peru pick the kind from a dropdown instead of a regex.
29
+ */
30
+ export const taxIdTypeOptionsForCheckout = ({ countryCode, shouldRequirePeruTaxId, }) => {
31
+ if (isPeruTaxIdActive({ countryCode, shouldRequirePeruTaxId })) {
32
+ return taxIdTypeOptions.PE;
33
+ }
34
+ if (countryCode === 'MX') {
35
+ return taxIdTypeOptions.MX;
36
+ }
37
+ return null;
38
+ };
39
+ export const taxIdLabelForCheckout = (countryCode) => {
40
+ if (isCountryRequireTaxId(countryCode)) {
41
+ return shipToTaxIdLabels[countryCode];
42
+ }
43
+ return null;
44
+ };
@@ -1,5 +1,7 @@
1
- import { shouldRenderTaxIdInput } from "./checkout/shouldRenderTaxIdInput";
1
+ import { resolveTaxIdSelection } from "./checkout/resolveTaxIdSelection";
2
+ import { curpRegex, isPeruTaxIdActive, isPeruTaxIdType, peruTaxIdTypeFromValue, rfcRegex, stripTaxIdSeparators, } from "./taxId/taxIdRules";
2
3
  import { euCountryCodes } from "../../types/index";
4
+ import { peruTaxIdFormatError, } from "../../types/checkout/TaxId";
3
5
  const isTaxIdRequired = (shippingCountry) => {
4
6
  const requireTaxIdCountry = [
5
7
  'MX',
@@ -8,86 +10,83 @@ const isTaxIdRequired = (shippingCountry) => {
8
10
  ];
9
11
  return requireTaxIdCountry.includes(shippingCountry);
10
12
  };
11
- export const taxIdValidationResult = ({ companyName, shippingCountry, taxId, }) => {
12
- // Check to see if we are required to collect tax id for the shipping country or not
13
- const isTaxIdInputRendered = shouldRenderTaxIdInput({
13
+ const invalid = (error, field) => ({
14
+ error,
15
+ field,
16
+ valid: false,
17
+ });
18
+ const valid = () => ({
19
+ error: null,
20
+ field: null,
21
+ valid: true,
22
+ });
23
+ export const taxIdValidationResult = ({ companyName, shippingCountry, shouldRequirePeruTaxId, taxId, taxIdType, }) => {
24
+ const { rendered, selectedType, typeOptions } = resolveTaxIdSelection({
14
25
  companyName,
15
26
  countryCode: shippingCountry,
27
+ shouldRequirePeruTaxId,
28
+ taxIdType,
16
29
  });
17
30
  // If the tax id input is not even rendered, no need to validate anything and allow to proceed. Validate when tax id input is not even rendered would prevent the user from checking out
18
- if (!isTaxIdInputRendered) {
19
- return {
20
- error: null,
21
- valid: true,
22
- };
31
+ if (!rendered) {
32
+ return valid();
33
+ }
34
+ // The number field is hidden until a type is chosen.
35
+ if (typeOptions && !selectedType) {
36
+ return invalid('Tax id type is required', 'type');
37
+ }
38
+ // Spaces and hyphens count as blank only. The original text is left unchanged.
39
+ if (isPeruTaxIdActive({
40
+ countryCode: shippingCountry,
41
+ shouldRequirePeruTaxId,
42
+ }) &&
43
+ selectedType &&
44
+ isPeruTaxIdType(selectedType.value)) {
45
+ if (!stripTaxIdSeparators(taxId)) {
46
+ return invalid('Tax id is required', 'value');
47
+ }
48
+ if (peruTaxIdTypeFromValue(taxId) !== selectedType.value) {
49
+ return invalid(peruTaxIdFormatError[selectedType.value], 'value');
50
+ }
51
+ return valid();
23
52
  }
24
53
  // Cache the result of isTaxIdRequired for reuse
25
54
  const taxIdRequired = isTaxIdRequired(shippingCountry);
26
55
  if (!taxIdRequired) {
27
56
  // If the shipping country does not require a tax id, the validation immediately returns valid
28
- return {
29
- error: null,
30
- valid: true,
31
- };
57
+ return valid();
32
58
  }
33
59
  // For all EU countries, tax id is not required if company name is not filled (not business address)
34
60
  if (euCountryCodes.includes(shippingCountry)) {
35
61
  if (!companyName.trim()) {
36
- return {
37
- error: null,
38
- valid: true,
39
- };
62
+ return valid();
40
63
  }
41
64
  if (!taxId) {
42
- return {
43
- error: 'Tax id is required',
44
- valid: false,
45
- };
65
+ return invalid('Tax id is required', 'value');
46
66
  }
47
- return {
48
- error: null,
49
- valid: true,
50
- };
67
+ return valid();
51
68
  }
52
69
  if (!taxId) {
53
- return {
54
- error: 'Tax id is required',
55
- valid: false,
56
- };
70
+ return invalid('Tax id is required', 'value');
57
71
  }
58
72
  if (shippingCountry === 'AR') {
59
- const isValid = /^[0-9]{2}-?[0-9]{8}-?[0-9]$/.test(taxId);
60
- if (!isValid) {
61
- return {
62
- error: 'Invalid CUIT/CUIL format. Must contain 11 digits, with or without dashes (XX-XXXXXXXX-X).',
63
- valid: false,
64
- };
73
+ const isValidAr = /^[0-9]{2}-?[0-9]{8}-?[0-9]$/.test(taxId);
74
+ if (!isValidAr) {
75
+ return invalid('Invalid CUIT/CUIL format. Must contain 11 digits, with or without dashes (XX-XXXXXXXX-X).', 'value');
65
76
  }
66
- return {
67
- error: null,
68
- valid: true,
69
- };
77
+ return valid();
70
78
  }
71
- // validate tax id for mexico;
72
- if (shippingCountry === 'MX') {
73
- // RFC: 3-4 letters + 6 digit date + 3 character homoclave (12-13 total)
74
- const isValidRfc = /^[A-ZÑ]{3,4}[0-9]{6}[A-Z0-9]{3}$/.test(taxId);
75
- // CURP: 4 letters + 6 digit date + gender (H/M/X) + 5 letters + alphanumeric + digit (18 total)
76
- const isValidCurp = /^[A-Z]{4}[0-9]{6}[HMX][A-Z]{5}[A-Z0-9][0-9]$/.test(taxId);
77
- if (!isValidRfc && !isValidCurp) {
78
- return {
79
- error: 'Invalid RFC or CURP format. Must be a 12–13 character RFC or an 18 character CURP, uppercase letters and numbers only.',
80
- valid: false,
81
- };
79
+ // validate tax id for mexico against the type the shopper selected
80
+ if (shippingCountry === 'MX' && selectedType) {
81
+ const isRfc = selectedType.value === 'RFC';
82
+ const isValidMx = isRfc ? rfcRegex.test(taxId) : curpRegex.test(taxId);
83
+ if (!isValidMx) {
84
+ return invalid(isRfc
85
+ ? 'Invalid RFC format. Must be 12–13 uppercase letters and numbers.'
86
+ : 'Invalid CURP format. Must be 18 uppercase letters and numbers.', 'value');
82
87
  }
83
- return {
84
- error: null,
85
- valid: true,
86
- };
88
+ return valid();
87
89
  }
88
90
  // Other countries doesn't need to validate tax id in the right format
89
- return {
90
- error: null,
91
- valid: true,
92
- };
91
+ return valid();
93
92
  };
@@ -1,2 +1,3 @@
1
+ export { curpRegex, isMexicoTaxIdType, isPeruTaxIdType, peruTaxIdTypeFromValue, stripTaxIdSeparators, } from './components/utils/taxId/taxIdRules';
1
2
  export { Zonos } from './scripts';
2
3
  export * from './types';
@@ -86,3 +86,34 @@ export const shipToTaxIdLabels = {
86
86
  SI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
87
87
  SK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
88
88
  };
89
+ export const isCountryRequireTaxId = (countryCode) => {
90
+ return countryRequireTaxId.some(code => code === countryCode);
91
+ };
92
+ export const taxIdTypeOptions = {
93
+ MX: [
94
+ { label: 'RFC', placeholder: 'XAXX010101000', value: 'RFC' },
95
+ { label: 'CURP', placeholder: 'AAAA800101HDFRRR09', value: 'CURP' },
96
+ ],
97
+ PE: [
98
+ { label: 'DNI', placeholder: '12345678', value: 'DNI' },
99
+ { label: 'RUC', placeholder: '20123456789', value: 'RUC' },
100
+ {
101
+ label: 'Carné de extranjería',
102
+ placeholder: '001234567',
103
+ value: 'CE',
104
+ },
105
+ ],
106
+ };
107
+ const checkoutTaxIdTypeValueList = ['CE', 'CURP', 'DNI', 'RFC', 'RUC'];
108
+ /** Every document kind checkout can send. Older clients omit the field. */
109
+ export const checkoutTaxIdTypeValues = checkoutTaxIdTypeValueList;
110
+ export const peruTaxIdDigitLength = {
111
+ CE: 9,
112
+ DNI: 8,
113
+ RUC: 11,
114
+ };
115
+ export const peruTaxIdFormatError = {
116
+ CE: 'Carné de extranjería must be 9 digits.',
117
+ DNI: 'DNI must be 8 digits.',
118
+ RUC: 'RUC must be 11 digits.',
119
+ };
@@ -86,5 +86,36 @@ const shipToTaxIdLabels = {
86
86
  SI: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
87
87
  SK: { friendlyName: 'EORI number', placeholder: 'DE123456789' },
88
88
  };
89
+ const isCountryRequireTaxId = (countryCode) => {
90
+ return countryRequireTaxId.some(code => code === countryCode);
91
+ };
92
+ const taxIdTypeOptions = {
93
+ MX: [
94
+ { label: 'RFC', placeholder: 'XAXX010101000', value: 'RFC' },
95
+ { label: 'CURP', placeholder: 'AAAA800101HDFRRR09', value: 'CURP' },
96
+ ],
97
+ PE: [
98
+ { label: 'DNI', placeholder: '12345678', value: 'DNI' },
99
+ { label: 'RUC', placeholder: '20123456789', value: 'RUC' },
100
+ {
101
+ label: 'Carné de extranjería',
102
+ placeholder: '001234567',
103
+ value: 'CE',
104
+ },
105
+ ],
106
+ };
107
+ const checkoutTaxIdTypeValueList = ['CE', 'CURP', 'DNI', 'RFC', 'RUC'];
108
+ /** Every document kind checkout can send. Older clients omit the field. */
109
+ const checkoutTaxIdTypeValues = checkoutTaxIdTypeValueList;
110
+ const peruTaxIdDigitLength = {
111
+ CE: 9,
112
+ DNI: 8,
113
+ RUC: 11,
114
+ };
115
+ const peruTaxIdFormatError = {
116
+ CE: 'Carné de extranjería must be 9 digits.',
117
+ DNI: 'DNI must be 8 digits.',
118
+ RUC: 'RUC must be 11 digits.',
119
+ };
89
120
 
90
- export { countryRequireTaxId as c, euCountryCodes as e, shipToTaxIdLabels as s };
121
+ export { checkoutTaxIdTypeValues as a, peruTaxIdFormatError as b, countryRequireTaxId as c, euCountryCodes as e, isCountryRequireTaxId as i, peruTaxIdDigitLength as p, shipToTaxIdLabels as s, taxIdTypeOptions as t };