idmission-web-sdk 1.0.322 → 1.0.324
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/read_text_prompt/ReadTextPrompt.d.ts +1 -1
- package/dist/sdk2.cjs.development.js +179 -93
- 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 +179 -93
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +179 -93
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -20,4 +20,4 @@ export type ReadTextPromptProps = {
|
|
|
20
20
|
classNames?: ReadTextPromptClassNames;
|
|
21
21
|
verbiage?: ReadTextPromptVerbiage;
|
|
22
22
|
};
|
|
23
|
-
export declare const ReadTextPrompt: ({ text, onComplete,
|
|
23
|
+
export declare const ReadTextPrompt: ({ text, onComplete, durationMs, classNames, verbiage: rawVerbiage, }: ReadTextPromptProps) => React.JSX.Element;
|
|
@@ -50,7 +50,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
50
50
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
51
51
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
52
52
|
|
|
53
|
-
var webSdkVersion = '1.0.
|
|
53
|
+
var webSdkVersion = '1.0.324';
|
|
54
54
|
|
|
55
55
|
function getPlatform() {
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -65,6 +65,30 @@ function getPlatform() {
|
|
|
65
65
|
function dataUrlToBase64(url) {
|
|
66
66
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
67
67
|
return tslib.__generator(this, function (_a) {
|
|
68
|
+
if (url.indexOf('blob:') >= 0) {
|
|
69
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
70
|
+
// Fetch the Blob content
|
|
71
|
+
fetch(url).then(function (response) {
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
throw new Error('Failed to fetch Blob content');
|
|
74
|
+
}
|
|
75
|
+
return response.blob();
|
|
76
|
+
}).then(function (blob) {
|
|
77
|
+
var reader = new FileReader();
|
|
78
|
+
reader.onload = function () {
|
|
79
|
+
var base64String = reader.result ? reader.result.split(',')[1] : '';
|
|
80
|
+
resolve(base64String);
|
|
81
|
+
};
|
|
82
|
+
reader.onerror = function () {
|
|
83
|
+
reader.abort();
|
|
84
|
+
reject(new Error('Error converting blob to base64'));
|
|
85
|
+
};
|
|
86
|
+
reader.readAsDataURL(blob);
|
|
87
|
+
})["catch"](function (error) {
|
|
88
|
+
reject(error);
|
|
89
|
+
});
|
|
90
|
+
})];
|
|
91
|
+
}
|
|
68
92
|
return [2 /*return*/, url.replace(/^data:image\/(png|jpeg);base64,/, '')];
|
|
69
93
|
});
|
|
70
94
|
});
|
|
@@ -9881,13 +9905,13 @@ var initialState$4 = {
|
|
|
9881
9905
|
var IdCaptureStateContext = /*#__PURE__*/React.createContext(initialState$4);
|
|
9882
9906
|
var IdCaptureDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
9883
9907
|
var reducer$4 = function reducer(state, action) {
|
|
9884
|
-
var _a;
|
|
9908
|
+
var _a, _b;
|
|
9885
9909
|
switch (action.type) {
|
|
9886
9910
|
case 'configureWizard':
|
|
9887
9911
|
{
|
|
9888
|
-
var
|
|
9889
|
-
captureRequirement =
|
|
9890
|
-
precapturedDocuments =
|
|
9912
|
+
var _c = action.payload,
|
|
9913
|
+
captureRequirement = _c.captureRequirement,
|
|
9914
|
+
precapturedDocuments = _c.precapturedDocuments;
|
|
9891
9915
|
var newState = tslib.__assign(tslib.__assign({}, state), {
|
|
9892
9916
|
captureRequirement: captureRequirement
|
|
9893
9917
|
});
|
|
@@ -9944,26 +9968,26 @@ var reducer$4 = function reducer(state, action) {
|
|
|
9944
9968
|
guideImageHeight: action.payload.height
|
|
9945
9969
|
});
|
|
9946
9970
|
case 'objectsDetected':
|
|
9947
|
-
var
|
|
9948
|
-
detectedObjects =
|
|
9949
|
-
detectionScore =
|
|
9950
|
-
detectionThresholdMet =
|
|
9951
|
-
detectedDocumentType =
|
|
9952
|
-
passportDetectionScore =
|
|
9953
|
-
passportDetectionThresholdMet =
|
|
9954
|
-
mrzDetectionScore =
|
|
9955
|
-
mrzDetectionThresholdMet =
|
|
9956
|
-
pdf417DetectionScore =
|
|
9957
|
-
pdf417DetectionThresholdMet =
|
|
9958
|
-
bestDocumentOrPassport =
|
|
9959
|
-
bestMrz =
|
|
9960
|
-
bestPdf417 =
|
|
9961
|
-
documentInBounds =
|
|
9962
|
-
documentTooClose =
|
|
9963
|
-
focusScore =
|
|
9964
|
-
focusThresholdMet =
|
|
9965
|
-
frameWidth =
|
|
9966
|
-
frameHeight =
|
|
9971
|
+
var _d = action.payload.prediction,
|
|
9972
|
+
detectedObjects = _d.detectedObjects,
|
|
9973
|
+
detectionScore = _d.detectionScore,
|
|
9974
|
+
detectionThresholdMet = _d.detectionThresholdMet,
|
|
9975
|
+
detectedDocumentType = _d.detectedDocumentType,
|
|
9976
|
+
passportDetectionScore = _d.passportDetectionScore,
|
|
9977
|
+
passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
|
|
9978
|
+
mrzDetectionScore = _d.mrzDetectionScore,
|
|
9979
|
+
mrzDetectionThresholdMet = _d.mrzDetectionThresholdMet,
|
|
9980
|
+
pdf417DetectionScore = _d.pdf417DetectionScore,
|
|
9981
|
+
pdf417DetectionThresholdMet = _d.pdf417DetectionThresholdMet,
|
|
9982
|
+
bestDocumentOrPassport = _d.bestDocumentOrPassport,
|
|
9983
|
+
bestMrz = _d.bestMrz,
|
|
9984
|
+
bestPdf417 = _d.bestPdf417,
|
|
9985
|
+
documentInBounds = _d.documentInBounds,
|
|
9986
|
+
documentTooClose = _d.documentTooClose,
|
|
9987
|
+
focusScore = _d.focusScore,
|
|
9988
|
+
focusThresholdMet = _d.focusThresholdMet,
|
|
9989
|
+
frameWidth = _d.frameWidth,
|
|
9990
|
+
frameHeight = _d.frameHeight;
|
|
9967
9991
|
var frameCapturedAt = new Date();
|
|
9968
9992
|
var frameCaptureRate = 0;
|
|
9969
9993
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -10012,9 +10036,9 @@ var reducer$4 = function reducer(state, action) {
|
|
|
10012
10036
|
});
|
|
10013
10037
|
case 'predictionMade':
|
|
10014
10038
|
{
|
|
10015
|
-
var
|
|
10016
|
-
detectedDocumentType_1 =
|
|
10017
|
-
passportDetectionScore_1 =
|
|
10039
|
+
var _e = action.payload,
|
|
10040
|
+
detectedDocumentType_1 = _e.detectedDocumentType,
|
|
10041
|
+
passportDetectionScore_1 = _e.passportDetectionScore;
|
|
10018
10042
|
var requestedDocumentType = state.requestedDocumentType;
|
|
10019
10043
|
var newState = tslib.__assign(tslib.__assign({}, state), {
|
|
10020
10044
|
detectedDocumentType: detectedDocumentType_1
|
|
@@ -10104,19 +10128,35 @@ var reducer$4 = function reducer(state, action) {
|
|
|
10104
10128
|
}
|
|
10105
10129
|
case 'documentCapturedManually':
|
|
10106
10130
|
{
|
|
10107
|
-
var
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10131
|
+
var newState_2 = tslib.__assign(tslib.__assign({}, state), {
|
|
10132
|
+
capturedDocuments: tslib.__assign(tslib.__assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = tslib.__assign(tslib.__assign({}, action.payload), {
|
|
10133
|
+
width: 0,
|
|
10134
|
+
height: 0
|
|
10135
|
+
}), _b))
|
|
10136
|
+
});
|
|
10137
|
+
var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
|
|
10138
|
+
return !(v in newState_2.capturedDocuments);
|
|
10111
10139
|
});
|
|
10112
|
-
if (
|
|
10113
|
-
|
|
10140
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
10141
|
+
if (state.requestedDocumentType === 'passport') {
|
|
10142
|
+
remainingRequirements = [];
|
|
10143
|
+
} else {
|
|
10144
|
+
remainingRequirements = remainingRequirements.filter(function (v) {
|
|
10145
|
+
return v !== 'passport';
|
|
10146
|
+
});
|
|
10147
|
+
}
|
|
10148
|
+
}
|
|
10149
|
+
if (remainingRequirements.length === 0) {
|
|
10150
|
+
newState_2.captureState = 'complete';
|
|
10114
10151
|
} else {
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10152
|
+
newState_2.requestedDocumentType = remainingRequirements[0];
|
|
10153
|
+
if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack') {
|
|
10154
|
+
newState_2.captureState = 'requestingFlip';
|
|
10155
|
+
newState_2.documentDetectionThresholdMet = false;
|
|
10156
|
+
newState_2.passportPageDetectionThresholdMet = false;
|
|
10157
|
+
}
|
|
10118
10158
|
}
|
|
10119
|
-
return
|
|
10159
|
+
return newState_2;
|
|
10120
10160
|
}
|
|
10121
10161
|
case 'flipRequestCompleted':
|
|
10122
10162
|
return tslib.__assign(tslib.__assign({}, state), {
|
|
@@ -13451,11 +13491,23 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
13451
13491
|
idCaptureRequirement: captureRequirement,
|
|
13452
13492
|
onFinished: onSubmitClick,
|
|
13453
13493
|
onCapture: function onCapture(imageData) {
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13494
|
+
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
13495
|
+
var base64ImageData;
|
|
13496
|
+
return tslib.__generator(this, function (_a) {
|
|
13497
|
+
switch (_a.label) {
|
|
13498
|
+
case 0:
|
|
13499
|
+
return [4 /*yield*/, dataUrlToBase64(imageData)];
|
|
13500
|
+
case 1:
|
|
13501
|
+
base64ImageData = _a.sent();
|
|
13502
|
+
dispatch({
|
|
13503
|
+
type: 'documentCapturedManually',
|
|
13504
|
+
payload: {
|
|
13505
|
+
imageData: base64ImageData
|
|
13506
|
+
}
|
|
13507
|
+
});
|
|
13508
|
+
return [2 /*return*/];
|
|
13509
|
+
}
|
|
13510
|
+
});
|
|
13459
13511
|
});
|
|
13460
13512
|
},
|
|
13461
13513
|
classNames: classNames.fallback,
|
|
@@ -14162,32 +14214,32 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
14162
14214
|
}, [checkLiveness, face, frame, isReady, submissionError]);
|
|
14163
14215
|
var onFallbackImageCaptured = React.useCallback(function (imageUrl) {
|
|
14164
14216
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
14165
|
-
var
|
|
14166
|
-
return tslib.__generator(this, function (
|
|
14167
|
-
switch (
|
|
14217
|
+
var imageData, response, e_2;
|
|
14218
|
+
return tslib.__generator(this, function (_a) {
|
|
14219
|
+
switch (_a.label) {
|
|
14168
14220
|
case 0:
|
|
14169
14221
|
dispatch({
|
|
14170
14222
|
type: 'livenessChecking'
|
|
14171
14223
|
});
|
|
14172
|
-
|
|
14224
|
+
_a.label = 1;
|
|
14173
14225
|
case 1:
|
|
14174
|
-
|
|
14175
|
-
_a = checkLiveness;
|
|
14226
|
+
_a.trys.push([1, 4,, 5]);
|
|
14176
14227
|
return [4 /*yield*/, dataUrlToBase64(imageUrl)];
|
|
14177
14228
|
case 2:
|
|
14178
|
-
|
|
14229
|
+
imageData = _a.sent();
|
|
14230
|
+
return [4 /*yield*/, checkLiveness(imageData)];
|
|
14179
14231
|
case 3:
|
|
14180
|
-
response =
|
|
14232
|
+
response = _a.sent();
|
|
14181
14233
|
dispatch({
|
|
14182
14234
|
type: 'livenessChecked',
|
|
14183
14235
|
payload: {
|
|
14184
|
-
imageUrl:
|
|
14236
|
+
imageUrl: imageData,
|
|
14185
14237
|
response: response
|
|
14186
14238
|
}
|
|
14187
14239
|
});
|
|
14188
14240
|
return [3 /*break*/, 5];
|
|
14189
14241
|
case 4:
|
|
14190
|
-
e_2 =
|
|
14242
|
+
e_2 = _a.sent();
|
|
14191
14243
|
dispatch({
|
|
14192
14244
|
type: 'livenessCheckFailed',
|
|
14193
14245
|
payload: {
|
|
@@ -16072,7 +16124,6 @@ var templateObject_1$7, templateObject_2$7, templateObject_3$7, templateObject_4
|
|
|
16072
16124
|
var ReadTextPrompt = function ReadTextPrompt(_a) {
|
|
16073
16125
|
var text = _a.text,
|
|
16074
16126
|
onComplete = _a.onComplete,
|
|
16075
|
-
startedAt = _a.startedAt,
|
|
16076
16127
|
_b = _a.durationMs,
|
|
16077
16128
|
durationMs = _b === void 0 ? 15000 : _b,
|
|
16078
16129
|
_c = _a.classNames,
|
|
@@ -16080,11 +16131,32 @@ var ReadTextPrompt = function ReadTextPrompt(_a) {
|
|
|
16080
16131
|
_d = _a.verbiage,
|
|
16081
16132
|
rawVerbiage = _d === void 0 ? {} : _d;
|
|
16082
16133
|
text = useVerbiage(text, '');
|
|
16134
|
+
var countdownTimeoutRef = React.useRef(undefined);
|
|
16135
|
+
var _e = React.useState(durationMs / 1000),
|
|
16136
|
+
countdownRemaining = _e[0],
|
|
16137
|
+
setCountdownRemaining = _e[1];
|
|
16083
16138
|
var verbiage = useTranslations(rawVerbiage, {
|
|
16084
16139
|
headingText: 'Please read the following text aloud',
|
|
16085
16140
|
doneBtnText: 'Done'
|
|
16086
16141
|
});
|
|
16087
|
-
var
|
|
16142
|
+
var manualCountdown = function manualCountdown(remainingTime) {
|
|
16143
|
+
if (remainingTime > 0) {
|
|
16144
|
+
var nextCycle_1 = remainingTime - 1;
|
|
16145
|
+
setCountdownRemaining(nextCycle_1);
|
|
16146
|
+
countdownTimeoutRef.current = setTimeout(function () {
|
|
16147
|
+
return manualCountdown(nextCycle_1);
|
|
16148
|
+
}, 1000);
|
|
16149
|
+
}
|
|
16150
|
+
};
|
|
16151
|
+
React.useEffect(function () {
|
|
16152
|
+
setCountdownRemaining(countdownRemaining);
|
|
16153
|
+
countdownTimeoutRef.current = setTimeout(function () {
|
|
16154
|
+
return manualCountdown(countdownRemaining);
|
|
16155
|
+
}, 1000);
|
|
16156
|
+
return function () {
|
|
16157
|
+
clearTimeout(countdownTimeoutRef.current);
|
|
16158
|
+
};
|
|
16159
|
+
}, []);
|
|
16088
16160
|
return /*#__PURE__*/React__default['default'].createElement(ReadTextPromptContainer, {
|
|
16089
16161
|
className: classNames.container
|
|
16090
16162
|
}, /*#__PURE__*/React__default['default'].createElement(ReadTextPromptHeading, {
|
|
@@ -16095,22 +16167,13 @@ var ReadTextPrompt = function ReadTextPrompt(_a) {
|
|
|
16095
16167
|
className: classNames.buttonsRow
|
|
16096
16168
|
}, /*#__PURE__*/React__default['default'].createElement(ReadTextPromptTimeRemaining, {
|
|
16097
16169
|
className: classNames.timeRemaining
|
|
16098
|
-
},
|
|
16170
|
+
}, countdownRemaining), /*#__PURE__*/React__default['default'].createElement(DoneButton, {
|
|
16099
16171
|
variant: "positive",
|
|
16100
16172
|
className: classNames.doneBtn,
|
|
16101
16173
|
onClick: onComplete,
|
|
16102
16174
|
finished: true
|
|
16103
16175
|
}, verbiage.doneBtnText)));
|
|
16104
16176
|
};
|
|
16105
|
-
function msToTime(s) {
|
|
16106
|
-
var ms = s % 1000;
|
|
16107
|
-
s = (s - ms) / 1000;
|
|
16108
|
-
var secs = s % 60;
|
|
16109
|
-
s = (s - secs) / 60;
|
|
16110
|
-
var mins = s % 60;
|
|
16111
|
-
secs += 1;
|
|
16112
|
-
return mins + ':' + ('00' + secs).slice(-2);
|
|
16113
|
-
}
|
|
16114
16177
|
var ReadTextPromptContainer = styled__default['default'].div(templateObject_1$6 || (templateObject_1$6 = tslib.__makeTemplateObject(["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n"], ["\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n flex-direction: column;\n"])));
|
|
16115
16178
|
var ReadTextPromptHeading = styled__default['default'].div(templateObject_2$6 || (templateObject_2$6 = tslib.__makeTemplateObject(["\n padding: 20px;\n font-weight: bold;\n margin: auto auto 32px;\n\n ", ";\n ", ";\n ", ";\n"], ["\n padding: 20px;\n font-weight: bold;\n margin: auto auto 32px;\n\n ", ";\n ", ";\n ", ";\n"])), function (props) {
|
|
16116
16179
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -16236,6 +16299,10 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16236
16299
|
stopRecordingAudio = _21.stopRecordingAudio,
|
|
16237
16300
|
videoUrl = _21.videoUrl,
|
|
16238
16301
|
audioUrl = _21.audioUrl;
|
|
16302
|
+
var countdownTimeoutRef = React.useRef(undefined);
|
|
16303
|
+
var _22 = React.useState(0),
|
|
16304
|
+
countdownRemaining = _22[0],
|
|
16305
|
+
setCountdownRemaining = _22[1];
|
|
16239
16306
|
React.useEffect(function () {
|
|
16240
16307
|
if (!isRecordingVideo && !videoUrl) {
|
|
16241
16308
|
startRecordingVideo();
|
|
@@ -16251,9 +16318,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16251
16318
|
React.useEffect(function () {
|
|
16252
16319
|
shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady && (!readTextPrompt || microphoneReady);
|
|
16253
16320
|
}, [cameraReady, idModelsReady, microphoneReady, readTextPrompt, videoLoaded]);
|
|
16254
|
-
var
|
|
16255
|
-
requestedAction =
|
|
16256
|
-
setRequestedAction =
|
|
16321
|
+
var _23 = React.useState('SHOW_ID_FRONT'),
|
|
16322
|
+
requestedAction = _23[0],
|
|
16323
|
+
setRequestedAction = _23[1];
|
|
16257
16324
|
React.useEffect(function () {
|
|
16258
16325
|
if (requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
|
|
16259
16326
|
if (!idCaptureModelsEnabled || !idModelsReady || !cameraReady || !videoLoaded) return;
|
|
@@ -16281,15 +16348,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16281
16348
|
}
|
|
16282
16349
|
});
|
|
16283
16350
|
}, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
|
|
16284
|
-
var _23 = React.useState(0),
|
|
16285
|
-
currentDetectionScore = _23[0],
|
|
16286
|
-
setCurrentDetectionScore = _23[1];
|
|
16287
16351
|
var _24 = React.useState(0),
|
|
16288
|
-
|
|
16289
|
-
|
|
16352
|
+
currentDetectionScore = _24[0],
|
|
16353
|
+
setCurrentDetectionScore = _24[1];
|
|
16290
16354
|
var _25 = React.useState(0),
|
|
16291
|
-
|
|
16292
|
-
|
|
16355
|
+
currentFocusScore = _25[0],
|
|
16356
|
+
setCurrentFocusScore = _25[1];
|
|
16357
|
+
var _26 = React.useState(0),
|
|
16358
|
+
goodFramesCount = _26[0],
|
|
16359
|
+
setGoodFramesCount = _26[1];
|
|
16293
16360
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
|
|
16294
16361
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
16295
16362
|
React.useEffect(function () {
|
|
@@ -16307,9 +16374,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16307
16374
|
}
|
|
16308
16375
|
});
|
|
16309
16376
|
}, [idCaptureModelsEnabled, idCardFrontDetectionThreshold, onIdPredictionMade]);
|
|
16310
|
-
var
|
|
16311
|
-
idFrontCaptureStartedAt =
|
|
16312
|
-
setFirstGoodFrameTime =
|
|
16377
|
+
var _27 = React.useState(null),
|
|
16378
|
+
idFrontCaptureStartedAt = _27[0],
|
|
16379
|
+
setFirstGoodFrameTime = _27[1];
|
|
16313
16380
|
React.useEffect(function () {
|
|
16314
16381
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
16315
16382
|
}, [goodFramesCount]);
|
|
@@ -16330,9 +16397,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16330
16397
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
16331
16398
|
var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
|
|
16332
16399
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
16333
|
-
var
|
|
16334
|
-
countdownStartedAt =
|
|
16335
|
-
setCountdownStartedAt =
|
|
16400
|
+
var _28 = React.useState(),
|
|
16401
|
+
countdownStartedAt = _28[0],
|
|
16402
|
+
setCountdownStartedAt = _28[1];
|
|
16336
16403
|
var frameLock = React.useRef(false);
|
|
16337
16404
|
var captureFrame = React.useCallback(function () {
|
|
16338
16405
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
@@ -16421,18 +16488,38 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16421
16488
|
setCountdownStartedAt(new Date());
|
|
16422
16489
|
}
|
|
16423
16490
|
}, [countdownStartedAt, satisfied]);
|
|
16491
|
+
React.useEffect(function () {
|
|
16492
|
+
return function () {
|
|
16493
|
+
clearTimeout(countdownTimeoutRef.current);
|
|
16494
|
+
};
|
|
16495
|
+
}, []);
|
|
16496
|
+
var manualCountdown = function manualCountdown(remainingTime) {
|
|
16497
|
+
if (remainingTime > 0) {
|
|
16498
|
+
var nextCycle_1 = remainingTime - 1;
|
|
16499
|
+
setCountdownRemaining(nextCycle_1);
|
|
16500
|
+
countdownTimeoutRef.current = setTimeout(function () {
|
|
16501
|
+
return manualCountdown(nextCycle_1);
|
|
16502
|
+
}, 1000);
|
|
16503
|
+
return;
|
|
16504
|
+
}
|
|
16505
|
+
if (countdownStartedAt) {
|
|
16506
|
+
captureFrame();
|
|
16507
|
+
}
|
|
16508
|
+
};
|
|
16424
16509
|
React.useEffect(function () {
|
|
16425
16510
|
if (!countdownStartedAt) return;
|
|
16426
|
-
|
|
16427
|
-
|
|
16511
|
+
setCountdownRemaining(captureCountdownSeconds);
|
|
16512
|
+
countdownTimeoutRef.current = setTimeout(function () {
|
|
16513
|
+
return manualCountdown(captureCountdownSeconds);
|
|
16514
|
+
}, 1000);
|
|
16428
16515
|
return function () {
|
|
16429
|
-
clearTimeout(
|
|
16516
|
+
clearTimeout(countdownTimeoutRef.current);
|
|
16430
16517
|
};
|
|
16431
16518
|
}, [captureCountdownSeconds, captureFrame, countdownStartedAt]);
|
|
16432
16519
|
var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
|
|
16433
|
-
var
|
|
16434
|
-
numFramesWithoutFaces =
|
|
16435
|
-
setNumFramesWithoutFaces =
|
|
16520
|
+
var _29 = React.useState(0),
|
|
16521
|
+
numFramesWithoutFaces = _29[0],
|
|
16522
|
+
setNumFramesWithoutFaces = _29[1];
|
|
16436
16523
|
React.useEffect(function () {
|
|
16437
16524
|
onSelfiePredictionMade(function (faces) {
|
|
16438
16525
|
setFaces(faces);
|
|
@@ -16448,14 +16535,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16448
16535
|
}
|
|
16449
16536
|
}, [numFramesWithoutFaces, onFaceNotDetected]);
|
|
16450
16537
|
var theme = styled.useTheme();
|
|
16451
|
-
var
|
|
16538
|
+
var _30 = useTranslations(rawVerbiage, {
|
|
16452
16539
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
16453
16540
|
searchingForIdCardText: 'Searching for ID card...',
|
|
16454
16541
|
captureBtnText: 'Capture'
|
|
16455
16542
|
}),
|
|
16456
|
-
captureBtnText =
|
|
16457
|
-
faceNotCenteredText =
|
|
16458
|
-
searchingForIdCardText =
|
|
16543
|
+
captureBtnText = _30.captureBtnText,
|
|
16544
|
+
faceNotCenteredText = _30.faceNotCenteredText,
|
|
16545
|
+
searchingForIdCardText = _30.searchingForIdCardText;
|
|
16459
16546
|
var debugScalingDetails = useDebugScalingDetails({
|
|
16460
16547
|
enabled: debugMode,
|
|
16461
16548
|
pageWidth: width,
|
|
@@ -16464,7 +16551,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16464
16551
|
videoHeight: (_k = (_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.videoHeight) !== null && _k !== void 0 ? _k : 0
|
|
16465
16552
|
});
|
|
16466
16553
|
var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
|
|
16467
|
-
var countdownRemaining = !!countdownStartedAt && Math.max(0, captureCountdownSeconds - Math.floor((new Date().getTime() - countdownStartedAt.getTime()) / 1000.0));
|
|
16468
16554
|
var searchingForIdCard = idCaptureModelsEnabled && capturingId && !goodFramesThresholdMet;
|
|
16469
16555
|
var guidanceText = !faceCentered ? faceNotCenteredText : searchingForIdCard ? searchingForIdCardText : undefined;
|
|
16470
16556
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
@@ -16502,7 +16588,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
16502
16588
|
face: face,
|
|
16503
16589
|
scaling: debugScalingDetails
|
|
16504
16590
|
});
|
|
16505
|
-
})))))), guidanceText && ( /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
|
|
16591
|
+
})))))), guidanceText && idCaptureModelsEnabled && !modelError && ( /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
|
|
16506
16592
|
className: classNames.guidanceMessageContainer
|
|
16507
16593
|
}, /*#__PURE__*/React__default['default'].createElement(GuidanceMessage, {
|
|
16508
16594
|
className: classNames.guidanceMessage,
|