@next-core/brick-kit 2.164.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.
@@ -5525,7 +5525,7 @@
5525
5525
  }();
5526
5526
 
5527
5527
  /**
5528
- * @description 获取bricks信息
5528
+ * @description 获取bricks/templates信息
5529
5529
  * @endpoint GET /api/v1/api_gateway/bricks
5530
5530
  */
5531
5531
  var BootstrapV2Api_getBricksInfo = /*#__PURE__*/function () {
@@ -6746,7 +6746,7 @@
6746
6746
  // eslint-disable-next-line no-console
6747
6747
  console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
6748
6748
  return;
6749
- }), window.DEVELOPER_PREVIEW ? BootstrapV2Api_getBricksInfo({}) : null];
6749
+ })];
6750
6750
  if (!window.NO_AUTH_GUARD) {
6751
6751
  var matches;
6752
6752
  var appId = window.APP_ID || (window.APP_ROOT && (matches = window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\//)) ? matches[1] : null);
@@ -6755,7 +6755,7 @@
6755
6755
  safeGetRuntimeMicroAppStandalone(appId);
6756
6756
  }
6757
6757
  }
6758
- var [bootstrapResult, confString, runtimeData, previewPackageData] = yield Promise.all(requests);
6758
+ var [bootstrapResult, confString, runtimeData] = yield Promise.all(requests);
6759
6759
  var conf;
6760
6760
  try {
6761
6761
  conf = confString ? yaml__default["default"].safeLoad(confString, {
@@ -6810,12 +6810,6 @@
6810
6810
  }
6811
6811
  }
6812
6812
  }
6813
- if (previewPackageData) {
6814
- Object.assign(bootstrapResult, {
6815
- brickPackages: previewPackageData.bricksInfo,
6816
- templatePackages: previewPackageData.templatesInfo
6817
- });
6818
- }
6819
6813
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, bootstrapResult), {}, {
6820
6814
  settings
6821
6815
  });
@@ -6842,6 +6836,41 @@
6842
6836
  return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
6843
6837
  }
6844
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
+
6845
6874
  /**
6846
6875
  * Take input from [0, n] and return it as [0, 1]
6847
6876
  * @hidden
@@ -8334,7 +8363,7 @@
8334
8363
  document.body.classList.add("bars-hidden-in-iframe");
8335
8364
  }
8336
8365
  yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
8337
- if (_this2.bootstrapData.storyboards.length === 0) {
8366
+ if (_this2.bootstrapData.storyboards.length === 0 && !window.DEVELOPER_PREVIEW) {
8338
8367
  throw new Error("No storyboard were found.");
8339
8368
  }
8340
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);
@@ -8409,6 +8438,11 @@
8409
8438
  loadMicroApps(params, interceptorParams) {
8410
8439
  var _this4 = this;
8411
8440
  return _asyncToGenerator__default["default"](function* () {
8441
+ // istanbul ignore if
8442
+ if (window.DEVELOPER_PREVIEW) {
8443
+ _this4.bootstrapData = yield getPreviewBootstrap();
8444
+ return;
8445
+ }
8412
8446
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread__default["default"]({
8413
8447
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",
8414
8448
  ignoreTemplateFields: "templates",
@@ -11903,7 +11937,7 @@
11903
11937
  }
11904
11938
 
11905
11939
  // If the router state is initial, ignore rendering the sub-brick.
11906
- if (_internalApiGetRouterState() === "initial") {
11940
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
11907
11941
  return;
11908
11942
  }
11909
11943
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -12162,7 +12196,7 @@
12162
12196
  }
12163
12197
 
12164
12198
  // If the router state is initial, ignore rendering the sub-brick.
12165
- if (_internalApiGetRouterState() === "initial") {
12199
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
12166
12200
  return;
12167
12201
  }
12168
12202
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -14093,6 +14127,7 @@
14093
14127
  exports.StoryboardFunctionRegistryFactory = StoryboardFunctionRegistryFactory;
14094
14128
  exports.UpdatingElement = UpdatingElement;
14095
14129
  exports.abortController = abortController;
14130
+ exports.applyTheme = applyTheme;
14096
14131
  exports.authenticate = authenticate;
14097
14132
  exports.batchSetAppsLocalTheme = batchSetAppsLocalTheme;
14098
14133
  exports.checkIf = checkIf;