@adyen/kyc-components 4.18.0 → 4.19.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 (366) hide show
  1. package/dist/{Accordion-IXKjwyLD.js → Accordion-BnhH5-eC.js} +1 -1
  2. package/dist/{AccountSetupRejected-BBkIzStE.js → AccountSetupRejected-BVzz6Scm.js} +2 -2
  3. package/dist/{AdaptiveWorkflow-BeNeSJmr.js → AdaptiveWorkflow-DsZ_wY_H.js} +31 -34
  4. package/dist/{AdaptiveWorkflowComponent-vGohaG9V.js → AdaptiveWorkflowComponent-1LmhvzA8.js} +56 -56
  5. package/dist/{Address-pRy7yAyT.js → Address-Dn9YYuVv.js} +7 -7
  6. package/dist/{AddressField-D5VvYpTn.js → AddressField-BLlc_T5f.js} +11 -14
  7. package/dist/{Avatar-CdBNstmD.js → Avatar-Y_RdG_YY.js} +1 -1
  8. package/dist/{BusinessFinancingDropin-BVJmBiV-.js → BusinessFinancingDropin-BJ7Z_6_q.js} +31 -36
  9. package/dist/{BusinessFinancingPage-D6Ltqocq.js → BusinessFinancingPage-C72fEfR8.js} +32 -32
  10. package/dist/{BusinessTypeSelectionPage-COGrE8in.js → BusinessTypeSelectionPage-CJT4_LdC.js} +14 -15
  11. package/dist/{Button-i8I2dHP8.js → Button-BuhgDsyo.js} +1 -1
  12. package/dist/Checkbox-CFN5ywvv.js +108 -0
  13. package/dist/{CompanyRegistrationNumberTypeSelector-Cse5eWmF.js → CompanyRegistrationNumberTypeSelector-Dw2BkLur.js} +8 -8
  14. package/dist/{ContactDetails-Bg6E-Qdo.js → ContactDetails-Bi_d3c4V.js} +7 -8
  15. package/dist/{ContextGuidance-OW20JTmA.js → ContextGuidance-D7YPJhH5.js} +2 -2
  16. package/dist/CountryField-CEttz1qx.js +1653 -0
  17. package/dist/{Currency-BB-aCS9R.js → Currency-D3ooH-P1.js} +8 -9
  18. package/dist/{CustomerSupport-CxLYgFMf.js → CustomerSupport-BPkPpm4S.js} +14 -15
  19. package/dist/{DataConflictsModal-Din0HvnQ.js → DataConflictsModal-CjK5meAj.js} +7 -7
  20. package/dist/{DebugModal-CCmbbYz8.js → DebugModal-BdzRooB8.js} +11 -12
  21. package/dist/{DecisionMakerDetails-CfQw5zLh.js → DecisionMakerDetails-CEvexevf.js} +16 -17
  22. package/dist/{DecisionMakerDetailsPage-DKdZRCWu.js → DecisionMakerDetailsPage-PdJIWA0L.js} +35 -35
  23. package/dist/{DecisionMakers-SZrdoYjV.js → DecisionMakers-B62TqNnC.js} +43 -43
  24. package/dist/{Dropzone-VbRNXGWC.js → Dropzone-VfjqDlA_.js} +7 -7
  25. package/dist/{EmbeddedStatus-g37gc_ic.js → EmbeddedStatus-sHJnhw3K.js} +4 -4
  26. package/dist/{EndStateLayout-CBRHUXyY.js → EndStateLayout-CddZpAGD.js} +2 -2
  27. package/dist/{EntityAssociation-zNH_hlni.js → EntityAssociation-DsQNaCo7.js} +7 -7
  28. package/dist/{ErrorPanel-BUnSs30r.js → ErrorPanel-C51kA_mU.js} +4 -4
  29. package/dist/GlobalEntryModal-rYmoNH8G.js +188 -0
  30. package/dist/GlobalEntryPage-CeBpyE1f.js +74 -0
  31. package/dist/{unincorporated-partnership-nnTW3FnG.js → Image-Dc5Xg1_Y.js} +3 -10
  32. package/dist/{Individual.rules-Caf9UMUo.js → Individual.rules-CE8liYua.js} +4 -4
  33. package/dist/{IndividualDropin-dtWJoFtm.js → IndividualDropin-BGY5Ddrh.js} +47 -54
  34. package/dist/{InputDate-CxzAaaCm.js → InputDate-Cp2ga0F5.js} +2 -2
  35. package/dist/{InputText-CQcWyZ8_.js → InputText-CRkApOKK.js} +3 -3
  36. package/dist/{Introduction-D_hA5jmK.js → Introduction-DZ-ov19S.js} +8 -8
  37. package/dist/{InvitedDecisionMakerComponent-UOdB2Gdf.js → InvitedDecisionMakerComponent-KwRWIgOY.js} +67 -67
  38. package/dist/{JpAddress-Bzh05zSM.js → JpAddress-DA4HeKHD.js} +13 -13
  39. package/dist/{JpAddress.module-Bdx0E9ys.js → JpAddress.module-h_ZcUDUu.js} +4 -4
  40. package/dist/{JpAddressFields-BcNA2qQ-.js → JpAddressFields-BG4Hvw6r.js} +10 -10
  41. package/dist/{LegalCompanyNameField-B4tZnTsz.js → LegalCompanyNameField-RnzsmUKo.js} +5 -5
  42. package/dist/{LegalRepresentativeDetailsPage-BJdt2arC.js → LegalRepresentativeDetailsPage-DVYi8ja1.js} +33 -33
  43. package/dist/{Link-JFzfaUOa.js → Link-PH3F7iTO.js} +1 -1
  44. package/dist/{ListItem-BnVTcObB.js → ListItem-B-gDVdRO.js} +2 -2
  45. package/dist/MX-CXUYOKFF.js +20 -0
  46. package/dist/{MaskedInput-fg7rPWNN.js → MaskedInput-BK38onJ9.js} +6 -6
  47. package/dist/{Modal-ByJare7m.js → Modal-BYdlsXkf.js} +1 -1
  48. package/dist/{Name-Cw7gZ538.js → Name-CnahYmZE.js} +5 -5
  49. package/dist/{NewSummary-01MQcP8O.js → NewSummary-RLsN58Mb.js} +7 -7
  50. package/dist/{PatriotActDisclosure-EIRUow5b.js → PatriotActDisclosure-CGU1K5gU.js} +14 -16
  51. package/dist/{PayoutDetailsDropin-Ba7MTkCv.js → PayoutDetailsDropin-CyF7UckP.js} +31 -40
  52. package/dist/{PayoutDetailsPage-rpkLlwhy.js → PayoutDetailsPage-D54T0cTR.js} +9 -9
  53. package/dist/{RadioGroup-Bt1Dv_S8.js → RadioGroup-lkTq-fXj.js} +4 -4
  54. package/dist/{Review-CgR-Yydj.js → Review-CQP_ivDp.js} +8 -8
  55. package/dist/RootBusinessDetailsPage-74wy-iuF.js +68 -0
  56. package/dist/{RootBusinessLinesPage-BMT3gr2J.js → RootBusinessLinesPage-DdbHs3i6.js} +30 -36
  57. package/dist/{RootIndividualDetailsPage-D3Hm7OrC.js → RootIndividualDetailsPage-CRiGz1L-.js} +33 -33
  58. package/dist/{Select-D4oEtS2n.js → Select-C2axJYZG.js} +322 -9
  59. package/dist/{SignPCIComponent-g8v3tteD.js → SignPCIComponent-2jkpTNie.js} +40 -42
  60. package/dist/{SingpassSelection-Bx4GOfIq.js → SingpassSelection-C0Nj8agM.js} +6 -6
  61. package/dist/{SoleProprietorshipPage-CG51YTEA.js → SoleProprietorshipPage-DL9KxFfM.js} +34 -34
  62. package/dist/{SourceOfFundsPage-BJKj0z9v.js → SourceOfFundsPage-CoriFRrS.js} +33 -39
  63. package/dist/{StructuredList-Ci4Ut4E5.js → StructuredList-Mj-OPN9u.js} +71 -3
  64. package/dist/{TaskListItem-D54ulnyc.js → TaskListItem-DOnEqpoq.js} +11 -11
  65. package/dist/{TaskVerificationStatus-CKHPTEpH.js → TaskVerificationStatus-ITLSeoau.js} +1 -1
  66. package/dist/{TaxReportingDropin-DgB6Uo-8.js → TaxReportingDropin-BnEktotO.js} +18 -19
  67. package/dist/{TermsOfServiceManagement-B73EAUQT.js → TermsOfServiceManagement-CY49Ivu1.js} +41 -45
  68. package/dist/{TextArea-BUx3yuMJ.js → TextArea-BzCbFjRp.js} +4 -4
  69. package/dist/{TrustDetailsPage-DbRZo3eo.js → TrustDetailsPage-BOt9PbYw.js} +33 -38
  70. package/dist/{TrustMemberCompanyPage-fjaHnVnu.js → TrustMemberCompanyPage-D36IOylX.js} +35 -35
  71. package/dist/{TrustMemberIndividualPage-ChdfyypX.js → TrustMemberIndividualPage-aAZXiZKb.js} +33 -33
  72. package/dist/{TrustMemberRoleAndTypePage-4FiocM2Q.js → TrustMemberRoleAndTypePage-C9zB9BEk.js} +17 -22
  73. package/dist/{TrustMembersOverview-BfW7xcig.js → TrustMembersOverview-DxAuj55H.js} +13 -13
  74. package/dist/{UnincorporatedPartnershipIndividualPage-CoxFU8hC.js → UnincorporatedPartnershipIndividualPage-C4jwWyYn.js} +33 -33
  75. package/dist/{UnincorporatedPartnershipMemberCompanyPage-qtLLtEBZ.js → UnincorporatedPartnershipMemberCompanyPage-0JVxcpB4.js} +35 -35
  76. package/dist/{UnincorporatedPartnershipMemberRoleAndTypePage-CcrbCZHP.js → UnincorporatedPartnershipMemberRoleAndTypePage-DfxG-RyJ.js} +12 -12
  77. package/dist/{UnincorporatedPartnershipMembersOverview-BcIX_dew.js → UnincorporatedPartnershipMembersOverview-DecZD9DL.js} +9 -9
  78. package/dist/{VerificationErrorAlert-CBkiCj7f.js → VerificationErrorAlert-kLh424Dx.js} +5 -5
  79. package/dist/{accountHolderUtils-BRcGuXPg.js → accountHolderUtils-DqrHbaM7.js} +1 -1
  80. package/dist/adyen-business-financing.js +33 -33
  81. package/dist/adyen-individual-configuration.js +59 -59
  82. package/dist/adyen-individual-status.js +33 -33
  83. package/dist/adyen-invited-decision-maker.js +3 -3
  84. package/dist/adyen-onboarding.js +83 -82
  85. package/dist/adyen-terms-of-service-management.js +3 -3
  86. package/dist/adyen-terms-of-service-status.js +6 -6
  87. package/dist/adyen-transfer-instrument-configuration.js +32 -32
  88. package/dist/adyen-transfer-instrument-management.js +39 -40
  89. package/dist/adyen-verification-status.js +6 -6
  90. package/dist/{TileGroup-PzJay6GP.js → bafinUtils-BnTI4Ice.js} +111 -5
  91. package/dist/{bg-BG-kWtPqE0Y.js → bg-BG-BXAB4Qsj.js} +2 -2
  92. package/dist/bg-BG-BkIvSbsH.js +7 -0
  93. package/dist/{bg-BG-DcW6QkFZ.js → bg-BG-DTGU1aVs.js} +6 -2
  94. package/dist/bg-BG-DbS559bK.js +7 -0
  95. package/dist/bg-BG-Smu9r9Kp.js +13 -0
  96. package/dist/{constants-4O_2-mb6.js → constants-f8C0SAkf.js} +5 -6
  97. package/dist/cs-CZ-4yvBEVL0.js +7 -0
  98. package/dist/{cs-CZ-BbNA0Bfn.js → cs-CZ-9tDZSfxe.js} +6 -2
  99. package/dist/cs-CZ-BQ5B0-Kt.js +13 -0
  100. package/dist/cs-CZ-CPvgcrDs.js +7 -0
  101. package/dist/{cs-CZ-C4gChMCC.js → cs-CZ-DG5rPvy2.js} +2 -2
  102. package/dist/{da-DK-CI1yBdPD.js → da-DK-B04gegkM.js} +6 -2
  103. package/dist/{da-DK-Bfi-eUhB.js → da-DK-BnW-O75l.js} +2 -2
  104. package/dist/da-DK-CXAIXO3c.js +13 -0
  105. package/dist/da-DK-D3mbpcHG.js +7 -0
  106. package/dist/da-DK-D5969QKP.js +7 -0
  107. package/dist/{de-DE-BuV4qgKM.js → de-DE-BvxSDtLA.js} +6 -2
  108. package/dist/de-DE-D6R-XC2F.js +7 -0
  109. package/dist/de-DE-DFQGGPCj.js +13 -0
  110. package/dist/{de-DE-DKSWXTNm.js → de-DE-DUiPzmSc.js} +2 -2
  111. package/dist/de-DE-uDUBu-3n.js +7 -0
  112. package/dist/{types-Cwq1JAWT.js → debugStore-DpSgCNGn.js} +11 -2
  113. package/dist/{el-GR-C4waexVM.js → el-GR-1n3FJpd3.js} +2 -2
  114. package/dist/el-GR-CedmhUFh.js +7 -0
  115. package/dist/{el-GR-tnyJOS2Y.js → el-GR-DEBCgQrC.js} +6 -2
  116. package/dist/el-GR-DEBvBgI-.js +13 -0
  117. package/dist/el-GR-DWh7gn7M.js +7 -0
  118. package/dist/en-US-BV2Gye3t.js +7 -0
  119. package/dist/en-US-CqjOvqxV.js +7 -0
  120. package/dist/{es-ES-CCk0CPW1.js → es-ES-2b5zl9Dh.js} +6 -2
  121. package/dist/es-ES-C7XCTACS.js +7 -0
  122. package/dist/{es-ES-BNOsR44t.js → es-ES-Cp45mlyV.js} +2 -2
  123. package/dist/es-ES-DTUHhE47.js +7 -0
  124. package/dist/es-ES-_qbfha1o.js +13 -0
  125. package/dist/{es-LA-svZ9JWfs.js → es-LA-CE8hE_Qb.js} +6 -2
  126. package/dist/es-LA-Cyf48j4P.js +7 -0
  127. package/dist/es-LA-DF0v3VMe.js +13 -0
  128. package/dist/{es-LA-BQoC1xVD.js → es-LA-De_gTMKb.js} +2 -2
  129. package/dist/es-LA-DlL8vCjJ.js +7 -0
  130. package/dist/{et-EE-nB00sVxj.js → et-EE-B4czzgF8.js} +2 -2
  131. package/dist/et-EE-DqhEsLik.js +7 -0
  132. package/dist/{et-EE-4OTBQhPM.js → et-EE-OAYKzRjG.js} +2 -2
  133. package/dist/et-EE-evCiUrFW.js +13 -0
  134. package/dist/{et-EE-Ykuzi3IN.js → et-EE-yEWgHoyl.js} +6 -2
  135. package/dist/{fi-FI-BfcDfpuq.js → fi-FI-BRaWGHEa.js} +6 -2
  136. package/dist/fi-FI-BTG87BwH.js +13 -0
  137. package/dist/fi-FI-Cdof5NRG.js +7 -0
  138. package/dist/{fi-FI-11WMt6xZ.js → fi-FI-D08MUkuM.js} +2 -2
  139. package/dist/fi-FI-RfGqWbnB.js +7 -0
  140. package/dist/{process-field-configurations-DBtjrbif.js → form-rules-wh_oE1AN.js} +86 -6
  141. package/dist/{fr-FR-DZ3x24wa.js → fr-FR-B1fQcJnJ.js} +6 -2
  142. package/dist/{fr-FR-CTX8eIfK.js → fr-FR-BxDpVfWO.js} +2 -2
  143. package/dist/fr-FR-DIiBHkhs.js +13 -0
  144. package/dist/fr-FR-NOULV1vy.js +7 -0
  145. package/dist/fr-FR-zDxTr2D3.js +7 -0
  146. package/dist/{getProblemsForEntity-ubvE1Px7.js → getProblemsForEntity-set4Krmx.js} +2 -2
  147. package/dist/hr-HR-2h3d5-q3.js +7 -0
  148. package/dist/{hr-HR-crREB4Gm.js → hr-HR-CiE3y0Ub.js} +6 -2
  149. package/dist/{hr-HR-q4LEknkW.js → hr-HR-DGQMquDg.js} +2 -2
  150. package/dist/hr-HR-DPjuJ54x.js +7 -0
  151. package/dist/hr-HR-DofgeWWO.js +13 -0
  152. package/dist/{http-8qgzqVqk.js → http-CFac2y4i.js} +1 -1
  153. package/dist/{hu-HU-D6LVf95k.js → hu-HU-Eofp7khl.js} +2 -2
  154. package/dist/hu-HU-FdLZGnBz.js +13 -0
  155. package/dist/{hu-HU-DsUOhM2K.js → hu-HU-VLUIAFMp.js} +2 -2
  156. package/dist/{hu-HU-CwugDrK-.js → hu-HU-bRcefVUd.js} +6 -2
  157. package/dist/hu-HU-hB61p4H9.js +7 -0
  158. package/dist/{it-IT-DmJ2fsTy.js → it-IT-B-nXU1YK.js} +6 -2
  159. package/dist/it-IT-BMXQzE0P.js +7 -0
  160. package/dist/{it-IT-COvAChQK.js → it-IT-CD7NJtJa.js} +2 -2
  161. package/dist/it-IT-CWIAGNlE.js +7 -0
  162. package/dist/it-IT-CXgZZgyU.js +13 -0
  163. package/dist/ja-JP-BuFZko8b.js +7 -0
  164. package/dist/ja-JP-C1c2UPpy.js +7 -0
  165. package/dist/{ja-JP-Ct_9QX6z.js → ja-JP-DX2RsV88.js} +6 -2
  166. package/dist/ja-JP-Yi2wExJE.js +13 -0
  167. package/dist/{ja-JP-qNISvG1u.js → ja-JP-YvXztswF.js} +2 -2
  168. package/dist/{localizeDateString-Bmx3yBcR.js → localizeDateString-BRB4gPDZ.js} +1 -1
  169. package/dist/lt-LT-BZ6seLuB.js +13 -0
  170. package/dist/{lt-LT-DkHCYjtT.js → lt-LT-Bzv_v-Qg.js} +6 -2
  171. package/dist/lt-LT-C62dFtWW.js +7 -0
  172. package/dist/{lt-LT-BZAM9Txq.js → lt-LT-Cjx4H-0R.js} +2 -2
  173. package/dist/lt-LT-D4raqCUa.js +7 -0
  174. package/dist/lv-LV-CMYrAWqu.js +13 -0
  175. package/dist/{lv-LV-CrmNCJJK.js → lv-LV-Ckf37gXo.js} +2 -2
  176. package/dist/lv-LV-DBms129k.js +7 -0
  177. package/dist/{lv-LV-D7eJdsac.js → lv-LV-DVv2mhEv.js} +6 -2
  178. package/dist/lv-LV-W0I-UUyj.js +7 -0
  179. package/dist/{mapExistingFile-BvFf01k6.js → mapExistingFile-BOXehUNN.js} +3 -3
  180. package/dist/{mapJpAddressSchemaToAddressLocalizations-DHL5chu8.js → mapJpAddressSchemaToAddressLocalizations-ClMxibP5.js} +2 -2
  181. package/dist/{mapLegalEntityToIndividualSchema-BeR7ESyx.js → mapLegalEntityToIndividualSchema-CI0cH-k5.js} +8 -8
  182. package/dist/{mapTransferInstrumentToPayoutAccount-2iWuaqS_.js → mapTransferInstrumentToPayoutAccount-DAXQcZKf.js} +3 -3
  183. package/dist/nl-NL-C9HoBicG.js +7 -0
  184. package/dist/nl-NL-CiH1raQa.js +13 -0
  185. package/dist/{nl-NL-D-rQ6aIY.js → nl-NL-DFHAkUK3.js} +2 -2
  186. package/dist/{nl-NL-BVbkn6Cc.js → nl-NL-DwrCD0Bp.js} +6 -2
  187. package/dist/nl-NL-UhYf45fo.js +7 -0
  188. package/dist/{no-NO-m32g5fSG.js → no-NO-B6frLiko.js} +2 -2
  189. package/dist/no-NO-Bo9rlROU.js +7 -0
  190. package/dist/no-NO-Ce2vzrp7.js +13 -0
  191. package/dist/{no-NO-DKa4b11A.js → no-NO-ClSO9-BH.js} +6 -2
  192. package/dist/no-NO-DN7Ovyir.js +7 -0
  193. package/dist/{omitObscuredFieldsIfUnchanged-B8KqUjNk.js → omitObscuredFieldsIfUnchanged-P2CVFokX.js} +2 -2
  194. package/dist/{patternValidators-DxkAZhsA.js → patternValidators-BXreB-rx.js} +1 -1
  195. package/dist/pl-PL-BmiDQi18.js +7 -0
  196. package/dist/{pl-PL-a3bZNR8A.js → pl-PL-DWH2wPZx.js} +6 -2
  197. package/dist/{pl-PL-CPw2fm9P.js → pl-PL-DnYkTdjO.js} +2 -2
  198. package/dist/pl-PL-STp7eeFE.js +7 -0
  199. package/dist/pl-PL-aErZF5Xz.js +13 -0
  200. package/dist/{processCapabilities-C2kMryYn.js → processCapabilities-zti_0yUx.js} +3 -1
  201. package/dist/{processValidationErrors-D9l2eO9k.js → processValidationErrors-Bm_TOvWG.js} +3 -3
  202. package/dist/{pt-BR-D1_qNWjQ.js → pt-BR-65dQv8uO.js} +2 -2
  203. package/dist/pt-BR-CFGpH3BW.js +7 -0
  204. package/dist/pt-BR-DXGEP6IP.js +7 -0
  205. package/dist/pt-BR-hRRebYjo.js +13 -0
  206. package/dist/{pt-BR-iKANHYsk.js → pt-BR-iYXbhMqT.js} +6 -2
  207. package/dist/pt-PT-BHR4CEnv.js +7 -0
  208. package/dist/pt-PT-BXIKj_3F.js +7 -0
  209. package/dist/{pt-PT-DN5Kzv0P.js → pt-PT-CNqZ8c_1.js} +6 -2
  210. package/dist/{pt-PT-DsN17CwV.js → pt-PT-D0fXeW1f.js} +2 -2
  211. package/dist/pt-PT-UAIvemf-.js +13 -0
  212. package/dist/{resolveEnvironment-DoST1OsT.js → resolveEnvironment-DEX5KqEv.js} +43 -38
  213. package/dist/ro-RO-BJeKitCz.js +13 -0
  214. package/dist/{ro-RO-BRa0uLv-.js → ro-RO-CNj95qQn.js} +2 -2
  215. package/dist/ro-RO-D4TQUwVB.js +7 -0
  216. package/dist/{ro-RO-HROrtm3u.js → ro-RO-DcHQ--3j.js} +6 -2
  217. package/dist/ro-RO-ni-ZNqXU.js +7 -0
  218. package/dist/{sk-SK-BdncFi12.js → sk-SK-C0x9Vs2X.js} +2 -2
  219. package/dist/sk-SK-CszMszV5.js +7 -0
  220. package/dist/{sk-SK-BHvTY7sQ.js → sk-SK-D8_n1xzc.js} +6 -2
  221. package/dist/sk-SK-DQAGAOJW.js +7 -0
  222. package/dist/sk-SK-ztSYyXUE.js +13 -0
  223. package/dist/sl-SI-B-MLX0nT.js +7 -0
  224. package/dist/sl-SI-BY4TzP-F.js +13 -0
  225. package/dist/{sl-SI-Drd_ptUm.js → sl-SI-BikBCOJK.js} +2 -2
  226. package/dist/{sl-SI-DgVD1kZK.js → sl-SI-BlhEijpT.js} +6 -2
  227. package/dist/sl-SI-DOAJBgQV.js +7 -0
  228. package/dist/style.css +345 -317
  229. package/dist/styles-DYaAeu4q.js +345 -317
  230. package/dist/sv-SE--LlaHl85.js +7 -0
  231. package/dist/{sv-SE-oLc1R4YI.js → sv-SE-BGP9Lmku.js} +2 -2
  232. package/dist/sv-SE-CNQCI2nX.js +7 -0
  233. package/dist/sv-SE-CrUbxniG.js +13 -0
  234. package/dist/{sv-SE-Dn9j5Ykd.js → sv-SE-DWQAUW9A.js} +6 -2
  235. package/dist/{translation-BYvhW5zA.js → translation-CcKrUksA.js} +10 -4
  236. package/dist/types/api/companyDataSet/companyDataset.types.d.ts +1 -3
  237. package/dist/types/components/Business/forms/AdditionalInformation/types.d.ts +1 -0
  238. package/dist/types/components/Business/forms/rules.d.ts +4 -2
  239. package/dist/types/components/EFP/mapping/businessFinancingKeyMappings.d.ts +12 -0
  240. package/dist/types/components/GlobalEntry/constants.d.ts +14 -0
  241. package/dist/types/components/GlobalEntry/fields/EntitySetupField/EntitySetupField.d.ts +2 -0
  242. package/dist/types/components/GlobalEntry/fields/EntitySetupField/types.d.ts +5 -0
  243. package/dist/types/components/GlobalEntry/forms/EntityInformation/EntityInformation.d.ts +7 -0
  244. package/dist/types/components/GlobalEntry/forms/EntityInformation/types.d.ts +3 -0
  245. package/dist/types/components/GlobalEntry/tasks/GlobalEntry.d.ts +6 -0
  246. package/dist/types/components/GlobalEntry/tasks/GlobalEntryModal.d.ts +4 -0
  247. package/dist/types/components/GlobalEntry/tasks/types.d.ts +4 -0
  248. package/dist/types/components/GlobalEntry/utils.d.ts +3 -0
  249. package/dist/types/components/Shared/forms/Address/utils.d.ts +1 -1
  250. package/dist/types/components/ui/atoms/Checkbox/Checkbox.d.ts +1 -2
  251. package/dist/types/context/SettingsContext/types.d.ts +1 -1
  252. package/dist/types/context/StateContext/types.d.ts +2 -1
  253. package/dist/types/context/ToggleContext/types.d.ts +5 -0
  254. package/dist/types/core/models/api/legal-arrangement.d.ts +1 -0
  255. package/dist/types/core/models/api/organization.d.ts +2 -1
  256. package/dist/types/types/form-rules.d.ts +2 -1
  257. package/dist/types/utils/entityStatusUtil.d.ts +1 -1
  258. package/dist/{types-KjTYEnAG.js → types-lzI_sUwT.js} +1 -1
  259. package/dist/unincorporated-partnership-DNTK5Y_5.js +11 -0
  260. package/dist/{useAssociatedLegalEntity-CkuvFV-D.js → useAssociatedLegalEntity-DB8HCSwp.js} +2 -2
  261. package/dist/{useBusinessDetailsData-ZmBKQqoD.js → useBusinessDetailsData-DJxoXaI7.js} +123 -118
  262. package/dist/{useBusinessLines-BFsRoAAj.js → useBusinessLines-CfQYLNkw.js} +1 -1
  263. package/dist/{useCanSeeIntroduction-BV78oSLN.js → useCanSeeIntroduction-CMh-srNo.js} +3 -3
  264. package/dist/{useCreateLegalEntity-CoBr-K0N.js → useCreateLegalEntity-CVBjJUw_.js} +1 -1
  265. package/dist/{useDataMissingRemediations-BzbA8Mu4.js → useDataMissingRemediations-BEdoAjt3.js} +2 -2
  266. package/dist/{useForm-CV0UezXM.js → useForm-BV6TtEpQ.js} +4 -4
  267. package/dist/{invalidateRootLegalEntity-CNKlzaEg.js → useId-BiYSHcau.js} +28 -6
  268. package/dist/{useLegalEntity-CtlUQv_J.js → useLegalEntity-BqO7Fmt0.js} +1 -1
  269. package/dist/{useNavigate-C32tng3x.js → useNavigate-BbaMx4B6.js} +33 -33
  270. package/dist/{useOnboardingStatus-BlXlrSAS.js → useOnboardingStatus-Bg1z2ftv.js} +1 -1
  271. package/dist/{usePciQuestionnaireList-CbkNC_Ye.js → usePciQuestionnaireList-Dq1w684P.js} +1 -1
  272. package/dist/{useSalesChannels-CQjvFAb2.js → useSalesChannels-D66W1KV8.js} +4 -4
  273. package/dist/{useScenarios-DeLWDtIg.js → useScenarios-BunWDxgO.js} +1 -1
  274. package/dist/{useTaskLandedEvent-BiIxm8IU.js → useTaskLandedEvent-BTVaABDA.js} +1 -1
  275. package/dist/{useTaskStatus-wrAxqtIR.js → useTaskStatus-B_-IRF4H.js} +1 -1
  276. package/dist/{useTermsOfServiceStatus-D1_ECrkO.js → useTermsOfServiceStatus-CGIpBA0U.js} +1 -1
  277. package/dist/{useTrustMembers-DsHD7BN-.js → useTrustMembers-DExoLajS.js} +4 -4
  278. package/dist/{useUnincorporatedPartnershipMembers-B5WCX6yK.js → useUnincorporatedPartnershipMembers-DgD91qBf.js} +4 -4
  279. package/dist/{useUpdateBusinessLines-Cncate8L.js → useUpdateBusinessLines-C2xW-32U.js} +1 -1
  280. package/dist/{useUpdateLegalEntity-Bk3h9Ga3.js → useUpdateLegalEntity-CavZl01k.js} +3 -3
  281. package/dist/{utils-UMZuwGLj.js → utils-BZ6sjmH0.js} +5 -5
  282. package/dist/{utils-C_W1-emm.js → utils-Bu9Q872y.js} +7 -7
  283. package/dist/{utils-BIsRIG8_.js → utils-CxPOLLKk.js} +2 -2
  284. package/dist/{utils-Cjauzs_k.js → utils-wOuhjMhJ.js} +13 -14
  285. package/dist/{validate-CMxq61UU.js → validate-K01plHbc.js} +5 -5
  286. package/dist/{validate-DZs3J_LS.js → validate-XXwQLqzu.js} +1 -1
  287. package/dist/{validateExtractionResult-BkzUg6_Q.js → validateExtractionResult-BkuHB6PK.js} +10 -11
  288. package/dist/{validationError-B33RQfsy.js → validationError-DZqoMG3g.js} +2 -2
  289. package/package.json +1 -1
  290. package/dist/Checkbox-DdEBnXOB.js +0 -55
  291. package/dist/Confirm-DcqMV7rd.js +0 -75
  292. package/dist/CountryField-B4jNKNdQ.js +0 -37
  293. package/dist/Field-Dg-2A6bG.js +0 -155
  294. package/dist/GlobalEntryModal-CjuK78f0.js +0 -34
  295. package/dist/GlobalEntryPage-DRvb0gLz.js +0 -44
  296. package/dist/LandingLayout-iZpW1Vsx.js +0 -81
  297. package/dist/MaybeModal-evIPP9Uh.js +0 -24
  298. package/dist/ProgressBar-DWFxLMUA.js +0 -38
  299. package/dist/RootBusinessDetailsPage-D-aCSPPF.js +0 -68
  300. package/dist/Summary-DPMBCqZT.js +0 -234
  301. package/dist/bafinUtils-CbfyDBkh.js +0 -112
  302. package/dist/bg-BG-DWtVZckB.js +0 -7
  303. package/dist/bg-BG-VIyyeYUh.js +0 -7
  304. package/dist/cs-CZ-D8nnXFEh.js +0 -7
  305. package/dist/cs-CZ-DeM0O93X.js +0 -7
  306. package/dist/da-DK-Cq-1LB6T.js +0 -7
  307. package/dist/da-DK-DrYRErQi.js +0 -7
  308. package/dist/de-DE-Bc55gBv4.js +0 -7
  309. package/dist/de-DE-CNHKj2ar.js +0 -7
  310. package/dist/debouncedInputEvent-Fwwp_K_-.js +0 -54
  311. package/dist/debugStore-Dwn1FXrh.js +0 -9
  312. package/dist/el-GR-Cr-3NgPk.js +0 -7
  313. package/dist/el-GR-DC8wWZlc.js +0 -7
  314. package/dist/en-US-BNfqvbyW.js +0 -7
  315. package/dist/en-US-DXMKV9NN.js +0 -7
  316. package/dist/es-ES-L_7CovzS.js +0 -7
  317. package/dist/es-ES-uVSZu-EQ.js +0 -7
  318. package/dist/es-LA-BU5Op1kh.js +0 -7
  319. package/dist/es-LA-DPvp-UlN.js +0 -7
  320. package/dist/et-EE-BFb0MPqf.js +0 -7
  321. package/dist/fi-FI-6yq1jSRa.js +0 -7
  322. package/dist/fi-FI-BI9sCCEP.js +0 -7
  323. package/dist/form-rules-CUUQGacJ.js +0 -7
  324. package/dist/formUtils-BrLGUOLK.js +0 -78
  325. package/dist/fr-FR-DBM2tUge.js +0 -7
  326. package/dist/fr-FR-_TkFnevF.js +0 -7
  327. package/dist/hr-HR-DubR_a2h.js +0 -7
  328. package/dist/hr-HR-Vx0hO2h4.js +0 -7
  329. package/dist/hu-HU-CK6lbZ-D.js +0 -7
  330. package/dist/it-IT-CL_4Y1hK.js +0 -7
  331. package/dist/it-IT-CVVOlFfY.js +0 -7
  332. package/dist/ja-JP-B8sNFjt_.js +0 -7
  333. package/dist/ja-JP-CNBPrNgM.js +0 -7
  334. package/dist/lt-LT-C9lXLzZA.js +0 -7
  335. package/dist/lt-LT-CPBTVJeD.js +0 -7
  336. package/dist/lv-LV-2Q8G1u4p.js +0 -7
  337. package/dist/lv-LV-CBsGjmsA.js +0 -7
  338. package/dist/nl-NL-C5MHFAIE.js +0 -7
  339. package/dist/nl-NL-DMdoFepr.js +0 -7
  340. package/dist/no-NO-Bna_-q84.js +0 -7
  341. package/dist/no-NO-CwgewQst.js +0 -7
  342. package/dist/pl-PL-D-TVYshE.js +0 -7
  343. package/dist/pl-PL-Ddtqvtag.js +0 -7
  344. package/dist/pt-BR-D3oWr3QJ.js +0 -7
  345. package/dist/pt-BR-DwHag_mp.js +0 -7
  346. package/dist/pt-PT-BVcFY8gr.js +0 -7
  347. package/dist/pt-PT-DpYwMinP.js +0 -7
  348. package/dist/ro-RO-CZpwJ4Sy.js +0 -7
  349. package/dist/ro-RO-D3Yk1KoW.js +0 -7
  350. package/dist/roleMetadata-a4sEtgHv.js +0 -56
  351. package/dist/sk-SK-D3UYKttr.js +0 -7
  352. package/dist/sk-SK-DyKdrRnN.js +0 -7
  353. package/dist/sl-SI-BkcElOhl.js +0 -7
  354. package/dist/sl-SI-nHUFaEcp.js +0 -7
  355. package/dist/summaryItem-uDWmtYtt.js +0 -16
  356. package/dist/sv-SE-DkZ2LyW5.js +0 -7
  357. package/dist/sv-SE-DxMX8Ox_.js +0 -7
  358. package/dist/types/components/Business/mapping/businessDetails/mapOrganizationTypeToCompanyType.d.ts +0 -9
  359. package/dist/types/components/GlobalEntry/forms/GlobalEntryModal/GlobalEntryModal.d.ts +0 -1
  360. package/dist/types/core/models/api/organization-type.d.ts +0 -5
  361. package/dist/useFormContext-BWw5svgR.js +0 -503
  362. package/dist/useId-BkDhUta2.js +0 -28
  363. package/dist/useMultiForm-DysFfqIA.js +0 -783
  364. package/dist/utils-C1buyvRw.js +0 -61
  365. package/dist/validationResult-Dzvfkukj.js +0 -77
  366. /package/dist/types/components/GlobalEntry/{forms/GlobalEntryModal/isGlobalEntryModalOpen.d.ts → globalEntryStore.d.ts} +0 -0
