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