idmission-web-sdk 2.3.71 → 2.3.72

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.
@@ -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.71';
214
+ var webSdkVersion = '2.3.72';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9556,11 +9556,18 @@
9556
9556
  return listeners["delete"](listener);
9557
9557
  };
9558
9558
  };
9559
+ var destroy = function destroy() {
9560
+ if ((undefined ? undefined.MODE : void 0) !== "production") {
9561
+ 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.");
9562
+ }
9563
+ listeners.clear();
9564
+ };
9559
9565
  var api = {
9560
9566
  setState: setState,
9561
9567
  getState: getState,
9562
9568
  getInitialState: getInitialState,
9563
- subscribe: subscribe
9569
+ subscribe: subscribe,
9570
+ destroy: destroy
9564
9571
  };
9565
9572
  var initialState = state = createState(setState, getState, api);
9566
9573
  return api;
@@ -9569,25 +9576,213 @@
9569
9576
  return createState ? createStoreImpl(createState) : createStoreImpl;
9570
9577
  };
9571
9578
 
9579
+ var withSelector = {exports: {}};
9580
+
9581
+ var shim = {exports: {}};
9582
+
9583
+ var useSyncExternalStoreShim_development = {};
9584
+
9585
+ /**
9586
+ * @license React
9587
+ * use-sync-external-store-shim.development.js
9588
+ *
9589
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9590
+ *
9591
+ * This source code is licensed under the MIT license found in the
9592
+ * LICENSE file in the root directory of this source tree.
9593
+ */
9594
+ var hasRequiredUseSyncExternalStoreShim_development;
9595
+ function requireUseSyncExternalStoreShim_development() {
9596
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
9597
+ hasRequiredUseSyncExternalStoreShim_development = 1;
9598
+ (function () {
9599
+ function is(x, y) {
9600
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
9601
+ }
9602
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
9603
+ 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."));
9604
+ var value = getSnapshot();
9605
+ if (!didWarnUncachedGetSnapshot) {
9606
+ var cachedValue = getSnapshot();
9607
+ objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0);
9608
+ }
9609
+ cachedValue = useState({
9610
+ inst: {
9611
+ value: value,
9612
+ getSnapshot: getSnapshot
9613
+ }
9614
+ });
9615
+ var inst = cachedValue[0].inst,
9616
+ forceUpdate = cachedValue[1];
9617
+ useLayoutEffect(function () {
9618
+ inst.value = value;
9619
+ inst.getSnapshot = getSnapshot;
9620
+ checkIfSnapshotChanged(inst) && forceUpdate({
9621
+ inst: inst
9622
+ });
9623
+ }, [subscribe, value, getSnapshot]);
9624
+ useEffect(function () {
9625
+ checkIfSnapshotChanged(inst) && forceUpdate({
9626
+ inst: inst
9627
+ });
9628
+ return subscribe(function () {
9629
+ checkIfSnapshotChanged(inst) && forceUpdate({
9630
+ inst: inst
9631
+ });
9632
+ });
9633
+ }, [subscribe]);
9634
+ useDebugValue(value);
9635
+ return value;
9636
+ }
9637
+ function checkIfSnapshotChanged(inst) {
9638
+ var latestGetSnapshot = inst.getSnapshot;
9639
+ inst = inst.value;
9640
+ try {
9641
+ var nextValue = latestGetSnapshot();
9642
+ return !objectIs(inst, nextValue);
9643
+ } catch (error) {
9644
+ return !0;
9645
+ }
9646
+ }
9647
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
9648
+ return getSnapshot();
9649
+ }
9650
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
9651
+ var React$1 = React,
9652
+ objectIs = "function" === typeof Object.is ? Object.is : is,
9653
+ useState = React$1.useState,
9654
+ useEffect = React$1.useEffect,
9655
+ useLayoutEffect = React$1.useLayoutEffect,
9656
+ useDebugValue = React$1.useDebugValue,
9657
+ didWarnOld18Alpha = !1,
9658
+ didWarnUncachedGetSnapshot = !1,
9659
+ shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
9660
+ useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim;
9661
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
9662
+ })();
9663
+ return useSyncExternalStoreShim_development;
9664
+ }
9665
+
9666
+ var hasRequiredShim;
9667
+ function requireShim() {
9668
+ if (hasRequiredShim) return shim.exports;
9669
+ hasRequiredShim = 1;
9670
+ {
9671
+ shim.exports = requireUseSyncExternalStoreShim_development();
9672
+ }
9673
+ return shim.exports;
9674
+ }
9675
+
9676
+ var withSelector_development = {};
9677
+
9678
+ /**
9679
+ * @license React
9680
+ * use-sync-external-store-shim/with-selector.development.js
9681
+ *
9682
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9683
+ *
9684
+ * This source code is licensed under the MIT license found in the
9685
+ * LICENSE file in the root directory of this source tree.
9686
+ */
9687
+ var hasRequiredWithSelector_development;
9688
+ function requireWithSelector_development() {
9689
+ if (hasRequiredWithSelector_development) return withSelector_development;
9690
+ hasRequiredWithSelector_development = 1;
9691
+ (function () {
9692
+ function is(x, y) {
9693
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
9694
+ }
9695
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
9696
+ var React$1 = React,
9697
+ shim = requireShim(),
9698
+ objectIs = "function" === typeof Object.is ? Object.is : is,
9699
+ useSyncExternalStore = shim.useSyncExternalStore,
9700
+ useRef = React$1.useRef,
9701
+ useEffect = React$1.useEffect,
9702
+ useMemo = React$1.useMemo,
9703
+ useDebugValue = React$1.useDebugValue;
9704
+ withSelector_development.useSyncExternalStoreWithSelector = function (subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
9705
+ var instRef = useRef(null);
9706
+ if (null === instRef.current) {
9707
+ var inst = {
9708
+ hasValue: !1,
9709
+ value: null
9710
+ };
9711
+ instRef.current = inst;
9712
+ } else inst = instRef.current;
9713
+ instRef = useMemo(function () {
9714
+ function memoizedSelector(nextSnapshot) {
9715
+ if (!hasMemo) {
9716
+ hasMemo = !0;
9717
+ memoizedSnapshot = nextSnapshot;
9718
+ nextSnapshot = selector(nextSnapshot);
9719
+ if (void 0 !== isEqual && inst.hasValue) {
9720
+ var currentSelection = inst.value;
9721
+ if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
9722
+ }
9723
+ return memoizedSelection = nextSnapshot;
9724
+ }
9725
+ currentSelection = memoizedSelection;
9726
+ if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
9727
+ var nextSelection = selector(nextSnapshot);
9728
+ if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
9729
+ memoizedSnapshot = nextSnapshot;
9730
+ return memoizedSelection = nextSelection;
9731
+ }
9732
+ var hasMemo = !1,
9733
+ memoizedSnapshot,
9734
+ memoizedSelection,
9735
+ maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
9736
+ return [function () {
9737
+ return memoizedSelector(getSnapshot());
9738
+ }, null === maybeGetServerSnapshot ? void 0 : function () {
9739
+ return memoizedSelector(maybeGetServerSnapshot());
9740
+ }];
9741
+ }, [getSnapshot, getServerSnapshot, selector, isEqual]);
9742
+ var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
9743
+ useEffect(function () {
9744
+ inst.hasValue = !0;
9745
+ inst.value = value;
9746
+ }, [value]);
9747
+ useDebugValue(value);
9748
+ return value;
9749
+ };
9750
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
9751
+ })();
9752
+ return withSelector_development;
9753
+ }
9754
+
9755
+ {
9756
+ withSelector.exports = requireWithSelector_development();
9757
+ }
9758
+ var withSelectorExports = withSelector.exports;
9759
+ var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelectorExports);
9760
+
9761
+ var useDebugValue = React.useDebugValue;
9762
+ var useSyncExternalStoreWithSelector = useSyncExternalStoreExports.useSyncExternalStoreWithSelector;
9763
+ var didWarnAboutEqualityFn = false;
9572
9764
  var identity = function identity(arg) {
9573
9765
  return arg;
9574
9766
  };
