@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.
package/dist/index.esm.js CHANGED
@@ -5526,7 +5526,7 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5526
5526
  }();
5527
5527
 
5528
5528
  /**
5529
- * @description 获取bricks信息
5529
+ * @description 获取bricks/templates信息
5530
5530
  * @endpoint GET /api/v1/api_gateway/bricks
5531
5531
  */
5532
5532
  var BootstrapV2Api_getBricksInfo = /*#__PURE__*/function () {
@@ -6747,7 +6747,7 @@ function _standaloneBootstrap() {
6747
6747
  // eslint-disable-next-line no-console
6748
6748
  console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
6749
6749
  return;
6750
- }), window.DEVELOPER_PREVIEW ? BootstrapV2Api_getBricksInfo({}) : null];
6750
+ })];
6751
6751
  if (!window.NO_AUTH_GUARD) {
6752
6752
  var matches;
6753
6753
  var appId = window.APP_ID || (window.APP_ROOT && (matches = window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\//)) ? matches[1] : null);
@@ -6756,7 +6756,7 @@ function _standaloneBootstrap() {
6756
6756
  safeGetRuntimeMicroAppStandalone(appId);
6757
6757
  }
6758
6758
  }
6759
- var [bootstrapResult, confString, runtimeData, previewPackageData] = yield Promise.all(requests);
6759
+ var [bootstrapResult, confString, runtimeData] = yield Promise.all(requests);
6760
6760
  var conf;
6761
6761
  try {
6762
6762
  conf = confString ? yaml.safeLoad(confString, {
@@ -6811,12 +6811,6 @@ function _standaloneBootstrap() {
6811
6811
  }
6812
6812
  }
6813
6813
  }
6814
- if (previewPackageData) {
6815
- Object.assign(bootstrapResult, {
6816
- brickPackages: previewPackageData.bricksInfo,
6817
- templatePackages: previewPackageData.templatesInfo
6818
- });
6819
- }
6820
6814
  return _objectSpread(_objectSpread({}, bootstrapResult), {}, {
6821
6815
  settings
6822
6816
  });
@@ -6843,6 +6837,41 @@ function _safeGetRuntimeMicroAppStandalone() {
6843
6837
  return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
6844
6838
  }
6845
6839
 
6840
+ function getPreviewBootstrap() {
6841
+ return _getPreviewBootstrap.apply(this, arguments);
6842
+ }
6843
+ function _getPreviewBootstrap() {
6844
+ _getPreviewBootstrap = _asyncToGenerator$3(function* () {
6845
+ var [runtimeData, previewPackageData] = yield Promise.all([BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
6846
+ // make it not crash when the backend service is not updated.
6847
+ // eslint-disable-next-line no-console
6848
+ console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
6849
+ return;
6850
+ }), BootstrapV2Api_getBricksInfo({})]);
6851
+ var result = {
6852
+ storyboards: [],
6853
+ microApps: []
6854
+ };
6855
+ if (runtimeData) {
6856
+ var runtimeSettings = runtimeData.settings;
6857
+ if (!isEmpty(runtimeSettings)) {
6858
+ Object.assign(result, {
6859
+ settings: runtimeSettings
6860
+ });
6861
+ }
6862
+ }
6863
+ if (previewPackageData) {
6864
+ var _previewPackageData$b, _previewPackageData$t;
6865
+ Object.assign(result, {
6866
+ brickPackages: (_previewPackageData$b = previewPackageData.bricksInfo) !== null && _previewPackageData$b !== void 0 ? _previewPackageData$b : [],
6867
+ templatePackages: (_previewPackageData$t = previewPackageData.templatesInfo) !== null && _previewPackageData$t !== void 0 ? _previewPackageData$t : []
6868
+ });
6869
+ }
6870
+ return result;
6871
+ });
6872
+ return _getPreviewBootstrap.apply(this, arguments);
6873
+ }
6874
+
6846
6875
  /**
6847
6876
  * Take input from [0, n] and return it as [0, 1]
6848
6877
  * @hidden
@@ -8335,7 +8364,7 @@ class Kernel {
8335
8364
  document.body.classList.add("bars-hidden-in-iframe");
8336
8365
  }
8337
8366
  yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
8338
- if (_this2.bootstrapData.storyboards.length === 0) {
8367
+ if (_this2.bootstrapData.storyboards.length === 0 && !window.DEVELOPER_PREVIEW) {
8339
8368
  throw new Error("No storyboard were found.");
8340
8369
  }
8341
8370
  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);
@@ -8410,6 +8439,11 @@ class Kernel {
8410
8439
  loadMicroApps(params, interceptorParams) {
8411
8440
  var _this4 = this;
8412
8441
  return _asyncToGenerator$3(function* () {
8442
+ // istanbul ignore if
8443
+ if (window.DEVELOPER_PREVIEW) {
8444
+ _this4.bootstrapData = yield getPreviewBootstrap();
8445
+ return;
8446
+ }
8413
8447
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
8414
8448
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",
8415
8449
  ignoreTemplateFields: "templates",
@@ -11904,7 +11938,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
11904
11938
  }
11905
11939
 
11906
11940
  // If the router state is initial, ignore rendering the sub-brick.
11907
- if (_internalApiGetRouterState() === "initial") {
11941
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
11908
11942
  return;
11909
11943
  }
11910
11944
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -12163,7 +12197,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12163
12197
  }
12164
12198
 
12165
12199
  // If the router state is initial, ignore rendering the sub-brick.
12166
- if (_internalApiGetRouterState() === "initial") {
12200
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
12167
12201
  return;
12168
12202
  }
12169
12203
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -14082,5 +14116,5 @@ function constructEventListener(handler) {
14082
14116
  });
14083
14117
  }
14084
14118
 
14085
- export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, abortController, authenticate, batchSetAppsLocalTheme, checkIf, checkIfByTransform, constructEventListener, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getCurrentTheme, getHistory, getMockInfo, getRealValue, getRuntime, getRuntimeMisc, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useProvider, useRecentApps };
14119
+ export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, abortController, applyTheme, authenticate, batchSetAppsLocalTheme, checkIf, checkIfByTransform, constructEventListener, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getCurrentTheme, getHistory, getMockInfo, getRealValue, getRuntime, getRuntimeMisc, handleHttpError, httpErrorToString, i18nText, initI18n, isLoggedIn, logout, looseCheckIf, looseCheckIfByTransform, looseCheckIfOfComputed, method, preprocessTransformProperties, property, reTransformForDevtools, renderEasyopsEmpty, transformElementProperties, transformIntermediateData, transformProperties, useApplyPageTitle, useCurrentApp, useCurrentMode, useCurrentTheme, useFeatureFlags, useLocation, useProvider, useRecentApps };
14086
14120
  //# sourceMappingURL=index.esm.js.map