@selfhelp/shared 1.17.1 → 1.19.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,12 +41,21 @@ __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
+ 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,
44
49
  ENDPOINTS: () => ENDPOINTS,
45
50
  FONT_SIZE_PX: () => FONT_SIZE_PX,
46
51
  FULL_RADIUS_PX: () => FULL_RADIUS_PX,
47
52
  HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
48
53
  LINE_HEIGHT: () => LINE_HEIGHT,
49
54
  LITERAL_CLASSES: () => LITERAL_CLASSES,
55
+ MOBILE_ICON_NAMES: () => MOBILE_ICON_NAMES,
56
+ MOBILE_ICON_SET: () => MOBILE_ICON_SET,
57
+ MOBILE_NAV_RENDER_OPTIONS: () => MOBILE_NAV_RENDER_OPTIONS,
58
+ MOBILE_NAV_RENDER_VALUES: () => MOBILE_NAV_RENDER_VALUES,
50
59
  MOBILE_PREVIEW_ENDPOINTS: () => MOBILE_PREVIEW_ENDPOINTS,
51
60
  PERMISSIONS: () => PERMISSIONS,
52
61
  PREVIEW_BRIDGE_MESSAGE: () => PREVIEW_BRIDGE_MESSAGE,
@@ -60,6 +69,8 @@ __export(index_exports, {
60
69
  SPACING_VALUES: () => SPACING_VALUES,
61
70
  STYLE_REGISTRY: () => STYLE_REGISTRY,
62
71
  SYSTEM_ENDPOINTS: () => SYSTEM_ENDPOINTS,
72
+ WEB_NAV_RENDER_OPTIONS: () => WEB_NAV_RENDER_OPTIONS,
73
+ WEB_NAV_RENDER_VALUES: () => WEB_NAV_RENDER_VALUES,
63
74
  _resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
64
75
  arePreviewPreferencesEqual: () => arePreviewPreferencesEqual,
65
76
  buildConditionContext: () => buildConditionContext,
@@ -69,6 +80,7 @@ __export(index_exports, {
69
80
  evaluateCondition: () => evaluateCondition,
70
81
  extendStyleRegistry: () => extendStyleRegistry,
71
82
  findRemap: () => findRemap,
83
+ getMenuVisibleChildren: () => getMenuVisibleChildren,
72
84
  getMergedStyleRegistry: () => getMergedStyleRegistry,
73
85
  getPluginStyleRegistry: () => getPluginStyleRegistry,
74
86
  getRegistryEntry: () => getRegistryEntry,
@@ -79,11 +91,16 @@ __export(index_exports, {
79
91
  gridSpanToReactNativeColumn: () => gridSpanToReactNativeColumn,
80
92
  hasInlineFormatting: () => hasInlineFormatting,
81
93
  isKnownStyleName: () => isKnownStyleName,
94
+ isMenuVisible: () => isMenuVisible,
95
+ isMobileIconName: () => isMobileIconName,
96
+ isMobileNavRender: () => isMobileNavRender,
97
+ isNavigationPage: () => isNavigationPage,
82
98
  isPreviewBridgeMessage: () => isPreviewBridgeMessage,
83
99
  isRegisteredStyleName: () => isRegisteredStyleName,
84
100
  isStyleAllowedOnPage: () => isStyleAllowedOnPage,
85
101
  isStylePlacementAllowed: () => isStylePlacementAllowed,
86
102
  isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
103
+ isWebNavRender: () => isWebNavRender,
87
104
  mapAccordionVariantToHeroUiVariant: () => mapAccordionVariantToHeroUiVariant,
88
105
  mapChipVariantToHeroUiVariant: () => mapChipVariantToHeroUiVariant,
89
106
  mapDividerVariantToReactNative: () => mapDividerVariantToReactNative,
@@ -105,10 +122,13 @@ __export(index_exports, {
105
122
  resolveAssetSources: () => resolveAssetSources,
106
123
  resolveAssetUrl: () => resolveAssetUrl,
107
124
  resolveMantineVariant: () => resolveMantineVariant,
125
+ resolveMobileIcon: () => resolveMobileIcon,
126
+ resolveMobileNavRender: () => resolveMobileNavRender,
108
127
  resolveSharedStyle: () => resolveSharedStyle,
109
128
  resolveSharedStyleForMobile: () => resolveSharedStyleForMobile,
110
129
  resolveSharedStyleForWeb: () => resolveSharedStyleForWeb,
111
130
  resolveSharedStyleProps: () => resolveSharedStyleProps,
131
+ resolveWebNavRender: () => resolveWebNavRender,
112
132
  setToStylePlatform: () => setToStylePlatform,
113
133
  sharedTailwindExtend: () => sharedTailwindExtend,
114
134
  sharedTailwindPreset: () => sharedTailwindPreset,
@@ -518,7 +538,13 @@ var ENDPOINTS = {
518
538
  LIST: `${API_VERSION_PREFIX}/pages`,
519
539
  LIST_WITH_LANGUAGE: (languageId) => `${API_VERSION_PREFIX}/pages/language/${languageId}`,
520
540
  BY_KEYWORD: (keyword) => `${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
521
- BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`
541
+ BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`,
542
+ /**
543
+ * DB-driven public path resolution (issue #30): maps a full public URL
544
+ * path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
545
+ * params. `path` is sent URL-encoded as a query parameter.
546
+ */
547
+ RESOLVE: (path) => `${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`
522
548
  },
523
549
  LANGUAGES: `${API_VERSION_PREFIX}/languages`,
524
550
  FORMS: {
@@ -1518,6 +1544,149 @@ function stripHtmlToText(value) {
1518
1544
  return out.replace(/\s+/g, " ").trim();
1519
1545
  }
1520
1546
 
1547
+ // src/navigation/navRender.ts
1548
+ var WEB_NAV_RENDER_VALUES = [
1549
+ "header-dropdown",
1550
+ "tabs",
1551
+ "sidebar-drawer",
1552
+ "hero-cards"
1553
+ ];
1554
+ var MOBILE_NAV_RENDER_VALUES = [
1555
+ "segmented-tabs",
1556
+ "bottom-tabs",
1557
+ "drawer",
1558
+ "hero-cards"
1559
+ ];
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."
1584
+ }
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."
1606
+ }
1607
+ ];
1608
+ function isWebNavRender(value) {
1609
+ return typeof value === "string" && WEB_NAV_RENDER_VALUES.includes(value);
1610
+ }
1611
+ function isMobileNavRender(value) {
1612
+ return typeof value === "string" && MOBILE_NAV_RENDER_VALUES.includes(value);
1613
+ }
1614
+ function resolveWebNavRender(value, fallback = DEFAULT_WEB_NAV_RENDER) {
1615
+ return isWebNavRender(value) ? value : fallback;
1616
+ }
1617
+ function resolveMobileNavRender(value, fallback = DEFAULT_MOBILE_NAV_RENDER) {
1618
+ return isMobileNavRender(value) ? value : fallback;
1619
+ }
1620
+
1621
+ // src/navigation/mobileIcons.ts
1622
+ var MOBILE_ICON_SET = [
1623
+ { name: "House", label: "Home" },
1624
+ { name: "LayoutDashboard", label: "Dashboard" },
1625
+ { name: "User", label: "User" },
1626
+ { name: "Users", label: "Users / Team" },
1627
+ { name: "Settings", label: "Settings" },
1628
+ { name: "FileText", label: "Document" },
1629
+ { name: "Files", label: "Files" },
1630
+ { name: "Folder", label: "Folder" },
1631
+ { name: "Info", label: "Info" },
1632
+ { name: "CircleQuestionMark", label: "Help" },
1633
+ { name: "Mail", label: "Mail" },
1634
+ { name: "Phone", label: "Phone" },
1635
+ { name: "Calendar", label: "Calendar" },
1636
+ { name: "Bell", label: "Notifications" },
1637
+ { name: "Search", label: "Search" },
1638
+ { name: "Star", label: "Star" },
1639
+ { name: "Heart", label: "Heart" },
1640
+ { name: "Bookmark", label: "Bookmark" },
1641
+ { name: "Map", label: "Map" },
1642
+ { name: "MapPin", label: "Location" },
1643
+ { name: "Image", label: "Image" },
1644
+ { name: "Video", label: "Video" },
1645
+ { name: "Music", label: "Music" },
1646
+ { name: "ShoppingCart", label: "Shopping cart" },
1647
+ { name: "CreditCard", label: "Payment" },
1648
+ { name: "ChartBar", label: "Bar chart" },
1649
+ { name: "ChartPie", label: "Pie chart" },
1650
+ { name: "Activity", label: "Activity" },
1651
+ { name: "Shield", label: "Shield" },
1652
+ { name: "Lock", label: "Lock" },
1653
+ { name: "Globe", label: "Globe" },
1654
+ { name: "Compass", label: "Compass" },
1655
+ { name: "Flag", label: "Flag" },
1656
+ { name: "Award", label: "Award" },
1657
+ { name: "Briefcase", label: "Work" },
1658
+ { name: "Building", label: "Building" },
1659
+ { name: "BookOpen", label: "Book" },
1660
+ { name: "MessageSquare", label: "Messages" },
1661
+ { name: "ClipboardList", label: "Tasks" },
1662
+ { name: "CircleCheck", label: "Check" },
1663
+ { name: "List", label: "List" },
1664
+ { name: "LayoutGrid", label: "Grid" },
1665
+ { name: "Menu", label: "Menu" },
1666
+ { name: "Database", label: "Data" }
1667
+ ];
1668
+ var MOBILE_ICON_NAMES = MOBILE_ICON_SET.map((entry) => entry.name);
1669
+ var DEFAULT_MOBILE_ICON = "Circle";
1670
+ function isMobileIconName(value) {
1671
+ return typeof value === "string" && MOBILE_ICON_NAMES.includes(value);
1672
+ }
1673
+ function resolveMobileIcon(value) {
1674
+ return isMobileIconName(value) ? value : DEFAULT_MOBILE_ICON;
1675
+ }
1676
+
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;
1681
+ }
1682
+ function getMenuVisibleChildren(page) {
1683
+ const children = page.children ?? [];
1684
+ return children.filter(isMenuVisible).sort((a, b) => (a.navPosition ?? 0) - (b.navPosition ?? 0));
1685
+ }
1686
+ function isNavigationPage(page) {
1687
+ return getMenuVisibleChildren(page).length > 0;
1688
+ }
1689
+
1521
1690
  // src/utils/spacing.ts
1522
1691
  var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
1523
1692
  function parseSpacing(raw) {
@@ -1570,6 +1739,10 @@ function transformPageData(apiPage) {
1570
1739
  is_system: apiPage.is_system !== void 0 ? toBool(apiPage.is_system) : void 0,
1571
1740
  title: apiPage.title ?? null,
1572
1741
  description: apiPage.description ?? null,
1742
+ icon: apiPage.icon ?? null,
1743
+ mobile_icon: apiPage.mobile_icon ?? null,
1744
+ web_nav_render: apiPage.web_nav_render ?? null,
1745
+ mobile_nav_render: apiPage.mobile_nav_render ?? null,
1573
1746
  children: apiPage.children?.map(transformPageData) ?? [],
1574
1747
  id_users: apiPage.id_users,
1575
1748
  id_pages: apiPage.id_pages ?? id,
@@ -1598,12 +1771,21 @@ function transformPagesData(pages) {
1598
1771
  COLOR_PALETTE,
1599
1772
  COLOR_SCALES,
1600
1773
  CONTAINER_SIZE_PX,
1774
+ DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
1775
+ DEFAULT_MOBILE_ICON,
1776
+ DEFAULT_MOBILE_NAV_RENDER,
1777
+ DEFAULT_WEB_GLOBAL_NAV_RENDER,
1778
+ DEFAULT_WEB_NAV_RENDER,
1601
1779
  ENDPOINTS,
1602
1780
  FONT_SIZE_PX,
1603
1781
  FULL_RADIUS_PX,
1604
1782
  HEADER_CLIENT_TYPE,
1605
1783
  LINE_HEIGHT,
1606
1784
  LITERAL_CLASSES,
1785
+ MOBILE_ICON_NAMES,
1786
+ MOBILE_ICON_SET,
1787
+ MOBILE_NAV_RENDER_OPTIONS,
1788
+ MOBILE_NAV_RENDER_VALUES,
1607
1789
  MOBILE_PREVIEW_ENDPOINTS,
1608
1790
  PERMISSIONS,
1609
1791
  PREVIEW_BRIDGE_MESSAGE,
@@ -1617,6 +1799,8 @@ function transformPagesData(pages) {
1617
1799
  SPACING_VALUES,
1618
1800
  STYLE_REGISTRY,
1619
1801
  SYSTEM_ENDPOINTS,
1802
+ WEB_NAV_RENDER_OPTIONS,
1803
+ WEB_NAV_RENDER_VALUES,
1620
1804
  _resetPluginStyleRegistry,
1621
1805
  arePreviewPreferencesEqual,
1622
1806
  buildConditionContext,
@@ -1626,6 +1810,7 @@ function transformPagesData(pages) {
1626
1810
  evaluateCondition,
1627
1811
  extendStyleRegistry,
1628
1812
  findRemap,
1813
+ getMenuVisibleChildren,
1629
1814
  getMergedStyleRegistry,
1630
1815
  getPluginStyleRegistry,
1631
1816
  getRegistryEntry,
@@ -1636,11 +1821,16 @@ function transformPagesData(pages) {
1636
1821
  gridSpanToReactNativeColumn,
1637
1822
  hasInlineFormatting,
1638
1823
  isKnownStyleName,
1824
+ isMenuVisible,
1825
+ isMobileIconName,
1826
+ isMobileNavRender,
1827
+ isNavigationPage,
1639
1828
  isPreviewBridgeMessage,
1640
1829
  isRegisteredStyleName,
1641
1830
  isStyleAllowedOnPage,
1642
1831
  isStylePlacementAllowed,
1643
1832
  isStyleSupportedOnPlatform,
1833
+ isWebNavRender,
1644
1834
  mapAccordionVariantToHeroUiVariant,
1645
1835
  mapChipVariantToHeroUiVariant,
1646
1836
  mapDividerVariantToReactNative,
@@ -1662,10 +1852,13 @@ function transformPagesData(pages) {
1662
1852
  resolveAssetSources,
1663
1853
  resolveAssetUrl,
1664
1854
  resolveMantineVariant,
1855
+ resolveMobileIcon,
1856
+ resolveMobileNavRender,
1665
1857
  resolveSharedStyle,
1666
1858
  resolveSharedStyleForMobile,
1667
1859
  resolveSharedStyleForWeb,
1668
1860
  resolveSharedStyleProps,
1861
+ resolveWebNavRender,
1669
1862
  setToStylePlatform,
1670
1863
  sharedTailwindExtend,
1671
1864
  sharedTailwindPreset,
package/dist/index.mjs CHANGED
@@ -391,7 +391,13 @@ var ENDPOINTS = {
391
391
  LIST: `${API_VERSION_PREFIX}/pages`,
392
392
  LIST_WITH_LANGUAGE: (languageId) => `${API_VERSION_PREFIX}/pages/language/${languageId}`,
393
393
  BY_KEYWORD: (keyword) => `${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
394
- BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`
394
+ BY_ID: (pageId) => `${API_VERSION_PREFIX}/pages/${pageId}`,
395
+ /**
396
+ * DB-driven public path resolution (issue #30): maps a full public URL
397
+ * path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
398
+ * params. `path` is sent URL-encoded as a query parameter.
399
+ */
400
+ RESOLVE: (path) => `${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`
395
401
  },
396
402
  LANGUAGES: `${API_VERSION_PREFIX}/languages`,
397
403
  FORMS: {
@@ -1391,6 +1397,149 @@ function stripHtmlToText(value) {
1391
1397
  return out.replace(/\s+/g, " ").trim();
1392
1398
  }
1393
1399
 
1400
+ // src/navigation/navRender.ts
1401
+ var WEB_NAV_RENDER_VALUES = [
1402
+ "header-dropdown",
1403
+ "tabs",
1404
+ "sidebar-drawer",
1405
+ "hero-cards"
1406
+ ];
1407
+ var MOBILE_NAV_RENDER_VALUES = [
1408
+ "segmented-tabs",
1409
+ "bottom-tabs",
1410
+ "drawer",
1411
+ "hero-cards"
1412
+ ];
1413
+ var DEFAULT_WEB_NAV_RENDER = "tabs";
1414
+ var DEFAULT_MOBILE_NAV_RENDER = "segmented-tabs";
1415
+ var DEFAULT_WEB_GLOBAL_NAV_RENDER = "header-dropdown";
1416
+ var DEFAULT_MOBILE_GLOBAL_NAV_RENDER = "bottom-tabs";
1417
+ var WEB_NAV_RENDER_OPTIONS = [
1418
+ {
1419
+ value: "header-dropdown",
1420
+ label: "Header dropdown",
1421
+ description: "Classic top menu; child pages appear in a dropdown. Best for the global website menu."
1422
+ },
1423
+ {
1424
+ value: "tabs",
1425
+ label: "Tabs",
1426
+ description: "Show child pages as horizontal tabs. Best for a navigation page with a few children."
1427
+ },
1428
+ {
1429
+ value: "sidebar-drawer",
1430
+ label: "Sidebar drawer",
1431
+ description: "Side drawer / hamburger menu. Best for large or deep navigation."
1432
+ },
1433
+ {
1434
+ value: "hero-cards",
1435
+ label: "Hero cards",
1436
+ description: "Dashboard-style card grid. Best for landing pages and CMS app dashboards."
1437
+ }
1438
+ ];
1439
+ var MOBILE_NAV_RENDER_OPTIONS = [
1440
+ {
1441
+ value: "segmented-tabs",
1442
+ label: "Segmented tabs",
1443
+ description: "Top segmented control for first-level children. Best for a few child pages."
1444
+ },
1445
+ {
1446
+ value: "bottom-tabs",
1447
+ label: "Bottom tabs",
1448
+ description: "Bottom tab bar for 3\u20135 main app-like destinations."
1449
+ },
1450
+ {
1451
+ value: "drawer",
1452
+ label: "Drawer",
1453
+ description: "Hamburger / side drawer for larger navigation."
1454
+ },
1455
+ {
1456
+ value: "hero-cards",
1457
+ label: "Hero cards",
1458
+ description: "Card grid for dashboards and CMS app pages."
1459
+ }
1460
+ ];
1461
+ function isWebNavRender(value) {
1462
+ return typeof value === "string" && WEB_NAV_RENDER_VALUES.includes(value);
1463
+ }
1464
+ function isMobileNavRender(value) {
1465
+ return typeof value === "string" && MOBILE_NAV_RENDER_VALUES.includes(value);
1466
+ }
1467
+ function resolveWebNavRender(value, fallback = DEFAULT_WEB_NAV_RENDER) {
1468
+ return isWebNavRender(value) ? value : fallback;
1469
+ }
1470
+ function resolveMobileNavRender(value, fallback = DEFAULT_MOBILE_NAV_RENDER) {
1471
+ return isMobileNavRender(value) ? value : fallback;
1472
+ }
1473
+
1474
+ // src/navigation/mobileIcons.ts
1475
+ var MOBILE_ICON_SET = [
1476
+ { name: "House", label: "Home" },
1477
+ { name: "LayoutDashboard", label: "Dashboard" },
1478
+ { name: "User", label: "User" },
1479
+ { name: "Users", label: "Users / Team" },
1480
+ { name: "Settings", label: "Settings" },
1481
+ { name: "FileText", label: "Document" },
1482
+ { name: "Files", label: "Files" },
1483
+ { name: "Folder", label: "Folder" },
1484
+ { name: "Info", label: "Info" },
1485
+ { name: "CircleQuestionMark", label: "Help" },
1486
+ { name: "Mail", label: "Mail" },
1487
+ { name: "Phone", label: "Phone" },
1488
+ { name: "Calendar", label: "Calendar" },
1489
+ { name: "Bell", label: "Notifications" },
1490
+ { name: "Search", label: "Search" },
1491
+ { name: "Star", label: "Star" },
1492
+ { name: "Heart", label: "Heart" },
1493
+ { name: "Bookmark", label: "Bookmark" },
1494
+ { name: "Map", label: "Map" },
1495
+ { name: "MapPin", label: "Location" },
1496
+ { name: "Image", label: "Image" },
1497
+ { name: "Video", label: "Video" },
1498
+ { name: "Music", label: "Music" },
1499
+ { name: "ShoppingCart", label: "Shopping cart" },
1500
+ { name: "CreditCard", label: "Payment" },
1501
+ { name: "ChartBar", label: "Bar chart" },
1502
+ { name: "ChartPie", label: "Pie chart" },
1503
+ { name: "Activity", label: "Activity" },
1504
+ { name: "Shield", label: "Shield" },
1505
+ { name: "Lock", label: "Lock" },
1506
+ { name: "Globe", label: "Globe" },
1507
+ { name: "Compass", label: "Compass" },
1508
+ { name: "Flag", label: "Flag" },
1509
+ { name: "Award", label: "Award" },
1510
+ { name: "Briefcase", label: "Work" },
1511
+ { name: "Building", label: "Building" },
1512
+ { name: "BookOpen", label: "Book" },
1513
+ { name: "MessageSquare", label: "Messages" },
1514
+ { name: "ClipboardList", label: "Tasks" },
1515
+ { name: "CircleCheck", label: "Check" },
1516
+ { name: "List", label: "List" },
1517
+ { name: "LayoutGrid", label: "Grid" },
1518
+ { name: "Menu", label: "Menu" },
1519
+ { name: "Database", label: "Data" }
1520
+ ];
1521
+ var MOBILE_ICON_NAMES = MOBILE_ICON_SET.map((entry) => entry.name);
1522
+ var DEFAULT_MOBILE_ICON = "Circle";
1523
+ function isMobileIconName(value) {
1524
+ return typeof value === "string" && MOBILE_ICON_NAMES.includes(value);
1525
+ }
1526
+ function resolveMobileIcon(value) {
1527
+ return isMobileIconName(value) ? value : DEFAULT_MOBILE_ICON;
1528
+ }
1529
+
1530
+ // src/navigation/menuVisibility.ts
1531
+ function isMenuVisible(page) {
1532
+ if (page.is_headless) return false;
1533
+ return page.navPosition !== null && page.navPosition !== void 0;
1534
+ }
1535
+ function getMenuVisibleChildren(page) {
1536
+ const children = page.children ?? [];
1537
+ return children.filter(isMenuVisible).sort((a, b) => (a.navPosition ?? 0) - (b.navPosition ?? 0));
1538
+ }
1539
+ function isNavigationPage(page) {
1540
+ return getMenuVisibleChildren(page).length > 0;
1541
+ }
1542
+
1394
1543
  // src/utils/spacing.ts
1395
1544
  var ALLOWED_KEYS = ["mt", "mb", "ms", "me", "pt", "pb", "ps", "pe"];
1396
1545
  function parseSpacing(raw) {
@@ -1443,6 +1592,10 @@ function transformPageData(apiPage) {
1443
1592
  is_system: apiPage.is_system !== void 0 ? toBool(apiPage.is_system) : void 0,
1444
1593
  title: apiPage.title ?? null,
1445
1594
  description: apiPage.description ?? null,
1595
+ icon: apiPage.icon ?? null,
1596
+ mobile_icon: apiPage.mobile_icon ?? null,
1597
+ web_nav_render: apiPage.web_nav_render ?? null,
1598
+ mobile_nav_render: apiPage.mobile_nav_render ?? null,
1446
1599
  children: apiPage.children?.map(transformPageData) ?? [],
1447
1600
  id_users: apiPage.id_users,
1448
1601
  id_pages: apiPage.id_pages ?? id,
@@ -1470,12 +1623,21 @@ export {
1470
1623
  COLOR_PALETTE,
1471
1624
  COLOR_SCALES,
1472
1625
  CONTAINER_SIZE_PX,
1626
+ DEFAULT_MOBILE_GLOBAL_NAV_RENDER,
1627
+ DEFAULT_MOBILE_ICON,
1628
+ DEFAULT_MOBILE_NAV_RENDER,
1629
+ DEFAULT_WEB_GLOBAL_NAV_RENDER,
1630
+ DEFAULT_WEB_NAV_RENDER,
1473
1631
  ENDPOINTS,
1474
1632
  FONT_SIZE_PX,
1475
1633
  FULL_RADIUS_PX,
1476
1634
  HEADER_CLIENT_TYPE,
1477
1635
  LINE_HEIGHT,
1478
1636
  LITERAL_CLASSES,
1637
+ MOBILE_ICON_NAMES,
1638
+ MOBILE_ICON_SET,
1639
+ MOBILE_NAV_RENDER_OPTIONS,
1640
+ MOBILE_NAV_RENDER_VALUES,
1479
1641
  MOBILE_PREVIEW_ENDPOINTS,
1480
1642
  PERMISSIONS,
1481
1643
  PREVIEW_BRIDGE_MESSAGE,
@@ -1489,6 +1651,8 @@ export {
1489
1651
  SPACING_VALUES,
1490
1652
  STYLE_REGISTRY,
1491
1653
  SYSTEM_ENDPOINTS,
1654
+ WEB_NAV_RENDER_OPTIONS,
1655
+ WEB_NAV_RENDER_VALUES,
1492
1656
  _resetPluginStyleRegistry,
1493
1657
  arePreviewPreferencesEqual,
1494
1658
  buildConditionContext,
@@ -1498,6 +1662,7 @@ export {
1498
1662
  evaluateCondition,
1499
1663
  extendStyleRegistry,
1500
1664
  findRemap,
1665
+ getMenuVisibleChildren,
1501
1666
  getMergedStyleRegistry,
1502
1667
  getPluginStyleRegistry,
1503
1668
  getRegistryEntry,
@@ -1508,11 +1673,16 @@ export {
1508
1673
  gridSpanToReactNativeColumn,
1509
1674
  hasInlineFormatting,
1510
1675
  isKnownStyleName,
1676
+ isMenuVisible,
1677
+ isMobileIconName,
1678
+ isMobileNavRender,
1679
+ isNavigationPage,
1511
1680
  isPreviewBridgeMessage,
1512
1681
  isRegisteredStyleName,
1513
1682
  isStyleAllowedOnPage,
1514
1683
  isStylePlacementAllowed,
1515
1684
  isStyleSupportedOnPlatform,
1685
+ isWebNavRender,
1516
1686
  mapAccordionVariantToHeroUiVariant,
1517
1687
  mapChipVariantToHeroUiVariant,
1518
1688
  mapDividerVariantToReactNative,
@@ -1534,10 +1704,13 @@ export {
1534
1704
  resolveAssetSources,
1535
1705
  resolveAssetUrl,
1536
1706
  resolveMantineVariant,
1707
+ resolveMobileIcon,
1708
+ resolveMobileNavRender,
1537
1709
  resolveSharedStyle,
1538
1710
  resolveSharedStyleForMobile,
1539
1711
  resolveSharedStyleForWeb,
1540
1712
  resolveSharedStyleProps,
1713
+ resolveWebNavRender,
1541
1714
  setToStylePlatform,
1542
1715
  sharedTailwindExtend,
1543
1716
  sharedTailwindPreset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.17.1",
3
+ "version": "1.19.0",
4
4
  "description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,3 +43,26 @@ describe('ENDPOINTS.AUTH password recovery', () => {
43
43
  );
44
44
  });
45
45
  });
46
+
47
+ /**
48
+ * Contract coverage for the DB-driven public path resolver (issue #30). The web
49
+ * frontend SSR layer and the mobile app both build the resolve request from
50
+ * `ENDPOINTS.PAGES.RESOLVE`, so a wrong/missing path silently breaks every
51
+ * parameterized public URL (`/reset/{user_id}/{token}`, `/team/{record_id}`).
52
+ */
53
+ describe('ENDPOINTS.PAGES.RESOLVE (DB-driven routing)', () => {
54
+ it('builds the resolve endpoint with the path as a URL-encoded query param', () => {
55
+ expect(ENDPOINTS.PAGES.RESOLVE('/team/7')).toBe(
56
+ `${API_VERSION_PREFIX}/pages/resolve?path=%2Fteam%2F7`,
57
+ );
58
+ });
59
+
60
+ it('encodes reset/validate token paths so slashes survive transport', () => {
61
+ expect(ENDPOINTS.PAGES.RESOLVE('/reset/42/abc.def~1')).toBe(
62
+ `${API_VERSION_PREFIX}/pages/resolve?path=%2Freset%2F42%2Fabc.def~1`,
63
+ );
64
+ expect(ENDPOINTS.PAGES.RESOLVE('/')).toBe(
65
+ `${API_VERSION_PREFIX}/pages/resolve?path=%2F`,
66
+ );
67
+ });
68
+ });
@@ -40,6 +40,13 @@ export const ENDPOINTS = {
40
40
  BY_KEYWORD: (keyword: string): string =>
41
41
  `${API_VERSION_PREFIX}/pages/by-keyword/${encodeURIComponent(keyword)}`,
42
42
  BY_ID: (pageId: number): string => `${API_VERSION_PREFIX}/pages/${pageId}`,
43
+ /**
44
+ * DB-driven public path resolution (issue #30): maps a full public URL
45
+ * path (e.g. `/reset/42/abc`, `/team/7`) to a page payload + route
46
+ * params. `path` is sent URL-encoded as a query parameter.
47
+ */
48
+ RESOLVE: (path: string): string =>
49
+ `${API_VERSION_PREFIX}/pages/resolve?path=${encodeURIComponent(path)}`,
43
50
  },
44
51
  LANGUAGES: `${API_VERSION_PREFIX}/languages`,
45
52
  FORMS: {
package/src/index.ts CHANGED
@@ -23,4 +23,5 @@ export * from './condition';
23
23
  export * from './cms-classes';
24
24
  export * from './assets';
25
25
  export * from './content';
26
+ export * from './navigation';
26
27
  export * from './utils';