@next-core/brick-kit 2.129.3 → 2.131.1

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,10 +1,10 @@
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
- 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';
7
+ import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedState, trackUsedContext, 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';
8
8
  import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, merge, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
@@ -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 */
@@ -2005,7 +2041,7 @@ class StoryboardContextWrapper {
2005
2041
  }
2006
2042
 
2007
2043
  updateValue(name, value, method) {
2008
- var _item$eventTarget;
2044
+ var _item$eventTarget2;
2009
2045
 
2010
2046
  if (!this.data.has(name)) {
2011
2047
  if (this.tplContextId) {
@@ -2029,6 +2065,22 @@ class StoryboardContextWrapper {
2029
2065
  return;
2030
2066
  }
2031
2067
 
2068
+ if (method === "refresh") {
2069
+ if (!item.refresh) {
2070
+ throw new Error("You can not refresh the storyboard context \"".concat(name, "\" which has no resolve."));
2071
+ }
2072
+
2073
+ item.refresh().then(val => {
2074
+ var _item$eventTarget;
2075
+
2076
+ item.value = val;
2077
+ (_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
2078
+ detail: item.value
2079
+ }));
2080
+ }, handleHttpError);
2081
+ return;
2082
+ }
2083
+
2032
2084
  if (method === "replace") {
2033
2085
  item.value = value;
2034
2086
  } else {
@@ -2041,7 +2093,7 @@ class StoryboardContextWrapper {
2041
2093
  }
2042
2094
  }
2043
2095
 
2044
- (_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
2096
+ (_item$eventTarget2 = item.eventTarget) === null || _item$eventTarget2 === void 0 ? void 0 : _item$eventTarget2.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
2045
2097
  detail: item.value
2046
2098
  }));
2047
2099
  }
