idmission-web-sdk 2.2.96 → 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/components/submission/SubmissionProvider.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +53 -20
- 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 +53 -20
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +53 -20
- 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
|
|
@@ -2371,14 +2371,15 @@
|
|
|
2371
2371
|
if (!documentServiceUrl) return [3 /*break*/, 8];
|
|
2372
2372
|
return [4 /*yield*/, Promise.all(Object.keys(documents).map(function (k) {
|
|
2373
2373
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
2374
|
-
var _a, _b;
|
|
2374
|
+
var filetype, _a, _b;
|
|
2375
2375
|
return __generator(this, function (_c) {
|
|
2376
2376
|
switch (_c.label) {
|
|
2377
2377
|
case 0:
|
|
2378
2378
|
if (!documents[k]) return [3 /*break*/, 2];
|
|
2379
|
+
filetype = k.endsWith('Video') ? 'video/mp4' : k.endsWith('Audio') ? 'audio/mp4' : 'image/jpeg';
|
|
2379
2380
|
_a = documents;
|
|
2380
2381
|
_b = k;
|
|
2381
|
-
return [4 /*yield*/, uploadIfPossible(documents[k], k)];
|
|
2382
|
+
return [4 /*yield*/, uploadIfPossible(documents[k], k, filetype)];
|
|
2382
2383
|
case 1:
|
|
2383
2384
|
_a[_b] = _c.sent();
|
|
2384
2385
|
_c.label = 2;
|
|
@@ -9962,6 +9963,9 @@
|
|
|
9962
9963
|
stopDocumentDetection: function stopDocumentDetection() {
|
|
9963
9964
|
return null;
|
|
9964
9965
|
},
|
|
9966
|
+
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
9967
|
+
return null;
|
|
9968
|
+
},
|
|
9965
9969
|
documentDetectionModelReady: false,
|
|
9966
9970
|
documentDetectionModelDownloadProgress: 0,
|
|
9967
9971
|
documentDetectionModelError: null,
|
|
@@ -10001,7 +10005,7 @@
|
|
|
10001
10005
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
10002
10006
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
10003
10007
|
_h = _a.shouldLoadModels,
|
|
10004
|
-
|
|
10008
|
+
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
10005
10009
|
var _j = useCameraStore(),
|
|
10006
10010
|
videoRef = _j.videoRef,
|
|
10007
10011
|
videoLoaded = _j.videoLoaded,
|
|
@@ -10021,7 +10025,13 @@
|
|
|
10021
10025
|
canvasKey = _o[0],
|
|
10022
10026
|
setCanvasKey = _o[1];
|
|
10023
10027
|
var stopDetection = React.useRef(0);
|
|
10024
|
-
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({
|
|
10025
10035
|
modelPath: documentDetectionModelPath,
|
|
10026
10036
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
10027
10037
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
@@ -10029,11 +10039,11 @@
|
|
|
10029
10039
|
videoRef: videoRef,
|
|
10030
10040
|
shouldLoadModels: shouldLoadModels
|
|
10031
10041
|
}),
|
|
10032
|
-
ready =
|
|
10033
|
-
modelDownloadProgress =
|
|
10034
|
-
modelError =
|
|
10035
|
-
setModelError =
|
|
10036
|
-
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) {
|
|
10037
10047
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10038
10048
|
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
10039
10049
|
var _a;
|
|
@@ -10076,8 +10086,8 @@
|
|
|
10076
10086
|
throttleMs: throttleMs,
|
|
10077
10087
|
autoStart: autoStart
|
|
10078
10088
|
}),
|
|
10079
|
-
start =
|
|
10080
|
-
stop =
|
|
10089
|
+
start = _r.start,
|
|
10090
|
+
stop = _r.stop;
|
|
10081
10091
|
React.useEffect(function setErrorIfAllZero() {
|
|
10082
10092
|
if (timesAllZero >= 2) {
|
|
10083
10093
|
setModelError(new Error('model is returning all zeroes'));
|
|
@@ -10096,6 +10106,7 @@
|
|
|
10096
10106
|
return {
|
|
10097
10107
|
startDocumentDetection: start,
|
|
10098
10108
|
stopDocumentDetection: stop,
|
|
10109
|
+
loadDocumentDetectionModel: load,
|
|
10099
10110
|
documentDetectionModelReady: ready,
|
|
10100
10111
|
documentDetectionModelError: modelError,
|
|
10101
10112
|
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
@@ -10108,7 +10119,7 @@
|
|
|
10108
10119
|
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
10109
10120
|
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
10110
10121
|
};
|
|
10111
|
-
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
10122
|
+
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
10112
10123
|
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
10113
10124
|
value: value
|
|
10114
10125
|
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
@@ -10118,6 +10129,9 @@
|
|
|
10118
10129
|
}
|
|
10119
10130
|
|
|
10120
10131
|
var FocusModelContext = /*#__PURE__*/React.createContext({
|
|
10132
|
+
loadFocusModel: function loadFocusModel() {
|
|
10133
|
+
return null;
|
|
10134
|
+
},
|
|
10121
10135
|
focusModelReady: false,
|
|
10122
10136
|
focusModelDownloadProgress: 0,
|
|
10123
10137
|
focusModelError: null,
|
|
@@ -10140,23 +10154,29 @@
|
|
|
10140
10154
|
_d = _a.showCanvases,
|
|
10141
10155
|
showCanvases = _d === void 0 ? false : _d,
|
|
10142
10156
|
_e = _a.shouldLoadModels,
|
|
10143
|
-
|
|
10157
|
+
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
10144
10158
|
var cropCanvas = React.useRef(null);
|
|
10145
10159
|
var rotateCanvas = React.useRef(null);
|
|
10146
10160
|
var _f = React.useState({}),
|
|
10147
10161
|
focusThresholds = _f[0],
|
|
10148
10162
|
setFocusThresholds = _f[1];
|
|
10149
10163
|
var videoRef = useCameraStore().videoRef;
|
|
10150
|
-
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({
|
|
10151
10171
|
modelPath: focusModelPath,
|
|
10152
10172
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
10153
10173
|
onModelError: onFocusModelError,
|
|
10154
10174
|
videoRef: videoRef,
|
|
10155
10175
|
shouldLoadModels: shouldLoadModels
|
|
10156
10176
|
}),
|
|
10157
|
-
ready =
|
|
10158
|
-
modelDownloadProgress =
|
|
10159
|
-
modelError =
|
|
10177
|
+
ready = _h.ready,
|
|
10178
|
+
modelDownloadProgress = _h.modelDownloadProgress,
|
|
10179
|
+
modelError = _h.modelError;
|
|
10160
10180
|
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
10161
10181
|
if (!ready) return null;
|
|
10162
10182
|
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -10166,6 +10186,7 @@
|
|
|
10166
10186
|
}, [ready]);
|
|
10167
10187
|
var value = React.useMemo(function () {
|
|
10168
10188
|
return {
|
|
10189
|
+
loadFocusModel: load,
|
|
10169
10190
|
focusModelReady: ready,
|
|
10170
10191
|
focusModelDownloadProgress: modelDownloadProgress,
|
|
10171
10192
|
focusModelError: modelError,
|
|
@@ -10174,7 +10195,7 @@
|
|
|
10174
10195
|
focusThresholds: focusThresholds,
|
|
10175
10196
|
setFocusThresholds: setFocusThresholds
|
|
10176
10197
|
};
|
|
10177
|
-
}, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
10198
|
+
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
10178
10199
|
return /*#__PURE__*/React.createElement(FocusModelContext.Provider, {
|
|
10179
10200
|
value: value
|
|
10180
10201
|
}, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -10235,6 +10256,9 @@
|
|
|
10235
10256
|
stop: function stop() {
|
|
10236
10257
|
return null;
|
|
10237
10258
|
},
|
|
10259
|
+
load: function load() {
|
|
10260
|
+
return null;
|
|
10261
|
+
},
|
|
10238
10262
|
modelDownloadProgress: 0,
|
|
10239
10263
|
modelError: null,
|
|
10240
10264
|
thresholds: defaultIdCaptureThresholds,
|
|
@@ -10274,6 +10298,7 @@
|
|
|
10274
10298
|
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
10275
10299
|
startDocumentDetection = _c.startDocumentDetection,
|
|
10276
10300
|
stopDocumentDetection = _c.stopDocumentDetection,
|
|
10301
|
+
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
10277
10302
|
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
10278
10303
|
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
10279
10304
|
onDocumentDetected = _c.onDocumentDetected,
|
|
@@ -10284,6 +10309,7 @@
|
|
|
10284
10309
|
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
10285
10310
|
documentDetectionModelError = _c.documentDetectionModelError;
|
|
10286
10311
|
var _d = React.useContext(FocusModelContext),
|
|
10312
|
+
loadFocusModel = _d.loadFocusModel,
|
|
10287
10313
|
focusModelReady = _d.focusModelReady,
|
|
10288
10314
|
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
10289
10315
|
makeFocusPrediction = _d.makeFocusPrediction,
|
|
@@ -10389,6 +10415,10 @@
|
|
|
10389
10415
|
React.useEffect(function () {
|
|
10390
10416
|
if (requiredDocumentType) resetBestFrame();
|
|
10391
10417
|
}, [requiredDocumentType, resetBestFrame]);
|
|
10418
|
+
var load = React.useCallback(function () {
|
|
10419
|
+
loadDocumentDetectionModel();
|
|
10420
|
+
loadFocusModel();
|
|
10421
|
+
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
10392
10422
|
var value = React.useMemo(function () {
|
|
10393
10423
|
return {
|
|
10394
10424
|
ready: documentDetectionModelReady && focusModelReady,
|
|
@@ -10396,6 +10426,7 @@
|
|
|
10396
10426
|
modelError: modelError,
|
|
10397
10427
|
start: startDocumentDetection,
|
|
10398
10428
|
stop: stopDocumentDetection,
|
|
10429
|
+
load: load,
|
|
10399
10430
|
thresholds: thresholds,
|
|
10400
10431
|
setThresholds: setThresholds,
|
|
10401
10432
|
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
@@ -10409,7 +10440,7 @@
|
|
|
10409
10440
|
requiredDocumentType: requiredDocumentType,
|
|
10410
10441
|
setRequiredDocumentType: setRequiredDocumentType
|
|
10411
10442
|
};
|
|
10412
|
-
}, [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]);
|
|
10413
10444
|
return /*#__PURE__*/React.createElement(IdCaptureModelsContext.Provider, {
|
|
10414
10445
|
value: value
|
|
10415
10446
|
}, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -18184,6 +18215,7 @@
|
|
|
18184
18215
|
state = _d[0],
|
|
18185
18216
|
dispatch = _d[1];
|
|
18186
18217
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
18218
|
+
var loadModels = React.useContext(IdCaptureModelsContext).load;
|
|
18187
18219
|
var _e = React.useState(false),
|
|
18188
18220
|
selectIdTypeModalOpen = _e[0],
|
|
18189
18221
|
setSelectIdTypeModalOpen = _e[1];
|
|
@@ -18216,6 +18248,7 @@
|
|
|
18216
18248
|
className: classNames.captureWithCameraButton,
|
|
18217
18249
|
colors: buttonColors,
|
|
18218
18250
|
onClick: function onClick() {
|
|
18251
|
+
loadModels();
|
|
18219
18252
|
void requestCameraAccess();
|
|
18220
18253
|
dispatch({
|
|
18221
18254
|
type: 'setUploadingDocumentsFromStorage',
|