idmission-web-sdk 2.1.24 → 2.1.25
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/IdCaptureStateProvider.d.ts +5 -1
- package/dist/sdk2.cjs.development.js +34 -9
- 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 +34 -9
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +34 -9
- 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
|
@@ -27,6 +27,7 @@ export type IdCaptureState = {
|
|
|
27
27
|
documentTooClose: boolean;
|
|
28
28
|
flipRequired: boolean;
|
|
29
29
|
backDetectedFirst: boolean;
|
|
30
|
+
overrideFlipRequired: boolean;
|
|
30
31
|
idCardFrontDetectionScore: number;
|
|
31
32
|
idCardFrontDetectionThresholdMet: boolean;
|
|
32
33
|
idCardBackDetectionScore: number;
|
|
@@ -115,6 +116,8 @@ export type IdCaptureAction = {
|
|
|
115
116
|
};
|
|
116
117
|
} | {
|
|
117
118
|
type: 'flipRequestCompleted';
|
|
119
|
+
} | {
|
|
120
|
+
type: 'overrideFlipRequired';
|
|
118
121
|
} | {
|
|
119
122
|
type: 'resetWizard';
|
|
120
123
|
} | {
|
|
@@ -123,7 +126,8 @@ export type IdCaptureAction = {
|
|
|
123
126
|
export type IdCaptureDispatch = Dispatch<IdCaptureAction>;
|
|
124
127
|
export declare const IdCaptureStateContext: React.Context<IdCaptureState>;
|
|
125
128
|
export declare const IdCaptureDispatchContext: React.Context<IdCaptureDispatch>;
|
|
126
|
-
export declare const IdCaptureStateProvider: ({ children, }: {
|
|
129
|
+
export declare const IdCaptureStateProvider: ({ children, flipRequiredTimeout, }: {
|
|
127
130
|
children: ReactNode;
|
|
131
|
+
flipRequiredTimeout?: number;
|
|
128
132
|
}) => React.JSX.Element;
|
|
129
133
|
export declare const useIdCaptureState: () => [IdCaptureState, IdCaptureDispatch];
|
|
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
234
234
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
var webSdkVersion = '2.1.
|
|
237
|
+
var webSdkVersion = '2.1.25';
|
|
238
238
|
|
|
239
239
|
function getPlatform() {
|
|
240
240
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -6140,6 +6140,7 @@ var initialState$4 = {
|
|
|
6140
6140
|
documentTooClose: false,
|
|
6141
6141
|
flipRequired: false,
|
|
6142
6142
|
backDetectedFirst: false,
|
|
6143
|
+
overrideFlipRequired: false,
|
|
6143
6144
|
idCardFrontDetectionScore: 0,
|
|
6144
6145
|
idCardFrontDetectionThresholdMet: false,
|
|
6145
6146
|
idCardBackDetectionScore: 0,
|
|
@@ -6258,8 +6259,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6258
6259
|
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
6259
6260
|
}
|
|
6260
6261
|
}
|
|
6261
|
-
var flipRequired = !state.allowIdCardBackToFrontCapture && state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
6262
|
-
var backDetectedFirst = state.allowIdCardBackToFrontCapture ? 'idCardBack' in state.capturedDocuments && detectedDocumentType === 'idCardBack' : state.requestedDocumentType.includes('idCardFront') && detectedDocumentType === 'idCardBack';
|
|
6262
|
+
var flipRequired = !state.overrideFlipRequired && !state.allowIdCardBackToFrontCapture && state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
6263
|
+
var backDetectedFirst = !state.overrideFlipRequired && (state.allowIdCardBackToFrontCapture ? 'idCardBack' in state.capturedDocuments && detectedDocumentType === 'idCardBack' : state.requestedDocumentType.includes('idCardFront') && detectedDocumentType === 'idCardBack');
|
|
6263
6264
|
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet;
|
|
6264
6265
|
var goodFramesCount = state.goodFramesCount;
|
|
6265
6266
|
if (isGoodFrame) {
|
|
@@ -6402,22 +6403,30 @@ var _reducer = function reducer(state, action) {
|
|
|
6402
6403
|
}
|
|
6403
6404
|
case 'flipRequestCompleted':
|
|
6404
6405
|
return _assign(_assign({}, state), {
|
|
6405
|
-
captureState: 'capturing'
|
|
6406
|
+
captureState: 'capturing',
|
|
6407
|
+
overrideFlipRequired: false
|
|
6408
|
+
});
|
|
6409
|
+
case 'overrideFlipRequired':
|
|
6410
|
+
return _assign(_assign({}, state), {
|
|
6411
|
+
overrideFlipRequired: true
|
|
6406
6412
|
});
|
|
6407
6413
|
case 'resetWizard':
|
|
6408
6414
|
return _assign(_assign({}, initialState$4), {
|
|
6409
6415
|
captureRequirement: state.captureRequirement,
|
|
6410
|
-
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
6416
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
6417
|
+
overrideFlipRequired: false
|
|
6411
6418
|
});
|
|
6412
6419
|
default:
|
|
6413
6420
|
return state;
|
|
6414
6421
|
}
|
|
6415
6422
|
};
|
|
6416
6423
|
var IdCaptureStateProvider = function IdCaptureStateProvider(_a) {
|
|
6417
|
-
var children = _a.children
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6424
|
+
var children = _a.children,
|
|
6425
|
+
_b = _a.flipRequiredTimeout,
|
|
6426
|
+
flipRequiredTimeout = _b === void 0 ? 10000 : _b;
|
|
6427
|
+
var _c = React.useReducer(_reducer, initialState$4),
|
|
6428
|
+
state = _c[0],
|
|
6429
|
+
dispatch = _c[1];
|
|
6421
6430
|
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
6422
6431
|
dispatch({
|
|
6423
6432
|
type: 'redrawRequested'
|
|
@@ -6430,6 +6439,22 @@ var IdCaptureStateProvider = function IdCaptureStateProvider(_a) {
|
|
|
6430
6439
|
window.removeEventListener('resize', onResize);
|
|
6431
6440
|
};
|
|
6432
6441
|
}, [onResize]);
|
|
6442
|
+
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
6443
|
+
React.useEffect(function () {
|
|
6444
|
+
if (state.overrideFlipRequired) return;
|
|
6445
|
+
if (state.flipRequired || state.backDetectedFirst) {
|
|
6446
|
+
var t_1 = setTimeout(function () {
|
|
6447
|
+
dispatch({
|
|
6448
|
+
type: 'overrideFlipRequired'
|
|
6449
|
+
});
|
|
6450
|
+
setRequiredDocumentType('none');
|
|
6451
|
+
}, flipRequiredTimeout);
|
|
6452
|
+
return function () {
|
|
6453
|
+
clearTimeout(t_1);
|
|
6454
|
+
};
|
|
6455
|
+
}
|
|
6456
|
+
return function () {};
|
|
6457
|
+
}, [flipRequiredTimeout, setRequiredDocumentType, state.backDetectedFirst, state.flipRequired, state.overrideFlipRequired]);
|
|
6433
6458
|
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateContext.Provider, {
|
|
6434
6459
|
value: state
|
|
6435
6460
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureDispatchContext.Provider, {
|