@elliemae/pui-app-sdk 5.40.0-beta.1 → 5.40.0-beta.10

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.
Files changed (98) hide show
  1. package/demo/{2706.3ac48b3e.iframe.bundle.js → 2706.13c3ce47.iframe.bundle.js} +1 -1
  2. package/demo/2706.13c3ce47.iframe.bundle.js.br +0 -0
  3. package/demo/2706.13c3ce47.iframe.bundle.js.gz +0 -0
  4. package/demo/{4545.f7205e3b.iframe.bundle.js → 4545.2a18ef60.iframe.bundle.js} +1 -1
  5. package/demo/4545.2a18ef60.iframe.bundle.js.br +0 -0
  6. package/demo/4545.2a18ef60.iframe.bundle.js.gz +0 -0
  7. package/demo/{786.6c70980fba796c81e61a.manager.bundle.js → 786.dfe92a10916c85ed77b9.manager.bundle.js} +67 -67
  8. package/demo/786.dfe92a10916c85ed77b9.manager.bundle.js.br +0 -0
  9. package/demo/786.dfe92a10916c85ed77b9.manager.bundle.js.gz +0 -0
  10. package/demo/{docs/4018.e3bb4bb2.iframe.bundle.js → 9693.d15d1405.iframe.bundle.js} +10 -10
  11. package/demo/9693.d15d1405.iframe.bundle.js.br +0 -0
  12. package/demo/9693.d15d1405.iframe.bundle.js.gz +0 -0
  13. package/demo/docs/{2706.3ac48b3e.iframe.bundle.js → 2706.13c3ce47.iframe.bundle.js} +1 -1
  14. package/demo/docs/2706.13c3ce47.iframe.bundle.js.br +0 -0
  15. package/demo/docs/2706.13c3ce47.iframe.bundle.js.gz +0 -0
  16. package/demo/docs/{4545.f7205e3b.iframe.bundle.js → 4545.2a18ef60.iframe.bundle.js} +1 -1
  17. package/demo/docs/4545.2a18ef60.iframe.bundle.js.br +0 -0
  18. package/demo/docs/4545.2a18ef60.iframe.bundle.js.gz +0 -0
  19. package/demo/docs/{786.6c70980fba796c81e61a.manager.bundle.js → 786.dfe92a10916c85ed77b9.manager.bundle.js} +67 -67
  20. package/demo/docs/786.dfe92a10916c85ed77b9.manager.bundle.js.br +0 -0
  21. package/demo/docs/786.dfe92a10916c85ed77b9.manager.bundle.js.gz +0 -0
  22. package/demo/{4018.e3bb4bb2.iframe.bundle.js → docs/9693.d15d1405.iframe.bundle.js} +10 -10
  23. package/demo/docs/9693.d15d1405.iframe.bundle.js.br +0 -0
  24. package/demo/docs/9693.d15d1405.iframe.bundle.js.gz +0 -0
  25. package/demo/docs/iframe.html +1 -1
  26. package/demo/docs/index.html +1 -1
  27. package/demo/docs/main.135f24d7.iframe.bundle.js +5 -0
  28. package/demo/docs/main.135f24d7.iframe.bundle.js.br +0 -0
  29. package/demo/docs/main.135f24d7.iframe.bundle.js.gz +0 -0
  30. package/demo/docs/{main.b2bf60fb5c3e8e222a28.manager.bundle.js → main.2d17a48f59bd17954fa2.manager.bundle.js} +1 -1
  31. package/demo/docs/{main.b2bf60fb5c3e8e222a28.manager.bundle.js.br → main.2d17a48f59bd17954fa2.manager.bundle.js.br} +0 -0
  32. package/demo/docs/main.2d17a48f59bd17954fa2.manager.bundle.js.gz +0 -0
  33. package/demo/docs/project.json +1 -1
  34. package/demo/docs/{runtime~main.962b8cd7.iframe.bundle.js → runtime~main.0318f0ae.iframe.bundle.js} +2 -2
  35. package/demo/docs/runtime~main.0318f0ae.iframe.bundle.js.br +0 -0
  36. package/demo/docs/runtime~main.0318f0ae.iframe.bundle.js.gz +0 -0
  37. package/demo/iframe.html +1 -1
  38. package/demo/index.html +1 -1
  39. package/demo/main.135f24d7.iframe.bundle.js +5 -0
  40. package/demo/main.135f24d7.iframe.bundle.js.br +0 -0
  41. package/demo/main.135f24d7.iframe.bundle.js.gz +0 -0
  42. package/demo/{main.b2bf60fb5c3e8e222a28.manager.bundle.js → main.2d17a48f59bd17954fa2.manager.bundle.js} +1 -1
  43. package/demo/{main.b2bf60fb5c3e8e222a28.manager.bundle.js.br → main.2d17a48f59bd17954fa2.manager.bundle.js.br} +0 -0
  44. package/demo/main.2d17a48f59bd17954fa2.manager.bundle.js.gz +0 -0
  45. package/demo/project.json +1 -1
  46. package/demo/{runtime~main.962b8cd7.iframe.bundle.js → runtime~main.0318f0ae.iframe.bundle.js} +2 -2
  47. package/demo/runtime~main.0318f0ae.iframe.bundle.js.br +0 -0
  48. package/demo/runtime~main.0318f0ae.iframe.bundle.js.gz +0 -0
  49. package/dist/cjs/utils/micro-frontend/guest.js +54 -12
  50. package/dist/cjs/utils/micro-frontend/host.js +36 -10
  51. package/dist/cjs/utils/micro-frontend/module-so.js +10 -12
  52. package/dist/cjs/view/guest-microapp.js +2 -0
  53. package/dist/cjs/view/tests/app.config.json +11 -0
  54. package/dist/cjs/view/tests/constants.js +2 -0
  55. package/dist/esm/index.js +3 -1
  56. package/dist/esm/utils/micro-frontend/guest.js +54 -12
  57. package/dist/esm/utils/micro-frontend/host.js +36 -10
  58. package/dist/esm/utils/micro-frontend/module-so.js +10 -12
  59. package/dist/esm/view/guest-microapp.js +2 -0
  60. package/dist/esm/view/tests/app.config.json +11 -0
  61. package/dist/esm/view/tests/constants.js +2 -0
  62. package/dist/types/lib/index.d.ts +2 -1
  63. package/dist/types/lib/utils/micro-frontend/guest.d.ts +11 -5
  64. package/dist/types/lib/utils/micro-frontend/host.d.ts +20 -3
  65. package/dist/types/lib/utils/micro-frontend/module-so.d.ts +10 -6
  66. package/dist/types/lib/utils/micro-frontend/types.d.ts +6 -0
  67. package/dist/types/lib/utils/window.d.ts +1 -0
  68. package/dist/types/lib/view/tests/constants.d.ts +1 -0
  69. package/dist/types/tsconfig.tsbuildinfo +1 -1
  70. package/package.json +5 -5
  71. package/demo/2706.3ac48b3e.iframe.bundle.js.br +0 -0
  72. package/demo/2706.3ac48b3e.iframe.bundle.js.gz +0 -0
  73. package/demo/4018.e3bb4bb2.iframe.bundle.js.br +0 -0
  74. package/demo/4018.e3bb4bb2.iframe.bundle.js.gz +0 -0
  75. package/demo/4545.f7205e3b.iframe.bundle.js.br +0 -0
  76. package/demo/4545.f7205e3b.iframe.bundle.js.gz +0 -0
  77. package/demo/786.6c70980fba796c81e61a.manager.bundle.js.br +0 -0
  78. package/demo/786.6c70980fba796c81e61a.manager.bundle.js.gz +0 -0
  79. package/demo/docs/2706.3ac48b3e.iframe.bundle.js.br +0 -0
  80. package/demo/docs/2706.3ac48b3e.iframe.bundle.js.gz +0 -0
  81. package/demo/docs/4018.e3bb4bb2.iframe.bundle.js.br +0 -0
  82. package/demo/docs/4018.e3bb4bb2.iframe.bundle.js.gz +0 -0
  83. package/demo/docs/4545.f7205e3b.iframe.bundle.js.br +0 -0
  84. package/demo/docs/4545.f7205e3b.iframe.bundle.js.gz +0 -0
  85. package/demo/docs/786.6c70980fba796c81e61a.manager.bundle.js.br +0 -0
  86. package/demo/docs/786.6c70980fba796c81e61a.manager.bundle.js.gz +0 -0
  87. package/demo/docs/main.b2bf60fb5c3e8e222a28.manager.bundle.js.gz +0 -0
  88. package/demo/docs/main.d3eba28f.iframe.bundle.js +0 -5
  89. package/demo/docs/main.d3eba28f.iframe.bundle.js.br +0 -0
  90. package/demo/docs/main.d3eba28f.iframe.bundle.js.gz +0 -0
  91. package/demo/docs/runtime~main.962b8cd7.iframe.bundle.js.br +0 -0
  92. package/demo/docs/runtime~main.962b8cd7.iframe.bundle.js.gz +0 -0
  93. package/demo/main.b2bf60fb5c3e8e222a28.manager.bundle.js.gz +0 -0
  94. package/demo/main.d3eba28f.iframe.bundle.js +0 -5
  95. package/demo/main.d3eba28f.iframe.bundle.js.br +0 -0
  96. package/demo/main.d3eba28f.iframe.bundle.js.gz +0 -0
  97. package/demo/runtime~main.962b8cd7.iframe.bundle.js.br +0 -0
  98. package/demo/runtime~main.962b8cd7.iframe.bundle.js.gz +0 -0
