idmission-web-sdk 2.1.77 → 2.1.78

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.1.77';
207
+ var webSdkVersion = '2.1.78';
208
208
 
209
209
  function getPlatform() {
210
210
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2842,6 +2842,12 @@ function useLoadFocusModel(_a) {
2842
2842
  modelError: modelError
2843
2843
  };
2844
2844
  }
2845
+ var lastFocusPredictionAt = 0;
2846
+ var lastFocusPredictionTime = 0;
2847
+ function setLastFocusPredictionAt(time) {
2848
+ lastFocusPredictionTime = time - lastFocusPredictionAt;
2849
+ lastFocusPredictionAt = time;
2850
+ }
2845
2851
  function makeFocusModelPrediction(model, imageData, cropCanvas, rotateCanvas, box) {
2846
2852
  var _a, _b, _c, _d, _e;
2847
2853
  var startedAt = new Date();
@@ -5954,22 +5960,19 @@ function FocusModelProvider(_a) {
5954
5960
  var _e = useState({}),
5955
5961
  focusThresholds = _e[0],
5956
5962
  setFocusThresholds = _e[1];
5957
- var _f = useState(0),
5958
- focusPredictionTime = _f[0],
5959
- setFocusPredictionTime = _f[1];
5960
- var _g = useLoadFocusModel({
5963
+ var _f = useLoadFocusModel({
5961
5964
  modelPath: focusModelPath,
5962
5965
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
5963
5966
  onModelError: onFocusModelError
5964
5967
  }),
5965
- model = _g.model,
5966
- ready = _g.ready,
5967
- modelDownloadProgress = _g.modelDownloadProgress,
5968
- modelError = _g.modelError;
5968
+ model = _f.model,
5969
+ ready = _f.ready,
5970
+ modelDownloadProgress = _f.modelDownloadProgress,
5971
+ modelError = _f.modelError;
5969
5972
  var makeFocusPrediction = useCallback(function (imageData, box) {
5970
5973
  if (!model.current) return null;
5971
5974
  var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
5972
- setFocusPredictionTime(prediction.predictionTime);
5975
+ setLastFocusPredictionAt(prediction.predictionTime);
5973
5976
  return prediction;
5974
5977
  }, [model]);
5975
5978
  var value = useMemo(function () {
@@ -5978,11 +5981,11 @@ function FocusModelProvider(_a) {
5978
5981
  focusModelDownloadProgress: modelDownloadProgress,
5979
5982
  focusModelError: modelError,
5980
5983
  makeFocusPrediction: makeFocusPrediction,
5981
- focusPredictionTime: focusPredictionTime,
5984
+ focusPredictionTime: lastFocusPredictionTime,
5982
5985
  focusThresholds: focusThresholds,
5983
5986
  setFocusThresholds: setFocusThresholds
5984
5987
  };
5985
- }, [focusPredictionTime, focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
5988
+ }, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
5986
5989
  return /*#__PURE__*/React__default.createElement(FocusModelContext.Provider, {
5987
5990
  value: value
5988
5991
  }, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {