idmission-web-sdk 2.1.0 → 2.1.2
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/lib/locales/es/translation.d.ts +2 -0
- package/dist/lib/locales/index.d.ts +2 -0
- package/dist/sdk2.cjs.development.js +29 -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 +29 -12
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +29 -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.2';
|
|
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,
|
|
@@ -4383,6 +4386,8 @@ var esTranslation = {
|
|
|
4383
4386
|
'Document is not centered': 'Documento no centrado',
|
|
4384
4387
|
'Document too close, please back up': 'Documento muy cerca, favor de alejarse',
|
|
4385
4388
|
'Document out of focus – try improving the lighting': 'Documento no enfocado - hay que tratar de mejorar la iluminación',
|
|
4389
|
+
'ID card front detected - please flip your ID card': 'Anverso detectado, por favor voltea tu identificación',
|
|
4390
|
+
'ID card back detected - please flip your ID card': 'Reverso detectado, por favor voltea tu identificación',
|
|
4386
4391
|
'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
|
|
4387
4392
|
'Capturing...': 'Capturando...',
|
|
4388
4393
|
'Capture failed!': 'Falló la captura',
|
|
@@ -4647,6 +4652,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4647
4652
|
processingIdCardText: 'ID card front captured.',
|
|
4648
4653
|
guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
|
|
4649
4654
|
guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
|
|
4655
|
+
guidanceBackDetectedFirstText: 'ID card back detected - please flip your ID card',
|
|
4650
4656
|
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
4651
4657
|
guidanceNotCenteredText: 'Document is not centered',
|
|
4652
4658
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
@@ -4661,7 +4667,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4661
4667
|
});
|
|
4662
4668
|
var satisfied = state.isGoodFrame;
|
|
4663
4669
|
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 : '');
|
|
4670
|
+
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
4671
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
4666
4672
|
ref: ref,
|
|
4667
4673
|
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
@@ -7452,13 +7458,23 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7452
7458
|
};
|
|
7453
7459
|
}, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
7454
7460
|
useEffect(function () {
|
|
7461
|
+
if (state.requestedDocumentType === 'idCardFront') {
|
|
7462
|
+
if (captureRequirement === 'idCardOrPassport') {
|
|
7463
|
+
setRequiredDocumentType(['idCardFront', 'passport']);
|
|
7464
|
+
} else {
|
|
7465
|
+
setRequiredDocumentType('idCardFront');
|
|
7466
|
+
}
|
|
7467
|
+
}
|
|
7455
7468
|
if (state.requestedDocumentType === 'idCardBack') {
|
|
7456
7469
|
setRequiredDocumentType('idCardBack');
|
|
7457
7470
|
}
|
|
7471
|
+
if (state.requestedDocumentType === 'passport') {
|
|
7472
|
+
setRequiredDocumentType('passport');
|
|
7473
|
+
}
|
|
7458
7474
|
return function () {
|
|
7459
7475
|
setRequiredDocumentType('none');
|
|
7460
7476
|
};
|
|
7461
|
-
}, [setRequiredDocumentType, state.requestedDocumentType]);
|
|
7477
|
+
}, [captureRequirement, setRequiredDocumentType, state.requestedDocumentType]);
|
|
7462
7478
|
var handleCapture = useCallback(function (imageData) {
|
|
7463
7479
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
7464
7480
|
var base64ImageData;
|
|
@@ -9362,6 +9378,7 @@ var AdditionalDocumentCapture = function AdditionalDocumentCapture(_a) {
|
|
|
9362
9378
|
var fileContent = fileReader.result.toString();
|
|
9363
9379
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete({
|
|
9364
9380
|
documentName: document.name,
|
|
9381
|
+
processAsPOA: document.processAsPOA ? 'Y' : 'N',
|
|
9365
9382
|
additionalDocument: {
|
|
9366
9383
|
name: file.name,
|
|
9367
9384
|
fileContent: dataUrlToBase64Sync(fileContent),
|