@next-core/brick-kit 2.173.2 → 2.174.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.
@@ -2737,7 +2737,7 @@
2737
2737
  };
2738
2738
  }
2739
2739
 
2740
- var _excluded$7 = ["properties", "slots"];
2740
+ var _excluded$8 = ["properties", "slots"];
2741
2741
  function setupUseBrickInTemplate(props, proxyContext) {
2742
2742
  function walk(props) {
2743
2743
  if (Array.isArray(props)) {
@@ -2756,7 +2756,7 @@
2756
2756
  properties,
2757
2757
  slots: originalSlots
2758
2758
  } = item,
2759
- restConf = _objectWithoutProperties__default["default"](item, _excluded$7);
2759
+ restConf = _objectWithoutProperties__default["default"](item, _excluded$8);
2760
2760
  var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
2761
2761
  var _slotConf$bricks;
2762
2762
  var [slotName, slotConf] = _ref2;
@@ -2900,7 +2900,7 @@
2900
2900
  }) : internalOptions;
2901
2901
  }
2902
2902
 
2903
- var _excluded$6 = ["children"],
2903
+ var _excluded$7 = ["children"],
2904
2904
  _excluded2$2 = ["children"],
2905
2905
  _excluded3 = ["items", "app"];
2906
2906
  var symbolAppId = Symbol("appId");
@@ -3167,7 +3167,7 @@
3167
3167
  var {
3168
3168
  children
3169
3169
  } = _ref,
3170
- rest = _objectWithoutProperties__default["default"](_ref, _excluded$6);
3170
+ rest = _objectWithoutProperties__default["default"](_ref, _excluded$7);
3171
3171
  var overrideAppId = rest[symbolAppId];
3172
3172
  if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
3173
3173
  appIds.add(overrideAppId);
@@ -3454,8 +3454,8 @@
3454
3454
  }
3455
3455
 
3456
3456
  /* istanbul ignore next */
3457
- function _dev_only_updateSnippetPreviewSettings(appId, snippetData) {
3458
- kernel._dev_only_updateSnippetPreviewSettings(appId, snippetData);
3457
+ function _dev_only_updateSnippetPreviewSettings(appId, snippetData, settings) {
3458
+ kernel._dev_only_updateSnippetPreviewSettings(appId, snippetData, settings);
3459
3459
  }
3460
3460
 
3461
3461
  /* istanbul ignore next */
@@ -3465,8 +3465,10 @@
3465
3465
  function _dev_only_updateStoryboardByTemplate(appId, newTemplate, settings) {
3466
3466
  kernel._dev_only_updateStoryboardByTemplate(appId, newTemplate, settings);
3467
3467
  }
3468
- function _dev_only_updateStoryboardBySnippet(appId, newSnippet) {
3469
- kernel._dev_only_updateStoryboardBySnippet(appId, newSnippet);
3468
+
3469
+ /* istanbul ignore next */
3470
+ function _dev_only_updateStoryboardBySnippet(appId, newSnippet, settings) {
3471
+ kernel._dev_only_updateStoryboardBySnippet(appId, newSnippet, settings);
3470
3472
  }
3471
3473
 
3472
3474
  /* istanbul ignore next */
@@ -3822,7 +3824,7 @@
3822
3824
  return kernel.loadDynamicBricksInBrickConf(brickConf);
3823
3825
  }
3824
3826
 
3825
- var _excluded$5 = ["extraQuery", "clear", "keepHash"];
3827
+ var _excluded$6 = ["extraQuery", "clear", "keepHash"];
3826
3828
  var blocked = false;
3827
3829
  function getUserConfirmation(message, callback) {
3828
3830
  blocked = !confirm(message);
@@ -3852,7 +3854,7 @@
3852
3854
  clear,
3853
3855
  keepHash
3854
3856
  } = options,
3855
- state = _objectWithoutProperties__default["default"](options, _excluded$5);
3857
+ state = _objectWithoutProperties__default["default"](options, _excluded$6);
3856
3858
  var urlSearchParams = new URLSearchParams(clear ? "" : browserHistory.location.search);
3857
3859
  var params = {};
3858
3860
  Object.assign(params, query, extraQuery);
@@ -7289,7 +7291,7 @@
7289
7291
  };
7290
7292
  }();
7291
7293
 
7292
- var _excluded$4 = ["feature_flags"],
7294
+ var _excluded$5 = ["feature_flags"],
7293
7295
  _excluded2$1 = ["featureFlags", "misc"];
7294
7296
  function standaloneBootstrap() {
7295
7297
  return _standaloneBootstrap.apply(this, arguments);
@@ -7335,7 +7337,7 @@
7335
7337
  var {
7336
7338
  feature_flags: featureFlags
7337
7339
  } = sys_settings,
7338
- rest = _objectWithoutProperties__default["default"](sys_settings, _excluded$4);
7340
+ rest = _objectWithoutProperties__default["default"](sys_settings, _excluded$5);
7339
7341
  settings = _objectSpread__default["default"]({
7340
7342
  featureFlags
7341
7343
  }, rest);
@@ -8348,7 +8350,7 @@
8348
8350
  }
8349
8351
  }
8350
8352
 
8351
- var _excluded$3 = ["properties", "slots"],
8353
+ var _excluded$4 = ["properties", "slots"],
8352
8354
  _excluded2 = ["ref", "slots"];
8353
8355
  function expandCustomTemplate(brickConf, proxyBrick, context) {
8354
8356
  var tplContext = new CustomTemplateContext(proxyBrick);
@@ -8392,7 +8394,7 @@
8392
8394
  properties: templateProperties,
8393
8395
  slots: externalSlots
8394
8396
  } = brickConf,
