@elliemae/microfe-common 2.29.0-alpha.0 → 2.29.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/dist/cjs/event.js +2 -0
- package/dist/cjs/host.js +14 -20
- package/dist/cjs/loader.js +2 -1
- package/dist/cjs/proxy.js +6 -7
- package/dist/cjs/remoting.js +1 -0
- package/dist/cjs/scriptingObject.js +2 -0
- package/dist/cjs/scriptingObjectManager.js +11 -32
- package/dist/cjs/window.js +2 -2
- package/dist/esm/event.js +2 -0
- package/dist/esm/host.js +13 -19
- package/dist/esm/loader.js +2 -1
- package/dist/esm/proxy.js +6 -7
- package/dist/esm/remoting.js +1 -0
- package/dist/esm/scriptingObject.js +2 -0
- package/dist/esm/scriptingObjectManager.js +11 -32
- package/dist/esm/window.js +2 -2
- package/dist/types/lib/app.d.ts +1 -1
- package/dist/types/lib/common.d.ts +2 -2
- package/dist/types/lib/event.d.ts +7 -7
- package/dist/types/lib/guest.d.ts +5 -5
- package/dist/types/lib/host.d.ts +6 -7
- package/dist/types/lib/loader.d.ts +1 -1
- package/dist/types/lib/proxy.d.ts +1 -1
- package/dist/types/lib/remoting.d.ts +2 -2
- package/dist/types/lib/remotingEventMessage.d.ts +3 -3
- package/dist/types/lib/scriptLoader.d.ts +1 -1
- package/dist/types/lib/scriptingObject.d.ts +1 -1
- package/dist/types/lib/scriptingObjectManager.d.ts +8 -2
- package/dist/types/lib/styleLoader.d.ts +1 -1
- package/dist/types/lib/tests/server.d.ts +1 -1
- package/dist/types/lib/typings/guest.d.ts +7 -7
- package/dist/types/lib/typings/host.d.ts +1 -1
- package/dist/types/lib/typings/microapp.d.ts +1 -1
- package/dist/types/lib/window.d.ts +4 -4
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -16
package/dist/cjs/event.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(event_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(event_exports);
|
|
27
27
|
class Event {
|
|
28
|
+
/* eslint-enable indent */
|
|
28
29
|
/**
|
|
29
30
|
* name of the event
|
|
30
31
|
*/
|
|
@@ -59,6 +60,7 @@ class ProxyEvent {
|
|
|
59
60
|
static [Symbol.hasInstance](obj) {
|
|
60
61
|
return typeof obj === "object" && obj !== null && "getType" in obj && typeof obj.getType === "function" && obj.getType() === "ProxyEvent";
|
|
61
62
|
}
|
|
63
|
+
/* eslint-enable indent */
|
|
62
64
|
/**
|
|
63
65
|
* module that owns this event management. SSF Guest or App Bridge host
|
|
64
66
|
*/
|
package/dist/cjs/host.js
CHANGED
|
@@ -25,13 +25,8 @@ var import_pubsub_js = require("pubsub-js");
|
|
|
25
25
|
var import_pui_theme = require("@elliemae/pui-theme");
|
|
26
26
|
var import_frame = require("./frame.js");
|
|
27
27
|
var import_config = require("./config.js");
|
|
28
|
-
var
|
|
28
|
+
var import_history2 = require("./history.js");
|
|
29
29
|
var import_logger = require("./logger.js");
|
|
30
|
-
const buildHostOptions = (params) => ({
|
|
31
|
-
systemVersion: params?.version ?? "latest",
|
|
32
|
-
history: params?.history ?? import_history.browserHistory,
|
|
33
|
-
theme: params?.theme ?? (0, import_pui_theme.getDefaultTheme)()
|
|
34
|
-
});
|
|
35
30
|
class CMicroAppHost {
|
|
36
31
|
static instance;
|
|
37
32
|
logger;
|
|
@@ -41,30 +36,28 @@ class CMicroAppHost {
|
|
|
41
36
|
onInit;
|
|
42
37
|
onRenewSessionTimer;
|
|
43
38
|
scriptingObjects;
|
|
44
|
-
|
|
39
|
+
constructor(params) {
|
|
40
|
+
this.appId = (0, import_config.getAppConfigValue)("appId");
|
|
41
|
+
this.onInit = params?.onInit;
|
|
42
|
+
this.logger = params?.logger || import_logger.logger;
|
|
43
|
+
this.onRenewSessionTimer = params?.onRenewSessionTimer;
|
|
44
|
+
this.props = {
|
|
45
|
+
systemVersion: params?.version ?? "latest",
|
|
46
|
+
history: params?.history ?? import_history2.browserHistory,
|
|
47
|
+
theme: params?.theme ?? (0, import_pui_theme.getDefaultTheme)()
|
|
48
|
+
};
|
|
49
|
+
this.activeGuests = {};
|
|
50
|
+
this.scriptingObjects = params?.scriptingObjects ?? {};
|
|
45
51
|
this.getProps = this.getProps.bind(this);
|
|
46
52
|
this.getLogger = this.getLogger.bind(this);
|
|
47
53
|
this.getGuests = this.getGuests.bind(this);
|
|
48
54
|
this.getGuest = this.getGuest.bind(this);
|
|
49
55
|
this.getObject = this.getObject.bind(this);
|
|
50
|
-
}
|
|
51
|
-
#scheduleConfigLoad() {
|
|
52
56
|
(0, import_config.loadAppConfig)().then(() => {
|
|
53
57
|
if (this.onInit) this.onInit(this.props);
|
|
54
58
|
}).catch(() => {
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
|
-
constructor(params) {
|
|
58
|
-
this.appId = (0, import_config.getAppConfigValue)("appId");
|
|
59
|
-
this.onInit = params?.onInit;
|
|
60
|
-
this.logger = params?.logger || import_logger.logger;
|
|
61
|
-
this.onRenewSessionTimer = params?.onRenewSessionTimer;
|
|
62
|
-
this.props = buildHostOptions(params);
|
|
63
|
-
this.activeGuests = {};
|
|
64
|
-
this.scriptingObjects = params?.scriptingObjects ?? {};
|
|
65
|
-
this.#bindInstanceMethods();
|
|
66
|
-
this.#scheduleConfigLoad();
|
|
67
|
-
}
|
|
68
61
|
static getInstance(params) {
|
|
69
62
|
if (!this.instance) {
|
|
70
63
|
this.instance = new this(params);
|
|
@@ -102,6 +95,7 @@ class CMicroAppHost {
|
|
|
102
95
|
publish(eventId, data) {
|
|
103
96
|
return (0, import_pubsub_js.publish)(eventId, data);
|
|
104
97
|
}
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
105
99
|
subscribe(eventId, listener) {
|
|
106
100
|
return (0, import_pubsub_js.subscribe)(eventId, listener);
|
|
107
101
|
}
|
package/dist/cjs/loader.js
CHANGED
|
@@ -129,8 +129,9 @@ const sanitizeAppConfig = (appConfig) => {
|
|
|
129
129
|
const loadApp = async (appConfig) => {
|
|
130
130
|
import_logger.logger.info(import_logRecords.logRecords.APP_LOADING(appConfig.id));
|
|
131
131
|
sanitizeAppConfig(appConfig);
|
|
132
|
+
let assets = appConfig.files;
|
|
132
133
|
const manifest = await (0, import_manifestLoader.getAppManifest)(appConfig);
|
|
133
|
-
|
|
134
|
+
assets = (0, import_manifestLoader.getFullFileNameofAssetsFromManifest)(manifest, appConfig.files);
|
|
134
135
|
let counter = 0;
|
|
135
136
|
const requests = assets.map((fileName) => {
|
|
136
137
|
counter += 1;
|
package/dist/cjs/proxy.js
CHANGED
|
@@ -45,10 +45,9 @@ class ScriptingObjectProxy {
|
|
|
45
45
|
this.objectType = objectType;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const isScriptingObjectProxy = (value) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
48
|
+
const isScriptingObjectProxy = (value) => (
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
50
|
+
value?.constructor?.name === "Proxy" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
51
|
+
value?.constructor?.name === "ScriptingObjectProxy" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-underscore-dangle
|
|
52
|
+
value?.__TYPE__ === "Proxy"
|
|
53
|
+
);
|
package/dist/cjs/remoting.js
CHANGED
|
@@ -35,6 +35,7 @@ const createMessage = ({
|
|
|
35
35
|
requestId: requestId ?? (!onewayMsg ? (0, import_uuid.v4)() : null),
|
|
36
36
|
source: MESSAGE_SOURCE,
|
|
37
37
|
type: messageType,
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
38
39
|
body: messageBody
|
|
39
40
|
});
|
|
40
41
|
const sendMessage = (param) => {
|
|
@@ -59,6 +59,7 @@ class ScriptingObject {
|
|
|
59
59
|
* transform the scripting object to a format suitable for transmitting over window.postMessage
|
|
60
60
|
* @returns marshalled scripting object
|
|
61
61
|
*/
|
|
62
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
62
63
|
_toJSON = () => {
|
|
63
64
|
const functions = [];
|
|
64
65
|
const events = [];
|
|
@@ -80,6 +81,7 @@ class ScriptingObject {
|
|
|
80
81
|
/**
|
|
81
82
|
* dispose the scripting object
|
|
82
83
|
*/
|
|
84
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
83
85
|
_dispose = () => {
|
|
84
86
|
};
|
|
85
87
|
/**
|
|
@@ -132,49 +132,28 @@ class ScriptingObjectManager {
|
|
|
132
132
|
* @param {AddScriptingObjectParams<ValueOf<AppObjects>>}
|
|
133
133
|
* @param params
|
|
134
134
|
*/
|
|
135
|
-
#assertValidScriptingObject = (so) => {
|
|
136
|
-
if (!so?.id || !so?._toJSON) {
|
|
137
|
-
throw new Error("Object is not derived from ScriptingObject");
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
#assertModuleHasGuest = (objectId, guestId) => {
|
|
141
|
-
if (objectId === MODULE_OBJECT && !guestId) {
|
|
142
|
-
throw new Error(`Guest id is required to add Module scripting object`);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
#registerGlobalScriptingObject = ({
|
|
146
|
-
objectId,
|
|
147
|
-
so,
|
|
148
|
-
guestId,
|
|
149
|
-
securityContext,
|
|
150
|
-
onDuplicate
|
|
151
|
-
}) => {
|
|
152
|
-
if (this.#scriptingObjects.has(objectId)) {
|
|
153
|
-
if (onDuplicate === "ignore" /* IGNORE */) return;
|
|
154
|
-
throw new Error(`Scripting Object ${so.id} already exists`);
|
|
155
|
-
}
|
|
156
|
-
this.#scriptingObjects.set(objectId, { so, guestId, securityContext });
|
|
157
|
-
};
|
|
158
135
|
addScriptingObject = (so, params) => {
|
|
159
136
|
const {
|
|
160
137
|
guestId,
|
|
161
138
|
onDuplicate = "throw" /* THROW */,
|
|
162
139
|
securityContext
|
|
163
140
|
} = params || {};
|
|
164
|
-
|
|
141
|
+
if (!so?.id || !so?._toJSON) {
|
|
142
|
+
throw new Error("Object is not derived from ScriptingObject");
|
|
143
|
+
}
|
|
165
144
|
const objectId = this.#normalizeId(so.id);
|
|
166
|
-
|
|
145
|
+
if (objectId === MODULE_OBJECT && !guestId) {
|
|
146
|
+
throw new Error(`Guest id is required to add Module scripting object`);
|
|
147
|
+
}
|
|
167
148
|
if (guestId) {
|
|
168
149
|
this.#addGuestScriptingObject({ so, ...params, guestId, onDuplicate });
|
|
169
150
|
return;
|
|
170
151
|
}
|
|
171
|
-
this.#
|
|
172
|
-
|
|
173
|
-
so
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
onDuplicate
|
|
177
|
-
});
|
|
152
|
+
if (this.#scriptingObjects.has(objectId)) {
|
|
153
|
+
if (onDuplicate === "ignore" /* IGNORE */) return;
|
|
154
|
+
throw new Error(`Scripting Object ${so.id} already exists`);
|
|
155
|
+
}
|
|
156
|
+
this.#scriptingObjects.set(objectId, { so, guestId, securityContext });
|
|
178
157
|
};
|
|
179
158
|
/**
|
|
180
159
|
* Get reference to the scripting object proxy for a guest
|
package/dist/cjs/window.js
CHANGED
|
@@ -30,7 +30,7 @@ const getWindow = () => {
|
|
|
30
30
|
try {
|
|
31
31
|
window.parent.document;
|
|
32
32
|
return window.parent;
|
|
33
|
-
} catch {
|
|
33
|
+
} catch (err) {
|
|
34
34
|
return window;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
@@ -57,7 +57,7 @@ const isCrossDomain = () => {
|
|
|
57
57
|
try {
|
|
58
58
|
window.parent.document;
|
|
59
59
|
return false;
|
|
60
|
-
} catch {
|
|
60
|
+
} catch (ex) {
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
};
|
package/dist/esm/event.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
class Event {
|
|
2
|
+
/* eslint-enable indent */
|
|
2
3
|
/**
|
|
3
4
|
* name of the event
|
|
4
5
|
*/
|
|
@@ -33,6 +34,7 @@ class ProxyEvent {
|
|
|
33
34
|
static [Symbol.hasInstance](obj) {
|
|
34
35
|
return typeof obj === "object" && obj !== null && "getType" in obj && typeof obj.getType === "function" && obj.getType() === "ProxyEvent";
|
|
35
36
|
}
|
|
37
|
+
/* eslint-enable indent */
|
|
36
38
|
/**
|
|
37
39
|
* module that owns this event management. SSF Guest or App Bridge host
|
|
38
40
|
*/
|
package/dist/esm/host.js
CHANGED
|
@@ -4,11 +4,6 @@ import { FRAME_CONTAINER_ID_PREFIX } from "./frame.js";
|
|
|
4
4
|
import { getAppConfigValue, loadAppConfig } from "./config.js";
|
|
5
5
|
import { browserHistory } from "./history.js";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
|
-
const buildHostOptions = (params) => ({
|
|
8
|
-
systemVersion: params?.version ?? "latest",
|
|
9
|
-
history: params?.history ?? browserHistory,
|
|
10
|
-
theme: params?.theme ?? getDefaultTheme()
|
|
11
|
-
});
|
|
12
7
|
class CMicroAppHost {
|
|
13
8
|
static instance;
|
|
14
9
|
logger;
|
|
@@ -18,30 +13,28 @@ class CMicroAppHost {
|
|
|
18
13
|
onInit;
|
|
19
14
|
onRenewSessionTimer;
|
|
20
15
|
scriptingObjects;
|
|
21
|
-
|
|
16
|
+
constructor(params) {
|
|
17
|
+
this.appId = getAppConfigValue("appId");
|
|
18
|
+
this.onInit = params?.onInit;
|
|
19
|
+
this.logger = params?.logger || logger;
|
|
20
|
+
this.onRenewSessionTimer = params?.onRenewSessionTimer;
|
|
21
|
+
this.props = {
|
|
22
|
+
systemVersion: params?.version ?? "latest",
|
|
23
|
+
history: params?.history ?? browserHistory,
|
|
24
|
+
theme: params?.theme ?? getDefaultTheme()
|
|
25
|
+
};
|
|
26
|
+
this.activeGuests = {};
|
|
27
|
+
this.scriptingObjects = params?.scriptingObjects ?? {};
|
|
22
28
|
this.getProps = this.getProps.bind(this);
|
|
23
29
|
this.getLogger = this.getLogger.bind(this);
|
|
24
30
|
this.getGuests = this.getGuests.bind(this);
|
|
25
31
|
this.getGuest = this.getGuest.bind(this);
|
|
26
32
|
this.getObject = this.getObject.bind(this);
|
|
27
|
-
}
|
|
28
|
-
#scheduleConfigLoad() {
|
|
29
33
|
loadAppConfig().then(() => {
|
|
30
34
|
if (this.onInit) this.onInit(this.props);
|
|
31
35
|
}).catch(() => {
|
|
32
36
|
});
|
|
33
37
|
}
|
|
34
|
-
constructor(params) {
|
|
35
|
-
this.appId = getAppConfigValue("appId");
|
|
36
|
-
this.onInit = params?.onInit;
|
|
37
|
-
this.logger = params?.logger || logger;
|
|
38
|
-
this.onRenewSessionTimer = params?.onRenewSessionTimer;
|
|
39
|
-
this.props = buildHostOptions(params);
|
|
40
|
-
this.activeGuests = {};
|
|
41
|
-
this.scriptingObjects = params?.scriptingObjects ?? {};
|
|
42
|
-
this.#bindInstanceMethods();
|
|
43
|
-
this.#scheduleConfigLoad();
|
|
44
|
-
}
|
|
45
38
|
static getInstance(params) {
|
|
46
39
|
if (!this.instance) {
|
|
47
40
|
this.instance = new this(params);
|
|
@@ -79,6 +72,7 @@ class CMicroAppHost {
|
|
|
79
72
|
publish(eventId, data) {
|
|
80
73
|
return publish(eventId, data);
|
|
81
74
|
}
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
82
76
|
subscribe(eventId, listener) {
|
|
83
77
|
return subscribe(eventId, listener);
|
|
84
78
|
}
|
package/dist/esm/loader.js
CHANGED
|
@@ -110,8 +110,9 @@ const sanitizeAppConfig = (appConfig) => {
|
|
|
110
110
|
const loadApp = async (appConfig) => {
|
|
111
111
|
logger.info(logRecords.APP_LOADING(appConfig.id));
|
|
112
112
|
sanitizeAppConfig(appConfig);
|
|
113
|
+
let assets = appConfig.files;
|
|
113
114
|
const manifest = await getAppManifest(appConfig);
|
|
114
|
-
|
|
115
|
+
assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files);
|
|
115
116
|
let counter = 0;
|
|
116
117
|
const requests = assets.map((fileName) => {
|
|
117
118
|
counter += 1;
|
package/dist/esm/proxy.js
CHANGED
|
@@ -21,13 +21,12 @@ class ScriptingObjectProxy {
|
|
|
21
21
|
this.objectType = objectType;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
const isScriptingObjectProxy = (value) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
const isScriptingObjectProxy = (value) => (
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
26
|
+
value?.constructor?.name === "Proxy" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
27
|
+
value?.constructor?.name === "ScriptingObjectProxy" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, no-underscore-dangle
|
|
28
|
+
value?.__TYPE__ === "Proxy"
|
|
29
|
+
);
|
|
31
30
|
export {
|
|
32
31
|
ScriptingObjectProxy,
|
|
33
32
|
isScriptingObjectProxy
|
package/dist/esm/remoting.js
CHANGED
|
@@ -11,6 +11,7 @@ const createMessage = ({
|
|
|
11
11
|
requestId: requestId ?? (!onewayMsg ? uuidv4() : null),
|
|
12
12
|
source: MESSAGE_SOURCE,
|
|
13
13
|
type: messageType,
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
14
15
|
body: messageBody
|
|
15
16
|
});
|
|
16
17
|
const sendMessage = (param) => {
|
|
@@ -35,6 +35,7 @@ class ScriptingObject {
|
|
|
35
35
|
* transform the scripting object to a format suitable for transmitting over window.postMessage
|
|
36
36
|
* @returns marshalled scripting object
|
|
37
37
|
*/
|
|
38
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
38
39
|
_toJSON = () => {
|
|
39
40
|
const functions = [];
|
|
40
41
|
const events = [];
|
|
@@ -56,6 +57,7 @@ class ScriptingObject {
|
|
|
56
57
|
/**
|
|
57
58
|
* dispose the scripting object
|
|
58
59
|
*/
|
|
60
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
59
61
|
_dispose = () => {
|
|
60
62
|
};
|
|
61
63
|
/**
|
|
@@ -106,49 +106,28 @@ class ScriptingObjectManager {
|
|
|
106
106
|
* @param {AddScriptingObjectParams<ValueOf<AppObjects>>}
|
|
107
107
|
* @param params
|
|
108
108
|
*/
|
|
109
|
-
#assertValidScriptingObject = (so) => {
|
|
110
|
-
if (!so?.id || !so?._toJSON) {
|
|
111
|
-
throw new Error("Object is not derived from ScriptingObject");
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
#assertModuleHasGuest = (objectId, guestId) => {
|
|
115
|
-
if (objectId === MODULE_OBJECT && !guestId) {
|
|
116
|
-
throw new Error(`Guest id is required to add Module scripting object`);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
#registerGlobalScriptingObject = ({
|
|
120
|
-
objectId,
|
|
121
|
-
so,
|
|
122
|
-
guestId,
|
|
123
|
-
securityContext,
|
|
124
|
-
onDuplicate
|
|
125
|
-
}) => {
|
|
126
|
-
if (this.#scriptingObjects.has(objectId)) {
|
|
127
|
-
if (onDuplicate === "ignore" /* IGNORE */) return;
|
|
128
|
-
throw new Error(`Scripting Object ${so.id} already exists`);
|
|
129
|
-
}
|
|
130
|
-
this.#scriptingObjects.set(objectId, { so, guestId, securityContext });
|
|
131
|
-
};
|
|
132
109
|
addScriptingObject = (so, params) => {
|
|
133
110
|
const {
|
|
134
111
|
guestId,
|
|
135
112
|
onDuplicate = "throw" /* THROW */,
|
|
136
113
|
securityContext
|
|
137
114
|
} = params || {};
|
|
138
|
-
|
|
115
|
+
if (!so?.id || !so?._toJSON) {
|
|
116
|
+
throw new Error("Object is not derived from ScriptingObject");
|
|
117
|
+
}
|
|
139
118
|
const objectId = this.#normalizeId(so.id);
|
|
140
|
-
|
|
119
|
+
if (objectId === MODULE_OBJECT && !guestId) {
|
|
120
|
+
throw new Error(`Guest id is required to add Module scripting object`);
|
|
121
|
+
}
|
|
141
122
|
if (guestId) {
|
|
142
123
|
this.#addGuestScriptingObject({ so, ...params, guestId, onDuplicate });
|
|
143
124
|
return;
|
|
144
125
|
}
|
|
145
|
-
this.#
|
|
146
|
-
|
|
147
|
-
so
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
onDuplicate
|
|
151
|
-
});
|
|
126
|
+
if (this.#scriptingObjects.has(objectId)) {
|
|
127
|
+
if (onDuplicate === "ignore" /* IGNORE */) return;
|
|
128
|
+
throw new Error(`Scripting Object ${so.id} already exists`);
|
|
129
|
+
}
|
|
130
|
+
this.#scriptingObjects.set(objectId, { so, guestId, securityContext });
|
|
152
131
|
};
|
|
153
132
|
/**
|
|
154
133
|
* Get reference to the scripting object proxy for a guest
|
package/dist/esm/window.js
CHANGED
|
@@ -3,7 +3,7 @@ const getWindow = () => {
|
|
|
3
3
|
try {
|
|
4
4
|
window.parent.document;
|
|
5
5
|
return window.parent;
|
|
6
|
-
} catch {
|
|
6
|
+
} catch (err) {
|
|
7
7
|
return window;
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -30,7 +30,7 @@ const isCrossDomain = () => {
|
|
|
30
30
|
try {
|
|
31
31
|
window.parent.document;
|
|
32
32
|
return false;
|
|
33
|
-
} catch {
|
|
33
|
+
} catch (ex) {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
36
|
};
|
package/dist/types/lib/app.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MicroAppConfig } from './typings/microapp.js';
|
|
2
2
|
export declare const launchMicroApp: (appConfig: MicroAppConfig) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RemotingScriptingObject } from '@elliemae/pui-scripting-object';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for scripting object proxy
|
|
4
4
|
*/
|
|
@@ -14,7 +14,7 @@ export interface IScriptingObjectProxy {
|
|
|
14
14
|
/**
|
|
15
15
|
* dipose the scripting object proxy
|
|
16
16
|
*/
|
|
17
|
-
dispose?():
|
|
17
|
+
dispose?(): any;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Interface for scripting object
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { IEvent, Events } from '@elliemae/pui-scripting-object';
|
|
2
|
-
import
|
|
2
|
+
import { EventListeners, Listener } from './common.js';
|
|
3
3
|
/**
|
|
4
4
|
* filter operators for subscribing to events
|
|
5
5
|
*/
|
|
6
6
|
export type FilterOperator = {
|
|
7
|
-
eq:
|
|
7
|
+
eq: any;
|
|
8
8
|
} | {
|
|
9
|
-
in:
|
|
9
|
+
in: any[];
|
|
10
10
|
} | {
|
|
11
|
-
includes:
|
|
11
|
+
includes: any;
|
|
12
12
|
} | {
|
|
13
13
|
gt: number;
|
|
14
14
|
} | {
|
|
@@ -23,7 +23,7 @@ export type FilterCriteria = Record<string, FilterOperator>;
|
|
|
23
23
|
/**
|
|
24
24
|
* parameters for subscribing to an event
|
|
25
25
|
*/
|
|
26
|
-
export type SubscribeParam<EventId, EventListener extends
|
|
26
|
+
export type SubscribeParam<EventId, EventListener extends Listener<any, any, any, any>> = {
|
|
27
27
|
/**
|
|
28
28
|
* unique id of the event
|
|
29
29
|
*/
|
|
@@ -171,7 +171,7 @@ export declare class ProxyEvent<AppEvents extends EventListeners = Events> imple
|
|
|
171
171
|
* @param callback event listener
|
|
172
172
|
* @returns subscription token
|
|
173
173
|
*/
|
|
174
|
-
subscribe: <EventListener extends
|
|
174
|
+
subscribe: <EventListener extends Listener<any, any, any, any>>(callback: EventListener) => string;
|
|
175
175
|
/**
|
|
176
176
|
* unsubscribe from an scripting object event
|
|
177
177
|
* @param token subscription token
|
|
@@ -183,7 +183,7 @@ export declare class ProxyEvent<AppEvents extends EventListeners = Events> imple
|
|
|
183
183
|
* @param value object to check
|
|
184
184
|
* @returns true if given object is an event
|
|
185
185
|
*/
|
|
186
|
-
export declare const isEvent: (value:
|
|
186
|
+
export declare const isEvent: (value: any) => value is Event;
|
|
187
187
|
/**
|
|
188
188
|
* Get normalized event ID for an object and event
|
|
189
189
|
* @param objectId scripting object id
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import { LogLevels } from '@elliemae/pui-diagnostics';
|
|
3
|
+
import { EventListeners } from './common.js';
|
|
4
|
+
import { IEventManager } from './event.js';
|
|
5
|
+
import { ScriptingObjects } from './scriptingObject.js';
|
|
6
6
|
/**
|
|
7
7
|
* parameters for connecting to the host
|
|
8
8
|
*/
|
package/dist/types/lib/host.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { History } from 'history';
|
|
2
|
+
import { DefaultTheme } from 'styled-components';
|
|
3
|
+
import { Logger } from '@elliemae/pui-diagnostics';
|
|
4
|
+
import { IMicroAppHost, SubscriptionListener, AppWindowSize } from './typings/host.js';
|
|
5
5
|
type HostOptions = {
|
|
6
6
|
systemVersion: string;
|
|
7
7
|
history: History;
|
|
@@ -13,12 +13,11 @@ type ConstructorParams = {
|
|
|
13
13
|
history?: History;
|
|
14
14
|
version?: string;
|
|
15
15
|
theme?: DefaultTheme;
|
|
16
|
-
scriptingObjects?: Record<string,
|
|
16
|
+
scriptingObjects?: Record<string, any>;
|
|
17
17
|
onRenewSessionTimer?: () => void;
|
|
18
18
|
onInit?: OnInitCallback;
|
|
19
19
|
};
|
|
20
20
|
export declare class CMicroAppHost implements IMicroAppHost {
|
|
21
|
-
#private;
|
|
22
21
|
private static instance;
|
|
23
22
|
private readonly logger;
|
|
24
23
|
private readonly appId;
|
|
@@ -26,7 +25,7 @@ export declare class CMicroAppHost implements IMicroAppHost {
|
|
|
26
25
|
activeGuests: Record<string, unknown>;
|
|
27
26
|
private readonly onInit?;
|
|
28
27
|
private readonly onRenewSessionTimer?;
|
|
29
|
-
scriptingObjects: Record<string,
|
|
28
|
+
scriptingObjects: Record<string, any>;
|
|
30
29
|
private constructor();
|
|
31
30
|
static getInstance(params?: ConstructorParams): CMicroAppHost;
|
|
32
31
|
static isInitialized(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MicroAppConfig } from './typings/microapp.js';
|
|
2
2
|
export declare const mountApp: ({ id, name }: MicroAppConfig) => Promise<void>;
|
|
3
3
|
export declare const unmountApp: ({ id, name }: MicroAppConfig) => Promise<void | null>;
|
|
4
4
|
export declare const loadApp: (appConfig: MicroAppConfig) => Promise<void>;
|
|
@@ -22,4 +22,4 @@ export declare class ScriptingObjectProxy implements IScriptingObjectProxy {
|
|
|
22
22
|
*/
|
|
23
23
|
constructor(objectId: string, objectType: string);
|
|
24
24
|
}
|
|
25
|
-
export declare const isScriptingObjectProxy: (value:
|
|
25
|
+
export declare const isScriptingObjectProxy: (value: any) => value is IScriptingObjectProxy;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Logger } from '@elliemae/pui-diagnostics';
|
|
2
2
|
/**
|
|
3
3
|
* Represents a callback parameters when a message is received
|
|
4
4
|
*/
|
|
@@ -47,7 +47,7 @@ export type RemotingMessage = {
|
|
|
47
47
|
/**
|
|
48
48
|
* The message body
|
|
49
49
|
*/
|
|
50
|
-
body:
|
|
50
|
+
body: any;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Represents a message to be sent to another window
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { RemotingScriptingObject } from '@elliemae/pui-scripting-object';
|
|
2
2
|
/**
|
|
3
3
|
* Event message for remoting
|
|
4
4
|
*/
|
|
@@ -18,9 +18,9 @@ export type RemotingEventMessage = {
|
|
|
18
18
|
/**
|
|
19
19
|
* Event parameters
|
|
20
20
|
*/
|
|
21
|
-
readonly eventParams?:
|
|
21
|
+
readonly eventParams?: Array<any>;
|
|
22
22
|
/**
|
|
23
23
|
* Event options
|
|
24
24
|
*/
|
|
25
|
-
readonly eventOptions?: Record<string,
|
|
25
|
+
readonly eventOptions?: Record<string, any>;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MicroAppConfig } from './typings/microapp.js';
|
|
2
2
|
export declare const APP_SCRIPT_ID_PREFIX = "emui-script-";
|
|
3
3
|
export declare const addScriptToDOM: ({ name, hostUrl, documentEle }: MicroAppConfig, fileName: string, index: number) => Promise<string>;
|
|
4
4
|
export declare const removeScriptFromDOM: (elementId?: string, documentEle?: Document) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RemotingScriptingObject, IScriptingObject } from '@elliemae/pui-scripting-object';
|
|
2
2
|
export type GenericFunction = (...args: unknown[]) => unknown;
|
|
3
|
-
export declare const isPublicFunction: (value:
|
|
3
|
+
export declare const isPublicFunction: (value: any, fnName: string) => value is GenericFunction;
|
|
4
4
|
/**
|
|
5
5
|
* Base class for all scripting objects
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import { ScriptingObjects } from './scriptingObject.js';
|
|
3
3
|
export declare const MODULE_OBJECT = "module";
|
|
4
4
|
type ValueOf<T> = T[keyof T];
|
|
5
5
|
/**
|
|
@@ -112,6 +112,12 @@ export type SOInfo<Objects extends ScriptingObjects> = {
|
|
|
112
112
|
};
|
|
113
113
|
export declare class ScriptingObjectManager<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>> {
|
|
114
114
|
#private;
|
|
115
|
+
/**
|
|
116
|
+
* registers scripting object to the host
|
|
117
|
+
* @param so scripting object to register
|
|
118
|
+
* @param {AddScriptingObjectParams<ValueOf<AppObjects>>}
|
|
119
|
+
* @param params
|
|
120
|
+
*/
|
|
115
121
|
addScriptingObject: <SO extends ValueOf<AppObjects>>(so: SO, params?: AddScriptingObjectParams) => void;
|
|
116
122
|
/**
|
|
117
123
|
* Get reference to the scripting object proxy for a guest
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MicroAppConfig } from './typings/microapp.js';
|
|
2
2
|
export declare const APP_STYLE_ID_PREFIX = "emui-style-";
|
|
3
3
|
export declare const addStylesToDOM: ({ name, hostUrl, documentEle }: MicroAppConfig, fileName: string, index: number) => Promise<string>;
|
|
4
4
|
export declare const removeStyleFromDOM: (elementId?: string, documentEle?: Document) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initServer: () => import("msw/
|
|
1
|
+
export declare const initServer: () => import("msw/lib/glossary-2792c6da").K;
|