@@ -2049,7 +2101,7 @@ class StoryboardContextWrapper {
2049
2101
  define(contextConfs, coreContext, brick) {
2050
2102
  var _this = this;
2051
2103
 
2052
- return _asyncToGenerator$4(function* () {
2104
+ return _asyncToGenerator$3(function* () {
2053
2105
  if (Array.isArray(contextConfs)) {
2054
2106
  var {
2055
2107
  mergedContext,
@@ -2090,7 +2142,7 @@ function resolveStoryboardContext(_x, _x2, _x3, _x4) {
2090
2142
  }
2091
2143
 
2092
2144
  function _resolveStoryboardContext() {
2093
- _resolveStoryboardContext = _asyncToGenerator$4(function* (contextConf, coreContext, storyboardContextWrapper, brick) {
2145
+ _resolveStoryboardContext = _asyncToGenerator$3(function* (contextConf, coreContext, storyboardContextWrapper, brick) {
2094
2146
  if (contextConf.property) {
2095
2147
  if (storyboardContextWrapper.tplContextId) {
2096
2148
  throw new Error("Setting `property` is not allowed in template scoped context");
@@ -2117,35 +2169,70 @@ function resolveNormalStoryboardContext(_x5, _x6, _x7, _x8) {
2117
2169
  }
2118
2170
 
2119
2171
  function _resolveNormalStoryboardContext() {
2120
- _resolveNormalStoryboardContext = _asyncToGenerator$4(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
2172
+ _resolveNormalStoryboardContext = _asyncToGenerator$3(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
2121
2173
  if (!looseCheckIf(contextConf, mergedContext)) {
2122
2174
  return false;
2123
2175
  }
2124
2176
 
2125
- var isResolve = false;
2126
- var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
2177
+ var isTemplateState = !!storyboardContextWrapper.tplContextId;
2178
+ var value = getDefinedTemplateState(isTemplateState, contextConf, brick);
2179
+ var refresh = null;
2180
+ var isLazyResolve = false;
2127
2181
 
2128
2182
  if (value === undefined) {
2129
2183
  if (contextConf.resolve) {
2130
2184
  if (looseCheckIf(contextConf.resolve, mergedContext)) {
2131
- isResolve = true;
2132
- var valueConf = {};
2133
- yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
2134
- transform: "value",
2135
- transformMapArray: false
2136
- }, contextConf.resolve), valueConf, null, mergedContext);
2137
- value = valueConf.value;
2185
+ refresh = /*#__PURE__*/function () {
2186
+ var _ref = _asyncToGenerator$3(function* () {
2187
+ var valueConf = {};
2188
+ yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
2189
+ transform: "value",
2190
+ transformMapArray: false
2191
+ }, contextConf.resolve), valueConf, null, mergedContext);
2192
+ return valueConf.value;
2193
+ });
2194
+
2195
+ return function refresh() {
2196
+ return _ref.apply(this, arguments);
2197
+ };
2198
+ }();
2199
+
2200
+ isLazyResolve = contextConf.resolve.lazy;
2201
+
2202
+ if (!isLazyResolve) {
2203
+ value = yield refresh();
2204
+ }
2138
2205
  } else if (!hasOwnProperty(contextConf, "value")) {
2139
2206
  return false;
2140
2207
  }
2141
2208
  }
2142
2209
 
2143
- if (!isResolve && contextConf.value !== undefined) {
2210
+ if ((!refresh || isLazyResolve) && contextConf.value !== undefined) {
2211
+ // If the context has no resolve, just use its `value`.
2212
+ // Or if the resolve is ignored or lazy, use its `value` as a fallback.
2144
2213
  value = computeRealValue(contextConf.value, mergedContext, true);
2145
2214
  }
2215
+
2216
+ if (contextConf.track) {
2217
+ // Track its dependencies and auto update when each of them changed.
2218
+ var deps = (isTemplateState ? trackUsedState : trackUsedContext)(refresh ? contextConf.resolve : contextConf.value);
2219
+
2220
+ for (var dep of deps) {
2221
+ var _eventTarget;
2222
+
2223
+ var ctx = storyboardContextWrapper.get().get(dep);
2224
+ ctx === null || ctx === void 0 ? void 0 : (_eventTarget = ctx.eventTarget) === null || _eventTarget === void 0 ? void 0 : _eventTarget.addEventListener(isTemplateState ? "state.change" : "context.change", () => {
2225
+ if (refresh) {
2226
+ storyboardContextWrapper.updateValue(contextConf.name, undefined, "refresh");
2227
+ } else {
2228
+ storyboardContextWrapper.updateValue(contextConf.name, computeRealValue(contextConf.value, mergedContext, true), "replace");
2229
+ }
2230
+ });
2231
+ }
2232
+ }
2146
2233
  }
2147
2234
 
2148
- resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
2235
+ resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, refresh);
2149
2236
  return true;
2150
2237
  });
2151
2238
  return _resolveNormalStoryboardContext.apply(this, arguments);
@@ -2176,12 +2263,13 @@ function getDefinedTemplateState(isTemplateState, contextConf, brick) {
2176
2263
  }
2177
2264
  }
2178
2265
 
2179
- function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick) {
2266
+ function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, refresh) {
2180
2267
  var newContext = {
2181
2268
  type: "free-variable",
2182
2269
  value,
2183
2270
  // This is required for tracking context, even if no `onChange` is specified.
2184
- eventTarget: new EventTarget$1()
2271
+ eventTarget: new EventTarget$1(),
2272
+ refresh
2185
2273
  };
2186
2274
 
2187
2275
  if (contextConf.onChange) {
@@ -2978,7 +3066,8 @@ function getNextInternalOptions(internalOptions, isArray, key) {
2978
3066
  }
2979
3067
 
2980
3068
  var _excluded$6 = ["children"],
2981
- _excluded2$2 = ["items", "app"];
3069
+ _excluded2$2 = ["children"],
3070
+ _excluded3 = ["items", "app"];
2982
3071
  var symbolAppId = Symbol("appId");
2983
3072
  // Caching menu requests to avoid flicker.
2984
3073
  var menuCache = new Map();
@@ -2989,7 +3078,7 @@ function constructMenu(_x, _x2, _x3) {
2989
3078
  }
2990
3079
 
2991
3080
  function _constructMenu() {
2992
- _constructMenu = _asyncToGenerator$4(function* (menuBar, context, kernel) {
3081
+ _constructMenu = _asyncToGenerator$3(function* (menuBar, context, kernel) {
2993
3082
  var hasSubMenu = !!menuBar.subMenuId;
2994
3083
 
2995
3084
  if (menuBar.menuId) {
@@ -3019,7 +3108,7 @@ function preConstructMenus(_x4, _x5, _x6) {
3019
3108
  }
3020
3109
 
3021
3110
  function _preConstructMenus() {
3022
- _preConstructMenus = _asyncToGenerator$4(function* (menus, context, kernel) {
3111
+ _preConstructMenus = _asyncToGenerator$3(function* (menus, context, kernel) {
3023
3112
  var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3024
3113
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3025
3114
  });
@@ -3032,7 +3121,7 @@ function fetchMenuById(_x7, _x8, _x9) {
3032
3121
  }
3033
3122
 
3034
3123
  function _fetchMenuById() {
3035
- _fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel, isPreFetch) {
3124
+ _fetchMenuById = _asyncToGenerator$3(function* (menuId, kernel, isPreFetch) {
3036
3125
  if (menuCache.has(menuId)) {
3037
3126
  return menuCache.get(menuId);
3038
3127
  }
@@ -3138,7 +3227,7 @@ function loadDynamicMenuItems(_x10) {
3138
3227
  }
3139
3228
 
3140
3229
  function _loadDynamicMenuItems() {
3141
- _loadDynamicMenuItems = _asyncToGenerator$4(function* (menu) {
3230
+ _loadDynamicMenuItems = _asyncToGenerator$3(function* (menu) {
3142
3231
  if (menu.dynamicItems && menu.itemsResolve) {
3143
3232
  var itemsConf = {};
3144
3233
  yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
@@ -3156,16 +3245,19 @@ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3156
3245
  }
3157
3246
 
3158
3247
  function _processMenu() {
3159
- _processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3248
+ _processMenu = _asyncToGenerator$3(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3160
3249
  var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3161
3250
  {
3162
3251
  items,
3163
3252
  app
3164
3253
  } = _yield$fetchMenuById,
3165
- restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded2$2);
3254
+ restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded3);
3255
+
3256
+ var appIds = collectOverrideApps(items, app[0].appId, context.app.id);
3257
+ yield kernel.fulfilStoryboardI18n(appIds);
3166
3258
 
3167
- var menuData = _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3168
- items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
3259
+ var menuData = _objectSpread(_objectSpread({}, computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3260
+ items: computeMenuItemsWithOverrideApp(items, context, kernel)
3169
3261
  });
3170
3262
 
3171
3263
  return {
@@ -3197,31 +3289,53 @@ function _processMenu() {
3197
3289
  return _processMenu.apply(this, arguments);
3198
3290
  }
3199
3291
 
3200
- function computeMenuItemsWithOverrideApp(items, context, kernel) {
3201
- return Promise.all(items.map( /*#__PURE__*/function () {
3202
- var _ref2 = _asyncToGenerator$4(function* (_ref) {
3292
+ function collectOverrideApps(items, rootAppId, contextAppId) {
3293
+ var appIds = new Set();
3294
+
3295
+ if (rootAppId !== contextAppId) {
3296
+ appIds.add(rootAppId);
3297
+ }
3298
+
3299
+ function collect(items) {
3300
+ for (var _ref of items) {
3203
3301
  var {
3204
3302
  children
3205
3303
  } = _ref,
3206
3304
  rest = _objectWithoutProperties(_ref, _excluded$6);
3207
3305
 
3208
- return _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3209
- children: children && (yield computeMenuItemsWithOverrideApp(children, context, kernel))
3210
- });
3211
- });
3306
+ var overrideAppId = rest[symbolAppId];
3212
3307
 
3213
- return function (_x16) {
3214
- return _ref2.apply(this, arguments);
3215
- };
3216
- }()));
3308
+ if (overrideAppId !== contextAppId && !appIds.has(overrideAppId) && requireOverrideApp(rest)) {
3309
+ appIds.add(overrideAppId);
3310
+ }
3311
+
3312
+ children && collect(children);
3313
+ }
3314
+ }
3315
+
3316
+ collect(items);
3317
+ return [...appIds];
3217
3318
  }
3218
3319
 
3219
- function processMenuTitle(_x17) {
3320
+ function computeMenuItemsWithOverrideApp(items, context, kernel) {
3321
+ return items.map(_ref2 => {
3322
+ var {
3323
+ children
3324
+ } = _ref2,
3325
+ rest = _objectWithoutProperties(_ref2, _excluded2$2);
3326
+
3327
+ return _objectSpread(_objectSpread({}, computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3328
+ children: children && computeMenuItemsWithOverrideApp(children, context, kernel)
3329
+ });
3330
+ });
3331
+ }
3332
+
3333
+ function processMenuTitle(_x16) {
3220
3334
  return _processMenuTitle.apply(this, arguments);
3221
3335
  }
3222
3336
 
3223
3337
  function _processMenuTitle() {
3224
- _processMenuTitle = _asyncToGenerator$4(function* (menuData) {
3338
+ _processMenuTitle = _asyncToGenerator$3(function* (menuData) {
3225
3339
  if (menuData.title || isEmpty(menuData.titleDataSource)) {
3226
3340
  return menuData.title;
3227
3341
  }
@@ -3311,37 +3425,29 @@ function requireOverrideApp(data) {
3311
3425
  return false;
3312
3426
  }
3313
3427
 
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;
3428
+ function computeRealValueWithOverrideApp(data, overrideAppId, context, kernel) {
3429
+ var newContext = context;
3321
3430
 
3322
- if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3323
- var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3431
+ if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3432
+ var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3324
3433
 
3325
- if (storyboard) {
3326
- yield kernel.fulfilStoryboard(storyboard);
3327
- newContext = _objectSpread(_objectSpread({}, context), {}, {
3328
- overrideApp: storyboard.app
3329
- });
3330
- }
3434
+ if (storyboard) {
3435
+ newContext = _objectSpread(_objectSpread({}, context), {}, {
3436
+ overrideApp: storyboard.app
3437
+ });
3331
3438
  }
3439
+ }
3332
3440
 
3333
- return computeRealValue(data, newContext, true, {
3334
- ignoreSymbols: true
3335
- });
3441
+ return computeRealValue(data, newContext, true, {
3442
+ ignoreSymbols: true
3336
3443
  });
3337
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3338
3444
  }
3339
3445
 
3340
3446
  var lazyBrickRegistry = new Map();
3341
3447
  var requestsMap = new WeakMap();
3342
3448
  function registerLazyBricks(bricks, factory) {
3343
3449
  var factoryWrapper = /*#__PURE__*/function () {
3344
- var _ref = _asyncToGenerator$4(function* () {
3450
+ var _ref = _asyncToGenerator$3(function* () {
3345
3451
  try {
3346
3452
  window.dispatchEvent(new CustomEvent("request.start"));
3347
3453
  yield factory();
@@ -3368,7 +3474,7 @@ function loadLazyBricks(_x) {
3368
3474
  }
3369
3475
 
3370
3476
  function _loadLazyBricks() {
3371
- _loadLazyBricks = _asyncToGenerator$4(function* (bricks) {
3477
+ _loadLazyBricks = _asyncToGenerator$3(function* (bricks) {
3372
3478
  var requests = new Set();
3373
3479
 
3374
3480
  for (var brick of bricks) {
@@ -3489,7 +3595,7 @@ class Runtime {
3489
3595
  }
3490
3596
 
3491
3597
  bootstrap(mountPoints) {
3492
- return _asyncToGenerator$4(function* () {
3598
+ return _asyncToGenerator$3(function* () {
3493
3599
  if (kernel !== undefined) {
3494
3600
  throw new Error("Cannot bootstrap more than once.");
3495
3601
  }
@@ -5777,7 +5883,7 @@ function startPoll(task, _ref, _ref2) {
5777
5883
  }
5778
5884
 
5779
5885
  function _poll() {
5780
- _poll = _asyncToGenerator$4(function* () {
5886
+ _poll = _asyncToGenerator$3(function* () {
5781
5887
  timeoutIdList.delete(currentTimeoutId);
5782
5888
  var shouldStop;
5783
5889
 
@@ -5856,7 +5962,7 @@ function clearPollTimeout() {
5856
5962
 
5857
5963
 
5858
5964
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5859
- var _ref = _asyncToGenerator$4(function* (options) {
5965
+ var _ref = _asyncToGenerator$3(function* (options) {
5860
5966
  return (
5861
5967
  /**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5862
5968
  (yield http.get("api/v1/runtime_standalone", options)).data
@@ -5874,7 +5980,7 @@ var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5874
5980
 
5875
5981
 
5876
5982
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5877
- var _ref = _asyncToGenerator$4(function* (params, options) {
5983
+ var _ref = _asyncToGenerator$3(function* (params, options) {
5878
5984
  return (
5879
5985
  /**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5880
5986
  (yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
@@ -5894,7 +6000,7 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5894
6000
 
5895
6001
 
5896
6002
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5897
- var _ref = _asyncToGenerator$4(function* (appId, params, options) {
6003
+ var _ref = _asyncToGenerator$3(function* (appId, params, options) {
5898
6004
  return (
5899
6005
  /**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5900
6006
  (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
@@ -5914,7 +6020,7 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5914
6020
 
5915
6021
 
5916
6022
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5917
- var _ref = _asyncToGenerator$4(function* (data, options) {
6023
+ var _ref = _asyncToGenerator$3(function* (data, options) {
5918
6024
  return (
5919
6025
  /**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5920
6026
  (yield http.post("api/contract/single_search", data, options)).data
@@ -5947,7 +6053,7 @@ function getArgsOfCustomApi(_x, _x2) {
5947
6053
  }
5948
6054
 
5949
6055
  function _getArgsOfCustomApi() {
5950
- _getArgsOfCustomApi = _asyncToGenerator$4(function* (provider, originalArgs) {
6056
+ _getArgsOfCustomApi = _asyncToGenerator$3(function* (provider, originalArgs) {
5951
6057
  if (!isCustomApiProvider(provider)) {
5952
6058
  return originalArgs;
5953
6059
  }
@@ -6063,7 +6169,7 @@ function _fetchFlowApiDefinition(_x3) {
6063
6169
  }
6064
6170
 
6065
6171
  function _fetchFlowApiDefinition2() {
6066
- _fetchFlowApiDefinition2 = _asyncToGenerator$4(function* (provider) {
6172
+ _fetchFlowApiDefinition2 = _asyncToGenerator$3(function* (provider) {
6067
6173
  var [namespaceName, nameWithVersion] = provider.split("@");
6068
6174
  var [name, version] = nameWithVersion.split(":");
6069
6175
  var contract;
@@ -6234,10 +6340,12 @@ function listenerFactory(handler, context, runtimeBrick) {
6234
6340
 
6235
6341
  case "context.assign":
6236
6342
  case "context.replace":
6343
+ case "context.refresh":
6237
6344
  return builtinContextListenerFactory(method, handler.args, handler, context);
6238
6345
 
6239
6346
  case "state.update":
6240
- return builtinStateListenerFactory(handler.args, handler, context);
6347
+ case "state.refresh":
6348
+ return builtinStateListenerFactory(method, handler.args, handler, context);
6241
6349
 
6242
6350
  case "tpl.dispatchEvent":
6243
6351
  return builtinTplDispatchEventFactory(handler.args, handler, context);
@@ -6320,7 +6428,7 @@ function listenerFactory(handler, context, runtimeBrick) {
6320
6428
 
6321
6429
  function usingProviderFactory(handler, context, runtimeBrick) {
6322
6430
  return /*#__PURE__*/function () {
6323
- var _ref2 = _asyncToGenerator$4(function* (event) {
6431
+ var _ref2 = _asyncToGenerator$3(function* (event) {
6324
6432
  if (!looseCheckIf(handler, _objectSpread(_objectSpread({}, context), {}, {
6325
6433
  event
6326
6434
  }))) {
@@ -6381,7 +6489,7 @@ function builtinContextListenerFactory(method, args, ifContainer, context) {
6381
6489
  };
6382
6490
  }
6383
6491
 
6384
- function builtinStateListenerFactory(args, ifContainer, context) {
6492
+ function builtinStateListenerFactory(method, args, ifContainer, context) {
6385
6493
  return function (event) {
6386
6494
  if (!looseCheckIf(ifContainer, _objectSpread(_objectSpread({}, context), {}, {
6387
6495
  event
@@ -6391,7 +6499,7 @@ function builtinStateListenerFactory(args, ifContainer, context) {
6391
6499
 
6392
6500
  var tplContext = getTplContext(context.tplContextId);
6393
6501
  var [name, value] = argsFactory(args, context, event);
6394
- tplContext.state.updateValue(name, value, "replace");
6502
+ tplContext.state.updateValue(name, value, method === "refresh" ? method : "replace");
6395
6503
  };
6396
6504
  }
6397
6505
 
@@ -6597,7 +6705,7 @@ function brickCallback(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {
6597
6705
  }
6598
6706
 
6599
6707
  function _brickCallback() {
6600
- _brickCallback = _asyncToGenerator$4(function* (target, handler, method, context, runtimeBrick, event, options) {
6708
+ _brickCallback = _asyncToGenerator$3(function* (target, handler, method, context, runtimeBrick, event, options) {
6601
6709
  var _handler$callback, _poll;
6602
6710
 
6603
6711
  if (typeof target[method] !== "function") {
@@ -6610,7 +6718,7 @@ function _brickCallback() {
6610
6718
  }
6611
6719
 
6612
6720
  var task = /*#__PURE__*/function () {
6613
- var _ref3 = _asyncToGenerator$4(function* () {
6721
+ var _ref3 = _asyncToGenerator$3(function* () {
6614
6722
  var computedArgs = argsFactory(handler.args, context, event, options);
6615
6723
 
6616
6724
  if (isUseProviderHandler(handler)) {
@@ -6966,7 +7074,7 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
6966
7074
 
6967
7075
 
6968
7076
  var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6969
- var _ref = _asyncToGenerator$4(function* (appId, options) {
7077
+ var _ref = _asyncToGenerator$3(function* (appId, options) {
6970
7078
  return (
6971
7079
  /**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
6972
7080
  (yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
@@ -6984,7 +7092,7 @@ var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6984
7092
 
6985
7093
 
6986
7094
  var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
6987
- var _ref = _asyncToGenerator$4(function* (data, options) {
7095
+ var _ref = _asyncToGenerator$3(function* (data, options) {
6988
7096
  return (
6989
7097
  /**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
6990
7098
  (yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
@@ -7134,7 +7242,7 @@ function CustomApi(_x) {
7134
7242
  }
7135
7243
 
7136
7244
  function _CustomApi() {
7137
- _CustomApi = _asyncToGenerator$4(function* (_ref2) {
7245
+ _CustomApi = _asyncToGenerator$3(function* (_ref2) {
7138
7246
  var {
7139
7247
  url,
7140
7248
  method = "GET",
@@ -7195,7 +7303,7 @@ function standaloneBootstrap() {
7195
7303
  }
7196
7304
 
7197
7305
  function _standaloneBootstrap() {
7198
- _standaloneBootstrap = _asyncToGenerator$4(function* () {
7306
+ _standaloneBootstrap = _asyncToGenerator$3(function* () {
7199
7307
  var [bootstrapResult, confString, runtimeData] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
7200
7308
  responseType: "text"
7201
7309
  }), yield BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
@@ -8258,7 +8366,7 @@ function asyncExpandCustomTemplate(_x, _x2, _x3) {
8258
8366
  }
8259
8367
 
8260
8368
  function _asyncExpandCustomTemplate() {
8261
- _asyncExpandCustomTemplate = _asyncToGenerator$4(function* (brickConf, proxyBrick, context) {
8369
+ _asyncExpandCustomTemplate = _asyncToGenerator$3(function* (brickConf, proxyBrick, context) {
8262
8370
  var tplContext = new CustomTemplateContext(proxyBrick);
8263
8371
  var template = customTemplateRegistry.get(brickConf.brick);
8264
8372
 
@@ -8759,7 +8867,7 @@ class Kernel {
8759
8867
  _defineProperty$1(this, "loadMagicBrickConfigStarted", false);
8760
8868
 
8761
8869
  _defineProperty$1(this, "_loadDepsOfStoryboard", /*#__PURE__*/function () {
8762
- var _ref = _asyncToGenerator$4(function* (storyboard) {
8870
+ var _ref = _asyncToGenerator$3(function* (storyboard) {
8763
8871
  var {
8764
8872
  brickPackages,
8765
8873
  templatePackages
@@ -8794,7 +8902,7 @@ class Kernel {
8794
8902
  }());
8795
8903
 
8796
8904
  _defineProperty$1(this, "_loadDynamicBricks", /*#__PURE__*/function () {
8797
- var _ref2 = _asyncToGenerator$4(function* (bricks, processors) {
8905
+ var _ref2 = _asyncToGenerator$3(function* (bricks, processors) {
8798
8906
  var filteredBricks = bricks.filter( // Only try to load undefined custom elements.
8799
8907
  item => !customElements.get(item)); // Try to load deps for dynamic added bricks.
8800
8908
 
@@ -8816,7 +8924,7 @@ class Kernel {
8816
8924
  }());
8817
8925
 
8818
8926
  _defineProperty$1(this, "_loadEditorBricks", /*#__PURE__*/function () {
8819
- var _ref3 = _asyncToGenerator$4(function* (editorBricks) {
8927
+ var _ref3 = _asyncToGenerator$3(function* (editorBricks) {
8820
8928
  var {
8821
8929
  dll,
8822
8930
  deps
@@ -8837,7 +8945,7 @@ class Kernel {
8837
8945
  bootstrap(mountPoints) {
8838
8946
  var _this2 = this;
8839
8947
 
8840
- return _asyncToGenerator$4(function* () {
8948
+ return _asyncToGenerator$3(function* () {
8841
8949
  var _this2$bootstrapData$, _this2$bootstrapData$2;
8842
8950
 
8843
8951
  listenDevtoolsEagerly();
@@ -8872,7 +8980,7 @@ class Kernel {
8872
8980
  layoutBootstrap(layout) {
8873
8981
  var _this3 = this;
8874
8982
 
8875
- return _asyncToGenerator$4(function* () {
8983
+ return _asyncToGenerator$3(function* () {
8876
8984
  var supportedLayouts = ["console", "business"];
8877
8985
 
8878
8986
  if (!supportedLayouts.includes(layout)) {
@@ -8924,7 +9032,7 @@ class Kernel {
8924
9032
  }
8925
9033
 
8926
9034
  loadCheckLogin() {
8927
- return _asyncToGenerator$4(function* () {
9035
+ return _asyncToGenerator$3(function* () {
8928
9036
  if (!window.NO_AUTH_GUARD) {
8929
9037
  var auth = yield checkLogin();
8930
9038
 
@@ -8938,7 +9046,7 @@ class Kernel {
8938
9046
  loadMicroApps(params, interceptorParams) {
8939
9047
  var _this4 = this;
8940
9048
 
8941
- return _asyncToGenerator$4(function* () {
9049
+ return _asyncToGenerator$3(function* () {
8942
9050
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
8943
9051
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons",
8944
9052
  ignoreTemplateFields: "templates",
@@ -8969,7 +9077,7 @@ class Kernel {
8969
9077
  fulfilStoryboard(storyboard) {
8970
9078
  var _this5 = this;
8971
9079
 
8972
- return _asyncToGenerator$4(function* () {
9080
+ return _asyncToGenerator$3(function* () {
8973
9081
  if (storyboard.$$fulfilled) {
8974
9082
  return;
8975
9083
  }
@@ -8985,10 +9093,11 @@ class Kernel {
8985
9093
  doFulfilStoryboard(storyboard) {
8986
9094
  var _this6 = this;
8987
9095
 
8988
- return _asyncToGenerator$4(function* () {
9096
+ return _asyncToGenerator$3(function* () {
8989
9097
  if (window.STANDALONE_MICRO_APPS) {
8990
9098
  Object.assign(storyboard, {
8991
- $$fulfilled: true
9099
+ $$fulfilled: true,
9100
+ $$fulfilling: null
8992
9101
  });
8993
9102
 
8994
9103
  if (!window.NO_AUTH_GUARD) {
@@ -9021,7 +9130,8 @@ class Kernel {
9021
9130
  routes,
9022
9131
  meta,
9023
9132
  app: _objectSpread(_objectSpread({}, storyboard.app), app),
9024
- $$fulfilled: true
9133
+ $$fulfilled: true,
9134
+ $$fulfilling: null
9025
9135
  });
9026
9136
  }
9027
9137
 
@@ -9030,9 +9140,12 @@ class Kernel {
9030
9140
  }
9031
9141
 
9032
9142
  postProcessStoryboard(storyboard) {
9033
- var _storyboard$meta;
9034
-
9035
9143
  storyboard.app.$$routeAliasMap = scanRouteAliasInStoryboard(storyboard);
9144
+ this.postProcessStoryboardI18n(storyboard);
9145
+ }
9146
+
9147
+ postProcessStoryboardI18n(storyboard) {
9148
+ var _storyboard$meta;
9036
9149
 
9037
9150
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
9038
9151
  // Prefix to avoid conflict between brick package's i18n namespace.
@@ -9045,10 +9158,70 @@ class Kernel {
9045
9158
  }
9046
9159
  }
9047
9160
 
9161
+ fulfilStoryboardI18n(appIds) {
9162
+ var _this7 = this;
9163
+
9164
+ return _asyncToGenerator$3(function* () {
9165
+ // Ignore already fulfilled apps.
9166
+ var filteredStoryboards = appIds.map(appId => _this7.bootstrapData.storyboards.find(story => story.app.id === appId)).filter(story => story && !story.$$fulfilled && !story.$$i18nFulfilled);
9167
+
9168
+ if (window.STANDALONE_MICRO_APPS) {
9169
+ // Fallback to fullfil whole storyboard for standalone micro-apps.
9170
+ yield Promise.all(filteredStoryboards.map(story => _this7.fulfilStoryboard(story)));
9171
+ return;
9172
+ } // Do not fulfil i18n if the app is doing a whole fulfilling.
9173
+
9174
+
9175
+ var fulfilling = [];
9176
+ var filteredAppIds = [];
9177
+
9178
+ for (var story of filteredStoryboards) {
9179
+ if (story.$$fulfilling) {
9180
+ fulfilling.push(story.$$fulfilling);
9181
+ } else {
9182
+ filteredAppIds.push(story.app.id);
9183
+ }
9184
+ }
9185
+
9186
+ if (filteredAppIds.length === 0) {
9187
+ // Still wait for these whole fulfilling.
9188
+ yield Promise.all(fulfilling);
9189
+ return;
9190
+ }
9191
+
9192
+ var [{
9193
+ i18nInfo
9194
+ }] = yield Promise.all([InstalledMicroAppApi_getI18NData({
9195
+ appIds: filteredAppIds.join(",")
9196
+ }), // Still wait for these whole fulfilling.
9197
+ ...fulfilling]);
9198
+
9199
+ var _loop = function (appId, i18n) {
9200
+ var storyboard = _this7.bootstrapData.storyboards.find(story => story.app.id === appId);
9201
+
9202
+ Object.assign(storyboard, {
9203
+ meta: _objectSpread(_objectSpread({}, storyboard.meta), {}, {
9204
+ i18n: i18n
9205
+ }),
9206
+ $$i18nFulfilled: true
9207
+ });
9208
+
9209
+ _this7.postProcessStoryboardI18n(storyboard);
9210
+ };
9211
+
9212
+ for (var {
9213
+ appId,
9214
+ i18n
9215
+ } of i18nInfo) {
9216
+ _loop(appId, i18n);
9217
+ }
9218
+ })();
9219
+ }
9220
+
9048
9221
  _dev_only_updateStoryboard(appId, storyboardPatch) {
9049
9222
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9050
9223
  Object.assign(storyboard, _objectSpread(_objectSpread({}, storyboardPatch), {}, {
9051
- $$fulfilling: Promise.resolve(),
9224
+ $$fulfilling: null,
9052
9225
  $$fulfilled: true,
9053
9226
  $$registerCustomTemplateProcessed: false,
9054
9227
  $$depsProcessed: false
@@ -9058,7 +9231,8 @@ class Kernel {
9058
9231
 
9059
9232
  _dev_only_updateTemplatePreviewSettings(appId, templateId, settings) {
9060
9233
  var {
9061
- routes
9234
+ routes,
9235
+ app
9062
9236
  } = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9063
9237
  var previewPath = "${APP.homepage}/_dev_only_/template-preview/".concat(templateId);
9064
9238
  var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
@@ -9068,7 +9242,8 @@ class Kernel {
9068
9242
  brick: templateId
9069
9243
  }, pick(settings, "properties", "events", "lifeCycle", "context"))],
9070
9244
  menu: false,
9071
- exact: true
9245
+ exact: true,
9246
+ hybrid: app.legacy === "iframe"
9072
9247
  };
9073
9248
 
9074
9249
  if (previewRouteIndex === -1) {
@@ -9082,7 +9257,8 @@ class Kernel {
9082
9257
  var _snippetData$bricks;
9083
9258
 
9084
9259
  var {
9085
- routes
9260
+ routes,
9261
+ app
9086
9262
  } = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9087
9263
  var previewPath = "${APP.homepage}/_dev_only_/snippet-preview/".concat(snippetData.snippetId);
9088
9264
  var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
@@ -9092,7 +9268,8 @@ class Kernel {
9092
9268
  brick: "span"
9093
9269
  }],
9094
9270
  menu: false,
9095
- exact: true
9271
+ exact: true,
9272
+ hybrid: app.legacy === "iframe"
9096
9273
  };
9097
9274
 
9098
9275
  if (previewRouteIndex === -1) {
@@ -9171,9 +9348,9 @@ class Kernel {
9171
9348
 
9172
9349
  gracefullyLoadDeps(fn) {
9173
9350
  var _arguments = arguments,
9174
- _this7 = this;
9351
+ _this8 = this;
9175
9352
 
9176
- return _asyncToGenerator$4(function* () {
9353
+ return _asyncToGenerator$3(function* () {
9177
9354
  for (var _len = _arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9178
9355
  args[_key - 1] = _arguments[_key];
9179
9356
  }
@@ -9185,7 +9362,7 @@ class Kernel {
9185
9362
  // The scripts maybe stale when a user stays in page while upgrades been applied.
9186
9363
  // So we force reloading again automatically.
9187
9364
  // NOTE: reload only once to avoid a infinite loop.
9188
- yield _this7.reloadMicroApps();
9365
+ yield _this8.reloadMicroApps();
9189
9366
  yield fn(...args);
9190
9367
  } else {
9191
9368
  throw e;
@@ -9234,15 +9411,15 @@ class Kernel {
9234
9411
  }
9235
9412
 
9236
9413
  loadDynamicBricksInBrickConf(brickConf) {
9237
- var _this8 = this;
9414
+ var _this9 = this;
9238
9415
 
9239
- return _asyncToGenerator$4(function* () {
9416
+ return _asyncToGenerator$3(function* () {
9240
9417
  // Notice: `brickConf` contains runtime data,
9241
9418
  // which may contains recursive ref,
9242
9419
  // which could cause stack overflow while traversing.
9243
9420
  var bricks = scanBricksInBrickConf(brickConf);
9244
9421
  var processors = scanProcessorsInAny(brickConf);
9245
- yield _this8.loadDynamicBricks(bricks, processors);
9422
+ yield _this9.loadDynamicBricks(bricks, processors);
9246
9423
  })();
9247
9424
  }
9248
9425
 
@@ -9314,7 +9491,7 @@ class Kernel {
9314
9491
  }
9315
9492
 
9316
9493
  loadUsers() {
9317
- return _asyncToGenerator$4(function* () {
9494
+ return _asyncToGenerator$3(function* () {
9318
9495
  var allUserMap = new Map();
9319
9496
 
9320
9497
  try {
@@ -9351,15 +9528,15 @@ class Kernel {
9351
9528
  }
9352
9529
 
9353
9530
  getMicroAppApiOrchestrationMapAsync() {
9354
- var _this9 = this;
9531
+ var _this10 = this;
9355
9532
 
9356
- return _asyncToGenerator$4(function* () {
9357
- return yield _this9.allMicroAppApiOrchestrationPromise;
9533
+ return _asyncToGenerator$3(function* () {
9534
+ return yield _this10.allMicroAppApiOrchestrationPromise;
9358
9535
  })();
9359
9536
  }
9360
9537
 
9361
9538
  loadMicroAppApiOrchestration(usedCustomApis) {
9362
- return _asyncToGenerator$4(function* () {
9539
+ return _asyncToGenerator$3(function* () {
9363
9540
  var allMicroAppApiOrchestrationMap = new Map();
9364
9541
  var legacyCustomApis = usedCustomApis.filter(item => !item.name.includes(":"));
9365
9542
 
@@ -9401,7 +9578,7 @@ class Kernel {
9401
9578
  }
9402
9579
 
9403
9580
  loadMagicBrickConfig() {
9404
- return _asyncToGenerator$4(function* () {
9581
+ return _asyncToGenerator$3(function* () {
9405
9582
  var allMagicBrickConfigMap = new Map();
9406
9583
 
9407
9584
  try {
@@ -9431,7 +9608,7 @@ class Kernel {
9431
9608
  }
9432
9609
 
9433
9610
  loadRelatedApps() {
9434
- return _asyncToGenerator$4(function* () {
9611
+ return _asyncToGenerator$3(function* () {
9435
9612
  var relatedApps = [];
9436
9613
 
9437
9614
  try {
@@ -9446,14 +9623,14 @@ class Kernel {
9446
9623
  }
9447
9624
 
9448
9625
  getRelatedAppsAsync(appId) {
9449
- var _this10 = this;
9626
+ var _this11 = this;
9450
9627
 
9451
- return _asyncToGenerator$4(function* () {
9628
+ return _asyncToGenerator$3(function* () {
9452
9629
  if (!appId) {
9453
9630
  return [];
9454
9631
  }
9455
9632
 
9456
- var allRelatedApps = yield _this10.allRelatedAppsPromise;
9633
+ var allRelatedApps = yield _this11.allRelatedAppsPromise;
9457
9634
  var thisApp = allRelatedApps.find(item => item.microAppId === appId);
9458
9635
 
9459
9636
  if (!thisApp) {
@@ -9465,38 +9642,38 @@ class Kernel {
9465
9642
  }
9466
9643
 
9467
9644
  updateWorkspaceStack() {
9468
- var _this11 = this;
9645
+ var _this12 = this;
9469
9646
 
9470
- return _asyncToGenerator$4(function* () {
9471
- if (_this11.currentApp && _this11.currentApp.id) {
9647
+ return _asyncToGenerator$3(function* () {
9648
+ if (_this12.currentApp && _this12.currentApp.id) {
9472
9649
  var workspace = {
9473
- appId: _this11.currentApp.id,
9474
- appName: _this11.currentApp.name,
9475
- appLocaleName: _this11.currentApp.localeName,
9476
- url: _this11.currentUrl
9650
+ appId: _this12.currentApp.id,
9651
+ appName: _this12.currentApp.name,
9652
+ appLocaleName: _this12.currentApp.localeName,
9653
+ url: _this12.currentUrl
9477
9654
  };
9478
9655
 
9479
- if (_this11.workspaceStack.length > 0) {
9480
- var previousWorkspace = _this11.workspaceStack[_this11.workspaceStack.length - 1];
9656
+ if (_this12.workspaceStack.length > 0) {
9657
+ var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
9481
9658
 
9482
- var _relatedApps = yield _this11.getRelatedAppsAsync(previousWorkspace.appId);
9659
+ var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
9483
9660
 
9484
- if (_relatedApps.some(item => item.microAppId === _this11.currentApp.id)) {
9661
+ if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
9485
9662
  Object.assign(previousWorkspace, workspace);
9486
9663
  return;
9487
9664
  }
9488
9665
  }
9489
9666
 
9490
- var relatedApps = yield _this11.getRelatedAppsAsync(_this11.currentApp.id);
9667
+ var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
9491
9668
 
9492
9669
  if (relatedApps.length > 0) {
9493
- _this11.workspaceStack.push(workspace);
9670
+ _this12.workspaceStack.push(workspace);
9494
9671
 
9495
9672
  return;
9496
9673
  }
9497
9674
  }
9498
9675
 
9499
- _this11.workspaceStack = [];
9676
+ _this12.workspaceStack = [];
9500
9677
  })();
9501
9678
  }
9502
9679
 
@@ -9543,22 +9720,22 @@ class Kernel {
9543
9720
  }
9544
9721
 
9545
9722
  getProviderBrick(provider) {
9546
- var _this12 = this;
9723
+ var _this13 = this;
9547
9724
 
9548
- return _asyncToGenerator$4(function* () {
9725
+ return _asyncToGenerator$3(function* () {
9549
9726
  if (isCustomApiProvider(provider)) {
9550
9727
  provider = CUSTOM_API_PROVIDER;
9551
9728
  }
9552
9729
 
9553
- if (_this12.providerRepository.has(provider)) {
9554
- return _this12.providerRepository.get(provider);
9730
+ if (_this13.providerRepository.has(provider)) {
9731
+ return _this13.providerRepository.get(provider);
9555
9732
  }
9556
9733
 
9557
9734
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
9558
9735
  registerCustomApi();
9559
9736
  }
9560
9737
 
9561
- yield _this12.loadDynamicBricks([provider]);
9738
+ yield _this13.loadDynamicBricks([provider]);
9562
9739
 
9563
9740
  if (!customElements.get(provider)) {
9564
9741
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -9566,7 +9743,7 @@ class Kernel {
9566
9743
 
9567
9744
  var brick = document.createElement(provider);
9568
9745
 
9569
- _this12.providerRepository.set(provider, brick);
9746
+ _this13.providerRepository.set(provider, brick);
9570
9747
 
9571
9748
  return brick;
9572
9749
  })();
@@ -9580,7 +9757,7 @@ function loadScriptOfDll(_x5) {
9580
9757
  }
9581
9758
 
9582
9759
  function _loadScriptOfDll() {
9583
- _loadScriptOfDll = _asyncToGenerator$4(function* (dlls) {
9760
+ _loadScriptOfDll = _asyncToGenerator$3(function* (dlls) {
9584
9761
  if (dlls.some(dll => dll.startsWith("dll-of-editor-bricks-helper."))) {
9585
9762
  var dllPath = window.DLL_PATH || {};
9586
9763
  yield loadScript(dllPath["react-dnd"], window.CORE_ROOT);
@@ -9738,44 +9915,6 @@ function isRouteConfOfRoutes(conf) {
9738
9915
  return conf.type === "routes";
9739
9916
  }
9740
9917
 
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
9918
  function getSubStoryboardByRoute(storyboard, matcher) {
9780
9919
  function getSubRoutes(routes) {
9781
9920
  return matcher(routes).map(getSubRoute);
@@ -10366,7 +10505,7 @@ class LocationContext {
10366
10505
  mountRoutes(routes, slotId, mountRoutesResult) {
10367
10506
  var _this = this;
10368
10507
 
10369
- return _asyncToGenerator$4(function* () {
10508
+ return _asyncToGenerator$3(function* () {
10370
10509
  var matched = _this.matchRoutes(routes, _this.kernel.nextApp);
10371
10510
 
10372
10511
  var redirect;
@@ -10451,7 +10590,7 @@ class LocationContext {
10451
10590
  mountMenu(menuConf, match, mountRoutesResult) {
10452
10591
  var _this2 = this;
10453
10592
 
10454
- return _asyncToGenerator$4(function* () {
10593
+ return _asyncToGenerator$3(function* () {
10455
10594
  if (menuConf === false) {
10456
10595
  // `route.menu` 设置为 `false` 表示不显示顶栏和侧栏。
10457
10596
  mountRoutesResult.flags.barsHidden = true;
@@ -10541,7 +10680,7 @@ class LocationContext {
10541
10680
  mountProviders(providers, match, slotId, mountRoutesResult) {
10542
10681
  var _this3 = this;
10543
10682
 
10544
- return _asyncToGenerator$4(function* () {
10683
+ return _asyncToGenerator$3(function* () {
10545
10684
  if (Array.isArray(providers)) {
10546
10685
  for (var providerConf of providers) {
10547
10686
  yield _this3.mountBrick(_objectSpread(_objectSpread({}, typeof providerConf === "string" ? {
@@ -10558,7 +10697,7 @@ class LocationContext {
10558
10697
  mountBricks(bricks, match, slotId, mountRoutesResult, tplStack) {
10559
10698
  var _this4 = this;
10560
10699
 
10561
- return _asyncToGenerator$4(function* () {
10700
+ return _asyncToGenerator$3(function* () {
10562
10701
  for (var brickConf of bricks) {
10563
10702
  try {
10564
10703
  yield _this4.mountBrick(brickConf, match, slotId, mountRoutesResult, tplStack === null || tplStack === void 0 ? void 0 : tplStack.slice());
@@ -10592,7 +10731,7 @@ class LocationContext {
10592
10731
  checkResolvableIf(ifContainer, context) {
10593
10732
  var _this5 = this;
10594
10733
 
10595
- return _asyncToGenerator$4(function* () {
10734
+ return _asyncToGenerator$3(function* () {
10596
10735
  if (isObject(ifContainer.if)) {
10597
10736
  var ifChecked = computeRealValue(ifContainer.if, context, true);
10598
10737
  var ifConf = {};
@@ -10605,7 +10744,7 @@ class LocationContext {
10605
10744
  }
10606
10745
 
10607
10746
  preCheckPermissions(container, context) {
10608
- return _asyncToGenerator$4(function* () {
10747
+ return _asyncToGenerator$3(function* () {
10609
10748
  if (isLoggedIn() && !getAuth().isAdmin && container.permissionsPreCheck && Array.isArray(container.permissionsPreCheck)) {
10610
10749
  var usedActions = computeRealValue(container.permissionsPreCheck, context, true);
10611
10750
  yield validatePermissions(usedActions);
@@ -10617,7 +10756,7 @@ class LocationContext {
10617
10756
  var _arguments = arguments,
10618
10757
  _this6 = this;
10619
10758
 
10620
- return _asyncToGenerator$4(function* () {
10759
+ return _asyncToGenerator$3(function* () {
10621
10760
  var _this6$kernel$nextApp, _brickConf$lifeCycle, _brick$lifeCycle;
10622
10761
 
10623
10762
  var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
@@ -10721,7 +10860,7 @@ class LocationContext {
10721
10860
  if (expandedBrickConf.exports) {
10722
10861
  for (var [prop, ctxName] of Object.entries(expandedBrickConf.exports)) {
10723
10862
  if (typeof ctxName === "string" && ctxName.startsWith("CTX.")) {
10724
- _this6.storyboardContextWrapper.set(ctxName.substr(4), {
10863
+ _this6.storyboardContextWrapper.set(ctxName.substring(4), {
10725
10864
  type: "brick-property",
10726
10865
  brick,
10727
10866
  prop
@@ -10955,7 +11094,7 @@ class LocationContext {
10955
11094
  preFetchMenu(data) {
10956
11095
  var _this7 = this;
10957
11096
 
10958
- return _asyncToGenerator$4(function* () {
11097
+ return _asyncToGenerator$3(function* () {
10959
11098
  var useMenus = scanAppGetMenuInAny(data);
10960
11099
 
10961
11100
  if (useMenus.length) {
@@ -11054,7 +11193,7 @@ function makeProviderRefreshable(providerBrick) {
11054
11193
  // },
11055
11194
  $refresh: {
11056
11195
  value: function () {
11057
- var _ref = _asyncToGenerator$4(function* () {
11196
+ var _ref = _asyncToGenerator$3(function* () {
11058
11197
  var {
11059
11198
  ignoreErrors,
11060
11199
  throwErrors,
@@ -11069,7 +11208,7 @@ function makeProviderRefreshable(providerBrick) {
11069
11208
 
11070
11209
  try {
11071
11210
  yield Promise.all(this.$$dependents.map( /*#__PURE__*/function () {
11072
- var _ref3 = _asyncToGenerator$4(function* (_ref2) {
11211
+ var _ref3 = _asyncToGenerator$3(function* (_ref2) {
11073
11212
  var {
11074
11213
  brick,
11075
11214
  method,
@@ -11105,7 +11244,7 @@ function makeProviderRefreshable(providerBrick) {
11105
11244
  }
11106
11245
 
11107
11246
  function _fetchData() {
11108
- _fetchData = _asyncToGenerator$4(function* () {
11247
+ _fetchData = _asyncToGenerator$3(function* () {
11109
11248
  var value = yield promise;
11110
11249
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11111
11250
 
@@ -11201,7 +11340,7 @@ class Resolver {
11201
11340
  resolve(brickConf, brick, context) {
11202
11341
  var _this = this;
11203
11342
 
11204
- return _asyncToGenerator$4(function* () {
11343
+ return _asyncToGenerator$3(function* () {
11205
11344
  var _brickConf$lifeCycle$, _brickConf$lifeCycle;
11206
11345
 
11207
11346
  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 +11361,7 @@ class Resolver {
11222
11361
  resolveOne(type, resolveConf, conf, brick, context) {
11223
11362
  var _this2 = this;
11224
11363
 
11225
- return _asyncToGenerator$4(function* () {
11364
+ return _asyncToGenerator$3(function* () {
11226
11365
  var brickConf = conf;
11227
11366
  var propsReference = conf;
11228
11367
  var actualResolveConf;
@@ -11300,20 +11439,34 @@ class Resolver {
11300
11439
  }
11301
11440
  }
11302
11441
 
11303
- var cacheKey = JSON.stringify({
11304
- provider,
11305
- useProvider,
11306
- method,
11307
- args
11308
- });
11442
+ var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
11443
+ : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
11444
+ var cacheKey;
11445
+
11446
+ try {
11447
+ // `actualArgs` may contain circular references, which makes
11448
+ // JSON stringify failed, thus we fallback to original args.
11449
+ cacheKey = JSON.stringify({
11450
+ provider,
11451
+ useProvider,
11452
+ method,
11453
+ actualArgs
11454
+ });
11455
+ } catch (e) {
11456
+ cacheKey = JSON.stringify({
11457
+ provider,
11458
+ useProvider,
11459
+ method,
11460
+ args
11461
+ });
11462
+ }
11463
+
11309
11464
  var promise;
11310
11465
 
11311
11466
  if (_this2.cache.has(cacheKey)) {
11312
11467
  promise = _this2.cache.get(cacheKey);
11313
11468
  } else {
11314
- var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
11315
- : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
11316
- promise = _asyncToGenerator$4(function* () {
11469
+ promise = _asyncToGenerator$3(function* () {
11317
11470
  if (useProvider) {
11318
11471
  actualArgs = yield getArgsOfCustomApi(useProvider, actualArgs);
11319
11472
  }
@@ -11346,7 +11499,7 @@ class Resolver {
11346
11499
  }
11347
11500
 
11348
11501
  function _fetchData() {
11349
- _fetchData = _asyncToGenerator$4(function* () {
11502
+ _fetchData = _asyncToGenerator$3(function* () {
11350
11503
  var value = yield promise;
11351
11504
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11352
11505
 
@@ -11387,7 +11540,7 @@ class Resolver {
11387
11540
 
11388
11541
  var _loop = function (providerBrick, interval) {
11389
11542
  var request = /*#__PURE__*/function () {
11390
- var _ref2 = _asyncToGenerator$4(function* () {
11543
+ var _ref2 = _asyncToGenerator$3(function* () {
11391
11544
  yield providerBrick.$refresh({
11392
11545
  ignoreErrors: interval.ignoreErrors,
11393
11546
  throwErrors: true,
@@ -11504,7 +11657,7 @@ function preFetchStandaloneInstalledApps(_x) {
11504
11657
  }
11505
11658
 
11506
11659
  function _preFetchStandaloneInstalledApps() {
11507
- _preFetchStandaloneInstalledApps = _asyncToGenerator$4(function* (storyboard) {
11660
+ _preFetchStandaloneInstalledApps = _asyncToGenerator$3(function* (storyboard) {
11508
11661
  var saIds = scanInstalledAppsInStoryboard(storyboard);
11509
11662
  yield fetchStandaloneApps(saIds);
11510
11663
  });
@@ -11516,7 +11669,7 @@ function fetchStandaloneApps(_x2) {
11516
11669
  }
11517
11670
 
11518
11671
  function _fetchStandaloneApps() {
11519
- _fetchStandaloneApps = _asyncToGenerator$4(function* (saIds) {
11672
+ _fetchStandaloneApps = _asyncToGenerator$3(function* (saIds) {
11520
11673
  // ignore apps which are already searched
11521
11674
  var searchIds = difference(saIds, Array.from(appIdSet));
11522
11675
 
@@ -11671,14 +11824,14 @@ class Router {
11671
11824
  bootstrap() {
11672
11825
  var _this = this;
11673
11826
 
11674
- return _asyncToGenerator$4(function* () {
11827
+ return _asyncToGenerator$3(function* () {
11675
11828
  var history = getHistory();
11676
11829
  _this.prevLocation = history.location;
11677
11830
 
11678
11831
  _this.locationChangeNotify("", history.location.pathname);
11679
11832
 
11680
11833
  history.listen( /*#__PURE__*/function () {
11681
- var _ref = _asyncToGenerator$4(function* (location, action) {
11834
+ var _ref = _asyncToGenerator$3(function* (location, action) {
11682
11835
  var _this$prevLocation$st, _location$state;
11683
11836
 
11684
11837
  var ignoreRendering = false;
@@ -11740,7 +11893,7 @@ class Router {
11740
11893
  queuedRender(location) {
11741
11894
  var _this2 = this;
11742
11895
 
11743
- return _asyncToGenerator$4(function* () {
11896
+ return _asyncToGenerator$3(function* () {
11744
11897
  _this2.rendering = true;
11745
11898
 
11746
11899
  try {
@@ -11760,7 +11913,7 @@ class Router {
11760
11913
  render(location) {
11761
11914
  var _this3 = this;
11762
11915
 
11763
- return _asyncToGenerator$4(function* () {
11916
+ return _asyncToGenerator$3(function* () {
11764
11917
  var _apiAnalyzer$getInsta, _getLocalAppsTheme;
11765
11918
 
11766
11919
  _this3.state = "initial";
@@ -12521,7 +12674,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12521
12674
 
12522
12675
  return true;
12523
12676
  }, [useBrick, data]);
12524
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12677
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12525
12678
  if (!isBrickAvailable) {
12526
12679
  return null;
12527
12680
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12561,7 +12714,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12561
12714
  return brick;
12562
12715
  }), [useBrick, data, isBrickAvailable]);
12563
12716
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12564
- var _ref4 = _asyncToGenerator$4(function* (element) {
12717
+ var _ref4 = _asyncToGenerator$3(function* (element) {
12565
12718
  immediatelyRefCallback === null || immediatelyRefCallback === void 0 ? void 0 : immediatelyRefCallback(element);
12566
12719
 
12567
12720
  if (element) {
@@ -12723,7 +12876,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12723
12876
  useImperativeHandle(ref, () => {
12724
12877
  return brickRef.current;
12725
12878
  });
12726
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12879
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12727
12880
  if (!isBrickAvailable) {
12728
12881
  return null;
12729
12882
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12763,7 +12916,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12763
12916
  return brick;
12764
12917
  }), [useBrick, data, isBrickAvailable]);
12765
12918
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12766
- var _ref10 = _asyncToGenerator$4(function* (element) {
12919
+ var _ref10 = _asyncToGenerator$3(function* (element) {
12767
12920
  brickRef.current = element;
12768
12921
 
12769
12922
  if (element) {
@@ -14421,7 +14574,7 @@ function fetchProviderArgs(_x, _x2) {
14421
14574
  }
14422
14575
 
14423
14576
  function _fetchProviderArgs() {
14424
- _fetchProviderArgs = _asyncToGenerator$4(function* (provider, args) {
14577
+ _fetchProviderArgs = _asyncToGenerator$3(function* (provider, args) {
14425
14578
  for (var _len = arguments.length, originalArgs = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
14426
14579
  originalArgs[_key - 2] = arguments[_key];
14427
14580
  }
@@ -14445,7 +14598,7 @@ function fetch(_x) {
14445
14598
  }
14446
14599
 
14447
14600
  function _fetch() {
14448
- _fetch = _asyncToGenerator$4(function* (provider) {
14601
+ _fetch = _asyncToGenerator$3(function* (provider) {
14449
14602
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14450
14603
  args[_key - 1] = arguments[_key];
14451
14604
  }
@@ -14459,7 +14612,7 @@ function _fetch() {
14459
14612
  if (cache.has(cacheKey)) {
14460
14613
  promise = cache.get(cacheKey);
14461
14614
  } else {
14462
- promise = _asyncToGenerator$4(function* () {
14615
+ promise = _asyncToGenerator$3(function* () {
14463
14616
  if (!isCustomApiProvider(provider)) {
14464
14617
  var providerBrick = yield _internalApiGetProviderBrick(provider);
14465
14618
  var providerTagName = providerBrick.tagName.toLowerCase();
@@ -14506,7 +14659,7 @@ function useProvider() {
14506
14659
  var data = useRef(defaults.data);
14507
14660
  var forceUpdate = useReducer(() => ({}), [])[1];
14508
14661
  var doFetch = useCallback( /*#__PURE__*/function () {
14509
- var _ref = _asyncToGenerator$4(function* (provider) {
14662
+ var _ref = _asyncToGenerator$3(function* (provider) {
14510
14663
  try {
14511
14664
  error.current = undefined;
14512
14665
  if (!suspense) setLoading(true);
@@ -14532,7 +14685,7 @@ function useProvider() {
14532
14685
  };
14533
14686
  }(), [provider, customOptions, dependencies, requestInit, suspense, transform, defaults.data, onError]);
14534
14687
  var makeFetch = useCallback( /*#__PURE__*/function () {
14535
- var _ref2 = _asyncToGenerator$4(function* (providerOrBody, args) {
14688
+ var _ref2 = _asyncToGenerator$3(function* (providerOrBody, args) {
14536
14689
  var providerStr = provider;
14537
14690
  var providerArgs = [];
14538
14691
 
@@ -14549,7 +14702,7 @@ function useProvider() {
14549
14702
  var actualArgs = yield fetchProviderArgs(providerStr, providerArgs, requestInit.options);
14550
14703
 
14551
14704
  if (suspense) {
14552
- return _asyncToGenerator$4(function* () {
14705
+ return _asyncToGenerator$3(function* () {
14553
14706
  suspender.current = doFetch(providerStr, ...actualArgs).then(newData => {
14554
14707
  suspenseStatus.current = "success";
14555
14708
  return newData;