idmission-web-sdk 2.3.134 → 2.3.135

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