idmission-web-sdk 2.3.121 → 2.3.123
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/VideoSignatureCapture.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +0 -25
- 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 +108 -226
- 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 +108 -226
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +108 -226
- 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 +1 -1
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.3.
|
|
214
|
+
var webSdkVersion = '2.3.123';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -24273,9 +24273,6 @@
|
|
|
24273
24273
|
|
|
24274
24274
|
var signatureRecorder = null;
|
|
24275
24275
|
var signatureChunks = [];
|
|
24276
|
-
var ondataavailableInvocations = [];
|
|
24277
|
-
var ondataavailableStartTime;
|
|
24278
|
-
var lastCalculatedVideoChunkRate;
|
|
24279
24276
|
var videoSignatureInitialState = {
|
|
24280
24277
|
startRecording: function startRecording() {
|
|
24281
24278
|
return null;
|
|
@@ -24300,9 +24297,6 @@
|
|
|
24300
24297
|
signatureValid: false,
|
|
24301
24298
|
supportsRequestVideoFrameCallback: undefined,
|
|
24302
24299
|
supportsRoundRect: undefined,
|
|
24303
|
-
nullChunksReceived: 0,
|
|
24304
|
-
timesSignatureCleared: 0,
|
|
24305
|
-
finalChunkReceived: false,
|
|
24306
24300
|
onSignatureVideoCaptured: function onSignatureVideoCaptured() {
|
|
24307
24301
|
return null;
|
|
24308
24302
|
}
|
|
@@ -24315,11 +24309,8 @@
|
|
|
24315
24309
|
captureAudio = false;
|
|
24316
24310
|
}
|
|
24317
24311
|
if (!camera) throw new Error('Camera not found');
|
|
24318
|
-
// clear whatever we have recorded so far.
|
|
24312
|
+
// set our flag and clear whatever we have recorded so far.
|
|
24319
24313
|
signatureChunks = [];
|
|
24320
|
-
ondataavailableInvocations = [];
|
|
24321
|
-
ondataavailableStartTime = undefined;
|
|
24322
|
-
lastCalculatedVideoChunkRate = undefined;
|
|
24323
24314
|
// start recording from the output canvas to capture the signature
|
|
24324
24315
|
var outputStream = (_a = get().outputCanvas.current) === null || _a === void 0 ? void 0 : _a.captureStream(24);
|
|
24325
24316
|
if (!outputStream) throw new Error('outputStream not found');
|
|
@@ -24337,26 +24328,18 @@
|
|
|
24337
24328
|
recordingStartedAt: e.timeStamp
|
|
24338
24329
|
});
|
|
24339
24330
|
};
|
|
24331
|
+
var hasFirstChunk = false;
|
|
24340
24332
|
signatureRecorder.ondataavailable = function (event) {
|
|
24341
|
-
var now = performance.now();
|
|
24342
24333
|
signatureChunks.push(event.data);
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
set(
|
|
24346
|
-
|
|
24347
|
-
|
|
24348
|
-
firstChunkReceivedAt: (_a = state.firstChunkReceivedAt) !== null && _a !== void 0 ? _a : now,
|
|
24349
|
-
lastChunkReceivedAt: now
|
|
24350
|
-
};
|
|
24334
|
+
if (!hasFirstChunk) {
|
|
24335
|
+
hasFirstChunk = true;
|
|
24336
|
+
set({
|
|
24337
|
+
firstChunkReceivedAt: performance.now(),
|
|
24338
|
+
lastChunkReceivedAt: performance.now()
|
|
24351
24339
|
});
|
|
24352
24340
|
} else {
|
|
24353
|
-
set(
|
|
24354
|
-
|
|
24355
|
-
return {
|
|
24356
|
-
nullChunksReceived: state.nullChunksReceived + 1,
|
|
24357
|
-
firstNullChunkReceivedAt: (_a = state.firstNullChunkReceivedAt) !== null && _a !== void 0 ? _a : now,
|
|
24358
|
-
lastNullChunkReceivedAt: now
|
|
24359
|
-
};
|
|
24341
|
+
set({
|
|
24342
|
+
lastChunkReceivedAt: performance.now()
|
|
24360
24343
|
});
|
|
24361
24344
|
}
|
|
24362
24345
|
};
|
|
@@ -24367,88 +24350,55 @@
|
|
|
24367
24350
|
},
|
|
24368
24351
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
24369
24352
|
return __awaiter(this, void 0, void 0, function () {
|
|
24370
|
-
|
|
24371
|
-
|
|
24372
|
-
|
|
24373
|
-
return __generator(this, function (_b) {
|
|
24374
|
-
if (get().recordingStoppedAt) return [2 /*return*/];
|
|
24375
|
-
recordingStoppedAt = performance.now();
|
|
24376
|
-
set({
|
|
24377
|
-
recordingStoppedAt: recordingStoppedAt
|
|
24378
|
-
});
|
|
24379
|
-
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
24380
|
-
blob = new Blob(signatureChunks, {
|
|
24381
|
-
type: mimeType
|
|
24382
|
-
});
|
|
24383
|
-
signatureChunks = [];
|
|
24384
|
-
signatureRecorder = null;
|
|
24385
|
-
_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;
|
|
24386
|
-
metadata = {
|
|
24387
|
-
mimeType: mimeType,
|
|
24388
|
-
browserFeatures: {
|
|
24389
|
-
supportsRoundRect: supportsRoundRect,
|
|
24390
|
-
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
24391
|
-
},
|
|
24392
|
-
diagnostics: {
|
|
24393
|
-
nullChunksReceived: nullChunksReceived,
|
|
24394
|
-
firstNullChunkReceivedAt: firstNullChunkReceivedAt,
|
|
24395
|
-
lastNullChunkReceivedAt: lastNullChunkReceivedAt,
|
|
24396
|
-
finalChunkReceived: finalChunkReceived,
|
|
24397
|
-
finalChunkTimedOut: timedOut,
|
|
24398
|
-
finalChunkWaitedMs: Math.ceil(waitedMs),
|
|
24399
|
-
videoChunkRate: lastCalculatedVideoChunkRate,
|
|
24400
|
-
timesSignatureCleared: timesSignatureCleared
|
|
24401
|
-
},
|
|
24402
|
-
timingData: {
|
|
24403
|
-
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
24404
|
-
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
24405
|
-
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
24406
|
-
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
24407
|
-
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
24408
|
-
acceptClickedAt: acceptClickedAt ? Math.ceil(acceptClickedAt) : 0,
|
|
24409
|
-
clearClickedAt: clearClickedAt ? Math.ceil(clearClickedAt) : 0,
|
|
24410
|
-
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
24411
|
-
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
24412
|
-
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
24413
|
-
}
|
|
24414
|
-
};
|
|
24415
|
-
debug('signature video metadata', metadata);
|
|
24416
|
-
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, metadata);
|
|
24417
|
-
return [2 /*return*/];
|
|
24418
|
-
});
|
|
24419
|
-
});
|
|
24420
|
-
}
|
|
24421
|
-
var _a, recordingStartedAt, recordingStopRequestedAt, isRecording, _b, finalChunkReceived, timedOut, waitedMs;
|
|
24422
|
-
return __generator(this, function (_c) {
|
|
24423
|
-
switch (_c.label) {
|
|
24353
|
+
var _this = this;
|
|
24354
|
+
return __generator(this, function (_a) {
|
|
24355
|
+
switch (_a.label) {
|
|
24424
24356
|
case 0:
|
|
24425
|
-
_a = get(), recordingStartedAt = _a.recordingStartedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt;
|
|
24426
|
-
isRecording = !!recordingStartedAt && !recordingStopRequestedAt;
|
|
24427
|
-
if (!isRecording) return [2 /*return*/];
|
|
24428
24357
|
set({
|
|
24429
|
-
recordingStopRequestedAt: performance.now()
|
|
24430
|
-
recordingStoppedAt: undefined
|
|
24358
|
+
recordingStopRequestedAt: performance.now()
|
|
24431
24359
|
});
|
|
24432
|
-
return [
|
|
24433
|
-
|
|
24434
|
-
];
|
|
24360
|
+
if (!signatureRecorder) return [2 /*return*/];
|
|
24361
|
+
return [4 /*yield*/, waitForOneMoreChunk()];
|
|
24435
24362
|
case 1:
|
|
24436
|
-
|
|
24437
|
-
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24363
|
+
_a.sent();
|
|
24364
|
+
signatureRecorder.onstop = function () {
|
|
24365
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
24366
|
+
var recordingStoppedAt, mimeType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, acceptClickedAt, recordingStopRequestedAt, lastChunkReceivedAt, supportsRequestVideoFrameCallback, supportsRoundRect;
|
|
24367
|
+
return __generator(this, function (_b) {
|
|
24368
|
+
recordingStoppedAt = performance.now();
|
|
24369
|
+
set({
|
|
24370
|
+
recordingStoppedAt: recordingStoppedAt
|
|
24371
|
+
});
|
|
24372
|
+
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
24373
|
+
blob = new Blob(signatureChunks, {
|
|
24374
|
+
type: mimeType
|
|
24375
|
+
});
|
|
24376
|
+
signatureChunks = [];
|
|
24377
|
+
signatureRecorder = null;
|
|
24378
|
+
_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;
|
|
24379
|
+
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
|
|
24380
|
+
mimeType: mimeType,
|
|
24381
|
+
browserFeatures: {
|
|
24382
|
+
supportsRoundRect: supportsRoundRect,
|
|
24383
|
+
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
24384
|
+
},
|
|
24385
|
+
timingData: {
|
|
24386
|
+
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
24387
|
+
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
24388
|
+
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
24389
|
+
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
24390
|
+
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
24391
|
+
acceptClickedAt: acceptClickedAt ? Math.ceil(acceptClickedAt) : 0,
|
|
24392
|
+
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
24393
|
+
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
24394
|
+
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
24395
|
+
}
|
|
24396
|
+
});
|
|
24397
|
+
return [2 /*return*/];
|
|
24398
|
+
});
|
|
24399
|
+
});
|
|
24400
|
+
};
|
|
24443
24401
|
signatureRecorder.stop();
|
|
24444
|
-
return [3 /*break*/, 4];
|
|
24445
|
-
case 2:
|
|
24446
|
-
warn('signature recorder not found, processing video immediately');
|
|
24447
|
-
return [4 /*yield*/, processVideo()];
|
|
24448
|
-
case 3:
|
|
24449
|
-
_c.sent();
|
|
24450
|
-
_c.label = 4;
|
|
24451
|
-
case 4:
|
|
24452
24402
|
return [2 /*return*/];
|
|
24453
24403
|
}
|
|
24454
24404
|
});
|
|
@@ -24456,9 +24406,6 @@
|
|
|
24456
24406
|
},
|
|
24457
24407
|
clearRecordedData: function clearRecordedData() {
|
|
24458
24408
|
signatureChunks = [];
|
|
24459
|
-
ondataavailableInvocations = [];
|
|
24460
|
-
ondataavailableStartTime = undefined;
|
|
24461
|
-
lastCalculatedVideoChunkRate = undefined;
|
|
24462
24409
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
24463
24410
|
signatureRecorder = null;
|
|
24464
24411
|
set({
|
|
@@ -24473,13 +24420,8 @@
|
|
|
24473
24420
|
signatureStartedAt: undefined,
|
|
24474
24421
|
signatureEndedAt: undefined,
|
|
24475
24422
|
acceptClickedAt: undefined,
|
|
24476
|
-
clearClickedAt: undefined,
|
|
24477
24423
|
supportsRequestVideoFrameCallback: undefined,
|
|
24478
|
-
supportsRoundRect: undefined
|
|
24479
|
-
nullChunksReceived: 0,
|
|
24480
|
-
firstNullChunkReceivedAt: undefined,
|
|
24481
|
-
lastNullChunkReceivedAt: undefined,
|
|
24482
|
-
finalChunkReceived: false
|
|
24424
|
+
supportsRoundRect: undefined
|
|
24483
24425
|
});
|
|
24484
24426
|
}
|
|
24485
24427
|
});
|
|
@@ -24489,11 +24431,11 @@
|
|
|
24489
24431
|
* @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.
|
|
24490
24432
|
* @param checkEveryMs - The interval in milliseconds between checks after the initial delay has passed.
|
|
24491
24433
|
* @param timeoutMs - The maximum time in milliseconds to wait for the chunk -- this is used to prevent infinite loops.
|
|
24492
|
-
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received.
|
|
24434
|
+
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received.
|
|
24493
24435
|
*/
|
|
24494
24436
|
function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
24495
24437
|
if (delayMs === void 0) {
|
|
24496
|
-
delayMs =
|
|
24438
|
+
delayMs = 1000;
|
|
24497
24439
|
}
|
|
24498
24440
|
if (checkEveryMs === void 0) {
|
|
24499
24441
|
checkEveryMs = 100;
|
|
@@ -24501,42 +24443,29 @@
|
|
|
24501
24443
|
if (timeoutMs === void 0) {
|
|
24502
24444
|
timeoutMs = 3000;
|
|
24503
24445
|
}
|
|
24446
|
+
var start = performance.now();
|
|
24504
24447
|
return new Promise(function (resolve) {
|
|
24505
|
-
var start = performance.now();
|
|
24506
24448
|
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
24507
|
-
function
|
|
24449
|
+
function gotAChunk() {
|
|
24508
24450
|
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
24509
|
-
|
|
24510
|
-
var timedOut = waitedMs > timeoutMs;
|
|
24511
|
-
var finalChunkReceived = !!lastChunkReceivedAt && !!initialLastChunkReceivedAt && lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
24512
|
-
return {
|
|
24513
|
-
waitedMs: waitedMs,
|
|
24514
|
-
finalChunkReceived: finalChunkReceived,
|
|
24515
|
-
timedOut: timedOut
|
|
24516
|
-
};
|
|
24451
|
+
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
24517
24452
|
}
|
|
24518
24453
|
setTimeout(function () {
|
|
24519
|
-
// check immediately
|
|
24520
|
-
var result = checkForChunk();
|
|
24521
|
-
if (result.finalChunkReceived || result.timedOut) return resolve(result);
|
|
24454
|
+
if (gotAChunk()) return resolve(); // check immediately
|
|
24522
24455
|
// otherwise, check on a configured interval
|
|
24523
24456
|
var interval = setInterval(function () {
|
|
24524
|
-
|
|
24525
|
-
if (result.finalChunkReceived || result.timedOut) {
|
|
24457
|
+
if (gotAChunk()) {
|
|
24526
24458
|
clearInterval(interval);
|
|
24527
|
-
resolve(
|
|
24459
|
+
resolve();
|
|
24528
24460
|
}
|
|
24529
24461
|
}, checkEveryMs);
|
|
24530
24462
|
}, delayMs);
|
|
24531
24463
|
});
|
|
24532
24464
|
}
|
|
24533
24465
|
function VideoSignatureContextProvider(_a) {
|
|
24466
|
+
var _b, _c;
|
|
24534
24467
|
var children = _a.children;
|
|
24535
|
-
var
|
|
24536
|
-
videoRef = _b.videoRef,
|
|
24537
|
-
videoWidth = _b.videoWidth,
|
|
24538
|
-
videoHeight = _b.videoHeight,
|
|
24539
|
-
releaseCameraAccess = _b.releaseCameraAccess;
|
|
24468
|
+
var videoRef = useCameraStore().videoRef;
|
|
24540
24469
|
var outputCanvas = React.useRef(null);
|
|
24541
24470
|
React.useEffect(function () {
|
|
24542
24471
|
return useVideoSignatureStore.setState({
|
|
@@ -24544,13 +24473,18 @@
|
|
|
24544
24473
|
});
|
|
24545
24474
|
}, []);
|
|
24546
24475
|
var drawOutputFrame = React.useCallback(function () {
|
|
24547
|
-
if (!outputCanvas.current) return;
|
|
24476
|
+
if (!outputCanvas.current || !videoRef.current) return;
|
|
24548
24477
|
var ctx = outputCanvas.current.getContext('2d');
|
|
24549
24478
|
if (!ctx) return;
|
|
24550
|
-
var _a = [
|
|
24479
|
+
var _a = [videoRef.current.videoWidth, videoRef.current.videoHeight],
|
|
24551
24480
|
w = _a[0],
|
|
24552
24481
|
h = _a[1];
|
|
24553
24482
|
var isPortrait = w < h;
|
|
24483
|
+
// Only update canvas dimensions if they changed (setting dimensions clears the canvas!)
|
|
24484
|
+
if (outputCanvas.current.width !== w || outputCanvas.current.height !== h) {
|
|
24485
|
+
outputCanvas.current.width = w;
|
|
24486
|
+
outputCanvas.current.height = h;
|
|
24487
|
+
}
|
|
24554
24488
|
var rect = [w * (isPortrait ? 0.02 : 0.15),
|
|
24555
24489
|
// x
|
|
24556
24490
|
h * (isPortrait ? 0.15 : 0.25),
|
|
@@ -24559,9 +24493,7 @@
|
|
|
24559
24493
|
// width
|
|
24560
24494
|
h * (isPortrait ? 0.7 : 0.5) // height
|
|
24561
24495
|
];
|
|
24562
|
-
|
|
24563
|
-
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
24564
|
-
}
|
|
24496
|
+
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
24565
24497
|
ctx.beginPath();
|
|
24566
24498
|
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
|
24567
24499
|
var supportsRoundRect = typeof ctx.roundRect === 'function';
|
|
@@ -24583,15 +24515,11 @@
|
|
|
24583
24515
|
ctx.drawImage.apply(ctx, __spreadArray([signatureCanvas], rect, false));
|
|
24584
24516
|
}
|
|
24585
24517
|
}, [videoRef]);
|
|
24586
|
-
|
|
24587
|
-
React.useEffect(function () {
|
|
24588
|
-
if (finalChunkReceived) releaseCameraAccess();
|
|
24589
|
-
}, [finalChunkReceived, releaseCameraAccess]);
|
|
24590
|
-
useVideoFrameLoop(videoRef, drawOutputFrame, !finalChunkReceived);
|
|
24518
|
+
useVideoFrameLoop(videoRef, drawOutputFrame);
|
|
24591
24519
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
24592
24520
|
ref: outputCanvas,
|
|
24593
|
-
width: videoWidth,
|
|
24594
|
-
height: videoHeight
|
|
24521
|
+
width: (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth,
|
|
24522
|
+
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
24595
24523
|
}));
|
|
24596
24524
|
}
|
|
24597
24525
|
function requestVideoFrameCallback(video, onFrame) {
|
|
@@ -24611,11 +24539,8 @@
|
|
|
24611
24539
|
};
|
|
24612
24540
|
}
|
|
24613
24541
|
}
|
|
24614
|
-
function videoFrameLoop(video, onFrame
|
|
24615
|
-
if (
|
|
24616
|
-
running = true;
|
|
24617
|
-
}
|
|
24618
|
-
if (!video || !running) return;
|
|
24542
|
+
function videoFrameLoop(video, onFrame) {
|
|
24543
|
+
if (!video) return;
|
|
24619
24544
|
var cancelFn;
|
|
24620
24545
|
var canceled = false;
|
|
24621
24546
|
function onFrameRecursive() {
|
|
@@ -24636,51 +24561,10 @@
|
|
|
24636
24561
|
if (cancelFn !== undefined) cancelFn();
|
|
24637
24562
|
};
|
|
24638
24563
|
}
|
|
24639
|
-
function useVideoFrameLoop(ref, onFrame
|
|
24640
|
-
if (running === void 0) {
|
|
24641
|
-
running = true;
|
|
24642
|
-
}
|
|
24564
|
+
function useVideoFrameLoop(ref, onFrame) {
|
|
24643
24565
|
React.useEffect(function () {
|
|
24644
|
-
return videoFrameLoop(ref.current, onFrame
|
|
24645
|
-
}, [onFrame, ref
|
|
24646
|
-
}
|
|
24647
|
-
function calculateAndStoreOndataavailableRate() {
|
|
24648
|
-
if (ondataavailableInvocations.length < 2 || !ondataavailableStartTime) {
|
|
24649
|
-
lastCalculatedVideoChunkRate = {
|
|
24650
|
-
averageRate: 0,
|
|
24651
|
-
minRate: 0,
|
|
24652
|
-
maxRate: 0,
|
|
24653
|
-
totalChunksReceived: ondataavailableInvocations.length,
|
|
24654
|
-
recordingDurationMs: 0
|
|
24655
|
-
};
|
|
24656
|
-
return;
|
|
24657
|
-
}
|
|
24658
|
-
var totalDuration = ondataavailableInvocations[ondataavailableInvocations.length - 1] - ondataavailableStartTime;
|
|
24659
|
-
var averageRate = (ondataavailableInvocations.length - 1) / (totalDuration / 1000); // invocations per second
|
|
24660
|
-
// Calculate rates for each interval between invocations
|
|
24661
|
-
var rates = [];
|
|
24662
|
-
for (var i = 1; i < ondataavailableInvocations.length; i++) {
|
|
24663
|
-
var intervalMs = ondataavailableInvocations[i] - ondataavailableInvocations[i - 1];
|
|
24664
|
-
var rate = 1000 / intervalMs; // invocations per second for this interval
|
|
24665
|
-
rates.push(rate);
|
|
24666
|
-
}
|
|
24667
|
-
var minRate = Math.min.apply(Math, rates);
|
|
24668
|
-
var maxRate = Math.max.apply(Math, rates);
|
|
24669
|
-
lastCalculatedVideoChunkRate = {
|
|
24670
|
-
averageRate: Math.round(averageRate * 100) / 100,
|
|
24671
|
-
// Round to 2 decimal places
|
|
24672
|
-
minRate: Math.round(minRate * 100) / 100,
|
|
24673
|
-
maxRate: Math.round(maxRate * 100) / 100,
|
|
24674
|
-
totalChunksReceived: ondataavailableInvocations.length,
|
|
24675
|
-
recordingDurationMs: Math.round(totalDuration)
|
|
24676
|
-
};
|
|
24677
|
-
}
|
|
24678
|
-
function trackVideoChunkRate(now) {
|
|
24679
|
-
// Track ondataavailable invocations for rate calculation
|
|
24680
|
-
ondataavailableStartTime !== null && ondataavailableStartTime !== void 0 ? ondataavailableStartTime : ondataavailableStartTime = now;
|
|
24681
|
-
ondataavailableInvocations.push(now);
|
|
24682
|
-
// Calculate and store the current rate
|
|
24683
|
-
calculateAndStoreOndataavailableRate();
|
|
24566
|
+
return videoFrameLoop(ref.current, onFrame);
|
|
24567
|
+
}, [onFrame, ref]);
|
|
24684
24568
|
}
|
|
24685
24569
|
|
|
24686
24570
|
function VideoSignaturePad(_a) {
|
|
@@ -24932,11 +24816,14 @@
|
|
|
24932
24816
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
24933
24817
|
startHeadTracking = _o.start,
|
|
24934
24818
|
stopHeadTracking = _o.stop;
|
|
24935
|
-
var
|
|
24936
|
-
|
|
24937
|
-
|
|
24938
|
-
|
|
24939
|
-
|
|
24819
|
+
var _p = useVideoSignatureStore(useShallow(function (state) {
|
|
24820
|
+
return {
|
|
24821
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt,
|
|
24822
|
+
acceptClickedAt: state.acceptClickedAt
|
|
24823
|
+
};
|
|
24824
|
+
})),
|
|
24825
|
+
firstChunkReceivedAt = _p.firstChunkReceivedAt,
|
|
24826
|
+
acceptClickedAt = _p.acceptClickedAt;
|
|
24940
24827
|
React.useImperativeHandle(ref, function () {
|
|
24941
24828
|
return {
|
|
24942
24829
|
clearRecordedData: function clearRecordedData() {
|
|
@@ -24962,15 +24849,15 @@
|
|
|
24962
24849
|
var verbiage = useTranslations(rawVerbiage, {
|
|
24963
24850
|
guidanceMessageText: 'Please sign the box below'
|
|
24964
24851
|
});
|
|
24965
|
-
var
|
|
24966
|
-
headTrackingSatisfied =
|
|
24967
|
-
setHeadTrackingSatisfied =
|
|
24968
|
-
var
|
|
24969
|
-
lastFace =
|
|
24970
|
-
setLastFace =
|
|
24971
|
-
var
|
|
24972
|
-
numFramesWithoutFaces =
|
|
24973
|
-
setNumFramesWithoutFaces =
|
|
24852
|
+
var _q = React.useState(true),
|
|
24853
|
+
headTrackingSatisfied = _q[0],
|
|
24854
|
+
setHeadTrackingSatisfied = _q[1];
|
|
24855
|
+
var _r = React.useState(null),
|
|
24856
|
+
lastFace = _r[0],
|
|
24857
|
+
setLastFace = _r[1];
|
|
24858
|
+
var _s = React.useState(0),
|
|
24859
|
+
numFramesWithoutFaces = _s[0],
|
|
24860
|
+
setNumFramesWithoutFaces = _s[1];
|
|
24974
24861
|
onHeadTrackingPredictionMade(f(React.useCallback(function (_a) {
|
|
24975
24862
|
var face = _a.face;
|
|
24976
24863
|
if (headTrackingDisabled) return;
|
|
@@ -24985,12 +24872,12 @@
|
|
|
24985
24872
|
return n + 1;
|
|
24986
24873
|
});
|
|
24987
24874
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
24988
|
-
var
|
|
24989
|
-
containerRef =
|
|
24990
|
-
|
|
24991
|
-
width =
|
|
24992
|
-
|
|
24993
|
-
height =
|
|
24875
|
+
var _t = useResizeObserver(),
|
|
24876
|
+
containerRef = _t.ref,
|
|
24877
|
+
_u = _t.width,
|
|
24878
|
+
width = _u === void 0 ? 1 : _u,
|
|
24879
|
+
_v = _t.height,
|
|
24880
|
+
height = _v === void 0 ? 1 : _v;
|
|
24994
24881
|
var debugScalingDetails = useDebugScalingDetails({
|
|
24995
24882
|
enabled: debugMode,
|
|
24996
24883
|
pageWidth: width,
|
|
@@ -25033,10 +24920,10 @@
|
|
|
25033
24920
|
face: lastFace,
|
|
25034
24921
|
scaling: debugScalingDetails,
|
|
25035
24922
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
25036
|
-
}))), /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React.createElement("br", null), "Recording: ", firstChunkReceivedAt ? 'true' : 'false'))), /*#__PURE__*/React.createElement(ExitCaptureButton, {
|
|
24923
|
+
}))), /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React.createElement("br", null), "Recording: ", firstChunkReceivedAt ? 'true' : 'false'))), !acceptClickedAt && ( /*#__PURE__*/React.createElement(ExitCaptureButton, {
|
|
25037
24924
|
onClick: onExit,
|
|
25038
24925
|
className: classNames.exitCaptureBtn
|
|
25039
|
-
}));
|
|
24926
|
+
})));
|
|
25040
24927
|
}
|
|
25041
24928
|
var VideoSignatureCapture = /*#__PURE__*/React.forwardRef(VideoSignatureCaptureComponent);
|
|
25042
24929
|
var Container$2 = styled.div(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n"], ["\n width: 100%;\n height: 100%;\n"
|
|
@@ -25615,18 +25502,13 @@
|
|
|
25615
25502
|
});
|
|
25616
25503
|
}, []);
|
|
25617
25504
|
var onClearBtnClicked = React.useCallback(function () {
|
|
25618
|
-
var _a;
|
|
25619
|
-
var _b = useVideoSignatureStore.getState(),
|
|
25620
|
-
timesSignatureCleared = _b.timesSignatureCleared,
|
|
25621
|
-
signaturePad = _b.signaturePad;
|
|
25505
|
+
var _a, _b;
|
|
25622
25506
|
useVideoSignatureStore.setState({
|
|
25623
|
-
clearClickedAt: performance.now(),
|
|
25624
|
-
timesSignatureCleared: timesSignatureCleared + 1,
|
|
25625
25507
|
signatureStartedAt: undefined,
|
|
25626
25508
|
signaturePadEmpty: true,
|
|
25627
25509
|
signatureValid: false
|
|
25628
25510
|
});
|
|
25629
|
-
(_a =
|
|
25511
|
+
(_b = (_a = useVideoSignatureStore.getState().signaturePad) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.clear();
|
|
25630
25512
|
if (restartVideoOnSignaturePadCleared) {
|
|
25631
25513
|
setTimeout(function () {
|
|
25632
25514
|
useVideoSignatureStore.getState().clearRecordedData();
|