idmission-web-sdk 0.0.51 → 0.0.53
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/common/SelfieProgressPreview.d.ts +4 -0
- package/dist/components/face_liveness/FaceLivenessCapture.d.ts +0 -3
- package/dist/lib/utils/useTimeout.d.ts +4 -0
- package/dist/sdk2.cjs.development.js +129 -128
- 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 +129 -128
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +129 -128
- 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/package.json +1 -1
|
@@ -17,6 +17,3 @@ export type FaceLivenessCaptureProps = {
|
|
|
17
17
|
debugMode?: boolean;
|
|
18
18
|
};
|
|
19
19
|
export declare const FaceLivenessCapture: ({ onCapture, onSuccess, onTimeout, onExit, timeoutDurationMs, colors, verbiage, debugMode, }: FaceLivenessCaptureProps) => ReactElement;
|
|
20
|
-
export declare const SelfieProgressPreview: ({ imageUrl }: {
|
|
21
|
-
imageUrl: string;
|
|
22
|
-
}) => JSX.Element;
|
|
@@ -9934,6 +9934,42 @@ var GuidanceMessage = styled__default['default'].div(templateObject_2$2 || (temp
|
|
|
9934
9934
|
});
|
|
9935
9935
|
var templateObject_1$4, templateObject_2$2;
|
|
9936
9936
|
|
|
9937
|
+
var useTimeout = function useTimeout(durationMs, onTimeout, timeoutAverted, shouldWaitLonger) {
|
|
9938
|
+
var _a = React.useState(false),
|
|
9939
|
+
timedOut = _a[0],
|
|
9940
|
+
setTimedOut = _a[1];
|
|
9941
|
+
var _b = React.useState(),
|
|
9942
|
+
timeoutStartedAt = _b[0],
|
|
9943
|
+
setTimeoutStartedAt = _b[1];
|
|
9944
|
+
React.useEffect(function () {
|
|
9945
|
+
if (!durationMs) return;
|
|
9946
|
+
setTimeoutStartedAt(new Date());
|
|
9947
|
+
var timer = setTimeout(function () {
|
|
9948
|
+
setTimedOut(true);
|
|
9949
|
+
}, durationMs);
|
|
9950
|
+
return function () {
|
|
9951
|
+
if (timer) clearTimeout(timer);
|
|
9952
|
+
};
|
|
9953
|
+
}, [durationMs]);
|
|
9954
|
+
React.useEffect(function () {
|
|
9955
|
+
if (!timedOut || timeoutAverted) return;
|
|
9956
|
+
if (!shouldWaitLonger) {
|
|
9957
|
+
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
|
|
9958
|
+
return;
|
|
9959
|
+
}
|
|
9960
|
+
var t = setTimeout(function () {
|
|
9961
|
+
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
|
|
9962
|
+
}, 10000);
|
|
9963
|
+
return function () {
|
|
9964
|
+
clearTimeout(t);
|
|
9965
|
+
};
|
|
9966
|
+
}, [onTimeout, shouldWaitLonger, timedOut, timeoutAverted]);
|
|
9967
|
+
return {
|
|
9968
|
+
timedOut: timedOut,
|
|
9969
|
+
timeoutStartedAt: timeoutStartedAt
|
|
9970
|
+
};
|
|
9971
|
+
};
|
|
9972
|
+
|
|
9937
9973
|
var initialState$3 = {
|
|
9938
9974
|
videoWidth: 0,
|
|
9939
9975
|
videoHeight: 0,
|
|
@@ -10125,25 +10161,9 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
10125
10161
|
});
|
|
10126
10162
|
})();
|
|
10127
10163
|
}, [captureReady, onSelfieCaptured, state.faces, takePhoto]);
|
|
10128
|
-
var _p =
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
var _q = React.useState(false),
|
|
10132
|
-
timedOut = _q[0],
|
|
10133
|
-
setTimedOut = _q[1];
|
|
10134
|
-
React.useEffect(function () {
|
|
10135
|
-
if (!timeoutDurationMs) return;
|
|
10136
|
-
setTimeoutStartedAt(new Date());
|
|
10137
|
-
var timer = setTimeout(function () {
|
|
10138
|
-
setTimedOut(true);
|
|
10139
|
-
}, timeoutDurationMs);
|
|
10140
|
-
return function () {
|
|
10141
|
-
if (timer) clearTimeout(timer);
|
|
10142
|
-
};
|
|
10143
|
-
}, [timeoutDurationMs]);
|
|
10144
|
-
React.useEffect(function () {
|
|
10145
|
-
if (timedOut) onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
|
|
10146
|
-
}, [onTimeout, timedOut]);
|
|
10164
|
+
var _p = useTimeout(timeoutDurationMs, onTimeout),
|
|
10165
|
+
timedOut = _p.timedOut,
|
|
10166
|
+
timeoutStartedAt = _p.timeoutStartedAt;
|
|
10147
10167
|
var debugScalingDetails = useDebugScalingDetails({
|
|
10148
10168
|
enabled: debugMode,
|
|
10149
10169
|
pageWidth: width,
|
|
@@ -10216,6 +10236,28 @@ var Spinner = styled__default['default'].div(templateObject_1$3 || (templateObje
|
|
|
10216
10236
|
});
|
|
10217
10237
|
var templateObject_1$3;
|
|
10218
10238
|
|
|
10239
|
+
var SelfieProgressPreview = function SelfieProgressPreview(_a) {
|
|
10240
|
+
var imageUrl = _a.imageUrl;
|
|
10241
|
+
return /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreviewWrapper, null, /*#__PURE__*/React__default['default'].createElement(SelfieProgressText, null, /*#__PURE__*/React__default['default'].createElement(Spinner, {
|
|
10242
|
+
"$size": 24,
|
|
10243
|
+
"$color": "white",
|
|
10244
|
+
"$thickness": 3,
|
|
10245
|
+
style: {
|
|
10246
|
+
position: 'relative',
|
|
10247
|
+
top: 4,
|
|
10248
|
+
left: -3,
|
|
10249
|
+
margin: '0 3px 0 -12px'
|
|
10250
|
+
}
|
|
10251
|
+
}), "Processing..."), /*#__PURE__*/React__default['default'].createElement(SelfiePreviewImageWrapper, null, /*#__PURE__*/React__default['default'].createElement("img", {
|
|
10252
|
+
src: imageUrl,
|
|
10253
|
+
alt: ""
|
|
10254
|
+
})));
|
|
10255
|
+
};
|
|
10256
|
+
var SelfieProgressPreviewWrapper = styled__default['default'].div(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"], ["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"])));
|
|
10257
|
+
var SelfieProgressText = styled__default['default'].div(templateObject_2$1 || (templateObject_2$1 = tslib.__makeTemplateObject(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"], ["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"])));
|
|
10258
|
+
var SelfiePreviewImageWrapper = styled__default['default'].div(templateObject_3$1 || (templateObject_3$1 = tslib.__makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
|
|
10259
|
+
var templateObject_1$2, templateObject_2$1, templateObject_3$1;
|
|
10260
|
+
|
|
10219
10261
|
var initialState$2 = {
|
|
10220
10262
|
frame: null,
|
|
10221
10263
|
face: null,
|
|
@@ -10385,31 +10427,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
10385
10427
|
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
|
|
10386
10428
|
}
|
|
10387
10429
|
}, [onTimeout, state.timesLivenessCheckFailed]);
|
|
10388
|
-
|
|
10389
|
-
timedOut = _g[0],
|
|
10390
|
-
setTimedOut = _g[1];
|
|
10391
|
-
React.useEffect(function () {
|
|
10392
|
-
if (!timeoutDurationMs) return;
|
|
10393
|
-
var timer = setTimeout(function () {
|
|
10394
|
-
setTimedOut(true);
|
|
10395
|
-
}, timeoutDurationMs);
|
|
10396
|
-
return function () {
|
|
10397
|
-
if (timer) clearTimeout(timer);
|
|
10398
|
-
};
|
|
10399
|
-
}, [timeoutDurationMs]);
|
|
10400
|
-
React.useEffect(function () {
|
|
10401
|
-
if (!timedOut || state.requestState === 'PASSED') return;
|
|
10402
|
-
if (state.requestState !== 'IN_PROGRESS') {
|
|
10403
|
-
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
|
|
10404
|
-
return;
|
|
10405
|
-
}
|
|
10406
|
-
var t = setTimeout(function () {
|
|
10407
|
-
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
|
|
10408
|
-
}, 10000);
|
|
10409
|
-
return function () {
|
|
10410
|
-
clearTimeout(t);
|
|
10411
|
-
};
|
|
10412
|
-
}, [onTimeout, state.requestState, timedOut]);
|
|
10430
|
+
useTimeout(timeoutDurationMs, onTimeout, state.requestState === 'PASSED', state.requestState === 'IN_PROGRESS');
|
|
10413
10431
|
verbiage.guidanceRemoveEyeCoveringsText || (verbiage.guidanceRemoveEyeCoveringsText = t('Please remove your eye coverings (sunglasses, eye patch, etc.)...'));
|
|
10414
10432
|
verbiage.guidanceRemoveHeadCoveringsText || (verbiage.guidanceRemoveHeadCoveringsText = t('Please remove your head coverings (hat, scarf, etc.)...'));
|
|
10415
10433
|
verbiage.guidanceRemoveMaskText || (verbiage.guidanceRemoveMaskText = t('Please remove your mask...'));
|
|
@@ -10426,27 +10444,6 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
10426
10444
|
imageUrl: imageUrl
|
|
10427
10445
|
}));
|
|
10428
10446
|
};
|
|
10429
|
-
var SelfieProgressPreview = function SelfieProgressPreview(_a) {
|
|
10430
|
-
var imageUrl = _a.imageUrl;
|
|
10431
|
-
return /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreviewWrapper, null, /*#__PURE__*/React__default['default'].createElement(SelfieProgressText, null, /*#__PURE__*/React__default['default'].createElement(Spinner, {
|
|
10432
|
-
"$size": 24,
|
|
10433
|
-
"$color": "white",
|
|
10434
|
-
"$thickness": 3,
|
|
10435
|
-
style: {
|
|
10436
|
-
position: 'relative',
|
|
10437
|
-
top: 4,
|
|
10438
|
-
left: -3,
|
|
10439
|
-
margin: '0 3px 0 -12px'
|
|
10440
|
-
}
|
|
10441
|
-
}), "Processing..."), /*#__PURE__*/React__default['default'].createElement(SelfiePreviewImageWrapper, null, /*#__PURE__*/React__default['default'].createElement("img", {
|
|
10442
|
-
src: imageUrl,
|
|
10443
|
-
alt: ""
|
|
10444
|
-
})));
|
|
10445
|
-
};
|
|
10446
|
-
var SelfieProgressPreviewWrapper = styled__default['default'].div(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"], ["\n position: absolute;\n display: flex;\n flex-direction: column;\n height: 33%;\n bottom: 12px;\n right: 12px;\n"])));
|
|
10447
|
-
var SelfieProgressText = styled__default['default'].div(templateObject_2$1 || (templateObject_2$1 = tslib.__makeTemplateObject(["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"], ["\n display: block;\n position: absolute;\n top: -32px;\n font:\n 14px -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Helvetica,\n Arial,\n sans-serif,\n 'Apple Color Emoji',\n 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n color: white;\n text-align: center;\n margin: 0 auto;\n width: 100%;\n"])));
|
|
10448
|
-
var SelfiePreviewImageWrapper = styled__default['default'].div(templateObject_3$1 || (templateObject_3$1 = tslib.__makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
|
|
10449
|
-
var templateObject_1$2, templateObject_2$1, templateObject_3$1;
|
|
10450
10447
|
|
|
10451
10448
|
var SelfieCaptureLoadingOverlay = function SelfieCaptureLoadingOverlay(_a) {
|
|
10452
10449
|
var headingText = _a.headingText,
|
|
@@ -12573,7 +12570,7 @@ var initialState$1 = {
|
|
|
12573
12570
|
frame: null,
|
|
12574
12571
|
face: null,
|
|
12575
12572
|
imageUrl: null,
|
|
12576
|
-
requestState: '
|
|
12573
|
+
requestState: 'CAPTURING',
|
|
12577
12574
|
requestError: null,
|
|
12578
12575
|
unverifiedTimes: 0
|
|
12579
12576
|
};
|
|
@@ -12581,10 +12578,10 @@ var reducer$1 = function reducer(state, action) {
|
|
|
12581
12578
|
switch (action.type) {
|
|
12582
12579
|
case 'verificationReady':
|
|
12583
12580
|
{
|
|
12584
|
-
var allowedStates = ['
|
|
12581
|
+
var allowedStates = ['CAPTURING', 'ERROR'];
|
|
12585
12582
|
if (allowedStates.includes(state.requestState)) {
|
|
12586
12583
|
return tslib.__assign(tslib.__assign({}, state), {
|
|
12587
|
-
requestState: '
|
|
12584
|
+
requestState: 'CAPTURED',
|
|
12588
12585
|
frame: action.payload.frame,
|
|
12589
12586
|
face: action.payload.face
|
|
12590
12587
|
});
|
|
@@ -12594,7 +12591,7 @@ var reducer$1 = function reducer(state, action) {
|
|
|
12594
12591
|
}
|
|
12595
12592
|
case 'verifying':
|
|
12596
12593
|
return tslib.__assign(tslib.__assign({}, state), {
|
|
12597
|
-
requestState: '
|
|
12594
|
+
requestState: 'VERIFYING',
|
|
12598
12595
|
imageUrl: action.payload.imageUrl
|
|
12599
12596
|
});
|
|
12600
12597
|
case 'verificationCompleted':
|
|
@@ -12613,14 +12610,14 @@ var reducer$1 = function reducer(state, action) {
|
|
|
12613
12610
|
}
|
|
12614
12611
|
var requestState = state.requestState,
|
|
12615
12612
|
unverifiedTimes = state.unverifiedTimes;
|
|
12616
|
-
var customerMatched = resultData.verificationResultCode === '
|
|
12613
|
+
var customerMatched = resultData.verificationResultCode === '00';
|
|
12617
12614
|
if (customerMatched) {
|
|
12618
|
-
requestState = '
|
|
12615
|
+
requestState = 'VERIFIED';
|
|
12619
12616
|
} else if (unverifiedTimes < 2) {
|
|
12620
|
-
requestState = '
|
|
12617
|
+
requestState = 'CAPTURING';
|
|
12621
12618
|
unverifiedTimes += 1;
|
|
12622
12619
|
} else {
|
|
12623
|
-
requestState = '
|
|
12620
|
+
requestState = 'REJECTED';
|
|
12624
12621
|
}
|
|
12625
12622
|
return tslib.__assign(tslib.__assign({}, state), {
|
|
12626
12623
|
requestState: requestState,
|
|
@@ -12658,6 +12655,9 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
|
|
|
12658
12655
|
submissionResponse = _f.submissionResponse,
|
|
12659
12656
|
selfieImage = _f.selfieImage,
|
|
12660
12657
|
setSelfieImage = _f.setSelfieImage;
|
|
12658
|
+
var _g = React.useState(null),
|
|
12659
|
+
imageUrl = _g[0],
|
|
12660
|
+
setImageUrl = _g[1];
|
|
12661
12661
|
var onSelfieCaptured = React.useCallback(function (frame, face) {
|
|
12662
12662
|
dispatch({
|
|
12663
12663
|
type: 'verificationReady',
|
|
@@ -12667,11 +12667,12 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
|
|
|
12667
12667
|
}
|
|
12668
12668
|
});
|
|
12669
12669
|
}, []);
|
|
12670
|
-
var isReady = state.requestState === '
|
|
12670
|
+
var isReady = state.requestState === 'CAPTURED';
|
|
12671
12671
|
React.useEffect(function () {
|
|
12672
12672
|
if (!frame || !face) return;
|
|
12673
|
-
|
|
12674
|
-
|
|
12673
|
+
var imageUrl = cropToShoulders(frame, face);
|
|
12674
|
+
setImageUrl(imageUrl);
|
|
12675
|
+
dataUrlToBase64(imageUrl).then(function (img) {
|
|
12675
12676
|
setSelfieImage(img);
|
|
12676
12677
|
});
|
|
12677
12678
|
}, [face, frame, setSelfieImage]);
|
|
@@ -12719,21 +12720,23 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
|
|
|
12719
12720
|
}, [isReady, onCustomerMatched, onCustomerNotMatched, selfieImage, state.requestState, submit]);
|
|
12720
12721
|
React.useEffect(function () {
|
|
12721
12722
|
if (!submissionResponse) return;
|
|
12722
|
-
if (state.requestState === '
|
|
12723
|
+
if (state.requestState === 'VERIFIED') {
|
|
12723
12724
|
onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(submissionResponse);
|
|
12724
|
-
} else if (state.requestState === '
|
|
12725
|
+
} else if (state.requestState === 'REJECTED') {
|
|
12725
12726
|
onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
|
|
12726
12727
|
}
|
|
12727
12728
|
}, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
|
|
12728
|
-
|
|
12729
|
+
useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['VERIFIED', 'REJECTED'].includes(state.requestState), state.requestState === 'VERIFYING');
|
|
12730
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
|
|
12729
12731
|
onSelfieCaptured: onSelfieCaptured,
|
|
12730
|
-
onTimeout: onCaptureGuidanceTimeout,
|
|
12731
12732
|
onExit: onExit,
|
|
12732
12733
|
timeoutDurationMs: captureGuidanceTimeoutDurationMs,
|
|
12733
12734
|
colors: colors,
|
|
12734
12735
|
verbiage: verbiage,
|
|
12735
12736
|
debugMode: debugMode
|
|
12736
|
-
})
|
|
12737
|
+
}), imageUrl && /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreview, {
|
|
12738
|
+
imageUrl: imageUrl
|
|
12739
|
+
}));
|
|
12737
12740
|
};
|
|
12738
12741
|
|
|
12739
12742
|
var CustomerVerificationSuccess = function CustomerVerificationSuccess(_a) {
|
|
@@ -12850,41 +12853,32 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
|
|
|
12850
12853
|
var _f = React.useContext(SubmissionContext),
|
|
12851
12854
|
submissionResponse = _f.submissionResponse,
|
|
12852
12855
|
selfieImage = _f.selfieImage;
|
|
12853
|
-
var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
|
|
12854
12856
|
var _g = React.useState('LOADING'),
|
|
12855
12857
|
captureState = _g[0],
|
|
12856
12858
|
setCaptureState = _g[1];
|
|
12859
|
+
var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
|
|
12857
12860
|
var onCustomerMatchedCallback = React.useCallback(function (response) {
|
|
12858
12861
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
12859
12862
|
return tslib.__generator(this, function (_a) {
|
|
12860
12863
|
setCaptureState('MATCHED');
|
|
12861
|
-
|
|
12862
|
-
setTimeout(function () {
|
|
12863
|
-
onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
|
|
12864
|
-
}, 0);
|
|
12864
|
+
onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
|
|
12865
12865
|
return [2];
|
|
12866
12866
|
});
|
|
12867
12867
|
});
|
|
12868
|
-
}, [onCustomerMatched
|
|
12868
|
+
}, [onCustomerMatched]);
|
|
12869
12869
|
var onCustomerNotMatchedCallback = React.useCallback(function (response) {
|
|
12870
12870
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
12871
12871
|
return tslib.__generator(this, function (_a) {
|
|
12872
12872
|
setCaptureState('NOT_MATCHED');
|
|
12873
|
-
|
|
12874
|
-
setTimeout(function () {
|
|
12875
|
-
onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
|
|
12876
|
-
}, 0);
|
|
12873
|
+
onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
|
|
12877
12874
|
return [2];
|
|
12878
12875
|
});
|
|
12879
12876
|
});
|
|
12880
|
-
}, [onCustomerNotMatched
|
|
12877
|
+
}, [onCustomerNotMatched]);
|
|
12881
12878
|
var onCaptureGuidanceTimeoutCallback = React.useCallback(function () {
|
|
12882
12879
|
setCaptureState('FAILED');
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
|
|
12886
|
-
}, 0);
|
|
12887
|
-
}, [onCaptureGuidanceTimeout, releaseCameraAccess]);
|
|
12880
|
+
onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
|
|
12881
|
+
}, [onCaptureGuidanceTimeout]);
|
|
12888
12882
|
var _h = React.useState(0),
|
|
12889
12883
|
attempt = _h[0],
|
|
12890
12884
|
setAttempt = _h[1];
|
|
@@ -12898,6 +12892,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
|
|
|
12898
12892
|
switch (captureState) {
|
|
12899
12893
|
case 'CAPTURING':
|
|
12900
12894
|
return /*#__PURE__*/React__default['default'].createElement(CustomerVerificationCapture, {
|
|
12895
|
+
key: attempt,
|
|
12901
12896
|
onCustomerMatched: onCustomerMatchedCallback,
|
|
12902
12897
|
onCustomerNotMatched: onCustomerNotMatchedCallback,
|
|
12903
12898
|
onCaptureGuidanceTimeout: onCaptureGuidanceTimeoutCallback,
|
|
@@ -12914,6 +12909,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
|
|
|
12914
12909
|
doneBtnText: verbiage.successDoneBtnText,
|
|
12915
12910
|
imageUrl: "data:image/png;base64, ".concat(selfieImage),
|
|
12916
12911
|
onDoneClick: function onDoneClick() {
|
|
12912
|
+
releaseCameraAccess();
|
|
12917
12913
|
submissionResponse && (onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse));
|
|
12918
12914
|
},
|
|
12919
12915
|
onRetryClick: function onRetryClick() {
|
|
@@ -12927,7 +12923,10 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
|
|
|
12927
12923
|
exitBtnText: verbiage === null || verbiage === void 0 ? void 0 : verbiage.failureExitBtnText,
|
|
12928
12924
|
imageUrl: assets.failureImageUrl,
|
|
12929
12925
|
canRetry: false,
|
|
12930
|
-
onExitClick:
|
|
12926
|
+
onExitClick: function onExitClick() {
|
|
12927
|
+
releaseCameraAccess();
|
|
12928
|
+
onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure();
|
|
12929
|
+
}
|
|
12931
12930
|
});
|
|
12932
12931
|
default:
|
|
12933
12932
|
return null;
|
|
@@ -12989,9 +12988,9 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
12989
12988
|
onBeforeSubmit: onBeforeSubmit,
|
|
12990
12989
|
geolocationEnabled: geolocationEnabled,
|
|
12991
12990
|
geolocationRequired: geolocationRequired
|
|
12992
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
12991
|
+
}, /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
|
|
12993
12992
|
preferFrontFacingCamera: true
|
|
12994
|
-
}, /*#__PURE__*/React__default['default'].createElement(CustomerVerificationWizard, {
|
|
12993
|
+
}, /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, null, /*#__PURE__*/React__default['default'].createElement(CustomerVerificationWizard, {
|
|
12995
12994
|
onComplete: onComplete,
|
|
12996
12995
|
onCustomerMatched: onCustomerMatched,
|
|
12997
12996
|
onCustomerNotMatched: onCustomerNotMatched,
|
|
@@ -13008,7 +13007,7 @@ var initialState = {
|
|
|
13008
13007
|
frame: null,
|
|
13009
13008
|
face: null,
|
|
13010
13009
|
imageUrl: null,
|
|
13011
|
-
requestState: '
|
|
13010
|
+
requestState: 'CAPTURING',
|
|
13012
13011
|
requestError: null,
|
|
13013
13012
|
notFoundTimes: 0
|
|
13014
13013
|
};
|
|
@@ -13016,10 +13015,10 @@ var reducer = function reducer(state, action) {
|
|
|
13016
13015
|
switch (action.type) {
|
|
13017
13016
|
case 'identificationReady':
|
|
13018
13017
|
{
|
|
13019
|
-
var allowedStates = ['
|
|
13018
|
+
var allowedStates = ['CAPTURING', 'ERROR'];
|
|
13020
13019
|
if (allowedStates.includes(state.requestState)) {
|
|
13021
13020
|
return tslib.__assign(tslib.__assign({}, state), {
|
|
13022
|
-
requestState: '
|
|
13021
|
+
requestState: 'CAPTURED',
|
|
13023
13022
|
frame: action.payload.frame,
|
|
13024
13023
|
face: action.payload.face
|
|
13025
13024
|
});
|
|
@@ -13029,7 +13028,7 @@ var reducer = function reducer(state, action) {
|
|
|
13029
13028
|
}
|
|
13030
13029
|
case 'identifying':
|
|
13031
13030
|
return tslib.__assign(tslib.__assign({}, state), {
|
|
13032
|
-
requestState: '
|
|
13031
|
+
requestState: 'IDENTIFYING',
|
|
13033
13032
|
imageUrl: action.payload.imageUrl
|
|
13034
13033
|
});
|
|
13035
13034
|
case 'identificationCompleted':
|
|
@@ -13052,7 +13051,7 @@ var reducer = function reducer(state, action) {
|
|
|
13052
13051
|
if (customerMatched) {
|
|
13053
13052
|
requestState = 'FOUND';
|
|
13054
13053
|
} else if (notFoundTimes < 2) {
|
|
13055
|
-
requestState = '
|
|
13054
|
+
requestState = 'CAPTURING';
|
|
13056
13055
|
notFoundTimes += 1;
|
|
13057
13056
|
} else {
|
|
13058
13057
|
requestState = 'NOT_FOUND';
|
|
@@ -13091,6 +13090,9 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
|
|
|
13091
13090
|
submissionResponse = _f.submissionResponse,
|
|
13092
13091
|
selfieImage = _f.selfieImage,
|
|
13093
13092
|
setSelfieImage = _f.setSelfieImage;
|
|
13093
|
+
var _g = React.useState(null),
|
|
13094
|
+
imageUrl = _g[0],
|
|
13095
|
+
setImageUrl = _g[1];
|
|
13094
13096
|
var onSelfieCaptured = React.useCallback(function (frame, face) {
|
|
13095
13097
|
dispatch({
|
|
13096
13098
|
type: 'identificationReady',
|
|
@@ -13102,11 +13104,12 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
|
|
|
13102
13104
|
}, []);
|
|
13103
13105
|
var frame = state.frame,
|
|
13104
13106
|
face = state.face;
|
|
13105
|
-
var isReady = state.requestState === '
|
|
13107
|
+
var isReady = state.requestState === 'CAPTURED';
|
|
13106
13108
|
React.useEffect(function () {
|
|
13107
13109
|
if (!frame || !face) return;
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
+
var imageUrl = cropToShoulders(frame, face);
|
|
13111
|
+
setImageUrl(imageUrl);
|
|
13112
|
+
dataUrlToBase64(imageUrl).then(function (img) {
|
|
13110
13113
|
setSelfieImage(img);
|
|
13111
13114
|
});
|
|
13112
13115
|
}, [face, frame, setSelfieImage]);
|
|
@@ -13160,15 +13163,17 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
|
|
|
13160
13163
|
onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
|
|
13161
13164
|
}
|
|
13162
13165
|
}, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
|
|
13163
|
-
|
|
13166
|
+
useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IDENTIFYING');
|
|
13167
|
+
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
|
|
13164
13168
|
onSelfieCaptured: onSelfieCaptured,
|
|
13165
|
-
onTimeout: onCaptureGuidanceTimeout,
|
|
13166
13169
|
onExit: onExit,
|
|
13167
13170
|
timeoutDurationMs: captureGuidanceTimeoutDurationMs,
|
|
13168
13171
|
colors: colors,
|
|
13169
13172
|
verbiage: verbiage,
|
|
13170
13173
|
debugMode: debugMode
|
|
13171
|
-
})
|
|
13174
|
+
}), imageUrl && /*#__PURE__*/React__default['default'].createElement(SelfieProgressPreview, {
|
|
13175
|
+
imageUrl: imageUrl
|
|
13176
|
+
}));
|
|
13172
13177
|
};
|
|
13173
13178
|
|
|
13174
13179
|
var CustomerIdentificationSuccess = function CustomerIdentificationSuccess(_a) {
|
|
@@ -13285,41 +13290,32 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
|
|
|
13285
13290
|
var _f = React.useContext(SubmissionContext),
|
|
13286
13291
|
submissionResponse = _f.submissionResponse,
|
|
13287
13292
|
selfieImage = _f.selfieImage;
|
|
13288
|
-
var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
|
|
13289
13293
|
var _g = React.useState('LOADING'),
|
|
13290
13294
|
captureState = _g[0],
|
|
13291
13295
|
setCaptureState = _g[1];
|
|
13296
|
+
var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
|
|
13292
13297
|
var onCustomerMatchedCallback = React.useCallback(function (response) {
|
|
13293
13298
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
13294
13299
|
return tslib.__generator(this, function (_a) {
|
|
13295
13300
|
setCaptureState('FOUND');
|
|
13296
|
-
|
|
13297
|
-
setTimeout(function () {
|
|
13298
|
-
onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
|
|
13299
|
-
}, 0);
|
|
13301
|
+
onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(response);
|
|
13300
13302
|
return [2];
|
|
13301
13303
|
});
|
|
13302
13304
|
});
|
|
13303
|
-
}, [onCustomerMatched
|
|
13305
|
+
}, [onCustomerMatched]);
|
|
13304
13306
|
var onCustomerNotMatchedCallback = React.useCallback(function (response) {
|
|
13305
13307
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
13306
13308
|
return tslib.__generator(this, function (_a) {
|
|
13307
13309
|
setCaptureState('NOT_FOUND');
|
|
13308
|
-
|
|
13309
|
-
setTimeout(function () {
|
|
13310
|
-
onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
|
|
13311
|
-
}, 0);
|
|
13310
|
+
onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(response);
|
|
13312
13311
|
return [2];
|
|
13313
13312
|
});
|
|
13314
13313
|
});
|
|
13315
|
-
}, [onCustomerNotMatched
|
|
13314
|
+
}, [onCustomerNotMatched]);
|
|
13316
13315
|
var onCaptureGuidanceTimeoutCallback = React.useCallback(function () {
|
|
13317
13316
|
setCaptureState('FAILED');
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
|
|
13321
|
-
}, 0);
|
|
13322
|
-
}, [onCaptureGuidanceTimeout, releaseCameraAccess]);
|
|
13317
|
+
onCaptureGuidanceTimeout === null || onCaptureGuidanceTimeout === void 0 ? void 0 : onCaptureGuidanceTimeout();
|
|
13318
|
+
}, [onCaptureGuidanceTimeout]);
|
|
13323
13319
|
var _h = React.useState(0),
|
|
13324
13320
|
attempt = _h[0],
|
|
13325
13321
|
setAttempt = _h[1];
|
|
@@ -13333,6 +13329,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
|
|
|
13333
13329
|
switch (captureState) {
|
|
13334
13330
|
case 'CAPTURING':
|
|
13335
13331
|
return /*#__PURE__*/React__default['default'].createElement(CustomerIdentificationCapture, {
|
|
13332
|
+
key: attempt,
|
|
13336
13333
|
onCustomerMatched: onCustomerMatchedCallback,
|
|
13337
13334
|
onCustomerNotMatched: onCustomerNotMatchedCallback,
|
|
13338
13335
|
onCaptureGuidanceTimeout: onCaptureGuidanceTimeoutCallback,
|
|
@@ -13349,6 +13346,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
|
|
|
13349
13346
|
doneBtnText: verbiage.successDoneBtnText,
|
|
13350
13347
|
imageUrl: "data:image/png;base64, ".concat(selfieImage),
|
|
13351
13348
|
onDoneClick: function onDoneClick() {
|
|
13349
|
+
releaseCameraAccess();
|
|
13352
13350
|
submissionResponse && (onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse));
|
|
13353
13351
|
},
|
|
13354
13352
|
onRetryClick: function onRetryClick() {
|
|
@@ -13363,7 +13361,10 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
|
|
|
13363
13361
|
exitBtnText: verbiage === null || verbiage === void 0 ? void 0 : verbiage.failureExitBtnText,
|
|
13364
13362
|
imageUrl: assets.failureImageUrl,
|
|
13365
13363
|
canRetry: false,
|
|
13366
|
-
onExitClick:
|
|
13364
|
+
onExitClick: function onExitClick() {
|
|
13365
|
+
releaseCameraAccess();
|
|
13366
|
+
onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure();
|
|
13367
|
+
}
|
|
13367
13368
|
});
|
|
13368
13369
|
default:
|
|
13369
13370
|
return null;
|