@adyen/kyc-components 3.91.0 → 3.92.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.
- package/dist/{4-people-BzyXLUF9.js → 4-people-BtDi7O9A.js} +2 -2
- package/dist/{AcceptTermsOfServiceComponent-Bl8Skw0p.js → AcceptTermsOfServiceComponent-T7eWi57Z.js} +17 -14
- package/dist/{Accordion-BxBwztLx.js → Accordion-Boa_Vira.js} +2 -2
- package/dist/{AccountSetupRejected-DWnI467S.js → AccountSetupRejected-LAVhMMBt.js} +4 -4
- package/dist/{ActionBar-BI8EL50o.js → ActionBar-CK8dwgSJ.js} +1 -1
- package/dist/{Address-BUrDDnmR.js → Address-ki-bCjUJ.js} +23 -289
- package/dist/{Alert-B83aFhFn.js → Alert-TCEgDc2-.js} +3 -3
- package/dist/{Avatar-CWGv3_UH.js → Avatar-AC-D1DKh.js} +2 -2
- package/dist/{BusinessFinancingComponent-Dp9pkrSs.js → BusinessFinancingComponent-Cf-EEnyR.js} +6 -6
- package/dist/{BusinessFinancingDropin-CxDQONVa.js → BusinessFinancingDropin-DeLlYaOF.js} +30 -22
- package/dist/{BusinessFinancingPage-CK4iko3V.js → BusinessFinancingPage-DtX8x3Zp.js} +4 -4
- package/dist/{BusinessTypeSelectionPage-BbCt3hSM.js → BusinessTypeSelectionPage-6Ltt53Mu.js} +58 -33
- package/dist/{Card-CQrP0PXC.js → Card-Det7uTiv.js} +2 -2
- package/dist/{debouncedInputEvent-CFFx_oML.js → Checkbox-D8rB6_HN.js} +3 -38
- package/dist/Confirm-Ctfqp-1b.js +64 -0
- package/dist/ConstitutionalDocument-TJAc9nDQ.js +2358 -0
- package/dist/ContextGuidance-CCknw_Y1.js +34 -0
- package/dist/CountryField-DzmOWqiE.js +66 -0
- package/dist/{CreateIndividualComponent-B6ecxCd8.js → CreateIndividualComponent-_H34wdze.js} +6 -6
- package/dist/{CreateTransferInstrumentComponent-Chqddjgy.js → CreateTransferInstrumentComponent-CmnVEFaB.js} +5 -12
- package/dist/{Currency-CkQVLmOQ.js → Currency-C2egEHMF.js} +64 -8
- package/dist/{CustomerSupport-BDynvVnl.js → CustomerSupport-DLfbNC-J.js} +12 -10
- package/dist/{DebugModal-DAu7rz8a.js → DebugModal-C0uG_A8N.js} +8 -7
- package/dist/{DecisionMakerDetailsPage-BBqNmh_M.js → DecisionMakerDetailsPage-BTR-hRwO.js} +6 -6
- package/dist/{DecisionMakers-Ddvw0N__.js → DecisionMakers-B4qQ3M6Y.js} +27 -21
- package/dist/Dropzone-CKT3THCY.js +218 -0
- package/dist/{EmbeddedStatus-BSK268B-.js → EmbeddedStatus-Bst5MPzi.js} +3 -3
- package/dist/{EndStateLayout-B8KmFejY.js → EndStateLayout-Ck_Lvgng.js} +2 -2
- package/dist/{EntityAssociation-DBPiXzNF.js → EntityAssociation-bcF_I_DK.js} +8 -8
- package/dist/{EntityGuidanceStatus-QEzHcb28.js → EntityGuidanceStatus-D6VoRE_0.js} +4 -3
- package/dist/ErrorPanel-CFN2G9Vz.js +190 -0
- package/dist/Field-B3Vy1-QZ.js +142 -0
- package/dist/{FormNavigation-DLJbUsy3.js → FormNavigation-Brw-75s0.js} +3 -3
- package/dist/{FormWrapper-41qnDF4W.js → FormWrapper-BcNyCMkD.js} +10 -10
- package/dist/Header-YafgG5Nz.js +83 -0
- package/dist/Image-Cvb4hnru.js +44 -0
- package/dist/{IndividualOnfido-pGSPtITh.js → IndividualOnfidoDropin-Dy5obHs1.js} +3833 -5548
- package/dist/InputDate-UCHQ3zOB.js +43 -0
- package/dist/InputGroup-WBfGDV5F.js +32 -0
- package/dist/InputText-DGKAS6ZI.js +134 -0
- package/dist/{Introduction-DaRfsN8P.js → Introduction-DOxSVZ6X.js} +4 -4
- package/dist/{JpAddress-BrtEV6zM.js → JpAddress-DClXaVjy.js} +22 -10
- package/dist/LandingLayout-co7NR2te.js +60 -0
- package/dist/{LegalRepresentativeDetailsPage-XcmRRT7P.js → LegalRepresentativeDetailsPage-DOP3L2r9.js} +4 -4
- package/dist/Link-DWTJ55UO.js +35 -0
- package/dist/List-BAzyC6sw.js +83 -0
- package/dist/{ListItem-DlRGqcSA.js → ListItem-B8D-kUHN.js} +3 -3
- package/dist/LoaderWrapper-CUz5NRFr.js +42 -0
- package/dist/{ManageIndividualComponent-BpzsaZ1O.js → ManageIndividualComponent-DND7vuna.js} +5 -5
- package/dist/{ManageTermsOfServiceComponent-D9i2HO5I.js → ManageTermsOfServiceComponent-ylDupO1E.js} +5 -5
- package/dist/{ManageTransferInstrumentComponent-C6LYppym.js → ManageTransferInstrumentComponent-CgUfGP5E.js} +16 -13
- package/dist/{Spacer-w89ksCbG.js → MaskedInput-Cn0VAuEp.js} +17 -631
- package/dist/{MaybeModal-DW5SxNsJ.js → MaybeModal-CWCEHeOg.js} +3 -3
- package/dist/{Modal-B4wxf7HK.js → Modal-pyBUluei.js} +2 -2
- package/dist/OnboardingDropinComponent-DwKImil4.js +2306 -0
- package/dist/{PayoutDetailsDropin-BKXxBApD.js → PayoutDetailsDropin-lYVb5WCQ.js} +105 -76
- package/dist/Radio-BMtxBpnn.js +39 -0
- package/dist/RadioGroup-DPc8nUuk.js +98 -0
- package/dist/RadioGroupCard-Pj9qq4uW.js +150 -0
- package/dist/{Review-DSdM3vGX.js → Review-gkTjl3a8.js} +7 -7
- package/dist/{RootBusinessDetailsPage-CqpiMFn9.js → RootBusinessDetailsPage-DjwEzuLA.js} +5 -5
- package/dist/{RootBusinessLinesPage-DUIp_zfH.js → RootBusinessLinesPage-2-U3mf6i.js} +104 -50
- package/dist/{RootIndividualDetailsPage-BpTbnRMJ.js → RootIndividualDetailsPage-BFYP63_i.js} +6 -6
- package/dist/{useForm-_Kjd_HFb.js → Select-D1rFT3T8.js} +10 -775
- package/dist/{SignPCIComponent-B-nJZ1cD.js → SignPCIComponent-DqElmjjG.js} +13 -11
- package/dist/{SingpassSelection-D7wRmaLb.js → SingpassSelection-eruroIiQ.js} +9 -7
- package/dist/{SoleProprietorshipPage-DUVjo6fc.js → SoleProprietorshipPage-7YdzA7iH.js} +4 -4
- package/dist/{SourceOfFundsPage-CFDBqD8v.js → SourceOfFundsPage-C_wiSoc4.js} +39 -26
- package/dist/Spacer-BK3jDget.js +18 -0
- package/dist/{StepProgressIndicator-BvU4jA3I.js → StepProgressIndicator-DLoEzGro.js} +1 -1
- package/dist/{StoreProvider-CyzNf7KK.js → StoreProvider-D9IR5HNN.js} +331 -222
- package/dist/StructuredList-9dnJRdx_.js +61 -0
- package/dist/{Summary-QyNHKBjO.js → Summary-Bq94iVfc.js} +10 -5
- package/dist/{InputText-DLAmX8CW.js → TaskVerificationStatus-BLCkXEn6.js} +3 -123
- package/dist/TaxInformationField-c-ZWfhUk.js +3134 -0
- package/dist/{TaxReportingDropin-Bn2xYbVw.js → TaxReportingDropin-ajO0q4eZ.js} +20 -17
- package/dist/TextArea-D9eJloeE.js +103 -0
- package/dist/TileGroup-CaY3i_T7.js +203 -0
- package/dist/{TrustDetailsPage-D0sr6zMt.js → TrustDetailsPage-BWXZX4-u.js} +40 -27
- package/dist/{TrustMemberCompanyPage-4sIP-M16.js → TrustMemberCompanyPage-CJj2BpXu.js} +5 -5
- package/dist/{TrustMemberIndividualPage-CelIjIAw.js → TrustMemberIndividualPage-BXp9RXDw.js} +4 -4
- package/dist/{TrustMemberRoleAndTypePage-C3CRy717.js → TrustMemberRoleAndTypePage-gYJ5U6RH.js} +24 -14
- package/dist/{TrustMembersOverview-HrRgAsno.js → TrustMembersOverview-Chmnt5jS.js} +13 -12
- package/dist/{UnincorporatedPartnershipIndividualPage-Dre5_Nuk.js → UnincorporatedPartnershipIndividualPage-DckUiPPY.js} +4 -4
- package/dist/{UnincorporatedPartnershipMemberCompanyPage-woQiy94h.js → UnincorporatedPartnershipMemberCompanyPage-Bx0A5Bit.js} +5 -5
- package/dist/{UnincorporatedPartnershipMemberRoleAndTypePage-DrirgJXY.js → UnincorporatedPartnershipMemberRoleAndTypePage-CEE1hzIn.js} +23 -16
- package/dist/{UnincorporatedPartnershipMembersOverview-BBiRqJkR.js → UnincorporatedPartnershipMembersOverview-wB8K9r6g.js} +10 -9
- package/dist/{VerificationErrorAlert-B_ovSmUS.js → VerificationErrorAlert-DZ5OOTBN.js} +4 -4
- package/dist/{ViewVerificationStatusComponent-CDQk4Nxa.js → ViewVerificationStatusComponent-BVY4YUJf.js} +4 -4
- package/dist/adyen-business-financing.js +3 -3
- package/dist/adyen-individual-configuration.js +3 -3
- package/dist/adyen-individual-status.js +3 -3
- package/dist/adyen-kyc-components.js +21 -20
- package/dist/adyen-onboarding.js +3 -3
- package/dist/adyen-terms-of-service-management.js +3 -3
- package/dist/adyen-terms-of-service-status.js +3 -3
- package/dist/adyen-transfer-instrument-configuration.js +3 -3
- package/dist/adyen-transfer-instrument-management.js +3 -3
- package/dist/adyen-verification-status.js +3 -3
- package/dist/{arrow-right-KxA3SvQj.js → arrow-right-BoqwUH_d.js} +2 -2
- package/dist/bafinUtils-Wct4TWLH.js +149 -0
- package/dist/{bag-BPumznWh.js → bag-BXVWLrwo.js} +2 -2
- package/dist/{bank-D6FiNBhs.js → bank-1GvaHPAZ.js} +2 -2
- package/dist/{bin-Bz6KOIeE.js → bin-Ba-3ll8T.js} +2 -2
- package/dist/{business-lines-DboUCbXw.js → business-lines-BAqTbnBw.js} +2 -2
- package/dist/{capital-GVQ3svwN.js → capital-9TKHySO7.js} +2 -2
- package/dist/{cash-stack-D9AoDDwt.js → cash-stack-DwYu4xNy.js} +2 -2
- package/dist/{certificate-CdEWgHQf.js → certificate-N2YFedpI.js} +2 -2
- package/dist/{checkmark-Q7x6tGhy.js → checkmark-D9dGhGpG.js} +2 -2
- package/dist/{checkmark-circle-x7dzbp3I.js → checkmark-circle-CFWClLQ6.js} +2 -2
- package/dist/{checkmark-circle-fill-CsvN5_PL.js → checkmark-circle-fill-DEB-tuGl.js} +2 -2
- package/dist/{checkmark-small-D35myntq.js → checkmark-small-D3VNx2lo.js} +2 -2
- package/dist/{chevron-down-C2iDorpW.js → chevron-down-C7SUSYfl.js} +2 -2
- package/dist/{chevron-left-ztPO84q-.js → chevron-left-BXmd-S46.js} +2 -2
- package/dist/{chevron-right-C_JN0oDt.js → chevron-right-jE6RwM2B.js} +2 -2
- package/dist/{chevron-up-CgG8n25g.js → chevron-up-BdfNcqzq.js} +2 -2
- package/dist/{circle-Bt3Nlr3q.js → circle-BJPTMCWB.js} +2 -2
- package/dist/{circle-small-filled-YMzP6yQU.js → circle-small-filled-BuO8Vg8j.js} +2 -2
- package/dist/{clock-BZHremOA.js → clock-DAzaBRWk.js} +2 -2
- package/dist/{coins-fkAk6dCo.js → coins-DYdzG5e_.js} +2 -2
- package/dist/commonValidators-DcFd5CHs.js +24 -0
- package/dist/{contract-BTa4HltT.js → contract-BfJb1t6M.js} +2 -2
- package/dist/{cross-Cn09MtQ_.js → cross-CDS_eot4.js} +2 -2
- package/dist/{cross-circle-fill-maan7Z5S.js → cross-circle-fill-C-EJ57Yn.js} +2 -2
- package/dist/{cross-circle-fill-small-DCz52AuN.js → cross-circle-fill-small-DkPjsuBH.js} +2 -2
- package/dist/currency-CrdnaaDu.js +35 -0
- package/dist/datasetUtil-BHQp0-xL.js +58 -0
- package/dist/debouncedInputEvent-Cv2S512Y.js +46 -0
- package/dist/{decision-makers-group-CgddXgrx.js → decision-makers-group-DrvpnEqj.js} +2 -2
- package/dist/{digital-wallet-D_IpxnkN.js → digital-wallet-Bx5YM1LY.js} +2 -2
- package/dist/{document-1-C08ut-Dt.js → document-1-qlSTF558.js} +2 -2
- package/dist/{document-blurred-2Zpodj3_.js → document-blurred-BiWap0xs.js} +2 -2
- package/dist/{document-cut-off-ClS7RiOp.js → document-cut-off-aQezqOif.js} +2 -2
- package/dist/{document-expired-CjksBq-N.js → document-expired-BhBXaWWQ.js} +2 -2
- package/dist/{document-front-DiAairT3.js → document-front-DYuhZGeQ.js} +2 -2
- package/dist/{document-person-vxlA6C5f.js → document-person-CDbnTOdV.js} +2 -2
- package/dist/{download-Drhk9k1f.js → download-BZQB1WkZ.js} +2 -2
- package/dist/{dropinUtils-DCWhMKpQ.js → dropinUtils-BpJn607e.js} +4 -4
- package/dist/{edit-1-CFoDTMvQ.js → edit-1-DAqtnOIx.js} +2 -2
- package/dist/{en-US-BzrLvydZ.js → en-US-CjjPhkB5.js} +2 -2
- package/dist/{external-link-DCMYUMfW.js → external-link-Cg6pJaSJ.js} +2 -2
- package/dist/fieldConfig-BPwb1GHc.js +134 -0
- package/dist/fieldConfigurations-BUT9DTUH.js +21 -0
- package/dist/form-rules-DhbF2mY4.js +13 -0
- package/dist/formUtils-BlVlgetw.js +137 -0
- package/dist/{funds-in-D8bj0aoE.js → funds-in-CInoUdmG.js} +2 -2
- package/dist/{getName-l7X1ZGKx.js → getName-CzpJ9tV7.js} +2 -2
- package/dist/getProps-CLJfvUMb.js +156 -0
- package/dist/{gift-CQ_DEma7.js → gift-omNInZeB.js} +2 -2
- package/dist/{graph-BJmqglH2.js → graph-DunG_uu1.js} +2 -2
- package/dist/{graph-up-Bq6adtlX.js → graph-up-BZze4i6m.js} +2 -2
- package/dist/{hasDataChanged-BXawTZla.js → hasDataChanged-8e8x8zjz.js} +2 -2
- package/dist/{headquarter-DNYyuuFq.js → headquarter-BhpSibFO.js} +2 -2
- package/dist/{hotel-BuNql78Z.js → hotel-Cp7VgGCJ.js} +2 -2
- package/dist/{house-B6sNRj-B.js → house-BhyBQdR3.js} +2 -2
- package/dist/{id-blurred-9dzBOWCE.js → id-blurred-B5lHEP8M.js} +2 -2
- package/dist/{id-cut-off-CohJCI2h.js → id-cut-off-Ba1FRzKO.js} +2 -2
- package/dist/{id-front-CSZfvdRg.js → id-front-CpNWN6nG.js} +2 -2
- package/dist/{id-glare-Q2JWo5ts.js → id-glare-DgCQON8k.js} +2 -2
- package/dist/{id-verification-instant-BUVBO4R3.js → id-verification-instant-Byt4Oul6.js} +2 -2
- package/dist/{id-verification-manual-B3YZALYU.js → id-verification-manual-CvcTkOSY.js} +2 -2
- package/dist/{iframeWidget-CbtmWmoO.js → iframeWidget-D6BlBF0m.js} +4 -4
- package/dist/{image-BSihO8lR.js → image-CmB0ioUM.js} +2 -2
- package/dist/{info-vHTZWoJ7.js → info-Bb_-xIEK.js} +2 -2
- package/dist/{info-filled-SQotHmT9.js → info-filled-CK8LB339.js} +2 -2
- package/dist/{instant-verification-Dvvkyfmp.js → instant-verification-UrnuHTYn.js} +2 -2
- package/dist/isEmpty-CsYVgjoD.js +23 -0
- package/dist/japanSupportUtils-iATUjnbf.js +17 -0
- package/dist/jpAddressSchema-De6ix57p.js +28 -0
- package/dist/{localizeDateString-BX5t59Ip.js → localizeDateString-BHDr1NID.js} +2 -2
- package/dist/{location-Q4oKvnkl.js → location-itJfxrDQ.js} +2 -2
- package/dist/{mail-BOdyoVqB.js → mail-VHTlAusn.js} +2 -2
- package/dist/makeSelectItemForRole-Bm2NwBxD.js +133 -0
- package/dist/{manual-verification-BvZWqA00.js → manual-verification-BO8zgAYT.js} +2 -2
- package/dist/{mapExistingFile-Bd7nsoK8.js → mapExistingFile-DNBa6Ekj.js} +80 -5
- package/dist/mapJpAddressSchemaToAddressLocalizations-BNb8d51F.js +147 -0
- package/dist/{mapLegalEntityToIndividualOnfidoSchema-CQF6zsO7.js → mapLegalEntityToIndividualOnfidoSchema-DREgz5Ms.js} +63 -3
- package/dist/{mapTransferInstrumentToPayoutAccount-CacHlKHM.js → mapTransferInstrumentToPayoutAccount-C5NqOfNW.js} +2 -2
- package/dist/{minus-circle-filled-kC2IUvKz.js → minus-circle-filled-ZhtJ0GD3.js} +2 -2
- package/dist/{onfido-logo-BWSv__sQ.js → onfido-logo-BSkKPH10.js} +2 -2
- package/dist/{options-horizontal-CBmbNv7R.js → options-horizontal-GuXvLvV3.js} +2 -2
- package/dist/{partner-CPjsrePY.js → partner-QD27Vy4w.js} +2 -2
- package/dist/{passport-blurred-B4UDQfmc.js → passport-blurred-CVG493IJ.js} +2 -2
- package/dist/{passport-cut-off-C0N2mgLk.js → passport-cut-off-COzA_TmB.js} +2 -2
- package/dist/{passport-front-BwA7wR91.js → passport-front-WJleLixT.js} +2 -2
- package/dist/{passport-front-green-BL4HmtsB.js → passport-front-green-CZVkCa1n.js} +2 -2
- package/dist/{passport-glare-Mg2ixsYA.js → passport-glare-BP5WnJZj.js} +2 -2
- package/dist/patternValidators-BXduwLbz.js +83 -0
- package/dist/{pay-by-link-plane-BVZndh67.js → pay-by-link-plane-BpY8Q6-B.js} +2 -2
- package/dist/{payout-ChUEoLjt.js → payout-DtB68BcZ.js} +2 -2
- package/dist/{payout-verification-instant-5u-wvFKv.js → payout-verification-instant-BzpfOQLD.js} +2 -2
- package/dist/{payout-verification-manual-BH2mu0UW.js → payout-verification-manual-gNEoeZkV.js} +2 -2
- package/dist/{person-DGjUU4S4.js → person-IVZG3t3_.js} +2 -2
- package/dist/{plaid-logo-CtActXTN.js → plaid-logo-FsZ7kfL-.js} +2 -2
- package/dist/{plus-CWXA5wdX.js → plus-DiALAL8-.js} +2 -2
- package/dist/{plus-circle-filled-CbC0u2Y1.js → plus-circle-filled-BzHtTqEN.js} +2 -2
- package/dist/{process-field-configurations-BZQqH4-M.js → process-field-configurations-B26ehyAw.js} +3 -3
- package/dist/{recurring-CkL4cCM2.js → recurring-DKNs9K3x.js} +2 -2
- package/dist/{reporting-DerosUNm.js → reporting-D5ABpLO_.js} +2 -2
- package/dist/{resolveEnvironment-C6JtHmZc.js → resolveEnvironment-B5Yrsa4J.js} +3 -3
- package/dist/{revenue-accelerate-Dp4Ns_5c.js → revenue-accelerate-D7Sp0V4a.js} +2 -2
- package/dist/{review-CxIN9azU.js → review-D4TUjcWF.js} +2 -2
- package/dist/roleMetadata-DmgqzhZJ.js +66 -0
- package/dist/{rules-ClDW_ZSK.js → rules-B_6RrE9T.js} +6 -5
- package/dist/{save-Fgy7EDid.js → save-BfqO2JBI.js} +2 -2
- package/dist/{search-C4GZ-Rc1.js → search-Cmzbf5zI.js} +2 -2
- package/dist/{show-yPjPmEf8.js → show-IdbU1C6P.js} +2 -2
- package/dist/{singpass-logo-BkMSwiGY.js → singpass-logo-wY4xsmTX.js} +2 -2
- package/dist/{singpass-verification-instant-hY4eGFwl.js → singpass-verification-instant-JCqTr7Mv.js} +2 -2
- package/dist/{singpass-verification-manual-DwhRpy5Q.js → singpass-verification-manual-DQ7XW6R3.js} +2 -2
- package/dist/{solution-payments-CNAat9h7.js → solution-payments-DpyE_sdS.js} +2 -2
- package/dist/{store-IuAkDRAp.js → store-Btc4GcmU.js} +2 -2
- package/dist/style.css +965 -993
- package/dist/styles-CLV89_hH.js +965 -993
- package/dist/summaryItem-CAQCQSkt.js +18 -0
- package/dist/{tax-reporting-graph-DjzwRgE6.js → tax-reporting-graph-hgoilCHZ.js} +2 -2
- package/dist/{terminal-1-_me9J9h0.js → terminal-1-D1pwXCoi.js} +2 -2
- package/dist/{tink-logo-BcIv93ND.js → tink-logo-DDyjz5eJ.js} +2 -2
- package/dist/types/api/businessLines/useCreateBusinessLine.d.ts +1 -1
- package/dist/types/api/businessLines/useDeleteBusinessLine.d.ts +1 -1
- package/dist/types/api/businessLines/useUpdateBusinessLines.d.ts +1 -1
- package/dist/types/api/businessLines/useUpdateSourceOfFunds.d.ts +1 -1
- package/dist/types/api/companyDataSet/useClearCompanyData.d.ts +1 -1
- package/dist/types/api/createLegalEntity/useCreateLegalEntity.d.ts +1 -1
- package/dist/types/api/documentValidation/useDocumentValidate.d.ts +1 -1
- package/dist/types/api/documents/useCreateDocument.d.ts +1 -1
- package/dist/types/api/documents/useDeleteDocument.d.ts +1 -1
- package/dist/types/api/documents/useDocument.d.ts +1 -1
- package/dist/types/api/documents/useUpdateDocument.d.ts +1 -1
- package/dist/types/api/entityVerifications/useVerifyIdNumber.d.ts +2 -2
- package/dist/types/api/idVerificationProviders/idVerificationStartCheck.d.ts +1 -1
- package/dist/types/api/idVerificationProviders/useExtractDocumentInformation.d.ts +1 -1
- package/dist/types/api/idVerificationProviders/useIdVerificationToken.d.ts +1 -1
- package/dist/types/api/legalEntity/useConfirmReview.d.ts +1 -1
- package/dist/types/api/legalEntity/useUpdateLegalEntity.d.ts +1 -1
- package/dist/types/api/onboardingStatus/useGenerateOnboardingLink.d.ts +1 -1
- package/dist/types/api/pci/useSignPci.d.ts +1 -2
- package/dist/types/api/taskStatus/useTaskStatus.d.ts +2 -2
- package/dist/types/api/termsOfService/useAcceptTermsOfService.d.ts +1 -1
- package/dist/types/api/types.d.ts +2 -1
- package/dist/types/api/uiAnalytics/useAnalyticsSession.d.ts +1 -1
- package/dist/types/api/uiAnalytics/usePushAnalyticEvent.d.ts +1 -1
- package/dist/types/api/validation/useValidateAccountIdentification.d.ts +1 -1
- package/dist/types/components/BankAccount/forms/BankDocument/types.d.ts +0 -1
- package/dist/types/components/BankAccount/forms/BankVerification/types.d.ts +1 -0
- package/dist/types/components/BankAccount/forms/BankVerification/verification/overlay/BankVerificationOverlay.d.ts +1 -1
- package/dist/types/components/BankAccount/forms/PayoutDetails/types.d.ts +0 -1
- package/dist/types/components/BankAccount/mapping/payoutKeyMappings.d.ts +439 -439
- package/dist/types/components/BankAccount/tasks/PayoutDetailsDropin/PayoutDetailsDropin.d.ts +1 -1
- package/dist/types/components/BankAccount/utils/payoutAccountUtil.d.ts +1 -1
- package/dist/types/components/Business/forms/BusinessDetails/form-ids.d.ts +2 -0
- package/dist/types/components/Business/forms/BusinessDetails/types.d.ts +1 -0
- package/dist/types/components/Business/forms/CompanyStructure/CompanyStructure.d.ts +0 -1
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/types.d.ts +1 -1
- package/dist/types/components/Business/tasks/BusinessDetailsDropin/utils.d.ts +1 -1
- package/dist/types/components/BusinessLines/tasks/BusinessLines/BusinessLinesDropin.d.ts +1 -1
- package/dist/types/components/BusinessLines/tasks/types.d.ts +2 -0
- package/dist/types/components/BusinessLines/tasks/utils.d.ts +4 -2
- package/dist/types/components/EFP/mapping/businessFinancingKeyMappings.d.ts +475 -475
- package/dist/types/components/EFP/tasks/SourceOfFundsDropin/utils.d.ts +1 -2
- package/dist/types/components/EFP/tasks/TaxReportingDropin/utils.d.ts +1 -2
- package/dist/types/components/EmbeddedDropins/BusinessFinancingComponent/utils.d.ts +1 -1
- package/dist/types/components/Individual/forms/Individual/Individual.d.ts +41 -3
- package/dist/types/components/Individual/forms/Individual/form-ids.d.ts +2 -0
- package/dist/types/components/Individual/forms/Individual/types.d.ts +1 -2
- package/dist/types/components/Individual/forms/IndividualOnfido/IndividualOnfido.types.d.ts +1 -0
- package/dist/types/components/Individual/forms/IndividualOnfido/form-ids.d.ts +2 -0
- package/dist/types/components/Individual/tasks/DecisionMakers/DecisionMakerDetails/utils.d.ts +1 -1
- package/dist/types/components/Individual/tasks/DecisionMakers/utils.d.ts +1 -1
- package/dist/types/components/Shared/Introduction/copy.d.ts +1 -1
- package/dist/types/components/Shared/forms/Address/utils.d.ts +1 -1
- package/dist/types/components/Shared/forms/BusinessTypeSelection/utils.d.ts +1 -1
- package/dist/types/components/Trust/tasks/RoleAndTypeDropin/formatRoleAndEntityTypeSummary.d.ts +1 -1
- package/dist/types/components/ui/molecules/EmbeddedStatus/statusToTag.d.ts +1 -1
- package/dist/types/core/user-events.d.ts +1 -0
- package/dist/types/language/types.d.ts +7 -2
- package/dist/types/language/utils.d.ts +1 -2
- package/dist/types/types/assert.d.ts +1 -0
- package/dist/types/utils/analytics/debouncedInputEvent.d.ts +1 -0
- package/dist/types/utils/analytics/getPrefilledDetails.d.ts +28 -0
- package/dist/types/utils/api/processCapabilitites.d.ts +13 -0
- package/dist/types/utils/entityStatusUtil.d.ts +1 -1
- package/dist/types/utils/formUtils.d.ts +1 -2
- package/dist/types/utils/getDisplayErrorMessage.d.ts +1 -2
- package/dist/types/utils/getName.d.ts +1 -1
- package/dist/types/utils/makeSelectItemForRole.d.ts +1 -1
- package/dist/types/utils/translation.d.ts +3 -2
- package/dist/{types-DDnAZYTj.js → types-C6ntGMCy.js} +3 -26
- package/dist/{types-DE1uuPfP.js → types-CpAtsPmJ.js} +1 -1
- package/dist/{types-hGeLq0SR.js → types-c9nG7Dev.js} +1 -1
- package/dist/unincorporated-partnership-MeN1dp53.js +97 -0
- package/dist/{upload-BF65P4KM.js → upload-BmUXjsaU.js} +2 -2
- package/dist/{us-check-CYY6Crhr.js → us-check-C1rTBsCY.js} +2 -2
- package/dist/{us-check-account-number-C7KE5YzX.js → us-check-account-number-9lI1dXNC.js} +2 -2
- package/dist/{us-check-routing-number-DUbhsYAR.js → us-check-routing-number-s_KaAGSM.js} +2 -2
- package/dist/{useAssociatedLegalEntity-D_Nk_obe.js → useAssociatedLegalEntity-ahBb64MW.js} +2 -2
- package/dist/useBusinessDetailsData-qQ2HRnKK.js +5161 -0
- package/dist/{useCreateLegalEntity-DT7ue23d.js → useCreateLegalEntity-Kc8_ZlAe.js} +2 -2
- package/dist/useDataset-DfKmlbQd.js +74 -0
- package/dist/useForm-9uKM-XKf.js +582 -0
- package/dist/{FormFlow-BrgeP70A.js → useFormContext-CvQfKDA3.js} +26 -31
- package/dist/{useGlobalData-C7tjZfC0.js → useGlobalData-BVQ2OrIi.js} +3 -3
- package/dist/useId-BZ0PA7jP.js +24 -0
- package/dist/{useMultiForm-DWozxGN4.js → useMultiForm-pAiPIh7X.js} +4 -4
- package/dist/{useOnboardingStatus-DBLS6PUq.js → useOnboardingStatus-BhDBSLB6.js} +1 -1
- package/dist/{useScenarios-DD06bWNN.js → useScenarios-DFW21Vhf.js} +2 -2
- package/dist/{useTermsOfServiceStatus-D2lYSqHn.js → useTermsOfServiceStatus-BnO0rXiL.js} +1 -1
- package/dist/{useToastContext-Cbw29cqc.js → useToastContext-D6Lbxqj9.js} +5 -17
- package/dist/{useUnincorporatedPartnershipMembers-Dbb2VjkF.js → useUnincorporatedPartnershipMembers-CIC7xPbD.js} +5 -5
- package/dist/useUpdateBusinessLines-WlwUOtSU.js +337 -0
- package/dist/{useUpdateLegalEntity-Aubxhgvv.js → useUpdateLegalEntity-CStkUt4I.js} +3 -3
- package/dist/utils-7_xBiPO_.js +58 -0
- package/dist/utils-BmxzrkCX.js +165 -0
- package/dist/{utils-D1-D6fui.js → utils-CB39nVjj.js} +6 -6
- package/dist/{utils-DenrGsUh.js → utils-CDAwsXQa.js} +4 -4
- package/dist/utils-DOiFhaKn.js +29 -0
- package/dist/{documentUtils-Be5wlCwo.js → validate-Bsx2oHT1.js} +170 -6
- package/dist/{validate-BxVes1el.js → validate-D-l23QLG.js} +2 -2
- package/dist/validate-D4iK6FUk.js +385 -0
- package/dist/{validationError-DPP91cM3.js → validationError-DYYlX-5X.js} +2 -2
- package/dist/{warning-circle-fill-CEN1WL7A.js → warning-circle-fill-DBvt921B.js} +2 -2
- package/dist/{warning-diamond-filled-BfXMlVrG.js → warning-diamond-filled-Lb2od2ry.js} +2 -2
- package/dist/{webinar-DqjqrNEv.js → webinar-m9nuFZBt.js} +2 -2
- package/dist/{yapily-logo-CZ4ywjwA.js → yapily-logo-BduxhNRA.js} +2 -2
- package/package.json +6 -6
- package/dist/ConstitutionalDocument-DM6M40MP.js +0 -143
- package/dist/CountryField-CsKJAI53.js +0 -843
- package/dist/IndividualOnfidoDropin-DZEn2Tf8.js +0 -2575
- package/dist/OnboardingDropinComponent-Cx-c_p0i.js +0 -7623
- package/dist/getFieldsWithExistingData-CfckMyJ1.js +0 -22
- package/dist/mapFinancialReportsToFinancialInformation-Bfvt2G87.js +0 -67
- package/dist/mapJpAddressSchemaToAddressLocalizations-CWY2lZGD.js +0 -63
- package/dist/types/components/Shared/forms/BusinessTypeSelection/EntityTypeRadioGroupCard.d.ts +0 -11
- package/dist/useBusinessDetailsData-DG9EJBH_.js +0 -2441
- package/dist/useDataset-DCCxYOjr.js +0 -220
- package/dist/useUpdateBusinessLines-8bDYsLav.js +0 -46
- package/dist/validate-BgMFLdKI.js +0 -41
|
@@ -2,171 +2,20 @@
|
|
|
2
2
|
{
|
|
3
3
|
try {
|
|
4
4
|
let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
5
|
-
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "
|
|
5
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "441e8e06-191b-48d9-992c-fbf7084e39cb", e._sentryDebugIdIdentifier = "sentry-dbid-441e8e06-191b-48d9-992c-fbf7084e39cb");
|
|
6
6
|
} catch (e) {
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
;
|
|
10
10
|
import { jsxs, jsx, Fragment } from "preact/jsx-runtime";
|
|
11
11
|
import cx from "classnames";
|
|
12
|
-
import {
|
|
13
|
-
import { u as useTranslation, a3 as useAnalyticsContext, a4 as Icon, z as translateStringOrObject, L as Loader, a5 as noop, G as Typography, P as createLogger, W as isEmpty, a1 as entriesOf, aV as doArraysMatch } from "./StoreProvider-CyzNf7KK.js";
|
|
14
|
-
import { b as useId } from "./useToastContext-Cbw29cqc.js";
|
|
12
|
+
import { useState, useRef, useMemo, useCallback, useEffect } from "preact/hooks";
|
|
15
13
|
import { computed, signal, useSignal, useSignalEffect } from "@preact/signals";
|
|
16
|
-
import { K as KEYBOARD_KEYS } from "./Modal-
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
className,
|
|
22
|
-
name,
|
|
23
|
-
disabled,
|
|
24
|
-
el,
|
|
25
|
-
dataTestId
|
|
26
|
-
}) => el === "fieldset" ? /* @__PURE__ */ jsx("fieldset", { name, disabled, className, "data-testid": dataTestId, children }) : /* @__PURE__ */ jsx("div", { className, "data-testid": dataTestId, children });
|
|
27
|
-
const Field = ({
|
|
28
|
-
className,
|
|
29
|
-
classNameModifiers = [],
|
|
30
|
-
children,
|
|
31
|
-
disabled,
|
|
32
|
-
optional,
|
|
33
|
-
errorMessage,
|
|
34
|
-
formatGuidance,
|
|
35
|
-
helper,
|
|
36
|
-
helperPosition = "above",
|
|
37
|
-
isValid,
|
|
38
|
-
label,
|
|
39
|
-
name,
|
|
40
|
-
showErrorIconBottom = false,
|
|
41
|
-
showErrorIcon = true,
|
|
42
|
-
el = "div",
|
|
43
|
-
dataTestId,
|
|
44
|
-
onBlur,
|
|
45
|
-
onFieldBlur,
|
|
46
|
-
onFocus
|
|
47
|
-
}) => {
|
|
48
|
-
const uniqueId = useId("field");
|
|
49
|
-
const { t } = useTranslation("common");
|
|
50
|
-
const userEvents = useAnalyticsContext();
|
|
51
|
-
const Label = el === "fieldset" ? "legend" : "label";
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (!errorMessage) return;
|
|
54
|
-
const returnValue = typeof errorMessage === "string" && errorMessage || typeof errorMessage === "object" && errorMessage.key || "invalid";
|
|
55
|
-
userEvents.addFieldEvent("Encountered error", {
|
|
56
|
-
actionType: "input",
|
|
57
|
-
field: name,
|
|
58
|
-
returnType: "validation",
|
|
59
|
-
returnValue
|
|
60
|
-
});
|
|
61
|
-
}, [name, errorMessage, userEvents]);
|
|
62
|
-
const elementIds = {
|
|
63
|
-
label: `${uniqueId}-label`,
|
|
64
|
-
helper: `${uniqueId}-helper`,
|
|
65
|
-
error: `${uniqueId}${ARIA_ERROR_SUFFIX}`,
|
|
66
|
-
guidanceText: `${uniqueId}-guidanceText`
|
|
67
|
-
};
|
|
68
|
-
const inputDescribedBy = `${errorMessage ? elementIds.error : ""} ${helper ? elementIds.helper : ""} ${formatGuidance ? elementIds.guidanceText : ""}`.trim();
|
|
69
|
-
return /* @__PURE__ */ jsxs(
|
|
70
|
-
MaybeFieldset,
|
|
71
|
-
{
|
|
72
|
-
className: cx(
|
|
73
|
-
"adyen-kyc-field",
|
|
74
|
-
className,
|
|
75
|
-
classNameModifiers.map((m) => `adyen-kyc-field--${m}`),
|
|
76
|
-
{
|
|
77
|
-
"adyen-kyc-field--error": !!errorMessage,
|
|
78
|
-
"adyen-kyc-field--valid": isValid,
|
|
79
|
-
"adyen-kyc-field--disabled": disabled
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
name,
|
|
83
|
-
disabled,
|
|
84
|
-
el,
|
|
85
|
-
dataTestId,
|
|
86
|
-
children: [
|
|
87
|
-
label && /* @__PURE__ */ jsxs(
|
|
88
|
-
Label,
|
|
89
|
-
{
|
|
90
|
-
id: elementIds.label,
|
|
91
|
-
htmlFor: el === "fieldset" ? void 0 : uniqueId,
|
|
92
|
-
className: cx("adyen-kyc-label__text", {
|
|
93
|
-
"adyen-kyc-label__text--error": !!errorMessage
|
|
94
|
-
}),
|
|
95
|
-
children: [
|
|
96
|
-
label,
|
|
97
|
-
optional && /* @__PURE__ */ jsxs("span", { className: "adyen-kyc-optional-label", children: [
|
|
98
|
-
" ",
|
|
99
|
-
t(($) => $["optional"])
|
|
100
|
-
] })
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
helper && helperPosition === "above" && /* @__PURE__ */ jsx("span", { id: elementIds.helper, className: "adyen-kyc-helper-text adyen-kyc-helper-text__above", children: helper }),
|
|
105
|
-
/* @__PURE__ */ jsxs("div", { className: "adyen-kyc-input-wrapper", children: [
|
|
106
|
-
children({
|
|
107
|
-
id: uniqueId,
|
|
108
|
-
"aria-labelledby": elementIds.label,
|
|
109
|
-
"aria-describedby": inputDescribedBy,
|
|
110
|
-
isInvalid: !!errorMessage,
|
|
111
|
-
isValid: !!isValid,
|
|
112
|
-
onBlurHandler: (e) => {
|
|
113
|
-
if (typeof onBlur === "function") onBlur(e);
|
|
114
|
-
if (typeof onFieldBlur === "function") onFieldBlur(e);
|
|
115
|
-
},
|
|
116
|
-
onFocusHandler: (e) => {
|
|
117
|
-
if (typeof onFocus === "function") onFocus(e);
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
helper && helperPosition === "below" && /* @__PURE__ */ jsx(
|
|
121
|
-
"span",
|
|
122
|
-
{
|
|
123
|
-
id: elementIds.helper,
|
|
124
|
-
className: "adyen-kyc-helper-text adyen-kyc-helper-text__below",
|
|
125
|
-
children: helper
|
|
126
|
-
}
|
|
127
|
-
),
|
|
128
|
-
isValid && /* @__PURE__ */ jsx("span", { className: "adyen-kyc-input__inline-validation adyen-kyc-input__inline-validation--valid", children: /* @__PURE__ */ jsx(Icon, { name: "check" }) }),
|
|
129
|
-
!!errorMessage && !showErrorIconBottom && showErrorIcon && /* @__PURE__ */ jsx("span", { className: "adyen-kyc-input__inline-validation adyen-kyc-input__inline-validation--invalid", children: /* @__PURE__ */ jsx(Icon, { name: "field-error" }) })
|
|
130
|
-
] }),
|
|
131
|
-
/* @__PURE__ */ jsxs("div", { "aria-live": "polite", "aria-atomic": true, className: "adyen-kyc-error-text", children: [
|
|
132
|
-
/* @__PURE__ */ jsx("span", { className: "adyen-kyc-u-screen-reader-only", children: `${label}:` }),
|
|
133
|
-
!!errorMessage && typeof errorMessage !== "boolean" && /* @__PURE__ */ jsxs("span", { id: elementIds.error, children: [
|
|
134
|
-
translateStringOrObject(t, errorMessage),
|
|
135
|
-
showErrorIconBottom && /* @__PURE__ */ jsx("span", { className: "adyen-kyc-input__inline-validation adyen-kyc-input__inline-validation--invalid-bottom", children: /* @__PURE__ */ jsx(Icon, { name: "field-error" }) })
|
|
136
|
-
] })
|
|
137
|
-
] }),
|
|
138
|
-
!errorMessage && formatGuidance && /* @__PURE__ */ jsx("span", { id: elementIds.guidanceText, "aria-live": "polite", className: "adyen-kyc-guidance-text", children: formatGuidance })
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
const loaderWrapperLoader = "adyen-kyc-loader-wrapper-loader";
|
|
144
|
-
const loaderWrapperLoaderActive = "adyen-kyc-loader-wrapper-loader-active";
|
|
145
|
-
const styles$1 = {
|
|
146
|
-
loaderWrapperLoader,
|
|
147
|
-
loaderWrapperLoaderActive
|
|
148
|
-
};
|
|
149
|
-
const LoaderWrapper = ({
|
|
150
|
-
children,
|
|
151
|
-
status,
|
|
152
|
-
formOpacityWhenLoading = 0,
|
|
153
|
-
loaderSize = "medium",
|
|
154
|
-
showSpinner = true,
|
|
155
|
-
className
|
|
156
|
-
}) => {
|
|
157
|
-
const opacitySyle = status === "loading" ? {
|
|
158
|
-
opacity: formOpacityWhenLoading
|
|
159
|
-
} : { opacity: 1 };
|
|
160
|
-
const showLoader = status === "loading" && showSpinner;
|
|
161
|
-
const loaderWrapperClass = cx(styles$1.loaderWrapperLoader, {
|
|
162
|
-
[styles$1.loaderWrapperLoaderActive]: showLoader
|
|
163
|
-
});
|
|
164
|
-
const overlayClass = cx(styles$1.loaderWrapper, className);
|
|
165
|
-
return /* @__PURE__ */ jsxs("div", { className: overlayClass, style: { position: "relative" }, children: [
|
|
166
|
-
showLoader && /* @__PURE__ */ jsx("div", { className: loaderWrapperClass, children: /* @__PURE__ */ jsx(Loader, { size: loaderSize }) }),
|
|
167
|
-
/* @__PURE__ */ jsx("div", { className: styles$1.loaderWrapperForm, style: opacitySyle, children })
|
|
168
|
-
] });
|
|
169
|
-
};
|
|
14
|
+
import { K as KEYBOARD_KEYS } from "./Modal-pyBUluei.js";
|
|
15
|
+
import { V as useAnalyticsContext, L as Loader, Y as noop, G as Typography, H as createLogger, u as useTranslation } from "./StoreProvider-D9IR5HNN.js";
|
|
16
|
+
import { d as debouncedInputEvent } from "./debouncedInputEvent-Cv2S512Y.js";
|
|
17
|
+
import { a as useId } from "./useId-BZ0PA7jP.js";
|
|
18
|
+
import { C as Checkbox } from "./Checkbox-D8rB6_HN.js";
|
|
170
19
|
const createSelectFocus = ({
|
|
171
20
|
activeItems,
|
|
172
21
|
filteredItems: items
|
|
@@ -526,7 +375,7 @@ const SelectListItem = ({
|
|
|
526
375
|
] })
|
|
527
376
|
}
|
|
528
377
|
);
|
|
529
|
-
const logger
|
|
378
|
+
const logger = createLogger();
|
|
530
379
|
const DEFAULT_ITEM_HEIGHT = 36;
|
|
531
380
|
function SelectList({
|
|
532
381
|
selectListId,
|
|
@@ -613,7 +462,7 @@ function SelectList({
|
|
|
613
462
|
if (itemEl) {
|
|
614
463
|
itemEl.focus();
|
|
615
464
|
} else {
|
|
616
|
-
logger
|
|
465
|
+
logger.warn("[SelectList] still cannot see the option", item.name);
|
|
617
466
|
}
|
|
618
467
|
}, 20);
|
|
619
468
|
},
|
|
@@ -1005,621 +854,7 @@ const Select = ({
|
|
|
1005
854
|
}
|
|
1006
855
|
);
|
|
1007
856
|
};
|
|
1008
|
-
class ValidationResult {
|
|
1009
|
-
validationResults;
|
|
1010
|
-
constructor(results) {
|
|
1011
|
-
this.validationResults = results;
|
|
1012
|
-
}
|
|
1013
|
-
/** Checks if all validation rules have passed */
|
|
1014
|
-
get isValid() {
|
|
1015
|
-
return this.validationResults.reduce((acc, result) => acc && result.isValid, true);
|
|
1016
|
-
}
|
|
1017
|
-
/** Checks if any validation rule returned an error */
|
|
1018
|
-
hasError() {
|
|
1019
|
-
return Boolean(this.getError());
|
|
1020
|
-
}
|
|
1021
|
-
/** Returns the first validation result that returned an error */
|
|
1022
|
-
getError() {
|
|
1023
|
-
return this.validationResults.find((result) => result.hasError);
|
|
1024
|
-
}
|
|
1025
|
-
/** Used to add async validation results to the static validation result*/
|
|
1026
|
-
addError(result) {
|
|
1027
|
-
this.validationResults.push(result);
|
|
1028
|
-
return this.validationResults;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
const logger = createLogger();
|
|
1032
|
-
const useAsyncValidator = (asyncRules) => {
|
|
1033
|
-
const [asyncValidationResults, setAsyncValidationResults] = useState({});
|
|
1034
|
-
const clearAsyncValidationResults = useCallback(
|
|
1035
|
-
(field) => setAsyncValidationResults((existingResults) => ({
|
|
1036
|
-
...existingResults,
|
|
1037
|
-
[field]: void 0
|
|
1038
|
-
})),
|
|
1039
|
-
[]
|
|
1040
|
-
);
|
|
1041
|
-
const triggerAsyncValidation = useCallback(
|
|
1042
|
-
(field, formState, mode) => {
|
|
1043
|
-
const rule = asyncRules?.[field];
|
|
1044
|
-
if (!rule || !rule.modes.includes(mode)) {
|
|
1045
|
-
clearAsyncValidationResults(field);
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
const value = formState.data[field];
|
|
1049
|
-
return rule.asyncValidate(formState.data[field], { state: formState }).then((isValid) => {
|
|
1050
|
-
setAsyncValidationResults((existingResults) => ({
|
|
1051
|
-
...existingResults,
|
|
1052
|
-
[field]: new ValidationResult([
|
|
1053
|
-
{
|
|
1054
|
-
isValid,
|
|
1055
|
-
errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value, { state: formState }) : rule.errorMessage,
|
|
1056
|
-
hasError: !isValid
|
|
1057
|
-
}
|
|
1058
|
-
])
|
|
1059
|
-
}));
|
|
1060
|
-
}).catch(logger.error);
|
|
1061
|
-
},
|
|
1062
|
-
[asyncRules, clearAsyncValidationResults]
|
|
1063
|
-
);
|
|
1064
|
-
return {
|
|
1065
|
-
asyncValidationResults,
|
|
1066
|
-
triggerAsyncValidation,
|
|
1067
|
-
clearAsyncValidationResults
|
|
1068
|
-
};
|
|
1069
|
-
};
|
|
1070
|
-
const useStaticValidator = (rules) => {
|
|
1071
|
-
const getRulesForField = useCallback(
|
|
1072
|
-
(field) => {
|
|
1073
|
-
const fallbackRule = {
|
|
1074
|
-
validate: () => true,
|
|
1075
|
-
modes: ["blur", "input"]
|
|
1076
|
-
};
|
|
1077
|
-
const fieldRules = rules?.[field] ?? [fallbackRule];
|
|
1078
|
-
return Array.isArray(fieldRules) ? fieldRules : [fieldRules];
|
|
1079
|
-
},
|
|
1080
|
-
[rules]
|
|
1081
|
-
);
|
|
1082
|
-
const triggerStaticValidation = useCallback(
|
|
1083
|
-
({ key, value, mode = "blur" }, context) => {
|
|
1084
|
-
const fieldRules = getRulesForField(key);
|
|
1085
|
-
const isFieldOptional = !!context?.state.optionalFields?.includes(key);
|
|
1086
|
-
const isFieldObscured = !!context?.state.obscuredFields?.includes(key);
|
|
1087
|
-
const validationRulesResult = fieldRules.map((rule) => {
|
|
1088
|
-
const shouldValidate = rule.modes.includes(mode) && !isFieldObscured;
|
|
1089
|
-
const isValid = isFieldOptional && isEmpty(value) ? true : rule.validate(value, context);
|
|
1090
|
-
return {
|
|
1091
|
-
isValid,
|
|
1092
|
-
errorMessage: typeof rule.errorMessage === "function" ? rule.errorMessage(value, context) : rule.errorMessage,
|
|
1093
|
-
hasError: shouldValidate && !isValid
|
|
1094
|
-
};
|
|
1095
|
-
});
|
|
1096
|
-
return new ValidationResult(validationRulesResult);
|
|
1097
|
-
},
|
|
1098
|
-
[getRulesForField]
|
|
1099
|
-
);
|
|
1100
|
-
return {
|
|
1101
|
-
triggerStaticValidation
|
|
1102
|
-
};
|
|
1103
|
-
};
|
|
1104
|
-
const omitKeys = (obj, omit) => Object.keys(obj).filter((k) => !omit.includes(k)).reduce((a, c) => {
|
|
1105
|
-
a[c] = obj[c];
|
|
1106
|
-
return a;
|
|
1107
|
-
}, {});
|
|
1108
|
-
const addKeys = (obj, add, initialValue, defaultData, pendingData) => add.reduce(
|
|
1109
|
-
(a, c) => ({
|
|
1110
|
-
...a,
|
|
1111
|
-
[c]: a[c] ?? pendingData?.[c] ?? defaultData?.[c] ?? initialValue
|
|
1112
|
-
}),
|
|
1113
|
-
obj
|
|
1114
|
-
);
|
|
1115
|
-
function getDataByFields(formData, fieldKeys) {
|
|
1116
|
-
return entriesOf(formData).reduce((acc, [key, val]) => {
|
|
1117
|
-
if (fieldKeys.includes(key)) {
|
|
1118
|
-
return { ...acc, [key]: val };
|
|
1119
|
-
}
|
|
1120
|
-
return acc;
|
|
1121
|
-
}, {});
|
|
1122
|
-
}
|
|
1123
|
-
const processField = ({
|
|
1124
|
-
key,
|
|
1125
|
-
value = null,
|
|
1126
|
-
mode,
|
|
1127
|
-
defaultData,
|
|
1128
|
-
fieldContext,
|
|
1129
|
-
formatters,
|
|
1130
|
-
staticValidate,
|
|
1131
|
-
asyncValidate
|
|
1132
|
-
}) => {
|
|
1133
|
-
const formatterFn = formatters?.[key]?.formatter ? formatters[key]?.formatter : formatters?.[key];
|
|
1134
|
-
const formattedValue = formatterFn && typeof formatterFn === "function" ? formatterFn(value, fieldContext) : value;
|
|
1135
|
-
const shouldValidateField = !(defaultData?.[key] === value && !!defaultData?.[key]);
|
|
1136
|
-
if (shouldValidateField && value) {
|
|
1137
|
-
asyncValidate(key, fieldContext.state, mode);
|
|
1138
|
-
}
|
|
1139
|
-
const validationResult = shouldValidateField ? staticValidate({ key, value: formattedValue, mode }, fieldContext) : new ValidationResult([
|
|
1140
|
-
{
|
|
1141
|
-
isValid: true,
|
|
1142
|
-
hasError: false
|
|
1143
|
-
}
|
|
1144
|
-
]);
|
|
1145
|
-
return [formattedValue, validationResult];
|
|
1146
|
-
};
|
|
1147
|
-
function init({
|
|
1148
|
-
schema,
|
|
1149
|
-
defaultData,
|
|
1150
|
-
fieldProblems,
|
|
1151
|
-
obscuredFields,
|
|
1152
|
-
optionalFields,
|
|
1153
|
-
trustedFields,
|
|
1154
|
-
formatters,
|
|
1155
|
-
staticValidate,
|
|
1156
|
-
asyncValidate
|
|
1157
|
-
}) {
|
|
1158
|
-
const getProcessedState = (fieldKey) => {
|
|
1159
|
-
const [formattedValue, validationResult] = processField({
|
|
1160
|
-
key: fieldKey,
|
|
1161
|
-
value: defaultData?.[fieldKey],
|
|
1162
|
-
mode: "blur",
|
|
1163
|
-
formatters,
|
|
1164
|
-
defaultData,
|
|
1165
|
-
fieldContext: {
|
|
1166
|
-
state: {
|
|
1167
|
-
data: defaultData,
|
|
1168
|
-
obscuredFields,
|
|
1169
|
-
optionalFields,
|
|
1170
|
-
trustedFields
|
|
1171
|
-
}
|
|
1172
|
-
},
|
|
1173
|
-
staticValidate,
|
|
1174
|
-
asyncValidate
|
|
1175
|
-
});
|
|
1176
|
-
if (typeof defaultData?.[fieldKey] === "undefined") {
|
|
1177
|
-
return {
|
|
1178
|
-
valid: validationResult.isValid && !fieldProblems?.[fieldKey] || false,
|
|
1179
|
-
errors: null,
|
|
1180
|
-
data: null,
|
|
1181
|
-
fieldProblems: fieldProblems?.[fieldKey] ?? false
|
|
1182
|
-
};
|
|
1183
|
-
}
|
|
1184
|
-
return {
|
|
1185
|
-
valid: validationResult.isValid && !fieldProblems?.[fieldKey] || false,
|
|
1186
|
-
errors: validationResult.getError() ?? null,
|
|
1187
|
-
data: formattedValue,
|
|
1188
|
-
fieldProblems: fieldProblems?.[fieldKey] ?? false
|
|
1189
|
-
};
|
|
1190
|
-
};
|
|
1191
|
-
const formFields = optionalFields ? [...schema, ...optionalFields] : schema;
|
|
1192
|
-
const formData = formFields.reduce(
|
|
1193
|
-
(acc, field) => {
|
|
1194
|
-
const {
|
|
1195
|
-
valid,
|
|
1196
|
-
errors,
|
|
1197
|
-
data,
|
|
1198
|
-
fieldProblems: processedFieldProblems
|
|
1199
|
-
} = getProcessedState(field);
|
|
1200
|
-
return {
|
|
1201
|
-
...acc,
|
|
1202
|
-
data: { ...acc.data, [field]: data },
|
|
1203
|
-
valid: { ...acc.valid, [field]: valid },
|
|
1204
|
-
errors: { ...acc.errors, [field]: errors },
|
|
1205
|
-
fieldProblems: { ...acc.fieldProblems, [field]: processedFieldProblems }
|
|
1206
|
-
};
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
schema,
|
|
1210
|
-
data: {},
|
|
1211
|
-
valid: {},
|
|
1212
|
-
errors: {},
|
|
1213
|
-
fieldProblems: {},
|
|
1214
|
-
obscuredFields,
|
|
1215
|
-
optionalFields,
|
|
1216
|
-
trustedFields
|
|
1217
|
-
}
|
|
1218
|
-
);
|
|
1219
|
-
return formData;
|
|
1220
|
-
}
|
|
1221
|
-
function reducer({
|
|
1222
|
-
staticValidate,
|
|
1223
|
-
asyncValidate,
|
|
1224
|
-
obscuredFields,
|
|
1225
|
-
optionalFields,
|
|
1226
|
-
trustedFields,
|
|
1227
|
-
formatters
|
|
1228
|
-
}) {
|
|
1229
|
-
return (state, {
|
|
1230
|
-
type,
|
|
1231
|
-
key,
|
|
1232
|
-
mode,
|
|
1233
|
-
value,
|
|
1234
|
-
schema,
|
|
1235
|
-
selectedSchema,
|
|
1236
|
-
formValue,
|
|
1237
|
-
fieldProblems,
|
|
1238
|
-
defaultData
|
|
1239
|
-
}) => {
|
|
1240
|
-
const validationSchema = selectedSchema || state.schema;
|
|
1241
|
-
switch (type) {
|
|
1242
|
-
case "setData": {
|
|
1243
|
-
if (!key) return state;
|
|
1244
|
-
return { ...state, data: { ...state.data, [key]: value } };
|
|
1245
|
-
}
|
|
1246
|
-
case "setValid": {
|
|
1247
|
-
if (!key) return state;
|
|
1248
|
-
return { ...state, valid: { ...state.valid, [key]: value } };
|
|
1249
|
-
}
|
|
1250
|
-
case "setErrors": {
|
|
1251
|
-
if (!key) return state;
|
|
1252
|
-
return { ...state, errors: { ...state.errors, [key]: value } };
|
|
1253
|
-
}
|
|
1254
|
-
case "setFieldProblems": {
|
|
1255
|
-
return state?.schema?.reduce(
|
|
1256
|
-
(acc, field) => ({
|
|
1257
|
-
...acc,
|
|
1258
|
-
fieldProblems: {
|
|
1259
|
-
...state.fieldProblems,
|
|
1260
|
-
[field]: fieldProblems?.[field] ?? false
|
|
1261
|
-
},
|
|
1262
|
-
valid: { ...state.valid, [field]: state.valid?.[field] && !fieldProblems?.[field] }
|
|
1263
|
-
}),
|
|
1264
|
-
state
|
|
1265
|
-
);
|
|
1266
|
-
}
|
|
1267
|
-
case "setSchema": {
|
|
1268
|
-
if (!schema) return state;
|
|
1269
|
-
const defaultState = init({
|
|
1270
|
-
schema,
|
|
1271
|
-
// requiredFields
|
|
1272
|
-
defaultData,
|
|
1273
|
-
fieldProblems,
|
|
1274
|
-
obscuredFields,
|
|
1275
|
-
optionalFields,
|
|
1276
|
-
trustedFields,
|
|
1277
|
-
staticValidate,
|
|
1278
|
-
asyncValidate
|
|
1279
|
-
});
|
|
1280
|
-
const removedFields = state.optionalFields?.length ? [
|
|
1281
|
-
...state.schema.filter((field) => !schema.includes(field)),
|
|
1282
|
-
...state.optionalFields.filter((field) => !optionalFields?.includes(field))
|
|
1283
|
-
] : state.schema.filter((field) => !schema.includes(field));
|
|
1284
|
-
const newFields = optionalFields?.length ? [
|
|
1285
|
-
...schema.filter((field) => !state.schema?.includes(field)),
|
|
1286
|
-
...optionalFields.filter((field) => !state.optionalFields?.includes(field))
|
|
1287
|
-
] : schema.filter((field) => !state.schema?.includes(field));
|
|
1288
|
-
const local = {
|
|
1289
|
-
data: omitKeys(state.data, newFields),
|
|
1290
|
-
errors: omitKeys(state.errors, newFields),
|
|
1291
|
-
valid: omitKeys(state.valid, newFields),
|
|
1292
|
-
fieldProblems: omitKeys(state.fieldProblems, newFields)
|
|
1293
|
-
};
|
|
1294
|
-
const updatedData = addKeys(
|
|
1295
|
-
omitKeys(state.data, removedFields),
|
|
1296
|
-
newFields,
|
|
1297
|
-
null,
|
|
1298
|
-
defaultState.data,
|
|
1299
|
-
state.local?.data
|
|
1300
|
-
);
|
|
1301
|
-
const updatedValid = addKeys(
|
|
1302
|
-
omitKeys(state.valid, removedFields),
|
|
1303
|
-
newFields,
|
|
1304
|
-
false,
|
|
1305
|
-
defaultState.valid,
|
|
1306
|
-
state.local?.valid
|
|
1307
|
-
);
|
|
1308
|
-
const updatedErrors = addKeys(
|
|
1309
|
-
omitKeys(state.errors, removedFields),
|
|
1310
|
-
newFields,
|
|
1311
|
-
null,
|
|
1312
|
-
defaultState.errors,
|
|
1313
|
-
state.local?.errors
|
|
1314
|
-
);
|
|
1315
|
-
const updatedFieldProblems = addKeys(
|
|
1316
|
-
omitKeys(state.fieldProblems, removedFields),
|
|
1317
|
-
newFields,
|
|
1318
|
-
false,
|
|
1319
|
-
defaultState.fieldProblems,
|
|
1320
|
-
state.local?.fieldProblems
|
|
1321
|
-
);
|
|
1322
|
-
return {
|
|
1323
|
-
...state,
|
|
1324
|
-
schema,
|
|
1325
|
-
data: updatedData,
|
|
1326
|
-
valid: updatedValid,
|
|
1327
|
-
errors: updatedErrors,
|
|
1328
|
-
fieldProblems: updatedFieldProblems,
|
|
1329
|
-
obscuredFields,
|
|
1330
|
-
optionalFields,
|
|
1331
|
-
trustedFields,
|
|
1332
|
-
local
|
|
1333
|
-
};
|
|
1334
|
-
}
|
|
1335
|
-
case "updateField": {
|
|
1336
|
-
if (!key || !mode) return state;
|
|
1337
|
-
const [formattedValue, validation] = processField({
|
|
1338
|
-
key,
|
|
1339
|
-
value,
|
|
1340
|
-
mode,
|
|
1341
|
-
defaultData,
|
|
1342
|
-
formatters,
|
|
1343
|
-
fieldContext: { state },
|
|
1344
|
-
staticValidate,
|
|
1345
|
-
asyncValidate
|
|
1346
|
-
});
|
|
1347
|
-
const oldValue = state.data[key];
|
|
1348
|
-
const clearFieldProblems = oldValue !== formattedValue;
|
|
1349
|
-
return {
|
|
1350
|
-
...state,
|
|
1351
|
-
data: { ...state.data, [key]: formattedValue },
|
|
1352
|
-
errors: {
|
|
1353
|
-
...state.errors,
|
|
1354
|
-
[key]: validation.getError() ?? null
|
|
1355
|
-
},
|
|
1356
|
-
valid: {
|
|
1357
|
-
...state.valid,
|
|
1358
|
-
[key]: validation.isValid && !state.fieldProblems?.[key] || false
|
|
1359
|
-
},
|
|
1360
|
-
fieldProblems: {
|
|
1361
|
-
...state.fieldProblems,
|
|
1362
|
-
[key]: clearFieldProblems ? false : state.fieldProblems?.[key] ?? false
|
|
1363
|
-
}
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
case "mergeForm": {
|
|
1367
|
-
const mergedState = {
|
|
1368
|
-
...state,
|
|
1369
|
-
data: { ...state.data, ...formValue?.data },
|
|
1370
|
-
errors: { ...state.errors, ...formValue?.errors },
|
|
1371
|
-
valid: { ...state.valid, ...formValue?.valid },
|
|
1372
|
-
fieldProblems: { ...state.fieldProblems, ...formValue?.fieldProblems }
|
|
1373
|
-
};
|
|
1374
|
-
if (mergedState.valid) {
|
|
1375
|
-
mergedState.isValid = Object.values(mergedState.valid).every((isValid) => isValid);
|
|
1376
|
-
}
|
|
1377
|
-
return mergedState;
|
|
1378
|
-
}
|
|
1379
|
-
case "validateForm": {
|
|
1380
|
-
const formValidation = validationSchema?.reduce(
|
|
1381
|
-
(acc, cur) => {
|
|
1382
|
-
const [formattedValue, validation] = processField({
|
|
1383
|
-
key: cur,
|
|
1384
|
-
value: state.data[cur],
|
|
1385
|
-
mode: "blur",
|
|
1386
|
-
defaultData,
|
|
1387
|
-
formatters,
|
|
1388
|
-
fieldContext: { state },
|
|
1389
|
-
staticValidate,
|
|
1390
|
-
asyncValidate
|
|
1391
|
-
});
|
|
1392
|
-
const oldValue = state.data[cur];
|
|
1393
|
-
const clearFieldProblems = oldValue !== formattedValue;
|
|
1394
|
-
return {
|
|
1395
|
-
valid: {
|
|
1396
|
-
...acc.valid,
|
|
1397
|
-
[cur]: validation.isValid && !state.fieldProblems?.[cur] || false
|
|
1398
|
-
},
|
|
1399
|
-
errors: {
|
|
1400
|
-
...acc.errors,
|
|
1401
|
-
[cur]: validation.getError() ?? null
|
|
1402
|
-
},
|
|
1403
|
-
fieldProblems: {
|
|
1404
|
-
...acc.fieldProblems,
|
|
1405
|
-
[cur]: clearFieldProblems ? false : state.fieldProblems?.[cur] ?? false
|
|
1406
|
-
}
|
|
1407
|
-
};
|
|
1408
|
-
},
|
|
1409
|
-
{ valid: state.valid, errors: state.errors, fieldProblems: state.fieldProblems }
|
|
1410
|
-
);
|
|
1411
|
-
return {
|
|
1412
|
-
...state,
|
|
1413
|
-
valid: formValidation?.valid,
|
|
1414
|
-
errors: formValidation?.errors,
|
|
1415
|
-
fieldProblems: formValidation?.fieldProblems
|
|
1416
|
-
};
|
|
1417
|
-
}
|
|
1418
|
-
default:
|
|
1419
|
-
throw new Error("Undefined useForm action");
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
const mergeStaticAndAsyncErrorsState = (staticValidationErrors, asyncValidationErrors, schema, setValid, optionalFields) => {
|
|
1424
|
-
const fields = optionalFields ? [...schema, ...optionalFields] : schema;
|
|
1425
|
-
if (!fields.length) return staticValidationErrors;
|
|
1426
|
-
const errors = fields.reduce(
|
|
1427
|
-
(acc, field) => {
|
|
1428
|
-
if (asyncValidationErrors[field]?.getError()) setValid(field, false);
|
|
1429
|
-
return {
|
|
1430
|
-
...acc,
|
|
1431
|
-
[field]: staticValidationErrors[field] ?? asyncValidationErrors[field]?.getError() ?? null
|
|
1432
|
-
};
|
|
1433
|
-
},
|
|
1434
|
-
{}
|
|
1435
|
-
);
|
|
1436
|
-
return errors;
|
|
1437
|
-
};
|
|
1438
|
-
function useForm({
|
|
1439
|
-
schema,
|
|
1440
|
-
defaultData,
|
|
1441
|
-
rules,
|
|
1442
|
-
asyncRules,
|
|
1443
|
-
fieldProblems,
|
|
1444
|
-
obscuredFields,
|
|
1445
|
-
optionalFields,
|
|
1446
|
-
trustedFields,
|
|
1447
|
-
formatters,
|
|
1448
|
-
shouldValidate = false
|
|
1449
|
-
}) {
|
|
1450
|
-
const { triggerStaticValidation } = useStaticValidator(rules);
|
|
1451
|
-
const { triggerAsyncValidation, asyncValidationResults } = useAsyncValidator(asyncRules);
|
|
1452
|
-
const getRequiredFields = useMemo(
|
|
1453
|
-
() => typeof schema === "function" ? schema : () => schema,
|
|
1454
|
-
[schema]
|
|
1455
|
-
);
|
|
1456
|
-
const getSchema = useMemo(
|
|
1457
|
-
() => defaultData ? getRequiredFields(defaultData) : [],
|
|
1458
|
-
[defaultData, getRequiredFields]
|
|
1459
|
-
);
|
|
1460
|
-
const getReducer = useCallback(
|
|
1461
|
-
() => reducer({
|
|
1462
|
-
staticValidate: triggerStaticValidation,
|
|
1463
|
-
asyncValidate: triggerAsyncValidation,
|
|
1464
|
-
obscuredFields,
|
|
1465
|
-
optionalFields,
|
|
1466
|
-
trustedFields,
|
|
1467
|
-
formatters
|
|
1468
|
-
}),
|
|
1469
|
-
[
|
|
1470
|
-
triggerStaticValidation,
|
|
1471
|
-
triggerAsyncValidation,
|
|
1472
|
-
obscuredFields,
|
|
1473
|
-
optionalFields,
|
|
1474
|
-
trustedFields,
|
|
1475
|
-
formatters
|
|
1476
|
-
]
|
|
1477
|
-
);
|
|
1478
|
-
const initialData = useMemo(
|
|
1479
|
-
() => ({
|
|
1480
|
-
schema: getSchema,
|
|
1481
|
-
defaultData,
|
|
1482
|
-
fieldProblems,
|
|
1483
|
-
obscuredFields,
|
|
1484
|
-
optionalFields,
|
|
1485
|
-
trustedFields,
|
|
1486
|
-
formatters,
|
|
1487
|
-
staticValidate: triggerStaticValidation,
|
|
1488
|
-
asyncValidate: triggerAsyncValidation
|
|
1489
|
-
}),
|
|
1490
|
-
[
|
|
1491
|
-
getSchema,
|
|
1492
|
-
defaultData,
|
|
1493
|
-
fieldProblems,
|
|
1494
|
-
obscuredFields,
|
|
1495
|
-
optionalFields,
|
|
1496
|
-
trustedFields,
|
|
1497
|
-
formatters,
|
|
1498
|
-
triggerStaticValidation,
|
|
1499
|
-
triggerAsyncValidation
|
|
1500
|
-
]
|
|
1501
|
-
);
|
|
1502
|
-
const [state, dispatch] = useReducer(getReducer(), initialData, init);
|
|
1503
|
-
const isValid = useMemo(
|
|
1504
|
-
() => state.schema?.every((key) => state.valid[key]),
|
|
1505
|
-
[state.schema, state.valid]
|
|
1506
|
-
);
|
|
1507
|
-
const getTargetValue = useCallback(
|
|
1508
|
-
(key, e) => {
|
|
1509
|
-
if (!e?.target) return e;
|
|
1510
|
-
if (e.target.type === "checkbox") {
|
|
1511
|
-
return !state.data[key];
|
|
1512
|
-
}
|
|
1513
|
-
return e.target.value;
|
|
1514
|
-
},
|
|
1515
|
-
[state.data]
|
|
1516
|
-
);
|
|
1517
|
-
const setErrors = useCallback(
|
|
1518
|
-
(key, value) => dispatch({ type: "setErrors", key, value }),
|
|
1519
|
-
[]
|
|
1520
|
-
);
|
|
1521
|
-
const setValid = useCallback(
|
|
1522
|
-
(key, value) => dispatch({ type: "setValid", key, value }),
|
|
1523
|
-
[]
|
|
1524
|
-
);
|
|
1525
|
-
const setData = useCallback(
|
|
1526
|
-
(key, value) => dispatch({ type: "setData", key, value }),
|
|
1527
|
-
[]
|
|
1528
|
-
);
|
|
1529
|
-
const setSchema = useCallback(
|
|
1530
|
-
(newSchema) => dispatch({ type: "setSchema", schema: newSchema, defaultData }),
|
|
1531
|
-
[defaultData]
|
|
1532
|
-
);
|
|
1533
|
-
const setFieldProblems = useCallback(
|
|
1534
|
-
(newFieldProblems) => dispatch({ type: "setFieldProblems", fieldProblems: newFieldProblems }),
|
|
1535
|
-
[]
|
|
1536
|
-
);
|
|
1537
|
-
const mergeForm = useCallback(
|
|
1538
|
-
(formValue) => dispatch({ type: "mergeForm", formValue }),
|
|
1539
|
-
[]
|
|
1540
|
-
);
|
|
1541
|
-
const handleChangeFor = useCallback(
|
|
1542
|
-
(key, mode = "blur") => (e) => {
|
|
1543
|
-
const value = getTargetValue(key, e);
|
|
1544
|
-
dispatch({
|
|
1545
|
-
type: "updateField",
|
|
1546
|
-
key,
|
|
1547
|
-
value,
|
|
1548
|
-
mode,
|
|
1549
|
-
defaultData
|
|
1550
|
-
});
|
|
1551
|
-
},
|
|
1552
|
-
[defaultData, getTargetValue]
|
|
1553
|
-
);
|
|
1554
|
-
const triggerValidation = useCallback(
|
|
1555
|
-
(selectedSchema) => {
|
|
1556
|
-
dispatch({
|
|
1557
|
-
type: "validateForm",
|
|
1558
|
-
selectedSchema,
|
|
1559
|
-
defaultData
|
|
1560
|
-
});
|
|
1561
|
-
},
|
|
1562
|
-
[defaultData]
|
|
1563
|
-
);
|
|
1564
|
-
const resetToDefaultData = useCallback(() => {
|
|
1565
|
-
getSchema.forEach((field) => {
|
|
1566
|
-
if (!defaultData || typeof defaultData[field] !== "undefined") {
|
|
1567
|
-
return handleChangeFor(field)(defaultData?.[field]);
|
|
1568
|
-
}
|
|
1569
|
-
setValid(field, false);
|
|
1570
|
-
setErrors(field, null);
|
|
1571
|
-
setData(field, defaultData[field]);
|
|
1572
|
-
});
|
|
1573
|
-
}, [defaultData, getSchema, handleChangeFor, setData, setErrors, setValid]);
|
|
1574
|
-
useEffect(() => {
|
|
1575
|
-
const newSchema = getRequiredFields(state.data);
|
|
1576
|
-
if (!doArraysMatch(state.schema, newSchema)) {
|
|
1577
|
-
setSchema(newSchema);
|
|
1578
|
-
}
|
|
1579
|
-
}, [state.schema, state.data, setSchema, getRequiredFields]);
|
|
1580
|
-
useEffect(() => {
|
|
1581
|
-
if (shouldValidate) {
|
|
1582
|
-
triggerValidation();
|
|
1583
|
-
}
|
|
1584
|
-
}, [shouldValidate, state.schema]);
|
|
1585
|
-
useEffect(() => {
|
|
1586
|
-
if (fieldProblems) {
|
|
1587
|
-
setFieldProblems(fieldProblems);
|
|
1588
|
-
}
|
|
1589
|
-
}, [JSON.stringify(fieldProblems), setFieldProblems]);
|
|
1590
|
-
const formErrors = useMemo(
|
|
1591
|
-
() => mergeStaticAndAsyncErrorsState(
|
|
1592
|
-
state.errors,
|
|
1593
|
-
asyncValidationResults,
|
|
1594
|
-
state.schema,
|
|
1595
|
-
setValid,
|
|
1596
|
-
state.optionalFields
|
|
1597
|
-
),
|
|
1598
|
-
[asyncValidationResults, state.errors, state.optionalFields, state.schema]
|
|
1599
|
-
);
|
|
1600
|
-
return {
|
|
1601
|
-
mergeForm,
|
|
1602
|
-
setData,
|
|
1603
|
-
setValid,
|
|
1604
|
-
setErrors,
|
|
1605
|
-
setFieldProblems,
|
|
1606
|
-
handleChangeFor,
|
|
1607
|
-
triggerValidation,
|
|
1608
|
-
resetToDefaultData,
|
|
1609
|
-
isValid,
|
|
1610
|
-
schema: state.schema,
|
|
1611
|
-
valid: state.valid,
|
|
1612
|
-
errors: formErrors,
|
|
1613
|
-
data: state.data,
|
|
1614
|
-
fieldProblems: state.fieldProblems
|
|
1615
|
-
};
|
|
1616
|
-
}
|
|
1617
857
|
export {
|
|
1618
|
-
Field as F,
|
|
1619
|
-
LoaderWrapper as L,
|
|
1620
858
|
Select as S,
|
|
1621
|
-
|
|
1622
|
-
SelectListItem as a,
|
|
1623
|
-
getDataByFields as g,
|
|
1624
|
-
useForm as u
|
|
859
|
+
SelectListItem as a
|
|
1625
860
|
};
|