@elliemae/pui-app-sdk 5.31.0-beta.1 → 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/dist/cjs/utils/micro-frontend/index.js +3 -2
- package/dist/cjs/utils/micro-frontend/types.js +18 -0
- package/dist/cjs/view/guest-microapp.js +15 -5
- package/dist/cjs/view/tests/app.config.json +1 -7
- package/dist/esm/utils/micro-frontend/index.js +3 -2
- package/dist/esm/utils/micro-frontend/types.js +14 -0
- package/dist/esm/view/guest-microapp.js +15 -5
- package/dist/esm/view/tests/app.config.json +1 -7
- package/dist/types/lib/utils/micro-frontend/types.d.ts +66 -3
- package/dist/types/lib/view/guest-microapp.d.ts +49 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -40,13 +40,14 @@ var import_guest = require("./guest.js");
|
|
|
40
40
|
var import_host = require("./host.js");
|
|
41
41
|
var import_config = require("../app-config/config.js");
|
|
42
42
|
var import_helpers = require("../helpers.js");
|
|
43
|
+
var import_types2 = require("./types.js");
|
|
43
44
|
const isHost = () => import_host.CMicroAppHost.isInitialized();
|
|
44
45
|
const isGuest = () => import_guest.CMicroAppGuest.isInitialized();
|
|
45
46
|
const isStandAloneGuest = () => isGuest() && window.top === window.self;
|
|
46
47
|
const getLogger = () => isHost() ? import_host.CMicroAppHost.getInstance().getLogger() : import_guest.CMicroAppGuest.getInstance().getLogger();
|
|
47
48
|
const isProduction = (mode) => {
|
|
48
49
|
if ((0, import_helpers.isCIBuild)()) return true;
|
|
49
|
-
if (mode) return mode ===
|
|
50
|
+
if (mode) return mode === import_types2.LaunchMode.PRODUCTION;
|
|
50
51
|
return true;
|
|
51
52
|
};
|
|
52
53
|
const getVersionedPath = (path) => {
|
|
@@ -65,7 +66,7 @@ const getMicroFrontEndAppConfig = (appInfo) => {
|
|
|
65
66
|
throw new Error(
|
|
66
67
|
`unable to locate application configuraiton for ${appInfo.id} under microFrontendApps section of app.config.json`
|
|
67
68
|
);
|
|
68
|
-
const { mode =
|
|
69
|
+
const { mode = import_types2.LaunchMode.PRODUCTION } = microFEAppConfig;
|
|
69
70
|
const envConfig = isProduction(mode) ? microFEAppConfig.production : microFEAppConfig.development;
|
|
70
71
|
if (microFEAppConfig.production) delete microFEAppConfig.production;
|
|
71
72
|
if (microFEAppConfig.development) delete microFEAppConfig.development;
|
|
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
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
|
+
};
|
|
6
10
|
var __copyProps = (to, from, except, desc) => {
|
|
7
11
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
12
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,4 +17,18 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
};
|
|
14
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
19
|
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
LaunchMode: () => LaunchMode,
|
|
22
|
+
MicroAppManager: () => MicroAppManager
|
|
23
|
+
});
|
|
16
24
|
module.exports = __toCommonJS(types_exports);
|
|
25
|
+
var LaunchMode = /* @__PURE__ */ ((LaunchMode2) => {
|
|
26
|
+
LaunchMode2["DEVELOPMENT"] = "development";
|
|
27
|
+
LaunchMode2["PRODUCTION"] = "production";
|
|
28
|
+
return LaunchMode2;
|
|
29
|
+
})(LaunchMode || {});
|
|
30
|
+
var MicroAppManager = /* @__PURE__ */ ((MicroAppManager2) => {
|
|
31
|
+
MicroAppManager2["SSF"] = "ssf";
|
|
32
|
+
MicroAppManager2["APPSDK"] = "appsdk";
|
|
33
|
+
return MicroAppManager2;
|
|
34
|
+
})(MicroAppManager || {});
|
|
@@ -35,6 +35,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
35
|
var import_react = require("react");
|
|
36
36
|
var import_styled_components = __toESM(require("styled-components"));
|
|
37
37
|
var import_react_redux = require("react-redux");
|
|
38
|
+
var import_types = require("../utils/micro-frontend/types.js");
|
|
38
39
|
var import_app_bridge = require("../utils/micro-frontend/app-bridge.js");
|
|
39
40
|
var import_ssf_host2 = require("../utils/micro-frontend/ssf-host.js");
|
|
40
41
|
var import_actions = require("../data/wait-message/actions.js");
|
|
@@ -54,7 +55,8 @@ const useAppRenderer = (props) => {
|
|
|
54
55
|
initialRoute,
|
|
55
56
|
onLoadComplete,
|
|
56
57
|
onUnloadComplete,
|
|
57
|
-
containerId
|
|
58
|
+
containerId,
|
|
59
|
+
ssfAppOptions = {}
|
|
58
60
|
} = props;
|
|
59
61
|
const dispatch = (0, import_react_redux.useDispatch)();
|
|
60
62
|
const getConfig = (0, import_react.useCallback)(
|
|
@@ -73,18 +75,25 @@ const useAppRenderer = (props) => {
|
|
|
73
75
|
await unloadInProgress;
|
|
74
76
|
dispatch(import_actions.waitMessage.open());
|
|
75
77
|
try {
|
|
76
|
-
const {
|
|
77
|
-
|
|
78
|
+
const {
|
|
79
|
+
microappManager = import_types.MicroAppManager.APPSDK,
|
|
80
|
+
hostUrl,
|
|
81
|
+
name
|
|
82
|
+
} = getConfig();
|
|
83
|
+
if (microappManager === import_types.MicroAppManager.SSF) {
|
|
78
84
|
ssfHost = (0, import_ssf_host2.getSSFHost)();
|
|
79
85
|
if (!ssfHost)
|
|
80
86
|
throw new Error(`Failed to load ${id}, SSFHost not initialized`);
|
|
81
87
|
if (isMounted) {
|
|
88
|
+
const { searchParams, ...guestOptions } = ssfAppOptions;
|
|
82
89
|
const guest = ssfHost.loadGuest({
|
|
83
90
|
id,
|
|
84
91
|
url: hostUrl,
|
|
85
92
|
title: name,
|
|
86
93
|
targetElement: document.getElementById(containerId),
|
|
87
|
-
|
|
94
|
+
searchParams,
|
|
95
|
+
onLoad: onLoadComplete,
|
|
96
|
+
options: guestOptions
|
|
88
97
|
});
|
|
89
98
|
instanceId = guest.id;
|
|
90
99
|
}
|
|
@@ -150,7 +159,8 @@ const useAppRenderer = (props) => {
|
|
|
150
159
|
id,
|
|
151
160
|
onLoadComplete,
|
|
152
161
|
onUnloadComplete,
|
|
153
|
-
getConfig
|
|
162
|
+
getConfig,
|
|
163
|
+
ssfAppOptions
|
|
154
164
|
]);
|
|
155
165
|
};
|
|
156
166
|
const GuestMicroApp = (0, import_react.memo)(
|
|
@@ -18,13 +18,7 @@
|
|
|
18
18
|
"ssfapp": {
|
|
19
19
|
"name": "SSF App",
|
|
20
20
|
"hostUrl": "./ssfapp",
|
|
21
|
-
"
|
|
22
|
-
"development": {
|
|
23
|
-
"files": ["index.js"]
|
|
24
|
-
},
|
|
25
|
-
"production": {
|
|
26
|
-
"files": ["index.js"]
|
|
27
|
-
}
|
|
21
|
+
"microappManager": "ssf"
|
|
28
22
|
},
|
|
29
23
|
"taskapp": {
|
|
30
24
|
"name": "Task",
|
|
@@ -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;
|
|
@@ -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
|
+
};
|
|
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
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";
|
|
6
7
|
import { getSSFHost } from "../utils/micro-frontend/ssf-host.js";
|
|
7
8
|
import { waitMessage } from "../data/wait-message/actions.js";
|
|
@@ -24,7 +25,8 @@ const useAppRenderer = (props) => {
|
|
|
24
25
|
initialRoute,
|
|
25
26
|
onLoadComplete,
|
|
26
27
|
onUnloadComplete,
|
|
27
|
-
containerId
|
|
28
|
+
containerId,
|
|
29
|
+
ssfAppOptions = {}
|
|
28
30
|
} = props;
|
|
29
31
|
const dispatch = useDispatch();
|
|
30
32
|
const getConfig = useCallback(
|
|
@@ -43,18 +45,25 @@ const useAppRenderer = (props) => {
|
|
|
43
45
|
await unloadInProgress;
|
|
44
46
|
dispatch(waitMessage.open());
|
|
45
47
|
try {
|
|
46
|
-
const {
|
|
47
|
-
|
|
48
|
+
const {
|
|
49
|
+
microappManager = MicroAppManager.APPSDK,
|
|
50
|
+
hostUrl,
|
|
51
|
+
name
|
|
52
|
+
} = getConfig();
|
|
53
|
+
if (microappManager === MicroAppManager.SSF) {
|
|
48
54
|
ssfHost = getSSFHost();
|
|
49
55
|
if (!ssfHost)
|
|
50
56
|
throw new Error(`Failed to load ${id}, SSFHost not initialized`);
|
|
51
57
|
if (isMounted) {
|
|
58
|
+
const { searchParams, ...guestOptions } = ssfAppOptions;
|
|
52
59
|
const guest = ssfHost.loadGuest({
|
|
53
60
|
id,
|
|
54
61
|
url: hostUrl,
|
|
55
62
|
title: name,
|
|
56
63
|
targetElement: document.getElementById(containerId),
|
|
57
|
-
|
|
64
|
+
searchParams,
|
|
65
|
+
onLoad: onLoadComplete,
|
|
66
|
+
options: guestOptions
|
|
58
67
|
});
|
|
59
68
|
instanceId = guest.id;
|
|
60
69
|
}
|
|
@@ -120,7 +129,8 @@ const useAppRenderer = (props) => {
|
|
|
120
129
|
id,
|
|
121
130
|
onLoadComplete,
|
|
122
131
|
onUnloadComplete,
|
|
123
|
-
getConfig
|
|
132
|
+
getConfig,
|
|
133
|
+
ssfAppOptions
|
|
124
134
|
]);
|
|
125
135
|
};
|
|
126
136
|
const GuestMicroApp = memo(
|
|
@@ -18,13 +18,7 @@
|
|
|
18
18
|
"ssfapp": {
|
|
19
19
|
"name": "SSF App",
|
|
20
20
|
"hostUrl": "./ssfapp",
|
|
21
|
-
"
|
|
22
|
-
"development": {
|
|
23
|
-
"files": ["index.js"]
|
|
24
|
-
},
|
|
25
|
-
"production": {
|
|
26
|
-
"files": ["index.js"]
|
|
27
|
-
}
|
|
21
|
+
"microappManager": "ssf"
|
|
28
22
|
},
|
|
29
23
|
"taskapp": {
|
|
30
24
|
"name": "Task",
|
|
@@ -1,23 +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;
|
|
14
63
|
/**
|
|
15
|
-
*
|
|
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
|
|
16
71
|
*/
|
|
17
|
-
ssfOnly?: boolean;
|
|
18
72
|
files?: Array<string>;
|
|
73
|
+
/**
|
|
74
|
+
* files specific to the development build.
|
|
75
|
+
*/
|
|
19
76
|
development?: EnvConfig;
|
|
77
|
+
/**
|
|
78
|
+
* files specific to the production build.
|
|
79
|
+
*/
|
|
20
80
|
production?: EnvConfig;
|
|
81
|
+
/**
|
|
82
|
+
* The Document object associated with the micro-frontend application.
|
|
83
|
+
*/
|
|
21
84
|
documentEle: Document;
|
|
22
85
|
} & InitOptions<Partial<ScriptingObjectTypes>, Events>;
|
|
23
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
|