@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
|
@@ -92,8 +92,7 @@ class CMicroAppGuest {
|
|
|
92
92
|
}
|
|
93
93
|
if (!host) {
|
|
94
94
|
const ssfAdapter = new SSFGuestAdapter();
|
|
95
|
-
if (!await ssfAdapter.init())
|
|
96
|
-
return null;
|
|
95
|
+
if (!await ssfAdapter.init()) return null;
|
|
97
96
|
host = ssfAdapter;
|
|
98
97
|
}
|
|
99
98
|
}
|
|
@@ -104,8 +103,7 @@ class CMicroAppGuest {
|
|
|
104
103
|
this.props.history = options?.history || this.props.history;
|
|
105
104
|
if (!this.props.host) {
|
|
106
105
|
const host = await this.getSSFAdapter();
|
|
107
|
-
if (host)
|
|
108
|
-
this.props.host = host;
|
|
106
|
+
if (host) this.props.host = host;
|
|
109
107
|
}
|
|
110
108
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
111
109
|
return loadAppConfig().then(() => {
|
|
@@ -113,15 +111,13 @@ class CMicroAppGuest {
|
|
|
113
111
|
const userId = this.getSessionStorageItem("userId") || "";
|
|
114
112
|
updateBAEventParameters({ appId: this.appId, instanceId, userId });
|
|
115
113
|
setAppDynamicsUserData({ appId: this.appId, instanceId, userId });
|
|
116
|
-
if (this.onInit)
|
|
117
|
-
this.onInit(this.props);
|
|
114
|
+
if (this.onInit) this.onInit(this.props);
|
|
118
115
|
});
|
|
119
116
|
}
|
|
120
117
|
mount(options = { containerId: "app-container" }) {
|
|
121
118
|
this.containerId = options?.containerId;
|
|
122
119
|
return Promise.resolve().then(() => {
|
|
123
|
-
if (this.onMount)
|
|
124
|
-
this.onMount(options);
|
|
120
|
+
if (this.onMount) this.onMount(options);
|
|
125
121
|
});
|
|
126
122
|
}
|
|
127
123
|
unmount(options) {
|
|
@@ -134,8 +130,7 @@ class CMicroAppGuest {
|
|
|
134
130
|
return this.onGetRef ? this.onGetRef() : null;
|
|
135
131
|
}
|
|
136
132
|
navigate(url, state) {
|
|
137
|
-
if (url)
|
|
138
|
-
this.props.history.push(url, state);
|
|
133
|
+
if (url) this.props.history.push(url, state);
|
|
139
134
|
}
|
|
140
135
|
}
|
|
141
136
|
export {
|
|
@@ -50,8 +50,7 @@ class CMicroAppHost {
|
|
|
50
50
|
this.renewSessionTimer = this.renewSessionTimer.bind(this);
|
|
51
51
|
this.setSystemVersion = this.setSystemVersion.bind(this);
|
|
52
52
|
loadAppConfig().then(() => {
|
|
53
|
-
if (this.onInit)
|
|
54
|
-
this.onInit(this.props);
|
|
53
|
+
if (this.onInit) this.onInit(this.props);
|
|
55
54
|
}).catch(() => {
|
|
56
55
|
});
|
|
57
56
|
updateBAEventParameters({ appId: this.appId });
|
|
@@ -97,23 +96,19 @@ class CMicroAppHost {
|
|
|
97
96
|
unsubscribe(token);
|
|
98
97
|
}
|
|
99
98
|
navigate(url, state) {
|
|
100
|
-
if (url)
|
|
101
|
-
this.props.history.push(url, state);
|
|
99
|
+
if (url) this.props.history.push(url, state);
|
|
102
100
|
}
|
|
103
101
|
openWaitMessage() {
|
|
104
102
|
const store = getStore();
|
|
105
|
-
if (store)
|
|
106
|
-
store.dispatch(waitMessage.open());
|
|
103
|
+
if (store) store.dispatch(waitMessage.open());
|
|
107
104
|
}
|
|
108
105
|
closeWaitMessage() {
|
|
109
106
|
const store = getStore();
|
|
110
|
-
if (store)
|
|
111
|
-
store.dispatch(waitMessage.close());
|
|
107
|
+
if (store) store.dispatch(waitMessage.close());
|
|
112
108
|
}
|
|
113
109
|
openErrorBanner(message) {
|
|
114
110
|
const store = getStore();
|
|
115
|
-
if (store)
|
|
116
|
-
store.dispatch(error.set({ description: message }));
|
|
111
|
+
if (store) store.dispatch(error.set({ description: message }));
|
|
117
112
|
}
|
|
118
113
|
getAuthToken() {
|
|
119
114
|
return getWindow().sessionStorage.getItem("Authorization");
|
|
@@ -123,13 +118,11 @@ class CMicroAppHost {
|
|
|
123
118
|
}
|
|
124
119
|
logout() {
|
|
125
120
|
const store = getStore();
|
|
126
|
-
if (store)
|
|
127
|
-
store.dispatch(logout.confirm());
|
|
121
|
+
if (store) store.dispatch(logout.confirm());
|
|
128
122
|
}
|
|
129
123
|
renewSessionTimer() {
|
|
130
124
|
resetUserIdleTime();
|
|
131
|
-
if (this.onRenewSessionTimer)
|
|
132
|
-
this.onRenewSessionTimer();
|
|
125
|
+
if (this.onRenewSessionTimer) this.onRenewSessionTimer();
|
|
133
126
|
}
|
|
134
127
|
getBreakpoint() {
|
|
135
128
|
return getCurrentBreakpoint();
|
|
@@ -8,10 +8,8 @@ const isGuest = () => CMicroAppGuest.isInitialized();
|
|
|
8
8
|
const isStandAloneGuest = () => isGuest() && window.top === window.self;
|
|
9
9
|
const getLogger = () => isHost() ? CMicroAppHost.getInstance().getLogger() : CMicroAppGuest.getInstance().getLogger();
|
|
10
10
|
const isProduction = (mode) => {
|
|
11
|
-
if (isCIBuild())
|
|
12
|
-
|
|
13
|
-
if (mode)
|
|
14
|
-
return mode === "production";
|
|
11
|
+
if (isCIBuild()) return true;
|
|
12
|
+
if (mode) return mode === "production";
|
|
15
13
|
return true;
|
|
16
14
|
};
|
|
17
15
|
const getVersionedPath = (path) => {
|
|
@@ -32,10 +30,8 @@ const getMicroFrontEndAppConfig = (appInfo) => {
|
|
|
32
30
|
);
|
|
33
31
|
const { mode = "production" } = microFEAppConfig;
|
|
34
32
|
const envConfig = isProduction(mode) ? microFEAppConfig.production : microFEAppConfig.development;
|
|
35
|
-
if (microFEAppConfig.production)
|
|
36
|
-
|
|
37
|
-
if (microFEAppConfig.development)
|
|
38
|
-
delete microFEAppConfig.development;
|
|
33
|
+
if (microFEAppConfig.production) delete microFEAppConfig.production;
|
|
34
|
+
if (microFEAppConfig.development) delete microFEAppConfig.development;
|
|
39
35
|
const microFEConfig = _.merge(
|
|
40
36
|
appInfo,
|
|
41
37
|
{
|
|
@@ -87,9 +87,8 @@ const subscribeToResetSession = (onResetListener) => {
|
|
|
87
87
|
return removeListeners.bind(null, resetListeners, onResetListener);
|
|
88
88
|
};
|
|
89
89
|
const trackActivity = (element, cb) => {
|
|
90
|
-
if (!element)
|
|
91
|
-
|
|
92
|
-
};
|
|
90
|
+
if (!element) return () => {
|
|
91
|
+
};
|
|
93
92
|
const thorttledCb = throttle(cb, THROTTLING_TIME, { leading: true });
|
|
94
93
|
userInteractionEvents.forEach(
|
|
95
94
|
(r) => element.addEventListener(r, thorttledCb)
|
package/dist/esm/utils/window.js
CHANGED
|
@@ -21,16 +21,13 @@ const convertBreakpointToNumber = (breakpoint) => Number(breakpoint.replace("px"
|
|
|
21
21
|
const getCurrentBreakpoint = () => {
|
|
22
22
|
const { width } = getViewportSize();
|
|
23
23
|
const { breakpoints } = getDefaultTheme();
|
|
24
|
-
if (width <= convertBreakpointToNumber(breakpoints.small))
|
|
25
|
-
|
|
26
|
-
if (width <= convertBreakpointToNumber(breakpoints.medium))
|
|
27
|
-
return "medium";
|
|
24
|
+
if (width <= convertBreakpointToNumber(breakpoints.small)) return "small";
|
|
25
|
+
if (width <= convertBreakpointToNumber(breakpoints.medium)) return "medium";
|
|
28
26
|
return "large";
|
|
29
27
|
};
|
|
30
28
|
const getAssetPath = () => {
|
|
31
29
|
const assetPath = window?.emui?._ASSET_PATH || "latest/";
|
|
32
|
-
if (!window.emui?.version)
|
|
33
|
-
return assetPath;
|
|
30
|
+
if (!window.emui?.version) return assetPath;
|
|
34
31
|
const majorMinorVersion = window.emui?.version.match(/^(?:\d+\.\d+)*/g);
|
|
35
32
|
return majorMinorVersion && majorMinorVersion[0] ? assetPath.replace("latest/", `${majorMinorVersion[0]}/`) : assetPath;
|
|
36
33
|
};
|
|
@@ -16,8 +16,7 @@ const ErrorToast = memo((props) => {
|
|
|
16
16
|
...storeError
|
|
17
17
|
};
|
|
18
18
|
const messageText = toastProps.description || toastProps.messageText;
|
|
19
|
-
if (messageText)
|
|
20
|
-
toast({ messageText, ...toastProps }, {});
|
|
19
|
+
if (messageText) toast({ messageText, ...toastProps }, {});
|
|
21
20
|
dispatch(error.clear());
|
|
22
21
|
}
|
|
23
22
|
}, [storeError, props, dispatch]);
|
|
@@ -3,8 +3,7 @@ import { useCallback } from "react";
|
|
|
3
3
|
import { DSAutocomplete } from "@elliemae/ds-controlled-form";
|
|
4
4
|
import { useFormContext } from "react-hook-form";
|
|
5
5
|
const filterOptions = (allOptions, newFilter) => {
|
|
6
|
-
if (!newFilter)
|
|
7
|
-
return allOptions;
|
|
6
|
+
if (!newFilter) return allOptions;
|
|
8
7
|
const filtered = allOptions.filter(
|
|
9
8
|
(option) => option.type === "section" || option.label.toLowerCase().includes(newFilter?.toLowerCase())
|
|
10
9
|
);
|
|
@@ -15,8 +14,7 @@ const Autocomplete = ({ children, ...rest }) => {
|
|
|
15
14
|
const watchedFilter = watch(rest.name);
|
|
16
15
|
const onSelect = useCallback(
|
|
17
16
|
(newValue, ...otherArgs) => {
|
|
18
|
-
if (rest.onSelect)
|
|
19
|
-
rest.onSelect(newValue, ...otherArgs);
|
|
17
|
+
if (rest.onSelect) rest.onSelect(newValue, ...otherArgs);
|
|
20
18
|
else
|
|
21
19
|
setValue(rest.name, newValue, {
|
|
22
20
|
shouldValidate: true,
|
|
@@ -23,13 +23,11 @@ const InputMask = ({
|
|
|
23
23
|
...props,
|
|
24
24
|
onChange: (e) => {
|
|
25
25
|
onChange(e);
|
|
26
|
-
if (changeHandler)
|
|
27
|
-
changeHandler(e);
|
|
26
|
+
if (changeHandler) changeHandler(e);
|
|
28
27
|
},
|
|
29
28
|
onBlur: (e) => {
|
|
30
29
|
onBlur();
|
|
31
|
-
if (onBlurHandler)
|
|
32
|
-
onBlurHandler(e);
|
|
30
|
+
if (onBlurHandler) onBlurHandler(e);
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
)
|
|
@@ -16,8 +16,7 @@ const Form = ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const methods = useForm(reactHookFormProps);
|
|
18
18
|
const formProps = {};
|
|
19
|
-
if (onSubmit)
|
|
20
|
-
formProps.onSubmit = methods.handleSubmit(onSubmit);
|
|
19
|
+
if (onSubmit) formProps.onSubmit = methods.handleSubmit(onSubmit);
|
|
21
20
|
const providerProps = Object.assign(methods, {
|
|
22
21
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
23
22
|
formProps: reactHookFormProps
|
|
@@ -13,12 +13,10 @@ const Login = ({
|
|
|
13
13
|
const dispatch = useAppDispatch();
|
|
14
14
|
const ref = useRef(false);
|
|
15
15
|
useEffect(() => {
|
|
16
|
-
if (ref.current)
|
|
17
|
-
return;
|
|
16
|
+
if (ref.current) return;
|
|
18
17
|
ref.current = true;
|
|
19
18
|
login({ clientId, scope, responseType }).then(({ authorized }) => {
|
|
20
|
-
if (authorized)
|
|
21
|
-
setUserAuthorized(true);
|
|
19
|
+
if (authorized) setUserAuthorized(true);
|
|
22
20
|
dispatch({ type: LOGIN_SUCCESS });
|
|
23
21
|
}).catch(() => {
|
|
24
22
|
}).finally(() => {
|
|
@@ -72,11 +72,9 @@ const mountApp = async ({ id, name }) => {
|
|
|
72
72
|
};
|
|
73
73
|
const unmountApp = async ({ id, name }) => {
|
|
74
74
|
const app = (window.emui || {})[id];
|
|
75
|
-
if (!app)
|
|
76
|
-
return null;
|
|
75
|
+
if (!app) return null;
|
|
77
76
|
const { unmount } = app;
|
|
78
|
-
if (!unmount)
|
|
79
|
-
return null;
|
|
77
|
+
if (!unmount) return null;
|
|
80
78
|
if (typeof unmount !== "function")
|
|
81
79
|
throw new Error(
|
|
82
80
|
`unmount failed for application ${name} with id ${id}. unmount is not a valid function`
|
|
@@ -94,8 +92,7 @@ const addAppToActiveAppList = (id, elementIds) => {
|
|
|
94
92
|
const { getRef } = app;
|
|
95
93
|
activeApps[id] = { elementIds };
|
|
96
94
|
const host = CMicroAppHost.getInstance();
|
|
97
|
-
if (host)
|
|
98
|
-
host.activeGuests[id] = getRef && getRef() || {};
|
|
95
|
+
if (host) host.activeGuests[id] = getRef && getRef() || {};
|
|
99
96
|
return Promise.resolve();
|
|
100
97
|
};
|
|
101
98
|
const waitAndInitApplication = (appConfig, requests) => (
|
|
@@ -108,14 +105,12 @@ const waitAndInitApplication = (appConfig, requests) => (
|
|
|
108
105
|
);
|
|
109
106
|
const removeAssetsFromDOM = (id, documentEle = document) => {
|
|
110
107
|
const host = CMicroAppHost.getInstance();
|
|
111
|
-
if (host)
|
|
112
|
-
delete host.activeGuests[id];
|
|
108
|
+
if (host) delete host.activeGuests[id];
|
|
113
109
|
const { elementIds } = activeApps[id] || {};
|
|
114
110
|
if (elementIds) {
|
|
115
111
|
elementIds.forEach((elementId) => {
|
|
116
112
|
const ele = documentEle.getElementById(elementId);
|
|
117
|
-
if (ele)
|
|
118
|
-
ele.remove();
|
|
113
|
+
if (ele) ele.remove();
|
|
119
114
|
});
|
|
120
115
|
delete activeApps[id];
|
|
121
116
|
}
|
|
@@ -138,18 +133,15 @@ const unloadApp = ({
|
|
|
138
133
|
hostUrl,
|
|
139
134
|
documentEle
|
|
140
135
|
}) => {
|
|
141
|
-
if (!hostUrl)
|
|
142
|
-
throw new Error("Unable to unload app. hostUrl is required");
|
|
136
|
+
if (!hostUrl) throw new Error("Unable to unload app. hostUrl is required");
|
|
143
137
|
getLogger().info(logRecords.APP_UNLOADING(id));
|
|
144
138
|
const app = (window.emui || {})[id];
|
|
145
|
-
if (!app)
|
|
146
|
-
return;
|
|
139
|
+
if (!app) return;
|
|
147
140
|
removeAssetsFromDOM(id, documentEle);
|
|
148
141
|
removeDynamicImportedScripts(hostUrl, documentEle);
|
|
149
142
|
removePrefetchLinks(hostUrl, documentEle);
|
|
150
143
|
removeDynamicImportedStyles(hostUrl, documentEle);
|
|
151
|
-
if (window.emui && window.emui[id])
|
|
152
|
-
delete window.emui[id];
|
|
144
|
+
if (window.emui && window.emui[id]) delete window.emui[id];
|
|
153
145
|
getLogger().info(logRecords.APP_UNLOADING_COMPLETE(id));
|
|
154
146
|
};
|
|
155
147
|
export {
|
|
@@ -39,8 +39,7 @@ const getAppManifest = async ({
|
|
|
39
39
|
};
|
|
40
40
|
const getFullFileNameofAssetsFromManifest = (manifest, assetNames = []) => assetNames.reduce((assets, assetName) => {
|
|
41
41
|
const fullFileName = manifest[assetName];
|
|
42
|
-
if (fullFileName)
|
|
43
|
-
assets.push(fullFileName);
|
|
42
|
+
if (fullFileName) assets.push(fullFileName);
|
|
44
43
|
else {
|
|
45
44
|
const logRecord = logRecords.ASSET_NOT_FOUND_IN_MANIFEST(assetName);
|
|
46
45
|
getLogger().error(logRecord);
|
|
@@ -7,24 +7,20 @@ const addScriptToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
|
7
7
|
throw new Error("Unable to add scripts to DOM. hostUrl is required.");
|
|
8
8
|
return new Promise((resolve, reject) => {
|
|
9
9
|
const ele = documentEle.createElement("script");
|
|
10
|
-
if (!ele)
|
|
11
|
-
reject(new Error("Unable to insert Application scripts."));
|
|
10
|
+
if (!ele) reject(new Error("Unable to insert Application scripts."));
|
|
12
11
|
ele.id = `${APP_SCRIPT_ID_PREFIX}${name}-${index}`;
|
|
13
12
|
const url = new URL(fileName, hostUrl);
|
|
14
13
|
ele.src = removeDoubleSlash(url.href);
|
|
15
14
|
ele.onload = resolve.bind(null, ele.id);
|
|
16
15
|
ele.onerror = reject.bind(null, ele.id);
|
|
17
16
|
ele.async = false;
|
|
18
|
-
if (isHeadScript(ele.src))
|
|
19
|
-
|
|
20
|
-
else
|
|
21
|
-
documentEle.body.appendChild(ele);
|
|
17
|
+
if (isHeadScript(ele.src)) documentEle.head.appendChild(ele);
|
|
18
|
+
else documentEle.body.appendChild(ele);
|
|
22
19
|
});
|
|
23
20
|
};
|
|
24
21
|
const removeScriptFromDOM = (elementId = "", documentEle = document) => new Promise((resolve) => {
|
|
25
22
|
const ele = documentEle.getElementById(elementId);
|
|
26
|
-
if (!ele)
|
|
27
|
-
console.warn(new Error(`script with id ${elementId} not found`));
|
|
23
|
+
if (!ele) console.warn(new Error(`script with id ${elementId} not found`));
|
|
28
24
|
ele.remove();
|
|
29
25
|
resolve();
|
|
30
26
|
});
|
|
@@ -34,8 +30,7 @@ const removeDynamicImportedScripts = (hostUrl, documentEle) => {
|
|
|
34
30
|
for (let index = scriptElements.length - 1; index >= 0; index -= 1) {
|
|
35
31
|
const scriptEle = scriptElements[index];
|
|
36
32
|
const { src } = scriptEle;
|
|
37
|
-
if (hostPattern.test(src))
|
|
38
|
-
scriptEle.remove();
|
|
33
|
+
if (hostPattern.test(src)) scriptEle.remove();
|
|
39
34
|
}
|
|
40
35
|
};
|
|
41
36
|
const removePrefetchLinks = (hostUrl, documentEle) => {
|
|
@@ -44,8 +39,7 @@ const removePrefetchLinks = (hostUrl, documentEle) => {
|
|
|
44
39
|
for (let index = prefetchElements.length - 1; index >= 0; index -= 1) {
|
|
45
40
|
const ele = prefetchElements[index];
|
|
46
41
|
const { href } = ele;
|
|
47
|
-
if (hostPattern.test(href))
|
|
48
|
-
ele.remove();
|
|
42
|
+
if (hostPattern.test(href)) ele.remove();
|
|
49
43
|
}
|
|
50
44
|
};
|
|
51
45
|
export {
|
|
@@ -5,8 +5,7 @@ const addStylesToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
|
5
5
|
throw new Error("Unable to add styles to DOM. hostUrl is required.");
|
|
6
6
|
return new Promise((resolve, reject) => {
|
|
7
7
|
const ele = documentEle.createElement("link");
|
|
8
|
-
if (!ele)
|
|
9
|
-
reject(new Error("Unable to insert Application styles."));
|
|
8
|
+
if (!ele) reject(new Error("Unable to insert Application styles."));
|
|
10
9
|
ele.id = `${APP_STYLE_ID_PREFIX}${name}-${index}`;
|
|
11
10
|
ele.rel = "stylesheet";
|
|
12
11
|
const url = new URL(fileName, hostUrl);
|
|
@@ -17,8 +16,7 @@ const addStylesToDOM = ({ name, hostUrl, documentEle }, fileName, index) => {
|
|
|
17
16
|
};
|
|
18
17
|
const removeStyleFromDOM = (elementId = "", documentEle = document) => new Promise((resolve) => {
|
|
19
18
|
const ele = documentEle.getElementById(elementId);
|
|
20
|
-
if (!ele)
|
|
21
|
-
console.warn(new Error(`style with id ${elementId} not found`));
|
|
19
|
+
if (!ele) console.warn(new Error(`style with id ${elementId} not found`));
|
|
22
20
|
ele.remove();
|
|
23
21
|
resolve();
|
|
24
22
|
});
|
|
@@ -28,8 +26,7 @@ const removeDynamicImportedStyles = (hostUrl, documentEle) => {
|
|
|
28
26
|
for (let index = prefetchElements.length - 1; index >= 0; index -= 1) {
|
|
29
27
|
const ele = prefetchElements[index];
|
|
30
28
|
const { href } = ele;
|
|
31
|
-
if (hostPattern.test(href))
|
|
32
|
-
ele.remove();
|
|
29
|
+
if (hostPattern.test(href)) ele.remove();
|
|
33
30
|
}
|
|
34
31
|
};
|
|
35
32
|
export {
|
|
@@ -33,19 +33,16 @@ const useAppWillRender = ({
|
|
|
33
33
|
async (appConfig, loadFailed = false) => {
|
|
34
34
|
await unmountApp(appConfig);
|
|
35
35
|
unloadApp(appConfig);
|
|
36
|
-
if (!loadFailed && onUnloadComplete)
|
|
37
|
-
onUnloadComplete();
|
|
36
|
+
if (!loadFailed && onUnloadComplete) onUnloadComplete();
|
|
38
37
|
},
|
|
39
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
39
|
[]
|
|
41
40
|
);
|
|
42
41
|
const load = useCallback(
|
|
43
42
|
async (appConfig) => {
|
|
44
|
-
if (dispatch)
|
|
45
|
-
dispatch(waitMessage.open());
|
|
43
|
+
if (dispatch) dispatch(waitMessage.open());
|
|
46
44
|
try {
|
|
47
|
-
if (ref.current)
|
|
48
|
-
await ref.current;
|
|
45
|
+
if (ref.current) await ref.current;
|
|
49
46
|
await loadApp(appConfig);
|
|
50
47
|
await mountApp(appConfig);
|
|
51
48
|
} catch (ex) {
|
|
@@ -56,15 +53,13 @@ const useAppWillRender = ({
|
|
|
56
53
|
await unload(appConfig, true);
|
|
57
54
|
throw ex;
|
|
58
55
|
}
|
|
59
|
-
if (dispatch)
|
|
60
|
-
dispatch(waitMessage.close());
|
|
56
|
+
if (dispatch) dispatch(waitMessage.close());
|
|
61
57
|
},
|
|
62
58
|
[dispatch, unload]
|
|
63
59
|
);
|
|
64
60
|
useLayoutEffect(() => {
|
|
65
|
-
if (!documentEle)
|
|
66
|
-
|
|
67
|
-
};
|
|
61
|
+
if (!documentEle) return () => {
|
|
62
|
+
};
|
|
68
63
|
const appConfig = merge(getConfig(), {
|
|
69
64
|
documentEle,
|
|
70
65
|
history,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { getAppConfigValue } from "../../utils/app-config/config.js";
|
|
2
2
|
const getNavigationLinks = () => {
|
|
3
3
|
const microApps = getAppConfigValue("microFrontendApps");
|
|
4
|
-
if (!microApps)
|
|
5
|
-
return [];
|
|
4
|
+
if (!microApps) return [];
|
|
6
5
|
return Object.keys(microApps).reduce((value, id) => {
|
|
7
6
|
const { name, homeRoute } = microApps[id] || {};
|
|
8
|
-
if (name && homeRoute)
|
|
9
|
-
value.push({ id, name, path: homeRoute });
|
|
7
|
+
if (name && homeRoute) value.push({ id, name, path: homeRoute });
|
|
10
8
|
return value;
|
|
11
9
|
}, []);
|
|
12
10
|
};
|
|
@@ -20,9 +20,8 @@ const updateContainerId = (id, documentEle) => {
|
|
|
20
20
|
};
|
|
21
21
|
const useFrameLoaded = ({ id, documentEle }) => {
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
if (!documentEle)
|
|
24
|
-
|
|
25
|
-
};
|
|
23
|
+
if (!documentEle) return () => {
|
|
24
|
+
};
|
|
26
25
|
const host = CMicroAppHost.getInstance();
|
|
27
26
|
addBaseTag(id, documentEle);
|
|
28
27
|
updateContainerId(id, documentEle);
|
|
@@ -14,10 +14,8 @@ import {
|
|
|
14
14
|
} from "@elliemae/ds-dialog";
|
|
15
15
|
import { useAppDispatch } from "../../../data/react.js";
|
|
16
16
|
import { logout } from "../../../data/logout/actions.js";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
addEventListeners
|
|
20
|
-
} from "../../../utils/session.js";
|
|
17
|
+
import { addEventListeners } from "../../../utils/session.js";
|
|
18
|
+
import { extendUIandPSSSession } from "../../../utils/extendSession.js";
|
|
21
19
|
import { useTrackSessionExpiry } from "./customHooks.js";
|
|
22
20
|
const SessionExpiry = memo(
|
|
23
21
|
({ open, warningNotifiedAt = 0 }) => {
|
|
@@ -30,9 +28,9 @@ const SessionExpiry = memo(
|
|
|
30
28
|
useEffect(() => {
|
|
31
29
|
setIsOpen(open);
|
|
32
30
|
}, [open]);
|
|
33
|
-
const resetSession = () => {
|
|
31
|
+
const resetSession = async () => {
|
|
34
32
|
setIsOpen(false);
|
|
35
|
-
|
|
33
|
+
await extendUIandPSSSession();
|
|
36
34
|
addEventListeners();
|
|
37
35
|
dispatch(logout.cancel());
|
|
38
36
|
};
|
|
@@ -18,8 +18,7 @@ const SessionTimeout = () => {
|
|
|
18
18
|
initSessionMonitoring();
|
|
19
19
|
const warningCb = subscribeToSessionExpiryWarning(
|
|
20
20
|
(sessionExpiryWarningNotifiedAt) => {
|
|
21
|
-
if (!sessionExpiryWarningNotifiedAt)
|
|
22
|
-
return;
|
|
21
|
+
if (!sessionExpiryWarningNotifiedAt) return;
|
|
23
22
|
setwarningNotifiedAt(sessionExpiryWarningNotifiedAt);
|
|
24
23
|
setSessionExpiryWarning(true);
|
|
25
24
|
}
|
|
@@ -2,8 +2,7 @@ import { useEffect } from "react";
|
|
|
2
2
|
const useHTMLWaitMessage = (close) => {
|
|
3
3
|
useEffect(() => {
|
|
4
4
|
const htmlWaitMsgElement = document.getElementById("em-wait-message");
|
|
5
|
-
if (htmlWaitMsgElement && close)
|
|
6
|
-
htmlWaitMsgElement.remove();
|
|
5
|
+
if (htmlWaitMsgElement && close) htmlWaitMsgElement.remove();
|
|
7
6
|
}, [close]);
|
|
8
7
|
};
|
|
9
8
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
2
|
interface GetTokenRequestParams {
|
|
3
|
-
|
|
3
|
+
code: string;
|
|
4
4
|
clientId: string;
|
|
5
5
|
scope: string;
|
|
6
6
|
redirectUri: string;
|
|
@@ -15,7 +15,7 @@ interface GetTokenError {
|
|
|
15
15
|
export interface GetTokenErrorResponse extends AxiosError {
|
|
16
16
|
response: AxiosResponse<GetTokenError>;
|
|
17
17
|
}
|
|
18
|
-
export declare const getToken: ({
|
|
18
|
+
export declare const getToken: ({ code, clientId, scope, redirectUri, }: GetTokenRequestParams) => Promise<{
|
|
19
19
|
tokenType: string;
|
|
20
20
|
accessToken: string;
|
|
21
21
|
}>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AxiosError, AxiosResponse } from 'axios';
|
|
2
|
+
import type { EndSessionFn } from '../../utils/auth/types.js';
|
|
2
3
|
type FailureCallback = {
|
|
3
4
|
(error: AxiosError): Promise<string>;
|
|
4
5
|
};
|
|
5
6
|
export declare const onAuthorizationFailure: (callback: FailureCallback) => void;
|
|
7
|
+
export declare const setEndSessionHandler: (handler: EndSessionFn) => void;
|
|
6
8
|
export declare const handleSuccess: (response: AxiosResponse) => AxiosResponse;
|
|
7
9
|
export declare const handleFailure: (error: AxiosError) => Promise<unknown>;
|
|
8
10
|
export {};
|
|
@@ -3,7 +3,7 @@ export declare const LOGIN = "auth/LOGIN";
|
|
|
3
3
|
export declare const LOGIN_SUCCESS = "auth/LOGIN_SUCCESS";
|
|
4
4
|
export declare const LOGOUT = "auth/LOGOUT";
|
|
5
5
|
export interface LoginParms {
|
|
6
|
-
|
|
6
|
+
code: string;
|
|
7
7
|
redirectUri: string;
|
|
8
8
|
clientId: string;
|
|
9
9
|
responseType: string;
|
|
@@ -17,6 +17,6 @@ export interface LogoutParams {
|
|
|
17
17
|
code: string;
|
|
18
18
|
}
|
|
19
19
|
export declare const auth: {
|
|
20
|
-
login: ({
|
|
20
|
+
login: ({ code, redirectUri, clientId, responseType, scope, }: LoginParms) => PayloadAction<LoginParms>;
|
|
21
21
|
logout: ({ clientId, redirectUri, responseType, scope, code, }: LogoutParams) => PayloadAction<LogoutParams>;
|
|
22
22
|
};
|
|
@@ -10,7 +10,8 @@ export { Page } from './view/page.js';
|
|
|
10
10
|
export { default as globalConstants } from './utils/constants.js';
|
|
11
11
|
export { useInjectReducer, useInjectSaga, createManager, } from 'redux-injectors';
|
|
12
12
|
export { useInjectQuery, useInjectSideEffect, useAppDispatch, useAppSelector, useAppMiddleware, } from './data/react.js';
|
|
13
|
-
export { useStateSelector, useStateSelectorShallow,
|
|
13
|
+
export { useStateSelector, useStateSelectorShallow, } from './utils/custom-hooks/use-state-selector.js';
|
|
14
|
+
export type { UseStateSelectorOptions } from './utils/custom-hooks/use-state-selector.js';
|
|
14
15
|
export { errorMiddleware } from './data/errorMiddleware.js';
|
|
15
16
|
export { startSideEffect, createSideEffect, removeSideEffect, clearSideEffects, } from './data/listenerMiddleware.js';
|
|
16
17
|
export { getAuthorizationHeader } from './utils/auth/helper.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { EndSessionFn } from './types.js';
|
|
1
2
|
export declare const isUserAuthorized: () => boolean;
|
|
2
3
|
export declare const getIDPInfoFromUrl: () => {
|
|
3
|
-
|
|
4
|
+
code: string;
|
|
4
5
|
idpErrorCode: string;
|
|
5
6
|
redirectUri: string;
|
|
6
7
|
};
|
|
@@ -11,15 +12,9 @@ export declare const navigateToLoginPage: ({ clientId, redirectUri, idpErrorCode
|
|
|
11
12
|
scope: string;
|
|
12
13
|
responseType: string;
|
|
13
14
|
}) => void;
|
|
14
|
-
export declare const endSession:
|
|
15
|
-
|
|
16
|
-
redirectUri: string;
|
|
17
|
-
responseType: string;
|
|
18
|
-
scope: string;
|
|
15
|
+
export declare const endSession: EndSessionFn;
|
|
16
|
+
export declare const authorize: ({ code, redirectUri, clientId, scope, responseType, }: {
|
|
19
17
|
code: string;
|
|
20
|
-
}) => Promise<void>;
|
|
21
|
-
export declare const authorize: ({ idpCode, redirectUri, clientId, scope, responseType, }: {
|
|
22
|
-
idpCode: string;
|
|
23
18
|
redirectUri: string;
|
|
24
19
|
clientId: string;
|
|
25
20
|
scope: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type LoginParams = {
|
|
2
|
+
clientId: string;
|
|
3
|
+
scope: string;
|
|
4
|
+
responseType: string;
|
|
5
|
+
redirectUri: string;
|
|
6
|
+
code: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const setLoginParams: (params: LoginParams) => void;
|
|
9
|
+
export declare const getLoginParams: () => LoginParams;
|
|
10
|
+
export {};
|
|
@@ -6,7 +6,6 @@ export interface UseStateSelectorOptions<Selected = unknown> {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Generic selector that receives a field selector function returned from getSelectField
|
|
9
|
-
*
|
|
10
9
|
* @see /lib/api/helpers.ts#getSelectField
|
|
11
10
|
* @param {SelectStateFieldFunction} selectStateFieldFunc the store state's field selector function
|
|
12
11
|
* ```javascript
|
|
@@ -23,7 +22,6 @@ export interface UseStateSelectorOptions<Selected = unknown> {
|
|
|
23
22
|
export declare function useStateSelector<TState = unknown, Selected = unknown>(selectStateFieldFunc: SelectStateFieldFunction<TState, Selected>, fieldName?: string | Array<string>, { defaultValue, equalityFn, }?: UseStateSelectorOptions<Selected>): Selected;
|
|
24
23
|
/**
|
|
25
24
|
* Generic selector that receives a field selector function returned from getSelectField.
|
|
26
|
-
*
|
|
27
25
|
* @see /lib/api/helpers.ts#getSelectField
|
|
28
26
|
*
|
|
29
27
|
* This is the same as useStateSelector with shallowEqual as default for equalityFn option.
|