idmission-web-sdk 2.3.135 → 2.3.137

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.
package/dist/sdk2.esm.js CHANGED
@@ -204,7 +204,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
204
204
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
205
205
  };
206
206
 
207
- var webSdkVersion = '2.3.135';
207
+ var webSdkVersion = '2.3.137';
208
208
 
209
209
  function getPlatform() {
210
210
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -5803,12 +5803,13 @@ function setLastBarcodeReadabilityPredictionAt(time) {
5803
5803
  lastBarcodeReadabilityPredictionTime = time - lastBarcodeReadabilityPredictionAt;
5804
5804
  lastBarcodeReadabilityPredictionAt = time;
5805
5805
  }
5806
- function makeBarcodeReadabilityModelPrediction(imageData, cropCanvas, rotateCanvas, box) {
5806
+ function makeBarcodeReadabilityModelPrediction(imageData, cropCanvas, rotateCanvas, resizeCanvas, box) {
5807
5807
  var _a, _b, _c, _d, _e;
5808
5808
  if (!classifier) return null;
5809
5809
  var startedAt = performance.now();
5810
5810
  var image = cropAndRotateIfNecessary(imageData, cropCanvas, rotateCanvas, box);
5811
- var result = classifier.classifyForVideo(image, performance.now());
5811
+ var resized = resizeIfNecessary(image, resizeCanvas, 500);
5812
+ var result = classifier.classifyForVideo(resized, performance.now());
5812
5813
  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) {
5813
5814
  return c.categoryName === 'blurry';
5814
5815
  })) === null || _d === void 0 ? void 0 : _d.score) !== null && _e !== void 0 ? _e : 0;
@@ -5875,7 +5876,7 @@ function BarcodeReadabilityModelProvider(_a) {
5875
5876
  modelError = _h.modelError;
5876
5877
  var makeBarcodeReadabilityPrediction = useCallback(function (imageData, box) {
5877
5878
  if (!ready) return null;
5878
- var prediction = makeBarcodeReadabilityModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
5879
+ var prediction = makeBarcodeReadabilityModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, resizeCanvas.current, box);
5879
5880
  if (!prediction) return null;
5880
5881
  setLastBarcodeReadabilityPredictionAt(prediction.predictionTime);
5881
5882
  return prediction;
@@ -5927,7 +5928,7 @@ var onMobile = isMobile();
5927
5928
  * @param barcodeReadabilityThresholds Thresholds for barcode readability
5928
5929
  * @returns Object containing barcode analysis results
5929
5930
  */
5930
- function analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, bestBarcodeResizeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold) {
5931
+ function analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold) {
5931
5932
  return __awaiter(this, void 0, void 0, function () {
5932
5933
  var pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, newBestBarcodeScore, newBestBarcodeDetails, documentCroppedPrediction, processedCroppedPrediction, pdf417Prediction;
5933
5934
  var _a;
@@ -5983,10 +5984,6 @@ function analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocu
5983
5984
  pdf417PredictionThresholdMet = true;
5984
5985
  }
5985
5986
  cropToDetectedObjectBox(croppedDocumentCanvas, processedCroppedPrediction.bestPDF417.box, bestBarcodeCanvas, 16);
5986
- if (bestBarcodeCanvas.width > 500 && bestBarcodeResizeCanvas) {
5987
- drawToCanvas(bestBarcodeResizeCanvas, bestBarcodeCanvas);
5988
- resizeIfNecessary(bestBarcodeResizeCanvas, bestBarcodeCanvas, 500);
5989
- }
5990
5987
  }
5991
5988
  }
5992
5989
  }
@@ -6028,12 +6025,12 @@ function useBarcodeReadabilityAnalysis() {
6028
6025
  var documentDetectionThresholds = useContext(DocumentDetectionModelContext).documentDetectionThresholds;
6029
6026
  var makeBarcodeReadabilityPrediction = useBarcodeReadabilityModelContext().makeBarcodeReadabilityPrediction;
6030
6027
  var getBarcodeReadabilityThreshold = useBarcodeReadabilityThreshold();
6031
- return useCallback(function (prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, bestBarcodeResizeCanvas, currentBestBarcodeScore) {
6028
+ return useCallback(function (prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, currentBestBarcodeScore) {
6032
6029
  return __awaiter(_this, void 0, void 0, function () {
6033
6030
  var barcodeReadabilityThreshold;
6034
6031
  return __generator(this, function (_a) {
6035
6032
  barcodeReadabilityThreshold = getBarcodeReadabilityThreshold(prediction.detectedDocumentType);
6036
- return [2 /*return*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, bestBarcodeResizeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold)];
6033
+ return [2 /*return*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas, croppedDocumentCanvas, bestBarcodeCanvas, currentBestBarcodeScore, documentDetectionThresholds, makeBarcodeReadabilityPrediction, barcodeReadabilityThreshold)];
6037
6034
  });
6038
6035
  });
6039
6036
  }, [documentDetectionThresholds, makeBarcodeReadabilityPrediction, getBarcodeReadabilityThreshold]);
@@ -6140,7 +6137,6 @@ function IdCaptureModelsProviderInner(_a) {
6140
6137
  var bestBarcodeDetails = useRef(null);
6141
6138
  var bestPredictionCanvas = useRef(null);
6142
6139
  var bestBarcodeCanvas = useRef(null);
6143
- var bestBarcodeResizeCanvas = useRef(null);
6144
6140
  var croppedDocumentCanvas = useRef(null);
6145
6141
  var bestFocusScore = useRef(0);
6146
6142
  var bestBarcodeScore = useRef(0);
@@ -6208,7 +6204,7 @@ function IdCaptureModelsProviderInner(_a) {
6208
6204
  };
6209
6205
  }
6210
6206
  if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
6211
- return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeResizeCanvas.current, bestBarcodeScore.current)];
6207
+ return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
6212
6208
  case 1:
6213
6209
  barcodeAnalysisResult = _h.sent();
6214
6210
  pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
@@ -6348,15 +6344,12 @@ function IdCaptureModelsProviderInner(_a) {
6348
6344
  }, /*#__PURE__*/React__default.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
6349
6345
  key: "bf-".concat(canvasKey),
6350
6346
  ref: bestPredictionCanvas
6351
- }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
6352
- key: "cd-".concat(canvasKey),
6353
- ref: croppedDocumentCanvas
6354
6347
  }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
6355
6348
  key: "bb-".concat(canvasKey),
6356
6349
  ref: bestBarcodeCanvas
6357
6350
  }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
6358
- key: "bbr-".concat(canvasKey),
6359
- ref: bestBarcodeResizeCanvas
6351
+ key: "cd-".concat(canvasKey),
6352
+ ref: croppedDocumentCanvas
6360
6353
  })), children);
6361
6354
  }
6362
6355
  function IdCaptureModelsProvider(_a) {