@adyen/kyc-components 3.81.0-beta.6 → 3.82.0-beta.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 (338) hide show
  1. package/dist/{AcceptTermsOfServiceComponent-TLpFCTa-.js → AcceptTermsOfServiceComponent-BcmaOZn_.js} +36 -10
  2. package/dist/{AccountSetupRejected-RmlaR74O.js → AccountSetupRejected-DY2Dr6NS.js} +6 -4
  3. package/dist/Address-DrcGzzbw.js +1076 -0
  4. package/dist/Alert-QIcYF1qD.js +231 -0
  5. package/dist/{Avatar-VJ5kzlyX.js → Avatar-DOeLDY6M.js} +2 -2
  6. package/dist/BusinessDetailsDropin-BGsHimRA.js +5088 -0
  7. package/dist/BusinessFinancingComponent-aYQz8gE4.js +45 -0
  8. package/dist/{BusinessFinancingDropin-DqqJh7oI.js → BusinessFinancingDropin-S1KF-NyW.js} +43 -20
  9. package/dist/BusinessFinancingPage-D2OV4IqT.js +40 -0
  10. package/dist/{BusinessTypeSelectionPage-0gAiU8-k.js → BusinessTypeSelectionPage-mJaPKHWj.js} +9 -5
  11. package/dist/Card-D3VCh4en.js +145 -0
  12. package/dist/Confirm-Dj-igSqL.js +64 -0
  13. package/dist/{ContractViewer-B2LwC3wV.js → ContractViewer-Byp71k2e.js} +33 -38
  14. package/dist/CountryField-B2dh1VXh.js +864 -0
  15. package/dist/CreateIndividualComponent-D6r8z9C9.js +72 -0
  16. package/dist/CreateTransferInstrumentComponent-Dpj7MNQS.js +67 -0
  17. package/dist/Currency-BAGjlBuR.js +238 -0
  18. package/dist/{CustomerSupport-CF1sYaZe.js → CustomerSupport-CYHYkHRf.js} +10 -6
  19. package/dist/{DebugModal-BfzyAxTL.js → DebugModal-B_xZdbHr.js} +8 -5
  20. package/dist/{DecisionMakerDetailsPage-DQzvrvjd.js → DecisionMakerDetailsPage-DMLnRAqQ.js} +11 -4
  21. package/dist/{DecisionMakers-CeBpj8p9.js → DecisionMakers-CG-_wD3e.js} +224 -96
  22. package/dist/Dropzone-CWLgt-EE.js +218 -0
  23. package/dist/{EmbeddedStatus-Da-R7LDJ.js → EmbeddedStatus-BIhXDQHZ.js} +4 -4
  24. package/dist/{EndStateLayout-B89OYlLx.js → EndStateLayout-C80dFrcg.js} +2 -2
  25. package/dist/{FormFlow-BQK-SrGL.js → FormFlow-Df3CEE-c.js} +8 -2
  26. package/dist/FormNavigation-UiyNK4Uw.js +162 -0
  27. package/dist/{IndividualOnfidoDropin-C1xH6itq.js → IndividualOnfidoDropin-CJLptmj_.js} +2796 -64
  28. package/dist/InputDate-uj7AgGvk.js +43 -0
  29. package/dist/InputGroup-WBfGDV5F.js +32 -0
  30. package/dist/InputText-Ds8RrvJq.js +161 -0
  31. package/dist/{Introduction-CDB0G3bY.js → Introduction-BWWadECu.js} +58 -4
  32. package/dist/LegalRepresentativeDetailsPage-BYUoJ0JW.js +61 -0
  33. package/dist/Link-Dc3z0YyP.js +35 -0
  34. package/dist/ManageIndividualComponent-DQlUh6YC.js +47 -0
  35. package/dist/ManageTermsOfServiceComponent-B5WnQ4n1.js +47 -0
  36. package/dist/{ManageTransferInstrumentComponent-D-CFPJJW.js → ManageTransferInstrumentComponent-CL8KJIXM.js} +25 -4
  37. package/dist/MaskedInput-CTOcOcUH.js +799 -0
  38. package/dist/MaybeModal-BBBahxa3.js +25 -0
  39. package/dist/Modal-Da5go-OS.js +136 -0
  40. package/dist/{OnboardingDropinComponent-USEEyykb.js → OnboardingDropinComponent-BYFTAjkC.js} +200 -41
  41. package/dist/PayoutDetailsDropin-UBEJcM6I.js +3694 -0
  42. package/dist/RadioGroup-DwMTx-4B.js +143 -0
  43. package/dist/RegistrationAddress-CcHFAuWw.js +2334 -0
  44. package/dist/{Review-C7kbmI2-.js → Review-B8HKLTsc.js} +8 -4
  45. package/dist/{RootBusinessDetailsPage-Oh-X5OJ6.js → RootBusinessDetailsPage-2rHbq8sK.js} +65 -44
  46. package/dist/RootIndividualDetailsPage-BYEh8Vlw.js +77 -0
  47. package/dist/{SignPCIComponent-3Ab8dWV4.js → SignPCIComponent-DZcOu0WP.js} +17 -8
  48. package/dist/{SingpassSelection-Bfra20iP.js → SingpassSelection-D45perGt.js} +6 -6
  49. package/dist/SoleProprietorshipPage-D4dn0vkS.js +50 -0
  50. package/dist/{SourceOfFundsPage-DsakBcHW.js → SourceOfFundsPage-By-6cY89.js} +46 -24
  51. package/dist/Spacer-BK3jDget.js +18 -0
  52. package/dist/StepProgressIndicator-Jd8MiZZp.js +78 -0
  53. package/dist/StoreProvider-B_tFiIdr.js +7072 -0
  54. package/dist/StructuredList-DaepaiVE.js +38 -0
  55. package/dist/{TaskItemStatus-CYI7n3qN.js → TaskItemStatus-Ccga7-2c.js} +4 -3
  56. package/dist/{TaskStatusIndicator-DSICKMZ9.js → TaskStatusIndicator-CGp1MHRK.js} +2 -2
  57. package/dist/TaxInformationField-qCHTQShR.js +3062 -0
  58. package/dist/{TaxReportingDropin-tYdGTVCv.js → TaxReportingDropin-sxuLHfT9.js} +25 -9
  59. package/dist/{TileGroup-CmLJ5fv6.js → TileGroup-B9jBcBJV.js} +4 -2
  60. package/dist/{TrustDetailsPage-DJ7sLu2B.js → TrustDetailsPage-pWuCF62_.js} +506 -19
  61. package/dist/TrustMemberCompanyPage-Blbw7uAa.js +60 -0
  62. package/dist/TrustMemberIndividualPage-CkqYu9NE.js +66 -0
  63. package/dist/UnincorporatedPartnershipIndividualPage-Dd_YBotT.js +66 -0
  64. package/dist/UnincorporatedPartnershipMemberCompanyPage-Dna06cxg.js +64 -0
  65. package/dist/{ViewVerificationStatusComponent-XmGpFS4Q.js → ViewVerificationStatusComponent-Dnc6ucMj.js} +4 -3
  66. package/dist/adyen-business-financing.js +33 -22
  67. package/dist/adyen-individual.js +36 -27
  68. package/dist/adyen-kyc-components.js +28 -15
  69. package/dist/adyen-manage-individual.js +25 -26
  70. package/dist/adyen-manage-terms-of-service.js +26 -27
  71. package/dist/adyen-manage-transfer-instruments.js +40 -42
  72. package/dist/adyen-onboarding.js +3 -3
  73. package/dist/adyen-terms-of-service.js +41 -38
  74. package/dist/adyen-transfer-instrument.js +38 -29
  75. package/dist/adyen-verification-status.js +44 -36
  76. package/dist/analytics-D2q0iFsS.js +61 -0
  77. package/dist/{bafinUtils-C_5C_Fk9.js → bafinUtils-BmLu7dPk.js} +164 -10
  78. package/dist/basePatterns-BwdnMQxI.js +15 -0
  79. package/dist/bg-BG-CW9c658c.js +13 -0
  80. package/dist/bg-BG-CZ8v3rdy.js +30 -0
  81. package/dist/{bg-BG-Dlzl9Szn.js → bg-BG-D5192UVe.js} +1 -2
  82. package/dist/{bg-BG-NMIts2sa.js → bg-BG-QC5irNEG.js} +2 -4
  83. package/dist/commonValidators-DKV_Zthp.js +24 -0
  84. package/dist/{cs-CZ-BkyFDlAU.js → cs-CZ-DOqH0WeT.js} +1 -2
  85. package/dist/cs-CZ-Dx6momCa.js +30 -0
  86. package/dist/cs-CZ-dU9fnQ1g.js +13 -0
  87. package/dist/{cs-CZ-Csr_35T-.js → cs-CZ-t297LwYw.js} +2 -4
  88. package/dist/currency-BGwQyxBo.js +36 -0
  89. package/dist/{da-DK-B5KNtXL8.js → da-DK-B45X2VaJ.js} +1 -2
  90. package/dist/da-DK-BJ7aTPir.js +13 -0
  91. package/dist/{da-DK-Dm8o1giq.js → da-DK-BoQic3Gy.js} +2 -4
  92. package/dist/da-DK-D4H69PX3.js +30 -0
  93. package/dist/de-DE-C78RLE2G.js +13 -0
  94. package/dist/{de-DE-BA9tcpNQ.js → de-DE-CWvgMDqU.js} +1 -2
  95. package/dist/{de-DE-DMFaycio.js → de-DE-Dwagawx1.js} +2 -4
  96. package/dist/de-DE-wp5-H-ov.js +30 -0
  97. package/dist/dropinUtils-Bs4XZJuG.js +192 -0
  98. package/dist/el-GR-BZRKurtr.js +13 -0
  99. package/dist/{el-GR-DIhHT2q_.js → el-GR-C3rkK_oc.js} +1 -2
  100. package/dist/el-GR-CK2heqPJ.js +30 -0
  101. package/dist/{el-GR-CGeBAkDN.js → el-GR-CxwhV-TX.js} +2 -4
  102. package/dist/emitEvent-CzZf80Am.js +28 -0
  103. package/dist/{en-US-DX4NHkX-.js → en-US-BbAzROHT.js} +2 -4
  104. package/dist/{en-US-TrwIHFh-.js → en-US-CAm3meB1.js} +1 -2
  105. package/dist/{en-US-SbE0c1gn.js → en-US-DIdQJky-.js} +1 -2
  106. package/dist/en-US.instructions-Ddr7AO05.js +22 -0
  107. package/dist/{es-ES-pXHx3ODy.js → es-ES-Bsoco8Fj.js} +2 -4
  108. package/dist/es-ES-BtUSEzkE.js +13 -0
  109. package/dist/{es-ES-RXwbiHjS.js → es-ES-DKCCgVF8.js} +1 -2
  110. package/dist/es-ES-Ds3-DtqZ.js +30 -0
  111. package/dist/et-EE-BCnK305R.js +13 -0
  112. package/dist/{et-EE-ZssIqWkO.js → et-EE-Bc6ioJRG.js} +1 -2
  113. package/dist/et-EE-Co-8akjV.js +30 -0
  114. package/dist/{et-EE-QLVnr6Vl.js → et-EE-DdGlUpaQ.js} +2 -4
  115. package/dist/{fi-FI-DT351N-G.js → fi-FI-ClnsYt3L.js} +2 -4
  116. package/dist/fi-FI-Cvar63RH.js +13 -0
  117. package/dist/fi-FI-DPNeTsJS.js +30 -0
  118. package/dist/{fi-FI-DmiggQEL.js → fi-FI-Hhku9Lmc.js} +1 -2
  119. package/dist/fieldConfigurations-Yf8yD64w.js +458 -0
  120. package/dist/form-rules-DhbF2mY4.js +13 -0
  121. package/dist/fr-FR-B5543Fe-.js +13 -0
  122. package/dist/{fr-FR-N5wYE2BZ.js → fr-FR-BYuKsZIb.js} +1 -2
  123. package/dist/{fr-FR-BNXXNUX_.js → fr-FR-CJI0bIig.js} +2 -4
  124. package/dist/fr-FR-ChmNQciP.js +30 -0
  125. package/dist/getName-CNY8xRgy.js +41 -0
  126. package/dist/{hasDataChanged-CzXG96AD.js → hasDataChanged-BaS61ojo.js} +2 -2
  127. package/dist/{hr-HR-B8AZ4eHJ.js → hr-HR-C0yWizOX.js} +2 -4
  128. package/dist/{hr-HR-5iwKtfgh.js → hr-HR-CPO5Yw2B.js} +1 -2
  129. package/dist/hr-HR-DqC8Cgs6.js +30 -0
  130. package/dist/hr-HR-ZreFlbK9.js +13 -0
  131. package/dist/hu-HU-B3BihdGh.js +13 -0
  132. package/dist/hu-HU-BOanVlKb.js +30 -0
  133. package/dist/{hu-HU-Aq1LsWah.js → hu-HU-mo_0ULJG.js} +1 -2
  134. package/dist/{hu-HU-DRi6Dz9U.js → hu-HU-wnSie9tz.js} +2 -4
  135. package/dist/iframeWidget-wJ62Bpmz.js +234 -0
  136. package/dist/{payout-verification-instant-BIcnFP-p.js → instant-verification-Dvvkyfmp.js} +3 -3
  137. package/dist/isEmpty-DyzV_vaf.js +23 -0
  138. package/dist/{it-IT-BeYbInCQ.js → it-IT-BeC2Y1F8.js} +2 -4
  139. package/dist/it-IT-Dd6xGSe-.js +13 -0
  140. package/dist/{it-IT-8DEagvb2.js → it-IT-Nl57jui-.js} +1 -2
  141. package/dist/it-IT-eCrTB65E.js +30 -0
  142. package/dist/ja-JP-BJljbFIZ.js +30 -0
  143. package/dist/{ja-JP-BhS-_dIx.js → ja-JP-CbgaW99b.js} +2 -2
  144. package/dist/{ja-JP-BGAJQs1g.js → ja-JP-D3oQAH7z.js} +1 -2
  145. package/dist/{ja-JP-C1OQ16fo.js → ja-JP-YoU7mNrK.js} +2 -4
  146. package/dist/ja-JP-iTbqSPNL.js +13 -0
  147. package/dist/keys-BpNgnAsD.js +23 -0
  148. package/dist/{localizeDateString-Jy9XkTyZ.js → localizeDateString-CEnsnB3Q.js} +2 -2
  149. package/dist/{lt-LT-HZOWQKZT.js → lt-LT-CVasDmF3.js} +1 -2
  150. package/dist/lt-LT-DE-4IXNG.js +13 -0
  151. package/dist/{lt-LT-_MzAcXJo.js → lt-LT-DIe4cKlu.js} +2 -4
  152. package/dist/lt-LT-DckQGgoT.js +30 -0
  153. package/dist/lv-LV-CeivEZms.js +13 -0
  154. package/dist/lv-LV-DP9oRTFv.js +30 -0
  155. package/dist/{lv-LV-CRhXAjn6.js → lv-LV-DXgW5zWl.js} +2 -4
  156. package/dist/{lv-LV-F-Z4lDCV.js → lv-LV-Sbsv8-nD.js} +1 -2
  157. package/dist/{payout-verification-manual-DH9-DdlZ.js → manual-verification-BvZWqA00.js} +3 -3
  158. package/dist/mapExistingFile-BphSM_zL.js +231 -0
  159. package/dist/mapScriptLocalization-BgHu6D6K.js +72 -0
  160. package/dist/mapTransferInstrumentToPayoutAccount-C2sNhjfY.js +30 -0
  161. package/dist/{nl-NL-C-xUU2N3.js → nl-NL-BHkRnVrj.js} +1 -2
  162. package/dist/{nl-NL-Dbx0ZmI7.js → nl-NL-Cysslsh2.js} +2 -4
  163. package/dist/nl-NL-D2QKudfh.js +30 -0
  164. package/dist/nl-NL-DVENFpd5.js +13 -0
  165. package/dist/no-NO-C_snYWBc.js +30 -0
  166. package/dist/no-NO-Dn2UkdoI.js +13 -0
  167. package/dist/{no-NO-47ncaBZY.js → no-NO-kaAdT9B8.js} +1 -2
  168. package/dist/{no-NO-C0sfkp82.js → no-NO-zSnPtrDi.js} +2 -4
  169. package/dist/pl-PL-CQ6c2Qz_.js +30 -0
  170. package/dist/{pl-PL-CZLzkboH.js → pl-PL-DD8JN4Qf.js} +1 -2
  171. package/dist/pl-PL-DFAzuceF.js +13 -0
  172. package/dist/{pl-PL-DAPGaxWi.js → pl-PL-UB5J5JcB.js} +2 -4
  173. package/dist/pt-PT-C-hbNnsB.js +30 -0
  174. package/dist/{pt-PT-BY9rcwcF.js → pt-PT-CjsyP_OK.js} +2 -4
  175. package/dist/{pt-PT-CN4ws8N7.js → pt-PT-Xm-pm3mb.js} +1 -2
  176. package/dist/pt-PT-_o5xgnxS.js +13 -0
  177. package/dist/{resolveEnvironment-BbdiVBJB.js → resolveEnvironment-DWnAnjxd.js} +3 -3
  178. package/dist/ro-RO-BrTWk1Ui.js +30 -0
  179. package/dist/{ro-RO-RylOvc5g.js → ro-RO-C3m6aJVP.js} +1 -2
  180. package/dist/{ro-RO-DJLWmWZ4.js → ro-RO-C8yYXQc_.js} +2 -4
  181. package/dist/ro-RO-D7c_Rj8V.js +13 -0
  182. package/dist/{rules-Cqfw8M_0.js → rules-V2n1q9wP.js} +5 -2
  183. package/dist/sk-SK-BBSuh2fA.js +13 -0
  184. package/dist/sk-SK-BTFtoPmI.js +30 -0
  185. package/dist/{sk-SK-BfJKbtGy.js → sk-SK-BVc-vNQm.js} +1 -2
  186. package/dist/{sk-SK-B7o3L57C.js → sk-SK-DbOE9C6n.js} +2 -4
  187. package/dist/sl-SI-BLTuWNf5.js +13 -0
  188. package/dist/sl-SI-BhVTSmhQ.js +30 -0
  189. package/dist/{sl-SI-C8CMAkD0.js → sl-SI-Br0UEUPL.js} +2 -4
  190. package/dist/{sl-SI-DklUFzaY.js → sl-SI-D_rqR0D7.js} +1 -2
  191. package/dist/style.css +3272 -3254
  192. package/dist/styles-CLV89_hH.js +3272 -3254
  193. package/dist/sv-SE-66rqYTxi.js +30 -0
  194. package/dist/{sv-SE-qduyDIzY.js → sv-SE-B3zoXMuH.js} +1 -2
  195. package/dist/sv-SE-BUfESAQK.js +13 -0
  196. package/dist/{sv-SE-Bwh0wKFk.js → sv-SE-BtXmvxx4.js} +2 -4
  197. package/dist/translation-CPyYrNAr.js +472 -0
  198. package/dist/types/api/industryCodes/industryCodes.types.d.ts +2 -0
  199. package/dist/types/api/industryCodes/useIndustryCodes.d.ts +6 -0
  200. package/dist/types/api/queryKeys.d.ts +2 -1
  201. package/dist/types/components/BankAccount/forms/PayoutDetails/PayoutDetails.d.ts +1 -0
  202. package/dist/types/components/BankAccount/forms/PayoutVerificationMethod/payoutVerificationMethodMetadata.d.ts +3 -3
  203. package/dist/types/components/BankAccount/tasks/PayoutDetailsDropin/payoutDetailsFormConfig.d.ts +0 -9
  204. package/dist/types/components/Business/forms/BasicInformation/BasicInformationMultiform.d.ts +0 -1
  205. package/dist/types/components/Business/forms/BusinessDetails/forms.d.ts +6 -0
  206. package/dist/types/components/Business/forms/rules.d.ts +1 -3
  207. package/dist/types/components/Business/tasks/BusinessDetailsDropin/utils.d.ts +1 -2
  208. package/dist/types/components/Business/tasks/BusinessDetailsMultiformDropin/BusinessDetailsMultiform.d.ts +1 -1
  209. package/dist/types/components/Contract/tasks/ServiceAgreementDropin/ServiceAgreementDropin.d.ts +1 -1
  210. package/dist/types/components/Contract/tasks/ServiceAgreementDropin/types.d.ts +1 -0
  211. package/dist/types/components/EFP/tasks/SourceOfFundsDropin/utils.d.ts +0 -1
  212. package/dist/types/components/EmbeddedDropins/AcceptTermsOfServiceComponent/AcceptTermsOfServiceComponent.d.ts +4 -3
  213. package/dist/types/components/Individual/forms/Individual/Individual.d.ts +4 -0
  214. package/dist/types/components/Individual/forms/Individual/ProofOfRelationship/types.d.ts +0 -5
  215. package/dist/types/components/Shared/fields/IdFieldTypeSelector/countryIdNumberTypes.d.ts +1 -1
  216. package/dist/types/components/Shared/forms/Address/utils.d.ts +1 -1
  217. package/dist/types/components/Trust/forms/Trust/Trust.d.ts +1 -0
  218. package/dist/types/components/Trust/forms/TrustRegistrationDetails/types.d.ts +1 -2
  219. package/dist/types/components/Trust/tasks/TrustMembers/TrustMembersOverview.d.ts +2 -1
  220. package/dist/types/components/UnincorporatedPartnership/pages/UnincorporatedPartnershipMemberCompanyPage.d.ts +2 -1
  221. package/dist/types/components/ui/atoms/ActionsMenu/ActionsMenu.d.ts +2 -1
  222. package/dist/types/components/ui/atoms/Button/Button.types.d.ts +3 -3
  223. package/dist/types/components/ui/atoms/ListItem/ListItem.d.ts +2 -1
  224. package/dist/types/components/ui/atoms/RadioGroupCard/RadioGroupCard.types.d.ts +0 -14
  225. package/dist/types/components/ui/atoms/RadioWithLabel/RadioWithLabel.d.ts +2 -1
  226. package/dist/types/components/ui/atoms/SelectList/SelectList.d.ts +1 -0
  227. package/dist/types/components/ui/atoms/StepProgressIndicator/StepProgressIndicator.d.ts +2 -1
  228. package/dist/types/components/ui/atoms/StructuredList/StructuredList.d.ts +2 -1
  229. package/dist/types/components/ui/atoms/Svg/svgs.d.ts +0 -12
  230. package/dist/types/components/ui/atoms/TaskStatusIndicator/TaskStatusIndicator.d.ts +3 -2
  231. package/dist/types/components/ui/layout/LandingLayout/LandingLayout.d.ts +1 -1
  232. package/dist/types/components/ui/layout/StackLayout/StackLayout.d.ts +2 -1
  233. package/dist/types/components/ui/molecules/InputCurrency/InputCurrency.d.ts +2 -1
  234. package/dist/types/components/ui/molecules/InputEmail/InputEmail.d.ts +2 -1
  235. package/dist/types/components/ui/molecules/InputGroup/InputGroup.d.ts +2 -1
  236. package/dist/types/components/ui/molecules/InputTelephone/InputTelephone.d.ts +2 -1
  237. package/dist/types/components/ui/molecules/InputText/InputText.d.ts +2 -0
  238. package/dist/types/components/ui/molecules/MaskedInput/MaskedInput.d.ts +0 -1
  239. package/dist/types/components/ui/molecules/Tabs/Tabs.d.ts +1 -1
  240. package/dist/types/context/StateContext/types.d.ts +1 -1
  241. package/dist/types/core/models/api/accountIdentification.d.ts +5 -4
  242. package/dist/types/core/models/api/contracts.d.ts +1 -1
  243. package/dist/types/core/process-field-configurations.d.ts +14 -3
  244. package/dist/types/embeds/business-financing/AdyenBusinessFinancing.d.ts +1 -1
  245. package/dist/types/embeds/business-financing/adyen-business-financing.types.d.ts +1 -5
  246. package/dist/types/embeds/emitEvent.d.ts +14 -0
  247. package/dist/types/embeds/individual/adyen-individual.types.d.ts +2 -2
  248. package/dist/types/embeds/manage-individual/AdyenManageIndividual.d.ts +1 -1
  249. package/dist/types/embeds/manage-individual/adyen-manage-individual.types.d.ts +1 -1
  250. package/dist/types/embeds/manage-terms-of-service/AdyenManageTermsOfService.d.ts +1 -1
  251. package/dist/types/embeds/manage-terms-of-service/adyen-manage-terms-of-service.types.d.ts +1 -1
  252. package/dist/types/embeds/manage-transfer-instruments/AdyenManageTransferInstrument.d.ts +3 -4
  253. package/dist/types/embeds/manage-transfer-instruments/adyen-manage-transfer-instruments.types.d.ts +3 -4
  254. package/dist/types/embeds/terms-of-service/adyen-terms-of-service.types.d.ts +4 -3
  255. package/dist/types/embeds/transfer-instrument/adyen-transfer-instrument.types.d.ts +2 -2
  256. package/dist/types/embeds/verification-status/adyen-verification-status.types.d.ts +3 -3
  257. package/dist/types/hooks/introduction/useIntroductionScreens.d.ts +2 -1
  258. package/dist/types/hooks/introduction/useShouldShowIntroduction.d.ts +2 -1
  259. package/dist/types/language/utils.d.ts +1 -1
  260. package/dist/types/utils/addLinkedFields.d.ts +7 -1
  261. package/dist/types/utils/entityStatusUtil.d.ts +1 -1
  262. package/dist/types/utils/formUtils.d.ts +1 -1
  263. package/dist/types/utils/getDisplayErrorMessage.d.ts +1 -1
  264. package/dist/types/utils/getName.d.ts +1 -1
  265. package/dist/types/utils/makeSelectItemForRole.d.ts +1 -1
  266. package/dist/types/utils/masking/masks/businessRegistrationNumberMasks.d.ts +5 -0
  267. package/dist/types/utils/translation.d.ts +6 -0
  268. package/dist/types-CAznNNSI.js +160 -0
  269. package/dist/types-D1xSH_ap.js +74 -0
  270. package/dist/types-czQuzOK4.js +64 -0
  271. package/dist/useAssociatedLegalEntity-zrvFkm6w.js +33 -0
  272. package/dist/useDataset-UxGyu2Za.js +120 -0
  273. package/dist/useForm-Dah8AZ3S.js +1694 -0
  274. package/dist/useFormContext-beqGS11A.js +23 -0
  275. package/dist/useGlobalData-C9KOnjRc.js +205 -0
  276. package/dist/{useMultiForm-D12QQ8Fr.js → useMultiForm-4axf9sa3.js} +4 -2
  277. package/dist/{useOnboardingStatus-C77iTj4t.js → useOnboardingStatus-B-G3ygsd.js} +2 -2
  278. package/dist/useScenarios-Bs-K4CKb.js +46 -0
  279. package/dist/{useTermsOfServiceStatus-ClHR-D8J.js → useTermsOfServiceStatus-BsBOTabo.js} +2 -2
  280. package/dist/useToastContext-BA6TVroR.js +51 -0
  281. package/dist/useUnincorporatedPartnershipMembers-DHPQPPps.js +99 -0
  282. package/dist/utils-7TgDVOvi.js +29 -0
  283. package/dist/{utils-7HIGSast.js → utils-C_6T21UY.js} +46 -4
  284. package/dist/utils-DNSfZiio.js +70 -0
  285. package/dist/utils-DxPqN-F5.js +159 -0
  286. package/dist/{validate-Cyc-okDY.js → validate-BCgpU6PK.js} +2 -2
  287. package/dist/validate-CD3D7QeQ.js +382 -0
  288. package/dist/validate-nbcWPtZJ.js +605 -0
  289. package/dist/validationError-CInDfoP_.js +86 -0
  290. package/package.json +44 -45
  291. package/dist/BusinessDetailsDropin-Dnze2MWp.js +0 -2136
  292. package/dist/BusinessFinancingComponent-BWGtnZ2l.js +0 -38
  293. package/dist/BusinessFinancingPage-00BXk692.js +0 -35
  294. package/dist/CreateIndividualComponent-JqyPXwi_.js +0 -64
  295. package/dist/CreateTransferInstrumentComponent-D7dPoBCI.js +0 -55
  296. package/dist/LegalRepresentativeDetailsPage-BzKsuqNS.js +0 -55
  297. package/dist/ManageIndividualComponent-BpE7jV1g.js +0 -42
  298. package/dist/ManageTermsOfServiceComponent-D2KTbyRY.js +0 -40
  299. package/dist/RootIndividualDetailsPage-DF6aSCDc.js +0 -71
  300. package/dist/SoleProprietorshipPage-Czj2qS1n.js +0 -44
  301. package/dist/StoreProvider-phu7r9_0.js +0 -31920
  302. package/dist/TrustMemberCompanyPage-DBmq70wc.js +0 -54
  303. package/dist/TrustMemberIndividualPage-QCSz7dt3.js +0 -60
  304. package/dist/UnincorporatedPartnershipIndividualPage-Ctks0l_r.js +0 -60
  305. package/dist/UnincorporatedPartnershipMemberCompanyPage-DP_iAiCM.js +0 -57
  306. package/dist/VerificationErrorAlert-CnWfh-Mq.js +0 -77
  307. package/dist/bg-BG-BvSUDgGF.js +0 -13
  308. package/dist/cs-CZ-y4mvq4Lv.js +0 -13
  309. package/dist/da-DK-qgQOVjDp.js +0 -13
  310. package/dist/de-DE-pSdsxBpQ.js +0 -13
  311. package/dist/el-GR-Bvjk5Sw8.js +0 -13
  312. package/dist/en-US-Bq2Twy6x.js +0 -54
  313. package/dist/es-ES-Dy1uR2H_.js +0 -13
  314. package/dist/et-EE-d9V24rcf.js +0 -13
  315. package/dist/fi-FI-B0fnAFV2.js +0 -13
  316. package/dist/fr-FR-BoKzVp2q.js +0 -13
  317. package/dist/getFieldsWithExistingData-Br7bX6SQ.js +0 -22
  318. package/dist/hr-HR-CF0AHQzi.js +0 -13
  319. package/dist/hu-HU-CSPhOvLC.js +0 -13
  320. package/dist/it-IT-BH-eqIKH.js +0 -13
  321. package/dist/ja-JP-B3yqM_FM.js +0 -13
  322. package/dist/lt-LT-Lzl_Cbw-.js +0 -13
  323. package/dist/lv-LV-y00wN1pj.js +0 -13
  324. package/dist/mapFinancialReportsToFinancialInformation-BDTfiDYF.js +0 -66
  325. package/dist/mapScriptLocalization-H2Re3k5X.js +0 -35
  326. package/dist/nl-NL-DmnFXAQC.js +0 -13
  327. package/dist/no-NO-DbvFfP96.js +0 -13
  328. package/dist/pl-PL--mmxopYA.js +0 -13
  329. package/dist/pt-PT-BVzXBFp7.js +0 -13
  330. package/dist/ro-RO-Cdmevo9A.js +0 -13
  331. package/dist/ru-RU-FZb2upqh.js +0 -13
  332. package/dist/sk-SK-nfeuTcY5.js +0 -13
  333. package/dist/sl-SI-DUTZDqkP.js +0 -13
  334. package/dist/sv-SE-BTx2XKAp.js +0 -13
  335. package/dist/useUpdateLegalEntity-J-L5lHm7.js +0 -57
  336. package/dist/validate-B_03afGP.js +0 -40
  337. package/dist/zh-CN-wUb4MmTZ.js +0 -13
  338. package/dist/zh-TW-DNTXHLKa.js +0 -13
@@ -1,2136 +0,0 @@
1
- ;
2
- {
3
- try {
4
- let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
5
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "5e1f42b3-0acc-4120-9494-ffbf31e94c9d", e._sentryDebugIdIdentifier = "sentry-dbid-5e1f42b3-0acc-4120-9494-ffbf31e94c9d");
6
- } catch (e) {
7
- }
8
- }
9
- ;
10
- import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
11
- import { u as useI18nContext, dz as MemoizedDocumentUpload, G as Button, bf as Modal, bw as ModalContent, N as Typography, at as CountryCodes, Y as CompanyTypesValues, f1 as useGlobalData, eT as getForms, $ as TaskTypes, f2 as BasicInformation, dt as getFormProps, f3 as CompanyStructure, f4 as AdditionalInformation, eN as MemoizedConstitutionalDocument, O as LegalEntityTypes, eM as FinancialInformation, ci as getDocument, cj as mapExistingFile, ck as getPageName, bC as formatObject, bl as entriesOf, b9 as businessDetailsComponentsKeyMapping, f5 as solePropBusinessDetailsKeyMapping, f6 as getDefaultRegistrationNumberType, f7 as getDefaultVatNumberType, b4 as objectsDeepEqual, d$ as operationalAddressIsSameIds, eP as COUNTRIES_USING_COMPANY_SEARCH, f8 as FIELDS_NEEDED_FOR_COMPANY_SEARCH, dk as keysOf, i as isUndefinedOrNull, dM as isDateOlderThanAYear, aO as summaryItem, f9 as solePropBusinessDetailsApiKeyMapping, f0 as businessDetailsApiKeyMapping, fa as isRegistrationNumberAbsentStateV4Scenario, cp as isEmpty, fb as COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT, cn as createDocumentRequest, bd as datasetUtilities, cJ as mapAddressLabels, eL as companyTypeMetadata, a0 as createLogger, cI as filterOutUnwantedAssociationsIfRootLE, bW as isValidationError, bX as processValidationErrors, bY as isMaintenanceModeError, fc as getProp, au as isEmpty$1, fd as documentFormsIds, aw as resolveFieldMetadata, e9 as registrationNumberDefaultFieldMetadata, fe as inferCompanyRegistrationNumberType, ff as getCompanyRegistrationNumberOptions, ea as registrationNumberDefaultFieldConfig, cd as taxInformationDefaultFieldMetadata, fg as countryToTaxInfoTypeMap, ce as taxInformationDefaultFieldConfig, fh as getKeyForField, cr as drop, ap as getOwnEntityAssociations, cS as doArraysMatch, cO as getFileExtention, X as useAccountHolder, a9 as useToastContext, a3 as useAnalyticsContext, aa as useExperimentsContext, v as useSettingsContext, a as useApiContext, dW as verifiedBusiness, bq as useQueryClient, fi as useStateContext, w as SettingNames, fj as setIsBankAccountRequestedForOrganization, bR as getAssociatedLeAnalyticsPayload, be as getCapabilityProblems, cs as documentApiUtils, cG as composePerScenarioFormConfigurations, cA as useScenarioConfiguration, eX as rules, cB as getPropsFromConfigurations, eY as useCompanySearch, fk as useCompanySelection, eZ as useVerifyTin, bS as getRequiredForms, bT as addValidityToForms, fl as useClearCompanyData, bU as useFormComposer, fm as setVerifiedBusiness, fn as FormWrapper, bh as Confirm, fo as solePropBusinessDetailsDocumentMapping, e$ as businessDetailsDocumentMapping } from "./StoreProvider-phu7r9_0.js";
12
- import { useState, useEffect, useRef, useMemo, useCallback } from "preact/hooks";
13
- import { u as useCreateLegalEntity, a as useUpdateLegalEntity } from "./useUpdateLegalEntity-J-L5lHm7.js";
14
- import { h as hasDataChanged } from "./hasDataChanged-CzXG96AD.js";
15
- import { o as organizationTypesToSkipCompanyStructureForm } from "./utils-7HIGSast.js";
16
- import { g as getFieldsWithExistingData } from "./getFieldsWithExistingData-Br7bX6SQ.js";
17
- import cx from "classnames";
18
- import { m as mapFinancialReportsToFinancialInformation, a as mapFinancialInformationToFinancialReport } from "./mapFinancialReportsToFinancialInformation-BDTfiDYF.js";
19
- import { a as mapApiScriptLocalizationToSchemaFields, m as mapSchemaFieldsToApiScriptLocalization } from "./mapScriptLocalization-H2Re3k5X.js";
20
- import { f as formatCurrency } from "./formatCurrency-CMOSdJMB.js";
21
- const stripWhitespace = (str) => str.replace(/\s/g, "");
22
- const toNormalizedString = (s) => stripWhitespace(s.toLowerCase());
23
- const isNormalizedStringMatch = (s1, s2) => toNormalizedString(s1) === toNormalizedString(s2);
24
- const documentTypes$2 = [
25
- { id: "Internal company document", name: "internalCompanyDocument" },
26
- { id: "Business registry statement", name: "businessRegistryStatement" }
27
- ];
28
- const GuidanceContent$4 = () => {
29
- const { i18n } = useI18nContext();
30
- return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-upload-field__guidance", children: /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
31
- /* @__PURE__ */ jsx("strong", { children: i18n.get("documentRequirements") }),
32
- /* @__PURE__ */ jsxs("ul", { children: [
33
- /* @__PURE__ */ jsx("li", { children: i18n.get("includesTheDirectorsFullName") }),
34
- /* @__PURE__ */ jsx("li", { children: i18n.get("includesEvidenceOfTheIndividualsRole") }),
35
- /* @__PURE__ */ jsx("li", { children: i18n.get("issuedOrSignedByALegalRepresentative") })
36
- ] })
37
- ] }) });
38
- };
39
- function ProofOfDirectorDocument({
40
- id,
41
- country,
42
- heading = "uploadYourOrganizationProofOfDirector",
43
- description = "weNeedAnOfficialDocument",
44
- ...props
45
- }) {
46
- const { i18n } = useI18nContext();
47
- const [selectedDocumentName, setSelectedDocumentName] = useState(documentTypes$2[0].id);
48
- return /* @__PURE__ */ jsx(
49
- MemoizedDocumentUpload,
50
- {
51
- ...props,
52
- id,
53
- heading: i18n.get(heading),
54
- description: i18n.get(description),
55
- documentField: "proofOfDirector",
56
- documentType: "proofOfDirector",
57
- guidanceContent: /* @__PURE__ */ jsx(GuidanceContent$4, {}),
58
- country,
59
- hidePageCount: true,
60
- documentTypeSelect: {
61
- selectedType: selectedDocumentName,
62
- setSelectedType: setSelectedDocumentName,
63
- options: documentTypes$2
64
- }
65
- }
66
- );
67
- }
68
- const DOC_TYPE_FOR_MULTI_UPLOAD = "Organizational chart and supporting document";
69
- const documentTypes$1 = [
70
- { id: "Certified Organizational chart", name: "certifiedOrganizationalChart" },
71
- {
72
- id: "Organizational chart and supporting document",
73
- name: "organizationalChartAndSupportingDocument"
74
- }
75
- ];
76
- const GuidanceContent$3 = ({ selectedDocumentName }) => {
77
- const { i18n } = useI18nContext();
78
- const [showGuidanceModal, setShowGuidanceModal] = useState(false);
79
- return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-upload-field__guidance", children: /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
80
- /* @__PURE__ */ jsx("strong", { children: i18n.get("documentRequirements") }),
81
- selectedDocumentName === "Certified Organizational chart" ? /* @__PURE__ */ jsxs("ul", { children: [
82
- /* @__PURE__ */ jsx("li", { children: i18n.get("showsOwnershipAndControllingRelations") }),
83
- /* @__PURE__ */ jsx("li", { children: i18n.get("entitiesMustIncludeANameLegalStructureAndCountryRegionOfRegistration") }),
84
- /* @__PURE__ */ jsx("li", { children: i18n.get("signedByALawyerAccountantAuditorWithinTheLast6Months") })
85
- ] }) : /* @__PURE__ */ jsxs("ul", { children: [
86
- /* @__PURE__ */ jsx("li", { children: i18n.get("oneOrganizationalChartShowingOwnershipAndControllingRelations") }),
87
- /* @__PURE__ */ jsxs("ul", { children: [
88
- /* @__PURE__ */ jsx("li", { children: i18n.get("entitiesMustIncludeANameLegalStructureAndCountryRegionOfRegistration") }),
89
- /* @__PURE__ */ jsxs("li", { children: [
90
- /* @__PURE__ */ jsxs("span", { children: [
91
- i18n.get("one"),
92
- " "
93
- ] }),
94
- /* @__PURE__ */ jsx(Button, { onClick: () => setShowGuidanceModal(true), variant: "link", children: i18n.get("supportingDocument") }),
95
- /* @__PURE__ */ jsxs("span", { children: [
96
- " ",
97
- i18n.get("describingTheOrganizationAndItsUBOSignedWithinTheLast6Months")
98
- ] })
99
- ] })
100
- ] })
101
- ] }),
102
- showGuidanceModal && /* @__PURE__ */ jsx(
103
- Modal,
104
- {
105
- size: "small",
106
- onClose: () => setShowGuidanceModal(false),
107
- ariaLabel: i18n.get("whichDocumentsQualifyToProveOwnership"),
108
- children: /* @__PURE__ */ jsxs(ModalContent, { children: [
109
- /* @__PURE__ */ jsx(
110
- Typography,
111
- {
112
- el: "h1",
113
- variant: "title-l",
114
- className: "adyen-kyc-u-margin-bottom-32 adyen-kyc-u-margin-top-32",
115
- children: i18n.get("whichDocumentsQualifyToProveOwnership")
116
- }
117
- ),
118
- /* @__PURE__ */ jsx(Typography, { el: "p", variant: "body", children: i18n.get("theDocumentsWeCanAcceptToProveOwnershipAre") }),
119
- /* @__PURE__ */ jsxs("ul", { children: [
120
- /* @__PURE__ */ jsx("li", { children: i18n.get("securitiesRegister") }),
121
- /* @__PURE__ */ jsx("li", { children: i18n.get("shareholderRegister") }),
122
- /* @__PURE__ */ jsx("li", { children: i18n.get("ultimateBeneficialOwnerRegister") }),
123
- /* @__PURE__ */ jsx("li", { children: i18n.get("articlesOfIncorporation") }),
124
- /* @__PURE__ */ jsx("li", { children: i18n.get("annualReports") }),
125
- /* @__PURE__ */ jsx("li", { children: i18n.get("annualReturns") }),
126
- /* @__PURE__ */ jsx("li", { children: i18n.get("certificateOfCorporateStatus") }),
127
- /* @__PURE__ */ jsx("li", { children: i18n.get("shareholderAgreements") }),
128
- /* @__PURE__ */ jsx("li", { children: i18n.get("assignmentAgreements") }),
129
- /* @__PURE__ */ jsx("li", { children: i18n.get("partnershipAgreements") }),
130
- /* @__PURE__ */ jsx("li", { children: i18n.get("boardOfDirectorsMeetingRecords") }),
131
- /* @__PURE__ */ jsx("li", { children: i18n.get("registrationDocument") }),
132
- /* @__PURE__ */ jsx("li", { children: i18n.get("certificateOfIncumbency") })
133
- ] })
134
- ] })
135
- }
136
- )
137
- ] }) });
138
- };
139
- function ProofOfOwnershipDocument({
140
- id,
141
- country,
142
- heading = "uploadYourOrganizationProofOfOwnership",
143
- description = "weNeedAnOfficialDocumentForOwnership",
144
- ...props
145
- }) {
146
- const { i18n } = useI18nContext();
147
- const [selectedDocumentName, setSelectedDocumentName] = useState(documentTypes$1[0].id);
148
- const supportsMultiple = selectedDocumentName === DOC_TYPE_FOR_MULTI_UPLOAD;
149
- useEffect(() => {
150
- if (props.data?.proofOfOwnership?.length === 2) {
151
- setSelectedDocumentName(DOC_TYPE_FOR_MULTI_UPLOAD);
152
- }
153
- }, [props.data?.proofOfOwnership]);
154
- return /* @__PURE__ */ jsx(
155
- MemoizedDocumentUpload,
156
- {
157
- ...props,
158
- id,
159
- heading: i18n.get(heading),
160
- description: i18n.get(description),
161
- documentField: "proofOfOwnership",
162
- documentType: "proofOfOwnership",
163
- guidanceContent: /* @__PURE__ */ jsx(GuidanceContent$3, { selectedDocumentName }),
164
- country,
165
- label: i18n.get("uploadYourDocuments"),
166
- documentTypeSelect: {
167
- selectedType: selectedDocumentName,
168
- setSelectedType: setSelectedDocumentName,
169
- options: documentTypes$1
170
- },
171
- hidePageCount: true,
172
- supportsMultipleUploads: supportsMultiple,
173
- maxNumberOfFiles: supportsMultiple ? 2 : 1,
174
- extraDropzoneDescription: supportsMultiple ? i18n.get("oneOrganizationalChartAndOneSupportingDocument") : void 0
175
- }
176
- );
177
- }
178
- const documentTypes = [
179
- { id: "Trade registry document", name: "tradeRegistryDocument" },
180
- { id: "Internal company document", name: "internalCompanyDocument" }
181
- ];
182
- const GuidanceContent$2 = () => {
183
- const { i18n } = useI18nContext();
184
- return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-upload-field__guidance", children: /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
185
- /* @__PURE__ */ jsx("strong", { children: i18n.get("documentRequirements") }),
186
- /* @__PURE__ */ jsxs("ul", { children: [
187
- /* @__PURE__ */ jsx("li", { children: i18n.get("includesTheSignatorysFullName") }),
188
- /* @__PURE__ */ jsx("li", { children: i18n.get("includesEvidenceOfTheIndividualsRoleSignatory") }),
189
- /* @__PURE__ */ jsx("li", { children: i18n.get("issuedOrSignedByALegalRepresentative") })
190
- ] })
191
- ] }) });
192
- };
193
- function ProofOfSignatoryDocument({
194
- id,
195
- country,
196
- heading = "uploadYourOrganizationProofOfSignatory",
197
- description = "weNeedAnOfficialDocumentSignatory",
198
- ...props
199
- }) {
200
- const { i18n } = useI18nContext();
201
- const [selectedDocumentName, setSelectedDocumentName] = useState(documentTypes[0].id);
202
- return /* @__PURE__ */ jsx(
203
- MemoizedDocumentUpload,
204
- {
205
- ...props,
206
- id,
207
- heading: i18n.get(heading),
208
- description: i18n.get(description),
209
- documentField: "proofOfSignatory",
210
- documentType: "proofOfSignatory",
211
- guidanceContent: /* @__PURE__ */ jsx(GuidanceContent$2, {}),
212
- country,
213
- hidePageCount: true,
214
- documentTypeSelect: {
215
- selectedType: selectedDocumentName,
216
- setSelectedType: setSelectedDocumentName,
217
- options: documentTypes
218
- }
219
- }
220
- );
221
- }
222
- const ACCEPTED_DOCUMENTS_MAP$1 = {
223
- [CountryCodes.PuertoRico]: {
224
- // should exactly match CountryCodes.UnitedStates
225
- [CompanyTypesValues.PRIVATE_COMPANY]: {
226
- header: "acceptedDocumentsForPrivateCompanies",
227
- documents: [
228
- "certificateOfIncorporation",
229
- "certificateOfFormation",
230
- "secretaryOfStateFiling__PR"
231
- ]
232
- },
233
- [CompanyTypesValues.PUBLIC_COMPANY]: {
234
- header: "acceptedDocumentsForPublicCompanies",
235
- documents: ["certificateOfIncorporation", "certificateOfFormation"]
236
- },
237
- [CompanyTypesValues.UNLISTED_PUBLIC_COMPANY]: {
238
- header: "acceptedDocumentsForPublicCompanies",
239
- documents: ["certificateOfIncorporation", "certificateOfFormation"]
240
- },
241
- [CompanyTypesValues.GOVERNMENTAL_ORGANIZATION]: {
242
- header: "acceptedDocumentsForGovernment",
243
- documents: ["charter"]
244
- },
245
- [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]: {
246
- header: "acceptedDocumentsForNonProfit",
247
- documents: [
248
- "articlesOfIncorporation",
249
- "meetingRecords",
250
- "secretaryOfStateRegDoc__PR",
251
- "certificateOfIncumbency"
252
- ]
253
- },
254
- [CompanyTypesValues.INCORPORATED_PARTNERSHIP]: {
255
- header: "acceptedDocumentsForPartnerships",
256
- documents: ["partnerShipAgreement", "secretaryOfStateFiling__PR"]
257
- }
258
- },
259
- [CountryCodes.UnitedStates]: {
260
- [CompanyTypesValues.PRIVATE_COMPANY]: {
261
- header: "acceptedDocumentsForPrivateCompanies",
262
- documents: ["certificateOfIncorporation", "certificateOfFormation", "secretaryOfStateFiling"]
263
- },
264
- [CompanyTypesValues.PUBLIC_COMPANY]: {
265
- header: "acceptedDocumentsForPublicCompanies",
266
- documents: ["certificateOfIncorporation", "certificateOfFormation"]
267
- },
268
- [CompanyTypesValues.UNLISTED_PUBLIC_COMPANY]: {
269
- header: "acceptedDocumentsForPublicCompanies",
270
- documents: ["certificateOfIncorporation", "certificateOfFormation"]
271
- },
272
- [CompanyTypesValues.GOVERNMENTAL_ORGANIZATION]: {
273
- header: "acceptedDocumentsForGovernment",
274
- documents: ["charter"]
275
- },
276
- [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]: {
277
- header: "acceptedDocumentsForNonProfit",
278
- documents: [
279
- "articlesOfIncorporation",
280
- "meetingRecords",
281
- "secretaryOfStateRegDoc",
282
- "certificateOfIncumbency"
283
- ]
284
- },
285
- [CompanyTypesValues.INCORPORATED_PARTNERSHIP]: {
286
- header: "acceptedDocumentsForPartnerships",
287
- documents: ["partnerShipAgreement", "secretaryOfStateFiling"]
288
- }
289
- }
290
- };
291
- const GuidanceContent$1 = ({
292
- country,
293
- companyType
294
- }) => {
295
- const { i18n } = useI18nContext();
296
- const acceptedDocGuidance = ACCEPTED_DOCUMENTS_MAP$1[country]?.[companyType];
297
- return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-upload-field__guidance", children: country === "US" ? /* @__PURE__ */ jsxs(Fragment, { children: [
298
- acceptedDocGuidance && /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
299
- /* @__PURE__ */ jsx("strong", { children: i18n.get(acceptedDocGuidance.header) }),
300
- /* @__PURE__ */ jsx("ul", { children: acceptedDocGuidance.documents.map((document, i) => /* @__PURE__ */ jsx("li", { children: i18n.get(document) }, i)) })
301
- ] }),
302
- /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
303
- /* @__PURE__ */ jsx("strong", { children: i18n.get("documentRequirements") }),
304
- /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx("li", { children: i18n.get("includesLegalCompanyName") }) })
305
- ] })
306
- ] }) : /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
307
- /* @__PURE__ */ jsxs("strong", { children: [
308
- " ",
309
- i18n.get("documentRequirements")
310
- ] }),
311
- /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx("li", { children: i18n.get("documentIssuedByGovernmentAuthority") }) })
312
- ] }) });
313
- };
314
- function RegistrationDocument({
315
- id,
316
- country,
317
- companyType = CompanyTypesValues.PRIVATE_COMPANY,
318
- heading = "companyRegistrationDocumentFormHeading",
319
- description = "companyRegistrationDocumentFormDescription",
320
- ...props
321
- }) {
322
- const { i18n } = useI18nContext();
323
- return /* @__PURE__ */ jsx(
324
- MemoizedDocumentUpload,
325
- {
326
- ...props,
327
- id,
328
- heading: i18n.get(heading),
329
- description: i18n.get(description),
330
- documentField: "registrationDocument",
331
- documentType: "registrationDocument",
332
- guidanceContent: /* @__PURE__ */ jsx(GuidanceContent$1, { country, companyType }),
333
- companyType,
334
- country,
335
- hidePageCount: true
336
- }
337
- );
338
- }
339
- const ACCEPTED_DOCUMENTS_MAP = {
340
- [CountryCodes.PuertoRico]: {
341
- // should exactly match CountryCodes.UnitedStates
342
- [CompanyTypesValues.PRIVATE_COMPANY]: {
343
- header: "acceptedDocumentsForPrivateCompanies",
344
- documents: ["irsCP575"]
345
- },
346
- [CompanyTypesValues.PUBLIC_COMPANY]: {
347
- header: "acceptedDocumentsForPublicCompanies",
348
- documents: ["annualReport", "secForm10k"]
349
- },
350
- [CompanyTypesValues.UNLISTED_PUBLIC_COMPANY]: {
351
- header: "acceptedDocumentsForPublicCompanies",
352
- documents: ["annualReport", "secForm10k"]
353
- },
354
- [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]: {
355
- header: "acceptedDocumentsForNonProfit",
356
- documents: ["annualReport"]
357
- },
358
- [CompanyTypesValues.INCORPORATED_PARTNERSHIP]: {
359
- header: "acceptedDocumentsForPartnerships",
360
- documents: ["irsScheduleK1"]
361
- }
362
- },
363
- [CountryCodes.UnitedStates]: {
364
- [CompanyTypesValues.PRIVATE_COMPANY]: {
365
- header: "acceptedDocumentsForPrivateCompanies",
366
- documents: ["irsCP575"]
367
- },
368
- [CompanyTypesValues.PUBLIC_COMPANY]: {
369
- header: "acceptedDocumentsForPublicCompanies",
370
- documents: ["annualReport", "secForm10k"]
371
- },
372
- [CompanyTypesValues.UNLISTED_PUBLIC_COMPANY]: {
373
- header: "acceptedDocumentsForPublicCompanies",
374
- documents: ["annualReport", "secForm10k"]
375
- },
376
- [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]: {
377
- header: "acceptedDocumentsForNonProfit",
378
- documents: ["annualReport"]
379
- },
380
- [CompanyTypesValues.INCORPORATED_PARTNERSHIP]: {
381
- header: "acceptedDocumentsForPartnerships",
382
- documents: ["irsScheduleK1"]
383
- }
384
- }
385
- };
386
- const GuidanceContent = ({
387
- country,
388
- companyType
389
- }) => {
390
- const { i18n } = useI18nContext();
391
- const acceptedDocGuidance = ACCEPTED_DOCUMENTS_MAP[country]?.[companyType];
392
- return /* @__PURE__ */ jsx("div", { className: "adyen-kyc-upload-field__guidance", children: country === "US" ? /* @__PURE__ */ jsxs(Fragment, { children: [
393
- acceptedDocGuidance && /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
394
- /* @__PURE__ */ jsx("strong", { children: i18n.get(acceptedDocGuidance.header) }),
395
- /* @__PURE__ */ jsx("ul", { children: acceptedDocGuidance.documents.map((document, i) => /* @__PURE__ */ jsx("li", { children: i18n.get(document) }, i)) })
396
- ] }),
397
- /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
398
- /* @__PURE__ */ jsx("strong", { children: i18n.get("documentRequirements") }),
399
- /* @__PURE__ */ jsxs("ul", { children: [
400
- /* @__PURE__ */ jsx("li", { children: i18n.get("includesLegalCompanyName") }),
401
- /* @__PURE__ */ jsx("li", { children: i18n.get("includesEIN") })
402
- ] })
403
- ] })
404
- ] }) : /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
405
- /* @__PURE__ */ jsx("div", { className: "adyen-kyc-upload-field__subtitle", children: i18n.get("documentRequirements") }),
406
- /* @__PURE__ */ jsxs("ul", { children: [
407
- /* @__PURE__ */ jsx("li", { children: i18n.get("containsNameOfCompany") }),
408
- /* @__PURE__ */ jsx("li", { children: i18n.get("documentShowsTaxIdOfCompany") }),
409
- /* @__PURE__ */ jsx("li", { children: i18n.get("issuedByTheTaxAuthority") })
410
- ] })
411
- ] }) });
412
- };
413
- function TaxDocument({
414
- id,
415
- country,
416
- companyType = CompanyTypesValues.PRIVATE_COMPANY,
417
- heading = "companyTaxDocumentFormHeading",
418
- description = "companyTaxDocumentFormDescription",
419
- ...props
420
- }) {
421
- const { i18n } = useI18nContext();
422
- return /* @__PURE__ */ jsx(
423
- MemoizedDocumentUpload,
424
- {
425
- ...props,
426
- id,
427
- heading: i18n.get(heading),
428
- description: i18n.get(description),
429
- documentField: "taxDocument",
430
- documentType: "proofOfOrganizationTaxInfo",
431
- guidanceContent: /* @__PURE__ */ jsx(GuidanceContent, { country, companyType }),
432
- companyType,
433
- country,
434
- hidePageCount: true
435
- }
436
- );
437
- }
438
- function BusinessDetails(props) {
439
- const { i18n } = useI18nContext();
440
- const { companyStructure } = useGlobalData();
441
- const {
442
- country,
443
- isTopLevelEntity,
444
- activeForm,
445
- showCompanyStructure,
446
- showBusinessSelection,
447
- setShowBusinessSelection,
448
- setShowCompanyStructure,
449
- loading,
450
- searchResults,
451
- taskType,
452
- handleNextClick,
453
- proceedToManualDataEntry
454
- } = props;
455
- const forms = getForms(country);
456
- const formWrapperClasses = (formId) => activeForm?.formId !== formId ? "adyen-kyc-form-wrapper adyen-kyc-form-wrapper--hidden" : "adyen-kyc-form-wrapper";
457
- const classNames = cx("adyen-kyc-business-details", {
458
- "adyen-kyc-business-details--hide": activeForm?.formId === "summary"
459
- });
460
- const companyType = taskType === TaskTypes.SOLE_PROPRIETOR_COMPANY ? CompanyTypesValues.SOLE_PROPRIETORSHIP : companyStructure?.entityType;
461
- return /* @__PURE__ */ jsxs("div", { className: classNames, children: [
462
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.basicInformation.formId), children: /* @__PURE__ */ jsx(
463
- BasicInformation,
464
- {
465
- ...getFormProps(props, forms.basicInformation.formId),
466
- id: forms.basicInformation.formId,
467
- heading: i18n.get(activeForm?.formHeading || forms.basicInformation.formHeading),
468
- description: activeForm?.formDescription ? i18n.get(activeForm?.formDescription) : void 0,
469
- country,
470
- companyType,
471
- isTopLevelEntity,
472
- showBusinessSelection,
473
- showCompanyStructure,
474
- isActiveForm: activeForm?.formId === forms.basicInformation.formId,
475
- loading,
476
- proceedToManualDataEntry,
477
- searchResults,
478
- setShowBusinessSelection,
479
- setShowCompanyStructure,
480
- handleNextClick,
481
- disableCountry: taskType === TaskTypes.SOLE_PROPRIETOR_COMPANY
482
- }
483
- ) }),
484
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyStructure.formId), children: /* @__PURE__ */ jsx(
485
- CompanyStructure,
486
- {
487
- ...getFormProps(props, forms.companyStructure.formId),
488
- id: forms.companyStructure.formId,
489
- heading: i18n.get(activeForm?.formHeading ?? forms.companyStructure.formHeading),
490
- description: i18n.get(
491
- activeForm?.formDescription ?? forms.companyStructure.formDescription
492
- ),
493
- country,
494
- showCompanyStructure
495
- }
496
- ) }),
497
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.additionalInformation.formId), children: /* @__PURE__ */ jsx(
498
- AdditionalInformation,
499
- {
500
- ...getFormProps(props, forms.additionalInformation.formId),
501
- id: forms.additionalInformation.formId,
502
- heading: i18n.get(activeForm?.formHeading ?? forms.additionalInformation.formHeading),
503
- country,
504
- companyType,
505
- showCompanyStructure
506
- }
507
- ) }),
508
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyRegistrationDocument.formId), children: /* @__PURE__ */ jsx(
509
- RegistrationDocument,
510
- {
511
- ...getFormProps(props, forms.companyRegistrationDocument.formId),
512
- id: forms.companyRegistrationDocument.formId,
513
- heading: forms.companyRegistrationDocument.formHeading,
514
- description: forms.companyRegistrationDocument.formDescription,
515
- country,
516
- companyType
517
- }
518
- ) }),
519
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyTaxDocument.formId), children: country === "US" ? /* @__PURE__ */ jsx(
520
- TaxDocument,
521
- {
522
- ...getFormProps(props, forms.companyTaxDocument.formId),
523
- id: forms.companyTaxDocument.formId,
524
- heading: forms.companyTaxDocument.formHeading,
525
- description: forms.companyTaxDocument.formDescription,
526
- country,
527
- companyType
528
- }
529
- ) : /* @__PURE__ */ jsx(
530
- MemoizedDocumentUpload,
531
- {
532
- ...getFormProps(props, forms.companyTaxDocument.formId),
533
- id: forms.companyTaxDocument.formId,
534
- heading: i18n.get(forms.companyTaxDocument.formHeading),
535
- description: i18n.get(forms.companyTaxDocument.formDescription),
536
- documentField: "taxDocument",
537
- documentType: "vatDocument",
538
- hidePageCount: true,
539
- guidanceContent: /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-u-margin-bottom-24", children: [
540
- /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-upload-field__subtitle", children: [
541
- " ",
542
- i18n.get("requirements")
543
- ] }),
544
- /* @__PURE__ */ jsxs("ul", { children: [
545
- /* @__PURE__ */ jsx("li", { children: i18n.get("containsNameOfCompany") }),
546
- /* @__PURE__ */ jsx("li", { children: i18n.get("documentShowsTaxIdOfCompany") }),
547
- /* @__PURE__ */ jsx("li", { children: i18n.get("issuedByTheTaxAuthority") })
548
- ] })
549
- ] })
550
- }
551
- ) }),
552
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyProofOfDirectorDocument.formId), children: /* @__PURE__ */ jsx(
553
- ProofOfDirectorDocument,
554
- {
555
- ...getFormProps(props, forms.companyProofOfDirectorDocument.formId),
556
- id: forms.companyProofOfDirectorDocument.formId,
557
- heading: forms.companyProofOfDirectorDocument.formHeading,
558
- description: forms.companyProofOfDirectorDocument.formDescription,
559
- country
560
- }
561
- ) }),
562
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyProofOfSignatoryDocument.formId), children: /* @__PURE__ */ jsx(
563
- ProofOfSignatoryDocument,
564
- {
565
- ...getFormProps(props, forms.companyProofOfSignatoryDocument.formId),
566
- id: forms.companyProofOfSignatoryDocument.formId,
567
- heading: forms.companyProofOfSignatoryDocument.formHeading,
568
- description: forms.companyProofOfSignatoryDocument.formDescription,
569
- country
570
- }
571
- ) }),
572
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyProofOfOwnershipDocument.formId), children: /* @__PURE__ */ jsx(
573
- ProofOfOwnershipDocument,
574
- {
575
- ...getFormProps(props, forms.companyProofOfOwnershipDocument.formId),
576
- id: forms.companyProofOfOwnershipDocument.formId,
577
- heading: forms.companyProofOfOwnershipDocument.formHeading,
578
- description: forms.companyProofOfOwnershipDocument.formDescription,
579
- country
580
- }
581
- ) }),
582
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyConstitutionalDocument.formId), children: /* @__PURE__ */ jsx(
583
- MemoizedConstitutionalDocument,
584
- {
585
- ...getFormProps(props, forms.companyConstitutionalDocument.formId),
586
- id: forms.companyConstitutionalDocument.formId,
587
- legalEntityType: LegalEntityTypes.SOLE_PROPRIETORSHIP,
588
- country
589
- }
590
- ) }),
591
- /* @__PURE__ */ jsx("div", { className: formWrapperClasses(forms.companyFinancialInformation.formId), children: /* @__PURE__ */ jsx(
592
- FinancialInformation,
593
- {
594
- ...getFormProps(props, forms.companyFinancialInformation.formId),
595
- heading: i18n.get("financialInformation"),
596
- id: forms.companyFinancialInformation.formId,
597
- country
598
- }
599
- ) })
600
- ] });
601
- }
602
- const mapApiDocumentToBusinessDetailsDocuments = (entityId) => {
603
- const registrationDocument = getDocument(entityId, "registrationDocument") ?? null;
604
- const taxDocument = getDocument(entityId, "vatDocument") ?? getDocument(entityId, "proofOfOrganizationTaxInfo") ?? null;
605
- const proofOfDirector = getDocument(entityId, "proofOfDirector") ?? null;
606
- const proofOfSignatory = getDocument(entityId, "proofOfSignatory") ?? null;
607
- const proofOfOwnership = getDocument(entityId, "proofOfOwnership") ?? null;
608
- const constitutionalDocument = getDocument(entityId, "constitutionalDocument") ?? null;
609
- return {
610
- companyRegistrationDocument: registrationDocument ? { registrationDocument: [mapExistingFile(getPageName(registrationDocument))] } : void 0,
611
- companyTaxDocument: taxDocument ? { taxDocument: [mapExistingFile(getPageName(taxDocument))] } : void 0,
612
- companyProofOfDirectorDocument: proofOfDirector ? { proofOfDirector: [mapExistingFile(getPageName(proofOfDirector))] } : void 0,
613
- companyProofOfSignatoryDocument: proofOfSignatory ? { proofOfSignatory: [mapExistingFile(getPageName(proofOfSignatory))] } : void 0,
614
- companyProofOfOwnershipDocument: proofOfOwnership ? { proofOfOwnership: [mapExistingFile(getPageName(proofOfOwnership))] } : void 0,
615
- companyConstitutionalDocument: constitutionalDocument ? {
616
- constitutionalDocument: [mapExistingFile(getPageName(constitutionalDocument))]
617
- } : void 0
618
- };
619
- };
620
- const mapBasicInformation = (data) => {
621
- if (!data) return;
622
- return !!data.country && COUNTRIES_USING_COMPANY_SEARCH.includes(data.country) ? data : entriesOf(data).reduce((acc, [field]) => {
623
- if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
624
- return {
625
- ...acc,
626
- [field]: data[field]
627
- };
628
- }
629
- return acc;
630
- }, {});
631
- };
632
- const mapDbaName = (legalEntity) => {
633
- const entity = legalEntity.type === "organization" ? legalEntity.organization : legalEntity.soleProprietorship;
634
- const dbaName = {};
635
- if (typeof entity?.doingBusinessAsAbsent !== "undefined") {
636
- dbaName.hasDoingBusinessAs = !entity.doingBusinessAsAbsent;
637
- } else {
638
- if (entity?.doingBusinessAs) {
639
- dbaName.hasDoingBusinessAs = entity?.doingBusinessAs !== (legalEntity.type === "organization" ? legalEntity.organization?.legalName : legalEntity.soleProprietorship?.name);
640
- } else {
641
- dbaName.hasDoingBusinessAs = void 0;
642
- }
643
- }
644
- if (legalEntity.organization?.doingBusinessAs) {
645
- dbaName.doingBusinessAs = legalEntity.organization?.doingBusinessAs;
646
- }
647
- return dbaName;
648
- };
649
- const mapIsUen = (taxInformation, registrationNumber, country) => {
650
- const currentCountryTaxInfo = taxInformation?.find((taxInfo) => taxInfo.country === country);
651
- if (!currentCountryTaxInfo || country !== "SG") return {};
652
- return {
653
- registrationNumber: currentCountryTaxInfo.type === "UEN" ? currentCountryTaxInfo.number : registrationNumber,
654
- isUen: currentCountryTaxInfo.type === "UEN"
655
- };
656
- };
657
- const mapAdditionalInformation = (data, legalEntity) => {
658
- if (!data) return;
659
- const entity = legalEntity.type === "organization" ? legalEntity.organization : legalEntity.soleProprietorship;
660
- const currentCountry = entity?.registeredAddress.country;
661
- const dbaNameFields = mapDbaName(legalEntity);
662
- const isUen = mapIsUen(
663
- data.taxInformation,
664
- data.registrationNumber,
665
- currentCountry
666
- );
667
- const companyType = legalEntity.type === "organization" ? legalEntity.organization?.type : CompanyTypesValues.SOLE_PROPRIETORSHIP;
668
- const registrationNumberType = getDefaultRegistrationNumberType(
669
- entity?.registrationNumber,
670
- currentCountry,
671
- companyType
672
- );
673
- const vatNumberType = getDefaultVatNumberType(entity?.vatNumber, currentCountry);
674
- const operationalAddressIsSame = entity?.principalPlaceOfBusiness && !objectsDeepEqual(entity?.principalPlaceOfBusiness, entity?.registeredAddress) ? operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME : operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME;
675
- const result = entriesOf(data).reduce(
676
- (acc, [field]) => {
677
- if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
678
- return {
679
- ...acc,
680
- [field]: data[field]
681
- };
682
- }
683
- if (!FIELDS_NEEDED_FOR_COMPANY_SEARCH.includes(field)) {
684
- return {
685
- ...acc,
686
- [field]: data[field]
687
- };
688
- }
689
- return acc;
690
- },
691
- { operationalAddressIsSame, registrationNumberType, vatNumberType }
692
- );
693
- return { ...result, ...dbaNameFields, ...isUen };
694
- };
695
- const mapLocalization = (data) => {
696
- const localization = data.organization?.localization;
697
- if (!localization) return {};
698
- let result = {};
699
- for (const { script, fields } of localization) {
700
- const schemaFieldsFromLocalization = mapApiScriptLocalizationToSchemaFields({
701
- script,
702
- fields: {
703
- // mismatch between API `legalName` and schema `legalCompanyName`
704
- legalCompanyName: fields.legalName
705
- }
706
- });
707
- result = {
708
- ...result,
709
- ...schemaFieldsFromLocalization
710
- };
711
- }
712
- return result;
713
- };
714
- const mapLegalEntityToBusinessDetailsSchema = (legalEntity, parentEntity, isExperimentEnabled) => {
715
- if (!legalEntity) return {};
716
- const {
717
- companyRegistrationDocument,
718
- companyTaxDocument,
719
- companyProofOfDirectorDocument,
720
- companyProofOfSignatoryDocument,
721
- companyProofOfOwnershipDocument,
722
- companyConstitutionalDocument
723
- } = mapApiDocumentToBusinessDetailsDocuments(legalEntity.id);
724
- const buildSolePropSchema = () => {
725
- const solePropData = formatObject(
726
- legalEntity,
727
- solePropBusinessDetailsKeyMapping
728
- );
729
- const country = solePropData?.additionalInformation?.registrationAddress?.country ?? parentEntity?.individual?.residentialAddress.country;
730
- if (legalEntity?.soleProprietorship?.financialReports && solePropData) {
731
- solePropData.companyFinancialInformation = mapFinancialReportsToFinancialInformation(
732
- legalEntity.soleProprietorship.financialReports
733
- );
734
- }
735
- return {
736
- ...solePropData,
737
- basicInformation: {
738
- ...solePropData?.basicInformation,
739
- country
740
- },
741
- companyConstitutionalDocument
742
- };
743
- };
744
- const orgSchema = isExperimentEnabled?.("EnableBusinessDetailsMultiForm") ? {
745
- ...formatObject(legalEntity, businessDetailsComponentsKeyMapping),
746
- businessSelection: {},
747
- companyRegistrationDocument,
748
- companyTaxDocument,
749
- companyProofOfDirectorDocument,
750
- companyProofOfSignatoryDocument,
751
- companyProofOfOwnershipDocument,
752
- companyFinancialInformation: {}
753
- } : {
754
- ...formatObject(legalEntity, businessDetailsComponentsKeyMapping),
755
- companyRegistrationDocument,
756
- companyTaxDocument,
757
- companyProofOfDirectorDocument,
758
- companyProofOfSignatoryDocument,
759
- companyProofOfOwnershipDocument,
760
- companyFinancialInformation: {}
761
- };
762
- const businessDetailsSchema = legalEntity.type === "organization" ? orgSchema : buildSolePropSchema();
763
- return entriesOf(businessDetailsSchema).reduce((componentData, [key]) => {
764
- switch (key) {
765
- case "basicInformation": {
766
- return {
767
- ...componentData,
768
- [key]: {
769
- ...mapBasicInformation(businessDetailsSchema[key]),
770
- ...mapLocalization(legalEntity)
771
- }
772
- };
773
- }
774
- case "businessSelection": {
775
- return {
776
- ...componentData,
777
- [key]: {
778
- hasSelectedBusiness: false
779
- }
780
- };
781
- }
782
- case "companyStructure": {
783
- return {
784
- ...componentData,
785
- [key]: {
786
- ...businessDetailsSchema[key]
787
- }
788
- };
789
- }
790
- case "additionalInformation": {
791
- return {
792
- ...componentData,
793
- [key]: mapAdditionalInformation(businessDetailsSchema[key], legalEntity)
794
- };
795
- }
796
- case "companyRegistrationDocument": {
797
- return {
798
- ...componentData,
799
- [key]: businessDetailsSchema[key]
800
- };
801
- }
802
- case "companyTaxDocument": {
803
- return {
804
- ...componentData,
805
- [key]: businessDetailsSchema[key]
806
- };
807
- }
808
- case "companyProofOfDirectorDocument": {
809
- return {
810
- ...componentData,
811
- [key]: businessDetailsSchema[key]
812
- };
813
- }
814
- case "companyProofOfSignatoryDocument": {
815
- return {
816
- ...componentData,
817
- [key]: businessDetailsSchema[key]
818
- };
819
- }
820
- case "companyProofOfOwnershipDocument": {
821
- return {
822
- ...componentData,
823
- [key]: businessDetailsSchema[key]
824
- };
825
- }
826
- case "companyConstitutionalDocument": {
827
- return {
828
- ...componentData,
829
- [key]: businessDetailsSchema[key]
830
- };
831
- }
832
- case "companyFinancialInformation": {
833
- const financialReports = legalEntity.type === "organization" ? legalEntity?.organization?.financialReports : legalEntity?.soleProprietorship?.financialReports;
834
- return financialReports?.length ? {
835
- ...componentData,
836
- [key]: mapFinancialReportsToFinancialInformation(financialReports)
837
- } : componentData;
838
- }
839
- default:
840
- return componentData;
841
- }
842
- }, {});
843
- };
844
- const businessDetailsBase = {
845
- /* Base required fields */
846
- country: { rule: "REQUIRED" },
847
- entityType: { rule: "businessRequiresCompanyType" },
848
- legalCompanyName: { rule: "REQUIRED" },
849
- jaHaniLegalCompanyName: { rule: "japaneseLegalCompanyName" },
850
- jaKanaLegalCompanyName: { rule: "japaneseLegalCompanyName" },
851
- hasDoingBusinessAs: { rule: "REQUIRED" },
852
- doingBusinessAs: { rule: "requireDoingBusinessAsName" },
853
- registrationAddress: { rule: "REQUIRED" },
854
- operationalAddressIsSame: { rule: "REQUIRED" },
855
- /* Base optional fields */
856
- operationalAddress: { rule: "OPTIONAL" },
857
- /* Fields with custom country specific rules */
858
- hasSelectedBusiness: { rule: "requireBusinessSelection" },
859
- stockExchangeMIC: { rule: "ifPubliclyTradedCompany" },
860
- stockISIN: { rule: "ifPubliclyTradedCompany" },
861
- stockTickerSymbol: { rule: "ifPubliclyTradedCompany" },
862
- dateOfIncorporation: { rule: "isDateOfIncorporationRequired" },
863
- stateOrProvince: { rule: "countryUsingCompanySearch" },
864
- registrationNumber: { rule: "countryRequiresRegistrationNumber" },
865
- registrationNumberType: { rule: "registrationNumberType" },
866
- exemptedFromRegistrationNumber: { rule: "companyRegistrationNumberExemptionAllowed" },
867
- eInvoicingCode: { rule: "isEInvoicingCodeEnabled" },
868
- countryOfGoverningLaw: { rule: "countryOfGoverningLawRequired" },
869
- taxDocument: { rule: "ifCountryUsAndTinFailed" }
870
- };
871
- const taxInformationBase = {
872
- vatNumber: { rule: "countryUsesVat" },
873
- vatNumberType: { rule: "vatNumberType" },
874
- exemptedFromVat: { rule: "isVatExempt" },
875
- vatAbsenceReason: { rule: "isVatExempt" },
876
- taxInformation: { rule: "countryUsesTaxId" },
877
- exemptedFromTax: { rule: "countryHasTaxExemptions" },
878
- isUen: { rule: "countryUsesUenOrGst" }
879
- };
880
- const financialInformationBase = {
881
- numberOfEmployees: { rule: "countryRequiresFinancialInformation" },
882
- financialReportingDate: { rule: "isFinancialReportingFieldsRequired" },
883
- currency: { rule: "isFinancialReportingFieldsRequired" },
884
- reportedValueOption: { rule: "isFinancialReportingFieldsRequired" },
885
- annualTurnover: { rule: "annualTurnoverRequired" },
886
- netAssets: { rule: "netAssetsRequired" },
887
- balanceSheetTotal: { rule: "balanceSheetTotalRequired" }
888
- };
889
- const businessDetailsFieldsPerScenario = {
890
- L0: {
891
- country: { rule: "REQUIRED" },
892
- legalCompanyName: { rule: "REQUIRED" },
893
- stateOrProvince: { rule: "countryUsingCompanySearch" },
894
- ...financialInformationBase
895
- },
896
- L1: {
897
- ...businessDetailsBase,
898
- ...financialInformationBase
899
- },
900
- L: {
901
- ...businessDetailsBase,
902
- ...taxInformationBase,
903
- ...financialInformationBase
904
- },
905
- L_PROOFOFADDRESS: {
906
- // TODO this field does not exist
907
- // proofOfAddressDocument: { rule: 'REQUIRED' },
908
- },
909
- L_REGDOC: {
910
- registrationDocument: { rule: "REQUIRED" }
911
- },
912
- L_TAXDOC: {
913
- taxDocument: { rule: "REQUIRED" }
914
- },
915
- L_BAFIN: {
916
- legalForm: { rule: "REQUIRED" }
917
- }
918
- };
919
- const adjustFormData = (oldFormData, newFormData) => {
920
- const schema = Array.from((/* @__PURE__ */ new Set([...keysOf(oldFormData), ...keysOf(newFormData)])).keys());
921
- return schema.reduce((acc, key) => {
922
- const oldValue = oldFormData[key];
923
- const newValue = newFormData[key];
924
- if (!isUndefinedOrNull(newValue)) return { ...acc, [key]: newValue };
925
- if (Array.isArray(oldValue)) return { ...acc, [key]: [] };
926
- if (typeof oldValue === "number") return { ...acc, [key]: null };
927
- if (typeof oldValue === "string") return { ...acc, [key]: "" };
928
- return { ...acc, [key]: "" };
929
- }, {});
930
- };
931
- const setRemovedFieldsOnSchemaToDeletedValue = (newData, existingData) => {
932
- const formIds = Array.from((/* @__PURE__ */ new Set([...keysOf(existingData), ...keysOf(newData)])).keys());
933
- return formIds.reduce((adjusted, formId) => {
934
- const oldFormData = existingData[formId];
935
- const newFormData = newData[formId];
936
- if (isUndefinedOrNull(oldFormData)) return { ...adjusted, [formId]: newFormData };
937
- if (isUndefinedOrNull(newFormData)) return adjusted;
938
- return { ...adjusted, [formId]: adjustFormData(oldFormData, newFormData) };
939
- }, {});
940
- };
941
- const formatFinancialInformationSummary = (data, i18n, country, dateOfIncorporation) => {
942
- let summary;
943
- if (!data) return void 0;
944
- if (dateOfIncorporation && !isDateOlderThanAYear(dateOfIncorporation)) {
945
- if (country === CountryCodes.UnitedKingdom) {
946
- summary = { numberOfEmployees: `${data.numberOfEmployees}` };
947
- return summary;
948
- }
949
- return void 0;
950
- }
951
- summary = {
952
- currency: data.currency,
953
- financialReportingDate: data.financialReportingDate
954
- };
955
- if (country === CountryCodes.UnitedKingdom) {
956
- summary.numberOfEmployees = `${data.numberOfEmployees}`;
957
- }
958
- if (data.balanceSheetTotal) {
959
- summary.balanceSheetTotal = summaryItem(
960
- "balanceSheetTotal",
961
- formatCurrency(data.balanceSheetTotal, data.currency, i18n.locale)
962
- );
963
- }
964
- if (data.annualTurnover) {
965
- summary.annualTurnover = formatCurrency(data.annualTurnover, data.currency, i18n.locale);
966
- }
967
- return summary;
968
- };
969
- const mapBusinessDetailsDocumentToApiDocument = async (data, entityId) => {
970
- const {
971
- companyRegistrationDocument,
972
- companyTaxDocument,
973
- companyProofOfDirectorDocument,
974
- companyConstitutionalDocument,
975
- companyProofOfSignatoryDocument,
976
- companyProofOfOwnershipDocument,
977
- basicInformation
978
- } = data;
979
- const taxDocumentType = COUNTRIES_THAT_USE_TAX_ID_INSTEAD_OF_VAT.includes(
980
- basicInformation?.country
981
- ) ? "proofOfOrganizationTaxInfo" : "vatDocument";
982
- const documents = await Promise.all([
983
- createDocumentRequest({
984
- entityId,
985
- entityType: "legalEntity",
986
- documentType: "registrationDocument",
987
- page1: companyRegistrationDocument?.registrationDocument?.[0]
988
- }),
989
- createDocumentRequest({
990
- entityId,
991
- entityType: "legalEntity",
992
- documentType: taxDocumentType,
993
- page1: companyTaxDocument?.taxDocument?.[0]
994
- }),
995
- createDocumentRequest({
996
- entityId,
997
- entityType: "legalEntity",
998
- documentType: "proofOfDirector",
999
- page1: companyProofOfDirectorDocument?.proofOfDirector?.[0]
1000
- }),
1001
- createDocumentRequest({
1002
- entityId,
1003
- entityType: "legalEntity",
1004
- documentType: "constitutionalDocument",
1005
- page1: companyConstitutionalDocument?.constitutionalDocument?.[0]
1006
- }),
1007
- createDocumentRequest({
1008
- entityId,
1009
- entityType: "legalEntity",
1010
- documentType: "proofOfSignatory",
1011
- page1: companyProofOfSignatoryDocument?.proofOfSignatory?.[0]
1012
- }),
1013
- createDocumentRequest({
1014
- entityId,
1015
- entityType: "legalEntity",
1016
- documentType: "proofOfOwnership",
1017
- page1: companyProofOfOwnershipDocument?.proofOfOwnership?.[0],
1018
- page2: companyProofOfOwnershipDocument?.proofOfOwnership?.[1]
1019
- })
1020
- ]);
1021
- return documents.filter(Boolean);
1022
- };
1023
- const mapBusinessDetailsSchemaToLegalEntity = (data, accountHolder, isExperimentEnabled) => {
1024
- const requestObj = {
1025
- ...formatObject(
1026
- data,
1027
- accountHolder === "mySoleProprietorName" ? solePropBusinessDetailsApiKeyMapping : businessDetailsApiKeyMapping
1028
- )
1029
- };
1030
- delete requestObj.organization?.legalFormDescription;
1031
- const canSaveRegNumberAbsentState = isExperimentEnabled("EnableRegistrationAndTaxAbsentStatesV4") && isRegistrationNumberAbsentStateV4Scenario(
1032
- data.basicInformation?.country,
1033
- data.companyStructure?.entityType
1034
- );
1035
- const taxData = COUNTRIES_USING_COMPANY_SEARCH.includes(
1036
- data.basicInformation?.country
1037
- ) ? data.basicInformation?.taxInformation : data.additionalInformation?.taxInformation;
1038
- const registrationNumber = COUNTRIES_USING_COMPANY_SEARCH.includes(
1039
- data.basicInformation?.country
1040
- ) ? data.basicInformation?.registrationNumber : data.additionalInformation?.registrationNumber;
1041
- const localization = [
1042
- mapSchemaFieldsToApiScriptLocalization(data.basicInformation ?? {}, "jaHani"),
1043
- mapSchemaFieldsToApiScriptLocalization(data.basicInformation ?? {}, "jaKana")
1044
- ].filter(({ fields }) => !isEmpty(fields)).map(({ script, fields }) => ({
1045
- script,
1046
- // mismatch between API `legalName` and schema `legalCompanyName`
1047
- fields: { legalName: fields.legalCompanyName }
1048
- }));
1049
- const doingBusinessAs = data.additionalInformation?.doingBusinessAs ?? "";
1050
- const entityObject = isEmpty(data.companyStructure) ? requestObj.soleProprietorship : requestObj.organization;
1051
- if (entityObject) {
1052
- if (taxData) {
1053
- entityObject.taxInformation = taxData;
1054
- }
1055
- if (!!requestObj.soleProprietorship && !requestObj.soleProprietorship?.countryOfGoverningLaw && !!data.basicInformation?.country) {
1056
- requestObj.soleProprietorship.countryOfGoverningLaw = data.basicInformation.country;
1057
- }
1058
- if (registrationNumber) {
1059
- entityObject.registrationNumber = registrationNumber;
1060
- if (canSaveRegNumberAbsentState && requestObj.organization) {
1061
- requestObj.organization.registrationNumberAbsent = false;
1062
- }
1063
- }
1064
- if (requestObj.organization && entityObject && localization.length > 0) {
1065
- entityObject.localization = localization;
1066
- }
1067
- if (data.additionalInformation?.exemptedFromRegistrationNumber && canSaveRegNumberAbsentState && requestObj.organization) {
1068
- requestObj.organization.registrationNumberAbsent = data.additionalInformation?.exemptedFromRegistrationNumber;
1069
- }
1070
- if (data.additionalInformation?.vatAbsenceReason) {
1071
- entityObject.vatNumber = "";
1072
- }
1073
- if (isExperimentEnabled("EnableDoingBusinessAsNameV4")) {
1074
- if (typeof data.additionalInformation?.hasDoingBusinessAs !== "undefined") {
1075
- entityObject.doingBusinessAsAbsent = !data.additionalInformation?.hasDoingBusinessAs;
1076
- }
1077
- } else {
1078
- entityObject.doingBusinessAs = doingBusinessAs || data.basicInformation?.legalCompanyName;
1079
- delete entityObject.doingBusinessAsAbsent;
1080
- }
1081
- if (data.additionalInformation?.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME && entityObject.principalPlaceOfBusiness) {
1082
- entityObject.principalPlaceOfBusiness = entityObject.registeredAddress;
1083
- }
1084
- if (!isEmpty(data.companyFinancialInformation)) {
1085
- const isIncorporationDateDependencyEnabled = isExperimentEnabled(
1086
- "EnableIncorporationDateBasedFinancialValidationForHO"
1087
- );
1088
- entityObject.financialReports = [
1089
- mapFinancialInformationToFinancialReport(
1090
- data.companyFinancialInformation,
1091
- isIncorporationDateDependencyEnabled ? data?.additionalInformation?.dateOfIncorporation : void 0
1092
- )
1093
- ];
1094
- }
1095
- }
1096
- requestObj.type = requestObj.organization ? LegalEntityTypes.ORGANIZATION : LegalEntityTypes.SOLE_PROPRIETORSHIP;
1097
- if (entityObject?.registeredAddress.country === "US") {
1098
- delete entityObject.registrationNumber;
1099
- }
1100
- if (!canSaveRegNumberAbsentState) {
1101
- delete requestObj.organization?.registrationNumberAbsent;
1102
- }
1103
- return requestObj;
1104
- };
1105
- const MANDATORY_FIELDS_BUSINESS_DETAILS = [
1106
- "basicInformation.legalCompanyName",
1107
- "basicInformation.country"
1108
- ];
1109
- const canSubmit = (data) => MANDATORY_FIELDS_BUSINESS_DETAILS.every((detail) => {
1110
- const value = getProp(data, detail);
1111
- return !isEmpty$1(value);
1112
- });
1113
- const isDocumentsRequired = (forms) => forms.some((form) => documentFormsIds.includes(form.formId));
1114
- const removeConditionalForms = (forms, isSkippingCompanyStructure) => isSkippingCompanyStructure ? forms.filter((f) => f.formId !== "companyStructure" && f.formId !== "companyType") : forms;
1115
- const formatBasicInformation = (data, labels, datasetUtils, companyType, isCountryOfGoverningLawEnabled) => {
1116
- const country = data?.country;
1117
- const registrationNumberLabel = resolveFieldMetadata(
1118
- registrationNumberDefaultFieldConfig[country],
1119
- {
1120
- companyType,
1121
- registrationNumberType: data.registrationNumber ? inferCompanyRegistrationNumberType(data?.registrationNumber, country, companyType) : getCompanyRegistrationNumberOptions(country, companyType)?.[0]?.id
1122
- },
1123
- registrationNumberDefaultFieldMetadata
1124
- ).label;
1125
- const taxIdLabel = resolveFieldMetadata(
1126
- taxInformationDefaultFieldConfig[country],
1127
- {
1128
- taxIdNumberType: countryToTaxInfoTypeMap[country] ?? void 0,
1129
- // TODO use type selector
1130
- companyType: void 0
1131
- },
1132
- taxInformationDefaultFieldMetadata
1133
- ).label;
1134
- const countryOfGoverningLaw = getCountryOfGoverningLaw(isCountryOfGoverningLawEnabled, data);
1135
- return {
1136
- [labels?.basicInformation?.legalCompanyName ?? "legalCompanyName"]: data.legalCompanyName,
1137
- country: datasetUtils.getCountryName(data.country),
1138
- [getKeyForField("stateOrProvince", data.country)]: datasetUtils.getStateName(
1139
- data.stateOrProvince,
1140
- data.country
1141
- ),
1142
- [taxIdLabel]: data.taxInformation?.find((taxId) => data.country === taxId.country)?.number,
1143
- [registrationNumberLabel]: data.registrationNumber,
1144
- countryOfGoverningLaw: datasetUtils.getCountryName(countryOfGoverningLaw)
1145
- };
1146
- };
1147
- const formatAdditionalInformation = (data, labels, country, companyType, i18n) => {
1148
- const registrationNumberLabel = resolveFieldMetadata(
1149
- registrationNumberDefaultFieldConfig[country],
1150
- {
1151
- companyType,
1152
- registrationNumberType: data.registrationNumber ? inferCompanyRegistrationNumberType(data?.registrationNumber, country, companyType) : getCompanyRegistrationNumberOptions(country, companyType)?.[0]?.id
1153
- },
1154
- registrationNumberDefaultFieldMetadata
1155
- ).label;
1156
- const taxIdLabel = resolveFieldMetadata(
1157
- taxInformationDefaultFieldConfig[country],
1158
- {
1159
- taxIdNumberType: countryToTaxInfoTypeMap[country] ?? void 0,
1160
- // TODO use type selector
1161
- companyType: void 0
1162
- },
1163
- taxInformationDefaultFieldMetadata
1164
- ).label;
1165
- return {
1166
- [labels?.additionalInformation?.legalForm ?? "businessStructure"]: data.legalFormLabel,
1167
- [labels?.additionalInformation?.doingBusinessAs ?? "doingBusinessAs"]: data.doingBusinessAs,
1168
- [registrationNumberLabel]: data.registrationNumber,
1169
- [taxIdLabel]: data.isUen ? void 0 : data.taxInformation?.find((taxId) => country === taxId.country)?.number,
1170
- [labels?.additionalInformation?.vatNumber ?? "vatNumber"]: data.vatNumber,
1171
- [labels?.additionalInformation?.vatAbsenceReason ?? "vatAbsenceReason"]: data.vatAbsenceReason ? i18n.get(data.vatAbsenceReason) : void 0,
1172
- [labels?.additionalInformation?.dateOfIncorporation ?? "dateOfIncorporation"]: data.dateOfIncorporation,
1173
- [labels?.additionalInformation?.stockExchangeMIC ?? "stockExchangeMIC"]: data.stockExchangeMIC,
1174
- [labels?.additionalInformation?.stockISIN ?? "stockISIN"]: data.stockISIN,
1175
- [labels?.additionalInformation?.stockTickerSymbol ?? "stockTickerSymbol"]: data.stockTickerSymbol,
1176
- [labels?.additionalInformation?.eInvoicingCode ?? "eInvoicingCode"]: data.eInvoicingCode
1177
- };
1178
- };
1179
- const formatDataForSummary = (data, forms, labels, i18n, isExperimentEnabled) => {
1180
- const datasetUtils = datasetUtilities(i18n.locale);
1181
- return entriesOf(data).reduce((summaryData, [form]) => {
1182
- if (!form || !data[form]) return summaryData;
1183
- const isCountryOfGoverningLawEnabled = isExperimentEnabled(
1184
- "EnableCountryOfGoverningLawForUKCompanies"
1185
- );
1186
- switch (form) {
1187
- case "basicInformation":
1188
- return {
1189
- ...summaryData,
1190
- [form]: formatBasicInformation(
1191
- data[form],
1192
- labels,
1193
- datasetUtils,
1194
- data.companyStructure?.entityType,
1195
- isCountryOfGoverningLawEnabled
1196
- )
1197
- };
1198
- case "companyStructure":
1199
- return {
1200
- ...summaryData,
1201
- [form]: {
1202
- entityType: i18n.get(
1203
- companyTypeMetadata[data[form]?.entityType]?.name
1204
- )
1205
- }
1206
- };
1207
- case "additionalInformation":
1208
- return {
1209
- ...summaryData,
1210
- [form]: {
1211
- hasInnerForms: true,
1212
- additionalInformationFormName: formatAdditionalInformation(
1213
- data[form],
1214
- labels,
1215
- data.basicInformation?.country,
1216
- data.companyStructure?.entityType,
1217
- i18n
1218
- ),
1219
- registrationAddress: mapAddressLabels(data[form].registrationAddress, datasetUtils),
1220
- operationalAddress: data[form].operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME ? mapAddressLabels(data[form].operationalAddress, datasetUtils) : void 0
1221
- }
1222
- };
1223
- case "companyRegistrationDocument":
1224
- if (!isDocumentsRequired(forms)) return summaryData;
1225
- return {
1226
- ...summaryData,
1227
- [form]: {
1228
- companyRegistrationDocument: {
1229
- fileName: data[form].registrationDocument?.[0]?.name
1230
- }
1231
- }
1232
- };
1233
- case "companyTaxDocument":
1234
- if (!isDocumentsRequired(forms)) return summaryData;
1235
- return {
1236
- ...summaryData,
1237
- [form]: {
1238
- companyTaxDocument: {
1239
- fileName: data[form].taxDocument?.[0]?.name
1240
- }
1241
- }
1242
- };
1243
- case "companyProofOfDirectorDocument":
1244
- if (!isDocumentsRequired(forms)) return summaryData;
1245
- return {
1246
- ...summaryData,
1247
- [form]: {
1248
- companyProofOfDirectorDocument: {
1249
- fileName: data[form].proofOfDirector?.[0]?.name
1250
- }
1251
- }
1252
- };
1253
- case "companyProofOfSignatoryDocument":
1254
- if (!isDocumentsRequired(forms)) return summaryData;
1255
- return {
1256
- ...summaryData,
1257
- [form]: {
1258
- companyProofOfSignatoryDocument: {
1259
- fileName: data[form].proofOfSignatory?.[0]?.name
1260
- }
1261
- }
1262
- };
1263
- case "companyProofOfOwnershipDocument":
1264
- if (!isDocumentsRequired(forms)) return summaryData;
1265
- return {
1266
- ...summaryData,
1267
- [form]: {
1268
- companyProofOfOwnershipDocument: {
1269
- fileName: data[form].proofOfOwnership?.map((doc) => doc.name).join("\n")
1270
- }
1271
- }
1272
- };
1273
- case "companyFinancialInformation": {
1274
- const isIncorporationDateDependencyEnabled = isExperimentEnabled(
1275
- "EnableIncorporationDateBasedFinancialValidationForHO"
1276
- );
1277
- return {
1278
- ...summaryData,
1279
- [form]: formatFinancialInformationSummary(
1280
- data[form],
1281
- i18n,
1282
- data?.basicInformation?.country,
1283
- isIncorporationDateDependencyEnabled ? data?.additionalInformation?.dateOfIncorporation : void 0
1284
- )
1285
- };
1286
- }
1287
- default:
1288
- return summaryData;
1289
- }
1290
- }, {});
1291
- };
1292
- async function submitDocuments({
1293
- data,
1294
- legalEntity,
1295
- forms,
1296
- documentUtils,
1297
- additionalTrackingParams,
1298
- userEvents
1299
- }) {
1300
- if (!isDocumentsRequired(forms)) return;
1301
- const logger = createLogger();
1302
- const formattedDocument = await mapBusinessDetailsDocumentToApiDocument(data, legalEntity.id);
1303
- try {
1304
- if (formattedDocument) {
1305
- await documentUtils.uploadDocuments(formattedDocument, legalEntity.id);
1306
- formattedDocument.forEach((doc) => {
1307
- userEvents?.addTaskEvent("Success", {
1308
- ...additionalTrackingParams,
1309
- actionType: "upload",
1310
- documentType: doc.type,
1311
- fileExtention: doc.attachments?.map((item) => getFileExtention(item.pageName)).filter((item) => item !== void 0) ?? []
1312
- });
1313
- });
1314
- }
1315
- } catch (err) {
1316
- logger.error(err);
1317
- userEvents.addTaskEvent("Encountered error", {
1318
- ...additionalTrackingParams,
1319
- actionType: "upload",
1320
- returnType: err.errorCode,
1321
- returnValue: err.title ?? err.message
1322
- });
1323
- }
1324
- }
1325
- async function submit({
1326
- additionalTrackingParams,
1327
- data,
1328
- legalEntityResponse,
1329
- associatedLegalArrangement,
1330
- nestedLegalEntity,
1331
- nestedLegalEntityDetails,
1332
- problems,
1333
- taskType,
1334
- accountHolder,
1335
- forms,
1336
- documentUtils,
1337
- i18n,
1338
- showToast,
1339
- setLoadingStatus,
1340
- setProblems,
1341
- handleUpdateLegalEntity,
1342
- createLegalEntity,
1343
- onExternalSubmit,
1344
- isExperimentEnabled,
1345
- userEvents
1346
- }) {
1347
- const logger = createLogger();
1348
- setLoadingStatus("loading");
1349
- let trackingPayload = {
1350
- ...additionalTrackingParams,
1351
- actionType: "submit",
1352
- companyStructure: data.companyStructure?.entityType ?? null,
1353
- countryOfRegistration: data.basicInformation?.country ?? null,
1354
- legalEntityName: accountHolder === "theCompanyIWorkFor" ? data.basicInformation?.legalCompanyName ?? null : null,
1355
- // Only send legalCompanyName for organizations
1356
- usedAdditionalAddress: data.additionalInformation?.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME
1357
- };
1358
- const entityToUpdate = (() => {
1359
- switch (taskType) {
1360
- case TaskTypes.SOLE_PROPRIETOR_COMPANY:
1361
- return associatedLegalArrangement;
1362
- case TaskTypes.TRUST_MEMBER_COMPANY:
1363
- case TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_COMPANY:
1364
- return nestedLegalEntity;
1365
- case TaskTypes.BUSINESS_DETAILS:
1366
- default:
1367
- return legalEntityResponse;
1368
- }
1369
- })();
1370
- const handleSubmitLegalEntity = async (legalEntity) => {
1371
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY && !nestedLegalEntity?.id || taskType === TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_COMPANY && !nestedLegalEntity?.id || taskType === TaskTypes.SOLE_PROPRIETOR_COMPANY && !associatedLegalArrangement?.id) {
1372
- return await createLegalEntity(legalEntity);
1373
- } else {
1374
- return handleUpdateLegalEntity({
1375
- ...drop("type").from(legalEntity),
1376
- id: entityToUpdate?.id ?? legalEntityResponse.id
1377
- });
1378
- }
1379
- };
1380
- const associateLegalEntityWithParent = async ({
1381
- legalEntity,
1382
- associatedLegalArrangement: associatedLegalArrangement2,
1383
- nestedLegalEntityDetails: nestedLegalEntityDetails2
1384
- }) => {
1385
- if (nestedLegalEntityDetails2 && associatedLegalArrangement2) {
1386
- const existingEntityAssociations = getOwnEntityAssociations(associatedLegalArrangement2);
1387
- const existingRoles = existingEntityAssociations.filter((ea) => ea.legalEntityId === associatedLegalArrangement2.id).map(({ type }) => type);
1388
- const newRoles = nestedLegalEntityDetails2?.roles ?? [];
1389
- const rolesChanged = !doArraysMatch(existingRoles, newRoles);
1390
- if (rolesChanged) {
1391
- const updatedAssociations = {
1392
- entityAssociations: [
1393
- ...newRoles.map((role) => ({
1394
- type: role,
1395
- legalEntityId: legalEntity.id
1396
- })) || [],
1397
- ...existingEntityAssociations.filter((ea) => ea.legalEntityId !== legalEntity.id) || []
1398
- ]
1399
- };
1400
- await handleUpdateLegalEntity({
1401
- ...updatedAssociations,
1402
- id: associatedLegalArrangement2.id
1403
- });
1404
- }
1405
- return;
1406
- } else {
1407
- const updatedAssociations = {
1408
- entityAssociations: [
1409
- {
1410
- type: LegalEntityTypes.SOLE_PROPRIETORSHIP,
1411
- legalEntityId: legalEntity.id
1412
- }
1413
- ]
1414
- };
1415
- await handleUpdateLegalEntity({ ...updatedAssociations, id: legalEntityResponse.id });
1416
- }
1417
- };
1418
- const savedLegalEntityData = legalEntityResponse ? mapLegalEntityToBusinessDetailsSchema(legalEntityResponse, void 0, isExperimentEnabled) : null;
1419
- const filteredData = savedLegalEntityData ? setRemovedFieldsOnSchemaToDeletedValue(data, savedLegalEntityData) : data;
1420
- if (filteredData?.additionalInformation && !filteredData?.additionalInformation?.taxInformation) {
1421
- filteredData.additionalInformation.taxInformation = void 0;
1422
- }
1423
- const isCountryOfGoverningLawEnabled = isExperimentEnabled(
1424
- "EnableCountryOfGoverningLawForUKCompanies"
1425
- );
1426
- const countryOfGoverningLaw = getCountryOfGoverningLaw(
1427
- isCountryOfGoverningLawEnabled,
1428
- filteredData?.basicInformation
1429
- );
1430
- if (filteredData?.basicInformation) {
1431
- if (countryOfGoverningLaw) {
1432
- filteredData.basicInformation.countryOfGoverningLaw = countryOfGoverningLaw;
1433
- } else {
1434
- delete filteredData.basicInformation.countryOfGoverningLaw;
1435
- }
1436
- }
1437
- try {
1438
- const mappedLegalEntity = {
1439
- ...mapBusinessDetailsSchemaToLegalEntity(filteredData, accountHolder, isExperimentEnabled),
1440
- entityAssociations: filterOutUnwantedAssociationsIfRootLE(
1441
- taskType,
1442
- entityToUpdate,
1443
- accountHolder
1444
- )
1445
- };
1446
- const legalEntity = await handleSubmitLegalEntity(mappedLegalEntity);
1447
- if (taskType === TaskTypes.TRUST_MEMBER_COMPANY || taskType === TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_COMPANY || taskType === TaskTypes.SOLE_PROPRIETOR_COMPANY && !associatedLegalArrangement?.id) {
1448
- await associateLegalEntityWithParent({
1449
- legalEntity,
1450
- associatedLegalArrangement,
1451
- nestedLegalEntityDetails
1452
- });
1453
- }
1454
- await submitDocuments({
1455
- data,
1456
- legalEntity,
1457
- additionalTrackingParams,
1458
- documentUtils,
1459
- forms,
1460
- userEvents
1461
- });
1462
- userEvents?.addTaskEvent("Success", trackingPayload);
1463
- showToast({ label: i18n.get("successfullyUpdatedDetails"), variant: "success" });
1464
- onExternalSubmit?.(data);
1465
- } catch (err) {
1466
- if (isValidationError(err)) {
1467
- const getErrors = processValidationErrors(err, TaskTypes.BUSINESS_DETAILS);
1468
- if (getErrors && !Object.keys(getErrors).length) {
1469
- showToast({ label: i18n.get("failedToUpdateDetails"), variant: "error" });
1470
- const unmappedErrorNames = err.invalidFields?.map((field) => field.name).filter(Boolean) ?? [];
1471
- if (unmappedErrorNames.length) {
1472
- trackingPayload = {
1473
- ...trackingPayload,
1474
- additionalData: { unmappedErrorNames }
1475
- };
1476
- }
1477
- } else {
1478
- setProblems({
1479
- ...problems,
1480
- validationErrors: getErrors
1481
- });
1482
- }
1483
- }
1484
- if (isMaintenanceModeError(err)) {
1485
- showToast({
1486
- label: i18n.get("maintenanceModeMessage"),
1487
- variant: "error",
1488
- duration: "indefinite"
1489
- });
1490
- }
1491
- if (!isValidationError(err) && !isMaintenanceModeError(err)) {
1492
- showToast({ label: i18n.get("failedToUpdateDetails"), variant: "error" });
1493
- }
1494
- logger.error(err);
1495
- userEvents?.addTaskEvent("Encountered error", {
1496
- ...trackingPayload,
1497
- returnType: err?.errorCode,
1498
- returnValue: err?.title || "backend"
1499
- });
1500
- } finally {
1501
- setLoadingStatus("success");
1502
- }
1503
- }
1504
- const getCountryOfGoverningLaw = (isCountryOfGoverningLawEnabled, basicData) => {
1505
- if (!isCountryOfGoverningLawEnabled || basicData?.country !== CountryCodes.UnitedKingdom) {
1506
- return void 0;
1507
- }
1508
- if (isCountryOfGoverningLawEnabled && basicData?.country === CountryCodes.UnitedKingdom && !basicData?.countryOfGoverningLaw) {
1509
- return CountryCodes.UnitedKingdom;
1510
- }
1511
- return basicData?.countryOfGoverningLaw;
1512
- };
1513
- function BusinessDetailsDropin({
1514
- country,
1515
- problems,
1516
- legalEntityResponse,
1517
- associatedLegalArrangement,
1518
- // initially undefined when creating entity
1519
- nestedLegalEntity,
1520
- // initially undefined when creating entity
1521
- nestedLegalEntityDetails,
1522
- // has entity roles for association logic
1523
- taskName,
1524
- hideSidebar,
1525
- taskType,
1526
- onChange,
1527
- onSubmit: onExternalSubmit,
1528
- handleHomeClick
1529
- }) {
1530
- const formRef = useRef(null);
1531
- const { accountHolder, setAccountHolder } = useAccountHolder();
1532
- const { showToast } = useToastContext();
1533
- const { i18n } = useI18nContext();
1534
- const userEvents = useAnalyticsContext();
1535
- const { isExperimentEnabled } = useExperimentsContext();
1536
- const { isSettingEnabled } = useSettingsContext();
1537
- const { baseUrl, rootLegalEntityId } = useApiContext();
1538
- const verifiedBusiness$1 = verifiedBusiness.value;
1539
- const queryClient = useQueryClient();
1540
- const {
1541
- state: { currentState }
1542
- } = useStateContext();
1543
- useEffect(() => {
1544
- onChange?.(currentState);
1545
- }, [currentState, onChange]);
1546
- const isSoleProp = accountHolder === "mySoleProprietorName";
1547
- const formWith2Views = "basicInformation";
1548
- const isAssociationTaskType = !taskType ? accountHolder !== "theCompanyIWorkFor" : taskType !== TaskTypes.BUSINESS_DETAILS;
1549
- const legalEntityType = !isSoleProp ? LegalEntityTypes.ORGANIZATION : LegalEntityTypes.SOLE_PROPRIETORSHIP;
1550
- const isUS = country === CountryCodes.UnitedStates;
1551
- const currentCountry = currentState.data.basicInformation?.country ?? country;
1552
- const isSkippingCompanyStructure = isSettingEnabled(SettingNames.AllowLegalEntityTypeChange) && organizationTypesToSkipCompanyStructureForm.includes(
1553
- legalEntityResponse?.organization?.type
1554
- ) && accountHolder !== "aTrust" && accountHolder !== "anUnincorporatedPartnership" || isSoleProp;
1555
- useEffect(() => {
1556
- const isBankAccountRequested = legalEntityResponse?.capabilities?.issueBankAccount?.requested;
1557
- setIsBankAccountRequestedForOrganization(isBankAccountRequested);
1558
- }, [legalEntityResponse]);
1559
- const subjectEntity = !isAssociationTaskType ? legalEntityResponse : isSoleProp ? associatedLegalArrangement : nestedLegalEntity;
1560
- const associatedLeTrackingParams = useMemo(
1561
- () => getAssociatedLeAnalyticsPayload({
1562
- associatedLegalEntity: associatedLegalArrangement
1563
- }),
1564
- [associatedLegalArrangement]
1565
- );
1566
- useEffect(() => {
1567
- userEvents.updateBaseTrackingPayload({ task: taskType });
1568
- userEvents.addTaskEvent("Landed on page", {
1569
- actionType: "start",
1570
- ...subjectEntity?.id && subjectEntity?.type && {
1571
- legalEntityId: subjectEntity.id,
1572
- entityType: subjectEntity.type
1573
- },
1574
- ...associatedLeTrackingParams
1575
- });
1576
- }, []);
1577
- const [tinMatched, setTinMatched] = useState(void 0);
1578
- const [initialData, setInitialData] = useState(() => {
1579
- return mapLegalEntityToBusinessDetailsSchema(
1580
- !isAssociationTaskType ? legalEntityResponse : isSoleProp ? associatedLegalArrangement ?? legalEntityResponse : nestedLegalEntity,
1581
- isSoleProp ? legalEntityResponse : void 0,
1582
- isExperimentEnabled
1583
- );
1584
- });
1585
- const [trustedFields, setTrustedFields] = useState(subjectEntity?.trustedFields ?? void 0);
1586
- const [currentProblems, setCurrentProblems] = useState(
1587
- problems ?? getCapabilityProblems(legalEntityResponse, currentCountry)?.LegalEntity?.[legalEntityResponse.id] ?? {}
1588
- );
1589
- const [showCompanyStructure, setShowCompanyStructure] = useState(
1590
- currentCountry !== "US" && !isSoleProp
1591
- );
1592
- const [showBusinessSelection, setShowBusinessSelection] = useState(false);
1593
- const [loadingStatus, setLoadingStatus] = useState("success");
1594
- const [businessMismatchModalOpen, setBusinessMismatchModalOpen] = useState(false);
1595
- const [companySearchParams, setCompanySearchParams] = useState({
1596
- legalCompanyName: void 0,
1597
- country: void 0,
1598
- stateOrProvince: void 0,
1599
- registrationNumber: void 0
1600
- });
1601
- const [singleCompanyDatasetParams, setSingleCompanyDatasetParams] = useState();
1602
- const documentUtils = documentApiUtils({
1603
- baseUrl: baseUrl.value,
1604
- rootLegalEntityId: rootLegalEntityId.value
1605
- });
1606
- useEffect(() => {
1607
- if (!subjectEntity?.documentDetails?.length) return;
1608
- documentUtils.fetchDocuments(subjectEntity.documentDetails, subjectEntity.id).then(() => {
1609
- setInitialData(
1610
- mapLegalEntityToBusinessDetailsSchema(
1611
- subjectEntity,
1612
- isSoleProp ? legalEntityResponse : void 0
1613
- )
1614
- );
1615
- }).catch(
1616
- () => showToast({ label: i18n.get("failedToFetchRelevantDocuments"), variant: "error" })
1617
- );
1618
- }, []);
1619
- const parseConfiguration = useCallback(
1620
- ({ scenarios }) => composePerScenarioFormConfigurations(scenarios, businessDetailsFieldsPerScenario),
1621
- []
1622
- );
1623
- const {
1624
- fieldConfigurations
1625
- } = useScenarioConfiguration({
1626
- legalEntityType,
1627
- parseConfiguration,
1628
- setLoadingStatus,
1629
- country: currentCountry
1630
- });
1631
- const customRules = useMemo(
1632
- () => rules({
1633
- data: currentState.data,
1634
- country: currentCountry,
1635
- taskType: taskType ?? TaskTypes.BUSINESS_DETAILS,
1636
- isExperimentEnabled,
1637
- accountHolder,
1638
- tinMatched,
1639
- rootLegalEntity: legalEntityResponse
1640
- }),
1641
- [
1642
- currentState.data,
1643
- currentCountry,
1644
- taskType,
1645
- isExperimentEnabled,
1646
- accountHolder,
1647
- tinMatched,
1648
- legalEntityResponse
1649
- ]
1650
- );
1651
- const initialForms = useMemo(() => getForms(currentCountry), [currentCountry]);
1652
- const derivedProps = useMemo(
1653
- () => getPropsFromConfigurations(
1654
- fieldConfigurations,
1655
- initialForms,
1656
- currentProblems?.remediationActions ? Object.values(currentProblems?.remediationActions) : [],
1657
- currentProblems?.missingData ?? [],
1658
- subjectEntity ? subjectEntity.type === LegalEntityTypes.SOLE_PROPRIETORSHIP ? getFieldsWithExistingData(
1659
- subjectEntity,
1660
- solePropBusinessDetailsApiKeyMapping,
1661
- solePropBusinessDetailsDocumentMapping
1662
- ) : getFieldsWithExistingData(
1663
- subjectEntity,
1664
- businessDetailsApiKeyMapping,
1665
- businessDetailsDocumentMapping
1666
- ) : [],
1667
- customRules,
1668
- {},
1669
- {},
1670
- subjectEntity?.type,
1671
- trustedFields
1672
- ),
1673
- [
1674
- fieldConfigurations,
1675
- initialForms,
1676
- currentProblems?.remediationActions,
1677
- currentProblems?.missingData,
1678
- subjectEntity,
1679
- customRules,
1680
- trustedFields
1681
- ]
1682
- );
1683
- const {
1684
- data: companySearchResponse,
1685
- isLoading: searchingCompanies,
1686
- isError: searchingError
1687
- } = useCompanySearch(
1688
- {
1689
- name: companySearchParams.legalCompanyName ?? "",
1690
- country: companySearchParams.country,
1691
- state: companySearchParams.stateOrProvince,
1692
- registrationNumber: companySearchParams.registrationNumber
1693
- },
1694
- {
1695
- enabled: showBusinessSelection
1696
- }
1697
- );
1698
- const companySearchResults = companySearchResponse?.results;
1699
- const businessName = currentState?.data?.basicInformation?.legalCompanyName || "";
1700
- const nameMatch = isNormalizedStringMatch(businessName, companySearchResults?.[0]?.name ?? "");
1701
- const taxInformation = currentState?.data?.basicInformation?.taxInformation;
1702
- const tin = taxInformation?.find((taxId) => currentCountry === taxId.country)?.number || "";
1703
- const [prevCompanySearchResults, setPrevCompanySearchResults] = useState(companySearchResults);
1704
- useEffect(() => {
1705
- if (!searchingCompanies && companySearchResults) {
1706
- userEvents.addPageEvent("Success", {
1707
- actionType: "submit",
1708
- label: "companySearch",
1709
- additionalData: {
1710
- numberOfResults: companySearchResults.length
1711
- },
1712
- ...subjectEntity?.id && subjectEntity?.type && {
1713
- legalEntityId: subjectEntity.id,
1714
- entityType: subjectEntity.type
1715
- },
1716
- ...associatedLeTrackingParams
1717
- });
1718
- }
1719
- }, [
1720
- searchingCompanies,
1721
- companySearchResults,
1722
- userEvents,
1723
- subjectEntity,
1724
- associatedLeTrackingParams
1725
- ]);
1726
- const {
1727
- data: singleCompanyDatasetAndTinResponse,
1728
- isLoading: fetchingDataset,
1729
- refetch: getCompanySelection
1730
- } = useCompanySelection(singleCompanyDatasetParams, {
1731
- enabled: !!singleCompanyDatasetParams && showBusinessSelection
1732
- });
1733
- const { refetch: fetchTin } = useVerifyTin({ name: businessName, tin }, { enabled: false });
1734
- const forms = useMemo(() => {
1735
- const requiredForms = getRequiredForms(
1736
- initialForms,
1737
- derivedProps?.requiredFields,
1738
- derivedProps?.optionalFields
1739
- );
1740
- const validityAddedForms = addValidityToForms(
1741
- requiredForms,
1742
- currentState.validityByForm,
1743
- currentProblems
1744
- );
1745
- return removeConditionalForms(
1746
- validityAddedForms,
1747
- currentCountry !== "US" || accountHolder !== "theCompanyIWorkFor" ? isSkippingCompanyStructure : !showCompanyStructure
1748
- );
1749
- }, [
1750
- initialForms,
1751
- derivedProps?.requiredFields,
1752
- derivedProps?.optionalFields,
1753
- currentState.validityByForm,
1754
- currentProblems,
1755
- currentCountry,
1756
- isSkippingCompanyStructure,
1757
- showCompanyStructure
1758
- ]);
1759
- const summaryData = useMemo(
1760
- () => ({
1761
- data: formatDataForSummary(
1762
- currentState.data,
1763
- forms,
1764
- derivedProps?.labels,
1765
- i18n,
1766
- isExperimentEnabled
1767
- ),
1768
- omitted: {
1769
- keys: ["operationalAddressIsSame"]
1770
- }
1771
- }),
1772
- [currentState.data, derivedProps?.labels, forms, i18n, isExperimentEnabled]
1773
- );
1774
- const canSubmitForm = useMemo(
1775
- () => canSubmit(currentState.data) && hasDataChanged(initialData, currentState.data),
1776
- [initialData, currentState.data]
1777
- );
1778
- const { mutateAsync: createLegalEntity } = useCreateLegalEntity();
1779
- const { mutateAsync: updateLegalEntity } = useUpdateLegalEntity();
1780
- const { mutateAsync: clearCompanyData, isPending: resettingTrustedData } = useClearCompanyData();
1781
- const submitTask = useCallback(() => {
1782
- setAccountHolder(accountHolder);
1783
- return submit({
1784
- additionalTrackingParams: associatedLeTrackingParams,
1785
- data: currentState.data,
1786
- legalEntityResponse,
1787
- associatedLegalArrangement,
1788
- nestedLegalEntity,
1789
- nestedLegalEntityDetails,
1790
- problems: currentProblems,
1791
- taskType: taskType ?? TaskTypes.BUSINESS_DETAILS,
1792
- accountHolder: accountHolder ?? "theCompanyIWorkFor",
1793
- forms,
1794
- documentUtils,
1795
- i18n,
1796
- showToast,
1797
- setLoadingStatus,
1798
- setProblems: setCurrentProblems,
1799
- handleUpdateLegalEntity: updateLegalEntity,
1800
- createLegalEntity,
1801
- onExternalSubmit,
1802
- isExperimentEnabled,
1803
- userEvents
1804
- });
1805
- }, [
1806
- setAccountHolder,
1807
- accountHolder,
1808
- associatedLeTrackingParams,
1809
- currentState.data,
1810
- legalEntityResponse,
1811
- associatedLegalArrangement,
1812
- nestedLegalEntity,
1813
- nestedLegalEntityDetails,
1814
- currentProblems,
1815
- taskType,
1816
- forms,
1817
- documentUtils,
1818
- i18n,
1819
- showToast,
1820
- updateLegalEntity,
1821
- createLegalEntity,
1822
- onExternalSubmit,
1823
- isExperimentEnabled,
1824
- userEvents
1825
- ]);
1826
- const {
1827
- handleNextClick,
1828
- handleBackClick,
1829
- activeForm,
1830
- shouldValidate,
1831
- setShouldValidate,
1832
- gotoFormByFormIndex,
1833
- steps
1834
- } = useFormComposer({
1835
- problems: currentProblems,
1836
- navigationTrackingParams: associatedLeTrackingParams,
1837
- forms,
1838
- onSubmit: submitTask
1839
- });
1840
- const loading = fetchingDataset || searchingCompanies || resettingTrustedData;
1841
- const proceedToManualDataEntry = useCallback(async () => {
1842
- await clearCompanyData().then(async () => {
1843
- if (!isUS) {
1844
- setShowCompanyStructure(true);
1845
- return;
1846
- }
1847
- if (!businessName || !tin) {
1848
- setShowCompanyStructure(true);
1849
- return;
1850
- }
1851
- const { data: refetchedTinResponse } = await fetchTin();
1852
- if (refetchedTinResponse?.matched === true) {
1853
- setShowCompanyStructure(true);
1854
- setBusinessMismatchModalOpen(false);
1855
- } else {
1856
- setBusinessMismatchModalOpen(true);
1857
- setTinMatched(false);
1858
- if (subjectEntity?.id && subjectEntity?.type) {
1859
- userEvents.addPageEvent("Encountered error", {
1860
- actionType: "submit",
1861
- label: "tinVerificationFailure",
1862
- legalEntityId: subjectEntity.id,
1863
- entityType: subjectEntity.type,
1864
- ...associatedLeTrackingParams
1865
- });
1866
- }
1867
- }
1868
- });
1869
- }, [
1870
- clearCompanyData,
1871
- isUS,
1872
- businessName,
1873
- tin,
1874
- getCompanySelection,
1875
- subjectEntity?.id,
1876
- subjectEntity?.type,
1877
- associatedLeTrackingParams,
1878
- userEvents
1879
- ]);
1880
- if (prevCompanySearchResults !== companySearchResults) {
1881
- if (companySearchResults?.length === 1 && nameMatch) {
1882
- setSingleCompanyDatasetParams({
1883
- company: companySearchResults[0],
1884
- state: currentState.data.basicInformation?.stateOrProvince,
1885
- name: businessName,
1886
- tin
1887
- });
1888
- } else if (companySearchResults?.length === 0 && !searchingCompanies && showBusinessSelection) {
1889
- proceedToManualDataEntry();
1890
- }
1891
- setPrevCompanySearchResults(companySearchResults);
1892
- }
1893
- const [prevSingleCompanyDatasetResponse, setPrevSingleCompanyDatasetResponse] = useState(
1894
- singleCompanyDatasetAndTinResponse
1895
- );
1896
- if (prevSingleCompanyDatasetResponse !== singleCompanyDatasetAndTinResponse) {
1897
- if (singleCompanyDatasetAndTinResponse?.tinMatched === true) {
1898
- setVerifiedBusiness(singleCompanyDatasetAndTinResponse);
1899
- handleNextClick();
1900
- } else {
1901
- setBusinessMismatchModalOpen(true);
1902
- setTinMatched(false);
1903
- }
1904
- setPrevSingleCompanyDatasetResponse(singleCompanyDatasetAndTinResponse);
1905
- }
1906
- useEffect(() => {
1907
- if (searchingError) {
1908
- proceedToManualDataEntry();
1909
- }
1910
- }, [searchingError]);
1911
- const isBusinessSelection = showBusinessSelection && activeForm.formId === formWith2Views;
1912
- const hideFooter = isBusinessSelection === true && loading;
1913
- const hideNextButton = activeForm.formId === formWith2Views ? isBusinessSelection : false;
1914
- const showBackButton = !COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry) ? false : isBusinessSelection ? loading : false;
1915
- const goToForm = useCallback(
1916
- (index) => {
1917
- if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) {
1918
- return gotoFormByFormIndex(index);
1919
- }
1920
- const selectedFormId = forms[index].formId;
1921
- if (selectedFormId === formWith2Views) {
1922
- if (verifiedBusiness$1) setShowBusinessSelection(false);
1923
- if (activeForm.formId === "companyStructure" && companySearchResults?.length) {
1924
- setShowCompanyStructure(false);
1925
- }
1926
- return gotoFormByFormIndex(index);
1927
- } else {
1928
- if (verifiedBusiness$1) return gotoFormByFormIndex(index);
1929
- if (activeForm.formId !== formWith2Views) return gotoFormByFormIndex(index);
1930
- if (activeForm.formId === formWith2Views && !isBusinessSelection) {
1931
- setShowBusinessSelection(true);
1932
- }
1933
- }
1934
- },
1935
- [
1936
- currentCountry,
1937
- forms,
1938
- gotoFormByFormIndex,
1939
- verifiedBusiness$1,
1940
- activeForm.formId,
1941
- companySearchResults?.length,
1942
- isBusinessSelection
1943
- ]
1944
- );
1945
- const nextClick = useCallback(() => {
1946
- if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry) || accountHolder !== "theCompanyIWorkFor")
1947
- return handleNextClick();
1948
- if (activeForm.formId === formWith2Views && currentState.validityByForm?.basicInformation && !isBusinessSelection && !verifiedBusiness$1) {
1949
- setCompanySearchParams({
1950
- legalCompanyName: currentState?.data?.basicInformation?.legalCompanyName ?? "",
1951
- country: currentState?.data.basicInformation?.country ?? country,
1952
- stateOrProvince: currentState?.data.basicInformation?.stateOrProvince,
1953
- registrationNumber: currentState?.data.basicInformation?.registrationNumber
1954
- });
1955
- setShowBusinessSelection(true);
1956
- } else {
1957
- handleNextClick();
1958
- }
1959
- }, [
1960
- currentCountry,
1961
- isSoleProp,
1962
- handleNextClick,
1963
- activeForm.formId,
1964
- currentState.validityByForm?.basicInformation,
1965
- currentState?.data.basicInformation?.legalCompanyName,
1966
- currentState?.data.basicInformation?.country,
1967
- currentState?.data.basicInformation?.stateOrProvince,
1968
- currentState?.data.basicInformation?.registrationNumber,
1969
- isBusinessSelection,
1970
- verifiedBusiness$1,
1971
- country
1972
- ]);
1973
- const backClick = useCallback(() => {
1974
- if (!COUNTRIES_USING_COMPANY_SEARCH.includes(currentCountry)) handleBackClick?.();
1975
- else {
1976
- switch (activeForm.formId) {
1977
- case formWith2Views: {
1978
- if (showBusinessSelection) setShowBusinessSelection(false);
1979
- break;
1980
- }
1981
- case "companyStructure": {
1982
- if (searchingError) {
1983
- setShowBusinessSelection(false);
1984
- setShowCompanyStructure(false);
1985
- handleBackClick?.();
1986
- break;
1987
- }
1988
- if (!searchingCompanies && companySearchResults && !companySearchResults.length) {
1989
- setShowBusinessSelection(false);
1990
- } else if (!verifiedBusiness$1) setShowCompanyStructure(false);
1991
- handleBackClick?.();
1992
- break;
1993
- }
1994
- case "additionalInformation": {
1995
- if (verifiedBusiness$1) setShowBusinessSelection(false);
1996
- handleBackClick?.();
1997
- break;
1998
- }
1999
- default:
2000
- handleBackClick?.();
2001
- break;
2002
- }
2003
- }
2004
- }, [
2005
- currentCountry,
2006
- handleBackClick,
2007
- activeForm.formId,
2008
- showBusinessSelection,
2009
- searchingError,
2010
- searchingCompanies,
2011
- companySearchResults,
2012
- verifiedBusiness$1
2013
- ]);
2014
- const homeClick = () => {
2015
- handleHomeClick?.();
2016
- };
2017
- const handleBusinessMismatchContinue = useCallback(() => {
2018
- setShowCompanyStructure(true);
2019
- setTrustedFields([]);
2020
- setBusinessMismatchModalOpen(false);
2021
- }, [setShowCompanyStructure, setTrustedFields, setBusinessMismatchModalOpen]);
2022
- const handleBusinessMismatchCancel = useCallback(() => {
2023
- backClick?.();
2024
- setBusinessMismatchModalOpen(false);
2025
- setTinMatched(void 0);
2026
- }, [backClick, setTinMatched, setBusinessMismatchModalOpen]);
2027
- const resetBusinessData = useCallback(() => {
2028
- queryClient.resetQueries({
2029
- queryKey: [
2030
- "companySearch",
2031
- {
2032
- name: companySearchParams.legalCompanyName ?? "",
2033
- country: companySearchParams.country,
2034
- state: companySearchParams.stateOrProvince,
2035
- registrationNumber: companySearchParams.registrationNumber
2036
- }
2037
- ]
2038
- });
2039
- setVerifiedBusiness(void 0);
2040
- }, [
2041
- companySearchParams.country,
2042
- companySearchParams.legalCompanyName,
2043
- companySearchParams.registrationNumber,
2044
- companySearchParams.stateOrProvince,
2045
- queryClient
2046
- ]);
2047
- useEffect(() => {
2048
- if (verifiedBusiness$1?.name && currentState.data.basicInformation?.legalCompanyName !== verifiedBusiness$1?.name && (currentState.data.basicInformation?.legalCompanyName !== companySearchParams.legalCompanyName || currentState.data.basicInformation?.stateOrProvince !== companySearchParams.stateOrProvince)) {
2049
- setShowCompanyStructure(false);
2050
- resetBusinessData();
2051
- }
2052
- }, [
2053
- companySearchParams,
2054
- currentState.data.basicInformation,
2055
- currentState.data.basicInformation?.legalCompanyName,
2056
- resetBusinessData,
2057
- verifiedBusiness$1
2058
- ]);
2059
- const [prevCurrentCountry, setPrevCurrentCountry] = useState(currentCountry);
2060
- if (prevCurrentCountry !== currentCountry && trustedFields?.length && legalEntityResponse.organization?.registeredAddress.country !== currentCountry) {
2061
- setTrustedFields(void 0);
2062
- setPrevCurrentCountry(currentCountry);
2063
- }
2064
- return /* @__PURE__ */ jsxs(
2065
- FormWrapper,
2066
- {
2067
- taskName: taskName ?? "businessDetails",
2068
- gotoFormByFormIndex: goToForm,
2069
- hideSidebar,
2070
- hideFooter,
2071
- loadingStatus,
2072
- forms,
2073
- activeForm,
2074
- validateForm: () => setShouldValidate(true),
2075
- navigationTrackingParams: associatedLeTrackingParams,
2076
- onSubmit: submitTask,
2077
- problems: currentProblems,
2078
- canSubmit: canSubmitForm,
2079
- summary: summaryData,
2080
- handleNextClick: nextClick,
2081
- handleBackClick: backClick,
2082
- handleHomeClick: homeClick,
2083
- steps,
2084
- showBackButton,
2085
- hideNextButton,
2086
- children: [
2087
- /* @__PURE__ */ jsx(
2088
- BusinessDetails,
2089
- {
2090
- ...derivedProps,
2091
- ref: formRef,
2092
- data: initialData,
2093
- country: currentCountry,
2094
- problems: currentProblems,
2095
- activeForm,
2096
- shouldValidate,
2097
- isTopLevelEntity: taskType === TaskTypes.BUSINESS_DETAILS,
2098
- showBusinessSelection,
2099
- setShowBusinessSelection,
2100
- showCompanyStructure,
2101
- setShowCompanyStructure,
2102
- searchResults: companySearchResults,
2103
- loading,
2104
- proceedToManualDataEntry,
2105
- handleNextClick: nextClick,
2106
- taskType
2107
- }
2108
- ),
2109
- businessMismatchModalOpen && /* @__PURE__ */ jsx(
2110
- Confirm,
2111
- {
2112
- title: i18n.get("businessSelection__tinVerificationFailureModalHeader"),
2113
- description: i18n.get("businessSelection__tinVerificationFailureModalContent"),
2114
- cancelText: i18n.get("businessSelection__tinVerificationFailureModalSecondaryButton"),
2115
- confirmText: i18n.get("businessSelection__tinVerificationFailureModalPrimaryButton"),
2116
- onCancel: handleBusinessMismatchCancel,
2117
- onConfirm: handleBusinessMismatchContinue
2118
- }
2119
- )
2120
- ]
2121
- }
2122
- );
2123
- }
2124
- export {
2125
- BusinessDetailsDropin as B,
2126
- ProofOfOwnershipDocument as P,
2127
- RegistrationDocument as R,
2128
- TaxDocument as T,
2129
- ProofOfSignatoryDocument as a,
2130
- ProofOfDirectorDocument as b,
2131
- mapLegalEntityToBusinessDetailsSchema as c,
2132
- businessDetailsFieldsPerScenario as d,
2133
- formatDataForSummary as f,
2134
- mapApiDocumentToBusinessDetailsDocuments as m,
2135
- submit as s
2136
- };