idmission-web-sdk 2.3.103 → 2.3.104
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/submission/SubmissionProvider.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +2 -2
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +98 -49
- 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 +98 -49
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +98 -49
- 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.104';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2359,6 +2359,9 @@
|
|
|
2359
2359
|
return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
|
|
2360
2360
|
});
|
|
2361
2361
|
}, []);
|
|
2362
|
+
useRevokeObjectUrlOnUnmount(signatureVideoUrl);
|
|
2363
|
+
useRevokeObjectUrlOnUnmount(idCaptureVideoUrl);
|
|
2364
|
+
useRevokeObjectUrlOnUnmount(idCaptureVideoAudioUrl);
|
|
2362
2365
|
React.useEffect(function () {
|
|
2363
2366
|
if (precapturedDocuments === null || precapturedDocuments === void 0 ? void 0 : precapturedDocuments.selfie) {
|
|
2364
2367
|
setSelfieImage(dataUrlToBase64Sync(precapturedDocuments.selfie.imageData));
|
|
@@ -3142,6 +3145,13 @@
|
|
|
3142
3145
|
}
|
|
3143
3146
|
return context;
|
|
3144
3147
|
}
|
|
3148
|
+
function useRevokeObjectUrlOnUnmount(url) {
|
|
3149
|
+
React.useEffect(function () {
|
|
3150
|
+
return function () {
|
|
3151
|
+
if (url) URL.revokeObjectURL(url);
|
|
3152
|
+
};
|
|
3153
|
+
}, [url]);
|
|
3154
|
+
}
|
|
3145
3155
|
|
|
3146
3156
|
function _typeof$1(o) {
|
|
3147
3157
|
"@babel/helpers - typeof";
|
|
@@ -24207,7 +24217,11 @@
|
|
|
24207
24217
|
return null;
|
|
24208
24218
|
},
|
|
24209
24219
|
stopRecording: function stopRecording() {
|
|
24210
|
-
return
|
|
24220
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
24221
|
+
return __generator(this, function (_a) {
|
|
24222
|
+
return [2 /*return*/, void 0];
|
|
24223
|
+
});
|
|
24224
|
+
});
|
|
24211
24225
|
},
|
|
24212
24226
|
clearRecordedData: function clearRecordedData() {
|
|
24213
24227
|
return null;
|
|
@@ -24272,45 +24286,54 @@
|
|
|
24272
24286
|
});
|
|
24273
24287
|
},
|
|
24274
24288
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
24275
|
-
|
|
24276
|
-
|
|
24277
|
-
|
|
24278
|
-
|
|
24279
|
-
|
|
24280
|
-
signatureRecorder.stop();
|
|
24281
|
-
signatureRecorder.onstop = function () {
|
|
24282
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
24283
|
-
var recordingStoppedAt, inferredType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt;
|
|
24284
|
-
return __generator(this, function (_b) {
|
|
24285
|
-
recordingStoppedAt = performance.now();
|
|
24289
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24290
|
+
var _this = this;
|
|
24291
|
+
return __generator(this, function (_a) {
|
|
24292
|
+
switch (_a.label) {
|
|
24293
|
+
case 0:
|
|
24286
24294
|
set({
|
|
24287
|
-
|
|
24288
|
-
});
|
|
24289
|
-
inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
24290
|
-
blob = new Blob(signatureChunks, {
|
|
24291
|
-
type: inferredType
|
|
24292
|
-
});
|
|
24293
|
-
signatureChunks = [];
|
|
24294
|
-
signatureRecorder = null;
|
|
24295
|
-
if (!signatureData) return [2 /*return*/];
|
|
24296
|
-
_a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
24297
|
-
onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
|
|
24298
|
-
mimeType: inferredType,
|
|
24299
|
-
timingData: {
|
|
24300
|
-
recordingStartRequestedAt: recordingStartRequestedAt,
|
|
24301
|
-
recordingStartedAt: recordingStartedAt,
|
|
24302
|
-
firstChunkReceivedAt: firstChunkReceivedAt,
|
|
24303
|
-
signatureStartedAt: signatureStartedAt,
|
|
24304
|
-
signatureEndedAt: signatureEndedAt,
|
|
24305
|
-
recordingStopRequestedAt: recordingStopRequestedAt,
|
|
24306
|
-
recordingStoppedAt: recordingStoppedAt,
|
|
24307
|
-
lastChunkReceivedAt: lastChunkReceivedAt
|
|
24308
|
-
}
|
|
24295
|
+
recordingStopRequestedAt: performance.now()
|
|
24309
24296
|
});
|
|
24297
|
+
if (!signatureRecorder) return [2 /*return*/];
|
|
24298
|
+
return [4 /*yield*/, waitForOneMoreChunk()];
|
|
24299
|
+
case 1:
|
|
24300
|
+
_a.sent();
|
|
24301
|
+
signatureRecorder.onstop = function () {
|
|
24302
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
24303
|
+
var recordingStoppedAt, mimeType, blob, _a, onSignatureVideoCaptured, recordingStartRequestedAt, recordingStartedAt, firstChunkReceivedAt, signatureStartedAt, signatureEndedAt, recordingStopRequestedAt, lastChunkReceivedAt;
|
|
24304
|
+
return __generator(this, function (_b) {
|
|
24305
|
+
recordingStoppedAt = performance.now();
|
|
24306
|
+
set({
|
|
24307
|
+
recordingStoppedAt: recordingStoppedAt
|
|
24308
|
+
});
|
|
24309
|
+
mimeType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
24310
|
+
blob = new Blob(signatureChunks, {
|
|
24311
|
+
type: mimeType
|
|
24312
|
+
});
|
|
24313
|
+
signatureChunks = [];
|
|
24314
|
+
signatureRecorder = null;
|
|
24315
|
+
_a = get(), onSignatureVideoCaptured = _a.onSignatureVideoCaptured, recordingStartRequestedAt = _a.recordingStartRequestedAt, recordingStartedAt = _a.recordingStartedAt, firstChunkReceivedAt = _a.firstChunkReceivedAt, signatureStartedAt = _a.signatureStartedAt, signatureEndedAt = _a.signatureEndedAt, recordingStopRequestedAt = _a.recordingStopRequestedAt, lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
24316
|
+
onSignatureVideoCaptured(blob, signatureData !== null && signatureData !== void 0 ? signatureData : null, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, {
|
|
24317
|
+
mimeType: mimeType,
|
|
24318
|
+
timingData: {
|
|
24319
|
+
recordingStartRequestedAt: recordingStartRequestedAt,
|
|
24320
|
+
recordingStartedAt: recordingStartedAt,
|
|
24321
|
+
firstChunkReceivedAt: firstChunkReceivedAt,
|
|
24322
|
+
signatureStartedAt: signatureStartedAt,
|
|
24323
|
+
signatureEndedAt: signatureEndedAt,
|
|
24324
|
+
recordingStopRequestedAt: recordingStopRequestedAt,
|
|
24325
|
+
recordingStoppedAt: recordingStoppedAt,
|
|
24326
|
+
lastChunkReceivedAt: lastChunkReceivedAt
|
|
24327
|
+
}
|
|
24328
|
+
});
|
|
24329
|
+
return [2 /*return*/];
|
|
24330
|
+
});
|
|
24331
|
+
});
|
|
24332
|
+
};
|
|
24333
|
+
signatureRecorder.stop();
|
|
24310
24334
|
return [2 /*return*/];
|
|
24311
|
-
|
|
24312
|
-
|
|
24313
|
-
};
|
|
24335
|
+
}
|
|
24336
|
+
});
|
|
24314
24337
|
});
|
|
24315
24338
|
},
|
|
24316
24339
|
clearRecordedData: function clearRecordedData() {
|
|
@@ -24330,28 +24353,40 @@
|
|
|
24330
24353
|
}
|
|
24331
24354
|
});
|
|
24332
24355
|
}));
|
|
24333
|
-
|
|
24356
|
+
/**
|
|
24357
|
+
* Wait for one more chunk to be received after the recording has stopped.
|
|
24358
|
+
* @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.
|
|
24359
|
+
* @param checkEveryMs - The interval in milliseconds between checks after the initial delay has passed.
|
|
24360
|
+
* @param timeoutMs - The maximum time in milliseconds to wait for the chunk -- this is used to prevent infinite loops.
|
|
24361
|
+
* @returns A promise that resolves when the delay has passed and at least one chunk has been received received.
|
|
24362
|
+
*/
|
|
24363
|
+
function waitForOneMoreChunk(delayMs, checkEveryMs, timeoutMs) {
|
|
24364
|
+
if (delayMs === void 0) {
|
|
24365
|
+
delayMs = 1000;
|
|
24366
|
+
}
|
|
24367
|
+
if (checkEveryMs === void 0) {
|
|
24368
|
+
checkEveryMs = 100;
|
|
24369
|
+
}
|
|
24334
24370
|
if (timeoutMs === void 0) {
|
|
24335
24371
|
timeoutMs = 3000;
|
|
24336
24372
|
}
|
|
24337
24373
|
var start = performance.now();
|
|
24338
24374
|
return new Promise(function (resolve) {
|
|
24339
24375
|
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
24340
|
-
if (!initialLastChunkReceivedAt) return resolve();
|
|
24341
24376
|
function gotAChunk() {
|
|
24342
24377
|
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
24343
24378
|
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
24344
24379
|
}
|
|
24345
24380
|
setTimeout(function () {
|
|
24346
24381
|
if (gotAChunk()) return resolve(); // check immediately
|
|
24347
|
-
// otherwise, check
|
|
24382
|
+
// otherwise, check on a configured interval
|
|
24348
24383
|
var interval = setInterval(function () {
|
|
24349
24384
|
if (gotAChunk()) {
|
|
24350
24385
|
clearInterval(interval);
|
|
24351
24386
|
resolve();
|
|
24352
24387
|
}
|
|
24353
|
-
},
|
|
24354
|
-
},
|
|
24388
|
+
}, checkEveryMs);
|
|
24389
|
+
}, delayMs);
|
|
24355
24390
|
});
|
|
24356
24391
|
}
|
|
24357
24392
|
function VideoSignatureContextProvider(_a) {
|
|
@@ -24457,23 +24492,37 @@
|
|
|
24457
24492
|
}
|
|
24458
24493
|
function requestVideoFrameCallback(video, onFrame) {
|
|
24459
24494
|
if (typeof (video === null || video === void 0 ? void 0 : video.requestVideoFrameCallback) === 'function') {
|
|
24460
|
-
video.requestVideoFrameCallback(onFrame);
|
|
24495
|
+
var rafId_1 = video.requestVideoFrameCallback(onFrame);
|
|
24496
|
+
return function () {
|
|
24497
|
+
return video.cancelVideoFrameCallback(rafId_1);
|
|
24498
|
+
};
|
|
24461
24499
|
} else {
|
|
24462
|
-
requestAnimationFrame(onFrame);
|
|
24500
|
+
var rafId_2 = requestAnimationFrame(onFrame);
|
|
24501
|
+
return function () {
|
|
24502
|
+
return cancelAnimationFrame(rafId_2);
|
|
24503
|
+
};
|
|
24463
24504
|
}
|
|
24464
24505
|
}
|
|
24465
24506
|
function videoFrameLoop(video, onFrame) {
|
|
24466
24507
|
if (!video) return;
|
|
24508
|
+
var cancelFn;
|
|
24509
|
+
var canceled = false;
|
|
24467
24510
|
function onFrameRecursive() {
|
|
24511
|
+
if (canceled) return;
|
|
24468
24512
|
onFrame();
|
|
24469
|
-
requestVideoFrameCallback(video, onFrameRecursive);
|
|
24513
|
+
cancelFn = requestVideoFrameCallback(video, onFrameRecursive);
|
|
24470
24514
|
}
|
|
24471
24515
|
function onPlay() {
|
|
24472
|
-
|
|
24516
|
+
if (canceled) return;
|
|
24517
|
+
cancelFn = requestVideoFrameCallback(video, onFrameRecursive);
|
|
24473
24518
|
}
|
|
24474
24519
|
video.addEventListener('play', onPlay);
|
|
24520
|
+
// If video already playing, start immediately
|
|
24521
|
+
if (!video.paused && video.readyState >= 2) onPlay();
|
|
24475
24522
|
return function () {
|
|
24523
|
+
canceled = true;
|
|
24476
24524
|
video.removeEventListener('play', onPlay);
|
|
24525
|
+
if (cancelFn !== undefined) cancelFn();
|
|
24477
24526
|
};
|
|
24478
24527
|
}
|
|
24479
24528
|
function useVideoFrameLoop(ref, onFrame) {
|
|
@@ -24723,7 +24772,7 @@
|
|
|
24723
24772
|
React.useEffect(function () {
|
|
24724
24773
|
useVideoSignatureStore.getState().startRecording(captureAudio);
|
|
24725
24774
|
return function () {
|
|
24726
|
-
return useVideoSignatureStore.getState().stopRecording();
|
|
24775
|
+
return void useVideoSignatureStore.getState().stopRecording();
|
|
24727
24776
|
};
|
|
24728
24777
|
}, [captureAudio]);
|
|
24729
24778
|
React.useEffect(function () {
|
|
@@ -25196,7 +25245,7 @@
|
|
|
25196
25245
|
}).then(onSelfieCaptured);
|
|
25197
25246
|
}, [logCaptureMetadata, onSelfieCaptured, setSelfieImage, uploadDocument]);
|
|
25198
25247
|
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData, metadata) {
|
|
25199
|
-
setSignatureData(signatureData);
|
|
25248
|
+
if (signatureData) setSignatureData(signatureData);
|
|
25200
25249
|
setSignatureVideoUrl(URL.createObjectURL(videoData));
|
|
25201
25250
|
setSignatureVideoMetadata(metadata);
|
|
25202
25251
|
setCaptureState('SUCCESS');
|