idmission-web-sdk 2.3.122 → 2.3.124
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_id/IdVideoCaptureSuccess.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +0 -26
- 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/lib/camera/Camera.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts.map +1 -1
- package/dist/lib/utils/logger.d.ts +6 -6
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +174 -292
- 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 +174 -292
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +174 -292
- 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
package/dist/sdk2.esm.js
CHANGED
|
@@ -205,7 +205,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
205
205
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
var webSdkVersion = '2.3.
|
|
208
|
+
var webSdkVersion = '2.3.124';
|
|
209
209
|
|
|
210
210
|
function getPlatform() {
|
|
211
211
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -803,38 +803,35 @@ function useLogLevel(newLogLevel) {
|
|
|
803
803
|
function useDebugLogging(enabled) {
|
|
804
804
|
useLogLevel(enabled ? LogLevel.Debug : logLevel);
|
|
805
805
|
}
|
|
806
|
-
function
|
|
807
|
-
|
|
806
|
+
var noop = function noop() {};
|
|
807
|
+
var debug = function debug() {
|
|
808
|
+
var args = [];
|
|
808
809
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
809
|
-
|
|
810
|
+
args[_i] = arguments[_i];
|
|
810
811
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
var parts = [];
|
|
812
|
+
return (logLevel >= LogLevel.Debug ? console.debug : noop).apply(void 0, args);
|
|
813
|
+
}; // eslint-disable-line no-console
|
|
814
|
+
var log = function log() {
|
|
815
|
+
var args = [];
|
|
816
816
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
817
|
-
|
|
817
|
+
args[_i] = arguments[_i];
|
|
818
818
|
}
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
var parts = [];
|
|
819
|
+
return (logLevel >= LogLevel.Info ? console.log : noop).apply(void 0, args);
|
|
820
|
+
}; // eslint-disable-line no-console
|
|
821
|
+
var warn = function warn() {
|
|
822
|
+
var args = [];
|
|
824
823
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
825
|
-
|
|
824
|
+
args[_i] = arguments[_i];
|
|
826
825
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
var parts = [];
|
|
826
|
+
return (logLevel >= LogLevel.Warn ? console.warn : noop).apply(void 0, args);
|
|
827
|
+
}; // eslint-disable-line no-console
|
|
828
|
+
var error = function error() {
|
|
829
|
+
var args = [];
|
|
832
830
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
833
|
-
|
|
831
|
+
args[_i] = arguments[_i];
|
|
834
832
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
}
|
|
833
|
+
return (logLevel >= LogLevel.Error ? console.error : noop).apply(void 0, args);
|
|
834
|
+
}; // eslint-disable-line no-console
|
|
838
835
|
|
|
839
836
|
var defaultAuthUrl = 'https://portal-api.idmission.com';
|
|
840
837
|
var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
|
|
@@ -3139,6 +3136,7 @@ function useFrameLoop(fn, options) {
|
|
|
3139
3136
|
};
|
|
3140
3137
|
}
|
|
3141
3138
|
|
|
3139
|
+
var LOG_TAG$1 = 'camera:Camera';
|
|
3142
3140
|
function listAvailableCameras(facingMode_1) {
|
|
3143
3141
|
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
3144
3142
|
var cameraEnumerationStream, allDevices, allowedVideoDevices;
|
|
@@ -3201,21 +3199,24 @@ var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
|
3201
3199
|
var currentCamera;
|
|
3202
3200
|
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
3203
3201
|
releaseCameraAccess();
|
|
3204
|
-
log(
|
|
3202
|
+
log("".concat(LOG_TAG$1, " obtaining camera access..."));
|
|
3205
3203
|
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
3206
3204
|
width = _a.width,
|
|
3207
3205
|
height = _a.height;
|
|
3208
|
-
log(
|
|
3206
|
+
log("".concat(LOG_TAG$1, " camera dimensions"), width, height);
|
|
3209
3207
|
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
3210
|
-
log(
|
|
3208
|
+
log("".concat(LOG_TAG$1, " camera label"), label);
|
|
3211
3209
|
var isRearFacing = cameraLabelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearCameraLabels, true), backUltraWideCameraLabels, true), ['iphone'], false));
|
|
3212
|
-
log(
|
|
3210
|
+
log("".concat(LOG_TAG$1, " is rear facing?"), isRearFacing);
|
|
3213
3211
|
var release = function release() {
|
|
3212
|
+
debug("".concat(LOG_TAG$1, " camera releasing stream"), stream);
|
|
3214
3213
|
stream.getTracks().forEach(function (track) {
|
|
3215
3214
|
track.enabled = false;
|
|
3215
|
+
debug("".concat(LOG_TAG$1, " camera stopping stream track"), track);
|
|
3216
3216
|
track.stop();
|
|
3217
3217
|
});
|
|
3218
3218
|
if (video) {
|
|
3219
|
+
debug("".concat(LOG_TAG$1, " camera releasing video element"), video);
|
|
3219
3220
|
video.pause();
|
|
3220
3221
|
video.srcObject = null;
|
|
3221
3222
|
video.src = '';
|
|
@@ -3231,14 +3232,14 @@ function obtainCameraAccess(stream, deviceLabel, video) {
|
|
|
3231
3232
|
isRearFacing: isRearFacing,
|
|
3232
3233
|
release: release
|
|
3233
3234
|
};
|
|
3234
|
-
log(
|
|
3235
|
+
log("".concat(LOG_TAG$1, " camera access granted"), currentCamera);
|
|
3235
3236
|
// if (video) video.srcObject = stream
|
|
3236
3237
|
// log('video source initialized')
|
|
3237
3238
|
return currentCamera;
|
|
3238
3239
|
}
|
|
3239
3240
|
function releaseCameraAccess() {
|
|
3240
3241
|
if (!currentCamera) return;
|
|
3241
|
-
log(
|
|
3242
|
+
log("".concat(LOG_TAG$1, " releasing camera access..."));
|
|
3242
3243
|
currentCamera.release();
|
|
3243
3244
|
currentCamera = undefined;
|
|
3244
3245
|
}
|
|
@@ -4390,6 +4391,7 @@ function useTranslations(verbiage, fallbacks) {
|
|
|
4390
4391
|
}, [fallbacks, i18n.language, t, verbiage]);
|
|
4391
4392
|
}
|
|
4392
4393
|
|
|
4394
|
+
var LOG_TAG = 'camera:store';
|
|
4393
4395
|
var camera = null;
|
|
4394
4396
|
var videoStream = null;
|
|
4395
4397
|
var audioStream = null;
|
|
@@ -4415,7 +4417,8 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4415
4417
|
var store = createStore(function (set, get) {
|
|
4416
4418
|
return _assign(_assign(_assign({}, initialState$6), config), {
|
|
4417
4419
|
reset: function reset() {
|
|
4418
|
-
|
|
4420
|
+
debug("".concat(LOG_TAG, " reset"));
|
|
4421
|
+
set(_assign(_assign({}, initialState$6), config));
|
|
4419
4422
|
},
|
|
4420
4423
|
setConfig: function setConfig(config) {
|
|
4421
4424
|
return set(config);
|
|
@@ -4446,6 +4449,7 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4446
4449
|
return __generator(this, function (_f) {
|
|
4447
4450
|
switch (_f.label) {
|
|
4448
4451
|
case 0:
|
|
4452
|
+
debug("".concat(LOG_TAG, " requestCameraAccess"), new Error().stack);
|
|
4449
4453
|
_a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
4450
4454
|
releaseCameraAccess();
|
|
4451
4455
|
_f.label = 1;
|
|
@@ -4455,9 +4459,9 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4455
4459
|
case 2:
|
|
4456
4460
|
availableCameras = _f.sent();
|
|
4457
4461
|
selectedCamera = void 0;
|
|
4458
|
-
debug(
|
|
4462
|
+
debug("".concat(LOG_TAG, " availableCameras"), availableCameras);
|
|
4459
4463
|
platform_1 = getPlatform();
|
|
4460
|
-
debug(
|
|
4464
|
+
debug("".concat(LOG_TAG, " platformDetails"), platform_1);
|
|
4461
4465
|
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
4462
4466
|
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
4463
4467
|
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
@@ -4474,7 +4478,7 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4474
4478
|
availableCameras = availableCameras.sort(function (a, b) {
|
|
4475
4479
|
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
4476
4480
|
});
|
|
4477
|
-
debug(
|
|
4481
|
+
debug("".concat(LOG_TAG, " cameras have been sorted"), availableCameras);
|
|
4478
4482
|
}
|
|
4479
4483
|
if (preferFrontFacingCamera) {
|
|
4480
4484
|
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
@@ -4498,7 +4502,7 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4498
4502
|
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
4499
4503
|
}
|
|
4500
4504
|
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
4501
|
-
debug(
|
|
4505
|
+
debug("".concat(LOG_TAG, " selectedCamera"), selectedCamera);
|
|
4502
4506
|
set({
|
|
4503
4507
|
videoDevice: selectedCamera
|
|
4504
4508
|
});
|
|
@@ -4526,7 +4530,7 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4526
4530
|
_f.label = 3;
|
|
4527
4531
|
case 3:
|
|
4528
4532
|
_f.trys.push([3, 5,, 6]);
|
|
4529
|
-
debug(
|
|
4533
|
+
debug("".concat(LOG_TAG, " obtaining camera access with constraints"), constraints);
|
|
4530
4534
|
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
4531
4535
|
case 4:
|
|
4532
4536
|
stream_1 = _f.sent();
|
|
@@ -4558,21 +4562,21 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4558
4562
|
})];
|
|
4559
4563
|
case 8:
|
|
4560
4564
|
stream_1 = _f.sent();
|
|
4561
|
-
debug(
|
|
4565
|
+
debug("".concat(LOG_TAG, " opened stream with no width and height constraints"));
|
|
4562
4566
|
return [3 /*break*/, 10];
|
|
4563
4567
|
case 9:
|
|
4564
4568
|
e_2 = _f.sent();
|
|
4565
|
-
debug(
|
|
4569
|
+
debug("".concat(LOG_TAG, " cannot open stream at all"), e_2);
|
|
4566
4570
|
return [3 /*break*/, 10];
|
|
4567
4571
|
case 10:
|
|
4568
4572
|
if (!stream_1) {
|
|
4569
|
-
error(
|
|
4573
|
+
error("".concat(LOG_TAG, " failed to open camera"));
|
|
4570
4574
|
throw new Error('failed to open camera: ');
|
|
4571
4575
|
}
|
|
4572
|
-
debug(
|
|
4576
|
+
debug("".concat(LOG_TAG, " camera access requested with constraints"), constraints);
|
|
4573
4577
|
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
4574
4578
|
if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
|
|
4575
|
-
debug(
|
|
4579
|
+
debug("".concat(LOG_TAG, " someone unplugged the continuity camera"), camera);
|
|
4576
4580
|
videoStream = null;
|
|
4577
4581
|
set({
|
|
4578
4582
|
videoDevice: null,
|
|
@@ -4580,10 +4584,8 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4580
4584
|
iphoneContinuityCameraAvailable: false,
|
|
4581
4585
|
iphoneContinuityCameraDenied: true
|
|
4582
4586
|
});
|
|
4583
|
-
get().requestCameraAccess();
|
|
4584
4587
|
} else {
|
|
4585
|
-
debug(
|
|
4586
|
-
get().releaseCameraAccess();
|
|
4588
|
+
debug("".concat(LOG_TAG, " someone unplugged the webcam"), camera);
|
|
4587
4589
|
videoStream = null;
|
|
4588
4590
|
set({
|
|
4589
4591
|
videoDevice: null,
|
|
@@ -4593,16 +4595,25 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4593
4595
|
});
|
|
4594
4596
|
}
|
|
4595
4597
|
};
|
|
4596
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended',
|
|
4598
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', function () {
|
|
4599
|
+
debug("".concat(LOG_TAG, ":handleStreamEnded HTMLVideoElement ended event"));
|
|
4600
|
+
handleStreamEnded_1();
|
|
4601
|
+
});
|
|
4597
4602
|
videoTrack_1 = stream_1.getVideoTracks()[0];
|
|
4598
|
-
videoTrack_1.onended =
|
|
4603
|
+
videoTrack_1.onended = function () {
|
|
4604
|
+
debug("".concat(LOG_TAG, ":handleStreamEnded MediaStreamTrack onended"), 'videoStream', videoStream, 'videoTrack', videoTrack_1, 'camera', camera);
|
|
4605
|
+
handleStreamEnded_1();
|
|
4606
|
+
};
|
|
4599
4607
|
camera = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
|
|
4600
4608
|
setTimeout(function () {
|
|
4601
4609
|
var _a;
|
|
4602
4610
|
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4603
4611
|
// when the camera access is being requested. This delay is a workaround for that.
|
|
4604
4612
|
videoTrack_1.onmute = function () {
|
|
4605
|
-
if (videoTrack_1.readyState !== 'live')
|
|
4613
|
+
if (videoTrack_1.readyState !== 'live') {
|
|
4614
|
+
debug("".concat(LOG_TAG, ":handleStreamEnded MediaStreamTrack onmute"), 'videoStream', videoStream, 'videoTrack', videoTrack_1);
|
|
4615
|
+
handleStreamEnded_1();
|
|
4616
|
+
}
|
|
4606
4617
|
};
|
|
4607
4618
|
videoStream = stream_1;
|
|
4608
4619
|
var isRearFacing = (_a = camera === null || camera === void 0 ? void 0 : camera.isRearFacing) !== null && _a !== void 0 ? _a : false;
|
|
@@ -4616,12 +4627,12 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4616
4627
|
case 11:
|
|
4617
4628
|
e_3 = _f.sent();
|
|
4618
4629
|
if (e_3.name === 'NotAllowedError' || ((_e = e_3.message) === null || _e === void 0 ? void 0 : _e.includes('Could not start video source'))) {
|
|
4619
|
-
error(
|
|
4630
|
+
error("".concat(LOG_TAG, " camera access has been blocked by the user"), e_3);
|
|
4620
4631
|
set({
|
|
4621
4632
|
cameraAccessDenied: true
|
|
4622
4633
|
});
|
|
4623
4634
|
} else {
|
|
4624
|
-
error(
|
|
4635
|
+
error("".concat(LOG_TAG, " camera access encountered some other error"), e_3);
|
|
4625
4636
|
throw e_3;
|
|
4626
4637
|
}
|
|
4627
4638
|
return [3 /*break*/, 12];
|
|
@@ -4634,12 +4645,10 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4634
4645
|
releaseCameraAccess: function releaseCameraAccess() {
|
|
4635
4646
|
return __awaiter(this, void 0, void 0, function () {
|
|
4636
4647
|
return __generator(this, function (_a) {
|
|
4648
|
+
debug("".concat(LOG_TAG, " release camera access"), 'camera', camera, 'videoStream', videoStream);
|
|
4637
4649
|
if (!camera) return [2 /*return*/];
|
|
4638
|
-
camera.release();
|
|
4650
|
+
camera.release(); // NOTE calls stop Camera tracks internally as noted above
|
|
4639
4651
|
camera = null;
|
|
4640
|
-
videoStream === null || videoStream === void 0 ? void 0 : videoStream.getTracks().forEach(function (track) {
|
|
4641
|
-
track.stop();
|
|
4642
|
-
});
|
|
4643
4652
|
videoStream = null;
|
|
4644
4653
|
set({
|
|
4645
4654
|
cameraReady: false,
|
|
@@ -4694,7 +4703,7 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4694
4703
|
return [3 /*break*/, 4];
|
|
4695
4704
|
case 3:
|
|
4696
4705
|
e_4 = _a.sent();
|
|
4697
|
-
debug(
|
|
4706
|
+
debug("".concat(LOG_TAG, " failed to open microphone"), e_4);
|
|
4698
4707
|
set({
|
|
4699
4708
|
microphoneAccessDenied: true
|
|
4700
4709
|
});
|
|
@@ -4721,6 +4730,7 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4721
4730
|
});
|
|
4722
4731
|
});
|
|
4723
4732
|
if (config.requestAccessAutomatically) {
|
|
4733
|
+
debug("".concat(LOG_TAG, " requesting camera access automatically"));
|
|
4724
4734
|
void store.getState().requestCameraAccess();
|
|
4725
4735
|
}
|
|
4726
4736
|
return _assign(_assign({}, store), {
|
|
@@ -14368,9 +14378,6 @@ function inferBlobType(blobPart) {
|
|
|
14368
14378
|
|
|
14369
14379
|
var signatureRecorder = null;
|
|
14370
14380
|
var signatureChunks = [];
|
|
14371
|
-
var ondataavailableInvocations = [];
|
|
14372
|
-
var ondataavailableStartTime;
|
|
14373
|
-
var lastCalculatedVideoChunkRate;
|
|
14374
14381
|
var videoSignatureInitialState = {
|
|
14375
14382
|
startRecording: function startRecording() {
|
|
14376
14383
|
return null;
|
|
@@ -14395,10 +14402,6 @@ var videoSignatureInitialState = {
|
|
|
14395
14402
|
signatureValid: false,
|
|
14396
14403
|
supportsRequestVideoFrameCallback: undefined,
|
|
14397
14404
|
supportsRoundRect: undefined,
|
|
14398
|
-
nullChunksReceived: 0,
|
|
14399
|
-
timesSignatureCleared: 0,
|
|
14400
|
-
finalChunkReceived: false,
|
|
14401
|
-
requestDataInterval: undefined,
|
|
14402
14405
|
onSignatureVideoCaptured: function onSignatureVideoCaptured() {
|
|
14403
14406
|
return null;
|
|
14404
14407
|
}
|
|
@@ -14411,11 +14414,8 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14411
14414
|
captureAudio = false;
|
|
14412
14415
|
}
|
|
14413
14416
|
if (!camera) throw new Error('Camera not found');
|
|
14414
|
-
// clear whatever we have recorded so far.
|
|
14417
|
+
// set our flag and clear whatever we have recorded so far.
|
|
14415
14418
|
signatureChunks = [];
|
|
14416
|
-
ondataavailableInvocations = [];
|
|
14417
|
-
ondataavailableStartTime = undefined;
|
|
14418
|
-
lastCalculatedVideoChunkRate = undefined;
|
|
14419
14419
|
// start recording from the output canvas to capture the signature
|
|
14420
14420
|
var outputStream = (_a = get().outputCanvas.current) === null || _a === void 0 ? void 0 : _a.captureStream(24);
|
|
14421
14421
|
if (!outputStream) throw new Error('outputStream not found');
|
|
@@ -14433,123 +14433,77 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14433
14433
|
recordingStartedAt: e.timeStamp
|
|
14434
14434
|
});
|
|
14435
14435
|
};
|
|
14436
|
+
var hasFirstChunk = false;
|
|
14436
14437
|
signatureRecorder.ondataavailable = function (event) {
|
|
14437
|
-
var now = performance.now();
|
|
14438
14438
|
signatureChunks.push(event.data);
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
set(
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
firstChunkReceivedAt: (_a = state.firstChunkReceivedAt) !== null && _a !== void 0 ? _a : now,
|
|
14445
|
-
lastChunkReceivedAt: now
|
|
14446
|
-
};
|
|
14439
|
+
if (!hasFirstChunk) {
|
|
14440
|
+
hasFirstChunk = true;
|
|
14441
|
+
set({
|
|
14442
|
+
firstChunkReceivedAt: performance.now(),
|
|
14443
|
+
lastChunkReceivedAt: performance.now()
|
|
14447
14444
|
});
|
|
14448
14445
|
} else {
|
|
14449
|
-
set(
|
|
14450
|
-
|
|
14451
|
-
return {
|
|
14452
|
-
nullChunksReceived: state.nullChunksReceived + 1,
|
|
14453
|
-
firstNullChunkReceivedAt: (_a = state.firstNullChunkReceivedAt) !== null && _a !== void 0 ? _a : now,
|
|
14454
|
-
lastNullChunkReceivedAt: now
|
|
14455
|
-
};
|
|
14446
|
+
set({
|
|
14447
|
+
lastChunkReceivedAt: performance.now()
|
|
14456
14448
|
});
|
|
14457
14449
|
}
|
|
14458
14450
|
};
|
|
14459
|
-
signatureRecorder.start();
|
|
14460
|
-
var interval = setInterval(function () {
|
|
14461
|
-
return signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.requestData();
|
|
14462
|
-
}, 250);
|
|
14451
|
+
signatureRecorder.start(250);
|
|
14463
14452
|
set({
|
|
14464
|
-
requestDataInterval: interval,
|
|
14465
14453
|
recordingStartRequestedAt: performance.now()
|
|
14466
14454
|
});
|
|
14467
14455
|
},
|
|
14468
14456
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
14469
14457
|
return __awaiter(this, void 0, void 0, function () {
|
|
14470
|
-
|
|
14471
|
-
|
|
14472
|
-
|
|
14473
|
-
return __generator(this, function (_b) {
|
|
14474
|
-
if (get().recordingStoppedAt) return [2 /*return*/];
|
|
14475
|
-
recordingStoppedAt = performance.now();
|
|
14476
|
-
set({
|
|
14477
|
-
recordingStoppedAt: recordingStoppedAt
|
|
14478
|
-
});
|
|
14479
|
-
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
14480
|
-
blob = new Blob(signatureChunks, {
|
|
14481
|
-
type: mimeType
|
|
14482
|
-
});
|
|
14483
|
-
signatureChunks = [];
|
|
14484
|
-
signatureRecorder = null;
|
|
14485
|
-
_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;
|
|
14486
|
-
metadata = {
|
|
14487
|
-
mimeType: mimeType,
|
|
14488
|
-
browserFeatures: {
|
|
14489
|
-
supportsRoundRect: supportsRoundRect,
|
|
14490
|
-
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
14491
|
-
},
|
|
14492
|
-
diagnostics: {
|
|
14493
|
-
nullChunksReceived: nullChunksReceived,
|
|
14494
|
-
firstNullChunkReceivedAt: firstNullChunkReceivedAt ? Math.ceil(firstNullChunkReceivedAt) : 0,
|
|
14495
|
-
lastNullChunkReceivedAt: lastNullChunkReceivedAt ? Math.ceil(lastNullChunkReceivedAt) : 0,
|
|
14496
|
-
finalChunkReceived: finalChunkReceived,
|
|
14497
|
-
finalChunkTimedOut: timedOut,
|
|
14498
|
-
finalChunkWaitedMs: Math.ceil(waitedMs),
|
|
14499
|
-
videoChunkRate: lastCalculatedVideoChunkRate,
|
|
14500
|
-
timesSignatureCleared: timesSignatureCleared
|
|
14501
|
-
},
|
|
14502
|
-
timingData: {
|
|
14503
|
-
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
14504
|
-
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
14505
|
-
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
14506
|
-
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
14507
|
-
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
14508
|
-
acceptClickedAt: acceptClickedAt ? Math.ceil(acceptClickedAt) : 0,
|
|
14509
|
-
clearClickedAt: clearClickedAt ? Math.ceil(clearClickedAt) : 0,
|
|
14510
|
-
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
14511
|
-
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
14512
|
-
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
14513
|
-
}
|
|
14514
|
-
};
|
|
14515
|
-
debug('signature video metadata', metadata);
|
|
14516
|
-
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, metadata);
|
|
14517
|
-
return [2 /*return*/];
|
|
14518
|
-
});
|
|
14519
|
-
});
|
|
14520
|
-
}
|
|
14521
|
-
var _a, recordingStartedAt, recordingStopRequestedAt, isRecording, _b, finalChunkReceived, timedOut, waitedMs;
|
|
14522
|
-
return __generator(this, function (_c) {
|
|
14523
|
-
switch (_c.label) {
|
|
14458
|
+
var _this = this;
|
|
14459
|
+
return __generator(this, function (_a) {
|
|
14460
|
+
switch (_a.label) {
|
|
14524
14461
|
case 0:
|
|
14525
|
-
_a = get(), recordingStartedAt = _a.recordingStartedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt;
|
|
14526
|
-
isRecording = !!recordingStartedAt && !recordingStopRequestedAt;
|
|
14527
|
-
if (!isRecording) return [2 /*return*/];
|
|
14528
14462
|
set({
|
|
14529
|
-
recordingStopRequestedAt: performance.now()
|
|
14530
|
-
recordingStoppedAt: undefined
|
|
14463
|
+
recordingStopRequestedAt: performance.now()
|
|
14531
14464
|
});
|
|
14532
|
-
|
|
14533
|
-
return [4 /*yield*/, waitForOneMoreChunk()
|
|
14534
|
-
// this represents the time that it is safe to release the camera access
|
|
14535
|
-
];
|
|
14465
|
+
if (!signatureRecorder) return [2 /*return*/];
|
|
14466
|
+
return [4 /*yield*/, waitForOneMoreChunk()];
|
|
14536
14467
|
case 1:
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14468
|
+
_a.sent();
|
|
14469
|
+
signatureRecorder.onstop = function () {
|
|
14470
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
14471
|
+
var recordingStoppedAt, mimeType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, acceptClickedAt, recordingStopRequestedAt, lastChunkReceivedAt, supportsRequestVideoFrameCallback, supportsRoundRect;
|
|
14472
|
+
return __generator(this, function (_b) {
|
|
14473
|
+
recordingStoppedAt = performance.now();
|
|
14474
|
+
set({
|
|
14475
|
+
recordingStoppedAt: recordingStoppedAt
|
|
14476
|
+
});
|
|
14477
|
+
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
14478
|
+
blob = new Blob(signatureChunks, {
|
|
14479
|
+
type: mimeType
|
|
14480
|
+
});
|
|
14481
|
+
signatureChunks = [];
|
|
14482
|
+
signatureRecorder = null;
|
|
14483
|
+
_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;
|
|
14484
|
+
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
|
|
14485
|
+
mimeType: mimeType,
|
|
14486
|
+
browserFeatures: {
|
|
14487
|
+
supportsRoundRect: supportsRoundRect,
|
|
14488
|
+
supportsRequestVideoFrameCallback: supportsRequestVideoFrameCallback
|
|
14489
|
+
},
|
|
14490
|
+
timingData: {
|
|
14491
|
+
recordingStartRequestedAt: recordingStartRequestedAt ? Math.ceil(recordingStartRequestedAt) : 0,
|
|
14492
|
+
recordingStartedAt: recordingStartedAt ? Math.ceil(recordingStartedAt) : 0,
|
|
14493
|
+
firstChunkReceivedAt: firstChunkReceivedAt ? Math.ceil(firstChunkReceivedAt) : 0,
|
|
14494
|
+
signatureStartedAt: signatureStartedAt ? Math.ceil(signatureStartedAt) : 0,
|
|
14495
|
+
signatureEndedAt: signatureEndedAt ? Math.ceil(signatureEndedAt) : 0,
|
|
14496
|
+
acceptClickedAt: acceptClickedAt ? Math.ceil(acceptClickedAt) : 0,
|
|
14497
|
+
recordingStopRequestedAt: recordingStopRequestedAt ? Math.ceil(recordingStopRequestedAt) : 0,
|
|
14498
|
+
recordingStoppedAt: Math.ceil(recordingStoppedAt),
|
|
14499
|
+
lastChunkReceivedAt: lastChunkReceivedAt ? Math.ceil(lastChunkReceivedAt) : 0
|
|
14500
|
+
}
|
|
14501
|
+
});
|
|
14502
|
+
return [2 /*return*/];
|
|
14503
|
+
});
|
|
14504
|
+
});
|
|
14505
|
+
};
|
|
14544
14506
|
signatureRecorder.stop();
|
|
14545
|
-
return [3 /*break*/, 4];
|
|
14546
|
-
case 2:
|
|
14547
|
-
warn('signature recorder not found, processing video immediately');
|
|
14548
|
-
return [4 /*yield*/, processVideo()];
|
|
14549
|
-
case 3:
|
|
14550
|
-
_c.sent();
|
|
14551
|
-
_c.label = 4;
|
|
14552
|
-
case 4:
|
|
14553
14507
|
return [2 /*return*/];
|
|
14554
14508
|
}
|
|
14555
14509
|
});
|
|
@@ -14557,9 +14511,6 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14557
14511
|
},
|
|
14558
14512
|
clearRecordedData: function clearRecordedData() {
|
|
14559
14513
|
signatureChunks = [];
|
|
14560
|
-
ondataavailableInvocations = [];
|
|
14561
|
-
ondataavailableStartTime = undefined;
|
|
14562
|
-
lastCalculatedVideoChunkRate = undefined;
|
|
14563
14514
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
14564
14515
|
signatureRecorder = null;
|
|
14565
14516
|
set({
|
|
@@ -14574,13 +14525,8 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14574
14525
|
signatureStartedAt: undefined,
|
|
14575
14526
|
signatureEndedAt: undefined,
|
|
14576
14527
|
acceptClickedAt: undefined,
|
|
14577
|
-
// Note: clearClickedAt is intentionally preserved for telemetry metadata
|
|
14578
14528
|
supportsRequestVideoFrameCallback: undefined,
|
|
14579
|
-
supportsRoundRect: undefined
|
|
14580
|
-
nullChunksReceived: 0,
|
|
14581
|
-
firstNullChunkReceivedAt: undefined,
|
|
14582
|
-
lastNullChunkReceivedAt: undefined,
|
|
14583
|
-
finalChunkReceived: false
|
|
14529
|
+
supportsRoundRect: undefined
|
|
14584
14530
|
});
|
|
14585
14531
|
}
|
|
14586
14532
|
});
|
|
@@ -14590,11 +14536,11 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14590
14536
|
* @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.
|
|
14591
14537
|
* @param checkEveryMs - The interval in milliseconds between checks after the initial delay has passed.
|
|
14592
14538
|
* @param timeoutMs - The maximum time in milliseconds to wait for the chunk -- this is used to prevent infinite loops.
|
|
14593
|
-
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received.
|
|
14539
|
+
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received.
|
|
14594
14540
|
*/
|
|
14595
14541
|
function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
14596
14542
|
if (delayMs === void 0) {
|
|
14597
|
-
delayMs =
|
|
14543
|
+
delayMs = 1000;
|
|
14598
14544
|
}
|
|
14599
14545
|
if (checkEveryMs === void 0) {
|
|
14600
14546
|
checkEveryMs = 100;
|
|
@@ -14602,44 +14548,29 @@ function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
|
14602
14548
|
if (timeoutMs === void 0) {
|
|
14603
14549
|
timeoutMs = 3000;
|
|
14604
14550
|
}
|
|
14551
|
+
var start = performance.now();
|
|
14605
14552
|
return new Promise(function (resolve) {
|
|
14606
|
-
var
|
|
14607
|
-
|
|
14608
|
-
var initialLastChunkReceivedAt = (_a = useVideoSignatureStore.getState().lastChunkReceivedAt) !== null && _a !== void 0 ? _a : start;
|
|
14609
|
-
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.requestData();
|
|
14610
|
-
function checkForChunk() {
|
|
14553
|
+
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14554
|
+
function gotAChunk() {
|
|
14611
14555
|
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14612
|
-
|
|
14613
|
-
var timedOut = waitedMs > timeoutMs;
|
|
14614
|
-
var finalChunkReceived = !!lastChunkReceivedAt && !!initialLastChunkReceivedAt && lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
14615
|
-
return {
|
|
14616
|
-
waitedMs: waitedMs,
|
|
14617
|
-
finalChunkReceived: finalChunkReceived,
|
|
14618
|
-
timedOut: timedOut
|
|
14619
|
-
};
|
|
14556
|
+
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
14620
14557
|
}
|
|
14621
14558
|
setTimeout(function () {
|
|
14622
|
-
// check immediately
|
|
14623
|
-
var result = checkForChunk();
|
|
14624
|
-
if (result.finalChunkReceived || result.timedOut) return resolve(result);
|
|
14559
|
+
if (gotAChunk()) return resolve(); // check immediately
|
|
14625
14560
|
// otherwise, check on a configured interval
|
|
14626
14561
|
var interval = setInterval(function () {
|
|
14627
|
-
|
|
14628
|
-
if (result.finalChunkReceived || result.timedOut) {
|
|
14562
|
+
if (gotAChunk()) {
|
|
14629
14563
|
clearInterval(interval);
|
|
14630
|
-
resolve(
|
|
14564
|
+
resolve();
|
|
14631
14565
|
}
|
|
14632
14566
|
}, checkEveryMs);
|
|
14633
14567
|
}, delayMs);
|
|
14634
14568
|
});
|
|
14635
14569
|
}
|
|
14636
14570
|
function VideoSignatureContextProvider(_a) {
|
|
14571
|
+
var _b, _c;
|
|
14637
14572
|
var children = _a.children;
|
|
14638
|
-
var
|
|
14639
|
-
videoRef = _b.videoRef,
|
|
14640
|
-
videoWidth = _b.videoWidth,
|
|
14641
|
-
videoHeight = _b.videoHeight,
|
|
14642
|
-
releaseCameraAccess = _b.releaseCameraAccess;
|
|
14573
|
+
var videoRef = useCameraStore().videoRef;
|
|
14643
14574
|
var outputCanvas = useRef(null);
|
|
14644
14575
|
useEffect(function () {
|
|
14645
14576
|
return useVideoSignatureStore.setState({
|
|
@@ -14647,13 +14578,18 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14647
14578
|
});
|
|
14648
14579
|
}, []);
|
|
14649
14580
|
var drawOutputFrame = useCallback(function () {
|
|
14650
|
-
if (!outputCanvas.current) return;
|
|
14581
|
+
if (!outputCanvas.current || !videoRef.current) return;
|
|
14651
14582
|
var ctx = outputCanvas.current.getContext('2d');
|
|
14652
14583
|
if (!ctx) return;
|
|
14653
|
-
var _a = [
|
|
14584
|
+
var _a = [videoRef.current.videoWidth, videoRef.current.videoHeight],
|
|
14654
14585
|
w = _a[0],
|
|
14655
14586
|
h = _a[1];
|
|
14656
14587
|
var isPortrait = w < h;
|
|
14588
|
+
// Only update canvas dimensions if they changed (setting dimensions clears the canvas!)
|
|
14589
|
+
if (outputCanvas.current.width !== w || outputCanvas.current.height !== h) {
|
|
14590
|
+
outputCanvas.current.width = w;
|
|
14591
|
+
outputCanvas.current.height = h;
|
|
14592
|
+
}
|
|
14657
14593
|
var rect = [w * (isPortrait ? 0.02 : 0.15),
|
|
14658
14594
|
// x
|
|
14659
14595
|
h * (isPortrait ? 0.15 : 0.25),
|
|
@@ -14662,9 +14598,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14662
14598
|
// width
|
|
14663
14599
|
h * (isPortrait ? 0.7 : 0.5) // height
|
|
14664
14600
|
];
|
|
14665
|
-
|
|
14666
|
-
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
14667
|
-
}
|
|
14601
|
+
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
14668
14602
|
ctx.beginPath();
|
|
14669
14603
|
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
|
14670
14604
|
var supportsRoundRect = typeof ctx.roundRect === 'function';
|
|
@@ -14686,15 +14620,11 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14686
14620
|
ctx.drawImage.apply(ctx, __spreadArray([signatureCanvas], rect, false));
|
|
14687
14621
|
}
|
|
14688
14622
|
}, [videoRef]);
|
|
14689
|
-
|
|
14690
|
-
useEffect(function () {
|
|
14691
|
-
if (finalChunkReceived) releaseCameraAccess();
|
|
14692
|
-
}, [finalChunkReceived, releaseCameraAccess]);
|
|
14693
|
-
useVideoFrameLoop(videoRef, drawOutputFrame, !finalChunkReceived);
|
|
14623
|
+
useVideoFrameLoop(videoRef, drawOutputFrame);
|
|
14694
14624
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
14695
14625
|
ref: outputCanvas,
|
|
14696
|
-
width: videoWidth,
|
|
14697
|
-
height: videoHeight
|
|
14626
|
+
width: (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth,
|
|
14627
|
+
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
14698
14628
|
}));
|
|
14699
14629
|
}
|
|
14700
14630
|
function requestVideoFrameCallback(video, onFrame) {
|
|
@@ -14714,11 +14644,8 @@ function requestVideoFrameCallback(video, onFrame) {
|
|
|
14714
14644
|
};
|
|
14715
14645
|
}
|
|
14716
14646
|
}
|
|
14717
|
-
function videoFrameLoop(video, onFrame
|
|
14718
|
-
if (
|
|
14719
|
-
running = true;
|
|
14720
|
-
}
|
|
14721
|
-
if (!video || !running) return;
|
|
14647
|
+
function videoFrameLoop(video, onFrame) {
|
|
14648
|
+
if (!video) return;
|
|
14722
14649
|
var cancelFn;
|
|
14723
14650
|
var canceled = false;
|
|
14724
14651
|
function onFrameRecursive() {
|
|
@@ -14739,51 +14666,10 @@ function videoFrameLoop(video, onFrame, running) {
|
|
|
14739
14666
|
if (cancelFn !== undefined) cancelFn();
|
|
14740
14667
|
};
|
|
14741
14668
|
}
|
|
14742
|
-
function useVideoFrameLoop(ref, onFrame
|
|
14743
|
-
if (running === void 0) {
|
|
14744
|
-
running = true;
|
|
14745
|
-
}
|
|
14669
|
+
function useVideoFrameLoop(ref, onFrame) {
|
|
14746
14670
|
useEffect(function () {
|
|
14747
|
-
return videoFrameLoop(ref.current, onFrame
|
|
14748
|
-
}, [onFrame, ref
|
|
14749
|
-
}
|
|
14750
|
-
function calculateAndStoreOndataavailableRate() {
|
|
14751
|
-
if (ondataavailableInvocations.length < 2 || !ondataavailableStartTime) {
|
|
14752
|
-
lastCalculatedVideoChunkRate = {
|
|
14753
|
-
averageRate: 0,
|
|
14754
|
-
minRate: 0,
|
|
14755
|
-
maxRate: 0,
|
|
14756
|
-
totalChunksReceived: ondataavailableInvocations.length,
|
|
14757
|
-
recordingDurationMs: 0
|
|
14758
|
-
};
|
|
14759
|
-
return;
|
|
14760
|
-
}
|
|
14761
|
-
var totalDuration = ondataavailableInvocations[ondataavailableInvocations.length - 1] - ondataavailableStartTime;
|
|
14762
|
-
var averageRate = (ondataavailableInvocations.length - 1) / (totalDuration / 1000); // invocations per second
|
|
14763
|
-
// Calculate rates for each interval between invocations
|
|
14764
|
-
var rates = [];
|
|
14765
|
-
for (var i = 1; i < ondataavailableInvocations.length; i++) {
|
|
14766
|
-
var intervalMs = ondataavailableInvocations[i] - ondataavailableInvocations[i - 1];
|
|
14767
|
-
var rate = 1000 / intervalMs; // invocations per second for this interval
|
|
14768
|
-
rates.push(rate);
|
|
14769
|
-
}
|
|
14770
|
-
var minRate = Math.min.apply(Math, rates);
|
|
14771
|
-
var maxRate = Math.max.apply(Math, rates);
|
|
14772
|
-
lastCalculatedVideoChunkRate = {
|
|
14773
|
-
averageRate: Math.round(averageRate * 100) / 100,
|
|
14774
|
-
// Round to 2 decimal places
|
|
14775
|
-
minRate: Math.round(minRate * 100) / 100,
|
|
14776
|
-
maxRate: Math.round(maxRate * 100) / 100,
|
|
14777
|
-
totalChunksReceived: ondataavailableInvocations.length,
|
|
14778
|
-
recordingDurationMs: Math.round(totalDuration)
|
|
14779
|
-
};
|
|
14780
|
-
}
|
|
14781
|
-
function trackVideoChunkRate(now) {
|
|
14782
|
-
// Track ondataavailable invocations for rate calculation
|
|
14783
|
-
ondataavailableStartTime !== null && ondataavailableStartTime !== void 0 ? ondataavailableStartTime : ondataavailableStartTime = now;
|
|
14784
|
-
ondataavailableInvocations.push(now);
|
|
14785
|
-
// Calculate and store the current rate
|
|
14786
|
-
calculateAndStoreOndataavailableRate();
|
|
14671
|
+
return videoFrameLoop(ref.current, onFrame);
|
|
14672
|
+
}, [onFrame, ref]);
|
|
14787
14673
|
}
|
|
14788
14674
|
|
|
14789
14675
|
function VideoSignaturePad(_a) {
|
|
@@ -15035,11 +14921,14 @@ function VideoSignatureCaptureComponent(_a, ref) {
|
|
|
15035
14921
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
15036
14922
|
startHeadTracking = _o.start,
|
|
15037
14923
|
stopHeadTracking = _o.stop;
|
|
15038
|
-
var
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
14924
|
+
var _p = useVideoSignatureStore(useShallow(function (state) {
|
|
14925
|
+
return {
|
|
14926
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt,
|
|
14927
|
+
acceptClickedAt: state.acceptClickedAt
|
|
14928
|
+
};
|
|
14929
|
+
})),
|
|
14930
|
+
firstChunkReceivedAt = _p.firstChunkReceivedAt,
|
|
14931
|
+
acceptClickedAt = _p.acceptClickedAt;
|
|
15043
14932
|
useImperativeHandle(ref, function () {
|
|
15044
14933
|
return {
|
|
15045
14934
|
clearRecordedData: function clearRecordedData() {
|
|
@@ -15065,15 +14954,15 @@ function VideoSignatureCaptureComponent(_a, ref) {
|
|
|
15065
14954
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15066
14955
|
guidanceMessageText: 'Please sign the box below'
|
|
15067
14956
|
});
|
|
15068
|
-
var
|
|
15069
|
-
headTrackingSatisfied =
|
|
15070
|
-
setHeadTrackingSatisfied =
|
|
15071
|
-
var
|
|
15072
|
-
lastFace =
|
|
15073
|
-
setLastFace =
|
|
15074
|
-
var
|
|
15075
|
-
numFramesWithoutFaces =
|
|
15076
|
-
setNumFramesWithoutFaces =
|
|
14957
|
+
var _q = useState(true),
|
|
14958
|
+
headTrackingSatisfied = _q[0],
|
|
14959
|
+
setHeadTrackingSatisfied = _q[1];
|
|
14960
|
+
var _r = useState(null),
|
|
14961
|
+
lastFace = _r[0],
|
|
14962
|
+
setLastFace = _r[1];
|
|
14963
|
+
var _s = useState(0),
|
|
14964
|
+
numFramesWithoutFaces = _s[0],
|
|
14965
|
+
setNumFramesWithoutFaces = _s[1];
|
|
15077
14966
|
onHeadTrackingPredictionMade(useThrottledCallback(useCallback(function (_a) {
|
|
15078
14967
|
var face = _a.face;
|
|
15079
14968
|
if (headTrackingDisabled) return;
|
|
@@ -15088,12 +14977,12 @@ function VideoSignatureCaptureComponent(_a, ref) {
|
|
|
15088
14977
|
return n + 1;
|
|
15089
14978
|
});
|
|
15090
14979
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
15091
|
-
var
|
|
15092
|
-
containerRef =
|
|
15093
|
-
|
|
15094
|
-
width =
|
|
15095
|
-
|
|
15096
|
-
height =
|
|
14980
|
+
var _t = useResizeObserver(),
|
|
14981
|
+
containerRef = _t.ref,
|
|
14982
|
+
_u = _t.width,
|
|
14983
|
+
width = _u === void 0 ? 1 : _u,
|
|
14984
|
+
_v = _t.height,
|
|
14985
|
+
height = _v === void 0 ? 1 : _v;
|
|
15097
14986
|
var debugScalingDetails = useDebugScalingDetails({
|
|
15098
14987
|
enabled: debugMode,
|
|
15099
14988
|
pageWidth: width,
|
|
@@ -15136,10 +15025,10 @@ function VideoSignatureCaptureComponent(_a, ref) {
|
|
|
15136
15025
|
face: lastFace,
|
|
15137
15026
|
scaling: debugScalingDetails,
|
|
15138
15027
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
15139
|
-
}))), /*#__PURE__*/React__default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__default.createElement("br", null), "Recording: ", firstChunkReceivedAt ? 'true' : 'false'))), /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
15028
|
+
}))), /*#__PURE__*/React__default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__default.createElement("br", null), "Recording: ", firstChunkReceivedAt ? 'true' : 'false'))), !acceptClickedAt && ( /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
15140
15029
|
onClick: onExit,
|
|
15141
15030
|
className: classNames.exitCaptureBtn
|
|
15142
|
-
}));
|
|
15031
|
+
})));
|
|
15143
15032
|
}
|
|
15144
15033
|
var VideoSignatureCapture = /*#__PURE__*/forwardRef(VideoSignatureCaptureComponent);
|
|
15145
15034
|
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"
|
|
@@ -15718,18 +15607,13 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
15718
15607
|
});
|
|
15719
15608
|
}, []);
|
|
15720
15609
|
var onClearBtnClicked = useCallback(function () {
|
|
15721
|
-
var _a;
|
|
15722
|
-
var _b = useVideoSignatureStore.getState(),
|
|
15723
|
-
timesSignatureCleared = _b.timesSignatureCleared,
|
|
15724
|
-
signaturePad = _b.signaturePad;
|
|
15610
|
+
var _a, _b;
|
|
15725
15611
|
useVideoSignatureStore.setState({
|
|
15726
|
-
clearClickedAt: performance.now(),
|
|
15727
|
-
timesSignatureCleared: timesSignatureCleared + 1,
|
|
15728
15612
|
signatureStartedAt: undefined,
|
|
15729
15613
|
signaturePadEmpty: true,
|
|
15730
15614
|
signatureValid: false
|
|
15731
15615
|
});
|
|
15732
|
-
(_a =
|
|
15616
|
+
(_b = (_a = useVideoSignatureStore.getState().signaturePad) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.clear();
|
|
15733
15617
|
if (restartVideoOnSignaturePadCleared) {
|
|
15734
15618
|
setTimeout(function () {
|
|
15735
15619
|
useVideoSignatureStore.getState().clearRecordedData();
|
|
@@ -16727,7 +16611,6 @@ var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(props) {
|
|
|
16727
16611
|
idFrontText: 'ID Front Image',
|
|
16728
16612
|
idBackText: 'ID Back Image'
|
|
16729
16613
|
});
|
|
16730
|
-
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
16731
16614
|
return /*#__PURE__*/React__default.createElement(OverlayContainer, {
|
|
16732
16615
|
className: classNames.container
|
|
16733
16616
|
}, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
|
|
@@ -16786,7 +16669,6 @@ var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(props) {
|
|
|
16786
16669
|
variant: "warning",
|
|
16787
16670
|
className: classNames.retryBtn,
|
|
16788
16671
|
onClick: function onClick() {
|
|
16789
|
-
void requestCameraAccess();
|
|
16790
16672
|
return onRetryClick === null || onRetryClick === void 0 ? void 0 : onRetryClick();
|
|
16791
16673
|
},
|
|
16792
16674
|
colors: colors.retryBtn,
|