idmission-web-sdk 2.0.2 → 2.1.0
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/README.md +36 -28
- package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +3 -12
- package/dist/components/customer_flows/IdAndFaceValidation.d.ts +3 -12
- package/dist/components/customer_flows/IdValidation.d.ts +3 -12
- package/dist/components/customer_flows/VideoIdValidation.d.ts +3 -12
- package/dist/components/id_capture/CapturedDocuments.d.ts +2 -0
- package/dist/components/id_capture/FocusModelProvider.d.ts +2 -1
- package/dist/components/id_capture/IdCapture.d.ts +4 -14
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +7 -22
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +11 -38
- package/dist/components/id_capture/IdCaptureSuccess.d.ts +2 -3
- package/dist/components/id_capture/IdCaptureWizard.d.ts +3 -9
- package/dist/components/video_id/IdVideoCapture.d.ts +12 -7
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts +3 -8
- package/dist/lib/models/DocumentDetection.d.ts +15 -12
- package/dist/lib/models/Focus.d.ts +6 -2
- package/dist/lib/models/helpers.d.ts +2 -0
- package/dist/sdk2.cjs.development.js +842 -968
- 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 +842 -968
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +842 -968
- 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/stories/Components/IdCapture/LicenseBackCapture.stories.d.ts +0 -48
- package/dist/stories/Components/IdCapture/LicenseFrontCapture.stories.d.ts +0 -45
- package/dist/stories/Components/IdCapture/PassportCapture.stories.d.ts +0 -47
- package/dist/stories/Components/IdCapture/Wizard.stories.d.ts +1 -77
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
return cooked;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
var webSdkVersion = '2.0
|
|
143
|
+
var webSdkVersion = '2.1.0';
|
|
144
144
|
|
|
145
145
|
function getPlatform() {
|
|
146
146
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2185,10 +2185,6 @@
|
|
|
2185
2185
|
}, [refCallback, size.width, size.height]);
|
|
2186
2186
|
}
|
|
2187
2187
|
|
|
2188
|
-
function supportsNativeBarcodeScanning() {
|
|
2189
|
-
return 'BarcodeDetector' in window;
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
2188
|
function getFrameDimensions(frame) {
|
|
2193
2189
|
var frameWidth = frame.width,
|
|
2194
2190
|
frameHeight = frame.height;
|
|
@@ -3034,10 +3030,42 @@
|
|
|
3034
3030
|
});
|
|
3035
3031
|
}
|
|
3036
3032
|
|
|
3037
|
-
|
|
3033
|
+
function convertBoundingBox(box) {
|
|
3034
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3035
|
+
return {
|
|
3036
|
+
xMin: (_a = box === null || box === void 0 ? void 0 : box.originX) !== null && _a !== void 0 ? _a : 0,
|
|
3037
|
+
xMax: ((_b = box === null || box === void 0 ? void 0 : box.originX) !== null && _b !== void 0 ? _b : 0) + ((_c = box === null || box === void 0 ? void 0 : box.width) !== null && _c !== void 0 ? _c : 0),
|
|
3038
|
+
yMin: (_d = box === null || box === void 0 ? void 0 : box.originY) !== null && _d !== void 0 ? _d : 0,
|
|
3039
|
+
yMax: ((_e = box === null || box === void 0 ? void 0 : box.originY) !== null && _e !== void 0 ? _e : 0) + ((_f = box === null || box === void 0 ? void 0 : box.height) !== null && _f !== void 0 ? _f : 0),
|
|
3040
|
+
width: (_g = box === null || box === void 0 ? void 0 : box.width) !== null && _g !== void 0 ? _g : 0,
|
|
3041
|
+
height: (_h = box === null || box === void 0 ? void 0 : box.height) !== null && _h !== void 0 ? _h : 0
|
|
3042
|
+
};
|
|
3043
|
+
}
|
|
3044
|
+
function waitForVideoReady(videoRef, checkEveryMs) {
|
|
3045
|
+
if (checkEveryMs === void 0) {
|
|
3046
|
+
checkEveryMs = 100;
|
|
3047
|
+
}
|
|
3048
|
+
return new Promise(function (resolve) {
|
|
3049
|
+
var _a;
|
|
3050
|
+
if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) return resolve();
|
|
3051
|
+
var interval = setInterval(function () {
|
|
3052
|
+
var _a;
|
|
3053
|
+
if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) {
|
|
3054
|
+
clearInterval(interval);
|
|
3055
|
+
resolve();
|
|
3056
|
+
}
|
|
3057
|
+
}, checkEveryMs);
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
var defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240619/model_fp16.tflite";
|
|
3038
3062
|
var defaultFocusModelLoadTimeoutMs = 45000;
|
|
3039
3063
|
var defaultFocusThresholds = {
|
|
3040
|
-
|
|
3064
|
+
idCardFront: {
|
|
3065
|
+
desktop: 0,
|
|
3066
|
+
mobile: 0.3
|
|
3067
|
+
},
|
|
3068
|
+
idCardBack: {
|
|
3041
3069
|
desktop: 0,
|
|
3042
3070
|
mobile: 0.3
|
|
3043
3071
|
},
|
|
@@ -3072,16 +3100,9 @@
|
|
|
3072
3100
|
delegate: modelCapabilities.delegate
|
|
3073
3101
|
},
|
|
3074
3102
|
runningMode: 'VIDEO'
|
|
3075
|
-
}])
|
|
3076
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3077
|
-
// models[id].classifyForVideo(emptyFrame, performance.now())
|
|
3078
|
-
// emptyFrame.remove()
|
|
3079
|
-
];
|
|
3103
|
+
}])];
|
|
3080
3104
|
case 3:
|
|
3081
3105
|
_a[_b] = _e.sent();
|
|
3082
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3083
|
-
// models[id].classifyForVideo(emptyFrame, performance.now())
|
|
3084
|
-
// emptyFrame.remove()
|
|
3085
3106
|
return [2 /*return*/, models[id]];
|
|
3086
3107
|
}
|
|
3087
3108
|
});
|
|
@@ -3103,7 +3124,9 @@
|
|
|
3103
3124
|
var _f = React.useState(null),
|
|
3104
3125
|
modelError = _f[0],
|
|
3105
3126
|
setModelError = _f[1];
|
|
3127
|
+
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
3106
3128
|
React.useEffect(function loadModel() {
|
|
3129
|
+
var _this = this;
|
|
3107
3130
|
setReady(false);
|
|
3108
3131
|
function handleDownloadProgress(event) {
|
|
3109
3132
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -3113,9 +3136,22 @@
|
|
|
3113
3136
|
setModelError(new Error('Model loading time limit exceeded.'));
|
|
3114
3137
|
}, modelLoadTimeoutMs);
|
|
3115
3138
|
loadFocusModel(modelPath).then(function (loadedModel) {
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3139
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
3140
|
+
return __generator(this, function (_a) {
|
|
3141
|
+
switch (_a.label) {
|
|
3142
|
+
case 0:
|
|
3143
|
+
model.current = loadedModel;
|
|
3144
|
+
setModelDownloadProgress(100);
|
|
3145
|
+
clearTimeout(modelLoadTimeout);
|
|
3146
|
+
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
3147
|
+
case 1:
|
|
3148
|
+
_a.sent();
|
|
3149
|
+
loadedModel.classifyForVideo(videoRef.current, performance.now());
|
|
3150
|
+
setReady(true);
|
|
3151
|
+
return [2 /*return*/];
|
|
3152
|
+
}
|
|
3153
|
+
});
|
|
3154
|
+
});
|
|
3119
3155
|
})["catch"](function (e) {
|
|
3120
3156
|
setModelError(e);
|
|
3121
3157
|
})["finally"](function () {
|
|
@@ -3125,7 +3161,7 @@
|
|
|
3125
3161
|
clearTimeout(modelLoadTimeout);
|
|
3126
3162
|
document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
|
|
3127
3163
|
};
|
|
3128
|
-
}, [modelPath, modelLoadTimeoutMs]);
|
|
3164
|
+
}, [modelPath, modelLoadTimeoutMs, videoRef]);
|
|
3129
3165
|
React.useEffect(function handleModelError() {
|
|
3130
3166
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
3131
3167
|
}, [modelError, onModelError]);
|
|
@@ -3303,18 +3339,6 @@
|
|
|
3303
3339
|
[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,
|
|
3304
3340
|
343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]]);K("VERSION","0.4.1646425229");}).call(commonjsGlobal);
|
|
3305
3341
|
|
|
3306
|
-
function convertBoundingBox(box) {
|
|
3307
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3308
|
-
return {
|
|
3309
|
-
xMin: (_a = box === null || box === void 0 ? void 0 : box.originX) !== null && _a !== void 0 ? _a : 0,
|
|
3310
|
-
xMax: ((_b = box === null || box === void 0 ? void 0 : box.originX) !== null && _b !== void 0 ? _b : 0) + ((_c = box === null || box === void 0 ? void 0 : box.width) !== null && _c !== void 0 ? _c : 0),
|
|
3311
|
-
yMin: (_d = box === null || box === void 0 ? void 0 : box.originY) !== null && _d !== void 0 ? _d : 0,
|
|
3312
|
-
yMax: ((_e = box === null || box === void 0 ? void 0 : box.originY) !== null && _e !== void 0 ? _e : 0) + ((_f = box === null || box === void 0 ? void 0 : box.height) !== null && _f !== void 0 ? _f : 0),
|
|
3313
|
-
width: (_g = box === null || box === void 0 ? void 0 : box.width) !== null && _g !== void 0 ? _g : 0,
|
|
3314
|
-
height: (_h = box === null || box === void 0 ? void 0 : box.height) !== null && _h !== void 0 ? _h : 0
|
|
3315
|
-
};
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3318
3342
|
var defaultFaceDetectorModelPath = 'https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite';
|
|
3319
3343
|
var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
3320
3344
|
var detector;
|
|
@@ -3340,16 +3364,9 @@
|
|
|
3340
3364
|
delegate: modelCapabilities.delegate
|
|
3341
3365
|
},
|
|
3342
3366
|
runningMode: 'VIDEO'
|
|
3343
|
-
}])
|
|
3344
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3345
|
-
// detector.detectForVideo(emptyFrame, performance.now())
|
|
3346
|
-
// emptyFrame.remove()
|
|
3347
|
-
];
|
|
3367
|
+
}])];
|
|
3348
3368
|
case 3:
|
|
3349
3369
|
detector = _c.sent();
|
|
3350
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3351
|
-
// detector.detectForVideo(emptyFrame, performance.now())
|
|
3352
|
-
// emptyFrame.remove()
|
|
3353
3370
|
return [2 /*return*/, detector];
|
|
3354
3371
|
}
|
|
3355
3372
|
});
|
|
@@ -3369,7 +3386,9 @@
|
|
|
3369
3386
|
var _e = React.useState(null),
|
|
3370
3387
|
modelError = _e[0],
|
|
3371
3388
|
setModelError = _e[1];
|
|
3389
|
+
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
3372
3390
|
React.useEffect(function loadModel() {
|
|
3391
|
+
var _this = this;
|
|
3373
3392
|
setReady(false);
|
|
3374
3393
|
var modelLoadTimeout = setTimeout(function () {
|
|
3375
3394
|
setModelError(new Error('Model loading time limit exceeded.'));
|
|
@@ -3379,9 +3398,22 @@
|
|
|
3379
3398
|
}
|
|
3380
3399
|
document.addEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
3381
3400
|
loadFaceDetector().then(function (model) {
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3401
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
3402
|
+
return __generator(this, function (_a) {
|
|
3403
|
+
switch (_a.label) {
|
|
3404
|
+
case 0:
|
|
3405
|
+
detector.current = model;
|
|
3406
|
+
setModelDownloadProgress(100);
|
|
3407
|
+
clearTimeout(modelLoadTimeout);
|
|
3408
|
+
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
3409
|
+
case 1:
|
|
3410
|
+
_a.sent();
|
|
3411
|
+
model.detectForVideo(videoRef.current, performance.now());
|
|
3412
|
+
setReady(true);
|
|
3413
|
+
return [2 /*return*/];
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
});
|
|
3385
3417
|
})["catch"](function (e) {
|
|
3386
3418
|
setModelError(e);
|
|
3387
3419
|
})["finally"](function () {
|
|
@@ -3391,7 +3423,7 @@
|
|
|
3391
3423
|
clearTimeout(modelLoadTimeout);
|
|
3392
3424
|
document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
3393
3425
|
};
|
|
3394
|
-
}, [modelLoadTimeoutMs]);
|
|
3426
|
+
}, [modelLoadTimeoutMs, videoRef]);
|
|
3395
3427
|
React.useEffect(function handleModelError() {
|
|
3396
3428
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
3397
3429
|
}, [modelError, onModelError]);
|
|
@@ -3654,14 +3686,19 @@
|
|
|
3654
3686
|
});
|
|
3655
3687
|
}
|
|
3656
3688
|
|
|
3657
|
-
var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/
|
|
3689
|
+
var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240614/model_fp16.tflite";
|
|
3658
3690
|
var defaultDocumentDetectionScoreThreshold = 0.1;
|
|
3659
3691
|
var defaultDocumentDetectionModelLoadTimeoutMs = 45000;
|
|
3660
3692
|
var defaultDocumentDetectionThresholds = {
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3693
|
+
idCardFront: 0.8,
|
|
3694
|
+
idCardBack: 0.8,
|
|
3695
|
+
passport: 0.5
|
|
3696
|
+
};
|
|
3697
|
+
var documentTypeDisplayNames = {
|
|
3698
|
+
idCardFront: 'ID card front',
|
|
3699
|
+
idCardBack: 'ID card back',
|
|
3700
|
+
passport: 'Passport',
|
|
3701
|
+
none: 'None'
|
|
3665
3702
|
};
|
|
3666
3703
|
var detectors = {};
|
|
3667
3704
|
function loadDocumentDetector(modelAssetPath, scoreThreshold) {
|
|
@@ -3696,16 +3733,9 @@
|
|
|
3696
3733
|
},
|
|
3697
3734
|
scoreThreshold: scoreThreshold,
|
|
3698
3735
|
runningMode: 'VIDEO'
|
|
3699
|
-
}])
|
|
3700
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3701
|
-
// detectors[id].detectForVideo(emptyFrame, performance.now())
|
|
3702
|
-
// emptyFrame.remove()
|
|
3703
|
-
];
|
|
3736
|
+
}])];
|
|
3704
3737
|
case 3:
|
|
3705
3738
|
_a[_b] = _e.sent();
|
|
3706
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3707
|
-
// detectors[id].detectForVideo(emptyFrame, performance.now())
|
|
3708
|
-
// emptyFrame.remove()
|
|
3709
3739
|
return [2 /*return*/, detectors[id]];
|
|
3710
3740
|
}
|
|
3711
3741
|
});
|
|
@@ -3729,7 +3759,9 @@
|
|
|
3729
3759
|
var _g = React.useState(null),
|
|
3730
3760
|
modelError = _g[0],
|
|
3731
3761
|
setModelError = _g[1];
|
|
3762
|
+
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
3732
3763
|
React.useEffect(function loadModel() {
|
|
3764
|
+
var _this = this;
|
|
3733
3765
|
setReady(false);
|
|
3734
3766
|
function handleDownloadProgress(event) {
|
|
3735
3767
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -3739,9 +3771,22 @@
|
|
|
3739
3771
|
setModelError(new Error('Model loading time limit exceeded.'));
|
|
3740
3772
|
}, modelLoadTimeoutMs);
|
|
3741
3773
|
loadDocumentDetector(modelPath, scoreThreshold).then(function (model) {
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3774
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
3775
|
+
return __generator(this, function (_a) {
|
|
3776
|
+
switch (_a.label) {
|
|
3777
|
+
case 0:
|
|
3778
|
+
detector.current = model;
|
|
3779
|
+
setModelDownloadProgress(100);
|
|
3780
|
+
clearTimeout(modelLoadTimeout);
|
|
3781
|
+
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
3782
|
+
case 1:
|
|
3783
|
+
_a.sent();
|
|
3784
|
+
model.detectForVideo(videoRef.current, performance.now());
|
|
3785
|
+
setReady(true);
|
|
3786
|
+
return [2 /*return*/];
|
|
3787
|
+
}
|
|
3788
|
+
});
|
|
3789
|
+
});
|
|
3745
3790
|
})["catch"](function (e) {
|
|
3746
3791
|
setModelError(e);
|
|
3747
3792
|
})["finally"](function () {
|
|
@@ -3751,7 +3796,7 @@
|
|
|
3751
3796
|
clearTimeout(modelLoadTimeout);
|
|
3752
3797
|
document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
|
|
3753
3798
|
};
|
|
3754
|
-
}, [modelLoadTimeoutMs, modelPath, scoreThreshold]);
|
|
3799
|
+
}, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
|
|
3755
3800
|
React.useEffect(function handleModelError() {
|
|
3756
3801
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
3757
3802
|
}, [modelError, onModelError]);
|
|
@@ -3808,34 +3853,33 @@
|
|
|
3808
3853
|
return n > 0;
|
|
3809
3854
|
});
|
|
3810
3855
|
});
|
|
3811
|
-
var
|
|
3856
|
+
var bestIdCardFront = detectedObjects.find(function (obj) {
|
|
3812
3857
|
return obj.label === 'Document';
|
|
3813
3858
|
});
|
|
3859
|
+
var bestIdCardBack = detectedObjects.find(function (obj) {
|
|
3860
|
+
return obj.label === 'Document back';
|
|
3861
|
+
});
|
|
3814
3862
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
3815
3863
|
return obj.label === 'Passport page';
|
|
3816
3864
|
});
|
|
3817
|
-
var
|
|
3818
|
-
var
|
|
3819
|
-
var
|
|
3820
|
-
var
|
|
3821
|
-
var
|
|
3865
|
+
var idCardFrontDetectionScore = (_a = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _a !== void 0 ? _a : 0;
|
|
3866
|
+
var idCardBackDetectionScore = (_b = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _b !== void 0 ? _b : 0;
|
|
3867
|
+
var passportDetectionScore = (_c = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _c !== void 0 ? _c : 0;
|
|
3868
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_d = thresholds.idCardFront) !== null && _d !== void 0 ? _d : 0);
|
|
3869
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_e = thresholds.idCardBack) !== null && _e !== void 0 ? _e : 0);
|
|
3870
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_f = thresholds.passport) !== null && _f !== void 0 ? _f : 0);
|
|
3871
|
+
var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
3872
|
+
var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
3873
|
+
var detectionScore = (_g = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _g !== void 0 ? _g : 0;
|
|
3822
3874
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
3823
3875
|
var detectedDocumentType = 'none';
|
|
3824
3876
|
if (passportDetectionThresholdMet) {
|
|
3825
3877
|
detectedDocumentType = 'passport';
|
|
3878
|
+
} else if (idCardBackDetectionThresholdMet) {
|
|
3879
|
+
detectedDocumentType = 'idCardBack';
|
|
3826
3880
|
} else if (detectionThresholdMet) {
|
|
3827
|
-
detectedDocumentType = '
|
|
3881
|
+
detectedDocumentType = 'idCardFront';
|
|
3828
3882
|
}
|
|
3829
|
-
var bestMrz = detectedObjects.find(function (obj) {
|
|
3830
|
-
return obj.label === 'MRZ';
|
|
3831
|
-
});
|
|
3832
|
-
var mrzDetectionScore = (_d = bestMrz === null || bestMrz === void 0 ? void 0 : bestMrz.score) !== null && _d !== void 0 ? _d : 0;
|
|
3833
|
-
var mrzDetectionThresholdMet = mrzDetectionScore >= ((_e = thresholds.mrz) !== null && _e !== void 0 ? _e : 0);
|
|
3834
|
-
var bestPdf417 = detectedObjects.find(function (obj) {
|
|
3835
|
-
return obj.label === 'PDF417';
|
|
3836
|
-
});
|
|
3837
|
-
var pdf417DetectionScore = (_f = bestPdf417 === null || bestPdf417 === void 0 ? void 0 : bestPdf417.score) !== null && _f !== void 0 ? _f : 0;
|
|
3838
|
-
var pdf417DetectionThresholdMet = pdf417DetectionScore >= ((_g = thresholds.pdf417) !== null && _g !== void 0 ? _g : 0);
|
|
3839
3883
|
var documentInBounds = false;
|
|
3840
3884
|
if (bestDocument) {
|
|
3841
3885
|
var boundaryPx = 20;
|
|
@@ -3865,15 +3909,13 @@
|
|
|
3865
3909
|
detectionTime: time,
|
|
3866
3910
|
detectionThresholdMet: detectionThresholdMet,
|
|
3867
3911
|
detectedDocumentType: detectedDocumentType,
|
|
3912
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
3913
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
3914
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
3915
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
3868
3916
|
passportDetectionScore: passportDetectionScore,
|
|
3869
3917
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
3870
|
-
mrzDetectionScore: mrzDetectionScore,
|
|
3871
|
-
mrzDetectionThresholdMet: mrzDetectionThresholdMet,
|
|
3872
|
-
pdf417DetectionScore: pdf417DetectionScore,
|
|
3873
|
-
pdf417DetectionThresholdMet: pdf417DetectionThresholdMet,
|
|
3874
3918
|
bestDocument: bestDocument,
|
|
3875
|
-
bestMrz: bestMrz,
|
|
3876
|
-
bestPdf417: bestPdf417,
|
|
3877
3919
|
documentInBounds: documentInBounds,
|
|
3878
3920
|
documentTooClose: documentTooClose,
|
|
3879
3921
|
frameWidth: frameWidth,
|
|
@@ -4121,24 +4163,26 @@
|
|
|
4121
4163
|
focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
4122
4164
|
_c = _a.focusModelLoadTimeoutMs,
|
|
4123
4165
|
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
4124
|
-
onFocusModelError = _a.onFocusModelError
|
|
4166
|
+
onFocusModelError = _a.onFocusModelError,
|
|
4167
|
+
_d = _a.showCanvases,
|
|
4168
|
+
showCanvases = _d === void 0 ? false : _d;
|
|
4125
4169
|
var cropCanvas = React.useRef(null);
|
|
4126
4170
|
var rotateCanvas = React.useRef(null);
|
|
4127
|
-
var
|
|
4128
|
-
focusThresholds =
|
|
4129
|
-
setFocusThresholds =
|
|
4130
|
-
var
|
|
4131
|
-
focusPredictionTime =
|
|
4132
|
-
setFocusPredictionTime =
|
|
4133
|
-
var
|
|
4171
|
+
var _e = React.useState({}),
|
|
4172
|
+
focusThresholds = _e[0],
|
|
4173
|
+
setFocusThresholds = _e[1];
|
|
4174
|
+
var _f = React.useState(0),
|
|
4175
|
+
focusPredictionTime = _f[0],
|
|
4176
|
+
setFocusPredictionTime = _f[1];
|
|
4177
|
+
var _g = useLoadFocusModel({
|
|
4134
4178
|
modelPath: focusModelPath,
|
|
4135
4179
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
4136
4180
|
onModelError: onFocusModelError
|
|
4137
4181
|
}),
|
|
4138
|
-
model =
|
|
4139
|
-
ready =
|
|
4140
|
-
modelDownloadProgress =
|
|
4141
|
-
modelError =
|
|
4182
|
+
model = _g.model,
|
|
4183
|
+
ready = _g.ready,
|
|
4184
|
+
modelDownloadProgress = _g.modelDownloadProgress,
|
|
4185
|
+
modelError = _g.modelError;
|
|
4142
4186
|
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
4143
4187
|
if (!model.current) return null;
|
|
4144
4188
|
var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -4159,13 +4203,23 @@
|
|
|
4159
4203
|
return /*#__PURE__*/React__default['default'].createElement(FocusModelContext.Provider, {
|
|
4160
4204
|
value: value
|
|
4161
4205
|
}, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
4162
|
-
ref: rotateCanvas
|
|
4206
|
+
ref: rotateCanvas,
|
|
4207
|
+
style: showCanvases ? {
|
|
4208
|
+
display: 'block'
|
|
4209
|
+
} : undefined
|
|
4163
4210
|
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
4164
|
-
ref: cropCanvas
|
|
4211
|
+
ref: cropCanvas,
|
|
4212
|
+
style: showCanvases ? {
|
|
4213
|
+
display: 'block'
|
|
4214
|
+
} : undefined
|
|
4165
4215
|
}), children);
|
|
4166
4216
|
}
|
|
4167
4217
|
|
|
4168
4218
|
var onMobile = isMobile();
|
|
4219
|
+
var defaultIdCaptureThresholds = {
|
|
4220
|
+
detection: defaultDocumentDetectionThresholds,
|
|
4221
|
+
focus: defaultFocusThresholds
|
|
4222
|
+
};
|
|
4169
4223
|
var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
|
|
4170
4224
|
ready: false,
|
|
4171
4225
|
start: function start() {
|
|
@@ -4176,7 +4230,7 @@
|
|
|
4176
4230
|
},
|
|
4177
4231
|
modelDownloadProgress: 0,
|
|
4178
4232
|
modelError: null,
|
|
4179
|
-
thresholds:
|
|
4233
|
+
thresholds: defaultIdCaptureThresholds,
|
|
4180
4234
|
setThresholds: function setThresholds() {
|
|
4181
4235
|
return null;
|
|
4182
4236
|
},
|
|
@@ -4191,6 +4245,10 @@
|
|
|
4191
4245
|
},
|
|
4192
4246
|
resetBestFrame: function resetBestFrame() {
|
|
4193
4247
|
return null;
|
|
4248
|
+
},
|
|
4249
|
+
requiredDocumentType: 'none',
|
|
4250
|
+
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
4251
|
+
return null;
|
|
4194
4252
|
}
|
|
4195
4253
|
});
|
|
4196
4254
|
function IdCaptureModelsProviderInner(_a) {
|
|
@@ -4223,26 +4281,34 @@
|
|
|
4223
4281
|
var bestPredictionCanvas = React.useRef(null);
|
|
4224
4282
|
var bestFocusScore = React.useRef(0);
|
|
4225
4283
|
var stopDetection = React.useRef(0);
|
|
4284
|
+
var _e = React.useState('none'),
|
|
4285
|
+
requiredDocumentType = _e[0],
|
|
4286
|
+
setRequiredDocumentType = _e[1];
|
|
4226
4287
|
var thresholds = React.useMemo(function () {
|
|
4227
4288
|
return __assign$1(__assign$1({}, documentDetectionThresholds), {
|
|
4228
4289
|
focus: focusThresholds
|
|
4229
4290
|
});
|
|
4230
4291
|
}, [documentDetectionThresholds, focusThresholds]);
|
|
4231
4292
|
var setThresholds = React.useCallback(function (thresholds) {
|
|
4232
|
-
|
|
4233
|
-
|
|
4293
|
+
if (thresholds.detection) {
|
|
4294
|
+
setDocumentDetectionThresholds(thresholds.detection);
|
|
4295
|
+
}
|
|
4296
|
+
if (thresholds.focus) {
|
|
4297
|
+
setFocusThresholds(thresholds.focus);
|
|
4298
|
+
}
|
|
4234
4299
|
}, [setDocumentDetectionThresholds, setFocusThresholds]);
|
|
4235
4300
|
React.useEffect(function handleDetections() {
|
|
4236
4301
|
var _this = this;
|
|
4237
4302
|
onDocumentDetected(function (prediction) {
|
|
4238
4303
|
return __awaiter(_this, void 0, void 0, function () {
|
|
4239
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4304
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4240
4305
|
var _a, _b, _c, _d, _e;
|
|
4241
4306
|
return __generator(this, function (_f) {
|
|
4242
4307
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
4243
4308
|
stopDetectionAtStart = stopDetection.current;
|
|
4244
4309
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
4245
|
-
|
|
4310
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
|
|
4311
|
+
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
|
|
4246
4312
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_a = prediction.bestDocument) === null || _a === void 0 ? void 0 : _a.box);
|
|
4247
4313
|
if (focusPrediction) {
|
|
4248
4314
|
focusScore = focusPrediction.score;
|
|
@@ -4271,7 +4337,7 @@
|
|
|
4271
4337
|
});
|
|
4272
4338
|
});
|
|
4273
4339
|
});
|
|
4274
|
-
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, thresholds.focus]);
|
|
4340
|
+
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
4275
4341
|
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
4276
4342
|
React.useEffect(function handleModelErrors() {
|
|
4277
4343
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
@@ -4285,9 +4351,9 @@
|
|
|
4285
4351
|
canvas: bestPredictionCanvas.current
|
|
4286
4352
|
});
|
|
4287
4353
|
}, [bestFrameDetails]);
|
|
4288
|
-
var
|
|
4289
|
-
canvasKey =
|
|
4290
|
-
setCanvasKey =
|
|
4354
|
+
var _f = React.useState(0),
|
|
4355
|
+
canvasKey = _f[0],
|
|
4356
|
+
setCanvasKey = _f[1];
|
|
4291
4357
|
var resetBestFrame = React.useCallback(function () {
|
|
4292
4358
|
stopDetection.current += 1;
|
|
4293
4359
|
setCanvasKey(function (n) {
|
|
@@ -4297,6 +4363,9 @@
|
|
|
4297
4363
|
setBestFrameDetails(null);
|
|
4298
4364
|
bestFocusScore.current = 0;
|
|
4299
4365
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
4366
|
+
React.useEffect(function () {
|
|
4367
|
+
requiredDocumentType && resetBestFrame();
|
|
4368
|
+
}, [requiredDocumentType, resetBestFrame]);
|
|
4300
4369
|
var value = React.useMemo(function () {
|
|
4301
4370
|
return {
|
|
4302
4371
|
ready: documentDetectionModelReady && focusModelReady,
|
|
@@ -4311,9 +4380,11 @@
|
|
|
4311
4380
|
focusPredictionTime: focusPredictionTime,
|
|
4312
4381
|
getBestFrame: getBestFrame,
|
|
4313
4382
|
resetBestFrame: resetBestFrame,
|
|
4314
|
-
bestFrameDetails: bestFrameDetails
|
|
4383
|
+
bestFrameDetails: bestFrameDetails,
|
|
4384
|
+
requiredDocumentType: requiredDocumentType,
|
|
4385
|
+
setRequiredDocumentType: setRequiredDocumentType
|
|
4315
4386
|
};
|
|
4316
|
-
}, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
4387
|
+
}, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
4317
4388
|
return /*#__PURE__*/React__default['default'].createElement(IdCaptureModelsContext.Provider, {
|
|
4318
4389
|
value: value
|
|
4319
4390
|
}, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
@@ -4364,28 +4435,19 @@
|
|
|
4364
4435
|
videoHeight: 0,
|
|
4365
4436
|
detectedObjects: [],
|
|
4366
4437
|
bestDocument: undefined,
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
documentType: 'none',
|
|
4438
|
+
detectedDocumentType: 'none',
|
|
4439
|
+
detectionThresholdMet: false,
|
|
4370
4440
|
documentInBounds: false,
|
|
4371
4441
|
documentTooClose: false,
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
pdf417DetectionThresholdMet: false,
|
|
4442
|
+
flipRequired: false,
|
|
4443
|
+
idCardFrontDetectionScore: 0,
|
|
4444
|
+
idCardFrontDetectionThresholdMet: false,
|
|
4445
|
+
idCardBackDetectionScore: 0,
|
|
4446
|
+
idCardBackDetectionThresholdMet: false,
|
|
4447
|
+
passportDetectionScore: 0,
|
|
4448
|
+
passportDetectionThresholdMet: false,
|
|
4380
4449
|
focusScore: 0,
|
|
4381
4450
|
focusThresholdMet: false,
|
|
4382
|
-
barcodeScanningEnabled: false,
|
|
4383
|
-
barcodeResult: null,
|
|
4384
|
-
waitingForBarcodeScan: false,
|
|
4385
|
-
shouldScanBarcode: false,
|
|
4386
|
-
autoCaptureBarcodeRequired: 'mobile',
|
|
4387
|
-
barcodeScanFailedAttempts: 0,
|
|
4388
|
-
maxBarcodeScanAttempts: 10,
|
|
4389
4451
|
isGoodFrame: false,
|
|
4390
4452
|
goodFramesCount: 0,
|
|
4391
4453
|
goodFramesThreshold: 3,
|
|
@@ -4399,8 +4461,6 @@
|
|
|
4399
4461
|
capturedDocuments: {},
|
|
4400
4462
|
captureRequirement: 'idCardOrPassport',
|
|
4401
4463
|
requestedDocumentType: 'idCardFront',
|
|
4402
|
-
detectedDocumentType: 'none',
|
|
4403
|
-
differentDocumentTypeDetections: 0,
|
|
4404
4464
|
operationStartedAt: null,
|
|
4405
4465
|
captureStartedAt: null
|
|
4406
4466
|
};
|
|
@@ -4435,11 +4495,6 @@
|
|
|
4435
4495
|
newState.operationStartedAt = new Date();
|
|
4436
4496
|
return newState;
|
|
4437
4497
|
}
|
|
4438
|
-
case 'configureCapture':
|
|
4439
|
-
return __assign$1(__assign$1(__assign$1({}, state), action.payload), {
|
|
4440
|
-
capturing: false,
|
|
4441
|
-
captureFailed: false
|
|
4442
|
-
});
|
|
4443
4498
|
case 'setRequiredDocumentType':
|
|
4444
4499
|
return __assign$1(__assign$1({}, state), {
|
|
4445
4500
|
requiredDocumentType: action.payload
|
|
@@ -4476,18 +4531,15 @@
|
|
|
4476
4531
|
case 'objectsDetected':
|
|
4477
4532
|
var _d = action.payload.prediction,
|
|
4478
4533
|
detectedObjects = _d.detectedObjects,
|
|
4479
|
-
detectionScore = _d.detectionScore,
|
|
4480
4534
|
detectionThresholdMet = _d.detectionThresholdMet,
|
|
4481
4535
|
detectedDocumentType = _d.detectedDocumentType,
|
|
4536
|
+
idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
|
|
4537
|
+
idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
|
|
4538
|
+
idCardBackDetectionScore = _d.idCardBackDetectionScore,
|
|
4539
|
+
idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
|
|
4482
4540
|
passportDetectionScore = _d.passportDetectionScore,
|
|
4483
4541
|
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
4484
|
-
mrzDetectionScore = _d.mrzDetectionScore,
|
|
4485
|
-
mrzDetectionThresholdMet = _d.mrzDetectionThresholdMet,
|
|
4486
|
-
pdf417DetectionScore = _d.pdf417DetectionScore,
|
|
4487
|
-
pdf417DetectionThresholdMet = _d.pdf417DetectionThresholdMet,
|
|
4488
4542
|
bestDocument = _d.bestDocument,
|
|
4489
|
-
bestMrz = _d.bestMrz,
|
|
4490
|
-
bestPdf417 = _d.bestPdf417,
|
|
4491
4543
|
documentInBounds = _d.documentInBounds,
|
|
4492
4544
|
documentTooClose = _d.documentTooClose,
|
|
4493
4545
|
focusScore = _d.focusScore,
|
|
@@ -4503,84 +4555,48 @@
|
|
|
4503
4555
|
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
4504
4556
|
}
|
|
4505
4557
|
}
|
|
4506
|
-
var
|
|
4507
|
-
var
|
|
4508
|
-
var waitingForBarcodeScan = shouldScanBarcode && !state.barcodeResult;
|
|
4509
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && focusThresholdMet;
|
|
4558
|
+
var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
4559
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && focusThresholdMet;
|
|
4510
4560
|
var goodFramesCount = state.goodFramesCount;
|
|
4511
4561
|
if (isGoodFrame) {
|
|
4512
4562
|
goodFramesCount += 1;
|
|
4513
4563
|
}
|
|
4564
|
+
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
4565
|
+
var requestedDocumentType = state.requestedDocumentType;
|
|
4566
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4567
|
+
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
4568
|
+
requestedDocumentType = 'passport';
|
|
4569
|
+
}
|
|
4570
|
+
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
4571
|
+
requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
|
|
4572
|
+
}
|
|
4573
|
+
}
|
|
4514
4574
|
return __assign$1(__assign$1({}, state), {
|
|
4515
4575
|
videoWidth: frameWidth,
|
|
4516
4576
|
videoHeight: frameHeight,
|
|
4517
4577
|
detectedObjects: detectedObjects,
|
|
4518
4578
|
bestDocument: bestDocument,
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4579
|
+
requestedDocumentType: requestedDocumentType,
|
|
4580
|
+
detectedDocumentType: detectedDocumentType,
|
|
4581
|
+
detectionThresholdMet: detectionThresholdMet,
|
|
4522
4582
|
documentInBounds: documentInBounds,
|
|
4523
4583
|
documentTooClose: documentTooClose,
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
passportPageDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4584
|
+
flipRequired: flipRequired,
|
|
4585
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4586
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4587
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
4588
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4589
|
+
passportDetectionScore: passportDetectionScore,
|
|
4590
|
+
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4532
4591
|
focusScore: focusScore,
|
|
4533
4592
|
focusThresholdMet: focusThresholdMet,
|
|
4534
|
-
shouldScanBarcode: shouldScanBarcode,
|
|
4535
|
-
waitingForBarcodeScan: waitingForBarcodeScan,
|
|
4536
4593
|
isGoodFrame: isGoodFrame,
|
|
4537
4594
|
goodFramesCount: goodFramesCount,
|
|
4538
4595
|
goodFramesThreshold: goodFramesThreshold,
|
|
4539
|
-
goodFramesThresholdMet:
|
|
4596
|
+
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
4540
4597
|
lastFrameCapturedAt: frameCapturedAt,
|
|
4541
4598
|
frameCaptureRate: frameCaptureRate
|
|
4542
4599
|
});
|
|
4543
|
-
case 'predictionMade':
|
|
4544
|
-
{
|
|
4545
|
-
var _e = action.payload,
|
|
4546
|
-
detectedDocumentType_1 = _e.detectedDocumentType,
|
|
4547
|
-
passportDetectionScore_1 = _e.passportDetectionScore;
|
|
4548
|
-
var requestedDocumentType = state.requestedDocumentType;
|
|
4549
|
-
var newState = __assign$1(__assign$1({}, state), {
|
|
4550
|
-
detectedDocumentType: detectedDocumentType_1
|
|
4551
|
-
});
|
|
4552
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4553
|
-
var predictionIsRequestedType = requestedDocumentType.startsWith(detectedDocumentType_1);
|
|
4554
|
-
if (predictionIsRequestedType) {
|
|
4555
|
-
newState.differentDocumentTypeDetections = 0;
|
|
4556
|
-
}
|
|
4557
|
-
if (detectedDocumentType_1 === 'passport' && requestedDocumentType !== 'passport') {
|
|
4558
|
-
newState.requestedDocumentType = 'passport';
|
|
4559
|
-
}
|
|
4560
|
-
if (requestedDocumentType === 'passport' && passportDetectionScore_1 < 0.3) {
|
|
4561
|
-
newState.requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
|
|
4562
|
-
}
|
|
4563
|
-
}
|
|
4564
|
-
return newState;
|
|
4565
|
-
}
|
|
4566
|
-
case 'barcodeScanned':
|
|
4567
|
-
return __assign$1(__assign$1({}, state), {
|
|
4568
|
-
barcodeResult: action.payload.result,
|
|
4569
|
-
waitingForBarcodeScan: false,
|
|
4570
|
-
autoCaptureBarcodeRequired: false
|
|
4571
|
-
});
|
|
4572
|
-
case 'barcodeScanFailed':
|
|
4573
|
-
{
|
|
4574
|
-
var newState = __assign$1(__assign$1({}, state), {
|
|
4575
|
-
barcodeScanFailedAttempts: state.barcodeScanFailedAttempts + 1
|
|
4576
|
-
});
|
|
4577
|
-
if (newState.barcodeScanFailedAttempts >= newState.maxBarcodeScanAttempts) {
|
|
4578
|
-
newState.autoCaptureBarcodeRequired = false;
|
|
4579
|
-
newState.shouldScanBarcode = false;
|
|
4580
|
-
newState.waitingForBarcodeScan = false;
|
|
4581
|
-
}
|
|
4582
|
-
return newState;
|
|
4583
|
-
}
|
|
4584
4600
|
case 'captureStarted':
|
|
4585
4601
|
return __assign$1(__assign$1({}, state), {
|
|
4586
4602
|
captureStartedAt: new Date(),
|
|
@@ -4632,8 +4648,9 @@
|
|
|
4632
4648
|
newState_1.requestedDocumentType = remainingRequirements[0];
|
|
4633
4649
|
if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack') {
|
|
4634
4650
|
newState_1.captureState = 'requestingFlip';
|
|
4635
|
-
newState_1.
|
|
4636
|
-
newState_1.
|
|
4651
|
+
newState_1.idCardFrontDetectionThresholdMet = false;
|
|
4652
|
+
newState_1.idCardBackDetectionThresholdMet = false;
|
|
4653
|
+
newState_1.passportDetectionThresholdMet = false;
|
|
4637
4654
|
}
|
|
4638
4655
|
}
|
|
4639
4656
|
return newState_1;
|
|
@@ -4664,8 +4681,9 @@
|
|
|
4664
4681
|
newState_2.requestedDocumentType = remainingRequirements[0];
|
|
4665
4682
|
if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack') {
|
|
4666
4683
|
newState_2.captureState = 'requestingFlip';
|
|
4667
|
-
newState_2.
|
|
4668
|
-
newState_2.
|
|
4684
|
+
newState_2.idCardFrontDetectionThresholdMet = false;
|
|
4685
|
+
newState_2.idCardBackDetectionThresholdMet = false;
|
|
4686
|
+
newState_2.passportDetectionThresholdMet = false;
|
|
4669
4687
|
}
|
|
4670
4688
|
}
|
|
4671
4689
|
return newState_2;
|
|
@@ -7795,85 +7813,42 @@
|
|
|
7795
7813
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
7796
7814
|
|
|
7797
7815
|
var IdCapture = function IdCapture(_a) {
|
|
7798
|
-
var _b, _c, _d, _e, _f, _g, _h, _j
|
|
7816
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7799
7817
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
_o = _a.autoCaptureBarcodeRequired,
|
|
7803
|
-
autoCaptureBarcodeRequired = _o === void 0 ? 'mobile' : _o,
|
|
7804
|
-
_p = _a.idCardDetectionThreshold,
|
|
7805
|
-
idCardDetectionThreshold = _p === void 0 ? defaultDocumentDetectionThresholds.idCard : _p,
|
|
7806
|
-
_q = _a.passportDetectionThreshold,
|
|
7807
|
-
passportDetectionThreshold = _q === void 0 ? defaultDocumentDetectionThresholds.passport : _q,
|
|
7808
|
-
_r = _a.mrzDetectionScoreThreshold,
|
|
7809
|
-
mrzDetectionScoreThreshold = _r === void 0 ? defaultDocumentDetectionThresholds.mrz : _r,
|
|
7810
|
-
_s = _a.pdf417DetectionThreshold,
|
|
7811
|
-
pdf417DetectionThreshold = _s === void 0 ? defaultDocumentDetectionThresholds.pdf417 : _s,
|
|
7812
|
-
_t = _a.idCardFocusScoreThreshold,
|
|
7813
|
-
idCardFocusScoreThreshold = _t === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _t,
|
|
7814
|
-
_u = _a.passportFocusScoreThreshold,
|
|
7815
|
-
passportFocusScoreThreshold = _u === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _u,
|
|
7816
|
-
_v = _a.barcodeScanningEnabled,
|
|
7817
|
-
barcodeScanningEnabled = _v === void 0 ? true : _v,
|
|
7818
|
-
_w = _a.maxBarcodeScanAttempts,
|
|
7819
|
-
maxBarcodeScanAttempts = _w === void 0 ? 10 : _w,
|
|
7818
|
+
_k = _a.thresholds,
|
|
7819
|
+
thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
|
|
7820
7820
|
guidanceMessage = _a.guidanceMessage,
|
|
7821
7821
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
7822
|
-
onPrediction = _a.onPrediction,
|
|
7823
7822
|
onCapture = _a.onCapture,
|
|
7824
|
-
|
|
7825
|
-
assets =
|
|
7826
|
-
|
|
7827
|
-
classNames =
|
|
7828
|
-
|
|
7829
|
-
colors =
|
|
7830
|
-
|
|
7831
|
-
rawVerbiage =
|
|
7832
|
-
|
|
7833
|
-
debugMode =
|
|
7834
|
-
var
|
|
7835
|
-
ref =
|
|
7836
|
-
|
|
7837
|
-
width =
|
|
7838
|
-
|
|
7839
|
-
height =
|
|
7840
|
-
var
|
|
7841
|
-
state =
|
|
7842
|
-
dispatch =
|
|
7823
|
+
_l = _a.assets,
|
|
7824
|
+
assets = _l === void 0 ? {} : _l,
|
|
7825
|
+
_m = _a.classNames,
|
|
7826
|
+
classNames = _m === void 0 ? {} : _m,
|
|
7827
|
+
_o = _a.colors,
|
|
7828
|
+
colors = _o === void 0 ? {} : _o,
|
|
7829
|
+
_p = _a.verbiage,
|
|
7830
|
+
rawVerbiage = _p === void 0 ? {} : _p,
|
|
7831
|
+
_q = _a.debugMode,
|
|
7832
|
+
debugMode = _q === void 0 ? false : _q;
|
|
7833
|
+
var _r = useResizeObserver(),
|
|
7834
|
+
ref = _r.ref,
|
|
7835
|
+
_s = _r.width,
|
|
7836
|
+
width = _s === void 0 ? 1 : _s,
|
|
7837
|
+
_t = _r.height,
|
|
7838
|
+
height = _t === void 0 ? 1 : _t;
|
|
7839
|
+
var _u = useIdCaptureState(),
|
|
7840
|
+
state = _u[0],
|
|
7841
|
+
dispatch = _u[1];
|
|
7843
7842
|
var cameraRef = React.useContext(CameraStateContext).cameraRef;
|
|
7844
|
-
var
|
|
7845
|
-
modelsReady =
|
|
7846
|
-
setThresholds =
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
getBestFrame = _6.getBestFrame;
|
|
7843
|
+
var _v = React.useContext(IdCaptureModelsContext),
|
|
7844
|
+
modelsReady = _v.ready,
|
|
7845
|
+
setThresholds = _v.setThresholds,
|
|
7846
|
+
detectionTime = _v.detectionTime,
|
|
7847
|
+
focusPredictionTime = _v.focusPredictionTime,
|
|
7848
|
+
getBestFrame = _v.getBestFrame;
|
|
7851
7849
|
React.useEffect(function () {
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
payload: {
|
|
7855
|
-
autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
|
|
7856
|
-
barcodeScanningEnabled: barcodeScanningEnabled,
|
|
7857
|
-
maxBarcodeScanAttempts: maxBarcodeScanAttempts
|
|
7858
|
-
}
|
|
7859
|
-
});
|
|
7860
|
-
}, [autoCaptureBarcodeRequired, barcodeScanningEnabled, dispatch, maxBarcodeScanAttempts]);
|
|
7861
|
-
React.useEffect(function () {
|
|
7862
|
-
setThresholds({
|
|
7863
|
-
idCard: idCardDetectionThreshold,
|
|
7864
|
-
passport: passportDetectionThreshold,
|
|
7865
|
-
mrz: mrzDetectionScoreThreshold,
|
|
7866
|
-
pdf417: pdf417DetectionThreshold,
|
|
7867
|
-
focus: {
|
|
7868
|
-
idCard: {
|
|
7869
|
-
mobile: idCardFocusScoreThreshold
|
|
7870
|
-
},
|
|
7871
|
-
passport: {
|
|
7872
|
-
mobile: passportFocusScoreThreshold
|
|
7873
|
-
}
|
|
7874
|
-
}
|
|
7875
|
-
});
|
|
7876
|
-
}, [idCardDetectionThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, passportDetectionThreshold, passportFocusScoreThreshold, pdf417DetectionThreshold, setThresholds]);
|
|
7850
|
+
setThresholds(thresholds);
|
|
7851
|
+
}, [thresholds, setThresholds]);
|
|
7877
7852
|
React.useEffect(function () {
|
|
7878
7853
|
if (!requiredDocumentType) return;
|
|
7879
7854
|
dispatch({
|
|
@@ -7890,18 +7865,7 @@
|
|
|
7890
7865
|
}
|
|
7891
7866
|
});
|
|
7892
7867
|
}, [dispatch, height, width]);
|
|
7893
|
-
|
|
7894
|
-
onPredictionMade(function (prediction) {
|
|
7895
|
-
dispatch({
|
|
7896
|
-
type: 'objectsDetected',
|
|
7897
|
-
payload: {
|
|
7898
|
-
prediction: prediction
|
|
7899
|
-
}
|
|
7900
|
-
});
|
|
7901
|
-
onPrediction === null || onPrediction === void 0 ? void 0 : onPrediction(prediction);
|
|
7902
|
-
});
|
|
7903
|
-
}, [dispatch, onPrediction, onPredictionMade]);
|
|
7904
|
-
var shouldCapture = autoCaptureEnabled && state.goodFramesThresholdMet && !state.capturing && !state.waitingForBarcodeScan && timeSince(state.captureStartedAt) >= 3000;
|
|
7868
|
+
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7905
7869
|
React.useEffect(function () {
|
|
7906
7870
|
if (!shouldCapture) return;
|
|
7907
7871
|
dispatch({
|
|
@@ -7915,29 +7879,13 @@
|
|
|
7915
7879
|
});
|
|
7916
7880
|
return;
|
|
7917
7881
|
}
|
|
7918
|
-
var
|
|
7882
|
+
var canvas = bestFrame.canvas,
|
|
7919
7883
|
documentType = bestFrame.documentType,
|
|
7920
7884
|
boundingBox = bestFrame.boundingBox,
|
|
7921
7885
|
detectionScore = bestFrame.detectionScore,
|
|
7922
7886
|
focusScore = bestFrame.focusScore;
|
|
7923
|
-
var width =
|
|
7924
|
-
height =
|
|
7925
|
-
var canvas = originalCanvas;
|
|
7926
|
-
// resize image to 2k max if barcode is read
|
|
7927
|
-
var isGreaterThan2k = width > 1920 && height > 1080 || width > 1080 && height > 1920;
|
|
7928
|
-
if (isGreaterThan2k && !!state.barcodeResult) {
|
|
7929
|
-
canvas = document.createElement('canvas');
|
|
7930
|
-
if (width > height) {
|
|
7931
|
-
canvas.width = 1920;
|
|
7932
|
-
canvas.height = height * (1920 / width);
|
|
7933
|
-
} else {
|
|
7934
|
-
canvas.height = 1920;
|
|
7935
|
-
canvas.width = width * (1920 / height);
|
|
7936
|
-
}
|
|
7937
|
-
var ctx2d = canvas.getContext('2d');
|
|
7938
|
-
if (!ctx2d) return;
|
|
7939
|
-
ctx2d.drawImage(originalCanvas, 0, 0, canvas.width, canvas.height);
|
|
7940
|
-
}
|
|
7887
|
+
var width = canvas.width,
|
|
7888
|
+
height = canvas.height;
|
|
7941
7889
|
var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
|
|
7942
7890
|
dispatch({
|
|
7943
7891
|
type: 'frameCaptured',
|
|
@@ -7961,18 +7909,17 @@
|
|
|
7961
7909
|
type: 'captured'
|
|
7962
7910
|
});
|
|
7963
7911
|
}, 0);
|
|
7964
|
-
}, [dispatch, getBestFrame, onCapture, shouldCapture, state.
|
|
7912
|
+
}, [dispatch, getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
|
|
7965
7913
|
assets.portraitGuidesImageUrl || (assets.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
|
|
7966
7914
|
assets.landscapeGuidesImageUrl || (assets.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
|
|
7967
7915
|
var theme = styled.useTheme();
|
|
7968
|
-
colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (
|
|
7969
|
-
colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (
|
|
7916
|
+
colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.unsatisfiedColor) !== null && _d !== void 0 ? _d : 'white');
|
|
7917
|
+
colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.satisfiedColor) !== null && _g !== void 0 ? _g : 'green');
|
|
7970
7918
|
var verbiage = useTranslations(rawVerbiage, {
|
|
7971
7919
|
instructionText: 'Scan the front of ID',
|
|
7972
7920
|
processingIdCardText: 'ID card front captured.',
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
guidanceSatisfiedText: 'Document detected, hold still...',
|
|
7921
|
+
guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
|
|
7922
|
+
guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
|
|
7976
7923
|
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
7977
7924
|
guidanceNotCenteredText: 'Document is not centered',
|
|
7978
7925
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
@@ -7987,10 +7934,10 @@
|
|
|
7987
7934
|
});
|
|
7988
7935
|
var satisfied = state.isGoodFrame;
|
|
7989
7936
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
7990
|
-
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.
|
|
7937
|
+
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.flipRequired ? verbiage.guidancePleaseFlipText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
|
|
7991
7938
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
7992
7939
|
ref: ref,
|
|
7993
|
-
className: "flex ".concat((
|
|
7940
|
+
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
7994
7941
|
}, guidanceMessage !== '' && ( /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
|
|
7995
7942
|
"$top": "",
|
|
7996
7943
|
"$bottom": "12.5dvh",
|
|
@@ -7999,7 +7946,7 @@
|
|
|
7999
7946
|
"$variant": satisfied ? 'positive' : 'default',
|
|
8000
7947
|
className: classNames.guidanceMessage
|
|
8001
7948
|
}, guidanceMessage))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugBoundingBoxOverlay, {
|
|
8002
|
-
"$flipX": !((
|
|
7949
|
+
"$flipX": !((_j = cameraRef.current) === null || _j === void 0 ? void 0 : _j.isRearFacing),
|
|
8003
7950
|
scaling: debugScalingDetails
|
|
8004
7951
|
}, state.detectedObjects.map(function (obj, i) {
|
|
8005
7952
|
var _a;
|
|
@@ -8009,7 +7956,7 @@
|
|
|
8009
7956
|
scaling: debugScalingDetails,
|
|
8010
7957
|
flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
|
|
8011
7958
|
});
|
|
8012
|
-
}))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['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['default'].createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, state.
|
|
7959
|
+
}))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['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['default'].createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default['default'].createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default['default'].createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u274C Models not ready")))));
|
|
8013
7960
|
};
|
|
8014
7961
|
var timeSince = function timeSince(t) {
|
|
8015
7962
|
if (!t) return 0;
|
|
@@ -8943,11 +8890,7 @@
|
|
|
8943
8890
|
setUrl(cropToDetectedObjectBox(imgRef.current, bbox).toDataURL('image/jpeg', 0.95));
|
|
8944
8891
|
}, 100);
|
|
8945
8892
|
}
|
|
8946
|
-
return /*#__PURE__*/React__default['default'].createElement("
|
|
8947
|
-
style: {
|
|
8948
|
-
position: 'relative'
|
|
8949
|
-
}
|
|
8950
|
-
}, /*#__PURE__*/React__default['default'].createElement("img", {
|
|
8893
|
+
return /*#__PURE__*/React__default['default'].createElement("img", {
|
|
8951
8894
|
ref: imgRef,
|
|
8952
8895
|
alt: alt,
|
|
8953
8896
|
className: className,
|
|
@@ -8967,13 +8910,12 @@
|
|
|
8967
8910
|
(_a = link.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(link);
|
|
8968
8911
|
});
|
|
8969
8912
|
}
|
|
8970
|
-
})
|
|
8913
|
+
});
|
|
8971
8914
|
};
|
|
8972
8915
|
|
|
8973
8916
|
var OverlayInstruction = styled__default['default'].p(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
|
|
8974
8917
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
8975
8918
|
var capturedDocuments = _a.capturedDocuments,
|
|
8976
|
-
// barcodeResult,
|
|
8977
8919
|
onSubmitClick = _a.onSubmitClick,
|
|
8978
8920
|
onRetryClick = _a.onRetryClick,
|
|
8979
8921
|
_b = _a.classNames,
|
|
@@ -8981,7 +8923,9 @@
|
|
|
8981
8923
|
_c = _a.colors,
|
|
8982
8924
|
colors = _c === void 0 ? {} : _c,
|
|
8983
8925
|
_d = _a.verbiage,
|
|
8984
|
-
rawVerbiage = _d === void 0 ? {} : _d
|
|
8926
|
+
rawVerbiage = _d === void 0 ? {} : _d,
|
|
8927
|
+
_e = _a.debugMode,
|
|
8928
|
+
debugMode = _e === void 0 ? false : _e;
|
|
8985
8929
|
var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
|
|
8986
8930
|
var idCardFront = capturedDocuments.idCardFront,
|
|
8987
8931
|
idCardBack = capturedDocuments.idCardBack,
|
|
@@ -9016,7 +8960,7 @@
|
|
|
9016
8960
|
image: idCardFront,
|
|
9017
8961
|
className: classNames.image,
|
|
9018
8962
|
alt: verbiage.idCardFrontText
|
|
9019
|
-
})))), idCardBack && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
|
|
8963
|
+
})), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
|
|
9020
8964
|
className: classNames.imageCol
|
|
9021
8965
|
}, /*#__PURE__*/React__default['default'].createElement(ImageHeading, {
|
|
9022
8966
|
className: classNames.imageHeading
|
|
@@ -9026,7 +8970,7 @@
|
|
|
9026
8970
|
image: idCardBack,
|
|
9027
8971
|
className: classNames.image,
|
|
9028
8972
|
alt: verbiage.idCardBackText
|
|
9029
|
-
})))), passport && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
|
|
8973
|
+
})), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
|
|
9030
8974
|
className: classNames.imageCol
|
|
9031
8975
|
}, /*#__PURE__*/React__default['default'].createElement(ImageHeading, {
|
|
9032
8976
|
className: classNames.imageHeading
|
|
@@ -9036,7 +8980,7 @@
|
|
|
9036
8980
|
image: passport,
|
|
9037
8981
|
className: classNames.image,
|
|
9038
8982
|
alt: verbiage.passportText
|
|
9039
|
-
})))))), /*#__PURE__*/React__default['default'].createElement(OverlayInstruction, {
|
|
8983
|
+
})), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default['default'].createElement(OverlayInstruction, {
|
|
9040
8984
|
className: classNames.instruction
|
|
9041
8985
|
}, verbiage.instructionText), /*#__PURE__*/React__default['default'].createElement(ButtonsRow, {
|
|
9042
8986
|
className: classNames.buttonsRow
|
|
@@ -9638,13 +9582,8 @@
|
|
|
9638
9582
|
var cameraRef = React.useContext(CameraStateContext).cameraRef;
|
|
9639
9583
|
var verbiage = useTranslations(rawVerbiage, {
|
|
9640
9584
|
instructionText: 'Scan the front of ID',
|
|
9641
|
-
processingIdCardText: 'ID card front captured.',
|
|
9642
9585
|
capturingText: 'Capturing...',
|
|
9643
|
-
captureFailedText: 'Capture failed!'
|
|
9644
|
-
guidanceSatisfiedText: 'Document detected, hold still...',
|
|
9645
|
-
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
9646
|
-
guidanceNotCenteredText: 'Document is not centered',
|
|
9647
|
-
guidanceNotDetectedText: 'Document not detected'
|
|
9586
|
+
captureFailedText: 'Capture failed!'
|
|
9648
9587
|
});
|
|
9649
9588
|
var isMobile = window.innerWidth < window.innerHeight;
|
|
9650
9589
|
var frontImageUrl = portraitGuidesOnMobile && isMobile ? flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontPortraitGuidesImageUrl : flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontLandscapeGuidesImageUrl;
|
|
@@ -9658,7 +9597,7 @@
|
|
|
9658
9597
|
landscapeGuidesImageUrl: assets.landscapeGuidesImageUrl,
|
|
9659
9598
|
isMirrored: !((_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing),
|
|
9660
9599
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
9661
|
-
imageVisible: requestingFlip || !state.
|
|
9600
|
+
imageVisible: requestingFlip || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
|
|
9662
9601
|
})), guideType === 'fit' && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureFitGuide, {
|
|
9663
9602
|
classNames: classNames,
|
|
9664
9603
|
requestingFlip: requestingFlip,
|
|
@@ -9668,7 +9607,7 @@
|
|
|
9668
9607
|
backImageUrl: backImageUrl,
|
|
9669
9608
|
isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
|
|
9670
9609
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
9671
|
-
imageVisible: requestingFlip || !state.
|
|
9610
|
+
imageVisible: requestingFlip || !state.detectionThresholdMet || !state.documentInBounds || state.documentTooClose || state.flipRequired
|
|
9672
9611
|
})));
|
|
9673
9612
|
}
|
|
9674
9613
|
|
|
@@ -10563,78 +10502,66 @@
|
|
|
10563
10502
|
var templateObject_1$l, templateObject_2$f, templateObject_3$d, templateObject_4$8, templateObject_5$4, templateObject_6$3;
|
|
10564
10503
|
|
|
10565
10504
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
10566
|
-
var _b, _c, _d, _e, _f, _g
|
|
10567
|
-
var _k, _l, _m, _o, _p, _q, _r, _s
|
|
10505
|
+
var _b, _c, _d, _e, _f, _g;
|
|
10506
|
+
var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
10568
10507
|
var onSuccess = _a.onSuccess,
|
|
10569
10508
|
onExitCapture = _a.onExitCapture,
|
|
10570
10509
|
onUserCancel = _a.onUserCancel,
|
|
10571
|
-
|
|
10572
|
-
loadingOverlayMode =
|
|
10510
|
+
_t = _a.loadingOverlayMode,
|
|
10511
|
+
loadingOverlayMode = _t === void 0 ? 'default' : _t,
|
|
10573
10512
|
precapturedDocuments = _a.precapturedDocuments,
|
|
10574
|
-
|
|
10575
|
-
captureRequirement =
|
|
10576
|
-
|
|
10577
|
-
separateIdCardCaptureSequence =
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
_0 = _a.barcodeScanningEnabled,
|
|
10583
|
-
barcodeScanningEnabled = _0 === void 0 ? false : _0,
|
|
10584
|
-
_1 = _a.idCardAutoCaptureScoreThreshold,
|
|
10585
|
-
idCardAutoCaptureScoreThreshold = _1 === void 0 ? defaultDocumentDetectionThresholds.idCard : _1,
|
|
10586
|
-
_2 = _a.passportAutoCaptureScoreThreshold,
|
|
10587
|
-
passportAutoCaptureScoreThreshold = _2 === void 0 ? defaultDocumentDetectionThresholds.passport : _2,
|
|
10588
|
-
_3 = _a.mrzDetectionScoreThreshold,
|
|
10589
|
-
mrzDetectionScoreThreshold = _3 === void 0 ? defaultDocumentDetectionThresholds.mrz : _3,
|
|
10590
|
-
_4 = _a.idCardFocusScoreThreshold,
|
|
10591
|
-
idCardFocusScoreThreshold = _4 === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _4,
|
|
10592
|
-
_5 = _a.passportFocusScoreThreshold,
|
|
10593
|
-
passportFocusScoreThreshold = _5 === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _5,
|
|
10594
|
-
_6 = _a.skipSuccessScreen,
|
|
10595
|
-
skipSuccessScreen = _6 === void 0 ? false : _6,
|
|
10513
|
+
_u = _a.captureRequirement,
|
|
10514
|
+
captureRequirement = _u === void 0 ? 'idCardOrPassport' : _u,
|
|
10515
|
+
_v = _a.separateIdCardCaptureSequence,
|
|
10516
|
+
separateIdCardCaptureSequence = _v === void 0 ? false : _v,
|
|
10517
|
+
_w = _a.thresholds,
|
|
10518
|
+
thresholds = _w === void 0 ? defaultIdCaptureThresholds : _w,
|
|
10519
|
+
_x = _a.skipSuccessScreen,
|
|
10520
|
+
skipSuccessScreen = _x === void 0 ? false : _x,
|
|
10596
10521
|
instructions = _a.instructions,
|
|
10597
|
-
|
|
10598
|
-
releaseCameraAccessOnExit =
|
|
10599
|
-
|
|
10600
|
-
guideType =
|
|
10601
|
-
|
|
10602
|
-
portraitGuidesOnMobile =
|
|
10603
|
-
|
|
10604
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
10605
|
-
|
|
10606
|
-
silentFallback =
|
|
10607
|
-
|
|
10608
|
-
assets =
|
|
10609
|
-
|
|
10610
|
-
classNames =
|
|
10611
|
-
|
|
10612
|
-
colors =
|
|
10613
|
-
|
|
10614
|
-
verbiage =
|
|
10615
|
-
|
|
10616
|
-
debugMode =
|
|
10617
|
-
var
|
|
10618
|
-
state =
|
|
10619
|
-
dispatch =
|
|
10620
|
-
var
|
|
10621
|
-
cameraAccessDenied =
|
|
10622
|
-
releaseCameraAccess =
|
|
10623
|
-
var
|
|
10624
|
-
overlayDismissed =
|
|
10625
|
-
setOverlayDismissed =
|
|
10626
|
-
var
|
|
10627
|
-
submissionStatus =
|
|
10628
|
-
setIdFrontImage =
|
|
10629
|
-
setIdBackImage =
|
|
10630
|
-
setPassportImage =
|
|
10631
|
-
logIdFrontCaptureAttempt =
|
|
10632
|
-
logIdBackCaptureAttempt =
|
|
10633
|
-
var
|
|
10634
|
-
start =
|
|
10635
|
-
stop =
|
|
10636
|
-
|
|
10637
|
-
|
|
10522
|
+
_y = _a.releaseCameraAccessOnExit,
|
|
10523
|
+
releaseCameraAccessOnExit = _y === void 0 ? true : _y,
|
|
10524
|
+
_z = _a.guideType,
|
|
10525
|
+
guideType = _z === void 0 ? 'fit' : _z,
|
|
10526
|
+
_0 = _a.portraitGuidesOnMobile,
|
|
10527
|
+
portraitGuidesOnMobile = _0 === void 0 ? false : _0,
|
|
10528
|
+
_1 = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
10529
|
+
rotateLoadingOverlayImageWhenPortrait = _1 === void 0 ? true : _1,
|
|
10530
|
+
_2 = _a.silentFallback,
|
|
10531
|
+
silentFallback = _2 === void 0 ? false : _2,
|
|
10532
|
+
_3 = _a.assets,
|
|
10533
|
+
assets = _3 === void 0 ? {} : _3,
|
|
10534
|
+
_4 = _a.classNames,
|
|
10535
|
+
classNames = _4 === void 0 ? {} : _4,
|
|
10536
|
+
_5 = _a.colors,
|
|
10537
|
+
colors = _5 === void 0 ? {} : _5,
|
|
10538
|
+
_6 = _a.verbiage,
|
|
10539
|
+
verbiage = _6 === void 0 ? {} : _6,
|
|
10540
|
+
_7 = _a.debugMode,
|
|
10541
|
+
debugMode = _7 === void 0 ? false : _7;
|
|
10542
|
+
var _8 = useIdCaptureState(),
|
|
10543
|
+
state = _8[0],
|
|
10544
|
+
dispatch = _8[1];
|
|
10545
|
+
var _9 = React.useContext(CameraStateContext),
|
|
10546
|
+
cameraAccessDenied = _9.cameraAccessDenied,
|
|
10547
|
+
releaseCameraAccess = _9.releaseCameraAccess;
|
|
10548
|
+
var _10 = React.useState(false),
|
|
10549
|
+
overlayDismissed = _10[0],
|
|
10550
|
+
setOverlayDismissed = _10[1];
|
|
10551
|
+
var _11 = React.useContext(SubmissionContext),
|
|
10552
|
+
submissionStatus = _11.submissionStatus,
|
|
10553
|
+
setIdFrontImage = _11.setIdFrontImage,
|
|
10554
|
+
setIdBackImage = _11.setIdBackImage,
|
|
10555
|
+
setPassportImage = _11.setPassportImage,
|
|
10556
|
+
logIdFrontCaptureAttempt = _11.logIdFrontCaptureAttempt,
|
|
10557
|
+
logIdBackCaptureAttempt = _11.logIdBackCaptureAttempt;
|
|
10558
|
+
var _12 = React.useContext(IdCaptureModelsContext),
|
|
10559
|
+
start = _12.start,
|
|
10560
|
+
stop = _12.stop,
|
|
10561
|
+
onPredictionMade = _12.onPredictionMade,
|
|
10562
|
+
setRequiredDocumentType = _12.setRequiredDocumentType,
|
|
10563
|
+
modelError = _12.modelError,
|
|
10564
|
+
resetBestFrame = _12.resetBestFrame;
|
|
10638
10565
|
React.useEffect(function () {
|
|
10639
10566
|
dispatch({
|
|
10640
10567
|
type: 'configureWizard',
|
|
@@ -10659,16 +10586,29 @@
|
|
|
10659
10586
|
type: 'captureStarted'
|
|
10660
10587
|
});
|
|
10661
10588
|
start();
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10589
|
+
}, [dispatch, overlayDismissed, start, state.captureState]);
|
|
10590
|
+
React.useEffect(function () {
|
|
10591
|
+
onPredictionMade(function (prediction) {
|
|
10592
|
+
if (state.captureState === 'capturing') {
|
|
10593
|
+
dispatch({
|
|
10594
|
+
type: 'objectsDetected',
|
|
10595
|
+
payload: {
|
|
10596
|
+
prediction: prediction
|
|
10597
|
+
}
|
|
10598
|
+
});
|
|
10599
|
+
} else if (state.captureState === 'requestingFlip') {
|
|
10600
|
+
if (prediction.idCardBackDetectionThresholdMet) {
|
|
10601
|
+
resetBestFrame();
|
|
10602
|
+
dispatch({
|
|
10603
|
+
type: 'flipRequestCompleted'
|
|
10604
|
+
});
|
|
10605
|
+
}
|
|
10606
|
+
}
|
|
10670
10607
|
});
|
|
10671
|
-
}, [dispatch]);
|
|
10608
|
+
}, [dispatch, onPredictionMade, resetBestFrame, state.captureState]);
|
|
10609
|
+
React.useEffect(function () {
|
|
10610
|
+
if (state.captureState === 'complete') stop();
|
|
10611
|
+
}, [state.captureState, stop]);
|
|
10672
10612
|
var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
|
|
10673
10613
|
logCaptureMetadata(metadata);
|
|
10674
10614
|
dispatch({
|
|
@@ -10678,7 +10618,9 @@
|
|
|
10678
10618
|
width: width,
|
|
10679
10619
|
height: height,
|
|
10680
10620
|
documentType: documentType,
|
|
10681
|
-
boundingBox: metadata.boundingBox
|
|
10621
|
+
boundingBox: metadata.boundingBox,
|
|
10622
|
+
detectionScore: metadata.bestDetectionScore,
|
|
10623
|
+
focusScore: metadata.bestFocusScore
|
|
10682
10624
|
}
|
|
10683
10625
|
});
|
|
10684
10626
|
}, [dispatch, logCaptureMetadata]);
|
|
@@ -10708,9 +10650,9 @@
|
|
|
10708
10650
|
type: 'resetWizard'
|
|
10709
10651
|
});
|
|
10710
10652
|
}, [dispatch]);
|
|
10711
|
-
var
|
|
10712
|
-
attempt =
|
|
10713
|
-
setAttempt =
|
|
10653
|
+
var _13 = React.useState(0),
|
|
10654
|
+
attempt = _13[0],
|
|
10655
|
+
setAttempt = _13[1];
|
|
10714
10656
|
var onExit = React.useCallback(function () {
|
|
10715
10657
|
setOverlayDismissed(false);
|
|
10716
10658
|
setAttempt(function (n) {
|
|
@@ -10735,19 +10677,19 @@
|
|
|
10735
10677
|
}
|
|
10736
10678
|
}, [cameraAccessDenied]);
|
|
10737
10679
|
assets.idCardFront || (assets.idCardFront = {});
|
|
10738
|
-
(
|
|
10739
|
-
(
|
|
10680
|
+
(_h = assets.idCardFront).portraitGuidesImageUrl || (_h.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
|
|
10681
|
+
(_j = assets.idCardFront).landscapeGuidesImageUrl || (_j.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
|
|
10740
10682
|
assets.idCardBack || (assets.idCardBack = {});
|
|
10741
|
-
(
|
|
10742
|
-
(
|
|
10683
|
+
(_k = assets.idCardBack).portraitGuidesImageUrl || (_k.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Portrait-2.svg"));
|
|
10684
|
+
(_l = assets.idCardBack).landscapeGuidesImageUrl || (_l.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
|
|
10743
10685
|
assets.passport || (assets.passport = {});
|
|
10744
|
-
(
|
|
10745
|
-
(
|
|
10686
|
+
(_m = assets.passport).portraitGuidesImageUrl || (_m.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Portrait-2.svg"));
|
|
10687
|
+
(_o = assets.passport).landscapeGuidesImageUrl || (_o.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Landscape-2.svg"));
|
|
10746
10688
|
assets.flipIdPrompt || (assets.flipIdPrompt = {});
|
|
10747
|
-
(
|
|
10748
|
-
(
|
|
10749
|
-
(
|
|
10750
|
-
(
|
|
10689
|
+
(_p = assets.flipIdPrompt).frontPortraitGuidesImageUrl || (_p.frontPortraitGuidesImageUrl = assets.idCardFront.portraitGuidesImageUrl);
|
|
10690
|
+
(_q = assets.flipIdPrompt).frontLandscapeGuidesImageUrl || (_q.frontLandscapeGuidesImageUrl = assets.idCardFront.landscapeGuidesImageUrl);
|
|
10691
|
+
(_r = assets.flipIdPrompt).backPortraitGuidesImageUrl || (_r.backPortraitGuidesImageUrl = assets.idCardBack.portraitGuidesImageUrl);
|
|
10692
|
+
(_s = assets.flipIdPrompt).backLandscapeGuidesImageUrl || (_s.backLandscapeGuidesImageUrl = assets.idCardBack.landscapeGuidesImageUrl);
|
|
10751
10693
|
var idCaptureVerbiages = {
|
|
10752
10694
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
10753
10695
|
instructionText: 'Scan the front of ID',
|
|
@@ -10761,24 +10703,35 @@
|
|
|
10761
10703
|
})
|
|
10762
10704
|
};
|
|
10763
10705
|
var theme = styled.useTheme();
|
|
10764
|
-
var
|
|
10765
|
-
guideRectX =
|
|
10766
|
-
guideRectY =
|
|
10767
|
-
guideRectWidth =
|
|
10768
|
-
guideRectHeight =
|
|
10769
|
-
imageUrl =
|
|
10706
|
+
var _14 = useIdCaptureState()[0],
|
|
10707
|
+
guideRectX = _14.guideRectX,
|
|
10708
|
+
guideRectY = _14.guideRectY,
|
|
10709
|
+
guideRectWidth = _14.guideRectWidth,
|
|
10710
|
+
guideRectHeight = _14.guideRectHeight,
|
|
10711
|
+
imageUrl = _14.imageUrl;
|
|
10770
10712
|
var idCaptureAssets = assets[state.requestedDocumentType];
|
|
10771
10713
|
var idCaptureVerbiage = idCaptureVerbiages[state.requestedDocumentType];
|
|
10772
10714
|
React.useEffect(function () {
|
|
10773
10715
|
if (separateIdCardCaptureSequence) return;
|
|
10774
|
-
if (state.captureState
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
}
|
|
10716
|
+
if (state.captureState !== 'requestingFlip') return;
|
|
10717
|
+
var t = setTimeout(function () {
|
|
10718
|
+
resetBestFrame();
|
|
10719
|
+
dispatch({
|
|
10720
|
+
type: 'flipRequestCompleted'
|
|
10721
|
+
});
|
|
10722
|
+
}, 6000);
|
|
10723
|
+
return function () {
|
|
10724
|
+
clearTimeout(t);
|
|
10725
|
+
};
|
|
10726
|
+
}, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
10727
|
+
React.useEffect(function () {
|
|
10728
|
+
if (state.requestedDocumentType === 'idCardBack') {
|
|
10729
|
+
setRequiredDocumentType('idCardBack');
|
|
10780
10730
|
}
|
|
10781
|
-
|
|
10731
|
+
return function () {
|
|
10732
|
+
setRequiredDocumentType('none');
|
|
10733
|
+
};
|
|
10734
|
+
}, [setRequiredDocumentType, state.requestedDocumentType]);
|
|
10782
10735
|
var handleCapture = React.useCallback(function (imageData) {
|
|
10783
10736
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
10784
10737
|
var base64ImageData;
|
|
@@ -10812,7 +10765,7 @@
|
|
|
10812
10765
|
});
|
|
10813
10766
|
}
|
|
10814
10767
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
10815
|
-
className: "flex ".concat((
|
|
10768
|
+
className: "flex ".concat((_b = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _b !== void 0 ? _b : '')
|
|
10816
10769
|
}, state.captureState !== 'complete' && ( /*#__PURE__*/React__default['default'].createElement(CameraFeedWrapper, {
|
|
10817
10770
|
"$x": guideRectX,
|
|
10818
10771
|
"$y": guideRectY,
|
|
@@ -10823,15 +10776,7 @@
|
|
|
10823
10776
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.cameraFeed
|
|
10824
10777
|
}))), overlayDismissed && state.captureState === 'capturing' && ( /*#__PURE__*/React__default['default'].createElement(IdCapture, {
|
|
10825
10778
|
requiredDocumentType: state.requestedDocumentType,
|
|
10826
|
-
|
|
10827
|
-
idCardDetectionThreshold: idCardAutoCaptureScoreThreshold,
|
|
10828
|
-
passportDetectionThreshold: passportAutoCaptureScoreThreshold,
|
|
10829
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
10830
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
10831
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
10832
|
-
autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
|
|
10833
|
-
barcodeScanningEnabled: barcodeScanningEnabled && state.requestedDocumentType === 'idCardBack',
|
|
10834
|
-
onPrediction: onPrediction,
|
|
10779
|
+
thresholds: thresholds,
|
|
10835
10780
|
onCapture: onCapture,
|
|
10836
10781
|
assets: idCaptureAssets,
|
|
10837
10782
|
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.capture,
|
|
@@ -10847,15 +10792,15 @@
|
|
|
10847
10792
|
assets: idCaptureAssets,
|
|
10848
10793
|
colors: colors,
|
|
10849
10794
|
verbiage: idCaptureVerbiage
|
|
10850
|
-
}), !((
|
|
10851
|
-
classNames: (
|
|
10852
|
-
text: (
|
|
10795
|
+
}), !((_d = (_c = theme.idCapture) === null || _c === void 0 ? void 0 : _c.capturePreview) === null || _d === void 0 ? void 0 : _d.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && imageUrl && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
|
|
10796
|
+
classNames: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.imagePreview,
|
|
10797
|
+
text: (_f = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _f === void 0 ? void 0 : _f.processingIdCardText,
|
|
10853
10798
|
imageUrl: imageUrl
|
|
10854
10799
|
})), state.captureState !== 'complete' && ( /*#__PURE__*/React__default['default'].createElement("div", {
|
|
10855
10800
|
id: "idmission-above-guides-content"
|
|
10856
10801
|
})), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
|
|
10857
10802
|
onClick: onExit,
|
|
10858
|
-
className: (
|
|
10803
|
+
className: (_g = classNames.capture) === null || _g === void 0 ? void 0 : _g.exitCaptureBtn
|
|
10859
10804
|
}), !overlayDismissed && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingOverlay, {
|
|
10860
10805
|
key: attempt,
|
|
10861
10806
|
mode: loadingOverlayMode,
|
|
@@ -10882,12 +10827,12 @@
|
|
|
10882
10827
|
verbiage: verbiage.success
|
|
10883
10828
|
})), state.captureState === 'complete' && showSuccessScreen && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureSuccess, {
|
|
10884
10829
|
capturedDocuments: state.capturedDocuments,
|
|
10885
|
-
barcodeResult: state.barcodeResult,
|
|
10886
10830
|
classNames: classNames.success,
|
|
10887
10831
|
onSubmitClick: onSubmitClick,
|
|
10888
10832
|
onRetryClick: onRetryClick,
|
|
10889
10833
|
colors: colors.success,
|
|
10890
|
-
verbiage: verbiage.success
|
|
10834
|
+
verbiage: verbiage.success,
|
|
10835
|
+
debugMode: debugMode
|
|
10891
10836
|
})));
|
|
10892
10837
|
};
|
|
10893
10838
|
|
|
@@ -13576,7 +13521,7 @@
|
|
|
13576
13521
|
var processAudio = React.useCallback(function () {
|
|
13577
13522
|
var _a;
|
|
13578
13523
|
var audioBlob = new Blob(audioChunks.current, {
|
|
13579
|
-
type: 'audio/
|
|
13524
|
+
type: 'audio/mp4'
|
|
13580
13525
|
});
|
|
13581
13526
|
audioChunks.current = [];
|
|
13582
13527
|
setAudioUrl(URL.createObjectURL(audioBlob));
|
|
@@ -14367,6 +14312,31 @@
|
|
|
14367
14312
|
var templateObject_1$6, templateObject_2$6, templateObject_3$6, templateObject_4$1, templateObject_5, templateObject_6;
|
|
14368
14313
|
|
|
14369
14314
|
var edgeBoundary = 0.05;
|
|
14315
|
+
var defaultVideoIdCaptureThresholds = {
|
|
14316
|
+
detection: {
|
|
14317
|
+
idCardFront: 0.6,
|
|
14318
|
+
idCardBack: 0.6,
|
|
14319
|
+
passport: 1
|
|
14320
|
+
},
|
|
14321
|
+
focus: {
|
|
14322
|
+
idCardFront: {
|
|
14323
|
+
desktop: 0,
|
|
14324
|
+
mobile: 0
|
|
14325
|
+
},
|
|
14326
|
+
idCardBack: {
|
|
14327
|
+
desktop: 0,
|
|
14328
|
+
mobile: 0
|
|
14329
|
+
},
|
|
14330
|
+
passport: {
|
|
14331
|
+
desktop: 0,
|
|
14332
|
+
mobile: 0
|
|
14333
|
+
}
|
|
14334
|
+
},
|
|
14335
|
+
goodFrames: {
|
|
14336
|
+
idCardFront: 1,
|
|
14337
|
+
idCardBack: 1
|
|
14338
|
+
}
|
|
14339
|
+
};
|
|
14370
14340
|
var IdVideoCapture = function IdVideoCapture(_a) {
|
|
14371
14341
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
14372
14342
|
var onComplete = _a.onComplete,
|
|
@@ -14378,96 +14348,85 @@
|
|
|
14378
14348
|
idCaptureModelsEnabled = _w === void 0 ? true : _w,
|
|
14379
14349
|
_x = _a.idCardFrontDelay,
|
|
14380
14350
|
idCardFrontDelay = _x === void 0 ? 1000 : _x,
|
|
14381
|
-
_y = _a.
|
|
14382
|
-
|
|
14383
|
-
_z = _a.
|
|
14384
|
-
|
|
14385
|
-
_0 = _a.
|
|
14386
|
-
|
|
14387
|
-
_1 = _a.idCardBackDetectionThreshold,
|
|
14388
|
-
idCardBackDetectionThreshold = _1 === void 0 ? 0.6 : _1,
|
|
14389
|
-
_2 = _a.idCardBackFocusThreshold,
|
|
14390
|
-
idCardBackFocusThreshold = _2 === void 0 ? 0 : _2,
|
|
14391
|
-
_3 = _a.goodIdCardBackFramesThreshold,
|
|
14392
|
-
goodIdCardBackFramesThreshold = _3 === void 0 ? 1 : _3,
|
|
14393
|
-
_4 = _a.skipShowIdCardBack,
|
|
14394
|
-
skipShowIdCardBack = _4 === void 0 ? false : _4,
|
|
14395
|
-
_5 = _a.captureCountdownSeconds,
|
|
14396
|
-
captureCountdownSeconds = _5 === void 0 ? 3 : _5,
|
|
14351
|
+
_y = _a.videoIdCaptureThresholds,
|
|
14352
|
+
videoIdCaptureThresholds = _y === void 0 ? defaultVideoIdCaptureThresholds : _y,
|
|
14353
|
+
_z = _a.skipShowIdCardBack,
|
|
14354
|
+
skipShowIdCardBack = _z === void 0 ? false : _z,
|
|
14355
|
+
_0 = _a.captureCountdownSeconds,
|
|
14356
|
+
captureCountdownSeconds = _0 === void 0 ? 3 : _0,
|
|
14397
14357
|
readTextPrompt = _a.readTextPrompt,
|
|
14398
|
-
|
|
14399
|
-
readTextTimeoutDurationMs =
|
|
14400
|
-
|
|
14401
|
-
readTextMinReadingMs =
|
|
14402
|
-
|
|
14403
|
-
disableFaceDetectionWhileAudioCapture =
|
|
14404
|
-
|
|
14405
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
14406
|
-
|
|
14407
|
-
mergeAVStreams =
|
|
14408
|
-
|
|
14409
|
-
assets =
|
|
14410
|
-
|
|
14411
|
-
classNames =
|
|
14412
|
-
|
|
14413
|
-
colors =
|
|
14414
|
-
|
|
14415
|
-
rawVerbiage =
|
|
14416
|
-
|
|
14417
|
-
debugMode =
|
|
14418
|
-
var
|
|
14419
|
-
ref =
|
|
14420
|
-
|
|
14421
|
-
width =
|
|
14422
|
-
|
|
14423
|
-
height =
|
|
14424
|
-
var
|
|
14425
|
-
cameraRef =
|
|
14426
|
-
videoRef =
|
|
14427
|
-
videoLoaded =
|
|
14428
|
-
cameraReady =
|
|
14429
|
-
microphoneReady =
|
|
14430
|
-
audioStream =
|
|
14431
|
-
setVideoLoaded =
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
|
|
14440
|
-
|
|
14441
|
-
|
|
14442
|
-
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14447
|
-
|
|
14448
|
-
|
|
14449
|
-
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
audioUrl = _26.audioUrl;
|
|
14358
|
+
_1 = _a.readTextTimeoutDurationMs,
|
|
14359
|
+
readTextTimeoutDurationMs = _1 === void 0 ? 15000 : _1,
|
|
14360
|
+
_2 = _a.readTextMinReadingMs,
|
|
14361
|
+
readTextMinReadingMs = _2 === void 0 ? 10000 : _2,
|
|
14362
|
+
_3 = _a.disableFaceDetectionWhileAudioCapture,
|
|
14363
|
+
disableFaceDetectionWhileAudioCapture = _3 === void 0 ? false : _3,
|
|
14364
|
+
_4 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
14365
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _4 === void 0 ? 2000 : _4,
|
|
14366
|
+
_5 = _a.mergeAVStreams,
|
|
14367
|
+
mergeAVStreams = _5 === void 0 ? false : _5,
|
|
14368
|
+
_6 = _a.assets,
|
|
14369
|
+
assets = _6 === void 0 ? {} : _6,
|
|
14370
|
+
_7 = _a.classNames,
|
|
14371
|
+
classNames = _7 === void 0 ? {} : _7,
|
|
14372
|
+
_8 = _a.colors,
|
|
14373
|
+
colors = _8 === void 0 ? {} : _8,
|
|
14374
|
+
_9 = _a.verbiage,
|
|
14375
|
+
rawVerbiage = _9 === void 0 ? {} : _9,
|
|
14376
|
+
_10 = _a.debugMode,
|
|
14377
|
+
debugMode = _10 === void 0 ? false : _10;
|
|
14378
|
+
var _11 = useResizeObserver(),
|
|
14379
|
+
ref = _11.ref,
|
|
14380
|
+
_12 = _11.width,
|
|
14381
|
+
width = _12 === void 0 ? 1 : _12,
|
|
14382
|
+
_13 = _11.height,
|
|
14383
|
+
height = _13 === void 0 ? 1 : _13;
|
|
14384
|
+
var _14 = React.useContext(CameraStateContext),
|
|
14385
|
+
cameraRef = _14.cameraRef,
|
|
14386
|
+
videoRef = _14.videoRef,
|
|
14387
|
+
videoLoaded = _14.videoLoaded,
|
|
14388
|
+
cameraReady = _14.cameraReady,
|
|
14389
|
+
microphoneReady = _14.microphoneReady,
|
|
14390
|
+
audioStream = _14.audioStream,
|
|
14391
|
+
setVideoLoaded = _14.setVideoLoaded;
|
|
14392
|
+
var _15 = React.useState([]),
|
|
14393
|
+
detectedObjects = _15[0],
|
|
14394
|
+
setDetectedObjects = _15[1];
|
|
14395
|
+
var _16 = React.useState([]),
|
|
14396
|
+
faces = _16[0],
|
|
14397
|
+
setFaces = _16[1];
|
|
14398
|
+
var _17 = React.useContext(IdCaptureModelsContext),
|
|
14399
|
+
idModelsReady = _17.ready,
|
|
14400
|
+
startIdModels = _17.start,
|
|
14401
|
+
stopIdModels = _17.stop,
|
|
14402
|
+
onIdPredictionMade = _17.onPredictionMade,
|
|
14403
|
+
setThresholds = _17.setThresholds,
|
|
14404
|
+
bestFrameDetails = _17.bestFrameDetails,
|
|
14405
|
+
resetBestFrame = _17.resetBestFrame,
|
|
14406
|
+
idModelError = _17.modelError;
|
|
14407
|
+
var _18 = React.useState(null),
|
|
14408
|
+
videoStartsAt = _18[0],
|
|
14409
|
+
setVideoStartsAt = _18[1];
|
|
14410
|
+
var _19 = React.useContext(SubmissionContext),
|
|
14411
|
+
setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
|
|
14412
|
+
setExpectedAudioText = _19.setExpectedAudioText;
|
|
14413
|
+
var _20 = React.useContext(SelfieGuidanceModelsContext),
|
|
14414
|
+
onSelfiePredictionMade = _20.onPredictionMade,
|
|
14415
|
+
selfieModelError = _20.error;
|
|
14416
|
+
var _21 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
|
|
14417
|
+
isRecordingVideo = _21.isRecordingVideo,
|
|
14418
|
+
startRecordingVideo = _21.startRecordingVideo,
|
|
14419
|
+
startRecordingAudio = _21.startRecordingAudio,
|
|
14420
|
+
stopRecordingVideo = _21.stopRecordingVideo,
|
|
14421
|
+
stopRecordingAudio = _21.stopRecordingAudio,
|
|
14422
|
+
videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
|
|
14423
|
+
audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
|
|
14424
|
+
videoUrl = _21.videoUrl,
|
|
14425
|
+
audioUrl = _21.audioUrl;
|
|
14467
14426
|
var countdownTimeoutRef = React.useRef(undefined);
|
|
14468
|
-
var
|
|
14469
|
-
countdownRemaining =
|
|
14470
|
-
setCountdownRemaining =
|
|
14427
|
+
var _22 = React.useState(-1),
|
|
14428
|
+
countdownRemaining = _22[0],
|
|
14429
|
+
setCountdownRemaining = _22[1];
|
|
14471
14430
|
React.useEffect(function () {
|
|
14472
14431
|
if (!isRecordingVideo && !videoUrl) {
|
|
14473
14432
|
startRecordingVideo();
|
|
@@ -14487,41 +14446,30 @@
|
|
|
14487
14446
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
14488
14447
|
}
|
|
14489
14448
|
}, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
|
|
14490
|
-
var
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
var _28 = React.useState('SHOW_ID_FRONT'),
|
|
14495
|
-
requestedAction = _28[0],
|
|
14496
|
-
setRequestedAction = _28[1];
|
|
14449
|
+
var _23 = React.useState('SHOW_ID_FRONT'),
|
|
14450
|
+
requestedAction = _23[0],
|
|
14451
|
+
setRequestedAction = _23[1];
|
|
14452
|
+
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
14497
14453
|
React.useEffect(function startModelsWhenCapturing() {
|
|
14498
|
-
if (!
|
|
14454
|
+
if (!shouldRunIdModels) return;
|
|
14499
14455
|
startIdModels();
|
|
14500
14456
|
return function () {
|
|
14501
14457
|
stopIdModels();
|
|
14502
14458
|
};
|
|
14503
|
-
}, [
|
|
14459
|
+
}, [shouldRunIdModels, startIdModels, stopIdModels]);
|
|
14504
14460
|
React.useEffect(function () {
|
|
14505
|
-
setThresholds(
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
setCurrentDetectionScore = _29[1];
|
|
14518
|
-
var _30 = React.useState(0),
|
|
14519
|
-
currentFocusScore = _30[0],
|
|
14520
|
-
setCurrentFocusScore = _30[1];
|
|
14521
|
-
var _31 = React.useState(0),
|
|
14522
|
-
goodFramesCount = _31[0],
|
|
14523
|
-
setGoodFramesCount = _31[1];
|
|
14524
|
-
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
|
|
14461
|
+
setThresholds(videoIdCaptureThresholds);
|
|
14462
|
+
}, [requestedAction, setThresholds, videoIdCaptureThresholds]);
|
|
14463
|
+
var _24 = React.useState(0),
|
|
14464
|
+
currentDetectionScore = _24[0],
|
|
14465
|
+
setCurrentDetectionScore = _24[1];
|
|
14466
|
+
var _25 = React.useState(0),
|
|
14467
|
+
currentFocusScore = _25[0],
|
|
14468
|
+
setCurrentFocusScore = _25[1];
|
|
14469
|
+
var _26 = React.useState(0),
|
|
14470
|
+
goodFramesCount = _26[0],
|
|
14471
|
+
setGoodFramesCount = _26[1];
|
|
14472
|
+
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
|
|
14525
14473
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
14526
14474
|
React.useEffect(function () {
|
|
14527
14475
|
if (!idCaptureModelsEnabled || idModelError) return;
|
|
@@ -14529,18 +14477,19 @@
|
|
|
14529
14477
|
setDetectedObjects(prediction.detectedObjects);
|
|
14530
14478
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
14531
14479
|
setCurrentFocusScore(prediction.focusScore);
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
} else {
|
|
14537
|
-
setGoodFramesCount(0);
|
|
14480
|
+
var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
|
|
14481
|
+
var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
|
|
14482
|
+
if (requestedAction === 'FLIP_ID' && isGoodFrame) {
|
|
14483
|
+
return setRequestedAction('SHOW_ID_BACK');
|
|
14538
14484
|
}
|
|
14485
|
+
setGoodFramesCount(isGoodFrame ? function (n) {
|
|
14486
|
+
return n + 1;
|
|
14487
|
+
} : 0);
|
|
14539
14488
|
});
|
|
14540
|
-
}, [idCaptureModelsEnabled,
|
|
14541
|
-
var
|
|
14542
|
-
idFrontCaptureStartedAt =
|
|
14543
|
-
setFirstGoodFrameTime =
|
|
14489
|
+
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction]);
|
|
14490
|
+
var _27 = React.useState(null),
|
|
14491
|
+
idFrontCaptureStartedAt = _27[0],
|
|
14492
|
+
setFirstGoodFrameTime = _27[1];
|
|
14544
14493
|
React.useEffect(function () {
|
|
14545
14494
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
14546
14495
|
}, [goodFramesCount]);
|
|
@@ -14561,73 +14510,56 @@
|
|
|
14561
14510
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
14562
14511
|
var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
|
|
14563
14512
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
14564
|
-
var
|
|
14565
|
-
countdownStartedAt =
|
|
14566
|
-
setCountdownStartedAt =
|
|
14513
|
+
var _28 = React.useState(),
|
|
14514
|
+
countdownStartedAt = _28[0],
|
|
14515
|
+
setCountdownStartedAt = _28[1];
|
|
14516
|
+
var photoCanvas = React.useRef(null);
|
|
14567
14517
|
var frameLock = React.useRef(false);
|
|
14568
14518
|
var captureFrame = React.useCallback(function () {
|
|
14569
14519
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
14570
|
-
var
|
|
14571
|
-
return __generator(this, function (
|
|
14572
|
-
switch (
|
|
14520
|
+
var frameBase64;
|
|
14521
|
+
return __generator(this, function (_a) {
|
|
14522
|
+
switch (_a.label) {
|
|
14573
14523
|
case 0:
|
|
14574
14524
|
if (frameLock.current) return [2 /*return*/];
|
|
14575
14525
|
frameLock.current = true;
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
if (!frame) {
|
|
14526
|
+
drawToCanvas(photoCanvas.current, videoRef.current);
|
|
14527
|
+
frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
|
|
14528
|
+
if (!frameBase64) {
|
|
14580
14529
|
frameLock.current = false;
|
|
14581
14530
|
return [2 /*return*/];
|
|
14582
14531
|
}
|
|
14583
|
-
|
|
14584
|
-
case
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
if (!_a) return [3 /*break*/, 4];
|
|
14588
|
-
return [4 /*yield*/, new Promise(function (resolve) {
|
|
14589
|
-
var reader = new FileReader();
|
|
14590
|
-
reader.onloadend = function () {
|
|
14591
|
-
return resolve(reader.result);
|
|
14592
|
-
};
|
|
14593
|
-
reader.readAsDataURL(frame);
|
|
14594
|
-
})];
|
|
14595
|
-
case 3:
|
|
14596
|
-
_a = _b.sent();
|
|
14597
|
-
_b.label = 4;
|
|
14598
|
-
case 4:
|
|
14599
|
-
frameBase64 = _a;
|
|
14600
|
-
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 8];
|
|
14532
|
+
_a.label = 1;
|
|
14533
|
+
case 1:
|
|
14534
|
+
_a.trys.push([1,, 7, 8]);
|
|
14535
|
+
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
|
|
14601
14536
|
if (onIdFrontImageCaptured) {
|
|
14602
|
-
|
|
14537
|
+
onIdFrontImageCaptured(frameBase64);
|
|
14603
14538
|
}
|
|
14604
|
-
if (!skipShowIdCardBack) return [3 /*break*/,
|
|
14605
|
-
if (!(skipShowIdCardBack === true)) return [3 /*break*/,
|
|
14539
|
+
if (!skipShowIdCardBack) return [3 /*break*/, 4];
|
|
14540
|
+
if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
|
|
14606
14541
|
return [2 /*return*/, onIdBackCaptureComplete()];
|
|
14607
|
-
case
|
|
14542
|
+
case 2:
|
|
14608
14543
|
return [4 /*yield*/, skipShowIdCardBack()];
|
|
14609
|
-
case
|
|
14610
|
-
if (
|
|
14544
|
+
case 3:
|
|
14545
|
+
if (_a.sent()) {
|
|
14611
14546
|
return [2 /*return*/, onIdBackCaptureComplete()];
|
|
14612
14547
|
}
|
|
14613
|
-
|
|
14614
|
-
case
|
|
14548
|
+
_a.label = 4;
|
|
14549
|
+
case 4:
|
|
14615
14550
|
setRequestedAction('FLIP_ID');
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
}, 6000);
|
|
14619
|
-
return [3 /*break*/, 9];
|
|
14620
|
-
case 8:
|
|
14551
|
+
return [3 /*break*/, 6];
|
|
14552
|
+
case 5:
|
|
14621
14553
|
if (requestedAction == 'SHOW_ID_BACK') {
|
|
14622
14554
|
if (onIdBackImageCaptured) {
|
|
14623
|
-
|
|
14555
|
+
onIdBackImageCaptured(frameBase64);
|
|
14624
14556
|
}
|
|
14625
14557
|
onIdBackCaptureComplete();
|
|
14626
14558
|
}
|
|
14627
|
-
|
|
14628
|
-
case
|
|
14629
|
-
return [3 /*break*/,
|
|
14630
|
-
case
|
|
14559
|
+
_a.label = 6;
|
|
14560
|
+
case 6:
|
|
14561
|
+
return [3 /*break*/, 8];
|
|
14562
|
+
case 7:
|
|
14631
14563
|
setDetectedObjects([]);
|
|
14632
14564
|
setCurrentDetectionScore(0);
|
|
14633
14565
|
setCurrentFocusScore(0);
|
|
@@ -14639,17 +14571,27 @@
|
|
|
14639
14571
|
clearTimeout(countdownTimeoutRef.current);
|
|
14640
14572
|
}
|
|
14641
14573
|
return [7 /*endfinally*/];
|
|
14642
|
-
case
|
|
14574
|
+
case 8:
|
|
14643
14575
|
return [2 /*return*/];
|
|
14644
14576
|
}
|
|
14645
14577
|
});
|
|
14646
14578
|
});
|
|
14647
|
-
}, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack,
|
|
14579
|
+
}, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
|
|
14580
|
+
var isFlipping = requestedAction === 'FLIP_ID';
|
|
14581
|
+
React.useEffect(function () {
|
|
14582
|
+
if (!isFlipping) return;
|
|
14583
|
+
var t = setTimeout(function () {
|
|
14584
|
+
setRequestedAction('SHOW_ID_BACK');
|
|
14585
|
+
}, 6000);
|
|
14586
|
+
return function () {
|
|
14587
|
+
clearTimeout(t);
|
|
14588
|
+
};
|
|
14589
|
+
}, [isFlipping]);
|
|
14648
14590
|
var stopRecording = React.useCallback(function () {
|
|
14649
14591
|
stopRecordingVideo();
|
|
14650
14592
|
stopRecordingAudio();
|
|
14651
14593
|
}, [stopRecordingAudio, stopRecordingVideo]);
|
|
14652
|
-
var satisfied = goodFramesThresholdMet && faceCentered && delaySatisfied;
|
|
14594
|
+
var satisfied = !isFlipping && goodFramesThresholdMet && faceCentered && delaySatisfied;
|
|
14653
14595
|
React.useEffect(function () {
|
|
14654
14596
|
if (satisfied && !countdownStartedAt) {
|
|
14655
14597
|
setCountdownStartedAt(new Date());
|
|
@@ -14669,10 +14611,7 @@
|
|
|
14669
14611
|
}, 1000);
|
|
14670
14612
|
return;
|
|
14671
14613
|
}
|
|
14672
|
-
|
|
14673
|
-
captureFrame();
|
|
14674
|
-
}
|
|
14675
|
-
}, [captureFrame, countdownStartedAt, countdownTimeoutRef]);
|
|
14614
|
+
}, [countdownTimeoutRef]);
|
|
14676
14615
|
React.useEffect(function () {
|
|
14677
14616
|
if (!countdownStartedAt) return;
|
|
14678
14617
|
setCountdownRemaining(captureCountdownSeconds);
|
|
@@ -14682,11 +14621,17 @@
|
|
|
14682
14621
|
return function () {
|
|
14683
14622
|
clearTimeout(countdownTimeoutRef.current);
|
|
14684
14623
|
};
|
|
14685
|
-
}, [captureCountdownSeconds,
|
|
14624
|
+
}, [captureCountdownSeconds, countdownStartedAt, manualCountdown]);
|
|
14625
|
+
React.useEffect(function () {
|
|
14626
|
+
if (countdownRemaining === 0) {
|
|
14627
|
+
setCountdownRemaining(-1);
|
|
14628
|
+
captureFrame().then();
|
|
14629
|
+
}
|
|
14630
|
+
}, [captureFrame, countdownRemaining]);
|
|
14686
14631
|
var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
|
|
14687
|
-
var
|
|
14688
|
-
numFramesWithoutFaces =
|
|
14689
|
-
setNumFramesWithoutFaces =
|
|
14632
|
+
var _29 = React.useState(0),
|
|
14633
|
+
numFramesWithoutFaces = _29[0],
|
|
14634
|
+
setNumFramesWithoutFaces = _29[1];
|
|
14690
14635
|
React.useEffect(function () {
|
|
14691
14636
|
if (!selfieModelError) {
|
|
14692
14637
|
onSelfiePredictionMade(function (faces) {
|
|
@@ -14704,14 +14649,14 @@
|
|
|
14704
14649
|
}
|
|
14705
14650
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
14706
14651
|
var theme = styled.useTheme();
|
|
14707
|
-
var
|
|
14652
|
+
var _30 = useTranslations(rawVerbiage, {
|
|
14708
14653
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
14709
14654
|
searchingForIdCardText: 'Searching for ID card...',
|
|
14710
14655
|
captureBtnText: 'Capture'
|
|
14711
14656
|
}),
|
|
14712
|
-
captureBtnText =
|
|
14713
|
-
faceNotCenteredText =
|
|
14714
|
-
searchingForIdCardText =
|
|
14657
|
+
captureBtnText = _30.captureBtnText,
|
|
14658
|
+
faceNotCenteredText = _30.faceNotCenteredText,
|
|
14659
|
+
searchingForIdCardText = _30.searchingForIdCardText;
|
|
14715
14660
|
var debugScalingDetails = useDebugScalingDetails({
|
|
14716
14661
|
enabled: debugMode,
|
|
14717
14662
|
pageWidth: width,
|
|
@@ -14725,7 +14670,9 @@
|
|
|
14725
14670
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
14726
14671
|
ref: ref,
|
|
14727
14672
|
className: "flex ".concat((_l = classNames.container) !== null && _l !== void 0 ? _l : '')
|
|
14728
|
-
},
|
|
14673
|
+
}, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
14674
|
+
ref: photoCanvas
|
|
14675
|
+
}), requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__default['default'].createElement(ReadTextPrompt, {
|
|
14729
14676
|
text: readTextPrompt,
|
|
14730
14677
|
startedAt: timeoutStartedAt || undefined,
|
|
14731
14678
|
durationMs: readTextTimeoutDurationMs,
|
|
@@ -14764,7 +14711,7 @@
|
|
|
14764
14711
|
className: classNames.guidanceMessage,
|
|
14765
14712
|
"$background": (_q = (_p = (_o = theme.guidanceMessages) === null || _o === void 0 ? void 0 : _o.negative) === null || _p === void 0 ? void 0 : _p.backgroundColor) !== null && _q !== void 0 ? _q : 'red',
|
|
14766
14713
|
"$textColor": (_t = (_s = (_r = theme.guidanceMessages) === null || _r === void 0 ? void 0 : _r.negative) === null || _s === void 0 ? void 0 : _s.textColor) !== null && _t !== void 0 ? _t : 'white'
|
|
14767
|
-
}, guidanceText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default['default'].createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default['default'].createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Detection Score: ", (_u = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)),
|
|
14714
|
+
}, guidanceText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default['default'].createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default['default'].createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Detection Score: ", (_u = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React__default['default'].createElement(CountdownContainer, {
|
|
14768
14715
|
className: classNames.countdownContainer
|
|
14769
14716
|
}, /*#__PURE__*/React__default['default'].createElement(Countdown, {
|
|
14770
14717
|
className: classNames.countdown
|
|
@@ -14919,64 +14866,60 @@
|
|
|
14919
14866
|
faceLivenessProps = _h === void 0 ? {} : _h,
|
|
14920
14867
|
_j = _a.idCaptureModelsEnabled,
|
|
14921
14868
|
idCaptureModelsEnabled = _j === void 0 ? true : _j,
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
idCardFrontFocusThreshold = _a.idCardFrontFocusThreshold,
|
|
14925
|
-
idCardBackFocusThreshold = _a.idCardBackFocusThreshold,
|
|
14926
|
-
goodIdCardFrontFramesThreshold = _a.goodIdCardFrontFramesThreshold,
|
|
14927
|
-
goodIdCardBackFramesThreshold = _a.goodIdCardBackFramesThreshold,
|
|
14869
|
+
_k = _a.videoIdCaptureThresholds,
|
|
14870
|
+
videoIdCaptureThresholds = _k === void 0 ? defaultVideoIdCaptureThresholds : _k,
|
|
14928
14871
|
readTextPrompt = _a.readTextPrompt,
|
|
14929
14872
|
readTextTimeoutDurationMs = _a.readTextTimeoutDurationMs,
|
|
14930
14873
|
readTextMinReadingMs = _a.readTextMinReadingMs,
|
|
14931
|
-
|
|
14932
|
-
skipIdCapture =
|
|
14933
|
-
|
|
14934
|
-
skipShowIdCardBack =
|
|
14935
|
-
|
|
14936
|
-
skipSuccessScreen =
|
|
14937
|
-
|
|
14938
|
-
idCaptureLoadingOverlayMode =
|
|
14939
|
-
|
|
14940
|
-
idCaptureGuideType =
|
|
14941
|
-
|
|
14942
|
-
idCapturePortraitGuidesOnMobile =
|
|
14943
|
-
|
|
14944
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
14945
|
-
|
|
14946
|
-
idCaptureModelLoadTimeoutMs =
|
|
14947
|
-
|
|
14948
|
-
faceLivenessLoadingOverlayMode =
|
|
14949
|
-
|
|
14950
|
-
disableFaceDetectionWhileAudioCapture =
|
|
14951
|
-
|
|
14952
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
14953
|
-
|
|
14954
|
-
silentFallback =
|
|
14955
|
-
|
|
14956
|
-
mergeAVStreams =
|
|
14957
|
-
|
|
14958
|
-
assets =
|
|
14959
|
-
|
|
14960
|
-
classNames =
|
|
14961
|
-
|
|
14962
|
-
colors =
|
|
14963
|
-
|
|
14964
|
-
verbiage =
|
|
14965
|
-
|
|
14966
|
-
debugMode =
|
|
14967
|
-
var
|
|
14968
|
-
submissionStatus =
|
|
14969
|
-
idCaptureVideoUrl =
|
|
14970
|
-
idCaptureVideoAudioUrl =
|
|
14971
|
-
idCaptureVideoIdFrontImage =
|
|
14972
|
-
idCaptureVideoIdBackImage =
|
|
14973
|
-
setIdCaptureVideoUrl =
|
|
14974
|
-
setIdCaptureVideoIdFrontImage =
|
|
14975
|
-
setIdCaptureVideoIdBackImage =
|
|
14976
|
-
setIdCaptureVideoAudioUrl =
|
|
14977
|
-
var
|
|
14978
|
-
captureState =
|
|
14979
|
-
setCaptureState =
|
|
14874
|
+
_l = _a.skipIdCapture,
|
|
14875
|
+
skipIdCapture = _l === void 0 ? false : _l,
|
|
14876
|
+
_m = _a.skipShowIdCardBack,
|
|
14877
|
+
skipShowIdCardBack = _m === void 0 ? false : _m,
|
|
14878
|
+
_o = _a.skipSuccessScreen,
|
|
14879
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
14880
|
+
_p = _a.idCaptureLoadingOverlayMode,
|
|
14881
|
+
idCaptureLoadingOverlayMode = _p === void 0 ? 'default' : _p,
|
|
14882
|
+
_q = _a.idCaptureGuideType,
|
|
14883
|
+
idCaptureGuideType = _q === void 0 ? 'fit' : _q,
|
|
14884
|
+
_r = _a.idCapturePortraitGuidesOnMobile,
|
|
14885
|
+
idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
|
|
14886
|
+
_s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
14887
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
14888
|
+
_t = _a.idCaptureModelLoadTimeoutMs,
|
|
14889
|
+
idCaptureModelLoadTimeoutMs = _t === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _t,
|
|
14890
|
+
_u = _a.faceLivenessLoadingOverlayMode,
|
|
14891
|
+
faceLivenessLoadingOverlayMode = _u === void 0 ? 'default' : _u,
|
|
14892
|
+
_v = _a.disableFaceDetectionWhileAudioCapture,
|
|
14893
|
+
disableFaceDetectionWhileAudioCapture = _v === void 0 ? true : _v,
|
|
14894
|
+
_w = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
14895
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
|
|
14896
|
+
_x = _a.silentFallback,
|
|
14897
|
+
silentFallback = _x === void 0 ? false : _x,
|
|
14898
|
+
_y = _a.mergeAVStreams,
|
|
14899
|
+
mergeAVStreams = _y === void 0 ? false : _y,
|
|
14900
|
+
_z = _a.assets,
|
|
14901
|
+
assets = _z === void 0 ? {} : _z,
|
|
14902
|
+
_0 = _a.classNames,
|
|
14903
|
+
classNames = _0 === void 0 ? {} : _0,
|
|
14904
|
+
_1 = _a.colors,
|
|
14905
|
+
colors = _1 === void 0 ? {} : _1,
|
|
14906
|
+
_2 = _a.verbiage,
|
|
14907
|
+
verbiage = _2 === void 0 ? {} : _2,
|
|
14908
|
+
_3 = _a.debugMode,
|
|
14909
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
14910
|
+
var _4 = React.useContext(SubmissionContext),
|
|
14911
|
+
submissionStatus = _4.submissionStatus,
|
|
14912
|
+
idCaptureVideoUrl = _4.idCaptureVideoUrl,
|
|
14913
|
+
idCaptureVideoAudioUrl = _4.idCaptureVideoAudioUrl,
|
|
14914
|
+
idCaptureVideoIdFrontImage = _4.idCaptureVideoIdFrontImage,
|
|
14915
|
+
idCaptureVideoIdBackImage = _4.idCaptureVideoIdBackImage,
|
|
14916
|
+
setIdCaptureVideoUrl = _4.setIdCaptureVideoUrl,
|
|
14917
|
+
setIdCaptureVideoIdFrontImage = _4.setIdCaptureVideoIdFrontImage,
|
|
14918
|
+
setIdCaptureVideoIdBackImage = _4.setIdCaptureVideoIdBackImage,
|
|
14919
|
+
setIdCaptureVideoAudioUrl = _4.setIdCaptureVideoAudioUrl;
|
|
14920
|
+
var _5 = React.useState('CAPTURING_ID'),
|
|
14921
|
+
captureState = _5[0],
|
|
14922
|
+
setCaptureState = _5[1];
|
|
14980
14923
|
React.useEffect(function () {
|
|
14981
14924
|
if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
|
|
14982
14925
|
}, [captureState, skipIdCapture]);
|
|
@@ -15007,9 +14950,9 @@
|
|
|
15007
14950
|
var onVideoCaptureFaceNotDetected = React.useCallback(function () {
|
|
15008
14951
|
setCaptureState('CHECKING_LIVENESS');
|
|
15009
14952
|
}, []);
|
|
15010
|
-
var
|
|
15011
|
-
attempt =
|
|
15012
|
-
setAttempt =
|
|
14953
|
+
var _6 = React.useState(0),
|
|
14954
|
+
attempt = _6[0],
|
|
14955
|
+
setAttempt = _6[1];
|
|
15013
14956
|
var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
|
|
15014
14957
|
var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
|
|
15015
14958
|
userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
|
|
@@ -15113,12 +15056,7 @@
|
|
|
15113
15056
|
onFaceNotDetected: onVideoCaptureFaceNotDetected,
|
|
15114
15057
|
onRecordingFailed: onRecordingFailed,
|
|
15115
15058
|
idCaptureModelsEnabled: idCaptureModelsEnabled,
|
|
15116
|
-
|
|
15117
|
-
idCardBackDetectionThreshold: idCardBackDetectionThreshold,
|
|
15118
|
-
idCardFrontFocusThreshold: idCardFrontFocusThreshold,
|
|
15119
|
-
idCardBackFocusThreshold: idCardBackFocusThreshold,
|
|
15120
|
-
goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
|
|
15121
|
-
goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
|
|
15059
|
+
videoIdCaptureThresholds: videoIdCaptureThresholds,
|
|
15122
15060
|
skipShowIdCardBack: skipShowIdCardBack,
|
|
15123
15061
|
disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
|
|
15124
15062
|
disableFaceDetectionWhileAudioCaptureMsDelay: disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
@@ -15579,9 +15517,8 @@
|
|
|
15579
15517
|
* Render a fullscreen ID capture component that instructs the user to photograph both sides of their ID card, or full page of their passport.
|
|
15580
15518
|
*/
|
|
15581
15519
|
var IdValidation = function IdValidation(_a) {
|
|
15582
|
-
var _b,
|
|
15583
|
-
|
|
15584
|
-
lang = _d === void 0 ? 'auto' : _d,
|
|
15520
|
+
var _b = _a.lang,
|
|
15521
|
+
lang = _b === void 0 ? 'auto' : _b,
|
|
15585
15522
|
sessionId = _a.sessionId,
|
|
15586
15523
|
clientRequestID = _a.clientRequestID,
|
|
15587
15524
|
submissionUrl = _a.submissionUrl,
|
|
@@ -15604,35 +15541,25 @@
|
|
|
15604
15541
|
webhooksFireOnReview = _a.webhooksFireOnReview,
|
|
15605
15542
|
sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
|
|
15606
15543
|
precapturedDocuments = _a.precapturedDocuments,
|
|
15607
|
-
|
|
15608
|
-
loadingOverlayMode =
|
|
15609
|
-
|
|
15610
|
-
idCaptureRequirement =
|
|
15611
|
-
|
|
15612
|
-
separateIdCardCaptureSequence =
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
_k = _a.passportAutoCaptureScoreThreshold,
|
|
15618
|
-
passportAutoCaptureScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.passport : _k,
|
|
15619
|
-
_l = _a.mrzDetectionScoreThreshold,
|
|
15620
|
-
mrzDetectionScoreThreshold = _l === void 0 ? defaultDocumentDetectionThresholds.mrz : _l,
|
|
15621
|
-
_m = _a.idCardFocusScoreThreshold,
|
|
15622
|
-
idCardFocusScoreThreshold = _m === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _m,
|
|
15623
|
-
_o = _a.passportFocusScoreThreshold,
|
|
15624
|
-
passportFocusScoreThreshold = _o === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _o,
|
|
15625
|
-
_p = _a.skipSuccessScreen,
|
|
15626
|
-
skipSuccessScreen = _p === void 0 ? false : _p,
|
|
15544
|
+
_c = _a.loadingOverlayMode,
|
|
15545
|
+
loadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
15546
|
+
_d = _a.idCaptureRequirement,
|
|
15547
|
+
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
15548
|
+
_e = _a.separateIdCardCaptureSequence,
|
|
15549
|
+
separateIdCardCaptureSequence = _e === void 0 ? false : _e,
|
|
15550
|
+
_f = _a.idCaptureThresholds,
|
|
15551
|
+
idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
|
|
15552
|
+
_g = _a.skipSuccessScreen,
|
|
15553
|
+
skipSuccessScreen = _g === void 0 ? false : _g,
|
|
15627
15554
|
instructions = _a.instructions,
|
|
15628
|
-
|
|
15629
|
-
guideType =
|
|
15630
|
-
|
|
15631
|
-
portraitGuidesOnMobile =
|
|
15632
|
-
|
|
15633
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
15634
|
-
|
|
15635
|
-
modelLoadTimeoutMs =
|
|
15555
|
+
_h = _a.guideType,
|
|
15556
|
+
guideType = _h === void 0 ? 'fit' : _h,
|
|
15557
|
+
_j = _a.portraitGuidesOnMobile,
|
|
15558
|
+
portraitGuidesOnMobile = _j === void 0 ? false : _j,
|
|
15559
|
+
_k = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
15560
|
+
rotateLoadingOverlayImageWhenPortrait = _k === void 0 ? true : _k,
|
|
15561
|
+
_l = _a.modelLoadTimeoutMs,
|
|
15562
|
+
modelLoadTimeoutMs = _l === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _l,
|
|
15636
15563
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
15637
15564
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
15638
15565
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -15646,28 +15573,28 @@
|
|
|
15646
15573
|
onUserCancel = _a.onUserCancel,
|
|
15647
15574
|
onModelError = _a.onModelError,
|
|
15648
15575
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15649
|
-
|
|
15650
|
-
theme =
|
|
15651
|
-
|
|
15652
|
-
assets =
|
|
15653
|
-
|
|
15654
|
-
classNames =
|
|
15655
|
-
|
|
15656
|
-
colors =
|
|
15657
|
-
|
|
15658
|
-
verbiage =
|
|
15659
|
-
|
|
15660
|
-
captureSignature =
|
|
15661
|
-
|
|
15662
|
-
captureSignatureVideo =
|
|
15663
|
-
|
|
15664
|
-
captureAdditionalDocuments =
|
|
15665
|
-
|
|
15666
|
-
geolocationEnabled =
|
|
15667
|
-
|
|
15668
|
-
geolocationRequired =
|
|
15669
|
-
|
|
15670
|
-
debugMode =
|
|
15576
|
+
_m = _a.theme,
|
|
15577
|
+
theme = _m === void 0 ? 'default' : _m,
|
|
15578
|
+
_o = _a.assets,
|
|
15579
|
+
assets = _o === void 0 ? {} : _o,
|
|
15580
|
+
_p = _a.classNames,
|
|
15581
|
+
classNames = _p === void 0 ? {} : _p,
|
|
15582
|
+
_q = _a.colors,
|
|
15583
|
+
colors = _q === void 0 ? {} : _q,
|
|
15584
|
+
_r = _a.verbiage,
|
|
15585
|
+
verbiage = _r === void 0 ? {} : _r,
|
|
15586
|
+
_s = _a.captureSignature,
|
|
15587
|
+
captureSignature = _s === void 0 ? false : _s,
|
|
15588
|
+
_t = _a.captureSignatureVideo,
|
|
15589
|
+
captureSignatureVideo = _t === void 0 ? false : _t,
|
|
15590
|
+
_u = _a.captureAdditionalDocuments,
|
|
15591
|
+
captureAdditionalDocuments = _u === void 0 ? [] : _u,
|
|
15592
|
+
_v = _a.geolocationEnabled,
|
|
15593
|
+
geolocationEnabled = _v === void 0 ? true : _v,
|
|
15594
|
+
_w = _a.geolocationRequired,
|
|
15595
|
+
geolocationRequired = _w === void 0 ? false : _w,
|
|
15596
|
+
_x = _a.debugMode,
|
|
15597
|
+
debugMode = _x === void 0 ? false : _x;
|
|
15671
15598
|
useLanguage(lang);
|
|
15672
15599
|
useDebugLogging(debugMode);
|
|
15673
15600
|
var idCaptureProps = React.useMemo(function () {
|
|
@@ -15678,13 +15605,7 @@
|
|
|
15678
15605
|
precapturedDocuments: precapturedDocuments,
|
|
15679
15606
|
captureRequirement: idCaptureRequirement,
|
|
15680
15607
|
separateIdCardCaptureSequence: separateIdCardCaptureSequence,
|
|
15681
|
-
|
|
15682
|
-
idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
|
|
15683
|
-
passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
|
|
15684
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
15685
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
15686
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
15687
|
-
barcodeScanningEnabled: false,
|
|
15608
|
+
thresholds: idCaptureThresholds,
|
|
15688
15609
|
skipSuccessScreen: skipSuccessScreen,
|
|
15689
15610
|
loadingOverlayMode: loadingOverlayMode,
|
|
15690
15611
|
instructions: instructions,
|
|
@@ -15698,7 +15619,7 @@
|
|
|
15698
15619
|
verbiage: verbiage,
|
|
15699
15620
|
debugMode: debugMode
|
|
15700
15621
|
};
|
|
15701
|
-
}, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence,
|
|
15622
|
+
}, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, instructions, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, assets, classNames, colors, verbiage, debugMode]);
|
|
15702
15623
|
var additionalDocumentCaptureProps = React.useMemo(function () {
|
|
15703
15624
|
return {
|
|
15704
15625
|
documents: captureAdditionalDocuments,
|
|
@@ -15892,9 +15813,8 @@
|
|
|
15892
15813
|
* Render a fullscreen capture component that performs `IDValidation` and `FaceValidation` sequentially.
|
|
15893
15814
|
* */
|
|
15894
15815
|
var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
15895
|
-
var _b,
|
|
15896
|
-
|
|
15897
|
-
lang = _d === void 0 ? 'auto' : _d,
|
|
15816
|
+
var _b = _a.lang,
|
|
15817
|
+
lang = _b === void 0 ? 'auto' : _b,
|
|
15898
15818
|
sessionId = _a.sessionId,
|
|
15899
15819
|
authUrl = _a.authUrl,
|
|
15900
15820
|
submissionUrl = _a.submissionUrl,
|
|
@@ -15916,39 +15836,29 @@
|
|
|
15916
15836
|
webhooksFireOnReview = _a.webhooksFireOnReview,
|
|
15917
15837
|
sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
|
|
15918
15838
|
precapturedDocuments = _a.precapturedDocuments,
|
|
15919
|
-
|
|
15920
|
-
idCaptureLoadingOverlayMode =
|
|
15921
|
-
|
|
15922
|
-
idCaptureRequirement =
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15930
|
-
|
|
15931
|
-
_l = _a.idCardFocusScoreThreshold,
|
|
15932
|
-
idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
|
|
15933
|
-
_m = _a.passportFocusScoreThreshold,
|
|
15934
|
-
passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
|
|
15935
|
-
_o = _a.faceLivenessLoadingOverlayMode,
|
|
15936
|
-
faceLivenessLoadingOverlayMode = _o === void 0 ? 'default' : _o,
|
|
15937
|
-
_p = _a.faceLivenessTimeoutDurationMs,
|
|
15938
|
-
faceLivenessTimeoutDurationMs = _p === void 0 ? 15000 : _p,
|
|
15939
|
-
_q = _a.skipSuccessScreen,
|
|
15940
|
-
skipSuccessScreen = _q === void 0 ? false : _q,
|
|
15839
|
+
_c = _a.idCaptureLoadingOverlayMode,
|
|
15840
|
+
idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
15841
|
+
_d = _a.idCaptureRequirement,
|
|
15842
|
+
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
15843
|
+
_e = _a.idCaptureThresholds,
|
|
15844
|
+
idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
|
|
15845
|
+
_f = _a.faceLivenessLoadingOverlayMode,
|
|
15846
|
+
faceLivenessLoadingOverlayMode = _f === void 0 ? 'default' : _f,
|
|
15847
|
+
_g = _a.faceLivenessTimeoutDurationMs,
|
|
15848
|
+
faceLivenessTimeoutDurationMs = _g === void 0 ? 15000 : _g,
|
|
15849
|
+
_h = _a.skipSuccessScreen,
|
|
15850
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
15941
15851
|
idCaptureInstructions = _a.idCaptureInstructions,
|
|
15942
|
-
|
|
15943
|
-
idCaptureGuideType =
|
|
15944
|
-
|
|
15945
|
-
idCapturePortraitGuidesOnMobile =
|
|
15946
|
-
|
|
15947
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
15948
|
-
|
|
15949
|
-
idCaptureModelLoadTimeoutMs =
|
|
15950
|
-
|
|
15951
|
-
selfieCaptureModelLoadTimeoutMs =
|
|
15852
|
+
_j = _a.idCaptureGuideType,
|
|
15853
|
+
idCaptureGuideType = _j === void 0 ? 'fit' : _j,
|
|
15854
|
+
_k = _a.idCapturePortraitGuidesOnMobile,
|
|
15855
|
+
idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
|
|
15856
|
+
_l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
15857
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
|
|
15858
|
+
_m = _a.idCaptureModelLoadTimeoutMs,
|
|
15859
|
+
idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
|
|
15860
|
+
_o = _a.selfieCaptureModelLoadTimeoutMs,
|
|
15861
|
+
selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
|
|
15952
15862
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
15953
15863
|
onDocumentUploaded = _a.onDocumentUploaded,
|
|
15954
15864
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -15965,28 +15875,28 @@
|
|
|
15965
15875
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
15966
15876
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
15967
15877
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15968
|
-
|
|
15969
|
-
captureSignature =
|
|
15970
|
-
|
|
15971
|
-
captureSignatureVideo =
|
|
15972
|
-
|
|
15973
|
-
captureAdditionalDocuments =
|
|
15974
|
-
|
|
15975
|
-
theme =
|
|
15976
|
-
|
|
15977
|
-
assets =
|
|
15978
|
-
|
|
15979
|
-
classNames =
|
|
15980
|
-
|
|
15981
|
-
colors =
|
|
15982
|
-
|
|
15983
|
-
verbiage =
|
|
15984
|
-
|
|
15985
|
-
geolocationEnabled =
|
|
15986
|
-
|
|
15987
|
-
geolocationRequired =
|
|
15988
|
-
|
|
15989
|
-
debugMode =
|
|
15878
|
+
_p = _a.captureSignature,
|
|
15879
|
+
captureSignature = _p === void 0 ? false : _p,
|
|
15880
|
+
_q = _a.captureSignatureVideo,
|
|
15881
|
+
captureSignatureVideo = _q === void 0 ? false : _q,
|
|
15882
|
+
_r = _a.captureAdditionalDocuments,
|
|
15883
|
+
captureAdditionalDocuments = _r === void 0 ? [] : _r,
|
|
15884
|
+
_s = _a.theme,
|
|
15885
|
+
theme = _s === void 0 ? 'default' : _s,
|
|
15886
|
+
_t = _a.assets,
|
|
15887
|
+
assets = _t === void 0 ? {} : _t,
|
|
15888
|
+
_u = _a.classNames,
|
|
15889
|
+
classNames = _u === void 0 ? {} : _u,
|
|
15890
|
+
_v = _a.colors,
|
|
15891
|
+
colors = _v === void 0 ? {} : _v,
|
|
15892
|
+
_w = _a.verbiage,
|
|
15893
|
+
verbiage = _w === void 0 ? {} : _w,
|
|
15894
|
+
_x = _a.geolocationEnabled,
|
|
15895
|
+
geolocationEnabled = _x === void 0 ? true : _x,
|
|
15896
|
+
_y = _a.geolocationRequired,
|
|
15897
|
+
geolocationRequired = _y === void 0 ? false : _y,
|
|
15898
|
+
_z = _a.debugMode,
|
|
15899
|
+
debugMode = _z === void 0 ? false : _z;
|
|
15990
15900
|
useLanguage(lang);
|
|
15991
15901
|
useDebugLogging(debugMode);
|
|
15992
15902
|
var idCaptureProps = React.useMemo(function () {
|
|
@@ -16000,12 +15910,7 @@
|
|
|
16000
15910
|
verbiage: verbiage.idCapture,
|
|
16001
15911
|
precapturedDocuments: precapturedDocuments,
|
|
16002
15912
|
captureRequirement: idCaptureRequirement,
|
|
16003
|
-
|
|
16004
|
-
idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
|
|
16005
|
-
passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
|
|
16006
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
16007
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
16008
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
15913
|
+
thresholds: idCaptureThresholds,
|
|
16009
15914
|
loadingOverlayMode: idCaptureLoadingOverlayMode,
|
|
16010
15915
|
instructions: idCaptureInstructions,
|
|
16011
15916
|
guideType: idCaptureGuideType,
|
|
@@ -16015,7 +15920,7 @@
|
|
|
16015
15920
|
skipSuccessScreen: skipSuccessScreen,
|
|
16016
15921
|
debugMode: debugMode
|
|
16017
15922
|
};
|
|
16018
|
-
}, [assets.idCapture, classNames.idCapture, colors.idCapture,
|
|
15923
|
+
}, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, skipSuccessScreen, debugMode]);
|
|
16019
15924
|
var faceLivenessProps = React.useMemo(function () {
|
|
16020
15925
|
return {
|
|
16021
15926
|
loadingOverlayMode: faceLivenessLoadingOverlayMode,
|
|
@@ -16123,10 +16028,9 @@
|
|
|
16123
16028
|
* Render a fullscreen capture component that performs IDValidation and FaceValidation sequentially, and then stores the results in IDmission's customer database using the supplied `enrollmentId` for later verification or 1:N matching.
|
|
16124
16029
|
*/
|
|
16125
16030
|
var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollment(_a) {
|
|
16126
|
-
var _b, _c;
|
|
16127
16031
|
var enrollmentId = _a.enrollmentId,
|
|
16128
|
-
|
|
16129
|
-
lang =
|
|
16032
|
+
_b = _a.lang,
|
|
16033
|
+
lang = _b === void 0 ? 'auto' : _b,
|
|
16130
16034
|
sessionId = _a.sessionId,
|
|
16131
16035
|
authUrl = _a.authUrl,
|
|
16132
16036
|
submissionUrl = _a.submissionUrl,
|
|
@@ -16150,39 +16054,29 @@
|
|
|
16150
16054
|
webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
|
|
16151
16055
|
webhooksFireOnReview = _a.webhooksFireOnReview,
|
|
16152
16056
|
sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
|
|
16153
|
-
|
|
16154
|
-
idCaptureLoadingOverlayMode =
|
|
16155
|
-
|
|
16156
|
-
idCaptureRequirement =
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
_l = _a.idCardFocusScoreThreshold,
|
|
16166
|
-
idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
|
|
16167
|
-
_m = _a.passportFocusScoreThreshold,
|
|
16168
|
-
passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
|
|
16169
|
-
_o = _a.faceLivenessTimeoutDurationMs,
|
|
16170
|
-
faceLivenessTimeoutDurationMs = _o === void 0 ? 15000 : _o,
|
|
16171
|
-
_p = _a.faceLivenessLoadingOverlayMode,
|
|
16172
|
-
faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
|
|
16173
|
-
_q = _a.skipSuccessScreen,
|
|
16174
|
-
skipSuccessScreen = _q === void 0 ? false : _q,
|
|
16057
|
+
_c = _a.idCaptureLoadingOverlayMode,
|
|
16058
|
+
idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
16059
|
+
_d = _a.idCaptureRequirement,
|
|
16060
|
+
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
16061
|
+
_e = _a.idCaptureThresholds,
|
|
16062
|
+
idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
|
|
16063
|
+
_f = _a.faceLivenessTimeoutDurationMs,
|
|
16064
|
+
faceLivenessTimeoutDurationMs = _f === void 0 ? 15000 : _f,
|
|
16065
|
+
_g = _a.faceLivenessLoadingOverlayMode,
|
|
16066
|
+
faceLivenessLoadingOverlayMode = _g === void 0 ? 'default' : _g,
|
|
16067
|
+
_h = _a.skipSuccessScreen,
|
|
16068
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
16175
16069
|
idCaptureInstructions = _a.idCaptureInstructions,
|
|
16176
|
-
|
|
16177
|
-
idCaptureGuideType =
|
|
16178
|
-
|
|
16179
|
-
idCapturePortraitGuidesOnMobile =
|
|
16180
|
-
|
|
16181
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
16182
|
-
|
|
16183
|
-
idCaptureModelLoadTimeoutMs =
|
|
16184
|
-
|
|
16185
|
-
selfieCaptureModelLoadTimeoutMs =
|
|
16070
|
+
_j = _a.idCaptureGuideType,
|
|
16071
|
+
idCaptureGuideType = _j === void 0 ? 'fit' : _j,
|
|
16072
|
+
_k = _a.idCapturePortraitGuidesOnMobile,
|
|
16073
|
+
idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
|
|
16074
|
+
_l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
16075
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
|
|
16076
|
+
_m = _a.idCaptureModelLoadTimeoutMs,
|
|
16077
|
+
idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
|
|
16078
|
+
_o = _a.selfieCaptureModelLoadTimeoutMs,
|
|
16079
|
+
selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
|
|
16186
16080
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
16187
16081
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
16188
16082
|
onDocumentUploaded = _a.onDocumentUploaded,
|
|
@@ -16198,28 +16092,28 @@
|
|
|
16198
16092
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
16199
16093
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
16200
16094
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
16201
|
-
|
|
16202
|
-
captureSignature =
|
|
16203
|
-
|
|
16204
|
-
captureSignatureVideo =
|
|
16205
|
-
|
|
16206
|
-
captureAdditionalDocuments =
|
|
16207
|
-
|
|
16208
|
-
theme =
|
|
16209
|
-
|
|
16210
|
-
assets =
|
|
16211
|
-
|
|
16212
|
-
classNames =
|
|
16213
|
-
|
|
16214
|
-
colors =
|
|
16215
|
-
|
|
16216
|
-
verbiage =
|
|
16217
|
-
|
|
16218
|
-
geolocationEnabled =
|
|
16219
|
-
|
|
16220
|
-
geolocationRequired =
|
|
16221
|
-
|
|
16222
|
-
debugMode =
|
|
16095
|
+
_p = _a.captureSignature,
|
|
16096
|
+
captureSignature = _p === void 0 ? false : _p,
|
|
16097
|
+
_q = _a.captureSignatureVideo,
|
|
16098
|
+
captureSignatureVideo = _q === void 0 ? false : _q,
|
|
16099
|
+
_r = _a.captureAdditionalDocuments,
|
|
16100
|
+
captureAdditionalDocuments = _r === void 0 ? [] : _r,
|
|
16101
|
+
_s = _a.theme,
|
|
16102
|
+
theme = _s === void 0 ? 'default' : _s,
|
|
16103
|
+
_t = _a.assets,
|
|
16104
|
+
assets = _t === void 0 ? {} : _t,
|
|
16105
|
+
_u = _a.classNames,
|
|
16106
|
+
classNames = _u === void 0 ? {} : _u,
|
|
16107
|
+
_v = _a.colors,
|
|
16108
|
+
colors = _v === void 0 ? {} : _v,
|
|
16109
|
+
_w = _a.verbiage,
|
|
16110
|
+
verbiage = _w === void 0 ? {} : _w,
|
|
16111
|
+
_x = _a.geolocationEnabled,
|
|
16112
|
+
geolocationEnabled = _x === void 0 ? true : _x,
|
|
16113
|
+
_y = _a.geolocationRequired,
|
|
16114
|
+
geolocationRequired = _y === void 0 ? false : _y,
|
|
16115
|
+
_z = _a.debugMode,
|
|
16116
|
+
debugMode = _z === void 0 ? false : _z;
|
|
16223
16117
|
useLanguage(lang);
|
|
16224
16118
|
useDebugLogging(debugMode);
|
|
16225
16119
|
var idCaptureProps = React.useMemo(function () {
|
|
@@ -16229,12 +16123,7 @@
|
|
|
16229
16123
|
colors: colors.idCapture,
|
|
16230
16124
|
verbiage: verbiage.idCapture,
|
|
16231
16125
|
captureRequirement: idCaptureRequirement,
|
|
16232
|
-
|
|
16233
|
-
idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
|
|
16234
|
-
passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
|
|
16235
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
16236
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
16237
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
16126
|
+
thresholds: idCaptureThresholds,
|
|
16238
16127
|
loadingOverlayMode: idCaptureLoadingOverlayMode,
|
|
16239
16128
|
instructions: idCaptureInstructions,
|
|
16240
16129
|
guideType: idCaptureGuideType,
|
|
@@ -16247,7 +16136,7 @@
|
|
|
16247
16136
|
skipSuccessScreen: skipSuccessScreen,
|
|
16248
16137
|
debugMode: debugMode
|
|
16249
16138
|
};
|
|
16250
|
-
}, [assets.idCapture, classNames.idCapture, colors.idCapture,
|
|
16139
|
+
}, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
|
|
16251
16140
|
var faceLivenessProps = React.useMemo(function () {
|
|
16252
16141
|
return {
|
|
16253
16142
|
onExitCapture: onExitCapture,
|
|
@@ -17585,70 +17474,60 @@
|
|
|
17585
17474
|
faceLivenessProps = _a.faceLivenessProps,
|
|
17586
17475
|
_c = _a.idCaptureModelsEnabled,
|
|
17587
17476
|
idCaptureModelsEnabled = _c === void 0 ? true : _c,
|
|
17588
|
-
_d = _a.
|
|
17589
|
-
|
|
17590
|
-
_e = _a.idCardFrontFocusThreshold,
|
|
17591
|
-
idCardFrontFocusThreshold = _e === void 0 ? 0 : _e,
|
|
17592
|
-
_f = _a.goodIdCardFrontFramesThreshold,
|
|
17593
|
-
goodIdCardFrontFramesThreshold = _f === void 0 ? 1 : _f,
|
|
17594
|
-
_g = _a.idCardBackDetectionThreshold,
|
|
17595
|
-
idCardBackDetectionThreshold = _g === void 0 ? 0.6 : _g,
|
|
17596
|
-
_h = _a.idCardBackFocusThreshold,
|
|
17597
|
-
idCardBackFocusThreshold = _h === void 0 ? 0 : _h,
|
|
17598
|
-
_j = _a.goodIdCardBackFramesThreshold,
|
|
17599
|
-
goodIdCardBackFramesThreshold = _j === void 0 ? 1 : _j,
|
|
17477
|
+
_d = _a.videoIdCaptureThresholds,
|
|
17478
|
+
videoIdCaptureThresholds = _d === void 0 ? defaultVideoIdCaptureThresholds : _d,
|
|
17600
17479
|
readTextPrompt = _a.readTextPrompt,
|
|
17601
|
-
|
|
17602
|
-
readTextTimeoutDurationMs =
|
|
17603
|
-
|
|
17604
|
-
readTextMinReadingMs =
|
|
17605
|
-
|
|
17606
|
-
skipSuccessScreen =
|
|
17607
|
-
|
|
17608
|
-
skipIdCapture =
|
|
17609
|
-
|
|
17610
|
-
skipShowIdCardBack =
|
|
17611
|
-
|
|
17612
|
-
idCaptureLoadingOverlayMode =
|
|
17613
|
-
|
|
17614
|
-
idCaptureGuideType =
|
|
17615
|
-
|
|
17616
|
-
idCapturePortraitGuidesOnMobile =
|
|
17617
|
-
|
|
17618
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
17480
|
+
_e = _a.readTextTimeoutDurationMs,
|
|
17481
|
+
readTextTimeoutDurationMs = _e === void 0 ? 15000 : _e,
|
|
17482
|
+
_f = _a.readTextMinReadingMs,
|
|
17483
|
+
readTextMinReadingMs = _f === void 0 ? 10000 : _f,
|
|
17484
|
+
_g = _a.skipSuccessScreen,
|
|
17485
|
+
skipSuccessScreen = _g === void 0 ? false : _g,
|
|
17486
|
+
_h = _a.skipIdCapture,
|
|
17487
|
+
skipIdCapture = _h === void 0 ? false : _h,
|
|
17488
|
+
_j = _a.skipShowIdCardBack,
|
|
17489
|
+
skipShowIdCardBack = _j === void 0 ? false : _j,
|
|
17490
|
+
_k = _a.idCaptureLoadingOverlayMode,
|
|
17491
|
+
idCaptureLoadingOverlayMode = _k === void 0 ? 'default' : _k,
|
|
17492
|
+
_l = _a.idCaptureGuideType,
|
|
17493
|
+
idCaptureGuideType = _l === void 0 ? 'fit' : _l,
|
|
17494
|
+
_m = _a.idCapturePortraitGuidesOnMobile,
|
|
17495
|
+
idCapturePortraitGuidesOnMobile = _m === void 0 ? false : _m,
|
|
17496
|
+
_o = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
17497
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _o === void 0 ? true : _o,
|
|
17619
17498
|
idCardForFaceMatch = _a.idCardForFaceMatch,
|
|
17620
|
-
|
|
17621
|
-
faceLivenessLoadingOverlayMode =
|
|
17622
|
-
|
|
17623
|
-
disableFaceDetectionWhileAudioCapture =
|
|
17624
|
-
|
|
17625
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
17626
|
-
|
|
17627
|
-
silentFallback =
|
|
17628
|
-
|
|
17629
|
-
mergeAVStreams =
|
|
17630
|
-
|
|
17631
|
-
theme =
|
|
17632
|
-
|
|
17633
|
-
assets =
|
|
17634
|
-
|
|
17635
|
-
classNames =
|
|
17636
|
-
|
|
17637
|
-
colors =
|
|
17638
|
-
|
|
17639
|
-
verbiage =
|
|
17640
|
-
|
|
17641
|
-
captureSignature =
|
|
17642
|
-
|
|
17643
|
-
captureSignatureVideo =
|
|
17644
|
-
|
|
17645
|
-
captureAdditionalDocuments =
|
|
17646
|
-
|
|
17647
|
-
geolocationEnabled =
|
|
17648
|
-
|
|
17649
|
-
geolocationRequired =
|
|
17650
|
-
|
|
17651
|
-
debugMode =
|
|
17499
|
+
_p = _a.faceLivenessLoadingOverlayMode,
|
|
17500
|
+
faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
|
|
17501
|
+
_q = _a.disableFaceDetectionWhileAudioCapture,
|
|
17502
|
+
disableFaceDetectionWhileAudioCapture = _q === void 0 ? false : _q,
|
|
17503
|
+
_r = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
17504
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _r === void 0 ? 2000 : _r,
|
|
17505
|
+
_s = _a.silentFallback,
|
|
17506
|
+
silentFallback = _s === void 0 ? false : _s,
|
|
17507
|
+
_t = _a.mergeAVStreams,
|
|
17508
|
+
mergeAVStreams = _t === void 0 ? false : _t,
|
|
17509
|
+
_u = _a.theme,
|
|
17510
|
+
theme = _u === void 0 ? 'default' : _u,
|
|
17511
|
+
_v = _a.assets,
|
|
17512
|
+
assets = _v === void 0 ? {} : _v,
|
|
17513
|
+
_w = _a.classNames,
|
|
17514
|
+
classNames = _w === void 0 ? {} : _w,
|
|
17515
|
+
_x = _a.colors,
|
|
17516
|
+
colors = _x === void 0 ? {} : _x,
|
|
17517
|
+
_y = _a.verbiage,
|
|
17518
|
+
verbiage = _y === void 0 ? {} : _y,
|
|
17519
|
+
_z = _a.captureSignature,
|
|
17520
|
+
captureSignature = _z === void 0 ? false : _z,
|
|
17521
|
+
_0 = _a.captureSignatureVideo,
|
|
17522
|
+
captureSignatureVideo = _0 === void 0 ? false : _0,
|
|
17523
|
+
_1 = _a.captureAdditionalDocuments,
|
|
17524
|
+
captureAdditionalDocuments = _1 === void 0 ? [] : _1,
|
|
17525
|
+
_2 = _a.geolocationEnabled,
|
|
17526
|
+
geolocationEnabled = _2 === void 0 ? true : _2,
|
|
17527
|
+
_3 = _a.geolocationRequired,
|
|
17528
|
+
geolocationRequired = _3 === void 0 ? false : _3,
|
|
17529
|
+
_4 = _a.debugMode,
|
|
17530
|
+
debugMode = _4 === void 0 ? false : _4;
|
|
17652
17531
|
useLanguage(lang);
|
|
17653
17532
|
useDebugLogging(debugMode);
|
|
17654
17533
|
var videoIdCaptureProps = React.useMemo(function () {
|
|
@@ -17656,12 +17535,7 @@
|
|
|
17656
17535
|
idCaptureProps: idCaptureProps,
|
|
17657
17536
|
faceLivenessProps: faceLivenessProps,
|
|
17658
17537
|
idCaptureModelsEnabled: idCaptureModelsEnabled,
|
|
17659
|
-
|
|
17660
|
-
idCardFrontFocusThreshold: idCardFrontFocusThreshold,
|
|
17661
|
-
goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
|
|
17662
|
-
idCardBackDetectionThreshold: idCardBackDetectionThreshold,
|
|
17663
|
-
idCardBackFocusThreshold: idCardBackFocusThreshold,
|
|
17664
|
-
goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
|
|
17538
|
+
videoIdCaptureThresholds: videoIdCaptureThresholds,
|
|
17665
17539
|
readTextPrompt: readTextPrompt,
|
|
17666
17540
|
readTextTimeoutDurationMs: readTextTimeoutDurationMs,
|
|
17667
17541
|
readTextMinReadingMs: readTextMinReadingMs,
|
|
@@ -17686,7 +17560,7 @@
|
|
|
17686
17560
|
verbiage: verbiage,
|
|
17687
17561
|
debugMode: debugMode
|
|
17688
17562
|
};
|
|
17689
|
-
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled,
|
|
17563
|
+
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
|
|
17690
17564
|
var additionalDocumentCaptureProps = React.useMemo(function () {
|
|
17691
17565
|
return {
|
|
17692
17566
|
documents: captureAdditionalDocuments,
|