idmission-web-sdk 2.3.58 → 2.3.59

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.
Files changed (28) hide show
  1. package/dist/components/CompositeWizard.d.ts.map +1 -1
  2. package/dist/components/camera/CameraVideoTag.d.ts.map +1 -1
  3. package/dist/components/face_liveness/FaceLivenessWizard.d.ts +6 -1
  4. package/dist/components/face_liveness/FaceLivenessWizard.d.ts.map +1 -1
  5. package/dist/components/id_capture/IdCaptureWizard.d.ts +7 -1
  6. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  7. package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
  8. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  9. package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
  10. package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +1 -2
  11. package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
  12. package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
  13. package/dist/lib/camera/cameraStore.d.ts +3 -3
  14. package/dist/lib/camera/cameraStore.d.ts.map +1 -1
  15. package/dist/lib/camera/useVideoRecorder.d.ts +1 -2
  16. package/dist/lib/camera/useVideoRecorder.d.ts.map +1 -1
  17. package/dist/sdk2.cjs.development.js +161 -150
  18. package/dist/sdk2.cjs.development.js.map +1 -1
  19. package/dist/sdk2.cjs.production.js +1 -1
  20. package/dist/sdk2.cjs.production.js.map +1 -1
  21. package/dist/sdk2.esm.js +161 -150
  22. package/dist/sdk2.esm.js.map +1 -1
  23. package/dist/sdk2.umd.development.js +161 -150
  24. package/dist/sdk2.umd.development.js.map +1 -1
  25. package/dist/sdk2.umd.production.js +1 -1
  26. package/dist/sdk2.umd.production.js.map +1 -1
  27. package/dist/version.d.ts +1 -1
  28. package/package.json +1 -1
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.3.58';
214
+ var webSdkVersion = '2.3.59';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9610,8 +9610,8 @@
9610
9610
  release: release
9611
9611
  };
9612
9612
  log('camera access granted');
9613
- if (video) video.srcObject = stream;
9614
- log('video source initialized');
9613
+ // if (video) video.srcObject = stream
9614
+ // log('video source initialized')
9615
9615
  return currentCamera;
9616
9616
  }
9617
9617
  function releaseCameraAccess() {
@@ -13534,24 +13534,24 @@
13534
13534
  }, [fallbacks, i18n.language, t, verbiage]);
13535
13535
  }
13536
13536
 
13537
+ var camera = null;
13538
+ var videoStream = null;
13539
+ var audioStream = null;
13537
13540
  var initialState$6 = {
13538
13541
  videoRef: {
13539
13542
  current: null
13540
13543
  },
13541
13544
  videoLoaded: false,
13542
- videoStream: null,
13543
13545
  videoDevice: null,
13544
13546
  videoWidth: 0,
13545
13547
  videoHeight: 0,
13546
13548
  isRearFacing: false,
13547
- camera: null,
13548
13549
  cameraReady: false,
13549
13550
  cameraAccessDenied: false,
13550
13551
  iphoneContinuityCameraAvailable: false,
13551
13552
  iphoneContinuityCameraDenied: false,
13552
13553
  preferIphoneContinuityCamera: true,
13553
13554
  cameraTamperingDetected: false,
13554
- audioStream: null,
13555
13555
  microphoneReady: false,
13556
13556
  microphoneAccessDenied: false
13557
13557
  };
@@ -13565,8 +13565,7 @@
13565
13565
  return set(config);
13566
13566
  },
