idmission-web-sdk 2.2.60 → 2.2.62
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/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +0 -2
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +2 -4
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +0 -4
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/lib/models/defaults/DocumentDetector.d.ts +1 -1
- package/dist/sdk2.cjs.development.js +21 -41
- 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 +21 -41
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +21 -41
- 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.62';
|
|
207
207
|
|
|
208
208
|
function getPlatform() {
|
|
209
209
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2238,7 +2238,7 @@ function average(arr) {
|
|
|
2238
2238
|
|
|
2239
2239
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
2240
2240
|
|
|
2241
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
2241
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
|
|
2242
2242
|
|
|
2243
2243
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
2244
2244
|
|
|
@@ -2257,10 +2257,6 @@ var defaultFocusThresholds = {
|
|
|
2257
2257
|
passport: {
|
|
2258
2258
|
desktop: 0,
|
|
2259
2259
|
mobile: 0.3
|
|
2260
|
-
},
|
|
2261
|
-
singlePage: {
|
|
2262
|
-
desktop: 0,
|
|
2263
|
-
mobile: 0.3
|
|
2264
2260
|
}
|
|
2265
2261
|
};
|
|
2266
2262
|
var classifier = null;
|
|
@@ -2886,19 +2882,16 @@ var defaultDocumentDetectionThresholds = {
|
|
|
2886
2882
|
idCardFront: 0.6,
|
|
2887
2883
|
idCardBack: 0.6,
|
|
2888
2884
|
passport: 0.4,
|
|
2889
|
-
singlePage: 0.4,
|
|
2890
2885
|
stability: {
|
|
2891
2886
|
idCardFront: 0.85,
|
|
2892
2887
|
idCardBack: 0.85,
|
|
2893
|
-
passport: 0.5
|
|
2894
|
-
singlePage: 0.5
|
|
2888
|
+
passport: 0.5
|
|
2895
2889
|
}
|
|
2896
2890
|
};
|
|
2897
2891
|
var documentTypeDisplayNames = {
|
|
2898
2892
|
idCardFront: 'ID card front',
|
|
2899
2893
|
idCardBack: 'ID card back',
|
|
2900
2894
|
passport: 'Passport',
|
|
2901
|
-
singlePage: 'Single page',
|
|
2902
2895
|
none: 'None'
|
|
2903
2896
|
};
|
|
2904
2897
|
var detector = null;
|
|
@@ -3087,7 +3080,7 @@ var defaultDocumentDetectionBoundaries = {
|
|
|
3087
3080
|
right: 20
|
|
3088
3081
|
};
|
|
3089
3082
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
3090
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
3083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
3091
3084
|
if (boundaries === void 0) {
|
|
3092
3085
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
3093
3086
|
}
|
|
@@ -3138,25 +3131,18 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
3138
3131
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
3139
3132
|
return obj.label === 'Passport page';
|
|
3140
3133
|
});
|
|
3141
|
-
var bestSinglePage = detectedObjects.find(function (obj) {
|
|
3142
|
-
return obj.label === 'Single page';
|
|
3143
|
-
});
|
|
3144
3134
|
var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
|
|
3145
3135
|
var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
|
|
3146
3136
|
var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
|
|
3147
|
-
var
|
|
3148
|
-
var
|
|
3149
|
-
var
|
|
3150
|
-
var
|
|
3151
|
-
var
|
|
3152
|
-
var
|
|
3153
|
-
var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
3154
|
-
var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
|
|
3137
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
|
|
3138
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
|
|
3139
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
|
|
3140
|
+
var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
3141
|
+
var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
3142
|
+
var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
|
|
3155
3143
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
3156
3144
|
var detectedDocumentType = 'none';
|
|
3157
|
-
if (
|
|
3158
|
-
detectedDocumentType = 'singlePage';
|
|
3159
|
-
} else if (passportDetectionThresholdMet) {
|
|
3145
|
+
if (passportDetectionThresholdMet) {
|
|
3160
3146
|
detectedDocumentType = 'passport';
|
|
3161
3147
|
} else if (idCardBackDetectionThresholdMet) {
|
|
3162
3148
|
detectedDocumentType = 'idCardBack';
|
|
@@ -3170,12 +3156,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
3170
3156
|
var documentIsStable = false;
|
|
3171
3157
|
var documentTooClose = false;
|
|
3172
3158
|
if (bestDocument) {
|
|
3173
|
-
var
|
|
3174
|
-
docWidth =
|
|
3175
|
-
docHeight =
|
|
3159
|
+
var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
3160
|
+
docWidth = _o[0],
|
|
3161
|
+
docHeight = _o[1];
|
|
3176
3162
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
3177
3163
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
3178
|
-
var thresholdSet = (
|
|
3164
|
+
var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
|
|
3179
3165
|
var threshold_1 = thresholdSet[detectedDocumentType];
|
|
3180
3166
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
3181
3167
|
trackBox(bestDocument.box, framesNeeded);
|
|
@@ -4144,8 +4130,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4144
4130
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
4145
4131
|
stopDetectionAtStart = stopDetection.current;
|
|
4146
4132
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
4147
|
-
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType))
|
|
4148
|
-
;
|
|
4133
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
|
|
4149
4134
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
4150
4135
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
|
|
4151
4136
|
if (focusPrediction) {
|
|
@@ -4293,8 +4278,6 @@ var initialState$4 = {
|
|
|
4293
4278
|
idCardBackDetectionThresholdMet: false,
|
|
4294
4279
|
passportDetectionScore: 0,
|
|
4295
4280
|
passportDetectionThresholdMet: false,
|
|
4296
|
-
singlePageDetectionScore: 0,
|
|
4297
|
-
singlePageDetectionThresholdMet: false,
|
|
4298
4281
|
focusScore: 0,
|
|
4299
4282
|
focusThresholdMet: false,
|
|
4300
4283
|
isGoodFrame: false,
|
|
@@ -5247,7 +5230,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
5247
5230
|
scaling: debugScalingDetails,
|
|
5248
5231
|
flipX: !isRearFacing
|
|
5249
5232
|
});
|
|
5250
|
-
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.
|
|
5233
|
+
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
5251
5234
|
};
|
|
5252
5235
|
var timeSince = function timeSince(t) {
|
|
5253
5236
|
if (!t) return 0;
|
|
@@ -11267,14 +11250,11 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11267
11250
|
}, [isRecording, isRecordingVideo, startRecordingVideo, videoUrl]);
|
|
11268
11251
|
var animationFrame = useRef(0);
|
|
11269
11252
|
useEffect(function () {
|
|
11270
|
-
var _a;
|
|
11271
11253
|
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
|
|
11272
|
-
var
|
|
11273
|
-
w =
|
|
11274
|
-
h =
|
|
11275
|
-
var isPortrait =
|
|
11276
|
-
var cameraIsLandscape = w > h;
|
|
11277
|
-
if (isPortrait && cameraIsLandscape) _a = [h, w], w = _a[0], h = _a[1];
|
|
11254
|
+
var _a = [camera.width, camera.height],
|
|
11255
|
+
w = _a[0],
|
|
11256
|
+
h = _a[1];
|
|
11257
|
+
var isPortrait = w < h;
|
|
11278
11258
|
outputCanvas.current.width = w;
|
|
11279
11259
|
outputCanvas.current.height = h;
|
|
11280
11260
|
var ctx = outputCanvas.current.getContext('2d');
|