@incodetech/core 2.0.0-alpha.11 → 2.0.0-alpha.13

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.
Files changed (34) hide show
  1. package/dist/{OpenViduLogger-5b7KqNTo.esm.js → OpenViduLogger-CRbRNZA7.esm.js} +1 -1
  2. package/dist/OpenViduLogger-Dy5P806a.esm.js +3 -0
  3. package/dist/{warmup-Cijuyvoc.d.ts → StateMachine-pi8byl8C.d.ts} +4 -1
  4. package/dist/{addEvent-s2Za-pK3.esm.js → addEvent-BGKc_lHF.esm.js} +1 -1
  5. package/dist/{deepsightLoader-Bn2D0REl.esm.js → deepsightLoader-B36_XZ7r.esm.js} +3 -3
  6. package/dist/{recordingsRepository-CTjaf-ER.esm.js → deepsightService-BWxcc4OC.esm.js} +2 -33
  7. package/dist/email.d.ts +1 -1
  8. package/dist/email.esm.js +3 -3
  9. package/dist/{endpoints-B0ltwtb5.esm.js → endpoints-D9TGnxRK.esm.js} +336 -21
  10. package/dist/flow.d.ts +4 -303
  11. package/dist/flow.esm.js +4 -5
  12. package/dist/id-DHVSW_wJ.esm.js +1825 -0
  13. package/dist/id.d.ts +6 -0
  14. package/dist/id.esm.js +8 -0
  15. package/dist/index-CbF_uI-x.d.ts +618 -0
  16. package/dist/index.d.ts +8 -3
  17. package/dist/index.esm.js +7 -4
  18. package/dist/{lib-CykGFCEr.esm.js → lib-BJoLTN_W.esm.js} +2 -2
  19. package/dist/phone.d.ts +1 -1
  20. package/dist/phone.esm.js +3 -3
  21. package/dist/recordingsRepository-D5MURoVB.esm.js +40 -0
  22. package/dist/selfie.d.ts +22 -324
  23. package/dist/selfie.esm.js +34 -23
  24. package/dist/{permissionServices-BhD0KxsO.esm.js → streamingEvents-B3hNanPl.esm.js} +34 -3
  25. package/dist/types-BpCrZLU6.d.ts +302 -0
  26. package/dist/types-DZbrbPgj.d.ts +335 -0
  27. package/package.json +6 -2
  28. package/dist/OpenViduLogger-20ZYS-mT.esm.js +0 -3
  29. package/dist/StateMachine-BqPpBhOz.d.ts +0 -2
  30. package/dist/getBrowser-CLEzz0Hi.esm.js +0 -8
  31. package/dist/types-Dif6MQmX.d.ts +0 -5
  32. /package/dist/{Manager-Cy9-TMC9.d.ts → Manager-BZUZTRPx.d.ts} +0 -0
  33. /package/dist/{chunk-C_Yo44FK.esm.js → chunk-FbsBJI8u.esm.js} +0 -0
  34. /package/dist/{xstate.esm-2T5fOCTq.esm.js → xstate.esm-2hDiAXvZ.esm.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { i as __toCommonJS, n as __esm, r as __export, t as __commonJS } from "./chunk-C_Yo44FK.esm.js";
2
- import { n as require_jsnlog, t as require_OpenViduLogger } from "./OpenViduLogger-5b7KqNTo.esm.js";
1
+ import { i as __toCommonJS, n as __esm, r as __export, t as __commonJS } from "./chunk-FbsBJI8u.esm.js";
2
+ import { n as require_jsnlog, t as require_OpenViduLogger } from "./OpenViduLogger-CRbRNZA7.esm.js";
3
3
 
4
4
  //#region ../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Enums/LocalRecorderState.js
5
5
  var require_LocalRecorderState = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/openvidu-browser@2.32.1/node_modules/openvidu-browser/lib/OpenViduInternal/Enums/LocalRecorderState.js": ((exports) => {
package/dist/phone.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Manager } from "./Manager-Cy9-TMC9.js";
1
+ import { t as Manager } from "./Manager-BZUZTRPx.js";
2
2
 
3
3
  //#region src/modules/phone/types.d.ts
4
4
 
