idmission-web-sdk 1.0.171 → 1.0.172

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.
@@ -34,6 +34,7 @@ export type IdCaptureVerbiage = {
34
34
  guidanceSatisfiedText?: CustomerSuppliedVerbiage;
35
35
  guidanceTooBlurryText?: CustomerSuppliedVerbiage;
36
36
  guidanceNotCenteredText?: CustomerSuppliedVerbiage;
37
+ guidanceTooCloseText?: CustomerSuppliedVerbiage;
37
38
  guidanceNotDetectedText?: CustomerSuppliedVerbiage;
38
39
  };
39
40
  export type IdCaptureProps = {
@@ -17,6 +17,7 @@ export type IdCapturePrediction = {
17
17
  bestMrz: DetectedObject | undefined;
18
18
  bestPdf417: DetectedObject | undefined;
19
19
  documentInBounds: boolean;
20
+ documentTooClose: boolean;
20
21
  focusScore: number;
21
22
  focusThresholdMet: boolean;
22
23
  focusPredictionTime: number;
@@ -24,6 +24,7 @@ export type IdCaptureState = {
24
24
  documentType: DocumentType;
25
25
  requiredDocumentType?: CapturedDocumentType;
26
26
  documentInBounds: boolean;
27
+ documentTooClose: boolean;
27
28
  documentDetectionScore: number;
28
29
  documentDetectionThresholdMet: boolean;
29
30
  mrzDetectionScore: number;
@@ -20,6 +20,7 @@ declare const _default: {
20
20
  Passport: string;
21
21
  'Document not detected': string;
22
22
  'Document is not centered': string;
23
+ 'Document too close, please back up': string;
23
24
  'Document out of focus \u2013 try improving the lighting': string;
24
25
  'Document detected, hold still...': string;
25
26
  'Capturing...': string;
@@ -28,6 +28,7 @@ export declare const resources: {
28
28
  Passport: string;
29
29
  'Document not detected': string;
30
30
  'Document is not centered': string;
31
+ 'Document too close, please back up': string;
31
32
  'Document out of focus \u2013 try improving the lighting': string;
32
33
  'Document detected, hold still...': string;
33
34
  'Capturing...': string;
@@ -48,7 +48,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
48
48
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
49
49
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
50
50
 
51
- var webSdkVersion = '1.0.171';
51
+ var webSdkVersion = '1.0.172';
52
52
 
53
53
  function getPlatform() {
54
54
  if (typeof window === 'undefined') return;
@@ -8873,16 +8873,16 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
8873
8873
  logPredictions = false;
8874
8874
  }
8875
8875
  return tslib.__awaiter(this, void 0, void 0, function () {
8876
- var _o, frameWidth, frameHeight, _q, boxes, scores, labels, time, allZero, detectedObjects, bestDocument, bestPassportPage, bestDocumentScore, passportDetectionScore, passportDetectionThresholdMet, bestDocumentOrPassport, detectionScore, detectionThresholdMet, detectedDocumentType, bestMrz, mrzDetectionScore, mrzDetectionThresholdMet, bestPdf417, pdf417DetectionScore, pdf417DetectionThresholdMet, documentInBounds, boundaryPx, _r, boundaryX, boundaryY, boundaryWidth, boundaryHeight, focusPrediction, focusPredictionTime, focusScore, focusThresholdMet, focusThreshold;
8877
- var _s;
8878
- return tslib.__generator(this, function (_t) {
8879
- switch (_t.label) {
8876
+ var _o, frameWidth, frameHeight, _q, boxes, scores, labels, time, allZero, detectedObjects, bestDocument, bestPassportPage, bestDocumentScore, passportDetectionScore, passportDetectionThresholdMet, bestDocumentOrPassport, detectionScore, detectionThresholdMet, detectedDocumentType, bestMrz, mrzDetectionScore, mrzDetectionThresholdMet, bestPdf417, pdf417DetectionScore, pdf417DetectionThresholdMet, documentInBounds, boundaryPx, _r, boundaryX, boundaryY, boundaryWidth, boundaryHeight, documentTooClose, _s, docWidth, docHeight, focusPrediction, focusPredictionTime, focusScore, focusThresholdMet, focusThreshold;
8877
+ var _t;
8878
+ return tslib.__generator(this, function (_u) {
8879
+ switch (_u.label) {
8880
8880
  case 0:
8881
8881
  _o = getFrameDimensions(frame), frameWidth = _o[0], frameHeight = _o[1];
8882
8882
  drawToCanvas(lastPredictionCanvas, frame);
8883
8883
  return [4 /*yield*/, makeDocumentDetectionPredictions(frame, logPredictions)];
8884
8884
  case 1:
8885
- _q = _t.sent(), boxes = _q.boxes, scores = _q.scores, labels = _q.labels, time = _q.time;
8885
+ _q = _u.sent(), boxes = _q.boxes, scores = _q.scores, labels = _q.labels, time = _q.time;
8886
8886
  allZero = boxes.length > 0 && !boxes.some(function (box) {
8887
8887
  return box.some(function (n) {
8888
8888
  return n > 0;
@@ -8935,15 +8935,20 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
8935
8935
  // If either the left side visible or if not, right edge of ID should be more than 80% of width.
8936
8936
  boundaryX + boundaryWidth + boundaryPx < frameWidth; // Valid right edge if it's less than video width.
8937
8937
  }
8938
+ documentTooClose = false;
8939
+ if (bestDocumentOrPassport) {
8940
+ _s = [bestDocumentOrPassport.bbox[2], bestDocumentOrPassport.bbox[3]], docWidth = _s[0], docHeight = _s[1];
8941
+ documentTooClose = docWidth > 0.8 || docHeight > 0.8;
8942
+ }
8938
8943
  focusPrediction = null, focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
8939
- if (!(detectionThresholdMet && documentInBounds)) return [3 /*break*/, 3];
8944
+ if (!(detectionThresholdMet && documentInBounds && !documentTooClose)) return [3 /*break*/, 3];
8940
8945
  return [4 /*yield*/, makeFocusPrediction(frame, bestDocumentOrPassport === null || bestDocumentOrPassport === void 0 ? void 0 : bestDocumentOrPassport.bbox, logPredictions)];
8941
8946
  case 2:
8942
- _s = _t.sent(), focusPrediction = _s[0], focusPredictionTime = _s[1];
8947
+ _t = _u.sent(), focusPrediction = _t[0], focusPredictionTime = _t[1];
8943
8948
  focusScore = (_j = focusPrediction === null || focusPrediction === void 0 ? void 0 : focusPrediction[1]) !== null && _j !== void 0 ? _j : 0;
8944
8949
  focusThreshold = (_m = onMobile ? (_k = thresholds.focus) === null || _k === void 0 ? void 0 : _k.mobile : (_l = thresholds.focus) === null || _l === void 0 ? void 0 : _l.desktop) !== null && _m !== void 0 ? _m : 0;
8945
8950
  focusThresholdMet = focusScore >= focusThreshold;
8946
- _t.label = 3;
8951
+ _u.label = 3;
8947
8952
  case 3:
8948
8953
  return [2 /*return*/, {
8949
8954
  detectedObjects: detectedObjects,
@@ -8961,6 +8966,7 @@ function makePredictions(frame, lastPredictionCanvas, thresholds, logPredictions
8961
8966
  bestMrz: bestMrz,
8962
8967
  bestPdf417: bestPdf417,
8963
8968
  documentInBounds: documentInBounds,
8969
+ documentTooClose: documentTooClose,
8964
8970
  focusScore: focusScore,
8965
8971
  focusThresholdMet: focusThresholdMet,
8966
8972
  focusPredictionTime: focusPredictionTime,
@@ -9149,6 +9155,7 @@ var initialState$5 = {
9149
9155
  bestPdf417: undefined,
9150
9156
  documentType: 'none',
9151
9157
  documentInBounds: false,
9158
+ documentTooClose: false,
9152
9159
  documentDetectionScore: 0,
9153
9160
  documentDetectionThresholdMet: false,
9154
9161
  passportPageDetectionScore: 0,
@@ -9233,6 +9240,7 @@ var reducer$5 = function reducer(state, action) {
9233
9240
  bestMrz = _a.bestMrz,
9234
9241
  bestPdf417 = _a.bestPdf417,
9235
9242
  documentInBounds = _a.documentInBounds,
9243
+ documentTooClose = _a.documentTooClose,
9236
9244
  focusScore = _a.focusScore,
9237
9245
  focusThresholdMet = _a.focusThresholdMet,
9238
9246
  frameWidth = _a.frameWidth,
@@ -9249,7 +9257,7 @@ var reducer$5 = function reducer(state, action) {
9249
9257
  var barcodeScanRequired = state.autoCaptureBarcodeRequired === true || state.autoCaptureBarcodeRequired === 'mobile' && isMobile();
9250
9258
  var shouldScanBarcode = state.barcodeScanningEnabled && pdf417DetectionThresholdMet && barcodeScanRequired;
9251
9259
  var waitingForBarcodeScan = shouldScanBarcode && !state.barcodeResult;
9252
- var isGoodFrame = detectionThresholdMet && documentInBounds && focusThresholdMet;
9260
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && focusThresholdMet;
9253
9261
  var goodFramesCount = state.goodFramesCount;
9254
9262
  if (isGoodFrame) {
9255
9263
  goodFramesCount += 1;
@@ -9263,6 +9271,7 @@ var reducer$5 = function reducer(state, action) {
9263
9271
  bestPdf417: bestPdf417,
9264
9272
  documentType: detectedDocumentType,
9265
9273
  documentInBounds: documentInBounds,
9274
+ documentTooClose: documentTooClose,
9266
9275
  documentDetectionScore: detectionScore,
9267
9276
  documentDetectionThresholdMet: detectionThresholdMet,
9268
9277
  mrzDetectionScore: mrzDetectionScore,
@@ -9576,6 +9585,7 @@ var esTranslation = {
9576
9585
  Passport: 'Pasaporte',
9577
9586
  'Document not detected': 'No se ha detectado el documento',
9578
9587
  'Document is not centered': 'Documento no centrado',
9588
+ 'Document too close, please back up': 'Documento muy cerca, favor de alejarse',
9579
9589
  'Document out of focus – try improving the lighting': 'Documento no enfocado - hay que tratar de mejorar la iluminación',
9580
9590
  'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
9581
9591
  'Capturing...': 'Capturando...',
@@ -9977,6 +9987,7 @@ var IdCapture = function IdCapture(_a) {
9977
9987
  guidanceSatisfiedText: 'Document detected, hold still...',
9978
9988
  guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
9979
9989
  guidanceNotCenteredText: 'Document is not centered',
9990
+ guidanceTooCloseText: 'Document too close, please back up',
9980
9991
  guidanceNotDetectedText: 'Document not detected'
9981
9992
  });
9982
9993
  var debugScalingDetails = useDebugScalingDetails({
@@ -9988,7 +9999,7 @@ var IdCapture = function IdCapture(_a) {
9988
9999
  });
9989
10000
  var satisfied = state.isGoodFrame;
9990
10001
  if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
9991
- guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.documentDetectionThresholdMet ? verbiage.guidanceNotDetectedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
10002
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.documentDetectionThresholdMet ? verbiage.guidanceNotDetectedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
9992
10003
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
9993
10004
  ref: ref,
9994
10005
  className: "flex ".concat((_j = classNames.container) !== null && _j !== void 0 ? _j : '')