idmission-web-sdk 2.2.27 → 2.2.28
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/lib/models/DocumentDetection.d.ts +1 -0
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/FaceDetection.d.ts +2 -1
- package/dist/lib/models/FaceDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +1 -0
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +58 -13
- 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 +58 -13
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +58 -13
- 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
|
@@ -201,7 +201,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
201
201
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
202
202
|
};
|
|
203
203
|
|
|
204
|
-
var webSdkVersion = '2.2.
|
|
204
|
+
var webSdkVersion = '2.2.28';
|
|
205
205
|
|
|
206
206
|
function getPlatform() {
|
|
207
207
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2821,6 +2821,15 @@ function loadFocusModel() {
|
|
|
2821
2821
|
});
|
|
2822
2822
|
});
|
|
2823
2823
|
}
|
|
2824
|
+
function closeFocusModel(modelAssetPath) {
|
|
2825
|
+
if (modelAssetPath === void 0) {
|
|
2826
|
+
modelAssetPath = defaultFocusModelPath;
|
|
2827
|
+
}
|
|
2828
|
+
var id = "".concat(modelAssetPath);
|
|
2829
|
+
if (!models[id]) return;
|
|
2830
|
+
models[id].close();
|
|
2831
|
+
delete models[id];
|
|
2832
|
+
}
|
|
2824
2833
|
function useLoadFocusModel(_a) {
|
|
2825
2834
|
var _b = _a.modelPath,
|
|
2826
2835
|
modelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
@@ -2873,6 +2882,9 @@ function useLoadFocusModel(_a) {
|
|
|
2873
2882
|
clearTimeout(modelLoadTimeout);
|
|
2874
2883
|
});
|
|
2875
2884
|
return function () {
|
|
2885
|
+
log('unloading focus model', model.current);
|
|
2886
|
+
model.current = null;
|
|
2887
|
+
closeFocusModel(modelPath);
|
|
2876
2888
|
clearTimeout(modelLoadTimeout);
|
|
2877
2889
|
document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
|
|
2878
2890
|
};
|
|
@@ -2926,38 +2938,53 @@ function cropIfNecessary(imageData, cropCanvas, rotateCanvas, box) {
|
|
|
2926
2938
|
}
|
|
2927
2939
|
|
|
2928
2940
|
var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
2929
|
-
var
|
|
2941
|
+
var detectors$1 = {};
|
|
2930
2942
|
function loadFaceDetector() {
|
|
2931
|
-
return __awaiter(this,
|
|
2932
|
-
var _a, _b;
|
|
2933
|
-
|
|
2934
|
-
|
|
2943
|
+
return __awaiter(this, arguments, void 0, function (modelAssetPath) {
|
|
2944
|
+
var id, _a, _b, _c, _d;
|
|
2945
|
+
if (modelAssetPath === void 0) {
|
|
2946
|
+
modelAssetPath = defaultFaceDetectorModelPath;
|
|
2947
|
+
}
|
|
2948
|
+
return __generator(this, function (_e) {
|
|
2949
|
+
switch (_e.label) {
|
|
2935
2950
|
case 0:
|
|
2936
|
-
|
|
2951
|
+
id = "".concat(modelAssetPath);
|
|
2952
|
+
if (detectors$1[id]) return [2 /*return*/, detectors$1[id]];
|
|
2937
2953
|
return [4 /*yield*/, preloadFaceDetectorDependencies()];
|
|
2938
2954
|
case 1:
|
|
2939
|
-
|
|
2955
|
+
_e.sent();
|
|
2940
2956
|
if (modelCapabilities.delegate === 'NONE') {
|
|
2941
2957
|
throw new Error('No available delegate for face detector.');
|
|
2942
2958
|
}
|
|
2943
|
-
|
|
2959
|
+
_a = detectors$1;
|
|
2960
|
+
_b = id;
|
|
2961
|
+
_d = (_c = FaceDetector).createFromOptions;
|
|
2944
2962
|
return [4 /*yield*/, FilesetResolver.forVisionTasks(visionTasksBasePath)];
|
|
2945
2963
|
case 2:
|
|
2946
|
-
return [4 /*yield*/,
|
|
2964
|
+
return [4 /*yield*/, _d.apply(_c, [_e.sent(), {
|
|
2947
2965
|
// canvas: document.createElement('canvas'),
|
|
2948
2966
|
baseOptions: {
|
|
2949
|
-
modelAssetPath:
|
|
2967
|
+
modelAssetPath: modelAssetPath,
|
|
2950
2968
|
delegate: modelCapabilities.delegate
|
|
2951
2969
|
},
|
|
2952
2970
|
runningMode: 'VIDEO'
|
|
2953
2971
|
}])];
|
|
2954
2972
|
case 3:
|
|
2955
|
-
|
|
2956
|
-
return [2 /*return*/,
|
|
2973
|
+
_a[_b] = _e.sent();
|
|
2974
|
+
return [2 /*return*/, detectors$1[id]];
|
|
2957
2975
|
}
|
|
2958
2976
|
});
|
|
2959
2977
|
});
|
|
2960
2978
|
}
|
|
2979
|
+
function closeFaceDetector(modelAssetPath) {
|
|
2980
|
+
if (modelAssetPath === void 0) {
|
|
2981
|
+
modelAssetPath = defaultFaceDetectorModelPath;
|
|
2982
|
+
}
|
|
2983
|
+
var id = "".concat(modelAssetPath);
|
|
2984
|
+
if (!detectors$1[id]) return;
|
|
2985
|
+
detectors$1[id].close();
|
|
2986
|
+
delete detectors$1[id];
|
|
2987
|
+
}
|
|
2961
2988
|
function useLoadFaceDetector(_a) {
|
|
2962
2989
|
var onModelError = _a.onModelError,
|
|
2963
2990
|
_b = _a.modelLoadTimeoutMs,
|
|
@@ -3006,6 +3033,9 @@ function useLoadFaceDetector(_a) {
|
|
|
3006
3033
|
clearTimeout(modelLoadTimeout);
|
|
3007
3034
|
});
|
|
3008
3035
|
return function () {
|
|
3036
|
+
log('unloading face detection model', detector.current);
|
|
3037
|
+
detector.current = null;
|
|
3038
|
+
closeFaceDetector();
|
|
3009
3039
|
clearTimeout(modelLoadTimeout);
|
|
3010
3040
|
document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
3011
3041
|
};
|
|
@@ -3428,6 +3458,18 @@ function loadDocumentDetector() {
|
|
|
3428
3458
|
});
|
|
3429
3459
|
});
|
|
3430
3460
|
}
|
|
3461
|
+
function closeDocumentDetector(modelAssetPath, scoreThreshold) {
|
|
3462
|
+
if (modelAssetPath === void 0) {
|
|
3463
|
+
modelAssetPath = defaultDocumentDetectorModelPath;
|
|
3464
|
+
}
|
|
3465
|
+
if (scoreThreshold === void 0) {
|
|
3466
|
+
scoreThreshold = defaultDocumentDetectionScoreThreshold;
|
|
3467
|
+
}
|
|
3468
|
+
var id = "".concat(modelAssetPath, ":").concat(scoreThreshold);
|
|
3469
|
+
if (!detectors[id]) return;
|
|
3470
|
+
detectors[id].close();
|
|
3471
|
+
delete detectors[id];
|
|
3472
|
+
}
|
|
3431
3473
|
function useLoadDocumentDetector(_a) {
|
|
3432
3474
|
var _b = _a.modelPath,
|
|
3433
3475
|
modelPath = _b === void 0 ? defaultDocumentDetectorModelPath : _b,
|
|
@@ -3482,6 +3524,9 @@ function useLoadDocumentDetector(_a) {
|
|
|
3482
3524
|
clearTimeout(modelLoadTimeout);
|
|
3483
3525
|
});
|
|
3484
3526
|
return function () {
|
|
3527
|
+
log('unloading document detection model');
|
|
3528
|
+
detector.current = null;
|
|
3529
|
+
closeDocumentDetector(modelPath, scoreThreshold);
|
|
3485
3530
|
clearTimeout(modelLoadTimeout);
|
|
3486
3531
|
document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
|
|
3487
3532
|
};
|