@next-core/brick-kit 2.167.1 → 2.168.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 +134 -24
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +135 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/handleHttpError.d.ts +12 -0
- package/dist/types/handleHttpError.d.ts.map +1 -1
- package/dist/types/i18n/constants.d.ts +5 -1
- 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/getTracks.d.ts +6 -0
- package/dist/types/internal/getTracks.d.ts.map +1 -0
- package/dist/types/internal/setProperties.d.ts.map +1 -1
- package/dist/types/transformProperties.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.bundle.js
CHANGED
|
@@ -172,6 +172,10 @@
|
|
|
172
172
|
K["NETWORK_ERROR"] = "NETWORK_ERROR";
|
|
173
173
|
K["PAGE_NOT_FOUND"] = "PAGE_NOT_FOUND";
|
|
174
174
|
K["APP_NOT_FOUND"] = "APP_NOT_FOUND";
|
|
175
|
+
K["LICENSE_EXPIRED"] = "LICENSE_EXPIRED";
|
|
176
|
+
K["NO_PERMISSION"] = "NO_PERMISSION";
|
|
177
|
+
K["OTHER_ERROR"] = "OTHER_ERROR";
|
|
178
|
+
K["GO_BACK_PREVIOUS_PAGE"] = "GO_BACK_PREVIOUS_PAGE";
|
|
175
179
|
})(K || (K = {}));
|
|
176
180
|
|
|
177
181
|
/**
|
|
@@ -821,6 +825,32 @@
|
|
|
821
825
|
return StateOfUseBrick.INITIAL;
|
|
822
826
|
}
|
|
823
827
|
|
|
828
|
+
function getTracks(value) {
|
|
829
|
+
var contextNames = false;
|
|
830
|
+
var stateNames = false;
|
|
831
|
+
var formStateNames = false;
|
|
832
|
+
if (typeof value === "string" ? brickUtils.isEvaluable(value) : isPreEvaluated(value)) {
|
|
833
|
+
var raw = typeof value === "string" ? value : getPreEvaluatedRaw(value);
|
|
834
|
+
if (brickUtils.isTrackAll(raw)) {
|
|
835
|
+
var result = brickUtils.trackAll(raw);
|
|
836
|
+
if (result) {
|
|
837
|
+
contextNames = result.context;
|
|
838
|
+
stateNames = result.state;
|
|
839
|
+
formStateNames = result.formState;
|
|
840
|
+
}
|
|
841
|
+
} else {
|
|
842
|
+
contextNames = brickUtils.trackContext(raw);
|
|
843
|
+
stateNames = brickUtils.trackState(raw);
|
|
844
|
+
formStateNames = brickUtils.trackFormState(raw);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return {
|
|
848
|
+
contextNames,
|
|
849
|
+
stateNames,
|
|
850
|
+
formStateNames
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
|
|
824
854
|
/** @internal */
|
|
825
855
|
function transformElementProperties(element, data, to, from, mapArray) {
|
|
826
856
|
var result = preprocessTransformProperties(data, to, from, mapArray);
|
|
@@ -885,9 +915,11 @@
|
|
|
885
915
|
raw = getPreEvaluatedRaw(v);
|
|
886
916
|
addDataToPreEvaluated(v, data);
|
|
887
917
|
}
|
|
888
|
-
var
|
|
889
|
-
|
|
890
|
-
|
|
918
|
+
var {
|
|
919
|
+
contextNames,
|
|
920
|
+
stateNames,
|
|
921
|
+
formStateNames
|
|
922
|
+
} = getTracks(raw);
|
|
891
923
|
if (contextNames || stateNames || formStateNames) {
|
|
892
924
|
options.trackingContextList.push({
|
|
893
925
|
contextNames,
|
|
@@ -1125,7 +1157,11 @@
|
|
|
1125
1157
|
[K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
|
|
1126
1158
|
[K.NETWORK_ERROR]: "Network error, please check your network.",
|
|
1127
1159
|
[K.PAGE_NOT_FOUND]: "Page not found, please check the URL",
|
|
1128
|
-
[K.APP_NOT_FOUND]: "App not found, maybe the URL is wrong or you don't have permission to access"
|
|
1160
|
+
[K.APP_NOT_FOUND]: "App not found, maybe the URL is wrong or you don't have permission to access",
|
|
1161
|
+
[K.LICENSE_EXPIRED]: "The license authorization has expired, please contact the platform administrator",
|
|
1162
|
+
[K.NO_PERMISSION]: "Unauthorized access, unable to retrieve the required resources for this page",
|
|
1163
|
+
[K.OTHER_ERROR]: "Oops! Something went wrong",
|
|
1164
|
+
[K.GO_BACK_PREVIOUS_PAGE]: "Go back to previous page"
|
|
1129
1165
|
};
|
|
1130
1166
|
var en = locale$7;
|
|
1131
1167
|
|
|
@@ -1137,7 +1173,11 @@
|
|
|
1137
1173
|
[K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
|
|
1138
1174
|
[K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。",
|
|
1139
1175
|
[K.PAGE_NOT_FOUND]: "请求的页面未找到,请确认 URL 是否正确",
|
|
1140
|
-
[K.APP_NOT_FOUND]: "请求的微应用无法找到, 可能是 URL 错误或者无权限访问"
|
|
1176
|
+
[K.APP_NOT_FOUND]: "请求的微应用无法找到, 可能是 URL 错误或者无权限访问",
|
|
1177
|
+
[K.LICENSE_EXPIRED]: "License 授权失效,请联系平台管理员",
|
|
1178
|
+
[K.NO_PERMISSION]: "没有权限,无法获取页面所需要的资源",
|
|
1179
|
+
[K.OTHER_ERROR]: "糟糕!页面出现了一些问题",
|
|
1180
|
+
[K.GO_BACK_PREVIOUS_PAGE]: "回到上一页"
|
|
1141
1181
|
};
|
|
1142
1182
|
var zh = locale$6;
|
|
1143
1183
|
|
|
@@ -2754,11 +2794,12 @@
|
|
|
2754
2794
|
result[propName] = realValue;
|
|
2755
2795
|
}
|
|
2756
2796
|
}
|
|
2757
|
-
if (Array.isArray(trackingContextList)
|
|
2758
|
-
var
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2797
|
+
if (Array.isArray(trackingContextList)) {
|
|
2798
|
+
var {
|
|
2799
|
+
contextNames,
|
|
2800
|
+
stateNames,
|
|
2801
|
+
formStateNames
|
|
2802
|
+
} = getTracks(propValue);
|
|
2762
2803
|
if (contextNames || stateNames || formStateNames) {
|
|
2763
2804
|
trackingContextList.push({
|
|
2764
2805
|
contextNames,
|
|
@@ -3904,6 +3945,47 @@
|
|
|
3904
3945
|
}, []);
|
|
3905
3946
|
return /*#__PURE__*/React__default["default"].createElement("div", null, i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.LOGIN_TIMEOUT_MESSAGE)));
|
|
3906
3947
|
}
|
|
3948
|
+
function getConfOfHttpStatus(error) {
|
|
3949
|
+
var _error$response;
|
|
3950
|
+
switch ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) {
|
|
3951
|
+
case 403:
|
|
3952
|
+
return {
|
|
3953
|
+
showBackLink: true,
|
|
3954
|
+
title: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.NO_PERMISSION)),
|
|
3955
|
+
illustration: {
|
|
3956
|
+
name: "no-permission",
|
|
3957
|
+
category: "easyops2"
|
|
3958
|
+
}
|
|
3959
|
+
};
|
|
3960
|
+
default:
|
|
3961
|
+
return null;
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
function getConfOfHttpCode(error) {
|
|
3965
|
+
var _error$responseJson;
|
|
3966
|
+
switch ((_error$responseJson = error.responseJson) === null || _error$responseJson === void 0 ? void 0 : _error$responseJson.code) {
|
|
3967
|
+
case "200000":
|
|
3968
|
+
return {
|
|
3969
|
+
title: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.LICENSE_EXPIRED)),
|
|
3970
|
+
illustration: {
|
|
3971
|
+
name: "license-expired",
|
|
3972
|
+
category: "easyops2"
|
|
3973
|
+
}
|
|
3974
|
+
};
|
|
3975
|
+
default:
|
|
3976
|
+
return {
|
|
3977
|
+
showBackLink: true,
|
|
3978
|
+
title: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.OTHER_ERROR)),
|
|
3979
|
+
illustration: {
|
|
3980
|
+
name: "unknown-error",
|
|
3981
|
+
category: "easyops2"
|
|
3982
|
+
}
|
|
3983
|
+
};
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
function getRefinedErrorConf(error) {
|
|
3987
|
+
return [getConfOfHttpStatus, getConfOfHttpCode].reduce((result, method) => result ? result : method(error), null);
|
|
3988
|
+
}
|
|
3907
3989
|
|
|
3908
3990
|
class WebsocketMessageRequest {
|
|
3909
3991
|
constructor(event, topic) {
|
|
@@ -8698,10 +8780,10 @@
|
|
|
8698
8780
|
_this3.presetBricks = layout === "business" ? {
|
|
8699
8781
|
loadingBar: "business-website.loading-bar",
|
|
8700
8782
|
pageNotFound: "presentational-bricks.brick-result",
|
|
8701
|
-
pageError: "
|
|
8783
|
+
pageError: "presentational-bricks.brick-result"
|
|
8702
8784
|
} : _objectSpread__default["default"](_objectSpread__default["default"]({}, _this3.bootstrapData.navbar), {}, {
|
|
8703
8785
|
pageNotFound: "presentational-bricks.brick-result",
|
|
8704
|
-
pageError: "
|
|
8786
|
+
pageError: "presentational-bricks.brick-result"
|
|
8705
8787
|
});
|
|
8706
8788
|
for (var item of supportedLayouts) {
|
|
8707
8789
|
if (item === layout) {
|
|
@@ -11515,6 +11597,13 @@
|
|
|
11515
11597
|
}
|
|
11516
11598
|
_this3.kernel.setOriginFaviconHref(faviconElement.href);
|
|
11517
11599
|
}
|
|
11600
|
+
var illustrationStyle = {
|
|
11601
|
+
display: "flex",
|
|
11602
|
+
alignItems: "center",
|
|
11603
|
+
justifyContent: "center",
|
|
11604
|
+
transform: "translateY(-100px)",
|
|
11605
|
+
height: "calc(100vh - var(--app-bar-height))"
|
|
11606
|
+
};
|
|
11518
11607
|
setTheme(((_getLocalAppsTheme = getLocalAppsTheme()) === null || _getLocalAppsTheme === void 0 ? void 0 : _getLocalAppsTheme[currentApp === null || currentApp === void 0 ? void 0 : currentApp.id]) || (currentApp === null || currentApp === void 0 ? void 0 : currentApp.theme) || "light");
|
|
11519
11608
|
getRuntime().getFeatureFlags()["support-ui-8.2-compact-layout"] ? document.body.classList.add("compact-layout") : document.body.classList.remove("compact-layout");
|
|
11520
11609
|
setMode("default");
|
|
@@ -11572,14 +11661,41 @@
|
|
|
11572
11661
|
var brickPageError = _this3.kernel.presetBricks.pageError;
|
|
11573
11662
|
yield _this3.kernel.loadDynamicBricks([brickPageError]);
|
|
11574
11663
|
mountRoutesResult.flags.failed = true;
|
|
11575
|
-
|
|
11664
|
+
var {
|
|
11665
|
+
title,
|
|
11666
|
+
illustration,
|
|
11667
|
+
showBackLink
|
|
11668
|
+
} = getRefinedErrorConf(error);
|
|
11669
|
+
mountRoutesResult.main = [_objectSpread__default["default"](_objectSpread__default["default"]({
|
|
11576
11670
|
type: brickPageError,
|
|
11577
11671
|
properties: {
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11672
|
+
status: "illustrations",
|
|
11673
|
+
useNewIllustration: true,
|
|
11674
|
+
customTitle: title,
|
|
11675
|
+
subTitle: httpErrorToString(error),
|
|
11676
|
+
illustrationsConfig: illustration,
|
|
11677
|
+
style: illustrationStyle
|
|
11678
|
+
}
|
|
11679
|
+
}, showBackLink ? {
|
|
11680
|
+
children: [{
|
|
11681
|
+
type: "a",
|
|
11682
|
+
properties: {
|
|
11683
|
+
textContent: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.GO_BACK_PREVIOUS_PAGE)),
|
|
11684
|
+
style: {
|
|
11685
|
+
display: "block",
|
|
11686
|
+
textAlign: "center"
|
|
11687
|
+
}
|
|
11688
|
+
},
|
|
11689
|
+
slotId: "content",
|
|
11690
|
+
events: {
|
|
11691
|
+
click: [{
|
|
11692
|
+
action: "history.goBack"
|
|
11693
|
+
}]
|
|
11694
|
+
}
|
|
11695
|
+
}]
|
|
11696
|
+
} : {}), {}, {
|
|
11581
11697
|
events: {}
|
|
11582
|
-
}];
|
|
11698
|
+
})];
|
|
11583
11699
|
mountRoutesResult.portal = [];
|
|
11584
11700
|
}
|
|
11585
11701
|
}
|
|
@@ -11800,13 +11916,7 @@
|
|
|
11800
11916
|
properties: _objectSpread__default["default"]({
|
|
11801
11917
|
status: "illustrations",
|
|
11802
11918
|
useNewIllustration: true,
|
|
11803
|
-
style:
|
|
11804
|
-
display: "flex",
|
|
11805
|
-
alignItems: "center",
|
|
11806
|
-
justifyContent: "center",
|
|
11807
|
-
transform: "translateY(-100px)",
|
|
11808
|
-
height: "calc(100vh - var(--app-bar-height))"
|
|
11809
|
-
}
|
|
11919
|
+
style: illustrationStyle
|
|
11810
11920
|
}, storyboard ? notFoundPageConfig : notFoundAppConfig),
|
|
11811
11921
|
events: {}
|
|
11812
11922
|
}], mountPoints.main);
|