@elliemae/microfe-common 2.28.6 → 2.29.0-alpha.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 +0 -2
- package/dist/cjs/host.js +20 -14
- package/dist/cjs/loader.js +1 -2
- package/dist/cjs/proxy.js +7 -6
- package/dist/cjs/remoting.js +0 -1
- package/dist/cjs/scriptingObject.js +0 -2
- package/dist/cjs/scriptingObjectManager.js +32 -11
- package/dist/cjs/window.js +2 -2
- package/dist/esm/event.js +0 -2
- package/dist/esm/host.js +19 -13
- package/dist/esm/loader.js +1 -2
- package/dist/esm/proxy.js +7 -6
- package/dist/esm/remoting.js +0 -1
- package/dist/esm/scriptingObject.js +0 -2
- package/dist/esm/scriptingObjectManager.js +32 -11
- 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 +7 -6
- 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 +2 -8
- 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 +14 -6
package/dist/cjs/event.js
CHANGED
|
@@ -25,7 +25,6 @@ __export(event_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(event_exports);
|
|
27
27
|
class Event {
|
|
28
|
-
/* eslint-enable indent */
|
|
29
28
|
/**
|
|
30
29
|
* name of the event
|
|
31
30
|
*/
|
|
@@ -60,7 +59,6 @@ class ProxyEvent {
|
|
|
60
59
|
static [Symbol.hasInstance](obj) {
|
|
61
60
|
return typeof obj === "object" && obj !== null && "getType" in obj && typeof obj.getType === "function" && obj.getType() === "ProxyEvent";
|
|
62
61
|
}
|
|
63
|
-
/* eslint-enable indent */
|
|
64
62
|
/**
|
|
65
63
|
* module that owns this event management. SSF Guest or App Bridge host
|
|
66
64
|
*/
|
package/dist/cjs/host.js
CHANGED
|
@@ -25,8 +25,13 @@ 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_history = 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
|
+
});
|
|
30
35
|
class CMicroAppHost {
|
|
31
36
|
static instance;
|
|
32
37
|
logger;
|
|
@@ -36,28 +41,30 @@ class CMicroAppHost {
|
|
|
36
41
|
onInit;
|
|
37
42
|
onRenewSessionTimer;
|
|
38
43
|
scriptingObjects;
|
|
39
|
-
|
|
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 ?? {};
|
|
44
|
+
#bindInstanceMethods() {
|
|
51
45
|
this.getProps = this.getProps.bind(this);
|
|
52
46
|
this.getLogger = this.getLogger.bind(this);
|
|
53
47
|
this.getGuests = this.getGuests.bind(this);
|
|
54
48
|
this.getGuest = this.getGuest.bind(this);
|
|
55
49
|
this.getObject = this.getObject.bind(this);
|
|
50
|
+
}
|
|
51
|
+
#scheduleConfigLoad() {
|
|
56
52
|
(0, import_config.loadAppConfig)().then(() => {
|
|
57
53
|
if (this.onInit) this.onInit(this.props);
|
|
58
54
|
}).catch(() => {
|
|
59
55
|
});
|
|
60
56
|
}
|
|
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
|
+
}
|
|
61
68
|
static getInstance(params) {
|
|
62
69
|
if (!this.instance) {
|
|
63
70
|
this.instance = new this(params);
|
|
@@ -95,7 +102,6 @@ class CMicroAppHost {
|
|
|
95
102
|
publish(eventId, data) {
|
|
96
103
|
return (0, import_pubsub_js.publish)(eventId, data);
|
|
97
104
|
}
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
99
105
|
subscribe(eventId, listener) {
|
|
100
106
|
return (0, import_pubsub_js.subscribe)(eventId, listener);
|
|
101
107
|
}
|
package/dist/cjs/loader.js
CHANGED
|
@@ -129,9 +129,8 @@ 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;
|
|
133
132
|
const manifest = await (0, import_manifestLoader.getAppManifest)(appConfig);
|
|
134
|
-
assets = (0, import_manifestLoader.getFullFileNameofAssetsFromManifest)(manifest, appConfig.files);
|
|
133
|
+
const assets = (0, import_manifestLoader.getFullFileNameofAssetsFromManifest)(manifest, appConfig.files);
|
|
135
134
|
let counter = 0;
|
|
136
135
|
const requests = assets.map((fileName) => {
|
|
137
136
|
counter += 1;
|
package/dist/cjs/proxy.js
CHANGED
|
@@ -45,9 +45,10 @@ class ScriptingObjectProxy {
|
|
|
45
45
|
this.objectType = objectType;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
const isScriptingObjectProxy = (value) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const isScriptingObjectProxy = (value) => {
|
|
49
|
+
if (typeof value !== "object" || value === null) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const candidate = value;
|
|
53
|
+
return candidate.constructor?.name === "Proxy" || candidate.constructor?.name === "ScriptingObjectProxy" || candidate.__TYPE__ === "Proxy";
|
|
54
|
+
};
|
package/dist/cjs/remoting.js
CHANGED
|
@@ -35,7 +35,6 @@ 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
|
|
39
38
|
body: messageBody
|
|
40
39
|
});
|
|
41
40
|
const sendMessage = (param) => {
|
|
@@ -59,7 +59,6 @@ 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
|
|
63
62
|
_toJSON = () => {
|
|
64
63
|
const functions = [];
|
|
65
64
|
const events = [];
|
|
@@ -81,7 +80,6 @@ class ScriptingObject {
|
|
|
81
80
|
/**
|
|
82
81
|
* dispose the scripting object
|
|
83
82
|
*/
|
|
84
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
85
83
|
_dispose = () => {
|
|
86
84
|
};
|
|
87
85
|
/**
|
|
@@ -132,29 +132,50 @@ class ScriptingObjectManager {
|
|
|
132
132
|
* @param {AddScriptingObjectParams<ValueOf<AppObjects>>}
|
|
133
133
|
* @param params
|
|
134
134
|
*/
|
|
135
|
-
|
|
136
|
-
const {
|
|
137
|
-
guestId,
|
|
138
|
-
onDuplicate = "throw" /* THROW */,
|
|
139
|
-
securityContext
|
|
140
|
-
} = params || {};
|
|
135
|
+
#assertValidScriptingObject = (so) => {
|
|
141
136
|
if (!so?.id || !so?._toJSON) {
|
|
142
137
|
throw new Error("Object is not derived from ScriptingObject");
|
|
143
138
|
}
|
|
144
|
-
|
|
139
|
+
};
|
|
140
|
+
#assertModuleHasGuest = (objectId, guestId) => {
|
|
145
141
|
if (objectId === MODULE_OBJECT && !guestId) {
|
|
146
142
|
throw new Error(`Guest id is required to add Module scripting object`);
|
|
147
143
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
};
|
|
145
|
+
#registerGlobalScriptingObject = ({
|
|
146
|
+
objectId,
|
|
147
|
+
so,
|
|
148
|
+
guestId,
|
|
149
|
+
securityContext,
|
|
150
|
+
onDuplicate
|
|
151
|
+
}) => {
|
|
152
152
|
if (this.#scriptingObjects.has(objectId)) {
|
|
153
153
|
if (onDuplicate === "ignore" /* IGNORE */) return;
|
|
154
154
|
throw new Error(`Scripting Object ${so.id} already exists`);
|
|
155
155
|
}
|
|
156
156
|
this.#scriptingObjects.set(objectId, { so, guestId, securityContext });
|
|
157
157
|
};
|
|
158
|
+
addScriptingObject = (so, params) => {
|
|
159
|
+
const {
|
|
160
|
+
guestId,
|
|
161
|
+
onDuplicate = "throw" /* THROW */,
|
|
162
|
+
securityContext
|
|
163
|
+
} = params || {};
|
|
164
|
+
this.#assertValidScriptingObject(so);
|
|
165
|
+
const objectId = this.#normalizeId(so.id);
|
|
166
|
+
this.#assertModuleHasGuest(objectId, guestId);
|
|
167
|
+
if (guestId) {
|
|
168
|
+
this.#addGuestScriptingObject({ so, ...params, guestId, onDuplicate });
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this.#registerGlobalScriptingObject({
|
|
172
|
+
objectId,
|
|
173
|
+
so,
|
|
174
|
+
guestId,
|
|
175
|
+
securityContext,
|
|
176
|
+
onDuplicate
|
|
177
|
+
});
|
|
178
|
+
};
|
|
158
179
|
/**
|
|
159
180
|
* Get reference to the scripting object proxy for a guest
|
|
160
181
|
* @param {string} objectId scripting object id
|
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 {
|
|
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 {
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
};
|
package/dist/esm/event.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
class Event {
|
|
2
|
-
/* eslint-enable indent */
|
|
3
2
|
/**
|
|
4
3
|
* name of the event
|
|
5
4
|
*/
|
|
@@ -34,7 +33,6 @@ class ProxyEvent {
|
|
|
34
33
|
static [Symbol.hasInstance](obj) {
|
|
35
34
|
return typeof obj === "object" && obj !== null && "getType" in obj && typeof obj.getType === "function" && obj.getType() === "ProxyEvent";
|
|
36
35
|
}
|
|
37
|
-
/* eslint-enable indent */
|
|
38
36
|
/**
|
|
39
37
|
* module that owns this event management. SSF Guest or App Bridge host
|
|
40
38
|
*/
|
package/dist/esm/host.js
CHANGED
|
@@ -4,6 +4,11 @@ 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
|
+
});
|
|
7
12
|
class CMicroAppHost {
|
|
8
13
|
static instance;
|
|
9
14
|
logger;
|
|
@@ -13,28 +18,30 @@ class CMicroAppHost {
|
|
|
13
18
|
onInit;
|
|
14
19
|
onRenewSessionTimer;
|
|
15
20
|
scriptingObjects;
|
|
16
|
-
|
|
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 ?? {};
|
|
21
|
+
#bindInstanceMethods() {
|
|
28
22
|
this.getProps = this.getProps.bind(this);
|
|
29
23
|
this.getLogger = this.getLogger.bind(this);
|
|
30
24
|
this.getGuests = this.getGuests.bind(this);
|
|
31
25
|
this.getGuest = this.getGuest.bind(this);
|
|
32
26
|
this.getObject = this.getObject.bind(this);
|
|
27
|
+
}
|
|
28
|
+
#scheduleConfigLoad() {
|
|
33
29
|
loadAppConfig().then(() => {
|
|
34
30
|
if (this.onInit) this.onInit(this.props);
|
|
35
31
|
}).catch(() => {
|
|
36
32
|
});
|
|
37
33
|
}
|
|
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
|
+
}
|
|
38
45
|
static getInstance(params) {
|
|
39
46
|
if (!this.instance) {
|
|
40
47
|
this.instance = new this(params);
|
|
@@ -72,7 +79,6 @@ class CMicroAppHost {
|
|
|
72
79
|
publish(eventId, data) {
|
|
73
80
|
return publish(eventId, data);
|
|
74
81
|
}
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
76
82
|
subscribe(eventId, listener) {
|
|
77
83
|
return subscribe(eventId, listener);
|
|
78
84
|
}
|
package/dist/esm/loader.js
CHANGED
|
@@ -110,9 +110,8 @@ 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;
|
|
114
113
|
const manifest = await getAppManifest(appConfig);
|
|
115
|
-
assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files);
|
|
114
|
+
const assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files);
|
|
116
115
|
let counter = 0;
|
|
117
116
|
const requests = assets.map((fileName) => {
|
|
118
117
|
counter += 1;
|
package/dist/esm/proxy.js
CHANGED
|
@@ -21,12 +21,13 @@ class ScriptingObjectProxy {
|
|
|
21
21
|
this.objectType = objectType;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
const isScriptingObjectProxy = (value) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const isScriptingObjectProxy = (value) => {
|
|
25
|
+
if (typeof value !== "object" || value === null) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const candidate = value;
|
|
29
|
+
return candidate.constructor?.name === "Proxy" || candidate.constructor?.name === "ScriptingObjectProxy" || candidate.__TYPE__ === "Proxy";
|
|
30
|
+
};
|
|
30
31
|
export {
|
|
31
32
|
ScriptingObjectProxy,
|
|
32
33
|
isScriptingObjectProxy
|
package/dist/esm/remoting.js
CHANGED
|
@@ -11,7 +11,6 @@ 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
|
|
15
14
|
body: messageBody
|
|
16
15
|
});
|
|
17
16
|
const sendMessage = (param) => {
|
|
@@ -35,7 +35,6 @@ 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
|
|
39
38
|
_toJSON = () => {
|
|
40
39
|
const functions = [];
|
|
41
40
|
const events = [];
|
|
@@ -57,7 +56,6 @@ class ScriptingObject {
|
|
|
57
56
|
/**
|
|
58
57
|
* dispose the scripting object
|
|
59
58
|
*/
|
|
60
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
61
59
|
_dispose = () => {
|
|
62
60
|
};
|
|
63
61
|
/**
|
|
@@ -106,29 +106,50 @@ class ScriptingObjectManager {
|
|
|
106
106
|
* @param {AddScriptingObjectParams<ValueOf<AppObjects>>}
|
|
107
107
|
* @param params
|
|
108
108
|
*/
|
|
109
|
-
|
|
110
|
-
const {
|
|
111
|
-
guestId,
|
|
112
|
-
onDuplicate = "throw" /* THROW */,
|
|
113
|
-
securityContext
|
|
114
|
-
} = params || {};
|
|
109
|
+
#assertValidScriptingObject = (so) => {
|
|
115
110
|
if (!so?.id || !so?._toJSON) {
|
|
116
111
|
throw new Error("Object is not derived from ScriptingObject");
|
|
117
112
|
}
|
|
118
|
-
|
|
113
|
+
};
|
|
114
|
+
#assertModuleHasGuest = (objectId, guestId) => {
|
|
119
115
|
if (objectId === MODULE_OBJECT && !guestId) {
|
|
120
116
|
throw new Error(`Guest id is required to add Module scripting object`);
|
|
121
117
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
};
|
|
119
|
+
#registerGlobalScriptingObject = ({
|
|
120
|
+
objectId,
|
|
121
|
+
so,
|
|
122
|
+
guestId,
|
|
123
|
+
securityContext,
|
|
124
|
+
onDuplicate
|
|
125
|
+
}) => {
|
|
126
126
|
if (this.#scriptingObjects.has(objectId)) {
|
|
127
127
|
if (onDuplicate === "ignore" /* IGNORE */) return;
|
|
128
128
|
throw new Error(`Scripting Object ${so.id} already exists`);
|
|
129
129
|
}
|
|
130
130
|
this.#scriptingObjects.set(objectId, { so, guestId, securityContext });
|
|
131
131
|
};
|
|
132
|
+
addScriptingObject = (so, params) => {
|
|
133
|
+
const {
|
|
134
|
+
guestId,
|
|
135
|
+
onDuplicate = "throw" /* THROW */,
|
|
136
|
+
securityContext
|
|
137
|
+
} = params || {};
|
|
138
|
+
this.#assertValidScriptingObject(so);
|
|
139
|
+
const objectId = this.#normalizeId(so.id);
|
|
140
|
+
this.#assertModuleHasGuest(objectId, guestId);
|
|
141
|
+
if (guestId) {
|
|
142
|
+
this.#addGuestScriptingObject({ so, ...params, guestId, onDuplicate });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.#registerGlobalScriptingObject({
|
|
146
|
+
objectId,
|
|
147
|
+
so,
|
|
148
|
+
guestId,
|
|
149
|
+
securityContext,
|
|
150
|
+
onDuplicate
|
|
151
|
+
});
|
|
152
|
+
};
|
|
132
153
|
/**
|
|
133
154
|
* Get reference to the scripting object proxy for a guest
|
|
134
155
|
* @param {string} objectId scripting object id
|
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 {
|
|
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 {
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
36
36
|
};
|
package/dist/types/lib/app.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MicroAppConfig } from './typings/microapp.js';
|
|
1
|
+
import type { MicroAppConfig } from './typings/microapp.js';
|
|
2
2
|
export declare const launchMicroApp: (appConfig: MicroAppConfig) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RemotingScriptingObject } from '@elliemae/pui-scripting-object';
|
|
1
|
+
import type { 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?(): unknown;
|
|
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 { EventListeners
|
|
2
|
+
import type { EventListeners } from './common.js';
|
|
3
3
|
/**
|
|
4
4
|
* filter operators for subscribing to events
|
|
5
5
|
*/
|
|
6
6
|
export type FilterOperator = {
|
|
7
|
-
eq:
|
|
7
|
+
eq: unknown;
|
|
8
8
|
} | {
|
|
9
|
-
in:
|
|
9
|
+
in: unknown[];
|
|
10
10
|
} | {
|
|
11
|
-
includes:
|
|
11
|
+
includes: unknown;
|
|
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 EventListeners[string]> = {
|
|
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 AppEvents[Extract<keyof AppEvents, string>]>(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: unknown) => 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 { 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';
|
|
1
|
+
import type { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import type { LogLevels } from '@elliemae/pui-diagnostics';
|
|
3
|
+
import type { EventListeners } from './common.js';
|
|
4
|
+
import type { IEventManager } from './event.js';
|
|
5
|
+
import type { 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 { 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';
|
|
1
|
+
import type { History } from 'history';
|
|
2
|
+
import type { DefaultTheme } from 'styled-components';
|
|
3
|
+
import type { Logger } from '@elliemae/pui-diagnostics';
|
|
4
|
+
import type { IMicroAppHost, SubscriptionListener, AppWindowSize } from './typings/host.js';
|
|
5
5
|
type HostOptions = {
|
|
6
6
|
systemVersion: string;
|
|
7
7
|
history: History;
|
|
@@ -13,11 +13,12 @@ type ConstructorParams = {
|
|
|
13
13
|
history?: History;
|
|
14
14
|
version?: string;
|
|
15
15
|
theme?: DefaultTheme;
|
|
16
|
-
scriptingObjects?: Record<string,
|
|
16
|
+
scriptingObjects?: Record<string, unknown>;
|
|
17
17
|
onRenewSessionTimer?: () => void;
|
|
18
18
|
onInit?: OnInitCallback;
|
|
19
19
|
};
|
|
20
20
|
export declare class CMicroAppHost implements IMicroAppHost {
|
|
21
|
+
#private;
|
|
21
22
|
private static instance;
|
|
22
23
|
private readonly logger;
|
|
23
24
|
private readonly appId;
|
|
@@ -25,7 +26,7 @@ export declare class CMicroAppHost implements IMicroAppHost {
|
|
|
25
26
|
activeGuests: Record<string, unknown>;
|
|
26
27
|
private readonly onInit?;
|
|
27
28
|
private readonly onRenewSessionTimer?;
|
|
28
|
-
scriptingObjects: Record<string,
|
|
29
|
+
scriptingObjects: Record<string, unknown>;
|
|
29
30
|
private constructor();
|
|
30
31
|
static getInstance(params?: ConstructorParams): CMicroAppHost;
|
|
31
32
|
static isInitialized(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MicroAppConfig } from './typings/microapp.js';
|
|
1
|
+
import type { 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: unknown) => value is IScriptingObjectProxy;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from '@elliemae/pui-diagnostics';
|
|
1
|
+
import type { 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: unknown;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Represents a message to be sent to another window
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RemotingScriptingObject } from '@elliemae/pui-scripting-object';
|
|
1
|
+
import type { 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?: unknown[];
|
|
22
22
|
/**
|
|
23
23
|
* Event options
|
|
24
24
|
*/
|
|
25
|
-
readonly eventOptions?: Record<string,
|
|
25
|
+
readonly eventOptions?: Record<string, unknown>;
|
|
26
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MicroAppConfig } from './typings/microapp.js';
|
|
1
|
+
import type { 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: unknown, fnName: string) => value is GenericFunction;
|
|
4
4
|
/**
|
|
5
5
|
* Base class for all scripting objects
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
|
|
2
|
-
import { ScriptingObjects } from './scriptingObject.js';
|
|
1
|
+
import type { ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import type { ScriptingObjects } from './scriptingObject.js';
|
|
3
3
|
export declare const MODULE_OBJECT = "module";
|
|
4
4
|
type ValueOf<T> = T[keyof T];
|
|
5
5
|
/**
|
|
@@ -112,12 +112,6 @@ 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
|
-
*/
|
|
121
115
|
addScriptingObject: <SO extends ValueOf<AppObjects>>(so: SO, params?: AddScriptingObjectParams) => void;
|
|
122
116
|
/**
|
|
123
117
|
* Get reference to the scripting object proxy for a guest
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MicroAppConfig } from './typings/microapp.js';
|
|
1
|
+
import type { 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/node").SetupServer;
|