@elliemae/pui-app-sdk 5.21.0-beta.4 → 5.21.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.
Files changed (145) hide show
  1. package/dist/cjs/analytics/index.js +1 -2
  2. package/dist/cjs/index.js +0 -2
  3. package/dist/cjs/utils/decorators/functionDecorators.js +35 -2
  4. package/dist/cjs/utils/decorators/index.js +2 -1
  5. package/dist/cjs/utils/micro-frontend/guest.js +14 -100
  6. package/dist/cjs/{view/tests/scriptingObjects/constant.js → utils/micro-frontend/host-app.js} +10 -5
  7. package/dist/cjs/utils/micro-frontend/host.js +3 -36
  8. package/dist/cjs/utils/micro-frontend/scripting-objects/analytics.js +12 -2
  9. package/dist/cjs/{view/tests/utils.js → utils/micro-frontend/ssfguest-adapter.js} +29 -34
  10. package/dist/cjs/utils/testing/index.js +1 -15
  11. package/dist/cjs/view/micro-iframe-app/iframe/index.js +1 -1
  12. package/dist/cjs/view/micro-iframe-app/iframe.html +1 -5
  13. package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +1 -3
  14. package/dist/esm/analytics/index.js +1 -2
  15. package/dist/esm/index.js +0 -2
  16. package/dist/esm/utils/decorators/functionDecorators.js +35 -2
  17. package/dist/esm/utils/decorators/index.js +4 -2
  18. package/dist/esm/utils/micro-frontend/guest.js +14 -100
  19. package/dist/esm/utils/micro-frontend/host-app.js +9 -0
  20. package/dist/esm/utils/micro-frontend/host.js +3 -36
  21. package/dist/esm/utils/micro-frontend/scripting-objects/analytics.js +2 -2
  22. package/dist/esm/utils/micro-frontend/ssfguest-adapter.js +28 -0
  23. package/dist/esm/utils/testing/index.js +1 -5
  24. package/dist/esm/view/micro-iframe-app/iframe/index.js +1 -1
  25. package/dist/esm/view/micro-iframe-app/iframe.html +1 -5
  26. package/dist/esm/view/micro-iframe-app/use-frame-loaded.js +1 -3
  27. package/dist/types/lib/index.d.ts +0 -1
  28. package/dist/types/lib/utils/decorators/functionDecorators.d.ts +28 -0
  29. package/dist/types/lib/utils/decorators/index.d.ts +2 -1
  30. package/dist/types/lib/utils/micro-frontend/guest.d.ts +11 -46
  31. package/dist/types/lib/utils/micro-frontend/host-app.d.ts +11 -0
  32. package/dist/types/lib/utils/micro-frontend/host.d.ts +10 -27
  33. package/dist/types/lib/utils/micro-frontend/scripting-objects/analytics.d.ts +2 -2
  34. package/dist/types/lib/utils/micro-frontend/ssfguest-adapter.d.ts +7 -0
  35. package/dist/types/lib/utils/micro-frontend/types.d.ts +1 -2
  36. package/dist/types/lib/utils/testing/index.d.ts +1 -57
  37. package/dist/types/lib/utils/window.d.ts +6 -13
  38. package/dist/types/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +48 -43
  40. package/dist/cjs/utils/micro-frontend/app-bridge.js +0 -40
  41. package/dist/cjs/utils/micro-frontend/tests/app.config.json +0 -200
  42. package/dist/cjs/utils/micro-frontend/tests/utils.js +0 -116
  43. package/dist/cjs/view/microapp-v2.js +0 -91
  44. package/dist/cjs/view/tests/__snapshots__/micro-iframe-app.test.tsx.snap +0 -208
  45. package/dist/cjs/view/tests/__snapshots__/microapp-v2.test.tsx.snap +0 -21
  46. package/dist/cjs/view/tests/app.config.json +0 -200
  47. package/dist/cjs/view/tests/constants.js +0 -44
  48. package/dist/cjs/view/tests/flights/23.1/app.checksum1.css +0 -3
  49. package/dist/cjs/view/tests/flights/23.1/app.checksum1.js +0 -52
  50. package/dist/cjs/view/tests/flights/23.1/manifest.json +0 -4
  51. package/dist/cjs/view/tests/flights/latest/app.checksum.css +0 -3
  52. package/dist/cjs/view/tests/flights/latest/app.checksum.js +0 -52
  53. package/dist/cjs/view/tests/flights/latest/manifest.json +0 -4
  54. package/dist/cjs/view/tests/hotels/23.1/app.checksum.css +0 -3
  55. package/dist/cjs/view/tests/hotels/23.1/app.checksum.js +0 -52
  56. package/dist/cjs/view/tests/hotels/23.1/manifest.json +0 -4
  57. package/dist/cjs/view/tests/hotels/latest/app.checksum.css +0 -3
  58. package/dist/cjs/view/tests/hotels/latest/app.checksum.js +0 -52
  59. package/dist/cjs/view/tests/hotels/latest/manifest.json +0 -4
  60. package/dist/cjs/view/tests/loan/latest/index.js +0 -116
  61. package/dist/cjs/view/tests/loan/latest/manifest.json +0 -3
  62. package/dist/cjs/view/tests/scriptingObjects/appraisalServiceModule.js +0 -85
  63. package/dist/cjs/view/tests/scriptingObjects/global.js +0 -40
  64. package/dist/cjs/view/tests/scriptingObjects/loan.js +0 -207
  65. package/dist/cjs/view/tests/server.js +0 -29
  66. package/dist/cjs/view/tests/serverHandlers.js +0 -210
  67. package/dist/cjs/view/tests/task/latest/index.dev.js +0 -67
  68. package/dist/cjs/view/tests/task/latest/index.js +0 -67
  69. package/dist/cjs/view/tests/task/latest/manifest.json +0 -4
  70. package/dist/cjs/view/tests/travelhub/23.1/app.checksum.css +0 -3
  71. package/dist/cjs/view/tests/travelhub/23.1/app.checksum.js +0 -25
  72. package/dist/cjs/view/tests/travelhub/23.1/landing.checksum1.css +0 -3
  73. package/dist/cjs/view/tests/travelhub/23.1/landing.checksum1.js +0 -6
  74. package/dist/cjs/view/tests/travelhub/23.1/manifest.json +0 -6
  75. package/dist/cjs/view/tests/travelhub/latest/app.checksum.css +0 -3
  76. package/dist/cjs/view/tests/travelhub/latest/app.checksum.js +0 -30
  77. package/dist/cjs/view/tests/travelhub/latest/landing.checksum.css +0 -3
  78. package/dist/cjs/view/tests/travelhub/latest/landing.checksum.js +0 -8
  79. package/dist/cjs/view/tests/travelhub/latest/manifest.json +0 -6
  80. package/dist/esm/utils/micro-frontend/app-bridge.js +0 -20
  81. package/dist/esm/utils/micro-frontend/tests/app.config.json +0 -200
  82. package/dist/esm/utils/micro-frontend/tests/utils.js +0 -96
  83. package/dist/esm/view/microapp-v2.js +0 -71
  84. package/dist/esm/view/tests/__snapshots__/micro-iframe-app.test.tsx.snap +0 -208
  85. package/dist/esm/view/tests/__snapshots__/microapp-v2.test.tsx.snap +0 -21
  86. package/dist/esm/view/tests/app.config.json +0 -200
  87. package/dist/esm/view/tests/constants.js +0 -24
  88. package/dist/esm/view/tests/flights/23.1/app.checksum1.css +0 -3
  89. package/dist/esm/view/tests/flights/23.1/app.checksum1.js +0 -51
  90. package/dist/esm/view/tests/flights/23.1/manifest.json +0 -4
  91. package/dist/esm/view/tests/flights/latest/app.checksum.css +0 -3
  92. package/dist/esm/view/tests/flights/latest/app.checksum.js +0 -51
  93. package/dist/esm/view/tests/flights/latest/manifest.json +0 -4
  94. package/dist/esm/view/tests/hotels/23.1/app.checksum.css +0 -3
  95. package/dist/esm/view/tests/hotels/23.1/app.checksum.js +0 -51
  96. package/dist/esm/view/tests/hotels/23.1/manifest.json +0 -4
  97. package/dist/esm/view/tests/hotels/latest/app.checksum.css +0 -3
  98. package/dist/esm/view/tests/hotels/latest/app.checksum.js +0 -51
  99. package/dist/esm/view/tests/hotels/latest/manifest.json +0 -4
  100. package/dist/esm/view/tests/loan/latest/index.js +0 -115
  101. package/dist/esm/view/tests/loan/latest/manifest.json +0 -3
  102. package/dist/esm/view/tests/scriptingObjects/appraisalServiceModule.js +0 -67
  103. package/dist/esm/view/tests/scriptingObjects/constant.js +0 -4
  104. package/dist/esm/view/tests/scriptingObjects/global.js +0 -20
  105. package/dist/esm/view/tests/scriptingObjects/loan.js +0 -187
  106. package/dist/esm/view/tests/server.js +0 -9
  107. package/dist/esm/view/tests/serverHandlers.js +0 -180
  108. package/dist/esm/view/tests/task/latest/index.dev.js +0 -66
  109. package/dist/esm/view/tests/task/latest/index.js +0 -66
  110. package/dist/esm/view/tests/task/latest/manifest.json +0 -4
  111. package/dist/esm/view/tests/travelhub/23.1/app.checksum.css +0 -3
  112. package/dist/esm/view/tests/travelhub/23.1/app.checksum.js +0 -24
  113. package/dist/esm/view/tests/travelhub/23.1/landing.checksum1.css +0 -3
  114. package/dist/esm/view/tests/travelhub/23.1/landing.checksum1.js +0 -5
  115. package/dist/esm/view/tests/travelhub/23.1/manifest.json +0 -6
  116. package/dist/esm/view/tests/travelhub/latest/app.checksum.css +0 -3
  117. package/dist/esm/view/tests/travelhub/latest/app.checksum.js +0 -29
  118. package/dist/esm/view/tests/travelhub/latest/landing.checksum.css +0 -3
  119. package/dist/esm/view/tests/travelhub/latest/landing.checksum.js +0 -7
  120. package/dist/esm/view/tests/travelhub/latest/manifest.json +0 -6
  121. package/dist/esm/view/tests/utils.js +0 -33
  122. package/dist/types/lib/utils/micro-frontend/app-bridge.d.ts +0 -4
  123. package/dist/types/lib/utils/micro-frontend/tests/utils.d.ts +0 -39
  124. package/dist/types/lib/view/microapp-v2.d.ts +0 -16
  125. package/dist/types/lib/view/tests/constants.d.ts +0 -11
  126. package/dist/types/lib/view/tests/flights/23.1/app.checksum1.d.ts +0 -7
  127. package/dist/types/lib/view/tests/flights/latest/app.checksum.d.ts +0 -7
  128. package/dist/types/lib/view/tests/hotels/23.1/app.checksum.d.ts +0 -7
  129. package/dist/types/lib/view/tests/hotels/latest/app.checksum.d.ts +0 -7
  130. package/dist/types/lib/view/tests/loan/latest/index.d.ts +0 -11
  131. package/dist/types/lib/view/tests/microapp-v2.test.d.ts +0 -1
  132. package/dist/types/lib/view/tests/scriptingObjects/appraisalServiceModule.d.ts +0 -36
  133. package/dist/types/lib/view/tests/scriptingObjects/constant.d.ts +0 -1
  134. package/dist/types/lib/view/tests/scriptingObjects/global.d.ts +0 -9
  135. package/dist/types/lib/view/tests/scriptingObjects/loan.d.ts +0 -31
  136. package/dist/types/lib/view/tests/server.d.ts +0 -1
  137. package/dist/types/lib/view/tests/serverHandlers.d.ts +0 -5
  138. package/dist/types/lib/view/tests/task/latest/index.d.ts +0 -10
  139. package/dist/types/lib/view/tests/task/latest/index.dev.d.ts +0 -10
  140. package/dist/types/lib/view/tests/travelhub/23.1/app.checksum.d.ts +0 -7
  141. package/dist/types/lib/view/tests/travelhub/23.1/landing.checksum1.d.ts +0 -2
  142. package/dist/types/lib/view/tests/travelhub/latest/app.checksum.d.ts +0 -0
  143. package/dist/types/lib/view/tests/travelhub/latest/landing.checksum.d.ts +0 -0
  144. package/dist/types/lib/view/tests/utils.d.ts +0 -7
  145. /package/dist/types/lib/{view/tests/micro-iframe-app.test.d.ts → utils/micro-frontend/tests/guest-ssf-host.test.d.ts} +0 -0
