@adyen/kyc-components 2.8.1 → 2.9.0

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 (315) hide show
  1. package/dist/es/AD-43128b9f.mjs +29 -0
  2. package/dist/es/AE-81598d61.mjs +40 -0
  3. package/dist/es/AG-ed98ae0e.mjs +55 -0
  4. package/dist/es/AI-3e78c886.mjs +50 -0
  5. package/dist/es/AL-3ad2778a.mjs +50 -0
  6. package/dist/es/AM-6a5175fb.mjs +55 -0
  7. package/dist/es/AN-311f7139.mjs +55 -0
  8. package/dist/es/AO-99b5ef59.mjs +55 -0
  9. package/dist/es/AQ-effe27c7.mjs +55 -0
  10. package/dist/es/AR-4013d95c.mjs +50 -0
  11. package/dist/es/AS-f15d56b2.mjs +55 -0
  12. package/dist/es/AT-d4d62b74.mjs +29 -0
  13. package/dist/es/AU-b9cba969.mjs +35 -0
  14. package/dist/es/AW-581f73fb.mjs +55 -0
  15. package/dist/es/AX-07af957a.mjs +29 -0
  16. package/dist/es/AZ-be214142.mjs +50 -0
  17. package/dist/es/BA-af4be83f.mjs +50 -0
  18. package/dist/es/BB-df28f015.mjs +55 -0
  19. package/dist/es/BD-7aef0af6.mjs +55 -0
  20. package/dist/es/BE-fc7cf8d5.mjs +29 -0
  21. package/dist/es/BF-090b06e2.mjs +55 -0
  22. package/dist/es/BG-1f54cf4f.mjs +50 -0
  23. package/dist/es/BH-1e9cc2b9.mjs +50 -0
  24. package/dist/es/BJ-d5dd5c6f.mjs +55 -0
  25. package/dist/es/BM-a808b13f.mjs +50 -0
  26. package/dist/es/BN-b13f6f6a.mjs +55 -0
  27. package/dist/es/BR-55d93100.mjs +71 -0
  28. package/dist/es/BS-db6a5bce.mjs +50 -0
  29. package/dist/es/BT-dfed2604.mjs +55 -0
  30. package/dist/es/BV-e123b0a8.mjs +50 -0
  31. package/dist/es/BW-08473bd7.mjs +55 -0
  32. package/dist/es/BY-2762d989.mjs +50 -0
  33. package/dist/es/BZ-7f28b1ff.mjs +55 -0
  34. package/dist/es/CA-aa1f78ab.mjs +41 -0
  35. package/dist/es/CC-2cc6ac39.mjs +55 -0
  36. package/dist/es/CF-78ae0244.mjs +55 -0
  37. package/dist/es/CH-47f538c0.mjs +29 -0
  38. package/dist/es/CI-10feb889.mjs +55 -0
  39. package/dist/es/CK-e308c734.mjs +55 -0
  40. package/dist/es/CL-4a6c3e0b.mjs +55 -0
  41. package/dist/es/CM-fddc630d.mjs +55 -0
  42. package/dist/es/CN-46bb9203.mjs +50 -0
  43. package/dist/es/CO-1b150cda.mjs +55 -0
  44. package/dist/es/CR-2bf50f66.mjs +50 -0
  45. package/dist/es/CU-904aea8f.mjs +55 -0
  46. package/dist/es/CX-750ccd92.mjs +55 -0
  47. package/dist/es/CY-1508b23e.mjs +29 -0
  48. package/dist/es/CZ-b6eaa1d5.mjs +29 -0
  49. package/dist/es/DE-e02051d4.mjs +29 -0
  50. package/dist/es/DJ-0032728a.mjs +55 -0
  51. package/dist/es/DK-6116657e.mjs +59 -0
  52. package/dist/es/DM-a2c158c9.mjs +55 -0
  53. package/dist/es/DO-cedffa27.mjs +50 -0
  54. package/dist/es/DZ-d44be6f8.mjs +55 -0
  55. package/dist/es/EC-c2e5813b.mjs +56 -0
  56. package/dist/es/EE-1a10f52d.mjs +29 -0
  57. package/dist/es/EG-8f29aebd.mjs +55 -0
  58. package/dist/es/EH-2dafda3e.mjs +55 -0
  59. package/dist/es/ES-42b3562e.mjs +29 -0
  60. package/dist/es/ET-ffa87ef0.mjs +55 -0
  61. package/dist/es/FI-8e3bb2bb.mjs +29 -0
  62. package/dist/es/FJ-088ea689.mjs +50 -0
  63. package/dist/es/FK-16d84ff5.mjs +55 -0
  64. package/dist/es/FM-32616e6f.mjs +55 -0
  65. package/dist/es/FO-62c08e45.mjs +50 -0
  66. package/dist/es/FR-3db03e20.mjs +29 -0
  67. package/dist/es/GA-4de2f994.mjs +55 -0
  68. package/dist/es/GB-28ea0b5a.mjs +59 -0
  69. package/dist/es/GD-0ad67069.mjs +55 -0
  70. package/dist/es/GE-0f594b35.mjs +50 -0
  71. package/dist/es/GF-a062cea7.mjs +29 -0
  72. package/dist/es/GG-e00581ea.mjs +59 -0
  73. package/dist/es/GH-80209e7e.mjs +55 -0
  74. package/dist/es/GI-b0f7c8b3.mjs +101 -0
  75. package/dist/es/GL-8f5e8ba9.mjs +50 -0
  76. package/dist/es/GM-ff3ca013.mjs +55 -0
  77. package/dist/es/GN-fc7c0f8c.mjs +55 -0
  78. package/dist/es/GP-68f23382.mjs +29 -0
  79. package/dist/es/GQ-f9867fbd.mjs +55 -0
  80. package/dist/es/GR-64a2d25c.mjs +29 -0
  81. package/dist/es/GS-49ce0f4c.mjs +55 -0
  82. package/dist/es/GT-fa779b14.mjs +50 -0
  83. package/dist/es/GU-f0dceb37.mjs +55 -0
  84. package/dist/es/GW-471336ea.mjs +55 -0
  85. package/dist/es/GY-2889ae39.mjs +55 -0
  86. package/dist/es/HK-0561cac3.mjs +62 -0
  87. package/dist/es/HM-924a724f.mjs +55 -0
  88. package/dist/es/HN-6dae206e.mjs +55 -0
  89. package/dist/es/HR-85763090.mjs +29 -0
  90. package/dist/es/HT-a659da85.mjs +55 -0
  91. package/dist/es/HU-f9ea5037.mjs +29 -0
  92. package/dist/es/ID-cb5cfce1.mjs +50 -0
  93. package/dist/es/IE-b341cbd2.mjs +29 -0
  94. package/dist/es/IL-657901df.mjs +29 -0
  95. package/dist/es/IM-5bd6279a.mjs +59 -0
  96. package/dist/es/IN-3c11df0e.mjs +56 -0
  97. package/dist/es/IO-24f6d2e7.mjs +55 -0
  98. package/dist/es/IQ-241c0148.mjs +55 -0
  99. package/dist/es/IS-4a7e436f.mjs +50 -0
  100. package/dist/es/IT-f9755e76.mjs +29 -0
  101. package/dist/es/JE-46968fa2.mjs +59 -0
  102. package/dist/es/JM-a6657a34.mjs +50 -0
  103. package/dist/es/JO-bd1eabea.mjs +50 -0
  104. package/dist/es/JP-9b5a30fa.mjs +88 -0
  105. package/dist/es/KE-2a866579.mjs +55 -0
  106. package/dist/es/KG-7713761d.mjs +55 -0
  107. package/dist/es/KH-a5f0f831.mjs +55 -0
  108. package/dist/es/KI-8376e298.mjs +55 -0
  109. package/dist/es/KM-48c8c9c0.mjs +55 -0
  110. package/dist/es/KN-b34777c7.mjs +55 -0
  111. package/dist/es/KR-8bcf8499.mjs +50 -0
  112. package/dist/es/KW-4dd6ab01.mjs +50 -0
  113. package/dist/es/KY-4f921c93.mjs +50 -0
  114. package/dist/es/KZ-68b655f3.mjs +50 -0
  115. package/dist/es/LA-582a34e2.mjs +55 -0
  116. package/dist/es/LB-7e5023a3.mjs +50 -0
  117. package/dist/es/LC-4e610f91.mjs +55 -0
  118. package/dist/es/LI-3979434e.mjs +29 -0
  119. package/dist/es/LK-23f5002d.mjs +55 -0
  120. package/dist/es/LT-2076ca77.mjs +29 -0
  121. package/dist/es/LU-b0538582.mjs +29 -0
  122. package/dist/es/LV-440617df.mjs +29 -0
  123. package/dist/es/MA-f2af9aa6.mjs +55 -0
  124. package/dist/es/MC-f619d821.mjs +29 -0
  125. package/dist/es/MD-ffe4e2f4.mjs +50 -0
  126. package/dist/es/ME-46686aa8.mjs +50 -0
  127. package/dist/es/MH-c535387d.mjs +55 -0
  128. package/dist/es/MK-11442cf1.mjs +50 -0
  129. package/dist/es/ML-b2c3720e.mjs +55 -0
  130. package/dist/es/MM-0ae1a124.mjs +55 -0
  131. package/dist/es/MN-baba0d9d.mjs +55 -0
  132. package/dist/es/MO-2c51f9f7.mjs +55 -0
  133. package/dist/es/MP-55044c4b.mjs +55 -0
  134. package/dist/es/MQ-aaefd2b2.mjs +29 -0
  135. package/dist/es/MR-f122a6f0.mjs +50 -0
  136. package/dist/es/MS-7623ec5f.mjs +55 -0
  137. package/dist/es/MT-315c76bb.mjs +29 -0
  138. package/dist/es/MU-126673fe.mjs +50 -0
  139. package/dist/es/MV-d8748aca.mjs +55 -0
  140. package/dist/es/MW-26492427.mjs +55 -0
  141. package/dist/es/MX-ca79b44b.mjs +60 -0
  142. package/dist/es/MY-443e729e.mjs +55 -0
  143. package/dist/es/MZ-192a5094.mjs +55 -0
  144. package/dist/es/NC-3849aac0.mjs +50 -0
  145. package/dist/es/NE-bf76bc84.mjs +55 -0
  146. package/dist/es/NF-46f5dffa.mjs +55 -0
  147. package/dist/es/NG-458396e5.mjs +55 -0
  148. package/dist/es/NI-efe8c864.mjs +55 -0
  149. package/dist/es/NL-3e38d0eb.mjs +29 -0
  150. package/dist/es/NO-088fac56.mjs +59 -0
  151. package/dist/es/NP-26b20587.mjs +55 -0
  152. package/dist/es/NR-ba1f7da1.mjs +55 -0
  153. package/dist/es/NU-6dc3ed45.mjs +55 -0
  154. package/dist/es/NZ-12ed2cb9.mjs +47 -0
  155. package/dist/es/OM-4976855b.mjs +55 -0
  156. package/dist/es/PA-3b45122a.mjs +55 -0
  157. package/dist/es/PE-ad6e8281.mjs +50 -0
  158. package/dist/es/PF-2b1b6f30.mjs +50 -0
  159. package/dist/es/PG-b94ea47f.mjs +55 -0
  160. package/dist/es/PH-1b96a1eb.mjs +50 -0
  161. package/dist/es/PK-35cadd30.mjs +50 -0
  162. package/dist/es/PL-6a490cd1.mjs +53 -0
  163. package/dist/es/PM-d508f3c5.mjs +29 -0
  164. package/dist/es/PN-1f6ccf43.mjs +55 -0
  165. package/dist/es/PR-730f2830.mjs +55 -0
  166. package/dist/es/PS-f3ef78cd.mjs +50 -0
  167. package/dist/es/PT-66954cea.mjs +29 -0
  168. package/dist/es/PW-0d1c7797.mjs +55 -0
  169. package/dist/es/PY-c8e58794.mjs +55 -0
  170. package/dist/es/QA-35be8b1e.mjs +50 -0
  171. package/dist/es/RE-9f92ed9b.mjs +29 -0
  172. package/dist/es/RO-5c62edb1.mjs +29 -0
  173. package/dist/es/RS-bc256d90.mjs +50 -0
  174. package/dist/es/RU-bbee5e73.mjs +55 -0
  175. package/dist/es/RW-95b5d859.mjs +55 -0
  176. package/dist/es/SA-69b2f72a.mjs +50 -0
  177. package/dist/es/SB-567c239a.mjs +55 -0
  178. package/dist/es/SC-9e5a0d31.mjs +55 -0
  179. package/dist/es/SE-4ed53265.mjs +59 -0
  180. package/dist/es/SG-970463e3.mjs +35 -0
  181. package/dist/es/SH-d8ab21b7.mjs +55 -0
  182. package/dist/es/SI-3b6d3545.mjs +29 -0
  183. package/dist/es/SJ-e3430cfd.mjs +50 -0
  184. package/dist/es/SK-2385e057.mjs +29 -0
  185. package/dist/es/SL-92bf45d9.mjs +55 -0
  186. package/dist/es/SM-bafbc267.mjs +29 -0
  187. package/dist/es/SN-5733e740.mjs +55 -0
  188. package/dist/es/SO-d5b69054.mjs +55 -0
  189. package/dist/es/SR-0a8c71c0.mjs +55 -0
  190. package/dist/es/ST-d40d86c1.mjs +55 -0
  191. package/dist/es/TC-ccbc7116.mjs +55 -0
  192. package/dist/es/TD-679d137c.mjs +55 -0
  193. package/dist/es/TF-6bfcf75d.mjs +50 -0
  194. package/dist/es/TG-a20ef9ed.mjs +55 -0
  195. package/dist/es/TH-e39a447c.mjs +56 -0
  196. package/dist/es/TK-89a81d38.mjs +55 -0
  197. package/dist/es/TL-8d6ca9b7.mjs +50 -0
  198. package/dist/es/TN-6e746476.mjs +50 -0
  199. package/dist/es/TO-a8c55d73.mjs +55 -0
  200. package/dist/es/TR-b1175ddc.mjs +50 -0
  201. package/dist/es/TT-5c4a3940.mjs +56 -0
  202. package/dist/es/TV-e1a267b9.mjs +55 -0
  203. package/dist/es/TW-9e0e34fa.mjs +62 -0
  204. package/dist/es/TZ-c8a8159b.mjs +55 -0
  205. package/dist/es/UA-7014199a.mjs +50 -0
  206. package/dist/es/UG-1fe39fa7.mjs +55 -0
  207. package/dist/es/UM-3fcbf872.mjs +55 -0
  208. package/dist/es/US-6fbdfc0c.mjs +60 -0
  209. package/dist/es/UY-e6d05d75.mjs +50 -0
  210. package/dist/es/UZ-433656c8.mjs +55 -0
  211. package/dist/es/VA-e8e13d32.mjs +29 -0
  212. package/dist/es/VC-331669c0.mjs +55 -0
  213. package/dist/es/VE-5e7b0d3b.mjs +55 -0
  214. package/dist/es/VG-43e85e33.mjs +50 -0
  215. package/dist/es/VI-3d9d6d8b.mjs +55 -0
  216. package/dist/es/VN-9442a8c1.mjs +50 -0
  217. package/dist/es/VU-96fae02f.mjs +55 -0
  218. package/dist/es/WF-90a27056.mjs +50 -0
  219. package/dist/es/WS-ddcb2b71.mjs +55 -0
  220. package/dist/es/YE-02c4c81e.mjs +55 -0
  221. package/dist/es/YT-33751cc9.mjs +29 -0
  222. package/dist/es/ZA-0084b083.mjs +56 -0
  223. package/dist/es/ZM-c6a4d6cc.mjs +55 -0
  224. package/dist/es/adyen-kyc-components.es.js +1748 -1387
  225. package/dist/types/components/Company/component/CompanyComponent.d.ts +25 -26
  226. package/dist/types/components/Company/rules.d.ts +1 -0
  227. package/dist/types/components/CompanyNameAndCountry/component/CompanyNameAndCountryComponent.d.ts +3 -2
  228. package/dist/types/components/CompanyNameAndCountry/types.d.ts +4 -4
  229. package/dist/types/components/Individual/rules.d.ts +3 -0
  230. package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/component/DriversLicense.d.ts +8 -7
  231. package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/component/PassportNumber.d.ts +4 -4
  232. package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/component/ProofOfIdentityCard.d.ts +4 -4
  233. package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/component/TypeOfIdentity.d.ts +1 -1
  234. package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/types.d.ts +2 -2
  235. package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/validate.d.ts +1 -1
  236. package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/component/DriversLicense.d.ts +1 -1
  237. package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/component/TypeOfIdentity.d.ts +1 -1
  238. package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/types.d.ts +2 -2
  239. package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/validate.d.ts +1 -3
  240. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/additionalIdentityInfoSchema.d.ts +7 -0
  241. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/DriversLicense.d.ts +19 -0
  242. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/IdentityNZComponent.d.ts +2 -0
  243. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/PassportNumber.d.ts +15 -0
  244. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/component/TypeOfIdentity.d.ts +12 -0
  245. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/types.d.ts +10 -0
  246. package/dist/types/components/PersonalDetails/component/IdentityComponent/IdentityNZ/validate.d.ts +3 -0
  247. package/dist/types/components/{identityUS → PersonalDetails/component/IdentityComponent/identityUS}/component/IdentityUSComponent.d.ts +1 -1
  248. package/dist/types/components/PersonalDetails/component/IdentityComponent/index.d.ts +2 -0
  249. package/dist/types/components/PersonalDetails/component/PersonalDetailsComponent.d.ts +1 -2
  250. package/dist/types/components/PersonalDetails/types.d.ts +7 -1
  251. package/dist/types/components/SoleProp/component/SolePropComponent.d.ts +23 -3
  252. package/dist/types/components/TaskList/component/TaskListItem.d.ts +1 -1
  253. package/dist/types/components/TaskList/types.d.ts +3 -0
  254. package/dist/types/components/internal/Address/types.d.ts +1 -41
  255. package/dist/types/components/internal/Address/utils.d.ts +1 -1
  256. package/dist/types/components/internal/CountryField/CountryField.d.ts +3 -0
  257. package/dist/types/components/internal/CountryField/index.d.ts +1 -0
  258. package/dist/types/components/internal/CountryField/types.d.ts +12 -0
  259. package/dist/types/components/internal/EntityAssociation/EntityAssociation.d.ts +1 -1
  260. package/dist/types/components/internal/EntityAssociation/types.d.ts +3 -0
  261. package/dist/types/components/internal/FormFields/Select/types.d.ts +17 -12
  262. package/dist/types/components/internal/LegalCompanyNameField/LegalCompanyNameField.d.ts +4 -0
  263. package/dist/types/components/internal/LegalCompanyNameField/index.d.ts +1 -0
  264. package/dist/types/components/internal/LegalCompanyNameField/types.d.ts +8 -0
  265. package/dist/types/components/internal/Remove/Remove.d.ts +1 -1
  266. package/dist/types/components/internal/Remove/types.d.ts +2 -0
  267. package/dist/types/components/internal/StateField/StateField.d.ts +3 -0
  268. package/dist/types/components/internal/StateField/index.d.ts +1 -0
  269. package/dist/types/components/internal/StateField/types.d.ts +8 -0
  270. package/dist/types/components/internal/TaxId/taxIdValidation.d.ts +1 -1
  271. package/dist/types/core/Services/agnostic/get-fonts.d.ts +4 -11
  272. package/dist/types/core/Services/agnostic/get-payout-account-formats.d.ts +3 -0
  273. package/dist/types/core/Services/componentApi/index.d.ts +0 -2
  274. package/dist/types/core/Services/kycExternalApi/index.d.ts +0 -1
  275. package/dist/types/core/hooks/useForm/reducer.d.ts +1 -1
  276. package/dist/types/core/hooks/useForm/types.d.ts +16 -5
  277. package/dist/types/core/models/api/get-configuration.d.ts +2 -25
  278. package/dist/types/core/models/api/get-scenarios.d.ts +19 -3
  279. package/dist/types/core/models/api/individual.d.ts +1 -0
  280. package/dist/types/core/models/api/trust-types-value.d.ts +4 -0
  281. package/dist/types/core/models/form.d.ts +1 -1
  282. package/dist/types/core/models/identity.d.ts +1 -1
  283. package/dist/types/datasets/accountFormats/getAccountFormatForCountry.d.ts +3 -0
  284. package/dist/types/language/config.d.ts +12 -1
  285. package/dist/types/utils/decision-maker-roles.d.ts +1 -1
  286. package/dist/types/utils/entity-status-util.d.ts +2 -2
  287. package/dist/types/utils/entriesOf.d.ts +1 -0
  288. package/dist/types/utils/mapping/componentApiMapping.d.ts +10 -5
  289. package/dist/types/utils/mapping/mapping.d.ts +12 -82
  290. package/dist/types/utils/mapping/utils.d.ts +41 -0
  291. package/dist/types/utils/regex/driversLicenseCardNumberPatterns.d.ts +3 -0
  292. package/dist/types/utils/regex/driversLicenseNumberPatterns.d.ts +5 -0
  293. package/dist/types/utils/regex/index.d.ts +4 -0
  294. package/dist/types/utils/regex/passportNumberPatterns.d.ts +4 -0
  295. package/dist/types/utils/regex/proofOfIdentityCardPatterns.d.ts +4 -0
  296. package/dist/types/utils/trust-util.d.ts +1 -1
  297. package/dist/types/utils/validation/commonValidators.d.ts +2 -2
  298. package/package.json +2 -1
  299. package/dist/types/components/internal/Address/components/CountryField.d.ts +0 -2
  300. package/dist/types/components/internal/Address/components/StateField.d.ts +0 -2
  301. package/dist/types/components/internal/LegalCompanyName/LegalCompanyName.d.ts +0 -3
  302. package/dist/types/components/internal/LegalCompanyName/index.d.ts +0 -1
  303. package/dist/types/components/internal/LegalCompanyName/types.d.ts +0 -8
  304. package/dist/types/components/internal/LegalCompanyName/validate.d.ts +0 -3
  305. package/dist/types/core/Services/componentApi/get-payout-fields.d.ts +0 -4
  306. package/dist/types/core/Services/componentApi/get-payout-formats.d.ts +0 -4
  307. package/dist/types/core/Services/kycExternalApi/get-account-format.d.ts +0 -4
  308. package/dist/types/core/models/api/get-payout-fields.d.ts +0 -2
  309. package/dist/types/utils/regex/hkIdentityTypePatterns.d.ts +0 -3
  310. /package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/additionalIdentityInfoSchema.d.ts +0 -0
  311. /package/dist/types/components/{IdentityAu → PersonalDetails/component/IdentityComponent/IdentityAu}/component/IdentityAuComponent.d.ts +0 -0
  312. /package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/additionalIdentityInfoSchema.d.ts +0 -0
  313. /package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/component/IdentityHKComponent.d.ts +0 -0
  314. /package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/component/PassportNumber.d.ts +0 -0
  315. /package/dist/types/components/{IdentityHK → PersonalDetails/component/IdentityComponent/IdentityHK}/component/ProofOfIdentityCard.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { useContext, useState, useCallback, useEffect, useMemo, useReducer, useLayoutEffect, useRef as useRef$1, useId as useId$1 } from "preact/hooks";
2
- import { createContext, createElement, toChildArray, render } from "preact";
2
+ import { createContext, createElement, render } from "preact";
3
3
  import sanitizeHtml from "sanitize-html";
4
4
  import cx from "classnames";
5
5
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
@@ -28,6 +28,7 @@ const postalCode = "Postal code";
28
28
  const city = "City";
29
29
  const cityTown = "City / Town";
30
30
  const state = "State";
31
+ const region = "Region";
31
32
  const provinceOrTerritory = "Province or territory";
32
33
  const selectProvinceOrTerritory = "Select a province or territory";
33
34
  const zipCode = "ZIP code";
@@ -72,8 +73,11 @@ const codNumericPersonal = "Cod Numeric Personal (CNP)";
72
73
  const cadastroDePessoasFisicas = "Cadastro de Pessoas Físicas (CFP)";
73
74
  const invalidFormatExpects = "Invalid format. Expected format: %{format}";
74
75
  const invalidFormatForAuPassportNumber = "This isn't a valid Australian passport number. Expected format: 1-2 letters followed by 7 numbers.";
76
+ const invalidFormatForNZPassportNumber = "Expected format should be 8-9 alphanumeric characters. For example: PA094043.";
75
77
  const invalidFormatForAuDriversLicenseNumber = "This isn't a valid Australian driver's license number. Expected format: 6-11 alphanumeric characters.";
78
+ const invalidFormatForNZDriversLicenseNumber = "Expected format should be: 2 characters, followed by 6 digits";
76
79
  const invalidFormatForAuDriversLicenseCardNumber = "This isn't a valid Australian driver's license card number. Expected format: 6-10 alphanumeric characters.";
80
+ const invalidFormatForNZDriversLicenseCardNumber = "Expected format should be: 3 digits";
77
81
  const invalidFormatForAuProofOfIdentityCardNumber = "This isn't a valid Australian proof of identity card number. Expected format: 6-10 alphanumeric characters.";
78
82
  const invalidFormatForHKPassportNumber = "Not valid for HK. Format should be: 9-character alphanumeric. For example: K12345599";
79
83
  const invalidFormatForHKDriversLicenseNumber = "Not valid for HK. Format should be: 8-character alphanumeric. For example: A1234567";
@@ -108,6 +112,7 @@ const issuerState = "Issuing state";
108
112
  const licenseNumber = "Driver license number";
109
113
  const driverLicense = "Driver License";
110
114
  const licenseCardNumber = "Card number";
115
+ const licenceVersionNumber = "Licence version number";
111
116
  const documents = "Documents";
112
117
  const idDocument$1 = "ID Document";
113
118
  const documentType = "Document type";
@@ -427,7 +432,7 @@ const irdDocument = "IRD document";
427
432
  const irdNumber = "IRD number";
428
433
  const australianBusinessNumberAbn = "Australian business number (ABN)";
429
434
  const australianBusinessNumberAcn = "Australian company number (ACN)";
430
- const companyNumber__NZ = "New Zealand Business Number (NZBN) / Company Number (NCN)";
435
+ const NZBN = "New Zealand Business Number (NZBN)";
431
436
  const enterpriseNumber = "Enterprise Number";
432
437
  const NIP = "NIP (Numer identyfikacji podatkowej)";
433
438
  const NIPC = "NIPC (Número de Identificação de Pessoa Colectiva)";
@@ -476,12 +481,16 @@ const updateTheInformation = "Update the information";
476
481
  const andResubmit = "and submit again.";
477
482
  const someFieldsHaveUnsupportedFormatedUpdateInfoAndResubmit = "Some fields have unsupported formats. Update the information and submit again.";
478
483
  const trustType = "Type of trust agreement";
484
+ const businessTrust = "Business trust";
479
485
  const cashManagementTrust = "Cash management trust";
486
+ const charitableTrust = "Charitable trust";
480
487
  const corporateUnitTrust = "Corporate unit trust";
481
488
  const deceasedEstate = "Deceased estate";
482
489
  const discretionaryInvestmentTrust = "Discretionary investment trust";
483
490
  const discretionaryServicesManagementTrust = "Discretionary services management trust";
484
491
  const discretionaryTradingTrust = "Discretionary trading trust";
492
+ const discretionaryTrust = "Discretionary trust";
493
+ const familyTrust = "Family trust";
485
494
  const firstHomeSaverAccountsTrust = "First home saver accounts trust";
486
495
  const fixedTrust = "Fixed trust";
487
496
  const fixedUnitTrust = "Fixed unit trust";
@@ -1003,6 +1012,7 @@ const remediationMessage_3_100 = "Check the above information, then click here t
1003
1012
  const sameNameAsLegalName = "Same as legal name of the company";
1004
1013
  const whereCanIFindTheseNumbersOnMyDriversLicense = "Where can I find these numbers on my driver's license?";
1005
1014
  const whereToFindNumbersOnDriversLicense = "Depending on the issuing state the position of these numbers might differ, but the license number is always on the front side of the card and the card number is in most cases located on the back of the license.";
1015
+ const whereToFindNumbersOnDriversLicense__NZ = "The license number and version number are always on the front side of the card.";
1006
1016
  const iStillCantFindIt = "I still can't find it.";
1007
1017
  const patriotActDisclosureTitle = "Important Information You Need to Know About Opening An Account";
1008
1018
  const patriotActDisclosureTextParagraph1 = "To help the government fight the funding of terrorism and money laundering activities, Federal law requires financial institutions to obtain, verify, and record information that identifies each person (individual or entity) who opens an account and certain individuals who are associated with an account.";
