idmission-web-sdk 1.0.344 → 1.0.346

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.
@@ -2,7 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { SelfieCaptureClassNames, SelfieCaptureColors, SelfieCaptureVerbiage } from '../selfie_capture/SelfieCapture';
3
3
  import { SelfieProgressPreviewClassNames } from '../common/SelfieProgressPreview';
4
4
  import { CustomerSuppliedVerbiage } from '../../lib/locales';
5
- import { SelfieCaptureLoadingOverlayProps } from "../selfie_capture/SelfieCaptureLoadingOverlay";
5
+ import { SelfieCaptureLoadingOverlayProps } from '../selfie_capture/SelfieCaptureLoadingOverlay';
6
6
  export type FaceLivenessCaptureClassNames = SelfieCaptureClassNames & {
7
7
  imagePreview?: SelfieProgressPreviewClassNames;
8
8
  };
@@ -1,7 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { CustomerSuppliedVerbiage } from '../../lib/locales';
3
3
  import { LoaderButtonColors } from '../common/LoaderButton';
4
- import { SelfieCaptureLoadingOverlayProps } from "../selfie_capture/SelfieCaptureLoadingOverlay";
4
+ import { SelfieCaptureLoadingOverlayProps } from '../selfie_capture/SelfieCaptureLoadingOverlay';
5
5
  export type SelfieCaptureFallbackClassNames = {
6
6
  container?: string;
7
7
  inner?: string;
@@ -33,4 +33,4 @@ export type SelfieCaptureFallbackProps = {
33
33
  silentFallback?: boolean;
34
34
  selfieCaptureLoadingOverlayProps?: SelfieCaptureLoadingOverlayProps;
35
35
  };
36
- export declare const SelfieCaptureFallback: ({ onFinished, onCapture, classNames, colors, verbiage: rawVerbiage, silentFallback, selfieCaptureLoadingOverlayProps: overlayProps }: SelfieCaptureFallbackProps) => ReactElement;
36
+ export declare const SelfieCaptureFallback: ({ onFinished, onCapture, classNames, colors, verbiage: rawVerbiage, silentFallback, selfieCaptureLoadingOverlayProps: overlayProps, }: SelfieCaptureFallbackProps) => ReactElement;
@@ -50,7 +50,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
50
50
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
51
51
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
52
52
 
53
- var webSdkVersion = '1.0.344';
53
+ var webSdkVersion = '1.0.346';
54
54
 
55
55
  function getPlatform() {
56
56
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -14190,6 +14190,7 @@ var SelfieCaptureFallback = function SelfieCaptureFallback(_a) {
14190
14190
  var _a;
14191
14191
  var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
14192
14192
  if (!file) return;
14193
+ setImage('LOADING'); // this is to reduce some of the flicker - it isn't perfect since .readAsDataURL is slow
14193
14194
  var reader = new FileReader();
14194
14195
  reader.addEventListener('load', function (e) {
14195
14196
  var _a;
@@ -14214,6 +14215,7 @@ var SelfieCaptureFallback = function SelfieCaptureFallback(_a) {
14214
14215
  }
14215
14216
  });
14216
14217
  }
14218
+ // todo: JN - we might be able to use the media stream instead if we clone it - as it stands today, we hae to use the camera to support iOS 16 devices
14217
14219
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("input", {
14218
14220
  ref: fileInput,
14219
14221
  type: "file",
@@ -14241,7 +14243,7 @@ var SelfieCaptureFallback = function SelfieCaptureFallback(_a) {
14241
14243
  className: classNames.heading
14242
14244
  }, verbiage.headingText), /*#__PURE__*/React__default['default'].createElement(Description$1, {
14243
14245
  className: classNames.description
14244
- }, verbiage.descriptionText))), image && ( /*#__PURE__*/React__default['default'].createElement(ImageContainer$5, {
14246
+ }, verbiage.descriptionText))), image && image !== 'LOADING' && ( /*#__PURE__*/React__default['default'].createElement(ImageContainer$5, {
14245
14247
  className: classNames.imageContainer
14246
14248
  }, /*#__PURE__*/React__default['default'].createElement("img", {
14247
14249
  src: image,
@@ -14530,6 +14532,9 @@ var initialState$2 = {
14530
14532
  phoneDetected: false,
14531
14533
  timesLivenessCheckFailed: 0
14532
14534
  };
14535
+ /** todo: JN - this feels like it should be hoisted up to the wizard because these states of failed and error dovetail into those in the wizard.
14536
+ * There may also be some crossing of wires in how error/failed are used.
14537
+ */
14533
14538
  var reducer$2 = function reducer(state, action) {
14534
14539
  var _a, _b;
14535
14540
  switch (action.type) {
@@ -14693,21 +14698,28 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
14693
14698
  var onFallbackImageCaptured = React.useCallback(function (imageUrl) {
14694
14699
  return tslib.__awaiter(void 0, void 0, void 0, function () {
14695
14700
  var imageData, response, e_2;
14696
- return tslib.__generator(this, function (_a) {
14697
- switch (_a.label) {
14701
+ var _a;
14702
+ return tslib.__generator(this, function (_b) {
14703
+ switch (_b.label) {
14698
14704
  case 0:
14699
14705
  dispatch({
14700
14706
  type: 'livenessChecking'
14701
14707
  });
14702
- _a.label = 1;
14708
+ _b.label = 1;
14703
14709
  case 1:
14704
- _a.trys.push([1, 4,, 5]);
14710
+ _b.trys.push([1, 4,, 5]);
14705
14711
  return [4 /*yield*/, dataUrlToBase64(imageUrl)];
14706
14712
  case 2:
14707
- imageData = _a.sent();
14708
- return [4 /*yield*/, checkLiveness(imageData)];
14713
+ imageData = _b.sent();
14714
+ return [4 /*yield*/, checkLiveness(imageData)
14715
+ // todo: JN - this feels dirty and is the reason for the todo around line 83 - but is necessary to handle fallback liveness validation
14716
+ ];
14709
14717
  case 3:
14710
- response = _a.sent();
14718
+ response = _b.sent();
14719
+ // todo: JN - this feels dirty and is the reason for the todo around line 83 - but is necessary to handle fallback liveness validation
14720
+ if (((_a = response === null || response === void 0 ? void 0 : response.resultData) === null || _a === void 0 ? void 0 : _a.verificationResult) !== 'Live Face Detected') {
14721
+ onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
14722
+ }
14711
14723
  dispatch({
14712
14724
  type: 'livenessChecked',
14713
14725
  payload: {
@@ -14717,7 +14729,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
14717
14729
  });
14718
14730
  return [3 /*break*/, 5];
14719
14731
  case 4:
14720
- e_2 = _a.sent();
14732
+ e_2 = _b.sent();
14721
14733
  dispatch({
14722
14734
  type: 'livenessCheckFailed',
14723
14735
  payload: {
@@ -14730,7 +14742,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
14730
14742
  }
14731
14743
  });
14732
14744
  });
14733
- }, [checkLiveness]);
14745
+ }, [checkLiveness, onTimeout]);
14734
14746
  React.useEffect(function () {
14735
14747
  if (isPassed && state.imageUrl) onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(state.imageUrl);
14736
14748
  }, [onSuccess, state.imageUrl, isPassed]);
@@ -14966,7 +14978,8 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
14966
14978
  });
14967
14979
  });
14968
14980
  }, [onSuccess, setSelfieImage, livenessCheckRequest, submissionResponse]);
14969
- var onTimeoutCallback = React.useCallback(function () {
14981
+ // todo: JN - how this is being used, it would make sense to rename the prop as well, but that would be a breaking change - discuss
14982
+ var onFailureOrTimeout = React.useCallback(function () {
14970
14983
  setCaptureState('FAILED');
14971
14984
  onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(submissionResponse, livenessCheckRequest);
14972
14985
  }, [onTimeout, livenessCheckRequest, submissionResponse]);
@@ -15011,7 +15024,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
15011
15024
  key: "capture".concat(attempt),
15012
15025
  onCapture: onCapture,
15013
15026
  onSuccess: onSuccessCallback,
15014
- onTimeout: onTimeoutCallback,
15027
+ onTimeout: onFailureOrTimeout,
15015
15028
  onExit: onExitCallback,
15016
15029
  timeoutDurationMs: timeoutDurationMs,
15017
15030
  silentFallback: silentFallback,