@elliemae/pui-app-sdk 2.4.1 → 2.6.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/api/auth/index.js +1 -1
- package/dist/cjs/data/store.js +8 -6
- package/dist/cjs/utils/auth/index.js +2 -0
- package/dist/cjs/utils/helpers.js +2 -0
- package/dist/cjs/utils/micro-frontend/host.js +2 -2
- package/dist/cjs/utils/url.js +2 -0
- package/dist/cjs/view/micro-app/app-factory/index.js +1 -3
- package/dist/cjs/view/micro-app/resources/manifest.js +12 -3
- package/dist/cjs/view/micro-app/resources/script.js +2 -0
- package/dist/cjs/view/micro-app/resources/style.js +2 -0
- package/dist/cjs/view/micro-app/use-app-will-render.js +3 -1
- package/dist/cjs/view/micro-iframe-app/app.js +49 -0
- package/dist/cjs/view/micro-iframe-app/index.js +19 -29
- package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +2 -0
- package/dist/cjs/view/use-previous.js +18 -0
- package/dist/cjs/view/useQuery/index.js +1 -1
- package/dist/es/api/auth/index.js +1 -1
- package/dist/es/data/store.js +8 -6
- package/dist/es/utils/auth/index.js +1 -0
- package/dist/es/utils/helpers.js +1 -0
- package/dist/es/utils/micro-frontend/host.js +2 -2
- package/dist/es/utils/url.js +1 -0
- package/dist/es/view/micro-app/app-factory/index.js +1 -3
- package/dist/es/view/micro-app/resources/manifest.js +12 -3
- package/dist/es/view/micro-app/resources/script.js +1 -0
- package/dist/es/view/micro-app/resources/style.js +1 -0
- package/dist/es/view/micro-app/use-app-will-render.js +3 -1
- package/dist/es/view/micro-iframe-app/app.js +33 -0
- package/dist/es/view/micro-iframe-app/index.js +21 -25
- package/dist/es/view/micro-iframe-app/use-frame-loaded.js +1 -0
- package/dist/es/view/use-previous.js +8 -0
- package/dist/es/view/useQuery/index.js +1 -1
- package/dist/public/assets/index.0944904d91ed62aebf865bc6461471aa.svg +4 -0
- package/dist/public/assets/index.4c19242eb7de64399b205c842bf3185c.svg +5 -0
- package/dist/public/assets/logo.6799a57c45dd9c96b44e2bac6c4ee12c.svg +2 -0
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiAppSdk.73f2b187826be98ec18f.js +5 -0
- package/dist/public/js/{emuiAppSdk.76f9785513159e1288d9.js.LICENSE.txt → emuiAppSdk.73f2b187826be98ec18f.js.LICENSE.txt} +0 -0
- package/dist/public/js/emuiAppSdk.73f2b187826be98ec18f.js.gz +0 -0
- package/dist/public/js/emuiAppSdk.73f2b187826be98ec18f.js.map +1 -0
- package/dist/types/data/react-redux.d.ts +11 -1
- package/dist/types/data/store.d.ts +17 -2
- package/dist/types/utils/micro-frontend/host.d.ts +2 -2
- package/dist/types/utils/testing/render-with-redux.d.ts +11 -1
- package/dist/types/utils/testing/render-with-router-redux.d.ts +11 -1
- package/dist/types/view/micro-app/resources/manifest.d.ts +3 -2
- package/dist/types/view/micro-app/use-app-will-render.d.ts +6 -1
- package/dist/types/view/micro-iframe-app/app.d.ts +9 -0
- package/dist/types/view/micro-iframe-app/index.d.ts +5 -1
- package/dist/types/view/use-previous.d.ts +1 -0
- package/package.json +16 -16
- package/dist/public/assets/index.0b1a9788cf34ed694203302cf0043632.svg +0 -1
- package/dist/public/assets/index.727d0ddd56d2eede2ff0c35608b4391e.svg +0 -1
- package/dist/public/assets/logo.09d22adfe058bec750135e4e463105ef.svg +0 -1
- package/dist/public/js/emuiAppSdk.76f9785513159e1288d9.js +0 -5
- package/dist/public/js/emuiAppSdk.76f9785513159e1288d9.js.gz +0 -0
- package/dist/public/js/emuiAppSdk.76f9785513159e1288d9.js.map +0 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.introspectToken = exports.revokeToken = exports.getToken = void 0;
|
|
7
7
|
|
|
8
|
-
require("core-js/modules/web.url.js");
|
|
8
|
+
require("core-js/modules/web.url-search-params.js");
|
|
9
9
|
|
|
10
10
|
var _httpClient = require("../../communication/http-client");
|
|
11
11
|
|
package/dist/cjs/data/store.js
CHANGED
|
@@ -17,6 +17,7 @@ var _reduxSaga = _interopRequireDefault(require("redux-saga"));
|
|
|
17
17
|
|
|
18
18
|
var _reducers = require("./reducers");
|
|
19
19
|
|
|
20
|
+
/* eslint-disable max-params */
|
|
20
21
|
const rootReducer = (0, _reducers.createReducer)();
|
|
21
22
|
// global variable
|
|
22
23
|
let appStore = null;
|
|
@@ -31,7 +32,10 @@ const getStore = () => appStore;
|
|
|
31
32
|
|
|
32
33
|
exports.getStore = getStore;
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
// ToDo: middlewareConfig is a temporary parameter and will be removed in the future
|
|
36
|
+
const createStore = (initialState, sagaMiddleware, history, middlewareConfig = {
|
|
37
|
+
thunk: false
|
|
38
|
+
}) => {
|
|
35
39
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
36
40
|
const {
|
|
37
41
|
run: runSaga
|
|
@@ -44,9 +48,7 @@ const createStore = (initialState, sagaMiddleware, history) => {
|
|
|
44
48
|
reducer: rootReducer,
|
|
45
49
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
50
|
// @ts-ignore
|
|
47
|
-
middleware: getDefaultMiddleware => getDefaultMiddleware(
|
|
48
|
-
thunk: false
|
|
49
|
-
}).concat(sagaMiddleware).concat((0, _connectedReactRouter.routerMiddleware)(history)),
|
|
51
|
+
middleware: getDefaultMiddleware => getDefaultMiddleware(middlewareConfig).concat(sagaMiddleware).concat((0, _connectedReactRouter.routerMiddleware)(history)),
|
|
50
52
|
devTools: process.env.NODE_ENV !== 'production',
|
|
51
53
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
54
|
// @ts-ignore
|
|
@@ -70,9 +72,9 @@ const createStore = (initialState, sagaMiddleware, history) => {
|
|
|
70
72
|
return baseStore;
|
|
71
73
|
};
|
|
72
74
|
|
|
73
|
-
const createAppStore = (initialState = {}, history) => {
|
|
75
|
+
const createAppStore = (initialState = {}, history, middlewareConfig) => {
|
|
74
76
|
const sagaMiddleware = (0, _reduxSaga.default)({});
|
|
75
|
-
const store = createStore(initialState, sagaMiddleware, history);
|
|
77
|
+
const store = createStore(initialState, sagaMiddleware, history, middlewareConfig);
|
|
76
78
|
setStore(store);
|
|
77
79
|
return store;
|
|
78
80
|
};
|
|
@@ -7,6 +7,8 @@ exports.login = exports.authorize = exports.endSession = exports.navigateToLogin
|
|
|
7
7
|
|
|
8
8
|
require("core-js/modules/web.url.js");
|
|
9
9
|
|
|
10
|
+
require("core-js/modules/web.url-search-params.js");
|
|
11
|
+
|
|
10
12
|
require("core-js/modules/es.string.replace.js");
|
|
11
13
|
|
|
12
14
|
var _history = require("../history");
|
|
@@ -7,6 +7,8 @@ exports.convertRelativeToAbsoluteUrl = exports.isCIBuild = exports.isProd = void
|
|
|
7
7
|
|
|
8
8
|
require("core-js/modules/web.url.js");
|
|
9
9
|
|
|
10
|
+
require("core-js/modules/web.url-search-params.js");
|
|
11
|
+
|
|
10
12
|
const isProd = () => process.env.NODE_ENV === 'production';
|
|
11
13
|
|
|
12
14
|
exports.isProd = isProd;
|
|
@@ -168,11 +168,11 @@ class CMicroAppHost {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
onResizeEvent(eventHandler) {
|
|
171
|
-
return (0, _pubsubJs.subscribe)(_constants.HOST_WINDOW_RESIZED, eventHandler);
|
|
171
|
+
return (0, _pubsubJs.subscribe)(_constants.HOST_WINDOW_RESIZED, (msg, data) => eventHandler(data));
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
onBreakpointChangeEvent(eventHandler) {
|
|
175
|
-
return (0, _pubsubJs.subscribe)(_constants.HOST_WINDOW_BREAKPOINT_CHANGED, eventHandler);
|
|
175
|
+
return (0, _pubsubJs.subscribe)(_constants.HOST_WINDOW_BREAKPOINT_CHANGED, (msg, data) => eventHandler(data));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
setSystemVersion(version = 'latest') {
|
package/dist/cjs/utils/url.js
CHANGED
|
@@ -155,9 +155,7 @@ const loadApp = async appConfig => {
|
|
|
155
155
|
// get application manifest & full asset name with hash value
|
|
156
156
|
(0, _microFrontend.getLogger)().info(_logRecords.logRecords.APP_LOADING(appConfig.id));
|
|
157
157
|
let assets = appConfig.files;
|
|
158
|
-
const
|
|
159
|
-
data: manifest
|
|
160
|
-
} = await (0, _manifest.getAppManifest)(appConfig);
|
|
158
|
+
const manifest = await (0, _manifest.getAppManifest)(appConfig);
|
|
161
159
|
assets = (0, _manifest.getFullFileNameofAssetsFromManifest)(manifest, appConfig.files); // download each asset by adding it to DOM
|
|
162
160
|
|
|
163
161
|
let counter = 0;
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getFullFileNameofAssetsFromManifest = exports.getAppManifest = void 0;
|
|
7
7
|
|
|
8
|
+
require("core-js/modules/es.string.replace.js");
|
|
9
|
+
|
|
8
10
|
require("core-js/modules/web.url.js");
|
|
9
11
|
|
|
10
|
-
require("core-js/modules/
|
|
12
|
+
require("core-js/modules/web.url-search-params.js");
|
|
11
13
|
|
|
12
14
|
var _httpClient = require("../../../communication/http-client");
|
|
13
15
|
|
|
@@ -17,12 +19,19 @@ var _microFrontend = require("../../../utils/micro-frontend");
|
|
|
17
19
|
|
|
18
20
|
var _logRecords = require("../../../utils/log-records");
|
|
19
21
|
|
|
20
|
-
const
|
|
22
|
+
const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d+\//, '/latest/');
|
|
23
|
+
|
|
24
|
+
const getAppManifest = async ({
|
|
21
25
|
hostUrl,
|
|
22
26
|
manifestPath
|
|
23
27
|
}) => {
|
|
24
28
|
const url = new URL(`${manifestPath.replace(/\/?$/, '/')}manifest.json`, hostUrl);
|
|
25
|
-
|
|
29
|
+
const response = await (0, _httpClient.getHTTPClient)().get((0, _url.removeDoubleSlash)(url.href));
|
|
30
|
+
if (response.headers['content-type'].includes('application/json')) return response.data;
|
|
31
|
+
return getAppManifest({
|
|
32
|
+
hostUrl,
|
|
33
|
+
manifestPath: getUnVersionedManifestPath(manifestPath)
|
|
34
|
+
});
|
|
26
35
|
};
|
|
27
36
|
|
|
28
37
|
exports.getAppManifest = getAppManifest;
|
|
@@ -7,6 +7,8 @@ exports.removePrefetchLinks = exports.removeDynamicImportedScripts = exports.rem
|
|
|
7
7
|
|
|
8
8
|
require("core-js/modules/web.url.js");
|
|
9
9
|
|
|
10
|
+
require("core-js/modules/web.url-search-params.js");
|
|
11
|
+
|
|
10
12
|
var _url = require("../../../utils/url");
|
|
11
13
|
|
|
12
14
|
const APP_SCRIPT_ID_PREFIX = 'emui-script-';
|
|
@@ -7,6 +7,8 @@ exports.removeDynamicImportedStyles = exports.removeStyleFromDOM = exports.addSt
|
|
|
7
7
|
|
|
8
8
|
require("core-js/modules/web.url.js");
|
|
9
9
|
|
|
10
|
+
require("core-js/modules/web.url-search-params.js");
|
|
11
|
+
|
|
10
12
|
var _url = require("../../../utils/url");
|
|
11
13
|
|
|
12
14
|
const APP_STYLE_ID_PREFIX = 'emui-style-';
|
|
@@ -23,7 +23,8 @@ const useAppWillRender = ({
|
|
|
23
23
|
id,
|
|
24
24
|
documentEle,
|
|
25
25
|
history,
|
|
26
|
-
theme
|
|
26
|
+
theme,
|
|
27
|
+
onUnloadComplete
|
|
27
28
|
}) => {
|
|
28
29
|
// ToDo: Since ecc app is using older version of react-redux we need this undefined check. once ECC upgrades to react-redux v6 or later, this check can be removed
|
|
29
30
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -35,6 +36,7 @@ const useAppWillRender = ({
|
|
|
35
36
|
const unload = (0, _react.useCallback)(async appConfig => {
|
|
36
37
|
await (0, _appFactory.unmountApp)(appConfig);
|
|
37
38
|
(0, _appFactory.unloadApp)(appConfig);
|
|
39
|
+
if (onUnloadComplete) onUnloadComplete(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
40
|
}, []);
|
|
39
41
|
const load = (0, _react.useCallback)(async appConfig => {
|
|
40
42
|
if (dispatch) dispatch(_actions.waitMessage.open());
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.App = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
|
|
12
|
+
var _index = _interopRequireDefault(require("file-loader?name=iframe.[contenthash].[ext]!./iframe/index.html"));
|
|
13
|
+
|
|
14
|
+
var _iframe = require("./iframe");
|
|
15
|
+
|
|
16
|
+
var _useFrameLoaded = require("./use-frame-loaded");
|
|
17
|
+
|
|
18
|
+
var _useAppWillRender = require("../micro-app/use-app-will-render");
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const App = /*#__PURE__*/(0, _react.memo)(({
|
|
25
|
+
id,
|
|
26
|
+
dispose,
|
|
27
|
+
onUnloadComplete,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
const [documentEle, setDocumentEle] = (0, _react.useState)(null);
|
|
31
|
+
(0, _useFrameLoaded.useFrameLoaded)({
|
|
32
|
+
id,
|
|
33
|
+
documentEle,
|
|
34
|
+
...rest
|
|
35
|
+
});
|
|
36
|
+
(0, _useAppWillRender.useAppWillRender)({
|
|
37
|
+
id,
|
|
38
|
+
documentEle: dispose ? null : documentEle,
|
|
39
|
+
onUnloadComplete,
|
|
40
|
+
...rest
|
|
41
|
+
});
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_iframe.IFrame, {
|
|
43
|
+
id: id,
|
|
44
|
+
src: _index.default,
|
|
45
|
+
...rest,
|
|
46
|
+
onFrameReady: setDocumentEle
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
exports.App = App;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,38 +7,30 @@ exports.MicroIFrameApp = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _react = require("react");
|
|
11
9
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _iframe = require("./iframe");
|
|
15
|
-
|
|
16
|
-
var _useFrameLoaded = require("./use-frame-loaded");
|
|
10
|
+
var _usePrevious = require("../use-previous");
|
|
17
11
|
|
|
18
|
-
var
|
|
12
|
+
var _app = require("./app");
|
|
19
13
|
|
|
20
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
-
// @ts-ignore
|
|
24
14
|
const MicroIFrameApp = /*#__PURE__*/(0, _react.memo)(({
|
|
25
|
-
|
|
15
|
+
entityId = null,
|
|
26
16
|
...rest
|
|
27
17
|
}) => {
|
|
28
|
-
const [
|
|
29
|
-
(0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
const [disposePrevApp, setDisposePrevApp] = (0, _react.useState)(false);
|
|
19
|
+
const [appKey, setAppKey] = (0, _react.useState)(Date.now());
|
|
20
|
+
const prevEntityId = (0, _usePrevious.usePrevious)(entityId);
|
|
21
|
+
(0, _react.useEffect)(() => {
|
|
22
|
+
if (prevEntityId !== entityId && prevEntityId) {
|
|
23
|
+
setDisposePrevApp(true);
|
|
24
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
|
|
26
|
+
}, [entityId]);
|
|
27
|
+
return /*#__PURE__*/(0, _react.createElement)(_app.App, { ...rest,
|
|
28
|
+
key: appKey,
|
|
29
|
+
dispose: disposePrevApp,
|
|
30
|
+
onUnloadComplete: () => {
|
|
31
|
+
setAppKey(Date.now());
|
|
32
|
+
setDisposePrevApp(false);
|
|
33
|
+
}
|
|
44
34
|
});
|
|
45
35
|
});
|
|
46
36
|
exports.MicroIFrameApp = MicroIFrameApp;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePrevious = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
const usePrevious = value => {
|
|
11
|
+
const ref = (0, _react.useRef)();
|
|
12
|
+
(0, _react.useEffect)(() => {
|
|
13
|
+
ref.current = value;
|
|
14
|
+
}, [value]);
|
|
15
|
+
return ref.current;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.usePrevious = usePrevious;
|
package/dist/es/data/store.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-params */
|
|
1
2
|
// @strip-block
|
|
2
3
|
import { configureStore } from '@reduxjs/toolkit';
|
|
3
4
|
import { createInjectorsEnhancer, forceReducerReload } from 'redux-injectors';
|
|
@@ -12,7 +13,10 @@ export const setStore = store => {
|
|
|
12
13
|
};
|
|
13
14
|
export const getStore = () => appStore;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
// ToDo: middlewareConfig is a temporary parameter and will be removed in the future
|
|
17
|
+
const createStore = (initialState, sagaMiddleware, history, middlewareConfig = {
|
|
18
|
+
thunk: false
|
|
19
|
+
}) => {
|
|
16
20
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
17
21
|
const {
|
|
18
22
|
run: runSaga
|
|
@@ -25,9 +29,7 @@ const createStore = (initialState, sagaMiddleware, history) => {
|
|
|
25
29
|
reducer: rootReducer,
|
|
26
30
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
27
31
|
// @ts-ignore
|
|
28
|
-
middleware: getDefaultMiddleware => getDefaultMiddleware(
|
|
29
|
-
thunk: false
|
|
30
|
-
}).concat(sagaMiddleware).concat(routerMiddleware(history)),
|
|
32
|
+
middleware: getDefaultMiddleware => getDefaultMiddleware(middlewareConfig).concat(sagaMiddleware).concat(routerMiddleware(history)),
|
|
31
33
|
devTools: process.env.NODE_ENV !== 'production',
|
|
32
34
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
35
|
// @ts-ignore
|
|
@@ -58,9 +60,9 @@ const createStore = (initialState, sagaMiddleware, history) => {
|
|
|
58
60
|
return baseStore;
|
|
59
61
|
};
|
|
60
62
|
|
|
61
|
-
export const createAppStore = (initialState = {}, history) => {
|
|
63
|
+
export const createAppStore = (initialState = {}, history, middlewareConfig) => {
|
|
62
64
|
const sagaMiddleware = createSagaMiddleware({});
|
|
63
|
-
const store = createStore(initialState, sagaMiddleware, history);
|
|
65
|
+
const store = createStore(initialState, sagaMiddleware, history, middlewareConfig);
|
|
64
66
|
setStore(store);
|
|
65
67
|
return store;
|
|
66
68
|
};
|
package/dist/es/utils/helpers.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "core-js/modules/web.url.js";
|
|
2
|
+
import "core-js/modules/web.url-search-params.js";
|
|
2
3
|
export const isProd = () => process.env.NODE_ENV === 'production';
|
|
3
4
|
export const isCIBuild = () => process.env.CI === 'true';
|
|
4
5
|
const PROTOCOL = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
@@ -150,11 +150,11 @@ export class CMicroAppHost {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
onResizeEvent(eventHandler) {
|
|
153
|
-
return subscribe(HOST_WINDOW_RESIZED, eventHandler);
|
|
153
|
+
return subscribe(HOST_WINDOW_RESIZED, (msg, data) => eventHandler(data));
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
onBreakpointChangeEvent(eventHandler) {
|
|
157
|
-
return subscribe(HOST_WINDOW_BREAKPOINT_CHANGED, eventHandler);
|
|
157
|
+
return subscribe(HOST_WINDOW_BREAKPOINT_CHANGED, (msg, data) => eventHandler(data));
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
setSystemVersion(version = 'latest') {
|
package/dist/es/utils/url.js
CHANGED
|
@@ -130,9 +130,7 @@ export const loadApp = async appConfig => {
|
|
|
130
130
|
// get application manifest & full asset name with hash value
|
|
131
131
|
getLogger().info(logRecords.APP_LOADING(appConfig.id));
|
|
132
132
|
let assets = appConfig.files;
|
|
133
|
-
const
|
|
134
|
-
data: manifest
|
|
135
|
-
} = await getAppManifest(appConfig);
|
|
133
|
+
const manifest = await getAppManifest(appConfig);
|
|
136
134
|
assets = getFullFileNameofAssetsFromManifest(manifest, appConfig.files); // download each asset by adding it to DOM
|
|
137
135
|
|
|
138
136
|
let counter = 0;
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import "core-js/modules/web.url.js";
|
|
2
1
|
import "core-js/modules/es.string.replace.js";
|
|
2
|
+
import "core-js/modules/web.url.js";
|
|
3
|
+
import "core-js/modules/web.url-search-params.js";
|
|
3
4
|
import { getHTTPClient } from "../../../communication/http-client";
|
|
4
5
|
import { removeDoubleSlash } from "../../../utils/url";
|
|
5
6
|
import { getLogger } from "../../../utils/micro-frontend";
|
|
6
7
|
import { logRecords } from "../../../utils/log-records";
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
const getUnVersionedManifestPath = path => path.replace(/\/\d+\.\d+\//, '/latest/');
|
|
10
|
+
|
|
11
|
+
export const getAppManifest = async ({
|
|
8
12
|
hostUrl,
|
|
9
13
|
manifestPath
|
|
10
14
|
}) => {
|
|
11
15
|
const url = new URL(`${manifestPath.replace(/\/?$/, '/')}manifest.json`, hostUrl);
|
|
12
|
-
|
|
16
|
+
const response = await getHTTPClient().get(removeDoubleSlash(url.href));
|
|
17
|
+
if (response.headers['content-type'].includes('application/json')) return response.data;
|
|
18
|
+
return getAppManifest({
|
|
19
|
+
hostUrl,
|
|
20
|
+
manifestPath: getUnVersionedManifestPath(manifestPath)
|
|
21
|
+
});
|
|
13
22
|
};
|
|
14
23
|
export const getFullFileNameofAssetsFromManifest = (manifest, assetNames = []) => assetNames.reduce((assets, assetName) => {
|
|
15
24
|
const fullFileName = manifest[assetName];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "core-js/modules/web.url.js";
|
|
2
|
+
import "core-js/modules/web.url-search-params.js";
|
|
2
3
|
import { removeDoubleSlash } from "../../../utils/url";
|
|
3
4
|
export const APP_SCRIPT_ID_PREFIX = 'emui-script-';
|
|
4
5
|
const HEAD_SCRIPTS = new RegExp('/(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js', 'i'); // const isDeferEligible = (scriptSrc: string) => !HEAD_SCRIPTS.test(scriptSrc);
|
|
@@ -9,7 +9,8 @@ export const useAppWillRender = ({
|
|
|
9
9
|
id,
|
|
10
10
|
documentEle,
|
|
11
11
|
history,
|
|
12
|
-
theme
|
|
12
|
+
theme,
|
|
13
|
+
onUnloadComplete
|
|
13
14
|
}) => {
|
|
14
15
|
// ToDo: Since ecc app is using older version of react-redux we need this undefined check. once ECC upgrades to react-redux v6 or later, this check can be removed
|
|
15
16
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -21,6 +22,7 @@ export const useAppWillRender = ({
|
|
|
21
22
|
const unload = useCallback(async appConfig => {
|
|
22
23
|
await unmountApp(appConfig);
|
|
23
24
|
unloadApp(appConfig);
|
|
25
|
+
if (onUnloadComplete) onUnloadComplete(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
26
|
}, []);
|
|
25
27
|
const load = useCallback(async appConfig => {
|
|
26
28
|
if (dispatch) dispatch(waitMessage.open());
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { memo, useState } from 'react'; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
|
|
4
|
+
import frameHtml from 'file-loader?name=iframe.[contenthash].[ext]!./iframe/index.html';
|
|
5
|
+
import { IFrame } from "./iframe";
|
|
6
|
+
import { useFrameLoaded } from "./use-frame-loaded";
|
|
7
|
+
import { useAppWillRender } from "../micro-app/use-app-will-render";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const App = /*#__PURE__*/memo(({
|
|
10
|
+
id,
|
|
11
|
+
dispose,
|
|
12
|
+
onUnloadComplete,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const [documentEle, setDocumentEle] = useState(null);
|
|
16
|
+
useFrameLoaded({
|
|
17
|
+
id,
|
|
18
|
+
documentEle,
|
|
19
|
+
...rest
|
|
20
|
+
});
|
|
21
|
+
useAppWillRender({
|
|
22
|
+
id,
|
|
23
|
+
documentEle: dispose ? null : documentEle,
|
|
24
|
+
onUnloadComplete,
|
|
25
|
+
...rest
|
|
26
|
+
});
|
|
27
|
+
return /*#__PURE__*/_jsx(IFrame, {
|
|
28
|
+
id: id,
|
|
29
|
+
src: frameHtml,
|
|
30
|
+
...rest,
|
|
31
|
+
onFrameReady: setDocumentEle
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { IFrame } from "./iframe";
|
|
6
|
-
import { useFrameLoaded } from "./use-frame-loaded";
|
|
7
|
-
import { useAppWillRender } from "../micro-app/use-app-will-render";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { useEffect, useState, memo } from 'react';
|
|
2
|
+
import { usePrevious } from "../use-previous";
|
|
3
|
+
import { App } from "./app";
|
|
4
|
+
import { createElement as _createElement } from "react";
|
|
9
5
|
export const MicroIFrameApp = /*#__PURE__*/memo(({
|
|
10
|
-
|
|
6
|
+
entityId = null,
|
|
11
7
|
...rest
|
|
12
8
|
}) => {
|
|
13
|
-
const [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
const [disposePrevApp, setDisposePrevApp] = useState(false);
|
|
10
|
+
const [appKey, setAppKey] = useState(Date.now());
|
|
11
|
+
const prevEntityId = usePrevious(entityId);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (prevEntityId !== entityId && prevEntityId) {
|
|
14
|
+
setDisposePrevApp(true);
|
|
15
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
+
|
|
17
|
+
}, [entityId]);
|
|
18
|
+
return /*#__PURE__*/_createElement(App, { ...rest,
|
|
19
|
+
key: appKey,
|
|
20
|
+
dispose: disposePrevApp,
|
|
21
|
+
onUnloadComplete: () => {
|
|
22
|
+
setAppKey(Date.now());
|
|
23
|
+
setDisposePrevApp(false);
|
|
24
|
+
}
|
|
29
25
|
});
|
|
30
26
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16"><g><path fill="#ffffff" d="M8,2c1.1,0,2,0.9,2,2v1c0,1.1-0.9,2-2,2S6,6.1,6,5V4C6,2.9,6.9,2,8,2 M8,0C5.8,0,4,1.8,4,4v1
|
|
2
|
+
c0,2.2,1.8,4,4,4s4-1.8,4-4V4C12,1.8,10.2,0,8,0L8,0z"/>
|
|
3
|
+
<path data-color="color-2" fill="#ffffff" d="M9,12c1.5,0,2.8,0.8,3.5,2l-8.9,0c0.7-1.2,2-2,3.5-2H9 M9,10H7c-3.3,0-6,2.7-6,6v0h14v0
|
|
4
|
+
C15,12.7,12.3,10,9,10L9,10z"/></g></svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16"><g>
|
|
2
|
+
<path data-color="color-2" fill="#ffffff" d="M10,14H6c0,1.1,0.9,2,2,2S10,15.1,10,14z"/>
|
|
3
|
+
<path fill="#ffffff" d="M15,11h-0.5C13.8,10.3,13,9.3,13,8V5c0-2.8-2.2-5-5-5S3,2.2,3,5v3c0,1.3-0.8,2.3-1.5,3H1c-0.6,0-1,0.4-1,1
|
|
4
|
+
s0.4,1,1,1h14c0.6,0,1-0.4,1-1S15.6,11,15,11z"/>
|
|
5
|
+
</g></svg>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" width="195" height="28" viewBox="0 0 195 28"><style>.st0{fill:#dee3e0}.st1{fill:#fff}.st2{fill:#408a90}.st3{fill:#00acdc}.st4{fill:#f7911e}.st5{fill:#0067ab}.st6{fill:#fefefe}</style><g id="Page-1_2_"><g id="brand-assets" transform="translate(-107 -187)"><g id="logo-enc-em-inline-dark" transform="translate(107 187)"><g id="Group-3"><g id="Group" transform="translate(143 14)"><path id="Fill-27" class="st0" d="M1.8 1.9c-.6 0-.9.6-.9 1.1s.3 1.1.9 1.1c.6 0 .8-.7.8-1.1.1-.5-.2-1.1-.8-1.1zM.4.1h.5v1.8c.2-.3.5-.5 1-.5.9 0 1.3.7 1.3 1.5s-.4 1.6-1.3 1.6c-.5 0-.9-.3-1-.5v.4H.4V.1z"/><path id="Fill-29" class="st0" d="M3.7 5.3H4c.5 0 .7-.7.7-.7 0-.1-.1-.2-.1-.3l-1-2.8h.6L5 4l.8-2.5h.6l-1.1 3c-.2.6-.4 1.2-1.1 1.2h-.4l-.1-.4z"/><path id="Fill-31" class="st0" d="M50.5 1.8h.2c.1 0 .2 0 .2-.2 0-.1-.1-.2-.2-.2h-.2v.4zm-.2-.5h.4c.3 0 .4.1.4.3 0 .2-.1.3-.3.3l.3.5h-.2l-.3-.5h-.2v.5h-.2V1.3h.1zm.3 1.4c.5 0 .8-.4.8-.8 0-.5-.3-.8-.8-.8s-.8.4-.8.8.4.8.8.8zm0-1.8c.5 0 1 .4 1 1 0 .5-.4 1-1 1s-1-.4-1-1c.1-.6.5-1 1-1z"/><path id="Fill-33" class="st0" d="M8.8.1h4.8v1.1H10v2.5h3.2v1H10v2.9h3.6v1H8.8z"/><path id="Fill-35" class="st0" d="M14.6 8.6h1.1V0h-1.1z"/><path id="Fill-37" class="st0" d="M17 8.6h1.1V0H17z"/><path id="Fill-38" class="st0" d="M19.4 8.6h1.2V2.3h-1.2v6.3zm-.1-7.2h1.2V0h-1.2v1.4z"/><path id="Fill-39" class="st0" d="M25.7 4.9c0-1-.6-1.7-1.6-1.7-1.1 0-1.6.9-1.7 1.7h3.3zm.7 3.5c-.4.2-.9.4-2 .4-2.2 0-3.2-1.3-3.2-3.4 0-1.9 1.2-3.2 2.9-3.2 2.1 0 2.8 1.5 2.8 3.5h-4.5c0 1.2 1 2.1 2.1 2.1.8 0 1.6-.4 1.9-.6v1.2z"/><path id="Fill-40" class="st0" d="M27.9.1H30l2.6 7.1L35.3.1h2v8.5h-1.2V1.2l-2.9 7.4H32l-2.8-7.4v7.4h-1.3z"/><path id="Fill-41" class="st0" d="M48.2 4.9c0-1-.6-1.7-1.6-1.7-1.1 0-1.6.9-1.7 1.7h3.3zm.8 3.5c-.4.2-.9.4-2 .4-2.2 0-3.2-1.3-3.2-3.4 0-1.9 1.2-3.2 2.9-3.2 2.1 0 2.8 1.5 2.8 3.5H45c0 1.2 1 2.1 2.1 2.1.8 0 1.6-.4 1.9-.6v1.2z"/><path id="Fill-42" class="st0" d="M42.2 5.6h-.7c-.6 0-2.2.1-2.2 1.2 0 .7.6 1 1.2 1 1.1 0 1.7-.7 1.7-1.6v-.6zm-3-1.5l-.9-.2c.3-1.4 1.6-1.7 2.4-1.7 1.8 0 2.5.9 2.5 2.6v2.6c0 .7 0 1 .1 1.2h-1.2v-.8c-.3.4-.9 1-1.9 1-1.3 0-2.3-.6-2.3-1.9 0-1.6 1.7-2.1 2.9-2.1H42c0-1.1-.4-1.8-1.5-1.7-1 .1-1.3 1-1.3 1z"/></g><g id="Page-1"><path id="Fill-1" class="st1" d="M28 14c0 7.7-6.3 14-14 14S0 21.7 0 14 6.3 0 14 0s14 6.3 14 14"/><path id="Fill-3" class="st2" d="M14.1 2.3v-.5H14C7.2 1.8 1.8 7.3 1.8 14h.6c6.5.1 11.7-5.2 11.7-11.7"/><path id="Fill-5" class="st3" d="M2.3 14.1h-.6c.1 6.7 5.5 12.2 12.2 12.2h.1v-.4c.1-6.5-5.1-11.8-11.7-11.8"/><path id="Fill-7" class="st4" d="M25.9 14.1h.3V14c0-6.7-5.4-12.2-12.1-12.2v.5c0 6.5 5.3 11.8 11.8 11.8"/><path id="Fill-9" class="st5" d="M14.1 25.9v.4c6.7-.1 12-5.5 12.1-12.2h-.3c-6.5 0-11.8 5.3-11.8 11.8"/></g><path id="Page-1_1_" class="st6" d="M131.1 20.1c.8.5 2 .8 2.6.8.9 0 2.1-.4 2.1-1.6 0-2-4.9-1.9-4.9-5 0-2.3 1.7-3.5 4-3.5 1 0 1.8.2 2.6.4l-.2 1.8c-.5-.3-1.7-.6-2.2-.6-1.1 0-2 .4-2 1.4 0 2.3 4.9 1.6 4.9 5.2 0 2.4-1.9 3.5-3.9 3.5-1.1 0-2.1-.1-3.1-.6l.1-1.8zm9.4-9.7h.3c.2 0 .4 0 .4-.3 0-.2-.2-.3-.4-.3h-.3v.6zm-.3-.8h.7c.4 0 .6.2.6.5s-.2.5-.5.5l.5.8h-.3l-.5-.8h-.2v.8h-.3V9.6zm.6 2.2c.7 0 1.2-.6 1.2-1.3 0-.7-.5-1.3-1.2-1.3s-1.2.6-1.2 1.3c0 .8.5 1.3 1.2 1.3zm0-2.8c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5-1.5-.7-1.5-1.5.7-1.5 1.5-1.5zM123 20.1c.8.5 2 .8 2.6.8.9 0 2.1-.4 2.1-1.6 0-2-4.9-1.9-4.9-5 0-2.3 1.7-3.5 4-3.5 1 0 1.8.2 2.6.4l-.2 1.8c-.5-.3-1.7-.6-2.2-.6-1.1 0-2 .4-2 1.4 0 2.3 4.9 1.6 4.9 5.2 0 2.4-1.9 3.5-3.9 3.5-1.1 0-2.1-.1-3.1-.6l.1-1.8zm-3.8-3.1h-1.3c-1.1 0-3.9.2-3.9 2.2 0 1.2 1.1 1.8 2.1 1.8 2 0 3.1-1.3 3.1-2.9V17zm-6.2-5.1c1-.6 2.3-1.1 3.7-1.1 3.2 0 4.5 1.6 4.5 4.6V20c0 1.3 0 1.9.1 2.2h-1.9v-1.5c-.5.7-1.6 1.7-3.5 1.7-2.4 0-4.1-1.1-4.1-3.5 0-2.8 3.1-3.7 5.2-3.7h2.2c0-1.9-.7-2.9-2.8-2.9-1.2 0-2.4.4-3.3 1.1l-.1-1.5zm-7.7.6c-2.2 0-3.3 2.1-3.3 4.2 0 1.9 1 4.2 3.3 4.2 2.2 0 3.1-2.5 3.1-4.2 0-2-.8-4.2-3.1-4.2zm-5.4-1.4h2v1.6c.5-.8 1.8-1.8 3.8-1.8 3.3 0 4.8 2.7 4.8 5.7 0 3.1-1.4 6.1-4.8 6.1-2 0-3.1-.8-3.7-1.8V26h-2.1V11.1zm-17.3 0h1.9v1.6c.8-1.3 1.9-1.9 3.6-1.9 1.3 0 2.6.7 3.2 2.2.8-1.6 2.5-2.2 3.5-2.2 2.9 0 3.9 1.8 3.9 4.3v7.2h-2.1v-6.7c0-1.4-.3-3.1-2-3.1-2.1 0-2.9 2.1-2.9 4.2v5.7h-2.1v-6.7c0-1.4-.3-3.1-2-3.1-2.1 0-2.9 2.1-2.9 4.2v5.7h-2.1V11.1zm-8 9.8c2.4 0 3.5-2.2 3.5-4.2 0-2.1-1.3-4.2-3.5-4.2s-3.5 2.1-3.5 4.2c-.1 2 1 4.2 3.5 4.2zm0-10c3.4 0 5.7 2.5 5.7 5.9 0 3.2-2.3 5.9-5.7 5.9s-5.7-2.7-5.7-5.9c-.1-3.5 2.2-5.9 5.7-5.9zM67.4 13c-.8-.3-1.6-.5-2.2-.5-2.3 0-3.6 2.1-3.6 4.2 0 2 1.1 4.2 3.7 4.2.7 0 1.6-.2 2.2-.6l.2 1.8c-.9.4-1.8.5-2.6.5-3.4 0-5.7-2.7-5.7-5.9 0-3.4 2.3-5.9 5.7-5.9.8 0 1.9.2 2.5.4l-.2 1.8zm-19.2-1.9h2v1.8c.6-1.3 2.1-2 3.7-2 2.9 0 4.2 1.8 4.2 4.8v6.7H56v-5.8c0-2.6-.6-3.9-2.4-4-2.4 0-3.4 1.9-3.4 4.6v5.2h-2.1V11.1h.1zM38 7h8.6v1.9h-6.4v4.5H46v1.9h-5.8v5.1h6.4v1.9H38V7z"/></g></g></g></g></svg>
|