@incodetech/core 0.0.0-dev-20260409-a38d5e8 → 0.0.0-dev-20260409-09dfd52
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-CXaS5Ooj.esm.js +55 -0
- package/dist/{OpenViduRecordingProvider-Bn2meybK.esm.js → OpenViduRecordingProvider-D_cVAwYQ.esm.js} +1 -1
- package/dist/{WasmUtilProvider-BpZSvZbg.esm.js → WasmUtilProvider-mWSXzp7b.esm.js} +1 -1
- package/dist/{addressSearch-DOFI7lwy.esm.js → addressSearch-C26OZIx0.esm.js} +4 -4
- package/dist/antifraud.d.ts +1 -1
- package/dist/antifraud.esm.js +4 -37
- package/dist/antifraudStateMachine-B74mO8vr.esm.js +39 -0
- package/dist/authentication.d.ts +11 -11
- package/dist/authentication.esm.js +22 -19
- package/dist/authenticationManager-BBQHippG.esm.js +67 -0
- package/dist/{authenticationManager-C2mk36yK.d.ts → authenticationManager-DOTo1EYF.d.ts} +2 -2
- package/dist/{authenticationManager-C7dL_avf.esm.js → authenticationStateMachine-DCJ0ArAt.esm.js} +7 -67
- package/dist/{backCameraStream-tabTmwDS.esm.js → backCameraStream-D9g2wyil.esm.js} +3 -3
- package/dist/camera.d.ts +1 -1
- package/dist/camera.esm.js +3 -3
- package/dist/consent.d.ts +55 -55
- package/dist/consent.esm.js +4 -149
- package/dist/consentStateMachine-DIdJXJW0.esm.js +151 -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 +5 -5
- package/dist/curp-validation.esm.js +4 -417
- package/dist/curpValidationStateMachine-Dp5WB6__.esm.js +419 -0
- package/dist/{deepsightLoader-Cj6SyUQ-.esm.js → deepsightLoader-CaULV07H.esm.js} +10 -10
- package/dist/{deepsightService-ByD6uIs7.d.ts → deepsightService-S-tU77m-.d.ts} +2 -2
- package/dist/{deepsightService-BjgXl5hs.esm.js → deepsightService-rPGLH8Xp.esm.js} +5 -5
- package/dist/device.esm.js +3 -3
- package/dist/document-capture.d.ts +80 -78
- package/dist/document-capture.esm.js +8 -403
- package/dist/document-upload.d.ts +53 -53
- package/dist/document-upload.esm.js +7 -7
- package/dist/documentCaptureStateMachine-ByYOCKz5.esm.js +403 -0
- package/dist/ekyb.d.ts +3 -3
- package/dist/ekyb.esm.js +10 -655
- package/dist/ekybStateMachine-DRku_YmR.esm.js +653 -0
- package/dist/ekyc.d.ts +3 -3
- package/dist/ekyc.esm.js +6 -10614
- package/dist/ekycStateMachine-CSWaaWVl.esm.js +10615 -0
- package/dist/email.d.ts +3 -3
- package/dist/email.esm.js +6 -5
- package/dist/{emailManager-CU_hzrsl.d.ts → emailManager-D6CHM2QO.d.ts} +4 -3
- package/dist/emailManager-DByjyeY8.esm.js +238 -0
- package/dist/{emailManager-_9R4vm6g.esm.js → emailStateMachine-BoIkeCw5.esm.js} +6 -239
- package/dist/{events-DlHrOIRc.esm.js → events-W91zLpx4.esm.js} +5 -1
- package/dist/events.esm.js +2 -2
- package/dist/extensibility.d.ts +15 -15
- package/dist/extensibility.esm.js +33 -26
- package/dist/face-match.d.ts +7 -6
- package/dist/face-match.esm.js +8 -129
- package/dist/faceCaptureManagerFactory-Bspg2Tyf.esm.js +117 -0
- package/dist/{faceCaptureManagerFactory-Da_-ohdg.d.ts → faceCaptureManagerFactory-P2yy30KU.d.ts} +8 -8
- package/dist/{faceCaptureSetup-CaVWkjvE.esm.js → faceCaptureSetup-CQevz86q.esm.js} +5 -119
- package/dist/faceMatchStateMachine-CLterVEC.esm.js +127 -0
- package/dist/flow.d.ts +8 -13
- package/dist/flow.esm.js +10 -29
- package/dist/{flowCompletionService-B5JemmC6.esm.js → flowCompletionService-DZSDUXus.esm.js} +2 -2
- package/dist/{flowServices-p22wrYPf.esm.js → flowServices-YATk0fgY.esm.js} +3 -3
- package/dist/geolocation.d.ts +7 -6
- package/dist/geolocation.esm.js +7 -105
- package/dist/geolocationStateMachine-CRRUCl9K.esm.js +105 -0
- package/dist/{getDeviceClass-DEzz4cmY.esm.js → getDeviceClass-DBF-ExLR.esm.js} +1 -1
- package/dist/government-validation.d.ts +2 -2
- package/dist/government-validation.esm.js +5 -269
- package/dist/governmentValidationStateMachine-C_iPX9VE.esm.js +271 -0
- package/dist/http.esm.js +1 -1
- package/dist/id.d.ts +10 -10
- package/dist/id.esm.js +22 -20
- package/dist/idCaptureManager-CJfatzuY.esm.js +335 -0
- package/dist/{idCaptureManager-CV08v1e3.d.ts → idCaptureManager-CbZvdr9y.d.ts} +7 -7
- package/dist/{idCaptureManager-dyZzKv8L.esm.js → idCaptureStateMachine-gf-Q9piu.esm.js} +17 -346
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +8 -8
- package/dist/{lib-Bavz2qmt.esm.js → lib-BzVJ-zxG.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +55 -55
- package/dist/mandatory-consent.esm.js +4 -124
- package/dist/mandatoryConsentStateMachine-BZNBJ1fK.esm.js +126 -0
- package/dist/{openviduLazy-vhrVZCr_.esm.js → openviduLazy-CLg_-u0m.esm.js} +2 -2
- package/dist/openviduLazy-rFXBtZVZ.esm.js +3 -0
- package/dist/{permissionServices-Cskq32Yd.esm.js → permissionServices-Cisv73eQ.esm.js} +2 -2
- package/dist/phone.d.ts +3 -3
- package/dist/phone.esm.js +6 -5
- package/dist/phoneManager-DhC4obPF.esm.js +258 -0
- package/dist/{phoneManager-ulJuGvJ8.d.ts → phoneManager-Zwr-qCnC.d.ts} +2 -2
- package/dist/{phoneManager-DerdUfd4.esm.js → phoneStateMachine-Cc_w4tC0.esm.js} +5 -258
- package/dist/{recordingService-483wQ6kR.esm.js → recordingService-CCfxUY7-.esm.js} +14 -68
- package/dist/redirect-to-mobile.d.ts +2 -2
- package/dist/redirect-to-mobile.esm.js +5 -247
- package/dist/redirectToMobileStateMachine-vOe27Ufw.esm.js +249 -0
- package/dist/runChildModule-DVC4JEjp.esm.js +27 -0
- package/dist/selfie.d.ts +11 -11
- package/dist/selfie.esm.js +22 -19
- package/dist/selfieManager-CorEST5h.esm.js +60 -0
- package/dist/{selfieManager-DCRP7X75.d.ts → selfieManager-DNwfxieF.d.ts} +2 -2
- package/dist/selfieStateMachine-3b19ON1z.esm.js +56 -0
- package/dist/{session-CUh77zj3.esm.js → session-B_rKSRql.esm.js} +4 -4
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +6 -6
- package/dist/{setup-DpHakxsC.d.ts → setup-BYqwVLiv.d.ts} +1 -1
- package/dist/{setup-XpxfZgKn.esm.js → setup-DLvhsDol.esm.js} +6 -5
- package/dist/signature.d.ts +4 -3
- package/dist/signature.esm.js +6 -189
- package/dist/signatureStateMachine-CU92zCXU.esm.js +189 -0
- package/dist/{stats-DHDoqSBV.esm.js → stats-gFD2351t.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{types-2OPf1pyv.d.ts → types-CYJ0Ish6.d.ts} +1 -1
- package/dist/types-CjsEZRcz.d.ts +35 -0
- package/dist/{types-CVJVQ7fp.d.ts → types-DU8HmI5U.d.ts} +1 -1
- package/dist/wasm.d.ts +2 -2
- package/dist/wasm.esm.js +8 -8
- package/dist/workflow.d.ts +813 -0
- package/dist/workflow.esm.js +600 -0
- package/package.json +7 -3
- package/dist/openviduLazy-BIPHozOu.esm.js +0 -3
- package/dist/selfieManager-DeOcNel4.esm.js +0 -110
- /package/dist/{Actor-Ba71-_30.d.ts → Actor-DbWH1K6E.d.ts} +0 -0
- /package/dist/{BaseWasmProvider-D-s_6M5H.esm.js → BaseWasmProvider-DoYDYH1z.esm.js} +0 -0
- /package/dist/{BrowserEnvironmentProvider-DaHeLJQw.esm.js → BrowserEnvironmentProvider-BtKLxTx4.esm.js} +0 -0
- /package/dist/{BrowserTimerProvider-BhD2MlHg.esm.js → BrowserTimerProvider-v7bpbrAk.esm.js} +0 -0
- /package/dist/{ITimerCapability-oixwa6nj.esm.js → ITimerCapability-BZO_FsCo.esm.js} +0 -0
- /package/dist/{Manager-BN2g_I8W.d.ts → Manager-DcPMRgTm.d.ts} +0 -0
- /package/dist/{MotionSensorProvider-CodM3e0E.esm.js → MotionSensorProvider-D90R4qwV.esm.js} +0 -0
- /package/dist/{StateMachine-BoJsfMvg.d.ts → StateMachine-BBuIgsHT.d.ts} +0 -0
- /package/dist/{api-DzpnV6O7.esm.js → api-aa9Mx20l.esm.js} +0 -0
- /package/dist/{browserSimulation-B4ubb2OL.esm.js → browserSimulation-DFqGKQAD.esm.js} +0 -0
- /package/dist/{camera-1eeGnAaL.d.ts → camera-DATT31my.d.ts} +0 -0
- /package/dist/{camera-DmkFpf5N.esm.js → camera-DpPQS_-5.esm.js} +0 -0
- /package/dist/{chunk-DsxENsBR.esm.js → chunk-YGHKo4MY.esm.js} +0 -0
- /package/dist/{displayErrors-BZLX7idb.d.ts → displayErrors-xrg0ejaS.d.ts} +0 -0
- /package/dist/{flowCompletionService-D-3YCHyO.d.ts → flowCompletionService-gxt5reFV.d.ts} +0 -0
- /package/dist/{getBrowser-Dtyt9J_h.esm.js → getBrowser-DCcD7H-M.esm.js} +0 -0
- /package/dist/{platform-Dv7a2fv-.esm.js → platform-DctkySJU.esm.js} +0 -0
- /package/dist/{types-D_QfFKxT.d.ts → types-CIjb0FKu.d.ts} +0 -0
- /package/dist/{warmup-CIj_wEV_.d.ts → warmup-Ckb1hN85.d.ts} +0 -0
- /package/dist/{xstate.esm-Bv55-lJ4.esm.js → xstate.esm-B7FPE6br.esm.js} +0 -0
|
@@ -1,421 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { a as createActor,
|
|
1
|
+
import "./api-aa9Mx20l.esm.js";
|
|
2
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-W91zLpx4.esm.js";
|
|
3
|
+
import { a as createActor, o as createManager } from "./xstate.esm-B7FPE6br.esm.js";
|
|
4
|
+
import { n as mexicanStates, t as curpValidationMachine } from "./curpValidationStateMachine-Dp5WB6__.esm.js";
|
|
4
5
|
|
|
5
|
-
//#region src/modules/curp-validation/curpValidationUtils.ts
|
|
6
|
-
const CURP_PATTERN = /^([A-Z][AEIOUX][A-Z]{2}\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])[HMX](?:AS|B[CS]|C[CLMSH]|D[FG]|G[TR]|HG|JC|M[CNS]|N[ETL]|OC|PL|Q[TR]|S[PLR]|T[CSL]|VZ|YN|ZS)[B-DF-HJ-NP-TV-Z]{3}[A-Z\d])(\d)$/;
|
|
7
|
-
const CURP_LENGTH = 18;
|
|
8
|
-
function isValidCurp(curp) {
|
|
9
|
-
return typeof curp === "string" && curp.length === CURP_LENGTH && CURP_PATTERN.test(curp.toUpperCase());
|
|
10
|
-
}
|
|
11
|
-
/** Convert YYYY-MM-DD to DD/MM/YYYY for the API */
|
|
12
|
-
function formatDateForApi(date) {
|
|
13
|
-
const [year, month, day] = date.split("-");
|
|
14
|
-
return `${day}/${month}/${year}`;
|
|
15
|
-
}
|
|
16
|
-
const mexicanStates = [
|
|
17
|
-
{
|
|
18
|
-
value: "NE",
|
|
19
|
-
label: "Born Abroad"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
value: "AS",
|
|
23
|
-
label: "Aguascalientes"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
value: "BC",
|
|
27
|
-
label: "Baja California"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
value: "BS",
|
|
31
|
-
label: "Baja California Sur"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: "CC",
|
|
35
|
-
label: "Campeche"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
value: "CL",
|
|
39
|
-
label: "Coahuila de Zaragoza"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
value: "CM",
|
|
43
|
-
label: "Colima"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
value: "CS",
|
|
47
|
-
label: "Chiapas"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: "CH",
|
|
51
|
-
label: "Chihuahua"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
value: "DF",
|
|
55
|
-
label: "Distrito Federal"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
value: "DG",
|
|
59
|
-
label: "Durango"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
value: "GT",
|
|
63
|
-
label: "Guanajuato"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
value: "GR",
|
|
67
|
-
label: "Guerrero"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
value: "HG",
|
|
71
|
-
label: "Hidalgo"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
value: "JC",
|
|
75
|
-
label: "Jalisco"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
value: "MC",
|
|
79
|
-
label: "Estado de México"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
value: "MN",
|
|
83
|
-
label: "Michoacan de Ocampo"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
value: "MS",
|
|
87
|
-
label: "Morelos"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
value: "NT",
|
|
91
|
-
label: "Nayarit"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
value: "NL",
|
|
95
|
-
label: "Nuevo León"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
value: "OC",
|
|
99
|
-
label: "Oaxaca"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
value: "PL",
|
|
103
|
-
label: "Puebla"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
value: "QT",
|
|
107
|
-
label: "Queretaro de Arteaga"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
value: "QR",
|
|
111
|
-
label: "Quintana Roo"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
value: "SP",
|
|
115
|
-
label: "San Luis Potosi"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
value: "SL",
|
|
119
|
-
label: "Sinaloa"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
value: "SR",
|
|
123
|
-
label: "Sonora"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
value: "TC",
|
|
127
|
-
label: "Tabasco"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
value: "TS",
|
|
131
|
-
label: "Tamaulipas"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
value: "TL",
|
|
135
|
-
label: "Tlaxcala"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
value: "VZ",
|
|
139
|
-
label: "Veracruz"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
value: "YN",
|
|
143
|
-
label: "Yucatan"
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
value: "ZS",
|
|
147
|
-
label: "Zacatecas"
|
|
148
|
-
}
|
|
149
|
-
];
|
|
150
|
-
function isGenerateFormValid(form) {
|
|
151
|
-
return !!(form.name && form.firstLastName && form.gender && form.birthDate && form.birthState);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
//#endregion
|
|
155
|
-
//#region src/modules/curp-validation/curpValidationServices.ts
|
|
156
|
-
async function fetchOcrData(signal) {
|
|
157
|
-
const res = await api.get(endpoints.ocrData, { signal });
|
|
158
|
-
if (!res.ok) throw new Error(`GET ${endpoints.ocrData} failed: ${res.status} ${res.statusText}`);
|
|
159
|
-
return res.data;
|
|
160
|
-
}
|
|
161
|
-
async function addCurp(curp, signal) {
|
|
162
|
-
const res = await api.post(endpoints.addCurp, { curp }, { signal });
|
|
163
|
-
if (!res.ok) throw new Error(`POST ${endpoints.addCurp} failed: ${res.status} ${res.statusText}`);
|
|
164
|
-
return res.data;
|
|
165
|
-
}
|
|
166
|
-
async function addCurpV2(form, signal) {
|
|
167
|
-
const payload = {
|
|
168
|
-
name: form.name,
|
|
169
|
-
firstLastName: form.firstLastName,
|
|
170
|
-
secondLastName: form.secondLastName,
|
|
171
|
-
gender: form.gender,
|
|
172
|
-
birthDate: formatDateForApi(form.birthDate),
|
|
173
|
-
state: form.birthState
|
|
174
|
-
};
|
|
175
|
-
const res = await api.post(endpoints.addCurpV2, payload, { signal });
|
|
176
|
-
if (!res.ok) throw new Error(`POST ${endpoints.addCurpV2} failed: ${res.status} ${res.statusText}`);
|
|
177
|
-
return res.data;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/modules/curp-validation/curpValidationStateMachine.ts
|
|
182
|
-
const DEFAULT_GENERATE_FORM = {
|
|
183
|
-
name: "",
|
|
184
|
-
firstLastName: "",
|
|
185
|
-
secondLastName: "",
|
|
186
|
-
gender: "",
|
|
187
|
-
birthDate: "",
|
|
188
|
-
birthState: ""
|
|
189
|
-
};
|
|
190
|
-
const curpValidationMachine = setup({
|
|
191
|
-
types: {
|
|
192
|
-
context: {},
|
|
193
|
-
events: {},
|
|
194
|
-
input: {}
|
|
195
|
-
},
|
|
196
|
-
actors: {
|
|
197
|
-
fetchOcrData: fromPromise(async ({ signal }) => {
|
|
198
|
-
return fetchOcrData(signal);
|
|
199
|
-
}),
|
|
200
|
-
verifyCurp: fromPromise(async ({ input, signal }) => {
|
|
201
|
-
return addCurp(input.curp, signal);
|
|
202
|
-
}),
|
|
203
|
-
generateCurpActor: fromPromise(async ({ input, signal }) => {
|
|
204
|
-
return addCurpV2(input.form, signal);
|
|
205
|
-
})
|
|
206
|
-
},
|
|
207
|
-
actions: {
|
|
208
|
-
setCurpFromOcr: assign(({ event }) => {
|
|
209
|
-
const curp = (event.output?.curp ?? "").toUpperCase();
|
|
210
|
-
return {
|
|
211
|
-
curp,
|
|
212
|
-
isValid: isValidCurp(curp)
|
|
213
|
-
};
|
|
214
|
-
}),
|
|
215
|
-
setCurp: assign(({ event }) => {
|
|
216
|
-
const curp = event.curp.toUpperCase();
|
|
217
|
-
return {
|
|
218
|
-
curp,
|
|
219
|
-
isValid: isValidCurp(curp)
|
|
220
|
-
};
|
|
221
|
-
}),
|
|
222
|
-
setGenerateForm: assign(({ context, event }) => {
|
|
223
|
-
const e = event;
|
|
224
|
-
const form = {
|
|
225
|
-
...context.generateForm,
|
|
226
|
-
...e.form
|
|
227
|
-
};
|
|
228
|
-
return {
|
|
229
|
-
generateForm: form,
|
|
230
|
-
isGenerateFormValid: isGenerateFormValid(form)
|
|
231
|
-
};
|
|
232
|
-
}),
|
|
233
|
-
setGeneratedCurp: assign(({ event }) => {
|
|
234
|
-
const curp = event.output?.curp ?? "";
|
|
235
|
-
return {
|
|
236
|
-
generatedCurp: curp,
|
|
237
|
-
curp,
|
|
238
|
-
isValid: isValidCurp(curp)
|
|
239
|
-
};
|
|
240
|
-
}),
|
|
241
|
-
decrementRetries: assign(({ context }) => ({ retriesLeft: Math.max(0, context.retriesLeft - 1) })),
|
|
242
|
-
setFromGenerate: assign({ fromGenerate: () => true }),
|
|
243
|
-
clearFromGenerate: assign({ fromGenerate: () => false }),
|
|
244
|
-
setError: assign(({ event }) => ({ error: String(event.error) }))
|
|
245
|
-
},
|
|
246
|
-
guards: {
|
|
247
|
-
hasPrefillFromOcr: ({ context }) => context.config.prefillFromOcr !== false,
|
|
248
|
-
hasOcrCurp: ({ event }) => {
|
|
249
|
-
return !!event.output?.curp?.trim();
|
|
250
|
-
},
|
|
251
|
-
canRetry: ({ context }) => context.retriesLeft > 0,
|
|
252
|
-
isDeceased: ({ event }) => {
|
|
253
|
-
return event.output?.deceasedStatus === "DECEASED";
|
|
254
|
-
},
|
|
255
|
-
isScrapingFallback: ({ event }) => {
|
|
256
|
-
return event.output?.result === "Attempting validation by scraping method";
|
|
257
|
-
},
|
|
258
|
-
isGenerateSuccess: ({ event }) => {
|
|
259
|
-
const output = event.output;
|
|
260
|
-
return !!(output?.success && output?.curp);
|
|
261
|
-
},
|
|
262
|
-
isVerifySuccess: ({ event }) => {
|
|
263
|
-
return event.output?.success === true;
|
|
264
|
-
},
|
|
265
|
-
fromGeneratePath: ({ context }) => context.fromGenerate,
|
|
266
|
-
isGenerateFormValidGuard: ({ context }) => context.isGenerateFormValid,
|
|
267
|
-
isValidCurpGuard: ({ context }) => context.isValid
|
|
268
|
-
}
|
|
269
|
-
}).createMachine({
|
|
270
|
-
id: "curpValidation",
|
|
271
|
-
initial: "idle",
|
|
272
|
-
context: ({ input }) => ({
|
|
273
|
-
config: input.config,
|
|
274
|
-
curp: "",
|
|
275
|
-
isValid: false,
|
|
276
|
-
generateForm: { ...DEFAULT_GENERATE_FORM },
|
|
277
|
-
isGenerateFormValid: false,
|
|
278
|
-
retriesLeft: input.config.maxRetries ?? 1,
|
|
279
|
-
generatedCurp: void 0,
|
|
280
|
-
error: void 0,
|
|
281
|
-
fromGenerate: false
|
|
282
|
-
}),
|
|
283
|
-
states: {
|
|
284
|
-
idle: { on: {
|
|
285
|
-
LOAD: [{
|
|
286
|
-
target: "loading",
|
|
287
|
-
guard: "hasPrefillFromOcr"
|
|
288
|
-
}, { target: "enterCurp" }],
|
|
289
|
-
CLOSE: "closed"
|
|
290
|
-
} },
|
|
291
|
-
loading: {
|
|
292
|
-
invoke: {
|
|
293
|
-
id: "fetchOcrData",
|
|
294
|
-
src: "fetchOcrData",
|
|
295
|
-
onDone: [{
|
|
296
|
-
target: "verifying",
|
|
297
|
-
guard: "hasOcrCurp",
|
|
298
|
-
actions: "setCurpFromOcr"
|
|
299
|
-
}, { target: "enterCurp" }],
|
|
300
|
-
onError: { target: "enterCurp" }
|
|
301
|
-
},
|
|
302
|
-
on: { CLOSE: "closed" }
|
|
303
|
-
},
|
|
304
|
-
enterCurp: { on: {
|
|
305
|
-
SET_CURP: { actions: "setCurp" },
|
|
306
|
-
VERIFY: {
|
|
307
|
-
target: "verifying",
|
|
308
|
-
guard: "isValidCurpGuard"
|
|
309
|
-
},
|
|
310
|
-
SWITCH_TO_GENERATE: {
|
|
311
|
-
target: "generateCurp",
|
|
312
|
-
actions: "setFromGenerate"
|
|
313
|
-
},
|
|
314
|
-
CLOSE: "closed"
|
|
315
|
-
} },
|
|
316
|
-
verifying: {
|
|
317
|
-
invoke: {
|
|
318
|
-
id: "verifyCurp",
|
|
319
|
-
src: "verifyCurp",
|
|
320
|
-
input: ({ context }) => ({ curp: context.curp }),
|
|
321
|
-
onDone: [{
|
|
322
|
-
target: "success",
|
|
323
|
-
guard: "isVerifySuccess"
|
|
324
|
-
}, {
|
|
325
|
-
target: "failure",
|
|
326
|
-
actions: "decrementRetries"
|
|
327
|
-
}],
|
|
328
|
-
onError: {
|
|
329
|
-
target: "failure",
|
|
330
|
-
actions: ["decrementRetries", "setError"]
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
on: { CLOSE: "closed" }
|
|
334
|
-
},
|
|
335
|
-
success: {
|
|
336
|
-
after: { 3e3: "finished" },
|
|
337
|
-
on: { CLOSE: "closed" }
|
|
338
|
-
},
|
|
339
|
-
failure: {
|
|
340
|
-
on: {
|
|
341
|
-
RETRY: [{
|
|
342
|
-
target: "generateCurp",
|
|
343
|
-
guard: ({ context }) => context.retriesLeft > 0 && context.fromGenerate
|
|
344
|
-
}, {
|
|
345
|
-
target: "enterCurp",
|
|
346
|
-
guard: ({ context }) => context.retriesLeft > 0 && !context.fromGenerate,
|
|
347
|
-
actions: "clearFromGenerate"
|
|
348
|
-
}],
|
|
349
|
-
CLOSE: "closed"
|
|
350
|
-
},
|
|
351
|
-
after: { 3e3: [{
|
|
352
|
-
target: "finished",
|
|
353
|
-
guard: ({ context }) => context.retriesLeft <= 0
|
|
354
|
-
}] }
|
|
355
|
-
},
|
|
356
|
-
generateCurp: { on: {
|
|
357
|
-
SET_GENERATE_FORM: { actions: "setGenerateForm" },
|
|
358
|
-
GENERATE: {
|
|
359
|
-
target: "generating",
|
|
360
|
-
guard: "isGenerateFormValidGuard"
|
|
361
|
-
},
|
|
362
|
-
CLOSE: "closed"
|
|
363
|
-
} },
|
|
364
|
-
generating: {
|
|
365
|
-
invoke: {
|
|
366
|
-
id: "generateCurpActor",
|
|
367
|
-
src: "generateCurpActor",
|
|
368
|
-
input: ({ context }) => ({ form: context.generateForm }),
|
|
369
|
-
onDone: [
|
|
370
|
-
{
|
|
371
|
-
target: "finished",
|
|
372
|
-
guard: "isScrapingFallback"
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
target: "finished",
|
|
376
|
-
guard: "isDeceased"
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
target: "confirmCurp",
|
|
380
|
-
guard: "isGenerateSuccess",
|
|
381
|
-
actions: "setGeneratedCurp"
|
|
382
|
-
},
|
|
383
|
-
{
|
|
384
|
-
target: "generateError",
|
|
385
|
-
actions: "setFromGenerate"
|
|
386
|
-
}
|
|
387
|
-
],
|
|
388
|
-
onError: {
|
|
389
|
-
target: "generateError",
|
|
390
|
-
actions: ["setFromGenerate", "setError"]
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
on: { CLOSE: "closed" }
|
|
394
|
-
},
|
|
395
|
-
confirmCurp: { on: {
|
|
396
|
-
CONFIRM: { target: "verifying" },
|
|
397
|
-
CLOSE: "closed"
|
|
398
|
-
} },
|
|
399
|
-
generateError: {
|
|
400
|
-
on: {
|
|
401
|
-
RETRY: {
|
|
402
|
-
target: "generateCurp",
|
|
403
|
-
guard: "canRetry",
|
|
404
|
-
actions: "decrementRetries"
|
|
405
|
-
},
|
|
406
|
-
CLOSE: "closed"
|
|
407
|
-
},
|
|
408
|
-
after: { 3e3: [{
|
|
409
|
-
target: "finished",
|
|
410
|
-
guard: ({ context }) => context.retriesLeft <= 0
|
|
411
|
-
}] }
|
|
412
|
-
},
|
|
413
|
-
finished: { type: "final" },
|
|
414
|
-
closed: { type: "final" }
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
//#endregion
|
|
419
6
|
//#region src/modules/curp-validation/curpValidationActor.ts
|
|
420
7
|
function createCurpValidationActor(options) {
|
|
421
8
|
return createActor(curpValidationMachine, { input: { config: options.config } }).start();
|