@next-core/brick-kit 2.203.3 → 2.204.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/dist/index.bundle.js +59 -10
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +59 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/types/auth.d.ts +13 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/i18n/constants.d.ts +1 -0
- package/dist/types/i18n/constants.d.ts.map +1 -1
- package/dist/types/i18n/locales/en.d.ts.map +1 -1
- package/dist/types/i18n/locales/zh.d.ts.map +1 -1
- package/dist/types/internal/menu.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.bundle.js
CHANGED
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
K["PAGE_NOT_FOUND"] = "PAGE_NOT_FOUND";
|
|
176
176
|
K["APP_NOT_FOUND"] = "APP_NOT_FOUND";
|
|
177
177
|
K["LICENSE_EXPIRED"] = "LICENSE_EXPIRED";
|
|
178
|
+
K["LICENSE_BLOCKED"] = "LICENSE_BLOCKED";
|
|
178
179
|
K["NO_PERMISSION"] = "NO_PERMISSION";
|
|
179
180
|
K["OTHER_ERROR"] = "OTHER_ERROR";
|
|
180
181
|
K["GO_BACK_PREVIOUS_PAGE"] = "GO_BACK_PREVIOUS_PAGE";
|
|
@@ -940,6 +941,7 @@
|
|
|
940
941
|
[K.PAGE_NOT_FOUND]: "Page not found, please check the URL",
|
|
941
942
|
[K.APP_NOT_FOUND]: "App not found, maybe the URL is wrong or you don't have permission to access",
|
|
942
943
|
[K.LICENSE_EXPIRED]: "The license authorization has expired, please contact the platform administrator",
|
|
944
|
+
[K.LICENSE_BLOCKED]: "The page is not authorized, please contact the platform administrator",
|
|
943
945
|
[K.NO_PERMISSION]: "Unauthorized access, unable to retrieve the required resources for this page",
|
|
944
946
|
[K.OTHER_ERROR]: "Oops! Something went wrong",
|
|
945
947
|
[K.GO_BACK_PREVIOUS_PAGE]: "Go back to previous page",
|
|
@@ -959,6 +961,7 @@
|
|
|
959
961
|
[K.PAGE_NOT_FOUND]: "请求的页面未找到,请确认 URL 是否正确",
|
|
960
962
|
[K.APP_NOT_FOUND]: "请求的微应用无法找到, 可能是 URL 错误或者无权限访问",
|
|
961
963
|
[K.LICENSE_EXPIRED]: "License 授权失效,请联系平台管理员",
|
|
964
|
+
[K.LICENSE_BLOCKED]: "该页面未授权,请联系平台管理员",
|
|
962
965
|
[K.NO_PERMISSION]: "没有权限,无法获取页面所需要的资源",
|
|
963
966
|
[K.OTHER_ERROR]: "糟糕!页面出现了一些问题",
|
|
964
967
|
[K.GO_BACK_PREVIOUS_PAGE]: "回到上一页",
|
|
@@ -1205,12 +1208,9 @@
|
|
|
1205
1208
|
|
|
1206
1209
|
/** @internal */
|
|
1207
1210
|
function logout() {
|
|
1208
|
-
auth
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
auth.accessRule = undefined;
|
|
1212
|
-
auth.isAdmin = undefined;
|
|
1213
|
-
auth.csrfToken = undefined;
|
|
1211
|
+
for (var key of Object.keys(auth)) {
|
|
1212
|
+
auth[key] = undefined;
|
|
1213
|
+
}
|
|
1214
1214
|
resetPermissionPreChecks();
|
|
1215
1215
|
|
|
1216
1216
|
// re-init analytics to clear user_id
|
|
@@ -1226,6 +1226,41 @@
|
|
|
1226
1226
|
return auth.username !== undefined;
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
|
+
/**
|
|
1230
|
+
* 判断一个内部 URL 路径是否被屏蔽。
|
|
1231
|
+
*/
|
|
1232
|
+
function isBlockedPath(pathname) {
|
|
1233
|
+
var _auth$license, _auth$license$blackLi;
|
|
1234
|
+
return !!((_auth$license = auth.license) !== null && _auth$license !== void 0 && (_auth$license$blackLi = _auth$license.blackList) !== null && _auth$license$blackLi !== void 0 && _auth$license$blackLi.some(path => brickUtils.matchPath(pathname, {
|
|
1235
|
+
path
|
|
1236
|
+
})));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* 判断一个内部 URL 是否被屏蔽。
|
|
1241
|
+
*/
|
|
1242
|
+
function isBlockedUrl(url) {
|
|
1243
|
+
var pathname = (typeof url === "string" ? history$1.createLocation(url) : url).pathname;
|
|
1244
|
+
if (typeof pathname !== "string") {
|
|
1245
|
+
return false;
|
|
1246
|
+
}
|
|
1247
|
+
return isBlockedPath(pathname);
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* 判断一个 href 是否被屏蔽。
|
|
1252
|
+
*/
|
|
1253
|
+
function isBlockedHref(href) {
|
|
1254
|
+
var basePath = getBasePath();
|
|
1255
|
+
var url = new URL(href, "".concat(location.origin).concat(basePath));
|
|
1256
|
+
// 忽略外链地址
|
|
1257
|
+
if (url.origin !== location.origin || !url.pathname.startsWith(basePath)) {
|
|
1258
|
+
return false;
|
|
1259
|
+
}
|
|
1260
|
+
// 转换为内部路径
|
|
1261
|
+
return isBlockedPath(url.pathname.substring(basePath.length - 1));
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1229
1264
|
var permissionMap = new Map();
|
|
1230
1265
|
function preCheckPermissions(_x) {
|
|
1231
1266
|
return _preCheckPermissions.apply(this, arguments);
|
|
@@ -2609,8 +2644,11 @@
|
|
|
2609
2644
|
icon: item.icon,
|
|
2610
2645
|
items: children,
|
|
2611
2646
|
defaultExpanded: item.defaultExpanded
|
|
2612
|
-
} : item;
|
|
2613
|
-
});
|
|
2647
|
+
} : isMenuItemBlocked(item) ? null : item;
|
|
2648
|
+
}).filter(Boolean);
|
|
2649
|
+
}
|
|
2650
|
+
function isMenuItemBlocked(item) {
|
|
2651
|
+
return item.href ? isBlockedHref(item.href) : item.to ? isBlockedUrl(item.to) : false;
|
|
2614
2652
|
}
|
|
2615
2653
|
function processMenu(_x15, _x16, _x17, _x18, _x19) {
|
|
2616
2654
|
return _processMenu.apply(this, arguments);
|
|
@@ -12216,6 +12254,7 @@
|
|
|
12216
12254
|
var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp, _currentApp2, _currentApp2$config, _currentApp2$config$_, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme, _currentApp3, _currentApp4, _storyboard$app$homep, _storyboard$app2;
|
|
12217
12255
|
_this3.state = "initial";
|
|
12218
12256
|
var renderId = _this3.renderId = _.uniqueId("render-id-");
|
|
12257
|
+
var blocked = isBlockedPath(location.pathname);
|
|
12219
12258
|
resetAllInjected();
|
|
12220
12259
|
clearPollTimeout();
|
|
12221
12260
|
clearCollectWidgetContract();
|
|
@@ -12236,7 +12275,7 @@
|
|
|
12236
12275
|
if (window.DEVELOPER_PREVIEW) {
|
|
12237
12276
|
return;
|
|
12238
12277
|
}
|
|
12239
|
-
var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
|
|
12278
|
+
var storyboard = blocked ? undefined : locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
|
|
12240
12279
|
var currentAppId = storyboard === null || storyboard === void 0 ? void 0 : (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id;
|
|
12241
12280
|
// dynamically change the value of the APP variable, if it's union app
|
|
12242
12281
|
if (window.BOOTSTRAP_UNION_FILE && currentAppId && currentAppId !== ((_this3$kernel$previou = _this3.kernel.previousApp) === null || _this3$kernel$previou === void 0 ? void 0 : _this3$kernel$previou.id)) {
|
|
@@ -12652,6 +12691,13 @@
|
|
|
12652
12691
|
},
|
|
12653
12692
|
customTitle: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.PAGE_NOT_FOUND))
|
|
12654
12693
|
};
|
|
12694
|
+
var blockedPageConfig = {
|
|
12695
|
+
illustrationsConfig: {
|
|
12696
|
+
name: "no-permission",
|
|
12697
|
+
category: "easyops2"
|
|
12698
|
+
},
|
|
12699
|
+
customTitle: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.LICENSE_BLOCKED))
|
|
12700
|
+
};
|
|
12655
12701
|
_this3.state = "ready-to-mount";
|
|
12656
12702
|
mountTree([{
|
|
12657
12703
|
type: brickPageNotFound,
|
|
@@ -12659,7 +12705,7 @@
|
|
|
12659
12705
|
status: "illustrations",
|
|
12660
12706
|
useNewIllustration: true,
|
|
12661
12707
|
style: illustrationStyle
|
|
12662
|
-
}, storyboard ? notFoundPageConfig : notFoundAppConfig),
|
|
12708
|
+
}, blocked ? blockedPageConfig : storyboard ? notFoundPageConfig : notFoundAppConfig),
|
|
12663
12709
|
children: [{
|
|
12664
12710
|
type: "a",
|
|
12665
12711
|
properties: {
|
|
@@ -17021,6 +17067,9 @@
|
|
|
17021
17067
|
exports.i18nText = i18nText;
|
|
17022
17068
|
exports.initI18n = initI18n;
|
|
17023
17069
|
exports.instantiateModalStack = instantiateModalStack;
|
|
17070
|
+
exports.isBlockedHref = isBlockedHref;
|
|
17071
|
+
exports.isBlockedPath = isBlockedPath;
|
|
17072
|
+
exports.isBlockedUrl = isBlockedUrl;
|
|
17024
17073
|
exports.isLoggedIn = isLoggedIn;
|
|
17025
17074
|
exports.logout = logout;
|
|
17026
17075
|
exports.looseCheckIf = looseCheckIf$1;
|