idmission-web-sdk 2.2.150 → 2.2.152

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.
@@ -233,7 +233,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
233
233
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
234
234
  };
235
235
 
236
- var webSdkVersion = '2.2.150';
236
+ var webSdkVersion = '2.2.152';
237
237
 
238
238
  function getPlatform() {
239
239
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -3890,12 +3890,9 @@ function CameraStoreProvider(_a) {
3890
3890
  }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
3891
3891
  React.useEffect(function () {
3892
3892
  var _a;
3893
- if (!requireMicrophoneAccess) return;
3894
- (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
3895
- return function () {
3896
- var _a;
3897
- return (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().releaseMicrophoneAccess();
3898
- };
3893
+ if (requireMicrophoneAccess) {
3894
+ (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
3895
+ }
3899
3896
  }, [requireMicrophoneAccess]);
3900
3897
  React.useEffect(function () {
3901
3898
  return function () {
@@ -13078,18 +13075,25 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
13078
13075
  processAudio();
13079
13076
  }
13080
13077
  }, [audioRecordingIntentionallyStopped, audioRecordingStopped, processAudio]);
13081
- return {
13082
- isRecordingVideo: isRecordingVideo,
13083
- isRecordingAudio: isRecordingAudio,
13084
- startRecordingVideo: startRecordingVideo,
13085
- startRecordingAudio: startRecordingAudio,
13086
- stopRecordingVideo: stopRecordingVideo,
13087
- stopRecordingAudio: stopRecordingAudio,
13088
- videoRecordingUnintentionallyStopped: videoRecordingStopped && !videoRecordingIntentionallyStopped,
13089
- audioRecordingUnintentionallyStopped: audioRecordingStopped && !audioRecordingIntentionallyStopped,
13090
- videoUrl: videoUrl,
13091
- audioUrl: audioUrl
13092
- };
13078
+ var clearRecordedData = React.useCallback(function () {
13079
+ videoChunks.current = [];
13080
+ audioChunks.current = [];
13081
+ }, []);
13082
+ return React.useMemo(function () {
13083
+ return {
13084
+ isRecordingVideo: isRecordingVideo,
13085
+ isRecordingAudio: isRecordingAudio,
13086
+ startRecordingVideo: startRecordingVideo,
13087
+ startRecordingAudio: startRecordingAudio,
13088
+ stopRecordingVideo: stopRecordingVideo,
13089
+ stopRecordingAudio: stopRecordingAudio,
13090
+ clearRecordedData: clearRecordedData,
13091
+ videoRecordingUnintentionallyStopped: videoRecordingStopped && !videoRecordingIntentionallyStopped,
13092
+ audioRecordingUnintentionallyStopped: audioRecordingStopped && !audioRecordingIntentionallyStopped,
13093
+ videoUrl: videoUrl,
13094
+ audioUrl: audioUrl
13095
+ };
13096
+ }, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, clearRecordedData, isRecordingAudio, isRecordingVideo, startRecordingAudio, startRecordingVideo, stopRecordingAudio, stopRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
13093
13097
  };
13094
13098
 
13095
13099
  var videoSignatureInitialState = {
@@ -13099,6 +13103,10 @@ var videoSignatureInitialState = {
13099
13103
  stopRecording: function stopRecording() {
13100
13104
  return null;
13101
13105
  },
13106
+ clearRecordedData: function clearRecordedData() {
13107
+ return null;
13108
+ },
13109
+ isRecording: false,
13102
13110
  signatureData: null,
13103
13111
  signatureDataUrl: null,
13104
13112
  signatureVideoData: null,
@@ -13142,17 +13150,28 @@ function VideoSignatureContextProvider(_a) {
13142
13150
  startRecordingVideo = _k.startRecordingVideo,
13143
13151
  stopRecordingVideo = _k.stopRecordingVideo,
13144
13152
  startRecordingAudio = _k.startRecordingAudio,
13145
- stopRecordingAudio = _k.stopRecordingAudio;
13153
+ stopRecordingAudio = _k.stopRecordingAudio,
13154
+ clearRecordedVideoData = _k.clearRecordedData;
13146
13155
  var outputCanvas = React.useRef(null);
13147
13156
  var recordingLock = React.useRef(false);
13157
+ var onRecordingStopped = React.useRef(function () {});
13148
13158
  var _l = React.useState(false),
13149
13159
  isRecording = _l[0],
13150
13160
  setIsRecording = _l[1];
13151
13161
  var startRecording = React.useCallback(function () {
13152
- setIsRecording(true);
13162
+ return setIsRecording(true);
13153
13163
  }, []);
13154
13164
  var stopRecording = React.useCallback(function () {
13165
+ return setIsRecording(false);
13166
+ }, []);
13167
+ var clearRecordedData = React.useCallback(function () {
13168
+ var _a;
13169
+ recordingLock.current = false;
13170
+ onRecordingStopped.current = function () {
13171
+ return setIsRecording(true);
13172
+ };
13155
13173
  setIsRecording(false);
13174
+ (_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
13156
13175
  }, []);
13157
13176
  React.useEffect(function () {
13158
13177
  if (!isRecording) return;
@@ -13178,6 +13197,8 @@ function VideoSignatureContextProvider(_a) {
13178
13197
  _b.sent();
13179
13198
  _b.label = 2;
13180
13199
  case 2:
13200
+ recordedChunks.current = [];
13201
+ clearRecordedVideoData();
13181
13202
  startRecordingVideo();
13182
13203
  if (captureAudio) startRecordingAudio();
13183
13204
  stream = outputCanvas.current.captureStream(24 /* fps */);
@@ -13202,13 +13223,14 @@ function VideoSignatureContextProvider(_a) {
13202
13223
  });
13203
13224
  setSignatureVideoData(blob);
13204
13225
  setSignatureVideoUrl(URL.createObjectURL(blob));
13226
+ onRecordingStopped.current();
13205
13227
  };
13206
13228
  return [2 /*return*/];
13207
13229
  }
13208
13230
  });
13209
13231
  });
13210
13232
  })();
13211
- }, [audioStream, captureAudio, isRecording, startRecordingAudio, startRecordingVideo]);
13233
+ }, [audioStream, captureAudio, clearRecordedVideoData, isRecording, startRecordingAudio, startRecordingVideo]);
13212
13234
  var animationFrame = React.useRef(0);
