@next-core/brick-kit 2.131.0 → 2.132.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
@@ -1565,44 +1565,6 @@ function getDynamicReadOnlyProxy(_ref) {
1565
1565
  });
1566
1566
  }
1567
1567
 
1568
- var misc;
1569
- function getRuntimeMisc() {
1570
- if (!misc) {
1571
- misc = {
1572
- isInIframe: false,
1573
- isInIframeOfSameSite: false,
1574
- isInIframeOfNext: false,
1575
- isInIframeOfVisualBuilder: false,
1576
- isInIframeOfLegacyConsole: false
1577
- };
1578
-
1579
- if (window !== window.parent) {
1580
- misc.isInIframe = true;
1581
-
1582
- try {
1583
- // Handle:
1584
- // - Previewing in visual builder by iframe.
1585
- // - Nesting next in next.
1586
- // - Nesting console in next.
1587
- if (window.origin === window.parent.origin) {
1588
- misc.isInIframeOfSameSite = true;
1589
- var selfIsNext = getBasePath() === "/next/";
1590
- var parentPathname = window.parent.location.pathname;
1591
- var parentIsNext = parentPathname.startsWith("/next/");
1592
- misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
1593
- misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
1594
- misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
1595
- }
1596
- } catch (e) {// do nothing
1597
- }
1598
- }
1599
-
1600
- Object.freeze(misc);
1601
- }
1602
-
1603
- return misc;
1604
- }
1605
-
1606
1568
  // `GeneralGlobals` are globals which are page-state-agnostic,
1607
1569
  // thus they can be used both in storyboard expressions and functions.
