idmission-web-sdk 0.0.30 → 0.0.32
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 +2 -1
- package/dist/components/signature_capture/VideoSignatureCapture.d.ts +2 -1
- package/dist/components/signature_kyc/SignatureKYCWizard.d.ts +2 -1
- package/dist/sdk2.cjs.development.js +63 -54
- 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 +63 -54
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +63 -54
- 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 +1 -0
- package/dist/stories/SignatureCapture/VideoSignatureCapture.stories.d.ts +7 -2
- package/package.json +1 -1
|
@@ -10,5 +10,6 @@ export type SignatureKYCProps = {
|
|
|
10
10
|
onComplete?: (submissionResponse: SubmissionResponse) => void;
|
|
11
11
|
geolocationEnabled?: boolean;
|
|
12
12
|
geolocationRequired?: boolean;
|
|
13
|
+
debugMode?: boolean;
|
|
13
14
|
};
|
|
14
|
-
export declare const SignatureKYC: ({ submissionToken, submissionEnvironment, submissionUrl, onBeforeSubmit, onComplete, geolocationEnabled, geolocationRequired, }: SignatureKYCProps) => ReactElement;
|
|
15
|
+
export declare const SignatureKYC: ({ submissionToken, submissionEnvironment, submissionUrl, onBeforeSubmit, onComplete, geolocationEnabled, geolocationRequired, debugMode, }: SignatureKYCProps) => ReactElement;
|
|
@@ -5,5 +5,6 @@ export type VideoSignatureCaptureProps = {
|
|
|
5
5
|
onComplete?: (signatureData: SignatureData, imageData: string) => void;
|
|
6
6
|
onFaceNotDetected?: () => void;
|
|
7
7
|
verbiage?: SignatureCaptureVerbiage;
|
|
8
|
+
debugMode?: boolean;
|
|
8
9
|
};
|
|
9
|
-
export declare const VideoSignatureCapture: ({ onComplete, onFaceNotDetected, verbiage, }: VideoSignatureCaptureProps) => React.ReactElement;
|
|
10
|
+
export declare const VideoSignatureCapture: ({ onComplete, onFaceNotDetected, verbiage, debugMode, }: VideoSignatureCaptureProps) => React.ReactElement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
export type SignatureKYCWizardProps = {
|
|
3
3
|
onComplete?: () => void;
|
|
4
|
+
debugMode?: boolean;
|
|
4
5
|
};
|
|
5
|
-
export declare const SignatureKYCWizard: ({ onComplete, }: SignatureKYCWizardProps) => ReactElement;
|
|
6
|
+
export declare const SignatureKYCWizard: ({ onComplete, debugMode, }: SignatureKYCWizardProps) => ReactElement;
|
|
@@ -11363,36 +11363,38 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11363
11363
|
var onComplete = _a.onComplete,
|
|
11364
11364
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
11365
11365
|
_d = _a.verbiage,
|
|
11366
|
-
verbiage = _d === void 0 ? {} : _d
|
|
11366
|
+
verbiage = _d === void 0 ? {} : _d,
|
|
11367
|
+
_e = _a.debugMode,
|
|
11368
|
+
debugMode = _e === void 0 ? false : _e;
|
|
11367
11369
|
var t = reactI18next.useTranslation().t;
|
|
11368
|
-
var
|
|
11369
|
-
cameraRef =
|
|
11370
|
-
videoRef =
|
|
11371
|
-
var
|
|
11372
|
-
ref =
|
|
11373
|
-
width =
|
|
11374
|
-
height =
|
|
11370
|
+
var _f = React.useContext(CameraStateContext),
|
|
11371
|
+
cameraRef = _f.cameraRef,
|
|
11372
|
+
videoRef = _f.videoRef;
|
|
11373
|
+
var _g = useResizeObserver__default['default'](),
|
|
11374
|
+
ref = _g.ref,
|
|
11375
|
+
width = _g.width,
|
|
11376
|
+
height = _g.height;
|
|
11375
11377
|
var signaturePad = React.useRef(null);
|
|
11376
11378
|
var signatureRecorder = React.useRef(null);
|
|
11377
11379
|
var recordedChunks = React.useRef([]);
|
|
11378
|
-
var
|
|
11379
|
-
signatureVideoUrl =
|
|
11380
|
-
setSignatureVideoUrl =
|
|
11381
|
-
var
|
|
11382
|
-
start =
|
|
11383
|
-
stop =
|
|
11384
|
-
onPredictionMade =
|
|
11385
|
-
var
|
|
11386
|
-
isRecording =
|
|
11387
|
-
startRecording =
|
|
11388
|
-
stopRecording =
|
|
11389
|
-
videoUrl =
|
|
11390
|
-
var _k = React.useState(null),
|
|
11391
|
-
signatureData = _k[0],
|
|
11392
|
-
setSignatureData = _k[1];
|
|
11380
|
+
var _h = React.useState(null),
|
|
11381
|
+
signatureVideoUrl = _h[0],
|
|
11382
|
+
setSignatureVideoUrl = _h[1];
|
|
11383
|
+
var _j = React.useContext(HighPerformanceSelfieGuidanceModelsContext),
|
|
11384
|
+
start = _j.start,
|
|
11385
|
+
stop = _j.stop,
|
|
11386
|
+
onPredictionMade = _j.onPredictionMade;
|
|
11387
|
+
var _k = useVideoRecorder(cameraRef.current),
|
|
11388
|
+
isRecording = _k.isRecording,
|
|
11389
|
+
startRecording = _k.startRecording,
|
|
11390
|
+
stopRecording = _k.stopRecording,
|
|
11391
|
+
videoUrl = _k.videoUrl;
|
|
11393
11392
|
var _l = React.useState(null),
|
|
11394
|
-
|
|
11395
|
-
|
|
11393
|
+
signatureData = _l[0],
|
|
11394
|
+
setSignatureData = _l[1];
|
|
11395
|
+
var _m = React.useState(null),
|
|
11396
|
+
signatureDataUrl = _m[0],
|
|
11397
|
+
setSignatureDataUrl = _m[1];
|
|
11396
11398
|
verbiage.acceptBtnText = verbiage.acceptBtnText || t('Accept');
|
|
11397
11399
|
verbiage.clearBtnText = verbiage.clearBtnText || t('Clear');
|
|
11398
11400
|
var outputCanvas = React.useRef(null);
|
|
@@ -11433,23 +11435,27 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11433
11435
|
}, [onComplete, signatureData, signatureDataUrl, signatureVideoUrl]);
|
|
11434
11436
|
var animationFrame = React.useRef(0);
|
|
11435
11437
|
React.useEffect(function () {
|
|
11438
|
+
var _a;
|
|
11436
11439
|
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !cameraRef.current || !isRecording) return;
|
|
11437
|
-
|
|
11438
|
-
|
|
11440
|
+
var _b = [cameraRef.current.width, cameraRef.current.height],
|
|
11441
|
+
w = _b[0],
|
|
11442
|
+
h = _b[1];
|
|
11443
|
+
var isPortrait = window.innerWidth < window.innerHeight;
|
|
11444
|
+
var cameraIsLandscape = w > h;
|
|
11445
|
+
if (isPortrait && cameraIsLandscape) _a = [h, w], w = _a[0], h = _a[1];
|
|
11446
|
+
outputCanvas.current.width = w;
|
|
11447
|
+
outputCanvas.current.height = h;
|
|
11439
11448
|
var ctx = outputCanvas.current.getContext('2d');
|
|
11440
11449
|
if (!ctx) return;
|
|
11441
11450
|
animationFrame.current = requestAnimationFrame(function runFrame() {
|
|
11442
11451
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
11443
|
-
var
|
|
11452
|
+
var rect;
|
|
11444
11453
|
return tslib.__generator(this, function (_a) {
|
|
11445
11454
|
if (!signaturePad.current || !videoRef.current || !outputCanvas.current) {
|
|
11446
11455
|
cancelAnimationFrame(animationFrame.current);
|
|
11447
11456
|
return [2];
|
|
11448
11457
|
}
|
|
11449
|
-
|
|
11450
|
-
w = outputCanvas.current.width;
|
|
11451
|
-
h = outputCanvas.current.height;
|
|
11452
|
-
rect = [w * (isMobile ? 0.02 : 0.15), h * (isMobile ? 0.15 : 0.25), w * (isMobile ? 0.96 : 0.7), h * (isMobile ? 0.7 : 0.5)];
|
|
11458
|
+
rect = [w * (isPortrait ? 0.02 : 0.15), h * (isPortrait ? 0.15 : 0.25), w * (isPortrait ? 0.96 : 0.7), h * (isPortrait ? 0.7 : 0.5)];
|
|
11453
11459
|
ctx.drawImage(videoRef.current, 0, 0, w, h);
|
|
11454
11460
|
ctx.beginPath();
|
|
11455
11461
|
ctx.fillStyle = 'rgba(255,255,255,0.5)';
|
|
@@ -11465,9 +11471,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11465
11471
|
cancelAnimationFrame(animationFrame.current);
|
|
11466
11472
|
};
|
|
11467
11473
|
}, [cameraRef, isRecording, onFaceNotDetected, videoRef]);
|
|
11468
|
-
var
|
|
11469
|
-
numFramesWithoutFaces =
|
|
11470
|
-
setNumFramesWithoutFaces =
|
|
11474
|
+
var _o = React.useState(0),
|
|
11475
|
+
numFramesWithoutFaces = _o[0],
|
|
11476
|
+
setNumFramesWithoutFaces = _o[1];
|
|
11471
11477
|
React.useEffect(function () {
|
|
11472
11478
|
onPredictionMade(function (faces) {
|
|
11473
11479
|
setNumFramesWithoutFaces(function (n) {
|
|
@@ -11530,16 +11536,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11530
11536
|
stopRecording();
|
|
11531
11537
|
(_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
|
|
11532
11538
|
}
|
|
11533
|
-
}, verbiage.acceptBtnText))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11539
|
+
}, verbiage.acceptBtnText))), debugMode && /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, "Video: ", (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.width, "x", (_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.height), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11534
11540
|
style: {
|
|
11535
11541
|
display: 'none'
|
|
11536
11542
|
}
|
|
11537
11543
|
}, /*#__PURE__*/React__default['default'].createElement("canvas", {
|
|
11538
|
-
ref: outputCanvas
|
|
11539
|
-
style: {
|
|
11540
|
-
width: (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.videoWidth,
|
|
11541
|
-
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
11542
|
-
}
|
|
11544
|
+
ref: outputCanvas
|
|
11543
11545
|
})));
|
|
11544
11546
|
};
|
|
11545
11547
|
|
|
@@ -11565,16 +11567,18 @@ var SignatureKYCLoadingOverlay = function SignatureKYCLoadingOverlay(_a) {
|
|
|
11565
11567
|
};
|
|
11566
11568
|
|
|
11567
11569
|
var SignatureKYCWizard = function SignatureKYCWizard(_a) {
|
|
11568
|
-
var onComplete = _a.onComplete
|
|
11569
|
-
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11570
|
+
var onComplete = _a.onComplete,
|
|
11571
|
+
_b = _a.debugMode,
|
|
11572
|
+
debugMode = _b === void 0 ? false : _b;
|
|
11573
|
+
var _c = React.useContext(SubmissionContext),
|
|
11574
|
+
selfieImage = _c.selfieImage,
|
|
11575
|
+
setSelfieImage = _c.setSelfieImage,
|
|
11576
|
+
setSignatureData = _c.setSignatureData,
|
|
11577
|
+
logSelfieCaptureAttempt = _c.logSelfieCaptureAttempt;
|
|
11574
11578
|
var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
|
|
11575
|
-
var
|
|
11576
|
-
captureState =
|
|
11577
|
-
setCaptureState =
|
|
11579
|
+
var _d = React.useState('LOADING'),
|
|
11580
|
+
captureState = _d[0],
|
|
11581
|
+
setCaptureState = _d[1];
|
|
11578
11582
|
var operationStartedAt = React.useRef();
|
|
11579
11583
|
var captureStartedAt = React.useRef();
|
|
11580
11584
|
var captureEndedAt = React.useRef();
|
|
@@ -11634,12 +11638,14 @@ var SignatureKYCWizard = function SignatureKYCWizard(_a) {
|
|
|
11634
11638
|
switch (captureState) {
|
|
11635
11639
|
case 'CHECKING_LIVENESS':
|
|
11636
11640
|
return /*#__PURE__*/React__default['default'].createElement(FaceLivenessCapture, {
|
|
11637
|
-
onSuccess: onFaceCaptureSuccess
|
|
11641
|
+
onSuccess: onFaceCaptureSuccess,
|
|
11642
|
+
debugMode: debugMode
|
|
11638
11643
|
});
|
|
11639
11644
|
case 'CAPTURING_SIGNATURE':
|
|
11640
11645
|
return /*#__PURE__*/React__default['default'].createElement(VideoSignatureCapture, {
|
|
11641
11646
|
onComplete: onSignatureCaptureCompleted,
|
|
11642
|
-
onFaceNotDetected: onSignatureCaptureFacesNotDetected
|
|
11647
|
+
onFaceNotDetected: onSignatureCaptureFacesNotDetected,
|
|
11648
|
+
debugMode: debugMode
|
|
11643
11649
|
});
|
|
11644
11650
|
default:
|
|
11645
11651
|
return null;
|
|
@@ -13290,7 +13296,8 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
13290
13296
|
onBeforeSubmit = _a.onBeforeSubmit,
|
|
13291
13297
|
onComplete = _a.onComplete,
|
|
13292
13298
|
geolocationEnabled = _a.geolocationEnabled,
|
|
13293
|
-
geolocationRequired = _a.geolocationRequired
|
|
13299
|
+
geolocationRequired = _a.geolocationRequired,
|
|
13300
|
+
debugMode = _a.debugMode;
|
|
13294
13301
|
return /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
|
|
13295
13302
|
action: SubmissionAction.NONE,
|
|
13296
13303
|
environment: submissionEnvironment,
|
|
@@ -13304,7 +13311,9 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
13304
13311
|
preferContinuityCamera: false,
|
|
13305
13312
|
preferFrontFacingCamera: true,
|
|
13306
13313
|
requestMicrophoneAccess: true
|
|
13307
|
-
}, /*#__PURE__*/React__default['default'].createElement(SignatureKYCWizard,
|
|
13314
|
+
}, /*#__PURE__*/React__default['default'].createElement(SignatureKYCWizard, {
|
|
13315
|
+
debugMode: debugMode
|
|
13316
|
+
})));
|
|
13308
13317
|
};
|
|
13309
13318
|
|
|
13310
13319
|
i18n__default['default'].use(LanguageDetector__default['default']).use(reactI18next.initReactI18next).init({
|