@elliemae/pui-app-sdk 5.21.0-beta.7 → 5.21.1
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/analytics/index.js +1 -2
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/utils/app-config/config.js +4 -4
- package/dist/cjs/utils/decorators/functionDecorators.js +35 -2
- package/dist/cjs/utils/decorators/index.js +2 -1
- package/dist/cjs/utils/micro-frontend/guest.js +14 -101
- package/dist/cjs/{view/tests/scriptingObjects/constant.js → utils/micro-frontend/host-app.js} +10 -5
- package/dist/cjs/utils/micro-frontend/host.js +3 -36
- package/dist/cjs/utils/micro-frontend/scripting-objects/analytics.js +12 -2
- package/dist/cjs/{view/tests/utils.js → utils/micro-frontend/ssfguest-adapter.js} +29 -34
- package/dist/cjs/utils/testing/index.js +1 -15
- package/dist/cjs/view/micro-iframe-app/iframe/index.js +1 -1
- package/dist/cjs/view/micro-iframe-app/iframe.html +1 -5
- package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +1 -3
- package/dist/esm/analytics/index.js +1 -2
- package/dist/esm/index.js +1 -7
- package/dist/esm/utils/app-config/config.js +4 -4
- package/dist/esm/utils/decorators/functionDecorators.js +35 -2
- package/dist/esm/utils/decorators/index.js +4 -2
- package/dist/esm/utils/micro-frontend/guest.js +14 -101
- package/dist/esm/utils/micro-frontend/host-app.js +9 -0
- package/dist/esm/utils/micro-frontend/host.js +3 -36
- package/dist/esm/utils/micro-frontend/scripting-objects/analytics.js +2 -2
- package/dist/esm/utils/micro-frontend/ssfguest-adapter.js +28 -0
- package/dist/esm/utils/testing/index.js +1 -5
- package/dist/esm/view/micro-iframe-app/iframe/index.js +1 -1
- package/dist/esm/view/micro-iframe-app/iframe.html +1 -5
- package/dist/esm/view/micro-iframe-app/use-frame-loaded.js +1 -3
- package/dist/types/lib/index.d.ts +1 -2
- package/dist/types/lib/utils/decorators/functionDecorators.d.ts +28 -0
- package/dist/types/lib/utils/decorators/index.d.ts +2 -1
- package/dist/types/lib/utils/micro-frontend/guest.d.ts +11 -46
- package/dist/types/lib/utils/micro-frontend/host-app.d.ts +11 -0
- package/dist/types/lib/utils/micro-frontend/host.d.ts +10 -27
- package/dist/types/lib/utils/micro-frontend/scripting-objects/analytics.d.ts +2 -2
- package/dist/types/lib/utils/micro-frontend/ssfguest-adapter.d.ts +7 -0
- package/dist/types/lib/utils/micro-frontend/types.d.ts +1 -2
- package/dist/types/lib/utils/testing/index.d.ts +1 -57
- package/dist/types/lib/utils/window.d.ts +6 -13
- package/dist/types/lib/view/micro-app/index.d.ts +0 -5
- package/dist/types/lib/view/micro-iframe-app/index.d.ts +0 -5
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -43
- package/dist/cjs/utils/micro-frontend/app-bridge.js +0 -40
- package/dist/cjs/utils/micro-frontend/tests/app.config.json +0 -200
- package/dist/cjs/utils/micro-frontend/tests/utils.js +0 -116
- package/dist/cjs/view/guest-microapp.js +0 -126
- package/dist/cjs/view/tests/__snapshots__/guest-microapp.test.tsx.snap +0 -21
- package/dist/cjs/view/tests/__snapshots__/micro-iframe-app.test.tsx.snap +0 -208
- package/dist/cjs/view/tests/app.config.json +0 -200
- package/dist/cjs/view/tests/constants.js +0 -44
- package/dist/cjs/view/tests/flights/23.1/app.checksum1.css +0 -3
- package/dist/cjs/view/tests/flights/23.1/app.checksum1.js +0 -52
- package/dist/cjs/view/tests/flights/23.1/manifest.json +0 -4
- package/dist/cjs/view/tests/flights/latest/app.checksum.css +0 -3
- package/dist/cjs/view/tests/flights/latest/app.checksum.js +0 -52
- package/dist/cjs/view/tests/flights/latest/manifest.json +0 -4
- package/dist/cjs/view/tests/hotels/23.1/app.checksum.css +0 -3
- package/dist/cjs/view/tests/hotels/23.1/app.checksum.js +0 -52
- package/dist/cjs/view/tests/hotels/23.1/manifest.json +0 -4
- package/dist/cjs/view/tests/hotels/latest/app.checksum.css +0 -3
- package/dist/cjs/view/tests/hotels/latest/app.checksum.js +0 -52
- package/dist/cjs/view/tests/hotels/latest/manifest.json +0 -4
- package/dist/cjs/view/tests/loan/latest/index.js +0 -116
- package/dist/cjs/view/tests/loan/latest/manifest.json +0 -3
- package/dist/cjs/view/tests/scriptingObjects/appraisalServiceModule.js +0 -85
- package/dist/cjs/view/tests/scriptingObjects/global.js +0 -40
- package/dist/cjs/view/tests/scriptingObjects/loan.js +0 -207
- package/dist/cjs/view/tests/server.js +0 -29
- package/dist/cjs/view/tests/serverHandlers.js +0 -210
- package/dist/cjs/view/tests/task/latest/index.dev.js +0 -67
- package/dist/cjs/view/tests/task/latest/index.js +0 -67
- package/dist/cjs/view/tests/task/latest/manifest.json +0 -4
- package/dist/cjs/view/tests/travelhub/23.1/app.checksum.css +0 -3
- package/dist/cjs/view/tests/travelhub/23.1/app.checksum.js +0 -25
- package/dist/cjs/view/tests/travelhub/23.1/landing.checksum1.css +0 -3
- package/dist/cjs/view/tests/travelhub/23.1/landing.checksum1.js +0 -6
- package/dist/cjs/view/tests/travelhub/23.1/manifest.json +0 -6
- package/dist/cjs/view/tests/travelhub/latest/app.checksum.css +0 -3
- package/dist/cjs/view/tests/travelhub/latest/app.checksum.js +0 -30
- package/dist/cjs/view/tests/travelhub/latest/landing.checksum.css +0 -3
- package/dist/cjs/view/tests/travelhub/latest/landing.checksum.js +0 -8
- package/dist/cjs/view/tests/travelhub/latest/manifest.json +0 -6
- package/dist/esm/utils/micro-frontend/app-bridge.js +0 -20
- package/dist/esm/utils/micro-frontend/tests/app.config.json +0 -200
- package/dist/esm/utils/micro-frontend/tests/utils.js +0 -96
- package/dist/esm/view/guest-microapp.js +0 -96
- package/dist/esm/view/tests/__snapshots__/guest-microapp.test.tsx.snap +0 -21
- package/dist/esm/view/tests/__snapshots__/micro-iframe-app.test.tsx.snap +0 -208
- package/dist/esm/view/tests/app.config.json +0 -200
- package/dist/esm/view/tests/constants.js +0 -24
- package/dist/esm/view/tests/flights/23.1/app.checksum1.css +0 -3
- package/dist/esm/view/tests/flights/23.1/app.checksum1.js +0 -51
- package/dist/esm/view/tests/flights/23.1/manifest.json +0 -4
- package/dist/esm/view/tests/flights/latest/app.checksum.css +0 -3
- package/dist/esm/view/tests/flights/latest/app.checksum.js +0 -51
- package/dist/esm/view/tests/flights/latest/manifest.json +0 -4
- package/dist/esm/view/tests/hotels/23.1/app.checksum.css +0 -3
- package/dist/esm/view/tests/hotels/23.1/app.checksum.js +0 -51
- package/dist/esm/view/tests/hotels/23.1/manifest.json +0 -4
- package/dist/esm/view/tests/hotels/latest/app.checksum.css +0 -3
- package/dist/esm/view/tests/hotels/latest/app.checksum.js +0 -51
- package/dist/esm/view/tests/hotels/latest/manifest.json +0 -4
- package/dist/esm/view/tests/loan/latest/index.js +0 -115
- package/dist/esm/view/tests/loan/latest/manifest.json +0 -3
- package/dist/esm/view/tests/scriptingObjects/appraisalServiceModule.js +0 -67
- package/dist/esm/view/tests/scriptingObjects/constant.js +0 -4
- package/dist/esm/view/tests/scriptingObjects/global.js +0 -20
- package/dist/esm/view/tests/scriptingObjects/loan.js +0 -187
- package/dist/esm/view/tests/server.js +0 -9
- package/dist/esm/view/tests/serverHandlers.js +0 -180
- package/dist/esm/view/tests/task/latest/index.dev.js +0 -66
- package/dist/esm/view/tests/task/latest/index.js +0 -66
- package/dist/esm/view/tests/task/latest/manifest.json +0 -4
- package/dist/esm/view/tests/travelhub/23.1/app.checksum.css +0 -3
- package/dist/esm/view/tests/travelhub/23.1/app.checksum.js +0 -24
- package/dist/esm/view/tests/travelhub/23.1/landing.checksum1.css +0 -3
- package/dist/esm/view/tests/travelhub/23.1/landing.checksum1.js +0 -5
- package/dist/esm/view/tests/travelhub/23.1/manifest.json +0 -6
- package/dist/esm/view/tests/travelhub/latest/app.checksum.css +0 -3
- package/dist/esm/view/tests/travelhub/latest/app.checksum.js +0 -29
- package/dist/esm/view/tests/travelhub/latest/landing.checksum.css +0 -3
- package/dist/esm/view/tests/travelhub/latest/landing.checksum.js +0 -7
- package/dist/esm/view/tests/travelhub/latest/manifest.json +0 -6
- package/dist/esm/view/tests/utils.js +0 -33
- package/dist/types/lib/utils/micro-frontend/app-bridge.d.ts +0 -4
- package/dist/types/lib/utils/micro-frontend/tests/utils.d.ts +0 -39
- package/dist/types/lib/view/guest-microapp.d.ts +0 -13
- package/dist/types/lib/view/tests/constants.d.ts +0 -11
- package/dist/types/lib/view/tests/flights/23.1/app.checksum1.d.ts +0 -7
- package/dist/types/lib/view/tests/flights/latest/app.checksum.d.ts +0 -7
- package/dist/types/lib/view/tests/hotels/23.1/app.checksum.d.ts +0 -7
- package/dist/types/lib/view/tests/hotels/latest/app.checksum.d.ts +0 -7
- package/dist/types/lib/view/tests/loan/latest/index.d.ts +0 -11
- package/dist/types/lib/view/tests/micro-iframe-app.test.d.ts +0 -1
- package/dist/types/lib/view/tests/scriptingObjects/appraisalServiceModule.d.ts +0 -36
- package/dist/types/lib/view/tests/scriptingObjects/constant.d.ts +0 -1
- package/dist/types/lib/view/tests/scriptingObjects/global.d.ts +0 -9
- package/dist/types/lib/view/tests/scriptingObjects/loan.d.ts +0 -31
- package/dist/types/lib/view/tests/server.d.ts +0 -1
- package/dist/types/lib/view/tests/serverHandlers.d.ts +0 -5
- package/dist/types/lib/view/tests/task/latest/index.d.ts +0 -10
- package/dist/types/lib/view/tests/task/latest/index.dev.d.ts +0 -10
- package/dist/types/lib/view/tests/travelhub/23.1/app.checksum.d.ts +0 -7
- package/dist/types/lib/view/tests/travelhub/23.1/landing.checksum1.d.ts +0 -2
- package/dist/types/lib/view/tests/travelhub/latest/app.checksum.d.ts +0 -0
- package/dist/types/lib/view/tests/travelhub/latest/landing.checksum.d.ts +0 -0
- package/dist/types/lib/view/tests/utils.d.ts +0 -7
- /package/dist/types/lib/{view/tests/guest-microapp.test.d.ts → utils/micro-frontend/tests/guest-ssf-host.test.d.ts} +0 -0
|
@@ -136,9 +136,9 @@ function AsyncSingleExecution(_target, _propertyKey, descriptor) {
|
|
|
136
136
|
return promiseMap.get(key);
|
|
137
137
|
}
|
|
138
138
|
const promise = originalMethod.apply(this, args);
|
|
139
|
-
if (promise
|
|
139
|
+
if (promise && typeof promise.then === "function") {
|
|
140
140
|
promiseMap.set(key, promise);
|
|
141
|
-
promise.finally(() => {
|
|
141
|
+
promise.catch((e) => e).finally(() => {
|
|
142
142
|
promiseMap.delete(key);
|
|
143
143
|
});
|
|
144
144
|
}
|
|
@@ -146,6 +146,38 @@ function AsyncSingleExecution(_target, _propertyKey, descriptor) {
|
|
|
146
146
|
};
|
|
147
147
|
return descriptor;
|
|
148
148
|
}
|
|
149
|
+
function RetryAsync(retries = 3, interval = 2e3, reThrowException = true) {
|
|
150
|
+
return function(_target, _propertyKey, descriptor) {
|
|
151
|
+
const originalMethod = descriptor.value;
|
|
152
|
+
descriptor.value = async function(...args) {
|
|
153
|
+
let attempts = 0;
|
|
154
|
+
while (attempts < retries) {
|
|
155
|
+
try {
|
|
156
|
+
const result = originalMethod.apply(this, args);
|
|
157
|
+
if (result && typeof result.then === "function") {
|
|
158
|
+
return await result;
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
attempts += 1;
|
|
163
|
+
if (attempts >= retries) {
|
|
164
|
+
if (reThrowException) {
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
await new Promise((resolve) => {
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
resolve(true);
|
|
172
|
+
}, interval);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return void 0;
|
|
177
|
+
};
|
|
178
|
+
return descriptor;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
149
181
|
export {
|
|
150
182
|
AsyncSingleExecution,
|
|
151
183
|
CacheUntilResolved,
|
|
@@ -154,5 +186,6 @@ export {
|
|
|
154
186
|
Memoize,
|
|
155
187
|
MemoizeAsync,
|
|
156
188
|
QueueTask,
|
|
189
|
+
RetryAsync,
|
|
157
190
|
Throttle
|
|
158
191
|
};
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
Memoize,
|
|
8
8
|
MemoizeAsync,
|
|
9
9
|
QueueTask,
|
|
10
|
-
Throttle
|
|
10
|
+
Throttle,
|
|
11
|
+
RetryAsync
|
|
11
12
|
} from "./functionDecorators.js";
|
|
12
13
|
const decorators = {
|
|
13
14
|
class: {
|
|
@@ -22,7 +23,8 @@ const decorators = {
|
|
|
22
23
|
MemoizeAsync,
|
|
23
24
|
QueueTask,
|
|
24
25
|
Throttle,
|
|
25
|
-
AsyncSingleExecution
|
|
26
|
+
AsyncSingleExecution,
|
|
27
|
+
RetryAsync
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
export {
|
|
@@ -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 {
|
|
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
|
|
64
|
+
this.instance = new this(params);
|
|
79
65
|
}
|
|
80
66
|
return this.instance;
|
|
81
67
|
}
|
|
@@ -91,46 +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
|
-
if (!host) return Promise.resolve(null);
|
|
102
|
-
return host.getObject(objectId);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* subscribe to the scripting object event
|
|
106
|
-
* @param {SubscribeParam<EventId, AppEvents[EventId]>} params - the parameters for the subscription
|
|
107
|
-
* @param {string} params.soName - the name of the scripting object
|
|
108
|
-
* @param {string} params.eventName - the name of the event
|
|
109
|
-
* @param {Function} params.callback - the callback function to be called when the event is triggered
|
|
110
|
-
* @returns {void}
|
|
111
|
-
*/
|
|
112
|
-
subscribe(params) {
|
|
113
|
-
let host = null;
|
|
114
|
-
if (this.#communicationMethod === "ssf" /* SSF */) {
|
|
115
|
-
host = this.getHost();
|
|
116
|
-
return host.subscribe(params);
|
|
117
|
-
}
|
|
118
|
-
host = this.getHost();
|
|
119
|
-
return host.subscribe(params);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* unsubscribe from the scripting object event
|
|
123
|
-
* @param params - parameters for the unsubscription
|
|
124
|
-
*/
|
|
125
|
-
unsubscribe(params) {
|
|
126
|
-
let host = null;
|
|
127
|
-
if (this.#communicationMethod === "ssf" /* SSF */) {
|
|
128
|
-
host = this.getHost();
|
|
129
|
-
host.unsubscribe(params);
|
|
130
|
-
}
|
|
131
|
-
host = this.getHost();
|
|
132
|
-
host.unsubscribe(params);
|
|
133
|
-
}
|
|
134
80
|
getProps() {
|
|
135
81
|
return this.props;
|
|
136
82
|
}
|
|
@@ -195,22 +141,21 @@ class CMicroAppGuest {
|
|
|
195
141
|
}
|
|
196
142
|
getSessionStorageItem(key) {
|
|
197
143
|
let value = sessionStorage.getItem(key);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
value = host.getItem(key);
|
|
144
|
+
if (!value && this.props.host?.getItem) {
|
|
145
|
+
value = this.props.host.getItem(key);
|
|
201
146
|
}
|
|
202
147
|
return value;
|
|
203
148
|
}
|
|
204
|
-
async
|
|
149
|
+
async getSSFAdapter() {
|
|
205
150
|
let host = null;
|
|
206
151
|
if (window.parent !== window) {
|
|
207
152
|
if (!isCrossDomain()) {
|
|
208
|
-
host = window.parent?.emui?.MicroAppHost
|
|
153
|
+
host = window.parent?.emui?.MicroAppHost || null;
|
|
209
154
|
}
|
|
210
155
|
if (!host) {
|
|
211
|
-
|
|
212
|
-
await
|
|
213
|
-
|
|
156
|
+
const ssfAdapter = new SSFGuestAdapter();
|
|
157
|
+
if (!await ssfAdapter.init()) return null;
|
|
158
|
+
host = ssfAdapter;
|
|
214
159
|
}
|
|
215
160
|
}
|
|
216
161
|
return host;
|
|
@@ -222,21 +167,17 @@ class CMicroAppGuest {
|
|
|
222
167
|
this.props = _.merge(this.props, options);
|
|
223
168
|
this.props.history = options?.history || this.props.history;
|
|
224
169
|
if (!this.props.host) {
|
|
225
|
-
const host = await this.
|
|
226
|
-
if (host)
|
|
227
|
-
this.props.host = host;
|
|
228
|
-
}
|
|
170
|
+
const host = await this.getSSFAdapter();
|
|
171
|
+
if (host) this.props.host = host;
|
|
229
172
|
}
|
|
173
|
+
if (this.props.host) setHostApp(this.props.host);
|
|
230
174
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
231
175
|
return loadAppConfig().then(() => {
|
|
232
176
|
const instanceId = this.getSessionStorageItem("instanceId") || "";
|
|
233
177
|
const userId = this.getSessionStorageItem("userId") || "";
|
|
234
178
|
updateBAEventParameters({ appId: this.appId, instanceId, userId });
|
|
235
179
|
setAppDynamicsUserData({ appId: this.appId, instanceId, userId });
|
|
236
|
-
|
|
237
|
-
this.#appBridge = appBridge;
|
|
238
|
-
if (this.onInit) this.onInit(this.props);
|
|
239
|
-
});
|
|
180
|
+
if (this.onInit) this.onInit(this.props);
|
|
240
181
|
});
|
|
241
182
|
}
|
|
242
183
|
mount(options = { containerId: "app-container" }) {
|
|
@@ -257,34 +198,6 @@ class CMicroAppGuest {
|
|
|
257
198
|
navigate(url, state) {
|
|
258
199
|
if (url) this.props.history.push(url, state);
|
|
259
200
|
}
|
|
260
|
-
/**
|
|
261
|
-
* add scripting object for child microapp to use
|
|
262
|
-
* @param so - The scripting object to be added.
|
|
263
|
-
* @param params - Optional parameters for adding the scripting object.
|
|
264
|
-
*/
|
|
265
|
-
addScriptingObject(so, params) {
|
|
266
|
-
if (this.#appBridge) {
|
|
267
|
-
this.#appBridge.addScriptingObject(so, params);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* dispatch event to child microapp
|
|
272
|
-
* @param {DispatchEventParams<EventId, Params>} params - event parameters
|
|
273
|
-
*/
|
|
274
|
-
async dispatchEvent(params) {
|
|
275
|
-
if (this.#appBridge) {
|
|
276
|
-
await this.#appBridge.dispatchEvent(params);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* removes scripting object from child microapp use
|
|
281
|
-
* @param objectId unique id of the scripting object
|
|
282
|
-
*/
|
|
283
|
-
removeScriptingObject(objectId) {
|
|
284
|
-
if (this.#appBridge) {
|
|
285
|
-
this.#appBridge.removeScriptingObject(objectId);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
201
|
}
|
|
289
202
|
export {
|
|
290
203
|
CMicroAppGuest
|
|
@@ -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 {
|
|
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
|
|
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
|
|
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
|
|
@@ -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(
|
|
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 }) => {
|
|
@@ -29,7 +29,7 @@ export { SessionTimeout } from './view/session-timeout/index.js';
|
|
|
29
29
|
export { subscribeToSessionExpiryWarning, subscribeToSessionExpiry, subscribeToResetSession, resetUserIdleTime, trackActivity, } from './utils/session.js';
|
|
30
30
|
export { waitMessage as waitMessageAction } from './data/wait-message/actions.js';
|
|
31
31
|
export { initServiceWorker } from './utils/service-worker.js';
|
|
32
|
-
export { CMicroAppGuest
|
|
32
|
+
export { CMicroAppGuest } from './utils/micro-frontend/guest.js';
|
|
33
33
|
export { CMicroAppHost } from './utils/micro-frontend/host.js';
|
|
34
34
|
export { enableReactAppForHostIntegration } from './utils/app-host-integration/react.js';
|
|
35
35
|
export { getAppConfigValue, setAppConfigValue, setAppConfig, } from './utils/app-config/config.js';
|
|
@@ -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 { GuestMicroApp } from './view/guest-microapp.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
|
|
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
|
|
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
|
|
34
|
+
static getInstance(params?: ConstructorParams): CMicroAppGuest;
|
|
39
35
|
static isInitialized(): boolean;
|
|
40
36
|
static isHosted(): boolean;
|
|
41
|
-
getHost(): IMicroAppHost
|
|
37
|
+
getHost(): IMicroAppHost | undefined;
|
|
42
38
|
getLogger(): MicroFrontEndLogger;
|
|
43
|
-
|
|
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
|
|
41
|
+
private getSSFAdapter;
|
|
61
42
|
get uuid(): string;
|
|
62
|
-
init(options: InitOptions
|
|
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;
|