@@ -1,783 +0,0 @@
1
- try {
2
- let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
3
- n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "11d9c062-fe38-4ed8-b4ea-7f59b42fa498", e._sentryDebugIdIdentifier = "sentry-dbid-11d9c062-fe38-4ed8-b4ea-7f59b42fa498");
4
- } catch (e) {}
5
- import { o as createLogger } from "./translation-BYvhW5zA.js";
6
- import { nt as isEmpty } from "./resolveEnvironment-DoST1OsT.js";
7
- import { o as objectsDeepEqual } from "./AnalyticsContext-BnRQ9H1u.js";
8
- import { i as omitKeys, n as addKeys, t as ValidationResult } from "./validationResult-Dzvfkukj.js";
9
- import { useCallback, useEffect, useMemo, useReducer } from "preact/hooks";
10
- //#region src/hooks/useMultiForm/reducer.ts
11
- var hasValueChanged = (newData, prevData) => {
12
- if (typeof newData === "object") return !objectsDeepEqual(newData, prevData);
13
- return newData !== prevData;
14
- };
15
- /** Formats and validates a field */
16
- var processField = ({ key, value, formName, mode, defaultData, data, fieldContext, formatters, staticValidate }) => {
17
- const formatterFn = formatters?.[key]?.formatter ? formatters[key]?.formatter : formatters?.[key];
18
- const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
19
- const fieldHasDefaultValue = key in (defaultData ?? {});
20
- const fieldHasChanged = defaultData?.[key] !== value;
21
- const validationResult = (fieldContext.state.obscuredFields?.includes(key) ? fieldHasChanged : fieldHasChanged || fieldHasDefaultValue) ? staticValidate({
22
- key,
23
- value: formattedValue,
24
- mode,
25
- formName
26
- }, data, fieldContext) : new ValidationResult([{
27
- isValid: true,
28
- hasError: false
29
- }]);
30
- const asyncValidationResult = fieldContext.state?.asyncErrors?.[key];
31
- /** Add any existing async validation result to validation result */
32
- if (asyncValidationResult) validationResult.addError(asyncValidationResult);
33
- return [formattedValue, validationResult];
34
- };
35
- /**
36
- * The function takes in the below params and spits out an initial state, by running the validations
37
- * across all forms and fields. It makes sure all validations are done and only sets the validity
38
- * instead of the errors, this is to avoid users seeing error immaturely on initial load.
39
- *
40
- * @param requiredFields
41
- * @param staticValidate
42
- * @param asyncValidate
43
- * @param defaultData
44
- * @param obscuredFields
45
- * @param optionalFields
46
- * @param trustedFields
47
- * @param fieldProblems
48
- * @param formatters
49
- * @param data
50
- */
51
- function init({ requiredFields, staticValidate, defaultData, obscuredFields, optionalFields, trustedFields, fieldProblems, formatters, data, asyncErrors }) {
52
- /**
53
- * Fetches the validation result of a field in a form
54
- * @param fieldKey
55
- * @param formName
56
- */
57
- const getProcessedState = (fieldKey, formName) => {
58
- const [formattedValue, validationResult] = processField({
59
- key: fieldKey,
60
- value: data?.[formName]?.[fieldKey] ?? defaultData?.[formName]?.[fieldKey] ?? null,
61
- mode: "blur",
62
- formName,
63
- formatters: formatters?.[formName],
64
- defaultData: defaultData?.[formName],
65
- data,
66
- fieldContext: { state: {
67
- data: data?.[formName],
68
- obscuredFields: obscuredFields?.[formName],
69
- optionalFields: optionalFields?.[formName],
70
- trustedFields: trustedFields?.[formName],
71
- requiredFields: requiredFields?.[formName],
72
- asyncErrors: asyncErrors?.[formName]
73
- } },
74
- staticValidate
75
- });
76
- return {
77
- valid: validationResult.isValid && !fieldProblems?.[formName]?.[fieldKey] || false,
78
- errors: null,
79
- data: formattedValue,
80
- fieldProblems: fieldProblems?.[formName]?.[fieldKey]
81
- };
82
- };
83
- /**
84
- * requiredFields can be undefined if the configuration api call is not yet completed
85
- * returned default state in this case
86
- */
87
- if (!requiredFields) return {
88
- data: defaultData,
89
- errors: {},
90
- fieldProblems: {},
91
- valid: {},
92
- requiredFields: {},
93
- asyncErrors: {},
94
- defaultData
95
- };
96
- /**
97
- * Make sure forms containing only optional fields are also taken into account
98
- */
99
- const formsForOptionalFields = Object.keys(optionalFields ?? {});
100
- const formsForRequiredFields = Object.keys(requiredFields);
101
- /**
102
- * Visits every field and builds a state with the validity
103
- */
104
- return Array.from(new Set([...formsForOptionalFields, ...formsForRequiredFields])).reduce((acc, formName) => {
105
- const form = formName;
106
- const optionalsFormFields = optionalFields?.[form] ?? [];
107
- const requiredFormFields = requiredFields?.[form] ?? [];
108
- const formState = [...optionalsFormFields, ...requiredFormFields].reduce((acc, field) => {
109
- const { valid, errors, data, fieldProblems: processedFieldProblems } = getProcessedState(field, form);
110
- return {
111
- ...acc,
112
- data: {
113
- ...acc.data,
114
- [field]: data
115
- },
116
- valid: {
117
- ...acc.valid,
118
- [field]: valid
119
- },
120
- errors: {
121
- ...acc.errors,
122
- [field]: errors
123
- },
124
- fieldProblems: {
125
- ...acc.fieldProblems,
126
- ...processedFieldProblems ? { [field]: processedFieldProblems } : {}
127
- }
128
- };
129
- }, {});
130
- return {
131
- requiredFields,
132
- data: {
133
- ...acc.data,
134
- [formName]: formState.data
135
- },
136
- valid: {
137
- ...acc.valid,
138
- [formName]: formState.valid
139
- },
140
- errors: {
141
- ...acc.errors,
142
- [formName]: formState.errors
143
- },
144
- fieldProblems: {
145
- ...acc.fieldProblems,
146
- [formName]: formState.fieldProblems
147
- },
148
- asyncErrors: { ...acc.asyncErrors },
149
- obscuredFields,
150
- optionalFields,
151
- trustedFields,
152
- defaultData
153
- };
154
- }, {
155
- requiredFields,
156
- data: {},
157
- valid: {},
158
- errors: {},
159
- fieldProblems: {},
160
- obscuredFields,
161
- optionalFields,
162
- trustedFields,
163
- asyncErrors: {}
164
- });
165
- }
166
- function reducer({ staticValidate, obscuredFields, optionalFields, trustedFields, formatters, defaultData }) {
167
- return (state, { type, key, mode, value, formData, formName, selectedSchema, innerFormFields, requiredFields, optionalFields: newOptionalFields, asyncValidationResults }) => {
168
- const clonedState = structuredClone(state);
169
- switch (type) {
170
- case "setData":
171
- if (!key || !formName) return state;
172
- clonedState.data[formName] ??= {};
173
- clonedState.data[formName][key] = value;
174
- return clonedState;
175
- case "setFormData": {
176
- if (!formName || !formData) return state;
177
- const formRequiredFields = clonedState.requiredFields?.[formName] ?? [];
178
- const formOptionalFields = clonedState.optionalFields?.[formName] ?? [];
179
- const allowedFields = [...formRequiredFields, ...formOptionalFields];
180
- const filteredUpdates = {};
181
- for (const formDataKey in formData) if (allowedFields.includes(formDataKey)) filteredUpdates[formDataKey] = formData[formDataKey];
182
- clonedState.data[formName] = filteredUpdates;
183
- const formValidity = allowedFields.reduce((acc, field) => {
184
- const [, validation] = processField({
185
- key: field,
186
- value: filteredUpdates[field],
187
- mode: "blur",
188
- formName,
189
- defaultData: defaultData?.[formName],
190
- data: clonedState.data,
191
- formatters: formatters?.[formName],
192
- fieldContext: { state: {
193
- data: clonedState?.data?.[formName],
194
- obscuredFields: obscuredFields?.[formName],
195
- optionalFields: optionalFields?.[formName],
196
- trustedFields: trustedFields?.[formName],
197
- errors: clonedState.errors?.[formName],
198
- valid: clonedState.valid?.[formName],
199
- fieldProblems: clonedState.fieldProblems?.[formName],
200
- asyncErrors: clonedState.asyncErrors?.[formName]
201
- } },
202
- staticValidate
203
- });
204
- return {
205
- ...acc,
206
- [field]: validation.isValid
207
- };
208
- }, {});
209
- clonedState.data[formName] = filteredUpdates;
210
- clonedState.valid[formName] = formValidity;
211
- return clonedState;
212
- }
213
- case "setValid":
214
- if (!key || !formName || clonedState.valid[formName]?.[key] === value) return state;
215
- clonedState.valid[formName] ??= {};
216
- clonedState.valid[formName][key] = !!value;
217
- return clonedState;
218
- case "setErrors":
219
- if (!key || !formName) return state;
220
- clonedState.errors[formName] ??= {};
221
- clonedState.errors[formName][key] = value;
222
- return clonedState;
223
- case "setRequiredFields": {
224
- /**
225
- * If defaultData changes reset the data in the form to new defaultData
226
- * Fetching documents are bit delayed, this accomodates that delay
227
- */
228
- const hasDefaultDataChanged = !objectsDeepEqual(defaultData, state.defaultData);
229
- if (objectsDeepEqual(requiredFields, clonedState.requiredFields) && objectsDeepEqual(newOptionalFields, clonedState.optionalFields) && !hasDefaultDataChanged) return state;
230
- const updatedData = hasDefaultDataChanged ? defaultData : structuredClone(clonedState.data);
231
- /**
232
- * When schema changes without a defaultData refresh, re-add any fields that were
233
- * previously removed and are now reintroduced from the local stash.
234
- *
235
- * This preserves user-entered values across dynamic required/optional transitions,
236
- * such as when rule-driven fields are temporarily hidden and then shown again.
237
- */
238
- if (!hasDefaultDataChanged && updatedData) for (const formName in requiredFields) {
239
- const form = formName;
240
- const prevFields = [...clonedState.requiredFields?.[form] ?? [], ...clonedState.optionalFields?.[form] ?? []];
241
- [...requiredFields?.[form] ?? [], ...newOptionalFields?.[form] ?? []].filter((field) => !prevFields.includes(field)).forEach((field) => {
242
- const currentValue = updatedData?.[form]?.[field];
243
- const localValue = clonedState.local?.[form]?.data?.[field];
244
- if (typeof currentValue === "undefined" && typeof localValue !== "undefined") {
245
- if (!updatedData[form]) return;
246
- updatedData[form][field] = localValue;
247
- }
248
- });
249
- }
250
- const newState = init({
251
- requiredFields,
252
- data: updatedData,
253
- fieldProblems: clonedState.fieldProblems,
254
- obscuredFields,
255
- optionalFields: newOptionalFields,
256
- trustedFields,
257
- staticValidate,
258
- defaultData
259
- });
260
- if (hasDefaultDataChanged) return newState;
261
- /**
262
- * Persist values of fields that are being removed from the active schema into local.
263
- *
264
- * These values are later used to restore data for reintroduced fields in subsequent
265
- * schema transitions, avoiding silent data loss during dynamic form updates.
266
- */
267
- const local = Object.keys(requiredFields ?? {}).reduce((acc, formName) => {
268
- const form = formName;
269
- const prevFields = [...clonedState.requiredFields?.[form] ?? [], ...clonedState.optionalFields?.[form] ?? []];
270
- const nextFields = [...requiredFields?.[form] ?? [], ...newOptionalFields?.[form] ?? []];
271
- const removedFields = prevFields.filter((field) => !nextFields.includes(field));
272
- if (!removedFields.length) {
273
- if (clonedState.local?.[form]) return {
274
- ...acc,
275
- [form]: clonedState.local[form]
276
- };
277
- return acc;
278
- }
279
- const localFormData = {
280
- ...clonedState.local?.[form]?.data ?? {},
281
- ...removedFields.reduce((fieldAcc, field) => {
282
- const value = clonedState.data?.[form]?.[field];
283
- if (typeof value !== "undefined") return {
284
- ...fieldAcc,
285
- [field]: value
286
- };
287
- return fieldAcc;
288
- }, {})
289
- };
290
- return {
291
- ...acc,
292
- [form]: {
293
- ...clonedState.local?.[form] ?? {},
294
- data: localFormData
295
- }
296
- };
297
- }, {});
298
- return {
299
- ...newState,
300
- local
301
- };
302
- }
303
- case "setInnerFormRequiredFields": {
304
- /**
305
- * This sets the requiredFields in a single form.
306
- * Ideally this should not be used anywhere, as this goes against the idea of having all
307
- * the rules of calculating requiredFields in a single place. keeping this in case we have
308
- * any exceptional scenarios where this would be required. Can be removed once all forms
309
- * migrated to useMultiform
310
- */
311
- if (!innerFormFields || !formName) return state;
312
- const requiredFields = {
313
- ...clonedState.requiredFields,
314
- [formName]: innerFormFields
315
- };
316
- const defaultState = init({
317
- requiredFields,
318
- defaultData,
319
- fieldProblems: clonedState.fieldProblems,
320
- obscuredFields,
321
- optionalFields,
322
- trustedFields,
323
- staticValidate,
324
- data: defaultData
325
- });
326
- const removedFields = clonedState.optionalFields?.[formName].length ? [...(clonedState.requiredFields?.[formName] ?? []).filter((field) => !innerFormFields.includes(field)), ...clonedState.optionalFields[formName].filter((field) => !optionalFields?.[formName].includes(field))] : clonedState.requiredFields?.[formName].filter((field) => !innerFormFields.includes(field));
327
- const newFields = optionalFields?.[formName].length ? [...innerFormFields.filter((field) => !clonedState.requiredFields?.[formName].includes(field)), ...(optionalFields[formName] ?? []).filter((field) => !clonedState.optionalFields?.[formName].includes(field))] : innerFormFields.filter((field) => !clonedState.requiredFields?.[formName].includes(field));
328
- const formLocal = {
329
- data: omitKeys(clonedState.data?.[formName], newFields),
330
- errors: omitKeys(clonedState.errors?.[formName], newFields),
331
- valid: omitKeys(clonedState.valid?.[formName], newFields),
332
- fieldProblems: omitKeys(clonedState.fieldProblems?.[formName], newFields)
333
- };
334
- const local = {
335
- ...clonedState.local,
336
- [formName]: formLocal
337
- };
338
- const updatedFormData = addKeys(omitKeys(clonedState.data?.[formName], removedFields), newFields, null, defaultState.data?.[formName], clonedState.local?.[formName].data);
339
- const updatedData = {
340
- ...clonedState.data,
341
- [formName]: updatedFormData
342
- };
343
- const updatedFormValidity = addKeys(omitKeys(clonedState.valid?.[formName], removedFields), newFields, false, defaultState.valid?.[formName], clonedState.local?.[formName].valid);
344
- const updatedValidity = {
345
- ...clonedState.valid,
346
- [formName]: updatedFormValidity
347
- };
348
- const updatedFormErrors = addKeys(omitKeys(clonedState.errors?.[formName], removedFields), newFields, null, defaultState.errors?.[formName], clonedState.local?.[formName].errors);
349
- const updatedErrors = {
350
- ...clonedState.errors,
351
- [formName]: updatedFormErrors
352
- };
353
- const updatedFormFieldProblems = addKeys(omitKeys(clonedState.fieldProblems?.[formName], removedFields), newFields, false, defaultState.fieldProblems?.[formName], clonedState.local?.[formName].fieldProblems);
354
- return {
355
- requiredFields,
356
- data: updatedData,
357
- valid: updatedValidity,
358
- errors: updatedErrors,
359
- fieldProblems: {
360
- ...clonedState.fieldProblems,
361
- [formName]: updatedFormFieldProblems
362
- },
363
- asyncErrors: clonedState.asyncErrors,
364
- optionalFields,
365
- trustedFields,
366
- local,
367
- defaultData
368
- };
369
- }
370
- case "updateField": {
371
- /**
372
- * Called when a field value changes in form
373
- * Validates the field and updates data, validity, error in the state for the field
374
- */
375
- if (!key || !mode || !formName) return state;
376
- const updatedData = {
377
- ...clonedState.data,
378
- [formName]: {
379
- ...clonedState.data?.[formName],
380
- [key]: value
381
- }
382
- };
383
- /**
384
- * Wipe async errors for the field if value has been changed
385
- */
386
- const updatedAsyncErrors = hasValueChanged(value, clonedState.data?.[formName]?.[key]) ? {
387
- ...clonedState.asyncErrors,
388
- [formName]: {
389
- ...clonedState.asyncErrors?.[formName],
390
- [key]: null
391
- }
392
- } : clonedState.asyncErrors;
393
- const [formattedValue, validation] = processField({
394
- key,
395
- value,
396
- mode,
397
- formName,
398
- defaultData: defaultData?.[formName],
399
- data: updatedData,
400
- formatters: formatters?.[formName],
401
- fieldContext: { state: {
402
- data: clonedState.data?.[formName],
403
- obscuredFields: obscuredFields?.[formName],
404
- optionalFields: optionalFields?.[formName],
405
- trustedFields: trustedFields?.[formName],
406
- errors: clonedState.errors[formName],
407
- valid: clonedState.valid[formName],
408
- fieldProblems: clonedState.fieldProblems[formName],
409
- asyncErrors: updatedAsyncErrors[formName]
410
- } },
411
- staticValidate
412
- });
413
- const clearFieldProblems = (clonedState.data?.[formName])?.[key] !== formattedValue;
414
- return {
415
- ...clonedState,
416
- data: {
417
- ...clonedState.data,
418
- [formName]: {
419
- ...clonedState.data?.[formName],
420
- [key]: formattedValue
421
- }
422
- },
423
- asyncErrors: updatedAsyncErrors,
424
- errors: {
425
- ...clonedState.errors,
426
- [formName]: {
427
- ...clonedState.errors[formName],
428
- [key]: validation.getError() ?? null
429
- }
430
- },
431
- valid: {
432
- ...clonedState.valid,
433
- [formName]: {
434
- ...clonedState?.valid?.[formName],
435
- [key]: (validation.isValid && !clonedState.fieldProblems?.[formName]?.[key]) ?? false
436
- }
437
- },
438
- fieldProblems: {
439
- ...clonedState.fieldProblems,
440
- [formName]: {
441
- ...clonedState.fieldProblems[formName],
442
- ...!clearFieldProblems && clonedState.fieldProblems?.[formName]?.[key] ? { [key]: true } : {}
443
- }
444
- }
445
- };
446
- }
447
- case "validateForm": {
448
- /**
449
- * Called when triggerValidation('formName') is called, validates all the fields in the form
450
- * and populates the errors in the state
451
- */
452
- if (!formName) return state;
453
- const formFields = clonedState.requiredFields?.[formName];
454
- if (!formFields) return state;
455
- const formState = (selectedSchema || formFields).reduce((acc, field) => {
456
- const formData = clonedState.data?.[formName];
457
- const [formattedValue, validation] = processField({
458
- key: field,
459
- mode: "blur",
460
- value: formData?.[field] ?? null,
461
- formName,
462
- defaultData: defaultData?.[formName],
463
- data: clonedState.data,
464
- formatters: formatters?.[formName],
465
- fieldContext: { state: {
466
- data: clonedState.data?.[formName],
467
- obscuredFields: obscuredFields?.[formName],
468
- optionalFields: optionalFields?.[formName],
469
- trustedFields: trustedFields?.[formName],
470
- errors: clonedState.errors[formName],
471
- valid: clonedState.valid[formName],
472
- fieldProblems: clonedState.fieldProblems[formName],
473
- asyncErrors: clonedState.asyncErrors[formName]
474
- } },
475
- staticValidate
476
- });
477
- const clearFieldProblems = (clonedState?.data?.[formName])?.[field] !== formattedValue;
478
- const fieldAsyncValidationResult = asyncValidationResults?.[field];
479
- return {
480
- data: formData,
481
- asyncErrors: {
482
- ...acc.asyncErrors,
483
- [field]: fieldAsyncValidationResult?.getError() ?? null
484
- },
485
- errors: {
486
- ...acc.errors,
487
- [field]: validation.getError() ?? fieldAsyncValidationResult?.getError() ?? null
488
- },
489
- valid: {
490
- ...acc.valid,
491
- [field]: validation.isValid && (fieldAsyncValidationResult?.isValid ?? true) && !clonedState.fieldProblems[formName][field]
492
- },
493
- fieldProblems: {
494
- ...acc.fieldProblems,
495
- ...!clearFieldProblems && acc.fieldProblems?.[field] ? { [field]: true } : {}
496
- }
497
- };
498
- }, {});
499
- return {
500
- ...clonedState,
501
- errors: {
502
- ...clonedState.errors,
503
- [formName]: formState.errors
504
- },
505
- asyncErrors: {
506
- ...clonedState.asyncErrors,
507
- [formName]: formState.asyncErrors
508
- },
509
- valid: {
510
- ...clonedState.valid,
511
- [formName]: formState.valid
512
- },
513
- fieldProblems: {
514
- ...clonedState.fieldProblems,
515
- [formName]: formState.fieldProblems
516
- }
517
- };
518
- }
519
- default: throw new Error("Undefined useForm action");
520
- }
521
- };
522
- }
523
- //#endregion
524
- //#region src/hooks/useMultiForm/useMultiFormAsyncValidator.ts
525
- var logger = createLogger();
526
- /**
527
- * Returns
528
- * - triggerAsyncValidation function which can execute the async validation for a field and populate the sync validation results
529
- * - asyncValidationResult state which keeps track of async validations of all fields.
530
- * @param asyncRules
531
- */
532
- var useMultiFormAsyncValidator = (asyncRules) => {
533
- const validResult = {
534
- isValid: true,
535
- hasError: false
536
- };
537
- const triggerAsyncValidation = useCallback(async (field, formName, data) => {
538
- if (!asyncRules) return new ValidationResult([validResult]);
539
- const rule = typeof asyncRules === "function" ? asyncRules(data)[formName]?.[field] : asyncRules[formName][field];
540
- const value = data?.[formName]?.[field];
541
- if (!rule || !value) return new ValidationResult([validResult]);
542
- const isValid = await rule.asyncValidate(value).catch(logger.error);
543
- if (isValid === false) return new ValidationResult([{
544
- isValid,
545
- errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value) : rule.errorMessage,
546
- hasError: !isValid
547
- }]);
548
- return new ValidationResult([validResult]);
549
- }, [asyncRules]);
550
- const triggerAsyncFormValidation = async (formName, state, selectedSchema) => {
551
- const fields = selectedSchema ?? state.requiredFields?.[formName];
552
- if (!fields?.length) return { isValid: true };
553
- const asyncValidationResults = await fields.reduce(async (accPromise, fieldName) => {
554
- const acc = await accPromise;
555
- const asyncValidationResult = await triggerAsyncValidation(fieldName, formName, state.data);
556
- return {
557
- ...acc,
558
- [fieldName]: asyncValidationResult
559
- };
560
- }, Promise.resolve({}));
561
- const isValid = Object.values(asyncValidationResults).every((validationResult) => validationResult.isValid);
562
- return {
563
- ...asyncValidationResults,
564
- isValid
565
- };
566
- };
567
- return { triggerAsyncFormValidation };
568
- };
569
- //#endregion
570
- //#region src/utils/validation/commonValidators.ts
571
- var isTruthyValidator = {
572
- validate: (value) => !!value,
573
- modes: ["blur"],
574
- errorMessage: "fieldIsRequired"
575
- };
576
- var isNotEmptyValidator = {
577
- validate: (value) => !isEmpty(value),
578
- modes: ["blur"],
579
- errorMessage: "fieldIsRequired"
580
- };
581
- //#endregion
582
- //#region src/hooks/useMultiForm/useMultiFormStaticValidator.ts
583
- var useMultiFormStaticValidator = (rules) => {
584
- const getRulesForField = useCallback((field, form, data) => {
585
- const fallbackRule = {
586
- validate: () => true,
587
- modes: ["blur", "input"]
588
- };
589
- if (!form) return [fallbackRule];
590
- const fieldRules = typeof rules === "function" ? rules(data)?.[form]?.[field] ?? [fallbackRule] : rules?.[form]?.[field] ?? [fallbackRule];
591
- return Array.isArray(fieldRules) ? fieldRules : [fieldRules];
592
- }, [rules]);
593
- return { triggerStaticValidation: useCallback(({ key, value, mode = "blur", formName }, data, context) => {
594
- const fieldRules = getRulesForField(key, formName, data);
595
- const isFieldOptional = !!context?.state.optionalFields?.includes(key);
596
- const isFieldObscured = !!context?.state.obscuredFields?.includes(key);
597
- if (!isFieldOptional) fieldRules.unshift(isNotEmptyValidator);
598
- return new ValidationResult(fieldRules.map((rule) => {
599
- const shouldValidate = rule.modes.includes(mode) && !isFieldObscured;
600
- const isValid = isFieldOptional && isEmpty(value) ? true : rule.validate(value, context);
601
- return {
602
- isValid,
603
- errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value, context) : rule.errorMessage,
604
- hasError: shouldValidate && !isValid
605
- };
606
- }));
607
- }, [getRulesForField]) };
608
- };
609
- //#endregion
610
- //#region src/hooks/useMultiForm/useMultiForm.ts
611
- function useMultiForm({ defaultData, rules, asyncRules, fieldProblems, allFields, requiredFields, obscuredFields, optionalFields, trustedFields, formatters }) {
612
- const { triggerStaticValidation } = useMultiFormStaticValidator(rules);
613
- const { triggerAsyncFormValidation } = useMultiFormAsyncValidator(asyncRules);
614
- const getRequiredFields = useMemo(() => typeof requiredFields === "function" ? requiredFields : () => requiredFields, [requiredFields]);
615
- const getSchema = useMemo(() => getRequiredFields(defaultData), [defaultData, getRequiredFields]);
616
- const getReducer = useCallback(() => reducer({
617
- staticValidate: triggerStaticValidation,
618
- defaultData,
619
- obscuredFields,
620
- optionalFields,
621
- trustedFields,
622
- formatters
623
- }), [
624
- triggerStaticValidation,
625
- obscuredFields,
626
- optionalFields,
627
- trustedFields,
628
- formatters,
629
- defaultData
630
- ]);
631
- const initialData = useMemo(() => ({
632
- requiredFields: getSchema,
633
- defaultData,
634
- fieldProblems,
635
- obscuredFields,
636
- optionalFields,
637
- trustedFields,
638
- formatters,
639
- staticValidate: triggerStaticValidation,
640
- data: defaultData
641
- }), [
642
- getSchema,
643
- defaultData,
644
- fieldProblems,
645
- obscuredFields,
646
- optionalFields,
647
- trustedFields,
648
- formatters,
649
- triggerStaticValidation
650
- ]);
651
- const [state, dispatch] = useReducer(getReducer(), initialData, init);
652
- const isValid = useMemo(() => {
653
- const formsForOptionalFields = Object.keys(state.optionalFields ?? {});
654
- const formsForRequiredFields = Object.keys(state.requiredFields ?? {});
655
- return Array.from(new Set([...formsForOptionalFields, ...formsForRequiredFields])).reduce((acc, formName) => {
656
- const form = formName;
657
- const optionalsFormFields = state.optionalFields?.[form] ?? [];
658
- const requiredFormFields = state.requiredFields?.[form] ?? [];
659
- const formFields = [...optionalsFormFields, ...requiredFormFields];
660
- const formValidity = state.valid[formName] ?? {};
661
- return {
662
- ...acc,
663
- [formName]: Object.entries(formValidity)?.every(([field, valid]) => formFields.includes(field) ? valid : true)
664
- };
665
- }, {});
666
- }, [state.requiredFields, state.valid]);
667
- const getTargetValue = useCallback((formName, key, e) => {
668
- if (!e?.target) return e;
669
- if (e.target.type === "checkbox") return !state.data?.[formName][key];
670
- return e.target.value;
671
- }, [state.data]);
672
- const setErrors = useCallback((formName, key, value) => {
673
- dispatch({
674
- type: "setErrors",
675
- key,
676
- value,
677
- formName
678
- });
679
- }, []);
680
- const setValid = useCallback((formName, key, value) => {
681
- dispatch({
682
- type: "setValid",
683
- key,
684
- value,
685
- formName
686
- });
687
- }, []);
688
- const setData = useCallback((formName, key, value) => {
689
- dispatch({
690
- type: "setData",
691
- key,
692
- value,
693
- formName
694
- });
695
- }, []);
696
- const setFormData = useCallback((formName, formData) => {
697
- dispatch({
698
- type: "setFormData",
699
- formName,
700
- formData
701
- });
702
- }, []);
703
- const handleChangeFor = useCallback((formName, key, mode = "blur") => (e) => {
704
- dispatch({
705
- type: "updateField",
706
- key,
707
- value: getTargetValue(formName, key, e),
708
- mode,
709
- formName
710
- });
711
- }, [getTargetValue]);
712
- const triggerValidation = useCallback(async (formName, selectedSchema) => {
713
- const asyncValidationResults = await triggerAsyncFormValidation(formName, state, selectedSchema);
714
- dispatch({
715
- type: "validateForm",
716
- formName,
717
- selectedSchema,
718
- asyncValidationResults
719
- });
720
- return asyncValidationResults.isValid;
721
- }, [state, triggerAsyncFormValidation]);
722
- const resetToDefaultData = useCallback(() => {
723
- if (!getSchema) return;
724
- Object.entries(getSchema).forEach(([formName]) => {
725
- const form = formName;
726
- const formData = defaultData?.[form];
727
- getSchema[form].forEach((field) => {
728
- if (!formData || typeof formData[field] !== "undefined") {
729
- handleChangeFor(form, field)(formData);
730
- return;
731
- }
732
- setValid(form, field, false);
733
- setErrors(form, field, null);
734
- setData(form, field, formData[field]);
735
- });
736
- });
737
- }, [
738
- defaultData,
739
- getSchema,
740
- handleChangeFor,
741
- setData,
742
- setErrors,
743
- setValid
744
- ]);
745
- useEffect(() => {
746
- const requiredFields = getRequiredFields(state.data);
747
- if (!requiredFields) return;
748
- dispatch({
749
- type: "setRequiredFields",
750
- requiredFields,
751
- defaultData,
752
- optionalFields
753
- });
754
- }, [
755
- getRequiredFields,
756
- state.data,
757
- defaultData,
758
- optionalFields
759
- ]);
760
- return {
761
- setData,
762
- setFormData,
763
- setValid,
764
- setErrors,
765
- handleChangeFor,
766
- triggerValidation,
767
- resetToDefaultData,
768
- isValid,
769
- allFields,
770
- requiredFields: state.requiredFields,
771
- optionalFields: state.optionalFields,
772
- trustedFields: state.trustedFields,
773
- obscuredFields: state.obscuredFields,
774
- valid: state.valid,
775
- errors: state.errors,
776
- data: state.data,
777
- fieldProblems: state.fieldProblems,
778
- defaultData,
779
- asyncErrors: state.asyncErrors
780
- };
781
- }
782
- //#endregion
783
- export { isNotEmptyValidator as n, isTruthyValidator as r, useMultiForm as t };