@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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dvvriq9l.esm.js";
|
|
3
|
+
import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
|
|
4
|
+
import { a as fromPromise, c as createManager, r as assign, s as createActor, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
|
|
5
|
+
import { t as validateCPF } from "./cpf-BRzggV8G.esm.js";
|
|
6
|
+
|
|
7
|
+
//#region src/modules/cpf-ocr/cpfOcrServices.ts
|
|
8
|
+
async function fetchCpfOcrData(signal) {
|
|
9
|
+
const res = await api.get(endpoints.ocrData, { signal });
|
|
10
|
+
if (!res.ok) throw new Error(`GET ${endpoints.ocrData} failed: ${res.status} ${res.statusText}`);
|
|
11
|
+
return res.data;
|
|
12
|
+
}
|
|
13
|
+
async function submitCpfOcr(documentNumber, signal) {
|
|
14
|
+
const res = await api.put(endpoints.updateSession, { documentNumber }, { signal });
|
|
15
|
+
if (!res.ok) throw new Error(`PUT ${endpoints.updateSession} failed: ${res.status} ${res.statusText}`);
|
|
16
|
+
return res.data;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/modules/cpf-ocr/cpfOcrUtils.ts
|
|
21
|
+
function formatCPF(value) {
|
|
22
|
+
const digits = value.replace(/\D/g, "").slice(0, 11);
|
|
23
|
+
const first = digits.slice(0, 3);
|
|
24
|
+
const second = digits.slice(3, 6);
|
|
25
|
+
const third = digits.slice(6, 9);
|
|
26
|
+
const verifier = digits.slice(9, 11);
|
|
27
|
+
if (digits.length > 9) return `${first}.${second}.${third}-${verifier}`;
|
|
28
|
+
if (digits.length > 6) return `${first}.${second}.${third}`;
|
|
29
|
+
if (digits.length > 3) return `${first}.${second}`;
|
|
30
|
+
return first;
|
|
31
|
+
}
|
|
32
|
+
function isValidCPF(value) {
|
|
33
|
+
return validateCPF(value);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/modules/cpf-ocr/cpfOcrStateMachine.ts
|
|
38
|
+
const cpfOcrMachine = setup({
|
|
39
|
+
types: {
|
|
40
|
+
context: {},
|
|
41
|
+
events: {},
|
|
42
|
+
input: {}
|
|
43
|
+
},
|
|
44
|
+
actors: {
|
|
45
|
+
fetchCpfOcrData: fromPromise(async ({ signal }) => fetchCpfOcrData(signal)),
|
|
46
|
+
submitCpfOcr: fromPromise(async ({ input, signal }) => submitCpfOcr(input.cpf, signal))
|
|
47
|
+
},
|
|
48
|
+
actions: {
|
|
49
|
+
setPrefill: assign(({ event }) => {
|
|
50
|
+
const output = event.output;
|
|
51
|
+
const cpf = formatCPF(output.documentNumber ?? "");
|
|
52
|
+
return {
|
|
53
|
+
cpf,
|
|
54
|
+
isValid: isValidCPF(cpf),
|
|
55
|
+
error: void 0
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
setCpf: assign(({ event }) => {
|
|
59
|
+
const cpf = formatCPF(event.cpf);
|
|
60
|
+
return {
|
|
61
|
+
cpf,
|
|
62
|
+
isValid: isValidCPF(cpf),
|
|
63
|
+
error: void 0
|
|
64
|
+
};
|
|
65
|
+
}),
|
|
66
|
+
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
67
|
+
clearError: assign({ error: () => void 0 })
|
|
68
|
+
},
|
|
69
|
+
guards: { isValid: ({ context }) => context.isValid }
|
|
70
|
+
}).createMachine({
|
|
71
|
+
id: "cpfOcr",
|
|
72
|
+
initial: "idle",
|
|
73
|
+
context: {
|
|
74
|
+
cpf: "",
|
|
75
|
+
isValid: false,
|
|
76
|
+
error: void 0
|
|
77
|
+
},
|
|
78
|
+
states: {
|
|
79
|
+
idle: { on: { LOAD: "loading" } },
|
|
80
|
+
loading: { invoke: {
|
|
81
|
+
src: "fetchCpfOcrData",
|
|
82
|
+
onDone: {
|
|
83
|
+
target: "inputting",
|
|
84
|
+
actions: "setPrefill"
|
|
85
|
+
},
|
|
86
|
+
onError: {
|
|
87
|
+
target: "error",
|
|
88
|
+
actions: "setError"
|
|
89
|
+
}
|
|
90
|
+
} },
|
|
91
|
+
inputting: { on: {
|
|
92
|
+
SET_CPF: { actions: "setCpf" },
|
|
93
|
+
SUBMIT: {
|
|
94
|
+
guard: "isValid",
|
|
95
|
+
target: "submitting"
|
|
96
|
+
}
|
|
97
|
+
} },
|
|
98
|
+
submitting: { invoke: {
|
|
99
|
+
src: "submitCpfOcr",
|
|
100
|
+
input: ({ context }) => ({ cpf: context.cpf }),
|
|
101
|
+
onDone: { target: "finished" },
|
|
102
|
+
onError: {
|
|
103
|
+
target: "error",
|
|
104
|
+
actions: "setError"
|
|
105
|
+
}
|
|
106
|
+
} },
|
|
107
|
+
error: { on: {
|
|
108
|
+
RETRY: {
|
|
109
|
+
target: "loading",
|
|
110
|
+
actions: "clearError"
|
|
111
|
+
},
|
|
112
|
+
SET_CPF: {
|
|
113
|
+
target: "inputting",
|
|
114
|
+
actions: "setCpf"
|
|
115
|
+
}
|
|
116
|
+
} },
|
|
117
|
+
finished: { type: "final" }
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/modules/cpf-ocr/cpfOcrActor.ts
|
|
123
|
+
function createCpfOcrActor() {
|
|
124
|
+
return createActor(cpfOcrMachine, { input: {} }).start();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/modules/cpf-ocr/cpfOcrManager.ts
|
|
129
|
+
function mapState(snapshot) {
|
|
130
|
+
const { context } = snapshot;
|
|
131
|
+
if (snapshot.matches("idle")) return { status: "idle" };
|
|
132
|
+
if (snapshot.matches("loading")) return { status: "loading" };
|
|
133
|
+
if (snapshot.matches("inputting")) return {
|
|
134
|
+
status: "inputting",
|
|
135
|
+
cpf: context.cpf,
|
|
136
|
+
isValid: context.isValid
|
|
137
|
+
};
|
|
138
|
+
if (snapshot.matches("submitting")) return { status: "submitting" };
|
|
139
|
+
if (snapshot.matches("error")) return {
|
|
140
|
+
status: "error",
|
|
141
|
+
error: context.error ?? "Unknown error"
|
|
142
|
+
};
|
|
143
|
+
if (snapshot.matches("finished")) return { status: "finished" };
|
|
144
|
+
return { status: "idle" };
|
|
145
|
+
}
|
|
146
|
+
function createApi({ actor, trackElementClicked }) {
|
|
147
|
+
return {
|
|
148
|
+
load() {
|
|
149
|
+
actor.send({ type: "LOAD" });
|
|
150
|
+
},
|
|
151
|
+
setCpf(cpf) {
|
|
152
|
+
actor.send({
|
|
153
|
+
type: "SET_CPF",
|
|
154
|
+
cpf
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
submit() {
|
|
158
|
+
trackElementClicked?.("continue");
|
|
159
|
+
actor.send({ type: "SUBMIT" });
|
|
160
|
+
},
|
|
161
|
+
retry() {
|
|
162
|
+
trackElementClicked?.("retry");
|
|
163
|
+
actor.send({ type: "RETRY" });
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function createCpfOcrManager() {
|
|
168
|
+
return createManager({
|
|
169
|
+
actor: createCpfOcrActor(),
|
|
170
|
+
mapState,
|
|
171
|
+
createApi,
|
|
172
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.idOcr)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Creates a CPF-OCR manager from a pre-built actor.
|
|
177
|
+
* Use this when overriding the machine via `.provide()` for custom backends
|
|
178
|
+
* or for story-isolation testing.
|
|
179
|
+
*/
|
|
180
|
+
function createCpfOcrManagerFromActor(actor) {
|
|
181
|
+
return createManager({
|
|
182
|
+
actor,
|
|
183
|
+
mapState,
|
|
184
|
+
createApi,
|
|
185
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.idOcr)
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
export { isValidCPF as a, formatCPF as i, createCpfOcrManagerFromActor as n, cpfOcrMachine as r, createCpfOcrManager as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as api } from "./api-CESGtpbH.esm.js";
|
|
2
|
-
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-
|
|
3
|
-
import { t as endpoints } from "./endpoints-
|
|
4
|
-
import { a as fromPromise, c as createManager, s as createActor, t as setup } from "./xstate.esm-
|
|
5
|
-
import { t as sleep } from "./ITimerCapability-
|
|
2
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dvvriq9l.esm.js";
|
|
3
|
+
import { t as endpoints } from "./endpoints-BeTK0Mlt.esm.js";
|
|
4
|
+
import { a as fromPromise, c as createManager, s as createActor, t as setup } from "./xstate.esm-C9wncMQa.esm.js";
|
|
5
|
+
import { t as sleep } from "./ITimerCapability-CB0I1Uf2.esm.js";
|
|
6
6
|
|
|
7
7
|
//#region src/modules/cross-document-data-match/crossDocumentDataMatchServices.ts
|
|
8
8
|
/** Minimum spinner duration (ms), aligned with SDK v1 `ProcessCrossDocumentData`. */
|
|
@@ -1,161 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./Actor-
|
|
3
|
-
import "./camera-
|
|
4
|
-
import "./types-
|
|
5
|
-
import
|
|
1
|
+
import "./Manager-BHn8wH8K.js";
|
|
2
|
+
import "./Actor-Y0_Fj-KL.js";
|
|
3
|
+
import "./camera-SRBpPq2X.js";
|
|
4
|
+
import "./types-Bj9hdFjU.js";
|
|
5
|
+
import "./types-DvGZI7BF.js";
|
|
6
|
+
import "./types-DOUhndhT.js";
|
|
7
|
+
import { a as CurpValidationActor, c as CurpValidationErrors, d as GenerateCurpFieldDef, f as GenerateCurpFieldType, i as createCurpValidationManagerFromActor, l as CurpValidationRule, n as CurpValidationState, o as curpValidationMachine, p as GenerateCurpForm, r as createCurpValidationManager, s as CurpValidationConfig, t as CurpValidationManager, u as EnterCurpFieldDef } from "./curpValidationManager-RttixpIc.js";
|
|
6
8
|
|
|
7
|
-
//#region src/modules/curp-validation/types.d.ts
|
|
8
|
-
type CurpValidationConfig = FlowModuleConfig['CURP_VALIDATION'] & {
|
|
9
|
-
/** Maximum validation retries before auto-advancing. @default 1 */
|
|
10
|
-
maxRetries?: number;
|
|
11
|
-
/** Whether to attempt OCR pre-fill on load. @default true */
|
|
12
|
-
prefillFromOcr?: boolean;
|
|
13
|
-
};
|
|
14
|
-
/** CURP generation form data */
|
|
15
|
-
type GenerateCurpForm = {
|
|
16
|
-
name: string;
|
|
17
|
-
firstLastName: string;
|
|
18
|
-
secondLastName: string;
|
|
19
|
-
gender: 'H' | 'M' | 'X' | '';
|
|
20
|
-
birthDate: string;
|
|
21
|
-
birthState: string;
|
|
22
|
-
};
|
|
23
|
-
type GenerateCurpFieldType = 'text' | 'date' | 'dropdown';
|
|
24
|
-
/**
|
|
25
|
-
* Discriminated union of validation rules supported across both CURP screens.
|
|
26
|
-
* `required` is used by Generate-CURP fields; `curpFormat` is used by the
|
|
27
|
-
* single-field CURP entry.
|
|
28
|
-
*/
|
|
29
|
-
type CurpValidationRule = {
|
|
30
|
-
type: 'required';
|
|
31
|
-
} | {
|
|
32
|
-
type: 'curpFormat';
|
|
33
|
-
};
|
|
34
|
-
type GenerateCurpFieldDef = {
|
|
35
|
-
key: keyof GenerateCurpForm;
|
|
36
|
-
labelKey: string;
|
|
37
|
-
type: GenerateCurpFieldType;
|
|
38
|
-
required: boolean;
|
|
39
|
-
autoComplete?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Validation rules evaluated by the state machine on blur (per-field) and
|
|
42
|
-
* on submit (full form). Required fields should include `{ type: 'required' }`.
|
|
43
|
-
* Optional fields (e.g. `secondLastName`) omit this entirely.
|
|
44
|
-
*/
|
|
45
|
-
validation?: CurpValidationRule[];
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Configuration for the single CURP-entry field on the gateway screen.
|
|
49
|
-
* Intentionally has no `required` rule: the user can leave it empty and
|
|
50
|
-
* use the "I don't have my CURP" escape-hatch button instead.
|
|
51
|
-
*/
|
|
52
|
-
type EnterCurpFieldDef = {
|
|
53
|
-
key: 'curp';
|
|
54
|
-
labelKey: string;
|
|
55
|
-
validation?: CurpValidationRule[];
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Map of field-key → i18n error key currently displayed for that field.
|
|
59
|
-
* Empty/undefined means no errors are currently shown. The state machine
|
|
60
|
-
* is the single source of truth for which entries exist here — UI must
|
|
61
|
-
* render this map as-is without further gating.
|
|
62
|
-
*/
|
|
63
|
-
type CurpValidationErrors = Partial<Record<string, string>>;
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/modules/curp-validation/curpValidationStateMachine.d.ts
|
|
66
|
-
|
|
67
|
-
declare const curpValidationMachine: any;
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/modules/curp-validation/curpValidationActor.d.ts
|
|
70
|
-
type CreateCurpValidationActorOptions = {
|
|
71
|
-
config: CurpValidationConfig;
|
|
72
|
-
};
|
|
73
|
-
//#endregion
|
|
74
|
-
//#region src/modules/curp-validation/curpValidationManager.d.ts
|
|
75
|
-
type CurpValidationIdleState = {
|
|
76
|
-
status: 'idle';
|
|
77
|
-
};
|
|
78
|
-
type CurpValidationLoadingState = {
|
|
79
|
-
status: 'loading';
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* State exposed to UI for the CURP entry gateway screen.
|
|
83
|
-
*
|
|
84
|
-
* `isValid` is **derived** from `validationErrors`: it is `true` whenever
|
|
85
|
-
* no errors are currently displayed (including the initial empty render).
|
|
86
|
-
* The UI must not treat `isValid` as "the form would pass full validation
|
|
87
|
-
* right now" — that was the old pessimistic semantic. Use the absence of
|
|
88
|
-
* errors plus an additional `curp.length === 0` no-op guard on the submit
|
|
89
|
-
* button instead.
|
|
90
|
-
*/
|
|
91
|
-
type CurpValidationEnterCurpState = {
|
|
92
|
-
status: 'enterCurp';
|
|
93
|
-
curp: string;
|
|
94
|
-
isValid: boolean;
|
|
95
|
-
validationErrors?: CurpValidationErrors;
|
|
96
|
-
};
|
|
97
|
-
type CurpValidationVerifyingState = {
|
|
98
|
-
status: 'verifying';
|
|
99
|
-
};
|
|
100
|
-
type CurpValidationSuccessState = {
|
|
101
|
-
status: 'success';
|
|
102
|
-
};
|
|
103
|
-
type CurpValidationFailureState = {
|
|
104
|
-
status: 'failure';
|
|
105
|
-
retriesLeft: number;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* State exposed to UI for the multi-field Generate CURP form.
|
|
109
|
-
*
|
|
110
|
-
* `isValid` is derived: `true` when no errors are currently displayed.
|
|
111
|
-
* Validation runs on blur (single field) and on submit (full form);
|
|
112
|
-
* `validationErrors` reflects exactly what should be rendered next
|
|
113
|
-
* to each input.
|
|
114
|
-
*/
|
|
115
|
-
type CurpValidationGenerateCurpState = {
|
|
116
|
-
status: 'generateCurp';
|
|
117
|
-
form: GenerateCurpForm;
|
|
118
|
-
isValid: boolean;
|
|
119
|
-
validationErrors?: CurpValidationErrors;
|
|
120
|
-
};
|
|
121
|
-
type CurpValidationGeneratingState = {
|
|
122
|
-
status: 'generating';
|
|
123
|
-
};
|
|
124
|
-
type CurpValidationConfirmCurpState = {
|
|
125
|
-
status: 'confirmCurp';
|
|
126
|
-
curp: string;
|
|
127
|
-
};
|
|
128
|
-
type CurpValidationGenerateErrorState = {
|
|
129
|
-
status: 'generateError';
|
|
130
|
-
retriesLeft: number;
|
|
131
|
-
};
|
|
132
|
-
type CurpValidationFinishedState = {
|
|
133
|
-
status: 'finished';
|
|
134
|
-
};
|
|
135
|
-
type CurpValidationClosedState = {
|
|
136
|
-
status: 'closed';
|
|
137
|
-
};
|
|
138
|
-
type CurpValidationState = CurpValidationIdleState | CurpValidationLoadingState | CurpValidationEnterCurpState | CurpValidationVerifyingState | CurpValidationSuccessState | CurpValidationFailureState | CurpValidationGenerateCurpState | CurpValidationGeneratingState | CurpValidationConfirmCurpState | CurpValidationGenerateErrorState | CurpValidationFinishedState | CurpValidationClosedState;
|
|
139
|
-
declare function createCurpValidationManager(options: CreateCurpValidationActorOptions): Manager<CurpValidationState> & {
|
|
140
|
-
load(): void;
|
|
141
|
-
setCurp(curp: string): void;
|
|
142
|
-
/**
|
|
143
|
-
* Triggers single-field on-blur validation. The state machine routes
|
|
144
|
-
* the event to the validator for the currently active screen and
|
|
145
|
-
* updates the corresponding `validationErrors` map. Sending a field
|
|
146
|
-
* key that does not belong to the active screen is a no-op.
|
|
147
|
-
*/
|
|
148
|
-
validateField(field: "curp" | keyof GenerateCurpForm): void;
|
|
149
|
-
verify(): void;
|
|
150
|
-
switchToGenerate(): void;
|
|
151
|
-
setGenerateForm(form: Partial<GenerateCurpForm>): void;
|
|
152
|
-
generate(): void;
|
|
153
|
-
confirmGenerated(): void;
|
|
154
|
-
retry(): void;
|
|
155
|
-
close(): void;
|
|
156
|
-
};
|
|
157
|
-
type CurpValidationManager = ReturnType<typeof createCurpValidationManager>;
|
|
158
|
-
//#endregion
|
|
159
9
|
//#region src/modules/curp-validation/curpValidationUtils.d.ts
|
|
160
10
|
type MexicanState = {
|
|
161
11
|
value: string;
|
|
@@ -185,4 +35,4 @@ declare const GENERATE_CURP_FIELDS: GenerateCurpFieldDef[];
|
|
|
185
35
|
*/
|
|
186
36
|
declare const ENTER_CURP_FIELD: EnterCurpFieldDef;
|
|
187
37
|
//#endregion
|
|
188
|
-
export { type CurpValidationConfig, type CurpValidationErrors, type CurpValidationManager, type CurpValidationRule, type CurpValidationState, ENTER_CURP_FIELD, type EnterCurpFieldDef, GENERATE_CURP_FIELDS, type GenerateCurpFieldDef, type GenerateCurpFieldType, type GenerateCurpForm, createCurpValidationManager, curpValidationMachine, mexicanStates };
|
|
38
|
+
export { type CurpValidationActor, type CurpValidationConfig, type CurpValidationErrors, type CurpValidationManager, type CurpValidationRule, type CurpValidationState, ENTER_CURP_FIELD, type EnterCurpFieldDef, GENERATE_CURP_FIELDS, type GenerateCurpFieldDef, type GenerateCurpFieldType, type GenerateCurpForm, createCurpValidationManager, createCurpValidationManagerFromActor, curpValidationMachine, mexicanStates };
|
|
@@ -1,110 +1,8 @@
|
|
|
1
1
|
import "./api-CESGtpbH.esm.js";
|
|
2
|
-
import
|
|
3
|
-
import "./endpoints-
|
|
4
|
-
import
|
|
5
|
-
import { i as mexicanStates, n as ENTER_CURP_FIELD, r as GENERATE_CURP_FIELDS, t as curpValidationMachine } from "./curpValidationStateMachine-
|
|
2
|
+
import "./events-Dvvriq9l.esm.js";
|
|
3
|
+
import "./endpoints-BeTK0Mlt.esm.js";
|
|
4
|
+
import "./xstate.esm-C9wncMQa.esm.js";
|
|
5
|
+
import { i as mexicanStates, n as ENTER_CURP_FIELD, r as GENERATE_CURP_FIELDS, t as curpValidationMachine } from "./curpValidationStateMachine-B7V_qp66.esm.js";
|
|
6
|
+
import { n as createCurpValidationManagerFromActor, t as createCurpValidationManager } from "./curpValidationManager-CFem6zP9.esm.js";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
function createCurpValidationActor(options) {
|
|
9
|
-
return createActor(curpValidationMachine, { input: { config: options.config } }).start();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/modules/curp-validation/curpValidationManager.ts
|
|
14
|
-
const hasNoErrors = (errors) => Object.keys(errors ?? {}).length === 0;
|
|
15
|
-
function mapState(snapshot) {
|
|
16
|
-
const typedSnapshot = snapshot;
|
|
17
|
-
const { context } = typedSnapshot;
|
|
18
|
-
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
19
|
-
if (typedSnapshot.matches("loading")) return { status: "loading" };
|
|
20
|
-
if (typedSnapshot.matches("enterCurp")) return {
|
|
21
|
-
status: "enterCurp",
|
|
22
|
-
curp: context.curp,
|
|
23
|
-
isValid: hasNoErrors(context.enterCurpValidationErrors),
|
|
24
|
-
validationErrors: context.enterCurpValidationErrors
|
|
25
|
-
};
|
|
26
|
-
if (typedSnapshot.matches("verifying")) return { status: "verifying" };
|
|
27
|
-
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
28
|
-
if (typedSnapshot.matches("failure")) return {
|
|
29
|
-
status: "failure",
|
|
30
|
-
retriesLeft: context.retriesLeft
|
|
31
|
-
};
|
|
32
|
-
if (typedSnapshot.matches("generateCurp")) return {
|
|
33
|
-
status: "generateCurp",
|
|
34
|
-
form: context.generateForm,
|
|
35
|
-
isValid: hasNoErrors(context.generateCurpValidationErrors),
|
|
36
|
-
validationErrors: context.generateCurpValidationErrors
|
|
37
|
-
};
|
|
38
|
-
if (typedSnapshot.matches("generating")) return { status: "generating" };
|
|
39
|
-
if (typedSnapshot.matches("confirmCurp")) return {
|
|
40
|
-
status: "confirmCurp",
|
|
41
|
-
curp: context.curp
|
|
42
|
-
};
|
|
43
|
-
if (typedSnapshot.matches("generateError")) return {
|
|
44
|
-
status: "generateError",
|
|
45
|
-
retriesLeft: context.retriesLeft
|
|
46
|
-
};
|
|
47
|
-
if (typedSnapshot.matches("finished")) return { status: "finished" };
|
|
48
|
-
if (typedSnapshot.matches("closed")) return { status: "closed" };
|
|
49
|
-
return { status: "idle" };
|
|
50
|
-
}
|
|
51
|
-
function createApi({ actor, trackElementClicked }) {
|
|
52
|
-
return {
|
|
53
|
-
load() {
|
|
54
|
-
actor.send({ type: "LOAD" });
|
|
55
|
-
},
|
|
56
|
-
setCurp(curp) {
|
|
57
|
-
actor.send({
|
|
58
|
-
type: "SET_CURP",
|
|
59
|
-
curp
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
validateField(field) {
|
|
63
|
-
actor.send({
|
|
64
|
-
type: "VALIDATE_FIELD",
|
|
65
|
-
field
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
verify() {
|
|
69
|
-
trackElementClicked?.("verify");
|
|
70
|
-
actor.send({ type: "VERIFY" });
|
|
71
|
-
},
|
|
72
|
-
switchToGenerate() {
|
|
73
|
-
trackElementClicked?.("switchToGenerate");
|
|
74
|
-
actor.send({ type: "SWITCH_TO_GENERATE" });
|
|
75
|
-
},
|
|
76
|
-
setGenerateForm(form) {
|
|
77
|
-
actor.send({
|
|
78
|
-
type: "SET_GENERATE_FORM",
|
|
79
|
-
form
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
generate() {
|
|
83
|
-
trackElementClicked?.("generate");
|
|
84
|
-
actor.send({ type: "GENERATE" });
|
|
85
|
-
},
|
|
86
|
-
confirmGenerated() {
|
|
87
|
-
trackElementClicked?.("confirmGenerated");
|
|
88
|
-
actor.send({ type: "CONFIRM" });
|
|
89
|
-
},
|
|
90
|
-
retry() {
|
|
91
|
-
trackElementClicked?.("retry");
|
|
92
|
-
actor.send({ type: "RETRY" });
|
|
93
|
-
},
|
|
94
|
-
close() {
|
|
95
|
-
trackElementClicked?.("close");
|
|
96
|
-
actor.send({ type: "CLOSE" });
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function createCurpValidationManager(options) {
|
|
101
|
-
return createManager({
|
|
102
|
-
actor: createCurpValidationActor(options),
|
|
103
|
-
mapState,
|
|
104
|
-
createApi,
|
|
105
|
-
instrumentation: createManagerInstrumentation(eventModuleNames.curpValidation)
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
110
|
-
export { ENTER_CURP_FIELD, GENERATE_CURP_FIELDS, createCurpValidationManager, curpValidationMachine, mexicanStates };
|
|
8
|
+
export { ENTER_CURP_FIELD, GENERATE_CURP_FIELDS, createCurpValidationManager, createCurpValidationManagerFromActor, curpValidationMachine, mexicanStates };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dvvriq9l.esm.js";
|
|
2
|
+
import { c as createManager, s as createActor } from "./xstate.esm-C9wncMQa.esm.js";
|
|
3
|
+
import { t as curpValidationMachine } from "./curpValidationStateMachine-B7V_qp66.esm.js";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/curp-validation/curpValidationActor.ts
|
|
6
|
+
function createCurpValidationActor(options) {
|
|
7
|
+
return createActor(curpValidationMachine, { input: { config: options.config } }).start();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/modules/curp-validation/curpValidationManager.ts
|
|
12
|
+
const hasNoErrors = (errors) => Object.keys(errors ?? {}).length === 0;
|
|
13
|
+
function mapState(snapshot) {
|
|
14
|
+
const typedSnapshot = snapshot;
|
|
15
|
+
const { context } = typedSnapshot;
|
|
16
|
+
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
17
|
+
if (typedSnapshot.matches("loading")) return { status: "loading" };
|
|
18
|
+
if (typedSnapshot.matches("enterCurp")) return {
|
|
19
|
+
status: "enterCurp",
|
|
20
|
+
curp: context.curp,
|
|
21
|
+
isValid: hasNoErrors(context.enterCurpValidationErrors),
|
|
22
|
+
validationErrors: context.enterCurpValidationErrors
|
|
23
|
+
};
|
|
24
|
+
if (typedSnapshot.matches("verifying")) return { status: "verifying" };
|
|
25
|
+
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
26
|
+
if (typedSnapshot.matches("failure")) return {
|
|
27
|
+
status: "failure",
|
|
28
|
+
retriesLeft: context.retriesLeft,
|
|
29
|
+
fromAutoVerify: context.fromAutoVerify
|
|
30
|
+
};
|
|
31
|
+
if (typedSnapshot.matches("generateCurp")) return {
|
|
32
|
+
status: "generateCurp",
|
|
33
|
+
form: context.generateForm,
|
|
34
|
+
isValid: hasNoErrors(context.generateCurpValidationErrors),
|
|
35
|
+
validationErrors: context.generateCurpValidationErrors
|
|
36
|
+
};
|
|
37
|
+
if (typedSnapshot.matches("generating")) return { status: "generating" };
|
|
38
|
+
if (typedSnapshot.matches("confirmCurp")) return {
|
|
39
|
+
status: "confirmCurp",
|
|
40
|
+
curp: context.curp
|
|
41
|
+
};
|
|
42
|
+
if (typedSnapshot.matches("generateError")) return {
|
|
43
|
+
status: "generateError",
|
|
44
|
+
retriesLeft: context.retriesLeft
|
|
45
|
+
};
|
|
46
|
+
if (typedSnapshot.matches("finished")) return { status: "finished" };
|
|
47
|
+
if (typedSnapshot.matches("closed")) return { status: "closed" };
|
|
48
|
+
return { status: "idle" };
|
|
49
|
+
}
|
|
50
|
+
function createApi({ actor, trackElementClicked }) {
|
|
51
|
+
return {
|
|
52
|
+
load() {
|
|
53
|
+
actor.send({ type: "LOAD" });
|
|
54
|
+
},
|
|
55
|
+
setCurp(curp) {
|
|
56
|
+
actor.send({
|
|
57
|
+
type: "SET_CURP",
|
|
58
|
+
curp
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
validateField(field) {
|
|
62
|
+
actor.send({
|
|
63
|
+
type: "VALIDATE_FIELD",
|
|
64
|
+
field
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
verify() {
|
|
68
|
+
trackElementClicked?.("verify");
|
|
69
|
+
actor.send({ type: "VERIFY" });
|
|
70
|
+
},
|
|
71
|
+
switchToGenerate() {
|
|
72
|
+
trackElementClicked?.("switchToGenerate");
|
|
73
|
+
actor.send({ type: "SWITCH_TO_GENERATE" });
|
|
74
|
+
},
|
|
75
|
+
setGenerateForm(form) {
|
|
76
|
+
actor.send({
|
|
77
|
+
type: "SET_GENERATE_FORM",
|
|
78
|
+
form
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
generate() {
|
|
82
|
+
trackElementClicked?.("generate");
|
|
83
|
+
actor.send({ type: "GENERATE" });
|
|
84
|
+
},
|
|
85
|
+
confirmGenerated() {
|
|
86
|
+
trackElementClicked?.("confirmGenerated");
|
|
87
|
+
actor.send({ type: "CONFIRM" });
|
|
88
|
+
},
|
|
89
|
+
retry() {
|
|
90
|
+
trackElementClicked?.("retry");
|
|
91
|
+
actor.send({ type: "RETRY" });
|
|
92
|
+
},
|
|
93
|
+
close() {
|
|
94
|
+
trackElementClicked?.("close");
|
|
95
|
+
actor.send({ type: "CLOSE" });
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function createCurpValidationManager(options) {
|
|
100
|
+
return createManager({
|
|
101
|
+
actor: createCurpValidationActor(options),
|
|
102
|
+
mapState,
|
|
103
|
+
createApi,
|
|
104
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.curpValidation)
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates a CURP-validation manager from a pre-built actor.
|
|
109
|
+
* Use this when overriding the machine via `.provide()` for custom backends
|
|
110
|
+
* or for story-isolation testing.
|
|
111
|
+
*/
|
|
112
|
+
function createCurpValidationManagerFromActor(actor) {
|
|
113
|
+
return createManager({
|
|
114
|
+
actor,
|
|
115
|
+
mapState,
|
|
116
|
+
createApi,
|
|
117
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.curpValidation)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
export { createCurpValidationManagerFromActor as n, createCurpValidationManager as t };
|