@adyen/kyc-components 4.25.2 → 4.26.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/dist/{4-people-DKuivE0m.js → 4-people-CAxQpi_3.js} +2 -2
  2. package/dist/{AcceptTermsOfServiceWorkflow-BKWCrZdZ.js → AcceptTermsOfServiceWorkflow-Dqbo6l6E.js} +4 -4
  3. package/dist/{Accordion-D_DOaWj2.js → Accordion-BAdwrgCR.js} +4 -24
  4. package/dist/{AccountSetupRejected-BtcxtVKO.js → AccountSetupRejected-BiFdVnlI.js} +3 -4
  5. package/dist/{NodeRenderer-Z10yF5MV.js → AdaptiveWorkflow-Cl6sIKYm.js} +87 -34
  6. package/dist/{AdaptiveWorkflowComponent-C4Q6NVtv.js → AdaptiveWorkflowComponent-DTvjszP9.js} +32 -33
  7. package/dist/{AddressFields-CFG2_P0x.js → AddressFields-DSJ_dDIS.js} +21 -27
  8. package/dist/{Avatar-k5lNd5KG.js → Avatar-C2zeqSSB.js} +10 -8
  9. package/dist/{BusinessFinancingDropin-BjTnxk__.js → BusinessFinancingDropin-BZsQMeo9.js} +61 -71
  10. package/dist/{BusinessFinancingPage-C4dAslMp.js → BusinessFinancingPage-BilT7QB1.js} +7 -7
  11. package/dist/{BusinessRegistrationNumberField-Dz1uGvRQ.js → BusinessRegistrationNumberField-CBEz-yoj.js} +7 -8
  12. package/dist/{BusinessRegistrationNumberFieldGroup-BFPrFa1_.js → BusinessRegistrationNumberFieldGroup-CkoC1zF3.js} +7 -8
  13. package/dist/{BusinessTypeSelectionPage-DeWD37jR.js → BusinessTypeSelectionPage-CIO175KD.js} +16 -17
  14. package/dist/{Button-BxdC8cVB.js → Button-Dwr6jvJZ.js} +2 -2
  15. package/dist/Checkbox-CpzEl3ji.js +114 -0
  16. package/dist/{ComponentGroup-S6c3rVoX.js → ComponentGroup-BjjCPKWY.js} +4 -4
  17. package/dist/{ConstitutionalDocument-CNNhKkzD.js → ConstitutionalDocument-C_ZgPp87.js} +25 -28
  18. package/dist/{ContactDetails-_HCOKj3-.js → ContactDetails-DHHlpdct.js} +8 -13
  19. package/dist/{ContextGuidance-v-d9RQuo.js → ContextGuidance-SHSxyen7.js} +3 -3
  20. package/dist/CountryField-DUANNyWK.js +56 -0
  21. package/dist/{Currency-3Z9i_AhY.js → Currency-DFgCZFeZ.js} +10 -12
  22. package/dist/{CustomerSupport-B0UJHtAq.js → CustomerSupport-8Gp9EPcW.js} +17 -17
  23. package/dist/DateField-DfkL_Acw.js +73 -0
  24. package/dist/{DebugModal-CR4CRxIH.js → DebugModal-DrmTRJup.js} +12 -17
  25. package/dist/{DecisionMakerDetails-RF9BoMYF.js → DecisionMakerDetails-DSuWWQR3.js} +21 -24
  26. package/dist/{DecisionMakerDetailsPage-DY0nuFUI.js → DecisionMakerDetailsPage-DvaF8JWQ.js} +43 -40
  27. package/dist/{DecisionMakers-qRoXooYA.js → DecisionMakers-HjFvfukQ.js} +55 -61
  28. package/dist/{DetailViewLayout-DNCGEd7b.js → DetailViewLayout-DJgAzdlZ.js} +8 -6
  29. package/dist/{Dropzone-cewfCgXt.js → Dropzone-CM9xNqdS.js} +8 -8
  30. package/dist/EmailField-CIMaH5h8.js +61 -0
  31. package/dist/{EmbeddedStatus-Keg7UojY.js → EmbeddedStatus-4YjyzkcD.js} +4 -4
  32. package/dist/{EndStateLayout-GHEYl82p.js → EndStateLayout-C5Pqler-.js} +3 -3
  33. package/dist/{EntityAssociation-BPtrqdQR.js → EntityAssociation-mOKgAoTo.js} +7 -7
  34. package/dist/{ErrorPanel-PefRq1M4.js → ErrorPanel-MWL7vQHx.js} +24 -19
  35. package/dist/{GlobalEntryModal-De-1eJCW.js → GlobalEntryModal-CLTA41r-.js} +191 -75
  36. package/dist/{GlobalEntryPage-D8fuYItP.js → GlobalEntryPage-CxXk05KE.js} +10 -10
  37. package/dist/Icon-_YUEZg1p.js +175 -0
  38. package/dist/{IdentityNumber-Cz6-4YcM.js → IdentityNumber-DA8DOgxH.js} +10 -12
  39. package/dist/{IdentityNumberFieldGroup-D2PV_4A5.js → IdentityNumberFieldGroup-D4MTWr-z.js} +16 -14
  40. package/dist/{IdentityScreeningWorkflow-mbcaIctn.js → IdentityScreeningWorkflow-DfI-6mXR.js} +16 -16
  41. package/dist/{Image-Bn_Yyuof.js → Image-CxnjHtP1.js} +1 -1
  42. package/dist/{IndividualDropin-Bg0cL1Rf.js → IndividualDropin-B70zK0AA.js} +266 -281
  43. package/dist/{IndustryCodeFieldGroup-DmOqxPIg.js → IndustryCodeFieldGroup-CHPfvz-_.js} +9 -10
  44. package/dist/{InputDate-B0RNGCq2.js → InputDate-BSxqqg_B.js} +6 -29
  45. package/dist/InputDate.utils-D4Ov0KIl.js +25 -0
  46. package/dist/{InputGroup-B4U3QVEp.js → InputGroup-Bv005B22.js} +7 -6
  47. package/dist/{InputText-CwPK55J0.js → InputText-DIesIpnW.js} +42 -4
  48. package/dist/{Introduction-DFW6EaLG.js → Introduction--U4NyUxq.js} +9 -9
  49. package/dist/{InvitedDecisionMakerComponent-B-ey6hBS.js → InvitedDecisionMakerComponent-DIBX_HRF.js} +45 -45
  50. package/dist/{JpAddressFields-CzGnXBMk.js → JpAddressFields-OgKOVHI0.js} +13 -13
  51. package/dist/{LegalCompanyNameField-CV2EgRCw.js → LegalCompanyNameField-wgWJRR84.js} +5 -5
  52. package/dist/{LegalRepresentativeDetailsPage-BDG0ML64.js → LegalRepresentativeDetailsPage-BFtn7wzQ.js} +35 -34
  53. package/dist/{Link-C3dYYTm_.js → Link-D0Yqc2r0.js} +7 -6
  54. package/dist/{List-ywoRPg-q.js → List-qvNxW9lm.js} +3 -2
  55. package/dist/{ListItem-CHGVbHhB.js → ListItem-DY-qq1lS.js} +29 -4
  56. package/dist/{Loader-BVtlpTeo.js → Loader-BDaKGf77.js} +1 -1
  57. package/dist/{Modal-Dq44ZUNN.js → Modal-C-T-spfu.js} +25 -5
  58. package/dist/{Name-BfQr3et_.js → Name-C8NOxqDE.js} +5 -5
  59. package/dist/NumberField-CUGWeVc9.js +60 -0
  60. package/dist/{PatriotActDisclosure-BNAsJXEL.js → PatriotActDisclosure-CWcGyfuA.js} +11 -12
  61. package/dist/{PayoutDetailsDropin-NyizAaYy.js → PayoutDetailsDropin-CZT8xUPC.js} +163 -158
  62. package/dist/{PayoutDetailsPage-CoE94WE6.js → PayoutDetailsPage-C54-v6yl.js} +10 -9
  63. package/dist/{Review-CzgmjDcZ.js → Review-CYIwvp62.js} +25 -24
  64. package/dist/{RootBusinessDetailsPage-MdKN-iNS.js → RootBusinessDetailsPage-CI8iAty4.js} +9 -7
  65. package/dist/{RootBusinessLinesPage-Dv1uT7OS.js → RootBusinessLinesPage-ZPaIqKwi.js} +48 -53
  66. package/dist/{RootIndividualDetailsPage-PkcLN0El.js → RootIndividualDetailsPage-ApOJRs0B.js} +42 -39
  67. package/dist/{Select-prMx73V9.js → Select-DwuMMZWv.js} +330 -19
  68. package/dist/{SignPCIComponent-CIkdVNH2.js → SignPCIComponent-B4D4nPDO.js} +19 -23
  69. package/dist/{SingpassSelection-B6NONcr4.js → SingpassSelection-vy5Stz5H.js} +7 -7
  70. package/dist/Skeleton-7xDqhYr-.js +30 -0
  71. package/dist/{SoleProprietorshipPage-_aY8GRDx.js → SoleProprietorshipPage-dyEpmmk3.js} +7 -7
  72. package/dist/{SourceOfFundsPage-B5nZ3MjN.js → SourceOfFundsPage-DgCWI7Ac.js} +46 -58
  73. package/dist/{SourceOfFundsWorkflow-IkLZG9JI.js → SourceOfFundsWorkflow-CdOOLWqA.js} +4 -4
  74. package/dist/{StackLayout-IUdNMDgW.js → StackLayout-J1ynSX-P.js} +6 -5
  75. package/dist/{utils-lIizXlcC.js → StateField-BMyu6YZZ.js} +89 -3
  76. package/dist/{Step-BJh4XZae.js → Step-Cqaytd3J.js} +19 -13
  77. package/dist/SummarySection-BVPfXtuP.js +60 -0
  78. package/dist/{Task-yQcY16x1.js → Task-CegWZQgV.js} +8 -8
  79. package/dist/{TaskGroup-C9iFHpux.js → TaskGroup-BqSUUr1i.js} +5 -5
  80. package/dist/{TaskListItem-ChlmCIfF.js → TaskListItem-CvYgXREa.js} +11 -11
  81. package/dist/{TaskStepperContextProvider-I7talGDO.js → TaskStepperContextProvider-9wlnwii7.js} +1 -1
  82. package/dist/{TaskVerificationStatus-Bd5Eftf2.js → TaskVerificationStatus-zoxTZ2mt.js} +3 -3
  83. package/dist/{TaxInformationFieldGroup-Dq0J9rBU.js → TaxInformationFieldGroup-lT5OgO75.js} +19 -18
  84. package/dist/{TaxReportingDropin-Cq3gBWtp.js → TaxReportingDropin-C9jUzNzP.js} +22 -26
  85. package/dist/{TaxReportingWorkflow-flQPRAPy.js → TaxReportingWorkflow-C3qyl3rW.js} +4 -4
  86. package/dist/{TermsOfServiceManagement-BM5K4cpw.js → TermsOfServiceManagement-DfFV6erX.js} +21 -30
  87. package/dist/{TextArea-C12oXMzX.js → TextArea-CQIt_2VI.js} +5 -5
  88. package/dist/TextField-C8CRipRJ.js +73 -0
  89. package/dist/{TrustDetailsPage-z7s9FxVC.js → TrustDetailsPage-Ax5uaglT.js} +59 -67
  90. package/dist/{TrustMemberCompanyPage-6yLYDall.js → TrustMemberCompanyPage-DBxTZo-8.js} +8 -8
  91. package/dist/{TrustMemberIndividualPage-Dlt0O4MR.js → TrustMemberIndividualPage-DFhWDN3f.js} +35 -34
  92. package/dist/{TrustMemberRoleAndTypePage-DIwrtOWr.js → TrustMemberRoleAndTypePage-Bdoyd1ix.js} +23 -30
  93. package/dist/{TrustMembersOverview-CowTgfIb.js → TrustMembersOverview-BCdJRHAn.js} +18 -22
  94. package/dist/{UboTaskItem-CZLDzQil.js → UboTaskItem-DIIoWLbx.js} +8 -8
  95. package/dist/{UnincorporatedPartnershipIndividualPage-tHoVsMAA.js → UnincorporatedPartnershipIndividualPage-B20wDAzH.js} +35 -34
  96. package/dist/{UnincorporatedPartnershipMemberCompanyPage-B-wcypiJ.js → UnincorporatedPartnershipMemberCompanyPage-DvcQYNzd.js} +8 -8
  97. package/dist/{UnincorporatedPartnershipMemberRoleAndTypePage-D973uyHj.js → UnincorporatedPartnershipMemberRoleAndTypePage-Dx1pRB4b.js} +14 -16
  98. package/dist/{UnincorporatedPartnershipMembersOverview-5w1BrDMI.js → UnincorporatedPartnershipMembersOverview-C0cRXnsL.js} +11 -14
  99. package/dist/VerificationErrorAlert-D0K9gep-.js +68 -0
  100. package/dist/WebsiteField-Bgf9bYOR.js +62 -0
  101. package/dist/{Workflow-CF-HUIjR.js → Workflow-DxRS9IMd.js} +9 -9
  102. package/dist/{accountHolderUtils-CAu4V0ed.js → accountHolderUtils-QdO9D_A_.js} +3 -3
  103. package/dist/adyen-business-financing.js +8 -9
  104. package/dist/adyen-individual-configuration.js +36 -36
  105. package/dist/adyen-individual-status.js +8 -9
  106. package/dist/adyen-invited-decision-maker.js +3 -3
  107. package/dist/adyen-onboarding.js +61 -59
  108. package/dist/adyen-terms-of-service-management.js +3 -3
  109. package/dist/adyen-terms-of-service-status.js +6 -7
  110. package/dist/adyen-transfer-instrument-configuration.js +7 -8
  111. package/dist/adyen-transfer-instrument-management.js +16 -22
  112. package/dist/adyen-verification-status.js +7 -9
  113. package/dist/{arrow-right-D2hul7WG.js → arrow-right-BwP9nNDE.js} +2 -2
  114. package/dist/bafinUtils-CW20t7tP.js +3548 -0
  115. package/dist/{bag-CRRS1aow.js → bag-Cnk9dcZg.js} +2 -2
  116. package/dist/{bank-BoirCLLW.js → bank-UssyP-aG.js} +2 -2
  117. package/dist/bg-BG-C7z9VtPy.js +7 -0
  118. package/dist/{bin-BOmfqfrr.js → bin--Ft4cPCj.js} +2 -2
  119. package/dist/{capital-DTjbiurV.js → capital-BbOFhTHY.js} +2 -2
  120. package/dist/{cash-stack-7KpYpBek.js → cash-stack-LTzc8hQZ.js} +2 -2
  121. package/dist/{certificate-BPuoJ6Ip.js → certificate-CswNcwlI.js} +2 -2
  122. package/dist/{checkmark-BiSLf8M1.js → checkmark-DH1abKZn.js} +2 -2
  123. package/dist/{checkmark-circle-Ams7bSve.js → checkmark-circle-VWM-JsI6.js} +2 -2
  124. package/dist/{checkmark-circle-fill-_p4ss4ac.js → checkmark-circle-fill-AuW2DQDT.js} +2 -2
  125. package/dist/{checkmark-small-3bw4ftPV.js → checkmark-small-B6vsnsSO.js} +2 -2
  126. package/dist/{chevron-down-GgZawvoy.js → chevron-down-BGAMP7CF.js} +2 -2
  127. package/dist/{chevron-left-TeZTTvo5.js → chevron-left-EjFIt8Cd.js} +2 -2
  128. package/dist/{chevron-right-Cg8XlTxx.js → chevron-right-B5zb9mkt.js} +2 -2
  129. package/dist/{chevron-up-COQUTli0.js → chevron-up-DZiittpJ.js} +2 -2
  130. package/dist/{circle-CypWzg83.js → circle-CygvxRY_.js} +2 -2
  131. package/dist/{circle-small-filled-DfdK2A35.js → circle-small-filled-PeElhgJU.js} +2 -2
  132. package/dist/{clock-DmfGJ2r9.js → clock-CQXEE5jK.js} +2 -2
  133. package/dist/{coins-CBvbB8_X.js → coins-C7syygUR.js} +2 -2
  134. package/dist/{constants-DAb_IqC6.js → constants-DR4IoRWH.js} +7 -8
  135. package/dist/{contract-D1_RJ_xh.js → contract-BWEAd7e-.js} +2 -2
  136. package/dist/{countries-BGMTpyJv.js → countries-ZMuvRtQR.js} +1 -1
  137. package/dist/{country-BEZkohEO.js → country-WYlusjTL.js} +2 -2
  138. package/dist/{cross-circle-fill-CUXdo1x-.js → cross-circle-fill-Bxj_fgQE.js} +2 -2
  139. package/dist/cross-circle-fill-small-DwUKcL9P.js +20 -0
  140. package/dist/{cross-BORHADVQ.js → cross-vK6qh9R0.js} +2 -2
  141. package/dist/cs-CZ-B_u3kWRS.js +7 -0
  142. package/dist/da-DK-s_nCUhFO.js +7 -0
  143. package/dist/de-DE-5lHcZmT6.js +7 -0
  144. package/dist/{decisionMakerRoles-JEb0ON4e.js → decisionMakerRoles-DA8MK9Dh.js} +2 -2
  145. package/dist/{document-1-qvV57JdS.js → document-1-BPWF8zKf.js} +2 -2
  146. package/dist/{document-person-DiJ7M8-D.js → document-person-DVRFNq7g.js} +2 -2
  147. package/dist/{documentUtils-CxjFpoJB.js → documentUtils-6K3LdjjN.js} +6 -4
  148. package/dist/{download-Ca4w0Yfr.js → download-DfdpoHdN.js} +2 -2
  149. package/dist/dropinUtils-C0hhy3A9.js +2572 -0
  150. package/dist/{edit-1-D8VhDchs.js → edit-1-BgVB06zI.js} +2 -2
  151. package/dist/el-GR-DTaQeK-A.js +7 -0
  152. package/dist/{entityAssociationUtil-CY0grcyH.js → entityAssociationUtil-BlfcBl3i.js} +1 -1
  153. package/dist/{error-DrzrPjvf.js → error-m4DJ8d3r.js} +3 -3
  154. package/dist/es-ES-tZMJvO6B.js +7 -0
  155. package/dist/es-LA-C0x1nQUQ.js +7 -0
  156. package/dist/et-EE-BqB-3lW_.js +7 -0
  157. package/dist/{external-link-Dy4le-8Q.js → external-link-BbXGAtFE.js} +2 -2
  158. package/dist/fi-FI-BpwWFhLW.js +7 -0
  159. package/dist/{form-rules-DhuNdiqF.js → form-rules-DaLzvm8o.js} +90 -5
  160. package/dist/{formatValidationError-z2D5oU1e.js → formatValidationError-CwtW9tMt.js} +2 -2
  161. package/dist/fr-FR-DMPXwPYV.js +7 -0
  162. package/dist/{getDefaultRegistrationNumberType-BNO2BcfK.js → getDefaultRegistrationNumberType-CVVuCd8E.js} +5 -7
  163. package/dist/{useAssociatedLegalEntity-BdcoiUby.js → getFormSlice-CxtXJ0-P.js} +23 -5
  164. package/dist/{getName-DgxRqagk.js → getName-Cii7OyRd.js} +2 -2
  165. package/dist/{getProblemsForEntity-BY_voJ99.js → getProblemsForEntity-mdb3Bfpj.js} +3 -3
  166. package/dist/{getTrustedDecisionMakers-Ta-pURcL.js → getTrustedDecisionMakers-D89oYOLp.js} +2 -2
  167. package/dist/getValidationError-RnMEkCKd.js +19 -0
  168. package/dist/{gift-Bs_mAgul.js → gift-BjS6ErNG.js} +2 -2
  169. package/dist/{graph-Co0JhGiY.js → graph-B8rX9eXr.js} +2 -2
  170. package/dist/{graph-up-DIvH9haf.js → graph-up-Dwaq7upe.js} +2 -2
  171. package/dist/{headquarter-BESfDGKh.js → headquarter-CXwws_UP.js} +2 -2
  172. package/dist/{hotel-Vne7G5M6.js → hotel-CD5Lv9P7.js} +2 -2
  173. package/dist/hr-HR-D5kV_w60.js +7 -0
  174. package/dist/{http-DsJtugN1.js → http-C8rt2BZk.js} +5 -4
  175. package/dist/hu-HU-Bl1dnZfO.js +7 -0
  176. package/dist/{image-BQM21XCk.js → image-BTE2a8ZV.js} +2 -2
  177. package/dist/{info-DExoPRH5.js → info-BTc0bCCM.js} +2 -2
  178. package/dist/{info-filled-11KMeUso.js → info-filled-DhYinieW.js} +2 -2
  179. package/dist/it-IT-DiuPLWbr.js +7 -0
  180. package/dist/ja-JP-COBWjdXk.js +7 -0
  181. package/dist/{legalArrangementUtils-C68JdH6I.js → legalArrangementUtils-Crgt_L7h.js} +1 -1
  182. package/dist/{location-zRH5zJ8c.js → location-CwE3Q0gg.js} +2 -2
  183. package/dist/lt-LT-D9Pum2_8.js +7 -0
  184. package/dist/lv-LV-DDcLP43G.js +7 -0
  185. package/dist/{mail-i1-zg-cv.js → mail-CIeugZTd.js} +2 -2
  186. package/dist/{mapAddressLocalizationToJpAddressSchema-DpOIaxj6.js → mapAddressLocalizationToJpAddressSchema-Dpsnbt5H.js} +2 -2
  187. package/dist/{mapExistingFile-RrS8dCpX.js → mapExistingFile-BXfeQxev.js} +2 -2
  188. package/dist/{mapJpAddressSchemaToAddressLocalizations-wwD6Rp3Q.js → mapJpAddressSchemaToAddressLocalizations-CAoOxUg9.js} +16 -15
  189. package/dist/{mapLegalEntityToIndividualSchema-DtT3pcZJ.js → mapLegalEntityToIndividualSchema-Bl89JIZK.js} +12 -13
  190. package/dist/{mapTransferInstrumentToPayoutAccount-BpXU-nP1.js → mapTransferInstrumentToPayoutAccount-6aBAKF7U.js} +4 -4
  191. package/dist/{minus-circle-filled-CxUdRO8J.js → minus-circle-filled-96DZCdcJ.js} +2 -2
  192. package/dist/nl-NL-CBRRvqAY.js +7 -0
  193. package/dist/no-NO-C9lYR_fQ.js +7 -0
  194. package/dist/{options-horizontal-D86T_xAF.js → options-horizontal-BU9r-Xx3.js} +2 -2
  195. package/dist/{partner-Dje0ykF6.js → partner-C1SWc0pB.js} +2 -2
  196. package/dist/{pay-by-link-plane-DAiddPu6.js → pay-by-link-plane-xK4Zkol0.js} +2 -2
  197. package/dist/{payout-DKiGv3F9.js → payout-zGf0LNbo.js} +2 -2
  198. package/dist/{pdf-CC8vqpTo.js → pdf-Bbs3Ji9v.js} +157 -174
  199. package/dist/{pdf.worker.min-CdKJICZZ.js → pdf.worker.min-DTQpK-0h.js} +67 -58
  200. package/dist/{person-DgALGIIz.js → person-xTKhpEGR.js} +2 -2
  201. package/dist/pl-PL-CZST_1gV.js +7 -0
  202. package/dist/{plus-DlQKP2C9.js → plus-Cm_dWRpB.js} +2 -2
  203. package/dist/{plus-circle-filled-BntUOVIJ.js → plus-circle-filled-Df77eidx.js} +2 -2
  204. package/dist/{processCapabilities-CWE5UFt8.js → processCapabilities-FL4-KAbd.js} +7 -9
  205. package/dist/{processValidationErrors-CFU1x_1n.js → processValidationErrors-CcgBvwPJ.js} +4 -4
  206. package/dist/pt-BR-C32QroLH.js +7 -0
  207. package/dist/pt-PT-ByfmK1XA.js +7 -0
  208. package/dist/{recurring-DZgT_ekJ.js → recurring-BfwVHJ2Z.js} +2 -2
  209. package/dist/resolveEnvironment-DwfwgVEU.js +2516 -0
  210. package/dist/{revenue-accelerate-aMLYFVW6.js → revenue-accelerate-ClN0cx7Z.js} +2 -2
  211. package/dist/ro-RO-YkglLwfY.js +7 -0
  212. package/dist/{save-uDNye08N.js → save-QK2A-teG.js} +2 -2
  213. package/dist/{search-0OS6oe8N.js → search-DVSyT7Q7.js} +2 -2
  214. package/dist/{uppercase-DvjwUM0n.js → sharedValidators-DODW7kuK.js} +5 -3
  215. package/dist/{show-BWoS9-Y1.js → show-BRWLIRSA.js} +2 -2
  216. package/dist/sk-SK-BYRIVzdY.js +7 -0
  217. package/dist/sl-SI-Cjub_bfF.js +7 -0
  218. package/dist/{solution-payments-BMal7uJZ.js → solution-payments-BZZceFVV.js} +2 -2
  219. package/dist/{store-N7ZA4FKy.js → store-DLKKLXhn.js} +2 -2
  220. package/dist/style.css +1418 -1157
  221. package/dist/styles-DYaAeu4q.js +1418 -1157
  222. package/dist/sv-SE-1re-9Lp8.js +7 -0
  223. package/dist/{terminal-1-0RlQpbUC.js → terminal-1-CpAyEdjO.js} +2 -2
  224. package/dist/{translation-DbATp_35.js → translation-CpH8D2NK.js} +34 -30
  225. package/dist/types/adaptiveWorkflow/component-registry.d.ts +19 -2
  226. package/dist/types/adaptiveWorkflow/components/NodeRenderer/NodeRenderer.d.ts +7 -0
  227. package/dist/types/adaptiveWorkflow/components/NodeRenderer/SimpleFieldRenderer.d.ts +2 -2
  228. package/dist/types/adaptiveWorkflow/components/Shared/Fields/CountryField/CountryField.d.ts +4 -0
  229. package/dist/types/adaptiveWorkflow/components/Shared/Fields/CountryField/contextMap.d.ts +10 -0
  230. package/dist/types/adaptiveWorkflow/components/Shared/Fields/DateField/DateField.d.ts +4 -0
  231. package/dist/types/adaptiveWorkflow/components/Shared/Fields/DateField/contextMap.d.ts +9 -0
  232. package/dist/types/adaptiveWorkflow/components/Shared/Fields/DateField/validators.d.ts +2 -0
  233. package/dist/types/adaptiveWorkflow/components/Shared/Fields/EmailField/EmailField.d.ts +4 -0
  234. package/dist/types/adaptiveWorkflow/components/Shared/Fields/EmailField/contextMap.d.ts +10 -0
  235. package/dist/types/adaptiveWorkflow/components/Shared/Fields/EmailField/validators.d.ts +2 -0
  236. package/dist/types/adaptiveWorkflow/components/Shared/Fields/NumberField/NumberField.d.ts +4 -0
  237. package/dist/types/adaptiveWorkflow/components/Shared/Fields/NumberField/contextMap.d.ts +9 -0
  238. package/dist/types/adaptiveWorkflow/components/Shared/Fields/NumberField/validators.d.ts +2 -0
  239. package/dist/types/adaptiveWorkflow/components/Shared/Fields/TextField/TextField.d.ts +4 -0
  240. package/dist/types/adaptiveWorkflow/components/Shared/Fields/TextField/contextMap.d.ts +10 -0
  241. package/dist/types/adaptiveWorkflow/components/Shared/Fields/TextField/validators.d.ts +4 -0
  242. package/dist/types/adaptiveWorkflow/components/Shared/Fields/WebsiteField/WebsiteField.d.ts +4 -0
  243. package/dist/types/adaptiveWorkflow/components/Shared/Fields/WebsiteField/contextMap.d.ts +10 -0
  244. package/dist/types/adaptiveWorkflow/components/Shared/Fields/WebsiteField/validators.d.ts +3 -0
  245. package/dist/types/adaptiveWorkflow/utils/validators/getValidationError.d.ts +7 -0
  246. package/dist/types/adaptiveWorkflow/utils/validators/sharedValidators.d.ts +3 -0
  247. package/dist/types/adaptiveWorkflow/utils/validators/types.d.ts +6 -0
  248. package/dist/types/api/adaptive/useAdaptiveWorkflow.d.ts +1 -1
  249. package/dist/types/api/address/useAddressCleanse.d.ts +2 -2
  250. package/dist/types/api/address/useRetrieveAddress.d.ts +2 -2
  251. package/dist/types/api/address/useRetrieveFromPostcodeJp.d.ts +2 -2
  252. package/dist/types/api/address/useSearchAddress.d.ts +2 -2
  253. package/dist/types/api/businessLines/useBusinessLines.d.ts +1 -1
  254. package/dist/types/api/companySearch/useCompanySearch.d.ts +6 -293
  255. package/dist/types/api/configurations/useSupportedCountries.d.ts +1 -1
  256. package/dist/types/api/configurations/useTaskTypes.d.ts +1 -1
  257. package/dist/types/api/configurations/useVersionConfiguration.d.ts +2 -2
  258. package/dist/types/api/datasets/useLegalForms.d.ts +1 -1
  259. package/dist/types/api/datasets/useNaceCodes.d.ts +1 -1
  260. package/dist/types/api/datasets/useSourceOfFundsTypes.d.ts +1 -1
  261. package/dist/types/api/documents/useDocument.d.ts +1 -1
  262. package/dist/types/api/documents/useDocuments.d.ts +2 -2
  263. package/dist/types/api/idNowProvider/useIdNowProvider.d.ts +3 -3
  264. package/dist/types/api/idVerificationProviders/useIdVerificationToken.d.ts +2 -2
  265. package/dist/types/api/industryCodes/useIndustryCodes.d.ts +1 -1
  266. package/dist/types/api/invitations/useInvitationStatus.d.ts +1 -1
  267. package/dist/types/api/invitedEntity/useInvitedEntityAssociationData.d.ts +2 -2
  268. package/dist/types/api/invitedEntity/useInvitedEntityRootCapabilities.d.ts +2 -2
  269. package/dist/types/api/invitedEntity/useInvitedEntityVerificationErrors.d.ts +2 -2
  270. package/dist/types/api/legalEntity/useLegalEntity.d.ts +9 -9
  271. package/dist/types/api/onboardingStatus/useOnboardingStatus.d.ts +1 -1
  272. package/dist/types/api/openId/useOpenIdAuthorizationLink.d.ts +1 -1
  273. package/dist/types/api/pci/usePciQuestionnaireList.d.ts +2 -2
  274. package/dist/types/api/pci/usePciStatus.d.ts +2 -2
  275. package/dist/types/api/pci/usePciTemplate.d.ts +2 -2
  276. package/dist/types/api/providersConfiguration/useProviderStatus.d.ts +1 -1
  277. package/dist/types/api/taskStatus/useTaskStatus.d.ts +2 -2
  278. package/dist/types/api/taskStatus/useTaskStatuses.d.ts +2 -2
  279. package/dist/types/api/taxClassification/useTaxClassification.d.ts +2 -2
  280. package/dist/types/api/termsOfService/useAcceptedTermsOfService.d.ts +2 -2
  281. package/dist/types/api/termsOfService/useTermsOfService.d.ts +2 -2
  282. package/dist/types/api/termsOfService/useTermsOfServiceAcceptanceInfos.d.ts +1 -1
  283. package/dist/types/api/termsOfService/useTermsOfServiceStatus.d.ts +2 -2
  284. package/dist/types/api/tinVerification/useVerifyTin.d.ts +5 -245
  285. package/dist/types/api/toggles/useToggles.d.ts +1 -1
  286. package/dist/types/api/transferInstruments/useBankVerificationProviders.d.ts +1 -1
  287. package/dist/types/api/transferInstruments/useTransferInstrument.d.ts +1 -1
  288. package/dist/types/api/transferInstruments/useTransferInstruments.d.ts +1 -1
  289. package/dist/types/api/uiAnalytics/useAnalyticsSession.d.ts +2 -2
  290. package/dist/types/api/validation/useValidatePhoneNumber.d.ts +2 -2
  291. package/dist/types/components/BankAccount/mapping/mapPayoutAccountSchemaToApiBankAccount.d.ts +3 -2
  292. package/dist/types/components/BankAccount/mapping/mapPayoutDetailsToTransferInstrument.d.ts +3 -2
  293. package/dist/types/components/Business/forms/rules.d.ts +3 -1
  294. package/dist/types/components/EFP/tasks/BusinessFinancingDropin/BusinessFinancingSummary.d.ts +3 -2
  295. package/dist/types/components/GlobalEntry/hooks/usePrefetchCompanySearch.d.ts +11 -0
  296. package/dist/types/components/GlobalEntry/rules.d.ts +1 -1
  297. package/dist/types/components/GlobalEntry/utils/submitGlobalEntry.d.ts +3 -1
  298. package/dist/types/components/Individual/forms/BasicDetails/validate.d.ts +3 -1
  299. package/dist/types/components/Individual/forms/Individual.rules.d.ts +4 -2
  300. package/dist/types/components/Shared/NewSummary/NewSummary.d.ts +7 -6
  301. package/dist/types/components/Shared/SummarySection/SummarySection.d.ts +12 -4
  302. package/dist/types/components/Shared/fields/LocalizedNameFields/validate.d.ts +2 -2
  303. package/dist/types/components/Shared/fields/RegistrationAndOperationalAddressFields/utils.d.ts +1 -1
  304. package/dist/types/components/Shared/fields/TaxInformationField/taxIdNumberTypes.d.ts +1 -1
  305. package/dist/types/components/Shared/forms/Address/localized/jp/jpAddressSchema.d.ts +11 -1
  306. package/dist/types/components/ui/atoms/Typography/Typography.types.d.ts +1 -1
  307. package/dist/types/context/SettingsContext/types.d.ts +8 -0
  308. package/dist/types/context/ToggleContext/types.d.ts +3 -13
  309. package/dist/types/utils/japanSupportUtils.d.ts +2 -2
  310. package/dist/types/utils/validatorUtils.d.ts +2 -0
  311. package/dist/{types-D6p5FQF-.js → types-BymnGWO9.js} +1 -1
  312. package/dist/{types-B9zXzag-.js → types-qahGXhtr.js} +1 -1
  313. package/dist/{upload-C5NC1E4N.js → upload-BI7LKlDm.js} +2 -2
  314. package/dist/{useAdaptiveWorkflow-DsQESk9f.js → useAdaptiveWorkflow-B35cXauP.js} +1 -1
  315. package/dist/{useBusinessDetailsData-BDcLKqSN.js → useBusinessDetailsData-D1DJeC90.js} +125 -149
  316. package/dist/{useBusinessLines-BhSN6qCH.js → useBusinessLines-0FcuDMzo.js} +1 -1
  317. package/dist/{useCanSeeIntroduction-BLGY7sE-.js → useCanSeeIntroduction-CvLOidr8.js} +5 -5
  318. package/dist/{useDataMissingRemediations-ttUrk09_.js → useDataMissingRemediations-DKjYzfe2.js} +3 -3
  319. package/dist/{useForm-BFeaSvlP.js → useForm-B5MdX_HU.js} +6 -6
  320. package/dist/{useHideTaskStepper-C_w6iUY-.js → useHideTaskStepper-BgCN--mG.js} +1 -1
  321. package/dist/{invalidateRootLegalEntity-B97dCa-s.js → useId-DbtfzzaE.js} +32 -4
  322. package/dist/{useIndustryCodes-uAj90IyS.js → useIndustryCodes-La1cU8oH.js} +1 -1
  323. package/dist/{useLegalEntity-QQXN6YOm.js → useLegalEntity-CxeMoCm4.js} +4 -3
  324. package/dist/{useNavigate-BdAQG04P.js → useNavigate-uuRpGZuZ.js} +33 -33
  325. package/dist/{useOnboardingStatus-CsGUjkm-.js → useOnboardingStatus-CX8IrDe_.js} +1 -1
  326. package/dist/{usePciQuestionnaireList-CFNJD8pS.js → usePciQuestionnaireList-CB_tjNsz.js} +1 -1
  327. package/dist/{useSalesChannels-huIL6Dhk.js → useSalesChannels-XZRfoa6v.js} +5 -5
  328. package/dist/{useScenarios-DV2TeNvN.js → useScenarios-DfE71fl7.js} +7 -6
  329. package/dist/{useSettingsContext-9O3Aqpfq.js → useSettingsContext-Bpf4UqRT.js} +6 -3
  330. package/dist/{useTaskLandedEvent-DwZHcMEQ.js → useTaskLandedEvent-DzsLZguJ.js} +2 -2
  331. package/dist/{useTaskStatus-CgrhdaE_.js → useTaskStatus-4nAPf_uD.js} +1 -1
  332. package/dist/{useTermsOfServiceStatus-DbJDklA2.js → useTermsOfServiceStatus-FDpSDjco.js} +1 -1
  333. package/dist/{useTrustMembers-uhgi2qfN.js → useTrustMembers-xuXOS0a8.js} +9 -8
  334. package/dist/{useUnincorporatedPartnershipMembers-DVEWj1is.js → useUnincorporatedPartnershipMembers-DcfQJdVZ.js} +5 -5
  335. package/dist/{useUpdateBusinessLines-DCKYTzxd.js → useUpdateBusinessLines-B-pF2YT-.js} +1 -1
  336. package/dist/utils-BD22komZ.js +214 -0
  337. package/dist/{utils-SKYT7xU4.js → utils-BFxg3gPM.js} +2 -2
  338. package/dist/{utils-D8pwjFm5.js → utils-CtCqc_ym.js} +5 -6
  339. package/dist/{validate-BBVJuFm5.js → validate-83HsNk18.js} +15 -17
  340. package/dist/{validate-t6pT7AaZ.js → validate-DNq64o-B.js} +3 -3
  341. package/dist/{validate-Bkpa-y5Q.js → validate-mbqt6wsS.js} +7 -7
  342. package/dist/{validate-Dmdw3pYn.js → validate-r2j-Yc-q.js} +2 -2
  343. package/dist/{validateExtractionResult-qkFkcrwl.js → validateExtractionResult-IRRMwcNi.js} +5 -7
  344. package/dist/{warning-circle-fill-C2lMYPJW.js → warning-circle-fill-ClFvGo5m.js} +2 -2
  345. package/dist/{warning-diamond-filled-CQ2DdW5g.js → warning-diamond-filled-CWyKR65i.js} +2 -2
  346. package/dist/{webinar-BpZWqd-g.js → webinar-DWX7Z5Wz.js} +2 -2
  347. package/package.json +36 -36
  348. package/dist/AdaptiveWorkflow-2EE8iiMD.js +0 -33
  349. package/dist/Alert-BqbbDRYR.js +0 -172
  350. package/dist/AnalyticsContext-CpimDlw4.js +0 -21
  351. package/dist/Checkbox-qfdF12cF.js +0 -60
  352. package/dist/Confirm-DjFpxSzC.js +0 -77
  353. package/dist/CountryField-CMOB4yz4.js +0 -38
  354. package/dist/DataConflictsModal-8Nnj7_UD.js +0 -238
  355. package/dist/Field-Df7ajJE2.js +0 -154
  356. package/dist/FormFlow.module-DqMxjYHl.js +0 -20
  357. package/dist/Header-DvifUz7-.js +0 -93
  358. package/dist/Icon-DFQgr7dy.js +0 -175
  359. package/dist/LandingLayout-BsIoIFzs.js +0 -76
  360. package/dist/LegalName-BYQ12uWc.js +0 -33
  361. package/dist/LoaderWrapper-Dc88hY-P.js +0 -34
  362. package/dist/MaskedInput-CkDwzLxe.js +0 -719
  363. package/dist/MaybeModal-Dfm1rIUG.js +0 -24
  364. package/dist/NewSummary-DYLlnpwx.js +0 -73
  365. package/dist/ProgressBar-DWFxLMUA.js +0 -38
  366. package/dist/RadioGroup-CY33MT83.js +0 -47
  367. package/dist/RadioWithLabel-BmUFWDxq.js +0 -45
  368. package/dist/SettingsContext-Dl-9WWCI.js +0 -9
  369. package/dist/StateContext-B2_Pqd_y.js +0 -9
  370. package/dist/StateField-BiNI3dm9.js +0 -55
  371. package/dist/StructuredList-BHUmeWeh.js +0 -56
  372. package/dist/Summary-BTDbRMfh.js +0 -235
  373. package/dist/TaxInformationField--Uhp0zLv.js +0 -242
  374. package/dist/TileGroup-BFcSgQ1l.js +0 -172
  375. package/dist/ToastContext-B_wd2IY2.js +0 -13
  376. package/dist/ToastContextProvider-BSQ1Upl_.js +0 -103
  377. package/dist/VerificationErrorAlert-B6HmAZ0g.js +0 -38
  378. package/dist/_rolldown_dynamic_import_helper-sGNwd-kR.js +0 -14
  379. package/dist/bafinUtils-RXELXyTR.js +0 -96
  380. package/dist/bg-BG-DfbtcqF4.js +0 -7
  381. package/dist/birthDateUtils-D6uk7zwm.js +0 -84
  382. package/dist/businessRegistrationNumberPatterns-pbrCVTTp.js +0 -982
  383. package/dist/cross-circle-fill-small-DdoPZZeo.js +0 -20
  384. package/dist/cs-CZ-CajuRLo4.js +0 -7
  385. package/dist/da-DK-BEwmSejn.js +0 -7
  386. package/dist/datasetUtil-BdHPWsxZ.js +0 -45
  387. package/dist/de-DE-PyK3jl-6.js +0 -7
  388. package/dist/debouncedInputEvent-Fwwp_K_-.js +0 -54
  389. package/dist/debugStore-Dwn1FXrh.js +0 -9
  390. package/dist/dropinUtils-OsMsnnYG.js +0 -496
  391. package/dist/el-GR-KPFghikv.js +0 -7
  392. package/dist/es-ES-z4jLCvkJ.js +0 -7
  393. package/dist/es-LA-Dx4QymCh.js +0 -7
  394. package/dist/et-EE-1EhDxtTe.js +0 -7
  395. package/dist/fi-FI-Dc2RMc_u.js +0 -7
  396. package/dist/fieldConfigurations-CZCFghnK.js +0 -11
  397. package/dist/formFieldsUtils-CnDkgahc.js +0 -7
  398. package/dist/formUtils-BHgG8yQZ.js +0 -52
  399. package/dist/formUtils-DAKrWwgL.js +0 -84
  400. package/dist/fr-FR-DswL4wQ1.js +0 -7
  401. package/dist/getFormSlice-C1ma6Xd4.js +0 -21
  402. package/dist/getTrustedFields-BJ88GlM-.js +0 -28
  403. package/dist/globalStore--_np-9ON.js +0 -418
  404. package/dist/hr-HR-DI2D_V50.js +0 -7
  405. package/dist/hu-HU-lyRcZjGI.js +0 -7
  406. package/dist/isEmpty-Uewyl-r6.js +0 -14
  407. package/dist/isEmptyEntity-3OHnhXqG.js +0 -43
  408. package/dist/it-IT-Bn4CEcmI.js +0 -7
  409. package/dist/ja-JP-CAX_xwUx.js +0 -7
  410. package/dist/keys-Ce8YnRP2.js +0 -20
  411. package/dist/listToRecord-DumSkYDz.js +0 -10
  412. package/dist/lt-LT-BdgYuJW7.js +0 -7
  413. package/dist/lv-LV-Bz5c0Psg.js +0 -7
  414. package/dist/mapScriptLocalization-BCfkZo1y.js +0 -46
  415. package/dist/nl-NL-BE2cQh0x.js +0 -7
  416. package/dist/no-NO-vgzpp44v.js +0 -7
  417. package/dist/patternValidators-DsrZkuOO.js +0 -73
  418. package/dist/pl-PL-DgDSRVmp.js +0 -7
  419. package/dist/pt-BR-BaKp-J8F.js +0 -7
  420. package/dist/pt-PT-Df48oeP5.js +0 -7
  421. package/dist/resolveEnvironment-Tnw3ytcJ.js +0 -999
  422. package/dist/ro-RO-CTMsv_EY.js +0 -7
  423. package/dist/roleMetadata-CbgaYaH8.js +0 -56
  424. package/dist/sk-SK-oqO5I3Aw.js +0 -7
  425. package/dist/sl-SI-CQhJFnpj.js +0 -7
  426. package/dist/summaryItem-uDWmtYtt.js +0 -16
  427. package/dist/sv-SE-CmevESLi.js +0 -7
  428. package/dist/toFullWidth-Dgy4X4i8.js +0 -52
  429. package/dist/trustUtil-BG17fZ56.js +0 -98
  430. package/dist/types/adaptiveWorkflow/components/Fields/LegalName.d.ts +0 -14
  431. package/dist/types-B28r2lAW.js +0 -30
  432. package/dist/types-CZAHRt31.js +0 -147
  433. package/dist/useAccountHolder-BpIX1iBG.js +0 -102
  434. package/dist/useAllowedCountries-qyvo-c6A.js +0 -80
  435. package/dist/useAnalyticsContext-gSnRnYgV.js +0 -12
  436. package/dist/useCreateLegalEntity-CYZd_62a.js +0 -24
  437. package/dist/useDataset-K19TDoyR.js +0 -98
  438. package/dist/useDeleteTransferInstrument-C10xzHiO.js +0 -31
  439. package/dist/useId-BkDhUta2.js +0 -28
  440. package/dist/useMultiForm-CM3lpilP.js +0 -790
  441. package/dist/useToastContext-B6Mqc2HY.js +0 -12
  442. package/dist/useToggleContext-B_YexrbT.js +0 -21
  443. package/dist/useUpdateLegalEntity-B7LRg8m0.js +0 -29
  444. package/dist/utils-BLBh0VEd.js +0 -1755
  445. package/dist/utils-CYUYe54m.js +0 -24
  446. package/dist/utils-DdHbAadK.js +0 -80
  447. package/dist/validationError-DUn2rT0n.js +0 -55
  448. package/dist/validationResult-bjYBDjbU.js +0 -29
  449. package/dist/validatorUtils-D2O6AAZn.js +0 -106
  450. /package/dist/{pt-BR-CPbFPNwq2.js → pt-BR-CPbFPNwq.js} +0 -0