13213
13235
  React.useEffect(function () {
13214
13236
  if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
@@ -13265,8 +13287,10 @@ function VideoSignatureContextProvider(_a) {
13265
13287
  }, [stopRecordingAudio, stopRecordingVideo]);
13266
13288
  var value = React.useMemo(function () {
13267
13289
  return {
13290
+ isRecording: isRecording,
13268
13291
  startRecording: startRecording,
13269
13292
  stopRecording: stopRecording,
13293
+ clearRecordedData: clearRecordedData,
13270
13294
  signaturePad: signaturePad,
13271
13295
  signatureData: signatureData,
13272
13296
  signatureDataUrl: signatureDataUrl,
@@ -13274,7 +13298,7 @@ function VideoSignatureContextProvider(_a) {
13274
13298
  signatureVideoUrl: signatureVideoUrl,
13275
13299
  onAcceptClicked: onAcceptClicked
13276
13300
  };
13277
- }, [onAcceptClicked, signatureData, signatureDataUrl, signatureVideoData, signatureVideoUrl, startRecording, stopRecording]);
13301
+ }, [clearRecordedData, isRecording, onAcceptClicked, signatureData, signatureDataUrl, signatureVideoData, signatureVideoUrl, startRecording, stopRecording]);
13278
13302
  return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureContext.Provider, {
13279
13303
  value: value
13280
13304
  }, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
@@ -13290,24 +13314,27 @@ function useVideoSignatureContext() {
13290
13314
  }
13291
13315
 