1608
1570
  function getGeneralGlobals(attemptToVisitGlobals, options) {
@@ -1655,9 +1617,6 @@ function getIndividualGlobal(variableName, _ref) {
1655
1617
  getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue
1656
1618
  };
1657
1619
 
1658
- case "RUNTIME_MISC":
1659
- return collectCoverage ? fakeRuntimeMisc() : getRuntimeMisc();
1660
-
1661
1620
  case "console":
1662
1621
  return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
1663
1622
 
@@ -1693,16 +1652,6 @@ function fakeCheckPermissions() {
1693
1652
  return true;
1694
1653
  }
1695
1654
 
1696
- function fakeRuntimeMisc() {
1697
- return {
1698
- isInIframe: false,
1699
- isInIframeOfSameSite: false,
1700
- isInIframeOfNext: false,
1701
- isInIframeOfVisualBuilder: false,
1702
- isInIframeOfLegacyConsole: false
1703
- };
1704
- }
1705
-
1706
1655
  /** @internal */
1707
1656
 
1708
1657
  /** @internal */
@@ -8820,6 +8769,44 @@ function getPropsOfCustomTemplate(tagName) {
8820
8769
  return ((_state$map = state === null || state === void 0 ? void 0 : state.map(item => item.name)) !== null && _state$map !== void 0 ? _state$map : []).concat(Object.keys((_proxy$properties = proxy === null || proxy === void 0 ? void 0 : proxy.properties) !== null && _proxy$properties !== void 0 ? _proxy$properties : {}));
8821
8770
  }
8822
8771
 
8772
+ var misc;
8773
+ function getRuntimeMisc() {
8774
+ if (!misc) {
8775
+ misc = {
8776
+ isInIframe: false,
8777
+ isInIframeOfSameSite: false,
8778
+ isInIframeOfNext: false,
8779
+ isInIframeOfVisualBuilder: false,
8780
+ isInIframeOfLegacyConsole: false
8781
+ };
8782
+
8783
+ if (window !== window.parent) {
8784
+ misc.isInIframe = true;
8785
+
8786
+ try {
8787
+ // Handle:
8788
+ // - Previewing in visual builder by iframe.
8789
+ // - Nesting next in next.
8790
+ // - Nesting console in next.
8791
+ if (window.origin === window.parent.origin) {
8792
+ misc.isInIframeOfSameSite = true;
8793
+ var selfIsNext = getBasePath() === "/next/";
8794
+ var parentPathname = window.parent.location.pathname;
8795
+ var parentIsNext = parentPathname.startsWith("/next/");
8796
+ misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
8797
+ misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
8798
+ misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
8799
+ }
8800
+ } catch (e) {// do nothing
8801
+ }
8802
+ }
8803
+
8804
+ Object.freeze(misc);
8805
+ }
8806
+
8807
+ return misc;
8808
+ }
8809
+
8823
8810
  class Kernel {
8824
8811
  constructor() {
8825
8812
  var _this = this;
@@ -8950,6 +8937,11 @@ class Kernel {
8950
8937
 
8951
8938
  listenDevtoolsEagerly();
8952
8939
  _this2.mountPoints = mountPoints;
8940
+
8941
+ if (getRuntimeMisc().isInIframeOfSameSite && !getRuntimeMisc().isInIframeOfVisualBuilder) {
8942
+ document.body.classList.add("bars-hidden-in-iframe");
8943
+ }
8944
+
8953
8945
  yield Promise.all([_this2.loadCheckLogin(), _this2.loadMicroApps()]);
8954
8946
 
8955
8947
  if (_this2.bootstrapData.storyboards.length === 0) {
@@ -9231,7 +9223,8 @@ class Kernel {
9231
9223
 
9232
9224
  _dev_only_updateTemplatePreviewSettings(appId, templateId, settings) {
9233
9225
  var {
9234
- routes
9226
+ routes,
9227
+ app
9235
9228
  } = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9236
9229
  var previewPath = "${APP.homepage}/_dev_only_/template-preview/".concat(templateId);
9237
9230
  var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
@@ -9241,7 +9234,8 @@ class Kernel {
9241
9234
  brick: templateId
9242
9235
  }, pick(settings, "properties", "events", "lifeCycle", "context"))],
9243
9236
  menu: false,
9244
- exact: true
9237
+ exact: true,
9238
+ hybrid: app.legacy === "iframe"
9245
9239
  };
9246
9240
 
9247
9241
  if (previewRouteIndex === -1) {
@@ -9255,7 +9249,8 @@ class Kernel {
9255
9249
  var _snippetData$bricks;
9256
9250
 
9257
9251
  var {
9258
- routes
9252
+ routes,
9253
+ app
9259
9254
  } = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9260
9255
  var previewPath = "${APP.homepage}/_dev_only_/snippet-preview/".concat(snippetData.snippetId);
9261
9256
  var previewRouteIndex = routes.findIndex(route => route.path === previewPath);
@@ -9265,7 +9260,8 @@ class Kernel {
9265
9260
  brick: "span"
9266
9261
  }],
9267
9262
  menu: false,
9268
- exact: true
9263
+ exact: true,
9264
+ hybrid: app.legacy === "iframe"
9269
9265
  };
9270
9266
 
9271
9267
  if (previewRouteIndex === -1) {
@@ -9277,15 +9273,19 @@ class Kernel {
9277
9273
 
9278
9274
  _dev_only_updateStoryboardByRoute(appId, newRoute) {
9279
9275
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9276
+ var match = false;
9277
+
9278
+ var getKey = route => "".concat(route.path, ".").concat(route.exact);
9280
9279
 
9281
9280
  var replaceRoute = (routes, key) => {
9282
9281
  return routes.map(route => {
9283
- var routeKey = route.path;
9282
+ var routeKey = getKey(route);
9284
9283
 
9285
9284
  if (route.type === "routes") {
9286
9285
  route.routes = replaceRoute(route.routes, key);
9287
9286
  return route;
9288
9287
  } else if (routeKey === key) {
9288
+ match = true;
9289
9289
  return newRoute;
9290
9290
  } else {
9291
9291
  return route;
@@ -9293,7 +9293,11 @@ class Kernel {
9293
9293
  });
9294
9294
  };
9295
9295
 
9296
- storyboard.routes = replaceRoute(storyboard.routes, newRoute.path);
9296
+ storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));
9297
+
9298
+ if (!match) {
9299
+ storyboard.routes.unshift(newRoute);
9300
+ }
9297
9301
  }
9298
9302
 
9299
9303
  _dev_only_updateStoryboardByTemplate(appId, newTemplate, settings) {
@@ -14772,5 +14776,5 @@ function useProvider() {
14772
14776
  }));
14773
14777
  }
14774
14778
 
14775
- export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, batchSetAppsLocalTheme, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getCurrentTheme, getHistory, getMockInfo, getRuntime, 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 };
14779
+ export { BrickAsComponent, BrickWrapper, DisplayByFeatureFlags, EasyopsEmpty, ErrorBoundary, FeatureFlagsProvider, ForwardRefSingleBrickAsComponent, ModalElement, SingleBrickAsComponent, StoryboardFunctionRegistryFactory, UpdatingElement, authenticate, batchSetAppsLocalTheme, checkIf, checkIfByTransform, createHistory, createRuntime, developHelper, doTransform, event, getAuth, getCssPropertyValue, getCurrentTheme, getHistory, getMockInfo, 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 };
14776
14780
  //# sourceMappingURL=index.esm.js.map