@incodetech/core 0.0.0-dev-20260506-135ee70 → 0.0.0-dev-20260507-e005279
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/{OpenViduRecordingProvider-uonkP2qT.esm.js → OpenViduRecordingProvider-VSC4Wgmh.esm.js} +1 -1
- package/dist/ae-signature.d.ts +3 -3
- package/dist/antifraud.d.ts +1 -1
- package/dist/authentication.d.ts +11 -11
- package/dist/authentication.esm.js +4 -4
- package/dist/{authenticationManager-DoYYNtAB.esm.js → authenticationManager-BmRvJPaH.esm.js} +1 -1
- package/dist/{authenticationManager-B8GvzIqz.d.ts → authenticationManager-ii8ZNmw2.d.ts} +2 -2
- package/dist/{authenticationStateMachine-DM9magHC.esm.js → authenticationStateMachine-wCMzEk11.esm.js} +2 -2
- package/dist/camera.d.ts +1 -1
- package/dist/consent.d.ts +49 -49
- package/dist/cpf-ocr.d.ts +24 -24
- package/dist/cross-document-data-match.d.ts +1 -1
- package/dist/curp-validation.d.ts +5 -5
- package/dist/custom-fields.d.ts +2 -2
- package/dist/custom-watchlist.d.ts +1 -1
- package/dist/{deepsightService-GnSzshni.d.ts → deepsightService-DljAhyUS.d.ts} +2 -2
- package/dist/document-capture.d.ts +71 -71
- package/dist/document-upload.d.ts +44 -44
- package/dist/ekyb.d.ts +3 -3
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybStateMachine-jDkRkJdd.esm.js → ekybStateMachine-aK9Zeaz0.esm.js} +1 -1
- package/dist/ekyc.d.ts +3 -3
- package/dist/electronic-signature.d.ts +3 -3
- package/dist/email.d.ts +3 -3
- package/dist/{emailManager-_R1h46gY.d.ts → emailManager-CveAxTDP.d.ts} +2 -2
- package/dist/extensibility.d.ts +15 -15
- package/dist/extensibility.esm.js +9 -9
- package/dist/face-match.d.ts +1 -1
- package/dist/{faceCaptureManagerFactory-Djy4IlDy.d.ts → faceCaptureManagerFactory-trA9Rn6f.d.ts} +8 -8
- package/dist/{faceCaptureSetup-BS_YbgPv.esm.js → faceCaptureSetup-9eFWtwWI.esm.js} +1 -1
- package/dist/flow-events.d.ts +5 -5
- package/dist/flow.d.ts +11 -11
- package/dist/flow.esm.js +2 -2
- package/dist/{flowServices-O6vB_fWX.esm.js → flowServices-DAz4XU4K.esm.js} +1 -1
- package/dist/geolocation.d.ts +2 -2
- package/dist/government-validation.d.ts +2 -2
- package/dist/home.d.ts +14 -14
- package/dist/id-ocr.d.ts +54 -54
- package/dist/id-ocr.esm.js +6 -386
- package/dist/id.d.ts +10 -10
- package/dist/id.esm.js +4 -4
- package/dist/{idCaptureManager-CPTyaHJV.esm.js → idCaptureManager-CSD21nvL.esm.js} +1 -1
- package/dist/{idCaptureManager-Bqg9zlPG.d.ts → idCaptureManager-DcGzjbMw.d.ts} +7 -7
- package/dist/{idCaptureStateMachine-BamGe_4p.esm.js → idCaptureStateMachine-DNP1IiM8.esm.js} +4 -4
- package/dist/idOcrStateMachine-BpMmG450.esm.js +388 -0
- package/dist/identity-reuse.d.ts +42 -42
- package/dist/{index-CzOhiwDF.d.ts → index-BpTtY0jy.d.ts} +2 -2
- package/dist/{index-DQ9F_jHn.d.ts → index-DxHpELN_.d.ts} +120 -120
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/mandatory-consent.d.ts +55 -55
- package/dist/mandatory-consent.esm.js +1 -1
- package/dist/openviduLazy-C35XN0G5.esm.js +3 -0
- package/dist/{openviduLazy-aNR44E71.esm.js → openviduLazy-CH1qVdk4.esm.js} +1 -1
- package/dist/phone.d.ts +3 -3
- package/dist/{phoneManager-Co_KRbXI.d.ts → phoneManager-CXU5qAEp.d.ts} +2 -2
- package/dist/qe-signature.d.ts +3 -3
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{recordingService-Dfbz2eLt.esm.js → recordingService-DmAnFiD_.esm.js} +4 -4
- package/dist/redirect-to-mobile.d.ts +2 -2
- package/dist/redirect-to-mobile.esm.js +1 -1
- package/dist/selfie.d.ts +11 -11
- package/dist/selfie.esm.js +4 -4
- package/dist/{selfieManager-nb4RVuY8.d.ts → selfieManager-BM3gX8wt.d.ts} +2 -2
- package/dist/{selfieManager-DZAiQU3s.esm.js → selfieManager-BfsykqaD.esm.js} +1 -1
- package/dist/{selfieStateMachine-DBEkKHvx.esm.js → selfieStateMachine-CzExLyb6.esm.js} +2 -2
- package/dist/{session-z8mDIfNZ.esm.js → session-DeQFkqNh.esm.js} +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +1 -1
- package/dist/{setup-Bj5ZkdOq.d.ts → setup-DR-GXYcF.d.ts} +1 -1
- package/dist/{setup-CePh1s7T.esm.js → setup-Dnt4R04d.esm.js} +1 -1
- package/dist/signature.d.ts +2 -2
- package/dist/signature.esm.js +1 -1
- package/dist/{types-C7dI6ci8.d.ts → types-BRSrJ9_B.d.ts} +1 -1
- package/dist/{types-DP2M29nE.d.ts → types-BYfGowzf.d.ts} +1 -1
- package/dist/{types-BWX0ell9.d.ts → types-CB9HxtLU.d.ts} +1 -1
- package/dist/wasm.d.ts +2 -2
- package/dist/wasm.esm.js +2 -2
- package/dist/watchlist-for-business.d.ts +1 -1
- package/dist/watchlist.d.ts +1 -1
- package/dist/workflow.d.ts +120 -120
- package/dist/workflow.esm.js +14 -12
- package/package.json +3 -3
- package/dist/openviduLazy-npBduPje.esm.js +0 -3
- /package/dist/{Actor-Bmv1bZHV.d.ts → Actor-DPJ2L-q1.d.ts} +0 -0
- /package/dist/{Manager-B29-VhX7.d.ts → Manager-D09zXsjJ.d.ts} +0 -0
- /package/dist/{StateMachine-B69HEnJB.d.ts → StateMachine-Dg9ghlLh.d.ts} +0 -0
- /package/dist/{camera-m4482v-4.d.ts → camera-DV8Ep-_K.d.ts} +0 -0
- /package/dist/{deepsightLoader-CmYeKifo.esm.js → deepsightLoader-Czuy5gmc.esm.js} +0 -0
- /package/dist/{displayErrors-CbV0IBtb.d.ts → displayErrors-Qx-DuMvI.d.ts} +0 -0
- /package/dist/{flowCompletionService-BqSRUWAg.d.ts → flowCompletionService-B4VbRg-J.d.ts} +0 -0
- /package/dist/{lib-By_d_iUN.esm.js → lib-e9A3TaUp.esm.js} +0 -0
- /package/dist/{mandatoryConsentStateMachine-BK246N9V.esm.js → mandatoryConsentStateMachine-u2Dejbsq.esm.js} +0 -0
- /package/dist/{qe-signature-TspdCZZA.esm.js → qe-signature-C5aBKDWr.esm.js} +0 -0
- /package/dist/{redirectToMobileStateMachine-SEyTm9zV.esm.js → redirectToMobileStateMachine-CcwBfjQG.esm.js} +0 -0
- /package/dist/{signatureStateMachine-DbyKqwWg.esm.js → signatureStateMachine-Bs0_U_Lo.esm.js} +0 -0
- /package/dist/{types-CvEiKWkW.d.ts → types--DdSD2gk.d.ts} +0 -0
- /package/dist/{warmup-CyH7UzFj.d.ts → warmup-Br1UnuWP.d.ts} +0 -0
package/dist/id-ocr.esm.js
CHANGED
|
@@ -1,390 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { n as eventModuleNames, o as createManagerInstrumentation
|
|
3
|
-
import
|
|
4
|
-
import { a as createActor,
|
|
5
|
-
import
|
|
1
|
+
import "./api-DZdHZLhE.esm.js";
|
|
2
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-uIxiN9N7.esm.js";
|
|
3
|
+
import "./endpoints-DNtRS0G7.esm.js";
|
|
4
|
+
import { a as createActor, o as createManager } from "./xstate.esm-COokXZK9.esm.js";
|
|
5
|
+
import "./cpf-Dalbmi8t.esm.js";
|
|
6
|
+
import { a as MIN_AGE, i as CPFFlowIds, n as OCR_FIELDS, r as getOcrFields, t as idOcrStateMachine } from "./idOcrStateMachine-BpMmG450.esm.js";
|
|
6
7
|
|
|
7
|
-
//#region ../infra/src/providers/browser/DateFormattingProvider.ts
|
|
8
|
-
var DateFormattingProvider = class {
|
|
9
|
-
utcToIsoDateString(value) {
|
|
10
|
-
if (value === void 0 || value === null || value === "") return "";
|
|
11
|
-
const date = new Date(value);
|
|
12
|
-
if (Number.isNaN(date.getTime())) return "";
|
|
13
|
-
return `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, "0")}-${String(date.getUTCDate()).padStart(2, "0")}`;
|
|
14
|
-
}
|
|
15
|
-
parseIsoDateStringToEpochMs(value) {
|
|
16
|
-
return Date.parse(value);
|
|
17
|
-
}
|
|
18
|
-
getAgeInYears(birthDate, referenceEpochMs) {
|
|
19
|
-
const now = new Date(referenceEpochMs);
|
|
20
|
-
const birth = typeof birthDate === "string" && /^\d{4}-\d{2}-\d{2}$/.test(birthDate) ? (() => {
|
|
21
|
-
const [y, m, d] = birthDate.split("-").map(Number);
|
|
22
|
-
return new Date(y, m - 1, d);
|
|
23
|
-
})() : new Date(birthDate);
|
|
24
|
-
let age = now.getFullYear() - birth.getFullYear();
|
|
25
|
-
const monthDiff = now.getMonth() - birth.getMonth();
|
|
26
|
-
if (monthDiff < 0 || monthDiff === 0 && now.getDate() < birth.getDate()) age--;
|
|
27
|
-
return age;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/modules/id-ocr/idOcrUtils.ts
|
|
33
|
-
const dateFormattingInstance$1 = new DateFormattingProvider();
|
|
34
|
-
const resolveFullName = (data) => {
|
|
35
|
-
if (data.name?.fullName) return data.name.fullName;
|
|
36
|
-
const joined = [
|
|
37
|
-
data.name?.givenName ?? data.givenName ?? data.firstName,
|
|
38
|
-
data.name?.paternalLastName ?? data.fathersSurname,
|
|
39
|
-
data.name?.maternalLastName ?? data.mothersSurname
|
|
40
|
-
].filter(Boolean).join(" ").trim();
|
|
41
|
-
if (joined) return joined;
|
|
42
|
-
return data.fullNameMrz ?? "";
|
|
43
|
-
};
|
|
44
|
-
const mapOcrResponseToFormData = (data) => ({
|
|
45
|
-
name: resolveFullName(data),
|
|
46
|
-
firstName: data.firstName ?? data.givenName ?? data.name?.givenName ?? "",
|
|
47
|
-
lastName: data.fathersSurname ?? data.name?.paternalLastName ?? "",
|
|
48
|
-
paternalLastName: data.fathersSurname ?? data.name?.paternalLastName ?? "",
|
|
49
|
-
maternalLastName: data.mothersSurname ?? data.name?.maternalLastName ?? "",
|
|
50
|
-
birthDate: dateFormattingInstance$1.utcToIsoDateString(data.birthDate),
|
|
51
|
-
gender: data.gender ?? "",
|
|
52
|
-
address: data.address ?? "",
|
|
53
|
-
documentNumber: data.documentNumber ?? "",
|
|
54
|
-
personalNumber: data.personalNumber ?? "",
|
|
55
|
-
curp: data.curp ?? "",
|
|
56
|
-
issuingCountry: data.issuingCountry ?? "",
|
|
57
|
-
expireAt: data.expireAt,
|
|
58
|
-
email: ""
|
|
59
|
-
});
|
|
60
|
-
const mapUpdateOcrDataForApi = (params) => {
|
|
61
|
-
const working = { ...params };
|
|
62
|
-
const nameTrimmed = working.name?.trim();
|
|
63
|
-
if (nameTrimmed) working.name = nameTrimmed;
|
|
64
|
-
if (nameTrimmed && !working.firstName?.trim() && !working.paternalLastName?.trim() && !working.maternalLastName?.trim()) {
|
|
65
|
-
const tokens = nameTrimmed.split(/\s+/).filter(Boolean);
|
|
66
|
-
if (tokens.length === 3) {
|
|
67
|
-
working.firstName = tokens[0];
|
|
68
|
-
working.paternalLastName = tokens[1];
|
|
69
|
-
working.maternalLastName = tokens[2];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const body = {};
|
|
73
|
-
for (const key of Object.keys(working)) {
|
|
74
|
-
const raw = working[key];
|
|
75
|
-
if (raw === void 0) continue;
|
|
76
|
-
if (key === "birthDate") {
|
|
77
|
-
body[key] = dateFormattingInstance$1.parseIsoDateStringToEpochMs(raw);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
body[key] = typeof raw === "string" ? raw.trim() : raw;
|
|
81
|
-
}
|
|
82
|
-
return body;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
//#endregion
|
|
86
|
-
//#region src/modules/id-ocr/idOcrServices.ts
|
|
87
|
-
/** Fetch ID OCR data. Throws on failure. */
|
|
88
|
-
async function getOcrData(signal, isSecondId) {
|
|
89
|
-
const url = isSecondId ? endpoints.ocrDataSecondId : endpoints.ocrData;
|
|
90
|
-
const res = await api.get(url, { signal });
|
|
91
|
-
if (!res.ok) throw new Error(`GET ${url} failed: ${res.status} ${res.statusText}`);
|
|
92
|
-
return res.data;
|
|
93
|
-
}
|
|
94
|
-
/** Updates ID OCR data if OCR data is editable. Throws on failure. */
|
|
95
|
-
async function updateOcrData(params, signal, isSecondId) {
|
|
96
|
-
const url = isSecondId ? endpoints.updateEditableOcrDataSecondId : endpoints.updateEditableOcrData;
|
|
97
|
-
const res = await api.put(url, mapUpdateOcrDataForApi(params), { signal });
|
|
98
|
-
if (!res.ok) throw new Error(`PUT failed: ${url} failed: ${res.status} ${res.statusText}`);
|
|
99
|
-
return res.data;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/modules/id-ocr/idOcrConsts.ts
|
|
104
|
-
const MIN_AGE = 18;
|
|
105
|
-
const CPFFlowIds = [
|
|
106
|
-
"65985b7ec335fa20effa547b",
|
|
107
|
-
"657b823ddb312196b5dd30f8",
|
|
108
|
-
"659843c207413e34c407fc1d",
|
|
109
|
-
"657c8b7a188817b6ec04b26c",
|
|
110
|
-
"6793bba8845d50f53f5fb910",
|
|
111
|
-
"679826a35ec9927c65407873",
|
|
112
|
-
"6838c03fae866c13e63fbaf4",
|
|
113
|
-
"681a14fb37a49f2319cbf359",
|
|
114
|
-
"68e5318406c77c2b6993ed8f",
|
|
115
|
-
"68e531531a6892418eecd21f",
|
|
116
|
-
"68e5314706c77c2b6993eb99"
|
|
117
|
-
];
|
|
118
|
-
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/modules/id-ocr/idOcrFields.ts
|
|
121
|
-
const CPF_ONLY_OCR_FIELDS = [{
|
|
122
|
-
key: "documentNumber",
|
|
123
|
-
labelKey: "userData.cpf",
|
|
124
|
-
type: "text",
|
|
125
|
-
validation: [{ type: "required" }, { type: "cpf" }],
|
|
126
|
-
required: true
|
|
127
|
-
}];
|
|
128
|
-
const OCR_FIELDS = [
|
|
129
|
-
{
|
|
130
|
-
key: "name",
|
|
131
|
-
labelKey: "userData.fullName",
|
|
132
|
-
type: "text",
|
|
133
|
-
validation: [{ type: "required" }],
|
|
134
|
-
required: true
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
key: "birthDate",
|
|
138
|
-
labelKey: "userData.dateOfBirth",
|
|
139
|
-
type: "date",
|
|
140
|
-
validation: [{ type: "required" }, {
|
|
141
|
-
type: "minAge",
|
|
142
|
-
years: MIN_AGE
|
|
143
|
-
}],
|
|
144
|
-
required: true
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
key: "gender",
|
|
148
|
-
labelKey: "userData.sex",
|
|
149
|
-
type: "radio",
|
|
150
|
-
options: [{
|
|
151
|
-
label: "common.male",
|
|
152
|
-
value: "M"
|
|
153
|
-
}, {
|
|
154
|
-
label: "common.female",
|
|
155
|
-
value: "F"
|
|
156
|
-
}],
|
|
157
|
-
required: false
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
key: "issuingCountry",
|
|
161
|
-
labelKey: "userData.issuingCountry",
|
|
162
|
-
type: "text",
|
|
163
|
-
validation: [{ type: "required" }],
|
|
164
|
-
required: true
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
key: "documentNumber",
|
|
168
|
-
labelKey: "userData.documentNumber",
|
|
169
|
-
type: "text",
|
|
170
|
-
validation: [{ type: "required" }],
|
|
171
|
-
required: true
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
key: "address",
|
|
175
|
-
labelKey: "userData.address",
|
|
176
|
-
type: "text",
|
|
177
|
-
validation: [{ type: "required" }],
|
|
178
|
-
required: true
|
|
179
|
-
}
|
|
180
|
-
];
|
|
181
|
-
const getOcrFields = (config) => {
|
|
182
|
-
const { flowId } = config;
|
|
183
|
-
if (flowId && CPFFlowIds.includes(flowId)) return CPF_ONLY_OCR_FIELDS;
|
|
184
|
-
return OCR_FIELDS;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
//#endregion
|
|
188
|
-
//#region src/modules/id-ocr/idOcrValidators.ts
|
|
189
|
-
const dateFormattingInstance = new DateFormattingProvider();
|
|
190
|
-
const createValidators = () => {
|
|
191
|
-
return {
|
|
192
|
-
required: (value, _) => !value.trim() ? "modifiableOCR.cantBeEmpty" : void 0,
|
|
193
|
-
minAge: (value, rule) => {
|
|
194
|
-
if (!value.trim() || rule.type !== "minAge") return void 0;
|
|
195
|
-
return dateFormattingInstance.getAgeInYears(value, getTimestamp()) < rule.years ? "modifiableOCR.ageRange" : void 0;
|
|
196
|
-
},
|
|
197
|
-
cpf: (value, rule) => {
|
|
198
|
-
if (rule.type !== "cpf" || !value.trim()) return void 0;
|
|
199
|
-
return validateCPF(value) ? void 0 : "verification.errors.invalidTaxId";
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
const normalizeFieldValue = (value) => typeof value === "string" ? value.trim() : String(value ?? "");
|
|
204
|
-
const validateFieldValue = (value, field, validators) => {
|
|
205
|
-
if (!field.validation) return void 0;
|
|
206
|
-
for (const rule of field.validation) {
|
|
207
|
-
const error = validators[rule.type](value, rule);
|
|
208
|
-
if (error) return error;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const validateOcrForm = (data, fields) => {
|
|
212
|
-
const validators = createValidators();
|
|
213
|
-
return fields.reduce((errors, field) => {
|
|
214
|
-
const error = validateFieldValue(normalizeFieldValue(data[field.key]), field, validators);
|
|
215
|
-
if (error) errors[field.key] = error;
|
|
216
|
-
return errors;
|
|
217
|
-
}, {});
|
|
218
|
-
};
|
|
219
|
-
const validateOcrField = (data, fieldKey, fields) => {
|
|
220
|
-
const field = fields.find((field$1) => field$1.key === fieldKey);
|
|
221
|
-
if (!field) return void 0;
|
|
222
|
-
const validators = createValidators();
|
|
223
|
-
return validateFieldValue(normalizeFieldValue(data[field.key]), field, validators);
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
//#endregion
|
|
227
|
-
//#region src/modules/id-ocr/idOcrStateMachine.ts
|
|
228
|
-
const emptyOcrData = () => ({});
|
|
229
|
-
const idOcrStateMachine = setup({
|
|
230
|
-
types: {
|
|
231
|
-
context: {},
|
|
232
|
-
events: {},
|
|
233
|
-
input: {}
|
|
234
|
-
},
|
|
235
|
-
actors: {
|
|
236
|
-
getOcrData: fromPromise(async ({ input, signal }) => getOcrData(signal, input.isSecondId)),
|
|
237
|
-
updateOcrData: fromPromise(async ({ input, signal }) => updateOcrData(input.params, signal, input.isSecondId))
|
|
238
|
-
},
|
|
239
|
-
actions: {
|
|
240
|
-
setInitialData: assign(({ event }) => {
|
|
241
|
-
const raw = event.output;
|
|
242
|
-
return {
|
|
243
|
-
formData: mapOcrResponseToFormData(raw),
|
|
244
|
-
editedFields: {},
|
|
245
|
-
validationErrors: void 0,
|
|
246
|
-
error: void 0
|
|
247
|
-
};
|
|
248
|
-
}),
|
|
249
|
-
updateField: assign(({ context, event }) => {
|
|
250
|
-
const { field, value } = event;
|
|
251
|
-
return {
|
|
252
|
-
formData: {
|
|
253
|
-
...context.formData,
|
|
254
|
-
[field]: value
|
|
255
|
-
},
|
|
256
|
-
editedFields: {
|
|
257
|
-
...context.editedFields,
|
|
258
|
-
[field]: value
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
}),
|
|
262
|
-
clearFieldValidationError: assign(({ context, event }) => {
|
|
263
|
-
if (event.type !== "DATA_CHANGED") return {};
|
|
264
|
-
const { field } = event;
|
|
265
|
-
const errs = context.validationErrors;
|
|
266
|
-
if (!errs?.[field]) return {};
|
|
267
|
-
const next = { ...errs };
|
|
268
|
-
delete next[field];
|
|
269
|
-
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
270
|
-
}),
|
|
271
|
-
setOcrValidationErrors: assign(({ context }) => ({ validationErrors: validateOcrForm(context.formData, getOcrFields(context.config)) })),
|
|
272
|
-
validateFormField: assign(({ context, event }) => {
|
|
273
|
-
if (event.type !== "VALIDATE_FIELD") return {};
|
|
274
|
-
const { field } = event;
|
|
275
|
-
const message = validateOcrField(context.formData, field, getOcrFields(context.config));
|
|
276
|
-
const next = { ...context.validationErrors ?? {} };
|
|
277
|
-
if (message) next[field] = message;
|
|
278
|
-
else delete next[field];
|
|
279
|
-
return { validationErrors: Object.keys(next).length > 0 ? next : void 0 };
|
|
280
|
-
}),
|
|
281
|
-
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
282
|
-
beginSecondIdOcrPhase: assign(() => ({
|
|
283
|
-
activeOcrDocument: "second",
|
|
284
|
-
editedFields: {},
|
|
285
|
-
validationErrors: void 0
|
|
286
|
-
})),
|
|
287
|
-
resetForRetry: assign(() => ({
|
|
288
|
-
activeOcrDocument: "first",
|
|
289
|
-
formData: emptyOcrData(),
|
|
290
|
-
editedFields: {},
|
|
291
|
-
error: void 0,
|
|
292
|
-
validationErrors: void 0
|
|
293
|
-
})),
|
|
294
|
-
computeValidationResult: assign(({ context }) => ({ validationErrors: validateOcrForm(context.formData, getOcrFields(context.config)) }))
|
|
295
|
-
},
|
|
296
|
-
guards: {
|
|
297
|
-
isOcrEditable: ({ context }) => context.config.editableOcr === true,
|
|
298
|
-
shouldLoadSecondOcrAfterFirst: ({ context }) => context.config.secondId === true && context.activeOcrDocument === "first",
|
|
299
|
-
isOcrFormValid: ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0,
|
|
300
|
-
shouldSubmit: ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0 && Object.keys(context.editedFields).length > 0,
|
|
301
|
-
shouldProceedWithoutSubmitToSecondId: ({ context }) => Object.keys(context.validationErrors ?? {}).length === 0 && Object.keys(context.editedFields).length === 0 && context.config.secondId === true && context.activeOcrDocument === "first"
|
|
302
|
-
}
|
|
303
|
-
}).createMachine({
|
|
304
|
-
id: "idOcr",
|
|
305
|
-
initial: "idle",
|
|
306
|
-
context: ({ input }) => {
|
|
307
|
-
const data = emptyOcrData();
|
|
308
|
-
return {
|
|
309
|
-
config: input.config,
|
|
310
|
-
formData: data,
|
|
311
|
-
editedFields: {},
|
|
312
|
-
activeOcrDocument: "first"
|
|
313
|
-
};
|
|
314
|
-
},
|
|
315
|
-
states: {
|
|
316
|
-
idle: { on: { LOAD: [{ target: "loading" }] } },
|
|
317
|
-
loading: { invoke: {
|
|
318
|
-
src: "getOcrData",
|
|
319
|
-
input: ({ context }) => ({ isSecondId: context.activeOcrDocument === "second" }),
|
|
320
|
-
onDone: [{
|
|
321
|
-
target: "inputting",
|
|
322
|
-
guard: "isOcrEditable",
|
|
323
|
-
actions: "setInitialData"
|
|
324
|
-
}, {
|
|
325
|
-
target: "readonly",
|
|
326
|
-
actions: "setInitialData"
|
|
327
|
-
}],
|
|
328
|
-
onError: {
|
|
329
|
-
target: "error",
|
|
330
|
-
actions: "setError"
|
|
331
|
-
}
|
|
332
|
-
} },
|
|
333
|
-
readonly: { on: { CONTINUE: [{
|
|
334
|
-
target: "loading",
|
|
335
|
-
guard: "shouldLoadSecondOcrAfterFirst",
|
|
336
|
-
actions: "beginSecondIdOcrPhase"
|
|
337
|
-
}, { target: "success" }] } },
|
|
338
|
-
inputting: { on: {
|
|
339
|
-
DATA_CHANGED: { actions: ["updateField", "clearFieldValidationError"] },
|
|
340
|
-
VALIDATE_FIELD: { actions: "validateFormField" },
|
|
341
|
-
CONTINUE: { target: "validatingContinue" }
|
|
342
|
-
} },
|
|
343
|
-
validatingContinue: {
|
|
344
|
-
entry: "computeValidationResult",
|
|
345
|
-
always: [
|
|
346
|
-
{
|
|
347
|
-
guard: "shouldSubmit",
|
|
348
|
-
target: "submitting"
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
guard: "shouldProceedWithoutSubmitToSecondId",
|
|
352
|
-
target: "loading",
|
|
353
|
-
actions: "beginSecondIdOcrPhase"
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
guard: "isOcrFormValid",
|
|
357
|
-
target: "success"
|
|
358
|
-
},
|
|
359
|
-
{ target: "inputting" }
|
|
360
|
-
]
|
|
361
|
-
},
|
|
362
|
-
submitting: { invoke: {
|
|
363
|
-
src: "updateOcrData",
|
|
364
|
-
input: ({ context }) => ({
|
|
365
|
-
params: context.editedFields,
|
|
366
|
-
isSecondId: context.activeOcrDocument === "second"
|
|
367
|
-
}),
|
|
368
|
-
onDone: [{
|
|
369
|
-
target: "loading",
|
|
370
|
-
guard: "shouldLoadSecondOcrAfterFirst",
|
|
371
|
-
actions: "beginSecondIdOcrPhase"
|
|
372
|
-
}, { target: "success" }],
|
|
373
|
-
onError: {
|
|
374
|
-
target: "error",
|
|
375
|
-
actions: "setError"
|
|
376
|
-
}
|
|
377
|
-
} },
|
|
378
|
-
error: { on: { RETRY: {
|
|
379
|
-
target: "loading",
|
|
380
|
-
actions: "resetForRetry"
|
|
381
|
-
} } },
|
|
382
|
-
success: { after: { 3e3: "finished" } },
|
|
383
|
-
finished: { type: "final" }
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
//#endregion
|
|
388
8
|
//#region src/modules/id-ocr/idOcrActor.ts
|
|
389
9
|
function createIdOcrActor(options) {
|
|
390
10
|
return createActor(idOcrStateMachine, { input: { config: options.config } }).start();
|
package/dist/id.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./warmup-
|
|
2
|
-
import "./Manager-
|
|
3
|
-
import "./Actor-
|
|
4
|
-
import "./StateMachine-
|
|
5
|
-
import { t as CameraStream } from "./camera-
|
|
6
|
-
import "./types-
|
|
7
|
-
import "./types-
|
|
8
|
-
import "./deepsightService-
|
|
9
|
-
import { n as PermissionStatus, t as PermissionResult } from "./types
|
|
10
|
-
import { A as IdCaptureConfig, B as IdErrorCode, C as IdCaptureMachine, D as DetectionArea, E as CapturedImage, F as IdCaptureInput, G as ManualUploadContext, H as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, I as IdCaptureMode, J as RecordingSession, K as ManualUploadSide, L as IdCaptureThresholds, M as IdCaptureDependencies, N as IdCaptureEvent, O as DetectionStatus, P as IdCaptureGeometry, R as IdDocumentType, S as createIdCaptureActor, T as CaptureIdResponse, U as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, V as IdFlowStep, W as MANUAL_UPLOAD_MAX_RETRIES, X as DetectionOrientation, Y as UploadIdResponse, Z as IdCaptureSettings, _ as uploadIdImage, a as IdCaptureInitResult, b as CreateIdCaptureActorOptions, c as UploadIdImageParams, d as initializeIdCapture, f as preloadIdRecordingProvider, g as stopStream, h as stopRecording, j as IdCaptureContext, k as ID_ERROR_CODES, l as UploadManualIdFileParams, m as startRecordingSession, n as IdCaptureState, o as InitializeIdCaptureParams, p as processId, q as ManualUploadTab, r as createIdCaptureManager, s as StartRecordingParams, t as IdCaptureManager, u as ValidationError, v as uploadManualIdFile, w as idCaptureMachine, x as IdCaptureActor, y as validateUploadResponse, z as IdError } from "./idCaptureManager-
|
|
1
|
+
import "./warmup-Br1UnuWP.js";
|
|
2
|
+
import "./Manager-D09zXsjJ.js";
|
|
3
|
+
import "./Actor-DPJ2L-q1.js";
|
|
4
|
+
import "./StateMachine-Dg9ghlLh.js";
|
|
5
|
+
import { t as CameraStream } from "./camera-DV8Ep-_K.js";
|
|
6
|
+
import "./types-CB9HxtLU.js";
|
|
7
|
+
import "./types-BYfGowzf.js";
|
|
8
|
+
import "./deepsightService-DljAhyUS.js";
|
|
9
|
+
import { n as PermissionStatus, t as PermissionResult } from "./types--DdSD2gk.js";
|
|
10
|
+
import { A as IdCaptureConfig, B as IdErrorCode, C as IdCaptureMachine, D as DetectionArea, E as CapturedImage, F as IdCaptureInput, G as ManualUploadContext, H as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, I as IdCaptureMode, J as RecordingSession, K as ManualUploadSide, L as IdCaptureThresholds, M as IdCaptureDependencies, N as IdCaptureEvent, O as DetectionStatus, P as IdCaptureGeometry, R as IdDocumentType, S as createIdCaptureActor, T as CaptureIdResponse, U as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, V as IdFlowStep, W as MANUAL_UPLOAD_MAX_RETRIES, X as DetectionOrientation, Y as UploadIdResponse, Z as IdCaptureSettings, _ as uploadIdImage, a as IdCaptureInitResult, b as CreateIdCaptureActorOptions, c as UploadIdImageParams, d as initializeIdCapture, f as preloadIdRecordingProvider, g as stopStream, h as stopRecording, j as IdCaptureContext, k as ID_ERROR_CODES, l as UploadManualIdFileParams, m as startRecordingSession, n as IdCaptureState, o as InitializeIdCaptureParams, p as processId, q as ManualUploadTab, r as createIdCaptureManager, s as StartRecordingParams, t as IdCaptureManager, u as ValidationError, v as uploadManualIdFile, w as idCaptureMachine, x as IdCaptureActor, y as validateUploadResponse, z as IdError } from "./idCaptureManager-DcGzjbMw.js";
|
|
11
11
|
export { CameraStream, CaptureIdResponse, CapturedImage, type CreateIdCaptureActorOptions, DetectionArea, DetectionOrientation, DetectionStatus, ID_ERROR_CODES, type IdCaptureActor, IdCaptureConfig, type IdCaptureContext, IdCaptureDependencies, type IdCaptureEvent, IdCaptureGeometry, IdCaptureInitResult, type IdCaptureInput, type IdCaptureMachine, type IdCaptureManager, IdCaptureMode, IdCaptureSettings, type IdCaptureState, IdCaptureThresholds, IdDocumentType, IdError, IdErrorCode, IdFlowStep, InitializeIdCaptureParams, MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, MANUAL_UPLOAD_MAX_RETRIES, ManualUploadContext, ManualUploadSide, ManualUploadTab, PermissionResult, PermissionStatus, RecordingSession, StartRecordingParams, UploadIdImageParams, UploadIdResponse, UploadManualIdFileParams, ValidationError, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, preloadIdRecordingProvider, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, uploadManualIdFile, validateUploadResponse };
|
package/dist/id.esm.js
CHANGED
|
@@ -3,12 +3,12 @@ import "./BrowserTimerProvider-OUipjf3B.esm.js";
|
|
|
3
3
|
import "./api-DZdHZLhE.esm.js";
|
|
4
4
|
import "./events-uIxiN9N7.esm.js";
|
|
5
5
|
import "./endpoints-DNtRS0G7.esm.js";
|
|
6
|
-
import "./session-
|
|
6
|
+
import "./session-DeQFkqNh.esm.js";
|
|
7
7
|
import "./IpifyProvider-wp6qqO1v.esm.js";
|
|
8
8
|
import "./browserSimulation-B5_Amlr4.esm.js";
|
|
9
9
|
import "./xstate.esm-COokXZK9.esm.js";
|
|
10
10
|
import "./BrowserStorageProvider-DVqF8tnD.esm.js";
|
|
11
|
-
import "./recordingService-
|
|
11
|
+
import "./recordingService-DmAnFiD_.esm.js";
|
|
12
12
|
import "./deepsightService-Bcszplg_.esm.js";
|
|
13
13
|
import "./permissionServices-eL_s8LM6.esm.js";
|
|
14
14
|
import "./camera-3XOyIO-y.esm.js";
|
|
@@ -19,7 +19,7 @@ import "./platform-C3jlX5mh.esm.js";
|
|
|
19
19
|
import "./ITimerCapability-CSQe9nqt.esm.js";
|
|
20
20
|
import "./backCameraStream-5ADnns4R.esm.js";
|
|
21
21
|
import "./getDeviceClass-DheTn1ak.esm.js";
|
|
22
|
-
import { a as startRecordingSession, c as uploadIdImage, d as ID_ERROR_CODES, f as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, i as processId, l as uploadManualIdFile, m as MANUAL_UPLOAD_MAX_RETRIES, n as initializeIdCapture, o as stopRecording, p as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, r as preloadIdRecordingProvider, s as stopStream, t as idCaptureMachine, u as validateUploadResponse } from "./idCaptureStateMachine-
|
|
23
|
-
import { r as createIdCaptureActor, t as createIdCaptureManager } from "./idCaptureManager-
|
|
22
|
+
import { a as startRecordingSession, c as uploadIdImage, d as ID_ERROR_CODES, f as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, i as processId, l as uploadManualIdFile, m as MANUAL_UPLOAD_MAX_RETRIES, n as initializeIdCapture, o as stopRecording, p as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, r as preloadIdRecordingProvider, s as stopStream, t as idCaptureMachine, u as validateUploadResponse } from "./idCaptureStateMachine-DNP1IiM8.esm.js";
|
|
23
|
+
import { r as createIdCaptureActor, t as createIdCaptureManager } from "./idCaptureManager-CSD21nvL.esm.js";
|
|
24
24
|
|
|
25
25
|
export { ID_ERROR_CODES, MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, MANUAL_UPLOAD_MAX_RETRIES, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, preloadIdRecordingProvider, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, uploadManualIdFile, validateUploadResponse };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-uIxiN9N7.esm.js";
|
|
2
2
|
import { a as createActor, o as createManager } from "./xstate.esm-COokXZK9.esm.js";
|
|
3
3
|
import { t as BrowserStorageProvider } from "./BrowserStorageProvider-DVqF8tnD.esm.js";
|
|
4
|
-
import { t as idCaptureMachine } from "./idCaptureStateMachine-
|
|
4
|
+
import { t as idCaptureMachine } from "./idCaptureStateMachine-DNP1IiM8.esm.js";
|
|
5
5
|
|
|
6
6
|
//#region src/modules/id/idCaptureActor.ts
|
|
7
7
|
function createIdCaptureActor(options) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as Manager } from "./Manager-
|
|
2
|
-
import { t as ActorRefFrom } from "./Actor-
|
|
3
|
-
import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-
|
|
4
|
-
import { t as CameraStream } from "./camera-
|
|
5
|
-
import { a as RegulationTypes, n as Flow, o as TutorialIdConfig } from "./types-
|
|
6
|
-
import { c as IMLProviderCapability, d as IRecordingCapability, f as RecordingConnection, i as IncodeCanvas, l as MLProviderConfig, n as IMotionSensorCapability, r as StreamCanvasCapture, t as DeepsightService, u as IStorageCapability } from "./deepsightService-
|
|
7
|
-
import { n as PermissionStatus, t as PermissionResult } from "./types
|
|
1
|
+
import { t as Manager } from "./Manager-D09zXsjJ.js";
|
|
2
|
+
import { t as ActorRefFrom } from "./Actor-DPJ2L-q1.js";
|
|
3
|
+
import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-Dg9ghlLh.js";
|
|
4
|
+
import { t as CameraStream } from "./camera-DV8Ep-_K.js";
|
|
5
|
+
import { a as RegulationTypes, n as Flow, o as TutorialIdConfig } from "./types-BYfGowzf.js";
|
|
6
|
+
import { c as IMLProviderCapability, d as IRecordingCapability, f as RecordingConnection, i as IncodeCanvas, l as MLProviderConfig, n as IMotionSensorCapability, r as StreamCanvasCapture, t as DeepsightService, u as IStorageCapability } from "./deepsightService-DljAhyUS.js";
|
|
7
|
+
import { n as PermissionStatus, t as PermissionResult } from "./types--DdSD2gk.js";
|
|
8
8
|
|
|
9
9
|
//#region ../infra/src/capabilities/IIdCaptureCapability.d.ts
|
|
10
10
|
/**
|
package/dist/{idCaptureStateMachine-BamGe_4p.esm.js → idCaptureStateMachine-DNP1IiM8.esm.js}
RENAMED
|
@@ -3,9 +3,9 @@ import { t as BrowserTimerProvider } from "./BrowserTimerProvider-OUipjf3B.esm.j
|
|
|
3
3
|
import { r as getToken, t as api } from "./api-DZdHZLhE.esm.js";
|
|
4
4
|
import { S as revokeObjectURL } from "./events-uIxiN9N7.esm.js";
|
|
5
5
|
import { t as endpoints } from "./endpoints-DNtRS0G7.esm.js";
|
|
6
|
-
import { t as getDisableIpify } from "./session-
|
|
6
|
+
import { t as getDisableIpify } from "./session-DeQFkqNh.esm.js";
|
|
7
7
|
import { i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-COokXZK9.esm.js";
|
|
8
|
-
import { _ as StreamCanvasCapture, d as createRecordingSession, f as startRecording, g as flagIdManualReview, m as StreamCanvasProcessingSession, n as preloadOpenViduProvider, p as stopRecording$1 } from "./recordingService-
|
|
8
|
+
import { _ as StreamCanvasCapture, d as createRecordingSession, f as startRecording, g as flagIdManualReview, m as StreamCanvasProcessingSession, n as preloadOpenViduProvider, p as stopRecording$1 } from "./recordingService-DmAnFiD_.esm.js";
|
|
9
9
|
import { n as IncodeCanvas } from "./deepsightService-Bcszplg_.esm.js";
|
|
10
10
|
import { n as requestPermission, r as clearCameraPermissionCache, t as checkPermission } from "./permissionServices-eL_s8LM6.esm.js";
|
|
11
11
|
import { r as getWindowDimensions } from "./getBrowser-FtGDQirD.esm.js";
|
|
@@ -429,7 +429,7 @@ function preloadIdRecordingProvider(config) {
|
|
|
429
429
|
preloadOpenViduProvider();
|
|
430
430
|
}
|
|
431
431
|
async function createOpenViduRecordingProvider() {
|
|
432
|
-
const { OpenViduRecordingProvider } = await import("./OpenViduRecordingProvider-
|
|
432
|
+
const { OpenViduRecordingProvider } = await import("./OpenViduRecordingProvider-VSC4Wgmh.esm.js");
|
|
433
433
|
return new OpenViduRecordingProvider();
|
|
434
434
|
}
|
|
435
435
|
async function startRecordingSession(params) {
|
|
@@ -841,7 +841,7 @@ const checkMotionSensorActor = fromCallback(({ input, sendBack }) => {
|
|
|
841
841
|
});
|
|
842
842
|
const initializeDeepsightSessionActor = fromPromise(async ({ input }) => {
|
|
843
843
|
if (!input.dependencies) return;
|
|
844
|
-
const { loadDeepsightSession } = await import("./deepsightLoader-
|
|
844
|
+
const { loadDeepsightSession } = await import("./deepsightLoader-Czuy5gmc.esm.js");
|
|
845
845
|
return loadDeepsightSession({
|
|
846
846
|
ds: input.ds,
|
|
847
847
|
storage: input.dependencies.storage,
|