@next-core/brick-kit 2.182.0 → 2.183.0

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
@@ -7228,14 +7228,14 @@ function standaloneBootstrap() {
7228
7228
  }
7229
7229
  function _standaloneBootstrap() {
7230
7230
  _standaloneBootstrap = _asyncToGenerator$3(function* () {
7231
- var requests = [http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
7231
+ var requests = [window.BOOTSTRAP_UNION_FILE ? http.get(window.BOOTSTRAP_UNION_FILE) : http.get(window.BOOTSTRAP_FILE), window.BOOTSTRAP_UNION_FILE ? Promise.resolve("") : http.get("".concat(window.APP_ROOT, "conf.yaml"), {
7232
7232
  responseType: "text"
7233
7233
  }), BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
7234
7234
  // make it not crash when the backend service is not updated.
7235
7235
  // eslint-disable-next-line no-console
7236
7236
  console.warn("request runtime api from api-gateway failed: ", error, ", something might went wrong running standalone micro app");
7237
7237
  return;
7238
- })];
7238
+ }), window.BOOTSTRAP_UNION_FILE ? http.get(window.BOOTSTRAP_FILE) : Promise.resolve(undefined)];
7239
7239
  if (!window.NO_AUTH_GUARD) {
7240
7240
  var matches;
7241
7241
  var appId = window.APP_ID || (window.APP_ROOT && (matches = window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\//)) ? matches[1] : null);
@@ -7244,7 +7244,7 @@ function _standaloneBootstrap() {
7244
7244
  safeGetRuntimeMicroAppStandalone(appId);
7245
7245
  }
7246
7246
  }
7247
- var [bootstrapResult, confString, runtimeData] = yield Promise.all(requests);
7247
+ var [bootstrapResult, confString, runtimeData, fullBootstrapDetail] = yield Promise.all(requests);
7248
7248
  var conf;
7249
7249
  try {
7250
7250
  conf = confString ? yaml.safeLoad(confString, {
@@ -7299,12 +7299,34 @@ function _standaloneBootstrap() {
7299
7299
  }
7300
7300
  }
7301
7301
  }
7302
+ mergeFullBootstrapDetail(bootstrapResult, fullBootstrapDetail);
7302
7303
  return _objectSpread(_objectSpread({}, bootstrapResult), {}, {
7303
7304
  settings
7304
7305
  });
7305
7306
  });
7306
7307
  return _standaloneBootstrap.apply(this, arguments);
7307
7308
  }
7309
+ function mergeFullBootstrapDetail(bootstrapResult, fullBootstrapDetail) {
7310
+ if (fullBootstrapDetail) {
7311
+ var {
7312
+ storyboards
7313
+ } = fullBootstrapDetail;
7314
+ var {
7315
+ routes,
7316
+ meta,
7317
+ app
7318
+ } = storyboards[0];
7319
+ var matchedStoryboard = bootstrapResult.storyboards.find(item => item.app.id === app.id);
7320
+ if (matchedStoryboard) {
7321
+ Object.assign(matchedStoryboard, {
7322
+ routes,
7323
+ meta,
7324
+ app: _objectSpread(_objectSpread({}, matchedStoryboard.app), app),
7325
+ $$fullMerged: true
7326
+ });
7327
+ }
7328
+ }
7329
+ }
7308
7330
  var appRuntimeDataMap = new Map();
7309
7331
  function safeGetRuntimeMicroAppStandalone(_x) {
7310
7332
  return _safeGetRuntimeMicroAppStandalone.apply(this, arguments);
@@ -9002,6 +9024,23 @@ class Kernel {
9002
9024
  $$fulfilled: true,
9003
9025
  $$fulfilling: null
9004
9026
  });
9027
+ if (window.BOOTSTRAP_UNION_FILE && !storyboard.$$fullMerged) {
9028
+ var fullBootstrapPath = "".concat(window.APP_ROOT, "-/").concat(storyboard.bootstrapFile);
9029
+ var {
9030
+ storyboards
9031
+ } = yield http.get(fullBootstrapPath);
9032
+ var {
9033
+ routes,
9034
+ meta,
9035
+ app
9036
+ } = storyboards[0];
9037
+ Object.assign(storyboard, {
9038
+ routes,
9039
+ meta,
9040
+ app: _objectSpread(_objectSpread({}, storyboard.app), app),
9041
+ $$fullMerged: true
9042
+ });
9043
+ }
9005
9044
  if (!window.NO_AUTH_GUARD) {
9006
9045
  var appRuntimeData;
9007
9046
  try {
@@ -9024,14 +9063,14 @@ class Kernel {
9024
9063
  }
9025
9064
  } else {
9026
9065
  var {
9027
- routes,
9028
- meta,
9029
- app
9066
+ routes: _routes,
9067
+ meta: _meta,
9068
+ app: _app
9030
9069
  } = yield BootstrapV2Api_getAppStoryboardV2(storyboard.app.id, {});
9031
9070
  Object.assign(storyboard, {
9032
- routes,
9033
- meta,
9034
- app: _objectSpread(_objectSpread({}, storyboard.app), app),
9071
+ routes: _routes,
9072
+ meta: _meta,
9073
+ app: _objectSpread(_objectSpread({}, storyboard.app), _app),
9035
9074
  $$fulfilled: true,
9036
9075
  $$fulfilling: null
9037
9076
  });
@@ -11623,6 +11662,17 @@ function setUIVersion(version) {
11623
11662
  document.documentElement.dataset.ui = ui;
11624
11663
  }
11625
11664
 
11665
+ function setAppVariable(params) {
11666
+ var {
11667
+ appId,
11668
+ version
11669
+ } = params;
11670
+ if (window.APP_ROOT_TPL) {
11671
+ window.APP_ID = appId;
11672
+ window.APP_ROOT = window.APP_ROOT_TPL.replace("{id}", appId).replace("{version}", version);
11673
+ }
11674
+ }
11675
+
11626
11676
  class Router {
11627
11677
  constructor(kernel) {
11628
11678
  _defineProperty$1(this, "defaultCollapsed", false);
@@ -11767,7 +11817,7 @@ class Router {
11767
11817
  render(location) {
11768
11818
  var _this3 = this;
11769
11819
  return _asyncToGenerator$3(function* () {
11770
- var _apiAnalyzer$getInsta, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme;
11820
+ var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme;
11771
11821
  _this3.state = "initial";
11772
11822
  var renderId = _this3.renderId = uniqueId("render-id-");
11773
11823
  resetAllInjected();
@@ -11788,6 +11838,14 @@ class Router {
11788
11838
  return;
11789
11839
  }
11790
11840
  var storyboard = locationContext.matchStoryboard(_this3.kernel.bootstrapData.storyboards);
11841
+ var currentAppId = storyboard === null || storyboard === void 0 ? void 0 : (_storyboard$app = storyboard.app) === null || _storyboard$app === void 0 ? void 0 : _storyboard$app.id;
11842
+ // dynamically change the value of the APP variable, if it's union app
11843
+ if (window.BOOTSTRAP_UNION_FILE && currentAppId && currentAppId !== ((_this3$kernel$previou = _this3.kernel.previousApp) === null || _this3$kernel$previou === void 0 ? void 0 : _this3$kernel$previou.id)) {
11844
+ setAppVariable({
11845
+ appId: currentAppId,
11846
+ version: storyboard.app.currentVersion
11847
+ });
11848
+ }
11791
11849
 
11792
11850
  /** Pending task for loading bricks */
11793
11851
  var pendingTask;