8395
- restBrickConf = _objectWithoutProperties__default["default"](brickConf, _excluded$3);
8397
+ restBrickConf = _objectWithoutProperties__default["default"](brickConf, _excluded$4);
8396
8398
  var newBrickConf = restBrickConf;
8397
8399
 
8398
8400
  // Get a copy of proxy for each instance of custom template.
@@ -8808,6 +8810,7 @@
8808
8810
  return misc;
8809
8811
  }
8810
8812
 
8813
+ var _excluded$3 = ["params"];
8811
8814
  class Kernel {
8812
8815
  constructor() {
8813
8816
  var _this = this;
@@ -9095,8 +9098,18 @@
9095
9098
  }
9096
9099
  postProcessStoryboard(storyboard) {
9097
9100
  storyboard.app.$$routeAliasMap = brickUtils.scanRouteAliasInStoryboard(storyboard);
9101
+ this.postProcessStoryboardImgSrc(storyboard);
9098
9102
  this.postProcessStoryboardI18n(storyboard);
9099
9103
  }
9104
+ postProcessStoryboardImgSrc(storyboard) {
9105
+ var _storyboard$app$menuI;
9106
+ if (storyboard.app.menuIcon && "imgSrc" in storyboard.app.menuIcon && (_storyboard$app$menuI = storyboard.app.menuIcon.imgSrc) !== null && _storyboard$app$menuI !== void 0 && _storyboard$app$menuI.startsWith("api/")) {
9107
+ var splittedImgSrc = storyboard.app.menuIcon.imgSrc.split("/");
9108
+ var imgSrc = splittedImgSrc[splittedImgSrc.length - 1];
9109
+ var result = imagesFactory(storyboard.app.id, storyboard.app.isBuildPush, storyboard.app.currentVersion).get(imgSrc);
9110
+ storyboard.app.menuIcon.imgSrc = result;
9111
+ }
9112
+ }
9100
9113
  postProcessStoryboardI18n(storyboard) {
9101
9114
  var _storyboard$meta;
9102
9115
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
@@ -9191,27 +9204,42 @@
9191
9204
  routes.splice(previewRouteIndex, 1, newPreviewRoute);
9192
9205
  }
9193
9206
  }
9194
- _dev_only_updateSnippetPreviewSettings(appId, snippetData) {
9195
- var _snippetData$bricks;
9207
+ _dev_only_updateSnippetPreviewSettings(appId, snippetData, settings) {
9196
9208
  var {
9197
9209
  routes,
9198
9210
  app
9199
9211
  } = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9200
9212
  var previewPath = "${APP.homepage}/_dev_only_/snippet-preview/".concat(snippetData.snippetId);
9201
9213
  var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
9202
- var newPreviewRoute = {
9203
- path: previewPath,
9204
- bricks: ((_snippetData$bricks = snippetData.bricks) === null || _snippetData$bricks === void 0 ? void 0 : _snippetData$bricks.length) > 0 ? snippetData.bricks : [{
9205
- brick: "span"
9206
- }],
9207
- menu: false,
9208
- exact: true,
9209
- hybrid: app.legacy === "iframe"
9210
- };
9211
- if (previewRouteIndex === -1) {
9212
- routes.unshift(newPreviewRoute);
9213
- } else {
9214
- routes.splice(previewRouteIndex, 1, newPreviewRoute);
9214
+ try {
9215
+ var _parsedSnippetData$br;
9216
+ var {
9217
+ params: declareParams
9218
+ } = snippetData,
9219
+ nodeData = _objectWithoutProperties__default["default"](snippetData, _excluded$3);
9220
+ var parsedSnippetData = brickUtils.snippetEvaluate(nodeData, {
9221
+ rootType: "route",
9222
+ inputParams: settings === null || settings === void 0 ? void 0 : settings.params,
9223
+ declareParams
9224
+ });
9225
+ var newPreviewRoute = {
9226
+ path: previewPath,
9227
+ bricks: ((_parsedSnippetData$br = parsedSnippetData.bricks) === null || _parsedSnippetData$br === void 0 ? void 0 : _parsedSnippetData$br.length) > 0 ? parsedSnippetData.bricks : [{
9228
+ brick: "span"
9229
+ }],
9230
+ menu: false,
9231
+ exact: true,
9232
+ hybrid: app.legacy === "iframe",
9233
+ context: parsedSnippetData.data || []
9234
+ };
9235
+ if (previewRouteIndex === -1) {
9236
+ routes.unshift(newPreviewRoute);
9237
+ } else {
9238
+ routes.splice(previewRouteIndex, 1, newPreviewRoute);
9239
+ }
9240
+ } catch (error) {
9241
+ // eslint-disable-next-line no-console
9242
+ throw new Error(error);
9215
9243
  }
9216
9244
  }
9217
9245
  _dev_only_updateStoryboardByRoute(appId, newRoute) {
@@ -9247,8 +9275,8 @@
9247
9275
  }, appId);
9248
9276
  this._dev_only_updateTemplatePreviewSettings(appId, newTemplate.name, settings);
9249
9277
  }
9250
- _dev_only_updateStoryboardBySnippet(appId, newSnippet) {
9251
- this._dev_only_updateSnippetPreviewSettings(appId, newSnippet);
9278
+ _dev_only_updateStoryboardBySnippet(appId, newSnippet, settings) {
9279
+ this._dev_only_updateSnippetPreviewSettings(appId, newSnippet, settings);
9252
9280
  }
9253
9281
  _dev_only_updateFormPreviewSettings(appId, formId, formData) {
9254
9282
  var {