idmission-web-sdk 2.2.63 → 2.2.65
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/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 +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 +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 +364 -332
- 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 +364 -332
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +364 -332
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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.65';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -8311,7 +8311,7 @@
|
|
|
8311
8311
|
|
|
8312
8312
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
8313
8313
|
|
|
8314
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
8314
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241212_131026.tflite");
|
|
8315
8315
|
|
|
8316
8316
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
8317
8317
|
|
|
@@ -8330,6 +8330,10 @@
|
|
|
8330
8330
|
passport: {
|
|
8331
8331
|
desktop: 0,
|
|
8332
8332
|
mobile: 0.3
|
|
8333
|
+
},
|
|
8334
|
+
singlePage: {
|
|
8335
|
+
desktop: 0,
|
|
8336
|
+
mobile: 0.3
|
|
8333
8337
|
}
|
|
8334
8338
|
};
|
|
8335
8339
|
var classifier = null;
|
|
@@ -8955,16 +8959,19 @@
|
|
|
8955
8959
|
idCardFront: 0.6,
|
|
8956
8960
|
idCardBack: 0.6,
|
|
8957
8961
|
passport: 0.4,
|
|
8962
|
+
singlePage: 0.4,
|
|
8958
8963
|
stability: {
|
|
8959
8964
|
idCardFront: 0.85,
|
|
8960
8965
|
idCardBack: 0.85,
|
|
8961
|
-
passport: 0.5
|
|
8966
|
+
passport: 0.5,
|
|
8967
|
+
singlePage: 0.5
|
|
8962
8968
|
}
|
|
8963
8969
|
};
|
|
8964
8970
|
var documentTypeDisplayNames = {
|
|
8965
8971
|
idCardFront: 'ID card front',
|
|
8966
8972
|
idCardBack: 'ID card back',
|
|
8967
8973
|
passport: 'Passport',
|
|
8974
|
+
singlePage: 'Single page',
|
|
8968
8975
|
none: 'None'
|
|
8969
8976
|
};
|
|
8970
8977
|
var detector = null;
|
|
@@ -9153,7 +9160,7 @@
|
|
|
9153
9160
|
right: 20
|
|
9154
9161
|
};
|
|
9155
9162
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
9156
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9163
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
9157
9164
|
if (boundaries === void 0) {
|
|
9158
9165
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
9159
9166
|
}
|
|
@@ -9204,18 +9211,25 @@
|
|
|
9204
9211
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
9205
9212
|
return obj.label === 'Passport page';
|
|
9206
9213
|
});
|
|
9214
|
+
var bestSinglePage = detectedObjects.find(function (obj) {
|
|
9215
|
+
return obj.label === 'Single page';
|
|
9216
|
+
});
|
|
9207
9217
|
var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
|
|
9208
9218
|
var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
|
|
9209
9219
|
var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
|
|
9210
|
-
var
|
|
9211
|
-
var
|
|
9212
|
-
var
|
|
9213
|
-
var
|
|
9214
|
-
var
|
|
9215
|
-
var
|
|
9220
|
+
var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
|
|
9221
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
|
|
9222
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
|
|
9223
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
|
|
9224
|
+
var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
|
|
9225
|
+
var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
9226
|
+
var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
9227
|
+
var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
|
|
9216
9228
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
9217
9229
|
var detectedDocumentType = 'none';
|
|
9218
|
-
if (
|
|
9230
|
+
if (singlePageDetectionThresholdMet) {
|
|
9231
|
+
detectedDocumentType = 'singlePage';
|
|
9232
|
+
} else if (passportDetectionThresholdMet) {
|
|
9219
9233
|
detectedDocumentType = 'passport';
|
|
9220
9234
|
} else if (idCardBackDetectionThresholdMet) {
|
|
9221
9235
|
detectedDocumentType = 'idCardBack';
|
|
@@ -9229,12 +9243,12 @@
|
|
|
9229
9243
|
var documentIsStable = false;
|
|
9230
9244
|
var documentTooClose = false;
|
|
9231
9245
|
if (bestDocument) {
|
|
9232
|
-
var
|
|
9233
|
-
docWidth =
|
|
9234
|
-
docHeight =
|
|
9246
|
+
var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
9247
|
+
docWidth = _q[0],
|
|
9248
|
+
docHeight = _q[1];
|
|
9235
9249
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
9236
9250
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
9237
|
-
var thresholdSet = (
|
|
9251
|
+
var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
|
|
9238
9252
|
var threshold_1 = thresholdSet[detectedDocumentType];
|
|
9239
9253
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
9240
9254
|
trackBox(bestDocument.box, framesNeeded);
|
|
@@ -9256,6 +9270,8 @@
|
|
|
9256
9270
|
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
9257
9271
|
passportDetectionScore: passportDetectionScore,
|
|
9258
9272
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
9273
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
9274
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
9259
9275
|
bestDocument: bestDocument,
|
|
9260
9276
|
documentInBounds: documentInBounds,
|
|
9261
9277
|
documentTooClose: documentTooClose,
|
|
@@ -10203,37 +10219,39 @@
|
|
|
10203
10219
|
});
|
|
10204
10220
|
function IdCaptureModelsProviderInner(_a) {
|
|
10205
10221
|
var children = _a.children,
|
|
10206
|
-
onModelError = _a.onModelError
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10222
|
+
onModelError = _a.onModelError,
|
|
10223
|
+
_b = _a.allowSinglePageIdCapture,
|
|
10224
|
+
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
10225
|
+
var _c = React.useContext(DocumentDetectionModelContext),
|
|
10226
|
+
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
10227
|
+
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
10228
|
+
startDocumentDetection = _c.startDocumentDetection,
|
|
10229
|
+
stopDocumentDetection = _c.stopDocumentDetection,
|
|
10230
|
+
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
10231
|
+
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
10232
|
+
onDocumentDetected = _c.onDocumentDetected,
|
|
10233
|
+
detectionTime = _c.detectionTime,
|
|
10234
|
+
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
10235
|
+
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
10236
|
+
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
10237
|
+
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
10238
|
+
documentDetectionModelError = _c.documentDetectionModelError;
|
|
10239
|
+
var _d = React.useContext(FocusModelContext),
|
|
10240
|
+
focusModelReady = _d.focusModelReady,
|
|
10241
|
+
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
10242
|
+
makeFocusPrediction = _d.makeFocusPrediction,
|
|
10243
|
+
focusThresholds = _d.focusThresholds,
|
|
10244
|
+
setFocusThresholds = _d.setFocusThresholds,
|
|
10245
|
+
focusPredictionTime = _d.focusPredictionTime,
|
|
10246
|
+
focusModelError = _d.focusModelError;
|
|
10229
10247
|
var onPredictionHandler = React.useRef();
|
|
10230
10248
|
var bestFrameDetails = React.useRef(null);
|
|
10231
10249
|
var bestPredictionCanvas = React.useRef(null);
|
|
10232
10250
|
var bestFocusScore = React.useRef(0);
|
|
10233
10251
|
var stopDetection = React.useRef(0);
|
|
10234
|
-
var
|
|
10235
|
-
requiredDocumentType =
|
|
10236
|
-
setRequiredDocumentType =
|
|
10252
|
+
var _e = React.useState('none'),
|
|
10253
|
+
requiredDocumentType = _e[0],
|
|
10254
|
+
setRequiredDocumentType = _e[1];
|
|
10237
10255
|
var thresholds = React.useMemo(function () {
|
|
10238
10256
|
return _assign(_assign({}, documentDetectionThresholds), {
|
|
10239
10257
|
focus: focusThresholds
|
|
@@ -10251,34 +10269,42 @@
|
|
|
10251
10269
|
var _this = this;
|
|
10252
10270
|
onDocumentDetected(function (prediction) {
|
|
10253
10271
|
return __awaiter(_this, void 0, void 0, function () {
|
|
10254
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
10255
|
-
var _a, _b, _c, _d, _e, _f;
|
|
10256
|
-
return __generator(this, function (
|
|
10272
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
10273
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10274
|
+
return __generator(this, function (_h) {
|
|
10257
10275
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
10258
10276
|
stopDetectionAtStart = stopDetection.current;
|
|
10259
10277
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
10260
|
-
|
|
10278
|
+
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
10279
|
+
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
10280
|
+
prediction.detectedDocumentType = 'passport';
|
|
10281
|
+
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
10282
|
+
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
10283
|
+
prediction.singlePageDetectionScore = 0;
|
|
10284
|
+
prediction.singlePageDetectionThresholdMet = false;
|
|
10285
|
+
}
|
|
10286
|
+
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'));
|
|
10261
10287
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
10262
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (
|
|
10288
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
10263
10289
|
if (focusPrediction) {
|
|
10264
10290
|
focusScore = focusPrediction.score;
|
|
10265
10291
|
focusPredictionTime = focusPrediction.predictionTime;
|
|
10266
10292
|
}
|
|
10267
|
-
focusThresholdSet = (
|
|
10268
|
-
focusThreshold = (
|
|
10293
|
+
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
10294
|
+
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;
|
|
10269
10295
|
focusThresholdMet = focusScore >= focusThreshold;
|
|
10270
10296
|
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
10271
10297
|
bestFocusScore.current = focusScore;
|
|
10272
10298
|
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
10273
10299
|
bestFrameDetails.current = {
|
|
10274
|
-
boundingBox: (
|
|
10300
|
+
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
10275
10301
|
documentType: prediction.detectedDocumentType,
|
|
10276
10302
|
detectionScore: prediction.detectionScore,
|
|
10277
10303
|
focusScore: focusScore
|
|
10278
10304
|
};
|
|
10279
10305
|
}
|
|
10280
10306
|
}
|
|
10281
|
-
(
|
|
10307
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
10282
10308
|
focusScore: focusScore,
|
|
10283
10309
|
focusPredictionTime: focusPredictionTime,
|
|
10284
10310
|
focusThresholdMet: focusThresholdMet
|
|
@@ -10287,7 +10313,7 @@
|
|
|
10287
10313
|
});
|
|
10288
10314
|
});
|
|
10289
10315
|
});
|
|
10290
|
-
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
10316
|
+
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
10291
10317
|
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
10292
10318
|
React.useEffect(function handleModelErrors() {
|
|
10293
10319
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
@@ -10301,9 +10327,9 @@
|
|
|
10301
10327
|
canvas: bestPredictionCanvas.current
|
|
10302
10328
|
});
|
|
10303
10329
|
}, []);
|
|
10304
|
-
var
|
|
10305
|
-
canvasKey =
|
|
10306
|
-
setCanvasKey =
|
|
10330
|
+
var _f = React.useState(0),
|
|
10331
|
+
canvasKey = _f[0],
|
|
10332
|
+
setCanvasKey = _f[1];
|
|
10307
10333
|
var resetBestFrame = React.useCallback(function () {
|
|
10308
10334
|
stopDetection.current += 1;
|
|
10309
10335
|
setCanvasKey(function (n) {
|
|
@@ -10433,9 +10459,9 @@
|
|
|
10433
10459
|
});
|
|
10434
10460
|
}
|
|
10435
10461
|
|
|
10436
|
-
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
|
|
10462
|
+
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
10437
10463
|
|
|
10438
|
-
var
|
|
10464
|
+
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
10439
10465
|
idCardFront: ['idCardFront'],
|
|
10440
10466
|
idCardBack: ['idCardBack'],
|
|
10441
10467
|
passport: ['passport'],
|
|
@@ -10443,13 +10469,35 @@
|
|
|
10443
10469
|
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
10444
10470
|
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
10445
10471
|
};
|
|
10446
|
-
function
|
|
10472
|
+
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
10447
10473
|
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
10448
|
-
return
|
|
10474
|
+
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
10449
10475
|
}
|
|
10450
|
-
function
|
|
10476
|
+
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
10451
10477
|
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
10452
|
-
return
|
|
10478
|
+
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
10479
|
+
}
|
|
10480
|
+
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
10481
|
+
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
10482
|
+
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
10483
|
+
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
10484
|
+
console.log({
|
|
10485
|
+
capturedDocuments: capturedDocuments,
|
|
10486
|
+
captureRequirement: captureRequirement
|
|
10487
|
+
});
|
|
10488
|
+
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
10489
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
10490
|
+
return !v.includes('idCard');
|
|
10491
|
+
});
|
|
10492
|
+
}
|
|
10493
|
+
if (isIdCardOrPassport) {
|
|
10494
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
10495
|
+
return v !== 'passport';
|
|
10496
|
+
});
|
|
10497
|
+
}
|
|
10498
|
+
return acceptedTypes.filter(function (v) {
|
|
10499
|
+
return !(v in capturedDocuments);
|
|
10500
|
+
});
|
|
10453
10501
|
}
|
|
10454
10502
|
|
|
10455
10503
|
var initialState$4 = {
|
|
@@ -10488,6 +10536,8 @@
|
|
|
10488
10536
|
idCardBackDetectionThresholdMet: false,
|
|
10489
10537
|
passportDetectionScore: 0,
|
|
10490
10538
|
passportDetectionThresholdMet: false,
|
|
10539
|
+
singlePageDetectionScore: 0,
|
|
10540
|
+
singlePageDetectionThresholdMet: false,
|
|
10491
10541
|
focusScore: 0,
|
|
10492
10542
|
focusThresholdMet: false,
|
|
10493
10543
|
isGoodFrame: false,
|
|
@@ -10503,6 +10553,7 @@
|
|
|
10503
10553
|
capturedDocuments: {},
|
|
10504
10554
|
captureRequirement: 'idCardOrPassport',
|
|
10505
10555
|
requestedDocumentType: 'idCardFront',
|
|
10556
|
+
allowSinglePageIdCapture: false,
|
|
10506
10557
|
allowIdCardBackToFrontCapture: false,
|
|
10507
10558
|
operationStartedAt: null,
|
|
10508
10559
|
captureStartedAt: null
|
|
@@ -10517,11 +10568,13 @@
|
|
|
10517
10568
|
var _c = action.payload,
|
|
10518
10569
|
captureRequirement = _c.captureRequirement,
|
|
10519
10570
|
precapturedDocuments = _c.precapturedDocuments,
|
|
10571
|
+
allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
|
|
10520
10572
|
allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
|
|
10521
10573
|
enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
|
|
10522
10574
|
allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
|
|
10523
10575
|
var newState = _assign(_assign({}, state), {
|
|
10524
10576
|
captureRequirement: captureRequirement,
|
|
10577
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
10525
10578
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
10526
10579
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
10527
10580
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
@@ -10589,6 +10642,8 @@
|
|
|
10589
10642
|
idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
|
|
10590
10643
|
passportDetectionScore = _d.passportDetectionScore,
|
|
10591
10644
|
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
10645
|
+
singlePageDetectionScore = _d.singlePageDetectionScore,
|
|
10646
|
+
singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
|
|
10592
10647
|
bestDocument = _d.bestDocument,
|
|
10593
10648
|
documentInBounds = _d.documentInBounds,
|
|
10594
10649
|
documentTooClose = _d.documentTooClose,
|
|
@@ -10609,7 +10664,8 @@
|
|
|
10609
10664
|
}
|
|
10610
10665
|
}
|
|
10611
10666
|
}
|
|
10612
|
-
var
|
|
10667
|
+
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
10668
|
+
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
10613
10669
|
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
10614
10670
|
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
10615
10671
|
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
@@ -10669,6 +10725,8 @@
|
|
|
10669
10725
|
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
10670
10726
|
passportDetectionScore: passportDetectionScore,
|
|
10671
10727
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
10728
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
10729
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
10672
10730
|
focusScore: focusScore,
|
|
10673
10731
|
focusThresholdMet: focusThresholdMet,
|
|
10674
10732
|
isGoodFrame: isGoodFrame,
|
|
@@ -10706,7 +10764,7 @@
|
|
|
10706
10764
|
});
|
|
10707
10765
|
case 'documentCaptured':
|
|
10708
10766
|
{
|
|
10709
|
-
var
|
|
10767
|
+
var newState = _assign(_assign({}, state), {
|
|
10710
10768
|
capturing: false,
|
|
10711
10769
|
captureFailed: false,
|
|
10712
10770
|
allowOverrideFlipRequirement: false,
|
|
@@ -10715,64 +10773,42 @@
|
|
|
10715
10773
|
wrongDocumentTypePredictions: 0,
|
|
10716
10774
|
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
10717
10775
|
});
|
|
10718
|
-
var remainingRequirements =
|
|
10719
|
-
return !(v in newState_1.capturedDocuments);
|
|
10720
|
-
});
|
|
10721
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
10722
|
-
if (state.requestedDocumentType === 'passport') {
|
|
10723
|
-
remainingRequirements = [];
|
|
10724
|
-
} else {
|
|
10725
|
-
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
10726
|
-
return v !== 'passport';
|
|
10727
|
-
});
|
|
10728
|
-
}
|
|
10729
|
-
}
|
|
10776
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
10730
10777
|
if (remainingRequirements.length === 0) {
|
|
10731
|
-
|
|
10778
|
+
newState.captureState = 'complete';
|
|
10732
10779
|
} else {
|
|
10733
|
-
|
|
10734
|
-
if (state.requestedDocumentType === 'idCardFront' &&
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10780
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
10781
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
10782
|
+
newState.captureState = 'requestingFlip';
|
|
10783
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
10784
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
10785
|
+
newState.passportDetectionThresholdMet = false;
|
|
10786
|
+
newState.wrongDocumentTypePredictions = 0;
|
|
10740
10787
|
}
|
|
10741
10788
|
}
|
|
10742
|
-
return
|
|
10789
|
+
return newState;
|
|
10743
10790
|
}
|
|
10744
10791
|
case 'documentCapturedManually':
|
|
10745
10792
|
{
|
|
10746
|
-
var
|
|
10793
|
+
var newState = _assign(_assign({}, state), {
|
|
10747
10794
|
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
|
|
10748
10795
|
width: 0,
|
|
10749
10796
|
height: 0
|
|
10750
10797
|
}), _b))
|
|
10751
10798
|
});
|
|
10752
|
-
var remainingRequirements =
|
|
10753
|
-
return !(v in newState_2.capturedDocuments);
|
|
10754
|
-
});
|
|
10755
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
10756
|
-
if (state.requestedDocumentType === 'passport') {
|
|
10757
|
-
remainingRequirements = [];
|
|
10758
|
-
} else {
|
|
10759
|
-
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
10760
|
-
return v !== 'passport';
|
|
10761
|
-
});
|
|
10762
|
-
}
|
|
10763
|
-
}
|
|
10799
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
10764
10800
|
if (remainingRequirements.length === 0) {
|
|
10765
|
-
|
|
10801
|
+
newState.captureState = 'complete';
|
|
10766
10802
|
} else {
|
|
10767
|
-
|
|
10768
|
-
if (state.requestedDocumentType === 'idCardFront' &&
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
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;
|
|
10773
10809
|
}
|
|
10774
10810
|
}
|
|
10775
|
-
return
|
|
10811
|
+
return newState;
|
|
10776
10812
|
}
|
|
10777
10813
|
case 'flipRequestCompleted':
|
|
10778
10814
|
return _assign(_assign({}, state), {
|
|
@@ -14163,7 +14199,7 @@
|
|
|
14163
14199
|
imageUrl: imageUrl
|
|
14164
14200
|
}
|
|
14165
14201
|
});
|
|
14166
|
-
var capturedDocumentType = documentType
|
|
14202
|
+
var capturedDocumentType = documentType;
|
|
14167
14203
|
setTimeout(function () {
|
|
14168
14204
|
var _a;
|
|
14169
14205
|
var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
|
|
@@ -14230,7 +14266,7 @@
|
|
|
14230
14266
|
scaling: debugScalingDetails,
|
|
14231
14267
|
flipX: !isRearFacing
|
|
14232
14268
|
});
|
|
14233
|
-
}))), 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")))));
|
|
14269
|
+
}))), 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")))));
|
|
14234
14270
|
};
|
|
14235
14271
|
var timeSince = function timeSince(t) {
|
|
14236
14272
|
if (!t) return 0;
|
|
@@ -15343,15 +15379,8 @@
|
|
|
15343
15379
|
_e = _a.debugMode,
|
|
15344
15380
|
debugMode = _e === void 0 ? false : _e;
|
|
15345
15381
|
var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
|
|
15346
|
-
var idCardFront = capturedDocuments.idCardFront,
|
|
15347
|
-
idCardBack = capturedDocuments.idCardBack,
|
|
15348
|
-
passport = capturedDocuments.passport;
|
|
15349
15382
|
var verbiage = useTranslations(rawVerbiage, {
|
|
15350
15383
|
headingText: 'ID Capture Successful',
|
|
15351
|
-
idCardFrontText: 'ID Card Front',
|
|
15352
|
-
idCardBackText: 'ID Card Back',
|
|
15353
|
-
passportText: 'Passport',
|
|
15354
|
-
instructionText: 'Verify the entire ID was captured clearly with no glare.',
|
|
15355
15384
|
retryText: 'Retry',
|
|
15356
15385
|
submittingText: 'Submitting...',
|
|
15357
15386
|
submitText: 'Done'
|
|
@@ -15368,25 +15397,16 @@
|
|
|
15368
15397
|
className: classNames.imageContainer
|
|
15369
15398
|
}, /*#__PURE__*/React.createElement(ImageRow, {
|
|
15370
15399
|
className: classNames.imageRow
|
|
15371
|
-
},
|
|
15372
|
-
|
|
15373
|
-
|
|
15374
|
-
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15381
|
-
className: classNames.image,
|
|
15382
|
-
alt: verbiage.idCardBackText
|
|
15383
|
-
}), 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, {
|
|
15384
|
-
className: classNames.imageCol
|
|
15385
|
-
}, /*#__PURE__*/React.createElement(StyledImage, {
|
|
15386
|
-
image: passport,
|
|
15387
|
-
className: classNames.image,
|
|
15388
|
-
alt: verbiage.passportText
|
|
15389
|
-
}), 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, {
|
|
15400
|
+
}, Object.values(capturedDocuments).map(function (doc) {
|
|
15401
|
+
return /*#__PURE__*/React.createElement(ImageCol$1, {
|
|
15402
|
+
className: classNames.imageCol,
|
|
15403
|
+
key: doc.imageData
|
|
15404
|
+
}, /*#__PURE__*/React.createElement(StyledImage, {
|
|
15405
|
+
image: doc,
|
|
15406
|
+
className: classNames.image,
|
|
15407
|
+
alt: doc.documentType
|
|
15408
|
+
}), 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)))));
|
|
15409
|
+
}))), /*#__PURE__*/React.createElement(ButtonsColumn, {
|
|
15390
15410
|
className: classNames.buttonsRow
|
|
15391
15411
|
}, /*#__PURE__*/React.createElement(WideButton, {
|
|
15392
15412
|
className: classNames.submitBtn,
|
|
@@ -15405,7 +15425,7 @@
|
|
|
15405
15425
|
};
|
|
15406
15426
|
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"])));
|
|
15407
15427
|
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"])));
|
|
15408
|
-
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
|
|
15428
|
+
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"])));
|
|
15409
15429
|
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"])));
|
|
15410
15430
|
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"])));
|
|
15411
15431
|
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"])));
|
|
@@ -17113,8 +17133,8 @@
|
|
|
17113
17133
|
var _j = React.useState(silentFallback),
|
|
17114
17134
|
useFallback = _j[0],
|
|
17115
17135
|
setUseFallback = _j[1];
|
|
17116
|
-
var
|
|
17117
|
-
var
|
|
17136
|
+
var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
17137
|
+
var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
17118
17138
|
var _k = useFileState(),
|
|
17119
17139
|
rawFile = _k.rawFile,
|
|
17120
17140
|
fileInputOnChange = _k.fileInputOnChange;
|
|
@@ -17127,7 +17147,7 @@
|
|
|
17127
17147
|
var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
|
|
17128
17148
|
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.';
|
|
17129
17149
|
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.';
|
|
17130
|
-
var descriptionText = "On-device capture guidance failed, please capture ".concat(
|
|
17150
|
+
var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
|
|
17131
17151
|
var verbiage = useTranslations(rawVerbiage, {
|
|
17132
17152
|
headingText: "We're having some trouble.",
|
|
17133
17153
|
descriptionText: descriptionText,
|
|
@@ -17201,7 +17221,7 @@
|
|
|
17201
17221
|
alt: "",
|
|
17202
17222
|
className: classNames.image
|
|
17203
17223
|
}));
|
|
17204
|
-
}))), images.length <
|
|
17224
|
+
}))), images.length < minImageCount && ( /*#__PURE__*/React.createElement(Instruction, {
|
|
17205
17225
|
className: classNames.instruction
|
|
17206
17226
|
}, instructionText)), /*#__PURE__*/React.createElement("input", {
|
|
17207
17227
|
ref: fileInput,
|
|
@@ -17212,7 +17232,7 @@
|
|
|
17212
17232
|
hidden: true
|
|
17213
17233
|
}), /*#__PURE__*/React.createElement(StyledButtonsRow$8, {
|
|
17214
17234
|
className: classNames.buttonsRow
|
|
17215
|
-
}, images.length <
|
|
17235
|
+
}, images.length < maxImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
|
|
17216
17236
|
variant: images.length > 0 ? 'secondary' : 'positive',
|
|
17217
17237
|
className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
|
|
17218
17238
|
colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
|
|
@@ -17225,7 +17245,7 @@
|
|
|
17225
17245
|
setDocumentToCapture(instructionText);
|
|
17226
17246
|
}
|
|
17227
17247
|
}
|
|
17228
|
-
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >=
|
|
17248
|
+
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
|
|
17229
17249
|
variant: "positive",
|
|
17230
17250
|
className: classNames.doneBtn,
|
|
17231
17251
|
colors: colors.doneBtn,
|
|
@@ -17272,79 +17292,82 @@
|
|
|
17272
17292
|
precapturedDocuments = _a.precapturedDocuments,
|
|
17273
17293
|
_j = _a.captureRequirement,
|
|
17274
17294
|
captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
|
|
17275
|
-
_k = _a.
|
|
17276
|
-
|
|
17277
|
-
_l = _a.
|
|
17278
|
-
|
|
17279
|
-
_m = _a.
|
|
17280
|
-
|
|
17295
|
+
_k = _a.allowSinglePageIdCapture,
|
|
17296
|
+
allowSinglePageIdCapture = _k === void 0 ? false : _k,
|
|
17297
|
+
_l = _a.separateIdCardCaptureSequence,
|
|
17298
|
+
separateIdCardCaptureSequence = _l === void 0 ? false : _l,
|
|
17299
|
+
_m = _a.thresholds,
|
|
17300
|
+
thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
|
|
17301
|
+
_o = _a.skipSuccessScreen,
|
|
17302
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
17281
17303
|
instructions = _a.instructions,
|
|
17282
|
-
|
|
17283
|
-
releaseCameraAccessOnExit =
|
|
17284
|
-
|
|
17285
|
-
guideType =
|
|
17286
|
-
|
|
17287
|
-
portraitGuidesOnMobile =
|
|
17288
|
-
|
|
17289
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
17290
|
-
|
|
17291
|
-
silentFallback =
|
|
17292
|
-
|
|
17293
|
-
forceFallbackMode =
|
|
17294
|
-
|
|
17295
|
-
allowIdCardBackToFrontCapture =
|
|
17296
|
-
|
|
17297
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
17298
|
-
|
|
17299
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
17300
|
-
|
|
17301
|
-
guideImages =
|
|
17302
|
-
|
|
17303
|
-
assets =
|
|
17304
|
-
|
|
17305
|
-
classNames =
|
|
17306
|
-
|
|
17307
|
-
colors =
|
|
17308
|
-
|
|
17309
|
-
verbiage =
|
|
17310
|
-
|
|
17311
|
-
debugMode =
|
|
17312
|
-
var
|
|
17313
|
-
state =
|
|
17314
|
-
dispatch =
|
|
17315
|
-
var
|
|
17316
|
-
cameraAccessDenied =
|
|
17317
|
-
requestCameraAccess =
|
|
17318
|
-
releaseCameraAccess =
|
|
17319
|
-
var
|
|
17320
|
-
overlayDismissed =
|
|
17321
|
-
setOverlayDismissed =
|
|
17322
|
-
var
|
|
17323
|
-
submissionStatus =
|
|
17324
|
-
setIdFrontImage =
|
|
17325
|
-
setIdBackImage =
|
|
17326
|
-
setPassportImage =
|
|
17327
|
-
logIdFrontCaptureAttempt =
|
|
17328
|
-
logIdBackCaptureAttempt =
|
|
17329
|
-
var
|
|
17330
|
-
start =
|
|
17331
|
-
stop =
|
|
17332
|
-
onPredictionMade =
|
|
17333
|
-
setRequiredDocumentType =
|
|
17334
|
-
modelError =
|
|
17335
|
-
resetBestFrame =
|
|
17304
|
+
_p = _a.releaseCameraAccessOnExit,
|
|
17305
|
+
releaseCameraAccessOnExit = _p === void 0 ? true : _p,
|
|
17306
|
+
_q = _a.guideType,
|
|
17307
|
+
guideType = _q === void 0 ? 'fit' : _q,
|
|
17308
|
+
_r = _a.portraitGuidesOnMobile,
|
|
17309
|
+
portraitGuidesOnMobile = _r === void 0 ? true : _r,
|
|
17310
|
+
_s = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
17311
|
+
rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
17312
|
+
_t = _a.silentFallback,
|
|
17313
|
+
silentFallback = _t === void 0 ? false : _t,
|
|
17314
|
+
_u = _a.forceFallbackMode,
|
|
17315
|
+
forceFallbackMode = _u === void 0 ? false : _u,
|
|
17316
|
+
_v = _a.allowIdCardBackToFrontCapture,
|
|
17317
|
+
allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
|
|
17318
|
+
_w = _a.enableOverrideWrongDocumentTypeDialog,
|
|
17319
|
+
enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
|
|
17320
|
+
_x = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
17321
|
+
allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
|
|
17322
|
+
_y = _a.guideImages,
|
|
17323
|
+
guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
|
|
17324
|
+
_z = _a.assets,
|
|
17325
|
+
assets = _z === void 0 ? {} : _z,
|
|
17326
|
+
_0 = _a.classNames,
|
|
17327
|
+
classNames = _0 === void 0 ? {} : _0,
|
|
17328
|
+
_1 = _a.colors,
|
|
17329
|
+
colors = _1 === void 0 ? {} : _1,
|
|
17330
|
+
_2 = _a.verbiage,
|
|
17331
|
+
verbiage = _2 === void 0 ? {} : _2,
|
|
17332
|
+
_3 = _a.debugMode,
|
|
17333
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
17334
|
+
var _4 = useIdCaptureState(),
|
|
17335
|
+
state = _4[0],
|
|
17336
|
+
dispatch = _4[1];
|
|
17337
|
+
var _5 = useCameraStore(),
|
|
17338
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
17339
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
17340
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
17341
|
+
var _6 = React.useState(false),
|
|
17342
|
+
overlayDismissed = _6[0],
|
|
17343
|
+
setOverlayDismissed = _6[1];
|
|
17344
|
+
var _7 = React.useContext(SubmissionContext),
|
|
17345
|
+
submissionStatus = _7.submissionStatus,
|
|
17346
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
17347
|
+
setIdBackImage = _7.setIdBackImage,
|
|
17348
|
+
setPassportImage = _7.setPassportImage,
|
|
17349
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
17350
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
17351
|
+
var _8 = React.useContext(IdCaptureModelsContext),
|
|
17352
|
+
start = _8.start,
|
|
17353
|
+
stop = _8.stop,
|
|
17354
|
+
onPredictionMade = _8.onPredictionMade,
|
|
17355
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
17356
|
+
modelError = _8.modelError,
|
|
17357
|
+
resetBestFrame = _8.resetBestFrame;
|
|
17336
17358
|
React.useEffect(function () {
|
|
17337
17359
|
dispatch({
|
|
17338
17360
|
type: 'configureWizard',
|
|
17339
17361
|
payload: {
|
|
17340
17362
|
captureRequirement: captureRequirement,
|
|
17341
17363
|
precapturedDocuments: precapturedDocuments,
|
|
17364
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture,
|
|
17342
17365
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
17343
17366
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
17344
17367
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
17345
17368
|
}
|
|
17346
17369
|
});
|
|
17347
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
17370
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
17348
17371
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
17349
17372
|
React.useEffect(function () {
|
|
17350
17373
|
documentCount && resetBestFrame();
|
|
@@ -17402,13 +17425,16 @@
|
|
|
17402
17425
|
var _a = state.capturedDocuments,
|
|
17403
17426
|
idCardFront = _a.idCardFront,
|
|
17404
17427
|
idCardBack = _a.idCardBack,
|
|
17405
|
-
passport = _a.passport
|
|
17428
|
+
passport = _a.passport,
|
|
17429
|
+
singlePage = _a.singlePage;
|
|
17406
17430
|
var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
|
|
17407
17431
|
var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
|
|
17408
17432
|
var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
|
|
17433
|
+
var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
|
|
17409
17434
|
idFrontImage && setIdFrontImage(idFrontImage);
|
|
17410
17435
|
idBackImage && setIdBackImage(idBackImage);
|
|
17411
17436
|
passportImage && setPassportImage(passportImage);
|
|
17437
|
+
singlePageImage && setIdFrontImage(singlePageImage);
|
|
17412
17438
|
releaseCameraAccessOnExit && releaseCameraAccess();
|
|
17413
17439
|
setTimeout(function () {
|
|
17414
17440
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
|
|
@@ -17424,9 +17450,9 @@
|
|
|
17424
17450
|
type: 'resetWizard'
|
|
17425
17451
|
});
|
|
17426
17452
|
}, [dispatch]);
|
|
17427
|
-
var
|
|
17428
|
-
attempt =
|
|
17429
|
-
setAttempt =
|
|
17453
|
+
var _9 = React.useState(0),
|
|
17454
|
+
attempt = _9[0],
|
|
17455
|
+
setAttempt = _9[1];
|
|
17430
17456
|
var onExit = React.useCallback(function () {
|
|
17431
17457
|
releaseCameraAccess();
|
|
17432
17458
|
setOverlayDismissed(false);
|
|
@@ -17517,9 +17543,9 @@
|
|
|
17517
17543
|
});
|
|
17518
17544
|
});
|
|
17519
17545
|
}, [dispatch]);
|
|
17520
|
-
var
|
|
17521
|
-
progressStarted =
|
|
17522
|
-
setProgressStarted =
|
|
17546
|
+
var _10 = React.useState(false),
|
|
17547
|
+
progressStarted = _10[0],
|
|
17548
|
+
setProgressStarted = _10[1];
|
|
17523
17549
|
React.useEffect(function () {
|
|
17524
17550
|
if (state.captureState === 'capturing') {
|
|
17525
17551
|
setProgressStarted(false);
|
|
@@ -21811,7 +21837,8 @@
|
|
|
21811
21837
|
detection: {
|
|
21812
21838
|
idCardFront: 0.4,
|
|
21813
21839
|
idCardBack: 0.5,
|
|
21814
|
-
passport: 0.3
|
|
21840
|
+
passport: 0.3,
|
|
21841
|
+
singlePage: 0.3
|
|
21815
21842
|
},
|
|
21816
21843
|
focus: {
|
|
21817
21844
|
idCardFront: {
|
|
@@ -21825,12 +21852,17 @@
|
|
|
21825
21852
|
passport: {
|
|
21826
21853
|
desktop: 0,
|
|
21827
21854
|
mobile: 0
|
|
21855
|
+
},
|
|
21856
|
+
singlePage: {
|
|
21857
|
+
desktop: 0,
|
|
21858
|
+
mobile: 0
|
|
21828
21859
|
}
|
|
21829
21860
|
},
|
|
21830
21861
|
goodFrames: {
|
|
21831
21862
|
idCardFront: 1,
|
|
21832
21863
|
idCardBack: 1,
|
|
21833
|
-
passport: 1
|
|
21864
|
+
passport: 1,
|
|
21865
|
+
singlePage: 1
|
|
21834
21866
|
},
|
|
21835
21867
|
flipShortcutThreshold: 0.7
|
|
21836
21868
|
};
|
|
@@ -21902,6 +21934,7 @@
|
|
|
21902
21934
|
stopIdModels = _18.stop,
|
|
21903
21935
|
onIdPredictionMade = _18.onPredictionMade,
|
|
21904
21936
|
setThresholds = _18.setThresholds,
|
|
21937
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
21905
21938
|
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
21906
21939
|
bestFrameDetails = _18.bestFrameDetails,
|
|
21907
21940
|
resetBestFrame = _18.resetBestFrame,
|
|
@@ -21980,6 +22013,9 @@
|
|
|
21980
22013
|
React.useEffect(function () {
|
|
21981
22014
|
setThresholds(adjustedThresholds);
|
|
21982
22015
|
}, [requestedAction, setThresholds, adjustedThresholds]);
|
|
22016
|
+
React.useEffect(function () {
|
|
22017
|
+
setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
|
|
22018
|
+
}, [requestedAction, setRequiredDocumentType]);
|
|
21983
22019
|
React.useEffect(function () {
|
|
21984
22020
|
setDocumentDetectionBoundaries({
|
|
21985
22021
|
top: 20,
|
|
@@ -22002,6 +22038,9 @@
|
|
|
22002
22038
|
setGoodFramesCount = _28[1];
|
|
22003
22039
|
var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
|
|
22004
22040
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
22041
|
+
var _29 = React.useState(false),
|
|
22042
|
+
isSinglePage = _29[0],
|
|
22043
|
+
setIsSinglePage = _29[1];
|
|
22005
22044
|
React.useEffect(function () {
|
|
22006
22045
|
if (!idCaptureModelsEnabled || idModelError) return;
|
|
22007
22046
|
onIdPredictionMade(function (prediction) {
|
|
@@ -22009,7 +22048,8 @@
|
|
|
22009
22048
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
22010
22049
|
setCurrentDetectedDocumentType(prediction.detectedDocumentType);
|
|
22011
22050
|
setCurrentFocusScore(prediction.focusScore);
|
|
22012
|
-
|
|
22051
|
+
setIsSinglePage(prediction.singlePageDetectionThresholdMet);
|
|
22052
|
+
var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
|
|
22013
22053
|
var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
|
|
22014
22054
|
var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
|
|
22015
22055
|
if (shouldShortcutFlipAnimation) {
|
|
@@ -22020,9 +22060,9 @@
|
|
|
22020
22060
|
} : 0);
|
|
22021
22061
|
});
|
|
22022
22062
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
|
|
22023
|
-
var
|
|
22024
|
-
idFrontCaptureStartedAt =
|
|
22025
|
-
setFirstGoodFrameTime =
|
|
22063
|
+
var _30 = React.useState(null),
|
|
22064
|
+
idFrontCaptureStartedAt = _30[0],
|
|
22065
|
+
setFirstGoodFrameTime = _30[1];
|
|
22026
22066
|
React.useEffect(function () {
|
|
22027
22067
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
22028
22068
|
}, [goodFramesCount]);
|
|
@@ -22043,80 +22083,60 @@
|
|
|
22043
22083
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
22044
22084
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
22045
22085
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
22046
|
-
var
|
|
22047
|
-
countdownStartedAt =
|
|
22048
|
-
setCountdownStartedAt =
|
|
22086
|
+
var _31 = React.useState(),
|
|
22087
|
+
countdownStartedAt = _31[0],
|
|
22088
|
+
setCountdownStartedAt = _31[1];
|
|
22049
22089
|
var photoCanvas = React.useRef(null);
|
|
22050
22090
|
var frameLock = React.useRef(false);
|
|
22051
22091
|
var captureFrame = React.useCallback(function () {
|
|
22052
22092
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
22053
|
-
var frameBase64
|
|
22054
|
-
return __generator(this, function (
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
_b.label = 1;
|
|
22066
|
-
case 1:
|
|
22067
|
-
_b.trys.push([1,, 7, 8]);
|
|
22068
|
-
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
|
|
22093
|
+
var frameBase64;
|
|
22094
|
+
return __generator(this, function (_a) {
|
|
22095
|
+
if (frameLock.current) return [2 /*return*/];
|
|
22096
|
+
frameLock.current = true;
|
|
22097
|
+
drawToCanvas(photoCanvas.current, videoRef.current);
|
|
22098
|
+
frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
|
|
22099
|
+
if (!frameBase64) {
|
|
22100
|
+
frameLock.current = false;
|
|
22101
|
+
return [2 /*return*/];
|
|
22102
|
+
}
|
|
22103
|
+
try {
|
|
22104
|
+
if (requestedAction == 'SHOW_ID_FRONT') {
|
|
22069
22105
|
if (onIdFrontImageCaptured) {
|
|
22070
22106
|
onIdFrontImageCaptured(frameBase64);
|
|
22071
22107
|
}
|
|
22072
|
-
if (
|
|
22073
|
-
_a = skipShowIdCardBack === true;
|
|
22074
|
-
if (_a) return [3 /*break*/, 3];
|
|
22075
|
-
return [4 /*yield*/, skipShowIdCardBack()];
|
|
22076
|
-
case 2:
|
|
22077
|
-
_a = _b.sent();
|
|
22078
|
-
_b.label = 3;
|
|
22079
|
-
case 3:
|
|
22080
|
-
if (_a) {
|
|
22108
|
+
if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
|
|
22081
22109
|
return [2 /*return*/, onIdCaptureComplete()];
|
|
22082
22110
|
}
|
|
22083
|
-
_b.label = 4;
|
|
22084
|
-
case 4:
|
|
22085
22111
|
setRequestedAction('FLIP_ID');
|
|
22086
|
-
|
|
22087
|
-
|
|
22088
|
-
|
|
22089
|
-
if (onIdBackImageCaptured) {
|
|
22090
|
-
onIdBackImageCaptured(frameBase64);
|
|
22091
|
-
}
|
|
22092
|
-
onIdCaptureComplete();
|
|
22093
|
-
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
22094
|
-
if (onIdFrontImageCaptured) {
|
|
22095
|
-
onIdFrontImageCaptured(frameBase64);
|
|
22096
|
-
}
|
|
22097
|
-
onIdCaptureComplete();
|
|
22112
|
+
} else if (requestedAction == 'SHOW_ID_BACK') {
|
|
22113
|
+
if (onIdBackImageCaptured) {
|
|
22114
|
+
onIdBackImageCaptured(frameBase64);
|
|
22098
22115
|
}
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
setDetectedObjects([]);
|
|
22104
|
-
setCurrentDetectionScore(0);
|
|
22105
|
-
setCurrentFocusScore(0);
|
|
22106
|
-
setGoodFramesCount(0);
|
|
22107
|
-
setCountdownStartedAt(undefined);
|
|
22108
|
-
resetBestFrame();
|
|
22109
|
-
frameLock.current = false;
|
|
22110
|
-
if (countdownTimeoutRef.current) {
|
|
22111
|
-
clearTimeout(countdownTimeoutRef.current);
|
|
22116
|
+
onIdCaptureComplete();
|
|
22117
|
+
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
22118
|
+
if (onIdFrontImageCaptured) {
|
|
22119
|
+
onIdFrontImageCaptured(frameBase64);
|
|
22112
22120
|
}
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22121
|
+
onIdCaptureComplete();
|
|
22122
|
+
}
|
|
22123
|
+
} finally {
|
|
22124
|
+
setDetectedObjects([]);
|
|
22125
|
+
setCurrentDetectionScore(0);
|
|
22126
|
+
setCurrentFocusScore(0);
|
|
22127
|
+
setGoodFramesCount(0);
|
|
22128
|
+
setCountdownStartedAt(undefined);
|
|
22129
|
+
setIsSinglePage(false);
|
|
22130
|
+
resetBestFrame();
|
|
22131
|
+
frameLock.current = false;
|
|
22132
|
+
if (countdownTimeoutRef.current) {
|
|
22133
|
+
clearTimeout(countdownTimeoutRef.current);
|
|
22134
|
+
}
|
|
22116
22135
|
}
|
|
22136
|
+
return [2 /*return*/];
|
|
22117
22137
|
});
|
|
22118
22138
|
});
|
|
22119
|
-
}, [
|
|
22139
|
+
}, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
|
|
22120
22140
|
var isFlipping = requestedAction === 'FLIP_ID';
|
|
22121
22141
|
React.useEffect(function () {
|
|
22122
22142
|
if (!isFlipping) return;
|
|
@@ -22175,9 +22195,9 @@
|
|
|
22175
22195
|
stopSelfieGuidance();
|
|
22176
22196
|
};
|
|
22177
22197
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
22178
|
-
var
|
|
22179
|
-
numFramesWithoutFaces =
|
|
22180
|
-
setNumFramesWithoutFaces =
|
|
22198
|
+
var _32 = React.useState(0),
|
|
22199
|
+
numFramesWithoutFaces = _32[0],
|
|
22200
|
+
setNumFramesWithoutFaces = _32[1];
|
|
22181
22201
|
onSelfiePredictionMade(f(React.useCallback(function (_a) {
|
|
22182
22202
|
var face = _a.face;
|
|
22183
22203
|
if (selfieModelError) return;
|
|
@@ -22193,12 +22213,12 @@
|
|
|
22193
22213
|
}
|
|
22194
22214
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
22195
22215
|
var theme = styled.useTheme();
|
|
22196
|
-
var
|
|
22216
|
+
var _33 = useTranslations(rawVerbiage, {
|
|
22197
22217
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
22198
22218
|
captureBtnText: 'Capture'
|
|
22199
22219
|
}),
|
|
22200
|
-
captureBtnText =
|
|
22201
|
-
faceNotCenteredText =
|
|
22220
|
+
captureBtnText = _33.captureBtnText,
|
|
22221
|
+
faceNotCenteredText = _33.faceNotCenteredText;
|
|
22202
22222
|
var debugScalingDetails = useDebugScalingDetails({
|
|
22203
22223
|
enabled: debugMode,
|
|
22204
22224
|
pageWidth: width,
|
|
@@ -22273,6 +22293,11 @@
|
|
|
22273
22293
|
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"])));
|
|
22274
22294
|
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"])));
|
|
22275
22295
|
var CaptureButton = styled(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
|
|
22296
|
+
function evaluateShouldSkip(value) {
|
|
22297
|
+
if (value === true) return true;
|
|
22298
|
+
if (typeof value === 'function') return value();
|
|
22299
|
+
return false;
|
|
22300
|
+
}
|
|
22276
22301
|
var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
|
|
22277
22302
|
|
|
22278
22303
|
var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
|
|
@@ -22425,7 +22450,7 @@
|
|
|
22425
22450
|
customOverlayContent = _a.customOverlayContent,
|
|
22426
22451
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
22427
22452
|
_u = _a.idDocumentType,
|
|
22428
|
-
idDocumentType = _u === void 0 ? '
|
|
22453
|
+
idDocumentType = _u === void 0 ? 'idCardOrPassport' : _u,
|
|
22429
22454
|
_v = _a.idCaptureGuideType,
|
|
22430
22455
|
idCaptureGuideType = _v === void 0 ? 'fit' : _v,
|
|
22431
22456
|
_w = _a.idCaptureGuideImages,
|
|
@@ -22457,6 +22482,7 @@
|
|
|
22457
22482
|
_9 = _a.debugMode,
|
|
22458
22483
|
debugMode = _9 === void 0 ? false : _9;
|
|
22459
22484
|
var _10 = React.useContext(SubmissionContext),
|
|
22485
|
+
passportImage = _10.passportImage,
|
|
22460
22486
|
submissionStatus = _10.submissionStatus,
|
|
22461
22487
|
idCaptureVideoUrl = _10.idCaptureVideoUrl,
|
|
22462
22488
|
idCaptureVideoAudioUrl = _10.idCaptureVideoAudioUrl,
|
|
@@ -22532,6 +22558,7 @@
|
|
|
22532
22558
|
});
|
|
22533
22559
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
22534
22560
|
}, [onExitCapture]);
|
|
22561
|
+
var capturedIdDocumentType = idDocumentType !== 'idCardOrPassport' ? idDocumentType : passportImage ? 'passport' : 'idCard';
|
|
22535
22562
|
var faceLivenessGuides = React.useCallback(function (_a) {
|
|
22536
22563
|
var _b, _c, _d, _e;
|
|
22537
22564
|
var status = _a.status;
|
|
@@ -22540,12 +22567,12 @@
|
|
|
22540
22567
|
verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
|
|
22541
22568
|
requestedAction: "VERIFY_LIVENESS",
|
|
22542
22569
|
idCaptureGuideImages: idCaptureGuideImages,
|
|
22543
|
-
idDocumentType:
|
|
22570
|
+
idDocumentType: capturedIdDocumentType,
|
|
22544
22571
|
faceGuideStatus: status,
|
|
22545
22572
|
faceGuideBorderColor: status === 'success' ? (_d = colors.idVideoCapture) === null || _d === void 0 ? void 0 : _d.guidesSatisfiedColor : (_e = colors.idVideoCapture) === null || _e === void 0 ? void 0 : _e.guidesUnsatisfiedColor,
|
|
22546
22573
|
idCardGuideStatus: "disabled"
|
|
22547
22574
|
});
|
|
22548
|
-
}, [(_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides, (_c = colors.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guidesSatisfiedColor, (_d = colors.idVideoCapture) === null || _d === void 0 ? void 0 : _d.guidesUnsatisfiedColor, idCaptureGuideImages, (_e = verbiage.idVideoCapture) === null || _e === void 0 ? void 0 : _e.guides]);
|
|
22575
|
+
}, [capturedIdDocumentType, (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides, (_c = colors.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guidesSatisfiedColor, (_d = colors.idVideoCapture) === null || _d === void 0 ? void 0 : _d.guidesUnsatisfiedColor, idCaptureGuideImages, (_e = verbiage.idVideoCapture) === null || _e === void 0 ? void 0 : _e.guides]);
|
|
22549
22576
|
if (submissionStatus === SubmissionStatus.SUBMITTING) {
|
|
22550
22577
|
return /*#__PURE__*/React.createElement(PageContainer, {
|
|
22551
22578
|
className: "flex"
|
|
@@ -22564,7 +22591,8 @@
|
|
|
22564
22591
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
22565
22592
|
focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
|
|
22566
22593
|
onModelError: onIdCaptureModelError,
|
|
22567
|
-
modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
|
|
22594
|
+
modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
|
|
22595
|
+
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
22568
22596
|
}, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
|
|
22569
22597
|
autoStart: false,
|
|
22570
22598
|
onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
|
|
@@ -22635,7 +22663,7 @@
|
|
|
22635
22663
|
onExitCapture: handleExitCapture,
|
|
22636
22664
|
idCaptureModelsEnabled: idCaptureModelsEnabled,
|
|
22637
22665
|
idCaptureGuideImages: idCaptureGuideImages,
|
|
22638
|
-
idDocumentType:
|
|
22666
|
+
idDocumentType: capturedIdDocumentType,
|
|
22639
22667
|
videoIdCaptureThresholds: videoIdCaptureThresholds,
|
|
22640
22668
|
skipShowIdCardBack: skipShowIdCardBack,
|
|
22641
22669
|
disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
|
|
@@ -22814,7 +22842,8 @@
|
|
|
22814
22842
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
22815
22843
|
focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
22816
22844
|
onModelError: idCaptureProps.onModelError,
|
|
22817
|
-
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
|
|
22845
|
+
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
|
|
22846
|
+
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
22818
22847
|
}, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
|
|
22819
22848
|
onSuccess: onIdCaptureSuccess
|
|
22820
22849
|
}))))));
|
|
@@ -23136,31 +23165,33 @@
|
|
|
23136
23165
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
23137
23166
|
_d = _a.idCaptureRequirement,
|
|
23138
23167
|
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
23139
|
-
_e = _a.
|
|
23140
|
-
|
|
23141
|
-
_f = _a.
|
|
23142
|
-
|
|
23143
|
-
_g = _a.
|
|
23144
|
-
|
|
23168
|
+
_e = _a.allowSinglePageIdCapture,
|
|
23169
|
+
allowSinglePageIdCapture = _e === void 0 ? false : _e,
|
|
23170
|
+
_f = _a.separateIdCardCaptureSequence,
|
|
23171
|
+
separateIdCardCaptureSequence = _f === void 0 ? false : _f,
|
|
23172
|
+
_g = _a.idCaptureThresholds,
|
|
23173
|
+
idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
|
|
23174
|
+
_h = _a.skipSuccessScreen,
|
|
23175
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
23145
23176
|
instructions = _a.instructions,
|
|
23146
|
-
|
|
23147
|
-
guideType =
|
|
23148
|
-
|
|
23149
|
-
guideImages =
|
|
23150
|
-
|
|
23151
|
-
portraitGuidesOnMobile =
|
|
23152
|
-
|
|
23153
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
23154
|
-
|
|
23155
|
-
modelLoadTimeoutMs =
|
|
23156
|
-
|
|
23157
|
-
forceFallbackMode =
|
|
23158
|
-
|
|
23159
|
-
allowIdCardBackToFrontCapture =
|
|
23160
|
-
|
|
23161
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
23162
|
-
|
|
23163
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
23177
|
+
_j = _a.guideType,
|
|
23178
|
+
guideType = _j === void 0 ? 'fit' : _j,
|
|
23179
|
+
_k = _a.guideImages,
|
|
23180
|
+
guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
|
|
23181
|
+
_l = _a.portraitGuidesOnMobile,
|
|
23182
|
+
portraitGuidesOnMobile = _l === void 0 ? true : _l,
|
|
23183
|
+
_m = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
23184
|
+
rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
|
|
23185
|
+
_o = _a.modelLoadTimeoutMs,
|
|
23186
|
+
modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
|
|
23187
|
+
_p = _a.forceFallbackMode,
|
|
23188
|
+
forceFallbackMode = _p === void 0 ? false : _p,
|
|
23189
|
+
_q = _a.allowIdCardBackToFrontCapture,
|
|
23190
|
+
allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
|
|
23191
|
+
_r = _a.enableOverrideWrongDocumentTypeDialog,
|
|
23192
|
+
enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
|
|
23193
|
+
_s = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
23194
|
+
allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
|
|
23164
23195
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
23165
23196
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
23166
23197
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -23174,28 +23205,28 @@
|
|
|
23174
23205
|
onUserCancel = _a.onUserCancel,
|
|
23175
23206
|
onModelError = _a.onModelError,
|
|
23176
23207
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
23177
|
-
|
|
23178
|
-
theme =
|
|
23179
|
-
|
|
23180
|
-
assets =
|
|
23181
|
-
|
|
23182
|
-
classNames =
|
|
23183
|
-
|
|
23184
|
-
colors =
|
|
23185
|
-
|
|
23186
|
-
verbiage =
|
|
23187
|
-
|
|
23188
|
-
captureSignature =
|
|
23189
|
-
|
|
23190
|
-
captureSignatureVideo =
|
|
23191
|
-
|
|
23192
|
-
captureAdditionalDocuments =
|
|
23193
|
-
|
|
23194
|
-
geolocationEnabled =
|
|
23195
|
-
|
|
23196
|
-
geolocationRequired =
|
|
23197
|
-
|
|
23198
|
-
debugMode =
|
|
23208
|
+
_t = _a.theme,
|
|
23209
|
+
theme = _t === void 0 ? 'default' : _t,
|
|
23210
|
+
_u = _a.assets,
|
|
23211
|
+
assets = _u === void 0 ? {} : _u,
|
|
23212
|
+
_v = _a.classNames,
|
|
23213
|
+
classNames = _v === void 0 ? {} : _v,
|
|
23214
|
+
_w = _a.colors,
|
|
23215
|
+
colors = _w === void 0 ? {} : _w,
|
|
23216
|
+
_x = _a.verbiage,
|
|
23217
|
+
verbiage = _x === void 0 ? {} : _x,
|
|
23218
|
+
_y = _a.captureSignature,
|
|
23219
|
+
captureSignature = _y === void 0 ? false : _y,
|
|
23220
|
+
_z = _a.captureSignatureVideo,
|
|
23221
|
+
captureSignatureVideo = _z === void 0 ? false : _z,
|
|
23222
|
+
_0 = _a.captureAdditionalDocuments,
|
|
23223
|
+
captureAdditionalDocuments = _0 === void 0 ? [] : _0,
|
|
23224
|
+
_1 = _a.geolocationEnabled,
|
|
23225
|
+
geolocationEnabled = _1 === void 0 ? true : _1,
|
|
23226
|
+
_2 = _a.geolocationRequired,
|
|
23227
|
+
geolocationRequired = _2 === void 0 ? false : _2,
|
|
23228
|
+
_3 = _a.debugMode,
|
|
23229
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
23199
23230
|
useLanguage(lang);
|
|
23200
23231
|
useDebugLogging(debugMode);
|
|
23201
23232
|
var idCaptureProps = React.useMemo(function () {
|
|
@@ -23205,6 +23236,7 @@
|
|
|
23205
23236
|
onModelError: onModelError,
|
|
23206
23237
|
precapturedDocuments: precapturedDocuments,
|
|
23207
23238
|
captureRequirement: idCaptureRequirement,
|
|
23239
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture,
|
|
23208
23240
|
separateIdCardCaptureSequence: separateIdCardCaptureSequence,
|
|
23209
23241
|
thresholds: idCaptureThresholds,
|
|
23210
23242
|
skipSuccessScreen: skipSuccessScreen,
|
|
@@ -23227,7 +23259,7 @@
|
|
|
23227
23259
|
verbiage: verbiage,
|
|
23228
23260
|
debugMode: debugMode
|
|
23229
23261
|
};
|
|
23230
|
-
}, [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]);
|
|
23262
|
+
}, [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]);
|
|
23231
23263
|
var additionalDocumentCaptureProps = React.useMemo(function () {
|
|
23232
23264
|
return {
|
|
23233
23265
|
documents: captureAdditionalDocuments,
|
|
@@ -25186,7 +25218,7 @@
|
|
|
25186
25218
|
idCaptureRotateLoadingOverlayImageWhenPortrait = _p === void 0 ? true : _p,
|
|
25187
25219
|
idCardForFaceMatch = _a.idCardForFaceMatch,
|
|
25188
25220
|
_q = _a.idDocumentType,
|
|
25189
|
-
idDocumentType = _q === void 0 ? '
|
|
25221
|
+
idDocumentType = _q === void 0 ? 'idCardOrPassport' : _q,
|
|
25190
25222
|
_r = _a.faceLivenessLoadingOverlayMode,
|
|
25191
25223
|
faceLivenessLoadingOverlayMode = _r === void 0 ? 'default' : _r,
|
|
25192
25224
|
_s = _a.disableFaceDetectionWhileAudioCapture,
|