9575
- function useStore(api, selector) {
9767
+ function useStore(api, selector, equalityFn) {
9576
9768
  if (selector === void 0) {
9577
9769
  selector = identity;
9578
9770
  }
9579
- var slice = React.useSyncExternalStore(api.subscribe, function () {
9580
- return selector(api.getState());
9581
- }, function () {
9582
- return selector(api.getInitialState());
9583
- });
9584
- React.useDebugValue(slice);
9771
+ if ((undefined ? undefined.MODE : void 0) !== "production" && equalityFn && !didWarnAboutEqualityFn) {
9772
+ 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");
9773
+ didWarnAboutEqualityFn = true;
9774
+ }
9775
+ var slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getServerState || api.getInitialState, selector, equalityFn);
9776
+ useDebugValue(slice);
9585
9777
  return slice;
9586
9778
  }
9587
9779
  var createImpl = function createImpl(createState) {
9588
- var api = createStore(createState);
9589
- var useBoundStore = function useBoundStore(selector) {
9590
- return useStore(api, selector);
9780
+ if ((undefined ? undefined.MODE : void 0) !== "production" && typeof createState !== "function") {
9781
+ console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");
9782
+ }
9783
+ var api = typeof createState === "function" ? createStore(createState) : createState;
9784
+ var useBoundStore = function useBoundStore(selector, equalityFn) {
9785
+ return useStore(api, selector, equalityFn);
9591
9786
  };
9592
9787
  Object.assign(useBoundStore, api);
9593
9788
  return useBoundStore;
@@ -14300,8 +14495,8 @@
14300
14495
  var children = _a.children,
14301
14496
  _b = _a.focusModelPath,
14302
14497
  focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
14303
- _c = _a.focusModelLoadTimeoutMs,
14304
- focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
14498
+ _c = _a.modelLoadTimeoutMs,
14499
+ modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
14305
14500
  onFocusModelError = _a.onFocusModelError,
14306
14501
  _d = _a.showCanvases,
14307
14502
  showCanvases = _d === void 0 ? false : _d,
@@ -14321,7 +14516,7 @@
14321
14516
  }, []);
