idmission-web-sdk 2.2.6 → 2.2.7
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/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +96 -94
- 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 +96 -94
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +96 -94
- 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 +2 -2
package/dist/sdk2.esm.js
CHANGED
|
@@ -200,7 +200,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
200
200
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
var webSdkVersion = '2.2.
|
|
203
|
+
var webSdkVersion = '2.2.7';
|
|
204
204
|
|
|
205
205
|
function getPlatform() {
|
|
206
206
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -4321,105 +4321,107 @@ var _reducer = function reducer(state, action) {
|
|
|
4321
4321
|
guideImageHeight: action.payload.height
|
|
4322
4322
|
});
|
|
4323
4323
|
case 'objectsDetected':
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4324
|
+
{
|
|
4325
|
+
var _d = action.payload.prediction,
|
|
4326
|
+
detectedObjects = _d.detectedObjects,
|
|
4327
|
+
detectionThresholdMet = _d.detectionThresholdMet,
|
|
4328
|
+
detectedDocumentType = _d.detectedDocumentType,
|
|
4329
|
+
idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
|
|
4330
|
+
idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
|
|
4331
|
+
idCardBackDetectionScore = _d.idCardBackDetectionScore,
|
|
4332
|
+
idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
|
|
4333
|
+
passportDetectionScore = _d.passportDetectionScore,
|
|
4334
|
+
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
4335
|
+
bestDocument = _d.bestDocument,
|
|
4336
|
+
documentInBounds = _d.documentInBounds,
|
|
4337
|
+
documentTooClose = _d.documentTooClose,
|
|
4338
|
+
documentIsStable = _d.documentIsStable,
|
|
4339
|
+
focusScore = _d.focusScore,
|
|
4340
|
+
focusThresholdMet = _d.focusThresholdMet,
|
|
4341
|
+
frameWidth = _d.frameWidth,
|
|
4342
|
+
frameHeight = _d.frameHeight;
|
|
4343
|
+
var frameCapturedAt = new Date();
|
|
4344
|
+
var frameCaptureRate = 0;
|
|
4345
|
+
var goodFramesThreshold = state.goodFramesThreshold;
|
|
4346
|
+
if (state.lastFrameCapturedAt) {
|
|
4347
|
+
var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
|
|
4348
|
+
if (frameTime > 0) {
|
|
4349
|
+
frameCaptureRate = 1000.0 / frameTime;
|
|
4350
|
+
if (frameCaptureRate > 0) {
|
|
4351
|
+
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
4352
|
+
}
|
|
4351
4353
|
}
|
|
4352
4354
|
}
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
wrongDocumentTypePredictions += 1;
|
|
4365
|
-
}
|
|
4366
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
|
|
4367
|
-
var goodFramesCount = state.goodFramesCount;
|
|
4368
|
-
if (isGoodFrame) {
|
|
4369
|
-
goodFramesCount += 1;
|
|
4370
|
-
}
|
|
4371
|
-
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
4372
|
-
var requestedDocumentType = state.requestedDocumentType;
|
|
4373
|
-
if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
|
|
4374
|
-
if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
|
|
4375
|
-
requestedDocumentType = 'idCardFront';
|
|
4376
|
-
} else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
|
|
4377
|
-
requestedDocumentType = 'idCardBack';
|
|
4355
|
+
var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
|
|
4356
|
+
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
4357
|
+
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
4358
|
+
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
4359
|
+
var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
|
|
4360
|
+
var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
|
|
4361
|
+
var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
|
|
4362
|
+
var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
|
|
4363
|
+
var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
|
|
4364
|
+
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
4365
|
+
wrongDocumentTypePredictions += 1;
|
|
4378
4366
|
}
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
if (
|
|
4382
|
-
|
|
4367
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
|
|
4368
|
+
var goodFramesCount = state.goodFramesCount;
|
|
4369
|
+
if (isGoodFrame) {
|
|
4370
|
+
goodFramesCount += 1;
|
|
4383
4371
|
}
|
|
4384
|
-
|
|
4385
|
-
|
|
4372
|
+
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
4373
|
+
var requestedDocumentType = state.requestedDocumentType;
|
|
4374
|
+
if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
|
|
4375
|
+
if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
|
|
4376
|
+
requestedDocumentType = 'idCardFront';
|
|
4377
|
+
} else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
|
|
4378
|
+
requestedDocumentType = 'idCardBack';
|
|
4379
|
+
}
|
|
4386
4380
|
}
|
|
4381
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4382
|
+
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
4383
|
+
requestedDocumentType = 'passport';
|
|
4384
|
+
}
|
|
4385
|
+
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
4386
|
+
requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
var hasBeenRunningForLongEnough = !!state.captureStartedAt && new Date().getTime() - state.captureStartedAt.getTime() > 1000;
|
|
4390
|
+
var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
|
|
4391
|
+
var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
4392
|
+
return _assign(_assign({}, state), {
|
|
4393
|
+
videoWidth: frameWidth,
|
|
4394
|
+
videoHeight: frameHeight,
|
|
4395
|
+
detectedObjects: detectedObjects,
|
|
4396
|
+
bestDocument: bestDocument,
|
|
4397
|
+
requestedDocumentType: requestedDocumentType,
|
|
4398
|
+
detectedDocumentType: detectedDocumentType,
|
|
4399
|
+
detectionThresholdMet: detectionThresholdMet,
|
|
4400
|
+
documentInBounds: documentInBounds,
|
|
4401
|
+
documentTooClose: documentTooClose,
|
|
4402
|
+
documentIsStable: documentIsStable,
|
|
4403
|
+
flipRequired: flipRequired,
|
|
4404
|
+
backDetectedFirst: backDetectedFirst,
|
|
4405
|
+
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
4406
|
+
passportDetectedButNotAllowed: passportDetectedButNotAllowed,
|
|
4407
|
+
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
4408
|
+
wrongDocumentTypePredictions: wrongDocumentTypePredictions,
|
|
4409
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4410
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4411
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
4412
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4413
|
+
passportDetectionScore: passportDetectionScore,
|
|
4414
|
+
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4415
|
+
focusScore: focusScore,
|
|
4416
|
+
focusThresholdMet: focusThresholdMet,
|
|
4417
|
+
isGoodFrame: isGoodFrame,
|
|
4418
|
+
goodFramesCount: goodFramesCount,
|
|
4419
|
+
goodFramesThreshold: goodFramesThreshold,
|
|
4420
|
+
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
4421
|
+
lastFrameCapturedAt: frameCapturedAt,
|
|
4422
|
+
frameCaptureRate: frameCaptureRate
|
|
4423
|
+
});
|
|
4387
4424
|
}
|
|
4388
|
-
var hasBeenRunningForLongEnough = !!state.captureStartedAt && new Date().getTime() - state.captureStartedAt.getTime() > 1000;
|
|
4389
|
-
var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
|
|
4390
|
-
var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
4391
|
-
return _assign(_assign({}, state), {
|
|
4392
|
-
videoWidth: frameWidth,
|
|
4393
|
-
videoHeight: frameHeight,
|
|
4394
|
-
detectedObjects: detectedObjects,
|
|
4395
|
-
bestDocument: bestDocument,
|
|
4396
|
-
requestedDocumentType: requestedDocumentType,
|
|
4397
|
-
detectedDocumentType: detectedDocumentType,
|
|
4398
|
-
detectionThresholdMet: detectionThresholdMet,
|
|
4399
|
-
documentInBounds: documentInBounds,
|
|
4400
|
-
documentTooClose: documentTooClose,
|
|
4401
|
-
documentIsStable: documentIsStable,
|
|
4402
|
-
flipRequired: flipRequired,
|
|
4403
|
-
backDetectedFirst: backDetectedFirst,
|
|
4404
|
-
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
4405
|
-
passportDetectedButNotAllowed: passportDetectedButNotAllowed,
|
|
4406
|
-
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
4407
|
-
wrongDocumentTypePredictions: wrongDocumentTypePredictions,
|
|
4408
|
-
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4409
|
-
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4410
|
-
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
4411
|
-
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4412
|
-
passportDetectionScore: passportDetectionScore,
|
|
4413
|
-
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4414
|
-
focusScore: focusScore,
|
|
4415
|
-
focusThresholdMet: focusThresholdMet,
|
|
4416
|
-
isGoodFrame: isGoodFrame,
|
|
4417
|
-
goodFramesCount: goodFramesCount,
|
|
4418
|
-
goodFramesThreshold: goodFramesThreshold,
|
|
4419
|
-
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
4420
|
-
lastFrameCapturedAt: frameCapturedAt,
|
|
4421
|
-
frameCaptureRate: frameCaptureRate
|
|
4422
|
-
});
|
|
4423
4425
|
case 'captureStarted':
|
|
4424
4426
|
return _assign(_assign({}, state), {
|
|
4425
4427
|
captureStartedAt: new Date(),
|