@incodetech/core 0.0.0-dev-20260402-682edb5 → 0.0.0-dev-20260402-7cf9db4
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/Actor-phIcsUhv.d.ts +2 -0
- package/dist/BaseWasmProvider-BFXU7jj8.esm.js +1536 -0
- package/dist/BrowserEnvironmentProvider-DApG6lNu.esm.js +89 -0
- package/dist/BrowserTimerProvider-CRhCvln7.esm.js +22 -0
- package/dist/Manager-BndLda4_.d.ts +19 -0
- package/dist/{events-Cc1xUUgF.esm.js → Manager-D_DMzMWz.esm.js} +114 -11
- package/dist/{warmup-CzfSiaMj.d.ts → StateMachine-CGAi8x_b.d.ts} +4 -1
- package/dist/StreamCanvasCapture-9VAzOfOv.esm.js +410 -0
- package/dist/WasmUtilProvider-DctESPCy.esm.js +114 -0
- package/dist/{addressSearch-DzOdaNEA.esm.js → addressSearch-CYGzuJJ3.esm.js} +3 -3
- package/dist/authentication.d.ts +9 -7
- package/dist/authentication.esm.js +12 -10
- package/dist/{authenticationManager-TaI12wf3.d.ts → authenticationManager-B5Yv9bDw.d.ts} +2 -2
- package/dist/{authenticationManager-CBSPCdJc.esm.js → authenticationManager-C9iQ1d2a.esm.js} +5 -5
- package/dist/{backCameraStream-BGAbuvw1.esm.js → backCameraStream-BJwEXNl4.esm.js} +2 -1
- package/dist/camera-D-MPXRbZ.esm.js +22 -0
- package/dist/camera-Dv2WEhGe.d.ts +4 -0
- package/dist/consent.d.ts +55 -54
- package/dist/consent.esm.js +2 -3
- package/dist/curp-validation.d.ts +5 -3
- package/dist/curp-validation.esm.js +2 -3
- package/dist/deepsightLoader-D2MKmB5z.esm.js +48 -0
- package/dist/{deepsightService-DxA--87N.d.ts → deepsightService-CWnhwXLw.d.ts} +223 -17
- package/dist/document-capture.d.ts +58 -56
- package/dist/document-capture.esm.js +5 -4
- package/dist/document-upload.d.ts +47 -45
- package/dist/document-upload.esm.js +5 -4
- package/dist/ekyb.d.ts +3 -2
- package/dist/ekyb.esm.js +8 -7
- package/dist/ekyc.d.ts +3 -2
- package/dist/ekyc.esm.js +133 -123
- package/dist/email.d.ts +3 -2
- package/dist/email.esm.js +4 -4
- package/dist/{emailManager-DN_q_zxy.d.ts → emailManager-BIq6pJa8.d.ts} +11 -4
- package/dist/{emailManager-DSR9gQLX.esm.js → emailManager-C5GCSw78.esm.js} +43 -23
- package/dist/extensibility.d.ts +45 -43
- package/dist/extensibility.esm.js +26 -15
- package/dist/face-match.d.ts +1 -1
- package/dist/face-match.esm.js +2 -3
- package/dist/{faceCaptureManagerFactory-CGpkO_S3.d.ts → faceCaptureManagerFactory-CN5-GRxP.d.ts} +89 -142
- package/dist/{faceCaptureSetup-Rr7LUbBm.esm.js → faceCaptureSetup-DYRykM5Y.esm.js} +413 -7
- package/dist/flow.d.ts +6 -5
- package/dist/flow.esm.js +7 -7
- package/dist/{flowCompletionService-Bkaerugt.esm.js → flowCompletionService-CBvXiMKa.esm.js} +1 -1
- package/dist/{flowServices-Bt6lMLUI.esm.js → flowServices-CQ3rTJLE.esm.js} +2 -2
- package/dist/geolocation.d.ts +2 -1
- package/dist/geolocation.esm.js +16 -3
- package/dist/government-validation.d.ts +2 -1
- package/dist/government-validation.esm.js +3 -3
- package/dist/id.d.ts +9 -6
- package/dist/id.esm.js +14 -11
- package/dist/{idCaptureManager-Dc2NJMy_.d.ts → idCaptureManager-B1RWflj0.d.ts} +15 -12
- package/dist/{idCaptureManager-QyM4nIKM.esm.js → idCaptureManager-D5rjCu9r.esm.js} +178 -8
- package/dist/index.d.ts +68 -21
- package/dist/index.esm.js +440 -11
- package/dist/mandatory-consent.d.ts +58 -56
- package/dist/mandatory-consent.esm.js +2 -3
- package/dist/phone.d.ts +3 -2
- package/dist/phone.esm.js +4 -4
- package/dist/{phoneManager-D2A0hXXq.d.ts → phoneManager-Ba66ysK2.d.ts} +9 -2
- package/dist/{phoneManager-D2nZtu-b.esm.js → phoneManager-CQJim-Ky.esm.js} +32 -21
- package/dist/platform-B3nGssGZ.esm.js +83 -0
- package/dist/redirect-to-mobile.d.ts +2 -1
- package/dist/redirect-to-mobile.esm.js +3 -3
- package/dist/selfie.d.ts +9 -7
- package/dist/selfie.esm.js +12 -10
- package/dist/{selfieManager-B4Nnp7ws.d.ts → selfieManager-BnfnTPcx.d.ts} +2 -2
- package/dist/{selfieManager-CvE35L72.esm.js → selfieManager-DYW1C2GP.esm.js} +4 -3
- package/dist/session-TBPhHmyy.esm.js +3130 -0
- package/dist/session.d.ts +1 -1
- package/dist/session.esm.js +2 -2
- package/dist/signature.d.ts +3 -3
- package/dist/signature.esm.js +3 -4
- package/dist/{stats-D0m3TvIg.esm.js → stats-D4C7iDy1.esm.js} +1 -1
- package/dist/stats.esm.js +2 -2
- package/dist/{types-oveF7RrS.d.ts → types-BWGxcjiZ.d.ts} +1 -1
- package/dist/{types-mQLzH6uw.d.ts → types-BX1ZlbSR.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/deepsightLoader-B93Oa9pS.esm.js +0 -24
- package/dist/deepsightService-CLUMQ5ee.esm.js +0 -235
- package/dist/index-BTaLQSj9.d.ts +0 -219
- package/dist/recordingsRepository-Djt_In2b.esm.js +0 -122
- package/dist/session-CUy9-Yzi.esm.js +0 -250
- package/dist/src-8rn6DoH7.esm.js +0 -6554
- /package/dist/{api-G4JA8CXK.esm.js → api-3fZO5bmj.esm.js} +0 -0
- /package/dist/{browserSimulation-C8gNnn5p.esm.js → browserSimulation-zWJAZ1vA.esm.js} +0 -0
- /package/dist/{displayErrors-BgtBHbfb.d.ts → displayErrors-DzzB3fcR.d.ts} +0 -0
- /package/dist/{flowCompletionService-De8JDo87.d.ts → flowCompletionService-C_CShl_d.d.ts} +0 -0
- /package/dist/{id-B30uqGbp.esm.js → id-Dv0it9CY.esm.js} +0 -0
- /package/dist/{index-LKrIp3Oo.d.ts → index-CuY8tqBC.d.ts} +0 -0
- /package/dist/{lib-qeMam2F_.esm.js → lib-B5byelWf.esm.js} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { a as isIPhone14OrHigher, n as isDesktop, r as isIOS, t as isAndroid } from "./platform-B3nGssGZ.esm.js";
|
|
2
|
+
import { i as IncodeCanvas, l as mlWasmJSApi_default, t as BaseWasmProvider, u as WasmPipelineType } from "./BaseWasmProvider-BFXU7jj8.esm.js";
|
|
3
|
+
import { a as uploadDeepsightVideo, c as requestPermission, i as stopRecording$1, l as StreamCanvasProcessingSession, n as createRecordingSession, o as OpenViduRecordingProvider, p as getDeviceClass, r as startRecording, s as checkPermission, t as StreamCanvasCapture, u as flagFaceManualReview } from "./StreamCanvasCapture-9VAzOfOv.esm.js";
|
|
4
|
+
import { r as getToken, t as api } from "./api-3fZO5bmj.esm.js";
|
|
5
|
+
import { C as fromPromise, S as fromCallback, b as setup, s as createManagerInstrumentation, t as createManager, x as assign } from "./Manager-D_DMzMWz.esm.js";
|
|
6
6
|
import { t as endpoints } from "./endpoints-CCuj1KZH.esm.js";
|
|
7
|
-
import {
|
|
7
|
+
import { i as stopCameraStream, r as requestCameraAccess } from "./camera-D-MPXRbZ.esm.js";
|
|
8
|
+
import { t as addDeviceStats } from "./stats-D4C7iDy1.esm.js";
|
|
9
|
+
import { n as getDesktopCameraStream, t as getBackCameraStream } from "./backCameraStream-BJwEXNl4.esm.js";
|
|
8
10
|
|
|
9
11
|
//#region src/internal/faceCapture/faceCaptureManagerFactory.ts
|
|
10
12
|
function getPermissionStatus(snapshot) {
|
|
@@ -151,6 +153,164 @@ const FACE_ERROR_CODES = {
|
|
|
151
153
|
SELFIE_IMAGE_LOW_QUALITY: "SELFIE_IMAGE_LOW_QUALITY"
|
|
152
154
|
};
|
|
153
155
|
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region ../infra/src/providers/wasm/FaceDetectionProvider.ts
|
|
158
|
+
var FaceDetectionProvider = class extends BaseWasmProvider {
|
|
159
|
+
constructor() {
|
|
160
|
+
super(WasmPipelineType.SelfieWithQualityMetrics);
|
|
161
|
+
this.defaultThresholds = {
|
|
162
|
+
frameMinX: 0,
|
|
163
|
+
frameMinY: 0,
|
|
164
|
+
frameMaxX: 1,
|
|
165
|
+
frameMaxY: 1,
|
|
166
|
+
brightnessThreshold: 50,
|
|
167
|
+
blurrinessThreshold: 50,
|
|
168
|
+
tiltRotationAngleThreshold: 15,
|
|
169
|
+
minMagicCropSize: 200,
|
|
170
|
+
headwearThreshold: .86,
|
|
171
|
+
lensesThreshold: .95,
|
|
172
|
+
closedEyesThreshold: .9,
|
|
173
|
+
maskThreshold: .85,
|
|
174
|
+
minFaceQualityScore: .63,
|
|
175
|
+
faceOcclusionThreshold: .3
|
|
176
|
+
};
|
|
177
|
+
this.currentFrame = null;
|
|
178
|
+
this.bestCanvas = null;
|
|
179
|
+
this.bestFace = null;
|
|
180
|
+
}
|
|
181
|
+
async processFrame(image) {
|
|
182
|
+
this.currentFrame = image;
|
|
183
|
+
await this.processFrameWasm(image);
|
|
184
|
+
}
|
|
185
|
+
async initialize(config) {
|
|
186
|
+
await this.initializeBase(config, "selfie");
|
|
187
|
+
this.applyDefaults(config.autocaptureInterval ?? 0);
|
|
188
|
+
}
|
|
189
|
+
setCallbacks(callbacks) {
|
|
190
|
+
this.ensureInitialized();
|
|
191
|
+
const onBestShotWrapper = (face) => {
|
|
192
|
+
this.bestFace = face;
|
|
193
|
+
if (this.currentFrame) {
|
|
194
|
+
const frameCanvas = IncodeCanvas.fromImageData(this.currentFrame);
|
|
195
|
+
this.bestCanvas = frameCanvas.clone() ?? frameCanvas;
|
|
196
|
+
}
|
|
197
|
+
callbacks.onBestShot?.(face);
|
|
198
|
+
};
|
|
199
|
+
const onCaptureWrapper = () => {
|
|
200
|
+
let frameCanvas = this.bestCanvas;
|
|
201
|
+
if (!frameCanvas && this.currentFrame) frameCanvas = IncodeCanvas.fromImageData(this.currentFrame);
|
|
202
|
+
if (!frameCanvas) return;
|
|
203
|
+
const faceCoordinates = this.bestFace ? this.formatFaceCoordinates(this.bestFace) : this.createDefaultFaceCoordinates(frameCanvas);
|
|
204
|
+
try {
|
|
205
|
+
frameCanvas.updateBase64Image();
|
|
206
|
+
frameCanvas.updateBlob();
|
|
207
|
+
} catch {}
|
|
208
|
+
callbacks.onCapture?.(frameCanvas, faceCoordinates);
|
|
209
|
+
this.bestCanvas = null;
|
|
210
|
+
this.bestFace = null;
|
|
211
|
+
};
|
|
212
|
+
mlWasmJSApi_default.setFaceDetectionCallbacks(this.getPipelineType(), callbacks.onFarAway ?? (() => {}), callbacks.onTooClose ?? (() => {}), callbacks.onTooManyFaces ?? (() => {}), callbacks.onNoFace ?? (() => {}), onCaptureWrapper, callbacks.onGetReady ?? (() => {}), callbacks.onGetReadyFinished ?? (() => {}), callbacks.onCenterFace ?? (() => {}), callbacks.onDark ?? (() => {}), callbacks.onBlur ?? (() => {}), callbacks.onFaceAngle ?? (() => {}), onBestShotWrapper, callbacks.onLenses ?? (() => {}), callbacks.onMask ?? (() => {}), callbacks.onEyesClosed ?? (() => {}), callbacks.onHeadWear ?? (() => {}), callbacks.onSwitchToManualCapture ?? (() => {}), callbacks.onFaceOccluded ?? (() => {}));
|
|
213
|
+
}
|
|
214
|
+
setPositionConstraints(constraints) {
|
|
215
|
+
this.ensureInitialized();
|
|
216
|
+
mlWasmJSApi_default.setFacePositionConstraints(this.getPipelineType(), constraints.minX, constraints.minY, constraints.maxX, constraints.maxY);
|
|
217
|
+
}
|
|
218
|
+
applyDefaults(autocaptureInterval = 0) {
|
|
219
|
+
this.ensureInitialized();
|
|
220
|
+
this.setThresholds({
|
|
221
|
+
brightnessThreshold: this.defaultThresholds.brightnessThreshold,
|
|
222
|
+
blurrinessThreshold: this.defaultThresholds.blurrinessThreshold,
|
|
223
|
+
tiltRotationAngleThreshold: this.defaultThresholds.tiltRotationAngleThreshold,
|
|
224
|
+
minMagicCropSize: this.defaultThresholds.minMagicCropSize,
|
|
225
|
+
autocaptureInterval,
|
|
226
|
+
minFaceQualityScore: this.defaultThresholds.minFaceQualityScore,
|
|
227
|
+
faceOcclusionThreshold: this.defaultThresholds.faceOcclusionThreshold
|
|
228
|
+
});
|
|
229
|
+
this.setPositionConstraints({
|
|
230
|
+
minX: this.defaultThresholds.frameMinX,
|
|
231
|
+
minY: this.defaultThresholds.frameMinY,
|
|
232
|
+
maxX: this.defaultThresholds.frameMaxX,
|
|
233
|
+
maxY: this.defaultThresholds.frameMaxY
|
|
234
|
+
});
|
|
235
|
+
this.setAttributesThresholds({
|
|
236
|
+
headwearThreshold: this.defaultThresholds.headwearThreshold,
|
|
237
|
+
lensesThreshold: this.defaultThresholds.lensesThreshold,
|
|
238
|
+
closedEyesThreshold: this.defaultThresholds.closedEyesThreshold,
|
|
239
|
+
maskThreshold: this.defaultThresholds.maskThreshold
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
setAutocaptureInterval(interval) {
|
|
243
|
+
this.ensureInitialized();
|
|
244
|
+
if (!this.currentThresholds) {
|
|
245
|
+
this.applyDefaults(interval);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.setThresholds({
|
|
249
|
+
...this.currentThresholds,
|
|
250
|
+
autocaptureInterval: interval
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
setThresholds(thresholds) {
|
|
254
|
+
this.ensureInitialized();
|
|
255
|
+
this.currentThresholds = { ...thresholds };
|
|
256
|
+
mlWasmJSApi_default.setFaceDetectionThresholds(this.getPipelineType(), thresholds.brightnessThreshold, thresholds.blurrinessThreshold, thresholds.tiltRotationAngleThreshold, thresholds.minMagicCropSize, thresholds.autocaptureInterval, thresholds.minFaceQualityScore, thresholds.faceOcclusionThreshold);
|
|
257
|
+
}
|
|
258
|
+
setAttributesThresholds(thresholds) {
|
|
259
|
+
this.ensureInitialized();
|
|
260
|
+
mlWasmJSApi_default.setFaceAttributesThresholds(this.getPipelineType(), thresholds.headwearThreshold, thresholds.lensesThreshold, thresholds.closedEyesThreshold, thresholds.maskThreshold);
|
|
261
|
+
}
|
|
262
|
+
setChecksEnabled(config) {
|
|
263
|
+
this.ensureInitialized();
|
|
264
|
+
mlWasmJSApi_default.setFaceChecksEnabled(this.getPipelineType(), config.lenses, config.mask, config.closedEyes, config.headWear, config.occlusion);
|
|
265
|
+
}
|
|
266
|
+
setVideoSelfieMode(enabled) {
|
|
267
|
+
this.ensureInitialized();
|
|
268
|
+
mlWasmJSApi_default.setFaceDetectionMode(this.getPipelineType(), enabled);
|
|
269
|
+
}
|
|
270
|
+
reset() {
|
|
271
|
+
super.reset();
|
|
272
|
+
this.currentFrame = null;
|
|
273
|
+
this.bestCanvas = null;
|
|
274
|
+
this.bestFace = null;
|
|
275
|
+
}
|
|
276
|
+
createDefaultFaceCoordinates(canvas) {
|
|
277
|
+
return {
|
|
278
|
+
rightEyeX: 0,
|
|
279
|
+
rightEyeY: 0,
|
|
280
|
+
leftEyeX: 0,
|
|
281
|
+
leftEyeY: 0,
|
|
282
|
+
noseTipX: 0,
|
|
283
|
+
noseTipY: 0,
|
|
284
|
+
rightMouthX: 0,
|
|
285
|
+
rightMouthY: 0,
|
|
286
|
+
mouthX: 0,
|
|
287
|
+
mouthY: 0,
|
|
288
|
+
x: 0,
|
|
289
|
+
y: 0,
|
|
290
|
+
width: canvas.width() ?? 0,
|
|
291
|
+
height: canvas.height() ?? 0
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
formatFaceCoordinates(face) {
|
|
295
|
+
return {
|
|
296
|
+
rightEyeX: face.rightEye.x,
|
|
297
|
+
rightEyeY: face.rightEye.y,
|
|
298
|
+
leftEyeX: face.leftEye.x,
|
|
299
|
+
leftEyeY: face.leftEye.y,
|
|
300
|
+
noseTipX: face.noseTip.x,
|
|
301
|
+
noseTipY: face.noseTip.y,
|
|
302
|
+
rightMouthX: face.rightMouthCorner.x,
|
|
303
|
+
rightMouthY: face.rightMouthCorner.y,
|
|
304
|
+
mouthX: face.leftMouthCorner.x,
|
|
305
|
+
mouthY: face.leftMouthCorner.y,
|
|
306
|
+
x: face.rect.x,
|
|
307
|
+
y: face.rect.y,
|
|
308
|
+
width: face.rect.width,
|
|
309
|
+
height: face.rect.height
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
154
314
|
//#endregion
|
|
155
315
|
//#region src/modules/selfie/selfieUploadService.ts
|
|
156
316
|
/**
|
|
@@ -383,13 +543,259 @@ async function stopRecording(session) {
|
|
|
383
543
|
}
|
|
384
544
|
}
|
|
385
545
|
async function initializeDeepsightSession(options) {
|
|
386
|
-
const { loadDeepsightSession } = await import("./deepsightLoader-
|
|
546
|
+
const { loadDeepsightSession } = await import("./deepsightLoader-D2MKmB5z.esm.js");
|
|
387
547
|
return loadDeepsightSession({
|
|
388
548
|
ds: options.ds,
|
|
389
549
|
storage: options.storage
|
|
390
550
|
});
|
|
391
551
|
}
|
|
392
552
|
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region ../infra/src/media/VideoTrimmer.ts
|
|
555
|
+
async function getDurationBySeek(videoBlob) {
|
|
556
|
+
const video = document.createElement("video");
|
|
557
|
+
video.preload = "metadata";
|
|
558
|
+
video.src = URL.createObjectURL(videoBlob);
|
|
559
|
+
try {
|
|
560
|
+
if (!Number.isFinite(video.duration)) {
|
|
561
|
+
video.currentTime = Number.MAX_SAFE_INTEGER;
|
|
562
|
+
await new Promise((resolve) => {
|
|
563
|
+
const onDurationChange = () => {
|
|
564
|
+
if (Number.isFinite(video.duration)) {
|
|
565
|
+
video.removeEventListener("durationchange", onDurationChange);
|
|
566
|
+
video.removeEventListener("timeupdate", onTimeUpdate);
|
|
567
|
+
resolve(video.duration);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
const onTimeUpdate = () => {
|
|
571
|
+
if (Number.isFinite(video.duration)) {
|
|
572
|
+
video.removeEventListener("timeupdate", onTimeUpdate);
|
|
573
|
+
video.removeEventListener("durationchange", onDurationChange);
|
|
574
|
+
resolve(video.duration);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
video.addEventListener("durationchange", onDurationChange);
|
|
578
|
+
video.addEventListener("timeupdate", onTimeUpdate);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
const duration = video.duration;
|
|
582
|
+
return Number.isFinite(duration) ? duration : null;
|
|
583
|
+
} finally {
|
|
584
|
+
URL.revokeObjectURL(video.src);
|
|
585
|
+
video.src = "";
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
async function trimLastNSecondsUsingPlayback(videoBlob, seconds) {
|
|
589
|
+
const video = document.createElement("video");
|
|
590
|
+
video.preload = "metadata";
|
|
591
|
+
video.playsInline = true;
|
|
592
|
+
video.muted = true;
|
|
593
|
+
const videoURL = URL.createObjectURL(videoBlob);
|
|
594
|
+
video.src = videoURL;
|
|
595
|
+
const duration = await getDurationBySeek(videoBlob);
|
|
596
|
+
if (!duration || duration < seconds) {
|
|
597
|
+
URL.revokeObjectURL(videoURL);
|
|
598
|
+
return videoBlob;
|
|
599
|
+
}
|
|
600
|
+
const startTime = Math.max(0, Math.floor(duration) - seconds);
|
|
601
|
+
await new Promise((resolve) => {
|
|
602
|
+
if (video.readyState >= 2) resolve();
|
|
603
|
+
else video.addEventListener("loadedmetadata", () => resolve(), { once: true });
|
|
604
|
+
});
|
|
605
|
+
const canvas = document.createElement("canvas");
|
|
606
|
+
canvas.width = 230;
|
|
607
|
+
canvas.height = 320;
|
|
608
|
+
const captureFps = isAndroid() ? 15 : 24;
|
|
609
|
+
const stream = canvas.captureStream(captureFps);
|
|
610
|
+
const ctx = canvas.getContext("2d");
|
|
611
|
+
video.currentTime = startTime;
|
|
612
|
+
await new Promise((resolve) => {
|
|
613
|
+
video.addEventListener("seeked", () => resolve(), { once: true });
|
|
614
|
+
});
|
|
615
|
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
616
|
+
const mimeType = videoBlob.type || (MediaRecorder.isTypeSupported("video/webm") ? "video/webm" : "video/mp4");
|
|
617
|
+
const mediaRecorder = new MediaRecorder(stream.clone(), {
|
|
618
|
+
mimeType,
|
|
619
|
+
videoBitsPerSecond: 5e5,
|
|
620
|
+
bitsPerSecond: 5e5
|
|
621
|
+
});
|
|
622
|
+
const chunks = [];
|
|
623
|
+
mediaRecorder.ondataavailable = (event) => {
|
|
624
|
+
if (event.data.size > 0) chunks.push(event.data);
|
|
625
|
+
};
|
|
626
|
+
const recordingPromise = new Promise((resolve) => {
|
|
627
|
+
mediaRecorder.onstop = () => {
|
|
628
|
+
const trimmedBlob$1 = new Blob(chunks, { type: mimeType });
|
|
629
|
+
URL.revokeObjectURL(videoURL);
|
|
630
|
+
mediaRecorder.stream?.getTracks().forEach((track) => track.stop());
|
|
631
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
632
|
+
video.src = "";
|
|
633
|
+
resolve(trimmedBlob$1);
|
|
634
|
+
};
|
|
635
|
+
});
|
|
636
|
+
video.addEventListener("play", () => {
|
|
637
|
+
function drawVideo() {
|
|
638
|
+
if (video.currentTime >= duration) {
|
|
639
|
+
mediaRecorder.stop();
|
|
640
|
+
video.pause();
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
644
|
+
requestAnimationFrame(drawVideo);
|
|
645
|
+
}
|
|
646
|
+
drawVideo();
|
|
647
|
+
setTimeout(() => {
|
|
648
|
+
mediaRecorder.start(100);
|
|
649
|
+
}, 500);
|
|
650
|
+
});
|
|
651
|
+
video.play().catch(() => {
|
|
652
|
+
URL.revokeObjectURL(videoURL);
|
|
653
|
+
});
|
|
654
|
+
const trimmedBlob = await recordingPromise;
|
|
655
|
+
console.timeEnd("trimLastNSecondsUsingPlayback");
|
|
656
|
+
return trimmedBlob;
|
|
657
|
+
}
|
|
658
|
+
async function trimLastNSeconds(videoBlob, seconds) {
|
|
659
|
+
return await trimLastNSecondsUsingPlayback(videoBlob, seconds);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region ../infra/src/providers/browser/LocalRecordingProvider.ts
|
|
664
|
+
function toBase64(videoBlob) {
|
|
665
|
+
return new Promise((resolve, reject) => {
|
|
666
|
+
const reader = new FileReader();
|
|
667
|
+
reader.onloadend = () => {
|
|
668
|
+
const base64 = reader.result.split(",")[1];
|
|
669
|
+
resolve(base64);
|
|
670
|
+
};
|
|
671
|
+
reader.onerror = () => reject(reader.error ?? /* @__PURE__ */ new Error("FileReader error"));
|
|
672
|
+
reader.readAsDataURL(videoBlob);
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function getSupportedMediaRecorderMimeType() {
|
|
676
|
+
const possibleTypes = isIOS() ? [
|
|
677
|
+
"video/mp4",
|
|
678
|
+
"video/webm",
|
|
679
|
+
"video/webm;codecs=vp9",
|
|
680
|
+
"video/webm;codecs=vp8"
|
|
681
|
+
] : [
|
|
682
|
+
"video/webm",
|
|
683
|
+
"video/webm;codecs=vp9",
|
|
684
|
+
"video/webm;codecs=vp8",
|
|
685
|
+
"video/mp4"
|
|
686
|
+
];
|
|
687
|
+
for (const type of possibleTypes) if (MediaRecorder.isTypeSupported(type)) return type;
|
|
688
|
+
return "";
|
|
689
|
+
}
|
|
690
|
+
function getAdaptiveMediaRecorderOptions() {
|
|
691
|
+
const mimeType = getSupportedMediaRecorderMimeType();
|
|
692
|
+
if (isIOS()) return {
|
|
693
|
+
mimeType,
|
|
694
|
+
videoBitsPerSecond: 1e6,
|
|
695
|
+
bitsPerSecond: 1e6
|
|
696
|
+
};
|
|
697
|
+
return {
|
|
698
|
+
mimeType,
|
|
699
|
+
videoBitsPerSecond: 5e5,
|
|
700
|
+
bitsPerSecond: 5e5
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
var LocalRecordingProvider = class {
|
|
704
|
+
constructor() {
|
|
705
|
+
this.mediaRecorder = null;
|
|
706
|
+
this._isRecording = false;
|
|
707
|
+
this._hasError = false;
|
|
708
|
+
this._error = null;
|
|
709
|
+
this.mimeType = "";
|
|
710
|
+
this.stream = null;
|
|
711
|
+
this.pauseRecordingBound = this.pauseRecording.bind(this);
|
|
712
|
+
}
|
|
713
|
+
get isRecording() {
|
|
714
|
+
return this._isRecording;
|
|
715
|
+
}
|
|
716
|
+
get hasError() {
|
|
717
|
+
return this._hasError;
|
|
718
|
+
}
|
|
719
|
+
get error() {
|
|
720
|
+
return this._error;
|
|
721
|
+
}
|
|
722
|
+
startRecording(stream) {
|
|
723
|
+
this.reset();
|
|
724
|
+
this.registerEventListeners();
|
|
725
|
+
this.stream = stream;
|
|
726
|
+
try {
|
|
727
|
+
const options = getAdaptiveMediaRecorderOptions();
|
|
728
|
+
this.mimeType = options.mimeType;
|
|
729
|
+
const recorder = new MediaRecorder(stream.clone(), options);
|
|
730
|
+
recorder.onerror = (event) => {
|
|
731
|
+
this._error = `Recording error: ${event}`;
|
|
732
|
+
this._isRecording = false;
|
|
733
|
+
this._hasError = true;
|
|
734
|
+
};
|
|
735
|
+
recorder.start();
|
|
736
|
+
this.mediaRecorder = recorder;
|
|
737
|
+
this._isRecording = true;
|
|
738
|
+
this._error = null;
|
|
739
|
+
this._hasError = false;
|
|
740
|
+
} catch (err) {
|
|
741
|
+
this._error = `Failed to start recording: ${err}`;
|
|
742
|
+
this._hasError = true;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
async stopRecording(trimSeconds, encrypt, generateChecksum) {
|
|
746
|
+
const recorder = this.mediaRecorder;
|
|
747
|
+
return new Promise((resolve, reject) => {
|
|
748
|
+
this.removeEventListeners();
|
|
749
|
+
if (recorder && this._isRecording) {
|
|
750
|
+
const chunks = [];
|
|
751
|
+
recorder.ondataavailable = (event) => {
|
|
752
|
+
if (event.data.size > 0) chunks.push(event.data);
|
|
753
|
+
};
|
|
754
|
+
recorder.onstop = async () => {
|
|
755
|
+
try {
|
|
756
|
+
const trimmedVideo = await trimLastNSeconds(new Blob(chunks, { type: this.mimeType }), trimSeconds);
|
|
757
|
+
const encryptedVideoBase64 = encrypt(await toBase64(trimmedVideo));
|
|
758
|
+
generateChecksum(await trimmedVideo.arrayBuffer());
|
|
759
|
+
this._isRecording = false;
|
|
760
|
+
resolve({
|
|
761
|
+
trimmedBlob: trimmedVideo,
|
|
762
|
+
encryptedVideo: encryptedVideoBase64
|
|
763
|
+
});
|
|
764
|
+
} catch (error) {
|
|
765
|
+
this._isRecording = false;
|
|
766
|
+
this._error = `Recording stop failed: ${error}`;
|
|
767
|
+
this._hasError = true;
|
|
768
|
+
reject(error);
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
recorder.stop();
|
|
772
|
+
this._isRecording = false;
|
|
773
|
+
} else resolve({
|
|
774
|
+
trimmedBlob: new Blob([], { type: this.mimeType }),
|
|
775
|
+
encryptedVideo: ""
|
|
776
|
+
});
|
|
777
|
+
recorder?.stream?.getTracks().forEach((track) => track.stop());
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
reset() {
|
|
781
|
+
this._isRecording = false;
|
|
782
|
+
this._error = null;
|
|
783
|
+
this._hasError = false;
|
|
784
|
+
}
|
|
785
|
+
pauseRecording() {
|
|
786
|
+
if (!this._isRecording) return;
|
|
787
|
+
if (this.mediaRecorder?.state === "recording") try {
|
|
788
|
+
this.mediaRecorder.pause();
|
|
789
|
+
} catch {}
|
|
790
|
+
}
|
|
791
|
+
registerEventListeners() {
|
|
792
|
+
document.addEventListener("visibilitychange", this.pauseRecordingBound);
|
|
793
|
+
}
|
|
794
|
+
removeEventListeners() {
|
|
795
|
+
document.removeEventListener("visibilitychange", this.pauseRecordingBound);
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
|
|
393
799
|
//#endregion
|
|
394
800
|
//#region src/internal/faceCapture/recordingService.ts
|
|
395
801
|
/**
|
package/dist/flow.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import
|
|
3
|
-
import "./types-
|
|
4
|
-
import { n as FlowModule, r as FlowModuleConfig, t as Flow } from "./types-
|
|
5
|
-
import {
|
|
1
|
+
import { a as WasmPipeline, t as AnyStateMachine } from "./StateMachine-CGAi8x_b.js";
|
|
2
|
+
import "./camera-Dv2WEhGe.js";
|
|
3
|
+
import "./types-BWGxcjiZ.js";
|
|
4
|
+
import { n as FlowModule, r as FlowModuleConfig, t as Flow } from "./types-BX1ZlbSR.js";
|
|
5
|
+
import { t as Manager } from "./Manager-BndLda4_.js";
|
|
6
|
+
import { n as GetFinishStatusFn, t as FinishStatus } from "./flowCompletionService-C_CShl_d.js";
|
|
6
7
|
|
|
7
8
|
//#region src/modules/flow/flowUtils.d.ts
|
|
8
9
|
|
package/dist/flow.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import "./api-G4JA8CXK.esm.js";
|
|
1
|
+
import "./browserSimulation-zWJAZ1vA.esm.js";
|
|
2
|
+
import "./api-3fZO5bmj.esm.js";
|
|
3
|
+
import { C as fromPromise, S as fromCallback, b as setup, s as createManagerInstrumentation, t as createManager, w as createActor, x as assign } from "./Manager-D_DMzMWz.esm.js";
|
|
5
4
|
import "./endpoints-CCuj1KZH.esm.js";
|
|
6
|
-
import "./session-
|
|
7
|
-
import
|
|
8
|
-
import { t as
|
|
5
|
+
import "./session-TBPhHmyy.esm.js";
|
|
6
|
+
import "./BrowserEnvironmentProvider-DApG6lNu.esm.js";
|
|
7
|
+
import { n as getRequiredWasmPipelines, r as normalizeFlowModules, t as getFlow } from "./flowServices-CQ3rTJLE.esm.js";
|
|
8
|
+
import { t as getFinishStatus } from "./flowCompletionService-CBvXiMKa.esm.js";
|
|
9
9
|
|
|
10
10
|
//#region src/modules/flow/flowStateMachine.ts
|
|
11
11
|
const flowMachine = setup({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as api } from "./api-
|
|
1
|
+
import { t as api } from "./api-3fZO5bmj.esm.js";
|
|
2
2
|
import { t as endpoints } from "./endpoints-CCuj1KZH.esm.js";
|
|
3
|
-
import { i as initializeSession, r as getSessionFingerprintResult } from "./session-
|
|
3
|
+
import { i as initializeSession, r as getSessionFingerprintResult } from "./session-TBPhHmyy.esm.js";
|
|
4
4
|
|
|
5
5
|
//#region src/modules/flow/flowUtils.ts
|
|
6
6
|
const WASM_MODULE_PIPELINES = {
|
package/dist/geolocation.d.ts
CHANGED
package/dist/geolocation.esm.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { r as isIOS, t as isAndroid } from "./platform-B3nGssGZ.esm.js";
|
|
2
|
+
import { t as api } from "./api-3fZO5bmj.esm.js";
|
|
3
|
+
import { C as fromPromise, b as setup, r as eventModuleNames, s as createManagerInstrumentation, t as createManager, w as createActor, x as assign } from "./Manager-D_DMzMWz.esm.js";
|
|
4
4
|
import { t as endpoints } from "./endpoints-CCuj1KZH.esm.js";
|
|
5
5
|
|
|
6
|
+
//#region ../infra/src/providers/browser/BrowserGeolocationProvider.ts
|
|
7
|
+
var BrowserGeolocationProvider = class {
|
|
8
|
+
getCurrentPosition() {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
navigator.geolocation.getCurrentPosition((pos) => resolve({
|
|
11
|
+
latitude: pos.coords.latitude,
|
|
12
|
+
longitude: pos.coords.longitude
|
|
13
|
+
}), reject);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
6
19
|
//#region src/modules/geolocation/geolocationServices.ts
|
|
7
20
|
async function addGeolocation(params, signal) {
|
|
8
21
|
const res = await api.post(endpoints.addGeolocation, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as api } from "./api-G4JA8CXK.esm.js";
|
|
1
|
+
import { t as api } from "./api-3fZO5bmj.esm.js";
|
|
2
|
+
import { C as fromPromise, S as fromCallback, b as setup, s as createManagerInstrumentation, t as createManager, w as createActor, x as assign } from "./Manager-D_DMzMWz.esm.js";
|
|
4
3
|
import { t as endpoints } from "./endpoints-CCuj1KZH.esm.js";
|
|
4
|
+
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-CRhCvln7.esm.js";
|
|
5
5
|
|
|
6
6
|
//#region src/modules/government-validation/governmentValidationServices.ts
|
|
7
7
|
async function processGovernmentValidation(signal) {
|
package/dist/id.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
1
|
+
import "./StateMachine-CGAi8x_b.js";
|
|
2
|
+
import "./Actor-phIcsUhv.js";
|
|
3
|
+
import { c as PermissionResult, l as PermissionStatus } from "./deepsightService-CWnhwXLw.js";
|
|
4
|
+
import { A as IdCaptureEvent, B as UploadIdResponse, C as CapturedImage, D as IdCaptureConfig, E as ID_ERROR_CODES, F as IdDocumentType, H as IdCaptureSettings, I as IdError, L as IdErrorCode, M as IdCaptureInput, N as IdCaptureMode, O as IdCaptureContext, P as IdCaptureThresholds, R as IdFlowStep, S as CaptureIdResponse, T as DetectionStatus, V as DetectionOrientation, _ as CreateIdCaptureActorOptions, a as IdCaptureInitResult, b as IdCaptureMachine, c as UploadIdImageParams, d as processId, f as startRecordingSession, g as validateUploadResponse, h as uploadIdImage, j as IdCaptureGeometry, k as IdCaptureDependencies, l as ValidationError, m as stopStream, n as IdCaptureState, o as InitializeIdCaptureParams, p as stopRecording, r as createIdCaptureManager, s as StartRecordingParams, t as IdCaptureManager, u as initializeIdCapture, v as IdCaptureActor, w as DetectionArea, x as idCaptureMachine, y as createIdCaptureActor, z as RecordingSession } from "./idCaptureManager-B1RWflj0.js";
|
|
5
|
+
import { t as CameraStream } from "./camera-Dv2WEhGe.js";
|
|
6
|
+
import "./types-BWGxcjiZ.js";
|
|
7
|
+
import "./types-BX1ZlbSR.js";
|
|
8
|
+
import "./Manager-BndLda4_.js";
|
|
9
|
+
import "./index-CuY8tqBC.js";
|
|
7
10
|
export { CameraStream, CaptureIdResponse, CapturedImage, CreateIdCaptureActorOptions, DetectionArea, DetectionOrientation, DetectionStatus, ID_ERROR_CODES, IdCaptureActor, IdCaptureConfig, IdCaptureContext, IdCaptureDependencies, IdCaptureEvent, IdCaptureGeometry, IdCaptureInitResult, IdCaptureInput, IdCaptureMachine, IdCaptureManager, IdCaptureMode, IdCaptureSettings, IdCaptureState, IdCaptureThresholds, IdDocumentType, IdError, IdErrorCode, IdFlowStep, InitializeIdCaptureParams, PermissionResult, PermissionStatus, RecordingSession, StartRecordingParams, UploadIdImageParams, UploadIdResponse, ValidationError, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, validateUploadResponse };
|
package/dist/id.esm.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
1
|
+
import "./platform-B3nGssGZ.esm.js";
|
|
2
|
+
import "./BaseWasmProvider-BFXU7jj8.esm.js";
|
|
3
|
+
import "./StreamCanvasCapture-9VAzOfOv.esm.js";
|
|
4
|
+
import "./browserSimulation-zWJAZ1vA.esm.js";
|
|
5
|
+
import "./api-3fZO5bmj.esm.js";
|
|
6
|
+
import "./Manager-D_DMzMWz.esm.js";
|
|
7
7
|
import "./endpoints-CCuj1KZH.esm.js";
|
|
8
|
-
import "./session-
|
|
9
|
-
import
|
|
10
|
-
import "./
|
|
11
|
-
import "./
|
|
12
|
-
import "./
|
|
8
|
+
import "./session-TBPhHmyy.esm.js";
|
|
9
|
+
import "./BrowserEnvironmentProvider-DApG6lNu.esm.js";
|
|
10
|
+
import { a as initializeIdCapture, c as stopRecording, d as validateUploadResponse, f as ID_ERROR_CODES, i as idCaptureMachine, l as stopStream, o as processId, r as createIdCaptureActor, s as startRecordingSession, t as createIdCaptureManager, u as uploadIdImage } from "./idCaptureManager-D5rjCu9r.esm.js";
|
|
11
|
+
import "./BrowserTimerProvider-CRhCvln7.esm.js";
|
|
12
|
+
import "./camera-D-MPXRbZ.esm.js";
|
|
13
|
+
import "./stats-D4C7iDy1.esm.js";
|
|
14
|
+
import "./backCameraStream-BJwEXNl4.esm.js";
|
|
15
|
+
import "./id-Dv0it9CY.esm.js";
|
|
13
16
|
|
|
14
17
|
export { ID_ERROR_CODES, createIdCaptureActor, createIdCaptureManager, idCaptureMachine, initializeIdCapture, processId, startRecordingSession, stopRecording, stopStream, uploadIdImage, validateUploadResponse };
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
1
|
+
import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-CGAi8x_b.js";
|
|
2
|
+
import { t as ActorRefFrom } from "./Actor-phIcsUhv.js";
|
|
3
|
+
import { a as StreamCanvasCapture, c as PermissionResult, d as RecordingConnection, f as IMLProviderCapability, l as PermissionStatus, m as IncodeCanvas, o as IStorageCapability, p as MLProviderConfig, s as IMotionSensorCapability, t as DeepsightService, u as IRecordingCapability } from "./deepsightService-CWnhwXLw.js";
|
|
4
|
+
import { t as CameraStream } from "./camera-Dv2WEhGe.js";
|
|
5
|
+
import { a as TutorialIdConfig, i as RegulationTypes, t as Flow } from "./types-BX1ZlbSR.js";
|
|
6
|
+
import { t as Manager } from "./Manager-BndLda4_.js";
|
|
4
7
|
|
|
5
|
-
//#region ../infra/src/capabilities/IAnalyticsCapability.d.ts
|
|
6
|
-
interface IAnalyticsCapability {
|
|
7
|
-
analyzeFrame(image: ImageData): Promise<void>;
|
|
8
|
-
update(): void;
|
|
9
|
-
getAnalysisStatus(): string;
|
|
10
|
-
getMotionStatus(): string;
|
|
11
|
-
getMetadata(): string;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
8
|
//#region ../infra/src/capabilities/IIdCaptureCapability.d.ts
|
|
15
9
|
/**
|
|
16
10
|
* Configuration for ID capture provider.
|
|
@@ -160,6 +154,15 @@ interface IIdCaptureCapability extends IMLProviderCapability<IdCaptureConfig$1>
|
|
|
160
154
|
setCapturedCanvases(original: IncodeCanvas, transformed: IncodeCanvas): void;
|
|
161
155
|
}
|
|
162
156
|
//#endregion
|
|
157
|
+
//#region ../infra/src/capabilities/IAnalyticsCapability.d.ts
|
|
158
|
+
interface IAnalyticsCapability {
|
|
159
|
+
analyzeFrame(image: ImageData): Promise<void>;
|
|
160
|
+
update(): void;
|
|
161
|
+
getAnalysisStatus(): string;
|
|
162
|
+
getMotionStatus(): string;
|
|
163
|
+
getMetadata(): string;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
163
166
|
//#region src/modules/id/types.d.ts
|
|
164
167
|
type IdCaptureMode = 'front' | 'back' | 'passport';
|
|
165
168
|
/**
|