@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,4 +1,4 @@
|
|
|
1
|
-
import { a as __toDynamicImportESM } from "./chunk-
|
|
1
|
+
import { a as __toDynamicImportESM } from "./chunk-V5DOKNPJ.esm.js";
|
|
2
2
|
|
|
3
3
|
//#region ../infra/src/capabilities/platform.ts
|
|
4
4
|
/**
|
|
@@ -186,7 +186,7 @@ const createApi = (config) => {
|
|
|
186
186
|
baseURL: config.apiURL,
|
|
187
187
|
headers
|
|
188
188
|
};
|
|
189
|
-
const client
|
|
189
|
+
const client = {
|
|
190
190
|
defaults,
|
|
191
191
|
async request(requestConfig) {
|
|
192
192
|
const { method = "GET", url, headers: headers$1 = {}, query, params, body, signal, timeout = config.timeout ?? DEFAULT_TIMEOUT, parse, onUploadProgress } = requestConfig;
|
|
@@ -238,14 +238,14 @@ const createApi = (config) => {
|
|
|
238
238
|
}
|
|
239
239
|
},
|
|
240
240
|
get(url, config$1) {
|
|
241
|
-
return client
|
|
241
|
+
return client.request({
|
|
242
242
|
...config$1,
|
|
243
243
|
url,
|
|
244
244
|
method: "GET"
|
|
245
245
|
});
|
|
246
246
|
},
|
|
247
247
|
post(url, body, config$1) {
|
|
248
|
-
return client
|
|
248
|
+
return client.request({
|
|
249
249
|
...config$1,
|
|
250
250
|
url,
|
|
251
251
|
body,
|
|
@@ -253,7 +253,7 @@ const createApi = (config) => {
|
|
|
253
253
|
});
|
|
254
254
|
},
|
|
255
255
|
put(url, body, config$1) {
|
|
256
|
-
return client
|
|
256
|
+
return client.request({
|
|
257
257
|
...config$1,
|
|
258
258
|
url,
|
|
259
259
|
body,
|
|
@@ -261,7 +261,7 @@ const createApi = (config) => {
|
|
|
261
261
|
});
|
|
262
262
|
},
|
|
263
263
|
patch(url, body, config$1) {
|
|
264
|
-
return client
|
|
264
|
+
return client.request({
|
|
265
265
|
...config$1,
|
|
266
266
|
url,
|
|
267
267
|
body,
|
|
@@ -269,21 +269,21 @@ const createApi = (config) => {
|
|
|
269
269
|
});
|
|
270
270
|
},
|
|
271
271
|
delete(url, config$1) {
|
|
272
|
-
return client
|
|
272
|
+
return client.request({
|
|
273
273
|
...config$1,
|
|
274
274
|
url,
|
|
275
275
|
method: "DELETE"
|
|
276
276
|
});
|
|
277
277
|
},
|
|
278
278
|
head(url, config$1) {
|
|
279
|
-
return client
|
|
279
|
+
return client.request({
|
|
280
280
|
...config$1,
|
|
281
281
|
url,
|
|
282
282
|
method: "HEAD"
|
|
283
283
|
});
|
|
284
284
|
},
|
|
285
285
|
options(url, config$1) {
|
|
286
|
-
return client
|
|
286
|
+
return client.request({
|
|
287
287
|
...config$1,
|
|
288
288
|
url,
|
|
289
289
|
method: "OPTIONS"
|
|
@@ -293,7 +293,7 @@ const createApi = (config) => {
|
|
|
293
293
|
defaults.headers[name] = value;
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
return client
|
|
296
|
+
return client;
|
|
297
297
|
};
|
|
298
298
|
var createApi_default = createApi;
|
|
299
299
|
|
|
@@ -344,7 +344,7 @@ function createManager(options) {
|
|
|
344
344
|
});
|
|
345
345
|
return () => subscription.unsubscribe();
|
|
346
346
|
}
|
|
347
|
-
const api
|
|
347
|
+
const api = createApi$1({
|
|
348
348
|
actor,
|
|
349
349
|
getSnapshot
|
|
350
350
|
});
|
|
@@ -355,7 +355,7 @@ function createManager(options) {
|
|
|
355
355
|
actor.stop();
|
|
356
356
|
}
|
|
357
357
|
};
|
|
358
|
-
return Object.defineProperties(base, Object.getOwnPropertyDescriptors(api
|
|
358
|
+
return Object.defineProperties(base, Object.getOwnPropertyDescriptors(api));
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
//#endregion
|
|
@@ -419,6 +419,16 @@ var IncodeCanvas = class IncodeCanvas {
|
|
|
419
419
|
return this.canvas && this.canvas.width > 1 && this.canvas.height > 1;
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
422
|
+
* Disposes of resources, including revoking object URLs to prevent memory leaks.
|
|
423
|
+
*/
|
|
424
|
+
dispose() {
|
|
425
|
+
if (this.blobData?.url) {
|
|
426
|
+
URL.revokeObjectURL(this.blobData.url);
|
|
427
|
+
this.blobData = null;
|
|
428
|
+
}
|
|
429
|
+
this.base64Image = null;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
422
432
|
* Release the data stored by IncodeCanvas.
|
|
423
433
|
*/
|
|
424
434
|
release() {
|
|
@@ -427,9 +437,23 @@ var IncodeCanvas = class IncodeCanvas {
|
|
|
427
437
|
this.canvas.height = 1;
|
|
428
438
|
this.canvas.getContext("2d")?.clearRect(0, 0, 1, 1);
|
|
429
439
|
this.base64Image = null;
|
|
440
|
+
if (this.blobData?.url) URL.revokeObjectURL(this.blobData.url);
|
|
430
441
|
this.blobData = null;
|
|
431
442
|
}
|
|
432
443
|
/**
|
|
444
|
+
* Revokes the object URL if one exists, preventing memory leaks.
|
|
445
|
+
* Use this when you no longer need the preview image URL.
|
|
446
|
+
*/
|
|
447
|
+
revokeObjectURL() {
|
|
448
|
+
if (this.blobData?.url) {
|
|
449
|
+
URL.revokeObjectURL(this.blobData.url);
|
|
450
|
+
this.blobData = {
|
|
451
|
+
...this.blobData,
|
|
452
|
+
url: ""
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
433
457
|
* Get the width of the canvas.
|
|
434
458
|
*/
|
|
435
459
|
width() {
|
|
@@ -587,6 +611,34 @@ var IncodeCanvas = class IncodeCanvas {
|
|
|
587
611
|
}
|
|
588
612
|
};
|
|
589
613
|
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region ../infra/src/media/video.ts
|
|
616
|
+
/**
|
|
617
|
+
* Creates a hidden video element for a stream and appends it to document.body.
|
|
618
|
+
*/
|
|
619
|
+
function createHiddenVideoElement(stream) {
|
|
620
|
+
if (typeof document === "undefined") throw new Error("Document not available");
|
|
621
|
+
const video = document.createElement("video");
|
|
622
|
+
video.autoplay = true;
|
|
623
|
+
video.playsInline = true;
|
|
624
|
+
video.muted = true;
|
|
625
|
+
video.srcObject = stream;
|
|
626
|
+
video.style.width = "0px";
|
|
627
|
+
video.style.height = "0px";
|
|
628
|
+
video.style.position = "absolute";
|
|
629
|
+
video.style.top = "0";
|
|
630
|
+
video.style.left = "0";
|
|
631
|
+
video.style.zIndex = "-1";
|
|
632
|
+
document.body.appendChild(video);
|
|
633
|
+
return {
|
|
634
|
+
element: video,
|
|
635
|
+
dispose: () => {
|
|
636
|
+
video.srcObject = null;
|
|
637
|
+
if (video.parentElement) video.parentElement.removeChild(video);
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
590
642
|
//#endregion
|
|
591
643
|
//#region ../infra/src/media/permissions.ts
|
|
592
644
|
async function queryPermission(name) {
|
|
@@ -794,7 +846,6 @@ async function getDurationBySeek(videoBlob) {
|
|
|
794
846
|
}
|
|
795
847
|
}
|
|
796
848
|
async function trimLastNSecondsUsingPlayback(videoBlob, seconds) {
|
|
797
|
-
console.log("[VideoTrimmer] Starting playback-based trimming...");
|
|
798
849
|
const video = document.createElement("video");
|
|
799
850
|
video.preload = "metadata";
|
|
800
851
|
video.playsInline = true;
|
|
@@ -802,14 +853,11 @@ async function trimLastNSecondsUsingPlayback(videoBlob, seconds) {
|
|
|
802
853
|
const videoURL = URL.createObjectURL(videoBlob);
|
|
803
854
|
video.src = videoURL;
|
|
804
855
|
const duration = await getDurationBySeek(videoBlob);
|
|
805
|
-
console.log("[VideoTrimmer] Video duration:", duration);
|
|
806
856
|
if (!duration || duration < seconds) {
|
|
807
|
-
console.log("[VideoTrimmer] Video too short, returning original");
|
|
808
857
|
URL.revokeObjectURL(videoURL);
|
|
809
858
|
return videoBlob;
|
|
810
859
|
}
|
|
811
860
|
const startTime = Math.max(0, Math.floor(duration) - seconds);
|
|
812
|
-
console.log("[VideoTrimmer] Trimming from", startTime, "to", duration);
|
|
813
861
|
await new Promise((resolve) => {
|
|
814
862
|
if (video.readyState >= 2) resolve();
|
|
815
863
|
else video.addEventListener("loadedmetadata", () => resolve(), { once: true });
|
|
@@ -837,21 +885,17 @@ async function trimLastNSecondsUsingPlayback(videoBlob, seconds) {
|
|
|
837
885
|
};
|
|
838
886
|
const recordingPromise = new Promise((resolve) => {
|
|
839
887
|
mediaRecorder.onstop = () => {
|
|
840
|
-
|
|
841
|
-
const trimmedBlob = new Blob(chunks, { type: mimeType });
|
|
888
|
+
const trimmedBlob$1 = new Blob(chunks, { type: mimeType });
|
|
842
889
|
URL.revokeObjectURL(videoURL);
|
|
843
890
|
mediaRecorder.stream?.getTracks().forEach((track) => track.stop());
|
|
844
891
|
stream.getTracks().forEach((track) => track.stop());
|
|
845
892
|
video.src = "";
|
|
846
|
-
|
|
847
|
-
resolve(trimmedBlob);
|
|
893
|
+
resolve(trimmedBlob$1);
|
|
848
894
|
};
|
|
849
895
|
});
|
|
850
896
|
video.addEventListener("play", () => {
|
|
851
|
-
console.log("[VideoTrimmer] Video playing, starting recording...");
|
|
852
897
|
function drawVideo() {
|
|
853
898
|
if (video.currentTime >= duration) {
|
|
854
|
-
console.log("[VideoTrimmer] Reached end, stopping...");
|
|
855
899
|
mediaRecorder.stop();
|
|
856
900
|
video.pause();
|
|
857
901
|
return;
|
|
@@ -861,25 +905,185 @@ async function trimLastNSecondsUsingPlayback(videoBlob, seconds) {
|
|
|
861
905
|
}
|
|
862
906
|
drawVideo();
|
|
863
907
|
setTimeout(() => {
|
|
864
|
-
console.log("[VideoTrimmer] Starting MediaRecorder...");
|
|
865
908
|
mediaRecorder.start(100);
|
|
866
909
|
}, 500);
|
|
867
910
|
});
|
|
868
|
-
|
|
869
|
-
video.play().catch((err) => {
|
|
870
|
-
console.error("[VideoTrimmer] Play failed:", err);
|
|
911
|
+
video.play().catch(() => {
|
|
871
912
|
URL.revokeObjectURL(videoURL);
|
|
872
913
|
});
|
|
873
|
-
|
|
914
|
+
const trimmedBlob = await recordingPromise;
|
|
915
|
+
console.timeEnd("trimLastNSecondsUsingPlayback");
|
|
916
|
+
return trimmedBlob;
|
|
874
917
|
}
|
|
875
918
|
async function trimLastNSeconds(videoBlob, seconds) {
|
|
876
|
-
console.log(`[VideoTrimmer] trimLastNSeconds called (trim to ${seconds}s from ${videoBlob.size} bytes)`);
|
|
877
|
-
console.log("[VideoTrimmer] Using playback-based trimming");
|
|
878
919
|
return await trimLastNSecondsUsingPlayback(videoBlob, seconds);
|
|
879
920
|
}
|
|
880
921
|
|
|
881
922
|
//#endregion
|
|
882
|
-
//#region ../infra/src/providers/browser/
|
|
923
|
+
//#region ../infra/src/providers/browser/BrowserEnvironmentProvider.ts
|
|
924
|
+
var BrowserEnvironmentProvider = class {
|
|
925
|
+
getScreenDimensions() {
|
|
926
|
+
if (typeof screen === "undefined") return {
|
|
927
|
+
width: 0,
|
|
928
|
+
height: 0
|
|
929
|
+
};
|
|
930
|
+
return {
|
|
931
|
+
width: screen.width,
|
|
932
|
+
height: screen.height
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
generateCanvasFingerprint() {
|
|
936
|
+
try {
|
|
937
|
+
if (typeof document === "undefined") return "";
|
|
938
|
+
const canvas = document.createElement("canvas");
|
|
939
|
+
const ctx = canvas.getContext("2d");
|
|
940
|
+
if (!ctx) return "";
|
|
941
|
+
ctx.textBaseline = "top";
|
|
942
|
+
ctx.font = "14px Arial";
|
|
943
|
+
ctx.fillText("fingerprint", 2, 2);
|
|
944
|
+
return canvas.toDataURL().slice(-50);
|
|
945
|
+
} catch {
|
|
946
|
+
return "";
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
getWebGLRenderer() {
|
|
950
|
+
try {
|
|
951
|
+
if (typeof document === "undefined") return "";
|
|
952
|
+
const canvas = document.createElement("canvas");
|
|
953
|
+
const gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
954
|
+
if (!gl) return "";
|
|
955
|
+
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
956
|
+
if (!debugInfo) return "";
|
|
957
|
+
return gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) || "";
|
|
958
|
+
} catch {
|
|
959
|
+
return "";
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
getWindowProperty(prop) {
|
|
963
|
+
if (typeof window === "undefined") return;
|
|
964
|
+
return window[prop];
|
|
965
|
+
}
|
|
966
|
+
getNavigatorProperty(prop) {
|
|
967
|
+
if (typeof navigator === "undefined") return;
|
|
968
|
+
return navigator[prop];
|
|
969
|
+
}
|
|
970
|
+
getNavigatorPrefixes() {
|
|
971
|
+
if (typeof navigator === "undefined") return {
|
|
972
|
+
webkit: false,
|
|
973
|
+
moz: false,
|
|
974
|
+
o: false,
|
|
975
|
+
ms: false
|
|
976
|
+
};
|
|
977
|
+
const nav = navigator;
|
|
978
|
+
return {
|
|
979
|
+
webkit: nav.webkitGetUserMedia !== void 0,
|
|
980
|
+
moz: nav.mozGetUserMedia !== void 0,
|
|
981
|
+
o: nav.oGetUserMedia !== void 0,
|
|
982
|
+
ms: nav.msGetUserMedia !== void 0
|
|
983
|
+
};
|
|
984
|
+
}
|
|
985
|
+
async fetchJson(url, timeoutMs = 3e3) {
|
|
986
|
+
try {
|
|
987
|
+
if (typeof fetch === "undefined") return null;
|
|
988
|
+
const controller = new AbortController();
|
|
989
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
990
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
991
|
+
clearTimeout(timeoutId);
|
|
992
|
+
return await response.json();
|
|
993
|
+
} catch {
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
async enumerateVideoDeviceLabels() {
|
|
998
|
+
try {
|
|
999
|
+
if (typeof navigator === "undefined" || !navigator.mediaDevices?.enumerateDevices) return [];
|
|
1000
|
+
return (await navigator.mediaDevices.enumerateDevices()).filter((device) => device.kind === "videoinput").map((device) => device.label);
|
|
1001
|
+
} catch {
|
|
1002
|
+
return [];
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
getTimestamp() {
|
|
1006
|
+
return Date.now();
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region ../infra/src/providers/browser/BrowserStorageProvider.ts
|
|
1012
|
+
/**
|
|
1013
|
+
* Browser-based storage provider wrapping localStorage.
|
|
1014
|
+
* Handles JSON serialization/deserialization automatically.
|
|
1015
|
+
*/
|
|
1016
|
+
var BrowserStorageProvider = class {
|
|
1017
|
+
/**
|
|
1018
|
+
* Retrieves a value from localStorage.
|
|
1019
|
+
* @param key - The storage key
|
|
1020
|
+
* @returns The stored value or null if not found
|
|
1021
|
+
* @throws Error if stored value is invalid JSON
|
|
1022
|
+
*/
|
|
1023
|
+
async get(key) {
|
|
1024
|
+
try {
|
|
1025
|
+
const item = localStorage.getItem(key);
|
|
1026
|
+
if (item === null) return null;
|
|
1027
|
+
return JSON.parse(item);
|
|
1028
|
+
} catch (error) {
|
|
1029
|
+
if (error instanceof SyntaxError) throw new Error(`Invalid JSON stored at key "${key}": ${error.message}`);
|
|
1030
|
+
throw error;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Stores a value in localStorage.
|
|
1035
|
+
* @param key - The storage key
|
|
1036
|
+
* @param value - The value to store (will be serialized as JSON)
|
|
1037
|
+
* @throws Error if value cannot be serialized or quota is exceeded
|
|
1038
|
+
*/
|
|
1039
|
+
async set(key, value) {
|
|
1040
|
+
try {
|
|
1041
|
+
const serialized = JSON.stringify(value);
|
|
1042
|
+
localStorage.setItem(key, serialized);
|
|
1043
|
+
} catch (error) {
|
|
1044
|
+
if ((error instanceof DOMException || error.name === "QuotaExceededError") && error.name === "QuotaExceededError") throw new Error(`Storage quota exceeded for key "${key}"`);
|
|
1045
|
+
if (error instanceof TypeError) throw new Error(`Failed to serialize value for key "${key}": ${error.message}`);
|
|
1046
|
+
throw error;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Removes a value from localStorage.
|
|
1051
|
+
* @param key - The storage key to remove
|
|
1052
|
+
*/
|
|
1053
|
+
async remove(key) {
|
|
1054
|
+
localStorage.removeItem(key);
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Clears all values from localStorage.
|
|
1058
|
+
*/
|
|
1059
|
+
async clear() {
|
|
1060
|
+
localStorage.clear();
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region ../infra/src/providers/browser/BrowserTimerProvider.ts
|
|
1066
|
+
var BrowserTimerProvider = class BrowserTimerProvider {
|
|
1067
|
+
static getInstance() {
|
|
1068
|
+
if (!BrowserTimerProvider.instance) BrowserTimerProvider.instance = new BrowserTimerProvider();
|
|
1069
|
+
return BrowserTimerProvider.instance;
|
|
1070
|
+
}
|
|
1071
|
+
setTimeout(callback, delayMs) {
|
|
1072
|
+
return setTimeout(callback, delayMs);
|
|
1073
|
+
}
|
|
1074
|
+
setInterval(callback, delayMs) {
|
|
1075
|
+
return setInterval(callback, delayMs);
|
|
1076
|
+
}
|
|
1077
|
+
clearTimeout(handle) {
|
|
1078
|
+
clearTimeout(handle);
|
|
1079
|
+
}
|
|
1080
|
+
clearInterval(handle) {
|
|
1081
|
+
clearInterval(handle);
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region ../infra/src/providers/browser/LocalRecordingProvider.ts
|
|
883
1087
|
function toBase64(videoBlob) {
|
|
884
1088
|
return new Promise((resolve, reject) => {
|
|
885
1089
|
const reader = new FileReader();
|
|
@@ -919,7 +1123,7 @@ function getAdaptiveMediaRecorderOptions() {
|
|
|
919
1123
|
bitsPerSecond: 5e5
|
|
920
1124
|
};
|
|
921
1125
|
}
|
|
922
|
-
var
|
|
1126
|
+
var LocalRecordingProvider = class {
|
|
923
1127
|
constructor() {
|
|
924
1128
|
this.mediaRecorder = null;
|
|
925
1129
|
this._isRecording = false;
|
|
@@ -957,7 +1161,6 @@ var DeepsightRecordingProvider = class {
|
|
|
957
1161
|
this._error = null;
|
|
958
1162
|
this._hasError = false;
|
|
959
1163
|
} catch (err) {
|
|
960
|
-
console.error(`Failed to start recording: ${err}`);
|
|
961
1164
|
this._error = `Failed to start recording: ${err}`;
|
|
962
1165
|
this._hasError = true;
|
|
963
1166
|
}
|
|
@@ -1273,13 +1476,13 @@ var MotionSensorProvider = class {
|
|
|
1273
1476
|
//#region ../infra/src/providers/browser/openviduLazy.ts
|
|
1274
1477
|
let openViduImport;
|
|
1275
1478
|
async function enableProdModeBeforeLoad() {
|
|
1276
|
-
const { OpenViduLogger } = await import("./OpenViduLogger-
|
|
1479
|
+
const { OpenViduLogger } = await import("./OpenViduLogger-DyqID_-7.esm.js").then(__toDynamicImportESM(1));
|
|
1277
1480
|
OpenViduLogger.getInstance().enableProdMode();
|
|
1278
1481
|
}
|
|
1279
1482
|
async function loadOpenVidu() {
|
|
1280
1483
|
if (openViduImport) return openViduImport;
|
|
1281
1484
|
await enableProdModeBeforeLoad();
|
|
1282
|
-
openViduImport = import("./lib-
|
|
1485
|
+
openViduImport = import("./lib-CbAibJlt.esm.js").then(__toDynamicImportESM(1));
|
|
1283
1486
|
return openViduImport;
|
|
1284
1487
|
}
|
|
1285
1488
|
|
|
@@ -2533,6 +2736,10 @@ var WasmUtilProvider = class WasmUtilProvider extends BaseWasmProvider {
|
|
|
2533
2736
|
this.ensureInitialized();
|
|
2534
2737
|
return mlWasmJSApi_default.isVirtualCamera(label);
|
|
2535
2738
|
}
|
|
2739
|
+
async prc() {
|
|
2740
|
+
this.ensureInitialized();
|
|
2741
|
+
await mlWasmJSApi_default.prc();
|
|
2742
|
+
}
|
|
2536
2743
|
async poc(output) {
|
|
2537
2744
|
this.ensureInitialized();
|
|
2538
2745
|
await mlWasmJSApi_default.poc(output);
|
|
@@ -2571,80 +2778,4 @@ const DEFAULT_ID_CAPTURE_THRESHOLDS = {
|
|
|
2571
2778
|
const DEFAULT_ID_CAPTURE_MODEL_VERSION = "v2";
|
|
2572
2779
|
|
|
2573
2780
|
//#endregion
|
|
2574
|
-
|
|
2575
|
-
let client = null;
|
|
2576
|
-
let currentToken = null;
|
|
2577
|
-
function setClient(httpClient) {
|
|
2578
|
-
client = httpClient;
|
|
2579
|
-
}
|
|
2580
|
-
function setToken(token) {
|
|
2581
|
-
currentToken = token;
|
|
2582
|
-
}
|
|
2583
|
-
function getToken() {
|
|
2584
|
-
return currentToken;
|
|
2585
|
-
}
|
|
2586
|
-
function getApi() {
|
|
2587
|
-
if (!client) throw new Error("SDK not configured. Call setup({ apiURL: \"...\" }) first.");
|
|
2588
|
-
return client;
|
|
2589
|
-
}
|
|
2590
|
-
function resetApi() {
|
|
2591
|
-
client = null;
|
|
2592
|
-
currentToken = null;
|
|
2593
|
-
}
|
|
2594
|
-
function addTokenHeader(config) {
|
|
2595
|
-
if (!currentToken) return config ?? {};
|
|
2596
|
-
return {
|
|
2597
|
-
...config,
|
|
2598
|
-
headers: {
|
|
2599
|
-
...config?.headers,
|
|
2600
|
-
"X-Incode-Hardware-Id": currentToken
|
|
2601
|
-
}
|
|
2602
|
-
};
|
|
2603
|
-
}
|
|
2604
|
-
const api = {
|
|
2605
|
-
get(url, config) {
|
|
2606
|
-
return getApi().get(url, addTokenHeader(config));
|
|
2607
|
-
},
|
|
2608
|
-
post(url, data, config) {
|
|
2609
|
-
return getApi().post(url, data, addTokenHeader(config));
|
|
2610
|
-
},
|
|
2611
|
-
put(url, data, config) {
|
|
2612
|
-
return getApi().put(url, data, addTokenHeader(config));
|
|
2613
|
-
},
|
|
2614
|
-
patch(url, data, config) {
|
|
2615
|
-
return getApi().patch(url, data, addTokenHeader(config));
|
|
2616
|
-
},
|
|
2617
|
-
delete(url, config) {
|
|
2618
|
-
return getApi().delete(url, addTokenHeader(config));
|
|
2619
|
-
}
|
|
2620
|
-
};
|
|
2621
|
-
|
|
2622
|
-
//#endregion
|
|
2623
|
-
//#region src/internal/http/endpoints.ts
|
|
2624
|
-
const endpoints = {
|
|
2625
|
-
createSession: "/omni/start",
|
|
2626
|
-
flow: "/omni/onboarding/flow",
|
|
2627
|
-
events: "/omni/interview-events",
|
|
2628
|
-
selfie: "/omni/add/face",
|
|
2629
|
-
recordingCreateSessionV2: "/omni/recordings/create-session/v2",
|
|
2630
|
-
recordingStartV2: "/omni/recordings/record-start/v2",
|
|
2631
|
-
recordingStopV2: "/omni/recordings/record-stop/v2",
|
|
2632
|
-
deepsightVideoImport: "/omni/recordings/import",
|
|
2633
|
-
phone: "/omni/add/phone",
|
|
2634
|
-
phoneInstant: "/omni/instant/add/phone",
|
|
2635
|
-
getPhone: "/omni/get/phone",
|
|
2636
|
-
startInfo: "/omni/start-info",
|
|
2637
|
-
sendSmsOtp: "/omni/send/sms-otp",
|
|
2638
|
-
compareOtp: "/omni/compare/otp",
|
|
2639
|
-
email: "/omni/add/email",
|
|
2640
|
-
getEmail: "/omni/get/email",
|
|
2641
|
-
frontId: "/omni/add/front-id/v2",
|
|
2642
|
-
backId: "/omni/add/back-id/v2",
|
|
2643
|
-
getImages: "/omni/get/images",
|
|
2644
|
-
processId: "/omni/process/id",
|
|
2645
|
-
processSecondId: "/omni/process/second-id",
|
|
2646
|
-
processFace: "/omni/process/face"
|
|
2647
|
-
};
|
|
2648
|
-
|
|
2649
|
-
//#endregion
|
|
2650
|
-
export { isIOS as A, enumerateVideoDevices as C, createApi_default as D, createManager as E, isSafari as M, isAndroid as O, applyTrackConstraints as S, stopCameraStream as T, DeepsightRecordingProvider as _, resetApi as a, queryCameraPermission as b, DEFAULT_ID_CAPTURE_MODEL_VERSION as c, IdCaptureProvider as d, FaceDetectionProvider as f, MotionSensorProvider as g, OpenViduRecordingProvider as h, getToken as i, isIPhone14OrHigher as j, isDesktop as k, DEFAULT_ID_CAPTURE_THRESHOLDS as l, VisibilityProvider as m, api as n, setClient as o, warmupWasm as p, getApi as r, setToken as s, endpoints as t, WasmUtilProvider as u, StreamCanvasProcessingSession as v, requestCameraAccess as w, IncodeCanvas as x, StreamCanvasCapture as y };
|
|
2781
|
+
export { createManager as C, isIOS as D, isDesktop as E, isIPhone14OrHigher as O, stopCameraStream as S, isAndroid as T, createHiddenVideoElement as _, FaceDetectionProvider as a, enumerateVideoDevices as b, OpenViduRecordingProvider as c, BrowserTimerProvider as d, BrowserStorageProvider as f, queryCameraPermission as g, StreamCanvasCapture as h, IdCaptureProvider as i, isSafari as k, MotionSensorProvider as l, StreamCanvasProcessingSession as m, DEFAULT_ID_CAPTURE_THRESHOLDS as n, warmupWasm as o, BrowserEnvironmentProvider as p, WasmUtilProvider as r, VisibilityProvider as s, DEFAULT_ID_CAPTURE_MODEL_VERSION as t, LocalRecordingProvider as u, IncodeCanvas as v, createApi_default as w, requestCameraAccess as x, applyTrackConstraints as y };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as api } from "./api-DfRLAneb.esm.js";
|
|
2
|
+
|
|
3
|
+
//#region src/modules/stats/statsServices.ts
|
|
4
|
+
/**
|
|
5
|
+
* Sends device stats to the backend.
|
|
6
|
+
*/
|
|
7
|
+
async function addDeviceStats(stats) {
|
|
8
|
+
try {
|
|
9
|
+
await api.post("/omni/device/stats", stats);
|
|
10
|
+
} catch {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { addDeviceStats as t };
|
package/dist/stats.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/modules/stats/statsServices.d.ts
|
|
2
|
+
type LabelInspectionStatus = 'FAIL' | 'PASS';
|
|
3
|
+
type DeviceStats = {
|
|
4
|
+
cameraLabelInspectionStatus?: LabelInspectionStatus;
|
|
5
|
+
virtualCameraDetected?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Sends device stats to the backend.
|
|
9
|
+
*/
|
|
10
|
+
declare function addDeviceStats(stats: DeviceStats): Promise<void>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { type DeviceStats, type LabelInspectionStatus, addDeviceStats };
|
|
@@ -1,39 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as stopCameraStream, g as queryCameraPermission, x as requestCameraAccess } from "./src-DYtpbFY5.esm.js";
|
|
2
|
+
import { r as getUserAgent, t as getDeviceInfo } from "./getDeviceClass-DkfbtsIJ.esm.js";
|
|
3
|
+
import { t as endpoints } from "./endpoints-BUsSVoJV.esm.js";
|
|
4
|
+
import { t as api } from "./api-DfRLAneb.esm.js";
|
|
3
5
|
|
|
4
|
-
//#region ../infra/src/device/getDeviceClass.ts
|
|
5
|
-
function getDeviceInfo() {
|
|
6
|
-
if (typeof navigator === "undefined") return {
|
|
7
|
-
userAgent: "",
|
|
8
|
-
platform: "",
|
|
9
|
-
maxTouchPoints: 0
|
|
10
|
-
};
|
|
11
|
-
return {
|
|
12
|
-
userAgent: navigator.userAgent,
|
|
13
|
-
platform: navigator.platform,
|
|
14
|
-
maxTouchPoints: navigator.maxTouchPoints
|
|
15
|
-
};
|
|
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
|
-
}
|
|
35
|
-
|
|
36
|
-
//#endregion
|
|
37
6
|
//#region src/internal/device/getBrowser.ts
|
|
38
7
|
function getBrowser() {
|
|
39
8
|
const userAgent = getUserAgent();
|
|
@@ -80,6 +49,36 @@ async function requestPermission() {
|
|
|
80
49
|
}
|
|
81
50
|
}
|
|
82
51
|
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/internal/recordings/recordingsRepository.ts
|
|
54
|
+
async function createRecordingSession(type) {
|
|
55
|
+
return (await api.post(endpoints.recordingCreateSessionV2, { type })).data;
|
|
56
|
+
}
|
|
57
|
+
async function startRecording(params) {
|
|
58
|
+
return (await api.post(endpoints.recordingStartV2, {
|
|
59
|
+
videoRecordingId: params.videoRecordingId,
|
|
60
|
+
frameRate: 30,
|
|
61
|
+
outputMode: "COMPOSED",
|
|
62
|
+
resolution: params.resolution,
|
|
63
|
+
type: params.type,
|
|
64
|
+
hasAudio: params.hasAudio ?? false
|
|
65
|
+
})).data;
|
|
66
|
+
}
|
|
67
|
+
async function stopRecording(videoRecordingId) {
|
|
68
|
+
return (await api.post(endpoints.recordingStopV2, { videoRecordingId })).data;
|
|
69
|
+
}
|
|
70
|
+
async function uploadDeepsightVideo(encryptedVideo, token) {
|
|
71
|
+
try {
|
|
72
|
+
return (await api.post(endpoints.deepsightVideoImport, {
|
|
73
|
+
video: encryptedVideo,
|
|
74
|
+
type: "selfie"
|
|
75
|
+
}, { headers: { "X-Incode-Hardware-Id": token } })).data.recordingId ?? "";
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error("Error uploading deepsight video:", error);
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
83
82
|
//#endregion
|
|
84
83
|
//#region src/internal/recordings/streamingEvents.ts
|
|
85
84
|
const streamingEvents = {
|
|
@@ -94,4 +93,4 @@ const streamingEvents = {
|
|
|
94
93
|
};
|
|
95
94
|
|
|
96
95
|
//#endregion
|
|
97
|
-
export {
|
|
96
|
+
export { uploadDeepsightVideo as a, getDeviceClass as c, stopRecording as i, getBrowser as l, createRecordingSession as n, checkPermission as o, startRecording as r, requestPermission as s, streamingEvents as t };
|