idmission-web-sdk 2.3.57 → 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 (30) 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/IdCaptureStateProvider.d.ts +11 -2
  6. package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
  7. package/dist/components/id_capture/IdCaptureWizard.d.ts +7 -1
  8. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  9. package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
  10. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  11. package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
  12. package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +12 -4
  13. package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
  14. package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
  15. package/dist/lib/camera/cameraStore.d.ts +3 -3
  16. package/dist/lib/camera/cameraStore.d.ts.map +1 -1
  17. package/dist/lib/camera/useVideoRecorder.d.ts +12 -4
  18. package/dist/lib/camera/useVideoRecorder.d.ts.map +1 -1
  19. package/dist/sdk2.cjs.development.js +165 -152
  20. package/dist/sdk2.cjs.development.js.map +1 -1
  21. package/dist/sdk2.cjs.production.js +1 -1
  22. package/dist/sdk2.cjs.production.js.map +1 -1
  23. package/dist/sdk2.esm.js +165 -152
  24. package/dist/sdk2.esm.js.map +1 -1
  25. package/dist/sdk2.umd.development.js +234 -399
  26. package/dist/sdk2.umd.development.js.map +1 -1
  27. package/dist/sdk2.umd.production.js +1 -1
  28. package/dist/sdk2.umd.production.js.map +1 -1
  29. package/dist/version.d.ts +1 -1
  30. package/package.json +3 -3
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('react-dom'), require('tus-js-client'), require('prop-types')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom/client', 'platform', 'styled-components', 'react-dom', 'tus-js-client', 'prop-types'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.ReactDOM, global.platform, global.styled, global.ReactDOM, global.tusJsClient, global.PropTypes));
5
- })(this, (function (exports, React, ReactDOM, platform, styled, reactDom, tusJsClient, require$$0) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('react-dom'), require('tus-js-client'), require('prop-types'), require('react-dom/server')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom/client', 'platform', 'styled-components', 'react-dom', 'tus-js-client', 'prop-types', 'react-dom/server'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.ReactDOM, global.platform, global.styled, global.ReactDOM, global.tusJsClient, global.PropTypes, global.server));
5
+ })(this, (function (exports, React, ReactDOM, platform, styled, reactDom, tusJsClient, require$$0, server) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -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.57';
214
+ var webSdkVersion = '2.3.59';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9477,18 +9477,11 @@
9477
9477
  return listeners["delete"](listener);
9478
9478
  };
9479
9479
  };
9480
- var destroy = function destroy() {
9481
- if ((undefined ? undefined.MODE : void 0) !== "production") {
9482
- console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.");
9483
- }
9484
- listeners.clear();
9485
- };
9486
9480
  var api = {
9487
9481
  setState: setState,
9488
9482
  getState: getState,
9489
9483
  getInitialState: getInitialState,
9490
- subscribe: subscribe,
9491
- destroy: destroy
9484
+ subscribe: subscribe
9492
9485
  };
9493
9486
  var initialState = state = createState(setState, getState, api);
9494
9487
  return api;
@@ -9497,213 +9490,25 @@
9497
9490
  return createState ? createStoreImpl(createState) : createStoreImpl;
9498
9491
  };
9499
9492
 