13292
13316
  function VideoSignatureGuides(_a) {
13293
- var _b;
13294
- var _c = _a.requestedAction,
13295
- requestedAction = _c === void 0 ? 'VERIFY_LIVENESS' : _c,
13296
- _d = _a.faceGuideStatus,
13297
- faceGuideStatus = _d === void 0 ? 'success' : _d,
13317
+ var _b = _a.requestedAction,
13318
+ requestedAction = _b === void 0 ? 'VERIFY_LIVENESS' : _b,
13319
+ _c = _a.faceGuideStatus,
13320
+ faceGuideStatus = _c === void 0 ? 'success' : _c,
13298
13321
  faceGuideBorderWidth = _a.faceGuideBorderWidth,
13299
13322
  faceGuideBorderColor = _a.faceGuideBorderColor,
13300
- _e = _a.classNames,
13301
- classNames = _e === void 0 ? {} : _e,
13302
- _f = _a.verbiage,
13303
- rawVerbiage = _f === void 0 ? {} : _f;
13304
- var _g = useResizeObserver(),
13305
- ref = _g.ref,
13306
- width = _g.width,
13307
- height = _g.height;
13308
- var _h = useVideoSignatureContext(),
13309
- signaturePad = _h.signaturePad,
13310
- onAcceptClicked = _h.onAcceptClicked;
13323
+ onClearSignaturePadClicked = _a.onClearSignaturePadClicked,
13324
+ _d = _a.classNames,
13325
+ classNames = _d === void 0 ? {} : _d,
13326
+ _e = _a.verbiage,
13327
+ rawVerbiage = _e === void 0 ? {} : _e;
13328
+ var _f = useResizeObserver(),
13329
+ ref = _f.ref,
13330
+ width = _f.width,
13331
+ height = _f.height;
13332
+ var _g = useVideoSignatureContext(),
13333
+ signaturePad = _g.signaturePad,
13334
+ onAcceptClicked = _g.onAcceptClicked;
13335
+ var _h = React.useState(true),
13336
+ isSignaturePadEmpty = _h[0],
13337
+ setIsSignaturePadEmpty = _h[1];
13311
13338
  var verbiage = useTranslations(rawVerbiage, {
13312
13339
  clearSignatureBtnText: 'Clear',
13313
13340
  acceptSignatureBtnText: 'Accept'
@@ -13341,19 +13368,28 @@ function VideoSignatureGuides(_a) {
13341
13368
  className: classNames.signatureCanvasInner
13342
13369
  }, /*#__PURE__*/React__namespace.default.createElement(SignatureCanvas__default.default, {
13343
13370
  ref: signaturePad,
13344
- canvasProps: canvasProps
13371
+ canvasProps: canvasProps,
13372
+ onEnd: function onEnd() {
13373
+ var _a;
13374
+ setIsSignaturePadEmpty(!!((_a = signaturePad === null || signaturePad === void 0 ? void 0 : signaturePad.current) === null || _a === void 0 ? void 0 : _a.isEmpty()));
13375
+ }
13345
13376
  })), /*#__PURE__*/React__namespace.default.createElement(SignatureButtonsContainer, {
13346
13377
  className: classNames.signatureButtonsRow
13347
13378
  }, /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
13348
13379
  variant: "secondary",
13349
13380
  className: classNames.clearSignatureBtn,
13350
- onClick: (_b = signaturePad === null || signaturePad === void 0 ? void 0 : signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
13381
+ onClick: function onClick() {
13382
+ var _a, _b;
13383
+ (_a = signaturePad === null || signaturePad === void 0 ? void 0 : signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
13384
+ setIsSignaturePadEmpty(!!((_b = signaturePad === null || signaturePad === void 0 ? void 0 : signaturePad.current) === null || _b === void 0 ? void 0 : _b.isEmpty()));
13385
+ onClearSignaturePadClicked === null || onClearSignaturePadClicked === void 0 ? void 0 : onClearSignaturePadClicked();
13386
+ },
13351
13387
  disabled: requestedAction === 'VERIFY_LIVENESS',
13352
13388
  finished: true
13353
13389
  }, verbiage.clearSignatureBtnText), /*#__PURE__*/React__namespace.default.createElement(AcceptBtn, {
13354
13390
  variant: "positive",
13355
13391
  className: classNames.acceptSignatureBtn,
13356
- disabled: requestedAction === 'VERIFY_LIVENESS',
13392
+ disabled: requestedAction === 'VERIFY_LIVENESS' || isSignaturePadEmpty,
13357
13393
  onClick: onAcceptClicked,
13358
13394
  finished: true
13359
13395
  }, verbiage.acceptSignatureBtnText))))));
