@incodetech/core 2.4.1 → 2.5.0-agentic.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.
- package/dist/Actor-DqjOqDfU.d.ts +1 -0
- package/dist/{BaseWasmProvider-Bq3OHo7P.d.ts → BaseWasmProvider-CPdofn7R.d.ts} +3 -5
- package/dist/BrowserNetworkStatusProvider-BrDXBEDd.esm.js +21 -0
- package/dist/{multipartRecordingService-CLwrF5wD.esm.js → CameraCompositor-C7N1N61V.esm.js} +61 -744
- package/dist/DateFormattingProvider-DPq9zco-.esm.js +25 -0
- package/dist/{FaceDetectionProvider-J_-1Cwck.esm.js → FaceDetectionProvider-Cy2EAL0i.esm.js} +38 -66
- package/dist/IBrowserEnvironmentCapability-D7JG7ML3.esm.js +16 -0
- package/dist/IGeolocationCapability-r49Qo7rR.d.ts +10 -0
- package/dist/{IIdCaptureCapability-CGcEt2Cw.d.ts → IIdCaptureCapability-BRAZQtkM.d.ts} +4 -3
- package/dist/{IWasmUtilCapability-GF2n7sfm.d.ts → IWasmUtilCapability-CLWIYHB4.d.ts} +35 -7
- package/dist/Manager-BvXAwDv9.esm.js +125 -0
- package/dist/{Manager-C9T5amUN.d.ts → Manager-DufwKlav.d.ts} +1 -7
- package/dist/{MotionSensorProvider-DYxh8TjR.esm.js → MotionSensorProvider-BAGydZPH.esm.js} +20 -0
- package/dist/MultipartRecordingProvider-BtMQZEbg.esm.js +151 -0
- package/dist/{PhoneValidationProvider-SZiOS0jB.esm.js → PhoneValidationProvider-Co4zk2en.esm.js} +7 -0
- package/dist/{StreamCanvasCapture-7JRf-2ck.d.ts → StreamCanvasCapture-BqaHTJF0.d.ts} +36 -5
- package/dist/{StreamCanvasCapture-C9jtgBdT.esm.js → StreamCanvasCapture-CXd87trH.esm.js} +18 -3
- package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +42 -0
- package/dist/{WasmUtilProvider-DtJuBdt-.esm.js → WasmUtilProvider-C4x5gc1c.esm.js} +135 -25
- package/dist/WorkerEncoderRecordingProvider-BO7urYwT.esm.js +80 -0
- package/dist/addressSearch-DBJeg_g3.esm.js +301 -0
- package/dist/{advanceableErrors-q_pfU3Cn.esm.js → advanceableErrors-CxZyPRyh.esm.js} +4 -2
- package/dist/ae-signature.d.ts +2 -2
- package/dist/ae-signature.esm.js +1 -1
- package/dist/allowedCharacters-Bnir--CN.esm.js +17 -0
- package/dist/antifraud.d.ts +1 -1
- package/dist/antifraud.esm.js +2 -2
- package/dist/{antifraudManager-DbGCvlJs.d.ts → antifraudManager-BxfCsyA7.d.ts} +3 -3
- package/dist/{antifraudManager-CaweCYnY.esm.js → antifraudManager-DRMBLSh7.esm.js} +5 -3
- package/dist/{antifraudStateMachine-DRl0UVyA.esm.js → antifraudStateMachine-Bi0m60oV.esm.js} +4 -6
- package/dist/{api-Cz90EHyu.esm.js → api-B58edv6M.esm.js} +13 -7
- package/dist/{apiError-9Yi8xMeB.esm.js → apiError-B9-B3cMq.esm.js} +1 -1
- package/dist/attemptCarry-CxiYlUAO.esm.js +45 -0
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-BIZC55Bi.d.ts → authenticationManager-CkD0JR7Q.d.ts} +2 -2
- package/dist/{authenticationManager-pKQS4fHT.esm.js → authenticationManager-DNWtc0eq.esm.js} +7 -6
- package/dist/{authenticationStateMachine-D_DygKtQ.esm.js → authenticationStateMachine-CJ9i4Al-.esm.js} +50 -18
- package/dist/avatar.d.ts +1 -1
- package/dist/backCameraLabel-yda5ugE4.esm.js +67 -0
- package/dist/{backCameraStream-CMvXj4X4.esm.js → backCameraStream-6qVHvj76.esm.js} +12 -107
- package/dist/{browser-DlFgHpoC-DnyrCR8r.esm.js → browser-pQZA35G2-B4Dwja1e.esm.js} +161 -150
- package/dist/calendarDate-D2zWfUlA.esm.js +35 -0
- package/dist/{callback-645_omgz.d.ts → callback-BmjJ1G-5.d.ts} +1 -1
- package/dist/camera-9yYDUOsO.d.ts +5 -0
- package/dist/{camera-sIa9ceW2.esm.js → camera-CJKApt0x.esm.js} +19 -20
- package/dist/camera.d.ts +9 -5
- package/dist/camera.esm.js +1 -1
- package/dist/certificate-issuance.d.ts +1 -1
- package/dist/certificate-issuance.esm.js +2 -2
- package/dist/{certificateIssuanceManager-Dr8A4Lgr.d.ts → certificateIssuanceManager-BcYhxO63.d.ts} +4 -3
- package/dist/{certificateIssuanceManager-BfeMv2PU.esm.js → certificateIssuanceManager-Ctj6AJC7.esm.js} +5 -3
- package/dist/{certificateIssuanceStateMachine-Frgjbjw8.esm.js → certificateIssuanceStateMachine-DDqN9kvL.esm.js} +4 -4
- package/dist/cnpj-CVq3vL39.esm.js +71 -0
- package/dist/cnpj-D5cxwIe-.esm.js +9 -0
- package/dist/connectivity-BCuEoQ-n.esm.js +114 -0
- package/dist/consent.d.ts +1 -1
- package/dist/consent.esm.js +2 -2
- package/dist/{consentManager-Ca8FHlC4.d.ts → consentManager-B0YKqYtZ.d.ts} +20 -12
- package/dist/{consentManager-CvEu8h_W.esm.js → consentManager-CyoeiABc.esm.js} +7 -4
- package/dist/{consentStateMachine-DJTgN_-1.esm.js → consentStateMachine-BTUrAslr.esm.js} +25 -15
- package/dist/cpf-DDXMTLYr.esm.js +37 -0
- package/dist/{createFaceAvatar-lYX0VTYs.d.ts → createFaceAvatar-Ct9QrQ66.d.ts} +1 -1
- package/dist/cross-document-data-match.d.ts +1 -1
- package/dist/cross-document-data-match.esm.js +1 -1
- package/dist/{crossDocumentDataMatchManager-Cu141CE8.esm.js → crossDocumentDataMatchManager-cmQmp7Bi.esm.js} +6 -5
- package/dist/{crossDocumentDataMatchManager-yCWCOzcU.d.ts → crossDocumentDataMatchManager-crZcIUSY.d.ts} +3 -3
- package/dist/curp-DZGvefg3.esm.js +14 -0
- package/dist/curp-validation.d.ts +1 -1
- package/dist/curp-validation.esm.js +2 -2
- package/dist/{curpValidationManager-B-z9q5V3.esm.js → curpValidationManager-EW44fVpH.esm.js} +6 -3
- package/dist/{curpValidationManager-C9sqoh9n.d.ts → curpValidationManager-HOidAKvT.d.ts} +4 -4
- package/dist/{curpValidationStateMachine-vDEFLMPw.esm.js → curpValidationStateMachine-BFkt90Zs.esm.js} +41 -34
- package/dist/custom-fields.d.ts +1 -1
- package/dist/custom-fields.esm.js +1 -1
- package/dist/custom-watchlist.d.ts +1 -1
- package/dist/custom-watchlist.esm.js +2 -2
- package/dist/{customFieldsManager-CF-cO8ap.d.ts → customFieldsManager-CdWTbsew.d.ts} +3 -3
- package/dist/{customFieldsManager-D1ex2cFM.esm.js → customFieldsManager-DPMBJrcH.esm.js} +15 -17
- package/dist/{customWatchlistManager-CTI-SGk0.esm.js → customWatchlistManager-DiYpPjZx.esm.js} +5 -3
- package/dist/{customWatchlistManager-DolUswyR.d.ts → customWatchlistManager-lJrveDS4.d.ts} +3 -3
- package/dist/{customWatchlistStateMachine-hmRd0f2I.esm.js → customWatchlistStateMachine-D7VxQggF.esm.js} +4 -6
- package/dist/deepsightCaptureConfig-BxD3mSac.esm.js +70 -0
- package/dist/{deepsightService-C3DVBOZd.esm.js → deepsightLoader-KYZP8_x-.esm.js} +41 -74
- package/dist/definitionSource-B9WTvQb9.esm.js +30 -0
- package/dist/{createCameraCycleOwnership-Dj_LHUvN.esm.js → desktopCameraElection-BGQRIA2u.esm.js} +278 -44
- package/dist/device.d.ts +3 -3
- package/dist/device.esm.js +16 -16
- package/dist/document-capture.d.ts +3 -3
- package/dist/document-capture.esm.js +2 -2
- package/dist/document-signature.d.ts +123 -0
- package/dist/document-signature.esm.js +149 -0
- package/dist/{documentCaptureManager-DUJwpKC5.esm.js → documentCaptureManager-SRG6YEMh.esm.js} +30 -20
- package/dist/{documentCaptureManager-DkyDtm3Y.d.ts → documentCaptureManager-sJWgqtUy.d.ts} +42 -8
- package/dist/{documentCaptureStateMachine-B8i7GnLh.esm.js → documentCaptureStateMachine-Bh0uyfGq.esm.js} +110 -63
- package/dist/documentSignatureStateMachine-CLljjltG.esm.js +219 -0
- package/dist/dynamic-forms.d.ts +2 -2
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-C0dHs1ty.d.ts → dynamicFormsManager-C45pTncO.d.ts} +4 -4
- package/dist/{dynamicFormsManager-DK_oc5Oy.esm.js → dynamicFormsManager-CnU2hRvl.esm.js} +5 -3
- package/dist/{dynamicFormsStateMachine-CGlIAWZ6.esm.js → dynamicFormsStateMachine-huYmjamB.esm.js} +12 -13
- package/dist/ekyb.d.ts +5 -5
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-BLgkiWXw.esm.js → ekybManager-CaEErq39.esm.js} +5 -3
- package/dist/{ekybManager-BaZ_7CEu.d.ts → ekybManager-Cjk8pQX0.d.ts} +5 -5
- package/dist/ekybStateMachine-BIU8KIMv.esm.js +2173 -0
- package/dist/ekybUtils-Dl0MU-ib.esm.js +172 -0
- package/dist/ekyc-prefill.d.ts +17 -0
- package/dist/ekyc-prefill.esm.js +3 -0
- package/dist/ekyc.d.ts +4 -3
- package/dist/ekyc.esm.js +3 -3
- package/dist/{ekycManager-BO-Lui3t.esm.js → ekycManager-D2K8AaMV.esm.js} +39 -16
- package/dist/{ekycManager-DW-ynodd.d.ts → ekycManager-DusmB-4j.d.ts} +49 -7
- package/dist/ekycPrefillManager-BwmPXfhY.d.ts +566 -0
- package/dist/ekycPrefillManager-CENQjdNq.esm.js +102 -0
- package/dist/ekycPrefillStateMachine-jT3hIt2X.esm.js +1289 -0
- package/dist/ekycStateMachine-6EKndBd7.esm.js +9024 -0
- package/dist/ekycUtils-C6HZB46m.esm.js +1532 -0
- package/dist/electronic-signature.d.ts +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-DTSLOvKR.d.ts → electronicSignatureManager-5tYz-a4o.d.ts} +4 -3
- package/dist/{electronicSignatureManager-CjKvJ6E-.esm.js → electronicSignatureManager-wM8WTgzP.esm.js} +12 -18
- package/dist/email.d.ts +1 -1
- package/dist/email.esm.js +2 -2
- package/dist/{emailManager-ButFktRm.esm.js → emailManager-BBdRYLtH.esm.js} +5 -3
- package/dist/{emailManager-Dy6omJVp.d.ts → emailManager-pM7ZPuMa.d.ts} +3 -3
- package/dist/{emailStateMachine-BXtlC0NV.esm.js → emailStateMachine-DO7lWYvn.esm.js} +35 -25
- package/dist/events-PUWyizJn.esm.js +299 -0
- package/dist/events.d.ts +4 -4
- package/dist/events.esm.js +2 -1
- package/dist/extensibility.d.ts +57 -41
- package/dist/extensibility.esm.js +39 -37
- package/dist/{externalFetch-DrR9xshk.esm.js → externalFetch-cUjJYyXj.esm.js} +4 -1
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +2 -2
- package/dist/{faceCaptureManagerFactory-1hzeS_rB.d.ts → faceCaptureManagerFactory-D1EJw36F.d.ts} +101 -77
- package/dist/{faceCaptureManagerFactory-BDGhg24q.esm.js → faceCaptureManagerFactory-DbEARG3h.esm.js} +29 -12
- package/dist/{faceCaptureSetup-CvGYG4GZ.esm.js → faceCaptureSetup-VaAjMpWX.esm.js} +189 -513
- package/dist/{faceMatchManager-DIgG-UFS.d.ts → faceMatchManager-C5b5WtcY.d.ts} +23 -7
- package/dist/{faceMatchManager-DWFUQjMQ.esm.js → faceMatchManager-nBvS9z0o.esm.js} +5 -3
- package/dist/{faceMatchStateMachine-CUCvlydD.esm.js → faceMatchStateMachine-48O8j_Lx.esm.js} +70 -42
- package/dist/{feature-management-D4ne_hXW.esm.js → feature-management-D7oLtULO.esm.js} +37 -22
- package/dist/feature-management.esm.js +1 -1
- package/dist/field-comparison.d.ts +1 -1
- package/dist/field-comparison.esm.js +1 -1
- package/dist/{fieldComparisonManager-v3knTYV_.esm.js → fieldComparisonManager-B1ipvtnp.esm.js} +7 -7
- package/dist/{fieldComparisonManager-CUX4gza2.d.ts → fieldComparisonManager-mFOHRhVd.d.ts} +3 -3
- package/dist/fiscal-qr.d.ts +1 -1
- package/dist/fiscal-qr.esm.js +1 -1
- package/dist/{fiscalQrManager-D0Iy7EKR.d.ts → fiscalQrManager-DFnFVpP9.d.ts} +3 -3
- package/dist/{fiscalQrManager-Dt9fHG7h.esm.js → fiscalQrManager-yecjuXV4.esm.js} +9 -8
- package/dist/flow-events.d.ts +1 -1
- package/dist/flow.d.ts +73 -24
- package/dist/flow.esm.js +261 -66
- package/dist/{flowCompletionService-Cemwaa5b.esm.js → flowCompletionService-CIjaIpMH.esm.js} +2 -2
- package/dist/flowServices-Dqt75TXx.esm.js +951 -0
- package/dist/formErrors-lSfh7Y8J.esm.js +512 -0
- package/dist/geolocation.d.ts +1 -1
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-Dn24g1fl.d.ts → geolocationManager-CENrvxpK.d.ts} +19 -20
- package/dist/{geolocationManager-B0dc5rW9.esm.js → geolocationManager-DHfgXhEs.esm.js} +9 -9
- package/dist/{geolocationStateMachine-B3rcoODF.esm.js → geolocationStateMachine-CrEspaN-.esm.js} +16 -14
- package/dist/{getDeviceClass-bsWdEDxP.esm.js → getDeviceClass-Dcy9erbl.esm.js} +1 -1
- package/dist/government-validation.d.ts +1 -1
- package/dist/government-validation.esm.js +2 -2
- package/dist/{governmentValidationManager-BtXWHICu.esm.js → governmentValidationManager-0-L21hu6.esm.js} +5 -3
- package/dist/{governmentValidationManager-B82zOut8.d.ts → governmentValidationManager-De_vU7bm.d.ts} +4 -4
- package/dist/{governmentValidationStateMachine-COL-Vs48.esm.js → governmentValidationStateMachine-BFIcq3UB.esm.js} +4 -6
- package/dist/home.d.ts +4 -3
- package/dist/home.esm.js +4 -2
- package/dist/http.esm.js +1 -1
- package/dist/id-ocr.d.ts +2 -2
- package/dist/id-ocr.esm.js +3 -3
- package/dist/id-selfie-flow.d.ts +7 -6
- package/dist/id-selfie-flow.esm.js +14 -12
- package/dist/id-verification.d.ts +1 -1
- package/dist/id-verification.esm.js +2 -2
- package/dist/id.d.ts +6 -19
- package/dist/id.esm.js +4 -4
- package/dist/{idCaptureDefaults-BGsG2OAs.esm.js → idCaptureDefaults-CNopPetU.esm.js} +17 -7
- package/dist/{idCaptureManager-IouAnrFm.esm.js → idCaptureManager-BPDCAV04.esm.js} +95 -34
- package/dist/{idCaptureManager-0M02hSuC.d.ts → idCaptureManager-CNFBeYgV.d.ts} +105 -16
- package/dist/{idCaptureServices-VTKIPSpT.esm.js → idCaptureServices-CWZFmS7l.esm.js} +36 -213
- package/dist/{idCaptureStateMachine-_Pn2Xkpb.esm.js → idCaptureStateMachine-Cyt2BvPB.esm.js} +3081 -2510
- package/dist/{idOcrManager-DT3kPIB3.d.ts → idOcrManager-DflRx-_u.d.ts} +6 -5
- package/dist/{idOcrManager-D3-HNMXP.esm.js → idOcrManager-bjBLjrEE.esm.js} +5 -3
- package/dist/{idOcrStateMachine-DyENX6Ki.esm.js → idOcrStateMachine-D5ifJ1B8.esm.js} +20 -16
- package/dist/{idVerificationManager-BJapZfpy.d.ts → idVerificationManager-B6R8xNZq.d.ts} +4 -3
- package/dist/{idVerificationManager-iWz7Avkr.esm.js → idVerificationManager-C8Ja-vKq.esm.js} +5 -3
- package/dist/{idVerificationStateMachine-CL1kUdBe.esm.js → idVerificationStateMachine-BMnfZZli.esm.js} +4 -6
- package/dist/identity-reuse.d.ts +2 -2
- package/dist/identity-reuse.esm.js +2 -2
- package/dist/identity-search.d.ts +97 -0
- package/dist/identity-search.esm.js +96 -0
- package/dist/{identityReuseManager-CD1ucp1d.esm.js → identityReuseManager-B5BWAleT.esm.js} +9 -4
- package/dist/{identityReuseManager-ooAbp6Kc.d.ts → identityReuseManager-CZ-qJ_Aa.d.ts} +82 -15
- package/dist/{identityReuseStateMachine-DfV81wQC.esm.js → identityReuseStateMachine-Cuggm1UP.esm.js} +24 -31
- package/dist/{index-BKOWUhxG.d.ts → index-BMr3MZEI.d.ts} +93 -22
- package/dist/{index-CKQ9QBZP.d.ts → index-BoGlwLGK.d.ts} +2 -2
- package/dist/index-DHuAkTe0.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/{invokeOnCaptureCallback-DYrkOXO6.esm.js → invokeOnCaptureCallback-D2FOfi4O.esm.js} +1 -1
- package/dist/kyb-checks.d.ts +3 -0
- package/dist/kyb-checks.esm.js +3 -0
- package/dist/kybChecksManager-BF2vf0Q2.esm.js +90 -0
- package/dist/kybChecksManager-CKDy1mel.d.ts +95 -0
- package/dist/kybChecksStateMachine-oBQfgdka.esm.js +713 -0
- package/dist/mandatory-consent.d.ts +2 -2
- package/dist/mandatory-consent.esm.js +2 -2
- package/dist/{mandatoryConsentManager-qYojnZYg.d.ts → mandatoryConsentManager-BcxCesP5.d.ts} +30 -13
- package/dist/{mandatoryConsentManager-Cwqx1nK7.esm.js → mandatoryConsentManager-FfgHdPYw.esm.js} +7 -4
- package/dist/{mandatoryConsentStateMachine-pXWqAHo_.esm.js → mandatoryConsentStateMachine-CXuYC3qR.esm.js} +35 -19
- package/dist/mediaRecorderOptions-Di_V9TnZ.esm.js +87 -0
- package/dist/multipartRecordingService-CFmOUGQt.esm.js +407 -0
- package/dist/numericRange-2e1vw1W0.esm.js +256 -0
- package/dist/{permissionGuards-gcy3U0SL.esm.js → permissionGuards-CZTCRHT-.esm.js} +1 -1
- package/dist/{permissionServices-Ca-tSNhT.esm.js → permissionServices-Vd86JiW9.esm.js} +47 -19
- package/dist/phone-number.d.ts +7 -1
- package/dist/phone-number.esm.js +15 -2
- package/dist/phone.d.ts +1 -1
- package/dist/phone.esm.js +2 -2
- package/dist/{phoneManager-BO-LTih5.d.ts → phoneManager-bA-xw2TP.d.ts} +8 -11
- package/dist/{phoneManager-KKUq-Vgo.esm.js → phoneManager-oIMdbeLG.esm.js} +8 -7
- package/dist/phoneServices-Dk4j3NhI.esm.js +63 -0
- package/dist/{phoneStateMachine-D2QWS2cu.esm.js → phoneStateMachine-Cu3y7ewi.esm.js} +57 -90
- package/dist/{phoneValidation-DnBcNUNh.esm.js → phoneValidation-OggtfjRt.esm.js} +1 -2
- package/dist/{platform-DkcRc9JV.esm.js → platform-GIg4uPWe.esm.js} +15 -4
- package/dist/processFaceMatch-CHeI0DEt.esm.js +21 -0
- package/dist/qe-signature.d.ts +2 -2
- package/dist/qe-signature.esm.js +1 -1
- package/dist/recordingService-DK3kjUby.esm.js +404 -0
- package/dist/redirect-to-mobile.d.ts +2 -2
- package/dist/redirect-to-mobile.esm.js +2 -2
- package/dist/{redirectToMobileManager-CVsvpVbQ.d.ts → redirectToMobileManager-Db99n9Yu.d.ts} +7 -4
- package/dist/{redirectToMobileManager-uHW3dyuQ.esm.js → redirectToMobileManager-yYJGE47m.esm.js} +10 -6
- package/dist/{redirectToMobileStateMachine-b-H-ipGM.esm.js → redirectToMobileStateMachine-g_NbyHrL.esm.js} +82 -46
- package/dist/resolveForm-DaaQSVWp.esm.js +146 -0
- package/dist/{runChildModule-DSpP41Hl.esm.js → runChildModule-x1rrxjYY.esm.js} +9 -7
- package/dist/{sdkVersion-DKHwWEyH.esm.js → sdkVersion-kRh5h82H.esm.js} +1 -1
- package/dist/selfie.d.ts +6 -6
- package/dist/selfie.esm.js +15 -13
- package/dist/{selfieErrorUtils-DoN1KFSQ.esm.js → selfieErrorUtils-B9GfiS9f.esm.js} +1 -1
- package/dist/{selfieManager-DtQegA6T.esm.js → selfieManager-CivYjnF5.esm.js} +7 -6
- package/dist/{selfieManager-BJdNu_nd.d.ts → selfieManager-CqDlUy6B.d.ts} +2 -2
- package/dist/{selfieStateMachine-CnCwJZuC.esm.js → selfieStateMachine-dLwrXWll.esm.js} +5 -5
- package/dist/{session-CNUfjlRc.esm.js → session-DeJ-rd9u.esm.js} +78 -9
- package/dist/session.d.ts +85 -9
- package/dist/session.esm.js +7 -6
- package/dist/{sessionInitializer-JM_glXR2.esm.js → sessionInitializer-uZgyxsrL.esm.js} +442 -208
- package/dist/{setup-YPKTUCY5.d.ts → setup-Cr2KCwau.d.ts} +7 -6
- package/dist/{setup-C5tfWt6W.esm.js → setup-D0QZHkS8.esm.js} +42 -29
- package/dist/signature.d.ts +1 -1
- package/dist/signature.esm.js +2 -2
- package/dist/{signatureManager-f_dPAGXn.esm.js → signatureManager-DRUflksL.esm.js} +5 -3
- package/dist/{signatureManager-BpVt_Jv7.d.ts → signatureManager-daT_8fj_.d.ts} +3 -3
- package/dist/{signatureStateMachine-C-nUq_oq.esm.js → signatureStateMachine-BQZenxel.esm.js} +5 -7
- package/dist/{spawn-D9jgw9pW.d.ts → spawn-COZKetCS.d.ts} +1 -1
- package/dist/{stats-BEvexnKC.esm.js → stats-DHu3li6G.esm.js} +1 -1
- package/dist/stats.esm.js +1 -1
- package/dist/step-up.d.ts +379 -0
- package/dist/step-up.esm.js +640 -0
- package/dist/{tri-xzRLIIMN.esm.js → tri-D_gHPWrq.esm.js} +137 -8
- package/dist/tri.d.ts +2 -2
- package/dist/tri.esm-CftnGf9w.esm.js +3115 -0
- package/dist/tri.esm.js +2 -2
- package/dist/trueSight-CbrZUzLx.esm.js +1 -0
- package/dist/{trueSightService-fLmL_cyg.esm.js → trueSightService-BMp8g65B.esm.js} +25 -16
- package/dist/trust-graph.d.ts +87 -27
- package/dist/trust-graph.esm.js +6 -25
- package/dist/trustGraphStateMachine-0Ehwried.esm.js +58 -0
- package/dist/types-B9C8W01q.d.ts +34 -0
- package/dist/types-BNkzXOXE.d.ts +45 -0
- package/dist/{types-B6HsSzpk.d.ts → types-BZsmNYom.d.ts} +77 -9
- package/dist/types-BinnzVrL.d.ts +6 -0
- package/dist/{types-CJ7Yl9K-.d.ts → types-Bpo97EOh.d.ts} +4 -2
- package/dist/{types-0L-eFDmr.d.ts → types-BwMpWCVG.d.ts} +6 -2
- package/dist/{types-BQA7lRDV.d.ts → types-C3rfDzgE.d.ts} +4 -2
- package/dist/types-CXTDuzUJ.d.ts +16 -0
- package/dist/{types-BEwVKkLJ.d.ts → types-CeEcakO7.d.ts} +7 -1
- package/dist/{types-DUnFZ08M.d.ts → types-Cy6Lx3L6.d.ts} +18 -10
- package/dist/{types-BAxn7MpY.d.ts → types-D-FEM1rT.d.ts} +156 -58
- package/dist/types-D6Q1D1kx.d.ts +33 -0
- package/dist/{events-Du2A4-Qr.esm.js → types-DLsivQsu.esm.js} +6 -303
- package/dist/{types-DPIDuhut.d.ts → types-DNVzoRvi.d.ts} +2 -1
- package/dist/types-DWqO7owj.d.ts +58 -0
- package/dist/{types-yPH8lAH-.d.ts → types-HHgsFhZn.d.ts} +16 -3
- package/dist/{types-Ckir_BEs.d.ts → types-LbccjQYX.d.ts} +3 -2
- package/dist/{types-CK8Jbjkp.d.ts → types-PnJXvTkV.d.ts} +1 -1
- package/dist/types-g3NuVCT9.d.ts +118 -0
- package/dist/types-tOSLpcSa.d.ts +231 -0
- package/dist/urlUtils-B2wagB5v.esm.js +39 -0
- package/dist/usStates-CwOQ2kAx.esm.js +209 -0
- package/dist/video-selfie.d.ts +27 -17
- package/dist/video-selfie.esm.js +105 -26
- package/dist/{videoSelfieCameraWarmer-BBNKiau1.esm.js → videoSelfieCameraWarmer-BpP0_lDr.esm.js} +47 -29
- package/dist/{videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js → videoSelfieFlowModuleMachine-IWdxw1TW.esm.js} +1 -1
- package/dist/{videoSelfieStepDetector-CGsTltqB.d.ts → videoSelfieStepDetector-CxOc3kSI.d.ts} +24 -9
- package/dist/virtualCameraCheck-eFOm2C9q.esm.js +27 -0
- package/dist/{warmup-BElYWRh7.esm.js → warmup-ClZxXOkg.esm.js} +378 -57
- package/dist/{warmup-BO57syF6.d.ts → warmup-SWu5L7cW.d.ts} +19 -2
- package/dist/wasm.d.ts +9 -3
- package/dist/wasm.esm.js +3 -3
- package/dist/wasmDeepsightConfigSync-DukEcrU8.esm.js +77 -0
- package/dist/{wasmDsFlagSync-CYj5LL9z.esm.js → wasmDsFlagSync-Bw-P5OG1.esm.js} +1 -1
- package/dist/{wasmWebClient-BjZw_7OB.esm.js → wasmWebClient-BLtlzQhv.esm.js} +77 -29
- package/dist/watchlist-for-business.d.ts +2 -1
- package/dist/watchlist-for-business.esm.js +2 -2
- package/dist/watchlist.d.ts +1 -1
- package/dist/watchlist.esm.js +2 -2
- package/dist/{watchlistForBusinessManager-CZZOFkGl.esm.js → watchlistForBusinessManager-d8kdf35n.esm.js} +40 -8
- package/dist/{watchlistForBusinessManager-B3GDPZrr.d.ts → watchlistForBusinessManager-l7ZERQcV.d.ts} +57 -21
- package/dist/watchlistForBusinessStateMachine-Y9wFmuMH.esm.js +170 -0
- package/dist/{watchlistManager-DXtX94SN.esm.js → watchlistManager-D1BVrd3H.esm.js} +5 -3
- package/dist/{watchlistManager-DJQOd8Pw.d.ts → watchlistManager-DQq4GxBO.d.ts} +3 -3
- package/dist/{watchlistStateMachine-McALifag.esm.js → watchlistStateMachine-Da4p0sTE.esm.js} +4 -6
- package/dist/workflow.d.ts +10 -6
- package/dist/workflow.esm.js +95 -60
- package/dist/{xstate-actors.esm-8Gzepa_A.esm.js → xstate-actors.esm-BCcwgosu.esm.js} +1 -1
- package/dist/xstate.cjs-D6Ur0X1F.d.ts +7 -0
- package/dist/{xstate.esm-DSajW7CJ.esm.js → xstate.esm-CIqUf_i6.esm.js} +1 -125
- package/package.json +34 -7
- package/dist/Actor-DpTj5PFb.d.ts +0 -1
- package/dist/IBrowserEnvironmentCapability-DEaRRk-R.esm.js +0 -9
- package/dist/addressSearch-DPjIKJrX.esm.js +0 -563
- package/dist/camera-9wWD-pwg.d.ts +0 -4
- package/dist/cpf-uAZTPUBy.esm.js +0 -61
- package/dist/deepsightLoader-sH7920zw.esm.js +0 -55
- package/dist/ekybStateMachine-BfgOUZMK.esm.js +0 -933
- package/dist/ekycStateMachine-CDnI_NRq.esm.js +0 -1443
- package/dist/ekycUtils-zY8CdKJL.esm.js +0 -300
- package/dist/flowServices-X6Rwf_7E.esm.js +0 -688
- package/dist/index-DpTj5PFb.d.ts +0 -1
- package/dist/thumbmark.esm-CRc0cYvz.esm.js +0 -1242
- package/dist/tri.esm-BIjHhBJ2.esm.js +0 -2620
- package/dist/types-BvLo3U4u.d.ts +0 -134
- package/dist/types-zOgZqMni.d.ts +0 -6
- package/dist/urlUtils-6jsE6rKp.esm.js +0 -23
- package/dist/watchlistForBusinessStateMachine-B66E7jud.esm.js +0 -78
- /package/dist/{types-BSBzhHRH2.d.ts → types-BSBzhHRH.d.ts} +0 -0
|
@@ -1,933 +0,0 @@
|
|
|
1
|
-
import { t as api, u as endpoints } from "./api-Cz90EHyu.esm.js";
|
|
2
|
-
import { A as isSupportedCountry, C as COUNTRIES_WITH_CNPJ_VALIDATION, D as INVALID_CNPJ_PATTERNS, E as FIELD_ORDER, S as CNPJ_SECOND_DIGIT_FACTORS, T as FIELD_NAME_MAPPING, _ as sortModulesByOrder, b as ALL_COUNTRIES, g as requiresAddressValidation, h as isFieldOptional, k as UBO_FIELD_LABELS, m as hasAtLeastOneAddressField, n as getFlow, v as toEkybConfig, x as CNPJ_FIRST_DIGIT_FACTORS, y as ADDRESS_FIELDS } from "./flowServices-X6Rwf_7E.esm.js";
|
|
3
|
-
import { i as assign, t as setup } from "./xstate.esm-DSajW7CJ.esm.js";
|
|
4
|
-
import { n as fromPromise } from "./xstate-actors.esm-8Gzepa_A.esm.js";
|
|
5
|
-
import { a as FIXED_DIGIT_POSTAL_CODE_LENGTH, c as getPostalCodeMaxLength, d as STREET_LEVEL_REQUIRED_ERROR, f as fillFromSuggestion, i as checkSupport, l as validatePostalCode, m as usStateOptions, n as resolveForm, o as formatPostalCode, p as getStreetLevelErrorForSuggestion, r as createBundledDefinitionSource, s as getPostalCodeErrorKey, t as debounceSearchActor, u as DYNAMIC_REQUIRED_KEY } from "./addressSearch-DPjIKJrX.esm.js";
|
|
6
|
-
//#region src/modules/ekyb/ekybValidators.ts
|
|
7
|
-
function cleanCnpjString(cnpj) {
|
|
8
|
-
return cnpj.replace(/\./g, "").replace(/\//g, "").replace(/-/g, "");
|
|
9
|
-
}
|
|
10
|
-
function calculateVerificationDigit(cnpjString, factors) {
|
|
11
|
-
let digit = 11 - factors.reduce((acc, factor, index) => acc + Number.parseInt(cnpjString.charAt(index), 10) * factor, 0) % 11;
|
|
12
|
-
if (digit >= 10) digit = 0;
|
|
13
|
-
return digit.toString();
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Validates a Brazilian CNPJ number (14-digit checksum).
|
|
17
|
-
* Accepts formatted (00.000.000/0000-00) or unformatted input.
|
|
18
|
-
*/
|
|
19
|
-
function validateCNPJ(cnpjInput) {
|
|
20
|
-
if (!cnpjInput || typeof cnpjInput !== "string") return false;
|
|
21
|
-
let cnpj = cnpjInput.trim();
|
|
22
|
-
if (cnpj.length === 18) cnpj = cleanCnpjString(cnpj);
|
|
23
|
-
if (cnpj.length !== 14) return false;
|
|
24
|
-
if (!/^\d+$/.test(cnpj)) return false;
|
|
25
|
-
if (INVALID_CNPJ_PATTERNS.includes(cnpj)) return false;
|
|
26
|
-
const first = calculateVerificationDigit(cnpj, CNPJ_FIRST_DIGIT_FACTORS);
|
|
27
|
-
if (cnpj.charAt(12) !== first) return false;
|
|
28
|
-
const second = calculateVerificationDigit(cnpj, CNPJ_SECOND_DIGIT_FACTORS);
|
|
29
|
-
if (cnpj.charAt(13) !== second) return false;
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
const buildPostalCodeParams = (country) => {
|
|
33
|
-
const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
|
|
34
|
-
if (fixedLen !== void 0) return { length: fixedLen };
|
|
35
|
-
let maxLen = getPostalCodeMaxLength(country);
|
|
36
|
-
if (country === "US" || country === "BR") maxLen = maxLen - 1;
|
|
37
|
-
return { maxLength: maxLen };
|
|
38
|
-
};
|
|
39
|
-
const createValidators = () => ({
|
|
40
|
-
required: (value, _rule, field) => {
|
|
41
|
-
if (value.trim().length > 0) return void 0;
|
|
42
|
-
const fieldName = field.displayLabel ?? field.label;
|
|
43
|
-
return fieldName ? {
|
|
44
|
-
key: DYNAMIC_REQUIRED_KEY,
|
|
45
|
-
params: { fieldName }
|
|
46
|
-
} : { key: DYNAMIC_REQUIRED_KEY };
|
|
47
|
-
},
|
|
48
|
-
streetLevelRequired: (value) => {
|
|
49
|
-
if (value.trim().length > 0) return void 0;
|
|
50
|
-
return STREET_LEVEL_REQUIRED_ERROR;
|
|
51
|
-
},
|
|
52
|
-
cnpj: (value) => {
|
|
53
|
-
if (value.trim().length === 0) return void 0;
|
|
54
|
-
return validateCNPJ(value) ? void 0 : { key: "ekyb.error.invalidTaxId" };
|
|
55
|
-
},
|
|
56
|
-
postalCodeFormat: (value, rule) => {
|
|
57
|
-
if (rule.type !== "postalCodeFormat") return void 0;
|
|
58
|
-
if (value.trim().length === 0) return void 0;
|
|
59
|
-
if (validatePostalCode(value, rule.country)) return void 0;
|
|
60
|
-
return {
|
|
61
|
-
key: getPostalCodeErrorKey(rule.country),
|
|
62
|
-
params: buildPostalCodeParams(rule.country)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
|
|
67
|
-
const evaluateRules = (value, rules, field, validators) => {
|
|
68
|
-
if (!rules) return void 0;
|
|
69
|
-
for (const rule of rules) {
|
|
70
|
-
const error = validators[rule.type](value, rule, field);
|
|
71
|
-
if (error) return error;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Address group: when no address field is filled (for countries that require
|
|
76
|
-
* address validation), marks required address fields with a required error.
|
|
77
|
-
* Per-field errors take precedence — this is merged last in validateEkybForm.
|
|
78
|
-
*/
|
|
79
|
-
function validateAddressGroup(fields, values, country) {
|
|
80
|
-
if (!requiresAddressValidation(country)) return {};
|
|
81
|
-
const addressValues = {};
|
|
82
|
-
for (const f of ADDRESS_FIELDS) addressValues[f] = values[f];
|
|
83
|
-
if (hasAtLeastOneAddressField(addressValues)) return {};
|
|
84
|
-
const errors = {};
|
|
85
|
-
const requiredAddressFields = fields.filter((f) => ADDRESS_FIELDS.includes(f.name) && f.required);
|
|
86
|
-
for (const f of requiredAddressFields) if (!(values[f.name] ?? "").trim()) {
|
|
87
|
-
const fieldName = f.displayLabel ?? f.label;
|
|
88
|
-
errors[f.name] = {
|
|
89
|
-
key: DYNAMIC_REQUIRED_KEY,
|
|
90
|
-
params: { fieldName }
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
return errors;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* UBO group: marks required UBO name/surname fields when the UBO entry
|
|
97
|
-
* has been interacted with (first UBO always validates; subsequent UBOs
|
|
98
|
-
* only validate if either field has a value).
|
|
99
|
-
*/
|
|
100
|
-
function validateUboGroup(ubos, hasUbos) {
|
|
101
|
-
if (!hasUbos) return {};
|
|
102
|
-
const errors = {};
|
|
103
|
-
for (let i = 0; i < ubos.length; i++) {
|
|
104
|
-
const isDefault = i === 0;
|
|
105
|
-
const hasAnyValue = ubos[i].name.trim() !== "" || ubos[i].surname.trim() !== "";
|
|
106
|
-
if (isDefault || hasAnyValue) {
|
|
107
|
-
if (!ubos[i].name.trim()) errors[`ubo-${i}-name`] = {
|
|
108
|
-
key: DYNAMIC_REQUIRED_KEY,
|
|
109
|
-
params: { fieldName: UBO_FIELD_LABELS.name }
|
|
110
|
-
};
|
|
111
|
-
if (!ubos[i].surname.trim()) errors[`ubo-${i}-surname`] = {
|
|
112
|
-
key: DYNAMIC_REQUIRED_KEY,
|
|
113
|
-
params: { fieldName: UBO_FIELD_LABELS.surname }
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return errors;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Full-form validation: per-field pass, then address cross-field pass, then
|
|
121
|
-
* UBO pass. Per-field errors take precedence over cross-field errors for
|
|
122
|
-
* the same key.
|
|
123
|
-
*/
|
|
124
|
-
function validateEkybForm(values, fields, country, ubos, hasUbos) {
|
|
125
|
-
const validators = createValidators();
|
|
126
|
-
const perField = fields.reduce((acc, field) => {
|
|
127
|
-
const value = normalizeFieldValue(values[field.name]);
|
|
128
|
-
const error = evaluateRules(value, field.validation, field, validators);
|
|
129
|
-
if (error) acc[field.name] = error;
|
|
130
|
-
return acc;
|
|
131
|
-
}, {});
|
|
132
|
-
const addressGroup = validateAddressGroup(fields, values, country);
|
|
133
|
-
const uboGroup = validateUboGroup(ubos, hasUbos);
|
|
134
|
-
return {
|
|
135
|
-
...addressGroup,
|
|
136
|
-
...perField,
|
|
137
|
-
...uboGroup
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Single-field validation (per-field only, no cross-field passes).
|
|
142
|
-
* Intended for blur-triggered validation of regular form fields.
|
|
143
|
-
*/
|
|
144
|
-
function validateEkybField(values, fieldName, fields) {
|
|
145
|
-
const field = fields.find((f) => f.name === fieldName);
|
|
146
|
-
if (!field) return void 0;
|
|
147
|
-
const validators = createValidators();
|
|
148
|
-
const value = normalizeFieldValue(values[field.name]);
|
|
149
|
-
return evaluateRules(value, field.validation, field, validators);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Single UBO field validation (blur-triggered).
|
|
153
|
-
* fieldKey format: `ubo-{index}-name` or `ubo-{index}-surname`.
|
|
154
|
-
* Returns undefined for non-default UBOs whose peer field is also empty
|
|
155
|
-
* (user hasn't started filling that UBO entry yet).
|
|
156
|
-
*/
|
|
157
|
-
function validateEkybUboField(ubos, fieldKey) {
|
|
158
|
-
const match = fieldKey.match(/^ubo-(\d+)-(name|surname)$/);
|
|
159
|
-
if (!match) return void 0;
|
|
160
|
-
const index = Number(match[1]);
|
|
161
|
-
const field = match[2];
|
|
162
|
-
if (index < 0 || index >= ubos.length) return void 0;
|
|
163
|
-
const ubo = ubos[index];
|
|
164
|
-
const isDefault = index === 0;
|
|
165
|
-
const hasAnyValue = ubo.name.trim() !== "" || ubo.surname.trim() !== "";
|
|
166
|
-
if (!isDefault && !hasAnyValue) return void 0;
|
|
167
|
-
if (!ubo[field].trim()) return {
|
|
168
|
-
key: DYNAMIC_REQUIRED_KEY,
|
|
169
|
-
params: { fieldName: UBO_FIELD_LABELS[field] }
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
/** Returns true when CNPJ validation applies for the given country. */
|
|
173
|
-
function requiresCnpjValidation(country) {
|
|
174
|
-
return COUNTRIES_WITH_CNPJ_VALIDATION.includes(country);
|
|
175
|
-
}
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region ../form-definitions/generated/ekyb.ts
|
|
178
|
-
const EKYB_DEFINITIONS = {
|
|
179
|
-
"ekyb/MX": {
|
|
180
|
-
schemaVersion: 1,
|
|
181
|
-
vocabulary: "1.0",
|
|
182
|
-
id: "ekyb/MX",
|
|
183
|
-
module: "ekyb",
|
|
184
|
-
country: "MX",
|
|
185
|
-
fields: [
|
|
186
|
-
{
|
|
187
|
-
name: "businessName",
|
|
188
|
-
kind: "text",
|
|
189
|
-
group: "businessName",
|
|
190
|
-
required: true,
|
|
191
|
-
label: { key: "ekyb.businessName" },
|
|
192
|
-
input: { autofill: "organization" }
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
name: "taxId",
|
|
196
|
-
kind: "text",
|
|
197
|
-
group: "taxId",
|
|
198
|
-
required: true,
|
|
199
|
-
label: { key: "ekyb.taxId" }
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
name: "postalCode",
|
|
203
|
-
kind: "text",
|
|
204
|
-
group: "address",
|
|
205
|
-
required: true,
|
|
206
|
-
label: { key: "ekyb.postalCode" },
|
|
207
|
-
input: {
|
|
208
|
-
maxLength: 5,
|
|
209
|
-
autofill: "postalCode"
|
|
210
|
-
},
|
|
211
|
-
rules: [{ id: "postalCodeFormat" }]
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
submit: {
|
|
215
|
-
static: { plugins: ["ekyb"] },
|
|
216
|
-
context: { country: "country" }
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
"ekyb/US": {
|
|
220
|
-
schemaVersion: 1,
|
|
221
|
-
vocabulary: "1.0",
|
|
222
|
-
id: "ekyb/US",
|
|
223
|
-
module: "ekyb",
|
|
224
|
-
country: "US",
|
|
225
|
-
fields: [
|
|
226
|
-
{
|
|
227
|
-
name: "businessName",
|
|
228
|
-
kind: "text",
|
|
229
|
-
group: "businessName",
|
|
230
|
-
required: true,
|
|
231
|
-
label: { key: "ekyb.businessName" },
|
|
232
|
-
input: { autofill: "organization" }
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "taxId",
|
|
236
|
-
kind: "text",
|
|
237
|
-
group: "taxId",
|
|
238
|
-
required: true,
|
|
239
|
-
label: { key: "ekyb.taxId" }
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: "street",
|
|
243
|
-
kind: "text",
|
|
244
|
-
group: "address",
|
|
245
|
-
required: true,
|
|
246
|
-
widget: "addressSearch",
|
|
247
|
-
label: { key: "ekyb.street" },
|
|
248
|
-
input: { autofill: "addressLine1" }
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: "houseNo",
|
|
252
|
-
kind: "text",
|
|
253
|
-
group: "address",
|
|
254
|
-
required: true,
|
|
255
|
-
label: { key: "ekyb.houseNo" }
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
name: "addressLine2",
|
|
259
|
-
kind: "text",
|
|
260
|
-
group: "address",
|
|
261
|
-
label: { key: "ekyb.addressLine2" },
|
|
262
|
-
input: { autofill: "addressLine2" }
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
name: "city",
|
|
266
|
-
kind: "text",
|
|
267
|
-
group: "address",
|
|
268
|
-
required: true,
|
|
269
|
-
label: { key: "ekyb.city" },
|
|
270
|
-
input: { autofill: "addressLevel2" }
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: "state",
|
|
274
|
-
kind: "choice",
|
|
275
|
-
group: "address",
|
|
276
|
-
required: true,
|
|
277
|
-
widget: "select",
|
|
278
|
-
label: { key: "ekyb.state" },
|
|
279
|
-
placeholder: { key: "verification.placeholder.state" },
|
|
280
|
-
input: { autofill: "addressLevel1" },
|
|
281
|
-
optionsRef: "US_STATES"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
name: "postalCode",
|
|
285
|
-
kind: "text",
|
|
286
|
-
group: "address",
|
|
287
|
-
required: true,
|
|
288
|
-
label: { key: "ekyb.postalCode" },
|
|
289
|
-
input: {
|
|
290
|
-
maxLength: 10,
|
|
291
|
-
autofill: "postalCode"
|
|
292
|
-
},
|
|
293
|
-
rules: [{ id: "postalCodeFormat" }]
|
|
294
|
-
}
|
|
295
|
-
],
|
|
296
|
-
collections: [{
|
|
297
|
-
id: "ubos",
|
|
298
|
-
group: "ubos",
|
|
299
|
-
min: 1,
|
|
300
|
-
max: 8,
|
|
301
|
-
fields: [{
|
|
302
|
-
name: "name",
|
|
303
|
-
kind: "text",
|
|
304
|
-
group: "ubos",
|
|
305
|
-
required: true,
|
|
306
|
-
label: { key: "ekyb.uboName" }
|
|
307
|
-
}, {
|
|
308
|
-
name: "surname",
|
|
309
|
-
kind: "text",
|
|
310
|
-
group: "ubos",
|
|
311
|
-
required: true,
|
|
312
|
-
label: { key: "ekyb.uboSurname" }
|
|
313
|
-
}],
|
|
314
|
-
payload: {
|
|
315
|
-
key: "uboNames",
|
|
316
|
-
join: ["name", "surname"]
|
|
317
|
-
}
|
|
318
|
-
}],
|
|
319
|
-
submit: {
|
|
320
|
-
static: { plugins: ["ekyb"] },
|
|
321
|
-
context: { country: "country" }
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
//#endregion
|
|
326
|
-
//#region src/modules/ekyb/ekybForm.ts
|
|
327
|
-
/**
|
|
328
|
-
* eKYB adapter for form definitions.
|
|
329
|
-
*
|
|
330
|
-
* Selects the bundled definition for a country, resolves it against the
|
|
331
|
-
* verification fields from module configuration, and projects the result to
|
|
332
|
-
* today's public `EkybFieldDef[]` shape. A country without a projectable
|
|
333
|
-
* definition, or a custom field list that can't be expressed as groups, keeps
|
|
334
|
-
* the current builder.
|
|
335
|
-
*/
|
|
336
|
-
/** eKYB group id → the verification-field entries that turn it on. */
|
|
337
|
-
const EKYB_GROUP_ENTRIES = {
|
|
338
|
-
businessName: ["name-user_input"],
|
|
339
|
-
taxId: ["taxId-user_input"],
|
|
340
|
-
address: [
|
|
341
|
-
"street-user_input",
|
|
342
|
-
"houseNo-user_input",
|
|
343
|
-
"address2-user_input",
|
|
344
|
-
"city-user_input",
|
|
345
|
-
"state-user_input",
|
|
346
|
-
"postalCode-user_input"
|
|
347
|
-
],
|
|
348
|
-
ubos: ["ubos-user_input"]
|
|
349
|
-
};
|
|
350
|
-
const KNOWN_ENTRIES = new Set(Object.values(EKYB_GROUP_ENTRIES).flat());
|
|
351
|
-
const OPTION_LISTS = { US_STATES: usStateOptions };
|
|
352
|
-
/** Vocabulary rules expressed as today's `EkybValidationRule` objects. */
|
|
353
|
-
const RULES = {
|
|
354
|
-
cnpj: () => ({ type: "cnpj" }),
|
|
355
|
-
postalCodeFormat: (country) => ({
|
|
356
|
-
type: "postalCodeFormat",
|
|
357
|
-
country
|
|
358
|
-
})
|
|
359
|
-
};
|
|
360
|
-
const EKYB_SUPPORTED_IDS = {
|
|
361
|
-
schemaVersions: [1],
|
|
362
|
-
vocabulary: "1.0",
|
|
363
|
-
kinds: /* @__PURE__ */ new Set(["text", "choice"]),
|
|
364
|
-
groups: new Set(Object.keys(EKYB_GROUP_ENTRIES)),
|
|
365
|
-
rules: new Set(Object.keys(RULES)),
|
|
366
|
-
transforms: /* @__PURE__ */ new Set(),
|
|
367
|
-
groupRules: /* @__PURE__ */ new Set(),
|
|
368
|
-
optionLists: new Set(Object.keys(OPTION_LISTS)),
|
|
369
|
-
conditions: /* @__PURE__ */ new Set()
|
|
370
|
-
};
|
|
371
|
-
/** Today's UBO actions use a fixed limit and a single collection. */
|
|
372
|
-
const UBO_COLLECTION = "ubos";
|
|
373
|
-
/**
|
|
374
|
-
* Whether today's code handles a field the way its definition says. Today's
|
|
375
|
-
* validators show their own message, so a rule can't carry one. The field
|
|
376
|
-
* shape has no hint, suggestions, sections or Text params, and the UI shows a
|
|
377
|
-
* placeholder only on dropdowns. `buildEkybSubmitPayload` sends the value
|
|
378
|
-
* under the field name, unchanged. Input formatting and request bodies stay
|
|
379
|
-
* in today's code until P2.
|
|
380
|
-
*/
|
|
381
|
-
function isProjectableField(field) {
|
|
382
|
-
return !field.hint && !field.suggestionsRef && !field.section && !field.label.params && !field.displayLabel?.params && (field.options ?? []).every((option) => !option.label.params) && (!field.placeholder || field.kind === "choice" && !field.placeholder.params) && (field.rules ?? []).every((rule) => !rule.message) && !field.input?.format?.length && (field.payload?.key ?? field.name) === field.name && !field.payload?.omit;
|
|
383
|
-
}
|
|
384
|
-
/** The only properties today's owner fields honor. */
|
|
385
|
-
const UBO_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
386
|
-
"name",
|
|
387
|
-
"kind",
|
|
388
|
-
"group",
|
|
389
|
-
"required",
|
|
390
|
-
"label"
|
|
391
|
-
]);
|
|
392
|
-
/**
|
|
393
|
-
* Today's owner code is fixed: owner 1 is required, up to `UBO_INPUT_LIMIT`
|
|
394
|
-
* owners, each with a required name and surname under `UBO_FIELD_LABELS`, and
|
|
395
|
-
* the request body joins them into `uboNames`. A collection is projectable
|
|
396
|
-
* only when it declares exactly that.
|
|
397
|
-
*/
|
|
398
|
-
function isProjectableUboCollection(collection) {
|
|
399
|
-
const { key, join } = collection.payload;
|
|
400
|
-
const names = collection.fields.map((field) => field.name);
|
|
401
|
-
return collection.id === UBO_COLLECTION && collection.min === 1 && collection.max === 8 && key === "uboNames" && join.length === 2 && join[0] === "name" && join[1] === "surname" && names.length === 2 && names[0] === "name" && names[1] === "surname" && collection.fields.every((field) => Object.keys(field).every((prop) => UBO_FIELD_KEYS.has(prop)) && field.kind === "text" && field.required === true && Object.keys(field.label).length === 1 && field.label.key === UBO_FIELD_LABELS[field.name]);
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Caches the check per definition object. Bundled definitions are singletons
|
|
405
|
-
* created once at module load, so each is checked once. A served source (P4)
|
|
406
|
-
* that builds new objects per call would still be correct, but would miss
|
|
407
|
-
* this cache; key it by definition id and version then.
|
|
408
|
-
*/
|
|
409
|
-
const projectable = /* @__PURE__ */ new WeakMap();
|
|
410
|
-
/** Whether every part of a definition maps onto today's `EkybFieldDef`. */
|
|
411
|
-
function isProjectableEkybDefinition(definition) {
|
|
412
|
-
let result = projectable.get(definition);
|
|
413
|
-
if (result === void 0) {
|
|
414
|
-
result = definition.module === "ekyb" && checkSupport(definition, EKYB_SUPPORTED_IDS).supported && !definition.sections?.length && definition.fields.every(isProjectableField) && (definition.collections ?? []).every(isProjectableUboCollection);
|
|
415
|
-
projectable.set(definition, result);
|
|
416
|
-
}
|
|
417
|
-
return result;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Maps module configuration to groups. Returns `undefined` when the field
|
|
421
|
-
* list can't be expressed as whole groups (an unknown entry, or part of the
|
|
422
|
-
* address), so the current builder keeps handling it.
|
|
423
|
-
*/
|
|
424
|
-
function toEkybResolveContext(config, verificationFields) {
|
|
425
|
-
const entries = verificationFields.filter((entry) => !entry.startsWith("socure"));
|
|
426
|
-
if (entries.some((entry) => !KNOWN_ENTRIES.has(entry))) return void 0;
|
|
427
|
-
const groups = {};
|
|
428
|
-
for (const [group, groupEntries] of Object.entries(EKYB_GROUP_ENTRIES)) {
|
|
429
|
-
const present = groupEntries.filter((e) => entries.includes(e)).length;
|
|
430
|
-
if (present !== 0 && present !== groupEntries.length) return void 0;
|
|
431
|
-
groups[group] = present > 0;
|
|
432
|
-
}
|
|
433
|
-
groups.ubos = groups.ubos === true && config.checkUniqueBeneficialOwner !== false;
|
|
434
|
-
return { groups };
|
|
435
|
-
}
|
|
436
|
-
const bundled = createBundledDefinitionSource(EKYB_DEFINITIONS);
|
|
437
|
-
/** The resolved definition for this country and configuration, if one applies. */
|
|
438
|
-
function selectEkybForm(config, verificationFields, country) {
|
|
439
|
-
const context = toEkybResolveContext(config, verificationFields);
|
|
440
|
-
if (!context) return void 0;
|
|
441
|
-
const definition = bundled.select({
|
|
442
|
-
module: "ekyb",
|
|
443
|
-
country
|
|
444
|
-
});
|
|
445
|
-
if (!definition || !isProjectableEkybDefinition(definition)) return void 0;
|
|
446
|
-
return resolveForm(definition, context);
|
|
447
|
-
}
|
|
448
|
-
function projectField(field, required, country) {
|
|
449
|
-
const def = {
|
|
450
|
-
name: field.name,
|
|
451
|
-
type: field.kind === "choice" ? "dropdown" : "text",
|
|
452
|
-
label: field.label.key,
|
|
453
|
-
required
|
|
454
|
-
};
|
|
455
|
-
if (field.placeholder) def.placeholder = field.placeholder.key;
|
|
456
|
-
if (field.displayLabel) def.displayLabel = field.displayLabel.text ?? field.displayLabel.key;
|
|
457
|
-
if (field.input?.maxLength !== void 0) def.maxLength = field.input.maxLength;
|
|
458
|
-
if (field.optionsRef) def.options = OPTION_LISTS[field.optionsRef];
|
|
459
|
-
else if (field.options) def.options = field.options.map((option) => ({
|
|
460
|
-
value: option.value,
|
|
461
|
-
label: option.label.key
|
|
462
|
-
}));
|
|
463
|
-
const validation = required ? [{ type: "required" }] : [];
|
|
464
|
-
for (const rule of field.rules ?? []) {
|
|
465
|
-
const project = RULES[rule.id];
|
|
466
|
-
if (project) validation.push(project(country));
|
|
467
|
-
}
|
|
468
|
-
if (validation.length > 0) def.validation = validation;
|
|
469
|
-
return def;
|
|
470
|
-
}
|
|
471
|
-
/** Projects a resolved definition to today's `EkybFieldDef[]`. */
|
|
472
|
-
function projectEkybFields(form, country) {
|
|
473
|
-
return form.fields.map(({ field, required }) => projectField(field, required, country));
|
|
474
|
-
}
|
|
475
|
-
/** Whether the resolved form collects beneficial owners. */
|
|
476
|
-
function hasUboCollection(form) {
|
|
477
|
-
return form.collections.some((c) => c.collection.id === UBO_COLLECTION);
|
|
478
|
-
}
|
|
479
|
-
//#endregion
|
|
480
|
-
//#region src/modules/ekyb/ekybActions.ts
|
|
481
|
-
function buildEkybValidationRules(fieldName, required, country) {
|
|
482
|
-
const rules = [];
|
|
483
|
-
if (required) rules.push({ type: "required" });
|
|
484
|
-
if (fieldName === "taxId" && requiresCnpjValidation(country)) rules.push({ type: "cnpj" });
|
|
485
|
-
if (fieldName === "postalCode") rules.push({
|
|
486
|
-
type: "postalCodeFormat",
|
|
487
|
-
country
|
|
488
|
-
});
|
|
489
|
-
return rules;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Fields and beneficial-owner state for a country. A country with a form
|
|
493
|
-
* definition (`packages/form-definitions/catalog/ekyb`) reads it; any other
|
|
494
|
-
* country, or a custom field list that isn't whole groups, keeps the current
|
|
495
|
-
* builder and its UBO rule.
|
|
496
|
-
*/
|
|
497
|
-
function buildEkybForm(config, verificationFields, country) {
|
|
498
|
-
const form = selectEkybForm(config, verificationFields, country);
|
|
499
|
-
if (form) return {
|
|
500
|
-
fields: projectEkybFields(form, country),
|
|
501
|
-
hasUbos: hasUboCollection(form)
|
|
502
|
-
};
|
|
503
|
-
const hasUbos = config.checkUniqueBeneficialOwner !== false && verificationFields.includes("ubos-user_input") && country !== "MX";
|
|
504
|
-
return {
|
|
505
|
-
fields: buildEkybFields(verificationFields, country, hasUbos),
|
|
506
|
-
hasUbos
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
/** The per-country builder for countries without a form definition yet. */
|
|
510
|
-
function buildEkybFields(verificationFields, country, _hasUbos) {
|
|
511
|
-
let modules = verificationFields.filter((f) => f !== "ubos-user_input" && !f.startsWith("socure"));
|
|
512
|
-
if (country === "GB") modules = modules.filter((m) => m !== "state-user_input");
|
|
513
|
-
if (country === "MX") modules = modules.filter((m) => {
|
|
514
|
-
if (m === "ubos-user_input") return false;
|
|
515
|
-
const fieldName = FIELD_NAME_MAPPING[m] ?? m;
|
|
516
|
-
if (ADDRESS_FIELDS.includes(fieldName) && fieldName !== "postalCode") return false;
|
|
517
|
-
return true;
|
|
518
|
-
});
|
|
519
|
-
return sortModulesByOrder(modules, FIELD_ORDER).map((moduleName) => {
|
|
520
|
-
const fieldName = FIELD_NAME_MAPPING[moduleName] ?? moduleName;
|
|
521
|
-
const optional = isFieldOptional(fieldName, country);
|
|
522
|
-
const def = {
|
|
523
|
-
name: fieldName,
|
|
524
|
-
type: "text",
|
|
525
|
-
label: `ekyb.${fieldName}`,
|
|
526
|
-
required: !optional
|
|
527
|
-
};
|
|
528
|
-
if (fieldName === "taxId") {
|
|
529
|
-
def.required = true;
|
|
530
|
-
if (country === "CN") def.label = "verification.labels.prcId";
|
|
531
|
-
if (country === "BR") def.displayLabel = "CPF";
|
|
532
|
-
}
|
|
533
|
-
if (fieldName === "postalCode") def.maxLength = getPostalCodeMaxLength(country);
|
|
534
|
-
if (fieldName === "state" && country === "US") {
|
|
535
|
-
def.type = "dropdown";
|
|
536
|
-
def.options = usStateOptions;
|
|
537
|
-
def.placeholder = "verification.placeholder.state";
|
|
538
|
-
}
|
|
539
|
-
const validation = buildEkybValidationRules(fieldName, def.required, country);
|
|
540
|
-
if (validation.length > 0) def.validation = validation;
|
|
541
|
-
return def;
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
function getDefaultVerificationFields(config) {
|
|
545
|
-
if (config.verificationFields && config.verificationFields.length > 0) return config.verificationFields;
|
|
546
|
-
const fields = [];
|
|
547
|
-
if (config.checkBusinessName !== false) fields.push("name-user_input");
|
|
548
|
-
if (config.checkAddress !== false) fields.push("street-user_input", "houseNo-user_input", "address2-user_input", "city-user_input", "state-user_input", "postalCode-user_input");
|
|
549
|
-
if (config.checkTaxId !== false) fields.push("taxId-user_input");
|
|
550
|
-
if (config.checkUniqueBeneficialOwner !== false) fields.push("ubos-user_input");
|
|
551
|
-
return fields;
|
|
552
|
-
}
|
|
553
|
-
function processEkybFieldValue(name, value, country) {
|
|
554
|
-
if (name === "postalCode") return formatPostalCode(value, country);
|
|
555
|
-
return value;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Builds the request body. Keep it in sync with `isProjectableField` and
|
|
559
|
-
* `isProjectableUboCollection` in `ekybForm.ts`: definitions are projectable
|
|
560
|
-
* only when they declare exactly this handling, until P2 builds request
|
|
561
|
-
* bodies from them.
|
|
562
|
-
*/
|
|
563
|
-
function buildEkybSubmitPayload(ctx) {
|
|
564
|
-
const uboNames = ctx.ubos.filter((u) => u.name.trim() || u.surname.trim()).map((u) => `${u.name.trim()} ${u.surname.trim()}`.trim());
|
|
565
|
-
const payload = {
|
|
566
|
-
country: ctx.country,
|
|
567
|
-
plugins: ["ekyb"],
|
|
568
|
-
uboNames
|
|
569
|
-
};
|
|
570
|
-
for (const field of ctx.fields) {
|
|
571
|
-
const val = ctx.values[field.name];
|
|
572
|
-
if (val !== void 0 && val !== "") payload[field.name] = val;
|
|
573
|
-
}
|
|
574
|
-
return payload;
|
|
575
|
-
}
|
|
576
|
-
//#endregion
|
|
577
|
-
//#region src/modules/ekyb/ekybGuards.ts
|
|
578
|
-
const hasFlowIdGuard = ({ context }) => !!context.config.flowId;
|
|
579
|
-
const hasNoValidationErrorsGuard = ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0;
|
|
580
|
-
const canAddUboGuard = ({ context }) => context.canAddUbo;
|
|
581
|
-
const isValidUboIndexGuard = ({ context, event }) => {
|
|
582
|
-
const { index } = event;
|
|
583
|
-
return Number.isInteger(index) && index >= 0 && index < context.ubos.length;
|
|
584
|
-
};
|
|
585
|
-
const isSupportedCountryGuard = ({ event }) => {
|
|
586
|
-
const { country } = event;
|
|
587
|
-
return isSupportedCountry(country);
|
|
588
|
-
};
|
|
589
|
-
//#endregion
|
|
590
|
-
//#region src/modules/ekyb/ekybServices.ts
|
|
591
|
-
/** Fetches the onboarding flow and extracts the EKYB module configuration */
|
|
592
|
-
async function fetchEkybModuleConfig(signal) {
|
|
593
|
-
const ekybModule = (await getFlow(signal)).flowModules.find((m) => m.key === "EKYB");
|
|
594
|
-
if (!ekybModule) throw new Error("EKYB module not found in flow configuration");
|
|
595
|
-
return ekybModule.configuration;
|
|
596
|
-
}
|
|
597
|
-
/** Submits eKYB business verification */
|
|
598
|
-
async function submitEkyb(data, signal) {
|
|
599
|
-
const res = await api.post(endpoints.ekybSubmit, data, { signal });
|
|
600
|
-
if (!res.ok) throw new Error(`POST ${endpoints.ekybSubmit} failed: ${res.status} ${res.statusText}`);
|
|
601
|
-
return res.data;
|
|
602
|
-
}
|
|
603
|
-
//#endregion
|
|
604
|
-
//#region src/modules/ekyb/ekybActors.ts
|
|
605
|
-
const fetchEkybModuleConfigActor = fromPromise(async ({ signal }) => fetchEkybModuleConfig(signal));
|
|
606
|
-
const submitEkybActor = fromPromise(async ({ input, signal }) => submitEkyb(input, signal));
|
|
607
|
-
//#endregion
|
|
608
|
-
//#region src/modules/ekyb/ekybStateMachine.ts
|
|
609
|
-
const ADDRESS_AUTOCOMPLETE_KEYS = [
|
|
610
|
-
"street",
|
|
611
|
-
"city",
|
|
612
|
-
"state",
|
|
613
|
-
"postalCode",
|
|
614
|
-
"houseNo"
|
|
615
|
-
];
|
|
616
|
-
const ekybMachine = setup({
|
|
617
|
-
types: {
|
|
618
|
-
context: {},
|
|
619
|
-
events: {},
|
|
620
|
-
input: {}
|
|
621
|
-
},
|
|
622
|
-
actors: {
|
|
623
|
-
fetchEkybModuleConfig: fetchEkybModuleConfigActor,
|
|
624
|
-
submitEkyb: submitEkybActor,
|
|
625
|
-
debounceSearch: debounceSearchActor
|
|
626
|
-
},
|
|
627
|
-
actions: {
|
|
628
|
-
applyFetchedConfig: assign(({ event }) => {
|
|
629
|
-
const fetched = event.output;
|
|
630
|
-
const config = {
|
|
631
|
-
checkBusinessName: fetched.checkBusinessName,
|
|
632
|
-
checkAddress: fetched.checkAddress,
|
|
633
|
-
checkTaxId: fetched.checkTaxId,
|
|
634
|
-
checkUniqueBeneficialOwner: fetched.checkUniqueBeneficialOwner
|
|
635
|
-
};
|
|
636
|
-
const country = "US";
|
|
637
|
-
const { fields, hasUbos } = buildEkybForm(config, getDefaultVerificationFields(config), country);
|
|
638
|
-
return {
|
|
639
|
-
config,
|
|
640
|
-
country,
|
|
641
|
-
availableCountries: ALL_COUNTRIES,
|
|
642
|
-
fields,
|
|
643
|
-
values: { country },
|
|
644
|
-
validationErrors: void 0,
|
|
645
|
-
ubos: hasUbos ? [{
|
|
646
|
-
id: "ubo-1",
|
|
647
|
-
name: "",
|
|
648
|
-
surname: ""
|
|
649
|
-
}] : [],
|
|
650
|
-
canAddUbo: hasUbos,
|
|
651
|
-
hasUbos,
|
|
652
|
-
addressSuggestions: [],
|
|
653
|
-
_nextUboId: 2,
|
|
654
|
-
_searchQuery: ""
|
|
655
|
-
};
|
|
656
|
-
}),
|
|
657
|
-
setCountry: assign(({ context, event }) => {
|
|
658
|
-
const { country } = event;
|
|
659
|
-
const vFields = getDefaultVerificationFields(context.config);
|
|
660
|
-
const { fields, hasUbos } = buildEkybForm(context.config, vFields, country);
|
|
661
|
-
let nextId = context._nextUboId;
|
|
662
|
-
let ubos;
|
|
663
|
-
if (hasUbos) if (context.ubos.length > 0) ubos = context.ubos;
|
|
664
|
-
else {
|
|
665
|
-
ubos = [{
|
|
666
|
-
id: `ubo-${nextId}`,
|
|
667
|
-
name: "",
|
|
668
|
-
surname: ""
|
|
669
|
-
}];
|
|
670
|
-
nextId += 1;
|
|
671
|
-
}
|
|
672
|
-
else ubos = [];
|
|
673
|
-
return {
|
|
674
|
-
country,
|
|
675
|
-
fields,
|
|
676
|
-
values: {
|
|
677
|
-
...context.values,
|
|
678
|
-
country,
|
|
679
|
-
state: ""
|
|
680
|
-
},
|
|
681
|
-
validationErrors: void 0,
|
|
682
|
-
ubos,
|
|
683
|
-
canAddUbo: hasUbos && ubos.length < 8,
|
|
684
|
-
hasUbos,
|
|
685
|
-
_nextUboId: nextId
|
|
686
|
-
};
|
|
687
|
-
}),
|
|
688
|
-
updateField: assign(({ context, event }) => {
|
|
689
|
-
if (event.type !== "DATA_CHANGED") return {};
|
|
690
|
-
const processed = processEkybFieldValue(event.name, event.value, context.country);
|
|
691
|
-
return { values: {
|
|
692
|
-
...context.values,
|
|
693
|
-
[event.name]: processed
|
|
694
|
-
} };
|
|
695
|
-
}),
|
|
696
|
-
clearFieldValidationError: assign(({ context, event }) => {
|
|
697
|
-
if (event.type !== "DATA_CHANGED") return {};
|
|
698
|
-
const errs = context.validationErrors;
|
|
699
|
-
if (!errs?.[event.name]) return {};
|
|
700
|
-
const next = { ...errs };
|
|
701
|
-
delete next[event.name];
|
|
702
|
-
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
703
|
-
}),
|
|
704
|
-
validateFormField: assign(({ context, event }) => {
|
|
705
|
-
if (event.type !== "VALIDATE_FIELD") return {};
|
|
706
|
-
const { name } = event;
|
|
707
|
-
const message = /^ubo-\d+-(name|surname)$/.test(name) ? validateEkybUboField(context.ubos, name) : validateEkybField(context.values, name, context.fields);
|
|
708
|
-
const next = { ...context.validationErrors ?? {} };
|
|
709
|
-
if (message) next[name] = message;
|
|
710
|
-
else delete next[name];
|
|
711
|
-
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
712
|
-
}),
|
|
713
|
-
computeValidationResult: assign(({ context }) => {
|
|
714
|
-
const errors = validateEkybForm(context.values, context.fields, context.country, context.ubos, context.hasUbos);
|
|
715
|
-
return { validationErrors: Object.keys(errors).length > 0 ? errors : void 0 };
|
|
716
|
-
}),
|
|
717
|
-
addUbo: assign(({ context }) => {
|
|
718
|
-
const newId = context._nextUboId;
|
|
719
|
-
const ubos = [...context.ubos, {
|
|
720
|
-
id: `ubo-${newId}`,
|
|
721
|
-
name: "",
|
|
722
|
-
surname: ""
|
|
723
|
-
}];
|
|
724
|
-
return {
|
|
725
|
-
ubos,
|
|
726
|
-
canAddUbo: ubos.length < 8,
|
|
727
|
-
_nextUboId: newId + 1
|
|
728
|
-
};
|
|
729
|
-
}),
|
|
730
|
-
removeUbo: assign(({ context, event }) => {
|
|
731
|
-
const { index } = event;
|
|
732
|
-
const ubos = context.ubos.filter((_, i) => i !== index);
|
|
733
|
-
const canAddUbo = ubos.length < 8;
|
|
734
|
-
const errs = context.validationErrors;
|
|
735
|
-
let newErrors;
|
|
736
|
-
if (errs) {
|
|
737
|
-
const next = {};
|
|
738
|
-
for (const [key, val] of Object.entries(errs)) {
|
|
739
|
-
const match = key.match(/^ubo-(\d+)-(name|surname)$/);
|
|
740
|
-
if (!match) {
|
|
741
|
-
next[key] = val;
|
|
742
|
-
continue;
|
|
743
|
-
}
|
|
744
|
-
const uboIdx = Number(match[1]);
|
|
745
|
-
if (uboIdx === index) continue;
|
|
746
|
-
const newIdx = uboIdx > index ? uboIdx - 1 : uboIdx;
|
|
747
|
-
next[`ubo-${newIdx}-${match[2]}`] = val;
|
|
748
|
-
}
|
|
749
|
-
newErrors = Object.keys(next).length > 0 ? next : void 0;
|
|
750
|
-
}
|
|
751
|
-
return {
|
|
752
|
-
ubos,
|
|
753
|
-
canAddUbo,
|
|
754
|
-
validationErrors: newErrors
|
|
755
|
-
};
|
|
756
|
-
}),
|
|
757
|
-
setUboField: assign(({ context, event }) => {
|
|
758
|
-
const { index, field, value } = event;
|
|
759
|
-
const ubos = context.ubos.map((ubo, i) => i === index ? {
|
|
760
|
-
...ubo,
|
|
761
|
-
[field]: value
|
|
762
|
-
} : ubo);
|
|
763
|
-
const fieldKey = `ubo-${index}-${field}`;
|
|
764
|
-
const errs = context.validationErrors;
|
|
765
|
-
if (!errs?.[fieldKey]) return { ubos };
|
|
766
|
-
const next = { ...errs };
|
|
767
|
-
delete next[fieldKey];
|
|
768
|
-
return {
|
|
769
|
-
ubos,
|
|
770
|
-
validationErrors: Object.keys(next).length > 0 ? next : void 0
|
|
771
|
-
};
|
|
772
|
-
}),
|
|
773
|
-
setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
|
|
774
|
-
clearErrorMessage: assign({ errorMessage: () => "" }),
|
|
775
|
-
fillAddressFields: assign(({ context, event }) => {
|
|
776
|
-
const { suggestion } = event;
|
|
777
|
-
const activeFields = new Set(context.fields.map((f) => f.name));
|
|
778
|
-
const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion, activeFields);
|
|
779
|
-
const errs = context.validationErrors;
|
|
780
|
-
let newErrors = errs;
|
|
781
|
-
if (errs) {
|
|
782
|
-
const next = { ...errs };
|
|
783
|
-
for (const key of ADDRESS_AUTOCOMPLETE_KEYS) delete next[key];
|
|
784
|
-
newErrors = Object.keys(next).length > 0 ? next : void 0;
|
|
785
|
-
}
|
|
786
|
-
const streetError = getStreetLevelErrorForSuggestion(suggestion, activeFields);
|
|
787
|
-
if (streetError !== void 0) newErrors = {
|
|
788
|
-
...newErrors,
|
|
789
|
-
street: streetError
|
|
790
|
-
};
|
|
791
|
-
return {
|
|
792
|
-
values: newValues,
|
|
793
|
-
addressSuggestions: [],
|
|
794
|
-
_searchQuery: "",
|
|
795
|
-
validationErrors: newErrors
|
|
796
|
-
};
|
|
797
|
-
}),
|
|
798
|
-
setAddressSuggestions: assign(({ event }) => ({ addressSuggestions: event.suggestions }))
|
|
799
|
-
},
|
|
800
|
-
guards: {
|
|
801
|
-
hasFlowId: hasFlowIdGuard,
|
|
802
|
-
hasNoValidationErrors: hasNoValidationErrorsGuard,
|
|
803
|
-
canAddUbo: canAddUboGuard,
|
|
804
|
-
isValidUboIndex: isValidUboIndexGuard,
|
|
805
|
-
isSupportedCountry: isSupportedCountryGuard
|
|
806
|
-
}
|
|
807
|
-
}).createMachine({
|
|
808
|
-
id: "ekyb",
|
|
809
|
-
initial: "idle",
|
|
810
|
-
context: ({ input }) => {
|
|
811
|
-
const config = toEkybConfig(input.config);
|
|
812
|
-
const country = "US";
|
|
813
|
-
const { fields, hasUbos } = buildEkybForm(config, getDefaultVerificationFields(config), country);
|
|
814
|
-
return {
|
|
815
|
-
config,
|
|
816
|
-
country,
|
|
817
|
-
availableCountries: ALL_COUNTRIES,
|
|
818
|
-
fields,
|
|
819
|
-
values: { country },
|
|
820
|
-
validationErrors: void 0,
|
|
821
|
-
ubos: hasUbos ? [{
|
|
822
|
-
id: "ubo-1",
|
|
823
|
-
name: "",
|
|
824
|
-
surname: ""
|
|
825
|
-
}] : [],
|
|
826
|
-
canAddUbo: hasUbos,
|
|
827
|
-
hasUbos,
|
|
828
|
-
errorMessage: "",
|
|
829
|
-
addressSuggestions: [],
|
|
830
|
-
_nextUboId: 2,
|
|
831
|
-
_searchQuery: ""
|
|
832
|
-
};
|
|
833
|
-
},
|
|
834
|
-
states: {
|
|
835
|
-
idle: { on: { LOAD: [{
|
|
836
|
-
target: "loading",
|
|
837
|
-
guard: "hasFlowId"
|
|
838
|
-
}, { target: "form" }] } },
|
|
839
|
-
loading: { invoke: {
|
|
840
|
-
id: "fetchEkybModuleConfig",
|
|
841
|
-
src: "fetchEkybModuleConfig",
|
|
842
|
-
onDone: {
|
|
843
|
-
target: "form",
|
|
844
|
-
actions: "applyFetchedConfig"
|
|
845
|
-
},
|
|
846
|
-
onError: "form"
|
|
847
|
-
} },
|
|
848
|
-
form: {
|
|
849
|
-
initial: "inputting",
|
|
850
|
-
states: {
|
|
851
|
-
inputting: { on: {
|
|
852
|
-
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
853
|
-
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
854
|
-
SUBMIT: { target: "validatingSubmit" }
|
|
855
|
-
} },
|
|
856
|
-
searching: {
|
|
857
|
-
invoke: {
|
|
858
|
-
id: "debounceSearch",
|
|
859
|
-
src: "debounceSearch",
|
|
860
|
-
input: ({ context }) => ({ query: context._searchQuery })
|
|
861
|
-
},
|
|
862
|
-
on: {
|
|
863
|
-
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
864
|
-
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
865
|
-
RESULTS: {
|
|
866
|
-
target: "inputting",
|
|
867
|
-
actions: "setAddressSuggestions"
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
},
|
|
871
|
-
validatingSubmit: {
|
|
872
|
-
entry: "computeValidationResult",
|
|
873
|
-
always: [{
|
|
874
|
-
guard: "hasNoValidationErrors",
|
|
875
|
-
target: "#ekyb.submitting"
|
|
876
|
-
}, { target: "inputting" }]
|
|
877
|
-
}
|
|
878
|
-
},
|
|
879
|
-
on: {
|
|
880
|
-
SET_COUNTRY: {
|
|
881
|
-
guard: "isSupportedCountry",
|
|
882
|
-
actions: "setCountry"
|
|
883
|
-
},
|
|
884
|
-
ADD_UBO: {
|
|
885
|
-
guard: "canAddUbo",
|
|
886
|
-
actions: "addUbo"
|
|
887
|
-
},
|
|
888
|
-
REMOVE_UBO: {
|
|
889
|
-
guard: "isValidUboIndex",
|
|
890
|
-
actions: "removeUbo"
|
|
891
|
-
},
|
|
892
|
-
SET_UBO_FIELD: {
|
|
893
|
-
guard: "isValidUboIndex",
|
|
894
|
-
actions: "setUboField"
|
|
895
|
-
},
|
|
896
|
-
SEARCH_ADDRESS: {
|
|
897
|
-
target: ".searching",
|
|
898
|
-
actions: assign(({ event }) => ({
|
|
899
|
-
_searchQuery: event.query,
|
|
900
|
-
addressSuggestions: []
|
|
901
|
-
}))
|
|
902
|
-
},
|
|
903
|
-
SELECT_ADDRESS: {
|
|
904
|
-
target: ".inputting",
|
|
905
|
-
actions: "fillAddressFields"
|
|
906
|
-
},
|
|
907
|
-
CLOSE: { target: "closed" }
|
|
908
|
-
}
|
|
909
|
-
},
|
|
910
|
-
submitting: { invoke: {
|
|
911
|
-
id: "submitEkyb",
|
|
912
|
-
src: "submitEkyb",
|
|
913
|
-
input: ({ context }) => buildEkybSubmitPayload(context),
|
|
914
|
-
onDone: { target: "success" },
|
|
915
|
-
onError: {
|
|
916
|
-
target: "error",
|
|
917
|
-
actions: "setErrorMessage"
|
|
918
|
-
}
|
|
919
|
-
} },
|
|
920
|
-
success: { after: { 3e3: "finished" } },
|
|
921
|
-
error: { on: {
|
|
922
|
-
RETRY: {
|
|
923
|
-
target: "form",
|
|
924
|
-
actions: "clearErrorMessage"
|
|
925
|
-
},
|
|
926
|
-
CLOSE: { target: "closed" }
|
|
927
|
-
} },
|
|
928
|
-
finished: { type: "final" },
|
|
929
|
-
closed: { type: "final" }
|
|
930
|
-
}
|
|
931
|
-
});
|
|
932
|
-
//#endregion
|
|
933
|
-
export { ekybMachine as t };
|