9500
- var withSelector = {exports: {}};
9501
-
9502
- var shim = {exports: {}};
9503
-
9504
- var useSyncExternalStoreShim_development = {};
9505
-
9506
- /**
9507
- * @license React
9508
- * use-sync-external-store-shim.development.js
9509
- *
9510
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9511
- *
9512
- * This source code is licensed under the MIT license found in the
9513
- * LICENSE file in the root directory of this source tree.
9514
- */
9515
- var hasRequiredUseSyncExternalStoreShim_development;
9516
- function requireUseSyncExternalStoreShim_development() {
9517
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
9518
- hasRequiredUseSyncExternalStoreShim_development = 1;
9519
- (function () {
9520
- function is(x, y) {
9521
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
9522
- }
9523
- function useSyncExternalStore$2(subscribe, getSnapshot) {
9524
- didWarnOld18Alpha || void 0 === React$1.startTransition || (didWarnOld18Alpha = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
9525
- var value = getSnapshot();
9526
- if (!didWarnUncachedGetSnapshot) {
9527
- var cachedValue = getSnapshot();
9528
- objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0);
9529
- }
9530
- cachedValue = useState({
9531
- inst: {
9532
- value: value,
9533
- getSnapshot: getSnapshot
9534
- }
9535
- });
9536
- var inst = cachedValue[0].inst,
9537
- forceUpdate = cachedValue[1];
9538
- useLayoutEffect(function () {
9539
- inst.value = value;
9540
- inst.getSnapshot = getSnapshot;
9541
- checkIfSnapshotChanged(inst) && forceUpdate({
9542
- inst: inst
9543
- });
9544
- }, [subscribe, value, getSnapshot]);
9545
- useEffect(function () {
9546
- checkIfSnapshotChanged(inst) && forceUpdate({
9547
- inst: inst
9548
- });
9549
- return subscribe(function () {
9550
- checkIfSnapshotChanged(inst) && forceUpdate({
9551
- inst: inst
9552
- });
9553
- });
9554
- }, [subscribe]);
9555
- useDebugValue(value);
9556
- return value;
9557
- }
9558
- function checkIfSnapshotChanged(inst) {
9559
- var latestGetSnapshot = inst.getSnapshot;
9560
- inst = inst.value;
9561
- try {
9562
- var nextValue = latestGetSnapshot();
9563
- return !objectIs(inst, nextValue);
9564
- } catch (error) {
9565
- return !0;
9566
- }
9567
- }
9568
- function useSyncExternalStore$1(subscribe, getSnapshot) {
9569
- return getSnapshot();
9570
- }
9571
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
9572
- var React$1 = React,
9573
- objectIs = "function" === typeof Object.is ? Object.is : is,
9574
- useState = React$1.useState,
9575
- useEffect = React$1.useEffect,
9576
- useLayoutEffect = React$1.useLayoutEffect,
9577
- useDebugValue = React$1.useDebugValue,
9578
- didWarnOld18Alpha = !1,
9579
- didWarnUncachedGetSnapshot = !1,
9580
- shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
9581
- useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim;
9582
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
9583
- })();
9584
- return useSyncExternalStoreShim_development;
9585
- }
9586
-
9587
- var hasRequiredShim;
9588
- function requireShim() {
9589
- if (hasRequiredShim) return shim.exports;
9590
- hasRequiredShim = 1;
9591
- {
9592
- shim.exports = requireUseSyncExternalStoreShim_development();
9593
- }
9594
- return shim.exports;
9595
- }
9596
-
9597
- var withSelector_development = {};
9598
-
9599
- /**
9600
- * @license React
9601
- * use-sync-external-store-shim/with-selector.development.js
9602
- *
9603
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9604
- *
9605
- * This source code is licensed under the MIT license found in the
9606
- * LICENSE file in the root directory of this source tree.
9607
- */
9608
- var hasRequiredWithSelector_development;
9609
- function requireWithSelector_development() {
9610
- if (hasRequiredWithSelector_development) return withSelector_development;
9611
- hasRequiredWithSelector_development = 1;
9612
- (function () {
9613
- function is(x, y) {
9614
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
9615
- }
9616
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
9617
- var React$1 = React,
9618
- shim = requireShim(),
9619
- objectIs = "function" === typeof Object.is ? Object.is : is,
9620
- useSyncExternalStore = shim.useSyncExternalStore,
9621
- useRef = React$1.useRef,
9622
- useEffect = React$1.useEffect,
9623
- useMemo = React$1.useMemo,
9624
- useDebugValue = React$1.useDebugValue;
9625
- withSelector_development.useSyncExternalStoreWithSelector = function (subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
9626
- var instRef = useRef(null);
9627
- if (null === instRef.current) {
9628
- var inst = {
9629
- hasValue: !1,
9630
- value: null
9631
- };
9632
- instRef.current = inst;
9633
- } else inst = instRef.current;
9634
- instRef = useMemo(function () {
9635
- function memoizedSelector(nextSnapshot) {
9636
- if (!hasMemo) {
9637
- hasMemo = !0;
9638
- memoizedSnapshot = nextSnapshot;
9639
- nextSnapshot = selector(nextSnapshot);
9640
- if (void 0 !== isEqual && inst.hasValue) {
9641
- var currentSelection = inst.value;
9642
- if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
9643
- }
9644
- return memoizedSelection = nextSnapshot;
9645
- }
9646
- currentSelection = memoizedSelection;
9647
- if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
9648
- var nextSelection = selector(nextSnapshot);
9649
- if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
9650
- memoizedSnapshot = nextSnapshot;
9651
- return memoizedSelection = nextSelection;
9652
- }
9653
- var hasMemo = !1,
9654
- memoizedSnapshot,
9655
- memoizedSelection,
9656
- maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
9657
- return [function () {
9658
- return memoizedSelector(getSnapshot());
9659
- }, null === maybeGetServerSnapshot ? void 0 : function () {
9660
- return memoizedSelector(maybeGetServerSnapshot());
9661
- }];
9662
- }, [getSnapshot, getServerSnapshot, selector, isEqual]);
9663
- var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
9664
- useEffect(function () {
9665
- inst.hasValue = !0;
9666
- inst.value = value;
9667
- }, [value]);
9668
- useDebugValue(value);
9669
- return value;
9670
- };
9671
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
9672
- })();
9673
- return withSelector_development;
9674
- }
9675
-
9676
- {
9677
- withSelector.exports = requireWithSelector_development();
9678
- }
9679
- var withSelectorExports = withSelector.exports;
9680
- var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelectorExports);
9681
-
9682
- var useDebugValue = React.useDebugValue;
9683
- var useSyncExternalStoreWithSelector = useSyncExternalStoreExports.useSyncExternalStoreWithSelector;
9684
- var didWarnAboutEqualityFn = false;
9685
9493
  var identity = function identity(arg) {
9686
9494
  return arg;
9687
9495
  };
9688
- function useStore(api, selector, equalityFn) {
9496
+ function useStore(api, selector) {
9689
9497
  if (selector === void 0) {
9690
9498
  selector = identity;
9691
9499
  }
9692
- if ((undefined ? undefined.MODE : void 0) !== "production" && equalityFn && !didWarnAboutEqualityFn) {
9693
- console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937");
9694
- didWarnAboutEqualityFn = true;
9695
- }
9696
- var slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getInitialState, selector, equalityFn);
9697
- useDebugValue(slice);
9500
+ var slice = React.useSyncExternalStore(api.subscribe, function () {
9501
+ return selector(api.getState());
9502
+ }, function () {
9503
+ return selector(api.getInitialState());
9504
+ });
9505
+ React.useDebugValue(slice);
9698
9506
  return slice;
9699
9507
  }
9700
9508
  var createImpl = function createImpl(createState) {
9701
- if ((undefined ? undefined.MODE : void 0) !== "production" && typeof createState !== "function") {
9702
- console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");
9703
- }
9704
- var api = typeof createState === "function" ? createStore(createState) : createState;
9705
- var useBoundStore = function useBoundStore(selector, equalityFn) {
9706
- return useStore(api, selector, equalityFn);
9509
+ var api = createStore(createState);
9510
+ var useBoundStore = function useBoundStore(selector) {
9511
+ return useStore(api, selector);
9707
9512
  };
9708
9513
  Object.assign(useBoundStore, api);
9709
9514
  return useBoundStore;
@@ -9805,8 +9610,8 @@
9805
9610
  release: release
9806
9611
  };
9807
9612
  log('camera access granted');
9808
- if (video) video.srcObject = stream;
9809
- log('video source initialized');
9613
+ // if (video) video.srcObject = stream
9614
+ // log('video source initialized')
9810
9615
  return currentCamera;
9811
9616
  }
9812
9617
  function releaseCameraAccess() {
@@ -13729,24 +13534,24 @@
13729
13534
  }, [fallbacks, i18n.language, t, verbiage]);
13730
13535
  }
