@elliemae/pui-app-sdk 5.26.0 → 5.26.2
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/decorators/index.js +1 -0
- package/dist/cjs/utils/helpers.js +16 -0
- package/dist/cjs/utils/micro-frontend/guest.js +9 -3
- package/dist/esm/utils/decorators/index.js +3 -1
- package/dist/esm/utils/helpers.js +16 -0
- package/dist/esm/utils/micro-frontend/guest.js +9 -3
- package/dist/types/lib/utils/decorators/index.d.ts +2 -1
- package/dist/types/lib/utils/helpers.d.ts +7 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
|
@@ -34,6 +34,7 @@ const decorators = {
|
|
|
34
34
|
ImmutableArgs: import_functionDecorators.ImmutableArgs,
|
|
35
35
|
Memoize: import_functionDecorators.Memoize,
|
|
36
36
|
MemoizeAsync: import_functionDecorators.MemoizeAsync,
|
|
37
|
+
MemoizeSingleArgPrimitive: import_functionDecorators.MemoizeSingleArgPrimitive,
|
|
37
38
|
QueueTask: import_functionDecorators.QueueTask,
|
|
38
39
|
Throttle: import_functionDecorators.Throttle,
|
|
39
40
|
AsyncSingleExecution: import_functionDecorators.AsyncSingleExecution,
|
|
@@ -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;
|
|
@@ -257,7 +263,7 @@ class CMicroAppGuest {
|
|
|
257
263
|
const host = await this.findHost();
|
|
258
264
|
if (host) {
|
|
259
265
|
this.props.host = host;
|
|
260
|
-
}
|
|
266
|
+
} else this.logger.warn("unable to connect to host microapp");
|
|
261
267
|
}
|
|
262
268
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
263
269
|
return (0, import_app_config.loadAppConfig)().then(() => {
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
MemoizeAsync,
|
|
9
9
|
QueueTask,
|
|
10
10
|
Throttle,
|
|
11
|
-
RetryAsync
|
|
11
|
+
RetryAsync,
|
|
12
|
+
MemoizeSingleArgPrimitive
|
|
12
13
|
} from "./functionDecorators.js";
|
|
13
14
|
const decorators = {
|
|
14
15
|
class: {
|
|
@@ -21,6 +22,7 @@ const decorators = {
|
|
|
21
22
|
ImmutableArgs,
|
|
22
23
|
Memoize,
|
|
23
24
|
MemoizeAsync,
|
|
25
|
+
MemoizeSingleArgPrimitive,
|
|
24
26
|
QueueTask,
|
|
25
27
|
Throttle,
|
|
26
28
|
AsyncSingleExecution,
|
|
@@ -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;
|
|
@@ -224,7 +230,7 @@ class CMicroAppGuest {
|
|
|
224
230
|
const host = await this.findHost();
|
|
225
231
|
if (host) {
|
|
226
232
|
this.props.host = host;
|
|
227
|
-
}
|
|
233
|
+
} else this.logger.warn("unable to connect to host microapp");
|
|
228
234
|
}
|
|
229
235
|
__webpack_public_path__ = __webpack_public_path__.replace(/\/?$/, "/");
|
|
230
236
|
return loadAppConfig().then(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Mixins, Singleton } from './classDecorators.js';
|
|
2
|
-
import { AsyncSingleExecution, CacheUntilResolved, Debounce, ImmutableArgs, Memoize, MemoizeAsync, QueueTask, Throttle, RetryAsync } from './functionDecorators.js';
|
|
2
|
+
import { AsyncSingleExecution, CacheUntilResolved, Debounce, ImmutableArgs, Memoize, MemoizeAsync, QueueTask, Throttle, RetryAsync, MemoizeSingleArgPrimitive } from './functionDecorators.js';
|
|
3
3
|
declare const decorators: {
|
|
4
4
|
class: {
|
|
5
5
|
Mixins: typeof Mixins;
|
|
@@ -11,6 +11,7 @@ declare const decorators: {
|
|
|
11
11
|
ImmutableArgs: typeof ImmutableArgs;
|
|
12
12
|
Memoize: typeof Memoize;
|
|
13
13
|
MemoizeAsync: typeof MemoizeAsync;
|
|
14
|
+
MemoizeSingleArgPrimitive: typeof MemoizeSingleArgPrimitive;
|
|
14
15
|
QueueTask: typeof QueueTask;
|
|
15
16
|
Throttle: typeof Throttle;
|
|
16
17
|
AsyncSingleExecution: typeof AsyncSingleExecution;
|
|
@@ -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>;
|