@next-core/brick-kit 2.89.1 → 2.90.2

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
@@ -2,13 +2,13 @@ import { createBrowserHistory, locationsAreEqual, createPath } from 'history';
2
2
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
4
  import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
5
- import _defineProperty$2 from '@babel/runtime/helpers/defineProperty';
5
+ import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
6
  import * as React from 'react';
7
7
  import React__default, { useState, useEffect, forwardRef, useRef, useImperativeHandle, useMemo, useContext, createContext } from 'react';
8
- import lodash, { set, get, difference, cloneDeep, isNil, sortBy, merge, clamp, uniqueId, orderBy, omit, isEmpty } from 'lodash';
8
+ import lodash, { set, get, difference, identity, cloneDeep, isNil, sortBy, merge, clamp, uniqueId, orderBy, omit, isEmpty } from 'lodash';
9
9
  import { toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, scanPermissionActionsInStoryboard, precookFunction, cook, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, scanRouteAliasInStoryboard, loadScript, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, getDllAndDepsByResource, resolveContextConcurrently, matchPath, asyncProcessBrick, restoreDynamicTemplates, mapCustomApisToNameAndNamespace, scanCustomApisInStoryboard } from '@next-core/brick-utils';
10
10
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
11
- import i18next from 'i18next';
11
+ import i18next, { getFixedT } from 'i18next';
12
12
  import moment from 'moment';
13
13
  import { pipes } from '@next-core/pipes';
14
14
  import { userAnalytics, apiAnalyzer } from '@next-core/easyops-analytics';
@@ -22,9 +22,9 @@ import _decorate from '@babel/runtime/helpers/decorate';
22
22
 