@@ -1072,6 +1082,7 @@ const defaultTrans = {
1072
1082
  city,
1073
1083
  cityTown,
1074
1084
  state,
1085
+ region,
1075
1086
  provinceOrTerritory,
1076
1087
  selectProvinceOrTerritory,
1077
1088
  zipCode,
@@ -1116,8 +1127,11 @@ const defaultTrans = {
1116
1127
  cadastroDePessoasFisicas,
1117
1128
  invalidFormatExpects,
1118
1129
  invalidFormatForAuPassportNumber,
1130
+ invalidFormatForNZPassportNumber,
1119
1131
  invalidFormatForAuDriversLicenseNumber,
1132
+ invalidFormatForNZDriversLicenseNumber,
1120
1133
  invalidFormatForAuDriversLicenseCardNumber,
1134
+ invalidFormatForNZDriversLicenseCardNumber,
1121
1135
  invalidFormatForAuProofOfIdentityCardNumber,
1122
1136
  invalidFormatForHKPassportNumber,
1123
1137
  invalidFormatForHKDriversLicenseNumber,
@@ -1152,6 +1166,7 @@ const defaultTrans = {
1152
1166
  licenseNumber,
1153
1167
  driverLicense,
1154
1168
  licenseCardNumber,
1169
+ licenceVersionNumber,
1155
1170
  documents,
1156
1171
  idDocument: idDocument$1,
1157
1172
  documentType,
@@ -1471,7 +1486,8 @@ const defaultTrans = {
1471
1486
  irdNumber,
1472
1487
  australianBusinessNumberAbn,
1473
1488
  australianBusinessNumberAcn,
1474
- companyNumber__NZ,
1489
+ "NZBN/NCN": "New Zealand Business Number (NZBN) / Company Number (NCN)",
1490
+ NZBN,
1475
1491
  enterpriseNumber,
1476
1492
  NIP,
1477
1493
  NIPC,
@@ -1524,12 +1540,16 @@ const defaultTrans = {
1524
1540
  andResubmit,
1525
1541
  someFieldsHaveUnsupportedFormatedUpdateInfoAndResubmit,
1526
1542
  trustType,
1543
+ businessTrust,
1527
1544
  cashManagementTrust,
1545
+ charitableTrust,
1528
1546
  corporateUnitTrust,
1529
1547
  deceasedEstate,
1530
1548
  discretionaryInvestmentTrust,
1531
1549
  discretionaryServicesManagementTrust,
1532
1550
  discretionaryTradingTrust,
1551
+ discretionaryTrust,
1552
+ familyTrust,
1533
1553
  firstHomeSaverAccountsTrust,
1534
1554
  fixedTrust,
1535
1555
  fixedUnitTrust,
@@ -2063,6 +2083,7 @@ const defaultTrans = {
2063
2083
  sameNameAsLegalName,
2064
2084
  whereCanIFindTheseNumbersOnMyDriversLicense,
2065
2085
  whereToFindNumbersOnDriversLicense,
2086
+ whereToFindNumbersOnDriversLicense__NZ,
2066
2087
  iStillCantFindIt,
2067
2088
  patriotActDisclosureTitle,
2068
2089
  patriotActDisclosureTextParagraph1,
@@ -4431,6 +4452,13 @@ const businessRegistrationNumberPatterns = {
4431
4452
  x: 9,
4432
4453
  y: 13
4433
4454
  }
4455
+ },
4456
+ [CompanyTypesValue.SOLE_PROPRIETORSHIP]: {
4457
+ regex: /^\d{13}$/,
4458
+ format: "Xdigits",
4459
+ values: {
4460
+ digits: 13
4461
+ }
4434
4462
  }
4435
4463
  },
4436
4464
  [CountryCodes.Norway]: {
@@ -4565,6 +4593,22 @@ const CountryIdNumberPatterns = {
4565
4593
  [CountryCodes.UnitedStates]: /^\d{4}$/,
4566
4594
  US9: /^\d{9}$/
4567
4595
  };
4596
+ const DriversLicenseCardNumberPatterns = {
4597
+ [CountryCodes.NewZealand]: /^[\d]{3}$/
4598
+ };
4599
+ const DriversLicenseNumberPatterns = {
4600
+ [CountryCodes.Australia]: /^[A-Za-z\d]{6,11}$/,
4601
+ [CountryCodes.HongKong]: /^[A-Z]{1}[A-Z0-9]{7}$/,
4602
+ [CountryCodes.NewZealand]: /^[A-Za-z]{2}[\d]{6}$/
4603
+ };
4604
+ const PassportNumberPatterns = {
4605
+ [CountryCodes.Australia]: /^[A-Z]{1,2}\d{7}$/,
4606
+ [CountryCodes.HongKong]: /^(?=.{9}$)[A-Z]{1,2}\d{6}[A-Z0-9]{1,2}$/
4607
+ };
4608
+ const ProofOfIdentityCardPatterns = {
4609
+ [CountryCodes.Australia]: /^[A-Za-z\d]{6,10}$/,
4610
+ [CountryCodes.HongKong]: /^[A-Z]{1,2}[0-9]{6}[0-9A]$/
4611
+ };
4568
4612
  const vatSpecsPerCountry = {
4569
4613
  /* EUROPE: EU */
4570
4614
  [CountryCodes.Austria]: {
@@ -7399,6 +7443,44 @@ var SettingNames = /* @__PURE__ */ ((SettingNames2) => {
7399
7443
  SettingNames2["RequirePciSignPosMoto"] = "requirePciSignPosMoto";
7400
7444
  return SettingNames2;
7401
7445
  })(SettingNames || {});
7446
+ function useGlobalData() {
7447
+ const {
7448
+ getData
7449
+ } = useStateContext();
7450
+ return getData();
7451
+ }
7452
+ function useGlobalDataSlice(sliceId, caller) {
7453
+ const {
7454
+ dispatch,
7455
+ getData
7456
+ } = useStateContext();
7457
+ const sliceData = getData()[sliceId];
7458
+ const updateState = useCallback((updatedSlice) => dispatch({
7459
+ type: "addToState",
7460
+ value: {
7461
+ ...updatedSlice,
7462
+ dataStoreId: sliceId,
7463
+ caller
7464
+ }
7465
+ // TODO merge SFValue and StateSlice types
7466
+ }), [sliceId, caller]);
7467
+ const updateStateSlice = useMemo(() => debounce(updateState, ON_CHANGE_DEBOUNCE_DURATION), [updateState]);
7468
+ return {
7469
+ sliceData,
7470
+ updateStateSlice
7471
+ };
7472
+ }
7473
+ function useResetGlobalData(caller) {
7474
+ const {
7475
+ dispatch
7476
+ } = useStateContext();
7477
+ return useCallback(() => dispatch({
7478
+ type: "resetState",
7479
+ value: {
7480
+ caller
7481
+ }
7482
+ }), [dispatch, caller]);
7483
+ }
7402
7484
  function useDataset(datasetIdentifier2, skip) {
7403
7485
  const {
7404
7486
  i18n
@@ -7477,15 +7559,17 @@ function datasetUtilities(locale) {
7477
7559
  };
7478
7560
  }
7479
7561
  const logger$j = createLogger("CountryField");
7562
+ const COUNTRY_FIELD = "country";
7480
7563
  function CountryField({
7481
- allowedCountries = [],
7482
- classNameModifiers = [],
7483
- errorMessage,
7484
- onDropdownChange,
7485
- value,
7486
- readOnly,
7564
+ data,
7565
+ valid,
7566
+ error,
7487
7567
  label,
7488
- helperText
7568
+ readonly,
7569
+ handleChangeFor,
7570
+ helperText,
7571
+ allowedCountries = [],
7572
+ classNameModifiers = []
7489
7573
  }) {
7490
7574
  const {
7491
7575
  i18n
@@ -7503,100 +7587,76 @@ function CountryField({
7503
7587
  ...item,
7504
7588
  sprite: `#adl-flag-${item.id.toLowerCase()}`
7505
7589
  }));
7590
+ const handleCompanyChangeFor = useCallback((e) => {
7591
+ const {
7592
+ value
7593
+ } = e.target;
7594
+ handleChangeFor(COUNTRY_FIELD)(value);
7595
+ }, [handleChangeFor]);
7506
7596
  return jsx(Field, {
7507
- name: "country",
7508
- label: label || i18n.get("country"),
7509
- errorMessage,
7597
+ name: COUNTRY_FIELD,
7598
+ label: label || i18n.get(COUNTRY_FIELD),
7599
+ errorMessage: error,
7510
7600
  classNameModifiers,
7511
- isValid: !!value,
7601
+ isValid: valid,
7512
7602
  helper: helperText,
7513
7603
  children: (childProps) => jsx(Select, {
7514
7604
  ...childProps,
7515
- onChange: onDropdownChange,
7516
- name: "country",
7605
+ name: COUNTRY_FIELD,
7517
7606
  placeholder: i18n.get("selectCountry"),
7518
- selected: value,
7607
+ selected: data,
7519
7608
  items: countries,
7520
- readonly: (countries.length === 1 || readOnly) && !!value
7609
+ readonly: (countries.length === 1 || readonly) && !!data,
7610
+ onChange: handleCompanyChangeFor
7521
7611
  })
7522
7612
  });
7523
7613
  }
7524
- const companyNameValidatorRules = {
7525
- legalCompanyName: {
7526
- modes: ["blur"],
7527
- validate: (legalCompanyName2) => !isEmpty(legalCompanyName2),
7528
- errorMessage: "fieldIsRequired"
7529
- }
7530
- };
7531
- const legalCompanyNameFields = ["legalCompanyName"];
7532
- function LegalCompanyName(props) {
7614
+ const LEGAL_COMPANY_NAME_FIELD = "legalCompanyName";
7615
+ function LegalCompanyNameField({
7616
+ country: country2,
7617
+ data,
7618
+ valid,
7619
+ error,
7620
+ label,
7621
+ readonly,
7622
+ handleChangeFor
7623
+ }) {
7533
7624
  const {
7534
7625
  i18n
7535
7626
  } = useI18nContext();
7536
- const {
7537
- dataStoreId,
7538
- requiredFields,
7539
- country: country2
7540
- } = props;
7541
- const schema = requiredFields || ["legalCompanyName"];
7542
- const stateRef = useRef$1({
7543
- setState: null
7544
- });
7545
- const {
7546
- handleChangeFor,
7547
- data,
7548
- valid,
7549
- errors,
7550
- isValid,
7551
- fieldProblems
7552
- } = useForm({
7553
- ...props,
7554
- schema,
7555
- rules: props.validators || companyNameValidatorRules,
7556
- defaultData: props.data,
7557
- fieldProblems: props == null ? void 0 : props.fieldValidationErrors
7558
- });
7559
- useEffect(() => {
7560
- var _a, _b;
7561
- (_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
7562
- type: "addToState",
7563
- value: {
7564
- data,
7565
- valid,
7566
- errors,
7567
- fieldProblems,
7568
- caller: "legalCompanyName",
7569
- dataStoreId
7570
- }
7571
- });
7572
- }, [data, valid, errors, isValid]);
7573
- const formUtils = formUtilities(props, i18n);
7574
- return !formUtils.isRequiredField("legalCompanyName") ? null : jsxs("div", {
7575
- className: "adyen-kyc-field__legal-company-name",
7576
- children: [jsx(StateContextSetter, {
7577
- stateRef
7578
- }), jsx(Field, {
7579
- name: "legalCompanyName",
7580
- label: formUtils.getLabel("legalCompanyName"),
7581
- helper: i18n.get("legalCompanyNameHelper", {
7582
- localizeFor: country2
7583
- }),
7584
- classNameModifiers: ["legalCompanyName"],
7585
- errorMessage: formUtils.getErrorMessage("legalCompanyName", errors, fieldProblems),
7586
- isValid: valid.legalCompanyName,
7587
- children: (childProps) => jsx(InputText, {
7588
- ...childProps,
7589
- name: "legalCompanyName",
7590
- value: data.legalCompanyName,
7591
- readonly: formUtils.isReadOnly("legalCompanyName"),
7592
- classNameModifiers: ["legalCompanyName"],
7593
- onInput: handleChangeFor("legalCompanyName", "input"),
7594
- onBlur: handleChangeFor("legalCompanyName", "blur"),
7595
- "aria-required": true,
7596
- "aria-label": formUtils.getLabel("legalCompanyName"),
7597
- "aria-invalid": !valid.legalCompanyName
7598
- })
7599
- })]
7627
+ const handleLegalCompanyNameInput = useCallback((e) => {
7628
+ const {
7629
+ value
7630
+ } = e.target;
7631
+ handleChangeFor(LEGAL_COMPANY_NAME_FIELD, "input")(value);
7632
+ }, [handleChangeFor]);
7633
+ const handleLegalCompanyNameBlur = useCallback((e) => {
7634
+ const {
7635
+ value
7636
+ } = e.target;
7637
+ handleChangeFor(LEGAL_COMPANY_NAME_FIELD, "blur")(value);
7638
+ }, [handleChangeFor]);
7639
+ return jsx(Field, {
7640
+ name: LEGAL_COMPANY_NAME_FIELD,
7641
+ label,
7642
+ helper: i18n.get("legalCompanyNameHelper", {
7643
+ localizeFor: country2
7644
+ }),
7645
+ classNameModifiers: [LEGAL_COMPANY_NAME_FIELD],
7646
+ errorMessage: error,
7647
+ isValid: valid,
7648
+ children: (childProps) => jsx(InputText, {
7649
+ ...childProps,
7650
+ "aria-required": true,
7651
+ "aria-label": label,
7652
+ "aria-invalid": !valid,
7653
+ name: LEGAL_COMPANY_NAME_FIELD,
7654
+ value: data,
7655
+ readonly,
7656
+ classNameModifiers: [LEGAL_COMPANY_NAME_FIELD],
7657
+ onInput: handleLegalCompanyNameInput,
7658
+ onBlur: handleLegalCompanyNameBlur
7659
+ })
7600
7660
  });
7601
7661
  }
7602
7662
  const Disclaimer$1 = "";
@@ -7627,90 +7687,96 @@ const PatriotActDisclosure = () => {
7627
7687
  });
7628
7688
  };
7629
7689
  const companyCountryValidationRules = {
7630
- companyCountry: {
7690
+ country: {
7631
7691
  modes: ["blur"],
7632
7692
  validate: (companyCountry2) => !isEmpty(companyCountry2),
7633
7693
  errorMessage: "fieldIsRequired"
7694
+ },
7695
+ legalCompanyName: {
7696
+ modes: ["blur"],
7697
+ validate: (legalCompanyName2) => !isEmpty(legalCompanyName2),
7698
+ errorMessage: "fieldIsRequired"
7634
7699
  }
7635
7700
  };
7636
- const companyNameAndCountryFields = ["companyCountry", "legalCompanyName"];
7637
- function CompanyNameAndCountryComponent(props) {
7701
+ const companyNameAndCountryFields = [LEGAL_COMPANY_NAME_FIELD, COUNTRY_FIELD];
7702
+ function CompanyNameAndCountry(props) {
7638
7703
  const {
7639
7704
  i18n
7640
7705
  } = useI18nContext();
7641
7706
  const {
7642
7707
  isSettingEnabled
7643
7708
  } = useSettingsContext();
7644
- const COMPANY_NAME_AND_COUNTRY = props.id;
7645
- const schema = ["companyCountry"];
7646
- const stateRef = useRef$1({
7647
- setState: null
7648
- });
7649
- const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
7650
- const requiredFieldsByFlow = companyNameAndCountryFields;
7651
7709
  const {
7652
- handleChangeFor,
7653
- data,
7654
- valid,
7655
- errors,
7656
- isValid,
7657
- fieldProblems
7710
+ id: id2
7711
+ } = props;
7712
+ const {
7713
+ sliceData,
7714
+ updateStateSlice
7715
+ } = useGlobalDataSlice(id2);
7716
+ const {
7717
+ data: formData,
7718
+ valid: formValid,
7719
+ errors: formErrors,
7720
+ fieldProblems: formFieldProblems,
7721
+ handleChangeFor
7658
7722
  } = useForm({
7659
7723
  ...props,
7660
- schema,
7661
- defaultData: props.data,
7662
- rules: props.validators || companyCountryValidationRules,
7724
+ schema: companyNameAndCountryFields,
7725
+ defaultData: props == null ? void 0 : props.data,
7726
+ rules: (props == null ? void 0 : props.validators) || companyCountryValidationRules,
7663
7727
  fieldProblems: props == null ? void 0 : props.fieldValidationErrors
7664
7728
  });
7665
7729
  const formUtils = formUtilities(props, i18n);
7730
+ const isAllowedEditPrefilledCountry = isSettingEnabled(SettingNames.AllowPrefilledCountryEdit);
7666
7731
  useEffect(() => {
7667
- var _a, _b;
7668
- (_b = (_a = stateRef.current).setState) == null ? void 0 : _b.call(_a, {
7669
- type: "addToState",
7670
- value: {
7671
- data,
7672
- valid,
7673
- errors,
7674
- fieldProblems,
7675
- caller: COMPANY_NAME_AND_COUNTRY,
7676
- dataStoreId: COMPANY_NAME_AND_COUNTRY,
7677
- schema: requiredFieldsByFlow
7678
- }
7732
+ updateStateSlice == null ? void 0 : updateStateSlice({
7733
+ data: {
7734
+ ...sliceData,
7735
+ ...formData
7736
+ },
7737
+ errors: formErrors,
7738
+ valid: formValid,
7739
+ fieldProblems: formFieldProblems
7679
7740
  });
7680
- }, [data, valid, errors, isValid]);
7681
- const legalCompanyNameProps = getFieldProps(props, legalCompanyNameFields);
7682
- return jsxs("div", {
7683
- children: [jsx(StateContextSetter, {
7684
- owner: COMPANY_NAME_AND_COUNTRY,
7685
- stateRef
7686
- }), jsx(FormHeader, {
7687
- heading: props.heading
7741
+ }, [formData, formErrors, formFieldProblems, formValid, updateStateSlice]);
7742
+ return jsxs("form", {
7743
+ children: [jsx(FormHeader, {
7744
+ heading: props == null ? void 0 : props.heading
7688
7745
  }), jsx(ErrorPanel, {
7689
7746
  verificationErrors: props == null ? void 0 : props.formVerificationErrors,
7690
7747
  validationErrors: props == null ? void 0 : props.fieldValidationErrors,
7691
7748
  formUtils,
7692
7749
  id: "ariaErrorField"
7693
- }), data.companyCountry === "US" ? jsx(PatriotActDisclosure, {}) : void 0, formUtils.isRequiredField("companyCountry") && jsx(CountryField, {
7694
- label: formUtils.getLabel("companyCountry"),
7750
+ }), formData.country === "US" ? jsx(PatriotActDisclosure, {}) : void 0, formUtils.isRequiredField(COUNTRY_FIELD) && jsx(CountryField, {
7751
+ data: formData.country,
7752
+ valid: formValid.country,
7753
+ error: formUtils.getErrorMessage(COUNTRY_FIELD, formErrors, formFieldProblems),
7754
+ label: formUtils.getLabel(COUNTRY_FIELD),
7755
+ readonly: !isAllowedEditPrefilledCountry || Boolean(props == null ? void 0 : props.disableCountry),
7756
+ classNameModifiers: [COUNTRY_FIELD],
7695
7757
  allowedCountries: [],
7696
- classNameModifiers: ["country"],
7697
- errorMessage: formUtils.getErrorMessage("companyCountry", errors, fieldProblems),
7698
- onDropdownChange: handleChangeFor("companyCountry"),
7699
- value: data.companyCountry,
7700
- readOnly: !isAllowedEditPrefilledCountry || props.disableCountry
7701
- }), formUtils.isRequiredField("legalCompanyName") && jsx(LegalCompanyName, {
7702
- ...legalCompanyNameProps,
7703
- dataStoreId: COMPANY_NAME_AND_COUNTRY,
7704
- country: data.companyCountry
7758
+ handleChangeFor
7759
+ }), formUtils.isRequiredField(LEGAL_COMPANY_NAME_FIELD) && jsx(LegalCompanyNameField, {
7760
+ data: formData.legalCompanyName,
7761
+ country: formData.country,
7762
+ valid: formValid.legalCompanyName,
7763
+ error: formUtils.getErrorMessage(LEGAL_COMPANY_NAME_FIELD, formErrors, formFieldProblems),
7764
+ label: formUtils.getLabel(LEGAL_COMPANY_NAME_FIELD),
7765
+ readonly: formUtils.isReadOnly(LEGAL_COMPANY_NAME_FIELD),
7766
+ handleChangeFor
7705
7767
  })]
7706
7768
  });
7707
7769
  }
7770
+ const CompanyNameAndCountryComponent = memo(CompanyNameAndCountry, (prevProps, nextProps) => {
7771
+ var _a, _b;
7772
+ return objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.optionalFields, nextProps.optionalFields) && objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && ((_a = prevProps.data) == null ? void 0 : _a.country) === ((_b = nextProps.data) == null ? void 0 : _b.country) && prevProps.shouldValidate === nextProps.shouldValidate;
7773
+ });
7708
7774
  const CompanyTypeComponent$1 = "";
7709
7775
  const companyBase = {
7710
7776
  accountHolder: {
7711
7777
  rule: "accountHolderIfCustomer"
7712
7778
  },
7713
- companyCountry: {
7779
+ country: {
7714
7780
  rule: "REQUIRED"
7715
7781
  },
7716
7782
  entityType: {
@@ -8205,16 +8271,13 @@ const countryConfig$4 = {
8205
8271
  label: "irdDocument"
8206
8272
  },
8207
8273
  registrationNumber: {
8208
- label: "companyNumber__NZ"
8274
+ label: "NZBN"
8209
8275
  },
8210
8276
  taxId: {
8211
8277
  label: "IRD"
8212
8278
  },
8213
8279
  exemptedFromVat: {
8214
8280
  label: "vatNumberExempted"
8215
- },
8216
- vatNumber: {
8217
- label: "irdNumber"
8218
8281
  }
8219
8282
  },
8220
8283
  [CountryCodes.Norway]: {
@@ -8537,12 +8600,15 @@ var TaskStatus = /* @__PURE__ */ ((TaskStatus2) => {
8537
8600
  TaskStatus2[TaskStatus2["REMOVING"] = 9] = "REMOVING";
8538
8601
  return TaskStatus2;
8539
8602
  })(TaskStatus || {});
8540
- const SOLE_PROP_COUNTRIES = [CountryCodes.Austria, CountryCodes.Australia, CountryCodes.Belgium, CountryCodes.Bulgaria, CountryCodes.Canada, CountryCodes.Croatia, CountryCodes.Cyprus, CountryCodes.CzechRepublic, CountryCodes.Denmark, CountryCodes.Estonia, CountryCodes.Finland, CountryCodes.France, CountryCodes.Germany, CountryCodes.Gibraltar, CountryCodes.Greece, CountryCodes.Guernsey, CountryCodes.HongKong, CountryCodes.Hungary, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Italy, CountryCodes.Jersey, CountryCodes.Latvia, CountryCodes.Liechtenstein, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Malta, CountryCodes.Monaco, CountryCodes.Netherlands, CountryCodes.Norway, CountryCodes.Poland, CountryCodes.Portugal, CountryCodes.PuertoRico, CountryCodes.Romania, CountryCodes.Singapore, CountryCodes.Slovakia, CountryCodes.Slovenia, CountryCodes.Spain, CountryCodes.Sweden, CountryCodes.Switzerland, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
8603
+ const SOLE_PROP_COUNTRIES = [CountryCodes.Austria, CountryCodes.Australia, CountryCodes.Belgium, CountryCodes.Bulgaria, CountryCodes.Canada, CountryCodes.Croatia, CountryCodes.Cyprus, CountryCodes.CzechRepublic, CountryCodes.Denmark, CountryCodes.Estonia, CountryCodes.Finland, CountryCodes.France, CountryCodes.Germany, CountryCodes.Gibraltar, CountryCodes.Greece, CountryCodes.Guernsey, CountryCodes.HongKong, CountryCodes.Hungary, CountryCodes.Ireland, CountryCodes.IsleOfMan, CountryCodes.Italy, CountryCodes.Jersey, CountryCodes.Latvia, CountryCodes.Liechtenstein, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Malta, CountryCodes.Monaco, CountryCodes.Netherlands, CountryCodes.NewZealand, CountryCodes.Norway, CountryCodes.Poland, CountryCodes.Portugal, CountryCodes.PuertoRico, CountryCodes.Romania, CountryCodes.Singapore, CountryCodes.Slovakia, CountryCodes.Slovenia, CountryCodes.Spain, CountryCodes.Sweden, CountryCodes.Switzerland, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
8541
8604
  const ID_NUMBER_EXEMPT_COUNTRIES = [CountryCodes.Canada, CountryCodes.UnitedStates];
8542
8605
  const ID_NUMBER_VERIFICATION_COUNTRIES = [CountryCodes.UnitedStates];
8543
8606
  const COUNTRIES_WHICH_USE_MULTIPLE_IDENTITY_TYPES = [CountryCodes.HongKong, CountryCodes.Australia];
8544
- const ID_NUMBER_REQUIRED_FOR_DIRECTOR_COUNTRIES = [CountryCodes.Singapore];
8607
+ const ID_NUMBER_REQUIRED_FOR_DIRECTOR_COUNTRIES = [CountryCodes.Singapore, CountryCodes.NewZealand];
8545
8608
  const NATIONALITY_REQUIRED_FOR_COUNTRIES = [CountryCodes.Singapore];
8609
+ const CONTACTS_REQUIRED_FOR_COUNTRIES = [CountryCodes.NewZealand];
8610
+ const JOB_TITLE_REQUIRED_FOR_COUNTRIES = [CountryCodes.NewZealand];
8611
+ const ISSUER_REQUIRED_FOR_COUNTRIES = [CountryCodes.Australia];
8546
8612
  const rules$2 = ({
8547
8613
  data,
8548
8614
  country: country2,
@@ -8584,19 +8650,25 @@ const rules$2 = ({
8584
8650
  }
8585
8651
  },
8586
8652
  contactsIfRequiredForRole: () => {
8587
- var _a, _b, _c;
8653
+ var _a, _b, _c, _d;
8588
8654
  if (!((_a = data.personalDetails) == null ? void 0 : _a.role)) {
8589
8655
  return "REQUIRED";
8590
8656
  }
8591
8657
  if ((_c = (_b = data.personalDetails) == null ? void 0 : _b.role) == null ? void 0 : _c.includes(DecisionMakerType.SIGNATORY)) {
8592
8658
  return "REQUIRED";
8593
8659
  }
8660
+ if (CONTACTS_REQUIRED_FOR_COUNTRIES.includes((_d = data.personalDetails) == null ? void 0 : _d.residencyCountry)) {
8661
+ return "REQUIRED";
8662
+ }
8594
8663
  },
8595
8664
  jobTitleIfRequiredForRole: () => {
8596
8665
  var _a, _b;
8597
8666
  if ((_b = (_a = data.personalDetails) == null ? void 0 : _a.role) == null ? void 0 : _b.some((role2) => role2 === DecisionMakerType.SIGNATORY || role2 === DecisionMakerType.CONTROLLING_PERSON)) {
8598
8667
  return "REQUIRED";
8599
8668
  }
8669
+ if (JOB_TITLE_REQUIRED_FOR_COUNTRIES.includes(country2)) {
8670
+ return "REQUIRED";
8671
+ }
8600
8672
  },
8601
8673
  nationalityIfRequiredForRole: () => {
8602
8674
  var _a;
@@ -8620,6 +8692,12 @@ const rules$2 = ({
8620
8692
  return "REQUIRED";
8621
8693
  }
8622
8694
  },
8695
+ issuerStateRequired: () => {
8696
+ var _a;
8697
+ if (((_a = data.personalDetails) == null ? void 0 : _a.typeOfIdentity) === "driversLicense" && ISSUER_REQUIRED_FOR_COUNTRIES.includes(country2)) {
8698
+ return "REQUIRED";
8699
+ }
8700
+ },
8623
8701
  isVerificationAllowedForCountry: () => ID_NUMBER_VERIFICATION_COUNTRIES.includes(country2)
8624
8702
  });
8625
8703
  const accountHolderValidationRules = {
@@ -9589,7 +9667,7 @@ function ListItem({
9589
9667
  const Address$1 = "";
9590
9668
  const ADDRESS_SCHEMA = ["street", "houseNumberOrName", "postalCode", "city", "stateOrProvince", "country"];
9591
9669
  const [STREET, HOUSE_NUMBER, POSTAL_CODE, CITY, STATE, COUNTRY] = ADDRESS_SCHEMA;
9592
- const COUNTRIES_WITH_STATES_DATASET = [CountryCodes.Australia, CountryCodes.Brazil, CountryCodes.Canada, CountryCodes.UnitedStates];
9670
+ const COUNTRIES_WITH_STATES_DATASET = [CountryCodes.Australia, CountryCodes.Brazil, CountryCodes.Canada, CountryCodes.NewZealand, CountryCodes.UnitedStates];
9593
9671
  const COUNTRIES_WITH_OPTIONAL_HOUSE_NUMBER = [CountryCodes.Canada, CountryCodes.UnitedKingdom, CountryCodes.UnitedStates];
9594
9672
  const ADDRESS_SCHEMAS = {
9595
9673
  [CountryCodes.Australia]: [COUNTRY, STREET, HOUSE_NUMBER, CITY, STATE, POSTAL_CODE],
@@ -9622,6 +9700,7 @@ const LABELS = {
9622
9700
  [CountryCodes.Australia]: "state",
9623
9701
  [CountryCodes.Brazil]: "state",
9624
9702
  [CountryCodes.Canada]: "provinceOrTerritory",
9703
+ [CountryCodes.NewZealand]: "region",
9625
9704
  [CountryCodes.UnitedStates]: "state"
9626
9705
  },
9627
9706
  stateOrProvincePlaceholder: {
@@ -9668,15 +9747,17 @@ const mapAddressLabels = (data, datasetUtils) => {
9668
9747
  }
9669
9748
  return data;
9670
9749
  };
9671
- function StateField(props) {
9672
- const {
9673
- classNameModifiers,
9674
- selectedCountry,
9675
- onDropdownChange,
9676
- value,
9677
- readOnly,
9678
- errorMessage
9679
- } = props;
9750
+ const STATE_FIELD = "stateOrProvince";
9751
+ function StateField({
9752
+ data,
9753
+ valid,
9754
+ error,
9755
+ label,
9756
+ readonly,
9757
+ handleChangeFor,
9758
+ selectedCountry,
9759
+ classNameModifiers = []
9760
+ }) {
9680
9761
  const {
9681
9762
  i18n
9682
9763
  } = useI18nContext();
@@ -9684,24 +9765,30 @@ function StateField(props) {
9684
9765
  dataset: states,
9685
9766
  loaded
9686
9767
  } = useDataset(datasetIdentifier.state(selectedCountry), !selectedCountry || !COUNTRIES_WITH_STATES_DATASET.includes(selectedCountry));
9687
- const labelKey = getKeyForField("stateOrProvince", selectedCountry);
9768
+ const handleStateChangeFor = useCallback((e) => {
9769
+ const {
9770
+ value
9771
+ } = e.target;
9772
+ handleChangeFor(STATE_FIELD)(value);
9773
+ }, [handleChangeFor]);
9774
+ const labelKey = getKeyForField(STATE_FIELD, selectedCountry);
9688
9775
  const placeholderKey = getKeyForField("stateOrProvincePlaceholder", selectedCountry);
9689
9776
  if (!loaded || !states.length)
9690
9777
  return null;
9691
9778
  return jsx(Field, {
9692
- name: "stateOrProvince",
9693
- label: i18n.get(labelKey),
9779
+ name: STATE_FIELD,
9780
+ label: label || i18n.get(labelKey),
9694
9781
  classNameModifiers,
9695
- errorMessage,
9696
- isValid: !!value,
9782
+ errorMessage: error,
9783
+ isValid: valid,
9697
9784
  children: (childProps) => jsx(Select, {
9698
9785
  ...childProps,
9699
- name: "stateOrProvince",
9700
- onChange: onDropdownChange,
9701
- selected: value,
9786
+ name: STATE_FIELD,
9787
+ selected: data,
9702
9788
  placeholder: i18n.get(placeholderKey),
9703
9789
  items: states,
9704
- readonly: readOnly && !!value
9790
+ readonly: readonly && !!data,
9791
+ onChange: handleStateChangeFor
9705
9792
  })
9706
9793
  });
9707
9794
  }
@@ -9716,13 +9803,11 @@ function FieldContainer(props) {
9716
9803
  errors,
9717
9804
  fieldProblems,
9718
9805
  fieldName,
9719
- onInput,
9720
- onBlur,
9721
9806
  trimOnBlur,
9722
9807
  allowedCountries,
9723
- onDropdownChange,
9724
9808
  hideField,
9725
- maxlength
9809
+ maxlength,
9810
+ handleChangeFor
9726
9811
  } = props;
9727
9812
  const formUtils = formUtilities(props, i18n);
9728
9813
  const errorMessage = formUtils.getErrorMessage(fieldName, errors, fieldProblems);
@@ -9732,20 +9817,26 @@ function FieldContainer(props) {
9732
9817
  switch (field) {
9733
9818
  case "country":
9734
9819
  return jsx(CountryField, {
9820
+ data: value,
9821
+ valid: valid == null ? void 0 : valid.country,
9822
+ error: errorMessage,
9823
+ label: formUtils.getLabel(field),
9824
+ readonly: formUtils.isReadOnly(field),
9735
9825
  classNameModifiers,
9736
9826
  allowedCountries,
9737
- errorMessage,
9738
- onDropdownChange,
9739
- value,
9740
- className: hideField ? "adl-u-display-none" : ""
9827
+ className: hideField ? "adl-u-display-none" : "",
9828
+ handleChangeFor
9741
9829
  });
9742
9830
  case "stateOrProvince":
9743
9831
  return jsx(StateField, {
9832
+ data: value,
9833
+ valid: valid == null ? void 0 : valid.stateOrProvince,
9834
+ error: errorMessage,
9835
+ label: formUtils.getLabel(field),
9836
+ readonly: formUtils.isReadOnly(field),
9744
9837
  classNameModifiers,
9745
9838
  selectedCountry: data.country,
9746
- errorMessage,
9747
- onDropdownChange,
9748
- value
9839
+ handleChangeFor
9749
9840
  });
9750
9841
  default:
9751
9842
  return jsx(Field, {
@@ -9759,8 +9850,8 @@ function FieldContainer(props) {
9759
9850
  classNameModifiers,
9760
9851
  name: field,
9761
9852
  value: field === "postalCode" ? value == null ? void 0 : value.toUpperCase() : value,
9762
- onInput,
9763
- onBlur,
9853
+ onInput: handleChangeFor(fieldName, "input"),
9854
+ onBlur: handleChangeFor(fieldName, "blur"),
9764
9855
  maxLength: maxlength,
9765
9856
  "aria-required": true,
9766
9857
  "aria-label": props == null ? void 0 : props["aria-label"],
@@ -10442,9 +10533,7 @@ function Address(props) {
10442
10533
  errors,
10443
10534
  fieldProblems,
10444
10535
  fieldName,
10445
- onInput: handleChangeFor(fieldName, "input"),
10446
- onBlur: handleChangeFor(fieldName, "blur"),
10447
- onDropdownChange: handleChangeFor(fieldName, "blur"),
10536
+ handleChangeFor,
10448
10537
  maxlength: getMaxLengthByFieldAndCountry(countrySpecificFormatters, fieldName, data.country, true),
10449
10538
  hideField,
10450
10539
  "aria-label": formUtils.getLabel(fieldName, fieldName),
@@ -10741,8 +10830,8 @@ function CompanyComponent(props) {
10741
10830
  var _a, _b, _c, _d, _e, _f, _g, _h;
10742
10831
  const companyType2 = (_b = (_a = currentState.data) == null ? void 0 : _a[CompanyTypeFormID]) == null ? void 0 : _b.entityType;
10743
10832
  setCurrentCompanyType(companyType2);
10744
- const companyCountryPrev = (_d = (_c = prevState.data) == null ? void 0 : _c[CompanyNameAndCountryFormID]) == null ? void 0 : _d.companyCountry;
10745
- const companyCountry2 = (_f = (_e = currentState.data) == null ? void 0 : _e[CompanyNameAndCountryFormID]) == null ? void 0 : _f.companyCountry;
10833
+ const companyCountryPrev = (_d = (_c = prevState.data) == null ? void 0 : _c[CompanyNameAndCountryFormID]) == null ? void 0 : _d.country;
10834
+ const companyCountry2 = (_f = (_e = currentState.data) == null ? void 0 : _e[CompanyNameAndCountryFormID]) == null ? void 0 : _f.country;
10746
10835
  const accountHolder2 = (_h = (_g = currentState.data) == null ? void 0 : _g[CompanyTypeFormID]) == null ? void 0 : _h.accountHolder;
10747
10836
  if (companyCountry2 != null && companyCountry2 !== companyCountryPrev) {
10748
10837
  props.onCountryChange(companyCountry2);
@@ -10761,8 +10850,8 @@ function CompanyComponent(props) {
10761
10850
  children: jsx(CompanyNameAndCountryComponent, {
10762
10851
  ...companyNameAndCountryFormProps,
10763
10852
  data: {
10764
- ...companyNameAndCountryFormProps == null ? void 0 : companyNameAndCountryFormProps.data,
10765
- companyCountry: props.country
10853
+ ...companyNameAndCountryFormProps.data,
10854
+ country: props.country
10766
10855
  },
10767
10856
  heading: i18n.get("nameAndCountry"),
10768
10857
  id: CompanyNameAndCountryFormID
@@ -10794,7 +10883,7 @@ function CompanyComponent(props) {
10794
10883
  }),
10795
10884
  id: CompanyRegistrationAddressFormID,
10796
10885
  country: props.country,
10797
- problems: props == null ? void 0 : props.problems,
10886
+ problems: props.problems,
10798
10887
  handleAddressSearch: props.handleAddressSearch,
10799
10888
  handleFindAddress: props.handleFindAddress
10800
10889
  })
@@ -11046,6 +11135,7 @@ const COUNTRIES_THAT_DONT_REQUIRE_SOLE_PROP_REGISTRATION = [CountryCodes.Austral
11046
11135
  const COUNTRIES_THAT_DONT_REQUIRE_COMPANY_REGISTRATION = [CountryCodes.Singapore, CountryCodes.UnitedStates];
11047
11136
  const COUNTRIES_WITH_POSSIBLE_REGISTRATION_EXEMPTIONS_FOR_SOLE_PROPS = [CountryCodes.Austria, CountryCodes.Canada, CountryCodes.Finland, CountryCodes.Germany, CountryCodes.Lithuania, CountryCodes.Luxembourg, CountryCodes.Poland, CountryCodes.Sweden, CountryCodes.Switzerland];
11048
11137
  const COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT = [CountryCodes.Australia, CountryCodes.Canada, CountryCodes.Gibraltar, CountryCodes.HongKong, CountryCodes.NewZealand, CountryCodes.PuertoRico, CountryCodes.Singapore, CountryCodes.UnitedStates];
11138
+ const COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP = [CountryCodes.NewZealand, CountryCodes.Singapore];
11049
11139
  const COUNTRIES_WITH_POSSIBLE_TAX_EXEMPTION_FOR_COMPANIES = [
11050
11140
  // strictly a subset of countries which use tax ID
11051
11141
  // right now in all countries companies must provide a tax ID - but maybe there will be exemptions in future?
@@ -11080,7 +11170,7 @@ const rules$1 = ({
11080
11170
  }
11081
11171
  },
11082
11172
  countryUsesTaxId: () => {
11083
- if (COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country2) && !("solePropNameAndCountry" in data && country2 === "SG")) {
11173
+ if (COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(country2) && !("solePropNameAndCountry" in data && COUNTRIES_THAT_DO_NOT_USE_TAX_ID_FOR_SOLE_PROP.includes(country2))) {
11084
11174
  return "REQUIRED";
11085
11175
  }
11086
11176
  },
@@ -11657,8 +11747,8 @@ const mandatoryApiFields = {
11657
11747
  INDIVIDUAL: ["personalDetails.firstName", "personalDetails.lastName", "personalDetails.residencyCountry"],
11658
11748
  DECISIONMAKER: ["personalDetails.firstName", "personalDetails.lastName", "personalDetails.residencyCountry", "personalDetails.role", "personalDetails.jobTitle"],
11659
11749
  DECISION_MAKER_OWNER: ["personalDetails.firstName", "personalDetails.lastName", "personalDetails.residencyCountry", "personalDetails.role"],
11660
- ORGANIZATION: ["companyNameAndCountry.legalCompanyName", "companyNameAndCountry.companyCountry"],
11661
- SOLE_PROPRIETORSHIP: ["solePropNameAndCountry.legalCompanyName", "solePropNameAndCountry.companyCountry"],
11750
+ ORGANIZATION: ["companyNameAndCountry.legalCompanyName", "companyNameAndCountry.country"],
11751
+ SOLE_PROPRIETORSHIP: ["solePropNameAndCountry.legalCompanyName", "solePropNameAndCountry.country"],
11662
11752
  TRUST: ["trustRegistrationDetails.legalName", "trustRegistrationDetails.country"]
11663
11753
  };
11664
11754
  const individualMaskedFields = ["personalDetails.idNumber", "personalDetails.idNumberExempt"];
@@ -11674,6 +11764,7 @@ const individualBaseMapping = {
11674
11764
  "personalDetails.issuerState": "individual.identificationData.issuerState",
11675
11765
  "personalDetails.licenseCardNumber": "individual.identificationData.cardNumber",
11676
11766
  "personalDetails.nationality": "individual.nationality",
11767
+ "personalDetails.jobTitle": "individual.jobTitle",
11677
11768
  "address.city": "individual.residentialAddress.city",
11678
11769
  "address.country": "individual.residentialAddress.country",
11679
11770
  "address.postalCode": "individual.residentialAddress.postalCode",
@@ -11704,6 +11795,7 @@ const payoutBaseMapping = {
11704
11795
  "payoutAccountDetails.iban": "bankAccount.iban"
11705
11796
  };
11706
11797
  const companyBaseMapping = {
11798
+ "companyNameAndCountry.country": "organization.registeredAddress.country",
11707
11799
  "companyNameAndCountry.legalCompanyName": "organization.legalName",
11708
11800
  "companyType.entityType": "organization.type",
11709
11801
  "companyDetails.tradingName": "organization.doingBusinessAs",
@@ -11745,8 +11837,8 @@ const trustBaseMapping = {
11745
11837
  "trustRegistrationAddress.operationalAddress.houseNumberOrName": "trust.principalPlaceOfBusiness.street2"
11746
11838
  };
11747
11839
  const solePropBaseMapping = {
11840
+ "solePropNameAndCountry.country": "soleProprietorship.countryOfGoverningLaw",
11748
11841
  "solePropNameAndCountry.legalCompanyName": "soleProprietorship.name",
11749
- "solePropNameAndCountry.companyCountry": "soleProprietorship.countryOfGoverningLaw",
11750
11842
  "solePropRegistrationDetails.tradingName": "soleProprietorship.doingBusinessAs",
11751
11843
  "solePropRegistrationDetails.vatNumber": "soleProprietorship.vatNumber",
11752
11844
  "solePropRegistrationDetails.vatAbsenceReason": "soleProprietorship.vatAbsenceReason",
@@ -11766,7 +11858,6 @@ const solePropBaseMapping = {
11766
11858
  "solePropRegistrationAddress.operationalAddress.houseNumberOrName": "soleProprietorship.principalPlaceOfBusiness.street2"
11767
11859
  };
11768
11860
  const companyComponentsKeyMapping = {
11769
- "companyNameAndCountry.companyCountry": "organization.registeredAddress.country",
11770
11861
  "companyDetails.exemptedFromVat": "organization.vatAbsenceReason",
11771
11862
  ...companyBaseMapping
11772
11863
  };
@@ -11819,49 +11910,85 @@ const remediationSolePropKeyMapping = {
11819
11910
  ...solePropApiKeyMapping,
11820
11911
  [DocumentType.CONSTITUTIONAL_DOCUMENT]: "solePropConstitutionalDocument.constitutionalDocument"
11821
11912
  };
11822
- const mapIndividualToLegalEntity = (data) => {
11823
- var _a;
11824
- const requestObj = {
11825
- ...formatObject(data, individualApiKeyMapping)
11826
- };
11827
- requestObj.type = LegalEntityType.INDIVIDUAL;
11828
- requestObj.individual.identificationData = adjustIdentificationData(data.personalDetails, requestObj.individual.identificationData);
11829
- if ((_a = requestObj.individual.phone) == null ? void 0 : _a.number) {
11830
- requestObj.individual.phone.type = "mobile";
11831
- } else {
11832
- delete requestObj.individual.phone;
11913
+ const legalEntityDocumentToFieldMapping = {
11914
+ [LegalEntityType.INDIVIDUAL]: {
11915
+ [DocumentType.PASSPORT]: "idDocument.idDocument",
11916
+ [DocumentType.PROOF_OF_RESIDENCY]: "proofOfResidence.proofOfResidence",
11917
+ [DocumentType.PROOF_OF_NATIONAL_ID_NUMBER]: "proofOfNationalId.proofOfNationalId"
11918
+ },
11919
+ [LegalEntityType.ORGANIZATION]: {
11920
+ [DocumentType.REGISTRATION_DOCUMENT]: "companyRegistrationDocument.registrationDocument",
11921
+ [DocumentType.VAT_DOCUMENT]: "companyTaxDocument.taxDocument"
11922
+ },
11923
+ [LegalEntityType.SOLE_PROPRIETORSHIP]: {
11924
+ [DocumentType.CONSTITUTIONAL_DOCUMENT]: "solePropConstitutionalDocument.constitutionalDocument"
11925
+ },
11926
+ [LegalEntityType.TRUST]: {
11927
+ [DocumentType.CONSTITUTIONAL_DOCUMENT]: "trustConstitutionalDocument.constitutionalDocument"
11833
11928
  }
11834
- return requestObj;
11835
- };
11836
- const identityTypeToApiIdentityTypeMap = {
11837
- nationalIdNumber: "nationalIdNumber",
11838
- passport: "passport",
11839
- driversLicense: "driversLicense",
11840
- proofOfIdentityCard: "identityCard"
11841
11929
  };
11842
- const apiIdentityTypeToIdentityTypeMap = reverseObject(identityTypeToApiIdentityTypeMap);
11843
- const adjustIdentificationData = (data, apiData) => {
11844
- if (data.idNumber === void 0 && data.idNumberExempt === void 0)
11845
- return void 0;
11846
- return {
11847
- ...apiData,
11848
- number: stripCountryIdFormat(data.idNumber, data.residencyCountry),
11849
- nationalIdExempt: apiData.nationalIdExempt ?? !data.idNumber,
11850
- type: identityTypeToApiIdentityTypeMap[data.typeOfIdentity] ?? "nationalIdNumber"
11851
- };
11852
- };
11853
- const mapTransferInstrumentToPayoutAccount = (transferInstrument) => formatObject(transferInstrument, payoutComponentKeyMapping);
11854
- const mapPayoutAccountToTransferInstrument = ({
11855
- data,
11856
- legalEntity
11857
- }) => {
11930
+ function getProp(object, path) {
11931
+ const splitPath = path.split(".");
11932
+ const reducer2 = (xs, x) => xs && xs[x] !== void 0 ? xs[x] : void 0;
11933
+ return splitPath.reduce(reducer2, object);
11934
+ }
11935
+ function assignToProp(path, obj, val) {
11936
+ const splitPath = path.split(".");
11937
+ const pathDepth = splitPath.length;
11938
+ let currentObj = obj;
11939
+ splitPath.forEach((key, index) => {
11940
+ if (index === pathDepth - 1) {
11941
+ currentObj[key] = val;
11942
+ } else {
11943
+ if (!currentObj[key]) {
11944
+ currentObj[key] = {};
11945
+ }
11946
+ currentObj = currentObj[key];
11947
+ }
11948
+ });
11949
+ }
11950
+ const formatObject = (obj, mapping) => {
11951
+ if (obj) {
11952
+ const formattedObj = {};
11953
+ Object.entries(mapping).forEach(([targetKey, sourceKey]) => {
11954
+ const value = getProp(obj, sourceKey);
11955
+ if (value !== void 0) {
11956
+ assignToProp(targetKey, formattedObj, value);
11957
+ }
11958
+ });
11959
+ return formattedObj;
11960
+ }
11961
+ return null;
11962
+ };
11963
+ const identityTypeToApiIdentityTypeMap = {
11964
+ nationalIdNumber: "nationalIdNumber",
11965
+ passport: "passport",
11966
+ driversLicense: "driversLicense",
11967
+ proofOfIdentityCard: "identityCard"
11968
+ };
11969
+ const apiIdentityTypeToIdentityTypeMap = reverseObject(identityTypeToApiIdentityTypeMap);
11970
+ const adjustIdentificationData = (data, apiData) => {
11971
+ if (data.idNumber === void 0 && data.idNumberExempt === void 0)
11972
+ return void 0;
11973
+ return {
11974
+ ...apiData,
11975
+ number: stripCountryIdFormat(data.idNumber, data.residencyCountry),
11976
+ nationalIdExempt: apiData.nationalIdExempt ?? !data.idNumber,
11977
+ type: identityTypeToApiIdentityTypeMap[data.typeOfIdentity] ?? "nationalIdNumber"
11978
+ };
11979
+ };
11980
+ const mapTransferInstrumentToPayoutAccount = (transferInstrument) => formatObject(transferInstrument, payoutComponentKeyMapping);
11981
+ const mapPayoutAccountToTransferInstrument = ({
11982
+ data,
11983
+ legalEntity
11984
+ }) => {
11858
11985
  const payoutAccountData = formatObject(data, payoutApiKeyMapping);
11859
11986
  payoutAccountData.legalEntityId = legalEntity.id;
11860
11987
  payoutAccountData.type = TransferInstrumentType.BANK_ACCOUNT;
11861
11988
  return payoutAccountData;
11862
11989
  };
11863
11990
  const mapLegalEntityToIndividual = (legalEntity, isChangingType) => {
11864
- var _a, _b;
11991
+ var _a, _b, _c;
11865
11992
  let individualData = formatObject(legalEntity, individualComponentsKeyMapping);
11866
11993
  individualData = {
11867
11994
  ...individualData,
@@ -11877,10 +12004,30 @@ const mapLegalEntityToIndividual = (legalEntity, isChangingType) => {
11877
12004
  if ((_b = (_a = legalEntity == null ? void 0 : legalEntity.individual) == null ? void 0 : _a.identificationData) == null ? void 0 : _b.type) {
11878
12005
  individualData.personalDetails.typeOfIdentity = apiIdentityTypeToIdentityTypeMap[legalEntity.individual.identificationData.type];
11879
12006
  }
12007
+ if ((_c = legalEntity == null ? void 0 : legalEntity.documentDetails) == null ? void 0 : _c.length) {
12008
+ individualData = {
12009
+ ...individualData,
12010
+ ...mapApiDocumentToIndividualDocuments(legalEntity == null ? void 0 : legalEntity.id)
12011
+ };
12012
+ }
11880
12013
  return individualData;
11881
12014
  };
12015
+ const mapIndividualToLegalEntity = (data) => {
12016
+ var _a;
12017
+ const requestObj = {
12018
+ ...formatObject(data, individualApiKeyMapping)
12019
+ };
12020
+ requestObj.type = LegalEntityType.INDIVIDUAL;
12021
+ requestObj.individual.identificationData = adjustIdentificationData(data.personalDetails, requestObj.individual.identificationData);
12022
+ if ((_a = requestObj.individual.phone) == null ? void 0 : _a.number) {
12023
+ requestObj.individual.phone.type = "mobile";
12024
+ } else {
12025
+ delete requestObj.individual.phone;
12026
+ }
12027
+ return requestObj;
12028
+ };
11882
12029
  const mapLegalEntityToCompany = (legalEntity, isChangingType) => {
11883
- var _a, _b, _c;
12030
+ var _a, _b, _c, _d;
11884
12031
  let companyCompData;
11885
12032
  if (legalEntity == null ? void 0 : legalEntity.organization) {
11886
12033
  companyCompData = formatObject(legalEntity, companyComponentsKeyMapping);
@@ -11908,6 +12055,12 @@ const mapLegalEntityToCompany = (legalEntity, isChangingType) => {
11908
12055
  companyCompData.companyDetails.exemptedFromTax = false;
11909
12056
  companyCompData.companyDetails.uenOrGst = countryTaxInformation == null ? void 0 : countryTaxInformation.type;
11910
12057
  }
12058
+ if ((_d = legalEntity == null ? void 0 : legalEntity.documentDetails) == null ? void 0 : _d.length) {
12059
+ companyCompData = {
12060
+ ...companyCompData,
12061
+ ...mapApiDocumentToCompanyDocuments(legalEntity == null ? void 0 : legalEntity.id)
12062
+ };
12063
+ }
11911
12064
  }
11912
12065
  companyCompData = {
11913
12066
  ...companyCompData,
@@ -11928,13 +12081,120 @@ const mapCompanyToLegalEntity = (data) => {
11928
12081
  if (data.companyDetails.taxId) {
11929
12082
  requestObj.organization = updateTaxInformation({
11930
12083
  taxId: data.companyDetails.taxId,
11931
- country: data.companyNameAndCountry.companyCountry,
12084
+ country: data.companyNameAndCountry.country,
11932
12085
  entity: requestObj.organization
11933
12086
  });
11934
12087
  }
11935
12088
  requestObj.type = LegalEntityType.ORGANIZATION;
11936
12089
  return requestObj;
11937
12090
  };
12091
+ const mapLegalEntityToTrust = (legalEntity) => {
12092
+ var _a, _b, _c;
12093
+ let trustCompData;
12094
+ if (legalEntity == null ? void 0 : legalEntity.trust) {
12095
+ trustCompData = formatObject(legalEntity, trustComponentsKeyMapping);
12096
+ if ((_a = legalEntity.trust) == null ? void 0 : _a.principalPlaceOfBusiness) {
12097
+ trustCompData.trustRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME;
12098
+ } else {
12099
+ if (!trustCompData.trustRegistrationAddress) {
12100
+ trustCompData.trustRegistrationAddress = {};
12101
+ }
12102
+ trustCompData.trustRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
12103
+ }
12104
+ const {
12105
+ taxInformation = []
12106
+ } = legalEntity.trust;
12107
+ if (taxInformation.length) {
12108
+ const {
12109
+ country: country2
12110
+ } = legalEntity.trust.registeredAddress;
12111
+ trustCompData.trustRegistrationDetails.taxId = (_b = taxInformation.find((info) => info.country === country2)) == null ? void 0 : _b.number;
12112
+ trustCompData.trustRegistrationDetails.exemptedFromTax = false;
12113
+ }
12114
+ if ((_c = legalEntity == null ? void 0 : legalEntity.documentDetails) == null ? void 0 : _c.length) {
12115
+ trustCompData = {
12116
+ ...trustCompData,
12117
+ ...mapApiDocumentToTrustDocument(legalEntity == null ? void 0 : legalEntity.id)
12118
+ };
12119
+ }
12120
+ }
12121
+ return trustCompData;
12122
+ };
12123
+ const mapTrustToLegalEntity = (data) => {
12124
+ const requestObj = {
12125
+ ...formatObject(data, trustApiKeyMapping)
12126
+ };
12127
+ if (data.trustRegistrationDetails.taxId) {
12128
+ requestObj.trust = updateTaxInformation({
12129
+ taxId: data.trustRegistrationDetails.taxId,
12130
+ country: data.trustRegistrationDetails.country,
12131
+ entity: requestObj.trust
12132
+ });
12133
+ }
12134
+ requestObj.type = LegalEntityType.TRUST;
12135
+ return requestObj;
12136
+ };
12137
+ const mapLegalEntityToSoleProp = (legalEntity) => {
12138
+ var _a, _b, _c, _d, _e;
12139
+ let solePropCompData;
12140
+ if (legalEntity == null ? void 0 : legalEntity.soleProprietorship) {
12141
+ solePropCompData = formatObject(legalEntity, solePropComponentsKeyMapping);
12142
+ if ((_a = legalEntity.soleProprietorship) == null ? void 0 : _a.principalPlaceOfBusiness) {
12143
+ solePropCompData.solePropRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME;
12144
+ } else {
12145
+ if (!solePropCompData.solePropRegistrationAddress) {
12146
+ solePropCompData.solePropRegistrationAddress = {};
12147
+ }
12148
+ solePropCompData.solePropRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
12149
+ }
12150
+ solePropCompData.solePropRegistrationDetails = {
12151
+ ...solePropCompData.solePropRegistrationDetails,
12152
+ sameNameAsLegalName: !(((_b = solePropCompData.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName) && ((_c = solePropCompData.solePropRegistrationDetails) == null ? void 0 : _c.tradingName) && solePropCompData.solePropNameAndCountry.legalCompanyName !== solePropCompData.solePropRegistrationDetails.tradingName)
12153
+ };
12154
+ const {
12155
+ taxInformation = []
12156
+ } = legalEntity.soleProprietorship;
12157
+ if (taxInformation.length) {
12158
+ const {
12159
+ country: country2
12160
+ } = legalEntity.soleProprietorship.registeredAddress;
12161
+ solePropCompData.solePropRegistrationDetails.taxId = (_d = taxInformation.find((info) => info.country === country2)) == null ? void 0 : _d.number;
12162
+ solePropCompData.solePropRegistrationDetails.exemptedFromTax = false;
12163
+ }
12164
+ if ((_e = legalEntity == null ? void 0 : legalEntity.documentDetails) == null ? void 0 : _e.length) {
12165
+ solePropCompData = {
12166
+ ...solePropCompData,
12167
+ ...mapApiDocumentToSolePropDocuments(legalEntity == null ? void 0 : legalEntity.id)
12168
+ };
12169
+ }
12170
+ }
12171
+ return solePropCompData;
12172
+ };
12173
+ const mapSolePropToLegalEntity = (data) => {
12174
+ const requestObj = {
12175
+ ...formatObject(data, solePropApiKeyMapping)
12176
+ };
12177
+ if (requestObj.soleProprietorship.vatAbsenceReason) {
12178
+ requestObj.soleProprietorship.vatNumber = "";
12179
+ }
12180
+ if (data.solePropRegistrationDetails.taxId || requestObj.soleProprietorship.taxAbsent) {
12181
+ requestObj.soleProprietorship = updateTaxInformation({
12182
+ taxId: data.solePropRegistrationDetails.taxId,
12183
+ exemptedFromTax: data.solePropRegistrationDetails.exemptedFromTax,
12184
+ country: data.solePropNameAndCountry.country,
12185
+ entity: requestObj.soleProprietorship
12186
+ });
12187
+ }
12188
+ if (data.solePropRegistrationDetails.exemptedFromRegistrationNumber) {
12189
+ requestObj.soleProprietorship.registrationNumber = "";
12190
+ }
12191
+ requestObj.type = LegalEntityType.SOLE_PROPRIETORSHIP;
12192
+ return requestObj;
12193
+ };
12194
+ const getPageName = (document2, pageIndex = 0) => {
12195
+ var _a;
12196
+ return ((_a = document2 == null ? void 0 : document2.attachments) == null ? void 0 : _a[pageIndex].pageName) || null;
12197
+ };
11938
12198
  const mapIndividualDocumentToApiDocument = async (data, entityId) => {
11939
12199
  var _a, _b, _c, _d;
11940
12200
  if (data) {
@@ -12000,7 +12260,7 @@ const mapCompanyDocumentToApiDocument = async (data, entityId) => {
12000
12260
  }
12001
12261
  } = data;
12002
12262
  const entityType2 = "legalEntity";
12003
- const taxDocumentType = COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(data.companyNameAndCountry.companyCountry) ? DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO : DocumentType.VAT_DOCUMENT;
12263
+ const taxDocumentType = COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(data.companyNameAndCountry.country) ? DocumentType.PROOF_OF_ORGANIZATION_TAX_INFO : DocumentType.VAT_DOCUMENT;
12004
12264
  const documents2 = await Promise.all([
12005
12265
  createDocumentRequest({
12006
12266
  entityId,
@@ -12035,13 +12295,48 @@ const mapApiDocumentToCompanyDocuments = (entityId) => {
12035
12295
  } : null
12036
12296
  };
12037
12297
  };
12038
- const mapApiDocumentToPayoutDocuments = (entityId) => {
12039
- const bankStatement2 = getDocument$1(entityId, DocumentType.BANK_STATEMENT) || null;
12298
+ const mapTrustDocumentToApiDocument = async (data, entityId) => {
12299
+ var _a;
12300
+ const constitutionalDocument2 = (_a = data == null ? void 0 : data.trustConstitutionalDocument) == null ? void 0 : _a.constitutionalDocument;
12301
+ const entityType2 = "legalEntity";
12302
+ const documents2 = await Promise.all([createDocumentRequest({
12303
+ entityId,
12304
+ entityType: entityType2,
12305
+ documentType: DocumentType.CONSTITUTIONAL_DOCUMENT,
12306
+ page1: constitutionalDocument2 == null ? void 0 : constitutionalDocument2[0]
12307
+ })]);
12308
+ return documents2.filter(Boolean);
12309
+ };
12310
+ const mapApiDocumentToTrustDocument = (entityId) => {
12311
+ const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12040
12312
  return {
12041
- bankStatementDocument: bankStatement2 ? [{
12042
- name: getPageName(bankStatement2)
12043
- }] : null,
12044
- description: bankStatement2.description
12313
+ trustConstitutionalDocument: constitutionalDocument2 ? {
12314
+ constitutionalDocument: [{
12315
+ name: getPageName(constitutionalDocument2)
12316
+ }]
12317
+ } : null
12318
+ };
12319
+ };
12320
+ const mapSolePropDocumentToApiDocument = async (data, entityId) => {
12321
+ var _a;
12322
+ const constitutionalDocument2 = (_a = data == null ? void 0 : data.solePropConstitutionalDocument) == null ? void 0 : _a.constitutionalDocument;
12323
+ const entityType2 = "legalEntity";
12324
+ const documents2 = await Promise.all([createDocumentRequest({
12325
+ entityId,
12326
+ entityType: entityType2,
12327
+ documentType: DocumentType.CONSTITUTIONAL_DOCUMENT,
12328
+ page1: constitutionalDocument2 == null ? void 0 : constitutionalDocument2[0]
12329
+ })]);
12330
+ return documents2.filter(Boolean);
12331
+ };
12332
+ const mapApiDocumentToSolePropDocuments = (entityId) => {
12333
+ const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12334
+ return {
12335
+ solePropConstitutionalDocument: constitutionalDocument2 ? {
12336
+ constitutionalDocument: [{
12337
+ name: getPageName(constitutionalDocument2)
12338
+ }]
12339
+ } : null
12045
12340
  };
12046
12341
  };
12047
12342
  const mapPayoutDocumentsToApiDocuments = async (data, entityId) => {
@@ -12064,174 +12359,21 @@ const mapPayoutDocumentsToApiDocuments = async (data, entityId) => {
12064
12359
  });
12065
12360
  return document2;
12066
12361
  };
12067
- const formatObject = (obj, mapping) => {
12068
- if (obj) {
12069
- const formattedObj = {};
12070
- Object.entries(mapping).forEach(([targetKey, sourceKey]) => {
12071
- const value = getProp(obj, sourceKey);
12072
- if (value !== void 0) {
12073
- assignToProp(targetKey, formattedObj, value);
12074
- }
12075
- });
12076
- return formattedObj;
12077
- }
12078
- return null;
12079
- };
12080
- function assignToProp(path, obj, val) {
12081
- const splitPath = path.split(".");
12082
- const pathDepth = splitPath.length;
12083
- let currentObj = obj;
12084
- splitPath.forEach((key, index) => {
12085
- if (index === pathDepth - 1) {
12086
- currentObj[key] = val;
12087
- } else {
12088
- if (!currentObj[key]) {
12089
- currentObj[key] = {};
12090
- }
12091
- currentObj = currentObj[key];
12092
- }
12093
- });
12094
- }
12095
- const mapLegalEntityToTrust = (legalEntity) => {
12096
- var _a, _b;
12097
- let trustCompData;
12098
- if (legalEntity == null ? void 0 : legalEntity.trust) {
12099
- trustCompData = formatObject(legalEntity, trustComponentsKeyMapping);
12100
- if ((_a = legalEntity.trust) == null ? void 0 : _a.principalPlaceOfBusiness) {
12101
- trustCompData.trustRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME;
12102
- } else {
12103
- if (!trustCompData.trustRegistrationAddress) {
12104
- trustCompData.trustRegistrationAddress = {};
12105
- }
12106
- trustCompData.trustRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
12107
- }
12108
- const {
12109
- taxInformation = []
12110
- } = legalEntity.trust;
12111
- if (taxInformation.length) {
12112
- const {
12113
- country: country2
12114
- } = legalEntity.trust.registeredAddress;
12115
- trustCompData.trustRegistrationDetails.taxId = (_b = taxInformation.find((info) => info.country === country2)) == null ? void 0 : _b.number;
12116
- trustCompData.trustRegistrationDetails.exemptedFromTax = false;
12117
- }
12118
- }
12119
- return trustCompData;
12120
- };
12121
- const mapTrustToLegalEntity = (data) => {
12122
- const requestObj = {
12123
- ...formatObject(data, trustApiKeyMapping)
12124
- };
12125
- if (data.trustRegistrationDetails.taxId) {
12126
- requestObj.trust = updateTaxInformation({
12127
- taxId: data.trustRegistrationDetails.taxId,
12128
- country: data.trustRegistrationDetails.country,
12129
- entity: requestObj.trust
12130
- });
12131
- }
12132
- requestObj.type = LegalEntityType.TRUST;
12133
- return requestObj;
12134
- };
12135
- const mapTrustDocumentToApiDocument = async (data, entityId) => {
12136
- var _a;
12137
- const constitutionalDocument2 = (_a = data == null ? void 0 : data.trustConstitutionalDocument) == null ? void 0 : _a.constitutionalDocument;
12138
- const entityType2 = "legalEntity";
12139
- const documents2 = await Promise.all([createDocumentRequest({
12140
- entityId,
12141
- entityType: entityType2,
12142
- documentType: DocumentType.CONSTITUTIONAL_DOCUMENT,
12143
- page1: constitutionalDocument2 == null ? void 0 : constitutionalDocument2[0]
12144
- })]);
12145
- return documents2.filter(Boolean);
12146
- };
12147
- const mapLegalEntityToSoleProp = (legalEntity) => {
12148
- var _a, _b, _c, _d;
12149
- let solePropCompData;
12150
- if (legalEntity == null ? void 0 : legalEntity.soleProprietorship) {
12151
- solePropCompData = formatObject(legalEntity, solePropComponentsKeyMapping);
12152
- if ((_a = legalEntity.soleProprietorship) == null ? void 0 : _a.principalPlaceOfBusiness) {
12153
- solePropCompData.solePropRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME;
12154
- } else {
12155
- if (!solePropCompData.solePropRegistrationAddress) {
12156
- solePropCompData.solePropRegistrationAddress = {};
12157
- }
12158
- solePropCompData.solePropRegistrationAddress.operationalAddressIsSame = operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
12159
- }
12160
- solePropCompData.solePropRegistrationDetails = {
12161
- ...solePropCompData.solePropRegistrationDetails,
12162
- sameNameAsLegalName: !(((_b = solePropCompData.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName) && ((_c = solePropCompData.solePropRegistrationDetails) == null ? void 0 : _c.tradingName) && solePropCompData.solePropNameAndCountry.legalCompanyName !== solePropCompData.solePropRegistrationDetails.tradingName)
12163
- };
12164
- const {
12165
- taxInformation = []
12166
- } = legalEntity.soleProprietorship;
12167
- if (taxInformation.length) {
12168
- const {
12169
- country: country2
12170
- } = legalEntity.soleProprietorship.registeredAddress;
12171
- solePropCompData.solePropRegistrationDetails.taxId = (_d = taxInformation.find((info) => info.country === country2)) == null ? void 0 : _d.number;
12172
- solePropCompData.solePropRegistrationDetails.exemptedFromTax = false;
12173
- }
12174
- }
12175
- return solePropCompData;
12176
- };
12177
- const mapSolePropToLegalEntity = (data) => {
12178
- const requestObj = {
12179
- ...formatObject(data, solePropApiKeyMapping)
12180
- };
12181
- if (requestObj.soleProprietorship.vatAbsenceReason) {
12182
- requestObj.soleProprietorship.vatNumber = "";
12183
- }
12184
- if (data.solePropRegistrationDetails.taxId || requestObj.soleProprietorship.taxAbsent) {
12185
- requestObj.soleProprietorship = updateTaxInformation({
12186
- taxId: data.solePropRegistrationDetails.taxId,
12187
- exemptedFromTax: data.solePropRegistrationDetails.exemptedFromTax,
12188
- country: data.solePropNameAndCountry.companyCountry,
12189
- entity: requestObj.soleProprietorship
12190
- });
12191
- }
12192
- if (data.solePropRegistrationDetails.exemptedFromRegistrationNumber) {
12193
- requestObj.soleProprietorship.registrationNumber = "";
12194
- }
12195
- requestObj.type = LegalEntityType.SOLE_PROPRIETORSHIP;
12196
- return requestObj;
12197
- };
12198
- const mapSolePropDocumentToApiDocument = async (data, entityId) => {
12199
- var _a;
12200
- const constitutionalDocument2 = (_a = data == null ? void 0 : data.solePropConstitutionalDocument) == null ? void 0 : _a.constitutionalDocument;
12201
- const entityType2 = "legalEntity";
12202
- const documents2 = await Promise.all([createDocumentRequest({
12203
- entityId,
12204
- entityType: entityType2,
12205
- documentType: DocumentType.CONSTITUTIONAL_DOCUMENT,
12206
- page1: constitutionalDocument2 == null ? void 0 : constitutionalDocument2[0]
12207
- })]);
12208
- return documents2.filter(Boolean);
12209
- };
12210
- const mapApiDocumentToSolePropDocuments = (entityId) => {
12211
- const constitutionalDocument2 = getDocument$1(entityId, DocumentType.CONSTITUTIONAL_DOCUMENT) || null;
12212
- return {
12213
- solePropConstitutionalDocument: constitutionalDocument2 ? {
12214
- constitutionalDocument: [{
12215
- name: getPageName(constitutionalDocument2)
12216
- }]
12217
- } : null
12218
- };
12219
- };
12220
- const getPageName = (document2, pageIndex = 0) => {
12221
- var _a;
12222
- return ((_a = document2 == null ? void 0 : document2.attachments) == null ? void 0 : _a[pageIndex].pageName) || null;
12223
- };
12224
- function getProp(object, path) {
12225
- const splitPath = path.split(".");
12226
- const reducer2 = (xs, x) => xs && xs[x] !== void 0 ? xs[x] : void 0;
12227
- return splitPath.reduce(reducer2, object);
12228
- }
12229
- const idDocumentUploadFields = ["idDocumentType", "idFrontPage", "idBackPage", "idDocument"];
12230
- const documentTypeValidationRules$1 = {
12231
- idDocumentType: {
12232
- validate: (idDocumentType) => !!idDocumentType,
12233
- errorMessage: "fieldIsRequired",
12234
- modes: ["blur", "input"]
12362
+ const mapApiDocumentToPayoutDocuments = (entityId) => {
12363
+ const bankStatement2 = getDocument$1(entityId, DocumentType.BANK_STATEMENT) || null;
12364
+ return {
12365
+ bankStatementDocument: bankStatement2 ? [{
12366
+ name: getPageName(bankStatement2)
12367
+ }] : null,
12368
+ description: bankStatement2.description
12369
+ };
12370
+ };
12371
+ const idDocumentUploadFields = ["idDocumentType", "idFrontPage", "idBackPage", "idDocument"];
12372
+ const documentTypeValidationRules$1 = {
12373
+ idDocumentType: {
12374
+ validate: (idDocumentType) => !!idDocumentType,
12375
+ errorMessage: "fieldIsRequired",
12376
+ modes: ["blur", "input"]
12235
12377
  }
12236
12378
  };
12237
12379
  function IdDocumentManualUploadComponent(props) {
@@ -13745,89 +13887,709 @@ const ContactDetailsComp = memo(ContactDetailsComponent, (prevProps, nextProps)
13745
13887
  ContactDetailsComponent.defaultProps = {
13746
13888
  data: {}
13747
13889
  };
13748
- const additionalIdentityInfoFields$1 = ["typeOfIdentity", "licenseCardNumber", "issuerState"];
13749
- const identityTypes$1 = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
13750
- function useGlobalData() {
13751
- const {
13752
- getData
13753
- } = useStateContext();
13754
- return getData();
13755
- }
13756
- function useGlobalDataSlice(sliceId, caller) {
13757
- const {
13758
- dispatch,
13759
- getData
13760
- } = useStateContext();
13761
- const sliceData = getData()[sliceId];
13762
- const updateState = useCallback((updatedSlice) => dispatch({
13763
- type: "addToState",
13764
- value: {
13765
- ...updatedSlice,
13766
- dataStoreId: sliceId,
13767
- caller
13768
- }
13769
- // TODO merge SFValue and StateSlice types
13770
- }), [sliceId, caller]);
13771
- const updateStateSlice = useMemo(() => debounce(updateState, ON_CHANGE_DEBOUNCE_DURATION), [updateState]);
13772
- return {
13773
- sliceData,
13774
- updateStateSlice
13890
+ const IdentityNumber$1 = "";
13891
+ function validCheckCharacter(input, calculationInput) {
13892
+ if (!/^[A-Z]$/.test(input)) {
13893
+ return false;
13894
+ }
13895
+ const CHECKCHARACTER_ODD_VALUE = {
13896
+ 0: 1,
13897
+ 9: 21,
13898
+ I: 19,
13899
+ R: 8,
13900
+ 1: 0,
13901
+ A: 1,
13902
+ J: 21,
13903
+ S: 12,
13904
+ 2: 5,
13905
+ B: 0,
13906
+ K: 2,
13907
+ T: 14,
13908
+ 3: 7,
13909
+ C: 5,
13910
+ L: 4,
13911
+ U: 16,
13912
+ 4: 9,
13913
+ D: 7,
13914
+ M: 18,
13915
+ V: 10,
13916
+ 5: 13,
13917
+ E: 9,
13918
+ N: 20,
13919
+ W: 22,
13920
+ 6: 15,
13921
+ F: 13,
13922
+ O: 11,
13923
+ X: 25,
13924
+ 7: 17,
13925
+ G: 15,
13926
+ P: 3,
13927
+ Y: 24,
13928
+ 8: 19,
13929
+ H: 17,
13930
+ Q: 6,
13931
+ Z: 23
13775
13932
  };
13776
- }
13777
- function useResetGlobalData(caller) {
13778
- const {
13779
- dispatch
13780
- } = useStateContext();
13781
- return useCallback(() => dispatch({
13782
- type: "resetState",
13783
- value: {
13784
- caller
13785
- }
13786
- }), [dispatch, caller]);
13787
- }
13788
- const isTruthyValidator$1 = {
13789
- validate: (value) => !!value,
13790
- modes: ["blur"],
13791
- errorMessage: "fieldIsRequired"
13792
- };
13793
- const PASSPORT_NUMBER_PATTERN$1 = /^[A-Z]{1,2}\d{7}$/;
13794
- const DRIVERS_LICENSE_NUMBER_PATTERN$1 = /^[A-Za-z\d]{6,11}$/;
13795
- const PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN$1 = /^[A-Za-z\d]{6,10}$/;
13796
- const auIdentityValidationRules = {
13797
- typeOfIdentity: [isTruthyValidator$1],
13798
- idNumber: [{
13799
- validate: (value, context) => {
13800
- switch (context.state.data.typeOfIdentity) {
13801
- case "passport":
13802
- return PASSPORT_NUMBER_PATTERN$1.test(value);
13803
- case "driversLicense":
13804
- return DRIVERS_LICENSE_NUMBER_PATTERN$1.test(value);
13805
- case "proofOfIdentityCard":
13806
- return PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN$1.test(value);
13807
- }
13808
- },
13809
- errorMessage: (value, context) => {
13810
- switch (context.state.data.typeOfIdentity) {
13811
- case "passport":
13812
- return "invalidFormatForAuPassportNumber";
13813
- case "driversLicense":
13814
- return "invalidFormatForAuDriversLicenseNumber";
13815
- case "proofOfIdentityCard":
13816
- return "invalidFormatForAuProofOfIdentityCardNumber";
13817
- }
13818
- },
13819
- modes: ["blur"]
13820
- }],
13821
- licenseCardNumber: [{
13822
- validate: (value) => DRIVERS_LICENSE_NUMBER_PATTERN$1.test(value),
13823
- errorMessage: "invalidFormatForAuDriversLicenseCardNumber",
13824
- modes: ["blur"]
13825
- }],
13826
- issuerState: [isTruthyValidator$1]
13827
- };
13828
- const DriversLicense$1 = ({
13829
- driversLicense: driversLicense2,
13830
- onIssuerStateChange,
13933
+ const CHECKCHARACTER_EVEN_VALUE = {
13934
+ 0: 0,
13935
+ 9: 9,
13936
+ I: 8,
13937
+ R: 17,
13938
+ 1: 1,
13939
+ A: 0,
13940
+ J: 9,
13941
+ S: 18,
13942
+ 2: 2,
13943
+ B: 1,
13944
+ K: 10,
13945
+ T: 19,
13946
+ 3: 3,
13947
+ C: 2,
13948
+ L: 11,
13949
+ U: 20,
13950
+ 4: 4,
13951
+ D: 3,
13952
+ M: 12,
13953
+ V: 21,
13954
+ 5: 5,
13955
+ E: 4,
13956
+ N: 13,
13957
+ W: 22,
13958
+ 6: 6,
13959
+ F: 5,
13960
+ O: 14,
13961
+ X: 23,
13962
+ 7: 7,
13963
+ G: 6,
13964
+ P: 15,
13965
+ Y: 24,
13966
+ 8: 8,
13967
+ H: 7,
13968
+ Q: 16,
13969
+ Z: 25
13970
+ };
13971
+ let total = 0;
13972
+ for (let i = 0; i < 15; i += 1) {
13973
+ const set = i % 2 === 1 ? CHECKCHARACTER_EVEN_VALUE : CHECKCHARACTER_ODD_VALUE;
13974
+ const token = calculationInput.substring(i, i + 1);
13975
+ const value = set[token];
13976
+ if (value == null) {
13977
+ return true;
13978
+ }
13979
+ total = (total + value) % 26;
13980
+ }
13981
+ if (total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input) {
13982
+ return true;
13983
+ }
13984
+ return false;
13985
+ }
13986
+ const helper = {
13987
+ validCheckCharacter
13988
+ };
13989
+ const countryIdNumberFormatters = {
13990
+ [CountryCodes.Brazil]: {
13991
+ idNumber: {
13992
+ formatter: formatBrazilSSN,
13993
+ maxlength: 18
13994
+ }
13995
+ },
13996
+ [CountryCodes.Denmark]: {
13997
+ idNumber: {
13998
+ formatter: formatDenmarkCPR,
13999
+ maxlength: 11
14000
+ }
14001
+ },
14002
+ [CountryCodes.Sweden]: {
14003
+ idNumber: {
14004
+ formatter: formatSwedenPersonnummer,
14005
+ maxlength: 13
14006
+ }
14007
+ },
14008
+ [CountryCodes.UnitedStates]: {
14009
+ idNumber: {
14010
+ maxlength: 4
14011
+ }
14012
+ },
14013
+ US9: {
14014
+ idNumber: {
14015
+ maxlength: 9
14016
+ }
14017
+ }
14018
+ };
14019
+ const IdNumberValidationRules = {
14020
+ idNumber: [{
14021
+ validate: (value) => !!value,
14022
+ modes: ["blur"],
14023
+ errorMessage: "fieldIsRequired"
14024
+ }]
14025
+ };
14026
+ const countryIdNumberValidationRules = {
14027
+ [CountryCodes.Brazil]: {
14028
+ idNumber: [{
14029
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.BR.test(idNumber2) : false,
14030
+ modes: ["blur"],
14031
+ errorMessage: "invalidFormatIdentityNumberBR"
14032
+ }]
14033
+ },
14034
+ [CountryCodes.Canada]: {
14035
+ idNumber: [{
14036
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.CA.test(idNumber2) : false,
14037
+ modes: ["blur"],
14038
+ errorMessage: "invalidFormatIdentityNumberCA"
14039
+ }]
14040
+ },
14041
+ [CountryCodes.Denmark]: {
14042
+ idNumber: [{
14043
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.DK.test(idNumber2) : false,
14044
+ modes: ["blur"],
14045
+ errorMessage: "invalidFormatIdentityNumberDK"
14046
+ }]
14047
+ },
14048
+ [CountryCodes.Italy]: {
14049
+ idNumber: [{
14050
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && helper.validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14051
+ modes: ["blur"],
14052
+ errorMessage: "invalidFormatIdentityNumberIT"
14053
+ }]
14054
+ },
14055
+ [CountryCodes.Poland]: {
14056
+ idNumber: [{
14057
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.PL.test(idNumber2) : false,
14058
+ modes: ["blur"],
14059
+ errorMessage: "invalidFormatIdentityNumberPL"
14060
+ }]
14061
+ },
14062
+ [CountryCodes.Romania]: {
14063
+ idNumber: [{
14064
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.RO.test(idNumber2) : false,
14065
+ modes: ["blur"],
14066
+ errorMessage: "invalidFormatIdentityNumberRO"
14067
+ }]
14068
+ },
14069
+ [CountryCodes.Singapore]: {
14070
+ idNumber: [{
14071
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.SG.test(idNumber2) : false,
14072
+ modes: ["blur"],
14073
+ errorMessage: "invalidFormatIdentityNumberSG"
14074
+ }]
14075
+ },
14076
+ [CountryCodes.Spain]: {
14077
+ idNumber: [{
14078
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.ES.test(idNumber2) : false,
14079
+ modes: ["blur"],
14080
+ errorMessage: "invalidFormatIdentityNumberES"
14081
+ }]
14082
+ },
14083
+ [CountryCodes.Sweden]: {
14084
+ idNumber: [{
14085
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.SE.test(idNumber2) : false,
14086
+ modes: ["blur"],
14087
+ errorMessage: "invalidFormatIdentityNumberSE"
14088
+ }]
14089
+ },
14090
+ [CountryCodes.UnitedStates]: {
14091
+ idNumber: [{
14092
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.US.test(idNumber2) : false,
14093
+ modes: ["blur"],
14094
+ errorMessage: "invalidFormatIdentityNumberUS"
14095
+ }]
14096
+ },
14097
+ US9: {
14098
+ idNumber: [{
14099
+ validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.US9.test(idNumber2) : false,
14100
+ modes: ["blur"],
14101
+ errorMessage: "invalidFormatIdentityNumberUS9"
14102
+ }]
14103
+ }
14104
+ };
14105
+ const idNumberFields = ["idNumber", "idNumberExempt"];
14106
+ function IdentityNumber(props) {
14107
+ const {
14108
+ i18n
14109
+ } = useI18nContext();
14110
+ const {
14111
+ dataStoreId,
14112
+ country: country2,
14113
+ errors: propErrors,
14114
+ data: propData,
14115
+ requiredFields,
14116
+ fieldValidationErrors,
14117
+ maskedFields,
14118
+ classNames,
14119
+ dataPlaceholder
14120
+ } = props;
14121
+ const stateRef = useRef$1({
14122
+ setState: null
14123
+ });
14124
+ const formUtils = formUtilities(props, i18n);
14125
+ const [errors, setErrors] = useState(propErrors);
14126
+ const [data, setData] = useState({
14127
+ ...propData,
14128
+ idNumberExempt: !!(propData == null ? void 0 : propData.idNumberExempt)
14129
+ });
14130
+ const formattingRules = useMemo(() => mergeCountryBasedRulesets({}, countryIdNumberFormatters, country2), [country2]);
14131
+ const validationRules = useMemo(() => mergeCountryBasedValidators(IdNumberValidationRules, countryIdNumberValidationRules, country2), [country2]);
14132
+ const maxLengthForField = getMaxLengthByFormatRuleset(formattingRules, "idNumber");
14133
+ const {
14134
+ handleChangeFor,
14135
+ data: formData,
14136
+ valid,
14137
+ errors: formErrors,
14138
+ fieldProblems,
14139
+ setValid,
14140
+ setErrors: setFormErrors,
14141
+ triggerValidation
14142
+ } = useForm({
14143
+ ...props,
14144
+ schema: requiredFields ?? idNumberFields,
14145
+ formatters: formattingRules,
14146
+ rules: validationRules,
14147
+ defaultData: propData,
14148
+ fieldProblems: fieldValidationErrors,
14149
+ maskedFields
14150
+ });
14151
+ useEffect(() => {
14152
+ if (propErrors && propErrors.idNumber) {
14153
+ const idNumberFieldErrors = pick("idNumber").from(propErrors);
14154
+ setErrors({
14155
+ ...errors,
14156
+ ...idNumberFieldErrors
14157
+ });
14158
+ setValid("idNumber", false);
14159
+ }
14160
+ }, [propErrors]);
14161
+ useEffect(() => {
14162
+ if (data.idNumber) {
14163
+ triggerValidation(["idNumber"]);
14164
+ }
14165
+ }, [country2]);
14166
+ useEffect(() => {
14167
+ const dataHasChanged = !objectsDeepEqual(data, formData);
14168
+ const persistExternalErrors = !!(!dataHasChanged && propErrors && Object.keys(propErrors).length);
14169
+ const newErrors = {
14170
+ ...formErrors,
14171
+ ...persistExternalErrors && errors
14172
+ };
14173
+ if (!objectsDeepEqual(errors, newErrors)) {
14174
+ setErrors(newErrors);
14175
+ }
14176
+ if (persistExternalErrors) {
14177
+ setValid("idNumber", false);
14178
+ }
14179
+ setData({
14180
+ ...data,
14181
+ ...formData
14182
+ });
14183
+ }, [formErrors, formData]);
14184
+ useEffect(() => {
14185
+ var _a, _b;
14186
+ const adjustedValid = {
14187
+ ...valid
14188
+ };
14189
+ adjustedValid.idNumber = data.idNumberExempt ? true : valid.idNumber;
14190
+ const adjustedData = {
14191
+ ...data
14192
+ };
14193
+ adjustedData.idNumber = data.idNumberExempt ? void 0 : data.idNumber;
14194
+ if (data.idNumberExempt && formErrors.idNumber !== null)
14195
+ setFormErrors("idNumber", null);
14196
+ (_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14197
+ type: "addToState",
14198
+ value: {
14199
+ data: adjustedData,
14200
+ valid: adjustedValid,
14201
+ errors,
14202
+ fieldProblems,
14203
+ caller: "idNum",
14204
+ dataStoreId
14205
+ }
14206
+ });
14207
+ }, [data, valid, errors, fieldProblems, dataStoreId]);
14208
+ const classModifiers = [formUtils.isRequiredField("idNumberExempt") ? "idNumberWithExempt" : "idNumber"];
14209
+ if (classNames)
14210
+ classModifiers.push(...classNames);
14211
+ return jsx("div", {
14212
+ className: "adyen-kyc-field__id-number",
14213
+ children: formUtils.isRequiredField("idNumber") && jsxs(Fragment, {
14214
+ children: [jsx(Field, {
14215
+ name: "idNumber",
14216
+ label: formUtils.getLabel("idNumber"),
14217
+ classNameModifiers: classModifiers,
14218
+ errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems),
14219
+ disabled: data.idNumberExempt,
14220
+ isValid: valid.idNumber,
14221
+ dataPlaceholder: data.idNumber && dataPlaceholder,
14222
+ children: (childProps) => jsx(InputText, {
14223
+ ...childProps,
14224
+ name: "idNumber",
14225
+ value: data.idNumber,
14226
+ placeholder: formUtils.getPlaceholder("idNumber"),
14227
+ readonly: formUtils.isReadOnly("idNumber"),
14228
+ onInput: handleChangeFor("idNumber", "input"),
14229
+ onBlur: handleChangeFor("idNumber", "blur"),
14230
+ "aria-required": true,
14231
+ "aria-label": formUtils.getLabel("idNumber", "idNumber"),
14232
+ "aria-invalid": !valid.idNumber,
14233
+ inputMode: "numeric",
14234
+ maxLength: maxLengthForField,
14235
+ ...data.idNumberExempt && {
14236
+ disabled: true
14237
+ }
14238
+ })
14239
+ }), jsx(Field, {
14240
+ classNameModifiers: ["idNumber__checkbox"],
14241
+ name: "idNumberExempt",
14242
+ children: (childProps) => formUtils.isRequiredField("idNumberExempt") && jsx(Checkbox, {
14243
+ ...childProps,
14244
+ label: formUtils.getLabel("idNumberExempt"),
14245
+ checked: Boolean(data.idNumberExempt),
14246
+ classNameModifiers: ["idNumberExempt"],
14247
+ name: "idNumberExempt",
14248
+ onChange: handleChangeFor("idNumberExempt")
14249
+ })
14250
+ }), jsx(StateContextSetter, {
14251
+ owner: "IdNumberComp",
14252
+ stateRef
14253
+ })]
14254
+ })
14255
+ });
14256
+ }
14257
+ const IdentityNumberComponent = memo(IdentityNumber, (prevProps, nextProps) => prevProps.country === nextProps.country && prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.errors, nextProps.errors) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors));
14258
+ IdentityNumberComponent.defaultProps = {
14259
+ data: {},
14260
+ onChange: () => {
14261
+ }
14262
+ };
14263
+ const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14264
+ if (propagationMode === "stop")
14265
+ event.stopPropagation();
14266
+ if (keys.includes(event.key)) {
14267
+ if (propagationMode === "stopIfMatches")
14268
+ event.stopPropagation();
14269
+ callback();
14270
+ }
14271
+ };
14272
+ const styles = {
14273
+ "adyen-kyc-multi-select-list": "adyen-kyc-multi-select-list",
14274
+ "adyen-kyc-multi-select-list-item": "adyen-kyc-multi-select-list-item",
14275
+ "adyen-kyc-multi-select-list-item--with-description": "adyen-kyc-multi-select-list-item--with-description",
14276
+ "adyen-kyc-checkbox__label": "adyen-kyc-checkbox__label"
14277
+ };
14278
+ const MultiSelectList = ({
14279
+ options,
14280
+ selected,
14281
+ onSelect,
14282
+ mapToSelectItem
14283
+ }) => jsx("ul", {
14284
+ className: styles["adyen-kyc-multi-select-list"],
14285
+ children: options.map((option) => {
14286
+ const item = mapToSelectItem(option);
14287
+ const isSelected = selected.includes(option);
14288
+ const handleSelect = () => {
14289
+ const newSelection = isSelected ? selected.filter((selectedOption) => selectedOption !== option) : [...selected, option];
14290
+ onSelect(newSelection);
14291
+ };
14292
+ return jsx(SelectListItem, {
14293
+ item,
14294
+ selected: isSelected,
14295
+ onKeyDown: handleKeys(["Enter", " "], handleSelect),
14296
+ onSelect: handleSelect,
14297
+ isMulti: true,
14298
+ className: cx([styles["adyen-kyc-multi-select-list-item"], {
14299
+ [styles["adyen-kyc-multi-select-list-item--with-description"]]: !!item.description
14300
+ }])
14301
+ }, item.id);
14302
+ })
14303
+ });
14304
+ const decisionMakerRoleValidationRules = {
14305
+ role: {
14306
+ modes: ["blur"],
14307
+ validate: (role2) => !!(role2 == null ? void 0 : role2.length),
14308
+ errorMessage: "fieldIsRequired"
14309
+ }
14310
+ };
14311
+ const decisionMakerRoleFields = ["role"];
14312
+ const DecisionMakerRoleComponent = (props) => {
14313
+ const {
14314
+ data: dataProp,
14315
+ dataStoreId,
14316
+ validators,
14317
+ fieldValidationErrors,
14318
+ requiredFields,
14319
+ allowedRoles
14320
+ } = props;
14321
+ const {
14322
+ i18n
14323
+ } = useI18nContext();
14324
+ const {
14325
+ data,
14326
+ valid,
14327
+ errors,
14328
+ isValid,
14329
+ fieldProblems,
14330
+ handleChangeFor
14331
+ } = useForm({
14332
+ ...props,
14333
+ schema: requiredFields || ["role"],
14334
+ rules: validators || decisionMakerRoleValidationRules,
14335
+ defaultData: dataProp,
14336
+ fieldProblems: fieldValidationErrors
14337
+ });
14338
+ const [decisionMakerRoles2, setDecisionMakerRoles] = useState([]);
14339
+ const stateRef = useRef$1({
14340
+ setState: null
14341
+ });
14342
+ const formUtils = formUtilities(props, i18n);
14343
+ const allowedRolesString = allowedRoles == null ? void 0 : allowedRoles.toString();
14344
+ const makeSelectItemForDecisionMakerRole = (role2) => {
14345
+ const validRole = decisionMakerRoles2.find((item) => item.id === role2);
14346
+ return {
14347
+ ...validRole,
14348
+ disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(validRole == null ? void 0 : validRole.id))
14349
+ };
14350
+ };
14351
+ const changeRoles = (roles) => {
14352
+ handleChangeFor("role", "input")(roles);
14353
+ };
14354
+ useEffect(() => {
14355
+ var _a, _b;
14356
+ (_b = (_a = stateRef.current).setState) == null ? void 0 : _b.call(_a, {
14357
+ type: "addToState",
14358
+ value: {
14359
+ data,
14360
+ valid,
14361
+ errors,
14362
+ fieldProblems,
14363
+ caller: "Role",
14364
+ dataStoreId
14365
+ }
14366
+ });
14367
+ }, [data, valid, errors, isValid, dataStoreId, fieldProblems]);
14368
+ useEffect(() => {
14369
+ setDecisionMakerRoles(getTranslatedDecisionMakerRoles(i18n, allowedRoles));
14370
+ }, [allowedRoles, allowedRolesString, i18n, i18n.languageCode, i18n.locale]);
14371
+ return jsxs("div", {
14372
+ className: "adyen-kyc-field__role",
14373
+ children: [jsx(StateContextSetter, {
14374
+ stateRef
14375
+ }), formUtils.isRequiredField("role", false) && jsx(Field, {
14376
+ name: "role",
14377
+ classNameModifiers: ["role"],
14378
+ label: formUtils.getLabel("role", "selectAllTheRolesThatThisDecisionMakerHolds"),
14379
+ errorMessage: formUtils.getErrorMessage("role", errors, fieldProblems),
14380
+ isValid: valid.role,
14381
+ showErrorIconBottom: true,
14382
+ children: (childProps) => jsx(MultiSelectList, {
14383
+ ...childProps,
14384
+ options: allowedRoles ?? [],
14385
+ selected: data.role ?? [],
14386
+ onSelect: changeRoles,
14387
+ mapToSelectItem: makeSelectItemForDecisionMakerRole
14388
+ })
14389
+ })]
14390
+ });
14391
+ };
14392
+ const nameValidationRules = {
14393
+ firstName: [{
14394
+ validate: hasText,
14395
+ errorMessage: "fieldIsRequired",
14396
+ modes: ["blur"]
14397
+ }],
14398
+ lastName: [{
14399
+ validate: hasText,
14400
+ errorMessage: "fieldIsRequired",
14401
+ modes: ["blur"]
14402
+ }]
14403
+ };
14404
+ const specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS.replace("-", ""));
14405
+ const nameFormatters = {
14406
+ firstName: {
14407
+ // formatter: trimValWithOneSpace // just trim
14408
+ // Example - removing disallowed chars as they are input: then they don't end up in state
14409
+ formatter: (val) => val ? trimValWithOneSpace(val).replace(specialCharsRegEx, "") : void 0
14410
+ // trim & replace
14411
+ },
14412
+ lastName: {
14413
+ formatter: (val) => val ? trimValWithOneSpace(val).replace(specialCharsRegEx, "") : void 0
14414
+ }
14415
+ };
14416
+ const nameFields = ["firstName", "lastName"];
14417
+ function NameComponent(props) {
14418
+ const {
14419
+ i18n
14420
+ } = useI18nContext();
14421
+ const schema = props.requiredFields || ["firstName", "lastName"];
14422
+ const {
14423
+ handleChangeFor,
14424
+ data,
14425
+ valid,
14426
+ errors,
14427
+ fieldProblems,
14428
+ isValid
14429
+ } = useForm({
14430
+ ...props,
14431
+ schema,
14432
+ rules: nameValidationRules,
14433
+ formatters: nameFormatters,
14434
+ defaultData: props.data,
14435
+ fieldProblems: props == null ? void 0 : props.fieldValidationErrors
14436
+ });
14437
+ const {
14438
+ dataStoreId
14439
+ } = props;
14440
+ const stateRef = useRef$1({
14441
+ setState: null
14442
+ });
14443
+ useEffect(() => {
14444
+ var _a, _b, _c;
14445
+ (_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14446
+ type: "addToState",
14447
+ value: {
14448
+ data,
14449
+ valid,
14450
+ errors,
14451
+ fieldProblems,
14452
+ caller: "name",
14453
+ dataStoreId
14454
+ }
14455
+ });
14456
+ (_c = props.onChange) == null ? void 0 : _c.call(props, {
14457
+ schema,
14458
+ data,
14459
+ valid,
14460
+ errors,
14461
+ fieldProblems,
14462
+ isValid
14463
+ });
14464
+ }, [data, valid, errors, isValid]);
14465
+ const formUtils = formUtilities(props, i18n);
14466
+ return jsxs("div", {
14467
+ className: "adyen-kyc-field-wrapper",
14468
+ children: [jsx(StateContextSetter, {
14469
+ stateRef
14470
+ }), formUtils.isRequiredField("firstName") && jsx(Field, {
14471
+ name: "firstName",
14472
+ label: formUtils.getLabel("firstName"),
14473
+ classNameModifiers: ["firstName", "col-50"],
14474
+ errorMessage: formUtils.getErrorMessage("firstName", errors, fieldProblems),
14475
+ isValid: valid.firstName,
14476
+ helper: formUtils.getLabel("enterNameExactlyAsAppearInID"),
14477
+ children: (childProps) => jsx(InputText, {
14478
+ ...childProps,
14479
+ name: "firstName",
14480
+ value: data.firstName,
14481
+ classNameModifiers: ["name"],
14482
+ readonly: formUtils.isReadOnly("firstName"),
14483
+ onInput: handleChangeFor("firstName", "input"),
14484
+ onBlur: handleChangeFor("firstName", "blur"),
14485
+ trimOnBlur: true,
14486
+ spellCheck: false,
14487
+ "aria-required": true,
14488
+ "aria-label": formUtils.getLabel("firstName"),
14489
+ "aria-invalid": !valid.firstName
14490
+ })
14491
+ }), formUtils.isRequiredField("lastName") && jsx(Field, {
14492
+ name: "lastName",
14493
+ label: formUtils.getLabel("lastName"),
14494
+ classNameModifiers: ["lastName", "col-50"],
14495
+ errorMessage: formUtils.getErrorMessage("lastName", errors, fieldProblems),
14496
+ isValid: valid.lastName,
14497
+ helper: formUtils.getLabel("enterLastNameExactlyAsAppearInID"),
14498
+ children: (childProps) => jsx(InputText, {
14499
+ ...childProps,
14500
+ name: "lastName",
14501
+ value: data.lastName,
14502
+ classNameModifiers: ["lastName"],
14503
+ readonly: formUtils.isReadOnly("lastName"),
14504
+ onInput: handleChangeFor("lastName", "input"),
14505
+ onBlur: handleChangeFor("lastName", "blur"),
14506
+ trimOnBlur: true,
14507
+ spellCheck: false,
14508
+ "aria-required": true,
14509
+ "aria-label": formUtils.getLabel("lastName"),
14510
+ "aria-invalid": !valid.lastName
14511
+ })
14512
+ })]
14513
+ });
14514
+ }
14515
+ const Name = memo(NameComponent, (prevProps, nextProps) => prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors));
14516
+ NameComponent.defaultProps = {
14517
+ data: {},
14518
+ onChange: () => {
14519
+ },
14520
+ visibility: "editable",
14521
+ validationRules: nameValidationRules
14522
+ };
14523
+ const personalDetailsValidationRules = {
14524
+ birthDate: [{
14525
+ modes: ["blur"],
14526
+ validate: (birthDate2) => !!birthDate2,
14527
+ errorMessage: "fieldIsRequired"
14528
+ }, {
14529
+ modes: ["blur"],
14530
+ validate: (birthDate2) => birthDate2 && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14531
+ errorMessage: "invalidDateOfBirth"
14532
+ }],
14533
+ residencyCountry: {
14534
+ modes: ["blur"],
14535
+ validate: (residencyCountry2) => !!residencyCountry2,
14536
+ errorMessage: "fieldIsRequired"
14537
+ },
14538
+ nationality: {
14539
+ modes: ["blur"],
14540
+ validate: (nationality2) => !!nationality2,
14541
+ errorMessage: "fieldIsRequired"
14542
+ },
14543
+ jobTitle: {
14544
+ modes: ["blur"],
14545
+ validate: (jobTitle2) => !!jobTitle2,
14546
+ errorMessage: "fieldIsRequired"
14547
+ }
14548
+ };
14549
+ const additionalIdentityInfoFields$2 = ["typeOfIdentity", "licenseCardNumber", "issuerState"];
14550
+ const identityTypes$2 = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
14551
+ const isTruthyValidator = {
14552
+ validate: (value) => !!value,
14553
+ modes: ["blur"],
14554
+ errorMessage: "fieldIsRequired"
14555
+ };
14556
+ const auIdentityValidationRules = {
14557
+ typeOfIdentity: [isTruthyValidator],
14558
+ idNumber: [{
14559
+ validate: (value, context) => {
14560
+ switch (context == null ? void 0 : context.state.data.typeOfIdentity) {
14561
+ case "passport":
14562
+ return PassportNumberPatterns.AU.test(value ?? "");
14563
+ case "driversLicense":
14564
+ return DriversLicenseNumberPatterns.AU.test(value ?? "");
14565
+ case "proofOfIdentityCard":
14566
+ return ProofOfIdentityCardPatterns.AU.test(value ?? "");
14567
+ default:
14568
+ return false;
14569
+ }
14570
+ },
14571
+ errorMessage: (_, context) => {
14572
+ switch (context == null ? void 0 : context.state.data.typeOfIdentity) {
14573
+ case "passport":
14574
+ return "invalidFormatForAuPassportNumber";
14575
+ case "driversLicense":
14576
+ return "invalidFormatForAuDriversLicenseNumber";
14577
+ case "proofOfIdentityCard":
14578
+ return "invalidFormatForAuProofOfIdentityCardNumber";
14579
+ }
14580
+ },
14581
+ modes: ["blur"]
14582
+ }],
14583
+ licenseCardNumber: [{
14584
+ validate: (value) => DriversLicenseNumberPatterns.AU.test(value ?? ""),
14585
+ errorMessage: "invalidFormatForAuDriversLicenseCardNumber",
14586
+ modes: ["blur"]
14587
+ }],
14588
+ issuerState: [isTruthyValidator]
14589
+ };
14590
+ const DriversLicense$2 = ({
14591
+ driversLicense: driversLicense2,
14592
+ onIssuerStateChange,
13831
14593
  onLicenseNumberInput,
13832
14594
  onLicenseNumberBlur,
13833
14595
  onCardNumberInput,
@@ -13903,7 +14665,7 @@ const DriversLicense$1 = ({
13903
14665
  })]
13904
14666
  });
13905
14667
  };
13906
- const PassportNumber$1 = ({
14668
+ const PassportNumber$2 = ({
13907
14669
  passportNumber: passportNumber2,
13908
14670
  onInput,
13909
14671
  onBlur,
@@ -13949,11 +14711,11 @@ const ProofOfIdentityCard$1 = ({
13949
14711
  placeholder: ""
13950
14712
  })
13951
14713
  });
13952
- const mapIdentityTypeToItem$1 = (type, label) => ({
14714
+ const mapIdentityTypeToItem$2 = (type, label) => ({
13953
14715
  id: type,
13954
14716
  name: label
13955
14717
  });
13956
- const TypeOfIdentity$1 = ({
14718
+ const TypeOfIdentity$2 = ({
13957
14719
  availableIdentityTypes,
13958
14720
  selectedIdentityType,
13959
14721
  setSelectedIdentityType,
@@ -13975,7 +14737,7 @@ const TypeOfIdentity$1 = ({
13975
14737
  children: (childProps) => jsx(Select, {
13976
14738
  ...childProps,
13977
14739
  isInvalid: false,
13978
- items: availableIdentityTypes.map((type) => mapIdentityTypeToItem$1(type, i18n.get(type))),
14740
+ items: availableIdentityTypes.map((type) => mapIdentityTypeToItem$2(type, i18n.get(type))),
13979
14741
  placeholder: i18n.get("id"),
13980
14742
  selected: selectedIdentityType,
13981
14743
  onChange: (event) => setSelectedIdentityType(event.target.value)
@@ -13996,7 +14758,7 @@ function IdentityAuComponent(props) {
13996
14758
  valid
13997
14759
  } = useForm({
13998
14760
  ...props,
13999
- schema: props.requiredFields,
14761
+ schema: props.requiredFields ?? [],
14000
14762
  defaultData: props.data,
14001
14763
  fieldProblems: props.fieldValidationErrors,
14002
14764
  rules: auIdentityValidationRules,
@@ -14024,28 +14786,28 @@ function IdentityAuComponent(props) {
14024
14786
  } = useI18nContext();
14025
14787
  const formUtils = formUtilities(props, i18n);
14026
14788
  return jsxs(Fragment, {
14027
- children: [jsx(TypeOfIdentity$1, {
14028
- availableIdentityTypes: identityTypes$1.filter((type) => type !== "nationalIdNumber"),
14789
+ children: [jsx(TypeOfIdentity$2, {
14790
+ availableIdentityTypes: identityTypes$2.filter((type) => type !== "nationalIdNumber"),
14029
14791
  selectedIdentityType: data.typeOfIdentity,
14030
14792
  setSelectedIdentityType: handleChangeFor("typeOfIdentity"),
14031
14793
  formUtils,
14032
14794
  isValid: valid.typeOfIdentity,
14033
14795
  errorMessage: formUtils.getErrorMessage("typeOfIdentity", errors, fieldProblems)
14034
- }), data.typeOfIdentity === "passport" ? jsx(PassportNumber$1, {
14035
- passportNumber: data.idNumber,
14796
+ }), data.typeOfIdentity === "passport" ? jsx(PassportNumber$2, {
14797
+ passportNumber: data.idNumber ?? "",
14036
14798
  onInput: handleChangeFor("idNumber", "input"),
14037
14799
  onBlur: handleChangeFor("idNumber", "blur"),
14038
14800
  formUtils,
14039
14801
  isValid: valid.idNumber,
14040
14802
  errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
14041
14803
  }) : data.typeOfIdentity === "proofOfIdentityCard" ? jsx(ProofOfIdentityCard$1, {
14042
- cardNumber: data.idNumber,
14804
+ cardNumber: data.idNumber ?? "",
14043
14805
  onInput: handleChangeFor("idNumber", "input"),
14044
14806
  onBlur: handleChangeFor("idNumber", "blur"),
14045
14807
  formUtils,
14046
14808
  isValid: valid.idNumber,
14047
14809
  errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
14048
- }) : data.typeOfIdentity === "driversLicense" ? jsx(DriversLicense$1, {
14810
+ }) : data.typeOfIdentity === "driversLicense" ? jsx(DriversLicense$2, {
14049
14811
  driversLicense: data,
14050
14812
  onIssuerStateChange: handleChangeFor("issuerState"),
14051
14813
  onLicenseNumberInput: handleChangeFor("idNumber", "input"),
@@ -14066,18 +14828,10 @@ function IdentityAuComponent(props) {
14066
14828
  }) : void 0]
14067
14829
  });
14068
14830
  }
14069
- const auIdentityFields = [...additionalIdentityInfoFields$1, "idNumber"];
14070
- const additionalIdentityInfoFields = ["typeOfIdentity"];
14071
- const identityTypes = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
14072
- const PASSPORT_NUMBER_PATTERN = /^(?=.{9}$)[A-Z]{1,2}\d{6}[A-Z0-9]{1,2}$/;
14073
- const DRIVERS_LICENSE_NUMBER_PATTERN = /^[A-Z]{1}[A-Z0-9]{7}$/;
14074
- const PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN = /^[A-Z]{1,2}[0-9]{6}[0-9A]$/;
14075
- const isValidatePassportNumber = (value) => PASSPORT_NUMBER_PATTERN.test(value);
14076
- const isTruthyValidator = {
14077
- validate: (value) => !!value,
14078
- modes: ["blur"],
14079
- errorMessage: "fieldIsRequired"
14080
- };
14831
+ const auIdentityFields = [...additionalIdentityInfoFields$2, "idNumber"];
14832
+ const additionalIdentityInfoFields$1 = ["typeOfIdentity"];
14833
+ const identityTypes$1 = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
14834
+ const isValidatePassportNumber = (value) => PassportNumberPatterns.HK.test(value);
14081
14835
  const identityValidationRules = {
14082
14836
  typeOfIdentity: [isTruthyValidator],
14083
14837
  idNumber: [{
@@ -14087,9 +14841,9 @@ const identityValidationRules = {
14087
14841
  case "passport":
14088
14842
  return isValidatePassportNumber(value);
14089
14843
  case "driversLicense":
14090
- return DRIVERS_LICENSE_NUMBER_PATTERN.test(value);
14844
+ return DriversLicenseNumberPatterns.HK.test(value);
14091
14845
  case "proofOfIdentityCard":
14092
- return PROOF_OF_IDENTITY_CARD_NUMBER_PATTERN.test(value);
14846
+ return ProofOfIdentityCardPatterns.HK.test(value);
14093
14847
  default:
14094
14848
  return false;
14095
14849
  }
@@ -14105,15 +14859,9 @@ const identityValidationRules = {
14105
14859
  }
14106
14860
  },
14107
14861
  modes: ["blur"]
14108
- }],
14109
- licenseCardNumber: [{
14110
- validate: (value) => DRIVERS_LICENSE_NUMBER_PATTERN.test(value ?? ""),
14111
- errorMessage: "invalidFormatForHKDriversLicenseNumber",
14112
- modes: ["blur"]
14113
- }],
14114
- issuerState: [isTruthyValidator]
14862
+ }]
14115
14863
  };
14116
- const DriversLicense = ({
14864
+ const DriversLicense$1 = ({
14117
14865
  driversLicense: driversLicense2,
14118
14866
  onLicenseNumberInput,
14119
14867
  onLicenseNumberBlur,
@@ -14140,7 +14888,7 @@ const DriversLicense = ({
14140
14888
  })
14141
14889
  });
14142
14890
  };
14143
- const PassportNumber = ({
14891
+ const PassportNumber$1 = ({
14144
14892
  passportNumber: passportNumber2,
14145
14893
  onInput,
14146
14894
  onBlur,
@@ -14182,11 +14930,11 @@ const ProofOfIdentityCard = ({
14182
14930
  placeholder: ""
14183
14931
  })
14184
14932
  });
14185
- const mapIdentityTypeToItem = (type, label) => ({
14933
+ const mapIdentityTypeToItem$1 = (type, label) => ({
14186
14934
  id: type,
14187
14935
  name: label
14188
14936
  });
14189
- const TypeOfIdentity = ({
14937
+ const TypeOfIdentity$1 = ({
14190
14938
  availableIdentityTypes,
14191
14939
  selectedIdentityType,
14192
14940
  setSelectedIdentityType,
@@ -14208,7 +14956,7 @@ const TypeOfIdentity = ({
14208
14956
  children: (childProps) => jsx(Select, {
14209
14957
  ...childProps,
14210
14958
  isInvalid: false,
14211
- items: availableIdentityTypes.map((type) => mapIdentityTypeToItem(type, i18n.get(type))),
14959
+ items: availableIdentityTypes.map((type) => mapIdentityTypeToItem$1(type, i18n.get(type))),
14212
14960
  placeholder: i18n.get("id"),
14213
14961
  selected: selectedIdentityType,
14214
14962
  onChange: (event) => setSelectedIdentityType(event.target.value)
@@ -14260,14 +15008,14 @@ function IdentityHKComponent(props) {
14260
15008
  } = useI18nContext();
14261
15009
  const formUtils = formUtilities(props, i18n);
14262
15010
  return jsxs(Fragment, {
14263
- children: [jsx(TypeOfIdentity, {
14264
- availableIdentityTypes: identityTypes.filter((type) => type !== "nationalIdNumber"),
15011
+ children: [jsx(TypeOfIdentity$1, {
15012
+ availableIdentityTypes: identityTypes$1.filter((type) => type !== "nationalIdNumber"),
14265
15013
  selectedIdentityType: data.typeOfIdentity,
14266
15014
  setSelectedIdentityType: handleChangeFor("typeOfIdentity"),
14267
15015
  formUtils,
14268
15016
  isValid: valid.typeOfIdentity,
14269
15017
  errorMessage: formUtils.getErrorMessage("typeOfIdentity", errors, fieldProblems)
14270
- }), data.typeOfIdentity === "passport" ? jsx(PassportNumber, {
15018
+ }), data.typeOfIdentity === "passport" ? jsx(PassportNumber$1, {
14271
15019
  passportNumber: data.idNumber ?? "",
14272
15020
  onInput: handleChangeFor("idNumber", "input"),
14273
15021
  onBlur: handleChangeFor("idNumber", "blur"),
@@ -14281,7 +15029,7 @@ function IdentityHKComponent(props) {
14281
15029
  isValid: valid.idNumber,
14282
15030
  label: formUtils.getLabel("idNumber", "hkid"),
14283
15031
  errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
14284
- }) : data.typeOfIdentity === "driversLicense" ? jsx(DriversLicense, {
15032
+ }) : data.typeOfIdentity === "driversLicense" ? jsx(DriversLicense$1, {
14285
15033
  driversLicense: data,
14286
15034
  onLicenseNumberInput: handleChangeFor("idNumber", "input"),
14287
15035
  onLicenseNumberBlur: handleChangeFor("idNumber", "blur"),
@@ -14295,380 +15043,235 @@ function IdentityHKComponent(props) {
14295
15043
  }) : void 0]
14296
15044
  });
14297
15045
  }
14298
- const hkIdentityFields = [...additionalIdentityInfoFields, "idNumber"];
14299
- const IdentityNumber$1 = "";
14300
- function validCheckCharacter(input, calculationInput) {
14301
- if (!/^[A-Z]$/.test(input)) {
14302
- return false;
14303
- }
14304
- const CHECKCHARACTER_ODD_VALUE = {
14305
- 0: 1,
14306
- 9: 21,
14307
- I: 19,
14308
- R: 8,
14309
- 1: 0,
14310
- A: 1,
14311
- J: 21,
14312
- S: 12,
14313
- 2: 5,
14314
- B: 0,
14315
- K: 2,
14316
- T: 14,
14317
- 3: 7,
14318
- C: 5,
14319
- L: 4,
14320
- U: 16,
14321
- 4: 9,
14322
- D: 7,
14323
- M: 18,
14324
- V: 10,
14325
- 5: 13,
14326
- E: 9,
14327
- N: 20,
14328
- W: 22,
14329
- 6: 15,
14330
- F: 13,
14331
- O: 11,
14332
- X: 25,
14333
- 7: 17,
14334
- G: 15,
14335
- P: 3,
14336
- Y: 24,
14337
- 8: 19,
14338
- H: 17,
14339
- Q: 6,
14340
- Z: 23
14341
- };
14342
- const CHECKCHARACTER_EVEN_VALUE = {
14343
- 0: 0,
14344
- 9: 9,
14345
- I: 8,
14346
- R: 17,
14347
- 1: 1,
14348
- A: 0,
14349
- J: 9,
14350
- S: 18,
14351
- 2: 2,
14352
- B: 1,
14353
- K: 10,
14354
- T: 19,
14355
- 3: 3,
14356
- C: 2,
14357
- L: 11,
14358
- U: 20,
14359
- 4: 4,
14360
- D: 3,
14361
- M: 12,
14362
- V: 21,
14363
- 5: 5,
14364
- E: 4,
14365
- N: 13,
14366
- W: 22,
14367
- 6: 6,
14368
- F: 5,
14369
- O: 14,
14370
- X: 23,
14371
- 7: 7,
14372
- G: 6,
14373
- P: 15,
14374
- Y: 24,
14375
- 8: 8,
14376
- H: 7,
14377
- Q: 16,
14378
- Z: 25
14379
- };
14380
- let total = 0;
14381
- for (let i = 0; i < 15; i += 1) {
14382
- const set = i % 2 === 1 ? CHECKCHARACTER_EVEN_VALUE : CHECKCHARACTER_ODD_VALUE;
14383
- const token = calculationInput.substring(i, i + 1);
14384
- const value = set[token];
14385
- if (value == null) {
14386
- return true;
14387
- }
14388
- total = (total + value) % 26;
14389
- }
14390
- if (total >= 0 && total <= 26 && "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(total) === input) {
14391
- return true;
14392
- }
14393
- return false;
14394
- }
14395
- const helper = {
14396
- validCheckCharacter
14397
- };
14398
- const countryIdNumberFormatters = {
14399
- [CountryCodes.Brazil]: {
14400
- idNumber: {
14401
- formatter: formatBrazilSSN,
14402
- maxlength: 18
14403
- }
14404
- },
14405
- [CountryCodes.Denmark]: {
14406
- idNumber: {
14407
- formatter: formatDenmarkCPR,
14408
- maxlength: 11
14409
- }
14410
- },
14411
- [CountryCodes.Sweden]: {
14412
- idNumber: {
14413
- formatter: formatSwedenPersonnummer,
14414
- maxlength: 13
14415
- }
14416
- },
14417
- [CountryCodes.UnitedStates]: {
14418
- idNumber: {
14419
- maxlength: 4
14420
- }
14421
- },
14422
- US9: {
14423
- idNumber: {
14424
- maxlength: 9
14425
- }
14426
- }
14427
- };
14428
- const IdNumberValidationRules = {
15046
+ const hkIdentityFields = [...additionalIdentityInfoFields$1, "idNumber"];
15047
+ const additionalIdentityInfoFields = ["typeOfIdentity", "licenseCardNumber"];
15048
+ const identityTypes = ["nationalIdNumber", "passport", "driversLicense", "proofOfIdentityCard"];
15049
+ const PASSPORT_NUMBER_PATTERN = /^[A-Z]{1,2}\d{7}$/;
15050
+ const nzIdentityValidationRules = {
15051
+ typeOfIdentity: [isTruthyValidator],
14429
15052
  idNumber: [{
14430
- validate: (value) => !!value,
14431
- modes: ["blur"],
14432
- errorMessage: "fieldIsRequired"
14433
- }]
14434
- };
14435
- const countryIdNumberValidationRules = {
14436
- [CountryCodes.Brazil]: {
14437
- idNumber: [{
14438
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.BR.test(idNumber2) : false,
14439
- modes: ["blur"],
14440
- errorMessage: "invalidFormatIdentityNumberBR"
14441
- }]
14442
- },
14443
- [CountryCodes.Canada]: {
14444
- idNumber: [{
14445
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.CA.test(idNumber2) : false,
14446
- modes: ["blur"],
14447
- errorMessage: "invalidFormatIdentityNumberCA"
14448
- }]
14449
- },
14450
- [CountryCodes.Denmark]: {
14451
- idNumber: [{
14452
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.DK.test(idNumber2) : false,
14453
- modes: ["blur"],
14454
- errorMessage: "invalidFormatIdentityNumberDK"
14455
- }]
14456
- },
14457
- [CountryCodes.Italy]: {
14458
- idNumber: [{
14459
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.IT.test(idNumber2) && helper.validCheckCharacter(idNumber2.substring(15, 16), idNumber2.substring(0, 15)) : false,
14460
- modes: ["blur"],
14461
- errorMessage: "invalidFormatIdentityNumberIT"
14462
- }]
14463
- },
14464
- [CountryCodes.Poland]: {
14465
- idNumber: [{
14466
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.PL.test(idNumber2) : false,
14467
- modes: ["blur"],
14468
- errorMessage: "invalidFormatIdentityNumberPL"
14469
- }]
14470
- },
14471
- [CountryCodes.Romania]: {
14472
- idNumber: [{
14473
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.RO.test(idNumber2) : false,
14474
- modes: ["blur"],
14475
- errorMessage: "invalidFormatIdentityNumberRO"
14476
- }]
14477
- },
14478
- [CountryCodes.Singapore]: {
14479
- idNumber: [{
14480
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.SG.test(idNumber2) : false,
14481
- modes: ["blur"],
14482
- errorMessage: "invalidFormatIdentityNumberSG"
14483
- }]
14484
- },
14485
- [CountryCodes.Spain]: {
14486
- idNumber: [{
14487
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.ES.test(idNumber2) : false,
14488
- modes: ["blur"],
14489
- errorMessage: "invalidFormatIdentityNumberES"
14490
- }]
14491
- },
14492
- [CountryCodes.Sweden]: {
14493
- idNumber: [{
14494
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.SE.test(idNumber2) : false,
14495
- modes: ["blur"],
14496
- errorMessage: "invalidFormatIdentityNumberSE"
14497
- }]
14498
- },
14499
- [CountryCodes.UnitedStates]: {
14500
- idNumber: [{
14501
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.US.test(idNumber2) : false,
14502
- modes: ["blur"],
14503
- errorMessage: "invalidFormatIdentityNumberUS"
14504
- }]
14505
- },
14506
- US9: {
14507
- idNumber: [{
14508
- validate: (idNumber2) => idNumber2 ? CountryIdNumberPatterns.US9.test(idNumber2) : false,
14509
- modes: ["blur"],
14510
- errorMessage: "invalidFormatIdentityNumberUS9"
14511
- }]
14512
- }
15053
+ validate: (val, context) => {
15054
+ var _a, _b;
15055
+ const value = val ?? "";
15056
+ switch ((_b = (_a = context == null ? void 0 : context.state) == null ? void 0 : _a.data) == null ? void 0 : _b.typeOfIdentity) {
15057
+ case "passport":
15058
+ return PASSPORT_NUMBER_PATTERN.test(value);
15059
+ case "driversLicense":
15060
+ return DriversLicenseNumberPatterns[CountryCodes.NewZealand].test(value);
15061
+ default:
15062
+ return false;
15063
+ }
15064
+ },
15065
+ errorMessage: (_, context) => {
15066
+ var _a, _b;
15067
+ switch ((_b = (_a = context == null ? void 0 : context.state) == null ? void 0 : _a.data) == null ? void 0 : _b.typeOfIdentity) {
15068
+ case "passport":
15069
+ return "invalidFormatForNZPassportNumber";
15070
+ case "driversLicense":
15071
+ return "invalidFormatForNZDriversLicenseNumber";
15072
+ }
15073
+ },
15074
+ modes: ["blur"]
15075
+ }],
15076
+ licenseCardNumber: [{
15077
+ validate: (value) => DriversLicenseCardNumberPatterns[CountryCodes.NewZealand].test(value ?? ""),
15078
+ errorMessage: "invalidFormatForNZDriversLicenseCardNumber",
15079
+ modes: ["blur"]
15080
+ }]
14513
15081
  };
14514
- const idNumberFields = ["idNumber", "idNumberExempt"];
14515
- function IdentityNumber(props) {
15082
+ const DriversLicense = ({
15083
+ driversLicense: driversLicense2,
15084
+ onLicenseNumberInput,
15085
+ onLicenseNumberBlur,
15086
+ onCardNumberInput,
15087
+ onCardNumberBlur,
15088
+ formUtils: {
15089
+ getLabel
15090
+ },
15091
+ isValid,
15092
+ errorMessages
15093
+ }) => {
14516
15094
  const {
14517
15095
  i18n
14518
15096
  } = useI18nContext();
14519
- const {
14520
- dataStoreId,
14521
- country: country2,
14522
- errors: propErrors,
14523
- data: propData,
14524
- requiredFields,
14525
- fieldValidationErrors,
14526
- maskedFields,
14527
- classNames,
14528
- dataPlaceholder
14529
- } = props;
14530
- const stateRef = useRef$1({
14531
- setState: null
15097
+ return jsxs(Fragment, {
15098
+ children: [jsxs("div", {
15099
+ className: "adyen-kyc-field-wrapper",
15100
+ children: [jsx(Field, {
15101
+ name: "licenseNumber",
15102
+ label: getLabel("idNumber", "licenseNumber"),
15103
+ isValid: isValid.idNumber,
15104
+ errorMessage: errorMessages.idNumber,
15105
+ children: (childProps) => jsx(InputText, {
15106
+ ...childProps,
15107
+ name: "licenseNumber",
15108
+ value: driversLicense2.idNumber,
15109
+ onInput: onLicenseNumberInput,
15110
+ onBlur: onLicenseNumberBlur,
15111
+ placeholder: ""
15112
+ })
15113
+ }), jsx(Field, {
15114
+ name: "licenseCardNumber",
15115
+ label: getLabel("licenceVersionNumber"),
15116
+ isValid: isValid.licenseCardNumber,
15117
+ errorMessage: errorMessages.licenseCardNumber,
15118
+ children: (childProps) => jsx(InputText, {
15119
+ ...childProps,
15120
+ name: "licenseCardNumber",
15121
+ value: driversLicense2.licenseCardNumber,
15122
+ onInput: onCardNumberInput,
15123
+ onBlur: onCardNumberBlur,
15124
+ placeholder: ""
15125
+ })
15126
+ })]
15127
+ }), jsx(ContextGuidance, {
15128
+ page: "Personal details",
15129
+ title: i18n.get("whereCanIFindTheseNumbersOnMyDriversLicense"),
15130
+ content: jsxs(Fragment, {
15131
+ children: [i18n.get("whereToFindNumbersOnDriversLicense__NZ"), " ", jsx("a", {
15132
+ href: "https://www.nzta.govt.nz/driver-licences/getting-a-licence/your-driver-licence-explained/",
15133
+ target: "_blank",
15134
+ rel: "noreferrer",
15135
+ children: i18n.get("iStillCantFindIt")
15136
+ })]
15137
+ }),
15138
+ titleId: "whereCanIFindTheseNumbersOnMyDriversLicense",
15139
+ contentId: "whereToFindNumbersOnDriversLicense"
15140
+ })]
14532
15141
  });
14533
- const formUtils = formUtilities(props, i18n);
14534
- const [errors, setErrors] = useState(propErrors);
14535
- const [data, setData] = useState({
14536
- ...propData,
14537
- idNumberExempt: !!(propData == null ? void 0 : propData.idNumberExempt)
15142
+ };
15143
+ const PassportNumber = ({
15144
+ passportNumber: passportNumber2,
15145
+ onInput,
15146
+ onBlur,
15147
+ formUtils: {
15148
+ getLabel
15149
+ },
15150
+ errorMessage,
15151
+ isValid
15152
+ }) => jsx(Field, {
15153
+ name: "passportNumber",
15154
+ label: getLabel("idNumber", "passportNumber"),
15155
+ errorMessage,
15156
+ isValid,
15157
+ children: (childProps) => jsx(InputText, {
15158
+ ...childProps,
15159
+ name: "passportNumber",
15160
+ value: passportNumber2,
15161
+ onInput,
15162
+ onBlur,
15163
+ placeholder: ""
15164
+ })
15165
+ });
15166
+ const mapIdentityTypeToItem = (type, label) => ({
15167
+ id: type,
15168
+ name: label
15169
+ });
15170
+ const TypeOfIdentity = ({
15171
+ availableIdentityTypes,
15172
+ selectedIdentityType,
15173
+ setSelectedIdentityType,
15174
+ formUtils: {
15175
+ getLabel
15176
+ },
15177
+ errorMessage,
15178
+ isValid
15179
+ }) => {
15180
+ const {
15181
+ i18n
15182
+ } = useI18nContext();
15183
+ return jsx(Field, {
15184
+ name: "typeOfIdentity",
15185
+ label: getLabel("typeOfIdentity"),
15186
+ errorMessage,
15187
+ isValid,
15188
+ helper: i18n.get("typeOfIdentitySubtitle"),
15189
+ children: (childProps) => jsx(Select, {
15190
+ ...childProps,
15191
+ isInvalid: false,
15192
+ items: availableIdentityTypes.map((type) => mapIdentityTypeToItem(type, i18n.get(type))),
15193
+ placeholder: i18n.get("id"),
15194
+ selected: selectedIdentityType,
15195
+ onChange: (event) => setSelectedIdentityType(event.target.value)
15196
+ })
14538
15197
  });
14539
- const formattingRules = useMemo(() => mergeCountryBasedRulesets({}, countryIdNumberFormatters, country2), [country2]);
14540
- const validationRules = useMemo(() => mergeCountryBasedValidators(IdNumberValidationRules, countryIdNumberValidationRules, country2), [country2]);
14541
- const maxLengthForField = getMaxLengthByFormatRuleset(formattingRules, "idNumber");
15198
+ };
15199
+ function IdentityNZComponent(props) {
15200
+ var _a;
15201
+ if (((_a = props.data) == null ? void 0 : _a.typeOfIdentity) === "nationalIdNumber") {
15202
+ props.data.typeOfIdentity = void 0;
15203
+ }
14542
15204
  const {
14543
15205
  handleChangeFor,
14544
- data: formData,
14545
- valid,
14546
- errors: formErrors,
15206
+ triggerValidation,
15207
+ data,
15208
+ errors,
14547
15209
  fieldProblems,
14548
- setValid,
14549
- setErrors: setFormErrors,
14550
- triggerValidation
15210
+ valid
14551
15211
  } = useForm({
14552
15212
  ...props,
14553
- schema: requiredFields ?? idNumberFields,
14554
- formatters: formattingRules,
14555
- rules: validationRules,
14556
- defaultData: propData,
14557
- fieldProblems: fieldValidationErrors,
14558
- maskedFields
15213
+ schema: props.requiredFields ?? [],
15214
+ defaultData: props.data,
15215
+ fieldProblems: props.fieldValidationErrors,
15216
+ rules: nzIdentityValidationRules,
15217
+ maskedFields: props.maskedFields
14559
15218
  });
14560
15219
  useEffect(() => {
14561
- if (propErrors && propErrors.idNumber) {
14562
- const idNumberFieldErrors = pick("idNumber").from(propErrors);
14563
- setErrors({
14564
- ...errors,
14565
- ...idNumberFieldErrors
14566
- });
14567
- setValid("idNumber", false);
14568
- }
14569
- }, [propErrors]);
14570
- useEffect(() => {
14571
- if (data.idNumber) {
15220
+ if (data.typeOfIdentity)
14572
15221
  triggerValidation(["idNumber"]);
14573
- }
14574
- }, [country2]);
14575
- useEffect(() => {
14576
- const dataHasChanged = !objectsDeepEqual(data, formData);
14577
- const persistExternalErrors = !!(!dataHasChanged && propErrors && Object.keys(propErrors).length);
14578
- const newErrors = {
14579
- ...formErrors,
14580
- ...persistExternalErrors && errors
14581
- };
14582
- if (!objectsDeepEqual(errors, newErrors)) {
14583
- setErrors(newErrors);
14584
- }
14585
- if (persistExternalErrors) {
14586
- setValid("idNumber", false);
14587
- }
14588
- setData({
14589
- ...data,
14590
- ...formData
14591
- });
14592
- }, [formErrors, formData]);
14593
- useEffect(() => {
14594
- var _a, _b;
14595
- const adjustedValid = {
14596
- ...valid
14597
- };
14598
- adjustedValid.idNumber = data.idNumberExempt ? true : valid.idNumber;
14599
- const adjustedData = {
15222
+ }, [data.typeOfIdentity]);
15223
+ const {
15224
+ sliceData,
15225
+ updateStateSlice
15226
+ } = useGlobalDataSlice("personalDetails");
15227
+ useEffect(() => updateStateSlice({
15228
+ data: {
15229
+ ...sliceData,
14600
15230
  ...data
14601
- };
14602
- adjustedData.idNumber = data.idNumberExempt ? void 0 : data.idNumber;
14603
- if (data.idNumberExempt && formErrors.idNumber !== null)
14604
- setFormErrors("idNumber", null);
14605
- (_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14606
- type: "addToState",
14607
- value: {
14608
- data: adjustedData,
14609
- valid: adjustedValid,
14610
- errors,
14611
- fieldProblems,
14612
- caller: "idNum",
14613
- dataStoreId
15231
+ },
15232
+ errors,
15233
+ valid,
15234
+ fieldProblems
15235
+ }), [data, errors, valid, fieldProblems]);
15236
+ const {
15237
+ i18n
15238
+ } = useI18nContext();
15239
+ const formUtils = formUtilities(props, i18n);
15240
+ const availableIdentityTypes = ["passport", "driversLicense"];
15241
+ return jsxs(Fragment, {
15242
+ children: [jsx(TypeOfIdentity, {
15243
+ availableIdentityTypes: identityTypes.filter((type) => availableIdentityTypes.includes(type)),
15244
+ selectedIdentityType: data.typeOfIdentity,
15245
+ setSelectedIdentityType: handleChangeFor("typeOfIdentity"),
15246
+ formUtils,
15247
+ isValid: valid.typeOfIdentity,
15248
+ errorMessage: formUtils.getErrorMessage("typeOfIdentity", errors, fieldProblems)
15249
+ }), data.typeOfIdentity === "passport" ? jsx(PassportNumber, {
15250
+ passportNumber: data.idNumber ?? "",
15251
+ onInput: handleChangeFor("idNumber", "input"),
15252
+ onBlur: handleChangeFor("idNumber", "blur"),
15253
+ formUtils,
15254
+ isValid: valid.idNumber,
15255
+ errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems)
15256
+ }) : data.typeOfIdentity === "driversLicense" ? jsx(DriversLicense, {
15257
+ driversLicense: data,
15258
+ onLicenseNumberInput: handleChangeFor("idNumber", "input"),
15259
+ onLicenseNumberBlur: handleChangeFor("idNumber", "blur"),
15260
+ onCardNumberInput: handleChangeFor("licenseCardNumber", "input"),
15261
+ onCardNumberBlur: handleChangeFor("licenseCardNumber", "blur"),
15262
+ formUtils,
15263
+ isValid: {
15264
+ idNumber: valid.idNumber,
15265
+ licenseCardNumber: valid.licenseCardNumber
15266
+ },
15267
+ errorMessages: {
15268
+ idNumber: formUtils.getErrorMessage("idNumber", errors, fieldProblems),
15269
+ licenseCardNumber: formUtils.getErrorMessage("licenseCardNumber", errors, fieldProblems)
14614
15270
  }
14615
- });
14616
- }, [data, valid, errors, fieldProblems, dataStoreId]);
14617
- const classModifiers = [formUtils.isRequiredField("idNumberExempt") ? "idNumberWithExempt" : "idNumber"];
14618
- if (classNames)
14619
- classModifiers.push(...classNames);
14620
- return jsx("div", {
14621
- className: "adyen-kyc-field__id-number",
14622
- children: formUtils.isRequiredField("idNumber") && jsxs(Fragment, {
14623
- children: [jsx(Field, {
14624
- name: "idNumber",
14625
- label: formUtils.getLabel("idNumber"),
14626
- classNameModifiers: classModifiers,
14627
- errorMessage: formUtils.getErrorMessage("idNumber", errors, fieldProblems),
14628
- disabled: data.idNumberExempt,
14629
- isValid: valid.idNumber,
14630
- dataPlaceholder: data.idNumber && dataPlaceholder,
14631
- children: (childProps) => jsx(InputText, {
14632
- ...childProps,
14633
- name: "idNumber",
14634
- value: data.idNumber,
14635
- placeholder: formUtils.getPlaceholder("idNumber"),
14636
- readonly: formUtils.isReadOnly("idNumber"),
14637
- onInput: handleChangeFor("idNumber", "input"),
14638
- onBlur: handleChangeFor("idNumber", "blur"),
14639
- "aria-required": true,
14640
- "aria-label": formUtils.getLabel("idNumber", "idNumber"),
14641
- "aria-invalid": !valid.idNumber,
14642
- inputMode: "numeric",
14643
- maxLength: maxLengthForField,
14644
- ...data.idNumberExempt && {
14645
- disabled: true
14646
- }
14647
- })
14648
- }), jsx(Field, {
14649
- classNameModifiers: ["idNumber__checkbox"],
14650
- name: "idNumberExempt",
14651
- children: (childProps) => formUtils.isRequiredField("idNumberExempt") && jsx(Checkbox, {
14652
- ...childProps,
14653
- label: formUtils.getLabel("idNumberExempt"),
14654
- checked: Boolean(data.idNumberExempt),
14655
- classNameModifiers: ["idNumberExempt"],
14656
- name: "idNumberExempt",
14657
- onChange: handleChangeFor("idNumberExempt")
14658
- })
14659
- }), jsx(StateContextSetter, {
14660
- owner: "IdNumberComp",
14661
- stateRef
14662
- })]
14663
- })
15271
+ }) : void 0]
14664
15272
  });
14665
15273
  }
14666
- const IdentityNumberComponent = memo(IdentityNumber, (prevProps, nextProps) => prevProps.country === nextProps.country && prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.errors, nextProps.errors) && objectsDeepEqual(prevProps.labels, nextProps.labels) && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors));
14667
- IdentityNumberComponent.defaultProps = {
14668
- data: {},
14669
- onChange: () => {
14670
- }
14671
- };
15274
+ const nzIdentityFields = [...additionalIdentityInfoFields, "idNumber"];
14672
15275
  const ERROR_CODES = {
14673
15276
  SSN_REMEDIATION: "1_316",
14674
15277
  SSN_4_DIGITS_VALIDATION: "1_3062",
@@ -14708,297 +15311,59 @@ const IdentityUSComponent = forwardRef((props, ref) => {
14708
15311
  USIdentityProps.dataPlaceholder = "*** — ** — ";
14709
15312
  }
14710
15313
  return jsx(IdentityNumberComponent, {
14711
- ...USIdentityProps,
14712
- ref
14713
- });
14714
- });
14715
- const handleKeys = (keys, callback, propagationMode = "stopIfMatches") => (event) => {
14716
- if (propagationMode === "stop")
14717
- event.stopPropagation();
14718
- if (keys.includes(event.key)) {
14719
- if (propagationMode === "stopIfMatches")
14720
- event.stopPropagation();
14721
- callback();
14722
- }
14723
- };
14724
- const styles = {
14725
- "adyen-kyc-multi-select-list": "adyen-kyc-multi-select-list",
14726
- "adyen-kyc-multi-select-list-item": "adyen-kyc-multi-select-list-item",
14727
- "adyen-kyc-multi-select-list-item--with-description": "adyen-kyc-multi-select-list-item--with-description",
14728
- "adyen-kyc-checkbox__label": "adyen-kyc-checkbox__label"
14729
- };
14730
- const MultiSelectList = ({
14731
- options,
14732
- selected,
14733
- onSelect,
14734
- mapToSelectItem
14735
- }) => jsx("ul", {
14736
- className: styles["adyen-kyc-multi-select-list"],
14737
- children: options.map((option) => {
14738
- const item = mapToSelectItem(option);
14739
- const isSelected = selected.includes(option);
14740
- const handleSelect = () => {
14741
- const newSelection = isSelected ? selected.filter((selectedOption) => selectedOption !== option) : [...selected, option];
14742
- onSelect(newSelection);
14743
- };
14744
- return jsx(SelectListItem, {
14745
- item,
14746
- selected: isSelected,
14747
- onKeyDown: handleKeys(["Enter", " "], handleSelect),
14748
- onSelect: handleSelect,
14749
- isMulti: true,
14750
- className: cx([styles["adyen-kyc-multi-select-list-item"], {
14751
- [styles["adyen-kyc-multi-select-list-item--with-description"]]: !!item.description
14752
- }])
14753
- }, item.id);
14754
- })
14755
- });
14756
- const decisionMakerRoleValidationRules = {
14757
- role: {
14758
- modes: ["blur"],
14759
- validate: (role2) => !!(role2 == null ? void 0 : role2.length),
14760
- errorMessage: "fieldIsRequired"
14761
- }
14762
- };
14763
- const decisionMakerRoleFields = ["role"];
14764
- const DecisionMakerRoleComponent = (props) => {
14765
- const {
14766
- data: dataProp,
14767
- dataStoreId,
14768
- validators,
14769
- fieldValidationErrors,
14770
- requiredFields,
14771
- allowedRoles
14772
- } = props;
14773
- const {
14774
- i18n
14775
- } = useI18nContext();
14776
- const {
14777
- data,
14778
- valid,
14779
- errors,
14780
- isValid,
14781
- fieldProblems,
14782
- handleChangeFor
14783
- } = useForm({
14784
- ...props,
14785
- schema: requiredFields || ["role"],
14786
- rules: validators || decisionMakerRoleValidationRules,
14787
- defaultData: dataProp,
14788
- fieldProblems: fieldValidationErrors
14789
- });
14790
- const [decisionMakerRoles2, setDecisionMakerRoles] = useState([]);
14791
- const stateRef = useRef$1({
14792
- setState: null
14793
- });
14794
- const formUtils = formUtilities(props, i18n);
14795
- const allowedRolesString = allowedRoles == null ? void 0 : allowedRoles.toString();
14796
- const makeSelectItemForDecisionMakerRole = (role2) => {
14797
- const validRole = decisionMakerRoles2.find((item) => item.id === role2);
14798
- return {
14799
- ...validRole,
14800
- disabled: !(allowedRoles == null ? void 0 : allowedRoles.includes(validRole == null ? void 0 : validRole.id))
14801
- };
14802
- };
14803
- const changeRoles = (roles) => {
14804
- handleChangeFor("role", "input")(roles);
14805
- };
14806
- useEffect(() => {
14807
- var _a, _b;
14808
- (_b = (_a = stateRef.current).setState) == null ? void 0 : _b.call(_a, {
14809
- type: "addToState",
14810
- value: {
14811
- data,
14812
- valid,
14813
- errors,
14814
- fieldProblems,
14815
- caller: "Role",
14816
- dataStoreId
14817
- }
14818
- });
14819
- }, [data, valid, errors, isValid, dataStoreId, fieldProblems]);
14820
- useEffect(() => {
14821
- setDecisionMakerRoles(getTranslatedDecisionMakerRoles(i18n, allowedRoles));
14822
- }, [allowedRoles, allowedRolesString, i18n, i18n.languageCode, i18n.locale]);
14823
- return jsxs("div", {
14824
- className: "adyen-kyc-field__role",
14825
- children: [jsx(StateContextSetter, {
14826
- stateRef
14827
- }), formUtils.isRequiredField("role", false) && jsx(Field, {
14828
- name: "role",
14829
- classNameModifiers: ["role"],
14830
- label: formUtils.getLabel("role", "selectAllTheRolesThatThisDecisionMakerHolds"),
14831
- errorMessage: formUtils.getErrorMessage("role", errors, fieldProblems),
14832
- isValid: valid.role,
14833
- showErrorIconBottom: true,
14834
- children: (childProps) => jsx(MultiSelectList, {
14835
- ...childProps,
14836
- options: allowedRoles ?? [],
14837
- selected: data.role ?? [],
14838
- onSelect: changeRoles,
14839
- mapToSelectItem: makeSelectItemForDecisionMakerRole
14840
- })
14841
- })]
14842
- });
14843
- };
14844
- const nameValidationRules = {
14845
- firstName: [{
14846
- validate: hasText,
14847
- errorMessage: "fieldIsRequired",
14848
- modes: ["blur"]
14849
- }],
14850
- lastName: [{
14851
- validate: hasText,
14852
- errorMessage: "fieldIsRequired",
14853
- modes: ["blur"]
14854
- }]
14855
- };
14856
- const specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS.replace("-", ""));
14857
- const nameFormatters = {
14858
- firstName: {
14859
- // formatter: trimValWithOneSpace // just trim
14860
- // Example - removing disallowed chars as they are input: then they don't end up in state
14861
- formatter: (val) => val ? trimValWithOneSpace(val).replace(specialCharsRegEx, "") : void 0
14862
- // trim & replace
14863
- },
14864
- lastName: {
14865
- formatter: (val) => val ? trimValWithOneSpace(val).replace(specialCharsRegEx, "") : void 0
14866
- }
14867
- };
14868
- const nameFields = ["firstName", "lastName"];
14869
- function NameComponent(props) {
14870
- const {
14871
- i18n
14872
- } = useI18nContext();
14873
- const schema = props.requiredFields || ["firstName", "lastName"];
14874
- const {
14875
- handleChangeFor,
14876
- data,
14877
- valid,
14878
- errors,
14879
- fieldProblems,
14880
- isValid
14881
- } = useForm({
14882
- ...props,
14883
- schema,
14884
- rules: nameValidationRules,
14885
- formatters: nameFormatters,
14886
- defaultData: props.data,
14887
- fieldProblems: props == null ? void 0 : props.fieldValidationErrors
14888
- });
14889
- const {
14890
- dataStoreId
14891
- } = props;
14892
- const stateRef = useRef$1({
14893
- setState: null
14894
- });
14895
- useEffect(() => {
14896
- var _a, _b, _c;
14897
- (_b = (_a = stateRef.current) == null ? void 0 : _a.setState) == null ? void 0 : _b.call(_a, {
14898
- type: "addToState",
14899
- value: {
14900
- data,
14901
- valid,
14902
- errors,
14903
- fieldProblems,
14904
- caller: "name",
14905
- dataStoreId
14906
- }
15314
+ ...USIdentityProps,
15315
+ ref
15316
+ });
15317
+ });
15318
+ function IdentityComponent(props) {
15319
+ var _a;
15320
+ const {
15321
+ personalDetails: personalDetails2,
15322
+ country: country2,
15323
+ errors
15324
+ } = props;
15325
+ const identityProps = getFieldProps(personalDetails2, idNumberFields);
15326
+ if (!((_a = identityProps == null ? void 0 : identityProps.requiredFields) == null ? void 0 : _a.length)) {
15327
+ return null;
15328
+ }
15329
+ if (country2 === "AU") {
15330
+ const auIdentityProps = getFieldProps(personalDetails2, auIdentityFields);
15331
+ return jsx(IdentityAuComponent, {
15332
+ ...auIdentityProps,
15333
+ dataStoreId: personalDetails2.id
14907
15334
  });
14908
- (_c = props.onChange) == null ? void 0 : _c.call(props, {
14909
- schema,
14910
- data,
14911
- valid,
15335
+ }
15336
+ if (country2 === "HK") {
15337
+ const hkIdentityProps = getFieldProps(personalDetails2, hkIdentityFields);
15338
+ return jsx(IdentityHKComponent, {
15339
+ ...hkIdentityProps,
15340
+ dataStoreId: personalDetails2.id
15341
+ });
15342
+ }
15343
+ if (country2 === "US") {
15344
+ return jsx(IdentityUSComponent, {
15345
+ ...identityProps,
14912
15346
  errors,
14913
- fieldProblems,
14914
- isValid
15347
+ dataStoreId: personalDetails2.id,
15348
+ country: country2,
15349
+ formVerificationErrors: personalDetails2.formVerificationErrors
14915
15350
  });
14916
- }, [data, valid, errors, isValid]);
14917
- const formUtils = formUtilities(props, i18n);
14918
- return jsxs("div", {
14919
- className: "adyen-kyc-field-wrapper",
14920
- children: [jsx(StateContextSetter, {
14921
- stateRef
14922
- }), formUtils.isRequiredField("firstName") && jsx(Field, {
14923
- name: "firstName",
14924
- label: formUtils.getLabel("firstName"),
14925
- classNameModifiers: ["firstName", "col-50"],
14926
- errorMessage: formUtils.getErrorMessage("firstName", errors, fieldProblems),
14927
- isValid: valid.firstName,
14928
- helper: formUtils.getLabel("enterNameExactlyAsAppearInID"),
14929
- children: (childProps) => jsx(InputText, {
14930
- ...childProps,
14931
- name: "firstName",
14932
- value: data.firstName,
14933
- classNameModifiers: ["name"],
14934
- readonly: formUtils.isReadOnly("firstName"),
14935
- onInput: handleChangeFor("firstName", "input"),
14936
- onBlur: handleChangeFor("firstName", "blur"),
14937
- trimOnBlur: true,
14938
- spellCheck: false,
14939
- "aria-required": true,
14940
- "aria-label": formUtils.getLabel("firstName"),
14941
- "aria-invalid": !valid.firstName
14942
- })
14943
- }), formUtils.isRequiredField("lastName") && jsx(Field, {
14944
- name: "lastName",
14945
- label: formUtils.getLabel("lastName"),
14946
- classNameModifiers: ["lastName", "col-50"],
14947
- errorMessage: formUtils.getErrorMessage("lastName", errors, fieldProblems),
14948
- isValid: valid.lastName,
14949
- helper: formUtils.getLabel("enterLastNameExactlyAsAppearInID"),
14950
- children: (childProps) => jsx(InputText, {
14951
- ...childProps,
14952
- name: "lastName",
14953
- value: data.lastName,
14954
- classNameModifiers: ["lastName"],
14955
- readonly: formUtils.isReadOnly("lastName"),
14956
- onInput: handleChangeFor("lastName", "input"),
14957
- onBlur: handleChangeFor("lastName", "blur"),
14958
- trimOnBlur: true,
14959
- spellCheck: false,
14960
- "aria-required": true,
14961
- "aria-label": formUtils.getLabel("lastName"),
14962
- "aria-invalid": !valid.lastName
14963
- })
14964
- })]
15351
+ }
15352
+ if (country2 === "NZ") {
15353
+ const nzIdentityProps = getFieldProps(personalDetails2, nzIdentityFields);
15354
+ return jsx(IdentityNZComponent, {
15355
+ ...nzIdentityProps,
15356
+ dataStoreId: personalDetails2.id
15357
+ });
15358
+ }
15359
+ return jsx(IdentityNumberComponent, {
15360
+ ...identityProps,
15361
+ errors,
15362
+ country: country2,
15363
+ dataStoreId: personalDetails2.id
14965
15364
  });
14966
15365
  }
14967
- const Name = memo(NameComponent, (prevProps, nextProps) => prevProps.shouldValidate === nextProps.shouldValidate && objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors));
14968
- NameComponent.defaultProps = {
14969
- data: {},
14970
- onChange: () => {
14971
- },
14972
- visibility: "editable",
14973
- validationRules: nameValidationRules
14974
- };
14975
- const personalDetailsValidationRules = {
14976
- birthDate: [{
14977
- modes: ["blur"],
14978
- validate: (birthDate2) => !!birthDate2,
14979
- errorMessage: "fieldIsRequired"
14980
- }, {
14981
- modes: ["blur"],
14982
- validate: (birthDate2) => birthDate2 && new Date(birthDate2) < /* @__PURE__ */ new Date(),
14983
- errorMessage: "invalidDateOfBirth"
14984
- }],
14985
- residencyCountry: {
14986
- modes: ["blur"],
14987
- validate: (residencyCountry2) => !!residencyCountry2,
14988
- errorMessage: "fieldIsRequired"
14989
- },
14990
- nationality: {
14991
- modes: ["blur"],
14992
- validate: (nationality2) => !!nationality2,
14993
- errorMessage: "fieldIsRequired"
14994
- },
14995
- jobTitle: {
14996
- modes: ["blur"],
14997
- validate: (jobTitle2) => !!jobTitle2,
14998
- errorMessage: "fieldIsRequired"
14999
- }
15000
- };
15001
- const personalDetailsFields = [...nameFields, "birthDate", ...idNumberFields, ...additionalIdentityInfoFields$1, "residencyCountry", "nationality", "jobTitle", ...decisionMakerRoleFields, ...contactDetailFields, ...accountHolderFields];
15366
+ const personalDetailsFields = [...nameFields, "birthDate", ...idNumberFields, ...additionalIdentityInfoFields$2, "residencyCountry", "nationality", "jobTitle", ...decisionMakerRoleFields, ...contactDetailFields, ...accountHolderFields];
15002
15367
  function PersonalDetailsComponent(props) {
15003
15368
  const {
15004
15369
  i18n
@@ -15037,9 +15402,6 @@ function PersonalDetailsComponent(props) {
15037
15402
  } = useVerification(props.verifyFields, data.residencyCountry);
15038
15403
  const decisionMakerRoleProps = getFieldProps(props, decisionMakerRoleFields);
15039
15404
  const nameProps = getFieldProps(props, nameFields);
15040
- const identityProps = getFieldProps(props, idNumberFields);
15041
- const identityAuProps = getFieldProps(props, auIdentityFields);
15042
- const identityHKProps = getFieldProps(props, hkIdentityFields);
15043
15405
  const contactDetailsFormProps = getFieldProps(props, contactDetailFields);
15044
15406
  const accountHolderProps = getFieldProps(props, accountHolderFields);
15045
15407
  this.verifyForm = () => {
@@ -15167,36 +15529,26 @@ function PersonalDetailsComponent(props) {
15167
15529
  max: formatDateObj(/* @__PURE__ */ new Date())
15168
15530
  })
15169
15531
  }), formUtils.isRequiredField("residencyCountry") && jsx(CountryField, {
15532
+ data: data.residencyCountry,
15533
+ valid: valid == null ? void 0 : valid.residencyCountry,
15534
+ error: formUtils.getErrorMessage("residencyCountry", errors, fieldProblems),
15170
15535
  label: formUtils.getLabel("residencyCountry"),
15536
+ readonly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask,
15171
15537
  allowedCountries: [],
15172
15538
  classNameModifiers: ["country"],
15173
- errorMessage: formUtils.getErrorMessage("residencyCountry", errors, fieldProblems),
15174
- onDropdownChange: handleChangeFor("residencyCountry", "input"),
15175
- value: data.residencyCountry,
15176
- readOnly: !isAllowedEditPrefilledCountry && !isDecisionMakerTask
15177
- }), hasRequiredFields(identityProps) && (data.residencyCountry === "HK" ? jsx(IdentityHKComponent, {
15178
- ...identityHKProps,
15179
- dataStoreId: PERSONAL_DETAILS
15180
- }) : data.residencyCountry === "AU" ? jsx(IdentityAuComponent, {
15181
- ...identityAuProps,
15182
- dataStoreId: PERSONAL_DETAILS
15183
- }) : data.residencyCountry === "US" ? jsx(IdentityUSComponent, {
15184
- ...identityProps,
15185
- errors: externalErrors,
15186
- dataStoreId: PERSONAL_DETAILS,
15539
+ handleChangeFor: () => handleChangeFor("residencyCountry", "input")
15540
+ }), jsx(IdentityComponent, {
15541
+ personalDetails: props,
15187
15542
  country: data.residencyCountry,
15188
- formVerificationErrors: props.formVerificationErrors
15189
- }) : jsx(IdentityNumberComponent, {
15190
- ...identityProps,
15191
- errors: externalErrors,
15192
- country: data.residencyCountry,
15193
- dataStoreId: PERSONAL_DETAILS
15194
- })), (data.residencyCountry === "SG" || data.residencyCountry === "HK") && formUtils.isRequiredField("nationality") && jsx(CountryField, {
15543
+ errors: externalErrors
15544
+ }), (data.residencyCountry === "SG" || data.residencyCountry === "HK") && formUtils.isRequiredField("nationality") && jsx(CountryField, {
15545
+ data: data.nationality,
15546
+ valid: valid == null ? void 0 : valid.nationality,
15547
+ error: formUtils.getErrorMessage("nationality", errors, fieldProblems),
15195
15548
  label: formUtils.getLabel("nationality"),
15549
+ readonly: formUtils.isReadOnly("nationality"),
15196
15550
  classNameModifiers: ["nationality"],
15197
- errorMessage: formUtils.getErrorMessage("nationality", errors, fieldProblems),
15198
- onDropdownChange: handleChangeFor("nationality", "input"),
15199
- value: data.nationality
15551
+ handleChangeFor: () => handleChangeFor("nationality", "input")
15200
15552
  }), hasRequiredFields(contactDetailsFormProps) && jsx(ContactDetailsComp, {
15201
15553
  ...contactDetailsFormProps,
15202
15554
  dataStoreId: PERSONAL_DETAILS,
@@ -17751,13 +18103,14 @@ function PayoutVerificationMethod(props) {
17751
18103
  }
17752
18104
  })]
17753
18105
  }), jsx(CountryField, {
18106
+ data: data.bankCountry,
18107
+ valid: valid == null ? void 0 : valid.bankCountry,
18108
+ error: formUtils.getErrorMessage("bankCountry", errors, fieldProblems),
17754
18109
  label: formUtils.getLabel("bankCountry", "bankAccountCountry"),
18110
+ readonly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
17755
18111
  allowedCountries: allowedBankCountries,
17756
18112
  classNameModifiers: ["country"],
17757
- errorMessage: formUtils.getErrorMessage("bankCountry", errors, fieldProblems),
17758
- onDropdownChange: handleChangeFor("bankCountry", "input"),
17759
- value: data.bankCountry,
17760
- readOnly: !intraRegionCrossBorderPayoutsAllowed || allowedBankCountries.length === 1,
18113
+ handleChangeFor: () => handleChangeFor("bankCountry", "input"),
17761
18114
  helperText: intraRegionCrossBorderPayoutsAllowed ? void 0 : i18n.get(props.legalEntityType === LegalEntityType.INDIVIDUAL ? "youCanOnlyUseABankAccountInTheCountryWhereYouLive" : "youCanOnlyUseABankAccountInTheCountryWhereYourCompanyIsRegistered")
17762
18115
  }), jsx(Field, {
17763
18116
  name: "verificationMethods",
@@ -18082,59 +18435,63 @@ function SolePropComponent(props) {
18082
18435
  const legalCompanyName2 = (_b = (_a = currentState.data) == null ? void 0 : _a.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName;
18083
18436
  setTradingName(((_c = solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data) == null ? void 0 : _c.tradingName) || legalCompanyName2);
18084
18437
  };
18085
- const renderActiveForm = (activeForm) => jsxs(Fragment, {
18086
- children: [jsx(StateContextWatcher, {
18087
- owner: "SolePropComponent",
18088
- onChange: handleStateChange
18089
- }), jsx("div", {
18090
- className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18091
- children: jsx(CompanyNameAndCountryComponent, {
18092
- ...solePropNameAndCountryFormProps,
18093
- data: {
18094
- ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18095
- companyCountry: props.country
18096
- },
18097
- labels: {
18098
- companyCountry: "countryOfEstablishment",
18099
- legalCompanyName: "legalNameOfSoleProprietor"
18100
- },
18101
- heading: i18n.get("nameAndCountry"),
18102
- id: solePropNameAndCountryFormId,
18103
- disableCountry: true
18104
- })
18105
- }), jsx("div", {
18106
- className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18107
- children: jsx(CompanyDetailsComponent, {
18108
- ...solePropsRegistrationDetailsFormProps,
18109
- data: {
18110
- ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18111
- tradingName: tradingName2
18112
- },
18113
- heading: i18n.get("registrationDetails"),
18114
- id: solePropRegistrationDetailsFormId,
18115
- companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18116
- country: props.country
18117
- })
18118
- }), jsx("div", {
18119
- className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18120
- children: jsx(RegistrationAddressComponent, {
18121
- ...solePropRegistrationAddressFormProps,
18122
- heading: i18n.get("registeredAddress"),
18123
- id: solePropRegistrationAddressFormId,
18124
- country: props.country,
18125
- problems: props == null ? void 0 : props.problems,
18126
- handleAddressSearch: props.handleAddressSearch,
18127
- handleFindAddress: props.handleFindAddress
18128
- })
18129
- }), jsx("div", {
18130
- className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18131
- children: jsx(ConstitutionalDocumentUpload, {
18132
- ...solePropDocumentsFormProps,
18133
- id: solePropDocumentFormId,
18134
- legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18135
- })
18136
- })]
18137
- });
18438
+ const renderActiveForm = (activeForm) => {
18439
+ var _a;
18440
+ return jsxs(Fragment, {
18441
+ children: [jsx(StateContextWatcher, {
18442
+ owner: "SolePropComponent",
18443
+ onChange: handleStateChange
18444
+ }), jsx("div", {
18445
+ className: activeForm.formId !== solePropNameAndCountryFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18446
+ children: jsx(CompanyNameAndCountryComponent, {
18447
+ ...solePropNameAndCountryFormProps,
18448
+ data: {
18449
+ ...solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data,
18450
+ country: props == null ? void 0 : props.country,
18451
+ legalCompanyName: (_a = solePropNameAndCountryFormProps == null ? void 0 : solePropNameAndCountryFormProps.data) == null ? void 0 : _a.legalCompanyName
18452
+ },
18453
+ labels: {
18454
+ country: "countryOfEstablishment",
18455
+ legalCompanyName: "legalNameOfSoleProprietor"
18456
+ },
18457
+ heading: i18n.get("nameAndCountry"),
18458
+ id: solePropNameAndCountryFormId,
18459
+ disableCountry: true
18460
+ })
18461
+ }), jsx("div", {
18462
+ className: activeForm.formId !== solePropRegistrationDetailsFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18463
+ children: jsx(CompanyDetailsComponent, {
18464
+ ...solePropsRegistrationDetailsFormProps,
18465
+ data: {
18466
+ ...solePropsRegistrationDetailsFormProps == null ? void 0 : solePropsRegistrationDetailsFormProps.data,
18467
+ tradingName: tradingName2
18468
+ },
18469
+ heading: i18n.get("registrationDetails"),
18470
+ id: solePropRegistrationDetailsFormId,
18471
+ companyType: CompanyTypesValue.SOLE_PROPRIETORSHIP,
18472
+ country: props.country
18473
+ })
18474
+ }), jsx("div", {
18475
+ className: activeForm.formId !== solePropRegistrationAddressFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18476
+ children: jsx(RegistrationAddressComponent, {
18477
+ ...solePropRegistrationAddressFormProps,
18478
+ heading: i18n.get("registeredAddress"),
18479
+ id: solePropRegistrationAddressFormId,
18480
+ country: props.country,
18481
+ problems: props == null ? void 0 : props.problems,
18482
+ handleAddressSearch: props.handleAddressSearch,
18483
+ handleFindAddress: props.handleFindAddress
18484
+ })
18485
+ }), jsx("div", {
18486
+ className: activeForm.formId !== solePropDocumentFormId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper",
18487
+ children: jsx(ConstitutionalDocumentUpload, {
18488
+ ...solePropDocumentsFormProps,
18489
+ id: solePropDocumentFormId,
18490
+ legalEntityType: LegalEntityType.SOLE_PROPRIETORSHIP
18491
+ })
18492
+ })]
18493
+ });
18494
+ };
18138
18495
  return jsx("div", {
18139
18496
  className: "adyen-kyc-sol-prop",
18140
18497
  children: renderActiveForm(props.activeForm || solePropForms.solePropNameAndCountry)
@@ -18154,12 +18511,16 @@ const ContextHelper = ({
18154
18511
  })
18155
18512
  });
18156
18513
  var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18514
+ TrustTypes2["BUSINESS_TRUST"] = "businessTrust";
18157
18515
  TrustTypes2["CASH_MANAGEMENT_TRUST"] = "cashManagementTrust";
18516
+ TrustTypes2["CHARTIABLE_TRUST"] = "charitableTrust";
18158
18517
  TrustTypes2["CORPORATE_UNIT_TRUST"] = "corporateUnitTrust";
18159
18518
  TrustTypes2["DECEASED_ESTATE"] = "deceasedEstate";
18160
18519
  TrustTypes2["DISCRETIONARY_INVESTMENT_TRUST"] = "discretionaryInvestmentTrust";
18161
18520
  TrustTypes2["DISCRETIONARY_SERVICES_MANAGEMENT_TRUST"] = "discretionaryServicesManagementTrust";
18162
18521
  TrustTypes2["DISCRETIONARY_TRADING_TRUST"] = "discretionaryTradingTrust";
18522
+ TrustTypes2["DISCRETIONARY_TRUST"] = "discretionaryTrust";
18523
+ TrustTypes2["FAMILY_TRUST"] = "familyTrust";
18163
18524
  TrustTypes2["FIRST_HOME_SAVER_ACCOUNTS_TRUST"] = "firstHomeSaverAccountsTrust";
18164
18525
  TrustTypes2["FIXED_TRUST"] = "fixedTrust";
18165
18526
  TrustTypes2["FIXED_UNIT_TRUST"] = "fixedUnitTrust";
@@ -18172,8 +18533,14 @@ var TrustTypes = /* @__PURE__ */ ((TrustTypes2) => {
18172
18533
  return TrustTypes2;
18173
18534
  })(TrustTypes || {});
18174
18535
  const trustTypeOptions = [{
18536
+ id: TrustTypes.BUSINESS_TRUST,
18537
+ name: "businessTrust"
18538
+ }, {
18175
18539
  id: TrustTypes.CASH_MANAGEMENT_TRUST,
18176
18540
  name: "cashManagementTrust"
18541
+ }, {
18542
+ id: TrustTypes.CHARTIABLE_TRUST,
18543
+ name: "charitableTrust"
18177
18544
  }, {
18178
18545
  id: TrustTypes.CORPORATE_UNIT_TRUST,
18179
18546
  name: "corporateUnitTrust"
@@ -18189,6 +18556,12 @@ const trustTypeOptions = [{
18189
18556
  }, {
18190
18557
  id: TrustTypes.DISCRETIONARY_TRADING_TRUST,
18191
18558
  name: "discretionaryTradingTrust"
18559
+ }, {
18560
+ id: TrustTypes.DISCRETIONARY_TRUST,
18561
+ name: "discretionaryTrust"
18562
+ }, {
18563
+ id: TrustTypes.FAMILY_TRUST,
18564
+ name: "familyTrust"
18192
18565
  }, {
18193
18566
  id: TrustTypes.FIRST_HOME_SAVER_ACCOUNTS_TRUST,
18194
18567
  name: "firstHomeSaverAccountsTrust"
@@ -18300,14 +18673,15 @@ function TrustRegistrationDetailsComponent(props) {
18300
18673
  id: "ariaErrorField"
18301
18674
  }), jsx(ContextHelper, {
18302
18675
  content: i18n.get("makeSureToHaveYourTrustDeed")
18303
- }), formUtils.isRequiredField("country") && jsx(CountryField, {
18304
- label: formUtils.getLabel("country", "countryOfEstablishment"),
18676
+ }), formUtils.isRequiredField(COUNTRY_FIELD) && jsx(CountryField, {
18677
+ data: data.country,
18678
+ valid: valid == null ? void 0 : valid.country,
18679
+ error: formUtils.getErrorMessage(COUNTRY_FIELD, errors, fieldProblems),
18680
+ label: formUtils.getLabel(COUNTRY_FIELD, "countryOfEstablishment"),
18681
+ readonly: formUtils.isReadOnly(COUNTRY_FIELD),
18305
18682
  allowedCountries: ALLOWED_TRUST_COUNTRIES,
18306
- classNameModifiers: ["country"],
18307
- errorMessage: formUtils.getErrorMessage("country", errors, fieldProblems),
18308
- onDropdownChange: handleChangeFor("country"),
18309
- value: data.country,
18310
- readOnly: true
18683
+ classNameModifiers: [COUNTRY_FIELD],
18684
+ handleChangeFor
18311
18685
  }), formUtils.isRequiredField("legalName") && jsx(Field, {
18312
18686
  name: "legalName",
18313
18687
  label: formUtils.getLabel("legalName", "nameOfTrustAgreement"),
@@ -19541,7 +19915,7 @@ const additionalIdentityInfo = {
19541
19915
  rules: ["requiredIfCountryUsesMultipleTypesOfIdentity", "isDirectorIdNumberRequiredForCountry"]
19542
19916
  },
19543
19917
  issuerState: {
19544
- rule: "requiredIfIdentityTypeIsDriversLicense"
19918
+ rule: "issuerStateRequired"
19545
19919
  },
19546
19920
  licenseCardNumber: {
19547
19921
  rule: "requiredIfIdentityTypeIsDriversLicense"
@@ -19717,7 +20091,15 @@ const fieldsPerScenario = {
19717
20091
  }
19718
20092
  }
19719
20093
  };
19720
- const countryConfig = countryConfig$4;
20094
+ const countryConfig = {
20095
+ ...countryConfig$4,
20096
+ [CountryCodes.NewZealand]: {
20097
+ ...countryConfig$4[CountryCodes.NewZealand],
20098
+ registrationNumber: {
20099
+ label: "NZBN"
20100
+ }
20101
+ }
20102
+ };
19721
20103
  function parseIndividualScenarios(scenario, country2) {
19722
20104
  let fieldConfigurations = scenario == null ? void 0 : scenario.reduce((scenarios, scenarioName) => ({
19723
20105
  ...scenarios,
@@ -20041,11 +20423,17 @@ const convertApiFieldNameToSchemaFieldName = (apiField, legalEntityType) => {
20041
20423
  };
20042
20424
  const knownProblematicFields = ["personalDetails.typeOfIdentity", "personalDetails.issuerState"];
20043
20425
  const getFieldsWithExistingData = (legalEntity) => {
20426
+ var _a;
20044
20427
  const apiFieldsWithExistingData = getNestedPropertyKeys(legalEntity);
20045
20428
  const legalEntityType = legalEntity.type;
20046
20429
  if (!legalEntityType)
20047
20430
  return [];
20048
- return apiFieldsWithExistingData.map((field) => convertApiFieldNameToSchemaFieldName(field, legalEntityType)).filter((field) => field !== void 0).filter((field) => !knownProblematicFields.includes(field));
20431
+ const nonDocumentFields = apiFieldsWithExistingData.map((field) => convertApiFieldNameToSchemaFieldName(field, legalEntityType)).filter((field) => field !== void 0).filter((field) => !knownProblematicFields.includes(field));
20432
+ if ((_a = legalEntity.documentDetails) == null ? void 0 : _a.length) {
20433
+ const documentFields = legalEntity.documentDetails.map((document2) => legalEntityDocumentToFieldMapping[legalEntityType][document2.type]).filter((field) => field !== void 0);
20434
+ return [...nonDocumentFields, ...documentFields];
20435
+ }
20436
+ return nonDocumentFields;
20049
20437
  };
20050
20438
  var ToastType = /* @__PURE__ */ ((ToastType2) => {
20051
20439
  ToastType2["LOADING"] = "loading";
@@ -20379,7 +20767,7 @@ function CompanyDropinComponent({
20379
20767
  } = useConfigurationApi();
20380
20768
  const [data, setData] = useState(dataFromResponse);
20381
20769
  const [problems, setProblems] = useState(propProblems);
20382
- const [country2, setCountry] = useState(((_a = data == null ? void 0 : data.companyNameAndCountry) == null ? void 0 : _a.companyCountry) ?? parentCountry);
20770
+ const [country2, setCountry] = useState(((_a = data == null ? void 0 : data.companyNameAndCountry) == null ? void 0 : _a.country) ?? parentCountry);
20383
20771
  const [loadingStatus, setLoadingStatus] = useState("success");
20384
20772
  const formRef = useRef$1(null);
20385
20773
  const baseTrackingPayload = getBaseTrackingPayload({
@@ -20483,7 +20871,7 @@ function CompanyDropinComponent({
20483
20871
  setLoadingStatus("loading");
20484
20872
  const companyTrackingPayload = {
20485
20873
  companyStructure: dataSubmitted.companyType.entityType,
20486
- countryOfRegistration: dataSubmitted.companyNameAndCountry.companyCountry,
20874
+ countryOfRegistration: dataSubmitted.companyNameAndCountry.country,
20487
20875
  legalEntityName: dataSubmitted.companyNameAndCountry.legalCompanyName,
20488
20876
  usedAdditionalAddress: dataSubmitted.companyRegistrationAddress.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
20489
20877
  };
@@ -20660,7 +21048,7 @@ function CompanyDropinComponent({
20660
21048
  activeForm,
20661
21049
  capabilities,
20662
21050
  data: dataFromResponse,
20663
- country: (_b = data == null ? void 0 : data.companyNameAndCountry) == null ? void 0 : _b.companyCountry,
21051
+ country: (_b = data == null ? void 0 : data.companyNameAndCountry) == null ? void 0 : _b.country,
20664
21052
  problems,
20665
21053
  handleAddressSearch,
20666
21054
  handleFindAddress,
@@ -21390,58 +21778,66 @@ const ActionsMenu = ({
21390
21778
  };
21391
21779
  const Remove = ({
21392
21780
  onRemove,
21393
- onRemoveStatusChange
21781
+ onRemoveStatusChange,
21782
+ isRemoveDisabled,
21783
+ handleIsRemoveDisabled
21394
21784
  }) => {
21395
21785
  const {
21396
21786
  i18n
21397
21787
  } = useI18nContext();
21398
- const [isUndoVisible, setIsUndoVisible] = useState(false);
21399
21788
  const [undoTimer, setUndoTimer] = useState(5);
21789
+ const [isRemoving, setIsRemoving] = useState(false);
21400
21790
  useEffect(() => {
21401
- let undoTimeout;
21402
21791
  let undoInterval;
21403
- const deleteEntity = () => {
21404
- onRemove();
21405
- };
21406
- if (isUndoVisible) {
21407
- undoTimeout = setTimeout(() => {
21408
- setIsUndoVisible(false);
21409
- onRemoveStatusChange(false);
21410
- deleteEntity();
21411
- }, 5e3);
21792
+ if (isRemoving && undoTimer > 0) {
21412
21793
  undoInterval = setInterval(() => {
21413
21794
  setUndoTimer((prevCount) => prevCount - 1);
21414
21795
  }, 1e3);
21415
21796
  }
21416
21797
  return () => {
21417
- clearTimeout(undoTimeout);
21418
21798
  clearInterval(undoInterval);
21419
- setUndoTimer(5);
21420
21799
  };
21421
- }, [isUndoVisible, setUndoTimer, setIsUndoVisible]);
21800
+ }, [isRemoving, undoTimer]);
21422
21801
  const onClickHandler = (event) => {
21423
21802
  event.stopPropagation();
21424
21803
  event.preventDefault();
21425
- if (!isUndoVisible) {
21426
- setIsUndoVisible(true);
21804
+ if (!isRemoving) {
21805
+ setIsRemoving(true);
21427
21806
  onRemoveStatusChange(true);
21807
+ handleIsRemoveDisabled(true);
21428
21808
  } else {
21429
- setIsUndoVisible(false);
21809
+ setUndoTimer(5);
21810
+ setIsRemoving(false);
21430
21811
  onRemoveStatusChange(false);
21812
+ handleIsRemoveDisabled(false);
21431
21813
  }
21432
21814
  };
21433
- return jsx(Button, {
21434
- showAsLink: isUndoVisible,
21815
+ useEffect(() => {
21816
+ if (undoTimer === 0 && isRemoving) {
21817
+ setIsRemoving(false);
21818
+ onRemoveStatusChange(false);
21819
+ handleIsRemoveDisabled(false);
21820
+ onRemove();
21821
+ }
21822
+ }, [undoTimer, isRemoving, onRemoveStatusChange, handleIsRemoveDisabled, onRemove]);
21823
+ return isRemoving ? jsx(Button, {
21824
+ showAsLink: isRemoving,
21435
21825
  type: "button",
21436
- icon: !isUndoVisible ? "bin" : "",
21437
21826
  ghost: true,
21438
21827
  onClick: onClickHandler,
21439
21828
  onKeyDown: handleKeys(["Enter"], noop),
21440
- label: isUndoVisible ? i18n.get("undoWithTimer", {
21829
+ label: i18n.get("undoWithTimer", {
21441
21830
  values: {
21442
21831
  secondsLeft: undoTimer
21443
21832
  }
21444
- }) : ""
21833
+ })
21834
+ }) : jsx(Button, {
21835
+ type: "button",
21836
+ icon: "bin",
21837
+ ghost: true,
21838
+ onClick: onClickHandler,
21839
+ onKeyDown: handleKeys(["Enter"], noop),
21840
+ disabled: isRemoveDisabled
21445
21841
  });
21446
21842
  };
21447
21843
  const EntityAssociation = ({
@@ -21452,7 +21848,9 @@ const EntityAssociation = ({
21452
21848
  problems,
21453
21849
  infoContent,
21454
21850
  onNavigateToEntity,
21455
- removeEntity
21851
+ removeEntity,
21852
+ isRemoveDisabled = false,
21853
+ handleIsRemoveDisabled
21456
21854
  }) => {
21457
21855
  const {
21458
21856
  i18n
@@ -21497,11 +21895,13 @@ const EntityAssociation = ({
21497
21895
  open: showingActions,
21498
21896
  setOpen: setShowingActions
21499
21897
  })]
21500
- }), typeof removeEntity === "function" && jsx("div", {
21898
+ }), typeof removeEntity === "function" && typeof handleIsRemoveDisabled === "function" && jsx("div", {
21501
21899
  className: "adl-entity-association__remove",
21502
21900
  children: jsx(Remove, {
21503
21901
  onRemove: removeEntity,
21504
- onRemoveStatusChange: setIsStatusRemoving
21902
+ onRemoveStatusChange: setIsStatusRemoving,
21903
+ isRemoveDisabled,
21904
+ handleIsRemoveDisabled
21505
21905
  })
21506
21906
  })]
21507
21907
  })]
@@ -21626,6 +22026,7 @@ const DecisionMakersComponent = ({
21626
22026
  const {
21627
22027
  showToast
21628
22028
  } = useToastContext();
22029
+ const [isRemoveDisabled, setIsRemoveDisabled] = useState(false);
21629
22030
  const decisionMakers2 = getOwnDecisionMakers(legalEntityResponse);
21630
22031
  const registeredCountry = (_b = (_a = legalEntityResponse == null ? void 0 : legalEntityResponse.organization) == null ? void 0 : _a.registeredAddress) == null ? void 0 : _b.country;
21631
22032
  const availableDecisionMakers = getAvailableDecisionMakerRoleTypes(registeredCountry);
@@ -21743,7 +22144,9 @@ const DecisionMakersComponent = ({
21743
22144
  problems: decisionMaker2 == null ? void 0 : decisionMaker2.problems,
21744
22145
  removeEntity: () => {
21745
22146
  deleteDecisionMaker(decisionMaker2);
21746
- }
22147
+ },
22148
+ isRemoveDisabled,
22149
+ handleIsRemoveDisabled: setIsRemoveDisabled
21747
22150
  }, decisionMaker2.reference))
21748
22151
  }) : null, jsx(Button, {
21749
22152
  secondary: true,
@@ -22087,7 +22490,9 @@ const TaskListItem = ({
22087
22490
  info,
22088
22491
  loading: loading2 = false,
22089
22492
  showErrorAlerts = "onErrorStatus",
22090
- removeEntity
22493
+ removeEntity,
22494
+ isRemoveDisabled = false,
22495
+ handleIsRemoveDisabled
22091
22496
  }) => {
22092
22497
  const shouldShowErrorAlert = showErrorAlerts === "always" || showErrorAlerts === "onErrorStatus" && status === TaskStatus.ERROR;
22093
22498
  const [isStatusRemoving, setIsStatusRemoving] = useState(false);
@@ -22135,11 +22540,13 @@ const TaskListItem = ({
22135
22540
  children: [jsx(TaskItemStatus, {
22136
22541
  status: isStatusRemoving ? TaskStatus.REMOVING : status,
22137
22542
  downloadHandler
22138
- }), typeof removeEntity === "function" ? jsx("div", {
22543
+ }), typeof removeEntity === "function" && typeof handleIsRemoveDisabled === "function" ? jsx("div", {
22139
22544
  className: "adyen-task-item__remove",
22140
22545
  children: jsx(Remove, {
22141
22546
  onRemove: removeEntity,
22142
- onRemoveStatusChange: setIsStatusRemoving
22547
+ onRemoveStatusChange: setIsStatusRemoving,
22548
+ isRemoveDisabled,
22549
+ handleIsRemoveDisabled
22143
22550
  })
22144
22551
  }) : jsx(Icon, {
22145
22552
  className: "adl-u-color-grey-60",
@@ -22166,6 +22573,7 @@ const PayoutAccountTaskListItem = ({
22166
22573
  } = useI18nContext();
22167
22574
  const [isDeletingTransferInstrument, setIsDeletingTransferInstrument] = useState(false);
22168
22575
  const isInstantVerificationAccount = isInstantVerifiedAccount(account);
22576
+ const [isRemoveDisabled, setIsRemoveDisabled] = useState(false);
22169
22577
  const maskedAccountNumber = getMaskedAccountNumber(account);
22170
22578
  const status = getTaskStatus(EntityType.BANK_ACCOUNT, capabilityProblems, legalEntityResponse, [account.id], isInstantVerificationAccount);
22171
22579
  return jsx(TaskListItem, {
@@ -22180,7 +22588,9 @@ const PayoutAccountTaskListItem = ({
22180
22588
  removeEntity: () => {
22181
22589
  setIsDeletingTransferInstrument(true);
22182
22590
  onTransferInstrumentDelete();
22183
- }
22591
+ },
22592
+ isRemoveDisabled,
22593
+ handleIsRemoveDisabled: setIsRemoveDisabled
22184
22594
  });
22185
22595
  };
22186
22596
  const TaskListGroup$1 = "";
@@ -25154,50 +25564,34 @@ function StateProvider({
25154
25564
  const labels = (data, country2) => ({
25155
25565
  registrationNumber: () => {
25156
25566
  var _a;
25157
- if (country2 === CountryCodes.Monaco && ((_a = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _a.companyCountry) === CountryCodes.Monaco) {
25567
+ if (country2 === CountryCodes.Monaco && ((_a = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _a.country) === CountryCodes.Monaco) {
25158
25568
  return "mcRegistrationNumberSoleProp";
25159
25569
  }
25160
25570
  }
25161
25571
  });
25162
- const getFontFaceRule = (fontFamily, fontStyle, fontWeight, fontSrc, additionalFormats) => {
25163
- const ruleLines = [`font-family: '${fontFamily}'`, `font-style: ${fontStyle}`, `font-weight: ${fontWeight}`, `src: url(${fontSrc})`];
25164
- const additionalSources = [];
25165
- if (additionalFormats.eot) {
25166
- additionalSources.push(`url(${additionalFormats.eot}) format('embedded-opentype')`);
25167
- }
25168
- if (additionalFormats.woff) {
25169
- additionalSources.push(`url(${additionalFormats.woff}) format('woff')`);
25170
- }
25171
- if (additionalFormats.woff2) {
25172
- additionalSources.push(`url(${additionalFormats.woff2}) format('woff2')`);
25173
- }
25174
- if (additionalFormats.ttf) {
25175
- additionalSources.push(`url(${additionalFormats.ttf}) format('truetype')`);
25176
- }
25177
- if (additionalFormats.otf) {
25178
- additionalSources.push(`url(${additionalFormats.otf}) format('opentype')`);
25179
- }
25180
- if (additionalSources.length > 0) {
25181
- ruleLines.push(`src: ${additionalSources.join(",")};`);
25182
- }
25572
+ const fontFormats = ["eot", "woff", "woff2", "ttf", "otf"];
25573
+ const formatFullNames = {
25574
+ eot: "embedded-opentype",
25575
+ woff: "woff",
25576
+ woff2: "woff2",
25577
+ ttf: "truetype",
25578
+ otf: "opentype"
25579
+ };
25580
+ const getFontFaceRule = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
25581
+ const fontSources = formats.map((format) => `url(${fontPath}.${format}) format(${formatFullNames[format]})`);
25582
+ const ruleLines = [`font-family: '${fontFamily}'`, `font-style: ${fontStyle}`, `font-weight: ${fontWeight}`, `src: ${fontSources.join(",")}`];
25183
25583
  return `@font-face {${ruleLines.join(";")}}`;
25184
25584
  };
25185
- const addStyleTagForFont = (fontFamily, fontStyle, fontWeight, fontSrc, additionalFormats) => {
25585
+ const addStyleTagForFont = (fontFamily, fontStyle, fontWeight, fontPath, formats) => {
25186
25586
  const style = document.createElement("style");
25187
25587
  style.setAttribute("type", "text/css");
25188
- style.innerText = getFontFaceRule(fontFamily, fontStyle, fontWeight, fontSrc, additionalFormats);
25189
- document.body.insertBefore(style, document.body.firstChild);
25588
+ style.innerText = getFontFaceRule(fontFamily, fontStyle, fontWeight, fontPath, formats);
25589
+ document.head.insertBefore(style, document.head.firstChild);
25190
25590
  };
25191
25591
  const addStyleTagForADLIconFont = (loadingContext) => {
25192
25592
  const fontPath = `${loadingContext}static/fonts`;
25193
25593
  const iconFontPath = `${fontPath}/adyen-kyc-icons`;
25194
- addStyleTagForFont("adyen-kyc-icons", "normal", "normal", `${iconFontPath}.eot`, {
25195
- eot: `${iconFontPath}.eot`,
25196
- woff: `${iconFontPath}.woff`,
25197
- woff2: `${iconFontPath}.woff2`,
25198
- ttf: `${iconFontPath}.ttf`,
25199
- otf: `${iconFontPath}.otf`
25200
- });
25594
+ addStyleTagForFont("adyen-kyc-icons", "normal", "normal", iconFontPath, fontFormats);
25201
25595
  };
25202
25596
  let isFlagsLoaded = false;
25203
25597
  let isDocumentGuidanceLoaded = false;
@@ -25800,8 +26194,8 @@ function SolePropDropinComponent({
25800
26194
  var _a2, _b, _c, _d;
25801
26195
  let summaryData = cloneObject(data2);
25802
26196
  let solePropCountry;
25803
- if ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.companyCountry) {
25804
- solePropCountry = datasetUtils.getCountryName(summaryData.solePropNameAndCountry.companyCountry);
26197
+ if ((_a2 = summaryData == null ? void 0 : summaryData.solePropNameAndCountry) == null ? void 0 : _a2.country) {
26198
+ solePropCountry = datasetUtils.getCountryName(summaryData.solePropNameAndCountry.country);
25805
26199
  }
25806
26200
  summaryData.solePropNameAndCountry = {
25807
26201
  legalNameOfSoleProprietor: (_b = data2.solePropNameAndCountry) == null ? void 0 : _b.legalCompanyName,
@@ -25842,7 +26236,7 @@ function SolePropDropinComponent({
25842
26236
  children: jsx(SolePropWithFormComposer, {
25843
26237
  capabilities,
25844
26238
  data,
25845
- country: ((_a = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _a.companyCountry) || country2,
26239
+ country: ((_a = data == null ? void 0 : data.solePropNameAndCountry) == null ? void 0 : _a.country) || country2,
25846
26240
  problems,
25847
26241
  eventEmitter,
25848
26242
  hideDropinLayout,
@@ -27028,23 +27422,6 @@ const getLegalEntity = async (context) => {
27028
27422
  }
27029
27423
  });
27030
27424
  };
27031
- const getPayoutFormats = async (context, country2) => {
27032
- const {
27033
- loadingContext,
27034
- sdkToken,
27035
- legalEntityId
27036
- } = context;
27037
- return httpGet({
27038
- loadingContext,
27039
- errorLevel: "warn",
27040
- errorMessage: `Payout account format not available`,
27041
- path: `${legalEntityId}/configurations/payoutAccountFormats/${country2}`,
27042
- sdkToken,
27043
- headers: {
27044
- "Content-Type": "application/json"
27045
- }
27046
- });
27047
- };
27048
27425
  const getScenarios = async (context) => {
27049
27426
  const {
27050
27427
  loadingContext,
@@ -27387,6 +27764,15 @@ const AuthProvider = ({
27387
27764
  children
27388
27765
  });
27389
27766
  };
27767
+ const accountFormatsImports = /* @__PURE__ */ Object.assign({ "./AD.json": () => import("./AD-43128b9f.mjs"), "./AE.json": () => import("./AE-81598d61.mjs"), "./AG.json": () => import("./AG-ed98ae0e.mjs"), "./AI.json": () => import("./AI-3e78c886.mjs"), "./AL.json": () => import("./AL-3ad2778a.mjs"), "./AM.json": () => import("./AM-6a5175fb.mjs"), "./AN.json": () => import("./AN-311f7139.mjs"), "./AO.json": () => import("./AO-99b5ef59.mjs"), "./AQ.json": () => import("./AQ-effe27c7.mjs"), "./AR.json": () => import("./AR-4013d95c.mjs"), "./AS.json": () => import("./AS-f15d56b2.mjs"), "./AT.json": () => import("./AT-d4d62b74.mjs"), "./AU.json": () => import("./AU-b9cba969.mjs"), "./AW.json": () => import("./AW-581f73fb.mjs"), "./AX.json": () => import("./AX-07af957a.mjs"), "./AZ.json": () => import("./AZ-be214142.mjs"), "./BA.json": () => import("./BA-af4be83f.mjs"), "./BB.json": () => import("./BB-df28f015.mjs"), "./BD.json": () => import("./BD-7aef0af6.mjs"), "./BE.json": () => import("./BE-fc7cf8d5.mjs"), "./BF.json": () => import("./BF-090b06e2.mjs"), "./BG.json": () => import("./BG-1f54cf4f.mjs"), "./BH.json": () => import("./BH-1e9cc2b9.mjs"), "./BJ.json": () => import("./BJ-d5dd5c6f.mjs"), "./BM.json": () => import("./BM-a808b13f.mjs"), "./BN.json": () => import("./BN-b13f6f6a.mjs"), "./BR.json": () => import("./BR-55d93100.mjs"), "./BS.json": () => import("./BS-db6a5bce.mjs"), "./BT.json": () => import("./BT-dfed2604.mjs"), "./BV.json": () => import("./BV-e123b0a8.mjs"), "./BW.json": () => import("./BW-08473bd7.mjs"), "./BY.json": () => import("./BY-2762d989.mjs"), "./BZ.json": () => import("./BZ-7f28b1ff.mjs"), "./CA.json": () => import("./CA-aa1f78ab.mjs"), "./CC.json": () => import("./CC-2cc6ac39.mjs"), "./CF.json": () => import("./CF-78ae0244.mjs"), "./CH.json": () => import("./CH-47f538c0.mjs"), "./CI.json": () => import("./CI-10feb889.mjs"), "./CK.json": () => import("./CK-e308c734.mjs"), "./CL.json": () => import("./CL-4a6c3e0b.mjs"), "./CM.json": () => import("./CM-fddc630d.mjs"), "./CN.json": () => import("./CN-46bb9203.mjs"), "./CO.json": () => import("./CO-1b150cda.mjs"), "./CR.json": () => import("./CR-2bf50f66.mjs"), "./CU.json": () => import("./CU-904aea8f.mjs"), "./CX.json": () => import("./CX-750ccd92.mjs"), "./CY.json": () => import("./CY-1508b23e.mjs"), "./CZ.json": () => import("./CZ-b6eaa1d5.mjs"), "./DE.json": () => import("./DE-e02051d4.mjs"), "./DJ.json": () => import("./DJ-0032728a.mjs"), "./DK.json": () => import("./DK-6116657e.mjs"), "./DM.json": () => import("./DM-a2c158c9.mjs"), "./DO.json": () => import("./DO-cedffa27.mjs"), "./DZ.json": () => import("./DZ-d44be6f8.mjs"), "./EC.json": () => import("./EC-c2e5813b.mjs"), "./EE.json": () => import("./EE-1a10f52d.mjs"), "./EG.json": () => import("./EG-8f29aebd.mjs"), "./EH.json": () => import("./EH-2dafda3e.mjs"), "./ES.json": () => import("./ES-42b3562e.mjs"), "./ET.json": () => import("./ET-ffa87ef0.mjs"), "./FI.json": () => import("./FI-8e3bb2bb.mjs"), "./FJ.json": () => import("./FJ-088ea689.mjs"), "./FK.json": () => import("./FK-16d84ff5.mjs"), "./FM.json": () => import("./FM-32616e6f.mjs"), "./FO.json": () => import("./FO-62c08e45.mjs"), "./FR.json": () => import("./FR-3db03e20.mjs"), "./GA.json": () => import("./GA-4de2f994.mjs"), "./GB.json": () => import("./GB-28ea0b5a.mjs"), "./GD.json": () => import("./GD-0ad67069.mjs"), "./GE.json": () => import("./GE-0f594b35.mjs"), "./GF.json": () => import("./GF-a062cea7.mjs"), "./GG.json": () => import("./GG-e00581ea.mjs"), "./GH.json": () => import("./GH-80209e7e.mjs"), "./GI.json": () => import("./GI-b0f7c8b3.mjs"), "./GL.json": () => import("./GL-8f5e8ba9.mjs"), "./GM.json": () => import("./GM-ff3ca013.mjs"), "./GN.json": () => import("./GN-fc7c0f8c.mjs"), "./GP.json": () => import("./GP-68f23382.mjs"), "./GQ.json": () => import("./GQ-f9867fbd.mjs"), "./GR.json": () => import("./GR-64a2d25c.mjs"), "./GS.json": () => import("./GS-49ce0f4c.mjs"), "./GT.json": () => import("./GT-fa779b14.mjs"), "./GU.json": () => import("./GU-f0dceb37.mjs"), "./GW.json": () => import("./GW-471336ea.mjs"), "./GY.json": () => import("./GY-2889ae39.mjs"), "./HK.json": () => import("./HK-0561cac3.mjs"), "./HM.json": () => import("./HM-924a724f.mjs"), "./HN.json": () => import("./HN-6dae206e.mjs"), "./HR.json": () => import("./HR-85763090.mjs"), "./HT.json": () => import("./HT-a659da85.mjs"), "./HU.json": () => import("./HU-f9ea5037.mjs"), "./ID.json": () => import("./ID-cb5cfce1.mjs"), "./IE.json": () => import("./IE-b341cbd2.mjs"), "./IL.json": () => import("./IL-657901df.mjs"), "./IM.json": () => import("./IM-5bd6279a.mjs"), "./IN.json": () => import("./IN-3c11df0e.mjs"), "./IO.json": () => import("./IO-24f6d2e7.mjs"), "./IQ.json": () => import("./IQ-241c0148.mjs"), "./IS.json": () => import("./IS-4a7e436f.mjs"), "./IT.json": () => import("./IT-f9755e76.mjs"), "./JE.json": () => import("./JE-46968fa2.mjs"), "./JM.json": () => import("./JM-a6657a34.mjs"), "./JO.json": () => import("./JO-bd1eabea.mjs"), "./JP.json": () => import("./JP-9b5a30fa.mjs"), "./KE.json": () => import("./KE-2a866579.mjs"), "./KG.json": () => import("./KG-7713761d.mjs"), "./KH.json": () => import("./KH-a5f0f831.mjs"), "./KI.json": () => import("./KI-8376e298.mjs"), "./KM.json": () => import("./KM-48c8c9c0.mjs"), "./KN.json": () => import("./KN-b34777c7.mjs"), "./KR.json": () => import("./KR-8bcf8499.mjs"), "./KW.json": () => import("./KW-4dd6ab01.mjs"), "./KY.json": () => import("./KY-4f921c93.mjs"), "./KZ.json": () => import("./KZ-68b655f3.mjs"), "./LA.json": () => import("./LA-582a34e2.mjs"), "./LB.json": () => import("./LB-7e5023a3.mjs"), "./LC.json": () => import("./LC-4e610f91.mjs"), "./LI.json": () => import("./LI-3979434e.mjs"), "./LK.json": () => import("./LK-23f5002d.mjs"), "./LT.json": () => import("./LT-2076ca77.mjs"), "./LU.json": () => import("./LU-b0538582.mjs"), "./LV.json": () => import("./LV-440617df.mjs"), "./MA.json": () => import("./MA-f2af9aa6.mjs"), "./MC.json": () => import("./MC-f619d821.mjs"), "./MD.json": () => import("./MD-ffe4e2f4.mjs"), "./ME.json": () => import("./ME-46686aa8.mjs"), "./MH.json": () => import("./MH-c535387d.mjs"), "./MK.json": () => import("./MK-11442cf1.mjs"), "./ML.json": () => import("./ML-b2c3720e.mjs"), "./MM.json": () => import("./MM-0ae1a124.mjs"), "./MN.json": () => import("./MN-baba0d9d.mjs"), "./MO.json": () => import("./MO-2c51f9f7.mjs"), "./MP.json": () => import("./MP-55044c4b.mjs"), "./MQ.json": () => import("./MQ-aaefd2b2.mjs"), "./MR.json": () => import("./MR-f122a6f0.mjs"), "./MS.json": () => import("./MS-7623ec5f.mjs"), "./MT.json": () => import("./MT-315c76bb.mjs"), "./MU.json": () => import("./MU-126673fe.mjs"), "./MV.json": () => import("./MV-d8748aca.mjs"), "./MW.json": () => import("./MW-26492427.mjs"), "./MX.json": () => import("./MX-ca79b44b.mjs"), "./MY.json": () => import("./MY-443e729e.mjs"), "./MZ.json": () => import("./MZ-192a5094.mjs"), "./NC.json": () => import("./NC-3849aac0.mjs"), "./NE.json": () => import("./NE-bf76bc84.mjs"), "./NF.json": () => import("./NF-46f5dffa.mjs"), "./NG.json": () => import("./NG-458396e5.mjs"), "./NI.json": () => import("./NI-efe8c864.mjs"), "./NL.json": () => import("./NL-3e38d0eb.mjs"), "./NO.json": () => import("./NO-088fac56.mjs"), "./NP.json": () => import("./NP-26b20587.mjs"), "./NR.json": () => import("./NR-ba1f7da1.mjs"), "./NU.json": () => import("./NU-6dc3ed45.mjs"), "./NZ.json": () => import("./NZ-12ed2cb9.mjs"), "./OM.json": () => import("./OM-4976855b.mjs"), "./PA.json": () => import("./PA-3b45122a.mjs"), "./PE.json": () => import("./PE-ad6e8281.mjs"), "./PF.json": () => import("./PF-2b1b6f30.mjs"), "./PG.json": () => import("./PG-b94ea47f.mjs"), "./PH.json": () => import("./PH-1b96a1eb.mjs"), "./PK.json": () => import("./PK-35cadd30.mjs"), "./PL.json": () => import("./PL-6a490cd1.mjs"), "./PM.json": () => import("./PM-d508f3c5.mjs"), "./PN.json": () => import("./PN-1f6ccf43.mjs"), "./PR.json": () => import("./PR-730f2830.mjs"), "./PS.json": () => import("./PS-f3ef78cd.mjs"), "./PT.json": () => import("./PT-66954cea.mjs"), "./PW.json": () => import("./PW-0d1c7797.mjs"), "./PY.json": () => import("./PY-c8e58794.mjs"), "./QA.json": () => import("./QA-35be8b1e.mjs"), "./RE.json": () => import("./RE-9f92ed9b.mjs"), "./RO.json": () => import("./RO-5c62edb1.mjs"), "./RS.json": () => import("./RS-bc256d90.mjs"), "./RU.json": () => import("./RU-bbee5e73.mjs"), "./RW.json": () => import("./RW-95b5d859.mjs"), "./SA.json": () => import("./SA-69b2f72a.mjs"), "./SB.json": () => import("./SB-567c239a.mjs"), "./SC.json": () => import("./SC-9e5a0d31.mjs"), "./SE.json": () => import("./SE-4ed53265.mjs"), "./SG.json": () => import("./SG-970463e3.mjs"), "./SH.json": () => import("./SH-d8ab21b7.mjs"), "./SI.json": () => import("./SI-3b6d3545.mjs"), "./SJ.json": () => import("./SJ-e3430cfd.mjs"), "./SK.json": () => import("./SK-2385e057.mjs"), "./SL.json": () => import("./SL-92bf45d9.mjs"), "./SM.json": () => import("./SM-bafbc267.mjs"), "./SN.json": () => import("./SN-5733e740.mjs"), "./SO.json": () => import("./SO-d5b69054.mjs"), "./SR.json": () => import("./SR-0a8c71c0.mjs"), "./ST.json": () => import("./ST-d40d86c1.mjs"), "./TC.json": () => import("./TC-ccbc7116.mjs"), "./TD.json": () => import("./TD-679d137c.mjs"), "./TF.json": () => import("./TF-6bfcf75d.mjs"), "./TG.json": () => import("./TG-a20ef9ed.mjs"), "./TH.json": () => import("./TH-e39a447c.mjs"), "./TK.json": () => import("./TK-89a81d38.mjs"), "./TL.json": () => import("./TL-8d6ca9b7.mjs"), "./TN.json": () => import("./TN-6e746476.mjs"), "./TO.json": () => import("./TO-a8c55d73.mjs"), "./TR.json": () => import("./TR-b1175ddc.mjs"), "./TT.json": () => import("./TT-5c4a3940.mjs"), "./TV.json": () => import("./TV-e1a267b9.mjs"), "./TW.json": () => import("./TW-9e0e34fa.mjs"), "./TZ.json": () => import("./TZ-c8a8159b.mjs"), "./UA.json": () => import("./UA-7014199a.mjs"), "./UG.json": () => import("./UG-1fe39fa7.mjs"), "./UM.json": () => import("./UM-3fcbf872.mjs"), "./US.json": () => import("./US-6fbdfc0c.mjs"), "./UY.json": () => import("./UY-e6d05d75.mjs"), "./UZ.json": () => import("./UZ-433656c8.mjs"), "./VA.json": () => import("./VA-e8e13d32.mjs"), "./VC.json": () => import("./VC-331669c0.mjs"), "./VE.json": () => import("./VE-5e7b0d3b.mjs"), "./VG.json": () => import("./VG-43e85e33.mjs"), "./VI.json": () => import("./VI-3d9d6d8b.mjs"), "./VN.json": () => import("./VN-9442a8c1.mjs"), "./VU.json": () => import("./VU-96fae02f.mjs"), "./WF.json": () => import("./WF-90a27056.mjs"), "./WS.json": () => import("./WS-ddcb2b71.mjs"), "./YE.json": () => import("./YE-02c4c81e.mjs"), "./YT.json": () => import("./YT-33751cc9.mjs"), "./ZA.json": () => import("./ZA-0084b083.mjs"), "./ZM.json": () => import("./ZM-c6a4d6cc.mjs") });
27768
+ const getAccountFormatsForCountry = async (country2) => {
27769
+ const importForCountry = accountFormatsImports[`./${country2}.json`];
27770
+ if (!importForCountry) {
27771
+ throw Error(`No account formats available for ${country2}`);
27772
+ }
27773
+ return (await importForCountry()).default;
27774
+ };
27775
+ const getPayoutAccountFormat = async (country2) => getAccountFormatsForCountry(country2);
27390
27776
  const getEmbeddedApi = ({
27391
27777
  base,
27392
27778
  sdkToken,
@@ -27412,7 +27798,7 @@ const getEmbeddedApi = ({
27412
27798
  taskList: tasks
27413
27799
  };
27414
27800
  },
27415
- getPayoutAccountFormat: async (country2) => getPayoutFormats(baseRequestContext, country2),
27801
+ getPayoutAccountFormat: async (country2) => getPayoutAccountFormat(country2),
27416
27802
  getDataset: async (datasetIdentifier2, locale) => getDataset$1({
27417
27803
  ...baseRequestContext,
27418
27804
  loadingContext
@@ -27481,19 +27867,6 @@ const companyIndexSearch = async (context, data) => {
27481
27867
  }
27482
27868
  }, data);
27483
27869
  };
27484
- const getPayoutAccountFormat = async (context, country2) => {
27485
- const {
27486
- loadingContext,
27487
- clientKey
27488
- } = context;
27489
- return httpGet({
27490
- loadingContext,
27491
- errorLevel: "warn",
27492
- errorMessage: `Payout account format configuration is not available`,
27493
- path: `v1/configuration/accountFormats/${country2}`,
27494
- clientKey
27495
- });
27496
- };
27497
27870
  const getAllowedCountries = async (context) => {
27498
27871
  const {
27499
27872
  loadingContext,
@@ -27664,10 +28037,7 @@ const getKycExternalApi = ({
27664
28037
  loadingContext,
27665
28038
  clientKey
27666
28039
  }, request),
27667
- getPayoutAccountFormat: async (country2) => getPayoutAccountFormat({
27668
- loadingContext,
27669
- clientKey
27670
- }, country2),
28040
+ getPayoutAccountFormat: async (country2) => getPayoutAccountFormat(country2),
27671
28041
  getAllowedCountries: async () => getAllowedCountries({
27672
28042
  loadingContext,
27673
28043
  clientKey
@@ -27742,32 +28112,26 @@ const CoreProvider = ({
27742
28112
  const {
27743
28113
  getAllowedCountries: getAllowedCountries2
27744
28114
  } = useConfigurationApi();
27745
- const [loaded, setLoaded] = useState(false);
27746
28115
  const [contextCountry, setContextCountry] = useState(initialContextCountry);
27747
28116
  const [accountHolder2, setAccountHolder] = useState(null);
27748
28117
  const [accountFormat, setAccountFormat] = useState("local");
27749
- const init2 = async () => {
28118
+ useEffect(() => {
27750
28119
  addStyleTagForADLIconFont(loadingContext);
27751
- try {
28120
+ }, [loadingContext]);
28121
+ useEffect(() => {
28122
+ const checkIfCountryIsAllowed = async () => {
27752
28123
  const allowedCountries = (await getAllowedCountries2()).countries;
27753
28124
  if (!allowedCountries.includes(contextCountry)) {
27754
- throw new Error(`
28125
+ logger$2.warn(`
27755
28126
 
27756
28127
  "${contextCountry}" isn't a supported country. Please use one of the following:
27757
28128
  - ${listify(allowedCountries)}.
27758
28129
  `);
27759
28130
  }
27760
- } catch (e) {
27761
- logger$2.warn(e);
27762
- } finally {
27763
- setLoaded(true);
27764
- }
27765
- };
27766
- useEffect(() => {
27767
- init2().catch(logger$2.error);
27768
- });
28131
+ };
28132
+ checkIfCountryIsAllowed().catch(logger$2.warn);
28133
+ }, [contextCountry, getAllowedCountries2]);
27769
28134
  const contextValue = useMemo(() => ({
27770
- loadingContext,
27771
28135
  isReview,
27772
28136
  setContextCountry,
27773
28137
  contextCountry,
@@ -27775,13 +28139,10 @@ const CoreProvider = ({
27775
28139
  accountHolder: accountHolder2,
27776
28140
  setAccountFormat,
27777
28141
  accountFormat
27778
- }), [contextCountry, loaded, accountHolder2, accountFormat]);
27779
- if (!loaded) {
27780
- return null;
27781
- }
28142
+ }), [isReview, contextCountry, accountHolder2, accountFormat]);
27782
28143
  return jsx(CoreContext.Provider, {
27783
28144
  value: contextValue,
27784
- children: children && toChildArray(children)
28145
+ children
27785
28146
  });
27786
28147
  };
27787
28148
  function ExperimentsContextProvider({