@next-core/brick-kit 2.163.0 → 2.164.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.
@@ -5484,8 +5484,7 @@
5484
5484
  */
5485
5485
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5486
5486
  var _ref = _asyncToGenerator__default["default"](function* (options) {
5487
- return (/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5488
- (yield brickHttp.http.get("api/v1/runtime_standalone", options)).data
5487
+ return (/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */(yield brickHttp.http.get("api/v1/runtime_standalone", options)).data
5489
5488
  );
5490
5489
  });
5491
5490
  return function BootstrapStandaloneApi_runtimeStandalone(_x) {
@@ -5499,8 +5498,7 @@
5499
5498
  */
5500
5499
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5501
5500
  var _ref = _asyncToGenerator__default["default"](function* (params, options) {
5502
- return (/**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5503
- (yield brickHttp.http.get("api/auth/v2/bootstrap", _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
5501
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.1.0 */(yield brickHttp.http.get("api/auth/v2/bootstrap", _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
5504
5502
  params
5505
5503
  }))).data
5506
5504
  );
@@ -5516,8 +5514,7 @@
5516
5514
  */
5517
5515
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5518
5516
  var _ref = _asyncToGenerator__default["default"](function* (appId, params, options) {
5519
- return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5520
- (yield brickHttp.http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
5517
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */(yield brickHttp.http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
5521
5518
  params
5522
5519
  }))).data
5523
5520
  );
@@ -5527,14 +5524,29 @@
5527
5524
  };
5528
5525
  }();
5529
5526
 
5527
+ /**
5528
+ * @description 获取bricks/templates信息
5529
+ * @endpoint GET /api/v1/api_gateway/bricks
5530
+ */
5531
+ var BootstrapV2Api_getBricksInfo = /*#__PURE__*/function () {
5532
+ var _ref = _asyncToGenerator__default["default"](function* (params, options) {
5533
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetBricksInfo@1.0.0 */(yield brickHttp.http.get("api/v1/api_gateway/bricks", _objectSpread__default["default"](_objectSpread__default["default"]({}, options), {}, {
5534
+ params
5535
+ }))).data
5536
+ );
5537
+ });
5538
+ return function BootstrapV2Api_getBricksInfo(_x, _x2) {
5539
+ return _ref.apply(this, arguments);
5540
+ };
5541
+ }();
5542
+
5530
5543
  /**
5531
5544
  * @description 通过defaultOrg查找单个契约信息
5532
5545
  * @endpoint POST /api/contract/single_search
5533
5546
  */
5534
5547
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5535
5548
  var _ref = _asyncToGenerator__default["default"](function* (data, options) {
5536
- return (/**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5537
- (yield brickHttp.http.post("api/contract/single_search", data, options)).data
5549
+ return (/**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */(yield brickHttp.http.post("api/contract/single_search", data, options)).data
5538
5550
  );
5539
5551
  });
5540
5552
  return function ContractApi_searchSingleContract(_x, _x2) {
@@ -6824,6 +6836,41 @@
6824
6836
  return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
6825
6837
  }
6826
6838
 
6839
+ function getPreviewBootstrap() {
6840
+ return _getPreviewBootstrap.apply(this, arguments);
6841
+ }
6842
+ function _getPreviewBootstrap() {
6843
+ _getPreviewBootstrap = _asyncToGenerator__default["default"](function* () {
6844
+ var [runtimeData, previewPackageData] = yield Promise.all([BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
6845
+ // make it not crash when the backend service is not updated.
6846
+ // eslint-disable-next-line no-console
6847
+ console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
6848
+ return;
6849
+ }), BootstrapV2Api_getBricksInfo({})]);
6850
+ var result = {
6851
+ storyboards: [],
6852
+ microApps: []
6853
+ };
6854
+ if (runtimeData) {
6855
+ var runtimeSettings = runtimeData.settings;
6856
+ if (!_.isEmpty(runtimeSettings)) {
6857
+ Object.assign(result, {
6858
+ settings: runtimeSettings
6859
+ });
6860
+ }
6861
+ }
6862
+ if (previewPackageData) {
6863
+ var _previewPackageData$b, _previewPackageData$t;
6864
+ Object.assign(result, {
6865
+ brickPackages: (_previewPackageData$b = previewPackageData.bricksInfo) !== null && _previewPackageData$b !== void 0 ? _previewPackageData$b : [],
6866
+ templatePackages: (_previewPackageData$t = previewPackageData.templatesInfo) !== null && _previewPackageData$t !== void 0 ? _previewPackageData$t : []
6867
+ });
6868
+ }
6869
+ return result;
6870
+ });
6871
+ return _getPreviewBootstrap.apply(this, arguments);
6872
+ }
6873
+
6827
6874
  /**
6828
6875
  * Take input from [0, n] and return it as [0, 1]
6829
6876
  * @hidden
@@ -8316,7 +8363,7 @@
8316
8363
  document.body.classList.add("bars-hidden-in-iframe");
8317
8364
  }
8318
8365
  yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
8319
- if (_this2.bootstrapData.storyboards.length === 0) {
8366
+ if (_this2.bootstrapData.storyboards.length === 0 && !window.DEVELOPER_PREVIEW) {
8320
8367
  throw new Error("No storyboard were found.");
8321
8368
  }
8322
8369
  generateColorTheme((_this2$bootstrapData$ = _this2.bootstrapData.settings) === null || _this2$bootstrapData$ === void 0 ? void 0 : (_this2$bootstrapData$2 = _this2$bootstrapData$.misc) === null || _this2$bootstrapData$2 === void 0 ? void 0 : _this2$bootstrapData$2.theme);
@@ -8391,6 +8438,11 @@
8391
8438
  loadMicroApps(params, interceptorParams) {
8392
8439
  var _this4 = this;
8393
8440
  return _asyncToGenerator__default["default"](function* () {
8441
+ // istanbul ignore if
8442
+ if (window.DEVELOPER_PREVIEW) {
8443
+ _this4.bootstrapData = yield getPreviewBootstrap();
8444
+ return;
8445
+ }
8394
8446
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread__default["default"]({
8395
8447
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",
8396
8448
  ignoreTemplateFields: "templates",
@@ -11885,7 +11937,7 @@
11885
11937
  }
11886
11938
 
11887
11939
  // If the router state is initial, ignore rendering the sub-brick.
11888
- if (_internalApiGetRouterState() === "initial") {
11940
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
11889
11941
  return;
11890
11942
  }
11891
11943
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -12144,7 +12196,7 @@
12144
12196
  }
12145
12197
 
12146
12198
  // If the router state is initial, ignore rendering the sub-brick.
12147
- if (_internalApiGetRouterState() === "initial") {
12199
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
12148
12200
  return;
12149
12201
  }
12150
12202
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -14075,6 +14127,7 @@
14075
14127
  exports.StoryboardFunctionRegistryFactory = StoryboardFunctionRegistryFactory;
14076
14128
  exports.UpdatingElement = UpdatingElement;
14077
14129
  exports.abortController = abortController;
14130
+ exports.applyTheme = applyTheme;
14078
14131
  exports.authenticate = authenticate;
14079
14132
  exports.batchSetAppsLocalTheme = batchSetAppsLocalTheme;
14080
14133
  exports.checkIf = checkIf;