idmission-web-sdk 2.3.135 → 2.3.136

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.3.135';
214
+ var webSdkVersion = '2.3.136';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -14563,12 +14563,13 @@
14563
14563
  lastBarcodeReadabilityPredictionTime = time - lastBarcodeReadabilityPredictionAt;
14564
14564
  lastBarcodeReadabilityPredictionAt = time;
14565
14565
  }
14566
- function makeBarcodeReadabilityModelPrediction(imageData, cropCanvas, rotateCanvas, box) {
14566
+ function makeBarcodeReadabilityModelPrediction(imageData, cropCanvas, rotateCanvas, resizeCanvas, box) {
14567
14567
  var _a, _b, _c, _d, _e;
14568
14568
  if (!classifier) return null;
14569
14569
  var startedAt = performance.now();
14570
14570
  var image = cropAndRotateIfNecessary(imageData, cropCanvas, rotateCanvas, box);
14571
- var result = classifier.classifyForVideo(image, performance.now());
14571
+ var resized = resizeIfNecessary(image, resizeCanvas, 500);
14572
+ var result = classifier.classifyForVideo(resized, performance.now());
14572
14573
  var score = (_e = (_d = (_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.classifications) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.categories) === null || _c === void 0 ? void 0 : _c.find(function (c) {
14573
14574
  return c.categoryName === 'blurry';
14574
14575
  })) === null || _d === void 0 ? void 0 : _d.score) !== null && _e !== void 0 ? _e : 0;
@@ -14635,7 +14636,7 @@
14635
14636
  modelError = _h.modelError;
14636
14637
  var makeBarcodeReadabilityPrediction = React.useCallback(function (imageData, box) {
14637
14638
  if (!ready) return null;
14638
- var prediction = makeBarcodeReadabilityModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
14639
+ var prediction = makeBarcodeReadabilityModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, resizeCanvas.current, box);
14639
14640
  if (!prediction) return null;
14640
14641
  setLastBarcodeReadabilityPredictionAt(prediction.predictionTime);
14641
14642
  return prediction;
@@ -14687,7 +14688,7 @@
14687
14688
  * @param barcodeReadabilityThresholds Thresholds for barcode readability
14688
14689
  * @returns Object containing barcode analysis results
14689
14690
  */
14690
- function analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, bestBarcodeResizeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold) {
14691
+ function analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold) {
14691
14692
  return __awaiter(this, void 0, void 0, function () {
14692
14693
  var pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, newBestBarcodeScore, newBestBarcodeDetails, documentCroppedPrediction, processedCroppedPrediction, pdf417Prediction;
14693
14694
  var _a;
@@ -14743,10 +14744,6 @@
14743
14744
  pdf417PredictionThresholdMet = true;
14744
14745
  }
14745
14746
  cropToDetectedObjectBox(croppedDocumentCanvas, processedCroppedPrediction.bestPDF417.box, bestBarcodeCanvas, 16);
14746
- if (bestBarcodeCanvas.width > 500 && bestBarcodeResizeCanvas) {
14747
- drawToCanvas(bestBarcodeResizeCanvas, bestBarcodeCanvas);
14748
- resizeIfNecessary(bestBarcodeResizeCanvas, bestBarcodeCanvas, 500);
14749
- }
14750
14747
  }
14751
14748
  }
14752
14749
  }
@@ -14788,12 +14785,12 @@
14788
14785
  var documentDetectionThresholds = React.useContext(DocumentDetectionModelContext).documentDetectionThresholds;
14789
14786
  var makeBarcodeReadabilityPrediction = useBarcodeReadabilityModelContext().makeBarcodeReadabilityPrediction;
14790
14787
  var getBarcodeReadabilityThreshold = useBarcodeReadabilityThreshold();
14791
- return React.useCallback(function (prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, bestBarcodeResizeCanvas, currentBestBarcodeScore) {
14788
+ return React.useCallback(function (prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, currentBestBarcodeScore) {
14792
14789
  return __awaiter(_this, void 0, void 0, function () {
14793
14790
  var barcodeReadabilityThreshold;
14794
14791
  return __generator(this, function (_a) {
14795
14792
  barcodeReadabilityThreshold = getBarcodeReadabilityThreshold(prediction.detectedDocumentType);
14796
- return [2 /*return*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, bestBarcodeResizeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold)];
14793
+ return [2 /*return*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold)];
14797
14794
  });
14798
14795
  });
14799
14796
  }, [documentDetectionThresholds, makeBarcodeReadabilityPrediction, getBarcodeReadabilityThreshold]);
@@ -14900,7 +14897,6 @@
14900
14897
  var bestBarcodeDetails = React.useRef(null);
14901
14898
  var bestPredictionCanvas = React.useRef(null);
14902
14899
  var bestBarcodeCanvas = React.useRef(null);
14903
- var bestBarcodeResizeCanvas = React.useRef(null);
14904
14900
  var croppedDocumentCanvas = React.useRef(null);
14905
14901
  var bestFocusScore = React.useRef(0);
14906
14902
  var bestBarcodeScore = React.useRef(0);
@@ -14968,7 +14964,7 @@
14968
14964
  };
14969
14965
  }
14970
14966
  if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
14971
- return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeResizeCanvas.current, bestBarcodeScore.current)];
14967
+ return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
14972
14968
  case 1:
14973
14969
  barcodeAnalysisResult = _h.sent();
14974
14970
  pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
@@ -15108,15 +15104,12 @@
15108
15104
  }, /*#__PURE__*/React.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React.createElement(InvisibleCanvas, {
15109
15105
  key: "bf-".concat(canvasKey),
15110
15106
  ref: bestPredictionCanvas
15111
- }), /*#__PURE__*/React.createElement(InvisibleCanvas, {
15112
- key: "cd-".concat(canvasKey),
15113
- ref: croppedDocumentCanvas
15114
15107
  }), /*#__PURE__*/React.createElement(InvisibleCanvas, {
15115
15108
  key: "bb-".concat(canvasKey),
15116
15109
  ref: bestBarcodeCanvas
15117
15110
  }), /*#__PURE__*/React.createElement(InvisibleCanvas, {
15118
- key: "bbr-".concat(canvasKey),
15119
- ref: bestBarcodeResizeCanvas
15111
+ key: "cd-".concat(canvasKey),
15112
+ ref: croppedDocumentCanvas
15120
15113
  })), children);
15121
15114
  }
15122
15115
  function IdCaptureModelsProvider(_a) {