idmission-web-sdk 0.0.42 → 0.0.43
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/customer_flows/SignatureKYC.d.ts +4 -1
- package/dist/components/signature_capture/VideoSignatureCapture.d.ts +10 -2
- package/dist/components/signature_kyc/SignatureKYCWizard.d.ts +18 -1
- package/dist/sdk2.cjs.development.js +73 -50
- 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 +73 -50
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +73 -50
- 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/SignatureKYC.stories.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { LangOption } from '../../lib/locales';
|
|
3
3
|
import { SubmissionEnvironment, SubmissionRequest, SubmissionResponse } from '../../contexts/SubmissionContext';
|
|
4
|
+
import { SignatureKYCColors, SignatureKYCVerbiage } from '../signature_kyc/SignatureKYCWizard';
|
|
4
5
|
export type SignatureKYCProps = {
|
|
5
6
|
lang?: LangOption;
|
|
6
7
|
submissionToken: string;
|
|
@@ -8,8 +9,10 @@ export type SignatureKYCProps = {
|
|
|
8
9
|
submissionUrl?: string;
|
|
9
10
|
onBeforeSubmit?: (request: SubmissionRequest) => Promise<SubmissionRequest>;
|
|
10
11
|
onComplete?: (submissionResponse: SubmissionResponse) => void;
|
|
12
|
+
colors?: SignatureKYCColors;
|
|
13
|
+
verbiage?: SignatureKYCVerbiage;
|
|
11
14
|
geolocationEnabled?: boolean;
|
|
12
15
|
geolocationRequired?: boolean;
|
|
13
16
|
debugMode?: boolean;
|
|
14
17
|
};
|
|
15
|
-
export declare const SignatureKYC: ({ submissionToken, submissionEnvironment, submissionUrl, onBeforeSubmit, onComplete, geolocationEnabled, geolocationRequired, debugMode, }: SignatureKYCProps) => ReactElement;
|
|
18
|
+
export declare const SignatureKYC: ({ submissionToken, submissionEnvironment, submissionUrl, onBeforeSubmit, onComplete, colors, verbiage, geolocationEnabled, geolocationRequired, debugMode, }: SignatureKYCProps) => ReactElement;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SignatureData } from './data';
|
|
3
3
|
import { SignatureCaptureVerbiage } from './SignatureCapture';
|
|
4
|
+
export type VideoSignatureCaptureColors = {
|
|
5
|
+
guidanceMessageBackgroundColor?: string;
|
|
6
|
+
guidanceMessageTextColor?: string;
|
|
7
|
+
};
|
|
8
|
+
export type VideoSignatureCaptureVerbiage = SignatureCaptureVerbiage & {
|
|
9
|
+
guidanceMessageText?: string;
|
|
10
|
+
};
|
|
4
11
|
export type VideoSignatureCaptureProps = {
|
|
5
12
|
onComplete?: (signatureData: SignatureData, imageData: string, videoData: Blob) => void;
|
|
6
13
|
onFaceNotDetected?: () => void;
|
|
7
14
|
onExit?: () => void;
|
|
8
|
-
|
|
15
|
+
colors?: VideoSignatureCaptureColors;
|
|
16
|
+
verbiage?: VideoSignatureCaptureVerbiage;
|
|
9
17
|
debugMode?: boolean;
|
|
10
18
|
};
|
|
11
|
-
export declare const VideoSignatureCapture: ({ onComplete, onFaceNotDetected, onExit, verbiage, debugMode, }: VideoSignatureCaptureProps) => React.ReactElement;
|
|
19
|
+
export declare const VideoSignatureCapture: ({ onComplete, onFaceNotDetected, onExit, colors, verbiage, debugMode, }: VideoSignatureCaptureProps) => React.ReactElement;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { VideoSignatureCaptureColors, VideoSignatureCaptureVerbiage } from '../signature_capture/VideoSignatureCapture';
|
|
3
|
+
import { FaceLivenessColors, FaceLivenessVerbiage } from '../face_liveness/FaceLivenessWizard';
|
|
4
|
+
export type SignatureKYCColors = {
|
|
5
|
+
faceLiveness?: FaceLivenessColors;
|
|
6
|
+
videoSignatureCapture?: VideoSignatureCaptureColors;
|
|
7
|
+
};
|
|
8
|
+
export type SignatureKYCVerbiage = {
|
|
9
|
+
faceLiveness?: FaceLivenessVerbiage;
|
|
10
|
+
videoSignatureCapture?: VideoSignatureCaptureVerbiage;
|
|
11
|
+
success?: {
|
|
12
|
+
headingText?: string;
|
|
13
|
+
retryBtnText?: string;
|
|
14
|
+
doneBtnText?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
2
17
|
export type SignatureKYCWizardProps = {
|
|
3
18
|
onComplete?: () => void;
|
|
4
19
|
onRetryClicked?: () => void;
|
|
20
|
+
colors?: SignatureKYCColors;
|
|
21
|
+
verbiage?: SignatureKYCVerbiage;
|
|
5
22
|
debugMode?: boolean;
|
|
6
23
|
};
|
|
7
|
-
export declare const SignatureKYCWizard: ({ onComplete, onRetryClicked, debugMode, }: SignatureKYCWizardProps) => ReactElement;
|
|
24
|
+
export declare const SignatureKYCWizard: ({ onComplete, onRetryClicked, colors, verbiage, debugMode, }: SignatureKYCWizardProps) => ReactElement;
|
|
@@ -11430,39 +11430,44 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11430
11430
|
var onComplete = _a.onComplete,
|
|
11431
11431
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
11432
11432
|
onExit = _a.onExit,
|
|
11433
|
-
_d = _a.
|
|
11434
|
-
|
|
11435
|
-
_e = _a.
|
|
11436
|
-
|
|
11433
|
+
_d = _a.colors,
|
|
11434
|
+
colors = _d === void 0 ? {} : _d,
|
|
11435
|
+
_e = _a.verbiage,
|
|
11436
|
+
verbiage = _e === void 0 ? {} : _e,
|
|
11437
|
+
_f = _a.debugMode,
|
|
11438
|
+
debugMode = _f === void 0 ? false : _f;
|
|
11437
11439
|
var t = reactI18next.useTranslation().t;
|
|
11438
|
-
var
|
|
11439
|
-
cameraRef =
|
|
11440
|
-
videoRef =
|
|
11441
|
-
var
|
|
11442
|
-
ref =
|
|
11443
|
-
width =
|
|
11444
|
-
height =
|
|
11440
|
+
var _g = React.useContext(CameraStateContext),
|
|
11441
|
+
cameraRef = _g.cameraRef,
|
|
11442
|
+
videoRef = _g.videoRef;
|
|
11443
|
+
var _h = useResizeObserver__default['default'](),
|
|
11444
|
+
ref = _h.ref,
|
|
11445
|
+
width = _h.width,
|
|
11446
|
+
height = _h.height;
|
|
11445
11447
|
var signaturePad = React.useRef(null);
|
|
11446
11448
|
var signatureRecorder = React.useRef(null);
|
|
11447
11449
|
var recordedChunks = React.useRef([]);
|
|
11448
|
-
var
|
|
11449
|
-
signatureVideoUrl =
|
|
11450
|
-
setSignatureVideoUrl =
|
|
11450
|
+
var _j = React.useState(null),
|
|
11451
|
+
signatureVideoUrl = _j[0],
|
|
11452
|
+
setSignatureVideoUrl = _j[1];
|
|
11451
11453
|
var onPredictionMade = React.useContext(HighPerformanceSelfieGuidanceModelsContext).onPredictionMade;
|
|
11452
|
-
var
|
|
11453
|
-
isRecording =
|
|
11454
|
-
startRecording =
|
|
11455
|
-
stopRecording =
|
|
11456
|
-
videoUrl =
|
|
11457
|
-
var _k = React.useState(null),
|
|
11458
|
-
signatureData = _k[0],
|
|
11459
|
-
setSignatureData = _k[1];
|
|
11454
|
+
var _k = useVideoRecorder(cameraRef.current),
|
|
11455
|
+
isRecording = _k.isRecording,
|
|
11456
|
+
startRecording = _k.startRecording,
|
|
11457
|
+
stopRecording = _k.stopRecording,
|
|
11458
|
+
videoUrl = _k.videoUrl;
|
|
11460
11459
|
var _l = React.useState(null),
|
|
11461
|
-
|
|
11462
|
-
|
|
11460
|
+
signatureData = _l[0],
|
|
11461
|
+
setSignatureData = _l[1];
|
|
11463
11462
|
var _m = React.useState(null),
|
|
11464
|
-
|
|
11465
|
-
|
|
11463
|
+
signatureDataUrl = _m[0],
|
|
11464
|
+
setSignatureDataUrl = _m[1];
|
|
11465
|
+
var _o = React.useState(null),
|
|
11466
|
+
signatureVideoData = _o[0],
|
|
11467
|
+
setSignatureVideoData = _o[1];
|
|
11468
|
+
colors.guidanceMessageBackgroundColor || (colors.guidanceMessageBackgroundColor = '#ccc');
|
|
11469
|
+
colors.guidanceMessageTextColor || (colors.guidanceMessageTextColor = 'black');
|
|
11470
|
+
verbiage.guidanceMessageText || (verbiage.guidanceMessageText = t('Please sign the box below'));
|
|
11466
11471
|
verbiage.acceptBtnText || (verbiage.acceptBtnText = t('Accept'));
|
|
11467
11472
|
verbiage.clearBtnText || (verbiage.clearBtnText = t('Clear'));
|
|
11468
11473
|
var outputCanvas = React.useRef(null);
|
|
@@ -11534,9 +11539,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11534
11539
|
cancelAnimationFrame(animationFrame.current);
|
|
11535
11540
|
};
|
|
11536
11541
|
}, [cameraRef, isRecording, onFaceNotDetected, videoRef]);
|
|
11537
|
-
var
|
|
11538
|
-
numFramesWithoutFaces =
|
|
11539
|
-
setNumFramesWithoutFaces =
|
|
11542
|
+
var _p = React.useState(0),
|
|
11543
|
+
numFramesWithoutFaces = _p[0],
|
|
11544
|
+
setNumFramesWithoutFaces = _p[1];
|
|
11540
11545
|
React.useEffect(function () {
|
|
11541
11546
|
onPredictionMade(function (faces) {
|
|
11542
11547
|
setNumFramesWithoutFaces(function (n) {
|
|
@@ -11566,12 +11571,14 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11566
11571
|
value: JSON.stringify(signatureData, null, 2)
|
|
11567
11572
|
}));
|
|
11568
11573
|
}
|
|
11569
|
-
var guidanceMessage = t('Please sign the box below');
|
|
11570
11574
|
return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
|
|
11571
11575
|
className: "flex"
|
|
11572
|
-
}, /*#__PURE__*/React__default['default'].createElement(CameraVideoTag, null),
|
|
11576
|
+
}, /*#__PURE__*/React__default['default'].createElement(CameraVideoTag, null), verbiage.guidanceMessageText && /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
|
|
11573
11577
|
"$top": "5vh"
|
|
11574
|
-
}, /*#__PURE__*/React__default['default'].createElement(GuidanceMessage,
|
|
11578
|
+
}, /*#__PURE__*/React__default['default'].createElement(GuidanceMessage, {
|
|
11579
|
+
"$background": colors.guidanceMessageBackgroundColor,
|
|
11580
|
+
"$textColor": colors.guidanceMessageTextColor
|
|
11581
|
+
}, verbiage.guidanceMessageText)), /*#__PURE__*/React__default['default'].createElement(SignatureCanvasContainer, null, /*#__PURE__*/React__default['default'].createElement(SignaturePad, {
|
|
11575
11582
|
ref: ref
|
|
11576
11583
|
}, /*#__PURE__*/React__default['default'].createElement(SignatureCanvas__default['default'], {
|
|
11577
11584
|
ref: signaturePad,
|
|
@@ -11673,19 +11680,23 @@ var templateObject_1;
|
|
|
11673
11680
|
var SignatureKYCWizard = function SignatureKYCWizard(_a) {
|
|
11674
11681
|
var onComplete = _a.onComplete,
|
|
11675
11682
|
onRetryClicked = _a.onRetryClicked,
|
|
11676
|
-
_b = _a.
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11683
|
+
_b = _a.colors,
|
|
11684
|
+
colors = _b === void 0 ? {} : _b,
|
|
11685
|
+
_c = _a.verbiage,
|
|
11686
|
+
verbiage = _c === void 0 ? {} : _c,
|
|
11687
|
+
_d = _a.debugMode,
|
|
11688
|
+
debugMode = _d === void 0 ? false : _d;
|
|
11689
|
+
var _e = React.useContext(SubmissionContext),
|
|
11690
|
+
submit = _e.submit,
|
|
11691
|
+
selfieImage = _e.selfieImage,
|
|
11692
|
+
signatureVideo = _e.signatureVideo,
|
|
11693
|
+
setSelfieImage = _e.setSelfieImage,
|
|
11694
|
+
setSignatureData = _e.setSignatureData,
|
|
11695
|
+
setSignatureVideo = _e.setSignatureVideo,
|
|
11696
|
+
logSelfieCaptureAttempt = _e.logSelfieCaptureAttempt;
|
|
11697
|
+
var _f = React.useState('LOADING'),
|
|
11698
|
+
captureState = _f[0],
|
|
11699
|
+
setCaptureState = _f[1];
|
|
11689
11700
|
var operationStartedAt = React.useRef();
|
|
11690
11701
|
var captureStartedAt = React.useRef();
|
|
11691
11702
|
var captureEndedAt = React.useRef();
|
|
@@ -11734,13 +11745,13 @@ var SignatureKYCWizard = function SignatureKYCWizard(_a) {
|
|
|
11734
11745
|
setSignatureVideo(URL.createObjectURL(videoData));
|
|
11735
11746
|
setCaptureState('SUCCESS');
|
|
11736
11747
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete();
|
|
11737
|
-
}, [onComplete, setSignatureData]);
|
|
11748
|
+
}, [onComplete, setSignatureData, setSignatureVideo]);
|
|
11738
11749
|
var onSignatureCaptureFacesNotDetected = React.useCallback(function () {
|
|
11739
11750
|
setCaptureState('CHECKING_LIVENESS');
|
|
11740
11751
|
}, []);
|
|
11741
|
-
var
|
|
11742
|
-
attempt =
|
|
11743
|
-
setAttempt =
|
|
11752
|
+
var _g = React.useState(0),
|
|
11753
|
+
attempt = _g[0],
|
|
11754
|
+
setAttempt = _g[1];
|
|
11744
11755
|
var onExit = React.useCallback(function () {
|
|
11745
11756
|
setAttempt(function (n) {
|
|
11746
11757
|
return n + 1;
|
|
@@ -11750,11 +11761,14 @@ var SignatureKYCWizard = function SignatureKYCWizard(_a) {
|
|
|
11750
11761
|
return /*#__PURE__*/React__default['default'].createElement(HighPerformanceSelfieGuidanceModelsProvider, {
|
|
11751
11762
|
throttleMs: captureState === 'CAPTURING_SIGNATURE' ? 250 : 0
|
|
11752
11763
|
}, captureState !== 'LOADING' && function () {
|
|
11764
|
+
var _a, _b, _c;
|
|
11753
11765
|
switch (captureState) {
|
|
11754
11766
|
case 'CHECKING_LIVENESS':
|
|
11755
11767
|
return /*#__PURE__*/React__default['default'].createElement(FaceLivenessCapture, {
|
|
11756
11768
|
onSuccess: onFaceCaptureSuccess,
|
|
11757
11769
|
onExit: onExit,
|
|
11770
|
+
colors: colors.faceLiveness,
|
|
11771
|
+
verbiage: verbiage.faceLiveness,
|
|
11758
11772
|
debugMode: debugMode
|
|
11759
11773
|
});
|
|
11760
11774
|
case 'CAPTURING_SIGNATURE':
|
|
@@ -11762,13 +11776,18 @@ var SignatureKYCWizard = function SignatureKYCWizard(_a) {
|
|
|
11762
11776
|
onComplete: onSignatureCaptureCompleted,
|
|
11763
11777
|
onFaceNotDetected: onSignatureCaptureFacesNotDetected,
|
|
11764
11778
|
onExit: onExit,
|
|
11779
|
+
colors: colors.videoSignatureCapture,
|
|
11780
|
+
verbiage: verbiage.videoSignatureCapture,
|
|
11765
11781
|
debugMode: debugMode
|
|
11766
11782
|
});
|
|
11767
11783
|
case 'SUCCESS':
|
|
11768
11784
|
return /*#__PURE__*/React__default['default'].createElement(SignatureKYCSuccess, {
|
|
11769
11785
|
videoUrl: signatureVideo !== null && signatureVideo !== void 0 ? signatureVideo : '',
|
|
11770
11786
|
onDoneClick: submit,
|
|
11771
|
-
onRetryClick: onRetryClicked
|
|
11787
|
+
onRetryClick: onRetryClicked,
|
|
11788
|
+
headingText: (_a = verbiage.success) === null || _a === void 0 ? void 0 : _a.headingText,
|
|
11789
|
+
retryBtnText: (_b = verbiage.success) === null || _b === void 0 ? void 0 : _b.retryBtnText,
|
|
11790
|
+
doneBtnText: (_c = verbiage.success) === null || _c === void 0 ? void 0 : _c.doneBtnText
|
|
11772
11791
|
});
|
|
11773
11792
|
default:
|
|
11774
11793
|
return null;
|
|
@@ -13477,6 +13496,8 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
13477
13496
|
submissionUrl = _a.submissionUrl,
|
|
13478
13497
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
13479
13498
|
onComplete = _a.onComplete,
|
|
13499
|
+
colors = _a.colors,
|
|
13500
|
+
verbiage = _a.verbiage,
|
|
13480
13501
|
geolocationEnabled = _a.geolocationEnabled,
|
|
13481
13502
|
geolocationRequired = _a.geolocationRequired,
|
|
13482
13503
|
debugMode = _a.debugMode;
|
|
@@ -13498,7 +13519,9 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
13498
13519
|
preferFrontFacingCamera: true,
|
|
13499
13520
|
requestMicrophoneAccess: true
|
|
13500
13521
|
}, /*#__PURE__*/React__default['default'].createElement(SignatureKYCWizard, {
|
|
13522
|
+
colors: colors,
|
|
13501
13523
|
debugMode: debugMode,
|
|
13524
|
+
verbiage: verbiage,
|
|
13502
13525
|
onRetryClicked: function onRetryClicked() {
|
|
13503
13526
|
setAttempt(function (n) {
|
|
13504
13527
|
return n + 1;
|