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
|
@@ -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.102';
|
|
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
|
});
|
|
@@ -9298,6 +9289,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9298
9289
|
}, /*#__PURE__*/React__namespace.default.createElement(XIcon, null)))));
|
|
9299
9290
|
}
|
|
9300
9291
|
function PassportUploadScreen(_a) {
|
|
9292
|
+
var _this = this;
|
|
9301
9293
|
var _b = _a.classNames,
|
|
9302
9294
|
classNames = _b === void 0 ? {} : _b,
|
|
9303
9295
|
_c = _a.verbiage,
|
|
@@ -9305,7 +9297,6 @@ function PassportUploadScreen(_a) {
|
|
|
9305
9297
|
var _d = React.useState(null),
|
|
9306
9298
|
file = _d[0],
|
|
9307
9299
|
setFile = _d[1];
|
|
9308
|
-
var onCapturedManually = useOnCapturedManually();
|
|
9309
9300
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9310
9301
|
uploadPassportText: 'Upload Passport',
|
|
9311
9302
|
loadingText: 'Loading...',
|
|
@@ -9331,25 +9322,39 @@ function PassportUploadScreen(_a) {
|
|
|
9331
9322
|
disabled: !file,
|
|
9332
9323
|
colors: buttonColors,
|
|
9333
9324
|
onClick: function onClick() {
|
|
9334
|
-
return
|
|
9325
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
9326
|
+
var _a;
|
|
9327
|
+
var _b, _c;
|
|
9328
|
+
return __generator(this, function (_d) {
|
|
9329
|
+
switch (_d.label) {
|
|
9330
|
+
case 0:
|
|
9331
|
+
_a = dispatchIdCaptureAction;
|
|
9332
|
+
_b = {
|
|
9333
|
+
type: 'documentCaptured'
|
|
9334
|
+
};
|
|
9335
|
+
_c = {};
|
|
9336
|
+
return [4 /*yield*/, readFile(file)];
|
|
9337
|
+
case 1:
|
|
9338
|
+
return [2 /*return*/, _a.apply(void 0, [(_b.payload = (_c.imageData = _d.sent(), _c.documentType = 'passport', _c.width = 0, _c.height = 0, _c), _b)])];
|
|
9339
|
+
}
|
|
9340
|
+
});
|
|
9341
|
+
});
|
|
9335
9342
|
}
|
|
9336
9343
|
}, verbiage.continueText)));
|
|
9337
9344
|
}
|
|
9338
9345
|
function IdDocumentUploadScreen(_a) {
|
|
9346
|
+
var _this = this;
|
|
9339
9347
|
var _b = _a.classNames,
|
|
9340
9348
|
classNames = _b === void 0 ? {} : _b,
|
|
9341
9349
|
_c = _a.verbiage,
|
|
9342
9350
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
9343
|
-
var
|
|
9344
|
-
|
|
9345
|
-
|
|
9351
|
+
var state = useIdCaptureStore();
|
|
9352
|
+
var _d = React.useState(null),
|
|
9353
|
+
idFrontFile = _d[0],
|
|
9354
|
+
setIdFrontFile = _d[1];
|
|
9346
9355
|
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();
|
|
9356
|
+
idBackFile = _e[0],
|
|
9357
|
+
setIdBackFile = _e[1];
|
|
9353
9358
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9354
9359
|
uploadIdFrontText: 'Upload ID Front',
|
|
9355
9360
|
uploadIdBackText: 'Upload ID Back',
|
|
@@ -9389,51 +9394,54 @@ function IdDocumentUploadScreen(_a) {
|
|
|
9389
9394
|
disabled: !idFrontFile || !state.allowSinglePageIdCapture && !idBackFile,
|
|
9390
9395
|
colors: buttonColors,
|
|
9391
9396
|
onClick: function onClick() {
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9397
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
9398
|
+
var _a, _b, _c, _d;
|
|
9399
|
+
var _e, _f, _g, _h;
|
|
9400
|
+
return __generator(this, function (_j) {
|
|
9401
|
+
switch (_j.label) {
|
|
9402
|
+
case 0:
|
|
9403
|
+
_b = (_a = state).dispatch;
|
|
9404
|
+
_e = {
|
|
9405
|
+
type: 'documentsCaptured'
|
|
9406
|
+
};
|
|
9407
|
+
if (!(!idBackFile && state.allowSinglePageIdCapture)) return [3 /*break*/, 2];
|
|
9408
|
+
_f = {};
|
|
9409
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
9410
|
+
case 1:
|
|
9411
|
+
_c = [(_f.imageData = _j.sent(), _f.documentType = 'singlePage', _f.width = 0, _f.height = 0, _f)];
|
|
9412
|
+
return [3 /*break*/, 5];
|
|
9413
|
+
case 2:
|
|
9414
|
+
_g = {};
|
|
9415
|
+
return [4 /*yield*/, readFile(idFrontFile)];
|
|
9416
|
+
case 3:
|
|
9417
|
+
_d = [(_g.imageData = _j.sent(), _g.documentType = 'idCardFront', _g.width = 0, _g.height = 0, _g)];
|
|
9418
|
+
_h = {};
|
|
9419
|
+
return [4 /*yield*/, readFile(idBackFile)];
|
|
9420
|
+
case 4:
|
|
9421
|
+
_c = _d.concat([(_h.imageData = _j.sent(), _h.documentType = 'idCardBack', _h.width = 0, _h.height = 0, _h)]);
|
|
9422
|
+
_j.label = 5;
|
|
9423
|
+
case 5:
|
|
9424
|
+
return [2 /*return*/, _b.apply(_a, [(_e.payload = _c, _e)])];
|
|
9425
|
+
}
|
|
9396
9426
|
});
|
|
9397
|
-
}
|
|
9398
|
-
void onCapturedManually(idFrontFile, idBackFile);
|
|
9427
|
+
});
|
|
9399
9428
|
}
|
|
9400
9429
|
}, verbiage.continueText)));
|
|
9401
9430
|
}
|
|
9402
9431
|
function CancelUploadTypeButton(_a) {
|
|
9403
9432
|
var children = _a.children,
|
|
9404
9433
|
className = _a.className;
|
|
9405
|
-
var dispatch = useIdCaptureState()[1];
|
|
9406
9434
|
return /*#__PURE__*/React__namespace.default.createElement(Button, {
|
|
9407
9435
|
className: className,
|
|
9408
9436
|
colors: buttonColors,
|
|
9409
9437
|
onClick: function onClick() {
|
|
9410
|
-
return
|
|
9438
|
+
return dispatchIdCaptureAction({
|
|
9411
9439
|
type: 'setUploadingDocumentsType',
|
|
9412
9440
|
payload: null
|
|
9413
9441
|
});
|
|
9414
9442
|
}
|
|
9415
9443
|
}, children);
|
|
9416
9444
|
}
|
|
9417
|
-
function useOnCapturedManually() {
|
|
9418
|
-
var dispatch = useIdCaptureState()[1];
|
|
9419
|
-
return React.useCallback(function () {
|
|
9420
|
-
var files = [];
|
|
9421
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9422
|
-
files[_i] = arguments[_i];
|
|
9423
|
-
}
|
|
9424
|
-
return Promise.all(files.filter(Boolean).map(readFile)).then(function (f) {
|
|
9425
|
-
for (var _i = 0, f_1 = f; _i < f_1.length; _i++) {
|
|
9426
|
-
var imageData = f_1[_i];
|
|
9427
|
-
dispatch({
|
|
9428
|
-
type: 'documentCapturedManually',
|
|
9429
|
-
payload: {
|
|
9430
|
-
imageData: imageData
|
|
9431
|
-
}
|
|
9432
|
-
});
|
|
9433
|
-
}
|
|
9434
|
-
});
|
|
9435
|
-
}, [dispatch]);
|
|
9436
|
-
}
|
|
9437
9445
|
function readFile(file) {
|
|
9438
9446
|
return new Promise(function (resolve, reject) {
|
|
9439
9447
|
if (!file) return reject(new Error('File is undefined'));
|
|
@@ -9836,32 +9844,30 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9836
9844
|
verbiage = _3 === void 0 ? {} : _3,
|
|
9837
9845
|
_4 = _a.debugMode,
|
|
9838
9846
|
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;
|
|
9847
|
+
var state = useIdCaptureStore();
|
|
9848
|
+
var _5 = useCameraStore(),
|
|
9849
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
9850
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
9851
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
9852
|
+
var _6 = React.useState(false),
|
|
9853
|
+
overlayDismissed = _6[0],
|
|
9854
|
+
setOverlayDismissed = _6[1];
|
|
9855
|
+
var _7 = React.useContext(SubmissionContext),
|
|
9856
|
+
submissionStatus = _7.submissionStatus,
|
|
9857
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
9858
|
+
setIdBackImage = _7.setIdBackImage,
|
|
9859
|
+
setPassportImage = _7.setPassportImage,
|
|
9860
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
9861
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
9862
|
+
var _8 = React.useContext(IdCaptureModelsContext),
|
|
9863
|
+
start = _8.start,
|
|
9864
|
+
stop = _8.stop,
|
|
9865
|
+
onPredictionMade = _8.onPredictionMade,
|
|
9866
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
9867
|
+
modelError = _8.modelError,
|
|
9868
|
+
resetBestFrame = _8.resetBestFrame;
|
|
9863
9869
|
React.useEffect(function () {
|
|
9864
|
-
|
|
9870
|
+
dispatchIdCaptureAction({
|
|
9865
9871
|
type: 'configureWizard',
|
|
9866
9872
|
payload: {
|
|
9867
9873
|
captureRequirement: captureRequirement,
|
|
@@ -9873,7 +9879,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9873
9879
|
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
9874
9880
|
}
|
|
9875
9881
|
});
|
|
9876
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement,
|
|
9882
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
9877
9883
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
9878
9884
|
React.useEffect(function () {
|
|
9879
9885
|
if (documentCount) resetBestFrame();
|
|
@@ -9889,15 +9895,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9889
9895
|
}, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
|
|
9890
9896
|
React.useEffect(function startModelsWhenCapturing() {
|
|
9891
9897
|
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
9892
|
-
|
|
9898
|
+
dispatchIdCaptureAction({
|
|
9893
9899
|
type: 'captureStarted'
|
|
9894
9900
|
});
|
|
9895
9901
|
start();
|
|
9896
|
-
}, [
|
|
9902
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
9897
9903
|
React.useEffect(function () {
|
|
9898
9904
|
onPredictionMade(function (prediction) {
|
|
9899
9905
|
if (state.captureState === 'capturing') {
|
|
9900
|
-
|
|
9906
|
+
dispatchIdCaptureAction({
|
|
9901
9907
|
type: 'objectsDetected',
|
|
9902
9908
|
payload: {
|
|
9903
9909
|
prediction: prediction
|
|
@@ -9906,19 +9912,19 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9906
9912
|
} else if (state.captureState === 'requestingFlip') {
|
|
9907
9913
|
if (state.requestedDocumentType !== 'selfie' && prediction["".concat(state.requestedDocumentType, "DetectionThresholdMet")]) {
|
|
9908
9914
|
resetBestFrame();
|
|
9909
|
-
|
|
9915
|
+
dispatchIdCaptureAction({
|
|
9910
9916
|
type: 'flipRequestCompleted'
|
|
9911
9917
|
});
|
|
9912
9918
|
}
|
|
9913
9919
|
}
|
|
9914
9920
|
});
|
|
9915
|
-
}, [
|
|
9921
|
+
}, [onPredictionMade, resetBestFrame, state.captureState, state.requestedDocumentType]);
|
|
9916
9922
|
React.useEffect(function () {
|
|
9917
9923
|
if (state.captureState === 'complete') stop();
|
|
9918
9924
|
}, [state.captureState, stop]);
|
|
9919
9925
|
var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
|
|
9920
9926
|
logCaptureMetadata(metadata);
|
|
9921
|
-
|
|
9927
|
+
dispatchIdCaptureAction({
|
|
9922
9928
|
type: 'documentCaptured',
|
|
9923
9929
|
payload: {
|
|
9924
9930
|
imageData: imageData,
|
|
@@ -9930,7 +9936,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9930
9936
|
focusScore: metadata.bestFocusScore
|
|
9931
9937
|
}
|
|
9932
9938
|
});
|
|
9933
|
-
}, [
|
|
9939
|
+
}, [logCaptureMetadata]);
|
|
9934
9940
|
var onSubmitClick = React.useCallback(function () {
|
|
9935
9941
|
var _a = state.capturedDocuments,
|
|
9936
9942
|
idCardFront = _a.idCardFront,
|
|
@@ -9956,25 +9962,25 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9956
9962
|
}, [onSuccess, releaseCameraAccess, releaseCameraAccessOnExit, setIdBackImage, setIdFrontImage, setPassportImage, state.capturedDocuments]);
|
|
9957
9963
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, state.captureState === 'complete', onSubmitClick);
|
|
9958
9964
|
var onRetryClick = React.useCallback(function () {
|
|
9959
|
-
|
|
9965
|
+
return dispatchIdCaptureAction({
|
|
9960
9966
|
type: 'resetWizard'
|
|
9961
9967
|
});
|
|
9962
|
-
}, [
|
|
9963
|
-
var
|
|
9964
|
-
attempt =
|
|
9965
|
-
setAttempt =
|
|
9968
|
+
}, []);
|
|
9969
|
+
var _9 = React.useState(0),
|
|
9970
|
+
attempt = _9[0],
|
|
9971
|
+
setAttempt = _9[1];
|
|
9966
9972
|
var onExit = React.useCallback(function () {
|
|
9967
9973
|
releaseCameraAccess();
|
|
9968
9974
|
setOverlayDismissed(false);
|
|
9969
9975
|
setAttempt(function (n) {
|
|
9970
9976
|
return n + 1;
|
|
9971
9977
|
});
|
|
9972
|
-
|
|
9978
|
+
dispatchIdCaptureAction({
|
|
9973
9979
|
type: 'resetWizard'
|
|
9974
9980
|
});
|
|
9975
9981
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
9976
9982
|
void requestCameraAccess();
|
|
9977
|
-
}, [
|
|
9983
|
+
}, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
|
|
9978
9984
|
React.useEffect(function () {
|
|
9979
9985
|
if (submissionStatus !== SubmissionStatus.READY) {
|
|
9980
9986
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
@@ -10007,14 +10013,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10007
10013
|
if (state.captureState !== 'requestingFlip') return;
|
|
10008
10014
|
var t = setTimeout(function () {
|
|
10009
10015
|
resetBestFrame();
|
|
10010
|
-
|
|
10016
|
+
dispatchIdCaptureAction({
|
|
10011
10017
|
type: 'flipRequestCompleted'
|
|
10012
10018
|
});
|
|
10013
10019
|
}, 6000);
|
|
10014
10020
|
return function () {
|
|
10015
10021
|
clearTimeout(t);
|
|
10016
10022
|
};
|
|
10017
|
-
}, [
|
|
10023
|
+
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
10018
10024
|
React.useEffect(function () {
|
|
10019
10025
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
10020
10026
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -10042,7 +10048,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10042
10048
|
return [4 /*yield*/, dataUrlToBase64(imageData)];
|
|
10043
10049
|
case 1:
|
|
10044
10050
|
base64ImageData = _a.sent();
|
|
10045
|
-
|
|
10051
|
+
dispatchIdCaptureAction({
|
|
10046
10052
|
type: 'documentCapturedManually',
|
|
10047
10053
|
payload: {
|
|
10048
10054
|
imageData: base64ImageData
|
|
@@ -10052,10 +10058,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10052
10058
|
}
|
|
10053
10059
|
});
|
|
10054
10060
|
});
|
|
10055
|
-
}, [
|
|
10056
|
-
var
|
|
10057
|
-
progressStarted =
|
|
10058
|
-
setProgressStarted =
|
|
10061
|
+
}, []);
|
|
10062
|
+
var _10 = React.useState(false),
|
|
10063
|
+
progressStarted = _10[0],
|
|
10064
|
+
setProgressStarted = _10[1];
|
|
10059
10065
|
React.useEffect(function () {
|
|
10060
10066
|
if (state.captureState === 'capturing') {
|
|
10061
10067
|
setProgressStarted(false);
|
|
@@ -10135,7 +10141,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10135
10141
|
capturedDocuments: state.capturedDocuments,
|
|
10136
10142
|
classNames: classNames.success,
|
|
10137
10143
|
onSubmitClick: function onSubmitClick() {
|
|
10138
|
-
|
|
10144
|
+
return dispatchIdCaptureAction({
|
|
10139
10145
|
type: 'flipRequestCompleted'
|
|
10140
10146
|
});
|
|
10141
10147
|
},
|