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.
package/dist/sdk2.esm.js CHANGED
@@ -14,7 +14,7 @@ import LanguageDetector from 'i18next-browser-languagedetector';
14
14
  import i18n from 'i18next';
15
15
  import SignatureCanvas from 'react-signature-canvas';
16
16
 
17
- var webSdkVersion = '2.1.8';
17
+ var webSdkVersion = '2.1.9';
18
18
 
19
19
  function getPlatform() {
20
20
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -458,7 +458,8 @@ var SessionIdMissingOverlay = function SessionIdMissingOverlay() {
458
458
  }, "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.")));
459
459
  };
460
460
 
461
- var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
461
+ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay(_a) {
462
+ var message = _a.message;
462
463
  return /*#__PURE__*/React__default.createElement(OverlayContainer, null, /*#__PURE__*/React__default.createElement(OverlayInner$2, {
463
464
  style: {
464
465
  justifyContent: 'center'
@@ -471,7 +472,7 @@ var SessionValidationFailedOverlay = function SessionValidationFailedOverlay() {
471
472
  style: {
472
473
  marginBottom: 0
473
474
  }
474
- }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "sessionId"), " is not valid."), /*#__PURE__*/React__default.createElement("p", {
475
+ }, "Required property ", /*#__PURE__*/React__default.createElement("code", null, "sessionId"), " is not valid", message && " (".concat(message, ")"), "."), /*#__PURE__*/React__default.createElement("p", {
475
476
  style: {
476
477
  lineHeight: '1.5rem'
477
478
  }
@@ -579,7 +580,7 @@ var Spinner = styled.div(templateObject_1$D || (templateObject_1$D = __makeTempl
579
580
  var templateObject_1$D;
580
581
 
581
582
  var defaultAuthUrl = 'https://portal-api.idmission.com';
582
- 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'];
583
+ 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'];
583
584
  var initialState$5 = {
584
585
  authUrl: defaultAuthUrl,
585
586
  sessionCheckState: 'READY'
@@ -597,6 +598,7 @@ var reducer$5 = function reducer(state, action) {
597
598
  sessionCheckState: action.payload
598
599
  });
599
600
  case 'setError':
601
+ console.log('setting error', action.payload);
600
602
  return __assign(__assign({}, state), {
601
603
  sessionCheckState: 'ERROR',
602
604
  authError: action.payload
@@ -661,11 +663,11 @@ function useAuthReducer(authUrl, sessionId) {
661
663
  });
662
664
  (function () {
663
665
  return __awaiter(_this, void 0, void 0, function () {
664
- var resp, valid, e_1;
665
- return __generator(this, function (_a) {
666
- switch (_a.label) {
666
+ var resp, _a, valid, message, e_1;
667
+ return __generator(this, function (_b) {
668
+ switch (_b.label) {
667
669
  case 0:
668
- _a.trys.push([0, 3,, 4]);
670
+ _b.trys.push([0, 3,, 4]);
669
671
  return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
670
672
  method: 'POST',
671
673
  headers: {
@@ -676,17 +678,23 @@ function useAuthReducer(authUrl, sessionId) {
676
678
  })
677
679
  })];
678
680
  case 1:
679
- resp = _a.sent();
681
+ resp = _b.sent();
680
682
  return [4 /*yield*/, resp.json()];
681
683
  case 2:
682
- valid = _a.sent().valid;
684
+ _a = _b.sent(), valid = _a.valid, message = _a.message;
685
+ if (!resp.ok) {
686
+ dispatch({
687
+ type: 'setError',
688
+ payload: new SessionValidationFailedError(new Error(message), authUrl)
689
+ });
690
+ }
683
691
  dispatch({
684
692
  type: 'setCheckState',
685
693
  payload: valid ? 'PASSED' : 'FAILED'
686
694
  });
687
695
  return [3 /*break*/, 4];
688
696
  case 3:
689
- e_1 = _a.sent();
697
+ e_1 = _b.sent();
690
698
  dispatch({
691
699
  type: 'setError',
692
700
  payload: new SessionValidationFailedError(e_1, authUrl)
@@ -709,18 +717,21 @@ function useAuthContext() {
709
717
  return [state, dispatch];
710
718
  }
711
719
  function AuthProvider(_a) {
712
- var _b = _a.authUrl,
713
- authUrl = _b === void 0 ? defaultAuthUrl : _b,
720
+ var _b;
721
+ var _c = _a.authUrl,
722
+ authUrl = _c === void 0 ? defaultAuthUrl : _c,
714
723
  sessionId = _a.sessionId,
715
724
  children = _a.children;
716
- var _c = useAuthReducer(authUrl, sessionId),
717
- state = _c[0],
718
- dispatch = _c[1];
725
+ var _d = useAuthReducer(authUrl, sessionId),
726
+ state = _d[0],
727
+ dispatch = _d[1];
719
728
  if (state.sessionCheckState === 'MISSING') {
720
729
  return /*#__PURE__*/React__default.createElement(SessionIdMissingOverlay, null);
721
730
  }
722
731
  if (state.sessionCheckState === 'FAILED') {
723
- return /*#__PURE__*/React__default.createElement(SessionValidationFailedOverlay, null);
732
+ return /*#__PURE__*/React__default.createElement(SessionValidationFailedOverlay, {
733
+ message: (_b = state.authError) === null || _b === void 0 ? void 0 : _b.message
734
+ });
724
735
  }
725
736
  if (state.sessionCheckState === 'AUTH_URL_NOT_ALLOWED') {
726
737
  return /*#__PURE__*/React__default.createElement(AuthUrlNotAllowedOverlay, null);