idmission-web-sdk 2.2.100 → 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 +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 +233 -216
- 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 +234 -217
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +536 -293
- 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
|
@@ -11,10 +11,11 @@ var useResizeObserver = require('use-resize-observer');
|
|
|
11
11
|
var tasksVision = require('@mediapipe/tasks-vision');
|
|
12
12
|
var zustand = require('zustand');
|
|
13
13
|
var useDebounce = require('use-debounce');
|
|
14
|
+
var middleware = require('zustand/middleware');
|
|
15
|
+
var shallow = require('zustand/react/shallow');
|
|
14
16
|
var reactDom = require('react-dom');
|
|
15
17
|
var LanguageDetector = require('i18next-browser-languagedetector');
|
|
16
18
|
var i18n = require('i18next');
|
|
17
|
-
var shallow = require('zustand/react/shallow');
|
|
18
19
|
var SignatureCanvas = require('react-signature-canvas');
|
|
19
20
|
|
|
20
21
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -234,7 +235,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
234
235
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
235
236
|
};
|
|
236
237
|
|
|
237
|
-
var webSdkVersion = '2.2.
|
|
238
|
+
var webSdkVersion = '2.2.101';
|
|
238
239
|
|
|
239
240
|
function getPlatform() {
|
|
240
241
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -4450,31 +4451,35 @@ var initialState$4 = {
|
|
|
4450
4451
|
requestedDocumentType: 'idCardFront',
|
|
4451
4452
|
allowSinglePageIdCapture: false,
|
|
4452
4453
|
allowIdCardBackToFrontCapture: false,
|
|
4454
|
+
allowUploadingDocumentsFromStorage: false,
|
|
4453
4455
|
isUploadingDocumentsFromStorage: false,
|
|
4454
4456
|
uploadingDocumentsType: null,
|
|
4455
4457
|
operationStartedAt: null,
|
|
4456
|
-
captureStartedAt: null
|
|
4458
|
+
captureStartedAt: null,
|
|
4459
|
+
dispatch: function dispatch() {
|
|
4460
|
+
return null;
|
|
4461
|
+
}
|
|
4457
4462
|
};
|
|
4458
|
-
var IdCaptureStateContext = /*#__PURE__*/React.createContext(initialState$4);
|
|
4459
|
-
var IdCaptureDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
4460
4463
|
var _reducer = function reducer(state, action) {
|
|
4461
|
-
var _a
|
|
4464
|
+
var _a;
|
|
4462
4465
|
switch (action.type) {
|
|
4463
4466
|
case 'configureWizard':
|
|
4464
4467
|
{
|
|
4465
|
-
var
|
|
4466
|
-
captureRequirement =
|
|
4467
|
-
precapturedDocuments =
|
|
4468
|
-
allowSinglePageIdCapture =
|
|
4469
|
-
allowIdCardBackToFrontCapture =
|
|
4470
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
4471
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
4468
|
+
var _b = action.payload,
|
|
4469
|
+
captureRequirement = _b.captureRequirement,
|
|
4470
|
+
precapturedDocuments = _b.precapturedDocuments,
|
|
4471
|
+
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
4472
|
+
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
4473
|
+
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
4474
|
+
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
4475
|
+
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
4472
4476
|
var newState = _assign(_assign({}, state), {
|
|
4473
4477
|
captureRequirement: captureRequirement,
|
|
4474
4478
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
4475
4479
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
4476
4480
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
4477
|
-
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
4481
|
+
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
4482
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
4478
4483
|
});
|
|
4479
4484
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
4480
4485
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -4492,7 +4497,7 @@ var _reducer = function reducer(state, action) {
|
|
|
4492
4497
|
}
|
|
4493
4498
|
}
|
|
4494
4499
|
newState.operationStartedAt = new Date();
|
|
4495
|
-
if (!
|
|
4500
|
+
if (!allowUploadingDocumentsFromStorage) {
|
|
4496
4501
|
newState.captureState = 'capturing';
|
|
4497
4502
|
}
|
|
4498
4503
|
return newState;
|
|
@@ -4532,26 +4537,26 @@ var _reducer = function reducer(state, action) {
|
|
|
4532
4537
|
});
|
|
4533
4538
|
case 'objectsDetected':
|
|
4534
4539
|
{
|
|
4535
|
-
var
|
|
4536
|
-
detectedObjects =
|
|
4537
|
-
detectionThresholdMet =
|
|
4538
|
-
detectedDocumentType =
|
|
4539
|
-
idCardFrontDetectionScore =
|
|
4540
|
-
idCardFrontDetectionThresholdMet =
|
|
4541
|
-
idCardBackDetectionScore =
|
|
4542
|
-
idCardBackDetectionThresholdMet =
|
|
4543
|
-
passportDetectionScore =
|
|
4544
|
-
passportDetectionThresholdMet =
|
|
4545
|
-
singlePageDetectionScore =
|
|
4546
|
-
singlePageDetectionThresholdMet =
|
|
4547
|
-
bestDocument =
|
|
4548
|
-
documentInBounds =
|
|
4549
|
-
documentTooClose =
|
|
4550
|
-
documentIsStable =
|
|
4551
|
-
focusScore =
|
|
4552
|
-
focusThresholdMet =
|
|
4553
|
-
frameWidth =
|
|
4554
|
-
frameHeight =
|
|
4540
|
+
var _c = action.payload.prediction,
|
|
4541
|
+
detectedObjects = _c.detectedObjects,
|
|
4542
|
+
detectionThresholdMet = _c.detectionThresholdMet,
|
|
4543
|
+
detectedDocumentType = _c.detectedDocumentType,
|
|
4544
|
+
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
4545
|
+
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
4546
|
+
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
4547
|
+
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
4548
|
+
passportDetectionScore = _c.passportDetectionScore,
|
|
4549
|
+
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
4550
|
+
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
4551
|
+
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
4552
|
+
bestDocument = _c.bestDocument,
|
|
4553
|
+
documentInBounds = _c.documentInBounds,
|
|
4554
|
+
documentTooClose = _c.documentTooClose,
|
|
4555
|
+
documentIsStable = _c.documentIsStable,
|
|
4556
|
+
focusScore = _c.focusScore,
|
|
4557
|
+
focusThresholdMet = _c.focusThresholdMet,
|
|
4558
|
+
frameWidth = _c.frameWidth,
|
|
4559
|
+
frameHeight = _c.frameHeight;
|
|
4555
4560
|
var frameCapturedAt = new Date();
|
|
4556
4561
|
var frameCaptureRate = 0;
|
|
4557
4562
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -4684,7 +4689,9 @@ var _reducer = function reducer(state, action) {
|
|
|
4684
4689
|
} else {
|
|
4685
4690
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
4686
4691
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4687
|
-
newState.
|
|
4692
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
4693
|
+
newState.captureState = 'requestingFlip';
|
|
4694
|
+
}
|
|
4688
4695
|
newState.idCardFrontDetectionThresholdMet = false;
|
|
4689
4696
|
newState.idCardBackDetectionThresholdMet = false;
|
|
4690
4697
|
newState.passportDetectionThresholdMet = false;
|
|
@@ -4694,28 +4701,23 @@ var _reducer = function reducer(state, action) {
|
|
|
4694
4701
|
return newState;
|
|
4695
4702
|
}
|
|
4696
4703
|
case 'documentCapturedManually':
|
|
4704
|
+
return _reducer(state, {
|
|
4705
|
+
type: 'documentCaptured',
|
|
4706
|
+
payload: _assign(_assign({}, action.payload), {
|
|
4707
|
+
documentType: state.requestedDocumentType,
|
|
4708
|
+
width: 0,
|
|
4709
|
+
height: 0
|
|
4710
|
+
})
|
|
4711
|
+
});
|
|
4712
|
+
case 'documentsCaptured':
|
|
4697
4713
|
{
|
|
4698
|
-
var newState = _assign(
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
4706
|
-
if (remainingRequirements.length === 0) {
|
|
4707
|
-
newState.captureState = 'complete';
|
|
4708
|
-
} else {
|
|
4709
|
-
newState.requestedDocumentType = remainingRequirements[0];
|
|
4710
|
-
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4711
|
-
if (!newState.isUploadingDocumentsFromStorage) {
|
|
4712
|
-
newState.captureState = 'requestingFlip';
|
|
4713
|
-
}
|
|
4714
|
-
newState.idCardFrontDetectionThresholdMet = false;
|
|
4715
|
-
newState.idCardBackDetectionThresholdMet = false;
|
|
4716
|
-
newState.passportDetectionThresholdMet = false;
|
|
4717
|
-
newState.wrongDocumentTypePredictions = 0;
|
|
4718
|
-
}
|
|
4714
|
+
var newState = _assign({}, state);
|
|
4715
|
+
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
4716
|
+
var doc = _e[_d];
|
|
4717
|
+
newState = _reducer(newState, {
|
|
4718
|
+
type: 'documentCaptured',
|
|
4719
|
+
payload: doc
|
|
4720
|
+
});
|
|
4719
4721
|
}
|
|
4720
4722
|
return newState;
|
|
4721
4723
|
}
|
|
@@ -4752,6 +4754,9 @@ var _reducer = function reducer(state, action) {
|
|
|
4752
4754
|
}
|
|
4753
4755
|
case 'resetWizard':
|
|
4754
4756
|
return _assign(_assign({}, initialState$4), {
|
|
4757
|
+
dispatch: state.dispatch,
|
|
4758
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
4759
|
+
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
4755
4760
|
captureRequirement: state.captureRequirement,
|
|
4756
4761
|
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
4757
4762
|
});
|
|
@@ -4759,13 +4764,26 @@ var _reducer = function reducer(state, action) {
|
|
|
4759
4764
|
return state;
|
|
4760
4765
|
}
|
|
4761
4766
|
};
|
|
4762
|
-
var
|
|
4767
|
+
var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
|
|
4768
|
+
return _assign(_assign({}, initialState$4), {
|
|
4769
|
+
dispatch: function dispatch(action) {
|
|
4770
|
+
return set(function (state) {
|
|
4771
|
+
return _reducer(state, action);
|
|
4772
|
+
}, undefined, action);
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
}));
|
|
4776
|
+
function IdCaptureStateProvider(_a) {
|
|
4763
4777
|
var children = _a.children;
|
|
4764
|
-
var
|
|
4765
|
-
state
|
|
4766
|
-
|
|
4778
|
+
var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
|
|
4779
|
+
return state.overrideWrongDocumentTypeGuidance;
|
|
4780
|
+
}));
|
|
4781
|
+
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
4782
|
+
React.useEffect(function () {
|
|
4783
|
+
if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
|
|
4784
|
+
}, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
4767
4785
|
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
4768
|
-
|
|
4786
|
+
dispatchIdCaptureAction({
|
|
4769
4787
|
type: 'redrawRequested'
|
|
4770
4788
|
});
|
|
4771
4789
|
}, 500);
|
|
@@ -4773,26 +4791,13 @@ var IdCaptureStateProvider = function IdCaptureStateProvider(_a) {
|
|
|
4773
4791
|
if (typeof window === 'undefined') return;
|
|
4774
4792
|
window.addEventListener('resize', onResize);
|
|
4775
4793
|
return function () {
|
|
4776
|
-
window.removeEventListener('resize', onResize);
|
|
4794
|
+
return window.removeEventListener('resize', onResize);
|
|
4777
4795
|
};
|
|
4778
4796
|
}, [onResize]);
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
}
|
|
4784
|
-
}, [state.overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
4785
|
-
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateContext.Provider, {
|
|
4786
|
-
value: state
|
|
4787
|
-
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureDispatchContext.Provider, {
|
|
4788
|
-
value: dispatch
|
|
4789
|
-
}, children));
|
|
4790
|
-
};
|
|
4791
|
-
var useIdCaptureState = function useIdCaptureState() {
|
|
4792
|
-
var state = React.useContext(IdCaptureStateContext);
|
|
4793
|
-
var dispatch = React.useContext(IdCaptureDispatchContext);
|
|
4794
|
-
if (!state || !dispatch) throw new Error('useIdCaptureState cannot be used without IdCaptureStateProvider');
|
|
4795
|
-
return [state, dispatch];
|
|
4797
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
4798
|
+
}
|
|
4799
|
+
var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
|
|
4800
|
+
return useIdCaptureStore.getState().dispatch(action);
|
|
4796
4801
|
};
|
|
4797
4802
|
|
|
4798
4803
|
function DebugStatsPane(_a) {
|
|
@@ -4867,7 +4872,7 @@ var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
|
|
|
4867
4872
|
var scaling = _a.scaling,
|
|
4868
4873
|
$flipX = _a.$flipX,
|
|
4869
4874
|
children = _a.children;
|
|
4870
|
-
var _b =
|
|
4875
|
+
var _b = useIdCaptureStore(),
|
|
4871
4876
|
guideRectWidth = _b.guideRectWidth,
|
|
4872
4877
|
guideRectHeight = _b.guideRectHeight,
|
|
4873
4878
|
guideRectX = _b.guideRectX,
|
|
@@ -6032,14 +6037,14 @@ function OverrideWrongDocumentTypeGuidanceDialog(_a) {
|
|
|
6032
6037
|
classNames = _b === void 0 ? {} : _b,
|
|
6033
6038
|
_c = _a.verbiage,
|
|
6034
6039
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
6035
|
-
var _d =
|
|
6036
|
-
|
|
6037
|
-
dispatch = _d
|
|
6040
|
+
var _d = useIdCaptureStore(),
|
|
6041
|
+
allowOverrideWrongDocumentTypeGuidance = _d.allowOverrideWrongDocumentTypeGuidance,
|
|
6042
|
+
dispatch = _d.dispatch;
|
|
6038
6043
|
var verbiage = useTranslations(rawVerbiage, {
|
|
6039
6044
|
messageText: 'We are having trouble identifying the correct side of your id, do you want to continue with capture anyway?',
|
|
6040
6045
|
buttonText: 'OK'
|
|
6041
6046
|
});
|
|
6042
|
-
if (!
|
|
6047
|
+
if (!allowOverrideWrongDocumentTypeGuidance) return null;
|
|
6043
6048
|
return /*#__PURE__*/React__namespace.default.createElement(Container$2, {
|
|
6044
6049
|
className: classNames.container
|
|
6045
6050
|
}, /*#__PURE__*/React__namespace.default.createElement(InnerContainer, {
|
|
@@ -6093,52 +6098,50 @@ var IdCapture = function IdCapture(_a) {
|
|
|
6093
6098
|
width = _q === void 0 ? 1 : _q,
|
|
6094
6099
|
_r = _p.height,
|
|
6095
6100
|
height = _r === void 0 ? 1 : _r;
|
|
6096
|
-
var
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
focusPredictionTime = _u.focusPredictionTime,
|
|
6107
|
-
getBestFrame = _u.getBestFrame;
|
|
6101
|
+
var state = useIdCaptureStore();
|
|
6102
|
+
var _s = useCameraStore(),
|
|
6103
|
+
camera = _s.camera,
|
|
6104
|
+
isRearFacing = _s.isRearFacing;
|
|
6105
|
+
var _t = React.useContext(IdCaptureModelsContext),
|
|
6106
|
+
modelsReady = _t.ready,
|
|
6107
|
+
setThresholds = _t.setThresholds,
|
|
6108
|
+
detectionTime = _t.detectionTime,
|
|
6109
|
+
focusPredictionTime = _t.focusPredictionTime,
|
|
6110
|
+
getBestFrame = _t.getBestFrame;
|
|
6108
6111
|
React.useEffect(function () {
|
|
6109
|
-
return
|
|
6112
|
+
return dispatchIdCaptureAction({
|
|
6110
6113
|
type: 'captureInitialized'
|
|
6111
6114
|
});
|
|
6112
|
-
}, [
|
|
6115
|
+
}, []);
|
|
6113
6116
|
React.useEffect(function () {
|
|
6114
6117
|
setThresholds(thresholds);
|
|
6115
6118
|
}, [thresholds, setThresholds]);
|
|
6116
6119
|
React.useEffect(function () {
|
|
6117
6120
|
if (!requiredDocumentType) return;
|
|
6118
|
-
|
|
6121
|
+
dispatchIdCaptureAction({
|
|
6119
6122
|
type: 'setRequiredDocumentType',
|
|
6120
6123
|
payload: requiredDocumentType
|
|
6121
6124
|
});
|
|
6122
|
-
}, [
|
|
6125
|
+
}, [requiredDocumentType]);
|
|
6123
6126
|
React.useEffect(function () {
|
|
6124
|
-
|
|
6127
|
+
dispatchIdCaptureAction({
|
|
6125
6128
|
type: 'pageRendered',
|
|
6126
6129
|
payload: {
|
|
6127
6130
|
pageWidth: width,
|
|
6128
6131
|
pageHeight: height
|
|
6129
6132
|
}
|
|
6130
6133
|
});
|
|
6131
|
-
}, [
|
|
6134
|
+
}, [height, width]);
|
|
6132
6135
|
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
6133
6136
|
React.useEffect(function () {
|
|
6134
6137
|
if (!shouldCapture) return;
|
|
6135
|
-
|
|
6138
|
+
dispatchIdCaptureAction({
|
|
6136
6139
|
type: 'capturing'
|
|
6137
6140
|
});
|
|
6138
6141
|
var bestFrame = getBestFrame();
|
|
6139
6142
|
if (!bestFrame) {
|
|
6140
6143
|
log('uh oh, i did not get a photo');
|
|
6141
|
-
|
|
6144
|
+
dispatchIdCaptureAction({
|
|
6142
6145
|
type: 'captureFailed'
|
|
6143
6146
|
});
|
|
6144
6147
|
return;
|
|
@@ -6151,7 +6154,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
6151
6154
|
var width = canvas.width,
|
|
6152
6155
|
height = canvas.height;
|
|
6153
6156
|
var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
|
|
6154
|
-
|
|
6157
|
+
dispatchIdCaptureAction({
|
|
6155
6158
|
type: 'frameCaptured',
|
|
6156
6159
|
payload: {
|
|
6157
6160
|
imageUrl: imageUrl
|
|
@@ -6169,11 +6172,11 @@ var IdCapture = function IdCapture(_a) {
|
|
|
6169
6172
|
bestFocusScore: focusScore
|
|
6170
6173
|
};
|
|
6171
6174
|
onCapture === null || onCapture === void 0 ? void 0 : onCapture(imageUrl, width, height, capturedDocumentType, metadata);
|
|
6172
|
-
|
|
6175
|
+
dispatchIdCaptureAction({
|
|
6173
6176
|
type: 'captured'
|
|
6174
6177
|
});
|
|
6175
6178
|
}, 0);
|
|
6176
|
-
}, [
|
|
6179
|
+
}, [getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
|
|
6177
6180
|
var theme = styled.useTheme();
|
|
6178
6181
|
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');
|
|
6179
6182
|
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');
|
|
@@ -6899,12 +6902,6 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
|
|
|
6899
6902
|
var _q = React.useState(false),
|
|
6900
6903
|
dismissed = _q[0],
|
|
6901
6904
|
setDismissed = _q[1];
|
|
6902
|
-
var dispatch = useIdCaptureState()[1];
|
|
6903
|
-
React.useEffect(function () {
|
|
6904
|
-
return dispatch({
|
|
6905
|
-
type: 'captureInitialized'
|
|
6906
|
-
});
|
|
6907
|
-
}, [dispatch]);
|
|
6908
6905
|
assets.instructionImageUrl || (assets.instructionImageUrl = legacyInstructionImageUrl$1);
|
|
6909
6906
|
var verbiage = useTranslations(rawVerbiage, {
|
|
6910
6907
|
headingText: 'Use your device camera to capture your ID',
|
|
@@ -7889,9 +7886,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
|
|
|
7889
7886
|
wrapperAspectRatio = _1.wrapperAspectRatio,
|
|
7890
7887
|
guideOrientationOnImageLoaded = _1.onImageLoaded,
|
|
7891
7888
|
setDimensions = _1.setDimensions;
|
|
7892
|
-
var
|
|
7893
|
-
state = _2[0],
|
|
7894
|
-
dispatch = _2[1];
|
|
7889
|
+
var state = useIdCaptureStore();
|
|
7895
7890
|
var theme = styled.useTheme();
|
|
7896
7891
|
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;
|
|
7897
7892
|
React.useEffect(function () {
|
|
@@ -7917,14 +7912,14 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
|
|
|
7917
7912
|
var imageByUrl = imagesByUrl[img.src];
|
|
7918
7913
|
var width = (_a = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.width) !== null && _a !== void 0 ? _a : img.naturalWidth;
|
|
7919
7914
|
var height = (_b = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.height) !== null && _b !== void 0 ? _b : img.naturalHeight;
|
|
7920
|
-
|
|
7915
|
+
dispatchIdCaptureAction({
|
|
7921
7916
|
type: 'guideImageLoaded',
|
|
7922
7917
|
payload: {
|
|
7923
7918
|
width: width,
|
|
7924
7919
|
height: height
|
|
7925
7920
|
}
|
|
7926
7921
|
});
|
|
7927
|
-
}, [
|
|
7922
|
+
}, [guideOrientationOnImageLoaded, imagesByUrl]);
|
|
7928
7923
|
return /*#__PURE__*/React__namespace.default.createElement(StyledPageContainer, {
|
|
7929
7924
|
ref: wrapperRef,
|
|
7930
7925
|
onClick: onClick,
|
|
@@ -8054,19 +8049,17 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8054
8049
|
images = _w === void 0 ? defaultIdCaptureGuideImages : _w,
|
|
8055
8050
|
_x = _a.classNames,
|
|
8056
8051
|
classNames = _x === void 0 ? {} : _x;
|
|
8057
|
-
var _y =
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
guideImageHeight = _z.guideImageHeight,
|
|
8062
|
-
dispatch = _y[1];
|
|
8052
|
+
var _y = useIdCaptureStore(),
|
|
8053
|
+
redrawing = _y.redrawing,
|
|
8054
|
+
guideImageWidth = _y.guideImageWidth,
|
|
8055
|
+
guideImageHeight = _y.guideImageHeight;
|
|
8063
8056
|
var canvasRef = React.useRef(null);
|
|
8064
|
-
var
|
|
8065
|
-
wrapperRef =
|
|
8066
|
-
|
|
8067
|
-
wrapperWidth =
|
|
8068
|
-
|
|
8069
|
-
wrapperHeight =
|
|
8057
|
+
var _z = useResizeObserver__default.default(),
|
|
8058
|
+
wrapperRef = _z.ref,
|
|
8059
|
+
_0 = _z.width,
|
|
8060
|
+
wrapperWidth = _0 === void 0 ? 1 : _0,
|
|
8061
|
+
_1 = _z.height,
|
|
8062
|
+
wrapperHeight = _1 === void 0 ? 1 : _1;
|
|
8070
8063
|
var theme = styled.useTheme();
|
|
8071
8064
|
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;
|
|
8072
8065
|
if (padding === undefined) {
|
|
@@ -8084,7 +8077,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8084
8077
|
if (redrawing) {
|
|
8085
8078
|
resetCanvasDimensions(canvas);
|
|
8086
8079
|
var timer_1 = setTimeout(function () {
|
|
8087
|
-
|
|
8080
|
+
dispatchIdCaptureAction({
|
|
8088
8081
|
type: 'redrawInProgress'
|
|
8089
8082
|
});
|
|
8090
8083
|
}, 10);
|
|
@@ -8134,7 +8127,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8134
8127
|
// reset composite mode to default
|
|
8135
8128
|
ctx.globalCompositeOperation = 'source-over';
|
|
8136
8129
|
var rectOffsetTop = canvas.offsetTop;
|
|
8137
|
-
|
|
8130
|
+
dispatchIdCaptureAction({
|
|
8138
8131
|
type: 'redrawCompleted',
|
|
8139
8132
|
payload: {
|
|
8140
8133
|
guideRectX: rectX,
|
|
@@ -8145,7 +8138,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8145
8138
|
}
|
|
8146
8139
|
});
|
|
8147
8140
|
return function () {};
|
|
8148
|
-
}, [aspectRatio, borderColor, borderRadius, borderWidth,
|
|
8141
|
+
}, [aspectRatio, borderColor, borderRadius, borderWidth, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
|
|
8149
8142
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(CanvasWrapper$1, {
|
|
8150
8143
|
ref: wrapperRef,
|
|
8151
8144
|
"$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
|
|
@@ -8195,7 +8188,7 @@ function IdCaptureGuides(_a) {
|
|
|
8195
8188
|
colors = _k === void 0 ? {} : _k,
|
|
8196
8189
|
_l = _a.verbiage,
|
|
8197
8190
|
rawVerbiage = _l === void 0 ? {} : _l;
|
|
8198
|
-
var state =
|
|
8191
|
+
var state = useIdCaptureStore();
|
|
8199
8192
|
var isRearFacing = useCameraStore(function (state) {
|
|
8200
8193
|
return state.isRearFacing;
|
|
8201
8194
|
});
|
|
@@ -9158,7 +9151,7 @@ var StyledButtonsRow$8 = styled__default.default(ButtonsRow)(templateObject_6$5
|
|
|
9158
9151
|
var templateObject_1$m, templateObject_2$k, templateObject_3$g, templateObject_4$a, templateObject_5$6, templateObject_6$5;
|
|
9159
9152
|
|
|
9160
9153
|
function ScalingCameraFeed() {
|
|
9161
|
-
var _a =
|
|
9154
|
+
var _a = useIdCaptureStore(),
|
|
9162
9155
|
captureState = _a.captureState,
|
|
9163
9156
|
guideRectX = _a.guideRectX,
|
|
9164
9157
|
guideRectY = _a.guideRectY,
|
|
@@ -9184,14 +9177,12 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9184
9177
|
classNames = _b === void 0 ? {} : _b,
|
|
9185
9178
|
_c = _a.verbiage,
|
|
9186
9179
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
9187
|
-
var
|
|
9188
|
-
state = _d[0],
|
|
9189
|
-
dispatch = _d[1];
|
|
9180
|
+
var state = useIdCaptureStore();
|
|
9190
9181
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
9191
9182
|
var loadModels = React.useContext(IdCaptureModelsContext).load;
|
|
9192
|
-
var
|
|
9193
|
-
selectIdTypeModalOpen =
|
|
9194
|
-
setSelectIdTypeModalOpen =
|
|
9183
|
+
var _d = React.useState(false),
|
|
9184
|
+
selectIdTypeModalOpen = _d[0],
|
|
9185
|
+
setSelectIdTypeModalOpen = _d[1];
|
|
9195
9186
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9196
9187
|
captureWithCameraText: 'Capture with Camera',
|
|
9197
9188
|
orText: 'OR',
|
|
@@ -9223,7 +9214,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9223
9214
|
onClick: function onClick() {
|
|
9224
9215
|
loadModels();
|
|
9225
9216
|
void requestCameraAccess();
|
|
9226
|
-
dispatch({
|
|
9217
|
+
state.dispatch({
|
|
9227
9218
|
type: 'setUploadingDocumentsFromStorage',
|
|
9228
9219
|
payload: false
|
|
9229
9220
|
});
|
|
@@ -9240,19 +9231,19 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9240
9231
|
className: classNames.uploadFromStorageButton,
|
|
9241
9232
|
colors: buttonColors,
|
|
9242
9233
|
onClick: function onClick() {
|
|
9243
|
-
dispatch({
|
|
9234
|
+
state.dispatch({
|
|
9244
9235
|
type: 'setUploadingDocumentsFromStorage',
|
|
9245
9236
|
payload: true
|
|
9246
9237
|
});
|
|
9247
9238
|
if (state.captureRequirement === 'idCardOrPassport') {
|
|
9248
9239
|
setSelectIdTypeModalOpen(true);
|
|
9249
9240
|
} else if (state.captureRequirement === 'passport') {
|
|
9250
|
-
dispatch({
|
|
9241
|
+
state.dispatch({
|
|
9251
9242
|
type: 'setUploadingDocumentsType',
|
|
9252
9243
|
payload: 'passport'
|
|
9253
9244
|
});
|
|
9254
9245
|
} else {
|
|
9255
|
-
dispatch({
|
|
9246
|
+
state.dispatch({
|
|
9256
9247
|
type: 'setUploadingDocumentsType',
|
|
9257
9248
|
payload: 'idCard'
|
|
9258
9249
|
});
|
|
@@ -9272,7 +9263,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9272
9263
|
className: classNames.selectPassportTypeButton,
|
|
9273
9264
|
colors: buttonColors,
|
|
9274
9265
|
onClick: function onClick() {
|
|
9275
|
-
return dispatch({
|
|
9266
|
+
return state.dispatch({
|
|
9276
9267
|
type: 'setUploadingDocumentsType',
|
|
9277
9268
|
payload: 'passport'
|
|
9278
9269
|
});
|
|
@@ -9285,7 +9276,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9285
9276
|
className: classNames.selectIdCardTypeButton,
|
|
9286
9277
|
colors: buttonColors,
|
|
9287
9278
|
onClick: function onClick() {
|
|
9288
|
-
return dispatch({
|
|
9279
|
+
return state.dispatch({
|
|
9289
9280
|
type: 'setUploadingDocumentsType',
|
|
9290
9281
|
payload: 'idCard'
|
|
9291
9282
|
});
|
|
@@ -9336,20 +9327,18 @@ function PassportUploadScreen(_a) {
|
|
|
9336
9327
|
}, verbiage.continueText)));
|
|
9337
9328
|
}
|
|
9338
9329
|
function IdDocumentUploadScreen(_a) {
|
|
9330
|
+
var _this = this;
|
|
9339
9331
|
var _b = _a.classNames,
|
|
9340
9332
|
classNames = _b === void 0 ? {} : _b,
|
|
9341
9333
|
_c = _a.verbiage,
|
|
9342
9334
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
9343
|
-
var
|
|
9344
|
-
|
|
9345
|
-
|
|
9335
|
+
var state = useIdCaptureStore();
|
|
9336
|
+
var _d = React.useState(null),
|
|
9337
|
+
idFrontFile = _d[0],
|
|
9338
|
+
setIdFrontFile = _d[1];
|
|
9346
9339
|
var _e = React.useState(null),
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
var _f = React.useState(null),
|
|
9350
|
-
idBackFile = _f[0],
|
|
9351
|
-
setIdBackFile = _f[1];
|
|
9352
|
-
var onCapturedManually = useOnCapturedManually();
|
|
9340
|
+
idBackFile = _e[0],
|
|
9341
|
+
setIdBackFile = _e[1];
|
|
9353
9342
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9354
9343
|
uploadIdFrontText: 'Upload ID Front',
|
|
9355
9344
|
uploadIdBackText: 'Upload ID Back',
|
|
@@ -9389,25 +9378,56 @@ function IdDocumentUploadScreen(_a) {
|
|
|
9389
9378
|
disabled: !idFrontFile || !state.allowSinglePageIdCapture && !idBackFile,
|
|
9390
9379
|
colors: buttonColors,
|
|
9391
9380
|
onClick: function onClick() {
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9381
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
9382
|
+
var _a, _b, _c, _d, _e;
|
|
9383
|
+
var _f, _g, _h, _j, _k;
|
|
9384
|
+
return __generator(this, function (_l) {
|
|
9385
|
+
switch (_l.label) {
|
|
9386
|
+
case 0:
|
|
9387
|
+
if (!(!idBackFile && state.allowSinglePageIdCapture)) return [3 /*break*/, 2];
|
|
9388
|
+
state.dispatch({
|
|
9389
|
+
type: 'setUploadingDocumentsType',
|
|
9390
|
+
payload: 'singlePage'
|
|
9391
|
+
});
|
|
9392
|
+
_b = (_a = state).dispatch;
|
|
9393
|
+
_f = {
|
|
9394
|
+
type: 'documentCaptured'
|
|
9395
|
+
};
|
|
9396
|
+
_g = {};
|
|
9397
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
9398
|
+
case 1:
|
|
9399
|
+
_b.apply(_a, [(_f.payload = (_g.imageData = _l.sent(), _g.documentType = 'singlePage', _g.width = 0, _g.height = 0, _g), _f)]);
|
|
9400
|
+
return [3 /*break*/, 5];
|
|
9401
|
+
case 2:
|
|
9402
|
+
_d = (_c = state).dispatch;
|
|
9403
|
+
_h = {
|
|
9404
|
+
type: 'documentsCaptured'
|
|
9405
|
+
};
|
|
9406
|
+
_j = {};
|
|
9407
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
9408
|
+
case 3:
|
|
9409
|
+
_e = [(_j.imageData = _l.sent(), _j.documentType = 'idCardFront', _j.width = 0, _j.height = 0, _j)];
|
|
9410
|
+
_k = {};
|
|
9411
|
+
return [4 /*yield*/, readFile(idBackFile)];
|
|
9412
|
+
case 4:
|
|
9413
|
+
_d.apply(_c, [(_h.payload = _e.concat([(_k.imageData = _l.sent(), _k.documentType = 'idCardBack', _k.width = 0, _k.height = 0, _k)]), _h)]);
|
|
9414
|
+
_l.label = 5;
|
|
9415
|
+
case 5:
|
|
9416
|
+
return [2 /*return*/];
|
|
9417
|
+
}
|
|
9396
9418
|
});
|
|
9397
|
-
}
|
|
9398
|
-
void onCapturedManually(idFrontFile, idBackFile);
|
|
9419
|
+
});
|
|
9399
9420
|
}
|
|
9400
9421
|
}, verbiage.continueText)));
|
|
9401
9422
|
}
|
|
9402
9423
|
function CancelUploadTypeButton(_a) {
|
|
9403
9424
|
var children = _a.children,
|
|
9404
9425
|
className = _a.className;
|
|
9405
|
-
var dispatch = useIdCaptureState()[1];
|
|
9406
9426
|
return /*#__PURE__*/React__namespace.default.createElement(Button, {
|
|
9407
9427
|
className: className,
|
|
9408
9428
|
colors: buttonColors,
|
|
9409
9429
|
onClick: function onClick() {
|
|
9410
|
-
return
|
|
9430
|
+
return dispatchIdCaptureAction({
|
|
9411
9431
|
type: 'setUploadingDocumentsType',
|
|
9412
9432
|
payload: null
|
|
9413
9433
|
});
|
|
@@ -9415,7 +9435,6 @@ function CancelUploadTypeButton(_a) {
|
|
|
9415
9435
|
}, children);
|
|
9416
9436
|
}
|
|
9417
9437
|
function useOnCapturedManually() {
|
|
9418
|
-
var dispatch = useIdCaptureState()[1];
|
|
9419
9438
|
return React.useCallback(function () {
|
|
9420
9439
|
var files = [];
|
|
9421
9440
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -9424,7 +9443,7 @@ function useOnCapturedManually() {
|
|
|
9424
9443
|
return Promise.all(files.filter(Boolean).map(readFile)).then(function (f) {
|
|
9425
9444
|
for (var _i = 0, f_1 = f; _i < f_1.length; _i++) {
|
|
9426
9445
|
var imageData = f_1[_i];
|
|
9427
|
-
|
|
9446
|
+
dispatchIdCaptureAction({
|
|
9428
9447
|
type: 'documentCapturedManually',
|
|
9429
9448
|
payload: {
|
|
9430
9449
|
imageData: imageData
|
|
@@ -9432,7 +9451,7 @@ function useOnCapturedManually() {
|
|
|
9432
9451
|
});
|
|
9433
9452
|
}
|
|
9434
9453
|
});
|
|
9435
|
-
}, [
|
|
9454
|
+
}, []);
|
|
9436
9455
|
}
|
|
9437
9456
|
function readFile(file) {
|
|
9438
9457
|
return new Promise(function (resolve, reject) {
|
|
@@ -9836,32 +9855,30 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9836
9855
|
verbiage = _3 === void 0 ? {} : _3,
|
|
9837
9856
|
_4 = _a.debugMode,
|
|
9838
9857
|
debugMode = _4 === void 0 ? false : _4;
|
|
9839
|
-
var
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
modelError = _9.modelError,
|
|
9862
|
-
resetBestFrame = _9.resetBestFrame;
|
|
9858
|
+
var state = useIdCaptureStore();
|
|
9859
|
+
var _5 = useCameraStore(),
|
|
9860
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
9861
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
9862
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
9863
|
+
var _6 = React.useState(false),
|
|
9864
|
+
overlayDismissed = _6[0],
|
|
9865
|
+
setOverlayDismissed = _6[1];
|
|
9866
|
+
var _7 = React.useContext(SubmissionContext),
|
|
9867
|
+
submissionStatus = _7.submissionStatus,
|
|
9868
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
9869
|
+
setIdBackImage = _7.setIdBackImage,
|
|
9870
|
+
setPassportImage = _7.setPassportImage,
|
|
9871
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
9872
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
9873
|
+
var _8 = React.useContext(IdCaptureModelsContext),
|
|
9874
|
+
start = _8.start,
|
|
9875
|
+
stop = _8.stop,
|
|
9876
|
+
onPredictionMade = _8.onPredictionMade,
|
|
9877
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
9878
|
+
modelError = _8.modelError,
|
|
9879
|
+
resetBestFrame = _8.resetBestFrame;
|
|
9863
9880
|
React.useEffect(function () {
|
|
9864
|
-
|
|
9881
|
+
dispatchIdCaptureAction({
|
|
9865
9882
|
type: 'configureWizard',
|
|
9866
9883
|
payload: {
|
|
9867
9884
|
captureRequirement: captureRequirement,
|
|
@@ -9873,7 +9890,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9873
9890
|
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
9874
9891
|
}
|
|
9875
9892
|
});
|
|
9876
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement,
|
|
9893
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
9877
9894
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
9878
9895
|
React.useEffect(function () {
|
|
9879
9896
|
if (documentCount) resetBestFrame();
|
|
@@ -9889,15 +9906,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9889
9906
|
}, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
|
|
9890
9907
|
React.useEffect(function startModelsWhenCapturing() {
|
|
9891
9908
|
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
9892
|
-
|
|
9909
|
+
dispatchIdCaptureAction({
|
|
9893
9910
|
type: 'captureStarted'
|
|
9894
9911
|
});
|
|
9895
9912
|
start();
|
|
9896
|
-
}, [
|
|
9913
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
9897
9914
|
React.useEffect(function () {
|
|
9898
9915
|
onPredictionMade(function (prediction) {
|
|
9899
9916
|
if (state.captureState === 'capturing') {
|
|
9900
|
-
|
|
9917
|
+
dispatchIdCaptureAction({
|
|
9901
9918
|
type: 'objectsDetected',
|
|
9902
9919
|
payload: {
|
|
9903
9920
|
prediction: prediction
|
|
@@ -9906,19 +9923,19 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9906
9923
|
} else if (state.captureState === 'requestingFlip') {
|
|
9907
9924
|
if (state.requestedDocumentType !== 'selfie' && prediction["".concat(state.requestedDocumentType, "DetectionThresholdMet")]) {
|
|
9908
9925
|
resetBestFrame();
|
|
9909
|
-
|
|
9926
|
+
dispatchIdCaptureAction({
|
|
9910
9927
|
type: 'flipRequestCompleted'
|
|
9911
9928
|
});
|
|
9912
9929
|
}
|
|
9913
9930
|
}
|
|
9914
9931
|
});
|
|
9915
|
-
}, [
|
|
9932
|
+
}, [onPredictionMade, resetBestFrame, state.captureState, state.requestedDocumentType]);
|
|
9916
9933
|
React.useEffect(function () {
|
|
9917
9934
|
if (state.captureState === 'complete') stop();
|
|
9918
9935
|
}, [state.captureState, stop]);
|
|
9919
9936
|
var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
|
|
9920
9937
|
logCaptureMetadata(metadata);
|
|
9921
|
-
|
|
9938
|
+
dispatchIdCaptureAction({
|
|
9922
9939
|
type: 'documentCaptured',
|
|
9923
9940
|
payload: {
|
|
9924
9941
|
imageData: imageData,
|
|
@@ -9930,7 +9947,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9930
9947
|
focusScore: metadata.bestFocusScore
|
|
9931
9948
|
}
|
|
9932
9949
|
});
|
|
9933
|
-
}, [
|
|
9950
|
+
}, [logCaptureMetadata]);
|
|
9934
9951
|
var onSubmitClick = React.useCallback(function () {
|
|
9935
9952
|
var _a = state.capturedDocuments,
|
|
9936
9953
|
idCardFront = _a.idCardFront,
|
|
@@ -9956,25 +9973,25 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9956
9973
|
}, [onSuccess, releaseCameraAccess, releaseCameraAccessOnExit, setIdBackImage, setIdFrontImage, setPassportImage, state.capturedDocuments]);
|
|
9957
9974
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, state.captureState === 'complete', onSubmitClick);
|
|
9958
9975
|
var onRetryClick = React.useCallback(function () {
|
|
9959
|
-
|
|
9976
|
+
return dispatchIdCaptureAction({
|
|
9960
9977
|
type: 'resetWizard'
|
|
9961
9978
|
});
|
|
9962
|
-
}, [
|
|
9963
|
-
var
|
|
9964
|
-
attempt =
|
|
9965
|
-
setAttempt =
|
|
9979
|
+
}, []);
|
|
9980
|
+
var _9 = React.useState(0),
|
|
9981
|
+
attempt = _9[0],
|
|
9982
|
+
setAttempt = _9[1];
|
|
9966
9983
|
var onExit = React.useCallback(function () {
|
|
9967
9984
|
releaseCameraAccess();
|
|
9968
9985
|
setOverlayDismissed(false);
|
|
9969
9986
|
setAttempt(function (n) {
|
|
9970
9987
|
return n + 1;
|
|
9971
9988
|
});
|
|
9972
|
-
|
|
9989
|
+
dispatchIdCaptureAction({
|
|
9973
9990
|
type: 'resetWizard'
|
|
9974
9991
|
});
|
|
9975
9992
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
9976
9993
|
void requestCameraAccess();
|
|
9977
|
-
}, [
|
|
9994
|
+
}, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
|
|
9978
9995
|
React.useEffect(function () {
|
|
9979
9996
|
if (submissionStatus !== SubmissionStatus.READY) {
|
|
9980
9997
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
@@ -10007,14 +10024,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10007
10024
|
if (state.captureState !== 'requestingFlip') return;
|
|
10008
10025
|
var t = setTimeout(function () {
|
|
10009
10026
|
resetBestFrame();
|
|
10010
|
-
|
|
10027
|
+
dispatchIdCaptureAction({
|
|
10011
10028
|
type: 'flipRequestCompleted'
|
|
10012
10029
|
});
|
|
10013
10030
|
}, 6000);
|
|
10014
10031
|
return function () {
|
|
10015
10032
|
clearTimeout(t);
|
|
10016
10033
|
};
|
|
10017
|
-
}, [
|
|
10034
|
+
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
10018
10035
|
React.useEffect(function () {
|
|
10019
10036
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
10020
10037
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -10042,7 +10059,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10042
10059
|
return [4 /*yield*/, dataUrlToBase64(imageData)];
|
|
10043
10060
|
case 1:
|
|
10044
10061
|
base64ImageData = _a.sent();
|
|
10045
|
-
|
|
10062
|
+
dispatchIdCaptureAction({
|
|
10046
10063
|
type: 'documentCapturedManually',
|
|
10047
10064
|
payload: {
|
|
10048
10065
|
imageData: base64ImageData
|
|
@@ -10052,10 +10069,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10052
10069
|
}
|
|
10053
10070
|
});
|
|
10054
10071
|
});
|
|
10055
|
-
}, [
|
|
10056
|
-
var
|
|
10057
|
-
progressStarted =
|
|
10058
|
-
setProgressStarted =
|
|
10072
|
+
}, []);
|
|
10073
|
+
var _10 = React.useState(false),
|
|
10074
|
+
progressStarted = _10[0],
|
|
10075
|
+
setProgressStarted = _10[1];
|
|
10059
10076
|
React.useEffect(function () {
|
|
10060
10077
|
if (state.captureState === 'capturing') {
|
|
10061
10078
|
setProgressStarted(false);
|
|
@@ -10135,7 +10152,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10135
10152
|
capturedDocuments: state.capturedDocuments,
|
|
10136
10153
|
classNames: classNames.success,
|
|
10137
10154
|
onSubmitClick: function onSubmitClick() {
|
|
10138
|
-
|
|
10155
|
+
return dispatchIdCaptureAction({
|
|
10139
10156
|
type: 'flipRequestCompleted'
|
|
10140
10157
|
});
|
|
10141
10158
|
},
|