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