@elliemae/pui-app-sdk 5.10.2 → 5.10.4

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.
@@ -42,6 +42,7 @@ let endSessionHandler = null;
42
42
  const onAuthorizationFailure = (callback) => {
43
43
  unAuthorizedFailureHandler = callback;
44
44
  };
45
+ const getEndSessionHandler = () => endSessionHandler;
45
46
  const setEndSessionHandler = (handler) => {
46
47
  endSessionHandler = handler;
47
48
  };
@@ -59,11 +60,10 @@ const handleFailure = (error) => {
59
60
  });
60
61
  }).catch((exception) => Promise.reject(exception));
61
62
  }
62
- if (endSessionHandler) {
63
- endSessionHandler({ ...(0, import_loginParams.getLoginParams)(), skipRevoke: true }).catch(
64
- () => {
65
- }
66
- );
63
+ const endSession = getEndSessionHandler();
64
+ if (endSession) {
65
+ endSession({ ...(0, import_loginParams.getLoginParams)(), skipRevoke: true }).catch(() => {
66
+ });
67
67
  }
68
68
  }
69
69
  return Promise.reject(error);
@@ -28,13 +28,11 @@ var import_actions = require("../../data/auth/actions.js");
28
28
  var import_auth = require("../../utils/auth/index.js");
29
29
  var import_micro_frontend = require("../../utils/micro-frontend/index.js");
30
30
  var import_log_records = require("../../utils/log-records.js");
31
- var import_response_interceptor = require("../../communication/http-client/response-interceptor.js");
32
31
  function* login({
33
32
  payload
34
33
  }) {
35
34
  try {
36
35
  yield (0, import_effects.call)(import_auth.authorize, payload);
37
- yield (0, import_effects.call)(import_response_interceptor.setEndSessionHandler, import_auth.endSession);
38
36
  yield (0, import_effects.put)({ type: import_actions.LOGIN_SUCCESS });
39
37
  } catch (err) {
40
38
  (0, import_micro_frontend.getLogger)().error({
@@ -38,6 +38,7 @@ var import_reducer = require("../data/auth/reducer.js");
38
38
  var import_auth = require("../sideeffect/auth/index.js");
39
39
  var import_login = require("./login/index.js");
40
40
  var import_auth2 = require("../utils/auth/index.js");
41
+ var import_response_interceptor = require("../communication/http-client/response-interceptor.js");
41
42
  const key = "auth";
42
43
  const RequireAuth = ({
43
44
  children,
@@ -51,6 +52,7 @@ const RequireAuth = ({
51
52
  reducer: import_reducer.authReducer,
52
53
  saga: import_auth.authentication
53
54
  });
55
+ (0, import_response_interceptor.setEndSessionHandler)(import_auth2.endSession);
54
56
  const userAuthorized = (0, import_auth2.isUserAuthorized)();
55
57
  if (userAuthorized) {
56
58
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
@@ -6,6 +6,7 @@ let endSessionHandler = null;
6
6
  const onAuthorizationFailure = (callback) => {
7
7
  unAuthorizedFailureHandler = callback;
8
8
  };
9
+ const getEndSessionHandler = () => endSessionHandler;
9
10
  const setEndSessionHandler = (handler) => {
10
11
  endSessionHandler = handler;
11
12
  };
@@ -23,11 +24,10 @@ const handleFailure = (error) => {
23
24
  });
24
25
  }).catch((exception) => Promise.reject(exception));
25
26
  }
26
- if (endSessionHandler) {
27
- endSessionHandler({ ...getLoginParams(), skipRevoke: true }).catch(
28
- () => {
29
- }
30
- );
27
+ const endSession = getEndSessionHandler();
28
+ if (endSession) {
29
+ endSession({ ...getLoginParams(), skipRevoke: true }).catch(() => {
30
+ });
31
31
  }
32
32
  }
33
33
  return Promise.reject(error);
@@ -11,13 +11,11 @@ import {
11
11
  import { authorize, endSession } from "../../utils/auth/index.js";
12
12
  import { getLogger } from "../../utils/micro-frontend/index.js";
13
13
  import { logRecords } from "../../utils/log-records.js";
14
- import { setEndSessionHandler } from "../../communication/http-client/response-interceptor.js";
15
14
  function* login({
16
15
  payload
17
16
  }) {
18
17
  try {
19
18
  yield call(authorize, payload);
20
- yield call(setEndSessionHandler, endSession);
21
19
  yield put({ type: LOGIN_SUCCESS });
22
20
  } catch (err) {
23
21
  getLogger().error({
@@ -4,7 +4,8 @@ import enums from "../utils/constants.js";
4
4
  import { authReducer } from "../data/auth/reducer.js";
5
5
  import { authentication } from "../sideeffect/auth/index.js";
6
6
  import { Login } from "./login/index.js";
7
- import { isUserAuthorized } from "../utils/auth/index.js";
7
+ import { endSession, isUserAuthorized } from "../utils/auth/index.js";
8
+ import { setEndSessionHandler } from "../communication/http-client/response-interceptor.js";
8
9
  const key = "auth";
9
10
  const RequireAuth = ({
10
11
  children,
@@ -18,6 +19,7 @@ const RequireAuth = ({
18
19
  reducer: authReducer,
19
20
  saga: authentication
20
21
  });
22
+ setEndSessionHandler(endSession);
21
23
  const userAuthorized = isUserAuthorized();
22
24
  if (userAuthorized) {
23
25
  return /* @__PURE__ */ jsx(Fragment, { children });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-app-sdk",
3
- "version": "5.10.2",
3
+ "version": "5.10.4",
4
4
  "description": "ICE MT UI Platform Application SDK ",
5
5
  "sideEffects": [
6
6
  "*.css",