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
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
return cooked;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
var webSdkVersion = '2.1.
|
|
143
|
+
var webSdkVersion = '2.1.1';
|
|
144
144
|
|
|
145
145
|
function getPlatform() {
|
|
146
146
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -4302,33 +4302,33 @@
|
|
|
4302
4302
|
onDocumentDetected(function (prediction) {
|
|
4303
4303
|
return __awaiter(_this, void 0, void 0, function () {
|
|
4304
4304
|
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4305
|
-
var _a, _b, _c, _d, _e;
|
|
4306
|
-
return __generator(this, function (
|
|
4305
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4306
|
+
return __generator(this, function (_g) {
|
|
4307
4307
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
4308
4308
|
stopDetectionAtStart = stopDetection.current;
|
|
4309
4309
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
4310
|
-
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
|
|
4310
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
|
|
4311
4311
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
|
|
4312
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (
|
|
4312
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
|
|
4313
4313
|
if (focusPrediction) {
|
|
4314
4314
|
focusScore = focusPrediction.score;
|
|
4315
4315
|
focusPredictionTime = focusPrediction.predictionTime;
|
|
4316
4316
|
}
|
|
4317
|
-
focusThresholdSet = (
|
|
4318
|
-
focusThreshold = (
|
|
4317
|
+
focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
|
|
4318
|
+
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;
|
|
4319
4319
|
focusThresholdMet = focusScore >= focusThreshold;
|
|
4320
4320
|
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
4321
4321
|
bestFocusScore.current = focusScore;
|
|
4322
4322
|
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
4323
4323
|
setBestFrameDetails({
|
|
4324
|
-
boundingBox: (
|
|
4324
|
+
boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
|
|
4325
4325
|
documentType: prediction.detectedDocumentType,
|
|
4326
4326
|
detectionScore: prediction.detectionScore,
|
|
4327
4327
|
focusScore: focusScore
|
|
4328
4328
|
});
|
|
4329
4329
|
}
|
|
4330
4330
|
}
|
|
4331
|
-
(
|
|
4331
|
+
(_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, __assign$1(__assign$1({}, prediction), {
|
|
4332
4332
|
focusScore: focusScore,
|
|
4333
4333
|
focusPredictionTime: focusPredictionTime,
|
|
4334
4334
|
focusThresholdMet: focusThresholdMet
|
|
@@ -4440,6 +4440,7 @@
|
|
|
4440
4440
|
documentInBounds: false,
|
|
4441
4441
|
documentTooClose: false,
|
|
4442
4442
|
flipRequired: false,
|
|
4443
|
+
backDetectedFirst: false,
|
|
4443
4444
|
idCardFrontDetectionScore: 0,
|
|
4444
4445
|
idCardFrontDetectionThresholdMet: false,
|
|
4445
4446
|
idCardBackDetectionScore: 0,
|
|
@@ -4556,7 +4557,8 @@
|
|
|
4556
4557
|
}
|
|
4557
4558
|
}
|
|
4558
4559
|
var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
4559
|
-
var
|
|
4560
|
+
var backDetectedFirst = state.requestedDocumentType.includes('idCardFront') && detectedDocumentType === 'idCardBack';
|
|
4561
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet;
|
|
4560
4562
|
var goodFramesCount = state.goodFramesCount;
|
|
4561
4563
|
if (isGoodFrame) {
|
|
4562
4564
|
goodFramesCount += 1;
|
|
@@ -4582,6 +4584,7 @@
|
|
|
4582
4584
|
documentInBounds: documentInBounds,
|
|
4583
4585
|
documentTooClose: documentTooClose,
|
|
4584
4586
|
flipRequired: flipRequired,
|
|
4587
|
+
backDetectedFirst: backDetectedFirst,
|
|
4585
4588
|
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4586
4589
|
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4587
4590
|
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
@@ -7920,6 +7923,7 @@
|
|
|
7920
7923
|
processingIdCardText: 'ID card front captured.',
|
|
7921
7924
|
guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
|
|
7922
7925
|
guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
|
|
7926
|
+
guidanceBackDetectedFirstText: 'ID card back detected - please flip your ID card',
|
|
7923
7927
|
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
7924
7928
|
guidanceNotCenteredText: 'Document is not centered',
|
|
7925
7929
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
@@ -7934,7 +7938,7 @@
|
|
|
7934
7938
|
});
|
|
7935
7939
|
var satisfied = state.isGoodFrame;
|
|
7936
7940
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
7937
|
-
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 : '');
|
|
7941
|
+
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 : '');
|
|
7938
7942
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
7939
7943
|
ref: ref,
|
|
7940
7944
|
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
@@ -10725,13 +10729,23 @@
|
|
|
10725
10729
|
};
|
|
10726
10730
|
}, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
10727
10731
|
React.useEffect(function () {
|
|
10732
|
+
if (state.requestedDocumentType === 'idCardFront') {
|
|
10733
|
+
if (captureRequirement === 'idCardOrPassport') {
|
|
10734
|
+
setRequiredDocumentType(['idCardFront', 'passport']);
|
|
10735
|
+
} else {
|
|
10736
|
+
setRequiredDocumentType('idCardFront');
|
|
10737
|
+
}
|
|
10738
|
+
}
|
|
10728
10739
|
if (state.requestedDocumentType === 'idCardBack') {
|
|
10729
10740
|
setRequiredDocumentType('idCardBack');
|
|
10730
10741
|
}
|
|
10742
|
+
if (state.requestedDocumentType === 'passport') {
|
|
10743
|
+
setRequiredDocumentType('passport');
|
|
10744
|
+
}
|
|
10731
10745
|
return function () {
|
|
10732
10746
|
setRequiredDocumentType('none');
|
|
10733
10747
|
};
|
|
10734
|
-
}, [setRequiredDocumentType, state.requestedDocumentType]);
|
|
10748
|
+
}, [captureRequirement, setRequiredDocumentType, state.requestedDocumentType]);
|
|
10735
10749
|
var handleCapture = React.useCallback(function (imageData) {
|
|
10736
10750
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
10737
10751
|
var base64ImageData;
|
|
@@ -12635,6 +12649,7 @@
|
|
|
12635
12649
|
var fileContent = fileReader.result.toString();
|
|
12636
12650
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete({
|
|
12637
12651
|
documentName: document.name,
|
|
12652
|
+
processAsPOA: document.processAsPOA ? 'Y' : 'N',
|
|
12638
12653
|
additionalDocument: {
|
|
12639
12654
|
name: file.name,
|
|
12640
12655
|
fileContent: dataUrlToBase64Sync(fileContent),
|