@@ -13377,30 +13413,32 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13377
13413
  var onVideoCaptured = _a.onVideoCaptured,
13378
13414
  onFaceNotDetected = _a.onFaceNotDetected,
13379
13415
  onExit = _a.onExit,
13416
+ _c = _a.restartVideoOnSignaturePadCleared,
13417
+ restartVideoOnSignaturePadCleared = _c === void 0 ? true : _c,
13380
13418
  guidesComponent = _a.guidesComponent,
13381
- _c = _a.classNames,
13382
- classNames = _c === void 0 ? {} : _c,
13383
- _d = _a.colors,
13384
- colors = _d === void 0 ? {} : _d,
13385
- _e = _a.verbiage,
13386
- rawVerbiage = _e === void 0 ? {} : _e,
13387
- _f = _a.debugMode,
13388
- debugMode = _f === void 0 ? false : _f;
13419
+ _d = _a.classNames,
13420
+ classNames = _d === void 0 ? {} : _d,
13421
+ _e = _a.colors,
13422
+ colors = _e === void 0 ? {} : _e,
13423
+ _f = _a.verbiage,
13424
+ rawVerbiage = _f === void 0 ? {} : _f,
13425
+ _g = _a.debugMode,
13426
+ debugMode = _g === void 0 ? false : _g;
13389
13427
  var camera = useCameraStore(function (state) {
13390
13428
  return state.camera;
13391
13429
  });
13392
13430
  var onPredictionMade = React.useContext(SelfieGuidanceModelsContext).onPredictionMade;
13393
- var _g = useVideoSignatureContext(),
13394
- signatureData = _g.signatureData,
13395
- signatureDataUrl = _g.signatureDataUrl,
13396
- signatureVideoData = _g.signatureVideoData,
13397
- startRecording = _g.startRecording,
13398
- stopRecording = _g.stopRecording;
13431
+ var _h = useVideoSignatureContext(),
13432
+ signatureData = _h.signatureData,
13433
+ signatureDataUrl = _h.signatureDataUrl,
13434
+ signatureVideoData = _h.signatureVideoData,
13435
+ startRecording = _h.startRecording,
13436
+ stopRecording = _h.stopRecording,
13437
+ clearRecordedData = _h.clearRecordedData,
13438
+ isRecording = _h.isRecording;
13399
13439
  React.useEffect(function () {
13400
13440
  startRecording();
13401
- return function () {
13402
- stopRecording();
13403
- };
13441
+ return stopRecording;
13404
13442
  }, [startRecording, stopRecording]);
13405
13443
  colors.guidanceMessageBackgroundColor || (colors.guidanceMessageBackgroundColor = '#ccc');
13406
13444
  colors.guidanceMessageTextColor || (colors.guidanceMessageTextColor = 'black');
@@ -13412,9 +13450,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13412
13450
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
13413
13451
  }
13414
13452
  }, [onVideoCaptured, signatureData, signatureDataUrl, signatureVideoData]);