14322
14517
  var _h = useLoadFocusModel({
14323
14518
  modelPath: focusModelPath,
14324
- modelLoadTimeoutMs: focusModelLoadTimeoutMs,
14519
+ modelLoadTimeoutMs: modelLoadTimeoutMs,
14325
14520
  onModelError: onFocusModelError,
14326
14521
  videoRef: videoRef,
14327
14522
  shouldLoadModels: shouldLoadModels
@@ -14796,8 +14991,11 @@
14796
14991
  var extensionConnector;
14797
14992
  try {
14798
14993
  extensionConnector = (enabled != null ? enabled : (undefined ? undefined.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
14799
- } catch (e) {}
14994
+ } catch (_e) {}
14800
14995
  if (!extensionConnector) {
14996
+ if ((undefined ? undefined.MODE : void 0) !== "production" && enabled) {
14997
+ console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension");
14998
+ }
14801
14999
  return fn(set, get, api);
14802
15000
  }
14803
15001
  var _extractConnectionInf = extractConnectionInformation(store, extensionConnector, options),
@@ -14868,7 +15066,7 @@
14868
15066
  return;
14869
15067
  }
14870
15068
  if (Object.keys(action.state).length !== 1) {
14871
- 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 ");
15069
+ 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 ");
14872
15070
  }
14873
15071
  var stateFromDevtools = action.state[store];
14874
15072
  if (stateFromDevtools === void 0 || stateFromDevtools === null) {
@@ -14956,71 +15154,50 @@
14956
15154
  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."); }
14957
15155
  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; } }
14958
15156
  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; }