13567
13567
  onVideoMounted: function onVideoMounted(e) {
13568
- var _a;
13569
- var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
13568
+ var selectedVideoStreamId = videoStream === null || videoStream === void 0 ? void 0 : videoStream.id;
13570
13569
  if (!selectedVideoStreamId) return;
13571
13570
  var srcObject = e.currentTarget.srcObject;
13572
13571
  if (srcObject.id === selectedVideoStreamId) {
@@ -13586,19 +13585,19 @@
13586
13585
  },
13587
13586
  requestCameraAccess: function requestCameraAccess() {
13588
13587
  return __awaiter(this, void 0, void 0, function () {
13589
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
13590
- var _b, _c, _d;
13591
- return __generator(this, function (_e) {
13592
- switch (_e.label) {
13588
+ var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, e_3;
13589
+ var _b, _c, _d, _e;
13590
+ return __generator(this, function (_f) {
13591
+ switch (_f.label) {
13593
13592
  case 0:
13594
13593
  _a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
13595
13594
  releaseCameraAccess();
13596
- _e.label = 1;
13595
+ _f.label = 1;
13597
13596
  case 1:
13598
- _e.trys.push([1, 11,, 12]);
13597
+ _f.trys.push([1, 11,, 12]);
13599
13598
  return [4 /*yield*/, listAvailableCameras()];
13600
13599
  case 2:
13601
- availableCameras = _e.sent();
13600
+ availableCameras = _f.sent();
13602
13601
  selectedCamera = void 0;
13603
13602
  debug('availableCameras', availableCameras);
13604
13603
  platform_1 = getPlatform();
@@ -13668,16 +13667,16 @@
13668
13667
  };
13669
13668
  }
13670
13669
  stream_1 = null;
13671
- _e.label = 3;
13670
+ _f.label = 3;
13672
13671
  case 3:
13673
- _e.trys.push([3, 5,, 6]);
13672
+ _f.trys.push([3, 5,, 6]);
13674
13673
  debug('obtaining camera access with constraints', constraints);
13675
13674
  return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
13676
13675
  case 4:
13677
- stream_1 = _e.sent();
13676
+ stream_1 = _f.sent();
13678
13677
  return [3 /*break*/, 6];
13679
13678
  case 5:
13680
- e_1 = _e.sent();
13679
+ e_1 = _f.sent();
13681
13680
  if (e_1.name === 'NotAllowedError') {
13682
13681
  if (preferIphoneContinuityCamera) {
13683
13682
  set({
@@ -13694,19 +13693,19 @@
13694
13693
  return [3 /*break*/, 6];
13695
13694
  case 6:
13696
13695
  if (!!stream_1) return [3 /*break*/, 10];
13697
- _e.label = 7;
13696
+ _f.label = 7;
13698
13697
  case 7:
13699
- _e.trys.push([7, 9,, 10]);
13698
+ _f.trys.push([7, 9,, 10]);
13700
13699
  return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
13701
13700
  audio: false,
13702
13701
  video: true
13703
13702
  })];
13704
13703
  case 8:
13705
- stream_1 = _e.sent();
13704
+ stream_1 = _f.sent();
13706
13705
  debug('opened stream with no width and height constraints');
13707
13706
  return [3 /*break*/, 10];
13708
13707
  case 9:
13709
- e_2 = _e.sent();
13708
+ e_2 = _f.sent();
13710
13709
  debug('cannot open stream at all', e_2);
13711
13710
  return [3 /*break*/, 10];
13712
13711
  case 10:
@@ -13718,8 +13717,8 @@
13718
13717
  handleStreamEnded_1 = function handleStreamEnded_1() {
13719
13718
  if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
13720
13719
  debug('someone unplugged the continuity camera');
13720
+ videoStream = null;
13721
13721
  set({
13722
- videoStream: null,
13723
13722
  videoDevice: null,
13724
13723
  cameraReady: false,
13725
13724
  iphoneContinuityCameraAvailable: false,
@@ -13728,9 +13727,9 @@
13728
13727
  get().requestCameraAccess();
13729
13728
  } else {
13730
13729
  debug('someone unplugged the webcam');
13731
- releaseCameraAccess();
13730
+ get().releaseCameraAccess();
13731
+ videoStream = null;
13732
13732
  set({
13733
- videoStream: null,
13734
13733
  videoDevice: null,
13735
13734
  videoLoaded: false,
13736
13735
  cameraReady: false,
@@ -13741,25 +13740,26 @@
13741
13740
  (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
13742
13741
  videoTrack_1 = stream_1.getVideoTracks()[0];
13743
13742
  videoTrack_1.onended = handleStreamEnded_1;
13744
- camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
13743
+ camera = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
13745
13744
  setTimeout(function () {
13745
+ var _a;
13746
13746
  // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
13747
13747
  // when the camera access is being requested. This delay is a workaround for that.
13748
13748
  videoTrack_1.onmute = function () {
13749
13749
  if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
13750
13750
  };
13751
+ videoStream = stream_1;
13752
+ var isRearFacing = (_a = camera === null || camera === void 0 ? void 0 : camera.isRearFacing) !== null && _a !== void 0 ? _a : false;
13751
13753
  set({
13752
- camera: camera_1,
13753
13754
  cameraReady: true,
13754
13755
  cameraAccessDenied: false,
13755
- isRearFacing: camera_1.isRearFacing,
13756
- videoStream: stream_1
13756
+ isRearFacing: isRearFacing
13757
13757
  });
13758
13758
  }, 500);
13759
13759
  return [3 /*break*/, 12];
13760
13760
  case 11:
13761
- e_3 = _e.sent();
13762
- if (e_3.name === 'NotAllowedError') {
13761
+ e_3 = _f.sent();
13762
+ if (e_3.name === 'NotAllowedError' || ((_e = e_3.message) === null || _e === void 0 ? void 0 : _e.includes('Could not start video source'))) {
13763
13763
  error('camera access has been blocked by the user', e_3);
13764
13764
  set({
13765
13765
  cameraAccessDenied: true
@@ -13777,17 +13777,18 @@
13777
13777
  },
13778
13778
  releaseCameraAccess: function releaseCameraAccess() {
13779
13779
  return __awaiter(this, void 0, void 0, function () {
13780
- var camera;
13781
13780
  return __generator(this, function (_a) {
13782
- camera = get().camera;
13783
13781
  if (!camera) return [2 /*return*/];
13784
13782
  camera.release();
13783
+ camera = null;
13784
+ videoStream === null || videoStream === void 0 ? void 0 : videoStream.getTracks().forEach(function (track) {
13785
+ track.stop();
13786
+ });
13787
+ videoStream = null;
13785
13788
  set({
13786
- camera: null,
13787
13789
  cameraReady: false,
13788
13790
  cameraAccessDenied: false,
13789
13791
  videoDevice: null,
13790
- videoStream: null,
13791
13792
  videoLoaded: false
13792
13793
  });
13793
13794
  return [2 /*return*/];
@@ -13816,8 +13817,8 @@
13816
13817
  // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
13817
13818
  // when the camera access is being requested. This delay is a workaround for that.
13818
13819
  setTimeout(function () {
13820
+ audioStream = stream_2;
13819
13821
  set({
13820
- audioStream: stream_2,
13821
13822
  microphoneReady: true,
13822
13823
  microphoneAccessDenied: false
13823
13824
  });
@@ -13826,6 +13827,7 @@
13826
13827
  microphoneReady: false,
13827
13828
  microphoneAccessDenied: true
13828
13829
  });
13830
+ get().releaseMicrophoneAccess();
13829
13831
  };
13830
13832
  var track = stream_2.getAudioTracks()[0];
13831
13833
  track.onended = handleStreamEnded;
@@ -13849,14 +13851,13 @@
13849
13851
  },
13850
13852
  releaseMicrophoneAccess: function releaseMicrophoneAccess() {
13851
13853
  var _a;
13852
- var audioStream = get().audioStream;
13853
13854
  (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
13854
13855
  audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
13855
13856
  var _a;
13856
13857
  (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
13857
13858
  });
13859
+ audioStream = null;
13858
13860
  set({
13859
- audioStream: null,
13860
13861
  microphoneReady: false,
13861
13862
  microphoneAccessDenied: false
13862
13863
  });
@@ -15757,15 +15758,13 @@
15757
15758
  _q = _o.height,
15758
15759
  height = _q === void 0 ? 1 : _q;
15759
15760
  var state = useIdCaptureStore();
15760
- var _r = useCameraStore(),
15761
- camera = _r.camera,
15762
- isRearFacing = _r.isRearFacing;
15763
- var _s = React.useContext(IdCaptureModelsContext),
15764
- modelsReady = _s.ready,
15765
- setThresholds = _s.setThresholds,
15766
- detectionTime = _s.detectionTime,
15767
- focusPredictionTime = _s.focusPredictionTime,
15768
- getBestFrame = _s.getBestFrame;
15761
+ var isRearFacing = useCameraStore().isRearFacing;
15762
+ var _r = React.useContext(IdCaptureModelsContext),
15763
+ modelsReady = _r.ready,
15764
+ setThresholds = _r.setThresholds,
15765
+ detectionTime = _r.detectionTime,
15766
+ focusPredictionTime = _r.focusPredictionTime,
15767
+ getBestFrame = _r.getBestFrame;
15769
15768
  React.useEffect(function () {
15770
15769
  return dispatchIdCaptureAction({
15771
15770
  type: 'captureInitialized'
@@ -18210,9 +18209,7 @@
18210
18209
  var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
18211
18210
  state = _c[0],
18212
18211
  dispatch = _c[1];
18213
- var _d = useCameraStore(),
18214
- videoStream = _d.videoStream,
18215
- videoRef = _d.videoRef;
18212
+ var videoRef = useCameraStore().videoRef;
18216
18213
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
18217
18214
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
18218
18215
  return __awaiter(void 0, void 0, void 0, function () {
@@ -18306,7 +18303,7 @@
18306
18303
  }, [onResize]);
18307
18304
  var videoTag = videoRef.current;
18308
18305
  React.useEffect(function () {
18309
- if (!state.capturing || !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active)) return;
18306
+ if (!state.capturing) return;
18310
18307
  function onComplete(content) {
18311
18308
  if (!content) return;
18312
18309
  var contentUrl = URL.createObjectURL(content);
@@ -18323,7 +18320,7 @@
18323
18320
  drawToCanvas(canvas, videoTag);
18324
18321
  canvas.toBlob(onComplete);
18325
18322
  }
18326
- }, [state.capturing, videoStream, videoTag]);
18323
+ }, [state.capturing, videoTag]);
18327
18324
  var stateWithActions = React.useMemo(function () {
18328
18325
  return _assign(_assign({}, state), {
18329
18326
  uploadCapturedDocument: uploadCapturedDocument
@@ -18452,29 +18449,28 @@
18452
18449
  var CameraVideoTag = function CameraVideoTag(props) {
18453
18450
  var _a = useCameraStore(useShallow(function (store) {
18454
18451
  return {
18452
+ cameraReady: store.cameraReady,
18455
18453
  videoRef: store.videoRef,
18456
- videoStream: store.videoStream,
18457
18454
  onVideoMounted: store.onVideoMounted,
18458
18455
  isRearFacing: store.isRearFacing
18459
18456
  };
18460
18457
  })),
18458
+ cameraReady = _a.cameraReady,
18461
18459
  videoRef = _a.videoRef,
18462
- videoStream = _a.videoStream,
18463
18460
  onVideoMounted = _a.onVideoMounted,
18464
18461
  isRearFacing = _a.isRearFacing;
18465
- React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
18466
- if (videoRef.current && videoStream) {
18467
- debug('attaching camera stream to video tag');
18468
- // eslint-disable-next-line react-compiler/react-compiler
18469
- videoRef.current.srcObject = videoStream;
18470
- }
18471
- }, [videoStream, videoRef]);
18462
+ React.useEffect(function () {
18463
+ if (!cameraReady || !videoRef.current) return;
18464
+ debug('attaching camera stream to video tag');
18465
+ // eslint-disable-next-line react-compiler/react-compiler
18466
+ videoRef.current.srcObject = videoStream;
18467
+ }, [cameraReady, videoRef]);
18472
18468
  return /*#__PURE__*/React.createElement(FullscreenVideoTag, _assign({
18473
18469
  autoPlay: true,
18474
18470
  playsInline: true,
18475
18471
  muted: true,
18476
18472
  ref: videoRef,
18477
- onLoadedData: onVideoMounted,
18473
+ onCanPlay: onVideoMounted,
18478
18474
  "$isRearFacing": isRearFacing
18479
18475
  }, props));
18480
18476
  };
@@ -18511,7 +18507,6 @@
18511
18507
  content = _k.content,
18512
18508
  uploadState = _k.uploadState;
18513
18509
  var _l = useCameraStore(),
18514
- videoStream = _l.videoStream,
18515
18510
  cameraReady = _l.cameraReady,
18516
18511
  cameraAccessDenied = _l.cameraAccessDenied,
18517
18512
  requestCameraAccess = _l.requestCameraAccess;
@@ -18526,7 +18521,7 @@
18526
18521
  // and the user hasn't passed a media blob for the current document...
18527
18522
  !cameraAccessRequested &&
18528
18523
  // and we haven't already tried to force a camera request...
18529
- !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active); // and we don't already have camera access.
18524
+ !cameraReady; // and we don't already have camera access.
18530
18525
  React.useEffect(function requestCameraAccessIfNeeded() {
18531
18526
  if (!cameraAccessNeeded) return;
18532
18527
  setCameraAccessRequested(true);
@@ -19951,6 +19946,30 @@
19951
19946
  debugMode: debugMode
19952
19947
  })));
19953
19948
  };
19949
+ function IdCaptureWizardWithProviders(_a) {
19950
+ var _b, _c, _d, _e, _f, _g;
19951
+ var onCameraAccessDenied = _a.onCameraAccessDenied,
19952
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
19953
+ onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
19954
+ shouldLoadIdCaptureModels = _a.shouldLoadIdCaptureModels,
19955
+ idCaptureProps = __rest(_a, ["onCameraAccessDenied", "onCameraTamperingDetected", "onMicrophoneAccessDenied", "shouldLoadIdCaptureModels"]);
19956
+ return /*#__PURE__*/React.createElement(CameraStoreProvider, {
19957
+ onCameraAccessDenied: onCameraAccessDenied,
19958
+ onCameraTamperingDetected: onCameraTamperingDetected,
19959
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
19960
+ requestAccessAutomatically: shouldLoadIdCaptureModels,
19961
+ classNames: (_b = idCaptureProps.classNames) === null || _b === void 0 ? void 0 : _b.cameraStoreProvider,
19962
+ verbiage: (_c = idCaptureProps.verbiage) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider
19963
+ }, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
19964
+ autoStart: false,
19965
+ shouldLoadModels: shouldLoadIdCaptureModels,
19966
+ documentDetectionModelUrl: (_e = (_d = idCaptureProps.assets) === null || _d === void 0 ? void 0 : _d.documentDetectionModelUrl) !== null && _e !== void 0 ? _e : '',
19967
+ focusModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.focusModelUrl) !== null && _g !== void 0 ? _g : '',
19968
+ onModelError: idCaptureProps.onModelError,
19969
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
19970
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
19971
+ }, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps))))));
19972
+ }
19954
19973
 
19955
19974
  function SelfieCaptureLoadingGraphic(_a) {
19956
19975
  var _b, _c, _d;
@@ -20964,9 +20983,6 @@
20964
20983
  prediction = _o.prediction,
20965
20984
  dispatch = _m[1];
20966
20985
  var lastPredictionCanvas = React.useRef(null);
20967
- var camera = useCameraStore(useShallow(function (state) {
20968
- return state.camera;
20969
- }));
20970
20986
  var _p = React.useContext(SelfieGuidanceModelsContext),
20971
20987
  onPredictionMade = _p.onPredictionMade,
20972
20988
  canvasRef = _p.canvasRef,
@@ -22142,6 +22158,26 @@
22142
22158
  waitForIdCaptureModels: waitForIdCaptureModels
22143
22159
  })));
22144
22160
  };
22161
+ function FaceLivenessWizardWithProviders(_a) {
22162
+ var _b, _c;
22163
+ var onCameraAccessDenied = _a.onCameraAccessDenied,
22164
+ onCameraTamperingDetected = _a.onCameraTamperingDetected,
22165
+ onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
22166
+ faceLivenessProps = __rest(_a, ["onCameraAccessDenied", "onCameraTamperingDetected", "onMicrophoneAccessDenied"]);
22167
+ return /*#__PURE__*/React.createElement(CameraStoreProvider, {
22168
+ preferFrontFacingCamera: true,
22169
+ preferIphoneContinuityCamera: false,
22170
+ onCameraAccessDenied: onCameraAccessDenied,
22171
+ onCameraTamperingDetected: onCameraTamperingDetected,
22172
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
22173
+ classNames: (_b = faceLivenessProps.classNames) === null || _b === void 0 ? void 0 : _b.cameraStoreProvider,
22174
+ verbiage: (_c = faceLivenessProps.verbiage) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider
22175
+ }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
22176
+ autoStart: false,
22177
+ onModelError: faceLivenessProps.onModelError,
22178
+ modelLoadTimeoutMs: faceLivenessProps.modelLoadTimeoutMs
22179
+ }, /*#__PURE__*/React.createElement(FaceLivenessWizard, _assign({}, faceLivenessProps))));
22180
+ }
22145
22181
 
22146
22182
  var SubmissionSuccess = function SubmissionSuccess() {
22147
22183
  var _a = React.useContext(SubmissionContext),
@@ -23326,12 +23362,16 @@
23326
23362
  };
23327
23363
  var useVideoRecorderStore = create$1()(devtools(function (set, get) {
23328
23364
  return _assign(_assign({}, initialState$2), {
23329
- startRecordingVideo: function startRecordingVideo(camera, audioStream) {
23365
+ startRecordingVideo: function startRecordingVideo(captureAudio) {
23330
23366
  var _a, _b, _c;
23367
+ if (captureAudio === void 0) {
23368
+ captureAudio = false;
23369
+ }
23370
+ if (!camera) throw new Error('Camera not found');
23331
23371
  var _d = get(),
23332
23372
  mergeAVStreams = _d.mergeAVStreams,
23333
23373
  startRecordingAudio = _d.startRecordingAudio;
23334
- var videoStream = mergeAVStreams ? new MediaStream(__spreadArray(__spreadArray([], (_b = (_a = camera === null || camera === void 0 ? void 0 : camera.stream) === null || _a === void 0 ? void 0 : _a.getTracks()) !== null && _b !== void 0 ? _b : [], true), (_c = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getTracks()) !== null && _c !== void 0 ? _c : [], true)) : camera.stream;
23374
+ var videoStream = mergeAVStreams ? new MediaStream(__spreadArray(__spreadArray([], (_b = (_a = camera === null || camera === void 0 ? void 0 : camera.stream) === null || _a === void 0 ? void 0 : _a.getTracks()) !== null && _b !== void 0 ? _b : [], true), captureAudio ? (_c = audioStream === null || audioStream === void 0 ? void 0 : audioStream.getTracks()) !== null && _c !== void 0 ? _c : [] : [], true)) : camera.stream;
23335
23375
  if (!videoStream) return;
23336
23376
  clearVideoChunks();
23337
23377
  videoRecorder = null;
@@ -23359,8 +23399,8 @@
23359
23399
  // TODO: figure out what to do here
23360
23400
  }
23361
23401
  }, 100);
23362
- if (audioStream && !mergeAVStreams) {
23363
- startRecordingAudio(audioStream);
23402
+ if (captureAudio && !mergeAVStreams) {
23403
+ startRecordingAudio();
23364
23404
  }
23365
23405
  },
23366
23406
  stopRecordingVideo: function stopRecordingVideo() {
@@ -23371,7 +23411,7 @@
23371
23411
  videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
23372
23412
  }
23373
23413
  },
23374
- startRecordingAudio: function startRecordingAudio(audioStream) {
23414
+ startRecordingAudio: function startRecordingAudio() {
23375
23415
  if (get().mergeAVStreams) return;
23376
23416
  if (!audioStream) return;
23377
23417
  clearAudioChunks();
@@ -23505,18 +23545,19 @@
23505
23545
  };
23506
23546
  var useVideoSignatureStore = create$1()(devtools(function (set, get) {
23507
23547
  return _assign(_assign({}, videoSignatureInitialState), {
23508
- startRecording: function startRecording(camera, audioStream, captureAudio) {
23548
+ startRecording: function startRecording(captureAudio) {
23509
23549
  var _a;
23510
23550
  if (captureAudio === void 0) {
23511
23551
  captureAudio = false;
23512
23552
  }
23553
+ if (!camera) throw new Error('Camera not found');
23513
23554
  // set our flag and clear whatever we have recorded so far.
23514
23555
  set({
23515
23556
  isRecording: true
23516
23557
  });
23517
23558
  signatureChunks = [];
23518
23559
  // start recording video and audio
23519
- useVideoRecorderStore.getState().startRecordingVideo(camera, captureAudio ? audioStream : undefined);
23560
+ useVideoRecorderStore.getState().startRecordingVideo(captureAudio);
23520
23561
  // start recording from the output canvas to capture the signature
23521
23562
  var videoStream = get().outputCanvas.current.captureStream(24); // fps
23522
23563
  var tracks = [videoStream.getVideoTracks()[0]];
@@ -23810,14 +23851,10 @@
23810
23851
  debugMode = _l === void 0 ? false : _l;
23811
23852
  var _m = useCameraStore(useShallow(function (state) {
23812
23853
  return {
23813
- camera: state.camera,
23814
- audioStream: state.audioStream,
23815
23854
  videoWidth: state.videoWidth,
23816
23855
  videoHeight: state.videoHeight
23817
23856
  };
23818
23857
  })),
23819
- camera = _m.camera,
23820
- audioStream = _m.audioStream,
23821
23858
  videoWidth = _m.videoWidth,
23822
23859
  videoHeight = _m.videoHeight;
23823
23860
  var _o = useSelfieGuidanceModelsContext(),
@@ -23825,8 +23862,6 @@
23825
23862
  startHeadTracking = _o.start,
23826
23863
  stopHeadTracking = _o.stop;
23827
23864
  var _p = useVideoSignatureStore(),
23828
- startRecording = _p.startRecording,
23829
- stopRecording = _p.stopRecording,
23830
23865
  clearRecordedData = _p.clearRecordedData,
23831
23866
  isRecording = _p.isRecording;
23832
23867
  React.useEffect(function () {
@@ -23835,10 +23870,11 @@
23835
23870
  });
23836
23871
  }, [onSignatureVideoCaptured]);
23837
23872
  React.useEffect(function () {
23838
- if (!camera) return;
23839
- startRecording(camera, audioStream, captureAudio);
23840
- return stopRecording;
23841
- }, [audioStream, camera, captureAudio, startRecording, stopRecording]);
23873
+ useVideoSignatureStore.getState().startRecording(captureAudio);
23874
+ return function () {
23875
+ return useVideoSignatureStore.getState().stopRecording();
23876
+ };
23877
+ }, [captureAudio]);
23842
23878
  React.useEffect(function () {
23843
23879
  setTimeout(startHeadTracking, 1);
23844
23880
  return stopHeadTracking;
@@ -23859,7 +23895,7 @@
23859
23895
  setNumFramesWithoutFaces = _s[1];
23860
23896
  onHeadTrackingPredictionMade(f(React.useCallback(function (_a) {
23861
23897
  var face = _a.face;
23862
- if (!camera || headTrackingDisabled) return;
23898
+ if (headTrackingDisabled) return;
23863
23899
  var leftEdge = videoWidth * headTrackingBoundaryPercentage;
23864
23900
  var rightEdge = videoWidth * (1 - headTrackingBoundaryPercentage);
23865
23901
  var topEdge = videoHeight * headTrackingBoundaryPercentage;
@@ -23870,7 +23906,7 @@
23870
23906
  setNumFramesWithoutFaces(face ? 0 : function (n) {
23871
23907
  return n + 1;
23872
23908
  });
23873
- }, [camera, headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
23909
+ }, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
23874
23910
  var _t = useResizeObserver(),
23875
23911
  ref = _t.ref,
23876
23912
  _u = _t.width,
@@ -23913,7 +23949,7 @@
23913
23949
  face: lastFace,
23914
23950
  scaling: debugScalingDetails,
23915
23951
  color: headTrackingSatisfied ? 'green' : 'red'
23916
- }))), /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", camera === null || camera === void 0 ? void 0 : camera.width, "x", camera === null || camera === void 0 ? void 0 : camera.height, /*#__PURE__*/React.createElement("br", null), "Recording: ", isRecording ? 'true' : 'false'))), /*#__PURE__*/React.createElement(ExitCaptureButton, {
23952
+ }))), /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React.createElement("br", null), "Recording: ", isRecording ? 'true' : 'false'))), /*#__PURE__*/React.createElement(ExitCaptureButton, {
23917
23953
  onClick: onExit,
23918
23954
  className: classNames.exitCaptureBtn
23919
23955
  }));
@@ -24419,9 +24455,6 @@
24419
24455
  component = _a.component,
24420
24456
  props = __rest(_a, ["status", "restartVideoOnSignaturePadCleared", "captureAudio", "component"]);
24421
24457
  var Component = component !== null && component !== void 0 ? component : VideoSignatureGuides;
24422
- var _d = useCameraStore(),
24423
- camera = _d.camera,
24424
- audioStream = _d.audioStream;
24425
24458
  var onAcceptBtnClicked = React.useCallback(function () {
24426
24459
  var signaturePad = useVideoSignatureStore.getState().signaturePad;
24427
24460
  if (!signaturePad.current) throw new Error('Signature pad not found');
@@ -24443,11 +24476,11 @@
24443
24476
  setTimeout(function () {
24444
24477
  useVideoSignatureStore.getState().clearRecordedData();
24445
24478
  setTimeout(function () {
24446
- useVideoSignatureStore.getState().startRecording(camera, audioStream, captureAudio);
24479
+ useVideoSignatureStore.getState().startRecording(captureAudio);
24447
24480
  }, 100);
24448
24481
  }, 100);
24449
24482
  }
24450
- }, [audioStream, camera, captureAudio, restartVideoOnSignaturePadCleared]);
24483
+ }, [captureAudio, restartVideoOnSignaturePadCleared]);
24451
24484
  return /*#__PURE__*/React.createElement(Component, _assign({}, props, {
24452
24485
  faceGuideStatus: status,
24453
24486
  onAcceptBtnClicked: onAcceptBtnClicked,
@@ -24801,12 +24834,10 @@
24801
24834
  _9 = _7.height,
24802
24835
  height = _9 === void 0 ? 1 : _9;
24803
24836
  var _10 = useCameraStore(),
24804
- camera = _10.camera,
24805
24837
  videoRef = _10.videoRef,
24806
24838
  videoLoaded = _10.videoLoaded,
24807
24839
  cameraReady = _10.cameraReady,
24808
24840
  microphoneReady = _10.microphoneReady,
24809
- audioStream = _10.audioStream,
24810
24841
  isRearFacing = _10.isRearFacing,
24811
24842
  releaseCameraAccess = _10.releaseCameraAccess;
24812
24843
  var _11 = React.useState([]),
@@ -24848,8 +24879,8 @@
24848
24879
  countdownRemaining = _18[0],
24849
24880
  setCountdownRemaining = _18[1];
24850
24881
  React.useEffect(function () {
24851
- if (camera && !isRecordingVideo && !videoUrl) {
24852
- useVideoRecorderStore.getState().startRecordingVideo(camera, audioStream);
24882
+ if (!isRecordingVideo && !videoUrl) {
24883
+ useVideoRecorderStore.getState().startRecordingVideo();
24853
24884
  setVideoStartsAt(new Date());
24854
24885
  }
24855
24886
  // if the mergeAVStreams flag is present, the audio stream is on the video
@@ -24860,7 +24891,7 @@
24860
24891
  releaseCameraAccess();
24861
24892
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
24862
24893
  }
24863
- }, [audioStream, audioUrl, camera, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, videoUrl]);
24894
+ }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, videoUrl]);
24864
24895
  React.useEffect(function () {
24865
24896
  if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
24866
24897
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
@@ -24955,14 +24986,14 @@
24955
24986
  var _a;
24956
24987
  if (translatedText) {
24957
24988
  setRequestedAction('READ_TEXT');
24958
- useVideoRecorderStore.getState().startRecordingAudio(audioStream);
24989
+ useVideoRecorderStore.getState().startRecordingAudio();
24959
24990
  setIdCaptureVideoAudioStartsAt(new Date().getTime() - ((_a = videoStartsAt === null || videoStartsAt === void 0 ? void 0 : videoStartsAt.getTime()) !== null && _a !== void 0 ? _a : 0));
24960
24991
  var renderedTranslatedText = typeof translatedText === 'string' ? translatedText : server.renderToString(translatedText);
24961
24992
  setExpectedAudioText(renderedTranslatedText);
24962
24993
  } else {
24963
24994
  useVideoRecorderStore.getState().stopRecordingVideo();
24964
24995
  }
24965
- }, [audioStream, setExpectedAudioText, setIdCaptureVideoAudioStartsAt, translatedText, videoStartsAt]);
24996
+ }, [setExpectedAudioText, setIdCaptureVideoAudioStartsAt, translatedText, videoStartsAt]);
24966
24997
  var frameWidth = (_c = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) !== null && _c !== void 0 ? _c : 0;
24967
24998
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
24968
24999
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
@@ -25594,36 +25625,36 @@
25594
25625
  };
25595
25626
 
25596
25627
  function CompositeWizard(_a) {
25597
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
25628
+ var _b;
25598
25629
  var userChecks = _a.checks,
25599
- _l = _a.idCaptureProps,
25600
- idCaptureProps = _l === void 0 ? {} : _l,
25601
- _m = _a.faceLivenessProps,
25602
- faceLivenessProps = _m === void 0 ? {} : _m,
25630
+ _c = _a.idCaptureProps,
25631
+ idCaptureProps = _c === void 0 ? {} : _c,
25632
+ _d = _a.faceLivenessProps,
25633
+ faceLivenessProps = _d === void 0 ? {} : _d,
25603
25634
  additionalDocumentCaptureProps = _a.additionalDocumentCaptureProps,
25604
- _o = _a.signatureCaptureProps,
25605
- signatureCaptureProps = _o === void 0 ? {} : _o,
25606
- _p = _a.videoSignatureCaptureProps,
25607
- videoSignatureCaptureProps = _p === void 0 ? {} : _p,
25608
- _q = _a.videoIdCaptureProps,
25609
- videoIdCaptureProps = _q === void 0 ? {} : _q,
25610
- _r = _a.captureSignature,
25611
- captureSignature = _r === void 0 ? false : _r,
25612
- _s = _a.captureSignatureVideo,
25613
- captureSignatureVideo = _s === void 0 ? false : _s,
25635
+ _e = _a.signatureCaptureProps,
25636
+ signatureCaptureProps = _e === void 0 ? {} : _e,
25637
+ _f = _a.videoSignatureCaptureProps,
25638
+ videoSignatureCaptureProps = _f === void 0 ? {} : _f,
25639
+ _g = _a.videoIdCaptureProps,
25640
+ videoIdCaptureProps = _g === void 0 ? {} : _g,
25641
+ _h = _a.captureSignature,
25642
+ captureSignature = _h === void 0 ? false : _h,
25643
+ _j = _a.captureSignatureVideo,
25644
+ captureSignatureVideo = _j === void 0 ? false : _j,
25614
25645
  onCameraAccessDenied = _a.onCameraAccessDenied,
25615
25646
  onCameraTamperingDetected = _a.onCameraTamperingDetected,
25616
25647
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
25617
- _t = _a.debugMode,
25618
- debugMode = _t === void 0 ? false : _t;
25619
- var _u = React.useContext(SubmissionContext),
25620
- submit = _u.submit,
25621
- submissionStatus = _u.submissionStatus,
25622
- setSignatureData = _u.setSignatureData,
25623
- setAdditionalDocuments = _u.setAdditionalDocuments;
25624
- var _v = React.useState(0),
25625
- checkIndex = _v[0],
25626
- setCheckIndex = _v[1];
25648
+ _k = _a.debugMode,
25649
+ debugMode = _k === void 0 ? false : _k;
25650
+ var _l = React.useContext(SubmissionContext),
25651
+ submit = _l.submit,
25652
+ submissionStatus = _l.submissionStatus,
25653
+ setSignatureData = _l.setSignatureData,
25654
+ setAdditionalDocuments = _l.setAdditionalDocuments;
25655
+ var _m = React.useState(0),
25656
+ checkIndex = _m[0],
25657
+ setCheckIndex = _m[1];
25627
25658
  var checks = React.useMemo(function () {
25628
25659
  var _a, _b;
25629
25660
  var checks = __spreadArray([], userChecks, true);
@@ -25730,24 +25761,13 @@
25730
25761
  var shouldLoadIdCaptureModels = !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode) && !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.allowUploadingDocumentsFromStorage);
25731
25762
  switch (checks[checkIndex]) {
25732
25763
  case 'IdCapture':
25733
- return /*#__PURE__*/React.createElement(CameraStoreProvider, {
25764
+ return /*#__PURE__*/React.createElement(IdCaptureWizardWithProviders, _assign({}, idCaptureProps, {
25734
25765
  onCameraAccessDenied: onCameraAccessDenied,
25735
25766
  onCameraTamperingDetected: onCameraTamperingDetected,
25736
25767
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
25737
- requestAccessAutomatically: shouldLoadIdCaptureModels,
25738
- classNames: (_c = idCaptureProps.classNames) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider,
25739
- verbiage: (_d = idCaptureProps.verbiage) === null || _d === void 0 ? void 0 : _d.cameraStoreProvider
25740
- }, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
25741
- autoStart: false,
25742
- shouldLoadModels: shouldLoadIdCaptureModels,
25743
- documentDetectionModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.documentDetectionModelUrl) !== null && _f !== void 0 ? _f : '',
25744
- focusModelUrl: (_h = (_g = idCaptureProps.assets) === null || _g === void 0 ? void 0 : _g.focusModelUrl) !== null && _h !== void 0 ? _h : '',
25745
- onModelError: idCaptureProps.onModelError,
25746
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
25747
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
25748
- }, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
25768
+ shouldLoadIdCaptureModels: shouldLoadIdCaptureModels,
25749
25769
  onSuccess: onIdCaptureSuccess
25750
- }))))));
25770
+ }));
25751
25771
  case 'VideoIdCapture':
