idmission-web-sdk 2.1.0 → 2.1.1
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/additional_document_capture/AdditionalDocumentCapture.d.ts +2 -0
- package/dist/components/document_capture/DocumentCaptureStateProvider.d.ts +1 -0
- package/dist/components/id_capture/IdCapture.d.ts +1 -0
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +2 -2
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +1 -0
- package/dist/sdk2.cjs.development.js +27 -12
- 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 +27 -12
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +27 -12
- 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
package/dist/sdk2.esm.js
CHANGED
|
@@ -14,7 +14,7 @@ import LanguageDetector from 'i18next-browser-languagedetector';
|
|
|
14
14
|
import i18n from 'i18next';
|
|
15
15
|
import SignatureCanvas from 'react-signature-canvas';
|
|
16
16
|
|
|
17
|
-
var webSdkVersion = '2.1.
|
|
17
|
+
var webSdkVersion = '2.1.1';
|
|
18
18
|
|
|
19
19
|
function getPlatform() {
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -3716,33 +3716,33 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3716
3716
|
onDocumentDetected(function (prediction) {
|
|
3717
3717
|
return __awaiter(_this, void 0, void 0, function () {
|
|
3718
3718
|
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
3719
|
-
var _a, _b, _c, _d, _e;
|
|
3720
|
-
return __generator(this, function (
|
|
3719
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3720
|
+
return __generator(this, function (_g) {
|
|
3721
3721
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
3722
3722
|
stopDetectionAtStart = stopDetection.current;
|
|
3723
3723
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
3724
|
-
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
|
|
3724
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
|
|
3725
3725
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
|
|
3726
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (
|
|
3726
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
|
|
3727
3727
|
if (focusPrediction) {
|
|
3728
3728
|
focusScore = focusPrediction.score;
|
|
3729
3729
|
focusPredictionTime = focusPrediction.predictionTime;
|
|
3730
3730
|
}
|
|
3731
|
-
focusThresholdSet = (
|
|
3732
|
-
focusThreshold = (
|
|
3731
|
+
focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
|
|
3732
|
+
focusThreshold = (_d = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _d !== void 0 ? _d : 0;
|
|
3733
3733
|
focusThresholdMet = focusScore >= focusThreshold;
|
|
3734
3734
|
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
3735
3735
|
bestFocusScore.current = focusScore;
|
|
3736
3736
|
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
3737
3737
|
setBestFrameDetails({
|
|
3738
|
-
boundingBox: (
|
|
3738
|
+
boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
|
|
3739
3739
|
documentType: prediction.detectedDocumentType,
|
|
3740
3740
|
detectionScore: prediction.detectionScore,
|
|
3741
3741
|
focusScore: focusScore
|
|
3742
3742
|
});
|
|
3743
3743
|
}
|
|
3744
3744
|
}
|
|
3745
|
-
(
|
|
3745
|
+
(_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, __assign(__assign({}, prediction), {
|
|
3746
3746
|
focusScore: focusScore,
|
|
3747
3747
|
focusPredictionTime: focusPredictionTime,
|
|
3748
3748
|
focusThresholdMet: focusThresholdMet
|
|
@@ -3852,6 +3852,7 @@ var initialState$4 = {
|
|
|
3852
3852
|
documentInBounds: false,
|
|
3853
3853
|
documentTooClose: false,
|
|
3854
3854
|
flipRequired: false,
|
|
3855
|
+
backDetectedFirst: false,
|
|
3855
3856
|
idCardFrontDetectionScore: 0,
|
|
3856
3857
|
idCardFrontDetectionThresholdMet: false,
|
|
3857
3858
|
idCardBackDetectionScore: 0,
|
|
@@ -3968,7 +3969,8 @@ var reducer$4 = function reducer(state, action) {
|
|
|
3968
3969
|
}
|
|
3969
3970
|
}
|
|
3970
3971
|
var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
3971
|
-
var
|
|
3972
|
+
var backDetectedFirst = state.requestedDocumentType.includes('idCardFront') && detectedDocumentType === 'idCardBack';
|
|
3973
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet;
|
|
3972
3974
|
var goodFramesCount = state.goodFramesCount;
|
|
3973
3975
|
if (isGoodFrame) {
|
|
3974
3976
|
goodFramesCount += 1;
|
|
@@ -3994,6 +3996,7 @@ var reducer$4 = function reducer(state, action) {
|
|
|
3994
3996
|
documentInBounds: documentInBounds,
|
|
3995
3997
|
documentTooClose: documentTooClose,
|
|
3996
3998
|
flipRequired: flipRequired,
|
|
3999
|
+
backDetectedFirst: backDetectedFirst,
|
|
3997
4000
|
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
3998
4001
|
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
3999
4002
|
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
@@ -4647,6 +4650,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4647
4650
|
processingIdCardText: 'ID card front captured.',
|
|
4648
4651
|
guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
|
|
4649
4652
|
guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
|
|
4653
|
+
guidanceBackDetectedFirstText: 'ID card back detected - please flip your ID card',
|
|
4650
4654
|
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
4651
4655
|
guidanceNotCenteredText: 'Document is not centered',
|
|
4652
4656
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
@@ -4661,7 +4665,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4661
4665
|
});
|
|
4662
4666
|
var satisfied = state.isGoodFrame;
|
|
4663
4667
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
4664
|
-
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.flipRequired ? verbiage.guidancePleaseFlipText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
|
|
4668
|
+
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.backDetectedFirst ? verbiage.guidanceBackDetectedFirstText : state.flipRequired ? verbiage.guidancePleaseFlipText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
|
|
4665
4669
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
4666
4670
|
ref: ref,
|
|
4667
4671
|
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
@@ -7452,13 +7456,23 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7452
7456
|
};
|
|
7453
7457
|
}, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
7454
7458
|
useEffect(function () {
|
|
7459
|
+
if (state.requestedDocumentType === 'idCardFront') {
|
|
7460
|
+
if (captureRequirement === 'idCardOrPassport') {
|
|
7461
|
+
setRequiredDocumentType(['idCardFront', 'passport']);
|
|
7462
|
+
} else {
|
|
7463
|
+
setRequiredDocumentType('idCardFront');
|
|
7464
|
+
}
|
|
7465
|
+
}
|
|
7455
7466
|
if (state.requestedDocumentType === 'idCardBack') {
|
|
7456
7467
|
setRequiredDocumentType('idCardBack');
|
|
7457
7468
|
}
|
|
7469
|
+
if (state.requestedDocumentType === 'passport') {
|
|
7470
|
+
setRequiredDocumentType('passport');
|
|
7471
|
+
}
|
|
7458
7472
|
return function () {
|
|
7459
7473
|
setRequiredDocumentType('none');
|
|
7460
7474
|
};
|
|
7461
|
-
}, [setRequiredDocumentType, state.requestedDocumentType]);
|
|
7475
|
+
}, [captureRequirement, setRequiredDocumentType, state.requestedDocumentType]);
|
|
7462
7476
|
var handleCapture = useCallback(function (imageData) {
|
|
7463
7477
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
7464
7478
|
var base64ImageData;
|
|
@@ -9362,6 +9376,7 @@ var AdditionalDocumentCapture = function AdditionalDocumentCapture(_a) {
|
|
|
9362
9376
|
var fileContent = fileReader.result.toString();
|
|
9363
9377
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete({
|
|
9364
9378
|
documentName: document.name,
|
|
9379
|
+
processAsPOA: document.processAsPOA ? 'Y' : 'N',
|
|
9365
9380
|
additionalDocument: {
|
|
9366
9381
|
name: file.name,
|
|
9367
9382
|
fileContent: dataUrlToBase64Sync(fileContent),
|