@elliemae/pui-app-sdk 5.30.4 → 5.31.0-beta.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/README.md +1 -1
- package/dist/cjs/utils/micro-frontend/guest.js +33 -16
- package/dist/cjs/utils/micro-frontend/host.js +15 -5
- package/dist/cjs/utils/micro-frontend/index.js +3 -2
- package/dist/cjs/utils/micro-frontend/scripting-objects/analytics.js +2 -2
- package/dist/cjs/utils/micro-frontend/ssf-host.js +44 -0
- package/dist/cjs/utils/micro-frontend/types.js +18 -0
- package/dist/cjs/view/guest-microapp.js +70 -30
- package/dist/cjs/view/tests/__snapshots__/guest-microapp.test.tsx.snap +16 -0
- package/dist/cjs/view/tests/app.config.json +5 -0
- package/dist/cjs/view/tests/constants.js +2 -0
- package/dist/cjs/view/tests/serverHandlers.js +15 -0
- package/dist/cjs/view/tests/ssfapp/index.html +14 -0
- package/dist/cjs/view/tests/ssfapp/latest/index.js +16 -0
- package/dist/cjs/view/tests/ssfapp/latest/manifest.json +3 -0
- package/dist/esm/utils/micro-frontend/guest.js +33 -16
- package/dist/esm/utils/micro-frontend/host.js +15 -5
- package/dist/esm/utils/micro-frontend/index.js +3 -2
- package/dist/esm/utils/micro-frontend/scripting-objects/analytics.js +2 -2
- package/dist/esm/utils/micro-frontend/ssf-host.js +24 -0
- package/dist/esm/utils/micro-frontend/types.js +14 -0
- package/dist/esm/view/guest-microapp.js +75 -32
- package/dist/esm/view/tests/__snapshots__/guest-microapp.test.tsx.snap +16 -0
- package/dist/esm/view/tests/app.config.json +5 -0
- package/dist/esm/view/tests/constants.js +2 -0
- package/dist/esm/view/tests/serverHandlers.js +15 -0
- package/dist/esm/view/tests/ssfapp/index.html +14 -0
- package/dist/esm/view/tests/ssfapp/latest/index.js +15 -0
- package/dist/esm/view/tests/ssfapp/latest/manifest.json +3 -0
- package/dist/types/lib/utils/micro-frontend/guest.d.ts +6 -3
- package/dist/types/lib/utils/micro-frontend/host.d.ts +1 -1
- package/dist/types/lib/utils/micro-frontend/ssf-host.d.ts +5 -0
- package/dist/types/lib/utils/micro-frontend/types.d.ts +68 -1
- package/dist/types/lib/view/guest-microapp.d.ts +49 -0
- package/dist/types/lib/view/tests/constants.d.ts +1 -0
- package/dist/types/lib/view/tests/ssfapp/latest/index.d.ts +2 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/dist/cjs/utils/micro-frontend/tests/__snapshots__/guest.test.ts.snap +0 -242
- package/dist/esm/utils/micro-frontend/tests/__snapshots__/guest.test.ts.snap +0 -242
|
@@ -25,6 +25,7 @@ import { Analytics } from "./scripting-objects/analytics.js";
|
|
|
25
25
|
import { updateBAEventParameters } from "./scripting-objects/web-analytics.js";
|
|
26
26
|
import { renewSession } from "../session.js";
|
|
27
27
|
import { getAppBridge } from "./app-bridge.js";
|
|
28
|
+
import { getSSFHost, setSSFHost } from "./ssf-host.js";
|
|
28
29
|
class CMicroAppHost {
|
|
29
30
|
static instance;
|
|
30
31
|
logger;
|
|
@@ -56,14 +57,16 @@ class CMicroAppHost {
|
|
|
56
57
|
theme: params?.theme ?? getDefaultTheme()
|
|
57
58
|
};
|
|
58
59
|
this.activeGuests = {};
|
|
59
|
-
|
|
60
|
+
if (params?.ssfHostRef) setSSFHost(params.ssfHostRef);
|
|
61
|
+
this.#ssfHostRef = getSSFHost();
|
|
60
62
|
const analyticsObj = params?.analytics ?? new Analytics({ logger: this.logger });
|
|
61
63
|
this.scriptingObjects = {
|
|
62
64
|
analytics: analyticsObj,
|
|
63
65
|
...params?.scriptingObjects ?? {}
|
|
64
66
|
};
|
|
65
|
-
this.#ssfHostRef
|
|
66
|
-
|
|
67
|
+
this.#ssfHostRef.addScriptingObject(
|
|
68
|
+
analyticsObj
|
|
69
|
+
);
|
|
67
70
|
this.getProps = this.getProps.bind(this);
|
|
68
71
|
this.getLogger = this.getLogger.bind(this);
|
|
69
72
|
this.getGuests = this.getGuests.bind(this);
|
|
@@ -198,15 +201,21 @@ class CMicroAppHost {
|
|
|
198
201
|
if (this.#appBridge) {
|
|
199
202
|
this.#appBridge.addScriptingObject(so, params);
|
|
200
203
|
}
|
|
204
|
+
this.#ssfHostRef.addScriptingObject(so, params);
|
|
201
205
|
}
|
|
202
206
|
/**
|
|
203
207
|
* dispatch event to child microapp
|
|
204
208
|
* @param {DispatchEventParams<EventId, Params>} params - event parameters
|
|
205
209
|
*/
|
|
206
210
|
async dispatchEvent(params) {
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
const [appBridgeResult, ssfResult] = await Promise.all([
|
|
212
|
+
this.#appBridge ? this.#appBridge.dispatchEvent(params) : Promise.resolve(null),
|
|
213
|
+
this.#ssfHostRef.dispatchEvent(params)
|
|
214
|
+
]);
|
|
215
|
+
if (Array.isArray(appBridgeResult) && Array.isArray(ssfResult)) {
|
|
216
|
+
return appBridgeResult.concat(ssfResult);
|
|
209
217
|
}
|
|
218
|
+
return Promise.resolve();
|
|
210
219
|
}
|
|
211
220
|
/**
|
|
212
221
|
* removes scripting object from child microapp use
|
|
@@ -216,6 +225,7 @@ class CMicroAppHost {
|
|
|
216
225
|
if (this.#appBridge) {
|
|
217
226
|
this.#appBridge.removeScriptingObject(objectId);
|
|
218
227
|
}
|
|
228
|
+
this.#ssfHostRef.removeScriptingObject(objectId);
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
export {
|
|
@@ -3,13 +3,14 @@ import { CMicroAppGuest } from "./guest.js";
|
|
|
3
3
|
import { CMicroAppHost } from "./host.js";
|
|
4
4
|
import { getAppConfigValue } from "../app-config/config.js";
|
|
5
5
|
import { convertRelativeToAbsoluteUrl, isCIBuild } from "../helpers.js";
|
|
6
|
+
import { LaunchMode } from "./types.js";
|
|
6
7
|
const isHost = () => CMicroAppHost.isInitialized();
|
|
7
8
|
const isGuest = () => CMicroAppGuest.isInitialized();
|
|
8
9
|
const isStandAloneGuest = () => isGuest() && window.top === window.self;
|
|
9
10
|
const getLogger = () => isHost() ? CMicroAppHost.getInstance().getLogger() : CMicroAppGuest.getInstance().getLogger();
|
|
10
11
|
const isProduction = (mode) => {
|
|
11
12
|
if (isCIBuild()) return true;
|
|
12
|
-
if (mode) return mode ===
|
|
13
|
+
if (mode) return mode === LaunchMode.PRODUCTION;
|
|
13
14
|
return true;
|
|
14
15
|
};
|
|
15
16
|
const getVersionedPath = (path) => {
|
|
@@ -28,7 +29,7 @@ const getMicroFrontEndAppConfig = (appInfo) => {
|
|
|
28
29
|
throw new Error(
|
|
29
30
|
`unable to locate application configuraiton for ${appInfo.id} under microFrontendApps section of app.config.json`
|
|
30
31
|
);
|
|
31
|
-
const { mode =
|
|
32
|
+
const { mode = LaunchMode.PRODUCTION } = microFEAppConfig;
|
|
32
33
|
const envConfig = isProduction(mode) ? microFEAppConfig.production : microFEAppConfig.development;
|
|
33
34
|
if (microFEAppConfig.production) delete microFEAppConfig.production;
|
|
34
35
|
if (microFEAppConfig.development) delete microFEAppConfig.development;
|
|
@@ -117,8 +117,8 @@ class Analytics extends ScriptingObject {
|
|
|
117
117
|
throw new Error("parameter options is required");
|
|
118
118
|
const startMark = performance.mark(name, { detail: options });
|
|
119
119
|
return Promise.resolve({
|
|
120
|
-
name: startMark
|
|
121
|
-
startTime: startMark
|
|
120
|
+
name: startMark?.name,
|
|
121
|
+
startTime: startMark?.startTime
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
124
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SSFHost } from "@elliemae/ssf-host";
|
|
2
|
+
import { getLogger } from "../logger.js";
|
|
3
|
+
import { getAppConfigValue } from "../app-config/config.js";
|
|
4
|
+
import { Analytics } from "./scripting-objects/analytics.js";
|
|
5
|
+
let ssfHost = null;
|
|
6
|
+
const getSSFHost = () => {
|
|
7
|
+
if (!ssfHost) {
|
|
8
|
+
const logger = getLogger();
|
|
9
|
+
ssfHost = new SSFHost(getAppConfigValue("appId"), {
|
|
10
|
+
logger,
|
|
11
|
+
analyticsObj: new Analytics({ logger })
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return ssfHost;
|
|
15
|
+
};
|
|
16
|
+
const setSSFHost = (host) => {
|
|
17
|
+
if (!ssfHost) {
|
|
18
|
+
ssfHost = host;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
getSSFHost,
|
|
23
|
+
setSSFHost
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var LaunchMode = /* @__PURE__ */ ((LaunchMode2) => {
|
|
2
|
+
LaunchMode2["DEVELOPMENT"] = "development";
|
|
3
|
+
LaunchMode2["PRODUCTION"] = "production";
|
|
4
|
+
return LaunchMode2;
|
|
5
|
+
})(LaunchMode || {});
|
|
6
|
+
var MicroAppManager = /* @__PURE__ */ ((MicroAppManager2) => {
|
|
7
|
+
MicroAppManager2["SSF"] = "ssf";
|
|
8
|
+
MicroAppManager2["APPSDK"] = "appsdk";
|
|
9
|
+
return MicroAppManager2;
|
|
10
|
+
})(MicroAppManager || {});
|
|
11
|
+
export {
|
|
12
|
+
LaunchMode,
|
|
13
|
+
MicroAppManager
|
|
14
|
+
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useLayoutEffect, useRef } from "react";
|
|
2
|
+
import { memo, useLayoutEffect, useRef, useCallback } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { useDispatch } from "react-redux";
|
|
5
|
+
import { MicroAppManager } from "../utils/micro-frontend/types.js";
|
|
5
6
|
import { getAppBridge } from "../utils/micro-frontend/app-bridge.js";
|
|
7
|
+
import { getSSFHost } from "../utils/micro-frontend/ssf-host.js";
|
|
6
8
|
import { waitMessage } from "../data/wait-message/actions.js";
|
|
7
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getLogger,
|
|
11
|
+
getMicroFrontEndAppConfig
|
|
12
|
+
} from "../utils/micro-frontend/index.js";
|
|
8
13
|
const Div = styled.div`
|
|
9
14
|
display: flex;
|
|
10
15
|
width: 100%;
|
|
@@ -20,35 +25,67 @@ const useAppRenderer = (props) => {
|
|
|
20
25
|
initialRoute,
|
|
21
26
|
onLoadComplete,
|
|
22
27
|
onUnloadComplete,
|
|
23
|
-
containerId
|
|
28
|
+
containerId,
|
|
29
|
+
ssfAppOptions = {}
|
|
24
30
|
} = props;
|
|
25
31
|
const dispatch = useDispatch();
|
|
32
|
+
const getConfig = useCallback(
|
|
33
|
+
() => getMicroFrontEndAppConfig({
|
|
34
|
+
id
|
|
35
|
+
}),
|
|
36
|
+
[id]
|
|
37
|
+
);
|
|
26
38
|
useLayoutEffect(() => {
|
|
27
39
|
let isMounted = true;
|
|
28
40
|
let appBridge = null;
|
|
41
|
+
let ssfHost = null;
|
|
29
42
|
let unloadInProgress = Promise.resolve();
|
|
30
43
|
let instanceId = null;
|
|
31
44
|
(async () => {
|
|
32
45
|
await unloadInProgress;
|
|
33
46
|
dispatch(waitMessage.open());
|
|
34
47
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const {
|
|
49
|
+
microappManager = MicroAppManager.APPSDK,
|
|
50
|
+
hostUrl,
|
|
51
|
+
name
|
|
52
|
+
} = getConfig();
|
|
53
|
+
if (microappManager === MicroAppManager.SSF) {
|
|
54
|
+
ssfHost = getSSFHost();
|
|
55
|
+
if (!ssfHost)
|
|
56
|
+
throw new Error(`Failed to load ${id}, SSFHost not initialized`);
|
|
57
|
+
if (isMounted) {
|
|
58
|
+
const { searchParams, ...guestOptions } = ssfAppOptions;
|
|
59
|
+
const guest = ssfHost.loadGuest({
|
|
60
|
+
id,
|
|
61
|
+
url: hostUrl,
|
|
62
|
+
title: name,
|
|
63
|
+
targetElement: document.getElementById(containerId),
|
|
64
|
+
searchParams,
|
|
65
|
+
onLoad: onLoadComplete,
|
|
66
|
+
options: guestOptions
|
|
67
|
+
});
|
|
68
|
+
instanceId = guest.id;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
appBridge = await getAppBridge();
|
|
72
|
+
if (!appBridge)
|
|
73
|
+
throw new Error(`Failed to load ${id}, AppBridge not initialized`);
|
|
74
|
+
if (isMounted) {
|
|
75
|
+
instanceId = await appBridge.openApp({
|
|
76
|
+
id,
|
|
77
|
+
frameOptions: { containerId },
|
|
78
|
+
history,
|
|
79
|
+
homeRoute,
|
|
80
|
+
initialRoute
|
|
81
|
+
});
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
try {
|
|
84
|
+
onLoadComplete?.(instanceId);
|
|
85
|
+
} catch (ex) {
|
|
86
|
+
}
|
|
87
|
+
}, 0);
|
|
88
|
+
}
|
|
52
89
|
}
|
|
53
90
|
} catch (ex) {
|
|
54
91
|
getLogger().error({
|
|
@@ -58,6 +95,8 @@ const useAppRenderer = (props) => {
|
|
|
58
95
|
isMounted = false;
|
|
59
96
|
if (appBridge && instanceId)
|
|
60
97
|
unloadInProgress = appBridge.closeApp(instanceId);
|
|
98
|
+
if (ssfHost && instanceId)
|
|
99
|
+
unloadInProgress = Promise.resolve(ssfHost.unloadGuest(instanceId));
|
|
61
100
|
throw ex;
|
|
62
101
|
} finally {
|
|
63
102
|
dispatch(waitMessage.close());
|
|
@@ -65,19 +104,21 @@ const useAppRenderer = (props) => {
|
|
|
65
104
|
})();
|
|
66
105
|
return () => {
|
|
67
106
|
isMounted = false;
|
|
68
|
-
if (
|
|
107
|
+
if (ssfHost) {
|
|
108
|
+
unloadInProgress = Promise.resolve(ssfHost.unloadGuest(instanceId));
|
|
109
|
+
} else if (appBridge) {
|
|
69
110
|
unloadInProgress = appBridge.closeApp(instanceId);
|
|
70
|
-
unloadInProgress.then(() => {
|
|
71
|
-
instanceId = null;
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
try {
|
|
74
|
-
onUnloadComplete?.();
|
|
75
|
-
} catch (ex) {
|
|
76
|
-
}
|
|
77
|
-
}, 0);
|
|
78
|
-
}).catch(() => {
|
|
79
|
-
});
|
|
80
111
|
}
|
|
112
|
+
unloadInProgress.then(() => {
|
|
113
|
+
instanceId = null;
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
try {
|
|
116
|
+
onUnloadComplete?.();
|
|
117
|
+
} catch (ex) {
|
|
118
|
+
}
|
|
119
|
+
}, 0);
|
|
120
|
+
}).catch(() => {
|
|
121
|
+
});
|
|
81
122
|
};
|
|
82
123
|
}, [
|
|
83
124
|
containerId,
|
|
@@ -87,7 +128,9 @@ const useAppRenderer = (props) => {
|
|
|
87
128
|
initialRoute,
|
|
88
129
|
id,
|
|
89
130
|
onLoadComplete,
|
|
90
|
-
onUnloadComplete
|
|
131
|
+
onUnloadComplete,
|
|
132
|
+
getConfig,
|
|
133
|
+
ssfAppOptions
|
|
91
134
|
]);
|
|
92
135
|
};
|
|
93
136
|
const GuestMicroApp = memo(
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`GuestMicroApp with SSFHost should open ssfapp 1`] = `
|
|
4
|
+
"<html lang="en"><head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>SSFApp</title>
|
|
8
|
+
<!-- <script src="https://cdn.mortgagetech.q1.ice.com/ssf-guest"></script> -->
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<h1>SSF App</h1>
|
|
12
|
+
<output id="output">ssfapp starting
|
|
13
|
+
ssfapp loaded</output>
|
|
14
|
+
<script src="./latest/index.js"></script>
|
|
15
|
+
|
|
16
|
+
</body></html>"
|
|
17
|
+
`;
|
|
18
|
+
|
|
3
19
|
exports[`MicroAppV2 should open loanapp and call init and mount methods 1`] = `
|
|
4
20
|
Document {
|
|
5
21
|
"location": Location {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const LATEST_VERSION = "latest";
|
|
2
2
|
const RELEASE_VERSION = "23.1.0";
|
|
3
3
|
const LOAN_APP_ID = "loanapp";
|
|
4
|
+
const SSF_APP_ID = "ssfapp";
|
|
4
5
|
const TASK_APP_ID = "taskapp";
|
|
5
6
|
const FLIGHTS_APP_ID = "flights";
|
|
6
7
|
const HOTELS_APP_ID = "hotels";
|
|
@@ -20,5 +21,6 @@ export {
|
|
|
20
21
|
LOAN_SAVED_EVENT,
|
|
21
22
|
PRE_COMMIT_EVENT,
|
|
22
23
|
RELEASE_VERSION,
|
|
24
|
+
SSF_APP_ID,
|
|
23
25
|
TASK_APP_ID
|
|
24
26
|
};
|
|
@@ -172,6 +172,21 @@ const serverHandlers = [
|
|
|
172
172
|
"/loan/latest/manifest.json",
|
|
173
173
|
(req, res, ctx) => res(ctx.json(loanAppManifest))
|
|
174
174
|
),
|
|
175
|
+
rest.get("/ssfapp/", async (req, res, ctx) => {
|
|
176
|
+
const fileContent = await readFile(
|
|
177
|
+
path.join(__dirname, "ssfapp/index.html"),
|
|
178
|
+
"utf-8"
|
|
179
|
+
);
|
|
180
|
+
return res(
|
|
181
|
+
ctx.status(200),
|
|
182
|
+
ctx.set("Content-Type", "text/html"),
|
|
183
|
+
ctx.body(fileContent)
|
|
184
|
+
);
|
|
185
|
+
}),
|
|
186
|
+
rest.get("/ssfapp/latest/index.js", async (req, res, ctx) => {
|
|
187
|
+
const newRes = await sendJS(res, ctx, "./ssfapp/latest/index.js");
|
|
188
|
+
return newRes;
|
|
189
|
+
}),
|
|
175
190
|
...getServerHandlers()
|
|
176
191
|
];
|
|
177
192
|
export {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>SSFApp</title>
|
|
7
|
+
<!-- <script src="https://cdn.mortgagetech.q1.ice.com/ssf-guest"></script> -->
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<h1>SSF App</h1>
|
|
11
|
+
<output id="output"></output>
|
|
12
|
+
<script src="./latest/index.js"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const appId = "ssfapp";
|
|
2
|
+
const output = document.getElementById("output");
|
|
3
|
+
output.textContent = `${appId} starting`;
|
|
4
|
+
window.addEventListener("beforeunload", () => {
|
|
5
|
+
if (output) {
|
|
6
|
+
output.textContent += `
|
|
7
|
+
${appId} unloading`;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
document.addEventListener("load", () => {
|
|
11
|
+
if (output) {
|
|
12
|
+
output.textContent += `
|
|
13
|
+
${appId} loaded`;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DefaultTheme } from 'styled-components';
|
|
2
2
|
import { History, To } from 'history';
|
|
3
3
|
import type { IMicroAppGuest, IMicroAppHost, InitOptions, MountOptions } from '@elliemae/pui-micro-frontend-base';
|
|
4
|
+
import { SSFHost } from '@elliemae/ssf-host';
|
|
4
5
|
import { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
|
|
5
6
|
import { IMicroFEHost } from '@elliemae/pui-app-bridge';
|
|
6
7
|
import type { ScriptingObjects, EventListeners, SubscribeParam, UnsubscribeParam, DispatchEventParam, EventOptions, AddScriptingObjectParams } from '@elliemae/microfe-common';
|
|
@@ -24,6 +25,7 @@ interface ConstructorParams {
|
|
|
24
25
|
onUnmount?: OnUnMountCallback;
|
|
25
26
|
onGetRef?: OnGetRefCallback;
|
|
26
27
|
history?: History;
|
|
28
|
+
ssfHostRef?: SSFHost<ScriptingObjectTypes, Events> | null;
|
|
27
29
|
}
|
|
28
30
|
export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> implements IMicroAppGuest<AppObjects, AppEvents> {
|
|
29
31
|
#private;
|
|
@@ -73,10 +75,11 @@ export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partia
|
|
|
73
75
|
*/
|
|
74
76
|
addScriptingObject<SO extends AppObjects[keyof AppObjects]>(so: SO, params?: AddScriptingObjectParams): void;
|
|
75
77
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @param {
|
|
78
|
+
* Dispatches an event to the child microapp.
|
|
79
|
+
* @param {DispatchEventParam<EventId, Params, Options>} params - Event parameters.
|
|
80
|
+
* @returns {Promise<any[]>} A promise that resolves with the combined results of dispatched events.
|
|
78
81
|
*/
|
|
79
|
-
dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void>;
|
|
82
|
+
dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void | any[]>;
|
|
80
83
|
/**
|
|
81
84
|
* removes scripting object from child microapp use
|
|
82
85
|
* @param objectId unique id of the scripting object
|
|
@@ -76,7 +76,7 @@ export declare class CMicroAppHost<AppObjects extends ScriptingObjects = Partial
|
|
|
76
76
|
* dispatch event to child microapp
|
|
77
77
|
* @param {DispatchEventParams<EventId, Params>} params - event parameters
|
|
78
78
|
*/
|
|
79
|
-
dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void>;
|
|
79
|
+
dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void | any[]>;
|
|
80
80
|
/**
|
|
81
81
|
* removes scripting object from child microapp use
|
|
82
82
|
* @param objectId unique id of the scripting object
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SSFHost } from '@elliemae/ssf-host';
|
|
2
|
+
import { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
|
|
3
|
+
import type { ScriptingObjects, EventListeners } from '@elliemae/microfe-common';
|
|
4
|
+
export declare const getSSFHost: <AppObjects extends ScriptingObjects = ScriptingObjectTypes, AppEvents extends EventListeners = Events>() => SSFHost<AppObjects, AppEvents>;
|
|
5
|
+
export declare const setSSFHost: (host: SSFHost<any, any>) => void;
|
|
@@ -1,19 +1,86 @@
|
|
|
1
1
|
import { InitOptions } from '@elliemae/pui-micro-frontend-base';
|
|
2
2
|
import { Events, ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
|
|
3
|
+
/**
|
|
4
|
+
* Files specific to the mode of the micro-frontend application.
|
|
5
|
+
*/
|
|
3
6
|
type EnvConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* Array of file paths specific to the environment (development or production).
|
|
9
|
+
* relative or absolute URLs
|
|
10
|
+
*/
|
|
4
11
|
files: Array<string>;
|
|
5
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Modes in which a micro-frontend application can operate.
|
|
15
|
+
*/
|
|
16
|
+
export declare enum LaunchMode {
|
|
17
|
+
DEVELOPMENT = "development",
|
|
18
|
+
PRODUCTION = "production"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Library that manages the micro-frontend application.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum MicroAppManager {
|
|
24
|
+
SSF = "ssf",
|
|
25
|
+
APPSDK = "appsdk"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Configuration object for a micro-frontend application.
|
|
29
|
+
*/
|
|
6
30
|
export type MicroAppConfig = {
|
|
31
|
+
/**
|
|
32
|
+
* Unique identifier for the micro-frontend application.
|
|
33
|
+
*/
|
|
7
34
|
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Human-readable name for the micro-frontend application.
|
|
37
|
+
*/
|
|
8
38
|
name: string;
|
|
9
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Optional title for the micro-frontend application.
|
|
41
|
+
*/
|
|
42
|
+
title?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Mode in which the micro-frontend operates (e.g., 'development', 'production').
|
|
45
|
+
*/
|
|
46
|
+
mode?: LaunchMode;
|
|
47
|
+
/**
|
|
48
|
+
* Base URL where the micro-frontend is hosted.
|
|
49
|
+
*/
|
|
10
50
|
hostUrl?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Path to the manifest file for the micro-frontend.
|
|
53
|
+
*/
|
|
11
54
|
manifestPath?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Route to the home page of the micro-frontend application.
|
|
57
|
+
*/
|
|
12
58
|
homeRoute: string;
|
|
59
|
+
/**
|
|
60
|
+
* If true, the micro-frontend is treated as a JavaScript module.
|
|
61
|
+
*/
|
|
13
62
|
isJsModule?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Library that manages the micro-frontend application (e.g., 'ssf', 'appsdk').
|
|
65
|
+
* @default 'appsdk'
|
|
66
|
+
*/
|
|
67
|
+
microappManager?: MicroAppManager;
|
|
68
|
+
/**
|
|
69
|
+
* Array of file paths required by the micro-frontend application.
|
|
70
|
+
* relative or absolute URLs
|
|
71
|
+
*/
|
|
14
72
|
files?: Array<string>;
|
|
73
|
+
/**
|
|
74
|
+
* files specific to the development build.
|
|
75
|
+
*/
|
|
15
76
|
development?: EnvConfig;
|
|
77
|
+
/**
|
|
78
|
+
* files specific to the production build.
|
|
79
|
+
*/
|
|
16
80
|
production?: EnvConfig;
|
|
81
|
+
/**
|
|
82
|
+
* The Document object associated with the micro-frontend application.
|
|
83
|
+
*/
|
|
17
84
|
documentEle: Document;
|
|
18
85
|
} & InitOptions<Partial<ScriptingObjectTypes>, Events>;
|
|
19
86
|
export {};
|
|
@@ -1,10 +1,59 @@
|
|
|
1
|
+
import { OpenMode, IFrameSandboxValues, WindowFeatures } from '@elliemae/ssf-host';
|
|
1
2
|
import { OpenAppParams } from '@elliemae/pui-app-bridge';
|
|
2
3
|
export type OnLoadCompleteFn = (instanceId: string) => void;
|
|
3
4
|
export type OnUnloadCompleteFn = () => void;
|
|
5
|
+
/**
|
|
6
|
+
* parameters for the ssf microapp components
|
|
7
|
+
*/
|
|
8
|
+
export type SSFMicroAppParams<SearchParams> = {
|
|
9
|
+
/**
|
|
10
|
+
* individual query parameters indicating guest application's url parameter string
|
|
11
|
+
*/
|
|
12
|
+
searchParams?: SearchParams;
|
|
13
|
+
/**
|
|
14
|
+
* mode of opening the guest application, popup or embed
|
|
15
|
+
* @default OpenMode.Embed
|
|
16
|
+
*/
|
|
17
|
+
openMode?: OpenMode;
|
|
18
|
+
/**
|
|
19
|
+
* flag to disable sandboxing for iframe
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
disableSandbox?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* sandbox values for iframe
|
|
25
|
+
* @default [IFrameSandboxValues.AllowScripts, IFrameSandboxValues.AllowPopups, IFrameSandboxValues.AllowModals, IFrameSandboxValues.AllowForms, IFrameSandboxValues.AllowDownloads, IFrameSandboxValues.AllowSameOrigin ]
|
|
26
|
+
*/
|
|
27
|
+
sandboxValues?: Array<IFrameSandboxValues>;
|
|
28
|
+
/**
|
|
29
|
+
* resize the iframe to fit the content inside
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
fitToContent?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* css style for the microapp iframe
|
|
35
|
+
*/
|
|
36
|
+
style?: string;
|
|
37
|
+
/**
|
|
38
|
+
* features for the popup window
|
|
39
|
+
* @default { width: 800, height: 600, top: 100, left: 100 }
|
|
40
|
+
*/
|
|
41
|
+
popupWindowFeatures?: WindowFeatures;
|
|
42
|
+
/**
|
|
43
|
+
* permission policy for the guest iframe
|
|
44
|
+
* check https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow for more details
|
|
45
|
+
* @example "microphone 'self' https://example.com; geolocation 'none'"
|
|
46
|
+
*/
|
|
47
|
+
permissionPolicy?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Parameters for the GuestMicroApp component.
|
|
51
|
+
*/
|
|
4
52
|
export type GuestMicroAppParams = OpenAppParams & {
|
|
5
53
|
onLoadComplete?: OnLoadCompleteFn;
|
|
6
54
|
onUnloadComplete?: OnUnloadCompleteFn;
|
|
7
55
|
containerId?: string;
|
|
56
|
+
ssfAppOptions?: SSFMicroAppParams<Record<string, string | number | boolean>>;
|
|
8
57
|
};
|
|
9
58
|
/**
|
|
10
59
|
* Component to load a guest microapp
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const LATEST_VERSION = "latest";
|
|
2
2
|
export declare const RELEASE_VERSION = "23.1.0";
|
|
3
3
|
export declare const LOAN_APP_ID = "loanapp";
|
|
4
|
+
export declare const SSF_APP_ID = "ssfapp";
|
|
4
5
|
export declare const TASK_APP_ID = "taskapp";
|
|
5
6
|
export declare const FLIGHTS_APP_ID = "flights";
|
|
6
7
|
export declare const HOTELS_APP_ID = "hotels";
|