idmission-web-sdk 2.1.8 → 2.1.9

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.9';
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'
@@ -632,6 +633,7 @@ var reducer$5 = function reducer(state, action) {
632
633
  sessionCheckState: action.payload
633
634
  });
634
635
  case 'setError':
636
+ console.log('setting error', action.payload);
635
637
  return tslib.__assign(tslib.__assign({}, state), {
636
638
  sessionCheckState: 'ERROR',
637
639
  authError: action.payload
@@ -696,11 +698,11 @@ function useAuthReducer(authUrl, sessionId) {
696
698
  });
697
699
  (function () {
698
700
  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) {
701
+ var resp, _a, valid, message, e_1;
702
+ return tslib.__generator(this, function (_b) {
703
+ switch (_b.label) {
702
704
  case 0:
703
- _a.trys.push([0, 3,, 4]);
705
+ _b.trys.push([0, 3,, 4]);
704
706
  return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
705
707
  method: 'POST',
706
708
  headers: {
@@ -711,17 +713,23 @@ function useAuthReducer(authUrl, sessionId) {
711
713
  })
712
714
  })];
713
715
  case 1:
714
- resp = _a.sent();
716
+ resp = _b.sent();
715
717
  return [4 /*yield*/, resp.json()];
716
718
  case 2:
717
- valid = _a.sent().valid;
719
+ _a = _b.sent(), valid = _a.valid, message = _a.message;
720
+ if (!resp.ok) {
721
+ dispatch({
722
+ type: 'setError',
723
+ payload: new SessionValidationFailedError(new Error(message), authUrl)
724
+ });
725
+ }
718
726
  dispatch({
719
727
  type: 'setCheckState',
720
728
  payload: valid ? 'PASSED' : 'FAILED'
721
729
  });
722
730
  return [3 /*break*/, 4];
723
731
  case 3:
724
- e_1 = _a.sent();
732
+ e_1 = _b.sent();
725
733
  dispatch({
726
734
  type: 'setError',
727
735
  payload: new SessionValidationFailedError(e_1, authUrl)
@@ -744,18 +752,21 @@ function useAuthContext() {
744
752
  return [state, dispatch];
745
753
  }
746
754
  function AuthProvider(_a) {
747
- var _b = _a.authUrl,
748
- authUrl = _b === void 0 ? defaultAuthUrl : _b,
755
+ var _b;
756
+ var _c = _a.authUrl,
757
+ authUrl = _c === void 0 ? defaultAuthUrl : _c,
749
758
  sessionId = _a.sessionId,
750
759
  children = _a.children;
751
- var _c = useAuthReducer(authUrl, sessionId),
752
- state = _c[0],
753
- dispatch = _c[1];
760
+ var _d = useAuthReducer(authUrl, sessionId),
761
+ state = _d[0],
762
+ dispatch = _d[1];
754
763
  if (state.sessionCheckState === 'MISSING') {
755
764
  return /*#__PURE__*/React__default['default'].createElement(SessionIdMissingOverlay, null);
756
765
  }
757
766
  if (state.sessionCheckState === 'FAILED') {
758
- return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, null);
767
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, {
768
+ message: (_b = state.authError) === null || _b === void 0 ? void 0 : _b.message
769
+ });
759
770
  }
760
771
  if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
761
772
  return /*#__PURE__*/React__default['default'].createElement(AuthUrlNotAllowedOverlay, null);