13415
- var _h = React.useState(0),
13416
- numFramesWithoutFaces = _h[0],
13417
- setNumFramesWithoutFaces = _h[1];
13453
+ var _j = React.useState(0),
13454
+ numFramesWithoutFaces = _j[0],
13455
+ setNumFramesWithoutFaces = _j[1];
13418
13456
  React.useEffect(function () {
13419
13457
  onPredictionMade(function (_a) {
13420
13458
  var face = _a.face;
@@ -13439,9 +13477,10 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
13439
13477
  "$background": colors.guidanceMessageBackgroundColor,
13440
13478
  "$textColor": colors.guidanceMessageTextColor
13441
13479
  }, verbiage.guidanceMessageText))), /*#__PURE__*/React__namespace.default.createElement(GuidesComponent, {
13480
+ status: "success",
13442
13481
  classNames: classNames.videoSignatureGuidesClassNames,
13443
- status: "success"
13444
- }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", camera === null || camera === void 0 ? void 0 : camera.width, "x", camera === null || camera === void 0 ? void 0 : camera.height)), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
13482
+ onClearSignaturePadClicked: restartVideoOnSignaturePadCleared ? clearRecordedData : undefined
13483
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", camera === null || camera === void 0 ? void 0 : camera.width, "x", camera === null || camera === void 0 ? void 0 : camera.height, /*#__PURE__*/React__namespace.default.createElement("br", null), "Recording: ", isRecording ? 'true' : 'false')), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
13445
13484
  onClick: onExit,
13446
13485
  className: classNames.exitCaptureBtn
13447
13486
  }));
@@ -13520,37 +13559,30 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13520
13559
  captureAudio = _e === void 0 ? false : _e,
13521
13560
  _f = _a.allowSignatureAfterLivenessCheckFailure,
13522
13561
  allowSignatureAfterLivenessCheckFailure = _f === void 0 ? false : _f,
13562
+ _g = _a.restartVideoOnSignaturePadCleared,
13563
+ restartVideoOnSignaturePadCleared = _g === void 0 ? true : _g,
13523
13564
  faceLivenessProps = _a.faceLivenessProps,
13524
- _g = _a.assets,
13525
- assets = _g === void 0 ? {} : _g,
13526
- _h = _a.classNames,
13527
- classNames = _h === void 0 ? {} : _h,
13528
- _j = _a.colors,
13529
- colors = _j === void 0 ? {} : _j,
13530
- _k = _a.verbiage,
13531
- verbiage = _k === void 0 ? {} : _k,
13532
- _l = _a.debugMode,
13533
- debugMode = _l === void 0 ? false : _l;
13534
- var _m = React.useContext(SubmissionContext),
13535
- selfieImage = _m.selfieImage,
13536
- setSelfieImage = _m.setSelfieImage,
13537
- setSignatureData = _m.setSignatureData,
13538
- setSignatureVideoUrl = _m.setSignatureVideoUrl,
13539
- logSelfieCaptureAttempt = _m.logSelfieCaptureAttempt;
13540
- var _o = useCameraStore(shallow.useShallow(function (state) {
13541
- return {
13542
- cameraAccessDenied: state.cameraAccessDenied,
13543
- requestCameraAccess: state.requestCameraAccess,
13544
- releaseCameraAccess: state.releaseCameraAccess,
13545
- requestMicrophoneAccess: state.requestMicrophoneAccess,
13546
- releaseMicrophoneAccess: state.releaseMicrophoneAccess
13547
- };
13548
- })),
13549
- cameraAccessDenied = _o.cameraAccessDenied,
13550
- requestCameraAccess = _o.requestCameraAccess,
13551
- releaseCameraAccess = _o.releaseCameraAccess,
13552
- requestMicrophoneAccess = _o.requestMicrophoneAccess,
13553
- releaseMicrophoneAccess = _o.releaseMicrophoneAccess;
13565
+ _h = _a.assets,
13566
+ assets = _h === void 0 ? {} : _h,
13567
+ _j = _a.classNames,
13568
+ classNames = _j === void 0 ? {} : _j,
13569
+ _k = _a.colors,
13570
+ colors = _k === void 0 ? {} : _k,
13571
+ _l = _a.verbiage,
13572
+ verbiage = _l === void 0 ? {} : _l,
13573
+ _m = _a.debugMode,
13574
+ debugMode = _m === void 0 ? false : _m;
13575
+ var _o = React.useContext(SubmissionContext),
13576
+ selfieImage = _o.selfieImage,
13577
+ setSelfieImage = _o.setSelfieImage,
13578
+ setSignatureData = _o.setSignatureData,
13579
+ setSignatureVideoUrl = _o.setSignatureVideoUrl,
13580
+ logSelfieCaptureAttempt = _o.logSelfieCaptureAttempt;
13581
+ var cameraAccessDenied = useCameraStore(shallow.useShallow(function (state) {
13582
+ return {
13583
+ cameraAccessDenied: state.cameraAccessDenied
13584
+ };
13585
+ })).cameraAccessDenied;
13554
13586
  var _p = React.useState('CHECKING_LIVENESS'),
