idmission-web-sdk 2.3.12 → 2.3.13
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.map +1 -1
- package/dist/sdk2.cjs.development.js +65 -63
- 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 +65 -63
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +65 -63
- 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
|
@@ -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.13';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -23397,15 +23397,34 @@
|
|
|
23397
23397
|
};
|
|
23398
23398
|
|
|
23399
23399
|
var signatureRecorder = null;
|
|
23400
|
-
function getSignatureRecorder() {
|
|
23400
|
+
var getSignatureRecorder = function getSignatureRecorder() {
|
|
23401
23401
|
return signatureRecorder;
|
|
23402
|
-
}
|
|
23403
|
-
function setSignatureRecorder(recorder) {
|
|
23404
|
-
signatureRecorder = recorder;
|
|
23405
|
-
}
|
|
23402
|
+
};
|
|
23403
|
+
var setSignatureRecorder = function setSignatureRecorder(recorder) {
|
|
23404
|
+
return signatureRecorder = recorder;
|
|
23405
|
+
};
|
|
23406
23406
|
var signatureChunks = [];
|
|
23407
|
-
function clearSignatureChunks() {
|
|
23408
|
-
signatureChunks = [];
|
|
23407
|
+
var clearSignatureChunks = function clearSignatureChunks() {
|
|
23408
|
+
return signatureChunks = [];
|
|
23409
|
+
};
|
|
23410
|
+
var recordingLock = false;
|
|
23411
|
+
var setRecordingLock = function setRecordingLock(lock) {
|
|
23412
|
+
return recordingLock = lock;
|
|
23413
|
+
};
|
|
23414
|
+
var recordingLockEngaged = function recordingLockEngaged() {
|
|
23415
|
+
return recordingLock;
|
|
23416
|
+
};
|
|
23417
|
+
function waitForCanvasAvailable(canvasRef) {
|
|
23418
|
+
if (canvasRef.current) return Promise.resolve(null);
|
|
23419
|
+
return new Promise(function (resolve) {
|
|
23420
|
+
var interval = setInterval(function () {
|
|
23421
|
+
debug('VideoSignatureContext: waiting for output canvas');
|
|
23422
|
+
if (canvasRef.current) {
|
|
23423
|
+
clearInterval(interval);
|
|
23424
|
+
resolve(null);
|
|
23425
|
+
}
|
|
23426
|
+
}, 100);
|
|
23427
|
+
});
|
|
23409
23428
|
}
|
|
23410
23429
|
var videoSignatureInitialState = {
|
|
23411
23430
|
startRecording: function startRecording() {
|
|
@@ -23462,7 +23481,6 @@
|
|
|
23462
23481
|
stopRecordingAudio = _k.stopRecordingAudio,
|
|
23463
23482
|
clearRecordedVideoData = _k.clearRecordedData;
|
|
23464
23483
|
var outputCanvas = React.useRef(null);
|
|
23465
|
-
var recordingLock = React.useRef(false);
|
|
23466
23484
|
var onRecordingStopped = React.useRef(function () {});
|
|
23467
23485
|
var _l = React.useState(false),
|
|
23468
23486
|
isRecording = _l[0],
|
|
@@ -23481,67 +23499,45 @@
|
|
|
23481
23499
|
setIsRecording(true);
|
|
23482
23500
|
onRecordingStopped.current = function () {};
|
|
23483
23501
|
};
|
|
23484
|
-
|
|
23502
|
+
setRecordingLock(false);
|
|
23485
23503
|
setIsRecording(false);
|
|
23486
23504
|
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
23487
23505
|
setSignatureRecorder(null);
|
|
23488
23506
|
}, []);
|
|
23489
23507
|
React.useEffect(function () {
|
|
23490
23508
|
if (!isRecording) return;
|
|
23491
|
-
if (
|
|
23492
|
-
|
|
23493
|
-
(function () {
|
|
23494
|
-
|
|
23495
|
-
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
|
-
|
|
23502
|
-
|
|
23503
|
-
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
}
|
|
23507
|
-
}, 10);
|
|
23508
|
-
})];
|
|
23509
|
-
case 1:
|
|
23510
|
-
_b.sent();
|
|
23511
|
-
_b.label = 2;
|
|
23512
|
-
case 2:
|
|
23513
|
-
clearSignatureChunks();
|
|
23514
|
-
clearRecordedVideoData();
|
|
23515
|
-
startRecordingVideo();
|
|
23516
|
-
if (captureAudio) startRecordingAudio();
|
|
23517
|
-
stream = outputCanvas.current.captureStream(24 /* fps */);
|
|
23518
|
-
tracks = [stream.getVideoTracks()[0]];
|
|
23519
|
-
audioTrack = (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks()) === null || _a === void 0 ? void 0 : _a[0];
|
|
23520
|
-
if (audioTrack) tracks.push(audioTrack);
|
|
23521
|
-
signatureRecorder = new MediaRecorder(new MediaStream(tracks), {
|
|
23522
|
-
videoBitsPerSecond: 270000,
|
|
23523
|
-
audioBitsPerSecond: 32000
|
|
23524
|
-
});
|
|
23525
|
-
setSignatureRecorder(signatureRecorder);
|
|
23526
|
-
signatureRecorder.start();
|
|
23527
|
-
signatureRecorder.ondataavailable = function (event) {
|
|
23528
|
-
signatureChunks.push(event.data);
|
|
23529
|
-
};
|
|
23530
|
-
signatureRecorder.onstop = function () {
|
|
23531
|
-
var blob = new Blob(signatureChunks, {
|
|
23532
|
-
type: 'video/mp4'
|
|
23533
|
-
});
|
|
23534
|
-
setSignatureVideoData(blob);
|
|
23535
|
-
setSignatureVideoUrl(URL.createObjectURL(blob));
|
|
23536
|
-
clearSignatureChunks();
|
|
23537
|
-
setSignatureRecorder(null);
|
|
23538
|
-
onRecordingStopped.current();
|
|
23539
|
-
};
|
|
23540
|
-
return [2 /*return*/];
|
|
23541
|
-
}
|
|
23542
|
-
});
|
|
23509
|
+
if (recordingLockEngaged()) return;
|
|
23510
|
+
setRecordingLock(true);
|
|
23511
|
+
waitForCanvasAvailable(outputCanvas).then(function () {
|
|
23512
|
+
var _a;
|
|
23513
|
+
clearSignatureChunks();
|
|
23514
|
+
clearRecordedVideoData();
|
|
23515
|
+
startRecordingVideo();
|
|
23516
|
+
if (captureAudio) startRecordingAudio();
|
|
23517
|
+
var stream = outputCanvas.current.captureStream(24 /* fps */);
|
|
23518
|
+
var tracks = [stream.getVideoTracks()[0]];
|
|
23519
|
+
var audioTrack = (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks()) === null || _a === void 0 ? void 0 : _a[0];
|
|
23520
|
+
if (audioTrack) tracks.push(audioTrack);
|
|
23521
|
+
var signatureRecorder = new MediaRecorder(new MediaStream(tracks), {
|
|
23522
|
+
videoBitsPerSecond: 270000,
|
|
23523
|
+
audioBitsPerSecond: 32000
|
|
23543
23524
|
});
|
|
23544
|
-
|
|
23525
|
+
setSignatureRecorder(signatureRecorder);
|
|
23526
|
+
signatureRecorder.ondataavailable = function (event) {
|
|
23527
|
+
signatureChunks.push(event.data);
|
|
23528
|
+
};
|
|
23529
|
+
signatureRecorder.onstop = function () {
|
|
23530
|
+
var blob = new Blob(signatureChunks, {
|
|
23531
|
+
type: 'video/mp4'
|
|
23532
|
+
});
|
|
23533
|
+
setSignatureVideoData(blob);
|
|
23534
|
+
setSignatureVideoUrl(URL.createObjectURL(blob));
|
|
23535
|
+
clearSignatureChunks();
|
|
23536
|
+
setSignatureRecorder(null);
|
|
23537
|
+
onRecordingStopped.current();
|
|
23538
|
+
};
|
|
23539
|
+
signatureRecorder.start(1000);
|
|
23540
|
+
});
|
|
23545
23541
|
}, [audioStream, captureAudio, clearRecordedVideoData, isRecording, startRecordingAudio, startRecordingVideo]);
|
|
23546
23542
|
var animationFrame = React.useRef(0);
|
|
23547
23543
|
React.useEffect(function () {
|
|
@@ -23583,16 +23579,22 @@
|
|
|
23583
23579
|
return __generator(this, function (_b) {
|
|
23584
23580
|
switch (_b.label) {
|
|
23585
23581
|
case 0:
|
|
23582
|
+
debug('VideoSignatureContext: onAcceptClicked');
|
|
23586
23583
|
if (!signaturePad.current) return [2 /*return*/];
|
|
23584
|
+
debug('VideoSignatureContext: building signature data...');
|
|
23587
23585
|
signatureData = buildSignatureData(signaturePad.current);
|
|
23586
|
+
debug('VideoSignatureContext: exporting signature image...');
|
|
23588
23587
|
return [4 /*yield*/, exportSignatureImage(signaturePad.current)];
|
|
23589
23588
|
case 1:
|
|
23590
23589
|
imageUrl = _b.sent();
|
|
23591
23590
|
if (imageUrl) signatureData.fileContent = dataUrlToBase64Sync(imageUrl);
|
|
23591
|
+
debug('VideoSignatureContext: setting signature data url...');
|
|
23592
23592
|
setSignatureDataUrl(imageUrl);
|
|
23593
23593
|
setSignatureData(signatureData);
|
|
23594
|
+
debug('VideoSignatureContext: stopping recording...');
|
|
23594
23595
|
stopRecordingVideo();
|
|
23595
23596
|
stopRecordingAudio();
|
|
23597
|
+
debug('VideoSignatureContext: stopping signature recorder...');
|
|
23596
23598
|
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
23597
23599
|
return [2 /*return*/];
|
|
23598
23600
|
}
|