idmission-web-sdk 2.2.50 → 2.2.52
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/VideoIdValidation.d.ts +2 -0
- package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts +2 -1
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
- package/dist/components/id_capture/FocusModelProvider.d.ts +2 -1
- package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
- package/dist/components/video_id/Action.d.ts +2 -0
- package/dist/components/video_id/Action.d.ts.map +1 -0
- package/dist/components/video_id/IdVideoCapture.d.ts +5 -3
- package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureGuides.d.ts +5 -4
- package/dist/components/video_id/IdVideoCaptureGuides.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts +2 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
- package/dist/lib/locales/es/translation.d.ts +1 -0
- package/dist/lib/locales/es/translation.d.ts.map +1 -1
- package/dist/lib/locales/index.d.ts +1 -0
- package/dist/lib/locales/index.d.ts.map +1 -1
- package/dist/lib/models/DocumentDetection.d.ts +2 -1
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +2 -1
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +334 -285
- 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 +334 -285
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +334 -285
- 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
|
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
234
234
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
var webSdkVersion = '2.2.
|
|
237
|
+
var webSdkVersion = '2.2.52';
|
|
238
238
|
|
|
239
239
|
function getPlatform() {
|
|
240
240
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2302,18 +2302,21 @@ function useLoadFocusModel(_a) {
|
|
|
2302
2302
|
_c = _a.modelLoadTimeoutMs,
|
|
2303
2303
|
modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
2304
2304
|
onModelError = _a.onModelError,
|
|
2305
|
-
videoRef = _a.videoRef
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2305
|
+
videoRef = _a.videoRef,
|
|
2306
|
+
_d = _a.shouldLoadModels,
|
|
2307
|
+
shouldLoadModels = _d === void 0 ? true : _d;
|
|
2308
|
+
var _e = React.useState(false),
|
|
2309
|
+
ready = _e[0],
|
|
2310
|
+
setReady = _e[1];
|
|
2311
|
+
var _f = React.useState(0),
|
|
2312
|
+
modelDownloadProgress = _f[0],
|
|
2313
|
+
setModelDownloadProgress = _f[1];
|
|
2314
|
+
var _g = React.useState(null),
|
|
2315
|
+
modelError = _g[0],
|
|
2316
|
+
setModelError = _g[1];
|
|
2315
2317
|
React.useEffect(function loadModel() {
|
|
2316
2318
|
var _this = this;
|
|
2319
|
+
if (!shouldLoadModels) return;
|
|
2317
2320
|
setReady(false);
|
|
2318
2321
|
function handleDownloadProgress(event) {
|
|
2319
2322
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -2351,7 +2354,7 @@ function useLoadFocusModel(_a) {
|
|
|
2351
2354
|
clearTimeout(modelLoadTimeout);
|
|
2352
2355
|
document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
|
|
2353
2356
|
};
|
|
2354
|
-
}, [modelPath, modelLoadTimeoutMs, videoRef]);
|
|
2357
|
+
}, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
|
|
2355
2358
|
React.useEffect(function handleModelError() {
|
|
2356
2359
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
2357
2360
|
}, [modelError, onModelError]);
|
|
@@ -2934,25 +2937,28 @@ function closeDocumentDetector() {
|
|
|
2934
2937
|
detectorSettings = null;
|
|
2935
2938
|
}
|
|
2936
2939
|
function useLoadDocumentDetector(_a) {
|
|
2937
|
-
var _b = _a.
|
|
2938
|
-
|
|
2939
|
-
_c = _a.
|
|
2940
|
-
|
|
2941
|
-
_d = _a.
|
|
2942
|
-
|
|
2940
|
+
var _b = _a.shouldLoadModels,
|
|
2941
|
+
shouldLoadModels = _b === void 0 ? true : _b,
|
|
2942
|
+
_c = _a.modelPath,
|
|
2943
|
+
modelPath = _c === void 0 ? defaultDocumentDetectorModelPath : _c,
|
|
2944
|
+
_d = _a.modelLoadTimeoutMs,
|
|
2945
|
+
modelLoadTimeoutMs = _d === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _d,
|
|
2946
|
+
_e = _a.scoreThreshold,
|
|
2947
|
+
scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
|
|
2943
2948
|
onModelError = _a.onModelError,
|
|
2944
2949
|
videoRef = _a.videoRef;
|
|
2945
|
-
var
|
|
2946
|
-
ready =
|
|
2947
|
-
setReady =
|
|
2948
|
-
var
|
|
2949
|
-
modelDownloadProgress =
|
|
2950
|
-
setModelDownloadProgress =
|
|
2951
|
-
var
|
|
2952
|
-
modelError =
|
|
2953
|
-
setModelError =
|
|
2950
|
+
var _f = React.useState(false),
|
|
2951
|
+
ready = _f[0],
|
|
2952
|
+
setReady = _f[1];
|
|
2953
|
+
var _g = React.useState(0),
|
|
2954
|
+
modelDownloadProgress = _g[0],
|
|
2955
|
+
setModelDownloadProgress = _g[1];
|
|
2956
|
+
var _h = React.useState(null),
|
|
2957
|
+
modelError = _h[0],
|
|
2958
|
+
setModelError = _h[1];
|
|
2954
2959
|
React.useEffect(function loadModel() {
|
|
2955
2960
|
var _this = this;
|
|
2961
|
+
if (!shouldLoadModels) return;
|
|
2956
2962
|
setReady(false);
|
|
2957
2963
|
function handleDownloadProgress(event) {
|
|
2958
2964
|
setModelDownloadProgress(progressToPercentage(event.detail));
|
|
@@ -2990,7 +2996,7 @@ function useLoadDocumentDetector(_a) {
|
|
|
2990
2996
|
clearTimeout(modelLoadTimeout);
|
|
2991
2997
|
document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
|
|
2992
2998
|
};
|
|
2993
|
-
}, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
|
|
2999
|
+
}, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
|
|
2994
3000
|
React.useEffect(function handleModelError() {
|
|
2995
3001
|
modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
|
|
2996
3002
|
}, [modelError, onModelError]);
|
|
@@ -3793,38 +3799,41 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3793
3799
|
documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
|
|
3794
3800
|
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
3795
3801
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
3796
|
-
onDocumentDetectionModelError = _a.onDocumentDetectionModelError
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3802
|
+
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
3803
|
+
_h = _a.shouldLoadModels,
|
|
3804
|
+
shouldLoadModels = _h === void 0 ? true : _h;
|
|
3805
|
+
var _j = useCameraStore(),
|
|
3806
|
+
videoRef = _j.videoRef,
|
|
3807
|
+
videoLoaded = _j.videoLoaded,
|
|
3808
|
+
cameraReady = _j.cameraReady;
|
|
3801
3809
|
var lastPredictionCanvas = React.useRef(null);
|
|
3802
3810
|
var onPredictionHandler = React.useRef();
|
|
3803
|
-
var
|
|
3804
|
-
documentDetectionThresholds =
|
|
3805
|
-
setDocumentDetectionThresholds =
|
|
3806
|
-
var
|
|
3807
|
-
documentDetectionBoundaries =
|
|
3808
|
-
setDocumentDetectionBoundaries =
|
|
3809
|
-
var _l = React.useState(0),
|
|
3810
|
-
timesAllZero = _l[0],
|
|
3811
|
-
setTimesAllZero = _l[1];
|
|
3811
|
+
var _k = React.useState({}),
|
|
3812
|
+
documentDetectionThresholds = _k[0],
|
|
3813
|
+
setDocumentDetectionThresholds = _k[1];
|
|
3814
|
+
var _l = React.useState(defaultDocumentDetectionBoundaries),
|
|
3815
|
+
documentDetectionBoundaries = _l[0],
|
|
3816
|
+
setDocumentDetectionBoundaries = _l[1];
|
|
3812
3817
|
var _m = React.useState(0),
|
|
3813
|
-
|
|
3814
|
-
|
|
3818
|
+
timesAllZero = _m[0],
|
|
3819
|
+
setTimesAllZero = _m[1];
|
|
3820
|
+
var _o = React.useState(0),
|
|
3821
|
+
canvasKey = _o[0],
|
|
3822
|
+
setCanvasKey = _o[1];
|
|
3815
3823
|
var stopDetection = React.useRef(0);
|
|
3816
|
-
var
|
|
3824
|
+
var _p = useLoadDocumentDetector({
|
|
3817
3825
|
modelPath: documentDetectionModelPath,
|
|
3818
3826
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
3819
3827
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
3820
3828
|
onModelError: onDocumentDetectionModelError,
|
|
3821
|
-
videoRef: videoRef
|
|
3829
|
+
videoRef: videoRef,
|
|
3830
|
+
shouldLoadModels: shouldLoadModels
|
|
3822
3831
|
}),
|
|
3823
|
-
ready =
|
|
3824
|
-
modelDownloadProgress =
|
|
3825
|
-
modelError =
|
|
3826
|
-
setModelError =
|
|
3827
|
-
var
|
|
3832
|
+
ready = _p.ready,
|
|
3833
|
+
modelDownloadProgress = _p.modelDownloadProgress,
|
|
3834
|
+
modelError = _p.modelError,
|
|
3835
|
+
setModelError = _p.setModelError;
|
|
3836
|
+
var _q = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
3828
3837
|
return __awaiter(_this, void 0, void 0, function () {
|
|
3829
3838
|
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
3830
3839
|
var _a;
|
|
@@ -3867,8 +3876,8 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3867
3876
|
throttleMs: throttleMs,
|
|
3868
3877
|
autoStart: autoStart
|
|
3869
3878
|
}),
|
|
3870
|
-
start =
|
|
3871
|
-
stop =
|
|
3879
|
+
start = _q.start,
|
|
3880
|
+
stop = _q.stop;
|
|
3872
3881
|
React.useEffect(function setErrorIfAllZero() {
|
|
3873
3882
|
if (timesAllZero >= 2) {
|
|
3874
3883
|
setModelError(new Error('model is returning all zeroes'));
|
|
@@ -3929,22 +3938,25 @@ function FocusModelProvider(_a) {
|
|
|
3929
3938
|
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
3930
3939
|
onFocusModelError = _a.onFocusModelError,
|
|
3931
3940
|
_d = _a.showCanvases,
|
|
3932
|
-
showCanvases = _d === void 0 ? false : _d
|
|
3941
|
+
showCanvases = _d === void 0 ? false : _d,
|
|
3942
|
+
_e = _a.shouldLoadModels,
|
|
3943
|
+
shouldLoadModels = _e === void 0 ? true : _e;
|
|
3933
3944
|
var cropCanvas = React.useRef(null);
|
|
3934
3945
|
var rotateCanvas = React.useRef(null);
|
|
3935
|
-
var
|
|
3936
|
-
focusThresholds =
|
|
3937
|
-
setFocusThresholds =
|
|
3946
|
+
var _f = React.useState({}),
|
|
3947
|
+
focusThresholds = _f[0],
|
|
3948
|
+
setFocusThresholds = _f[1];
|
|
3938
3949
|
var videoRef = useCameraStore().videoRef;
|
|
3939
|
-
var
|
|
3950
|
+
var _g = useLoadFocusModel({
|
|
3940
3951
|
modelPath: focusModelPath,
|
|
3941
3952
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
3942
3953
|
onModelError: onFocusModelError,
|
|
3943
|
-
videoRef: videoRef
|
|
3954
|
+
videoRef: videoRef,
|
|
3955
|
+
shouldLoadModels: shouldLoadModels
|
|
3944
3956
|
}),
|
|
3945
|
-
ready =
|
|
3946
|
-
modelDownloadProgress =
|
|
3947
|
-
modelError =
|
|
3957
|
+
ready = _g.ready,
|
|
3958
|
+
modelDownloadProgress = _g.modelDownloadProgress,
|
|
3959
|
+
modelError = _g.modelError;
|
|
3948
3960
|
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
3949
3961
|
if (!ready) return null;
|
|
3950
3962
|
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
@@ -4904,6 +4916,7 @@ var esTranslation = {
|
|
|
4904
4916
|
'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no te muevas',
|
|
4905
4917
|
'Display the front of your ID card...': 'Hay que mostrar el frente de la identificación...',
|
|
4906
4918
|
'Display the back of your ID card...': 'Hay que mostrar el reverso de la identificación...',
|
|
4919
|
+
'Display the ID page of your passport...': 'Hay que mostrar el página de datos del pasaporte...',
|
|
4907
4920
|
'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
|
|
4908
4921
|
'Searching for ID card...': 'Localizando la identificación...',
|
|
4909
4922
|
'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
|
|
@@ -11735,7 +11748,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11735
11748
|
idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
|
|
11736
11749
|
idCardGuideBorderColor = _a.idCardGuideBorderColor,
|
|
11737
11750
|
idCardCaptureProgress = _a.idCardCaptureProgress,
|
|
11738
|
-
_3 = _a.
|
|
11751
|
+
_3 = _a.idCaptureGuideImages,
|
|
11739
11752
|
userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
|
|
11740
11753
|
_4 = _a.classNames,
|
|
11741
11754
|
classNames = _4 === void 0 ? {} : _4,
|
|
@@ -11747,10 +11760,11 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11747
11760
|
var verbiage = useTranslations(rawVerbiage, {
|
|
11748
11761
|
idFrontInstructionText: 'Display the front of your ID card...',
|
|
11749
11762
|
idBackInstructionText: 'Display the back of your ID card...',
|
|
11763
|
+
passportInstructionText: 'Display the ID page of your passport...',
|
|
11750
11764
|
flipIdInstructionText: 'Please flip your ID card...',
|
|
11751
11765
|
verifyLivenessInstructionText: 'Performing facial recognition, please hold still...'
|
|
11752
11766
|
});
|
|
11753
|
-
var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
|
|
11767
|
+
var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_PASSPORT' ? verbiage.passportInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
|
|
11754
11768
|
var theme = styled.useTheme();
|
|
11755
11769
|
if (faceGuideBorderWidth === undefined) faceGuideBorderWidth = (_d = (_c = (_b = theme.idVideoCapture) === null || _b === void 0 ? void 0 : _b.faceGuides) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 5;
|
|
11756
11770
|
if (faceGuideBorderColor === undefined) faceGuideBorderColor = (_j = satisfied ? (_f = (_e = theme.idVideoCapture) === null || _e === void 0 ? void 0 : _e.faceGuides) === null || _f === void 0 ? void 0 : _f.satisfiedColor : (_h = (_g = theme.idVideoCapture) === null || _g === void 0 ? void 0 : _g.faceGuides) === null || _h === void 0 ? void 0 : _h.unsatisfiedColor) !== null && _j !== void 0 ? _j : '#D6DCE7';
|
|
@@ -11815,7 +11829,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11815
11829
|
className: classNames.idCardGuideImage,
|
|
11816
11830
|
"$isMirrored": !isRearFacing,
|
|
11817
11831
|
style: idCardImageStyle,
|
|
11818
|
-
src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
|
|
11832
|
+
src: requestedAction === 'SHOW_PASSPORT' ? idCaptureGuideImages.landscape.SHOW_PASSPORT.url : requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
|
|
11819
11833
|
onLoad: onImageLoaded
|
|
11820
11834
|
})), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React__namespace.default.createElement(IdVideoCaptureFlipIdPrompt, {
|
|
11821
11835
|
idCaptureGuideImages: idCaptureGuideImages,
|
|
@@ -11950,7 +11964,7 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
11950
11964
|
detection: {
|
|
11951
11965
|
idCardFront: 0.4,
|
|
11952
11966
|
idCardBack: 0.5,
|
|
11953
|
-
passport:
|
|
11967
|
+
passport: 0.3
|
|
11954
11968
|
},
|
|
11955
11969
|
focus: {
|
|
11956
11970
|
idCardFront: {
|
|
@@ -11968,7 +11982,8 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
11968
11982
|
},
|
|
11969
11983
|
goodFrames: {
|
|
11970
11984
|
idCardFront: 1,
|
|
11971
|
-
idCardBack: 1
|
|
11985
|
+
idCardBack: 1,
|
|
11986
|
+
passport: 1
|
|
11972
11987
|
},
|
|
11973
11988
|
flipShortcutThreshold: 0.7
|
|
11974
11989
|
};
|
|
@@ -11982,91 +11997,93 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
11982
11997
|
onExitCapture = _a.onExitCapture,
|
|
11983
11998
|
_w = _a.idCaptureModelsEnabled,
|
|
11984
11999
|
idCaptureModelsEnabled = _w === void 0 ? true : _w,
|
|
11985
|
-
_x = _a.
|
|
11986
|
-
|
|
11987
|
-
_y = _a.
|
|
11988
|
-
|
|
11989
|
-
_z = _a.
|
|
11990
|
-
|
|
11991
|
-
_0 = _a.
|
|
11992
|
-
|
|
11993
|
-
_1 = _a.
|
|
11994
|
-
|
|
12000
|
+
_x = _a.idDocumentType,
|
|
12001
|
+
idDocumentType = _x === void 0 ? 'idCard' : _x,
|
|
12002
|
+
_y = _a.idCaptureGuideImages,
|
|
12003
|
+
idCaptureGuideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
|
|
12004
|
+
_z = _a.idCardFrontDelay,
|
|
12005
|
+
idCardFrontDelay = _z === void 0 ? 1000 : _z,
|
|
12006
|
+
_0 = _a.videoIdCaptureThresholds,
|
|
12007
|
+
videoIdCaptureThresholds = _0 === void 0 ? defaultVideoIdCaptureThresholds : _0,
|
|
12008
|
+
_1 = _a.skipShowIdCardBack,
|
|
12009
|
+
skipShowIdCardBack = _1 === void 0 ? false : _1,
|
|
12010
|
+
_2 = _a.captureCountdownSeconds,
|
|
12011
|
+
captureCountdownSeconds = _2 === void 0 ? 3 : _2,
|
|
11995
12012
|
readTextPrompt = _a.readTextPrompt,
|
|
11996
|
-
|
|
11997
|
-
readTextTimeoutDurationMs =
|
|
11998
|
-
|
|
11999
|
-
readTextMinReadingMs =
|
|
12000
|
-
|
|
12001
|
-
disableFaceDetectionWhileAudioCapture =
|
|
12002
|
-
|
|
12003
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
12004
|
-
|
|
12005
|
-
mergeAVStreams =
|
|
12006
|
-
|
|
12007
|
-
classNames =
|
|
12008
|
-
|
|
12009
|
-
colors =
|
|
12010
|
-
|
|
12011
|
-
rawVerbiage =
|
|
12012
|
-
|
|
12013
|
-
debugMode =
|
|
12014
|
-
var
|
|
12015
|
-
ref =
|
|
12016
|
-
|
|
12017
|
-
width =
|
|
12018
|
-
|
|
12019
|
-
height =
|
|
12020
|
-
var
|
|
12021
|
-
camera =
|
|
12022
|
-
videoRef =
|
|
12023
|
-
videoLoaded =
|
|
12024
|
-
cameraReady =
|
|
12025
|
-
microphoneReady =
|
|
12026
|
-
audioStream =
|
|
12027
|
-
isRearFacing =
|
|
12028
|
-
releaseCameraAccess =
|
|
12029
|
-
var
|
|
12030
|
-
detectedObjects =
|
|
12031
|
-
setDetectedObjects =
|
|
12032
|
-
var
|
|
12033
|
-
face =
|
|
12034
|
-
setFace =
|
|
12035
|
-
var
|
|
12036
|
-
idModelsReady =
|
|
12037
|
-
startIdModels =
|
|
12038
|
-
stopIdModels =
|
|
12039
|
-
onIdPredictionMade =
|
|
12040
|
-
setThresholds =
|
|
12041
|
-
setDocumentDetectionBoundaries =
|
|
12042
|
-
bestFrameDetails =
|
|
12043
|
-
resetBestFrame =
|
|
12044
|
-
idModelError =
|
|
12045
|
-
var
|
|
12046
|
-
videoStartsAt =
|
|
12047
|
-
setVideoStartsAt =
|
|
12048
|
-
var
|
|
12049
|
-
setIdCaptureVideoAudioStartsAt =
|
|
12050
|
-
setExpectedAudioText =
|
|
12051
|
-
var
|
|
12052
|
-
startSelfieGuidance =
|
|
12053
|
-
stopSelfieGuidance =
|
|
12054
|
-
onSelfiePredictionMade =
|
|
12055
|
-
selfieModelError =
|
|
12056
|
-
var
|
|
12057
|
-
isRecordingVideo =
|
|
12058
|
-
startRecordingVideo =
|
|
12059
|
-
startRecordingAudio =
|
|
12060
|
-
stopRecordingVideo =
|
|
12061
|
-
stopRecordingAudio =
|
|
12062
|
-
videoRecordingUnintentionallyStopped =
|
|
12063
|
-
audioRecordingUnintentionallyStopped =
|
|
12064
|
-
videoUrl =
|
|
12065
|
-
audioUrl =
|
|
12013
|
+
_3 = _a.readTextTimeoutDurationMs,
|
|
12014
|
+
readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
|
|
12015
|
+
_4 = _a.readTextMinReadingMs,
|
|
12016
|
+
readTextMinReadingMs = _4 === void 0 ? 10000 : _4,
|
|
12017
|
+
_5 = _a.disableFaceDetectionWhileAudioCapture,
|
|
12018
|
+
disableFaceDetectionWhileAudioCapture = _5 === void 0 ? false : _5,
|
|
12019
|
+
_6 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
12020
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _6 === void 0 ? 2000 : _6,
|
|
12021
|
+
_7 = _a.mergeAVStreams,
|
|
12022
|
+
mergeAVStreams = _7 === void 0 ? false : _7,
|
|
12023
|
+
_8 = _a.classNames,
|
|
12024
|
+
classNames = _8 === void 0 ? {} : _8,
|
|
12025
|
+
_9 = _a.colors,
|
|
12026
|
+
colors = _9 === void 0 ? {} : _9,
|
|
12027
|
+
_10 = _a.verbiage,
|
|
12028
|
+
rawVerbiage = _10 === void 0 ? {} : _10,
|
|
12029
|
+
_11 = _a.debugMode,
|
|
12030
|
+
debugMode = _11 === void 0 ? false : _11;
|
|
12031
|
+
var _12 = useResizeObserver__default.default(),
|
|
12032
|
+
ref = _12.ref,
|
|
12033
|
+
_13 = _12.width,
|
|
12034
|
+
width = _13 === void 0 ? 1 : _13,
|
|
12035
|
+
_14 = _12.height,
|
|
12036
|
+
height = _14 === void 0 ? 1 : _14;
|
|
12037
|
+
var _15 = useCameraStore(),
|
|
12038
|
+
camera = _15.camera,
|
|
12039
|
+
videoRef = _15.videoRef,
|
|
12040
|
+
videoLoaded = _15.videoLoaded,
|
|
12041
|
+
cameraReady = _15.cameraReady,
|
|
12042
|
+
microphoneReady = _15.microphoneReady,
|
|
12043
|
+
audioStream = _15.audioStream,
|
|
12044
|
+
isRearFacing = _15.isRearFacing,
|
|
12045
|
+
releaseCameraAccess = _15.releaseCameraAccess;
|
|
12046
|
+
var _16 = React.useState([]),
|
|
12047
|
+
detectedObjects = _16[0],
|
|
12048
|
+
setDetectedObjects = _16[1];
|
|
12049
|
+
var _17 = React.useState(null),
|
|
12050
|
+
face = _17[0],
|
|
12051
|
+
setFace = _17[1];
|
|
12052
|
+
var _18 = React.useContext(IdCaptureModelsContext),
|
|
12053
|
+
idModelsReady = _18.ready,
|
|
12054
|
+
startIdModels = _18.start,
|
|
12055
|
+
stopIdModels = _18.stop,
|
|
12056
|
+
onIdPredictionMade = _18.onPredictionMade,
|
|
12057
|
+
setThresholds = _18.setThresholds,
|
|
12058
|
+
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
12059
|
+
bestFrameDetails = _18.bestFrameDetails,
|
|
12060
|
+
resetBestFrame = _18.resetBestFrame,
|
|
12061
|
+
idModelError = _18.modelError;
|
|
12062
|
+
var _19 = React.useState(null),
|
|
12063
|
+
videoStartsAt = _19[0],
|
|
12064
|
+
setVideoStartsAt = _19[1];
|
|
12065
|
+
var _20 = React.useContext(SubmissionContext),
|
|
12066
|
+
setIdCaptureVideoAudioStartsAt = _20.setIdCaptureVideoAudioStartsAt,
|
|
12067
|
+
setExpectedAudioText = _20.setExpectedAudioText;
|
|
12068
|
+
var _21 = React.useContext(SelfieGuidanceModelsContext),
|
|
12069
|
+
startSelfieGuidance = _21.start,
|
|
12070
|
+
stopSelfieGuidance = _21.stop,
|
|
12071
|
+
onSelfiePredictionMade = _21.onPredictionMade,
|
|
12072
|
+
selfieModelError = _21.error;
|
|
12073
|
+
var _22 = useVideoRecorder(camera, audioStream, mergeAVStreams),
|
|
12074
|
+
isRecordingVideo = _22.isRecordingVideo,
|
|
12075
|
+
startRecordingVideo = _22.startRecordingVideo,
|
|
12076
|
+
startRecordingAudio = _22.startRecordingAudio,
|
|
12077
|
+
stopRecordingVideo = _22.stopRecordingVideo,
|
|
12078
|
+
stopRecordingAudio = _22.stopRecordingAudio,
|
|
12079
|
+
videoRecordingUnintentionallyStopped = _22.videoRecordingUnintentionallyStopped,
|
|
12080
|
+
audioRecordingUnintentionallyStopped = _22.audioRecordingUnintentionallyStopped,
|
|
12081
|
+
videoUrl = _22.videoUrl,
|
|
12082
|
+
audioUrl = _22.audioUrl;
|
|
12066
12083
|
var countdownTimeoutRef = React.useRef(undefined);
|
|
12067
|
-
var
|
|
12068
|
-
countdownRemaining =
|
|
12069
|
-
setCountdownRemaining =
|
|
12084
|
+
var _23 = React.useState(-1),
|
|
12085
|
+
countdownRemaining = _23[0],
|
|
12086
|
+
setCountdownRemaining = _23[1];
|
|
12070
12087
|
React.useEffect(function () {
|
|
12071
12088
|
if (!isRecordingVideo && !videoUrl) {
|
|
12072
12089
|
startRecordingVideo();
|
|
@@ -12086,9 +12103,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12086
12103
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
12087
12104
|
}
|
|
12088
12105
|
}, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
|
|
12089
|
-
var
|
|
12090
|
-
requestedAction =
|
|
12091
|
-
setRequestedAction =
|
|
12106
|
+
var _24 = React.useState(idDocumentType === 'idCard' ? 'SHOW_ID_FRONT' : 'SHOW_PASSPORT'),
|
|
12107
|
+
requestedAction = _24[0],
|
|
12108
|
+
setRequestedAction = _24[1];
|
|
12092
12109
|
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
12093
12110
|
React.useEffect(function startModelsWhenCapturing() {
|
|
12094
12111
|
if (!shouldRunIdModels) return;
|
|
@@ -12097,9 +12114,25 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12097
12114
|
return stopIdModels();
|
|
12098
12115
|
};
|
|
12099
12116
|
}, [shouldRunIdModels, startIdModels, stopIdModels]);
|
|
12117
|
+
var adjustedThresholds = React.useMemo(function () {
|
|
12118
|
+
if (idDocumentType === 'idCard') {
|
|
12119
|
+
return _assign(_assign({}, videoIdCaptureThresholds), {
|
|
12120
|
+
detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
|
|
12121
|
+
passport: 1
|
|
12122
|
+
})
|
|
12123
|
+
});
|
|
12124
|
+
} else {
|
|
12125
|
+
return _assign(_assign({}, videoIdCaptureThresholds), {
|
|
12126
|
+
detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
|
|
12127
|
+
idCardFront: 1,
|
|
12128
|
+
idCardBack: 1
|
|
12129
|
+
})
|
|
12130
|
+
});
|
|
12131
|
+
}
|
|
12132
|
+
}, [idDocumentType, videoIdCaptureThresholds]);
|
|
12100
12133
|
React.useEffect(function () {
|
|
12101
|
-
setThresholds(
|
|
12102
|
-
}, [requestedAction, setThresholds,
|
|
12134
|
+
setThresholds(adjustedThresholds);
|
|
12135
|
+
}, [requestedAction, setThresholds, adjustedThresholds]);
|
|
12103
12136
|
React.useEffect(function () {
|
|
12104
12137
|
setDocumentDetectionBoundaries({
|
|
12105
12138
|
top: 20,
|
|
@@ -12108,19 +12141,19 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12108
12141
|
bottom: 0
|
|
12109
12142
|
});
|
|
12110
12143
|
}, [setDocumentDetectionBoundaries]);
|
|
12111
|
-
var
|
|
12112
|
-
currentDetectionScore =
|
|
12113
|
-
setCurrentDetectionScore =
|
|
12114
|
-
var
|
|
12115
|
-
currentDetectedDocumentType =
|
|
12116
|
-
setCurrentDetectedDocumentType =
|
|
12117
|
-
var _26 = React.useState(0),
|
|
12118
|
-
currentFocusScore = _26[0],
|
|
12119
|
-
setCurrentFocusScore = _26[1];
|
|
12144
|
+
var _25 = React.useState(0),
|
|
12145
|
+
currentDetectionScore = _25[0],
|
|
12146
|
+
setCurrentDetectionScore = _25[1];
|
|
12147
|
+
var _26 = React.useState('none'),
|
|
12148
|
+
currentDetectedDocumentType = _26[0],
|
|
12149
|
+
setCurrentDetectedDocumentType = _26[1];
|
|
12120
12150
|
var _27 = React.useState(0),
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
var
|
|
12151
|
+
currentFocusScore = _27[0],
|
|
12152
|
+
setCurrentFocusScore = _27[1];
|
|
12153
|
+
var _28 = React.useState(0),
|
|
12154
|
+
goodFramesCount = _28[0],
|
|
12155
|
+
setGoodFramesCount = _28[1];
|
|
12156
|
+
var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
|
|
12124
12157
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
12125
12158
|
React.useEffect(function () {
|
|
12126
12159
|
if (!idCaptureModelsEnabled || idModelError) return;
|
|
@@ -12129,9 +12162,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12129
12162
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
12130
12163
|
setCurrentDetectedDocumentType(prediction.detectedDocumentType);
|
|
12131
12164
|
setCurrentFocusScore(prediction.focusScore);
|
|
12132
|
-
var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
|
|
12165
|
+
var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
|
|
12133
12166
|
var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
|
|
12134
|
-
var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >=
|
|
12167
|
+
var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
|
|
12135
12168
|
if (shouldShortcutFlipAnimation) {
|
|
12136
12169
|
return setRequestedAction('SHOW_ID_BACK');
|
|
12137
12170
|
}
|
|
@@ -12139,16 +12172,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12139
12172
|
return n + 1;
|
|
12140
12173
|
} : 0);
|
|
12141
12174
|
});
|
|
12142
|
-
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction,
|
|
12143
|
-
var
|
|
12144
|
-
idFrontCaptureStartedAt =
|
|
12145
|
-
setFirstGoodFrameTime =
|
|
12175
|
+
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
|
|
12176
|
+
var _29 = React.useState(null),
|
|
12177
|
+
idFrontCaptureStartedAt = _29[0],
|
|
12178
|
+
setFirstGoodFrameTime = _29[1];
|
|
12146
12179
|
React.useEffect(function () {
|
|
12147
12180
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
12148
12181
|
}, [goodFramesCount]);
|
|
12149
|
-
var delaySatisfied =
|
|
12182
|
+
var delaySatisfied = !['SHOW_ID_FRONT', 'SHOW_PASSPORT'].includes(requestedAction) || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
|
|
12150
12183
|
var translatedText = useVerbiage(readTextPrompt, '');
|
|
12151
|
-
var
|
|
12184
|
+
var onIdCaptureComplete = React.useCallback(function () {
|
|
12152
12185
|
var _a;
|
|
12153
12186
|
if (translatedText) {
|
|
12154
12187
|
setRequestedAction('READ_TEXT');
|
|
@@ -12163,16 +12196,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12163
12196
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
12164
12197
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
12165
12198
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
12166
|
-
var
|
|
12167
|
-
countdownStartedAt =
|
|
12168
|
-
setCountdownStartedAt =
|
|
12199
|
+
var _30 = React.useState(),
|
|
12200
|
+
countdownStartedAt = _30[0],
|
|
12201
|
+
setCountdownStartedAt = _30[1];
|
|
12169
12202
|
var photoCanvas = React.useRef(null);
|
|
12170
12203
|
var frameLock = React.useRef(false);
|
|
12171
12204
|
var captureFrame = React.useCallback(function () {
|
|
12172
12205
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
12173
|
-
var frameBase64;
|
|
12174
|
-
return __generator(this, function (
|
|
12175
|
-
switch (
|
|
12206
|
+
var frameBase64, _a;
|
|
12207
|
+
return __generator(this, function (_b) {
|
|
12208
|
+
switch (_b.label) {
|
|
12176
12209
|
case 0:
|
|
12177
12210
|
if (frameLock.current) return [2 /*return*/];
|
|
12178
12211
|
frameLock.current = true;
|
|
@@ -12182,23 +12215,25 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12182
12215
|
frameLock.current = false;
|
|
12183
12216
|
return [2 /*return*/];
|
|
12184
12217
|
}
|
|
12185
|
-
|
|
12218
|
+
_b.label = 1;
|
|
12186
12219
|
case 1:
|
|
12187
|
-
|
|
12220
|
+
_b.trys.push([1,, 7, 8]);
|
|
12188
12221
|
if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
|
|
12189
12222
|
if (onIdFrontImageCaptured) {
|
|
12190
12223
|
onIdFrontImageCaptured(frameBase64);
|
|
12191
12224
|
}
|
|
12192
12225
|
if (!skipShowIdCardBack) return [3 /*break*/, 4];
|
|
12193
|
-
|
|
12194
|
-
return [
|
|
12195
|
-
case 2:
|
|
12226
|
+
_a = skipShowIdCardBack === true;
|
|
12227
|
+
if (_a) return [3 /*break*/, 3];
|
|
12196
12228
|
return [4 /*yield*/, skipShowIdCardBack()];
|
|
12229
|
+
case 2:
|
|
12230
|
+
_a = _b.sent();
|
|
12231
|
+
_b.label = 3;
|
|
12197
12232
|
case 3:
|
|
12198
|
-
if (_a
|
|
12199
|
-
return [2 /*return*/,
|
|
12233
|
+
if (_a) {
|
|
12234
|
+
return [2 /*return*/, onIdCaptureComplete()];
|
|
12200
12235
|
}
|
|
12201
|
-
|
|
12236
|
+
_b.label = 4;
|
|
12202
12237
|
case 4:
|
|
12203
12238
|
setRequestedAction('FLIP_ID');
|
|
12204
12239
|
return [3 /*break*/, 6];
|
|
@@ -12207,9 +12242,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12207
12242
|
if (onIdBackImageCaptured) {
|
|
12208
12243
|
onIdBackImageCaptured(frameBase64);
|
|
12209
12244
|
}
|
|
12210
|
-
|
|
12245
|
+
onIdCaptureComplete();
|
|
12246
|
+
} else if (requestedAction == 'SHOW_PASSPORT') {
|
|
12247
|
+
if (onIdFrontImageCaptured) {
|
|
12248
|
+
onIdFrontImageCaptured(frameBase64);
|
|
12249
|
+
}
|
|
12250
|
+
onIdCaptureComplete();
|
|
12211
12251
|
}
|
|
12212
|
-
|
|
12252
|
+
_b.label = 6;
|
|
12213
12253
|
case 6:
|
|
12214
12254
|
return [3 /*break*/, 8];
|
|
12215
12255
|
case 7:
|
|
@@ -12229,7 +12269,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12229
12269
|
}
|
|
12230
12270
|
});
|
|
12231
12271
|
});
|
|
12232
|
-
}, [
|
|
12272
|
+
}, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
|
|
12233
12273
|
var isFlipping = requestedAction === 'FLIP_ID';
|
|
12234
12274
|
React.useEffect(function () {
|
|
12235
12275
|
if (!isFlipping) return;
|
|
@@ -12288,9 +12328,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12288
12328
|
stopSelfieGuidance();
|
|
12289
12329
|
};
|
|
12290
12330
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
12291
|
-
var
|
|
12292
|
-
numFramesWithoutFaces =
|
|
12293
|
-
setNumFramesWithoutFaces =
|
|
12331
|
+
var _31 = React.useState(0),
|
|
12332
|
+
numFramesWithoutFaces = _31[0],
|
|
12333
|
+
setNumFramesWithoutFaces = _31[1];
|
|
12294
12334
|
onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
|
|
12295
12335
|
var face = _a.face;
|
|
12296
12336
|
if (selfieModelError) return;
|
|
@@ -12306,12 +12346,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12306
12346
|
}
|
|
12307
12347
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
12308
12348
|
var theme = styled.useTheme();
|
|
12309
|
-
var
|
|
12349
|
+
var _32 = useTranslations(rawVerbiage, {
|
|
12310
12350
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
12311
12351
|
captureBtnText: 'Capture'
|
|
12312
12352
|
}),
|
|
12313
|
-
captureBtnText =
|
|
12314
|
-
faceNotCenteredText =
|
|
12353
|
+
captureBtnText = _32.captureBtnText,
|
|
12354
|
+
faceNotCenteredText = _32.faceNotCenteredText;
|
|
12315
12355
|
var debugScalingDetails = useDebugScalingDetails({
|
|
12316
12356
|
enabled: debugMode,
|
|
12317
12357
|
pageWidth: width,
|
|
@@ -12319,7 +12359,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12319
12359
|
videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0,
|
|
12320
12360
|
videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
|
|
12321
12361
|
});
|
|
12322
|
-
var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
|
|
12362
|
+
var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK', 'SHOW_PASSPORT'].includes(requestedAction);
|
|
12323
12363
|
var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
|
|
12324
12364
|
return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
|
|
12325
12365
|
ref: ref,
|
|
@@ -12340,8 +12380,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12340
12380
|
requestedAction: requestedAction,
|
|
12341
12381
|
satisfied: satisfied,
|
|
12342
12382
|
idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
|
|
12343
|
-
idCardCaptureProgress:
|
|
12344
|
-
|
|
12383
|
+
idCardCaptureProgress: countdownStartedAt ? 1 : 0,
|
|
12384
|
+
idCaptureGuideImages: idCaptureGuideImages,
|
|
12345
12385
|
faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
|
|
12346
12386
|
idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
|
|
12347
12387
|
}), debugMode && capturingId && ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
@@ -12536,49 +12576,51 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12536
12576
|
idCaptureLoadingOverlayMode = _t === void 0 ? 'default' : _t,
|
|
12537
12577
|
customOverlayContent = _a.customOverlayContent,
|
|
12538
12578
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
12539
|
-
_u = _a.
|
|
12540
|
-
|
|
12541
|
-
_v = _a.
|
|
12542
|
-
|
|
12543
|
-
_w = _a.
|
|
12544
|
-
|
|
12545
|
-
_x = _a.
|
|
12546
|
-
|
|
12547
|
-
_y = _a.
|
|
12548
|
-
|
|
12549
|
-
_z = _a.
|
|
12550
|
-
|
|
12551
|
-
_0 = _a.
|
|
12552
|
-
|
|
12553
|
-
_1 = _a.
|
|
12554
|
-
|
|
12555
|
-
_2 = _a.
|
|
12556
|
-
|
|
12557
|
-
_3 = _a.
|
|
12558
|
-
|
|
12559
|
-
_4 = _a.
|
|
12560
|
-
|
|
12561
|
-
_5 = _a.
|
|
12562
|
-
|
|
12563
|
-
_6 = _a.
|
|
12564
|
-
|
|
12565
|
-
_7 = _a.
|
|
12566
|
-
|
|
12567
|
-
_8 = _a.
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12579
|
+
_u = _a.idDocumentType,
|
|
12580
|
+
idDocumentType = _u === void 0 ? 'idCard' : _u,
|
|
12581
|
+
_v = _a.idCaptureGuideType,
|
|
12582
|
+
idCaptureGuideType = _v === void 0 ? 'fit' : _v,
|
|
12583
|
+
_w = _a.idCaptureGuideImages,
|
|
12584
|
+
idCaptureGuideImages = _w === void 0 ? defaultIdCaptureGuideImages : _w,
|
|
12585
|
+
_x = _a.idCapturePortraitGuidesOnMobile,
|
|
12586
|
+
idCapturePortraitGuidesOnMobile = _x === void 0 ? true : _x,
|
|
12587
|
+
_y = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
12588
|
+
idCaptureRotateLoadingOverlayImageWhenPortrait = _y === void 0 ? true : _y,
|
|
12589
|
+
_z = _a.idCaptureModelLoadTimeoutMs,
|
|
12590
|
+
idCaptureModelLoadTimeoutMs = _z === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _z,
|
|
12591
|
+
_0 = _a.faceLivenessLoadingOverlayMode,
|
|
12592
|
+
faceLivenessLoadingOverlayMode = _0 === void 0 ? 'default' : _0,
|
|
12593
|
+
_1 = _a.disableFaceDetectionWhileAudioCapture,
|
|
12594
|
+
disableFaceDetectionWhileAudioCapture = _1 === void 0 ? true : _1,
|
|
12595
|
+
_2 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
12596
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _2 === void 0 ? 2000 : _2,
|
|
12597
|
+
_3 = _a.silentFallback,
|
|
12598
|
+
silentFallback = _3 === void 0 ? false : _3,
|
|
12599
|
+
_4 = _a.mergeAVStreams,
|
|
12600
|
+
mergeAVStreams = _4 === void 0 ? false : _4,
|
|
12601
|
+
_5 = _a.assets,
|
|
12602
|
+
assets = _5 === void 0 ? {} : _5,
|
|
12603
|
+
_6 = _a.classNames,
|
|
12604
|
+
classNames = _6 === void 0 ? {} : _6,
|
|
12605
|
+
_7 = _a.colors,
|
|
12606
|
+
colors = _7 === void 0 ? {} : _7,
|
|
12607
|
+
_8 = _a.verbiage,
|
|
12608
|
+
verbiage = _8 === void 0 ? {} : _8,
|
|
12609
|
+
_9 = _a.debugMode,
|
|
12610
|
+
debugMode = _9 === void 0 ? false : _9;
|
|
12611
|
+
var _10 = React.useContext(SubmissionContext),
|
|
12612
|
+
submissionStatus = _10.submissionStatus,
|
|
12613
|
+
idCaptureVideoUrl = _10.idCaptureVideoUrl,
|
|
12614
|
+
idCaptureVideoAudioUrl = _10.idCaptureVideoAudioUrl,
|
|
12615
|
+
idCaptureVideoIdFrontImage = _10.idCaptureVideoIdFrontImage,
|
|
12616
|
+
idCaptureVideoIdBackImage = _10.idCaptureVideoIdBackImage,
|
|
12617
|
+
setIdCaptureVideoUrl = _10.setIdCaptureVideoUrl,
|
|
12618
|
+
setIdCaptureVideoIdFrontImage = _10.setIdCaptureVideoIdFrontImage,
|
|
12619
|
+
setIdCaptureVideoIdBackImage = _10.setIdCaptureVideoIdBackImage,
|
|
12620
|
+
setIdCaptureVideoAudioUrl = _10.setIdCaptureVideoAudioUrl;
|
|
12621
|
+
var _11 = React.useState('CAPTURING_ID'),
|
|
12622
|
+
captureState = _11[0],
|
|
12623
|
+
setCaptureState = _11[1];
|
|
12582
12624
|
React.useEffect(function () {
|
|
12583
12625
|
if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
|
|
12584
12626
|
}, [captureState, skipIdCapture]);
|
|
@@ -12609,9 +12651,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12609
12651
|
var onVideoCaptureFaceNotDetected = React.useCallback(function () {
|
|
12610
12652
|
setCaptureState('CHECKING_LIVENESS');
|
|
12611
12653
|
}, []);
|
|
12612
|
-
var
|
|
12613
|
-
attempt =
|
|
12614
|
-
setAttempt =
|
|
12654
|
+
var _12 = React.useState(0),
|
|
12655
|
+
attempt = _12[0],
|
|
12656
|
+
setAttempt = _12[1];
|
|
12615
12657
|
var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
|
|
12616
12658
|
var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
|
|
12617
12659
|
userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
|
|
@@ -12646,7 +12688,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12646
12688
|
var _b, _c, _d, _e;
|
|
12647
12689
|
var status = _a.status;
|
|
12648
12690
|
return /*#__PURE__*/React__namespace.default.createElement(IdVideoCaptureGuides, {
|
|
12649
|
-
|
|
12691
|
+
idCaptureGuideImages: idCaptureGuideImages,
|
|
12650
12692
|
classNames: (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides,
|
|
12651
12693
|
verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
|
|
12652
12694
|
requestedAction: "VERIFY_LIVENESS",
|
|
@@ -12706,6 +12748,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12706
12748
|
guideType: idCaptureGuideType,
|
|
12707
12749
|
portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
|
|
12708
12750
|
rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
12751
|
+
captureRequirement: idDocumentType,
|
|
12709
12752
|
debugMode: debugMode
|
|
12710
12753
|
}))));
|
|
12711
12754
|
case 'CHECKING_LIVENESS':
|
|
@@ -12742,7 +12785,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12742
12785
|
onRecordingFailed: onRecordingFailed,
|
|
12743
12786
|
onExitCapture: handleExitCapture,
|
|
12744
12787
|
idCaptureModelsEnabled: idCaptureModelsEnabled,
|
|
12745
|
-
|
|
12788
|
+
idCaptureGuideImages: idCaptureGuideImages,
|
|
12789
|
+
idDocumentType: idDocumentType,
|
|
12746
12790
|
videoIdCaptureThresholds: videoIdCaptureThresholds,
|
|
12747
12791
|
skipShowIdCardBack: skipShowIdCardBack,
|
|
12748
12792
|
disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
|
|
@@ -12909,9 +12953,11 @@ function CompositeWizard(_a) {
|
|
|
12909
12953
|
case 'IdCapture':
|
|
12910
12954
|
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
12911
12955
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12912
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12956
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
12957
|
+
requestAccessAutomatically: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode)
|
|
12913
12958
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
12914
12959
|
autoStart: false,
|
|
12960
|
+
shouldLoadModels: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode),
|
|
12915
12961
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
12916
12962
|
focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
12917
12963
|
onModelError: idCaptureProps.onModelError,
|
|
@@ -15281,40 +15327,42 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
15281
15327
|
_p = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
|
|
15282
15328
|
idCaptureRotateLoadingOverlayImageWhenPortrait = _p === void 0 ? true : _p,
|
|
15283
15329
|
idCardForFaceMatch = _a.idCardForFaceMatch,
|
|
15284
|
-
_q = _a.
|
|
15285
|
-
|
|
15286
|
-
_r = _a.
|
|
15287
|
-
|
|
15288
|
-
_s = _a.
|
|
15289
|
-
|
|
15290
|
-
_t = _a.
|
|
15291
|
-
|
|
15292
|
-
_u = _a.
|
|
15293
|
-
|
|
15294
|
-
_v = _a.
|
|
15295
|
-
|
|
15296
|
-
_w = _a.
|
|
15297
|
-
|
|
15298
|
-
_x = _a.
|
|
15299
|
-
|
|
15300
|
-
_y = _a.
|
|
15301
|
-
|
|
15302
|
-
_z = _a.
|
|
15303
|
-
|
|
15304
|
-
_0 = _a.
|
|
15305
|
-
|
|
15306
|
-
_1 = _a.
|
|
15307
|
-
|
|
15308
|
-
_2 = _a.
|
|
15309
|
-
|
|
15310
|
-
_3 = _a.
|
|
15311
|
-
|
|
15312
|
-
_4 = _a.
|
|
15313
|
-
|
|
15314
|
-
_5 = _a.
|
|
15315
|
-
|
|
15316
|
-
_6 = _a.
|
|
15317
|
-
|
|
15330
|
+
_q = _a.idDocumentType,
|
|
15331
|
+
idDocumentType = _q === void 0 ? 'idCard' : _q,
|
|
15332
|
+
_r = _a.faceLivenessLoadingOverlayMode,
|
|
15333
|
+
faceLivenessLoadingOverlayMode = _r === void 0 ? 'default' : _r,
|
|
15334
|
+
_s = _a.disableFaceDetectionWhileAudioCapture,
|
|
15335
|
+
disableFaceDetectionWhileAudioCapture = _s === void 0 ? false : _s,
|
|
15336
|
+
_t = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
15337
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _t === void 0 ? 2000 : _t,
|
|
15338
|
+
_u = _a.silentFallback,
|
|
15339
|
+
silentFallback = _u === void 0 ? false : _u,
|
|
15340
|
+
_v = _a.mergeAVStreams,
|
|
15341
|
+
mergeAVStreams = _v === void 0 ? false : _v,
|
|
15342
|
+
_w = _a.matchOnly,
|
|
15343
|
+
matchOnly = _w === void 0 ? false : _w,
|
|
15344
|
+
_x = _a.theme,
|
|
15345
|
+
theme = _x === void 0 ? 'default' : _x,
|
|
15346
|
+
_y = _a.assets,
|
|
15347
|
+
assets = _y === void 0 ? {} : _y,
|
|
15348
|
+
_z = _a.classNames,
|
|
15349
|
+
classNames = _z === void 0 ? {} : _z,
|
|
15350
|
+
_0 = _a.colors,
|
|
15351
|
+
colors = _0 === void 0 ? {} : _0,
|
|
15352
|
+
_1 = _a.verbiage,
|
|
15353
|
+
verbiage = _1 === void 0 ? {} : _1,
|
|
15354
|
+
_2 = _a.captureSignature,
|
|
15355
|
+
captureSignature = _2 === void 0 ? false : _2,
|
|
15356
|
+
_3 = _a.captureSignatureVideo,
|
|
15357
|
+
captureSignatureVideo = _3 === void 0 ? false : _3,
|
|
15358
|
+
_4 = _a.captureAdditionalDocuments,
|
|
15359
|
+
captureAdditionalDocuments = _4 === void 0 ? [] : _4,
|
|
15360
|
+
_5 = _a.geolocationEnabled,
|
|
15361
|
+
geolocationEnabled = _5 === void 0 ? true : _5,
|
|
15362
|
+
_6 = _a.geolocationRequired,
|
|
15363
|
+
geolocationRequired = _6 === void 0 ? false : _6,
|
|
15364
|
+
_7 = _a.debugMode,
|
|
15365
|
+
debugMode = _7 === void 0 ? false : _7;
|
|
15318
15366
|
useLanguage(lang);
|
|
15319
15367
|
useDebugLogging(debugMode);
|
|
15320
15368
|
var videoIdCaptureProps = React.useMemo(function () {
|
|
@@ -15335,6 +15383,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
15335
15383
|
idCaptureLoadingOverlayMode: idCaptureLoadingOverlayMode,
|
|
15336
15384
|
customOverlayContent: customOverlayContent,
|
|
15337
15385
|
onLoadingOverlayDismissed: onLoadingOverlayDismissed,
|
|
15386
|
+
idDocumentType: idDocumentType,
|
|
15338
15387
|
idCaptureGuideType: idCaptureGuideType,
|
|
15339
15388
|
idCaptureGuideImages: idCaptureGuideImages,
|
|
15340
15389
|
idCapturePortraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
|
|
@@ -15350,7 +15399,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
15350
15399
|
verbiage: verbiage,
|
|
15351
15400
|
debugMode: debugMode
|
|
15352
15401
|
};
|
|
15353
|
-
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
|
|
15402
|
+
}, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, idDocumentType, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
|
|
15354
15403
|
var additionalDocumentCaptureProps = React.useMemo(function () {
|
|
15355
15404
|
return {
|
|
15356
15405
|
documents: captureAdditionalDocuments,
|