idmission-web-sdk 2.2.74 → 2.2.75
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/CompositeWizard.d.ts.map +1 -1
- package/dist/components/customer_flows/IdValidation.d.ts +3 -1
- package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
- package/dist/components/fallback_flows/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/CapturedDocuments.d.ts +1 -1
- package/dist/components/id_capture/CapturedDocuments.d.ts.map +1 -1
- package/dist/components/id_capture/IdCapture.d.ts +2 -2
- package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +2 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +7 -5
- package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +4 -0
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureSuccess.d.ts +0 -4
- package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts +2 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCapture.d.ts +2 -0
- package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +6 -2
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +4 -0
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/lib/models/defaults/DocumentDetector.d.ts +1 -1
- package/dist/sdk2.cjs.development.js +353 -327
- 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 +353 -327
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +353 -327
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.2.
|
|
214
|
+
var webSdkVersion = '2.2.75';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -8339,7 +8339,7 @@
|
|
|
8339
8339
|
|
|
8340
8340
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
8341
8341
|
|
|
8342
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
8342
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250111_090328.tflite");
|
|
8343
8343
|
|
|
8344
8344
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
8345
8345
|
|
|
@@ -8358,6 +8358,10 @@
|
|
|
8358
8358
|
passport: {
|
|
8359
8359
|
desktop: 0,
|
|
8360
8360
|
mobile: 0.3
|
|
8361
|
+
},
|
|
8362
|
+
singlePage: {
|
|
8363
|
+
desktop: 0,
|
|
8364
|
+
mobile: 0.3
|
|
8361
8365
|
}
|
|
8362
8366
|
};
|
|
8363
8367
|
var classifier = null;
|
|
@@ -8983,16 +8987,19 @@
|
|
|
8983
8987
|
idCardFront: 0.6,
|
|
8984
8988
|
idCardBack: 0.6,
|
|
8985
8989
|
passport: 0.4,
|
|
8990
|
+
singlePage: 0.4,
|
|
8986
8991
|
stability: {
|
|
8987
8992
|
idCardFront: 0.85,
|
|
8988
8993
|
idCardBack: 0.85,
|
|
8989
|
-
passport: 0.5
|
|
8994
|
+
passport: 0.5,
|
|
8995
|
+
singlePage: 0.5
|
|
8990
8996
|
}
|
|
8991
8997
|
};
|
|
8992
8998
|
var documentTypeDisplayNames = {
|
|
8993
8999
|
idCardFront: 'ID card front',
|
|
8994
9000
|
idCardBack: 'ID card back',
|
|
8995
9001
|
passport: 'Passport',
|
|
9002
|
+
singlePage: 'Single page',
|
|
8996
9003
|
none: 'None'
|
|
8997
9004
|
};
|
|
8998
9005
|
var detector = null;
|
|
@@ -9181,7 +9188,7 @@
|
|
|
9181
9188
|
right: 20
|
|
9182
9189
|
};
|
|
9183
9190
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
9184
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9191
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
9185
9192
|
if (boundaries === void 0) {
|
|
9186
9193
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
9187
9194
|
}
|
|
@@ -9232,18 +9239,25 @@
|
|
|
9232
9239
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
9233
9240
|
return obj.label === 'Passport page';
|
|
9234
9241
|
});
|
|
9242
|
+
var bestSinglePage = detectedObjects.find(function (obj) {
|
|
9243
|
+
return obj.label === 'Single page';
|
|
9244
|
+
});
|
|
9235
9245
|
var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
|
|
9236
9246
|
var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
|
|
9237
9247
|
var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
|
|
9238
|
-
var
|
|
9239
|
-
var
|
|
9240
|
-
var
|
|
9241
|
-
var
|
|
9242
|
-
var
|
|
9243
|
-
var
|
|
9248
|
+
var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
|
|
9249
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
|
|
9250
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
|
|
9251
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
|
|
9252
|
+
var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
|
|
9253
|
+
var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
9254
|
+
var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
9255
|
+
var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
|
|
9244
9256
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
9245
9257
|
var detectedDocumentType = 'none';
|
|
9246
|
-
if (
|
|
9258
|
+
if (singlePageDetectionThresholdMet) {
|
|
9259
|
+
detectedDocumentType = 'singlePage';
|
|
9260
|
+
} else if (passportDetectionThresholdMet) {
|
|
9247
9261
|
detectedDocumentType = 'passport';
|
|
9248
9262
|
} else if (idCardBackDetectionThresholdMet) {
|
|
9249
9263
|
detectedDocumentType = 'idCardBack';
|
|
@@ -9257,12 +9271,12 @@
|
|
|
9257
9271
|
var documentIsStable = false;
|
|
9258
9272
|
var documentTooClose = false;
|
|
9259
9273
|
if (bestDocument) {
|
|
9260
|
-
var
|
|
9261
|
-
docWidth =
|
|
9262
|
-
docHeight =
|
|
9274
|
+
var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
9275
|
+
docWidth = _q[0],
|
|
9276
|
+
docHeight = _q[1];
|
|
9263
9277
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
9264
9278
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
9265
|
-
var thresholdSet = (
|
|
9279
|
+
var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
|
|
9266
9280
|
var threshold_1 = thresholdSet[detectedDocumentType];
|
|
9267
9281
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
9268
9282
|
trackBox(bestDocument.box, framesNeeded);
|
|
@@ -9284,6 +9298,8 @@
|
|
|
9284
9298
|
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
9285
9299
|
passportDetectionScore: passportDetectionScore,
|
|
9286
9300
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
9301
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
9302
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
9287
9303
|
bestDocument: bestDocument,
|
|
9288
9304
|
documentInBounds: documentInBounds,
|
|
9289
9305
|
documentTooClose: documentTooClose,
|
|
@@ -10230,37 +10246,39 @@
|
|
|
10230
10246
|
});
|
|
10231
10247
|
function IdCaptureModelsProviderInner(_a) {
|
|
10232
10248
|
var children = _a.children,
|
|
10233
|
-
onModelError = _a.onModelError
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10249
|
+
onModelError = _a.onModelError,
|
|
10250
|
+
_b = _a.allowSinglePageIdCapture,
|
|
10251
|
+
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
10252
|
+
var _c = React.useContext(DocumentDetectionModelContext),
|
|
10253
|
+
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
10254
|
+
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
10255
|
+
startDocumentDetection = _c.startDocumentDetection,
|
|
10256
|
+
stopDocumentDetection = _c.stopDocumentDetection,
|
|
10257
|
+
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
10258
|
+
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
10259
|
+
onDocumentDetected = _c.onDocumentDetected,
|
|
10260
|
+
detectionTime = _c.detectionTime,
|
|
10261
|
+
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
10262
|
+
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
10263
|
+
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
10264
|
+
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
10265
|
+
documentDetectionModelError = _c.documentDetectionModelError;
|
|
10266
|
+
var _d = React.useContext(FocusModelContext),
|
|
10267
|
+
focusModelReady = _d.focusModelReady,
|
|
10268
|
+
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
10269
|
+
makeFocusPrediction = _d.makeFocusPrediction,
|
|
10270
|
+
focusThresholds = _d.focusThresholds,
|
|
10271
|
+
setFocusThresholds = _d.setFocusThresholds,
|
|
10272
|
+
focusPredictionTime = _d.focusPredictionTime,
|
|
10273
|
+
focusModelError = _d.focusModelError;
|
|
10256
10274
|
var onPredictionHandler = React.useRef();
|
|
10257
10275
|
var bestFrameDetails = React.useRef(null);
|
|
10258
10276
|
var bestPredictionCanvas = React.useRef(null);
|
|
10259
10277
|
var bestFocusScore = React.useRef(0);
|
|
10260
10278
|
var stopDetection = React.useRef(0);
|
|
10261
|
-
var
|
|
10262
|
-
requiredDocumentType =
|
|
10263
|
-
setRequiredDocumentType =
|
|
10279
|
+
var _e = React.useState('none'),
|
|
10280
|
+
requiredDocumentType = _e[0],
|
|
10281
|
+
setRequiredDocumentType = _e[1];
|
|
10264
10282
|
var thresholds = React.useMemo(function () {
|
|
10265
10283
|
return _assign(_assign({}, documentDetectionThresholds), {
|
|
10266
10284
|
focus: focusThresholds
|
|
@@ -10278,34 +10296,42 @@
|
|
|
10278
10296
|
var _this = this;
|
|
10279
10297
|
onDocumentDetected(function (prediction) {
|
|
10280
10298
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10281
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
10282
|
-
var _a, _b, _c, _d, _e, _f;
|
|
10283
|
-
return __generator(this, function (
|
|
10299
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
10300
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10301
|
+
return __generator(this, function (_h) {
|
|
10284
10302
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
10285
10303
|
stopDetectionAtStart = stopDetection.current;
|
|
10286
10304
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
10287
|
-
|
|
10305
|
+
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
10306
|
+
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
10307
|
+
prediction.detectedDocumentType = 'passport';
|
|
10308
|
+
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
10309
|
+
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
10310
|
+
prediction.singlePageDetectionScore = 0;
|
|
10311
|
+
prediction.singlePageDetectionThresholdMet = false;
|
|
10312
|
+
}
|
|
10313
|
+
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || allowSinglePageIdCapture && isSinglePage && ((_b = requiredDocumentType.includes) === null || _b === void 0 ? void 0 : _b.call(requiredDocumentType, 'idCardFront'));
|
|
10288
10314
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
10289
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (
|
|
10315
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
10290
10316
|
if (focusPrediction) {
|
|
10291
10317
|
focusScore = focusPrediction.score;
|
|
10292
10318
|
focusPredictionTime = focusPrediction.predictionTime;
|
|
10293
10319
|
}
|
|
10294
|
-
focusThresholdSet = (
|
|
10295
|
-
focusThreshold = (
|
|
10320
|
+
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
10321
|
+
focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
|
|
10296
10322
|
focusThresholdMet = focusScore >= focusThreshold;
|
|
10297
10323
|
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
10298
10324
|
bestFocusScore.current = focusScore;
|
|
10299
10325
|
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
10300
10326
|
bestFrameDetails.current = {
|
|
10301
|
-
boundingBox: (
|
|
10327
|
+
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
10302
10328
|
documentType: prediction.detectedDocumentType,
|
|
10303
10329
|
detectionScore: prediction.detectionScore,
|
|
10304
10330
|
focusScore: focusScore
|
|
10305
10331
|
};
|
|
10306
10332
|
}
|
|
10307
10333
|
}
|
|
10308
|
-
(
|
|
10334
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
10309
10335
|
focusScore: focusScore,
|
|
10310
10336
|
focusPredictionTime: focusPredictionTime,
|
|
10311
10337
|
focusThresholdMet: focusThresholdMet
|
|
@@ -10314,7 +10340,7 @@
|
|
|
10314
10340
|
});
|
|
10315
10341
|
});
|
|
10316
10342
|
});
|
|
10317
|
-
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
10343
|
+
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
10318
10344
|
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
10319
10345
|
React.useEffect(function handleModelErrors() {
|
|
10320
10346
|
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
@@ -10328,9 +10354,9 @@
|
|
|
10328
10354
|
canvas: bestPredictionCanvas.current
|
|
10329
10355
|
});
|
|
10330
10356
|
}, []);
|
|
10331
|
-
var
|
|
10332
|
-
canvasKey =
|
|
10333
|
-
setCanvasKey =
|
|
10357
|
+
var _f = React.useState(0),
|
|
10358
|
+
canvasKey = _f[0],
|
|
10359
|
+
setCanvasKey = _f[1];
|
|
10334
10360
|
var resetBestFrame = React.useCallback(function () {
|
|
10335
10361
|
stopDetection.current += 1;
|
|
10336
10362
|
setCanvasKey(function (n) {
|
|
@@ -10460,9 +10486,9 @@
|
|
|
10460
10486
|
});
|
|
10461
10487
|
}
|
|
10462
10488
|
|
|
10463
|
-
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
|
|
10489
|
+
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
10464
10490
|
|
|
10465
|
-
var
|
|
10491
|
+
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
10466
10492
|
idCardFront: ['idCardFront'],
|
|
10467
10493
|
idCardBack: ['idCardBack'],
|
|
10468
10494
|
passport: ['passport'],
|
|
@@ -10470,13 +10496,31 @@
|
|
|
10470
10496
|
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
10471
10497
|
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
10472
10498
|
};
|
|
10473
|
-
function
|
|
10499
|
+
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
10474
10500
|
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
10475
|
-
return
|
|
10501
|
+
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
10476
10502
|
}
|
|
10477
|
-
function
|
|
10503
|
+
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
10478
10504
|
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
10479
|
-
return
|
|
10505
|
+
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
10506
|
+
}
|
|
10507
|
+
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
10508
|
+
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
10509
|
+
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
10510
|
+
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
10511
|
+
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
10512
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
10513
|
+
return !v.includes('idCard');
|
|
10514
|
+
});
|
|
10515
|
+
}
|
|
10516
|
+
if (isIdCardOrPassport) {
|
|
10517
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
10518
|
+
return v !== 'passport';
|
|
10519
|
+
});
|
|
10520
|
+
}
|
|
10521
|
+
return acceptedTypes.filter(function (v) {
|
|
10522
|
+
return !(v in capturedDocuments);
|
|
10523
|
+
});
|
|
10480
10524
|
}
|
|
10481
10525
|
|
|
10482
10526
|
var initialState$4 = {
|
|
@@ -10515,6 +10559,8 @@
|
|
|
10515
10559
|
idCardBackDetectionThresholdMet: false,
|
|
10516
10560
|
passportDetectionScore: 0,
|
|
10517
10561
|
passportDetectionThresholdMet: false,
|
|
10562
|
+
singlePageDetectionScore: 0,
|
|
10563
|
+
singlePageDetectionThresholdMet: false,
|
|
10518
10564
|
focusScore: 0,
|
|
10519
10565
|
focusThresholdMet: false,
|
|
10520
10566
|
isGoodFrame: false,
|
|
@@ -10530,6 +10576,7 @@
|
|
|
10530
10576
|
capturedDocuments: {},
|
|
10531
10577
|
captureRequirement: 'idCardOrPassport',
|
|
10532
10578
|
requestedDocumentType: 'idCardFront',
|
|
10579
|
+
allowSinglePageIdCapture: false,
|
|
10533
10580
|
allowIdCardBackToFrontCapture: false,
|
|
10534
10581
|
operationStartedAt: null,
|
|
10535
10582
|
captureStartedAt: null
|
|
@@ -10544,11 +10591,13 @@
|
|
|
10544
10591
|
var _c = action.payload,
|
|
10545
10592
|
captureRequirement = _c.captureRequirement,
|
|
10546
10593
|
precapturedDocuments = _c.precapturedDocuments,
|
|
10594
|
+
allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
|
|
10547
10595
|
allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
|
|
10548
10596
|
enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
|
|
10549
10597
|
allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
|
|
10550
10598
|
var newState = _assign(_assign({}, state), {
|
|
10551
10599
|
captureRequirement: captureRequirement,
|
|
10600
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
10552
10601
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
10553
10602
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
10554
10603
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
@@ -10616,6 +10665,8 @@
|
|
|
10616
10665
|
idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
|
|
10617
10666
|
passportDetectionScore = _d.passportDetectionScore,
|
|
10618
10667
|
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
10668
|
+
singlePageDetectionScore = _d.singlePageDetectionScore,
|
|
10669
|
+
singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
|
|
10619
10670
|
bestDocument = _d.bestDocument,
|
|
10620
10671
|
documentInBounds = _d.documentInBounds,
|
|
10621
10672
|
documentTooClose = _d.documentTooClose,
|
|
@@ -10636,7 +10687,8 @@
|
|
|
10636
10687
|
}
|
|
10637
10688
|
}
|
|
10638
10689
|
}
|
|
10639
|
-
var
|
|
10690
|
+
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
10691
|
+
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
10640
10692
|
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
10641
10693
|
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
10642
10694
|
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
@@ -10696,6 +10748,8 @@
|
|
|
10696
10748
|
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
10697
10749
|
passportDetectionScore: passportDetectionScore,
|
|
10698
10750
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
10751
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
10752
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
10699
10753
|
focusScore: focusScore,
|
|
10700
10754
|
focusThresholdMet: focusThresholdMet,
|
|
10701
10755
|
isGoodFrame: isGoodFrame,
|
|
@@ -10733,7 +10787,7 @@
|
|
|
10733
10787
|
});
|
|
10734
10788
|
case 'documentCaptured':
|
|
10735
10789
|
{
|
|
10736
|
-
var
|
|
10790
|
+
var newState = _assign(_assign({}, state), {
|
|
10737
10791
|
capturing: false,
|
|
10738
10792
|
captureFailed: false,
|
|
10739
10793
|
allowOverrideFlipRequirement: false,
|
|
@@ -10742,64 +10796,42 @@
|
|
|
10742
10796
|
wrongDocumentTypePredictions: 0,
|
|
10743
10797
|
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
10744
10798
|
});
|
|
10745
|
-
var remainingRequirements =
|
|
10746
|
-
return !(v in newState_1.capturedDocuments);
|
|
10747
|
-
});
|
|
10748
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
10749
|
-
if (state.requestedDocumentType === 'passport') {
|
|
10750
|
-
remainingRequirements = [];
|
|
10751
|
-
} else {
|
|
10752
|
-
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
10753
|
-
return v !== 'passport';
|
|
10754
|
-
});
|
|
10755
|
-
}
|
|
10756
|
-
}
|
|
10799
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
10757
10800
|
if (remainingRequirements.length === 0) {
|
|
10758
|
-
|
|
10801
|
+
newState.captureState = 'complete';
|
|
10759
10802
|
} else {
|
|
10760
|
-
|
|
10761
|
-
if (state.requestedDocumentType === 'idCardFront' &&
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10803
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
10804
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10805
|
+
newState.captureState = 'requestingFlip';
|
|
10806
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
10807
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
10808
|
+
newState.passportDetectionThresholdMet = false;
|
|
10809
|
+
newState.wrongDocumentTypePredictions = 0;
|
|
10767
10810
|
}
|
|
10768
10811
|
}
|
|
10769
|
-
return
|
|
10812
|
+
return newState;
|
|
10770
10813
|
}
|
|
10771
10814
|
case 'documentCapturedManually':
|
|
10772
10815
|
{
|
|
10773
|
-
var
|
|
10816
|
+
var newState = _assign(_assign({}, state), {
|
|
10774
10817
|
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
|
|
10775
10818
|
width: 0,
|
|
10776
10819
|
height: 0
|
|
10777
10820
|
}), _b))
|
|
10778
10821
|
});
|
|
10779
|
-
var remainingRequirements =
|
|
10780
|
-
return !(v in newState_2.capturedDocuments);
|
|
10781
|
-
});
|
|
10782
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
10783
|
-
if (state.requestedDocumentType === 'passport') {
|
|
10784
|
-
remainingRequirements = [];
|
|
10785
|
-
} else {
|
|
10786
|
-
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
10787
|
-
return v !== 'passport';
|
|
10788
|
-
});
|
|
10789
|
-
}
|
|
10790
|
-
}
|
|
10822
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
10791
10823
|
if (remainingRequirements.length === 0) {
|
|
10792
|
-
|
|
10824
|
+
newState.captureState = 'complete';
|
|
10793
10825
|
} else {
|
|
10794
|
-
|
|
10795
|
-
if (state.requestedDocumentType === 'idCardFront' &&
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10826
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
10827
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10828
|
+
newState.captureState = 'requestingFlip';
|
|
10829
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
10830
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
10831
|
+
newState.passportDetectionThresholdMet = false;
|
|
10800
10832
|
}
|
|
10801
10833
|
}
|
|
10802
|
-
return
|
|
10834
|
+
return newState;
|
|
10803
10835
|
}
|
|
10804
10836
|
case 'flipRequestCompleted':
|
|
10805
10837
|
return _assign(_assign({}, state), {
|
|
@@ -14190,7 +14222,7 @@
|
|
|
14190
14222
|
imageUrl: imageUrl
|
|
14191
14223
|
}
|
|
14192
14224
|
});
|
|
14193
|
-
var capturedDocumentType = documentType
|
|
14225
|
+
var capturedDocumentType = documentType;
|
|
14194
14226
|
setTimeout(function () {
|
|
14195
14227
|
var _a;
|
|
14196
14228
|
var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
|
|
@@ -14257,7 +14289,7 @@
|
|
|
14257
14289
|
scaling: debugScalingDetails,
|
|
14258
14290
|
flipX: !isRearFacing
|
|
14259
14291
|
});
|
|
14260
|
-
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
14292
|
+
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
14261
14293
|
};
|
|
14262
14294
|
var timeSince = function timeSince(t) {
|
|
14263
14295
|
if (!t) return 0;
|
|
@@ -15370,15 +15402,8 @@
|
|
|
15370
15402
|
_e = _a.debugMode,
|
|
15371
15403
|
debugMode = _e === void 0 ? false : _e;
|
|
15372
15404
|
var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
|
|
15373
|
-
var idCardFront = capturedDocuments.idCardFront,
|
|
15374
|
-
idCardBack = capturedDocuments.idCardBack,
|
|
15375
|
-
passport = capturedDocuments.passport;
|
|
15376
15405
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15377
15406
|
headingText: 'ID Capture Successful',
|
|
15378
|
-
idCardFrontText: 'ID Card Front',
|
|
15379
|
-
idCardBackText: 'ID Card Back',
|
|
15380
|
-
passportText: 'Passport',
|
|
15381
|
-
instructionText: 'Verify the entire ID was captured clearly with no glare.',
|
|
15382
15407
|
retryText: 'Retry',
|
|
15383
15408
|
submittingText: 'Submitting...',
|
|
15384
15409
|
submitText: 'Done'
|
|
@@ -15395,25 +15420,16 @@
|
|
|
15395
15420
|
className: classNames.imageContainer
|
|
15396
15421
|
}, /*#__PURE__*/React.createElement(ImageRow, {
|
|
15397
15422
|
className: classNames.imageRow
|
|
15398
|
-
},
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
|
|
15407
|
-
|
|
15408
|
-
className: classNames.image,
|
|
15409
|
-
alt: verbiage.idCardBackText
|
|
15410
|
-
}), debugMode && ( /*#__PURE__*/React.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React.createElement(ImageCol$1, {
|
|
15411
|
-
className: classNames.imageCol
|
|
15412
|
-
}, /*#__PURE__*/React.createElement(StyledImage, {
|
|
15413
|
-
image: passport,
|
|
15414
|
-
className: classNames.image,
|
|
15415
|
-
alt: verbiage.passportText
|
|
15416
|
-
}), debugMode && ( /*#__PURE__*/React.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React.createElement(ButtonsColumn, {
|
|
15423
|
+
}, Object.values(capturedDocuments).map(function (doc) {
|
|
15424
|
+
return /*#__PURE__*/React.createElement(ImageCol$1, {
|
|
15425
|
+
className: classNames.imageCol,
|
|
15426
|
+
key: doc.imageData
|
|
15427
|
+
}, /*#__PURE__*/React.createElement(StyledImage, {
|
|
15428
|
+
image: doc,
|
|
15429
|
+
className: classNames.image,
|
|
15430
|
+
alt: doc.documentType
|
|
15431
|
+
}), debugMode && ( /*#__PURE__*/React.createElement(DebugPre, null, "Document Type: ".concat(doc.documentType, "\nDetection Score: ").concat(doc.detectionScore, "\nFocus Score: ").concat(doc.focusScore, "\nBounding Box: ").concat(JSON.stringify(doc.boundingBox)))));
|
|
15432
|
+
}))), /*#__PURE__*/React.createElement(ButtonsColumn, {
|
|
15417
15433
|
className: classNames.buttonsRow
|
|
15418
15434
|
}, /*#__PURE__*/React.createElement(WideButton, {
|
|
15419
15435
|
className: classNames.submitBtn,
|
|
@@ -15432,7 +15448,7 @@
|
|
|
15432
15448
|
};
|
|
15433
15449
|
var Heading$a = styled.h1(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"], ["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"])));
|
|
15434
15450
|
var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"], ["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"])));
|
|
15435
|
-
var ImageRow = styled(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n
|
|
15451
|
+
var ImageRow = styled(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"])));
|
|
15436
15452
|
var ImageCol$1 = styled.div(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n width: 100%;\n max-height: none !important;\n"], ["\n width: 100%;\n max-height: none !important;\n"])));
|
|
15437
15453
|
var StyledImage = styled(CapturedDocumentImg)(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
|
|
15438
15454
|
var DebugPre = styled.pre(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"], ["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"])));
|
|
@@ -17142,8 +17158,8 @@
|
|
|
17142
17158
|
var _j = React.useState(silentFallback),
|
|
17143
17159
|
useFallback = _j[0],
|
|
17144
17160
|
setUseFallback = _j[1];
|
|
17145
|
-
var
|
|
17146
|
-
var
|
|
17161
|
+
var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
17162
|
+
var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
17147
17163
|
var _k = useFileState(),
|
|
17148
17164
|
rawFile = _k.rawFile,
|
|
17149
17165
|
fileInputOnChange = _k.fileInputOnChange;
|
|
@@ -17156,7 +17172,7 @@
|
|
|
17156
17172
|
var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
|
|
17157
17173
|
var firstInstructionText = idCaptureRequirement === 'idCard' || idCaptureRequirement === 'idCardAndPassport' ? 'Please capture the front of your ID card.' : idCaptureRequirement === 'passport' ? 'Please capture the ID page of your passport.' : 'Please capture the front of your ID card, or the ID page of your passport.';
|
|
17158
17174
|
var secondInstructionText = idCaptureRequirement === 'idCardOrPassport' ? 'Please capture the back of your ID card, or click Done if submitting a passport.' : 'Please capture the back of your ID card.';
|
|
17159
|
-
var descriptionText = "On-device capture guidance failed, please capture ".concat(
|
|
17175
|
+
var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
|
|
17160
17176
|
var verbiage = useTranslations(rawVerbiage, {
|
|
17161
17177
|
headingText: "We're having some trouble.",
|
|
17162
17178
|
descriptionText: descriptionText,
|
|
@@ -17230,7 +17246,7 @@
|
|
|
17230
17246
|
alt: "",
|
|
17231
17247
|
className: classNames.image
|
|
17232
17248
|
}));
|
|
17233
|
-
}))), images.length <
|
|
17249
|
+
}))), images.length < minImageCount && ( /*#__PURE__*/React.createElement(Instruction, {
|
|
17234
17250
|
className: classNames.instruction
|
|
17235
17251
|
}, instructionText)), /*#__PURE__*/React.createElement("input", {
|
|
17236
17252
|
ref: fileInput,
|
|
@@ -17241,7 +17257,7 @@
|
|
|
17241
17257
|
hidden: true
|
|
17242
17258
|
}), /*#__PURE__*/React.createElement(StyledButtonsRow$8, {
|
|
17243
17259
|
className: classNames.buttonsRow
|
|
17244
|
-
}, images.length <
|
|
17260
|
+
}, images.length < maxImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
|
|
17245
17261
|
variant: images.length > 0 ? 'secondary' : 'positive',
|
|
17246
17262
|
className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
|
|
17247
17263
|
colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
|
|
@@ -17254,7 +17270,7 @@
|
|
|
17254
17270
|
setDocumentToCapture(instructionText);
|
|
17255
17271
|
}
|
|
17256
17272
|
}
|
|
17257
|
-
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >=
|
|
17273
|
+
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
|
|
17258
17274
|
variant: "positive",
|
|
17259
17275
|
className: classNames.doneBtn,
|
|
17260
17276
|
colors: colors.doneBtn,
|
|
@@ -17301,79 +17317,82 @@
|
|
|
17301
17317
|
precapturedDocuments = _a.precapturedDocuments,
|
|
17302
17318
|
_j = _a.captureRequirement,
|
|
17303
17319
|
captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
|
|
17304
|
-
_k = _a.
|
|
17305
|
-
|
|
17306
|
-
_l = _a.
|
|
17307
|
-
|
|
17308
|
-
_m = _a.
|
|
17309
|
-
|
|
17320
|
+
_k = _a.allowSinglePageIdCapture,
|
|
17321
|
+
allowSinglePageIdCapture = _k === void 0 ? false : _k,
|
|
17322
|
+
_l = _a.separateIdCardCaptureSequence,
|
|
17323
|
+
separateIdCardCaptureSequence = _l === void 0 ? false : _l,
|
|
17324
|
+
_m = _a.thresholds,
|
|
17325
|
+
thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
|
|
17326
|
+
_o = _a.skipSuccessScreen,
|
|
17327
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
17310
17328
|
instructions = _a.instructions,
|
|
17311
|
-
|
|
17312
|
-
releaseCameraAccessOnExit =
|
|
17313
|
-
|
|
17314
|
-
guideType =
|
|
17315
|
-
|
|
17316
|
-
portraitGuidesOnMobile =
|
|
17317
|
-
|
|
17318
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
17319
|
-
|
|
17320
|
-
silentFallback =
|
|
17321
|
-
|
|
17322
|
-
forceFallbackMode =
|
|
17323
|
-
|
|
17324
|
-
allowIdCardBackToFrontCapture =
|
|
17325
|
-
|
|
17326
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
17327
|
-
|
|
17328
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
17329
|
-
|
|
17330
|
-
guideImages =
|
|
17331
|
-
|
|
17332
|
-
assets =
|
|
17333
|
-
|
|
17334
|
-
classNames =
|
|
17335
|
-
|
|
17336
|
-
colors =
|
|
17337
|
-
|
|
17338
|
-
verbiage =
|
|
17339
|
-
|
|
17340
|
-
debugMode =
|
|
17341
|
-
var
|
|
17342
|
-
state =
|
|
17343
|
-
dispatch =
|
|
17344
|
-
var
|
|
17345
|
-
cameraAccessDenied =
|
|
17346
|
-
requestCameraAccess =
|
|
17347
|
-
releaseCameraAccess =
|
|
17348
|
-
var
|
|
17349
|
-
overlayDismissed =
|
|
17350
|
-
setOverlayDismissed =
|
|
17351
|
-
var
|
|
17352
|
-
submissionStatus =
|
|
17353
|
-
setIdFrontImage =
|
|
17354
|
-
setIdBackImage =
|
|
17355
|
-
setPassportImage =
|
|
17356
|
-
logIdFrontCaptureAttempt =
|
|
17357
|
-
logIdBackCaptureAttempt =
|
|
17358
|
-
var
|
|
17359
|
-
start =
|
|
17360
|
-
stop =
|
|
17361
|
-
onPredictionMade =
|
|
17362
|
-
setRequiredDocumentType =
|
|
17363
|
-
modelError =
|
|
17364
|
-
resetBestFrame =
|
|
17329
|
+
_p = _a.releaseCameraAccessOnExit,
|
|
17330
|
+
releaseCameraAccessOnExit = _p === void 0 ? true : _p,
|
|
17331
|
+
_q = _a.guideType,
|
|
17332
|
+
guideType = _q === void 0 ? 'fit' : _q,
|
|
17333
|
+
_r = _a.portraitGuidesOnMobile,
|
|
17334
|
+
portraitGuidesOnMobile = _r === void 0 ? true : _r,
|
|
17335
|
+
_s = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
17336
|
+
rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
17337
|
+
_t = _a.silentFallback,
|
|
17338
|
+
silentFallback = _t === void 0 ? false : _t,
|
|
17339
|
+
_u = _a.forceFallbackMode,
|
|
17340
|
+
forceFallbackMode = _u === void 0 ? false : _u,
|
|
17341
|
+
_v = _a.allowIdCardBackToFrontCapture,
|
|
17342
|
+
allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
|
|
17343
|
+
_w = _a.enableOverrideWrongDocumentTypeDialog,
|
|
17344
|
+
enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
|
|
17345
|
+
_x = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
17346
|
+
allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
|
|
17347
|
+
_y = _a.guideImages,
|
|
17348
|
+
guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
|
|
17349
|
+
_z = _a.assets,
|
|
17350
|
+
assets = _z === void 0 ? {} : _z,
|
|
17351
|
+
_0 = _a.classNames,
|
|
17352
|
+
classNames = _0 === void 0 ? {} : _0,
|
|
17353
|
+
_1 = _a.colors,
|
|
17354
|
+
colors = _1 === void 0 ? {} : _1,
|
|
17355
|
+
_2 = _a.verbiage,
|
|
17356
|
+
verbiage = _2 === void 0 ? {} : _2,
|
|
17357
|
+
_3 = _a.debugMode,
|
|
17358
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
17359
|
+
var _4 = useIdCaptureState(),
|
|
17360
|
+
state = _4[0],
|
|
17361
|
+
dispatch = _4[1];
|
|
17362
|
+
var _5 = useCameraStore(),
|
|
17363
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
17364
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
17365
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
17366
|
+
var _6 = React.useState(false),
|
|
17367
|
+
overlayDismissed = _6[0],
|
|
17368
|
+
setOverlayDismissed = _6[1];
|
|
17369
|
+
var _7 = React.useContext(SubmissionContext),
|
|
17370
|
+
submissionStatus = _7.submissionStatus,
|
|
17371
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
17372
|
+
setIdBackImage = _7.setIdBackImage,
|
|
17373
|
+
setPassportImage = _7.setPassportImage,
|
|
17374
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
17375
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
17376
|
+
var _8 = React.useContext(IdCaptureModelsContext),
|
|
17377
|
+
start = _8.start,
|
|
17378
|
+
stop = _8.stop,
|
|
17379
|
+
onPredictionMade = _8.onPredictionMade,
|
|
17380
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
17381
|
+
modelError = _8.modelError,
|
|
17382
|
+
resetBestFrame = _8.resetBestFrame;
|
|
17365
17383
|
React.useEffect(function () {
|
|
17366
17384
|
dispatch({
|
|
17367
17385
|
type: 'configureWizard',
|
|
17368
17386
|
payload: {
|
|
17369
17387
|
captureRequirement: captureRequirement,
|
|
17370
17388
|
precapturedDocuments: precapturedDocuments,
|
|
17389
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture,
|
|
17371
17390
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
17372
17391
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
17373
17392
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
17374
17393
|
}
|
|
17375
17394
|
});
|
|
17376
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
17395
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
17377
17396
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
17378
17397
|
React.useEffect(function () {
|
|
17379
17398
|
if (documentCount) resetBestFrame();
|
|
@@ -17435,13 +17454,16 @@
|
|
|
17435
17454
|
var _a = state.capturedDocuments,
|
|
17436
17455
|
idCardFront = _a.idCardFront,
|
|
17437
17456
|
idCardBack = _a.idCardBack,
|
|
17438
|
-
passport = _a.passport
|
|
17457
|
+
passport = _a.passport,
|
|
17458
|
+
singlePage = _a.singlePage;
|
|
17439
17459
|
var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
|
|
17440
17460
|
var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
|
|
17441
17461
|
var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
|
|
17462
|
+
var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
|
|
17442
17463
|
if (idFrontImage) setIdFrontImage(idFrontImage);
|
|
17443
17464
|
if (idBackImage) setIdBackImage(idBackImage);
|
|
17444
17465
|
if (passportImage) setPassportImage(passportImage);
|
|
17466
|
+
if (singlePageImage) setIdFrontImage(singlePageImage);
|
|
17445
17467
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
17446
17468
|
setTimeout(function () {
|
|
17447
17469
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
|
|
@@ -17457,9 +17479,9 @@
|
|
|
17457
17479
|
type: 'resetWizard'
|
|
17458
17480
|
});
|
|
17459
17481
|
}, [dispatch]);
|
|
17460
|
-
var
|
|
17461
|
-
attempt =
|
|
17462
|
-
setAttempt =
|
|
17482
|
+
var _9 = React.useState(0),
|
|
17483
|
+
attempt = _9[0],
|
|
17484
|
+
setAttempt = _9[1];
|
|
17463
17485
|
var onExit = React.useCallback(function () {
|
|
17464
17486
|
releaseCameraAccess();
|
|
17465
17487
|
setOverlayDismissed(false);
|
|
@@ -17550,9 +17572,9 @@
|
|
|
17550
17572
|
});
|
|
17551
17573
|
});
|
|
17552
17574
|
}, [dispatch]);
|
|
17553
|
-
var
|
|
17554
|
-
progressStarted =
|
|
17555
|
-
setProgressStarted =
|
|
17575
|
+
var _10 = React.useState(false),
|
|
17576
|
+
progressStarted = _10[0],
|
|
17577
|
+
setProgressStarted = _10[1];
|
|
17556
17578
|
React.useEffect(function () {
|
|
17557
17579
|
if (state.captureState === 'capturing') {
|
|
17558
17580
|
setProgressStarted(false);
|
|
@@ -21852,7 +21874,8 @@
|
|
|
21852
21874
|
detection: {
|
|
21853
21875
|
idCardFront: 0.4,
|
|
21854
21876
|
idCardBack: 0.5,
|
|
21855
|
-
passport: 0.3
|
|
21877
|
+
passport: 0.3,
|
|
21878
|
+
singlePage: 0.3
|
|
21856
21879
|
},
|
|
21857
21880
|
focus: {
|
|
21858
21881
|
idCardFront: {
|
|
@@ -21866,12 +21889,17 @@
|
|
|
21866
21889
|
passport: {
|
|
21867
21890
|
desktop: 0,
|
|
21868
21891
|
mobile: 0
|
|
21892
|
+
},
|
|
21893
|
+
singlePage: {
|
|
21894
|
+
desktop: 0,
|
|
21895
|
+
mobile: 0
|
|
21869
21896
|
}
|
|
21870
21897
|
},
|
|
21871
21898
|
goodFrames: {
|
|
21872
21899
|
idCardFront: 1,
|
|
21873
21900
|
idCardBack: 1,
|
|
21874
|
-
passport: 1
|
|
21901
|
+
passport: 1,
|
|
21902
|
+
singlePage: 1
|
|
21875
21903
|
},
|
|
21876
21904
|
flipShortcutThreshold: 0.7
|
|
21877
21905
|
};
|
|
@@ -21943,6 +21971,7 @@
|
|
|
21943
21971
|
stopIdModels = _18.stop,
|
|
21944
21972
|
onIdPredictionMade = _18.onPredictionMade,
|
|
21945
21973
|
setThresholds = _18.setThresholds,
|
|
21974
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
21946
21975
|
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
21947
21976
|
bestFrameDetails = _18.bestFrameDetails,
|
|
21948
21977
|
resetBestFrame = _18.resetBestFrame,
|
|
@@ -22021,6 +22050,9 @@
|
|
|
22021
22050
|
React.useEffect(function () {
|
|
22022
22051
|
setThresholds(adjustedThresholds);
|
|
22023
22052
|
}, [requestedAction, setThresholds, adjustedThresholds]);
|
|
22053
|
+
React.useEffect(function () {
|
|
22054
|
+
setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
|
|
22055
|
+
}, [requestedAction, setRequiredDocumentType]);
|
|
22024
22056
|
React.useEffect(function () {
|
|
22025
22057
|
setDocumentDetectionBoundaries({
|
|
22026
22058
|
top: 20,
|
|
@@ -22043,6 +22075,9 @@
|
|
|
22043
22075
|
setGoodFramesCount = _28[1];
|
|
22044
22076
|
var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
|
|
22045
22077
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
22078
|
+
var _29 = React.useState(false),
|
|
22079
|
+
isSinglePage = _29[0],
|
|
22080
|
+
setIsSinglePage = _29[1];
|
|
22046
22081
|
React.useEffect(function () {
|
|
22047
22082
|
if (!idCaptureModelsEnabled || idModelError) return;
|
|
22048
22083
|
onIdPredictionMade(function (prediction) {
|
|
@@ -22050,7 +22085,8 @@
|
|
|
22050
22085
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
22051
22086
|
setCurrentDetectedDocumentType(prediction.detectedDocumentType);
|
|
22052
22087
|
setCurrentFocusScore(prediction.focusScore);
|
|
22053
|
-
|
|
22088
|
+
setIsSinglePage(prediction.singlePageDetectionThresholdMet);
|
|
22089
|
+
var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
|
|
22054
22090
|
var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
|
|
22055
22091
|
var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
|
|
22056
22092
|
if (shouldShortcutFlipAnimation) {
|
|
@@ -22061,9 +22097,9 @@
|
|
|
22061
22097
|
} : 0);
|
|
22062
22098
|
});
|
|
22063
22099
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
|
|
22064
|
-
var
|
|
22065
|
-
idFrontCaptureStartedAt =
|
|
22066
|
-
setFirstGoodFrameTime =
|
|
22100
|
+
var _30 = React.useState(null),
|
|
22101
|
+
idFrontCaptureStartedAt = _30[0],
|
|
22102
|
+
setFirstGoodFrameTime = _30[1];
|
|
22067
22103
|
React.useEffect(function () {
|
|
22068
22104
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
22069
22105
|
}, [goodFramesCount]);
|
|
@@ -22084,80 +22120,60 @@
|
|
|
22084
22120
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
22085
22121
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
22086
22122
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
22087
|
-
var
|
|
22088
|
-
countdownStartedAt =
|
|
22089
|
-
setCountdownStartedAt =
|
|
22123
|
+
var _31 = React.useState(),
|
|
22124
|
+
countdownStartedAt = _31[0],
|
|
22125
|
+
setCountdownStartedAt = _31[1];
|
|
22090
22126
|
var photoCanvas = React.useRef(null);
|
|
22091
22127
|
var frameLock = React.useRef(false);
|
|
22092
22128
|
var captureFrame = React.useCallback(function () {
|
|
22093
22129
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
22094
|
-
var frameBase64
|
|
22095
|
-
return __generator(this, function (
|
|
22096
|
-
|
|
22097
|
-
|
|
22098
|
-
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
_b.label = 1;
|
|
22107
|
-
case 1:
|
|
22108
|
-
_b.trys.push([1,, 7, 8]);
|
|
22109
|
-
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
|
|
22130
|
+
var frameBase64;
|
|
22131
|
+
return __generator(this, function (_a) {
|
|
22132
|
+
if (frameLock.current) return [2 /*return*/];
|
|
22133
|
+
frameLock.current = true;
|
|
22134
|
+
drawToCanvas(photoCanvas.current, videoRef.current);
|
|
22135
|
+
frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
|
|
22136
|
+
if (!frameBase64) {
|
|
22137
|
+
frameLock.current = false;
|
|
22138
|
+
return [2 /*return*/];
|
|
22139
|
+
}
|
|
22140
|
+
try {
|
|
22141
|
+
if (requestedAction == 'SHOW_ID_FRONT') {
|
|
22110
22142
|
if (onIdFrontImageCaptured) {
|
|
22111
22143
|
onIdFrontImageCaptured(frameBase64);
|
|
22112
22144
|
}
|
|
22113
|
-
if (
|
|
22114
|
-
_a = skipShowIdCardBack === true;
|
|
22115
|
-
if (_a) return [3 /*break*/, 3];
|
|
22116
|
-
return [4 /*yield*/, skipShowIdCardBack()];
|
|
22117
|
-
case 2:
|
|
22118
|
-
_a = _b.sent();
|
|
22119
|
-
_b.label = 3;
|
|
22120
|
-
case 3:
|
|
22121
|
-
if (_a) {
|
|
22145
|
+
if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
|
|
22122
22146
|
return [2 /*return*/, onIdCaptureComplete()];
|
|
22123
22147
|
}
|
|
22124
|
-
_b.label = 4;
|
|
22125
|
-
case 4:
|
|
22126
22148
|
setRequestedAction('FLIP_ID');
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
if (onIdBackImageCaptured) {
|
|
22131
|
-
onIdBackImageCaptured(frameBase64);
|
|
22132
|
-
}
|
|
22133
|
-
onIdCaptureComplete();
|
|
22134
|
-
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
22135
|
-
if (onIdFrontImageCaptured) {
|
|
22136
|
-
onIdFrontImageCaptured(frameBase64);
|
|
22137
|
-
}
|
|
22138
|
-
onIdCaptureComplete();
|
|
22149
|
+
} else if (requestedAction == 'SHOW_ID_BACK') {
|
|
22150
|
+
if (onIdBackImageCaptured) {
|
|
22151
|
+
onIdBackImageCaptured(frameBase64);
|
|
22139
22152
|
}
|
|
22140
|
-
|
|
22141
|
-
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
setDetectedObjects([]);
|
|
22145
|
-
setCurrentDetectionScore(0);
|
|
22146
|
-
setCurrentFocusScore(0);
|
|
22147
|
-
setGoodFramesCount(0);
|
|
22148
|
-
setCountdownStartedAt(undefined);
|
|
22149
|
-
resetBestFrame();
|
|
22150
|
-
frameLock.current = false;
|
|
22151
|
-
if (countdownTimeoutRef.current) {
|
|
22152
|
-
clearTimeout(countdownTimeoutRef.current);
|
|
22153
|
+
onIdCaptureComplete();
|
|
22154
|
+
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
22155
|
+
if (onIdFrontImageCaptured) {
|
|
22156
|
+
onIdFrontImageCaptured(frameBase64);
|
|
22153
22157
|
}
|
|
22154
|
-
|
|
22155
|
-
|
|
22156
|
-
|
|
22158
|
+
onIdCaptureComplete();
|
|
22159
|
+
}
|
|
22160
|
+
} finally {
|
|
22161
|
+
setDetectedObjects([]);
|
|
22162
|
+
setCurrentDetectionScore(0);
|
|
22163
|
+
setCurrentFocusScore(0);
|
|
22164
|
+
setGoodFramesCount(0);
|
|
22165
|
+
setCountdownStartedAt(undefined);
|
|
22166
|
+
setIsSinglePage(false);
|
|
22167
|
+
resetBestFrame();
|
|
22168
|
+
frameLock.current = false;
|
|
22169
|
+
if (countdownTimeoutRef.current) {
|
|
22170
|
+
clearTimeout(countdownTimeoutRef.current);
|
|
22171
|
+
}
|
|
22157
22172
|
}
|
|
22173
|
+
return [2 /*return*/];
|
|
22158
22174
|
});
|
|
22159
22175
|
});
|
|
22160
|
-
}, [
|
|
22176
|
+
}, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
|
|
22161
22177
|
var isFlipping = requestedAction === 'FLIP_ID';
|
|
22162
22178
|
React.useEffect(function () {
|
|
22163
22179
|
if (!isFlipping) return;
|
|
@@ -22216,9 +22232,9 @@
|
|
|
22216
22232
|
stopSelfieGuidance();
|
|
22217
22233
|
};
|
|
22218
22234
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
22219
|
-
var
|
|
22220
|
-
numFramesWithoutFaces =
|
|
22221
|
-
setNumFramesWithoutFaces =
|
|
22235
|
+
var _32 = React.useState(0),
|
|
22236
|
+
numFramesWithoutFaces = _32[0],
|
|
22237
|
+
setNumFramesWithoutFaces = _32[1];
|
|
22222
22238
|
onSelfiePredictionMade(f(React.useCallback(function (_a) {
|
|
22223
22239
|
var face = _a.face;
|
|
22224
22240
|
if (selfieModelError) return;
|
|
@@ -22234,12 +22250,12 @@
|
|
|
22234
22250
|
}
|
|
22235
22251
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
22236
22252
|
var theme = styled.useTheme();
|
|
22237
|
-
var
|
|
22253
|
+
var _33 = useTranslations(rawVerbiage, {
|
|
22238
22254
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
22239
22255
|
captureBtnText: 'Capture'
|
|
22240
22256
|
}),
|
|
22241
|
-
captureBtnText =
|
|
22242
|
-
faceNotCenteredText =
|
|
22257
|
+
captureBtnText = _33.captureBtnText,
|
|
22258
|
+
faceNotCenteredText = _33.faceNotCenteredText;
|
|
22243
22259
|
var debugScalingDetails = useDebugScalingDetails({
|
|
22244
22260
|
enabled: debugMode,
|
|
22245
22261
|
pageWidth: width,
|
|
@@ -22314,6 +22330,11 @@
|
|
|
22314
22330
|
var Countdown = styled.div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"], ["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"])));
|
|
22315
22331
|
var CaptureButtonContainer = styled.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"], ["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"])));
|
|
22316
22332
|
var CaptureButton = styled(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
|
|
22333
|
+
function evaluateShouldSkip(value) {
|
|
22334
|
+
if (value === true) return true;
|
|
22335
|
+
if (typeof value === 'function') return value();
|
|
22336
|
+
return false;
|
|
22337
|
+
}
|
|
22317
22338
|
var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
|
|
22318
22339
|
|
|
22319
22340
|
var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
|
|
@@ -22611,7 +22632,8 @@
|
|
|
22611
22632
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
22612
22633
|
focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
|
|
22613
22634
|
onModelError: onIdCaptureModelError,
|
|
22614
|
-
modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
|
|
22635
|
+
modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
|
|
22636
|
+
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
22615
22637
|
}, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
|
|
22616
22638
|
autoStart: false,
|
|
22617
22639
|
onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
|
|
@@ -22861,7 +22883,8 @@
|
|
|
22861
22883
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
22862
22884
|
focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
22863
22885
|
onModelError: idCaptureProps.onModelError,
|
|
22864
|
-
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
|
|
22886
|
+
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
|
|
22887
|
+
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
22865
22888
|
}, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
|
|
22866
22889
|
onSuccess: onIdCaptureSuccess
|
|
22867
22890
|
}))))));
|
|
@@ -23183,31 +23206,33 @@
|
|
|
23183
23206
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
23184
23207
|
_d = _a.idCaptureRequirement,
|
|
23185
23208
|
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
23186
|
-
_e = _a.
|
|
23187
|
-
|
|
23188
|
-
_f = _a.
|
|
23189
|
-
|
|
23190
|
-
_g = _a.
|
|
23191
|
-
|
|
23209
|
+
_e = _a.allowSinglePageIdCapture,
|
|
23210
|
+
allowSinglePageIdCapture = _e === void 0 ? false : _e,
|
|
23211
|
+
_f = _a.separateIdCardCaptureSequence,
|
|
23212
|
+
separateIdCardCaptureSequence = _f === void 0 ? false : _f,
|
|
23213
|
+
_g = _a.idCaptureThresholds,
|
|
23214
|
+
idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
|
|
23215
|
+
_h = _a.skipSuccessScreen,
|
|
23216
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
23192
23217
|
instructions = _a.instructions,
|
|
23193
|
-
|
|
23194
|
-
guideType =
|
|
23195
|
-
|
|
23196
|
-
guideImages =
|
|
23197
|
-
|
|
23198
|
-
portraitGuidesOnMobile =
|
|
23199
|
-
|
|
23200
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
23201
|
-
|
|
23202
|
-
modelLoadTimeoutMs =
|
|
23203
|
-
|
|
23204
|
-
forceFallbackMode =
|
|
23205
|
-
|
|
23206
|
-
allowIdCardBackToFrontCapture =
|
|
23207
|
-
|
|
23208
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
23209
|
-
|
|
23210
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
23218
|
+
_j = _a.guideType,
|
|
23219
|
+
guideType = _j === void 0 ? 'fit' : _j,
|
|
23220
|
+
_k = _a.guideImages,
|
|
23221
|
+
guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
|
|
23222
|
+
_l = _a.portraitGuidesOnMobile,
|
|
23223
|
+
portraitGuidesOnMobile = _l === void 0 ? true : _l,
|
|
23224
|
+
_m = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
23225
|
+
rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
|
|
23226
|
+
_o = _a.modelLoadTimeoutMs,
|
|
23227
|
+
modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
|
|
23228
|
+
_p = _a.forceFallbackMode,
|
|
23229
|
+
forceFallbackMode = _p === void 0 ? false : _p,
|
|
23230
|
+
_q = _a.allowIdCardBackToFrontCapture,
|
|
23231
|
+
allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
|
|
23232
|
+
_r = _a.enableOverrideWrongDocumentTypeDialog,
|
|
23233
|
+
enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
|
|
23234
|
+
_s = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
23235
|
+
allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
|
|
23211
23236
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
23212
23237
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
23213
23238
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -23221,28 +23246,28 @@
|
|
|
23221
23246
|
onUserCancel = _a.onUserCancel,
|
|
23222
23247
|
onModelError = _a.onModelError,
|
|
23223
23248
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
23224
|
-
|
|
23225
|
-
theme =
|
|
23226
|
-
|
|
23227
|
-
assets =
|
|
23228
|
-
|
|
23229
|
-
classNames =
|
|
23230
|
-
|
|
23231
|
-
colors =
|
|
23232
|
-
|
|
23233
|
-
verbiage =
|
|
23234
|
-
|
|
23235
|
-
captureSignature =
|
|
23236
|
-
|
|
23237
|
-
captureSignatureVideo =
|
|
23238
|
-
|
|
23239
|
-
captureAdditionalDocuments =
|
|
23240
|
-
|
|
23241
|
-
geolocationEnabled =
|
|
23242
|
-
|
|
23243
|
-
geolocationRequired =
|
|
23244
|
-
|
|
23245
|
-
debugMode =
|
|
23249
|
+
_t = _a.theme,
|
|
23250
|
+
theme = _t === void 0 ? 'default' : _t,
|
|
23251
|
+
_u = _a.assets,
|
|
23252
|
+
assets = _u === void 0 ? {} : _u,
|
|
23253
|
+
_v = _a.classNames,
|
|
23254
|
+
classNames = _v === void 0 ? {} : _v,
|
|
23255
|
+
_w = _a.colors,
|
|
23256
|
+
colors = _w === void 0 ? {} : _w,
|
|
23257
|
+
_x = _a.verbiage,
|
|
23258
|
+
verbiage = _x === void 0 ? {} : _x,
|
|
23259
|
+
_y = _a.captureSignature,
|
|
23260
|
+
captureSignature = _y === void 0 ? false : _y,
|
|
23261
|
+
_z = _a.captureSignatureVideo,
|
|
23262
|
+
captureSignatureVideo = _z === void 0 ? false : _z,
|
|
23263
|
+
_0 = _a.captureAdditionalDocuments,
|
|
23264
|
+
captureAdditionalDocuments = _0 === void 0 ? [] : _0,
|
|
23265
|
+
_1 = _a.geolocationEnabled,
|
|
23266
|
+
geolocationEnabled = _1 === void 0 ? true : _1,
|
|
23267
|
+
_2 = _a.geolocationRequired,
|
|
23268
|
+
geolocationRequired = _2 === void 0 ? false : _2,
|
|
23269
|
+
_3 = _a.debugMode,
|
|
23270
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
23246
23271
|
useLanguage(lang);
|
|
23247
23272
|
useDebugLogging(debugMode);
|
|
23248
23273
|
var idCaptureProps = React.useMemo(function () {
|
|
@@ -23252,6 +23277,7 @@
|
|
|
23252
23277
|
onModelError: onModelError,
|
|
23253
23278
|
precapturedDocuments: precapturedDocuments,
|
|
23254
23279
|
captureRequirement: idCaptureRequirement,
|
|
23280
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture,
|
|
23255
23281
|
separateIdCardCaptureSequence: separateIdCardCaptureSequence,
|
|
23256
23282
|
thresholds: idCaptureThresholds,
|
|
23257
23283
|
skipSuccessScreen: skipSuccessScreen,
|
|
@@ -23274,7 +23300,7 @@
|
|
|
23274
23300
|
verbiage: verbiage,
|
|
23275
23301
|
debugMode: debugMode
|
|
23276
23302
|
};
|
|
23277
|
-
}, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, allowIdCardBackToFrontCapture, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
|
|
23303
|
+
}, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, allowSinglePageIdCapture, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, allowIdCardBackToFrontCapture, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
|
|
23278
23304
|
var additionalDocumentCaptureProps = React.useMemo(function () {
|
|
23279
23305
|
return {
|
|
23280
23306
|
documents: captureAdditionalDocuments,
|