@incodetech/core 2.0.0-alpha.10 → 2.0.0-alpha.12
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-CQyDxBvM.esm.js → OpenViduLogger-CRbRNZA7.esm.js} +1 -1
- package/dist/OpenViduLogger-Dy5P806a.esm.js +3 -0
- package/dist/{warmup-CEJTfxQr.d.ts → StateMachine-pi8byl8C.d.ts} +4 -1
- package/dist/{addEvent-W0ORK0jT.esm.js → addEvent-BGKc_lHF.esm.js} +1 -1
- package/dist/deepsightLoader-B36_XZ7r.esm.js +25 -0
- package/dist/deepsightService-BWxcc4OC.esm.js +225 -0
- package/dist/email.d.ts +1 -1
- package/dist/email.esm.js +3 -3
- package/dist/{endpoints-BSTFaHYo.esm.js → endpoints-D9TGnxRK.esm.js} +966 -22
- package/dist/flow.d.ts +4 -303
- package/dist/flow.esm.js +4 -5
- package/dist/id-CJKLe8HS.esm.js +1818 -0
- package/dist/id.d.ts +6 -0
- package/dist/id.esm.js +8 -0
- package/dist/index-CbF_uI-x.d.ts +618 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.esm.js +7 -3
- package/dist/{lib-Bu9XGMBW.esm.js → lib-BJoLTN_W.esm.js} +2 -2
- package/dist/phone.d.ts +1 -1
- package/dist/phone.esm.js +3 -3
- package/dist/recordingsRepository-D5MURoVB.esm.js +40 -0
- package/dist/selfie.d.ts +77 -317
- package/dist/selfie.esm.js +165 -62
- package/dist/{permissionServices-I6vX6DBy.esm.js → streamingEvents-B3hNanPl.esm.js} +34 -9
- package/dist/types-BpCrZLU6.d.ts +302 -0
- package/dist/types-DZbrbPgj.d.ts +335 -0
- package/package.json +6 -2
- package/dist/OpenViduLogger-BdPfiZO6.esm.js +0 -3
- package/dist/StateMachine-DRE1oH2B.d.ts +0 -2
- package/dist/types-iZi2rawo.d.ts +0 -5
- /package/dist/{Manager-BGfxEmyv.d.ts → Manager-BZUZTRPx.d.ts} +0 -0
- /package/dist/{chunk-C_Yo44FK.esm.js → chunk-FbsBJI8u.esm.js} +0 -0
- /package/dist/{xstate.esm-B_rda9yU.esm.js → xstate.esm-2hDiAXvZ.esm.js} +0 -0
package/dist/selfie.esm.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
import { E as createManager, T as stopCameraStream, f as FaceDetectionProvider, h as OpenViduRecordingProvider, i as getToken, n as api, t as endpoints, u as WasmUtilProvider, v as StreamCanvasProcessingSession, w as requestCameraAccess, y as StreamCanvasCapture } from "./endpoints-D9TGnxRK.esm.js";
|
|
2
|
+
import { n as startRecording, r as stopRecording$1, t as createRecordingSession } from "./recordingsRepository-D5MURoVB.esm.js";
|
|
3
|
+
import { i as getDeviceClass, n as checkPermission, r as requestPermission, t as streamingEvents } from "./streamingEvents-B3hNanPl.esm.js";
|
|
4
|
+
import { a as createActor, i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-2hDiAXvZ.esm.js";
|
|
5
|
+
import { t as addEvent } from "./addEvent-BGKc_lHF.esm.js";
|
|
6
|
+
import "./deepsightService-BWxcc4OC.esm.js";
|
|
5
7
|
|
|
6
8
|
//#region src/modules/selfie/types.ts
|
|
7
9
|
const FACE_ERROR_CODES = {
|
|
@@ -55,53 +57,25 @@ const validateUploadResponse = ({ config, response }) => {
|
|
|
55
57
|
if (config.validateHeadCover && response.hasHeadCover) return FACE_ERROR_CODES.HEAD_COVER;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/internal/recordings/recordingsRepository.ts
|
|
60
|
-
async function createRecordingSession(type) {
|
|
61
|
-
return (await api.post(endpoints.recordingCreateSessionV2, { type })).data;
|
|
62
|
-
}
|
|
63
|
-
async function startRecording(params) {
|
|
64
|
-
return (await api.post(endpoints.recordingStartV2, {
|
|
65
|
-
videoRecordingId: params.videoRecordingId,
|
|
66
|
-
frameRate: 30,
|
|
67
|
-
outputMode: "COMPOSED",
|
|
68
|
-
resolution: params.resolution,
|
|
69
|
-
type: params.type,
|
|
70
|
-
hasAudio: params.hasAudio ?? false
|
|
71
|
-
})).data;
|
|
72
|
-
}
|
|
73
|
-
async function stopRecording$1(videoRecordingId) {
|
|
74
|
-
return (await api.post(endpoints.recordingStopV2, { videoRecordingId })).data;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/internal/recordings/streamingEvents.ts
|
|
79
|
-
const streamingEvents = {
|
|
80
|
-
strSessionDidConnect: "strSessionDidConnect",
|
|
81
|
-
strSessionDidDisconnect: "strSessionDidDisconnect",
|
|
82
|
-
strSessionDidFailWithError: "strSessionDidFailWithError",
|
|
83
|
-
strStreamVideoCaptureStart: "strStreamVideoCaptureStart",
|
|
84
|
-
strStreamVideoCaptureStop: "strStreamVideoCaptureStop",
|
|
85
|
-
strStreamPublisherCreated: "strStreamPublisherCreated",
|
|
86
|
-
strStreamPublisherDestroyed: "strStreamPublisherDestroyed",
|
|
87
|
-
strStreamPublisherDidFailWithError: "strStreamPublisherDidFailWithError"
|
|
88
|
-
};
|
|
89
|
-
|
|
90
60
|
//#endregion
|
|
91
61
|
//#region src/modules/selfie/selfieUploadService.ts
|
|
92
62
|
/**
|
|
93
63
|
* Uploads a selfie image to the backend.
|
|
94
64
|
*/
|
|
95
|
-
async function uploadSelfie({ encryptedBase64Image, faceCoordinates, signal }) {
|
|
65
|
+
async function uploadSelfie({ encryptedBase64Image, faceCoordinates, signal, metadata, recordingId }) {
|
|
96
66
|
try {
|
|
97
|
-
const
|
|
67
|
+
const payload = {
|
|
98
68
|
base64Image: encryptedBase64Image,
|
|
99
69
|
faceCoordinates: faceCoordinates ?? void 0,
|
|
100
70
|
encrypted: true,
|
|
101
|
-
clientInfo: { deviceClass: getDeviceClass() }
|
|
102
|
-
|
|
71
|
+
clientInfo: { deviceClass: getDeviceClass() },
|
|
72
|
+
metadata: metadata ?? void 0
|
|
73
|
+
};
|
|
74
|
+
const query = { imageType: "selfie" };
|
|
75
|
+
if (recordingId) query.recordingId = recordingId;
|
|
76
|
+
const res = await api.post(endpoints.selfie, payload, {
|
|
103
77
|
signal,
|
|
104
|
-
query
|
|
78
|
+
query
|
|
105
79
|
});
|
|
106
80
|
if (!res.ok) throw new Error(`POST ${endpoints.selfie} failed: ${res.status} ${res.statusText}`);
|
|
107
81
|
return res.data;
|
|
@@ -127,6 +101,12 @@ const getFaceErrorCodeFromHttpError = (error) => {
|
|
|
127
101
|
4078: FACE_ERROR_CODES.FACE_OCCLUDED
|
|
128
102
|
}[err.data.status] ?? FACE_ERROR_CODES.BAD_REQUEST;
|
|
129
103
|
};
|
|
104
|
+
async function processFace(imageType = "selfie", signal) {
|
|
105
|
+
return (await api.post(endpoints.processFace, {}, {
|
|
106
|
+
query: { imageType },
|
|
107
|
+
signal
|
|
108
|
+
})).data;
|
|
109
|
+
}
|
|
130
110
|
|
|
131
111
|
//#endregion
|
|
132
112
|
//#region src/modules/selfie/selfieServices.ts
|
|
@@ -249,6 +229,7 @@ function buildResolutionFromStream(stream) {
|
|
|
249
229
|
if (typeof width === "number" && typeof height === "number") return `${width}x${height}`;
|
|
250
230
|
}
|
|
251
231
|
async function startRecordingSession(params) {
|
|
232
|
+
if (params.config.deepsightLiveness === "VIDEOLIVENESS") return;
|
|
252
233
|
if (params.config.enableFaceRecording !== true) return;
|
|
253
234
|
if (params.existing) return params.existing;
|
|
254
235
|
const provider = params.config.recording?.capability ?? new OpenViduRecordingProvider();
|
|
@@ -371,6 +352,11 @@ function stopRecording(session) {
|
|
|
371
352
|
}
|
|
372
353
|
})();
|
|
373
354
|
}
|
|
355
|
+
async function initializeDeepsightSession(config) {
|
|
356
|
+
if (config.deepsightLiveness !== "VIDEOLIVENESS") return;
|
|
357
|
+
const { loadDeepsightSession } = await import("./deepsightLoader-B36_XZ7r.esm.js");
|
|
358
|
+
return loadDeepsightSession();
|
|
359
|
+
}
|
|
374
360
|
|
|
375
361
|
//#endregion
|
|
376
362
|
//#region src/modules/selfie/selfieStateMachine.ts
|
|
@@ -422,10 +408,26 @@ const _selfieMachine = setup({
|
|
|
422
408
|
});
|
|
423
409
|
return cleanup;
|
|
424
410
|
}),
|
|
411
|
+
initializeDeepsightSession: fromPromise(async ({ input }) => {
|
|
412
|
+
return await initializeDeepsightSession(input.config);
|
|
413
|
+
}),
|
|
425
414
|
uploadSelfie: fromPromise(async ({ input, signal }) => {
|
|
415
|
+
let metadata;
|
|
416
|
+
let recordingId = null;
|
|
417
|
+
if (input.deepsightService) {
|
|
418
|
+
const imageData = input.canvas.getImageData();
|
|
419
|
+
const sessionToken = getToken();
|
|
420
|
+
if (imageData && sessionToken) {
|
|
421
|
+
const result = await input.deepsightService.performCapture(sessionToken, imageData);
|
|
422
|
+
metadata = result.metadata;
|
|
423
|
+
recordingId = result.recordingId;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
426
|
return uploadSelfie({
|
|
427
427
|
encryptedBase64Image: await encryptSelfieImage({ canvas: input.canvas }),
|
|
428
428
|
faceCoordinates: input.faceCoordinates,
|
|
429
|
+
metadata,
|
|
430
|
+
recordingId,
|
|
429
431
|
signal
|
|
430
432
|
});
|
|
431
433
|
}),
|
|
@@ -436,6 +438,9 @@ const _selfieMachine = setup({
|
|
|
436
438
|
clonedStream: input.clonedStream,
|
|
437
439
|
existing: input.existing
|
|
438
440
|
});
|
|
441
|
+
}),
|
|
442
|
+
processFace: fromPromise(async ({ signal }) => {
|
|
443
|
+
return processFace("selfie", signal);
|
|
439
444
|
})
|
|
440
445
|
},
|
|
441
446
|
actions: {
|
|
@@ -479,12 +484,14 @@ const _selfieMachine = setup({
|
|
|
479
484
|
capturedImage: void 0,
|
|
480
485
|
faceCoordinates: void 0,
|
|
481
486
|
uploadResponse: void 0,
|
|
487
|
+
processResponse: void 0,
|
|
482
488
|
recordingSession: void 0,
|
|
483
489
|
recordingStream: void 0,
|
|
484
490
|
attemptsRemaining: context.config.captureAttempts,
|
|
485
491
|
uploadError: void 0,
|
|
486
492
|
permissionResult: void 0,
|
|
487
|
-
resetDetection: void 0
|
|
493
|
+
resetDetection: void 0,
|
|
494
|
+
deepsightService: void 0
|
|
488
495
|
})),
|
|
489
496
|
resetDetection: ({ context }) => {
|
|
490
497
|
context.resetDetection?.();
|
|
@@ -520,6 +527,20 @@ const _selfieMachine = setup({
|
|
|
520
527
|
} }),
|
|
521
528
|
stopRecordingStream: ({ context }) => {
|
|
522
529
|
if (context.recordingStream) stopStream(context.recordingStream);
|
|
530
|
+
},
|
|
531
|
+
startDeepsightRecording: ({ context }) => {
|
|
532
|
+
if (context.deepsightService && context.stream) context.deepsightService.startRecording(context.stream);
|
|
533
|
+
},
|
|
534
|
+
checkVirtualCamera: ({ context }) => {
|
|
535
|
+
(async () => {
|
|
536
|
+
if (context.deepsightService && context.stream) {
|
|
537
|
+
const videoTrack = context.stream.getVideoTracks()[0];
|
|
538
|
+
if (videoTrack) await context.deepsightService.checkVirtualCamera(videoTrack);
|
|
539
|
+
}
|
|
540
|
+
})();
|
|
541
|
+
},
|
|
542
|
+
cleanupDeepsight: ({ context }) => {
|
|
543
|
+
context.deepsightService?.cleanup();
|
|
523
544
|
}
|
|
524
545
|
},
|
|
525
546
|
guards: {
|
|
@@ -536,6 +557,7 @@ const _selfieMachine = setup({
|
|
|
536
557
|
return false;
|
|
537
558
|
},
|
|
538
559
|
hasStream: ({ context }) => context.stream !== void 0,
|
|
560
|
+
isCameraAndDeepsightReady: ({ context }) => context.stream !== void 0 && (context.config.deepsightLiveness !== "VIDEOLIVENESS" || context.deepsightService !== void 0),
|
|
539
561
|
hasAttemptsRemaining: ({ context }) => context.attemptsRemaining > 0,
|
|
540
562
|
hasCapturedImage: ({ context }) => context.capturedImage !== void 0,
|
|
541
563
|
hasUploadValidationError: ({ context }) => validateUploadResponse({
|
|
@@ -557,12 +579,14 @@ const _selfieMachine = setup({
|
|
|
557
579
|
capturedImage: void 0,
|
|
558
580
|
faceCoordinates: void 0,
|
|
559
581
|
uploadResponse: void 0,
|
|
582
|
+
processResponse: void 0,
|
|
560
583
|
recordingSession: void 0,
|
|
561
584
|
recordingStream: void 0,
|
|
562
585
|
attemptsRemaining: input.config.captureAttempts,
|
|
563
586
|
uploadError: void 0,
|
|
564
587
|
permissionResult: void 0,
|
|
565
|
-
resetDetection: void 0
|
|
588
|
+
resetDetection: void 0,
|
|
589
|
+
deepsightService: void 0
|
|
566
590
|
}),
|
|
567
591
|
on: { QUIT: { target: "#selfie.closed" } },
|
|
568
592
|
states: {
|
|
@@ -570,7 +594,7 @@ const _selfieMachine = setup({
|
|
|
570
594
|
target: "tutorial",
|
|
571
595
|
guard: "hasShowTutorial"
|
|
572
596
|
}, { target: "loading" }] } },
|
|
573
|
-
loading: { invoke: {
|
|
597
|
+
loading: { invoke: [{
|
|
574
598
|
id: "checkPermissionLoading",
|
|
575
599
|
src: "checkPermission",
|
|
576
600
|
onDone: [{
|
|
@@ -581,7 +605,13 @@ const _selfieMachine = setup({
|
|
|
581
605
|
target: "permissions",
|
|
582
606
|
actions: assign({ permissionResult: ({ event }) => event.output })
|
|
583
607
|
}]
|
|
584
|
-
}
|
|
608
|
+
}, {
|
|
609
|
+
id: "loadingInitDeepsight",
|
|
610
|
+
src: "initializeDeepsightSession",
|
|
611
|
+
input: ({ context }) => ({ config: context.config }),
|
|
612
|
+
onDone: { actions: assign({ deepsightService: ({ event }) => event.output }) },
|
|
613
|
+
onError: { actions: () => void 0 }
|
|
614
|
+
}] },
|
|
585
615
|
tutorial: {
|
|
586
616
|
initial: "checkingPermission",
|
|
587
617
|
entry: "trackTutorialSelfie",
|
|
@@ -600,7 +630,7 @@ const _selfieMachine = setup({
|
|
|
600
630
|
} },
|
|
601
631
|
initializingCamera: {
|
|
602
632
|
initial: "booting",
|
|
603
|
-
invoke: {
|
|
633
|
+
invoke: [{
|
|
604
634
|
id: "tutorialInitCamera",
|
|
605
635
|
src: "initializeCamera",
|
|
606
636
|
input: ({ context }) => context.config,
|
|
@@ -613,12 +643,18 @@ const _selfieMachine = setup({
|
|
|
613
643
|
target: "ready",
|
|
614
644
|
actions: assign({ error: ({ event }) => String(event.error) })
|
|
615
645
|
}]
|
|
616
|
-
},
|
|
646
|
+
}, {
|
|
647
|
+
id: "tutorialInitDeepsight",
|
|
648
|
+
src: "initializeDeepsightSession",
|
|
649
|
+
input: ({ context }) => ({ config: context.config }),
|
|
650
|
+
onDone: { actions: assign({ deepsightService: ({ event }) => event.output }) },
|
|
651
|
+
onError: { actions: () => void 0 }
|
|
652
|
+
}],
|
|
617
653
|
states: {
|
|
618
654
|
booting: {
|
|
619
655
|
always: [{
|
|
620
656
|
target: "#tutorialCameraReady",
|
|
621
|
-
guard: "
|
|
657
|
+
guard: "isCameraAndDeepsightReady"
|
|
622
658
|
}],
|
|
623
659
|
on: { NEXT_STEP: {
|
|
624
660
|
target: "waitingForStream",
|
|
@@ -627,7 +663,7 @@ const _selfieMachine = setup({
|
|
|
627
663
|
},
|
|
628
664
|
waitingForStream: { always: [{
|
|
629
665
|
target: "#selfie.capture",
|
|
630
|
-
guard: "
|
|
666
|
+
guard: "isCameraAndDeepsightReady"
|
|
631
667
|
}] }
|
|
632
668
|
}
|
|
633
669
|
},
|
|
@@ -638,10 +674,29 @@ const _selfieMachine = setup({
|
|
|
638
674
|
actions: "trackContinue"
|
|
639
675
|
} }
|
|
640
676
|
},
|
|
641
|
-
ready: {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
677
|
+
ready: {
|
|
678
|
+
initial: "idle",
|
|
679
|
+
states: {
|
|
680
|
+
idle: { always: [{
|
|
681
|
+
target: "initializingDeepsight",
|
|
682
|
+
guard: ({ context }) => context.config.deepsightLiveness === "VIDEOLIVENESS"
|
|
683
|
+
}, { target: "readyForNext" }] },
|
|
684
|
+
initializingDeepsight: { invoke: {
|
|
685
|
+
id: "initializeDeepsightTutorial",
|
|
686
|
+
src: "initializeDeepsightSession",
|
|
687
|
+
input: ({ context }) => ({ config: context.config }),
|
|
688
|
+
onDone: {
|
|
689
|
+
target: "readyForNext",
|
|
690
|
+
actions: assign({ deepsightService: ({ event }) => event.output })
|
|
691
|
+
},
|
|
692
|
+
onError: { target: "readyForNext" }
|
|
693
|
+
} },
|
|
694
|
+
readyForNext: { on: { NEXT_STEP: {
|
|
695
|
+
target: "#selfie.tutorial.waitingForPermission",
|
|
696
|
+
actions: "trackContinue"
|
|
697
|
+
} } }
|
|
698
|
+
}
|
|
699
|
+
},
|
|
645
700
|
waitingForPermission: { invoke: {
|
|
646
701
|
id: "checkPermissionWaiting",
|
|
647
702
|
src: "checkPermission",
|
|
@@ -657,8 +712,22 @@ const _selfieMachine = setup({
|
|
|
657
712
|
}
|
|
658
713
|
},
|
|
659
714
|
permissions: {
|
|
660
|
-
initial: "
|
|
715
|
+
initial: "checkingDeepsight",
|
|
661
716
|
states: {
|
|
717
|
+
checkingDeepsight: { always: [{
|
|
718
|
+
target: "initializingDeepsight",
|
|
719
|
+
guard: ({ context }) => context.config.deepsightLiveness === "VIDEOLIVENESS" && context.deepsightService === void 0
|
|
720
|
+
}, { target: "idle" }] },
|
|
721
|
+
initializingDeepsight: { invoke: {
|
|
722
|
+
id: "initializeDeepsightPerms",
|
|
723
|
+
src: "initializeDeepsightSession",
|
|
724
|
+
input: ({ context }) => ({ config: context.config }),
|
|
725
|
+
onDone: {
|
|
726
|
+
target: "idle",
|
|
727
|
+
actions: assign({ deepsightService: ({ event }) => event.output })
|
|
728
|
+
},
|
|
729
|
+
onError: { target: "idle" }
|
|
730
|
+
} },
|
|
662
731
|
idle: {
|
|
663
732
|
invoke: {
|
|
664
733
|
id: "checkPermissionIdle",
|
|
@@ -707,14 +776,29 @@ const _selfieMachine = setup({
|
|
|
707
776
|
}
|
|
708
777
|
},
|
|
709
778
|
capture: {
|
|
710
|
-
initial: "
|
|
779
|
+
initial: "checkingDeepsight",
|
|
711
780
|
exit: [
|
|
712
781
|
"stopMediaRecording",
|
|
713
782
|
"stopRecordingStream",
|
|
714
783
|
"clearRecordingSession",
|
|
715
|
-
"stopMediaStream"
|
|
784
|
+
"stopMediaStream",
|
|
785
|
+
"cleanupDeepsight"
|
|
716
786
|
],
|
|
717
787
|
states: {
|
|
788
|
+
checkingDeepsight: { always: [{
|
|
789
|
+
target: "initializingDeepsight",
|
|
790
|
+
guard: ({ context }) => context.config.deepsightLiveness === "VIDEOLIVENESS" && context.deepsightService === void 0
|
|
791
|
+
}, { target: "checkingStream" }] },
|
|
792
|
+
initializingDeepsight: { invoke: {
|
|
793
|
+
id: "initializeDeepsightCapture",
|
|
794
|
+
src: "initializeDeepsightSession",
|
|
795
|
+
input: ({ context }) => ({ config: context.config }),
|
|
796
|
+
onDone: {
|
|
797
|
+
target: "checkingStream",
|
|
798
|
+
actions: [assign({ deepsightService: ({ event }) => event.output })]
|
|
799
|
+
},
|
|
800
|
+
onError: { target: "checkingStream" }
|
|
801
|
+
} },
|
|
718
802
|
checkingStream: { always: [{
|
|
719
803
|
target: "detecting",
|
|
720
804
|
guard: "hasStream"
|
|
@@ -725,7 +809,7 @@ const _selfieMachine = setup({
|
|
|
725
809
|
input: ({ context }) => context.config,
|
|
726
810
|
onDone: {
|
|
727
811
|
target: "detecting",
|
|
728
|
-
actions: "setStreamAndCapturer"
|
|
812
|
+
actions: ["setStreamAndCapturer"]
|
|
729
813
|
},
|
|
730
814
|
onError: [{
|
|
731
815
|
target: "#selfie.permissions",
|
|
@@ -737,7 +821,12 @@ const _selfieMachine = setup({
|
|
|
737
821
|
}]
|
|
738
822
|
} },
|
|
739
823
|
detecting: {
|
|
740
|
-
entry: [
|
|
824
|
+
entry: [
|
|
825
|
+
assign({ detectionStatus: () => "detecting" }),
|
|
826
|
+
"createRecordingStream",
|
|
827
|
+
"checkVirtualCamera",
|
|
828
|
+
"startDeepsightRecording"
|
|
829
|
+
],
|
|
741
830
|
invoke: [{
|
|
742
831
|
id: "startRecording",
|
|
743
832
|
src: "startRecording",
|
|
@@ -807,7 +896,8 @@ const _selfieMachine = setup({
|
|
|
807
896
|
if (!canvas) throw new Error(FACE_ERROR_CODES.SERVER);
|
|
808
897
|
return {
|
|
809
898
|
canvas,
|
|
810
|
-
faceCoordinates: context.faceCoordinates
|
|
899
|
+
faceCoordinates: context.faceCoordinates,
|
|
900
|
+
deepsightService: context.deepsightService
|
|
811
901
|
};
|
|
812
902
|
},
|
|
813
903
|
onDone: {
|
|
@@ -834,10 +924,19 @@ const _selfieMachine = setup({
|
|
|
834
924
|
} } },
|
|
835
925
|
success: {
|
|
836
926
|
entry: "stopMediaRecording",
|
|
837
|
-
after: { 3e3: { target: "#selfie.
|
|
927
|
+
after: { 3e3: { target: "#selfie.processing" } }
|
|
838
928
|
}
|
|
839
929
|
}
|
|
840
930
|
},
|
|
931
|
+
processing: { invoke: {
|
|
932
|
+
id: "processFace",
|
|
933
|
+
src: "processFace",
|
|
934
|
+
onDone: {
|
|
935
|
+
target: "finished",
|
|
936
|
+
actions: assign({ processResponse: ({ event }) => event.output })
|
|
937
|
+
},
|
|
938
|
+
onError: { target: "finished" }
|
|
939
|
+
} },
|
|
841
940
|
finished: {
|
|
842
941
|
entry: "stopMediaStream",
|
|
843
942
|
on: { RESET: {
|
|
@@ -916,7 +1015,11 @@ function mapState(snapshot) {
|
|
|
916
1015
|
attemptsRemaining: context.attemptsRemaining,
|
|
917
1016
|
uploadError: context.uploadError
|
|
918
1017
|
};
|
|
919
|
-
if (snapshot.matches("
|
|
1018
|
+
if (snapshot.matches("processing")) return { status: "processing" };
|
|
1019
|
+
if (snapshot.matches("finished")) return {
|
|
1020
|
+
status: "finished",
|
|
1021
|
+
processResponse: context.processResponse
|
|
1022
|
+
};
|
|
920
1023
|
if (snapshot.matches("error")) return {
|
|
921
1024
|
status: "error",
|
|
922
1025
|
error: context.error ?? "Unknown error"
|
|
@@ -992,4 +1095,4 @@ function createSelfieManager(options) {
|
|
|
992
1095
|
}
|
|
993
1096
|
|
|
994
1097
|
//#endregion
|
|
995
|
-
export { createSelfieManager, selfieMachine };
|
|
1098
|
+
export { createSelfieManager, processFace, selfieMachine };
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as stopCameraStream, b as queryCameraPermission, w as requestCameraAccess } from "./endpoints-D9TGnxRK.esm.js";
|
|
2
|
+
import { a as getUserAgent } from "./recordingsRepository-D5MURoVB.esm.js";
|
|
2
3
|
|
|
3
|
-
//#region ../infra/src/device/getBrowser.ts
|
|
4
|
-
function getUserAgent() {
|
|
5
|
-
if (typeof navigator === "undefined") return "";
|
|
6
|
-
return navigator.userAgent;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
4
|
//#region ../infra/src/device/getDeviceClass.ts
|
|
11
5
|
function getDeviceInfo() {
|
|
12
6
|
if (typeof navigator === "undefined") return {
|
|
@@ -20,6 +14,24 @@ function getDeviceInfo() {
|
|
|
20
14
|
maxTouchPoints: navigator.maxTouchPoints
|
|
21
15
|
};
|
|
22
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Gets the current window dimensions.
|
|
19
|
+
* Returns default values (1280x720) in non-browser environments.
|
|
20
|
+
*/
|
|
21
|
+
function getWindowDimensions(defaultWidth = 1280, defaultHeight = 720) {
|
|
22
|
+
if (typeof window === "undefined") return {
|
|
23
|
+
outerWidth: defaultWidth,
|
|
24
|
+
outerHeight: defaultHeight,
|
|
25
|
+
innerWidth: defaultWidth,
|
|
26
|
+
innerHeight: defaultHeight
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
outerWidth: window.outerWidth,
|
|
30
|
+
outerHeight: window.outerHeight,
|
|
31
|
+
innerWidth: window.innerWidth,
|
|
32
|
+
innerHeight: window.innerHeight
|
|
33
|
+
};
|
|
34
|
+
}
|
|
23
35
|
|
|
24
36
|
//#endregion
|
|
25
37
|
//#region src/internal/device/getBrowser.ts
|
|
@@ -69,4 +81,17 @@ async function requestPermission() {
|
|
|
69
81
|
}
|
|
70
82
|
|
|
71
83
|
//#endregion
|
|
72
|
-
|
|
84
|
+
//#region src/internal/recordings/streamingEvents.ts
|
|
85
|
+
const streamingEvents = {
|
|
86
|
+
strSessionDidConnect: "strSessionDidConnect",
|
|
87
|
+
strSessionDidDisconnect: "strSessionDidDisconnect",
|
|
88
|
+
strSessionDidFailWithError: "strSessionDidFailWithError",
|
|
89
|
+
strStreamVideoCaptureStart: "strStreamVideoCaptureStart",
|
|
90
|
+
strStreamVideoCaptureStop: "strStreamVideoCaptureStop",
|
|
91
|
+
strStreamPublisherCreated: "strStreamPublisherCreated",
|
|
92
|
+
strStreamPublisherDestroyed: "strStreamPublisherDestroyed",
|
|
93
|
+
strStreamPublisherDidFailWithError: "strStreamPublisherDidFailWithError"
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { getBrowser as a, getDeviceClass as i, checkPermission as n, getWindowDimensions as o, requestPermission as r, streamingEvents as t };
|