@next-core/brick-kit 2.129.1 → 2.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('history'), require('@babel/runtime/helpers/objectSpread2'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/helpers/defineProperty'), require('react'), require('@next-core/brick-utils'), require('lodash'), require('@next-core/brick-http'), require('moment'), require('@next-core/pipes'), require('i18next'), require('@next-core/easyops-analytics'), require('antd'), require('@ant-design/icons'), require('js-yaml'), require('react-i18next'), require('@babel/runtime/helpers/esm/extends'), require('@next-core/illustrations'), require('@babel/runtime/helpers/decorate')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'history', '@babel/runtime/helpers/objectSpread2', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/helpers/defineProperty', 'react', '@next-core/brick-utils', 'lodash', '@next-core/brick-http', 'moment', '@next-core/pipes', 'i18next', '@next-core/easyops-analytics', 'antd', '@ant-design/icons', 'js-yaml', 'react-i18next', '@babel/runtime/helpers/esm/extends', '@next-core/illustrations', '@babel/runtime/helpers/decorate'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$4, global._defineProperty$1, global.React, global.brickUtils, global._, global.brickHttp, global.moment, global.pipes, global.i18next, global.easyopsAnalytics, global.antd, global.icons, global.yaml, global.reactI18next, global._extends, global.illustrations, global._decorate));
5
- })(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$4, _defineProperty$1, React, brickUtils, _, brickHttp, moment, pipes, i18next, easyopsAnalytics, antd, icons, yaml, reactI18next, _extends, illustrations, _decorate) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.BrickKit = {}, global.history$1, global._objectSpread, global._objectWithoutProperties, global._asyncToGenerator$3, global._defineProperty$1, global.React, global.brickUtils, global._, global.brickHttp, global.moment, global.pipes, global.i18next, global.easyopsAnalytics, global.antd, global.icons, global.yaml, global.reactI18next, global._extends, global.illustrations, global._decorate));
5
+ })(this, (function (exports, history$1, _objectSpread, _objectWithoutProperties, _asyncToGenerator$3, _defineProperty$1, React, brickUtils, _, brickHttp, moment, pipes, i18next, easyopsAnalytics, antd, icons, yaml, reactI18next, _extends, illustrations, _decorate) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
10
10
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
11
- var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator$4);
11
+ var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator$3);
12
12
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty$1);
13
13
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
14
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
@@ -444,7 +444,7 @@
444
444
  return ((_window$getComputedSt = window.getComputedStyle(el)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue(name)) || "";
445
445
  }
446
446
 
447
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
447
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
448
448
  try {
449
449
  var info = gen[key](arg);
450
450
  var value = info.value;
@@ -460,7 +460,7 @@
460
460
  }
461
461
  }
462
462
 
