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
package/dist/sdk2.esm.js
CHANGED
|
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
203
203
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
var webSdkVersion = '2.2.
|
|
206
|
+
var webSdkVersion = '2.2.98';
|
|
207
207
|
|
|
208
208
|
function getPlatform() {
|
|
209
209
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1399,14 +1399,15 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1399
1399
|
if (!documentServiceUrl) return [3 /*break*/, 8];
|
|
1400
1400
|
return [4 /*yield*/, Promise.all(Object.keys(documents).map(function (k) {
|
|
1401
1401
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1402
|
-
var _a, _b;
|
|
1402
|
+
var filetype, _a, _b;
|
|
1403
1403
|
return __generator(this, function (_c) {
|
|
1404
1404
|
switch (_c.label) {
|
|
1405
1405
|
case 0:
|
|
1406
1406
|
if (!documents[k]) return [3 /*break*/, 2];
|
|
1407
|
+
filetype = k.endsWith('Video') ? 'video/mp4' : k.endsWith('Audio') ? 'audio/mp4' : 'image/jpeg';
|
|
1407
1408
|
_a = documents;
|
|
1408
1409
|
_b = k;
|
|
1409
|
-
return [4 /*yield*/, uploadIfPossible(documents[k], k)];
|
|
1410
|
+
return [4 /*yield*/, uploadIfPossible(documents[k], k, filetype)];
|
|
1410
1411
|
case 1:
|
|
1411
1412
|
_a[_b] = _c.sent();
|
|
1412
1413
|
_c.label = 2;
|
|
@@ -3835,6 +3836,9 @@ var DocumentDetectionModelContext = /*#__PURE__*/createContext({
|
|
|
3835
3836
|
stopDocumentDetection: function stopDocumentDetection() {
|
|
3836
3837
|
return null;
|
|
3837
3838
|
},
|
|
3839
|
+
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
3840
|
+
return null;
|
|
3841
|
+
},
|
|
3838
3842
|
documentDetectionModelReady: false,
|
|
3839
3843
|
documentDetectionModelDownloadProgress: 0,
|
|
3840
3844
|
documentDetectionModelError: null,
|
|
@@ -3874,7 +3878,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3874
3878
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
3875
3879
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
3876
3880
|
_h = _a.shouldLoadModels,
|
|
3877
|
-
|
|
3881
|
+
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
3878
3882
|
var _j = useCameraStore(),
|
|
3879
3883
|
videoRef = _j.videoRef,
|
|
3880
3884
|
videoLoaded = _j.videoLoaded,
|
|
@@ -3894,7 +3898,13 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3894
3898
|
canvasKey = _o[0],
|
|
3895
3899
|
setCanvasKey = _o[1];
|
|
3896
3900
|
var stopDetection = useRef(0);
|
|
3897
|
-
var _p =
|
|
3901
|
+
var _p = useState(shouldLoadModelsProp),
|
|
3902
|
+
shouldLoadModels = _p[0],
|
|
3903
|
+
setShouldLoadModels = _p[1];
|
|
3904
|
+
var load = useCallback(function () {
|
|
3905
|
+
return setShouldLoadModels(true);
|
|
3906
|
+
}, []);
|
|
3907
|
+
var _q = useLoadDocumentDetector({
|
|
3898
3908
|
modelPath: documentDetectionModelPath,
|
|
3899
3909
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
3900
3910
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
@@ -3902,11 +3912,11 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3902
3912
|
videoRef: videoRef,
|
|
3903
3913
|
shouldLoadModels: shouldLoadModels
|
|
3904
3914
|
}),
|
|
3905
|
-
ready =
|
|
3906
|
-
modelDownloadProgress =
|
|
3907
|
-
modelError =
|
|
3908
|
-
setModelError =
|
|
3909
|
-
var
|
|
3915
|
+
ready = _q.ready,
|
|
3916
|
+
modelDownloadProgress = _q.modelDownloadProgress,
|
|
3917
|
+
modelError = _q.modelError,
|
|
3918
|
+
setModelError = _q.setModelError;
|
|
3919
|
+
var _r = useFrameLoop(useCallback(function (frameId, timeRunning) {
|
|
3910
3920
|
return __awaiter(_this, void 0, void 0, function () {
|
|
3911
3921
|
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
3912
3922
|
var _a;
|
|
@@ -3949,8 +3959,8 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3949
3959
|
throttleMs: throttleMs,
|
|
3950
3960
|
autoStart: autoStart
|
|
3951
3961
|
}),
|
|
3952
|
-
start =
|
|
3953
|
-
stop =
|
|
3962
|
+
start = _r.start,
|
|
3963
|
+
stop = _r.stop;
|
|
3954
3964
|
useEffect(function setErrorIfAllZero() {
|
|
3955
3965
|
if (timesAllZero >= 2) {
|
|
3956
3966
|
setModelError(new Error('model is returning all zeroes'));
|
|
@@ -3969,6 +3979,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3969
3979
|
return {
|
|
3970
3980
|
startDocumentDetection: start,
|
|
3971
3981
|
stopDocumentDetection: stop,
|
|
3982
|
+
loadDocumentDetectionModel: load,
|
|
3972
3983
|
documentDetectionModelReady: ready,
|
|
3973
3984
|
documentDetectionModelError: modelError,
|
|
3974
3985
|
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
@@ -3981,7 +3992,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3981
3992
|
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
3982
3993
|
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
3983
3994
|
};
|
|
3984
|
-
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
3995
|
+
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
3985
3996
|
return /*#__PURE__*/React.createElement(DocumentDetectionModelContext.Provider, {
|
|
3986
3997
|
value: value
|
|
3987
3998
|
}, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -3991,6 +4002,9 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3991
4002
|
}
|
|
3992
4003
|
|
|
3993
4004
|
var FocusModelContext = /*#__PURE__*/createContext({
|
|
4005
|
+
loadFocusModel: function loadFocusModel() {
|
|
4006
|
+
return null;
|
|
4007
|
+
},
|
|
3994
4008
|
focusModelReady: false,
|
|
3995
4009
|
focusModelDownloadProgress: 0,
|
|
3996
4010
|
focusModelError: null,
|
|
@@ -4013,23 +4027,29 @@ function FocusModelProvider(_a) {
|
|
|
4013
4027
|
_d = _a.showCanvases,
|
|
4014
4028
|
showCanvases = _d === void 0 ? false : _d,
|
|
4015
4029
|
_e = _a.shouldLoadModels,
|
|
4016
|
-
|
|
4030
|
+
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
4017
4031
|
var cropCanvas = useRef(null);
|
|
4018
4032
|
var rotateCanvas = useRef(null);
|
|
4019
4033
|
var _f = useState({}),
|
|
4020
4034
|
focusThresholds = _f[0],
|
|
4021
4035
|
setFocusThresholds = _f[1];
|
|
4022
4036
|
var videoRef = useCameraStore().videoRef;
|
|
4023
|
-
var _g =
|
|
4037
|
+
var _g = useState(shouldLoadModelsProp),
|
|
4038
|
+
shouldLoadModels = _g[0],
|
|
4039
|
+
setShouldLoadModels = _g[1];
|
|
4040
|
+
var load = useCallback(function () {
|
|
4041
|
+
return setShouldLoadModels(true);
|
|
4042
|
+
}, []);
|
|
4043
|
+
var _h = useLoadFocusModel({
|
|
4024
4044
|
modelPath: focusModelPath,
|
|
4025
4045
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
4026
4046
|
onModelError: onFocusModelError,
|
|
4027
4047
|
videoRef: videoRef,
|
|
4028
4048
|
shouldLoadModels: shouldLoadModels
|
|
4029
4049
|
}),
|
|
4030
|
-
ready =
|
|
4031
|
-
modelDownloadProgress =
|
|
4032
|
-
modelError =
|
|
4050
|
+
ready = _h.ready,
|
|
4051
|
+
modelDownloadProgress = _h.modelDownloadProgress,
|
|
4052
|
+
modelError = _h.modelError;
|
|
4033
4053
|
var makeFocusPrediction = useCallback(function (imageData, box) {
|
|
4034
4054
|
if (!ready) return null;
|
|
4035
4055
|
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -4039,6 +4059,7 @@ function FocusModelProvider(_a) {
|
|
|
4039
4059
|
}, [ready]);
|
|
4040
4060
|
var value = useMemo(function () {
|
|
4041
4061
|
return {
|
|
4062
|
+
loadFocusModel: load,
|
|
4042
4063
|
focusModelReady: ready,
|
|
4043
4064
|
focusModelDownloadProgress: modelDownloadProgress,
|
|
4044
4065
|
focusModelError: modelError,
|
|
@@ -4047,7 +4068,7 @@ function FocusModelProvider(_a) {
|
|
|
4047
4068
|
focusThresholds: focusThresholds,
|
|
4048
4069
|
setFocusThresholds: setFocusThresholds
|
|
4049
4070
|
};
|
|
4050
|
-
}, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
4071
|
+
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
4051
4072
|
return /*#__PURE__*/React__default.createElement(FocusModelContext.Provider, {
|
|
4052
4073
|
value: value
|
|
4053
4074
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -4108,6 +4129,9 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
4108
4129
|
stop: function stop() {
|
|
4109
4130
|
return null;
|
|
4110
4131
|
},
|
|
4132
|
+
load: function load() {
|
|
4133
|
+
return null;
|
|
4134
|
+
},
|
|
4111
4135
|
modelDownloadProgress: 0,
|
|
4112
4136
|
modelError: null,
|
|
4113
4137
|
thresholds: defaultIdCaptureThresholds,
|
|
@@ -4147,6 +4171,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4147
4171
|
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
4148
4172
|
startDocumentDetection = _c.startDocumentDetection,
|
|
4149
4173
|
stopDocumentDetection = _c.stopDocumentDetection,
|
|
4174
|
+
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
4150
4175
|
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
4151
4176
|
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
4152
4177
|
onDocumentDetected = _c.onDocumentDetected,
|
|
@@ -4157,6 +4182,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4157
4182
|
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
4158
4183
|
documentDetectionModelError = _c.documentDetectionModelError;
|
|
4159
4184
|
var _d = useContext(FocusModelContext),
|
|
4185
|
+
loadFocusModel = _d.loadFocusModel,
|
|
4160
4186
|
focusModelReady = _d.focusModelReady,
|
|
4161
4187
|
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
4162
4188
|
makeFocusPrediction = _d.makeFocusPrediction,
|
|
@@ -4262,6 +4288,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4262
4288
|
useEffect(function () {
|
|
4263
4289
|
if (requiredDocumentType) resetBestFrame();
|
|
4264
4290
|
}, [requiredDocumentType, resetBestFrame]);
|
|
4291
|
+
var load = useCallback(function () {
|
|
4292
|
+
loadDocumentDetectionModel();
|
|
4293
|
+
loadFocusModel();
|
|
4294
|
+
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
4265
4295
|
var value = useMemo(function () {
|
|
4266
4296
|
return {
|
|
4267
4297
|
ready: documentDetectionModelReady && focusModelReady,
|
|
@@ -4269,6 +4299,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4269
4299
|
modelError: modelError,
|
|
4270
4300
|
start: startDocumentDetection,
|
|
4271
4301
|
stop: stopDocumentDetection,
|
|
4302
|
+
load: load,
|
|
4272
4303
|
thresholds: thresholds,
|
|
4273
4304
|
setThresholds: setThresholds,
|
|
4274
4305
|
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
@@ -4282,7 +4313,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4282
4313
|
requiredDocumentType: requiredDocumentType,
|
|
4283
4314
|
setRequiredDocumentType: setRequiredDocumentType
|
|
4284
4315
|
};
|
|
4285
|
-
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
4316
|
+
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
4286
4317
|
return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
|
|
4287
4318
|
value: value
|
|
4288
4319
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -9110,6 +9141,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9110
9141
|
state = _d[0],
|
|
9111
9142
|
dispatch = _d[1];
|
|
9112
9143
|
var requestCameraAccess = useCameraStore().requestCameraAccess;
|
|
9144
|
+
var loadModels = useContext(IdCaptureModelsContext).load;
|
|
9113
9145
|
var _e = useState(false),
|
|
9114
9146
|
selectIdTypeModalOpen = _e[0],
|
|
9115
9147
|
setSelectIdTypeModalOpen = _e[1];
|
|
@@ -9142,6 +9174,7 @@ function IdCaptureOrUploadScreen(_a) {
|
|
|
9142
9174
|
className: classNames.captureWithCameraButton,
|
|
9143
9175
|
colors: buttonColors,
|
|
9144
9176
|
onClick: function onClick() {
|
|
9177
|
+
loadModels();
|
|
9145
9178
|
void requestCameraAccess();
|
|
9146
9179
|
dispatch({
|
|
9147
9180
|
type: 'setUploadingDocumentsFromStorage',
|