idmission-web-sdk 2.1.98 → 2.1.100

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.
@@ -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.98';
237
+ var webSdkVersion = '2.1.100';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -5231,9 +5231,12 @@ function setLastFaceDetectionAt(time) {
5231
5231
  lastFaceDetectionAt = time;
5232
5232
  }
5233
5233
  var framesNeededSamples$1 = [];
5234
- function trackFramesNeeded$1(value) {
5234
+ function trackFramesNeeded$1(value, bufferLength) {
5235
+ if (bufferLength === void 0) {
5236
+ bufferLength = 25;
5237
+ }
5235
5238
  framesNeededSamples$1.unshift(value);
5236
- if (framesNeededSamples$1.length > 10) framesNeededSamples$1.length = 10;
5239
+ if (framesNeededSamples$1.length > bufferLength) framesNeededSamples$1.length = bufferLength;
5237
5240
  }
5238
5241
  var lastNFaces = [];
5239
5242
  function trackFace(face, framesNeeded) {
@@ -5715,9 +5718,12 @@ function setLastDetectionAt(time) {
5715
5718
  lastDetectionAt = time;
5716
5719
  }
5717
5720
  var framesNeededSamples = [];
5718
- function trackFramesNeeded(value) {
5721
+ function trackFramesNeeded(value, bufferLength) {
5722
+ if (bufferLength === void 0) {
5723
+ bufferLength = 25;
5724
+ }
5719
5725
  framesNeededSamples.unshift(value);
5720
- if (framesNeededSamples.length > 10) framesNeededSamples.length = 10;
5726
+ if (framesNeededSamples.length > bufferLength) framesNeededSamples.length = bufferLength;
5721
5727
  }
5722
5728
  var lastNBoxes = [];
5723
5729
  function trackBox(box, framesNeeded) {
@@ -6547,15 +6553,19 @@ var _reducer = function reducer(state, action) {
6547
6553
  }
6548
6554
  }
6549
6555
  }
6550
- var idCardDetectedButNotAllowed = !state.captureRequirement.includes('idCard') && detectedDocumentType.includes('idCard');
6551
- var passportDetectedButNotAllowed = !state.captureRequirement.toLowerCase().includes('passport') && detectedDocumentType === 'passport';
6552
- var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? 'idCardFront' in state.capturedDocuments && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
6553
- var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? 'idCardBack' in state.capturedDocuments && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
6556
+ var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
6557
+ var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
6558
+ var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
6559
+ var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
6560
+ var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
6561
+ var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
6562
+ var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
6563
+ var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
6554
6564
  var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
6555
6565
  if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
6556
6566
  wrongDocumentTypePredictions += 1;
6557
6567
  }
6558
- var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && documentIsStable;
6568
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
6559
6569
  var goodFramesCount = state.goodFramesCount;
6560
6570
  if (isGoodFrame) {
6561
6571
  goodFramesCount += 1;
@@ -6563,9 +6573,9 @@ var _reducer = function reducer(state, action) {
6563
6573
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
6564
6574
  var requestedDocumentType = state.requestedDocumentType;
6565
6575
  if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
6566
- if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !('idCardFront' in state.capturedDocuments)) {
6576
+ if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
6567
6577
  requestedDocumentType = 'idCardFront';
6568
- } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !('idCardBack' in state.capturedDocuments)) {
6578
+ } else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
6569
6579
  requestedDocumentType = 'idCardBack';
6570
6580
  }
6571
6581
  }
@@ -6574,7 +6584,7 @@ var _reducer = function reducer(state, action) {
6574
6584
  requestedDocumentType = 'passport';
6575
6585
  }
6576
6586
  if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
6577
- requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
6587
+ requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
6578
6588
  }
6579
6589
  }
6580
6590
  var hasBeenRunningForLongEnough = !!state.captureStartedAt && new Date().getTime() - state.captureStartedAt.getTime() > 1000;