idmission-web-sdk 2.2.6 → 2.2.7

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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.6';
214
+ var webSdkVersion = '2.2.7';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -10502,105 +10502,107 @@
10502
10502
  guideImageHeight: action.payload.height
10503
10503
  });
10504
10504
  case 'objectsDetected':
10505
- var _d = action.payload.prediction,
10506
- detectedObjects = _d.detectedObjects,
10507
- detectionThresholdMet = _d.detectionThresholdMet,
10508
- detectedDocumentType = _d.detectedDocumentType,
10509
- idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
10510
- idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
10511
- idCardBackDetectionScore = _d.idCardBackDetectionScore,
10512
- idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
10513
- passportDetectionScore = _d.passportDetectionScore,
10514
- passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
10515
- bestDocument = _d.bestDocument,
10516
- documentInBounds = _d.documentInBounds,
10517
- documentTooClose = _d.documentTooClose,
10518
- documentIsStable = _d.documentIsStable,
10519
- focusScore = _d.focusScore,
10520
- focusThresholdMet = _d.focusThresholdMet,
10521
- frameWidth = _d.frameWidth,
10522
- frameHeight = _d.frameHeight;
10523
- var frameCapturedAt = new Date();
10524
- var frameCaptureRate = 0;
10525
- var goodFramesThreshold = state.goodFramesThreshold;
10526
- if (state.lastFrameCapturedAt) {
10527
- var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
10528
- if (frameTime > 0) {
10529
- frameCaptureRate = 1000.0 / frameTime;
10530
- if (frameCaptureRate > 0) {
10531
- goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
10505
+ {
10506
+ var _d = action.payload.prediction,
10507
+ detectedObjects = _d.detectedObjects,
10508
+ detectionThresholdMet = _d.detectionThresholdMet,
10509
+ detectedDocumentType = _d.detectedDocumentType,
10510
+ idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
10511
+ idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
10512
+ idCardBackDetectionScore = _d.idCardBackDetectionScore,
10513
+ idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
10514
+ passportDetectionScore = _d.passportDetectionScore,
10515
+ passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
10516
+ bestDocument = _d.bestDocument,
10517
+ documentInBounds = _d.documentInBounds,
10518
+ documentTooClose = _d.documentTooClose,
10519
+ documentIsStable = _d.documentIsStable,
10520
+ focusScore = _d.focusScore,
10521
+ focusThresholdMet = _d.focusThresholdMet,
10522
+ frameWidth = _d.frameWidth,
10523
+ frameHeight = _d.frameHeight;
10524
+ var frameCapturedAt = new Date();
10525
+ var frameCaptureRate = 0;
10526
+ var goodFramesThreshold = state.goodFramesThreshold;
10527
+ if (state.lastFrameCapturedAt) {
10528
+ var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
10529
+ if (frameTime > 0) {
10530
+ frameCaptureRate = 1000.0 / frameTime;
10531
+ if (frameCaptureRate > 0) {
10532
+ goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
10533
+ }
10532
10534
  }
10533
10535
  }
10534
- }
10535
- var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
10536
- var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
10537
- var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
10538
- var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
10539
- var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
10540
- var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
10541
- var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
10542
- var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
10543
- var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
10544
- if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
10545
- wrongDocumentTypePredictions += 1;
10546
- }
10547
- var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
10548
- var goodFramesCount = state.goodFramesCount;
10549
- if (isGoodFrame) {
10550
- goodFramesCount += 1;
10551
- }
10552
- var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
10553
- var requestedDocumentType = state.requestedDocumentType;
10554
- if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
10555
- if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
10556
- requestedDocumentType = 'idCardFront';
10557
- } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
10558
- requestedDocumentType = 'idCardBack';
10536
+ var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
10537
+ var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
10538
+ var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
10539
+ var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
10540
+ var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
10541
+ var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
10542
+ var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
10543
+ var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
10544
+ var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
10545
+ if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
10546
+ wrongDocumentTypePredictions += 1;
10559
10547
  }
10560
- }
10561
- if (state.captureRequirement === 'idCardOrPassport') {
10562
- if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
10563
- requestedDocumentType = 'passport';
10548
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
10549
+ var goodFramesCount = state.goodFramesCount;
10550
+ if (isGoodFrame) {
10551
+ goodFramesCount += 1;
10564
10552
  }
10565
- if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
10566
- requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
10553
+ var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
10554
+ var requestedDocumentType = state.requestedDocumentType;
10555
+ if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
10556
+ if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
10557
+ requestedDocumentType = 'idCardFront';
10558
+ } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
10559
+ requestedDocumentType = 'idCardBack';
10560
+ }
10567
10561
  }
