@next-core/brick-kit 2.128.0 → 2.129.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/CHANGELOG.md +34 -0
- package/dist/index.bundle.js +28 -22
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +29 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/core/Kernel.d.ts +1 -1
- package/dist/types/core/Kernel.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/standaloneBootstrap.d.ts.map +1 -1
- package/dist/types/handleHttpError.d.ts.map +1 -1
- package/dist/types/internal/menu.d.ts +3 -3
- package/dist/types/internal/menu.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
5
5
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
6
6
|
import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
|
|
7
7
|
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
|
-
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, sortBy, merge,
|
|
8
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, merge, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
|
|
9
9
|
import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { pipes } from '@next-core/pipes';
|
|
@@ -1415,7 +1415,8 @@ function authenticate(newAuth) {
|
|
|
1415
1415
|
userInstanceId: newAuth.userInstanceId,
|
|
1416
1416
|
loginFrom: newAuth.loginFrom,
|
|
1417
1417
|
accessRule: newAuth.accessRule,
|
|
1418
|
-
isAdmin: newAuth.isAdmin
|
|
1418
|
+
isAdmin: newAuth.isAdmin,
|
|
1419
|
+
csrfToken: newAuth.csrfToken
|
|
1419
1420
|
}); // re-init analytics to set user_id
|
|
1420
1421
|
|
|
1421
1422
|
if (userAnalytics.initialized) {
|
|
@@ -1439,6 +1440,7 @@ function logout() {
|
|
|
1439
1440
|
auth.userInstanceId = undefined;
|
|
1440
1441
|
auth.accessRule = undefined;
|
|
1441
1442
|
auth.isAdmin = undefined;
|
|
1443
|
+
auth.csrfToken = undefined;
|
|
1442
1444
|
resetPermissionPreChecks(); // re-init analytics to clear user_id
|
|
1443
1445
|
|
|
1444
1446
|
userAnalytics.setUserId();
|
|
@@ -3012,30 +3014,30 @@ function _constructMenu() {
|
|
|
3012
3014
|
return _constructMenu.apply(this, arguments);
|
|
3013
3015
|
}
|
|
3014
3016
|
|
|
3015
|
-
function
|
|
3016
|
-
return
|
|
3017
|
+
function preConstructMenus(_x4, _x5, _x6) {
|
|
3018
|
+
return _preConstructMenus.apply(this, arguments);
|
|
3017
3019
|
}
|
|
3018
3020
|
|
|
3019
|
-
function
|
|
3020
|
-
|
|
3021
|
-
var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
|
|
3021
|
+
function _preConstructMenus() {
|
|
3022
|
+
_preConstructMenus = _asyncToGenerator$4(function* (menus, context, kernel) {
|
|
3023
|
+
var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
|
|
3022
3024
|
data.forEach((item, index) => processMenuCache.set(menus[index], item));
|
|
3023
3025
|
});
|
|
3024
|
-
return
|
|
3026
|
+
return _preConstructMenus.apply(this, arguments);
|
|
3025
3027
|
}
|
|
3026
3028
|
|
|
3027
3029
|
var getMenu = menuId => processMenuCache.get(menuId);
|
|
3028
|
-
function fetchMenuById(_x7, _x8) {
|
|
3030
|
+
function fetchMenuById(_x7, _x8, _x9) {
|
|
3029
3031
|
return _fetchMenuById.apply(this, arguments);
|
|
3030
3032
|
}
|
|
3031
3033
|
|
|
3032
3034
|
function _fetchMenuById() {
|
|
3033
|
-
_fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel) {
|
|
3035
|
+
_fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel, isPreFetch) {
|
|
3034
3036
|
if (menuCache.has(menuId)) {
|
|
3035
3037
|
return menuCache.get(menuId);
|
|
3036
3038
|
}
|
|
3037
3039
|
|
|
3038
|
-
var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
|
|
3040
|
+
var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
|
|
3039
3041
|
page: 1,
|
|
3040
3042
|
page_size: 200,
|
|
3041
3043
|
fields: {
|
|
@@ -3131,7 +3133,7 @@ function processGroupInject(items, menu, injectWithMenus) {
|
|
|
3131
3133
|
});
|
|
3132
3134
|
}
|
|
3133
3135
|
|
|
3134
|
-
function loadDynamicMenuItems(
|
|
3136
|
+
function loadDynamicMenuItems(_x10) {
|
|
3135
3137
|
return _loadDynamicMenuItems.apply(this, arguments);
|
|
3136
3138
|
}
|
|
3137
3139
|
|
|
@@ -3149,13 +3151,13 @@ function _loadDynamicMenuItems() {
|
|
|
3149
3151
|
return _loadDynamicMenuItems.apply(this, arguments);
|
|
3150
3152
|
}
|
|
3151
3153
|
|
|
3152
|
-
function processMenu(
|
|
3154
|
+
function processMenu(_x11, _x12, _x13, _x14, _x15) {
|
|
3153
3155
|
return _processMenu.apply(this, arguments);
|
|
3154
3156
|
}
|
|
3155
3157
|
|
|
3156
3158
|
function _processMenu() {
|
|
3157
|
-
_processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu) {
|
|
3158
|
-
var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel),
|
|
3159
|
+
_processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
|
|
3160
|
+
var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
|
|
3159
3161
|
{
|
|
3160
3162
|
items,
|
|
3161
3163
|
app
|
|
@@ -3208,19 +3210,19 @@ function computeMenuItemsWithOverrideApp(items, context, kernel) {
|
|
|
3208
3210
|
});
|
|
3209
3211
|
});
|
|
3210
3212
|
|
|
3211
|
-
return function (
|
|
3213
|
+
return function (_x16) {
|
|
3212
3214
|
return _ref2.apply(this, arguments);
|
|
3213
3215
|
};
|
|
3214
3216
|
}()));
|
|
3215
3217
|
}
|
|
3216
3218
|
|
|
3217
|
-
function processMenuTitle(
|
|
3219
|
+
function processMenuTitle(_x17) {
|
|
3218
3220
|
return _processMenuTitle.apply(this, arguments);
|
|
3219
3221
|
}
|
|
3220
3222
|
|
|
3221
3223
|
function _processMenuTitle() {
|
|
3222
3224
|
_processMenuTitle = _asyncToGenerator$4(function* (menuData) {
|
|
3223
|
-
if (menuData.title ||
|
|
3225
|
+
if (menuData.title || isEmpty(menuData.titleDataSource)) {
|
|
3224
3226
|
return menuData.title;
|
|
3225
3227
|
}
|
|
3226
3228
|
|
|
@@ -3309,7 +3311,7 @@ function requireOverrideApp(data) {
|
|
|
3309
3311
|
return false;
|
|
3310
3312
|
}
|
|
3311
3313
|
|
|
3312
|
-
function computeRealValueWithOverrideApp(
|
|
3314
|
+
function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
|
|
3313
3315
|
return _computeRealValueWithOverrideApp.apply(this, arguments);
|
|
3314
3316
|
}
|
|
3315
3317
|
|
|
@@ -4015,8 +4017,11 @@ function handleHttpError(error) {
|
|
|
4015
4017
|
content: /*#__PURE__*/React.createElement("div", {
|
|
4016
4018
|
style: {
|
|
4017
4019
|
whiteSpace: "pre-wrap"
|
|
4020
|
+
},
|
|
4021
|
+
dangerouslySetInnerHTML: {
|
|
4022
|
+
__html: httpErrorToString(error)
|
|
4018
4023
|
}
|
|
4019
|
-
}
|
|
4024
|
+
}),
|
|
4020
4025
|
okText: i18next.t("".concat(NS_BRICK_KIT, ":").concat(K.MODAL_OK))
|
|
4021
4026
|
});
|
|
4022
4027
|
}
|
|
@@ -9522,10 +9527,11 @@ class Kernel {
|
|
|
9522
9527
|
return Object.assign({}, (_this$bootstrapData = this.bootstrapData) === null || _this$bootstrapData === void 0 ? void 0 : (_this$bootstrapData$s = _this$bootstrapData.settings) === null || _this$bootstrapData$s === void 0 ? void 0 : _this$bootstrapData$s.featureFlags);
|
|
9523
9528
|
}
|
|
9524
9529
|
|
|
9525
|
-
getStandaloneMenus(menuId) {
|
|
9530
|
+
getStandaloneMenus(menuId, isPreFetch) {
|
|
9526
9531
|
var _currentStoryboard$me, _currentStoryboard$me2;
|
|
9527
9532
|
|
|
9528
|
-
var
|
|
9533
|
+
var app = isPreFetch ? this.nextApp : this.currentApp;
|
|
9534
|
+
var currentAppId = app.id;
|
|
9529
9535
|
var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
|
|
9530
9536
|
var menus = (_currentStoryboard$me = currentStoryboard.meta) !== null && _currentStoryboard$me !== void 0 && _currentStoryboard$me.injectMenus ? cloneDeep(currentStoryboard.meta.injectMenus) : (_currentStoryboard$me2 = currentStoryboard.meta) !== null && _currentStoryboard$me2 !== void 0 && _currentStoryboard$me2.menus ? cloneDeep(currentStoryboard.meta.menus) : [];
|
|
9531
9537
|
return menus.filter(menu => menu.menuId === menuId).map(menu => {
|
|
@@ -10956,7 +10962,7 @@ class LocationContext {
|
|
|
10956
10962
|
var useMenus = scanAppGetMenuInAny(data);
|
|
10957
10963
|
|
|
10958
10964
|
if (useMenus.length) {
|
|
10959
|
-
yield
|
|
10965
|
+
yield preConstructMenus(useMenus, _this7.getCurrentContext(), _this7.kernel);
|
|
10960
10966
|
}
|
|
10961
10967
|
})();
|
|
10962
10968
|
}
|