@@ -1,790 +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] = "02353ddf-d3cc-4d6e-9165-dfef199ddbb3", e._sentryDebugIdIdentifier = "sentry-dbid-02353ddf-d3cc-4d6e-9165-dfef199ddbb3");
4
- } catch (e) {}
5
- import { t as createLogger } from "./logger-Z8AeTE4x.js";
6
- import { a as objectsDeepEqual } from "./genUtils-nphCwt1A.js";
7
- import { y as isEmpty } from "./validatorUtils-D2O6AAZn.js";
8
- import { r as omitKeys, t as addKeys } from "./formUtils-BHgG8yQZ.js";
9
- import { t as ValidationResult } from "./validationResult-bjYBDjbU.js";
10
- import { useCallback, useEffect, useMemo, useReducer } from "preact/hooks";
11
- //#region src/hooks/useMultiForm/reducer.ts
12
- /** Checks if a field key exists on the nested data object (even if its value is undefined) */
13
- var hasOwnNestedField = (data, formName, fieldKey) => {
14
- const form = data?.[formName];
15
- return form != null && typeof form === "object" && Object.hasOwn(form, fieldKey);
16
- };
17
- var hasValueChanged = (newData, prevData) => {
18
- if (typeof newData === "object") return !objectsDeepEqual(newData, prevData);
19
- return newData !== prevData;
20
- };
21
- /** Formats and validates a field */
22
- var processField = ({ key, value, formName, mode, defaultData, data, fieldContext, formatters, staticValidate }) => {
23
- const formatterFn = formatters?.[key]?.formatter ? formatters[key]?.formatter : formatters?.[key];
24
- const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
25
- const fieldHasDefaultValue = key in (defaultData ?? {});
26
- const fieldHasChanged = defaultData?.[key] !== value;
27
- const validationResult = (fieldContext.state.obscuredFields?.includes(key) ? fieldHasChanged : fieldHasChanged || fieldHasDefaultValue) ? staticValidate({
28
- key,
29
- value: formattedValue,
30
- mode,
31
- formName
32
- }, data, fieldContext) : new ValidationResult([{
33
- isValid: true,
34
- hasError: false
35
- }]);
36
- const asyncValidationResult = fieldContext.state?.asyncErrors?.[key];
37
- /** Add any existing async validation result to validation result */
38
- if (asyncValidationResult) validationResult.addError(asyncValidationResult);
39
- return [formattedValue, validationResult];
40
- };
41
- /**
42
- * The function takes in the below params and spits out an initial state, by running the validations
43
- * across all forms and fields. It makes sure all validations are done and only sets the validity
44
- * instead of the errors, this is to avoid users seeing error immaturely on initial load.
45
- *
46
- * @param requiredFields
47
- * @param staticValidate
48
- * @param asyncValidate
49
- * @param defaultData
50
- * @param obscuredFields
51
- * @param optionalFields
52
- * @param trustedFields
53
- * @param fieldProblems
54
- * @param formatters
55
- * @param data
56
- */
57
- function init({ requiredFields, staticValidate, defaultData, obscuredFields, optionalFields, trustedFields, fieldProblems, formatters, data, asyncErrors }) {
58
- /**
59
- * Fetches the validation result of a field in a form
60
- * @param fieldKey
61
- * @param formName
62
- */
63
- const getProcessedState = (fieldKey, formName) => {
64
- const [formattedValue, validationResult] = processField({
65
- key: fieldKey,
66
- value: hasOwnNestedField(data, formName, fieldKey) ? data?.[formName]?.[fieldKey] ?? null : defaultData?.[formName]?.[fieldKey] ?? null,
67
- mode: "blur",
68
- formName,
69
- formatters: formatters?.[formName],
70
- defaultData: defaultData?.[formName],
71
- data,
72
- fieldContext: { state: {
73
- data: data?.[formName],
74
- obscuredFields: obscuredFields?.[formName],
75
- optionalFields: optionalFields?.[formName],
76
- trustedFields: trustedFields?.[formName],
77
- requiredFields: requiredFields?.[formName],
78
- asyncErrors: asyncErrors?.[formName]
79
- } },
80
- staticValidate
81
- });
82
- return {
83
- valid: validationResult.isValid && !fieldProblems?.[formName]?.[fieldKey] || false,
84
- errors: null,
85
- data: formattedValue,
86
- fieldProblems: fieldProblems?.[formName]?.[fieldKey]
87
- };
88
- };
89
- /**
90
- * requiredFields can be undefined if the configuration api call is not yet completed
91
- * returned default state in this case
92
- */
93
- if (!requiredFields) return {
94
- data: defaultData,
95
- errors: {},
96
- fieldProblems: {},
97
- valid: {},
98
- requiredFields: {},
99
- asyncErrors: {},
100
- defaultData
101
- };
102
- /**
103
- * Make sure forms containing only optional fields are also taken into account
104
- */
105
- const formsForOptionalFields = Object.keys(optionalFields ?? {});
106
- const formsForRequiredFields = Object.keys(requiredFields);
107
- /**
108
- * Visits every field and builds a state with the validity
109
- */
110
- return Array.from(/* @__PURE__ */ new Set([...formsForOptionalFields, ...formsForRequiredFields])).reduce((acc, formName) => {
111
- const form = formName;
112
- const optionalsFormFields = optionalFields?.[form] ?? [];
113
- const requiredFormFields = requiredFields?.[form] ?? [];
114
- const formState = [...optionalsFormFields, ...requiredFormFields].reduce((acc, field) => {
115
- const { valid, errors, data, fieldProblems: processedFieldProblems } = getProcessedState(field, form);
116
- return {
117
- ...acc,
118
- data: {
119
- ...acc.data,
120
- [field]: data
121
- },
122
- valid: {
123
- ...acc.valid,
124
- [field]: valid
125
- },
126
- errors: {
127
- ...acc.errors,
128
- [field]: errors
129
- },
130
- fieldProblems: {
131
- ...acc.fieldProblems,
132
- ...processedFieldProblems ? { [field]: processedFieldProblems } : {}
133
- }
134
- };
135
- }, {});
136
- return {
137
- requiredFields,
138
- data: {
139
- ...acc.data,
140
- [formName]: formState.data
141
- },
142
- valid: {
143
- ...acc.valid,
144
- [formName]: formState.valid
145
- },
146
- errors: {
147
- ...acc.errors,
148
- [formName]: formState.errors
149
- },
150
- fieldProblems: {
151
- ...acc.fieldProblems,
152
- [formName]: formState.fieldProblems
153
- },
154
- asyncErrors: { ...acc.asyncErrors },
155
- obscuredFields,
156
- optionalFields,
157
- trustedFields,
158
- defaultData
159
- };
160
- }, {
161
- requiredFields,
162
- data: {},
163
- valid: {},
164
- errors: {},
165
- fieldProblems: {},
166
- obscuredFields,
167
- optionalFields,
168
- trustedFields,
169
- asyncErrors: {}
170
- });
171
- }
172
- function reducer({ staticValidate, obscuredFields, optionalFields, trustedFields, formatters, defaultData }) {
173
- return (state, { type, key, mode, value, formData, formName, selectedSchema, innerFormFields, requiredFields, optionalFields: newOptionalFields, asyncValidationResults }) => {
174
- const clonedState = structuredClone(state);
175
- switch (type) {
176
- case "setData":
177
- if (!key || !formName) return state;
178
- clonedState.data[formName] ??= {};
179
- clonedState.data[formName][key] = value;
180
- return clonedState;
181
- case "setFormData": {
182
- if (!formName || !formData) return state;
183
- const formRequiredFields = clonedState.requiredFields?.[formName] ?? [];
184
- const formOptionalFields = clonedState.optionalFields?.[formName] ?? [];
185
- const allowedFields = [...formRequiredFields, ...formOptionalFields];
186
- const filteredUpdates = {};
187
- for (const formDataKey in formData) if (allowedFields.includes(formDataKey)) filteredUpdates[formDataKey] = formData[formDataKey];
188
- clonedState.data[formName] = filteredUpdates;
189
- const formValidity = allowedFields.reduce((acc, field) => {
190
- const [, validation] = processField({
191
- key: field,
192
- value: filteredUpdates[field],
193
- mode: "blur",
194
- formName,
195
- defaultData: defaultData?.[formName],
196
- data: clonedState.data,
197
- formatters: formatters?.[formName],
198
- fieldContext: { state: {
199
- data: clonedState?.data?.[formName],
200
- obscuredFields: obscuredFields?.[formName],
201
- optionalFields: optionalFields?.[formName],
202
- trustedFields: trustedFields?.[formName],
203
- errors: clonedState.errors?.[formName],
204
- valid: clonedState.valid?.[formName],
205
- fieldProblems: clonedState.fieldProblems?.[formName],
206
- asyncErrors: clonedState.asyncErrors?.[formName]
207
- } },
208
- staticValidate
209
- });
210
- return {
211
- ...acc,
212
- [field]: validation.isValid
213
- };
214
- }, {});
215
- clonedState.data[formName] = filteredUpdates;
216
- clonedState.valid[formName] = formValidity;
217
- return clonedState;
218
- }
219
- case "setValid":
220
- if (!key || !formName || clonedState.valid[formName]?.[key] === value) return state;
221
- clonedState.valid[formName] ??= {};
222
- clonedState.valid[formName][key] = !!value;
223
- return clonedState;
224
- case "setErrors":
225
- if (!key || !formName) return state;
226
- clonedState.errors[formName] ??= {};
227
- clonedState.errors[formName][key] = value;
228
- return clonedState;
229
- case "setRequiredFields": {
230
- /**
231
- * If defaultData changes reset the data in the form to new defaultData
232
- * Fetching documents are bit delayed, this accomodates that delay
233
- */
234
- const hasDefaultDataChanged = !objectsDeepEqual(defaultData, state.defaultData);
235
- if (objectsDeepEqual(requiredFields, clonedState.requiredFields) && objectsDeepEqual(newOptionalFields, clonedState.optionalFields) && !hasDefaultDataChanged) return state;
236
- const updatedData = hasDefaultDataChanged ? defaultData : structuredClone(clonedState.data);
237
- /**
238
- * When schema changes without a defaultData refresh, re-add any fields that were
239
- * previously removed and are now reintroduced from the local stash.
240
- *
241
- * This preserves user-entered values across dynamic required/optional transitions,
242
- * such as when rule-driven fields are temporarily hidden and then shown again.
243
- */
244
- if (!hasDefaultDataChanged && updatedData) for (const formName in requiredFields) {
245
- const form = formName;
246
- const prevFields = [...clonedState.requiredFields?.[form] ?? [], ...clonedState.optionalFields?.[form] ?? []];
247
- [...requiredFields?.[form] ?? [], ...newOptionalFields?.[form] ?? []].filter((field) => !prevFields.includes(field)).forEach((field) => {
248
- const currentValue = updatedData?.[form]?.[field];
249
- const localValue = clonedState.local?.[form]?.data?.[field];
250
- if (typeof currentValue === "undefined" && typeof localValue !== "undefined") {
251
- if (!updatedData[form]) return;
252
- updatedData[form][field] = localValue;
253
- }
254
- });
255
- }
256
- const newState = init({
257
- requiredFields,
258
- data: updatedData,
259
- fieldProblems: clonedState.fieldProblems,
260
- obscuredFields,
261
- optionalFields: newOptionalFields,
262
- trustedFields,
263
- staticValidate,
264
- defaultData
265
- });
266
- if (hasDefaultDataChanged) return newState;
267
- /**
268
- * Persist values of fields that are being removed from the active schema into local.
269
- *
270
- * These values are later used to restore data for reintroduced fields in subsequent
271
- * schema transitions, avoiding silent data loss during dynamic form updates.
272
- */
273
- const local = Object.keys(requiredFields ?? {}).reduce((acc, formName) => {
274
- const form = formName;
275
- const prevFields = [...clonedState.requiredFields?.[form] ?? [], ...clonedState.optionalFields?.[form] ?? []];
276
- const nextFields = [...requiredFields?.[form] ?? [], ...newOptionalFields?.[form] ?? []];
277
- const removedFields = prevFields.filter((field) => !nextFields.includes(field));
278
- if (!removedFields.length) {
279
- if (clonedState.local?.[form]) return {
280
- ...acc,
281
- [form]: clonedState.local[form]
282
- };
283
- return acc;
284
- }
285
- const localFormData = {
286
- ...clonedState.local?.[form]?.data ?? {},
287
- ...removedFields.reduce((fieldAcc, field) => {
288
- const value = clonedState.data?.[form]?.[field];
289
- if (typeof value !== "undefined") return {
290
- ...fieldAcc,
291
- [field]: value
292
- };
293
- return fieldAcc;
294
- }, {})
295
- };
296
- return {
297
- ...acc,
298
- [form]: {
299
- ...clonedState.local?.[form] ?? {},
300
- data: localFormData
301
- }
302
- };
303
- }, {});
304
- return {
305
- ...newState,
306
- local
307
- };
308
- }
309
- case "setInnerFormRequiredFields": {
310
- /**
311
- * This sets the requiredFields in a single form.
312
- * Ideally this should not be used anywhere, as this goes against the idea of having all
313
- * the rules of calculating requiredFields in a single place. keeping this in case we have
314
- * any exceptional scenarios where this would be required. Can be removed once all forms
315
- * migrated to useMultiform
316
- */
317
- if (!innerFormFields || !formName) return state;
318
- const requiredFields = {
319
- ...clonedState.requiredFields,
320
- [formName]: innerFormFields
321
- };
322
- const defaultState = init({
323
- requiredFields,
324
- defaultData,
325
- fieldProblems: clonedState.fieldProblems,
326
- obscuredFields,
327
- optionalFields,
328
- trustedFields,
329
- staticValidate,
330
- data: defaultData
331
- });
332
- 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));
333
- 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));
334
- const formLocal = {
335
- data: omitKeys(clonedState.data?.[formName], newFields),
336
- errors: omitKeys(clonedState.errors?.[formName], newFields),
337
- valid: omitKeys(clonedState.valid?.[formName], newFields),
338
- fieldProblems: omitKeys(clonedState.fieldProblems?.[formName], newFields)
339
- };
340
- const local = {
341
- ...clonedState.local,
342
- [formName]: formLocal
343
- };
344
- const updatedFormData = addKeys(omitKeys(clonedState.data?.[formName], removedFields), newFields, null, defaultState.data?.[formName], clonedState.local?.[formName].data);
345
- const updatedData = {
346
- ...clonedState.data,
347
- [formName]: updatedFormData
348
- };
349
- const updatedFormValidity = addKeys(omitKeys(clonedState.valid?.[formName], removedFields), newFields, false, defaultState.valid?.[formName], clonedState.local?.[formName].valid);
350
- const updatedValidity = {
351
- ...clonedState.valid,
352
- [formName]: updatedFormValidity
353
- };
354
- const updatedFormErrors = addKeys(omitKeys(clonedState.errors?.[formName], removedFields), newFields, null, defaultState.errors?.[formName], clonedState.local?.[formName].errors);
355
- const updatedErrors = {
356
- ...clonedState.errors,
357
- [formName]: updatedFormErrors
358
- };
359
- const updatedFormFieldProblems = addKeys(omitKeys(clonedState.fieldProblems?.[formName], removedFields), newFields, false, defaultState.fieldProblems?.[formName], clonedState.local?.[formName].fieldProblems);
360
- return {
361
- requiredFields,
362
- data: updatedData,
363
- valid: updatedValidity,
364
- errors: updatedErrors,
365
- fieldProblems: {
366
- ...clonedState.fieldProblems,
367
- [formName]: updatedFormFieldProblems
368
- },
369
- asyncErrors: clonedState.asyncErrors,
370
- optionalFields,
371
- trustedFields,
372
- local,
373
- defaultData
374
- };
375
- }
376
- case "updateField": {
377
- /**
378
- * Called when a field value changes in form
379
- * Validates the field and updates data, validity, error in the state for the field
380
- */
381
- if (!key || !mode || !formName) return state;
382
- const updatedData = {
383
- ...clonedState.data,
384
- [formName]: {
385
- ...clonedState.data?.[formName],
386
- [key]: value
387
- }
388
- };
389
- /**
390
- * Wipe async errors for the field if value has been changed
391
- */
392
- const updatedAsyncErrors = hasValueChanged(value, clonedState.data?.[formName]?.[key]) ? {
393
- ...clonedState.asyncErrors,
394
- [formName]: {
395
- ...clonedState.asyncErrors?.[formName],
396
- [key]: null
397
- }
398
- } : clonedState.asyncErrors;
399
- const [formattedValue, validation] = processField({
400
- key,
401
- value,
402
- mode,
403
- formName,
404
- defaultData: defaultData?.[formName],
405
- data: updatedData,
406
- formatters: formatters?.[formName],
407
- fieldContext: { state: {
408
- data: clonedState.data?.[formName],
409
- obscuredFields: obscuredFields?.[formName],
410
- optionalFields: optionalFields?.[formName],
411
- trustedFields: trustedFields?.[formName],
412
- errors: clonedState.errors[formName],
413
- valid: clonedState.valid[formName],
414
- fieldProblems: clonedState.fieldProblems[formName],
415
- asyncErrors: updatedAsyncErrors[formName]
416
- } },
417
- staticValidate
418
- });
419
- const clearFieldProblems = (clonedState.data?.[formName])?.[key] !== formattedValue;
420
- return {
421
- ...clonedState,
422
- data: {
423
- ...clonedState.data,
424
- [formName]: {
425
- ...clonedState.data?.[formName],
426
- [key]: formattedValue
427
- }
428
- },
429
- asyncErrors: updatedAsyncErrors,
430
- errors: {
431
- ...clonedState.errors,
432
- [formName]: {
433
- ...clonedState.errors[formName],
434
- [key]: validation.getError() ?? null
435
- }
436
- },
437
- valid: {
438
- ...clonedState.valid,
439
- [formName]: {
440
- ...clonedState?.valid?.[formName],
441
- [key]: (validation.isValid && !clonedState.fieldProblems?.[formName]?.[key]) ?? false
442
- }
443
- },
444
- fieldProblems: {
445
- ...clonedState.fieldProblems,
446
- [formName]: {
447
- ...clonedState.fieldProblems[formName],
448
- ...!clearFieldProblems && clonedState.fieldProblems?.[formName]?.[key] ? { [key]: true } : {}
449
- }
450
- }
451
- };
452
- }
453
- case "validateForm": {
454
- /**
455
- * Called when triggerValidation('formName') is called, validates all the fields in the form
456
- * and populates the errors in the state
457
- */
458
- if (!formName) return state;
459
- const formFields = clonedState.requiredFields?.[formName];
460
- if (!formFields) return state;
461
- const formState = (selectedSchema || formFields).reduce((acc, field) => {
462
- const formData = clonedState.data?.[formName];
463
- const [formattedValue, validation] = processField({
464
- key: field,
465
- mode: "blur",
466
- value: formData?.[field] ?? null,
467
- formName,
468
- defaultData: defaultData?.[formName],
469
- data: clonedState.data,
470
- formatters: formatters?.[formName],
471
- fieldContext: { state: {
472
- data: clonedState.data?.[formName],
473
- obscuredFields: obscuredFields?.[formName],
474
- optionalFields: optionalFields?.[formName],
475
- trustedFields: trustedFields?.[formName],
476
- errors: clonedState.errors[formName],
477
- valid: clonedState.valid[formName],
478
- fieldProblems: clonedState.fieldProblems[formName],
479
- asyncErrors: clonedState.asyncErrors[formName]
480
- } },
481
- staticValidate
482
- });
483
- const clearFieldProblems = (clonedState?.data?.[formName])?.[field] !== formattedValue;
484
- const fieldAsyncValidationResult = asyncValidationResults?.[field];
485
- return {
486
- data: formData,
487
- asyncErrors: {
488
- ...acc.asyncErrors,
489
- [field]: fieldAsyncValidationResult?.getError() ?? null
490
- },
491
- errors: {
492
- ...acc.errors,
493
- [field]: validation.getError() ?? fieldAsyncValidationResult?.getError() ?? null
494
- },
495
- valid: {
496
- ...acc.valid,
497
- [field]: validation.isValid && (fieldAsyncValidationResult?.isValid ?? true) && !clonedState.fieldProblems[formName][field]
498
- },
499
- fieldProblems: {
500
- ...acc.fieldProblems,
501
- ...!clearFieldProblems && acc.fieldProblems?.[field] ? { [field]: true } : {}
502
- }
503
- };
504
- }, {});
505
- return {
506
- ...clonedState,
507
- errors: {
508
- ...clonedState.errors,
509
- [formName]: formState.errors
510
- },
511
- asyncErrors: {
512
- ...clonedState.asyncErrors,
513
- [formName]: formState.asyncErrors
514
- },
515
- valid: {
516
- ...clonedState.valid,
517
- [formName]: formState.valid
518
- },
519
- fieldProblems: {
520
- ...clonedState.fieldProblems,
521
- [formName]: formState.fieldProblems
522
- }
523
- };
524
- }
525
- default: throw new Error("Undefined useForm action");
526
- }
527
- };
528
- }
529
- //#endregion
530
- //#region src/hooks/useMultiForm/useMultiFormAsyncValidator.ts
531
- var logger = createLogger();
532
- /**
533
- * Returns
534
- * - triggerAsyncValidation function which can execute the async validation for a field and populate the sync validation results
535
- * - asyncValidationResult state which keeps track of async validations of all fields.
536
- * @param asyncRules
537
- */
538
- var useMultiFormAsyncValidator = (asyncRules) => {
539
- const validResult = {
540
- isValid: true,
541
- hasError: false
542
- };
543
- const triggerAsyncValidation = useCallback(async (field, formName, data) => {
544
- if (!asyncRules) return new ValidationResult([validResult]);
545
- const rule = typeof asyncRules === "function" ? asyncRules(data)[formName]?.[field] : asyncRules[formName][field];
546
- const value = data?.[formName]?.[field];
547
- if (!rule || !value) return new ValidationResult([validResult]);
548
- const isValid = await rule.asyncValidate(value).catch(logger.error);
549
- if (isValid === false) return new ValidationResult([{
550
- isValid,
551
- errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value) : rule.errorMessage,
552
- hasError: !isValid
553
- }]);
554
- return new ValidationResult([validResult]);
555
- }, [asyncRules]);
556
- const triggerAsyncFormValidation = async (formName, state, selectedSchema) => {
557
- const fields = selectedSchema ?? state.requiredFields?.[formName];
558
- if (!fields?.length) return { isValid: true };
559
- const asyncValidationResults = await fields.reduce(async (accPromise, fieldName) => {
560
- const acc = await accPromise;
561
- const asyncValidationResult = await triggerAsyncValidation(fieldName, formName, state.data);
562
- return {
563
- ...acc,
564
- [fieldName]: asyncValidationResult
565
- };
566
- }, Promise.resolve({}));
567
- const isValid = Object.values(asyncValidationResults).every((validationResult) => validationResult.isValid);
568
- return {
569
- ...asyncValidationResults,
570
- isValid
571
- };
572
- };
573
- return { triggerAsyncFormValidation };
574
- };
575
- //#endregion
576
- //#region src/utils/validation/commonValidators.ts
577
- var isTruthyValidator = {
578
- validate: (value) => !!value,
579
- modes: ["blur"],
580
- errorMessage: "fieldIsRequired"
581
- };
582
- var isNotEmptyValidator = {
583
- validate: (value) => !isEmpty(value),
584
- modes: ["blur"],
585
- errorMessage: "fieldIsRequired"
586
- };
587
- //#endregion
588
- //#region src/hooks/useMultiForm/useMultiFormStaticValidator.ts
589
- var useMultiFormStaticValidator = (rules) => {
590
- const getRulesForField = useCallback((field, form, data) => {
591
- const fallbackRule = {
592
- validate: () => true,
593
- modes: ["blur", "input"]
594
- };
595
- if (!form) return [fallbackRule];
596
- const fieldRules = typeof rules === "function" ? rules(data)?.[form]?.[field] ?? [fallbackRule] : rules?.[form]?.[field] ?? [fallbackRule];
597
- return Array.isArray(fieldRules) ? fieldRules : [fieldRules];
598
- }, [rules]);
599
- return { triggerStaticValidation: useCallback(({ key, value, mode = "blur", formName }, data, context) => {
600
- const fieldRules = getRulesForField(key, formName, data);
601
- const isFieldOptional = !!context?.state.optionalFields?.includes(key);
602
- const isFieldObscured = !!context?.state.obscuredFields?.includes(key);
603
- if (!isFieldOptional) fieldRules.unshift(isNotEmptyValidator);
604
- return new ValidationResult(fieldRules.map((rule) => {
605
- const shouldValidate = rule.modes.includes(mode) && !isFieldObscured;
606
- const isValid = isFieldOptional && isEmpty(value) ? true : rule.validate(value, context);
607
- return {
608
- isValid,
609
- errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value, context) : rule.errorMessage,
610
- hasError: shouldValidate && !isValid
611
- };
612
- }));
613
- }, [getRulesForField]) };
614
- };
615
- //#endregion
616
- //#region src/hooks/useMultiForm/useMultiForm.ts
617
- function useMultiForm({ defaultData, rules, asyncRules, fieldProblems, allFields, requiredFields, obscuredFields, optionalFields, trustedFields, formatters }) {
618
- const { triggerStaticValidation } = useMultiFormStaticValidator(rules);
619
- const { triggerAsyncFormValidation } = useMultiFormAsyncValidator(asyncRules);
620
- const getRequiredFields = useMemo(() => typeof requiredFields === "function" ? requiredFields : () => requiredFields, [requiredFields]);
621
- const getSchema = useMemo(() => getRequiredFields(defaultData), [defaultData, getRequiredFields]);
622
- const getReducer = useCallback(() => reducer({
623
- staticValidate: triggerStaticValidation,
624
- defaultData,
625
- obscuredFields,
626
- optionalFields,
627
- trustedFields,
628
- formatters
629
- }), [
630
- triggerStaticValidation,
631
- obscuredFields,
632
- optionalFields,
633
- trustedFields,
634
- formatters,
635
- defaultData
636
- ]);
637
- const initialData = useMemo(() => ({
638
- requiredFields: getSchema,
639
- defaultData,
640
- fieldProblems,
641
- obscuredFields,
642
- optionalFields,
643
- trustedFields,
644
- formatters,
645
- staticValidate: triggerStaticValidation,
646
- data: defaultData
647
- }), [
648
- getSchema,
649
- defaultData,
650
- fieldProblems,
651
- obscuredFields,
652
- optionalFields,
653
- trustedFields,
654
- formatters,
655
- triggerStaticValidation
656
- ]);
657
- const [state, dispatch] = useReducer(getReducer(), initialData, init);
658
- const isValid = useMemo(() => {
659
- const formsForOptionalFields = Object.keys(state.optionalFields ?? {});
660
- const formsForRequiredFields = Object.keys(state.requiredFields ?? {});
661
- return Array.from(/* @__PURE__ */ new Set([...formsForOptionalFields, ...formsForRequiredFields])).reduce((acc, formName) => {
662
- const form = formName;
663
- const optionalsFormFields = state.optionalFields?.[form] ?? [];
664
- const requiredFormFields = state.requiredFields?.[form] ?? [];
665
- const formFields = [...optionalsFormFields, ...requiredFormFields];
666
- const formValidity = state.valid[formName] ?? {};
667
- return {
668
- ...acc,
669
- [formName]: Object.entries(formValidity)?.every(([field, valid]) => formFields.includes(field) ? valid : true)
670
- };
671
- }, {});
672
- }, [state.requiredFields, state.valid]);
673
- const getTargetValue = useCallback((formName, key, e) => {
674
- if (!e?.target) return e;
675
- if (e.target.type === "checkbox") return !state.data?.[formName][key];
676
- return e.target.value;
677
- }, [state.data]);
678
- const setErrors = useCallback((formName, key, value) => {
679
- dispatch({
680
- type: "setErrors",
681
- key,
682
- value,
683
- formName
684
- });
685
- }, []);
686
- const setValid = useCallback((formName, key, value) => {
687
- dispatch({
688
- type: "setValid",
689
- key,
690
- value,
691
- formName
692
- });
693
- }, []);
694
- const setData = useCallback((formName, key, value) => {
695
- dispatch({
696
- type: "setData",
697
- key,
698
- value,
699
- formName
700
- });
701
- }, []);
702
- const setFormData = useCallback((formName, formData) => {
703
- dispatch({
704
- type: "setFormData",
705
- formName,
706
- formData
707
- });
708
- }, []);
709
- const handleChangeFor = useCallback((formName, key, mode = "blur") => (e) => {
710
- const value = getTargetValue(formName, key, e);
711
- dispatch({
712
- type: "updateField",
713
- key,
714
- value,
715
- mode,
716
- formName
717
- });
718
- }, [getTargetValue]);
719
- const triggerValidation = useCallback(async (formName, selectedSchema) => {
720
- const asyncValidationResults = await triggerAsyncFormValidation(formName, state, selectedSchema);
721
- dispatch({
722
- type: "validateForm",
723
- formName,
724
- selectedSchema,
725
- asyncValidationResults
726
- });
727
- return asyncValidationResults.isValid;
728
- }, [state, triggerAsyncFormValidation]);
729
- const resetToDefaultData = useCallback(() => {
730
- if (!getSchema) return;
731
- Object.entries(getSchema).forEach(([formName]) => {
732
- const form = formName;
733
- const formData = defaultData?.[form];
734
- getSchema[form].forEach((field) => {
735
- if (!formData || typeof formData[field] !== "undefined") {
736
- handleChangeFor(form, field)(formData);
737
- return;
738
- }
739
- setValid(form, field, false);
740
- setErrors(form, field, null);
741
- setData(form, field, formData[field]);
742
- });
743
- });
744
- }, [
745
- defaultData,
746
- getSchema,
747
- handleChangeFor,
748
- setData,
749
- setErrors,
750
- setValid
751
- ]);
752
- useEffect(() => {
753
- const requiredFields = getRequiredFields(state.data);
754
- if (!requiredFields) return;
755
- dispatch({
756
- type: "setRequiredFields",
757
- requiredFields,
758
- defaultData,
759
- optionalFields
760
- });
761
- }, [
762
- getRequiredFields,
763
- state.data,
764
- defaultData,
765
- optionalFields
766
- ]);
767
- return {
768
- setData,
769
- setFormData,
770
- setValid,
771
- setErrors,
772
- handleChangeFor,
773
- triggerValidation,
774
- resetToDefaultData,
775
- isValid,
776
- allFields,
777
- requiredFields: state.requiredFields,
778
- optionalFields: state.optionalFields,
779
- trustedFields: state.trustedFields,
780
- obscuredFields: state.obscuredFields,
781
- valid: state.valid,
782
- errors: state.errors,
783
- data: state.data,
784
- fieldProblems: state.fieldProblems,
785
- defaultData,
786
- asyncErrors: state.asyncErrors
787
- };
788
- }
789
- //#endregion
790
- export { isNotEmptyValidator as n, isTruthyValidator as r, useMultiForm as t };