idmission-web-sdk 2.1.106 → 2.1.108

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.
@@ -24,11 +24,13 @@ export type DetectedObject = {
24
24
  label: Label;
25
25
  score: number;
26
26
  };
27
- export type DocumentDetectionThresholds = {
27
+ export type DocumentThresholds = {
28
28
  idCardFront?: number;
29
29
  idCardBack?: number;
30
30
  passport?: number;
31
- stability?: number;
31
+ };
32
+ export type DocumentDetectionThresholds = DocumentThresholds & {
33
+ stability?: DocumentThresholds;
32
34
  };
33
35
  export declare function loadDocumentDetector(modelAssetPath?: string, scoreThreshold?: number): Promise<ObjectDetector>;
34
36
  export declare function useLoadDocumentDetector({ modelPath, modelLoadTimeoutMs, scoreThreshold, onModelError, }: {
@@ -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.106';
237
+ var webSdkVersion = '2.1.108';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -5569,7 +5569,11 @@ var defaultDocumentDetectionThresholds = {
5569
5569
  idCardFront: 0.6,
5570
5570
  idCardBack: 0.6,
5571
5571
  passport: 0.4,
5572
- stability: 0.9
5572
+ stability: {
5573
+ idCardFront: 0.85,
5574
+ idCardBack: 0.85,
5575
+ passport: 0.5
5576
+ }
5573
5577
  };
5574
5578
  var documentTypeDisplayNames = {
5575
5579
  idCardFront: 'ID card front',
@@ -5764,14 +5768,14 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
5764
5768
  var boundaryRight = (_c = boundaries.right) !== null && _c !== void 0 ? _c : 20;
5765
5769
  var boundaryBottom = (_d = boundaries.bottom) !== null && _d !== void 0 ? _d : 20;
5766
5770
  var frameWidth80Pct = frameWidth * 0.8;
5767
- var detectedObjects = applyNonMaxSuppression(detections.map(function (d) {
5768
- var _a;
5769
- var category = (_a = d.categories) === null || _a === void 0 ? void 0 : _a[0];
5770
- return {
5771
- label: category === null || category === void 0 ? void 0 : category.categoryName,
5772
- score: category === null || category === void 0 ? void 0 : category.score,
5773
- box: convertBoundingBox(d.boundingBox)
5774
- };
5771
+ var detectedObjects = applyNonMaxSuppression(detections.flatMap(function (d) {
5772
+ return d.categories.map(function (category) {
5773
+ return {
5774
+ label: category === null || category === void 0 ? void 0 : category.categoryName,
5775
+ score: category === null || category === void 0 ? void 0 : category.score,
5776
+ box: convertBoundingBox(d.boundingBox)
5777
+ };
5778
+ });
5775
5779
  }), function (obj) {
5776
5780
  var _a = obj.box,
5777
5781
  xMin = _a.xMin,
@@ -5832,7 +5836,8 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
5832
5836
  docHeight = _o[1];
5833
5837
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
5834
5838
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
5835
- var threshold_1 = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
5839
+ var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
5840
+ var threshold_1 = thresholdSet[detectedDocumentType];
5836
5841
  var framesNeeded = Math.ceil(average(framesNeededSamples));
5837
5842
  trackBox(bestDocument.box, framesNeeded);
5838
5843
  documentIsStable = lastNBoxes.length >= framesNeeded && !lastNPairs.some(function (pair) {