@incodetech/core 2.0.0-alpha.13 → 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-DHVSW_wJ.esm.js → id-r1mw9zBM.esm.js} +38 -36
- 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
|
@@ -1,3 +1,60 @@
|
|
|
1
|
+
import { AnyStateMachine, StateMachine } from "xstate";
|
|
2
|
+
|
|
3
|
+
//#region ../infra/src/wasm/warmup.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* All available ML pipelines in the SDK.
|
|
7
|
+
* - 'selfie' - Face detection for selfie capture
|
|
8
|
+
* - 'idCapture' - Document detection for ID capture
|
|
9
|
+
*/
|
|
10
|
+
type WasmPipeline = 'selfie' | 'idCapture';
|
|
11
|
+
interface WarmupConfig {
|
|
12
|
+
wasmPath: string;
|
|
13
|
+
wasmSimdPath?: string;
|
|
14
|
+
glueCodePath: string;
|
|
15
|
+
useSimd?: boolean;
|
|
16
|
+
pipelines?: readonly WasmPipeline[];
|
|
17
|
+
/**
|
|
18
|
+
* Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
|
|
19
|
+
* If not provided, models are expected to be in the same directory as the WASM files.
|
|
20
|
+
*/
|
|
21
|
+
modelsBasePath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Custom model files per pipeline. If not provided, uses default models.
|
|
24
|
+
* Keys are pipeline names, values are arrays of model file names.
|
|
25
|
+
*/
|
|
26
|
+
pipelineModels?: Partial<Record<WasmPipeline, string[]>>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Preloads WASM binary and ML models at app startup.
|
|
30
|
+
* Runs asynchronously - app can continue while WASM loads in background.
|
|
31
|
+
*
|
|
32
|
+
* Model files are automatically loaded based on the pipeline type.
|
|
33
|
+
* By default, models are expected in a 'models' subdirectory relative to the WASM binary.
|
|
34
|
+
*
|
|
35
|
+
* @param config - Configuration for WASM warmup
|
|
36
|
+
* @returns Promise that resolves when WASM is ready
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* // Basic usage - models loaded from /wasm/v2/models/
|
|
41
|
+
* warmupWasm({
|
|
42
|
+
* wasmPath: '/wasm/v2/ml-wasm.wasm',
|
|
43
|
+
* glueCodePath: '/wasm/v2/ml-wasm.js',
|
|
44
|
+
* pipelines: ['selfie', 'idCapture'],
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // With explicit models path
|
|
48
|
+
* warmupWasm({
|
|
49
|
+
* wasmPath: '/wasm/v2/ml-wasm.wasm',
|
|
50
|
+
* glueCodePath: '/wasm/v2/ml-wasm.js',
|
|
51
|
+
* modelsBasePath: 'https://cdn.example.com/wasm/v2/models',
|
|
52
|
+
* pipelines: ['selfie'],
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function warmupWasm(config: WarmupConfig): Promise<void>;
|
|
57
|
+
//#endregion
|
|
1
58
|
//#region src/modules/flow/types.d.ts
|
|
2
59
|
type EmptyConfig = Record<string, never>;
|
|
3
60
|
type RegulationTypes = 'US' | 'Worldwide' | 'Other' | 'US_Illinois' | 'US_Texas' | 'US_California' | 'US_Washington';
|
|
@@ -299,4 +356,4 @@ type Flow = {
|
|
|
299
356
|
ds?: boolean;
|
|
300
357
|
};
|
|
301
358
|
//#endregion
|
|
302
|
-
export { TutorialIdConfig as i, FlowModule as n, FlowModuleConfig as r, Flow as t };
|
|
359
|
+
export { AnyStateMachine as a, warmupWasm as c, TutorialIdConfig as i, FlowModule as n, StateMachine as o, FlowModuleConfig as r, WasmPipeline as s, Flow as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as WasmPipeline } from "./types-CMR6NkxW.js";
|
|
2
2
|
|
|
3
3
|
//#region ../infra/src/media/canvas.d.ts
|
|
4
4
|
/**
|
|
@@ -23,10 +23,19 @@ declare class IncodeCanvas {
|
|
|
23
23
|
* Check if the current canvas is valid.
|
|
24
24
|
*/
|
|
25
25
|
private checkCanvas;
|
|
26
|
+
/**
|
|
27
|
+
* Disposes of resources, including revoking object URLs to prevent memory leaks.
|
|
28
|
+
*/
|
|
29
|
+
dispose(): void;
|
|
26
30
|
/**
|
|
27
31
|
* Release the data stored by IncodeCanvas.
|
|
28
32
|
*/
|
|
29
33
|
release(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Revokes the object URL if one exists, preventing memory leaks.
|
|
36
|
+
* Use this when you no longer need the preview image URL.
|
|
37
|
+
*/
|
|
38
|
+
revokeObjectURL(): void;
|
|
30
39
|
/**
|
|
31
40
|
* Get the width of the canvas.
|
|
32
41
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@incodetech/core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.esm.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typescript": "^5.9.3",
|
|
45
45
|
"vitest": "^4.0.13",
|
|
46
46
|
"@incodetech/config": "1.0.0",
|
|
47
|
-
"@incodetech/infra": "1.1.0-alpha.
|
|
47
|
+
"@incodetech/infra": "1.1.0-alpha.3"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown -c tsdown.config.ts",
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { AnyStateMachine, StateMachine } from "xstate";
|
|
2
|
-
|
|
3
|
-
//#region ../infra/src/wasm/warmup.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* All available ML pipelines in the SDK.
|
|
7
|
-
* - 'selfie' - Face detection for selfie capture
|
|
8
|
-
* - 'idCapture' - Document detection for ID capture
|
|
9
|
-
*/
|
|
10
|
-
type WasmPipeline = 'selfie' | 'idCapture';
|
|
11
|
-
interface WarmupConfig {
|
|
12
|
-
wasmPath: string;
|
|
13
|
-
wasmSimdPath?: string;
|
|
14
|
-
glueCodePath: string;
|
|
15
|
-
useSimd?: boolean;
|
|
16
|
-
pipelines?: readonly WasmPipeline[];
|
|
17
|
-
/**
|
|
18
|
-
* Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
|
|
19
|
-
* If not provided, models are expected to be in the same directory as the WASM files.
|
|
20
|
-
*/
|
|
21
|
-
modelsBasePath?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Custom model files per pipeline. If not provided, uses default models.
|
|
24
|
-
* Keys are pipeline names, values are arrays of model file names.
|
|
25
|
-
*/
|
|
26
|
-
pipelineModels?: Partial<Record<WasmPipeline, string[]>>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Preloads WASM binary and ML models at app startup.
|
|
30
|
-
* Runs asynchronously - app can continue while WASM loads in background.
|
|
31
|
-
*
|
|
32
|
-
* Model files are automatically loaded based on the pipeline type.
|
|
33
|
-
* By default, models are expected in a 'models' subdirectory relative to the WASM binary.
|
|
34
|
-
*
|
|
35
|
-
* @param config - Configuration for WASM warmup
|
|
36
|
-
* @returns Promise that resolves when WASM is ready
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* // Basic usage - models loaded from /wasm/v2/models/
|
|
41
|
-
* warmupWasm({
|
|
42
|
-
* wasmPath: '/wasm/v2/ml-wasm.wasm',
|
|
43
|
-
* glueCodePath: '/wasm/v2/ml-wasm.js',
|
|
44
|
-
* pipelines: ['selfie', 'idCapture'],
|
|
45
|
-
* });
|
|
46
|
-
*
|
|
47
|
-
* // With explicit models path
|
|
48
|
-
* warmupWasm({
|
|
49
|
-
* wasmPath: '/wasm/v2/ml-wasm.wasm',
|
|
50
|
-
* glueCodePath: '/wasm/v2/ml-wasm.js',
|
|
51
|
-
* modelsBasePath: 'https://cdn.example.com/wasm/v2/models',
|
|
52
|
-
* pipelines: ['selfie'],
|
|
53
|
-
* });
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
declare function warmupWasm(config: WarmupConfig): Promise<void>;
|
|
57
|
-
//#endregion
|
|
58
|
-
export { warmupWasm as i, StateMachine as n, WasmPipeline as r, AnyStateMachine as t };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { n as api, t as endpoints } from "./endpoints-D9TGnxRK.esm.js";
|
|
2
|
-
|
|
3
|
-
//#region src/internal/events/addEvent.ts
|
|
4
|
-
function addEvent(event) {
|
|
5
|
-
const { code, module, screen, clientTimestamp, payload = {} } = event;
|
|
6
|
-
return api.post(endpoints.events, [{
|
|
7
|
-
code,
|
|
8
|
-
module,
|
|
9
|
-
screen,
|
|
10
|
-
clientTimestamp: clientTimestamp ?? Date.now(),
|
|
11
|
-
payload
|
|
12
|
-
}]).then(() => void 0).catch(() => void 0);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
export { addEvent as t };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { _ as DeepsightRecordingProvider, g as MotionSensorProvider, m as VisibilityProvider, u as WasmUtilProvider } from "./endpoints-D9TGnxRK.esm.js";
|
|
2
|
-
import { i as uploadDeepsightVideo } from "./recordingsRepository-D5MURoVB.esm.js";
|
|
3
|
-
import { t as createDeepsightService } from "./deepsightService-BWxcc4OC.esm.js";
|
|
4
|
-
|
|
5
|
-
//#region src/modules/selfie/deepsightLoader.ts
|
|
6
|
-
const SDK_VERSION = "2.0.0";
|
|
7
|
-
async function loadDeepsightSession() {
|
|
8
|
-
const service = createDeepsightService({
|
|
9
|
-
sdkVersion: SDK_VERSION,
|
|
10
|
-
wasmUtil: await WasmUtilProvider.getInstance(),
|
|
11
|
-
visibility: new VisibilityProvider(),
|
|
12
|
-
motionSensor: new MotionSensorProvider(),
|
|
13
|
-
recorder: new DeepsightRecordingProvider(),
|
|
14
|
-
uploadVideo: async (encryptedVideo, token) => {
|
|
15
|
-
return await uploadDeepsightVideo(encryptedVideo, token);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
await service.initialize();
|
|
19
|
-
await service.requestMotionPermission();
|
|
20
|
-
await service.startMotionSensors();
|
|
21
|
-
return service;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { loadDeepsightSession };
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { a as getUserAgent } from "./recordingsRepository-D5MURoVB.esm.js";
|
|
2
|
-
|
|
3
|
-
//#region src/internal/deepsight/metadataService.ts
|
|
4
|
-
function getWebGLFingerprint() {
|
|
5
|
-
try {
|
|
6
|
-
const canvas = document.createElement("canvas");
|
|
7
|
-
const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
8
|
-
if (!gl) return "";
|
|
9
|
-
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
10
|
-
if (!debugInfo) return "";
|
|
11
|
-
return gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) || "";
|
|
12
|
-
} catch {
|
|
13
|
-
return "";
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function isBrowserSimulation() {
|
|
17
|
-
const win = window;
|
|
18
|
-
const nav = navigator;
|
|
19
|
-
return !!(win.callPhantom || win._phantom || win.phantom || win.__nightmare || nav.webdriver || win.domAutomation || win.domAutomationController);
|
|
20
|
-
}
|
|
21
|
-
async function getFingerPrint(disableIpify = false) {
|
|
22
|
-
let visitorId = "";
|
|
23
|
-
let ip = "";
|
|
24
|
-
try {
|
|
25
|
-
const canvas = document.createElement("canvas");
|
|
26
|
-
const ctx = canvas.getContext("2d");
|
|
27
|
-
if (ctx) {
|
|
28
|
-
ctx.textBaseline = "top";
|
|
29
|
-
ctx.font = "14px Arial";
|
|
30
|
-
ctx.fillText("fingerprint", 2, 2);
|
|
31
|
-
visitorId = canvas.toDataURL().slice(-50);
|
|
32
|
-
}
|
|
33
|
-
} catch {}
|
|
34
|
-
if (!disableIpify) try {
|
|
35
|
-
const controller = new AbortController();
|
|
36
|
-
const timeoutId = setTimeout(() => controller.abort(), 3e3);
|
|
37
|
-
const response = await fetch("https://api.ipify.org?format=json", { signal: controller.signal });
|
|
38
|
-
clearTimeout(timeoutId);
|
|
39
|
-
ip = (await response.json()).ip || "";
|
|
40
|
-
} catch {}
|
|
41
|
-
return {
|
|
42
|
-
visitorId,
|
|
43
|
-
ip
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function createMetadataService(wasmUtil, visibility) {
|
|
47
|
-
return {
|
|
48
|
-
async initialize(sdkVersion, disableIpify = false) {
|
|
49
|
-
wasmUtil.setSdkPlatform("WEBAPP");
|
|
50
|
-
wasmUtil.setSdkVersion(sdkVersion);
|
|
51
|
-
const ua = getUserAgent();
|
|
52
|
-
const isMobile = /Android|iPhone|iPad|iPod/i.test(ua);
|
|
53
|
-
const fingerPrint = await getFingerPrint(disableIpify).catch(() => ({
|
|
54
|
-
visitorId: "",
|
|
55
|
-
ip: ""
|
|
56
|
-
}));
|
|
57
|
-
const deviceMetadata = {
|
|
58
|
-
kind: isMobile ? "mobile" : "desktop",
|
|
59
|
-
model: "",
|
|
60
|
-
os: void 0,
|
|
61
|
-
osVersion: void 0,
|
|
62
|
-
screenDimensions: {
|
|
63
|
-
width: screen.width,
|
|
64
|
-
height: screen.height
|
|
65
|
-
},
|
|
66
|
-
numTouchPoints: navigator.maxTouchPoints,
|
|
67
|
-
fingerprintHash: fingerPrint.visitorId || "",
|
|
68
|
-
ip: fingerPrint.ip || "",
|
|
69
|
-
backgroundMode: false
|
|
70
|
-
};
|
|
71
|
-
wasmUtil.setDeviceInfo(deviceMetadata);
|
|
72
|
-
const nav = navigator;
|
|
73
|
-
const browserInfo = {
|
|
74
|
-
userAgent: ua,
|
|
75
|
-
getUserMediaAvailability: {
|
|
76
|
-
webkit: nav.webkitGetUserMedia !== void 0,
|
|
77
|
-
moz: nav.mozGetUserMedia !== void 0,
|
|
78
|
-
o: nav.oGetUserMedia !== void 0,
|
|
79
|
-
ms: nav.msGetUserMedia !== void 0
|
|
80
|
-
},
|
|
81
|
-
webglFingerprint: getWebGLFingerprint(),
|
|
82
|
-
inspectorOpened: false,
|
|
83
|
-
isMockedBrowser: isBrowserSimulation()
|
|
84
|
-
};
|
|
85
|
-
wasmUtil.setBrowserInfo(browserInfo, false);
|
|
86
|
-
},
|
|
87
|
-
updateCameraInfo(videoTrack) {
|
|
88
|
-
const settings = videoTrack.getSettings();
|
|
89
|
-
const capabilities = videoTrack.getCapabilities?.() ?? {};
|
|
90
|
-
const labels = videoTrack.label ? [videoTrack.label] : [];
|
|
91
|
-
const cameraInfo = {
|
|
92
|
-
facingMode: settings.facingMode === "user" ? "frontal" : settings.facingMode === "environment" ? "back" : settings.facingMode || "unknown",
|
|
93
|
-
settings,
|
|
94
|
-
capabilities,
|
|
95
|
-
labels
|
|
96
|
-
};
|
|
97
|
-
wasmUtil.setCameraInfo(cameraInfo);
|
|
98
|
-
},
|
|
99
|
-
async checkForVirtualCameraByLabel(videoTrack = null) {
|
|
100
|
-
try {
|
|
101
|
-
if (!videoTrack) {
|
|
102
|
-
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
103
|
-
for (const device of devices) if (device.kind === "videoinput" && wasmUtil.isVirtualCamera(device.label)) return true;
|
|
104
|
-
}
|
|
105
|
-
if (videoTrack && wasmUtil.isVirtualCamera(videoTrack.label)) return true;
|
|
106
|
-
return false;
|
|
107
|
-
} catch {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
async analyzeFrame(imageData) {
|
|
112
|
-
await wasmUtil.analyzeFrame(imageData);
|
|
113
|
-
},
|
|
114
|
-
setMotionStatus(status) {
|
|
115
|
-
wasmUtil.setMotionStatus(status);
|
|
116
|
-
},
|
|
117
|
-
setBackgroundMode(backgroundMode) {
|
|
118
|
-
wasmUtil.setBackgroundMode(backgroundMode || visibility.wasBackgrounded);
|
|
119
|
-
visibility.reset();
|
|
120
|
-
},
|
|
121
|
-
estimatePerformance() {
|
|
122
|
-
return wasmUtil.estimatePerformance();
|
|
123
|
-
},
|
|
124
|
-
getMetadata() {
|
|
125
|
-
return wasmUtil.getMetadata();
|
|
126
|
-
},
|
|
127
|
-
getCheck() {
|
|
128
|
-
return wasmUtil.getCheck();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
//#endregion
|
|
134
|
-
//#region src/internal/deepsight/motionStatusService.ts
|
|
135
|
-
function createMotionStatusService(motionSensor) {
|
|
136
|
-
return {
|
|
137
|
-
async requestPermission() {
|
|
138
|
-
return motionSensor.requestPermission();
|
|
139
|
-
},
|
|
140
|
-
async start() {
|
|
141
|
-
await motionSensor.start();
|
|
142
|
-
},
|
|
143
|
-
stop() {
|
|
144
|
-
motionSensor.stop();
|
|
145
|
-
},
|
|
146
|
-
check() {
|
|
147
|
-
return motionSensor.check();
|
|
148
|
-
},
|
|
149
|
-
get isRunning() {
|
|
150
|
-
return motionSensor.isRunning;
|
|
151
|
-
},
|
|
152
|
-
get hasPermission() {
|
|
153
|
-
return motionSensor.hasPermission;
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/internal/deepsight/deepsightService.ts
|
|
160
|
-
function createDeepsightService(config) {
|
|
161
|
-
const metadata = createMetadataService(config.wasmUtil, config.visibility);
|
|
162
|
-
const motion = createMotionStatusService(config.motionSensor);
|
|
163
|
-
return {
|
|
164
|
-
metadata,
|
|
165
|
-
motion,
|
|
166
|
-
recorder: config.recorder,
|
|
167
|
-
async initialize(disableIpify = false) {
|
|
168
|
-
await metadata.initialize(config.sdkVersion, disableIpify);
|
|
169
|
-
metadata.estimatePerformance();
|
|
170
|
-
},
|
|
171
|
-
async requestMotionPermission() {
|
|
172
|
-
return motion.requestPermission();
|
|
173
|
-
},
|
|
174
|
-
async startMotionSensors() {
|
|
175
|
-
await motion.start();
|
|
176
|
-
},
|
|
177
|
-
stopMotionSensors() {
|
|
178
|
-
motion.stop();
|
|
179
|
-
},
|
|
180
|
-
startRecording(stream) {
|
|
181
|
-
config.recorder.startRecording(stream);
|
|
182
|
-
},
|
|
183
|
-
async checkVirtualCamera(videoTrack) {
|
|
184
|
-
metadata.updateCameraInfo(videoTrack);
|
|
185
|
-
return metadata.checkForVirtualCameraByLabel(videoTrack);
|
|
186
|
-
},
|
|
187
|
-
async performVirtualCameraCheck() {
|
|
188
|
-
const output = {
|
|
189
|
-
canvas: null,
|
|
190
|
-
itr: null,
|
|
191
|
-
skipped: null
|
|
192
|
-
};
|
|
193
|
-
await config.wasmUtil.poc(output);
|
|
194
|
-
if (output?.skipped === false) config.wasmUtil.setZc(output?.itr === true ? "FAIL" : "PASS");
|
|
195
|
-
},
|
|
196
|
-
async performCapture(sessionToken, imageData) {
|
|
197
|
-
let recordingId = null;
|
|
198
|
-
if (config.recorder.isRecording) {
|
|
199
|
-
const result = await config.recorder.stopRecording(10, (base64) => config.wasmUtil.encryptImage(base64), (buffer) => config.wasmUtil.ckvcks(buffer));
|
|
200
|
-
try {
|
|
201
|
-
recordingId = await config.uploadVideo(result.encryptedVideo, sessionToken);
|
|
202
|
-
} catch (error) {
|
|
203
|
-
console.error("[DeepsightService] Failed to upload video:", error);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
await this.performVirtualCameraCheck();
|
|
207
|
-
await metadata.analyzeFrame(imageData);
|
|
208
|
-
const motionStatus = motion.check();
|
|
209
|
-
metadata.setMotionStatus(motionStatus);
|
|
210
|
-
metadata.getCheck();
|
|
211
|
-
metadata.setBackgroundMode(false);
|
|
212
|
-
return {
|
|
213
|
-
metadata: metadata.getMetadata(),
|
|
214
|
-
recordingId
|
|
215
|
-
};
|
|
216
|
-
},
|
|
217
|
-
cleanup() {
|
|
218
|
-
motion.stop();
|
|
219
|
-
config.recorder.reset();
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
//#endregion
|
|
225
|
-
export { createDeepsightService as t };
|
|
@@ -1,40 +0,0 @@
|
|
|
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 };
|
|
File without changes
|
|
File without changes
|