idmission-web-sdk 2.1.8 → 2.1.10

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.
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
- export declare const SessionValidationFailedOverlay: () => React.JSX.Element;
2
+ export declare const SessionValidationFailedOverlay: ({ message, }: {
3
+ message?: string | undefined;
4
+ }) => React.JSX.Element;
@@ -49,7 +49,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
49
49
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
50
50
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
51
51
 
52
- var webSdkVersion = '2.1.8';
52
+ var webSdkVersion = '2.1.10';
53
53
 
54
54
  function getPlatform() {
55
55
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -493,7 +493,8 @@ var SessionIdMissingOverlay = function SessionIdMissingOverlay() {
493
493
  }, "Getting Started"), ' ', "section of the documentation for information on how to use your credentials to generate a valid session for your IDmission account. Every usage of the IDmission WebSDK must be authorized with a valid session from IDmission's servers.")));
494
494
  };
495
495
 
496
- var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
496
+ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay(_a) {
497
+ var message = _a.message;
497
498
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
498
499
  style: {
499
500
  justifyContent: 'center'
@@ -506,7 +507,7 @@ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
506
507
  style: {
507
508
  marginBottom: 0
508
509
  }
509
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is not valid."), /*#__PURE__*/React__default['default'].createElement("p", {
510
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is not valid", message && " (".concat(message, ")"), "."), /*#__PURE__*/React__default['default'].createElement("p", {
510
511
  style: {
511
512
  lineHeight: '1.5rem'
512
513
  }
@@ -614,7 +615,7 @@ var Spinner = styled__default['default'].div(templateObject_1$D || (templateObje
614
615
  var templateObject_1$D;
615
616
 
616
617
  var defaultAuthUrl = 'https://portal-api.idmission.com';
617
- var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
618
+ var allowedAuthUrls = ['https://portal-2-dev-fargate.idmission.com', 'https://portal-2-demo-fargate.idmission.com', 'https://portal-2-uat-fargate.idmission.com', 'https://portal-2-prod-fargate.idmission.com', 'https://portal2-api.idmission.com', 'https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
618
619
  var initialState$5 = {
619
620
  authUrl: defaultAuthUrl,
620
621
  sessionCheckState: 'READY'
@@ -682,7 +683,6 @@ function useAuthReducer(authUrl, sessionId) {
682
683
  payload: sessionId
683
684
  });
684
685
  })["catch"](function (e) {
685
- console.error('failed to resolve session id', e);
686
686
  dispatch({
687
687
  type: 'setError',
688
688
  payload: new SessionValidationFailedError(e, authUrl)
@@ -696,11 +696,11 @@ function useAuthReducer(authUrl, sessionId) {
696
696
  });
697
697
  (function () {
698
698
  return tslib.__awaiter(_this, void 0, void 0, function () {
699
- var resp, valid, e_1;
700
- return tslib.__generator(this, function (_a) {
701
- switch (_a.label) {
699
+ var resp, _a, valid, message, e_1;
700
+ return tslib.__generator(this, function (_b) {
701
+ switch (_b.label) {
702
702
  case 0:
703
- _a.trys.push([0, 3,, 4]);
703
+ _b.trys.push([0, 3,, 4]);
704
704
  return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
705
705
  method: 'POST',
706
706
  headers: {
@@ -711,17 +711,23 @@ function useAuthReducer(authUrl, sessionId) {
711
711
  })
712
712
  })];
713
713
  case 1:
714
- resp = _a.sent();
714
+ resp = _b.sent();
715
715
  return [4 /*yield*/, resp.json()];
716
716
  case 2:
717
- valid = _a.sent().valid;
717
+ _a = _b.sent(), valid = _a.valid, message = _a.message;
718
+ if (!resp.ok) {
719
+ dispatch({
720
+ type: 'setError',
721
+ payload: new SessionValidationFailedError(new Error(message), authUrl)
722
+ });
723
+ }
718
724
  dispatch({
719
725
  type: 'setCheckState',
720
726
  payload: valid ? 'PASSED' : 'FAILED'
721
727
  });
722
728
  return [3 /*break*/, 4];
723
729
  case 3:
724
- e_1 = _a.sent();
730
+ e_1 = _b.sent();
725
731
  dispatch({
726
732
  type: 'setError',
727
733
  payload: new SessionValidationFailedError(e_1, authUrl)
@@ -744,18 +750,21 @@ function useAuthContext() {
744
750
  return [state, dispatch];
745
751
  }
746
752
  function AuthProvider(_a) {
747
- var _b = _a.authUrl,
748
- authUrl = _b === void 0 ? defaultAuthUrl : _b,
753
+ var _b;
754
+ var _c = _a.authUrl,
755
+ authUrl = _c === void 0 ? defaultAuthUrl : _c,
749
756
  sessionId = _a.sessionId,
750
757
  children = _a.children;
751
- var _c = useAuthReducer(authUrl, sessionId),
752
- state = _c[0],
753
- dispatch = _c[1];
758
+ var _d = useAuthReducer(authUrl, sessionId),
759
+ state = _d[0],
760
+ dispatch = _d[1];
754
761
  if (state.sessionCheckState === 'MISSING') {
755
762
  return /*#__PURE__*/React__default['default'].createElement(SessionIdMissingOverlay, null);
756
763
  }
757
764
  if (state.sessionCheckState === 'FAILED') {
758
- return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, null);
765
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, {
766
+ message: (_b = state.authError) === null || _b === void 0 ? void 0 : _b.message
767
+ });
759
768
  }
760
769
  if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
761
770
  return /*#__PURE__*/React__default['default'].createElement(AuthUrlNotAllowedOverlay, null);
@@ -1336,7 +1345,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1336
1345
  }
1337
1346
  });
1338
1347
  });
1339
- }, [action, additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, companyId, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, expectedAudioText, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idCaptureVideoAudioStartsAt, idCaptureVideoAudioUrl, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idFrontCaptureAttempts, idFrontImage, idImageResolutionCheck, manualReviewRequired, needImmediateResponse, onBeforeSubmit, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureVideoUrl, uploadDocument, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters]);
1348
+ }, [additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, clientRequestID, companyId, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, expectedAudioText, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idCaptureVideoAudioStartsAt, idCaptureVideoAudioUrl, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idFrontCaptureAttempts, idFrontImage, idImageResolutionCheck, manualReviewRequired, needImmediateResponse, onBeforeSubmit, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureVideoUrl, uploadDocument, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters]);
1340
1349
  var defaultOnSubmit = React.useCallback(function () {
1341
1350
  return tslib.__awaiter(void 0, void 0, void 0, function () {
1342
1351
  var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
@@ -1535,7 +1544,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1535
1544
  }
1536
1545
  });
1537
1546
  });
1538
- }, [webhooksStripSpecialCharacters, idCardForFaceMatch, selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, onBeforeLivenessCheck, submissionUrl, environment, sessionId, onRequestFailure]);
1547
+ }, [webhooksStripSpecialCharacters, clientRequestID, idCardForFaceMatch, selfieCaptureAttempts, idFrontCaptureAttempts, idBackCaptureAttempts, geolocationResult, onBeforeLivenessCheck, submissionUrl, environment, sessionId, sendBase64DocumentsInSwaggerProxy, onRequestFailure]);
1539
1548
  var retryLocationAccess = React.useCallback(function () {
1540
1549
  setGeolocationAttempts(function (n) {
1541
1550
  return n + 1;
@@ -7445,7 +7454,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7445
7454
  });
7446
7455
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
7447
7456
  requestCameraAccess();
7448
- }, [dispatch, onExitCapture, releaseCameraAccess]);
7457
+ }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
7449
7458
  React.useEffect(function () {
7450
7459
  if (submissionStatus !== SubmissionStatus.READY) {
7451
7460
  releaseCameraAccessOnExit && releaseCameraAccess();