idmission-web-sdk 2.2.99 → 2.2.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureFitGuide.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureGuides.d.ts +1 -1
- package/dist/components/id_capture/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureOrUploadScreen.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +24 -5
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/id_capture/OverrideWrongDocumentTypeGuidanceDialog.d.ts.map +1 -1
- package/dist/components/id_capture/ScalingCameraFeed.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +241 -215
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +242 -216
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +544 -292
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -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.2.
|
|
214
|
+
var webSdkVersion = '2.2.101';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -513,6 +513,16 @@
|
|
|
513
513
|
}, _extends.apply(null, arguments);
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
517
|
+
if (null == r) return {};
|
|
518
|
+
var t = {};
|
|
519
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
520
|
+
if (e.includes(n)) continue;
|
|
521
|
+
t[n] = r[n];
|
|
522
|
+
}
|
|
523
|
+
return t;
|
|
524
|
+
}
|
|
525
|
+
|
|
516
526
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
517
527
|
|
|
518
528
|
function getDefaultExportFromCjs (x) {
|
|
@@ -9464,6 +9474,17 @@
|
|
|
9464
9474
|
React.useDebugValue(slice);
|
|
9465
9475
|
return slice;
|
|
9466
9476
|
}
|
|
9477
|
+
var createImpl = function createImpl(createState) {
|
|
9478
|
+
var api = createStore(createState);
|
|
9479
|
+
var useBoundStore = function useBoundStore(selector) {
|
|
9480
|
+
return useStore(api, selector);
|
|
9481
|
+
};
|
|
9482
|
+
Object.assign(useBoundStore, api);
|
|
9483
|
+
return useBoundStore;
|
|
9484
|
+
};
|
|
9485
|
+
var create$1 = function create(createState) {
|
|
9486
|
+
return createImpl;
|
|
9487
|
+
};
|
|
9467
9488
|
|
|
9468
9489
|
function listAvailableCameras(facingMode_1) {
|
|
9469
9490
|
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
@@ -10574,6 +10595,286 @@
|
|
|
10574
10595
|
});
|
|
10575
10596
|
}
|
|
10576
10597
|
|
|
10598
|
+
var _excluded = ["enabled", "anonymousActionType", "store"],
|
|
10599
|
+
_excluded2 = ["connection"];
|
|
10600
|
+
var trackedConnections = /* @__PURE__ */new Map();
|
|
10601
|
+
var getTrackedConnectionState = function getTrackedConnectionState(name) {
|
|
10602
|
+
var api = trackedConnections.get(name);
|
|
10603
|
+
if (!api) return {};
|
|
10604
|
+
return Object.fromEntries(Object.entries(api.stores).map(function (_ref) {
|
|
10605
|
+
var key = _ref[0],
|
|
10606
|
+
api2 = _ref[1];
|
|
10607
|
+
return [key, api2.getState()];
|
|
10608
|
+
}));
|
|
10609
|
+
};
|
|
10610
|
+
var extractConnectionInformation = function extractConnectionInformation(store, extensionConnector, options) {
|
|
10611
|
+
if (store === void 0) {
|
|
10612
|
+
return {
|
|
10613
|
+
type: "untracked",
|
|
10614
|
+
connection: extensionConnector.connect(options)
|
|
10615
|
+
};
|
|
10616
|
+
}
|
|
10617
|
+
var existingConnection = trackedConnections.get(options.name);
|
|
10618
|
+
if (existingConnection) {
|
|
10619
|
+
return _extends({
|
|
10620
|
+
type: "tracked",
|
|
10621
|
+
store: store
|
|
10622
|
+
}, existingConnection);
|
|
10623
|
+
}
|
|
10624
|
+
var newConnection = {
|
|
10625
|
+
connection: extensionConnector.connect(options),
|
|
10626
|
+
stores: {}
|
|
10627
|
+
};
|
|
10628
|
+
trackedConnections.set(options.name, newConnection);
|
|
10629
|
+
return _extends({
|
|
10630
|
+
type: "tracked",
|
|
10631
|
+
store: store
|
|
10632
|
+
}, newConnection);
|
|
10633
|
+
};
|
|
10634
|
+
var devtoolsImpl = function devtoolsImpl(fn, devtoolsOptions) {
|
|
10635
|
+
if (devtoolsOptions === void 0) {
|
|
10636
|
+
devtoolsOptions = {};
|
|
10637
|
+
}
|
|
10638
|
+
return function (set, get, api) {
|
|
10639
|
+
var _devtoolsOptions = devtoolsOptions,
|
|
10640
|
+
enabled = _devtoolsOptions.enabled,
|
|
10641
|
+
anonymousActionType = _devtoolsOptions.anonymousActionType,
|
|
10642
|
+
store = _devtoolsOptions.store,
|
|
10643
|
+
options = _objectWithoutPropertiesLoose(_devtoolsOptions, _excluded);
|
|
10644
|
+
var extensionConnector;
|
|
10645
|
+
try {
|
|
10646
|
+
extensionConnector = (enabled != null ? enabled : (undefined ? undefined.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
10647
|
+
} catch (e) {}
|
|
10648
|
+
if (!extensionConnector) {
|
|
10649
|
+
return fn(set, get, api);
|
|
10650
|
+
}
|
|
10651
|
+
var _extractConnectionInf = extractConnectionInformation(store, extensionConnector, options),
|
|
10652
|
+
connection = _extractConnectionInf.connection,
|
|
10653
|
+
connectionInformation = _objectWithoutPropertiesLoose(_extractConnectionInf, _excluded2);
|
|
10654
|
+
var isRecording = true;
|
|
10655
|
+
api.setState = function (state, replace, nameOrAction) {
|
|
10656
|
+
var _extends2;
|
|
10657
|
+
var r = set(state, replace);
|
|
10658
|
+
if (!isRecording) return r;
|
|
10659
|
+
var action = nameOrAction === void 0 ? {
|
|
10660
|
+
type: anonymousActionType || "anonymous"
|
|
10661
|
+
} : typeof nameOrAction === "string" ? {
|
|
10662
|
+
type: nameOrAction
|
|
10663
|
+
} : nameOrAction;
|
|
10664
|
+
if (store === void 0) {
|
|
10665
|
+
connection == null ? void 0 : connection.send(action, get());
|
|
10666
|
+
return r;
|
|
10667
|
+
}
|
|
10668
|
+
connection == null ? void 0 : connection.send(_extends({}, action, {
|
|
10669
|
+
type: store + "/" + action.type
|
|
10670
|
+
}), _extends({}, getTrackedConnectionState(options.name), (_extends2 = {}, _extends2[store] = api.getState(), _extends2)));
|
|
10671
|
+
return r;
|
|
10672
|
+
};
|
|
10673
|
+
var setStateFromDevtools = function setStateFromDevtools() {
|
|
10674
|
+
var originalIsRecording = isRecording;
|
|
10675
|
+
isRecording = false;
|
|
10676
|
+
set.apply(void 0, arguments);
|
|
10677
|
+
isRecording = originalIsRecording;
|
|
10678
|
+
};
|
|
10679
|
+
var initialState = fn(api.setState, get, api);
|
|
10680
|
+
if (connectionInformation.type === "untracked") {
|
|
10681
|
+
connection == null ? void 0 : connection.init(initialState);
|
|
10682
|
+
} else {
|
|
10683
|
+
connectionInformation.stores[connectionInformation.store] = api;
|
|
10684
|
+
connection == null ? void 0 : connection.init(Object.fromEntries(Object.entries(connectionInformation.stores).map(function (_ref2) {
|
|
10685
|
+
var key = _ref2[0],
|
|
10686
|
+
store2 = _ref2[1];
|
|
10687
|
+
return [key, key === connectionInformation.store ? initialState : store2.getState()];
|
|
10688
|
+
})));
|
|
10689
|
+
}
|
|
10690
|
+
if (api.dispatchFromDevtools && typeof api.dispatch === "function") {
|
|
10691
|
+
var didWarnAboutReservedActionType = false;
|
|
10692
|
+
var originalDispatch = api.dispatch;
|
|
10693
|
+
api.dispatch = function () {
|
|
10694
|
+
for (var _len = arguments.length, a = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10695
|
+
a[_key] = arguments[_key];
|
|
10696
|
+
}
|
|
10697
|
+
if ((undefined ? undefined.MODE : void 0) !== "production" && a[0].type === "__setState" && !didWarnAboutReservedActionType) {
|
|
10698
|
+
console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.');
|
|
10699
|
+
didWarnAboutReservedActionType = true;
|
|
10700
|
+
}
|
|
10701
|
+
originalDispatch.apply(void 0, a);
|
|
10702
|
+
};
|
|
10703
|
+
}
|
|
10704
|
+
connection.subscribe(function (message) {
|
|
10705
|
+
var _a;
|
|
10706
|
+
switch (message.type) {
|
|
10707
|
+
case "ACTION":
|
|
10708
|
+
if (typeof message.payload !== "string") {
|
|
10709
|
+
console.error("[zustand devtools middleware] Unsupported action format");
|
|
10710
|
+
return;
|
|
10711
|
+
}
|
|
10712
|
+
return parseJsonThen(message.payload, function (action) {
|
|
10713
|
+
if (action.type === "__setState") {
|
|
10714
|
+
if (store === void 0) {
|
|
10715
|
+
setStateFromDevtools(action.state);
|
|
10716
|
+
return;
|
|
10717
|
+
}
|
|
10718
|
+
if (Object.keys(action.state).length !== 1) {
|
|
10719
|
+
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 ");
|
|
10720
|
+
}
|
|
10721
|
+
var stateFromDevtools = action.state[store];
|
|
10722
|
+
if (stateFromDevtools === void 0 || stateFromDevtools === null) {
|
|
10723
|
+
return;
|
|
10724
|
+
}
|
|
10725
|
+
if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {
|
|
10726
|
+
setStateFromDevtools(stateFromDevtools);
|
|
10727
|
+
}
|
|
10728
|
+
return;
|
|
10729
|
+
}
|
|
10730
|
+
if (!api.dispatchFromDevtools) return;
|
|
10731
|
+
if (typeof api.dispatch !== "function") return;
|
|
10732
|
+
api.dispatch(action);
|
|
10733
|
+
});
|
|
10734
|
+
case "DISPATCH":
|
|
10735
|
+
switch (message.payload.type) {
|
|
10736
|
+
case "RESET":
|
|
10737
|
+
setStateFromDevtools(initialState);
|
|
10738
|
+
if (store === void 0) {
|
|
10739
|
+
return connection == null ? void 0 : connection.init(api.getState());
|
|
10740
|
+
}
|
|
10741
|
+
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
10742
|
+
case "COMMIT":
|
|
10743
|
+
if (store === void 0) {
|
|
10744
|
+
connection == null ? void 0 : connection.init(api.getState());
|
|
10745
|
+
return;
|
|
10746
|
+
}
|
|
10747
|
+
return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
10748
|
+
case "ROLLBACK":
|
|
10749
|
+
return parseJsonThen(message.state, function (state) {
|
|
10750
|
+
if (store === void 0) {
|
|
10751
|
+
setStateFromDevtools(state);
|
|
10752
|
+
connection == null ? void 0 : connection.init(api.getState());
|
|
10753
|
+
return;
|
|
10754
|
+
}
|
|
10755
|
+
setStateFromDevtools(state[store]);
|
|
10756
|
+
connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));
|
|
10757
|
+
});
|
|
10758
|
+
case "JUMP_TO_STATE":
|
|
10759
|
+
case "JUMP_TO_ACTION":
|
|
10760
|
+
return parseJsonThen(message.state, function (state) {
|
|
10761
|
+
if (store === void 0) {
|
|
10762
|
+
setStateFromDevtools(state);
|
|
10763
|
+
return;
|
|
10764
|
+
}
|
|
10765
|
+
if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {
|
|
10766
|
+
setStateFromDevtools(state[store]);
|
|
10767
|
+
}
|
|
10768
|
+
});
|
|
10769
|
+
case "IMPORT_STATE":
|
|
10770
|
+
{
|
|
10771
|
+
var nextLiftedState = message.payload.nextLiftedState;
|
|
10772
|
+
var lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;
|
|
10773
|
+
if (!lastComputedState) return;
|
|
10774
|
+
if (store === void 0) {
|
|
10775
|
+
setStateFromDevtools(lastComputedState);
|
|
10776
|
+
} else {
|
|
10777
|
+
setStateFromDevtools(lastComputedState[store]);
|
|
10778
|
+
}
|
|
10779
|
+
connection == null ? void 0 : connection.send(null,
|
|
10780
|
+
// FIXME no-any
|
|
10781
|
+
nextLiftedState);
|
|
10782
|
+
return;
|
|
10783
|
+
}
|
|
10784
|
+
case "PAUSE_RECORDING":
|
|
10785
|
+
return isRecording = !isRecording;
|
|
10786
|
+
}
|
|
10787
|
+
return;
|
|
10788
|
+
}
|
|
10789
|
+
});
|
|
10790
|
+
return initialState;
|
|
10791
|
+
};
|
|
10792
|
+
};
|
|
10793
|
+
var devtools = devtoolsImpl;
|
|
10794
|
+
var parseJsonThen = function parseJsonThen(stringified, f) {
|
|
10795
|
+
var parsed;
|
|
10796
|
+
try {
|
|
10797
|
+
parsed = JSON.parse(stringified);
|
|
10798
|
+
} catch (e) {
|
|
10799
|
+
console.error("[zustand devtools middleware] Could not parse the received json", e);
|
|
10800
|
+
}
|
|
10801
|
+
if (parsed !== void 0) f(parsed);
|
|
10802
|
+
};
|
|
10803
|
+
|
|
10804
|
+
function _createForOfIteratorHelperLoose$1(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$1(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."); }
|
|
10805
|
+
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(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$1(r, a) : void 0; } }
|
|
10806
|
+
function _arrayLikeToArray$1(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; }
|
|
10807
|
+
var isIterable = function isIterable(obj) {
|
|
10808
|
+
return Symbol.iterator in obj;
|
|
10809
|
+
};
|
|
10810
|
+
var hasIterableEntries = function hasIterableEntries(value) {
|
|
10811
|
+
return (
|
|
10812
|
+
// HACK: avoid checking entries type
|
|
10813
|
+
"entries" in value
|
|
10814
|
+
);
|
|
10815
|
+
};
|
|
10816
|
+
var compareEntries = function compareEntries(valueA, valueB) {
|
|
10817
|
+
var mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
|
|
10818
|
+
var mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
|
|
10819
|
+
if (mapA.size !== mapB.size) {
|
|
10820
|
+
return false;
|
|
10821
|
+
}
|
|
10822
|
+
for (var _iterator = _createForOfIteratorHelperLoose$1(mapA), _step; !(_step = _iterator()).done;) {
|
|
10823
|
+
var _step$value = _step.value,
|
|
10824
|
+
key = _step$value[0],
|
|
10825
|
+
value = _step$value[1];
|
|
10826
|
+
if (!Object.is(value, mapB.get(key))) {
|
|
10827
|
+
return false;
|
|
10828
|
+
}
|
|
10829
|
+
}
|
|
10830
|
+
return true;
|
|
10831
|
+
};
|
|
10832
|
+
var compareIterables = function compareIterables(valueA, valueB) {
|
|
10833
|
+
var iteratorA = valueA[Symbol.iterator]();
|
|
10834
|
+
var iteratorB = valueB[Symbol.iterator]();
|
|
10835
|
+
var nextA = iteratorA.next();
|
|
10836
|
+
var nextB = iteratorB.next();
|
|
10837
|
+
while (!nextA.done && !nextB.done) {
|
|
10838
|
+
if (!Object.is(nextA.value, nextB.value)) {
|
|
10839
|
+
return false;
|
|
10840
|
+
}
|
|
10841
|
+
nextA = iteratorA.next();
|
|
10842
|
+
nextB = iteratorB.next();
|
|
10843
|
+
}
|
|
10844
|
+
return !!nextA.done && !!nextB.done;
|
|
10845
|
+
};
|
|
10846
|
+
function shallow(valueA, valueB) {
|
|
10847
|
+
if (Object.is(valueA, valueB)) {
|
|
10848
|
+
return true;
|
|
10849
|
+
}
|
|
10850
|
+
if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
|
|
10851
|
+
return false;
|
|
10852
|
+
}
|
|
10853
|
+
if (!isIterable(valueA) || !isIterable(valueB)) {
|
|
10854
|
+
return compareEntries({
|
|
10855
|
+
entries: function entries() {
|
|
10856
|
+
return Object.entries(valueA);
|
|
10857
|
+
}
|
|
10858
|
+
}, {
|
|
10859
|
+
entries: function entries() {
|
|
10860
|
+
return Object.entries(valueB);
|
|
10861
|
+
}
|
|
10862
|
+
});
|
|
10863
|
+
}
|
|
10864
|
+
if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
|
|
10865
|
+
return compareEntries(valueA, valueB);
|
|
10866
|
+
}
|
|
10867
|
+
return compareIterables(valueA, valueB);
|
|
10868
|
+
}
|
|
10869
|
+
|
|
10870
|
+
function useShallow(selector) {
|
|
10871
|
+
var prev = React.useRef();
|
|
10872
|
+
return function (state) {
|
|
10873
|
+
var next = selector(state);
|
|
10874
|
+
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
10875
|
+
};
|
|
10876
|
+
}
|
|
10877
|
+
|
|
10577
10878
|
var initialState$4 = {
|
|
10578
10879
|
initialDrawComplete: false,
|
|
10579
10880
|
redrawing: false,
|
|
@@ -10629,31 +10930,35 @@
|
|
|
10629
10930
|
requestedDocumentType: 'idCardFront',
|
|
10630
10931
|
allowSinglePageIdCapture: false,
|
|
10631
10932
|
allowIdCardBackToFrontCapture: false,
|
|
10933
|
+
allowUploadingDocumentsFromStorage: false,
|
|
10632
10934
|
isUploadingDocumentsFromStorage: false,
|
|
10633
10935
|
uploadingDocumentsType: null,
|
|
10634
10936
|
operationStartedAt: null,
|
|
10635
|
-
captureStartedAt: null
|
|
10937
|
+
captureStartedAt: null,
|
|
10938
|
+
dispatch: function dispatch() {
|
|
10939
|
+
return null;
|
|
10940
|
+
}
|
|
10636
10941
|
};
|
|
10637
|
-
var IdCaptureStateContext = /*#__PURE__*/React.createContext(initialState$4);
|
|
10638
|
-
var IdCaptureDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
10639
10942
|
var _reducer = function reducer(state, action) {
|
|
10640
|
-
var _a
|
|
10943
|
+
var _a;
|
|
10641
10944
|
switch (action.type) {
|
|
10642
10945
|
case 'configureWizard':
|
|
10643
10946
|
{
|
|
10644
|
-
var
|
|
10645
|
-
captureRequirement =
|
|
10646
|
-
precapturedDocuments =
|
|
10647
|
-
allowSinglePageIdCapture =
|
|
10648
|
-
allowIdCardBackToFrontCapture =
|
|
10649
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
10650
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
10947
|
+
var _b = action.payload,
|
|
10948
|
+
captureRequirement = _b.captureRequirement,
|
|
10949
|
+
precapturedDocuments = _b.precapturedDocuments,
|
|
10950
|
+
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
10951
|
+
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
10952
|
+
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
10953
|
+
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
10954
|
+
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
10651
10955
|
var newState = _assign(_assign({}, state), {
|
|
10652
10956
|
captureRequirement: captureRequirement,
|
|
10653
10957
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
10654
10958
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
10655
10959
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
10656
|
-
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
10960
|
+
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
10961
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
10657
10962
|
});
|
|
10658
10963
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
10659
10964
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -10671,7 +10976,7 @@
|
|
|
10671
10976
|
}
|
|
10672
10977
|
}
|
|
10673
10978
|
newState.operationStartedAt = new Date();
|
|
10674
|
-
if (!
|
|
10979
|
+
if (!allowUploadingDocumentsFromStorage) {
|
|
10675
10980
|
newState.captureState = 'capturing';
|
|
10676
10981
|
}
|
|
10677
10982
|
return newState;
|
|
@@ -10711,26 +11016,26 @@
|
|
|
10711
11016
|
});
|
|
10712
11017
|
case 'objectsDetected':
|
|
10713
11018
|
{
|
|
10714
|
-
var
|
|
10715
|
-
detectedObjects =
|
|
10716
|
-
detectionThresholdMet =
|
|
10717
|
-
detectedDocumentType =
|
|
10718
|
-
idCardFrontDetectionScore =
|
|
10719
|
-
idCardFrontDetectionThresholdMet =
|
|
10720
|
-
idCardBackDetectionScore =
|
|
10721
|
-
idCardBackDetectionThresholdMet =
|
|
10722
|
-
passportDetectionScore =
|
|
10723
|
-
passportDetectionThresholdMet =
|
|
10724
|
-
singlePageDetectionScore =
|
|
10725
|
-
singlePageDetectionThresholdMet =
|
|
10726
|
-
bestDocument =
|
|
10727
|
-
documentInBounds =
|
|
10728
|
-
documentTooClose =
|
|
10729
|
-
documentIsStable =
|
|
10730
|
-
focusScore =
|
|
10731
|
-
focusThresholdMet =
|
|
10732
|
-
frameWidth =
|
|
10733
|
-
frameHeight =
|
|
11019
|
+
var _c = action.payload.prediction,
|
|
11020
|
+
detectedObjects = _c.detectedObjects,
|
|
11021
|
+
detectionThresholdMet = _c.detectionThresholdMet,
|
|
11022
|
+
detectedDocumentType = _c.detectedDocumentType,
|
|
11023
|
+
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
11024
|
+
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
11025
|
+
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
11026
|
+
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
11027
|
+
passportDetectionScore = _c.passportDetectionScore,
|
|
11028
|
+
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
11029
|
+
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
11030
|
+
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
11031
|
+
bestDocument = _c.bestDocument,
|
|
11032
|
+
documentInBounds = _c.documentInBounds,
|
|
11033
|
+
documentTooClose = _c.documentTooClose,
|
|
11034
|
+
documentIsStable = _c.documentIsStable,
|
|
11035
|
+
focusScore = _c.focusScore,
|
|
11036
|
+
focusThresholdMet = _c.focusThresholdMet,
|
|
11037
|
+
frameWidth = _c.frameWidth,
|
|
11038
|
+
frameHeight = _c.frameHeight;
|
|
10734
11039
|
var frameCapturedAt = new Date();
|
|
10735
11040
|
var frameCaptureRate = 0;
|
|
10736
11041
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -10816,6 +11121,11 @@
|
|
|
10816
11121
|
frameCaptureRate: frameCaptureRate
|
|
10817
11122
|
});
|
|
10818
11123
|
}
|
|
11124
|
+
case 'captureInitialized':
|
|
11125
|
+
return _assign(_assign({}, state), {
|
|
11126
|
+
captureState: 'capturing',
|
|
11127
|
+
isUploadingDocumentsFromStorage: false
|
|
11128
|
+
});
|
|
10819
11129
|
case 'captureStarted':
|
|
10820
11130
|
return _assign(_assign({}, state), {
|
|
10821
11131
|
captureStartedAt: new Date(),
|
|
@@ -10858,7 +11168,9 @@
|
|
|
10858
11168
|
} else {
|
|
10859
11169
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
10860
11170
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10861
|
-
newState.
|
|
11171
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
11172
|
+
newState.captureState = 'requestingFlip';
|
|
11173
|
+
}
|
|
10862
11174
|
newState.idCardFrontDetectionThresholdMet = false;
|
|
10863
11175
|
newState.idCardBackDetectionThresholdMet = false;
|
|
10864
11176
|
newState.passportDetectionThresholdMet = false;
|
|
@@ -10868,28 +11180,23 @@
|
|
|
10868
11180
|
return newState;
|
|
10869
11181
|
}
|
|
10870
11182
|
case 'documentCapturedManually':
|
|
11183
|
+
return _reducer(state, {
|
|
11184
|
+
type: 'documentCaptured',
|
|
11185
|
+
payload: _assign(_assign({}, action.payload), {
|
|
11186
|
+
documentType: state.requestedDocumentType,
|
|
11187
|
+
width: 0,
|
|
11188
|
+
height: 0
|
|
11189
|
+
})
|
|
11190
|
+
});
|
|
11191
|
+
case 'documentsCaptured':
|
|
10871
11192
|
{
|
|
10872
|
-
var newState = _assign(
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
10880
|
-
if (remainingRequirements.length === 0) {
|
|
10881
|
-
newState.captureState = 'complete';
|
|
10882
|
-
} else {
|
|
10883
|
-
newState.requestedDocumentType = remainingRequirements[0];
|
|
10884
|
-
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10885
|
-
if (!newState.isUploadingDocumentsFromStorage) {
|
|
10886
|
-
newState.captureState = 'requestingFlip';
|
|
10887
|
-
}
|
|
10888
|
-
newState.idCardFrontDetectionThresholdMet = false;
|
|
10889
|
-
newState.idCardBackDetectionThresholdMet = false;
|
|
10890
|
-
newState.passportDetectionThresholdMet = false;
|
|
10891
|
-
newState.wrongDocumentTypePredictions = 0;
|
|
10892
|
-
}
|
|
11193
|
+
var newState = _assign({}, state);
|
|
11194
|
+
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
11195
|
+
var doc = _e[_d];
|
|
11196
|
+
newState = _reducer(newState, {
|
|
11197
|
+
type: 'documentCaptured',
|
|
11198
|
+
payload: doc
|
|
11199
|
+
});
|
|
10893
11200
|
}
|
|
10894
11201
|
return newState;
|
|
10895
11202
|
}
|
|
@@ -10926,6 +11233,9 @@
|
|
|
10926
11233
|
}
|
|
10927
11234
|
case 'resetWizard':
|
|
10928
11235
|
return _assign(_assign({}, initialState$4), {
|
|
11236
|
+
dispatch: state.dispatch,
|
|
11237
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
11238
|
+
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
10929
11239
|
captureRequirement: state.captureRequirement,
|
|
10930
11240
|
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
10931
11241
|
});
|
|
@@ -10933,13 +11243,26 @@
|
|
|
10933
11243
|
return state;
|
|
10934
11244
|
}
|
|
10935
11245
|
};
|
|
10936
|
-
var
|
|
11246
|
+
var useIdCaptureStore = create$1()(devtools(function (set) {
|
|
11247
|
+
return _assign(_assign({}, initialState$4), {
|
|
11248
|
+
dispatch: function dispatch(action) {
|
|
11249
|
+
return set(function (state) {
|
|
11250
|
+
return _reducer(state, action);
|
|
11251
|
+
}, undefined, action);
|
|
11252
|
+
}
|
|
11253
|
+
});
|
|
11254
|
+
}));
|
|
11255
|
+
function IdCaptureStateProvider(_a) {
|
|
10937
11256
|
var children = _a.children;
|
|
10938
|
-
var
|
|
10939
|
-
state
|
|
10940
|
-
|
|
11257
|
+
var overrideWrongDocumentTypeGuidance = useIdCaptureStore(useShallow(function (state) {
|
|
11258
|
+
return state.overrideWrongDocumentTypeGuidance;
|
|
11259
|
+
}));
|
|
11260
|
+
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
11261
|
+
React.useEffect(function () {
|
|
11262
|
+
if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
|
|
11263
|
+
}, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
10941
11264
|
var onResize = c(function () {
|
|
10942
|
-
|
|
11265
|
+
dispatchIdCaptureAction({
|
|
10943
11266
|
type: 'redrawRequested'
|
|
10944
11267
|
});
|
|
10945
11268
|
}, 500);
|
|
@@ -10947,26 +11270,13 @@
|
|
|
10947
11270
|
if (typeof window === 'undefined') return;
|
|
10948
11271
|
window.addEventListener('resize', onResize);
|
|
10949
11272
|
return function () {
|
|
10950
|
-
window.removeEventListener('resize', onResize);
|
|
11273
|
+
return window.removeEventListener('resize', onResize);
|
|
10951
11274
|
};
|
|
10952
11275
|
}, [onResize]);
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
}
|
|
10958
|
-
}, [state.overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
10959
|
-
return /*#__PURE__*/React.createElement(IdCaptureStateContext.Provider, {
|
|
10960
|
-
value: state
|
|
10961
|
-
}, /*#__PURE__*/React.createElement(IdCaptureDispatchContext.Provider, {
|
|
10962
|
-
value: dispatch
|
|
10963
|
-
}, children));
|
|
10964
|
-
};
|
|
10965
|
-
var useIdCaptureState = function useIdCaptureState() {
|
|
10966
|
-
var state = React.useContext(IdCaptureStateContext);
|
|
10967
|
-
var dispatch = React.useContext(IdCaptureDispatchContext);
|
|
10968
|
-
if (!state || !dispatch) throw new Error('useIdCaptureState cannot be used without IdCaptureStateProvider');
|
|
10969
|
-
return [state, dispatch];
|
|
11276
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
11277
|
+
}
|
|
11278
|
+
var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
|
|
11279
|
+
return useIdCaptureStore.getState().dispatch(action);
|
|
10970
11280
|
};
|
|
10971
11281
|
|
|
10972
11282
|
function DebugStatsPane(_a) {
|
|
@@ -11041,7 +11351,7 @@
|
|
|
11041
11351
|
var scaling = _a.scaling,
|
|
11042
11352
|
$flipX = _a.$flipX,
|
|
11043
11353
|
children = _a.children;
|
|
11044
|
-
var _b =
|
|
11354
|
+
var _b = useIdCaptureStore(),
|
|
11045
11355
|
guideRectWidth = _b.guideRectWidth,
|
|
11046
11356
|
guideRectHeight = _b.guideRectHeight,
|
|
11047
11357
|
guideRectX = _b.guideRectX,
|
|
@@ -11547,9 +11857,9 @@
|
|
|
11547
11857
|
return e;
|
|
11548
11858
|
}
|
|
11549
11859
|
|
|
11550
|
-
function _createForOfIteratorHelperLoose
|
|
11551
|
-
function _unsupportedIterableToArray
|
|
11552
|
-
function _arrayLikeToArray
|
|
11860
|
+
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."); }
|
|
11861
|
+
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; } }
|
|
11862
|
+
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; }
|
|
11553
11863
|
var consoleLogger = {
|
|
11554
11864
|
type: 'logger',
|
|
11555
11865
|
log: function log(args) {
|
|
@@ -12396,7 +12706,7 @@
|
|
|
12396
12706
|
}
|
|
12397
12707
|
if (!useOptionsReplaceForData) {
|
|
12398
12708
|
data = _extends({}, data);
|
|
12399
|
-
for (var _iterator = _createForOfIteratorHelperLoose
|
|
12709
|
+
for (var _iterator = _createForOfIteratorHelperLoose(optionsKeys), _step; !(_step = _iterator()).done;) {
|
|
12400
12710
|
var key = _step.value;
|
|
12401
12711
|
delete data[key];
|
|
12402
12712
|
}
|
|
@@ -14996,14 +15306,14 @@
|
|
|
14996
15306
|
classNames = _b === void 0 ? {} : _b,
|
|
14997
15307
|
_c = _a.verbiage,
|
|
14998
15308
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
14999
|
-
var _d =
|
|
15000
|
-
|
|
15001
|
-
dispatch = _d
|
|
15309
|
+
var _d = useIdCaptureStore(),
|
|
15310
|
+
allowOverrideWrongDocumentTypeGuidance = _d.allowOverrideWrongDocumentTypeGuidance,
|
|
15311
|
+
dispatch = _d.dispatch;
|
|
15002
15312
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15003
15313
|
messageText: 'We are having trouble identifying the correct side of your id, do you want to continue with capture anyway?',
|
|
15004
15314
|
buttonText: 'OK'
|
|
15005
15315
|
});
|
|
15006
|
-
if (!
|
|
15316
|
+
if (!allowOverrideWrongDocumentTypeGuidance) return null;
|
|
15007
15317
|
return /*#__PURE__*/React.createElement(Container$2, {
|
|
15008
15318
|
className: classNames.container
|
|
15009
15319
|
}, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
@@ -15057,47 +15367,50 @@
|
|
|
15057
15367
|
width = _q === void 0 ? 1 : _q,
|
|
15058
15368
|
_r = _p.height,
|
|
15059
15369
|
height = _r === void 0 ? 1 : _r;
|
|
15060
|
-
var
|
|
15061
|
-
|
|
15062
|
-
|
|
15063
|
-
|
|
15064
|
-
|
|
15065
|
-
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15370
|
+
var state = useIdCaptureStore();
|
|
15371
|
+
var _s = useCameraStore(),
|
|
15372
|
+
camera = _s.camera,
|
|
15373
|
+
isRearFacing = _s.isRearFacing;
|
|
15374
|
+
var _t = React.useContext(IdCaptureModelsContext),
|
|
15375
|
+
modelsReady = _t.ready,
|
|
15376
|
+
setThresholds = _t.setThresholds,
|
|
15377
|
+
detectionTime = _t.detectionTime,
|
|
15378
|
+
focusPredictionTime = _t.focusPredictionTime,
|
|
15379
|
+
getBestFrame = _t.getBestFrame;
|
|
15380
|
+
React.useEffect(function () {
|
|
15381
|
+
return dispatchIdCaptureAction({
|
|
15382
|
+
type: 'captureInitialized'
|
|
15383
|
+
});
|
|
15384
|
+
}, []);
|
|
15072
15385
|
React.useEffect(function () {
|
|
15073
15386
|
setThresholds(thresholds);
|
|
15074
15387
|
}, [thresholds, setThresholds]);
|
|
15075
15388
|
React.useEffect(function () {
|
|
15076
15389
|
if (!requiredDocumentType) return;
|
|
15077
|
-
|
|
15390
|
+
dispatchIdCaptureAction({
|
|
15078
15391
|
type: 'setRequiredDocumentType',
|
|
15079
15392
|
payload: requiredDocumentType
|
|
15080
15393
|
});
|
|
15081
|
-
}, [
|
|
15394
|
+
}, [requiredDocumentType]);
|
|
15082
15395
|
React.useEffect(function () {
|
|
15083
|
-
|
|
15396
|
+
dispatchIdCaptureAction({
|
|
15084
15397
|
type: 'pageRendered',
|
|
15085
15398
|
payload: {
|
|
15086
15399
|
pageWidth: width,
|
|
15087
15400
|
pageHeight: height
|
|
15088
15401
|
}
|
|
15089
15402
|
});
|
|
15090
|
-
}, [
|
|
15403
|
+
}, [height, width]);
|
|
15091
15404
|
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
15092
15405
|
React.useEffect(function () {
|
|
15093
15406
|
if (!shouldCapture) return;
|
|
15094
|
-
|
|
15407
|
+
dispatchIdCaptureAction({
|
|
15095
15408
|
type: 'capturing'
|
|
15096
15409
|
});
|
|
15097
15410
|
var bestFrame = getBestFrame();
|
|
15098
15411
|
if (!bestFrame) {
|
|
15099
15412
|
log('uh oh, i did not get a photo');
|
|
15100
|
-
|
|
15413
|
+
dispatchIdCaptureAction({
|
|
15101
15414
|
type: 'captureFailed'
|
|
15102
15415
|
});
|
|
15103
15416
|
return;
|
|
@@ -15110,7 +15423,7 @@
|
|
|
15110
15423
|
var width = canvas.width,
|
|
15111
15424
|
height = canvas.height;
|
|
15112
15425
|
var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
|
|
15113
|
-
|
|
15426
|
+
dispatchIdCaptureAction({
|
|
15114
15427
|
type: 'frameCaptured',
|
|
15115
15428
|
payload: {
|
|
15116
15429
|
imageUrl: imageUrl
|
|
@@ -15128,11 +15441,11 @@
|
|
|
15128
15441
|
bestFocusScore: focusScore
|
|
15129
15442
|
};
|
|
15130
15443
|
onCapture === null || onCapture === void 0 ? void 0 : onCapture(imageUrl, width, height, capturedDocumentType, metadata);
|
|
15131
|
-
|
|
15444
|
+
dispatchIdCaptureAction({
|
|
15132
15445
|
type: 'captured'
|
|
15133
15446
|
});
|
|
15134
15447
|
}, 0);
|
|
15135
|
-
}, [
|
|
15448
|
+
}, [getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
|
|
15136
15449
|
var theme = styled.useTheme();
|
|
15137
15450
|
colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.unsatisfiedColor) !== null && _d !== void 0 ? _d : 'white');
|
|
15138
15451
|
colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.satisfiedColor) !== null && _g !== void 0 ? _g : 'green');
|
|
@@ -15858,13 +16171,6 @@
|
|
|
15858
16171
|
var _q = React.useState(false),
|
|
15859
16172
|
dismissed = _q[0],
|
|
15860
16173
|
setDismissed = _q[1];
|
|
15861
|
-
var dispatch = useIdCaptureState()[1];
|
|
15862
|
-
React.useEffect(function () {
|
|
15863
|
-
dispatch({
|
|
15864
|
-
type: 'setUploadingDocumentsFromStorage',
|
|
15865
|
-
payload: false
|
|
15866
|
-
});
|
|
15867
|
-
}, [dispatch]);
|
|
15868
16174
|
assets.instructionImageUrl || (assets.instructionImageUrl = legacyInstructionImageUrl$1);
|
|
15869
16175
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15870
16176
|
headingText: 'Use your device camera to capture your ID',
|
|
@@ -16035,80 +16341,6 @@
|
|
|
16035
16341
|
});
|
|
16036
16342
|
var templateObject_1$z, templateObject_2$u, templateObject_3$m, templateObject_4$g, templateObject_5$b, templateObject_6$9, templateObject_7$6, templateObject_8$3, templateObject_9$3, templateObject_10$2, templateObject_11$2, templateObject_12$2, templateObject_13$2, templateObject_14$1, templateObject_15$1, templateObject_16, templateObject_17, templateObject_18;
|
|
16037
16343
|
|
|
16038
|
-
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."); }
|
|
16039
|
-
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; } }
|
|
16040
|
-
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; }
|
|
16041
|
-
var isIterable = function isIterable(obj) {
|
|
16042
|
-
return Symbol.iterator in obj;
|
|
16043
|
-
};
|
|
16044
|
-
var hasIterableEntries = function hasIterableEntries(value) {
|
|
16045
|
-
return (
|
|
16046
|
-
// HACK: avoid checking entries type
|
|
16047
|
-
"entries" in value
|
|
16048
|
-
);
|
|
16049
|
-
};
|
|
16050
|
-
var compareEntries = function compareEntries(valueA, valueB) {
|
|
16051
|
-
var mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
|
|
16052
|
-
var mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
|
|
16053
|
-
if (mapA.size !== mapB.size) {
|
|
16054
|
-
return false;
|
|
16055
|
-
}
|
|
16056
|
-
for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
|
|
16057
|
-
var _step$value = _step.value,
|
|
16058
|
-
key = _step$value[0],
|
|
16059
|
-
value = _step$value[1];
|
|
16060
|
-
if (!Object.is(value, mapB.get(key))) {
|
|
16061
|
-
return false;
|
|
16062
|
-
}
|
|
16063
|
-
}
|
|
16064
|
-
return true;
|
|
16065
|
-
};
|
|
16066
|
-
var compareIterables = function compareIterables(valueA, valueB) {
|
|
16067
|
-
var iteratorA = valueA[Symbol.iterator]();
|
|
16068
|
-
var iteratorB = valueB[Symbol.iterator]();
|
|
16069
|
-
var nextA = iteratorA.next();
|
|
16070
|
-
var nextB = iteratorB.next();
|
|
16071
|
-
while (!nextA.done && !nextB.done) {
|
|
16072
|
-
if (!Object.is(nextA.value, nextB.value)) {
|
|
16073
|
-
return false;
|
|
16074
|
-
}
|
|
16075
|
-
nextA = iteratorA.next();
|
|
16076
|
-
nextB = iteratorB.next();
|
|
16077
|
-
}
|
|
16078
|
-
return !!nextA.done && !!nextB.done;
|
|
16079
|
-
};
|
|
16080
|
-
function shallow(valueA, valueB) {
|
|
16081
|
-
if (Object.is(valueA, valueB)) {
|
|
16082
|
-
return true;
|
|
16083
|
-
}
|
|
16084
|
-
if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
|
|
16085
|
-
return false;
|
|
16086
|
-
}
|
|
16087
|
-
if (!isIterable(valueA) || !isIterable(valueB)) {
|
|
16088
|
-
return compareEntries({
|
|
16089
|
-
entries: function entries() {
|
|
16090
|
-
return Object.entries(valueA);
|
|
16091
|
-
}
|
|
16092
|
-
}, {
|
|
16093
|
-
entries: function entries() {
|
|
16094
|
-
return Object.entries(valueB);
|
|
16095
|
-
}
|
|
16096
|
-
});
|
|
16097
|
-
}
|
|
16098
|
-
if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
|
|
16099
|
-
return compareEntries(valueA, valueB);
|
|
16100
|
-
}
|
|
16101
|
-
return compareIterables(valueA, valueB);
|
|
16102
|
-
}
|
|
16103
|
-
|
|
16104
|
-
function useShallow(selector) {
|
|
16105
|
-
var prev = React.useRef();
|
|
16106
|
-
return function (state) {
|
|
16107
|
-
var next = selector(state);
|
|
16108
|
-
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
16109
|
-
};
|
|
16110
|
-
}
|
|
16111
|
-
|
|
16112
16344
|
var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
|
|
16113
16345
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
16114
16346
|
var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
|
|
@@ -16923,9 +17155,7 @@
|
|
|
16923
17155
|
wrapperAspectRatio = _1.wrapperAspectRatio,
|
|
16924
17156
|
guideOrientationOnImageLoaded = _1.onImageLoaded,
|
|
16925
17157
|
setDimensions = _1.setDimensions;
|
|
16926
|
-
var
|
|
16927
|
-
state = _2[0],
|
|
16928
|
-
dispatch = _2[1];
|
|
17158
|
+
var state = useIdCaptureStore();
|
|
16929
17159
|
var theme = styled.useTheme();
|
|
16930
17160
|
if (borderWidth === undefined) borderWidth = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 4;
|
|
16931
17161
|
React.useEffect(function () {
|
|
@@ -16951,14 +17181,14 @@
|
|
|
16951
17181
|
var imageByUrl = imagesByUrl[img.src];
|
|
16952
17182
|
var width = (_a = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.width) !== null && _a !== void 0 ? _a : img.naturalWidth;
|
|
16953
17183
|
var height = (_b = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.height) !== null && _b !== void 0 ? _b : img.naturalHeight;
|
|
16954
|
-
|
|
17184
|
+
dispatchIdCaptureAction({
|
|
16955
17185
|
type: 'guideImageLoaded',
|
|
16956
17186
|
payload: {
|
|
16957
17187
|
width: width,
|
|
16958
17188
|
height: height
|
|
16959
17189
|
}
|
|
16960
17190
|
});
|
|
16961
|
-
}, [
|
|
17191
|
+
}, [guideOrientationOnImageLoaded, imagesByUrl]);
|
|
16962
17192
|
return /*#__PURE__*/React.createElement(StyledPageContainer, {
|
|
16963
17193
|
ref: wrapperRef,
|
|
16964
17194
|
onClick: onClick,
|
|
@@ -17088,19 +17318,17 @@
|
|
|
17088
17318
|
images = _w === void 0 ? defaultIdCaptureGuideImages : _w,
|
|
17089
17319
|
_x = _a.classNames,
|
|
17090
17320
|
classNames = _x === void 0 ? {} : _x;
|
|
17091
|
-
var _y =
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
guideImageHeight = _z.guideImageHeight,
|
|
17096
|
-
dispatch = _y[1];
|
|
17321
|
+
var _y = useIdCaptureStore(),
|
|
17322
|
+
redrawing = _y.redrawing,
|
|
17323
|
+
guideImageWidth = _y.guideImageWidth,
|
|
17324
|
+
guideImageHeight = _y.guideImageHeight;
|
|
17097
17325
|
var canvasRef = React.useRef(null);
|
|
17098
|
-
var
|
|
17099
|
-
wrapperRef =
|
|
17100
|
-
|
|
17101
|
-
wrapperWidth =
|
|
17102
|
-
|
|
17103
|
-
wrapperHeight =
|
|
17326
|
+
var _z = useResizeObserver(),
|
|
17327
|
+
wrapperRef = _z.ref,
|
|
17328
|
+
_0 = _z.width,
|
|
17329
|
+
wrapperWidth = _0 === void 0 ? 1 : _0,
|
|
17330
|
+
_1 = _z.height,
|
|
17331
|
+
wrapperHeight = _1 === void 0 ? 1 : _1;
|
|
17104
17332
|
var theme = styled.useTheme();
|
|
17105
17333
|
if (borderWidth === undefined) borderWidth = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 4;
|
|
17106
17334
|
if (padding === undefined) {
|
|
@@ -17118,7 +17346,7 @@
|
|
|
17118
17346
|
if (redrawing) {
|
|
17119
17347
|
resetCanvasDimensions(canvas);
|
|
17120
17348
|
var timer_1 = setTimeout(function () {
|
|
17121
|
-
|
|
17349
|
+
dispatchIdCaptureAction({
|
|
17122
17350
|
type: 'redrawInProgress'
|
|
17123
17351
|
});
|
|
17124
17352
|
}, 10);
|
|
@@ -17168,7 +17396,7 @@
|
|
|
17168
17396
|
// reset composite mode to default
|
|
17169
17397
|
ctx.globalCompositeOperation = 'source-over';
|
|
17170
17398
|
var rectOffsetTop = canvas.offsetTop;
|
|
17171
|
-
|
|
17399
|
+
dispatchIdCaptureAction({
|
|
17172
17400
|
type: 'redrawCompleted',
|
|
17173
17401
|
payload: {
|
|
17174
17402
|
guideRectX: rectX,
|
|
@@ -17179,7 +17407,7 @@
|
|
|
17179
17407
|
}
|
|
17180
17408
|
});
|
|
17181
17409
|
return function () {};
|
|
17182
|
-
}, [aspectRatio, borderColor, borderRadius, borderWidth,
|
|
17410
|
+
}, [aspectRatio, borderColor, borderRadius, borderWidth, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
|
|
17183
17411
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CanvasWrapper$1, {
|
|
17184
17412
|
ref: wrapperRef,
|
|
17185
17413
|
"$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
|
|
@@ -17229,7 +17457,7 @@
|
|
|
17229
17457
|
colors = _k === void 0 ? {} : _k,
|
|
17230
17458
|
_l = _a.verbiage,
|
|
17231
17459
|
rawVerbiage = _l === void 0 ? {} : _l;
|
|
17232
|
-
var state =
|
|
17460
|
+
var state = useIdCaptureStore();
|
|
17233
17461
|
var isRearFacing = useCameraStore(function (state) {
|
|
17234
17462
|
return state.isRearFacing;
|
|
17235
17463
|
});
|
|
@@ -18192,7 +18420,7 @@
|
|
|
18192
18420
|
var templateObject_1$m, templateObject_2$k, templateObject_3$g, templateObject_4$a, templateObject_5$6, templateObject_6$5;
|
|
18193
18421
|
|
|
18194
18422
|
function ScalingCameraFeed() {
|
|
18195
|
-
var _a =
|
|
18423
|
+
var _a = useIdCaptureStore(),
|
|
18196
18424
|
captureState = _a.captureState,
|
|
18197
18425
|
guideRectX = _a.guideRectX,
|
|
18198
18426
|
guideRectY = _a.guideRectY,
|
|
@@ -18218,14 +18446,12 @@
|
|
|
18218
18446
|
classNames = _b === void 0 ? {} : _b,
|
|
18219
18447
|
_c = _a.verbiage,
|
|
18220
18448
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
18221
|
-
var
|
|
18222
|
-
state = _d[0],
|
|
18223
|
-
dispatch = _d[1];
|
|
18449
|
+
var state = useIdCaptureStore();
|
|
18224
18450
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
18225
18451
|
var loadModels = React.useContext(IdCaptureModelsContext).load;
|
|
18226
|
-
var
|
|
18227
|
-
selectIdTypeModalOpen =
|
|
18228
|
-
setSelectIdTypeModalOpen =
|
|
18452
|
+
var _d = React.useState(false),
|
|
18453
|
+
selectIdTypeModalOpen = _d[0],
|
|
18454
|
+
setSelectIdTypeModalOpen = _d[1];
|
|
18229
18455
|
var verbiage = useTranslations(rawVerbiage, {
|
|
18230
18456
|
captureWithCameraText: 'Capture with Camera',
|
|
18231
18457
|
orText: 'OR',
|
|
@@ -18257,7 +18483,7 @@
|
|
|
18257
18483
|
onClick: function onClick() {
|
|
18258
18484
|
loadModels();
|
|
18259
18485
|
void requestCameraAccess();
|
|
18260
|
-
dispatch({
|
|
18486
|
+
state.dispatch({
|
|
18261
18487
|
type: 'setUploadingDocumentsFromStorage',
|
|
18262
18488
|
payload: false
|
|
18263
18489
|
});
|
|
@@ -18274,19 +18500,19 @@
|
|
|
18274
18500
|
className: classNames.uploadFromStorageButton,
|
|
18275
18501
|
colors: buttonColors,
|
|
18276
18502
|
onClick: function onClick() {
|
|
18277
|
-
dispatch({
|
|
18503
|
+
state.dispatch({
|
|
18278
18504
|
type: 'setUploadingDocumentsFromStorage',
|
|
18279
18505
|
payload: true
|
|
18280
18506
|
});
|
|
18281
18507
|
if (state.captureRequirement === 'idCardOrPassport') {
|
|
18282
18508
|
setSelectIdTypeModalOpen(true);
|
|
18283
18509
|
} else if (state.captureRequirement === 'passport') {
|
|
18284
|
-
dispatch({
|
|
18510
|
+
state.dispatch({
|
|
18285
18511
|
type: 'setUploadingDocumentsType',
|
|
18286
18512
|
payload: 'passport'
|
|
18287
18513
|
});
|
|
18288
18514
|
} else {
|
|
18289
|
-
dispatch({
|
|
18515
|
+
state.dispatch({
|
|
18290
18516
|
type: 'setUploadingDocumentsType',
|
|
18291
18517
|
payload: 'idCard'
|
|
18292
18518
|
});
|
|
@@ -18306,7 +18532,7 @@
|
|
|
18306
18532
|
className: classNames.selectPassportTypeButton,
|
|
18307
18533
|
colors: buttonColors,
|
|
18308
18534
|
onClick: function onClick() {
|
|
18309
|
-
return dispatch({
|
|
18535
|
+
return state.dispatch({
|
|
18310
18536
|
type: 'setUploadingDocumentsType',
|
|
18311
18537
|
payload: 'passport'
|
|
18312
18538
|
});
|
|
@@ -18319,7 +18545,7 @@
|
|
|
18319
18545
|
className: classNames.selectIdCardTypeButton,
|
|
18320
18546
|
colors: buttonColors,
|
|
18321
18547
|
onClick: function onClick() {
|
|
18322
|
-
return dispatch({
|
|
18548
|
+
return state.dispatch({
|
|
18323
18549
|
type: 'setUploadingDocumentsType',
|
|
18324
18550
|
payload: 'idCard'
|
|
18325
18551
|
});
|
|
@@ -18370,20 +18596,18 @@
|
|
|
18370
18596
|
}, verbiage.continueText)));
|
|
18371
18597
|
}
|
|
18372
18598
|
function IdDocumentUploadScreen(_a) {
|
|
18599
|
+
var _this = this;
|
|
18373
18600
|
var _b = _a.classNames,
|
|
18374
18601
|
classNames = _b === void 0 ? {} : _b,
|
|
18375
18602
|
_c = _a.verbiage,
|
|
18376
18603
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
18377
|
-
var
|
|
18378
|
-
|
|
18379
|
-
|
|
18604
|
+
var state = useIdCaptureStore();
|
|
18605
|
+
var _d = React.useState(null),
|
|
18606
|
+
idFrontFile = _d[0],
|
|
18607
|
+
setIdFrontFile = _d[1];
|
|
18380
18608
|
var _e = React.useState(null),
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
var _f = React.useState(null),
|
|
18384
|
-
idBackFile = _f[0],
|
|
18385
|
-
setIdBackFile = _f[1];
|
|
18386
|
-
var onCapturedManually = useOnCapturedManually();
|
|
18609
|
+
idBackFile = _e[0],
|
|
18610
|
+
setIdBackFile = _e[1];
|
|
18387
18611
|
var verbiage = useTranslations(rawVerbiage, {
|
|
18388
18612
|
uploadIdFrontText: 'Upload ID Front',
|
|
18389
18613
|
uploadIdBackText: 'Upload ID Back',
|
|
@@ -18423,25 +18647,56 @@
|
|
|
18423
18647
|
disabled: !idFrontFile || !state.allowSinglePageIdCapture && !idBackFile,
|
|
18424
18648
|
colors: buttonColors,
|
|
18425
18649
|
onClick: function onClick() {
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
|
|
18650
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
18651
|
+
var _a, _b, _c, _d, _e;
|
|
18652
|
+
var _f, _g, _h, _j, _k;
|
|
18653
|
+
return __generator(this, function (_l) {
|
|
18654
|
+
switch (_l.label) {
|
|
18655
|
+
case 0:
|
|
18656
|
+
if (!(!idBackFile && state.allowSinglePageIdCapture)) return [3 /*break*/, 2];
|
|
18657
|
+
state.dispatch({
|
|
18658
|
+
type: 'setUploadingDocumentsType',
|
|
18659
|
+
payload: 'singlePage'
|
|
18660
|
+
});
|
|
18661
|
+
_b = (_a = state).dispatch;
|
|
18662
|
+
_f = {
|
|
18663
|
+
type: 'documentCaptured'
|
|
18664
|
+
};
|
|
18665
|
+
_g = {};
|
|
18666
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
18667
|
+
case 1:
|
|
18668
|
+
_b.apply(_a, [(_f.payload = (_g.imageData = _l.sent(), _g.documentType = 'singlePage', _g.width = 0, _g.height = 0, _g), _f)]);
|
|
18669
|
+
return [3 /*break*/, 5];
|
|
18670
|
+
case 2:
|
|
18671
|
+
_d = (_c = state).dispatch;
|
|
18672
|
+
_h = {
|
|
18673
|
+
type: 'documentsCaptured'
|
|
18674
|
+
};
|
|
18675
|
+
_j = {};
|
|
18676
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
18677
|
+
case 3:
|
|
18678
|
+
_e = [(_j.imageData = _l.sent(), _j.documentType = 'idCardFront', _j.width = 0, _j.height = 0, _j)];
|
|
18679
|
+
_k = {};
|
|
18680
|
+
return [4 /*yield*/, readFile(idBackFile)];
|
|
18681
|
+
case 4:
|
|
18682
|
+
_d.apply(_c, [(_h.payload = _e.concat([(_k.imageData = _l.sent(), _k.documentType = 'idCardBack', _k.width = 0, _k.height = 0, _k)]), _h)]);
|
|
18683
|
+
_l.label = 5;
|
|
18684
|
+
case 5:
|
|
18685
|
+
return [2 /*return*/];
|
|
18686
|
+
}
|
|
18430
18687
|
});
|
|
18431
|
-
}
|
|
18432
|
-
void onCapturedManually(idFrontFile, idBackFile);
|
|
18688
|
+
});
|
|
18433
18689
|
}
|
|
18434
18690
|
}, verbiage.continueText)));
|
|
18435
18691
|
}
|
|
18436
18692
|
function CancelUploadTypeButton(_a) {
|
|
18437
18693
|
var children = _a.children,
|
|
18438
18694
|
className = _a.className;
|
|
18439
|
-
var dispatch = useIdCaptureState()[1];
|
|
18440
18695
|
return /*#__PURE__*/React.createElement(Button, {
|
|
18441
18696
|
className: className,
|
|
18442
18697
|
colors: buttonColors,
|
|
18443
18698
|
onClick: function onClick() {
|
|
18444
|
-
return
|
|
18699
|
+
return dispatchIdCaptureAction({
|
|
18445
18700
|
type: 'setUploadingDocumentsType',
|
|
18446
18701
|
payload: null
|
|
18447
18702
|
});
|
|
@@ -18449,7 +18704,6 @@
|
|
|
18449
18704
|
}, children);
|
|
18450
18705
|
}
|
|
18451
18706
|
function useOnCapturedManually() {
|
|
18452
|
-
var dispatch = useIdCaptureState()[1];
|
|
18453
18707
|
return React.useCallback(function () {
|
|
18454
18708
|
var files = [];
|
|
18455
18709
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -18458,7 +18712,7 @@
|
|
|
18458
18712
|
return Promise.all(files.filter(Boolean).map(readFile)).then(function (f) {
|
|
18459
18713
|
for (var _i = 0, f_1 = f; _i < f_1.length; _i++) {
|
|
18460
18714
|
var imageData = f_1[_i];
|
|
18461
|
-
|
|
18715
|
+
dispatchIdCaptureAction({
|
|
18462
18716
|
type: 'documentCapturedManually',
|
|
18463
18717
|
payload: {
|
|
18464
18718
|
imageData: imageData
|
|
@@ -18466,7 +18720,7 @@
|
|
|
18466
18720
|
});
|
|
18467
18721
|
}
|
|
18468
18722
|
});
|
|
18469
|
-
}, [
|
|
18723
|
+
}, []);
|
|
18470
18724
|
}
|
|
18471
18725
|
function readFile(file) {
|
|
18472
18726
|
return new Promise(function (resolve, reject) {
|
|
@@ -18870,32 +19124,30 @@
|
|
|
18870
19124
|
verbiage = _3 === void 0 ? {} : _3,
|
|
18871
19125
|
_4 = _a.debugMode,
|
|
18872
19126
|
debugMode = _4 === void 0 ? false : _4;
|
|
18873
|
-
var
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
modelError = _9.modelError,
|
|
18896
|
-
resetBestFrame = _9.resetBestFrame;
|
|
19127
|
+
var state = useIdCaptureStore();
|
|
19128
|
+
var _5 = useCameraStore(),
|
|
19129
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
19130
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
19131
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
19132
|
+
var _6 = React.useState(false),
|
|
19133
|
+
overlayDismissed = _6[0],
|
|
19134
|
+
setOverlayDismissed = _6[1];
|
|
19135
|
+
var _7 = React.useContext(SubmissionContext),
|
|
19136
|
+
submissionStatus = _7.submissionStatus,
|
|
19137
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
19138
|
+
setIdBackImage = _7.setIdBackImage,
|
|
19139
|
+
setPassportImage = _7.setPassportImage,
|
|
19140
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
19141
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
19142
|
+
var _8 = React.useContext(IdCaptureModelsContext),
|
|
19143
|
+
start = _8.start,
|
|
19144
|
+
stop = _8.stop,
|
|
19145
|
+
onPredictionMade = _8.onPredictionMade,
|
|
19146
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
19147
|
+
modelError = _8.modelError,
|
|
19148
|
+
resetBestFrame = _8.resetBestFrame;
|
|
18897
19149
|
React.useEffect(function () {
|
|
18898
|
-
|
|
19150
|
+
dispatchIdCaptureAction({
|
|
18899
19151
|
type: 'configureWizard',
|
|
18900
19152
|
payload: {
|
|
18901
19153
|
captureRequirement: captureRequirement,
|
|
@@ -18907,7 +19159,7 @@
|
|
|
18907
19159
|
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
18908
19160
|
}
|
|
18909
19161
|
});
|
|
18910
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement,
|
|
19162
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
18911
19163
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
18912
19164
|
React.useEffect(function () {
|
|
18913
19165
|
if (documentCount) resetBestFrame();
|
|
@@ -18923,15 +19175,15 @@
|
|
|
18923
19175
|
}, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
|
|
18924
19176
|
React.useEffect(function startModelsWhenCapturing() {
|
|
18925
19177
|
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
18926
|
-
|
|
19178
|
+
dispatchIdCaptureAction({
|
|
18927
19179
|
type: 'captureStarted'
|
|
18928
19180
|
});
|
|
18929
19181
|
start();
|
|
18930
|
-
}, [
|
|
19182
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
18931
19183
|
React.useEffect(function () {
|
|
18932
19184
|
onPredictionMade(function (prediction) {
|
|
18933
19185
|
if (state.captureState === 'capturing') {
|
|
18934
|
-
|
|
19186
|
+
dispatchIdCaptureAction({
|
|
18935
19187
|
type: 'objectsDetected',
|
|
18936
19188
|
payload: {
|
|
18937
19189
|
prediction: prediction
|
|
@@ -18940,19 +19192,19 @@
|
|
|
18940
19192
|
} else if (state.captureState === 'requestingFlip') {
|
|
18941
19193
|
if (state.requestedDocumentType !== 'selfie' && prediction["".concat(state.requestedDocumentType, "DetectionThresholdMet")]) {
|
|
18942
19194
|
resetBestFrame();
|
|
18943
|
-
|
|
19195
|
+
dispatchIdCaptureAction({
|
|
18944
19196
|
type: 'flipRequestCompleted'
|
|
18945
19197
|
});
|
|
18946
19198
|
}
|
|
18947
19199
|
}
|
|
18948
19200
|
});
|
|
18949
|
-
}, [
|
|
19201
|
+
}, [onPredictionMade, resetBestFrame, state.captureState, state.requestedDocumentType]);
|
|
18950
19202
|
React.useEffect(function () {
|
|
18951
19203
|
if (state.captureState === 'complete') stop();
|
|
18952
19204
|
}, [state.captureState, stop]);
|
|
18953
19205
|
var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
|
|
18954
19206
|
logCaptureMetadata(metadata);
|
|
18955
|
-
|
|
19207
|
+
dispatchIdCaptureAction({
|
|
18956
19208
|
type: 'documentCaptured',
|
|
18957
19209
|
payload: {
|
|
18958
19210
|
imageData: imageData,
|
|
@@ -18964,7 +19216,7 @@
|
|
|
18964
19216
|
focusScore: metadata.bestFocusScore
|
|
18965
19217
|
}
|
|
18966
19218
|
});
|
|
18967
|
-
}, [
|
|
19219
|
+
}, [logCaptureMetadata]);
|
|
18968
19220
|
var onSubmitClick = React.useCallback(function () {
|
|
18969
19221
|
var _a = state.capturedDocuments,
|
|
18970
19222
|
idCardFront = _a.idCardFront,
|
|
@@ -18990,25 +19242,25 @@
|
|
|
18990
19242
|
}, [onSuccess, releaseCameraAccess, releaseCameraAccessOnExit, setIdBackImage, setIdFrontImage, setPassportImage, state.capturedDocuments]);
|
|
18991
19243
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, state.captureState === 'complete', onSubmitClick);
|
|
18992
19244
|
var onRetryClick = React.useCallback(function () {
|
|
18993
|
-
|
|
19245
|
+
return dispatchIdCaptureAction({
|
|
18994
19246
|
type: 'resetWizard'
|
|
18995
19247
|
});
|
|
18996
|
-
}, [
|
|
18997
|
-
var
|
|
18998
|
-
attempt =
|
|
18999
|
-
setAttempt =
|
|
19248
|
+
}, []);
|
|
19249
|
+
var _9 = React.useState(0),
|
|
19250
|
+
attempt = _9[0],
|
|
19251
|
+
setAttempt = _9[1];
|
|
19000
19252
|
var onExit = React.useCallback(function () {
|
|
19001
19253
|
releaseCameraAccess();
|
|
19002
19254
|
setOverlayDismissed(false);
|
|
19003
19255
|
setAttempt(function (n) {
|
|
19004
19256
|
return n + 1;
|
|
19005
19257
|
});
|
|
19006
|
-
|
|
19258
|
+
dispatchIdCaptureAction({
|
|
19007
19259
|
type: 'resetWizard'
|
|
19008
19260
|
});
|
|
19009
19261
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
19010
19262
|
void requestCameraAccess();
|
|
19011
|
-
}, [
|
|
19263
|
+
}, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
|
|
19012
19264
|
React.useEffect(function () {
|
|
19013
19265
|
if (submissionStatus !== SubmissionStatus.READY) {
|
|
19014
19266
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
@@ -19041,14 +19293,14 @@
|
|
|
19041
19293
|
if (state.captureState !== 'requestingFlip') return;
|
|
19042
19294
|
var t = setTimeout(function () {
|
|
19043
19295
|
resetBestFrame();
|
|
19044
|
-
|
|
19296
|
+
dispatchIdCaptureAction({
|
|
19045
19297
|
type: 'flipRequestCompleted'
|
|
19046
19298
|
});
|
|
19047
19299
|
}, 6000);
|
|
19048
19300
|
return function () {
|
|
19049
19301
|
clearTimeout(t);
|
|
19050
19302
|
};
|
|
19051
|
-
}, [
|
|
19303
|
+
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
19052
19304
|
React.useEffect(function () {
|
|
19053
19305
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
19054
19306
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -19076,7 +19328,7 @@
|
|
|
19076
19328
|
return [4 /*yield*/, dataUrlToBase64(imageData)];
|
|
19077
19329
|
case 1:
|
|
19078
19330
|
base64ImageData = _a.sent();
|
|
19079
|
-
|
|
19331
|
+
dispatchIdCaptureAction({
|
|
19080
19332
|
type: 'documentCapturedManually',
|
|
19081
19333
|
payload: {
|
|
19082
19334
|
imageData: base64ImageData
|
|
@@ -19086,10 +19338,10 @@
|
|
|
19086
19338
|
}
|
|
19087
19339
|
});
|
|
19088
19340
|
});
|
|
19089
|
-
}, [
|
|
19090
|
-
var
|
|
19091
|
-
progressStarted =
|
|
19092
|
-
setProgressStarted =
|
|
19341
|
+
}, []);
|
|
19342
|
+
var _10 = React.useState(false),
|
|
19343
|
+
progressStarted = _10[0],
|
|
19344
|
+
setProgressStarted = _10[1];
|
|
19093
19345
|
React.useEffect(function () {
|
|
19094
19346
|
if (state.captureState === 'capturing') {
|
|
19095
19347
|
setProgressStarted(false);
|
|
@@ -19169,7 +19421,7 @@
|
|
|
19169
19421
|
capturedDocuments: state.capturedDocuments,
|
|
19170
19422
|
classNames: classNames.success,
|
|
19171
19423
|
onSubmitClick: function onSubmitClick() {
|
|
19172
|
-
|
|
19424
|
+
return dispatchIdCaptureAction({
|
|
19173
19425
|
type: 'flipRequestCompleted'
|
|
19174
19426
|
});
|
|
19175
19427
|
},
|