@next-core/brick-kit 2.129.3 → 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
  }
@@ -5777,7 +5831,7 @@ function startPoll(task, _ref, _ref2) {
5777
5831
  }
5778
5832
 
5779
5833
  function _poll() {
5780
- _poll = _asyncToGenerator$4(function* () {
5834
+ _poll = _asyncToGenerator$3(function* () {
5781
5835
  timeoutIdList.delete(currentTimeoutId);
5782
5836
  var shouldStop;
5783
5837
 
@@ -5856,7 +5910,7 @@ function clearPollTimeout() {
5856
5910
 
5857
5911
 
5858
5912
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5859
- var _ref = _asyncToGenerator$4(function* (options) {
5913
+ var _ref = _asyncToGenerator$3(function* (options) {
5860
5914
  return (
5861
5915
  /**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5862
5916
  (yield http.get("api/v1/runtime_standalone", options)).data
@@ -5874,7 +5928,7 @@ var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5874
5928
 
5875
5929
 
5876
5930
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5877
- var _ref = _asyncToGenerator$4(function* (params, options) {
5931
+ var _ref = _asyncToGenerator$3(function* (params, options) {
5878
5932
  return (
5879
5933
  /**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5880
5934
  (yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
@@ -5894,7 +5948,7 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5894
5948
 
5895
5949
 
5896
5950
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5897
- var _ref = _asyncToGenerator$4(function* (appId, params, options) {
5951
+ var _ref = _asyncToGenerator$3(function* (appId, params, options) {
5898
5952
  return (
5899
5953
  /**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5900
5954
  (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
@@ -5914,7 +5968,7 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5914
5968
 
5915
5969
 
5916
5970
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5917
- var _ref = _asyncToGenerator$4(function* (data, options) {
5971
+ var _ref = _asyncToGenerator$3(function* (data, options) {
5918
5972
  return (
5919
5973
  /**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5920
5974
  (yield http.post("api/contract/single_search", data, options)).data
@@ -5947,7 +6001,7 @@ function getArgsOfCustomApi(_x, _x2) {
5947
6001
  }
5948
6002
 
5949
6003
  function _getArgsOfCustomApi() {
5950
- _getArgsOfCustomApi = _asyncToGenerator$4(function* (provider, originalArgs) {
6004
+ _getArgsOfCustomApi = _asyncToGenerator$3(function* (provider, originalArgs) {
5951
6005
  if (!isCustomApiProvider(provider)) {
5952
6006
  return originalArgs;
5953
6007
  }
@@ -6063,7 +6117,7 @@ function _fetchFlowApiDefinition(_x3) {
6063
6117
  }
6064
6118
 
6065
6119
  function _fetchFlowApiDefinition2() {
6066
- _fetchFlowApiDefinition2 = _asyncToGenerator$4(function* (provider) {
6120
+ _fetchFlowApiDefinition2 = _asyncToGenerator$3(function* (provider) {
6067
6121
  var [namespaceName, nameWithVersion] = provider.split("@");
6068
6122
  var [name, version] = nameWithVersion.split(":");
6069
6123
  var contract;
@@ -6320,7 +6374,7 @@ function listenerFactory(handler, context, runtimeBrick) {
6320
6374
 
6321
6375
  function usingProviderFactory(handler, context, runtimeBrick) {
6322
6376
  return /*#__PURE__*/function () {
6323
- var _ref2 = _asyncToGenerator$4(function* (event) {
6377
+ var _ref2 = _asyncToGenerator$3(function* (event) {
6324
6378
  if (!looseCheckIf(handler, _objectSpread(_objectSpread({}, context), {}, {
6325
6379
  event
6326
6380
  }))) {
@@ -6597,7 +6651,7 @@ function brickCallback(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {
6597
6651
  }
6598
6652
 
6599
6653
  function _brickCallback() {
6600
- _brickCallback = _asyncToGenerator$4(function* (target, handler, method, context, runtimeBrick, event, options) {
6654
+ _brickCallback = _asyncToGenerator$3(function* (target, handler, method, context, runtimeBrick, event, options) {
6601
6655
  var _handler$callback, _poll;
6602
6656
 
6603
6657
  if (typeof target[method] !== "function") {
@@ -6610,7 +6664,7 @@ function _brickCallback() {
6610
6664
  }
6611
6665
 
6612
6666
  var task = /*#__PURE__*/function () {
6613
- var _ref3 = _asyncToGenerator$4(function* () {
6667
+ var _ref3 = _asyncToGenerator$3(function* () {
6614
6668
  var computedArgs = argsFactory(handler.args, context, event, options);
6615
6669
 
6616
6670
  if (isUseProviderHandler(handler)) {
@@ -6966,7 +7020,7 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
6966
7020
 
6967
7021
 
6968
7022
  var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6969
- var _ref = _asyncToGenerator$4(function* (appId, options) {
7023
+ var _ref = _asyncToGenerator$3(function* (appId, options) {
6970
7024
  return (
6971
7025
  /**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
6972
7026
  (yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
@@ -6984,7 +7038,7 @@ var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6984
7038
 
6985
7039
 
6986
7040
  var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
6987
- var _ref = _asyncToGenerator$4(function* (data, options) {
7041
+ var _ref = _asyncToGenerator$3(function* (data, options) {
6988
7042
  return (
6989
7043
  /**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
6990
7044
  (yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
@@ -7134,7 +7188,7 @@ function CustomApi(_x) {
7134
7188
  }
7135
7189
 
7136
7190
  function _CustomApi() {
7137
- _CustomApi = _asyncToGenerator$4(function* (_ref2) {
7191
+ _CustomApi = _asyncToGenerator$3(function* (_ref2) {
7138
7192
  var {
7139
7193
  url,
7140
7194
  method = "GET",
@@ -7195,7 +7249,7 @@ function standaloneBootstrap() {
7195
7249
  }
7196
7250
 
7197
7251
  function _standaloneBootstrap() {
7198
- _standaloneBootstrap = _asyncToGenerator$4(function* () {
7252
+ _standaloneBootstrap = _asyncToGenerator$3(function* () {
7199
7253
  var [bootstrapResult, confString, runtimeData] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
7200
7254
  responseType: "text"
7201
7255
  }), yield BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
@@ -8258,7 +8312,7 @@ function asyncExpandCustomTemplate(_x, _x2, _x3) {
8258
8312
  }
8259
8313
 
8260
8314
  function _asyncExpandCustomTemplate() {
8261
- _asyncExpandCustomTemplate = _asyncToGenerator$4(function* (brickConf, proxyBrick, context) {
8315
+ _asyncExpandCustomTemplate = _asyncToGenerator$3(function* (brickConf, proxyBrick, context) {
8262
8316
  var tplContext = new CustomTemplateContext(proxyBrick);
8263
8317
  var template = customTemplateRegistry.get(brickConf.brick);
8264
8318
 
@@ -8759,7 +8813,7 @@ class Kernel {
8759
8813
  _defineProperty$1(this, "loadMagicBrickConfigStarted", false);
8760
8814
 
8761
8815
  _defineProperty$1(this, "_loadDepsOfStoryboard", /*#__PURE__*/function () {
8762
- var _ref = _asyncToGenerator$4(function* (storyboard) {
8816
+ var _ref = _asyncToGenerator$3(function* (storyboard) {
8763
8817
  var {
8764
8818
  brickPackages,
8765
8819
  templatePackages
@@ -8794,7 +8848,7 @@ class Kernel {
8794
8848
  }());
8795
8849
 
8796
8850
  _defineProperty$1(this, "_loadDynamicBricks", /*#__PURE__*/function () {
8797
- var _ref2 = _asyncToGenerator$4(function* (bricks, processors) {
8851
+ var _ref2 = _asyncToGenerator$3(function* (bricks, processors) {
8798
8852
  var filteredBricks = bricks.filter( // Only try to load undefined custom elements.
8799
8853
  item => !customElements.get(item)); // Try to load deps for dynamic added bricks.
8800
8854
 
@@ -8816,7 +8870,7 @@ class Kernel {
8816
8870
  }());
8817
8871
 
8818
8872
  _defineProperty$1(this, "_loadEditorBricks", /*#__PURE__*/function () {
8819
- var _ref3 = _asyncToGenerator$4(function* (editorBricks) {
8873
+ var _ref3 = _asyncToGenerator$3(function* (editorBricks) {
8820
8874
  var {
8821
8875
  dll,
8822
8876
  deps
@@ -8837,7 +8891,7 @@ class Kernel {
8837
8891
  bootstrap(mountPoints) {
8838
8892
  var _this2 = this;
8839
8893
 
8840
- return _asyncToGenerator$4(function* () {
8894
+ return _asyncToGenerator$3(function* () {
8841
8895
  var _this2$bootstrapData$, _this2$bootstrapData$2;
8842
8896
 
8843
8897
  listenDevtoolsEagerly();
@@ -8872,7 +8926,7 @@ class Kernel {
8872
8926
  layoutBootstrap(layout) {
8873
8927
  var _this3 = this;
8874
8928
 
8875
- return _asyncToGenerator$4(function* () {
8929
+ return _asyncToGenerator$3(function* () {
8876
8930
  var supportedLayouts = ["console", "business"];
8877
8931
 
8878
8932
  if (!supportedLayouts.includes(layout)) {
@@ -8924,7 +8978,7 @@ class Kernel {
8924
8978
  }
8925
8979
 
8926
8980
  loadCheckLogin() {
8927
- return _asyncToGenerator$4(function* () {
8981
+ return _asyncToGenerator$3(function* () {
8928
8982
  if (!window.NO_AUTH_GUARD) {
8929
8983
  var auth = yield checkLogin();
8930
8984
 
@@ -8938,7 +8992,7 @@ class Kernel {
8938
8992
  loadMicroApps(params, interceptorParams) {
8939
8993
  var _this4 = this;
8940
8994
 
8941
- return _asyncToGenerator$4(function* () {
8995
+ return _asyncToGenerator$3(function* () {
8942
8996
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
8943
8997
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons",
8944
8998
  ignoreTemplateFields: "templates",
@@ -8969,7 +9023,7 @@ class Kernel {
8969
9023
  fulfilStoryboard(storyboard) {
8970
9024
  var _this5 = this;
8971
9025
 
8972
- return _asyncToGenerator$4(function* () {
9026
+ return _asyncToGenerator$3(function* () {
8973
9027
  if (storyboard.$$fulfilled) {
8974
9028
  return;
8975
9029
  }
@@ -8985,10 +9039,11 @@ class Kernel {
8985
9039
  doFulfilStoryboard(storyboard) {
8986
9040
  var _this6 = this;
8987
9041
 
8988
- return _asyncToGenerator$4(function* () {
9042
+ return _asyncToGenerator$3(function* () {
8989
9043
  if (window.STANDALONE_MICRO_APPS) {
8990
9044
  Object.assign(storyboard, {
8991
- $$fulfilled: true
9045
+ $$fulfilled: true,
9046
+ $$fulfilling: null
8992
9047
  });
8993
9048
 
8994
9049
  if (!window.NO_AUTH_GUARD) {
@@ -9021,7 +9076,8 @@ class Kernel {
9021
9076
  routes,
9022
9077
  meta,
9023
9078
  app: _objectSpread(_objectSpread({}, storyboard.app), app),
9024
- $$fulfilled: true
9079
+ $$fulfilled: true,
9080
+ $$fulfilling: null
9025
9081
  });
9026
9082
  }
9027
9083
 
@@ -9030,9 +9086,12 @@ class Kernel {
9030
9086
  }
9031
9087
 
9032
9088
  postProcessStoryboard(storyboard) {
9033
- var _storyboard$meta;
9034
-
9035
9089
  storyboard.app.$$routeAliasMap = scanRouteAliasInStoryboard(storyboard);
9090
+ this.postProcessStoryboardI18n(storyboard);
9091
+ }
9092
+
9093
+ postProcessStoryboardI18n(storyboard) {
9094
+ var _storyboard$meta;
9036
9095
 
9037
9096
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
9038
9097
  // Prefix to avoid conflict between brick package's i18n namespace.
@@ -9045,10 +9104,70 @@ class Kernel {
9045
9104
  }
9046
9105
  }
9047
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
+
9048
9167
  _dev_only_updateStoryboard(appId, storyboardPatch) {
9049
9168
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9050
9169
  Object.assign(storyboard, _objectSpread(_objectSpread({}, storyboardPatch), {}, {
9051
- $$fulfilling: Promise.resolve(),
9170
+ $$fulfilling: null,
9052
9171
  $$fulfilled: true,
9053
9172
  $$registerCustomTemplateProcessed: false,
9054
9173
  $$depsProcessed: false
@@ -9171,9 +9290,9 @@ class Kernel {
9171
9290
 
9172
9291
  gracefullyLoadDeps(fn) {
9173
9292
  var _arguments = arguments,
9174
- _this7 = this;
9293
+ _this8 = this;
9175
9294
 
9176
- return _asyncToGenerator$4(function* () {
9295
+ return _asyncToGenerator$3(function* () {
9177
9296
  for (var _len = _arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9178
9297
  args[_key - 1] = _arguments[_key];
9179
9298
  }
@@ -9185,7 +9304,7 @@ class Kernel {
9185
9304
  // The scripts maybe stale when a user stays in page while upgrades been applied.
9186
9305
  // So we force reloading again automatically.
9187
9306
  // NOTE: reload only once to avoid a infinite loop.
9188
- yield _this7.reloadMicroApps();
9307
+ yield _this8.reloadMicroApps();
9189
9308
  yield fn(...args);
9190
9309
  } else {
9191
9310
  throw e;
@@ -9234,15 +9353,15 @@ class Kernel {
9234
9353
  }
9235
9354
 
9236
9355
  loadDynamicBricksInBrickConf(brickConf) {
9237
- var _this8 = this;
9356
+ var _this9 = this;
9238
9357
 
9239
- return _asyncToGenerator$4(function* () {
9358
+ return _asyncToGenerator$3(function* () {
9240
9359
  // Notice: `brickConf` contains runtime data,
9241
9360
  // which may contains recursive ref,
9242
9361
  // which could cause stack overflow while traversing.
9243
9362
  var bricks = scanBricksInBrickConf(brickConf);
9244
9363
  var processors = scanProcessorsInAny(brickConf);
9245
- yield _this8.loadDynamicBricks(bricks, processors);
9364
+ yield _this9.loadDynamicBricks(bricks, processors);
9246
9365
  })();
9247
9366
  }
9248
9367
 
@@ -9314,7 +9433,7 @@ class Kernel {
9314
9433
  }
9315
9434
 
9316
9435
  loadUsers() {
9317
- return _asyncToGenerator$4(function* () {
9436
+ return _asyncToGenerator$3(function* () {
9318
9437
  var allUserMap = new Map();
9319
9438
 
9320
9439
  try {
@@ -9351,15 +9470,15 @@ class Kernel {
9351
9470
  }
9352
9471
 
9353
9472
  getMicroAppApiOrchestrationMapAsync() {
9354
- var _this9 = this;
9473
+ var _this10 = this;
9355
9474
 
9356
- return _asyncToGenerator$4(function* () {
9357
- return yield _this9.allMicroAppApiOrchestrationPromise;
9475
+ return _asyncToGenerator$3(function* () {
9476
+ return yield _this10.allMicroAppApiOrchestrationPromise;
9358
9477
  })();
9359
9478
  }
9360
9479
 
9361
9480
  loadMicroAppApiOrchestration(usedCustomApis) {
9362
- return _asyncToGenerator$4(function* () {
9481
+ return _asyncToGenerator$3(function* () {
9363
9482
  var allMicroAppApiOrchestrationMap = new Map();
9364
9483
  var legacyCustomApis = usedCustomApis.filter(item => !item.name.includes(":"));
9365
9484
 
@@ -9401,7 +9520,7 @@ class Kernel {
9401
9520
  }
9402
9521
 
9403
9522
  loadMagicBrickConfig() {
9404
- return _asyncToGenerator$4(function* () {
9523
+ return _asyncToGenerator$3(function* () {
9405
9524
  var allMagicBrickConfigMap = new Map();
9406
9525
 
9407
9526
  try {
@@ -9431,7 +9550,7 @@ class Kernel {
9431
9550
  }
9432
9551
 
9433
9552
  loadRelatedApps() {
9434
- return _asyncToGenerator$4(function* () {
9553
+ return _asyncToGenerator$3(function* () {
9435
9554
  var relatedApps = [];
9436
9555
 
9437
9556
  try {
@@ -9446,14 +9565,14 @@ class Kernel {
9446
9565
  }
9447
9566
 
9448
9567
  getRelatedAppsAsync(appId) {
9449
- var _this10 = this;
9568
+ var _this11 = this;
9450
9569
 
9451
- return _asyncToGenerator$4(function* () {
9570
+ return _asyncToGenerator$3(function* () {
9452
9571
  if (!appId) {
9453
9572
  return [];
9454
9573
  }
9455
9574
 
9456
- var allRelatedApps = yield _this10.allRelatedAppsPromise;
9575
+ var allRelatedApps = yield _this11.allRelatedAppsPromise;
9457
9576
  var thisApp = allRelatedApps.find(item => item.microAppId === appId);
9458
9577
 
9459
9578
  if (!thisApp) {
@@ -9465,38 +9584,38 @@ class Kernel {
9465
9584
  }
9466
9585
 
9467
9586
  updateWorkspaceStack() {
9468
- var _this11 = this;
9587
+ var _this12 = this;
9469
9588
 
9470
- return _asyncToGenerator$4(function* () {
9471
- if (_this11.currentApp && _this11.currentApp.id) {
9589
+ return _asyncToGenerator$3(function* () {
9590
+ if (_this12.currentApp && _this12.currentApp.id) {
9472
9591
  var workspace = {
9473
- appId: _this11.currentApp.id,
9474
- appName: _this11.currentApp.name,
9475
- appLocaleName: _this11.currentApp.localeName,
9476
- url: _this11.currentUrl
9592
+ appId: _this12.currentApp.id,
9593
+ appName: _this12.currentApp.name,
9594
+ appLocaleName: _this12.currentApp.localeName,
9595
+ url: _this12.currentUrl
9477
9596
  };
9478
9597
 
9479
- if (_this11.workspaceStack.length > 0) {
9480
- var previousWorkspace = _this11.workspaceStack[_this11.workspaceStack.length - 1];
9598
+ if (_this12.workspaceStack.length > 0) {
9599
+ var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
9481
9600
 
9482
- var _relatedApps = yield _this11.getRelatedAppsAsync(previousWorkspace.appId);
9601
+ var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
9483
9602
 
9484
- if (_relatedApps.some(item => item.microAppId === _this11.currentApp.id)) {
9603
+ if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
9485
9604
  Object.assign(previousWorkspace, workspace);
9486
9605
  return;
9487
9606
  }
9488
9607
  }
9489
9608
 
9490
- var relatedApps = yield _this11.getRelatedAppsAsync(_this11.currentApp.id);
9609
+ var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
9491
9610
 
9492
9611
  if (relatedApps.length > 0) {
9493
- _this11.workspaceStack.push(workspace);
9612
+ _this12.workspaceStack.push(workspace);
9494
9613
 
9495
9614
  return;
9496
9615
  }
9497
9616
  }
9498
9617
 
9499
- _this11.workspaceStack = [];
9618
+ _this12.workspaceStack = [];
9500
9619
  })();
9501
9620
  }
9502
9621
 
@@ -9543,22 +9662,22 @@ class Kernel {
9543
9662
  }
9544
9663
 
9545
9664
  getProviderBrick(provider) {
9546
- var _this12 = this;
9665
+ var _this13 = this;
9547
9666
 
9548
- return _asyncToGenerator$4(function* () {
9667
+ return _asyncToGenerator$3(function* () {
9549
9668
  if (isCustomApiProvider(provider)) {
9550
9669
  provider = CUSTOM_API_PROVIDER;
9551
9670
  }
9552
9671
 
9553
- if (_this12.providerRepository.has(provider)) {
9554
- return _this12.providerRepository.get(provider);
9672
+ if (_this13.providerRepository.has(provider)) {
9673
+ return _this13.providerRepository.get(provider);
9555
9674
  }
9556
9675
 
9557
9676
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
9558
9677
  registerCustomApi();
9559
9678
  }
9560
9679
 
9561
- yield _this12.loadDynamicBricks([provider]);
9680
+ yield _this13.loadDynamicBricks([provider]);
9562
9681
 
9563
9682
  if (!customElements.get(provider)) {
9564
9683
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -9566,7 +9685,7 @@ class Kernel {
9566
9685
 
9567
9686
  var brick = document.createElement(provider);
9568
9687
 
9569
- _this12.providerRepository.set(provider, brick);
9688
+ _this13.providerRepository.set(provider, brick);
9570
9689
 
9571
9690
  return brick;
9572
9691
  })();
@@ -9580,7 +9699,7 @@ function loadScriptOfDll(_x5) {
9580
9699
  }
9581
9700
 
9582
9701
  function _loadScriptOfDll() {
9583
- _loadScriptOfDll = _asyncToGenerator$4(function* (dlls) {
9702
+ _loadScriptOfDll = _asyncToGenerator$3(function* (dlls) {
9584
9703
  if (dlls.some(dll => dll.startsWith("dll-of-editor-bricks-helper."))) {
9585
9704
  var dllPath = window.DLL_PATH || {};
9586
9705
  yield loadScript(dllPath["react-dnd"], window.CORE_ROOT);
@@ -9738,44 +9857,6 @@ function isRouteConfOfRoutes(conf) {
9738
9857
  return conf.type === "routes";
9739
9858
  }
9740
9859
 
9741
- var misc;
9742
- function getRuntimeMisc() {
9743
- if (!misc) {
9744
- misc = {
9745
- isInIframe: false,
9746
- isInIframeOfSameSite: false,
9747
- isInIframeOfNext: false,
9748
- isInIframeOfVisualBuilder: false,
9749
- isInIframeOfLegacyConsole: false
9750
- };
9751
-
9752
- if (window !== window.parent) {
9753
- misc.isInIframe = true;
9754
-
9755
- try {
9756
- // Handle:
9757
- // - Previewing in visual builder by iframe.
9758
- // - Nesting next in next.
9759
- // - Nesting console in next.
9760
- if (window.origin === window.parent.origin) {
9761
- misc.isInIframeOfSameSite = true;
9762
- var selfIsNext = getBasePath() === "/next/";
9763
- var parentPathname = window.parent.location.pathname;
9764
- var parentIsNext = parentPathname.startsWith("/next/");
9765
- misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
9766
- misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
9767
- misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
9768
- }
9769
- } catch (e) {// do nothing
9770
- }
9771
- }
9772
-
9773
- Object.freeze(misc);
9774
- }
9775
-
9776
- return misc;
9777
- }
9778
-
9779
9860
  function getSubStoryboardByRoute(storyboard, matcher) {
9780
9861
  function getSubRoutes(routes) {
9781
9862
  return matcher(routes).map(getSubRoute);
@@ -10366,7 +10447,7 @@ class LocationContext {
10366
10447
  mountRoutes(routes, slotId, mountRoutesResult) {
10367
10448
  var _this = this;
10368
10449
 
10369
- return _asyncToGenerator$4(function* () {
10450
+ return _asyncToGenerator$3(function* () {
10370
10451
  var matched = _this.matchRoutes(routes, _this.kernel.nextApp);
10371
10452
 
10372
10453
  var redirect;
@@ -10451,7 +10532,7 @@ class LocationContext {
10451
10532
  mountMenu(menuConf, match, mountRoutesResult) {
10452
10533
  var _this2 = this;
10453
10534
 
10454
- return _asyncToGenerator$4(function* () {
10535
+ return _asyncToGenerator$3(function* () {
10455
10536
  if (menuConf === false) {
10456
10537
  // `route.menu` 设置为 `false` 表示不显示顶栏和侧栏。
10457
10538
  mountRoutesResult.flags.barsHidden = true;
@@ -10541,7 +10622,7 @@ class LocationContext {
10541
10622
  mountProviders(providers, match, slotId, mountRoutesResult) {
10542
10623
  var _this3 = this;
10543
10624
 
10544
- return _asyncToGenerator$4(function* () {
10625
+ return _asyncToGenerator$3(function* () {
10545
10626
  if (Array.isArray(providers)) {
10546
10627
  for (var providerConf of providers) {
10547
10628
  yield _this3.mountBrick(_objectSpread(_objectSpread({}, typeof providerConf === "string" ? {
@@ -10558,7 +10639,7 @@ class LocationContext {
10558
10639
  mountBricks(bricks, match, slotId, mountRoutesResult, tplStack) {
10559
10640
  var _this4 = this;
10560
10641
 
10561
- return _asyncToGenerator$4(function* () {
10642
+ return _asyncToGenerator$3(function* () {
10562
10643
  for (var brickConf of bricks) {
10563
10644
  try {
10564
10645
  yield _this4.mountBrick(brickConf, match, slotId, mountRoutesResult, tplStack === null || tplStack === void 0 ? void 0 : tplStack.slice());
@@ -10592,7 +10673,7 @@ class LocationContext {
10592
10673
  checkResolvableIf(ifContainer, context) {
10593
10674
  var _this5 = this;
10594
10675
 
10595
- return _asyncToGenerator$4(function* () {
10676
+ return _asyncToGenerator$3(function* () {
10596
10677
  if (isObject(ifContainer.if)) {
10597
10678
  var ifChecked = computeRealValue(ifContainer.if, context, true);
10598
10679
  var ifConf = {};
@@ -10605,7 +10686,7 @@ class LocationContext {
10605
10686
  }
10606
10687
 
10607
10688
  preCheckPermissions(container, context) {
10608
- return _asyncToGenerator$4(function* () {
10689
+ return _asyncToGenerator$3(function* () {
10609
10690
  if (isLoggedIn() && !getAuth().isAdmin && container.permissionsPreCheck && Array.isArray(container.permissionsPreCheck)) {
10610
10691
  var usedActions = computeRealValue(container.permissionsPreCheck, context, true);
10611
10692
  yield validatePermissions(usedActions);
@@ -10617,7 +10698,7 @@ class LocationContext {
10617
10698
  var _arguments = arguments,
10618
10699
  _this6 = this;
10619
10700
 
10620
- return _asyncToGenerator$4(function* () {
10701
+ return _asyncToGenerator$3(function* () {
10621
10702
  var _this6$kernel$nextApp, _brickConf$lifeCycle, _brick$lifeCycle;
10622
10703
 
10623
10704
  var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
@@ -10955,7 +11036,7 @@ class LocationContext {
10955
11036
  preFetchMenu(data) {
10956
11037
  var _this7 = this;
10957
11038
 
10958
- return _asyncToGenerator$4(function* () {
11039
+ return _asyncToGenerator$3(function* () {
10959
11040
  var useMenus = scanAppGetMenuInAny(data);
10960
11041
 
10961
11042
  if (useMenus.length) {
@@ -11054,7 +11135,7 @@ function makeProviderRefreshable(providerBrick) {
11054
11135
  // },
11055
11136
  $refresh: {
11056
11137
  value: function () {
11057
- var _ref = _asyncToGenerator$4(function* () {
11138
+ var _ref = _asyncToGenerator$3(function* () {
11058
11139
  var {
11059
11140
  ignoreErrors,
11060
11141
  throwErrors,
@@ -11069,7 +11150,7 @@ function makeProviderRefreshable(providerBrick) {
11069
11150
 
11070
11151
  try {
11071
11152
  yield Promise.all(this.$$dependents.map( /*#__PURE__*/function () {
11072
- var _ref3 = _asyncToGenerator$4(function* (_ref2) {
11153
+ var _ref3 = _asyncToGenerator$3(function* (_ref2) {
11073
11154
  var {
11074
11155
  brick,
11075
11156
  method,
@@ -11105,7 +11186,7 @@ function makeProviderRefreshable(providerBrick) {
11105
11186
  }
11106
11187
 
11107
11188
  function _fetchData() {
11108
- _fetchData = _asyncToGenerator$4(function* () {
11189
+ _fetchData = _asyncToGenerator$3(function* () {
11109
11190
  var value = yield promise;
11110
11191
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11111
11192
 
@@ -11201,7 +11282,7 @@ class Resolver {
11201
11282
  resolve(brickConf, brick, context) {
11202
11283
  var _this = this;
11203
11284
 
11204
- return _asyncToGenerator$4(function* () {
11285
+ return _asyncToGenerator$3(function* () {
11205
11286
  var _brickConf$lifeCycle$, _brickConf$lifeCycle;
11206
11287
 
11207
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 => {
@@ -11222,7 +11303,7 @@ class Resolver {
11222
11303
  resolveOne(type, resolveConf, conf, brick, context) {
11223
11304
  var _this2 = this;
11224
11305
 
11225
- return _asyncToGenerator$4(function* () {
11306
+ return _asyncToGenerator$3(function* () {
11226
11307
  var brickConf = conf;
11227
11308
  var propsReference = conf;
11228
11309
  var actualResolveConf;
@@ -11313,7 +11394,7 @@ class Resolver {
11313
11394
  } else {
11314
11395
  var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
11315
11396
  : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
11316
- promise = _asyncToGenerator$4(function* () {
11397
+ promise = _asyncToGenerator$3(function* () {
11317
11398
  if (useProvider) {
11318
11399
  actualArgs = yield getArgsOfCustomApi(useProvider, actualArgs);
11319
11400
  }
@@ -11346,7 +11427,7 @@ class Resolver {
11346
11427
  }
11347
11428
 
11348
11429
  function _fetchData() {
11349
- _fetchData = _asyncToGenerator$4(function* () {
11430
+ _fetchData = _asyncToGenerator$3(function* () {
11350
11431
  var value = yield promise;
11351
11432
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11352
11433
 
@@ -11387,7 +11468,7 @@ class Resolver {
11387
11468
 
11388
11469
  var _loop = function (providerBrick, interval) {
11389
11470
  var request = /*#__PURE__*/function () {
11390
- var _ref2 = _asyncToGenerator$4(function* () {
11471
+ var _ref2 = _asyncToGenerator$3(function* () {
11391
11472
  yield providerBrick.$refresh({
11392
11473
  ignoreErrors: interval.ignoreErrors,
11393
11474
  throwErrors: true,
@@ -11504,7 +11585,7 @@ function preFetchStandaloneInstalledApps(_x) {
11504
11585
  }
11505
11586
 
11506
11587
  function _preFetchStandaloneInstalledApps() {
11507
- _preFetchStandaloneInstalledApps = _asyncToGenerator$4(function* (storyboard) {
11588
+ _preFetchStandaloneInstalledApps = _asyncToGenerator$3(function* (storyboard) {
11508
11589
  var saIds = scanInstalledAppsInStoryboard(storyboard);
11509
11590
  yield fetchStandaloneApps(saIds);
11510
11591
  });
@@ -11516,7 +11597,7 @@ function fetchStandaloneApps(_x2) {
11516
11597
  }
11517
11598
 
11518
11599
  function _fetchStandaloneApps() {
11519
- _fetchStandaloneApps = _asyncToGenerator$4(function* (saIds) {
11600
+ _fetchStandaloneApps = _asyncToGenerator$3(function* (saIds) {
11520
11601
  // ignore apps which are already searched
11521
11602
  var searchIds = difference(saIds, Array.from(appIdSet));
11522
11603
 
@@ -11671,14 +11752,14 @@ class Router {
11671
11752
  bootstrap() {
11672
11753
  var _this = this;
11673
11754
 
11674
- return _asyncToGenerator$4(function* () {
11755
+ return _asyncToGenerator$3(function* () {
11675
11756
  var history = getHistory();
11676
11757
  _this.prevLocation = history.location;
11677
11758
 
11678
11759
  _this.locationChangeNotify("", history.location.pathname);
11679
11760
 
11680
11761
  history.listen( /*#__PURE__*/function () {
11681
- var _ref = _asyncToGenerator$4(function* (location, action) {
11762
+ var _ref = _asyncToGenerator$3(function* (location, action) {
11682
11763
  var _this$prevLocation$st, _location$state;
11683
11764
 
11684
11765
  var ignoreRendering = false;
@@ -11740,7 +11821,7 @@ class Router {
11740
11821
  queuedRender(location) {
11741
11822
  var _this2 = this;
11742
11823
 
11743
- return _asyncToGenerator$4(function* () {
11824
+ return _asyncToGenerator$3(function* () {
11744
11825
  _this2.rendering = true;
11745
11826
 
11746
11827
  try {
@@ -11760,7 +11841,7 @@ class Router {
11760
11841
  render(location) {
11761
11842
  var _this3 = this;
11762
11843
 
11763
- return _asyncToGenerator$4(function* () {
11844
+ return _asyncToGenerator$3(function* () {
11764
11845
  var _apiAnalyzer$getInsta, _getLocalAppsTheme;
11765
11846
 
11766
11847
  _this3.state = "initial";
@@ -12521,7 +12602,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12521
12602
 
12522
12603
  return true;
12523
12604
  }, [useBrick, data]);
12524
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12605
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12525
12606
  if (!isBrickAvailable) {
12526
12607
  return null;
12527
12608
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12561,7 +12642,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12561
12642
  return brick;
12562
12643
  }), [useBrick, data, isBrickAvailable]);
12563
12644
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12564
- var _ref4 = _asyncToGenerator$4(function* (element) {
12645
+ var _ref4 = _asyncToGenerator$3(function* (element) {
12565
12646
  immediatelyRefCallback === null || immediatelyRefCallback === void 0 ? void 0 : immediatelyRefCallback(element);
12566
12647
 
12567
12648
  if (element) {
@@ -12723,7 +12804,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12723
12804
  useImperativeHandle(ref, () => {
12724
12805
  return brickRef.current;
12725
12806
  });
12726
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12807
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12727
12808
  if (!isBrickAvailable) {
12728
12809
  return null;
12729
12810
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12763,7 +12844,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12763
12844
  return brick;
12764
12845
  }), [useBrick, data, isBrickAvailable]);
12765
12846
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12766
- var _ref10 = _asyncToGenerator$4(function* (element) {
12847
+ var _ref10 = _asyncToGenerator$3(function* (element) {
12767
12848
  brickRef.current = element;
12768
12849
 
12769
12850
  if (element) {
@@ -14421,7 +14502,7 @@ function fetchProviderArgs(_x, _x2) {
14421
14502
  }
14422
14503
 
14423
14504
  function _fetchProviderArgs() {
14424
- _fetchProviderArgs = _asyncToGenerator$4(function* (provider, args) {
14505
+ _fetchProviderArgs = _asyncToGenerator$3(function* (provider, args) {
14425
14506
  for (var _len = arguments.length, originalArgs = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
14426
14507
  originalArgs[_key - 2] = arguments[_key];
14427
14508
  }
@@ -14445,7 +14526,7 @@ function fetch(_x) {
14445
14526
  }
14446
14527
 
14447
14528
  function _fetch() {
14448
- _fetch = _asyncToGenerator$4(function* (provider) {
14529
+ _fetch = _asyncToGenerator$3(function* (provider) {
14449
14530
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14450
14531
  args[_key - 1] = arguments[_key];
14451
14532
  }
@@ -14459,7 +14540,7 @@ function _fetch() {
14459
14540
  if (cache.has(cacheKey)) {
14460
14541
  promise = cache.get(cacheKey);
14461
14542
  } else {
14462
- promise = _asyncToGenerator$4(function* () {
14543
+ promise = _asyncToGenerator$3(function* () {
14463
14544
  if (!isCustomApiProvider(provider)) {
14464
14545
  var providerBrick = yield _internalApiGetProviderBrick(provider);
14465
14546
  var providerTagName = providerBrick.tagName.toLowerCase();
@@ -14506,7 +14587,7 @@ function useProvider() {
14506
14587
  var data = useRef(defaults.data);
14507
14588
  var forceUpdate = useReducer(() => ({}), [])[1];
14508
14589
  var doFetch = useCallback( /*#__PURE__*/function () {
14509
- var _ref = _asyncToGenerator$4(function* (provider) {
14590
+ var _ref = _asyncToGenerator$3(function* (provider) {
14510
14591
  try {
14511
14592
  error.current = undefined;
14512
14593
  if (!suspense) setLoading(true);
@@ -14532,7 +14613,7 @@ function useProvider() {
14532
14613
  };
14533
14614
  }(), [provider, customOptions, dependencies, requestInit, suspense, transform, defaults.data, onError]);
14534
14615
  var makeFetch = useCallback( /*#__PURE__*/function () {
14535
- var _ref2 = _asyncToGenerator$4(function* (providerOrBody, args) {
14616
+ var _ref2 = _asyncToGenerator$3(function* (providerOrBody, args) {
14536
14617
  var providerStr = provider;
14537
14618
  var providerArgs = [];
14538
14619
 
@@ -14549,7 +14630,7 @@ function useProvider() {
14549
14630
  var actualArgs = yield fetchProviderArgs(providerStr, providerArgs, requestInit.options);
14550
14631
 
14551
14632
  if (suspense) {
14552
- return _asyncToGenerator$4(function* () {
14633
+ return _asyncToGenerator$3(function* () {
14553
14634
  suspender.current = doFetch(providerStr, ...actualArgs).then(newData => {
14554
14635
  suspenseStatus.current = "success";
14555
14636
  return newData;