package/dist/phone.esm.js CHANGED
@@ -1,6 +1,6 @@
1
- import { b as createManager, n as api, t as endpoints } from "./endpoints-B0ltwtb5.esm.js";
2
- import { a as createActor, i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-2T5fOCTq.esm.js";
3
- import { t as addEvent } from "./addEvent-s2Za-pK3.esm.js";
1
+ import { E as createManager, n as api, t as endpoints } from "./endpoints-D9TGnxRK.esm.js";
2
+ import { a as createActor, i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-2hDiAXvZ.esm.js";
3
+ import { t as addEvent } from "./addEvent-BGKc_lHF.esm.js";
4
4
 
5
5
  //#region src/modules/phone/phoneServices.ts
6
6
  async function fetchPhone(signal) {
@@ -0,0 +1,40 @@
1
+ import { n as api, t as endpoints } from "./endpoints-D9TGnxRK.esm.js";
2
+
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
+ //#region src/internal/recordings/recordingsRepository.ts
11
+ async function createRecordingSession(type) {
12
+ return (await api.post(endpoints.recordingCreateSessionV2, { type })).data;
13
+ }
14
+ async function startRecording(params) {
15
+ return (await api.post(endpoints.recordingStartV2, {
16
+ videoRecordingId: params.videoRecordingId,
17
+ frameRate: 30,
18
+ outputMode: "COMPOSED",
19
+ resolution: params.resolution,
20
+ type: params.type,
21
+ hasAudio: params.hasAudio ?? false
22
+ })).data;
23
+ }
24
+ async function stopRecording(videoRecordingId) {
25
+ return (await api.post(endpoints.recordingStopV2, { videoRecordingId })).data;
26
+ }
27
+ async function uploadDeepsightVideo(encryptedVideo, token) {
28
+ try {
29
+ return (await api.post(endpoints.deepsightVideoImport, {
30
+ video: encryptedVideo,
31
+ type: "selfie"
32
+ }, { headers: { "X-Incode-Hardware-Id": token } })).data.recordingId ?? "";
33
+ } catch (error) {
34
+ console.error("Error uploading deepsight video:", error);
35
+ return "";
36
+ }
37
+ }
38
+
39
+ //#endregion
40
+ export { getUserAgent as a, uploadDeepsightVideo as i, startRecording as n, stopRecording as r, createRecordingSession as t };
package/dist/selfie.d.ts CHANGED
@@ -1,165 +1,9 @@
1
- import { t as WasmPipeline } from "./warmup-Cijuyvoc.js";
2
- import { t as Manager } from "./Manager-Cy9-TMC9.js";
3
- import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-BqPpBhOz.js";
4
- import { n as PermissionStatus, t as PermissionResult } from "./types-Dif6MQmX.js";
1
+ import { a as CameraStream, d as IMLProviderCapability, f as MLProviderConfig, i as StreamCanvasCapture, l as MotionPermissionState, n as PermissionStatus, o as IRecordingCapability, p as IncodeCanvas, r as BaseWasmProvider, s as RecordingConnection, t as PermissionResult, u as MotionStatus } from "./types-DZbrbPgj.js";
2
+ import { n as StateMachine, t as AnyStateMachine } from "./StateMachine-pi8byl8C.js";
3
+ import { t as Manager } from "./Manager-BZUZTRPx.js";
5
4
 
6
- //#region ../infra/src/media/canvas.d.ts
7
- /**
8
- * Class representing a canvas element for image capture and manipulation.
9
- */
10
- declare class IncodeCanvas {
11
- canvas: HTMLCanvasElement;
12
- private base64Image;
13
- private blobData;
14
- /**
15
- * Creates an {@link IncodeCanvas} from a raw {@link ImageData} frame.
16
- * @param imageData - Frame pixels in RGBA format
17
- * @returns An {@link IncodeCanvas} containing the provided pixels
18
- */
19
- static fromImageData(imageData: ImageData): IncodeCanvas;
20
- /**
21
- * Create a new canvas element.
22
- * @param canvas_ - The canvas element to clone.
23
- */
24
- constructor(canvas_: HTMLCanvasElement);
25
- /**
26
- * Check if the current canvas is valid.
27
- */
28
- private checkCanvas;
29
- /**
30
- * Release the data stored by IncodeCanvas.
31
- */
32
- release(): void;
33
- /**
34
- * Get the width of the canvas.
35
- */
36
- width(): number | null;
37
- /**
38
- * Get the height of the canvas.
39
- */
40
- height(): number | null;
41
- /**
42
- * Set the width of the canvas.
43
- */
44
- setWidth(width: number): void;
45
- /**
46
- * Set the height of the canvas.
47
- */
48
- setHeight(height: number): void;
49
- /**
50
- * Clone the current canvas.
51
- */
52
- clone(): IncodeCanvas | null;
53
- /**
54
- * Deep clone the current IncodeCanvas including blob data.
55
- */
56
- deepClone(): Promise<IncodeCanvas | null>;
57
- /**
58
- * Returns the drawing context on the canvas.
59
- */
60
- getContext(contextId: '2d', contextAttributes?: CanvasRenderingContext2DSettings): CanvasRenderingContext2D | null;
61
- /**
62
- * Retrieves the image data from the canvas.
63
- */
64
- getImageData(): ImageData | null;
65
- /**
66
- * Updates the base64 representation of the current canvas image.
67
- */
68
- updateBase64Image(jpegQuality?: number): void;
69
- /**
70
- * Converts the current canvas element to a base64 string.
71
- */
72
- getBase64Image(jpegQuality?: number, includeDataURLPrefix?: boolean): string | null;
73
- /**
74
- * Sets the base64 representation of the current canvas image.
75
- */
76
- setBase64Image(base64Image: string | null): void;
77
- /**
78
- * Updates the Blob representation of the current canvas image.
79
- */
80
- updateBlob(jpegQuality?: number, includeDataURLPrefix?: boolean): void;
81
- /**
82
- * Converts a base64 string to a Blob and creates a URL for it.
83
- */
84
- static base64ToBlob(base64: string): {
85
- blob: Blob;
86
- url: string;
87
- } | null;
88
- /**
89
- * Retrieves the Blob data and its URL from the current canvas.
90
- */
91
- getBlobData(jpegQuality?: number, includeDataURLPrefix?: boolean): {
92
- blob: Blob;
93
- url: string;
94
- } | null;
95
- /**
96
- * Sets the Blob data of the current canvas image.
97
- */
98
- setBlobData(blobData: {
99
- blob: Blob;
100
- url: string;
101
- }): Promise<void>;
102
- /**
103
- * Returns a resized canvas according to video element size.
104
- */
105
- getResizedCanvas(videoElementWidth: number, videoElementHeight: number): IncodeCanvas | null;
106
- }
107
- //#endregion
108
- //#region ../infra/src/capabilities/IMLProviderCapability.d.ts
109
- /**
110
- * Base configuration shared by all ML provider capabilities.
111
- */
112
- interface MLProviderConfig {
113
- /** Path to the WASM binary */
114
- wasmPath?: string;
115
- /** Path to the SIMD-optimized WASM binary (optional) */
116
- wasmSimdPath?: string;
117
- /** Path to the WASM glue code */
118
- glueCodePath?: string;
119
- /** Whether to use SIMD optimizations (default: true) */
120
- useSimd?: boolean;
121
- /**
122
- * Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
123
- * If not provided, models are expected in a 'models' subdirectory relative to the WASM binary.
124
- */
125
- modelsBasePath?: string;
126
- }
127
- /**
128
- * Base interface for ML provider capabilities.
129
- * Provides common lifecycle and frame processing methods shared by
130
- * FaceDetectionCapability and IdCaptureCapability.
131
- */
132
- interface IMLProviderCapability<TConfig extends MLProviderConfig> {
133
- /**
134
- * Whether the provider has been initialized and is ready to process frames.
135
- */
136
- readonly initialized: boolean;
137
- /**
138
- * Initializes the provider with the given configuration.
139
- * If WASM was already warmed up via `setup()` or `warmupWasm()`, this returns almost instantly.
140
- * @param config - Provider configuration including WASM paths
141
- */
142
- initialize(config: TConfig): Promise<void>;
143
- /**
144
- * Processes a frame through the ML pipeline.
145
- * Callbacks set via `setCallbacks()` will be invoked based on the analysis results.
146
- * @param image - Image data to process
147
- * @throws Error if provider is not initialized
148
- */
149
- processFrame(image: ImageData): Promise<void>;
150
- /**
151
- * Resets the pipeline to its initial state.
152
- * Safe to call even if not initialized (no-op in that case).
153
- */
154
- reset(): void;
155
- /**
156
- * Disposes of resources and resets initialization state.
157
- * Safe to call even if not initialized.
158
- */
159
- dispose(): Promise<void>;
160
- }
161
- //#endregion
162
5
  //#region ../infra/src/capabilities/IFaceDetectionCapability.d.ts
6
+
163
7
  /**
164
8
  * Configuration for face detection provider.
165
9
  * Extends base ML provider config with face-detection specific options.
@@ -313,168 +157,6 @@ type IDeepsightRecordingCapability = {
313
157
  reset(): void;
314
158
  };
315
159
  //#endregion
316
- //#region ../infra/src/capabilities/IMotionSensorCapability.d.ts
317
- type MotionStatus = 'PASS' | 'FAIL' | 'UNCLEAR';
318
- type MotionPermissionState = 'granted' | 'denied' | 'not-required';
319
- //#endregion
320
- //#region ../infra/src/capabilities/IRecordingCapability.d.ts
321
- type RecordingPublisher = {
322
- getStreamId: () => string | undefined;
323
- replaceVideoTrack: (track: MediaStreamTrack) => Promise<void>;
324
- destroy: () => void;
325
- };
326
- type RecordingConnection = {
327
- sessionId: string | undefined;
328
- publisher: RecordingPublisher;
329
- disconnect: () => Promise<void>;
330
- };
331
- type RecordingConnectionEvents = {
332
- onSessionConnected?: (sessionId: string | undefined) => void;
333
- onSessionDisconnected?: (sessionId: string | undefined) => void;
334
- onSessionException?: (params: {
335
- name?: string;
336
- message?: string;
337
- sessionId?: string;
338
- }) => void;
339
- onPublisherCreated?: (params: {
340
- streamId?: string;
341
- sessionId?: string;
342
- }) => void;
343
- onPublisherError?: (params: {
344
- message?: string;
345
- sessionId?: string;
346
- streamId?: string;
347
- }) => void;
348
- };
349
- type ConnectRecordingParams = {
350
- sessionToken: string;
351
- stream: MediaStream;
352
- events?: RecordingConnectionEvents;
353
- };
354
- type IRecordingCapability = {
355
- /**
356
- * Connects to a recording session and publishes the provided media stream.
357
- * Returns a connection handle that can be disconnected and used to manage the publisher.
358
- */
359
- connect: (params: ConnectRecordingParams) => Promise<RecordingConnection>;
360
- };
361
- //#endregion
362
- //#region ../infra/src/media/camera.d.ts
363
- type CameraStream = MediaStream;
364
- //#endregion
365
- //#region ../infra/src/media/StreamCanvasCapture.d.ts
366
- type StreamCanvasCaptureOptions = {
367
- fps?: number;
368
- width?: number;
369
- height?: number;
370
- };
371
- type StreamCanvasCaptureEventMap = {
372
- frame: Event;
373
- };
374
- declare class StreamCanvasCapture {
375
- private video;
376
- private canvas;
377
- private ctx;
378
- private rafId;
379
- private lastFrameTimeSeconds;
380
- private lastTickTimeMs;
381
- private hasFrame;
382
- private disposed;
383
- private eventTarget;
384
- constructor(stream: CameraStream, options?: StreamCanvasCaptureOptions);
385
- addEventListener(type: keyof StreamCanvasCaptureEventMap, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
386
- removeEventListener(type: keyof StreamCanvasCaptureEventMap, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
387
- /**
388
- * Returns the latest cached frame as an {@link IncodeCanvas}.
389
- */
390
- getLatestCanvas(): IncodeCanvas | null;
391
- /**
392
- * Returns the latest cached frame as raw {@link ImageData}.
393
- */
394
- getLatestFrame(): ImageData | null;
395
- /**
396
- * Disposes internal resources and stops the capture loop.
397
- */
398
- dispose(): void;
399
- private rafLoop;
400
- private tick;
401
- }
402
- //#endregion
403
- //#region ../infra/src/wasm/WasmPipelineType.d.ts
404
- declare enum WasmPipelineType {
405
- IdBlurGlarePipeline = 0,
406
- IdBarcodeAndTextQualityPipeline = 1,
407
- IdVideoSelfiePipeline = 2,
408
- SelfieWithAggregationMetrics = 3,
409
- SelfieWithQualityMetrics = 4,
410
- IdFaceDetectionPipeline = 5,
411
- }
412
- //#endregion
413
- //#region ../infra/src/providers/wasm/BaseWasmProvider.d.ts
414
- /**
415
- * Base configuration for WASM providers
416
- */
417
- interface BaseWasmConfig {
418
- /** Path to the WASM binary */
419
- wasmPath?: string;
420
- /** Path to the SIMD-optimized WASM binary (optional) */
421
- wasmSimdPath?: string;
422
- /** Path to the WASM glue code */
423
- glueCodePath?: string;
424
- /** Whether to use SIMD optimizations (default: true) */
425
- useSimd?: boolean;
426
- /**
427
- * Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
428
- * If not provided, models are expected in a 'models' subdirectory relative to the WASM binary.
429
- */
430
- modelsBasePath?: string;
431
- }
432
- /**
433
- * Base provider class that abstracts common WASM functionality.
434
- * This serves as a foundation for specific ML capability providers
435
- * like FaceDetectionProvider and IdCaptureProvider.
436
- */
437
- declare abstract class BaseWasmProvider {
438
- private _isInitialized;
439
- protected pipelineType: WasmPipelineType | undefined;
440
- /**
441
- * Creates a new BaseWasmProvider
442
- * @param pipelineType - The WASM pipeline type this provider uses
443
- */
444
- constructor(pipelineType?: WasmPipelineType);
445
- /**
446
- * Returns whether this provider has been initialized.
447
- */
448
- get initialized(): boolean;
449
- protected getPipelineType(): WasmPipelineType;
450
- /**
451
- * Initializes the provider by ensuring WASM is loaded
452
- * @param config - Provider configuration
453
- * @param pipeline - The pipeline type to warm up ('selfie', 'idCapture', etc.)
454
- */
455
- protected initializeBase(config: BaseWasmConfig, pipeline: WasmPipeline): Promise<void>;
456
- /**
457
- * Ensures the provider is initialized before performing operations.
458
- * @throws Error if not initialized
459
- */
460
- protected ensureInitialized(): void;
461
- /**
462
- * Processes a frame through the WASM pipeline
463
- * @param image - Image data to process
464
- */
465
- processFrame(image: ImageData): Promise<void>;
466
- /**
467
- * Resets the pipeline to its initial state.
468
- * Safe to call even if not initialized (no-op in that case).
469
- */
470
- reset(): void;
471
- /**
472
- * Disposes of resources and resets initialization state.
473
- * Safe to call even if not initialized.
474
- */
475
- dispose(): Promise<void>;
476
- }
477
- //#endregion
478
160
  //#region ../infra/src/providers/wasm/FaceDetectionProvider.d.ts
479
161
  declare class FaceDetectionProvider extends BaseWasmProvider implements IFaceDetectionCapability {
480
162
  private defaultThresholds;
@@ -612,6 +294,15 @@ type RecordingSession = {
612
294
  hasAudio: boolean;
613
295
  };
614
296
  //#endregion
297
+ //#region src/modules/selfie/selfieUploadService.d.ts
298
+ type ProcessFaceImageType = 'selfie' | 'videoSelfie';
299
+ type ProcessFaceResponse = {
300
+ faceMatch: boolean;
301
+ confidence: number;
302
+ existingUser: boolean;
303
+ };
304
+ declare function processFace(imageType?: ProcessFaceImageType, signal?: AbortSignal): Promise<ProcessFaceResponse>;
305
+ //#endregion
615
306
  //#region src/modules/selfie/selfieStateMachine.d.ts
616
307
  type SelfieContext = {
617
308
  config: SelfieConfig;
@@ -624,6 +315,7 @@ type SelfieContext = {
624
315
  capturedImage: IncodeCanvas | undefined;
625
316
  faceCoordinates: FaceCoordinates | undefined;
626
317
  uploadResponse: SendFaceImageResponse | undefined;
318
+ processResponse: ProcessFaceResponse | undefined;
627
319
  recordingSession: RecordingSession | undefined;
628
320
  recordingStream: MediaStream | undefined;
629
321
  attemptsRemaining: number;
@@ -721,9 +413,15 @@ type SelfieCaptureState = {
721
413
  /** Error message from failed upload */
722
414
  uploadError: string | undefined;
723
415
  };
416
+ /** Processing the captured selfie */
417
+ type SelfieProcessingState = {
418
+ status: 'processing';
419
+ };
724
420
  /** Selfie capture completed successfully */
725
421
  type SelfieFinishedState = {
726
422
  status: 'finished';
423
+ /** Face processing result (face match, confidence, existing user) */
424
+ processResponse: ProcessFaceResponse | undefined;
727
425
  };
728
426
  /** User closed the selfie flow */
729
427
  type SelfieClosedState = {
@@ -736,7 +434,7 @@ type SelfieErrorState = {
736
434
  error: string;
737
435
  };
738
436
  /** Union of all possible selfie states */
739
- type SelfieState = SelfieIdleState | SelfieLoadingState | SelfieTutorialState | SelfiePermissionsState | SelfieCaptureState | SelfieFinishedState | SelfieClosedState | SelfieErrorState;
437
+ type SelfieState = SelfieIdleState | SelfieLoadingState | SelfieTutorialState | SelfiePermissionsState | SelfieCaptureState | SelfieProcessingState | SelfieFinishedState | SelfieClosedState | SelfieErrorState;
740
438
  /**
741
439
  * Creates a selfie manager instance for handling selfie capture flow.
742
440
  *
@@ -818,4 +516,4 @@ declare function createSelfieManager(options: CreateSelfieActorOptions): Manager
818
516
  };
819
517
  type SelfieManager = ReturnType<typeof createSelfieManager>;
820
518
  //#endregion
821
- export { type CameraStream, type DeepsightService, type DetectionStatus, type FaceErrorCode, type PermissionResult, type PermissionStatus, type SelfieConfig, type SelfieMachine, type SelfieManager, type SelfieState, createSelfieManager, selfieMachine };
519
+ export { type CameraStream, type DeepsightService, type DetectionStatus, type FaceErrorCode, type PermissionResult, type PermissionStatus, type ProcessFaceResponse, type SelfieConfig, type SelfieMachine, type SelfieManager, type SelfieState, createSelfieManager, processFace, selfieMachine };
@@ -1,9 +1,9 @@
1
- import { b as createManager, c as WasmUtilProvider, f as OpenViduRecordingProvider, g as StreamCanvasCapture, h as StreamCanvasProcessingSession, i as getToken, l as FaceDetectionProvider, n as api, t as endpoints, v as requestCameraAccess, y as stopCameraStream } from "./endpoints-B0ltwtb5.esm.js";
2
- import "./getBrowser-CLEzz0Hi.esm.js";
3
- import { n as requestPermission, r as getDeviceClass, t as checkPermission } from "./permissionServices-BhD0KxsO.esm.js";
4
- import { a as createActor, i as fromPromise, n as assign, r as fromCallback, t as setup } from "./xstate.esm-2T5fOCTq.esm.js";
5
- import { t as addEvent } from "./addEvent-s2Za-pK3.esm.js";
6
- import { n as startRecording, r as stopRecording$1, t as createRecordingSession } from "./recordingsRepository-CTjaf-ER.esm.js";
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";
7
7
 
8
8
  //#region src/modules/selfie/types.ts
9
9
  const FACE_ERROR_CODES = {
@@ -57,19 +57,6 @@ const validateUploadResponse = ({ config, response }) => {
57
57
  if (config.validateHeadCover && response.hasHeadCover) return FACE_ERROR_CODES.HEAD_COVER;
58
58
  };
59
59
 
60
- //#endregion
61
- //#region src/internal/recordings/streamingEvents.ts
62
- const streamingEvents = {
63
- strSessionDidConnect: "strSessionDidConnect",
64
- strSessionDidDisconnect: "strSessionDidDisconnect",
65
- strSessionDidFailWithError: "strSessionDidFailWithError",
66
- strStreamVideoCaptureStart: "strStreamVideoCaptureStart",
67
- strStreamVideoCaptureStop: "strStreamVideoCaptureStop",
68
- strStreamPublisherCreated: "strStreamPublisherCreated",
69
- strStreamPublisherDestroyed: "strStreamPublisherDestroyed",
70
- strStreamPublisherDidFailWithError: "strStreamPublisherDidFailWithError"
71
- };
72
-
73
60
  //#endregion
74
61
  //#region src/modules/selfie/selfieUploadService.ts
75
62
  /**
@@ -114,6 +101,12 @@ const getFaceErrorCodeFromHttpError = (error) => {
114
101
  4078: FACE_ERROR_CODES.FACE_OCCLUDED
115
102
  }[err.data.status] ?? FACE_ERROR_CODES.BAD_REQUEST;
116
103
  };
104
+ async function processFace(imageType = "selfie", signal) {
105
+ return (await api.post(endpoints.processFace, {}, {
106
+ query: { imageType },
107
+ signal
108
+ })).data;
109
+ }
117
110
 
118
111
  //#endregion
119
112
  //#region src/modules/selfie/selfieServices.ts
@@ -361,7 +354,7 @@ function stopRecording(session) {
361
354
  }
362
355
  async function initializeDeepsightSession(config) {
363
356
  if (config.deepsightLiveness !== "VIDEOLIVENESS") return;
364
- const { loadDeepsightSession } = await import("./deepsightLoader-Bn2D0REl.esm.js");
357
+ const { loadDeepsightSession } = await import("./deepsightLoader-B36_XZ7r.esm.js");
365
358
  return loadDeepsightSession();
366
359
  }
367
360
 
@@ -445,6 +438,9 @@ const _selfieMachine = setup({
445
438
  clonedStream: input.clonedStream,
446
439
  existing: input.existing
447
440
  });
441
+ }),
442
+ processFace: fromPromise(async ({ signal }) => {
443
+ return processFace("selfie", signal);
448
444
  })
449
445
  },
450
446
  actions: {
@@ -488,6 +484,7 @@ const _selfieMachine = setup({
488
484
  capturedImage: void 0,
489
485
  faceCoordinates: void 0,
490
486
  uploadResponse: void 0,
487
+ processResponse: void 0,
491
488
  recordingSession: void 0,
492
489
  recordingStream: void 0,
493
490
  attemptsRemaining: context.config.captureAttempts,
@@ -582,6 +579,7 @@ const _selfieMachine = setup({
582
579
  capturedImage: void 0,
583
580
  faceCoordinates: void 0,
584
581
  uploadResponse: void 0,
582
+ processResponse: void 0,
585
583
  recordingSession: void 0,
586
584
  recordingStream: void 0,
587
585
  attemptsRemaining: input.config.captureAttempts,
@@ -926,10 +924,19 @@ const _selfieMachine = setup({
926
924
  } } },
927
925
  success: {
928
926
  entry: "stopMediaRecording",
929
- after: { 3e3: { target: "#selfie.finished" } }
927
+ after: { 3e3: { target: "#selfie.processing" } }
930
928
  }
931
929
  }
932
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
+ } },
933
940
  finished: {
934
941
  entry: "stopMediaStream",
935
942
  on: { RESET: {
@@ -1008,7 +1015,11 @@ function mapState(snapshot) {
1008
1015
  attemptsRemaining: context.attemptsRemaining,
1009
1016
  uploadError: context.uploadError
1010
1017
  };
1011
- if (snapshot.matches("finished")) return { status: "finished" };
1018
+ if (snapshot.matches("processing")) return { status: "processing" };
1019
+ if (snapshot.matches("finished")) return {
1020
+ status: "finished",
1021
+ processResponse: context.processResponse
1022
+ };
1012
1023
  if (snapshot.matches("error")) return {
1013
1024
  status: "error",
1014
1025
  error: context.error ?? "Unknown error"
@@ -1084,4 +1095,4 @@ function createSelfieManager(options) {
1084
1095
  }
1085
1096
 
1086
1097
  //#endregion
1087
- export { createSelfieManager, selfieMachine };
1098
+ export { createSelfieManager, processFace, selfieMachine };
@@ -1,5 +1,5 @@
1
- import { _ as queryCameraPermission, v as requestCameraAccess, y as stopCameraStream } from "./endpoints-B0ltwtb5.esm.js";
2
- import { t as getUserAgent } from "./getBrowser-CLEzz0Hi.esm.js";
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";
3
3
 
4
4
  //#region ../infra/src/device/getDeviceClass.ts
5
5
  function getDeviceInfo() {
@@ -14,6 +14,24 @@ function getDeviceInfo() {
14
14
  maxTouchPoints: navigator.maxTouchPoints
15
15
  };
16
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
+ }
17
35
 
18
36
  //#endregion
19
37
  //#region src/internal/device/getBrowser.ts
@@ -63,4 +81,17 @@ async function requestPermission() {
63
81
  }
64
82
 
65
83
  //#endregion
66
- export { getBrowser as i, requestPermission as n, getDeviceClass as r, checkPermission as t };
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 };