@elliemae/pui-app-sdk 5.44.1 → 5.45.0
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/build/docs/404.html +2 -2
- package/build/docs/api/classes/Analytics/index.html +2 -2
- package/build/docs/api/classes/CMicroAppGuest/index.html +2 -2
- package/build/docs/api/classes/CMicroAppHost/index.html +2 -2
- package/build/docs/api/classes/ErrorBoundary/index.html +2 -2
- package/build/docs/api/classes/GuestModule/index.html +2 -2
- package/build/docs/api/functions/AppRoot/index.html +3 -3
- package/build/docs/api/functions/Autocomplete/index.html +3 -3
- package/build/docs/api/functions/CheckBox/index.html +3 -3
- package/build/docs/api/functions/ComboBox/index.html +3 -3
- package/build/docs/api/functions/ComboBoxV3/index.html +3 -3
- package/build/docs/api/functions/ConnectForm/index.html +3 -3
- package/build/docs/api/functions/DateInput/index.html +3 -3
- package/build/docs/api/functions/DatePicker/index.html +3 -3
- package/build/docs/api/functions/DateRangePicker/index.html +3 -3
- package/build/docs/api/functions/DateTimePicker/index.html +3 -3
- package/build/docs/api/functions/Form/index.html +3 -3
- package/build/docs/api/functions/FormItemLayout/index.html +3 -3
- package/build/docs/api/functions/FormLayoutBlockItem/index.html +3 -3
- package/build/docs/api/functions/FormSubmitButton/index.html +3 -3
- package/build/docs/api/functions/InputMask/index.html +3 -3
- package/build/docs/api/functions/InputText/index.html +3 -3
- package/build/docs/api/functions/LargeTextBox/index.html +3 -3
- package/build/docs/api/functions/MaskedInputText/index.html +3 -3
- package/build/docs/api/functions/Page/index.html +3 -3
- package/build/docs/api/functions/Radio/index.html +3 -3
- package/build/docs/api/functions/RadioGroup/index.html +3 -3
- package/build/docs/api/functions/RegisterService/index.html +3 -3
- package/build/docs/api/functions/RenderWithStateAddOns/index.html +3 -3
- package/build/docs/api/functions/RequireAuth/index.html +3 -3
- package/build/docs/api/functions/SessionTimeout/index.html +3 -3
- package/build/docs/api/functions/TextBox/index.html +3 -3
- package/build/docs/api/functions/Toggle/index.html +3 -3
- package/build/docs/api/functions/authSaga/index.html +3 -3
- package/build/docs/api/functions/authorize/index.html +3 -3
- package/build/docs/api/functions/buildModuleParams/index.html +3 -3
- package/build/docs/api/functions/cleanup/index.html +3 -3
- package/build/docs/api/functions/configureStore/index.html +3 -3
- package/build/docs/api/functions/createGuestModule/index.html +3 -3
- package/build/docs/api/functions/createManager/index.html +3 -3
- package/build/docs/api/functions/enableReactAppForHostIntegration/index.html +3 -3
- package/build/docs/api/functions/fetchHostAppData/index.html +3 -3
- package/build/docs/api/functions/fetchUserSettings/index.html +3 -3
- package/build/docs/api/functions/getApiActionCreator/index.html +3 -3
- package/build/docs/api/functions/getAppConfig/index.html +3 -3
- package/build/docs/api/functions/getAppConfigValue/index.html +3 -3
- package/build/docs/api/functions/getAuthHTTPClient/index.html +3 -3
- package/build/docs/api/functions/getAuthorizationHeader/index.html +3 -3
- package/build/docs/api/functions/getHTTPClient/index.html +3 -3
- package/build/docs/api/functions/getHostAppDataByKey/index.html +3 -3
- package/build/docs/api/functions/getLogger/index.html +3 -3
- package/build/docs/api/functions/getMicroFrontEndAppConfig/index.html +3 -3
- package/build/docs/api/functions/getNavigationLinks/index.html +3 -3
- package/build/docs/api/functions/getRedirectUrl/index.html +3 -3
- package/build/docs/api/functions/getSelectField/index.html +3 -3
- package/build/docs/api/functions/getStore/index.html +3 -3
- package/build/docs/api/functions/initServiceWorker/index.html +3 -3
- package/build/docs/api/functions/isCIBuild/index.html +3 -3
- package/build/docs/api/functions/isProd/index.html +3 -3
- package/build/docs/api/functions/isUserAuthorized/index.html +3 -3
- package/build/docs/api/functions/listenStorageEvents/index.html +3 -3
- package/build/docs/api/functions/loadAppConfig/index.html +3 -3
- package/build/docs/api/functions/loadable/index.html +3 -3
- package/build/docs/api/functions/login/index.html +3 -3
- package/build/docs/api/functions/notifyGuestUnloadComplete/index.html +3 -3
- package/build/docs/api/functions/onAuthorizationFailure/index.html +3 -3
- package/build/docs/api/functions/onGuestUnloadStart/index.html +3 -3
- package/build/docs/api/functions/redactPii/index.html +3 -3
- package/build/docs/api/functions/removeDoubleSlash/index.html +3 -3
- package/build/docs/api/functions/removeStorageEvents/index.html +3 -3
- package/build/docs/api/functions/render/index.html +4 -4
- package/build/docs/api/functions/renderHook/index.html +3 -3
- package/build/docs/api/functions/renderWithHostData/index.html +3 -3
- package/build/docs/api/functions/renderWithRedux/index.html +4 -4
- package/build/docs/api/functions/renderWithRouter/index.html +3 -3
- package/build/docs/api/functions/renderWithRouterRedux/index.html +3 -3
- package/build/docs/api/functions/sdkBaseQuery/index.html +3 -3
- package/build/docs/api/functions/sendBAEvent/index.html +3 -3
- package/build/docs/api/functions/sendMessageToHost/index.html +3 -3
- package/build/docs/api/functions/setAppConfig/index.html +3 -3
- package/build/docs/api/functions/setAppConfigValue/index.html +3 -3
- package/build/docs/api/functions/setHostAppData/index.html +3 -3
- package/build/docs/api/functions/setLoginParams/index.html +4 -4
- package/build/docs/api/functions/setSessionTimeoutInterval/index.html +24 -0
- package/build/docs/api/functions/subscribeToResetSession/index.html +4 -4
- package/build/docs/api/functions/subscribeToSessionExpiry/index.html +3 -3
- package/build/docs/api/functions/subscribeToSessionExpiryWarning/index.html +3 -3
- package/build/docs/api/functions/trackActivity/index.html +3 -3
- package/build/docs/api/functions/useAppDispatch/index.html +3 -3
- package/build/docs/api/functions/useAppMiddleware/index.html +3 -3
- package/build/docs/api/functions/useInjectQuery/index.html +3 -3
- package/build/docs/api/functions/useInjectReducer/index.html +3 -3
- package/build/docs/api/functions/useInjectSaga/index.html +3 -3
- package/build/docs/api/functions/useInjectSideEffect/index.html +3 -3
- package/build/docs/api/functions/useMediaQueryList/index.html +3 -3
- package/build/docs/api/functions/useStateSelector/index.html +3 -3
- package/build/docs/api/functions/useStateSelectorShallow/index.html +3 -3
- package/build/docs/api/functions/waitFor/index.html +3 -3
- package/build/docs/api/functions/waitForElementToBeRemoved/index.html +3 -3
- package/build/docs/api/functions/withAppDecorator/index.html +3 -3
- package/build/docs/api/index.html +3 -3
- package/build/docs/api/interfaces/AppConfig/index.html +2 -2
- package/build/docs/api/interfaces/GuestProps/index.html +2 -2
- package/build/docs/api/interfaces/UseStateSelectorOptions/index.html +2 -2
- package/build/docs/api/type-aliases/AppDispatch/index.html +2 -2
- package/build/docs/api/type-aliases/AppStore/index.html +2 -2
- package/build/docs/api/type-aliases/Await/index.html +2 -2
- package/build/docs/api/type-aliases/EMUI/index.html +2 -2
- package/build/docs/api/type-aliases/HostOptions/index.html +2 -2
- package/build/docs/api/type-aliases/HostProvidedParams/index.html +2 -2
- package/build/docs/api/type-aliases/ModuleOverrides/index.html +2 -2
- package/build/docs/api/type-aliases/OnHostInitCallback/index.html +2 -2
- package/build/docs/api/type-aliases/OnInitCallback/index.html +2 -2
- package/build/docs/api/type-aliases/OnMountCallback/index.html +2 -2
- package/build/docs/api/type-aliases/OnUnMountCallback/index.html +2 -2
- package/build/docs/api/type-aliases/RootState/index.html +2 -2
- package/build/docs/api/type-aliases/SelectStateFieldFunction/index.html +2 -2
- package/build/docs/api/variables/ErrorToast/index.html +2 -2
- package/build/docs/api/variables/FormPropsContext/index.html +2 -2
- package/build/docs/api/variables/GuestMicroApp/index.html +2 -2
- package/build/docs/api/variables/MASK_PIPES/index.html +2 -2
- package/build/docs/api/variables/MASK_TYPES/index.html +2 -2
- package/build/docs/api/variables/MicroApp/index.html +2 -2
- package/build/docs/api/variables/MicroIFrameApp/index.html +2 -2
- package/build/docs/api/variables/NavigationPrompt/index.html +2 -2
- package/build/docs/api/variables/NavigationPromptActions/index.html +2 -2
- package/build/docs/api/variables/Themes/index.html +2 -2
- package/build/docs/api/variables/VisuallyHidden/index.html +2 -2
- package/build/docs/api/variables/WaitMessage/index.html +2 -2
- package/build/docs/api/variables/act/index.html +2 -2
- package/build/docs/api/variables/ariaLive/index.html +2 -2
- package/build/docs/api/variables/auth/index.html +2 -2
- package/build/docs/api/variables/authReducer/index.html +2 -2
- package/build/docs/api/variables/clearSideEffects/index.html +2 -2
- package/build/docs/api/variables/createSideEffect/index.html +2 -2
- package/build/docs/api/variables/decorators/index.html +2 -2
- package/build/docs/api/variables/endSession/index.html +2 -2
- package/build/docs/api/variables/error/index.html +2 -2
- package/build/docs/api/variables/errorMiddleware/index.html +2 -2
- package/build/docs/api/variables/fireEvent/index.html +2 -2
- package/build/docs/api/variables/globalConstants/index.html +2 -2
- package/build/docs/api/variables/history/index.html +2 -2
- package/build/docs/api/variables/httpClientProps/index.html +2 -2
- package/build/docs/api/variables/logout/index.html +2 -2
- package/build/docs/api/variables/memoryHistory/index.html +2 -2
- package/build/docs/api/variables/removeSideEffect/index.html +2 -2
- package/build/docs/api/variables/resetUserIdleTime/index.html +2 -2
- package/build/docs/api/variables/screen/index.html +2 -2
- package/build/docs/api/variables/startSideEffect/index.html +2 -2
- package/build/docs/api/variables/updateBAEventParameters/index.html +2 -2
- package/build/docs/api/variables/useAppSelector/index.html +2 -2
- package/build/docs/api/variables/waitMessageAction/index.html +2 -2
- package/build/docs/api/variables/within/index.html +2 -2
- package/build/docs/assets/js/{2856.0700bd2f.js → 2856.5f4708fe.js} +1 -1
- package/build/docs/assets/js/{386.60c604cf.js → 386.1ca60f37.js} +2 -2
- package/build/docs/assets/js/{3995.097eacab.js → 3995.471cb67b.js} +1 -1
- package/build/docs/assets/js/{5e8c322a.c3cc240b.js → 5e8c322a.cd8f81c9.js} +1 -1
- package/build/docs/assets/js/{6286.44ea15e4.js → 6286.f26d2403.js} +1 -1
- package/build/docs/assets/js/{6779.205be7c8.js → 6779.d05f07c7.js} +1 -1
- package/build/docs/assets/js/77982fdd.daa51d7d.js +1 -0
- package/build/docs/assets/js/822e0178.bea29480.js +1 -0
- package/build/docs/assets/js/a48fd09c.e36a2228.js +1 -0
- package/build/docs/assets/js/fed4ae4f.b3dfb5da.js +1 -0
- package/build/docs/assets/js/main.eb628dfd.js +2 -0
- package/build/docs/assets/js/runtime~main.d66bc46a.js +1 -0
- package/build/docs/index.html +2 -2
- package/build/docs/sitemap.xml +1 -1
- package/build/docs/usage-guide/index.html +2 -2
- package/demo/{1896.f079560a.iframe.bundle.js → 1896.11783677.iframe.bundle.js} +1 -1
- package/demo/1896.11783677.iframe.bundle.js.br +0 -0
- package/demo/{docs/1896.f079560a.iframe.bundle.js.gz → 1896.11783677.iframe.bundle.js.gz} +0 -0
- package/demo/docs/{1896.f079560a.iframe.bundle.js → 1896.11783677.iframe.bundle.js} +1 -1
- package/demo/docs/1896.11783677.iframe.bundle.js.br +0 -0
- package/demo/{1896.f079560a.iframe.bundle.js.gz → docs/1896.11783677.iframe.bundle.js.gz} +0 -0
- package/demo/docs/iframe.html +1 -1
- package/demo/docs/index.html +1 -1
- package/demo/docs/{main.e50da2045dbe0d31db54.manager.bundle.js → main.7fe19f1fb477a0b9fcce.manager.bundle.js} +1 -1
- package/demo/docs/main.7fe19f1fb477a0b9fcce.manager.bundle.js.br +0 -0
- package/demo/docs/{main.e50da2045dbe0d31db54.manager.bundle.js.gz → main.7fe19f1fb477a0b9fcce.manager.bundle.js.gz} +0 -0
- package/demo/docs/main.ccc2d540.iframe.bundle.js +5 -0
- package/demo/docs/main.ccc2d540.iframe.bundle.js.br +0 -0
- package/demo/docs/main.ccc2d540.iframe.bundle.js.gz +0 -0
- package/demo/docs/project.json +1 -1
- package/demo/iframe.html +1 -1
- package/demo/index.html +1 -1
- package/demo/{main.e50da2045dbe0d31db54.manager.bundle.js → main.7fe19f1fb477a0b9fcce.manager.bundle.js} +1 -1
- package/demo/main.7fe19f1fb477a0b9fcce.manager.bundle.js.br +0 -0
- package/demo/{main.e50da2045dbe0d31db54.manager.bundle.js.gz → main.7fe19f1fb477a0b9fcce.manager.bundle.js.gz} +0 -0
- package/demo/main.ccc2d540.iframe.bundle.js +5 -0
- package/demo/main.ccc2d540.iframe.bundle.js.br +0 -0
- package/demo/main.ccc2d540.iframe.bundle.js.gz +0 -0
- package/demo/project.json +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/utils/session-timeout-config.js +8 -1
- package/dist/cjs/utils/session.js +5 -0
- package/dist/cjs/view/guest-microapp.js +40 -17
- package/dist/cjs/view/iframe-teardown-sandbox.js +50 -0
- package/dist/cjs/view/micro-app/use-app-will-render.js +24 -3
- package/dist/esm/index.js +2 -0
- package/dist/esm/utils/session-timeout-config.js +8 -1
- package/dist/esm/utils/session.js +7 -1
- package/dist/esm/view/guest-microapp.js +43 -17
- package/dist/esm/view/iframe-teardown-sandbox.js +30 -0
- package/dist/esm/view/micro-app/use-app-will-render.js +24 -3
- package/dist/types/lib/index.d.ts +1 -1
- package/dist/types/lib/utils/session-timeout-config.d.ts +1 -0
- package/dist/types/lib/utils/session.d.ts +5 -0
- package/dist/types/lib/view/iframe-teardown-sandbox.d.ts +20 -0
- package/dist/types/lib/view/tests/iframe-teardown-sandbox.test.d.ts +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/build/docs/assets/js/822e0178.dfd661b8.js +0 -1
- package/build/docs/assets/js/a48fd09c.49a10fd0.js +0 -1
- package/build/docs/assets/js/fed4ae4f.4cbcd19c.js +0 -1
- package/build/docs/assets/js/main.1bc3906d.js +0 -2
- package/build/docs/assets/js/runtime~main.995cc93a.js +0 -1
- package/demo/1896.f079560a.iframe.bundle.js.br +0 -0
- package/demo/docs/1896.f079560a.iframe.bundle.js.br +0 -0
- package/demo/docs/main.b01a6dc6.iframe.bundle.js +0 -5
- package/demo/docs/main.b01a6dc6.iframe.bundle.js.br +0 -0
- package/demo/docs/main.b01a6dc6.iframe.bundle.js.gz +0 -0
- package/demo/docs/main.e50da2045dbe0d31db54.manager.bundle.js.br +0 -0
- package/demo/main.b01a6dc6.iframe.bundle.js +0 -5
- package/demo/main.b01a6dc6.iframe.bundle.js.br +0 -0
- package/demo/main.b01a6dc6.iframe.bundle.js.gz +0 -0
- package/demo/main.e50da2045dbe0d31db54.manager.bundle.js.br +0 -0
- /package/build/docs/assets/js/{386.60c604cf.js.LICENSE.txt → 386.1ca60f37.js.LICENSE.txt} +0 -0
- /package/build/docs/assets/js/{main.1bc3906d.js.LICENSE.txt → main.eb628dfd.js.LICENSE.txt} +0 -0
|
@@ -17,6 +17,10 @@ import {
|
|
|
17
17
|
resolveGuestOpenHistory,
|
|
18
18
|
resolveNestedGuestFrameOptions
|
|
19
19
|
} from "../utils/micro-frontend/guest-host-context.js";
|
|
20
|
+
import {
|
|
21
|
+
getSsfGuestFrame,
|
|
22
|
+
preserveIframeForTeardown
|
|
23
|
+
} from "./iframe-teardown-sandbox.js";
|
|
20
24
|
const Div = styled.div`
|
|
21
25
|
display: flex;
|
|
22
26
|
width: 100%;
|
|
@@ -59,11 +63,14 @@ const useAppRenderer = (props) => {
|
|
|
59
63
|
[id]
|
|
60
64
|
);
|
|
61
65
|
const unloadInProgressRef = useRef(Promise.resolve());
|
|
66
|
+
const hostStateRef = useRef({ appBridge: null, ssfHost: null, instanceId: null });
|
|
62
67
|
useLayoutEffect(() => {
|
|
63
68
|
let isMounted = true;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
hostStateRef.current = {
|
|
70
|
+
appBridge: null,
|
|
71
|
+
ssfHost: null,
|
|
72
|
+
instanceId: null
|
|
73
|
+
};
|
|
67
74
|
const abortController = new AbortController();
|
|
68
75
|
const trackUnload = (unloadResult, onSettled) => {
|
|
69
76
|
unloadInProgressRef.current = unloadInProgressRef.current.then(() => toVoidPromise(unloadResult)).then(() => {
|
|
@@ -76,7 +83,7 @@ const useAppRenderer = (props) => {
|
|
|
76
83
|
});
|
|
77
84
|
};
|
|
78
85
|
const notifyUnloadComplete = () => {
|
|
79
|
-
instanceId = null;
|
|
86
|
+
hostStateRef.current.instanceId = null;
|
|
80
87
|
setTimeout(() => {
|
|
81
88
|
try {
|
|
82
89
|
onUnloadComplete?.();
|
|
@@ -108,7 +115,8 @@ const useAppRenderer = (props) => {
|
|
|
108
115
|
...stableSsfAppOptions
|
|
109
116
|
};
|
|
110
117
|
if (microappManager === MicroAppManager.SSF) {
|
|
111
|
-
ssfHost = getSSFHost();
|
|
118
|
+
const ssfHost = getSSFHost();
|
|
119
|
+
hostStateRef.current.ssfHost = ssfHost;
|
|
112
120
|
if (!ssfHost)
|
|
113
121
|
throw new Error(`Failed to load ${id}, SSFHost not initialized`);
|
|
114
122
|
if (!hostUrl)
|
|
@@ -139,14 +147,15 @@ const useAppRenderer = (props) => {
|
|
|
139
147
|
onLoad: onLoadComplete,
|
|
140
148
|
options: guestOptions
|
|
141
149
|
});
|
|
142
|
-
instanceId = guest.id;
|
|
150
|
+
hostStateRef.current.instanceId = guest.id;
|
|
143
151
|
}
|
|
144
152
|
} else {
|
|
145
|
-
appBridge = await getAppBridge();
|
|
153
|
+
const appBridge = await getAppBridge();
|
|
154
|
+
hostStateRef.current.appBridge = appBridge;
|
|
146
155
|
if (!appBridge)
|
|
147
156
|
throw new Error(`Failed to load ${id}, AppBridge not initialized`);
|
|
148
157
|
if (isMounted && !abortController.signal.aborted) {
|
|
149
|
-
|
|
158
|
+
const openedInstanceId = await appBridge.openApp({
|
|
150
159
|
id,
|
|
151
160
|
selfInitialize: configSelfInitialize,
|
|
152
161
|
frameOptions: {
|
|
@@ -160,13 +169,14 @@ const useAppRenderer = (props) => {
|
|
|
160
169
|
initialRoute
|
|
161
170
|
});
|
|
162
171
|
if (!isMounted || abortController.signal.aborted) {
|
|
163
|
-
trackUnload(appBridge.closeApp(
|
|
164
|
-
instanceId = null;
|
|
172
|
+
trackUnload(appBridge.closeApp(openedInstanceId));
|
|
173
|
+
hostStateRef.current.instanceId = null;
|
|
165
174
|
return;
|
|
166
175
|
}
|
|
176
|
+
hostStateRef.current.instanceId = openedInstanceId;
|
|
167
177
|
setTimeout(() => {
|
|
168
178
|
try {
|
|
169
|
-
onLoadComplete?.(
|
|
179
|
+
onLoadComplete?.(openedInstanceId);
|
|
170
180
|
} catch (ex) {
|
|
171
181
|
getLogger().warn({
|
|
172
182
|
message: `onLoadComplete callback failed for ${id}`,
|
|
@@ -183,6 +193,7 @@ const useAppRenderer = (props) => {
|
|
|
183
193
|
exception: ex
|
|
184
194
|
});
|
|
185
195
|
isMounted = false;
|
|
196
|
+
const { appBridge, ssfHost, instanceId } = hostStateRef.current;
|
|
186
197
|
if (appBridge && instanceId)
|
|
187
198
|
trackUnload(appBridge.closeApp(instanceId));
|
|
188
199
|
if (ssfHost && instanceId) trackUnload(ssfHost.unloadGuest(instanceId));
|
|
@@ -195,12 +206,27 @@ const useAppRenderer = (props) => {
|
|
|
195
206
|
return () => {
|
|
196
207
|
abortController.abort();
|
|
197
208
|
isMounted = false;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
209
|
+
const {
|
|
210
|
+
appBridge,
|
|
211
|
+
ssfHost,
|
|
212
|
+
instanceId: currentInstanceId
|
|
213
|
+
} = hostStateRef.current;
|
|
214
|
+
const startTeardown = (frameEle, unloadResult) => {
|
|
215
|
+
preserveIframeForTeardown(frameEle ?? void 0);
|
|
216
|
+
trackUnload(unloadResult, notifyUnloadComplete);
|
|
217
|
+
};
|
|
218
|
+
if (ssfHost && currentInstanceId) {
|
|
219
|
+
startTeardown(
|
|
220
|
+
getSsfGuestFrame(ssfHost, currentInstanceId),
|
|
221
|
+
ssfHost.unloadGuest(currentInstanceId)
|
|
222
|
+
);
|
|
223
|
+
} else if (appBridge && currentInstanceId) {
|
|
224
|
+
startTeardown(
|
|
225
|
+
document.getElementById(
|
|
226
|
+
currentInstanceId
|
|
227
|
+
),
|
|
228
|
+
appBridge.closeApp(currentInstanceId)
|
|
229
|
+
);
|
|
204
230
|
}
|
|
205
231
|
};
|
|
206
232
|
}, [
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const TEARDOWN_SANDBOX_ID = "pui-iframe-teardown-sandbox";
|
|
2
|
+
let disablePreserveForTeardown = false;
|
|
3
|
+
const setDisablePreserveForTeardown = (disabled) => {
|
|
4
|
+
disablePreserveForTeardown = disabled;
|
|
5
|
+
};
|
|
6
|
+
const getTeardownSandbox = () => {
|
|
7
|
+
let sandbox = document.getElementById(TEARDOWN_SANDBOX_ID);
|
|
8
|
+
if (!sandbox) {
|
|
9
|
+
sandbox = document.createElement("div");
|
|
10
|
+
sandbox.id = TEARDOWN_SANDBOX_ID;
|
|
11
|
+
sandbox.setAttribute("data-testid", TEARDOWN_SANDBOX_ID);
|
|
12
|
+
sandbox.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;visibility:hidden;";
|
|
13
|
+
document.body.appendChild(sandbox);
|
|
14
|
+
}
|
|
15
|
+
return sandbox;
|
|
16
|
+
};
|
|
17
|
+
const clearTeardownSandbox = () => {
|
|
18
|
+
document.getElementById(TEARDOWN_SANDBOX_ID)?.replaceChildren();
|
|
19
|
+
};
|
|
20
|
+
const preserveIframeForTeardown = (iframe) => {
|
|
21
|
+
if (disablePreserveForTeardown || !iframe?.isConnected) return;
|
|
22
|
+
getTeardownSandbox().appendChild(iframe);
|
|
23
|
+
};
|
|
24
|
+
const getSsfGuestFrame = (ssfHost, instanceId) => ssfHost.getGuests().find(({ id }) => id === instanceId)?.domElement ?? null;
|
|
25
|
+
export {
|
|
26
|
+
clearTeardownSandbox,
|
|
27
|
+
getSsfGuestFrame,
|
|
28
|
+
preserveIframeForTeardown,
|
|
29
|
+
setDisablePreserveForTeardown
|
|
30
|
+
};
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
getMicroFrontEndAppConfig
|
|
14
14
|
} from "../../utils/micro-frontend/index.js";
|
|
15
15
|
import { logRecords } from "../../utils/log-records.js";
|
|
16
|
+
import { preserveIframeForTeardown } from "../iframe-teardown-sandbox.js";
|
|
17
|
+
import { IFRAME_CONTAINER_ID_PREFIX } from "../micro-iframe-app/iframe/const.js";
|
|
16
18
|
const useAppWillRender = ({
|
|
17
19
|
id,
|
|
18
20
|
uuid,
|
|
@@ -32,8 +34,12 @@ const useAppWillRender = ({
|
|
|
32
34
|
);
|
|
33
35
|
const unload = useCallback(
|
|
34
36
|
async (appParams, loadFailed = false) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
try {
|
|
38
|
+
await unmountApp(appParams);
|
|
39
|
+
unloadApp(appParams);
|
|
40
|
+
} finally {
|
|
41
|
+
document.getElementById(`${IFRAME_CONTAINER_ID_PREFIX}${appParams.id}`)?.remove();
|
|
42
|
+
}
|
|
37
43
|
if (!loadFailed && onUnloadComplete) onUnloadComplete();
|
|
38
44
|
},
|
|
39
45
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -70,9 +76,24 @@ const useAppWillRender = ({
|
|
|
70
76
|
const appParams = { ...appConfig, uuid };
|
|
71
77
|
load(appParams);
|
|
72
78
|
return () => {
|
|
79
|
+
preserveIframeForTeardown(
|
|
80
|
+
document.getElementById(
|
|
81
|
+
`${IFRAME_CONTAINER_ID_PREFIX}${id}`
|
|
82
|
+
)
|
|
83
|
+
);
|
|
73
84
|
ref.current = unload(appParams);
|
|
74
85
|
};
|
|
75
|
-
}, [
|
|
86
|
+
}, [
|
|
87
|
+
documentEle,
|
|
88
|
+
getConfig,
|
|
89
|
+
history,
|
|
90
|
+
id,
|
|
91
|
+
theme,
|
|
92
|
+
homeRoute,
|
|
93
|
+
load,
|
|
94
|
+
unload,
|
|
95
|
+
uuid
|
|
96
|
+
]);
|
|
76
97
|
};
|
|
77
98
|
export {
|
|
78
99
|
useAppWillRender
|
|
@@ -26,7 +26,7 @@ export { ACTIONS as NavigationPromptActions } from './data/navigation-prompt/act
|
|
|
26
26
|
export { loadable } from './view/loadable/index.js';
|
|
27
27
|
export { WaitMessage } from './view/wait-message/index.js';
|
|
28
28
|
export { SessionTimeout } from './view/session-timeout/index.js';
|
|
29
|
-
export { subscribeToSessionExpiryWarning, subscribeToSessionExpiry, subscribeToResetSession, resetUserIdleTime, trackActivity, } from './utils/session.js';
|
|
29
|
+
export { subscribeToSessionExpiryWarning, subscribeToSessionExpiry, subscribeToResetSession, setSessionTimeoutInterval, resetUserIdleTime, trackActivity, } from './utils/session.js';
|
|
30
30
|
export { waitMessage as waitMessageAction } from './data/wait-message/actions.js';
|
|
31
31
|
export { initServiceWorker } from './utils/service-worker.js';
|
|
32
32
|
export { CMicroAppGuest, CMicroAppGuest as CMicroApp, } from './utils/micro-frontend/guest.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type SessionTimeoutKey = 'sessionTimeoutWarnInterval' | 'sessionTimeoutInterval';
|
|
2
2
|
export declare const resetSessionTimeoutCache: () => void;
|
|
3
|
+
export declare const setSessionTimeoutCacheInMS: (sessionExpiryInterval: number) => void;
|
|
3
4
|
export declare const getSessionTimeoutMs: (key: SessionTimeoutKey, fallback: number) => number;
|
|
4
5
|
export declare const getSessionWarnIntervalMs: () => number;
|
|
5
6
|
export declare const getSessionExpiryIntervalMs: () => number;
|
|
@@ -16,6 +16,11 @@ type LISTENER = {
|
|
|
16
16
|
* listeners so the warning modal can close. Only for explicit user actions.
|
|
17
17
|
*/
|
|
18
18
|
export declare const resetUserIdleTime: ResetUserIdleTimeFn;
|
|
19
|
+
/**
|
|
20
|
+
* Allows developers to provide a custom value for session expiry.
|
|
21
|
+
* @param sessionExpiryInterval Custom session expiry value.
|
|
22
|
+
*/
|
|
23
|
+
export declare const setSessionTimeoutInterval: (sessionExpiryInterval: number) => void;
|
|
19
24
|
/**
|
|
20
25
|
* Extends the PSS (Encompass) session via token introspection and resets idle.
|
|
21
26
|
* @param {boolean} [explicit=false] - Pass true for deliberate user actions
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const setDisablePreserveForTeardown: (disabled: boolean) => void;
|
|
2
|
+
export declare const clearTeardownSandbox: () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Re-parent a guest iframe so its JS context stays alive while async host
|
|
5
|
+
* teardown (closeApp / unloadGuest) completes.
|
|
6
|
+
* @param iframe
|
|
7
|
+
*/
|
|
8
|
+
export declare const preserveIframeForTeardown: (iframe: HTMLElement | null | undefined) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the SSF guest iframe from the host registry.
|
|
11
|
+
* @param ssfHost
|
|
12
|
+
* @param ssfHost.getGuests
|
|
13
|
+
* @param instanceId
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSsfGuestFrame: (ssfHost: {
|
|
16
|
+
getGuests: () => Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
domElement?: HTMLIFrameElement | null;
|
|
19
|
+
}>;
|
|
20
|
+
}, instanceId: string) => HTMLIFrameElement | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|