idmission-web-sdk 1.1.0 → 1.1.1
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/README.md +1 -0
- package/dist/components/customer_flows/VideoIdValidation.d.ts +2 -0
- package/dist/components/video_id/IdVideoCapture.d.ts +2 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts +2 -1
- package/dist/lib/camera/useVideoRecorder.d.ts +1 -1
- package/dist/sdk2.cjs.development.js +166 -142
- 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 +166 -142
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +166 -142
- 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/stories/CustomerFlows/VideoIdValidation.stories.d.ts +7 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -716,6 +716,7 @@ Render a fullscreen capture component that performs IDValidation and FaceValidat
|
|
|
716
716
|
<tr><td><code>skipSuccessScreen</code> (optional)</td><td>boolean or async function to indicate whether to proceed automatically after capture guidance is satisfied. If an async function is supplied returning a boolean, it will be evaluated at the time of capture guidance satisfaction. Defaults to false.</td></tr>
|
|
717
717
|
<tr><td><code>skipIdCapture</code> (optional)</td><td>boolean to indicate whether to skip the initial ID capture flow. Note that when this flag is set, submission to IDmission's servers will not be attempted; it should be used in tandem with onSubmit. Defaults to false.</td></tr>
|
|
718
718
|
<tr><td><code>skipShowIdCardBack</code> (optional)</td><td>boolean or async function to indicate whether to instruct the user to show the back of their ID card during video capture. If an async function is supplied returning a boolean, it will be evaluated at the time of ID front video capture completion. Defaults to false.</td></tr>
|
|
719
|
+
<tr><td><code>mergeAVStreams</code> (optional)</td><td>boolean flag to indicate whether recorded audio should be merged onto the recorded video stream before submission. Defaults to false.</td></tr>
|
|
719
720
|
<tr><td><code>assets</code> (optional)</td><td>object containing any asset overrides, for available options consult the Assets table below.</td></tr>
|
|
720
721
|
<tr><td><code>colors</code> (optional)</td><td>object containing any asset overrides, for available options consult the Colors table below.</td></tr>
|
|
721
722
|
<tr><td><code>verbiage</code> (optional)</td><td>object containing any verbiage overrides, for available options consult the Verbiage table below.</td></tr>
|
|
@@ -131,6 +131,8 @@ export interface VideoIdValidationProps extends PropsWithChildren {
|
|
|
131
131
|
disableFaceDetectionWhileAudioCaptureMsDelay?: number;
|
|
132
132
|
/** Flag for suppressing fallback messaging - used when models fail to load */
|
|
133
133
|
silentFallback?: boolean;
|
|
134
|
+
/** Boolean flag to indicate whether recorded audio should be merged onto the recorded video stream before submission. Defaults to false. */
|
|
135
|
+
mergeAVStreams?: boolean;
|
|
134
136
|
/** Name of an included theme or object containing theme properties. **/
|
|
135
137
|
theme?: ThemeInput;
|
|
136
138
|
/** Object containing any asset overrides. */
|
|
@@ -52,10 +52,11 @@ export type IdVideoCaptureProps = {
|
|
|
52
52
|
readTextMinReadingMs?: number;
|
|
53
53
|
disableFaceDetectionWhileAudioCapture: boolean;
|
|
54
54
|
disableFaceDetectionWhileAudioCaptureMsDelay: number;
|
|
55
|
+
mergeAVStreams?: boolean;
|
|
55
56
|
assets?: IdVideoCaptureAssets;
|
|
56
57
|
classNames?: IdVideoCaptureClassNames;
|
|
57
58
|
colors?: IdVideoCaptureColors;
|
|
58
59
|
verbiage?: IdVideoCaptureVerbiage;
|
|
59
60
|
debugMode?: boolean;
|
|
60
61
|
};
|
|
61
|
-
export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, onRecordingFailed, idCaptureModelsEnabled, idCardFrontDelay, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, skipShowIdCardBack, captureCountdownSeconds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
|
|
62
|
+
export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, onRecordingFailed, idCaptureModelsEnabled, idCardFrontDelay, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, skipShowIdCardBack, captureCountdownSeconds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, mergeAVStreams, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
|
|
@@ -65,10 +65,11 @@ export type VideoIdWizardProps = {
|
|
|
65
65
|
disableFaceDetectionWhileAudioCapture?: boolean;
|
|
66
66
|
disableFaceDetectionWhileAudioCaptureMsDelay?: number;
|
|
67
67
|
silentFallback?: boolean;
|
|
68
|
+
mergeAVStreams?: boolean;
|
|
68
69
|
assets?: VideoIdWizardAssets;
|
|
69
70
|
classNames?: VideoIdWizardClassNames;
|
|
70
71
|
colors?: VideoIdWizardColors;
|
|
71
72
|
verbiage?: VideoIdWizardVerbiage;
|
|
72
73
|
debugMode?: boolean;
|
|
73
74
|
};
|
|
74
|
-
export declare const VideoIdWizard: ({ onComplete, onExitCapture, onExitAfterFailure, onUserCancel, onIdCaptureModelError, onCameraAccessDenied, onMicrophoneAccessDenied, idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, idCardFrontDetectionThreshold, idCardBackDetectionThreshold, idCardFrontFocusThreshold, idCardBackFocusThreshold, goodIdCardFrontFramesThreshold, goodIdCardBackFramesThreshold, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, skipIdCapture, skipShowIdCardBack, skipSuccessScreen, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, assets, classNames, colors, verbiage, debugMode, }: VideoIdWizardProps) => ReactElement;
|
|
75
|
+
export declare const VideoIdWizard: ({ onComplete, onExitCapture, onExitAfterFailure, onUserCancel, onIdCaptureModelError, onCameraAccessDenied, onMicrophoneAccessDenied, idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, idCardFrontDetectionThreshold, idCardBackDetectionThreshold, idCardFrontFocusThreshold, idCardBackFocusThreshold, goodIdCardFrontFramesThreshold, goodIdCardBackFramesThreshold, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, skipIdCapture, skipShowIdCardBack, skipSuccessScreen, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode, }: VideoIdWizardProps) => ReactElement;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Camera } from './Camera';
|
|
2
|
-
export declare const useVideoRecorder: (camera: Camera | null, audioStream?: MediaStream | null) => {
|
|
2
|
+
export declare const useVideoRecorder: (camera: Camera | null, audioStream?: MediaStream | null, mergeAVStreams?: boolean) => {
|
|
3
3
|
isRecordingVideo: boolean;
|
|
4
4
|
isRecordingAudio: boolean;
|
|
5
5
|
startRecordingVideo: () => void;
|
|
@@ -51,7 +51,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
51
51
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
52
52
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
53
53
|
|
|
54
|
-
var webSdkVersion = '1.1.
|
|
54
|
+
var webSdkVersion = '1.1.1';
|
|
55
55
|
|
|
56
56
|
function getPlatform() {
|
|
57
57
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -15799,7 +15799,10 @@ var SignatureCapture = function SignatureCapture(_a) {
|
|
|
15799
15799
|
var AcceptBtn$1 = styled__default['default'](LoaderButton)(templateObject_1$b || (templateObject_1$b = tslib.__makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
15800
15800
|
var templateObject_1$b;
|
|
15801
15801
|
|
|
15802
|
-
var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
|
|
15802
|
+
var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStreams) {
|
|
15803
|
+
if (mergeAVStreams === void 0) {
|
|
15804
|
+
mergeAVStreams = false;
|
|
15805
|
+
}
|
|
15803
15806
|
var videoRecorder = React.useRef(null);
|
|
15804
15807
|
var audioRecorder = React.useRef(null);
|
|
15805
15808
|
var videoChunks = React.useRef([]);
|
|
@@ -15828,7 +15831,13 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
|
|
|
15828
15831
|
var _h = React.useState(false),
|
|
15829
15832
|
audioRecordingIntentionallyStopped = _h[0],
|
|
15830
15833
|
setAudioRecordingIntentionallyStopped = _h[1];
|
|
15831
|
-
var
|
|
15834
|
+
var getVideoStream = React.useCallback(function () {
|
|
15835
|
+
var _a, _b, _c;
|
|
15836
|
+
if (!mergeAVStreams) return camera === null || camera === void 0 ? void 0 : camera.stream;
|
|
15837
|
+
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 : [];
|
|
15838
|
+
var audioTracks = (_c = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getTracks()) !== null && _c !== void 0 ? _c : [];
|
|
15839
|
+
return new MediaStream(tslib.__spreadArray(tslib.__spreadArray([], videoTracks, true), audioTracks, true));
|
|
15840
|
+
}, [audioStream, camera === null || camera === void 0 ? void 0 : camera.stream, mergeAVStreams]);
|
|
15832
15841
|
var processVideo = React.useCallback(function () {
|
|
15833
15842
|
var videoBlob = new Blob(videoChunks.current, {
|
|
15834
15843
|
type: 'video/mp4'
|
|
@@ -15849,13 +15858,15 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
|
|
|
15849
15858
|
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
15850
15859
|
}, [audioStream]);
|
|
15851
15860
|
var startRecordingVideo = React.useCallback(function () {
|
|
15861
|
+
var videoStream = getVideoStream();
|
|
15852
15862
|
if (!videoStream) return;
|
|
15853
15863
|
videoChunks.current = [];
|
|
15854
15864
|
setIsRecordingVideo(true);
|
|
15855
15865
|
setVideoRecordingStopped(false);
|
|
15856
15866
|
setVideoRecordingIntentionallyStopped(false);
|
|
15857
15867
|
videoRecorder.current = new MediaRecorder(videoStream, {
|
|
15858
|
-
videoBitsPerSecond: 270000
|
|
15868
|
+
videoBitsPerSecond: 270000,
|
|
15869
|
+
audioBitsPerSecond: 32000
|
|
15859
15870
|
});
|
|
15860
15871
|
videoRecorder.current.ondataavailable = function (e) {
|
|
15861
15872
|
videoChunks.current.push(e.data);
|
|
@@ -15871,8 +15882,9 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
|
|
|
15871
15882
|
// TODO: figure out what to do here
|
|
15872
15883
|
}
|
|
15873
15884
|
}, 100);
|
|
15874
|
-
}, [
|
|
15885
|
+
}, [getVideoStream]);
|
|
15875
15886
|
var startRecordingAudio = React.useCallback(function () {
|
|
15887
|
+
if (mergeAVStreams) return;
|
|
15876
15888
|
if (!audioStream) return;
|
|
15877
15889
|
audioChunks.current = [];
|
|
15878
15890
|
setIsRecordingAudio(true);
|
|
@@ -15888,7 +15900,7 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
|
|
|
15888
15900
|
setAudioRecordingStopped(true);
|
|
15889
15901
|
};
|
|
15890
15902
|
audioRecorder.current.start(1000);
|
|
15891
|
-
}, [audioStream]);
|
|
15903
|
+
}, [audioStream, mergeAVStreams]);
|
|
15892
15904
|
var stopRecordingVideo = React.useCallback(function () {
|
|
15893
15905
|
var _a, _b;
|
|
15894
15906
|
setVideoRecordingIntentionallyStopped(true);
|
|
@@ -16640,80 +16652,86 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16640
16652
|
disableFaceDetectionWhileAudioCapture = _6 === void 0 ? false : _6,
|
|
16641
16653
|
_7 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
16642
16654
|
disableFaceDetectionWhileAudioCaptureMsDelay = _7 === void 0 ? 2000 : _7,
|
|
16643
|
-
_8 = _a.
|
|
16644
|
-
|
|
16645
|
-
_9 = _a.
|
|
16646
|
-
|
|
16647
|
-
_10 = _a.
|
|
16648
|
-
|
|
16649
|
-
_11 = _a.
|
|
16650
|
-
|
|
16651
|
-
_12 = _a.
|
|
16652
|
-
|
|
16653
|
-
|
|
16654
|
-
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
_15 =
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
|
|
16670
|
-
setDetectedObjects = _17[1];
|
|
16655
|
+
_8 = _a.mergeAVStreams,
|
|
16656
|
+
mergeAVStreams = _8 === void 0 ? false : _8,
|
|
16657
|
+
_9 = _a.assets,
|
|
16658
|
+
assets = _9 === void 0 ? {} : _9,
|
|
16659
|
+
_10 = _a.classNames,
|
|
16660
|
+
classNames = _10 === void 0 ? {} : _10,
|
|
16661
|
+
_11 = _a.colors,
|
|
16662
|
+
colors = _11 === void 0 ? {} : _11,
|
|
16663
|
+
_12 = _a.verbiage,
|
|
16664
|
+
rawVerbiage = _12 === void 0 ? {} : _12,
|
|
16665
|
+
_13 = _a.debugMode,
|
|
16666
|
+
debugMode = _13 === void 0 ? false : _13;
|
|
16667
|
+
var _14 = useResizeObserver__default['default'](),
|
|
16668
|
+
ref = _14.ref,
|
|
16669
|
+
_15 = _14.width,
|
|
16670
|
+
width = _15 === void 0 ? 1 : _15,
|
|
16671
|
+
_16 = _14.height,
|
|
16672
|
+
height = _16 === void 0 ? 1 : _16;
|
|
16673
|
+
var _17 = React.useContext(CameraStateContext),
|
|
16674
|
+
cameraRef = _17.cameraRef,
|
|
16675
|
+
videoRef = _17.videoRef,
|
|
16676
|
+
videoLoaded = _17.videoLoaded,
|
|
16677
|
+
cameraReady = _17.cameraReady,
|
|
16678
|
+
microphoneReady = _17.microphoneReady,
|
|
16679
|
+
audioStream = _17.audioStream,
|
|
16680
|
+
setVideoLoaded = _17.setVideoLoaded,
|
|
16681
|
+
takePhoto = _17.takePhoto;
|
|
16671
16682
|
var _18 = React.useState([]),
|
|
16672
|
-
|
|
16673
|
-
|
|
16674
|
-
var _19 = React.
|
|
16675
|
-
|
|
16676
|
-
|
|
16677
|
-
|
|
16678
|
-
|
|
16679
|
-
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
16683
|
-
|
|
16684
|
-
|
|
16685
|
-
|
|
16686
|
-
|
|
16687
|
-
var _21 = React.
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
var _22 = React.useContext(
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
var _23 =
|
|
16694
|
-
|
|
16695
|
-
|
|
16696
|
-
|
|
16697
|
-
|
|
16698
|
-
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16683
|
+
detectedObjects = _18[0],
|
|
16684
|
+
setDetectedObjects = _18[1];
|
|
16685
|
+
var _19 = React.useState([]),
|
|
16686
|
+
faces = _19[0],
|
|
16687
|
+
setFaces = _19[1];
|
|
16688
|
+
var _20 = React.useContext(IdCaptureModelsContext),
|
|
16689
|
+
idModelsReady = _20.ready,
|
|
16690
|
+
idModelsWorking = _20.working,
|
|
16691
|
+
makeIdPrediction = _20.makePrediction,
|
|
16692
|
+
onIdPredictionMade = _20.onPredictionMade,
|
|
16693
|
+
setThresholds = _20.setThresholds,
|
|
16694
|
+
bestFrameDetectionScore = _20.bestFrameDetectionScore,
|
|
16695
|
+
bestFrameFocusScore = _20.bestFrameFocusScore,
|
|
16696
|
+
resetBestFrame = _20.resetBestFrame,
|
|
16697
|
+
idModelError = _20.idModelError;
|
|
16698
|
+
var _21 = React.useState(null),
|
|
16699
|
+
videoStartsAt = _21[0],
|
|
16700
|
+
setVideoStartsAt = _21[1];
|
|
16701
|
+
var _22 = React.useContext(SubmissionContext),
|
|
16702
|
+
setIdCaptureVideoAudioStartsAt = _22.setIdCaptureVideoAudioStartsAt,
|
|
16703
|
+
setExpectedAudioText = _22.setExpectedAudioText;
|
|
16704
|
+
var _23 = React.useContext(HighPerformanceSelfieGuidanceModelsContext),
|
|
16705
|
+
onSelfiePredictionMade = _23.onPredictionMade,
|
|
16706
|
+
selfieModelError = _23.error;
|
|
16707
|
+
var _24 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
|
|
16708
|
+
isRecordingVideo = _24.isRecordingVideo,
|
|
16709
|
+
startRecordingVideo = _24.startRecordingVideo,
|
|
16710
|
+
startRecordingAudio = _24.startRecordingAudio,
|
|
16711
|
+
stopRecordingVideo = _24.stopRecordingVideo,
|
|
16712
|
+
stopRecordingAudio = _24.stopRecordingAudio,
|
|
16713
|
+
videoRecordingUnintentionallyStopped = _24.videoRecordingUnintentionallyStopped,
|
|
16714
|
+
audioRecordingUnintentionallyStopped = _24.audioRecordingUnintentionallyStopped,
|
|
16715
|
+
videoUrl = _24.videoUrl,
|
|
16716
|
+
audioUrl = _24.audioUrl;
|
|
16703
16717
|
var countdownTimeoutRef = React.useRef(undefined);
|
|
16704
|
-
var
|
|
16705
|
-
countdownRemaining =
|
|
16706
|
-
setCountdownRemaining =
|
|
16718
|
+
var _25 = React.useState(0),
|
|
16719
|
+
countdownRemaining = _25[0],
|
|
16720
|
+
setCountdownRemaining = _25[1];
|
|
16707
16721
|
React.useEffect(function () {
|
|
16708
16722
|
if (!isRecordingVideo && !videoUrl) {
|
|
16709
16723
|
startRecordingVideo();
|
|
16710
16724
|
setVideoStartsAt(new Date());
|
|
16711
16725
|
}
|
|
16712
|
-
if
|
|
16726
|
+
// if the mergeAVStreams flag is present, the audio stream is on the video
|
|
16727
|
+
// stream, so we won't wait for a separate data url containing audio only.
|
|
16728
|
+
var needsAudio = !!readTextPrompt && !mergeAVStreams;
|
|
16729
|
+
var audioReady = !needsAudio || audioUrl;
|
|
16730
|
+
if (videoUrl && audioReady) {
|
|
16713
16731
|
setVideoLoaded(false);
|
|
16714
16732
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
|
|
16715
16733
|
}
|
|
16716
|
-
}, [audioUrl, isRecordingVideo, onComplete, readTextPrompt, setVideoLoaded, startRecordingVideo, videoUrl]);
|
|
16734
|
+
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, setVideoLoaded, startRecordingVideo, videoUrl]);
|
|
16717
16735
|
React.useEffect(function () {
|
|
16718
16736
|
if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
|
|
16719
16737
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
@@ -16724,9 +16742,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16724
16742
|
React.useEffect(function () {
|
|
16725
16743
|
shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady && !idModelError && (!readTextPrompt || microphoneReady);
|
|
16726
16744
|
}, [cameraReady, idModelError, idModelsReady, microphoneReady, readTextPrompt, videoLoaded]);
|
|
16727
|
-
var
|
|
16728
|
-
requestedAction =
|
|
16729
|
-
setRequestedAction =
|
|
16745
|
+
var _26 = React.useState('SHOW_ID_FRONT'),
|
|
16746
|
+
requestedAction = _26[0],
|
|
16747
|
+
setRequestedAction = _26[1];
|
|
16730
16748
|
React.useEffect(function () {
|
|
16731
16749
|
if (requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
|
|
16732
16750
|
if (!idCaptureModelsEnabled || !idModelsReady || !cameraReady || !videoLoaded || idModelError) return;
|
|
@@ -16754,15 +16772,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16754
16772
|
}
|
|
16755
16773
|
});
|
|
16756
16774
|
}, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
|
|
16757
|
-
var _26 = React.useState(0),
|
|
16758
|
-
currentDetectionScore = _26[0],
|
|
16759
|
-
setCurrentDetectionScore = _26[1];
|
|
16760
16775
|
var _27 = React.useState(0),
|
|
16761
|
-
|
|
16762
|
-
|
|
16776
|
+
currentDetectionScore = _27[0],
|
|
16777
|
+
setCurrentDetectionScore = _27[1];
|
|
16763
16778
|
var _28 = React.useState(0),
|
|
16764
|
-
|
|
16765
|
-
|
|
16779
|
+
currentFocusScore = _28[0],
|
|
16780
|
+
setCurrentFocusScore = _28[1];
|
|
16781
|
+
var _29 = React.useState(0),
|
|
16782
|
+
goodFramesCount = _29[0],
|
|
16783
|
+
setGoodFramesCount = _29[1];
|
|
16766
16784
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
|
|
16767
16785
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
16768
16786
|
React.useEffect(function () {
|
|
@@ -16780,9 +16798,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16780
16798
|
}
|
|
16781
16799
|
});
|
|
16782
16800
|
}, [idCaptureModelsEnabled, idCardFrontDetectionThreshold, onIdPredictionMade, idModelError]);
|
|
16783
|
-
var
|
|
16784
|
-
idFrontCaptureStartedAt =
|
|
16785
|
-
setFirstGoodFrameTime =
|
|
16801
|
+
var _30 = React.useState(null),
|
|
16802
|
+
idFrontCaptureStartedAt = _30[0],
|
|
16803
|
+
setFirstGoodFrameTime = _30[1];
|
|
16786
16804
|
React.useEffect(function () {
|
|
16787
16805
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
16788
16806
|
}, [goodFramesCount]);
|
|
@@ -16803,9 +16821,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16803
16821
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
16804
16822
|
var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
|
|
16805
16823
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
16806
|
-
var
|
|
16807
|
-
countdownStartedAt =
|
|
16808
|
-
setCountdownStartedAt =
|
|
16824
|
+
var _31 = React.useState(),
|
|
16825
|
+
countdownStartedAt = _31[0],
|
|
16826
|
+
setCountdownStartedAt = _31[1];
|
|
16809
16827
|
var frameLock = React.useRef(false);
|
|
16810
16828
|
var captureFrame = React.useCallback(function () {
|
|
16811
16829
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
@@ -16926,9 +16944,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16926
16944
|
};
|
|
16927
16945
|
}, [captureCountdownSeconds, captureFrame, countdownStartedAt, manualCountdown]);
|
|
16928
16946
|
var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
|
|
16929
|
-
var
|
|
16930
|
-
numFramesWithoutFaces =
|
|
16931
|
-
setNumFramesWithoutFaces =
|
|
16947
|
+
var _32 = React.useState(0),
|
|
16948
|
+
numFramesWithoutFaces = _32[0],
|
|
16949
|
+
setNumFramesWithoutFaces = _32[1];
|
|
16932
16950
|
React.useEffect(function () {
|
|
16933
16951
|
if (!selfieModelError) {
|
|
16934
16952
|
onSelfiePredictionMade(function (faces) {
|
|
@@ -16946,14 +16964,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16946
16964
|
}
|
|
16947
16965
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
16948
16966
|
var theme = styled.useTheme();
|
|
16949
|
-
var
|
|
16967
|
+
var _33 = useTranslations(rawVerbiage, {
|
|
16950
16968
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
16951
16969
|
searchingForIdCardText: 'Searching for ID card...',
|
|
16952
16970
|
captureBtnText: 'Capture'
|
|
16953
16971
|
}),
|
|
16954
|
-
captureBtnText =
|
|
16955
|
-
faceNotCenteredText =
|
|
16956
|
-
searchingForIdCardText =
|
|
16972
|
+
captureBtnText = _33.captureBtnText,
|
|
16973
|
+
faceNotCenteredText = _33.faceNotCenteredText,
|
|
16974
|
+
searchingForIdCardText = _33.searchingForIdCardText;
|
|
16957
16975
|
var debugScalingDetails = useDebugScalingDetails({
|
|
16958
16976
|
enabled: debugMode,
|
|
16959
16977
|
pageWidth: width,
|
|
@@ -17194,29 +17212,31 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
17194
17212
|
disableFaceDetectionWhileAudioCaptureMsDelay = _v === void 0 ? 2000 : _v,
|
|
17195
17213
|
_w = _a.silentFallback,
|
|
17196
17214
|
silentFallback = _w === void 0 ? false : _w,
|
|
17197
|
-
_x = _a.
|
|
17198
|
-
|
|
17199
|
-
_y = _a.
|
|
17200
|
-
|
|
17201
|
-
_z = _a.
|
|
17202
|
-
|
|
17203
|
-
_0 = _a.
|
|
17204
|
-
|
|
17205
|
-
_1 = _a.
|
|
17206
|
-
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
|
|
17215
|
-
|
|
17216
|
-
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17215
|
+
_x = _a.mergeAVStreams,
|
|
17216
|
+
mergeAVStreams = _x === void 0 ? false : _x,
|
|
17217
|
+
_y = _a.assets,
|
|
17218
|
+
assets = _y === void 0 ? {} : _y,
|
|
17219
|
+
_z = _a.classNames,
|
|
17220
|
+
classNames = _z === void 0 ? {} : _z,
|
|
17221
|
+
_0 = _a.colors,
|
|
17222
|
+
colors = _0 === void 0 ? {} : _0,
|
|
17223
|
+
_1 = _a.verbiage,
|
|
17224
|
+
verbiage = _1 === void 0 ? {} : _1,
|
|
17225
|
+
_2 = _a.debugMode,
|
|
17226
|
+
debugMode = _2 === void 0 ? false : _2;
|
|
17227
|
+
var _3 = React.useContext(SubmissionContext),
|
|
17228
|
+
submissionStatus = _3.submissionStatus,
|
|
17229
|
+
idCaptureVideoUrl = _3.idCaptureVideoUrl,
|
|
17230
|
+
idCaptureVideoAudioUrl = _3.idCaptureVideoAudioUrl,
|
|
17231
|
+
idCaptureVideoIdFrontImage = _3.idCaptureVideoIdFrontImage,
|
|
17232
|
+
idCaptureVideoIdBackImage = _3.idCaptureVideoIdBackImage,
|
|
17233
|
+
setIdCaptureVideoUrl = _3.setIdCaptureVideoUrl,
|
|
17234
|
+
setIdCaptureVideoIdFrontImage = _3.setIdCaptureVideoIdFrontImage,
|
|
17235
|
+
setIdCaptureVideoIdBackImage = _3.setIdCaptureVideoIdBackImage,
|
|
17236
|
+
setIdCaptureVideoAudioUrl = _3.setIdCaptureVideoAudioUrl;
|
|
17237
|
+
var _4 = React.useState('CAPTURING_ID'),
|
|
17238
|
+
captureState = _4[0],
|
|
17239
|
+
setCaptureState = _4[1];
|
|
17220
17240
|
React.useEffect(function () {
|
|
17221
17241
|
if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
|
|
17222
17242
|
}, [captureState, skipIdCapture]);
|
|
@@ -17247,9 +17267,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
17247
17267
|
var onVideoCaptureFaceNotDetected = React.useCallback(function () {
|
|
17248
17268
|
setCaptureState('CHECKING_LIVENESS');
|
|
17249
17269
|
}, []);
|
|
17250
|
-
var
|
|
17251
|
-
attempt =
|
|
17252
|
-
setAttempt =
|
|
17270
|
+
var _5 = React.useState(0),
|
|
17271
|
+
attempt = _5[0],
|
|
17272
|
+
setAttempt = _5[1];
|
|
17253
17273
|
var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
|
|
17254
17274
|
var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
|
|
17255
17275
|
userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
|
|
@@ -17364,6 +17384,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
17364
17384
|
readTextPrompt: readTextPrompt,
|
|
17365
17385
|
readTextTimeoutDurationMs: readTextTimeoutDurationMs,
|
|
17366
17386
|
readTextMinReadingMs: readTextMinReadingMs,
|
|
17387
|
+
mergeAVStreams: mergeAVStreams,
|
|
17367
17388
|
assets: assets.idVideoCapture,
|
|
17368
17389
|
classNames: classNames.idVideoCapture,
|
|
17369
17390
|
colors: colors.idVideoCapture,
|
|
@@ -19705,28 +19726,30 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
19705
19726
|
disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
|
|
19706
19727
|
_x = _a.silentFallback,
|
|
19707
19728
|
silentFallback = _x === void 0 ? false : _x,
|
|
19708
|
-
_y = _a.
|
|
19709
|
-
|
|
19710
|
-
_z = _a.
|
|
19711
|
-
|
|
19712
|
-
_0 = _a.
|
|
19713
|
-
|
|
19714
|
-
_1 = _a.
|
|
19715
|
-
|
|
19716
|
-
_2 = _a.
|
|
19717
|
-
|
|
19718
|
-
_3 = _a.
|
|
19719
|
-
|
|
19720
|
-
_4 = _a.
|
|
19721
|
-
|
|
19722
|
-
_5 = _a.
|
|
19723
|
-
|
|
19724
|
-
_6 = _a.
|
|
19725
|
-
|
|
19726
|
-
_7 = _a.
|
|
19727
|
-
|
|
19728
|
-
_8 = _a.
|
|
19729
|
-
|
|
19729
|
+
_y = _a.mergeAVStreams,
|
|
19730
|
+
mergeAVStreams = _y === void 0 ? false : _y,
|
|
19731
|
+
_z = _a.theme,
|
|
19732
|
+
theme = _z === void 0 ? 'default' : _z,
|
|
19733
|
+
_0 = _a.assets,
|
|
19734
|
+
assets = _0 === void 0 ? {} : _0,
|
|
19735
|
+
_1 = _a.classNames,
|
|
19736
|
+
classNames = _1 === void 0 ? {} : _1,
|
|
19737
|
+
_2 = _a.colors,
|
|
19738
|
+
colors = _2 === void 0 ? {} : _2,
|
|
19739
|
+
_3 = _a.verbiage,
|
|
19740
|
+
verbiage = _3 === void 0 ? {} : _3,
|
|
19741
|
+
_4 = _a.captureSignature,
|
|
19742
|
+
captureSignature = _4 === void 0 ? false : _4,
|
|
19743
|
+
_5 = _a.captureSignatureVideo,
|
|
19744
|
+
captureSignatureVideo = _5 === void 0 ? false : _5,
|
|
19745
|
+
_6 = _a.captureAdditionalDocuments,
|
|
19746
|
+
captureAdditionalDocuments = _6 === void 0 ? [] : _6,
|
|
19747
|
+
_7 = _a.geolocationEnabled,
|
|
19748
|
+
geolocationEnabled = _7 === void 0 ? true : _7,
|
|
19749
|
+
_8 = _a.geolocationRequired,
|
|
19750
|
+
geolocationRequired = _8 === void 0 ? false : _8,
|
|
19751
|
+
_9 = _a.debugMode,
|
|
19752
|
+
debugMode = _9 === void 0 ? false : _9;
|
|
19730
19753
|
useLanguage(lang);
|
|
19731
19754
|
useDebugLogging(debugMode);
|
|
19732
19755
|
var videoIdCaptureProps = React.useMemo(function () {
|
|
@@ -19757,13 +19780,14 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
19757
19780
|
disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
|
|
19758
19781
|
disableFaceDetectionWhileAudioCaptureMsDelay: disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
19759
19782
|
silentFallback: silentFallback,
|
|
19783
|
+
mergeAVStreams: mergeAVStreams,
|
|
19760
19784
|
assets: assets,
|
|
19761
19785
|
classNames: classNames,
|
|
19762
19786
|
colors: colors,
|
|
19763
19787
|
verbiage: verbiage,
|
|
19764
19788
|
debugMode: debugMode
|
|
19765
19789
|
};
|
|
19766
|
-
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, assets, classNames, colors, verbiage, debugMode]);
|
|
19790
|
+
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
|
|
19767
19791
|
var additionalDocumentCaptureProps = React.useMemo(function () {
|
|
19768
19792
|
return {
|
|
19769
19793
|
documents: captureAdditionalDocuments,
|