13555
13587
  captureState = _p[0],
13556
13588
  setCaptureState = _p[1];
@@ -13611,21 +13643,13 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13611
13643
  var _s = React.useState(0),
13612
13644
  attempt = _s[0],
13613
13645
  setAttempt = _s[1];
13614
- var onExit = React.useCallback(function () {
13615
- releaseCameraAccess();
13616
- releaseMicrophoneAccess();
13646
+ var onRetry = React.useCallback(function () {
13647
+ onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
13617
13648
  setAttempt(function (n) {
13618
13649
  return n + 1;
13619
13650
  });
13620
13651
  setCaptureState('CHECKING_LIVENESS');
13621
- onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
13622
- void requestCameraAccess();
13623
- if (captureAudio) void requestMicrophoneAccess();
13624
- }, [captureAudio, onExitCapture, releaseCameraAccess, releaseMicrophoneAccess, requestCameraAccess, requestMicrophoneAccess]);
13625
- var onRetry = React.useCallback(function () {
13626
- onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
13627
- onExit();
13628
- }, [onExit, onRetryClicked]);
13652
+ }, [onRetryClicked]);
13629
13653
  var showSuccessScreen = useShowSuccessScreen(skipSuccessScreen, captureState === 'SUCCESS', onComplete);
13630
13654
  React.useEffect(function () {
13631
13655
  if (cameraAccessDenied) {
@@ -13635,14 +13659,12 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13635
13659
  setCaptureState('CHECKING_LIVENESS');
13636
13660
  }
13637
13661
  }, [cameraAccessDenied]);
13638
- var guidesComponent = React.useCallback(function (_a) {
13639
- var status = _a.status;
13640
- return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureGuides, {
13662
+ var guidesComponent = React.useCallback(function (props) {
13663
+ return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizardGuides, _assign({}, props, {
13641
13664
  classNames: classNames === null || classNames === void 0 ? void 0 : classNames.videoSignatureGuidesClassNames,
13642
- faceGuideStatus: status,
13643
- requestedAction: status === 'success' ? 'CAPTURE_SIGNATURE' : 'VERIFY_LIVENESS'
13644
- });
13645
- }, [classNames === null || classNames === void 0 ? void 0 : classNames.videoSignatureGuidesClassNames]);
13665
+ restartVideoOnSignaturePadCleared: restartVideoOnSignaturePadCleared
13666
+ }));
13667
+ }, [classNames === null || classNames === void 0 ? void 0 : classNames.videoSignatureGuidesClassNames, restartVideoOnSignaturePadCleared]);
13646
13668
  var onExitAfterFailureProp = faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onExitAfterFailure;
13647
13669
  var onExitAfterFailure = React.useCallback(function (resp, req) {
13648
13670
  onExitAfterFailureProp === null || onExitAfterFailureProp === void 0 ? void 0 : onExitAfterFailureProp(resp, req);
@@ -13668,7 +13690,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13668
13690
  key: "face-liveness-".concat(attempt)
13669
13691
  }, faceLivenessProps, {
13670
13692
  onSuccess: onFaceCaptureSuccess,
13671
- onExitCapture: onExit,
13693
+ onExitCapture: onExitCapture,
13672
13694
  onUserCancel: onUserCancel,
13673
13695
  onExitAfterFailure: onExitAfterFailure,
13674
13696
  onLoadingOverlayDismissed: onLoadingOverlayDismissedCallback,
@@ -13680,14 +13702,14 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13680
13702
  colors: colors.faceLiveness,
13681
13703
  verbiage: verbiage.faceLiveness,
13682
13704
  debugMode: debugMode,
13683
- releaseCameraAccessOnExit: false,
13684
13705
  renderCameraFeed: false
13685
13706
  }));
