@next-core/brick-kit 2.129.1 → 2.130.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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { parsePath, createBrowserHistory, locationsAreEqual, createPath } from 'history';
2
2
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
- import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
4
+ import _asyncToGenerator$3 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';
@@ -38,7 +38,7 @@ class BaseBar {
38
38
  bootstrap(brick, options) {
39
39
  var _this = this;
40
40
 
41
- return _asyncToGenerator$4(function* () {
41
+ return _asyncToGenerator$3(function* () {
42
42
  // Ignore if the brick is not changed.
43
43
  if (_this.brick === brick) {
44
44
  return;
@@ -445,7 +445,7 @@ function getCssPropertyValue(name) {
445
445
  return ((_window$getComputedSt = window.getComputedStyle(el)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue(name)) || "";
446
446
  }
447
447
 
448
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
448
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
449
449
  try {
450
450
  var info = gen[key](arg);
451
451
  var value = info.value;
@@ -461,7 +461,7 @@ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
461
461
  }
462
462
  }
463
463
 
464
- function _asyncToGenerator$3(fn) {
464
+ function _asyncToGenerator$2(fn) {
465
465
  return function () {
466
466
  var self = this,
467
467
  args = arguments;
@@ -469,11 +469,11 @@ function _asyncToGenerator$3(fn) {
469
469
  var gen = fn.apply(self, args);
470
470
 
471
471
  function _next(value) {
472
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
472
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
473
473
  }
474
474
 
475
475
  function _throw(err) {
476
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
476
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
477
477
  }
478
478
 
479
479
  _next(undefined);
@@ -536,7 +536,7 @@ function _objectSpread2(target) {
536
536
 
537
537
 
538
538
  var InstanceApi_getDetail = /*#__PURE__*/function () {
539
- var _ref = _asyncToGenerator$3(function* (objectId, instanceId, params, options) {
539
+ var _ref = _asyncToGenerator$2(function* (objectId, instanceId, params, options) {
540
540
  return (
541
541
  /**! @contract easyops.api.cmdb.instance.GetDetail */
542
542
  (yield http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2(_objectSpread2({}, options), {}, {
@@ -556,7 +556,7 @@ var InstanceApi_getDetail = /*#__PURE__*/function () {
556
556
 
557
557
 
558
558
  var InstanceApi_postSearch = /*#__PURE__*/function () {
559
- var _ref = _asyncToGenerator$3(function* (objectId, data, options) {
559
+ var _ref = _asyncToGenerator$2(function* (objectId, data, options) {
560
560
  return (
561
561
  /**! @contract easyops.api.cmdb.instance.PostSearch */
562
562
  (yield http.post("api/gateway/cmdb.instance.PostSearch/object/".concat(objectId, "/instance/_search"), data, options)).data
@@ -1333,41 +1333,26 @@ function i18nText(data) {
1333
1333
  }
1334
1334
  }
1335
1335
 
1336
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1337
- try {
1338
- var info = gen[key](arg);
1339
- var value = info.value;
1340
- } catch (error) {
1341
- reject(error);
1342
- return;
1343
- }
1344
-
1345
- if (info.done) {
1346
- resolve(value);
1347
- } else {
1348
- Promise.resolve(value).then(_next, _throw);
1349
- }
1350
- }
1351
-
1352
- function _asyncToGenerator$2(fn) {
1353
- return function () {
1354
- var self = this,
1355
- args = arguments;
1356
- return new Promise(function (resolve, reject) {
1357
- var gen = fn.apply(self, args);
1336
+ /**
1337
+ * @description 获取微应用的i18n数据
1338
+ * @endpoint GET /api/v1/micro-app/i18n
1339
+ */
1358
1340
 
1359
- function _next(value) {
1360
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1361
- }
1362
1341
 
1363
- function _throw(err) {
1364
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1365
- }
1342
+ var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
1343
+ var _ref = _asyncToGenerator$3(function* (params, options) {
1344
+ return (
1345
+ /**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */
1346
+ (yield http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread(_objectSpread({}, options), {}, {
1347
+ params
1348
+ }))).data
1349
+ );
1350
+ });
1366
1351
 
1367
- _next(undefined);
1368
- });
1352
+ return function InstalledMicroAppApi_getI18NData(_x, _x2) {
1353
+ return _ref.apply(this, arguments);
1369
1354
  };
1370
- }
1355
+ }();
1371
1356
  /**
1372
1357
  * @description 查询模型关联小产品列表
1373
1358
  * @endpoint LIST /api/micro_app/v1/object_micro_app
@@ -1375,9 +1360,9 @@ function _asyncToGenerator$2(fn) {
1375
1360
 
1376
1361
 
1377
1362
  var ObjectMicroAppApi_getObjectMicroAppList = /*#__PURE__*/function () {
1378
- var _ref = _asyncToGenerator$2(function* (options) {
1363
+ var _ref = _asyncToGenerator$3(function* (options) {
1379
1364
  return (
1380
- /**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList */
1365
+ /**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList@1.0.0 */
1381
1366
  (yield http.get("api/gateway/micro_app.object_micro_app.GetObjectMicroAppList/api/micro_app/v1/object_micro_app", options)).data
1382
1367
  );
1383
1368
  });
@@ -1393,9 +1378,9 @@ var ObjectMicroAppApi_getObjectMicroAppList = /*#__PURE__*/function () {
1393
1378
 
1394
1379
 
1395
1380
  var PermissionApi_validatePermissions = /*#__PURE__*/function () {
1396
- var _ref = _asyncToGenerator$2(function* (data, options) {
1381
+ var _ref = _asyncToGenerator$3(function* (data, options) {
1397
1382
  return (
1398
- /**! @contract easyops.api.micro_app.permission.ValidatePermissions */
1383
+ /**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */
1399
1384
  (yield http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
1400
1385
  );
1401
1386
  });
@@ -1461,7 +1446,7 @@ function preCheckPermissions(_x) {
1461
1446
  }
1462
1447
 
1463
1448
  function _preCheckPermissions() {
1464
- _preCheckPermissions = _asyncToGenerator$4(function* (storyboard) {
1449
+ _preCheckPermissions = _asyncToGenerator$3(function* (storyboard) {
1465
1450
  var usedActions = scanPermissionActionsInStoryboard(storyboard);
1466
1451
  yield validatePermissions(usedActions);
1467
1452
  });
@@ -1479,7 +1464,7 @@ function validatePermissions(_x2) {
1479
1464
  */
1480
1465
 
1481
1466
  function _validatePermissions() {
1482
- _validatePermissions = _asyncToGenerator$4(function* (usedActions) {
1467
+ _validatePermissions = _asyncToGenerator$3(function* (usedActions) {
1483
1468
  // Do not request known actions.
1484
1469
  var actions = difference(usedActions, Array.from(permissionMap.keys()));
1485
1470
 
@@ -1580,6 +1565,44 @@ function getDynamicReadOnlyProxy(_ref) {
1580
1565
  });
1581
1566
  }
1582
1567
 
1568
+ var misc;
1569
+ function getRuntimeMisc() {
1570
+ if (!misc) {
1571
+ misc = {
1572
+ isInIframe: false,
1573
+ isInIframeOfSameSite: false,
1574
+ isInIframeOfNext: false,
1575
+ isInIframeOfVisualBuilder: false,
1576
+ isInIframeOfLegacyConsole: false
1577
+ };
1578
+
1579
+ if (window !== window.parent) {
1580
+ misc.isInIframe = true;
1581
+
1582
+ try {
1583
+ // Handle:
1584
+ // - Previewing in visual builder by iframe.
1585
+ // - Nesting next in next.
1586
+ // - Nesting console in next.
1587
+ if (window.origin === window.parent.origin) {
1588
+ misc.isInIframeOfSameSite = true;
1589
+ var selfIsNext = getBasePath() === "/next/";
1590
+ var parentPathname = window.parent.location.pathname;
1591
+ var parentIsNext = parentPathname.startsWith("/next/");
1592
+ misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
1593
+ misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
1594
+ misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
1595
+ }
1596
+ } catch (e) {// do nothing
1597
+ }
1598
+ }
1599
+
1600
+ Object.freeze(misc);
1601
+ }
1602
+
1603
+ return misc;
1604
+ }
1605
+
1583
1606
  // `GeneralGlobals` are globals which are page-state-agnostic,
1584
1607
  // thus they can be used both in storyboard expressions and functions.
1585
1608
  function getGeneralGlobals(attemptToVisitGlobals, options) {
@@ -1632,6 +1655,9 @@ function getIndividualGlobal(variableName, _ref) {
1632
1655
  getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue
1633
1656
  };
1634
1657
 
1658
+ case "RUNTIME_MISC":
1659
+ return collectCoverage ? fakeRuntimeMisc() : getRuntimeMisc();
1660
+
1635
1661
  case "console":
1636
1662
  return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
1637
1663
 
@@ -1667,6 +1693,16 @@ function fakeCheckPermissions() {
1667
1693
  return true;
1668
1694
  }
1669
1695
 
1696
+ function fakeRuntimeMisc() {
1697
+ return {
1698
+ isInIframe: false,
1699
+ isInIframeOfSameSite: false,
1700
+ isInIframeOfNext: false,
1701
+ isInIframeOfVisualBuilder: false,
1702
+ isInIframeOfLegacyConsole: false
1703
+ };
1704
+ }
1705
+
1670
1706
  /** @internal */
1671
1707
 
1672
1708
  /** @internal */
@@ -2049,7 +2085,7 @@ class StoryboardContextWrapper {
2049
2085
  define(contextConfs, coreContext, brick) {
2050
2086
  var _this = this;
2051
2087
 
2052
- return _asyncToGenerator$4(function* () {
2088
+ return _asyncToGenerator$3(function* () {
2053
2089
  if (Array.isArray(contextConfs)) {
2054
2090
  var {
2055
2091
  mergedContext,
@@ -2090,7 +2126,7 @@ function resolveStoryboardContext(_x, _x2, _x3, _x4) {
2090
2126
  }
2091
2127
 
2092
2128
  function _resolveStoryboardContext() {
2093
- _resolveStoryboardContext = _asyncToGenerator$4(function* (contextConf, coreContext, storyboardContextWrapper, brick) {
2129
+ _resolveStoryboardContext = _asyncToGenerator$3(function* (contextConf, coreContext, storyboardContextWrapper, brick) {
2094
2130
  if (contextConf.property) {
2095
2131
  if (storyboardContextWrapper.tplContextId) {
2096
2132
  throw new Error("Setting `property` is not allowed in template scoped context");
@@ -2117,7 +2153,7 @@ function resolveNormalStoryboardContext(_x5, _x6, _x7, _x8) {
2117
2153
  }
2118
2154
 
2119
2155
  function _resolveNormalStoryboardContext() {
2120
- _resolveNormalStoryboardContext = _asyncToGenerator$4(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
2156
+ _resolveNormalStoryboardContext = _asyncToGenerator$3(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
2121
2157
  if (!looseCheckIf(contextConf, mergedContext)) {
2122
2158
  return false;
2123
2159
  }
@@ -2978,7 +3014,8 @@ function getNextInternalOptions(internalOptions, isArray, key) {
2978
3014
  }
2979
3015
 
2980
3016
  var _excluded$6 = ["children"],
2981
- _excluded2$2 = ["items", "app"];
3017
+ _excluded2$2 = ["children"],
3018
+ _excluded3 = ["items", "app"];
2982
3019
  var symbolAppId = Symbol("appId");
2983
3020
  // Caching menu requests to avoid flicker.
2984
3021
  var menuCache = new Map();
@@ -2989,7 +3026,7 @@ function constructMenu(_x, _x2, _x3) {
2989
3026
  }
2990
3027
 
2991
3028
  function _constructMenu() {
2992
- _constructMenu = _asyncToGenerator$4(function* (menuBar, context, kernel) {
3029
+ _constructMenu = _asyncToGenerator$3(function* (menuBar, context, kernel) {
2993
3030
  var hasSubMenu = !!menuBar.subMenuId;
2994
3031
 
2995
3032
  if (menuBar.menuId) {
@@ -3019,7 +3056,7 @@ function preConstructMenus(_x4, _x5, _x6) {
3019
3056
  }
3020
3057
 
3021
3058
  function _preConstructMenus() {
3022
- _preConstructMenus = _asyncToGenerator$4(function* (menus, context, kernel) {
3059
+ _preConstructMenus = _asyncToGenerator$3(function* (menus, context, kernel) {
3023
3060
  var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3024
3061
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3025
3062
  });
@@ -3032,7 +3069,7 @@ function fetchMenuById(_x7, _x8, _x9) {
3032
3069
  }
3033
3070
 
3034
3071
  function _fetchMenuById() {
3035
- _fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel, isPreFetch) {
3072
+ _fetchMenuById = _asyncToGenerator$3(function* (menuId, kernel, isPreFetch) {
3036
3073
  if (menuCache.has(menuId)) {
3037
3074
  return menuCache.get(menuId);
3038
3075
  }
@@ -3138,7 +3175,7 @@ function loadDynamicMenuItems(_x10) {
3138
3175
  }
3139
3176
 
3140
3177
  function _loadDynamicMenuItems() {
3141
- _loadDynamicMenuItems = _asyncToGenerator$4(function* (menu) {
3178
+ _loadDynamicMenuItems = _asyncToGenerator$3(function* (menu) {
3142
3179
  if (menu.dynamicItems && menu.itemsResolve) {
3143
3180
  var itemsConf = {};
3144
3181
  yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
@@ -3156,16 +3193,19 @@ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3156
3193
  }
3157
3194
 
3158
3195
  function _processMenu() {
3159
- _processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3196
+ _processMenu = _asyncToGenerator$3(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3160
3197
  var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3161
3198
  {
3162
3199
  items,
3163
3200
  app
3164
3201
  } = _yield$fetchMenuById,
3165
- restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded2$2);
3202
+ restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded3);
3203
+
3204
+ var appIds = collectOverrideApps(items, app[0].appId, context.app.id);
3205
+ yield kernel.fulfilStoryboardI18n(appIds);
3166
3206
 
3167
- var menuData = _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3168
- items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
3207
+ var menuData = _objectSpread(_objectSpread({}, computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3208
+ items: computeMenuItemsWithOverrideApp(items, context, kernel)
3169
3209
  });
3170
3210
 
3171
3211
  return {
@@ -3197,31 +3237,53 @@ function _processMenu() {
3197
3237
  return _processMenu.apply(this, arguments);
3198
3238
  }
3199
3239
 
3200
- function computeMenuItemsWithOverrideApp(items, context, kernel) {
3201
- return Promise.all(items.map( /*#__PURE__*/function () {
3202
- var _ref2 = _asyncToGenerator$4(function* (_ref) {
3240
+ function collectOverrideApps(items, rootAppId, contextAppId) {
3241
+ var appIds = new Set();
3242
+
3243
+ if (rootAppId !== contextAppId) {
3244
+ appIds.add(rootAppId);
3245
+ }
3246
+
3247
+ function collect(items) {
3248
+ for (var _ref of items) {
3203
3249
  var {
3204
3250
  children
3205
3251
  } = _ref,
3206
3252
  rest = _objectWithoutProperties(_ref, _excluded$6);
3207
3253
 
3208
- return _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3209
- children: children && (yield computeMenuItemsWithOverrideApp(children, context, kernel))
3210
- });
3211
- });
3254
+ var overrideAppId = rest[symbolAppId];
3212
3255
 
3213
- return function (_x16) {
3214
- return _ref2.apply(this, arguments);
3215
- };
3216
- }()));
3256
+ if (overrideAppId !== contextAppId && !appIds.has(overrideAppId) && requireOverrideApp(rest)) {
3257
+ appIds.add(overrideAppId);
3258
+ }
3259
+
3260
+ children && collect(children);
3261
+ }
3262
+ }
3263
+
3264
+ collect(items);
3265
+ return [...appIds];
3217
3266
  }
3218
3267
 
3219
- function processMenuTitle(_x17) {
3268
+ function computeMenuItemsWithOverrideApp(items, context, kernel) {
3269
+ return items.map(_ref2 => {
3270
+ var {
3271
+ children
3272
+ } = _ref2,
3273
+ rest = _objectWithoutProperties(_ref2, _excluded2$2);
3274
+
3275
+ return _objectSpread(_objectSpread({}, computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3276
+ children: children && computeMenuItemsWithOverrideApp(children, context, kernel)
3277
+ });
3278
+ });
3279
+ }
3280
+
3281
+ function processMenuTitle(_x16) {
3220
3282
  return _processMenuTitle.apply(this, arguments);
3221
3283
  }
3222
3284
 
3223
3285
  function _processMenuTitle() {
3224
- _processMenuTitle = _asyncToGenerator$4(function* (menuData) {
3286
+ _processMenuTitle = _asyncToGenerator$3(function* (menuData) {
3225
3287
  if (menuData.title || isEmpty(menuData.titleDataSource)) {
3226
3288
  return menuData.title;
3227
3289
  }
@@ -3311,37 +3373,29 @@ function requireOverrideApp(data) {
3311
3373
  return false;
3312
3374
  }
3313
3375
 
3314
- function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3315
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3316
- }
3317
-
3318
- function _computeRealValueWithOverrideApp() {
3319
- _computeRealValueWithOverrideApp = _asyncToGenerator$4(function* (data, overrideAppId, context, kernel) {
3320
- var newContext = context;
3376
+ function computeRealValueWithOverrideApp(data, overrideAppId, context, kernel) {
3377
+ var newContext = context;
3321
3378
 
3322
- if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3323
- var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3379
+ if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3380
+ var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3324
3381
 
3325
- if (storyboard) {
3326
- yield kernel.fulfilStoryboard(storyboard);
3327
- newContext = _objectSpread(_objectSpread({}, context), {}, {
3328
- overrideApp: storyboard.app
3329
- });
3330
- }
3382
+ if (storyboard) {
3383
+ newContext = _objectSpread(_objectSpread({}, context), {}, {
3384
+ overrideApp: storyboard.app
3385
+ });
3331
3386
  }
3387
+ }
3332
3388
 
3333
- return computeRealValue(data, newContext, true, {
3334
- ignoreSymbols: true
3335
- });
3389
+ return computeRealValue(data, newContext, true, {
3390
+ ignoreSymbols: true
3336
3391
  });
3337
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3338
3392
  }
3339
3393
 
3340
3394
  var lazyBrickRegistry = new Map();
3341
3395
  var requestsMap = new WeakMap();
3342
3396
  function registerLazyBricks(bricks, factory) {
3343
3397
  var factoryWrapper = /*#__PURE__*/function () {
3344
- var _ref = _asyncToGenerator$4(function* () {
3398
+ var _ref = _asyncToGenerator$3(function* () {
3345
3399
  try {
3346
3400
  window.dispatchEvent(new CustomEvent("request.start"));
3347
3401
  yield factory();
@@ -3368,7 +3422,7 @@ function loadLazyBricks(_x) {
3368
3422
  }
3369
3423
 
3370
3424
  function _loadLazyBricks() {
3371
- _loadLazyBricks = _asyncToGenerator$4(function* (bricks) {
3425
+ _loadLazyBricks = _asyncToGenerator$3(function* (bricks) {
3372
3426
  var requests = new Set();
3373
3427
 
3374
3428
  for (var brick of bricks) {
@@ -3489,7 +3543,7 @@ class Runtime {
3489
3543
  }
3490
3544
 
3491
3545
  bootstrap(mountPoints) {
3492
- return _asyncToGenerator$4(function* () {
3546
+ return _asyncToGenerator$3(function* () {
3493
3547
  if (kernel !== undefined) {
3494
3548
  throw new Error("Cannot bootstrap more than once.");
3495
3549
  }
@@ -4017,11 +4071,8 @@ function handleHttpError(error) {
4017
4071
  content: /*#__PURE__*/React.createElement("div", {
4018
4072
  style: {
4019
4073
  whiteSpace: "pre-wrap"
4020
- },
4021
- dangerouslySetInnerHTML: {
4022
- __html: httpErrorToString(error)
4023
4074
  }
4024
- }),
4075
+ }, httpErrorToString(error)),
4025
4076
  okText: i18next.t("".concat(NS_BRICK_KIT, ":").concat(K.MODAL_OK))
4026
4077
  });
4027
4078
  }
@@ -5780,7 +5831,7 @@ function startPoll(task, _ref, _ref2) {
5780
5831
  }
5781
5832
 
5782
5833
  function _poll() {
5783
- _poll = _asyncToGenerator$4(function* () {
5834
+ _poll = _asyncToGenerator$3(function* () {
5784
5835
  timeoutIdList.delete(currentTimeoutId);
5785
5836
  var shouldStop;
5786
5837
 
@@ -5859,7 +5910,7 @@ function clearPollTimeout() {
5859
5910
 
5860
5911
 
5861
5912
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5862
- var _ref = _asyncToGenerator$4(function* (options) {
5913
+ var _ref = _asyncToGenerator$3(function* (options) {
5863
5914
  return (
5864
5915
  /**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5865
5916
  (yield http.get("api/v1/runtime_standalone", options)).data
@@ -5877,7 +5928,7 @@ var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5877
5928
 
5878
5929
 
5879
5930
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5880
- var _ref = _asyncToGenerator$4(function* (params, options) {
5931
+ var _ref = _asyncToGenerator$3(function* (params, options) {
5881
5932
  return (
5882
5933
  /**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5883
5934
  (yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
@@ -5897,7 +5948,7 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5897
5948
 
5898
5949
 
5899
5950
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5900
- var _ref = _asyncToGenerator$4(function* (appId, params, options) {
5951
+ var _ref = _asyncToGenerator$3(function* (appId, params, options) {
5901
5952
  return (
5902
5953
  /**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5903
5954
  (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
@@ -5917,7 +5968,7 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5917
5968
 
5918
5969
 
5919
5970
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5920
- var _ref = _asyncToGenerator$4(function* (data, options) {
5971
+ var _ref = _asyncToGenerator$3(function* (data, options) {
5921
5972
  return (
5922
5973
  /**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5923
5974
  (yield http.post("api/contract/single_search", data, options)).data
@@ -5950,7 +6001,7 @@ function getArgsOfCustomApi(_x, _x2) {
5950
6001
  }
5951
6002
 
5952
6003
  function _getArgsOfCustomApi() {
5953
- _getArgsOfCustomApi = _asyncToGenerator$4(function* (provider, originalArgs) {
6004
+ _getArgsOfCustomApi = _asyncToGenerator$3(function* (provider, originalArgs) {
5954
6005
  if (!isCustomApiProvider(provider)) {
5955
6006
  return originalArgs;
5956
6007
  }
@@ -6066,7 +6117,7 @@ function _fetchFlowApiDefinition(_x3) {
6066
6117
  }
6067
6118
 
6068
6119
  function _fetchFlowApiDefinition2() {
6069
- _fetchFlowApiDefinition2 = _asyncToGenerator$4(function* (provider) {
6120
+ _fetchFlowApiDefinition2 = _asyncToGenerator$3(function* (provider) {
6070
6121
  var [namespaceName, nameWithVersion] = provider.split("@");
6071
6122
  var [name, version] = nameWithVersion.split(":");
6072
6123
  var contract;
@@ -6323,7 +6374,7 @@ function listenerFactory(handler, context, runtimeBrick) {
6323
6374
 
6324
6375
  function usingProviderFactory(handler, context, runtimeBrick) {
6325
6376
  return /*#__PURE__*/function () {
6326
- var _ref2 = _asyncToGenerator$4(function* (event) {
6377
+ var _ref2 = _asyncToGenerator$3(function* (event) {
6327
6378
  if (!looseCheckIf(handler, _objectSpread(_objectSpread({}, context), {}, {
6328
6379
  event
6329
6380
  }))) {
@@ -6600,7 +6651,7 @@ function brickCallback(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {
6600
6651
  }
6601
6652
 
6602
6653
  function _brickCallback() {
6603
- _brickCallback = _asyncToGenerator$4(function* (target, handler, method, context, runtimeBrick, event, options) {
6654
+ _brickCallback = _asyncToGenerator$3(function* (target, handler, method, context, runtimeBrick, event, options) {
6604
6655
  var _handler$callback, _poll;
6605
6656
 
6606
6657
  if (typeof target[method] !== "function") {
@@ -6613,7 +6664,7 @@ function _brickCallback() {
6613
6664
  }
6614
6665
 
6615
6666
  var task = /*#__PURE__*/function () {
6616
- var _ref3 = _asyncToGenerator$4(function* () {
6667
+ var _ref3 = _asyncToGenerator$3(function* () {
6617
6668
  var computedArgs = argsFactory(handler.args, context, event, options);
6618
6669
 
6619
6670
  if (isUseProviderHandler(handler)) {
@@ -6969,7 +7020,7 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
6969
7020
 
6970
7021
 
6971
7022
  var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6972
- var _ref = _asyncToGenerator$4(function* (appId, options) {
7023
+ var _ref = _asyncToGenerator$3(function* (appId, options) {
6973
7024
  return (
6974
7025
  /**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
6975
7026
  (yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
@@ -6987,7 +7038,7 @@ var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6987
7038
 
6988
7039
 
6989
7040
  var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
6990
- var _ref = _asyncToGenerator$4(function* (data, options) {
7041
+ var _ref = _asyncToGenerator$3(function* (data, options) {
6991
7042
  return (
6992
7043
  /**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
6993
7044
  (yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
@@ -7137,7 +7188,7 @@ function CustomApi(_x) {
7137
7188
  }
7138
7189
 
7139
7190
  function _CustomApi() {
7140
- _CustomApi = _asyncToGenerator$4(function* (_ref2) {
7191
+ _CustomApi = _asyncToGenerator$3(function* (_ref2) {
7141
7192
  var {
7142
7193
  url,
7143
7194
  method = "GET",
@@ -7198,7 +7249,7 @@ function standaloneBootstrap() {
7198
7249
  }
7199
7250
 
7200
7251
  function _standaloneBootstrap() {
7201
- _standaloneBootstrap = _asyncToGenerator$4(function* () {
7252
+ _standaloneBootstrap = _asyncToGenerator$3(function* () {
7202
7253
  var [bootstrapResult, confString, runtimeData] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
7203
7254
  responseType: "text"
7204
7255
  }), yield BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
@@ -8261,7 +8312,7 @@ function asyncExpandCustomTemplate(_x, _x2, _x3) {
8261
8312
  }
8262
8313
 
8263
8314
  function _asyncExpandCustomTemplate() {
8264
- _asyncExpandCustomTemplate = _asyncToGenerator$4(function* (brickConf, proxyBrick, context) {
8315
+ _asyncExpandCustomTemplate = _asyncToGenerator$3(function* (brickConf, proxyBrick, context) {
8265
8316
  var tplContext = new CustomTemplateContext(proxyBrick);
8266
8317
  var template = customTemplateRegistry.get(brickConf.brick);
8267
8318
 
@@ -8762,7 +8813,7 @@ class Kernel {
8762
8813
  _defineProperty$1(this, "loadMagicBrickConfigStarted", false);
8763
8814
 
8764
8815
  _defineProperty$1(this, "_loadDepsOfStoryboard", /*#__PURE__*/function () {
8765
- var _ref = _asyncToGenerator$4(function* (storyboard) {
8816
+ var _ref = _asyncToGenerator$3(function* (storyboard) {
8766
8817
  var {
8767
8818
  brickPackages,
8768
8819
  templatePackages
@@ -8797,7 +8848,7 @@ class Kernel {
8797
8848
  }());
8798
8849
 
8799
8850
  _defineProperty$1(this, "_loadDynamicBricks", /*#__PURE__*/function () {
8800
- var _ref2 = _asyncToGenerator$4(function* (bricks, processors) {
8851
+ var _ref2 = _asyncToGenerator$3(function* (bricks, processors) {
8801
8852
  var filteredBricks = bricks.filter( // Only try to load undefined custom elements.
8802
8853
  item => !customElements.get(item)); // Try to load deps for dynamic added bricks.
8803
8854
 
@@ -8819,7 +8870,7 @@ class Kernel {
8819
8870
  }());
8820
8871
 
8821
8872
  _defineProperty$1(this, "_loadEditorBricks", /*#__PURE__*/function () {
8822
- var _ref3 = _asyncToGenerator$4(function* (editorBricks) {
8873
+ var _ref3 = _asyncToGenerator$3(function* (editorBricks) {
8823
8874
  var {
8824
8875
  dll,
8825
8876
  deps
@@ -8840,7 +8891,7 @@ class Kernel {
8840
8891
  bootstrap(mountPoints) {
8841
8892
  var _this2 = this;
8842
8893
 
8843
- return _asyncToGenerator$4(function* () {
8894
+ return _asyncToGenerator$3(function* () {
8844
8895
  var _this2$bootstrapData$, _this2$bootstrapData$2;
8845
8896
 
8846
8897
  listenDevtoolsEagerly();
@@ -8875,7 +8926,7 @@ class Kernel {
8875
8926
  layoutBootstrap(layout) {
8876
8927
  var _this3 = this;
8877
8928
 
8878
- return _asyncToGenerator$4(function* () {
8929
+ return _asyncToGenerator$3(function* () {
8879
8930
  var supportedLayouts = ["console", "business"];
8880
8931
 
8881
8932
  if (!supportedLayouts.includes(layout)) {
@@ -8927,7 +8978,7 @@ class Kernel {
8927
8978
  }
8928
8979
 
8929
8980
  loadCheckLogin() {
8930
- return _asyncToGenerator$4(function* () {
8981
+ return _asyncToGenerator$3(function* () {
8931
8982
  if (!window.NO_AUTH_GUARD) {
8932
8983
  var auth = yield checkLogin();
8933
8984
 
@@ -8941,7 +8992,7 @@ class Kernel {
8941
8992
  loadMicroApps(params, interceptorParams) {
8942
8993
  var _this4 = this;
8943
8994
 
8944
- return _asyncToGenerator$4(function* () {
8995
+ return _asyncToGenerator$3(function* () {
8945
8996
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
8946
8997
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons",
8947
8998
  ignoreTemplateFields: "templates",
@@ -8972,7 +9023,7 @@ class Kernel {
8972
9023
  fulfilStoryboard(storyboard) {
8973
9024
  var _this5 = this;
8974
9025
 
8975
- return _asyncToGenerator$4(function* () {
9026
+ return _asyncToGenerator$3(function* () {
8976
9027
  if (storyboard.$$fulfilled) {
8977
9028
  return;
8978
9029
  }
@@ -8988,10 +9039,11 @@ class Kernel {
8988
9039
  doFulfilStoryboard(storyboard) {
8989
9040
  var _this6 = this;
8990
9041
 
8991
- return _asyncToGenerator$4(function* () {
9042
+ return _asyncToGenerator$3(function* () {
8992
9043
  if (window.STANDALONE_MICRO_APPS) {
8993
9044
  Object.assign(storyboard, {
8994
- $$fulfilled: true
9045
+ $$fulfilled: true,
9046
+ $$fulfilling: null
8995
9047
  });
8996
9048
 
8997
9049
  if (!window.NO_AUTH_GUARD) {
@@ -9024,7 +9076,8 @@ class Kernel {
9024
9076
  routes,
9025
9077
  meta,
9026
9078
  app: _objectSpread(_objectSpread({}, storyboard.app), app),
9027
- $$fulfilled: true
9079
+ $$fulfilled: true,
9080
+ $$fulfilling: null
9028
9081
  });
9029
9082
  }
9030
9083
 
@@ -9033,9 +9086,12 @@ class Kernel {
9033
9086
  }
9034
9087
 
9035
9088
  postProcessStoryboard(storyboard) {
9036
- var _storyboard$meta;
9037
-
9038
9089
  storyboard.app.$$routeAliasMap = scanRouteAliasInStoryboard(storyboard);
9090
+ this.postProcessStoryboardI18n(storyboard);
9091
+ }
9092
+
9093
+ postProcessStoryboardI18n(storyboard) {
9094
+ var _storyboard$meta;
9039
9095
 
9040
9096
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
9041
9097
  // Prefix to avoid conflict between brick package's i18n namespace.
@@ -9048,10 +9104,70 @@ class Kernel {
9048
9104
  }
9049
9105
  }
9050
9106
 
9107
+ fulfilStoryboardI18n(appIds) {
9108
+ var _this7 = this;
9109
+
9110
+ return _asyncToGenerator$3(function* () {
9111
+ // Ignore already fulfilled apps.
9112
+ var filteredStoryboards = appIds.map(appId => _this7.bootstrapData.storyboards.find(story => story.app.id === appId)).filter(story => story && !story.$$fulfilled && !story.$$i18nFulfilled);
9113
+
9114
+ if (window.STANDALONE_MICRO_APPS) {
9115
+ // Fallback to fullfil whole storyboard for standalone micro-apps.
9116
+ yield Promise.all(filteredStoryboards.map(story => _this7.fulfilStoryboard(story)));
9117
+ return;
9118
+ } // Do not fulfil i18n if the app is doing a whole fulfilling.
9119
+
9120
+
9121
+ var fulfilling = [];
9122
+ var filteredAppIds = [];
9123
+
9124
+ for (var story of filteredStoryboards) {
9125
+ if (story.$$fulfilling) {
9126
+ fulfilling.push(story.$$fulfilling);
9127
+ } else {
9128
+ filteredAppIds.push(story.app.id);
9129
+ }
9130
+ }
9131
+
9132
+ if (filteredAppIds.length === 0) {
9133
+ // Still wait for these whole fulfilling.
9134
+ yield Promise.all(fulfilling);
9135
+ return;
9136
+ }
9137
+
9138
+ var [{
9139
+ i18nInfo
9140
+ }] = yield Promise.all([InstalledMicroAppApi_getI18NData({
9141
+ appIds: filteredAppIds.join(",")
9142
+ }), // Still wait for these whole fulfilling.
9143
+ ...fulfilling]);
9144
+
9145
+ var _loop = function (appId, i18n) {
9146
+ var storyboard = _this7.bootstrapData.storyboards.find(story => story.app.id === appId);
9147
+
9148
+ Object.assign(storyboard, {
9149
+ meta: _objectSpread(_objectSpread({}, storyboard.meta), {}, {
9150
+ i18n: i18n
9151
+ }),
9152
+ $$i18nFulfilled: true
9153
+ });
9154
+
9155
+ _this7.postProcessStoryboardI18n(storyboard);
9156
+ };
9157
+
9158
+ for (var {
9159
+ appId,
9160
+ i18n
9161
+ } of i18nInfo) {
9162
+ _loop(appId, i18n);
9163
+ }
9164
+ })();
9165
+ }
9166
+
9051
9167
  _dev_only_updateStoryboard(appId, storyboardPatch) {
9052
9168
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9053
9169
  Object.assign(storyboard, _objectSpread(_objectSpread({}, storyboardPatch), {}, {
9054
- $$fulfilling: Promise.resolve(),
9170
+ $$fulfilling: null,
9055
9171
  $$fulfilled: true,
9056
9172
  $$registerCustomTemplateProcessed: false,
9057
9173
  $$depsProcessed: false
@@ -9174,9 +9290,9 @@ class Kernel {
9174
9290
 
9175
9291
  gracefullyLoadDeps(fn) {
9176
9292
  var _arguments = arguments,
9177
- _this7 = this;
9293
+ _this8 = this;
9178
9294
 
9179
- return _asyncToGenerator$4(function* () {
9295
+ return _asyncToGenerator$3(function* () {
9180
9296
  for (var _len = _arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9181
9297
  args[_key - 1] = _arguments[_key];
9182
9298
  }
@@ -9188,7 +9304,7 @@ class Kernel {
9188
9304
  // The scripts maybe stale when a user stays in page while upgrades been applied.
9189
9305
  // So we force reloading again automatically.
9190
9306
  // NOTE: reload only once to avoid a infinite loop.
9191
- yield _this7.reloadMicroApps();
9307
+ yield _this8.reloadMicroApps();
9192
9308
  yield fn(...args);
9193
9309
  } else {
9194
9310
  throw e;
@@ -9237,15 +9353,15 @@ class Kernel {
9237
9353
  }
9238
9354
 
9239
9355
  loadDynamicBricksInBrickConf(brickConf) {
9240
- var _this8 = this;
9356
+ var _this9 = this;
9241
9357
 
9242
- return _asyncToGenerator$4(function* () {
9358
+ return _asyncToGenerator$3(function* () {
9243
9359
  // Notice: `brickConf` contains runtime data,
9244
9360
  // which may contains recursive ref,
9245
9361
  // which could cause stack overflow while traversing.
9246
9362
  var bricks = scanBricksInBrickConf(brickConf);
9247
9363
  var processors = scanProcessorsInAny(brickConf);
9248
- yield _this8.loadDynamicBricks(bricks, processors);
9364
+ yield _this9.loadDynamicBricks(bricks, processors);
9249
9365
  })();
9250
9366
  }
9251
9367
 
@@ -9317,7 +9433,7 @@ class Kernel {
9317
9433
  }
9318
9434
 
9319
9435
  loadUsers() {
9320
- return _asyncToGenerator$4(function* () {
9436
+ return _asyncToGenerator$3(function* () {
9321
9437
  var allUserMap = new Map();
9322
9438
 
9323
9439
  try {
@@ -9354,15 +9470,15 @@ class Kernel {
9354
9470
  }
9355
9471
 
9356
9472
  getMicroAppApiOrchestrationMapAsync() {
9357
- var _this9 = this;
9473
+ var _this10 = this;
9358
9474
 
9359
- return _asyncToGenerator$4(function* () {
9360
- return yield _this9.allMicroAppApiOrchestrationPromise;
9475
+ return _asyncToGenerator$3(function* () {
9476
+ return yield _this10.allMicroAppApiOrchestrationPromise;
9361
9477
  })();
9362
9478
  }
9363
9479
 
9364
9480
  loadMicroAppApiOrchestration(usedCustomApis) {
9365
- return _asyncToGenerator$4(function* () {
9481
+ return _asyncToGenerator$3(function* () {
9366
9482
  var allMicroAppApiOrchestrationMap = new Map();
9367
9483
  var legacyCustomApis = usedCustomApis.filter(item => !item.name.includes(":"));
9368
9484
 
@@ -9404,7 +9520,7 @@ class Kernel {
9404
9520
  }
9405
9521
 
9406
9522
  loadMagicBrickConfig() {
9407
- return _asyncToGenerator$4(function* () {
9523
+ return _asyncToGenerator$3(function* () {
9408
9524
  var allMagicBrickConfigMap = new Map();
9409
9525
 
9410
9526
  try {
@@ -9434,7 +9550,7 @@ class Kernel {
9434
9550
  }
9435
9551
 
9436
9552
  loadRelatedApps() {
9437
- return _asyncToGenerator$4(function* () {
9553
+ return _asyncToGenerator$3(function* () {
9438
9554
  var relatedApps = [];
9439
9555
 
9440
9556
  try {
@@ -9449,14 +9565,14 @@ class Kernel {
9449
9565
  }
9450
9566
 
9451
9567
  getRelatedAppsAsync(appId) {
9452
- var _this10 = this;
9568
+ var _this11 = this;
9453
9569
 
9454
- return _asyncToGenerator$4(function* () {
9570
+ return _asyncToGenerator$3(function* () {
9455
9571
  if (!appId) {
9456
9572
  return [];
9457
9573
  }
9458
9574
 
9459
- var allRelatedApps = yield _this10.allRelatedAppsPromise;
9575
+ var allRelatedApps = yield _this11.allRelatedAppsPromise;
9460
9576
  var thisApp = allRelatedApps.find(item => item.microAppId === appId);
9461
9577
 
9462
9578
  if (!thisApp) {
@@ -9468,38 +9584,38 @@ class Kernel {
9468
9584
  }
9469
9585
 
9470
9586
  updateWorkspaceStack() {
9471
- var _this11 = this;
9587
+ var _this12 = this;
9472
9588
 
9473
- return _asyncToGenerator$4(function* () {
9474
- if (_this11.currentApp && _this11.currentApp.id) {
9589
+ return _asyncToGenerator$3(function* () {
9590
+ if (_this12.currentApp && _this12.currentApp.id) {
9475
9591
  var workspace = {
9476
- appId: _this11.currentApp.id,
9477
- appName: _this11.currentApp.name,
9478
- appLocaleName: _this11.currentApp.localeName,
9479
- url: _this11.currentUrl
9592
+ appId: _this12.currentApp.id,
9593
+ appName: _this12.currentApp.name,
9594
+ appLocaleName: _this12.currentApp.localeName,
9595
+ url: _this12.currentUrl
9480
9596
  };
9481
9597
 
9482
- if (_this11.workspaceStack.length > 0) {
9483
- var previousWorkspace = _this11.workspaceStack[_this11.workspaceStack.length - 1];
9598
+ if (_this12.workspaceStack.length > 0) {
9599
+ var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
9484
9600
 
9485
- var _relatedApps = yield _this11.getRelatedAppsAsync(previousWorkspace.appId);
9601
+ var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
9486
9602
 
9487
- if (_relatedApps.some(item => item.microAppId === _this11.currentApp.id)) {
9603
+ if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
9488
9604
  Object.assign(previousWorkspace, workspace);
9489
9605
  return;
9490
9606
  }
9491
9607
  }
9492
9608
 
9493
- var relatedApps = yield _this11.getRelatedAppsAsync(_this11.currentApp.id);
9609
+ var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
9494
9610
 
9495
9611
  if (relatedApps.length > 0) {
9496
- _this11.workspaceStack.push(workspace);
9612
+ _this12.workspaceStack.push(workspace);
9497
9613
 
9498
9614
  return;
9499
9615
  }
9500
9616
  }
9501
9617
 
9502
- _this11.workspaceStack = [];
9618
+ _this12.workspaceStack = [];
9503
9619
  })();
9504
9620
  }
9505
9621
 
@@ -9546,22 +9662,22 @@ class Kernel {
9546
9662
  }
9547
9663
 
9548
9664
  getProviderBrick(provider) {
9549
- var _this12 = this;
9665
+ var _this13 = this;
9550
9666
 
9551
- return _asyncToGenerator$4(function* () {
9667
+ return _asyncToGenerator$3(function* () {
9552
9668
  if (isCustomApiProvider(provider)) {
9553
9669
  provider = CUSTOM_API_PROVIDER;
9554
9670
  }
9555
9671
 
9556
- if (_this12.providerRepository.has(provider)) {
9557
- return _this12.providerRepository.get(provider);
9672
+ if (_this13.providerRepository.has(provider)) {
9673
+ return _this13.providerRepository.get(provider);
9558
9674
  }
9559
9675
 
9560
9676
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
9561
9677
  registerCustomApi();
9562
9678
  }
9563
9679
 
9564
- yield _this12.loadDynamicBricks([provider]);
9680
+ yield _this13.loadDynamicBricks([provider]);
9565
9681
 
9566
9682
  if (!customElements.get(provider)) {
9567
9683
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -9569,7 +9685,7 @@ class Kernel {
9569
9685
 
9570
9686
  var brick = document.createElement(provider);
9571
9687
 
9572
- _this12.providerRepository.set(provider, brick);
9688
+ _this13.providerRepository.set(provider, brick);
9573
9689
 
9574
9690
  return brick;
9575
9691
  })();
@@ -9583,7 +9699,7 @@ function loadScriptOfDll(_x5) {
9583
9699
  }
9584
9700
 
9585
9701
  function _loadScriptOfDll() {
9586
- _loadScriptOfDll = _asyncToGenerator$4(function* (dlls) {
9702
+ _loadScriptOfDll = _asyncToGenerator$3(function* (dlls) {
9587
9703
  if (dlls.some(dll => dll.startsWith("dll-of-editor-bricks-helper."))) {
9588
9704
  var dllPath = window.DLL_PATH || {};
9589
9705
  yield loadScript(dllPath["react-dnd"], window.CORE_ROOT);
@@ -9741,44 +9857,6 @@ function isRouteConfOfRoutes(conf) {
9741
9857
  return conf.type === "routes";
9742
9858
  }
9743
9859
 
9744
- var misc;
9745
- function getRuntimeMisc() {
9746
- if (!misc) {
9747
- misc = {
9748
- isInIframe: false,
9749
- isInIframeOfSameSite: false,
9750
- isInIframeOfNext: false,
9751
- isInIframeOfVisualBuilder: false,
9752
- isInIframeOfLegacyConsole: false
9753
- };
9754
-
9755
- if (window !== window.parent) {
9756
- misc.isInIframe = true;
9757
-
9758
- try {
9759
- // Handle:
9760
- // - Previewing in visual builder by iframe.
9761
- // - Nesting next in next.
9762
- // - Nesting console in next.
9763
- if (window.origin === window.parent.origin) {
9764
- misc.isInIframeOfSameSite = true;
9765
- var selfIsNext = getBasePath() === "/next/";
9766
- var parentPathname = window.parent.location.pathname;
9767
- var parentIsNext = parentPathname.startsWith("/next/");
9768
- misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
9769
- misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
9770
- misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
9771
- }
9772
- } catch (e) {// do nothing
9773
- }
9774
- }
9775
-
9776
- Object.freeze(misc);
9777
- }
9778
-
9779
- return misc;
9780
- }
9781
-
9782
9860
  function getSubStoryboardByRoute(storyboard, matcher) {
9783
9861
  function getSubRoutes(routes) {
9784
9862
  return matcher(routes).map(getSubRoute);
@@ -10369,7 +10447,7 @@ class LocationContext {
10369
10447
  mountRoutes(routes, slotId, mountRoutesResult) {
10370
10448
  var _this = this;
10371
10449
 
10372
- return _asyncToGenerator$4(function* () {
10450
+ return _asyncToGenerator$3(function* () {
10373
10451
  var matched = _this.matchRoutes(routes, _this.kernel.nextApp);
10374
10452
 
10375
10453
  var redirect;
@@ -10454,7 +10532,7 @@ class LocationContext {
10454
10532
  mountMenu(menuConf, match, mountRoutesResult) {
10455
10533
  var _this2 = this;
10456
10534
 
10457
- return _asyncToGenerator$4(function* () {
10535
+ return _asyncToGenerator$3(function* () {
10458
10536
  if (menuConf === false) {
10459
10537
  // `route.menu` 设置为 `false` 表示不显示顶栏和侧栏。
10460
10538
  mountRoutesResult.flags.barsHidden = true;
@@ -10544,7 +10622,7 @@ class LocationContext {
10544
10622
  mountProviders(providers, match, slotId, mountRoutesResult) {
10545
10623
  var _this3 = this;
10546
10624
 
10547
- return _asyncToGenerator$4(function* () {
10625
+ return _asyncToGenerator$3(function* () {
10548
10626
  if (Array.isArray(providers)) {
10549
10627
  for (var providerConf of providers) {
10550
10628
  yield _this3.mountBrick(_objectSpread(_objectSpread({}, typeof providerConf === "string" ? {
@@ -10561,7 +10639,7 @@ class LocationContext {
10561
10639
  mountBricks(bricks, match, slotId, mountRoutesResult, tplStack) {
10562
10640
  var _this4 = this;
10563
10641
 
10564
- return _asyncToGenerator$4(function* () {
10642
+ return _asyncToGenerator$3(function* () {
10565
10643
  for (var brickConf of bricks) {
10566
10644
  try {
10567
10645
  yield _this4.mountBrick(brickConf, match, slotId, mountRoutesResult, tplStack === null || tplStack === void 0 ? void 0 : tplStack.slice());
@@ -10595,7 +10673,7 @@ class LocationContext {
10595
10673
  checkResolvableIf(ifContainer, context) {
10596
10674
  var _this5 = this;
10597
10675
 
10598
- return _asyncToGenerator$4(function* () {
10676
+ return _asyncToGenerator$3(function* () {
10599
10677
  if (isObject(ifContainer.if)) {
10600
10678
  var ifChecked = computeRealValue(ifContainer.if, context, true);
10601
10679
  var ifConf = {};
@@ -10608,7 +10686,7 @@ class LocationContext {
10608
10686
  }
10609
10687
 
10610
10688
  preCheckPermissions(container, context) {
10611
- return _asyncToGenerator$4(function* () {
10689
+ return _asyncToGenerator$3(function* () {
10612
10690
  if (isLoggedIn() && !getAuth().isAdmin && container.permissionsPreCheck && Array.isArray(container.permissionsPreCheck)) {
10613
10691
  var usedActions = computeRealValue(container.permissionsPreCheck, context, true);
10614
10692
  yield validatePermissions(usedActions);
@@ -10620,7 +10698,7 @@ class LocationContext {
10620
10698
  var _arguments = arguments,
10621
10699
  _this6 = this;
10622
10700
 
10623
- return _asyncToGenerator$4(function* () {
10701
+ return _asyncToGenerator$3(function* () {
10624
10702
  var _this6$kernel$nextApp, _brickConf$lifeCycle, _brick$lifeCycle;
10625
10703
 
10626
10704
  var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
@@ -10958,7 +11036,7 @@ class LocationContext {
10958
11036
  preFetchMenu(data) {
10959
11037
  var _this7 = this;
10960
11038
 
10961
- return _asyncToGenerator$4(function* () {
11039
+ return _asyncToGenerator$3(function* () {
10962
11040
  var useMenus = scanAppGetMenuInAny(data);
10963
11041
 
10964
11042
  if (useMenus.length) {
@@ -11057,7 +11135,7 @@ function makeProviderRefreshable(providerBrick) {
11057
11135
  // },
11058
11136
  $refresh: {
11059
11137
  value: function () {
11060
- var _ref = _asyncToGenerator$4(function* () {
11138
+ var _ref = _asyncToGenerator$3(function* () {
11061
11139
  var {
11062
11140
  ignoreErrors,
11063
11141
  throwErrors,
@@ -11072,7 +11150,7 @@ function makeProviderRefreshable(providerBrick) {
11072
11150
 
11073
11151
  try {
11074
11152
  yield Promise.all(this.$$dependents.map( /*#__PURE__*/function () {
11075
- var _ref3 = _asyncToGenerator$4(function* (_ref2) {
11153
+ var _ref3 = _asyncToGenerator$3(function* (_ref2) {
11076
11154
  var {
11077
11155
  brick,
11078
11156
  method,
@@ -11108,7 +11186,7 @@ function makeProviderRefreshable(providerBrick) {
11108
11186
  }
11109
11187
 
11110
11188
  function _fetchData() {
11111
- _fetchData = _asyncToGenerator$4(function* () {
11189
+ _fetchData = _asyncToGenerator$3(function* () {
11112
11190
  var value = yield promise;
11113
11191
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11114
11192
 
@@ -11204,7 +11282,7 @@ class Resolver {
11204
11282
  resolve(brickConf, brick, context) {
11205
11283
  var _this = this;
11206
11284
 
11207
- return _asyncToGenerator$4(function* () {
11285
+ return _asyncToGenerator$3(function* () {
11208
11286
  var _brickConf$lifeCycle$, _brickConf$lifeCycle;
11209
11287
 
11210
11288
  var useResolves = ((_brickConf$lifeCycle$ = (_brickConf$lifeCycle = brickConf.lifeCycle) === null || _brickConf$lifeCycle === void 0 ? void 0 : _brickConf$lifeCycle.useResolves) !== null && _brickConf$lifeCycle$ !== void 0 ? _brickConf$lifeCycle$ : []).filter(r => {
@@ -11225,7 +11303,7 @@ class Resolver {
11225
11303
  resolveOne(type, resolveConf, conf, brick, context) {
11226
11304
  var _this2 = this;
11227
11305
 
11228
- return _asyncToGenerator$4(function* () {
11306
+ return _asyncToGenerator$3(function* () {
11229
11307
  var brickConf = conf;
11230
11308
  var propsReference = conf;
11231
11309
  var actualResolveConf;
@@ -11316,7 +11394,7 @@ class Resolver {
11316
11394
  } else {
11317
11395
  var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
11318
11396
  : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
11319
- promise = _asyncToGenerator$4(function* () {
11397
+ promise = _asyncToGenerator$3(function* () {
11320
11398
  if (useProvider) {
11321
11399
  actualArgs = yield getArgsOfCustomApi(useProvider, actualArgs);
11322
11400
  }
@@ -11349,7 +11427,7 @@ class Resolver {
11349
11427
  }
11350
11428
 
11351
11429
  function _fetchData() {
11352
- _fetchData = _asyncToGenerator$4(function* () {
11430
+ _fetchData = _asyncToGenerator$3(function* () {
11353
11431
  var value = yield promise;
11354
11432
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11355
11433
 
@@ -11390,7 +11468,7 @@ class Resolver {
11390
11468
 
11391
11469
  var _loop = function (providerBrick, interval) {
11392
11470
  var request = /*#__PURE__*/function () {
11393
- var _ref2 = _asyncToGenerator$4(function* () {
11471
+ var _ref2 = _asyncToGenerator$3(function* () {
11394
11472
  yield providerBrick.$refresh({
11395
11473
  ignoreErrors: interval.ignoreErrors,
11396
11474
  throwErrors: true,
@@ -11507,7 +11585,7 @@ function preFetchStandaloneInstalledApps(_x) {
11507
11585
  }
11508
11586
 
11509
11587
  function _preFetchStandaloneInstalledApps() {
11510
- _preFetchStandaloneInstalledApps = _asyncToGenerator$4(function* (storyboard) {
11588
+ _preFetchStandaloneInstalledApps = _asyncToGenerator$3(function* (storyboard) {
11511
11589
  var saIds = scanInstalledAppsInStoryboard(storyboard);
11512
11590
  yield fetchStandaloneApps(saIds);
11513
11591
  });
@@ -11519,7 +11597,7 @@ function fetchStandaloneApps(_x2) {
11519
11597
  }
11520
11598
 
11521
11599
  function _fetchStandaloneApps() {
11522
- _fetchStandaloneApps = _asyncToGenerator$4(function* (saIds) {
11600
+ _fetchStandaloneApps = _asyncToGenerator$3(function* (saIds) {
11523
11601
  // ignore apps which are already searched
11524
11602
  var searchIds = difference(saIds, Array.from(appIdSet));
11525
11603
 
@@ -11674,14 +11752,14 @@ class Router {
11674
11752
  bootstrap() {
11675
11753
  var _this = this;
11676
11754
 
11677
- return _asyncToGenerator$4(function* () {
11755
+ return _asyncToGenerator$3(function* () {
11678
11756
  var history = getHistory();
11679
11757
  _this.prevLocation = history.location;
11680
11758
 
11681
11759
  _this.locationChangeNotify("", history.location.pathname);
11682
11760
 
11683
11761
  history.listen( /*#__PURE__*/function () {
11684
- var _ref = _asyncToGenerator$4(function* (location, action) {
11762
+ var _ref = _asyncToGenerator$3(function* (location, action) {
11685
11763
  var _this$prevLocation$st, _location$state;
11686
11764
 
11687
11765
  var ignoreRendering = false;
@@ -11743,7 +11821,7 @@ class Router {
11743
11821
  queuedRender(location) {
11744
11822
  var _this2 = this;
11745
11823
 
11746
- return _asyncToGenerator$4(function* () {
11824
+ return _asyncToGenerator$3(function* () {
11747
11825
  _this2.rendering = true;
11748
11826
 
11749
11827
  try {
@@ -11763,7 +11841,7 @@ class Router {
11763
11841
  render(location) {
11764
11842
  var _this3 = this;
11765
11843
 
11766
- return _asyncToGenerator$4(function* () {
11844
+ return _asyncToGenerator$3(function* () {
11767
11845
  var _apiAnalyzer$getInsta, _getLocalAppsTheme;
11768
11846
 
11769
11847
  _this3.state = "initial";
@@ -12524,7 +12602,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12524
12602
 
12525
12603
  return true;
12526
12604
  }, [useBrick, data]);
12527
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12605
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12528
12606
  if (!isBrickAvailable) {
12529
12607
  return null;
12530
12608
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12564,7 +12642,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12564
12642
  return brick;
12565
12643
  }), [useBrick, data, isBrickAvailable]);
12566
12644
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12567
- var _ref4 = _asyncToGenerator$4(function* (element) {
12645
+ var _ref4 = _asyncToGenerator$3(function* (element) {
12568
12646
  immediatelyRefCallback === null || immediatelyRefCallback === void 0 ? void 0 : immediatelyRefCallback(element);
12569
12647
 
12570
12648
  if (element) {
@@ -12726,7 +12804,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12726
12804
  useImperativeHandle(ref, () => {
12727
12805
  return brickRef.current;
12728
12806
  });
12729
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12807
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12730
12808
  if (!isBrickAvailable) {
12731
12809
  return null;
12732
12810
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12766,7 +12844,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12766
12844
  return brick;
12767
12845
  }), [useBrick, data, isBrickAvailable]);
12768
12846
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12769
- var _ref10 = _asyncToGenerator$4(function* (element) {
12847
+ var _ref10 = _asyncToGenerator$3(function* (element) {
12770
12848
  brickRef.current = element;
12771
12849
 
12772
12850
  if (element) {
@@ -14424,7 +14502,7 @@ function fetchProviderArgs(_x, _x2) {
14424
14502
  }
14425
14503
 
14426
14504
  function _fetchProviderArgs() {
14427
- _fetchProviderArgs = _asyncToGenerator$4(function* (provider, args) {
14505
+ _fetchProviderArgs = _asyncToGenerator$3(function* (provider, args) {
14428
14506
  for (var _len = arguments.length, originalArgs = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
14429
14507
  originalArgs[_key - 2] = arguments[_key];
14430
14508
  }
@@ -14448,7 +14526,7 @@ function fetch(_x) {
14448
14526
  }
14449
14527
 
14450
14528
  function _fetch() {
14451
- _fetch = _asyncToGenerator$4(function* (provider) {
14529
+ _fetch = _asyncToGenerator$3(function* (provider) {
14452
14530
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14453
14531
  args[_key - 1] = arguments[_key];
14454
14532
  }
@@ -14462,7 +14540,7 @@ function _fetch() {
14462
14540
  if (cache.has(cacheKey)) {
14463
14541
  promise = cache.get(cacheKey);
14464
14542
  } else {
14465
- promise = _asyncToGenerator$4(function* () {
14543
+ promise = _asyncToGenerator$3(function* () {
14466
14544
  if (!isCustomApiProvider(provider)) {
14467
14545
  var providerBrick = yield _internalApiGetProviderBrick(provider);
14468
14546
  var providerTagName = providerBrick.tagName.toLowerCase();
@@ -14509,7 +14587,7 @@ function useProvider() {
14509
14587
  var data = useRef(defaults.data);
14510
14588
  var forceUpdate = useReducer(() => ({}), [])[1];
14511
14589
  var doFetch = useCallback( /*#__PURE__*/function () {
14512
- var _ref = _asyncToGenerator$4(function* (provider) {
14590
+ var _ref = _asyncToGenerator$3(function* (provider) {
14513
14591
  try {
14514
14592
  error.current = undefined;
14515
14593
  if (!suspense) setLoading(true);
@@ -14535,7 +14613,7 @@ function useProvider() {
14535
14613
  };
14536
14614
  }(), [provider, customOptions, dependencies, requestInit, suspense, transform, defaults.data, onError]);
14537
14615
  var makeFetch = useCallback( /*#__PURE__*/function () {
14538
- var _ref2 = _asyncToGenerator$4(function* (providerOrBody, args) {
14616
+ var _ref2 = _asyncToGenerator$3(function* (providerOrBody, args) {
14539
14617
  var providerStr = provider;
14540
14618
  var providerArgs = [];
14541
14619
 
@@ -14552,7 +14630,7 @@ function useProvider() {
14552
14630
  var actualArgs = yield fetchProviderArgs(providerStr, providerArgs, requestInit.options);
14553
14631
 
14554
14632
  if (suspense) {
14555
- return _asyncToGenerator$4(function* () {
14633
+ return _asyncToGenerator$3(function* () {
14556
14634
  suspender.current = doFetch(providerStr, ...actualArgs).then(newData => {
14557
14635
  suspenseStatus.current = "success";
14558
14636
  return newData;