idmission-web-sdk 2.2.58 → 2.2.60
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 +2 -0
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +4 -2
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +4 -0
- 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 +34 -17
- 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 +34 -17
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +34 -17
- 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 +3 -3
|
@@ -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.60';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -8311,7 +8311,7 @@
|
|
|
8311
8311
|
|
|
8312
8312
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
8313
8313
|
|
|
8314
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
8314
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241212_131026.tflite");
|
|
8315
8315
|
|
|
8316
8316
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
8317
8317
|
|
|
@@ -8330,6 +8330,10 @@
|
|
|
8330
8330
|
passport: {
|
|
8331
8331
|
desktop: 0,
|
|
8332
8332
|
mobile: 0.3
|
|
8333
|
+
},
|
|
8334
|
+
singlePage: {
|
|
8335
|
+
desktop: 0,
|
|
8336
|
+
mobile: 0.3
|
|
8333
8337
|
}
|
|
8334
8338
|
};
|
|
8335
8339
|
var classifier = null;
|
|
@@ -8955,16 +8959,19 @@
|
|
|
8955
8959
|
idCardFront: 0.6,
|
|
8956
8960
|
idCardBack: 0.6,
|
|
8957
8961
|
passport: 0.4,
|
|
8962
|
+
singlePage: 0.4,
|
|
8958
8963
|
stability: {
|
|
8959
8964
|
idCardFront: 0.85,
|
|
8960
8965
|
idCardBack: 0.85,
|
|
8961
|
-
passport: 0.5
|
|
8966
|
+
passport: 0.5,
|
|
8967
|
+
singlePage: 0.5
|
|
8962
8968
|
}
|
|
8963
8969
|
};
|
|
8964
8970
|
var documentTypeDisplayNames = {
|
|
8965
8971
|
idCardFront: 'ID card front',
|
|
8966
8972
|
idCardBack: 'ID card back',
|
|
8967
8973
|
passport: 'Passport',
|
|
8974
|
+
singlePage: 'Single page',
|
|
8968
8975
|
none: 'None'
|
|
8969
8976
|
};
|
|
8970
8977
|
var detector = null;
|
|
@@ -9153,7 +9160,7 @@
|
|
|
9153
9160
|
right: 20
|
|
9154
9161
|
};
|
|
9155
9162
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
9156
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9163
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
9157
9164
|
if (boundaries === void 0) {
|
|
9158
9165
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
9159
9166
|
}
|
|
@@ -9204,18 +9211,25 @@
|
|
|
9204
9211
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
9205
9212
|
return obj.label === 'Passport page';
|
|
9206
9213
|
});
|
|
9214
|
+
var bestSinglePage = detectedObjects.find(function (obj) {
|
|
9215
|
+
return obj.label === 'Single page';
|
|
9216
|
+
});
|
|
9207
9217
|
var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
|
|
9208
9218
|
var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
|
|
9209
9219
|
var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
|
|
9210
|
-
var
|
|
9211
|
-
var
|
|
9212
|
-
var
|
|
9213
|
-
var
|
|
9214
|
-
var
|
|
9215
|
-
var
|
|
9220
|
+
var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
|
|
9221
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
|
|
9222
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
|
|
9223
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
|
|
9224
|
+
var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
|
|
9225
|
+
var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
9226
|
+
var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
9227
|
+
var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
|
|
9216
9228
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
9217
9229
|
var detectedDocumentType = 'none';
|
|
9218
|
-
if (
|
|
9230
|
+
if (singlePageDetectionThresholdMet) {
|
|
9231
|
+
detectedDocumentType = 'singlePage';
|
|
9232
|
+
} else if (passportDetectionThresholdMet) {
|
|
9219
9233
|
detectedDocumentType = 'passport';
|
|
9220
9234
|
} else if (idCardBackDetectionThresholdMet) {
|
|
9221
9235
|
detectedDocumentType = 'idCardBack';
|
|
@@ -9229,12 +9243,12 @@
|
|
|
9229
9243
|
var documentIsStable = false;
|
|
9230
9244
|
var documentTooClose = false;
|
|
9231
9245
|
if (bestDocument) {
|
|
9232
|
-
var
|
|
9233
|
-
docWidth =
|
|
9234
|
-
docHeight =
|
|
9246
|
+
var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
9247
|
+
docWidth = _q[0],
|
|
9248
|
+
docHeight = _q[1];
|
|
9235
9249
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
9236
9250
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
9237
|
-
var thresholdSet = (
|
|
9251
|
+
var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
|
|
9238
9252
|
var threshold_1 = thresholdSet[detectedDocumentType];
|
|
9239
9253
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
9240
9254
|
trackBox(bestDocument.box, framesNeeded);
|
|
@@ -10257,7 +10271,8 @@
|
|
|
10257
10271
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
10258
10272
|
stopDetectionAtStart = stopDetection.current;
|
|
10259
10273
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
10260
|
-
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType))
|
|
10274
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || prediction.detectedDocumentType === 'singlePage' // TODO: remove this later
|
|
10275
|
+
;
|
|
10261
10276
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
10262
10277
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
|
|
10263
10278
|
if (focusPrediction) {
|
|
@@ -10488,6 +10503,8 @@
|
|
|
10488
10503
|
idCardBackDetectionThresholdMet: false,
|
|
10489
10504
|
passportDetectionScore: 0,
|
|
10490
10505
|
passportDetectionThresholdMet: false,
|
|
10506
|
+
singlePageDetectionScore: 0,
|
|
10507
|
+
singlePageDetectionThresholdMet: false,
|
|
10491
10508
|
focusScore: 0,
|
|
10492
10509
|
focusThresholdMet: false,
|
|
10493
10510
|
isGoodFrame: false,
|
|
@@ -14230,7 +14247,7 @@
|
|
|
14230
14247
|
scaling: debugScalingDetails,
|
|
14231
14248
|
flipX: !isRearFacing
|
|
14232
14249
|
});
|
|
14233
|
-
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
14250
|
+
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
14234
14251
|
};
|
|
14235
14252
|
var timeSince = function timeSince(t) {
|
|
14236
14253
|
if (!t) return 0;
|