idmission-web-sdk 2.3.124 → 2.3.125
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/components/video_signature_capture/VideoSignatureContext.d.ts +26 -0
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +214 -85
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +214 -85
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +214 -85
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { SignatureData } from '../signature_capture/data';
|
|
3
3
|
import SignatureCanvas from 'react-signature-canvas';
|
|
4
|
+
type VideoChunkRateStats = {
|
|
5
|
+
averageRate: number;
|
|
6
|
+
minRate: number;
|
|
7
|
+
maxRate: number;
|
|
8
|
+
totalChunksReceived: number;
|
|
9
|
+
recordingDurationMs: number;
|
|
10
|
+
};
|
|
4
11
|
export type VideoSignatureMetadata = {
|
|
5
12
|
mimeType?: string;
|
|
6
13
|
browserFeatures?: {
|
|
7
14
|
supportsRequestVideoFrameCallback?: boolean;
|
|
8
15
|
supportsRoundRect?: boolean;
|
|
9
16
|
};
|
|
17
|
+
diagnostics?: {
|
|
18
|
+
nullChunksReceived?: number;
|
|
19
|
+
firstNullChunkReceivedAt?: number;
|
|
20
|
+
lastNullChunkReceivedAt?: number;
|
|
21
|
+
finalChunkReceived?: boolean;
|
|
22
|
+
finalChunkTimedOut?: boolean;
|
|
23
|
+
finalChunkWaitedMs?: number;
|
|
24
|
+
videoChunkRate?: VideoChunkRateStats;
|
|
25
|
+
timesSignatureCleared?: number;
|
|
26
|
+
};
|
|
10
27
|
timingData?: {
|
|
11
28
|
recordingStartRequestedAt?: number;
|
|
12
29
|
recordingStartedAt?: number;
|
|
@@ -14,6 +31,7 @@ export type VideoSignatureMetadata = {
|
|
|
14
31
|
signatureStartedAt?: number;
|
|
15
32
|
signatureEndedAt?: number;
|
|
16
33
|
acceptClickedAt?: number;
|
|
34
|
+
clearClickedAt?: number;
|
|
17
35
|
recordingStopRequestedAt?: number;
|
|
18
36
|
lastChunkReceivedAt?: number;
|
|
19
37
|
recordingStoppedAt?: number;
|
|
@@ -37,8 +55,15 @@ export type VideoSignatureState = {
|
|
|
37
55
|
signatureStartedAt?: number;
|
|
38
56
|
signatureEndedAt?: number;
|
|
39
57
|
acceptClickedAt?: number;
|
|
58
|
+
clearClickedAt?: number;
|
|
40
59
|
supportsRequestVideoFrameCallback?: boolean;
|
|
41
60
|
supportsRoundRect?: boolean;
|
|
61
|
+
nullChunksReceived: number;
|
|
62
|
+
firstNullChunkReceivedAt?: number;
|
|
63
|
+
lastNullChunkReceivedAt?: number;
|
|
64
|
+
timesSignatureCleared: number;
|
|
65
|
+
finalChunkReceived: boolean;
|
|
66
|
+
requestDataInterval?: NodeJS.Timeout;
|
|
42
67
|
onSignatureVideoCaptured: OnSignatureVideoCaptured;
|
|
43
68
|
};
|
|
44
69
|
export declare const useVideoSignatureStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<VideoSignatureState>, "setState"> & {
|
|
@@ -58,4 +83,5 @@ export declare const useVideoSignatureStore: import("zustand").UseBoundStore<Omi
|
|
|
58
83
|
export default function VideoSignatureContextProvider({ children, }: {
|
|
59
84
|
children: ReactNode;
|
|
60
85
|
}): React.JSX.Element;
|
|
86
|
+
export {};
|
|
61
87
|
//# sourceMappingURL=VideoSignatureContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoSignatureContext.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,eAAe,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"VideoSignatureContext.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAkC,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,eAAe,MAAM,wBAAwB,CAAA;AAYpD,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAQD,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE;QAChB,iCAAiC,CAAC,EAAE,OAAO,CAAA;QAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAA;KAC5B,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,wBAAwB,CAAC,EAAE,MAAM,CAAA;QACjC,uBAAuB,CAAC,EAAE,MAAM,CAAA;QAChC,kBAAkB,CAAC,EAAE,OAAO,CAAA;QAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;QAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,cAAc,CAAC,EAAE,mBAAmB,CAAA;QACpC,qBAAqB,CAAC,EAAE,MAAM,CAAA;KAC/B,CAAA;IACD,UAAU,CA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,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kBAAkB,EAAE,OAAO,CAAA;IAE3B,mBAAmB,CAAC,EAAE,MAAM,CAAC,OAAO,CAAA;IACpC,wBAAwB,EAAE,wBAAwB,CAAA;CACnD,CAAA;AAmBD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;EAgNlC,CAAA;AAwDD,MAAM,CAAC,OAAO,UAAU,6BAA6B,CAAC,EACpD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;CACpB,qBA+DA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoSignatureWizard.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAGb,SAAS,EAKV,MAAM,OAAO,CAAA;AACd,OAAO,EAKL,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAMvE,OAAO,EAEL,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,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AC7B,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,QAAQ,CAAC,EAAE,sBAAsB,CAAA;IACjC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAiVD,eAAO,MAAM,oBAAoB,4GAGD,CAAA;
|
|
1
|
+
{"version":3,"file":"VideoSignatureWizard.d.ts","sourceRoot":"","sources":["../../../src/components/video_signature_capture/VideoSignatureWizard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,aAAa,EAGb,SAAS,EAKV,MAAM,OAAO,CAAA;AACd,OAAO,EAKL,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAMvE,OAAO,EAEL,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,EAC9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EAEpB,uBAAuB,EACxB,MAAM,qCAAqC,CAAA;AAG5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAA;AAM/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAA;AACvF,OAA6B,EAE3B,4BAA4B,EAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAsC,EACpC,wBAAwB,EAGzB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEL,6BAA6B,EAC7B,2BAA2B,EAE5B,MAAM,8BAA8B,CAAA;AAoBrC,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,CAAC,EAAE,kBAAkB,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,GAAG;IACvE,YAAY,CAAC,EAAE,sBAAsB,CAAA;IACrC,OAAO,CAAC,EAAE,+BAA+B,CAAA;IAC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O,CAAC,OAAO,CAAC,CAAC,CAAA;IACtD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,8BAA8B,CAAC,EAAE,MAAM,CAAA;IACvC,wBAAwB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1C,uCAAuC,CAAC,EAAE,OAAO,CAAA;IACjD,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,iBAAiB,CAAC,EAAE,uBAAuB,CAAA;IAC3C,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,sCAAsC,CAAC,EAAE,OAAO,CAAA;IAChD,eAAe,CAAC,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAA;IAC7D,6BAA6B,CAAC,EAAE,OAAO,CAAA;IACvC,6BAA6B,CAAC,EAAE,MAAM,CAAA;IACtC,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,2BAA2B,CAAC,EAAE,MAAM,CAAA;IAEpC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,QAAQ,CAAC,EAAE,sBAAsB,CAAA;IACjC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAiVD,eAAO,MAAM,oBAAoB,4GAGD,CAAA;AAiIhC,eAAO,MAAM,iCAAiC;2BAlDrB,MAAM,IAAI;gCACL,MAAM,IAAI;+BACX,MAAM,IAAI;kDAmDM,CAAA"}
|
|
@@ -236,7 +236,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
236
236
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
var webSdkVersion = '2.3.
|
|
239
|
+
var webSdkVersion = '2.3.125';
|
|
240
240
|
|
|
241
241
|
function getPlatform() {
|
|
242
242
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -14409,6 +14409,9 @@ function inferBlobType(blobPart) {
|
|
|
14409
14409
|
|
|
14410
14410
|
var signatureRecorder = null;
|
|
14411
14411
|
var signatureChunks = [];
|
|
14412
|
+
var ondataavailableInvocations = [];
|
|
14413
|
+
var ondataavailableStartTime;
|
|
14414
|
+
var lastCalculatedVideoChunkRate;
|
|
14412
14415
|
var videoSignatureInitialState = {
|
|
14413
14416
|
startRecording: function startRecording() {
|
|
14414
14417
|
return null;
|
|
@@ -14433,6 +14436,10 @@ var videoSignatureInitialState = {
|
|
|
14433
14436
|
signatureValid: false,
|
|
14434
14437
|
supportsRequestVideoFrameCallback: undefined,
|
|
14435
14438
|
supportsRoundRect: undefined,
|
|
14439
|
+
nullChunksReceived: 0,
|
|
14440
|
+
timesSignatureCleared: 0,
|
|
14441
|
+
finalChunkReceived: false,
|
|
14442
|
+
requestDataInterval: undefined,
|
|
14436
14443
|
onSignatureVideoCaptured: function onSignatureVideoCaptured() {
|
|
14437
14444
|
return null;
|
|
14438
14445
|
}
|
|
@@ -14445,8 +14452,11 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14445
14452
|
captureAudio = false;
|
|
14446
14453
|
}
|
|
14447
14454
|
if (!camera) throw new Error('Camera not found');
|
|
14448
|
-
//
|
|
14455
|
+
// clear whatever we have recorded so far.
|
|
14449
14456
|
signatureChunks = [];
|
|
14457
|
+
ondataavailableInvocations = [];
|
|
14458
|
+
ondataavailableStartTime = undefined;
|
|
14459
|
+
lastCalculatedVideoChunkRate = undefined;
|
|
14450
14460
|
// start recording from the output canvas to capture the signature
|
|
14451
14461
|
var outputStream = (_a = get().outputCanvas.current) === null || _a === void 0 ? void 0 : _a.captureStream(24);
|
|
14452
14462
|
if (!outputStream) throw new Error('outputStream not found');
|
|
@@ -14464,77 +14474,123 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14464
14474
|
recordingStartedAt: e.timeStamp
|
|
14465
14475
|
});
|
|
14466
14476
|
};
|
|
14467
|
-
var hasFirstChunk = false;
|
|
14468
14477
|
signatureRecorder.ondataavailable = function (event) {
|
|
14478
|
+
var now = performance.now();
|
|
14469
14479
|
signatureChunks.push(event.data);
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
set({
|
|
14473
|
-
|
|
14474
|
-
|
|
14480
|
+
trackVideoChunkRate(now);
|
|
14481
|
+
if (event.data.size > 0) {
|
|
14482
|
+
set(function (state) {
|
|
14483
|
+
var _a;
|
|
14484
|
+
return {
|
|
14485
|
+
firstChunkReceivedAt: (_a = state.firstChunkReceivedAt) !== null && _a !== void 0 ? _a : now,
|
|
14486
|
+
lastChunkReceivedAt: now
|
|
14487
|
+
};
|
|
14475
14488
|
});
|
|
14476
14489
|
} else {
|
|
14477
|
-
set({
|
|
14478
|
-
|
|
14490
|
+
set(function (state) {
|
|
14491
|
+
var _a;
|
|
14492
|
+
return {
|
|
14493
|
+
nullChunksReceived: state.nullChunksReceived + 1,
|
|
14494
|
+
firstNullChunkReceivedAt: (_a = state.firstNullChunkReceivedAt) !== null && _a !== void 0 ? _a : now,
|
|
14495
|
+
lastNullChunkReceivedAt: now
|
|
14496
|
+
};
|
|
14479
14497
|
});
|
|
14480
14498
|
}
|
|
14481
14499
|
};
|
|
14482
|
-
signatureRecorder.start(
|
|
14500
|
+
signatureRecorder.start();
|
|
14501
|
+
var interval = setInterval(function () {
|
|
14502
|
+
return signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.requestData();
|
|
14503
|
+
}, 250);
|
|
14483
14504
|
set({
|
|
14505
|
+
requestDataInterval: interval,
|
|
14484
14506
|
recordingStartRequestedAt: performance.now()
|
|
14485
14507
|
});
|
|
14486
14508
|
},
|
|
14487
14509
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
14488
14510
|
return __awaiter(this, void 0, void 0, function () {
|
|
14489
|
-
|
|
14490
|
-
|
|
14491
|
-
|
|
14511
|
+
function processVideo() {
|
|
14512
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
14513
|
+
var recordingStoppedAt, mimeType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, acceptClickedAt, clearClickedAt, recordingStopRequestedAt, lastChunkReceivedAt, supportsRequestVideoFrameCallback, supportsRoundRect, nullChunksReceived, firstNullChunkReceivedAt, lastNullChunkReceivedAt, timesSignatureCleared, metadata;
|
|
14514
|
+
return __generator(this, function (_b) {
|
|
14515
|
+
if (get().recordingStoppedAt) return [2 /*return*/];
|
|
14516
|
+
recordingStoppedAt = performance.now();
|
|
14517
|
+
set({
|
|
14518
|
+
recordingStoppedAt: recordingStoppedAt
|
|
14519
|
+
});
|
|
14520
|
+
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
14521
|
+
blob = new Blob(signatureChunks, {
|
|
14522
|
+
type: mimeType
|
|
14523
|
+
});
|
|
14524
|
+
signatureChunks = [];
|
|
14525
|
+
signatureRecorder = null;
|
|
14526
|
+
_a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, acceptClickedAt = _a.acceptClickedAt, clearClickedAt = _a.clearClickedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt, supportsRequestVideoFrameCallback = _a.supportsRequestVideoFrameCallback, supportsRoundRect = _a.supportsRoundRect, nullChunksReceived = _a.nullChunksReceived, firstNullChunkReceivedAt = _a.firstNullChunkReceivedAt, lastNullChunkReceivedAt = _a.lastNullChunkReceivedAt, timesSignatureCleared = _a.timesSignatureCleared;
|
|
14527
|
+
metadata = {
|
|
14528
|
+
mimeType: mimeType,
|
|
14529
|
+
browserFeatures: {
|
|
14530
|
+
supportsRoundRect: supportsRoundRect,
|
|
14531
|
+
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
14532
|
+
},
|
|
14533
|
+
diagnostics: {
|
|
14534
|
+
nullChunksReceived: nullChunksReceived,
|
|
14535
|
+
firstNullChunkReceivedAt: firstNullChunkReceivedAt ? Math.ceil(firstNullChunkReceivedAt) : 0,
|
|
14536
|
+
lastNullChunkReceivedAt: lastNullChunkReceivedAt ? Math.ceil(lastNullChunkReceivedAt) : 0,
|
|
14537
|
+
finalChunkReceived: finalChunkReceived,
|
|
14538
|
+
finalChunkTimedOut: timedOut,
|
|
14539
|
+
finalChunkWaitedMs: Math.ceil(waitedMs),
|
|
14540
|
+
videoChunkRate: lastCalculatedVideoChunkRate,
|
|
14541
|
+
timesSignatureCleared: timesSignatureCleared
|
|
14542
|
+
},
|
|
14543
|
+
timingData: {
|
|
14544
|
+
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
14545
|
+
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
14546
|
+
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
14547
|
+
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
14548
|
+
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
14549
|
+
acceptClickedAt: acceptClickedAt ? Math.ceil(acceptClickedAt) : 0,
|
|
14550
|
+
clearClickedAt: clearClickedAt ? Math.ceil(clearClickedAt) : 0,
|
|
14551
|
+
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
14552
|
+
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
14553
|
+
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
14554
|
+
}
|
|
14555
|
+
};
|
|
14556
|
+
debug('signature video metadata', metadata);
|
|
14557
|
+
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, metadata);
|
|
14558
|
+
return [2 /*return*/];
|
|
14559
|
+
});
|
|
14560
|
+
});
|
|
14561
|
+
}
|
|
14562
|
+
var _a, recordingStartedAt, recordingStopRequestedAt, isRecording, _b, finalChunkReceived, timedOut, waitedMs;
|
|
14563
|
+
return __generator(this, function (_c) {
|
|
14564
|
+
switch (_c.label) {
|
|
14492
14565
|
case 0:
|
|
14566
|
+
_a = get(), recordingStartedAt = _a.recordingStartedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt;
|
|
14567
|
+
isRecording = !!recordingStartedAt && !recordingStopRequestedAt;
|
|
14568
|
+
if (!isRecording) return [2 /*return*/];
|
|
14493
14569
|
set({
|
|
14494
|
-
recordingStopRequestedAt: performance.now()
|
|
14570
|
+
recordingStopRequestedAt: performance.now(),
|
|
14571
|
+
recordingStoppedAt: undefined
|
|
14495
14572
|
});
|
|
14496
|
-
|
|
14497
|
-
return [4 /*yield*/, waitForOneMoreChunk()
|
|
14573
|
+
clearInterval(get().requestDataInterval);
|
|
14574
|
+
return [4 /*yield*/, waitForOneMoreChunk()
|
|
14575
|
+
// this represents the time that it is safe to release the camera access
|
|
14576
|
+
];
|
|
14498
14577
|
case 1:
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
recordingStoppedAt: recordingStoppedAt
|
|
14507
|
-
});
|
|
14508
|
-
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
14509
|
-
blob = new Blob(signatureChunks, {
|
|
14510
|
-
type: mimeType
|
|
14511
|
-
});
|
|
14512
|
-
signatureChunks = [];
|
|
14513
|
-
signatureRecorder = null;
|
|
14514
|
-
_a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, acceptClickedAt = _a.acceptClickedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt, supportsRequestVideoFrameCallback = _a.supportsRequestVideoFrameCallback, supportsRoundRect = _a.supportsRoundRect;
|
|
14515
|
-
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
|
|
14516
|
-
mimeType: mimeType,
|
|
14517
|
-
browserFeatures: {
|
|
14518
|
-
supportsRoundRect: supportsRoundRect,
|
|
14519
|
-
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
14520
|
-
},
|
|
14521
|
-
timingData: {
|
|
14522
|
-
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
14523
|
-
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
14524
|
-
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
14525
|
-
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
14526
|
-
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
14527
|
-
acceptClickedAt: acceptClickedAt ? Math.ceil(acceptClickedAt) : 0,
|
|
14528
|
-
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
14529
|
-
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
14530
|
-
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
14531
|
-
}
|
|
14532
|
-
});
|
|
14533
|
-
return [2 /*return*/];
|
|
14534
|
-
});
|
|
14535
|
-
});
|
|
14536
|
-
};
|
|
14578
|
+
_b = _c.sent(), finalChunkReceived = _b.finalChunkReceived, timedOut = _b.timedOut, waitedMs = _b.waitedMs;
|
|
14579
|
+
// this represents the time that it is safe to release the camera access
|
|
14580
|
+
set({
|
|
14581
|
+
finalChunkReceived: true
|
|
14582
|
+
});
|
|
14583
|
+
if (!signatureRecorder) return [3 /*break*/, 2];
|
|
14584
|
+
signatureRecorder.onstop = processVideo;
|
|
14537
14585
|
signatureRecorder.stop();
|
|
14586
|
+
return [3 /*break*/, 4];
|
|
14587
|
+
case 2:
|
|
14588
|
+
warn('signature recorder not found, processing video immediately');
|
|
14589
|
+
return [4 /*yield*/, processVideo()];
|
|
14590
|
+
case 3:
|
|
14591
|
+
_c.sent();
|
|
14592
|
+
_c.label = 4;
|
|
14593
|
+
case 4:
|
|
14538
14594
|
return [2 /*return*/];
|
|
14539
14595
|
}
|
|
14540
14596
|
});
|
|
@@ -14542,6 +14598,9 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14542
14598
|
},
|
|
14543
14599
|
clearRecordedData: function clearRecordedData() {
|
|
14544
14600
|
signatureChunks = [];
|
|
14601
|
+
ondataavailableInvocations = [];
|
|
14602
|
+
ondataavailableStartTime = undefined;
|
|
14603
|
+
lastCalculatedVideoChunkRate = undefined;
|
|
14545
14604
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
14546
14605
|
signatureRecorder = null;
|
|
14547
14606
|
set({
|
|
@@ -14556,8 +14615,13 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14556
14615
|
signatureStartedAt: undefined,
|
|
14557
14616
|
signatureEndedAt: undefined,
|
|
14558
14617
|
acceptClickedAt: undefined,
|
|
14618
|
+
// Note: clearClickedAt is intentionally preserved for telemetry metadata
|
|
14559
14619
|
supportsRequestVideoFrameCallback: undefined,
|
|
14560
|
-
supportsRoundRect: undefined
|
|
14620
|
+
supportsRoundRect: undefined,
|
|
14621
|
+
nullChunksReceived: 0,
|
|
14622
|
+
firstNullChunkReceivedAt: undefined,
|
|
14623
|
+
lastNullChunkReceivedAt: undefined,
|
|
14624
|
+
finalChunkReceived: false
|
|
14561
14625
|
});
|
|
14562
14626
|
}
|
|
14563
14627
|
});
|
|
@@ -14567,11 +14631,11 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14567
14631
|
* @param delayMs - The delay in milliseconds before the first check -- this is used to make sure we get at least one extra second of video.
|
|
14568
14632
|
* @param checkEveryMs - The interval in milliseconds between checks after the initial delay has passed.
|
|
14569
14633
|
* @param timeoutMs - The maximum time in milliseconds to wait for the chunk -- this is used to prevent infinite loops.
|
|
14570
|
-
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received.
|
|
14634
|
+
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received. The return value is the number of milliseconds that we waited, whether we received a chunk, and whether we timed out.
|
|
14571
14635
|
*/
|
|
14572
14636
|
function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
14573
14637
|
if (delayMs === void 0) {
|
|
14574
|
-
delayMs =
|
|
14638
|
+
delayMs = 250;
|
|
14575
14639
|
}
|
|
14576
14640
|
if (checkEveryMs === void 0) {
|
|
14577
14641
|
checkEveryMs = 100;
|
|
@@ -14579,29 +14643,44 @@ function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
|
14579
14643
|
if (timeoutMs === void 0) {
|
|
14580
14644
|
timeoutMs = 3000;
|
|
14581
14645
|
}
|
|
14582
|
-
var start = performance.now();
|
|
14583
14646
|
return new Promise(function (resolve) {
|
|
14584
|
-
var
|
|
14585
|
-
|
|
14647
|
+
var _a;
|
|
14648
|
+
var start = performance.now();
|
|
14649
|
+
var initialLastChunkReceivedAt = (_a = useVideoSignatureStore.getState().lastChunkReceivedAt) !== null && _a !== void 0 ? _a : start;
|
|
14650
|
+
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.requestData();
|
|
14651
|
+
function checkForChunk() {
|
|
14586
14652
|
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14587
|
-
|
|
14653
|
+
var waitedMs = performance.now() - start;
|
|
14654
|
+
var timedOut = waitedMs > timeoutMs;
|
|
14655
|
+
var finalChunkReceived = !!lastChunkReceivedAt && !!initialLastChunkReceivedAt && lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
14656
|
+
return {
|
|
14657
|
+
waitedMs: waitedMs,
|
|
14658
|
+
finalChunkReceived: finalChunkReceived,
|
|
14659
|
+
timedOut: timedOut
|
|
14660
|
+
};
|
|
14588
14661
|
}
|
|
14589
14662
|
setTimeout(function () {
|
|
14590
|
-
|
|
14663
|
+
// check immediately
|
|
14664
|
+
var result = checkForChunk();
|
|
14665
|
+
if (result.finalChunkReceived || result.timedOut) return resolve(result);
|
|
14591
14666
|
// otherwise, check on a configured interval
|
|
14592
14667
|
var interval = setInterval(function () {
|
|
14593
|
-
|
|
14668
|
+
var result = checkForChunk();
|
|
14669
|
+
if (result.finalChunkReceived || result.timedOut) {
|
|
14594
14670
|
clearInterval(interval);
|
|
14595
|
-
resolve();
|
|
14671
|
+
resolve(result);
|
|
14596
14672
|
}
|
|
14597
14673
|
}, checkEveryMs);
|
|
14598
14674
|
}, delayMs);
|
|
14599
14675
|
});
|
|
14600
14676
|
}
|
|
14601
14677
|
function VideoSignatureContextProvider(_a) {
|
|
14602
|
-
var _b, _c;
|
|
14603
14678
|
var children = _a.children;
|
|
14604
|
-
var
|
|
14679
|
+
var _b = useCameraStore(),
|
|
14680
|
+
videoRef = _b.videoRef,
|
|
14681
|
+
videoWidth = _b.videoWidth,
|
|
14682
|
+
videoHeight = _b.videoHeight,
|
|
14683
|
+
releaseCameraAccess = _b.releaseCameraAccess;
|
|
14605
14684
|
var outputCanvas = React.useRef(null);
|
|
14606
14685
|
React.useEffect(function () {
|
|
14607
14686
|
return useVideoSignatureStore.setState({
|
|
@@ -14609,18 +14688,13 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14609
14688
|
});
|
|
14610
14689
|
}, []);
|
|
14611
14690
|
var drawOutputFrame = React.useCallback(function () {
|
|
14612
|
-
if (!outputCanvas.current
|
|
14691
|
+
if (!outputCanvas.current) return;
|
|
14613
14692
|
var ctx = outputCanvas.current.getContext('2d');
|
|
14614
14693
|
if (!ctx) return;
|
|
14615
|
-
var _a = [
|
|
14694
|
+
var _a = [outputCanvas.current.width, outputCanvas.current.height],
|
|
14616
14695
|
w = _a[0],
|
|
14617
14696
|
h = _a[1];
|
|
14618
14697
|
var isPortrait = w < h;
|
|
14619
|
-
// Only update canvas dimensions if they changed (setting dimensions clears the canvas!)
|
|
14620
|
-
if (outputCanvas.current.width !== w || outputCanvas.current.height !== h) {
|
|
14621
|
-
outputCanvas.current.width = w;
|
|
14622
|
-
outputCanvas.current.height = h;
|
|
14623
|
-
}
|
|
14624
14698
|
var rect = [w * (isPortrait ? 0.02 : 0.15),
|
|
14625
14699
|
// x
|
|
14626
14700
|
h * (isPortrait ? 0.15 : 0.25),
|
|
@@ -14629,7 +14703,9 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14629
14703
|
// width
|
|
14630
14704
|
h * (isPortrait ? 0.7 : 0.5) // height
|
|
14631
14705
|
];
|
|
14632
|
-
|
|
14706
|
+
if (videoRef.current) {
|
|
14707
|
+
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
14708
|
+
}
|
|
14633
14709
|
ctx.beginPath();
|
|
14634
14710
|
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
|
14635
14711
|
var supportsRoundRect = typeof ctx.roundRect === 'function';
|
|
@@ -14651,11 +14727,15 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14651
14727
|
ctx.drawImage.apply(ctx, __spreadArray([signatureCanvas], rect, false));
|
|
14652
14728
|
}
|
|
14653
14729
|
}, [videoRef]);
|
|
14654
|
-
|
|
14730
|
+
var finalChunkReceived = useVideoSignatureStore().finalChunkReceived;
|
|
14731
|
+
React.useEffect(function () {
|
|
14732
|
+
if (finalChunkReceived) releaseCameraAccess();
|
|
14733
|
+
}, [finalChunkReceived, releaseCameraAccess]);
|
|
14734
|
+
useVideoFrameLoop(videoRef, drawOutputFrame, !finalChunkReceived);
|
|
14655
14735
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
14656
14736
|
ref: outputCanvas,
|
|
14657
|
-
width:
|
|
14658
|
-
height:
|
|
14737
|
+
width: videoWidth,
|
|
14738
|
+
height: videoHeight
|
|
14659
14739
|
}));
|
|
14660
14740
|
}
|
|
14661
14741
|
function requestVideoFrameCallback(video, onFrame) {
|
|
@@ -14675,8 +14755,11 @@ function requestVideoFrameCallback(video, onFrame) {
|
|
|
14675
14755
|
};
|
|
14676
14756
|
}
|
|
14677
14757
|
}
|
|
14678
|
-
function videoFrameLoop(video, onFrame) {
|
|
14679
|
-
if (
|
|
14758
|
+
function videoFrameLoop(video, onFrame, running) {
|
|
14759
|
+
if (running === void 0) {
|
|
14760
|
+
running = true;
|
|
14761
|
+
}
|
|
14762
|
+
if (!video || !running) return;
|
|
14680
14763
|
var cancelFn;
|
|
14681
14764
|
var canceled = false;
|
|
14682
14765
|
function onFrameRecursive() {
|
|
@@ -14697,10 +14780,51 @@ function videoFrameLoop(video, onFrame) {
|
|
|
14697
14780
|
if (cancelFn !== undefined) cancelFn();
|
|
14698
14781
|
};
|
|
14699
14782
|
}
|
|
14700
|
-
function useVideoFrameLoop(ref, onFrame) {
|
|
14783
|
+
function useVideoFrameLoop(ref, onFrame, running) {
|
|
14784
|
+
if (running === void 0) {
|
|
14785
|
+
running = true;
|
|
14786
|
+
}
|
|
14701
14787
|
React.useEffect(function () {
|
|
14702
|
-
return videoFrameLoop(ref.current, onFrame);
|
|
14703
|
-
}, [onFrame, ref]);
|
|
14788
|
+
return videoFrameLoop(ref.current, onFrame, running);
|
|
14789
|
+
}, [onFrame, ref, running]);
|
|
14790
|
+
}
|
|
14791
|
+
function calculateAndStoreOndataavailableRate() {
|
|
14792
|
+
if (ondataavailableInvocations.length < 2 || !ondataavailableStartTime) {
|
|
14793
|
+
lastCalculatedVideoChunkRate = {
|
|
14794
|
+
averageRate: 0,
|
|
14795
|
+
minRate: 0,
|
|
14796
|
+
maxRate: 0,
|
|
14797
|
+
totalChunksReceived: ondataavailableInvocations.length,
|
|
14798
|
+
recordingDurationMs: 0
|
|
14799
|
+
};
|
|
14800
|
+
return;
|
|
14801
|
+
}
|
|
14802
|
+
var totalDuration = ondataavailableInvocations[ondataavailableInvocations.length - 1] - ondataavailableStartTime;
|
|
14803
|
+
var averageRate = (ondataavailableInvocations.length - 1) / (totalDuration / 1000); // invocations per second
|
|
14804
|
+
// Calculate rates for each interval between invocations
|
|
14805
|
+
var rates = [];
|
|
14806
|
+
for (var i = 1; i < ondataavailableInvocations.length; i++) {
|
|
14807
|
+
var intervalMs = ondataavailableInvocations[i] - ondataavailableInvocations[i - 1];
|
|
14808
|
+
var rate = 1000 / intervalMs; // invocations per second for this interval
|
|
14809
|
+
rates.push(rate);
|
|
14810
|
+
}
|
|
14811
|
+
var minRate = Math.min.apply(Math, rates);
|
|
14812
|
+
var maxRate = Math.max.apply(Math, rates);
|
|
14813
|
+
lastCalculatedVideoChunkRate = {
|
|
14814
|
+
averageRate: Math.round(averageRate * 100) / 100,
|
|
14815
|
+
// Round to 2 decimal places
|
|
14816
|
+
minRate: Math.round(minRate * 100) / 100,
|
|
14817
|
+
maxRate: Math.round(maxRate * 100) / 100,
|
|
14818
|
+
totalChunksReceived: ondataavailableInvocations.length,
|
|
14819
|
+
recordingDurationMs: Math.round(totalDuration)
|
|
14820
|
+
};
|
|
14821
|
+
}
|
|
14822
|
+
function trackVideoChunkRate(now) {
|
|
14823
|
+
// Track ondataavailable invocations for rate calculation
|
|
14824
|
+
ondataavailableStartTime !== null && ondataavailableStartTime !== void 0 ? ondataavailableStartTime : ondataavailableStartTime = now;
|
|
14825
|
+
ondataavailableInvocations.push(now);
|
|
14826
|
+
// Calculate and store the current rate
|
|
14827
|
+
calculateAndStoreOndataavailableRate();
|
|
14704
14828
|
}
|
|
14705
14829
|
|
|
14706
14830
|
function VideoSignaturePad(_a) {
|
|
@@ -15638,13 +15762,18 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
15638
15762
|
});
|
|
15639
15763
|
}, []);
|
|
15640
15764
|
var onClearBtnClicked = React.useCallback(function () {
|
|
15641
|
-
var _a
|
|
15765
|
+
var _a;
|
|
15766
|
+
var _b = useVideoSignatureStore.getState(),
|
|
15767
|
+
timesSignatureCleared = _b.timesSignatureCleared,
|
|
15768
|
+
signaturePad = _b.signaturePad;
|
|
15642
15769
|
useVideoSignatureStore.setState({
|
|
15770
|
+
clearClickedAt: performance.now(),
|
|
15771
|
+
timesSignatureCleared: timesSignatureCleared + 1,
|
|
15643
15772
|
signatureStartedAt: undefined,
|
|
15644
15773
|
signaturePadEmpty: true,
|
|
15645
15774
|
signatureValid: false
|
|
15646
15775
|
});
|
|
15647
|
-
(
|
|
15776
|
+
(_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
|
|
15648
15777
|
if (restartVideoOnSignaturePadCleared) {
|
|
15649
15778
|
setTimeout(function () {
|
|
15650
15779
|
useVideoSignatureStore.getState().clearRecordedData();
|