23
23
  class BaseBar {
24
24
  constructor(kernel, mountPoint) {
25
- _defineProperty$2(this, "element", void 0);
25
+ _defineProperty$1(this, "element", void 0);
26
26
 
27
- _defineProperty$2(this, "brick", void 0);
27
+ _defineProperty$1(this, "brick", void 0);
28
28
 
29
29
  this.kernel = kernel;
30
30
  this.mountPoint = mountPoint;
@@ -409,7 +409,7 @@ function _asyncToGenerator$3(fn) {
409
409
  };
410
410
  }
411
411
 
412
- function _defineProperty$1(obj, key, value) {
412
+ function _defineProperty(obj, key, value) {
413
413
  if (key in obj) {
414
414
  Object.defineProperty(obj, key, {
415
415
  value: value,
@@ -424,7 +424,7 @@ function _defineProperty$1(obj, key, value) {
424
424
  return obj;
425
425
  }
426
426
 
427
- function ownKeys$1(object, enumerableOnly) {
427
+ function ownKeys(object, enumerableOnly) {
428
428
  var keys = Object.keys(object);
429
429
 
430
430
  if (Object.getOwnPropertySymbols) {
@@ -438,18 +438,18 @@ function ownKeys$1(object, enumerableOnly) {
438
438
  return keys;
439
439
  }
440
440
 
441
- function _objectSpread2$1(target) {
441
+ function _objectSpread2(target) {
442
442
  for (var i = 1; i < arguments.length; i++) {
443
443
  var source = arguments[i] != null ? arguments[i] : {};
444
444
 
445
445
  if (i % 2) {
446
- ownKeys$1(Object(source), true).forEach(function (key) {
447
- _defineProperty$1(target, key, source[key]);
446
+ ownKeys(Object(source), true).forEach(function (key) {
447
+ _defineProperty(target, key, source[key]);
448
448
  });
449
449
  } else if (Object.getOwnPropertyDescriptors) {
450
450
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
451
451
  } else {
452
- ownKeys$1(Object(source)).forEach(function (key) {
452
+ ownKeys(Object(source)).forEach(function (key) {
453
453
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
454
454
  });
455
455
  }
@@ -467,7 +467,7 @@ var InstanceApi_getDetail = /*#__PURE__*/function () {
467
467
  var _ref = _asyncToGenerator$3(function* (objectId, instanceId, params, options) {
468
468
  return (
469
469
  /**! @contract easyops.api.cmdb.instance.GetDetail */
470
- (yield http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2$1(_objectSpread2$1({}, options), {}, {
470
+ (yield http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2(_objectSpread2({}, options), {}, {
471
471
  params
472
472
  }))).data
473
473
  );
@@ -668,12 +668,12 @@ function getUrlBySegueFactory(app, segues) {
668
668
  };
669
669
  }
670
670
 
671
- function imagesFactory(app) {
671
+ function imagesFactory(appId, isBuildPush) {
672
672
  return {
673
673
  get(name) {
674
674
  var _window$PUBLIC_ROOT;
675
675
 
676
- return app.isBuildPush ? "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/".concat(name) : "".concat((_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "", "micro-apps/").concat(app.id, "/images/").concat(name);
676
+ return isBuildPush ? "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/".concat(name) : "".concat((_window$PUBLIC_ROOT = window.PUBLIC_ROOT) !== null && _window$PUBLIC_ROOT !== void 0 ? _window$PUBLIC_ROOT : "", "micro-apps/").concat(appId, "/images/").concat(name);
677
677
  }
678
678
 
679
679
  };
@@ -1372,11 +1372,55 @@ function i18nText(data) {
1372
1372
  }
1373
1373
  }
1374
1374
 
1375
+ var locale$7 = {
1376
+ [K.REQUEST_FAILED]: "Request Failed",
1377
+ [K.MODAL_OK]: "Ok",
1378
+ [K.MODAL_CANCEL]: "Cancel",
1379
+ [K.SOMETHING_WENT_WRONG]: "Something went wrong!",
1380
+ [K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
1381
+ [K.NETWORK_ERROR]: "Network error, please check your network."
1382
+ };
1383
+ var en = locale$7;
1384
+
1385
+ var locale$6 = {
1386
+ [K.REQUEST_FAILED]: "请求失败",
1387
+ [K.MODAL_OK]: "确认",
1388
+ [K.MODAL_CANCEL]: "取消",
1389
+ [K.SOMETHING_WENT_WRONG]: "出现了一些问题!",
1390
+ [K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
1391
+ [K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
1392
+ };
1393
+ var zh = locale$6;
1394
+
1395
+ /** @internal */
1396
+
1397
+ var initI18n = () => {
1398
+ i18next.addResourceBundle("en", NS_BRICK_KIT, en);
1399
+ i18next.addResourceBundle("zh", NS_BRICK_KIT, zh);
1400
+ };
1401
+ /** @internal */
1402
+
1403
+ function getI18nNamespace(type, id) {
1404
+ return "$".concat(type, "-").concat(id);
1405
+ }
1406
+
1407
+ function registerWidgetI18n(widgetId, i18n) {
1408
+ var ns = getI18nNamespace("widget", widgetId);
1409
+ Object.entries(i18n).forEach(_ref => {
1410
+ var [lang, resources] = _ref;
1411
+ i18next.addResourceBundle(lang, ns, resources);
1412
+ });
1413
+ }
1414
+ function widgetI18nFactory(widgetId) {
1415
+ return getFixedT(null, getI18nNamespace("widget", widgetId));
1416
+ }
1417
+
1375
1418
  /** @internal */
1376
1419
 
1377
1420
  /** @internal */
1378
1421
  function StoryboardFunctionRegistryFactory() {
1379
1422
  var {
1423
+ widgetId,
1380
1424
  collectCoverage
1381
1425
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1382
1426
  var registeredFunctions = new Map(); // Use `Proxy` with a frozen target, to make a readonly function registry.
@@ -1388,7 +1432,30 @@ function StoryboardFunctionRegistryFactory() {
1388
1432
 
1389
1433
  });
1390
1434
 
1391
- function registerStoryboardFunctions(functions) {
1435
+ var builtinSupply = _objectSpread({
1436
+ // Functions can call other functions.
1437
+ FN: storyboardFunctions
1438
+ }, collectCoverage ? {
1439
+ // Fake builtin methods for tests.
1440
+ I18N: identity,
1441
+ I18N_TEXT: fakeI18nText,
1442
+ IMG: fakeImageFactory()
1443
+ } : widgetId ? {
1444
+ I18N: widgetI18nFactory(widgetId),
1445
+ I18N_TEXT: i18nText,
1446
+ IMG: widgetImagesFactory(widgetId)
1447
+ } : {
1448
+ I18N_TEXT: i18nText
1449
+ });
1450
+
1451
+ function registerStoryboardFunctions(functions, app) {
1452
+ if (app) {
1453
+ Object.assign(builtinSupply, {
1454
+ I18N: getFixedT(null, getI18nNamespace("app", app.id)),
1455
+ IMG: imagesFactory(app.id, app.isBuildPush)
1456
+ });
1457
+ }
1458
+
1392
1459
  registeredFunctions.clear();
1393
1460
 
1394
1461
  if (Array.isArray(functions)) {
@@ -1428,10 +1495,7 @@ function StoryboardFunctionRegistryFactory() {
1428
1495
  rules: {
1429
1496
  noVar: true
1430
1497
  },
1431
- globalVariables: supply(precooked.attemptToVisitGlobals, {
1432
- // Functions can call other functions.
1433
- FN: storyboardFunctions
1434
- }),
1498
+ globalVariables: supply(precooked.attemptToVisitGlobals, builtinSupply),
1435
1499
  hooks: collector && {
1436
1500
  beforeEvaluate: collector.beforeEvaluate,
1437
1501
  beforeCall: collector.beforeCall,
@@ -1456,6 +1520,19 @@ function StoryboardFunctionRegistryFactory() {
1456
1520
  };
1457
1521
  }
1458
1522
 
1523
+ function fakeI18nText(data) {
1524
+ return data === null || data === void 0 ? void 0 : data.en;
1525
+ }
1526
+
1527
+ function fakeImageFactory() {
1528
+ return {
1529
+ get(name) {
1530
+ return "mock/images/".concat(name);
1531
+ }
1532
+
1533
+ };
1534
+ }
1535
+
1459
1536
  var {
1460
1537
  storyboardFunctions,
1461
1538
  registerStoryboardFunctions
@@ -1477,7 +1554,9 @@ function registerWidgetFunctions(widgetId, functions) {
1477
1554
  var {
1478
1555
  storyboardFunctions,
1479
1556
  registerStoryboardFunctions
1480
- } = StoryboardFunctionRegistryFactory();
1557
+ } = StoryboardFunctionRegistryFactory({
1558
+ widgetId
1559
+ });
1481
1560
  widgetFunctionRegistry.set(widgetId, storyboardFunctions);
1482
1561
  registerStoryboardFunctions(functions);
1483
1562
  }
@@ -1648,7 +1727,7 @@ function evaluate(raw) {
1648
1727
  }
1649
1728
 
1650
1729
  if (attemptToVisitGlobals.has("IMG")) {
1651
- globalVariables.IMG = imagesFactory(app);
1730
+ globalVariables.IMG = imagesFactory(app.id, app.isBuildPush);
1652
1731
  }
1653
1732
 
1654
1733
  if (attemptToVisitGlobals.has("__WIDGET_IMG__")) {
@@ -1656,7 +1735,11 @@ function evaluate(raw) {
1656
1735
  }
1657
1736
 
1658
1737
  if (attemptToVisitGlobals.has("I18N")) {
1659
- globalVariables.I18N = i18next.getFixedT(null, "$app-".concat(app.id));
1738
+ globalVariables.I18N = i18next.getFixedT(null, getI18nNamespace("app", app.id));
1739
+ }
1740
+
1741
+ if (attemptToVisitGlobals.has("__WIDGET_I18N__")) {
1742
+ globalVariables.__WIDGET_I18N__ = widgetI18nFactory;
1660
1743
  }
1661
1744
 
1662
1745
  if (attemptToVisitGlobals.has("I18N_TEXT")) {
@@ -2438,21 +2521,23 @@ function _dev_only_getFakeKernel(overrides) {
2438
2521
  }
2439
2522
  class Runtime {
2440
2523
  constructor() {
2441
- _defineProperty$2(this, "registerBrickTemplate", registerBrickTemplate);
2524
+ _defineProperty$1(this, "registerBrickTemplate", registerBrickTemplate);
2525
+
2526
+ _defineProperty$1(this, "registerCustomTemplate", registerCustomTemplate);
2442
2527
 
2443
- _defineProperty$2(this, "registerCustomTemplate", registerCustomTemplate);
2528
+ _defineProperty$1(this, "registerCustomProcessor", registerCustomProcessor);
2444
2529
 
2445
- _defineProperty$2(this, "registerCustomProcessor", registerCustomProcessor);
2530
+ _defineProperty$1(this, "registerLazyBricks", registerLazyBricks);
2446
2531
 
2447
- _defineProperty$2(this, "registerLazyBricks", registerLazyBricks);
2532
+ _defineProperty$1(this, "registerWidgetFunctions", registerWidgetFunctions);
2448
2533
 
2449
- _defineProperty$2(this, "registerWidgetFunctions", registerWidgetFunctions);
2534
+ _defineProperty$1(this, "registerWidgetI18n", registerWidgetI18n);
2450
2535
 
2451
- _defineProperty$2(this, "getBasePath", getBasePath);
2536
+ _defineProperty$1(this, "getBasePath", getBasePath);
2452
2537
 
2453
- _defineProperty$2(this, "getCurrentTheme", getCurrentTheme);
2538
+ _defineProperty$1(this, "getCurrentTheme", getCurrentTheme);
2454
2539
 
2455
- _defineProperty$2(this, "getCurrentMode", getCurrentMode);
2540
+ _defineProperty$1(this, "getCurrentMode", getCurrentMode);
2456
2541
  }
2457
2542
 
2458
2543
  bootstrap(mountPoints) {
@@ -3011,13 +3096,13 @@ function LoginTimeoutMessage() {
3011
3096
 
3012
3097
  class WebsocketMessageRequest {
3013
3098
  constructor(event, topic) {
3014
- _defineProperty$2(this, "topic", void 0);
3099
+ _defineProperty$1(this, "topic", void 0);
3015
3100
 
3016
- _defineProperty$2(this, "data", void 0);
3101
+ _defineProperty$1(this, "data", void 0);
3017
3102
 
3018
- _defineProperty$2(this, "event", void 0);
3103
+ _defineProperty$1(this, "event", void 0);
3019
3104
 
3020
- _defineProperty$2(this, "message", void 0);
3105
+ _defineProperty$1(this, "message", void 0);
3021
3106
 
3022
3107
  this.event = event;
3023
3108
  this.topic = JSON.stringify(topic);
@@ -3062,13 +3147,13 @@ var PluginWebSocketMessageEvent;
3062
3147
 
3063
3148
  class WebsocketMessageResponse {
3064
3149
  constructor(response) {
3065
- _defineProperty$2(this, "topic", void 0);
3150
+ _defineProperty$1(this, "topic", void 0);
3066
3151
 
3067
- _defineProperty$2(this, "data", void 0);
3152
+ _defineProperty$1(this, "data", void 0);
3068
3153
 
3069
- _defineProperty$2(this, "event", void 0);
3154
+ _defineProperty$1(this, "event", void 0);
3070
3155
 
3071
- _defineProperty$2(this, "message", void 0);
3156
+ _defineProperty$1(this, "message", void 0);
3072
3157
 
3073
3158
  this.data = response;
3074
3159
  this.message = JSON.parse(response);
@@ -3116,19 +3201,19 @@ class WebsocketMessageResponse {
3116
3201
 
3117
3202
  class WebSocketService {
3118
3203
  constructor(options) {
3119
- _defineProperty$2(this, "retryCount", 0);
3204
+ _defineProperty$1(this, "retryCount", 0);
3120
3205
 
3121
- _defineProperty$2(this, "ws", null);
3206
+ _defineProperty$1(this, "ws", null);
3122
3207
 
3123
- _defineProperty$2(this, "lockReconnect", false);
3208
+ _defineProperty$1(this, "lockReconnect", false);
3124
3209
 
3125
- _defineProperty$2(this, "options", void 0);
3210
+ _defineProperty$1(this, "options", void 0);
3126
3211
 
3127
- _defineProperty$2(this, "messageQueue", new Set());
3212
+ _defineProperty$1(this, "messageQueue", new Set());
3128
3213
 
3129
- _defineProperty$2(this, "state", "initial");
3214
+ _defineProperty$1(this, "state", "initial");
3130
3215
 
3131
- _defineProperty$2(this, "defaultOptions", {
3216
+ _defineProperty$1(this, "defaultOptions", {
3132
3217
  url: null,
3133
3218
  reconnectTimeout: 1000,
3134
3219
  retryLimit: 6
@@ -4429,15 +4514,15 @@ function getMessageDispatcher() {
4429
4514
  }
4430
4515
  class MessageDispatcher {
4431
4516
  constructor() {
4432
- _defineProperty$2(this, "ws", void 0);
4517
+ _defineProperty$1(this, "ws", void 0);
4433
4518
 
4434
- _defineProperty$2(this, "context", void 0);
4519
+ _defineProperty$1(this, "context", void 0);
4435
4520
 
4436
- _defineProperty$2(this, "messages", new Map());
4521
+ _defineProperty$1(this, "messages", new Map());
4437
4522
 
4438
- _defineProperty$2(this, "messageCallbackHandlers", new Map());
4523
+ _defineProperty$1(this, "messageCallbackHandlers", new Map());
4439
4524
 
4440
- _defineProperty$2(this, "channels", new Map());
4525
+ _defineProperty$1(this, "channels", new Map());
4441
4526
  }
4442
4527
 
4443
4528
  create(brickAndMessages, context) {
@@ -4752,6 +4837,26 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
4752
4837
  return _ref.apply(this, arguments);
4753
4838
  };
4754
4839
  }();
4840
+ /**
4841
+ * @description 获取app storyboard初始化信息
4842
+ * @endpoint GET /api/auth/v2/bootstrap/:appId
4843
+ */
4844
+
4845
+
4846
+ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
4847
+ var _ref = _asyncToGenerator$4(function* (appId, params, options) {
4848
+ return (
4849
+ /**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
4850
+ (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
4851
+ params
4852
+ }))).data
4853
+ );
4854
+ });
4855
+
4856
+ return function BootstrapV2Api_getAppStoryboardV2(_x, _x2, _x3) {
4857
+ return _ref.apply(this, arguments);
4858
+ };
4859
+ }();
4755
4860
  /**
4756
4861
  * @description 通过defaultOrg查找单个契约信息
4757
4862
  * @endpoint POST /api/contract/single_search
@@ -5605,9 +5710,9 @@ function argsFactory(args, context, event) {
5605
5710
 
5606
5711
  class BrickNode {
5607
5712
  constructor(brick) {
5608
- _defineProperty$2(this, "$$brick", void 0);
5713
+ _defineProperty$1(this, "$$brick", void 0);
5609
5714
 
5610
- _defineProperty$2(this, "children", []);
5715
+ _defineProperty$1(this, "children", []);
5611
5716
 
5612
5717
  this.$$brick = brick;
5613
5718
  }
@@ -5706,55 +5811,6 @@ function _asyncToGenerator$1(fn) {
5706
5811
  };
5707
5812
  }
5708
5813
 
5709
- function _defineProperty(obj, key, value) {
5710
- if (key in obj) {
5711
- Object.defineProperty(obj, key, {
5712
- value: value,
5713
- enumerable: true,
5714
- configurable: true,
5715
- writable: true
5716
- });
5717
- } else {
5718
- obj[key] = value;
5719
- }
5720
-
5721
- return obj;
5722
- }
5723
-
5724
- function ownKeys(object, enumerableOnly) {
5725
- var keys = Object.keys(object);
5726
-
5727
- if (Object.getOwnPropertySymbols) {
5728
- var symbols = Object.getOwnPropertySymbols(object);
5729
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
5730
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
5731
- });
5732
- keys.push.apply(keys, symbols);
5733
- }
5734
-
5735
- return keys;
5736
- }
5737
-
5738
- function _objectSpread2(target) {
5739
- for (var i = 1; i < arguments.length; i++) {
5740
- var source = arguments[i] != null ? arguments[i] : {};
5741
-
5742
- if (i % 2) {
5743
- ownKeys(Object(source), true).forEach(function (key) {
5744
- _defineProperty(target, key, source[key]);
5745
- });
5746
- } else if (Object.getOwnPropertyDescriptors) {
5747
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
5748
- } else {
5749
- ownKeys(Object(source)).forEach(function (key) {
5750
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
5751
- });
5752
- }
5753
- }
5754
-
5755
- return target;
5756
- }
5757
-
5758
5814
  var checkLogin = /*#__PURE__*/function () {
5759
5815
  var _ref2 = _asyncToGenerator$1(function* (options) {
5760
5816
  return (yield http.get("api/auth/login", options)).data;
@@ -5765,30 +5821,6 @@ var checkLogin = /*#__PURE__*/function () {
5765
5821
  };
5766
5822
  }();
5767
5823
 
5768
- var bootstrap = /*#__PURE__*/function () {
5769
- var _ref3 = _asyncToGenerator$1(function* (params, options) {
5770
- return (yield http.get("api/auth/bootstrap", _objectSpread2(_objectSpread2({}, options), {}, {
5771
- params
5772
- }))).data;
5773
- });
5774
-
5775
- return function bootstrap(_x4, _x5) {
5776
- return _ref3.apply(this, arguments);
5777
- };
5778
- }();
5779
-
5780
- var getAppStoryboard = /*#__PURE__*/function () {
5781
- var _ref4 = _asyncToGenerator$1(function* (appId, params, options) {
5782
- return (yield http.get("api/auth/bootstrap/".concat(appId), _objectSpread2(_objectSpread2({}, options), {}, {
5783
- params
5784
- }))).data;
5785
- });
5786
-
5787
- return function getAppStoryboard(_x6, _x7, _x8) {
5788
- return _ref4.apply(this, arguments);
5789
- };
5790
- }();
5791
-
5792
5824
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
5793
5825
  try {
5794
5826
  var info = gen[key](arg);
@@ -6048,57 +6080,57 @@ function _standaloneBootstrap() {
6048
6080
 
6049
6081
  class Kernel {
6050
6082
  constructor() {
6051
- _defineProperty$2(this, "mountPoints", void 0);
6083
+ _defineProperty$1(this, "mountPoints", void 0);
6052
6084
 
6053
- _defineProperty$2(this, "bootstrapData", void 0);
6085
+ _defineProperty$1(this, "bootstrapData", void 0);
6054
6086
 
6055
- _defineProperty$2(this, "presetBricks", void 0);
6087
+ _defineProperty$1(this, "presetBricks", void 0);
6056
6088
 
6057
- _defineProperty$2(this, "menuBar", void 0);
6089
+ _defineProperty$1(this, "menuBar", void 0);
6058
6090
 
6059
- _defineProperty$2(this, "appBar", void 0);
6091
+ _defineProperty$1(this, "appBar", void 0);
6060
6092
 
6061
- _defineProperty$2(this, "loadingBar", void 0);
6093
+ _defineProperty$1(this, "loadingBar", void 0);
6062
6094
 
6063
- _defineProperty$2(this, "navBar", void 0);
6095
+ _defineProperty$1(this, "navBar", void 0);
6064
6096
 
6065
- _defineProperty$2(this, "sideBar", void 0);
6097
+ _defineProperty$1(this, "sideBar", void 0);
6066
6098
 
6067
- _defineProperty$2(this, "footer", void 0);
6099
+ _defineProperty$1(this, "footer", void 0);
6068
6100
 
6069
- _defineProperty$2(this, "breadcrumb", void 0);
6101
+ _defineProperty$1(this, "breadcrumb", void 0);
6070
6102
 
6071
- _defineProperty$2(this, "router", void 0);
6103
+ _defineProperty$1(this, "router", void 0);
6072
6104
 
6073
- _defineProperty$2(this, "currentApp", void 0);
6105
+ _defineProperty$1(this, "currentApp", void 0);
6074
6106
 
6075
- _defineProperty$2(this, "previousApp", void 0);
6107
+ _defineProperty$1(this, "previousApp", void 0);
6076
6108
 
6077
- _defineProperty$2(this, "nextApp", void 0);
6109
+ _defineProperty$1(this, "nextApp", void 0);
6078
6110
 
6079
- _defineProperty$2(this, "currentUrl", void 0);
6111
+ _defineProperty$1(this, "currentUrl", void 0);
6080
6112
 
6081
- _defineProperty$2(this, "currentRoute", void 0);
6113
+ _defineProperty$1(this, "currentRoute", void 0);
6082
6114
 
6083
- _defineProperty$2(this, "workspaceStack", []);
6115
+ _defineProperty$1(this, "workspaceStack", []);
6084
6116
 
6085
- _defineProperty$2(this, "currentLayout", void 0);
6117
+ _defineProperty$1(this, "currentLayout", void 0);
6086
6118
 
6087
- _defineProperty$2(this, "enableUiV8", false);
6119
+ _defineProperty$1(this, "enableUiV8", false);
6088
6120
 
6089
- _defineProperty$2(this, "allUserMapPromise", Promise.resolve(new Map()));
6121
+ _defineProperty$1(this, "allUserMapPromise", Promise.resolve(new Map()));
6090
6122
 
6091
- _defineProperty$2(this, "allMagicBrickConfigMapPromise", Promise.resolve(new Map()));
6123
+ _defineProperty$1(this, "allMagicBrickConfigMapPromise", Promise.resolve(new Map()));
6092
6124
 
6093
- _defineProperty$2(this, "allRelatedAppsPromise", Promise.resolve([]));
6125
+ _defineProperty$1(this, "allRelatedAppsPromise", Promise.resolve([]));
6094
6126
 
6095
- _defineProperty$2(this, "allMicroAppApiOrchestrationPromise", Promise.resolve(new Map()));
6127
+ _defineProperty$1(this, "allMicroAppApiOrchestrationPromise", Promise.resolve(new Map()));
6096
6128
 
6097
- _defineProperty$2(this, "providerRepository", new Map());
6129
+ _defineProperty$1(this, "providerRepository", new Map());
6098
6130
 
6099
- _defineProperty$2(this, "loadUsersStarted", false);
6131
+ _defineProperty$1(this, "loadUsersStarted", false);
6100
6132
 
6101
- _defineProperty$2(this, "loadMagicBrickConfigStarted", false);
6133
+ _defineProperty$1(this, "loadMagicBrickConfigStarted", false);
6102
6134
  }
6103
6135
 
6104
6136
  bootstrap(mountPoints) {
@@ -6214,17 +6246,12 @@ class Kernel {
6214
6246
  var _this3 = this;
6215
6247
 
6216
6248
  return _asyncToGenerator$4(function* () {
6217
- // Todo(jojiang): boostrap V2 接口测试通过后移除 V1 版本的兼容
6218
- var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : localStorage.getItem("__$$use-bootstrap-v2-provider$$__") ? BootstrapV2Api_bootstrapV2(_objectSpread({
6249
+ var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
6219
6250
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status",
6220
6251
  ignoreTemplateFields: "templates",
6221
6252
  ignoreBrickFields: "bricks,processors,providers,editors"
6222
6253
  }, params), {
6223
6254
  interceptorParams
6224
- }) : bootstrap(_objectSpread({
6225
- brief: true
6226
- }, params), {
6227
- interceptorParams
6228
6255
  });
6229
6256
 
6230
6257
  var bootstrapResponse = _objectSpread({
@@ -6275,7 +6302,7 @@ class Kernel {
6275
6302
  routes,
6276
6303
  meta,
6277
6304
  app
6278
- } = yield getAppStoryboard(storyboard.app.id);
6305
+ } = yield BootstrapV2Api_getAppStoryboardV2(storyboard.app.id, {});
6279
6306
  Object.assign(storyboard, {
6280
6307
  routes,
6281
6308
  meta,
@@ -6288,7 +6315,7 @@ class Kernel {
6288
6315
 
6289
6316
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
6290
6317
  // Prefix to avoid conflict between brick package's i18n namespace.
6291
- var i18nNamespace = "$app-".concat(storyboard.app.id); // Support any language in `meta.i18n`.
6318
+ var i18nNamespace = getI18nNamespace("app", storyboard.app.id); // Support any language in `meta.i18n`.
6292
6319
 
6293
6320
  Object.entries(storyboard.meta.i18n).forEach(_ref => {
6294
6321
  var [lang, resources] = _ref;
@@ -7750,11 +7777,11 @@ function registerCustomTemplate(tplName, tplConstructor, appId) {
7750
7777
 
7751
7778
  class CustomTemplateContext {
7752
7779
  constructor() {
7753
- _defineProperty$2(this, "contextMap", new Map());
7780
+ _defineProperty$1(this, "contextMap", new Map());
7754
7781
 
7755
- _defineProperty$2(this, "brickMap", new Map());
7782
+ _defineProperty$1(this, "brickMap", new Map());
7756
7783
 
7757
- _defineProperty$2(this, "propsMap", new Map());
7784
+ _defineProperty$1(this, "propsMap", new Map());
7758
7785
  }
7759
7786
 
7760
7787
  createContext() {
@@ -7810,35 +7837,35 @@ function listenOnTrackingContext(brick, trackingContextList, context) {
7810
7837
 
7811
7838
  class LocationContext {
7812
7839
  constructor(kernel, location) {
7813
- _defineProperty$2(this, "query", void 0);
7840
+ _defineProperty$1(this, "query", void 0);
7814
7841
 
7815
- _defineProperty$2(this, "resolver", void 0);
7842
+ _defineProperty$1(this, "resolver", void 0);
7816
7843
 
7817
- _defineProperty$2(this, "messageDispatcher", void 0);
7844
+ _defineProperty$1(this, "messageDispatcher", void 0);
7818
7845
 
7819
- _defineProperty$2(this, "beforePageLoadHandlers", []);
7846
+ _defineProperty$1(this, "beforePageLoadHandlers", []);
7820
7847
 
7821
- _defineProperty$2(this, "pageLoadHandlers", []);
7848
+ _defineProperty$1(this, "pageLoadHandlers", []);
7822
7849
 
7823
- _defineProperty$2(this, "beforePageLeaveHandlers", []);
7850
+ _defineProperty$1(this, "beforePageLeaveHandlers", []);
7824
7851
 
7825
- _defineProperty$2(this, "pageLeaveHandlers", []);
7852
+ _defineProperty$1(this, "pageLeaveHandlers", []);
7826
7853
 
7827
- _defineProperty$2(this, "anchorLoadHandlers", []);
7854
+ _defineProperty$1(this, "anchorLoadHandlers", []);
7828
7855
 
7829
- _defineProperty$2(this, "anchorUnloadHandlers", []);
7856
+ _defineProperty$1(this, "anchorUnloadHandlers", []);
7830
7857
 
7831
- _defineProperty$2(this, "messageCloseHandlers", []);
7858
+ _defineProperty$1(this, "messageCloseHandlers", []);
7832
7859
 
7833
- _defineProperty$2(this, "messageHandlers", []);
7860
+ _defineProperty$1(this, "messageHandlers", []);
7834
7861
 
7835
- _defineProperty$2(this, "segues", {});
7862
+ _defineProperty$1(this, "segues", {});
7836
7863
 
7837
- _defineProperty$2(this, "currentMatch", void 0);
7864
+ _defineProperty$1(this, "currentMatch", void 0);
7838
7865
 
7839
- _defineProperty$2(this, "storyboardContext", new Map());
7866
+ _defineProperty$1(this, "storyboardContext", new Map());
7840
7867
 
7841
- _defineProperty$2(this, "tplContext", new CustomTemplateContext());
7868
+ _defineProperty$1(this, "tplContext", new CustomTemplateContext());
7842
7869
 
7843
7870
  this.kernel = kernel;
7844
7871
  this.location = location;
@@ -8790,13 +8817,13 @@ function makeProviderRefreshable(providerBrick) {
8790
8817
 
8791
8818
  class Resolver {
8792
8819
  constructor(kernel) {
8793
- _defineProperty$2(this, "cache", new Map());
8820
+ _defineProperty$1(this, "cache", new Map());
8794
8821
 
8795
- _defineProperty$2(this, "refreshQueue", new Map());
8822
+ _defineProperty$1(this, "refreshQueue", new Map());
8796
8823
 
8797
- _defineProperty$2(this, "definedResolves", new Map());
8824
+ _defineProperty$1(this, "definedResolves", new Map());
8798
8825
 
8799
- _defineProperty$2(this, "active", true);
8826
+ _defineProperty$1(this, "active", true);
8800
8827
 
8801
8828
  this.kernel = kernel;
8802
8829
  }
@@ -8938,12 +8965,13 @@ class Resolver {
8938
8965
  } else {
8939
8966
  var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
8940
8967
  : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
8968
+ promise = _asyncToGenerator$4(function* () {
8969
+ if (useProvider) {
8970
+ actualArgs = yield getArgsOfCustomApi(useProvider, actualArgs);
8971
+ }
8941
8972
 
8942
- if (useProvider) {
8943
- actualArgs = yield getArgsOfCustomApi(useProvider, actualArgs);
8944
- }
8945
-
8946
- promise = providerBrick[method](...actualArgs);
8973
+ return providerBrick[method](...actualArgs);
8974
+ })();
8947
8975
 
8948
8976
  _this2.cache.set(cacheKey, promise);
8949
8977
  }
@@ -9011,7 +9039,7 @@ class Resolver {
9011
9039
 
9012
9040
  var _loop = function (providerBrick, interval) {
9013
9041
  var request = /*#__PURE__*/function () {
9014
- var _ref = _asyncToGenerator$4(function* () {
9042
+ var _ref2 = _asyncToGenerator$4(function* () {
9015
9043
  yield providerBrick.$refresh({
9016
9044
  ignoreErrors: interval.ignoreErrors,
9017
9045
  throwErrors: true,
@@ -9025,7 +9053,7 @@ class Resolver {
9025
9053
  });
9026
9054
 
9027
9055
  return function request() {
9028
- return _ref.apply(this, arguments);
9056
+ return _ref2.apply(this, arguments);
9029
9057
  };
9030
9058
  }();
9031
9059
 
@@ -9052,7 +9080,7 @@ class ResolveRequestError extends Error {
9052
9080
  // Pass remaining arguments (including vendor specific ones) to parent constructor
9053
9081
  super(rawError.message);
9054
9082
 
9055
- _defineProperty$2(this, "rawError", void 0);
9083
+ _defineProperty$1(this, "rawError", void 0);
9056
9084
 
9057
9085
  this.name = "ResolveRequestError"; // Maintains proper stack trace for where our error was thrown (only available on V8)
9058
9086
  // istanbul ignore else
@@ -9072,21 +9100,21 @@ function shouldBeDefaultCollapsed(defaultCollapsed, defaultCollapsedBreakpoint)
9072
9100
 
9073
9101
  class Router {
9074
9102
  constructor(kernel) {
9075
- _defineProperty$2(this, "defaultCollapsed", false);
9103
+ _defineProperty$1(this, "defaultCollapsed", false);
9076
9104
 
9077
- _defineProperty$2(this, "locationContext", void 0);
9105
+ _defineProperty$1(this, "locationContext", void 0);
9078
9106
 
9079
- _defineProperty$2(this, "rendering", false);
9107
+ _defineProperty$1(this, "rendering", false);
9080
9108
 
9081
- _defineProperty$2(this, "nextLocation", void 0);
9109
+ _defineProperty$1(this, "nextLocation", void 0);
9082
9110
 
9083
- _defineProperty$2(this, "prevLocation", void 0);
9111
+ _defineProperty$1(this, "prevLocation", void 0);
9084
9112
 
9085
- _defineProperty$2(this, "state", "initial");
9113
+ _defineProperty$1(this, "state", "initial");
9086
9114
 
9087
- _defineProperty$2(this, "renderId", void 0);
9115
+ _defineProperty$1(this, "renderId", void 0);
9088
9116
 
9089
- _defineProperty$2(this, "featureFlags", void 0);
9117
+ _defineProperty$1(this, "featureFlags", void 0);
9090
9118
 
9091
9119
  this.kernel = kernel;
9092
9120
  this.featureFlags = this.kernel.getFeatureFlags();
@@ -9267,7 +9295,7 @@ class Router {
9267
9295
 
9268
9296
  _this3.kernel.registerCustomTemplatesInStoryboard(storyboard);
9269
9297
 
9270
- registerStoryboardFunctions((_storyboard$meta = storyboard.meta) === null || _storyboard$meta === void 0 ? void 0 : _storyboard$meta.functions);
9298
+ registerStoryboardFunctions((_storyboard$meta = storyboard.meta) === null || _storyboard$meta === void 0 ? void 0 : _storyboard$meta.functions, storyboard.app);
9271
9299
  }
9272
9300
 
9273
9301
  var {
@@ -9593,33 +9621,6 @@ function getRuntime() {
9593
9621
  return runtime;
9594
9622
  }
9595
9623
 
9596
- var locale$7 = {
9597
- [K.REQUEST_FAILED]: "Request Failed",
9598
- [K.MODAL_OK]: "Ok",
9599
- [K.MODAL_CANCEL]: "Cancel",
9600
- [K.SOMETHING_WENT_WRONG]: "Something went wrong!",
9601
- [K.LOGIN_TIMEOUT_MESSAGE]: "You haven't logged in or your login session has expired. Login right now?",
9602
- [K.NETWORK_ERROR]: "Network error, please check your network."
9603
- };
9604
- var en = locale$7;
9605
-
9606
- var locale$6 = {
9607
- [K.REQUEST_FAILED]: "请求失败",
9608
- [K.MODAL_OK]: "确认",
9609
- [K.MODAL_CANCEL]: "取消",
9610
- [K.SOMETHING_WENT_WRONG]: "出现了一些问题!",
9611
- [K.LOGIN_TIMEOUT_MESSAGE]: "您还未登录或登录信息已过期,现在重新登录?",
9612
- [K.NETWORK_ERROR]: "网络错误,请检查您的网络连接。"
9613
- };
9614
- var zh = locale$6;
9615
-
9616
- /** @internal */
9617
-
9618
- var initI18n = () => {
9619
- i18next.addResourceBundle("en", NS_BRICK_KIT, en);
9620
- i18next.addResourceBundle("zh", NS_BRICK_KIT, zh);
9621
- };
9622
-
9623
9624
  // Ref https://reactjs.org/docs/error-boundaries.html
9624
9625
  class LegacyErrorBoundary extends React__default.Component {
9625
9626
  constructor(props) {
@@ -11081,7 +11082,7 @@ class UpdatingElement extends HTMLElement {
11081
11082
  constructor() {
11082
11083
  super(...arguments);
11083
11084
 
11084
- _defineProperty$2(this, "_hasRequestedRender", false);
11085
+ _defineProperty$1(this, "_hasRequestedRender", false);
11085
11086
  }
11086
11087
 
11087
11088
  /** @internal */
@@ -11292,13 +11293,13 @@ class UpdatingElement extends HTMLElement {
11292
11293
 
11293
11294
  }
11294
11295
 
11295
- _defineProperty$2(UpdatingElement, "_observedAttributes", new Set());
11296
+ _defineProperty$1(UpdatingElement, "_observedAttributes", new Set());
11296
11297
 
11297
- _defineProperty$2(UpdatingElement, "__dev_only_definedProperties", new Set());
11298
+ _defineProperty$1(UpdatingElement, "__dev_only_definedProperties", new Set());
11298
11299
 
11299
- _defineProperty$2(UpdatingElement, "__dev_only_definedMethods", new Set());
11300
+ _defineProperty$1(UpdatingElement, "__dev_only_definedMethods", new Set());
11300
11301
 
11301
- _defineProperty$2(UpdatingElement, "__dev_only_definedEvents", new Set());
11302
+ _defineProperty$1(UpdatingElement, "__dev_only_definedEvents", new Set());
11302
11303
 
11303
11304
  /**
11304
11305
  * 模态框类构件的抽象基类。