@elliemae/pui-app-sdk 5.22.0-beta.2 → 5.22.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.
- package/dist/cjs/analytics/index.js +1 -2
- package/dist/cjs/api/users/index.js +6 -4
- package/dist/cjs/data/auth/actions.js +10 -2
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/utils/auth/index.js +8 -5
- package/dist/cjs/utils/decorators/functionDecorators.js +6 -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 +14 -8
- 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/login/index.js +4 -3
- 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/cjs/view/require-auth.js +12 -2
- package/dist/esm/analytics/index.js +1 -2
- package/dist/esm/api/users/index.js +6 -4
- package/dist/esm/data/auth/actions.js +10 -2
- package/dist/esm/index.js +1 -7
- package/dist/esm/utils/auth/index.js +8 -5
- package/dist/esm/utils/decorators/functionDecorators.js +6 -1
- 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 +4 -8
- package/dist/esm/utils/micro-frontend/ssfguest-adapter.js +28 -0
- package/dist/esm/utils/testing/index.js +1 -5
- package/dist/esm/view/login/index.js +4 -3
- 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/esm/view/require-auth.js +12 -2
- package/dist/types/lib/api/users/index.d.ts +2 -1
- package/dist/types/lib/data/auth/actions.d.ts +2 -1
- package/dist/types/lib/index.d.ts +1 -2
- package/dist/types/lib/utils/auth/index.d.ts +4 -2
- 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 +5 -8
- 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/login/index.d.ts +2 -1
- 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/lib/view/require-auth.d.ts +2 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -44
- package/dist/cjs/utils/micro-frontend/app-bridge.js +0 -38
- 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 -81
- package/dist/cjs/view/tests/scriptingObjects/global.js +0 -40
- package/dist/cjs/view/tests/scriptingObjects/loan.js +0 -200
- 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 -18
- 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 -63
- package/dist/esm/view/tests/scriptingObjects/constant.js +0 -4
- package/dist/esm/view/tests/scriptingObjects/global.js +0 -22
- package/dist/esm/view/tests/scriptingObjects/loan.js +0 -180
- 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
|
@@ -45,7 +45,8 @@ const RequireAuth = ({
|
|
|
45
45
|
children,
|
|
46
46
|
clientId = import_constants.default.CLIENT_ID,
|
|
47
47
|
scope = "loc",
|
|
48
|
-
responseType = "code"
|
|
48
|
+
responseType = "code",
|
|
49
|
+
isConsumerUser = false
|
|
49
50
|
}) => {
|
|
50
51
|
const AuthManager = (0, import_redux_injectors.createManager)({
|
|
51
52
|
name: "AuthManager",
|
|
@@ -59,5 +60,14 @@ const RequireAuth = ({
|
|
|
59
60
|
(0, import_loginParams.setLoginParams)({ clientId, scope, responseType });
|
|
60
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthManager, { children });
|
|
61
62
|
}
|
|
62
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthManager, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AuthManager, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_login.Login,
|
|
65
|
+
{
|
|
66
|
+
clientId,
|
|
67
|
+
scope,
|
|
68
|
+
responseType,
|
|
69
|
+
isConsumerUser,
|
|
70
|
+
children
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
63
73
|
};
|
|
@@ -15,8 +15,7 @@ const sendBAEvent = ({
|
|
|
15
15
|
self = true
|
|
16
16
|
}) => {
|
|
17
17
|
if (!self) {
|
|
18
|
-
const
|
|
19
|
-
const sendEvent = host?.sendBAEvent;
|
|
18
|
+
const sendEvent = CMicroAppGuest.getInstance()?.getHost()?.sendBAEvent;
|
|
20
19
|
if (sendEvent) {
|
|
21
20
|
sendEvent(data);
|
|
22
21
|
} else {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { getAuthHTTPClient } from "../../communication/http-client/index.js";
|
|
2
|
-
const getUser = async ({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const getUser = async ({
|
|
3
|
+
userName,
|
|
4
|
+
isConsumerUser
|
|
5
|
+
}) => {
|
|
6
|
+
const URL = isConsumerUser ? "/iam/v1/users/me" : `/encompass/v1/users/${userName}`;
|
|
7
|
+
const { data } = await getAuthHTTPClient().get(URL);
|
|
6
8
|
return data;
|
|
7
9
|
};
|
|
8
10
|
export {
|
|
@@ -7,10 +7,18 @@ const auth = {
|
|
|
7
7
|
redirectUri,
|
|
8
8
|
clientId,
|
|
9
9
|
responseType,
|
|
10
|
-
scope
|
|
10
|
+
scope,
|
|
11
|
+
isConsumerUser
|
|
11
12
|
}) => ({
|
|
12
13
|
type: LOGIN,
|
|
13
|
-
payload: {
|
|
14
|
+
payload: {
|
|
15
|
+
code,
|
|
16
|
+
redirectUri,
|
|
17
|
+
clientId,
|
|
18
|
+
responseType,
|
|
19
|
+
scope,
|
|
20
|
+
isConsumerUser
|
|
21
|
+
}
|
|
14
22
|
}),
|
|
15
23
|
logout: ({
|
|
16
24
|
clientId,
|
package/dist/esm/index.js
CHANGED
|
@@ -60,10 +60,7 @@ import {
|
|
|
60
60
|
} from "./utils/session.js";
|
|
61
61
|
import { waitMessage } from "./data/wait-message/actions.js";
|
|
62
62
|
import { initServiceWorker } from "./utils/service-worker.js";
|
|
63
|
-
import {
|
|
64
|
-
CMicroAppGuest,
|
|
65
|
-
CMicroAppGuest as CMicroAppGuest2
|
|
66
|
-
} from "./utils/micro-frontend/guest.js";
|
|
63
|
+
import { CMicroAppGuest } from "./utils/micro-frontend/guest.js";
|
|
67
64
|
import { CMicroAppHost } from "./utils/micro-frontend/host.js";
|
|
68
65
|
import { enableReactAppForHostIntegration } from "./utils/app-host-integration/react.js";
|
|
69
66
|
import {
|
|
@@ -135,7 +132,6 @@ import { actions } from "./data/live-message/index.js";
|
|
|
135
132
|
import { actions as actions2 } from "./data/error/index.js";
|
|
136
133
|
import { actions as actions3 } from "./data/logout/actions.js";
|
|
137
134
|
import { MicroApp } from "./view/micro-app/index.js";
|
|
138
|
-
import { GuestMicroApp } from "./view/guest-microapp.js";
|
|
139
135
|
import { MicroIFrameApp } from "./view/micro-iframe-app/index.js";
|
|
140
136
|
import { getNavigationLinks } from "./view/micro-app/utils.js";
|
|
141
137
|
import { getStore } from "./data/store.js";
|
|
@@ -149,7 +145,6 @@ export {
|
|
|
149
145
|
Analytics,
|
|
150
146
|
AppRoot,
|
|
151
147
|
Autocomplete,
|
|
152
|
-
CMicroAppGuest2 as CMicroApp,
|
|
153
148
|
CMicroAppGuest,
|
|
154
149
|
CMicroAppHost,
|
|
155
150
|
CheckBox,
|
|
@@ -166,7 +161,6 @@ export {
|
|
|
166
161
|
FormItemLayout,
|
|
167
162
|
FormLayoutBlockItem,
|
|
168
163
|
FormSubmitButton,
|
|
169
|
-
GuestMicroApp,
|
|
170
164
|
InputMask,
|
|
171
165
|
InputText,
|
|
172
166
|
LargeTextBox,
|
|
@@ -86,7 +86,8 @@ const authorize = async ({
|
|
|
86
86
|
redirectUri,
|
|
87
87
|
clientId,
|
|
88
88
|
scope,
|
|
89
|
-
responseType
|
|
89
|
+
responseType,
|
|
90
|
+
isConsumerUser
|
|
90
91
|
}) => {
|
|
91
92
|
try {
|
|
92
93
|
const { tokenType, accessToken } = await getToken({
|
|
@@ -112,14 +113,14 @@ const authorize = async ({
|
|
|
112
113
|
bearerToken,
|
|
113
114
|
realm: instanceId,
|
|
114
115
|
userName,
|
|
115
|
-
sessionId: bearerToken
|
|
116
|
+
sessionId: bearerToken?.replace(`${instanceId} `, "")
|
|
116
117
|
};
|
|
117
118
|
sessionStorage.setItem("cred", JSON.stringify(cred));
|
|
118
119
|
sessionStorage.setItem("instanceId", instanceId);
|
|
119
120
|
sessionStorage.setItem("userId", userName);
|
|
120
121
|
loginEvent({ instanceId, userId: userName });
|
|
121
122
|
setAppDynamicsUserData({ instanceId, userId: userName });
|
|
122
|
-
const data = await getUser({ userName });
|
|
123
|
+
const data = await getUser({ userName, isConsumerUser });
|
|
123
124
|
sessionStorage.setItem("userSettings", JSON.stringify(data));
|
|
124
125
|
const pathName = new URL(redirectUri).pathname;
|
|
125
126
|
history.replace(pathName);
|
|
@@ -141,7 +142,8 @@ const authorize = async ({
|
|
|
141
142
|
const login = async ({
|
|
142
143
|
clientId,
|
|
143
144
|
scope,
|
|
144
|
-
responseType
|
|
145
|
+
responseType,
|
|
146
|
+
isConsumerUser
|
|
145
147
|
}) => {
|
|
146
148
|
const { code, idpErrorCode, redirectUri } = getIDPInfoFromUrl();
|
|
147
149
|
const loginInfo = {
|
|
@@ -150,7 +152,8 @@ const login = async ({
|
|
|
150
152
|
responseType,
|
|
151
153
|
redirectUri,
|
|
152
154
|
code,
|
|
153
|
-
idpErrorCode
|
|
155
|
+
idpErrorCode,
|
|
156
|
+
isConsumerUser
|
|
154
157
|
};
|
|
155
158
|
if (code) {
|
|
156
159
|
await authorize(loginInfo);
|
|
@@ -129,8 +129,13 @@ function Throttle(delay = 300) {
|
|
|
129
129
|
}
|
|
130
130
|
function AsyncSingleExecution(_target, _propertyKey, descriptor) {
|
|
131
131
|
const originalMethod = descriptor.value;
|
|
132
|
-
const
|
|
132
|
+
const instanceMap = /* @__PURE__ */ new WeakMap();
|
|
133
133
|
descriptor.value = function(...args) {
|
|
134
|
+
const instance = this;
|
|
135
|
+
if (!instanceMap.has(instance)) {
|
|
136
|
+
instanceMap.set(instance, /* @__PURE__ */ new Map());
|
|
137
|
+
}
|
|
138
|
+
const promiseMap = instanceMap.get(instance);
|
|
134
139
|
const key = JSON.stringify(args);
|
|
135
140
|
if (promiseMap.has(key)) {
|
|
136
141
|
return promiseMap.get(key);
|
|
@@ -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
|
*/
|
|
@@ -108,10 +108,7 @@ class Analytics extends ScriptingObject {
|
|
|
108
108
|
if (!options || !options?.appId || !options?.appUrl)
|
|
109
109
|
throw new Error("parameter options is required");
|
|
110
110
|
const startMark = performance.mark(name, { detail: options });
|
|
111
|
-
return Promise.resolve(
|
|
112
|
-
name: startMark.name,
|
|
113
|
-
startTime: startMark.startTime
|
|
114
|
-
});
|
|
111
|
+
return Promise.resolve(startMark);
|
|
115
112
|
};
|
|
116
113
|
/**
|
|
117
114
|
* end timing measure
|
|
@@ -130,12 +127,11 @@ class Analytics extends ScriptingObject {
|
|
|
130
127
|
* await analytics.endTiming('LongTask', { appId: 'loanApp', appUrl: 'https://loanApp.com' });
|
|
131
128
|
* ```
|
|
132
129
|
*/
|
|
133
|
-
// eslint-disable-next-line complexity
|
|
134
130
|
endTiming = (start, options) => {
|
|
135
131
|
if (!start) throw new Error("parameter start is required");
|
|
136
132
|
if (!options || !options?.appId || !options?.appUrl)
|
|
137
133
|
throw new Error("parameter options is required");
|
|
138
|
-
const measurementName = start
|
|
134
|
+
const measurementName = start.name ?? start;
|
|
139
135
|
const startMark = performance.getEntriesByName(
|
|
140
136
|
measurementName,
|
|
141
137
|
"mark"
|
|
@@ -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
|
|
@@ -7,7 +7,8 @@ const Login = ({
|
|
|
7
7
|
clientId,
|
|
8
8
|
scope,
|
|
9
9
|
responseType,
|
|
10
|
-
children
|
|
10
|
+
children,
|
|
11
|
+
isConsumerUser
|
|
11
12
|
}) => {
|
|
12
13
|
const [userAuthorized, setUserAuthorized] = useState(false);
|
|
13
14
|
const dispatch = useAppDispatch();
|
|
@@ -15,14 +16,14 @@ const Login = ({
|
|
|
15
16
|
useEffect(() => {
|
|
16
17
|
if (ref.current) return;
|
|
17
18
|
ref.current = true;
|
|
18
|
-
login({ clientId, scope, responseType }).then(({ authorized }) => {
|
|
19
|
+
login({ clientId, scope, responseType, isConsumerUser }).then(({ authorized }) => {
|
|
19
20
|
if (authorized) setUserAuthorized(true);
|
|
20
21
|
dispatch({ type: LOGIN_SUCCESS });
|
|
21
22
|
}).catch(() => {
|
|
22
23
|
}).finally(() => {
|
|
23
24
|
ref.current = false;
|
|
24
25
|
});
|
|
25
|
-
}, [dispatch, clientId, scope, responseType]);
|
|
26
|
+
}, [dispatch, clientId, scope, responseType, isConsumerUser]);
|
|
26
27
|
return userAuthorized ? /* @__PURE__ */ jsx(Fragment, { children }) : null;
|
|
27
28
|
};
|
|
28
29
|
export {
|
|
@@ -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 }) => {
|
|
@@ -12,7 +12,8 @@ const RequireAuth = ({
|
|
|
12
12
|
children,
|
|
13
13
|
clientId = enums.CLIENT_ID,
|
|
14
14
|
scope = "loc",
|
|
15
|
-
responseType = "code"
|
|
15
|
+
responseType = "code",
|
|
16
|
+
isConsumerUser = false
|
|
16
17
|
}) => {
|
|
17
18
|
const AuthManager = createManager({
|
|
18
19
|
name: "AuthManager",
|
|
@@ -26,7 +27,16 @@ const RequireAuth = ({
|
|
|
26
27
|
setLoginParams({ clientId, scope, responseType });
|
|
27
28
|
return /* @__PURE__ */ jsx(AuthManager, { children });
|
|
28
29
|
}
|
|
29
|
-
return /* @__PURE__ */ jsx(AuthManager, { children: /* @__PURE__ */ jsx(
|
|
30
|
+
return /* @__PURE__ */ jsx(AuthManager, { children: /* @__PURE__ */ jsx(
|
|
31
|
+
Login,
|
|
32
|
+
{
|
|
33
|
+
clientId,
|
|
34
|
+
scope,
|
|
35
|
+
responseType,
|
|
36
|
+
isConsumerUser,
|
|
37
|
+
children
|
|
38
|
+
}
|
|
39
|
+
) });
|
|
30
40
|
};
|
|
31
41
|
export {
|
|
32
42
|
RequireAuth
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface UsersRequestParams {
|
|
2
2
|
userName: string;
|
|
3
|
+
isConsumerUser: boolean;
|
|
3
4
|
}
|
|
4
|
-
export declare const getUser: ({ userName }: UsersRequestParams) => Promise<Record<string, unknown>>;
|
|
5
|
+
export declare const getUser: ({ userName, isConsumerUser, }: UsersRequestParams) => Promise<Record<string, unknown>>;
|
|
5
6
|
export {};
|
|
@@ -8,6 +8,7 @@ export interface LoginParms {
|
|
|
8
8
|
clientId: string;
|
|
9
9
|
responseType: string;
|
|
10
10
|
scope: string;
|
|
11
|
+
isConsumerUser: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface LogoutParams {
|
|
13
14
|
redirectUri: string;
|
|
@@ -17,6 +18,6 @@ export interface LogoutParams {
|
|
|
17
18
|
code: string;
|
|
18
19
|
}
|
|
19
20
|
export declare const auth: {
|
|
20
|
-
login: ({ code, redirectUri, clientId, responseType, scope, }: LoginParms) => PayloadAction<LoginParms>;
|
|
21
|
+
login: ({ code, redirectUri, clientId, responseType, scope, isConsumerUser, }: LoginParms) => PayloadAction<LoginParms>;
|
|
21
22
|
logout: ({ clientId, redirectUri, responseType, scope, code, }: LogoutParams) => PayloadAction<LogoutParams>;
|
|
22
23
|
};
|