idmission-web-sdk 2.2.99 → 2.2.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureFitGuide.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureGuideOverlay.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureGuides.d.ts +1 -1
- package/dist/components/id_capture/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureOrUploadScreen.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +24 -5
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/id_capture/OverrideWrongDocumentTypeGuidanceDialog.d.ts.map +1 -1
- package/dist/components/id_capture/ScalingCameraFeed.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +241 -215
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +242 -216
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +544 -292
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -4637,6 +4642,11 @@ var _reducer = function reducer(state, action) {
|
|
|
4637
4642
|
frameCaptureRate: frameCaptureRate
|
|
4638
4643
|
});
|
|
4639
4644
|
}
|
|
4645
|
+
case 'captureInitialized':
|
|
4646
|
+
return _assign(_assign({}, state), {
|
|
4647
|
+
captureState: 'capturing',
|
|
4648
|
+
isUploadingDocumentsFromStorage: false
|
|
4649
|
+
});
|
|
4640
4650
|
case 'captureStarted':
|
|
4641
4651
|
return _assign(_assign({}, state), {
|
|
4642
4652
|
captureStartedAt: new Date(),
|
|
@@ -4679,7 +4689,9 @@ var _reducer = function reducer(state, action) {
|
|
|
4679
4689
|
} else {
|
|
4680
4690
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
4681
4691
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4682
|
-
newState.
|
|
4692
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
4693
|
+
newState.captureState = 'requestingFlip';
|
|
4694
|
+
}
|
|
4683
4695
|
newState.idCardFrontDetectionThresholdMet = false;
|
|
4684
4696
|
newState.idCardBackDetectionThresholdMet = false;
|
|
4685
4697
|
newState.passportDetectionThresholdMet = false;
|
|
@@ -4689,28 +4701,23 @@ var _reducer = function reducer(state, action) {
|
|
|
4689
4701
|
return newState;
|
|
4690
4702
|
}
|
|
4691
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':
|
|
4692
4713
|
{
|
|
4693
|
-
var newState = _assign(
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
4701
|
-
if (remainingRequirements.length === 0) {
|
|
4702
|
-
newState.captureState = 'complete';
|
|
4703
|
-
} else {
|
|
4704
|
-
newState.requestedDocumentType = remainingRequirements[0];
|
|
4705
|
-
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4706
|
-
if (!newState.isUploadingDocumentsFromStorage) {
|
|
4707
|
-
newState.captureState = 'requestingFlip';
|
|
4708
|
-
}
|
|
4709
|
-
newState.idCardFrontDetectionThresholdMet = false;
|
|
4710
|
-
newState.idCardBackDetectionThresholdMet = false;
|
|
4711
|
-
newState.passportDetectionThresholdMet = false;
|
|
4712
|
-
newState.wrongDocumentTypePredictions = 0;
|
|
4713
|
-
}
|
|
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
|
+
});
|
|
4714
4721
|
}
|
|
4715
4722
|
return newState;
|
|
4716
4723
|
}
|
|
@@ -4747,6 +4754,9 @@ var _reducer = function reducer(state, action) {
|
|
|
4747
4754
|
}
|
|
4748
4755
|
case 'resetWizard':
|
|
4749
4756
|
return _assign(_assign({}, initialState$4), {
|
|
4757
|
+
dispatch: state.dispatch,
|
|
4758
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
4759
|
+
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
4750
4760
|
captureRequirement: state.captureRequirement,
|
|
4751
4761
|
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
4752
4762
|
});
|
|
@@ -4754,13 +4764,26 @@ var _reducer = function reducer(state, action) {
|
|
|
4754
4764
|
return state;
|
|
4755
4765
|
}
|
|
4756
4766
|
};
|
|
4757
|
-
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) {
|
|
4758
4777
|
var children = _a.children;
|
|
4759
|
-
var
|
|
4760
|
-
state
|
|
4761
|
-
|
|
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]);
|
|
4762
4785
|
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
4763
|
-
|
|
4786
|
+
dispatchIdCaptureAction({
|
|
4764
4787
|
type: 'redrawRequested'
|
|
4765
4788
|
});
|
|
4766
4789
|
}, 500);
|
|
@@ -4768,26 +4791,13 @@ var IdCaptureStateProvider = function IdCaptureStateProvider(_a) {
|
|
|
4768
4791
|
if (typeof window === 'undefined') return;
|
|
4769
4792
|
window.addEventListener('resize', onResize);
|
|
4770
4793
|
return function () {
|
|
4771
|
-
window.removeEventListener('resize', onResize);
|
|
4794
|
+
return window.removeEventListener('resize', onResize);
|
|
4772
4795
|
};
|
|
4773
4796
|
}, [onResize]);
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
}
|
|
4779
|
-
}, [state.overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
4780
|
-
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateContext.Provider, {
|
|
4781
|
-
value: state
|
|
4782
|
-
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureDispatchContext.Provider, {
|
|
4783
|
-
value: dispatch
|
|
4784
|
-
}, children));
|
|
4785
|
-
};
|
|
4786
|
-
var useIdCaptureState = function useIdCaptureState() {
|
|
4787
|
-
var state = React.useContext(IdCaptureStateContext);
|
|
4788
|
-
var dispatch = React.useContext(IdCaptureDispatchContext);
|
|
4789
|
-
if (!state || !dispatch) throw new Error('useIdCaptureState cannot be used without IdCaptureStateProvider');
|
|
4790
|
-
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);
|
|
4791
4801
|
};
|
|
4792
4802
|
|
|
4793
4803
|
function DebugStatsPane(_a) {
|
|
@@ -4862,7 +4872,7 @@ var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
|
|
|
4862
4872
|
var scaling = _a.scaling,
|
|
4863
4873
|
$flipX = _a.$flipX,
|
|
4864
4874
|
children = _a.children;
|
|
4865
|
-
var _b =
|
|
4875
|
+
var _b = useIdCaptureStore(),
|
|
4866
4876
|
guideRectWidth = _b.guideRectWidth,
|
|
4867
4877
|
guideRectHeight = _b.guideRectHeight,
|
|
4868
4878
|
guideRectX = _b.guideRectX,
|
|
@@ -6027,14 +6037,14 @@ function OverrideWrongDocumentTypeGuidanceDialog(_a) {
|
|
|
6027
6037
|
classNames = _b === void 0 ? {} : _b,
|
|
6028
6038
|
_c = _a.verbiage,
|
|
6029
6039
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
6030
|
-
var _d =
|
|
6031
|
-
|
|
6032
|
-
dispatch = _d
|
|
6040
|
+
var _d = useIdCaptureStore(),
|
|
6041
|
+
allowOverrideWrongDocumentTypeGuidance = _d.allowOverrideWrongDocumentTypeGuidance,
|
|
6042
|
+
dispatch = _d.dispatch;
|
|
6033
6043
|
var verbiage = useTranslations(rawVerbiage, {
|
|
6034
6044
|
messageText: 'We are having trouble identifying the correct side of your id, do you want to continue with capture anyway?',
|
|
6035
6045
|
buttonText: 'OK'
|
|
6036
6046
|
});
|
|
6037
|
-
if (!
|
|
6047
|
+
if (!allowOverrideWrongDocumentTypeGuidance) return null;
|
|
6038
6048
|
return /*#__PURE__*/React__namespace.default.createElement(Container$2, {
|
|
6039
6049
|
className: classNames.container
|
|
6040
6050
|
}, /*#__PURE__*/React__namespace.default.createElement(InnerContainer, {
|
|
@@ -6088,47 +6098,50 @@ var IdCapture = function IdCapture(_a) {
|
|
|
6088
6098
|
width = _q === void 0 ? 1 : _q,
|
|
6089
6099
|
_r = _p.height,
|
|
6090
6100
|
height = _r === void 0 ? 1 : _r;
|
|
6091
|
-
var
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
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;
|
|
6111
|
+
React.useEffect(function () {
|
|
6112
|
+
return dispatchIdCaptureAction({
|
|
6113
|
+
type: 'captureInitialized'
|
|
6114
|
+
});
|
|
6115
|
+
}, []);
|
|
6103
6116
|
React.useEffect(function () {
|
|
6104
6117
|
setThresholds(thresholds);
|
|
6105
6118
|
}, [thresholds, setThresholds]);
|
|
6106
6119
|
React.useEffect(function () {
|
|
6107
6120
|
if (!requiredDocumentType) return;
|
|
6108
|
-
|
|
6121
|
+
dispatchIdCaptureAction({
|
|
6109
6122
|
type: 'setRequiredDocumentType',
|
|
6110
6123
|
payload: requiredDocumentType
|
|
6111
6124
|
});
|
|
6112
|
-
}, [
|
|
6125
|
+
}, [requiredDocumentType]);
|
|
6113
6126
|
React.useEffect(function () {
|
|
6114
|
-
|
|
6127
|
+
dispatchIdCaptureAction({
|
|
6115
6128
|
type: 'pageRendered',
|
|
6116
6129
|
payload: {
|
|
6117
6130
|
pageWidth: width,
|
|
6118
6131
|
pageHeight: height
|
|
6119
6132
|
}
|
|
6120
6133
|
});
|
|
6121
|
-
}, [
|
|
6134
|
+
}, [height, width]);
|
|
6122
6135
|
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
6123
6136
|
React.useEffect(function () {
|
|
6124
6137
|
if (!shouldCapture) return;
|
|
6125
|
-
|
|
6138
|
+
dispatchIdCaptureAction({
|
|
6126
6139
|
type: 'capturing'
|
|
6127
6140
|
});
|
|
6128
6141
|
var bestFrame = getBestFrame();
|
|
6129
6142
|
if (!bestFrame) {
|
|
6130
6143
|
log('uh oh, i did not get a photo');
|
|
6131
|
-
|
|
6144
|
+
dispatchIdCaptureAction({
|
|
6132
6145
|
type: 'captureFailed'
|
|
6133
6146
|
});
|
|
6134
6147
|
return;
|
|
@@ -6141,7 +6154,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
6141
6154
|
var width = canvas.width,
|
|
6142
6155
|
height = canvas.height;
|
|
6143
6156
|
var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
|
|
6144
|
-
|
|
6157
|
+
dispatchIdCaptureAction({
|
|
6145
6158
|
type: 'frameCaptured',
|
|
6146
6159
|
payload: {
|
|
6147
6160
|
imageUrl: imageUrl
|
|
@@ -6159,11 +6172,11 @@ var IdCapture = function IdCapture(_a) {
|
|
|
6159
6172
|
bestFocusScore: focusScore
|
|
6160
6173
|
};
|
|
6161
6174
|
onCapture === null || onCapture === void 0 ? void 0 : onCapture(imageUrl, width, height, capturedDocumentType, metadata);
|
|
6162
|
-
|
|
6175
|
+
dispatchIdCaptureAction({
|
|
6163
6176
|
type: 'captured'
|
|
6164
6177
|
});
|
|
6165
6178
|
}, 0);
|
|
6166
|
-
}, [
|
|
6179
|
+
}, [getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
|
|
6167
6180
|
var theme = styled.useTheme();
|
|
6168
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');
|
|
6169
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');
|
|
@@ -6889,13 +6902,6 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
|
|
|
6889
6902
|
var _q = React.useState(false),
|
|
6890
6903
|
dismissed = _q[0],
|
|
6891
6904
|
setDismissed = _q[1];
|
|
6892
|
-
var dispatch = useIdCaptureState()[1];
|
|
6893
|
-
React.useEffect(function () {
|
|
6894
|
-
dispatch({
|
|
6895
|
-
type: 'setUploadingDocumentsFromStorage',
|
|
6896
|
-
payload: false
|
|
6897
|
-
});
|
|
6898
|
-
}, [dispatch]);
|
|
6899
6905
|
assets.instructionImageUrl || (assets.instructionImageUrl = legacyInstructionImageUrl$1);
|
|
6900
6906
|
var verbiage = useTranslations(rawVerbiage, {
|
|
6901
6907
|
headingText: 'Use your device camera to capture your ID',
|
|
@@ -7880,9 +7886,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
|
|
|
7880
7886
|
wrapperAspectRatio = _1.wrapperAspectRatio,
|
|
7881
7887
|
guideOrientationOnImageLoaded = _1.onImageLoaded,
|
|
7882
7888
|
setDimensions = _1.setDimensions;
|
|
7883
|
-
var
|
|
7884
|
-
state = _2[0],
|
|
7885
|
-
dispatch = _2[1];
|
|
7889
|
+
var state = useIdCaptureStore();
|
|
7886
7890
|
var theme = styled.useTheme();
|
|
7887
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;
|
|
7888
7892
|
React.useEffect(function () {
|
|
@@ -7908,14 +7912,14 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
|
|
|
7908
7912
|
var imageByUrl = imagesByUrl[img.src];
|
|
7909
7913
|
var width = (_a = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.width) !== null && _a !== void 0 ? _a : img.naturalWidth;
|
|
7910
7914
|
var height = (_b = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.height) !== null && _b !== void 0 ? _b : img.naturalHeight;
|
|
7911
|
-
|
|
7915
|
+
dispatchIdCaptureAction({
|
|
7912
7916
|
type: 'guideImageLoaded',
|
|
7913
7917
|
payload: {
|
|
7914
7918
|
width: width,
|
|
7915
7919
|
height: height
|
|
7916
7920
|
}
|
|
7917
7921
|
});
|
|
7918
|
-
}, [
|
|
7922
|
+
}, [guideOrientationOnImageLoaded, imagesByUrl]);
|
|
7919
7923
|
return /*#__PURE__*/React__namespace.default.createElement(StyledPageContainer, {
|
|
7920
7924
|
ref: wrapperRef,
|
|
7921
7925
|
onClick: onClick,
|
|
@@ -8045,19 +8049,17 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8045
8049
|
images = _w === void 0 ? defaultIdCaptureGuideImages : _w,
|
|
8046
8050
|
_x = _a.classNames,
|
|
8047
8051
|
classNames = _x === void 0 ? {} : _x;
|
|
8048
|
-
var _y =
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
guideImageHeight = _z.guideImageHeight,
|
|
8053
|
-
dispatch = _y[1];
|
|
8052
|
+
var _y = useIdCaptureStore(),
|
|
8053
|
+
redrawing = _y.redrawing,
|
|
8054
|
+
guideImageWidth = _y.guideImageWidth,
|
|
8055
|
+
guideImageHeight = _y.guideImageHeight;
|
|
8054
8056
|
var canvasRef = React.useRef(null);
|
|
8055
|
-
var
|
|
8056
|
-
wrapperRef =
|
|
8057
|
-
|
|
8058
|
-
wrapperWidth =
|
|
8059
|
-
|
|
8060
|
-
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;
|
|
8061
8063
|
var theme = styled.useTheme();
|
|
8062
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;
|
|
8063
8065
|
if (padding === undefined) {
|
|
@@ -8075,7 +8077,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8075
8077
|
if (redrawing) {
|
|
8076
8078
|
resetCanvasDimensions(canvas);
|
|
8077
8079
|
var timer_1 = setTimeout(function () {
|
|
8078
|
-
|
|
8080
|
+
dispatchIdCaptureAction({
|
|
8079
8081
|
type: 'redrawInProgress'
|
|
8080
8082
|
});
|
|
8081
8083
|
}, 10);
|
|
@@ -8125,7 +8127,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8125
8127
|
// reset composite mode to default
|
|
8126
8128
|
ctx.globalCompositeOperation = 'source-over';
|
|
8127
8129
|
var rectOffsetTop = canvas.offsetTop;
|
|
8128
|
-
|
|
8130
|
+
dispatchIdCaptureAction({
|
|
8129
8131
|
type: 'redrawCompleted',
|
|
8130
8132
|
payload: {
|
|
8131
8133
|
guideRectX: rectX,
|
|
@@ -8136,7 +8138,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
|
|
|
8136
8138
|
}
|
|
8137
8139
|
});
|
|
8138
8140
|
return function () {};
|
|
8139
|
-
}, [aspectRatio, borderColor, borderRadius, borderWidth,
|
|
8141
|
+
}, [aspectRatio, borderColor, borderRadius, borderWidth, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
|
|
8140
8142
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(CanvasWrapper$1, {
|
|
8141
8143
|
ref: wrapperRef,
|
|
8142
8144
|
"$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
|
|
@@ -8186,7 +8188,7 @@ function IdCaptureGuides(_a) {
|
|
|
8186
8188
|
colors = _k === void 0 ? {} : _k,
|
|
8187
8189
|
_l = _a.verbiage,
|
|
8188
8190
|
rawVerbiage = _l === void 0 ? {} : _l;
|
|
8189
|
-
var state =
|
|
8191
|
+
var state = useIdCaptureStore();
|
|
8190
8192
|
var isRearFacing = useCameraStore(function (state) {
|
|
8191
8193
|
return state.isRearFacing;
|
|
8192
8194
|
});
|
|
@@ -9149,7 +9151,7 @@ var StyledButtonsRow$8 = styled__default.default(ButtonsRow)(templateObject_6$5
|
|
|
9149
9151
|
var templateObject_1$m, templateObject_2$k, templateObject_3$g, templateObject_4$a, templateObject_5$6, templateObject_6$5;
|
|
9150
9152
|
|
|
9151
9153
|
function ScalingCameraFeed() {
|
|
9152
|
-
var _a =
|
|
9154
|
+
var _a = useIdCaptureStore(),
|
|
9153
9155
|
captureState = _a.captureState,
|
|
9154
9156
|
guideRectX = _a.guideRectX,
|
|
9155
9157
|
guideRectY = _a.guideRectY,
|
|
@@ -9175,14 +9177,12 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9175
9177
|
classNames = _b === void 0 ? {} : _b,
|
|
9176
9178
|
_c = _a.verbiage,
|
|
9177
9179
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
9178
|
-
var
|
|
9179
|
-
state = _d[0],
|
|
9180
|
-
dispatch = _d[1];
|
|
9180
|
+
var state = useIdCaptureStore();
|
|
9181
9181
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
9182
9182
|
var loadModels = React.useContext(IdCaptureModelsContext).load;
|
|
9183
|
-
var
|
|
9184
|
-
selectIdTypeModalOpen =
|
|
9185
|
-
setSelectIdTypeModalOpen =
|
|
9183
|
+
var _d = React.useState(false),
|
|
9184
|
+
selectIdTypeModalOpen = _d[0],
|
|
9185
|
+
setSelectIdTypeModalOpen = _d[1];
|
|
9186
9186
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9187
9187
|
captureWithCameraText: 'Capture with Camera',
|
|
9188
9188
|
orText: 'OR',
|
|
@@ -9214,7 +9214,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9214
9214
|
onClick: function onClick() {
|
|
9215
9215
|
loadModels();
|
|
9216
9216
|
void requestCameraAccess();
|
|
9217
|
-
dispatch({
|
|
9217
|
+
state.dispatch({
|
|
9218
9218
|
type: 'setUploadingDocumentsFromStorage',
|
|
9219
9219
|
payload: false
|
|
9220
9220
|
});
|
|
@@ -9231,19 +9231,19 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9231
9231
|
className: classNames.uploadFromStorageButton,
|
|
9232
9232
|
colors: buttonColors,
|
|
9233
9233
|
onClick: function onClick() {
|
|
9234
|
-
dispatch({
|
|
9234
|
+
state.dispatch({
|
|
9235
9235
|
type: 'setUploadingDocumentsFromStorage',
|
|
9236
9236
|
payload: true
|
|
9237
9237
|
});
|
|
9238
9238
|
if (state.captureRequirement === 'idCardOrPassport') {
|
|
9239
9239
|
setSelectIdTypeModalOpen(true);
|
|
9240
9240
|
} else if (state.captureRequirement === 'passport') {
|
|
9241
|
-
dispatch({
|
|
9241
|
+
state.dispatch({
|
|
9242
9242
|
type: 'setUploadingDocumentsType',
|
|
9243
9243
|
payload: 'passport'
|
|
9244
9244
|
});
|
|
9245
9245
|
} else {
|
|
9246
|
-
dispatch({
|
|
9246
|
+
state.dispatch({
|
|
9247
9247
|
type: 'setUploadingDocumentsType',
|
|
9248
9248
|
payload: 'idCard'
|
|
9249
9249
|
});
|
|
@@ -9263,7 +9263,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9263
9263
|
className: classNames.selectPassportTypeButton,
|
|
9264
9264
|
colors: buttonColors,
|
|
9265
9265
|
onClick: function onClick() {
|
|
9266
|
-
return dispatch({
|
|
9266
|
+
return state.dispatch({
|
|
9267
9267
|
type: 'setUploadingDocumentsType',
|
|
9268
9268
|
payload: 'passport'
|
|
9269
9269
|
});
|
|
@@ -9276,7 +9276,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9276
9276
|
className: classNames.selectIdCardTypeButton,
|
|
9277
9277
|
colors: buttonColors,
|
|
9278
9278
|
onClick: function onClick() {
|
|
9279
|
-
return dispatch({
|
|
9279
|
+
return state.dispatch({
|
|
9280
9280
|
type: 'setUploadingDocumentsType',
|
|
9281
9281
|
payload: 'idCard'
|
|
9282
9282
|
});
|
|
@@ -9327,20 +9327,18 @@ function PassportUploadScreen(_a) {
|
|
|
9327
9327
|
}, verbiage.continueText)));
|
|
9328
9328
|
}
|
|
9329
9329
|
function IdDocumentUploadScreen(_a) {
|
|
9330
|
+
var _this = this;
|
|
9330
9331
|
var _b = _a.classNames,
|
|
9331
9332
|
classNames = _b === void 0 ? {} : _b,
|
|
9332
9333
|
_c = _a.verbiage,
|
|
9333
9334
|
rawVerbiage = _c === void 0 ? {} : _c;
|
|
9334
|
-
var
|
|
9335
|
-
|
|
9336
|
-
|
|
9335
|
+
var state = useIdCaptureStore();
|
|
9336
|
+
var _d = React.useState(null),
|
|
9337
|
+
idFrontFile = _d[0],
|
|
9338
|
+
setIdFrontFile = _d[1];
|
|
9337
9339
|
var _e = React.useState(null),
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
var _f = React.useState(null),
|
|
9341
|
-
idBackFile = _f[0],
|
|
9342
|
-
setIdBackFile = _f[1];
|
|
9343
|
-
var onCapturedManually = useOnCapturedManually();
|
|
9340
|
+
idBackFile = _e[0],
|
|
9341
|
+
setIdBackFile = _e[1];
|
|
9344
9342
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9345
9343
|
uploadIdFrontText: 'Upload ID Front',
|
|
9346
9344
|
uploadIdBackText: 'Upload ID Back',
|
|
@@ -9380,25 +9378,56 @@ function IdDocumentUploadScreen(_a) {
|
|
|
9380
9378
|
disabled: !idFrontFile || !state.allowSinglePageIdCapture && !idBackFile,
|
|
9381
9379
|
colors: buttonColors,
|
|
9382
9380
|
onClick: function onClick() {
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
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
|
+
}
|
|
9387
9418
|
});
|
|
9388
|
-
}
|
|
9389
|
-
void onCapturedManually(idFrontFile, idBackFile);
|
|
9419
|
+
});
|
|
9390
9420
|
}
|
|
9391
9421
|
}, verbiage.continueText)));
|
|
9392
9422
|
}
|
|
9393
9423
|
function CancelUploadTypeButton(_a) {
|
|
9394
9424
|
var children = _a.children,
|
|
9395
9425
|
className = _a.className;
|
|
9396
|
-
var dispatch = useIdCaptureState()[1];
|
|
9397
9426
|
return /*#__PURE__*/React__namespace.default.createElement(Button, {
|
|
9398
9427
|
className: className,
|
|
9399
9428
|
colors: buttonColors,
|
|
9400
9429
|
onClick: function onClick() {
|
|
9401
|
-
return
|
|
9430
|
+
return dispatchIdCaptureAction({
|
|
9402
9431
|
type: 'setUploadingDocumentsType',
|
|
9403
9432
|
payload: null
|
|
9404
9433
|
});
|
|
@@ -9406,7 +9435,6 @@ function CancelUploadTypeButton(_a) {
|
|
|
9406
9435
|
}, children);
|
|
9407
9436
|
}
|
|
9408
9437
|
function useOnCapturedManually() {
|
|
9409
|
-
var dispatch = useIdCaptureState()[1];
|
|
9410
9438
|
return React.useCallback(function () {
|
|
9411
9439
|
var files = [];
|
|
9412
9440
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -9415,7 +9443,7 @@ function useOnCapturedManually() {
|
|
|
9415
9443
|
return Promise.all(files.filter(Boolean).map(readFile)).then(function (f) {
|
|
9416
9444
|
for (var _i = 0, f_1 = f; _i < f_1.length; _i++) {
|
|
9417
9445
|
var imageData = f_1[_i];
|
|
9418
|
-
|
|
9446
|
+
dispatchIdCaptureAction({
|
|
9419
9447
|
type: 'documentCapturedManually',
|
|
9420
9448
|
payload: {
|
|
9421
9449
|
imageData: imageData
|
|
@@ -9423,7 +9451,7 @@ function useOnCapturedManually() {
|
|
|
9423
9451
|
});
|
|
9424
9452
|
}
|
|
9425
9453
|
});
|
|
9426
|
-
}, [
|
|
9454
|
+
}, []);
|
|
9427
9455
|
}
|
|
9428
9456
|
function readFile(file) {
|
|
9429
9457
|
return new Promise(function (resolve, reject) {
|
|
@@ -9827,32 +9855,30 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9827
9855
|
verbiage = _3 === void 0 ? {} : _3,
|
|
9828
9856
|
_4 = _a.debugMode,
|
|
9829
9857
|
debugMode = _4 === void 0 ? false : _4;
|
|
9830
|
-
var
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
modelError = _9.modelError,
|
|
9853
|
-
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;
|
|
9854
9880
|
React.useEffect(function () {
|
|
9855
|
-
|
|
9881
|
+
dispatchIdCaptureAction({
|
|
9856
9882
|
type: 'configureWizard',
|
|
9857
9883
|
payload: {
|
|
9858
9884
|
captureRequirement: captureRequirement,
|
|
@@ -9864,7 +9890,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9864
9890
|
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
9865
9891
|
}
|
|
9866
9892
|
});
|
|
9867
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement,
|
|
9893
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
9868
9894
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
9869
9895
|
React.useEffect(function () {
|
|
9870
9896
|
if (documentCount) resetBestFrame();
|
|
@@ -9880,15 +9906,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9880
9906
|
}, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
|
|
9881
9907
|
React.useEffect(function startModelsWhenCapturing() {
|
|
9882
9908
|
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
9883
|
-
|
|
9909
|
+
dispatchIdCaptureAction({
|
|
9884
9910
|
type: 'captureStarted'
|
|
9885
9911
|
});
|
|
9886
9912
|
start();
|
|
9887
|
-
}, [
|
|
9913
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
9888
9914
|
React.useEffect(function () {
|
|
9889
9915
|
onPredictionMade(function (prediction) {
|
|
9890
9916
|
if (state.captureState === 'capturing') {
|
|
9891
|
-
|
|
9917
|
+
dispatchIdCaptureAction({
|
|
9892
9918
|
type: 'objectsDetected',
|
|
9893
9919
|
payload: {
|
|
9894
9920
|
prediction: prediction
|
|
@@ -9897,19 +9923,19 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9897
9923
|
} else if (state.captureState === 'requestingFlip') {
|
|
9898
9924
|
if (state.requestedDocumentType !== 'selfie' && prediction["".concat(state.requestedDocumentType, "DetectionThresholdMet")]) {
|
|
9899
9925
|
resetBestFrame();
|
|
9900
|
-
|
|
9926
|
+
dispatchIdCaptureAction({
|
|
9901
9927
|
type: 'flipRequestCompleted'
|
|
9902
9928
|
});
|
|
9903
9929
|
}
|
|
9904
9930
|
}
|
|
9905
9931
|
});
|
|
9906
|
-
}, [
|
|
9932
|
+
}, [onPredictionMade, resetBestFrame, state.captureState, state.requestedDocumentType]);
|
|
9907
9933
|
React.useEffect(function () {
|
|
9908
9934
|
if (state.captureState === 'complete') stop();
|
|
9909
9935
|
}, [state.captureState, stop]);
|
|
9910
9936
|
var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
|
|
9911
9937
|
logCaptureMetadata(metadata);
|
|
9912
|
-
|
|
9938
|
+
dispatchIdCaptureAction({
|
|
9913
9939
|
type: 'documentCaptured',
|
|
9914
9940
|
payload: {
|
|
9915
9941
|
imageData: imageData,
|
|
@@ -9921,7 +9947,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9921
9947
|
focusScore: metadata.bestFocusScore
|
|
9922
9948
|
}
|
|
9923
9949
|
});
|
|
9924
|
-
}, [
|
|
9950
|
+
}, [logCaptureMetadata]);
|
|
9925
9951
|
var onSubmitClick = React.useCallback(function () {
|
|
9926
9952
|
var _a = state.capturedDocuments,
|
|
9927
9953
|
idCardFront = _a.idCardFront,
|
|
@@ -9947,25 +9973,25 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9947
9973
|
}, [onSuccess, releaseCameraAccess, releaseCameraAccessOnExit, setIdBackImage, setIdFrontImage, setPassportImage, state.capturedDocuments]);
|
|
9948
9974
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, state.captureState === 'complete', onSubmitClick);
|
|
9949
9975
|
var onRetryClick = React.useCallback(function () {
|
|
9950
|
-
|
|
9976
|
+
return dispatchIdCaptureAction({
|
|
9951
9977
|
type: 'resetWizard'
|
|
9952
9978
|
});
|
|
9953
|
-
}, [
|
|
9954
|
-
var
|
|
9955
|
-
attempt =
|
|
9956
|
-
setAttempt =
|
|
9979
|
+
}, []);
|
|
9980
|
+
var _9 = React.useState(0),
|
|
9981
|
+
attempt = _9[0],
|
|
9982
|
+
setAttempt = _9[1];
|
|
9957
9983
|
var onExit = React.useCallback(function () {
|
|
9958
9984
|
releaseCameraAccess();
|
|
9959
9985
|
setOverlayDismissed(false);
|
|
9960
9986
|
setAttempt(function (n) {
|
|
9961
9987
|
return n + 1;
|
|
9962
9988
|
});
|
|
9963
|
-
|
|
9989
|
+
dispatchIdCaptureAction({
|
|
9964
9990
|
type: 'resetWizard'
|
|
9965
9991
|
});
|
|
9966
9992
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
9967
9993
|
void requestCameraAccess();
|
|
9968
|
-
}, [
|
|
9994
|
+
}, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
|
|
9969
9995
|
React.useEffect(function () {
|
|
9970
9996
|
if (submissionStatus !== SubmissionStatus.READY) {
|
|
9971
9997
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
@@ -9998,14 +10024,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
9998
10024
|
if (state.captureState !== 'requestingFlip') return;
|
|
9999
10025
|
var t = setTimeout(function () {
|
|
10000
10026
|
resetBestFrame();
|
|
10001
|
-
|
|
10027
|
+
dispatchIdCaptureAction({
|
|
10002
10028
|
type: 'flipRequestCompleted'
|
|
10003
10029
|
});
|
|
10004
10030
|
}, 6000);
|
|
10005
10031
|
return function () {
|
|
10006
10032
|
clearTimeout(t);
|
|
10007
10033
|
};
|
|
10008
|
-
}, [
|
|
10034
|
+
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
10009
10035
|
React.useEffect(function () {
|
|
10010
10036
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
10011
10037
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -10033,7 +10059,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10033
10059
|
return [4 /*yield*/, dataUrlToBase64(imageData)];
|
|
10034
10060
|
case 1:
|
|
10035
10061
|
base64ImageData = _a.sent();
|
|
10036
|
-
|
|
10062
|
+
dispatchIdCaptureAction({
|
|
10037
10063
|
type: 'documentCapturedManually',
|
|
10038
10064
|
payload: {
|
|
10039
10065
|
imageData: base64ImageData
|
|
@@ -10043,10 +10069,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10043
10069
|
}
|
|
10044
10070
|
});
|
|
10045
10071
|
});
|
|
10046
|
-
}, [
|
|
10047
|
-
var
|
|
10048
|
-
progressStarted =
|
|
10049
|
-
setProgressStarted =
|
|
10072
|
+
}, []);
|
|
10073
|
+
var _10 = React.useState(false),
|
|
10074
|
+
progressStarted = _10[0],
|
|
10075
|
+
setProgressStarted = _10[1];
|
|
10050
10076
|
React.useEffect(function () {
|
|
10051
10077
|
if (state.captureState === 'capturing') {
|
|
10052
10078
|
setProgressStarted(false);
|
|
@@ -10126,7 +10152,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
10126
10152
|
capturedDocuments: state.capturedDocuments,
|
|
10127
10153
|
classNames: classNames.success,
|
|
10128
10154
|
onSubmitClick: function onSubmitClick() {
|
|
10129
|
-
|
|
10155
|
+
return dispatchIdCaptureAction({
|
|
10130
10156
|
type: 'flipRequestCompleted'
|
|
10131
10157
|
});
|
|
10132
10158
|
},
|