@@ -1,7 +1,6 @@
1
1
  import _ from "lodash";
2
2
  import { v4 as uuidv4 } from "uuid";
3
3
  import { getDefaultTheme } from "@elliemae/pui-theme";
4
- import { SSFGuest } from "@elliemae/ssf-guest";
5
4
  import { getWindow } from "../window.js";
6
5
  import { loadAppConfig } from "../app-config/index.js";
7
6
  import { getAppConfigValue } from "../app-config/config.js";
@@ -11,7 +10,8 @@ import { setLogger } from "../logger.js";
11
10
  import { removeStorageEvents } from "../web-storage.js";
12
11
  import { updateBAEventParameters } from "./scripting-objects/web-analytics.js";
13
12
  import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
14
- import { getAppBridge } from "./app-bridge.js";
13
+ import { SSFGuestAdapter } from "./ssfguest-adapter.js";
14
+ import { setHostApp } from "./host-app.js";
15
15
  const isCrossDomain = () => {
16
16
  try {
17
17
  window.parent.document;
@@ -20,11 +20,6 @@ const isCrossDomain = () => {
20
20
  return true;
21
21
  }
22
22
  };
23
- var CommunicationMethod = /* @__PURE__ */ ((CommunicationMethod2) => {
24
- CommunicationMethod2["SSF"] = "ssf";
25
- CommunicationMethod2["APPSDK"] = "app-sdk";
26
- return CommunicationMethod2;
27
- })(CommunicationMethod || {});
28
23
  class CMicroAppGuest {
29
24
  /**
30
25
  * unique microapp id
@@ -35,14 +30,6 @@ class CMicroAppGuest {
35
30
  appId;
36
31
  props;
37
32
  containerId;
38
- /**
39
- * communication method used between microapps
40
- */
41
- #communicationMethod;
42
- /**
43
- * AppBridge instance
44
- */
45
- #appBridge = null;
46
33
  onInit;
47
34
  onMount;
48
35
  onUnmount;
@@ -53,7 +40,6 @@ class CMicroAppGuest {
53
40
  window.emui.uuid = window.emui.uuid || uuidv4();
54
41
  this.appId = window.emui?.appId || getAppConfigValue("appId");
55
42
  this.#uuid = window.emui.uuid;
56
- this.#communicationMethod = "app-sdk" /* APPSDK */;
57
43
  this.props = {
58
44
  host: null,
59
45
  hostUrl: null,
@@ -75,7 +61,7 @@ class CMicroAppGuest {
75
61
  }
76
62
  static getInstance(params) {
77
63
  if (!this.instance) {
78
- this.instance = new CMicroAppGuest(params);
64
+ this.instance = new this(params);
79
65
  }
80
66
  return this.instance;
81
67
  }
@@ -91,45 +77,6 @@ class CMicroAppGuest {
91
77
  getLogger() {
92
78
  return this.logger;
93
79
  }
94
- getObject(objectId) {
95
- let host = null;
96
- if (this.#communicationMethod === "ssf" /* SSF */) {
97
- host = this.getHost();
98
- return host.getObject(objectId);
99
- }
100
- host = this.getHost();
101
- return host.getObject(objectId);
102
- }
103
- /**
104
- * subscribe to the scripting object event
105
- * @param {SubscribeParam<EventId, AppEvents[EventId]>} params - the parameters for the subscription
106
- * @param {string} params.soName - the name of the scripting object
107
- * @param {string} params.eventName - the name of the event
108
- * @param {Function} params.callback - the callback function to be called when the event is triggered
109
- * @returns {void}
110
- */
111
- subscribe(params) {
112
- let host = null;
113
- if (this.#communicationMethod === "ssf" /* SSF */) {
114
- host = this.getHost();
115
- return host.subscribe(params);
116
- }
117
- host = this.getHost();
118
- return host.subscribe(params);
119
- }
120
- /**
121
- * unsubscribe from the scripting object event
122
- * @param params - parameters for the unsubscription
123
- */
124
- unsubscribe(params) {
125
- let host = null;
126
- if (this.#communicationMethod === "ssf" /* SSF */) {
127
- host = this.getHost();
128
- host.unsubscribe(params);
129
- }
130
- host = this.getHost();
131
- host.unsubscribe(params);
132
- }
133
80
  getProps() {
134
81
  return this.props;
135
82
  }
@@ -194,22 +141,21 @@ class CMicroAppGuest {
194
141
  }
195
142
  getSessionStorageItem(key) {
196
143
  let value = sessionStorage.getItem(key);
197
- const host = this.getHost();
198
- if (!value && host?.getItem) {
199
- value = host.getItem(key);
144
+ if (!value && this.props.host?.getItem) {
145
+ value = this.props.host.getItem(key);
200
146
  }
201
147
  return value;
202
148
  }
203
- async findHost() {
149
+ async getSSFAdapter() {
204
150
  let host = null;
205
151
  if (window.parent !== window) {
206
152
  if (!isCrossDomain()) {
207
- host = window.parent?.emui?.MicroAppHost ?? null;
153
+ host = window.parent?.emui?.MicroAppHost || null;
208
154
  }
209
155
  if (!host) {
210
- host = new SSFGuest({ appLogger: this.logger });
211
- await host.connect();
212
- this.#communicationMethod = "ssf" /* SSF */;
156
+ const ssfAdapter = new SSFGuestAdapter();
157
+ if (!await ssfAdapter.init()) return null;
158
+ host = ssfAdapter;
213
159
  }
214
160
  }
215
161
  return host;
@@ -221,21 +167,17 @@ class CMicroAppGuest {
221
167
  this.props = _.merge(this.props, options);
222
168
  this.props.history = options?.history || this.props.history;
223
169
  if (!this.props.host) {
224
- const host = await this.findHost();
225
- if (host) {
226
- this.props.host = host;
227
- }
170
+ const host = await this.getSSFAdapter();
171
+ if (host) this.props.host = host;
228
172
  }
173
+ if (this.props.host) setHostApp(this.props.host);
229
174
  __webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
230
175
  return loadAppConfig().then(() => {
231
176
  const instanceId = this.getSessionStorageItem("instanceId") || "";
232
177
  const userId = this.getSessionStorageItem("userId") || "";
233
178
  updateBAEventParameters({ appId: this.appId, instanceId, userId });
234
179
  setAppDynamicsUserData({ appId: this.appId, instanceId, userId });
235
- return getAppBridge().then((appBridge) => {
236
- this.#appBridge = appBridge;
237
- if (this.onInit) this.onInit(this.props);
238
- });
180
+ if (this.onInit) this.onInit(this.props);
239
181
  });
240
182
  }
241
183
  mount(options = { containerId: "app-container" }) {
@@ -256,34 +198,6 @@ class CMicroAppGuest {
256
198
  navigate(url, state) {
257
199
  if (url) this.props.history.push(url, state);
258
200
  }
259
- /**
260
- * add scripting object for child microapp to use
261
- * @param so - The scripting object to be added.
262
- * @param params - Optional parameters for adding the scripting object.
263
- */
264
- addScriptingObject(so, params) {
265
- if (this.#appBridge) {
266
- this.#appBridge.addScriptingObject(so, params);
267
- }
268
- }
269
- /**
270
- * dispatch event to child microapp
271
- * @param {DispatchEventParams<EventId, Params>} params - event parameters
272
- */
273
- async dispatchEvent(params) {
274
- if (this.#appBridge) {
275
- await this.#appBridge.dispatchEvent(params);
276
- }
277
- }
278
- /**
279
- * removes scripting object from child microapp use
280
- * @param objectId unique id of the scripting object
281
- */
282
- removeScriptingObject(objectId) {
283
- if (this.#appBridge) {
284
- this.#appBridge.removeScriptingObject(objectId);
285
- }
286
- }
287
201
  }
288
202
  export {
289
203
  CMicroAppGuest
@@ -0,0 +1,9 @@
1
+ let hostApp = null;
2
+ const setHostApp = (host) => {
3
+ hostApp = host;
4
+ };
5
+ const getHostApp = () => hostApp;
6
+ export {
7
+ getHostApp,
8
+ setHostApp
9
+ };
@@ -24,7 +24,7 @@ import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
24
24
  import { Analytics } from "./scripting-objects/analytics.js";
25
25
  import { updateBAEventParameters } from "./scripting-objects/web-analytics.js";
26
26
  import { renewSession } from "../session.js";
27
- import { getAppBridge } from "./app-bridge.js";
27
+ import { setHostApp } from "./host-app.js";
28
28
  class CMicroAppHost {
29
29
  static instance;
30
30
  logger;
@@ -36,7 +36,6 @@ class CMicroAppHost {
36
36
  throttleRenewSessionTimer;
37
37
  scriptingObjects;
38
38
  #ssfHostRef;
39
- #appBridge = null;
40
39
  // eslint-disable-next-line max-statements
41
40
  constructor(params) {
42
41
  this.appId = getAppConfigValue("appId");
@@ -77,11 +76,6 @@ class CMicroAppHost {
77
76
  }
78
77
  );
79
78
  loadAppConfig().then(() => {
80
- getAppBridge().then((appBridge) => {
81
- this.#appBridge = appBridge;
82
- }).catch((ex) => {
83
- throw ex;
84
- });
85
79
  if (this.onInit) this.onInit(this.props);
86
80
  }).catch(() => {
87
81
  });
@@ -92,7 +86,8 @@ class CMicroAppHost {
92
86
  }
93
87
  static getInstance(params) {
94
88
  if (!this.instance) {
95
- this.instance = new CMicroAppHost(params);
89
+ this.instance = new this(params);
90
+ setHostApp(this.instance);
96
91
  }
97
92
  return this.instance;
98
93
  }
@@ -186,34 +181,6 @@ class CMicroAppHost {
186
181
  async getObject(name) {
187
182
  return this.scriptingObjects[name];
188
183
  }
189
- /**
190
- * add scripting object for child microapp to use
191
- * @param so - The scripting object to be added.
192
- * @param params - Optional parameters for adding the scripting object.
193
- */
194
- addScriptingObject(so, params) {
195
- if (this.#appBridge) {
196
- this.#appBridge.addScriptingObject(so, params);
197
- }
198
- }
199
- /**
200
- * dispatch event to child microapp
201
- * @param {DispatchEventParams<EventId, Params>} params - event parameters
202
- */
203
- async dispatchEvent(params) {
204
- if (this.#appBridge) {
205
- await this.#appBridge.dispatchEvent(params);
206
- }
207
- }
208
- /**
209
- * removes scripting object from child microapp use
210
- * @param objectId unique id of the scripting object
211
- */
212
- removeScriptingObject(objectId) {
213
- if (this.#appBridge) {
214
- this.#appBridge.removeScriptingObject(objectId);
215
- }
216
- }
217
184
  }
218
185
  export {
219
186
  CMicroAppHost
@@ -1,8 +1,8 @@
1
- import { ScriptingObject } from "@elliemae/ssf-host";
1
+ import ssfHost from "@elliemae/em-ssf-host";
2
2
  import { getBAEventParameters } from "./web-analytics.js";
3
3
  import { getProductAppDetails } from "../../helpers.js";
4
4
  import { HeadSampler } from "../../headSampler.js";
5
- class Analytics extends ScriptingObject {
5
+ class Analytics extends ssfHost.ScriptingObject {
6
6
  /**
7
7
  * logger instance
8
8
  */
@@ -0,0 +1,28 @@
1
+ import ssfGuest from "@elliemae/em-ssf-guest";
2
+ class SSFGuestAdapter {
3
+ async init() {
4
+ if (!ssfGuest) return false;
5
+ await ssfGuest.connect();
6
+ return true;
7
+ }
8
+ async getObject(name) {
9
+ return ssfGuest.getObject(name);
10
+ }
11
+ subscribe(message, func) {
12
+ const callback = (scriptingObj, eventData) => {
13
+ func(message, eventData);
14
+ };
15
+ const [objectId, eventName] = message.split(".");
16
+ return ssfGuest.subscribe(
17
+ objectId,
18
+ eventName || "",
19
+ callback
20
+ );
21
+ }
22
+ unsubscribe(token, objectId, eventName) {
23
+ return ssfGuest.unsubscribe(objectId, eventName, token);
24
+ }
25
+ }
26
+ export {
27
+ SSFGuestAdapter
28
+ };
@@ -1,6 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { render } from "@testing-library/react";
3
- import userEvent from "@testing-library/user-event";
4
3
  import { getDefaultTheme } from "@elliemae/pui-theme";
5
4
  import { createAppStore } from "../../data/store.js";
6
5
  import { AppRoot } from "../../view/app-root/index.js";
@@ -12,10 +11,7 @@ const AllTheProviders = ({
12
11
  theme = defaultTheme,
13
12
  children
14
13
  }) => /* @__PURE__ */ jsx(AppRoot, { store, history: browserHistory, theme, children });
15
- const customRender = (ui, options) => ({
16
- user: userEvent.setup(),
17
- ...render(ui, { wrapper: AllTheProviders, ...options })
18
- });
14
+ const customRender = (ui, options) => render(ui, { wrapper: AllTheProviders, ...options });
19
15
  export * from "@testing-library/react";
20
16
  export {
21
17
  customRender as render
@@ -28,7 +28,7 @@ const IFrame = memo(
28
28
  ref: frameRef,
29
29
  title,
30
30
  src,
31
- "data-testid": `${IFRAME_CONTAINER_ID_PREFIX}${id}`,
31
+ scrolling: "no",
32
32
  ...sandboxProps,
33
33
  onLoad: () => frameRef?.current?.contentDocument && onFrameReady(frameRef.current.contentDocument)
34
34
  }
@@ -69,10 +69,6 @@
69
69
  <strong>JavaScript has been disabled on your browser</strong>, please
70
70
  <strong>enable JS</strong> to make this app work.</noscript
71
71
  >
72
- <div
73
- id="pui-app-container-"
74
- data-testid="pui-app-container-"
75
- class="full-width full-height"
76
- ></div>
72
+ <div id="pui-app-container-" class="full-width full-height"></div>
77
73
  </body>
78
74
  </html>
@@ -2,7 +2,6 @@ import { useEffect } from "react";
2
2
  import { trackActivity } from "../../utils/session.js";
3
3
  import { CMicroAppHost } from "../../utils/micro-frontend/host.js";
4
4
  import { getMicroFrontEndAppConfig } from "../../utils/micro-frontend/index.js";
5
- import { APP_CONTAINER_ID_PREFIX } from "../micro-app/const.js";
6
5
  const addBaseTag = (id, documentEle) => {
7
6
  const { hostUrl, manifestPath } = getMicroFrontEndAppConfig({
8
7
  id
@@ -14,10 +13,9 @@ const addBaseTag = (id, documentEle) => {
14
13
  documentEle.getElementsByTagName("head")[0].appendChild(base);
15
14
  };
16
15
  const updateContainerId = (id, documentEle) => {
17
- const ele = documentEle.getElementById(APP_CONTAINER_ID_PREFIX);
16
+ const ele = documentEle.getElementById("pui-app-container-");
18
17
  if (ele) {
19
18
  ele.id = `${ele.id}${id}`;
20
- ele.dataset.testid = ele.id;
21
19
  }
22
20
  };
23
21
  const useFrameLoaded = ({ id, documentEle }) => {
@@ -81,7 +81,6 @@ export { actions as ariaLive } from './data/live-message/index.js';
81
81
  export { actions as error } from './data/error/index.js';
82
82
  export { actions as logout } from './data/logout/actions.js';
83
83
  export { MicroApp } from './view/micro-app/index.js';
84
- export { MicroApp2 } from './view/microapp-v2.js';
85
84
  export { MicroIFrameApp } from './view/micro-iframe-app/index.js';
86
85
  export { getNavigationLinks } from './view/micro-app/utils.js';
87
86
  export { getStore } from './data/store.js';
@@ -131,3 +131,31 @@ export declare function Throttle(delay?: number): (_target: any, _propertyKey: s
131
131
  * ```
132
132
  */
133
133
  export declare function AsyncSingleExecution(_target: any, _propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
134
+ /**
135
+ * Retries an async method a specified number of times with a delay between attempts.
136
+ * @param {number} [retries=3] - The number of retry attempts.
137
+ * @param {number} [interval=2000] - The delay in milliseconds between retries.
138
+ * @param {boolean} [reThrowException=true] - Whether to rethrow the exception after all retries fail.
139
+ * @returns {MethodDecorator} A method decorator that modifies the property descriptor.
140
+ * @example
141
+ * class Example {
142
+ * @RetryAsync(3, 1000, true)
143
+ * async fetchData() {
144
+ * console.log('Attempting to fetch data...');
145
+ * if (Math.random() < 0.7) {
146
+ * throw new Error('Fetch failed');
147
+ * }
148
+ * return 'Data fetched successfully';
149
+ * }
150
+ * }
151
+ *
152
+ * const instance = new Example();
153
+ * instance.fetchData().then(console.log).catch(console.error);
154
+ *
155
+ * // Output (example):
156
+ * // Attempting to fetch data...
157
+ * // Attempting to fetch data...
158
+ * // Attempting to fetch data...
159
+ * // Error: Fetch failed
160
+ */
161
+ export declare function RetryAsync(retries?: number, interval?: number, reThrowException?: boolean): MethodDecorator;
@@ -1,5 +1,5 @@
1
1
  import { Mixins, Singleton } from './classDecorators.js';
2
- import { AsyncSingleExecution, CacheUntilResolved, Debounce, ImmutableArgs, Memoize, MemoizeAsync, QueueTask, Throttle } from './functionDecorators.js';
2
+ import { AsyncSingleExecution, CacheUntilResolved, Debounce, ImmutableArgs, Memoize, MemoizeAsync, QueueTask, Throttle, RetryAsync } from './functionDecorators.js';
3
3
  declare const decorators: {
4
4
  class: {
5
5
  Mixins: typeof Mixins;
@@ -14,6 +14,7 @@ declare const decorators: {
14
14
  QueueTask: typeof QueueTask;
15
15
  Throttle: typeof Throttle;
16
16
  AsyncSingleExecution: typeof AsyncSingleExecution;
17
+ RetryAsync: typeof RetryAsync;
17
18
  };
18
19
  };
19
20
  export { decorators };
@@ -1,12 +1,8 @@
1
1
  import { DefaultTheme } from 'styled-components';
2
2
  import { History, To } from 'history';
3
3
  import type { IMicroAppGuest, IMicroAppHost, InitOptions, MountOptions } from '@elliemae/pui-micro-frontend-base';
4
- import { ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
5
- import { IMicroFEHost } from '@elliemae/pui-app-bridge';
6
- import type { ScriptingObjects, EventListeners, SubscribeParam, UnsubscribeParam, DispatchEventParam, EventOptions, AddScriptingObjectParams } from '@elliemae/microfe-common';
7
- import { SSFGuest } from '@elliemae/ssf-guest';
8
4
  import { JSONValue, MicroFrontEndLogger } from '../types.js';
9
- export interface GuestProps<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> extends InitOptions<AppObjects, AppEvents> {
5
+ export interface GuestProps extends InitOptions {
10
6
  prevState: JSONValue | null;
11
7
  history: History;
12
8
  theme: DefaultTheme;
@@ -23,7 +19,7 @@ interface ConstructorParams {
23
19
  onGetRef?: OnGetRefCallback;
24
20
  history?: History;
25
21
  }
26
- export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> implements IMicroAppGuest<AppObjects, AppEvents> {
22
+ export declare class CMicroAppGuest implements IMicroAppGuest {
27
23
  #private;
28
24
  private static instance;
29
25
  private readonly logger;
@@ -35,50 +31,19 @@ export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partia
35
31
  private readonly onUnmount?;
36
32
  private readonly onGetRef?;
37
33
  private constructor();
38
- static getInstance<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events>(params?: ConstructorParams): CMicroAppGuest<AppObjects, AppEvents>;
34
+ static getInstance(params?: ConstructorParams): CMicroAppGuest;
39
35
  static isInitialized(): boolean;
40
36
  static isHosted(): boolean;
41
- getHost(): IMicroAppHost<Partial<ScriptingObjectTypes>, Events> | IMicroFEHost<Partial<ScriptingObjectTypes>, Events> | SSFGuest<Partial<ScriptingObjectTypes>, Events> | undefined;
37
+ getHost(): IMicroAppHost | undefined;
42
38
  getLogger(): MicroFrontEndLogger;
43
- getObject<ObjectId extends Extract<keyof AppObjects, string>>(objectId: ObjectId): Promise<AppObjects[ObjectId] | null>;
44
- /**
45
- * subscribe to the scripting object event
46
- * @param {SubscribeParam<EventId, AppEvents[EventId]>} params - the parameters for the subscription
47
- * @param {string} params.soName - the name of the scripting object
48
- * @param {string} params.eventName - the name of the event
49
- * @param {Function} params.callback - the callback function to be called when the event is triggered
50
- * @returns {void}
51
- */
52
- subscribe<EventId extends Extract<keyof AppEvents, string>>(params: SubscribeParam<EventId, AppEvents[EventId]>): string;
53
- /**
54
- * unsubscribe from the scripting object event
55
- * @param params - parameters for the unsubscription
56
- */
57
- unsubscribe<EventId extends Extract<keyof AppEvents, string>>(params: UnsubscribeParam<EventId>): void;
58
- getProps(): GuestProps<Partial<ScriptingObjectTypes>, Events>;
39
+ getProps(): GuestProps;
59
40
  private getSessionStorageItem;
60
- private findHost;
41
+ private getSSFAdapter;
61
42
  get uuid(): string;
62
- init(options: InitOptions<AppObjects, AppEvents>): Promise<void>;
63
- mount(options?: MountOptions): Promise<void>;
64
- unmount(options: MountOptions): Promise<JSONValue>;
65
- getRef<T>(): T | null;
66
- navigate(url: To, state?: any): void;
67
- /**
68
- * add scripting object for child microapp to use
69
- * @param so - The scripting object to be added.
70
- * @param params - Optional parameters for adding the scripting object.
71
- */
72
- addScriptingObject<SO extends AppObjects[keyof AppObjects]>(so: SO, params?: AddScriptingObjectParams): void;
73
- /**
74
- * dispatch event to child microapp
75
- * @param {DispatchEventParams<EventId, Params>} params - event parameters
76
- */
77
- dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void>;
78
- /**
79
- * removes scripting object from child microapp use
80
- * @param objectId unique id of the scripting object
81
- */
82
- removeScriptingObject(objectId: Extract<keyof AppObjects, string>): void;
43
+ init(this: CMicroAppGuest, options: InitOptions): Promise<void>;
44
+ mount(this: CMicroAppGuest, options?: MountOptions): Promise<void>;
45
+ unmount(this: CMicroAppGuest, options: MountOptions): Promise<JSONValue>;
46
+ getRef<T>(this: CMicroAppGuest): T | null;
47
+ navigate(this: CMicroAppGuest, url: To, state?: any): void;
83
48
  }
84
49
  export {};
@@ -0,0 +1,11 @@
1
+ import { IMicroAppHost } from '@elliemae/pui-micro-frontend-base';
2
+ /**
3
+ * set the host app reference
4
+ * @param host global host object
5
+ */
6
+ export declare const setHostApp: (host: IMicroAppHost) => void;
7
+ /**
8
+ * get the reference to host app
9
+ * @returns the global host object
10
+ */
11
+ export declare const getHostApp: () => IMicroAppHost | null;
@@ -1,9 +1,8 @@
1
1
  import { History, To } from 'history';
2
2
  import { DefaultTheme } from 'styled-components';
3
3
  import { IMicroAppHost, ResizeEventHandler, BreakpointChangeEventHandler, SubscriptionListener } from '@elliemae/pui-micro-frontend-base';
4
- import { SSFHost } from '@elliemae/ssf-host';
5
- import { BAEvent, ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
6
- import type { ScriptingObjects, EventListeners, AddScriptingObjectParams, DispatchEventParam, EventOptions } from '@elliemae/microfe-common';
4
+ import ssfHost from '@elliemae/em-ssf-host';
5
+ import { BAEvent } from '@elliemae/pui-scripting-object';
7
6
  import { MicroFrontEndLogger } from '../types.js';
8
7
  import { Analytics } from './scripting-objects/analytics.js';
9
8
  type HostOptions = {
@@ -20,10 +19,10 @@ type ConstructorParams = {
20
19
  scriptingObjects?: Record<string, any>;
21
20
  onRenewSessionTimer?: () => void;
22
21
  onInit?: OnInitCallback;
23
- ssfHostRef?: SSFHost<ScriptingObjectTypes, Events> | null;
22
+ ssfHostRef?: typeof ssfHost.Host;
24
23
  analytics?: Analytics;
25
24
  };
26
- export declare class CMicroAppHost<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> implements IMicroAppHost<AppObjects, AppEvents> {
25
+ export declare class CMicroAppHost implements IMicroAppHost {
27
26
  #private;
28
27
  private static instance;
29
28
  private readonly logger;
@@ -35,25 +34,25 @@ export declare class CMicroAppHost<AppObjects extends ScriptingObjects = Partial
35
34
  private readonly throttleRenewSessionTimer;
36
35
  scriptingObjects: Record<string, any>;
37
36
  private constructor();
38
- static getInstance<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events>(params?: ConstructorParams): CMicroAppHost<AppObjects, AppEvents>;
37
+ static getInstance(params?: ConstructorParams): CMicroAppHost;
39
38
  static isInitialized(): boolean;
40
- getProps(): HostOptions;
41
- getLogger(): MicroFrontEndLogger;
39
+ getProps(this: CMicroAppHost): HostOptions;
40
+ getLogger(this: CMicroAppHost): MicroFrontEndLogger;
42
41
  getItem(key: string): string | null;
43
42
  setItem(key: string, value: string): void;
44
- getGuests(): Record<string, unknown>;
43
+ getGuests(this: CMicroAppHost): Record<string, unknown>;
45
44
  getGuest<T>(id: string): T | null;
46
45
  publish<Type>(message: string | symbol, data?: Type): boolean;
47
46
  subscribe<T>(message: string | symbol, func: SubscriptionListener<T>): string;
48
47
  unsubscribe(token: string): void;
49
- navigate(url: To, state?: any): void;
48
+ navigate(this: CMicroAppHost, url: To, state?: any): void;
50
49
  openWaitMessage(): void;
51
50
  closeWaitMessage(): void;
52
51
  openErrorBanner(message: string): void;
53
52
  getAuthToken(): string;
54
53
  renewAuthToken(): string;
55
54
  logout(): void;
56
- renewSessionTimer(): Promise<void>;
55
+ renewSessionTimer(this: CMicroAppHost): Promise<void>;
57
56
  getBreakpoint(): keyof import("@elliemae/pui-theme").BreakPoints;
58
57
  getViewportSize(): {
59
58
  width: number;
@@ -64,21 +63,5 @@ export declare class CMicroAppHost<AppObjects extends ScriptingObjects = Partial
64
63
  setSystemVersion(version?: string): void;
65
64
  sendBAEvent(data: BAEvent): void;
66
65
  getObject<T>(name: string): Promise<T>;
67
- /**
68
- * add scripting object for child microapp to use
69
- * @param so - The scripting object to be added.
70
- * @param params - Optional parameters for adding the scripting object.
71
- */
72
- addScriptingObject<SO extends AppObjects[keyof AppObjects]>(so: SO, params?: AddScriptingObjectParams): void;
73
- /**
74
- * dispatch event to child microapp
75
- * @param {DispatchEventParams<EventId, Params>} params - event parameters
76
- */
77
- dispatchEvent<EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(params: DispatchEventParam<EventId, Params, Options>): Promise<void>;
78
- /**
79
- * removes scripting object from child microapp use
80
- * @param objectId unique id of the scripting object
81
- */
82
- removeScriptingObject(objectId: Extract<keyof AppObjects, string>): void;
83
66
  }
84
67
  export {};
@@ -1,4 +1,4 @@
1
- import { ScriptingObject } from '@elliemae/ssf-host';
1
+ import ssfHost from '@elliemae/em-ssf-host';
2
2
  import { IAnalytics, BAEvent, TimingOptions } from '@elliemae/pui-scripting-object';
3
3
  import { MicroFrontEndLogger } from '../../types.js';
4
4
  /**
@@ -19,7 +19,7 @@ type AnalyticsParams = {
19
19
  /**
20
20
  * Analytics scripting object
21
21
  */
22
- export declare class Analytics extends ScriptingObject implements IAnalytics {
22
+ export declare class Analytics extends ssfHost.ScriptingObject implements IAnalytics {
23
23
  #private;
24
24
  /**
25
25
  * Creates new instance of Analytics scripting object
@@ -0,0 +1,7 @@
1
+ import { SubscriptionListener } from '@elliemae/pui-micro-frontend-base';
2
+ export declare class SSFGuestAdapter {
3
+ init(): Promise<boolean>;
4
+ getObject<T>(name: string): Promise<T>;
5
+ subscribe<T>(message: string, func: SubscriptionListener<T>): string | number;
6
+ unsubscribe(token: string, objectId: string, eventName: string): void;
7
+ }
@@ -1,5 +1,4 @@
1
1
  import { InitOptions } from '@elliemae/pui-micro-frontend-base';
2
- import { Events, ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
3
2
  type EnvConfig = {
4
3
  files: Array<string>;
5
4
  };
@@ -14,5 +13,5 @@ export type MicroAppConfig = {
14
13
  development?: EnvConfig;
15
14
  production?: EnvConfig;
16
15
  documentEle: Document;
17
- } & InitOptions<Partial<ScriptingObjectTypes>, Events>;
16
+ } & InitOptions;
18
17
  export {};