@selfhelp/shared 1.19.0 → 1.21.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.js CHANGED
@@ -41,11 +41,8 @@ __export(index_exports, {
41
41
  COLOR_PALETTE: () => COLOR_PALETTE,
42
42
  COLOR_SCALES: () => COLOR_SCALES,
43
43
  CONTAINER_SIZE_PX: () => CONTAINER_SIZE_PX,
44
- DEFAULT_MOBILE_GLOBAL_NAV_RENDER: () => DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
45
44
  DEFAULT_MOBILE_ICON: () => DEFAULT_MOBILE_ICON,
46
- DEFAULT_MOBILE_NAV_RENDER: () => DEFAULT_MOBILE_NAV_RENDER,
47
- DEFAULT_WEB_GLOBAL_NAV_RENDER: () => DEFAULT_WEB_GLOBAL_NAV_RENDER,
48
- DEFAULT_WEB_NAV_RENDER: () => DEFAULT_WEB_NAV_RENDER,
45
+ DEFAULT_WEB_HEADER_PRESET: () => DEFAULT_WEB_HEADER_PRESET,
49
46
  ENDPOINTS: () => ENDPOINTS,
50
47
  FONT_SIZE_PX: () => FONT_SIZE_PX,
51
48
  FULL_RADIUS_PX: () => FULL_RADIUS_PX,
@@ -54,8 +51,6 @@ __export(index_exports, {
54
51
  LITERAL_CLASSES: () => LITERAL_CLASSES,
55
52
  MOBILE_ICON_NAMES: () => MOBILE_ICON_NAMES,
56
53
  MOBILE_ICON_SET: () => MOBILE_ICON_SET,
57
- MOBILE_NAV_RENDER_OPTIONS: () => MOBILE_NAV_RENDER_OPTIONS,
58
- MOBILE_NAV_RENDER_VALUES: () => MOBILE_NAV_RENDER_VALUES,
59
54
  MOBILE_PREVIEW_ENDPOINTS: () => MOBILE_PREVIEW_ENDPOINTS,
60
55
  PERMISSIONS: () => PERMISSIONS,
61
56
  PREVIEW_BRIDGE_MESSAGE: () => PREVIEW_BRIDGE_MESSAGE,
@@ -69,19 +64,25 @@ __export(index_exports, {
69
64
  SPACING_VALUES: () => SPACING_VALUES,
70
65
  STYLE_REGISTRY: () => STYLE_REGISTRY,
71
66
  SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
72
- WEB_NAV_RENDER_OPTIONS: () => WEB_NAV_RENDER_OPTIONS,
73
- WEB_NAV_RENDER_VALUES: () => WEB_NAV_RENDER_VALUES,
67
+ WEB_HEADER_PRESET_OPTIONS: () => WEB_HEADER_PRESET_OPTIONS,
68
+ WEB_HEADER_PRESET_VALUES: () => WEB_HEADER_PRESET_VALUES,
74
69
  _resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
75
70
  arePreviewPreferencesEqual: () => arePreviewPreferencesEqual,
76
71
  buildConditionContext: () => buildConditionContext,
77
72
  classifyClass: () => classifyClass,
78
73
  classifyClassString: () => classifyClassString,
74
+ collectPageIdsFromMenuItems: () => collectPageIdsFromMenuItems,
79
75
  colorToHex: () => colorToHex,
80
76
  evaluateCondition: () => evaluateCondition,
81
77
  extendStyleRegistry: () => extendStyleRegistry,
78
+ findMenuItemByPageId: () => findMenuItemByPageId,
82
79
  findRemap: () => findRemap,
83
- getMenuVisibleChildren: () => getMenuVisibleChildren,
80
+ flattenMenuItems: () => flattenMenuItems,
81
+ flattenNavigationMenuItems: () => flattenNavigationMenuItems,
84
82
  getMergedStyleRegistry: () => getMergedStyleRegistry,
83
+ getNavigationItemHref: () => getNavigationItemHref,
84
+ getNavigationItemKeyword: () => getNavigationItemKeyword,
85
+ getNavigationItemLabel: () => getNavigationItemLabel,
85
86
  getPluginStyleRegistry: () => getPluginStyleRegistry,
86
87
  getRegistryEntry: () => getRegistryEntry,
87
88
  getRegistryEntryAny: () => getRegistryEntryAny,
@@ -91,16 +92,20 @@ __export(index_exports, {
91
92
  gridSpanToReactNativeColumn: () => gridSpanToReactNativeColumn,
92
93
  hasInlineFormatting: () => hasInlineFormatting,
93
94
  isKnownStyleName: () => isKnownStyleName,
94
- isMenuVisible: () => isMenuVisible,
95
95
  isMobileIconName: () => isMobileIconName,
96
- isMobileNavRender: () => isMobileNavRender,
97
- isNavigationPage: () => isNavigationPage,
96
+ isOnAnyMobileMenu: () => isOnAnyMobileMenu,
97
+ isOnAnyMobileMenuFromPayload: () => isOnAnyMobileMenuFromPayload,
98
+ isPageInMenuTree: () => isPageInMenuTree,
99
+ isPageInResolvedMenus: () => isPageInResolvedMenus,
100
+ isPageOnAnyMenu: () => isPageOnAnyMenu,
101
+ isPageOnMobileMenu: () => isPageOnMobileMenu,
102
+ isPageOnWebMenu: () => isPageOnWebMenu,
98
103
  isPreviewBridgeMessage: () => isPreviewBridgeMessage,
99
104
  isRegisteredStyleName: () => isRegisteredStyleName,
100
105
  isStyleAllowedOnPage: () => isStyleAllowedOnPage,
101
106
  isStylePlacementAllowed: () => isStylePlacementAllowed,
102
107
  isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
103
- isWebNavRender: () => isWebNavRender,
108
+ isWebHeaderPreset: () => isWebHeaderPreset,
104
109
  mapAccordionVariantToHeroUiVariant: () => mapAccordionVariantToHeroUiVariant,
105
110
  mapChipVariantToHeroUiVariant: () => mapChipVariantToHeroUiVariant,
106
111
  mapDividerVariantToReactNative: () => mapDividerVariantToReactNative,
@@ -112,6 +117,7 @@ __export(index_exports, {
112
117
  mapSizeToHeroUi: () => mapSizeToHeroUi,
113
118
  mapSizeToMantine: () => mapSizeToMantine,
114
119
  mapSpacingToPx: () => mapSpacingToPx,
120
+ pageUrlToMobileRoute: () => pageUrlToMobileRoute,
115
121
  parseDimensionToReactNative: () => parseDimensionToReactNative,
116
122
  parseDimensionToWeb: () => parseDimensionToWeb,
117
123
  parseInlineRich: () => parseInlineRich,
@@ -121,14 +127,22 @@ __export(index_exports, {
121
127
  replaceCalcedValues: () => replaceCalcedValues,
122
128
  resolveAssetSources: () => resolveAssetSources,
123
129
  resolveAssetUrl: () => resolveAssetUrl,
130
+ resolveBranchNavGroup: () => resolveBranchNavGroup,
131
+ resolveHolderRedirectPath: () => resolveHolderRedirectPath,
124
132
  resolveMantineVariant: () => resolveMantineVariant,
125
133
  resolveMobileIcon: () => resolveMobileIcon,
126
- resolveMobileNavRender: () => resolveMobileNavRender,
134
+ resolveMobilePagePresentation: () => resolveMobilePagePresentation,
135
+ resolveMobileSegmentGroup: () => resolveMobileSegmentGroup,
136
+ resolveMobileStartupKeyword: () => resolveMobileStartupKeyword,
137
+ resolveMobileStartupRoute: () => resolveMobileStartupRoute,
127
138
  resolveSharedStyle: () => resolveSharedStyle,
128
139
  resolveSharedStyleForMobile: () => resolveSharedStyleForMobile,
129
140
  resolveSharedStyleForWeb: () => resolveSharedStyleForWeb,
130
141
  resolveSharedStyleProps: () => resolveSharedStyleProps,
131
- resolveWebNavRender: () => resolveWebNavRender,
142
+ resolveWebBranchNavGroup: () => resolveWebBranchNavGroup,
143
+ resolveWebHeaderPreset: () => resolveWebHeaderPreset,
144
+ resolveWebStartupPath: () => resolveWebStartupPath,
145
+ searchMenuPagesInPayload: () => searchMenuPagesInPayload,
132
146
  setToStylePlatform: () => setToStylePlatform,
133
147
  sharedTailwindExtend: () => sharedTailwindExtend,
134
148
  sharedTailwindPreset: () => sharedTailwindPreset,
@@ -546,6 +560,14 @@ var ENDPOINTS = {
546
560
  */
547
561
  RESOLVE: (path) => `${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`
548
562
  },
563
+ NAVIGATION: {
564
+ GET: `${API_VERSION_PREFIX}/navigation`,
565
+ LAST_VISITED: `${API_VERSION_PREFIX}/navigation/last-visited`
566
+ },
567
+ SEARCH: {
568
+ CONTENT: `${API_VERSION_PREFIX}/search`,
569
+ PAGES: `${API_VERSION_PREFIX}/search/pages`
570
+ },
549
571
  LANGUAGES: `${API_VERSION_PREFIX}/languages`,
550
572
  FORMS: {
551
573
  SUBMIT: `${API_VERSION_PREFIX}/forms/submit`,
@@ -1544,78 +1566,279 @@ function stripHtmlToText(value) {
1544
1566
  return out.replace(/\s+/g, " ").trim();
1545
1567
  }
1546
1568
 
1547
- // src/navigation/navRender.ts
1548
- var WEB_NAV_RENDER_VALUES = [
1549
- "header-dropdown",
1569
+ // src/navigation/headerPreset.ts
1570
+ var WEB_HEADER_PRESET_VALUES = [
1571
+ "simple",
1572
+ "dropdown",
1573
+ "mega-menu",
1550
1574
  "tabs",
1551
- "sidebar-drawer",
1552
- "hero-cards"
1575
+ "double-dropdown",
1576
+ "double-mega-menu"
1553
1577
  ];
1554
- var MOBILE_NAV_RENDER_VALUES = [
1555
- "segmented-tabs",
1556
- "bottom-tabs",
1557
- "drawer",
1558
- "hero-cards"
1578
+ var DEFAULT_WEB_HEADER_PRESET = "dropdown";
1579
+ var WEB_HEADER_PRESET_OPTIONS = [
1580
+ { value: "simple", label: "Simple", description: "Flat header links for small sites." },
1581
+ { value: "dropdown", label: "Dropdown", description: "Default \u2014 nested dropdown menus." },
1582
+ { value: "mega-menu", label: "Mega menu", description: "Rich sections with descriptions and icons." },
1583
+ { value: "tabs", label: "Tabs", description: "Top-level sections as tabs." },
1584
+ { value: "double-dropdown", label: "Double header (dropdown)", description: "Utility row plus main dropdown nav." },
1585
+ { value: "double-mega-menu", label: "Double header (mega menu)", description: "Utility row plus mega menu." }
1559
1586
  ];
1560
- var DEFAULT_WEB_NAV_RENDER = "tabs";
1561
- var DEFAULT_MOBILE_NAV_RENDER = "segmented-tabs";
1562
- var DEFAULT_WEB_GLOBAL_NAV_RENDER = "header-dropdown";
1563
- var DEFAULT_MOBILE_GLOBAL_NAV_RENDER = "bottom-tabs";
1564
- var WEB_NAV_RENDER_OPTIONS = [
1565
- {
1566
- value: "header-dropdown",
1567
- label: "Header dropdown",
1568
- description: "Classic top menu; child pages appear in a dropdown. Best for the global website menu."
1569
- },
1570
- {
1571
- value: "tabs",
1572
- label: "Tabs",
1573
- description: "Show child pages as horizontal tabs. Best for a navigation page with a few children."
1574
- },
1575
- {
1576
- value: "sidebar-drawer",
1577
- label: "Sidebar drawer",
1578
- description: "Side drawer / hamburger menu. Best for large or deep navigation."
1579
- },
1580
- {
1581
- value: "hero-cards",
1582
- label: "Hero cards",
1583
- description: "Dashboard-style card grid. Best for landing pages and CMS app dashboards."
1587
+ function isWebHeaderPreset(value) {
1588
+ return typeof value === "string" && WEB_HEADER_PRESET_VALUES.includes(value);
1589
+ }
1590
+ function resolveWebHeaderPreset(value, fallback = DEFAULT_WEB_HEADER_PRESET) {
1591
+ return isWebHeaderPreset(value) ? value : fallback;
1592
+ }
1593
+
1594
+ // src/navigation/menuMembership.ts
1595
+ function flattenItems(items) {
1596
+ const out = [];
1597
+ for (const item of items) {
1598
+ out.push(item);
1599
+ if (item.children?.length) {
1600
+ out.push(...flattenItems(item.children));
1601
+ }
1584
1602
  }
1585
- ];
1586
- var MOBILE_NAV_RENDER_OPTIONS = [
1587
- {
1588
- value: "segmented-tabs",
1589
- label: "Segmented tabs",
1590
- description: "Top segmented control for first-level children. Best for a few child pages."
1591
- },
1592
- {
1593
- value: "bottom-tabs",
1594
- label: "Bottom tabs",
1595
- description: "Bottom tab bar for 3\u20135 main app-like destinations."
1596
- },
1597
- {
1598
- value: "drawer",
1599
- label: "Drawer",
1600
- description: "Hamburger / side drawer for larger navigation."
1601
- },
1602
- {
1603
- value: "hero-cards",
1604
- label: "Hero cards",
1605
- description: "Card grid for dashboards and CMS app pages."
1603
+ return out;
1604
+ }
1605
+ function collectPageIdsFromMenuItems(items) {
1606
+ const ids = /* @__PURE__ */ new Set();
1607
+ for (const item of flattenItems(items)) {
1608
+ if (item.page?.id != null) {
1609
+ ids.add(item.page.id);
1610
+ }
1606
1611
  }
1607
- ];
1608
- function isWebNavRender(value) {
1609
- return typeof value === "string" && WEB_NAV_RENDER_VALUES.includes(value);
1612
+ return ids;
1613
+ }
1614
+ function isPageInMenuTree(items, pageId) {
1615
+ return collectPageIdsFromMenuItems(items).has(pageId);
1616
+ }
1617
+ function isPageInResolvedMenus(menus, menuKeys, pageId) {
1618
+ for (const key of menuKeys) {
1619
+ const menu = menus[key];
1620
+ if (menu && isPageInMenuTree(menu.items, pageId)) {
1621
+ return true;
1622
+ }
1623
+ }
1624
+ return false;
1625
+ }
1626
+ function isOnAnyMobileMenu(menus, pageId) {
1627
+ return isPageInResolvedMenus(menus, ["mobile_drawer", "mobile_bottom_tabs"], pageId);
1628
+ }
1629
+ function findMenuItemByPageId(items, pageId) {
1630
+ for (const item of flattenItems(items)) {
1631
+ if (item.page?.id === pageId) {
1632
+ return item;
1633
+ }
1634
+ }
1635
+ return null;
1636
+ }
1637
+
1638
+ // src/navigation/mobileRoute.ts
1639
+ function pageUrlToMobileRoute(url, keyword) {
1640
+ const normalizedKeyword = keyword.trim().toLowerCase();
1641
+ if (normalizedKeyword === "profile") {
1642
+ return "/profile";
1643
+ }
1644
+ if (normalizedKeyword === "home" || url === "/" || url === "" || url == null) {
1645
+ return "/index";
1646
+ }
1647
+ return `/${normalizedKeyword}`;
1648
+ }
1649
+
1650
+ // src/navigation/branchNav.ts
1651
+ function itemLabel(item) {
1652
+ return item.label || item.page?.title || item.page?.keyword || "";
1653
+ }
1654
+ function toSegment(item) {
1655
+ if (!item.page) {
1656
+ return null;
1657
+ }
1658
+ return {
1659
+ pageId: item.page.id,
1660
+ keyword: item.page.keyword,
1661
+ url: item.page.url,
1662
+ label: itemLabel(item),
1663
+ icon: item.icon ?? item.page.icon,
1664
+ mobile_icon: item.page.mobile_icon
1665
+ };
1666
+ }
1667
+ function findParentItem(items, pageId, parent = null) {
1668
+ for (const item of items) {
1669
+ if (item.page?.id === pageId) {
1670
+ return { parent, siblings: items };
1671
+ }
1672
+ if (item.children?.length) {
1673
+ const found = findParentItem(item.children, pageId, item);
1674
+ if (found) {
1675
+ return found;
1676
+ }
1677
+ }
1678
+ }
1679
+ return null;
1680
+ }
1681
+ function menuVisibleChildItems(item) {
1682
+ return (item.children ?? []).filter((child) => child.page != null && child.is_active !== false);
1683
+ }
1684
+ function findMenuItemByPageId2(items, pageId) {
1685
+ for (const item of items) {
1686
+ if (item.page?.id === pageId) {
1687
+ return item;
1688
+ }
1689
+ if (item.children?.length) {
1690
+ const nested = findMenuItemByPageId2(item.children, pageId);
1691
+ if (nested) {
1692
+ return nested;
1693
+ }
1694
+ }
1695
+ }
1696
+ return null;
1697
+ }
1698
+ function selfSegment(item) {
1699
+ return toSegment(item);
1700
+ }
1701
+ function resolveBranchNavGroup(payload, currentPageId, menuKeys) {
1702
+ const allItems = [];
1703
+ for (const key of menuKeys) {
1704
+ const menu = payload.menus[key];
1705
+ if (menu?.items) {
1706
+ allItems.push(...menu.items);
1707
+ }
1708
+ }
1709
+ for (const root of allItems) {
1710
+ const selfChildren = menuVisibleChildItems(root);
1711
+ if (root.page?.id === currentPageId && selfChildren.length > 0) {
1712
+ const segments = selfChildren.map(toSegment).filter((s) => s != null);
1713
+ return segments.length > 0 ? segments : null;
1714
+ }
1715
+ const located = findParentItem([root], currentPageId);
1716
+ if (located) {
1717
+ const directChildren = menuVisibleChildItems(
1718
+ located.parent ?? { id: 0, item_type: "group", label: "", position: 0, children: located.siblings }
1719
+ );
1720
+ if (located.parent && located.parent.page?.id === currentPageId && directChildren.length > 0) {
1721
+ const segments = directChildren.map(toSegment).filter((s) => s != null);
1722
+ return segments.length > 0 ? segments : null;
1723
+ }
1724
+ const siblings = located.siblings.filter((s) => s.page != null && s.is_active !== false);
1725
+ if (siblings.length > 1) {
1726
+ const segments = siblings.map(toSegment).filter((s) => s != null);
1727
+ return segments.length > 0 ? segments : null;
1728
+ }
1729
+ }
1730
+ }
1731
+ return null;
1732
+ }
1733
+ function resolveMobileSegmentGroup(payload, currentPageId) {
1734
+ const allItems = [];
1735
+ for (const key of ["mobile_drawer", "mobile_bottom_tabs"]) {
1736
+ const menu = payload.menus[key];
1737
+ if (menu?.items) {
1738
+ allItems.push(...menu.items);
1739
+ }
1740
+ }
1741
+ const currentItem = findMenuItemByPageId2(allItems, currentPageId);
1742
+ if (currentItem) {
1743
+ const selfChildren = menuVisibleChildItems(currentItem);
1744
+ if (selfChildren.length > 0) {
1745
+ const childSegments = selfChildren.map(toSegment).filter((segment) => segment != null);
1746
+ if (childSegments.length > 0) {
1747
+ if (currentItem.page?.has_content) {
1748
+ const self = selfSegment(currentItem);
1749
+ return self ? [self, ...childSegments] : childSegments;
1750
+ }
1751
+ return childSegments;
1752
+ }
1753
+ }
1754
+ }
1755
+ return resolveBranchNavGroup(payload, currentPageId, ["mobile_drawer", "mobile_bottom_tabs"]);
1610
1756
  }
1611
- function isMobileNavRender(value) {
1612
- return typeof value === "string" && MOBILE_NAV_RENDER_VALUES.includes(value);
1757
+ function resolveWebBranchNavGroup(payload, currentPageId) {
1758
+ return resolveBranchNavGroup(payload, currentPageId, ["web_header", "web_footer"]);
1613
1759
  }
1614
- function resolveWebNavRender(value, fallback = DEFAULT_WEB_NAV_RENDER) {
1615
- return isWebNavRender(value) ? value : fallback;
1760
+ function resolveMobilePagePresentation(payload, pageId) {
1761
+ return isOnAnyMobileMenuFromPayload(payload, pageId) ? "route" : "modal";
1616
1762
  }
1617
- function resolveMobileNavRender(value, fallback = DEFAULT_MOBILE_NAV_RENDER) {
1618
- return isMobileNavRender(value) ? value : fallback;
1763
+ function isOnAnyMobileMenuFromPayload(payload, pageId) {
1764
+ const drawerIds = collectPageIdsFromMenuItems(payload.menus.mobile_drawer?.items ?? []);
1765
+ const tabIds = collectPageIdsFromMenuItems(payload.menus.mobile_bottom_tabs?.items ?? []);
1766
+ return drawerIds.has(pageId) || tabIds.has(pageId);
1767
+ }
1768
+ function resolveHolderRedirectPath(payload, currentPageId, platform, hasContent) {
1769
+ if (hasContent) {
1770
+ return null;
1771
+ }
1772
+ const segments = platform === "mobile" ? resolveMobileSegmentGroup(payload, currentPageId) : resolveWebBranchNavGroup(payload, currentPageId);
1773
+ if (!segments || segments.length === 0) {
1774
+ return null;
1775
+ }
1776
+ const target = segments.find((segment) => segment.pageId !== currentPageId) ?? segments[0];
1777
+ if (target.pageId === currentPageId) {
1778
+ return null;
1779
+ }
1780
+ if (platform === "mobile") {
1781
+ return pageUrlToMobileRoute(target.url, target.keyword);
1782
+ }
1783
+ if (target.url && target.url !== "") {
1784
+ return target.url.startsWith("/") ? target.url : `/${target.url}`;
1785
+ }
1786
+ return target.keyword === "home" ? "/" : `/${target.keyword}`;
1787
+ }
1788
+
1789
+ // src/navigation/navLinks.ts
1790
+ function getNavigationItemLabel(item) {
1791
+ return item.label || item.page?.title || item.page?.keyword || "";
1792
+ }
1793
+ function getNavigationItemHref(item) {
1794
+ if (item.item_type === "external_url" && item.external_url) {
1795
+ return item.external_url;
1796
+ }
1797
+ const page = item.page;
1798
+ if (!page) {
1799
+ return "#";
1800
+ }
1801
+ if (page.url) {
1802
+ return page.url;
1803
+ }
1804
+ return page.keyword === "home" ? "/" : `/${page.keyword}`;
1805
+ }
1806
+ function flattenNavigationMenuItems(items) {
1807
+ const out = [];
1808
+ for (const item of items) {
1809
+ out.push(item);
1810
+ if (item.children?.length) {
1811
+ out.push(...flattenNavigationMenuItems(item.children));
1812
+ }
1813
+ }
1814
+ return out;
1815
+ }
1816
+ function getNavigationItemKeyword(item) {
1817
+ return item.page?.keyword ?? null;
1818
+ }
1819
+
1820
+ // src/navigation/menuVisibility.ts
1821
+ var WEB_MENU_KEYS = ["web_header", "web_footer"];
1822
+ var MOBILE_MENU_KEYS = ["mobile_drawer", "mobile_bottom_tabs"];
1823
+ var ALL_MENU_KEYS = [...WEB_MENU_KEYS, ...MOBILE_MENU_KEYS];
1824
+ function isPageOnAnyMenu(payload, pageId) {
1825
+ return isPageInResolvedMenus(payload.menus, ALL_MENU_KEYS, pageId);
1826
+ }
1827
+ function isPageOnWebMenu(payload, pageId) {
1828
+ return isPageInResolvedMenus(payload.menus, WEB_MENU_KEYS, pageId);
1829
+ }
1830
+ function isPageOnMobileMenu(payload, pageId) {
1831
+ return isPageInResolvedMenus(payload.menus, MOBILE_MENU_KEYS, pageId);
1832
+ }
1833
+ function flattenMenuItems(items) {
1834
+ const out = [];
1835
+ for (const item of items) {
1836
+ out.push(item);
1837
+ if (item.children?.length) {
1838
+ out.push(...flattenMenuItems(item.children));
1839
+ }
1840
+ }
1841
+ return out;
1619
1842
  }
1620
1843
 
1621
1844
  // src/navigation/mobileIcons.ts
@@ -1674,17 +1897,98 @@ function resolveMobileIcon(value) {
1674
1897
  return isMobileIconName(value) ? value : DEFAULT_MOBILE_ICON;
1675
1898
  }
1676
1899
 
1677
- // src/navigation/menuVisibility.ts
1678
- function isMenuVisible(page) {
1679
- if (page.is_headless) return false;
1680
- return page.navPosition !== null && page.navPosition !== void 0;
1900
+ // src/navigation/startup.ts
1901
+ function pickStartPage(startup, isLoggedIn, platform) {
1902
+ const useMobileCustom = startup.mobile_start_page_source === "custom_mobile_pages";
1903
+ if (isLoggedIn) {
1904
+ const lastVisited = platform === "mobile" ? startup.mobile_user_last_visited_page : startup.web_user_last_visited_page;
1905
+ const startMode = platform === "mobile" ? startup.mobile_user_start_mode : startup.web_user_start_mode;
1906
+ if (startMode === "last_visited_then_fixed_page" && lastVisited) {
1907
+ return lastVisited;
1908
+ }
1909
+ if (platform === "mobile" && useMobileCustom) {
1910
+ return startup.mobile_user_start_page;
1911
+ }
1912
+ if (platform === "mobile") {
1913
+ return startup.mobile_user_start_page ?? startup.web_user_start_page;
1914
+ }
1915
+ return startup.web_user_start_page;
1916
+ }
1917
+ if (platform === "mobile" && useMobileCustom) {
1918
+ return startup.mobile_guest_start_page;
1919
+ }
1920
+ if (platform === "mobile") {
1921
+ return startup.mobile_guest_start_page ?? startup.web_guest_start_page;
1922
+ }
1923
+ return startup.web_guest_start_page;
1924
+ }
1925
+ function resolveMobileStartupRoute(startup, isLoggedIn) {
1926
+ const page = pickStartPage(startup, isLoggedIn, "mobile");
1927
+ if (!page) {
1928
+ return "/index";
1929
+ }
1930
+ return pageUrlToMobileRoute(page.url, page.keyword);
1681
1931
  }
1682
- function getMenuVisibleChildren(page) {
1683
- const children = page.children ?? [];
1684
- return children.filter(isMenuVisible).sort((a, b) => (a.navPosition ?? 0) - (b.navPosition ?? 0));
1932
+ function resolveMobileStartupKeyword(startup, isLoggedIn) {
1933
+ const page = pickStartPage(startup, isLoggedIn, "mobile");
1934
+ return page?.keyword ?? "home";
1685
1935
  }
1686
- function isNavigationPage(page) {
1687
- return getMenuVisibleChildren(page).length > 0;
1936
+ function resolveWebStartupPath(startup, isLoggedIn) {
1937
+ const page = pickStartPage(startup, isLoggedIn, "web");
1938
+ if (!page) {
1939
+ return null;
1940
+ }
1941
+ if (page.url && page.url !== "") {
1942
+ return page.url.startsWith("/") ? page.url : `/${page.url}`;
1943
+ }
1944
+ if (page.keyword === "home") {
1945
+ return "/";
1946
+ }
1947
+ return `/${page.keyword}`;
1948
+ }
1949
+
1950
+ // src/navigation/menuSearch.ts
1951
+ function haystacksForItem(item) {
1952
+ const page = item.page;
1953
+ const label = getNavigationItemLabel(item);
1954
+ const values = [label];
1955
+ if (page) {
1956
+ values.push(page.title ?? "", page.keyword ?? "", page.url ?? "");
1957
+ }
1958
+ return values.map((value) => value.trim().toLowerCase()).filter((value) => value !== "");
1959
+ }
1960
+ function searchMenuPagesInPayload(payload, query, limit = 8) {
1961
+ const needle = query.trim().toLowerCase();
1962
+ if (needle === "") {
1963
+ return [];
1964
+ }
1965
+ const hits = [];
1966
+ const seen = /* @__PURE__ */ new Set();
1967
+ for (const menu of Object.values(payload.menus)) {
1968
+ if (!menu?.items?.length) {
1969
+ continue;
1970
+ }
1971
+ for (const item of flattenMenuItems(menu.items)) {
1972
+ if (!item.page || seen.has(item.page.id)) {
1973
+ continue;
1974
+ }
1975
+ const matched = haystacksForItem(item).some((haystack) => haystack.includes(needle));
1976
+ if (!matched) {
1977
+ continue;
1978
+ }
1979
+ seen.add(item.page.id);
1980
+ hits.push({
1981
+ page_id: item.page.id,
1982
+ keyword: item.page.keyword,
1983
+ url: getNavigationItemHref(item),
1984
+ title: getNavigationItemLabel(item)
1985
+ });
1986
+ if (hits.length >= limit) {
1987
+ return hits;
1988
+ }
1989
+ }
1990
+ }
1991
+ return hits;
1688
1992
  }
1689
1993
 
1690
1994
  // src/utils/spacing.ts
@@ -1734,15 +2038,11 @@ function transformPageData(apiPage) {
1734
2038
  url: apiPage.url ?? null,
1735
2039
  parent_page_id: parentPageId,
1736
2040
  is_headless: toBool(apiPage.is_headless),
1737
- navPosition: apiPage.navPosition !== void 0 ? apiPage.navPosition : apiPage.nav_position ?? null,
1738
- footerPosition: apiPage.footerPosition !== void 0 ? apiPage.footerPosition : apiPage.footer_position ?? null,
1739
2041
  is_system: apiPage.is_system !== void 0 ? toBool(apiPage.is_system) : void 0,
1740
2042
  title: apiPage.title ?? null,
1741
2043
  description: apiPage.description ?? null,
1742
2044
  icon: apiPage.icon ?? null,
1743
2045
  mobile_icon: apiPage.mobile_icon ?? null,
1744
- web_nav_render: apiPage.web_nav_render ?? null,
1745
- mobile_nav_render: apiPage.mobile_nav_render ?? null,
1746
2046
  children: apiPage.children?.map(transformPageData) ?? [],
1747
2047
  id_users: apiPage.id_users,
1748
2048
  id_pages: apiPage.id_pages ?? id,
@@ -1771,11 +2071,8 @@ function transformPagesData(pages) {
1771
2071
  COLOR_PALETTE,
1772
2072
  COLOR_SCALES,
1773
2073
  CONTAINER_SIZE_PX,
1774
- DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
1775
2074
  DEFAULT_MOBILE_ICON,
1776
- DEFAULT_MOBILE_NAV_RENDER,
1777
- DEFAULT_WEB_GLOBAL_NAV_RENDER,
1778
- DEFAULT_WEB_NAV_RENDER,
2075
+ DEFAULT_WEB_HEADER_PRESET,
1779
2076
  ENDPOINTS,
1780
2077
  FONT_SIZE_PX,
1781
2078
  FULL_RADIUS_PX,
@@ -1784,8 +2081,6 @@ function transformPagesData(pages) {
1784
2081
  LITERAL_CLASSES,
1785
2082
  MOBILE_ICON_NAMES,
1786
2083
  MOBILE_ICON_SET,
1787
- MOBILE_NAV_RENDER_OPTIONS,
1788
- MOBILE_NAV_RENDER_VALUES,
1789
2084
  MOBILE_PREVIEW_ENDPOINTS,
1790
2085
  PERMISSIONS,
1791
2086
  PREVIEW_BRIDGE_MESSAGE,
@@ -1799,19 +2094,25 @@ function transformPagesData(pages) {
1799
2094
  SPACING_VALUES,
1800
2095
  STYLE_REGISTRY,
1801
2096
  SYSTEM_ENDPOINTS,
1802
- WEB_NAV_RENDER_OPTIONS,
1803
- WEB_NAV_RENDER_VALUES,
2097
+ WEB_HEADER_PRESET_OPTIONS,
2098
+ WEB_HEADER_PRESET_VALUES,
1804
2099
  _resetPluginStyleRegistry,
1805
2100
  arePreviewPreferencesEqual,
1806
2101
  buildConditionContext,
1807
2102
  classifyClass,
1808
2103
  classifyClassString,
2104
+ collectPageIdsFromMenuItems,
1809
2105
  colorToHex,
1810
2106
  evaluateCondition,
1811
2107
  extendStyleRegistry,
2108
+ findMenuItemByPageId,
1812
2109
  findRemap,
1813
- getMenuVisibleChildren,
2110
+ flattenMenuItems,
2111
+ flattenNavigationMenuItems,
1814
2112
  getMergedStyleRegistry,
2113
+ getNavigationItemHref,
2114
+ getNavigationItemKeyword,
2115
+ getNavigationItemLabel,
1815
2116
  getPluginStyleRegistry,
1816
2117
  getRegistryEntry,
1817
2118
  getRegistryEntryAny,
@@ -1821,16 +2122,20 @@ function transformPagesData(pages) {
1821
2122
  gridSpanToReactNativeColumn,
1822
2123
  hasInlineFormatting,
1823
2124
  isKnownStyleName,
1824
- isMenuVisible,
1825
2125
  isMobileIconName,
1826
- isMobileNavRender,
1827
- isNavigationPage,
2126
+ isOnAnyMobileMenu,
2127
+ isOnAnyMobileMenuFromPayload,
2128
+ isPageInMenuTree,
2129
+ isPageInResolvedMenus,
2130
+ isPageOnAnyMenu,
2131
+ isPageOnMobileMenu,
2132
+ isPageOnWebMenu,
1828
2133
  isPreviewBridgeMessage,
1829
2134
  isRegisteredStyleName,
1830
2135
  isStyleAllowedOnPage,
1831
2136
  isStylePlacementAllowed,
1832
2137
  isStyleSupportedOnPlatform,
1833
- isWebNavRender,
2138
+ isWebHeaderPreset,
1834
2139
  mapAccordionVariantToHeroUiVariant,
1835
2140
  mapChipVariantToHeroUiVariant,
1836
2141
  mapDividerVariantToReactNative,
@@ -1842,6 +2147,7 @@ function transformPagesData(pages) {
1842
2147
  mapSizeToHeroUi,
1843
2148
  mapSizeToMantine,
1844
2149
  mapSpacingToPx,
2150
+ pageUrlToMobileRoute,
1845
2151
  parseDimensionToReactNative,
1846
2152
  parseDimensionToWeb,
1847
2153
  parseInlineRich,
@@ -1851,14 +2157,22 @@ function transformPagesData(pages) {
1851
2157
  replaceCalcedValues,
1852
2158
  resolveAssetSources,
1853
2159
  resolveAssetUrl,
2160
+ resolveBranchNavGroup,
2161
+ resolveHolderRedirectPath,
1854
2162
  resolveMantineVariant,
1855
2163
  resolveMobileIcon,
1856
- resolveMobileNavRender,
2164
+ resolveMobilePagePresentation,
2165
+ resolveMobileSegmentGroup,
2166
+ resolveMobileStartupKeyword,
2167
+ resolveMobileStartupRoute,
1857
2168
  resolveSharedStyle,
1858
2169
  resolveSharedStyleForMobile,
1859
2170
  resolveSharedStyleForWeb,
1860
2171
  resolveSharedStyleProps,
1861
- resolveWebNavRender,
2172
+ resolveWebBranchNavGroup,
2173
+ resolveWebHeaderPreset,
2174
+ resolveWebStartupPath,
2175
+ searchMenuPagesInPayload,
1862
2176
  setToStylePlatform,
1863
2177
  sharedTailwindExtend,
1864
2178
  sharedTailwindPreset,