@incodetech/core 2.0.1-rc.0 → 2.1.0-rc.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/{BrowserStorageProvider-CuOW1Er2.esm.js → BrowserStorageProvider-BpJM-gIl.esm.js} +8 -1
- package/dist/{IpifyProvider-D7jx52AL.esm.js → IpifyProvider-D4LWD15E.esm.js} +28 -0
- package/dist/{MotionSensorProvider-4v7xkqAp.esm.js → MotionSensorProvider-Bx7Mpzt0.esm.js} +63 -13
- package/dist/{OpenViduRecordingProvider-CMu6XVdc.esm.js → OpenViduRecordingProvider-O4GjBseO.esm.js} +1 -1
- package/dist/StateMachine-BC_nGvrc.d.ts +2 -0
- package/dist/StreamCanvasCapture-ImiDQdVA.esm.js +118 -0
- package/dist/StreamCanvasCapture-yyl20qd9.d.ts +152 -0
- package/dist/{BaseWasmProvider-C_DLEI40.esm.js → WasmUtilProvider-CiEN7Gjn.esm.js} +183 -11
- package/dist/{addressSearch-BpTbTWCa.esm.js → addressSearch-DvmWXKZg.esm.js} +63 -57
- package/dist/{ae-signature-DDDZmWXj.esm.js → ae-signature-BFZta3TZ.esm.js} +1 -1
- package/dist/ae-signature.d.ts +3 -3
- package/dist/ae-signature.esm.js +6 -5
- package/dist/antifraud.d.ts +5 -46
- package/dist/antifraud.esm.js +6 -43
- package/dist/antifraudManager-CkV4u-LE.esm.js +55 -0
- package/dist/antifraudManager-CznnhyvD.d.ts +63 -0
- package/dist/{antifraudStateMachine-O0TMf6yc.esm.js → antifraudStateMachine-Ccrb-Jxc.esm.js} +2 -2
- package/dist/apiError-B-j-gyDx.esm.js +51 -0
- package/dist/authentication.d.ts +13 -11
- package/dist/authentication.esm.js +26 -22
- package/dist/{authenticationManager-C83GNIhl.d.ts → authenticationManager-CIVY80H9.d.ts} +4 -4
- package/dist/{authenticationManager-5M-fKzXx.esm.js → authenticationManager-ZNotsWnC.esm.js} +6 -6
- package/dist/{authenticationStateMachine-BMZqatiF.esm.js → authenticationStateMachine-DksVbF_H.esm.js} +21 -9
- package/dist/{backCameraStream-DMdMeGk2.esm.js → backCameraStream-D7Wo4Nbx.esm.js} +95 -7
- package/dist/{session-CGtQJJzB.esm.js → browserSimulation-B1dWiXp7.esm.js} +61 -476
- package/dist/camera.d.ts +4 -3
- package/dist/camera.esm.js +4 -3
- package/dist/canvas-SKcRBxsk.esm.js +230 -0
- package/dist/consent.d.ts +4 -398
- package/dist/consent.esm.js +6 -77
- package/dist/consentManager-BLd51QiW.d.ts +419 -0
- package/dist/consentManager-BYo9Nu1r.esm.js +90 -0
- package/dist/{consentStateMachine-CCT-B60O.esm.js → consentStateMachine-BG3yL8aC.esm.js} +9 -6
- package/dist/cpf-ocr.d.ts +4 -199
- package/dist/cpf-ocr.esm.js +8 -177
- package/dist/cpfOcrManager-BnieFXuG.d.ts +216 -0
- package/dist/cpfOcrManager-sSKegxox.esm.js +190 -0
- package/dist/cross-document-data-match.d.ts +1 -1
- package/dist/cross-document-data-match.esm.js +4 -4
- package/dist/curp-validation.d.ts +8 -158
- package/dist/curp-validation.esm.js +6 -108
- package/dist/curpValidationManager-CFem6zP9.esm.js +122 -0
- package/dist/curpValidationManager-RttixpIc.d.ts +184 -0
- package/dist/{curpValidationStateMachine-CitWLr2c.esm.js → curpValidationStateMachine-B7V_qp66.esm.js} +20 -13
- package/dist/custom-fields.d.ts +2 -2
- package/dist/custom-fields.esm.js +4 -4
- package/dist/custom-watchlist.d.ts +1 -1
- package/dist/custom-watchlist.esm.js +4 -41
- package/dist/customWatchlistStateMachine-HmFybXLX.esm.js +50 -0
- package/dist/{deepsightLoader-Cm4JIT_z.esm.js → deepsightLoader-65k1Appi.esm.js} +19 -10
- package/dist/{deepsightService-CEVxzehb.d.ts → deepsightService-B7ShOkWL.d.ts} +8 -160
- package/dist/deepsightService-CrHmvx8X.esm.js +276 -0
- package/dist/device.esm.js +4 -3
- package/dist/document-capture.d.ts +992 -83
- package/dist/document-capture.esm.js +34 -8
- package/dist/document-upload.d.ts +47 -47
- package/dist/document-upload.esm.js +7 -7
- package/dist/{documentCaptureStateMachine-BqzTDy9k.esm.js → documentCaptureStateMachine-WYV1r9le.esm.js} +90 -6
- package/dist/dynamic-forms.d.ts +20 -5
- package/dist/dynamic-forms.esm.js +150 -61
- package/dist/ekyb.d.ts +32 -13
- package/dist/ekyb.esm.js +25 -15
- package/dist/{ekybStateMachine-BR2let5f.esm.js → ekybStateMachine-aYixw2sL.esm.js} +319 -207
- package/dist/ekyc.d.ts +10 -78
- package/dist/ekyc.esm.js +17 -12
- package/dist/{ekycStateMachine-oeO0Iekd.esm.js → ekycStateMachine-CXbpaJJn.esm.js} +201 -113
- package/dist/electronic-signature.d.ts +3 -3
- package/dist/electronic-signature.esm.js +5 -4
- package/dist/{electronicSignatureManager-D9OHzTpG.esm.js → electronicSignatureManager-BaECdJ1u.esm.js} +91 -23
- package/dist/email.d.ts +4 -3
- package/dist/email.esm.js +6 -5
- package/dist/{emailManager-wAV0LE-H.esm.js → emailManager--D5G3ChB.esm.js} +30 -7
- package/dist/{emailManager-DIfnS5g1.d.ts → emailManager-lAzDoQOs.d.ts} +66 -8
- package/dist/{emailStateMachine-DOf4j58N.esm.js → emailStateMachine-CxTOMAjC.esm.js} +46 -11
- package/dist/{endpoints-CnN3SyDa.esm.js → endpoints-BeTK0Mlt.esm.js} +6 -3
- package/dist/{events-D6-e4vok.esm.js → events-Dvvriq9l.esm.js} +3 -1
- package/dist/events.d.ts +2 -0
- package/dist/events.esm.js +1 -1
- package/dist/extensibility.d.ts +32 -16
- package/dist/extensibility.esm.js +55 -33
- package/dist/face-match.d.ts +32 -2
- package/dist/face-match.esm.js +5 -5
- package/dist/{faceCaptureManagerFactory-yqtpxjnN.d.ts → faceCaptureManagerFactory-C_hRHx8a.d.ts} +35 -11
- package/dist/{faceCaptureManagerFactory-Dh2PdGlF.esm.js → faceCaptureManagerFactory-kqbUqtrr.esm.js} +21 -5
- package/dist/{faceCaptureSetup-B3faSpYA.esm.js → faceCaptureSetup-CtvHWd3x.esm.js} +68 -183
- package/dist/{faceMatchStateMachine-DNFrxTFS.esm.js → faceMatchStateMachine-DdGXUBnx.esm.js} +60 -6
- package/dist/field-comparison.d.ts +4 -0
- package/dist/field-comparison.esm.js +7 -0
- package/dist/fieldComparisonManager-Bu5TaSr3.d.ts +76 -0
- package/dist/fieldComparisonManager-COGI2ARD.esm.js +162 -0
- package/dist/fiscal-qr.d.ts +59 -0
- package/dist/fiscal-qr.esm.js +323 -0
- package/dist/flow-events.d.ts +6 -5
- package/dist/flow.d.ts +23 -15
- package/dist/flow.esm.js +63 -17
- package/dist/flowCompletionService-BdR2cGgB.d.ts +19 -0
- package/dist/flowCompletionService-DdGojV9K.esm.js +20 -0
- package/dist/{flowServices-DG3IdWw6.esm.js → flowServices-BTuHLHVr.esm.js} +10 -5
- package/dist/geolocation.d.ts +4 -4
- package/dist/geolocation.esm.js +6 -6
- package/dist/{geolocationStateMachine-asasuHY2.esm.js → geolocationStateMachine-Dvh7X0wF.esm.js} +5 -5
- package/dist/getBrowser-C8DP7oTB.esm.js +8 -0
- package/dist/{getBrowser-BSXUTWXw.esm.js → getDeviceClass-C0olyNFS.esm.js} +1 -8
- package/dist/{getDeviceClass-BSntT9_j.esm.js → getDeviceClass-C8Do2qYu.esm.js} +1 -1
- package/dist/government-validation.d.ts +28 -8
- package/dist/government-validation.esm.js +19 -8
- package/dist/{governmentValidationStateMachine-BDDYrJTo.esm.js → governmentValidationStateMachine-DcJ-BfsC.esm.js} +35 -77
- package/dist/home.d.ts +15 -14
- package/dist/home.esm.js +2 -2
- package/dist/http-Cai3IoLS.esm.js +0 -0
- package/dist/http.esm.js +1 -0
- package/dist/id-ocr.d.ts +54 -54
- package/dist/id-ocr.esm.js +5 -5
- package/dist/id-verification.d.ts +27 -27
- package/dist/id-verification.esm.js +4 -4
- package/dist/id.d.ts +12 -10
- package/dist/id.esm.js +36 -26
- package/dist/{idCaptureManager-Fyd0eam-.d.ts → idCaptureManager-D-QYESvF.d.ts} +28 -14
- package/dist/{idCaptureManager-ZPkD7Gjk.esm.js → idCaptureManager-DGVv5l1_.esm.js} +22 -7
- package/dist/{idCaptureStateMachine-BK0bPHoc.esm.js → idCaptureStateMachine-DHi7HydI.esm.js} +172 -123
- package/dist/{idOcrStateMachine-YbjjC_Gg.esm.js → idOcrStateMachine-CDQ5d_VM.esm.js} +4 -4
- package/dist/{idVerificationStateMachine-xbw9HP1Z.esm.js → idVerificationStateMachine-kRxwImzO.esm.js} +2 -2
- package/dist/identity-reuse.d.ts +4 -530
- package/dist/identity-reuse.esm.js +8 -274
- package/dist/identityReuseManager-C6n_97dw.esm.js +95 -0
- package/dist/identityReuseManager-DwLtVzUn.d.ts +428 -0
- package/dist/identityReuseStateMachine-BfE5YiEr.esm.js +148 -0
- package/dist/{index-BcRG8rtJ.d.ts → index-B5hPA0Bg.d.ts} +2 -2
- package/dist/{index-DZoqeAo9.d.ts → index-B9NysVDB.d.ts} +469 -195
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +10 -8
- package/dist/{invokeOnCaptureCallback-rc6kBHo5.esm.js → invokeOnCaptureCallback-ygByVdnn.esm.js} +1 -1
- package/dist/{lib-BB0B_qQX.esm.js → lib-BY67lgbq.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +8 -412
- package/dist/mandatory-consent.esm.js +6 -76
- package/dist/mandatoryConsentManager-H6D18cZB.esm.js +89 -0
- package/dist/mandatoryConsentManager-KfIlURRY.d.ts +429 -0
- package/dist/{mandatoryConsentStateMachine-Cnco1jvn.esm.js → mandatoryConsentStateMachine-DtQNW1ji.esm.js} +6 -6
- package/dist/openviduLazy-B8L--0oe.esm.js +3 -0
- package/dist/{openviduLazy-Cok70ZSg.esm.js → openviduLazy-Dh14JNJc.esm.js} +2 -2
- package/dist/otp-CGMdUzBC.esm.js +33 -0
- package/dist/otp-DF5A0sFx.d.ts +8 -0
- package/dist/permissionGuards-C1ispV96.esm.js +23 -0
- package/dist/permissionServices-CG3bMSfG.esm.js +130 -0
- package/dist/phone.d.ts +4 -3
- package/dist/phone.esm.js +6 -5
- package/dist/{phoneManager-DAJbGhlY.esm.js → phoneManager-BmF-0Ez4.esm.js} +30 -7
- package/dist/{phoneManager-B6M30hKE.d.ts → phoneManager-fPmIBYQK.d.ts} +65 -7
- package/dist/{phoneStateMachine-CuPARRaT.esm.js → phoneStateMachine-BiV0yoEx.esm.js} +46 -11
- package/dist/{qe-signature-DFo_Cc-I.esm.js → qe-signature-CUYPcHVo.esm.js} +1 -1
- package/dist/qe-signature.d.ts +3 -3
- package/dist/qe-signature.esm.js +6 -5
- package/dist/{recordingService-Ig2UgbLv.esm.js → recordingService-Bn9EdCmz.esm.js} +197 -179
- package/dist/redirect-to-mobile.d.ts +6 -104
- package/dist/redirect-to-mobile.esm.js +6 -99
- package/dist/redirectToMobileManager-BNe3IzC_.d.ts +178 -0
- package/dist/redirectToMobileManager-Dy3t7o0C.esm.js +159 -0
- package/dist/{redirectToMobileStateMachine-BOEqe46A.esm.js → redirectToMobileStateMachine-DyAdRxfP.esm.js} +28 -19
- package/dist/{runChildModule-CqqwqAkW.esm.js → runChildModule-CuoHZ1cx.esm.js} +35 -3
- package/dist/selfie.d.ts +13 -11
- package/dist/selfie.esm.js +27 -23
- package/dist/{selfieManager-Duisl7qN.esm.js → selfieManager-BjCoKRy0.esm.js} +6 -6
- package/dist/{selfieManager-D0lSgd-J.d.ts → selfieManager-dUbKRzOh.d.ts} +4 -4
- package/dist/{selfieStateMachine-D76whWEf.esm.js → selfieStateMachine-b4F2q9zw.esm.js} +5 -3
- package/dist/session-DoVb-OcB.esm.js +152 -0
- package/dist/session.d.ts +37 -5
- package/dist/session.esm.js +12 -7
- package/dist/sessionInitializer-B8H5MsXM.esm.js +366 -0
- package/dist/{setup-C5AITV8m.d.ts → setup-BbkprdVv.d.ts} +57 -6
- package/dist/{setup-DsM8IG7k.esm.js → setup-BqEfrdja.esm.js} +162 -24
- package/dist/signature.d.ts +2 -2
- package/dist/signature.esm.js +4 -4
- package/dist/{signatureStateMachine-B5-QVUve.esm.js → signatureStateMachine-C5qqYLRz.esm.js} +3 -3
- package/dist/stats-BMNUG1AU.esm.js +41 -0
- package/dist/stats.d.ts +13 -2
- package/dist/stats.esm.js +3 -2
- package/dist/trust-graph.d.ts +33 -4
- package/dist/trust-graph.esm.js +21 -15
- package/dist/{types-CFV9G_7j.d.ts → types-Bj9hdFjU.d.ts} +1 -1
- package/dist/{types-BP1m8VRw.d.ts → types-DOUhndhT.d.ts} +14 -2
- package/dist/types-DsnEVMhr.esm.js +34 -0
- package/dist/types-DvGZI7BF.d.ts +131 -0
- package/dist/{types-B06Ypu2F.d.ts → types-NuT8ftBV.d.ts} +1 -1
- package/dist/types-ya0LN_MX.d.ts +5 -0
- package/dist/{warmup-CEcppFiS.d.ts → warmup-Dg8Lh-50.d.ts} +8 -0
- package/dist/wasm.d.ts +6 -4
- package/dist/wasm.esm.js +11 -9
- package/dist/watchlist-for-business.d.ts +1 -1
- package/dist/watchlist-for-business.esm.js +5 -73
- package/dist/watchlist.d.ts +1 -1
- package/dist/watchlist.esm.js +4 -41
- package/dist/watchlistForBusinessStateMachine-DMl8j2Ov.esm.js +74 -0
- package/dist/watchlistStateMachine-DmQlqI6L.esm.js +50 -0
- package/dist/workflow.d.ts +153 -100
- package/dist/workflow.esm.js +156 -80
- package/package.json +19 -1
- package/dist/StateMachine-BCQrZJhf.d.ts +0 -2
- package/dist/WasmUtilProvider-j98OJf-S.esm.js +0 -114
- package/dist/browserSimulation-gxD8cSpM.esm.js +0 -20
- package/dist/deepsightService-O74l4Y__.esm.js +0 -489
- package/dist/displayErrors-DqJ_IbsG.d.ts +0 -39
- package/dist/flowCompletionService-DhkT4SRY.d.ts +0 -10
- package/dist/flowCompletionService-P54yzGvA.esm.js +0 -13
- package/dist/openviduLazy-Cm0XFh_v.esm.js +0 -3
- package/dist/permissionServices-D_i6nzEw.esm.js +0 -50
- package/dist/stats-CIfiPzb1.esm.js +0 -16
- package/dist/types-CAD4va6a.d.ts +0 -5
- package/dist/watchlistServices-DMbUhkBX.esm.js +0 -12
- /package/dist/{Actor-CI32dTbG.d.ts → Actor-Y0_Fj-KL.d.ts} +0 -0
- /package/dist/{ITimerCapability-C67ZRskg.esm.js → ITimerCapability-CB0I1Uf2.esm.js} +0 -0
- /package/dist/{Manager-C8PrhBOx.d.ts → Manager-BHn8wH8K.d.ts} +0 -0
- /package/dist/{camera-PA2Ljri3.esm.js → camera-DJWm3V4g.esm.js} +0 -0
- /package/dist/{camera-DBSxa6ML.d.ts → camera-SRBpPq2X.d.ts} +0 -0
- /package/dist/{chunk-CRF6K_H_.esm.js → chunk-CMUKZ2uL.esm.js} +0 -0
- /package/dist/{cpf-PPz2Njto.esm.js → cpf-BRzggV8G.esm.js} +0 -0
- /package/dist/{dateUtils-UoN5xswP.esm.js → dateUtils-AksLQmgV.esm.js} +0 -0
- /package/dist/{platform-CfrjKhmi.esm.js → platform-SKvEfCBh.esm.js} +0 -0
- /package/dist/{xstate.esm-B70JrNqo.esm.js → xstate.esm-C9wncMQa.esm.js} +0 -0
package/dist/ekyc.d.ts
CHANGED
|
@@ -1,74 +1,7 @@
|
|
|
1
|
-
import { t as Manager } from "./Manager-
|
|
2
|
-
import "./Actor-
|
|
3
|
-
import {
|
|
1
|
+
import { t as Manager } from "./Manager-BHn8wH8K.js";
|
|
2
|
+
import "./Actor-Y0_Fj-KL.js";
|
|
3
|
+
import { a as EkycValidationError, c as AddressSuggestion, i as EkycModuleConfig, n as EkycFieldDef, o as EkycValidationErrors, r as EkycFormValues, t as EkycConfig } from "./types-DvGZI7BF.js";
|
|
4
4
|
|
|
5
|
-
//#region src/modules/ekyc/types.d.ts
|
|
6
|
-
type EkycFieldSource = 'user_input' | 'document_scan' | 'poa_document' | 'phone_module_input' | 'email_module_input' | false;
|
|
7
|
-
type EkycVerificationFields = {
|
|
8
|
-
name?: EkycFieldSource;
|
|
9
|
-
address?: EkycFieldSource;
|
|
10
|
-
phone?: EkycFieldSource;
|
|
11
|
-
email?: EkycFieldSource;
|
|
12
|
-
SSN?: EkycFieldSource;
|
|
13
|
-
taxId?: EkycFieldSource;
|
|
14
|
-
nationality?: EkycFieldSource;
|
|
15
|
-
'date of birth'?: EkycFieldSource;
|
|
16
|
-
dlNumber?: EkycFieldSource;
|
|
17
|
-
dlState?: EkycFieldSource;
|
|
18
|
-
dlExpireAt?: EkycFieldSource;
|
|
19
|
-
last4SSN?: EkycFieldSource;
|
|
20
|
-
idNum?: EkycFieldSource;
|
|
21
|
-
idNum1?: EkycFieldSource;
|
|
22
|
-
gender?: EkycFieldSource;
|
|
23
|
-
panNumber?: EkycFieldSource;
|
|
24
|
-
};
|
|
25
|
-
type EkycModuleConfig = {
|
|
26
|
-
source: string;
|
|
27
|
-
enablePhoneRisk?: boolean;
|
|
28
|
-
checkName?: boolean;
|
|
29
|
-
nameSource?: string;
|
|
30
|
-
checkEmail?: boolean;
|
|
31
|
-
emailSource?: string;
|
|
32
|
-
checkAddress?: boolean;
|
|
33
|
-
addressSource?: string;
|
|
34
|
-
checkPhone?: boolean;
|
|
35
|
-
phoneSource?: string;
|
|
36
|
-
checkSsn?: boolean;
|
|
37
|
-
ssnSource?: string;
|
|
38
|
-
checkDob?: boolean;
|
|
39
|
-
dobSource?: string;
|
|
40
|
-
checkNationality?: boolean;
|
|
41
|
-
nationalitySource?: string;
|
|
42
|
-
checkDlNumber?: boolean;
|
|
43
|
-
dlNumberSource?: string;
|
|
44
|
-
checkDlState?: boolean;
|
|
45
|
-
dlStateSource?: string;
|
|
46
|
-
checkDlExpireAt?: boolean;
|
|
47
|
-
dlExpireAtSource?: string;
|
|
48
|
-
checkLast4SSN?: boolean;
|
|
49
|
-
last4SSNSource?: string;
|
|
50
|
-
checkIdNum?: boolean;
|
|
51
|
-
idNumSource?: string;
|
|
52
|
-
checkIdNum1?: boolean;
|
|
53
|
-
idNum1Source?: string;
|
|
54
|
-
checkGender?: boolean;
|
|
55
|
-
genderSource?: string;
|
|
56
|
-
checkPanNumber?: boolean;
|
|
57
|
-
panNumberSource?: string;
|
|
58
|
-
};
|
|
59
|
-
type EkycFormValues = Record<string, string | undefined>;
|
|
60
|
-
/** Manager creation config */
|
|
61
|
-
type EkycConfig = {
|
|
62
|
-
flowId?: string;
|
|
63
|
-
verificationFields?: EkycVerificationFields;
|
|
64
|
-
source?: string;
|
|
65
|
-
fieldsCountry?: string;
|
|
66
|
-
enablePhoneRisk?: boolean;
|
|
67
|
-
};
|
|
68
|
-
type EkycFieldDef = FieldDef & {
|
|
69
|
-
source: EkycFieldSource;
|
|
70
|
-
};
|
|
71
|
-
//#endregion
|
|
72
5
|
//#region src/modules/ekyc/ekycStateMachine.d.ts
|
|
73
6
|
declare const ekycMachine: any;
|
|
74
7
|
//#endregion
|
|
@@ -85,14 +18,14 @@ type EkycFormState = {
|
|
|
85
18
|
status: 'form';
|
|
86
19
|
fields: EkycFieldDef[];
|
|
87
20
|
values: EkycFormValues;
|
|
88
|
-
|
|
21
|
+
validationErrors?: EkycValidationErrors;
|
|
22
|
+
/** True iff `validationErrors` is empty. Optimistic semantic: starts true on initial render. */
|
|
89
23
|
isValid: boolean;
|
|
90
24
|
addressSuggestions: AddressSuggestion[];
|
|
91
25
|
prefilled: Record<string, boolean>;
|
|
92
26
|
hideEmail: boolean;
|
|
93
27
|
fieldsCountry: string;
|
|
94
28
|
submitError: string;
|
|
95
|
-
submitAttempted: boolean;
|
|
96
29
|
};
|
|
97
30
|
type EkycSubmittingState = {
|
|
98
31
|
status: 'submitting';
|
|
@@ -123,13 +56,15 @@ type EkycState = EkycLoadingState | EkycFormState | EkycSubmittingState | EkycSu
|
|
|
123
56
|
declare function createEkycManager(options: CreateEkycActorOptions): Manager<EkycState> & {
|
|
124
57
|
/** Initializes the eKYC flow — fetches config and pre-fill data */
|
|
125
58
|
load(): void;
|
|
126
|
-
/** Sets a form field value
|
|
59
|
+
/** Sets a form field value. Clears any existing validation error for this field. */
|
|
127
60
|
setField(name: string, value: string): void;
|
|
61
|
+
/** Validates a single field (e.g., on blur). Populates or clears `validationErrors[name]`. */
|
|
62
|
+
validateField(name: string): void;
|
|
128
63
|
/** Initiates a debounced address autocomplete search */
|
|
129
64
|
searchAddress(query: string): void;
|
|
130
65
|
/** Selects an address suggestion and populates address fields */
|
|
131
66
|
selectAddress(suggestion: AddressSuggestion): void;
|
|
132
|
-
/** Submits the form
|
|
67
|
+
/** Submits the form. Runs full-form validation; advances only when no errors. */
|
|
133
68
|
submit(): void;
|
|
134
69
|
/** Retries from failure state, returning to the form */
|
|
135
70
|
retry(): void;
|
|
@@ -140,9 +75,6 @@ declare function createEkycManager(options: CreateEkycActorOptions): Manager<Eky
|
|
|
140
75
|
};
|
|
141
76
|
type EkycManager = ReturnType<typeof createEkycManager>;
|
|
142
77
|
//#endregion
|
|
143
|
-
//#region src/modules/ekyc/ekycActions.d.ts
|
|
144
|
-
declare function computeDisplayErrors(errors: Record<string, string>, touched: Record<string, boolean>, submitAttempted: boolean, country: string, fields?: EkycFieldDef[]): DisplayErrorsResult;
|
|
145
|
-
//#endregion
|
|
146
78
|
//#region src/modules/ekyc/ekycUtils.d.ts
|
|
147
79
|
/**
|
|
148
80
|
* Normalizes any supported eKYC config input into a manager-ready `EkycConfig`.
|
|
@@ -161,4 +93,4 @@ declare function computeDisplayErrors(errors: Record<string, string>, touched: R
|
|
|
161
93
|
*/
|
|
162
94
|
declare function toEkycConfig(config: Partial<EkycModuleConfig> & Partial<EkycConfig>): EkycConfig;
|
|
163
95
|
//#endregion
|
|
164
|
-
export { type AddressSuggestion, type EkycConfig, type EkycManager, type EkycModuleConfig, type EkycState,
|
|
96
|
+
export { type AddressSuggestion, type EkycConfig, type EkycManager, type EkycModuleConfig, type EkycState, type EkycValidationError, type EkycValidationErrors, createEkycManager, ekycMachine, toEkycConfig };
|
package/dist/ekyc.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./BrowserTimerProvider-DhNc_x02.esm.js";
|
|
2
2
|
import "./api-CESGtpbH.esm.js";
|
|
3
|
-
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-
|
|
4
|
-
import "./endpoints-
|
|
5
|
-
import { c as createManager, s as createActor } from "./xstate.esm-
|
|
6
|
-
import "./cpf-
|
|
7
|
-
import "./addressSearch-
|
|
8
|
-
import { n as
|
|
3
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dvvriq9l.esm.js";
|
|
4
|
+
import "./endpoints-BeTK0Mlt.esm.js";
|
|
5
|
+
import { c as createManager, s as createActor } from "./xstate.esm-C9wncMQa.esm.js";
|
|
6
|
+
import "./cpf-BRzggV8G.esm.js";
|
|
7
|
+
import "./addressSearch-DvmWXKZg.esm.js";
|
|
8
|
+
import { n as toEkycConfig, t as ekycMachine } from "./ekycStateMachine-CXbpaJJn.esm.js";
|
|
9
9
|
|
|
10
10
|
//#region src/modules/ekyc/ekycActor.ts
|
|
11
11
|
/**
|
|
@@ -26,14 +26,13 @@ function mapState(snapshot) {
|
|
|
26
26
|
status: "form",
|
|
27
27
|
fields: context.fields,
|
|
28
28
|
values: context.values,
|
|
29
|
-
|
|
30
|
-
isValid: context.
|
|
29
|
+
validationErrors: context.validationErrors,
|
|
30
|
+
isValid: Object.keys(context.validationErrors ?? {}).length === 0,
|
|
31
31
|
addressSuggestions: context.addressSuggestions,
|
|
32
32
|
prefilled: context.prefilled,
|
|
33
33
|
hideEmail: context.hideEmail,
|
|
34
34
|
fieldsCountry: context.fieldsCountry,
|
|
35
|
-
submitError: context.submitError
|
|
36
|
-
submitAttempted: context.submitAttempted
|
|
35
|
+
submitError: context.submitError
|
|
37
36
|
};
|
|
38
37
|
if (typedSnapshot.matches("submitting")) return { status: "submitting" };
|
|
39
38
|
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
@@ -53,11 +52,17 @@ function createApi({ actor, trackElementClicked }) {
|
|
|
53
52
|
},
|
|
54
53
|
setField(name, value) {
|
|
55
54
|
actor.send({
|
|
56
|
-
type: "
|
|
55
|
+
type: "DATA_CHANGED",
|
|
57
56
|
name,
|
|
58
57
|
value
|
|
59
58
|
});
|
|
60
59
|
},
|
|
60
|
+
validateField(name) {
|
|
61
|
+
actor.send({
|
|
62
|
+
type: "VALIDATE_FIELD",
|
|
63
|
+
name
|
|
64
|
+
});
|
|
65
|
+
},
|
|
61
66
|
searchAddress(query) {
|
|
62
67
|
actor.send({
|
|
63
68
|
type: "SEARCH_ADDRESS",
|
|
@@ -101,4 +106,4 @@ function createEkycManager(options) {
|
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
//#endregion
|
|
104
|
-
export {
|
|
109
|
+
export { createEkycManager, ekycMachine, toEkycConfig };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
-
import { t as endpoints } from "./endpoints-
|
|
3
|
-
import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-
|
|
4
|
-
import { t as validateCPF } from "./cpf-
|
|
5
|
-
import { a as
|
|
2
|
+
import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
|
|
3
|
+
import { a as fromPromise, r as assign, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
|
|
4
|
+
import { t as validateCPF } from "./cpf-BRzggV8G.esm.js";
|
|
5
|
+
import { a as getPostalCodeMaxLength, c as STREET_LEVEL_REQUIRED_ERROR, d as usStateOptions, i as getPostalCodeErrorKey, l as fillFromSuggestion, n as FIXED_DIGIT_POSTAL_CODE_LENGTH, o as validatePostalCode, r as formatPostalCode, s as DYNAMIC_REQUIRED_KEY, t as debounceSearchActor, u as getStreetLevelErrorForSuggestion } from "./addressSearch-DvmWXKZg.esm.js";
|
|
6
6
|
|
|
7
7
|
//#region src/modules/ekyc/ekycConsts.ts
|
|
8
8
|
const COUNTRY_SELECTOR_DISABLED_SOURCES = ["UK_VOTER_REGISTER"];
|
|
@@ -29,7 +29,6 @@ const DRIVERS_LICENSE_FIELDS = [
|
|
|
29
29
|
"dlState",
|
|
30
30
|
"dlExpireAt"
|
|
31
31
|
];
|
|
32
|
-
const REQUIRED_ERROR_KEYS = new Set(["verification.errors.required"]);
|
|
33
32
|
const DOB_OPTIONAL_SOURCES = ["US_TELCO_1", "UK_VOTER_REGISTER"];
|
|
34
33
|
const ADDRESS_OPTIONAL_SOURCES = ["US_TELCO_1", "UK_VOTER_REGISTER"];
|
|
35
34
|
const LAST4SSN_OPTIONAL_SOURCES = ["US_TELCO_1"];
|
|
@@ -120,6 +119,8 @@ const MIDDLE_NAME_SOURCES = [
|
|
|
120
119
|
"CL_1",
|
|
121
120
|
"INDIA_PAN"
|
|
122
121
|
];
|
|
122
|
+
const PHONE_RISK_ADDONS = ["phoneCheck", "advancedPhoneCheck"];
|
|
123
|
+
const EMAIL_RISK_ADDONS = ["emailCheck"];
|
|
123
124
|
|
|
124
125
|
//#endregion
|
|
125
126
|
//#region src/modules/ekyc/ekycUtils.ts
|
|
@@ -132,15 +133,22 @@ function mapToEKYCvalue(field) {
|
|
|
132
133
|
default: return "user_input";
|
|
133
134
|
}
|
|
134
135
|
}
|
|
136
|
+
function hasRiskAddon(riskAddons, allowedAddons) {
|
|
137
|
+
return allowedAddons.some((addon) => riskAddons?.includes(addon));
|
|
138
|
+
}
|
|
135
139
|
/** Maps raw backend module config to a field-source mapping */
|
|
136
140
|
function getEKYCFields(config) {
|
|
141
|
+
const hasPhoneRiskAddon = hasRiskAddon(config.riskAddons, PHONE_RISK_ADDONS);
|
|
142
|
+
const hasEmailRiskAddon = hasRiskAddon(config.riskAddons, EMAIL_RISK_ADDONS);
|
|
143
|
+
const shouldRenderEmail = config.checkEmail || hasEmailRiskAddon;
|
|
144
|
+
const shouldRenderPhone = config.checkPhone || hasPhoneRiskAddon;
|
|
137
145
|
return {
|
|
138
146
|
name: config.checkName ? mapToEKYCvalue(config.nameSource ?? "") : false,
|
|
139
147
|
SSN: config.checkSsn ? mapToEKYCvalue(config.ssnSource ?? "") : false,
|
|
140
148
|
address: config.checkAddress ? mapToEKYCvalue(config.addressSource ?? "") : false,
|
|
141
149
|
"date of birth": config.checkDob ? mapToEKYCvalue(config.dobSource ?? "") : false,
|
|
142
|
-
email:
|
|
143
|
-
phone:
|
|
150
|
+
email: shouldRenderEmail ? mapToEKYCvalue(config.emailSource ?? "") : false,
|
|
151
|
+
phone: shouldRenderPhone ? mapToEKYCvalue(config.phoneSource ?? "") : false,
|
|
144
152
|
nationality: config.checkNationality ? mapToEKYCvalue(config.nationalitySource ?? "") : false,
|
|
145
153
|
dlNumber: config.checkDlNumber ? mapToEKYCvalue(config.dlNumberSource ?? "") : false,
|
|
146
154
|
dlState: config.checkDlState ? mapToEKYCvalue(config.dlStateSource ?? "") : false,
|
|
@@ -178,7 +186,7 @@ function getEKYCCountry(source) {
|
|
|
178
186
|
* distinguish a raw backend config from an unconfigured / empty input.
|
|
179
187
|
*/
|
|
180
188
|
function hasRawSignal(c) {
|
|
181
|
-
return Boolean(c.source || c.checkName || c.checkEmail || c.checkAddress || c.checkPhone || c.checkSsn || c.checkDob || c.checkNationality || c.checkDlNumber || c.checkDlState || c.checkDlExpireAt || c.checkLast4SSN || c.checkIdNum || c.checkIdNum1 || c.checkGender || c.checkPanNumber);
|
|
189
|
+
return Boolean(c.source || c.checkName || c.checkEmail || c.checkAddress || c.checkPhone || c.checkSsn || c.checkDob || c.checkNationality || c.checkDlNumber || c.checkDlState || c.checkDlExpireAt || c.checkLast4SSN || c.checkIdNum || c.checkIdNum1 || c.checkGender || c.checkPanNumber || c.riskAddons?.length);
|
|
182
190
|
}
|
|
183
191
|
/**
|
|
184
192
|
* Normalizes any supported eKYC config input into a manager-ready `EkycConfig`.
|
|
@@ -10047,21 +10055,127 @@ function validatePhone(phone, country) {
|
|
|
10047
10055
|
function formatPhoneE164(phone, country) {
|
|
10048
10056
|
return phoneValidator.formatE164(phone, country) ?? phone;
|
|
10049
10057
|
}
|
|
10058
|
+
const SSN_FORMAT_REGEX = /^\d{3}-\d{2}-\d{4}$/;
|
|
10059
|
+
const EMAIL_FORMAT_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
10060
|
+
const buildPostalCodeParams = (country) => {
|
|
10061
|
+
const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
|
|
10062
|
+
if (fixedLen !== void 0) return { length: fixedLen };
|
|
10063
|
+
let maxLen = getPostalCodeMaxLength(country);
|
|
10064
|
+
if (country === "US" || country === "BR") maxLen = maxLen - 1;
|
|
10065
|
+
return { maxLength: maxLen };
|
|
10066
|
+
};
|
|
10067
|
+
const createValidators = () => ({
|
|
10068
|
+
required: (value, _rule, field) => {
|
|
10069
|
+
if (value.trim().length > 0) return void 0;
|
|
10070
|
+
const fieldName = field.displayLabel ?? field.label;
|
|
10071
|
+
return fieldName ? {
|
|
10072
|
+
key: DYNAMIC_REQUIRED_KEY,
|
|
10073
|
+
params: { fieldName }
|
|
10074
|
+
} : { key: DYNAMIC_REQUIRED_KEY };
|
|
10075
|
+
},
|
|
10076
|
+
streetLevelRequired: (value) => {
|
|
10077
|
+
if (value.trim().length > 0) return void 0;
|
|
10078
|
+
return STREET_LEVEL_REQUIRED_ERROR;
|
|
10079
|
+
},
|
|
10080
|
+
cpf: (value) => {
|
|
10081
|
+
if (value.trim().length === 0) return void 0;
|
|
10082
|
+
return validateCPF(value) ? void 0 : { key: "verification.errors.invalidTaxId" };
|
|
10083
|
+
},
|
|
10084
|
+
ssnFormat: (value) => {
|
|
10085
|
+
if (value.trim().length === 0) return void 0;
|
|
10086
|
+
return SSN_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.ssnFormat" };
|
|
10087
|
+
},
|
|
10088
|
+
noPoBox: (value) => {
|
|
10089
|
+
if (value.trim().length === 0) return void 0;
|
|
10090
|
+
return isPoBox(value) ? { key: "verification.errors.poBox" } : void 0;
|
|
10091
|
+
},
|
|
10092
|
+
postalCodeFormat: (value, rule) => {
|
|
10093
|
+
if (rule.type !== "postalCodeFormat") return void 0;
|
|
10094
|
+
if (value.trim().length === 0) return void 0;
|
|
10095
|
+
if (validatePostalCode(value, rule.country)) return void 0;
|
|
10096
|
+
return {
|
|
10097
|
+
key: getPostalCodeErrorKey(rule.country),
|
|
10098
|
+
params: buildPostalCodeParams(rule.country)
|
|
10099
|
+
};
|
|
10100
|
+
},
|
|
10101
|
+
phoneFormat: (value, rule) => {
|
|
10102
|
+
if (rule.type !== "phoneFormat") return void 0;
|
|
10103
|
+
const trimmed = value.trim();
|
|
10104
|
+
if (rule.optional && trimmed.length === 0) return void 0;
|
|
10105
|
+
return validatePhone(trimmed, rule.country) ? void 0 : { key: "verification.errors.phoneInvalid" };
|
|
10106
|
+
},
|
|
10107
|
+
emailFormat: (value) => {
|
|
10108
|
+
if (value.trim().length === 0) return void 0;
|
|
10109
|
+
return EMAIL_FORMAT_REGEX.test(value) ? void 0 : { key: "verification.errors.emailInvalid" };
|
|
10110
|
+
},
|
|
10111
|
+
exactLength: (value, rule) => {
|
|
10112
|
+
if (rule.type !== "exactLength") return void 0;
|
|
10113
|
+
if (value.trim().length === 0) return void 0;
|
|
10114
|
+
return value.length === rule.length ? void 0 : { key: "verification.errors.exactly10Characters" };
|
|
10115
|
+
}
|
|
10116
|
+
});
|
|
10117
|
+
const normalizeFieldValue = (value) => typeof value === "string" ? value : String(value ?? "");
|
|
10118
|
+
const evaluateRules = (value, rules, field, validators) => {
|
|
10119
|
+
if (!rules) return void 0;
|
|
10120
|
+
for (const rule of rules) {
|
|
10121
|
+
const error = validators[rule.type](value, rule, field);
|
|
10122
|
+
if (error) return error;
|
|
10123
|
+
}
|
|
10124
|
+
};
|
|
10125
|
+
function validateEkycForm(values, fields) {
|
|
10126
|
+
const validators = createValidators();
|
|
10127
|
+
return fields.reduce((errors, field) => {
|
|
10128
|
+
const error = evaluateRules(normalizeFieldValue(values[field.name]), field.validation, field, validators);
|
|
10129
|
+
if (error) errors[field.name] = error;
|
|
10130
|
+
return errors;
|
|
10131
|
+
}, {});
|
|
10132
|
+
}
|
|
10133
|
+
function validateEkycField(values, fieldName, fields) {
|
|
10134
|
+
const field = fields.find((f) => f.name === fieldName);
|
|
10135
|
+
if (!field) return void 0;
|
|
10136
|
+
const validators = createValidators();
|
|
10137
|
+
return evaluateRules(normalizeFieldValue(values[field.name]), field.validation, field, validators);
|
|
10138
|
+
}
|
|
10050
10139
|
|
|
10051
10140
|
//#endregion
|
|
10052
10141
|
//#region src/modules/ekyc/ekycActions.ts
|
|
10142
|
+
function buildValidationRules(field, country, configSource) {
|
|
10143
|
+
const rules = [];
|
|
10144
|
+
if (field.required) rules.push({ type: "required" });
|
|
10145
|
+
if (field.name === "taxId" && country === "BR") rules.push({ type: "cpf" });
|
|
10146
|
+
if (field.name === "ssn" && (country === "US" || country === "CA")) rules.push({ type: "ssnFormat" });
|
|
10147
|
+
if (field.name === "street") rules.push({ type: "noPoBox" });
|
|
10148
|
+
if (field.name === "postalCode") rules.push({
|
|
10149
|
+
type: "postalCodeFormat",
|
|
10150
|
+
country
|
|
10151
|
+
});
|
|
10152
|
+
if (field.name === "phone") rules.push({
|
|
10153
|
+
type: "phoneFormat",
|
|
10154
|
+
country,
|
|
10155
|
+
optional: isFieldOptional("phone", configSource)
|
|
10156
|
+
});
|
|
10157
|
+
if (field.name === "email") rules.push({ type: "emailFormat" });
|
|
10158
|
+
if (field.name === "panNumber") rules.push({
|
|
10159
|
+
type: "exactLength",
|
|
10160
|
+
length: 10
|
|
10161
|
+
});
|
|
10162
|
+
return rules;
|
|
10163
|
+
}
|
|
10053
10164
|
function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false) {
|
|
10054
10165
|
const defs = [];
|
|
10055
10166
|
const add = (name, type, label, source, opts) => {
|
|
10056
10167
|
if (source === false) return;
|
|
10057
|
-
|
|
10168
|
+
const def = {
|
|
10058
10169
|
name,
|
|
10059
10170
|
type,
|
|
10060
10171
|
label,
|
|
10061
10172
|
source,
|
|
10062
10173
|
required: !isFieldOptional(name, configSource),
|
|
10063
10174
|
...opts
|
|
10064
|
-
}
|
|
10175
|
+
};
|
|
10176
|
+
const validation = buildValidationRules(def, country, configSource);
|
|
10177
|
+
if (validation.length > 0) def.validation = validation;
|
|
10178
|
+
defs.push(def);
|
|
10065
10179
|
};
|
|
10066
10180
|
const nameSource = fields.name || (NAME_SOURCES.includes(configSource) ? "user_input" : false);
|
|
10067
10181
|
if (nameSource) {
|
|
@@ -10163,68 +10277,6 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
|
|
|
10163
10277
|
}
|
|
10164
10278
|
return defs;
|
|
10165
10279
|
}
|
|
10166
|
-
function validateField(name, value, required, country, configSource) {
|
|
10167
|
-
const val = (value ?? "").trim();
|
|
10168
|
-
if (required && !val) return "verification.errors.required";
|
|
10169
|
-
if (!val) return void 0;
|
|
10170
|
-
if (name === "taxId" && country === "BR") return validateCPF(val) ? void 0 : "verification.errors.invalidTaxId";
|
|
10171
|
-
if (name === "ssn" && (country === "US" || country === "CA")) return /^\d{3}-\d{2}-\d{4}$/.test(val) ? void 0 : "verification.errors.ssnFormat";
|
|
10172
|
-
if (name === "street" && isPoBox(val)) return "verification.errors.poBox";
|
|
10173
|
-
if (name === "postalCode") return validatePostalCode(val, country) ? void 0 : getPostalCodeErrorKey(country);
|
|
10174
|
-
if (name === "phone") {
|
|
10175
|
-
if (!isFieldOptional("phone", configSource) || val) return validatePhone(val, country) ? void 0 : "verification.errors.phoneInvalid";
|
|
10176
|
-
}
|
|
10177
|
-
if (name === "email" && val) return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val) ? void 0 : "verification.errors.emailInvalid";
|
|
10178
|
-
if (name === "panNumber" && val) return val.length === 10 ? void 0 : "verification.errors.exactly10Characters";
|
|
10179
|
-
}
|
|
10180
|
-
function computeValidation(fields, values, country, configSource) {
|
|
10181
|
-
const errors = {};
|
|
10182
|
-
for (const field of fields) {
|
|
10183
|
-
const err = validateField(field.name, values[field.name], field.required, country, configSource);
|
|
10184
|
-
if (err) errors[field.name] = err;
|
|
10185
|
-
}
|
|
10186
|
-
return {
|
|
10187
|
-
errors,
|
|
10188
|
-
isValid: Object.keys(errors).length === 0
|
|
10189
|
-
};
|
|
10190
|
-
}
|
|
10191
|
-
function computeDisplayErrors(errors, touched, submitAttempted, country, fields) {
|
|
10192
|
-
const display = {};
|
|
10193
|
-
const errorParams = {};
|
|
10194
|
-
const fieldLabelMap = new Map(fields?.map((f) => [f.name, f.displayLabel ?? f.label]));
|
|
10195
|
-
for (const [field, err] of Object.entries(errors)) {
|
|
10196
|
-
const isRequiredErr = REQUIRED_ERROR_KEYS.has(err);
|
|
10197
|
-
if (isRequiredErr && (submitAttempted || touched[field])) {
|
|
10198
|
-
const label = fieldLabelMap.get(field);
|
|
10199
|
-
if (label) {
|
|
10200
|
-
display[field] = DYNAMIC_REQUIRED_KEY;
|
|
10201
|
-
errorParams[field] = {
|
|
10202
|
-
...errorParams[field] ?? {},
|
|
10203
|
-
fieldName: label
|
|
10204
|
-
};
|
|
10205
|
-
} else display[field] = DYNAMIC_REQUIRED_KEY;
|
|
10206
|
-
} else if (!isRequiredErr && touched[field]) display[field] = err;
|
|
10207
|
-
if (display[field] && field === "postalCode" && POSTAL_CODE_FORMAT_ERROR_KEYS.has(err)) {
|
|
10208
|
-
const fixedLen = FIXED_DIGIT_POSTAL_CODE_LENGTH[country];
|
|
10209
|
-
if (fixedLen !== void 0) errorParams[field] = {
|
|
10210
|
-
...errorParams[field] ?? {},
|
|
10211
|
-
length: fixedLen
|
|
10212
|
-
};
|
|
10213
|
-
else {
|
|
10214
|
-
let maxLen = getPostalCodeMaxLength(country);
|
|
10215
|
-
if (country === "US" || country === "BR") maxLen = maxLen - 1;
|
|
10216
|
-
errorParams[field] = {
|
|
10217
|
-
...errorParams[field] ?? {},
|
|
10218
|
-
maxLength: maxLen
|
|
10219
|
-
};
|
|
10220
|
-
}
|
|
10221
|
-
}
|
|
10222
|
-
}
|
|
10223
|
-
return {
|
|
10224
|
-
displayErrors: display,
|
|
10225
|
-
errorParams
|
|
10226
|
-
};
|
|
10227
|
-
}
|
|
10228
10280
|
function applyPrefill(fields, ocrData, otpStatus, _country) {
|
|
10229
10281
|
const values = {};
|
|
10230
10282
|
const prefilled = {};
|
|
@@ -10380,7 +10432,7 @@ async function submitEkyc(data, signal) {
|
|
|
10380
10432
|
|
|
10381
10433
|
//#endregion
|
|
10382
10434
|
//#region src/modules/ekyc/ekycGuards.ts
|
|
10383
|
-
const
|
|
10435
|
+
const hasNoValidationErrorsGuard = ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0;
|
|
10384
10436
|
const hasFlowIdGuard = ({ context }) => !!context.config.flowId;
|
|
10385
10437
|
const hasVerificationFieldsGuard = ({ context }) => !!context.config.verificationFields;
|
|
10386
10438
|
const COUNTRY_NOT_SUPPORTED_MSG = "Request unsuccessful. Country not supported for EKYC.";
|
|
@@ -10403,6 +10455,19 @@ const submitEkycActor = fromPromise(async ({ input, signal }) => submitEkyc(inpu
|
|
|
10403
10455
|
|
|
10404
10456
|
//#endregion
|
|
10405
10457
|
//#region src/modules/ekyc/ekycStateMachine.ts
|
|
10458
|
+
const ADDRESS_AUTOCOMPLETE_KEYS = [
|
|
10459
|
+
"street",
|
|
10460
|
+
"city",
|
|
10461
|
+
"state",
|
|
10462
|
+
"postalCode",
|
|
10463
|
+
"houseNo"
|
|
10464
|
+
];
|
|
10465
|
+
const omitKeys = (errors, keys) => {
|
|
10466
|
+
if (!errors) return void 0;
|
|
10467
|
+
const next = { ...errors };
|
|
10468
|
+
for (const key of keys) delete next[key];
|
|
10469
|
+
return Object.keys(next).length > 0 ? next : void 0;
|
|
10470
|
+
};
|
|
10406
10471
|
const ekycMachine = setup({
|
|
10407
10472
|
types: {
|
|
10408
10473
|
context: {},
|
|
@@ -10432,45 +10497,62 @@ const ekycMachine = setup({
|
|
|
10432
10497
|
applyPrefillData: assign(({ context, event }) => {
|
|
10433
10498
|
const { ocrData, otpStatus } = event.output;
|
|
10434
10499
|
const { values, prefilled, hideEmail, readonlyFields } = applyPrefill(context.verificationFields, ocrData, otpStatus, context.fieldsCountry);
|
|
10435
|
-
const updatedFields = context.fields.map((f) => ({
|
|
10436
|
-
...f,
|
|
10437
|
-
readonly: readonlyFields.includes(f.name) ? true : f.readonly
|
|
10438
|
-
}));
|
|
10439
|
-
const { errors, isValid } = computeValidation(updatedFields, values, context.fieldsCountry, context.configSource);
|
|
10440
10500
|
return {
|
|
10441
10501
|
values,
|
|
10442
10502
|
prefilled,
|
|
10443
10503
|
hideEmail,
|
|
10444
|
-
fields:
|
|
10445
|
-
|
|
10446
|
-
|
|
10504
|
+
fields: context.fields.map((f) => ({
|
|
10505
|
+
...f,
|
|
10506
|
+
readonly: readonlyFields.includes(f.name) ? true : f.readonly
|
|
10507
|
+
}))
|
|
10447
10508
|
};
|
|
10448
10509
|
}),
|
|
10449
10510
|
updateField: assign(({ context, event }) => {
|
|
10450
|
-
|
|
10451
|
-
const processedValue = processFieldValue(name, value, context.fieldsCountry);
|
|
10452
|
-
const newValues = {
|
|
10453
|
-
...context.values,
|
|
10454
|
-
[name]: processedValue
|
|
10455
|
-
};
|
|
10456
|
-
const { errors, isValid } = computeValidation(context.fields, newValues, context.fieldsCountry, context.configSource);
|
|
10511
|
+
if (event.type !== "DATA_CHANGED") return {};
|
|
10512
|
+
const processedValue = processFieldValue(event.name, event.value, context.fieldsCountry);
|
|
10457
10513
|
return {
|
|
10458
|
-
values:
|
|
10459
|
-
|
|
10460
|
-
|
|
10514
|
+
values: {
|
|
10515
|
+
...context.values,
|
|
10516
|
+
[event.name]: processedValue
|
|
10517
|
+
},
|
|
10461
10518
|
submitError: ""
|
|
10462
10519
|
};
|
|
10463
10520
|
}),
|
|
10521
|
+
clearFieldValidationError: assign(({ context, event }) => {
|
|
10522
|
+
if (event.type !== "DATA_CHANGED") return {};
|
|
10523
|
+
const errs = context.validationErrors;
|
|
10524
|
+
if (!errs?.[event.name]) return {};
|
|
10525
|
+
const next = { ...errs };
|
|
10526
|
+
delete next[event.name];
|
|
10527
|
+
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
10528
|
+
}),
|
|
10529
|
+
validateFormField: assign(({ context, event }) => {
|
|
10530
|
+
if (event.type !== "VALIDATE_FIELD") return {};
|
|
10531
|
+
const message = validateEkycField(context.values, event.name, context.fields);
|
|
10532
|
+
const next = { ...context.validationErrors ?? {} };
|
|
10533
|
+
if (message) next[event.name] = message;
|
|
10534
|
+
else delete next[event.name];
|
|
10535
|
+
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
10536
|
+
}),
|
|
10537
|
+
computeValidationResult: assign(({ context }) => {
|
|
10538
|
+
const errors = validateEkycForm(context.values, context.fields);
|
|
10539
|
+
return { validationErrors: Object.keys(errors).length > 0 ? errors : void 0 };
|
|
10540
|
+
}),
|
|
10464
10541
|
fillAddressFields: assign(({ context, event }) => {
|
|
10465
10542
|
const { suggestion } = event;
|
|
10466
10543
|
const activeFields = new Set(context.fields.map((f) => f.name));
|
|
10467
10544
|
const { values: newValues } = fillFromSuggestion(context.values, {}, suggestion, activeFields);
|
|
10468
|
-
const
|
|
10545
|
+
const clearedErrors = omitKeys(context.validationErrors, ADDRESS_AUTOCOMPLETE_KEYS);
|
|
10546
|
+
const streetError = getStreetLevelErrorForSuggestion(suggestion, activeFields);
|
|
10547
|
+
const validationErrors = {
|
|
10548
|
+
...clearedErrors ?? {},
|
|
10549
|
+
...streetError !== void 0 ? { street: streetError } : {}
|
|
10550
|
+
};
|
|
10469
10551
|
return {
|
|
10470
10552
|
values: newValues,
|
|
10471
10553
|
addressSuggestions: [],
|
|
10472
|
-
|
|
10473
|
-
|
|
10554
|
+
_searchQuery: "",
|
|
10555
|
+
validationErrors: Object.keys(validationErrors).length > 0 ? validationErrors : void 0,
|
|
10474
10556
|
submitError: ""
|
|
10475
10557
|
};
|
|
10476
10558
|
}),
|
|
@@ -10478,11 +10560,10 @@ const ekycMachine = setup({
|
|
|
10478
10560
|
setErrorMessage: assign(({ event }) => ({ errorMessage: String(event.error ?? "verification.error") })),
|
|
10479
10561
|
clearErrorMessage: assign({ errorMessage: () => "" }),
|
|
10480
10562
|
setSubmitError: assign(() => ({ submitError: "verification.errors.countryNotSupported" })),
|
|
10481
|
-
clearSubmitError: assign({ submitError: () => "" })
|
|
10482
|
-
markSubmitAttempted: assign({ submitAttempted: () => true })
|
|
10563
|
+
clearSubmitError: assign({ submitError: () => "" })
|
|
10483
10564
|
},
|
|
10484
10565
|
guards: {
|
|
10485
|
-
|
|
10566
|
+
hasNoValidationErrors: hasNoValidationErrorsGuard,
|
|
10486
10567
|
hasFlowId: hasFlowIdGuard,
|
|
10487
10568
|
hasVerificationFields: hasVerificationFieldsGuard,
|
|
10488
10569
|
isCountryNotSupported: isCountryNotSupportedGuard
|
|
@@ -10500,14 +10581,11 @@ const ekycMachine = setup({
|
|
|
10500
10581
|
fieldsCountry: config.fieldsCountry ?? "",
|
|
10501
10582
|
fields: [],
|
|
10502
10583
|
values: {},
|
|
10503
|
-
errors: {},
|
|
10504
|
-
isValid: false,
|
|
10505
10584
|
addressSuggestions: [],
|
|
10506
10585
|
prefilled: {},
|
|
10507
10586
|
hideEmail: false,
|
|
10508
10587
|
errorMessage: "",
|
|
10509
10588
|
submitError: "",
|
|
10510
|
-
submitAttempted: false,
|
|
10511
10589
|
_searchQuery: ""
|
|
10512
10590
|
};
|
|
10513
10591
|
},
|
|
@@ -10557,23 +10635,37 @@ const ekycMachine = setup({
|
|
|
10557
10635
|
onError: { target: "form" }
|
|
10558
10636
|
} },
|
|
10559
10637
|
form: {
|
|
10560
|
-
initial: "
|
|
10638
|
+
initial: "inputting",
|
|
10561
10639
|
states: {
|
|
10562
|
-
|
|
10640
|
+
inputting: { on: {
|
|
10641
|
+
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
10642
|
+
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
10643
|
+
SUBMIT: { target: "validatingSubmit" }
|
|
10644
|
+
} },
|
|
10563
10645
|
searching: {
|
|
10564
10646
|
invoke: {
|
|
10565
10647
|
id: "debounceSearch",
|
|
10566
10648
|
src: "debounceSearch",
|
|
10567
10649
|
input: ({ context }) => ({ query: context._searchQuery })
|
|
10568
10650
|
},
|
|
10569
|
-
on: {
|
|
10570
|
-
|
|
10571
|
-
actions: "
|
|
10572
|
-
|
|
10651
|
+
on: {
|
|
10652
|
+
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
10653
|
+
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
10654
|
+
RESULTS: {
|
|
10655
|
+
target: "inputting",
|
|
10656
|
+
actions: "setAddressSuggestions"
|
|
10657
|
+
}
|
|
10658
|
+
}
|
|
10659
|
+
},
|
|
10660
|
+
validatingSubmit: {
|
|
10661
|
+
entry: "computeValidationResult",
|
|
10662
|
+
always: [{
|
|
10663
|
+
guard: "hasNoValidationErrors",
|
|
10664
|
+
target: "#ekyc.submitting"
|
|
10665
|
+
}, { target: "inputting" }]
|
|
10573
10666
|
}
|
|
10574
10667
|
},
|
|
10575
10668
|
on: {
|
|
10576
|
-
SET_FIELD: { actions: "updateField" },
|
|
10577
10669
|
SEARCH_ADDRESS: {
|
|
10578
10670
|
target: ".searching",
|
|
10579
10671
|
actions: assign(({ event }) => ({
|
|
@@ -10582,13 +10674,9 @@ const ekycMachine = setup({
|
|
|
10582
10674
|
}))
|
|
10583
10675
|
},
|
|
10584
10676
|
SELECT_ADDRESS: {
|
|
10585
|
-
target: ".
|
|
10677
|
+
target: ".inputting",
|
|
10586
10678
|
actions: "fillAddressFields"
|
|
10587
10679
|
},
|
|
10588
|
-
SUBMIT: [{
|
|
10589
|
-
target: "submitting",
|
|
10590
|
-
guard: "isValid"
|
|
10591
|
-
}, { actions: "markSubmitAttempted" }],
|
|
10592
10680
|
SKIP: { target: "#ekyc.finished" },
|
|
10593
10681
|
CLOSE: { target: "#ekyc.closed" }
|
|
10594
10682
|
}
|
|
@@ -10623,4 +10711,4 @@ const ekycMachine = setup({
|
|
|
10623
10711
|
});
|
|
10624
10712
|
|
|
10625
10713
|
//#endregion
|
|
10626
|
-
export {
|
|
10714
|
+
export { toEkycConfig as n, ekycMachine as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./Manager-
|
|
2
|
-
import "./Actor-
|
|
3
|
-
import { a as AE_CONSENT_KEYS, c as ConsentKey, d as ElectronicSignatureVariant, f as QE_CONSENT_KEYS, g as getDefaultConsentChecks, h as getConsentKeys, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, o as AeConsentKey, p as QeConsentKey, r as createElectronicSignatureManager, s as ConsentChecks, t as ElectronicSignatureManager, u as ElectronicSignatureDocument } from "./index-
|
|
1
|
+
import "./Manager-BHn8wH8K.js";
|
|
2
|
+
import "./Actor-Y0_Fj-KL.js";
|
|
3
|
+
import { a as AE_CONSENT_KEYS, c as ConsentKey, d as ElectronicSignatureVariant, f as QE_CONSENT_KEYS, g as getDefaultConsentChecks, h as getConsentKeys, i as electronicSignatureMachine, l as ElectronicSignatureConfig, m as areAllConsented, n as ElectronicSignatureState, o as AeConsentKey, p as QeConsentKey, r as createElectronicSignatureManager, s as ConsentChecks, t as ElectronicSignatureManager, u as ElectronicSignatureDocument } from "./index-B9NysVDB.js";
|
|
4
4
|
export { AE_CONSENT_KEYS, AeConsentKey, ConsentChecks, ConsentKey, ElectronicSignatureConfig, ElectronicSignatureDocument, ElectronicSignatureManager, ElectronicSignatureState, ElectronicSignatureVariant, QE_CONSENT_KEYS, QeConsentKey, areAllConsented, createElectronicSignatureManager, electronicSignatureMachine, getConsentKeys, getDefaultConsentChecks };
|