@next-core/brick-kit 2.131.1 → 2.132.2

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) {
@@ -9281,15 +9273,19 @@ class Kernel {
9281
9273
 
9282
9274
  _dev_only_updateStoryboardByRoute(appId, newRoute) {
9283
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);
9284
9279
 
9285
9280
  var replaceRoute = (routes, key) => {
9286
9281
  return routes.map(route => {
9287
- var routeKey = route.path;
9282
+ var routeKey = getKey(route);
9288
9283
 
9289
9284
  if (route.type === "routes") {
9290
9285
  route.routes = replaceRoute(route.routes, key);
9291
9286
  return route;
9292
9287
  } else if (routeKey === key) {
9288
+ match = true;
9293
9289
  return newRoute;
9294
9290
  } else {
9295
9291
  return route;
@@ -9297,7 +9293,11 @@ class Kernel {
9297
9293
  });
9298
9294
  };
9299
9295
 
9300
- 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
+ }
9301
9301
  }
9302
9302
 
9303
9303
  _dev_only_updateStoryboardByTemplate(appId, newTemplate, settings) {
@@ -14776,5 +14776,5 @@ function useProvider() {
14776
14776
  }));
14777
14777
  }
14778
14778
 
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, 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 };
14780
14780
  //# sourceMappingURL=index.esm.js.map