25752
25772
  return /*#__PURE__*/React.createElement(VideoIdWizard, _assign({}, videoIdCaptureProps, {
25753
25773
  onComplete: onVideoIdCaptureComplete,
@@ -25756,21 +25776,12 @@
25756
25776
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
25757
25777
  }));
25758
25778
  case 'FaceLiveness':
25759
- return /*#__PURE__*/React.createElement(CameraStoreProvider, {
25760
- preferFrontFacingCamera: true,
25761
- preferIphoneContinuityCamera: false,
25779
+ return /*#__PURE__*/React.createElement(FaceLivenessWizardWithProviders, _assign({}, faceLivenessProps, {
25762
25780
  onCameraAccessDenied: onCameraAccessDenied,
25763
25781
  onCameraTamperingDetected: onCameraTamperingDetected,
25764
25782
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
25765
- classNames: (_j = faceLivenessProps.classNames) === null || _j === void 0 ? void 0 : _j.cameraStoreProvider,
25766
- verbiage: (_k = faceLivenessProps.verbiage) === null || _k === void 0 ? void 0 : _k.cameraStoreProvider
25767
- }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
25768
- autoStart: false,
25769
- onModelError: faceLivenessProps.onModelError,
25770
- modelLoadTimeoutMs: faceLivenessProps.modelLoadTimeoutMs
25771
- }, /*#__PURE__*/React.createElement(FaceLivenessWizard, _assign({}, faceLivenessProps, {
25772
25783
  onComplete: onFaceLivenessComplete
25773
- }))));
25784
+ }));
25774
25785
  case 'SignatureCapture':
25775
25786
  return /*#__PURE__*/React.createElement(SignatureCapture, _assign({}, signatureCaptureProps, {
25776
25787
  onAccept: onSignatureCaptureSuccess