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
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.89';
|
|
209
209
|
|
|
210
210
|
function getPlatform() {
|
|
211
211
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1145,6 +1145,12 @@ var SubmissionContext = /*#__PURE__*/createContext({
|
|
|
1145
1145
|
setIdCaptureVideoUrl: function setIdCaptureVideoUrl() {
|
|
1146
1146
|
return null;
|
|
1147
1147
|
},
|
|
1148
|
+
setSignatureStartTimestamp: function setSignatureStartTimestamp() {
|
|
1149
|
+
return null;
|
|
1150
|
+
},
|
|
1151
|
+
setSignatureEndTimestamp: function setSignatureEndTimestamp() {
|
|
1152
|
+
return null;
|
|
1153
|
+
},
|
|
1148
1154
|
setIdCaptureVideoIdFrontImage: function setIdCaptureVideoIdFrontImage() {
|
|
1149
1155
|
return null;
|
|
1150
1156
|
},
|
|
@@ -1309,44 +1315,50 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1309
1315
|
signatureVideoUrl = _16[0],
|
|
1310
1316
|
setSignatureVideoUrl = _16[1];
|
|
1311
1317
|
var _17 = useState(null),
|
|
1312
|
-
|
|
1313
|
-
|
|
1318
|
+
signatureStartTimestamp = _17[0],
|
|
1319
|
+
setSignatureStartTimestamp = _17[1];
|
|
1314
1320
|
var _18 = useState(null),
|
|
1315
|
-
|
|
1316
|
-
|
|
1321
|
+
signatureEndTimestamp = _18[0],
|
|
1322
|
+
setSignatureEndTimestamp = _18[1];
|
|
1317
1323
|
var _19 = useState(null),
|
|
1318
|
-
|
|
1319
|
-
|
|
1324
|
+
idCaptureVideoUrl = _19[0],
|
|
1325
|
+
setIdCaptureVideoUrl = _19[1];
|
|
1320
1326
|
var _20 = useState(null),
|
|
1321
|
-
|
|
1322
|
-
|
|
1327
|
+
idCaptureVideoIdFrontImage = _20[0],
|
|
1328
|
+
setIdCaptureVideoIdFrontImage = _20[1];
|
|
1323
1329
|
var _21 = useState(null),
|
|
1324
|
-
|
|
1325
|
-
|
|
1330
|
+
idCaptureVideoIdBackImage = _21[0],
|
|
1331
|
+
setIdCaptureVideoIdBackImage = _21[1];
|
|
1326
1332
|
var _22 = useState(null),
|
|
1327
|
-
|
|
1328
|
-
|
|
1333
|
+
idCaptureVideoAudioUrl = _22[0],
|
|
1334
|
+
setIdCaptureVideoAudioUrl = _22[1];
|
|
1329
1335
|
var _23 = useState(null),
|
|
1330
|
-
|
|
1331
|
-
|
|
1336
|
+
idCaptureVideoAudioStartsAt = _23[0],
|
|
1337
|
+
setIdCaptureVideoAudioStartsAt = _23[1];
|
|
1332
1338
|
var _24 = useState(null),
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
var _25 = useState(
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
var _26 = useState(
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
var _27 = useState(
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
var _28 = useState(
|
|
1345
|
-
|
|
1346
|
-
|
|
1339
|
+
expectedAudioText = _24[0],
|
|
1340
|
+
setExpectedAudioText = _24[1];
|
|
1341
|
+
var _25 = useState(null),
|
|
1342
|
+
additionalDocuments = _25[0],
|
|
1343
|
+
setAdditionalDocuments = _25[1];
|
|
1344
|
+
var _26 = useState(null),
|
|
1345
|
+
geolocationResult = _26[0],
|
|
1346
|
+
setGeolocationResult = _26[1];
|
|
1347
|
+
var _27 = useState(0),
|
|
1348
|
+
geolocationAttempts = _27[0],
|
|
1349
|
+
setGeolocationAttempts = _27[1];
|
|
1350
|
+
var _28 = useState(false),
|
|
1351
|
+
geolocationBlocked = _28[0],
|
|
1352
|
+
setGeolocationBlocked = _28[1];
|
|
1347
1353
|
var _29 = useState([]),
|
|
1348
|
-
|
|
1349
|
-
|
|
1354
|
+
idFrontCaptureAttempts = _29[0],
|
|
1355
|
+
setIdFrontCaptureAttempts = _29[1];
|
|
1356
|
+
var _30 = useState([]),
|
|
1357
|
+
idBackCaptureAttempts = _30[0],
|
|
1358
|
+
setIdBackCaptureAttempts = _30[1];
|
|
1359
|
+
var _31 = useState([]),
|
|
1360
|
+
selfieCaptureAttempts = _31[0],
|
|
1361
|
+
setSelfieCaptureAttempts = _31[1];
|
|
1350
1362
|
var logIdFrontCaptureAttempt = useCallback(function (attempt) {
|
|
1351
1363
|
setIdFrontCaptureAttempts(function (attempts) {
|
|
1352
1364
|
return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
|
|
@@ -1623,6 +1635,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1623
1635
|
submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
|
|
1624
1636
|
}
|
|
1625
1637
|
}
|
|
1638
|
+
if (signatureStartTimestamp) {
|
|
1639
|
+
submissionRequest.customerData.signatureStartTimestamp = signatureStartTimestamp;
|
|
1640
|
+
}
|
|
1641
|
+
if (signatureEndTimestamp) {
|
|
1642
|
+
submissionRequest.customerData.signatureEndTimestamp = signatureEndTimestamp;
|
|
1643
|
+
}
|
|
1626
1644
|
if (additionalDocuments) {
|
|
1627
1645
|
submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
|
|
1628
1646
|
return _assign(_assign({}, d), {
|
|
@@ -1665,7 +1683,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1665
1683
|
}
|
|
1666
1684
|
});
|
|
1667
1685
|
});
|
|
1668
|
-
}, [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]);
|
|
1686
|
+
}, [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]);
|
|
1669
1687
|
var defaultOnSubmit = useCallback(function () {
|
|
1670
1688
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1671
1689
|
var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
|
|
@@ -1962,6 +1980,8 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1962
1980
|
setSelfieImage: setSelfieImage,
|
|
1963
1981
|
setSignatureData: setSignatureData,
|
|
1964
1982
|
setSignatureVideoUrl: setSignatureVideoUrl,
|
|
1983
|
+
setSignatureStartTimestamp: setSignatureStartTimestamp,
|
|
1984
|
+
setSignatureEndTimestamp: setSignatureEndTimestamp,
|
|
1965
1985
|
setIdCaptureVideoUrl: setIdCaptureVideoUrl,
|
|
1966
1986
|
setIdCaptureVideoIdFrontImage: setIdCaptureVideoIdFrontImage,
|
|
1967
1987
|
setIdCaptureVideoIdBackImage: setIdCaptureVideoIdBackImage,
|
|
@@ -13785,6 +13805,16 @@ var Container$4 = styled.div(templateObject_1$c || (templateObject_1$c = __makeT
|
|
|
13785
13805
|
var AcceptBtn$1 = styled(LoaderButton)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
13786
13806
|
var templateObject_1$c, templateObject_2$b;
|
|
13787
13807
|
|
|
13808
|
+
function isBlob(blobPart) {
|
|
13809
|
+
return typeof Blob !== 'undefined' && blobPart instanceof Blob;
|
|
13810
|
+
}
|
|
13811
|
+
function inferBlobType(blobPart) {
|
|
13812
|
+
var _a;
|
|
13813
|
+
if (!isBlob(blobPart)) return undefined;
|
|
13814
|
+
var t = ((_a = blobPart.type) !== null && _a !== void 0 ? _a : '').trim();
|
|
13815
|
+
return t.length > 0 ? t : undefined;
|
|
13816
|
+
}
|
|
13817
|
+
|
|
13788
13818
|
var videoRecorder = null;
|
|
13789
13819
|
var audioRecorder = null;
|
|
13790
13820
|
var videoChunks = [];
|
|
@@ -13918,8 +13948,9 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13918
13948
|
useVideoRecorderStore.getState().clearRecordedData();
|
|
13919
13949
|
}, []);
|
|
13920
13950
|
var processVideo = useCallback(function () {
|
|
13951
|
+
var inferredType = inferBlobType(videoChunks[0]) || (videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.mimeType) || 'video/mp4';
|
|
13921
13952
|
var videoBlob = new Blob(videoChunks, {
|
|
13922
|
-
type:
|
|
13953
|
+
type: inferredType
|
|
13923
13954
|
});
|
|
13924
13955
|
useVideoRecorderStore.setState({
|
|
13925
13956
|
videoUrl: URL.createObjectURL(videoBlob),
|
|
@@ -13929,8 +13960,9 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13929
13960
|
setVideoRecorder(null);
|
|
13930
13961
|
}, []);
|
|
13931
13962
|
var processAudio = useCallback(function () {
|
|
13963
|
+
var inferredType = inferBlobType(audioChunks[0]) || (audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.mimeType) || 'audio/mp4';
|
|
13932
13964
|
var audioBlob = new Blob(audioChunks, {
|
|
13933
|
-
type:
|
|
13965
|
+
type: inferredType
|
|
13934
13966
|
});
|
|
13935
13967
|
useVideoRecorderStore.setState({
|
|
13936
13968
|
audioUrl: URL.createObjectURL(audioBlob),
|
|
@@ -13970,6 +14002,7 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13970
14002
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, isRecordingAudio, isRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
13971
14003
|
};
|
|
13972
14004
|
|
|
14005
|
+
var RECORDING_TIMESTAMP_PADDING_MS = 1000;
|
|
13973
14006
|
var signatureRecorder = null;
|
|
13974
14007
|
var signatureChunks = [];
|
|
13975
14008
|
var videoSignatureInitialState = {
|
|
@@ -13982,7 +14015,6 @@ var videoSignatureInitialState = {
|
|
|
13982
14015
|
clearRecordedData: function clearRecordedData() {
|
|
13983
14016
|
return null;
|
|
13984
14017
|
},
|
|
13985
|
-
isRecording: false,
|
|
13986
14018
|
signaturePad: {
|
|
13987
14019
|
current: null
|
|
13988
14020
|
},
|
|
@@ -14005,7 +14037,7 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14005
14037
|
if (!camera) throw new Error('Camera not found');
|
|
14006
14038
|
// set our flag and clear whatever we have recorded so far.
|
|
14007
14039
|
set({
|
|
14008
|
-
|
|
14040
|
+
recordingStartedAt: performance.now()
|
|
14009
14041
|
});
|
|
14010
14042
|
signatureChunks = [];
|
|
14011
14043
|
// start recording video and audio
|
|
@@ -14019,27 +14051,52 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14019
14051
|
videoBitsPerSecond: 270000,
|
|
14020
14052
|
audioBitsPerSecond: 32000
|
|
14021
14053
|
});
|
|
14054
|
+
var hasFirstChunk = false;
|
|
14022
14055
|
signatureRecorder.ondataavailable = function (event) {
|
|
14023
14056
|
signatureChunks.push(event.data);
|
|
14057
|
+
if (!hasFirstChunk) {
|
|
14058
|
+
hasFirstChunk = true;
|
|
14059
|
+
set({
|
|
14060
|
+
firstChunkReceivedAt: performance.now(),
|
|
14061
|
+
lastChunkReceivedAt: performance.now()
|
|
14062
|
+
});
|
|
14063
|
+
} else {
|
|
14064
|
+
set({
|
|
14065
|
+
lastChunkReceivedAt: performance.now()
|
|
14066
|
+
});
|
|
14067
|
+
}
|
|
14024
14068
|
};
|
|
14025
14069
|
signatureRecorder.start(100);
|
|
14026
14070
|
},
|
|
14027
14071
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
14028
14072
|
set({
|
|
14029
|
-
|
|
14073
|
+
firstChunkReceivedAt: undefined,
|
|
14074
|
+
recordingStoppedAt: performance.now()
|
|
14075
|
+
});
|
|
14076
|
+
waitForOneMoreChunk().then(function () {
|
|
14077
|
+
if (!signatureRecorder) return;
|
|
14078
|
+
signatureRecorder.stop();
|
|
14079
|
+
signatureRecorder.onstop = function () {
|
|
14080
|
+
var inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
14081
|
+
var blob = new Blob(signatureChunks, {
|
|
14082
|
+
type: inferredType
|
|
14083
|
+
});
|
|
14084
|
+
signatureChunks = [];
|
|
14085
|
+
signatureRecorder = null;
|
|
14086
|
+
if (!signatureData) return;
|
|
14087
|
+
var _a = get(),
|
|
14088
|
+
onSignatureVideoCaptured = _a.onSignatureVideoCaptured,
|
|
14089
|
+
recordingStartedAt = _a.recordingStartedAt,
|
|
14090
|
+
signatureStartedAt = _a.signatureStartedAt,
|
|
14091
|
+
signatureEndedAt = _a.signatureEndedAt,
|
|
14092
|
+
lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
14093
|
+
var endMs = Math.min(signatureEndedAt !== null && signatureEndedAt !== void 0 ? signatureEndedAt : Infinity, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity);
|
|
14094
|
+
var signatureStartTimestamp = signatureStartedAt && recordingStartedAt ? formatTimestamp(Math.max(0, signatureStartedAt - recordingStartedAt - RECORDING_TIMESTAMP_PADDING_MS)) : undefined;
|
|
14095
|
+
var signatureEndTimestamp = endMs !== Infinity && recordingStartedAt ? formatTimestamp(Math.min(endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity)) : undefined;
|
|
14096
|
+
onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, signatureStartTimestamp, signatureEndTimestamp);
|
|
14097
|
+
};
|
|
14098
|
+
useVideoRecorderStore.getState().stopRecording();
|
|
14030
14099
|
});
|
|
14031
|
-
if (!signatureRecorder) return;
|
|
14032
|
-
signatureRecorder.stop();
|
|
14033
|
-
signatureRecorder.onstop = function () {
|
|
14034
|
-
var blob = new Blob(signatureChunks, {
|
|
14035
|
-
type: 'video/mp4'
|
|
14036
|
-
});
|
|
14037
|
-
signatureChunks = [];
|
|
14038
|
-
signatureRecorder = null;
|
|
14039
|
-
if (!signatureData) return;
|
|
14040
|
-
get().onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null);
|
|
14041
|
-
};
|
|
14042
|
-
useVideoRecorderStore.getState().stopRecording();
|
|
14043
14100
|
},
|
|
14044
14101
|
clearRecordedData: function clearRecordedData() {
|
|
14045
14102
|
signatureChunks = [];
|
|
@@ -14048,13 +14105,42 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
14048
14105
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
14049
14106
|
signatureRecorder = null;
|
|
14050
14107
|
set({
|
|
14051
|
-
|
|
14108
|
+
recordingStartedAt: undefined,
|
|
14109
|
+
recordingStoppedAt: undefined,
|
|
14110
|
+
firstChunkReceivedAt: undefined,
|
|
14111
|
+
lastChunkReceivedAt: undefined,
|
|
14052
14112
|
signaturePadEmpty: true,
|
|
14053
|
-
signatureValid: false
|
|
14113
|
+
signatureValid: false,
|
|
14114
|
+
signatureStartedAt: undefined,
|
|
14115
|
+
signatureEndedAt: undefined
|
|
14054
14116
|
});
|
|
14055
14117
|
}
|
|
14056
14118
|
});
|
|
14057
14119
|
}));
|
|
14120
|
+
function waitForOneMoreChunk(timeoutMs) {
|
|
14121
|
+
if (timeoutMs === void 0) {
|
|
14122
|
+
timeoutMs = 3000;
|
|
14123
|
+
}
|
|
14124
|
+
var start = performance.now();
|
|
14125
|
+
return new Promise(function (resolve) {
|
|
14126
|
+
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14127
|
+
if (!initialLastChunkReceivedAt) return resolve();
|
|
14128
|
+
function gotAChunk() {
|
|
14129
|
+
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14130
|
+
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
14131
|
+
}
|
|
14132
|
+
setTimeout(function () {
|
|
14133
|
+
if (gotAChunk()) return resolve(); // check immediately
|
|
14134
|
+
// otherwise, check every 100ms
|
|
14135
|
+
var interval = setInterval(function () {
|
|
14136
|
+
if (gotAChunk()) {
|
|
14137
|
+
clearInterval(interval);
|
|
14138
|
+
resolve();
|
|
14139
|
+
}
|
|
14140
|
+
}, 100);
|
|
14141
|
+
}, 0);
|
|
14142
|
+
});
|
|
14143
|
+
}
|
|
14058
14144
|
function VideoSignatureContextProvider(_a) {
|
|
14059
14145
|
var _this = this;
|
|
14060
14146
|
var _b, _c;
|
|
@@ -14073,7 +14159,14 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14073
14159
|
// clear recorded data when the component is mounted
|
|
14074
14160
|
useVideoSignatureStore.getState().clearRecordedData();
|
|
14075
14161
|
}, []);
|
|
14076
|
-
var
|
|
14162
|
+
var _e = useVideoSignatureStore(useShallow(function (state) {
|
|
14163
|
+
return {
|
|
14164
|
+
recordingStartedAt: state.recordingStartedAt,
|
|
14165
|
+
recordingStoppedAt: state.recordingStoppedAt
|
|
14166
|
+
};
|
|
14167
|
+
})),
|
|
14168
|
+
recordingStartedAt = _e.recordingStartedAt,
|
|
14169
|
+
recordingStoppedAt = _e.recordingStoppedAt;
|
|
14077
14170
|
useFrameLoop(useCallback(function () {
|
|
14078
14171
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14079
14172
|
var signaturePad, ctx, _a, w, h, isPortrait, rect;
|
|
@@ -14100,7 +14193,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14100
14193
|
});
|
|
14101
14194
|
});
|
|
14102
14195
|
}, [videoRef]), {
|
|
14103
|
-
autoStart:
|
|
14196
|
+
autoStart: !!recordingStartedAt && !recordingStoppedAt,
|
|
14104
14197
|
throttleMs: 1000 / 24
|
|
14105
14198
|
});
|
|
14106
14199
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -14109,6 +14202,17 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14109
14202
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
14110
14203
|
}));
|
|
14111
14204
|
}
|
|
14205
|
+
function formatTimestamp(durationMs) {
|
|
14206
|
+
// should be in the format of 00:00:00:00 (hh:mm:ss:cs)
|
|
14207
|
+
var hours = Math.floor(durationMs / 3600000);
|
|
14208
|
+
var minutes = Math.floor(durationMs % 3600000 / 60000);
|
|
14209
|
+
var seconds = Math.floor(durationMs % 60000 / 1000);
|
|
14210
|
+
var milliseconds = durationMs % 1000;
|
|
14211
|
+
// Convert milliseconds to centiseconds (1/100th of a second)
|
|
14212
|
+
var centiseconds = Math.floor(milliseconds / 10);
|
|
14213
|
+
var csString = centiseconds.toString().padStart(2, '0');
|
|
14214
|
+
return "".concat(hours.toString().padStart(2, '0'), ":") + "".concat(minutes.toString().padStart(2, '0'), ":") + "".concat(seconds.toString().padStart(2, '0'), ":") + "".concat(csString);
|
|
14215
|
+
}
|
|
14112
14216
|
|
|
14113
14217
|
function VideoSignaturePad(_a) {
|
|
14114
14218
|
var onAcceptBtnClicked = _a.onAcceptBtnClicked,
|
|
@@ -14170,8 +14274,11 @@ function VideoSignaturePad(_a) {
|
|
|
14170
14274
|
ref: signaturePad,
|
|
14171
14275
|
canvasProps: canvasProps,
|
|
14172
14276
|
onBegin: function onBegin() {
|
|
14173
|
-
return useVideoSignatureStore.setState({
|
|
14174
|
-
|
|
14277
|
+
return useVideoSignatureStore.setState(function (s) {
|
|
14278
|
+
return {
|
|
14279
|
+
signaturePadEmpty: false,
|
|
14280
|
+
signatureStartedAt: s.signatureStartedAt || performance.now()
|
|
14281
|
+
};
|
|
14175
14282
|
});
|
|
14176
14283
|
},
|
|
14177
14284
|
onEnd: function onEnd() {
|
|
@@ -14181,7 +14288,8 @@ function VideoSignaturePad(_a) {
|
|
|
14181
14288
|
return point;
|
|
14182
14289
|
});
|
|
14183
14290
|
useVideoSignatureStore.setState({
|
|
14184
|
-
signatureValid: points.length >= minSignaturePadPoints
|
|
14291
|
+
signatureValid: points.length >= minSignaturePadPoints,
|
|
14292
|
+
signatureEndedAt: performance.now()
|
|
14185
14293
|
});
|
|
14186
14294
|
}
|
|
14187
14295
|
}), !headTrackingSatisfied && !!verbiage.headTrackingUnsatisfiedText ? ( /*#__PURE__*/React__default.createElement(SignaturePadContentContainer, {
|
|
@@ -14248,6 +14356,12 @@ function VideoSignatureGuides(_a) {
|
|
|
14248
14356
|
useEffect(function () {
|
|
14249
14357
|
if (guideToDisplay) setMode(guideToDisplay);
|
|
14250
14358
|
}, [guideToDisplay]);
|
|
14359
|
+
var firstChunkReceivedAt = useVideoSignatureStore(useShallow(function (state) {
|
|
14360
|
+
return {
|
|
14361
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
14362
|
+
};
|
|
14363
|
+
})).firstChunkReceivedAt;
|
|
14364
|
+
var signaturePadDisabled = requestedAction !== 'CAPTURE_SIGNATURE' || !firstChunkReceivedAt;
|
|
14251
14365
|
return /*#__PURE__*/React__default.createElement(Container$3, {
|
|
14252
14366
|
className: classNames.container
|
|
14253
14367
|
}, /*#__PURE__*/React__default.createElement(Inner$1, {
|
|
@@ -14271,7 +14385,7 @@ function VideoSignatureGuides(_a) {
|
|
|
14271
14385
|
}, /*#__PURE__*/React__default.createElement(VideoSignaturePad, {
|
|
14272
14386
|
onAcceptBtnClicked: onAcceptBtnClicked,
|
|
14273
14387
|
onClearBtnClicked: onClearBtnClicked,
|
|
14274
|
-
disabled:
|
|
14388
|
+
disabled: signaturePadDisabled,
|
|
14275
14389
|
headTrackingSatisfied: headTrackingSatisfied,
|
|
14276
14390
|
minSignaturePadPoints: minSignaturePadPoints,
|
|
14277
14391
|
classNames: classNames,
|
|
@@ -14328,9 +14442,11 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14328
14442
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
14329
14443
|
startHeadTracking = _o.start,
|
|
14330
14444
|
stopHeadTracking = _o.stop;
|
|
14331
|
-
var
|
|
14332
|
-
|
|
14333
|
-
|
|
14445
|
+
var firstChunkReceivedAt = useVideoSignatureStore(useShallow(function (state) {
|
|
14446
|
+
return {
|
|
14447
|
+
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
14448
|
+
};
|
|
14449
|
+
})).firstChunkReceivedAt;
|
|
14334
14450
|
useEffect(function () {
|
|
14335
14451
|
useVideoSignatureStore.setState({
|
|
14336
14452
|
onSignatureVideoCaptured: onSignatureVideoCaptured
|
|
@@ -14349,15 +14465,15 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14349
14465
|
var verbiage = useTranslations(rawVerbiage, {
|
|
14350
14466
|
guidanceMessageText: 'Please sign the box below'
|
|
14351
14467
|
});
|
|
14352
|
-
var
|
|
14353
|
-
headTrackingSatisfied =
|
|
14354
|
-
setHeadTrackingSatisfied =
|
|
14355
|
-
var
|
|
14356
|
-
lastFace =
|
|
14357
|
-
setLastFace =
|
|
14358
|
-
var
|
|
14359
|
-
numFramesWithoutFaces =
|
|
14360
|
-
setNumFramesWithoutFaces =
|
|
14468
|
+
var _p = useState(true),
|
|
14469
|
+
headTrackingSatisfied = _p[0],
|
|
14470
|
+
setHeadTrackingSatisfied = _p[1];
|
|
14471
|
+
var _q = useState(null),
|
|
14472
|
+
lastFace = _q[0],
|
|
14473
|
+
setLastFace = _q[1];
|
|
14474
|
+
var _r = useState(0),
|
|
14475
|
+
numFramesWithoutFaces = _r[0],
|
|
14476
|
+
setNumFramesWithoutFaces = _r[1];
|
|
14361
14477
|
onHeadTrackingPredictionMade(useThrottledCallback(useCallback(function (_a) {
|
|
14362
14478
|
var face = _a.face;
|
|
14363
14479
|
if (headTrackingDisabled) return;
|
|
@@ -14372,12 +14488,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14372
14488
|
return n + 1;
|
|
14373
14489
|
});
|
|
14374
14490
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
14375
|
-
var
|
|
14376
|
-
ref =
|
|
14377
|
-
|
|
14378
|
-
width =
|
|
14379
|
-
|
|
14380
|
-
height =
|
|
14491
|
+
var _s = useResizeObserver(),
|
|
14492
|
+
ref = _s.ref,
|
|
14493
|
+
_t = _s.width,
|
|
14494
|
+
width = _t === void 0 ? 1 : _t,
|
|
14495
|
+
_u = _s.height,
|
|
14496
|
+
height = _u === void 0 ? 1 : _u;
|
|
14381
14497
|
var debugScalingDetails = useDebugScalingDetails({
|
|
14382
14498
|
enabled: debugMode,
|
|
14383
14499
|
pageWidth: width,
|
|
@@ -14408,13 +14524,19 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14408
14524
|
classNames: classNames.guides,
|
|
14409
14525
|
verbiage: rawVerbiage.guides,
|
|
14410
14526
|
onClearBtnClicked: restartVideoOnSignaturePadCleared ? function () {
|
|
14411
|
-
return setTimeout(
|
|
14412
|
-
|
|
14527
|
+
return setTimeout(function () {
|
|
14528
|
+
return useVideoSignatureStore.getState().clearRecordedData();
|
|
14529
|
+
}, 100);
|
|
14530
|
+
} : function () {
|
|
14531
|
+
return useVideoSignatureStore.setState({
|
|
14532
|
+
signatureStartedAt: undefined
|
|
14533
|
+
});
|
|
14534
|
+
}
|
|
14413
14535
|
}), debugMode && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectDetectionDebugOverlayDiv, null, lastFace && ( /*#__PURE__*/React__default.createElement(SelfieCaptureFaceDebugBox, {
|
|
14414
14536
|
face: lastFace,
|
|
14415
14537
|
scaling: debugScalingDetails,
|
|
14416
14538
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
14417
|
-
}))), /*#__PURE__*/React__default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__default.createElement("br", null), "Recording: ",
|
|
14539
|
+
}))), /*#__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, {
|
|
14418
14540
|
onClick: onExit,
|
|
14419
14541
|
className: classNames.exitCaptureBtn
|
|
14420
14542
|
}));
|
|
@@ -14745,6 +14867,8 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14745
14867
|
setSelfieImage = _u.setSelfieImage,
|
|
14746
14868
|
setSignatureData = _u.setSignatureData,
|
|
14747
14869
|
setSignatureVideoUrl = _u.setSignatureVideoUrl,
|
|
14870
|
+
setSignatureStartTimestamp = _u.setSignatureStartTimestamp,
|
|
14871
|
+
setSignatureEndTimestamp = _u.setSignatureEndTimestamp,
|
|
14748
14872
|
logSelfieCaptureAttempt = _u.logSelfieCaptureAttempt,
|
|
14749
14873
|
uploadDocument = _u.uploadDocument;
|
|
14750
14874
|
var cameraAccessDenied = useCameraStore(useShallow(function (state) {
|
|
@@ -14804,12 +14928,14 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14804
14928
|
filetype: 'image/jpeg'
|
|
14805
14929
|
}).then(onSelfieCaptured);
|
|
14806
14930
|
}, [logCaptureMetadata, onSelfieCaptured, setSelfieImage, uploadDocument]);
|
|
14807
|
-
var onSignatureCaptureCompleted = useCallback(function (videoData, signatureData, signatureImageData) {
|
|
14931
|
+
var onSignatureCaptureCompleted = useCallback(function (videoData, signatureData, signatureImageData, signatureStartTimestamp, signatureEndTimestamp) {
|
|
14808
14932
|
setSignatureData(signatureData);
|
|
14809
14933
|
setSignatureVideoUrl(URL.createObjectURL(videoData));
|
|
14934
|
+
if (signatureStartTimestamp) setSignatureStartTimestamp(signatureStartTimestamp);
|
|
14935
|
+
if (signatureEndTimestamp) setSignatureEndTimestamp(signatureEndTimestamp);
|
|
14810
14936
|
setCaptureState('SUCCESS');
|
|
14811
|
-
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
|
|
14812
|
-
}, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
|
|
14937
|
+
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData, signatureStartTimestamp, signatureEndTimestamp);
|
|
14938
|
+
}, [onVideoCaptured, setSignatureData, setSignatureEndTimestamp, setSignatureStartTimestamp, setSignatureVideoUrl]);
|
|
14813
14939
|
var _x = useState(true),
|
|
14814
14940
|
showLoadingOverlay = _x[0],
|
|
14815
14941
|
setShowLoadingOverlay = _x[1];
|
|
@@ -14978,6 +15104,7 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
14978
15104
|
var onClearBtnClicked = useCallback(function () {
|
|
14979
15105
|
var _a, _b;
|
|
14980
15106
|
useVideoSignatureStore.setState({
|
|
15107
|
+
signatureStartedAt: undefined,
|
|
14981
15108
|
signaturePadEmpty: true,
|
|
14982
15109
|
signatureValid: false
|
|
14983
15110
|
});
|