@elliemae/pui-app-sdk 5.10.0 → 5.10.2
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/cjs/api/auth/index.js +2 -2
- package/dist/cjs/communication/http-client/index.js +3 -6
- package/dist/cjs/communication/http-client/response-interceptor.js +24 -11
- package/dist/cjs/data/appMiddleware.js +1 -2
- package/dist/cjs/data/auth/actions.js +2 -2
- package/dist/cjs/data/queryMiddleware.js +1 -2
- package/dist/cjs/index.js +0 -1
- package/dist/cjs/sideeffect/auth/index.js +2 -0
- package/dist/cjs/sideeffect/error-toast/index.js +1 -2
- package/dist/cjs/sideeffect/wait-message/index.js +2 -4
- package/dist/cjs/utils/app-config/index.js +1 -2
- package/dist/cjs/utils/auth/index.js +24 -14
- package/dist/cjs/utils/auth/loginParams.js +29 -0
- package/dist/cjs/utils/auth/types.js +16 -0
- package/dist/cjs/utils/extendSession.js +47 -0
- package/dist/cjs/utils/log-records.js +4 -0
- package/dist/cjs/utils/micro-frontend/console-logger.js +1 -2
- package/dist/cjs/utils/micro-frontend/guest.js +5 -10
- package/dist/cjs/utils/micro-frontend/host.js +7 -14
- package/dist/cjs/utils/micro-frontend/index.js +4 -8
- package/dist/cjs/utils/micro-frontend/ssfguest-adapter.js +1 -2
- package/dist/cjs/utils/session.js +2 -3
- package/dist/cjs/utils/window.js +3 -6
- package/dist/cjs/view/error-toast/index.js +1 -2
- package/dist/cjs/view/fields/autocomplete/index.js +2 -4
- package/dist/cjs/view/fields/input-mask/index.js +2 -4
- package/dist/cjs/view/form/index.js +1 -2
- package/dist/cjs/view/login/index.js +2 -4
- package/dist/cjs/view/micro-app/app-factory/index.js +8 -16
- package/dist/cjs/view/micro-app/resources/manifest.js +1 -2
- package/dist/cjs/view/micro-app/resources/script.js +6 -12
- package/dist/cjs/view/micro-app/resources/style.js +3 -6
- package/dist/cjs/view/micro-app/use-app-will-render.js +6 -11
- package/dist/cjs/view/micro-app/utils.js +2 -4
- package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +2 -3
- package/dist/cjs/view/modals/session-expiry/index.js +3 -2
- package/dist/cjs/view/session-timeout/index.js +1 -2
- package/dist/cjs/view/wait-message/use-html-wait-message.js +1 -2
- package/dist/esm/api/auth/index.js +2 -2
- package/dist/esm/communication/http-client/index.js +3 -6
- package/dist/esm/communication/http-client/response-interceptor.js +24 -11
- package/dist/esm/data/appMiddleware.js +1 -2
- package/dist/esm/data/auth/actions.js +2 -2
- package/dist/esm/data/queryMiddleware.js +1 -2
- package/dist/esm/index.js +1 -3
- package/dist/esm/sideeffect/auth/index.js +2 -0
- package/dist/esm/sideeffect/error-toast/index.js +1 -2
- package/dist/esm/sideeffect/wait-message/index.js +2 -4
- package/dist/esm/utils/app-config/index.js +1 -2
- package/dist/esm/utils/auth/index.js +24 -14
- package/dist/esm/utils/auth/loginParams.js +9 -0
- package/dist/esm/utils/auth/types.js +0 -0
- package/dist/esm/utils/extendSession.js +27 -0
- package/dist/esm/utils/log-records.js +4 -0
- package/dist/esm/utils/micro-frontend/console-logger.js +1 -2
- package/dist/esm/utils/micro-frontend/guest.js +5 -10
- package/dist/esm/utils/micro-frontend/host.js +7 -14
- package/dist/esm/utils/micro-frontend/index.js +4 -8
- package/dist/esm/utils/micro-frontend/ssfguest-adapter.js +1 -2
- package/dist/esm/utils/session.js +2 -3
- package/dist/esm/utils/window.js +3 -6
- package/dist/esm/view/error-toast/index.js +1 -2
- package/dist/esm/view/fields/autocomplete/index.js +2 -4
- package/dist/esm/view/fields/input-mask/index.js +2 -4
- package/dist/esm/view/form/index.js +1 -2
- package/dist/esm/view/login/index.js +2 -4
- package/dist/esm/view/micro-app/app-factory/index.js +8 -16
- package/dist/esm/view/micro-app/resources/manifest.js +1 -2
- package/dist/esm/view/micro-app/resources/script.js +6 -12
- package/dist/esm/view/micro-app/resources/style.js +3 -6
- package/dist/esm/view/micro-app/use-app-will-render.js +6 -11
- package/dist/esm/view/micro-app/utils.js +2 -4
- package/dist/esm/view/micro-iframe-app/use-frame-loaded.js +2 -3
- package/dist/esm/view/modals/session-expiry/index.js +4 -6
- package/dist/esm/view/session-timeout/index.js +1 -2
- package/dist/esm/view/wait-message/use-html-wait-message.js +1 -2
- package/dist/types/lib/api/auth/index.d.ts +2 -2
- package/dist/types/lib/communication/http-client/response-interceptor.d.ts +2 -0
- package/dist/types/lib/data/auth/actions.d.ts +2 -2
- package/dist/types/lib/index.d.ts +2 -1
- package/dist/types/lib/utils/auth/index.d.ts +4 -9
- package/dist/types/lib/utils/auth/loginParams.d.ts +10 -0
- package/dist/types/lib/utils/auth/types.d.ts +8 -0
- package/dist/types/lib/utils/custom-hooks/use-state-selector.d.ts +0 -2
- package/dist/types/lib/utils/extendSession.d.ts +5 -0
- package/dist/types/lib/utils/log-records.d.ts +4 -0
- package/package.json +36 -36
|
@@ -25,7 +25,7 @@ __export(auth_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(auth_exports);
|
|
26
26
|
var import_http_client = require("../../communication/http-client/index.js");
|
|
27
27
|
const getToken = async ({
|
|
28
|
-
|
|
28
|
+
code,
|
|
29
29
|
clientId,
|
|
30
30
|
scope,
|
|
31
31
|
redirectUri
|
|
@@ -35,7 +35,7 @@ const getToken = async ({
|
|
|
35
35
|
params.append("client_id", clientId);
|
|
36
36
|
params.append("redirect_uri", redirectUri);
|
|
37
37
|
params.append("scope", scope);
|
|
38
|
-
params.append("code",
|
|
38
|
+
params.append("code", code);
|
|
39
39
|
const { data } = await (0, import_http_client.getHTTPClient)().post(
|
|
40
40
|
"/oauth2/v1/token",
|
|
41
41
|
params
|
|
@@ -47,14 +47,11 @@ const getHTTPClient = ({
|
|
|
47
47
|
baseURL,
|
|
48
48
|
headers
|
|
49
49
|
});
|
|
50
|
-
if (client?.defaults?.timeout)
|
|
51
|
-
client.defaults.timeout = REQUEST_TIMEOUT;
|
|
50
|
+
if (client?.defaults?.timeout) client.defaults.timeout = REQUEST_TIMEOUT;
|
|
52
51
|
(0, import_retry.default)(client);
|
|
53
52
|
const { request, response } = client?.interceptors || {};
|
|
54
|
-
if (request)
|
|
55
|
-
|
|
56
|
-
if (response)
|
|
57
|
-
response.use(import_response_interceptor.handleSuccess, import_response_interceptor.handleFailure);
|
|
53
|
+
if (request) request.use(import_request_interceptor.requestInterceptor);
|
|
54
|
+
if (response) response.use(import_response_interceptor.handleSuccess, import_response_interceptor.handleFailure);
|
|
58
55
|
return client;
|
|
59
56
|
};
|
|
60
57
|
const getAuthHTTPClient = ({
|
|
@@ -30,28 +30,41 @@ var response_interceptor_exports = {};
|
|
|
30
30
|
__export(response_interceptor_exports, {
|
|
31
31
|
handleFailure: () => handleFailure,
|
|
32
32
|
handleSuccess: () => handleSuccess,
|
|
33
|
-
onAuthorizationFailure: () => onAuthorizationFailure
|
|
33
|
+
onAuthorizationFailure: () => onAuthorizationFailure,
|
|
34
|
+
setEndSessionHandler: () => setEndSessionHandler
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(response_interceptor_exports);
|
|
36
37
|
var import_axios = __toESM(require("axios"));
|
|
38
|
+
var import_loginParams = require("../../utils/auth/loginParams.js");
|
|
37
39
|
const HTTP_UNAUTHORIZED = 401;
|
|
38
40
|
let unAuthorizedFailureHandler = null;
|
|
41
|
+
let endSessionHandler = null;
|
|
39
42
|
const onAuthorizationFailure = (callback) => {
|
|
40
43
|
unAuthorizedFailureHandler = callback;
|
|
41
44
|
};
|
|
45
|
+
const setEndSessionHandler = (handler) => {
|
|
46
|
+
endSessionHandler = handler;
|
|
47
|
+
};
|
|
42
48
|
const handleSuccess = (response) => response;
|
|
43
49
|
const handleFailure = (error) => {
|
|
44
50
|
const { status } = (error || {}).response || {};
|
|
45
|
-
if (status === HTTP_UNAUTHORIZED
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
throw error;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (status === HTTP_UNAUTHORIZED) {
|
|
52
|
+
if (unAuthorizedFailureHandler && typeof unAuthorizedFailureHandler === "function") {
|
|
53
|
+
return unAuthorizedFailureHandler(error).then((authorizationHeader) => {
|
|
54
|
+
const { config } = error;
|
|
55
|
+
if (!config?.headers) throw error;
|
|
56
|
+
config.headers["Authorization"] = authorizationHeader;
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
import_axios.default.request(config).then(resolve).catch(reject);
|
|
59
|
+
});
|
|
60
|
+
}).catch((exception) => Promise.reject(exception));
|
|
61
|
+
}
|
|
62
|
+
if (endSessionHandler) {
|
|
63
|
+
endSessionHandler({ ...(0, import_loginParams.getLoginParams)(), skipRevoke: true }).catch(
|
|
64
|
+
() => {
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
return Promise.reject(error);
|
|
57
70
|
};
|
|
@@ -39,8 +39,7 @@ const addMiddleware = ({
|
|
|
39
39
|
key,
|
|
40
40
|
middleware
|
|
41
41
|
}) => {
|
|
42
|
-
if (middlewareDispatchFns.has(key) || !store)
|
|
43
|
-
return;
|
|
42
|
+
if (middlewareDispatchFns.has(key) || !store) return;
|
|
44
43
|
middlewareDispatchFns.set(key, middleware(store));
|
|
45
44
|
};
|
|
46
45
|
const removeMiddleware = (key) => {
|
|
@@ -29,14 +29,14 @@ const LOGIN_SUCCESS = "auth/LOGIN_SUCCESS";
|
|
|
29
29
|
const LOGOUT = "auth/LOGOUT";
|
|
30
30
|
const auth = {
|
|
31
31
|
login: ({
|
|
32
|
-
|
|
32
|
+
code,
|
|
33
33
|
redirectUri,
|
|
34
34
|
clientId,
|
|
35
35
|
responseType,
|
|
36
36
|
scope
|
|
37
37
|
}) => ({
|
|
38
38
|
type: LOGIN,
|
|
39
|
-
payload: {
|
|
39
|
+
payload: { code, redirectUri, clientId, responseType, scope }
|
|
40
40
|
}),
|
|
41
41
|
logout: ({
|
|
42
42
|
clientId,
|
|
@@ -38,8 +38,7 @@ const addMiddleware = ({
|
|
|
38
38
|
reducerPath,
|
|
39
39
|
middleware
|
|
40
40
|
}) => {
|
|
41
|
-
if (middlewareDispatchFns.has(reducerPath) || !store)
|
|
42
|
-
return;
|
|
41
|
+
if (middlewareDispatchFns.has(reducerPath) || !store) return;
|
|
43
42
|
middlewareDispatchFns.set(reducerPath, middleware(store));
|
|
44
43
|
};
|
|
45
44
|
const removeMiddleware = (reducerPath) => {
|
package/dist/cjs/index.js
CHANGED
|
@@ -67,7 +67,6 @@ __export(lib_exports, {
|
|
|
67
67
|
TextBox: () => import_text_box.TextBox,
|
|
68
68
|
Themes: () => import_constants2.Themes,
|
|
69
69
|
Toggle: () => import_toggle.Toggle,
|
|
70
|
-
UseStateSelectorOptions: () => import_use_state_selector.UseStateSelectorOptions,
|
|
71
70
|
VisuallyHidden: () => import_visually_hidden.VisuallyHidden,
|
|
72
71
|
WaitMessage: () => import_wait_message.WaitMessage,
|
|
73
72
|
ariaLive: () => import_live_message.actions,
|
|
@@ -28,11 +28,13 @@ 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");
|
|
31
32
|
function* login({
|
|
32
33
|
payload
|
|
33
34
|
}) {
|
|
34
35
|
try {
|
|
35
36
|
yield (0, import_effects.call)(import_auth.authorize, payload);
|
|
37
|
+
yield (0, import_effects.call)(import_response_interceptor.setEndSessionHandler, import_auth.endSession);
|
|
36
38
|
yield (0, import_effects.put)({ type: import_actions.LOGIN_SUCCESS });
|
|
37
39
|
} catch (err) {
|
|
38
40
|
(0, import_micro_frontend.getLogger)().error({
|
|
@@ -33,8 +33,7 @@ function* openErrorToast(action) {
|
|
|
33
33
|
);
|
|
34
34
|
const host = yield (0, import_effects.call)(microApp.getHost.bind(microApp));
|
|
35
35
|
const message = action?.payload?.description || action?.payload?.messageText;
|
|
36
|
-
if (host && message)
|
|
37
|
-
yield (0, import_effects.call)(host.openErrorBanner.bind(host), message);
|
|
36
|
+
if (host && message) yield (0, import_effects.call)(host.openErrorBanner.bind(host), message);
|
|
38
37
|
} catch (ex) {
|
|
39
38
|
(0, import_micro_frontend.getLogger)().error({
|
|
40
39
|
...import_log_records.logRecords.ERR_TOAST_OPEN_FAILED,
|
|
@@ -32,8 +32,7 @@ function* openWaitMessage() {
|
|
|
32
32
|
import_guest.CMicroAppGuest.getInstance.bind(import_guest.CMicroAppGuest)
|
|
33
33
|
);
|
|
34
34
|
const host = yield (0, import_effects.call)(microApp.getHost.bind(microApp));
|
|
35
|
-
if (host)
|
|
36
|
-
yield (0, import_effects.call)(host.openWaitMessage.bind(host));
|
|
35
|
+
if (host) yield (0, import_effects.call)(host.openWaitMessage.bind(host));
|
|
37
36
|
} catch (ex) {
|
|
38
37
|
(0, import_micro_frontend.getLogger)().error({
|
|
39
38
|
...import_log_records.logRecords.WAIT_MSG_OPEN_FAILED,
|
|
@@ -47,8 +46,7 @@ function* closeWaitMessage() {
|
|
|
47
46
|
import_guest.CMicroAppGuest.getInstance.bind(import_guest.CMicroAppGuest)
|
|
48
47
|
);
|
|
49
48
|
const host = yield (0, import_effects.call)(microApp.getHost.bind(microApp));
|
|
50
|
-
if (host)
|
|
51
|
-
yield (0, import_effects.call)(host.closeWaitMessage.bind(host));
|
|
49
|
+
if (host) yield (0, import_effects.call)(host.closeWaitMessage.bind(host));
|
|
52
50
|
} catch (ex) {
|
|
53
51
|
(0, import_micro_frontend.getLogger)().error({
|
|
54
52
|
...import_log_records.logRecords.WAIT_MSG_CLOSE_FAILED,
|
|
@@ -41,8 +41,7 @@ var import_config2 = require("./config.js");
|
|
|
41
41
|
const parseAppConfig = (data) => {
|
|
42
42
|
const { activeEnv } = data;
|
|
43
43
|
const activeEnvConfig = data.env[activeEnv] || {};
|
|
44
|
-
if (data.env)
|
|
45
|
-
delete data.env;
|
|
44
|
+
if (data.env) delete data.env;
|
|
46
45
|
(0, import_config.setAppConfig)(import_lodash.default.merge(data, activeEnvConfig));
|
|
47
46
|
sessionStorage.setItem("envName", activeEnv);
|
|
48
47
|
(0, import_appdynamics.setAppDynamicsUserData)({ envName: activeEnv });
|
|
@@ -35,14 +35,15 @@ var import_helper = require("./helper.js");
|
|
|
35
35
|
var import_config = require("../app-config/config.js");
|
|
36
36
|
var import_micro_frontend = require("../micro-frontend/index.js");
|
|
37
37
|
var import_log_records = require("../log-records.js");
|
|
38
|
+
var import_loginParams = require("./loginParams.js");
|
|
38
39
|
const IDP_ENDPOINT_CONFIG_KEY = "serviceEndpoints.idp";
|
|
39
40
|
const isUserAuthorized = () => !!(0, import_helper.getAuthorizationHeader)();
|
|
40
41
|
const getIDPInfoFromUrl = () => {
|
|
41
42
|
const currentUrl = new URL(window.location.href);
|
|
42
|
-
const
|
|
43
|
+
const code = currentUrl.searchParams.get("code") || "";
|
|
43
44
|
const idpErrorCode = currentUrl.searchParams.get("error_code") || "";
|
|
44
45
|
currentUrl.search = "";
|
|
45
|
-
return {
|
|
46
|
+
return { code, idpErrorCode, redirectUri: currentUrl.href };
|
|
46
47
|
};
|
|
47
48
|
const navigateToLoginPage = ({
|
|
48
49
|
clientId,
|
|
@@ -71,16 +72,18 @@ const endSession = async ({
|
|
|
71
72
|
redirectUri,
|
|
72
73
|
responseType,
|
|
73
74
|
scope,
|
|
74
|
-
code = "1004"
|
|
75
|
+
code = "1004",
|
|
76
|
+
skipRevoke = false
|
|
75
77
|
}) => {
|
|
76
78
|
try {
|
|
77
79
|
const authorization = (0, import_helper.getAuthorizationHeader)();
|
|
78
80
|
sessionStorage.clear();
|
|
79
81
|
const token = authorization ? authorization.split(" ")[1] : "";
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
if (!skipRevoke)
|
|
83
|
+
await (0, import_auth.revokeToken)({
|
|
84
|
+
clientId,
|
|
85
|
+
token
|
|
86
|
+
});
|
|
84
87
|
(0, import_user_session_event.logoutEvent)();
|
|
85
88
|
(0, import_appdynamics.setAppDynamicsUserData)({ instanceId: "", userId: "" });
|
|
86
89
|
const idpHost = (0, import_config.getAppConfigValue)(IDP_ENDPOINT_CONFIG_KEY, "");
|
|
@@ -103,7 +106,7 @@ const endSession = async ({
|
|
|
103
106
|
}
|
|
104
107
|
};
|
|
105
108
|
const authorize = async ({
|
|
106
|
-
|
|
109
|
+
code,
|
|
107
110
|
redirectUri,
|
|
108
111
|
clientId,
|
|
109
112
|
scope,
|
|
@@ -111,11 +114,12 @@ const authorize = async ({
|
|
|
111
114
|
}) => {
|
|
112
115
|
try {
|
|
113
116
|
const { tokenType, accessToken } = await (0, import_auth.getToken)({
|
|
114
|
-
|
|
117
|
+
code,
|
|
115
118
|
clientId,
|
|
116
119
|
scope,
|
|
117
120
|
redirectUri
|
|
118
121
|
});
|
|
122
|
+
(0, import_loginParams.setLoginParams)({ clientId, scope, responseType, redirectUri, code });
|
|
119
123
|
const authorizationToken = `${tokenType} ${accessToken}`;
|
|
120
124
|
(0, import_helper.setAuthorizationHeader)(authorizationToken);
|
|
121
125
|
const introspectResponse = await (0, import_auth.introspectToken)({
|
|
@@ -144,8 +148,14 @@ const authorize = async ({
|
|
|
144
148
|
const pathName = new URL(redirectUri).pathname;
|
|
145
149
|
import_history.browserHistory.replace(pathName);
|
|
146
150
|
} catch (err) {
|
|
147
|
-
const
|
|
148
|
-
await endSession({
|
|
151
|
+
const errCode = err?.response?.data?.code;
|
|
152
|
+
await endSession({
|
|
153
|
+
clientId,
|
|
154
|
+
redirectUri,
|
|
155
|
+
code: errCode,
|
|
156
|
+
scope,
|
|
157
|
+
responseType
|
|
158
|
+
});
|
|
149
159
|
(0, import_micro_frontend.getLogger)().error({
|
|
150
160
|
...import_log_records.logRecords.LOGIN_FAILED,
|
|
151
161
|
exception: err
|
|
@@ -157,16 +167,16 @@ const login = async ({
|
|
|
157
167
|
scope,
|
|
158
168
|
responseType
|
|
159
169
|
}) => {
|
|
160
|
-
const {
|
|
170
|
+
const { code, idpErrorCode, redirectUri } = getIDPInfoFromUrl();
|
|
161
171
|
const loginInfo = {
|
|
162
172
|
clientId,
|
|
163
173
|
scope,
|
|
164
174
|
responseType,
|
|
165
175
|
redirectUri,
|
|
166
|
-
|
|
176
|
+
code,
|
|
167
177
|
idpErrorCode
|
|
168
178
|
};
|
|
169
|
-
if (
|
|
179
|
+
if (code) {
|
|
170
180
|
await authorize(loginInfo);
|
|
171
181
|
return { authorized: true };
|
|
172
182
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var loginParams_exports = {};
|
|
20
|
+
__export(loginParams_exports, {
|
|
21
|
+
getLoginParams: () => getLoginParams,
|
|
22
|
+
setLoginParams: () => setLoginParams
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(loginParams_exports);
|
|
25
|
+
let loginParams;
|
|
26
|
+
const setLoginParams = (params) => {
|
|
27
|
+
loginParams = params;
|
|
28
|
+
};
|
|
29
|
+
const getLoginParams = () => loginParams;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var extendSession_exports = {};
|
|
20
|
+
__export(extendSession_exports, {
|
|
21
|
+
extendUIandPSSSession: () => extendUIandPSSSession
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(extendSession_exports);
|
|
24
|
+
var import_loginParams = require("./auth/loginParams.js");
|
|
25
|
+
var import_helper = require("./auth/helper.js");
|
|
26
|
+
var import_auth = require("../api/auth/index.js");
|
|
27
|
+
var import_micro_frontend = require("./micro-frontend/index.js");
|
|
28
|
+
var import_log_records = require("./log-records.js");
|
|
29
|
+
var import_auth2 = require("./auth/index.js");
|
|
30
|
+
var import_session = require("./session.js");
|
|
31
|
+
const extendUIandPSSSession = async () => {
|
|
32
|
+
const loginParams = (0, import_loginParams.getLoginParams)();
|
|
33
|
+
try {
|
|
34
|
+
const authToken = (0, import_helper.getAuthorizationHeader)();
|
|
35
|
+
if (!authToken)
|
|
36
|
+
throw new Error("Authorization token not found to extend session");
|
|
37
|
+
const accessToken = authToken.split(" ")[1];
|
|
38
|
+
await (0, import_auth.introspectToken)({ clientId: loginParams.clientId, accessToken });
|
|
39
|
+
(0, import_session.resetUserIdleTime)(true);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
(0, import_micro_frontend.getLogger)().error({
|
|
42
|
+
...import_log_records.logRecords.SESSION_RENEWAL_FAILED,
|
|
43
|
+
exception: e
|
|
44
|
+
});
|
|
45
|
+
await (0, import_auth2.endSession)({ ...loginParams, skipRevoke: true });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -24,8 +24,7 @@ module.exports = __toCommonJS(console_logger_exports);
|
|
|
24
24
|
var import_pui_diagnostics = require("@elliemae/pui-diagnostics");
|
|
25
25
|
var import_config = require("../app-config/config.js");
|
|
26
26
|
const logger = (() => {
|
|
27
|
-
if (!import_pui_diagnostics.logger)
|
|
28
|
-
return console;
|
|
27
|
+
if (!import_pui_diagnostics.logger) return console;
|
|
29
28
|
return (0, import_pui_diagnostics.logger)({
|
|
30
29
|
transport: (0, import_pui_diagnostics.Console)(),
|
|
31
30
|
index: "app",
|
|
@@ -125,8 +125,7 @@ class CMicroAppGuest {
|
|
|
125
125
|
}
|
|
126
126
|
if (!host) {
|
|
127
127
|
const ssfAdapter = new import_ssfguest_adapter.SSFGuestAdapter();
|
|
128
|
-
if (!await ssfAdapter.init())
|
|
129
|
-
return null;
|
|
128
|
+
if (!await ssfAdapter.init()) return null;
|
|
130
129
|
host = ssfAdapter;
|
|
131
130
|
}
|
|
132
131
|
}
|
|
@@ -137,8 +136,7 @@ class CMicroAppGuest {
|
|
|
137
136
|
this.props.history = options?.history || this.props.history;
|
|
138
137
|
if (!this.props.host) {
|
|
139
138
|
const host = await this.getSSFAdapter();
|
|
140
|
-
if (host)
|
|
141
|
-
this.props.host = host;
|
|
139
|
+
if (host) this.props.host = host;
|
|
142
140
|
}
|
|
143
141
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
144
142
|
return (0, import_app_config.loadAppConfig)().then(() => {
|
|
@@ -146,15 +144,13 @@ class CMicroAppGuest {
|
|
|
146
144
|
const userId = this.getSessionStorageItem("userId") || "";
|
|
147
145
|
(0, import_web_analytics.updateBAEventParameters)({ appId: this.appId, instanceId, userId });
|
|
148
146
|
(0, import_appdynamics.setAppDynamicsUserData)({ appId: this.appId, instanceId, userId });
|
|
149
|
-
if (this.onInit)
|
|
150
|
-
this.onInit(this.props);
|
|
147
|
+
if (this.onInit) this.onInit(this.props);
|
|
151
148
|
});
|
|
152
149
|
}
|
|
153
150
|
mount(options = { containerId: "app-container" }) {
|
|
154
151
|
this.containerId = options?.containerId;
|
|
155
152
|
return Promise.resolve().then(() => {
|
|
156
|
-
if (this.onMount)
|
|
157
|
-
this.onMount(options);
|
|
153
|
+
if (this.onMount) this.onMount(options);
|
|
158
154
|
});
|
|
159
155
|
}
|
|
160
156
|
unmount(options) {
|
|
@@ -167,7 +163,6 @@ class CMicroAppGuest {
|
|
|
167
163
|
return this.onGetRef ? this.onGetRef() : null;
|
|
168
164
|
}
|
|
169
165
|
navigate(url, state) {
|
|
170
|
-
if (url)
|
|
171
|
-
this.props.history.push(url, state);
|
|
166
|
+
if (url) this.props.history.push(url, state);
|
|
172
167
|
}
|
|
173
168
|
}
|
|
@@ -66,8 +66,7 @@ class CMicroAppHost {
|
|
|
66
66
|
this.renewSessionTimer = this.renewSessionTimer.bind(this);
|
|
67
67
|
this.setSystemVersion = this.setSystemVersion.bind(this);
|
|
68
68
|
(0, import_app_config.loadAppConfig)().then(() => {
|
|
69
|
-
if (this.onInit)
|
|
70
|
-
this.onInit(this.props);
|
|
69
|
+
if (this.onInit) this.onInit(this.props);
|
|
71
70
|
}).catch(() => {
|
|
72
71
|
});
|
|
73
72
|
(0, import_web_analytics.updateBAEventParameters)({ appId: this.appId });
|
|
@@ -113,23 +112,19 @@ class CMicroAppHost {
|
|
|
113
112
|
(0, import_pubsub_js.unsubscribe)(token);
|
|
114
113
|
}
|
|
115
114
|
navigate(url, state) {
|
|
116
|
-
if (url)
|
|
117
|
-
this.props.history.push(url, state);
|
|
115
|
+
if (url) this.props.history.push(url, state);
|
|
118
116
|
}
|
|
119
117
|
openWaitMessage() {
|
|
120
118
|
const store = (0, import_store.getStore)();
|
|
121
|
-
if (store)
|
|
122
|
-
store.dispatch(import_actions.waitMessage.open());
|
|
119
|
+
if (store) store.dispatch(import_actions.waitMessage.open());
|
|
123
120
|
}
|
|
124
121
|
closeWaitMessage() {
|
|
125
122
|
const store = (0, import_store.getStore)();
|
|
126
|
-
if (store)
|
|
127
|
-
store.dispatch(import_actions.waitMessage.close());
|
|
123
|
+
if (store) store.dispatch(import_actions.waitMessage.close());
|
|
128
124
|
}
|
|
129
125
|
openErrorBanner(message) {
|
|
130
126
|
const store = (0, import_store.getStore)();
|
|
131
|
-
if (store)
|
|
132
|
-
store.dispatch(import_error.actions.set({ description: message }));
|
|
127
|
+
if (store) store.dispatch(import_error.actions.set({ description: message }));
|
|
133
128
|
}
|
|
134
129
|
getAuthToken() {
|
|
135
130
|
return (0, import_window.getWindow)().sessionStorage.getItem("Authorization");
|
|
@@ -139,13 +134,11 @@ class CMicroAppHost {
|
|
|
139
134
|
}
|
|
140
135
|
logout() {
|
|
141
136
|
const store = (0, import_store.getStore)();
|
|
142
|
-
if (store)
|
|
143
|
-
store.dispatch(import_actions2.logout.confirm());
|
|
137
|
+
if (store) store.dispatch(import_actions2.logout.confirm());
|
|
144
138
|
}
|
|
145
139
|
renewSessionTimer() {
|
|
146
140
|
(0, import_session.resetUserIdleTime)();
|
|
147
|
-
if (this.onRenewSessionTimer)
|
|
148
|
-
this.onRenewSessionTimer();
|
|
141
|
+
if (this.onRenewSessionTimer) this.onRenewSessionTimer();
|
|
149
142
|
}
|
|
150
143
|
getBreakpoint() {
|
|
151
144
|
return (0, import_window.getCurrentBreakpoint)();
|
|
@@ -45,10 +45,8 @@ const isGuest = () => import_guest.CMicroAppGuest.isInitialized();
|
|
|
45
45
|
const isStandAloneGuest = () => isGuest() && window.top === window.self;
|
|
46
46
|
const getLogger = () => isHost() ? import_host.CMicroAppHost.getInstance().getLogger() : import_guest.CMicroAppGuest.getInstance().getLogger();
|
|
47
47
|
const isProduction = (mode) => {
|
|
48
|
-
if ((0, import_helpers.isCIBuild)())
|
|
49
|
-
|
|
50
|
-
if (mode)
|
|
51
|
-
return mode === "production";
|
|
48
|
+
if ((0, import_helpers.isCIBuild)()) return true;
|
|
49
|
+
if (mode) return mode === "production";
|
|
52
50
|
return true;
|
|
53
51
|
};
|
|
54
52
|
const getVersionedPath = (path) => {
|
|
@@ -69,10 +67,8 @@ const getMicroFrontEndAppConfig = (appInfo) => {
|
|
|
69
67
|
);
|
|
70
68
|
const { mode = "production" } = microFEAppConfig;
|
|
71
69
|
const envConfig = isProduction(mode) ? microFEAppConfig.production : microFEAppConfig.development;
|
|
72
|
-
if (microFEAppConfig.production)
|
|
73
|
-
|
|
74
|
-
if (microFEAppConfig.development)
|
|
75
|
-
delete microFEAppConfig.development;
|
|
70
|
+
if (microFEAppConfig.production) delete microFEAppConfig.production;
|
|
71
|
+
if (microFEAppConfig.development) delete microFEAppConfig.development;
|
|
76
72
|
const microFEConfig = import_lodash.default.merge(
|
|
77
73
|
appInfo,
|
|
78
74
|
{
|
|
@@ -34,8 +34,7 @@ module.exports = __toCommonJS(ssfguest_adapter_exports);
|
|
|
34
34
|
var import_em_ssf_guest = __toESM(require("@elliemae/em-ssf-guest"));
|
|
35
35
|
class SSFGuestAdapter {
|
|
36
36
|
async init() {
|
|
37
|
-
if (!import_em_ssf_guest.default)
|
|
38
|
-
return false;
|
|
37
|
+
if (!import_em_ssf_guest.default) return false;
|
|
39
38
|
await import_em_ssf_guest.default.connect();
|
|
40
39
|
return true;
|
|
41
40
|
}
|
|
@@ -117,9 +117,8 @@ const subscribeToResetSession = (onResetListener) => {
|
|
|
117
117
|
return removeListeners.bind(null, resetListeners, onResetListener);
|
|
118
118
|
};
|
|
119
119
|
const trackActivity = (element, cb) => {
|
|
120
|
-
if (!element)
|
|
121
|
-
|
|
122
|
-
};
|
|
120
|
+
if (!element) return () => {
|
|
121
|
+
};
|
|
123
122
|
const thorttledCb = (0, import_lodash.throttle)(cb, THROTTLING_TIME, { leading: true });
|
|
124
123
|
userInteractionEvents.forEach(
|
|
125
124
|
(r) => element.addEventListener(r, thorttledCb)
|
package/dist/cjs/utils/window.js
CHANGED
|
@@ -47,16 +47,13 @@ const convertBreakpointToNumber = (breakpoint) => Number(breakpoint.replace("px"
|
|
|
47
47
|
const getCurrentBreakpoint = () => {
|
|
48
48
|
const { width } = getViewportSize();
|
|
49
49
|
const { breakpoints } = (0, import_pui_theme.getDefaultTheme)();
|
|
50
|
-
if (width <= convertBreakpointToNumber(breakpoints.small))
|
|
51
|
-
|
|
52
|
-
if (width <= convertBreakpointToNumber(breakpoints.medium))
|
|
53
|
-
return "medium";
|
|
50
|
+
if (width <= convertBreakpointToNumber(breakpoints.small)) return "small";
|
|
51
|
+
if (width <= convertBreakpointToNumber(breakpoints.medium)) return "medium";
|
|
54
52
|
return "large";
|
|
55
53
|
};
|
|
56
54
|
const getAssetPath = () => {
|
|
57
55
|
const assetPath = window?.emui?._ASSET_PATH || "latest/";
|
|
58
|
-
if (!window.emui?.version)
|
|
59
|
-
return assetPath;
|
|
56
|
+
if (!window.emui?.version) return assetPath;
|
|
60
57
|
const majorMinorVersion = window.emui?.version.match(/^(?:\d+\.\d+)*/g);
|
|
61
58
|
return majorMinorVersion && majorMinorVersion[0] ? assetPath.replace("latest/", `${majorMinorVersion[0]}/`) : assetPath;
|
|
62
59
|
};
|
|
@@ -39,8 +39,7 @@ const ErrorToast = (0, import_react.memo)((props) => {
|
|
|
39
39
|
...storeError
|
|
40
40
|
};
|
|
41
41
|
const messageText = toastProps.description || toastProps.messageText;
|
|
42
|
-
if (messageText)
|
|
43
|
-
(0, import_ds_toast.toast)({ messageText, ...toastProps }, {});
|
|
42
|
+
if (messageText) (0, import_ds_toast.toast)({ messageText, ...toastProps }, {});
|
|
44
43
|
dispatch(import_error.actions.clear());
|
|
45
44
|
}
|
|
46
45
|
}, [storeError, props, dispatch]);
|
|
@@ -26,8 +26,7 @@ var import_react = require("react");
|
|
|
26
26
|
var import_ds_controlled_form = require("@elliemae/ds-controlled-form");
|
|
27
27
|
var import_react_hook_form = require("react-hook-form");
|
|
28
28
|
const filterOptions = (allOptions, newFilter) => {
|
|
29
|
-
if (!newFilter)
|
|
30
|
-
return allOptions;
|
|
29
|
+
if (!newFilter) return allOptions;
|
|
31
30
|
const filtered = allOptions.filter(
|
|
32
31
|
(option) => option.type === "section" || option.label.toLowerCase().includes(newFilter?.toLowerCase())
|
|
33
32
|
);
|
|
@@ -38,8 +37,7 @@ const Autocomplete = ({ children, ...rest }) => {
|
|
|
38
37
|
const watchedFilter = watch(rest.name);
|
|
39
38
|
const onSelect = (0, import_react.useCallback)(
|
|
40
39
|
(newValue, ...otherArgs) => {
|
|
41
|
-
if (rest.onSelect)
|
|
42
|
-
rest.onSelect(newValue, ...otherArgs);
|
|
40
|
+
if (rest.onSelect) rest.onSelect(newValue, ...otherArgs);
|
|
43
41
|
else
|
|
44
42
|
setValue(rest.name, newValue, {
|
|
45
43
|
shouldValidate: true,
|
|
@@ -46,13 +46,11 @@ const InputMask = ({
|
|
|
46
46
|
...props,
|
|
47
47
|
onChange: (e) => {
|
|
48
48
|
onChange(e);
|
|
49
|
-
if (changeHandler)
|
|
50
|
-
changeHandler(e);
|
|
49
|
+
if (changeHandler) changeHandler(e);
|
|
51
50
|
},
|
|
52
51
|
onBlur: (e) => {
|
|
53
52
|
onBlur();
|
|
54
|
-
if (onBlurHandler)
|
|
55
|
-
onBlurHandler(e);
|
|
53
|
+
if (onBlurHandler) onBlurHandler(e);
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
56
|
)
|
|
@@ -46,8 +46,7 @@ const Form = ({
|
|
|
46
46
|
}) => {
|
|
47
47
|
const methods = (0, import_react_hook_form.useForm)(reactHookFormProps);
|
|
48
48
|
const formProps = {};
|
|
49
|
-
if (onSubmit)
|
|
50
|
-
formProps.onSubmit = methods.handleSubmit(onSubmit);
|
|
49
|
+
if (onSubmit) formProps.onSubmit = methods.handleSubmit(onSubmit);
|
|
51
50
|
const providerProps = Object.assign(methods, {
|
|
52
51
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
53
52
|
formProps: reactHookFormProps
|