@elliemae/pui-app-sdk 5.26.1 → 5.26.3
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/utils/helpers.js +16 -0
- package/dist/cjs/utils/micro-frontend/guest.js +11 -4
- package/dist/esm/utils/helpers.js +16 -0
- package/dist/esm/utils/micro-frontend/guest.js +11 -4
- package/dist/types/lib/utils/helpers.d.ts +7 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
|
@@ -18,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var helpers_exports = {};
|
|
20
20
|
__export(helpers_exports, {
|
|
21
|
+
abortPromise: () => abortPromise,
|
|
21
22
|
convertRelativeToAbsoluteUrl: () => convertRelativeToAbsoluteUrl,
|
|
22
23
|
getProductAppDetails: () => getProductAppDetails,
|
|
23
24
|
isCIBuild: () => isCIBuild,
|
|
@@ -55,3 +56,18 @@ const getProductAppDetails = () => {
|
|
|
55
56
|
appPageTitle
|
|
56
57
|
};
|
|
57
58
|
};
|
|
59
|
+
const abortPromise = ({
|
|
60
|
+
promise,
|
|
61
|
+
delay,
|
|
62
|
+
retValue = false,
|
|
63
|
+
throwError = false,
|
|
64
|
+
errMsg
|
|
65
|
+
}) => Promise.race([
|
|
66
|
+
promise,
|
|
67
|
+
new Promise((resolve, reject) => {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
if (throwError) reject(new Error(errMsg));
|
|
70
|
+
else resolve(retValue);
|
|
71
|
+
}, delay);
|
|
72
|
+
})
|
|
73
|
+
]);
|
|
@@ -45,6 +45,7 @@ var import_web_storage = require("../web-storage.js");
|
|
|
45
45
|
var import_web_analytics = require("./scripting-objects/web-analytics.js");
|
|
46
46
|
var import_appdynamics = require("../../analytics/appdynamics.js");
|
|
47
47
|
var import_app_bridge = require("./app-bridge.js");
|
|
48
|
+
var import_helpers = require("../helpers.js");
|
|
48
49
|
const isCrossDomain = () => {
|
|
49
50
|
try {
|
|
50
51
|
window.parent.document;
|
|
@@ -242,8 +243,13 @@ class CMicroAppGuest {
|
|
|
242
243
|
}
|
|
243
244
|
if (!host) {
|
|
244
245
|
host = new import_ssf_guest.SSFGuest({ appLogger: this.logger });
|
|
245
|
-
await
|
|
246
|
-
|
|
246
|
+
if (await (0, import_helpers.abortPromise)({
|
|
247
|
+
promise: host.connect(),
|
|
248
|
+
delay: 1e3,
|
|
249
|
+
retValue: false
|
|
250
|
+
})) {
|
|
251
|
+
host = null;
|
|
252
|
+
} else this.#communicationMethod = "ssf" /* SSF */;
|
|
247
253
|
}
|
|
248
254
|
}
|
|
249
255
|
return host;
|
|
@@ -252,12 +258,13 @@ class CMicroAppGuest {
|
|
|
252
258
|
return this.#uuid;
|
|
253
259
|
}
|
|
254
260
|
async init(options) {
|
|
255
|
-
|
|
261
|
+
const { history, ...rest } = options;
|
|
262
|
+
this.props = import_lodash.default.merge(this.props, rest);
|
|
256
263
|
if (!this.props.host) {
|
|
257
264
|
const host = await this.findHost();
|
|
258
265
|
if (host) {
|
|
259
266
|
this.props.host = host;
|
|
260
|
-
}
|
|
267
|
+
} else this.logger.warn("unable to connect to host microapp");
|
|
261
268
|
}
|
|
262
269
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
263
270
|
return (0, import_app_config.loadAppConfig)().then(() => {
|
|
@@ -29,7 +29,23 @@ const getProductAppDetails = () => {
|
|
|
29
29
|
appPageTitle
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
+
const abortPromise = ({
|
|
33
|
+
promise,
|
|
34
|
+
delay,
|
|
35
|
+
retValue = false,
|
|
36
|
+
throwError = false,
|
|
37
|
+
errMsg
|
|
38
|
+
}) => Promise.race([
|
|
39
|
+
promise,
|
|
40
|
+
new Promise((resolve, reject) => {
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
if (throwError) reject(new Error(errMsg));
|
|
43
|
+
else resolve(retValue);
|
|
44
|
+
}, delay);
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
32
47
|
export {
|
|
48
|
+
abortPromise,
|
|
33
49
|
convertRelativeToAbsoluteUrl,
|
|
34
50
|
getProductAppDetails,
|
|
35
51
|
isCIBuild,
|
|
@@ -12,6 +12,7 @@ import { removeStorageEvents } from "../web-storage.js";
|
|
|
12
12
|
import { updateBAEventParameters } from "./scripting-objects/web-analytics.js";
|
|
13
13
|
import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
|
|
14
14
|
import { getAppBridge } from "./app-bridge.js";
|
|
15
|
+
import { abortPromise } from "../helpers.js";
|
|
15
16
|
const isCrossDomain = () => {
|
|
16
17
|
try {
|
|
17
18
|
window.parent.document;
|
|
@@ -209,8 +210,13 @@ class CMicroAppGuest {
|
|
|
209
210
|
}
|
|
210
211
|
if (!host) {
|
|
211
212
|
host = new SSFGuest({ appLogger: this.logger });
|
|
212
|
-
await
|
|
213
|
-
|
|
213
|
+
if (await abortPromise({
|
|
214
|
+
promise: host.connect(),
|
|
215
|
+
delay: 1e3,
|
|
216
|
+
retValue: false
|
|
217
|
+
})) {
|
|
218
|
+
host = null;
|
|
219
|
+
} else this.#communicationMethod = "ssf" /* SSF */;
|
|
214
220
|
}
|
|
215
221
|
}
|
|
216
222
|
return host;
|
|
@@ -219,12 +225,13 @@ class CMicroAppGuest {
|
|
|
219
225
|
return this.#uuid;
|
|
220
226
|
}
|
|
221
227
|
async init(options) {
|
|
222
|
-
|
|
228
|
+
const { history, ...rest } = options;
|
|
229
|
+
this.props = _.merge(this.props, rest);
|
|
223
230
|
if (!this.props.host) {
|
|
224
231
|
const host = await this.findHost();
|
|
225
232
|
if (host) {
|
|
226
233
|
this.props.host = host;
|
|
227
|
-
}
|
|
234
|
+
} else this.logger.warn("unable to connect to host microapp");
|
|
228
235
|
}
|
|
229
236
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
230
237
|
return loadAppConfig().then(() => {
|
|
@@ -12,3 +12,10 @@ export declare const getProductAppDetails: () => {
|
|
|
12
12
|
appUrl: string;
|
|
13
13
|
appPageTitle: string;
|
|
14
14
|
};
|
|
15
|
+
export declare const abortPromise: ({ promise, delay, retValue, throwError, errMsg, }: {
|
|
16
|
+
promise: Promise<unknown>;
|
|
17
|
+
delay: number;
|
|
18
|
+
retValue?: unknown;
|
|
19
|
+
throwError?: boolean;
|
|
20
|
+
errMsg?: string;
|
|
21
|
+
}) => Promise<unknown>;
|