idmission-web-sdk 2.0.0 → 2.0.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/dist/sdk2.esm.js CHANGED
@@ -14,7 +14,7 @@ import LanguageDetector from 'i18next-browser-languagedetector';
14
14
  import i18n from 'i18next';
15
15
  import SignatureCanvas from 'react-signature-canvas';
16
16
 
17
- var webSdkVersion = '2.0.0';
17
+ var webSdkVersion = '2.0.1';
18
18
 
19
19
  function getPlatform() {
20
20
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9152,14 +9152,20 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
9152
9152
  var captureStartedAt = useRef();
9153
9153
  var captureEndedAt = useRef();
9154
9154
  var operationStartedAt = useRef();
9155
+ var _x = useContext(SelfieGuidanceModelsContext),
9156
+ start = _x.start,
9157
+ stop = _x.stop;
9155
9158
  useEffect(function () {
9156
9159
  operationStartedAt.current = new Date();
9157
9160
  }, []);
9158
9161
  useEffect(function () {
9159
- if (captureState === 'CAPTURING') {
9160
- captureStartedAt.current = new Date();
9161
- }
9162
- }, [captureState]);
9162
+ if (captureState !== 'CAPTURING') return;
9163
+ captureStartedAt.current = new Date();
9164
+ start();
9165
+ return function () {
9166
+ stop();
9167
+ };
9168
+ }, [captureState, start, stop]);
9163
9169
  var onCapture = useCallback(function () {
9164
9170
  captureEndedAt.current = new Date();
9165
9171
  }, []);
@@ -9196,9 +9202,9 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
9196
9202
  setCaptureState('FAILED');
9197
9203
  onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(submissionResponse, livenessCheckRequest);
9198
9204
  }, [onTimeout, livenessCheckRequest, submissionResponse]);
