@next-core/brick-kit 2.203.2 → 2.204.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/index.bundle.js +102 -11
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +102 -14
- 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/core/listen.d.ts +10 -0
- package/dist/types/core/listen.d.ts.map +1 -0
- package/dist/types/developHelper.d.ts +2 -0
- package/dist/types/developHelper.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 +3 -3
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);
|
|
@@ -12028,6 +12066,41 @@
|
|
|
12028
12066
|
}
|
|
12029
12067
|
}
|
|
12030
12068
|
|
|
12069
|
+
var initialize;
|
|
12070
|
+
var origin;
|
|
12071
|
+
var cachedUrl;
|
|
12072
|
+
var LOCAL_HOST = /^https?:\/\/localhost(?:$|:)/;
|
|
12073
|
+
function start(_origin) {
|
|
12074
|
+
if (location.origin !== _origin && !LOCAL_HOST.test(location.origin) && !LOCAL_HOST.test(_origin)) {
|
|
12075
|
+
// 禁止除 localhost 之外的跨域消息
|
|
12076
|
+
return;
|
|
12077
|
+
}
|
|
12078
|
+
initialize = true;
|
|
12079
|
+
origin = _origin;
|
|
12080
|
+
if (cachedUrl) {
|
|
12081
|
+
sendMessage({
|
|
12082
|
+
sender: "next-core",
|
|
12083
|
+
type: "url-change",
|
|
12084
|
+
url: cachedUrl
|
|
12085
|
+
});
|
|
12086
|
+
}
|
|
12087
|
+
}
|
|
12088
|
+
function sendMessage(data) {
|
|
12089
|
+
window.parent.postMessage(data, origin);
|
|
12090
|
+
}
|
|
12091
|
+
function sendUrlChange(data) {
|
|
12092
|
+
if (window.self !== window.parent && (data === null || data === void 0 ? void 0 : data.url) !== cachedUrl) {
|
|
12093
|
+
cachedUrl = data.url;
|
|
12094
|
+
if (initialize) {
|
|
12095
|
+
sendMessage({
|
|
12096
|
+
sender: "next-core",
|
|
12097
|
+
type: "url-change",
|
|
12098
|
+
url: data.url
|
|
12099
|
+
});
|
|
12100
|
+
}
|
|
12101
|
+
}
|
|
12102
|
+
}
|
|
12103
|
+
|
|
12031
12104
|
class Router {
|
|
12032
12105
|
constructor(kernel) {
|
|
12033
12106
|
_defineProperty__default["default"](this, "defaultCollapsed", false);
|
|
@@ -12094,6 +12167,9 @@
|
|
|
12094
12167
|
history.listen( /*#__PURE__*/function () {
|
|
12095
12168
|
var _ref = _asyncToGenerator__default["default"](function* (location, action) {
|
|
12096
12169
|
var _this$prevLocation$st, _location$state;
|
|
12170
|
+
sendUrlChange({
|
|
12171
|
+
url: window.location.origin + history.createHref(location)
|
|
12172
|
+
});
|
|
12097
12173
|
var ignoreRendering = false;
|
|
12098
12174
|
var omittedLocationProps = {
|
|
12099
12175
|
hash: null,
|
|
@@ -12149,6 +12225,9 @@
|
|
|
12149
12225
|
return _ref.apply(this, arguments);
|
|
12150
12226
|
};
|
|
12151
12227
|
}());
|
|
12228
|
+
sendUrlChange({
|
|
12229
|
+
url: window.location.href
|
|
12230
|
+
});
|
|
12152
12231
|
yield _this.queuedRender(history.location);
|
|
12153
12232
|
_this.kernel.firstRendered();
|
|
12154
12233
|
})();
|
|
@@ -12175,6 +12254,7 @@
|
|
|
12175
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;
|
|
12176
12255
|
_this3.state = "initial";
|
|
12177
12256
|
var renderId = _this3.renderId = _.uniqueId("render-id-");
|
|
12257
|
+
var blocked = isBlockedPath(location.pathname);
|
|
12178
12258
|
resetAllInjected();
|
|
12179
12259
|
clearPollTimeout();
|
|
12180
12260
|
clearCollectWidgetContract();
|
|
@@ -12195,7 +12275,7 @@
|
|
|
12195
12275
|
if (window.DEVELOPER_PREVIEW) {
|
|
12196
12276
|
return;
|
|
12197
12277
|
}
|
|
12198
|
-
var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
|
|
12278
|
+
var storyboard = blocked ? undefined : locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
|
|
12199
12279
|
var currentAppId = storyboard === null || storyboard === void 0 ? void 0 : (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id;
|
|
12200
12280
|
// dynamically change the value of the APP variable, if it's union app
|
|
12201
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)) {
|
|
@@ -12611,6 +12691,13 @@
|
|
|
12611
12691
|
},
|
|
12612
12692
|
customTitle: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.PAGE_NOT_FOUND))
|
|
12613
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
|
+
};
|
|
12614
12701
|
_this3.state = "ready-to-mount";
|
|
12615
12702
|
mountTree([{
|
|
12616
12703
|
type: brickPageNotFound,
|
|
@@ -12618,7 +12705,7 @@
|
|
|
12618
12705
|
status: "illustrations",
|
|
12619
12706
|
useNewIllustration: true,
|
|
12620
12707
|
style: illustrationStyle
|
|
12621
|
-
}, storyboard ? notFoundPageConfig : notFoundAppConfig),
|
|
12708
|
+
}, blocked ? blockedPageConfig : storyboard ? notFoundPageConfig : notFoundAppConfig),
|
|
12622
12709
|
children: [{
|
|
12623
12710
|
type: "a",
|
|
12624
12711
|
properties: {
|
|
@@ -14673,7 +14760,8 @@
|
|
|
14673
14760
|
getLegalRuntimeValue: _dev_only_getLegalRuntimeValue,
|
|
14674
14761
|
render: _dev_only_render,
|
|
14675
14762
|
setRealTimeDataInspectRoot,
|
|
14676
|
-
addRealTimeDataInspectHook
|
|
14763
|
+
addRealTimeDataInspectHook,
|
|
14764
|
+
iframePreviewInitialize: start
|
|
14677
14765
|
};
|
|
14678
14766
|
|
|
14679
14767
|
var _excluded$2 = ["type"];
|
|
@@ -16979,6 +17067,9 @@
|
|
|
16979
17067
|
exports.i18nText = i18nText;
|
|
16980
17068
|
exports.initI18n = initI18n;
|
|
16981
17069
|
exports.instantiateModalStack = instantiateModalStack;
|
|
17070
|
+
exports.isBlockedHref = isBlockedHref;
|
|
17071
|
+
exports.isBlockedPath = isBlockedPath;
|
|
17072
|
+
exports.isBlockedUrl = isBlockedUrl;
|
|
16982
17073
|
exports.isLoggedIn = isLoggedIn;
|
|
16983
17074
|
exports.logout = logout;
|
|
16984
17075
|
exports.looseCheckIf = looseCheckIf$1;
|