idmission-web-sdk 2.3.14 → 2.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts +2 -1
- package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +19 -4
- 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/VideoSignatureWizard.d.ts.map +1 -1
- package/dist/lib/camera/useVideoRecorder.d.ts +32 -3
- package/dist/lib/camera/useVideoRecorder.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +370 -361
- 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 +370 -361
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +370 -361
- 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 +1 -1
|
@@ -235,7 +235,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
235
235
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
var webSdkVersion = '2.3.
|
|
238
|
+
var webSdkVersion = '2.3.16';
|
|
239
239
|
|
|
240
240
|
function getPlatform() {
|
|
241
241
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -853,11 +853,11 @@ function setDefaultAuthUrl(url) {
|
|
|
853
853
|
if (!allowedAuthUrls.includes(url)) throw new Error('invalid auth url');
|
|
854
854
|
exports.defaultAuthUrl = url;
|
|
855
855
|
}
|
|
856
|
-
var initialState$
|
|
856
|
+
var initialState$7 = {
|
|
857
857
|
authUrl: exports.defaultAuthUrl,
|
|
858
858
|
sessionCheckState: 'READY'
|
|
859
859
|
};
|
|
860
|
-
var AuthStateContext = /*#__PURE__*/React.createContext(initialState$
|
|
860
|
+
var AuthStateContext = /*#__PURE__*/React.createContext(initialState$7);
|
|
861
861
|
var AuthDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
862
862
|
var reducer$4 = function reducer(state, action) {
|
|
863
863
|
switch (action.type) {
|
|
@@ -976,7 +976,7 @@ function useAuthReducer(authUrl, sessionId) {
|
|
|
976
976
|
if (authUrl === void 0) {
|
|
977
977
|
authUrl = exports.defaultAuthUrl;
|
|
978
978
|
}
|
|
979
|
-
var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$
|
|
979
|
+
var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$7), {
|
|
980
980
|
authUrl: authUrl
|
|
981
981
|
})),
|
|
982
982
|
state = _a[0],
|
|
@@ -4773,7 +4773,7 @@ function useTranslations(verbiage, fallbacks) {
|
|
|
4773
4773
|
}, [fallbacks, i18n.language, t, verbiage]);
|
|
4774
4774
|
}
|
|
4775
4775
|
|
|
4776
|
-
var initialState$
|
|
4776
|
+
var initialState$6 = {
|
|
4777
4777
|
videoRef: {
|
|
4778
4778
|
current: null
|
|
4779
4779
|
},
|
|
@@ -4796,9 +4796,9 @@ var initialState$5 = {
|
|
|
4796
4796
|
};
|
|
4797
4797
|
var createCameraStore = function createCameraStore(config) {
|
|
4798
4798
|
var store = zustand.createStore(function (set, get) {
|
|
4799
|
-
return _assign(_assign(_assign({}, initialState$
|
|
4799
|
+
return _assign(_assign(_assign({}, initialState$6), config), {
|
|
4800
4800
|
reset: function reset() {
|
|
4801
|
-
return set(_assign(_assign({}, initialState$
|
|
4801
|
+
return set(_assign(_assign({}, initialState$6), config));
|
|
4802
4802
|
},
|
|
4803
4803
|
setConfig: function setConfig(config) {
|
|
4804
4804
|
return set(config);
|
|
@@ -5815,7 +5815,7 @@ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, r
|
|
|
5815
5815
|
});
|
|
5816
5816
|
}
|
|
5817
5817
|
|
|
5818
|
-
var initialState$
|
|
5818
|
+
var initialState$5 = {
|
|
5819
5819
|
initialDrawComplete: false,
|
|
5820
5820
|
redrawing: false,
|
|
5821
5821
|
guideRectX: 0,
|
|
@@ -6175,7 +6175,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6175
6175
|
});
|
|
6176
6176
|
}
|
|
6177
6177
|
case 'resetWizard':
|
|
6178
|
-
return _assign(_assign({}, initialState$
|
|
6178
|
+
return _assign(_assign({}, initialState$5), {
|
|
6179
6179
|
dispatch: state.dispatch,
|
|
6180
6180
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
6181
6181
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
@@ -6187,7 +6187,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6187
6187
|
}
|
|
6188
6188
|
};
|
|
6189
6189
|
var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
|
|
6190
|
-
return _assign(_assign({}, initialState$
|
|
6190
|
+
return _assign(_assign({}, initialState$5), {
|
|
6191
6191
|
dispatch: function dispatch(action) {
|
|
6192
6192
|
return set(function (state) {
|
|
6193
6193
|
return _reducer(state, action);
|
|
@@ -11731,7 +11731,7 @@ var ImageContainer$6 = styled__default.default(OverlayImageContainer)(templateOb
|
|
|
11731
11731
|
var StyledButtonsRow$6 = styled__default.default(ButtonsRow$2)(templateObject_5$5 || (templateObject_5$5 = __makeTemplateObject(["\n margin-top: 32px;\n"], ["\n margin-top: 32px;\n"])));
|
|
11732
11732
|
var templateObject_1$m, templateObject_2$i, templateObject_3$d, templateObject_4$8, templateObject_5$5;
|
|
11733
11733
|
|
|
11734
|
-
var initialState$
|
|
11734
|
+
var initialState$4 = {
|
|
11735
11735
|
busy: false,
|
|
11736
11736
|
frame: null,
|
|
11737
11737
|
prediction: null
|
|
@@ -11786,7 +11786,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11786
11786
|
width = _k === void 0 ? 1 : _k,
|
|
11787
11787
|
_l = _j.height,
|
|
11788
11788
|
height = _l === void 0 ? 1 : _l;
|
|
11789
|
-
var _m = React.useReducer(reducer$3, initialState$
|
|
11789
|
+
var _m = React.useReducer(reducer$3, initialState$4),
|
|
11790
11790
|
_o = _m[0],
|
|
11791
11791
|
busy = _o.busy,
|
|
11792
11792
|
prediction = _o.prediction,
|
|
@@ -11896,7 +11896,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11896
11896
|
var Container$6 = styled__default.default.div(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n"], ["\n width: 100%;\n height: 100%;\n"])));
|
|
11897
11897
|
var templateObject_1$l;
|
|
11898
11898
|
|
|
11899
|
-
var initialState$
|
|
11899
|
+
var initialState$3 = {
|
|
11900
11900
|
frame: null,
|
|
11901
11901
|
face: null,
|
|
11902
11902
|
requestState: 'CAPTURING',
|
|
@@ -11913,7 +11913,7 @@ var reducer$2 = function reducer(state, action) {
|
|
|
11913
11913
|
var _a, _b;
|
|
11914
11914
|
switch (action.type) {
|
|
11915
11915
|
case 'resetLivenessCheck':
|
|
11916
|
-
return _assign(_assign({}, initialState$
|
|
11916
|
+
return _assign(_assign({}, initialState$3), {
|
|
11917
11917
|
timesLivenessCheckFailed: state.timesLivenessCheckFailed
|
|
11918
11918
|
});
|
|
11919
11919
|
case 'guidanceUnsatisfied':
|
|
@@ -12021,7 +12021,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
12021
12021
|
checkLiveness = _m.checkLiveness,
|
|
12022
12022
|
submissionError = _m.submissionError;
|
|
12023
12023
|
var modelError = useSelfieGuidanceModelsContext().error;
|
|
12024
|
-
var _o = React.useReducer(reducer$2, initialState$
|
|
12024
|
+
var _o = React.useReducer(reducer$2, initialState$3),
|
|
12025
12025
|
state = _o[0],
|
|
12026
12026
|
dispatch = _o[1];
|
|
12027
12027
|
var _p = React.useState(null),
|
|
@@ -13376,120 +13376,141 @@ function clearVideoChunks() {
|
|
|
13376
13376
|
function clearAudioChunks() {
|
|
13377
13377
|
audioChunks = [];
|
|
13378
13378
|
}
|
|
13379
|
-
var
|
|
13379
|
+
var initialState$2 = {
|
|
13380
|
+
videoUrl: null,
|
|
13381
|
+
audioUrl: null,
|
|
13382
|
+
isRecordingVideo: false,
|
|
13383
|
+
isRecordingAudio: false,
|
|
13384
|
+
videoRecordingStopped: false,
|
|
13385
|
+
audioRecordingStopped: false,
|
|
13386
|
+
videoRecordingIntentionallyStopped: false,
|
|
13387
|
+
audioRecordingIntentionallyStopped: false,
|
|
13388
|
+
mergeAVStreams: false
|
|
13389
|
+
};
|
|
13390
|
+
var useVideoRecorderStore = zustand.create()(middleware.devtools(function (set, get) {
|
|
13391
|
+
return _assign(_assign({}, initialState$2), {
|
|
13392
|
+
startRecordingVideo: function startRecordingVideo(camera, audioStream) {
|
|
13393
|
+
var _a, _b, _c;
|
|
13394
|
+
var videoStream = get().mergeAVStreams ? new MediaStream(__spreadArray(__spreadArray([], (_b = (_a = camera === null || camera === void 0 ? void 0 : camera.stream) === null || _a === void 0 ? void 0 : _a.getTracks()) !== null && _b !== void 0 ? _b : [], true), (_c = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getTracks()) !== null && _c !== void 0 ? _c : [], true)) : camera.stream;
|
|
13395
|
+
if (!videoStream) return;
|
|
13396
|
+
clearVideoChunks();
|
|
13397
|
+
setVideoRecorder(null);
|
|
13398
|
+
set({
|
|
13399
|
+
isRecordingVideo: true,
|
|
13400
|
+
videoRecordingStopped: false,
|
|
13401
|
+
videoRecordingIntentionallyStopped: false
|
|
13402
|
+
});
|
|
13403
|
+
var videoRecorder = new MediaRecorder(videoStream, {
|
|
13404
|
+
videoBitsPerSecond: 270000,
|
|
13405
|
+
audioBitsPerSecond: 32000
|
|
13406
|
+
});
|
|
13407
|
+
setVideoRecorder(videoRecorder);
|
|
13408
|
+
videoRecorder.ondataavailable = function (e) {
|
|
13409
|
+
videoChunks.push(e.data);
|
|
13410
|
+
};
|
|
13411
|
+
videoRecorder.onstop = function () {
|
|
13412
|
+
set({
|
|
13413
|
+
videoRecordingStopped: true
|
|
13414
|
+
});
|
|
13415
|
+
};
|
|
13416
|
+
videoRecorder.start(1000);
|
|
13417
|
+
setTimeout(function () {
|
|
13418
|
+
var videoRecorder = getVideoRecorder();
|
|
13419
|
+
if (!videoRecorder || videoRecorder.state === 'inactive') {
|
|
13420
|
+
log('media recorder is inactive!');
|
|
13421
|
+
// TODO: figure out what to do here
|
|
13422
|
+
}
|
|
13423
|
+
}, 100);
|
|
13424
|
+
},
|
|
13425
|
+
stopRecordingVideo: function stopRecordingVideo() {
|
|
13426
|
+
set({
|
|
13427
|
+
videoRecordingIntentionallyStopped: true
|
|
13428
|
+
});
|
|
13429
|
+
if ((videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.state) !== 'inactive') {
|
|
13430
|
+
videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
|
|
13431
|
+
}
|
|
13432
|
+
},
|
|
13433
|
+
startRecordingAudio: function startRecordingAudio(audioStream) {
|
|
13434
|
+
if (get().mergeAVStreams) return;
|
|
13435
|
+
if (!audioStream) return;
|
|
13436
|
+
clearAudioChunks();
|
|
13437
|
+
set({
|
|
13438
|
+
isRecordingAudio: true,
|
|
13439
|
+
audioRecordingStopped: false,
|
|
13440
|
+
audioRecordingIntentionallyStopped: false
|
|
13441
|
+
});
|
|
13442
|
+
var audioRecorder = new MediaRecorder(audioStream, {
|
|
13443
|
+
audioBitsPerSecond: 32000
|
|
13444
|
+
});
|
|
13445
|
+
setAudioRecorder(audioRecorder);
|
|
13446
|
+
audioRecorder.ondataavailable = function (e) {
|
|
13447
|
+
audioChunks.push(e.data);
|
|
13448
|
+
};
|
|
13449
|
+
audioRecorder.onstop = function () {
|
|
13450
|
+
set({
|
|
13451
|
+
audioRecordingStopped: true
|
|
13452
|
+
});
|
|
13453
|
+
};
|
|
13454
|
+
audioRecorder.start(1000);
|
|
13455
|
+
},
|
|
13456
|
+
stopRecordingAudio: function stopRecordingAudio() {
|
|
13457
|
+
set({
|
|
13458
|
+
audioRecordingIntentionallyStopped: true
|
|
13459
|
+
});
|
|
13460
|
+
if ((audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.state) !== 'inactive') {
|
|
13461
|
+
audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
|
|
13462
|
+
}
|
|
13463
|
+
},
|
|
13464
|
+
stopRecording: function stopRecording() {
|
|
13465
|
+
get().stopRecordingVideo();
|
|
13466
|
+
get().stopRecordingAudio();
|
|
13467
|
+
},
|
|
13468
|
+
clearRecordedData: function clearRecordedData() {
|
|
13469
|
+
clearVideoChunks();
|
|
13470
|
+
clearAudioChunks();
|
|
13471
|
+
}
|
|
13472
|
+
});
|
|
13473
|
+
}));
|
|
13474
|
+
var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
13380
13475
|
if (mergeAVStreams === void 0) {
|
|
13381
13476
|
mergeAVStreams = false;
|
|
13382
13477
|
}
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
setAudioUrl = _b[1];
|
|
13389
|
-
var _c = React.useState(false),
|
|
13390
|
-
isRecordingVideo = _c[0],
|
|
13391
|
-
setIsRecordingVideo = _c[1];
|
|
13392
|
-
var _d = React.useState(false),
|
|
13393
|
-
isRecordingAudio = _d[0],
|
|
13394
|
-
setIsRecordingAudio = _d[1];
|
|
13395
|
-
var _e = React.useState(false),
|
|
13396
|
-
videoRecordingStopped = _e[0],
|
|
13397
|
-
setVideoRecordingStopped = _e[1];
|
|
13398
|
-
var _f = React.useState(false),
|
|
13399
|
-
audioRecordingStopped = _f[0],
|
|
13400
|
-
setAudioRecordingStopped = _f[1];
|
|
13401
|
-
var _g = React.useState(false),
|
|
13402
|
-
videoRecordingIntentionallyStopped = _g[0],
|
|
13403
|
-
setVideoRecordingIntentionallyStopped = _g[1];
|
|
13404
|
-
var _h = React.useState(false),
|
|
13405
|
-
audioRecordingIntentionallyStopped = _h[0],
|
|
13406
|
-
setAudioRecordingIntentionallyStopped = _h[1];
|
|
13407
|
-
var getVideoStream = React.useCallback(function () {
|
|
13408
|
-
var _a, _b, _c;
|
|
13409
|
-
if (!mergeAVStreams) return camera === null || camera === void 0 ? void 0 : camera.stream;
|
|
13410
|
-
var videoTracks = (_b = (_a = camera === null || camera === void 0 ? void 0 : camera.stream) === null || _a === void 0 ? void 0 : _a.getTracks()) !== null && _b !== void 0 ? _b : [];
|
|
13411
|
-
var audioTracks = (_c = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getTracks()) !== null && _c !== void 0 ? _c : [];
|
|
13412
|
-
return new MediaStream(__spreadArray(__spreadArray([], videoTracks, true), audioTracks, true));
|
|
13413
|
-
}, [audioStream, camera === null || camera === void 0 ? void 0 : camera.stream, mergeAVStreams]);
|
|
13478
|
+
React.useEffect(function () {
|
|
13479
|
+
return useVideoRecorderStore.setState({
|
|
13480
|
+
mergeAVStreams: mergeAVStreams
|
|
13481
|
+
});
|
|
13482
|
+
}, [mergeAVStreams]);
|
|
13414
13483
|
var processVideo = React.useCallback(function () {
|
|
13415
13484
|
var videoBlob = new Blob(videoChunks, {
|
|
13416
13485
|
type: 'video/mp4'
|
|
13417
13486
|
});
|
|
13418
|
-
|
|
13487
|
+
useVideoRecorderStore.setState({
|
|
13488
|
+
videoUrl: URL.createObjectURL(videoBlob),
|
|
13489
|
+
isRecordingVideo: false
|
|
13490
|
+
});
|
|
13419
13491
|
clearVideoChunks();
|
|
13420
|
-
setIsRecordingVideo(false);
|
|
13421
13492
|
setVideoRecorder(null);
|
|
13422
|
-
|
|
13423
|
-
}, [camera]);
|
|
13493
|
+
}, []);
|
|
13424
13494
|
var processAudio = React.useCallback(function () {
|
|
13425
|
-
var _a;
|
|
13426
13495
|
var audioBlob = new Blob(audioChunks, {
|
|
13427
13496
|
type: 'audio/mp4'
|
|
13428
13497
|
});
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
setAudioRecorder(null);
|
|
13433
|
-
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
13434
|
-
}, [audioStream]);
|
|
13435
|
-
var startRecordingVideo = React.useCallback(function () {
|
|
13436
|
-
var videoStream = getVideoStream();
|
|
13437
|
-
if (!videoStream) return;
|
|
13438
|
-
clearVideoChunks();
|
|
13439
|
-
setIsRecordingVideo(true);
|
|
13440
|
-
setVideoRecordingStopped(false);
|
|
13441
|
-
setVideoRecordingIntentionallyStopped(false);
|
|
13442
|
-
var videoRecorder = new MediaRecorder(videoStream, {
|
|
13443
|
-
videoBitsPerSecond: 270000,
|
|
13444
|
-
audioBitsPerSecond: 32000
|
|
13498
|
+
useVideoRecorderStore.setState({
|
|
13499
|
+
audioUrl: URL.createObjectURL(audioBlob),
|
|
13500
|
+
isRecordingAudio: false
|
|
13445
13501
|
});
|
|
13446
|
-
setVideoRecorder(videoRecorder);
|
|
13447
|
-
videoRecorder.ondataavailable = function (e) {
|
|
13448
|
-
videoChunks.push(e.data);
|
|
13449
|
-
};
|
|
13450
|
-
videoRecorder.onstop = function () {
|
|
13451
|
-
setVideoRecordingStopped(true);
|
|
13452
|
-
};
|
|
13453
|
-
videoRecorder.start(1000);
|
|
13454
|
-
setTimeout(function () {
|
|
13455
|
-
var _a;
|
|
13456
|
-
if (((_a = getVideoRecorder()) === null || _a === void 0 ? void 0 : _a.state) === 'inactive') {
|
|
13457
|
-
log('media recorder is inactive!');
|
|
13458
|
-
// TODO: figure out what to do here
|
|
13459
|
-
}
|
|
13460
|
-
}, 100);
|
|
13461
|
-
}, [getVideoStream]);
|
|
13462
|
-
var startRecordingAudio = React.useCallback(function () {
|
|
13463
|
-
if (mergeAVStreams) return;
|
|
13464
|
-
if (!audioStream) return;
|
|
13465
13502
|
clearAudioChunks();
|
|
13466
|
-
|
|
13467
|
-
setAudioRecordingStopped(false);
|
|
13468
|
-
setAudioRecordingIntentionallyStopped(false);
|
|
13469
|
-
var audioRecorder = new MediaRecorder(audioStream, {
|
|
13470
|
-
audioBitsPerSecond: 32000
|
|
13471
|
-
});
|
|
13472
|
-
setAudioRecorder(audioRecorder);
|
|
13473
|
-
audioRecorder.ondataavailable = function (e) {
|
|
13474
|
-
audioChunks.push(e.data);
|
|
13475
|
-
};
|
|
13476
|
-
audioRecorder.onstop = function () {
|
|
13477
|
-
setAudioRecordingStopped(true);
|
|
13478
|
-
};
|
|
13479
|
-
audioRecorder.start(1000);
|
|
13480
|
-
}, [audioStream, mergeAVStreams]);
|
|
13481
|
-
var stopRecordingVideo = React.useCallback(function () {
|
|
13482
|
-
setVideoRecordingIntentionallyStopped(true);
|
|
13483
|
-
if ((videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.state) !== 'inactive') {
|
|
13484
|
-
videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
|
|
13485
|
-
}
|
|
13486
|
-
}, []);
|
|
13487
|
-
var stopRecordingAudio = React.useCallback(function () {
|
|
13488
|
-
setAudioRecordingIntentionallyStopped(true);
|
|
13489
|
-
if ((audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.state) !== 'inactive') {
|
|
13490
|
-
audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
|
|
13491
|
-
}
|
|
13503
|
+
setAudioRecorder(null);
|
|
13492
13504
|
}, []);
|
|
13505
|
+
var _a = useVideoRecorderStore(),
|
|
13506
|
+
videoUrl = _a.videoUrl,
|
|
13507
|
+
audioUrl = _a.audioUrl,
|
|
13508
|
+
isRecordingVideo = _a.isRecordingVideo,
|
|
13509
|
+
isRecordingAudio = _a.isRecordingAudio,
|
|
13510
|
+
videoRecordingStopped = _a.videoRecordingStopped,
|
|
13511
|
+
videoRecordingIntentionallyStopped = _a.videoRecordingIntentionallyStopped,
|
|
13512
|
+
audioRecordingStopped = _a.audioRecordingStopped,
|
|
13513
|
+
audioRecordingIntentionallyStopped = _a.audioRecordingIntentionallyStopped;
|
|
13493
13514
|
React.useEffect(function () {
|
|
13494
13515
|
if (videoRecordingStopped && videoRecordingIntentionallyStopped) {
|
|
13495
13516
|
processVideo();
|
|
@@ -13500,25 +13521,16 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
|
|
|
13500
13521
|
processAudio();
|
|
13501
13522
|
}
|
|
13502
13523
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, processAudio]);
|
|
13503
|
-
var clearRecordedData = React.useCallback(function () {
|
|
13504
|
-
clearVideoChunks();
|
|
13505
|
-
clearAudioChunks();
|
|
13506
|
-
}, []);
|
|
13507
13524
|
return React.useMemo(function () {
|
|
13508
13525
|
return {
|
|
13509
13526
|
isRecordingVideo: isRecordingVideo,
|
|
13510
13527
|
isRecordingAudio: isRecordingAudio,
|
|
13511
|
-
startRecordingVideo: startRecordingVideo,
|
|
13512
|
-
startRecordingAudio: startRecordingAudio,
|
|
13513
|
-
stopRecordingVideo: stopRecordingVideo,
|
|
13514
|
-
stopRecordingAudio: stopRecordingAudio,
|
|
13515
|
-
clearRecordedData: clearRecordedData,
|
|
13516
13528
|
videoRecordingUnintentionallyStopped: videoRecordingStopped && !videoRecordingIntentionallyStopped,
|
|
13517
13529
|
audioRecordingUnintentionallyStopped: audioRecordingStopped && !audioRecordingIntentionallyStopped,
|
|
13518
13530
|
videoUrl: videoUrl,
|
|
13519
13531
|
audioUrl: audioUrl
|
|
13520
13532
|
};
|
|
13521
|
-
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl,
|
|
13533
|
+
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, isRecordingAudio, isRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
13522
13534
|
};
|
|
13523
13535
|
|
|
13524
13536
|
var signatureRecorder = null;
|
|
@@ -13532,25 +13544,6 @@ var signatureChunks = [];
|
|
|
13532
13544
|
var clearSignatureChunks = function clearSignatureChunks() {
|
|
13533
13545
|
return signatureChunks = [];
|
|
13534
13546
|
};
|
|
13535
|
-
var recordingLock = false;
|
|
13536
|
-
var setRecordingLock = function setRecordingLock(lock) {
|
|
13537
|
-
return recordingLock = lock;
|
|
13538
|
-
};
|
|
13539
|
-
var recordingLockEngaged = function recordingLockEngaged() {
|
|
13540
|
-
return recordingLock;
|
|
13541
|
-
};
|
|
13542
|
-
function waitForCanvasAvailable(canvasRef) {
|
|
13543
|
-
if (canvasRef.current) return Promise.resolve(null);
|
|
13544
|
-
return new Promise(function (resolve) {
|
|
13545
|
-
var interval = setInterval(function () {
|
|
13546
|
-
log('VideoSignatureContext: waiting for output canvas');
|
|
13547
|
-
if (canvasRef.current) {
|
|
13548
|
-
clearInterval(interval);
|
|
13549
|
-
resolve(null);
|
|
13550
|
-
}
|
|
13551
|
-
}, 100);
|
|
13552
|
-
});
|
|
13553
|
-
}
|
|
13554
13547
|
var videoSignatureInitialState = {
|
|
13555
13548
|
startRecording: function startRecording() {
|
|
13556
13549
|
return null;
|
|
@@ -13562,10 +13555,16 @@ var videoSignatureInitialState = {
|
|
|
13562
13555
|
return null;
|
|
13563
13556
|
},
|
|
13564
13557
|
isRecording: false,
|
|
13558
|
+
signaturePad: {
|
|
13559
|
+
current: null
|
|
13560
|
+
},
|
|
13565
13561
|
signatureData: null,
|
|
13566
13562
|
signatureDataUrl: null,
|
|
13567
13563
|
signatureVideoData: null,
|
|
13568
13564
|
signatureVideoUrl: null,
|
|
13565
|
+
outputCanvas: {
|
|
13566
|
+
current: null
|
|
13567
|
+
},
|
|
13569
13568
|
onAcceptClicked: function onAcceptClicked() {
|
|
13570
13569
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
13571
13570
|
return __generator(this, function (_a) {
|
|
@@ -13574,72 +13573,24 @@ var videoSignatureInitialState = {
|
|
|
13574
13573
|
});
|
|
13575
13574
|
}
|
|
13576
13575
|
};
|
|
13577
|
-
var
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
var _b, _c;
|
|
13581
|
-
var children = _a.children,
|
|
13582
|
-
_d = _a.captureAudio,
|
|
13583
|
-
captureAudio = _d === void 0 ? false : _d;
|
|
13584
|
-
var signaturePad = React.useRef(null);
|
|
13585
|
-
var _e = React.useState(null),
|
|
13586
|
-
signatureData = _e[0],
|
|
13587
|
-
setSignatureData = _e[1];
|
|
13588
|
-
var _f = React.useState(null),
|
|
13589
|
-
signatureDataUrl = _f[0],
|
|
13590
|
-
setSignatureDataUrl = _f[1];
|
|
13591
|
-
var _g = React.useState(null),
|
|
13592
|
-
signatureVideoData = _g[0],
|
|
13593
|
-
setSignatureVideoData = _g[1];
|
|
13594
|
-
var _h = React.useState(null),
|
|
13595
|
-
signatureVideoUrl = _h[0],
|
|
13596
|
-
setSignatureVideoUrl = _h[1];
|
|
13597
|
-
var _j = useCameraStore(),
|
|
13598
|
-
camera = _j.camera,
|
|
13599
|
-
videoRef = _j.videoRef,
|
|
13600
|
-
audioStream = _j.audioStream;
|
|
13601
|
-
var _k = useVideoRecorder(camera, audioStream, captureAudio),
|
|
13602
|
-
isRecordingVideo = _k.isRecordingVideo,
|
|
13603
|
-
startRecordingVideo = _k.startRecordingVideo,
|
|
13604
|
-
stopRecordingVideo = _k.stopRecordingVideo,
|
|
13605
|
-
startRecordingAudio = _k.startRecordingAudio,
|
|
13606
|
-
stopRecordingAudio = _k.stopRecordingAudio,
|
|
13607
|
-
clearRecordedVideoData = _k.clearRecordedData;
|
|
13608
|
-
var outputCanvas = React.useRef(null);
|
|
13609
|
-
var onRecordingStopped = React.useRef(function () {});
|
|
13610
|
-
var _l = React.useState(false),
|
|
13611
|
-
isRecording = _l[0],
|
|
13612
|
-
setIsRecording = _l[1];
|
|
13613
|
-
var startRecording = React.useCallback(function () {
|
|
13614
|
-
return setIsRecording(true);
|
|
13615
|
-
}, []);
|
|
13616
|
-
var stopRecording = React.useCallback(function () {
|
|
13617
|
-
return setIsRecording(false);
|
|
13618
|
-
}, []);
|
|
13619
|
-
var clearRecordedData = React.useCallback(function () {
|
|
13620
|
-
var _a;
|
|
13621
|
-
onRecordingStopped.current = function () {
|
|
13622
|
-
setSignatureVideoUrl(null);
|
|
13623
|
-
setSignatureVideoData(null);
|
|
13624
|
-
setIsRecording(true);
|
|
13625
|
-
onRecordingStopped.current = function () {};
|
|
13626
|
-
};
|
|
13627
|
-
setRecordingLock(false);
|
|
13628
|
-
setIsRecording(false);
|
|
13629
|
-
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
13630
|
-
setSignatureRecorder(null);
|
|
13631
|
-
}, []);
|
|
13632
|
-
React.useEffect(function () {
|
|
13633
|
-
if (!isRecording) return;
|
|
13634
|
-
if (recordingLockEngaged()) return;
|
|
13635
|
-
setRecordingLock(true);
|
|
13636
|
-
waitForCanvasAvailable(outputCanvas).then(function () {
|
|
13576
|
+
var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set, get) {
|
|
13577
|
+
return _assign(_assign({}, videoSignatureInitialState), {
|
|
13578
|
+
startRecording: function startRecording(camera, audioStream, captureAudio) {
|
|
13637
13579
|
var _a;
|
|
13580
|
+
if (captureAudio === void 0) {
|
|
13581
|
+
captureAudio = false;
|
|
13582
|
+
}
|
|
13583
|
+
set({
|
|
13584
|
+
isRecording: true
|
|
13585
|
+
});
|
|
13638
13586
|
clearSignatureChunks();
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
|
|
13587
|
+
useVideoRecorderStore.getState().clearRecordedData();
|
|
13588
|
+
var _b = useVideoRecorderStore.getState(),
|
|
13589
|
+
startRecordingVideo = _b.startRecordingVideo,
|
|
13590
|
+
startRecordingAudio = _b.startRecordingAudio;
|
|
13591
|
+
startRecordingVideo(camera, audioStream);
|
|
13592
|
+
if (captureAudio) startRecordingAudio(audioStream);
|
|
13593
|
+
var stream = get().outputCanvas.current.captureStream(24 /* fps */);
|
|
13643
13594
|
var tracks = [stream.getVideoTracks()[0]];
|
|
13644
13595
|
var audioTrack = (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks()) === null || _a === void 0 ? void 0 : _a[0];
|
|
13645
13596
|
if (audioTrack) tracks.push(audioTrack);
|
|
@@ -13651,111 +13602,122 @@ function VideoSignatureContextProvider(_a) {
|
|
|
13651
13602
|
signatureRecorder.ondataavailable = function (event) {
|
|
13652
13603
|
signatureChunks.push(event.data);
|
|
13653
13604
|
};
|
|
13605
|
+
signatureRecorder.start(1000);
|
|
13606
|
+
},
|
|
13607
|
+
stopRecording: function stopRecording() {
|
|
13608
|
+
set({
|
|
13609
|
+
isRecording: false
|
|
13610
|
+
});
|
|
13611
|
+
if (!signatureRecorder) return;
|
|
13612
|
+
signatureRecorder.stop();
|
|
13654
13613
|
signatureRecorder.onstop = function () {
|
|
13655
13614
|
log('VideoSignatureContext: onstop');
|
|
13656
13615
|
var blob = new Blob(signatureChunks, {
|
|
13657
13616
|
type: 'video/mp4'
|
|
13658
13617
|
});
|
|
13659
|
-
|
|
13660
|
-
|
|
13618
|
+
useVideoSignatureStore.setState({
|
|
13619
|
+
signatureVideoData: blob,
|
|
13620
|
+
signatureVideoUrl: URL.createObjectURL(blob)
|
|
13621
|
+
});
|
|
13661
13622
|
clearSignatureChunks();
|
|
13662
13623
|
setSignatureRecorder(null);
|
|
13663
|
-
onRecordingStopped.current();
|
|
13664
13624
|
};
|
|
13665
|
-
|
|
13625
|
+
useVideoRecorderStore.getState().stopRecording();
|
|
13626
|
+
},
|
|
13627
|
+
clearRecordedData: function clearRecordedData() {
|
|
13628
|
+
var _a;
|
|
13629
|
+
clearSignatureChunks();
|
|
13630
|
+
useVideoRecorderStore.getState().stopRecordingVideo();
|
|
13631
|
+
useVideoRecorderStore.getState().clearRecordedData();
|
|
13632
|
+
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
13633
|
+
setSignatureRecorder(null);
|
|
13634
|
+
set({
|
|
13635
|
+
isRecording: false,
|
|
13636
|
+
signatureVideoData: null,
|
|
13637
|
+
signatureVideoUrl: null
|
|
13638
|
+
});
|
|
13639
|
+
}
|
|
13640
|
+
});
|
|
13641
|
+
}));
|
|
13642
|
+
function VideoSignatureContextProvider(_a) {
|
|
13643
|
+
var _b, _c;
|
|
13644
|
+
var children = _a.children,
|
|
13645
|
+
_d = _a.captureAudio,
|
|
13646
|
+
captureAudio = _d === void 0 ? false : _d;
|
|
13647
|
+
var _e = useCameraStore(),
|
|
13648
|
+
camera = _e.camera,
|
|
13649
|
+
videoRef = _e.videoRef;
|
|
13650
|
+
var isRecordingVideo = useVideoRecorder(captureAudio).isRecordingVideo;
|
|
13651
|
+
var outputCanvas = React.useRef(null);
|
|
13652
|
+
React.useEffect(function () {
|
|
13653
|
+
return useVideoSignatureStore.setState({
|
|
13654
|
+
outputCanvas: outputCanvas
|
|
13666
13655
|
});
|
|
13667
|
-
}, [
|
|
13656
|
+
}, []);
|
|
13657
|
+
var isRecording = useVideoSignatureStore().isRecording;
|
|
13658
|
+
// useEffect(() => {
|
|
13659
|
+
// if (!isRecording || !camera) return
|
|
13660
|
+
// waitForCanvasAvailable(outputCanvas).then(() => {
|
|
13661
|
+
// log('VideoSignatureContext: starting recording...')
|
|
13662
|
+
// clearSignatureChunks()
|
|
13663
|
+
// const { startRecordingVideo, startRecordingAudio } =
|
|
13664
|
+
// useVideoRecorderStore.getState()
|
|
13665
|
+
// startRecordingVideo(camera, audioStream)
|
|
13666
|
+
// if (captureAudio) startRecordingAudio(audioStream)
|
|
13667
|
+
// const stream = outputCanvas.current!.captureStream(24 /* fps */)
|
|
13668
|
+
// const tracks = [stream.getVideoTracks()[0]]
|
|
13669
|
+
// const audioTrack = audioStream?.getAudioTracks()?.[0]
|
|
13670
|
+
// if (audioTrack) tracks.push(audioTrack)
|
|
13671
|
+
// const signatureRecorder = new MediaRecorder(new MediaStream(tracks), {
|
|
13672
|
+
// videoBitsPerSecond: 270000,
|
|
13673
|
+
// audioBitsPerSecond: 32000,
|
|
13674
|
+
// })
|
|
13675
|
+
// setSignatureRecorder(signatureRecorder)
|
|
13676
|
+
// signatureRecorder.ondataavailable = (event) => {
|
|
13677
|
+
// signatureChunks.push(event.data)
|
|
13678
|
+
// }
|
|
13679
|
+
// signatureRecorder.start(1000)
|
|
13680
|
+
// })
|
|
13681
|
+
// }, [audioStream, captureAudio, isRecording, camera])
|
|
13668
13682
|
var animationFrame = React.useRef(0);
|
|
13669
13683
|
React.useEffect(function () {
|
|
13670
|
-
if (!
|
|
13684
|
+
if (!videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
|
|
13671
13685
|
var ctx = outputCanvas.current.getContext('2d');
|
|
13672
13686
|
if (!ctx) return;
|
|
13687
|
+
var signaturePad = useVideoSignatureStore.getState().signaturePad;
|
|
13673
13688
|
animationFrame.current = requestAnimationFrame(function runFrame() {
|
|
13674
|
-
|
|
13675
|
-
|
|
13676
|
-
return
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
animationFrame.current = requestAnimationFrame(runFrame);
|
|
13693
|
-
return [2 /*return*/];
|
|
13694
|
-
});
|
|
13695
|
-
});
|
|
13689
|
+
if (!signaturePad.current || !videoRef.current || !outputCanvas.current) {
|
|
13690
|
+
cancelAnimationFrame(animationFrame.current);
|
|
13691
|
+
return;
|
|
13692
|
+
}
|
|
13693
|
+
var _a = [videoRef.current.videoWidth, videoRef.current.videoHeight],
|
|
13694
|
+
w = _a[0],
|
|
13695
|
+
h = _a[1];
|
|
13696
|
+
var isPortrait = w < h;
|
|
13697
|
+
outputCanvas.current.width = w;
|
|
13698
|
+
outputCanvas.current.height = h;
|
|
13699
|
+
var rect = [w * (isPortrait ? 0.02 : 0.15), h * (isPortrait ? 0.15 : 0.25), w * (isPortrait ? 0.96 : 0.7), h * (isPortrait ? 0.7 : 0.5)];
|
|
13700
|
+
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
13701
|
+
ctx.beginPath();
|
|
13702
|
+
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
|
13703
|
+
ctx.roundRect.apply(ctx, __spreadArray(__spreadArray([], rect, false), [16], false));
|
|
13704
|
+
ctx.fill();
|
|
13705
|
+
ctx.drawImage.apply(ctx, __spreadArray([signaturePad.current.getCanvas()], rect, false));
|
|
13706
|
+
animationFrame.current = requestAnimationFrame(runFrame);
|
|
13696
13707
|
});
|
|
13697
13708
|
return function () {
|
|
13698
|
-
cancelAnimationFrame(animationFrame.current);
|
|
13709
|
+
return cancelAnimationFrame(animationFrame.current);
|
|
13699
13710
|
};
|
|
13700
13711
|
}, [camera, isRecording, isRecordingVideo, videoRef]);
|
|
13701
|
-
|
|
13702
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
13703
|
-
var signatureData, imageUrl;
|
|
13704
|
-
var _a;
|
|
13705
|
-
return __generator(this, function (_b) {
|
|
13706
|
-
switch (_b.label) {
|
|
13707
|
-
case 0:
|
|
13708
|
-
log('VideoSignatureContext: onAcceptClicked');
|
|
13709
|
-
if (!signaturePad.current) return [2 /*return*/];
|
|
13710
|
-
log('VideoSignatureContext: building signature data...');
|
|
13711
|
-
signatureData = buildSignatureData(signaturePad.current);
|
|
13712
|
-
log('VideoSignatureContext: exporting signature image...');
|
|
13713
|
-
return [4 /*yield*/, exportSignatureImage(signaturePad.current)];
|
|
13714
|
-
case 1:
|
|
13715
|
-
imageUrl = _b.sent();
|
|
13716
|
-
if (imageUrl) signatureData.fileContent = dataUrlToBase64Sync(imageUrl);
|
|
13717
|
-
log('VideoSignatureContext: setting signature data url...');
|
|
13718
|
-
setSignatureDataUrl(imageUrl);
|
|
13719
|
-
setSignatureData(signatureData);
|
|
13720
|
-
log('VideoSignatureContext: stopping recording...');
|
|
13721
|
-
stopRecordingVideo();
|
|
13722
|
-
stopRecordingAudio();
|
|
13723
|
-
log('VideoSignatureContext: stopping signature recorder...');
|
|
13724
|
-
(_a = getSignatureRecorder()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
13725
|
-
return [2 /*return*/];
|
|
13726
|
-
}
|
|
13727
|
-
});
|
|
13728
|
-
});
|
|
13729
|
-
}, [stopRecordingAudio, stopRecordingVideo]);
|
|
13730
|
-
var value = React.useMemo(function () {
|
|
13731
|
-
return {
|
|
13732
|
-
isRecording: isRecording,
|
|
13733
|
-
startRecording: startRecording,
|
|
13734
|
-
stopRecording: stopRecording,
|
|
13735
|
-
clearRecordedData: clearRecordedData,
|
|
13736
|
-
signaturePad: signaturePad,
|
|
13737
|
-
signatureData: signatureData,
|
|
13738
|
-
signatureDataUrl: signatureDataUrl,
|
|
13739
|
-
signatureVideoData: signatureVideoData,
|
|
13740
|
-
signatureVideoUrl: signatureVideoUrl,
|
|
13741
|
-
onAcceptClicked: onAcceptClicked
|
|
13742
|
-
};
|
|
13743
|
-
}, [clearRecordedData, isRecording, onAcceptClicked, signatureData, signatureDataUrl, signatureVideoData, signatureVideoUrl, startRecording, stopRecording]);
|
|
13744
|
-
return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureContext.Provider, {
|
|
13745
|
-
value: value
|
|
13746
|
-
}, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
13712
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
13747
13713
|
ref: outputCanvas,
|
|
13748
13714
|
width: (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth,
|
|
13749
13715
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
13750
13716
|
}));
|
|
13751
13717
|
}
|
|
13752
|
-
function useVideoSignatureContext() {
|
|
13753
|
-
var ctx = React.useContext(VideoSignatureContext);
|
|
13754
|
-
if (!ctx) throw new Error('useVideoSignatureContext cannot be used without ContextProvider');
|
|
13755
|
-
return ctx;
|
|
13756
|
-
}
|
|
13757
13718
|
|
|
13758
13719
|
function VideoSignatureGuides(_a) {
|
|
13720
|
+
var _this = this;
|
|
13759
13721
|
var _b = _a.requestedAction,
|
|
13760
13722
|
requestedAction = _b === void 0 ? 'VERIFY_LIVENESS' : _b,
|
|
13761
13723
|
_c = _a.faceGuideStatus,
|
|
@@ -13775,15 +13737,18 @@ function VideoSignatureGuides(_a) {
|
|
|
13775
13737
|
ref = _h.ref,
|
|
13776
13738
|
width = _h.width,
|
|
13777
13739
|
height = _h.height;
|
|
13778
|
-
var
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
|
|
13740
|
+
var signaturePad = React.useRef(null);
|
|
13741
|
+
var _j = React.useState(true),
|
|
13742
|
+
signaturePadEmpty = _j[0],
|
|
13743
|
+
setSignaturePadEmpty = _j[1];
|
|
13744
|
+
var _k = React.useState(false),
|
|
13745
|
+
signatureValid = _k[0],
|
|
13746
|
+
setSignatureValid = _k[1];
|
|
13747
|
+
React.useEffect(function () {
|
|
13748
|
+
return useVideoSignatureStore.setState({
|
|
13749
|
+
signaturePad: signaturePad
|
|
13750
|
+
});
|
|
13751
|
+
}, []);
|
|
13787
13752
|
var verbiage = useTranslations(rawVerbiage, {
|
|
13788
13753
|
signaturePadEmptyText: '',
|
|
13789
13754
|
headTrackingUnsatisfiedText: '',
|
|
@@ -13800,13 +13765,41 @@ function VideoSignatureGuides(_a) {
|
|
|
13800
13765
|
var isSigning = requestedAction === 'CAPTURE_SIGNATURE';
|
|
13801
13766
|
var canClear = isSigning && !signaturePadEmpty;
|
|
13802
13767
|
var canSubmit = isSigning && signatureValid && headTrackingSatisfied;
|
|
13803
|
-
var
|
|
13804
|
-
emptyContentDismissed =
|
|
13805
|
-
setEmptyContentDismissed =
|
|
13768
|
+
var _l = React.useState(false),
|
|
13769
|
+
emptyContentDismissed = _l[0],
|
|
13770
|
+
setEmptyContentDismissed = _l[1];
|
|
13806
13771
|
var displayEmptyState = requestedAction === 'CAPTURE_SIGNATURE' && signaturePadEmpty && !emptyContentDismissed;
|
|
13807
13772
|
React.useEffect(function () {
|
|
13808
13773
|
if (signaturePadEmpty) setEmptyContentDismissed(false);
|
|
13809
13774
|
}, [signaturePadEmpty]);
|
|
13775
|
+
var onAcceptClicked = React.useCallback(function () {
|
|
13776
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
13777
|
+
var signatureData, imageUrl;
|
|
13778
|
+
return __generator(this, function (_a) {
|
|
13779
|
+
switch (_a.label) {
|
|
13780
|
+
case 0:
|
|
13781
|
+
log('VideoSignatureContext: onAcceptClicked');
|
|
13782
|
+
if (!signaturePad.current) return [2 /*return*/];
|
|
13783
|
+
log('VideoSignatureContext: building signature data...');
|
|
13784
|
+
signatureData = buildSignatureData(signaturePad.current);
|
|
13785
|
+
log('VideoSignatureContext: exporting signature image...', signatureData);
|
|
13786
|
+
return [4 /*yield*/, exportSignatureImage(signaturePad.current)];
|
|
13787
|
+
case 1:
|
|
13788
|
+
imageUrl = _a.sent();
|
|
13789
|
+
if (imageUrl) signatureData.fileContent = dataUrlToBase64Sync(imageUrl);
|
|
13790
|
+
log('VideoSignatureContext: setting signature data url...', imageUrl);
|
|
13791
|
+
useVideoSignatureStore.setState({
|
|
13792
|
+
signatureData: signatureData,
|
|
13793
|
+
signatureDataUrl: imageUrl
|
|
13794
|
+
});
|
|
13795
|
+
log('VideoSignatureContext: stopping signature recorder...');
|
|
13796
|
+
// getSignatureRecorder()?.stop()
|
|
13797
|
+
useVideoSignatureStore.getState().stopRecording();
|
|
13798
|
+
return [2 /*return*/];
|
|
13799
|
+
}
|
|
13800
|
+
});
|
|
13801
|
+
});
|
|
13802
|
+
}, []);
|
|
13810
13803
|
return /*#__PURE__*/React__namespace.default.createElement(Container$3, {
|
|
13811
13804
|
className: classNames.container
|
|
13812
13805
|
}, /*#__PURE__*/React__namespace.default.createElement(Inner$1, {
|
|
@@ -13909,40 +13902,45 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
13909
13902
|
minSignaturePadPoints = _c === void 0 ? DEFAULT_MIN_SIGNATURE_PAD_POINTS : _c,
|
|
13910
13903
|
_d = _a.headTrackingBoundaryPercentage,
|
|
13911
13904
|
headTrackingBoundaryPercentage = _d === void 0 ? DEFAULT_HEAD_TRACKING_BOUNDARY_PERCENTAGE : _d,
|
|
13912
|
-
_e = _a.
|
|
13913
|
-
|
|
13914
|
-
_f = _a.
|
|
13915
|
-
|
|
13916
|
-
_g = _a.
|
|
13917
|
-
|
|
13918
|
-
_h = _a.
|
|
13919
|
-
|
|
13920
|
-
|
|
13905
|
+
_e = _a.captureAudio,
|
|
13906
|
+
captureAudio = _e === void 0 ? false : _e,
|
|
13907
|
+
_f = _a.classNames,
|
|
13908
|
+
classNames = _f === void 0 ? {} : _f,
|
|
13909
|
+
_g = _a.colors,
|
|
13910
|
+
colors = _g === void 0 ? {} : _g,
|
|
13911
|
+
_h = _a.verbiage,
|
|
13912
|
+
rawVerbiage = _h === void 0 ? {} : _h,
|
|
13913
|
+
_j = _a.debugMode,
|
|
13914
|
+
debugMode = _j === void 0 ? false : _j;
|
|
13915
|
+
var _k = useCameraStore(shallow.useShallow(function (state) {
|
|
13921
13916
|
return {
|
|
13922
13917
|
camera: state.camera,
|
|
13918
|
+
audioStream: state.audioStream,
|
|
13923
13919
|
videoWidth: state.videoWidth,
|
|
13924
13920
|
videoHeight: state.videoHeight
|
|
13925
13921
|
};
|
|
13926
13922
|
})),
|
|
13927
|
-
camera =
|
|
13928
|
-
|
|
13929
|
-
|
|
13930
|
-
|
|
13931
|
-
|
|
13932
|
-
|
|
13933
|
-
|
|
13934
|
-
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13923
|
+
camera = _k.camera,
|
|
13924
|
+
audioStream = _k.audioStream,
|
|
13925
|
+
videoWidth = _k.videoWidth,
|
|
13926
|
+
videoHeight = _k.videoHeight;
|
|
13927
|
+
var _l = useSelfieGuidanceModelsContext(),
|
|
13928
|
+
onPredictionMade = _l.onPredictionMade,
|
|
13929
|
+
startHeadTracking = _l.start,
|
|
13930
|
+
stopHeadTracking = _l.stop;
|
|
13931
|
+
var _m = useVideoSignatureStore(),
|
|
13932
|
+
signatureData = _m.signatureData,
|
|
13933
|
+
signatureDataUrl = _m.signatureDataUrl,
|
|
13934
|
+
signatureVideoData = _m.signatureVideoData,
|
|
13935
|
+
startRecording = _m.startRecording,
|
|
13936
|
+
stopRecording = _m.stopRecording,
|
|
13937
|
+
clearRecordedData = _m.clearRecordedData,
|
|
13938
|
+
isRecording = _m.isRecording;
|
|
13942
13939
|
React.useEffect(function () {
|
|
13943
|
-
|
|
13940
|
+
if (!camera) return;
|
|
13941
|
+
startRecording(camera, audioStream, captureAudio);
|
|
13944
13942
|
return stopRecording;
|
|
13945
|
-
}, [startRecording, stopRecording]);
|
|
13943
|
+
}, [audioStream, camera, captureAudio, startRecording, stopRecording]);
|
|
13946
13944
|
React.useEffect(function () {
|
|
13947
13945
|
setTimeout(startHeadTracking, 1);
|
|
13948
13946
|
return stopHeadTracking;
|
|
@@ -13957,15 +13955,15 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
13957
13955
|
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
|
|
13958
13956
|
}
|
|
13959
13957
|
}, [onVideoCaptured, signatureData, signatureDataUrl, signatureVideoData]);
|
|
13960
|
-
var
|
|
13961
|
-
headTrackingSatisfied =
|
|
13962
|
-
setHeadTrackingSatisfied =
|
|
13963
|
-
var
|
|
13964
|
-
lastFace =
|
|
13965
|
-
setLastFace =
|
|
13966
|
-
var
|
|
13967
|
-
numFramesWithoutFaces =
|
|
13968
|
-
setNumFramesWithoutFaces =
|
|
13958
|
+
var _o = React.useState(true),
|
|
13959
|
+
headTrackingSatisfied = _o[0],
|
|
13960
|
+
setHeadTrackingSatisfied = _o[1];
|
|
13961
|
+
var _p = React.useState(null),
|
|
13962
|
+
lastFace = _p[0],
|
|
13963
|
+
setLastFace = _p[1];
|
|
13964
|
+
var _q = React.useState(0),
|
|
13965
|
+
numFramesWithoutFaces = _q[0],
|
|
13966
|
+
setNumFramesWithoutFaces = _q[1];
|
|
13969
13967
|
onPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
|
|
13970
13968
|
var face = _a.face;
|
|
13971
13969
|
if (!camera) return;
|
|
@@ -13976,12 +13974,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
13976
13974
|
return n + 1;
|
|
13977
13975
|
});
|
|
13978
13976
|
}, [camera, headTrackingBoundaryPercentage, videoHeight, videoWidth]), 16));
|
|
13979
|
-
var
|
|
13980
|
-
ref =
|
|
13981
|
-
|
|
13982
|
-
width =
|
|
13983
|
-
|
|
13984
|
-
height =
|
|
13977
|
+
var _r = useResizeObserver(),
|
|
13978
|
+
ref = _r.ref,
|
|
13979
|
+
_s = _r.width,
|
|
13980
|
+
width = _s === void 0 ? 1 : _s,
|
|
13981
|
+
_t = _r.height,
|
|
13982
|
+
height = _t === void 0 ? 1 : _t;
|
|
13985
13983
|
var debugScalingDetails = useDebugScalingDetails({
|
|
13986
13984
|
enabled: debugMode,
|
|
13987
13985
|
pageWidth: width,
|
|
@@ -14198,6 +14196,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14198
14196
|
return n + 1;
|
|
14199
14197
|
});
|
|
14200
14198
|
setCaptureState('CHECKING_LIVENESS');
|
|
14199
|
+
useVideoSignatureStore.getState().clearRecordedData();
|
|
14201
14200
|
}, [onRetryClicked]);
|
|
14202
14201
|
var onExitSignatureCapture = React.useCallback(function () {
|
|
14203
14202
|
setAttempt(function (n) {
|
|
@@ -14219,9 +14218,10 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14219
14218
|
return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizardGuides, _assign({}, props, {
|
|
14220
14219
|
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.guides,
|
|
14221
14220
|
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.guides,
|
|
14222
|
-
restartVideoOnSignaturePadCleared: restartVideoOnSignaturePadCleared
|
|
14221
|
+
restartVideoOnSignaturePadCleared: restartVideoOnSignaturePadCleared,
|
|
14222
|
+
captureAudio: captureAudio
|
|
14223
14223
|
}));
|
|
14224
|
-
}, [classNames === null || classNames === void 0 ? void 0 : classNames.guides, restartVideoOnSignaturePadCleared, verbiage === null || verbiage === void 0 ? void 0 : verbiage.guides]);
|
|
14224
|
+
}, [captureAudio, classNames === null || classNames === void 0 ? void 0 : classNames.guides, restartVideoOnSignaturePadCleared, verbiage === null || verbiage === void 0 ? void 0 : verbiage.guides]);
|
|
14225
14225
|
var onExitAfterFailureProp = faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onExitAfterFailure;
|
|
14226
14226
|
var onExitAfterFailure = React.useCallback(function (resp, req) {
|
|
14227
14227
|
onExitAfterFailureProp === null || onExitAfterFailureProp === void 0 ? void 0 : onExitAfterFailureProp(resp, req);
|
|
@@ -14273,6 +14273,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14273
14273
|
headTrackingBoundaryPercentage: headTrackingBoundaryPercentage,
|
|
14274
14274
|
restartVideoOnSignaturePadCleared: restartVideoOnSignaturePadCleared,
|
|
14275
14275
|
guidesComponent: guidesComponent,
|
|
14276
|
+
captureAudio: captureAudio,
|
|
14276
14277
|
classNames: classNames,
|
|
14277
14278
|
colors: colors,
|
|
14278
14279
|
verbiage: verbiage,
|
|
@@ -14297,14 +14298,25 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
14297
14298
|
var status = _a.status,
|
|
14298
14299
|
_b = _a.restartVideoOnSignaturePadCleared,
|
|
14299
14300
|
restartVideoOnSignaturePadCleared = _b === void 0 ? true : _b,
|
|
14300
|
-
|
|
14301
|
-
|
|
14301
|
+
_c = _a.captureAudio,
|
|
14302
|
+
captureAudio = _c === void 0 ? false : _c,
|
|
14303
|
+
props = __rest(_a, ["status", "restartVideoOnSignaturePadCleared", "captureAudio"]);
|
|
14304
|
+
var _d = useCameraStore(),
|
|
14305
|
+
camera = _d.camera,
|
|
14306
|
+
audioStream = _d.audioStream;
|
|
14307
|
+
function onClear() {
|
|
14308
|
+
if (!restartVideoOnSignaturePadCleared) return;
|
|
14309
|
+
setTimeout(function () {
|
|
14310
|
+
useVideoSignatureStore.getState().clearRecordedData();
|
|
14311
|
+
setTimeout(function () {
|
|
14312
|
+
useVideoSignatureStore.getState().startRecording(camera, audioStream, captureAudio);
|
|
14313
|
+
}, 100);
|
|
14314
|
+
}, 100);
|
|
14315
|
+
}
|
|
14302
14316
|
return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureGuides, _assign({}, props, {
|
|
14303
14317
|
faceGuideStatus: status,
|
|
14304
|
-
|
|
14305
|
-
|
|
14306
|
-
return setTimeout(clearRecordedData, 100);
|
|
14307
|
-
} : undefined
|
|
14318
|
+
onClearSignaturePadClicked: onClear,
|
|
14319
|
+
requestedAction: status === 'success' ? 'CAPTURE_SIGNATURE' : 'VERIFY_LIVENESS'
|
|
14308
14320
|
}));
|
|
14309
14321
|
}
|
|
14310
14322
|
var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProviders(props) {
|
|
@@ -14687,12 +14699,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14687
14699
|
stopSelfieGuidance = _16.stop,
|
|
14688
14700
|
onSelfiePredictionMade = _16.onPredictionMade,
|
|
14689
14701
|
selfieModelError = _16.error;
|
|
14690
|
-
var _17 = useVideoRecorder(
|
|
14702
|
+
var _17 = useVideoRecorder(mergeAVStreams),
|
|
14691
14703
|
isRecordingVideo = _17.isRecordingVideo,
|
|
14692
|
-
startRecordingVideo = _17.startRecordingVideo,
|
|
14693
|
-
startRecordingAudio = _17.startRecordingAudio,
|
|
14694
|
-
stopRecordingVideo = _17.stopRecordingVideo,
|
|
14695
|
-
stopRecordingAudio = _17.stopRecordingAudio,
|
|
14696
14704
|
videoRecordingUnintentionallyStopped = _17.videoRecordingUnintentionallyStopped,
|
|
14697
14705
|
audioRecordingUnintentionallyStopped = _17.audioRecordingUnintentionallyStopped,
|
|
14698
14706
|
videoUrl = _17.videoUrl,
|
|
@@ -14702,8 +14710,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14702
14710
|
countdownRemaining = _18[0],
|
|
14703
14711
|
setCountdownRemaining = _18[1];
|
|
14704
14712
|
React.useEffect(function () {
|
|
14705
|
-
if (!isRecordingVideo && !videoUrl) {
|
|
14706
|
-
startRecordingVideo();
|
|
14713
|
+
if (camera && !isRecordingVideo && !videoUrl) {
|
|
14714
|
+
useVideoRecorderStore.getState().startRecordingVideo(camera, audioStream);
|
|
14707
14715
|
setVideoStartsAt(new Date());
|
|
14708
14716
|
}
|
|
14709
14717
|
// if the mergeAVStreams flag is present, the audio stream is on the video
|
|
@@ -14714,7 +14722,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14714
14722
|
releaseCameraAccess();
|
|
14715
14723
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
|
|
14716
14724
|
}
|
|
14717
|
-
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess,
|
|
14725
|
+
}, [audioStream, audioUrl, camera, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, videoUrl]);
|
|
14718
14726
|
React.useEffect(function () {
|
|
14719
14727
|
if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
|
|
14720
14728
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
@@ -14809,13 +14817,13 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14809
14817
|
var _a;
|
|
14810
14818
|
if (translatedText) {
|
|
14811
14819
|
setRequestedAction('READ_TEXT');
|
|
14812
|
-
startRecordingAudio();
|
|
14820
|
+
useVideoRecorderStore.getState().startRecordingAudio(audioStream);
|
|
14813
14821
|
setIdCaptureVideoAudioStartsAt(new Date().getTime() - ((_a = videoStartsAt === null || videoStartsAt === void 0 ? void 0 : videoStartsAt.getTime()) !== null && _a !== void 0 ? _a : 0));
|
|
14814
14822
|
setExpectedAudioText(translatedText);
|
|
14815
14823
|
} else {
|
|
14816
|
-
stopRecordingVideo();
|
|
14824
|
+
useVideoRecorderStore.getState().stopRecordingVideo();
|
|
14817
14825
|
}
|
|
14818
|
-
}, [setExpectedAudioText, setIdCaptureVideoAudioStartsAt,
|
|
14826
|
+
}, [audioStream, setExpectedAudioText, setIdCaptureVideoAudioStartsAt, translatedText, videoStartsAt]);
|
|
14819
14827
|
var frameWidth = (_c = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) !== null && _c !== void 0 ? _c : 0;
|
|
14820
14828
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
14821
14829
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
@@ -14885,9 +14893,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14885
14893
|
};
|
|
14886
14894
|
}, [isFlipping]);
|
|
14887
14895
|
var stopRecording = React.useCallback(function () {
|
|
14888
|
-
stopRecordingVideo();
|
|
14889
|
-
stopRecordingAudio();
|
|
14890
|
-
}, [
|
|
14896
|
+
useVideoRecorderStore.getState().stopRecordingVideo();
|
|
14897
|
+
useVideoRecorderStore.getState().stopRecordingAudio();
|
|
14898
|
+
}, []);
|
|
14891
14899
|
var satisfied = !isFlipping && goodFramesThresholdMet && faceCentered && delaySatisfied;
|
|
14892
14900
|
React.useEffect(function () {
|
|
14893
14901
|
if (satisfied && !countdownStartedAt) {
|
|
@@ -15289,6 +15297,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
15289
15297
|
return n + 1;
|
|
15290
15298
|
});
|
|
15291
15299
|
setCaptureState('CAPTURING_ID');
|
|
15300
|
+
useVideoRecorderStore.getState().clearRecordedData();
|
|
15292
15301
|
}, []);
|
|
15293
15302
|
var isCapturingId = !skipIdCapture && ['LOADING', 'CAPTURING_ID'].includes(captureState);
|
|
15294
15303
|
React.useEffect(function () {
|