14959
- var isIterable = function isIterable(obj) {
14960
- return Symbol.iterator in obj;
14961
- };
14962
- var hasIterableEntries = function hasIterableEntries(value) {
14963
- return (
14964
- // HACK: avoid checking entries type
14965
- "entries" in value
14966
- );
14967
- };
14968
- var compareEntries = function compareEntries(valueA, valueB) {
14969
- var mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
14970
- var mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
14971
- if (mapA.size !== mapB.size) {
15157
+ function shallow(objA, objB) {
15158
+ if (Object.is(objA, objB)) {
15159
+ return true;
15160
+ }
15161
+ if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
14972
15162
  return false;
14973
15163
  }
14974
- for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
14975
- var _step$value = _step.value,
14976
- key = _step$value[0],
14977
- value = _step$value[1];
14978
- if (!Object.is(value, mapB.get(key))) {
14979
- return false;
15164
+ if (objA instanceof Map && objB instanceof Map) {
15165
+ if (objA.size !== objB.size) return false;
15166
+ for (var _iterator = _createForOfIteratorHelperLoose(objA), _step; !(_step = _iterator()).done;) {
15167
+ var _step$value = _step.value,
15168
+ key = _step$value[0],
15169
+ value = _step$value[1];
15170
+ if (!Object.is(value, objB.get(key))) {
15171
+ return false;
15172
+ }
14980
15173
  }
15174
+ return true;
14981
15175
  }
14982
- return true;
14983
- };
14984
- var compareIterables = function compareIterables(valueA, valueB) {
14985
- var iteratorA = valueA[Symbol.iterator]();
14986
- var iteratorB = valueB[Symbol.iterator]();
14987
- var nextA = iteratorA.next();
14988
- var nextB = iteratorB.next();
14989
- while (!nextA.done && !nextB.done) {
14990
- if (!Object.is(nextA.value, nextB.value)) {
14991
- return false;
15176
+ if (objA instanceof Set && objB instanceof Set) {
15177
+ if (objA.size !== objB.size) return false;
15178
+ for (var _iterator2 = _createForOfIteratorHelperLoose(objA), _step2; !(_step2 = _iterator2()).done;) {
15179
+ var _value = _step2.value;
15180
+ if (!objB.has(_value)) {
15181
+ return false;
15182
+ }
14992
15183
  }
14993
- nextA = iteratorA.next();
14994
- nextB = iteratorB.next();
14995
- }
14996
- return !!nextA.done && !!nextB.done;
14997
- };
14998
- function shallow(valueA, valueB) {
14999
- if (Object.is(valueA, valueB)) {
15000
15184
  return true;
15001
15185
  }
15002
- if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
15186
+ var keysA = Object.keys(objA);
15187
+ if (keysA.length !== Object.keys(objB).length) {
15003
15188
  return false;
15004
15189
  }
15005
- if (!isIterable(valueA) || !isIterable(valueB)) {
15006
- return compareEntries({
15007
- entries: function entries() {
15008
- return Object.entries(valueA);
15009
- }
15010
- }, {
15011
- entries: function entries() {
15012
- return Object.entries(valueB);
15013
- }
15014
- });
15015
- }
15016
- if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
15017
- return compareEntries(valueA, valueB);
15190
+ for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
15191
+ var keyA = _keysA[_i];
15192
+ if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
15193
+ return false;
15194
+ }
15018
15195
  }
15019
- return compareIterables(valueA, valueB);
15196
+ return true;
15020
15197
  }
15021
-
15198
+ var useRef = React.useRef;
15022
15199
  function useShallow(selector) {
15023
- var prev = React.useRef();
15200
+ var prev = useRef();
15024
15201
  return function (state) {
15025
15202
  var next = selector(state);
15026
15203
  return shallow(prev.current, next) ? prev.current : prev.current = next;
@@ -19661,6 +19838,13 @@
19661
19838
  }
19662
19839
  var templateObject_1$p, templateObject_2$n, templateObject_3$h, templateObject_4$b, templateObject_5$6, templateObject_6$2, templateObject_7$1, templateObject_8$1, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
19663
19840
 
19841
+ var lastDocumentDetectedAtDefaults = {
19842
+ idCardFront: null,
19843
+ idCardBack: null,
19844
+ passport: null,
19845
+ singlePage: null,
19846
+ none: null
19847
+ };
19664
19848
  var IdCaptureWizard = function IdCaptureWizard(_a) {
19665
19849
  var _b, _c, _d, _e, _f;
19666
19850
  var onLoadingStarted = _a.onLoadingStarted,
@@ -19672,79 +19856,82 @@
19672
19856
  onUserCancel = _a.onUserCancel,
19673
19857
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
19674
19858
  onDocumentCaptured = _a.onDocumentCaptured,
19675
- _g = _a.loadingOverlayMode,
19676
- loadingOverlayMode = _g === void 0 ? 'default' : _g,
19859
+ onDocumentDetected = _a.onDocumentDetected,
19860
+ _g = _a.documentDetectionThrottleMs,
19861
+ documentDetectionThrottleMs = _g === void 0 ? 0 : _g,
19862
+ _h = _a.loadingOverlayMode,
19863
+ loadingOverlayMode = _h === void 0 ? 'default' : _h,
19677
19864
  customOverlayContent = _a.customOverlayContent,
19678
19865
  precapturedDocuments = _a.precapturedDocuments,
19679
- _h = _a.captureRequirement,
19680
- captureRequirement = _h === void 0 ? 'idCardOrPassport' : _h,
19681
- _j = _a.allowSinglePageIdCapture,
19682
- allowSinglePageIdCapture = _j === void 0 ? false : _j,
19683
- _k = _a.separateIdCardCaptureSequence,
19684
- separateIdCardCaptureSequence = _k === void 0 ? false : _k,
19685
- _l = _a.thresholds,
19686
- thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
19687
- _m = _a.skipSuccessScreen,
19688
- skipSuccessScreen = _m === void 0 ? false : _m,
19866
+ _j = _a.captureRequirement,
19867
+ captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
19868
+ _k = _a.allowSinglePageIdCapture,
19869
+ allowSinglePageIdCapture = _k === void 0 ? false : _k,
19870
+ _l = _a.separateIdCardCaptureSequence,
19871
+ separateIdCardCaptureSequence = _l === void 0 ? false : _l,
19872
+ _m = _a.thresholds,
19873
+ thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
19874
+ _o = _a.skipSuccessScreen,
19875
+ skipSuccessScreen = _o === void 0 ? false : _o,
19689
19876
  instructions = _a.instructions,
19690
- _o = _a.releaseCameraAccessOnExit,
19691
- releaseCameraAccessOnExit = _o === void 0 ? true : _o,
19692
- _p = _a.guideType,
19693
- guideType = _p === void 0 ? 'fit' : _p,
19694
- _q = _a.portraitGuidesOnMobile,
19695
- portraitGuidesOnMobile = _q === void 0 ? true : _q,
19696
- _r = _a.rotateLoadingOverlayImageWhenPortrait,
19697
- rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
19698
- _s = _a.silentFallback,
19699
- silentFallback = _s === void 0 ? false : _s,
19700
- _t = _a.forceFallbackMode,
19701
- forceFallbackMode = _t === void 0 ? false : _t,
19702
- _u = _a.allowIdCardBackToFrontCapture,
19703
- allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
19704
- _v = _a.enableOverrideWrongDocumentTypeDialog,
19705
- enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
19706
- _w = _a.allowOverrideWrongDocumentTypeAfterMs,
19707
- allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
19708
- _x = _a.allowUploadingDocumentsFromStorage,
19709
- allowUploadingDocumentsFromStorage = _x === void 0 ? false : _x,
19710
- _y = _a.guideImages,
19711
- guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
19712
- _z = _a.assets,
19713
- assets = _z === void 0 ? {} : _z,
19714
- _0 = _a.classNames,
19715
- classNames = _0 === void 0 ? {} : _0,
19716
- _1 = _a.colors,
19717
- colors = _1 === void 0 ? {} : _1,
19718
- _2 = _a.verbiage,
19719
- verbiage = _2 === void 0 ? {} : _2,
19720
- _3 = _a.debugMode,
19721
- debugMode = _3 === void 0 ? false : _3;
19877
+ _p = _a.releaseCameraAccessOnExit,
19878
+ releaseCameraAccessOnExit = _p === void 0 ? true : _p,
19879
+ _q = _a.guideType,
19880
+ guideType = _q === void 0 ? 'fit' : _q,
19881
+ _r = _a.portraitGuidesOnMobile,
19882
+ portraitGuidesOnMobile = _r === void 0 ? true : _r,
19883
+ _s = _a.rotateLoadingOverlayImageWhenPortrait,
19884
+ rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
19885
+ _t = _a.silentFallback,
19886
+ silentFallback = _t === void 0 ? false : _t,
19887
+ _u = _a.forceFallbackMode,
19888
+ forceFallbackMode = _u === void 0 ? false : _u,
19889
+ _v = _a.allowIdCardBackToFrontCapture,
19890
+ allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
19891
+ _w = _a.enableOverrideWrongDocumentTypeDialog,
19892
+ enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
19893
+ _x = _a.allowOverrideWrongDocumentTypeAfterMs,
19894
+ allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
19895
+ _y = _a.allowUploadingDocumentsFromStorage,
19896
+ allowUploadingDocumentsFromStorage = _y === void 0 ? false : _y,
19897
+ _z = _a.guideImages,
19898
+ guideImages = _z === void 0 ? defaultIdCaptureGuideImages : _z,
19899
+ _0 = _a.assets,
19900
+ assets = _0 === void 0 ? {} : _0,
19901
+ _1 = _a.classNames,
19902
+ classNames = _1 === void 0 ? {} : _1,
19903
+ _2 = _a.colors,
19904
+ colors = _2 === void 0 ? {} : _2,
19905
+ _3 = _a.verbiage,
19906
+ verbiage = _3 === void 0 ? {} : _3,
19907
+ _4 = _a.debugMode,
19908
+ debugMode = _4 === void 0 ? false : _4;
19722
19909
  var state = useIdCaptureStore();
19723
- var _4 = useCameraStore(),
19724
- cameraAccessDenied = _4.cameraAccessDenied,
19725
- requestCameraAccess = _4.requestCameraAccess,
19726
- releaseCameraAccess = _4.releaseCameraAccess;
19727
- var _5 = React.useState(false),
19728
- overlayDismissed = _5[0],
19729
- setOverlayDismissed = _5[1];
19730
- var _6 = React.useContext(SubmissionContext),
19731
- submissionStatus = _6.submissionStatus,
19732
- setIdFrontImage = _6.setIdFrontImage,
19733
- setIdBackImage = _6.setIdBackImage,
19734
- setPassportImage = _6.setPassportImage,
19735
- setIdFrontIrImage = _6.setIdFrontIrImage,
19736
- setIdBackIrImage = _6.setIdBackIrImage,
19737
- setIdFrontUvImage = _6.setIdFrontUvImage,
19738
- setIdBackUvImage = _6.setIdBackUvImage,
19739
- logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
19740
- logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
19741
- var _7 = useIdCaptureModelsContext(),
19742
- start = _7.start,
19743
- stop = _7.stop,
19744
- onPredictionMade = _7.onPredictionMade,
19745
- setRequiredDocumentType = _7.setRequiredDocumentType,
19746
- modelError = _7.modelError,
19747
- resetBestFrame = _7.resetBestFrame;
19910
+ var _5 = useCameraStore(),
19911
+ cameraAccessDenied = _5.cameraAccessDenied,
19912
+ requestCameraAccess = _5.requestCameraAccess,
19913
+ releaseCameraAccess = _5.releaseCameraAccess;
19914
+ var _6 = React.useState(false),
19915
+ overlayDismissed = _6[0],
19916
+ setOverlayDismissed = _6[1];
19917
+ var _7 = React.useContext(SubmissionContext),
19918
+ submissionStatus = _7.submissionStatus,
19919
+ setIdFrontImage = _7.setIdFrontImage,
19920
+ setIdBackImage = _7.setIdBackImage,
19921
+ setPassportImage = _7.setPassportImage,
19922
+ setIdFrontIrImage = _7.setIdFrontIrImage,
19923
+ setIdBackIrImage = _7.setIdBackIrImage,
19924
+ setIdFrontUvImage = _7.setIdFrontUvImage,
19925
+ setIdBackUvImage = _7.setIdBackUvImage,
19926
+ logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
19927
+ logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
19928
+ var _8 = useIdCaptureModelsContext(),
19929
+ start = _8.start,
19930
+ stop = _8.stop,
19931
+ onPredictionMade = _8.onPredictionMade,
19932
+ setRequiredDocumentType = _8.setRequiredDocumentType,
19933
+ modelError = _8.modelError,
19934
+ resetBestFrame = _8.resetBestFrame;
19748
19935
  React.useEffect(function () {
19749
19936
  dispatchIdCaptureAction({
19750
19937
  type: 'configureWizard',
@@ -19764,6 +19951,7 @@
19764
19951
  if (documentCount) resetBestFrame();
19765
19952
  }, [documentCount, resetBestFrame]);
19766
19953
  var isFallbackMode = forceFallbackMode || modelError;
19954
+ var lastDocumentDetectedAt = React.useRef(_assign({}, lastDocumentDetectedAtDefaults));
19767
19955
  var logCaptureMetadata = React.useCallback(function (metadata) {
19768
19956
  var _a = useIdCaptureStore.getState(),
19769
19957
  captureState = _a.captureState,
@@ -19786,12 +19974,21 @@
19786
19974
  }, [overlayDismissed, start, state.captureState]);
19787
19975
  React.useEffect(function () {
19788
19976
  onPredictionMade(function (prediction) {
19789
- var _a = useIdCaptureStore.getState(),
19790
- captureState = _a.captureState,
19791
- requestedDocumentType = _a.requestedDocumentType;
19977
+ var _a;
19978
+ var _b = useIdCaptureStore.getState(),
19979
+ captureState = _b.captureState,
19980
+ requestedDocumentType = _b.requestedDocumentType,
19981
+ detectedDocumentType = _b.detectedDocumentType;
19792
19982
  var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
19793
19983
  var thresholdMet = prediction[k];
19794
19984
  if (captureState === 'capturing') {
19985
+ if (detectedDocumentType !== 'none') {
19986
+ var now = Date.now();
19987
+ if (!lastDocumentDetectedAt.current[detectedDocumentType] || documentDetectionThrottleMs && now - ((_a = lastDocumentDetectedAt.current[detectedDocumentType]) !== null && _a !== void 0 ? _a : 0) > documentDetectionThrottleMs) {
19988
+ lastDocumentDetectedAt.current[detectedDocumentType] = now;
19989
+ onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(detectedDocumentType);
19990
+ }
19991
+ }
19795
19992
  dispatchIdCaptureAction({
19796
19993
  type: 'objectsDetected',
19797
19994
  payload: {
@@ -19812,6 +20009,7 @@
19812
20009
  var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
19813
20010
  logCaptureMetadata(metadata);
19814
20011
  onDocumentCaptured === null || onDocumentCaptured === void 0 ? void 0 : onDocumentCaptured(metadata);
20012
+ lastDocumentDetectedAt.current = _assign({}, lastDocumentDetectedAtDefaults);
19815
20013
  dispatchIdCaptureAction({
19816
20014
  type: 'documentCaptured',
19817
20015
  payload: {
@@ -19857,9 +20055,9 @@
19857
20055
  type: 'resetWizard'
19858
20056
  });
19859
20057
  }, []);
19860
- var _8 = React.useState(0),
19861
- attempt = _8[0],
19862
- setAttempt = _8[1];
20058
+ var _9 = React.useState(0),
20059
+ attempt = _9[0],
20060
+ setAttempt = _9[1];
19863
20061
  var onExit = React.useCallback(function () {
19864
20062
  releaseCameraAccess();
19865
20063
  setOverlayDismissed(false);
@@ -19950,9 +20148,9 @@
19950
20148
  });
19951
20149
  });
19952
20150
  }, []);
19953
- var _9 = React.useState(false),
19954
- progressStarted = _9[0],
19955
- setProgressStarted = _9[1];
20151
+ var _10 = React.useState(false),
20152
+ progressStarted = _10[0],
20153
+ setProgressStarted = _10[1];
19956
20154
  React.useEffect(function () {
19957
20155
  if (state.captureState === 'capturing') {
19958
20156
  setProgressStarted(false);
@@ -26351,28 +26549,31 @@
26351
26549
  onCameraAccessDenied = _a.onCameraAccessDenied,
26352
26550
  onCameraTamperingDetected = _a.onCameraTamperingDetected,
26353
26551
  onDocumentCaptured = _a.onDocumentCaptured,
26354
- _w = _a.theme,
26355
- theme = _w === void 0 ? 'default' : _w,
26356
- _x = _a.assets,
26357
- assets = _x === void 0 ? {} : _x,
26358
- _y = _a.classNames,
26359
- classNames = _y === void 0 ? {} : _y,
26360
- _z = _a.colors,
26361
- colors = _z === void 0 ? {} : _z,
26362
- _0 = _a.verbiage,
26363
- verbiage = _0 === void 0 ? {} : _0,
26364
- _1 = _a.captureSignature,
26365
- captureSignature = _1 === void 0 ? false : _1,
26366
- _2 = _a.captureSignatureVideo,
26367
- captureSignatureVideo = _2 === void 0 ? false : _2,
26368
- _3 = _a.captureAdditionalDocuments,
26369
- captureAdditionalDocuments = _3 === void 0 ? [] : _3,
26370
- _4 = _a.geolocationEnabled,
26371
- geolocationEnabled = _4 === void 0 ? true : _4,
26372
- _5 = _a.geolocationRequired,
26373
- geolocationRequired = _5 === void 0 ? false : _5,
26374
- _6 = _a.debugMode,
26375
- debugMode = _6 === void 0 ? false : _6;
26552
+ onDocumentDetected = _a.onDocumentDetected,
26553
+ _w = _a.documentDetectionThrottleMs,
26554
+ documentDetectionThrottleMs = _w === void 0 ? 0 : _w,
26555
+ _x = _a.theme,
26556
+ theme = _x === void 0 ? 'default' : _x,
26557
+ _y = _a.assets,
26558
+ assets = _y === void 0 ? {} : _y,
26559
+ _z = _a.classNames,
26560
+ classNames = _z === void 0 ? {} : _z,
26561
+ _0 = _a.colors,
26562
+ colors = _0 === void 0 ? {} : _0,
26563
+ _1 = _a.verbiage,
26564
+ verbiage = _1 === void 0 ? {} : _1,
26565
+ _2 = _a.captureSignature,
26566
+ captureSignature = _2 === void 0 ? false : _2,
26567
+ _3 = _a.captureSignatureVideo,
26568
+ captureSignatureVideo = _3 === void 0 ? false : _3,
26569
+ _4 = _a.captureAdditionalDocuments,
26570
+ captureAdditionalDocuments = _4 === void 0 ? [] : _4,
26571
+ _5 = _a.geolocationEnabled,
26572
+ geolocationEnabled = _5 === void 0 ? true : _5,
26573
+ _6 = _a.geolocationRequired,
26574
+ geolocationRequired = _6 === void 0 ? false : _6,
26575
+ _7 = _a.debugMode,
26576
+ debugMode = _7 === void 0 ? false : _7;
26376
26577
  useLanguage(lang);
26377
26578
  useDebugLogging(debugMode);
26378
26579
  var idCaptureProps = React.useMemo(function () {
@@ -26385,6 +26586,8 @@
26385
26586
  onUserCancel: onUserCancel,
26386
26587
  onModelError: onModelError,
26387
26588
  onDocumentCaptured: onDocumentCaptured,
26589
+ onDocumentDetected: onDocumentDetected,
26590
+ documentDetectionThrottleMs: documentDetectionThrottleMs,
26388
26591
  precapturedDocuments: precapturedDocuments,
26389
26592
  captureRequirement: idCaptureRequirement,
26390
26593
  allowSinglePageIdCapture: allowSinglePageIdCapture,
@@ -26412,7 +26615,7 @@
26412
26615
  verbiage: verbiage,
26413
26616
  debugMode: debugMode
26414
26617
  };
26415
- }, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onExitCapture, onUserCancel, onModelError, onDocumentCaptured, precapturedDocuments, idCaptureRequirement, allowSinglePageIdCapture, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, silentFallback, allowIdCardBackToFrontCapture, allowUploadingDocumentsFromStorage, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
26618
+ }, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onExitCapture, onUserCancel, onModelError, onDocumentCaptured, onDocumentDetected, documentDetectionThrottleMs, precapturedDocuments, idCaptureRequirement, allowSinglePageIdCapture, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, silentFallback, allowIdCardBackToFrontCapture, allowUploadingDocumentsFromStorage, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
26416
26619
  var additionalDocumentCaptureProps = React.useMemo(function () {
26417
26620
  return {
26418
26621
  documents: captureAdditionalDocuments,