idmission-web-sdk 2.1.73 → 2.1.74
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/IdCapture.d.ts +1 -0
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +1 -0
- package/dist/lib/locales/es/translation.d.ts +1 -0
- package/dist/lib/locales/index.d.ts +1 -0
- package/dist/lib/models/DocumentDetection.d.ts +5 -0
- package/dist/sdk2.cjs.development.js +87 -39
- 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 +87 -39
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +87 -39
- 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
|
@@ -34,6 +34,7 @@ export type IdCaptureVerbiage = {
|
|
|
34
34
|
guidanceTooBlurryText?: CustomerSuppliedVerbiage;
|
|
35
35
|
guidanceNotCenteredText?: CustomerSuppliedVerbiage;
|
|
36
36
|
guidanceTooCloseText?: CustomerSuppliedVerbiage;
|
|
37
|
+
guidanceNotStableText?: CustomerSuppliedVerbiage;
|
|
37
38
|
guidanceNotDetectedText?: CustomerSuppliedVerbiage;
|
|
38
39
|
guidanceIdCardNotAllowedText?: CustomerSuppliedVerbiage;
|
|
39
40
|
guidancePassportNotAllowedText?: CustomerSuppliedVerbiage;
|
|
@@ -23,6 +23,7 @@ declare const _default: {
|
|
|
23
23
|
'Document not detected': string;
|
|
24
24
|
'Document is not centered': string;
|
|
25
25
|
'Document too close, please back up': string;
|
|
26
|
+
'Please hold your ID document steady': string;
|
|
26
27
|
'Document out of focus \u2013 try improving the lighting': string;
|
|
27
28
|
'ID card front detected - please flip your ID card': string;
|
|
28
29
|
'ID card back detected - please flip your ID card': string;
|
|
@@ -31,6 +31,7 @@ export declare const resources: {
|
|
|
31
31
|
'Document not detected': string;
|
|
32
32
|
'Document is not centered': string;
|
|
33
33
|
'Document too close, please back up': string;
|
|
34
|
+
'Please hold your ID document steady': string;
|
|
34
35
|
'Document out of focus \u2013 try improving the lighting': string;
|
|
35
36
|
'ID card front detected - please flip your ID card': string;
|
|
36
37
|
'ID card back detected - please flip your ID card': string;
|
|
@@ -28,6 +28,7 @@ export type DocumentDetectionThresholds = {
|
|
|
28
28
|
idCardFront?: number;
|
|
29
29
|
idCardBack?: number;
|
|
30
30
|
passport?: number;
|
|
31
|
+
stability?: number;
|
|
31
32
|
};
|
|
32
33
|
export declare function loadDocumentDetector(modelAssetPath?: string, scoreThreshold?: number): Promise<ObjectDetector>;
|
|
33
34
|
export declare function useLoadDocumentDetector({ modelPath, modelLoadTimeoutMs, scoreThreshold, onModelError, }: {
|
|
@@ -57,6 +58,7 @@ export type DocumentDetectionPrediction = {
|
|
|
57
58
|
bestDocument: DetectedObject | undefined;
|
|
58
59
|
documentInBounds: boolean;
|
|
59
60
|
documentTooClose: boolean;
|
|
61
|
+
documentIsStable: boolean;
|
|
60
62
|
frameWidth: number;
|
|
61
63
|
frameHeight: number;
|
|
62
64
|
allZero: boolean;
|
|
@@ -68,6 +70,9 @@ export type ObjectDetectorPrediction = ObjectDetectorResult & {
|
|
|
68
70
|
frameHeight: number;
|
|
69
71
|
};
|
|
70
72
|
export declare function makeDocumentDetectorPrediction(detector: ObjectDetector, frame: HTMLCanvasElement): Promise<ObjectDetectorPrediction | null>;
|
|
73
|
+
export declare let lastDetectionAt: number;
|
|
74
|
+
export declare let lastDetectionTime: number;
|
|
75
|
+
export declare function setLastDetectionAt(time: number): void;
|
|
71
76
|
export type DocumentDetectionBoundaries = {
|
|
72
77
|
top: number;
|
|
73
78
|
bottom: number;
|
|
@@ -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.74';
|
|
238
238
|
|
|
239
239
|
function getPlatform() {
|
|
240
240
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -5439,7 +5439,8 @@ var defaultDocumentDetectionModelLoadTimeoutMs = 45000;
|
|
|
5439
5439
|
var defaultDocumentDetectionThresholds = {
|
|
5440
5440
|
idCardFront: 0.6,
|
|
5441
5441
|
idCardBack: 0.6,
|
|
5442
|
-
passport: 0.4
|
|
5442
|
+
passport: 0.4,
|
|
5443
|
+
stability: 0.9
|
|
5443
5444
|
};
|
|
5444
5445
|
var documentTypeDisplayNames = {
|
|
5445
5446
|
idCardFront: 'ID card front',
|
|
@@ -5581,6 +5582,13 @@ function makeDocumentDetectorPrediction(detector, frame) {
|
|
|
5581
5582
|
});
|
|
5582
5583
|
});
|
|
5583
5584
|
}
|
|
5585
|
+
var lastNBoxes = [];
|
|
5586
|
+
var lastDetectionAt = 0;
|
|
5587
|
+
var lastDetectionTime = 0;
|
|
5588
|
+
function setLastDetectionAt(time) {
|
|
5589
|
+
lastDetectionTime = time - lastDetectionAt;
|
|
5590
|
+
lastDetectionAt = time;
|
|
5591
|
+
}
|
|
5584
5592
|
var defaultDocumentDetectionBoundaries = {
|
|
5585
5593
|
top: 20,
|
|
5586
5594
|
bottom: 20,
|
|
@@ -5588,7 +5596,7 @@ var defaultDocumentDetectionBoundaries = {
|
|
|
5588
5596
|
right: 20
|
|
5589
5597
|
};
|
|
5590
5598
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
5591
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5599
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5592
5600
|
if (boundaries === void 0) {
|
|
5593
5601
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
5594
5602
|
}
|
|
@@ -5644,11 +5652,11 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5644
5652
|
var boundaryLeft = (_j = boundaries.left) !== null && _j !== void 0 ? _j : 20;
|
|
5645
5653
|
var boundaryRight = (_k = boundaries.right) !== null && _k !== void 0 ? _k : 20;
|
|
5646
5654
|
var boundaryBottom = (_l = boundaries.bottom) !== null && _l !== void 0 ? _l : 20;
|
|
5647
|
-
var
|
|
5648
|
-
xMin =
|
|
5649
|
-
yMin =
|
|
5650
|
-
width =
|
|
5651
|
-
height =
|
|
5655
|
+
var _o = bestDocument.box,
|
|
5656
|
+
xMin = _o.xMin,
|
|
5657
|
+
yMin = _o.yMin,
|
|
5658
|
+
width = _o.width,
|
|
5659
|
+
height = _o.height;
|
|
5652
5660
|
documentInBounds = yMin > boundaryTop &&
|
|
5653
5661
|
// Is it valid top edge of ID detected?
|
|
5654
5662
|
yMin + height + boundaryBottom < frameHeight && (
|
|
@@ -5657,12 +5665,23 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5657
5665
|
// If either the left side visible or if not, right edge of ID should be more than 80% of width.
|
|
5658
5666
|
xMin + width + boundaryRight < frameWidth; // Valid right edge if it's less than video width.
|
|
5659
5667
|
}
|
|
5668
|
+
var documentIsStable = false;
|
|
5660
5669
|
var documentTooClose = false;
|
|
5661
5670
|
if (bestDocument) {
|
|
5662
|
-
var
|
|
5663
|
-
docWidth =
|
|
5664
|
-
docHeight =
|
|
5671
|
+
var _p = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
5672
|
+
docWidth = _p[0],
|
|
5673
|
+
docHeight = _p[1];
|
|
5665
5674
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
5675
|
+
if (detectionThresholdMet) {
|
|
5676
|
+
var threshold_1 = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
|
|
5677
|
+
var framesNeeded = Math.ceil(Math.min(1000 / lastDetectionTime, 12));
|
|
5678
|
+
lastNBoxes = __spreadArray([bestDocument.box], lastNBoxes, true).slice(0, framesNeeded);
|
|
5679
|
+
documentIsStable = lastNBoxes.length >= framesNeeded && !createPairs(lastNBoxes).some(function (_a) {
|
|
5680
|
+
var a = _a[0],
|
|
5681
|
+
b = _a[1];
|
|
5682
|
+
return calculateIoU(a, b) < threshold_1;
|
|
5683
|
+
});
|
|
5684
|
+
}
|
|
5666
5685
|
}
|
|
5667
5686
|
return {
|
|
5668
5687
|
detectedObjects: detectedObjects,
|
|
@@ -5679,6 +5698,7 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5679
5698
|
bestDocument: bestDocument,
|
|
5680
5699
|
documentInBounds: documentInBounds,
|
|
5681
5700
|
documentTooClose: documentTooClose,
|
|
5701
|
+
documentIsStable: documentIsStable,
|
|
5682
5702
|
frameWidth: frameWidth,
|
|
5683
5703
|
frameHeight: frameHeight,
|
|
5684
5704
|
allZero: allZero
|
|
@@ -5698,6 +5718,27 @@ function applyNonMaxSuppression(detectedObjects) {
|
|
|
5698
5718
|
return !!obj;
|
|
5699
5719
|
});
|
|
5700
5720
|
}
|
|
5721
|
+
function createPairs(arr) {
|
|
5722
|
+
var pairs = [];
|
|
5723
|
+
for (var i = 0; i < arr.length - 1; i++) {
|
|
5724
|
+
pairs.push([arr[i], arr[i + 1]]);
|
|
5725
|
+
}
|
|
5726
|
+
return pairs;
|
|
5727
|
+
}
|
|
5728
|
+
function calculateIoU(boxA, boxB) {
|
|
5729
|
+
var xA = Math.max(boxA.xMin, boxB.xMin);
|
|
5730
|
+
var yA = Math.max(boxA.yMin, boxB.yMin);
|
|
5731
|
+
var xB = Math.min(boxA.xMax, boxB.xMax);
|
|
5732
|
+
var yB = Math.min(boxA.yMax, boxB.yMax);
|
|
5733
|
+
var intersectWidth = Math.max(0, xB - xA);
|
|
5734
|
+
var intersectHeight = Math.max(0, yB - yA);
|
|
5735
|
+
var intersectionArea = intersectWidth * intersectHeight;
|
|
5736
|
+
var boxAArea = (boxA.xMax - boxA.xMin) * (boxA.yMax - boxA.yMin);
|
|
5737
|
+
var boxBArea = (boxB.xMax - boxB.xMin) * (boxB.yMax - boxB.yMin);
|
|
5738
|
+
var unionArea = boxAArea + boxBArea - intersectionArea;
|
|
5739
|
+
if (unionArea === 0) return 0;
|
|
5740
|
+
return intersectionArea / unionArea;
|
|
5741
|
+
}
|
|
5701
5742
|
|
|
5702
5743
|
function useFrameLoop(fn, _a) {
|
|
5703
5744
|
var _b = _a.throttleMs,
|
|
@@ -5715,16 +5756,20 @@ function useFrameLoop(fn, _a) {
|
|
|
5715
5756
|
var currentLoopId = loopId.current;
|
|
5716
5757
|
function renderPrediction() {
|
|
5717
5758
|
return __awaiter(this, void 0, void 0, function () {
|
|
5759
|
+
var start, took, amountToThrottle;
|
|
5718
5760
|
return __generator(this, function (_a) {
|
|
5719
5761
|
switch (_a.label) {
|
|
5720
5762
|
case 0:
|
|
5721
5763
|
if (currentLoopId !== loopId.current) return [2 /*return*/];
|
|
5764
|
+
start = new Date().getTime();
|
|
5722
5765
|
return [4 /*yield*/, fn(frameId.current)];
|
|
5723
5766
|
case 1:
|
|
5724
5767
|
_a.sent();
|
|
5768
|
+
took = new Date().getTime() - start;
|
|
5769
|
+
amountToThrottle = Math.max((throttleMs !== null && throttleMs !== void 0 ? throttleMs : 0) - took, 0);
|
|
5725
5770
|
timer = setTimeout(function () {
|
|
5726
5771
|
frameId.current = requestAnimationFrame(renderPrediction);
|
|
5727
|
-
},
|
|
5772
|
+
}, amountToThrottle);
|
|
5728
5773
|
return [2 /*return*/];
|
|
5729
5774
|
}
|
|
5730
5775
|
});
|
|
@@ -5790,29 +5835,27 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5790
5835
|
var _b = _a.autoStart,
|
|
5791
5836
|
autoStart = _b === void 0 ? true : _b,
|
|
5792
5837
|
children = _a.children,
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5838
|
+
_c = _a.throttleMs,
|
|
5839
|
+
throttleMs = _c === void 0 ? 16 : _c,
|
|
5840
|
+
_d = _a.documentDetectionModelPath,
|
|
5841
|
+
documentDetectionModelPath = _d === void 0 ? defaultDocumentDetectorModelPath : _d,
|
|
5842
|
+
_e = _a.documentDetectionModelScoreThreshold,
|
|
5843
|
+
documentDetectionModelScoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
|
|
5844
|
+
_f = _a.documentDetectionModelLoadTimeoutMs,
|
|
5845
|
+
documentDetectionModelLoadTimeoutMs = _f === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _f,
|
|
5800
5846
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
|
|
5801
|
-
var
|
|
5802
|
-
videoRef =
|
|
5803
|
-
videoLoaded =
|
|
5804
|
-
cameraReady =
|
|
5847
|
+
var _g = React.useContext(CameraStateContext),
|
|
5848
|
+
videoRef = _g.videoRef,
|
|
5849
|
+
videoLoaded = _g.videoLoaded,
|
|
5850
|
+
cameraReady = _g.cameraReady;
|
|
5805
5851
|
var lastPredictionCanvas = React.useRef(null);
|
|
5806
5852
|
var onPredictionHandler = React.useRef();
|
|
5807
|
-
var
|
|
5808
|
-
documentDetectionThresholds =
|
|
5809
|
-
setDocumentDetectionThresholds =
|
|
5810
|
-
var
|
|
5811
|
-
documentDetectionBoundaries =
|
|
5812
|
-
setDocumentDetectionBoundaries =
|
|
5813
|
-
var _j = React.useState(0),
|
|
5814
|
-
detectionTime = _j[0],
|
|
5815
|
-
setDetectionTime = _j[1];
|
|
5853
|
+
var _h = React.useState({}),
|
|
5854
|
+
documentDetectionThresholds = _h[0],
|
|
5855
|
+
setDocumentDetectionThresholds = _h[1];
|
|
5856
|
+
var _j = React.useState(defaultDocumentDetectionBoundaries),
|
|
5857
|
+
documentDetectionBoundaries = _j[0],
|
|
5858
|
+
setDocumentDetectionBoundaries = _j[1];
|
|
5816
5859
|
var _k = React.useState(0),
|
|
5817
5860
|
timesAllZero = _k[0],
|
|
5818
5861
|
setTimesAllZero = _k[1];
|
|
@@ -5854,7 +5897,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5854
5897
|
if (!prediction) return [3 /*break*/, 3];
|
|
5855
5898
|
processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
|
|
5856
5899
|
processedPrediction.frameId = frameId;
|
|
5857
|
-
|
|
5900
|
+
setLastDetectionAt(new Date().getTime());
|
|
5858
5901
|
debug(processedPrediction);
|
|
5859
5902
|
if (processedPrediction.allZero) setTimesAllZero(function (n) {
|
|
5860
5903
|
return n + 1;
|
|
@@ -5897,7 +5940,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5897
5940
|
documentDetectionModelError: modelError,
|
|
5898
5941
|
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
5899
5942
|
onDocumentDetected: onDocumentDetected,
|
|
5900
|
-
detectionTime:
|
|
5943
|
+
detectionTime: lastDetectionTime,
|
|
5901
5944
|
documentDetectionThresholds: documentDetectionThresholds,
|
|
5902
5945
|
setDocumentDetectionThresholds: setDocumentDetectionThresholds,
|
|
5903
5946
|
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
@@ -5905,7 +5948,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5905
5948
|
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
5906
5949
|
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
5907
5950
|
};
|
|
5908
|
-
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected,
|
|
5951
|
+
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
5909
5952
|
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
5910
5953
|
value: value
|
|
5911
5954
|
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
@@ -6243,6 +6286,7 @@ var initialState$4 = {
|
|
|
6243
6286
|
detectionThresholdMet: false,
|
|
6244
6287
|
documentInBounds: false,
|
|
6245
6288
|
documentTooClose: false,
|
|
6289
|
+
documentIsStable: false,
|
|
6246
6290
|
flipRequired: false,
|
|
6247
6291
|
backDetectedFirst: false,
|
|
6248
6292
|
idCardDetectedButNotAllowed: false,
|
|
@@ -6361,6 +6405,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6361
6405
|
bestDocument = _d.bestDocument,
|
|
6362
6406
|
documentInBounds = _d.documentInBounds,
|
|
6363
6407
|
documentTooClose = _d.documentTooClose,
|
|
6408
|
+
documentIsStable = _d.documentIsStable,
|
|
6364
6409
|
focusScore = _d.focusScore,
|
|
6365
6410
|
focusThresholdMet = _d.focusThresholdMet,
|
|
6366
6411
|
frameWidth = _d.frameWidth,
|
|
@@ -6382,7 +6427,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6382
6427
|
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
6383
6428
|
wrongDocumentTypePredictions += 1;
|
|
6384
6429
|
}
|
|
6385
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet;
|
|
6430
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && documentIsStable;
|
|
6386
6431
|
var goodFramesCount = state.goodFramesCount;
|
|
6387
6432
|
if (isGoodFrame) {
|
|
6388
6433
|
goodFramesCount += 1;
|
|
@@ -6417,6 +6462,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6417
6462
|
detectionThresholdMet: detectionThresholdMet,
|
|
6418
6463
|
documentInBounds: documentInBounds,
|
|
6419
6464
|
documentTooClose: documentTooClose,
|
|
6465
|
+
documentIsStable: documentIsStable,
|
|
6420
6466
|
flipRequired: flipRequired,
|
|
6421
6467
|
backDetectedFirst: backDetectedFirst,
|
|
6422
6468
|
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
@@ -6836,6 +6882,7 @@ var esTranslation = {
|
|
|
6836
6882
|
'Document not detected': 'No se ha detectado el documento',
|
|
6837
6883
|
'Document is not centered': 'Documento no centrado',
|
|
6838
6884
|
'Document too close, please back up': 'Documento muy cerca, favor de alejarse',
|
|
6885
|
+
'Please hold your ID document steady': 'Por favor, mantenga firme su documento de identidad',
|
|
6839
6886
|
'Document out of focus – try improving the lighting': 'Documento no enfocado - hay que tratar de mejorar la iluminación',
|
|
6840
6887
|
'ID card front detected - please flip your ID card': 'Anverso de ID detectado, por favor voltea tu identificación',
|
|
6841
6888
|
'ID card back detected - please flip your ID card': 'Reverso de ID detectado, por favor voltea tu identificación',
|
|
@@ -7157,7 +7204,8 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7157
7204
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
7158
7205
|
guidanceNotDetectedText: 'Document not detected',
|
|
7159
7206
|
guidanceIdCardNotAllowedText: 'ID card detected, please scan a passport instead',
|
|
7160
|
-
guidancePassportNotAllowedText: 'Passport detected, please scan an ID card instead'
|
|
7207
|
+
guidancePassportNotAllowedText: 'Passport detected, please scan an ID card instead',
|
|
7208
|
+
guidanceNotStableText: 'Please hold your ID document steady'
|
|
7161
7209
|
});
|
|
7162
7210
|
var debugScalingDetails = useDebugScalingDetails({
|
|
7163
7211
|
enabled: debugMode,
|
|
@@ -7168,7 +7216,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7168
7216
|
});
|
|
7169
7217
|
var satisfied = state.isGoodFrame;
|
|
7170
7218
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
7171
|
-
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.backDetectedFirst ? verbiage.guidanceBackDetectedFirstText : state.flipRequired ? verbiage.guidancePleaseFlipText : state.idCardDetectedButNotAllowed ? verbiage.guidanceIdCardNotAllowedText : state.passportDetectedButNotAllowed ? verbiage.guidancePassportNotAllowedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
|
|
7219
|
+
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.backDetectedFirst ? verbiage.guidanceBackDetectedFirstText : state.flipRequired ? verbiage.guidancePleaseFlipText : state.idCardDetectedButNotAllowed ? verbiage.guidanceIdCardNotAllowedText : state.passportDetectedButNotAllowed ? verbiage.guidancePassportNotAllowedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : !state.documentIsStable ? verbiage.guidanceNotStableText : '');
|
|
7172
7220
|
return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
|
|
7173
7221
|
ref: ref,
|
|
7174
7222
|
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
@@ -7193,7 +7241,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7193
7241
|
scaling: debugScalingDetails,
|
|
7194
7242
|
flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
|
|
7195
7243
|
});
|
|
7196
|
-
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
|
|
7244
|
+
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
|
|
7197
7245
|
};
|
|
7198
7246
|
var timeSince = function timeSince(t) {
|
|
7199
7247
|
if (!t) return 0;
|