463
- function _asyncToGenerator$3(fn) {
463
+ function _asyncToGenerator$2(fn) {
464
464
  return function () {
465
465
  var self = this,
466
466
  args = arguments;
@@ -468,11 +468,11 @@
468
468
  var gen = fn.apply(self, args);
469
469
 
470
470
  function _next(value) {
471
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
471
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
472
472
  }
473
473
 
474
474
  function _throw(err) {
475
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
475
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
476
476
  }
477
477
 
478
478
  _next(undefined);
@@ -535,7 +535,7 @@
535
535
 
536
536
 
537
537
  var InstanceApi_getDetail = /*#__PURE__*/function () {
538
- var _ref = _asyncToGenerator$3(function* (objectId, instanceId, params, options) {
538
+ var _ref = _asyncToGenerator$2(function* (objectId, instanceId, params, options) {
539
539
  return (
540
540
  /**! @contract easyops.api.cmdb.instance.GetDetail */
541
541
  (yield brickHttp.http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2(_objectSpread2({}, options), {}, {
@@ -555,7 +555,7 @@
555
555
 
556
556
 
557
557
  var InstanceApi_postSearch = /*#__PURE__*/function () {
558
- var _ref = _asyncToGenerator$3(function* (objectId, data, options) {
558
+ var _ref = _asyncToGenerator$2(function* (objectId, data, options) {
559
559
  return (
560
560
  /**! @contract easyops.api.cmdb.instance.PostSearch */
561
561
  (yield brickHttp.http.post("api/gateway/cmdb.instance.PostSearch/object/".concat(objectId, "/instance/_search"), data, options)).data
@@ -1332,41 +1332,26 @@
1332
1332
  }
1333
1333
  }
1334
1334
 
1335
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1336
- try {
1337
- var info = gen[key](arg);
1338
- var value = info.value;
1339
- } catch (error) {
1340
- reject(error);
1341
- return;
1342
- }
1343
-
1344
- if (info.done) {
1345
- resolve(value);
1346
- } else {
1347
- Promise.resolve(value).then(_next, _throw);
1348
- }
1349
- }
1350
-
1351
- function _asyncToGenerator$2(fn) {
1352
- return function () {
1353
- var self = this,
1354
- args = arguments;
1355
- return new Promise(function (resolve, reject) {
1356
- var gen = fn.apply(self, args);
1335
+ /**
1336
+ * @description 获取微应用的i18n数据
1337
+ * @endpoint GET /api/v1/micro-app/i18n
1338
+ */
1357
1339
 
1358
- function _next(value) {
1359
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1360
- }
1361
1340
 
1362
- function _throw(err) {
1363
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1364
- }
1341
+ var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
1342
+ var _ref = _asyncToGenerator__default["default"](function* (params, options) {
1343
+ return (
1344
+ /**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */
1345
+ (yield brickHttp.http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
1346
+ params
1347
+ }))).data
1348
+ );
1349
+ });
1365
1350
 
1366
- _next(undefined);
1367
- });
1351
+ return function InstalledMicroAppApi_getI18NData(_x, _x2) {
1352
+ return _ref.apply(this, arguments);
1368
1353
  };
1369
- }
1354
+ }();
1370
1355
  /**
1371
1356
  * @description 查询模型关联小产品列表
1372
1357
  * @endpoint LIST /api/micro_app/v1/object_micro_app
@@ -1374,9 +1359,9 @@
1374
1359
 
1375
1360
 
1376
1361
  var ObjectMicroAppApi_getObjectMicroAppList = /*#__PURE__*/function () {
1377
- var _ref = _asyncToGenerator$2(function* (options) {
1362
+ var _ref = _asyncToGenerator__default["default"](function* (options) {
1378
1363
  return (
1379
- /**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList */
1364
+ /**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList@1.0.0 */
1380
1365
  (yield brickHttp.http.get("api/gateway/micro_app.object_micro_app.GetObjectMicroAppList/api/micro_app/v1/object_micro_app", options)).data
1381
1366
  );
1382
1367
  });
@@ -1392,9 +1377,9 @@
1392
1377
 
1393
1378
 
1394
1379
  var PermissionApi_validatePermissions = /*#__PURE__*/function () {
1395
- var _ref = _asyncToGenerator$2(function* (data, options) {
1380
+ var _ref = _asyncToGenerator__default["default"](function* (data, options) {
1396
1381
  return (
1397
- /**! @contract easyops.api.micro_app.permission.ValidatePermissions */
1382
+ /**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */
1398
1383
  (yield brickHttp.http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
1399
1384
  );
1400
1385
  });
@@ -1579,6 +1564,44 @@
1579
1564
  });
1580
1565
  }
1581
1566
 
1567
+ var misc;
1568
+ function getRuntimeMisc() {
1569
+ if (!misc) {
1570
+ misc = {
1571
+ isInIframe: false,
1572
+ isInIframeOfSameSite: false,
1573
+ isInIframeOfNext: false,
1574
+ isInIframeOfVisualBuilder: false,
1575
+ isInIframeOfLegacyConsole: false
1576
+ };
1577
+
1578
+ if (window !== window.parent) {
1579
+ misc.isInIframe = true;
1580
+
1581
+ try {
1582
+ // Handle:
1583
+ // - Previewing in visual builder by iframe.
1584
+ // - Nesting next in next.
1585
+ // - Nesting console in next.
1586
+ if (window.origin === window.parent.origin) {
1587
+ misc.isInIframeOfSameSite = true;
1588
+ var selfIsNext = getBasePath() === "/next/";
1589
+ var parentPathname = window.parent.location.pathname;
1590
+ var parentIsNext = parentPathname.startsWith("/next/");
1591
+ misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
1592
+ misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
1593
+ misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
1594
+ }
1595
+ } catch (e) {// do nothing
1596
+ }
1597
+ }
1598
+
1599
+ Object.freeze(misc);
1600
+ }
1601
+
1602
+ return misc;
1603
+ }
1604
+
1582
1605
  // `GeneralGlobals` are globals which are page-state-agnostic,
1583
1606
  // thus they can be used both in storyboard expressions and functions.
1584
1607
  function getGeneralGlobals(attemptToVisitGlobals, options) {
@@ -1631,6 +1654,9 @@
1631
1654
  getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue
1632
1655
  };
1633
1656
 
1657
+ case "RUNTIME_MISC":
1658
+ return collectCoverage ? fakeRuntimeMisc() : getRuntimeMisc();
1659
+
1634
1660
  case "console":
1635
1661
  return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
1636
1662
 
@@ -1666,6 +1692,16 @@
1666
1692
  return true;
1667
1693
  }
1668
1694
 
1695
+ function fakeRuntimeMisc() {
1696
+ return {
1697
+ isInIframe: false,
1698
+ isInIframeOfSameSite: false,
1699
+ isInIframeOfNext: false,
1700
+ isInIframeOfVisualBuilder: false,
1701
+ isInIframeOfLegacyConsole: false
1702
+ };
1703
+ }
1704
+
1669
1705
  /** @internal */
1670
1706
 
1671
1707
  /** @internal */
@@ -2977,7 +3013,8 @@
2977
3013
  }
2978
3014
 
2979
3015
  var _excluded$6 = ["children"],
2980
- _excluded2$2 = ["items", "app"];
3016
+ _excluded2$2 = ["children"],
3017
+ _excluded3 = ["items", "app"];
2981
3018
  var symbolAppId = Symbol("appId");
2982
3019
  // Caching menu requests to avoid flicker.
2983
3020
  var menuCache = new Map();
@@ -3161,10 +3198,13 @@
3161
3198
  items,
3162
3199
  app
3163
3200
  } = _yield$fetchMenuById,
3164
- restMenuData = _objectWithoutProperties__default["default"](_yield$fetchMenuById, _excluded2$2);
3201
+ restMenuData = _objectWithoutProperties__default["default"](_yield$fetchMenuById, _excluded3);
3202
+
3203
+ var appIds = collectOverrideApps(items, app[0].appId, context.app.id);
3204
+ yield kernel.fulfilStoryboardI18n(appIds);
3165
3205
 
3166
- var menuData = _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3167
- items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
3206
+ var menuData = _objectSpread__default["default"](_objectSpread__default["default"]({}, computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3207
+ items: computeMenuItemsWithOverrideApp(items, context, kernel)
3168
3208
  });
3169
3209
 
3170
3210
  return {
@@ -3196,26 +3236,48 @@
3196
3236
  return _processMenu.apply(this, arguments);
3197
3237
  }
3198
3238
 
3199
- function computeMenuItemsWithOverrideApp(items, context, kernel) {
3200
- return Promise.all(items.map( /*#__PURE__*/function () {
3201
- var _ref2 = _asyncToGenerator__default["default"](function* (_ref) {
3239
+ function collectOverrideApps(items, rootAppId, contextAppId) {
3240
+ var appIds = new Set();
3241
+
3242
+ if (rootAppId !== contextAppId) {
3243
+ appIds.add(rootAppId);
3244
+ }
3245
+
3246
+ function collect(items) {
3247
+ for (var _ref of items) {
3202
3248
  var {
3203
3249
  children
3204
3250
  } = _ref,
3205
3251
  rest = _objectWithoutProperties__default["default"](_ref, _excluded$6);
3206
3252
 
3207
- return _objectSpread__default["default"](_objectSpread__default["default"]({}, yield computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3208
- children: children && (yield computeMenuItemsWithOverrideApp(children, context, kernel))
3209
- });
3210
- });
3253
+ var overrideAppId = rest[symbolAppId];
3211
3254
 
3212
- return function (_x16) {
3213
- return _ref2.apply(this, arguments);
3214
- };
3215
- }()));
3255
+ if (overrideAppId !== contextAppId && !appIds.has(overrideAppId) && requireOverrideApp(rest)) {
3256
+ appIds.add(overrideAppId);
3257
+ }
3258
+
3259
+ children && collect(children);
3260
+ }
3261
+ }
3262
+
3263
+ collect(items);
3264
+ return [...appIds];
3216
3265
  }
3217
3266
 
3218
- function processMenuTitle(_x17) {
3267
+ function computeMenuItemsWithOverrideApp(items, context, kernel) {
3268
+ return items.map(_ref2 => {
3269
+ var {
3270
+ children
3271
+ } = _ref2,
3272
+ rest = _objectWithoutProperties__default["default"](_ref2, _excluded2$2);
3273
+
3274
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3275
+ children: children && computeMenuItemsWithOverrideApp(children, context, kernel)
3276
+ });
3277
+ });
3278
+ }
3279
+
3280
+ function processMenuTitle(_x16) {
3219
3281
  return _processMenuTitle.apply(this, arguments);
3220
3282
  }
3221
3283
 
@@ -3310,30 +3372,22 @@
3310
3372
  return false;
3311
3373
  }
3312
3374
 
3313
- function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3314
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3315
- }
3316
-
3317
- function _computeRealValueWithOverrideApp() {
3318
- _computeRealValueWithOverrideApp = _asyncToGenerator__default["default"](function* (data, overrideAppId, context, kernel) {
3319
- var newContext = context;
3375
+ function computeRealValueWithOverrideApp(data, overrideAppId, context, kernel) {
3376
+ var newContext = context;
3320
3377
 
3321
- if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3322
- var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3378
+ if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3379
+ var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3323
3380
 
3324
- if (storyboard) {
3325
- yield kernel.fulfilStoryboard(storyboard);
3326
- newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
3327
- overrideApp: storyboard.app
3328
- });
3329
- }
3381
+ if (storyboard) {
3382
+ newContext = _objectSpread__default["default"](_objectSpread__default["default"]({}, context), {}, {
3383
+ overrideApp: storyboard.app
3384
+ });
3330
3385
  }
3386
+ }
3331
3387
 
3332
- return computeRealValue(data, newContext, true, {
3333
- ignoreSymbols: true
3334
- });
3388
+ return computeRealValue(data, newContext, true, {
3389
+ ignoreSymbols: true
3335
3390
  });
3336
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3337
3391
  }
3338
3392
 
3339
3393
  var lazyBrickRegistry = new Map();
@@ -4016,11 +4070,8 @@
4016
4070
  content: /*#__PURE__*/React__default["default"].createElement("div", {
4017
4071
  style: {
4018
4072
  whiteSpace: "pre-wrap"
4019
- },
4020
- dangerouslySetInnerHTML: {
4021
- __html: httpErrorToString(error)
4022
4073
  }
4023
- }),
4074
+ }, httpErrorToString(error)),
4024
4075
  okText: i18next__default["default"].t("".concat(NS_BRICK_KIT, ":").concat(K.MODAL_OK))
4025
4076
  });
4026
4077
  }
@@ -8990,7 +9041,8 @@
8990
9041
  return _asyncToGenerator__default["default"](function* () {
8991
9042
  if (window.STANDALONE_MICRO_APPS) {
8992
9043
  Object.assign(storyboard, {
8993
- $$fulfilled: true
9044
+ $$fulfilled: true,
9045
+ $$fulfilling: null
8994
9046
  });
8995
9047
 
8996
9048
  if (!window.NO_AUTH_GUARD) {
@@ -9023,7 +9075,8 @@
9023
9075
  routes,
9024
9076
  meta,
9025
9077
  app: _objectSpread__default["default"](_objectSpread__default["default"]({}, storyboard.app), app),
9026
- $$fulfilled: true
9078
+ $$fulfilled: true,
9079
+ $$fulfilling: null
9027
9080
  });
9028
9081
  }
9029
9082
 
@@ -9032,9 +9085,12 @@
9032
9085
  }
9033
9086
 
9034
9087
  postProcessStoryboard(storyboard) {
9035
- var _storyboard$meta;
9036
-
9037
9088
  storyboard.app.$$routeAliasMap = brickUtils.scanRouteAliasInStoryboard(storyboard);
9089
+ this.postProcessStoryboardI18n(storyboard);
9090
+ }
9091
+
9092
+ postProcessStoryboardI18n(storyboard) {
9093
+ var _storyboard$meta;
9038
9094
 
9039
9095
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
9040
9096
  // Prefix to avoid conflict between brick package's i18n namespace.
@@ -9047,10 +9103,70 @@
9047
9103
  }
9048
9104
  }
9049
9105
 
9106
+ fulfilStoryboardI18n(appIds) {
9107
+ var _this7 = this;
9108
+
9109
+ return _asyncToGenerator__default["default"](function* () {
9110
+ // Ignore already fulfilled apps.
9111
+ var filteredStoryboards = appIds.map(appId => _this7.bootstrapData.storyboards.find(story => story.app.id === appId)).filter(story => story && !story.$$fulfilled && !story.$$i18nFulfilled);
9112
+
9113
+ if (window.STANDALONE_MICRO_APPS) {
9114
+ // Fallback to fullfil whole storyboard for standalone micro-apps.
9115
+ yield Promise.all(filteredStoryboards.map(story => _this7.fulfilStoryboard(story)));
9116
+ return;
9117
+ } // Do not fulfil i18n if the app is doing a whole fulfilling.
9118
+
9119
+
9120
+ var fulfilling = [];
9121
+ var filteredAppIds = [];
9122
+
9123
+ for (var story of filteredStoryboards) {
9124
+ if (story.$$fulfilling) {
9125
+ fulfilling.push(story.$$fulfilling);
9126
+ } else {
9127
+ filteredAppIds.push(story.app.id);
9128
+ }
9129
+ }
9130
+
9131
+ if (filteredAppIds.length === 0) {
9132
+ // Still wait for these whole fulfilling.
9133
+ yield Promise.all(fulfilling);
9134
+ return;
9135
+ }
9136
+
9137
+ var [{
9138
+ i18nInfo
9139
+ }] = yield Promise.all([InstalledMicroAppApi_getI18NData({
9140
+ appIds: filteredAppIds.join(",")
9141
+ }), // Still wait for these whole fulfilling.
9142
+ ...fulfilling]);
9143
+
9144
+ var _loop = function (appId, i18n) {
9145
+ var storyboard = _this7.bootstrapData.storyboards.find(story => story.app.id === appId);
9146
+
9147
+ Object.assign(storyboard, {
9148
+ meta: _objectSpread__default["default"](_objectSpread__default["default"]({}, storyboard.meta), {}, {
9149
+ i18n: i18n
9150
+ }),
9151
+ $$i18nFulfilled: true
9152
+ });
9153
+
9154
+ _this7.postProcessStoryboardI18n(storyboard);
9155
+ };
9156
+
9157
+ for (var {
9158
+ appId,
9159
+ i18n
9160
+ } of i18nInfo) {
9161
+ _loop(appId, i18n);
9162
+ }
9163
+ })();
9164
+ }
9165
+
9050
9166
  _dev_only_updateStoryboard(appId, storyboardPatch) {
9051
9167
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9052
9168
  Object.assign(storyboard, _objectSpread__default["default"](_objectSpread__default["default"]({}, storyboardPatch), {}, {
9053
- $$fulfilling: Promise.resolve(),
9169
+ $$fulfilling: null,
9054
9170
  $$fulfilled: true,
9055
9171
  $$registerCustomTemplateProcessed: false,
9056
9172
  $$depsProcessed: false
@@ -9173,7 +9289,7 @@
9173
9289
 
9174
9290
  gracefullyLoadDeps(fn) {
9175
9291
  var _arguments = arguments,
9176
- _this7 = this;
9292
+ _this8 = this;
9177
9293
 
9178
9294
  return _asyncToGenerator__default["default"](function* () {
9179
9295
  for (var _len = _arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -9187,7 +9303,7 @@
9187
9303
  // The scripts maybe stale when a user stays in page while upgrades been applied.
9188
9304
  // So we force reloading again automatically.
9189
9305
  // NOTE: reload only once to avoid a infinite loop.
9190
- yield _this7.reloadMicroApps();
9306
+ yield _this8.reloadMicroApps();
9191
9307
  yield fn(...args);
9192
9308
  } else {
9193
9309
  throw e;
@@ -9236,7 +9352,7 @@
9236
9352
  }
9237
9353
 
9238
9354
  loadDynamicBricksInBrickConf(brickConf) {
9239
- var _this8 = this;
9355
+ var _this9 = this;
9240
9356
 
9241
9357
  return _asyncToGenerator__default["default"](function* () {
9242
9358
  // Notice: `brickConf` contains runtime data,
@@ -9244,7 +9360,7 @@
9244
9360
  // which could cause stack overflow while traversing.
9245
9361
  var bricks = brickUtils.scanBricksInBrickConf(brickConf);
9246
9362
  var processors = brickUtils.scanProcessorsInAny(brickConf);
9247
- yield _this8.loadDynamicBricks(bricks, processors);
9363
+ yield _this9.loadDynamicBricks(bricks, processors);
9248
9364
  })();
9249
9365
  }
9250
9366
 
@@ -9353,10 +9469,10 @@
9353
9469
  }
9354
9470
 
9355
9471
  getMicroAppApiOrchestrationMapAsync() {
9356
- var _this9 = this;
9472
+ var _this10 = this;
9357
9473
 
9358
9474
  return _asyncToGenerator__default["default"](function* () {
9359
- return yield _this9.allMicroAppApiOrchestrationPromise;
9475
+ return yield _this10.allMicroAppApiOrchestrationPromise;
9360
9476
  })();
9361
9477
  }
9362
9478
 
@@ -9448,14 +9564,14 @@
9448
9564
  }
9449
9565
 
9450
9566
  getRelatedAppsAsync(appId) {
9451
- var _this10 = this;
9567
+ var _this11 = this;
9452
9568
 
9453
9569
  return _asyncToGenerator__default["default"](function* () {
9454
9570
  if (!appId) {
9455
9571
  return [];
9456
9572
  }
9457
9573
 
9458
- var allRelatedApps = yield _this10.allRelatedAppsPromise;
9574
+ var allRelatedApps = yield _this11.allRelatedAppsPromise;
9459
9575
  var thisApp = allRelatedApps.find(item => item.microAppId === appId);
9460
9576
 
9461
9577
  if (!thisApp) {
@@ -9467,38 +9583,38 @@
9467
9583
  }
9468
9584
 
9469
9585
  updateWorkspaceStack() {
9470
- var _this11 = this;
9586
+ var _this12 = this;
9471
9587
 
9472
9588
  return _asyncToGenerator__default["default"](function* () {
9473
- if (_this11.currentApp && _this11.currentApp.id) {
9589
+ if (_this12.currentApp && _this12.currentApp.id) {
9474
9590
  var workspace = {
9475
- appId: _this11.currentApp.id,
9476
- appName: _this11.currentApp.name,
9477
- appLocaleName: _this11.currentApp.localeName,
9478
- url: _this11.currentUrl
9591
+ appId: _this12.currentApp.id,
9592
+ appName: _this12.currentApp.name,
9593
+ appLocaleName: _this12.currentApp.localeName,
9594
+ url: _this12.currentUrl
9479
9595
  };
9480
9596
 
9481
- if (_this11.workspaceStack.length > 0) {
9482
- var previousWorkspace = _this11.workspaceStack[_this11.workspaceStack.length - 1];
9597
+ if (_this12.workspaceStack.length > 0) {
9598
+ var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
9483
9599
 
9484
- var _relatedApps = yield _this11.getRelatedAppsAsync(previousWorkspace.appId);
9600
+ var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
9485
9601
 
9486
- if (_relatedApps.some(item => item.microAppId === _this11.currentApp.id)) {
9602
+ if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
9487
9603
  Object.assign(previousWorkspace, workspace);
9488
9604
  return;
9489
9605
  }
9490
9606
  }
9491
9607
 
9492
- var relatedApps = yield _this11.getRelatedAppsAsync(_this11.currentApp.id);
9608
+ var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
9493
9609
 
9494
9610
  if (relatedApps.length > 0) {
9495
- _this11.workspaceStack.push(workspace);
9611
+ _this12.workspaceStack.push(workspace);
9496
9612
 
9497
9613
  return;
9498
9614
  }
9499
9615
  }
9500
9616
 
9501
- _this11.workspaceStack = [];
9617
+ _this12.workspaceStack = [];
9502
9618
  })();
9503
9619
  }
9504
9620
 
@@ -9545,22 +9661,22 @@
9545
9661
  }
9546
9662
 
9547
9663
  getProviderBrick(provider) {
9548
- var _this12 = this;
9664
+ var _this13 = this;
9549
9665
 
9550
9666
  return _asyncToGenerator__default["default"](function* () {
9551
9667
  if (isCustomApiProvider(provider)) {
9552
9668
  provider = CUSTOM_API_PROVIDER;
9553
9669
  }
9554
9670
 
9555
- if (_this12.providerRepository.has(provider)) {
9556
- return _this12.providerRepository.get(provider);
9671
+ if (_this13.providerRepository.has(provider)) {
9672
+ return _this13.providerRepository.get(provider);
9557
9673
  }
9558
9674
 
9559
9675
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
9560
9676
  registerCustomApi();
9561
9677
  }
9562
9678
 
9563
- yield _this12.loadDynamicBricks([provider]);
9679
+ yield _this13.loadDynamicBricks([provider]);
9564
9680
 
9565
9681
  if (!customElements.get(provider)) {
9566
9682
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -9568,7 +9684,7 @@
9568
9684
 
9569
9685
  var brick = document.createElement(provider);
9570
9686
 
9571
- _this12.providerRepository.set(provider, brick);
9687
+ _this13.providerRepository.set(provider, brick);
9572
9688
 
9573
9689
  return brick;
9574
9690
  })();
@@ -9740,44 +9856,6 @@
9740
9856
  return conf.type === "routes";
9741
9857
  }
9742
9858
 
9743
- var misc;
9744
- function getRuntimeMisc() {
9745
- if (!misc) {
9746
- misc = {
9747
- isInIframe: false,
9748
- isInIframeOfSameSite: false,
9749
- isInIframeOfNext: false,
9750
- isInIframeOfVisualBuilder: false,
9751
- isInIframeOfLegacyConsole: false
9752
- };
9753
-
9754
- if (window !== window.parent) {
9755
- misc.isInIframe = true;
9756
-
9757
- try {
9758
- // Handle:
9759
- // - Previewing in visual builder by iframe.
9760
- // - Nesting next in next.
9761
- // - Nesting console in next.
9762
- if (window.origin === window.parent.origin) {
9763
- misc.isInIframeOfSameSite = true;
9764
- var selfIsNext = getBasePath() === "/next/";
9765
- var parentPathname = window.parent.location.pathname;
9766
- var parentIsNext = parentPathname.startsWith("/next/");
9767
- misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
9768
- misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
9769
- misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
9770
- }
9771
- } catch (e) {// do nothing
9772
- }
9773
- }
9774
-
9775
- Object.freeze(misc);
9776
- }
9777
-
9778
- return misc;
9779
- }
9780
-
9781
9859
  function getSubStoryboardByRoute(storyboard, matcher) {
9782
9860
  function getSubRoutes(routes) {
9783
9861
  return matcher(routes).map(getSubRoute);