idmission-web-sdk 2.2.97 → 2.2.98
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/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/components/id_capture/IdCaptureModelsProvider.d.ts +1 -0
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureOrUploadScreen.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +50 -18
- 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 +50 -18
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +50 -18
- 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 +1 -1
|
@@ -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.98';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -9963,6 +9963,9 @@
|
|
|
9963
9963
|
stopDocumentDetection: function stopDocumentDetection() {
|
|
9964
9964
|
return null;
|
|
9965
9965
|
},
|
|
9966
|
+
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
9967
|
+
return null;
|
|
9968
|
+
},
|
|
9966
9969
|
documentDetectionModelReady: false,
|
|
9967
9970
|
documentDetectionModelDownloadProgress: 0,
|
|
9968
9971
|
documentDetectionModelError: null,
|
|
@@ -10002,7 +10005,7 @@
|
|
|
10002
10005
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
10003
10006
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
10004
10007
|
_h = _a.shouldLoadModels,
|
|
10005
|
-
|
|
10008
|
+
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
10006
10009
|
var _j = useCameraStore(),
|
|
10007
10010
|
videoRef = _j.videoRef,
|
|
10008
10011
|
videoLoaded = _j.videoLoaded,
|
|
@@ -10022,7 +10025,13 @@
|
|
|
10022
10025
|
canvasKey = _o[0],
|
|
10023
10026
|
setCanvasKey = _o[1];
|
|
10024
10027
|
var stopDetection = React.useRef(0);
|
|
10025
|
-
var _p =
|
|
10028
|
+
var _p = React.useState(shouldLoadModelsProp),
|
|
10029
|
+
shouldLoadModels = _p[0],
|
|
10030
|
+
setShouldLoadModels = _p[1];
|
|
10031
|
+
var load = React.useCallback(function () {
|
|
10032
|
+
return setShouldLoadModels(true);
|
|
10033
|
+
}, []);
|
|
10034
|
+
var _q = useLoadDocumentDetector({
|
|
10026
10035
|
modelPath: documentDetectionModelPath,
|
|
10027
10036
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
10028
10037
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
@@ -10030,11 +10039,11 @@
|
|
|
10030
10039
|
videoRef: videoRef,
|
|
10031
10040
|
shouldLoadModels: shouldLoadModels
|
|
10032
10041
|
}),
|
|
10033
|
-
ready =
|
|
10034
|
-
modelDownloadProgress =
|
|
10035
|
-
modelError =
|
|
10036
|
-
setModelError =
|
|
10037
|
-
var
|
|
10042
|
+
ready = _q.ready,
|
|
10043
|
+
modelDownloadProgress = _q.modelDownloadProgress,
|
|
10044
|
+
modelError = _q.modelError,
|
|
10045
|
+
setModelError = _q.setModelError;
|
|
10046
|
+
var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
10038
10047
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10039
10048
|
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
10040
10049
|
var _a;
|
|
@@ -10077,8 +10086,8 @@
|
|
|
10077
10086
|
throttleMs: throttleMs,
|
|
10078
10087
|
autoStart: autoStart
|
|
10079
10088
|
}),
|
|
10080
|
-
start =
|
|
10081
|
-
stop =
|
|
10089
|
+
start = _r.start,
|
|
10090
|
+
stop = _r.stop;
|
|
10082
10091
|
React.useEffect(function setErrorIfAllZero() {
|
|
10083
10092
|
if (timesAllZero >= 2) {
|
|
10084
10093
|
setModelError(new Error('model is returning all zeroes'));
|
|
@@ -10097,6 +10106,7 @@
|
|
|
10097
10106
|
return {
|
|
10098
10107
|
startDocumentDetection: start,
|
|
10099
10108
|
stopDocumentDetection: stop,
|
|
10109
|
+
loadDocumentDetectionModel: load,
|
|
10100
10110
|
documentDetectionModelReady: ready,
|
|
10101
10111
|
documentDetectionModelError: modelError,
|
|
10102
10112
|
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
@@ -10109,7 +10119,7 @@
|
|
|
10109
10119
|
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
10110
10120
|
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
10111
10121
|
};
|
|
10112
|
-
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
10122
|
+
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
10113
10123
|
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
10114
10124
|
value: value
|
|
10115
10125
|
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
@@ -10119,6 +10129,9 @@
|
|
|
10119
10129
|
}
|
|
10120
10130
|
|
|
10121
10131
|
var FocusModelContext = /*#__PURE__*/React.createContext({
|
|
10132
|
+
loadFocusModel: function loadFocusModel() {
|
|
10133
|
+
return null;
|
|
10134
|
+
},
|
|
10122
10135
|
focusModelReady: false,
|
|
10123
10136
|
focusModelDownloadProgress: 0,
|
|
10124
10137
|
focusModelError: null,
|
|
@@ -10141,23 +10154,29 @@
|
|
|
10141
10154
|
_d = _a.showCanvases,
|
|
10142
10155
|
showCanvases = _d === void 0 ? false : _d,
|
|
10143
10156
|
_e = _a.shouldLoadModels,
|
|
10144
|
-
|
|
10157
|
+
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
10145
10158
|
var cropCanvas = React.useRef(null);
|
|
10146
10159
|
var rotateCanvas = React.useRef(null);
|
|
10147
10160
|
var _f = React.useState({}),
|
|
10148
10161
|
focusThresholds = _f[0],
|
|
10149
10162
|
setFocusThresholds = _f[1];
|
|
10150
10163
|
var videoRef = useCameraStore().videoRef;
|
|
10151
|
-
var _g =
|
|
10164
|
+
var _g = React.useState(shouldLoadModelsProp),
|
|
10165
|
+
shouldLoadModels = _g[0],
|
|
10166
|
+
setShouldLoadModels = _g[1];
|
|
10167
|
+
var load = React.useCallback(function () {
|
|
10168
|
+
return setShouldLoadModels(true);
|
|
10169
|
+
}, []);
|
|
10170
|
+
var _h = useLoadFocusModel({
|
|
10152
10171
|
modelPath: focusModelPath,
|
|
10153
10172
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
10154
10173
|
onModelError: onFocusModelError,
|
|
10155
10174
|
videoRef: videoRef,
|
|
10156
10175
|
shouldLoadModels: shouldLoadModels
|
|
10157
10176
|
}),
|
|
10158
|
-
ready =
|
|
10159
|
-
modelDownloadProgress =
|
|
10160
|
-
modelError =
|
|
10177
|
+
ready = _h.ready,
|
|
10178
|
+
modelDownloadProgress = _h.modelDownloadProgress,
|
|
10179
|
+
modelError = _h.modelError;
|
|
10161
10180
|
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
10162
10181
|
if (!ready) return null;
|
|
10163
10182
|
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -10167,6 +10186,7 @@
|
|
|
10167
10186
|
}, [ready]);
|
|
10168
10187
|
var value = React.useMemo(function () {
|
|
10169
10188
|
return {
|
|
10189
|
+
loadFocusModel: load,
|
|
10170
10190
|
focusModelReady: ready,
|
|
10171
10191
|
focusModelDownloadProgress: modelDownloadProgress,
|
|
10172
10192
|
focusModelError: modelError,
|
|
@@ -10175,7 +10195,7 @@
|
|
|
10175
10195
|
focusThresholds: focusThresholds,
|
|
10176
10196
|
setFocusThresholds: setFocusThresholds
|
|
10177
10197
|
};
|
|
10178
|
-
}, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
10198
|
+
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
10179
10199
|
return /*#__PURE__*/React.createElement(FocusModelContext.Provider, {
|
|
10180
10200
|
value: value
|
|
10181
10201
|
}, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -10236,6 +10256,9 @@
|
|
|
10236
10256
|
stop: function stop() {
|
|
10237
10257
|
return null;
|
|
10238
10258
|
},
|
|
10259
|
+
load: function load() {
|
|
10260
|
+
return null;
|
|
10261
|
+
},
|
|
10239
10262
|
modelDownloadProgress: 0,
|
|
10240
10263
|
modelError: null,
|
|
10241
10264
|
thresholds: defaultIdCaptureThresholds,
|
|
@@ -10275,6 +10298,7 @@
|
|
|
10275
10298
|
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
10276
10299
|
startDocumentDetection = _c.startDocumentDetection,
|
|
10277
10300
|
stopDocumentDetection = _c.stopDocumentDetection,
|
|
10301
|
+
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
10278
10302
|
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
10279
10303
|
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
10280
10304
|
onDocumentDetected = _c.onDocumentDetected,
|
|
@@ -10285,6 +10309,7 @@
|
|
|
10285
10309
|
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
10286
10310
|
documentDetectionModelError = _c.documentDetectionModelError;
|
|
10287
10311
|
var _d = React.useContext(FocusModelContext),
|
|
10312
|
+
loadFocusModel = _d.loadFocusModel,
|
|
10288
10313
|
focusModelReady = _d.focusModelReady,
|
|
10289
10314
|
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
10290
10315
|
makeFocusPrediction = _d.makeFocusPrediction,
|
|
@@ -10390,6 +10415,10 @@
|
|
|
10390
10415
|
React.useEffect(function () {
|
|
10391
10416
|
if (requiredDocumentType) resetBestFrame();
|
|
10392
10417
|
}, [requiredDocumentType, resetBestFrame]);
|
|
10418
|
+
var load = React.useCallback(function () {
|
|
10419
|
+
loadDocumentDetectionModel();
|
|
10420
|
+
loadFocusModel();
|
|
10421
|
+
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
10393
10422
|
var value = React.useMemo(function () {
|
|
10394
10423
|
return {
|
|
10395
10424
|
ready: documentDetectionModelReady && focusModelReady,
|
|
@@ -10397,6 +10426,7 @@
|
|
|
10397
10426
|
modelError: modelError,
|
|
10398
10427
|
start: startDocumentDetection,
|
|
10399
10428
|
stop: stopDocumentDetection,
|
|
10429
|
+
load: load,
|
|
10400
10430
|
thresholds: thresholds,
|
|
10401
10431
|
setThresholds: setThresholds,
|
|
10402
10432
|
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
@@ -10410,7 +10440,7 @@
|
|
|
10410
10440
|
requiredDocumentType: requiredDocumentType,
|
|
10411
10441
|
setRequiredDocumentType: setRequiredDocumentType
|
|
10412
10442
|
};
|
|
10413
|
-
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
10443
|
+
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
10414
10444
|
return /*#__PURE__*/React.createElement(IdCaptureModelsContext.Provider, {
|
|
10415
10445
|
value: value
|
|
10416
10446
|
}, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -18185,6 +18215,7 @@
|
|
|
18185
18215
|
state = _d[0],
|
|
18186
18216
|
dispatch = _d[1];
|
|
18187
18217
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
18218
|
+
var loadModels = React.useContext(IdCaptureModelsContext).load;
|
|
18188
18219
|
var _e = React.useState(false),
|
|
18189
18220
|
selectIdTypeModalOpen = _e[0],
|
|
18190
18221
|
setSelectIdTypeModalOpen = _e[1];
|
|
@@ -18217,6 +18248,7 @@
|
|
|
18217
18248
|
className: classNames.captureWithCameraButton,
|
|
18218
18249
|
colors: buttonColors,
|
|
18219
18250
|
onClick: function onClick() {
|
|
18251
|
+
loadModels();
|
|
18220
18252
|
void requestCameraAccess();
|
|
18221
18253
|
dispatch({
|
|
18222
18254
|
type: 'setUploadingDocumentsFromStorage',
|