idmission-web-sdk 0.0.52 → 0.0.53

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.
@@ -12570,7 +12570,7 @@ var initialState$1 = {
12570
12570
  frame: null,
12571
12571
  face: null,
12572
12572
  imageUrl: null,
12573
- requestState: 'NOT_READY',
12573
+ requestState: 'CAPTURING',
12574
12574
  requestError: null,
12575
12575
  unverifiedTimes: 0
12576
12576
  };
@@ -12578,10 +12578,10 @@ var reducer$1 = function reducer(state, action) {
12578
12578
  switch (action.type) {
12579
12579
  case 'verificationReady':
12580
12580
  {
12581
- var allowedStates = ['NOT_READY', 'ERROR'];
12581
+ var allowedStates = ['CAPTURING', 'ERROR'];
12582
12582
  if (allowedStates.includes(state.requestState)) {
12583
12583
  return tslib.__assign(tslib.__assign({}, state), {
12584
- requestState: 'READY',
12584
+ requestState: 'CAPTURED',
12585
12585
  frame: action.payload.frame,
12586
12586
  face: action.payload.face
12587
12587
  });
@@ -12591,7 +12591,7 @@ var reducer$1 = function reducer(state, action) {
12591
12591
  }
12592
12592
  case 'verifying':
12593
12593
  return tslib.__assign(tslib.__assign({}, state), {
12594
- requestState: 'IN_PROGRESS',
12594
+ requestState: 'VERIFYING',
12595
12595
  imageUrl: action.payload.imageUrl
12596
12596
  });
12597
12597
  case 'verificationCompleted':
@@ -12610,14 +12610,14 @@ var reducer$1 = function reducer(state, action) {
12610
12610
  }
12611
12611
  var requestState = state.requestState,
12612
12612
  unverifiedTimes = state.unverifiedTimes;
12613
- var customerMatched = resultData.verificationResultCode === '46';
12613
+ var customerMatched = resultData.verificationResultCode === '00';
12614
12614
  if (customerMatched) {
12615
- requestState = 'FOUND';
12615
+ requestState = 'VERIFIED';
12616
12616
  } else if (unverifiedTimes < 2) {
12617
- requestState = 'READY';
12617
+ requestState = 'CAPTURING';
12618
12618
  unverifiedTimes += 1;
12619
12619
  } else {
12620
- requestState = 'NOT_FOUND';
12620
+ requestState = 'REJECTED';
12621
12621
  }
12622
12622
  return tslib.__assign(tslib.__assign({}, state), {
12623
12623
  requestState: requestState,
@@ -12667,7 +12667,7 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12667
12667
  }
12668
12668
  });
12669
12669
  }, []);
12670
- var isReady = state.requestState === 'READY';
12670
+ var isReady = state.requestState === 'CAPTURED';
12671
12671
  React.useEffect(function () {
12672
12672
  if (!frame || !face) return;
12673
12673
  var imageUrl = cropToShoulders(frame, face);
@@ -12720,13 +12720,13 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12720
12720
  }, [isReady, onCustomerMatched, onCustomerNotMatched, selfieImage, state.requestState, submit]);
12721
12721
  React.useEffect(function () {
12722
12722
  if (!submissionResponse) return;
12723
- if (state.requestState === 'FOUND') {
12723
+ if (state.requestState === 'VERIFIED') {
12724
12724
  onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(submissionResponse);
12725
- } else if (state.requestState === 'NOT_FOUND') {
12725
+ } else if (state.requestState === 'REJECTED') {
12726
12726
  onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
12727
12727
  }
12728
12728
  }, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
12729
- useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IN_PROGRESS');
12729
+ useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['VERIFIED', 'REJECTED'].includes(state.requestState), state.requestState === 'VERIFYING');
12730
12730
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
12731
12731
  onSelfieCaptured: onSelfieCaptured,
12732
12732
  onExit: onExit,
@@ -12856,6 +12856,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12856
12856
  var _g = React.useState('LOADING'),
12857
12857
  captureState = _g[0],
12858
12858
  setCaptureState = _g[1];
12859
+ var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
12859
12860
  var onCustomerMatchedCallback = React.useCallback(function (response) {
12860
12861
  return tslib.__awaiter(void 0, void 0, void 0, function () {
12861
12862
  return tslib.__generator(this, function (_a) {
@@ -12891,6 +12892,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12891
12892
  switch (captureState) {
12892
12893
  case 'CAPTURING':
12893
12894
  return /*#__PURE__*/React__default['default'].createElement(CustomerVerificationCapture, {
12895
+ key: attempt,
12894
12896
  onCustomerMatched: onCustomerMatchedCallback,
12895
12897
  onCustomerNotMatched: onCustomerNotMatchedCallback,
12896
12898
  onCaptureGuidanceTimeout: onCaptureGuidanceTimeoutCallback,
@@ -12907,6 +12909,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12907
12909
  doneBtnText: verbiage.successDoneBtnText,
12908
12910
  imageUrl: "data:image/png;base64, ".concat(selfieImage),
12909
12911
  onDoneClick: function onDoneClick() {
12912
+ releaseCameraAccess();
12910
12913
  submissionResponse && (onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse));
12911
12914
  },
12912
12915
  onRetryClick: function onRetryClick() {
@@ -12920,7 +12923,10 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12920
12923
  exitBtnText: verbiage === null || verbiage === void 0 ? void 0 : verbiage.failureExitBtnText,
12921
12924
  imageUrl: assets.failureImageUrl,
12922
12925
  canRetry: false,
12923
- onExitClick: onExitAfterFailure
12926
+ onExitClick: function onExitClick() {
12927
+ releaseCameraAccess();
12928
+ onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure();
12929
+ }
12924
12930
  });
12925
12931
  default:
12926
12932
  return null;
@@ -13001,7 +13007,7 @@ var initialState = {
13001
13007
  frame: null,
13002
13008
  face: null,
13003
13009
  imageUrl: null,
13004
- requestState: 'NOT_READY',
13010
+ requestState: 'CAPTURING',
13005
13011
  requestError: null,
13006
13012
  notFoundTimes: 0
13007
13013
  };
@@ -13009,10 +13015,10 @@ var reducer = function reducer(state, action) {
13009
13015
  switch (action.type) {
13010
13016
  case 'identificationReady':
13011
13017
  {
13012
- var allowedStates = ['NOT_READY', 'ERROR'];
13018
+ var allowedStates = ['CAPTURING', 'ERROR'];
13013
13019
  if (allowedStates.includes(state.requestState)) {
13014
13020
  return tslib.__assign(tslib.__assign({}, state), {
13015
- requestState: 'READY',
13021
+ requestState: 'CAPTURED',
13016
13022
  frame: action.payload.frame,
13017
13023
  face: action.payload.face
13018
13024
  });
@@ -13022,7 +13028,7 @@ var reducer = function reducer(state, action) {
13022
13028
  }
13023
13029
  case 'identifying':
13024
13030
  return tslib.__assign(tslib.__assign({}, state), {
13025
- requestState: 'IN_PROGRESS',
13031
+ requestState: 'IDENTIFYING',
13026
13032
  imageUrl: action.payload.imageUrl
13027
13033
  });
13028
13034
  case 'identificationCompleted':
@@ -13045,7 +13051,7 @@ var reducer = function reducer(state, action) {
13045
13051
  if (customerMatched) {
13046
13052
  requestState = 'FOUND';
13047
13053
  } else if (notFoundTimes < 2) {
13048
- requestState = 'READY';
13054
+ requestState = 'CAPTURING';
13049
13055
  notFoundTimes += 1;
13050
13056
  } else {
13051
13057
  requestState = 'NOT_FOUND';
@@ -13098,7 +13104,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13098
13104
  }, []);
13099
13105
  var frame = state.frame,
13100
13106
  face = state.face;
13101
- var isReady = state.requestState === 'READY';
13107
+ var isReady = state.requestState === 'CAPTURED';
13102
13108
  React.useEffect(function () {
13103
13109
  if (!frame || !face) return;
13104
13110
  var imageUrl = cropToShoulders(frame, face);
@@ -13157,7 +13163,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13157
13163
  onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
13158
13164
  }
13159
13165
  }, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
13160
- useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IN_PROGRESS');
13166
+ useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IDENTIFYING');
13161
13167
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
13162
13168
  onSelfieCaptured: onSelfieCaptured,
13163
13169
  onExit: onExit,
@@ -13287,6 +13293,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13287
13293
  var _g = React.useState('LOADING'),
13288
13294
  captureState = _g[0],
13289
13295
  setCaptureState = _g[1];
13296
+ var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
13290
13297
  var onCustomerMatchedCallback = React.useCallback(function (response) {
13291
13298
  return tslib.__awaiter(void 0, void 0, void 0, function () {
13292
13299
  return tslib.__generator(this, function (_a) {
@@ -13322,6 +13329,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13322
13329
  switch (captureState) {
13323
13330
  case 'CAPTURING':
13324
13331
  return /*#__PURE__*/React__default['default'].createElement(CustomerIdentificationCapture, {
13332
+ key: attempt,
13325
13333
  onCustomerMatched: onCustomerMatchedCallback,
13326
13334
  onCustomerNotMatched: onCustomerNotMatchedCallback,
13327
13335
  onCaptureGuidanceTimeout: onCaptureGuidanceTimeoutCallback,
@@ -13338,6 +13346,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13338
13346
  doneBtnText: verbiage.successDoneBtnText,
13339
13347
  imageUrl: "data:image/png;base64, ".concat(selfieImage),
13340
13348
  onDoneClick: function onDoneClick() {
13349
+ releaseCameraAccess();
13341
13350
  submissionResponse && (onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse));
13342
13351
  },
13343
13352
  onRetryClick: function onRetryClick() {
@@ -13352,7 +13361,10 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13352
13361
  exitBtnText: verbiage === null || verbiage === void 0 ? void 0 : verbiage.failureExitBtnText,
13353
13362
  imageUrl: assets.failureImageUrl,
13354
13363
  canRetry: false,
13355
- onExitClick: onExitAfterFailure
13364
+ onExitClick: function onExitClick() {
13365
+ releaseCameraAccess();
13366
+ onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure();
13367
+ }
13356
13368
  });
13357
13369
  default:
13358
13370
  return null;