idmission-web-sdk 2.2.100 → 2.2.102
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 +22 -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 -235
- 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 -236
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +544 -312
- 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/package.json +1 -1
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.2.
|
|
214
|
+
var webSdkVersion = '2.2.102';
|
|
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;
|
|
@@ -10863,7 +11168,9 @@
|
|
|
10863
11168
|
} else {
|
|
10864
11169
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
10865
11170
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10866
|
-
newState.
|
|
11171
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
11172
|
+
newState.captureState = 'requestingFlip';
|
|
11173
|
+
}
|
|
10867
11174
|
newState.idCardFrontDetectionThresholdMet = false;
|
|
10868
11175
|
newState.idCardBackDetectionThresholdMet = false;
|
|
10869
11176
|
newState.passportDetectionThresholdMet = false;
|
|
@@ -10873,28 +11180,23 @@
|
|
|
10873
11180
|
return newState;
|
|
10874
11181
|
}
|
|
10875
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':
|
|
10876
11192
|
{
|
|
10877
|
-
var newState = _assign(
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
10885
|
-
if (remainingRequirements.length === 0) {
|
|
10886
|
-
newState.captureState = 'complete';
|
|
10887
|
-
} else {
|
|
10888
|
-
newState.requestedDocumentType = remainingRequirements[0];
|
|
10889
|
-
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10890
|
-
if (!newState.isUploadingDocumentsFromStorage) {
|
|
10891
|
-
newState.captureState = 'requestingFlip';
|
|
10892
|
-
}
|
|
10893
|
-
newState.idCardFrontDetectionThresholdMet = false;
|
|
10894
|
-
newState.idCardBackDetectionThresholdMet = false;
|
|
10895
|
-
newState.passportDetectionThresholdMet = false;
|
|
10896
|
-
newState.wrongDocumentTypePredictions = 0;
|
|
10897
|
-
}
|
|
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
|
+
});
|
|
10898
11200
|
}
|
|
10899
11201
|
return newState;
|
|
10900
11202
|
}
|
|
@@ -10931,6 +11233,9 @@
|
|
|
10931
11233
|
}
|
|
10932
11234
|
case 'resetWizard':
|
|
10933
11235
|
return _assign(_assign({}, initialState$4), {
|
|
11236
|
+
dispatch: state.dispatch,
|
|
11237
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
11238
|
+
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
10934
11239
|
captureRequirement: state.captureRequirement,
|
|
10935
11240
|
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
10936
11241
|
});
|
|
@@ -10938,13 +11243,26 @@
|
|
|
10938
11243
|
return state;
|
|
10939
11244
|
}
|
|
10940
11245
|
};
|
|
10941
|
-
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) {
|
|
10942
11256
|
var children = _a.children;
|
|
10943
|
-
var
|
|
10944
|
-
state
|
|
10945
|
-
|
|
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]);
|
|
10946
11264
|
var onResize = c(function () {
|
|
10947
|
-
|
|
11265
|
+
dispatchIdCaptureAction({
|
|
10948
11266
|
type: 'redrawRequested'
|
|
10949
11267
|
});
|
|
10950
11268
|
}, 500);
|
|
@@ -10952,26 +11270,13 @@
|
|
|
10952
11270
|
if (typeof window === 'undefined') return;
|
|
10953
11271
|
window.addEventListener('resize', onResize);
|
|
10954
11272
|
return function () {
|
|
10955
|
-
window.removeEventListener('resize', onResize);
|
|
11273
|
+
return window.removeEventListener('resize', onResize);
|
|
10956
11274
|
};
|
|
10957
11275
|
}, [onResize]);
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
}
|
|
10963
|
-
}, [state.overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
10964
|
-
return /*#__PURE__*/React.createElement(IdCaptureStateContext.Provider, {
|
|
10965
|
-
value: state
|
|
10966
|
-
}, /*#__PURE__*/React.createElement(IdCaptureDispatchContext.Provider, {
|
|
10967
|
-
value: dispatch
|
|
10968
|
-
}, children));
|
|
10969
|
-
};
|
|
10970
|
-
var useIdCaptureState = function useIdCaptureState() {
|
|
10971
|
-
var state = React.useContext(IdCaptureStateContext);
|
|
10972
|
-
var dispatch = React.useContext(IdCaptureDispatchContext);
|
|
10973
|
-
if (!state || !dispatch) throw new Error('useIdCaptureState cannot be used without IdCaptureStateProvider');
|
|
10974
|
-
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);
|
|
10975
11280
|
};
|
|
10976
11281
|
|
|
10977
11282
|
function DebugStatsPane(_a) {
|
|
@@ -11046,7 +11351,7 @@
|
|
|
11046
11351
|
var scaling = _a.scaling,
|
|
11047
11352
|
$flipX = _a.$flipX,
|
|
11048
11353
|
children = _a.children;
|
|
11049
|
-
var _b =
|
|
11354
|
+
var _b = useIdCaptureStore(),
|
|
11050
11355
|
guideRectWidth = _b.guideRectWidth,
|
|
11051
11356
|
guideRectHeight = _b.guideRectHeight,
|
|
11052
11357
|
guideRectX = _b.guideRectX,
|
|
@@ -11552,9 +11857,9 @@
|
|
|
11552
11857
|
return e;
|
|
11553
11858
|
}
|
|
11554
11859
|
|
|
11555
|
-
function _createForOfIteratorHelperLoose
|
|
11556
|
-
function _unsupportedIterableToArray
|
|
11557
|
-
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; }
|
|
11558
11863
|
var consoleLogger = {
|
|
11559
11864
|
type: 'logger',
|
|
11560
11865
|
log: function log(args) {
|
|
@@ -12401,7 +12706,7 @@
|
|
|
12401
12706
|
}
|
|
12402
12707
|
if (!useOptionsReplaceForData) {
|
|
12403
12708
|
data = _extends({}, data);
|
|
12404
|
-
for (var _iterator = _createForOfIteratorHelperLoose
|
|
12709
|
+
for (var _iterator = _createForOfIteratorHelperLoose(optionsKeys), _step; !(_step = _iterator()).done;) {
|
|
12405
12710
|
var key = _step.value;
|
|
12406
12711
|
delete data[key];
|
|
12407
12712
|
}
|
|
@@ -15001,14 +15306,14 @@
|
|
|
15001
15306
|
classNames = _b === void 0 ? {} : _b,
|
|
15002
15307
|
_c = _a.verbiage,
|
|
15003
15308
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
15004
|
-
var _d =
|
|
15005
|
-
|
|
15006
|
-
dispatch = _d
|
|
15309
|
+
var _d = useIdCaptureStore(),
|
|
15310
|
+
allowOverrideWrongDocumentTypeGuidance = _d.allowOverrideWrongDocumentTypeGuidance,
|
|
15311
|
+
dispatch = _d.dispatch;
|
|
15007
15312
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15008
15313
|
messageText: 'We are having trouble identifying the correct side of your id, do you want to continue with capture anyway?',
|
|
15009
15314
|
buttonText: 'OK'
|
|
15010
15315
|
});
|
|
15011
|
-
if (!
|
|
15316
|
+
if (!allowOverrideWrongDocumentTypeGuidance) return null;
|
|
15012
15317
|
return /*#__PURE__*/React.createElement(Container$2, {
|
|
15013
15318
|
className: classNames.container
|
|
15014
15319
|
}, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
@@ -15062,52 +15367,50 @@
|
|
|
15062
15367
|
width = _q === void 0 ? 1 : _q,
|
|
15063
15368
|
_r = _p.height,
|
|
15064
15369
|
height = _r === void 0 ? 1 : _r;
|
|
15065
|
-
var
|
|
15066
|
-
|
|
15067
|
-
|
|
15068
|
-
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
focusPredictionTime = _u.focusPredictionTime,
|
|
15076
|
-
getBestFrame = _u.getBestFrame;
|
|
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;
|
|
15077
15380
|
React.useEffect(function () {
|
|
15078
|
-
return
|
|
15381
|
+
return dispatchIdCaptureAction({
|
|
15079
15382
|
type: 'captureInitialized'
|
|
15080
15383
|
});
|
|
15081
|
-
}, [
|
|
15384
|
+
}, []);
|
|
15082
15385
|
React.useEffect(function () {
|
|
15083
15386
|
setThresholds(thresholds);
|
|
15084
15387
|
}, [thresholds, setThresholds]);
|
|
15085
15388
|
React.useEffect(function () {
|
|
15086
15389
|
if (!requiredDocumentType) return;
|
|
15087
|
-
|
|
15390
|
+
dispatchIdCaptureAction({
|
|
15088
15391
|
type: 'setRequiredDocumentType',
|
|
15089
15392
|
payload: requiredDocumentType
|
|
15090
15393
|
});
|
|
15091
|
-
}, [
|
|
15394
|
+
}, [requiredDocumentType]);
|
|
15092
15395
|
React.useEffect(function () {
|
|
15093
|
-
|
|
15396
|
+
dispatchIdCaptureAction({
|
|
15094
15397
|
type: 'pageRendered',
|
|
15095
15398
|
payload: {
|
|
15096
15399
|
pageWidth: width,
|
|
15097
15400
|
pageHeight: height
|
|
15098
15401
|
}
|
|
15099
15402
|
});
|
|
15100
|
-
}, [
|
|
15403
|
+
}, [height, width]);
|
|
15101
15404
|
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
15102
15405
|
React.useEffect(function () {
|
|
15103
15406
|
if (!shouldCapture) return;
|
|
15104
|
-
|
|
15407
|
+
dispatchIdCaptureAction({
|
|
15105
15408
|
type: 'capturing'
|
|
15106
15409
|
});
|
|
15107
15410
|
var bestFrame = getBestFrame();
|
|
15108
15411
|
if (!bestFrame) {
|
|
15109
15412
|
log('uh oh, i did not get a photo');
|
|
15110
|
-
|
|
15413
|
+
dispatchIdCaptureAction({
|
|
15111
15414
|
type: 'captureFailed'
|
|
15112
15415
|
});
|
|
15113
15416
|
return;
|
|
@@ -15120,7 +15423,7 @@
|
|
|
15120
15423
|
var width = canvas.width,
|
|
15121
15424
|
height = canvas.height;
|
|
15122
15425
|
var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
|
|
15123
|
-
|
|
15426
|
+
dispatchIdCaptureAction({
|
|
15124
15427
|
type: 'frameCaptured',
|
|
15125
15428
|
payload: {
|
|
15126
15429
|
imageUrl: imageUrl
|
|
@@ -15138,11 +15441,11 @@
|
|
|
15138
15441
|
bestFocusScore: focusScore
|
|
15139
15442
|
};
|
|
15140
15443
|
onCapture === null || onCapture === void 0 ? void 0 : onCapture(imageUrl, width, height, capturedDocumentType, metadata);
|
|
15141
|
-
|
|
15444
|
+
dispatchIdCaptureAction({
|
|
15142
15445
|
type: 'captured'
|
|
15143
15446
|
});
|
|
15144
15447
|
}, 0);
|
|
15145
|
-
}, [
|
|
15448
|
+
}, [getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
|
|
15146
15449
|
var theme = styled.useTheme();
|
|
15147
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');
|
|
15148
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');
|
|
@@ -15868,12 +16171,6 @@
|
|
|
15868
16171
|
var _q = React.useState(false),
|
|
15869
16172
|
dismissed = _q[0],
|
|
15870
16173
|
setDismissed = _q[1];
|
|
15871
|
-
var dispatch = useIdCaptureState()[1];
|
|
15872
|
-
React.useEffect(function () {
|
|
15873
|
-
return dispatch({
|
|
15874
|
-
type: 'captureInitialized'
|
|
15875
|
-
});
|
|
15876
|
-
}, [dispatch]);
|
|
15877
16174
|
assets.instructionImageUrl || (assets.instructionImageUrl = legacyInstructionImageUrl$1);
|
|
15878
16175
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15879
16176
|
headingText: 'Use your device camera to capture your ID',
|
|
@@ -16044,80 +16341,6 @@
|
|
|
16044
16341
|
});
|
|
16045
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;
|
|
16046
16343
|
|
|
16047
|
-
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."); }
|
|
16048
|
-
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; } }
|
|
16049
|
-
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; }
|
|
16050
|
-
var isIterable = function isIterable(obj) {
|
|
16051
|
-
return Symbol.iterator in obj;
|
|
16052
|
-
};
|
|
16053
|
-
var hasIterableEntries = function hasIterableEntries(value) {
|
|
16054
|
-
return (
|
|
16055
|
-
// HACK: avoid checking entries type
|
|
16056
|
-
"entries" in value
|
|
16057
|
-
);
|
|
16058
|
-
};
|
|
16059
|
-
var compareEntries = function compareEntries(valueA, valueB) {
|
|
16060
|
-
var mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
|
|
16061
|
-
var mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
|
|
16062
|
-
if (mapA.size !== mapB.size) {
|
|
16063
|
-
return false;
|
|
16064
|
-
}
|
|
16065
|
-
for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
|
|
16066
|
-
var _step$value = _step.value,
|
|
16067
|
-
key = _step$value[0],
|
|
16068
|
-
value = _step$value[1];
|
|
16069
|
-
if (!Object.is(value, mapB.get(key))) {
|
|
16070
|
-
return false;
|
|
16071
|
-
}
|
|
16072
|
-
}
|
|
16073
|
-
return true;
|
|
16074
|
-
};
|
|
16075
|
-
var compareIterables = function compareIterables(valueA, valueB) {
|
|
16076
|
-
var iteratorA = valueA[Symbol.iterator]();
|
|
16077
|
-
var iteratorB = valueB[Symbol.iterator]();
|
|
16078
|
-
var nextA = iteratorA.next();
|
|
16079
|
-
var nextB = iteratorB.next();
|
|
16080
|
-
while (!nextA.done && !nextB.done) {
|
|
16081
|
-
if (!Object.is(nextA.value, nextB.value)) {
|
|
16082
|
-
return false;
|
|
16083
|
-
}
|
|
16084
|
-
nextA = iteratorA.next();
|
|
16085
|
-
nextB = iteratorB.next();
|
|
16086
|
-
}
|
|
16087
|
-
return !!nextA.done && !!nextB.done;
|
|
16088
|
-
};
|
|
16089
|
-
function shallow(valueA, valueB) {
|
|
16090
|
-
if (Object.is(valueA, valueB)) {
|
|
16091
|
-
return true;
|
|
16092
|
-
}
|
|
16093
|
-
if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
|
|
16094
|
-
return false;
|
|
16095
|
-
}
|
|
16096
|
-
if (!isIterable(valueA) || !isIterable(valueB)) {
|
|
16097
|
-
return compareEntries({
|
|
16098
|
-
entries: function entries() {
|
|
16099
|
-
return Object.entries(valueA);
|
|
16100
|
-
}
|
|
16101
|
-
}, {
|
|
16102
|
-
entries: function entries() {
|
|
16103
|
-
return Object.entries(valueB);
|
|
16104
|
-
}
|
|
16105
|
-
});
|
|
16106
|
-
}
|
|
16107
|
-
if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
|
|
16108
|
-
return compareEntries(valueA, valueB);
|
|
16109
|
-
}
|
|
16110
|
-
return compareIterables(valueA, valueB);
|
|
16111
|
-
}
|
|
16112
|
-
|
|
16113
|
-
function useShallow(selector) {
|
|
16114
|
-
var prev = React.useRef();
|
|
16115
|
-
return function (state) {
|
|
16116
|
-
var next = selector(state);
|
|
16117
|
-
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
16118
|
-
};
|
|
16119
|
-
}
|
|
16120
|
-
|
|
16121
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"])));
|
|
16122
16345
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
16123
16346
|
var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
|
|
@@ -16932,9 +17155,7 @@
|
|
|
16932
17155
|
wrapperAspectRatio = _1.wrapperAspectRatio,
|
|
16933
17156
|
guideOrientationOnImageLoaded = _1.onImageLoaded,
|
|
16934
17157
|
setDimensions = _1.setDimensions;
|
|
16935
|
-
var
|
|
16936
|
-
state = _2[0],
|
|
16937
|
-
dispatch = _2[1];
|
|
17158
|
+
var state = useIdCaptureStore();
|
|
16938
17159
|
var theme = styled.useTheme();
|
|
16939
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;
|
|
16940
17161
|
React.useEffect(function () {
|
|
@@ -16960,14 +17181,14 @@
|
|
|
16960
17181
|
var imageByUrl = imagesByUrl[img.src];
|
|
16961
17182
|
var width = (_a = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.width) !== null && _a !== void 0 ? _a : img.naturalWidth;
|
|
16962
17183
|
var height = (_b = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.height) !== null && _b !== void 0 ? _b : img.naturalHeight;
|
|
16963
|
-
|
|
17184
|
+
dispatchIdCaptureAction({
|
|
16964
17185
|
type: 'guideImageLoaded',
|
|
16965
17186
|
payload: {
|
|
16966
17187
|
width: width,
|
|
16967
17188
|
height: height
|
|
16968
17189
|
}
|
|
16969
17190
|
});
|
|
16970
|
-
}, [
|
|
17191
|
+
}, [guideOrientationOnImageLoaded, imagesByUrl]);
|
|
16971
17192
|
return /*#__PURE__*/React.createElement(StyledPageContainer, {
|
|
16972
17193
|
ref: wrapperRef,
|
|
16973
17194
|
onClick: onClick,
|
|
@@ -17097,19 +17318,17 @@
|
|
|
17097
17318
|
images = _w === void 0 ? defaultIdCaptureGuideImages : _w,
|
|
17098
17319
|
_x = _a.classNames,
|
|
17099
17320
|
classNames = _x === void 0 ? {} : _x;
|
|
17100
|
-
var _y =
|
|
17101
|
-
|
|
17102
|
-
|
|
17103
|
-
|
|
17104
|
-
guideImageHeight = _z.guideImageHeight,
|
|
17105
|
-
dispatch = _y[1];
|
|
17321
|
+
var _y = useIdCaptureStore(),
|
|
17322
|
+
redrawing = _y.redrawing,
|
|
17323
|
+
guideImageWidth = _y.guideImageWidth,
|
|
17324
|
+
guideImageHeight = _y.guideImageHeight;
|
|
17106
17325
|
var canvasRef = React.useRef(null);
|
|
17107
|
-
var
|
|
17108
|
-
wrapperRef =
|
|
17109
|
-
|
|
17110
|
-
wrapperWidth =
|
|
17111
|
-
|
|
17112
|
-
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;
|
|
17113
17332
|
var theme = styled.useTheme();
|
|
17114
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;
|
|
17115
17334
|
if (padding === undefined) {
|
|
@@ -17127,7 +17346,7 @@
|
|
|
17127
17346
|
if (redrawing) {
|
|
17128
17347
|
resetCanvasDimensions(canvas);
|
|
17129
17348
|
var timer_1 = setTimeout(function () {
|
|
17130
|
-
|
|
17349
|
+
dispatchIdCaptureAction({
|
|
17131
17350
|
type: 'redrawInProgress'
|
|
17132
17351
|
});
|
|
17133
17352
|
}, 10);
|
|
@@ -17177,7 +17396,7 @@
|
|
|
17177
17396
|
// reset composite mode to default
|
|
17178
17397
|
ctx.globalCompositeOperation = 'source-over';
|
|
17179
17398
|
var rectOffsetTop = canvas.offsetTop;
|
|
17180
|
-
|
|
17399
|
+
dispatchIdCaptureAction({
|
|
17181
17400
|
type: 'redrawCompleted',
|
|
17182
17401
|
payload: {
|
|
17183
17402
|
guideRectX: rectX,
|
|
@@ -17188,7 +17407,7 @@
|
|
|
17188
17407
|
}
|
|
17189
17408
|
});
|
|
17190
17409
|
return function () {};
|
|
17191
|
-
}, [aspectRatio, borderColor, borderRadius, borderWidth,
|
|
17410
|
+
}, [aspectRatio, borderColor, borderRadius, borderWidth, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
|
|
17192
17411
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CanvasWrapper$1, {
|
|
17193
17412
|
ref: wrapperRef,
|
|
17194
17413
|
"$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
|
|
@@ -17238,7 +17457,7 @@
|
|
|
17238
17457
|
colors = _k === void 0 ? {} : _k,
|
|
17239
17458
|
_l = _a.verbiage,
|
|
17240
17459
|
rawVerbiage = _l === void 0 ? {} : _l;
|
|
17241
|
-
var state =
|
|
17460
|
+
var state = useIdCaptureStore();
|
|
17242
17461
|
var isRearFacing = useCameraStore(function (state) {
|
|
17243
17462
|
return state.isRearFacing;
|
|
17244
17463
|
});
|
|
@@ -18201,7 +18420,7 @@
|
|
|
18201
18420
|
var templateObject_1$m, templateObject_2$k, templateObject_3$g, templateObject_4$a, templateObject_5$6, templateObject_6$5;
|
|
18202
18421
|
|
|
18203
18422
|
function ScalingCameraFeed() {
|
|
18204
|
-
var _a =
|
|
18423
|
+
var _a = useIdCaptureStore(),
|
|
18205
18424
|
captureState = _a.captureState,
|
|
18206
18425
|
guideRectX = _a.guideRectX,
|
|
18207
18426
|
guideRectY = _a.guideRectY,
|
|
@@ -18227,14 +18446,12 @@
|
|
|
18227
18446
|
classNames = _b === void 0 ? {} : _b,
|
|
18228
18447
|
_c = _a.verbiage,
|
|
18229
18448
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
18230
|
-
var
|
|
18231
|
-
state = _d[0],
|
|
18232
|
-
dispatch = _d[1];
|
|
18449
|
+
var state = useIdCaptureStore();
|
|
18233
18450
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
18234
18451
|
var loadModels = React.useContext(IdCaptureModelsContext).load;
|
|
18235
|
-
var
|
|
18236
|
-
selectIdTypeModalOpen =
|
|
18237
|
-
setSelectIdTypeModalOpen =
|
|
18452
|
+
var _d = React.useState(false),
|
|
18453
|
+
selectIdTypeModalOpen = _d[0],
|
|
18454
|
+
setSelectIdTypeModalOpen = _d[1];
|
|
18238
18455
|
var verbiage = useTranslations(rawVerbiage, {
|
|
18239
18456
|
captureWithCameraText: 'Capture with Camera',
|
|
18240
18457
|
orText: 'OR',
|
|
@@ -18266,7 +18483,7 @@
|
|
|
18266
18483
|
onClick: function onClick() {
|
|
18267
18484
|
loadModels();
|
|
18268
18485
|
void requestCameraAccess();
|
|
18269
|
-
dispatch({
|
|
18486
|
+
state.dispatch({
|
|
18270
18487
|
type: 'setUploadingDocumentsFromStorage',
|
|
18271
18488
|
payload: false
|
|
18272
18489
|
});
|
|
@@ -18283,19 +18500,19 @@
|
|
|
18283
18500
|
className: classNames.uploadFromStorageButton,
|
|
18284
18501
|
colors: buttonColors,
|
|
18285
18502
|
onClick: function onClick() {
|
|
18286
|
-
dispatch({
|
|
18503
|
+
state.dispatch({
|
|
18287
18504
|
type: 'setUploadingDocumentsFromStorage',
|
|
18288
18505
|
payload: true
|
|
18289
18506
|
});
|
|
18290
18507
|
if (state.captureRequirement === 'idCardOrPassport') {
|
|
18291
18508
|
setSelectIdTypeModalOpen(true);
|
|
18292
18509
|
} else if (state.captureRequirement === 'passport') {
|
|
18293
|
-
dispatch({
|
|
18510
|
+
state.dispatch({
|
|
18294
18511
|
type: 'setUploadingDocumentsType',
|
|
18295
18512
|
payload: 'passport'
|
|
18296
18513
|
});
|
|
18297
18514
|
} else {
|
|
18298
|
-
dispatch({
|
|
18515
|
+
state.dispatch({
|
|
18299
18516
|
type: 'setUploadingDocumentsType',
|
|
18300
18517
|
payload: 'idCard'
|
|
18301
18518
|
});
|
|
@@ -18315,7 +18532,7 @@
|
|
|
18315
18532
|
className: classNames.selectPassportTypeButton,
|
|
18316
18533
|
colors: buttonColors,
|
|
18317
18534
|
onClick: function onClick() {
|
|
18318
|
-
return dispatch({
|
|
18535
|
+
return state.dispatch({
|
|
18319
18536
|
type: 'setUploadingDocumentsType',
|
|
18320
18537
|
payload: 'passport'
|
|
18321
18538
|
});
|
|
@@ -18328,7 +18545,7 @@
|
|
|
18328
18545
|
className: classNames.selectIdCardTypeButton,
|
|
18329
18546
|
colors: buttonColors,
|
|
18330
18547
|
onClick: function onClick() {
|
|
18331
|
-
return dispatch({
|
|
18548
|
+
return state.dispatch({
|
|
18332
18549
|
type: 'setUploadingDocumentsType',
|
|
18333
18550
|
payload: 'idCard'
|
|
18334
18551
|
});
|
|
@@ -18341,6 +18558,7 @@
|
|
|
18341
18558
|
}, /*#__PURE__*/React.createElement(XIcon, null)))));
|
|
18342
18559
|
}
|
|
18343
18560
|
function PassportUploadScreen(_a) {
|
|
18561
|
+
var _this = this;
|
|
18344
18562
|
var _b = _a.classNames,
|
|
18345
18563
|
classNames = _b === void 0 ? {} : _b,
|
|
18346
18564
|
_c = _a.verbiage,
|
|
@@ -18348,7 +18566,6 @@
|
|
|
18348
18566
|
var _d = React.useState(null),
|
|
18349
18567
|
file = _d[0],
|
|
18350
18568
|
setFile = _d[1];
|
|
18351
|
-
var onCapturedManually = useOnCapturedManually();
|
|
18352
18569
|
var verbiage = useTranslations(rawVerbiage, {
|
|
18353
18570
|
uploadPassportText: 'Upload Passport',
|
|
18354
18571
|
loadingText: 'Loading...',
|
|
@@ -18374,25 +18591,39 @@
|
|
|
18374
18591
|
disabled: !file,
|
|
18375
18592
|
colors: buttonColors,
|
|
18376
18593
|
onClick: function onClick() {
|
|
18377
|
-
return
|
|
18594
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
18595
|
+
var _a;
|
|
18596
|
+
var _b, _c;
|
|
18597
|
+
return __generator(this, function (_d) {
|
|
18598
|
+
switch (_d.label) {
|
|
18599
|
+
case 0:
|
|
18600
|
+
_a = dispatchIdCaptureAction;
|
|
18601
|
+
_b = {
|
|
18602
|
+
type: 'documentCaptured'
|
|
18603
|
+
};
|
|
18604
|
+
_c = {};
|
|
18605
|
+
return [4 /*yield*/, readFile(file)];
|
|
18606
|
+
case 1:
|
|
18607
|
+
return [2 /*return*/, _a.apply(void 0, [(_b.payload = (_c.imageData = _d.sent(), _c.documentType = 'passport', _c.width = 0, _c.height = 0, _c), _b)])];
|
|
18608
|
+
}
|
|
18609
|
+
});
|
|
18610
|
+
});
|
|
18378
18611
|
}
|
|
18379
18612
|
}, verbiage.continueText)));
|
|
18380
18613
|
}
|
|
18381
18614
|
function IdDocumentUploadScreen(_a) {
|
|
18615
|
+
var _this = this;
|
|
18382
18616
|
var _b = _a.classNames,
|
|
18383
18617
|
classNames = _b === void 0 ? {} : _b,
|
|
18384
18618
|
_c = _a.verbiage,
|
|
18385
18619
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
18386
|
-
var
|
|
18387
|
-
|
|
18388
|
-
|
|
18620
|
+
var state = useIdCaptureStore();
|
|
18621
|
+
var _d = React.useState(null),
|
|
18622
|
+
idFrontFile = _d[0],
|
|
18623
|
+
setIdFrontFile = _d[1];
|
|
18389
18624
|
var _e = React.useState(null),
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
var _f = React.useState(null),
|
|
18393
|
-
idBackFile = _f[0],
|
|
18394
|
-
setIdBackFile = _f[1];
|
|
18395
|
-
var onCapturedManually = useOnCapturedManually();
|
|
18625
|
+
idBackFile = _e[0],
|
|
18626
|
+
setIdBackFile = _e[1];
|
|
18396
18627
|
var verbiage = useTranslations(rawVerbiage, {
|
|
18397
18628
|
uploadIdFrontText: 'Upload ID Front',
|
|
18398
18629
|
uploadIdBackText: 'Upload ID Back',
|
|
@@ -18432,51 +18663,54 @@
|
|
|
18432
18663
|
disabled: !idFrontFile || !state.allowSinglePageIdCapture && !idBackFile,
|
|
18433
18664
|
colors: buttonColors,
|
|
18434
18665
|
onClick: function onClick() {
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
|
|
18438
|
-
|
|
18666
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
18667
|
+
var _a, _b, _c, _d;
|
|
18668
|
+
var _e, _f, _g, _h;
|
|
18669
|
+
return __generator(this, function (_j) {
|
|
18670
|
+
switch (_j.label) {
|
|
18671
|
+
case 0:
|
|
18672
|
+
_b = (_a = state).dispatch;
|
|
18673
|
+
_e = {
|
|
18674
|
+
type: 'documentsCaptured'
|
|
18675
|
+
};
|
|
18676
|
+
if (!(!idBackFile && state.allowSinglePageIdCapture)) return [3 /*break*/, 2];
|
|
18677
|
+
_f = {};
|
|
18678
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
18679
|
+
case 1:
|
|
18680
|
+
_c = [(_f.imageData = _j.sent(), _f.documentType = 'singlePage', _f.width = 0, _f.height = 0, _f)];
|
|
18681
|
+
return [3 /*break*/, 5];
|
|
18682
|
+
case 2:
|
|
18683
|
+
_g = {};
|
|
18684
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
18685
|
+
case 3:
|
|
18686
|
+
_d = [(_g.imageData = _j.sent(), _g.documentType = 'idCardFront', _g.width = 0, _g.height = 0, _g)];
|
|
18687
|
+
_h = {};
|
|
18688
|
+
return [4 /*yield*/, readFile(idBackFile)];
|
|
18689
|
+
case 4:
|
|
18690
|
+
_c = _d.concat([(_h.imageData = _j.sent(), _h.documentType = 'idCardBack', _h.width = 0, _h.height = 0, _h)]);
|
|
18691
|
+
_j.label = 5;
|
|
18692
|
+
case 5:
|
|
18693
|
+
return [2 /*return*/, _b.apply(_a, [(_e.payload = _c, _e)])];
|
|
18694
|
+
}
|
|
18439
18695
|
});
|
|
18440
|
-
}
|
|
18441
|
-
void onCapturedManually(idFrontFile, idBackFile);
|
|
18696
|
+
});
|
|
18442
18697
|
}
|
|
18443
18698
|
}, verbiage.continueText)));
|
|
18444
18699
|
}
|
|
18445
18700
|
function CancelUploadTypeButton(_a) {
|
|
18446
18701
|
var children = _a.children,
|
|
18447
18702
|
className = _a.className;
|
|
18448
|
-
var dispatch = useIdCaptureState()[1];
|
|
18449
18703
|
return /*#__PURE__*/React.createElement(Button, {
|
|
18450
18704
|
className: className,
|
|
18451
18705
|
colors: buttonColors,
|
|
18452
18706
|
onClick: function onClick() {
|
|
18453
|
-
return
|
|
18707
|
+
return dispatchIdCaptureAction({
|
|
18454
18708
|
type: 'setUploadingDocumentsType',
|
|
18455
18709
|
payload: null
|
|
18456
18710
|
});
|
|
18457
18711
|
}
|
|
18458
18712
|
}, children);
|
|
18459
18713
|
}
|
|
18460
|
-
function useOnCapturedManually() {
|
|
18461
|
-
var dispatch = useIdCaptureState()[1];
|
|
18462
|
-
return React.useCallback(function () {
|
|
18463
|
-
var files = [];
|
|
18464
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
18465
|
-
files[_i] = arguments[_i];
|
|
18466
|
-
}
|
|
18467
|
-
return Promise.all(files.filter(Boolean).map(readFile)).then(function (f) {
|
|
18468
|
-
for (var _i = 0, f_1 = f; _i < f_1.length; _i++) {
|
|
18469
|
-
var imageData = f_1[_i];
|
|
18470
|
-
dispatch({
|
|
18471
|
-
type: 'documentCapturedManually',
|
|
18472
|
-
payload: {
|
|
18473
|
-
imageData: imageData
|
|
18474
|
-
}
|
|
18475
|
-
});
|
|
18476
|
-
}
|
|
18477
|
-
});
|
|
18478
|
-
}, [dispatch]);
|
|
18479
|
-
}
|
|
18480
18714
|
function readFile(file) {
|
|
18481
18715
|
return new Promise(function (resolve, reject) {
|
|
18482
18716
|
if (!file) return reject(new Error('File is undefined'));
|
|
@@ -18879,32 +19113,30 @@
|
|
|
18879
19113
|
verbiage = _3 === void 0 ? {} : _3,
|
|
18880
19114
|
_4 = _a.debugMode,
|
|
18881
19115
|
debugMode = _4 === void 0 ? false : _4;
|
|
18882
|
-
var
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
modelError = _9.modelError,
|
|
18905
|
-
resetBestFrame = _9.resetBestFrame;
|
|
19116
|
+
var state = useIdCaptureStore();
|
|
19117
|
+
var _5 = useCameraStore(),
|
|
19118
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
19119
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
19120
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
19121
|
+
var _6 = React.useState(false),
|
|
19122
|
+
overlayDismissed = _6[0],
|
|
19123
|
+
setOverlayDismissed = _6[1];
|
|
19124
|
+
var _7 = React.useContext(SubmissionContext),
|
|
19125
|
+
submissionStatus = _7.submissionStatus,
|
|
19126
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
19127
|
+
setIdBackImage = _7.setIdBackImage,
|
|
19128
|
+
setPassportImage = _7.setPassportImage,
|
|
19129
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
19130
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
19131
|
+
var _8 = React.useContext(IdCaptureModelsContext),
|
|
19132
|
+
start = _8.start,
|
|
19133
|
+
stop = _8.stop,
|
|
19134
|
+
onPredictionMade = _8.onPredictionMade,
|
|
19135
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
19136
|
+
modelError = _8.modelError,
|
|
19137
|
+
resetBestFrame = _8.resetBestFrame;
|
|
18906
19138
|
React.useEffect(function () {
|
|
18907
|
-
|
|
19139
|
+
dispatchIdCaptureAction({
|
|
18908
19140
|
type: 'configureWizard',
|
|
18909
19141
|
payload: {
|
|
18910
19142
|
captureRequirement: captureRequirement,
|
|
@@ -18916,7 +19148,7 @@
|
|
|
18916
19148
|
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
18917
19149
|
}
|
|
18918
19150
|
});
|
|
18919
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement,
|
|
19151
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
18920
19152
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
18921
19153
|
React.useEffect(function () {
|
|
18922
19154
|
if (documentCount) resetBestFrame();
|
|
@@ -18932,15 +19164,15 @@
|
|
|
18932
19164
|
}, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
|
|
18933
19165
|
React.useEffect(function startModelsWhenCapturing() {
|
|
18934
19166
|
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
18935
|
-
|
|
19167
|
+
dispatchIdCaptureAction({
|
|
18936
19168
|
type: 'captureStarted'
|
|
18937
19169
|
});
|
|
18938
19170
|
start();
|
|
18939
|
-
}, [
|
|
19171
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
18940
19172
|
React.useEffect(function () {
|
|
18941
19173
|
onPredictionMade(function (prediction) {
|
|
18942
19174
|
if (state.captureState === 'capturing') {
|
|
18943
|
-
|
|
19175
|
+
dispatchIdCaptureAction({
|
|
18944
19176
|
type: 'objectsDetected',
|
|
18945
19177
|
payload: {
|
|
18946
19178
|
prediction: prediction
|
|
@@ -18949,19 +19181,19 @@
|
|
|
18949
19181
|
} else if (state.captureState === 'requestingFlip') {
|
|
18950
19182
|
if (state.requestedDocumentType !== 'selfie' && prediction["".concat(state.requestedDocumentType, "DetectionThresholdMet")]) {
|
|
18951
19183
|
resetBestFrame();
|
|
18952
|
-
|
|
19184
|
+
dispatchIdCaptureAction({
|
|
18953
19185
|
type: 'flipRequestCompleted'
|
|
18954
19186
|
});
|
|
18955
19187
|
}
|
|
18956
19188
|
}
|
|
18957
19189
|
});
|
|
18958
|
-
}, [
|
|
19190
|
+
}, [onPredictionMade, resetBestFrame, state.captureState, state.requestedDocumentType]);
|
|
18959
19191
|
React.useEffect(function () {
|
|
18960
19192
|
if (state.captureState === 'complete') stop();
|
|
18961
19193
|
}, [state.captureState, stop]);
|
|
18962
19194
|
var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
|
|
18963
19195
|
logCaptureMetadata(metadata);
|
|
18964
|
-
|
|
19196
|
+
dispatchIdCaptureAction({
|
|
18965
19197
|
type: 'documentCaptured',
|
|
18966
19198
|
payload: {
|
|
18967
19199
|
imageData: imageData,
|
|
@@ -18973,7 +19205,7 @@
|
|
|
18973
19205
|
focusScore: metadata.bestFocusScore
|
|
18974
19206
|
}
|
|
18975
19207
|
});
|
|
18976
|
-
}, [
|
|
19208
|
+
}, [logCaptureMetadata]);
|
|
18977
19209
|
var onSubmitClick = React.useCallback(function () {
|
|
18978
19210
|
var _a = state.capturedDocuments,
|
|
18979
19211
|
idCardFront = _a.idCardFront,
|
|
@@ -18999,25 +19231,25 @@
|
|
|
18999
19231
|
}, [onSuccess, releaseCameraAccess, releaseCameraAccessOnExit, setIdBackImage, setIdFrontImage, setPassportImage, state.capturedDocuments]);
|
|
19000
19232
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, state.captureState === 'complete', onSubmitClick);
|
|
19001
19233
|
var onRetryClick = React.useCallback(function () {
|
|
19002
|
-
|
|
19234
|
+
return dispatchIdCaptureAction({
|
|
19003
19235
|
type: 'resetWizard'
|
|
19004
19236
|
});
|
|
19005
|
-
}, [
|
|
19006
|
-
var
|
|
19007
|
-
attempt =
|
|
19008
|
-
setAttempt =
|
|
19237
|
+
}, []);
|
|
19238
|
+
var _9 = React.useState(0),
|
|
19239
|
+
attempt = _9[0],
|
|
19240
|
+
setAttempt = _9[1];
|
|
19009
19241
|
var onExit = React.useCallback(function () {
|
|
19010
19242
|
releaseCameraAccess();
|
|
19011
19243
|
setOverlayDismissed(false);
|
|
19012
19244
|
setAttempt(function (n) {
|
|
19013
19245
|
return n + 1;
|
|
19014
19246
|
});
|
|
19015
|
-
|
|
19247
|
+
dispatchIdCaptureAction({
|
|
19016
19248
|
type: 'resetWizard'
|
|
19017
19249
|
});
|
|
19018
19250
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
19019
19251
|
void requestCameraAccess();
|
|
19020
|
-
}, [
|
|
19252
|
+
}, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
|
|
19021
19253
|
React.useEffect(function () {
|
|
19022
19254
|
if (submissionStatus !== SubmissionStatus.READY) {
|
|
19023
19255
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
@@ -19050,14 +19282,14 @@
|
|
|
19050
19282
|
if (state.captureState !== 'requestingFlip') return;
|
|
19051
19283
|
var t = setTimeout(function () {
|
|
19052
19284
|
resetBestFrame();
|
|
19053
|
-
|
|
19285
|
+
dispatchIdCaptureAction({
|
|
19054
19286
|
type: 'flipRequestCompleted'
|
|
19055
19287
|
});
|
|
19056
19288
|
}, 6000);
|
|
19057
19289
|
return function () {
|
|
19058
19290
|
clearTimeout(t);
|
|
19059
19291
|
};
|
|
19060
|
-
}, [
|
|
19292
|
+
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
19061
19293
|
React.useEffect(function () {
|
|
19062
19294
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
19063
19295
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -19085,7 +19317,7 @@
|
|
|
19085
19317
|
return [4 /*yield*/, dataUrlToBase64(imageData)];
|
|
19086
19318
|
case 1:
|
|
19087
19319
|
base64ImageData = _a.sent();
|
|
19088
|
-
|
|
19320
|
+
dispatchIdCaptureAction({
|
|
19089
19321
|
type: 'documentCapturedManually',
|
|
19090
19322
|
payload: {
|
|
19091
19323
|
imageData: base64ImageData
|
|
@@ -19095,10 +19327,10 @@
|
|
|
19095
19327
|
}
|
|
19096
19328
|
});
|
|
19097
19329
|
});
|
|
19098
|
-
}, [
|
|
19099
|
-
var
|
|
19100
|
-
progressStarted =
|
|
19101
|
-
setProgressStarted =
|
|
19330
|
+
}, []);
|
|
19331
|
+
var _10 = React.useState(false),
|
|
19332
|
+
progressStarted = _10[0],
|
|
19333
|
+
setProgressStarted = _10[1];
|
|
19102
19334
|
React.useEffect(function () {
|
|
19103
19335
|
if (state.captureState === 'capturing') {
|
|
19104
19336
|
setProgressStarted(false);
|
|
@@ -19178,7 +19410,7 @@
|
|
|
19178
19410
|
capturedDocuments: state.capturedDocuments,
|
|
19179
19411
|
classNames: classNames.success,
|
|
19180
19412
|
onSubmitClick: function onSubmitClick() {
|
|
19181
|
-
|
|
19413
|
+
return dispatchIdCaptureAction({
|
|
19182
19414
|
type: 'flipRequestCompleted'
|
|
19183
19415
|
});
|
|
19184
19416
|
},
|