13731
13536
 
13537
+ var camera = null;
13538
+ var videoStream = null;
13539
+ var audioStream = null;
13732
13540
  var initialState$6 = {
13733
13541
  videoRef: {
13734
13542
  current: null
13735
13543
  },
13736
13544
  videoLoaded: false,
13737
- videoStream: null,
13738
13545
  videoDevice: null,
13739
13546
  videoWidth: 0,
13740
13547
  videoHeight: 0,
13741
13548
  isRearFacing: false,
13742
- camera: null,
13743
13549
  cameraReady: false,
13744
13550
  cameraAccessDenied: false,
13745
13551
  iphoneContinuityCameraAvailable: false,
13746
13552
  iphoneContinuityCameraDenied: false,
13747
13553
  preferIphoneContinuityCamera: true,
13748
13554
  cameraTamperingDetected: false,
13749
- audioStream: null,
13750
13555
  microphoneReady: false,
13751
13556
  microphoneAccessDenied: false
13752
13557
  };
@@ -13760,8 +13565,7 @@
13760
13565
  return set(config);
13761
13566
  },
13762
13567
  onVideoMounted: function onVideoMounted(e) {
13763
- var _a;
13764
- 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;
13765
13569
  if (!selectedVideoStreamId) return;
13766
13570
  var srcObject = e.currentTarget.srcObject;
13767
13571
  if (srcObject.id === selectedVideoStreamId) {
@@ -13781,19 +13585,19 @@
13781
13585
  },
13782
13586
  requestCameraAccess: function requestCameraAccess() {
13783
13587
  return __awaiter(this, void 0, void 0, function () {
13784
- 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;
13785
- var _b, _c, _d;
13786
- return __generator(this, function (_e) {
13787
- 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) {
13788
13592
  case 0:
13789
13593
  _a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
13790
13594
  releaseCameraAccess();
13791
- _e.label = 1;
13595
+ _f.label = 1;
13792
13596
  case 1:
13793
- _e.trys.push([1, 11,, 12]);
13597
+ _f.trys.push([1, 11,, 12]);
13794
13598
  return [4 /*yield*/, listAvailableCameras()];
13795
13599
  case 2:
13796
- availableCameras = _e.sent();
13600
+ availableCameras = _f.sent();
13797
13601
  selectedCamera = void 0;
13798
13602
  debug('availableCameras', availableCameras);
13799
13603
  platform_1 = getPlatform();
@@ -13863,16 +13667,16 @@
13863
13667
  };
13864
13668
  }
13865
13669
  stream_1 = null;
13866
- _e.label = 3;
13670
+ _f.label = 3;
13867
13671
  case 3:
13868
- _e.trys.push([3, 5,, 6]);
13672
+ _f.trys.push([3, 5,, 6]);
13869
13673
  debug('obtaining camera access with constraints', constraints);
13870
13674
  return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
13871
13675
  case 4:
13872
- stream_1 = _e.sent();
13676
+ stream_1 = _f.sent();
13873
13677
  return [3 /*break*/, 6];
13874
13678
  case 5:
13875
- e_1 = _e.sent();
13679
+ e_1 = _f.sent();
13876
13680
  if (e_1.name === 'NotAllowedError') {
13877
13681
  if (preferIphoneContinuityCamera) {
13878
13682
  set({
@@ -13889,19 +13693,19 @@
13889
13693
  return [3 /*break*/, 6];
13890
13694
  case 6:
13891
13695
  if (!!stream_1) return [3 /*break*/, 10];
13892
- _e.label = 7;
13696
+ _f.label = 7;
13893
13697
  case 7:
13894
- _e.trys.push([7, 9,, 10]);
13698
+ _f.trys.push([7, 9,, 10]);
13895
13699
  return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
13896
13700
  audio: false,
13897
13701
  video: true
13898
13702
  })];
13899
13703
  case 8:
13900
- stream_1 = _e.sent();
13704
+ stream_1 = _f.sent();
13901
13705
  debug('opened stream with no width and height constraints');
13902
13706
  return [3 /*break*/, 10];
13903
13707
  case 9:
13904
- e_2 = _e.sent();
13708
+ e_2 = _f.sent();
13905
13709
  debug('cannot open stream at all', e_2);
13906
13710
  return [3 /*break*/, 10];
13907
13711
  case 10:
@@ -13913,8 +13717,8 @@
13913
13717
  handleStreamEnded_1 = function handleStreamEnded_1() {
13914
13718
  if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
13915
13719
  debug('someone unplugged the continuity camera');
13720
+ videoStream = null;
13916
13721
  set({
13917
- videoStream: null,
13918
13722
  videoDevice: null,
13919
13723
  cameraReady: false,
13920
13724
  iphoneContinuityCameraAvailable: false,
@@ -13923,9 +13727,9 @@
13923
13727
  get().requestCameraAccess();
13924
13728
  } else {
13925
13729
  debug('someone unplugged the webcam');
13926
- releaseCameraAccess();
13730
+ get().releaseCameraAccess();
13731
+ videoStream = null;
13927
13732
  set({
13928
- videoStream: null,
13929
13733
  videoDevice: null,
13930
13734
  videoLoaded: false,
13931
13735
  cameraReady: false,
@@ -13936,25 +13740,26 @@
13936
13740
  (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
13937
13741
  videoTrack_1 = stream_1.getVideoTracks()[0];
13938
13742
  videoTrack_1.onended = handleStreamEnded_1;
13939
- camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
13743
+ camera = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
13940
13744
  setTimeout(function () {
13745
+ var _a;
13941
13746
  // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
13942
13747
  // when the camera access is being requested. This delay is a workaround for that.
13943
13748
  videoTrack_1.onmute = function () {
13944
13749
  if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
13945
13750
  };
13751
+ videoStream = stream_1;
13752
+ var isRearFacing = (_a = camera === null || camera === void 0 ? void 0 : camera.isRearFacing) !== null && _a !== void 0 ? _a : false;
13946
13753
  set({
13947
- camera: camera_1,
13948
13754
  cameraReady: true,
13949
13755
  cameraAccessDenied: false,
13950
- isRearFacing: camera_1.isRearFacing,
13951
- videoStream: stream_1
13756
+ isRearFacing: isRearFacing
13952
13757
  });
13953
13758
  }, 500);
13954
13759
  return [3 /*break*/, 12];
13955
13760
  case 11:
13956
- e_3 = _e.sent();
13957
- 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'))) {
13958
13763
  error('camera access has been blocked by the user', e_3);
13959
13764
  set({
13960
13765
  cameraAccessDenied: true
@@ -13972,17 +13777,18 @@
13972
13777
  },
13973
13778
  releaseCameraAccess: function releaseCameraAccess() {
13974
13779
  return __awaiter(this, void 0, void 0, function () {
13975
- var camera;
13976
13780
  return __generator(this, function (_a) {
13977
- camera = get().camera;
13978
13781
  if (!camera) return [2 /*return*/];
13979
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;
13980
13788
  set({
13981
- camera: null,
13982
13789
  cameraReady: false,
13983
13790
  cameraAccessDenied: false,
13984
13791
  videoDevice: null,
13985
- videoStream: null,
13986
13792
  videoLoaded: false
13987
13793
  });
13988
13794
  return [2 /*return*/];
@@ -14011,8 +13817,8 @@
14011
13817
  // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
14012
13818
  // when the camera access is being requested. This delay is a workaround for that.
14013
13819
  setTimeout(function () {
13820
+ audioStream = stream_2;
14014
13821
  set({
14015
- audioStream: stream_2,
14016
13822
  microphoneReady: true,
14017
13823
  microphoneAccessDenied: false
14018
13824
  });
@@ -14021,6 +13827,7 @@
14021
13827
  microphoneReady: false,
14022
13828
  microphoneAccessDenied: true
14023
13829
  });
13830
+ get().releaseMicrophoneAccess();
14024
13831
  };
14025
13832
  var track = stream_2.getAudioTracks()[0];
14026
13833
  track.onended = handleStreamEnded;
@@ -14044,14 +13851,13 @@
14044
13851
  },
14045
13852
  releaseMicrophoneAccess: function releaseMicrophoneAccess() {
14046
13853
  var _a;
14047
- var audioStream = get().audioStream;
14048
13854
  (_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
14049
13855
  audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
14050
13856
  var _a;
14051
13857
  (_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
14052
13858
  });
13859
+ audioStream = null;
14053
13860
  set({
14054
- audioStream: null,
14055
13861
  microphoneReady: false,
14056
13862
  microphoneAccessDenied: false
14057
13863
  });
@@ -14903,11 +14709,8 @@
14903
14709
  var extensionConnector;
14904
14710
  try {
14905
14711
  extensionConnector = (enabled != null ? enabled : (undefined ? undefined.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
14906
- } catch (_e) {}
14712
+ } catch (e) {}
14907
14713
  if (!extensionConnector) {
14908
- if ((undefined ? undefined.MODE : void 0) !== "production" && enabled) {
14909
- console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension");
14910
- }
14911
14714
  return fn(set, get, api);
14912
14715
  }
14913
14716
  var _extractConnectionInf = extractConnectionInformation(store, extensionConnector, options),
@@ -14978,7 +14781,7 @@
14978
14781
  return;
14979
14782
  }
14980
14783
  if (Object.keys(action.state).length !== 1) {
14981
- console.error("\n [zustand devtools middleware] Unsupported __setState action format. \n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");
14784
+ console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");
14982
14785
  }
14983
14786
  var stateFromDevtools = action.state[store];
14984
14787
  if (stateFromDevtools === void 0 || stateFromDevtools === null) {
@@ -15066,50 +14869,71 @@
15066
14869
  function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15067
14870
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15068
14871
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15069
- function shallow(objA, objB) {
15070
- if (Object.is(objA, objB)) {
15071
- return true;
15072
- }
15073
- if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
14872
+ var isIterable = function isIterable(obj) {
14873
+ return Symbol.iterator in obj;
14874
+ };
14875
+ var hasIterableEntries = function hasIterableEntries(value) {
14876
+ return (
14877
+ // HACK: avoid checking entries type
14878
+ "entries" in value
14879
+ );
14880
+ };
14881
+ var compareEntries = function compareEntries(valueA, valueB) {
14882
+ var mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
14883
+ var mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
14884
+ if (mapA.size !== mapB.size) {
15074
14885
  return false;
15075
14886
  }
15076
- if (objA instanceof Map && objB instanceof Map) {
15077
- if (objA.size !== objB.size) return false;
15078
- for (var _iterator = _createForOfIteratorHelperLoose(objA), _step; !(_step = _iterator()).done;) {
15079
- var _step$value = _step.value,
15080
- key = _step$value[0],
15081
- value = _step$value[1];
15082
- if (!Object.is(value, objB.get(key))) {
15083
- return false;
15084
- }
14887
+ for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
14888
+ var _step$value = _step.value,
14889
+ key = _step$value[0],
14890
+ value = _step$value[1];
14891
+ if (!Object.is(value, mapB.get(key))) {
14892
+ return false;
15085
14893
  }
15086
- return true;
15087
14894
  }
15088
- if (objA instanceof Set && objB instanceof Set) {
15089
- if (objA.size !== objB.size) return false;
15090
- for (var _iterator2 = _createForOfIteratorHelperLoose(objA), _step2; !(_step2 = _iterator2()).done;) {
15091
- var _value = _step2.value;
15092
- if (!objB.has(_value)) {
15093
- return false;
15094
- }
14895
+ return true;
14896
+ };
14897
+ var compareIterables = function compareIterables(valueA, valueB) {
14898
+ var iteratorA = valueA[Symbol.iterator]();
14899
+ var iteratorB = valueB[Symbol.iterator]();
14900
+ var nextA = iteratorA.next();
14901
+ var nextB = iteratorB.next();
14902
+ while (!nextA.done && !nextB.done) {
14903
+ if (!Object.is(nextA.value, nextB.value)) {
14904
+ return false;
15095
14905
  }
14906
+ nextA = iteratorA.next();
14907
+ nextB = iteratorB.next();
14908
+ }
14909
+ return !!nextA.done && !!nextB.done;
14910
+ };
14911
+ function shallow(valueA, valueB) {
14912
+ if (Object.is(valueA, valueB)) {
15096
14913
  return true;
15097
14914
  }
15098
- var keysA = Object.keys(objA);
15099
- if (keysA.length !== Object.keys(objB).length) {
14915
+ if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
15100
14916
  return false;
15101
14917
  }
15102
- for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
15103
- var keyA = _keysA[_i];
15104
- if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
15105
- return false;
15106
- }
14918
+ if (!isIterable(valueA) || !isIterable(valueB)) {
14919
+ return compareEntries({
14920
+ entries: function entries() {
14921
+ return Object.entries(valueA);
14922
+ }
14923
+ }, {
14924
+ entries: function entries() {
14925
+ return Object.entries(valueB);
14926
+ }
14927
+ });
15107
14928
  }
15108
- return true;
14929
+ if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
14930
+ return compareEntries(valueA, valueB);
14931
+ }
14932
+ return compareIterables(valueA, valueB);
15109
14933
  }
15110
- var useRef = React.useRef;
14934
+
15111
14935
  function useShallow(selector) {
15112
- var prev = useRef();
14936
+ var prev = React.useRef();
15113
14937
  return function (state) {
15114
14938
  var next = selector(state);
15115
14939
  return shallow(prev.current, next) ? prev.current : prev.current = next;
@@ -15934,15 +15758,13 @@
15934
15758
  _q = _o.height,
15935
15759
  height = _q === void 0 ? 1 : _q;
15936
15760
  var state = useIdCaptureStore();
15937
- var _r = useCameraStore(),
15938
- camera = _r.camera,
15939
- isRearFacing = _r.isRearFacing;
15940
- var _s = React.useContext(IdCaptureModelsContext),
15941
- modelsReady = _s.ready,
15942
- setThresholds = _s.setThresholds,
15943
- detectionTime = _s.detectionTime,
15944
- focusPredictionTime = _s.focusPredictionTime,
15945
- 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;
15946
15768
  React.useEffect(function () {
15947
15769
  return dispatchIdCaptureAction({
15948
15770
  type: 'captureInitialized'
@@ -18387,9 +18209,7 @@
18387
18209
  var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
18388
18210
  state = _c[0],
18389
18211
  dispatch = _c[1];
18390
- var _d = useCameraStore(),
18391
- videoStream = _d.videoStream,
18392
- videoRef = _d.videoRef;
18212
+ var videoRef = useCameraStore().videoRef;
18393
18213
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
18394
18214
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
18395
18215
  return __awaiter(void 0, void 0, void 0, function () {
@@ -18483,7 +18303,7 @@
18483
18303
  }, [onResize]);
18484
18304
  var videoTag = videoRef.current;
18485
18305
  React.useEffect(function () {
18486
- if (!state.capturing || !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active)) return;
18306
+ if (!state.capturing) return;
18487
18307
  function onComplete(content) {
18488
18308
  if (!content) return;
18489
18309
  var contentUrl = URL.createObjectURL(content);
@@ -18500,7 +18320,7 @@
18500
18320
  drawToCanvas(canvas, videoTag);
18501
18321
  canvas.toBlob(onComplete);
18502
18322
  }
18503
- }, [state.capturing, videoStream, videoTag]);
18323
+ }, [state.capturing, videoTag]);
18504
18324
  var stateWithActions = React.useMemo(function () {
18505
18325
  return _assign(_assign({}, state), {
18506
18326
  uploadCapturedDocument: uploadCapturedDocument
@@ -18629,29 +18449,28 @@
18629
18449
  var CameraVideoTag = function CameraVideoTag(props) {
18630
18450
  var _a = useCameraStore(useShallow(function (store) {
18631
18451
  return {
18452
+ cameraReady: store.cameraReady,
18632
18453
  videoRef: store.videoRef,
18633
- videoStream: store.videoStream,
18634
18454
  onVideoMounted: store.onVideoMounted,
18635
18455
  isRearFacing: store.isRearFacing
18636
18456
  };
18637
18457
  })),
18458
+ cameraReady = _a.cameraReady,
18638
18459
  videoRef = _a.videoRef,
18639
- videoStream = _a.videoStream,
18640
18460
  onVideoMounted = _a.onVideoMounted,
18641
18461
  isRearFacing = _a.isRearFacing;
18642
- React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
18643
- if (videoRef.current && videoStream) {
18644
- debug('attaching camera stream to video tag');
18645
- // eslint-disable-next-line react-compiler/react-compiler
18646
- videoRef.current.srcObject = videoStream;
18647
- }
18648
- }, [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]);
18649
18468
  return /*#__PURE__*/React.createElement(FullscreenVideoTag, _assign({
18650
18469
  autoPlay: true,
18651
18470
  playsInline: true,
18652
18471
  muted: true,
18653
18472
  ref: videoRef,
18654
- onLoadedData: onVideoMounted,
18473
+ onCanPlay: onVideoMounted,
18655
18474
  "$isRearFacing": isRearFacing
18656
18475
  }, props));
18657
18476
  };
@@ -18688,7 +18507,6 @@
18688
18507
  content = _k.content,
18689
18508
  uploadState = _k.uploadState;
18690
18509
  var _l = useCameraStore(),
18691
- videoStream = _l.videoStream,
18692
18510
  cameraReady = _l.cameraReady,
18693
18511
  cameraAccessDenied = _l.cameraAccessDenied,
18694
18512
  requestCameraAccess = _l.requestCameraAccess;
@@ -18703,7 +18521,7 @@
18703
18521
  // and the user hasn't passed a media blob for the current document...
18704
18522
  !cameraAccessRequested &&
18705
18523
  // and we haven't already tried to force a camera request...
18706
- !(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.
18707
18525
  React.useEffect(function requestCameraAccessIfNeeded() {
18708
18526
  if (!cameraAccessNeeded) return;
18709
18527
  setCameraAccessRequested(true);
@@ -19902,7 +19720,7 @@
19902
19720
  focusScore: metadata.bestFocusScore
19903
19721
  }
19904
19722
  });
19905
- }, [logCaptureMetadata]);
19723
+ }, [logCaptureMetadata, onDocumentCaptured]);
19906
19724
  var onSubmitClick = React.useCallback(function () {
19907
19725
  var _a, _b, _c, _d, _e, _f, _g, _h;
19908
19726
  var docs = state.capturedDocuments;
@@ -20128,6 +19946,30 @@
20128
19946
  debugMode: debugMode
20129
19947
  })));
20130
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
+ }
20131
19973
 
20132
19974
  function SelfieCaptureLoadingGraphic(_a) {
20133
19975
  var _b, _c, _d;
@@ -21141,9 +20983,6 @@
21141
20983
  prediction = _o.prediction,
21142
20984
  dispatch = _m[1];
21143
20985
  var lastPredictionCanvas = React.useRef(null);
21144
- var camera = useCameraStore(useShallow(function (state) {
21145
- return state.camera;
21146
- }));
21147
20986
  var _p = React.useContext(SelfieGuidanceModelsContext),
21148
20987
  onPredictionMade = _p.onPredictionMade,
21149
20988
  canvasRef = _p.canvasRef,
@@ -22319,6 +22158,26 @@
22319
22158
  waitForIdCaptureModels: waitForIdCaptureModels
22320
22159
  })));
22321
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
+ }
22322
22181
 
22323
22182
  var SubmissionSuccess = function SubmissionSuccess() {
22324
22183
  var _a = React.useContext(SubmissionContext),
@@ -23503,12 +23362,16 @@
23503
23362
  };
23504
23363
  var useVideoRecorderStore = create$1()(devtools(function (set, get) {
23505
23364
  return _assign(_assign({}, initialState$2), {
23506
- startRecordingVideo: function startRecordingVideo(camera, audioStream) {
23365
+ startRecordingVideo: function startRecordingVideo(captureAudio) {
23507
23366
  var _a, _b, _c;
23367
+ if (captureAudio === void 0) {
23368
+ captureAudio = false;
23369
+ }
23370
+ if (!camera) throw new Error('Camera not found');
23508
23371
  var _d = get(),
23509
23372
  mergeAVStreams = _d.mergeAVStreams,
23510
23373
  startRecordingAudio = _d.startRecordingAudio;
23511
- 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;
23512
23375
  if (!videoStream) return;
23513
23376
  clearVideoChunks();
23514
23377
  videoRecorder = null;
@@ -23536,8 +23399,8 @@
23536
23399
  // TODO: figure out what to do here
23537
23400
  }
23538
23401
  }, 100);
23539
- if (audioStream && !mergeAVStreams) {
23540
- startRecordingAudio(audioStream);
23402
+ if (captureAudio && !mergeAVStreams) {
23403
+ startRecordingAudio();
23541
23404
  }
23542
23405
  },
23543
23406
  stopRecordingVideo: function stopRecordingVideo() {
@@ -23548,7 +23411,7 @@
23548
23411
  videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.stop(); // if you call this while state === 'inactive', an exception is thrown.
23549
23412
  }
23550
23413
  },
23551
- startRecordingAudio: function startRecordingAudio(audioStream) {
23414
+ startRecordingAudio: function startRecordingAudio() {
23552
23415
  if (get().mergeAVStreams) return;
23553
23416
  if (!audioStream) return;
23554
23417
  clearAudioChunks();
@@ -23682,18 +23545,19 @@
23682
23545
  };
23683
23546
  var useVideoSignatureStore = create$1()(devtools(function (set, get) {
23684
23547
  return _assign(_assign({}, videoSignatureInitialState), {
23685
- startRecording: function startRecording(camera, audioStream, captureAudio) {
23548
+ startRecording: function startRecording(captureAudio) {
23686
23549
  var _a;
23687
23550
  if (captureAudio === void 0) {
23688
23551
  captureAudio = false;
23689
23552
  }
23553
+ if (!camera) throw new Error('Camera not found');
23690
23554
  // set our flag and clear whatever we have recorded so far.
23691
23555
  set({
23692
23556
  isRecording: true
23693
23557
  });
23694
23558
  signatureChunks = [];
23695
23559
  // start recording video and audio
23696
- useVideoRecorderStore.getState().startRecordingVideo(camera, captureAudio ? audioStream : undefined);
23560
+ useVideoRecorderStore.getState().startRecordingVideo(captureAudio);
23697
23561
  // start recording from the output canvas to capture the signature
23698
23562
  var videoStream = get().outputCanvas.current.captureStream(24); // fps
23699
23563
  var tracks = [videoStream.getVideoTracks()[0]];
@@ -23987,14 +23851,10 @@
23987
23851
  debugMode = _l === void 0 ? false : _l;
23988
23852
  var _m = useCameraStore(useShallow(function (state) {
23989
23853
  return {
23990
- camera: state.camera,
23991
- audioStream: state.audioStream,
23992
23854
  videoWidth: state.videoWidth,
23993
23855
  videoHeight: state.videoHeight
23994
23856
  };
23995
23857
  })),
23996
- camera = _m.camera,
23997
- audioStream = _m.audioStream,
23998
23858
  videoWidth = _m.videoWidth,
23999
23859
  videoHeight = _m.videoHeight;
24000
23860
  var _o = useSelfieGuidanceModelsContext(),
@@ -24002,8 +23862,6 @@
24002
23862
  startHeadTracking = _o.start,
24003
23863
  stopHeadTracking = _o.stop;
24004
23864
  var _p = useVideoSignatureStore(),
24005
- startRecording = _p.startRecording,
24006
- stopRecording = _p.stopRecording,
24007
23865
  clearRecordedData = _p.clearRecordedData,
24008
23866
  isRecording = _p.isRecording;
24009
23867
  React.useEffect(function () {
@@ -24012,10 +23870,11 @@
24012
23870
  });
24013
23871
  }, [onSignatureVideoCaptured]);
24014
23872
  React.useEffect(function () {
24015
- if (!camera) return;
24016
- startRecording(camera, audioStream, captureAudio);
24017
- return stopRecording;
24018
- }, [audioStream, camera, captureAudio, startRecording, stopRecording]);
23873
+ useVideoSignatureStore.getState().startRecording(captureAudio);
23874
+ return function () {
23875
+ return useVideoSignatureStore.getState().stopRecording();
23876
+ };
23877
+ }, [captureAudio]);
24019
23878
  React.useEffect(function () {
24020
23879
  setTimeout(startHeadTracking, 1);
24021
23880
  return stopHeadTracking;
@@ -24036,7 +23895,7 @@
24036
23895
  setNumFramesWithoutFaces = _s[1];
24037
23896
  onHeadTrackingPredictionMade(f(React.useCallback(function (_a) {
24038
23897
  var face = _a.face;
24039
- if (!camera || headTrackingDisabled) return;
23898
+ if (headTrackingDisabled) return;
24040
23899
  var leftEdge = videoWidth * headTrackingBoundaryPercentage;
24041
23900
  var rightEdge = videoWidth * (1 - headTrackingBoundaryPercentage);
24042
23901
  var topEdge = videoHeight * headTrackingBoundaryPercentage;
@@ -24047,7 +23906,7 @@
24047
23906
  setNumFramesWithoutFaces(face ? 0 : function (n) {
24048
23907
  return n + 1;
24049
23908
  });
24050
- }, [camera, headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
23909
+ }, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
24051
23910
  var _t = useResizeObserver(),
24052
23911
  ref = _t.ref,
24053
23912
  _u = _t.width,
@@ -24090,7 +23949,7 @@
24090
23949
  face: lastFace,
24091
23950
  scaling: debugScalingDetails,
24092
23951
  color: headTrackingSatisfied ? 'green' : 'red'
24093
- }))), /*#__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, {
24094
23953
  onClick: onExit,
24095
23954
  className: classNames.exitCaptureBtn
24096
23955
  }));
@@ -24596,9 +24455,6 @@
24596
24455
  component = _a.component,
24597
24456
  props = __rest(_a, ["status", "restartVideoOnSignaturePadCleared", "captureAudio", "component"]);
24598
24457
  var Component = component !== null && component !== void 0 ? component : VideoSignatureGuides;
24599
- var _d = useCameraStore(),
24600
- camera = _d.camera,
24601
- audioStream = _d.audioStream;
24602
24458
  var onAcceptBtnClicked = React.useCallback(function () {
24603
24459
  var signaturePad = useVideoSignatureStore.getState().signaturePad;
24604
24460
  if (!signaturePad.current) throw new Error('Signature pad not found');
@@ -24620,11 +24476,11 @@
24620
24476
  setTimeout(function () {
24621
24477
  useVideoSignatureStore.getState().clearRecordedData();
24622
24478
  setTimeout(function () {
24623
- useVideoSignatureStore.getState().startRecording(camera, audioStream, captureAudio);
24479
+ useVideoSignatureStore.getState().startRecording(captureAudio);
24624
24480
  }, 100);
24625
24481
  }, 100);
24626
24482
  }
24627
- }, [audioStream, camera, captureAudio, restartVideoOnSignaturePadCleared]);
24483
+ }, [captureAudio, restartVideoOnSignaturePadCleared]);
24628
24484
  return /*#__PURE__*/React.createElement(Component, _assign({}, props, {
24629
24485
  faceGuideStatus: status,
24630
24486
  onAcceptBtnClicked: onAcceptBtnClicked,
@@ -24978,12 +24834,10 @@
24978
24834
  _9 = _7.height,
24979
24835
  height = _9 === void 0 ? 1 : _9;
24980
24836
  var _10 = useCameraStore(),
24981
- camera = _10.camera,
24982
24837
  videoRef = _10.videoRef,
24983
24838
  videoLoaded = _10.videoLoaded,
24984
24839
  cameraReady = _10.cameraReady,
24985
24840
  microphoneReady = _10.microphoneReady,
24986
- audioStream = _10.audioStream,
24987
24841
  isRearFacing = _10.isRearFacing,
24988
24842
  releaseCameraAccess = _10.releaseCameraAccess;
24989
24843
  var _11 = React.useState([]),
@@ -25025,8 +24879,8 @@
25025
24879
  countdownRemaining = _18[0],
25026
24880
  setCountdownRemaining = _18[1];
25027
24881
  React.useEffect(function () {
25028
- if (camera && !isRecordingVideo && !videoUrl) {
25029
- useVideoRecorderStore.getState().startRecordingVideo(camera, audioStream);
24882
+ if (!isRecordingVideo && !videoUrl) {
24883
+ useVideoRecorderStore.getState().startRecordingVideo();
25030
24884
  setVideoStartsAt(new Date());
25031
24885
  }
25032
24886
  // if the mergeAVStreams flag is present, the audio stream is on the video
@@ -25037,7 +24891,7 @@
25037
24891
  releaseCameraAccess();
25038
24892
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
25039
24893
  }
25040
- }, [audioStream, audioUrl, camera, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, videoUrl]);
24894
+ }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, videoUrl]);
25041
24895
  React.useEffect(function () {
25042
24896
  if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
25043
24897
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
@@ -25132,13 +24986,14 @@
25132
24986
  var _a;
25133
24987
  if (translatedText) {
25134
24988
  setRequestedAction('READ_TEXT');
25135
- useVideoRecorderStore.getState().startRecordingAudio(audioStream);
24989
+ useVideoRecorderStore.getState().startRecordingAudio();
25136
24990
  setIdCaptureVideoAudioStartsAt(new Date().getTime() - ((_a = videoStartsAt === null || videoStartsAt === void 0 ? void 0 : videoStartsAt.getTime()) !== null && _a !== void 0 ? _a : 0));
25137
- setExpectedAudioText(translatedText);
24991
+ var renderedTranslatedText = typeof translatedText === 'string' ? translatedText : server.renderToString(translatedText);
24992
+ setExpectedAudioText(renderedTranslatedText);
25138
24993
  } else {
25139
24994
  useVideoRecorderStore.getState().stopRecordingVideo();
25140
24995
  }
25141
- }, [audioStream, setExpectedAudioText, setIdCaptureVideoAudioStartsAt, translatedText, videoStartsAt]);
24996
+ }, [setExpectedAudioText, setIdCaptureVideoAudioStartsAt, translatedText, videoStartsAt]);
25142
24997
  var frameWidth = (_c = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) !== null && _c !== void 0 ? _c : 0;
25143
24998
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
25144
24999
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
@@ -25770,36 +25625,36 @@
25770
25625
  };
25771
25626
 
25772
25627
  function CompositeWizard(_a) {
25773
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
25628
+ var _b;
25774
25629
  var userChecks = _a.checks,
25775
- _l = _a.idCaptureProps,
25776
- idCaptureProps = _l === void 0 ? {} : _l,
25777
- _m = _a.faceLivenessProps,
25778
- 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,
25779
25634
  additionalDocumentCaptureProps = _a.additionalDocumentCaptureProps,
25780
- _o = _a.signatureCaptureProps,
25781
- signatureCaptureProps = _o === void 0 ? {} : _o,
25782
- _p = _a.videoSignatureCaptureProps,
25783
- videoSignatureCaptureProps = _p === void 0 ? {} : _p,
25784
- _q = _a.videoIdCaptureProps,
25785
- videoIdCaptureProps = _q === void 0 ? {} : _q,
25786
- _r = _a.captureSignature,
25787
- captureSignature = _r === void 0 ? false : _r,
25788
- _s = _a.captureSignatureVideo,
25789
- 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,
25790
25645
  onCameraAccessDenied = _a.onCameraAccessDenied,
25791
25646
  onCameraTamperingDetected = _a.onCameraTamperingDetected,
25792
25647
  onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
25793
- _t = _a.debugMode,
25794
- debugMode = _t === void 0 ? false : _t;
25795
- var _u = React.useContext(SubmissionContext),
25796
- submit = _u.submit,
25797
- submissionStatus = _u.submissionStatus,
25798
- setSignatureData = _u.setSignatureData,
25799
- setAdditionalDocuments = _u.setAdditionalDocuments;
25800
- var _v = React.useState(0),
25801
- checkIndex = _v[0],
25802
- 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];
25803
25658
  var checks = React.useMemo(function () {
25804
25659
  var _a, _b;
25805
25660
  var checks = __spreadArray([], userChecks, true);
@@ -25906,24 +25761,13 @@
25906
25761
  var shouldLoadIdCaptureModels = !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode) && !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.allowUploadingDocumentsFromStorage);
25907
25762
  switch (checks[checkIndex]) {
25908
25763
  case 'IdCapture':
25909
- return /*#__PURE__*/React.createElement(CameraStoreProvider, {
25764
+ return /*#__PURE__*/React.createElement(IdCaptureWizardWithProviders, _assign({}, idCaptureProps, {
25910
25765
  onCameraAccessDenied: onCameraAccessDenied,
25911
25766
  onCameraTamperingDetected: onCameraTamperingDetected,
25912
25767
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
25913
- requestAccessAutomatically: shouldLoadIdCaptureModels,
25914
- classNames: (_c = idCaptureProps.classNames) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider,
25915
- verbiage: (_d = idCaptureProps.verbiage) === null || _d === void 0 ? void 0 : _d.cameraStoreProvider
25916
- }, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
25917
- autoStart: false,
25918
- shouldLoadModels: shouldLoadIdCaptureModels,
25919
- documentDetectionModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.documentDetectionModelUrl) !== null && _f !== void 0 ? _f : '',
25920
- focusModelUrl: (_h = (_g = idCaptureProps.assets) === null || _g === void 0 ? void 0 : _g.focusModelUrl) !== null && _h !== void 0 ? _h : '',
25921
- onModelError: idCaptureProps.onModelError,
25922
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
25923
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
25924
- }, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
25768
+ shouldLoadIdCaptureModels: shouldLoadIdCaptureModels,
25925
25769
  onSuccess: onIdCaptureSuccess
25926
- }))))));
25770
+ }));
25927
25771
  case 'VideoIdCapture':
25928
25772
  return /*#__PURE__*/React.createElement(VideoIdWizard, _assign({}, videoIdCaptureProps, {
25929
25773
  onComplete: onVideoIdCaptureComplete,
@@ -25932,21 +25776,12 @@
25932
25776
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
25933
25777
  }));
25934
25778
  case 'FaceLiveness':
25935
- return /*#__PURE__*/React.createElement(CameraStoreProvider, {
25936
- preferFrontFacingCamera: true,
25937
- preferIphoneContinuityCamera: false,
25779
+ return /*#__PURE__*/React.createElement(FaceLivenessWizardWithProviders, _assign({}, faceLivenessProps, {
25938
25780
  onCameraAccessDenied: onCameraAccessDenied,
25939
25781
  onCameraTamperingDetected: onCameraTamperingDetected,
25940
25782
  onMicrophoneAccessDenied: onMicrophoneAccessDenied,
25941
- classNames: (_j = faceLivenessProps.classNames) === null || _j === void 0 ? void 0 : _j.cameraStoreProvider,
25942
- verbiage: (_k = faceLivenessProps.verbiage) === null || _k === void 0 ? void 0 : _k.cameraStoreProvider
25943
- }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
25944
- autoStart: false,
25945
- onModelError: faceLivenessProps.onModelError,
25946
- modelLoadTimeoutMs: faceLivenessProps.modelLoadTimeoutMs
25947
- }, /*#__PURE__*/React.createElement(FaceLivenessWizard, _assign({}, faceLivenessProps, {
25948
25783
  onComplete: onFaceLivenessComplete
25949
- }))));
25784
+ }));
25950
25785
  case 'SignatureCapture':
25951
25786
  return /*#__PURE__*/React.createElement(SignatureCapture, _assign({}, signatureCaptureProps, {
25952
25787
  onAccept: onSignatureCaptureSuccess