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
|
@@ -236,7 +236,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
236
236
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
var webSdkVersion = '2.3.
|
|
239
|
+
var webSdkVersion = '2.3.89';
|
|
240
240
|
|
|
241
241
|
function getPlatform() {
|
|
242
242
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1176,6 +1176,12 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
|
|
|
1176
1176
|
setIdCaptureVideoUrl: function setIdCaptureVideoUrl() {
|
|
1177
1177
|
return null;
|
|
1178
1178
|
},
|
|
1179
|
+
setSignatureStartTimestamp: function setSignatureStartTimestamp() {
|
|
1180
|
+
return null;
|
|
1181
|
+
},
|
|
1182
|
+
setSignatureEndTimestamp: function setSignatureEndTimestamp() {
|
|
1183
|
+
return null;
|
|
1184
|
+
},
|
|
1179
1185
|
setIdCaptureVideoIdFrontImage: function setIdCaptureVideoIdFrontImage() {
|
|
1180
1186
|
return null;
|
|
1181
1187
|
},
|
|
@@ -1340,44 +1346,50 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1340
1346
|
signatureVideoUrl = _16[0],
|
|
1341
1347
|
setSignatureVideoUrl = _16[1];
|
|
1342
1348
|
var _17 = React.useState(null),
|
|
1343
|
-
|
|
1344
|
-
|
|
1349
|
+
signatureStartTimestamp = _17[0],
|
|
1350
|
+
setSignatureStartTimestamp = _17[1];
|
|
1345
1351
|
var _18 = React.useState(null),
|
|
1346
|
-
|
|
1347
|
-
|
|
1352
|
+
signatureEndTimestamp = _18[0],
|
|
1353
|
+
setSignatureEndTimestamp = _18[1];
|
|
1348
1354
|
var _19 = React.useState(null),
|
|
1349
|
-
|
|
1350
|
-
|
|
1355
|
+
idCaptureVideoUrl = _19[0],
|
|
1356
|
+
setIdCaptureVideoUrl = _19[1];
|
|
1351
1357
|
var _20 = React.useState(null),
|
|
1352
|
-
|
|
1353
|
-
|
|
1358
|
+
idCaptureVideoIdFrontImage = _20[0],
|
|
1359
|
+
setIdCaptureVideoIdFrontImage = _20[1];
|
|
1354
1360
|
var _21 = React.useState(null),
|
|
1355
|
-
|
|
1356
|
-
|
|
1361
|
+
idCaptureVideoIdBackImage = _21[0],
|
|
1362
|
+
setIdCaptureVideoIdBackImage = _21[1];
|
|
1357
1363
|
var _22 = React.useState(null),
|
|
1358
|
-
|
|
1359
|
-
|
|
1364
|
+
idCaptureVideoAudioUrl = _22[0],
|
|
1365
|
+
setIdCaptureVideoAudioUrl = _22[1];
|
|
1360
1366
|
var _23 = React.useState(null),
|
|
1361
|
-
|
|
1362
|
-
|
|
1367
|
+
idCaptureVideoAudioStartsAt = _23[0],
|
|
1368
|
+
setIdCaptureVideoAudioStartsAt = _23[1];
|
|
1363
1369
|
var _24 = React.useState(null),
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
var _25 = React.useState(
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
var _26 = React.useState(
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
var _27 = React.useState(
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
var _28 = React.useState(
|
|
1376
|
-
|
|
1377
|
-
|
|
1370
|
+
expectedAudioText = _24[0],
|
|
1371
|
+
setExpectedAudioText = _24[1];
|
|
1372
|
+
var _25 = React.useState(null),
|
|
1373
|
+
additionalDocuments = _25[0],
|
|
1374
|
+
setAdditionalDocuments = _25[1];
|
|
1375
|
+
var _26 = React.useState(null),
|
|
1376
|
+
geolocationResult = _26[0],
|
|
1377
|
+
setGeolocationResult = _26[1];
|
|
1378
|
+
var _27 = React.useState(0),
|
|
1379
|
+
geolocationAttempts = _27[0],
|
|
1380
|
+
setGeolocationAttempts = _27[1];
|
|
1381
|
+
var _28 = React.useState(false),
|
|
1382
|
+
geolocationBlocked = _28[0],
|
|
1383
|
+
setGeolocationBlocked = _28[1];
|
|
1378
1384
|
var _29 = React.useState([]),
|
|
1379
|
-
|
|
1380
|
-
|
|
1385
|
+
idFrontCaptureAttempts = _29[0],
|
|
1386
|
+
setIdFrontCaptureAttempts = _29[1];
|
|
1387
|
+
var _30 = React.useState([]),
|
|
1388
|
+
idBackCaptureAttempts = _30[0],
|
|
1389
|
+
setIdBackCaptureAttempts = _30[1];
|
|
1390
|
+
var _31 = React.useState([]),
|
|
1391
|
+
selfieCaptureAttempts = _31[0],
|
|
1392
|
+
setSelfieCaptureAttempts = _31[1];
|
|
1381
1393
|
var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
|
|
1382
1394
|
setIdFrontCaptureAttempts(function (attempts) {
|
|
1383
1395
|
return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
|
|
@@ -1654,6 +1666,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1654
1666
|
submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
|
|
1655
1667
|
}
|
|
1656
1668
|
}
|
|
1669
|
+
if (signatureStartTimestamp) {
|
|
1670
|
+
submissionRequest.customerData.signatureStartTimestamp = signatureStartTimestamp;
|
|
1671
|
+
}
|
|
1672
|
+
if (signatureEndTimestamp) {
|
|
1673
|
+
submissionRequest.customerData.signatureEndTimestamp = signatureEndTimestamp;
|
|
1674
|
+
}
|
|
1657
1675
|
if (additionalDocuments) {
|
|
1658
1676
|
submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
|
|
1659
1677
|
return _assign(_assign({}, d), {
|
|
@@ -1696,7 +1714,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1696
1714
|
}
|
|
1697
1715
|
});
|
|
1698
1716
|
});
|
|
1699
|
-
}, [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]);
|
|
1717
|
+
}, [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]);
|
|
1700
1718
|
var defaultOnSubmit = React.useCallback(function () {
|
|
1701
1719
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1702
1720
|
var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
|
|
@@ -1993,6 +2011,8 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1993
2011
|
setSelfieImage: setSelfieImage,
|
|
1994
2012
|
setSignatureData: setSignatureData,
|
|
1995
2013
|
setSignatureVideoUrl: setSignatureVideoUrl,
|
|
2014
|
+
setSignatureStartTimestamp: setSignatureStartTimestamp,
|
|
2015
|
+
setSignatureEndTimestamp: setSignatureEndTimestamp,
|
|
1996
2016
|
setIdCaptureVideoUrl: setIdCaptureVideoUrl,
|
|
1997
2017
|
setIdCaptureVideoIdFrontImage: setIdCaptureVideoIdFrontImage,
|
|
1998
2018
|
setIdCaptureVideoIdBackImage: setIdCaptureVideoIdBackImage,
|
|
@@ -13816,6 +13836,16 @@ var Container$4 = styled__default.default.div(templateObject_1$c || (templateObj
|
|
|
13816
13836
|
var AcceptBtn$1 = styled__default.default(LoaderButton)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
13817
13837
|
var templateObject_1$c, templateObject_2$b;
|
|
13818
13838
|
|
|
13839
|
+
function isBlob(blobPart) {
|
|
13840
|
+
return typeof Blob !== 'undefined' && blobPart instanceof Blob;
|
|
13841
|
+
}
|
|
13842
|
+
function inferBlobType(blobPart) {
|
|
13843
|
+
var _a;
|
|
13844
|
+
if (!isBlob(blobPart)) return undefined;
|
|
13845
|
+
var t = ((_a = blobPart.type) !== null && _a !== void 0 ? _a : '').trim();
|
|
13846
|
+
return t.length > 0 ? t : undefined;
|
|
13847
|
+
}
|
|
13848
|
+
|
|
13819
13849
|
var videoRecorder = null;
|
|
13820
13850
|
var audioRecorder = null;
|
|
13821
13851
|
var videoChunks = [];
|
|
@@ -13949,8 +13979,9 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13949
13979
|
useVideoRecorderStore.getState().clearRecordedData();
|
|
13950
13980
|
}, []);
|
|
13951
13981
|
var processVideo = React.useCallback(function () {
|
|
13982
|
+
var inferredType = inferBlobType(videoChunks[0]) || (videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.mimeType) || 'video/mp4';
|
|
13952
13983
|
var videoBlob = new Blob(videoChunks, {
|
|
13953
|
-
type:
|
|
13984
|
+
type: inferredType
|
|
13954
13985
|
});
|
|
13955
13986
|
useVideoRecorderStore.setState({
|
|
13956
13987
|
videoUrl: URL.createObjectURL(videoBlob),
|
|
@@ -13960,8 +13991,9 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13960
13991
|
setVideoRecorder(null);
|
|
13961
13992
|
}, []);
|
|
13962
13993
|
var processAudio = React.useCallback(function () {
|
|
13994
|
+
var inferredType = inferBlobType(audioChunks[0]) || (audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.mimeType) || 'audio/mp4';
|
|
13963
13995
|
var audioBlob = new Blob(audioChunks, {
|
|
13964
|
-
type:
|
|
13996
|
+
type: inferredType
|
|
13965
13997
|
});
|
|
13966
13998
|
useVideoRecorderStore.setState({
|
|
13967
13999
|
audioUrl: URL.createObjectURL(audioBlob),
|
|
@@ -14001,6 +14033,7 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
14001
14033
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, isRecordingAudio, isRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
14002
14034
|
};
|
|
14003
14035
|
|
|
14036
|
+
var RECORDING_TIMESTAMP_PADDING_MS = 1000;
|
|
14004
14037
|
var signatureRecorder = null;
|
|
14005
14038
|
var signatureChunks = [];
|
|
14006
14039
|
var videoSignatureInitialState = {
|
|
@@ -14013,7 +14046,6 @@ var videoSignatureInitialState = {
|
|
|
14013
14046
|
clearRecordedData: function clearRecordedData() {
|
|
14014
14047
|
return null;
|
|
14015
14048
|
},
|
|
14016
|
-
isRecording: false,
|
|
14017
14049
|
signaturePad: {
|
|
14018
14050
|
current: null
|
|
14019
14051
|
},
|
|
@@ -14036,7 +14068,7 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14036
14068
|
if (!camera) throw new Error('Camera not found');
|
|
14037
14069
|
// set our flag and clear whatever we have recorded so far.
|
|
14038
14070
|
set({
|
|
14039
|
-
|
|
14071
|
+
recordingStartedAt: performance.now()
|
|
14040
14072
|
});
|
|
14041
14073
|
signatureChunks = [];
|
|
14042
14074
|
// start recording video and audio
|
|
@@ -14050,27 +14082,52 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14050
14082
|
videoBitsPerSecond: 270000,
|
|
14051
14083
|
audioBitsPerSecond: 32000
|
|
14052
14084
|
});
|
|
14085
|
+
var hasFirstChunk = false;
|
|
14053
14086
|
signatureRecorder.ondataavailable = function (event) {
|
|
14054
14087
|
signatureChunks.push(event.data);
|
|
14088
|
+
if (!hasFirstChunk) {
|
|
14089
|
+
hasFirstChunk = true;
|
|
14090
|
+
set({
|
|
14091
|
+
firstChunkReceivedAt: performance.now(),
|
|
14092
|
+
lastChunkReceivedAt: performance.now()
|
|
14093
|
+
});
|
|
14094
|
+
} else {
|
|
14095
|
+
set({
|
|
14096
|
+
lastChunkReceivedAt: performance.now()
|
|
14097
|
+
});
|
|
14098
|
+
}
|
|
14055
14099
|
};
|
|
14056
14100
|
signatureRecorder.start(100);
|
|
14057
14101
|
},
|
|
14058
14102
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
14059
14103
|
set({
|
|
14060
|
-
|
|
14104
|
+
firstChunkReceivedAt: undefined,
|
|
14105
|
+
recordingStoppedAt: performance.now()
|
|
14106
|
+
});
|
|
14107
|
+
waitForOneMoreChunk().then(function () {
|
|
14108
|
+
if (!signatureRecorder) return;
|
|
14109
|
+
signatureRecorder.stop();
|
|
14110
|
+
signatureRecorder.onstop = function () {
|
|
14111
|
+
var inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
14112
|
+
var blob = new Blob(signatureChunks, {
|
|
14113
|
+
type: inferredType
|
|
14114
|
+
});
|
|
14115
|
+
signatureChunks = [];
|
|
14116
|
+
signatureRecorder = null;
|
|
14117
|
+
if (!signatureData) return;
|
|
14118
|
+
var _a = get(),
|
|
14119
|
+
onSignatureVideoCaptured = _a.onSignatureVideoCaptured,
|
|
14120
|
+
recordingStartedAt = _a.recordingStartedAt,
|
|
14121
|
+
signatureStartedAt = _a.signatureStartedAt,
|
|
14122
|
+
signatureEndedAt = _a.signatureEndedAt,
|
|
14123
|
+
lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
14124
|
+
var endMs = Math.min(signatureEndedAt !== null && signatureEndedAt !== void 0 ? signatureEndedAt : Infinity, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity);
|
|
14125
|
+
var signatureStartTimestamp = signatureStartedAt && recordingStartedAt ? formatTimestamp(Math.max(0, signatureStartedAt - recordingStartedAt - RECORDING_TIMESTAMP_PADDING_MS)) : undefined;
|
|
14126
|
+
var signatureEndTimestamp = endMs !== Infinity && recordingStartedAt ? formatTimestamp(Math.min(endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity)) : undefined;
|
|
14127
|
+
onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, signatureStartTimestamp, signatureEndTimestamp);
|
|
14128
|
+
};
|
|
14129
|
+
useVideoRecorderStore.getState().stopRecording();
|
|
14061
14130
|
});
|
|
14062
|
-
if (!signatureRecorder) return;
|
|
14063
|
-
signatureRecorder.stop();
|
|
14064
|
-
signatureRecorder.onstop = function () {
|
|
14065
|
-
var blob = new Blob(signatureChunks, {
|
|
14066
|
-
type: 'video/mp4'
|
|
14067
|
-
});
|
|
14068
|
-
signatureChunks = [];
|
|
14069
|
-
signatureRecorder = null;
|
|
14070
|
-
if (!signatureData) return;
|
|
14071
|
-
get().onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null);
|
|
14072
|
-
};
|
|
14073
|
-
useVideoRecorderStore.getState().stopRecording();
|
|
14074
14131
|
},
|
|
14075
14132
|
clearRecordedData: function clearRecordedData() {
|
|
14076
14133
|
signatureChunks = [];
|
|
@@ -14079,13 +14136,42 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
14079
14136
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
14080
14137
|
signatureRecorder = null;
|
|
14081
14138
|
set({
|
|
14082
|
-
|
|
14139
|
+
recordingStartedAt: undefined,
|
|
14140
|
+
recordingStoppedAt: undefined,
|
|
14141
|
+
firstChunkReceivedAt: undefined,
|
|
14142
|
+
lastChunkReceivedAt: undefined,
|
|
14083
14143
|
signaturePadEmpty: true,
|
|
14084
|
-
signatureValid: false
|
|
14144
|
+
signatureValid: false,
|
|
14145
|
+
signatureStartedAt: undefined,
|
|
14146
|
+
signatureEndedAt: undefined
|
|
14085
14147
|
});
|
|
14086
14148
|
}
|
|
14087
14149
|
});
|
|
14088
14150
|
}));
|
|
14151
|
+
function waitForOneMoreChunk(timeoutMs) {
|
|
14152
|
+
if (timeoutMs === void 0) {
|
|
14153
|
+
timeoutMs = 3000;
|
|
14154
|
+
}
|
|
14155
|
+
var start = performance.now();
|
|
14156
|
+
return new Promise(function (resolve) {
|
|
14157
|
+
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14158
|
+
if (!initialLastChunkReceivedAt) return resolve();
|
|
14159
|
+
function gotAChunk() {
|
|
14160
|
+
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14161
|
+
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
14162
|
+
}
|
|
14163
|
+
setTimeout(function () {
|
|
14164
|
+
if (gotAChunk()) return resolve(); // check immediately
|
|
14165
|
+
// otherwise, check every 100ms
|
|
14166
|
+
var interval = setInterval(function () {
|
|
14167
|
+
if (gotAChunk()) {
|
|
14168
|
+
clearInterval(interval);
|
|
14169
|
+
resolve();
|
|
14170
|
+
}
|
|
14171
|
+
}, 100);
|
|
14172
|
+
}, 0);
|
|
14173
|
+
});
|
|
14174
|
+
}
|
|
14089
14175
|
function VideoSignatureContextProvider(_a) {
|
|
14090
14176
|
var _this = this;
|
|
14091
14177
|
var _b, _c;
|
|
@@ -14104,7 +14190,14 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14104
14190
|
// clear recorded data when the component is mounted
|
|
14105
14191
|
useVideoSignatureStore.getState().clearRecordedData();
|
|
14106
14192
|
}, []);
|
|
14107
|
-
var
|
|
14193
|
+
var _e = useVideoSignatureStore(shallow.useShallow(function (state) {
|
|
14194
|
+
return {
|
|
14195
|
+
recordingStartedAt: state.recordingStartedAt,
|
|
14196
|
+
recordingStoppedAt: state.recordingStoppedAt
|
|
14197
|
+
};
|
|
14198
|
+
})),
|
|
14199
|
+
recordingStartedAt = _e.recordingStartedAt,
|
|
14200
|
+
recordingStoppedAt = _e.recordingStoppedAt;
|
|
14108
14201
|
useFrameLoop(React.useCallback(function () {
|
|
14109
14202
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14110
14203
|
var signaturePad, ctx, _a, w, h, isPortrait, rect;
|
|
@@ -14131,7 +14224,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14131
14224
|
});
|
|
14132
14225
|
});
|
|
14133
14226
|
}, [videoRef]), {
|
|
14134
|
-
autoStart:
|
|
14227
|
+
autoStart: !!recordingStartedAt && !recordingStoppedAt,
|
|
14135
14228
|
throttleMs: 1000 / 24
|
|
14136
14229
|
});
|
|
14137
14230
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
@@ -14140,6 +14233,17 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14140
14233
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
14141
14234
|
}));
|
|
14142
14235
|
}
|
|
14236
|
+
function formatTimestamp(durationMs) {
|
|
14237
|
+
// should be in the format of 00:00:00:00 (hh:mm:ss:cs)
|
|
14238
|
+
var hours = Math.floor(durationMs / 3600000);
|
|
14239
|
+
var minutes = Math.floor(durationMs % 3600000 / 60000);
|
|
14240
|
+
var seconds = Math.floor(durationMs % 60000 / 1000);
|
|
14241
|
+
var milliseconds = durationMs % 1000;
|
|
14242
|
+
// Convert milliseconds to centiseconds (1/100th of a second)
|
|
14243
|
+
var centiseconds = Math.floor(milliseconds / 10);
|
|
14244
|
+
var csString = centiseconds.toString().padStart(2, '0');
|
|
14245
|
+
return "".concat(hours.toString().padStart(2, '0'), ":") + "".concat(minutes.toString().padStart(2, '0'), ":") + "".concat(seconds.toString().padStart(2, '0'), ":") + "".concat(csString);
|
|
14246
|
+
}
|
|
14143
14247
|
|
|
14144
14248
|
function VideoSignaturePad(_a) {
|
|
14145
14249
|
var onAcceptBtnClicked = _a.onAcceptBtnClicked,
|
|
@@ -14201,8 +14305,11 @@ function VideoSignaturePad(_a) {
|
|
|
14201
14305
|
ref: signaturePad,
|
|
14202
14306
|
canvasProps: canvasProps,
|
|
14203
14307
|
onBegin: function onBegin() {
|
|
14204
|
-
return useVideoSignatureStore.setState({
|
|
14205
|
-
|
|
14308
|
+
return useVideoSignatureStore.setState(function (s) {
|
|
14309
|
+
return {
|
|
14310
|
+
signaturePadEmpty: false,
|
|
14311
|
+
signatureStartedAt: s.signatureStartedAt || performance.now()
|
|
14312
|
+
};
|
|
14206
14313
|
});
|
|
14207
14314
|
},
|
|
14208
14315
|
onEnd: function onEnd() {
|
|
@@ -14212,7 +14319,8 @@ function VideoSignaturePad(_a) {
|
|
|
14212
14319
|
return point;
|
|
14213
14320
|
});
|
|
14214
14321
|
useVideoSignatureStore.setState({
|
|
14215
|
-
signatureValid: points.length >= minSignaturePadPoints
|
|
14322
|
+
signatureValid: points.length >= minSignaturePadPoints,
|
|
14323
|
+
signatureEndedAt: performance.now()
|
|
14216
14324
|
});
|
|
14217
14325
|
}
|
|
14218
14326
|
}), !headTrackingSatisfied && !!verbiage.headTrackingUnsatisfiedText ? ( /*#__PURE__*/React__namespace.default.createElement(SignaturePadContentContainer, {
|
|
@@ -14279,6 +14387,12 @@ function VideoSignatureGuides(_a) {
|
|
|
14279
14387
|
React.useEffect(function () {
|
|
14280
14388
|
if (guideToDisplay) setMode(guideToDisplay);
|
|
14281
14389
|
}, [guideToDisplay]);
|
|
14390
|
+
var firstChunkReceivedAt = useVideoSignatureStore(shallow.useShallow(function (state) {
|
|
14391
|
+
return {
|
|
14392
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
14393
|
+
};
|
|
14394
|
+
})).firstChunkReceivedAt;
|
|
14395
|
+
var signaturePadDisabled = requestedAction !== 'CAPTURE_SIGNATURE' || !firstChunkReceivedAt;
|
|
14282
14396
|
return /*#__PURE__*/React__namespace.default.createElement(Container$3, {
|
|
14283
14397
|
className: classNames.container
|
|
14284
14398
|
}, /*#__PURE__*/React__namespace.default.createElement(Inner$1, {
|
|
@@ -14302,7 +14416,7 @@ function VideoSignatureGuides(_a) {
|
|
|
14302
14416
|
}, /*#__PURE__*/React__namespace.default.createElement(VideoSignaturePad, {
|
|
14303
14417
|
onAcceptBtnClicked: onAcceptBtnClicked,
|
|
14304
14418
|
onClearBtnClicked: onClearBtnClicked,
|
|
14305
|
-
disabled:
|
|
14419
|
+
disabled: signaturePadDisabled,
|
|
14306
14420
|
headTrackingSatisfied: headTrackingSatisfied,
|
|
14307
14421
|
minSignaturePadPoints: minSignaturePadPoints,
|
|
14308
14422
|
classNames: classNames,
|
|
@@ -14359,9 +14473,11 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14359
14473
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
14360
14474
|
startHeadTracking = _o.start,
|
|
14361
14475
|
stopHeadTracking = _o.stop;
|
|
14362
|
-
var
|
|
14363
|
-
|
|
14364
|
-
|
|
14476
|
+
var firstChunkReceivedAt = useVideoSignatureStore(shallow.useShallow(function (state) {
|
|
14477
|
+
return {
|
|
14478
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
14479
|
+
};
|
|
14480
|
+
})).firstChunkReceivedAt;
|
|
14365
14481
|
React.useEffect(function () {
|
|
14366
14482
|
useVideoSignatureStore.setState({
|
|
14367
14483
|
onSignatureVideoCaptured: onSignatureVideoCaptured
|
|
@@ -14380,15 +14496,15 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14380
14496
|
var verbiage = useTranslations(rawVerbiage, {
|
|
14381
14497
|
guidanceMessageText: 'Please sign the box below'
|
|
14382
14498
|
});
|
|
14383
|
-
var
|
|
14384
|
-
headTrackingSatisfied =
|
|
14385
|
-
setHeadTrackingSatisfied =
|
|
14386
|
-
var
|
|
14387
|
-
lastFace =
|
|
14388
|
-
setLastFace =
|
|
14389
|
-
var
|
|
14390
|
-
numFramesWithoutFaces =
|
|
14391
|
-
setNumFramesWithoutFaces =
|
|
14499
|
+
var _p = React.useState(true),
|
|
14500
|
+
headTrackingSatisfied = _p[0],
|
|
14501
|
+
setHeadTrackingSatisfied = _p[1];
|
|
14502
|
+
var _q = React.useState(null),
|
|
14503
|
+
lastFace = _q[0],
|
|
14504
|
+
setLastFace = _q[1];
|
|
14505
|
+
var _r = React.useState(0),
|
|
14506
|
+
numFramesWithoutFaces = _r[0],
|
|
14507
|
+
setNumFramesWithoutFaces = _r[1];
|
|
14392
14508
|
onHeadTrackingPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
|
|
14393
14509
|
var face = _a.face;
|
|
14394
14510
|
if (headTrackingDisabled) return;
|
|
@@ -14403,12 +14519,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14403
14519
|
return n + 1;
|
|
14404
14520
|
});
|
|
14405
14521
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
14406
|
-
var
|
|
14407
|
-
ref =
|
|
14408
|
-
|
|
14409
|
-
width =
|
|
14410
|
-
|
|
14411
|
-
height =
|
|
14522
|
+
var _s = useResizeObserver(),
|
|
14523
|
+
ref = _s.ref,
|
|
14524
|
+
_t = _s.width,
|
|
14525
|
+
width = _t === void 0 ? 1 : _t,
|
|
14526
|
+
_u = _s.height,
|
|
14527
|
+
height = _u === void 0 ? 1 : _u;
|
|
14412
14528
|
var debugScalingDetails = useDebugScalingDetails({
|
|
14413
14529
|
enabled: debugMode,
|
|
14414
14530
|
pageWidth: width,
|
|
@@ -14439,13 +14555,19 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14439
14555
|
classNames: classNames.guides,
|
|
14440
14556
|
verbiage: rawVerbiage.guides,
|
|
14441
14557
|
onClearBtnClicked: restartVideoOnSignaturePadCleared ? function () {
|
|
14442
|
-
return setTimeout(
|
|
14443
|
-
|
|
14558
|
+
return setTimeout(function () {
|
|
14559
|
+
return useVideoSignatureStore.getState().clearRecordedData();
|
|
14560
|
+
}, 100);
|
|
14561
|
+
} : function () {
|
|
14562
|
+
return useVideoSignatureStore.setState({
|
|
14563
|
+
signatureStartedAt: undefined
|
|
14564
|
+
});
|
|
14565
|
+
}
|
|
14444
14566
|
}), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, null, lastFace && ( /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceDebugBox, {
|
|
14445
14567
|
face: lastFace,
|
|
14446
14568
|
scaling: debugScalingDetails,
|
|
14447
14569
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
14448
|
-
}))), /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__namespace.default.createElement("br", null), "Recording: ",
|
|
14570
|
+
}))), /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__namespace.default.createElement("br", null), "Recording: ", firstChunkReceivedAt ? 'true' : 'false'))), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
|
|
14449
14571
|
onClick: onExit,
|
|
14450
14572
|
className: classNames.exitCaptureBtn
|
|
14451
14573
|
}));
|
|
@@ -14776,6 +14898,8 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14776
14898
|
setSelfieImage = _u.setSelfieImage,
|
|
14777
14899
|
setSignatureData = _u.setSignatureData,
|
|
14778
14900
|
setSignatureVideoUrl = _u.setSignatureVideoUrl,
|
|
14901
|
+
setSignatureStartTimestamp = _u.setSignatureStartTimestamp,
|
|
14902
|
+
setSignatureEndTimestamp = _u.setSignatureEndTimestamp,
|
|
14779
14903
|
logSelfieCaptureAttempt = _u.logSelfieCaptureAttempt,
|
|
14780
14904
|
uploadDocument = _u.uploadDocument;
|
|
14781
14905
|
var cameraAccessDenied = useCameraStore(shallow.useShallow(function (state) {
|
|
@@ -14835,12 +14959,14 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14835
14959
|
filetype: 'image/jpeg'
|
|
14836
14960
|
}).then(onSelfieCaptured);
|
|
14837
14961
|
}, [logCaptureMetadata, onSelfieCaptured, setSelfieImage, uploadDocument]);
|
|
14838
|
-
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData) {
|
|
14962
|
+
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData, signatureStartTimestamp, signatureEndTimestamp) {
|
|
14839
14963
|
setSignatureData(signatureData);
|
|
14840
14964
|
setSignatureVideoUrl(URL.createObjectURL(videoData));
|
|
14965
|
+
if (signatureStartTimestamp) setSignatureStartTimestamp(signatureStartTimestamp);
|
|
14966
|
+
if (signatureEndTimestamp) setSignatureEndTimestamp(signatureEndTimestamp);
|
|
14841
14967
|
setCaptureState('SUCCESS');
|
|
14842
|
-
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
|
|
14843
|
-
}, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
|
|
14968
|
+
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData, signatureStartTimestamp, signatureEndTimestamp);
|
|
14969
|
+
}, [onVideoCaptured, setSignatureData, setSignatureEndTimestamp, setSignatureStartTimestamp, setSignatureVideoUrl]);
|
|
14844
14970
|
var _x = React.useState(true),
|
|
14845
14971
|
showLoadingOverlay = _x[0],
|
|
14846
14972
|
setShowLoadingOverlay = _x[1];
|
|
@@ -15009,6 +15135,7 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
15009
15135
|
var onClearBtnClicked = React.useCallback(function () {
|
|
15010
15136
|
var _a, _b;
|
|
15011
15137
|
useVideoSignatureStore.setState({
|
|
15138
|
+
signatureStartedAt: undefined,
|
|
15012
15139
|
signaturePadEmpty: true,
|
|
15013
15140
|
signatureValid: false
|
|
15014
15141
|
});
|