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