idmission-web-sdk 2.2.69 → 2.2.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CompositeWizard.d.ts.map +1 -1
- package/dist/components/customer_flows/IdValidation.d.ts +3 -1
- package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
- package/dist/components/fallback_flows/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/CapturedDocuments.d.ts +1 -1
- package/dist/components/id_capture/CapturedDocuments.d.ts.map +1 -1
- package/dist/components/id_capture/IdCapture.d.ts +2 -2
- package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +2 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +7 -5
- package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +4 -0
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureSuccess.d.ts +0 -4
- package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts +2 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCapture.d.ts +2 -0
- package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +6 -2
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +4 -0
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/lib/models/defaults/DocumentDetector.d.ts +1 -1
- package/dist/sdk2.cjs.development.js +353 -327
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +353 -327
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +353 -327
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/sdk2.esm.js
CHANGED
|
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
203
203
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
var webSdkVersion = '2.2.
|
|
206
|
+
var webSdkVersion = '2.2.70';
|
|
207
207
|
|
|
208
208
|
function getPlatform() {
|
|
209
209
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2266,7 +2266,7 @@ function average(arr) {
|
|
|
2266
2266
|
|
|
2267
2267
|
var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
|
|
2268
2268
|
|
|
2269
|
-
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-
|
|
2269
|
+
var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250108_165023.tflite");
|
|
2270
2270
|
|
|
2271
2271
|
var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
|
|
2272
2272
|
|
|
@@ -2285,6 +2285,10 @@ var defaultFocusThresholds = {
|
|
|
2285
2285
|
passport: {
|
|
2286
2286
|
desktop: 0,
|
|
2287
2287
|
mobile: 0.3
|
|
2288
|
+
},
|
|
2289
|
+
singlePage: {
|
|
2290
|
+
desktop: 0,
|
|
2291
|
+
mobile: 0.3
|
|
2288
2292
|
}
|
|
2289
2293
|
};
|
|
2290
2294
|
var classifier = null;
|
|
@@ -2910,16 +2914,19 @@ var defaultDocumentDetectionThresholds = {
|
|
|
2910
2914
|
idCardFront: 0.6,
|
|
2911
2915
|
idCardBack: 0.6,
|
|
2912
2916
|
passport: 0.4,
|
|
2917
|
+
singlePage: 0.4,
|
|
2913
2918
|
stability: {
|
|
2914
2919
|
idCardFront: 0.85,
|
|
2915
2920
|
idCardBack: 0.85,
|
|
2916
|
-
passport: 0.5
|
|
2921
|
+
passport: 0.5,
|
|
2922
|
+
singlePage: 0.5
|
|
2917
2923
|
}
|
|
2918
2924
|
};
|
|
2919
2925
|
var documentTypeDisplayNames = {
|
|
2920
2926
|
idCardFront: 'ID card front',
|
|
2921
2927
|
idCardBack: 'ID card back',
|
|
2922
2928
|
passport: 'Passport',
|
|
2929
|
+
singlePage: 'Single page',
|
|
2923
2930
|
none: 'None'
|
|
2924
2931
|
};
|
|
2925
2932
|
var detector = null;
|
|
@@ -3108,7 +3115,7 @@ var defaultDocumentDetectionBoundaries = {
|
|
|
3108
3115
|
right: 20
|
|
3109
3116
|
};
|
|
3110
3117
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
3111
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
3118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
3112
3119
|
if (boundaries === void 0) {
|
|
3113
3120
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
3114
3121
|
}
|
|
@@ -3159,18 +3166,25 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
3159
3166
|
var bestPassportPage = detectedObjects.find(function (obj) {
|
|
3160
3167
|
return obj.label === 'Passport page';
|
|
3161
3168
|
});
|
|
3169
|
+
var bestSinglePage = detectedObjects.find(function (obj) {
|
|
3170
|
+
return obj.label === 'Single page';
|
|
3171
|
+
});
|
|
3162
3172
|
var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
|
|
3163
3173
|
var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
|
|
3164
3174
|
var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
|
|
3165
|
-
var
|
|
3166
|
-
var
|
|
3167
|
-
var
|
|
3168
|
-
var
|
|
3169
|
-
var
|
|
3170
|
-
var
|
|
3175
|
+
var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
|
|
3176
|
+
var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
|
|
3177
|
+
var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
|
|
3178
|
+
var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
|
|
3179
|
+
var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
|
|
3180
|
+
var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
|
|
3181
|
+
var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
|
|
3182
|
+
var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
|
|
3171
3183
|
var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
|
|
3172
3184
|
var detectedDocumentType = 'none';
|
|
3173
|
-
if (
|
|
3185
|
+
if (singlePageDetectionThresholdMet) {
|
|
3186
|
+
detectedDocumentType = 'singlePage';
|
|
3187
|
+
} else if (passportDetectionThresholdMet) {
|
|
3174
3188
|
detectedDocumentType = 'passport';
|
|
3175
3189
|
} else if (idCardBackDetectionThresholdMet) {
|
|
3176
3190
|
detectedDocumentType = 'idCardBack';
|
|
@@ -3184,12 +3198,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
3184
3198
|
var documentIsStable = false;
|
|
3185
3199
|
var documentTooClose = false;
|
|
3186
3200
|
if (bestDocument) {
|
|
3187
|
-
var
|
|
3188
|
-
docWidth =
|
|
3189
|
-
docHeight =
|
|
3201
|
+
var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
3202
|
+
docWidth = _q[0],
|
|
3203
|
+
docHeight = _q[1];
|
|
3190
3204
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
3191
3205
|
if (detectionThresholdMet && documentInBounds && !documentTooClose) {
|
|
3192
|
-
var thresholdSet = (
|
|
3206
|
+
var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
|
|
3193
3207
|
var threshold_1 = thresholdSet[detectedDocumentType];
|
|
3194
3208
|
var framesNeeded = Math.ceil(average(framesNeededSamples));
|
|
3195
3209
|
trackBox(bestDocument.box, framesNeeded);
|
|
@@ -3211,6 +3225,8 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
3211
3225
|
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
3212
3226
|
passportDetectionScore: passportDetectionScore,
|
|
3213
3227
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
3228
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
3229
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
3214
3230
|
bestDocument: bestDocument,
|
|
3215
3231
|
documentInBounds: documentInBounds,
|
|
3216
3232
|
documentTooClose: documentTooClose,
|
|
@@ -4103,37 +4119,39 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
4103
4119
|
});
|
|
4104
4120
|
function IdCaptureModelsProviderInner(_a) {
|
|
4105
4121
|
var children = _a.children,
|
|
4106
|
-
onModelError = _a.onModelError
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4122
|
+
onModelError = _a.onModelError,
|
|
4123
|
+
_b = _a.allowSinglePageIdCapture,
|
|
4124
|
+
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
4125
|
+
var _c = useContext(DocumentDetectionModelContext),
|
|
4126
|
+
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
4127
|
+
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
4128
|
+
startDocumentDetection = _c.startDocumentDetection,
|
|
4129
|
+
stopDocumentDetection = _c.stopDocumentDetection,
|
|
4130
|
+
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
4131
|
+
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
4132
|
+
onDocumentDetected = _c.onDocumentDetected,
|
|
4133
|
+
detectionTime = _c.detectionTime,
|
|
4134
|
+
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
4135
|
+
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
4136
|
+
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
4137
|
+
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
4138
|
+
documentDetectionModelError = _c.documentDetectionModelError;
|
|
4139
|
+
var _d = useContext(FocusModelContext),
|
|
4140
|
+
focusModelReady = _d.focusModelReady,
|
|
4141
|
+
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
4142
|
+
makeFocusPrediction = _d.makeFocusPrediction,
|
|
4143
|
+
focusThresholds = _d.focusThresholds,
|
|
4144
|
+
setFocusThresholds = _d.setFocusThresholds,
|
|
4145
|
+
focusPredictionTime = _d.focusPredictionTime,
|
|
4146
|
+
focusModelError = _d.focusModelError;
|
|
4129
4147
|
var onPredictionHandler = useRef();
|
|
4130
4148
|
var bestFrameDetails = useRef(null);
|
|
4131
4149
|
var bestPredictionCanvas = useRef(null);
|
|
4132
4150
|
var bestFocusScore = useRef(0);
|
|
4133
4151
|
var stopDetection = useRef(0);
|
|
4134
|
-
var
|
|
4135
|
-
requiredDocumentType =
|
|
4136
|
-
setRequiredDocumentType =
|
|
4152
|
+
var _e = useState('none'),
|
|
4153
|
+
requiredDocumentType = _e[0],
|
|
4154
|
+
setRequiredDocumentType = _e[1];
|
|
4137
4155
|
var thresholds = useMemo(function () {
|
|
4138
4156
|
return _assign(_assign({}, documentDetectionThresholds), {
|
|
4139
4157
|
focus: focusThresholds
|
|
@@ -4151,34 +4169,42 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4151
4169
|
var _this = this;
|
|
4152
4170
|
onDocumentDetected(function (prediction) {
|
|
4153
4171
|
return __awaiter(_this, void 0, void 0, function () {
|
|
4154
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4155
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4156
|
-
return __generator(this, function (
|
|
4172
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4173
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4174
|
+
return __generator(this, function (_h) {
|
|
4157
4175
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
4158
4176
|
stopDetectionAtStart = stopDetection.current;
|
|
4159
4177
|
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
4160
|
-
|
|
4178
|
+
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
4179
|
+
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
4180
|
+
prediction.detectedDocumentType = 'passport';
|
|
4181
|
+
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
4182
|
+
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
4183
|
+
prediction.singlePageDetectionScore = 0;
|
|
4184
|
+
prediction.singlePageDetectionThresholdMet = false;
|
|
4185
|
+
}
|
|
4186
|
+
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'));
|
|
4161
4187
|
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
4162
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (
|
|
4188
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
4163
4189
|
if (focusPrediction) {
|
|
4164
4190
|
focusScore = focusPrediction.score;
|
|
4165
4191
|
focusPredictionTime = focusPrediction.predictionTime;
|
|
4166
4192
|
}
|
|
4167
|
-
focusThresholdSet = (
|
|
4168
|
-
focusThreshold = (
|
|
4193
|
+
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
4194
|
+
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;
|
|
4169
4195
|
focusThresholdMet = focusScore >= focusThreshold;
|
|
4170
4196
|
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
4171
4197
|
bestFocusScore.current = focusScore;
|
|
4172
4198
|
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
4173
4199
|
bestFrameDetails.current = {
|
|
4174
|
-
boundingBox: (
|
|
4200
|
+
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
4175
4201
|
documentType: prediction.detectedDocumentType,
|
|
4176
4202
|
detectionScore: prediction.detectionScore,
|
|
4177
4203
|
focusScore: focusScore
|
|
4178
4204
|
};
|
|
4179
4205
|
}
|
|
4180
4206
|
}
|
|
4181
|
-
(
|
|
4207
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
4182
4208
|
focusScore: focusScore,
|
|
4183
4209
|
focusPredictionTime: focusPredictionTime,
|
|
4184
4210
|
focusThresholdMet: focusThresholdMet
|
|
@@ -4187,7 +4213,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4187
4213
|
});
|
|
4188
4214
|
});
|
|
4189
4215
|
});
|
|
4190
|
-
}, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
4216
|
+
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
4191
4217
|
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
4192
4218
|
useEffect(function handleModelErrors() {
|
|
4193
4219
|
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
@@ -4201,9 +4227,9 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
4201
4227
|
canvas: bestPredictionCanvas.current
|
|
4202
4228
|
});
|
|
4203
4229
|
}, []);
|
|
4204
|
-
var
|
|
4205
|
-
canvasKey =
|
|
4206
|
-
setCanvasKey =
|
|
4230
|
+
var _f = useState(0),
|
|
4231
|
+
canvasKey = _f[0],
|
|
4232
|
+
setCanvasKey = _f[1];
|
|
4207
4233
|
var resetBestFrame = useCallback(function () {
|
|
4208
4234
|
stopDetection.current += 1;
|
|
4209
4235
|
setCanvasKey(function (n) {
|
|
@@ -4250,9 +4276,9 @@ function IdCaptureModelsProvider(_a) {
|
|
|
4250
4276
|
return /*#__PURE__*/React__default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
|
|
4251
4277
|
}
|
|
4252
4278
|
|
|
4253
|
-
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
|
|
4279
|
+
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
4254
4280
|
|
|
4255
|
-
var
|
|
4281
|
+
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
4256
4282
|
idCardFront: ['idCardFront'],
|
|
4257
4283
|
idCardBack: ['idCardBack'],
|
|
4258
4284
|
passport: ['passport'],
|
|
@@ -4260,13 +4286,31 @@ var requiredDocumentsForOption = {
|
|
|
4260
4286
|
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
4261
4287
|
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
4262
4288
|
};
|
|
4263
|
-
function
|
|
4289
|
+
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
4264
4290
|
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
4265
|
-
return
|
|
4291
|
+
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
4266
4292
|
}
|
|
4267
|
-
function
|
|
4293
|
+
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
4268
4294
|
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
4269
|
-
return
|
|
4295
|
+
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
4296
|
+
}
|
|
4297
|
+
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
4298
|
+
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
4299
|
+
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
4300
|
+
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
4301
|
+
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
4302
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
4303
|
+
return !v.includes('idCard');
|
|
4304
|
+
});
|
|
4305
|
+
}
|
|
4306
|
+
if (isIdCardOrPassport) {
|
|
4307
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
4308
|
+
return v !== 'passport';
|
|
4309
|
+
});
|
|
4310
|
+
}
|
|
4311
|
+
return acceptedTypes.filter(function (v) {
|
|
4312
|
+
return !(v in capturedDocuments);
|
|
4313
|
+
});
|
|
4270
4314
|
}
|
|
4271
4315
|
|
|
4272
4316
|
var initialState$4 = {
|
|
@@ -4305,6 +4349,8 @@ var initialState$4 = {
|
|
|
4305
4349
|
idCardBackDetectionThresholdMet: false,
|
|
4306
4350
|
passportDetectionScore: 0,
|
|
4307
4351
|
passportDetectionThresholdMet: false,
|
|
4352
|
+
singlePageDetectionScore: 0,
|
|
4353
|
+
singlePageDetectionThresholdMet: false,
|
|
4308
4354
|
focusScore: 0,
|
|
4309
4355
|
focusThresholdMet: false,
|
|
4310
4356
|
isGoodFrame: false,
|
|
@@ -4320,6 +4366,7 @@ var initialState$4 = {
|
|
|
4320
4366
|
capturedDocuments: {},
|
|
4321
4367
|
captureRequirement: 'idCardOrPassport',
|
|
4322
4368
|
requestedDocumentType: 'idCardFront',
|
|
4369
|
+
allowSinglePageIdCapture: false,
|
|
4323
4370
|
allowIdCardBackToFrontCapture: false,
|
|
4324
4371
|
operationStartedAt: null,
|
|
4325
4372
|
captureStartedAt: null
|
|
@@ -4334,11 +4381,13 @@ var _reducer = function reducer(state, action) {
|
|
|
4334
4381
|
var _c = action.payload,
|
|
4335
4382
|
captureRequirement = _c.captureRequirement,
|
|
4336
4383
|
precapturedDocuments = _c.precapturedDocuments,
|
|
4384
|
+
allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
|
|
4337
4385
|
allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
|
|
4338
4386
|
enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
|
|
4339
4387
|
allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
|
|
4340
4388
|
var newState = _assign(_assign({}, state), {
|
|
4341
4389
|
captureRequirement: captureRequirement,
|
|
4390
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
4342
4391
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
4343
4392
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
4344
4393
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
@@ -4406,6 +4455,8 @@ var _reducer = function reducer(state, action) {
|
|
|
4406
4455
|
idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
|
|
4407
4456
|
passportDetectionScore = _d.passportDetectionScore,
|
|
4408
4457
|
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
4458
|
+
singlePageDetectionScore = _d.singlePageDetectionScore,
|
|
4459
|
+
singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
|
|
4409
4460
|
bestDocument = _d.bestDocument,
|
|
4410
4461
|
documentInBounds = _d.documentInBounds,
|
|
4411
4462
|
documentTooClose = _d.documentTooClose,
|
|
@@ -4426,7 +4477,8 @@ var _reducer = function reducer(state, action) {
|
|
|
4426
4477
|
}
|
|
4427
4478
|
}
|
|
4428
4479
|
}
|
|
4429
|
-
var
|
|
4480
|
+
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
4481
|
+
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
4430
4482
|
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
4431
4483
|
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
4432
4484
|
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
@@ -4486,6 +4538,8 @@ var _reducer = function reducer(state, action) {
|
|
|
4486
4538
|
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4487
4539
|
passportDetectionScore: passportDetectionScore,
|
|
4488
4540
|
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4541
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
4542
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
4489
4543
|
focusScore: focusScore,
|
|
4490
4544
|
focusThresholdMet: focusThresholdMet,
|
|
4491
4545
|
isGoodFrame: isGoodFrame,
|
|
@@ -4523,7 +4577,7 @@ var _reducer = function reducer(state, action) {
|
|
|
4523
4577
|
});
|
|
4524
4578
|
case 'documentCaptured':
|
|
4525
4579
|
{
|
|
4526
|
-
var
|
|
4580
|
+
var newState = _assign(_assign({}, state), {
|
|
4527
4581
|
capturing: false,
|
|
4528
4582
|
captureFailed: false,
|
|
4529
4583
|
allowOverrideFlipRequirement: false,
|
|
@@ -4532,64 +4586,42 @@ var _reducer = function reducer(state, action) {
|
|
|
4532
4586
|
wrongDocumentTypePredictions: 0,
|
|
4533
4587
|
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
4534
4588
|
});
|
|
4535
|
-
var remainingRequirements =
|
|
4536
|
-
return !(v in newState_1.capturedDocuments);
|
|
4537
|
-
});
|
|
4538
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4539
|
-
if (state.requestedDocumentType === 'passport') {
|
|
4540
|
-
remainingRequirements = [];
|
|
4541
|
-
} else {
|
|
4542
|
-
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
4543
|
-
return v !== 'passport';
|
|
4544
|
-
});
|
|
4545
|
-
}
|
|
4546
|
-
}
|
|
4589
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
4547
4590
|
if (remainingRequirements.length === 0) {
|
|
4548
|
-
|
|
4591
|
+
newState.captureState = 'complete';
|
|
4549
4592
|
} else {
|
|
4550
|
-
|
|
4551
|
-
if (state.requestedDocumentType === 'idCardFront' &&
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4593
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
4594
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4595
|
+
newState.captureState = 'requestingFlip';
|
|
4596
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
4597
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
4598
|
+
newState.passportDetectionThresholdMet = false;
|
|
4599
|
+
newState.wrongDocumentTypePredictions = 0;
|
|
4557
4600
|
}
|
|
4558
4601
|
}
|
|
4559
|
-
return
|
|
4602
|
+
return newState;
|
|
4560
4603
|
}
|
|
4561
4604
|
case 'documentCapturedManually':
|
|
4562
4605
|
{
|
|
4563
|
-
var
|
|
4606
|
+
var newState = _assign(_assign({}, state), {
|
|
4564
4607
|
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
|
|
4565
4608
|
width: 0,
|
|
4566
4609
|
height: 0
|
|
4567
4610
|
}), _b))
|
|
4568
4611
|
});
|
|
4569
|
-
var remainingRequirements =
|
|
4570
|
-
return !(v in newState_2.capturedDocuments);
|
|
4571
|
-
});
|
|
4572
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4573
|
-
if (state.requestedDocumentType === 'passport') {
|
|
4574
|
-
remainingRequirements = [];
|
|
4575
|
-
} else {
|
|
4576
|
-
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
4577
|
-
return v !== 'passport';
|
|
4578
|
-
});
|
|
4579
|
-
}
|
|
4580
|
-
}
|
|
4612
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
4581
4613
|
if (remainingRequirements.length === 0) {
|
|
4582
|
-
|
|
4614
|
+
newState.captureState = 'complete';
|
|
4583
4615
|
} else {
|
|
4584
|
-
|
|
4585
|
-
if (state.requestedDocumentType === 'idCardFront' &&
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4616
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
4617
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4618
|
+
newState.captureState = 'requestingFlip';
|
|
4619
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
4620
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
4621
|
+
newState.passportDetectionThresholdMet = false;
|
|
4590
4622
|
}
|
|
4591
4623
|
}
|
|
4592
|
-
return
|
|
4624
|
+
return newState;
|
|
4593
4625
|
}
|
|
4594
4626
|
case 'flipRequestCompleted':
|
|
4595
4627
|
return _assign(_assign({}, state), {
|
|
@@ -5190,7 +5222,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
5190
5222
|
imageUrl: imageUrl
|
|
5191
5223
|
}
|
|
5192
5224
|
});
|
|
5193
|
-
var capturedDocumentType = documentType
|
|
5225
|
+
var capturedDocumentType = documentType;
|
|
5194
5226
|
setTimeout(function () {
|
|
5195
5227
|
var _a;
|
|
5196
5228
|
var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
|
|
@@ -5257,7 +5289,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
5257
5289
|
scaling: debugScalingDetails,
|
|
5258
5290
|
flipX: !isRearFacing
|
|
5259
5291
|
});
|
|
5260
|
-
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
5292
|
+
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
5261
5293
|
};
|
|
5262
5294
|
var timeSince = function timeSince(t) {
|
|
5263
5295
|
if (!t) return 0;
|
|
@@ -6296,15 +6328,8 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
6296
6328
|
_e = _a.debugMode,
|
|
6297
6329
|
debugMode = _e === void 0 ? false : _e;
|
|
6298
6330
|
var submissionStatus = useContext(SubmissionContext).submissionStatus;
|
|
6299
|
-
var idCardFront = capturedDocuments.idCardFront,
|
|
6300
|
-
idCardBack = capturedDocuments.idCardBack,
|
|
6301
|
-
passport = capturedDocuments.passport;
|
|
6302
6331
|
var verbiage = useTranslations(rawVerbiage, {
|
|
6303
6332
|
headingText: 'ID Capture Successful',
|
|
6304
|
-
idCardFrontText: 'ID Card Front',
|
|
6305
|
-
idCardBackText: 'ID Card Back',
|
|
6306
|
-
passportText: 'Passport',
|
|
6307
|
-
instructionText: 'Verify the entire ID was captured clearly with no glare.',
|
|
6308
6333
|
retryText: 'Retry',
|
|
6309
6334
|
submittingText: 'Submitting...',
|
|
6310
6335
|
submitText: 'Done'
|
|
@@ -6321,25 +6346,16 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
6321
6346
|
className: classNames.imageContainer
|
|
6322
6347
|
}, /*#__PURE__*/React__default.createElement(ImageRow, {
|
|
6323
6348
|
className: classNames.imageRow
|
|
6324
|
-
},
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
className: classNames.image,
|
|
6335
|
-
alt: verbiage.idCardBackText
|
|
6336
|
-
}), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
6337
|
-
className: classNames.imageCol
|
|
6338
|
-
}, /*#__PURE__*/React__default.createElement(StyledImage, {
|
|
6339
|
-
image: passport,
|
|
6340
|
-
className: classNames.image,
|
|
6341
|
-
alt: verbiage.passportText
|
|
6342
|
-
}), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
|
|
6349
|
+
}, Object.values(capturedDocuments).map(function (doc) {
|
|
6350
|
+
return /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
6351
|
+
className: classNames.imageCol,
|
|
6352
|
+
key: doc.imageData
|
|
6353
|
+
}, /*#__PURE__*/React__default.createElement(StyledImage, {
|
|
6354
|
+
image: doc,
|
|
6355
|
+
className: classNames.image,
|
|
6356
|
+
alt: doc.documentType
|
|
6357
|
+
}), debugMode && ( /*#__PURE__*/React__default.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)))));
|
|
6358
|
+
}))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
|
|
6343
6359
|
className: classNames.buttonsRow
|
|
6344
6360
|
}, /*#__PURE__*/React__default.createElement(WideButton, {
|
|
6345
6361
|
className: classNames.submitBtn,
|
|
@@ -6358,7 +6374,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
6358
6374
|
};
|
|
6359
6375
|
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"])));
|
|
6360
6376
|
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"])));
|
|
6361
|
-
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
|
|
6377
|
+
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"])));
|
|
6362
6378
|
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"])));
|
|
6363
6379
|
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"])));
|
|
6364
6380
|
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"])));
|
|
@@ -8068,8 +8084,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
|
|
|
8068
8084
|
var _j = useState(silentFallback),
|
|
8069
8085
|
useFallback = _j[0],
|
|
8070
8086
|
setUseFallback = _j[1];
|
|
8071
|
-
var
|
|
8072
|
-
var
|
|
8087
|
+
var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
8088
|
+
var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
8073
8089
|
var _k = useFileState(),
|
|
8074
8090
|
rawFile = _k.rawFile,
|
|
8075
8091
|
fileInputOnChange = _k.fileInputOnChange;
|
|
@@ -8082,7 +8098,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
|
|
|
8082
8098
|
var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
|
|
8083
8099
|
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.';
|
|
8084
8100
|
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.';
|
|
8085
|
-
var descriptionText = "On-device capture guidance failed, please capture ".concat(
|
|
8101
|
+
var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
|
|
8086
8102
|
var verbiage = useTranslations(rawVerbiage, {
|
|
8087
8103
|
headingText: "We're having some trouble.",
|
|
8088
8104
|
descriptionText: descriptionText,
|
|
@@ -8156,7 +8172,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
|
|
|
8156
8172
|
alt: "",
|
|
8157
8173
|
className: classNames.image
|
|
8158
8174
|
}));
|
|
8159
|
-
}))), images.length <
|
|
8175
|
+
}))), images.length < minImageCount && ( /*#__PURE__*/React__default.createElement(Instruction, {
|
|
8160
8176
|
className: classNames.instruction
|
|
8161
8177
|
}, instructionText)), /*#__PURE__*/React__default.createElement("input", {
|
|
8162
8178
|
ref: fileInput,
|
|
@@ -8167,7 +8183,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
|
|
|
8167
8183
|
hidden: true
|
|
8168
8184
|
}), /*#__PURE__*/React__default.createElement(StyledButtonsRow$8, {
|
|
8169
8185
|
className: classNames.buttonsRow
|
|
8170
|
-
}, images.length <
|
|
8186
|
+
}, images.length < maxImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
|
|
8171
8187
|
variant: images.length > 0 ? 'secondary' : 'positive',
|
|
8172
8188
|
className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
|
|
8173
8189
|
colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
|
|
@@ -8180,7 +8196,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
|
|
|
8180
8196
|
setDocumentToCapture(instructionText);
|
|
8181
8197
|
}
|
|
8182
8198
|
}
|
|
8183
|
-
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >=
|
|
8199
|
+
}, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
|
|
8184
8200
|
variant: "positive",
|
|
8185
8201
|
className: classNames.doneBtn,
|
|
8186
8202
|
colors: colors.doneBtn,
|
|
@@ -8227,79 +8243,82 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
8227
8243
|
precapturedDocuments = _a.precapturedDocuments,
|
|
8228
8244
|
_j = _a.captureRequirement,
|
|
8229
8245
|
captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
|
|
8230
|
-
_k = _a.
|
|
8231
|
-
|
|
8232
|
-
_l = _a.
|
|
8233
|
-
|
|
8234
|
-
_m = _a.
|
|
8235
|
-
|
|
8246
|
+
_k = _a.allowSinglePageIdCapture,
|
|
8247
|
+
allowSinglePageIdCapture = _k === void 0 ? false : _k,
|
|
8248
|
+
_l = _a.separateIdCardCaptureSequence,
|
|
8249
|
+
separateIdCardCaptureSequence = _l === void 0 ? false : _l,
|
|
8250
|
+
_m = _a.thresholds,
|
|
8251
|
+
thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
|
|
8252
|
+
_o = _a.skipSuccessScreen,
|
|
8253
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
8236
8254
|
instructions = _a.instructions,
|
|
8237
|
-
|
|
8238
|
-
releaseCameraAccessOnExit =
|
|
8239
|
-
|
|
8240
|
-
guideType =
|
|
8241
|
-
|
|
8242
|
-
portraitGuidesOnMobile =
|
|
8243
|
-
|
|
8244
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
8245
|
-
|
|
8246
|
-
silentFallback =
|
|
8247
|
-
|
|
8248
|
-
forceFallbackMode =
|
|
8249
|
-
|
|
8250
|
-
allowIdCardBackToFrontCapture =
|
|
8251
|
-
|
|
8252
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
8253
|
-
|
|
8254
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
8255
|
-
|
|
8256
|
-
guideImages =
|
|
8257
|
-
|
|
8258
|
-
assets =
|
|
8259
|
-
|
|
8260
|
-
classNames =
|
|
8261
|
-
|
|
8262
|
-
colors =
|
|
8263
|
-
|
|
8264
|
-
verbiage =
|
|
8265
|
-
|
|
8266
|
-
debugMode =
|
|
8267
|
-
var
|
|
8268
|
-
state =
|
|
8269
|
-
dispatch =
|
|
8270
|
-
var
|
|
8271
|
-
cameraAccessDenied =
|
|
8272
|
-
requestCameraAccess =
|
|
8273
|
-
releaseCameraAccess =
|
|
8274
|
-
var
|
|
8275
|
-
overlayDismissed =
|
|
8276
|
-
setOverlayDismissed =
|
|
8277
|
-
var
|
|
8278
|
-
submissionStatus =
|
|
8279
|
-
setIdFrontImage =
|
|
8280
|
-
setIdBackImage =
|
|
8281
|
-
setPassportImage =
|
|
8282
|
-
logIdFrontCaptureAttempt =
|
|
8283
|
-
logIdBackCaptureAttempt =
|
|
8284
|
-
var
|
|
8285
|
-
start =
|
|
8286
|
-
stop =
|
|
8287
|
-
onPredictionMade =
|
|
8288
|
-
setRequiredDocumentType =
|
|
8289
|
-
modelError =
|
|
8290
|
-
resetBestFrame =
|
|
8255
|
+
_p = _a.releaseCameraAccessOnExit,
|
|
8256
|
+
releaseCameraAccessOnExit = _p === void 0 ? true : _p,
|
|
8257
|
+
_q = _a.guideType,
|
|
8258
|
+
guideType = _q === void 0 ? 'fit' : _q,
|
|
8259
|
+
_r = _a.portraitGuidesOnMobile,
|
|
8260
|
+
portraitGuidesOnMobile = _r === void 0 ? true : _r,
|
|
8261
|
+
_s = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
8262
|
+
rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
8263
|
+
_t = _a.silentFallback,
|
|
8264
|
+
silentFallback = _t === void 0 ? false : _t,
|
|
8265
|
+
_u = _a.forceFallbackMode,
|
|
8266
|
+
forceFallbackMode = _u === void 0 ? false : _u,
|
|
8267
|
+
_v = _a.allowIdCardBackToFrontCapture,
|
|
8268
|
+
allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
|
|
8269
|
+
_w = _a.enableOverrideWrongDocumentTypeDialog,
|
|
8270
|
+
enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
|
|
8271
|
+
_x = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
8272
|
+
allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
|
|
8273
|
+
_y = _a.guideImages,
|
|
8274
|
+
guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
|
|
8275
|
+
_z = _a.assets,
|
|
8276
|
+
assets = _z === void 0 ? {} : _z,
|
|
8277
|
+
_0 = _a.classNames,
|
|
8278
|
+
classNames = _0 === void 0 ? {} : _0,
|
|
8279
|
+
_1 = _a.colors,
|
|
8280
|
+
colors = _1 === void 0 ? {} : _1,
|
|
8281
|
+
_2 = _a.verbiage,
|
|
8282
|
+
verbiage = _2 === void 0 ? {} : _2,
|
|
8283
|
+
_3 = _a.debugMode,
|
|
8284
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
8285
|
+
var _4 = useIdCaptureState(),
|
|
8286
|
+
state = _4[0],
|
|
8287
|
+
dispatch = _4[1];
|
|
8288
|
+
var _5 = useCameraStore(),
|
|
8289
|
+
cameraAccessDenied = _5.cameraAccessDenied,
|
|
8290
|
+
requestCameraAccess = _5.requestCameraAccess,
|
|
8291
|
+
releaseCameraAccess = _5.releaseCameraAccess;
|
|
8292
|
+
var _6 = useState(false),
|
|
8293
|
+
overlayDismissed = _6[0],
|
|
8294
|
+
setOverlayDismissed = _6[1];
|
|
8295
|
+
var _7 = useContext(SubmissionContext),
|
|
8296
|
+
submissionStatus = _7.submissionStatus,
|
|
8297
|
+
setIdFrontImage = _7.setIdFrontImage,
|
|
8298
|
+
setIdBackImage = _7.setIdBackImage,
|
|
8299
|
+
setPassportImage = _7.setPassportImage,
|
|
8300
|
+
logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
|
|
8301
|
+
logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
|
|
8302
|
+
var _8 = useContext(IdCaptureModelsContext),
|
|
8303
|
+
start = _8.start,
|
|
8304
|
+
stop = _8.stop,
|
|
8305
|
+
onPredictionMade = _8.onPredictionMade,
|
|
8306
|
+
setRequiredDocumentType = _8.setRequiredDocumentType,
|
|
8307
|
+
modelError = _8.modelError,
|
|
8308
|
+
resetBestFrame = _8.resetBestFrame;
|
|
8291
8309
|
useEffect(function () {
|
|
8292
8310
|
dispatch({
|
|
8293
8311
|
type: 'configureWizard',
|
|
8294
8312
|
payload: {
|
|
8295
8313
|
captureRequirement: captureRequirement,
|
|
8296
8314
|
precapturedDocuments: precapturedDocuments,
|
|
8315
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture,
|
|
8297
8316
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
8298
8317
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
8299
8318
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
|
|
8300
8319
|
}
|
|
8301
8320
|
});
|
|
8302
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
8321
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
8303
8322
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
8304
8323
|
useEffect(function () {
|
|
8305
8324
|
if (documentCount) resetBestFrame();
|
|
@@ -8361,13 +8380,16 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
8361
8380
|
var _a = state.capturedDocuments,
|
|
8362
8381
|
idCardFront = _a.idCardFront,
|
|
8363
8382
|
idCardBack = _a.idCardBack,
|
|
8364
|
-
passport = _a.passport
|
|
8383
|
+
passport = _a.passport,
|
|
8384
|
+
singlePage = _a.singlePage;
|
|
8365
8385
|
var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
|
|
8366
8386
|
var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
|
|
8367
8387
|
var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
|
|
8388
|
+
var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
|
|
8368
8389
|
if (idFrontImage) setIdFrontImage(idFrontImage);
|
|
8369
8390
|
if (idBackImage) setIdBackImage(idBackImage);
|
|
8370
8391
|
if (passportImage) setPassportImage(passportImage);
|
|
8392
|
+
if (singlePageImage) setIdFrontImage(singlePageImage);
|
|
8371
8393
|
if (releaseCameraAccessOnExit) releaseCameraAccess();
|
|
8372
8394
|
setTimeout(function () {
|
|
8373
8395
|
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
|
|
@@ -8383,9 +8405,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
8383
8405
|
type: 'resetWizard'
|
|
8384
8406
|
});
|
|
8385
8407
|
}, [dispatch]);
|
|
8386
|
-
var
|
|
8387
|
-
attempt =
|
|
8388
|
-
setAttempt =
|
|
8408
|
+
var _9 = useState(0),
|
|
8409
|
+
attempt = _9[0],
|
|
8410
|
+
setAttempt = _9[1];
|
|
8389
8411
|
var onExit = useCallback(function () {
|
|
8390
8412
|
releaseCameraAccess();
|
|
8391
8413
|
setOverlayDismissed(false);
|
|
@@ -8476,9 +8498,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
8476
8498
|
});
|
|
8477
8499
|
});
|
|
8478
8500
|
}, [dispatch]);
|
|
8479
|
-
var
|
|
8480
|
-
progressStarted =
|
|
8481
|
-
setProgressStarted =
|
|
8501
|
+
var _10 = useState(false),
|
|
8502
|
+
progressStarted = _10[0],
|
|
8503
|
+
setProgressStarted = _10[1];
|
|
8482
8504
|
useEffect(function () {
|
|
8483
8505
|
if (state.captureState === 'capturing') {
|
|
8484
8506
|
setProgressStarted(false);
|
|
@@ -12010,7 +12032,8 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
12010
12032
|
detection: {
|
|
12011
12033
|
idCardFront: 0.4,
|
|
12012
12034
|
idCardBack: 0.5,
|
|
12013
|
-
passport: 0.3
|
|
12035
|
+
passport: 0.3,
|
|
12036
|
+
singlePage: 0.3
|
|
12014
12037
|
},
|
|
12015
12038
|
focus: {
|
|
12016
12039
|
idCardFront: {
|
|
@@ -12024,12 +12047,17 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
12024
12047
|
passport: {
|
|
12025
12048
|
desktop: 0,
|
|
12026
12049
|
mobile: 0
|
|
12050
|
+
},
|
|
12051
|
+
singlePage: {
|
|
12052
|
+
desktop: 0,
|
|
12053
|
+
mobile: 0
|
|
12027
12054
|
}
|
|
12028
12055
|
},
|
|
12029
12056
|
goodFrames: {
|
|
12030
12057
|
idCardFront: 1,
|
|
12031
12058
|
idCardBack: 1,
|
|
12032
|
-
passport: 1
|
|
12059
|
+
passport: 1,
|
|
12060
|
+
singlePage: 1
|
|
12033
12061
|
},
|
|
12034
12062
|
flipShortcutThreshold: 0.7
|
|
12035
12063
|
};
|
|
@@ -12101,6 +12129,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12101
12129
|
stopIdModels = _18.stop,
|
|
12102
12130
|
onIdPredictionMade = _18.onPredictionMade,
|
|
12103
12131
|
setThresholds = _18.setThresholds,
|
|
12132
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
12104
12133
|
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
12105
12134
|
bestFrameDetails = _18.bestFrameDetails,
|
|
12106
12135
|
resetBestFrame = _18.resetBestFrame,
|
|
@@ -12179,6 +12208,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12179
12208
|
useEffect(function () {
|
|
12180
12209
|
setThresholds(adjustedThresholds);
|
|
12181
12210
|
}, [requestedAction, setThresholds, adjustedThresholds]);
|
|
12211
|
+
useEffect(function () {
|
|
12212
|
+
setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
|
|
12213
|
+
}, [requestedAction, setRequiredDocumentType]);
|
|
12182
12214
|
useEffect(function () {
|
|
12183
12215
|
setDocumentDetectionBoundaries({
|
|
12184
12216
|
top: 20,
|
|
@@ -12201,6 +12233,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12201
12233
|
setGoodFramesCount = _28[1];
|
|
12202
12234
|
var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
|
|
12203
12235
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
12236
|
+
var _29 = useState(false),
|
|
12237
|
+
isSinglePage = _29[0],
|
|
12238
|
+
setIsSinglePage = _29[1];
|
|
12204
12239
|
useEffect(function () {
|
|
12205
12240
|
if (!idCaptureModelsEnabled || idModelError) return;
|
|
12206
12241
|
onIdPredictionMade(function (prediction) {
|
|
@@ -12208,7 +12243,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12208
12243
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
12209
12244
|
setCurrentDetectedDocumentType(prediction.detectedDocumentType);
|
|
12210
12245
|
setCurrentFocusScore(prediction.focusScore);
|
|
12211
|
-
|
|
12246
|
+
setIsSinglePage(prediction.singlePageDetectionThresholdMet);
|
|
12247
|
+
var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
|
|
12212
12248
|
var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
|
|
12213
12249
|
var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
|
|
12214
12250
|
if (shouldShortcutFlipAnimation) {
|
|
@@ -12219,9 +12255,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12219
12255
|
} : 0);
|
|
12220
12256
|
});
|
|
12221
12257
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
|
|
12222
|
-
var
|
|
12223
|
-
idFrontCaptureStartedAt =
|
|
12224
|
-
setFirstGoodFrameTime =
|
|
12258
|
+
var _30 = useState(null),
|
|
12259
|
+
idFrontCaptureStartedAt = _30[0],
|
|
12260
|
+
setFirstGoodFrameTime = _30[1];
|
|
12225
12261
|
useEffect(function () {
|
|
12226
12262
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
12227
12263
|
}, [goodFramesCount]);
|
|
@@ -12242,80 +12278,60 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12242
12278
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
12243
12279
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
12244
12280
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
12245
|
-
var
|
|
12246
|
-
countdownStartedAt =
|
|
12247
|
-
setCountdownStartedAt =
|
|
12281
|
+
var _31 = useState(),
|
|
12282
|
+
countdownStartedAt = _31[0],
|
|
12283
|
+
setCountdownStartedAt = _31[1];
|
|
12248
12284
|
var photoCanvas = useRef(null);
|
|
12249
12285
|
var frameLock = useRef(false);
|
|
12250
12286
|
var captureFrame = useCallback(function () {
|
|
12251
12287
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
12252
|
-
var frameBase64
|
|
12253
|
-
return __generator(this, function (
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
_b.label = 1;
|
|
12265
|
-
case 1:
|
|
12266
|
-
_b.trys.push([1,, 7, 8]);
|
|
12267
|
-
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
|
|
12288
|
+
var frameBase64;
|
|
12289
|
+
return __generator(this, function (_a) {
|
|
12290
|
+
if (frameLock.current) return [2 /*return*/];
|
|
12291
|
+
frameLock.current = true;
|
|
12292
|
+
drawToCanvas(photoCanvas.current, videoRef.current);
|
|
12293
|
+
frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
|
|
12294
|
+
if (!frameBase64) {
|
|
12295
|
+
frameLock.current = false;
|
|
12296
|
+
return [2 /*return*/];
|
|
12297
|
+
}
|
|
12298
|
+
try {
|
|
12299
|
+
if (requestedAction == 'SHOW_ID_FRONT') {
|
|
12268
12300
|
if (onIdFrontImageCaptured) {
|
|
12269
12301
|
onIdFrontImageCaptured(frameBase64);
|
|
12270
12302
|
}
|
|
12271
|
-
if (
|
|
12272
|
-
_a = skipShowIdCardBack === true;
|
|
12273
|
-
if (_a) return [3 /*break*/, 3];
|
|
12274
|
-
return [4 /*yield*/, skipShowIdCardBack()];
|
|
12275
|
-
case 2:
|
|
12276
|
-
_a = _b.sent();
|
|
12277
|
-
_b.label = 3;
|
|
12278
|
-
case 3:
|
|
12279
|
-
if (_a) {
|
|
12303
|
+
if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
|
|
12280
12304
|
return [2 /*return*/, onIdCaptureComplete()];
|
|
12281
12305
|
}
|
|
12282
|
-
_b.label = 4;
|
|
12283
|
-
case 4:
|
|
12284
12306
|
setRequestedAction('FLIP_ID');
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
if (onIdBackImageCaptured) {
|
|
12289
|
-
onIdBackImageCaptured(frameBase64);
|
|
12290
|
-
}
|
|
12291
|
-
onIdCaptureComplete();
|
|
12292
|
-
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
12293
|
-
if (onIdFrontImageCaptured) {
|
|
12294
|
-
onIdFrontImageCaptured(frameBase64);
|
|
12295
|
-
}
|
|
12296
|
-
onIdCaptureComplete();
|
|
12307
|
+
} else if (requestedAction == 'SHOW_ID_BACK') {
|
|
12308
|
+
if (onIdBackImageCaptured) {
|
|
12309
|
+
onIdBackImageCaptured(frameBase64);
|
|
12297
12310
|
}
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
setDetectedObjects([]);
|
|
12303
|
-
setCurrentDetectionScore(0);
|
|
12304
|
-
setCurrentFocusScore(0);
|
|
12305
|
-
setGoodFramesCount(0);
|
|
12306
|
-
setCountdownStartedAt(undefined);
|
|
12307
|
-
resetBestFrame();
|
|
12308
|
-
frameLock.current = false;
|
|
12309
|
-
if (countdownTimeoutRef.current) {
|
|
12310
|
-
clearTimeout(countdownTimeoutRef.current);
|
|
12311
|
+
onIdCaptureComplete();
|
|
12312
|
+
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
12313
|
+
if (onIdFrontImageCaptured) {
|
|
12314
|
+
onIdFrontImageCaptured(frameBase64);
|
|
12311
12315
|
}
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12316
|
+
onIdCaptureComplete();
|
|
12317
|
+
}
|
|
12318
|
+
} finally {
|
|
12319
|
+
setDetectedObjects([]);
|
|
12320
|
+
setCurrentDetectionScore(0);
|
|
12321
|
+
setCurrentFocusScore(0);
|
|
12322
|
+
setGoodFramesCount(0);
|
|
12323
|
+
setCountdownStartedAt(undefined);
|
|
12324
|
+
setIsSinglePage(false);
|
|
12325
|
+
resetBestFrame();
|
|
12326
|
+
frameLock.current = false;
|
|
12327
|
+
if (countdownTimeoutRef.current) {
|
|
12328
|
+
clearTimeout(countdownTimeoutRef.current);
|
|
12329
|
+
}
|
|
12315
12330
|
}
|
|
12331
|
+
return [2 /*return*/];
|
|
12316
12332
|
});
|
|
12317
12333
|
});
|
|
12318
|
-
}, [
|
|
12334
|
+
}, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
|
|
12319
12335
|
var isFlipping = requestedAction === 'FLIP_ID';
|
|
12320
12336
|
useEffect(function () {
|
|
12321
12337
|
if (!isFlipping) return;
|
|
@@ -12374,9 +12390,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12374
12390
|
stopSelfieGuidance();
|
|
12375
12391
|
};
|
|
12376
12392
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
12377
|
-
var
|
|
12378
|
-
numFramesWithoutFaces =
|
|
12379
|
-
setNumFramesWithoutFaces =
|
|
12393
|
+
var _32 = useState(0),
|
|
12394
|
+
numFramesWithoutFaces = _32[0],
|
|
12395
|
+
setNumFramesWithoutFaces = _32[1];
|
|
12380
12396
|
onSelfiePredictionMade(useThrottledCallback(useCallback(function (_a) {
|
|
12381
12397
|
var face = _a.face;
|
|
12382
12398
|
if (selfieModelError) return;
|
|
@@ -12392,12 +12408,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12392
12408
|
}
|
|
12393
12409
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
12394
12410
|
var theme = useTheme();
|
|
12395
|
-
var
|
|
12411
|
+
var _33 = useTranslations(rawVerbiage, {
|
|
12396
12412
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
12397
12413
|
captureBtnText: 'Capture'
|
|
12398
12414
|
}),
|
|
12399
|
-
captureBtnText =
|
|
12400
|
-
faceNotCenteredText =
|
|
12415
|
+
captureBtnText = _33.captureBtnText,
|
|
12416
|
+
faceNotCenteredText = _33.faceNotCenteredText;
|
|
12401
12417
|
var debugScalingDetails = useDebugScalingDetails({
|
|
12402
12418
|
enabled: debugMode,
|
|
12403
12419
|
pageWidth: width,
|
|
@@ -12472,6 +12488,11 @@ var CountdownContainer = styled.div(templateObject_1$5 || (templateObject_1$5 =
|
|
|
12472
12488
|
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"])));
|
|
12473
12489
|
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"])));
|
|
12474
12490
|
var CaptureButton = styled(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
|
|
12491
|
+
function evaluateShouldSkip(value) {
|
|
12492
|
+
if (value === true) return true;
|
|
12493
|
+
if (typeof value === 'function') return value();
|
|
12494
|
+
return false;
|
|
12495
|
+
}
|
|
12475
12496
|
var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
|
|
12476
12497
|
|
|
12477
12498
|
var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
|
|
@@ -12769,7 +12790,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12769
12790
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
12770
12791
|
focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
|
|
12771
12792
|
onModelError: onIdCaptureModelError,
|
|
12772
|
-
modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
|
|
12793
|
+
modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
|
|
12794
|
+
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
12773
12795
|
}, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
|
|
12774
12796
|
autoStart: false,
|
|
12775
12797
|
onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
|
|
@@ -13019,7 +13041,8 @@ function CompositeWizard(_a) {
|
|
|
13019
13041
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
13020
13042
|
focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
13021
13043
|
onModelError: idCaptureProps.onModelError,
|
|
13022
|
-
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
|
|
13044
|
+
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
|
|
13045
|
+
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
13023
13046
|
}, /*#__PURE__*/React__default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
|
|
13024
13047
|
onSuccess: onIdCaptureSuccess
|
|
13025
13048
|
}))))));
|
|
@@ -13341,31 +13364,33 @@ var IdValidation = function IdValidation(_a) {
|
|
|
13341
13364
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
13342
13365
|
_d = _a.idCaptureRequirement,
|
|
13343
13366
|
idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
|
|
13344
|
-
_e = _a.
|
|
13345
|
-
|
|
13346
|
-
_f = _a.
|
|
13347
|
-
|
|
13348
|
-
_g = _a.
|
|
13349
|
-
|
|
13367
|
+
_e = _a.allowSinglePageIdCapture,
|
|
13368
|
+
allowSinglePageIdCapture = _e === void 0 ? false : _e,
|
|
13369
|
+
_f = _a.separateIdCardCaptureSequence,
|
|
13370
|
+
separateIdCardCaptureSequence = _f === void 0 ? false : _f,
|
|
13371
|
+
_g = _a.idCaptureThresholds,
|
|
13372
|
+
idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
|
|
13373
|
+
_h = _a.skipSuccessScreen,
|
|
13374
|
+
skipSuccessScreen = _h === void 0 ? false : _h,
|
|
13350
13375
|
instructions = _a.instructions,
|
|
13351
|
-
|
|
13352
|
-
guideType =
|
|
13353
|
-
|
|
13354
|
-
guideImages =
|
|
13355
|
-
|
|
13356
|
-
portraitGuidesOnMobile =
|
|
13357
|
-
|
|
13358
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
13359
|
-
|
|
13360
|
-
modelLoadTimeoutMs =
|
|
13361
|
-
|
|
13362
|
-
forceFallbackMode =
|
|
13363
|
-
|
|
13364
|
-
allowIdCardBackToFrontCapture =
|
|
13365
|
-
|
|
13366
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
13367
|
-
|
|
13368
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
13376
|
+
_j = _a.guideType,
|
|
13377
|
+
guideType = _j === void 0 ? 'fit' : _j,
|
|
13378
|
+
_k = _a.guideImages,
|
|
13379
|
+
guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
|
|
13380
|
+
_l = _a.portraitGuidesOnMobile,
|
|
13381
|
+
portraitGuidesOnMobile = _l === void 0 ? true : _l,
|
|
13382
|
+
_m = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
13383
|
+
rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
|
|
13384
|
+
_o = _a.modelLoadTimeoutMs,
|
|
13385
|
+
modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
|
|
13386
|
+
_p = _a.forceFallbackMode,
|
|
13387
|
+
forceFallbackMode = _p === void 0 ? false : _p,
|
|
13388
|
+
_q = _a.allowIdCardBackToFrontCapture,
|
|
13389
|
+
allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
|
|
13390
|
+
_r = _a.enableOverrideWrongDocumentTypeDialog,
|
|
13391
|
+
enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
|
|
13392
|
+
_s = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
13393
|
+
allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
|
|
13369
13394
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
13370
13395
|
onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
|
|
13371
13396
|
onDocumentUploadProgress = _a.onDocumentUploadProgress,
|
|
@@ -13379,28 +13404,28 @@ var IdValidation = function IdValidation(_a) {
|
|
|
13379
13404
|
onUserCancel = _a.onUserCancel,
|
|
13380
13405
|
onModelError = _a.onModelError,
|
|
13381
13406
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
13382
|
-
|
|
13383
|
-
theme =
|
|
13384
|
-
|
|
13385
|
-
assets =
|
|
13386
|
-
|
|
13387
|
-
classNames =
|
|
13388
|
-
|
|
13389
|
-
colors =
|
|
13390
|
-
|
|
13391
|
-
verbiage =
|
|
13392
|
-
|
|
13393
|
-
captureSignature =
|
|
13394
|
-
|
|
13395
|
-
captureSignatureVideo =
|
|
13396
|
-
|
|
13397
|
-
captureAdditionalDocuments =
|
|
13398
|
-
|
|
13399
|
-
geolocationEnabled =
|
|
13400
|
-
|
|
13401
|
-
geolocationRequired =
|
|
13402
|
-
|
|
13403
|
-
debugMode =
|
|
13407
|
+
_t = _a.theme,
|
|
13408
|
+
theme = _t === void 0 ? 'default' : _t,
|
|
13409
|
+
_u = _a.assets,
|
|
13410
|
+
assets = _u === void 0 ? {} : _u,
|
|
13411
|
+
_v = _a.classNames,
|
|
13412
|
+
classNames = _v === void 0 ? {} : _v,
|
|
13413
|
+
_w = _a.colors,
|
|
13414
|
+
colors = _w === void 0 ? {} : _w,
|
|
13415
|
+
_x = _a.verbiage,
|
|
13416
|
+
verbiage = _x === void 0 ? {} : _x,
|
|
13417
|
+
_y = _a.captureSignature,
|
|
13418
|
+
captureSignature = _y === void 0 ? false : _y,
|
|
13419
|
+
_z = _a.captureSignatureVideo,
|
|
13420
|
+
captureSignatureVideo = _z === void 0 ? false : _z,
|
|
13421
|
+
_0 = _a.captureAdditionalDocuments,
|
|
13422
|
+
captureAdditionalDocuments = _0 === void 0 ? [] : _0,
|
|
13423
|
+
_1 = _a.geolocationEnabled,
|
|
13424
|
+
geolocationEnabled = _1 === void 0 ? true : _1,
|
|
13425
|
+
_2 = _a.geolocationRequired,
|
|
13426
|
+
geolocationRequired = _2 === void 0 ? false : _2,
|
|
13427
|
+
_3 = _a.debugMode,
|
|
13428
|
+
debugMode = _3 === void 0 ? false : _3;
|
|
13404
13429
|
useLanguage(lang);
|
|
13405
13430
|
useDebugLogging(debugMode);
|
|
13406
13431
|
var idCaptureProps = useMemo(function () {
|
|
@@ -13410,6 +13435,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
13410
13435
|
onModelError: onModelError,
|
|
13411
13436
|
precapturedDocuments: precapturedDocuments,
|
|
13412
13437
|
captureRequirement: idCaptureRequirement,
|
|
13438
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture,
|
|
13413
13439
|
separateIdCardCaptureSequence: separateIdCardCaptureSequence,
|
|
13414
13440
|
thresholds: idCaptureThresholds,
|
|
13415
13441
|
skipSuccessScreen: skipSuccessScreen,
|
|
@@ -13432,7 +13458,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
13432
13458
|
verbiage: verbiage,
|
|
13433
13459
|
debugMode: debugMode
|
|
13434
13460
|
};
|
|
13435
|
-
}, [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]);
|
|
13461
|
+
}, [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]);
|
|
13436
13462
|
var additionalDocumentCaptureProps = useMemo(function () {
|
|
13437
13463
|
return {
|
|
13438
13464
|
documents: captureAdditionalDocuments,
|