idmission-web-sdk 2.2.49 → 2.2.51
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/components/CompositeWizard.d.ts.map +1 -1
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts +2 -1
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
- package/dist/components/id_capture/FocusModelProvider.d.ts +2 -1
- package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +2 -1
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +2 -1
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +78 -64
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +78 -64
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +78 -64
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -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.2.
|
|
214
|
+
var webSdkVersion = '2.2.51';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -8344,18 +8344,21 @@
|
|
|
8344
8344
|
_c = _a.modelLoadTimeoutMs,
|
|
8345
8345
|
modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
8346
8346
|
onModelError = _a.onModelError,
|
|
8347
|
-
videoRef = _a.videoRef
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8347
|
+
videoRef = _a.videoRef,
|
|
8348
|
+
_d = _a.shouldLoadModels,
|
|
8349
|
+
shouldLoadModels = _d === void 0 ? true : _d;
|
|
8350
|
+
var _e = React.useState(false),
|
|
8351
|
+
ready = _e[0],
|
|
8352
|
+
setReady = _e[1];
|
|
8353
|
+
var _f = React.useState(0),
|
|
8354
|
+
modelDownloadProgress = _f[0],
|
|
8355
|
+
setModelDownloadProgress = _f[1];
|
|
8356
|
+
var _g = React.useState(null),
|
|
8357
|
+
modelError = _g[0],
|
|
8358
|
+
setModelError = _g[1];
|
|
8357
8359
|
React.useEffect(function loadModel() {
|
|
8358
8360
|
var _this = this;
|
|
8361
|
+
if (!shouldLoadModels) return;
|
|
8359
8362
|
setReady(false);
|
|
8360
8363
|
function handleDownloadProgress(event) {
|
|
8361
8364
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -8393,7 +8396,7 @@
|
|
|
8393
8396
|
clearTimeout(modelLoadTimeout);
|
|
8394
8397
|
document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
|
|
8395
8398
|
};
|
|
8396
|
-
}, [modelPath, modelLoadTimeoutMs, videoRef]);
|
|
8399
|
+
}, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
|
|
8397
8400
|
React.useEffect(function handleModelError() {
|
|
8398
8401
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
8399
8402
|
}, [modelError, onModelError]);
|
|
@@ -8976,25 +8979,28 @@
|
|
|
8976
8979
|
detectorSettings = null;
|
|
8977
8980
|
}
|
|
8978
8981
|
function useLoadDocumentDetector(_a) {
|
|
8979
|
-
var _b = _a.
|
|
8980
|
-
|
|
8981
|
-
_c = _a.
|
|
8982
|
-
|
|
8983
|
-
_d = _a.
|
|
8984
|
-
|
|
8982
|
+
var _b = _a.shouldLoadModels,
|
|
8983
|
+
shouldLoadModels = _b === void 0 ? true : _b,
|
|
8984
|
+
_c = _a.modelPath,
|
|
8985
|
+
modelPath = _c === void 0 ? defaultDocumentDetectorModelPath : _c,
|
|
8986
|
+
_d = _a.modelLoadTimeoutMs,
|
|
8987
|
+
modelLoadTimeoutMs = _d === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _d,
|
|
8988
|
+
_e = _a.scoreThreshold,
|
|
8989
|
+
scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
|
|
8985
8990
|
onModelError = _a.onModelError,
|
|
8986
8991
|
videoRef = _a.videoRef;
|
|
8987
|
-
var
|
|
8988
|
-
ready =
|
|
8989
|
-
setReady =
|
|
8990
|
-
var
|
|
8991
|
-
modelDownloadProgress =
|
|
8992
|
-
setModelDownloadProgress =
|
|
8993
|
-
var
|
|
8994
|
-
modelError =
|
|
8995
|
-
setModelError =
|
|
8992
|
+
var _f = React.useState(false),
|
|
8993
|
+
ready = _f[0],
|
|
8994
|
+
setReady = _f[1];
|
|
8995
|
+
var _g = React.useState(0),
|
|
8996
|
+
modelDownloadProgress = _g[0],
|
|
8997
|
+
setModelDownloadProgress = _g[1];
|
|
8998
|
+
var _h = React.useState(null),
|
|
8999
|
+
modelError = _h[0],
|
|
9000
|
+
setModelError = _h[1];
|
|
8996
9001
|
React.useEffect(function loadModel() {
|
|
8997
9002
|
var _this = this;
|
|
9003
|
+
if (!shouldLoadModels) return;
|
|
8998
9004
|
setReady(false);
|
|
8999
9005
|
function handleDownloadProgress(event) {
|
|
9000
9006
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -9032,7 +9038,7 @@
|
|
|
9032
9038
|
clearTimeout(modelLoadTimeout);
|
|
9033
9039
|
document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
|
|
9034
9040
|
};
|
|
9035
|
-
}, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
|
|
9041
|
+
}, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
|
|
9036
9042
|
React.useEffect(function handleModelError() {
|
|
9037
9043
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
9038
9044
|
}, [modelError, onModelError]);
|
|
@@ -9889,38 +9895,41 @@
|
|
|
9889
9895
|
documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
|
|
9890
9896
|
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
9891
9897
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
9892
|
-
onDocumentDetectionModelError = _a.onDocumentDetectionModelError
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9898
|
+
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
9899
|
+
_h = _a.shouldLoadModels,
|
|
9900
|
+
shouldLoadModels = _h === void 0 ? true : _h;
|
|
9901
|
+
var _j = useCameraStore(),
|
|
9902
|
+
videoRef = _j.videoRef,
|
|
9903
|
+
videoLoaded = _j.videoLoaded,
|
|
9904
|
+
cameraReady = _j.cameraReady;
|
|
9897
9905
|
var lastPredictionCanvas = React.useRef(null);
|
|
9898
9906
|
var onPredictionHandler = React.useRef();
|
|
9899
|
-
var
|
|
9900
|
-
documentDetectionThresholds =
|
|
9901
|
-
setDocumentDetectionThresholds =
|
|
9902
|
-
var
|
|
9903
|
-
documentDetectionBoundaries =
|
|
9904
|
-
setDocumentDetectionBoundaries =
|
|
9905
|
-
var _l = React.useState(0),
|
|
9906
|
-
timesAllZero = _l[0],
|
|
9907
|
-
setTimesAllZero = _l[1];
|
|
9907
|
+
var _k = React.useState({}),
|
|
9908
|
+
documentDetectionThresholds = _k[0],
|
|
9909
|
+
setDocumentDetectionThresholds = _k[1];
|
|
9910
|
+
var _l = React.useState(defaultDocumentDetectionBoundaries),
|
|
9911
|
+
documentDetectionBoundaries = _l[0],
|
|
9912
|
+
setDocumentDetectionBoundaries = _l[1];
|
|
9908
9913
|
var _m = React.useState(0),
|
|
9909
|
-
|
|
9910
|
-
|
|
9914
|
+
timesAllZero = _m[0],
|
|
9915
|
+
setTimesAllZero = _m[1];
|
|
9916
|
+
var _o = React.useState(0),
|
|
9917
|
+
canvasKey = _o[0],
|
|
9918
|
+
setCanvasKey = _o[1];
|
|
9911
9919
|
var stopDetection = React.useRef(0);
|
|
9912
|
-
var
|
|
9920
|
+
var _p = useLoadDocumentDetector({
|
|
9913
9921
|
modelPath: documentDetectionModelPath,
|
|
9914
9922
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
9915
9923
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
9916
9924
|
onModelError: onDocumentDetectionModelError,
|
|
9917
|
-
videoRef: videoRef
|
|
9925
|
+
videoRef: videoRef,
|
|
9926
|
+
shouldLoadModels: shouldLoadModels
|
|
9918
9927
|
}),
|
|
9919
|
-
ready =
|
|
9920
|
-
modelDownloadProgress =
|
|
9921
|
-
modelError =
|
|
9922
|
-
setModelError =
|
|
9923
|
-
var
|
|
9928
|
+
ready = _p.ready,
|
|
9929
|
+
modelDownloadProgress = _p.modelDownloadProgress,
|
|
9930
|
+
modelError = _p.modelError,
|
|
9931
|
+
setModelError = _p.setModelError;
|
|
9932
|
+
var _q = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
9924
9933
|
return __awaiter(_this, void 0, void 0, function () {
|
|
9925
9934
|
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
9926
9935
|
var _a;
|
|
@@ -9963,8 +9972,8 @@
|
|
|
9963
9972
|
throttleMs: throttleMs,
|
|
9964
9973
|
autoStart: autoStart
|
|
9965
9974
|
}),
|
|
9966
|
-
start =
|
|
9967
|
-
stop =
|
|
9975
|
+
start = _q.start,
|
|
9976
|
+
stop = _q.stop;
|
|
9968
9977
|
React.useEffect(function setErrorIfAllZero() {
|
|
9969
9978
|
if (timesAllZero >= 2) {
|
|
9970
9979
|
setModelError(new Error('model is returning all zeroes'));
|
|
@@ -10025,22 +10034,25 @@
|
|
|
10025
10034
|
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
10026
10035
|
onFocusModelError = _a.onFocusModelError,
|
|
10027
10036
|
_d = _a.showCanvases,
|
|
10028
|
-
showCanvases = _d === void 0 ? false : _d
|
|
10037
|
+
showCanvases = _d === void 0 ? false : _d,
|
|
10038
|
+
_e = _a.shouldLoadModels,
|
|
10039
|
+
shouldLoadModels = _e === void 0 ? true : _e;
|
|
10029
10040
|
var cropCanvas = React.useRef(null);
|
|
10030
10041
|
var rotateCanvas = React.useRef(null);
|
|
10031
|
-
var
|
|
10032
|
-
focusThresholds =
|
|
10033
|
-
setFocusThresholds =
|
|
10042
|
+
var _f = React.useState({}),
|
|
10043
|
+
focusThresholds = _f[0],
|
|
10044
|
+
setFocusThresholds = _f[1];
|
|
10034
10045
|
var videoRef = useCameraStore().videoRef;
|
|
10035
|
-
var
|
|
10046
|
+
var _g = useLoadFocusModel({
|
|
10036
10047
|
modelPath: focusModelPath,
|
|
10037
10048
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
10038
10049
|
onModelError: onFocusModelError,
|
|
10039
|
-
videoRef: videoRef
|
|
10050
|
+
videoRef: videoRef,
|
|
10051
|
+
shouldLoadModels: shouldLoadModels
|
|
10040
10052
|
}),
|
|
10041
|
-
ready =
|
|
10042
|
-
modelDownloadProgress =
|
|
10043
|
-
modelError =
|
|
10053
|
+
ready = _g.ready,
|
|
10054
|
+
modelDownloadProgress = _g.modelDownloadProgress,
|
|
10055
|
+
modelError = _g.modelError;
|
|
10044
10056
|
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
10045
10057
|
if (!ready) return null;
|
|
10046
10058
|
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -21916,7 +21928,7 @@
|
|
|
21916
21928
|
top: 20,
|
|
21917
21929
|
left: 20,
|
|
21918
21930
|
right: 20,
|
|
21919
|
-
bottom:
|
|
21931
|
+
bottom: 0
|
|
21920
21932
|
});
|
|
21921
21933
|
}, [setDocumentDetectionBoundaries]);
|
|
21922
21934
|
var _24 = React.useState(0),
|
|
@@ -22720,9 +22732,11 @@
|
|
|
22720
22732
|
case 'IdCapture':
|
|
22721
22733
|
return /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
22722
22734
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
22723
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22735
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
22736
|
+
requestAccessAutomatically: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode)
|
|
22724
22737
|
}, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
|
|
22725
22738
|
autoStart: false,
|
|
22739
|
+
shouldLoadModels: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode),
|
|
22726
22740
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
22727
22741
|
focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
22728
22742
|
onModelError: idCaptureProps.onModelError,
|