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
package/dist/sdk2.esm.js
CHANGED
|
@@ -14,7 +14,7 @@ import LanguageDetector from 'i18next-browser-languagedetector';
|
|
|
14
14
|
import i18n from 'i18next';
|
|
15
15
|
import SignatureCanvas from 'react-signature-canvas';
|
|
16
16
|
|
|
17
|
-
var webSdkVersion = '2.0
|
|
17
|
+
var webSdkVersion = '2.1.0';
|
|
18
18
|
|
|
19
19
|
function getPlatform() {
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1599,10 +1599,6 @@ function convertBase64ToBlob(base64Image) {
|
|
|
1599
1599
|
});
|
|
1600
1600
|
}
|
|
1601
1601
|
|
|
1602
|
-
function supportsNativeBarcodeScanning() {
|
|
1603
|
-
return 'BarcodeDetector' in window;
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
1602
|
function getFrameDimensions(frame) {
|
|
1607
1603
|
var frameWidth = frame.width,
|
|
1608
1604
|
frameHeight = frame.height;
|
|
@@ -2446,10 +2442,42 @@ function giveUpAfter(maxTime) {
|
|
|
2446
2442
|
});
|
|
2447
2443
|
}
|
|
2448
2444
|
|
|
2449
|
-
|
|
2445
|
+
function convertBoundingBox(box) {
|
|
2446
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2447
|
+
return {
|
|
2448
|
+
xMin: (_a = box === null || box === void 0 ? void 0 : box.originX) !== null && _a !== void 0 ? _a : 0,
|
|
2449
|
+
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),
|
|
2450
|
+
yMin: (_d = box === null || box === void 0 ? void 0 : box.originY) !== null && _d !== void 0 ? _d : 0,
|
|
2451
|
+
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),
|
|
2452
|
+
width: (_g = box === null || box === void 0 ? void 0 : box.width) !== null && _g !== void 0 ? _g : 0,
|
|
2453
|
+
height: (_h = box === null || box === void 0 ? void 0 : box.height) !== null && _h !== void 0 ? _h : 0
|
|
2454
|
+
};
|
|
2455
|
+
}
|
|
2456
|
+
function waitForVideoReady(videoRef, checkEveryMs) {
|
|
2457
|
+
if (checkEveryMs === void 0) {
|
|
2458
|
+
checkEveryMs = 100;
|
|
2459
|
+
}
|
|
2460
|
+
return new Promise(function (resolve) {
|
|
2461
|
+
var _a;
|
|
2462
|
+
if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) return resolve();
|
|
2463
|
+
var interval = setInterval(function () {
|
|
2464
|
+
var _a;
|
|
2465
|
+
if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) {
|
|
2466
|
+
clearInterval(interval);
|
|
2467
|
+
resolve();
|
|
2468
|
+
}
|
|
2469
|
+
}, checkEveryMs);
|
|
2470
|
+
});
|
|
2471
|
+
}
|
|
2472
|
+
|
|
2473
|
+
var defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240619/model_fp16.tflite";
|
|
2450
2474
|
var defaultFocusModelLoadTimeoutMs = 45000;
|
|
2451
2475
|
var defaultFocusThresholds = {
|
|
2452
|
-
|
|
2476
|
+
idCardFront: {
|
|
2477
|
+
desktop: 0,
|
|
2478
|
+
mobile: 0.3
|
|
2479
|
+
},
|
|
2480
|
+
idCardBack: {
|
|
2453
2481
|
desktop: 0,
|
|
2454
2482
|
mobile: 0.3
|
|
2455
2483
|
},
|
|
@@ -2484,16 +2512,9 @@ function loadFocusModel(modelAssetPath) {
|
|
|
2484
2512
|
delegate: modelCapabilities.delegate
|
|
2485
2513
|
},
|
|
2486
2514
|
runningMode: 'VIDEO'
|
|
2487
|
-
}])
|
|
2488
|
-
// const emptyFrame = document.createElement('canvas')
|
|
2489
|
-
// models[id].classifyForVideo(emptyFrame, performance.now())
|
|
2490
|
-
// emptyFrame.remove()
|
|
2491
|
-
];
|
|
2515
|
+
}])];
|
|
2492
2516
|
case 3:
|
|
2493
2517
|
_a[_b] = _e.sent();
|
|
2494
|
-
// const emptyFrame = document.createElement('canvas')
|
|
2495
|
-
// models[id].classifyForVideo(emptyFrame, performance.now())
|
|
2496
|
-
// emptyFrame.remove()
|
|
2497
2518
|
return [2 /*return*/, models[id]];
|
|
2498
2519
|
}
|
|
2499
2520
|
});
|
|
@@ -2515,7 +2536,9 @@ function useLoadFocusModel(_a) {
|
|
|
2515
2536
|
var _f = useState(null),
|
|
2516
2537
|
modelError = _f[0],
|
|
2517
2538
|
setModelError = _f[1];
|
|
2539
|
+
var videoRef = useContext(CameraStateContext).videoRef;
|
|
2518
2540
|
useEffect(function loadModel() {
|
|
2541
|
+
var _this = this;
|
|
2519
2542
|
setReady(false);
|
|
2520
2543
|
function handleDownloadProgress(event) {
|
|
2521
2544
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -2525,9 +2548,22 @@ function useLoadFocusModel(_a) {
|
|
|
2525
2548
|
setModelError(new Error('Model loading time limit exceeded.'));
|
|
2526
2549
|
}, modelLoadTimeoutMs);
|
|
2527
2550
|
loadFocusModel(modelPath).then(function (loadedModel) {
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2551
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2552
|
+
return __generator(this, function (_a) {
|
|
2553
|
+
switch (_a.label) {
|
|
2554
|
+
case 0:
|
|
2555
|
+
model.current = loadedModel;
|
|
2556
|
+
setModelDownloadProgress(100);
|
|
2557
|
+
clearTimeout(modelLoadTimeout);
|
|
2558
|
+
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
2559
|
+
case 1:
|
|
2560
|
+
_a.sent();
|
|
2561
|
+
loadedModel.classifyForVideo(videoRef.current, performance.now());
|
|
2562
|
+
setReady(true);
|
|
2563
|
+
return [2 /*return*/];
|
|
2564
|
+
}
|
|
2565
|
+
});
|
|
2566
|
+
});
|
|
2531
2567
|
})["catch"](function (e) {
|
|
2532
2568
|
setModelError(e);
|
|
2533
2569
|
})["finally"](function () {
|
|
@@ -2537,7 +2573,7 @@ function useLoadFocusModel(_a) {
|
|
|
2537
2573
|
clearTimeout(modelLoadTimeout);
|
|
2538
2574
|
document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
|
|
2539
2575
|
};
|
|
2540
|
-
}, [modelPath, modelLoadTimeoutMs]);
|
|
2576
|
+
}, [modelPath, modelLoadTimeoutMs, videoRef]);
|
|
2541
2577
|
useEffect(function handleModelError() {
|
|
2542
2578
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
2543
2579
|
}, [modelError, onModelError]);
|
|
@@ -2717,18 +2753,6 @@ K("FACEDETECTION_TESSELATION",[[127,34],[34,139],[139,127],[11,0],[0,37],[37,11]
|
|
|
2717
2753
|
[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,
|
|
2718
2754
|
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);
|
|
2719
2755
|
|
|
2720
|
-
function convertBoundingBox(box) {
|
|
2721
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2722
|
-
return {
|
|
2723
|
-
xMin: (_a = box === null || box === void 0 ? void 0 : box.originX) !== null && _a !== void 0 ? _a : 0,
|
|
2724
|
-
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),
|
|
2725
|
-
yMin: (_d = box === null || box === void 0 ? void 0 : box.originY) !== null && _d !== void 0 ? _d : 0,
|
|
2726
|
-
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),
|
|
2727
|
-
width: (_g = box === null || box === void 0 ? void 0 : box.width) !== null && _g !== void 0 ? _g : 0,
|
|
2728
|
-
height: (_h = box === null || box === void 0 ? void 0 : box.height) !== null && _h !== void 0 ? _h : 0
|
|
2729
|
-
};
|
|
2730
|
-
}
|
|
2731
|
-
|
|
2732
2756
|
var defaultFaceDetectorModelPath = 'https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite';
|
|
2733
2757
|
var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
2734
2758
|
var detector;
|
|
@@ -2754,16 +2778,9 @@ function loadFaceDetector() {
|
|
|
2754
2778
|
delegate: modelCapabilities.delegate
|
|
2755
2779
|
},
|
|
2756
2780
|
runningMode: 'VIDEO'
|
|
2757
|
-
}])
|
|
2758
|
-
// const emptyFrame = document.createElement('canvas')
|
|
2759
|
-
// detector.detectForVideo(emptyFrame, performance.now())
|
|
2760
|
-
// emptyFrame.remove()
|
|
2761
|
-
];
|
|
2781
|
+
}])];
|
|
2762
2782
|
case 3:
|
|
2763
2783
|
detector = _c.sent();
|
|
2764
|
-
// const emptyFrame = document.createElement('canvas')
|
|
2765
|
-
// detector.detectForVideo(emptyFrame, performance.now())
|
|
2766
|
-
// emptyFrame.remove()
|
|
2767
2784
|
return [2 /*return*/, detector];
|
|
2768
2785
|
}
|
|
2769
2786
|
});
|
|
@@ -2783,7 +2800,9 @@ function useLoadFaceDetector(_a) {
|
|
|
2783
2800
|
var _e = useState(null),
|
|
2784
2801
|
modelError = _e[0],
|
|
2785
2802
|
setModelError = _e[1];
|
|
2803
|
+
var videoRef = useContext(CameraStateContext).videoRef;
|
|
2786
2804
|
useEffect(function loadModel() {
|
|
2805
|
+
var _this = this;
|
|
2787
2806
|
setReady(false);
|
|
2788
2807
|
var modelLoadTimeout = setTimeout(function () {
|
|
2789
2808
|
setModelError(new Error('Model loading time limit exceeded.'));
|
|
@@ -2793,9 +2812,22 @@ function useLoadFaceDetector(_a) {
|
|
|
2793
2812
|
}
|
|
2794
2813
|
document.addEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
2795
2814
|
loadFaceDetector().then(function (model) {
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2815
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
2816
|
+
return __generator(this, function (_a) {
|
|
2817
|
+
switch (_a.label) {
|
|
2818
|
+
case 0:
|
|
2819
|
+
detector.current = model;
|
|
2820
|
+
setModelDownloadProgress(100);
|
|
2821
|
+
clearTimeout(modelLoadTimeout);
|
|
2822
|
+
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
2823
|
+
case 1:
|
|
2824
|
+
_a.sent();
|
|
2825
|
+
model.detectForVideo(videoRef.current, performance.now());
|
|
2826
|
+
setReady(true);
|
|
2827
|
+
return [2 /*return*/];
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
});
|
|
2799
2831
|
})["catch"](function (e) {
|
|
2800
2832
|
setModelError(e);
|
|
2801
2833
|
})["finally"](function () {
|
|
@@ -2805,7 +2837,7 @@ function useLoadFaceDetector(_a) {
|
|
|
2805
2837
|
clearTimeout(modelLoadTimeout);
|
|
2806
2838
|
document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
|
|
2807
2839
|
};
|
|
2808
|
-
}, [modelLoadTimeoutMs]);
|
|
2840
|
+
}, [modelLoadTimeoutMs, videoRef]);
|
|
2809
2841
|
useEffect(function handleModelError() {
|
|
2810
2842
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
2811
2843
|
}, [modelError, onModelError]);
|
|
@@ -3068,14 +3100,19 @@ function sumUpProgressForDependencies(dependencies) {
|
|
|
3068
3100
|
});
|
|
3069
3101
|
}
|
|
3070
3102
|
|
|
3071
|
-
var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/
|
|
3103
|
+
var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240614/model_fp16.tflite";
|
|
3072
3104
|
var defaultDocumentDetectionScoreThreshold = 0.1;
|
|
3073
3105
|
var defaultDocumentDetectionModelLoadTimeoutMs = 45000;
|
|
3074
3106
|
var defaultDocumentDetectionThresholds = {
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3107
|
+
idCardFront: 0.8,
|
|
3108
|
+
idCardBack: 0.8,
|
|
3109
|
+
passport: 0.5
|
|
3110
|
+
};
|
|
3111
|
+
var documentTypeDisplayNames = {
|
|
3112
|
+
idCardFront: 'ID card front',
|
|
3113
|
+
idCardBack: 'ID card back',
|
|
3114
|
+
passport: 'Passport',
|
|
3115
|
+
none: 'None'
|
|
3079
3116
|
};
|
|
3080
3117
|
var detectors = {};
|
|
3081
3118
|
function loadDocumentDetector(modelAssetPath, scoreThreshold) {
|
|
@@ -3110,16 +3147,9 @@ function loadDocumentDetector(modelAssetPath, scoreThreshold) {
|
|
|
3110
3147
|
},
|
|
3111
3148
|
scoreThreshold: scoreThreshold,
|
|
3112
3149
|
runningMode: 'VIDEO'
|
|
3113
|
-
}])
|
|
3114
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3115
|
-
// detectors[id].detectForVideo(emptyFrame, performance.now())
|
|
3116
|
-
// emptyFrame.remove()
|
|
3117
|
-
];
|
|
3150
|
+
}])];
|
|
3118
3151
|
case 3:
|
|
3119
3152
|
_a[_b] = _e.sent();
|
|
3120
|
-
// const emptyFrame = document.createElement('canvas')
|
|
3121
|
-
// detectors[id].detectForVideo(emptyFrame, performance.now())
|
|
3122
|
-
// emptyFrame.remove()
|
|
3123
3153
|
return [2 /*return*/, detectors[id]];
|
|
3124
3154
|
}
|
|
3125
3155
|
});
|
|
@@ -3143,7 +3173,9 @@ function useLoadDocumentDetector(_a) {
|
|
|
3143
3173
|
var _g = useState(null),
|
|
3144
3174
|
modelError = _g[0],
|
|
3145
3175
|
setModelError = _g[1];
|
|
3176
|
+
var videoRef = useContext(CameraStateContext).videoRef;
|
|
3146
3177
|
useEffect(function loadModel() {
|
|
3178
|
+
var _this = this;
|
|
3147
3179
|
setReady(false);
|
|
3148
3180
|
function handleDownloadProgress(event) {
|
|
3149
3181
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -3153,9 +3185,22 @@ function useLoadDocumentDetector(_a) {
|
|
|
3153
3185
|
setModelError(new Error('Model loading time limit exceeded.'));
|
|
3154
3186
|
}, modelLoadTimeoutMs);
|
|
3155
3187
|
loadDocumentDetector(modelPath, scoreThreshold).then(function (model) {
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3188
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
3189
|
+
return __generator(this, function (_a) {
|
|
3190
|
+
switch (_a.label) {
|
|
3191
|
+
case 0:
|
|
3192
|
+
detector.current = model;
|
|
3193
|
+
setModelDownloadProgress(100);
|
|
3194
|
+
clearTimeout(modelLoadTimeout);
|
|
3195
|
+
return [4 /*yield*/, waitForVideoReady(videoRef)];
|
|
3196
|
+
case 1:
|
|
3197
|
+
_a.sent();
|
|
3198
|
+
model.detectForVideo(videoRef.current, performance.now());
|
|
3199
|
+
setReady(true);
|
|
3200
|
+
return [2 /*return*/];
|
|
3201
|
+
}
|
|
3202
|
+
});
|
|
3203
|
+
});
|
|
3159
3204
|
})["catch"](function (e) {
|
|
3160
3205
|
setModelError(e);
|
|
3161
3206
|
})["finally"](function () {
|
|
@@ -3165,7 +3210,7 @@ function useLoadDocumentDetector(_a) {
|
|
|
3165
3210
|
clearTimeout(modelLoadTimeout);
|
|
3166
3211
|
document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
|
|
3167
3212
|
};
|
|
3168
|
-
}, [modelLoadTimeoutMs, modelPath, scoreThreshold]);
|
|
3213
|
+
}, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
|
|
3169
3214
|
useEffect(function handleModelError() {
|
|
3170
3215
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
3171
3216
|
}, [modelError, onModelError]);
|
|
@@ -3222,34 +3267,33 @@ function processDocumentDetectorPrediction(prediction, thresholds) {
|
|
|
3222
3267
|
return n > 0;
|
|
3223
3268
|
});
|
|
3224
3269
|
});
|
|
3225
|
-
var
|
|
3270
|
+
var bestIdCardFront = detectedObjects.find(function (obj) {
|
|
3226
3271
|
return obj.label === 'Document';
|
|
3227
3272
|
});
|
|
3273
|
+
var bestIdCardBack = detectedObjects.find(function (obj) {
|
|
3274
|
+
return obj.label === 'Document back';
|
|
3275
|
+
});
|
|
3228
3276
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
3229
3277
|
return obj.label === 'Passport page';
|
|
3230
3278
|
});
|
|
3231
|
-
var
|
|
3232
|
-
var
|
|
3233
|
-
var
|
|
3234
|
-
var
|
|
3235
|
-
var
|
|
3279
|
+
var idCardFrontDetectionScore = (_a = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _a !== void 0 ? _a : 0;
|
|
3280
|
+
var idCardBackDetectionScore = (_b = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _b !== void 0 ? _b : 0;
|
|
3281
|
+
var passportDetectionScore = (_c = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _c !== void 0 ? _c : 0;
|
|
3282
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_d = thresholds.idCardFront) !== null && _d !== void 0 ? _d : 0);
|
|
3283
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_e = thresholds.idCardBack) !== null && _e !== void 0 ? _e : 0);
|
|
3284
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_f = thresholds.passport) !== null && _f !== void 0 ? _f : 0);
|
|
3285
|
+
var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
3286
|
+
var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
3287
|
+
var detectionScore = (_g = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _g !== void 0 ? _g : 0;
|
|
3236
3288
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
3237
3289
|
var detectedDocumentType = 'none';
|
|
3238
3290
|
if (passportDetectionThresholdMet) {
|
|
3239
3291
|
detectedDocumentType = 'passport';
|
|
3292
|
+
} else if (idCardBackDetectionThresholdMet) {
|
|
3293
|
+
detectedDocumentType = 'idCardBack';
|
|
3240
3294
|
} else if (detectionThresholdMet) {
|
|
3241
|
-
detectedDocumentType = '
|
|
3295
|
+
detectedDocumentType = 'idCardFront';
|
|
3242
3296
|
}
|
|
3243
|
-
var bestMrz = detectedObjects.find(function (obj) {
|
|
3244
|
-
return obj.label === 'MRZ';
|
|
3245
|
-
});
|
|
3246
|
-
var mrzDetectionScore = (_d = bestMrz === null || bestMrz === void 0 ? void 0 : bestMrz.score) !== null && _d !== void 0 ? _d : 0;
|
|
3247
|
-
var mrzDetectionThresholdMet = mrzDetectionScore >= ((_e = thresholds.mrz) !== null && _e !== void 0 ? _e : 0);
|
|
3248
|
-
var bestPdf417 = detectedObjects.find(function (obj) {
|
|
3249
|
-
return obj.label === 'PDF417';
|
|
3250
|
-
});
|
|
3251
|
-
var pdf417DetectionScore = (_f = bestPdf417 === null || bestPdf417 === void 0 ? void 0 : bestPdf417.score) !== null && _f !== void 0 ? _f : 0;
|
|
3252
|
-
var pdf417DetectionThresholdMet = pdf417DetectionScore >= ((_g = thresholds.pdf417) !== null && _g !== void 0 ? _g : 0);
|
|
3253
3297
|
var documentInBounds = false;
|
|
3254
3298
|
if (bestDocument) {
|
|
3255
3299
|
var boundaryPx = 20;
|
|
@@ -3279,15 +3323,13 @@ function processDocumentDetectorPrediction(prediction, thresholds) {
|
|
|
3279
3323
|
detectionTime: time,
|
|
3280
3324
|
detectionThresholdMet: detectionThresholdMet,
|
|
3281
3325
|
detectedDocumentType: detectedDocumentType,
|
|
3326
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
3327
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
3328
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
3329
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
3282
3330
|
passportDetectionScore: passportDetectionScore,
|
|
3283
3331
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
3284
|
-
mrzDetectionScore: mrzDetectionScore,
|
|
3285
|
-
mrzDetectionThresholdMet: mrzDetectionThresholdMet,
|
|
3286
|
-
pdf417DetectionScore: pdf417DetectionScore,
|
|
3287
|
-
pdf417DetectionThresholdMet: pdf417DetectionThresholdMet,
|
|
3288
3332
|
bestDocument: bestDocument,
|
|
3289
|
-
bestMrz: bestMrz,
|
|
3290
|
-
bestPdf417: bestPdf417,
|
|
3291
3333
|
documentInBounds: documentInBounds,
|
|
3292
3334
|
documentTooClose: documentTooClose,
|
|
3293
3335
|
frameWidth: frameWidth,
|
|
@@ -3535,24 +3577,26 @@ function FocusModelProvider(_a) {
|
|
|
3535
3577
|
focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
3536
3578
|
_c = _a.focusModelLoadTimeoutMs,
|
|
3537
3579
|
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
3538
|
-
onFocusModelError = _a.onFocusModelError
|
|
3580
|
+
onFocusModelError = _a.onFocusModelError,
|
|
3581
|
+
_d = _a.showCanvases,
|
|
3582
|
+
showCanvases = _d === void 0 ? false : _d;
|
|
3539
3583
|
var cropCanvas = useRef(null);
|
|
3540
3584
|
var rotateCanvas = useRef(null);
|
|
3541
|
-
var
|
|
3542
|
-
focusThresholds =
|
|
3543
|
-
setFocusThresholds =
|
|
3544
|
-
var
|
|
3545
|
-
focusPredictionTime =
|
|
3546
|
-
setFocusPredictionTime =
|
|
3547
|
-
var
|
|
3585
|
+
var _e = useState({}),
|
|
3586
|
+
focusThresholds = _e[0],
|
|
3587
|
+
setFocusThresholds = _e[1];
|
|
3588
|
+
var _f = useState(0),
|
|
3589
|
+
focusPredictionTime = _f[0],
|
|
3590
|
+
setFocusPredictionTime = _f[1];
|
|
3591
|
+
var _g = useLoadFocusModel({
|
|
3548
3592
|
modelPath: focusModelPath,
|
|
3549
3593
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
3550
3594
|
onModelError: onFocusModelError
|
|
3551
3595
|
}),
|
|
3552
|
-
model =
|
|
3553
|
-
ready =
|
|
3554
|
-
modelDownloadProgress =
|
|
3555
|
-
modelError =
|
|
3596
|
+
model = _g.model,
|
|
3597
|
+
ready = _g.ready,
|
|
3598
|
+
modelDownloadProgress = _g.modelDownloadProgress,
|
|
3599
|
+
modelError = _g.modelError;
|
|
3556
3600
|
var makeFocusPrediction = useCallback(function (imageData, box) {
|
|
3557
3601
|
if (!model.current) return null;
|
|
3558
3602
|
var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -3573,13 +3617,23 @@ function FocusModelProvider(_a) {
|
|
|
3573
3617
|
return /*#__PURE__*/React__default.createElement(FocusModelContext.Provider, {
|
|
3574
3618
|
value: value
|
|
3575
3619
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
3576
|
-
ref: rotateCanvas
|
|
3620
|
+
ref: rotateCanvas,
|
|
3621
|
+
style: showCanvases ? {
|
|
3622
|
+
display: 'block'
|
|
3623
|
+
} : undefined
|
|
3577
3624
|
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
3578
|
-
ref: cropCanvas
|
|
3625
|
+
ref: cropCanvas,
|
|
3626
|
+
style: showCanvases ? {
|
|
3627
|
+
display: 'block'
|
|
3628
|
+
} : undefined
|
|
3579
3629
|
}), children);
|
|
3580
3630
|
}
|
|
3581
3631
|
|
|
3582
3632
|
var onMobile = isMobile();
|
|
3633
|
+
var defaultIdCaptureThresholds = {
|
|
3634
|
+
detection: defaultDocumentDetectionThresholds,
|
|
3635
|
+
focus: defaultFocusThresholds
|
|
3636
|
+
};
|
|
3583
3637
|
var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
3584
3638
|
ready: false,
|
|
3585
3639
|
start: function start() {
|
|
@@ -3590,7 +3644,7 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
3590
3644
|
},
|
|
3591
3645
|
modelDownloadProgress: 0,
|
|
3592
3646
|
modelError: null,
|
|
3593
|
-
thresholds:
|
|
3647
|
+
thresholds: defaultIdCaptureThresholds,
|
|
3594
3648
|
setThresholds: function setThresholds() {
|
|
3595
3649
|
return null;
|
|
3596
3650
|
},
|
|
@@ -3605,6 +3659,10 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
3605
3659
|
},
|
|
3606
3660
|
resetBestFrame: function resetBestFrame() {
|
|
3607
3661
|
return null;
|
|
3662
|
+
},
|
|
3663
|
+
requiredDocumentType: 'none',
|
|
3664
|
+
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
3665
|
+
return null;
|
|
3608
3666
|
}
|
|
3609
3667
|
});
|
|
3610
3668
|
function IdCaptureModelsProviderInner(_a) {
|
|
@@ -3637,26 +3695,34 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3637
3695
|
var bestPredictionCanvas = useRef(null);
|
|
3638
3696
|
var bestFocusScore = useRef(0);
|
|
3639
3697
|
var stopDetection = useRef(0);
|
|
3698
|
+
var _e = useState('none'),
|
|
3699
|
+
requiredDocumentType = _e[0],
|
|
3700
|
+
setRequiredDocumentType = _e[1];
|
|
3640
3701
|
var thresholds = useMemo(function () {
|
|
3641
3702
|
return __assign(__assign({}, documentDetectionThresholds), {
|
|
3642
3703
|
focus: focusThresholds
|
|
3643
3704
|
});
|
|
3644
3705
|
}, [documentDetectionThresholds, focusThresholds]);
|
|
3645
3706
|
var setThresholds = useCallback(function (thresholds) {
|
|
3646
|
-
|
|
3647
|
-
|
|
3707
|
+
if (thresholds.detection) {
|
|
3708
|
+
setDocumentDetectionThresholds(thresholds.detection);
|
|
3709
|
+
}
|
|
3710
|
+
if (thresholds.focus) {
|
|
3711
|
+
setFocusThresholds(thresholds.focus);
|
|
3712
|
+
}
|
|
3648
3713
|
}, [setDocumentDetectionThresholds, setFocusThresholds]);
|
|
3649
3714
|
useEffect(function handleDetections() {
|
|
3650
3715
|
var _this = this;
|
|
3651
3716
|
onDocumentDetected(function (prediction) {
|
|
3652
3717
|
return __awaiter(_this, void 0, void 0, function () {
|
|
3653
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, focusPrediction, focusThresholdSet, focusThreshold;
|
|
3718
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
3654
3719
|
var _a, _b, _c, _d, _e;
|
|
3655
3720
|
return __generator(this, function (_f) {
|
|
3656
3721
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
3657
3722
|
stopDetectionAtStart = stopDetection.current;
|
|
3658
3723
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
3659
|
-
|
|
3724
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
|
|
3725
|
+
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
|
|
3660
3726
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_a = prediction.bestDocument) === null || _a === void 0 ? void 0 : _a.box);
|
|
3661
3727
|
if (focusPrediction) {
|
|
3662
3728
|
focusScore = focusPrediction.score;
|
|
@@ -3685,7 +3751,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3685
3751
|
});
|
|
3686
3752
|
});
|
|
3687
3753
|
});
|
|
3688
|
-
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, thresholds.focus]);
|
|
3754
|
+
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
3689
3755
|
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
3690
3756
|
useEffect(function handleModelErrors() {
|
|
3691
3757
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
@@ -3699,9 +3765,9 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3699
3765
|
canvas: bestPredictionCanvas.current
|
|
3700
3766
|
});
|
|
3701
3767
|
}, [bestFrameDetails]);
|
|
3702
|
-
var
|
|
3703
|
-
canvasKey =
|
|
3704
|
-
setCanvasKey =
|
|
3768
|
+
var _f = useState(0),
|
|
3769
|
+
canvasKey = _f[0],
|
|
3770
|
+
setCanvasKey = _f[1];
|
|
3705
3771
|
var resetBestFrame = useCallback(function () {
|
|
3706
3772
|
stopDetection.current += 1;
|
|
3707
3773
|
setCanvasKey(function (n) {
|
|
@@ -3711,6 +3777,9 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3711
3777
|
setBestFrameDetails(null);
|
|
3712
3778
|
bestFocusScore.current = 0;
|
|
3713
3779
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
3780
|
+
useEffect(function () {
|
|
3781
|
+
requiredDocumentType && resetBestFrame();
|
|
3782
|
+
}, [requiredDocumentType, resetBestFrame]);
|
|
3714
3783
|
var value = useMemo(function () {
|
|
3715
3784
|
return {
|
|
3716
3785
|
ready: documentDetectionModelReady && focusModelReady,
|
|
@@ -3725,9 +3794,11 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
3725
3794
|
focusPredictionTime: focusPredictionTime,
|
|
3726
3795
|
getBestFrame: getBestFrame,
|
|
3727
3796
|
resetBestFrame: resetBestFrame,
|
|
3728
|
-
bestFrameDetails: bestFrameDetails
|
|
3797
|
+
bestFrameDetails: bestFrameDetails,
|
|
3798
|
+
requiredDocumentType: requiredDocumentType,
|
|
3799
|
+
setRequiredDocumentType: setRequiredDocumentType
|
|
3729
3800
|
};
|
|
3730
|
-
}, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
3801
|
+
}, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
3731
3802
|
return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
|
|
3732
3803
|
value: value
|
|
3733
3804
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -3776,28 +3847,19 @@ var initialState$4 = {
|
|
|
3776
3847
|
videoHeight: 0,
|
|
3777
3848
|
detectedObjects: [],
|
|
3778
3849
|
bestDocument: undefined,
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
documentType: 'none',
|
|
3850
|
+
detectedDocumentType: 'none',
|
|
3851
|
+
detectionThresholdMet: false,
|
|
3782
3852
|
documentInBounds: false,
|
|
3783
3853
|
documentTooClose: false,
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
pdf417DetectionThresholdMet: false,
|
|
3854
|
+
flipRequired: false,
|
|
3855
|
+
idCardFrontDetectionScore: 0,
|
|
3856
|
+
idCardFrontDetectionThresholdMet: false,
|
|
3857
|
+
idCardBackDetectionScore: 0,
|
|
3858
|
+
idCardBackDetectionThresholdMet: false,
|
|
3859
|
+
passportDetectionScore: 0,
|
|
3860
|
+
passportDetectionThresholdMet: false,
|
|
3792
3861
|
focusScore: 0,
|
|
3793
3862
|
focusThresholdMet: false,
|
|
3794
|
-
barcodeScanningEnabled: false,
|
|
3795
|
-
barcodeResult: null,
|
|
3796
|
-
waitingForBarcodeScan: false,
|
|
3797
|
-
shouldScanBarcode: false,
|
|
3798
|
-
autoCaptureBarcodeRequired: 'mobile',
|
|
3799
|
-
barcodeScanFailedAttempts: 0,
|
|
3800
|
-
maxBarcodeScanAttempts: 10,
|
|
3801
3863
|
isGoodFrame: false,
|
|
3802
3864
|
goodFramesCount: 0,
|
|
3803
3865
|
goodFramesThreshold: 3,
|
|
@@ -3811,8 +3873,6 @@ var initialState$4 = {
|
|
|
3811
3873
|
capturedDocuments: {},
|
|
3812
3874
|
captureRequirement: 'idCardOrPassport',
|
|
3813
3875
|
requestedDocumentType: 'idCardFront',
|
|
3814
|
-
detectedDocumentType: 'none',
|
|
3815
|
-
differentDocumentTypeDetections: 0,
|
|
3816
3876
|
operationStartedAt: null,
|
|
3817
3877
|
captureStartedAt: null
|
|
3818
3878
|
};
|
|
@@ -3847,11 +3907,6 @@ var reducer$4 = function reducer(state, action) {
|
|
|
3847
3907
|
newState.operationStartedAt = new Date();
|
|
3848
3908
|
return newState;
|
|
3849
3909
|
}
|
|
3850
|
-
case 'configureCapture':
|
|
3851
|
-
return __assign(__assign(__assign({}, state), action.payload), {
|
|
3852
|
-
capturing: false,
|
|
3853
|
-
captureFailed: false
|
|
3854
|
-
});
|
|
3855
3910
|
case 'setRequiredDocumentType':
|
|
3856
3911
|
return __assign(__assign({}, state), {
|
|
3857
3912
|
requiredDocumentType: action.payload
|
|
@@ -3888,18 +3943,15 @@ var reducer$4 = function reducer(state, action) {
|
|
|
3888
3943
|
case 'objectsDetected':
|
|
3889
3944
|
var _d = action.payload.prediction,
|
|
3890
3945
|
detectedObjects = _d.detectedObjects,
|
|
3891
|
-
detectionScore = _d.detectionScore,
|
|
3892
3946
|
detectionThresholdMet = _d.detectionThresholdMet,
|
|
3893
3947
|
detectedDocumentType = _d.detectedDocumentType,
|
|
3948
|
+
idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
|
|
3949
|
+
idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
|
|
3950
|
+
idCardBackDetectionScore = _d.idCardBackDetectionScore,
|
|
3951
|
+
idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
|
|
3894
3952
|
passportDetectionScore = _d.passportDetectionScore,
|
|
3895
3953
|
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
3896
|
-
mrzDetectionScore = _d.mrzDetectionScore,
|
|
3897
|
-
mrzDetectionThresholdMet = _d.mrzDetectionThresholdMet,
|
|
3898
|
-
pdf417DetectionScore = _d.pdf417DetectionScore,
|
|
3899
|
-
pdf417DetectionThresholdMet = _d.pdf417DetectionThresholdMet,
|
|
3900
3954
|
bestDocument = _d.bestDocument,
|
|
3901
|
-
bestMrz = _d.bestMrz,
|
|
3902
|
-
bestPdf417 = _d.bestPdf417,
|
|
3903
3955
|
documentInBounds = _d.documentInBounds,
|
|
3904
3956
|
documentTooClose = _d.documentTooClose,
|
|
3905
3957
|
focusScore = _d.focusScore,
|
|
@@ -3915,84 +3967,48 @@ var reducer$4 = function reducer(state, action) {
|
|
|
3915
3967
|
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
3916
3968
|
}
|
|
3917
3969
|
}
|
|
3918
|
-
var
|
|
3919
|
-
var
|
|
3920
|
-
var waitingForBarcodeScan = shouldScanBarcode && !state.barcodeResult;
|
|
3921
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && focusThresholdMet;
|
|
3970
|
+
var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
|
|
3971
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && focusThresholdMet;
|
|
3922
3972
|
var goodFramesCount = state.goodFramesCount;
|
|
3923
3973
|
if (isGoodFrame) {
|
|
3924
3974
|
goodFramesCount += 1;
|
|
3925
3975
|
}
|
|
3976
|
+
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
3977
|
+
var requestedDocumentType = state.requestedDocumentType;
|
|
3978
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
3979
|
+
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
3980
|
+
requestedDocumentType = 'passport';
|
|
3981
|
+
}
|
|
3982
|
+
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
3983
|
+
requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3926
3986
|
return __assign(__assign({}, state), {
|
|
3927
3987
|
videoWidth: frameWidth,
|
|
3928
3988
|
videoHeight: frameHeight,
|
|
3929
3989
|
detectedObjects: detectedObjects,
|
|
3930
3990
|
bestDocument: bestDocument,
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3991
|
+
requestedDocumentType: requestedDocumentType,
|
|
3992
|
+
detectedDocumentType: detectedDocumentType,
|
|
3993
|
+
detectionThresholdMet: detectionThresholdMet,
|
|
3934
3994
|
documentInBounds: documentInBounds,
|
|
3935
3995
|
documentTooClose: documentTooClose,
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
passportPageDetectionThresholdMet: passportDetectionThresholdMet,
|
|
3996
|
+
flipRequired: flipRequired,
|
|
3997
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
3998
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
3999
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
4000
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4001
|
+
passportDetectionScore: passportDetectionScore,
|
|
4002
|
+
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
3944
4003
|
focusScore: focusScore,
|
|
3945
4004
|
focusThresholdMet: focusThresholdMet,
|
|
3946
|
-
shouldScanBarcode: shouldScanBarcode,
|
|
3947
|
-
waitingForBarcodeScan: waitingForBarcodeScan,
|
|
3948
4005
|
isGoodFrame: isGoodFrame,
|
|
3949
4006
|
goodFramesCount: goodFramesCount,
|
|
3950
4007
|
goodFramesThreshold: goodFramesThreshold,
|
|
3951
|
-
goodFramesThresholdMet:
|
|
4008
|
+
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
3952
4009
|
lastFrameCapturedAt: frameCapturedAt,
|
|
3953
4010
|
frameCaptureRate: frameCaptureRate
|
|
3954
4011
|
});
|
|
3955
|
-
case 'predictionMade':
|
|
3956
|
-
{
|
|
3957
|
-
var _e = action.payload,
|
|
3958
|
-
detectedDocumentType_1 = _e.detectedDocumentType,
|
|
3959
|
-
passportDetectionScore_1 = _e.passportDetectionScore;
|
|
3960
|
-
var requestedDocumentType = state.requestedDocumentType;
|
|
3961
|
-
var newState = __assign(__assign({}, state), {
|
|
3962
|
-
detectedDocumentType: detectedDocumentType_1
|
|
3963
|
-
});
|
|
3964
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
3965
|
-
var predictionIsRequestedType = requestedDocumentType.startsWith(detectedDocumentType_1);
|
|
3966
|
-
if (predictionIsRequestedType) {
|
|
3967
|
-
newState.differentDocumentTypeDetections = 0;
|
|
3968
|
-
}
|
|
3969
|
-
if (detectedDocumentType_1 === 'passport' && requestedDocumentType !== 'passport') {
|
|
3970
|
-
newState.requestedDocumentType = 'passport';
|
|
3971
|
-
}
|
|
3972
|
-
if (requestedDocumentType === 'passport' && passportDetectionScore_1 < 0.3) {
|
|
3973
|
-
newState.requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
|
|
3974
|
-
}
|
|
3975
|
-
}
|
|
3976
|
-
return newState;
|
|
3977
|
-
}
|
|
3978
|
-
case 'barcodeScanned':
|
|
3979
|
-
return __assign(__assign({}, state), {
|
|
3980
|
-
barcodeResult: action.payload.result,
|
|
3981
|
-
waitingForBarcodeScan: false,
|
|
3982
|
-
autoCaptureBarcodeRequired: false
|
|
3983
|
-
});
|
|
3984
|
-
case 'barcodeScanFailed':
|
|
3985
|
-
{
|
|
3986
|
-
var newState = __assign(__assign({}, state), {
|
|
3987
|
-
barcodeScanFailedAttempts: state.barcodeScanFailedAttempts + 1
|
|
3988
|
-
});
|
|
3989
|
-
if (newState.barcodeScanFailedAttempts >= newState.maxBarcodeScanAttempts) {
|
|
3990
|
-
newState.autoCaptureBarcodeRequired = false;
|
|
3991
|
-
newState.shouldScanBarcode = false;
|
|
3992
|
-
newState.waitingForBarcodeScan = false;
|
|
3993
|
-
}
|
|
3994
|
-
return newState;
|
|
3995
|
-
}
|
|
3996
4012
|
case 'captureStarted':
|
|
3997
4013
|
return __assign(__assign({}, state), {
|
|
3998
4014
|
captureStartedAt: new Date(),
|
|
@@ -4044,8 +4060,9 @@ var reducer$4 = function reducer(state, action) {
|
|
|
4044
4060
|
newState_1.requestedDocumentType = remainingRequirements[0];
|
|
4045
4061
|
if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack') {
|
|
4046
4062
|
newState_1.captureState = 'requestingFlip';
|
|
4047
|
-
newState_1.
|
|
4048
|
-
newState_1.
|
|
4063
|
+
newState_1.idCardFrontDetectionThresholdMet = false;
|
|
4064
|
+
newState_1.idCardBackDetectionThresholdMet = false;
|
|
4065
|
+
newState_1.passportDetectionThresholdMet = false;
|
|
4049
4066
|
}
|
|
4050
4067
|
}
|
|
4051
4068
|
return newState_1;
|
|
@@ -4076,8 +4093,9 @@ var reducer$4 = function reducer(state, action) {
|
|
|
4076
4093
|
newState_2.requestedDocumentType = remainingRequirements[0];
|
|
4077
4094
|
if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack') {
|
|
4078
4095
|
newState_2.captureState = 'requestingFlip';
|
|
4079
|
-
newState_2.
|
|
4080
|
-
newState_2.
|
|
4096
|
+
newState_2.idCardFrontDetectionThresholdMet = false;
|
|
4097
|
+
newState_2.idCardBackDetectionThresholdMet = false;
|
|
4098
|
+
newState_2.passportDetectionThresholdMet = false;
|
|
4081
4099
|
}
|
|
4082
4100
|
}
|
|
4083
4101
|
return newState_2;
|
|
@@ -4522,85 +4540,42 @@ var templateObject_1$A, templateObject_2$p;
|
|
|
4522
4540
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
4523
4541
|
|
|
4524
4542
|
var IdCapture = function IdCapture(_a) {
|
|
4525
|
-
var _b, _c, _d, _e, _f, _g, _h, _j
|
|
4543
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
4526
4544
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
_o = _a.autoCaptureBarcodeRequired,
|
|
4530
|
-
autoCaptureBarcodeRequired = _o === void 0 ? 'mobile' : _o,
|
|
4531
|
-
_p = _a.idCardDetectionThreshold,
|
|
4532
|
-
idCardDetectionThreshold = _p === void 0 ? defaultDocumentDetectionThresholds.idCard : _p,
|
|
4533
|
-
_q = _a.passportDetectionThreshold,
|
|
4534
|
-
passportDetectionThreshold = _q === void 0 ? defaultDocumentDetectionThresholds.passport : _q,
|
|
4535
|
-
_r = _a.mrzDetectionScoreThreshold,
|
|
4536
|
-
mrzDetectionScoreThreshold = _r === void 0 ? defaultDocumentDetectionThresholds.mrz : _r,
|
|
4537
|
-
_s = _a.pdf417DetectionThreshold,
|
|
4538
|
-
pdf417DetectionThreshold = _s === void 0 ? defaultDocumentDetectionThresholds.pdf417 : _s,
|
|
4539
|
-
_t = _a.idCardFocusScoreThreshold,
|
|
4540
|
-
idCardFocusScoreThreshold = _t === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _t,
|
|
4541
|
-
_u = _a.passportFocusScoreThreshold,
|
|
4542
|
-
passportFocusScoreThreshold = _u === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _u,
|
|
4543
|
-
_v = _a.barcodeScanningEnabled,
|
|
4544
|
-
barcodeScanningEnabled = _v === void 0 ? true : _v,
|
|
4545
|
-
_w = _a.maxBarcodeScanAttempts,
|
|
4546
|
-
maxBarcodeScanAttempts = _w === void 0 ? 10 : _w,
|
|
4545
|
+
_k = _a.thresholds,
|
|
4546
|
+
thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
|
|
4547
4547
|
guidanceMessage = _a.guidanceMessage,
|
|
4548
4548
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
4549
|
-
onPrediction = _a.onPrediction,
|
|
4550
4549
|
onCapture = _a.onCapture,
|
|
4551
|
-
|
|
4552
|
-
assets =
|
|
4553
|
-
|
|
4554
|
-
classNames =
|
|
4555
|
-
|
|
4556
|
-
colors =
|
|
4557
|
-
|
|
4558
|
-
rawVerbiage =
|
|
4559
|
-
|
|
4560
|
-
debugMode =
|
|
4561
|
-
var
|
|
4562
|
-
ref =
|
|
4563
|
-
|
|
4564
|
-
width =
|
|
4565
|
-
|
|
4566
|
-
height =
|
|
4567
|
-
var
|
|
4568
|
-
state =
|
|
4569
|
-
dispatch =
|
|
4550
|
+
_l = _a.assets,
|
|
4551
|
+
assets = _l === void 0 ? {} : _l,
|
|
4552
|
+
_m = _a.classNames,
|
|
4553
|
+
classNames = _m === void 0 ? {} : _m,
|
|
4554
|
+
_o = _a.colors,
|
|
4555
|
+
colors = _o === void 0 ? {} : _o,
|
|
4556
|
+
_p = _a.verbiage,
|
|
4557
|
+
rawVerbiage = _p === void 0 ? {} : _p,
|
|
4558
|
+
_q = _a.debugMode,
|
|
4559
|
+
debugMode = _q === void 0 ? false : _q;
|
|
4560
|
+
var _r = useResizeObserver(),
|
|
4561
|
+
ref = _r.ref,
|
|
4562
|
+
_s = _r.width,
|
|
4563
|
+
width = _s === void 0 ? 1 : _s,
|
|
4564
|
+
_t = _r.height,
|
|
4565
|
+
height = _t === void 0 ? 1 : _t;
|
|
4566
|
+
var _u = useIdCaptureState(),
|
|
4567
|
+
state = _u[0],
|
|
4568
|
+
dispatch = _u[1];
|
|
4570
4569
|
var cameraRef = useContext(CameraStateContext).cameraRef;
|
|
4571
|
-
var
|
|
4572
|
-
modelsReady =
|
|
4573
|
-
setThresholds =
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
getBestFrame = _6.getBestFrame;
|
|
4570
|
+
var _v = useContext(IdCaptureModelsContext),
|
|
4571
|
+
modelsReady = _v.ready,
|
|
4572
|
+
setThresholds = _v.setThresholds,
|
|
4573
|
+
detectionTime = _v.detectionTime,
|
|
4574
|
+
focusPredictionTime = _v.focusPredictionTime,
|
|
4575
|
+
getBestFrame = _v.getBestFrame;
|
|
4578
4576
|
useEffect(function () {
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
payload: {
|
|
4582
|
-
autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
|
|
4583
|
-
barcodeScanningEnabled: barcodeScanningEnabled,
|
|
4584
|
-
maxBarcodeScanAttempts: maxBarcodeScanAttempts
|
|
4585
|
-
}
|
|
4586
|
-
});
|
|
4587
|
-
}, [autoCaptureBarcodeRequired, barcodeScanningEnabled, dispatch, maxBarcodeScanAttempts]);
|
|
4588
|
-
useEffect(function () {
|
|
4589
|
-
setThresholds({
|
|
4590
|
-
idCard: idCardDetectionThreshold,
|
|
4591
|
-
passport: passportDetectionThreshold,
|
|
4592
|
-
mrz: mrzDetectionScoreThreshold,
|
|
4593
|
-
pdf417: pdf417DetectionThreshold,
|
|
4594
|
-
focus: {
|
|
4595
|
-
idCard: {
|
|
4596
|
-
mobile: idCardFocusScoreThreshold
|
|
4597
|
-
},
|
|
4598
|
-
passport: {
|
|
4599
|
-
mobile: passportFocusScoreThreshold
|
|
4600
|
-
}
|
|
4601
|
-
}
|
|
4602
|
-
});
|
|
4603
|
-
}, [idCardDetectionThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, passportDetectionThreshold, passportFocusScoreThreshold, pdf417DetectionThreshold, setThresholds]);
|
|
4577
|
+
setThresholds(thresholds);
|
|
4578
|
+
}, [thresholds, setThresholds]);
|
|
4604
4579
|
useEffect(function () {
|
|
4605
4580
|
if (!requiredDocumentType) return;
|
|
4606
4581
|
dispatch({
|
|
@@ -4617,18 +4592,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4617
4592
|
}
|
|
4618
4593
|
});
|
|
4619
4594
|
}, [dispatch, height, width]);
|
|
4620
|
-
|
|
4621
|
-
onPredictionMade(function (prediction) {
|
|
4622
|
-
dispatch({
|
|
4623
|
-
type: 'objectsDetected',
|
|
4624
|
-
payload: {
|
|
4625
|
-
prediction: prediction
|
|
4626
|
-
}
|
|
4627
|
-
});
|
|
4628
|
-
onPrediction === null || onPrediction === void 0 ? void 0 : onPrediction(prediction);
|
|
4629
|
-
});
|
|
4630
|
-
}, [dispatch, onPrediction, onPredictionMade]);
|
|
4631
|
-
var shouldCapture = autoCaptureEnabled && state.goodFramesThresholdMet && !state.capturing && !state.waitingForBarcodeScan && timeSince(state.captureStartedAt) >= 3000;
|
|
4595
|
+
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
4632
4596
|
useEffect(function () {
|
|
4633
4597
|
if (!shouldCapture) return;
|
|
4634
4598
|
dispatch({
|
|
@@ -4642,29 +4606,13 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4642
4606
|
});
|
|
4643
4607
|
return;
|
|
4644
4608
|
}
|
|
4645
|
-
var
|
|
4609
|
+
var canvas = bestFrame.canvas,
|
|
4646
4610
|
documentType = bestFrame.documentType,
|
|
4647
4611
|
boundingBox = bestFrame.boundingBox,
|
|
4648
4612
|
detectionScore = bestFrame.detectionScore,
|
|
4649
4613
|
focusScore = bestFrame.focusScore;
|
|
4650
|
-
var width =
|
|
4651
|
-
height =
|
|
4652
|
-
var canvas = originalCanvas;
|
|
4653
|
-
// resize image to 2k max if barcode is read
|
|
4654
|
-
var isGreaterThan2k = width > 1920 && height > 1080 || width > 1080 && height > 1920;
|
|
4655
|
-
if (isGreaterThan2k && !!state.barcodeResult) {
|
|
4656
|
-
canvas = document.createElement('canvas');
|
|
4657
|
-
if (width > height) {
|
|
4658
|
-
canvas.width = 1920;
|
|
4659
|
-
canvas.height = height * (1920 / width);
|
|
4660
|
-
} else {
|
|
4661
|
-
canvas.height = 1920;
|
|
4662
|
-
canvas.width = width * (1920 / height);
|
|
4663
|
-
}
|
|
4664
|
-
var ctx2d = canvas.getContext('2d');
|
|
4665
|
-
if (!ctx2d) return;
|
|
4666
|
-
ctx2d.drawImage(originalCanvas, 0, 0, canvas.width, canvas.height);
|
|
4667
|
-
}
|
|
4614
|
+
var width = canvas.width,
|
|
4615
|
+
height = canvas.height;
|
|
4668
4616
|
var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
|
|
4669
4617
|
dispatch({
|
|
4670
4618
|
type: 'frameCaptured',
|
|
@@ -4688,18 +4636,17 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4688
4636
|
type: 'captured'
|
|
4689
4637
|
});
|
|
4690
4638
|
}, 0);
|
|
4691
|
-
}, [dispatch, getBestFrame, onCapture, shouldCapture, state.
|
|
4639
|
+
}, [dispatch, getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
|
|
4692
4640
|
assets.portraitGuidesImageUrl || (assets.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
|
|
4693
4641
|
assets.landscapeGuidesImageUrl || (assets.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
|
|
4694
4642
|
var theme = useTheme();
|
|
4695
|
-
colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (
|
|
4696
|
-
colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (
|
|
4643
|
+
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');
|
|
4644
|
+
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');
|
|
4697
4645
|
var verbiage = useTranslations(rawVerbiage, {
|
|
4698
4646
|
instructionText: 'Scan the front of ID',
|
|
4699
4647
|
processingIdCardText: 'ID card front captured.',
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
guidanceSatisfiedText: 'Document detected, hold still...',
|
|
4648
|
+
guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
|
|
4649
|
+
guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
|
|
4703
4650
|
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
4704
4651
|
guidanceNotCenteredText: 'Document is not centered',
|
|
4705
4652
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
@@ -4714,10 +4661,10 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4714
4661
|
});
|
|
4715
4662
|
var satisfied = state.isGoodFrame;
|
|
4716
4663
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
4717
|
-
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.
|
|
4664
|
+
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 : '');
|
|
4718
4665
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
4719
4666
|
ref: ref,
|
|
4720
|
-
className: "flex ".concat((
|
|
4667
|
+
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
4721
4668
|
}, guidanceMessage !== '' && ( /*#__PURE__*/React__default.createElement(GuidanceMessageContainer, {
|
|
4722
4669
|
"$top": "",
|
|
4723
4670
|
"$bottom": "12.5dvh",
|
|
@@ -4726,7 +4673,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4726
4673
|
"$variant": satisfied ? 'positive' : 'default',
|
|
4727
4674
|
className: classNames.guidanceMessage
|
|
4728
4675
|
}, guidanceMessage))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugBoundingBoxOverlay, {
|
|
4729
|
-
"$flipX": !((
|
|
4676
|
+
"$flipX": !((_j = cameraRef.current) === null || _j === void 0 ? void 0 : _j.isRearFacing),
|
|
4730
4677
|
scaling: debugScalingDetails
|
|
4731
4678
|
}, state.detectedObjects.map(function (obj, i) {
|
|
4732
4679
|
var _a;
|
|
@@ -4736,7 +4683,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
4736
4683
|
scaling: debugScalingDetails,
|
|
4737
4684
|
flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
|
|
4738
4685
|
});
|
|
4739
|
-
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.
|
|
4686
|
+
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
4740
4687
|
};
|
|
4741
4688
|
var timeSince = function timeSince(t) {
|
|
4742
4689
|
if (!t) return 0;
|
|
@@ -5670,11 +5617,7 @@ var CapturedDocumentImg = function CapturedDocumentImg(_a) {
|
|
|
5670
5617
|
setUrl(cropToDetectedObjectBox(imgRef.current, bbox).toDataURL('image/jpeg', 0.95));
|
|
5671
5618
|
}, 100);
|
|
5672
5619
|
}
|
|
5673
|
-
return /*#__PURE__*/React__default.createElement("
|
|
5674
|
-
style: {
|
|
5675
|
-
position: 'relative'
|
|
5676
|
-
}
|
|
5677
|
-
}, /*#__PURE__*/React__default.createElement("img", {
|
|
5620
|
+
return /*#__PURE__*/React__default.createElement("img", {
|
|
5678
5621
|
ref: imgRef,
|
|
5679
5622
|
alt: alt,
|
|
5680
5623
|
className: className,
|
|
@@ -5694,13 +5637,12 @@ var CapturedDocumentImg = function CapturedDocumentImg(_a) {
|
|
|
5694
5637
|
(_a = link.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(link);
|
|
5695
5638
|
});
|
|
5696
5639
|
}
|
|
5697
|
-
})
|
|
5640
|
+
});
|
|
5698
5641
|
};
|
|
5699
5642
|
|
|
5700
5643
|
var OverlayInstruction = styled.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"])));
|
|
5701
5644
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
5702
5645
|
var capturedDocuments = _a.capturedDocuments,
|
|
5703
|
-
// barcodeResult,
|
|
5704
5646
|
onSubmitClick = _a.onSubmitClick,
|
|
5705
5647
|
onRetryClick = _a.onRetryClick,
|
|
5706
5648
|
_b = _a.classNames,
|
|
@@ -5708,7 +5650,9 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
5708
5650
|
_c = _a.colors,
|
|
5709
5651
|
colors = _c === void 0 ? {} : _c,
|
|
5710
5652
|
_d = _a.verbiage,
|
|
5711
|
-
rawVerbiage = _d === void 0 ? {} : _d
|
|
5653
|
+
rawVerbiage = _d === void 0 ? {} : _d,
|
|
5654
|
+
_e = _a.debugMode,
|
|
5655
|
+
debugMode = _e === void 0 ? false : _e;
|
|
5712
5656
|
var submissionStatus = useContext(SubmissionContext).submissionStatus;
|
|
5713
5657
|
var idCardFront = capturedDocuments.idCardFront,
|
|
5714
5658
|
idCardBack = capturedDocuments.idCardBack,
|
|
@@ -5743,7 +5687,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
5743
5687
|
image: idCardFront,
|
|
5744
5688
|
className: classNames.image,
|
|
5745
5689
|
alt: verbiage.idCardFrontText
|
|
5746
|
-
})))), idCardBack && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
5690
|
+
})), debugMode && ( /*#__PURE__*/React__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.createElement(ImageCol$1, {
|
|
5747
5691
|
className: classNames.imageCol
|
|
5748
5692
|
}, /*#__PURE__*/React__default.createElement(ImageHeading, {
|
|
5749
5693
|
className: classNames.imageHeading
|
|
@@ -5753,7 +5697,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
5753
5697
|
image: idCardBack,
|
|
5754
5698
|
className: classNames.image,
|
|
5755
5699
|
alt: verbiage.idCardBackText
|
|
5756
|
-
})))), passport && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
5700
|
+
})), debugMode && ( /*#__PURE__*/React__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.createElement(ImageCol$1, {
|
|
5757
5701
|
className: classNames.imageCol
|
|
5758
5702
|
}, /*#__PURE__*/React__default.createElement(ImageHeading, {
|
|
5759
5703
|
className: classNames.imageHeading
|
|
@@ -5763,7 +5707,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
5763
5707
|
image: passport,
|
|
5764
5708
|
className: classNames.image,
|
|
5765
5709
|
alt: verbiage.passportText
|
|
5766
|
-
})))))), /*#__PURE__*/React__default.createElement(OverlayInstruction, {
|
|
5710
|
+
})), debugMode && ( /*#__PURE__*/React__default.createElement("pre", null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default.createElement(OverlayInstruction, {
|
|
5767
5711
|
className: classNames.instruction
|
|
5768
5712
|
}, verbiage.instructionText), /*#__PURE__*/React__default.createElement(ButtonsRow, {
|
|
5769
5713
|
className: classNames.buttonsRow
|
|
@@ -6365,13 +6309,8 @@ function IdCaptureGuides(_a) {
|
|
|
6365
6309
|
var cameraRef = useContext(CameraStateContext).cameraRef;
|
|
6366
6310
|
var verbiage = useTranslations(rawVerbiage, {
|
|
6367
6311
|
instructionText: 'Scan the front of ID',
|
|
6368
|
-
processingIdCardText: 'ID card front captured.',
|
|
6369
6312
|
capturingText: 'Capturing...',
|
|
6370
|
-
captureFailedText: 'Capture failed!'
|
|
6371
|
-
guidanceSatisfiedText: 'Document detected, hold still...',
|
|
6372
|
-
guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
|
|
6373
|
-
guidanceNotCenteredText: 'Document is not centered',
|
|
6374
|
-
guidanceNotDetectedText: 'Document not detected'
|
|
6313
|
+
captureFailedText: 'Capture failed!'
|
|
6375
6314
|
});
|
|
6376
6315
|
var isMobile = window.innerWidth < window.innerHeight;
|
|
6377
6316
|
var frontImageUrl = portraitGuidesOnMobile && isMobile ? flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontPortraitGuidesImageUrl : flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontLandscapeGuidesImageUrl;
|
|
@@ -6385,7 +6324,7 @@ function IdCaptureGuides(_a) {
|
|
|
6385
6324
|
landscapeGuidesImageUrl: assets.landscapeGuidesImageUrl,
|
|
6386
6325
|
isMirrored: !((_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing),
|
|
6387
6326
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
6388
|
-
imageVisible: requestingFlip || !state.
|
|
6327
|
+
imageVisible: requestingFlip || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
|
|
6389
6328
|
})), guideType === 'fit' && ( /*#__PURE__*/React__default.createElement(IdCaptureFitGuide, {
|
|
6390
6329
|
classNames: classNames,
|
|
6391
6330
|
requestingFlip: requestingFlip,
|
|
@@ -6395,7 +6334,7 @@ function IdCaptureGuides(_a) {
|
|
|
6395
6334
|
backImageUrl: backImageUrl,
|
|
6396
6335
|
isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
|
|
6397
6336
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
6398
|
-
imageVisible: requestingFlip || !state.
|
|
6337
|
+
imageVisible: requestingFlip || !state.detectionThresholdMet || !state.documentInBounds || state.documentTooClose || state.flipRequired
|
|
6399
6338
|
})));
|
|
6400
6339
|
}
|
|
6401
6340
|
|
|
@@ -7290,78 +7229,66 @@ var StyledButtonsRow$8 = styled(ButtonsRow)(templateObject_6$3 || (templateObjec
|
|
|
7290
7229
|
var templateObject_1$l, templateObject_2$f, templateObject_3$d, templateObject_4$8, templateObject_5$4, templateObject_6$3;
|
|
7291
7230
|
|
|
7292
7231
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
7293
|
-
var _b, _c, _d, _e, _f, _g
|
|
7294
|
-
var _k, _l, _m, _o, _p, _q, _r, _s
|
|
7232
|
+
var _b, _c, _d, _e, _f, _g;
|
|
7233
|
+
var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7295
7234
|
var onSuccess = _a.onSuccess,
|
|
7296
7235
|
onExitCapture = _a.onExitCapture,
|
|
7297
7236
|
onUserCancel = _a.onUserCancel,
|
|
7298
|
-
|
|
7299
|
-
loadingOverlayMode =
|
|
7237
|
+
_t = _a.loadingOverlayMode,
|
|
7238
|
+
loadingOverlayMode = _t === void 0 ? 'default' : _t,
|
|
7300
7239
|
precapturedDocuments = _a.precapturedDocuments,
|
|
7301
|
-
|
|
7302
|
-
captureRequirement =
|
|
7303
|
-
|
|
7304
|
-
separateIdCardCaptureSequence =
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
_0 = _a.barcodeScanningEnabled,
|
|
7310
|
-
barcodeScanningEnabled = _0 === void 0 ? false : _0,
|
|
7311
|
-
_1 = _a.idCardAutoCaptureScoreThreshold,
|
|
7312
|
-
idCardAutoCaptureScoreThreshold = _1 === void 0 ? defaultDocumentDetectionThresholds.idCard : _1,
|
|
7313
|
-
_2 = _a.passportAutoCaptureScoreThreshold,
|
|
7314
|
-
passportAutoCaptureScoreThreshold = _2 === void 0 ? defaultDocumentDetectionThresholds.passport : _2,
|
|
7315
|
-
_3 = _a.mrzDetectionScoreThreshold,
|
|
7316
|
-
mrzDetectionScoreThreshold = _3 === void 0 ? defaultDocumentDetectionThresholds.mrz : _3,
|
|
7317
|
-
_4 = _a.idCardFocusScoreThreshold,
|
|
7318
|
-
idCardFocusScoreThreshold = _4 === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _4,
|
|
7319
|
-
_5 = _a.passportFocusScoreThreshold,
|
|
7320
|
-
passportFocusScoreThreshold = _5 === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _5,
|
|
7321
|
-
_6 = _a.skipSuccessScreen,
|
|
7322
|
-
skipSuccessScreen = _6 === void 0 ? false : _6,
|
|
7240
|
+
_u = _a.captureRequirement,
|
|
7241
|
+
captureRequirement = _u === void 0 ? 'idCardOrPassport' : _u,
|
|
7242
|
+
_v = _a.separateIdCardCaptureSequence,
|
|
7243
|
+
separateIdCardCaptureSequence = _v === void 0 ? false : _v,
|
|
7244
|
+
_w = _a.thresholds,
|
|
7245
|
+
thresholds = _w === void 0 ? defaultIdCaptureThresholds : _w,
|
|
7246
|
+
_x = _a.skipSuccessScreen,
|
|
7247
|
+
skipSuccessScreen = _x === void 0 ? false : _x,
|
|
7323
7248
|
instructions = _a.instructions,
|
|
7324
|
-
|
|
7325
|
-
releaseCameraAccessOnExit =
|
|
7326
|
-
|
|
7327
|
-
guideType =
|
|
7328
|
-
|
|
7329
|
-
portraitGuidesOnMobile =
|
|
7330
|
-
|
|
7331
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
7332
|
-
|
|
7333
|
-
silentFallback =
|
|
7334
|
-
|
|
7335
|
-
assets =
|
|
7336
|
-
|
|
7337
|
-
classNames =
|
|
7338
|
-
|
|
7339
|
-
colors =
|
|
7340
|
-
|
|
7341
|
-
verbiage =
|
|
7342
|
-
|
|
7343
|
-
debugMode =
|
|
7344
|
-
var
|
|
7345
|
-
state =
|
|
7346
|
-
dispatch =
|
|
7347
|
-
var
|
|
7348
|
-
cameraAccessDenied =
|
|
7349
|
-
releaseCameraAccess =
|
|
7350
|
-
var
|
|
7351
|
-
overlayDismissed =
|
|
7352
|
-
setOverlayDismissed =
|
|
7353
|
-
var
|
|
7354
|
-
submissionStatus =
|
|
7355
|
-
setIdFrontImage =
|
|
7356
|
-
setIdBackImage =
|
|
7357
|
-
setPassportImage =
|
|
7358
|
-
logIdFrontCaptureAttempt =
|
|
7359
|
-
logIdBackCaptureAttempt =
|
|
7360
|
-
var
|
|
7361
|
-
start =
|
|
7362
|
-
stop =
|
|
7363
|
-
|
|
7364
|
-
|
|
7249
|
+
_y = _a.releaseCameraAccessOnExit,
|
|
7250
|
+
releaseCameraAccessOnExit = _y === void 0 ? true : _y,
|
|
7251
|
+
_z = _a.guideType,
|
|
7252
|
+
guideType = _z === void 0 ? 'fit' : _z,
|
|
7253
|
+
_0 = _a.portraitGuidesOnMobile,
|
|
7254
|
+
portraitGuidesOnMobile = _0 === void 0 ? false : _0,
|
|
7255
|
+
_1 = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
7256
|
+
rotateLoadingOverlayImageWhenPortrait = _1 === void 0 ? true : _1,
|
|
7257
|
+
_2 = _a.silentFallback,
|
|
7258
|
+
silentFallback = _2 === void 0 ? false : _2,
|
|
7259
|
+
_3 = _a.assets,
|
|
7260
|
+
assets = _3 === void 0 ? {} : _3,
|
|
7261
|
+
_4 = _a.classNames,
|
|
7262
|
+
classNames = _4 === void 0 ? {} : _4,
|
|
7263
|
+
_5 = _a.colors,
|
|
7264
|
+
colors = _5 === void 0 ? {} : _5,
|
|
7265
|
+
_6 = _a.verbiage,
|
|
7266
|
+
verbiage = _6 === void 0 ? {} : _6,
|
|
7267
|
+
_7 = _a.debugMode,
|
|
7268
|
+
debugMode = _7 === void 0 ? false : _7;
|
|
7269
|
+
var _8 = useIdCaptureState(),
|
|
7270
|
+
state = _8[0],
|
|
7271
|
+
dispatch = _8[1];
|
|
7272
|
+
var _9 = useContext(CameraStateContext),
|
|
7273
|
+
cameraAccessDenied = _9.cameraAccessDenied,
|
|
7274
|
+
releaseCameraAccess = _9.releaseCameraAccess;
|
|
7275
|
+
var _10 = useState(false),
|
|
7276
|
+
overlayDismissed = _10[0],
|
|
7277
|
+
setOverlayDismissed = _10[1];
|
|
7278
|
+
var _11 = useContext(SubmissionContext),
|
|
7279
|
+
submissionStatus = _11.submissionStatus,
|
|
7280
|
+
setIdFrontImage = _11.setIdFrontImage,
|
|
7281
|
+
setIdBackImage = _11.setIdBackImage,
|
|
7282
|
+
setPassportImage = _11.setPassportImage,
|
|
7283
|
+
logIdFrontCaptureAttempt = _11.logIdFrontCaptureAttempt,
|
|
7284
|
+
logIdBackCaptureAttempt = _11.logIdBackCaptureAttempt;
|
|
7285
|
+
var _12 = useContext(IdCaptureModelsContext),
|
|
7286
|
+
start = _12.start,
|
|
7287
|
+
stop = _12.stop,
|
|
7288
|
+
onPredictionMade = _12.onPredictionMade,
|
|
7289
|
+
setRequiredDocumentType = _12.setRequiredDocumentType,
|
|
7290
|
+
modelError = _12.modelError,
|
|
7291
|
+
resetBestFrame = _12.resetBestFrame;
|
|
7365
7292
|
useEffect(function () {
|
|
7366
7293
|
dispatch({
|
|
7367
7294
|
type: 'configureWizard',
|
|
@@ -7386,16 +7313,29 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7386
7313
|
type: 'captureStarted'
|
|
7387
7314
|
});
|
|
7388
7315
|
start();
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7316
|
+
}, [dispatch, overlayDismissed, start, state.captureState]);
|
|
7317
|
+
useEffect(function () {
|
|
7318
|
+
onPredictionMade(function (prediction) {
|
|
7319
|
+
if (state.captureState === 'capturing') {
|
|
7320
|
+
dispatch({
|
|
7321
|
+
type: 'objectsDetected',
|
|
7322
|
+
payload: {
|
|
7323
|
+
prediction: prediction
|
|
7324
|
+
}
|
|
7325
|
+
});
|
|
7326
|
+
} else if (state.captureState === 'requestingFlip') {
|
|
7327
|
+
if (prediction.idCardBackDetectionThresholdMet) {
|
|
7328
|
+
resetBestFrame();
|
|
7329
|
+
dispatch({
|
|
7330
|
+
type: 'flipRequestCompleted'
|
|
7331
|
+
});
|
|
7332
|
+
}
|
|
7333
|
+
}
|
|
7397
7334
|
});
|
|
7398
|
-
}, [dispatch]);
|
|
7335
|
+
}, [dispatch, onPredictionMade, resetBestFrame, state.captureState]);
|
|
7336
|
+
useEffect(function () {
|
|
7337
|
+
if (state.captureState === 'complete') stop();
|
|
7338
|
+
}, [state.captureState, stop]);
|
|
7399
7339
|
var onCapture = useCallback(function (imageData, width, height, documentType, metadata) {
|
|
7400
7340
|
logCaptureMetadata(metadata);
|
|
7401
7341
|
dispatch({
|
|
@@ -7405,7 +7345,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7405
7345
|
width: width,
|
|
7406
7346
|
height: height,
|
|
7407
7347
|
documentType: documentType,
|
|
7408
|
-
boundingBox: metadata.boundingBox
|
|
7348
|
+
boundingBox: metadata.boundingBox,
|
|
7349
|
+
detectionScore: metadata.bestDetectionScore,
|
|
7350
|
+
focusScore: metadata.bestFocusScore
|
|
7409
7351
|
}
|
|
7410
7352
|
});
|
|
7411
7353
|
}, [dispatch, logCaptureMetadata]);
|
|
@@ -7435,9 +7377,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7435
7377
|
type: 'resetWizard'
|
|
7436
7378
|
});
|
|
7437
7379
|
}, [dispatch]);
|
|
7438
|
-
var
|
|
7439
|
-
attempt =
|
|
7440
|
-
setAttempt =
|
|
7380
|
+
var _13 = useState(0),
|
|
7381
|
+
attempt = _13[0],
|
|
7382
|
+
setAttempt = _13[1];
|
|
7441
7383
|
var onExit = useCallback(function () {
|
|
7442
7384
|
setOverlayDismissed(false);
|
|
7443
7385
|
setAttempt(function (n) {
|
|
@@ -7462,19 +7404,19 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7462
7404
|
}
|
|
7463
7405
|
}, [cameraAccessDenied]);
|
|
7464
7406
|
assets.idCardFront || (assets.idCardFront = {});
|
|
7465
|
-
(
|
|
7466
|
-
(
|
|
7407
|
+
(_h = assets.idCardFront).portraitGuidesImageUrl || (_h.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
|
|
7408
|
+
(_j = assets.idCardFront).landscapeGuidesImageUrl || (_j.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
|
|
7467
7409
|
assets.idCardBack || (assets.idCardBack = {});
|
|
7468
|
-
(
|
|
7469
|
-
(
|
|
7410
|
+
(_k = assets.idCardBack).portraitGuidesImageUrl || (_k.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Portrait-2.svg"));
|
|
7411
|
+
(_l = assets.idCardBack).landscapeGuidesImageUrl || (_l.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
|
|
7470
7412
|
assets.passport || (assets.passport = {});
|
|
7471
|
-
(
|
|
7472
|
-
(
|
|
7413
|
+
(_m = assets.passport).portraitGuidesImageUrl || (_m.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Portrait-2.svg"));
|
|
7414
|
+
(_o = assets.passport).landscapeGuidesImageUrl || (_o.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Landscape-2.svg"));
|
|
7473
7415
|
assets.flipIdPrompt || (assets.flipIdPrompt = {});
|
|
7474
|
-
(
|
|
7475
|
-
(
|
|
7476
|
-
(
|
|
7477
|
-
(
|
|
7416
|
+
(_p = assets.flipIdPrompt).frontPortraitGuidesImageUrl || (_p.frontPortraitGuidesImageUrl = assets.idCardFront.portraitGuidesImageUrl);
|
|
7417
|
+
(_q = assets.flipIdPrompt).frontLandscapeGuidesImageUrl || (_q.frontLandscapeGuidesImageUrl = assets.idCardFront.landscapeGuidesImageUrl);
|
|
7418
|
+
(_r = assets.flipIdPrompt).backPortraitGuidesImageUrl || (_r.backPortraitGuidesImageUrl = assets.idCardBack.portraitGuidesImageUrl);
|
|
7419
|
+
(_s = assets.flipIdPrompt).backLandscapeGuidesImageUrl || (_s.backLandscapeGuidesImageUrl = assets.idCardBack.landscapeGuidesImageUrl);
|
|
7478
7420
|
var idCaptureVerbiages = {
|
|
7479
7421
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
7480
7422
|
instructionText: 'Scan the front of ID',
|
|
@@ -7488,24 +7430,35 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7488
7430
|
})
|
|
7489
7431
|
};
|
|
7490
7432
|
var theme = useTheme();
|
|
7491
|
-
var
|
|
7492
|
-
guideRectX =
|
|
7493
|
-
guideRectY =
|
|
7494
|
-
guideRectWidth =
|
|
7495
|
-
guideRectHeight =
|
|
7496
|
-
imageUrl =
|
|
7433
|
+
var _14 = useIdCaptureState()[0],
|
|
7434
|
+
guideRectX = _14.guideRectX,
|
|
7435
|
+
guideRectY = _14.guideRectY,
|
|
7436
|
+
guideRectWidth = _14.guideRectWidth,
|
|
7437
|
+
guideRectHeight = _14.guideRectHeight,
|
|
7438
|
+
imageUrl = _14.imageUrl;
|
|
7497
7439
|
var idCaptureAssets = assets[state.requestedDocumentType];
|
|
7498
7440
|
var idCaptureVerbiage = idCaptureVerbiages[state.requestedDocumentType];
|
|
7499
7441
|
useEffect(function () {
|
|
7500
7442
|
if (separateIdCardCaptureSequence) return;
|
|
7501
|
-
if (state.captureState
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
}
|
|
7443
|
+
if (state.captureState !== 'requestingFlip') return;
|
|
7444
|
+
var t = setTimeout(function () {
|
|
7445
|
+
resetBestFrame();
|
|
7446
|
+
dispatch({
|
|
7447
|
+
type: 'flipRequestCompleted'
|
|
7448
|
+
});
|
|
7449
|
+
}, 6000);
|
|
7450
|
+
return function () {
|
|
7451
|
+
clearTimeout(t);
|
|
7452
|
+
};
|
|
7453
|
+
}, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
7454
|
+
useEffect(function () {
|
|
7455
|
+
if (state.requestedDocumentType === 'idCardBack') {
|
|
7456
|
+
setRequiredDocumentType('idCardBack');
|
|
7507
7457
|
}
|
|
7508
|
-
|
|
7458
|
+
return function () {
|
|
7459
|
+
setRequiredDocumentType('none');
|
|
7460
|
+
};
|
|
7461
|
+
}, [setRequiredDocumentType, state.requestedDocumentType]);
|
|
7509
7462
|
var handleCapture = useCallback(function (imageData) {
|
|
7510
7463
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
7511
7464
|
var base64ImageData;
|
|
@@ -7539,7 +7492,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7539
7492
|
});
|
|
7540
7493
|
}
|
|
7541
7494
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
7542
|
-
className: "flex ".concat((
|
|
7495
|
+
className: "flex ".concat((_b = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _b !== void 0 ? _b : '')
|
|
7543
7496
|
}, state.captureState !== 'complete' && ( /*#__PURE__*/React__default.createElement(CameraFeedWrapper, {
|
|
7544
7497
|
"$x": guideRectX,
|
|
7545
7498
|
"$y": guideRectY,
|
|
@@ -7550,15 +7503,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7550
7503
|
className: classNames === null || classNames === void 0 ? void 0 : classNames.cameraFeed
|
|
7551
7504
|
}))), overlayDismissed && state.captureState === 'capturing' && ( /*#__PURE__*/React__default.createElement(IdCapture, {
|
|
7552
7505
|
requiredDocumentType: state.requestedDocumentType,
|
|
7553
|
-
|
|
7554
|
-
idCardDetectionThreshold: idCardAutoCaptureScoreThreshold,
|
|
7555
|
-
passportDetectionThreshold: passportAutoCaptureScoreThreshold,
|
|
7556
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
7557
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
7558
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
7559
|
-
autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
|
|
7560
|
-
barcodeScanningEnabled: barcodeScanningEnabled && state.requestedDocumentType === 'idCardBack',
|
|
7561
|
-
onPrediction: onPrediction,
|
|
7506
|
+
thresholds: thresholds,
|
|
7562
7507
|
onCapture: onCapture,
|
|
7563
7508
|
assets: idCaptureAssets,
|
|
7564
7509
|
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.capture,
|
|
@@ -7574,15 +7519,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7574
7519
|
assets: idCaptureAssets,
|
|
7575
7520
|
colors: colors,
|
|
7576
7521
|
verbiage: idCaptureVerbiage
|
|
7577
|
-
}), !((
|
|
7578
|
-
classNames: (
|
|
7579
|
-
text: (
|
|
7522
|
+
}), !((_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.createElement(IdCaptureImagePreview, {
|
|
7523
|
+
classNames: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.imagePreview,
|
|
7524
|
+
text: (_f = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _f === void 0 ? void 0 : _f.processingIdCardText,
|
|
7580
7525
|
imageUrl: imageUrl
|
|
7581
7526
|
})), state.captureState !== 'complete' && ( /*#__PURE__*/React__default.createElement("div", {
|
|
7582
7527
|
id: "idmission-above-guides-content"
|
|
7583
7528
|
})), /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
7584
7529
|
onClick: onExit,
|
|
7585
|
-
className: (
|
|
7530
|
+
className: (_g = classNames.capture) === null || _g === void 0 ? void 0 : _g.exitCaptureBtn
|
|
7586
7531
|
}), !overlayDismissed && ( /*#__PURE__*/React__default.createElement(IdCaptureLoadingOverlay, {
|
|
7587
7532
|
key: attempt,
|
|
7588
7533
|
mode: loadingOverlayMode,
|
|
@@ -7609,12 +7554,12 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
7609
7554
|
verbiage: verbiage.success
|
|
7610
7555
|
})), state.captureState === 'complete' && showSuccessScreen && ( /*#__PURE__*/React__default.createElement(IdCaptureSuccess, {
|
|
7611
7556
|
capturedDocuments: state.capturedDocuments,
|
|
7612
|
-
barcodeResult: state.barcodeResult,
|
|
7613
7557
|
classNames: classNames.success,
|
|
7614
7558
|
onSubmitClick: onSubmitClick,
|
|
7615
7559
|
onRetryClick: onRetryClick,
|
|
7616
7560
|
colors: colors.success,
|
|
7617
|
-
verbiage: verbiage.success
|
|
7561
|
+
verbiage: verbiage.success,
|
|
7562
|
+
debugMode: debugMode
|
|
7618
7563
|
})));
|
|
7619
7564
|
};
|
|
7620
7565
|
|
|
@@ -9683,7 +9628,7 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
|
|
|
9683
9628
|
var processAudio = useCallback(function () {
|
|
9684
9629
|
var _a;
|
|
9685
9630
|
var audioBlob = new Blob(audioChunks.current, {
|
|
9686
|
-
type: 'audio/
|
|
9631
|
+
type: 'audio/mp4'
|
|
9687
9632
|
});
|
|
9688
9633
|
audioChunks.current = [];
|
|
9689
9634
|
setAudioUrl(URL.createObjectURL(audioBlob));
|
|
@@ -10474,6 +10419,31 @@ var DoneButton = styled(LoaderButton)(templateObject_6 || (templateObject_6 = __
|
|
|
10474
10419
|
var templateObject_1$6, templateObject_2$6, templateObject_3$6, templateObject_4$1, templateObject_5, templateObject_6;
|
|
10475
10420
|
|
|
10476
10421
|
var edgeBoundary = 0.05;
|
|
10422
|
+
var defaultVideoIdCaptureThresholds = {
|
|
10423
|
+
detection: {
|
|
10424
|
+
idCardFront: 0.6,
|
|
10425
|
+
idCardBack: 0.6,
|
|
10426
|
+
passport: 1
|
|
10427
|
+
},
|
|
10428
|
+
focus: {
|
|
10429
|
+
idCardFront: {
|
|
10430
|
+
desktop: 0,
|
|
10431
|
+
mobile: 0
|
|
10432
|
+
},
|
|
10433
|
+
idCardBack: {
|
|
10434
|
+
desktop: 0,
|
|
10435
|
+
mobile: 0
|
|
10436
|
+
},
|
|
10437
|
+
passport: {
|
|
10438
|
+
desktop: 0,
|
|
10439
|
+
mobile: 0
|
|
10440
|
+
}
|
|
10441
|
+
},
|
|
10442
|
+
goodFrames: {
|
|
10443
|
+
idCardFront: 1,
|
|
10444
|
+
idCardBack: 1
|
|
10445
|
+
}
|
|
10446
|
+
};
|
|
10477
10447
|
var IdVideoCapture = function IdVideoCapture(_a) {
|
|
10478
10448
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
10479
10449
|
var onComplete = _a.onComplete,
|
|
@@ -10485,96 +10455,85 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10485
10455
|
idCaptureModelsEnabled = _w === void 0 ? true : _w,
|
|
10486
10456
|
_x = _a.idCardFrontDelay,
|
|
10487
10457
|
idCardFrontDelay = _x === void 0 ? 1000 : _x,
|
|
10488
|
-
_y = _a.
|
|
10489
|
-
|
|
10490
|
-
_z = _a.
|
|
10491
|
-
|
|
10492
|
-
_0 = _a.
|
|
10493
|
-
|
|
10494
|
-
_1 = _a.idCardBackDetectionThreshold,
|
|
10495
|
-
idCardBackDetectionThreshold = _1 === void 0 ? 0.6 : _1,
|
|
10496
|
-
_2 = _a.idCardBackFocusThreshold,
|
|
10497
|
-
idCardBackFocusThreshold = _2 === void 0 ? 0 : _2,
|
|
10498
|
-
_3 = _a.goodIdCardBackFramesThreshold,
|
|
10499
|
-
goodIdCardBackFramesThreshold = _3 === void 0 ? 1 : _3,
|
|
10500
|
-
_4 = _a.skipShowIdCardBack,
|
|
10501
|
-
skipShowIdCardBack = _4 === void 0 ? false : _4,
|
|
10502
|
-
_5 = _a.captureCountdownSeconds,
|
|
10503
|
-
captureCountdownSeconds = _5 === void 0 ? 3 : _5,
|
|
10458
|
+
_y = _a.videoIdCaptureThresholds,
|
|
10459
|
+
videoIdCaptureThresholds = _y === void 0 ? defaultVideoIdCaptureThresholds : _y,
|
|
10460
|
+
_z = _a.skipShowIdCardBack,
|
|
10461
|
+
skipShowIdCardBack = _z === void 0 ? false : _z,
|
|
10462
|
+
_0 = _a.captureCountdownSeconds,
|
|
10463
|
+
captureCountdownSeconds = _0 === void 0 ? 3 : _0,
|
|
10504
10464
|
readTextPrompt = _a.readTextPrompt,
|
|
10505
|
-
|
|
10506
|
-
readTextTimeoutDurationMs =
|
|
10507
|
-
|
|
10508
|
-
readTextMinReadingMs =
|
|
10509
|
-
|
|
10510
|
-
disableFaceDetectionWhileAudioCapture =
|
|
10511
|
-
|
|
10512
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
10513
|
-
|
|
10514
|
-
mergeAVStreams =
|
|
10515
|
-
|
|
10516
|
-
assets =
|
|
10517
|
-
|
|
10518
|
-
classNames =
|
|
10519
|
-
|
|
10520
|
-
colors =
|
|
10521
|
-
|
|
10522
|
-
rawVerbiage =
|
|
10523
|
-
|
|
10524
|
-
debugMode =
|
|
10525
|
-
var
|
|
10526
|
-
ref =
|
|
10527
|
-
|
|
10528
|
-
width =
|
|
10529
|
-
|
|
10530
|
-
height =
|
|
10531
|
-
var
|
|
10532
|
-
cameraRef =
|
|
10533
|
-
videoRef =
|
|
10534
|
-
videoLoaded =
|
|
10535
|
-
cameraReady =
|
|
10536
|
-
microphoneReady =
|
|
10537
|
-
audioStream =
|
|
10538
|
-
setVideoLoaded =
|
|
10539
|
-
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
audioUrl = _26.audioUrl;
|
|
10465
|
+
_1 = _a.readTextTimeoutDurationMs,
|
|
10466
|
+
readTextTimeoutDurationMs = _1 === void 0 ? 15000 : _1,
|
|
10467
|
+
_2 = _a.readTextMinReadingMs,
|
|
10468
|
+
readTextMinReadingMs = _2 === void 0 ? 10000 : _2,
|
|
10469
|
+
_3 = _a.disableFaceDetectionWhileAudioCapture,
|
|
10470
|
+
disableFaceDetectionWhileAudioCapture = _3 === void 0 ? false : _3,
|
|
10471
|
+
_4 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
10472
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _4 === void 0 ? 2000 : _4,
|
|
10473
|
+
_5 = _a.mergeAVStreams,
|
|
10474
|
+
mergeAVStreams = _5 === void 0 ? false : _5,
|
|
10475
|
+
_6 = _a.assets,
|
|
10476
|
+
assets = _6 === void 0 ? {} : _6,
|
|
10477
|
+
_7 = _a.classNames,
|
|
10478
|
+
classNames = _7 === void 0 ? {} : _7,
|
|
10479
|
+
_8 = _a.colors,
|
|
10480
|
+
colors = _8 === void 0 ? {} : _8,
|
|
10481
|
+
_9 = _a.verbiage,
|
|
10482
|
+
rawVerbiage = _9 === void 0 ? {} : _9,
|
|
10483
|
+
_10 = _a.debugMode,
|
|
10484
|
+
debugMode = _10 === void 0 ? false : _10;
|
|
10485
|
+
var _11 = useResizeObserver(),
|
|
10486
|
+
ref = _11.ref,
|
|
10487
|
+
_12 = _11.width,
|
|
10488
|
+
width = _12 === void 0 ? 1 : _12,
|
|
10489
|
+
_13 = _11.height,
|
|
10490
|
+
height = _13 === void 0 ? 1 : _13;
|
|
10491
|
+
var _14 = useContext(CameraStateContext),
|
|
10492
|
+
cameraRef = _14.cameraRef,
|
|
10493
|
+
videoRef = _14.videoRef,
|
|
10494
|
+
videoLoaded = _14.videoLoaded,
|
|
10495
|
+
cameraReady = _14.cameraReady,
|
|
10496
|
+
microphoneReady = _14.microphoneReady,
|
|
10497
|
+
audioStream = _14.audioStream,
|
|
10498
|
+
setVideoLoaded = _14.setVideoLoaded;
|
|
10499
|
+
var _15 = useState([]),
|
|
10500
|
+
detectedObjects = _15[0],
|
|
10501
|
+
setDetectedObjects = _15[1];
|
|
10502
|
+
var _16 = useState([]),
|
|
10503
|
+
faces = _16[0],
|
|
10504
|
+
setFaces = _16[1];
|
|
10505
|
+
var _17 = useContext(IdCaptureModelsContext),
|
|
10506
|
+
idModelsReady = _17.ready,
|
|
10507
|
+
startIdModels = _17.start,
|
|
10508
|
+
stopIdModels = _17.stop,
|
|
10509
|
+
onIdPredictionMade = _17.onPredictionMade,
|
|
10510
|
+
setThresholds = _17.setThresholds,
|
|
10511
|
+
bestFrameDetails = _17.bestFrameDetails,
|
|
10512
|
+
resetBestFrame = _17.resetBestFrame,
|
|
10513
|
+
idModelError = _17.modelError;
|
|
10514
|
+
var _18 = useState(null),
|
|
10515
|
+
videoStartsAt = _18[0],
|
|
10516
|
+
setVideoStartsAt = _18[1];
|
|
10517
|
+
var _19 = useContext(SubmissionContext),
|
|
10518
|
+
setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
|
|
10519
|
+
setExpectedAudioText = _19.setExpectedAudioText;
|
|
10520
|
+
var _20 = useContext(SelfieGuidanceModelsContext),
|
|
10521
|
+
onSelfiePredictionMade = _20.onPredictionMade,
|
|
10522
|
+
selfieModelError = _20.error;
|
|
10523
|
+
var _21 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
|
|
10524
|
+
isRecordingVideo = _21.isRecordingVideo,
|
|
10525
|
+
startRecordingVideo = _21.startRecordingVideo,
|
|
10526
|
+
startRecordingAudio = _21.startRecordingAudio,
|
|
10527
|
+
stopRecordingVideo = _21.stopRecordingVideo,
|
|
10528
|
+
stopRecordingAudio = _21.stopRecordingAudio,
|
|
10529
|
+
videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
|
|
10530
|
+
audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
|
|
10531
|
+
videoUrl = _21.videoUrl,
|
|
10532
|
+
audioUrl = _21.audioUrl;
|
|
10574
10533
|
var countdownTimeoutRef = useRef(undefined);
|
|
10575
|
-
var
|
|
10576
|
-
countdownRemaining =
|
|
10577
|
-
setCountdownRemaining =
|
|
10534
|
+
var _22 = useState(-1),
|
|
10535
|
+
countdownRemaining = _22[0],
|
|
10536
|
+
setCountdownRemaining = _22[1];
|
|
10578
10537
|
useEffect(function () {
|
|
10579
10538
|
if (!isRecordingVideo && !videoUrl) {
|
|
10580
10539
|
startRecordingVideo();
|
|
@@ -10594,41 +10553,30 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10594
10553
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
10595
10554
|
}
|
|
10596
10555
|
}, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
|
|
10597
|
-
var
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
var _28 = useState('SHOW_ID_FRONT'),
|
|
10602
|
-
requestedAction = _28[0],
|
|
10603
|
-
setRequestedAction = _28[1];
|
|
10556
|
+
var _23 = useState('SHOW_ID_FRONT'),
|
|
10557
|
+
requestedAction = _23[0],
|
|
10558
|
+
setRequestedAction = _23[1];
|
|
10559
|
+
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
10604
10560
|
useEffect(function startModelsWhenCapturing() {
|
|
10605
|
-
if (!
|
|
10561
|
+
if (!shouldRunIdModels) return;
|
|
10606
10562
|
startIdModels();
|
|
10607
10563
|
return function () {
|
|
10608
10564
|
stopIdModels();
|
|
10609
10565
|
};
|
|
10610
|
-
}, [
|
|
10566
|
+
}, [shouldRunIdModels, startIdModels, stopIdModels]);
|
|
10611
10567
|
useEffect(function () {
|
|
10612
|
-
setThresholds(
|
|
10613
|
-
|
|
10614
|
-
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
setCurrentDetectionScore = _29[1];
|
|
10625
|
-
var _30 = useState(0),
|
|
10626
|
-
currentFocusScore = _30[0],
|
|
10627
|
-
setCurrentFocusScore = _30[1];
|
|
10628
|
-
var _31 = useState(0),
|
|
10629
|
-
goodFramesCount = _31[0],
|
|
10630
|
-
setGoodFramesCount = _31[1];
|
|
10631
|
-
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
|
|
10568
|
+
setThresholds(videoIdCaptureThresholds);
|
|
10569
|
+
}, [requestedAction, setThresholds, videoIdCaptureThresholds]);
|
|
10570
|
+
var _24 = useState(0),
|
|
10571
|
+
currentDetectionScore = _24[0],
|
|
10572
|
+
setCurrentDetectionScore = _24[1];
|
|
10573
|
+
var _25 = useState(0),
|
|
10574
|
+
currentFocusScore = _25[0],
|
|
10575
|
+
setCurrentFocusScore = _25[1];
|
|
10576
|
+
var _26 = useState(0),
|
|
10577
|
+
goodFramesCount = _26[0],
|
|
10578
|
+
setGoodFramesCount = _26[1];
|
|
10579
|
+
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
|
|
10632
10580
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
10633
10581
|
useEffect(function () {
|
|
10634
10582
|
if (!idCaptureModelsEnabled || idModelError) return;
|
|
@@ -10636,18 +10584,19 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10636
10584
|
setDetectedObjects(prediction.detectedObjects);
|
|
10637
10585
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
10638
10586
|
setCurrentFocusScore(prediction.focusScore);
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
} else {
|
|
10644
|
-
setGoodFramesCount(0);
|
|
10587
|
+
var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
|
|
10588
|
+
var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
|
|
10589
|
+
if (requestedAction === 'FLIP_ID' && isGoodFrame) {
|
|
10590
|
+
return setRequestedAction('SHOW_ID_BACK');
|
|
10645
10591
|
}
|
|
10592
|
+
setGoodFramesCount(isGoodFrame ? function (n) {
|
|
10593
|
+
return n + 1;
|
|
10594
|
+
} : 0);
|
|
10646
10595
|
});
|
|
10647
|
-
}, [idCaptureModelsEnabled,
|
|
10648
|
-
var
|
|
10649
|
-
idFrontCaptureStartedAt =
|
|
10650
|
-
setFirstGoodFrameTime =
|
|
10596
|
+
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction]);
|
|
10597
|
+
var _27 = useState(null),
|
|
10598
|
+
idFrontCaptureStartedAt = _27[0],
|
|
10599
|
+
setFirstGoodFrameTime = _27[1];
|
|
10651
10600
|
useEffect(function () {
|
|
10652
10601
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
10653
10602
|
}, [goodFramesCount]);
|
|
@@ -10668,73 +10617,56 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10668
10617
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
10669
10618
|
var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
|
|
10670
10619
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
10671
|
-
var
|
|
10672
|
-
countdownStartedAt =
|
|
10673
|
-
setCountdownStartedAt =
|
|
10620
|
+
var _28 = useState(),
|
|
10621
|
+
countdownStartedAt = _28[0],
|
|
10622
|
+
setCountdownStartedAt = _28[1];
|
|
10623
|
+
var photoCanvas = useRef(null);
|
|
10674
10624
|
var frameLock = useRef(false);
|
|
10675
10625
|
var captureFrame = useCallback(function () {
|
|
10676
10626
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
10677
|
-
var
|
|
10678
|
-
return __generator(this, function (
|
|
10679
|
-
switch (
|
|
10627
|
+
var frameBase64;
|
|
10628
|
+
return __generator(this, function (_a) {
|
|
10629
|
+
switch (_a.label) {
|
|
10680
10630
|
case 0:
|
|
10681
10631
|
if (frameLock.current) return [2 /*return*/];
|
|
10682
10632
|
frameLock.current = true;
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
if (!frame) {
|
|
10633
|
+
drawToCanvas(photoCanvas.current, videoRef.current);
|
|
10634
|
+
frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
|
|
10635
|
+
if (!frameBase64) {
|
|
10687
10636
|
frameLock.current = false;
|
|
10688
10637
|
return [2 /*return*/];
|
|
10689
10638
|
}
|
|
10690
|
-
|
|
10691
|
-
case
|
|
10692
|
-
|
|
10693
|
-
|
|
10694
|
-
if (!_a) return [3 /*break*/, 4];
|
|
10695
|
-
return [4 /*yield*/, new Promise(function (resolve) {
|
|
10696
|
-
var reader = new FileReader();
|
|
10697
|
-
reader.onloadend = function () {
|
|
10698
|
-
return resolve(reader.result);
|
|
10699
|
-
};
|
|
10700
|
-
reader.readAsDataURL(frame);
|
|
10701
|
-
})];
|
|
10702
|
-
case 3:
|
|
10703
|
-
_a = _b.sent();
|
|
10704
|
-
_b.label = 4;
|
|
10705
|
-
case 4:
|
|
10706
|
-
frameBase64 = _a;
|
|
10707
|
-
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 8];
|
|
10639
|
+
_a.label = 1;
|
|
10640
|
+
case 1:
|
|
10641
|
+
_a.trys.push([1,, 7, 8]);
|
|
10642
|
+
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
|
|
10708
10643
|
if (onIdFrontImageCaptured) {
|
|
10709
|
-
|
|
10644
|
+
onIdFrontImageCaptured(frameBase64);
|
|
10710
10645
|
}
|
|
10711
|
-
if (!skipShowIdCardBack) return [3 /*break*/,
|
|
10712
|
-
if (!(skipShowIdCardBack === true)) return [3 /*break*/,
|
|
10646
|
+
if (!skipShowIdCardBack) return [3 /*break*/, 4];
|
|
10647
|
+
if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
|
|
10713
10648
|
return [2 /*return*/, onIdBackCaptureComplete()];
|
|
10714
|
-
case
|
|
10649
|
+
case 2:
|
|
10715
10650
|
return [4 /*yield*/, skipShowIdCardBack()];
|
|
10716
|
-
case
|
|
10717
|
-
if (
|
|
10651
|
+
case 3:
|
|
10652
|
+
if (_a.sent()) {
|
|
10718
10653
|
return [2 /*return*/, onIdBackCaptureComplete()];
|
|
10719
10654
|
}
|
|
10720
|
-
|
|
10721
|
-
case
|
|
10655
|
+
_a.label = 4;
|
|
10656
|
+
case 4:
|
|
10722
10657
|
setRequestedAction('FLIP_ID');
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
}, 6000);
|
|
10726
|
-
return [3 /*break*/, 9];
|
|
10727
|
-
case 8:
|
|
10658
|
+
return [3 /*break*/, 6];
|
|
10659
|
+
case 5:
|
|
10728
10660
|
if (requestedAction == 'SHOW_ID_BACK') {
|
|
10729
10661
|
if (onIdBackImageCaptured) {
|
|
10730
|
-
|
|
10662
|
+
onIdBackImageCaptured(frameBase64);
|
|
10731
10663
|
}
|
|
10732
10664
|
onIdBackCaptureComplete();
|
|
10733
10665
|
}
|
|
10734
|
-
|
|
10735
|
-
case
|
|
10736
|
-
return [3 /*break*/,
|
|
10737
|
-
case
|
|
10666
|
+
_a.label = 6;
|
|
10667
|
+
case 6:
|
|
10668
|
+
return [3 /*break*/, 8];
|
|
10669
|
+
case 7:
|
|
10738
10670
|
setDetectedObjects([]);
|
|
10739
10671
|
setCurrentDetectionScore(0);
|
|
10740
10672
|
setCurrentFocusScore(0);
|
|
@@ -10746,17 +10678,27 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10746
10678
|
clearTimeout(countdownTimeoutRef.current);
|
|
10747
10679
|
}
|
|
10748
10680
|
return [7 /*endfinally*/];
|
|
10749
|
-
case
|
|
10681
|
+
case 8:
|
|
10750
10682
|
return [2 /*return*/];
|
|
10751
10683
|
}
|
|
10752
10684
|
});
|
|
10753
10685
|
});
|
|
10754
|
-
}, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack,
|
|
10686
|
+
}, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
|
|
10687
|
+
var isFlipping = requestedAction === 'FLIP_ID';
|
|
10688
|
+
useEffect(function () {
|
|
10689
|
+
if (!isFlipping) return;
|
|
10690
|
+
var t = setTimeout(function () {
|
|
10691
|
+
setRequestedAction('SHOW_ID_BACK');
|
|
10692
|
+
}, 6000);
|
|
10693
|
+
return function () {
|
|
10694
|
+
clearTimeout(t);
|
|
10695
|
+
};
|
|
10696
|
+
}, [isFlipping]);
|
|
10755
10697
|
var stopRecording = useCallback(function () {
|
|
10756
10698
|
stopRecordingVideo();
|
|
10757
10699
|
stopRecordingAudio();
|
|
10758
10700
|
}, [stopRecordingAudio, stopRecordingVideo]);
|
|
10759
|
-
var satisfied = goodFramesThresholdMet && faceCentered && delaySatisfied;
|
|
10701
|
+
var satisfied = !isFlipping && goodFramesThresholdMet && faceCentered && delaySatisfied;
|
|
10760
10702
|
useEffect(function () {
|
|
10761
10703
|
if (satisfied && !countdownStartedAt) {
|
|
10762
10704
|
setCountdownStartedAt(new Date());
|
|
@@ -10776,10 +10718,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10776
10718
|
}, 1000);
|
|
10777
10719
|
return;
|
|
10778
10720
|
}
|
|
10779
|
-
|
|
10780
|
-
captureFrame();
|
|
10781
|
-
}
|
|
10782
|
-
}, [captureFrame, countdownStartedAt, countdownTimeoutRef]);
|
|
10721
|
+
}, [countdownTimeoutRef]);
|
|
10783
10722
|
useEffect(function () {
|
|
10784
10723
|
if (!countdownStartedAt) return;
|
|
10785
10724
|
setCountdownRemaining(captureCountdownSeconds);
|
|
@@ -10789,11 +10728,17 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10789
10728
|
return function () {
|
|
10790
10729
|
clearTimeout(countdownTimeoutRef.current);
|
|
10791
10730
|
};
|
|
10792
|
-
}, [captureCountdownSeconds,
|
|
10731
|
+
}, [captureCountdownSeconds, countdownStartedAt, manualCountdown]);
|
|
10732
|
+
useEffect(function () {
|
|
10733
|
+
if (countdownRemaining === 0) {
|
|
10734
|
+
setCountdownRemaining(-1);
|
|
10735
|
+
captureFrame().then();
|
|
10736
|
+
}
|
|
10737
|
+
}, [captureFrame, countdownRemaining]);
|
|
10793
10738
|
var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
|
|
10794
|
-
var
|
|
10795
|
-
numFramesWithoutFaces =
|
|
10796
|
-
setNumFramesWithoutFaces =
|
|
10739
|
+
var _29 = useState(0),
|
|
10740
|
+
numFramesWithoutFaces = _29[0],
|
|
10741
|
+
setNumFramesWithoutFaces = _29[1];
|
|
10797
10742
|
useEffect(function () {
|
|
10798
10743
|
if (!selfieModelError) {
|
|
10799
10744
|
onSelfiePredictionMade(function (faces) {
|
|
@@ -10811,14 +10756,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10811
10756
|
}
|
|
10812
10757
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
10813
10758
|
var theme = useTheme();
|
|
10814
|
-
var
|
|
10759
|
+
var _30 = useTranslations(rawVerbiage, {
|
|
10815
10760
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
10816
10761
|
searchingForIdCardText: 'Searching for ID card...',
|
|
10817
10762
|
captureBtnText: 'Capture'
|
|
10818
10763
|
}),
|
|
10819
|
-
captureBtnText =
|
|
10820
|
-
faceNotCenteredText =
|
|
10821
|
-
searchingForIdCardText =
|
|
10764
|
+
captureBtnText = _30.captureBtnText,
|
|
10765
|
+
faceNotCenteredText = _30.faceNotCenteredText,
|
|
10766
|
+
searchingForIdCardText = _30.searchingForIdCardText;
|
|
10822
10767
|
var debugScalingDetails = useDebugScalingDetails({
|
|
10823
10768
|
enabled: debugMode,
|
|
10824
10769
|
pageWidth: width,
|
|
@@ -10832,7 +10777,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10832
10777
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
10833
10778
|
ref: ref,
|
|
10834
10779
|
className: "flex ".concat((_l = classNames.container) !== null && _l !== void 0 ? _l : '')
|
|
10835
|
-
},
|
|
10780
|
+
}, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
10781
|
+
ref: photoCanvas
|
|
10782
|
+
}), requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__default.createElement(ReadTextPrompt, {
|
|
10836
10783
|
text: readTextPrompt,
|
|
10837
10784
|
startedAt: timeoutStartedAt || undefined,
|
|
10838
10785
|
durationMs: readTextTimeoutDurationMs,
|
|
@@ -10871,7 +10818,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
10871
10818
|
className: classNames.guidanceMessage,
|
|
10872
10819
|
"$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',
|
|
10873
10820
|
"$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'
|
|
10874
|
-
}, guidanceText))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__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.createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)),
|
|
10821
|
+
}, guidanceText))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__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.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.createElement(CountdownContainer, {
|
|
10875
10822
|
className: classNames.countdownContainer
|
|
10876
10823
|
}, /*#__PURE__*/React__default.createElement(Countdown, {
|
|
10877
10824
|
className: classNames.countdown
|
|
@@ -11026,64 +10973,60 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
11026
10973
|
faceLivenessProps = _h === void 0 ? {} : _h,
|
|
11027
10974
|
_j = _a.idCaptureModelsEnabled,
|
|
11028
10975
|
idCaptureModelsEnabled = _j === void 0 ? true : _j,
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
idCardFrontFocusThreshold = _a.idCardFrontFocusThreshold,
|
|
11032
|
-
idCardBackFocusThreshold = _a.idCardBackFocusThreshold,
|
|
11033
|
-
goodIdCardFrontFramesThreshold = _a.goodIdCardFrontFramesThreshold,
|
|
11034
|
-
goodIdCardBackFramesThreshold = _a.goodIdCardBackFramesThreshold,
|
|
10976
|
+
_k = _a.videoIdCaptureThresholds,
|
|
10977
|
+
videoIdCaptureThresholds = _k === void 0 ? defaultVideoIdCaptureThresholds : _k,
|
|
11035
10978
|
readTextPrompt = _a.readTextPrompt,
|
|
11036
10979
|
readTextTimeoutDurationMs = _a.readTextTimeoutDurationMs,
|
|
11037
10980
|
readTextMinReadingMs = _a.readTextMinReadingMs,
|
|
11038
|
-
|
|
11039
|
-
skipIdCapture =
|
|
11040
|
-
|
|
11041
|
-
skipShowIdCardBack =
|
|
11042
|
-
|
|
11043
|
-
skipSuccessScreen =
|
|
11044
|
-
|
|
11045
|
-
idCaptureLoadingOverlayMode =
|
|
11046
|
-
|
|
11047
|
-
idCaptureGuideType =
|
|
11048
|
-
|
|
11049
|
-
idCapturePortraitGuidesOnMobile =
|
|
11050
|
-
|
|
11051
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
11052
|
-
|
|
11053
|
-
idCaptureModelLoadTimeoutMs =
|
|
11054
|
-
|
|
11055
|
-
faceLivenessLoadingOverlayMode =
|
|
11056
|
-
|
|
11057
|
-
disableFaceDetectionWhileAudioCapture =
|
|
11058
|
-
|
|
11059
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
11060
|
-
|
|
11061
|
-
silentFallback =
|
|
11062
|
-
|
|
11063
|
-
mergeAVStreams =
|
|
11064
|
-
|
|
11065
|
-
assets =
|
|
11066
|
-
|
|
11067
|
-
classNames =
|
|
11068
|
-
|
|
11069
|
-
colors =
|
|
11070
|
-
|
|
11071
|
-
verbiage =
|
|
11072
|
-
|
|
11073
|
-
debugMode =
|
|
11074
|
-
var
|
|
11075
|
-
submissionStatus =
|
|
11076
|
-
idCaptureVideoUrl =
|
|
11077
|
-
idCaptureVideoAudioUrl =
|
|
11078
|
-
idCaptureVideoIdFrontImage =
|
|
11079
|
-
idCaptureVideoIdBackImage =
|
|
11080
|
-
setIdCaptureVideoUrl =
|
|
11081
|
-
setIdCaptureVideoIdFrontImage =
|
|
11082
|
-
setIdCaptureVideoIdBackImage =
|
|
11083
|
-
setIdCaptureVideoAudioUrl =
|
|
11084
|
-
var
|
|
11085
|
-
captureState =
|
|
11086
|
-
setCaptureState =
|
|
10981
|
+
_l = _a.skipIdCapture,
|
|
10982
|
+
skipIdCapture = _l === void 0 ? false : _l,
|
|
10983
|
+
_m = _a.skipShowIdCardBack,
|
|
10984
|
+
skipShowIdCardBack = _m === void 0 ? false : _m,
|
|
10985
|
+
_o = _a.skipSuccessScreen,
|
|
10986
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
10987
|
+
_p = _a.idCaptureLoadingOverlayMode,
|
|
10988
|
+
idCaptureLoadingOverlayMode = _p === void 0 ? 'default' : _p,
|
|
10989
|
+
_q = _a.idCaptureGuideType,
|
|
10990
|
+
idCaptureGuideType = _q === void 0 ? 'fit' : _q,
|
|
10991
|
+
_r = _a.idCapturePortraitGuidesOnMobile,
|
|
10992
|
+
idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
|
|
10993
|
+
_s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
10994
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
10995
|
+
_t = _a.idCaptureModelLoadTimeoutMs,
|
|
10996
|
+
idCaptureModelLoadTimeoutMs = _t === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _t,
|
|
10997
|
+
_u = _a.faceLivenessLoadingOverlayMode,
|
|
10998
|
+
faceLivenessLoadingOverlayMode = _u === void 0 ? 'default' : _u,
|
|
10999
|
+
_v = _a.disableFaceDetectionWhileAudioCapture,
|
|
11000
|
+
disableFaceDetectionWhileAudioCapture = _v === void 0 ? true : _v,
|
|
11001
|
+
_w = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
11002
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
|
|
11003
|
+
_x = _a.silentFallback,
|
|
11004
|
+
silentFallback = _x === void 0 ? false : _x,
|
|
11005
|
+
_y = _a.mergeAVStreams,
|
|
11006
|
+
mergeAVStreams = _y === void 0 ? false : _y,
|
|
11007
|
+
_z = _a.assets,
|
|
11008
|
+
assets = _z === void 0 ? {} : _z,
|
|
11009
|
+
_0 = _a.classNames,
|
|
11010
|
+
classNames = _0 === void 0 ? {} : _0,
|
|
11011
|
+
_1 = _a.colors,
|
|
11012
|
+
colors = _1 === void 0 ? {} : _1,
|
|
11013
|
+
_2 = _a.verbiage,
|
|
11014
|
+
verbiage = _2 === void 0 ? {} : _2,
|
|
11015
|
+
_3 = _a.debugMode,
|
|
11016
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
11017
|
+
var _4 = useContext(SubmissionContext),
|
|
11018
|
+
submissionStatus = _4.submissionStatus,
|
|
11019
|
+
idCaptureVideoUrl = _4.idCaptureVideoUrl,
|
|
11020
|
+
idCaptureVideoAudioUrl = _4.idCaptureVideoAudioUrl,
|
|
11021
|
+
idCaptureVideoIdFrontImage = _4.idCaptureVideoIdFrontImage,
|
|
11022
|
+
idCaptureVideoIdBackImage = _4.idCaptureVideoIdBackImage,
|
|
11023
|
+
setIdCaptureVideoUrl = _4.setIdCaptureVideoUrl,
|
|
11024
|
+
setIdCaptureVideoIdFrontImage = _4.setIdCaptureVideoIdFrontImage,
|
|
11025
|
+
setIdCaptureVideoIdBackImage = _4.setIdCaptureVideoIdBackImage,
|
|
11026
|
+
setIdCaptureVideoAudioUrl = _4.setIdCaptureVideoAudioUrl;
|
|
11027
|
+
var _5 = useState('CAPTURING_ID'),
|
|
11028
|
+
captureState = _5[0],
|
|
11029
|
+
setCaptureState = _5[1];
|
|
11087
11030
|
useEffect(function () {
|
|
11088
11031
|
if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
|
|
11089
11032
|
}, [captureState, skipIdCapture]);
|
|
@@ -11114,9 +11057,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
11114
11057
|
var onVideoCaptureFaceNotDetected = useCallback(function () {
|
|
11115
11058
|
setCaptureState('CHECKING_LIVENESS');
|
|
11116
11059
|
}, []);
|
|
11117
|
-
var
|
|
11118
|
-
attempt =
|
|
11119
|
-
setAttempt =
|
|
11060
|
+
var _6 = useState(0),
|
|
11061
|
+
attempt = _6[0],
|
|
11062
|
+
setAttempt = _6[1];
|
|
11120
11063
|
var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
|
|
11121
11064
|
var onFaceCaptureExitAfterFailure = useCallback(function (resp, req) {
|
|
11122
11065
|
userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
|
|
@@ -11220,12 +11163,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
11220
11163
|
onFaceNotDetected: onVideoCaptureFaceNotDetected,
|
|
11221
11164
|
onRecordingFailed: onRecordingFailed,
|
|
11222
11165
|
idCaptureModelsEnabled: idCaptureModelsEnabled,
|
|
11223
|
-
|
|
11224
|
-
idCardBackDetectionThreshold: idCardBackDetectionThreshold,
|
|
11225
|
-
idCardFrontFocusThreshold: idCardFrontFocusThreshold,
|
|
11226
|
-
idCardBackFocusThreshold: idCardBackFocusThreshold,
|
|
11227
|
-
goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
|
|
11228
|
-
goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
|
|
11166
|
+
videoIdCaptureThresholds: videoIdCaptureThresholds,
|
|
11229
11167
|
skipShowIdCardBack: skipShowIdCardBack,
|
|
11230
11168
|
disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
|
|
11231
11169
|
disableFaceDetectionWhileAudioCaptureMsDelay: disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
@@ -11686,9 +11624,8 @@ var ThemeProvider = function ThemeProvider(_a) {
|
|
|
11686
11624
|
* Render a fullscreen ID capture component that instructs the user to photograph both sides of their ID card, or full page of their passport.
|
|
11687
11625
|
*/
|
|
11688
11626
|
var IdValidation = function IdValidation(_a) {
|
|
11689
|
-
var _b,
|
|
11690
|
-
|
|
11691
|
-
lang = _d === void 0 ? 'auto' : _d,
|
|
11627
|
+
var _b = _a.lang,
|
|
11628
|
+
lang = _b === void 0 ? 'auto' : _b,
|
|
11692
11629
|
sessionId = _a.sessionId,
|
|
11693
11630
|
clientRequestID = _a.clientRequestID,
|
|
11694
11631
|
submissionUrl = _a.submissionUrl,
|
|
@@ -11711,35 +11648,25 @@ var IdValidation = function IdValidation(_a) {
|
|
|
11711
11648
|
webhooksFireOnReview = _a.webhooksFireOnReview,
|
|
11712
11649
|
sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
|
|
11713
11650
|
precapturedDocuments = _a.precapturedDocuments,
|
|
11714
|
-
|
|
11715
|
-
loadingOverlayMode =
|
|
11716
|
-
|
|
11717
|
-
idCaptureRequirement =
|
|
11718
|
-
|
|
11719
|
-
separateIdCardCaptureSequence =
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
_k = _a.passportAutoCaptureScoreThreshold,
|
|
11725
|
-
passportAutoCaptureScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.passport : _k,
|
|
11726
|
-
_l = _a.mrzDetectionScoreThreshold,
|
|
11727
|
-
mrzDetectionScoreThreshold = _l === void 0 ? defaultDocumentDetectionThresholds.mrz : _l,
|
|
11728
|
-
_m = _a.idCardFocusScoreThreshold,
|
|
11729
|
-
idCardFocusScoreThreshold = _m === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _m,
|
|
11730
|
-
_o = _a.passportFocusScoreThreshold,
|
|
11731
|
-
passportFocusScoreThreshold = _o === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _o,
|
|
11732
|
-
_p = _a.skipSuccessScreen,
|
|
11733
|
-
skipSuccessScreen = _p === void 0 ? false : _p,
|
|
11651
|
+
_c = _a.loadingOverlayMode,
|
|
11652
|
+
loadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
11653
|
+
_d = _a.idCaptureRequirement,
|
|
11654
|
+
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
11655
|
+
_e = _a.separateIdCardCaptureSequence,
|
|
11656
|
+
separateIdCardCaptureSequence = _e === void 0 ? false : _e,
|
|
11657
|
+
_f = _a.idCaptureThresholds,
|
|
11658
|
+
idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
|
|
11659
|
+
_g = _a.skipSuccessScreen,
|
|
11660
|
+
skipSuccessScreen = _g === void 0 ? false : _g,
|
|
11734
11661
|
instructions = _a.instructions,
|
|
11735
|
-
|
|
11736
|
-
guideType =
|
|
11737
|
-
|
|
11738
|
-
portraitGuidesOnMobile =
|
|
11739
|
-
|
|
11740
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
11741
|
-
|
|
11742
|
-
modelLoadTimeoutMs =
|
|
11662
|
+
_h = _a.guideType,
|
|
11663
|
+
guideType = _h === void 0 ? 'fit' : _h,
|
|
11664
|
+
_j = _a.portraitGuidesOnMobile,
|
|
11665
|
+
portraitGuidesOnMobile = _j === void 0 ? false : _j,
|
|
11666
|
+
_k = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
11667
|
+
rotateLoadingOverlayImageWhenPortrait = _k === void 0 ? true : _k,
|
|
11668
|
+
_l = _a.modelLoadTimeoutMs,
|
|
11669
|
+
modelLoadTimeoutMs = _l === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _l,
|
|
11743
11670
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
11744
11671
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
11745
11672
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -11753,28 +11680,28 @@ var IdValidation = function IdValidation(_a) {
|
|
|
11753
11680
|
onUserCancel = _a.onUserCancel,
|
|
11754
11681
|
onModelError = _a.onModelError,
|
|
11755
11682
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
11756
|
-
|
|
11757
|
-
theme =
|
|
11758
|
-
|
|
11759
|
-
assets =
|
|
11760
|
-
|
|
11761
|
-
classNames =
|
|
11762
|
-
|
|
11763
|
-
colors =
|
|
11764
|
-
|
|
11765
|
-
verbiage =
|
|
11766
|
-
|
|
11767
|
-
captureSignature =
|
|
11768
|
-
|
|
11769
|
-
captureSignatureVideo =
|
|
11770
|
-
|
|
11771
|
-
captureAdditionalDocuments =
|
|
11772
|
-
|
|
11773
|
-
geolocationEnabled =
|
|
11774
|
-
|
|
11775
|
-
geolocationRequired =
|
|
11776
|
-
|
|
11777
|
-
debugMode =
|
|
11683
|
+
_m = _a.theme,
|
|
11684
|
+
theme = _m === void 0 ? 'default' : _m,
|
|
11685
|
+
_o = _a.assets,
|
|
11686
|
+
assets = _o === void 0 ? {} : _o,
|
|
11687
|
+
_p = _a.classNames,
|
|
11688
|
+
classNames = _p === void 0 ? {} : _p,
|
|
11689
|
+
_q = _a.colors,
|
|
11690
|
+
colors = _q === void 0 ? {} : _q,
|
|
11691
|
+
_r = _a.verbiage,
|
|
11692
|
+
verbiage = _r === void 0 ? {} : _r,
|
|
11693
|
+
_s = _a.captureSignature,
|
|
11694
|
+
captureSignature = _s === void 0 ? false : _s,
|
|
11695
|
+
_t = _a.captureSignatureVideo,
|
|
11696
|
+
captureSignatureVideo = _t === void 0 ? false : _t,
|
|
11697
|
+
_u = _a.captureAdditionalDocuments,
|
|
11698
|
+
captureAdditionalDocuments = _u === void 0 ? [] : _u,
|
|
11699
|
+
_v = _a.geolocationEnabled,
|
|
11700
|
+
geolocationEnabled = _v === void 0 ? true : _v,
|
|
11701
|
+
_w = _a.geolocationRequired,
|
|
11702
|
+
geolocationRequired = _w === void 0 ? false : _w,
|
|
11703
|
+
_x = _a.debugMode,
|
|
11704
|
+
debugMode = _x === void 0 ? false : _x;
|
|
11778
11705
|
useLanguage(lang);
|
|
11779
11706
|
useDebugLogging(debugMode);
|
|
11780
11707
|
var idCaptureProps = useMemo(function () {
|
|
@@ -11785,13 +11712,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
11785
11712
|
precapturedDocuments: precapturedDocuments,
|
|
11786
11713
|
captureRequirement: idCaptureRequirement,
|
|
11787
11714
|
separateIdCardCaptureSequence: separateIdCardCaptureSequence,
|
|
11788
|
-
|
|
11789
|
-
idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
|
|
11790
|
-
passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
|
|
11791
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
11792
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
11793
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
11794
|
-
barcodeScanningEnabled: false,
|
|
11715
|
+
thresholds: idCaptureThresholds,
|
|
11795
11716
|
skipSuccessScreen: skipSuccessScreen,
|
|
11796
11717
|
loadingOverlayMode: loadingOverlayMode,
|
|
11797
11718
|
instructions: instructions,
|
|
@@ -11805,7 +11726,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
11805
11726
|
verbiage: verbiage,
|
|
11806
11727
|
debugMode: debugMode
|
|
11807
11728
|
};
|
|
11808
|
-
}, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence,
|
|
11729
|
+
}, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, instructions, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, assets, classNames, colors, verbiage, debugMode]);
|
|
11809
11730
|
var additionalDocumentCaptureProps = useMemo(function () {
|
|
11810
11731
|
return {
|
|
11811
11732
|
documents: captureAdditionalDocuments,
|
|
@@ -11999,9 +11920,8 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
11999
11920
|
* Render a fullscreen capture component that performs `IDValidation` and `FaceValidation` sequentially.
|
|
12000
11921
|
* */
|
|
12001
11922
|
var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
12002
|
-
var _b,
|
|
12003
|
-
|
|
12004
|
-
lang = _d === void 0 ? 'auto' : _d,
|
|
11923
|
+
var _b = _a.lang,
|
|
11924
|
+
lang = _b === void 0 ? 'auto' : _b,
|
|
12005
11925
|
sessionId = _a.sessionId,
|
|
12006
11926
|
authUrl = _a.authUrl,
|
|
12007
11927
|
submissionUrl = _a.submissionUrl,
|
|
@@ -12023,39 +11943,29 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12023
11943
|
webhooksFireOnReview = _a.webhooksFireOnReview,
|
|
12024
11944
|
sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
|
|
12025
11945
|
precapturedDocuments = _a.precapturedDocuments,
|
|
12026
|
-
|
|
12027
|
-
idCaptureLoadingOverlayMode =
|
|
12028
|
-
|
|
12029
|
-
idCaptureRequirement =
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
_l = _a.idCardFocusScoreThreshold,
|
|
12039
|
-
idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
|
|
12040
|
-
_m = _a.passportFocusScoreThreshold,
|
|
12041
|
-
passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
|
|
12042
|
-
_o = _a.faceLivenessLoadingOverlayMode,
|
|
12043
|
-
faceLivenessLoadingOverlayMode = _o === void 0 ? 'default' : _o,
|
|
12044
|
-
_p = _a.faceLivenessTimeoutDurationMs,
|
|
12045
|
-
faceLivenessTimeoutDurationMs = _p === void 0 ? 15000 : _p,
|
|
12046
|
-
_q = _a.skipSuccessScreen,
|
|
12047
|
-
skipSuccessScreen = _q === void 0 ? false : _q,
|
|
11946
|
+
_c = _a.idCaptureLoadingOverlayMode,
|
|
11947
|
+
idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
11948
|
+
_d = _a.idCaptureRequirement,
|
|
11949
|
+
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
11950
|
+
_e = _a.idCaptureThresholds,
|
|
11951
|
+
idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
|
|
11952
|
+
_f = _a.faceLivenessLoadingOverlayMode,
|
|
11953
|
+
faceLivenessLoadingOverlayMode = _f === void 0 ? 'default' : _f,
|
|
11954
|
+
_g = _a.faceLivenessTimeoutDurationMs,
|
|
11955
|
+
faceLivenessTimeoutDurationMs = _g === void 0 ? 15000 : _g,
|
|
11956
|
+
_h = _a.skipSuccessScreen,
|
|
11957
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
12048
11958
|
idCaptureInstructions = _a.idCaptureInstructions,
|
|
12049
|
-
|
|
12050
|
-
idCaptureGuideType =
|
|
12051
|
-
|
|
12052
|
-
idCapturePortraitGuidesOnMobile =
|
|
12053
|
-
|
|
12054
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
12055
|
-
|
|
12056
|
-
idCaptureModelLoadTimeoutMs =
|
|
12057
|
-
|
|
12058
|
-
selfieCaptureModelLoadTimeoutMs =
|
|
11959
|
+
_j = _a.idCaptureGuideType,
|
|
11960
|
+
idCaptureGuideType = _j === void 0 ? 'fit' : _j,
|
|
11961
|
+
_k = _a.idCapturePortraitGuidesOnMobile,
|
|
11962
|
+
idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
|
|
11963
|
+
_l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
11964
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
|
|
11965
|
+
_m = _a.idCaptureModelLoadTimeoutMs,
|
|
11966
|
+
idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
|
|
11967
|
+
_o = _a.selfieCaptureModelLoadTimeoutMs,
|
|
11968
|
+
selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
|
|
12059
11969
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
12060
11970
|
onDocumentUploaded = _a.onDocumentUploaded,
|
|
12061
11971
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -12072,28 +11982,28 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12072
11982
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
12073
11983
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
12074
11984
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
12075
|
-
|
|
12076
|
-
captureSignature =
|
|
12077
|
-
|
|
12078
|
-
captureSignatureVideo =
|
|
12079
|
-
|
|
12080
|
-
captureAdditionalDocuments =
|
|
12081
|
-
|
|
12082
|
-
theme =
|
|
12083
|
-
|
|
12084
|
-
assets =
|
|
12085
|
-
|
|
12086
|
-
classNames =
|
|
12087
|
-
|
|
12088
|
-
colors =
|
|
12089
|
-
|
|
12090
|
-
verbiage =
|
|
12091
|
-
|
|
12092
|
-
geolocationEnabled =
|
|
12093
|
-
|
|
12094
|
-
geolocationRequired =
|
|
12095
|
-
|
|
12096
|
-
debugMode =
|
|
11985
|
+
_p = _a.captureSignature,
|
|
11986
|
+
captureSignature = _p === void 0 ? false : _p,
|
|
11987
|
+
_q = _a.captureSignatureVideo,
|
|
11988
|
+
captureSignatureVideo = _q === void 0 ? false : _q,
|
|
11989
|
+
_r = _a.captureAdditionalDocuments,
|
|
11990
|
+
captureAdditionalDocuments = _r === void 0 ? [] : _r,
|
|
11991
|
+
_s = _a.theme,
|
|
11992
|
+
theme = _s === void 0 ? 'default' : _s,
|
|
11993
|
+
_t = _a.assets,
|
|
11994
|
+
assets = _t === void 0 ? {} : _t,
|
|
11995
|
+
_u = _a.classNames,
|
|
11996
|
+
classNames = _u === void 0 ? {} : _u,
|
|
11997
|
+
_v = _a.colors,
|
|
11998
|
+
colors = _v === void 0 ? {} : _v,
|
|
11999
|
+
_w = _a.verbiage,
|
|
12000
|
+
verbiage = _w === void 0 ? {} : _w,
|
|
12001
|
+
_x = _a.geolocationEnabled,
|
|
12002
|
+
geolocationEnabled = _x === void 0 ? true : _x,
|
|
12003
|
+
_y = _a.geolocationRequired,
|
|
12004
|
+
geolocationRequired = _y === void 0 ? false : _y,
|
|
12005
|
+
_z = _a.debugMode,
|
|
12006
|
+
debugMode = _z === void 0 ? false : _z;
|
|
12097
12007
|
useLanguage(lang);
|
|
12098
12008
|
useDebugLogging(debugMode);
|
|
12099
12009
|
var idCaptureProps = useMemo(function () {
|
|
@@ -12107,12 +12017,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12107
12017
|
verbiage: verbiage.idCapture,
|
|
12108
12018
|
precapturedDocuments: precapturedDocuments,
|
|
12109
12019
|
captureRequirement: idCaptureRequirement,
|
|
12110
|
-
|
|
12111
|
-
idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
|
|
12112
|
-
passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
|
|
12113
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
12114
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
12115
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
12020
|
+
thresholds: idCaptureThresholds,
|
|
12116
12021
|
loadingOverlayMode: idCaptureLoadingOverlayMode,
|
|
12117
12022
|
instructions: idCaptureInstructions,
|
|
12118
12023
|
guideType: idCaptureGuideType,
|
|
@@ -12122,7 +12027,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12122
12027
|
skipSuccessScreen: skipSuccessScreen,
|
|
12123
12028
|
debugMode: debugMode
|
|
12124
12029
|
};
|
|
12125
|
-
}, [assets.idCapture, classNames.idCapture, colors.idCapture,
|
|
12030
|
+
}, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, skipSuccessScreen, debugMode]);
|
|
12126
12031
|
var faceLivenessProps = useMemo(function () {
|
|
12127
12032
|
return {
|
|
12128
12033
|
loadingOverlayMode: faceLivenessLoadingOverlayMode,
|
|
@@ -12230,10 +12135,9 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12230
12135
|
* 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.
|
|
12231
12136
|
*/
|
|
12232
12137
|
var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollment(_a) {
|
|
12233
|
-
var _b, _c;
|
|
12234
12138
|
var enrollmentId = _a.enrollmentId,
|
|
12235
|
-
|
|
12236
|
-
lang =
|
|
12139
|
+
_b = _a.lang,
|
|
12140
|
+
lang = _b === void 0 ? 'auto' : _b,
|
|
12237
12141
|
sessionId = _a.sessionId,
|
|
12238
12142
|
authUrl = _a.authUrl,
|
|
12239
12143
|
submissionUrl = _a.submissionUrl,
|
|
@@ -12257,39 +12161,29 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
12257
12161
|
webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
|
|
12258
12162
|
webhooksFireOnReview = _a.webhooksFireOnReview,
|
|
12259
12163
|
sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
|
|
12260
|
-
|
|
12261
|
-
idCaptureLoadingOverlayMode =
|
|
12262
|
-
|
|
12263
|
-
idCaptureRequirement =
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
_l = _a.idCardFocusScoreThreshold,
|
|
12273
|
-
idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
|
|
12274
|
-
_m = _a.passportFocusScoreThreshold,
|
|
12275
|
-
passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
|
|
12276
|
-
_o = _a.faceLivenessTimeoutDurationMs,
|
|
12277
|
-
faceLivenessTimeoutDurationMs = _o === void 0 ? 15000 : _o,
|
|
12278
|
-
_p = _a.faceLivenessLoadingOverlayMode,
|
|
12279
|
-
faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
|
|
12280
|
-
_q = _a.skipSuccessScreen,
|
|
12281
|
-
skipSuccessScreen = _q === void 0 ? false : _q,
|
|
12164
|
+
_c = _a.idCaptureLoadingOverlayMode,
|
|
12165
|
+
idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
12166
|
+
_d = _a.idCaptureRequirement,
|
|
12167
|
+
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
12168
|
+
_e = _a.idCaptureThresholds,
|
|
12169
|
+
idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
|
|
12170
|
+
_f = _a.faceLivenessTimeoutDurationMs,
|
|
12171
|
+
faceLivenessTimeoutDurationMs = _f === void 0 ? 15000 : _f,
|
|
12172
|
+
_g = _a.faceLivenessLoadingOverlayMode,
|
|
12173
|
+
faceLivenessLoadingOverlayMode = _g === void 0 ? 'default' : _g,
|
|
12174
|
+
_h = _a.skipSuccessScreen,
|
|
12175
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
12282
12176
|
idCaptureInstructions = _a.idCaptureInstructions,
|
|
12283
|
-
|
|
12284
|
-
idCaptureGuideType =
|
|
12285
|
-
|
|
12286
|
-
idCapturePortraitGuidesOnMobile =
|
|
12287
|
-
|
|
12288
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
12289
|
-
|
|
12290
|
-
idCaptureModelLoadTimeoutMs =
|
|
12291
|
-
|
|
12292
|
-
selfieCaptureModelLoadTimeoutMs =
|
|
12177
|
+
_j = _a.idCaptureGuideType,
|
|
12178
|
+
idCaptureGuideType = _j === void 0 ? 'fit' : _j,
|
|
12179
|
+
_k = _a.idCapturePortraitGuidesOnMobile,
|
|
12180
|
+
idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
|
|
12181
|
+
_l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
12182
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
|
|
12183
|
+
_m = _a.idCaptureModelLoadTimeoutMs,
|
|
12184
|
+
idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
|
|
12185
|
+
_o = _a.selfieCaptureModelLoadTimeoutMs,
|
|
12186
|
+
selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
|
|
12293
12187
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
12294
12188
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
12295
12189
|
onDocumentUploaded = _a.onDocumentUploaded,
|
|
@@ -12305,28 +12199,28 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
12305
12199
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
12306
12200
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
12307
12201
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
12308
|
-
|
|
12309
|
-
captureSignature =
|
|
12310
|
-
|
|
12311
|
-
captureSignatureVideo =
|
|
12312
|
-
|
|
12313
|
-
captureAdditionalDocuments =
|
|
12314
|
-
|
|
12315
|
-
theme =
|
|
12316
|
-
|
|
12317
|
-
assets =
|
|
12318
|
-
|
|
12319
|
-
classNames =
|
|
12320
|
-
|
|
12321
|
-
colors =
|
|
12322
|
-
|
|
12323
|
-
verbiage =
|
|
12324
|
-
|
|
12325
|
-
geolocationEnabled =
|
|
12326
|
-
|
|
12327
|
-
geolocationRequired =
|
|
12328
|
-
|
|
12329
|
-
debugMode =
|
|
12202
|
+
_p = _a.captureSignature,
|
|
12203
|
+
captureSignature = _p === void 0 ? false : _p,
|
|
12204
|
+
_q = _a.captureSignatureVideo,
|
|
12205
|
+
captureSignatureVideo = _q === void 0 ? false : _q,
|
|
12206
|
+
_r = _a.captureAdditionalDocuments,
|
|
12207
|
+
captureAdditionalDocuments = _r === void 0 ? [] : _r,
|
|
12208
|
+
_s = _a.theme,
|
|
12209
|
+
theme = _s === void 0 ? 'default' : _s,
|
|
12210
|
+
_t = _a.assets,
|
|
12211
|
+
assets = _t === void 0 ? {} : _t,
|
|
12212
|
+
_u = _a.classNames,
|
|
12213
|
+
classNames = _u === void 0 ? {} : _u,
|
|
12214
|
+
_v = _a.colors,
|
|
12215
|
+
colors = _v === void 0 ? {} : _v,
|
|
12216
|
+
_w = _a.verbiage,
|
|
12217
|
+
verbiage = _w === void 0 ? {} : _w,
|
|
12218
|
+
_x = _a.geolocationEnabled,
|
|
12219
|
+
geolocationEnabled = _x === void 0 ? true : _x,
|
|
12220
|
+
_y = _a.geolocationRequired,
|
|
12221
|
+
geolocationRequired = _y === void 0 ? false : _y,
|
|
12222
|
+
_z = _a.debugMode,
|
|
12223
|
+
debugMode = _z === void 0 ? false : _z;
|
|
12330
12224
|
useLanguage(lang);
|
|
12331
12225
|
useDebugLogging(debugMode);
|
|
12332
12226
|
var idCaptureProps = useMemo(function () {
|
|
@@ -12336,12 +12230,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
12336
12230
|
colors: colors.idCapture,
|
|
12337
12231
|
verbiage: verbiage.idCapture,
|
|
12338
12232
|
captureRequirement: idCaptureRequirement,
|
|
12339
|
-
|
|
12340
|
-
idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
|
|
12341
|
-
passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
|
|
12342
|
-
mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
|
|
12343
|
-
idCardFocusScoreThreshold: idCardFocusScoreThreshold,
|
|
12344
|
-
passportFocusScoreThreshold: passportFocusScoreThreshold,
|
|
12233
|
+
thresholds: idCaptureThresholds,
|
|
12345
12234
|
loadingOverlayMode: idCaptureLoadingOverlayMode,
|
|
12346
12235
|
instructions: idCaptureInstructions,
|
|
12347
12236
|
guideType: idCaptureGuideType,
|
|
@@ -12354,7 +12243,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
12354
12243
|
skipSuccessScreen: skipSuccessScreen,
|
|
12355
12244
|
debugMode: debugMode
|
|
12356
12245
|
};
|
|
12357
|
-
}, [assets.idCapture, classNames.idCapture, colors.idCapture,
|
|
12246
|
+
}, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
|
|
12358
12247
|
var faceLivenessProps = useMemo(function () {
|
|
12359
12248
|
return {
|
|
12360
12249
|
onExitCapture: onExitCapture,
|
|
@@ -13692,70 +13581,60 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
13692
13581
|
faceLivenessProps = _a.faceLivenessProps,
|
|
13693
13582
|
_c = _a.idCaptureModelsEnabled,
|
|
13694
13583
|
idCaptureModelsEnabled = _c === void 0 ? true : _c,
|
|
13695
|
-
_d = _a.
|
|
13696
|
-
|
|
13697
|
-
_e = _a.idCardFrontFocusThreshold,
|
|
13698
|
-
idCardFrontFocusThreshold = _e === void 0 ? 0 : _e,
|
|
13699
|
-
_f = _a.goodIdCardFrontFramesThreshold,
|
|
13700
|
-
goodIdCardFrontFramesThreshold = _f === void 0 ? 1 : _f,
|
|
13701
|
-
_g = _a.idCardBackDetectionThreshold,
|
|
13702
|
-
idCardBackDetectionThreshold = _g === void 0 ? 0.6 : _g,
|
|
13703
|
-
_h = _a.idCardBackFocusThreshold,
|
|
13704
|
-
idCardBackFocusThreshold = _h === void 0 ? 0 : _h,
|
|
13705
|
-
_j = _a.goodIdCardBackFramesThreshold,
|
|
13706
|
-
goodIdCardBackFramesThreshold = _j === void 0 ? 1 : _j,
|
|
13584
|
+
_d = _a.videoIdCaptureThresholds,
|
|
13585
|
+
videoIdCaptureThresholds = _d === void 0 ? defaultVideoIdCaptureThresholds : _d,
|
|
13707
13586
|
readTextPrompt = _a.readTextPrompt,
|
|
13708
|
-
|
|
13709
|
-
readTextTimeoutDurationMs =
|
|
13710
|
-
|
|
13711
|
-
readTextMinReadingMs =
|
|
13712
|
-
|
|
13713
|
-
skipSuccessScreen =
|
|
13714
|
-
|
|
13715
|
-
skipIdCapture =
|
|
13716
|
-
|
|
13717
|
-
skipShowIdCardBack =
|
|
13718
|
-
|
|
13719
|
-
idCaptureLoadingOverlayMode =
|
|
13720
|
-
|
|
13721
|
-
idCaptureGuideType =
|
|
13722
|
-
|
|
13723
|
-
idCapturePortraitGuidesOnMobile =
|
|
13724
|
-
|
|
13725
|
-
idCaptureRotateLoadingOverlayImageWhenPortrait =
|
|
13587
|
+
_e = _a.readTextTimeoutDurationMs,
|
|
13588
|
+
readTextTimeoutDurationMs = _e === void 0 ? 15000 : _e,
|
|
13589
|
+
_f = _a.readTextMinReadingMs,
|
|
13590
|
+
readTextMinReadingMs = _f === void 0 ? 10000 : _f,
|
|
13591
|
+
_g = _a.skipSuccessScreen,
|
|
13592
|
+
skipSuccessScreen = _g === void 0 ? false : _g,
|
|
13593
|
+
_h = _a.skipIdCapture,
|
|
13594
|
+
skipIdCapture = _h === void 0 ? false : _h,
|
|
13595
|
+
_j = _a.skipShowIdCardBack,
|
|
13596
|
+
skipShowIdCardBack = _j === void 0 ? false : _j,
|
|
13597
|
+
_k = _a.idCaptureLoadingOverlayMode,
|
|
13598
|
+
idCaptureLoadingOverlayMode = _k === void 0 ? 'default' : _k,
|
|
13599
|
+
_l = _a.idCaptureGuideType,
|
|
13600
|
+
idCaptureGuideType = _l === void 0 ? 'fit' : _l,
|
|
13601
|
+
_m = _a.idCapturePortraitGuidesOnMobile,
|
|
13602
|
+
idCapturePortraitGuidesOnMobile = _m === void 0 ? false : _m,
|
|
13603
|
+
_o = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
13604
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _o === void 0 ? true : _o,
|
|
13726
13605
|
idCardForFaceMatch = _a.idCardForFaceMatch,
|
|
13727
|
-
|
|
13728
|
-
faceLivenessLoadingOverlayMode =
|
|
13729
|
-
|
|
13730
|
-
disableFaceDetectionWhileAudioCapture =
|
|
13731
|
-
|
|
13732
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
13733
|
-
|
|
13734
|
-
silentFallback =
|
|
13735
|
-
|
|
13736
|
-
mergeAVStreams =
|
|
13737
|
-
|
|
13738
|
-
theme =
|
|
13739
|
-
|
|
13740
|
-
assets =
|
|
13741
|
-
|
|
13742
|
-
classNames =
|
|
13743
|
-
|
|
13744
|
-
colors =
|
|
13745
|
-
|
|
13746
|
-
verbiage =
|
|
13747
|
-
|
|
13748
|
-
captureSignature =
|
|
13749
|
-
|
|
13750
|
-
captureSignatureVideo =
|
|
13751
|
-
|
|
13752
|
-
captureAdditionalDocuments =
|
|
13753
|
-
|
|
13754
|
-
geolocationEnabled =
|
|
13755
|
-
|
|
13756
|
-
geolocationRequired =
|
|
13757
|
-
|
|
13758
|
-
debugMode =
|
|
13606
|
+
_p = _a.faceLivenessLoadingOverlayMode,
|
|
13607
|
+
faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
|
|
13608
|
+
_q = _a.disableFaceDetectionWhileAudioCapture,
|
|
13609
|
+
disableFaceDetectionWhileAudioCapture = _q === void 0 ? false : _q,
|
|
13610
|
+
_r = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
13611
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _r === void 0 ? 2000 : _r,
|
|
13612
|
+
_s = _a.silentFallback,
|
|
13613
|
+
silentFallback = _s === void 0 ? false : _s,
|
|
13614
|
+
_t = _a.mergeAVStreams,
|
|
13615
|
+
mergeAVStreams = _t === void 0 ? false : _t,
|
|
13616
|
+
_u = _a.theme,
|
|
13617
|
+
theme = _u === void 0 ? 'default' : _u,
|
|
13618
|
+
_v = _a.assets,
|
|
13619
|
+
assets = _v === void 0 ? {} : _v,
|
|
13620
|
+
_w = _a.classNames,
|
|
13621
|
+
classNames = _w === void 0 ? {} : _w,
|
|
13622
|
+
_x = _a.colors,
|
|
13623
|
+
colors = _x === void 0 ? {} : _x,
|
|
13624
|
+
_y = _a.verbiage,
|
|
13625
|
+
verbiage = _y === void 0 ? {} : _y,
|
|
13626
|
+
_z = _a.captureSignature,
|
|
13627
|
+
captureSignature = _z === void 0 ? false : _z,
|
|
13628
|
+
_0 = _a.captureSignatureVideo,
|
|
13629
|
+
captureSignatureVideo = _0 === void 0 ? false : _0,
|
|
13630
|
+
_1 = _a.captureAdditionalDocuments,
|
|
13631
|
+
captureAdditionalDocuments = _1 === void 0 ? [] : _1,
|
|
13632
|
+
_2 = _a.geolocationEnabled,
|
|
13633
|
+
geolocationEnabled = _2 === void 0 ? true : _2,
|
|
13634
|
+
_3 = _a.geolocationRequired,
|
|
13635
|
+
geolocationRequired = _3 === void 0 ? false : _3,
|
|
13636
|
+
_4 = _a.debugMode,
|
|
13637
|
+
debugMode = _4 === void 0 ? false : _4;
|
|
13759
13638
|
useLanguage(lang);
|
|
13760
13639
|
useDebugLogging(debugMode);
|
|
13761
13640
|
var videoIdCaptureProps = useMemo(function () {
|
|
@@ -13763,12 +13642,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
13763
13642
|
idCaptureProps: idCaptureProps,
|
|
13764
13643
|
faceLivenessProps: faceLivenessProps,
|
|
13765
13644
|
idCaptureModelsEnabled: idCaptureModelsEnabled,
|
|
13766
|
-
|
|
13767
|
-
idCardFrontFocusThreshold: idCardFrontFocusThreshold,
|
|
13768
|
-
goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
|
|
13769
|
-
idCardBackDetectionThreshold: idCardBackDetectionThreshold,
|
|
13770
|
-
idCardBackFocusThreshold: idCardBackFocusThreshold,
|
|
13771
|
-
goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
|
|
13645
|
+
videoIdCaptureThresholds: videoIdCaptureThresholds,
|
|
13772
13646
|
readTextPrompt: readTextPrompt,
|
|
13773
13647
|
readTextTimeoutDurationMs: readTextTimeoutDurationMs,
|
|
13774
13648
|
readTextMinReadingMs: readTextMinReadingMs,
|
|
@@ -13793,7 +13667,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
13793
13667
|
verbiage: verbiage,
|
|
13794
13668
|
debugMode: debugMode
|
|
13795
13669
|
};
|
|
13796
|
-
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled,
|
|
13670
|
+
}, [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]);
|
|
13797
13671
|
var additionalDocumentCaptureProps = useMemo(function () {
|
|
13798
13672
|
return {
|
|
13799
13673
|
documents: captureAdditionalDocuments,
|