@@ -26,6 +26,7 @@ __export(constants_exports, {
26
26
  LATEST_VERSION: () => LATEST_VERSION,
27
27
  LOAN_APP_ID: () => LOAN_APP_ID,
28
28
  LOAN_SAVED_EVENT: () => LOAN_SAVED_EVENT,
29
+ LOAN_SELF_INIT_APP_ID: () => LOAN_SELF_INIT_APP_ID,
29
30
  PRE_COMMIT_EVENT: () => PRE_COMMIT_EVENT,
30
31
  RELEASE_VERSION: () => RELEASE_VERSION,
31
32
  SSF_APP_ID: () => SSF_APP_ID,
@@ -35,6 +36,7 @@ module.exports = __toCommonJS(constants_exports);
35
36
  const LATEST_VERSION = "latest";
36
37
  const RELEASE_VERSION = "23.1.0";
37
38
  const LOAN_APP_ID = "loanapp";
39
+ const LOAN_SELF_INIT_APP_ID = "loanapp-selfinit";
38
40
  const SSF_APP_ID = "ssfapp";
39
41
  const TASK_APP_ID = "taskapp";
40
42
  const FLIGHTS_APP_ID = "flights";
package/dist/esm/index.js CHANGED
@@ -64,7 +64,9 @@ import {
64
64
  CMicroAppGuest,
65
65
  CMicroAppGuest as CMicroAppGuest2
66
66
  } from "./utils/micro-frontend/guest.js";
67
- import { CMicroAppHost } from "./utils/micro-frontend/host.js";
67
+ import {
68
+ CMicroAppHost
69
+ } from "./utils/micro-frontend/host.js";
68
70
  import {
69
71
  buildModuleParams,
70
72
  createGuestModule,
@@ -100,6 +100,11 @@ class CMicroAppGuest {
100
100
  static getInstance(params) {
101
101
  if (!this.instance) {
102
102
  this.instance = new CMicroAppGuest(params);
103
+ if (!params?.selfInitialize) {
104
+ (params?.logger || consoleLogger).warn(
105
+ "CMicroApp.getInstance() called without selfInitialize: true \u2014 this legacy mode is deprecated. Pass { selfInitialize: true } and use initialize() instead."
106
+ );
107
+ }
103
108
  }
104
109
  return this.instance;
105
110
  }
@@ -292,12 +297,20 @@ class CMicroAppGuest {
292
297
  }
293
298
  return null;
294
299
  }
300
+ #exposeGetHost() {
301
+ window.emui = window.emui || {};
302
+ window.emui.getHost = () => this.props.host ?? null;
303
+ }
304
+ async #initAppBridge() {
305
+ this.#appBridge = await getAppBridge();
306
+ }
295
307
  #applyModuleParams(params) {
296
308
  if (params.homeRoute) this.props.homeRoute = params.homeRoute;
297
309
  if (params.theme) this.props.theme = params.theme;
298
310
  if (params.hostUrl) this.props.hostUrl = params.hostUrl;
299
311
  if (params.manifestPath)
300
312
  this.props.manifestPath = params.manifestPath;
313
+ if (params.containerId) this.containerId = params.containerId;
301
314
  this.#applyHistoryFromParams(params);
302
315
  }
