idmission-web-sdk 0.0.52 → 0.0.54

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.
@@ -9554,10 +9554,11 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
9554
9554
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
9555
9555
  className: "flex"
9556
9556
  }, state.captureState !== CaptureState.COMPLETE && /*#__PURE__*/React__default['default'].createElement(CameraVideoTag, null), overlayDismissed && function () {
9557
+ var docCount = Object.keys(state.capturedDocuments).length;
9557
9558
  switch (state.requestedDocumentType) {
9558
9559
  case DocumentType.ID_CARD_FRONT:
9559
9560
  return /*#__PURE__*/React__default['default'].createElement(IdCapture, {
9560
- key: Object.keys(state.capturedDocuments).length,
9561
+ key: "capture".concat(docCount),
9561
9562
  requiredDocumentType: state.requestedDocumentType,
9562
9563
  autoCaptureEnabled: autoCaptureEnabled,
9563
9564
  autoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
@@ -9578,7 +9579,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
9578
9579
  });
9579
9580
  case DocumentType.ID_CARD_BACK:
9580
9581
  return /*#__PURE__*/React__default['default'].createElement(IdCapture, {
9581
- key: Object.keys(state.capturedDocuments).length,
9582
+ key: "capture".concat(docCount),
9582
9583
  requiredDocumentType: state.requestedDocumentType,
9583
9584
  autoCaptureEnabled: autoCaptureEnabled,
9584
9585
  autoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
@@ -9598,7 +9599,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
9598
9599
  });
9599
9600
  case DocumentType.PASSPORT:
9600
9601
  return /*#__PURE__*/React__default['default'].createElement(IdCapture, {
9601
- key: Object.keys(state.capturedDocuments).length,
9602
+ key: "capture".concat(docCount),
9602
9603
  requiredDocumentType: state.requestedDocumentType,
9603
9604
  autoCaptureEnabled: autoCaptureEnabled,
9604
9605
  autoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
@@ -10261,7 +10262,7 @@ var templateObject_1$2, templateObject_2$1, templateObject_3$1;
10261
10262
  var initialState$2 = {
10262
10263
  frame: null,
10263
10264
  face: null,
10264
- requestState: 'NOT_READY',
10265
+ requestState: 'CAPTURING',
10265
10266
  requestError: null,
10266
10267
  imageUrl: null,
10267
10268
  faceLive: false,
@@ -10275,10 +10276,10 @@ var reducer$2 = function reducer(state, action) {
10275
10276
  switch (action.type) {
10276
10277
  case 'livenessReady':
10277
10278
  {
10278
- var allowedStates = ['NOT_READY', 'FAILED', 'ERROR'];
10279
+ var allowedStates = ['CAPTURING', 'FAILED', 'ERROR'];
10279
10280
  if (allowedStates.includes(state.requestState)) {
10280
10281
  return tslib.__assign(tslib.__assign({}, state), {
10281
- requestState: 'READY',
10282
+ requestState: 'CAPTURED',
10282
10283
  frame: action.payload.frame,
10283
10284
  face: action.payload.face
10284
10285
  });
@@ -10371,7 +10372,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
10371
10372
  }, [onCapture]);
10372
10373
  var frame = state.frame,
10373
10374
  face = state.face;
10374
- var isReady = state.requestState === 'READY';
10375
+ var isReady = state.requestState === 'CAPTURED';
10375
10376
  var isPassed = state.requestState === 'PASSED';
10376
10377
  React.useEffect(function () {
10377
10378
  if (!frame || !face || !isReady) return;
@@ -10711,7 +10712,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10711
10712
  switch (captureState) {
10712
10713
  case 'CAPTURING':
10713
10714
  return /*#__PURE__*/React__default['default'].createElement(FaceLivenessCapture, {
10714
- key: "capture",
10715
+ key: "capture".concat(attempt),
10715
10716
  onCapture: onCapture,
10716
10717
  onSuccess: onSuccessCallback,
10717
10718
  onTimeout: onTimeoutCallback,
@@ -12570,7 +12571,7 @@ var initialState$1 = {
12570
12571
  frame: null,
12571
12572
  face: null,
12572
12573
  imageUrl: null,
12573
- requestState: 'NOT_READY',
12574
+ requestState: 'CAPTURING',
12574
12575
  requestError: null,
12575
12576
  unverifiedTimes: 0
12576
12577
  };
@@ -12578,10 +12579,10 @@ var reducer$1 = function reducer(state, action) {
12578
12579
  switch (action.type) {
12579
12580
  case 'verificationReady':
12580
12581
  {
12581
- var allowedStates = ['NOT_READY', 'ERROR'];
12582
+ var allowedStates = ['CAPTURING', 'ERROR'];
12582
12583
  if (allowedStates.includes(state.requestState)) {
12583
12584
  return tslib.__assign(tslib.__assign({}, state), {
12584
- requestState: 'READY',
12585
+ requestState: 'CAPTURED',
12585
12586
  frame: action.payload.frame,
12586
12587
  face: action.payload.face
12587
12588
  });
@@ -12591,7 +12592,7 @@ var reducer$1 = function reducer(state, action) {
12591
12592
  }
12592
12593
  case 'verifying':
12593
12594
  return tslib.__assign(tslib.__assign({}, state), {
12594
- requestState: 'IN_PROGRESS',
12595
+ requestState: 'VERIFYING',
12595
12596
  imageUrl: action.payload.imageUrl
12596
12597
  });
12597
12598
  case 'verificationCompleted':
@@ -12610,14 +12611,14 @@ var reducer$1 = function reducer(state, action) {
12610
12611
  }
12611
12612
  var requestState = state.requestState,
12612
12613
  unverifiedTimes = state.unverifiedTimes;
12613
- var customerMatched = resultData.verificationResultCode === '46';
12614
+ var customerMatched = resultData.verificationResultCode === '00';
12614
12615
  if (customerMatched) {
12615
- requestState = 'FOUND';
12616
+ requestState = 'VERIFIED';
12616
12617
  } else if (unverifiedTimes < 2) {
12617
- requestState = 'READY';
12618
+ requestState = 'CAPTURING';
12618
12619
  unverifiedTimes += 1;
12619
12620
  } else {
12620
- requestState = 'NOT_FOUND';
12621
+ requestState = 'REJECTED';
12621
12622
  }
12622
12623
  return tslib.__assign(tslib.__assign({}, state), {
12623
12624
  requestState: requestState,
@@ -12667,7 +12668,7 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12667
12668
  }
12668
12669
  });
12669
12670
  }, []);
12670
- var isReady = state.requestState === 'READY';
12671
+ var isReady = state.requestState === 'CAPTURED';
12671
12672
  React.useEffect(function () {
12672
12673
  if (!frame || !face) return;
12673
12674
  var imageUrl = cropToShoulders(frame, face);
@@ -12720,13 +12721,13 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12720
12721
  }, [isReady, onCustomerMatched, onCustomerNotMatched, selfieImage, state.requestState, submit]);
12721
12722
  React.useEffect(function () {
12722
12723
  if (!submissionResponse) return;
12723
- if (state.requestState === 'FOUND') {
12724
+ if (state.requestState === 'VERIFIED') {
12724
12725
  onCustomerMatched === null || onCustomerMatched === void 0 ? void 0 : onCustomerMatched(submissionResponse);
12725
- } else if (state.requestState === 'NOT_FOUND') {
12726
+ } else if (state.requestState === 'REJECTED') {
12726
12727
  onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
12727
12728
  }
12728
12729
  }, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
12729
- useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IN_PROGRESS');
12730
+ useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['VERIFIED', 'REJECTED'].includes(state.requestState), state.requestState === 'VERIFYING');
12730
12731
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
12731
12732
  onSelfieCaptured: onSelfieCaptured,
12732
12733
  onExit: onExit,
@@ -12856,6 +12857,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12856
12857
  var _g = React.useState('LOADING'),
12857
12858
  captureState = _g[0],
12858
12859
  setCaptureState = _g[1];
12860
+ var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
12859
12861
  var onCustomerMatchedCallback = React.useCallback(function (response) {
12860
12862
  return tslib.__awaiter(void 0, void 0, void 0, function () {
12861
12863
  return tslib.__generator(this, function (_a) {
@@ -12891,6 +12893,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12891
12893
  switch (captureState) {
12892
12894
  case 'CAPTURING':
12893
12895
  return /*#__PURE__*/React__default['default'].createElement(CustomerVerificationCapture, {
12896
+ key: "capture".concat(attempt),
12894
12897
  onCustomerMatched: onCustomerMatchedCallback,
12895
12898
  onCustomerNotMatched: onCustomerNotMatchedCallback,
12896
12899
  onCaptureGuidanceTimeout: onCaptureGuidanceTimeoutCallback,
@@ -12907,6 +12910,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12907
12910
  doneBtnText: verbiage.successDoneBtnText,
12908
12911
  imageUrl: "data:image/png;base64, ".concat(selfieImage),
12909
12912
  onDoneClick: function onDoneClick() {
12913
+ releaseCameraAccess();
12910
12914
  submissionResponse && (onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse));
12911
12915
  },
12912
12916
  onRetryClick: function onRetryClick() {
@@ -12920,7 +12924,10 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
12920
12924
  exitBtnText: verbiage === null || verbiage === void 0 ? void 0 : verbiage.failureExitBtnText,
12921
12925
  imageUrl: assets.failureImageUrl,
12922
12926
  canRetry: false,
12923
- onExitClick: onExitAfterFailure
12927
+ onExitClick: function onExitClick() {
12928
+ releaseCameraAccess();
12929
+ onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure();
12930
+ }
12924
12931
  });
12925
12932
  default:
12926
12933
  return null;
@@ -13001,7 +13008,7 @@ var initialState = {
13001
13008
  frame: null,
13002
13009
  face: null,
13003
13010
  imageUrl: null,
13004
- requestState: 'NOT_READY',
13011
+ requestState: 'CAPTURING',
13005
13012
  requestError: null,
13006
13013
  notFoundTimes: 0
13007
13014
  };
@@ -13009,10 +13016,10 @@ var reducer = function reducer(state, action) {
13009
13016
  switch (action.type) {
13010
13017
  case 'identificationReady':
13011
13018
  {
13012
- var allowedStates = ['NOT_READY', 'ERROR'];
13019
+ var allowedStates = ['CAPTURING', 'ERROR'];
13013
13020
  if (allowedStates.includes(state.requestState)) {
13014
13021
  return tslib.__assign(tslib.__assign({}, state), {
13015
- requestState: 'READY',
13022
+ requestState: 'CAPTURED',
13016
13023
  frame: action.payload.frame,
13017
13024
  face: action.payload.face
13018
13025
  });
@@ -13022,7 +13029,7 @@ var reducer = function reducer(state, action) {
13022
13029
  }
13023
13030
  case 'identifying':
13024
13031
  return tslib.__assign(tslib.__assign({}, state), {
13025
- requestState: 'IN_PROGRESS',
13032
+ requestState: 'IDENTIFYING',
13026
13033
  imageUrl: action.payload.imageUrl
13027
13034
  });
13028
13035
  case 'identificationCompleted':
@@ -13045,7 +13052,7 @@ var reducer = function reducer(state, action) {
13045
13052
  if (customerMatched) {
13046
13053
  requestState = 'FOUND';
13047
13054
  } else if (notFoundTimes < 2) {
13048
- requestState = 'READY';
13055
+ requestState = 'CAPTURING';
13049
13056
  notFoundTimes += 1;
13050
13057
  } else {
13051
13058
  requestState = 'NOT_FOUND';
@@ -13098,7 +13105,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13098
13105
  }, []);
13099
13106
  var frame = state.frame,
13100
13107
  face = state.face;
13101
- var isReady = state.requestState === 'READY';
13108
+ var isReady = state.requestState === 'CAPTURED';
13102
13109
  React.useEffect(function () {
13103
13110
  if (!frame || !face) return;
13104
13111
  var imageUrl = cropToShoulders(frame, face);
@@ -13157,7 +13164,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13157
13164
  onCustomerNotMatched === null || onCustomerNotMatched === void 0 ? void 0 : onCustomerNotMatched(submissionResponse);
13158
13165
  }
13159
13166
  }, [onCustomerMatched, onCustomerNotMatched, state.requestState, submissionResponse]);
13160
- useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IN_PROGRESS');
13167
+ useTimeout(captureGuidanceTimeoutDurationMs, onCaptureGuidanceTimeout, ['FOUND', 'NOT_FOUND'].includes(state.requestState), state.requestState === 'IDENTIFYING');
13161
13168
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
13162
13169
  onSelfieCaptured: onSelfieCaptured,
13163
13170
  onExit: onExit,
@@ -13287,6 +13294,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13287
13294
  var _g = React.useState('LOADING'),
13288
13295
  captureState = _g[0],
13289
13296
  setCaptureState = _g[1];
13297
+ var releaseCameraAccess = React.useContext(CameraStateContext).releaseCameraAccess;
13290
13298
  var onCustomerMatchedCallback = React.useCallback(function (response) {
13291
13299
  return tslib.__awaiter(void 0, void 0, void 0, function () {
13292
13300
  return tslib.__generator(this, function (_a) {
@@ -13322,6 +13330,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13322
13330
  switch (captureState) {
13323
13331
  case 'CAPTURING':
13324
13332
  return /*#__PURE__*/React__default['default'].createElement(CustomerIdentificationCapture, {
13333
+ key: "capture".concat(attempt),
13325
13334
  onCustomerMatched: onCustomerMatchedCallback,
13326
13335
  onCustomerNotMatched: onCustomerNotMatchedCallback,
13327
13336
  onCaptureGuidanceTimeout: onCaptureGuidanceTimeoutCallback,
@@ -13338,6 +13347,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13338
13347
  doneBtnText: verbiage.successDoneBtnText,
13339
13348
  imageUrl: "data:image/png;base64, ".concat(selfieImage),
13340
13349
  onDoneClick: function onDoneClick() {
13350
+ releaseCameraAccess();
13341
13351
  submissionResponse && (onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse));
13342
13352
  },
13343
13353
  onRetryClick: function onRetryClick() {
@@ -13352,7 +13362,10 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
13352
13362
  exitBtnText: verbiage === null || verbiage === void 0 ? void 0 : verbiage.failureExitBtnText,
13353
13363
  imageUrl: assets.failureImageUrl,
13354
13364
  canRetry: false,
13355
- onExitClick: onExitAfterFailure
13365
+ onExitClick: function onExitClick() {
13366
+ releaseCameraAccess();
13367
+ onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure();
13368
+ }
13356
13369
  });
13357
13370
  default:
13358
13371
  return null;