@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.
package/dist/index.esm.js CHANGED
@@ -5485,8 +5485,7 @@ function clearPollTimeout() {
5485
5485
  */
5486
5486
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5487
5487
  var _ref = _asyncToGenerator$3(function* (options) {
5488
- return (/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5489
- (yield http.get("api/v1/runtime_standalone", options)).data
5488
+ return (/**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */(yield http.get("api/v1/runtime_standalone", options)).data
5490
5489
  );
5491
5490
  });
5492
5491
  return function BootstrapStandaloneApi_runtimeStandalone(_x) {
@@ -5500,8 +5499,7 @@ var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5500
5499
  */
5501
5500
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5502
5501
  var _ref = _asyncToGenerator$3(function* (params, options) {
5503
- return (/**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5504
- (yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
5502
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.1.0 */(yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
5505
5503
  params
5506
5504
  }))).data
5507
5505
  );
@@ -5517,8 +5515,7 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5517
5515
  */
5518
5516
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5519
5517
  var _ref = _asyncToGenerator$3(function* (appId, params, options) {
5520
- return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5521
- (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
5518
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */(yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
5522
5519
  params
5523
5520
  }))).data
5524
5521
  );
@@ -5528,14 +5525,29 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5528
5525
  };
5529
5526
  }();
5530
5527
 
5528
+ /**
5529
+ * @description 获取bricks/templates信息
5530
+ * @endpoint GET /api/v1/api_gateway/bricks
5531
+ */
5532
+ var BootstrapV2Api_getBricksInfo = /*#__PURE__*/function () {
5533
+ var _ref = _asyncToGenerator$3(function* (params, options) {
5534
+ return (/**! @contract easyops.api.api_gateway.bootstrap_v2.GetBricksInfo@1.0.0 */(yield http.get("api/v1/api_gateway/bricks", _objectSpread(_objectSpread({}, options), {}, {
5535
+ params
5536
+ }))).data
5537
+ );
5538
+ });
5539
+ return function BootstrapV2Api_getBricksInfo(_x, _x2) {
5540
+ return _ref.apply(this, arguments);
5541
+ };
5542
+ }();
5543
+
5531
5544
  /**
5532
5545
  * @description 通过defaultOrg查找单个契约信息
5533
5546
  * @endpoint POST /api/contract/single_search
5534
5547
  */
5535
5548
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5536
5549
  var _ref = _asyncToGenerator$3(function* (data, options) {
5537
- return (/**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5538
- (yield http.post("api/contract/single_search", data, options)).data
5550
+ return (/**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */(yield http.post("api/contract/single_search", data, options)).data
5539
5551
  );
5540
5552
  });
5541
5553
  return function ContractApi_searchSingleContract(_x, _x2) {
@@ -6825,6 +6837,41 @@ function _safeGetRuntimeMicroAppStandalone() {
6825
6837
  return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
6826
6838
  }
6827
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
+
6828
6875
  /**
6829
6876
  * Take input from [0, n] and return it as [0, 1]
6830
6877
  * @hidden
@@ -8317,7 +8364,7 @@ class Kernel {
8317
8364
  document.body.classList.add("bars-hidden-in-iframe");
8318
8365
  }
8319
8366
  yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
8320
- if (_this2.bootstrapData.storyboards.length === 0) {
8367
+ if (_this2.bootstrapData.storyboards.length === 0 && !window.DEVELOPER_PREVIEW) {
8321
8368
  throw new Error("No storyboard were found.");
8322
8369
  }
8323
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);
@@ -8392,6 +8439,11 @@ class Kernel {
8392
8439
  loadMicroApps(params, interceptorParams) {
8393
8440
  var _this4 = this;
8394
8441
  return _asyncToGenerator$3(function* () {
8442
+ // istanbul ignore if
8443
+ if (window.DEVELOPER_PREVIEW) {
8444
+ _this4.bootstrapData = yield getPreviewBootstrap();
8445
+ return;
8446
+ }
8395
8447
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
8396
8448
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",
8397
8449
  ignoreTemplateFields: "templates",
@@ -11886,7 +11938,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
11886
11938
  }
11887
11939
 
11888
11940
  // If the router state is initial, ignore rendering the sub-brick.
11889
- if (_internalApiGetRouterState() === "initial") {
11941
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
11890
11942
  return;
11891
11943
  }
11892
11944
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -12145,7 +12197,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12145
12197
  }
12146
12198
 
12147
12199
  // If the router state is initial, ignore rendering the sub-brick.
12148
- if (_internalApiGetRouterState() === "initial") {
12200
+ if (_internalApiGetRouterState() === "initial" && !window.DEVELOPER_PREVIEW) {
12149
12201
  return;
12150
12202
  }
12151
12203
  _internalApiLoadDynamicBricksInBrickConf(useBrick).catch(handleHttpError);
@@ -14064,5 +14116,5 @@ function constructEventListener(handler) {
14064
14116
  });
14065
14117
  }
14066
14118
 
14067
- 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 };
14068
14120
  //# sourceMappingURL=index.esm.js.map