9199
- var _x = useState(0),
9200
- attempt = _x[0],
9201
- setAttempt = _x[1];
9205
+ var _y = useState(0),
9206
+ attempt = _y[0],
9207
+ setAttempt = _y[1];
9202
9208
  var onExitCallback = useCallback(function () {
9203
9209
  setAttempt(function (n) {
9204
9210
  return n + 1;
@@ -9614,7 +9620,10 @@ var SignatureCapture = function SignatureCapture(_a) {
9614
9620
  var AcceptBtn$1 = styled(LoaderButton)(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
9615
9621
  var templateObject_1$b;
9616
9622
 
9617
- var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
9623
+ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStreams) {
9624
+ if (mergeAVStreams === void 0) {
9625
+ mergeAVStreams = false;
9626
+ }
9618
9627
  var videoRecorder = useRef(null);
9619
9628
  var audioRecorder = useRef(null);
9620
9629
  var videoChunks = useRef([]);
@@ -9643,7 +9652,13 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
9643
9652
  var _h = useState(false),
9644
9653
  audioRecordingIntentionallyStopped = _h[0],
9645
9654
  setAudioRecordingIntentionallyStopped = _h[1];
9646
- var videoStream = camera === null || camera === void 0 ? void 0 : camera.stream;
9655
+ var getVideoStream = useCallback(function () {
9656
+ var _a, _b, _c;
9657
+ if (!mergeAVStreams) return camera === null || camera === void 0 ? void 0 : camera.stream;
9658
+ 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 : [];
9659
+ var audioTracks = (_c = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getTracks()) !== null && _c !== void 0 ? _c : [];
9660
+ return new MediaStream(__spreadArray(__spreadArray([], videoTracks, true), audioTracks, true));
9661
+ }, [audioStream, camera === null || camera === void 0 ? void 0 : camera.stream, mergeAVStreams]);
9647
9662
  var processVideo = useCallback(function () {
9648
9663
  var videoBlob = new Blob(videoChunks.current, {
9649
9664
  type: 'video/mp4'
@@ -9664,13 +9679,15 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
9664
9679
  (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
9665
9680
  }, [audioStream]);
9666
9681
  var startRecordingVideo = useCallback(function () {
9682
+ var videoStream = getVideoStream();
9667
9683
  if (!videoStream) return;
9668
9684
  videoChunks.current = [];
9669
9685
  setIsRecordingVideo(true);
9670
9686
  setVideoRecordingStopped(false);
9671
9687
  setVideoRecordingIntentionallyStopped(false);
9672
9688
  videoRecorder.current = new MediaRecorder(videoStream, {
9673
- videoBitsPerSecond: 270000
9689
+ videoBitsPerSecond: 270000,
9690
+ audioBitsPerSecond: 32000
9674
9691
  });
9675
9692
  videoRecorder.current.ondataavailable = function (e) {
9676
9693
  videoChunks.current.push(e.data);
@@ -9686,8 +9703,9 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
9686
9703
  // TODO: figure out what to do here
9687
9704
  }
9688
9705
  }, 100);
9689
- }, [videoStream]);
9706
+ }, [getVideoStream]);
9690
9707
  var startRecordingAudio = useCallback(function () {
9708
+ if (mergeAVStreams) return;
9691
9709
  if (!audioStream) return;
9692
9710
  audioChunks.current = [];
9693
9711
  setIsRecordingAudio(true);
@@ -9703,7 +9721,7 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream) {
9703
9721
  setAudioRecordingStopped(true);
9704
9722
  };
9705
9723
  audioRecorder.current.start(1000);
9706
- }, [audioStream]);
9724
+ }, [audioStream, mergeAVStreams]);
9707
9725
  var stopRecordingVideo = useCallback(function () {
9708
9726
  var _a, _b;
9709
9727
  setVideoRecordingIntentionallyStopped(true);
@@ -10005,45 +10023,52 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
10005
10023
  onRetryClicked = _a.onRetryClicked,
10006
10024
  onExitCapture = _a.onExitCapture,
10007
10025
  onUserCancel = _a.onUserCancel,
10008
- onModelError = _a.onModelError,
10009
10026
  _c = _a.loadingOverlayMode,
10010
10027
  loadingOverlayMode = _c === void 0 ? 'default' : _c,
10011
- _d = _a.modelLoadTimeoutMs,
10012
- modelLoadTimeoutMs = _d === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _d,
10013
- _e = _a.skipSuccessScreen,
10014
- skipSuccessScreen = _e === void 0 ? false : _e,
10015
- _f = _a.assets,
10016
- assets = _f === void 0 ? {} : _f,
10017
- _g = _a.classNames,
10018
- classNames = _g === void 0 ? {} : _g,
10019
- _h = _a.colors,
10020
- colors = _h === void 0 ? {} : _h,
10021
- _j = _a.verbiage,
10022
- verbiage = _j === void 0 ? {} : _j,
10023
- _k = _a.debugMode,
10024
- debugMode = _k === void 0 ? false : _k;
10025
- var _l = useContext(SubmissionContext),
10026
- selfieImage = _l.selfieImage,
10027
- signatureVideoUrl = _l.signatureVideoUrl,
10028
- setSelfieImage = _l.setSelfieImage,
10029
- setSignatureData = _l.setSignatureData,
10030
- setSignatureVideoUrl = _l.setSignatureVideoUrl,
10031
- logSelfieCaptureAttempt = _l.logSelfieCaptureAttempt;
10028
+ _d = _a.skipSuccessScreen,
10029
+ skipSuccessScreen = _d === void 0 ? false : _d,
10030
+ _e = _a.assets,
10031
+ assets = _e === void 0 ? {} : _e,
10032
+ _f = _a.classNames,
10033
+ classNames = _f === void 0 ? {} : _f,
10034
+ _g = _a.colors,
10035
+ colors = _g === void 0 ? {} : _g,
10036
+ _h = _a.verbiage,
10037
+ verbiage = _h === void 0 ? {} : _h,
10038
+ _j = _a.debugMode,
10039
+ debugMode = _j === void 0 ? false : _j;
10040
+ var _k = useContext(SubmissionContext),
10041
+ selfieImage = _k.selfieImage,
10042
+ signatureVideoUrl = _k.signatureVideoUrl,
10043
+ setSelfieImage = _k.setSelfieImage,
10044
+ setSignatureData = _k.setSignatureData,
10045
+ setSignatureVideoUrl = _k.setSignatureVideoUrl,
10046
+ logSelfieCaptureAttempt = _k.logSelfieCaptureAttempt;
10032
10047
  var cameraAccessDenied = useContext(CameraStateContext).cameraAccessDenied;
10033
- var _m = useState('LOADING'),
10034
- captureState = _m[0],
10035
- setCaptureState = _m[1];
10048
+ var _l = useState('LOADING'),
10049
+ captureState = _l[0],
10050
+ setCaptureState = _l[1];
10036
10051
  var operationStartedAt = useRef();
10037
10052
  var captureStartedAt = useRef();
10038
10053
  var captureEndedAt = useRef();
10054
+ var _m = useContext(SelfieGuidanceModelsContext),
10055
+ start = _m.start,
10056
+ stop = _m.stop;
10039
10057
  useEffect(function () {
10040
10058
  operationStartedAt.current = new Date();
10041
10059
  }, []);
10042
10060
  useEffect(function () {
10043
- if (captureState === 'CHECKING_LIVENESS') {
10044
- captureStartedAt.current = new Date();
10045
- }
10061
+ if (captureState !== 'CHECKING_LIVENESS') return;
10062
+ captureStartedAt.current = new Date();
10046
10063
  }, [captureState]);
10064
+ var shouldRun = ['CHECKING_LIVENESS', 'CAPTURING_SIGNATURE'].includes(captureState);
10065
+ useEffect(function () {
10066
+ if (!shouldRun) return;
10067
+ start();
10068
+ return function () {
10069
+ stop();
10070
+ };
10071
+ }, [shouldRun, start, stop]);
10047
10072
  var logCaptureMetadata = useCallback(function () {
10048
10073
  var _a, _b, _c;
10049
10074
  logSelfieCaptureAttempt({
@@ -10108,11 +10133,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
10108
10133
  setCaptureState('LOADING');
10109
10134
  }
10110
10135
  }, [cameraAccessDenied]);
10111
- return /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
10112
- throttleMs: captureState === 'CAPTURING_SIGNATURE' ? 250 : 0,
10113
- onModelError: onModelError,
10114
- modelLoadTimeoutMs: modelLoadTimeoutMs
10115
- }, /*#__PURE__*/React__default.createElement(PageContainer, {
10136
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PageContainer, {
10116
10137
  className: "flex ".concat((_b = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _b !== void 0 ? _b : '')
10117
10138
  }, /*#__PURE__*/React__default.createElement(CameraVideoTag, {
10118
10139
  className: classNames.cameraFeed
@@ -10477,79 +10498,85 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10477
10498
  disableFaceDetectionWhileAudioCapture = _8 === void 0 ? false : _8,
10478
10499
  _9 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
10479
10500
  disableFaceDetectionWhileAudioCaptureMsDelay = _9 === void 0 ? 2000 : _9,
10480
- _10 = _a.assets,
10481
- assets = _10 === void 0 ? {} : _10,
10482
- _11 = _a.classNames,
10483
- classNames = _11 === void 0 ? {} : _11,
10484
- _12 = _a.colors,
10485
- colors = _12 === void 0 ? {} : _12,
10486
- _13 = _a.verbiage,
10487
- rawVerbiage = _13 === void 0 ? {} : _13,
10488
- _14 = _a.debugMode,
10489
- debugMode = _14 === void 0 ? false : _14;
10490
- var _15 = useResizeObserver(),
10491
- ref = _15.ref,
10492
- _16 = _15.width,
10493
- width = _16 === void 0 ? 1 : _16,
10494
- _17 = _15.height,
10495
- height = _17 === void 0 ? 1 : _17;
10496
- var _18 = useContext(CameraStateContext),
10497
- cameraRef = _18.cameraRef,
10498
- videoRef = _18.videoRef,
10499
- videoLoaded = _18.videoLoaded,
10500
- cameraReady = _18.cameraReady,
10501
- microphoneReady = _18.microphoneReady,
10502
- audioStream = _18.audioStream,
10503
- setVideoLoaded = _18.setVideoLoaded,
10504
- takePhoto = _18.takePhoto;
10505
- var _19 = useState([]),
10506
- detectedObjects = _19[0],
10507
- setDetectedObjects = _19[1];
10501
+ _10 = _a.mergeAVStreams,
10502
+ mergeAVStreams = _10 === void 0 ? false : _10,
10503
+ _11 = _a.assets,
10504
+ assets = _11 === void 0 ? {} : _11,
10505
+ _12 = _a.classNames,
10506
+ classNames = _12 === void 0 ? {} : _12,
10507
+ _13 = _a.colors,
10508
+ colors = _13 === void 0 ? {} : _13,
10509
+ _14 = _a.verbiage,
10510
+ rawVerbiage = _14 === void 0 ? {} : _14,
10511
+ _15 = _a.debugMode,
10512
+ debugMode = _15 === void 0 ? false : _15;
10513
+ var _16 = useResizeObserver(),
10514
+ ref = _16.ref,
10515
+ _17 = _16.width,
10516
+ width = _17 === void 0 ? 1 : _17,
10517
+ _18 = _16.height,
10518
+ height = _18 === void 0 ? 1 : _18;
10519
+ var _19 = useContext(CameraStateContext),
10520
+ cameraRef = _19.cameraRef,
10521
+ videoRef = _19.videoRef,
10522
+ videoLoaded = _19.videoLoaded,
10523
+ cameraReady = _19.cameraReady,
10524
+ microphoneReady = _19.microphoneReady,
10525
+ audioStream = _19.audioStream,
10526
+ setVideoLoaded = _19.setVideoLoaded,
10527
+ takePhoto = _19.takePhoto;
10508
10528
  var _20 = useState([]),
10509
- faces = _20[0],
10510
- setFaces = _20[1];
10511
- var _21 = useContext(IdCaptureModelsContext),
10512
- idModelsReady = _21.ready,
10513
- startIdModels = _21.start,
10514
- stopIdModels = _21.stop,
10515
- onIdPredictionMade = _21.onPredictionMade,
10516
- setThresholds = _21.setThresholds,
10517
- bestFrameDetails = _21.bestFrameDetails,
10518
- resetBestFrame = _21.resetBestFrame,
10519
- idModelError = _21.modelError;
10520
- var _22 = useState(null),
10521
- videoStartsAt = _22[0],
10522
- setVideoStartsAt = _22[1];
10523
- var _23 = useContext(SubmissionContext),
10524
- setIdCaptureVideoAudioStartsAt = _23.setIdCaptureVideoAudioStartsAt,
10525
- setExpectedAudioText = _23.setExpectedAudioText;
10526
- var _24 = useContext(SelfieGuidanceModelsContext),
10527
- onSelfiePredictionMade = _24.onPredictionMade,
10528
- selfieModelError = _24.error;
10529
- var _25 = useVideoRecorder(cameraRef.current, audioStream),
10530
- isRecordingVideo = _25.isRecordingVideo,
10531
- startRecordingVideo = _25.startRecordingVideo,
10532
- startRecordingAudio = _25.startRecordingAudio,
10533
- stopRecordingVideo = _25.stopRecordingVideo,
10534
- stopRecordingAudio = _25.stopRecordingAudio,
10535
- videoRecordingUnintentionallyStopped = _25.videoRecordingUnintentionallyStopped,
10536
- audioRecordingUnintentionallyStopped = _25.audioRecordingUnintentionallyStopped,
10537
- videoUrl = _25.videoUrl,
10538
- audioUrl = _25.audioUrl;
10529
+ detectedObjects = _20[0],
10530
+ setDetectedObjects = _20[1];
10531
+ var _21 = useState([]),
10532
+ faces = _21[0],
10533
+ setFaces = _21[1];
10534
+ var _22 = useContext(IdCaptureModelsContext),
10535
+ idModelsReady = _22.ready,
10536
+ startIdModels = _22.start,
10537
+ stopIdModels = _22.stop,
10538
+ onIdPredictionMade = _22.onPredictionMade,
10539
+ setThresholds = _22.setThresholds,
10540
+ bestFrameDetails = _22.bestFrameDetails,
10541
+ resetBestFrame = _22.resetBestFrame,
10542
+ idModelError = _22.modelError;
10543
+ var _23 = useState(null),
10544
+ videoStartsAt = _23[0],
10545
+ setVideoStartsAt = _23[1];
10546
+ var _24 = useContext(SubmissionContext),
10547
+ setIdCaptureVideoAudioStartsAt = _24.setIdCaptureVideoAudioStartsAt,
10548
+ setExpectedAudioText = _24.setExpectedAudioText;
10549
+ var _25 = useContext(SelfieGuidanceModelsContext),
10550
+ onSelfiePredictionMade = _25.onPredictionMade,
10551
+ selfieModelError = _25.error;
10552
+ var _26 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
10553
+ isRecordingVideo = _26.isRecordingVideo,
10554
+ startRecordingVideo = _26.startRecordingVideo,
10555
+ startRecordingAudio = _26.startRecordingAudio,
10556
+ stopRecordingVideo = _26.stopRecordingVideo,
10557
+ stopRecordingAudio = _26.stopRecordingAudio,
10558
+ videoRecordingUnintentionallyStopped = _26.videoRecordingUnintentionallyStopped,
10559
+ audioRecordingUnintentionallyStopped = _26.audioRecordingUnintentionallyStopped,
10560
+ videoUrl = _26.videoUrl,
10561
+ audioUrl = _26.audioUrl;
10539
10562
  var countdownTimeoutRef = useRef(undefined);
10540
- var _26 = useState(0),
10541
- countdownRemaining = _26[0],
10542
- setCountdownRemaining = _26[1];
10563
+ var _27 = useState(0),
10564
+ countdownRemaining = _27[0],
10565
+ setCountdownRemaining = _27[1];
10543
10566
  useEffect(function () {
10544
10567
  if (!isRecordingVideo && !videoUrl) {
10545
10568
  startRecordingVideo();
10546
10569
  setVideoStartsAt(new Date());
10547
10570
  }
10548
- if (videoUrl && (!readTextPrompt || audioUrl)) {
10571
+ // if the mergeAVStreams flag is present, the audio stream is on the video
10572
+ // stream, so we won't wait for a separate data url containing audio only.
10573
+ var needsAudio = !!readTextPrompt && !mergeAVStreams;
10574
+ var audioReady = !needsAudio || audioUrl;
10575
+ if (videoUrl && audioReady) {
10549
10576
  setVideoLoaded(false);
10550
10577
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
10551
10578
  }
10552
- }, [audioUrl, isRecordingVideo, onComplete, readTextPrompt, setVideoLoaded, startRecordingVideo, videoUrl]);
10579
+ }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, setVideoLoaded, startRecordingVideo, videoUrl]);
10553
10580
  useEffect(function () {
10554
10581
  if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
10555
10582
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
@@ -10559,9 +10586,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10559
10586
  useEffect(function () {
10560
10587
  shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady && !idModelError && (!readTextPrompt || microphoneReady);
10561
10588
  }, [cameraReady, idModelError, idModelsReady, microphoneReady, readTextPrompt, videoLoaded]);
10562
- var _27 = useState('SHOW_ID_FRONT'),
10563
- requestedAction = _27[0],
10564
- setRequestedAction = _27[1];
10589
+ var _28 = useState('SHOW_ID_FRONT'),
10590
+ requestedAction = _28[0],
10591
+ setRequestedAction = _28[1];
10565
10592
  useEffect(function startModelsWhenCapturing() {
10566
10593
  if (!shouldCaptureFrames.current && requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
10567
10594
  startIdModels();
@@ -10580,15 +10607,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10580
10607
  }
10581
10608
  });
10582
10609
  }, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
10583
- var _28 = useState(0),
10584
- currentDetectionScore = _28[0],
10585
- setCurrentDetectionScore = _28[1];
10586
10610
  var _29 = useState(0),
10587
- currentFocusScore = _29[0],
10588
- setCurrentFocusScore = _29[1];
10611
+ currentDetectionScore = _29[0],
10612
+ setCurrentDetectionScore = _29[1];
10589
10613
  var _30 = useState(0),
10590
- goodFramesCount = _30[0],
10591
- setGoodFramesCount = _30[1];
10614
+ currentFocusScore = _30[0],
10615
+ setCurrentFocusScore = _30[1];
10616
+ var _31 = useState(0),
10617
+ goodFramesCount = _31[0],
10618
+ setGoodFramesCount = _31[1];
10592
10619
  var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
10593
10620
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
10594
10621
  useEffect(function () {
@@ -10606,9 +10633,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10606
10633
  }
10607
10634
  });
10608
10635
  }, [idCaptureModelsEnabled, idCardFrontDetectionThreshold, onIdPredictionMade, idModelError]);
10609
- var _31 = useState(null),
10610
- idFrontCaptureStartedAt = _31[0],
10611
- setFirstGoodFrameTime = _31[1];
10636
+ var _32 = useState(null),
10637
+ idFrontCaptureStartedAt = _32[0],
10638
+ setFirstGoodFrameTime = _32[1];
10612
10639
  useEffect(function () {
10613
10640
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
10614
10641
  }, [goodFramesCount]);
@@ -10629,9 +10656,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10629
10656
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
10630
10657
  var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
10631
10658
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
10632
- var _32 = useState(),
10633
- countdownStartedAt = _32[0],
10634
- setCountdownStartedAt = _32[1];
10659
+ var _33 = useState(),
10660
+ countdownStartedAt = _33[0],
10661
+ setCountdownStartedAt = _33[1];
10635
10662
  var frameLock = useRef(false);
10636
10663
  var captureFrame = useCallback(function () {
10637
10664
  return __awaiter(void 0, void 0, void 0, function () {
@@ -10752,9 +10779,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10752
10779
  };
10753
10780
  }, [captureCountdownSeconds, captureFrame, countdownStartedAt, manualCountdown]);
10754
10781
  var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
10755
- var _33 = useState(0),
10756
- numFramesWithoutFaces = _33[0],
10757
- setNumFramesWithoutFaces = _33[1];
10782
+ var _34 = useState(0),
10783
+ numFramesWithoutFaces = _34[0],
10784
+ setNumFramesWithoutFaces = _34[1];
10758
10785
  useEffect(function () {
10759
10786
  if (!selfieModelError) {
10760
10787
  onSelfiePredictionMade(function (faces) {
@@ -10772,14 +10799,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10772
10799
  }
10773
10800
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
10774
10801
  var theme = useTheme();
10775
- var _34 = useTranslations(rawVerbiage, {
10802
+ var _35 = useTranslations(rawVerbiage, {
10776
10803
  faceNotCenteredText: 'Please move your face to the center...',
10777
10804
  searchingForIdCardText: 'Searching for ID card...',
10778
10805
  captureBtnText: 'Capture'
10779
10806
  }),
10780
- captureBtnText = _34.captureBtnText,
10781
- faceNotCenteredText = _34.faceNotCenteredText,
10782
- searchingForIdCardText = _34.searchingForIdCardText;
10807
+ captureBtnText = _35.captureBtnText,
10808
+ faceNotCenteredText = _35.faceNotCenteredText,
10809
+ searchingForIdCardText = _35.searchingForIdCardText;
10783
10810
  var debugScalingDetails = useDebugScalingDetails({
10784
10811
  enabled: debugMode,
10785
10812
  pageWidth: width,
@@ -11020,29 +11047,31 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11020
11047
  disableFaceDetectionWhileAudioCaptureMsDelay = _v === void 0 ? 2000 : _v,
11021
11048
  _w = _a.silentFallback,
11022
11049
  silentFallback = _w === void 0 ? false : _w,
11023
- _x = _a.assets,
11024
- assets = _x === void 0 ? {} : _x,
11025
- _y = _a.classNames,
11026
- classNames = _y === void 0 ? {} : _y,
11027
- _z = _a.colors,
11028
- colors = _z === void 0 ? {} : _z,
11029
- _0 = _a.verbiage,
11030
- verbiage = _0 === void 0 ? {} : _0,
11031
- _1 = _a.debugMode,
11032
- debugMode = _1 === void 0 ? false : _1;
11033
- var _2 = useContext(SubmissionContext),
11034
- submissionStatus = _2.submissionStatus,
11035
- idCaptureVideoUrl = _2.idCaptureVideoUrl,
11036
- idCaptureVideoAudioUrl = _2.idCaptureVideoAudioUrl,
11037
- idCaptureVideoIdFrontImage = _2.idCaptureVideoIdFrontImage,
11038
- idCaptureVideoIdBackImage = _2.idCaptureVideoIdBackImage,
11039
- setIdCaptureVideoUrl = _2.setIdCaptureVideoUrl,
11040
- setIdCaptureVideoIdFrontImage = _2.setIdCaptureVideoIdFrontImage,
11041
- setIdCaptureVideoIdBackImage = _2.setIdCaptureVideoIdBackImage,
11042
- setIdCaptureVideoAudioUrl = _2.setIdCaptureVideoAudioUrl;
11043
- var _3 = useState('CAPTURING_ID'),
11044
- captureState = _3[0],
11045
- setCaptureState = _3[1];
11050
+ _x = _a.mergeAVStreams,
11051
+ mergeAVStreams = _x === void 0 ? false : _x,
11052
+ _y = _a.assets,
11053
+ assets = _y === void 0 ? {} : _y,
11054
+ _z = _a.classNames,
11055
+ classNames = _z === void 0 ? {} : _z,
11056
+ _0 = _a.colors,
11057
+ colors = _0 === void 0 ? {} : _0,
11058
+ _1 = _a.verbiage,
11059
+ verbiage = _1 === void 0 ? {} : _1,
11060
+ _2 = _a.debugMode,
11061
+ debugMode = _2 === void 0 ? false : _2;
11062
+ var _3 = useContext(SubmissionContext),
11063
+ submissionStatus = _3.submissionStatus,
11064
+ idCaptureVideoUrl = _3.idCaptureVideoUrl,
11065
+ idCaptureVideoAudioUrl = _3.idCaptureVideoAudioUrl,
11066
+ idCaptureVideoIdFrontImage = _3.idCaptureVideoIdFrontImage,
11067
+ idCaptureVideoIdBackImage = _3.idCaptureVideoIdBackImage,
11068
+ setIdCaptureVideoUrl = _3.setIdCaptureVideoUrl,
11069
+ setIdCaptureVideoIdFrontImage = _3.setIdCaptureVideoIdFrontImage,
11070
+ setIdCaptureVideoIdBackImage = _3.setIdCaptureVideoIdBackImage,
11071
+ setIdCaptureVideoAudioUrl = _3.setIdCaptureVideoAudioUrl;
11072
+ var _4 = useState('CAPTURING_ID'),
11073
+ captureState = _4[0],
11074
+ setCaptureState = _4[1];
11046
11075
  useEffect(function () {
11047
11076
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
11048
11077
  }, [captureState, skipIdCapture]);
@@ -11073,9 +11102,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11073
11102
  var onVideoCaptureFaceNotDetected = useCallback(function () {
11074
11103
  setCaptureState('CHECKING_LIVENESS');
11075
11104
  }, []);
11076
- var _4 = useState(0),
11077
- attempt = _4[0],
11078
- setAttempt = _4[1];
11105
+ var _5 = useState(0),
11106
+ attempt = _5[0],
11107
+ setAttempt = _5[1];
11079
11108
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
11080
11109
  var onFaceCaptureExitAfterFailure = useCallback(function (resp, req) {
11081
11110
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -11116,11 +11145,13 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11116
11145
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
11117
11146
  debugMode: debugMode
11118
11147
  }, /*#__PURE__*/React__default.createElement(IdCaptureModelsProvider, {
11148
+ autoStart: false,
11119
11149
  documentDetectionModelUrl: (_c = (_b = idCaptureProps.assets) === null || _b === void 0 ? void 0 : _b.documentDetectionModelUrl) !== null && _c !== void 0 ? _c : '',
11120
11150
  focusModelUrl: (_e = (_d = idCaptureProps.assets) === null || _d === void 0 ? void 0 : _d.focusModelUrl) !== null && _e !== void 0 ? _e : '',
11121
11151
  onModelError: onIdCaptureModelError,
11122
11152
  modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
11123
11153
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
11154
+ autoStart: false,
11124
11155
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
11125
11156
  modelLoadTimeoutMs: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.modelLoadTimeoutMs
11126
11157
  }, /*#__PURE__*/React__default.createElement(PageContainer, {
@@ -11189,6 +11220,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11189
11220
  readTextPrompt: readTextPrompt,
11190
11221
  readTextTimeoutDurationMs: readTextTimeoutDurationMs,
11191
11222
  readTextMinReadingMs: readTextMinReadingMs,
11223
+ mergeAVStreams: mergeAVStreams,
11192
11224
  assets: assets.idVideoCapture,
11193
11225
  classNames: classNames.idVideoCapture,
11194
11226
  colors: colors.idVideoCapture,
@@ -11387,6 +11419,7 @@ var CompositeWizardComponent = function CompositeWizardComponent(_a) {
11387
11419
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
11388
11420
  debugMode: debugMode
11389
11421
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
11422
+ autoStart: false,
11390
11423
  onModelError: faceLivenessProps.onModelError,
11391
11424
  modelLoadTimeoutMs: faceLivenessProps.modelLoadTimeoutMs
11392
11425
  }, /*#__PURE__*/React__default.createElement(FaceLivenessWizard, __assign({}, faceLivenessProps, {
@@ -11406,10 +11439,15 @@ var CompositeWizardComponent = function CompositeWizardComponent(_a) {
11406
11439
  onCameraAccessDenied: onCameraAccessDenied,
11407
11440
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
11408
11441
  debugMode: debugMode
11442
+ }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
11443
+ autoStart: false,
11444
+ throttleMs: 250,
11445
+ onModelError: videoSignatureCaptureProps.onModelError,
11446
+ modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs
11409
11447
  }, /*#__PURE__*/React__default.createElement(VideoSignatureWizard, __assign({}, videoSignatureCaptureProps, {
11410
11448
  onComplete: onVideoSignatureComplete,
11411
11449
  onRetryClicked: onVideoSignatureRetry
11412
- })));
11450
+ }))));
11413
11451
  case 'AdditionalDocumentCapture':
11414
11452
  return /*#__PURE__*/React__default.createElement(AdditionalDocumentCaptureWizard, __assign({}, additionalDocumentCaptureProps, {
11415
11453
  documents: documents,
@@ -12736,6 +12774,16 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12736
12774
  var _m = useContext(CameraStateContext),
12737
12775
  cameraAccessDenied = _m.cameraAccessDenied,
12738
12776
  releaseCameraAccess = _m.releaseCameraAccess;
12777
+ var _o = useContext(SelfieGuidanceModelsContext),
12778
+ start = _o.start,
12779
+ stop = _o.stop;
12780
+ useEffect(function () {
12781
+ if (captureState !== 'CAPTURING') return;
12782
+ start();
12783
+ return function () {
12784
+ stop();
12785
+ };
12786
+ }, [captureState, start, stop]);
12739
12787
  var onCustomerMatchedCallback = useCallback(function (resp, req) {
12740
12788
  return __awaiter(void 0, void 0, void 0, function () {
12741
12789
  return __generator(this, function (_a) {
@@ -12758,9 +12806,9 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12758
12806
  setCaptureState('FAILED');
12759
12807
  onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
12760
12808
  }, [onCaptureGuidanceTimeout]);
12761
- var _o = useState(0),
12762
- attempt = _o[0],
12763
- setAttempt = _o[1];
12809
+ var _p = useState(0),
12810
+ attempt = _p[0],
12811
+ setAttempt = _p[1];
12764
12812
  var onExitCallback = useCallback(function () {
12765
12813
  setAttempt(function (n) {
12766
12814
  return n + 1;
@@ -12934,6 +12982,7 @@ var CustomerVerification = function CustomerVerification(_a) {
12934
12982
  onCameraAccessDenied: onCameraAccessDenied,
12935
12983
  debugMode: debugMode
12936
12984
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
12985
+ autoStart: false,
12937
12986
  onModelError: onModelError,
12938
12987
  modelLoadTimeoutMs: modelLoadTimeoutMs
12939
12988
  }, /*#__PURE__*/React__default.createElement(CustomerVerificationWizard, {
@@ -13280,6 +13329,16 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13280
13329
  var _m = useContext(CameraStateContext),
13281
13330
  cameraAccessDenied = _m.cameraAccessDenied,
13282
13331
  releaseCameraAccess = _m.releaseCameraAccess;
13332
+ var _o = useContext(SelfieGuidanceModelsContext),
13333
+ start = _o.start,
13334
+ stop = _o.stop;
13335
+ useEffect(function () {
13336
+ if (captureState !== 'CAPTURING') return;
13337
+ start();
13338
+ return function () {
13339
+ stop();
13340
+ };
13341
+ }, [captureState, start, stop]);
13283
13342
  var onCustomerMatchedCallback = useCallback(function (resp, req) {
13284
13343
  return __awaiter(void 0, void 0, void 0, function () {
13285
13344
  return __generator(this, function (_a) {
@@ -13302,9 +13361,9 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13302
13361
  setCaptureState('FAILED');
13303
13362
  onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
13304
13363
  }, [onCaptureGuidanceTimeout]);
13305
- var _o = useState(0),
13306
- attempt = _o[0],
13307
- setAttempt = _o[1];
13364
+ var _p = useState(0),
13365
+ attempt = _p[0],
13366
+ setAttempt = _p[1];
13308
13367
  var onExitCallback = useCallback(function () {
13309
13368
  setAttempt(function (n) {
13310
13369
  return n + 1;
@@ -13476,6 +13535,7 @@ var CustomerIdentification = function CustomerIdentification(_a) {
13476
13535
  onCameraAccessDenied: onCameraAccessDenied,
13477
13536
  debugMode: debugMode
13478
13537
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
13538
+ autoStart: false,
13479
13539
  modelLoadTimeoutMs: modelLoadTimeoutMs,
13480
13540
  onModelError: onModelError
13481
13541
  }, /*#__PURE__*/React__default.createElement(CustomerIdentificationWizard, {
@@ -13660,28 +13720,30 @@ var VideoIdValidation = function VideoIdValidation(_a) {
13660
13720
  disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
13661
13721
  _x = _a.silentFallback,
13662
13722
  silentFallback = _x === void 0 ? false : _x,
13663
- _y = _a.theme,
13664
- theme = _y === void 0 ? 'default' : _y,
13665
- _z = _a.assets,
13666
- assets = _z === void 0 ? {} : _z,
13667
- _0 = _a.classNames,
13668
- classNames = _0 === void 0 ? {} : _0,
13669
- _1 = _a.colors,
13670
- colors = _1 === void 0 ? {} : _1,
13671
- _2 = _a.verbiage,
13672
- verbiage = _2 === void 0 ? {} : _2,
13673
- _3 = _a.captureSignature,
13674
- captureSignature = _3 === void 0 ? false : _3,
13675
- _4 = _a.captureSignatureVideo,
13676
- captureSignatureVideo = _4 === void 0 ? false : _4,
13677
- _5 = _a.captureAdditionalDocuments,
13678
- captureAdditionalDocuments = _5 === void 0 ? [] : _5,
13679
- _6 = _a.geolocationEnabled,
13680
- geolocationEnabled = _6 === void 0 ? true : _6,
13681
- _7 = _a.geolocationRequired,
13682
- geolocationRequired = _7 === void 0 ? false : _7,
13683
- _8 = _a.debugMode,
13684
- debugMode = _8 === void 0 ? false : _8;
13723
+ _y = _a.mergeAVStreams,
13724
+ mergeAVStreams = _y === void 0 ? false : _y,
13725
+ _z = _a.theme,
13726
+ theme = _z === void 0 ? 'default' : _z,
13727
+ _0 = _a.assets,
13728
+ assets = _0 === void 0 ? {} : _0,
13729
+ _1 = _a.classNames,
13730
+ classNames = _1 === void 0 ? {} : _1,
13731
+ _2 = _a.colors,
13732
+ colors = _2 === void 0 ? {} : _2,
13733
+ _3 = _a.verbiage,
13734
+ verbiage = _3 === void 0 ? {} : _3,
13735
+ _4 = _a.captureSignature,
13736
+ captureSignature = _4 === void 0 ? false : _4,
13737
+ _5 = _a.captureSignatureVideo,
13738
+ captureSignatureVideo = _5 === void 0 ? false : _5,
13739
+ _6 = _a.captureAdditionalDocuments,
13740
+ captureAdditionalDocuments = _6 === void 0 ? [] : _6,
13741
+ _7 = _a.geolocationEnabled,
13742
+ geolocationEnabled = _7 === void 0 ? true : _7,
13743
+ _8 = _a.geolocationRequired,
13744
+ geolocationRequired = _8 === void 0 ? false : _8,
13745
+ _9 = _a.debugMode,
13746
+ debugMode = _9 === void 0 ? false : _9;
13685
13747
  useLanguage(lang);
13686
13748
  useDebugLogging(debugMode);
13687
13749
  var videoIdCaptureProps = useMemo(function () {
@@ -13712,13 +13774,14 @@ var VideoIdValidation = function VideoIdValidation(_a) {
13712
13774
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
13713
13775
  disableFaceDetectionWhileAudioCaptureMsDelay: disableFaceDetectionWhileAudioCaptureMsDelay,
13714
13776
  silentFallback: silentFallback,
13777
+ mergeAVStreams: mergeAVStreams,
13715
13778
  assets: assets,
13716
13779
  classNames: classNames,
13717
13780
  colors: colors,
13718
13781
  verbiage: verbiage,
13719
13782
  debugMode: debugMode
13720
13783
  };
13721
- }, [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]);
13784
+ }, [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]);
13722
13785
  var additionalDocumentCaptureProps = useMemo(function () {
13723
13786
  return {
13724
13787
  documents: captureAdditionalDocuments,