13686
13707
  case 'CAPTURING_SIGNATURE':
13687
13708
  return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureCapture, {
13688
13709
  onVideoCaptured: onSignatureCaptureCompleted,
13689
13710
  onFaceNotDetected: onSignatureCaptureFacesNotDetected,
13690
- onExit: onExit,
13711
+ onExit: onExitCapture,
13712
+ restartVideoOnSignaturePadCleared: restartVideoOnSignaturePadCleared,
13691
13713
  guidesComponent: guidesComponent,
13692
13714
  classNames: classNames,
13693
13715
  colors: colors,
@@ -13709,6 +13731,49 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
13709
13731
  }
13710
13732
  }()));
13711
13733
  };
13734
+ function VideoSignatureWizardGuides(_a) {
13735
+ var status = _a.status,
13736
+ classNames = _a.classNames,
13737
+ _b = _a.restartVideoOnSignaturePadCleared,
13738
+ restartVideoOnSignaturePadCleared = _b === void 0 ? true : _b;
13739
+ var clearRecordedData = useVideoSignatureContext().clearRecordedData;
13740
+ return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureGuides, {
13741
+ classNames: classNames,
13742
+ faceGuideStatus: status,
13743
+ requestedAction: status === 'success' ? 'CAPTURE_SIGNATURE' : 'VERIFY_LIVENESS',
13744
+ onClearSignaturePadClicked: restartVideoOnSignaturePadCleared ? clearRecordedData : undefined
13745
+ });
13746
+ }
13747
+ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProviders(props) {
13748
+ var _a = React.useState(0),
13749
+ attempts = _a[0],
13750
+ setAttempts = _a[1];
13751
+ var onRetryClickedProp = props.onRetryClicked;
13752
+ var onRetryClicked = React.useCallback(function () {
13753
+ setAttempts(function (n) {
13754
+ return n + 1;
13755
+ });
13756
+ onRetryClickedProp === null || onRetryClickedProp === void 0 ? void 0 : onRetryClickedProp();
13757
+ }, [onRetryClickedProp]);
13758
+ return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
13759
+ key: "camera-store-".concat(attempts),
13760
+ preferIphoneContinuityCamera: false,
13761
+ preferFrontFacingCamera: true,
13762
+ requireMicrophoneAccess: props.captureAudio,
13763
+ maxVideoWidth: 1280,
13764
+ maxFps: 30,
13765
+ onCameraAccessDenied: props.onCameraAccessDenied,
13766
+ onMicrophoneAccessDenied: props.onMicrophoneAccessDenied
13767
+ }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
13768
+ autoStart: false,
13769
+ throttleMs: 250,
13770
+ onModelError: props.onModelError,
13771
+ modelLoadTimeoutMs: props.modelLoadTimeoutMs,
13772
+ requireVerticalFaceCentering: false
13773
+ }, /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizard, _assign({}, props, {
13774
+ onRetryClicked: onRetryClicked
13775
+ }))));
13776
+ };
13712
13777
 
13713
13778
  var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
13714
13779
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
@@ -14982,23 +15047,11 @@ function CompositeWizard(_a) {
14982
15047
  onAccept: onSignatureCaptureSuccess
14983
15048
  }));
14984
15049
  case 'VideoSignatureCapture':
