@next-core/brick-kit 2.127.3 → 2.129.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/CHANGELOG.md CHANGED
@@ -3,6 +3,40 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.129.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.128.1...@next-core/brick-kit@2.129.0) (2022-08-19)
7
+
8
+
9
+ ### Features
10
+
11
+ * support crsf token ([3ef8c62](https://github.com/easyops-cn/next-core/commit/3ef8c624af8126185222ce2e98c4c5622e6de9e7))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.128.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.128.0...@next-core/brick-kit@2.128.1) (2022-08-19)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * fix menu prefetch in standalone apps ([e96b0cf](https://github.com/easyops-cn/next-core/commit/e96b0cfbe973a285ec6f8b5ceb2d8a3e638210bb))
23
+ * support setting standalone app root ([8e0d3e4](https://github.com/easyops-cn/next-core/commit/8e0d3e49c2c2b93f2b05de4a857c6c6724f27b82))
24
+
25
+
26
+
27
+
28
+
29
+ # [2.128.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.127.3...@next-core/brick-kit@2.128.0) (2022-08-18)
30
+
31
+
32
+ ### Features
33
+
34
+ * **brick-kit:** support location.host and location.hostname ([0548c9f](https://github.com/easyops-cn/next-core/commit/0548c9fab28e58e4194bfedea44c92a39f0c27e2))
35
+
36
+
37
+
38
+
39
+
6
40
  ## [2.127.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.127.2...@next-core/brick-kit@2.127.3) (2022-08-17)
7
41
 
8
42
 
@@ -1414,7 +1414,8 @@
1414
1414
  userInstanceId: newAuth.userInstanceId,
1415
1415
  loginFrom: newAuth.loginFrom,
1416
1416
  accessRule: newAuth.accessRule,
1417
- isAdmin: newAuth.isAdmin
1417
+ isAdmin: newAuth.isAdmin,
1418
+ csrfToken: newAuth.csrfToken
1418
1419
  }); // re-init analytics to set user_id
1419
1420
 
1420
1421
  if (easyopsAnalytics.userAnalytics.initialized) {
@@ -1438,6 +1439,7 @@
1438
1439
  auth.userInstanceId = undefined;
1439
1440
  auth.accessRule = undefined;
1440
1441
  auth.isAdmin = undefined;
1442
+ auth.csrfToken = undefined;
1441
1443
  resetPermissionPreChecks(); // re-init analytics to clear user_id
1442
1444
 
1443
1445
  easyopsAnalytics.userAnalytics.setUserId();
@@ -1635,10 +1637,14 @@
1635
1637
  case "location":
1636
1638
  return collectCoverage ? {
1637
1639
  href: "http://localhost:3000/functions/test",
1638
- origin: "http://localhost:3000"
1640
+ origin: "http://localhost:3000",
1641
+ host: "localhost:3000",
1642
+ hostname: "localhost"
1639
1643
  } : {
1640
1644
  href: location.href,
1641
- origin: location.origin
1645
+ origin: location.origin,
1646
+ host: location.host,
1647
+ hostname: location.hostname
1642
1648
  };
1643
1649
  }
1644
1650
  }
@@ -3007,30 +3013,30 @@
3007
3013
  return _constructMenu.apply(this, arguments);
3008
3014
  }
3009
3015
 
3010
- function constructMenuByMenusList(_x4, _x5, _x6) {
3011
- return _constructMenuByMenusList.apply(this, arguments);
3016
+ function preConstructMenus(_x4, _x5, _x6) {
3017
+ return _preConstructMenus.apply(this, arguments);
3012
3018
  }
3013
3019
 
3014
- function _constructMenuByMenusList() {
3015
- _constructMenuByMenusList = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
3016
- var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel)));
3020
+ function _preConstructMenus() {
3021
+ _preConstructMenus = _asyncToGenerator__default["default"](function* (menus, context, kernel) {
3022
+ var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3017
3023
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3018
3024
  });
3019
- return _constructMenuByMenusList.apply(this, arguments);
3025
+ return _preConstructMenus.apply(this, arguments);
3020
3026
  }
3021
3027
 
3022
3028
  var getMenu = menuId => processMenuCache.get(menuId);
3023
- function fetchMenuById(_x7, _x8) {
3029
+ function fetchMenuById(_x7, _x8, _x9) {
3024
3030
  return _fetchMenuById.apply(this, arguments);
3025
3031
  }
3026
3032
 
3027
3033
  function _fetchMenuById() {
3028
- _fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel) {
3034
+ _fetchMenuById = _asyncToGenerator__default["default"](function* (menuId, kernel, isPreFetch) {
3029
3035
  if (menuCache.has(menuId)) {
3030
3036
  return menuCache.get(menuId);
3031
3037
  }
3032
3038
 
3033
- var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3039
+ var menuList = window.STANDALONE_MICRO_APPS ? kernel.getStandaloneMenus(menuId, isPreFetch) : (yield InstanceApi_postSearch("EASYOPS_STORYBOARD_MENU", {
3034
3040
  page: 1,
3035
3041
  page_size: 200,
3036
3042
  fields: {
@@ -3126,7 +3132,7 @@
3126
3132
  });
3127
3133
  }
3128
3134
 
3129
- function loadDynamicMenuItems(_x9) {
3135
+ function loadDynamicMenuItems(_x10) {
3130
3136
  return _loadDynamicMenuItems.apply(this, arguments);
3131
3137
  }
3132
3138
 
@@ -3144,13 +3150,13 @@
3144
3150
  return _loadDynamicMenuItems.apply(this, arguments);
3145
3151
  }
3146
3152
 
3147
- function processMenu(_x10, _x11, _x12, _x13) {
3153
+ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3148
3154
  return _processMenu.apply(this, arguments);
3149
3155
  }
3150
3156
 
3151
3157
  function _processMenu() {
3152
- _processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu) {
3153
- var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel),
3158
+ _processMenu = _asyncToGenerator__default["default"](function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3159
+ var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3154
3160
  {
3155
3161
  items,
3156
3162
  app
@@ -3203,19 +3209,19 @@
3203
3209
  });
3204
3210
  });
3205
3211
 
3206
- return function (_x14) {
3212
+ return function (_x16) {
3207
3213
  return _ref2.apply(this, arguments);
3208
3214
  };
3209
3215
  }()));
3210
3216
  }
3211
3217
 
3212
- function processMenuTitle(_x15) {
3218
+ function processMenuTitle(_x17) {
3213
3219
  return _processMenuTitle.apply(this, arguments);
3214
3220
  }
3215
3221
 
3216
3222
  function _processMenuTitle() {
3217
3223
  _processMenuTitle = _asyncToGenerator__default["default"](function* (menuData) {
3218
- if (menuData.title || !menuData.titleDataSource) {
3224
+ if (menuData.title || _.isEmpty(menuData.titleDataSource)) {
3219
3225
  return menuData.title;
3220
3226
  }
3221
3227
 
@@ -3304,7 +3310,7 @@
3304
3310
  return false;
3305
3311
  }
3306
3312
 
3307
- function computeRealValueWithOverrideApp(_x16, _x17, _x18, _x19) {
3313
+ function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3308
3314
  return _computeRealValueWithOverrideApp.apply(this, arguments);
3309
3315
  }
3310
3316
 
@@ -9517,10 +9523,11 @@
9517
9523
  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);
9518
9524
  }
9519
9525
 
9520
- getStandaloneMenus(menuId) {
9526
+ getStandaloneMenus(menuId, isPreFetch) {
9521
9527
  var _currentStoryboard$me, _currentStoryboard$me2;
9522
9528
 
9523
- var currentAppId = this.currentApp.id;
9529
+ var app = isPreFetch ? this.nextApp : this.currentApp;
9530
+ var currentAppId = app.id;
9524
9531
  var currentStoryboard = this.bootstrapData.storyboards.find(storyboard => storyboard.app.id === currentAppId);
9525
9532
  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) : [];
9526
9533
  return menus.filter(menu => menu.menuId === menuId).map(menu => {
@@ -10951,7 +10958,7 @@
10951
10958
  var useMenus = brickUtils.scanAppGetMenuInAny(data);
10952
10959
 
10953
10960
  if (useMenus.length) {
10954
- yield constructMenuByMenusList(useMenus, _this7.getCurrentContext(), _this7.kernel);
10961
+ yield preConstructMenus(useMenus, _this7.getCurrentContext(), _this7.kernel);
10955
10962
  }
10956
10963
  })();
10957
10964
  }