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
|
@@ -4,9 +4,11 @@ export type AdditionalDocument = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
description?: string;
|
|
6
6
|
skip?: () => Promise<boolean>;
|
|
7
|
+
processAsPOA?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export type UploadedDocument = {
|
|
9
10
|
documentName: string;
|
|
11
|
+
processAsPOA: 'Y' | 'N';
|
|
10
12
|
additionalDocument: string | Record<string, string>;
|
|
11
13
|
};
|
|
12
14
|
export type AdditionalDocumentCaptureClassNames = {
|
|
@@ -32,6 +32,7 @@ export type IdCaptureVerbiage = {
|
|
|
32
32
|
captureFailedText?: CustomerSuppliedVerbiage;
|
|
33
33
|
guidanceSatisfiedText?: CustomerSuppliedVerbiage;
|
|
34
34
|
guidancePleaseFlipText?: CustomerSuppliedVerbiage;
|
|
35
|
+
guidanceBackDetectedFirstText?: CustomerSuppliedVerbiage;
|
|
35
36
|
guidanceTooBlurryText?: CustomerSuppliedVerbiage;
|
|
36
37
|
guidanceNotCenteredText?: CustomerSuppliedVerbiage;
|
|
37
38
|
guidanceTooCloseText?: CustomerSuppliedVerbiage;
|
|
@@ -36,8 +36,8 @@ export type IdCaptureModelsState = {
|
|
|
36
36
|
bestFrameDetails: BestFrameDetails | null;
|
|
37
37
|
getBestFrame: () => BestFrame | null;
|
|
38
38
|
resetBestFrame: () => void;
|
|
39
|
-
requiredDocumentType: DocumentType;
|
|
40
|
-
setRequiredDocumentType: (value: DocumentType) => void;
|
|
39
|
+
requiredDocumentType: DocumentType | DocumentType[];
|
|
40
|
+
setRequiredDocumentType: (value: DocumentType | DocumentType[]) => void;
|
|
41
41
|
};
|
|
42
42
|
export declare const IdCaptureModelsContext: React.Context<IdCaptureModelsState>;
|
|
43
43
|
export type IdCaptureModelsProviderProps = {
|
|
@@ -26,6 +26,7 @@ export type IdCaptureState = {
|
|
|
26
26
|
documentInBounds: boolean;
|
|
27
27
|
documentTooClose: boolean;
|
|
28
28
|
flipRequired: boolean;
|
|
29
|
+
backDetectedFirst: boolean;
|
|
29
30
|
idCardFrontDetectionScore: number;
|
|
30
31
|
idCardFrontDetectionThresholdMet: boolean;
|
|
31
32
|
idCardBackDetectionScore: number;
|
|
@@ -24,6 +24,8 @@ declare const _default: {
|
|
|
24
24
|
'Document is not centered': string;
|
|
25
25
|
'Document too close, please back up': string;
|
|
26
26
|
'Document out of focus \u2013 try improving the lighting': string;
|
|
27
|
+
'ID card front detected - please flip your ID card': string;
|
|
28
|
+
'ID card back detected - please flip your ID card': string;
|
|
27
29
|
'Document detected, hold still...': string;
|
|
28
30
|
'Capturing...': string;
|
|
29
31
|
'Capture failed!': string;
|
|
@@ -32,6 +32,8 @@ export declare const resources: {
|
|
|
32
32
|
'Document is not centered': string;
|
|
33
33
|
'Document too close, please back up': string;
|
|
34
34
|
'Document out of focus \u2013 try improving the lighting': string;
|
|
35
|
+
'ID card front detected - please flip your ID card': string;
|
|
36
|
+
'ID card back detected - please flip your ID card': string;
|
|
35
37
|
'Document detected, hold still...': string;
|
|
36
38
|
'Capturing...': string;
|
|
37
39
|
'Capture failed!': string;
|
|
@@ -49,7 +49,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
49
49
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
50
50
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
51
51
|
|
|
52
|
-
var webSdkVersion = '2.1.
|
|
52
|
+
var webSdkVersion = '2.1.2';
|
|
53
53
|
|
|
54
54
|
function getPlatform() {
|
|
55
55
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -3751,33 +3751,33 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3751
3751
|
onDocumentDetected(function (prediction) {
|
|
3752
3752
|
return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
3753
3753
|
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
3754
|
-
var _a, _b, _c, _d, _e;
|
|
3755
|
-
return tslib.__generator(this, function (
|
|
3754
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3755
|
+
return tslib.__generator(this, function (_g) {
|
|
3756
3756
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
3757
3757
|
stopDetectionAtStart = stopDetection.current;
|
|
3758
3758
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
3759
|
-
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
|
|
3759
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
|
|
3760
3760
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
|
|
3761
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (
|
|
3761
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
|
|
3762
3762
|
if (focusPrediction) {
|
|
3763
3763
|
focusScore = focusPrediction.score;
|
|
3764
3764
|
focusPredictionTime = focusPrediction.predictionTime;
|
|
3765
3765
|
}
|
|
3766
|
-
focusThresholdSet = (
|
|
3767
|
-
focusThreshold = (
|
|
3766
|
+
focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
|
|
3767
|
+
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;
|
|
3768
3768
|
focusThresholdMet = focusScore >= focusThreshold;
|
|
3769
3769
|
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
3770
3770
|
bestFocusScore.current = focusScore;
|
|
3771
3771
|
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
3772
3772
|
setBestFrameDetails({
|
|
3773
|
-
boundingBox: (
|
|
3773
|
+
boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
|
|
3774
3774
|
documentType: prediction.detectedDocumentType,
|
|
3775
3775
|
detectionScore: prediction.detectionScore,
|
|
3776
3776
|
focusScore: focusScore
|
|
3777
3777
|
});
|
|
3778
3778
|
}
|
|
3779
3779
|
}
|
|
3780
|
-
(
|
|
3780
|
+
(_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, tslib.__assign(tslib.__assign({}, prediction), {
|
|
3781
3781
|
focusScore: focusScore,
|
|
3782
3782
|
focusPredictionTime: focusPredictionTime,
|
|
3783
3783
|
focusThresholdMet: focusThresholdMet
|
|
@@ -3887,6 +3887,7 @@ var initialState$4 = {
|
|
|
3887
3887
|
documentInBounds: false,
|
|
3888
3888
|
documentTooClose: false,
|
|
3889
3889
|
flipRequired: false,
|
|
3890
|
+
backDetectedFirst: false,
|
|
3890
3891
|
idCardFrontDetectionScore: 0,
|
|
3891
3892
|
idCardFrontDetectionThresholdMet: false,
|
|
3892
3893
|
idCardBackDetectionScore: 0,
|
|
@@ -4003,7 +4004,8 @@ var reducer$4 = function reducer(state, action) {
|
|
|
4003
4004
|
}
|
|
4004
4005
|
}
|
|
4005
4006
|
var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
4006
|
-
var
|
|
4007
|
+
var backDetectedFirst = state.requestedDocumentType.includes('idCardFront') && detectedDocumentType === 'idCardBack';
|
|
4008
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet;
|
|
4007
4009
|
var goodFramesCount = state.goodFramesCount;
|
|
4008
4010
|
if (isGoodFrame) {
|
|
4009
4011
|
goodFramesCount += 1;
|
|
@@ -4029,6 +4031,7 @@ var reducer$4 = function reducer(state, action) {
|
|
|
4029
4031
|
documentInBounds: documentInBounds,
|
|
4030
4032
|
documentTooClose: documentTooClose,
|
|
4031
4033
|
flipRequired: flipRequired,
|
|
4034
|
+
backDetectedFirst: backDetectedFirst,
|
|
4032
4035
|
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4033
4036
|
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4034
4037
|
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
@@ -4418,6 +4421,8 @@ var esTranslation = {
|
|
|
4418
4421
|
'Document is not centered': 'Documento no centrado',
|
|
4419
4422
|
'Document too close, please back up': 'Documento muy cerca, favor de alejarse',
|
|
4420
4423
|
'Document out of focus – try improving the lighting': 'Documento no enfocado - hay que tratar de mejorar la iluminación',
|
|
4424
|
+
'ID card front detected - please flip your ID card': 'Anverso detectado, por favor voltea tu identificación',
|
|
4425
|
+
'ID card back detected - please flip your ID card': 'Reverso detectado, por favor voltea tu identificación',
|
|
4421
4426
|
'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
|
|
4422
4427
|
'Capturing...': 'Capturando...',
|
|
4423
4428
|
'Capture failed!': 'Falló la captura',
|
|
@@ -4682,6 +4687,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4682
4687
|
processingIdCardText: 'ID card front captured.',
|
|
4683
4688
|
guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
|
|
4684
4689
|
guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
|
|
4690
|
+
guidanceBackDetectedFirstText: 'ID card back detected - please flip your ID card',
|
|
4685
4691
|
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
4686
4692
|
guidanceNotCenteredText: 'Document is not centered',
|
|
4687
4693
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
@@ -4696,7 +4702,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4696
4702
|
});
|
|
4697
4703
|
var satisfied = state.isGoodFrame;
|
|
4698
4704
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
4699
|
-
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 : '');
|
|
4705
|
+
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 : '');
|
|
4700
4706
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
4701
4707
|
ref: ref,
|
|
4702
4708
|
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
@@ -7487,13 +7493,23 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7487
7493
|
};
|
|
7488
7494
|
}, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
7489
7495
|
React.useEffect(function () {
|
|
7496
|
+
if (state.requestedDocumentType === 'idCardFront') {
|
|
7497
|
+
if (captureRequirement === 'idCardOrPassport') {
|
|
7498
|
+
setRequiredDocumentType(['idCardFront', 'passport']);
|
|
7499
|
+
} else {
|
|
7500
|
+
setRequiredDocumentType('idCardFront');
|
|
7501
|
+
}
|
|
7502
|
+
}
|
|
7490
7503
|
if (state.requestedDocumentType === 'idCardBack') {
|
|
7491
7504
|
setRequiredDocumentType('idCardBack');
|
|
7492
7505
|
}
|
|
7506
|
+
if (state.requestedDocumentType === 'passport') {
|
|
7507
|
+
setRequiredDocumentType('passport');
|
|
7508
|
+
}
|
|
7493
7509
|
return function () {
|
|
7494
7510
|
setRequiredDocumentType('none');
|
|
7495
7511
|
};
|
|
7496
|
-
}, [setRequiredDocumentType, state.requestedDocumentType]);
|
|
7512
|
+
}, [captureRequirement, setRequiredDocumentType, state.requestedDocumentType]);
|
|
7497
7513
|
var handleCapture = React.useCallback(function (imageData) {
|
|
7498
7514
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
7499
7515
|
var base64ImageData;
|
|
@@ -9397,6 +9413,7 @@ var AdditionalDocumentCapture = function AdditionalDocumentCapture(_a) {
|
|
|
9397
9413
|
var fileContent = fileReader.result.toString();
|
|
9398
9414
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete({
|
|
9399
9415
|
documentName: document.name,
|
|
9416
|
+
processAsPOA: document.processAsPOA ? 'Y' : 'N',
|
|
9400
9417
|
additionalDocument: {
|
|
9401
9418
|
name: file.name,
|
|
9402
9419
|
fileContent: dataUrlToBase64Sync(fileContent),
|