14985
- return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
14986
- preferIphoneContinuityCamera: false,
14987
- preferFrontFacingCamera: true,
14988
- requireMicrophoneAccess: videoSignatureCaptureProps.captureAudio,
14989
- maxVideoWidth: 1280,
14990
- maxFps: 30,
15050
+ return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizardWithProviders, _assign({}, videoSignatureCaptureProps, {
15051
+ onComplete: onVideoSignatureComplete,
14991
15052
  onCameraAccessDenied: onCameraAccessDenied,
14992
15053
  onMicrophoneAccessDenied: onMicrophoneAccessDenied
14993
- }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
14994
- autoStart: false,
14995
- throttleMs: 250,
14996
- onModelError: videoSignatureCaptureProps.onModelError,
14997
- modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs,
14998
- requireVerticalFaceCentering: false
14999
- }, /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizard, _assign({}, videoSignatureCaptureProps, {
15000
- onComplete: onVideoSignatureComplete
15001
- }))));
15054
+ }));
15002
15055
  case 'AdditionalDocumentCapture':
15003
15056
  return /*#__PURE__*/React__namespace.default.createElement(AdditionalDocumentCaptureWizard, _assign({}, additionalDocumentCaptureProps, {
15004
15057
  documents: documents,
@@ -17315,16 +17368,18 @@ var SignatureKYC = function SignatureKYC(_a) {
17315
17368
  modelLoadTimeoutMs = _f === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _f,
17316
17369
  _g = _a.allowSignatureAfterLivenessCheckFailure,
17317
17370
  allowSignatureAfterLivenessCheckFailure = _g === void 0 ? false : _g,
17371
+ _h = _a.restartVideoOnSignaturePadCleared,
17372
+ restartVideoOnSignaturePadCleared = _h === void 0 ? true : _h,
17318
17373
  faceLivenessProps = _a.faceLivenessProps,
17319
- _h = _a.theme,
17320
- theme = _h === void 0 ? 'default' : _h,
17374
+ _j = _a.theme,
17375
+ theme = _j === void 0 ? 'default' : _j,
17321
17376
  classNames = _a.classNames,
17322
17377
  colors = _a.colors,
17323
17378
  verbiage = _a.verbiage,
17324
17379
  geolocationEnabled = _a.geolocationEnabled,
17325
17380
  geolocationRequired = _a.geolocationRequired,
17326
- _j = _a.debugMode,
17327
- debugMode = _j === void 0 ? false : _j;
17381
+ _k = _a.debugMode,
17382
+ debugMode = _k === void 0 ? false : _k;
17328
17383
  useLanguage(lang);
17329
17384
  useDebugLogging(debugMode);
17330
17385
  return /*#__PURE__*/React__namespace.default.createElement(AuthProvider, {
@@ -17368,6 +17423,7 @@ var SignatureKYC = function SignatureKYC(_a) {
17368
17423
  modelLoadTimeoutMs: modelLoadTimeoutMs,
17369
17424
  faceLivenessProps: faceLivenessProps,
17370
17425
  allowSignatureAfterLivenessCheckFailure: allowSignatureAfterLivenessCheckFailure,
17426
+ restartVideoOnSignaturePadCleared: restartVideoOnSignaturePadCleared,
17371
17427
  classNames: classNames,
17372
17428
  colors: colors,
17373
17429
  debugMode: debugMode,
@@ -17375,7 +17431,7 @@ var SignatureKYC = function SignatureKYC(_a) {
17375
17431
  onModelError: onModelError,
17376
17432
  onUserCancel: onUserCancel
17377
17433
  };
17378
- }, [customOverlayContent, onLoadingOverlayDismissed, loadingOverlayMode, skipSuccessScreen, captureAudio, modelLoadTimeoutMs, faceLivenessProps, allowSignatureAfterLivenessCheckFailure, classNames, colors, debugMode, verbiage, onModelError, onUserCancel])
17434
+ }, [customOverlayContent, onLoadingOverlayDismissed, loadingOverlayMode, skipSuccessScreen, captureAudio, modelLoadTimeoutMs, faceLivenessProps, allowSignatureAfterLivenessCheckFailure, restartVideoOnSignaturePadCleared, classNames, colors, debugMode, verbiage, onModelError, onUserCancel])
17379
17435
  }))));
17380
17436
  };
17381
17437