idmission-web-sdk 1.0.49 → 1.0.50
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/README.md +1 -0
- package/dist/components/customer_flows/FaceValidation.d.ts +5 -5
- package/dist/components/customer_flows/IdAndFaceValidation.d.ts +3 -2
- package/dist/components/customer_flows/VideoIdValidation.d.ts +2 -2
- package/dist/components/face_liveness/FaceLivenessWizard.d.ts +5 -5
- package/dist/components/submission/SubmissionProvider.d.ts +3 -2
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts +2 -2
- package/dist/contexts/SubmissionContext.d.ts +1 -0
- package/dist/sdk2.cjs.development.js +68 -52
- 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 +68 -52
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +68 -52
- 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/stories/CustomerFlows/IdAndFaceValidation.stories.d.ts +6 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -293,6 +293,7 @@ Render a fullscreen capture component that performs IDValidation and FaceValidat
|
|
|
293
293
|
<table>
|
|
294
294
|
<tr><td><code>submissionToken</code></td><td>a token generated with your IDmission credentials.</td></tr>
|
|
295
295
|
<tr><td><code>submissionUrl</code></td><td>URL to hit with all API requests. Default: https://api.idmission.com</td></tr>
|
|
296
|
+
<tr><td><code>onBeforeLivenessCheck</code> (optional)</td><td>callback function that fires immediately prior to liveness check, giving the client application an opportunity to specify custom asynchronous logic that mutates the request before it executes. The liveness check request is passed in as a parameter and a promise resolving to the updated request should be returned.</td></tr>
|
|
296
297
|
<tr><td><code>onBeforeSubmit</code> (optional)</td><td>callback function that fires immediately prior to submission, giving the client application an opportunity to specify custom asynchronous logic that mutates the request before it executes. The submission request is passed in as a parameter and a promise resolving to the updated request should be returned.</td></tr>
|
|
297
298
|
<tr><td><code>onComplete</code> (optional)</td><td>callback function that fires when the user has completed both flows. Arguments: the SubmissionResponse from IDmission's API is passed as an argument to the customer's application for further handling, which indicates whether the user passed the validation check, and the request payload dispatched to IDmission's API, which contains the images submitted by the user.</td></tr>
|
|
298
299
|
<tr><td><code>onApproved</code> (optional)</td><td>callback function that fires when the user completes both flows with a valid ID and passes the realness check. Arguments: same as onComplete.</td></tr>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LivenessCheckRequest, SubmissionEnvironment, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
3
3
|
import { FaceLivenessAssets, FaceLivenessColors, FaceLivenessVerbiage } from '../face_liveness/FaceLivenessWizard';
|
|
4
4
|
import { LangOption } from '../../lib/locales';
|
|
5
5
|
export interface FaceValidationProps extends PropsWithChildren {
|
|
@@ -13,10 +13,10 @@ export interface FaceValidationProps extends PropsWithChildren {
|
|
|
13
13
|
webhooksStripSpecialCharacters?: boolean;
|
|
14
14
|
timeoutDurationMs?: number;
|
|
15
15
|
skipSuccessScreen?: boolean | (() => Promise<boolean>);
|
|
16
|
-
onBeforeSubmit?: (req:
|
|
17
|
-
onComplete?: (resp: SubmissionResponse | null, req:
|
|
18
|
-
onApproved?: (resp: SubmissionResponse, req:
|
|
19
|
-
onDenied?: (resp: SubmissionResponse | null, req:
|
|
16
|
+
onBeforeSubmit?: (req: LivenessCheckRequest) => Promise<LivenessCheckRequest>;
|
|
17
|
+
onComplete?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
18
|
+
onApproved?: (resp: SubmissionResponse, req: LivenessCheckRequest) => void;
|
|
19
|
+
onDenied?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
20
20
|
onExitAfterFailure?: () => void;
|
|
21
21
|
assets?: FaceLivenessAssets;
|
|
22
22
|
colors?: FaceLivenessColors;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { CardData, PersonalData, SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
2
|
+
import { CardData, LivenessCheckRequest, PersonalData, SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
3
3
|
import { FaceLivenessAssets, FaceLivenessColors, FaceLivenessVerbiage } from '../face_liveness/FaceLivenessWizard';
|
|
4
4
|
import { IdCaptureWizardAssets, IdCaptureWizardColors, IdCaptureWizardVerbiage } from '../id_capture/IdCaptureWizard';
|
|
5
5
|
import { AdditionalDocumentCaptureWizardVerbiage } from '../additional_document_capture/AdditionalDocumentCaptureWizard';
|
|
@@ -45,10 +45,11 @@ export interface IdAndFaceValidationProps extends PropsWithChildren {
|
|
|
45
45
|
passportFocusScoreThreshold?: number;
|
|
46
46
|
faceLivenessTimeoutDurationMs?: number;
|
|
47
47
|
skipSuccessScreen?: boolean | (() => Promise<boolean>);
|
|
48
|
+
onBeforeLivenessCheck?: (req: LivenessCheckRequest) => Promise<LivenessCheckRequest>;
|
|
48
49
|
onBeforeSubmit?: (req: SubmissionRequest) => Promise<SubmissionRequest>;
|
|
49
50
|
onComplete?: (resp: SubmissionResponse, req: SubmissionRequest) => void;
|
|
50
51
|
onApproved?: (resp: SubmissionResponse, req: SubmissionRequest) => void;
|
|
51
|
-
onDenied?: (resp: SubmissionResponse | null, req: SubmissionRequest | null) => void;
|
|
52
|
+
onDenied?: (resp: SubmissionResponse | null, req: SubmissionRequest | LivenessCheckRequest | null) => void;
|
|
52
53
|
onExitAfterFailure?: () => void;
|
|
53
54
|
captureSignature?: boolean | (() => Promise<boolean>);
|
|
54
55
|
captureSignatureVideo?: boolean | (() => Promise<boolean>);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { CardData, PersonalData, SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
2
|
+
import { CardData, LivenessCheckRequest, PersonalData, SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
3
3
|
import { CustomerSuppliedVerbiage, LangOption } from '../../lib/locales';
|
|
4
4
|
import { VideoIdWizardAssets, VideoIdWizardColors, VideoIdWizardVerbiage } from '../video_id/IdVideoCaptureWizard';
|
|
5
5
|
import { IdCaptureWizardProps } from '../id_capture/IdCaptureWizard';
|
|
@@ -23,7 +23,7 @@ export interface VideoIdValidationProps extends PropsWithChildren {
|
|
|
23
23
|
webhooksStripSpecialCharacters?: boolean;
|
|
24
24
|
onBeforeSubmit?: (req: SubmissionRequest) => Promise<SubmissionRequest>;
|
|
25
25
|
onComplete?: (resp: SubmissionResponse, req: SubmissionRequest) => void;
|
|
26
|
-
onExitAfterFailure?: (resp: SubmissionResponse | null, req:
|
|
26
|
+
onExitAfterFailure?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
27
27
|
idCaptureProps?: IdCaptureWizardProps;
|
|
28
28
|
faceLivenessProps?: FaceLivenessWizardProps;
|
|
29
29
|
idCardFrontDetectionThreshold?: number;
|
|
@@ -3,7 +3,7 @@ import { FaceLivenessCaptureColors, FaceLivenessCaptureVerbiage } from './FaceLi
|
|
|
3
3
|
import { SelfieCaptureLoadingOverlayAssets, SelfieCaptureLoadingOverlayColors, SelfieCaptureLoadingOverlayVerbiage } from '../selfie_capture/SelfieCaptureLoadingOverlay';
|
|
4
4
|
import { FaceLivenessSuccessColors, FaceLivenessSuccessVerbiage } from './FaceLivenessSuccess';
|
|
5
5
|
import { FaceLivenessFailureAssets, FaceLivenessFailureColors, FaceLivenessFailureVerbiage } from './FaceLivenessFailure';
|
|
6
|
-
import {
|
|
6
|
+
import { LivenessCheckRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
7
7
|
export type FaceLivenessAssets = {
|
|
8
8
|
loadingOverlay?: SelfieCaptureLoadingOverlayAssets;
|
|
9
9
|
failure?: FaceLivenessFailureAssets;
|
|
@@ -19,10 +19,10 @@ export type FaceLivenessVerbiage = FaceLivenessCaptureVerbiage & {
|
|
|
19
19
|
failure?: FaceLivenessFailureVerbiage;
|
|
20
20
|
};
|
|
21
21
|
export type FaceLivenessWizardProps = {
|
|
22
|
-
onSuccess?: (resp: SubmissionResponse, req:
|
|
23
|
-
onComplete?: (resp: SubmissionResponse | null, req:
|
|
24
|
-
onTimeout?: (resp: SubmissionResponse | null, req:
|
|
25
|
-
onExitAfterFailure?: (resp: SubmissionResponse | null, req:
|
|
22
|
+
onSuccess?: (resp: SubmissionResponse, req: LivenessCheckRequest) => void;
|
|
23
|
+
onComplete?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
24
|
+
onTimeout?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
25
|
+
onExitAfterFailure?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
26
26
|
timeoutDurationMs?: number;
|
|
27
27
|
maxRetries?: number;
|
|
28
28
|
skipSuccessScreen?: boolean | (() => Promise<boolean>);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { CardData, PersonalData, SubmissionAction, SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
2
|
+
import { CardData, LivenessCheckRequest, PersonalData, SubmissionAction, SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
3
3
|
export type SubmissionProviderProps = {
|
|
4
4
|
action: SubmissionAction;
|
|
5
5
|
children: ReactElement;
|
|
@@ -21,7 +21,8 @@ export type SubmissionProviderProps = {
|
|
|
21
21
|
webhooksClientTraceId?: string;
|
|
22
22
|
webhooksStripSpecialCharacters?: boolean;
|
|
23
23
|
onBeforeSubmit?: (req: SubmissionRequest) => Promise<SubmissionRequest>;
|
|
24
|
+
onBeforeLivenessCheck?: (req: LivenessCheckRequest) => Promise<LivenessCheckRequest>;
|
|
24
25
|
onResponseReceived?: (res: SubmissionResponse, req: SubmissionRequest) => void;
|
|
25
26
|
onRequestFailure?: (err: Error) => void;
|
|
26
27
|
};
|
|
27
|
-
export declare const SubmissionProvider: ({ action, children, url, environment, token, companyId, enrollmentId, personalData, cardData, manualReviewRequired, idBackImageRequired, verifyIdWithExternalDatabases, deduplicationEnabled, deduplicationSynchronous, geolocationEnabled, geolocationRequired, webhooksEnabled, webhooksClientTraceId, webhooksStripSpecialCharacters, onBeforeSubmit, onResponseReceived, onRequestFailure, }: SubmissionProviderProps) => ReactElement;
|
|
28
|
+
export declare const SubmissionProvider: ({ action, children, url, environment, token, companyId, enrollmentId, personalData, cardData, manualReviewRequired, idBackImageRequired, verifyIdWithExternalDatabases, deduplicationEnabled, deduplicationSynchronous, geolocationEnabled, geolocationRequired, webhooksEnabled, webhooksClientTraceId, webhooksStripSpecialCharacters, onBeforeSubmit, onBeforeLivenessCheck, onResponseReceived, onRequestFailure, }: SubmissionProviderProps) => ReactElement;
|
|
@@ -4,7 +4,7 @@ import { FaceLivenessAssets, FaceLivenessColors, FaceLivenessVerbiage, FaceLiven
|
|
|
4
4
|
import { IdVideoCaptureAssets, IdVideoCaptureColors, IdVideoCaptureVerbiage } from './IdVideoCapture';
|
|
5
5
|
import { IdVideoCaptureSuccessColors, IdVideoCaptureSuccessVerbiage } from './IdVideoCaptureSuccess';
|
|
6
6
|
import { CustomerSuppliedVerbiage } from '../../lib/locales';
|
|
7
|
-
import {
|
|
7
|
+
import { LivenessCheckRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
8
8
|
export type VideoIdWizardAssets = {
|
|
9
9
|
idCapture?: IdCaptureWizardAssets;
|
|
10
10
|
faceLiveness?: FaceLivenessAssets;
|
|
@@ -25,7 +25,7 @@ export type VideoIdWizardVerbiage = {
|
|
|
25
25
|
export type VideoIdWizardProps = {
|
|
26
26
|
idCaptureProps?: IdCaptureWizardProps;
|
|
27
27
|
faceLivenessProps?: FaceLivenessWizardProps;
|
|
28
|
-
onExitAfterFailure?: (resp: SubmissionResponse | null, req:
|
|
28
|
+
onExitAfterFailure?: (resp: SubmissionResponse | null, req: LivenessCheckRequest | null) => void;
|
|
29
29
|
idCardFrontDetectionThreshold?: number;
|
|
30
30
|
idCardFrontFocusThreshold?: number;
|
|
31
31
|
goodIdCardFrontFramesThreshold?: number;
|
|
@@ -176,6 +176,7 @@ export type SubmissionState = {
|
|
|
176
176
|
logIdFrontCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
|
|
177
177
|
logIdBackCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
|
|
178
178
|
logSelfieCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
|
|
179
|
+
livenessCheckRequest: LivenessCheckRequest | null;
|
|
179
180
|
checkLiveness: (imageDataUrl: string) => Promise<LiveCheckResponse>;
|
|
180
181
|
retryLocationAccess: () => void;
|
|
181
182
|
};
|
|
@@ -48,7 +48,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
48
48
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
49
49
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
50
50
|
|
|
51
|
-
var webSdkVersion = '1.0.
|
|
51
|
+
var webSdkVersion = '1.0.50';
|
|
52
52
|
|
|
53
53
|
function getPlatform() {
|
|
54
54
|
return window.platform;
|
|
@@ -142,6 +142,7 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
|
|
|
142
142
|
logSelfieCaptureAttempt: function logSelfieCaptureAttempt() {
|
|
143
143
|
return null;
|
|
144
144
|
},
|
|
145
|
+
livenessCheckRequest: null,
|
|
145
146
|
checkLiveness: function checkLiveness() {
|
|
146
147
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
147
148
|
return tslib.__generator(this, function (_a) {
|
|
@@ -512,6 +513,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
512
513
|
_l = _a.webhooksStripSpecialCharacters,
|
|
513
514
|
webhooksStripSpecialCharacters = _l === void 0 ? true : _l,
|
|
514
515
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
516
|
+
onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
|
|
515
517
|
onResponseReceived = _a.onResponseReceived,
|
|
516
518
|
onRequestFailure = _a.onRequestFailure;
|
|
517
519
|
var _m = React.useState(SubmissionStatus.READY),
|
|
@@ -530,47 +532,50 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
530
532
|
retrySubmission = _r[0],
|
|
531
533
|
setRetrySubmission = _r[1];
|
|
532
534
|
var _s = React.useState(null),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
+
livenessCheckRequest = _s[0],
|
|
536
|
+
setLivenessCheckRequest = _s[1];
|
|
535
537
|
var _t = React.useState(null),
|
|
536
|
-
|
|
537
|
-
|
|
538
|
+
idFrontImage = _t[0],
|
|
539
|
+
setIdFrontImage = _t[1];
|
|
538
540
|
var _u = React.useState(null),
|
|
539
|
-
|
|
540
|
-
|
|
541
|
+
idBackImage = _u[0],
|
|
542
|
+
setIdBackImage = _u[1];
|
|
541
543
|
var _v = React.useState(null),
|
|
542
|
-
|
|
543
|
-
|
|
544
|
+
passportImage = _v[0],
|
|
545
|
+
setPassportImage = _v[1];
|
|
544
546
|
var _w = React.useState(null),
|
|
545
|
-
|
|
546
|
-
|
|
547
|
+
selfieImage = _w[0],
|
|
548
|
+
setSelfieImage = _w[1];
|
|
547
549
|
var _x = React.useState(null),
|
|
548
|
-
|
|
549
|
-
|
|
550
|
+
signatureData = _x[0],
|
|
551
|
+
setSignatureData = _x[1];
|
|
550
552
|
var _y = React.useState(null),
|
|
551
|
-
|
|
552
|
-
|
|
553
|
+
signatureVideoUrl = _y[0],
|
|
554
|
+
setSignatureVideoUrl = _y[1];
|
|
553
555
|
var _z = React.useState(null),
|
|
554
|
-
|
|
555
|
-
|
|
556
|
+
idCaptureVideoUrl = _z[0],
|
|
557
|
+
setIdCaptureVideoUrl = _z[1];
|
|
556
558
|
var _0 = React.useState(null),
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
var _1 = React.useState(
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
var _2 = React.useState(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
var _3 = React.useState(
|
|
566
|
-
|
|
567
|
-
|
|
559
|
+
additionalDocuments = _0[0],
|
|
560
|
+
setAdditionalDocuments = _0[1];
|
|
561
|
+
var _1 = React.useState(null),
|
|
562
|
+
geolocationResult = _1[0],
|
|
563
|
+
setGeolocationResult = _1[1];
|
|
564
|
+
var _2 = React.useState(0),
|
|
565
|
+
geolocationAttempts = _2[0],
|
|
566
|
+
setGeolocationAttempts = _2[1];
|
|
567
|
+
var _3 = React.useState(false),
|
|
568
|
+
geolocationBlocked = _3[0],
|
|
569
|
+
setGeolocationBlocked = _3[1];
|
|
568
570
|
var _4 = React.useState([]),
|
|
569
|
-
|
|
570
|
-
|
|
571
|
+
idFrontCaptureAttempts = _4[0],
|
|
572
|
+
setIdFrontCaptureAttempts = _4[1];
|
|
571
573
|
var _5 = React.useState([]),
|
|
572
|
-
|
|
573
|
-
|
|
574
|
+
idBackCaptureAttempts = _5[0],
|
|
575
|
+
setIdBackCaptureAttempts = _5[1];
|
|
576
|
+
var _6 = React.useState([]),
|
|
577
|
+
selfieCaptureAttempts = _6[0],
|
|
578
|
+
setSelfieCaptureAttempts = _6[1];
|
|
574
579
|
var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
|
|
575
580
|
setIdFrontCaptureAttempts(function (attempts) {
|
|
576
581
|
return tslib.__spreadArray(tslib.__spreadArray([], attempts, true), [attempt], false);
|
|
@@ -767,12 +772,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
767
772
|
}, [action, manualReviewRequired, deduplicationEnabled, webhooksEnabled, deduplicationSynchronous, verifyIdWithExternalDatabases, idBackImageRequired, webhooksStripSpecialCharacters, idFrontImage, idBackImage, passportImage, selfieImage, companyId, personalData, cardData, enrollmentId, webhooksClientTraceId, signatureData, additionalDocuments, idCaptureVideoUrl, signatureVideoUrl, selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, onBeforeSubmit, url, environment, token, onResponseReceived, onRequestFailure]);
|
|
768
773
|
var checkLiveness = React.useCallback(function (imageDataUrl) {
|
|
769
774
|
return tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
770
|
-
var request, host, endpoint, response, statusMessage, submissionResponse_3, e_2, err;
|
|
775
|
+
var request, onBeforeLivenessCheckResult, host, endpoint, response, statusMessage, submissionResponse_3, e_2, err;
|
|
771
776
|
var _a, _b, _c;
|
|
772
777
|
return tslib.__generator(this, function (_d) {
|
|
773
778
|
switch (_d.label) {
|
|
774
779
|
case 0:
|
|
775
|
-
_d.trys.push([0,
|
|
780
|
+
_d.trys.push([0, 8,, 9]);
|
|
776
781
|
_a = {
|
|
777
782
|
securityData: {
|
|
778
783
|
userName: '',
|
|
@@ -796,6 +801,14 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
796
801
|
idBackCaptureAttempts: idBackCaptureAttempts,
|
|
797
802
|
geolocationResult: geolocationResult
|
|
798
803
|
});
|
|
804
|
+
setLivenessCheckRequest(request);
|
|
805
|
+
if (!onBeforeLivenessCheck) return [3, 3];
|
|
806
|
+
return [4, onBeforeLivenessCheck(request)];
|
|
807
|
+
case 2:
|
|
808
|
+
onBeforeLivenessCheckResult = _d.sent();
|
|
809
|
+
if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
|
|
810
|
+
_d.label = 3;
|
|
811
|
+
case 3:
|
|
799
812
|
host = url || determineSubmissionHost(environment, token);
|
|
800
813
|
endpoint = liveCheckEndpoint(!!token);
|
|
801
814
|
return [4, fetch(host + endpoint, {
|
|
@@ -805,27 +818,27 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
805
818
|
})["catch"](function (e) {
|
|
806
819
|
throw new NetworkError(e.message);
|
|
807
820
|
})];
|
|
808
|
-
case
|
|
821
|
+
case 4:
|
|
809
822
|
response = _d.sent();
|
|
810
|
-
if (!!response.ok) return [3,
|
|
823
|
+
if (!!response.ok) return [3, 6];
|
|
811
824
|
return [4, response.text()];
|
|
812
|
-
case
|
|
825
|
+
case 5:
|
|
813
826
|
statusMessage = _d.sent();
|
|
814
827
|
if (!statusMessage || statusMessage === 'Load failed') throw new NetworkError(statusMessage);
|
|
815
828
|
throw new SubmissionError({
|
|
816
829
|
statusCode: response.statusText,
|
|
817
830
|
statusMessage: statusMessage
|
|
818
831
|
});
|
|
819
|
-
case
|
|
832
|
+
case 6:
|
|
820
833
|
return [4, response.json()];
|
|
821
|
-
case
|
|
834
|
+
case 7:
|
|
822
835
|
submissionResponse_3 = _d.sent();
|
|
823
836
|
if (submissionResponse_3.status.statusCode !== '000') {
|
|
824
837
|
throw new SubmissionError(submissionResponse_3.status);
|
|
825
838
|
}
|
|
826
839
|
setSubmissionResponse(submissionResponse_3);
|
|
827
840
|
return [2, submissionResponse_3];
|
|
828
|
-
case
|
|
841
|
+
case 8:
|
|
829
842
|
e_2 = _d.sent();
|
|
830
843
|
err = e_2;
|
|
831
844
|
setSubmissionStatus(SubmissionStatus.FAILED);
|
|
@@ -840,12 +853,12 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
840
853
|
});
|
|
841
854
|
onRequestFailure === null || onRequestFailure === void 0 ? void 0 : onRequestFailure(err);
|
|
842
855
|
throw err;
|
|
843
|
-
case
|
|
856
|
+
case 9:
|
|
844
857
|
return [2];
|
|
845
858
|
}
|
|
846
859
|
});
|
|
847
860
|
});
|
|
848
|
-
}, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onRequestFailure, selfieCaptureAttempts, token, url, webhooksStripSpecialCharacters]);
|
|
861
|
+
}, [environment, geolocationResult, idBackCaptureAttempts, idFrontCaptureAttempts, onBeforeLivenessCheck, onRequestFailure, selfieCaptureAttempts, token, url, webhooksStripSpecialCharacters]);
|
|
849
862
|
var retryLocationAccess = React.useCallback(function () {
|
|
850
863
|
setGeolocationAttempts(function (n) {
|
|
851
864
|
return n + 1;
|
|
@@ -897,6 +910,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
897
910
|
logIdFrontCaptureAttempt: logIdFrontCaptureAttempt,
|
|
898
911
|
logIdBackCaptureAttempt: logIdBackCaptureAttempt,
|
|
899
912
|
logSelfieCaptureAttempt: logSelfieCaptureAttempt,
|
|
913
|
+
livenessCheckRequest: livenessCheckRequest,
|
|
900
914
|
checkLiveness: checkLiveness,
|
|
901
915
|
retryLocationAccess: retryLocationAccess
|
|
902
916
|
};
|
|
@@ -11667,7 +11681,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
11667
11681
|
debugMode = _j === void 0 ? false : _j;
|
|
11668
11682
|
var _k = React.useContext(SubmissionContext),
|
|
11669
11683
|
submissionResponse = _k.submissionResponse,
|
|
11670
|
-
|
|
11684
|
+
livenessCheckRequest = _k.livenessCheckRequest,
|
|
11671
11685
|
setSelfieImage = _k.setSelfieImage,
|
|
11672
11686
|
logSelfieCaptureAttempt = _k.logSelfieCaptureAttempt;
|
|
11673
11687
|
var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
|
|
@@ -11709,23 +11723,23 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
11709
11723
|
return tslib.__generator(this, function (_b) {
|
|
11710
11724
|
switch (_b.label) {
|
|
11711
11725
|
case 0:
|
|
11712
|
-
if (!
|
|
11726
|
+
if (!livenessCheckRequest || !submissionResponse) return [2];
|
|
11713
11727
|
setCaptureState('SUCCESS');
|
|
11714
11728
|
setFaceCropImageUrl(faceCropImageUrl);
|
|
11715
11729
|
_a = setSelfieImage;
|
|
11716
11730
|
return [4, dataUrlToBase64(faceCropImageUrl)];
|
|
11717
11731
|
case 1:
|
|
11718
11732
|
_a.apply(void 0, [_b.sent()]);
|
|
11719
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(submissionResponse,
|
|
11733
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(submissionResponse, livenessCheckRequest);
|
|
11720
11734
|
return [2];
|
|
11721
11735
|
}
|
|
11722
11736
|
});
|
|
11723
11737
|
});
|
|
11724
|
-
}, [onSuccess, setSelfieImage,
|
|
11738
|
+
}, [onSuccess, setSelfieImage, livenessCheckRequest, submissionResponse]);
|
|
11725
11739
|
var onTimeoutCallback = React.useCallback(function () {
|
|
11726
11740
|
setCaptureState('FAILED');
|
|
11727
|
-
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(submissionResponse,
|
|
11728
|
-
}, [onTimeout,
|
|
11741
|
+
onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(submissionResponse, livenessCheckRequest);
|
|
11742
|
+
}, [onTimeout, livenessCheckRequest, submissionResponse]);
|
|
11729
11743
|
var _p = React.useState(0),
|
|
11730
11744
|
attempt = _p[0],
|
|
11731
11745
|
setAttempt = _p[1];
|
|
@@ -11739,9 +11753,9 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
11739
11753
|
logCaptureMetadata();
|
|
11740
11754
|
releaseCameraAccessOnExit && releaseCameraAccess();
|
|
11741
11755
|
setTimeout(function () {
|
|
11742
|
-
onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse,
|
|
11756
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
|
|
11743
11757
|
}, 0);
|
|
11744
|
-
}, [logCaptureMetadata, onComplete, releaseCameraAccess, releaseCameraAccessOnExit,
|
|
11758
|
+
}, [logCaptureMetadata, onComplete, releaseCameraAccess, releaseCameraAccessOnExit, livenessCheckRequest, submissionResponse]);
|
|
11745
11759
|
var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onDoneCallback);
|
|
11746
11760
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, captureState !== 'LOADING' && function () {
|
|
11747
11761
|
switch (captureState) {
|
|
@@ -11787,7 +11801,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
11787
11801
|
onExitClick: function onExitClick() {
|
|
11788
11802
|
releaseCameraAccessOnExit && releaseCameraAccess();
|
|
11789
11803
|
setTimeout(function () {
|
|
11790
|
-
onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse,
|
|
11804
|
+
onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
|
|
11791
11805
|
}, 0);
|
|
11792
11806
|
}
|
|
11793
11807
|
});
|
|
@@ -12844,7 +12858,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
12844
12858
|
webhooksEnabled: webhooksEnabled,
|
|
12845
12859
|
webhooksClientTraceId: webhooksClientTraceId,
|
|
12846
12860
|
webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
|
|
12847
|
-
|
|
12861
|
+
onBeforeLivenessCheck: onBeforeSubmit,
|
|
12848
12862
|
geolocationEnabled: geolocationEnabled,
|
|
12849
12863
|
geolocationRequired: geolocationRequired
|
|
12850
12864
|
}, /*#__PURE__*/React__default['default'].createElement(CompositeWizardComponent, {
|
|
@@ -12888,6 +12902,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12888
12902
|
faceLivenessTimeoutDurationMs = _k === void 0 ? 15000 : _k,
|
|
12889
12903
|
_l = _a.skipSuccessScreen,
|
|
12890
12904
|
skipSuccessScreen = _l === void 0 ? false : _l,
|
|
12905
|
+
onBeforeLivenessCheck = _a.onBeforeLivenessCheck,
|
|
12891
12906
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
12892
12907
|
onComplete = _a.onComplete,
|
|
12893
12908
|
onApproved = _a.onApproved,
|
|
@@ -12981,6 +12996,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
12981
12996
|
webhooksClientTraceId: webhooksClientTraceId,
|
|
12982
12997
|
webhooksStripSpecialCharacters: webhooksStripSpecialCharacters,
|
|
12983
12998
|
onBeforeSubmit: onBeforeSubmit,
|
|
12999
|
+
onBeforeLivenessCheck: onBeforeLivenessCheck,
|
|
12984
13000
|
onResponseReceived: onResponseReceived,
|
|
12985
13001
|
geolocationEnabled: geolocationEnabled,
|
|
12986
13002
|
geolocationRequired: geolocationRequired
|