@incodetech/core 2.0.0-alpha.12 → 2.0.0-alpha.14
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/{OpenViduLogger-CRbRNZA7.esm.js → OpenViduLogger-BLxxXoyF.esm.js} +1 -1
- package/dist/OpenViduLogger-DyqID_-7.esm.js +3 -0
- package/dist/api-DfRLAneb.esm.js +53 -0
- package/dist/deepsightLoader-BMT0FSg6.esm.js +24 -0
- package/dist/deepsightService-j5zMt6wf.esm.js +236 -0
- package/dist/email.d.ts +5 -5
- package/dist/email.esm.js +16 -17
- package/dist/{xstate.esm-2hDiAXvZ.esm.js → endpoints-BUsSVoJV.esm.js} +28 -1
- package/dist/events-B8ZkhAZo.esm.js +285 -0
- package/dist/flow.d.ts +2 -3
- package/dist/flow.esm.js +18 -7
- package/dist/getDeviceClass-DkfbtsIJ.esm.js +41 -0
- package/dist/{id-CJKLe8HS.esm.js → id-r1mw9zBM.esm.js} +48 -39
- package/dist/id.d.ts +4 -5
- package/dist/id.esm.js +7 -6
- package/dist/{index-CbF_uI-x.d.ts → index-CJMK8K5u.d.ts} +3 -7
- package/dist/index.d.ts +220 -6
- package/dist/index.esm.js +12 -8
- package/dist/{lib-BJoLTN_W.esm.js → lib-CbAibJlt.esm.js} +2 -2
- package/dist/phone.d.ts +5 -5
- package/dist/phone.esm.js +16 -14
- package/dist/selfie.d.ts +119 -46
- package/dist/selfie.esm.js +284 -161
- package/dist/{endpoints-D9TGnxRK.esm.js → src-DYtpbFY5.esm.js} +242 -111
- package/dist/stats-DnU4uUFv.esm.js +16 -0
- package/dist/stats.d.ts +12 -0
- package/dist/stats.esm.js +4 -0
- package/dist/{streamingEvents-B3hNanPl.esm.js → streamingEvents-CfEJv3xH.esm.js} +35 -36
- package/dist/{types-BpCrZLU6.d.ts → types-CMR6NkxW.d.ts} +58 -1
- package/dist/{types-DZbrbPgj.d.ts → types-CRVSv38Q.d.ts} +10 -1
- package/package.json +2 -2
- package/dist/OpenViduLogger-Dy5P806a.esm.js +0 -3
- package/dist/StateMachine-pi8byl8C.d.ts +0 -58
- package/dist/addEvent-BGKc_lHF.esm.js +0 -16
- package/dist/deepsightLoader-B36_XZ7r.esm.js +0 -25
- package/dist/deepsightService-BWxcc4OC.esm.js +0 -225
- package/dist/recordingsRepository-D5MURoVB.esm.js +0 -40
- /package/dist/{Manager-BZUZTRPx.d.ts → Manager-Co-PsiG9.d.ts} +0 -0
- /package/dist/{chunk-FbsBJI8u.esm.js → chunk-V5DOKNPJ.esm.js} +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { t as endpoints } from "./endpoints-BUsSVoJV.esm.js";
|
|
2
|
+
import { i as isApiConfigured, r as getToken, t as api } from "./api-DfRLAneb.esm.js";
|
|
3
|
+
|
|
4
|
+
//#region ../infra/src/capabilities/IBrowserEnvironmentCapability.ts
|
|
5
|
+
function getTimestamp() {
|
|
6
|
+
return Date.now();
|
|
7
|
+
}
|
|
8
|
+
function revokeObjectURL(url) {
|
|
9
|
+
URL.revokeObjectURL(url);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/internal/events/addEvent.ts
|
|
14
|
+
const eventsQueue = [];
|
|
15
|
+
const eventSubscribers = [];
|
|
16
|
+
/**
|
|
17
|
+
* Subscribes to all SDK events for logging, debugging, or custom analytics.
|
|
18
|
+
* Returns an unsubscribe function.
|
|
19
|
+
*
|
|
20
|
+
* @param listener - Callback function that receives each event
|
|
21
|
+
* @returns Unsubscribe function to remove the listener
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const unsubscribe = subscribeEvent((event) => {
|
|
26
|
+
* console.log('[Event]', event.code, event.module);
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // Later
|
|
30
|
+
* unsubscribe();
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function subscribeEvent(listener) {
|
|
34
|
+
eventSubscribers.push(listener);
|
|
35
|
+
return () => {
|
|
36
|
+
const index = eventSubscribers.indexOf(listener);
|
|
37
|
+
if (index > -1) eventSubscribers.splice(index, 1);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function notifySubscribers(event) {
|
|
41
|
+
eventSubscribers.forEach((listener) => {
|
|
42
|
+
try {
|
|
43
|
+
listener(event);
|
|
44
|
+
} catch (_error) {}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sends an event to the dashboard for tracking.
|
|
49
|
+
* Fire-and-forget: never blocks, never throws.
|
|
50
|
+
* Events are queued if SDK is not configured yet.
|
|
51
|
+
*/
|
|
52
|
+
function addEvent(event) {
|
|
53
|
+
notifySubscribers(event);
|
|
54
|
+
const token = getToken();
|
|
55
|
+
if (!isApiConfigured() || !token) {
|
|
56
|
+
eventsQueue.push(event);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
api.post(endpoints.events, [{
|
|
60
|
+
code: event.code,
|
|
61
|
+
module: event.module,
|
|
62
|
+
screen: event.screen,
|
|
63
|
+
clientTimestamp: event.clientTimestamp ?? getTimestamp(),
|
|
64
|
+
payload: event.payload ?? {}
|
|
65
|
+
}]).catch(() => {});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Flushes any queued events that were sent before SDK was configured.
|
|
69
|
+
* Called automatically by setup() after token is set.
|
|
70
|
+
*/
|
|
71
|
+
function flushEventQueue() {
|
|
72
|
+
if (!isApiConfigured() || !getToken()) return;
|
|
73
|
+
const queuedEvents = [...eventsQueue];
|
|
74
|
+
eventsQueue.length = 0;
|
|
75
|
+
for (const event of queuedEvents) addEvent(event);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/internal/events/helpers.ts
|
|
80
|
+
function screenEvent(params) {
|
|
81
|
+
addEvent({
|
|
82
|
+
code: params.code,
|
|
83
|
+
module: params.module,
|
|
84
|
+
screen: params.screen,
|
|
85
|
+
clientTimestamp: getTimestamp(),
|
|
86
|
+
payload: params.payload
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function moduleOpened(module, screen, payload) {
|
|
90
|
+
screenEvent({
|
|
91
|
+
module,
|
|
92
|
+
screen,
|
|
93
|
+
code: "moduleOpened",
|
|
94
|
+
payload
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function moduleClosed(module, screen, payload) {
|
|
98
|
+
screenEvent({
|
|
99
|
+
module,
|
|
100
|
+
screen,
|
|
101
|
+
code: "moduleClosed",
|
|
102
|
+
payload
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function screenOpened(module, screen, payload) {
|
|
106
|
+
screenEvent({
|
|
107
|
+
module,
|
|
108
|
+
screen,
|
|
109
|
+
code: "screenOpened",
|
|
110
|
+
payload
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function screenClosed(module, screen, payload) {
|
|
114
|
+
screenEvent({
|
|
115
|
+
module,
|
|
116
|
+
screen,
|
|
117
|
+
code: "screenClosed",
|
|
118
|
+
payload
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/internal/events/types.ts
|
|
124
|
+
const eventModuleNames = {
|
|
125
|
+
selfie: "SELFIE",
|
|
126
|
+
authFace: "AUTH_FACE",
|
|
127
|
+
mlConsent: "ML_CONSENT",
|
|
128
|
+
combinedConsent: "COMBINED_CONSENT",
|
|
129
|
+
curpValidation: "CURP_VALIDATION",
|
|
130
|
+
faceMatch: "FACE_MATCH",
|
|
131
|
+
qr: "QR",
|
|
132
|
+
videoSelfie: "VIDEO_ONBOARDING",
|
|
133
|
+
passport: "ID",
|
|
134
|
+
front: "ID",
|
|
135
|
+
back: "ID",
|
|
136
|
+
id: "ID",
|
|
137
|
+
document: "DOCUMENT_CAPTURE",
|
|
138
|
+
creditCard: "CREDIT_CARD_FRONT",
|
|
139
|
+
creditCardBack: "CREDIT_CARD_BACK",
|
|
140
|
+
conference: "CONFERENCE",
|
|
141
|
+
otp: "OTP",
|
|
142
|
+
signature: "SIGNATURE",
|
|
143
|
+
ekyc: "EXTERNAL_VERIFICATION",
|
|
144
|
+
globalWatchList: "GLOBAL_WATCHLIST",
|
|
145
|
+
customWatchList: "CUSTOM_WATCHLIST",
|
|
146
|
+
email: "EMAIL",
|
|
147
|
+
phone: "PHONE",
|
|
148
|
+
instantVerifyEmail: "INSTANT_VERIFY_EMAIL",
|
|
149
|
+
instantVerifyConsent: "INSTANT_VERIFY_CONSENT",
|
|
150
|
+
forms: "FORMS",
|
|
151
|
+
customModule: "CUSTOM_MODULE"
|
|
152
|
+
};
|
|
153
|
+
const eventScreenNames = {
|
|
154
|
+
faceMatch: "FACE_MATCH",
|
|
155
|
+
faceCaptureTutorial: "SELFIE_CAPTURE_TUTORIAL",
|
|
156
|
+
faceCaptureCamera: "SELFIE_CAMERA_CAPTURE",
|
|
157
|
+
faceCaptureError: "SELFIE_ATTEMPT_FAILED",
|
|
158
|
+
faceCaptureSuccess: "SELFIE_UPLOAD_SUCCEEDED",
|
|
159
|
+
faceCaptureUpload: "SELFIE_UPLOAD_PROGRESS",
|
|
160
|
+
mlConsent: "MACHINE_LEARNING_CONSENT",
|
|
161
|
+
combinedConsent: "COMBINED_CONSENT",
|
|
162
|
+
curpEnter: "ENTER_CURP",
|
|
163
|
+
curpValidate: "VALIDATE_CURP",
|
|
164
|
+
curpGenerate: "GENERATE_CURP",
|
|
165
|
+
curpValidation: "CURP_VALIDATION_PROGRESS",
|
|
166
|
+
curpValidationFailed: "CURP_VALIDATION_FAILED",
|
|
167
|
+
curpValidationSuccess: "CURP_VALIDATION_SUCCEEDED",
|
|
168
|
+
qrTutorial: "QR_TUTORIAL",
|
|
169
|
+
qrScan: "QR_SCAN",
|
|
170
|
+
smsOtp: "OTP",
|
|
171
|
+
simpleOTP: "OTP",
|
|
172
|
+
signatureInput: "SIGNATURE_INPUT",
|
|
173
|
+
frontTutorial: "FRONT_ID_CAPTURE_TUTORIAL",
|
|
174
|
+
frontCameraCapture: "FRONT_ID_CAMERA_CAPTURE",
|
|
175
|
+
frontHelp: "FRONT_ID_HELP",
|
|
176
|
+
frontReviewPhoto: "FRONT_ID_REVIEW_PHOTO",
|
|
177
|
+
frontUploadProgress: "FRONT_ID_UPLOAD_PROGRESS",
|
|
178
|
+
frontAttemptFailed: "FRONT_ID_ATTEMPT_FAILED",
|
|
179
|
+
frontUploadSuccess: "FRONT_ID_UPLOAD_SUCCEEDED",
|
|
180
|
+
backTutorial: "BACK_ID_CAPTURE_TUTORIAL",
|
|
181
|
+
backCameraCapture: "BACK_ID_CAMERA_CAPTURE",
|
|
182
|
+
backReviewPhoto: "BACK_ID_REVIEW_PHOTO",
|
|
183
|
+
backUploadProgress: "BACK_ID_UPLOAD_PROGRESS",
|
|
184
|
+
backAttemptFailed: "BACK_ID_ATTEMPT_FAILED",
|
|
185
|
+
backUploadSuccess: "BACK_ID_UPLOAD_SUCCEEDED",
|
|
186
|
+
backHelp: "BACK_ID_HELP",
|
|
187
|
+
passportTutorial: "TUTORIAL_PASSPORT",
|
|
188
|
+
documentTutorial: "DOCUMENT_CAPTURE_TUTORIAL",
|
|
189
|
+
documentCameraCapture: "DOCUMENT_CAMERA_CAPTURE",
|
|
190
|
+
documentHelp: "DOCUMENT_HELP",
|
|
191
|
+
documentReviewPhoto: "DOCUMENT_REVIEW_PHOTO",
|
|
192
|
+
documentUploadProgress: "DOCUMENT_UPLOAD_IN_PROGRESS",
|
|
193
|
+
documentAttemptFailed: "DOCUMENT_ATTEMPT_FAILED",
|
|
194
|
+
documentUploadSuccess: "DOCUMENT_UPLOAD_SUCCEEDED",
|
|
195
|
+
conferenceWait: "CONFERENCE_WAIT",
|
|
196
|
+
conferenceVideoChat: "CONFERENCE_VIDEO_CHAT",
|
|
197
|
+
conferenceMessageChat: "CONFERENCE_MESSAGE_CHAT",
|
|
198
|
+
videoSelfieTutorial: "VIDEO_SELFIE_TUTORIAL",
|
|
199
|
+
videoSelfie: "VIDEO_SELFIE",
|
|
200
|
+
videoSelfieFaceCapture: "VIDEO_SELFIE_FACE_CAPTURE",
|
|
201
|
+
videoSelfieFaceUploadProgress: "VIDEO_SELFIE_FACE_UPLOAD_PROGRESS",
|
|
202
|
+
videoSelfieFaceAttemptFailed: "VIDEO_SELFIE_FACE_ATTEMPT_FAILED",
|
|
203
|
+
videoSelfieFaceUploadSucceeded: "VIDEO_SELFIE_FACE_UPLOAD_SUCCEEDED",
|
|
204
|
+
videoSelfieFrontIdCapture: "VIDEO_SELFIE_FRONT_ID_CAPTURE",
|
|
205
|
+
videoSelfieFrontIdUploadProgress: "VIDEO_SELFIE_FRONT_ID_UPLOAD_PROGRESS",
|
|
206
|
+
videoSelfieFrontIdAttemptFailed: "VIDEO_SELFIE_FRONT_ID_ATTEMPT_FAILED",
|
|
207
|
+
videoSelfieFrontIdUploadSucceeded: "VIDEO_SELFIE_FRONT_ID_UPLOAD_SUCCEEDED",
|
|
208
|
+
videoSelfieBackIdCapture: "VIDEO_SELFIE_BACK_ID_CAPTURE",
|
|
209
|
+
videoSelfieBackIdUploadProgress: "VIDEO_SELFIE_BACK_ID_UPLOAD_PROGRESS",
|
|
210
|
+
videoSelfieBackIdAttemptFailed: "VIDEO_SELFIE_BACK_ID_ATTEMPT_FAILED",
|
|
211
|
+
videoSelfieBackIdUploadSucceeded: "VIDEO_SELFIE_BACK_ID_UPLOAD_SUCCEEDED",
|
|
212
|
+
videoSelfieDocumentCapture: "VIDEO_SELFIE_DOCUMENT_CAPTURE",
|
|
213
|
+
videoSelfieVoiceQuestion: "VIDEO_SELFIE_VOICE_QUESTION",
|
|
214
|
+
videoSelfieVoiceFinalQuestion: "VIDEO_SELFIE_VOICE_FINAL_QUESTION",
|
|
215
|
+
videoSelfieVideoUpload: "VIDEO SELFIE VIDEO UPLOAD",
|
|
216
|
+
ekycInput: "EKYC_INPUT",
|
|
217
|
+
ekycProgress: "EKYC_PROGRESS",
|
|
218
|
+
ekycSucceeded: "EKYC_SUCCEEDED",
|
|
219
|
+
ekycFailed: "EKYC_FAILED",
|
|
220
|
+
forms: "FORMS",
|
|
221
|
+
globalWatchListInput: "GLOBAL_WATCHLIST_INPUT",
|
|
222
|
+
globalWatchListProgress: "GLOBAL_WATCHLIST_PROGRESS",
|
|
223
|
+
globalWatchListSuccess: "GLOBAL_WATCHLIST_SUCCEEDED",
|
|
224
|
+
globalWatchListFailed: "GLOBAL_WATCHLIST_FAILED",
|
|
225
|
+
customWatchListInput: "CUSTOM_WATCHLIST_INPUT",
|
|
226
|
+
customWatchListProgress: "CUSTOM_WATCHLIST_PROGRESS",
|
|
227
|
+
customWatchListSuccess: "CUSTOM_WATCHLIST_SUCCEEDED",
|
|
228
|
+
customWatchListFailed: "CUSTOM_WATCHLIST_FAILED",
|
|
229
|
+
emailInput: "EMAIL_INPUT",
|
|
230
|
+
phoneInput: "PHONE_INPUT",
|
|
231
|
+
instantVerify: "INSTANT_VERIFY",
|
|
232
|
+
authFace: "AUTH_FACE",
|
|
233
|
+
authFaceError: "AUTH_FACE_ATTEMPT_FAILED",
|
|
234
|
+
authFaceUpload: "AUTH_FACE_UPLOAD_PROGRESS",
|
|
235
|
+
authFaceUploadSuccess: "AUTH_FACE_UPLOAD_SUCCEEDED",
|
|
236
|
+
authFaceUploadFailed: "AUTH_FACE_UPLOAD_FAILED",
|
|
237
|
+
customModuleCallback: "CUSTOM_MODULE_CALLBACK",
|
|
238
|
+
customModuleProcessing: "CUSTOM_MODULE_PROCESSING",
|
|
239
|
+
digitalIdFileSelection: "DIGITAL_ID_FILE_SELECTION",
|
|
240
|
+
digitalIdFileReview: "DIGITAL_ID_FILE_REVIEW",
|
|
241
|
+
digitalIdUploadProgress: "DIGITAL_ID_UPLOAD_PROGRESS",
|
|
242
|
+
digitalIdUploadSuccess: "DIGITAL_ID_UPLOAD_SUCCEEDED",
|
|
243
|
+
digitalIdUploadFailed: "DIGITAL_ID_UPLOAD_FAILED",
|
|
244
|
+
digitalIdAnalysisProgress: "DIGITAL_ID_ANALYSIS_PROGRESS",
|
|
245
|
+
digitalIdVerificationSuccess: "DIGITAL_ID_VERIFICATION_SUCCESS",
|
|
246
|
+
digitalIdVerificationFailed: "DIGITAL_ID_VERIFICATION_FAILED"
|
|
247
|
+
};
|
|
248
|
+
const videoSelfieEvents = {
|
|
249
|
+
imageTooBlurry: "imageTooBlurry",
|
|
250
|
+
fillFrame: "fillFrame",
|
|
251
|
+
checkCameraOrLighting: "checkCameraOrLighting",
|
|
252
|
+
frontIdCaptureStarted: "frontIdCaptureStarted",
|
|
253
|
+
lookAtCamera: "lookAtCamera",
|
|
254
|
+
moveCloser: "moveCloser",
|
|
255
|
+
lookingForFrontId: "lookingForFrontId",
|
|
256
|
+
lookingForBackId: "lookingForBackId",
|
|
257
|
+
cameraSwitchToBack: "cameraSwitchToBack",
|
|
258
|
+
cameraSwitchToFront: "cameraSwitchToFront",
|
|
259
|
+
audioStreamOpened: "audioStreamOpened",
|
|
260
|
+
audioStreamClosed: "audioStreamClosed",
|
|
261
|
+
videoSelfieVideoUploadInProgress: "videoSelfieVideoUploadInProgress",
|
|
262
|
+
videoSelfieTosNotAccepted: "videoSelfieTosNotAccepted",
|
|
263
|
+
videoSelfieTosAccepted: "videoSelfieTosAccepted",
|
|
264
|
+
videoSelfieStreamCreated: "videoSelfieStreamCreated",
|
|
265
|
+
videoSelfieStreamDestroyed: "videoSelfieStreamDestroyed",
|
|
266
|
+
videoSelfieReconnecting: "videoSelfieReconnecting",
|
|
267
|
+
videoSelfieReconnected: "videoSelfieReconnected"
|
|
268
|
+
};
|
|
269
|
+
const tutorialScreenNamesMapper = {
|
|
270
|
+
passport: eventScreenNames.passportTutorial,
|
|
271
|
+
front: eventScreenNames.frontTutorial,
|
|
272
|
+
back: eventScreenNames.backTutorial,
|
|
273
|
+
selfie: eventScreenNames.faceCaptureTutorial
|
|
274
|
+
};
|
|
275
|
+
const cameraScreenNamesMapper = {
|
|
276
|
+
front: "front",
|
|
277
|
+
back: "back",
|
|
278
|
+
passport: "passport",
|
|
279
|
+
creditCard: "front",
|
|
280
|
+
creditCardBack: "back",
|
|
281
|
+
document: "document"
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
//#endregion
|
|
285
|
+
export { videoSelfieEvents as a, screenClosed as c, addEvent as d, flushEventQueue as f, tutorialScreenNamesMapper as i, screenEvent as l, revokeObjectURL as m, eventModuleNames as n, moduleClosed as o, subscribeEvent as p, eventScreenNames as r, moduleOpened as s, cameraScreenNamesMapper as t, screenOpened as u };
|
package/dist/flow.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { r as WasmPipeline, t as
|
|
2
|
-
import { t as Manager } from "./Manager-
|
|
3
|
-
import { n as FlowModule, r as FlowModuleConfig, t as Flow } from "./types-BpCrZLU6.js";
|
|
1
|
+
import { a as AnyStateMachine, n as FlowModule, r as FlowModuleConfig, s as WasmPipeline, t as Flow } from "./types-CMR6NkxW.js";
|
|
2
|
+
import { t as Manager } from "./Manager-Co-PsiG9.js";
|
|
4
3
|
|
|
5
4
|
//#region src/modules/flow/flowAnalyzer.d.ts
|
|
6
5
|
|
package/dist/flow.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
1
|
+
import { C as createManager } from "./src-DYtpbFY5.esm.js";
|
|
2
|
+
import { a as fromPromise, i as fromCallback, n as setup, o as createActor, r as assign, t as endpoints } from "./endpoints-BUsSVoJV.esm.js";
|
|
3
|
+
import { t as api } from "./api-DfRLAneb.esm.js";
|
|
3
4
|
|
|
4
5
|
//#region src/modules/flow/flowAnalyzer.ts
|
|
5
6
|
const WASM_MODULE_PIPELINES = {
|
|
@@ -379,22 +380,32 @@ const orchestratedFlowMachine = setup({
|
|
|
379
380
|
})),
|
|
380
381
|
setFlowData: assign(({ event }) => {
|
|
381
382
|
const flow = event.output;
|
|
383
|
+
const flowModules = flow.flowModules ?? [];
|
|
384
|
+
const firstModule = flowModules[0];
|
|
385
|
+
const config = {
|
|
386
|
+
...firstModule?.configuration,
|
|
387
|
+
ds: flow.ds
|
|
388
|
+
};
|
|
382
389
|
return {
|
|
383
390
|
flow,
|
|
384
|
-
steps: (
|
|
385
|
-
currentStepIndex:
|
|
386
|
-
currentStep:
|
|
387
|
-
config
|
|
391
|
+
steps: Object.keys(flowModules),
|
|
392
|
+
currentStepIndex: flowModules.length > 0 ? 0 : -1,
|
|
393
|
+
currentStep: firstModule?.key,
|
|
394
|
+
config
|
|
388
395
|
};
|
|
389
396
|
}),
|
|
390
397
|
setError: assign(({ event }) => ({ error: String(event.error) })),
|
|
391
398
|
incrementStep: assign(({ context }) => {
|
|
392
399
|
const nextIndex = context.currentStepIndex + 1;
|
|
393
400
|
const module = context.flow?.flowModules?.[nextIndex];
|
|
401
|
+
const config = {
|
|
402
|
+
...module?.configuration,
|
|
403
|
+
ds: context.flow?.ds
|
|
404
|
+
};
|
|
394
405
|
return {
|
|
395
406
|
currentStepIndex: nextIndex,
|
|
396
407
|
currentStep: module?.key,
|
|
397
|
-
config
|
|
408
|
+
config
|
|
398
409
|
};
|
|
399
410
|
}),
|
|
400
411
|
setFinishStatus: assign(({ event }) => ({ finishStatus: event.output }))
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region ../infra/src/device/getBrowser.ts
|
|
2
|
+
function getUserAgent() {
|
|
3
|
+
if (typeof navigator === "undefined") return "";
|
|
4
|
+
return navigator.userAgent;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../infra/src/device/getDeviceClass.ts
|
|
9
|
+
function getDeviceInfo() {
|
|
10
|
+
if (typeof navigator === "undefined") return {
|
|
11
|
+
userAgent: "",
|
|
12
|
+
platform: "",
|
|
13
|
+
maxTouchPoints: 0
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
userAgent: navigator.userAgent,
|
|
17
|
+
platform: navigator.platform,
|
|
18
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the current window dimensions.
|
|
23
|
+
* Returns default values (1280x720) in non-browser environments.
|
|
24
|
+
*/
|
|
25
|
+
function getWindowDimensions(defaultWidth = 1280, defaultHeight = 720) {
|
|
26
|
+
if (typeof window === "undefined") return {
|
|
27
|
+
outerWidth: defaultWidth,
|
|
28
|
+
outerHeight: defaultHeight,
|
|
29
|
+
innerWidth: defaultWidth,
|
|
30
|
+
innerHeight: defaultHeight
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
outerWidth: window.outerWidth,
|
|
34
|
+
outerHeight: window.outerHeight,
|
|
35
|
+
innerWidth: window.innerWidth,
|
|
36
|
+
innerHeight: window.innerHeight
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { getWindowDimensions as n, getUserAgent as r, getDeviceInfo as t };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
1
|
+
import { d as addEvent, m as revokeObjectURL, n as eventModuleNames } from "./events-B8ZkhAZo.esm.js";
|
|
2
|
+
import { C as createManager, D as isIOS, E as isDesktop, O as isIPhone14OrHigher, S as stopCameraStream, T as isAndroid, b as enumerateVideoDevices, c as OpenViduRecordingProvider, d as BrowserTimerProvider, h as StreamCanvasCapture, k as isSafari, m as StreamCanvasProcessingSession, n as DEFAULT_ID_CAPTURE_THRESHOLDS, t as DEFAULT_ID_CAPTURE_MODEL_VERSION, v as IncodeCanvas, x as requestCameraAccess, y as applyTrackConstraints } from "./src-DYtpbFY5.esm.js";
|
|
3
|
+
import { n as getWindowDimensions } from "./getDeviceClass-DkfbtsIJ.esm.js";
|
|
4
|
+
import { a as fromPromise, i as fromCallback, n as setup, o as createActor, r as assign, t as endpoints } from "./endpoints-BUsSVoJV.esm.js";
|
|
5
|
+
import { c as getDeviceClass, i as stopRecording$1, n as createRecordingSession, o as checkPermission, r as startRecording, s as requestPermission, t as streamingEvents } from "./streamingEvents-CfEJv3xH.esm.js";
|
|
6
|
+
import { t as api } from "./api-DfRLAneb.esm.js";
|
|
6
7
|
|
|
8
|
+
//#region ../infra/src/capabilities/ITimerCapability.ts
|
|
9
|
+
function sleep(ms) {
|
|
10
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
7
14
|
//#region src/modules/id/idCameraStream.ts
|
|
8
15
|
const BACK_CAMERA_KEYWORDS = [
|
|
9
16
|
"rear",
|
|
@@ -151,9 +158,6 @@ function getAndroidVideoConstraints(level) {
|
|
|
151
158
|
default: return {};
|
|
152
159
|
}
|
|
153
160
|
}
|
|
154
|
-
function delay(ms) {
|
|
155
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
156
|
-
}
|
|
157
161
|
async function getAndroidBackCameraStream(fallbackLevel = 0) {
|
|
158
162
|
if (fallbackLevel > 4) throw new Error("Failed to get camera after all fallback attempts");
|
|
159
163
|
try {
|
|
@@ -180,11 +184,11 @@ async function getAndroidBackCameraStream(fallbackLevel = 0) {
|
|
|
180
184
|
const errorName = error instanceof Error ? error.name : "UnknownError";
|
|
181
185
|
const nextLevel = Math.min(fallbackLevel + 1, 4);
|
|
182
186
|
if (errorName === "NotReadableError") {
|
|
183
|
-
await
|
|
187
|
+
await sleep(300);
|
|
184
188
|
return getAndroidBackCameraStream(nextLevel);
|
|
185
189
|
}
|
|
186
190
|
if (errorName === "AbortError") {
|
|
187
|
-
await
|
|
191
|
+
await sleep(300);
|
|
188
192
|
return getAndroidBackCameraStream(fallbackLevel);
|
|
189
193
|
}
|
|
190
194
|
return getAndroidBackCameraStream(nextLevel);
|
|
@@ -352,7 +356,7 @@ async function uploadIdImage(params) {
|
|
|
352
356
|
const { type, image, onProgress, signal, metadata, ageAssurance, glare, sharpness, shouldSkipGlareBack } = params;
|
|
353
357
|
addEvent({
|
|
354
358
|
code: "captureAttemptFinished",
|
|
355
|
-
module:
|
|
359
|
+
module: eventModuleNames.id,
|
|
356
360
|
payload: { logs: [] }
|
|
357
361
|
});
|
|
358
362
|
const endpoint = type === "front" ? endpoints.frontId : endpoints.backId;
|
|
@@ -428,6 +432,7 @@ async function startRecordingSession(params) {
|
|
|
428
432
|
onSessionConnected: (sessionId) => {
|
|
429
433
|
addEvent({
|
|
430
434
|
code: streamingEvents.strSessionDidConnect,
|
|
435
|
+
module: eventModuleNames.id,
|
|
431
436
|
payload: {
|
|
432
437
|
message: "Recording session connected",
|
|
433
438
|
sessionId
|
|
@@ -437,6 +442,7 @@ async function startRecordingSession(params) {
|
|
|
437
442
|
onSessionDisconnected: (sessionId) => {
|
|
438
443
|
addEvent({
|
|
439
444
|
code: streamingEvents.strSessionDidDisconnect,
|
|
445
|
+
module: eventModuleNames.id,
|
|
440
446
|
payload: {
|
|
441
447
|
message: "Recording session disconnected",
|
|
442
448
|
sessionId
|
|
@@ -446,6 +452,7 @@ async function startRecordingSession(params) {
|
|
|
446
452
|
onSessionException: (event) => {
|
|
447
453
|
addEvent({
|
|
448
454
|
code: streamingEvents.strSessionDidFailWithError,
|
|
455
|
+
module: eventModuleNames.id,
|
|
449
456
|
payload: {
|
|
450
457
|
message: "Recording session failed due to an error",
|
|
451
458
|
eventName: event.name,
|
|
@@ -458,6 +465,7 @@ async function startRecordingSession(params) {
|
|
|
458
465
|
onPublisherCreated: (p) => {
|
|
459
466
|
addEvent({
|
|
460
467
|
code: streamingEvents.strStreamPublisherCreated,
|
|
468
|
+
module: eventModuleNames.id,
|
|
461
469
|
payload: {
|
|
462
470
|
message: "Recording publisher created",
|
|
463
471
|
sessionId: p.sessionId,
|
|
@@ -468,6 +476,7 @@ async function startRecordingSession(params) {
|
|
|
468
476
|
onPublisherError: (p) => {
|
|
469
477
|
addEvent({
|
|
470
478
|
code: streamingEvents.strStreamPublisherDidFailWithError,
|
|
479
|
+
module: eventModuleNames.id,
|
|
471
480
|
payload: {
|
|
472
481
|
message: "Recording publisher failed due to an error",
|
|
473
482
|
sessionId: p.sessionId,
|
|
@@ -486,6 +495,7 @@ async function startRecordingSession(params) {
|
|
|
486
495
|
});
|
|
487
496
|
addEvent({
|
|
488
497
|
code: streamingEvents.strStreamVideoCaptureStart,
|
|
498
|
+
module: eventModuleNames.id,
|
|
489
499
|
payload: {
|
|
490
500
|
message: "Recording capture started",
|
|
491
501
|
resolution,
|
|
@@ -508,6 +518,7 @@ function stopRecording(session) {
|
|
|
508
518
|
try {
|
|
509
519
|
addEvent({
|
|
510
520
|
code: streamingEvents.strStreamVideoCaptureStop,
|
|
521
|
+
module: eventModuleNames.id,
|
|
511
522
|
payload: {
|
|
512
523
|
message: "Recording capture stopped",
|
|
513
524
|
videoRecordingId: session.videoRecordingId,
|
|
@@ -518,6 +529,7 @@ function stopRecording(session) {
|
|
|
518
529
|
await stopRecording$1(session.videoRecordingId);
|
|
519
530
|
addEvent({
|
|
520
531
|
code: streamingEvents.strStreamPublisherDestroyed,
|
|
532
|
+
module: eventModuleNames.id,
|
|
521
533
|
payload: {
|
|
522
534
|
message: "Recording publisher destroyed",
|
|
523
535
|
sessionId: session.sessionId,
|
|
@@ -528,6 +540,7 @@ function stopRecording(session) {
|
|
|
528
540
|
await session.connection.disconnect();
|
|
529
541
|
addEvent({
|
|
530
542
|
code: streamingEvents.strSessionDidDisconnect,
|
|
543
|
+
module: eventModuleNames.id,
|
|
531
544
|
payload: {
|
|
532
545
|
message: "Recording session disconnected",
|
|
533
546
|
sessionId: session.sessionId
|
|
@@ -547,7 +560,7 @@ async function processId(isSecondId = false, queueName = "", signal) {
|
|
|
547
560
|
function getIdErrorCodeFromUnknown(error) {
|
|
548
561
|
if (error instanceof Error) {
|
|
549
562
|
const message = error.message;
|
|
550
|
-
|
|
563
|
+
return Object.values(ID_ERROR_CODES).find((value) => message.includes(value));
|
|
551
564
|
}
|
|
552
565
|
}
|
|
553
566
|
const _idCaptureMachine = setup({
|
|
@@ -580,25 +593,26 @@ const _idCaptureMachine = setup({
|
|
|
580
593
|
let bestCanvas = null;
|
|
581
594
|
let storedQualityElements = {};
|
|
582
595
|
let isCapturing = false;
|
|
596
|
+
const timer = BrowserTimerProvider.getInstance();
|
|
583
597
|
let notificationTimeout = null;
|
|
584
598
|
let currentNotificationStatus = null;
|
|
585
599
|
const NOTIFICATION_DURATION_MS = 500;
|
|
586
600
|
const clearNotificationTimeout = () => {
|
|
587
601
|
if (notificationTimeout) {
|
|
588
|
-
clearTimeout(notificationTimeout);
|
|
602
|
+
timer.clearTimeout(notificationTimeout);
|
|
589
603
|
notificationTimeout = null;
|
|
590
604
|
currentNotificationStatus = null;
|
|
591
605
|
}
|
|
592
606
|
};
|
|
593
607
|
const sendNotification = (status) => {
|
|
594
608
|
if (notificationTimeout && currentNotificationStatus !== status) return;
|
|
595
|
-
if (notificationTimeout && currentNotificationStatus === status) clearTimeout(notificationTimeout);
|
|
609
|
+
if (notificationTimeout && currentNotificationStatus === status) timer.clearTimeout(notificationTimeout);
|
|
596
610
|
currentNotificationStatus = status;
|
|
597
611
|
sendBack({
|
|
598
612
|
type: "DETECTION_UPDATE",
|
|
599
613
|
status
|
|
600
614
|
});
|
|
601
|
-
notificationTimeout = setTimeout(() => {
|
|
615
|
+
notificationTimeout = timer.setTimeout(() => {
|
|
602
616
|
notificationTimeout = null;
|
|
603
617
|
currentNotificationStatus = null;
|
|
604
618
|
sendBack({
|
|
@@ -753,7 +767,7 @@ const _idCaptureMachine = setup({
|
|
|
753
767
|
},
|
|
754
768
|
reset: () => {
|
|
755
769
|
if (notificationTimeout) {
|
|
756
|
-
clearTimeout(notificationTimeout);
|
|
770
|
+
timer.clearTimeout(notificationTimeout);
|
|
757
771
|
notificationTimeout = null;
|
|
758
772
|
currentNotificationStatus = null;
|
|
759
773
|
}
|
|
@@ -790,7 +804,8 @@ const _idCaptureMachine = setup({
|
|
|
790
804
|
glare: input.qualityElements?.glare,
|
|
791
805
|
sharpness: input.qualityElements?.sharpness,
|
|
792
806
|
ageAssurance: false,
|
|
793
|
-
signal
|
|
807
|
+
signal,
|
|
808
|
+
onProgress: input.onProgress
|
|
794
809
|
});
|
|
795
810
|
}),
|
|
796
811
|
processId: fromPromise(async ({ input, signal }) => {
|
|
@@ -814,13 +829,14 @@ const _idCaptureMachine = setup({
|
|
|
814
829
|
});
|
|
815
830
|
return () => {};
|
|
816
831
|
}
|
|
817
|
-
const
|
|
832
|
+
const timer = BrowserTimerProvider.getInstance();
|
|
833
|
+
const interval = timer.setInterval(() => {
|
|
818
834
|
sendBack({
|
|
819
835
|
type: "MOTION_STATUS",
|
|
820
836
|
status: input.motionProvider.check()
|
|
821
837
|
});
|
|
822
838
|
}, 500);
|
|
823
|
-
return () => clearInterval(interval);
|
|
839
|
+
return () => timer.clearInterval(interval);
|
|
824
840
|
})
|
|
825
841
|
},
|
|
826
842
|
actions: {
|
|
@@ -888,6 +904,7 @@ const _idCaptureMachine = setup({
|
|
|
888
904
|
trackTutorialId: () => {
|
|
889
905
|
addEvent({
|
|
890
906
|
code: "tutorialVideoStarted",
|
|
907
|
+
module: eventModuleNames.id,
|
|
891
908
|
payload: { tutorialFrontID: true }
|
|
892
909
|
});
|
|
893
910
|
},
|
|
@@ -934,9 +951,8 @@ const _idCaptureMachine = setup({
|
|
|
934
951
|
if (!canvasWidth || !canvasHeight) return;
|
|
935
952
|
const originalCanvas = canvas;
|
|
936
953
|
let frameRect;
|
|
954
|
+
const { innerWidth: viewportWidth, innerHeight: viewportHeight } = getWindowDimensions();
|
|
937
955
|
if (context.detectionArea) {
|
|
938
|
-
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 1280;
|
|
939
|
-
const viewportHeight = typeof window !== "undefined" ? window.innerHeight : 720;
|
|
940
956
|
const scaleX = viewportWidth / canvasWidth;
|
|
941
957
|
const scaleY = viewportHeight / canvasHeight;
|
|
942
958
|
const scale = Math.max(scaleX, scaleY);
|
|
@@ -951,8 +967,6 @@ const _idCaptureMachine = setup({
|
|
|
951
967
|
h: context.detectionArea.height / scale
|
|
952
968
|
};
|
|
953
969
|
} else if (context.frameRect) {
|
|
954
|
-
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 1280;
|
|
955
|
-
const viewportHeight = typeof window !== "undefined" ? window.innerHeight : 720;
|
|
956
970
|
const scaleX = viewportWidth / canvasWidth;
|
|
957
971
|
const scaleY = viewportHeight / canvasHeight;
|
|
958
972
|
const scale = Math.max(scaleX, scaleY);
|
|
@@ -986,8 +1000,6 @@ const _idCaptureMachine = setup({
|
|
|
986
1000
|
h: maxY - minY
|
|
987
1001
|
};
|
|
988
1002
|
} else {
|
|
989
|
-
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 1280;
|
|
990
|
-
const viewportHeight = typeof window !== "undefined" ? window.innerHeight : 720;
|
|
991
1003
|
const frameViewportWidth = Math.min(387, viewportWidth * .9);
|
|
992
1004
|
const frameViewportHeight = frameViewportWidth / (35 / 22);
|
|
993
1005
|
const frameViewportX = (viewportWidth - frameViewportWidth) / 2;
|
|
@@ -1010,7 +1022,7 @@ const _idCaptureMachine = setup({
|
|
|
1010
1022
|
uploadError: () => void 0,
|
|
1011
1023
|
detectionStatus: () => "idle",
|
|
1012
1024
|
previewImageUrl: ({ context }) => {
|
|
1013
|
-
if (context.previewImageUrl)
|
|
1025
|
+
if (context.previewImageUrl) revokeObjectURL(context.previewImageUrl);
|
|
1014
1026
|
},
|
|
1015
1027
|
uploadProgress: () => void 0
|
|
1016
1028
|
}),
|
|
@@ -1043,12 +1055,7 @@ const _idCaptureMachine = setup({
|
|
|
1043
1055
|
const transformedImage = (context.provider?.getCapturedCanvas())?.getBase64Image(1, true);
|
|
1044
1056
|
let fallbackImage = "";
|
|
1045
1057
|
if ("output" in event) fallbackImage = event.output.originalImage ?? "";
|
|
1046
|
-
const imageData = {
|
|
1047
|
-
imageBase64: transformedImage ?? fallbackImage,
|
|
1048
|
-
blob: new Blob(),
|
|
1049
|
-
url: "",
|
|
1050
|
-
metadata: ""
|
|
1051
|
-
};
|
|
1058
|
+
const imageData = { imageBase64: transformedImage ?? fallbackImage };
|
|
1052
1059
|
if (context.currentMode === "front" || context.currentMode === "passport") return {
|
|
1053
1060
|
...context.capturedImages,
|
|
1054
1061
|
front: imageData
|
|
@@ -1501,13 +1508,19 @@ const _idCaptureMachine = setup({
|
|
|
1501
1508
|
invoke: {
|
|
1502
1509
|
id: "uploadIdImage",
|
|
1503
1510
|
src: "uploadIdImage",
|
|
1504
|
-
input: ({ context }) => {
|
|
1511
|
+
input: ({ context, self }) => {
|
|
1505
1512
|
const canvas = context.provider?.getOriginalCapturedCanvas();
|
|
1506
1513
|
if (!canvas) throw new Error(ID_ERROR_CODES.UPLOAD_ERROR);
|
|
1507
1514
|
return {
|
|
1508
1515
|
canvas,
|
|
1509
1516
|
type: context.currentMode === "back" ? "back" : "front",
|
|
1510
|
-
qualityElements: context.qualityElements
|
|
1517
|
+
qualityElements: context.qualityElements,
|
|
1518
|
+
onProgress: (progress) => {
|
|
1519
|
+
self.send({
|
|
1520
|
+
type: "UPLOAD_PROGRESS",
|
|
1521
|
+
progress
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1511
1524
|
};
|
|
1512
1525
|
},
|
|
1513
1526
|
onDone: {
|
|
@@ -1596,11 +1609,7 @@ const _idCaptureMachine = setup({
|
|
|
1596
1609
|
"stopMediaStream",
|
|
1597
1610
|
"disposeProvider"
|
|
1598
1611
|
],
|
|
1599
|
-
type: "final"
|
|
1600
|
-
on: { RESET: {
|
|
1601
|
-
target: "idle",
|
|
1602
|
-
actions: "resetContext"
|
|
1603
|
-
} }
|
|
1612
|
+
type: "final"
|
|
1604
1613
|
},
|
|
1605
1614
|
closed: {
|
|
1606
1615
|
entry: ["stopMediaStream", "disposeProvider"],
|