303
316
  #applyHistoryFromParams(params) {
@@ -322,35 +335,60 @@ class CMicroAppGuest {
322
335
  if (route) this.props.history.push(route);
323
336
  }
324
337
  /**
325
- * Guest-initiated lifecycle: discovers the host, pulls module parameters,
326
- * and applies them. After this resolves the guest is ready to render.
338
+ * Guest-initiated lifecycle: discovers the host and applies module
339
+ * parameters if available. After this resolves the guest is ready to render.
327
340
  * Requires selfInitialize: true in the constructor so the bridge
328
341
  * skips calling init() / mount() on this guest.
329
- * @returns module parameters provided by the host
342
+ *
343
+ * The module scripting object is optional — if the host did not register
344
+ * one, a warning is logged and the guest proceeds with its own config.
345
+ * @returns module parameters provided by the host, or a minimal object with moduleId
330
346
  */
347
+ // eslint-disable-next-line max-statements, complexity
331
348
  async initialize() {
349
+ if (window.emui?._ASSET_PATH) {
350
+ __webpack_public_path__ = new URL("../", window.emui._ASSET_PATH).href;
351
+ } else {
352
+ __webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
353
+ }
332
354
  const isStandalone = window.top === window.self && !window.opener;
333
355
  if (isStandalone) {
334
356
  await loadAppConfig();
357
+ await this.#initAppBridge();
335
358
  this.logger.info("Running in standalone mode \u2014 skipping host discovery");
336
359
  if (this.onInit) this.onInit(this.props);
337
360
  return { moduleId: this.appId };
338
361
  }
339
- const [host] = await Promise.all([this.#discoverHost(), loadAppConfig()]);
362
+ const [host] = await Promise.all([
363
+ this.#discoverHost(),
364
+ loadAppConfig().then(() => this.#initAppBridge())
365
+ ]);
340
366
  if (!host) {
341
367
  throw new Error(
342
368
  "Unable to discover host. Ensure the host uses an updated pui-app-sdk and pui-microfe, or use the host-initiated model (onInit/onMount)."
343
369
  );
344
370
  }
345
371
  this.props.host = host;
346
- const module = await host.getObject("module");
347
- if (!module) {
348
- throw new Error(
349
- `Host did not register a module scripting object for guest "${this.appId}". Ensure the host registers a module SO before rendering GuestMicroApp.`
372
+ this.#exposeGetHost();
373
+ let params = { moduleId: this.appId };
374
+ try {
375
+ const module = await host.getObject("module");
376
+ if (module) {
377
+ params = await module.getParameters();
378
+ this.#applyModuleParams(params);
379
+ } else {
380
+ this.logger.warn(
381
+ `Host did not register a module scripting object for "${this.appId}". Proceeding without host-provided parameters (history, theme, initialRoute).`
382
+ );
383
+ }
384
+ } catch (ex) {
385
+ this.logger.warn(
386
+ `Failed to retrieve module parameters for "${this.appId}". Proceeding without host-provided parameters.`
350
387
  );
351
388
  }
352
- const params = await module.getParameters();
353
- this.#applyModuleParams(params);
389
+ const instanceId = this.getSessionStorageItem("instanceId") || "";
390
+ const userId = this.getSessionStorageItem("userId") || "";
391
+ updateBAEventParameters({ appId: this.appId, instanceId, userId });
354
392
  if (this.onInit) this.onInit(this.props);
355
393
  return params;
356
394
  }
@@ -363,6 +401,7 @@ class CMicroAppGuest {
363
401
  this.props.host = host;
364
402
  } else this.logger.warn("unable to connect to host microapp");
365
403
  }
404
+ this.#exposeGetHost();
366
405
  __webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
367
406
  return loadAppConfig().then(() => {
368
407
  const instanceId = this.getSessionStorageItem("instanceId") || "";
@@ -401,9 +440,12 @@ class CMicroAppGuest {
401
440
  if (url) this.props.history.push(url, state);
402
441
  }
403
442
  /**
404
- * add scripting object for child microapp to use
443
+ * Register a scripting object for child micro-apps to use.
444
+ * Adds the object to both the App Bridge and the SSF Host so guests
445
+ * using either transport can discover it. Always prefer this method
446
+ * over calling appBridge.addScriptingObject() directly.
405
447
  * @param so - The scripting object to be added.
406
- * @param params - Optional parameters for adding the scripting object.
448
+ * @param params - Optional parameters (e.g. `{ guestId }` to scope to a specific guest).
407
449
  */
408
450
  addScriptingObject(so, params) {
409
451
  if (this.#appBridge) {
@@ -36,6 +36,7 @@ class CMicroAppHost {
36
36
  scriptingObjects;
37
37
  #ssfHostRef;
38
38
  #appBridge = null;
39
+ #selfInitialize;
39
40
  // eslint-disable-next-line max-statements
40
41
  constructor(params) {
41
42
  this.appId = getAppConfigValue("appId");
@@ -43,6 +44,7 @@ class CMicroAppHost {
43
44
  this.logger = params?.logger || consoleLogger;
44
45
  setLogger(this.logger);
45
46
  this.onRenewSessionTimer = params?.onRenewSessionTimer;
47
+ this.#selfInitialize = params?.selfInitialize ?? false;
46
48
  this.props = {
47
49
  systemVersion: params?.version ?? "latest",
48
50
  history: params?.history ?? browserHistory,
@@ -74,26 +76,47 @@ class CMicroAppHost {
74
76
  leading: true
75
77
  }
76
78
  );
77
- loadAppConfig().then(() => {
78
- getAppBridge().then((appBridge) => {
79
- this.#appBridge = appBridge;
80
- if (this.onInit) this.onInit(this.props);
81
- }).catch((ex) => {
82
- throw ex;
79
+ if (!this.#selfInitialize) {
80
+ loadAppConfig().then(() => {
81
+ getAppBridge().then((appBridge) => {
82
+ this.#appBridge = appBridge;
83
+ if (this.onInit) this.onInit(this.props);
84
+ }).catch((ex) => {
85
+ throw ex;
86
+ });
87
+ }).catch(() => {
83
88
  });
84
- }).catch(() => {
85
- });
89
+ }
86
90
  updateBAEventParameters({ appId: this.appId });
87
91
  }
88
92
  static getInstance(params) {
89
93
  if (!this.instance) {
90
94
  this.instance = new CMicroAppHost(params);
95
+ if (!params?.selfInitialize) {
96
+ (params?.logger || consoleLogger).warn(
97
+ "CMicroAppHost.getInstance() called without selfInitialize: true \u2014 this legacy mode is deprecated. Pass { selfInitialize: true } and use initialize() instead."
98
+ );
99
+ }
91
100
  }
92
101
  return this.instance;
93
102
  }
94
103
  static isInitialized() {
95
104
  return !!this.instance;
96
105
  }
106
+ /**
107
+ * Host-initiated lifecycle: loads app config, initializes the app bridge,
108
+ * and calls the onInit callback. Call this instead of relying on the
109
+ * automatic constructor chain when `selfInitialize: true`.
110
+ * @returns host options (systemVersion, history, theme)
111
+ */
112
+ async initialize() {
113
+ __webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
114
+ await loadAppConfig();
115
+ const appBridge = await getAppBridge();
116
+ this.#appBridge = appBridge;
117
+ if (this.onInit) this.onInit(this.props);
118
+ return this.props;
119
+ }
97
120
  getProps() {
98
121
  return this.props;
99
122
  }
@@ -182,9 +205,12 @@ class CMicroAppHost {
182
205
  return this.scriptingObjects[name];
183
206
  }
184
207
  /**
185
- * add scripting object for child microapp to use
208
+ * Register a scripting object for child micro-apps to use.
209
+ * Adds the object to both the App Bridge and the SSF Host so guests
210
+ * using either transport can discover it. Always prefer this method
211
+ * over calling appBridge.addScriptingObject() directly.
186
212
  * @param so - The scripting object to be added.
187
- * @param params - Optional parameters for adding the scripting object.
213
+ * @param params - Optional parameters (e.g. `{ guestId }` to scope to a specific guest).
188
214
  */
189
215
  addScriptingObject(so, params) {
190
216
  if (this.#appBridge) {
@@ -1,5 +1,6 @@
1
1
  import { ScriptingObject, Event } from "@elliemae/ssf-host";
2
2
  import { getMicroFrontEndAppConfig } from "./index.js";
3
+ import { APP_CONTAINER_ID_PREFIX } from "../../view/micro-app/const.js";
3
4
  const LOG_LEVEL_METHOD = {
4
5
  DEBUG: "debug",
5
6
  INFO: "info",
@@ -15,6 +16,7 @@ const buildModuleParams = (guestId, params = {}) => {
15
16
  hostUrl: config.hostUrl,
16
17
  manifestPath: config.manifestPath,
17
18
  homeRoute: config.homeRoute,
19
+ containerId: `${APP_CONTAINER_ID_PREFIX}${guestId}`,
18
20
  ...params
19
21
  };
20
22
  };
@@ -37,16 +39,12 @@ class GuestModule extends ScriptingObject {
37
39
  * @param handler
38
40
  */
39
41
  // eslint-disable-next-line no-underscore-dangle
40
- _setUnloadHandler(handler) {
42
+ _setUnloadHandler = (handler) => {
41
43
  this.#onUnload = handler;
42
- }
43
- getParameters() {
44
- return Promise.resolve(this.#params);
45
- }
46
- getCapabilities() {
47
- return Promise.resolve({});
48
- }
49
- log(message, logLevel) {
44
+ };
45
+ getParameters = () => Promise.resolve(this.#params);
46
+ getCapabilities = () => Promise.resolve({});
47
+ log = (message, logLevel) => {
50
48
  const logger = window.emui?.logger;
51
49
  if (!logger) return Promise.resolve();
52
50
  const text = typeof message === "string" ? message : message.message;
@@ -54,11 +52,11 @@ class GuestModule extends ScriptingObject {
54
52
  const logFn = logger[method];
55
53
  if (logFn) logFn(text);
56
54
  return Promise.resolve();
57
- }
58
- unload() {
55
+ };
56
+ unload = () => {
59
57
  if (this.#onUnload) return this.#onUnload();
60
58
  return Promise.resolve();
61
- }
59
+ };
62
60
  }
63
61
  const createGuestModule = (guestId, params = {}, overrides = {}) => {
64
62
  const mod = new GuestModule(guestId, params);
@@ -60,6 +60,7 @@ const useAppRenderer = (props) => {
60
60
  hostUrl,
61
61
  title,
62
62
  name,
63
+ selfInitialize: configSelfInitialize,
63
64
  ssfAppOptions: configSsfAppOptions = {}
64
65
  } = getConfig();
65
66
  const mergedSsfAppOptions = {
@@ -107,6 +108,7 @@ const useAppRenderer = (props) => {
107
108
  if (isMounted) {
108
109
  instanceId = await appBridge.openApp({
109
110
  id,
111
+ selfInitialize: configSelfInitialize,
110
112
  frameOptions: {
111
113
  containerId,
112
114
  queryParams: buildLogRocketQueryParams()
@@ -25,6 +25,17 @@
25
25
  "style": "border: 2px solid red;"
26
26
  }
27
27
  },
28
+ "loanapp-selfinit": {
29
+ "name": "Loan Self Init",
30
+ "hostUrl": "./loan",
31
+ "selfInitialize": true,
32
+ "development": {
33
+ "files": ["index.js"]
34
+ },
35
+ "production": {
36
+ "files": ["index.js"]
37
+ }
38
+ },
28
39
  "taskapp": {
29
40
  "name": "Task",
30
41
  "hostUrl": "./task",
@@ -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 LOAN_SELF_INIT_APP_ID = "loanapp-selfinit";
4
5
  const SSF_APP_ID = "ssfapp";
5
6
  const TASK_APP_ID = "taskapp";
6
7
  const FLIGHTS_APP_ID = "flights";
@@ -19,6 +20,7 @@ export {
19
20
  LATEST_VERSION,
20
21
  LOAN_APP_ID,
21
22
  LOAN_SAVED_EVENT,
23
+ LOAN_SELF_INIT_APP_ID,
22
24
  PRE_COMMIT_EVENT,
23
25
  RELEASE_VERSION,
24
26
  SSF_APP_ID,
@@ -30,7 +30,8 @@ export { subscribeToSessionExpiryWarning, subscribeToSessionExpiry, subscribeToR
30
30
  export { waitMessage as waitMessageAction } from './data/wait-message/actions.js';
31
31
  export { initServiceWorker } from './utils/service-worker.js';
32
32
  export { CMicroAppGuest, CMicroAppGuest as CMicroApp, } from './utils/micro-frontend/guest.js';
33
- export { CMicroAppHost } from './utils/micro-frontend/host.js';
33
+ /** @deprecated Use CMicroApp with selfInitialize: true instead */
34
+ export { CMicroAppHost, type HostOptions, } from './utils/micro-frontend/host.js';
34
35
  export { buildModuleParams, createGuestModule, GuestModule, } from './utils/micro-frontend/module-so.js';
35
36
  export type { HostProvidedParams, ModuleOverrides, } from './utils/micro-frontend/module-so.js';
36
37
  export { enableReactAppForHostIntegration } from './utils/app-host-integration/react.js';
@@ -96,11 +96,14 @@ export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partia
96
96
  private findHost;
97
97
  get uuid(): string;
98
98
  /**
99
- * Guest-initiated lifecycle: discovers the host, pulls module parameters,
100
- * and applies them. After this resolves the guest is ready to render.
99
+ * Guest-initiated lifecycle: discovers the host and applies module
100
+ * parameters if available. After this resolves the guest is ready to render.
101
101
  * Requires selfInitialize: true in the constructor so the bridge
102
102
  * skips calling init() / mount() on this guest.
103
- * @returns module parameters provided by the host
103
+ *
104
+ * The module scripting object is optional — if the host did not register
105
+ * one, a warning is logged and the guest proceeds with its own config.
106
+ * @returns module parameters provided by the host, or a minimal object with moduleId
104
107
  */
105
108
  initialize(): Promise<ModuleParameters>;
106
109
  init(options: InitOptions<AppObjects, AppEvents>): Promise<void>;
@@ -109,9 +112,12 @@ export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partia
109
112
  getRef<T>(): T | null;
110
113
  navigate(url: To, state?: any): void;
111
114
  /**
112
- * add scripting object for child microapp to use
115
+ * Register a scripting object for child micro-apps to use.
116
+ * Adds the object to both the App Bridge and the SSF Host so guests
117
+ * using either transport can discover it. Always prefer this method
118
+ * over calling appBridge.addScriptingObject() directly.
113
119
  * @param so - The scripting object to be added.
114
- * @param params - Optional parameters for adding the scripting object.
120
+ * @param params - Optional parameters (e.g. `{ guestId }` to scope to a specific guest).
115
121
  */
116
122
  addScriptingObject<SO extends AppObjects[keyof AppObjects]>(so: SO, params?: AddScriptingObjectParams): void;
117
123
  /**
@@ -6,7 +6,7 @@ import { BAEvent, ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-o
6
6
  import type { ScriptingObjects, EventListeners, AddScriptingObjectParams, DispatchEventParam, EventOptions } from '@elliemae/microfe-common';
7
7
  import { Analytics } from '@elliemae/pui-analytics-so';
8
8
  import { MicroFrontEndLogger } from '../types.js';
9
- type HostOptions = {
9
+ export type HostOptions = {
10
10
  systemVersion: string;
11
11
  history: History;
12
12
  theme: DefaultTheme;
@@ -22,11 +22,18 @@ type ConstructorParams = {
22
22
  onInit?: OnInitCallback;
23
23
  ssfHostRef?: SSFHost<ScriptingObjectTypes, Events> | null;
24
24
  analytics?: Analytics;
25
+ /**
26
+ * When true the host drives its own lifecycle via {@link CMicroAppHost.initialize}.
27
+ * The constructor skips the automatic loadAppConfig → getAppBridge → onInit chain.
28
+ */
29
+ selfInitialize?: boolean;
25
30
  };
26
31
  /**
27
32
  * Micro-frontend host application class (singleton).
28
33
  * Manages hosting and coordination of multiple micro-frontend guest applications.
29
34
  * Provides shared services like navigation, theming, analytics, and state management.
35
+ * @deprecated Use {@link CMicroAppGuest | CMicroApp} instead. CMicroApp now supports
36
+ * both guest and host use cases via `selfInitialize: true` and `initialize()`.
30
37
  * @template AppObjects - Type of custom scripting objects
31
38
  * @template AppEvents - Type of custom event listeners
32
39
  * @example
@@ -57,6 +64,13 @@ export declare class CMicroAppHost<AppObjects extends ScriptingObjects = Partial
57
64
  private constructor();
58
65
  static getInstance<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events>(params?: ConstructorParams): CMicroAppHost<AppObjects, AppEvents>;
59
66
  static isInitialized(): boolean;
67
+ /**
68
+ * Host-initiated lifecycle: loads app config, initializes the app bridge,
69
+ * and calls the onInit callback. Call this instead of relying on the
70
+ * automatic constructor chain when `selfInitialize: true`.
71
+ * @returns host options (systemVersion, history, theme)
72
+ */
73
+ initialize(): Promise<HostOptions>;
60
74
  getProps(): HostOptions;
61
75
  getLogger(): MicroFrontEndLogger;
62
76
  getItem(key: string): string | null;
@@ -85,9 +99,12 @@ export declare class CMicroAppHost<AppObjects extends ScriptingObjects = Partial
85
99
  sendBAEvent(data: BAEvent): void;
86
100
  getObject<T>(name: string): Promise<T>;
87
101
  /**
88
- * add scripting object for child microapp to use
102
+ * Register a scripting object for child micro-apps to use.
103
+ * Adds the object to both the App Bridge and the SSF Host so guests
104
+ * using either transport can discover it. Always prefer this method
105
+ * over calling appBridge.addScriptingObject() directly.
89
106
  * @param so - The scripting object to be added.
90
- * @param params - Optional parameters for adding the scripting object.
107
+ * @param params - Optional parameters (e.g. `{ guestId }` to scope to a specific guest).
91
108
  */
92
109
  addScriptingObject<SO extends AppObjects[keyof AppObjects]>(so: SO, params?: AddScriptingObjectParams): void;
93
110
  /**
@@ -42,11 +42,11 @@ export declare class GuestModule extends ScriptingObject implements IModule {
42
42
  * The App Bridge auto-binds this in openApp().
43
43
  * @param handler
44
44
  */
45
- _setUnloadHandler(handler: () => Promise<void>): void;
46
- getParameters(): Promise<ModuleParameters>;
47
- getCapabilities(): Promise<Record<string, unknown>>;
48
- log(message: LogMessage | string, logLevel: keyof typeof LogLevels): Promise<void>;
49
- unload(): Promise<void>;
45
+ _setUnloadHandler: (handler: () => Promise<void>) => void;
46
+ getParameters: () => Promise<ModuleParameters>;
47
+ getCapabilities: () => Promise<Record<string, unknown>>;
48
+ log: (message: LogMessage | string, logLevel: keyof typeof LogLevels) => Promise<void>;
49
+ unload: () => Promise<void>;
50
50
  }
51
51
  /**
52
52
  * Optional method overrides the host can supply to customise
@@ -74,9 +74,13 @@ export type ModuleOverrides = {
74
74
  * Internally calls {@link buildModuleParams} to merge the app config
75
75
  * values (hostUrl, manifestPath, homeRoute) with host-provided values
76
76
  * (theme, history, initialRoute).
77
+ *
78
+ * Register the returned object via {@link CMicroAppHost.addScriptingObject}
79
+ * or {@link CMicroAppGuest.addScriptingObject} (not directly on the app
80
+ * bridge) so it is added to both the App Bridge and the SSF Host.
77
81
  * @param guestId - App id as defined in app.config.json (e.g. 'loanapp')
78
82
  * @param params - Host-provided values (theme, history, initialRoute, custom keys)
79
83
  * @param overrides - Method overrides / additions (e.g. custom getCapabilities)
80
- * @returns IModule scripting object ready for addScriptingObject()
84
+ * @returns IModule scripting object ready for CMicroAppHost/CMicroApp.addScriptingObject()
81
85
  */
82
86
  export declare const createGuestModule: (guestId: string, params?: HostProvidedParams, overrides?: ModuleOverrides) => IModule;
@@ -127,6 +127,12 @@ export type MicroAppConfig = {
127
127
  * options for ssf based micro-frontend applications.
128
128
  */
129
129
  ssfAppOptions?: SSFAppOptions<Record<string, string | number | boolean>>;
130
+ /**
131
+ * When true the guest drives its own lifecycle via `initialize()` and
132
+ * the bridge skips calling `init()` / `mount()` on the guest.
133
+ * Set this in the `microFrontendApps` section of `app.config.json`.
134
+ */
135
+ selfInitialize?: boolean;
130
136
  /**
131
137
  * The Document object associated with the micro-frontend application.
132
138
  */
@@ -15,6 +15,7 @@ export type EMUI<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTy
15
15
  version: string;
16
16
  MicroAppHost?: IMicroFEHost<AppObjects, AppEvents> | IMicroAppHost | SSFGuest<AppObjects, AppEvents>;
17
17
  __host?: IMicroFEHost<AppObjects, AppEvents>;
18
+ getHost?: () => IMicroFEHost<AppObjects, AppEvents> | SSFGuest<AppObjects, AppEvents> | IMicroAppHost | null;
18
19
  logger?: Logger;
19
20
  logRocket?: typeof LogRocket;
20
21
  logRocketConfig?: {
@@ -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 LOAN_SELF_INIT_APP_ID = "loanapp-selfinit";
4
5
  export declare const SSF_APP_ID = "ssfapp";
5
6
  export declare const TASK_APP_ID = "taskapp";
6
7
  export declare const FLIGHTS_APP_ID = "flights";