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.
@@ -140,7 +140,7 @@
140
140
  return cooked;
141
141
  }
142
142
 
143
- var webSdkVersion = '2.1.8';
143
+ var webSdkVersion = '2.1.9';
144
144
 
145
145
  function getPlatform() {
146
146
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -857,7 +857,8 @@
857
857
  }, "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.")));
858
858
  };
859
859
 
860
- var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
860
+ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay(_a) {
861
+ var message = _a.message;
861
862
  return /*#__PURE__*/React__default['default'].createElement(OverlayContainer, null, /*#__PURE__*/React__default['default'].createElement(OverlayInner$2, {
862
863
  style: {
863
864
  justifyContent: 'center'
@@ -870,7 +871,7 @@
870
871
  style: {
871
872
  marginBottom: 0
872
873
  }
873
- }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is not valid."), /*#__PURE__*/React__default['default'].createElement("p", {
874
+ }, "Required property ", /*#__PURE__*/React__default['default'].createElement("code", null, "sessionId"), " is not valid", message && " (".concat(message, ")"), "."), /*#__PURE__*/React__default['default'].createElement("p", {
874
875
  style: {
875
876
  lineHeight: '1.5rem'
876
877
  }
@@ -978,7 +979,7 @@
978
979
  var templateObject_1$D;
979
980
 
980
981
  var defaultAuthUrl = 'https://portal-api.idmission.com';
981
- 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'];
982
+ 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'];
982
983
  var initialState$5 = {
983
984
  authUrl: defaultAuthUrl,
984
985
  sessionCheckState: 'READY'
@@ -996,6 +997,7 @@
996
997
  sessionCheckState: action.payload
997
998
  });
998
999
  case 'setError':
1000
+ console.log('setting error', action.payload);
999
1001
  return __assign$1(__assign$1({}, state), {
1000
1002
  sessionCheckState: 'ERROR',
1001
1003
  authError: action.payload
@@ -1060,11 +1062,11 @@
1060
1062
  });
1061
1063
  (function () {
1062
1064
  return __awaiter(_this, void 0, void 0, function () {
1063
- var resp, valid, e_1;
1064
- return __generator(this, function (_a) {
1065
- switch (_a.label) {
1065
+ var resp, _a, valid, message, e_1;
1066
+ return __generator(this, function (_b) {
1067
+ switch (_b.label) {
1066
1068
  case 0:
1067
- _a.trys.push([0, 3,, 4]);
1069
+ _b.trys.push([0, 3,, 4]);
1068
1070
  return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
1069
1071
  method: 'POST',
1070
1072
  headers: {
@@ -1075,17 +1077,23 @@
1075
1077
  })
1076
1078
  })];
1077
1079
  case 1:
1078
- resp = _a.sent();
1080
+ resp = _b.sent();
1079
1081
  return [4 /*yield*/, resp.json()];
1080
1082
  case 2:
1081
- valid = _a.sent().valid;
1083
+ _a = _b.sent(), valid = _a.valid, message = _a.message;
1084
+ if (!resp.ok) {
1085
+ dispatch({
1086
+ type: 'setError',
1087
+ payload: new SessionValidationFailedError(new Error(message), authUrl)
1088
+ });
1089
+ }
1082
1090
  dispatch({
1083
1091
  type: 'setCheckState',
1084
1092
  payload: valid ? 'PASSED' : 'FAILED'
1085
1093
  });
1086
1094
  return [3 /*break*/, 4];
1087
1095
  case 3:
1088
- e_1 = _a.sent();
1096
+ e_1 = _b.sent();
1089
1097
  dispatch({
1090
1098
  type: 'setError',
1091
1099
  payload: new SessionValidationFailedError(e_1, authUrl)
@@ -1108,18 +1116,21 @@
1108
1116
  return [state, dispatch];
1109
1117
  }
1110
1118
  function AuthProvider(_a) {
1111
- var _b = _a.authUrl,
1112
- authUrl = _b === void 0 ? defaultAuthUrl : _b,
1119
+ var _b;
1120
+ var _c = _a.authUrl,
1121
+ authUrl = _c === void 0 ? defaultAuthUrl : _c,
1113
1122
  sessionId = _a.sessionId,
1114
1123
  children = _a.children;
1115
- var _c = useAuthReducer(authUrl, sessionId),
1116
- state = _c[0],
1117
- dispatch = _c[1];
1124
+ var _d = useAuthReducer(authUrl, sessionId),
1125
+ state = _d[0],
1126
+ dispatch = _d[1];
1118
1127
  if (state.sessionCheckState === 'MISSING') {
1119
1128
  return /*#__PURE__*/React__default['default'].createElement(SessionIdMissingOverlay, null);
1120
1129
  }
1121
1130
  if (state.sessionCheckState === 'FAILED') {
1122
- return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, null);
1131
+ return /*#__PURE__*/React__default['default'].createElement(SessionValidationFailedOverlay, {
1132
+ message: (_b = state.authError) === null || _b === void 0 ? void 0 : _b.message
1133
+ });
1123
1134
  }
1124
1135
  if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
1125
1136
  return /*#__PURE__*/React__default['default'].createElement(AuthUrlNotAllowedOverlay, null);