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 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.0';
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 videoStream = camera === null || camera === void 0 ? void 0 : camera.stream;
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
- }, [videoStream]);
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.assets,
16644
- assets = _8 === void 0 ? {} : _8,
16645
- _9 = _a.classNames,
16646
- classNames = _9 === void 0 ? {} : _9,
16647
- _10 = _a.colors,
16648
- colors = _10 === void 0 ? {} : _10,
16649
- _11 = _a.verbiage,
16650
- rawVerbiage = _11 === void 0 ? {} : _11,
16651
- _12 = _a.debugMode,
16652
- debugMode = _12 === void 0 ? false : _12;
16653
- var _13 = useResizeObserver__default['default'](),
16654
- ref = _13.ref,
16655
- _14 = _13.width,
16656
- width = _14 === void 0 ? 1 : _14,
16657
- _15 = _13.height,
16658
- height = _15 === void 0 ? 1 : _15;
16659
- var _16 = React.useContext(CameraStateContext),
16660
- cameraRef = _16.cameraRef,
16661
- videoRef = _16.videoRef,
16662
- videoLoaded = _16.videoLoaded,
16663
- cameraReady = _16.cameraReady,
16664
- microphoneReady = _16.microphoneReady,
16665
- audioStream = _16.audioStream,
16666
- setVideoLoaded = _16.setVideoLoaded,
16667
- takePhoto = _16.takePhoto;
16668
- var _17 = React.useState([]),
16669
- detectedObjects = _17[0],
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
- faces = _18[0],
16673
- setFaces = _18[1];
16674
- var _19 = React.useContext(IdCaptureModelsContext),
16675
- idModelsReady = _19.ready,
16676
- idModelsWorking = _19.working,
16677
- makeIdPrediction = _19.makePrediction,
16678
- onIdPredictionMade = _19.onPredictionMade,
16679
- setThresholds = _19.setThresholds,
16680
- bestFrameDetectionScore = _19.bestFrameDetectionScore,
16681
- bestFrameFocusScore = _19.bestFrameFocusScore,
16682
- resetBestFrame = _19.resetBestFrame,
16683
- idModelError = _19.idModelError;
16684
- var _20 = React.useState(null),
16685
- videoStartsAt = _20[0],
16686
- setVideoStartsAt = _20[1];
16687
- var _21 = React.useContext(SubmissionContext),
16688
- setIdCaptureVideoAudioStartsAt = _21.setIdCaptureVideoAudioStartsAt,
16689
- setExpectedAudioText = _21.setExpectedAudioText;
16690
- var _22 = React.useContext(HighPerformanceSelfieGuidanceModelsContext),
16691
- onSelfiePredictionMade = _22.onPredictionMade,
16692
- selfieModelError = _22.error;
16693
- var _23 = useVideoRecorder(cameraRef.current, audioStream),
16694
- isRecordingVideo = _23.isRecordingVideo,
16695
- startRecordingVideo = _23.startRecordingVideo,
16696
- startRecordingAudio = _23.startRecordingAudio,
16697
- stopRecordingVideo = _23.stopRecordingVideo,
16698
- stopRecordingAudio = _23.stopRecordingAudio,
16699
- videoRecordingUnintentionallyStopped = _23.videoRecordingUnintentionallyStopped,
16700
- audioRecordingUnintentionallyStopped = _23.audioRecordingUnintentionallyStopped,
16701
- videoUrl = _23.videoUrl,
16702
- audioUrl = _23.audioUrl;
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 _24 = React.useState(0),
16705
- countdownRemaining = _24[0],
16706
- setCountdownRemaining = _24[1];
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 (videoUrl && (!readTextPrompt || audioUrl)) {
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 _25 = React.useState('SHOW_ID_FRONT'),
16728
- requestedAction = _25[0],
16729
- setRequestedAction = _25[1];
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
- currentFocusScore = _27[0],
16762
- setCurrentFocusScore = _27[1];
16776
+ currentDetectionScore = _27[0],
16777
+ setCurrentDetectionScore = _27[1];
16763
16778
  var _28 = React.useState(0),
16764
- goodFramesCount = _28[0],
16765
- setGoodFramesCount = _28[1];
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 _29 = React.useState(null),
16784
- idFrontCaptureStartedAt = _29[0],
16785
- setFirstGoodFrameTime = _29[1];
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 _30 = React.useState(),
16807
- countdownStartedAt = _30[0],
16808
- setCountdownStartedAt = _30[1];
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 _31 = React.useState(0),
16930
- numFramesWithoutFaces = _31[0],
16931
- setNumFramesWithoutFaces = _31[1];
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 _32 = useTranslations(rawVerbiage, {
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 = _32.captureBtnText,
16955
- faceNotCenteredText = _32.faceNotCenteredText,
16956
- searchingForIdCardText = _32.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.assets,
17198
- assets = _x === void 0 ? {} : _x,
17199
- _y = _a.classNames,
17200
- classNames = _y === void 0 ? {} : _y,
17201
- _z = _a.colors,
17202
- colors = _z === void 0 ? {} : _z,
17203
- _0 = _a.verbiage,
17204
- verbiage = _0 === void 0 ? {} : _0,
17205
- _1 = _a.debugMode,
17206
- debugMode = _1 === void 0 ? false : _1;
17207
- var _2 = React.useContext(SubmissionContext),
17208
- submissionStatus = _2.submissionStatus,
17209
- idCaptureVideoUrl = _2.idCaptureVideoUrl,
17210
- idCaptureVideoAudioUrl = _2.idCaptureVideoAudioUrl,
17211
- idCaptureVideoIdFrontImage = _2.idCaptureVideoIdFrontImage,
17212
- idCaptureVideoIdBackImage = _2.idCaptureVideoIdBackImage,
17213
- setIdCaptureVideoUrl = _2.setIdCaptureVideoUrl,
17214
- setIdCaptureVideoIdFrontImage = _2.setIdCaptureVideoIdFrontImage,
17215
- setIdCaptureVideoIdBackImage = _2.setIdCaptureVideoIdBackImage,
17216
- setIdCaptureVideoAudioUrl = _2.setIdCaptureVideoAudioUrl;
17217
- var _3 = React.useState('CAPTURING_ID'),
17218
- captureState = _3[0],
17219
- setCaptureState = _3[1];
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 _4 = React.useState(0),
17251
- attempt = _4[0],
17252
- setAttempt = _4[1];
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.theme,
19709
- theme = _y === void 0 ? 'default' : _y,
19710
- _z = _a.assets,
19711
- assets = _z === void 0 ? {} : _z,
19712
- _0 = _a.classNames,
19713
- classNames = _0 === void 0 ? {} : _0,
19714
- _1 = _a.colors,
19715
- colors = _1 === void 0 ? {} : _1,
19716
- _2 = _a.verbiage,
19717
- verbiage = _2 === void 0 ? {} : _2,
19718
- _3 = _a.captureSignature,
19719
- captureSignature = _3 === void 0 ? false : _3,
19720
- _4 = _a.captureSignatureVideo,
19721
- captureSignatureVideo = _4 === void 0 ? false : _4,
19722
- _5 = _a.captureAdditionalDocuments,
19723
- captureAdditionalDocuments = _5 === void 0 ? [] : _5,
19724
- _6 = _a.geolocationEnabled,
19725
- geolocationEnabled = _6 === void 0 ? true : _6,
19726
- _7 = _a.geolocationRequired,
19727
- geolocationRequired = _7 === void 0 ? false : _7,
19728
- _8 = _a.debugMode,
19729
- debugMode = _8 === void 0 ? false : _8;
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,