idmission-web-sdk 0.0.31 → 0.0.33

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.
@@ -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;
@@ -2,8 +2,9 @@ import React from 'react';
2
2
  import { SignatureData } from './data';
3
3
  import { SignatureCaptureVerbiage } from './SignatureCapture';
4
4
  export type VideoSignatureCaptureProps = {
5
- onComplete?: (signatureData: SignatureData, imageData: string) => void;
5
+ onComplete?: (signatureData: SignatureData, imageData: string, videoData: Blob) => 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;
@@ -0,0 +1,10 @@
1
+ import { ReactElement } from 'react';
2
+ export type SignatureKYCSuccessProps = {
3
+ videoUrl: string;
4
+ headingText?: string;
5
+ retryBtnText?: string;
6
+ doneBtnText?: string;
7
+ onDoneClick?: () => void;
8
+ onRetryClick?: () => void;
9
+ };
10
+ export declare const SignatureKYCSuccess: ({ videoUrl, headingText, retryBtnText, doneBtnText, onDoneClick, onRetryClick, }: SignatureKYCSuccessProps) => ReactElement;
@@ -1,5 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  export type SignatureKYCWizardProps = {
3
3
  onComplete?: () => void;
4
+ onRetryClicked?: () => void;
5
+ debugMode?: boolean;
4
6
  };
5
- export declare const SignatureKYCWizard: ({ onComplete, }: SignatureKYCWizardProps) => ReactElement;
7
+ export declare const SignatureKYCWizard: ({ onComplete, onRetryClicked, debugMode, }: SignatureKYCWizardProps) => ReactElement;
@@ -157,12 +157,14 @@ export type SubmissionState = {
157
157
  passportImage: string | null;
158
158
  selfieImage: string | null;
159
159
  signatureData: SignatureData | null;
160
+ signatureVideo: string | null;
160
161
  additionalDocuments: UploadedDocument[] | null;
161
162
  setIdFrontImage: (image: string) => void;
162
163
  setIdBackImage: (image: string) => void;
163
164
  setPassportImage: (image: string) => void;
164
165
  setSelfieImage: (image: string) => void;
165
166
  setSignatureData: (signatureData: SignatureData) => void;
167
+ setSignatureVideo: (videoB64: string) => void;
166
168
  setAdditionalDocuments: (uploadedDocuments: UploadedDocument[]) => void;
167
169
  logIdFrontCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
168
170
  logIdBackCaptureAttempt: (attempt: CaptureAttemptMetadata) => void;
@@ -86,6 +86,7 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
86
86
  passportImage: null,
87
87
  selfieImage: null,
88
88
  signatureData: null,
89
+ signatureVideo: null,
89
90
  additionalDocuments: null,
90
91
  setIdFrontImage: function setIdFrontImage() {
91
92
  return null;
@@ -102,6 +103,9 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
102
103
  setSignatureData: function setSignatureData() {
103
104
  return null;
104
105
  },
106
+ setSignatureVideo: function setSignatureVideo() {
107
+ return null;
108
+ },
105
109
  setAdditionalDocuments: function setAdditionalDocuments() {
106
110
  return null;
107
111
  },
@@ -191,7 +195,7 @@ function contentDispositionFromDataUrl(url) {
191
195
  return (_b = (_a = url.match(/^(data:.*;base64),/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '';
192
196
  }
193
197
 
194
- var PageContainerDiv = styled__default['default'].div(templateObject_1$7 || (templateObject_1$7 = tslib.__makeTemplateObject(["\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ", "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n font-family: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,\n Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ", "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n font-family: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,\n Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (_a) {
198
+ var PageContainerDiv = styled__default['default'].div(templateObject_1$7 || (templateObject_1$7 = tslib.__makeTemplateObject(["\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ", "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n font-family:\n Inter,\n -apple-system,\n BlinkMacSystemFont,\n Segoe UI,\n Roboto,\n Oxygen,\n Ubuntu,\n Cantarell,\n Fira Sans,\n Droid Sans,\n Helvetica Neue,\n sans-serif;\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ", "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n font-family:\n Inter,\n -apple-system,\n BlinkMacSystemFont,\n Segoe UI,\n Roboto,\n Oxygen,\n Ubuntu,\n Cantarell,\n Fira Sans,\n Droid Sans,\n Helvetica Neue,\n sans-serif;\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (_a) {
195
199
  var $heightOffset = _a.$heightOffset;
196
200
  return $heightOffset !== null && $heightOffset !== void 0 ? $heightOffset : 0;
197
201
  });
@@ -202,7 +206,11 @@ var PageContainer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
202
206
  heightOffset = _b === void 0 ? 0 : _b,
203
207
  style = _a.style,
204
208
  onClick = _a.onClick;
209
+ var _c = React.useState(false),
210
+ dimensionsCalculated = _c[0],
211
+ setDimensionsCalculated = _c[1];
205
212
  React.useEffect(function () {
213
+ setDimensionsCalculated(false);
206
214
  var calcAppDimensions = function calcAppDimensions() {
207
215
  var doc = document.documentElement;
208
216
  doc.style.setProperty('--app-width', "".concat(window.innerWidth, "px"));
@@ -210,6 +218,7 @@ var PageContainer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
210
218
  };
211
219
  window.addEventListener('resize', calcAppDimensions);
212
220
  calcAppDimensions();
221
+ setDimensionsCalculated(true);
213
222
  return function () {
214
223
  window.removeEventListener('resize', calcAppDimensions);
215
224
  };
@@ -220,7 +229,7 @@ var PageContainer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
220
229
  onClick: onClick,
221
230
  className: className,
222
231
  "$heightOffset": heightOffset
223
- }, children);
232
+ }, dimensionsCalculated && children);
224
233
  });
225
234
  PageContainer.displayName = 'PageContainer';
226
235
  var templateObject_1$7;
@@ -346,26 +355,29 @@ var SubmissionProvider = function SubmissionProvider(_a) {
346
355
  signatureData = _t[0],
347
356
  setSignatureData = _t[1];
348
357
  var _u = React.useState(null),
349
- additionalDocuments = _u[0],
350
- setAdditionalDocuments = _u[1];
358
+ signatureVideo = _u[0],
359
+ setSignatureVideo = _u[1];
351
360
  var _v = React.useState(null),
352
- geolocationResult = _v[0],
353
- setGeolocationResult = _v[1];
354
- var _w = React.useState(0),
355
- geolocationAttempts = _w[0],
356
- setGeolocationAttempts = _w[1];
357
- var _x = React.useState(false),
358
- geolocationBlocked = _x[0],
359
- setGeolocationBlocked = _x[1];
360
- var _y = React.useState([]),
361
- idFrontCaptureAttempts = _y[0],
362
- setIdFrontCaptureAttempts = _y[1];
361
+ additionalDocuments = _v[0],
362
+ setAdditionalDocuments = _v[1];
363
+ var _w = React.useState(null),
364
+ geolocationResult = _w[0],
365
+ setGeolocationResult = _w[1];
366
+ var _x = React.useState(0),
367
+ geolocationAttempts = _x[0],
368
+ setGeolocationAttempts = _x[1];
369
+ var _y = React.useState(false),
370
+ geolocationBlocked = _y[0],
371
+ setGeolocationBlocked = _y[1];
363
372
  var _z = React.useState([]),
364
- idBackCaptureAttempts = _z[0],
365
- setIdBackCaptureAttempts = _z[1];
373
+ idFrontCaptureAttempts = _z[0],
374
+ setIdFrontCaptureAttempts = _z[1];
366
375
  var _0 = React.useState([]),
367
- selfieCaptureAttempts = _0[0],
368
- setSelfieCaptureAttempts = _0[1];
376
+ idBackCaptureAttempts = _0[0],
377
+ setIdBackCaptureAttempts = _0[1];
378
+ var _1 = React.useState([]),
379
+ selfieCaptureAttempts = _1[0],
380
+ setSelfieCaptureAttempts = _1[1];
369
381
  var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
370
382
  setIdFrontCaptureAttempts(function (attempts) {
371
383
  return tslib.__spreadArray(tslib.__spreadArray([], attempts, true), [attempt], false);
@@ -610,12 +622,14 @@ var SubmissionProvider = function SubmissionProvider(_a) {
610
622
  passportImage: passportImage,
611
623
  selfieImage: selfieImage,
612
624
  signatureData: signatureData,
625
+ signatureVideo: signatureVideo,
613
626
  additionalDocuments: additionalDocuments,
614
627
  setIdFrontImage: setIdFrontImage,
615
628
  setIdBackImage: setIdBackImage,
616
629
  setPassportImage: setPassportImage,
617
630
  setSelfieImage: setSelfieImage,
618
631
  setSignatureData: setSignatureData,
632
+ setSignatureVideo: setSignatureVideo,
619
633
  setAdditionalDocuments: setAdditionalDocuments,
620
634
  logIdFrontCaptureAttempt: logIdFrontCaptureAttempt,
621
635
  logIdBackCaptureAttempt: logIdBackCaptureAttempt,
@@ -11363,25 +11377,24 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
11363
11377
  var onComplete = _a.onComplete,
11364
11378
  onFaceNotDetected = _a.onFaceNotDetected,
11365
11379
  _d = _a.verbiage,
11366
- verbiage = _d === void 0 ? {} : _d;
11380
+ verbiage = _d === void 0 ? {} : _d,
11381
+ _e = _a.debugMode,
11382
+ debugMode = _e === void 0 ? false : _e;
11367
11383
  var t = reactI18next.useTranslation().t;
11368
- var _e = React.useContext(CameraStateContext),
11369
- cameraRef = _e.cameraRef,
11370
- videoRef = _e.videoRef;
11371
- var _f = useResizeObserver__default['default'](),
11372
- ref = _f.ref,
11373
- width = _f.width,
11374
- height = _f.height;
11384
+ var _f = React.useContext(CameraStateContext),
11385
+ cameraRef = _f.cameraRef,
11386
+ videoRef = _f.videoRef;
11387
+ var _g = useResizeObserver__default['default'](),
11388
+ ref = _g.ref,
11389
+ width = _g.width,
11390
+ height = _g.height;
11375
11391
  var signaturePad = React.useRef(null);
11376
11392
  var signatureRecorder = React.useRef(null);
11377
11393
  var recordedChunks = React.useRef([]);
11378
- var _g = React.useState(null),
11379
- signatureVideoUrl = _g[0],
11380
- setSignatureVideoUrl = _g[1];
11381
- var _h = React.useContext(HighPerformanceSelfieGuidanceModelsContext),
11382
- start = _h.start,
11383
- stop = _h.stop,
11384
- onPredictionMade = _h.onPredictionMade;
11394
+ var _h = React.useState(null),
11395
+ signatureVideoUrl = _h[0],
11396
+ setSignatureVideoUrl = _h[1];
11397
+ var onPredictionMade = React.useContext(HighPerformanceSelfieGuidanceModelsContext).onPredictionMade;
11385
11398
  var _j = useVideoRecorder(cameraRef.current),
11386
11399
  isRecording = _j.isRecording,
11387
11400
  startRecording = _j.startRecording,
@@ -11393,63 +11406,65 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
11393
11406
  var _l = React.useState(null),
11394
11407
  signatureDataUrl = _l[0],
11395
11408
  setSignatureDataUrl = _l[1];
11396
- verbiage.acceptBtnText = verbiage.acceptBtnText || t('Accept');
11397
- verbiage.clearBtnText = verbiage.clearBtnText || t('Clear');
11409
+ var _m = React.useState(null),
11410
+ signatureVideoData = _m[0],
11411
+ setSignatureVideoData = _m[1];
11412
+ verbiage.acceptBtnText || (verbiage.acceptBtnText = t('Accept'));
11413
+ verbiage.clearBtnText || (verbiage.clearBtnText = t('Clear'));
11398
11414
  var outputCanvas = React.useRef(null);
11399
11415
  React.useEffect(function () {
11400
- if (isRecording && onFaceNotDetected) {
11401
- start();
11402
- }
11403
- return function () {
11404
- stop();
11405
- };
11406
- }, [isRecording, onFaceNotDetected, start, stop]);
11407
- React.useEffect(function () {
11408
- if (!isRecording && !videoUrl && !!outputCanvas.current) {
11409
- startRecording();
11410
- var stream = outputCanvas.current.captureStream(25);
11411
- signatureRecorder.current = new MediaRecorder(stream, {});
11412
- signatureRecorder.current.start();
11413
- signatureRecorder.current.ondataavailable = function (event) {
11414
- var _a;
11415
- recordedChunks.current.push(event.data);
11416
- if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
11417
- signatureRecorder.current.stop();
11418
- }
11419
- };
11420
- signatureRecorder.current.onstop = function () {
11421
- var blob = new Blob(recordedChunks.current, {
11422
- type: 'video/mp4'
11423
- });
11424
- var url = URL.createObjectURL(blob);
11425
- setSignatureVideoUrl(url);
11426
- };
11427
- }
11416
+ setTimeout(function () {
11417
+ if (!isRecording && !videoUrl && !!outputCanvas.current) {
11418
+ startRecording();
11419
+ var stream = outputCanvas.current.captureStream(25);
11420
+ signatureRecorder.current = new MediaRecorder(stream, {});
11421
+ signatureRecorder.current.start();
11422
+ signatureRecorder.current.ondataavailable = function (event) {
11423
+ var _a;
11424
+ recordedChunks.current.push(event.data);
11425
+ if (((_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.state) === 'recording') {
11426
+ signatureRecorder.current.stop();
11427
+ }
11428
+ };
11429
+ signatureRecorder.current.onstop = function () {
11430
+ var blob = new Blob(recordedChunks.current, {
11431
+ type: 'video/mp4'
11432
+ });
11433
+ setSignatureVideoData(blob);
11434
+ var url = URL.createObjectURL(blob);
11435
+ setSignatureVideoUrl(url);
11436
+ };
11437
+ }
11438
+ }, 100);
11428
11439
  }, [isRecording, startRecording, videoUrl]);
11429
11440
  React.useEffect(function () {
11430
- if (signatureVideoUrl && signatureData && signatureDataUrl) {
11431
- onComplete === null || onComplete === void 0 ? void 0 : onComplete(signatureData, signatureDataUrl);
11441
+ if (signatureVideoData && signatureData && signatureDataUrl) {
11442
+ onComplete === null || onComplete === void 0 ? void 0 : onComplete(signatureData, signatureDataUrl, signatureVideoData);
11432
11443
  }
11433
- }, [onComplete, signatureData, signatureDataUrl, signatureVideoUrl]);
11444
+ }, [onComplete, signatureData, signatureDataUrl, signatureVideoData]);
11434
11445
  var animationFrame = React.useRef(0);
11435
11446
  React.useEffect(function () {
11447
+ var _a;
11436
11448
  if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !cameraRef.current || !isRecording) return;
11437
- outputCanvas.current.width = cameraRef.current.width;
11438
- outputCanvas.current.height = cameraRef.current.height;
11449
+ var _b = [cameraRef.current.width, cameraRef.current.height],
11450
+ w = _b[0],
11451
+ h = _b[1];
11452
+ var isPortrait = window.innerWidth < window.innerHeight;
11453
+ var cameraIsLandscape = w > h;
11454
+ if (isPortrait && cameraIsLandscape) _a = [h, w], w = _a[0], h = _a[1];
11455
+ outputCanvas.current.width = w;
11456
+ outputCanvas.current.height = h;
11439
11457
  var ctx = outputCanvas.current.getContext('2d');
11440
11458
  if (!ctx) return;
11441
11459
  animationFrame.current = requestAnimationFrame(function runFrame() {
11442
11460
  return tslib.__awaiter(this, void 0, void 0, function () {
11443
- var isMobile, w, h, rect;
11461
+ var rect;
11444
11462
  return tslib.__generator(this, function (_a) {
11445
11463
  if (!signaturePad.current || !videoRef.current || !outputCanvas.current) {
11446
11464
  cancelAnimationFrame(animationFrame.current);
11447
11465
  return [2];
11448
11466
  }
11449
- isMobile = window.innerWidth <= 800;
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)];
11467
+ 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
11468
  ctx.drawImage(videoRef.current, 0, 0, w, h);
11454
11469
  ctx.beginPath();
11455
11470
  ctx.fillStyle = 'rgba(255,255,255,0.5)';
@@ -11465,9 +11480,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
11465
11480
  cancelAnimationFrame(animationFrame.current);
11466
11481
  };
11467
11482
  }, [cameraRef, isRecording, onFaceNotDetected, videoRef]);
11468
- var _m = React.useState(0),
11469
- numFramesWithoutFaces = _m[0],
11470
- setNumFramesWithoutFaces = _m[1];
11483
+ var _o = React.useState(0),
11484
+ numFramesWithoutFaces = _o[0],
11485
+ setNumFramesWithoutFaces = _o[1];
11471
11486
  React.useEffect(function () {
11472
11487
  onPredictionMade(function (faces) {
11473
11488
  setNumFramesWithoutFaces(function (n) {
@@ -11530,16 +11545,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
11530
11545
  stopRecording();
11531
11546
  (_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
11532
11547
  }
11533
- }, verbiage.acceptBtnText))), /*#__PURE__*/React__default['default'].createElement("div", {
11548
+ }, 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
11549
  style: {
11535
11550
  display: 'none'
11536
11551
  }
11537
11552
  }, /*#__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
- }
11553
+ ref: outputCanvas
11543
11554
  })));
11544
11555
  };
11545
11556
 
@@ -11564,26 +11575,66 @@ var SignatureKYCLoadingOverlay = function SignatureKYCLoadingOverlay(_a) {
11564
11575
  });
11565
11576
  };
11566
11577
 
11578
+ var SignatureKYCSuccess = function SignatureKYCSuccess(_a) {
11579
+ var videoUrl = _a.videoUrl,
11580
+ headingText = _a.headingText,
11581
+ retryBtnText = _a.retryBtnText,
11582
+ doneBtnText = _a.doneBtnText,
11583
+ onDoneClick = _a.onDoneClick,
11584
+ onRetryClick = _a.onRetryClick;
11585
+ var t = reactI18next.useTranslation().t;
11586
+ headingText || (headingText = t('Signature KYC Successful'));
11587
+ retryBtnText || (retryBtnText = t('Retry'));
11588
+ doneBtnText || (doneBtnText = t('Done'));
11589
+ return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner, null, /*#__PURE__*/React__default['default'].createElement("h1", null, headingText), /*#__PURE__*/React__default['default'].createElement(OverlayImageWrapper, null, /*#__PURE__*/React__default['default'].createElement("video", {
11590
+ src: videoUrl,
11591
+ controls: true,
11592
+ style: {
11593
+ marginLeft: 'auto',
11594
+ marginRight: 'auto'
11595
+ }
11596
+ })), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("button", {
11597
+ className: "ladda-button",
11598
+ "data-style": "expand-right",
11599
+ "data-color": "red",
11600
+ onClick: onRetryClick
11601
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
11602
+ className: "ladda-label"
11603
+ }, retryBtnText)), /*#__PURE__*/React__default['default'].createElement("button", {
11604
+ className: "ladda-button",
11605
+ "data-style": "expand-right",
11606
+ "data-color": "mint",
11607
+ onClick: onDoneClick,
11608
+ style: {
11609
+ marginLeft: 15
11610
+ }
11611
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
11612
+ className: "ladda-label"
11613
+ }, doneBtnText)))));
11614
+ };
11615
+
11567
11616
  var SignatureKYCWizard = function SignatureKYCWizard(_a) {
11568
- var onComplete = _a.onComplete;
11569
- var _b = React.useContext(SubmissionContext),
11570
- selfieImage = _b.selfieImage,
11571
- setSelfieImage = _b.setSelfieImage,
11572
- setSignatureData = _b.setSignatureData,
11573
- logSelfieCaptureAttempt = _b.logSelfieCaptureAttempt;
11574
- var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
11575
- var _c = React.useState('LOADING'),
11576
- captureState = _c[0],
11577
- setCaptureState = _c[1];
11617
+ var onComplete = _a.onComplete,
11618
+ onRetryClicked = _a.onRetryClicked,
11619
+ _b = _a.debugMode,
11620
+ debugMode = _b === void 0 ? false : _b;
11621
+ var _c = React.useContext(SubmissionContext),
11622
+ submit = _c.submit,
11623
+ selfieImage = _c.selfieImage,
11624
+ signatureVideo = _c.signatureVideo,
11625
+ setSelfieImage = _c.setSelfieImage,
11626
+ setSignatureData = _c.setSignatureData,
11627
+ setSignatureVideo = _c.setSignatureVideo,
11628
+ logSelfieCaptureAttempt = _c.logSelfieCaptureAttempt;
11629
+ var _d = React.useState('LOADING'),
11630
+ captureState = _d[0],
11631
+ setCaptureState = _d[1];
11578
11632
  var operationStartedAt = React.useRef();
11579
11633
  var captureStartedAt = React.useRef();
11580
11634
  var captureEndedAt = React.useRef();
11581
11635
  React.useEffect(function () {
11582
11636
  operationStartedAt.current = new Date();
11583
- return function () {
11584
- releaseCameraAccess();
11585
- };
11586
- }, [releaseCameraAccess]);
11637
+ }, []);
11587
11638
  React.useEffect(function () {
11588
11639
  if (captureState === 'CHECKING_LIVENESS') {
11589
11640
  captureStartedAt.current = new Date();
@@ -11621,8 +11672,10 @@ var SignatureKYCWizard = function SignatureKYCWizard(_a) {
11621
11672
  });
11622
11673
  });
11623
11674
  }, [logCaptureMetadata, selfieImage, setSelfieImage]);
11624
- var onSignatureCaptureCompleted = React.useCallback(function (signatureData) {
11675
+ var onSignatureCaptureCompleted = React.useCallback(function (signatureData, _, videoData) {
11625
11676
  setSignatureData(signatureData);
11677
+ setSignatureVideo(URL.createObjectURL(videoData));
11678
+ setCaptureState('SUCCESS');
11626
11679
  onComplete === null || onComplete === void 0 ? void 0 : onComplete();
11627
11680
  }, [onComplete, setSignatureData]);
11628
11681
  var onSignatureCaptureFacesNotDetected = React.useCallback(function () {
@@ -11634,12 +11687,20 @@ var SignatureKYCWizard = function SignatureKYCWizard(_a) {
11634
11687
  switch (captureState) {
11635
11688
  case 'CHECKING_LIVENESS':
11636
11689
  return /*#__PURE__*/React__default['default'].createElement(FaceLivenessCapture, {
11637
- onSuccess: onFaceCaptureSuccess
11690
+ onSuccess: onFaceCaptureSuccess,
11691
+ debugMode: debugMode
11638
11692
  });
11639
11693
  case 'CAPTURING_SIGNATURE':
11640
11694
  return /*#__PURE__*/React__default['default'].createElement(VideoSignatureCapture, {
11641
11695
  onComplete: onSignatureCaptureCompleted,
11642
- onFaceNotDetected: onSignatureCaptureFacesNotDetected
11696
+ onFaceNotDetected: onSignatureCaptureFacesNotDetected,
11697
+ debugMode: debugMode
11698
+ });
11699
+ case 'SUCCESS':
11700
+ return /*#__PURE__*/React__default['default'].createElement(SignatureKYCSuccess, {
11701
+ videoUrl: signatureVideo !== null && signatureVideo !== void 0 ? signatureVideo : '',
11702
+ onDoneClick: submit,
11703
+ onRetryClick: onRetryClicked
11643
11704
  });
11644
11705
  default:
11645
11706
  return null;
@@ -13290,7 +13351,11 @@ var SignatureKYC = function SignatureKYC(_a) {
13290
13351
  onBeforeSubmit = _a.onBeforeSubmit,
13291
13352
  onComplete = _a.onComplete,
13292
13353
  geolocationEnabled = _a.geolocationEnabled,
13293
- geolocationRequired = _a.geolocationRequired;
13354
+ geolocationRequired = _a.geolocationRequired,
13355
+ debugMode = _a.debugMode;
13356
+ var _b = React.useState(0),
13357
+ attempt = _b[0],
13358
+ setAttempt = _b[1];
13294
13359
  return /*#__PURE__*/React__default['default'].createElement(SubmissionProvider, {
13295
13360
  action: SubmissionAction.NONE,
13296
13361
  environment: submissionEnvironment,
@@ -13301,10 +13366,18 @@ var SignatureKYC = function SignatureKYC(_a) {
13301
13366
  geolocationEnabled: geolocationEnabled,
13302
13367
  geolocationRequired: geolocationRequired
13303
13368
  }, /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
13369
+ key: attempt,
13304
13370
  preferContinuityCamera: false,
13305
13371
  preferFrontFacingCamera: true,
13306
13372
  requestMicrophoneAccess: true
13307
- }, /*#__PURE__*/React__default['default'].createElement(SignatureKYCWizard, null)));
13373
+ }, /*#__PURE__*/React__default['default'].createElement(SignatureKYCWizard, {
13374
+ debugMode: debugMode,
13375
+ onRetryClicked: function onRetryClicked() {
13376
+ setAttempt(function (n) {
13377
+ return n + 1;
13378
+ });
13379
+ }
13380
+ })));
13308
13381
  };
13309
13382
 
13310
13383
  i18n__default['default'].use(LanguageDetector__default['default']).use(reactI18next.initReactI18next).init({