idmission-web-sdk 2.3.88 → 2.3.89
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 +2 -0
- package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
- package/dist/components/submission/types.d.ts +2 -0
- package/dist/components/submission/types.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 +7 -2
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureGuides.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignaturePad.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts +1 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
- package/dist/lib/camera/useVideoRecorder.d.ts.map +1 -1
- package/dist/lib/utils/blobs.d.ts +3 -0
- package/dist/lib/utils/blobs.d.ts.map +1 -0
- package/dist/sdk2.cjs.development.js +208 -81
- 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 +208 -81
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +208 -81
- 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.89';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2125,6 +2125,12 @@
|
|
|
2125
2125
|
setIdCaptureVideoUrl: function setIdCaptureVideoUrl() {
|
|
2126
2126
|
return null;
|
|
2127
2127
|
},
|
|
2128
|
+
setSignatureStartTimestamp: function setSignatureStartTimestamp() {
|
|
2129
|
+
return null;
|
|
2130
|
+
},
|
|
2131
|
+
setSignatureEndTimestamp: function setSignatureEndTimestamp() {
|
|
2132
|
+
return null;
|
|
2133
|
+
},
|
|
2128
2134
|
setIdCaptureVideoIdFrontImage: function setIdCaptureVideoIdFrontImage() {
|
|
2129
2135
|
return null;
|
|
2130
2136
|
},
|
|
@@ -2289,44 +2295,50 @@
|
|
|
2289
2295
|
signatureVideoUrl = _16[0],
|
|
2290
2296
|
setSignatureVideoUrl = _16[1];
|
|
2291
2297
|
var _17 = React.useState(null),
|
|
2292
|
-
|
|
2293
|
-
|
|
2298
|
+
signatureStartTimestamp = _17[0],
|
|
2299
|
+
setSignatureStartTimestamp = _17[1];
|
|
2294
2300
|
var _18 = React.useState(null),
|
|
2295
|
-
|
|
2296
|
-
|
|
2301
|
+
signatureEndTimestamp = _18[0],
|
|
2302
|
+
setSignatureEndTimestamp = _18[1];
|
|
2297
2303
|
var _19 = React.useState(null),
|
|
2298
|
-
|
|
2299
|
-
|
|
2304
|
+
idCaptureVideoUrl = _19[0],
|
|
2305
|
+
setIdCaptureVideoUrl = _19[1];
|
|
2300
2306
|
var _20 = React.useState(null),
|
|
2301
|
-
|
|
2302
|
-
|
|
2307
|
+
idCaptureVideoIdFrontImage = _20[0],
|
|
2308
|
+
setIdCaptureVideoIdFrontImage = _20[1];
|
|
2303
2309
|
var _21 = React.useState(null),
|
|
2304
|
-
|
|
2305
|
-
|
|
2310
|
+
idCaptureVideoIdBackImage = _21[0],
|
|
2311
|
+
setIdCaptureVideoIdBackImage = _21[1];
|
|
2306
2312
|
var _22 = React.useState(null),
|
|
2307
|
-
|
|
2308
|
-
|
|
2313
|
+
idCaptureVideoAudioUrl = _22[0],
|
|
2314
|
+
setIdCaptureVideoAudioUrl = _22[1];
|
|
2309
2315
|
var _23 = React.useState(null),
|
|
2310
|
-
|
|
2311
|
-
|
|
2316
|
+
idCaptureVideoAudioStartsAt = _23[0],
|
|
2317
|
+
setIdCaptureVideoAudioStartsAt = _23[1];
|
|
2312
2318
|
var _24 = React.useState(null),
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
var _25 = React.useState(
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
var _26 = React.useState(
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
var _27 = React.useState(
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
var _28 = React.useState(
|
|
2325
|
-
|
|
2326
|
-
|
|
2319
|
+
expectedAudioText = _24[0],
|
|
2320
|
+
setExpectedAudioText = _24[1];
|
|
2321
|
+
var _25 = React.useState(null),
|
|
2322
|
+
additionalDocuments = _25[0],
|
|
2323
|
+
setAdditionalDocuments = _25[1];
|
|
2324
|
+
var _26 = React.useState(null),
|
|
2325
|
+
geolocationResult = _26[0],
|
|
2326
|
+
setGeolocationResult = _26[1];
|
|
2327
|
+
var _27 = React.useState(0),
|
|
2328
|
+
geolocationAttempts = _27[0],
|
|
2329
|
+
setGeolocationAttempts = _27[1];
|
|
2330
|
+
var _28 = React.useState(false),
|
|
2331
|
+
geolocationBlocked = _28[0],
|
|
2332
|
+
setGeolocationBlocked = _28[1];
|
|
2327
2333
|
var _29 = React.useState([]),
|
|
2328
|
-
|
|
2329
|
-
|
|
2334
|
+
idFrontCaptureAttempts = _29[0],
|
|
2335
|
+
setIdFrontCaptureAttempts = _29[1];
|
|
2336
|
+
var _30 = React.useState([]),
|
|
2337
|
+
idBackCaptureAttempts = _30[0],
|
|
2338
|
+
setIdBackCaptureAttempts = _30[1];
|
|
2339
|
+
var _31 = React.useState([]),
|
|
2340
|
+
selfieCaptureAttempts = _31[0],
|
|
2341
|
+
setSelfieCaptureAttempts = _31[1];
|
|
2330
2342
|
var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
|
|
2331
2343
|
setIdFrontCaptureAttempts(function (attempts) {
|
|
2332
2344
|
return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
|
|
@@ -2603,6 +2615,12 @@
|
|
|
2603
2615
|
submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
|
|
2604
2616
|
}
|
|
2605
2617
|
}
|
|
2618
|
+
if (signatureStartTimestamp) {
|
|
2619
|
+
submissionRequest.customerData.signatureStartTimestamp = signatureStartTimestamp;
|
|
2620
|
+
}
|
|
2621
|
+
if (signatureEndTimestamp) {
|
|
2622
|
+
submissionRequest.customerData.signatureEndTimestamp = signatureEndTimestamp;
|
|
2623
|
+
}
|
|
2606
2624
|
if (additionalDocuments) {
|
|
2607
2625
|
submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
|
|
2608
2626
|
return _assign(_assign({}, d), {
|
|
@@ -2645,7 +2663,7 @@
|
|
|
2645
2663
|
}
|
|
2646
2664
|
});
|
|
2647
2665
|
});
|
|
2648
|
-
}, [additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, clientRequestID, companyId, customerDataMatchConfig, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, expectedAudioText, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idBackIrImage, idBackUvImage, idCaptureVideoAudioStartsAt, idCaptureVideoAudioUrl, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idCardForFaceMatch, idData, idFrontCaptureAttempts, idFrontImage, idFrontIrImage, idFrontUvImage, idImageResolutionCheck, jobId, manualReviewRequired, needImmediateResponse, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureVideoUrl, uploadDocument, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksFireOnReviewURL, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters, webhooksURL]);
|
|
2666
|
+
}, [additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, clientRequestID, companyId, customerDataMatchConfig, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, expectedAudioText, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idBackIrImage, idBackUvImage, idCaptureVideoAudioStartsAt, idCaptureVideoAudioUrl, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idCardForFaceMatch, idData, idFrontCaptureAttempts, idFrontImage, idFrontIrImage, idFrontUvImage, idImageResolutionCheck, jobId, manualReviewRequired, needImmediateResponse, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureEndTimestamp, signatureStartTimestamp, signatureVideoUrl, uploadDocument, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksFireOnReviewURL, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters, webhooksURL]);
|
|
2649
2667
|
var defaultOnSubmit = React.useCallback(function () {
|
|
2650
2668
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
2651
2669
|
var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
|
|
@@ -2942,6 +2960,8 @@
|
|
|
2942
2960
|
setSelfieImage: setSelfieImage,
|
|
2943
2961
|
setSignatureData: setSignatureData,
|
|
2944
2962
|
setSignatureVideoUrl: setSignatureVideoUrl,
|
|
2963
|
+
setSignatureStartTimestamp: setSignatureStartTimestamp,
|
|
2964
|
+
setSignatureEndTimestamp: setSignatureEndTimestamp,
|
|
2945
2965
|
setIdCaptureVideoUrl: setIdCaptureVideoUrl,
|
|
2946
2966
|
setIdCaptureVideoIdFrontImage: setIdCaptureVideoIdFrontImage,
|
|
2947
2967
|
setIdCaptureVideoIdBackImage: setIdCaptureVideoIdBackImage,
|
|
@@ -23690,6 +23710,16 @@
|
|
|
23690
23710
|
var AcceptBtn$1 = styled(LoaderButton)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
23691
23711
|
var templateObject_1$c, templateObject_2$b;
|
|
23692
23712
|
|
|
23713
|
+
function isBlob(blobPart) {
|
|
23714
|
+
return typeof Blob !== 'undefined' && blobPart instanceof Blob;
|
|
23715
|
+
}
|
|
23716
|
+
function inferBlobType(blobPart) {
|
|
23717
|
+
var _a;
|
|
23718
|
+
if (!isBlob(blobPart)) return undefined;
|
|
23719
|
+
var t = ((_a = blobPart.type) !== null && _a !== void 0 ? _a : '').trim();
|
|
23720
|
+
return t.length > 0 ? t : undefined;
|
|
23721
|
+
}
|
|
23722
|
+
|
|
23693
23723
|
var videoRecorder = null;
|
|
23694
23724
|
var audioRecorder = null;
|
|
23695
23725
|
var videoChunks = [];
|
|
@@ -23823,8 +23853,9 @@
|
|
|
23823
23853
|
useVideoRecorderStore.getState().clearRecordedData();
|
|
23824
23854
|
}, []);
|
|
23825
23855
|
var processVideo = React.useCallback(function () {
|
|
23856
|
+
var inferredType = inferBlobType(videoChunks[0]) || (videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.mimeType) || 'video/mp4';
|
|
23826
23857
|
var videoBlob = new Blob(videoChunks, {
|
|
23827
|
-
type:
|
|
23858
|
+
type: inferredType
|
|
23828
23859
|
});
|
|
23829
23860
|
useVideoRecorderStore.setState({
|
|
23830
23861
|
videoUrl: URL.createObjectURL(videoBlob),
|
|
@@ -23834,8 +23865,9 @@
|
|
|
23834
23865
|
setVideoRecorder(null);
|
|
23835
23866
|
}, []);
|
|
23836
23867
|
var processAudio = React.useCallback(function () {
|
|
23868
|
+
var inferredType = inferBlobType(audioChunks[0]) || (audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.mimeType) || 'audio/mp4';
|
|
23837
23869
|
var audioBlob = new Blob(audioChunks, {
|
|
23838
|
-
type:
|
|
23870
|
+
type: inferredType
|
|
23839
23871
|
});
|
|
23840
23872
|
useVideoRecorderStore.setState({
|
|
23841
23873
|
audioUrl: URL.createObjectURL(audioBlob),
|
|
@@ -23875,6 +23907,7 @@
|
|
|
23875
23907
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, isRecordingAudio, isRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
23876
23908
|
};
|
|
23877
23909
|
|
|
23910
|
+
var RECORDING_TIMESTAMP_PADDING_MS = 1000;
|
|
23878
23911
|
var signatureRecorder = null;
|
|
23879
23912
|
var signatureChunks = [];
|
|
23880
23913
|
var videoSignatureInitialState = {
|
|
@@ -23887,7 +23920,6 @@
|
|
|
23887
23920
|
clearRecordedData: function clearRecordedData() {
|
|
23888
23921
|
return null;
|
|
23889
23922
|
},
|
|
23890
|
-
isRecording: false,
|
|
23891
23923
|
signaturePad: {
|
|
23892
23924
|
current: null
|
|
23893
23925
|
},
|
|
@@ -23910,7 +23942,7 @@
|
|
|
23910
23942
|
if (!camera) throw new Error('Camera not found');
|
|
23911
23943
|
// set our flag and clear whatever we have recorded so far.
|
|
23912
23944
|
set({
|
|
23913
|
-
|
|
23945
|
+
recordingStartedAt: performance.now()
|
|
23914
23946
|
});
|
|
23915
23947
|
signatureChunks = [];
|
|
23916
23948
|
// start recording video and audio
|
|
@@ -23924,27 +23956,52 @@
|
|
|
23924
23956
|
videoBitsPerSecond: 270000,
|
|
23925
23957
|
audioBitsPerSecond: 32000
|
|
23926
23958
|
});
|
|
23959
|
+
var hasFirstChunk = false;
|
|
23927
23960
|
signatureRecorder.ondataavailable = function (event) {
|
|
23928
23961
|
signatureChunks.push(event.data);
|
|
23962
|
+
if (!hasFirstChunk) {
|
|
23963
|
+
hasFirstChunk = true;
|
|
23964
|
+
set({
|
|
23965
|
+
firstChunkReceivedAt: performance.now(),
|
|
23966
|
+
lastChunkReceivedAt: performance.now()
|
|
23967
|
+
});
|
|
23968
|
+
} else {
|
|
23969
|
+
set({
|
|
23970
|
+
lastChunkReceivedAt: performance.now()
|
|
23971
|
+
});
|
|
23972
|
+
}
|
|
23929
23973
|
};
|
|
23930
23974
|
signatureRecorder.start(100);
|
|
23931
23975
|
},
|
|
23932
23976
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
23933
23977
|
set({
|
|
23934
|
-
|
|
23978
|
+
firstChunkReceivedAt: undefined,
|
|
23979
|
+
recordingStoppedAt: performance.now()
|
|
23980
|
+
});
|
|
23981
|
+
waitForOneMoreChunk().then(function () {
|
|
23982
|
+
if (!signatureRecorder) return;
|
|
23983
|
+
signatureRecorder.stop();
|
|
23984
|
+
signatureRecorder.onstop = function () {
|
|
23985
|
+
var inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
23986
|
+
var blob = new Blob(signatureChunks, {
|
|
23987
|
+
type: inferredType
|
|
23988
|
+
});
|
|
23989
|
+
signatureChunks = [];
|
|
23990
|
+
signatureRecorder = null;
|
|
23991
|
+
if (!signatureData) return;
|
|
23992
|
+
var _a = get(),
|
|
23993
|
+
onSignatureVideoCaptured = _a.onSignatureVideoCaptured,
|
|
23994
|
+
recordingStartedAt = _a.recordingStartedAt,
|
|
23995
|
+
signatureStartedAt = _a.signatureStartedAt,
|
|
23996
|
+
signatureEndedAt = _a.signatureEndedAt,
|
|
23997
|
+
lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
23998
|
+
var endMs = Math.min(signatureEndedAt !== null && signatureEndedAt !== void 0 ? signatureEndedAt : Infinity, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity);
|
|
23999
|
+
var signatureStartTimestamp = signatureStartedAt && recordingStartedAt ? formatTimestamp(Math.max(0, signatureStartedAt - recordingStartedAt - RECORDING_TIMESTAMP_PADDING_MS)) : undefined;
|
|
24000
|
+
var signatureEndTimestamp = endMs !== Infinity && recordingStartedAt ? formatTimestamp(Math.min(endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity)) : undefined;
|
|
24001
|
+
onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, signatureStartTimestamp, signatureEndTimestamp);
|
|
24002
|
+
};
|
|
24003
|
+
useVideoRecorderStore.getState().stopRecording();
|
|
23935
24004
|
});
|
|
23936
|
-
if (!signatureRecorder) return;
|
|
23937
|
-
signatureRecorder.stop();
|
|
23938
|
-
signatureRecorder.onstop = function () {
|
|
23939
|
-
var blob = new Blob(signatureChunks, {
|
|
23940
|
-
type: 'video/mp4'
|
|
23941
|
-
});
|
|
23942
|
-
signatureChunks = [];
|
|
23943
|
-
signatureRecorder = null;
|
|
23944
|
-
if (!signatureData) return;
|
|
23945
|
-
get().onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null);
|
|
23946
|
-
};
|
|
23947
|
-
useVideoRecorderStore.getState().stopRecording();
|
|
23948
24005
|
},
|
|
23949
24006
|
clearRecordedData: function clearRecordedData() {
|
|
23950
24007
|
signatureChunks = [];
|
|
@@ -23953,13 +24010,42 @@
|
|
|
23953
24010
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
23954
24011
|
signatureRecorder = null;
|
|
23955
24012
|
set({
|
|
23956
|
-
|
|
24013
|
+
recordingStartedAt: undefined,
|
|
24014
|
+
recordingStoppedAt: undefined,
|
|
24015
|
+
firstChunkReceivedAt: undefined,
|
|
24016
|
+
lastChunkReceivedAt: undefined,
|
|
23957
24017
|
signaturePadEmpty: true,
|
|
23958
|
-
signatureValid: false
|
|
24018
|
+
signatureValid: false,
|
|
24019
|
+
signatureStartedAt: undefined,
|
|
24020
|
+
signatureEndedAt: undefined
|
|
23959
24021
|
});
|
|
23960
24022
|
}
|
|
23961
24023
|
});
|
|
23962
24024
|
}));
|
|
24025
|
+
function waitForOneMoreChunk(timeoutMs) {
|
|
24026
|
+
if (timeoutMs === void 0) {
|
|
24027
|
+
timeoutMs = 3000;
|
|
24028
|
+
}
|
|
24029
|
+
var start = performance.now();
|
|
24030
|
+
return new Promise(function (resolve) {
|
|
24031
|
+
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
24032
|
+
if (!initialLastChunkReceivedAt) return resolve();
|
|
24033
|
+
function gotAChunk() {
|
|
24034
|
+
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
24035
|
+
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
24036
|
+
}
|
|
24037
|
+
setTimeout(function () {
|
|
24038
|
+
if (gotAChunk()) return resolve(); // check immediately
|
|
24039
|
+
// otherwise, check every 100ms
|
|
24040
|
+
var interval = setInterval(function () {
|
|
24041
|
+
if (gotAChunk()) {
|
|
24042
|
+
clearInterval(interval);
|
|
24043
|
+
resolve();
|
|
24044
|
+
}
|
|
24045
|
+
}, 100);
|
|
24046
|
+
}, 0);
|
|
24047
|
+
});
|
|
24048
|
+
}
|
|
23963
24049
|
function VideoSignatureContextProvider(_a) {
|
|
23964
24050
|
var _this = this;
|
|
23965
24051
|
var _b, _c;
|
|
@@ -23978,7 +24064,14 @@
|
|
|
23978
24064
|
// clear recorded data when the component is mounted
|
|
23979
24065
|
useVideoSignatureStore.getState().clearRecordedData();
|
|
23980
24066
|
}, []);
|
|
23981
|
-
var
|
|
24067
|
+
var _e = useVideoSignatureStore(useShallow(function (state) {
|
|
24068
|
+
return {
|
|
24069
|
+
recordingStartedAt: state.recordingStartedAt,
|
|
24070
|
+
recordingStoppedAt: state.recordingStoppedAt
|
|
24071
|
+
};
|
|
24072
|
+
})),
|
|
24073
|
+
recordingStartedAt = _e.recordingStartedAt,
|
|
24074
|
+
recordingStoppedAt = _e.recordingStoppedAt;
|
|
23982
24075
|
useFrameLoop(React.useCallback(function () {
|
|
23983
24076
|
return __awaiter(_this, void 0, void 0, function () {
|
|
23984
24077
|
var signaturePad, ctx, _a, w, h, isPortrait, rect;
|
|
@@ -24005,7 +24098,7 @@
|
|
|
24005
24098
|
});
|
|
24006
24099
|
});
|
|
24007
24100
|
}, [videoRef]), {
|
|
24008
|
-
autoStart:
|
|
24101
|
+
autoStart: !!recordingStartedAt && !recordingStoppedAt,
|
|
24009
24102
|
throttleMs: 1000 / 24
|
|
24010
24103
|
});
|
|
24011
24104
|
return /*#__PURE__*/React.createElement(React.Fragment, null, children, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -24014,6 +24107,17 @@
|
|
|
24014
24107
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
24015
24108
|
}));
|
|
24016
24109
|
}
|
|
24110
|
+
function formatTimestamp(durationMs) {
|
|
24111
|
+
// should be in the format of 00:00:00:00 (hh:mm:ss:cs)
|
|
24112
|
+
var hours = Math.floor(durationMs / 3600000);
|
|
24113
|
+
var minutes = Math.floor(durationMs % 3600000 / 60000);
|
|
24114
|
+
var seconds = Math.floor(durationMs % 60000 / 1000);
|
|
24115
|
+
var milliseconds = durationMs % 1000;
|
|
24116
|
+
// Convert milliseconds to centiseconds (1/100th of a second)
|
|
24117
|
+
var centiseconds = Math.floor(milliseconds / 10);
|
|
24118
|
+
var csString = centiseconds.toString().padStart(2, '0');
|
|
24119
|
+
return "".concat(hours.toString().padStart(2, '0'), ":") + "".concat(minutes.toString().padStart(2, '0'), ":") + "".concat(seconds.toString().padStart(2, '0'), ":") + "".concat(csString);
|
|
24120
|
+
}
|
|
24017
24121
|
|
|
24018
24122
|
function VideoSignaturePad(_a) {
|
|
24019
24123
|
var onAcceptBtnClicked = _a.onAcceptBtnClicked,
|
|
@@ -24075,8 +24179,11 @@
|
|
|
24075
24179
|
ref: signaturePad,
|
|
24076
24180
|
canvasProps: canvasProps,
|
|
24077
24181
|
onBegin: function onBegin() {
|
|
24078
|
-
return useVideoSignatureStore.setState({
|
|
24079
|
-
|
|
24182
|
+
return useVideoSignatureStore.setState(function (s) {
|
|
24183
|
+
return {
|
|
24184
|
+
signaturePadEmpty: false,
|
|
24185
|
+
signatureStartedAt: s.signatureStartedAt || performance.now()
|
|
24186
|
+
};
|
|
24080
24187
|
});
|
|
24081
24188
|
},
|
|
24082
24189
|
onEnd: function onEnd() {
|
|
@@ -24086,7 +24193,8 @@
|
|
|
24086
24193
|
return point;
|
|
24087
24194
|
});
|
|
24088
24195
|
useVideoSignatureStore.setState({
|
|
24089
|
-
signatureValid: points.length >= minSignaturePadPoints
|
|
24196
|
+
signatureValid: points.length >= minSignaturePadPoints,
|
|
24197
|
+
signatureEndedAt: performance.now()
|
|
24090
24198
|
});
|
|
24091
24199
|
}
|
|
24092
24200
|
}), !headTrackingSatisfied && !!verbiage.headTrackingUnsatisfiedText ? ( /*#__PURE__*/React.createElement(SignaturePadContentContainer, {
|
|
@@ -24153,6 +24261,12 @@
|
|
|
24153
24261
|
React.useEffect(function () {
|
|
24154
24262
|
if (guideToDisplay) setMode(guideToDisplay);
|
|
24155
24263
|
}, [guideToDisplay]);
|
|
24264
|
+
var firstChunkReceivedAt = useVideoSignatureStore(useShallow(function (state) {
|
|
24265
|
+
return {
|
|
24266
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
24267
|
+
};
|
|
24268
|
+
})).firstChunkReceivedAt;
|
|
24269
|
+
var signaturePadDisabled = requestedAction !== 'CAPTURE_SIGNATURE' || !firstChunkReceivedAt;
|
|
24156
24270
|
return /*#__PURE__*/React.createElement(Container$3, {
|
|
24157
24271
|
className: classNames.container
|
|
24158
24272
|
}, /*#__PURE__*/React.createElement(Inner$1, {
|
|
@@ -24176,7 +24290,7 @@
|
|
|
24176
24290
|
}, /*#__PURE__*/React.createElement(VideoSignaturePad, {
|
|
24177
24291
|
onAcceptBtnClicked: onAcceptBtnClicked,
|
|
24178
24292
|
onClearBtnClicked: onClearBtnClicked,
|
|
24179
|
-
disabled:
|
|
24293
|
+
disabled: signaturePadDisabled,
|
|
24180
24294
|
headTrackingSatisfied: headTrackingSatisfied,
|
|
24181
24295
|
minSignaturePadPoints: minSignaturePadPoints,
|
|
24182
24296
|
classNames: classNames,
|
|
@@ -24233,9 +24347,11 @@
|
|
|
24233
24347
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
24234
24348
|
startHeadTracking = _o.start,
|
|
24235
24349
|
stopHeadTracking = _o.stop;
|
|
24236
|
-
var
|
|
24237
|
-
|
|
24238
|
-
|
|
24350
|
+
var firstChunkReceivedAt = useVideoSignatureStore(useShallow(function (state) {
|
|
24351
|
+
return {
|
|
24352
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
24353
|
+
};
|
|
24354
|
+
})).firstChunkReceivedAt;
|
|
24239
24355
|
React.useEffect(function () {
|
|
24240
24356
|
useVideoSignatureStore.setState({
|
|
24241
24357
|
onSignatureVideoCaptured: onSignatureVideoCaptured
|
|
@@ -24254,15 +24370,15 @@
|
|
|
24254
24370
|
var verbiage = useTranslations(rawVerbiage, {
|
|
24255
24371
|
guidanceMessageText: 'Please sign the box below'
|
|
24256
24372
|
});
|
|
24257
|
-
var
|
|
24258
|
-
headTrackingSatisfied =
|
|
24259
|
-
setHeadTrackingSatisfied =
|
|
24260
|
-
var
|
|
24261
|
-
lastFace =
|
|
24262
|
-
setLastFace =
|
|
24263
|
-
var
|
|
24264
|
-
numFramesWithoutFaces =
|
|
24265
|
-
setNumFramesWithoutFaces =
|
|
24373
|
+
var _p = React.useState(true),
|
|
24374
|
+
headTrackingSatisfied = _p[0],
|
|
24375
|
+
setHeadTrackingSatisfied = _p[1];
|
|
24376
|
+
var _q = React.useState(null),
|
|
24377
|
+
lastFace = _q[0],
|
|
24378
|
+
setLastFace = _q[1];
|
|
24379
|
+
var _r = React.useState(0),
|
|
24380
|
+
numFramesWithoutFaces = _r[0],
|
|
24381
|
+
setNumFramesWithoutFaces = _r[1];
|
|
24266
24382
|
onHeadTrackingPredictionMade(f(React.useCallback(function (_a) {
|
|
24267
24383
|
var face = _a.face;
|
|
24268
24384
|
if (headTrackingDisabled) return;
|
|
@@ -24277,12 +24393,12 @@
|
|
|
24277
24393
|
return n + 1;
|
|
24278
24394
|
});
|
|
24279
24395
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
24280
|
-
var
|
|
24281
|
-
ref =
|
|
24282
|
-
|
|
24283
|
-
width =
|
|
24284
|
-
|
|
24285
|
-
height =
|
|
24396
|
+
var _s = useResizeObserver(),
|
|
24397
|
+
ref = _s.ref,
|
|
24398
|
+
_t = _s.width,
|
|
24399
|
+
width = _t === void 0 ? 1 : _t,
|
|
24400
|
+
_u = _s.height,
|
|
24401
|
+
height = _u === void 0 ? 1 : _u;
|
|
24286
24402
|
var debugScalingDetails = useDebugScalingDetails({
|
|
24287
24403
|
enabled: debugMode,
|
|
24288
24404
|
pageWidth: width,
|
|
@@ -24313,13 +24429,19 @@
|
|
|
24313
24429
|
classNames: classNames.guides,
|
|
24314
24430
|
verbiage: rawVerbiage.guides,
|
|
24315
24431
|
onClearBtnClicked: restartVideoOnSignaturePadCleared ? function () {
|
|
24316
|
-
return setTimeout(
|
|
24317
|
-
|
|
24432
|
+
return setTimeout(function () {
|
|
24433
|
+
return useVideoSignatureStore.getState().clearRecordedData();
|
|
24434
|
+
}, 100);
|
|
24435
|
+
} : function () {
|
|
24436
|
+
return useVideoSignatureStore.setState({
|
|
24437
|
+
signatureStartedAt: undefined
|
|
24438
|
+
});
|
|
24439
|
+
}
|
|
24318
24440
|
}), debugMode && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectDetectionDebugOverlayDiv, null, lastFace && ( /*#__PURE__*/React.createElement(SelfieCaptureFaceDebugBox, {
|
|
24319
24441
|
face: lastFace,
|
|
24320
24442
|
scaling: debugScalingDetails,
|
|
24321
24443
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
24322
|
-
}))), /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React.createElement("br", null), "Recording: ",
|
|
24444
|
+
}))), /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React.createElement("br", null), "Recording: ", firstChunkReceivedAt ? 'true' : 'false'))), /*#__PURE__*/React.createElement(ExitCaptureButton, {
|
|
24323
24445
|
onClick: onExit,
|
|
24324
24446
|
className: classNames.exitCaptureBtn
|
|
24325
24447
|
}));
|
|
@@ -24650,6 +24772,8 @@
|
|
|
24650
24772
|
setSelfieImage = _u.setSelfieImage,
|
|
24651
24773
|
setSignatureData = _u.setSignatureData,
|
|
24652
24774
|
setSignatureVideoUrl = _u.setSignatureVideoUrl,
|
|
24775
|
+
setSignatureStartTimestamp = _u.setSignatureStartTimestamp,
|
|
24776
|
+
setSignatureEndTimestamp = _u.setSignatureEndTimestamp,
|
|
24653
24777
|
logSelfieCaptureAttempt = _u.logSelfieCaptureAttempt,
|
|
24654
24778
|
uploadDocument = _u.uploadDocument;
|
|
24655
24779
|
var cameraAccessDenied = useCameraStore(useShallow(function (state) {
|
|
@@ -24709,12 +24833,14 @@
|
|
|
24709
24833
|
filetype: 'image/jpeg'
|
|
24710
24834
|
}).then(onSelfieCaptured);
|
|
24711
24835
|
}, [logCaptureMetadata, onSelfieCaptured, setSelfieImage, uploadDocument]);
|
|
24712
|
-
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData) {
|
|
24836
|
+
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData, signatureStartTimestamp, signatureEndTimestamp) {
|
|
24713
24837
|
setSignatureData(signatureData);
|
|
24714
24838
|
setSignatureVideoUrl(URL.createObjectURL(videoData));
|
|
24839
|
+
if (signatureStartTimestamp) setSignatureStartTimestamp(signatureStartTimestamp);
|
|
24840
|
+
if (signatureEndTimestamp) setSignatureEndTimestamp(signatureEndTimestamp);
|
|
24715
24841
|
setCaptureState('SUCCESS');
|
|
24716
|
-
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
|
|
24717
|
-
}, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
|
|
24842
|
+
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData, signatureStartTimestamp, signatureEndTimestamp);
|
|
24843
|
+
}, [onVideoCaptured, setSignatureData, setSignatureEndTimestamp, setSignatureStartTimestamp, setSignatureVideoUrl]);
|
|
24718
24844
|
var _x = React.useState(true),
|
|
24719
24845
|
showLoadingOverlay = _x[0],
|
|
24720
24846
|
setShowLoadingOverlay = _x[1];
|
|
@@ -24883,6 +25009,7 @@
|
|
|
24883
25009
|
var onClearBtnClicked = React.useCallback(function () {
|
|
24884
25010
|
var _a, _b;
|
|
24885
25011
|
useVideoSignatureStore.setState({
|
|
25012
|
+
signatureStartedAt: undefined,
|
|
24886
25013
|
signaturePadEmpty: true,
|
|
24887
25014
|
signatureValid: false
|
|
24888
25015
|
});
|