10562
+ if (state.captureRequirement === 'idCardOrPassport') {
10563
+ if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
10564
+ requestedDocumentType = 'passport';
10565
+ }
10566
+ if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
10567
+ requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
10568
+ }
10569
+ }
10570
+ var hasBeenRunningForLongEnough = !!state.captureStartedAt && new Date().getTime() - state.captureStartedAt.getTime() > 1000;
10571
+ var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
10572
+ var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
10573
+ return _assign(_assign({}, state), {
10574
+ videoWidth: frameWidth,
10575
+ videoHeight: frameHeight,
10576
+ detectedObjects: detectedObjects,
10577
+ bestDocument: bestDocument,
10578
+ requestedDocumentType: requestedDocumentType,
10579
+ detectedDocumentType: detectedDocumentType,
10580
+ detectionThresholdMet: detectionThresholdMet,
10581
+ documentInBounds: documentInBounds,
10582
+ documentTooClose: documentTooClose,
10583
+ documentIsStable: documentIsStable,
10584
+ flipRequired: flipRequired,
10585
+ backDetectedFirst: backDetectedFirst,
10586
+ idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
10587
+ passportDetectedButNotAllowed: passportDetectedButNotAllowed,
10588
+ allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
10589
+ wrongDocumentTypePredictions: wrongDocumentTypePredictions,
10590
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
10591
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
10592
+ idCardBackDetectionScore: idCardBackDetectionScore,
10593
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
10594
+ passportDetectionScore: passportDetectionScore,
10595
+ passportDetectionThresholdMet: passportDetectionThresholdMet,
10596
+ focusScore: focusScore,
10597
+ focusThresholdMet: focusThresholdMet,
10598
+ isGoodFrame: isGoodFrame,
10599
+ goodFramesCount: goodFramesCount,
10600
+ goodFramesThreshold: goodFramesThreshold,
10601
+ goodFramesThresholdMet: goodFramesThresholdMet,
10602
+ lastFrameCapturedAt: frameCapturedAt,
10603
+ frameCaptureRate: frameCaptureRate
10604
+ });
10568
10605
  }
10569
- var hasBeenRunningForLongEnough = !!state.captureStartedAt && new Date().getTime() - state.captureStartedAt.getTime() > 1000;
10570
- var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
10571
- var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
10572
- return _assign(_assign({}, state), {
10573
- videoWidth: frameWidth,
10574
- videoHeight: frameHeight,
10575
- detectedObjects: detectedObjects,
10576
- bestDocument: bestDocument,
10577
- requestedDocumentType: requestedDocumentType,
10578
- detectedDocumentType: detectedDocumentType,
10579
- detectionThresholdMet: detectionThresholdMet,
10580
- documentInBounds: documentInBounds,
10581
- documentTooClose: documentTooClose,
10582
- documentIsStable: documentIsStable,
10583
- flipRequired: flipRequired,
10584
- backDetectedFirst: backDetectedFirst,
10585
- idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
10586
- passportDetectedButNotAllowed: passportDetectedButNotAllowed,
10587
- allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
10588
- wrongDocumentTypePredictions: wrongDocumentTypePredictions,
10589
- idCardFrontDetectionScore: idCardFrontDetectionScore,
10590
- idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
10591
- idCardBackDetectionScore: idCardBackDetectionScore,
10592
- idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
10593
- passportDetectionScore: passportDetectionScore,
10594
- passportDetectionThresholdMet: passportDetectionThresholdMet,
10595
- focusScore: focusScore,
10596
- focusThresholdMet: focusThresholdMet,
10597
- isGoodFrame: isGoodFrame,
10598
- goodFramesCount: goodFramesCount,
10599
- goodFramesThreshold: goodFramesThreshold,
10600
- goodFramesThresholdMet: goodFramesThresholdMet,
10601
- lastFrameCapturedAt: frameCapturedAt,
10602
- frameCaptureRate: frameCaptureRate
10603
- });
10604
10606
  case 'captureStarted':
10605
10607
  return _assign(_assign({}, state), {
10606
10608
  captureStartedAt: new Date(),