idmission-web-sdk 2.1.94 → 2.1.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/face_liveness/FaceLivenessCapture.d.ts +1 -2
- package/dist/components/face_liveness/FaceLivenessWizard.d.ts +1 -2
- package/dist/components/selfie_capture/SelfieCapture.d.ts +2 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts +4 -3
- package/dist/lib/models/FaceDetection.d.ts +21 -0
- package/dist/lib/models/helpers.d.ts +4 -0
- package/dist/sdk2.cjs.development.js +380 -366
- 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 +380 -366
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +380 -366
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
234
234
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
var webSdkVersion = '2.1.
|
|
237
|
+
var webSdkVersion = '2.1.96';
|
|
238
238
|
|
|
239
239
|
function getPlatform() {
|
|
240
240
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2754,6 +2754,36 @@ function waitForVideoReady(videoRef, checkEveryMs) {
|
|
|
2754
2754
|
}, checkEveryMs);
|
|
2755
2755
|
});
|
|
2756
2756
|
}
|
|
2757
|
+
function createPairs(arr, maxPairs) {
|
|
2758
|
+
var pairs = [];
|
|
2759
|
+
var len = arr.length - 1;
|
|
2760
|
+
var end = Math.min(maxPairs , len);
|
|
2761
|
+
for (var i = 0; i < end; i++) {
|
|
2762
|
+
pairs.push([arr[i], arr[i + 1]]);
|
|
2763
|
+
}
|
|
2764
|
+
return pairs;
|
|
2765
|
+
}
|
|
2766
|
+
function calculateIoU(boxA, boxB) {
|
|
2767
|
+
var xA = Math.max(boxA.xMin, boxB.xMin);
|
|
2768
|
+
var yA = Math.max(boxA.yMin, boxB.yMin);
|
|
2769
|
+
var xB = Math.min(boxA.xMax, boxB.xMax);
|
|
2770
|
+
var yB = Math.min(boxA.yMax, boxB.yMax);
|
|
2771
|
+
var intersectWidth = Math.max(0, xB - xA);
|
|
2772
|
+
var intersectHeight = Math.max(0, yB - yA);
|
|
2773
|
+
var intersectionArea = intersectWidth * intersectHeight;
|
|
2774
|
+
var boxAArea = (boxA.xMax - boxA.xMin) * (boxA.yMax - boxA.yMin);
|
|
2775
|
+
var boxBArea = (boxB.xMax - boxB.xMin) * (boxB.yMax - boxB.yMin);
|
|
2776
|
+
var unionArea = boxAArea + boxBArea - intersectionArea;
|
|
2777
|
+
if (unionArea === 0) return 0;
|
|
2778
|
+
return intersectionArea / unionArea;
|
|
2779
|
+
}
|
|
2780
|
+
function average(arr) {
|
|
2781
|
+
var len = arr.length;
|
|
2782
|
+
if (len === 0) return 0;
|
|
2783
|
+
var sum = 0;
|
|
2784
|
+
for (var i = 0; i < len; i++) sum += arr[i];
|
|
2785
|
+
return sum / len;
|
|
2786
|
+
}
|
|
2757
2787
|
|
|
2758
2788
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
2759
2789
|
|
|
@@ -5194,6 +5224,25 @@ function useLoadFaceDetector(_a) {
|
|
|
5194
5224
|
modelError: modelError
|
|
5195
5225
|
};
|
|
5196
5226
|
}
|
|
5227
|
+
var lastFaceDetectionAt = 0;
|
|
5228
|
+
var lastFaceDetectionTime = 0;
|
|
5229
|
+
function setLastFaceDetectionAt(time) {
|
|
5230
|
+
lastFaceDetectionTime = time - lastFaceDetectionAt;
|
|
5231
|
+
lastFaceDetectionAt = time;
|
|
5232
|
+
}
|
|
5233
|
+
var framesNeededSamples$1 = [];
|
|
5234
|
+
function trackFramesNeeded$1(value) {
|
|
5235
|
+
framesNeededSamples$1.unshift(value);
|
|
5236
|
+
if (framesNeededSamples$1.length > 10) framesNeededSamples$1.length = 10;
|
|
5237
|
+
}
|
|
5238
|
+
var lastNFaces = [];
|
|
5239
|
+
function trackFace(face, framesNeeded) {
|
|
5240
|
+
if (framesNeeded === void 0) {
|
|
5241
|
+
framesNeeded = 12;
|
|
5242
|
+
}
|
|
5243
|
+
lastNFaces.unshift(face);
|
|
5244
|
+
if (lastNFaces.length > framesNeeded) lastNFaces.length = framesNeeded;
|
|
5245
|
+
}
|
|
5197
5246
|
function makeFaceDetectorPrediction(model, imageData) {
|
|
5198
5247
|
var prediction = model.detectForVideo(imageData, performance.now());
|
|
5199
5248
|
var faces = prediction.detections.map(function (d) {
|
|
@@ -5213,6 +5262,71 @@ function makeFaceDetectorPrediction(model, imageData) {
|
|
|
5213
5262
|
faces: faces
|
|
5214
5263
|
});
|
|
5215
5264
|
}
|
|
5265
|
+
function processFaceDetectorPrediction(_a) {
|
|
5266
|
+
var faces = _a.faces,
|
|
5267
|
+
videoWidth = _a.videoWidth,
|
|
5268
|
+
videoHeight = _a.videoHeight,
|
|
5269
|
+
_b = _a.requireVerticalFaceCentering,
|
|
5270
|
+
requireVerticalFaceCentering = _b === void 0 ? true : _b,
|
|
5271
|
+
_c = _a.stabilityThreshold,
|
|
5272
|
+
stabilityThreshold = _c === void 0 ? 0.9 : _c;
|
|
5273
|
+
var face = faces[0];
|
|
5274
|
+
var faceNotDetected = faces.length === 0;
|
|
5275
|
+
var faceNotCentered = requireVerticalFaceCentering,
|
|
5276
|
+
faceLookingAway = false,
|
|
5277
|
+
faceTooClose = false,
|
|
5278
|
+
faceTooFar = false;
|
|
5279
|
+
if (face) {
|
|
5280
|
+
// calculate centroids
|
|
5281
|
+
var vCX = videoWidth / 2;
|
|
5282
|
+
var vCY = videoHeight / 2;
|
|
5283
|
+
var fCX = (face.box.xMin + face.box.xMax) / 2;
|
|
5284
|
+
var fCY = (face.box.yMin + face.box.yMax) / 2;
|
|
5285
|
+
// calculate thresholds
|
|
5286
|
+
var vTX = videoWidth * 0.125;
|
|
5287
|
+
var vTY = videoHeight * 0.125;
|
|
5288
|
+
var fTW = face.box.width * 0.2;
|
|
5289
|
+
var fTH = face.box.height * 0.2;
|
|
5290
|
+
var nose = face.keypoints[2]; //.find((k) => k.name === 'noseTip')
|
|
5291
|
+
if (nose) {
|
|
5292
|
+
faceLookingAway = Math.abs(fCX - nose.x) > fTW || Math.abs(fCY - nose.y) > fTH;
|
|
5293
|
+
var faceNotCenteredHorizontally = Math.abs(vCX - fCX) > vTX;
|
|
5294
|
+
var faceNotCenteredVertically = Math.abs(vCY + 50 - fCY) > vTY;
|
|
5295
|
+
faceNotCentered = faceNotCenteredHorizontally || requireVerticalFaceCentering && faceNotCenteredVertically;
|
|
5296
|
+
}
|
|
5297
|
+
var isMobile = videoWidth < videoHeight;
|
|
5298
|
+
var tooCloseMultiple = isMobile ? 2 : 4.5;
|
|
5299
|
+
var tooFarMultiple = isMobile ? 6 : 7;
|
|
5300
|
+
faceTooClose = face.box.width > videoWidth / tooCloseMultiple;
|
|
5301
|
+
faceTooFar = face.box.width < videoWidth / tooFarMultiple;
|
|
5302
|
+
}
|
|
5303
|
+
var faceInGuides = !faceNotDetected && !faceNotCentered && !faceLookingAway && !faceTooClose && !faceTooFar;
|
|
5304
|
+
if (lastFaceDetectionTime > 0) {
|
|
5305
|
+
trackFramesNeeded$1(1000 / lastFaceDetectionTime);
|
|
5306
|
+
}
|
|
5307
|
+
var faceIsStable = false;
|
|
5308
|
+
if (faceInGuides) {
|
|
5309
|
+
var framesNeeded = Math.ceil(average(framesNeededSamples$1));
|
|
5310
|
+
trackFace(face, framesNeeded);
|
|
5311
|
+
faceIsStable = lastNFaces.length >= framesNeeded && !createPairs(lastNFaces, 12).some(function (_a) {
|
|
5312
|
+
var a = _a[0],
|
|
5313
|
+
b = _a[1];
|
|
5314
|
+
return calculateIoU(a.box, b.box) < stabilityThreshold;
|
|
5315
|
+
});
|
|
5316
|
+
}
|
|
5317
|
+
var faceReady = faceInGuides && faceIsStable;
|
|
5318
|
+
return {
|
|
5319
|
+
face: face,
|
|
5320
|
+
faceNotDetected: faceNotDetected,
|
|
5321
|
+
faceNotCentered: faceNotCentered,
|
|
5322
|
+
faceLookingAway: faceLookingAway,
|
|
5323
|
+
faceTooClose: faceTooClose,
|
|
5324
|
+
faceTooFar: faceTooFar,
|
|
5325
|
+
faceReady: faceReady,
|
|
5326
|
+
faceReadyAt: faceReady ? new Date() : null,
|
|
5327
|
+
faceIsStable: faceIsStable
|
|
5328
|
+
};
|
|
5329
|
+
}
|
|
5216
5330
|
|
|
5217
5331
|
var preloadModels = function preloadModels(_a) {
|
|
5218
5332
|
return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
@@ -5689,6 +5803,9 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5689
5803
|
// If either the left side visible or if not, right edge of ID should be more than 80% of width.
|
|
5690
5804
|
xMin + width + boundaryRight < frameWidth; // Valid right edge if it's less than video width.
|
|
5691
5805
|
}
|
|
5806
|
+
if (lastDetectionTime > 0) {
|
|
5807
|
+
trackFramesNeeded(1000 / lastDetectionTime);
|
|
5808
|
+
}
|
|
5692
5809
|
var documentIsStable = false;
|
|
5693
5810
|
var documentTooClose = false;
|
|
5694
5811
|
if (bestDocument) {
|
|
@@ -5698,7 +5815,6 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5698
5815
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
5699
5816
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
5700
5817
|
var threshold_1 = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
|
|
5701
|
-
trackFramesNeeded(1000 / lastDetectionTime);
|
|
5702
5818
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
5703
5819
|
trackBox(bestDocument.box, framesNeeded);
|
|
5704
5820
|
documentIsStable = lastNBoxes.length >= framesNeeded && !createPairs(lastNBoxes, 12).some(function (_a) {
|
|
@@ -5743,36 +5859,6 @@ function applyNonMaxSuppression(detectedObjects) {
|
|
|
5743
5859
|
return !!obj;
|
|
5744
5860
|
});
|
|
5745
5861
|
}
|
|
5746
|
-
function createPairs(arr, maxPairs) {
|
|
5747
|
-
var pairs = [];
|
|
5748
|
-
var len = arr.length - 1;
|
|
5749
|
-
var end = Math.min(maxPairs , len);
|
|
5750
|
-
for (var i = 0; i < end; i++) {
|
|
5751
|
-
pairs.push([arr[i], arr[i + 1]]);
|
|
5752
|
-
}
|
|
5753
|
-
return pairs;
|
|
5754
|
-
}
|
|
5755
|
-
function calculateIoU(boxA, boxB) {
|
|
5756
|
-
var xA = Math.max(boxA.xMin, boxB.xMin);
|
|
5757
|
-
var yA = Math.max(boxA.yMin, boxB.yMin);
|
|
5758
|
-
var xB = Math.min(boxA.xMax, boxB.xMax);
|
|
5759
|
-
var yB = Math.min(boxA.yMax, boxB.yMax);
|
|
5760
|
-
var intersectWidth = Math.max(0, xB - xA);
|
|
5761
|
-
var intersectHeight = Math.max(0, yB - yA);
|
|
5762
|
-
var intersectionArea = intersectWidth * intersectHeight;
|
|
5763
|
-
var boxAArea = (boxA.xMax - boxA.xMin) * (boxA.yMax - boxA.yMin);
|
|
5764
|
-
var boxBArea = (boxB.xMax - boxB.xMin) * (boxB.yMax - boxB.yMin);
|
|
5765
|
-
var unionArea = boxAArea + boxBArea - intersectionArea;
|
|
5766
|
-
if (unionArea === 0) return 0;
|
|
5767
|
-
return intersectionArea / unionArea;
|
|
5768
|
-
}
|
|
5769
|
-
function average(arr) {
|
|
5770
|
-
var len = arr.length;
|
|
5771
|
-
if (len === 0) return 0;
|
|
5772
|
-
var sum = 0;
|
|
5773
|
-
for (var i = 0; i < len; i++) sum += arr[i];
|
|
5774
|
-
return sum / len;
|
|
5775
|
-
}
|
|
5776
5862
|
|
|
5777
5863
|
function useFrameLoop(fn, _a) {
|
|
5778
5864
|
var _b = _a.throttleMs,
|
|
@@ -11239,24 +11325,26 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11239
11325
|
throttleMs = _a.throttleMs,
|
|
11240
11326
|
onModelError = _a.onModelError,
|
|
11241
11327
|
_c = _a.modelLoadTimeoutMs,
|
|
11242
|
-
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11328
|
+
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
|
|
11329
|
+
_d = _a.requireVerticalFaceCentering,
|
|
11330
|
+
requireVerticalFaceCentering = _d === void 0 ? true : _d;
|
|
11331
|
+
var _e = React.useContext(CameraStateContext),
|
|
11332
|
+
videoRef = _e.videoRef,
|
|
11333
|
+
videoLoaded = _e.videoLoaded,
|
|
11334
|
+
cameraReady = _e.cameraReady;
|
|
11247
11335
|
var canvasRef = React.useRef(null);
|
|
11248
11336
|
var onPredictionHandler = React.useRef();
|
|
11249
|
-
var
|
|
11337
|
+
var _f = useLoadFaceDetector({
|
|
11250
11338
|
onModelError: onModelError,
|
|
11251
11339
|
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
11252
11340
|
}),
|
|
11253
|
-
detector =
|
|
11254
|
-
ready =
|
|
11255
|
-
modelDownloadProgress =
|
|
11256
|
-
modelError =
|
|
11257
|
-
var
|
|
11341
|
+
detector = _f.detector,
|
|
11342
|
+
ready = _f.ready,
|
|
11343
|
+
modelDownloadProgress = _f.modelDownloadProgress,
|
|
11344
|
+
modelError = _f.modelError;
|
|
11345
|
+
var _g = useFrameLoop(React.useCallback(function () {
|
|
11258
11346
|
return __awaiter(_this, void 0, void 0, function () {
|
|
11259
|
-
var vw, vh, ctx, faces, e_1;
|
|
11347
|
+
var vw, vh, ctx, faces, processed, e_1;
|
|
11260
11348
|
var _a;
|
|
11261
11349
|
return __generator(this, function (_b) {
|
|
11262
11350
|
switch (_b.label) {
|
|
@@ -11275,7 +11363,14 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11275
11363
|
case 1:
|
|
11276
11364
|
_b.trys.push([1, 3,, 4]);
|
|
11277
11365
|
faces = makeFaceDetectorPrediction(detector.current, canvasRef.current).faces;
|
|
11278
|
-
|
|
11366
|
+
processed = processFaceDetectorPrediction({
|
|
11367
|
+
faces: faces,
|
|
11368
|
+
videoWidth: vw,
|
|
11369
|
+
videoHeight: vh,
|
|
11370
|
+
requireVerticalFaceCentering: requireVerticalFaceCentering
|
|
11371
|
+
});
|
|
11372
|
+
setLastFaceDetectionAt(new Date().getTime());
|
|
11373
|
+
return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processed)];
|
|
11279
11374
|
case 2:
|
|
11280
11375
|
_b.sent();
|
|
11281
11376
|
return [3 /*break*/, 4];
|
|
@@ -11292,8 +11387,8 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11292
11387
|
throttleMs: throttleMs,
|
|
11293
11388
|
autoStart: autoStart
|
|
11294
11389
|
}),
|
|
11295
|
-
start =
|
|
11296
|
-
stop =
|
|
11390
|
+
start = _g.start,
|
|
11391
|
+
stop = _g.stop;
|
|
11297
11392
|
var onPredictionMade = React.useCallback(function (handler) {
|
|
11298
11393
|
onPredictionHandler.current = handler;
|
|
11299
11394
|
}, []);
|
|
@@ -11516,75 +11611,18 @@ var StyledButtonsRow$7 = styled__default.default(ButtonsRow)(templateObject_5$4
|
|
|
11516
11611
|
var templateObject_1$i, templateObject_2$g, templateObject_3$d, templateObject_4$8, templateObject_5$4;
|
|
11517
11612
|
|
|
11518
11613
|
var initialState$3 = {
|
|
11519
|
-
videoWidth: 0,
|
|
11520
|
-
videoHeight: 0,
|
|
11521
|
-
requireVerticalFaceCentering: true,
|
|
11522
11614
|
busy: false,
|
|
11523
11615
|
frame: null,
|
|
11524
|
-
|
|
11525
|
-
faceNotDetected: false,
|
|
11526
|
-
faceNotCentered: false,
|
|
11527
|
-
faceLookingAway: false,
|
|
11528
|
-
faceTooClose: false,
|
|
11529
|
-
faceTooFar: false,
|
|
11530
|
-
faceReady: false,
|
|
11531
|
-
faceReadyAt: null
|
|
11616
|
+
prediction: null
|
|
11532
11617
|
};
|
|
11533
11618
|
var reducer$3 = function reducer(state, action) {
|
|
11534
11619
|
switch (action.type) {
|
|
11535
|
-
case 'configure':
|
|
11536
|
-
return _assign(_assign({}, state), action.payload);
|
|
11537
11620
|
case 'facesDetected':
|
|
11538
11621
|
{
|
|
11539
11622
|
if (state.busy) return state;
|
|
11540
|
-
var faces = action.payload.faces;
|
|
11541
|
-
var face = faces[0];
|
|
11542
|
-
var faceNotDetected = faces.length === 0;
|
|
11543
|
-
var faceNotCentered = state.requireVerticalFaceCentering,
|
|
11544
|
-
faceLookingAway = false,
|
|
11545
|
-
faceTooClose = false,
|
|
11546
|
-
faceTooFar = false,
|
|
11547
|
-
faceReadyAt = state.faceReadyAt;
|
|
11548
|
-
if (face) {
|
|
11549
|
-
// calculate centroids
|
|
11550
|
-
var vCX = state.videoWidth / 2;
|
|
11551
|
-
var vCY = state.videoHeight / 2;
|
|
11552
|
-
var fCX = (face.box.xMin + face.box.xMax) / 2;
|
|
11553
|
-
var fCY = (face.box.yMin + face.box.yMax) / 2;
|
|
11554
|
-
// calculate thresholds
|
|
11555
|
-
var vTX = state.videoWidth * 0.125;
|
|
11556
|
-
var vTY = state.videoHeight * 0.125;
|
|
11557
|
-
var fTW = face.box.width * 0.2;
|
|
11558
|
-
var fTH = face.box.height * 0.2;
|
|
11559
|
-
var nose = face.keypoints[2]; //.find((k) => k.name === 'noseTip')
|
|
11560
|
-
if (nose) {
|
|
11561
|
-
faceLookingAway = Math.abs(fCX - nose.x) > fTW || Math.abs(fCY - nose.y) > fTH;
|
|
11562
|
-
var faceNotCenteredHorizontally = Math.abs(vCX - fCX) > vTX;
|
|
11563
|
-
var faceNotCenteredVertically = Math.abs(vCY + 50 - fCY) > vTY;
|
|
11564
|
-
faceNotCentered = faceNotCenteredHorizontally || state.requireVerticalFaceCentering && faceNotCenteredVertically;
|
|
11565
|
-
}
|
|
11566
|
-
var isMobile = state.videoWidth < state.videoHeight;
|
|
11567
|
-
var tooCloseMultiple = isMobile ? 2 : 4.5;
|
|
11568
|
-
var tooFarMultiple = isMobile ? 6 : 7;
|
|
11569
|
-
faceTooClose = face.box.width > state.videoWidth / tooCloseMultiple;
|
|
11570
|
-
faceTooFar = face.box.width < state.videoWidth / tooFarMultiple;
|
|
11571
|
-
}
|
|
11572
|
-
var faceReady = !faceNotDetected && !faceNotCentered && !faceLookingAway && !faceTooClose && !faceTooFar;
|
|
11573
|
-
if (!faceReady) {
|
|
11574
|
-
faceReadyAt = null;
|
|
11575
|
-
} else if (!state.faceReady) {
|
|
11576
|
-
faceReadyAt = new Date();
|
|
11577
|
-
}
|
|
11578
11623
|
return _assign(_assign({}, state), {
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
faceNotCentered: faceNotCentered,
|
|
11582
|
-
faceLookingAway: faceLookingAway,
|
|
11583
|
-
faceTooClose: faceTooClose,
|
|
11584
|
-
faceTooFar: faceTooFar,
|
|
11585
|
-
faceReady: faceReady,
|
|
11586
|
-
faceReadyAt: faceReadyAt,
|
|
11587
|
-
busy: faceReady
|
|
11624
|
+
prediction: action.payload,
|
|
11625
|
+
busy: action.payload.faceReady
|
|
11588
11626
|
});
|
|
11589
11627
|
}
|
|
11590
11628
|
case 'captureStarted':
|
|
@@ -11598,79 +11636,64 @@ var reducer$3 = function reducer(state, action) {
|
|
|
11598
11636
|
}
|
|
11599
11637
|
};
|
|
11600
11638
|
var SelfieCapture = function SelfieCapture(_a) {
|
|
11601
|
-
var _b;
|
|
11639
|
+
var _b, _c, _d, _e, _f, _g;
|
|
11602
11640
|
var onGuidanceSatisfied = _a.onGuidanceSatisfied,
|
|
11603
11641
|
onGuidanceNotSatisfied = _a.onGuidanceNotSatisfied,
|
|
11604
11642
|
onSelfieCaptureStarted = _a.onSelfieCaptureStarted,
|
|
11605
11643
|
onSelfieCaptured = _a.onSelfieCaptured,
|
|
11606
11644
|
onTimeout = _a.onTimeout,
|
|
11607
11645
|
onExit = _a.onExit,
|
|
11608
|
-
|
|
11609
|
-
timeoutDurationMs =
|
|
11646
|
+
_h = _a.timeoutDurationMs,
|
|
11647
|
+
timeoutDurationMs = _h === void 0 ? 15000 : _h,
|
|
11610
11648
|
guidanceMessage = _a.guidanceMessage,
|
|
11611
11649
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
11612
11650
|
guidesComponent = _a.guidesComponent,
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11628
|
-
|
|
11629
|
-
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
dispatch =
|
|
11651
|
+
_j = _a.shouldCapture,
|
|
11652
|
+
shouldCapture = _j === void 0 ? true : _j,
|
|
11653
|
+
_k = _a.classNames,
|
|
11654
|
+
classNames = _k === void 0 ? {} : _k,
|
|
11655
|
+
_l = _a.colors,
|
|
11656
|
+
colors = _l === void 0 ? {} : _l,
|
|
11657
|
+
_m = _a.verbiage,
|
|
11658
|
+
rawVerbiage = _m === void 0 ? {} : _m,
|
|
11659
|
+
_o = _a.debugMode,
|
|
11660
|
+
debugMode = _o === void 0 ? false : _o;
|
|
11661
|
+
var _p = useResizeObserver__default.default(),
|
|
11662
|
+
ref = _p.ref,
|
|
11663
|
+
_q = _p.width,
|
|
11664
|
+
width = _q === void 0 ? 1 : _q,
|
|
11665
|
+
_r = _p.height,
|
|
11666
|
+
height = _r === void 0 ? 1 : _r;
|
|
11667
|
+
var _s = React.useReducer(reducer$3, initialState$3),
|
|
11668
|
+
_t = _s[0],
|
|
11669
|
+
busy = _t.busy,
|
|
11670
|
+
prediction = _t.prediction,
|
|
11671
|
+
dispatch = _s[1];
|
|
11634
11672
|
var lastPredictionCanvas = React.useRef(null);
|
|
11635
|
-
var
|
|
11636
|
-
cameraRef =
|
|
11637
|
-
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
|
|
11642
|
-
guidanceError = _q.error;
|
|
11643
|
-
React.useEffect(function () {
|
|
11644
|
-
if (cameraReady && videoRef.current && videoRef.current.videoWidth !== 0) {
|
|
11645
|
-
dispatch({
|
|
11646
|
-
type: 'configure',
|
|
11647
|
-
payload: {
|
|
11648
|
-
videoWidth: videoRef.current.videoWidth,
|
|
11649
|
-
videoHeight: videoRef.current.videoHeight,
|
|
11650
|
-
requireVerticalFaceCentering: requireVerticalFaceCentering
|
|
11651
|
-
}
|
|
11652
|
-
});
|
|
11653
|
-
}
|
|
11654
|
-
}, [cameraReady, requireVerticalFaceCentering, videoRef]);
|
|
11673
|
+
var _u = React.useContext(CameraStateContext),
|
|
11674
|
+
cameraRef = _u.cameraRef,
|
|
11675
|
+
videoRef = _u.videoRef;
|
|
11676
|
+
var _v = React.useContext(SelfieGuidanceModelsContext),
|
|
11677
|
+
onPredictionMade = _v.onPredictionMade,
|
|
11678
|
+
canvasRef = _v.canvasRef,
|
|
11679
|
+
guidanceError = _v.error;
|
|
11655
11680
|
onPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (prediction) {
|
|
11656
11681
|
return new Promise(function (resolve) {
|
|
11657
|
-
if (shouldCapture && !
|
|
11682
|
+
if (shouldCapture && !busy) {
|
|
11658
11683
|
drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
|
|
11659
11684
|
dispatch({
|
|
11660
11685
|
type: 'facesDetected',
|
|
11661
|
-
payload:
|
|
11662
|
-
faces: prediction
|
|
11663
|
-
}
|
|
11686
|
+
payload: prediction
|
|
11664
11687
|
});
|
|
11665
11688
|
}
|
|
11666
11689
|
resolve();
|
|
11667
11690
|
});
|
|
11668
|
-
}, [canvasRef, shouldCapture,
|
|
11691
|
+
}, [canvasRef, shouldCapture, busy]), 16));
|
|
11669
11692
|
React.useEffect(function () {
|
|
11670
|
-
|
|
11671
|
-
}, [onGuidanceNotSatisfied, onGuidanceSatisfied,
|
|
11693
|
+
(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) ? onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied() : onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
|
|
11694
|
+
}, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
|
|
11672
11695
|
React.useEffect(function () {
|
|
11673
|
-
if (!
|
|
11696
|
+
if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
|
|
11674
11697
|
var timer = setTimeout(function () {
|
|
11675
11698
|
dispatch({
|
|
11676
11699
|
type: 'captureStarted'
|
|
@@ -11681,7 +11704,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11681
11704
|
var ctx = frame.getContext('2d');
|
|
11682
11705
|
if (!ctx) return;
|
|
11683
11706
|
var imageData = ctx.getImageData(0, 0, frame.width, frame.height);
|
|
11684
|
-
onSelfieCaptured === null || onSelfieCaptured === void 0 ? void 0 : onSelfieCaptured(imageData,
|
|
11707
|
+
onSelfieCaptured === null || onSelfieCaptured === void 0 ? void 0 : onSelfieCaptured(imageData, prediction.face);
|
|
11685
11708
|
clearCanvas(frame);
|
|
11686
11709
|
dispatch({
|
|
11687
11710
|
type: 'captureCompleted'
|
|
@@ -11690,16 +11713,16 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11690
11713
|
return function () {
|
|
11691
11714
|
if (timer) clearTimeout(timer);
|
|
11692
11715
|
};
|
|
11693
|
-
}, [onSelfieCaptureStarted, onSelfieCaptured,
|
|
11694
|
-
var
|
|
11695
|
-
timedOut =
|
|
11696
|
-
timeoutStartedAt =
|
|
11716
|
+
}, [onSelfieCaptureStarted, onSelfieCaptured, prediction]);
|
|
11717
|
+
var _w = useTimeout(timeoutDurationMs, onTimeout),
|
|
11718
|
+
timedOut = _w.timedOut,
|
|
11719
|
+
timeoutStartedAt = _w.timeoutStartedAt;
|
|
11697
11720
|
var debugScalingDetails = useDebugScalingDetails({
|
|
11698
11721
|
enabled: debugMode,
|
|
11699
11722
|
pageWidth: width,
|
|
11700
11723
|
pageHeight: height,
|
|
11701
|
-
videoWidth:
|
|
11702
|
-
videoHeight:
|
|
11724
|
+
videoWidth: (_c = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) !== null && _c !== void 0 ? _c : 0,
|
|
11725
|
+
videoHeight: (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0
|
|
11703
11726
|
});
|
|
11704
11727
|
colors.guidesUnsatisfiedColor || (colors.guidesUnsatisfiedColor = 'white');
|
|
11705
11728
|
colors.guidesSatisfiedColor || (colors.guidesSatisfiedColor = 'green');
|
|
@@ -11709,11 +11732,12 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11709
11732
|
guidanceMoveBackText: 'Move back...',
|
|
11710
11733
|
guidanceMoveForwardText: 'Move forward...',
|
|
11711
11734
|
guidanceMoveToCenterText: 'Move to the center...',
|
|
11712
|
-
guidanceNoFaceDetectedText: 'Waiting for face to be detected...'
|
|
11735
|
+
guidanceNoFaceDetectedText: 'Waiting for face to be detected...',
|
|
11736
|
+
guidanceNotStableText: 'Please hold still...'
|
|
11713
11737
|
});
|
|
11714
|
-
var satisfied =
|
|
11738
|
+
var satisfied = (_f = prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) !== null && _f !== void 0 ? _f : false;
|
|
11715
11739
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
11716
|
-
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceHoldStillText :
|
|
11740
|
+
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceHoldStillText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? verbiage.guidanceLookStraightText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? verbiage.guidanceMoveBackText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? verbiage.guidanceMoveForwardText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? verbiage.guidanceMoveToCenterText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceNotDetected) ? verbiage.guidanceNoFaceDetectedText : !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? verbiage.guidanceNotStableText : '');
|
|
11717
11741
|
if (guidanceError) {
|
|
11718
11742
|
return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFallback, {
|
|
11719
11743
|
classNames: classNames.fallback
|
|
@@ -11722,7 +11746,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11722
11746
|
var GuidesComponent = guidesComponent !== null && guidesComponent !== void 0 ? guidesComponent : FaceCaptureGuideOverlay;
|
|
11723
11747
|
return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
|
|
11724
11748
|
ref: ref,
|
|
11725
|
-
className: "flex ".concat((
|
|
11749
|
+
className: "flex ".concat((_g = classNames.container) !== null && _g !== void 0 ? _g : '')
|
|
11726
11750
|
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
11727
11751
|
ref: lastPredictionCanvas
|
|
11728
11752
|
}), /*#__PURE__*/React__namespace.default.createElement(GuidesComponent, {
|
|
@@ -11733,14 +11757,11 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
11733
11757
|
}, /*#__PURE__*/React__namespace.default.createElement(GuidanceMessage, {
|
|
11734
11758
|
"$variant": satisfied ? 'positive' : 'negative',
|
|
11735
11759
|
className: classNames.guidanceMessage
|
|
11736
|
-
}, guidanceMessage))), debugMode &&
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
|
|
11740
|
-
|
|
11741
|
-
color: satisfied ? 'green' : 'red'
|
|
11742
|
-
});
|
|
11743
|
-
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), !state.faceNotCentered ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__namespace.default.createElement("br", null), !state.faceTooClose && !state.faceTooFar ? '✅' : '❌', " Face", ' ', state.faceTooClose ? 'Too Close' : state.faceTooFar ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__namespace.default.createElement("br", null), !state.faceLookingAway ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__namespace.default.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
|
|
11760
|
+
}, guidanceMessage))), debugMode && (prediction === null || prediction === void 0 ? void 0 : prediction.face) && ( /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, null, /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceDebugBox, {
|
|
11761
|
+
face: prediction.face,
|
|
11762
|
+
scaling: debugScalingDetails,
|
|
11763
|
+
color: satisfied ? 'green' : 'red'
|
|
11764
|
+
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) && !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? '✅' : '❌', ' ', "Face", ' ', (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? 'Too Close' : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? '✅' : '❌', " Face Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
|
|
11744
11765
|
onClick: onExit,
|
|
11745
11766
|
className: classNames.exitCaptureBtn
|
|
11746
11767
|
}));
|
|
@@ -11854,25 +11875,23 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
11854
11875
|
silentFallback = _g === void 0 ? false : _g,
|
|
11855
11876
|
guidesComponent = _a.guidesComponent,
|
|
11856
11877
|
disableCapturePreview = _a.disableCapturePreview,
|
|
11857
|
-
_h = _a.
|
|
11858
|
-
|
|
11859
|
-
_j = _a.
|
|
11860
|
-
|
|
11861
|
-
_k = _a.
|
|
11862
|
-
|
|
11863
|
-
_l = _a.verbiage,
|
|
11864
|
-
rawVerbiage = _l === void 0 ? {} : _l,
|
|
11878
|
+
_h = _a.classNames,
|
|
11879
|
+
classNames = _h === void 0 ? {} : _h,
|
|
11880
|
+
_j = _a.colors,
|
|
11881
|
+
colors = _j === void 0 ? {} : _j,
|
|
11882
|
+
_k = _a.verbiage,
|
|
11883
|
+
rawVerbiage = _k === void 0 ? {} : _k,
|
|
11865
11884
|
debugMode = _a.debugMode;
|
|
11866
|
-
var
|
|
11867
|
-
checkLiveness =
|
|
11868
|
-
submissionError =
|
|
11885
|
+
var _l = React.useContext(SubmissionContext),
|
|
11886
|
+
checkLiveness = _l.checkLiveness,
|
|
11887
|
+
submissionError = _l.submissionError;
|
|
11869
11888
|
var modelError = React.useContext(SelfieGuidanceModelsContext).error;
|
|
11870
|
-
var
|
|
11871
|
-
state =
|
|
11872
|
-
dispatch =
|
|
11873
|
-
var
|
|
11874
|
-
imageUrl =
|
|
11875
|
-
setImageUrl =
|
|
11889
|
+
var _m = React.useReducer(reducer$2, initialState$2),
|
|
11890
|
+
state = _m[0],
|
|
11891
|
+
dispatch = _m[1];
|
|
11892
|
+
var _o = React.useState(null),
|
|
11893
|
+
imageUrl = _o[0],
|
|
11894
|
+
setImageUrl = _o[1];
|
|
11876
11895
|
var rawCanvas = React.useRef(null);
|
|
11877
11896
|
var cropCanvas = React.useRef(null);
|
|
11878
11897
|
var resizeCanvas = React.useRef(null);
|
|
@@ -12064,7 +12083,6 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
12064
12083
|
onGuidanceSatisfied: onGuidanceSatisfied,
|
|
12065
12084
|
onGuidanceNotSatisfied: onGuidanceNotSatisfied,
|
|
12066
12085
|
guidesComponent: guidesByRequestState,
|
|
12067
|
-
requireVerticalFaceCentering: requireVerticalFaceCentering,
|
|
12068
12086
|
classNames: classNames,
|
|
12069
12087
|
colors: colors,
|
|
12070
12088
|
verbiage: verbiage,
|
|
@@ -12521,42 +12539,40 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
12521
12539
|
silentFallback = _l === void 0 ? false : _l,
|
|
12522
12540
|
guidesComponent = _a.guidesComponent,
|
|
12523
12541
|
disableCapturePreview = _a.disableCapturePreview,
|
|
12524
|
-
_m = _a.
|
|
12525
|
-
|
|
12526
|
-
_o = _a.
|
|
12527
|
-
|
|
12528
|
-
_p = _a.
|
|
12529
|
-
|
|
12530
|
-
_q = _a.
|
|
12531
|
-
|
|
12532
|
-
_r = _a.
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
captureState = _x[0],
|
|
12553
|
-
setCaptureState = _x[1];
|
|
12542
|
+
_m = _a.assets,
|
|
12543
|
+
assets = _m === void 0 ? {} : _m,
|
|
12544
|
+
_o = _a.classNames,
|
|
12545
|
+
classNames = _o === void 0 ? {} : _o,
|
|
12546
|
+
_p = _a.colors,
|
|
12547
|
+
colors = _p === void 0 ? {} : _p,
|
|
12548
|
+
_q = _a.verbiage,
|
|
12549
|
+
verbiage = _q === void 0 ? {} : _q,
|
|
12550
|
+
_r = _a.debugMode,
|
|
12551
|
+
debugMode = _r === void 0 ? false : _r;
|
|
12552
|
+
var _s = React.useContext(SubmissionContext),
|
|
12553
|
+
submissionResponse = _s.submissionResponse,
|
|
12554
|
+
livenessCheckRequest = _s.livenessCheckRequest,
|
|
12555
|
+
setSelfieImage = _s.setSelfieImage,
|
|
12556
|
+
logSelfieCaptureAttempt = _s.logSelfieCaptureAttempt;
|
|
12557
|
+
var _t = React.useContext(CameraStateContext),
|
|
12558
|
+
cameraAccessDenied = _t.cameraAccessDenied,
|
|
12559
|
+
requestCameraAccess = _t.requestCameraAccess,
|
|
12560
|
+
releaseCameraAccess = _t.releaseCameraAccess;
|
|
12561
|
+
var _u = React.useState(''),
|
|
12562
|
+
faceCropImageUrl = _u[0],
|
|
12563
|
+
setFaceCropImageUrl = _u[1];
|
|
12564
|
+
var _v = React.useState(0),
|
|
12565
|
+
retryCount = _v[0],
|
|
12566
|
+
setRetryCount = _v[1];
|
|
12567
|
+
var _w = React.useState('LOADING'),
|
|
12568
|
+
captureState = _w[0],
|
|
12569
|
+
setCaptureState = _w[1];
|
|
12554
12570
|
var captureStartedAt = React.useRef();
|
|
12555
12571
|
var captureEndedAt = React.useRef();
|
|
12556
12572
|
var operationStartedAt = React.useRef();
|
|
12557
|
-
var
|
|
12558
|
-
start =
|
|
12559
|
-
stop =
|
|
12573
|
+
var _x = React.useContext(SelfieGuidanceModelsContext),
|
|
12574
|
+
start = _x.start,
|
|
12575
|
+
stop = _x.stop;
|
|
12560
12576
|
React.useEffect(function () {
|
|
12561
12577
|
operationStartedAt.current = new Date();
|
|
12562
12578
|
}, []);
|
|
@@ -12604,9 +12620,9 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
12604
12620
|
setCaptureState('FAILED');
|
|
12605
12621
|
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(submissionResponse, livenessCheckRequest);
|
|
12606
12622
|
}, [onTimeout, livenessCheckRequest, submissionResponse]);
|
|
12607
|
-
var
|
|
12608
|
-
attempt =
|
|
12609
|
-
setAttempt =
|
|
12623
|
+
var _y = React.useState(0),
|
|
12624
|
+
attempt = _y[0],
|
|
12625
|
+
setAttempt = _y[1];
|
|
12610
12626
|
var onExitCallback = React.useCallback(function () {
|
|
12611
12627
|
setAttempt(function (n) {
|
|
12612
12628
|
return n + 1;
|
|
@@ -12670,7 +12686,6 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
12670
12686
|
silentFallback: silentFallback,
|
|
12671
12687
|
guidesComponent: guidesComponent,
|
|
12672
12688
|
disableCapturePreview: disableCapturePreview,
|
|
12673
|
-
requireVerticalFaceCentering: requireVerticalFaceCentering,
|
|
12674
12689
|
classNames: classNames.capture,
|
|
12675
12690
|
colors: colors,
|
|
12676
12691
|
verbiage: verbiage,
|
|
@@ -13525,9 +13540,10 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
13525
13540
|
numFramesWithoutFaces = _k[0],
|
|
13526
13541
|
setNumFramesWithoutFaces = _k[1];
|
|
13527
13542
|
React.useEffect(function () {
|
|
13528
|
-
onPredictionMade(function (
|
|
13529
|
-
|
|
13530
|
-
|
|
13543
|
+
onPredictionMade(function (_a) {
|
|
13544
|
+
var face = _a.face;
|
|
13545
|
+
setNumFramesWithoutFaces(face ? 0 : function (n) {
|
|
13546
|
+
return n + 1;
|
|
13531
13547
|
});
|
|
13532
13548
|
});
|
|
13533
13549
|
}, [onPredictionMade]);
|
|
@@ -13757,7 +13773,6 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
13757
13773
|
onSuccess: onFaceCaptureSuccess,
|
|
13758
13774
|
onExit: onExit,
|
|
13759
13775
|
guidesComponent: guidesComponent,
|
|
13760
|
-
requireVerticalFaceCentering: false,
|
|
13761
13776
|
classNames: classNames.faceLiveness,
|
|
13762
13777
|
colors: colors.faceLiveness,
|
|
13763
13778
|
verbiage: verbiage.faceLiveness,
|
|
@@ -14052,99 +14067,99 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
14052
14067
|
flipShortcutThreshold: 0.7
|
|
14053
14068
|
};
|
|
14054
14069
|
var IdVideoCapture = function IdVideoCapture(_a) {
|
|
14055
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w
|
|
14070
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
14056
14071
|
var onComplete = _a.onComplete,
|
|
14057
14072
|
onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
|
|
14058
14073
|
onIdBackImageCaptured = _a.onIdBackImageCaptured,
|
|
14059
14074
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
14060
14075
|
onRecordingFailed = _a.onRecordingFailed,
|
|
14061
14076
|
onExitCapture = _a.onExitCapture,
|
|
14062
|
-
|
|
14063
|
-
idCaptureModelsEnabled =
|
|
14064
|
-
|
|
14065
|
-
idCardCaptureGuideImages =
|
|
14066
|
-
|
|
14067
|
-
idCardFrontDelay =
|
|
14068
|
-
|
|
14069
|
-
videoIdCaptureThresholds =
|
|
14070
|
-
|
|
14071
|
-
skipShowIdCardBack =
|
|
14072
|
-
|
|
14073
|
-
captureCountdownSeconds =
|
|
14077
|
+
_x = _a.idCaptureModelsEnabled,
|
|
14078
|
+
idCaptureModelsEnabled = _x === void 0 ? true : _x,
|
|
14079
|
+
_y = _a.idCardCaptureGuideImages,
|
|
14080
|
+
idCardCaptureGuideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
|
|
14081
|
+
_z = _a.idCardFrontDelay,
|
|
14082
|
+
idCardFrontDelay = _z === void 0 ? 1000 : _z,
|
|
14083
|
+
_0 = _a.videoIdCaptureThresholds,
|
|
14084
|
+
videoIdCaptureThresholds = _0 === void 0 ? defaultVideoIdCaptureThresholds : _0,
|
|
14085
|
+
_1 = _a.skipShowIdCardBack,
|
|
14086
|
+
skipShowIdCardBack = _1 === void 0 ? false : _1,
|
|
14087
|
+
_2 = _a.captureCountdownSeconds,
|
|
14088
|
+
captureCountdownSeconds = _2 === void 0 ? 3 : _2,
|
|
14074
14089
|
readTextPrompt = _a.readTextPrompt,
|
|
14075
|
-
|
|
14076
|
-
readTextTimeoutDurationMs =
|
|
14077
|
-
|
|
14078
|
-
readTextMinReadingMs =
|
|
14079
|
-
|
|
14080
|
-
disableFaceDetectionWhileAudioCapture =
|
|
14081
|
-
|
|
14082
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
14083
|
-
|
|
14084
|
-
mergeAVStreams =
|
|
14085
|
-
|
|
14086
|
-
classNames =
|
|
14087
|
-
|
|
14088
|
-
colors =
|
|
14089
|
-
|
|
14090
|
-
rawVerbiage =
|
|
14091
|
-
|
|
14092
|
-
debugMode =
|
|
14093
|
-
var
|
|
14094
|
-
ref =
|
|
14095
|
-
|
|
14096
|
-
width =
|
|
14097
|
-
|
|
14098
|
-
height =
|
|
14099
|
-
var
|
|
14100
|
-
cameraRef =
|
|
14101
|
-
videoRef =
|
|
14102
|
-
videoLoaded =
|
|
14103
|
-
cameraReady =
|
|
14104
|
-
microphoneReady =
|
|
14105
|
-
audioStream =
|
|
14106
|
-
setVideoLoaded =
|
|
14107
|
-
var
|
|
14108
|
-
detectedObjects =
|
|
14109
|
-
setDetectedObjects =
|
|
14110
|
-
var
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
var
|
|
14114
|
-
idModelsReady =
|
|
14115
|
-
startIdModels =
|
|
14116
|
-
stopIdModels =
|
|
14117
|
-
onIdPredictionMade =
|
|
14118
|
-
setThresholds =
|
|
14119
|
-
setDocumentDetectionBoundaries =
|
|
14120
|
-
bestFrameDetails =
|
|
14121
|
-
resetBestFrame =
|
|
14122
|
-
idModelError =
|
|
14123
|
-
var
|
|
14124
|
-
videoStartsAt =
|
|
14125
|
-
setVideoStartsAt =
|
|
14126
|
-
var
|
|
14127
|
-
setIdCaptureVideoAudioStartsAt =
|
|
14128
|
-
setExpectedAudioText =
|
|
14129
|
-
var
|
|
14130
|
-
startSelfieGuidance =
|
|
14131
|
-
stopSelfieGuidance =
|
|
14132
|
-
onSelfiePredictionMade =
|
|
14133
|
-
selfieModelError =
|
|
14134
|
-
var
|
|
14135
|
-
isRecordingVideo =
|
|
14136
|
-
startRecordingVideo =
|
|
14137
|
-
startRecordingAudio =
|
|
14138
|
-
stopRecordingVideo =
|
|
14139
|
-
stopRecordingAudio =
|
|
14140
|
-
videoRecordingUnintentionallyStopped =
|
|
14141
|
-
audioRecordingUnintentionallyStopped =
|
|
14142
|
-
videoUrl =
|
|
14143
|
-
audioUrl =
|
|
14090
|
+
_3 = _a.readTextTimeoutDurationMs,
|
|
14091
|
+
readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
|
|
14092
|
+
_4 = _a.readTextMinReadingMs,
|
|
14093
|
+
readTextMinReadingMs = _4 === void 0 ? 10000 : _4,
|
|
14094
|
+
_5 = _a.disableFaceDetectionWhileAudioCapture,
|
|
14095
|
+
disableFaceDetectionWhileAudioCapture = _5 === void 0 ? false : _5,
|
|
14096
|
+
_6 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
14097
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _6 === void 0 ? 2000 : _6,
|
|
14098
|
+
_7 = _a.mergeAVStreams,
|
|
14099
|
+
mergeAVStreams = _7 === void 0 ? false : _7,
|
|
14100
|
+
_8 = _a.classNames,
|
|
14101
|
+
classNames = _8 === void 0 ? {} : _8,
|
|
14102
|
+
_9 = _a.colors,
|
|
14103
|
+
colors = _9 === void 0 ? {} : _9,
|
|
14104
|
+
_10 = _a.verbiage,
|
|
14105
|
+
rawVerbiage = _10 === void 0 ? {} : _10,
|
|
14106
|
+
_11 = _a.debugMode,
|
|
14107
|
+
debugMode = _11 === void 0 ? false : _11;
|
|
14108
|
+
var _12 = useResizeObserver__default.default(),
|
|
14109
|
+
ref = _12.ref,
|
|
14110
|
+
_13 = _12.width,
|
|
14111
|
+
width = _13 === void 0 ? 1 : _13,
|
|
14112
|
+
_14 = _12.height,
|
|
14113
|
+
height = _14 === void 0 ? 1 : _14;
|
|
14114
|
+
var _15 = React.useContext(CameraStateContext),
|
|
14115
|
+
cameraRef = _15.cameraRef,
|
|
14116
|
+
videoRef = _15.videoRef,
|
|
14117
|
+
videoLoaded = _15.videoLoaded,
|
|
14118
|
+
cameraReady = _15.cameraReady,
|
|
14119
|
+
microphoneReady = _15.microphoneReady,
|
|
14120
|
+
audioStream = _15.audioStream,
|
|
14121
|
+
setVideoLoaded = _15.setVideoLoaded;
|
|
14122
|
+
var _16 = React.useState([]),
|
|
14123
|
+
detectedObjects = _16[0],
|
|
14124
|
+
setDetectedObjects = _16[1];
|
|
14125
|
+
var _17 = React.useState(null),
|
|
14126
|
+
face = _17[0],
|
|
14127
|
+
setFace = _17[1];
|
|
14128
|
+
var _18 = React.useContext(IdCaptureModelsContext),
|
|
14129
|
+
idModelsReady = _18.ready,
|
|
14130
|
+
startIdModels = _18.start,
|
|
14131
|
+
stopIdModels = _18.stop,
|
|
14132
|
+
onIdPredictionMade = _18.onPredictionMade,
|
|
14133
|
+
setThresholds = _18.setThresholds,
|
|
14134
|
+
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
14135
|
+
bestFrameDetails = _18.bestFrameDetails,
|
|
14136
|
+
resetBestFrame = _18.resetBestFrame,
|
|
14137
|
+
idModelError = _18.modelError;
|
|
14138
|
+
var _19 = React.useState(null),
|
|
14139
|
+
videoStartsAt = _19[0],
|
|
14140
|
+
setVideoStartsAt = _19[1];
|
|
14141
|
+
var _20 = React.useContext(SubmissionContext),
|
|
14142
|
+
setIdCaptureVideoAudioStartsAt = _20.setIdCaptureVideoAudioStartsAt,
|
|
14143
|
+
setExpectedAudioText = _20.setExpectedAudioText;
|
|
14144
|
+
var _21 = React.useContext(SelfieGuidanceModelsContext),
|
|
14145
|
+
startSelfieGuidance = _21.start,
|
|
14146
|
+
stopSelfieGuidance = _21.stop,
|
|
14147
|
+
onSelfiePredictionMade = _21.onPredictionMade,
|
|
14148
|
+
selfieModelError = _21.error;
|
|
14149
|
+
var _22 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
|
|
14150
|
+
isRecordingVideo = _22.isRecordingVideo,
|
|
14151
|
+
startRecordingVideo = _22.startRecordingVideo,
|
|
14152
|
+
startRecordingAudio = _22.startRecordingAudio,
|
|
14153
|
+
stopRecordingVideo = _22.stopRecordingVideo,
|
|
14154
|
+
stopRecordingAudio = _22.stopRecordingAudio,
|
|
14155
|
+
videoRecordingUnintentionallyStopped = _22.videoRecordingUnintentionallyStopped,
|
|
14156
|
+
audioRecordingUnintentionallyStopped = _22.audioRecordingUnintentionallyStopped,
|
|
14157
|
+
videoUrl = _22.videoUrl,
|
|
14158
|
+
audioUrl = _22.audioUrl;
|
|
14144
14159
|
var countdownTimeoutRef = React.useRef(undefined);
|
|
14145
|
-
var
|
|
14146
|
-
countdownRemaining =
|
|
14147
|
-
setCountdownRemaining =
|
|
14160
|
+
var _23 = React.useState(-1),
|
|
14161
|
+
countdownRemaining = _23[0],
|
|
14162
|
+
setCountdownRemaining = _23[1];
|
|
14148
14163
|
React.useEffect(function () {
|
|
14149
14164
|
if (!isRecordingVideo && !videoUrl) {
|
|
14150
14165
|
startRecordingVideo();
|
|
@@ -14164,9 +14179,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14164
14179
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
14165
14180
|
}
|
|
14166
14181
|
}, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
|
|
14167
|
-
var
|
|
14168
|
-
requestedAction =
|
|
14169
|
-
setRequestedAction =
|
|
14182
|
+
var _24 = React.useState('SHOW_ID_FRONT'),
|
|
14183
|
+
requestedAction = _24[0],
|
|
14184
|
+
setRequestedAction = _24[1];
|
|
14170
14185
|
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
14171
14186
|
React.useEffect(function startModelsWhenCapturing() {
|
|
14172
14187
|
if (!shouldRunIdModels) return;
|
|
@@ -14186,15 +14201,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14186
14201
|
bottom: 1
|
|
14187
14202
|
});
|
|
14188
14203
|
}, [setDocumentDetectionBoundaries]);
|
|
14204
|
+
var _25 = React.useState(0),
|
|
14205
|
+
currentDetectionScore = _25[0],
|
|
14206
|
+
setCurrentDetectionScore = _25[1];
|
|
14189
14207
|
var _26 = React.useState(0),
|
|
14190
|
-
|
|
14191
|
-
|
|
14208
|
+
currentFocusScore = _26[0],
|
|
14209
|
+
setCurrentFocusScore = _26[1];
|
|
14192
14210
|
var _27 = React.useState(0),
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
var _28 = React.useState(0),
|
|
14196
|
-
goodFramesCount = _28[0],
|
|
14197
|
-
setGoodFramesCount = _28[1];
|
|
14211
|
+
goodFramesCount = _27[0],
|
|
14212
|
+
setGoodFramesCount = _27[1];
|
|
14198
14213
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
|
|
14199
14214
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
14200
14215
|
React.useEffect(function () {
|
|
@@ -14214,9 +14229,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14214
14229
|
} : 0);
|
|
14215
14230
|
});
|
|
14216
14231
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
|
|
14217
|
-
var
|
|
14218
|
-
idFrontCaptureStartedAt =
|
|
14219
|
-
setFirstGoodFrameTime =
|
|
14232
|
+
var _28 = React.useState(null),
|
|
14233
|
+
idFrontCaptureStartedAt = _28[0],
|
|
14234
|
+
setFirstGoodFrameTime = _28[1];
|
|
14220
14235
|
React.useEffect(function () {
|
|
14221
14236
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
14222
14237
|
}, [goodFramesCount]);
|
|
@@ -14235,11 +14250,11 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14235
14250
|
}, [setExpectedAudioText, setIdCaptureVideoAudioStartsAt, startRecordingAudio, stopRecordingVideo, translatedText, videoStartsAt]);
|
|
14236
14251
|
var frameWidth = (_c = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth) !== null && _c !== void 0 ? _c : 0;
|
|
14237
14252
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
14238
|
-
var faceBox =
|
|
14253
|
+
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
14239
14254
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
14240
|
-
var
|
|
14241
|
-
countdownStartedAt =
|
|
14242
|
-
setCountdownStartedAt =
|
|
14255
|
+
var _29 = React.useState(),
|
|
14256
|
+
countdownStartedAt = _29[0],
|
|
14257
|
+
setCountdownStartedAt = _29[1];
|
|
14243
14258
|
var photoCanvas = React.useRef(null);
|
|
14244
14259
|
var frameLock = React.useRef(false);
|
|
14245
14260
|
var captureFrame = React.useCallback(function () {
|
|
@@ -14362,14 +14377,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14362
14377
|
stopSelfieGuidance();
|
|
14363
14378
|
};
|
|
14364
14379
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
14365
|
-
var
|
|
14366
|
-
numFramesWithoutFaces =
|
|
14367
|
-
setNumFramesWithoutFaces =
|
|
14368
|
-
onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (
|
|
14380
|
+
var _30 = React.useState(0),
|
|
14381
|
+
numFramesWithoutFaces = _30[0],
|
|
14382
|
+
setNumFramesWithoutFaces = _30[1];
|
|
14383
|
+
onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
|
|
14384
|
+
var face = _a.face;
|
|
14369
14385
|
if (selfieModelError) return;
|
|
14370
|
-
|
|
14371
|
-
setNumFramesWithoutFaces(function (n) {
|
|
14372
|
-
return
|
|
14386
|
+
setFace(face);
|
|
14387
|
+
setNumFramesWithoutFaces(face ? 0 : function (n) {
|
|
14388
|
+
return n + 1;
|
|
14373
14389
|
});
|
|
14374
14390
|
}, [selfieModelError]), 16));
|
|
14375
14391
|
React.useEffect(function () {
|
|
@@ -14379,18 +14395,18 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14379
14395
|
}
|
|
14380
14396
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
14381
14397
|
var theme = styled.useTheme();
|
|
14382
|
-
var
|
|
14398
|
+
var _31 = useTranslations(rawVerbiage, {
|
|
14383
14399
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
14384
14400
|
captureBtnText: 'Capture'
|
|
14385
14401
|
}),
|
|
14386
|
-
captureBtnText =
|
|
14387
|
-
faceNotCenteredText =
|
|
14402
|
+
captureBtnText = _31.captureBtnText,
|
|
14403
|
+
faceNotCenteredText = _31.faceNotCenteredText;
|
|
14388
14404
|
var debugScalingDetails = useDebugScalingDetails({
|
|
14389
14405
|
enabled: debugMode,
|
|
14390
14406
|
pageWidth: width,
|
|
14391
14407
|
pageHeight: height,
|
|
14392
|
-
videoWidth: (
|
|
14393
|
-
videoHeight: (
|
|
14408
|
+
videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0,
|
|
14409
|
+
videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
|
|
14394
14410
|
});
|
|
14395
14411
|
var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
|
|
14396
14412
|
// const searchingForIdCard =
|
|
@@ -14398,7 +14414,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14398
14414
|
var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
|
|
14399
14415
|
return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
|
|
14400
14416
|
ref: ref,
|
|
14401
|
-
className: "flex ".concat((
|
|
14417
|
+
className: "flex ".concat((_k = classNames.container) !== null && _k !== void 0 ? _k : '')
|
|
14402
14418
|
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
14403
14419
|
ref: photoCanvas
|
|
14404
14420
|
}), requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__namespace.default.createElement(ReadTextPrompt, {
|
|
@@ -14420,7 +14436,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14420
14436
|
faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
|
|
14421
14437
|
idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
|
|
14422
14438
|
}), debugMode && capturingId && ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
14423
|
-
"$flipX": !((
|
|
14439
|
+
"$flipX": !((_l = cameraRef.current) === null || _l === void 0 ? void 0 : _l.isRearFacing)
|
|
14424
14440
|
}, detectedObjects.map(function (obj, i) {
|
|
14425
14441
|
var _a;
|
|
14426
14442
|
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
@@ -14430,19 +14446,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14430
14446
|
color: "blue",
|
|
14431
14447
|
flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
|
|
14432
14448
|
});
|
|
14433
|
-
})), /*#__PURE__*/React__namespace.default.createElement(DebugBoundingBoxOverlay, null,
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
scaling: debugScalingDetails
|
|
14438
|
-
});
|
|
14439
|
-
})))))), guidanceText && idCaptureModelsEnabled && !idModelError && ( /*#__PURE__*/React__namespace.default.createElement(GuidanceMessageContainer, {
|
|
14449
|
+
})), /*#__PURE__*/React__namespace.default.createElement(DebugBoundingBoxOverlay, null, face && ( /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceDebugBox, {
|
|
14450
|
+
face: face,
|
|
14451
|
+
scaling: debugScalingDetails
|
|
14452
|
+
}))))))), guidanceText && idCaptureModelsEnabled && !idModelError && ( /*#__PURE__*/React__namespace.default.createElement(GuidanceMessageContainer, {
|
|
14440
14453
|
className: classNames.guidanceMessageContainer
|
|
14441
14454
|
}, /*#__PURE__*/React__namespace.default.createElement(GuidanceMessage, {
|
|
14442
14455
|
className: classNames.guidanceMessage,
|
|
14443
|
-
"$background": (
|
|
14444
|
-
"$textColor": (
|
|
14445
|
-
}, guidanceText))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__namespace.default.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__namespace.default.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__namespace.default.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__namespace.default.createElement("br", null), "Best Frame Detection Score:", ' ', (
|
|
14456
|
+
"$background": (_p = (_o = (_m = theme.guidanceMessages) === null || _m === void 0 ? void 0 : _m.negative) === null || _o === void 0 ? void 0 : _o.backgroundColor) !== null && _p !== void 0 ? _p : 'red',
|
|
14457
|
+
"$textColor": (_s = (_r = (_q = theme.guidanceMessages) === null || _q === void 0 ? void 0 : _q.negative) === null || _r === void 0 ? void 0 : _r.textColor) !== null && _s !== void 0 ? _s : 'white'
|
|
14458
|
+
}, guidanceText))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__namespace.default.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__namespace.default.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__namespace.default.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__namespace.default.createElement("br", null), "Best Frame Detection Score:", ' ', (_u = (_t = bestFrameDetails.current) === null || _t === void 0 ? void 0 : _t.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__namespace.default.createElement("br", null), "Best Frame Focus Score: ", (_w = (_v = bestFrameDetails.current) === null || _v === void 0 ? void 0 : _v.focusScore) !== null && _w !== void 0 ? _w : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React__namespace.default.createElement(CountdownContainer, {
|
|
14446
14459
|
className: classNames.countdownContainer
|
|
14447
14460
|
}, /*#__PURE__*/React__namespace.default.createElement(Countdown, {
|
|
14448
14461
|
className: classNames.countdown
|
|
@@ -14758,7 +14771,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14758
14771
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
14759
14772
|
autoStart: false,
|
|
14760
14773
|
onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
|
|
14761
|
-
modelLoadTimeoutMs: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.modelLoadTimeoutMs
|
|
14774
|
+
modelLoadTimeoutMs: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.modelLoadTimeoutMs,
|
|
14775
|
+
requireVerticalFaceCentering: captureState === 'CHECKING_LIVENESS'
|
|
14762
14776
|
}, /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
|
|
14763
14777
|
className: "flex ".concat((_k = classNames.container) !== null && _k !== void 0 ? _k : '')
|
|
14764
14778
|
}, ['CHECKING_LIVENESS', 'CAPTURING_VIDEO'].includes(captureState) && /*#__PURE__*/React__namespace.default.createElement(CameraVideoTag, {
|
|
@@ -14804,7 +14818,6 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14804
14818
|
renderCameraFeed: false,
|
|
14805
14819
|
releaseCameraAccessOnExit: false,
|
|
14806
14820
|
disableCapturePreview: !debugMode,
|
|
14807
|
-
requireVerticalFaceCentering: false,
|
|
14808
14821
|
guidesComponent: faceLivenessGuides,
|
|
14809
14822
|
assets: assets.faceLiveness,
|
|
14810
14823
|
classNames: classNames.faceLiveness,
|
|
@@ -15052,7 +15065,8 @@ function CompositeWizard(_a) {
|
|
|
15052
15065
|
autoStart: false,
|
|
15053
15066
|
throttleMs: 250,
|
|
15054
15067
|
onModelError: videoSignatureCaptureProps.onModelError,
|
|
15055
|
-
modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs
|
|
15068
|
+
modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs,
|
|
15069
|
+
requireVerticalFaceCentering: false
|
|
15056
15070
|
}, /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizard, _assign({}, videoSignatureCaptureProps, {
|
|
15057
15071
|
onComplete: onVideoSignatureComplete,
|
|
15058
15072
|
onRetryClicked: onVideoSignatureRetry
|