@selfhelp/shared 1.20.0 → 1.21.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/CHANGELOG.md +23 -0
- package/dist/index.d.mts +168 -108
- package/dist/index.d.ts +168 -108
- package/dist/index.js +476 -107
- package/dist/index.mjs +444 -92
- package/package.json +1 -1
- package/src/api/endpoints.ts +8 -0
- package/src/navigation/__tests__/navigation.test.ts +217 -68
- package/src/navigation/__tests__/startup.test.ts +33 -0
- package/src/navigation/branchNav.ts +261 -0
- package/src/navigation/headerPreset.ts +52 -0
- package/src/navigation/index.ts +9 -7
- package/src/navigation/menuMembership.ts +89 -0
- package/src/navigation/menuSearch.ts +69 -0
- package/src/navigation/menuVisibility.ts +24 -25
- package/src/navigation/mobileRoute.ts +20 -0
- package/src/navigation/navLinks.ts +38 -0
- package/src/navigation/navigationPayload.ts +84 -0
- package/src/navigation/startup.ts +87 -0
- package/src/types/api/__tests__/page-routing.test.ts +0 -6
- package/src/types/pages.ts +0 -13
- package/src/utils/__tests__/transformPageData.test.ts +3 -19
- package/src/utils/transformPageData.ts +1 -37
- package/src/navigation/navRender.ts +0 -132
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,29 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
9
9
|
|
|
10
10
|
This project follows semantic versioning.
|
|
11
11
|
|
|
12
|
+
## v1.21.1
|
|
13
|
+
|
|
14
|
+
**Menu-builder navigation helpers (patch)** — additive navigation utilities for
|
|
15
|
+
mobile bottom tabs and cross-menu page lookup. `findPageRefInNavigationPayload`
|
|
16
|
+
resolves `INavigationResolvedPageRef` metadata from any public menu tree;
|
|
17
|
+
`findNearestBottomTabMenuItemForPage` and `isBottomTabMenuItemActive` drive
|
|
18
|
+
nested bottom-tab active state (ancestor tab stays active for descendant paths).
|
|
19
|
+
`searchMenuPagesInPayload` now honours `payload.search.min_chars` before
|
|
20
|
+
returning hits. Regression tests assert legacy `TWebNavRender` /
|
|
21
|
+
`TMobileNavRender` option lists are not re-exported from the package root.
|
|
22
|
+
|
|
23
|
+
## v1.21.0
|
|
24
|
+
|
|
25
|
+
**Menu-builder navigation contract (breaking cleanup)** — replaces the page-level
|
|
26
|
+
`web_nav_render` / `mobile_nav_render` model with first-class menu payloads and
|
|
27
|
+
web header presets. The `navigation` module now exports `TWebHeaderPreset`,
|
|
28
|
+
`INavigationPayload`, menu-tree helpers (`flattenMenuItems`,
|
|
29
|
+
`isPageOnMobileMenu`, `isPageOnWebMenu`, `searchMenuPagesInPayload`),
|
|
30
|
+
mobile branch navigation (`resolveMobileSegmentGroup` with self-segment support
|
|
31
|
+
when a tab page has content), and `isOnAnyMobileMenuFromPayload`. The legacy
|
|
32
|
+
`TWebNavRender` / `TMobileNavRender` types remain exported only for archived
|
|
33
|
+
consumers; new work must use menu-builder contracts.
|
|
34
|
+
|
|
12
35
|
## v1.20.0
|
|
13
36
|
|
|
14
37
|
**CMS-in-CMS modal contract (sizing + form/list actions)** — additive contracts
|
package/dist/index.d.mts
CHANGED
|
@@ -7,56 +7,6 @@ export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, FULL_RADI
|
|
|
7
7
|
export { TAnyStyleName, TPluginStyleImplMap, TStyleImplMap, getRegistryEntry, getRegistryEntryAny, getStylePlacement, getStylePlatforms, getStylePluginId, isKnownStyleName, isRegisteredStyleName, isStyleAllowedOnPage, isStylePlacementAllowed, isStyleSupportedOnPlatform, setToStylePlatform, stylePlatformToSet } from './registry/index.mjs';
|
|
8
8
|
export { sharedTailwindExtend, sharedTailwindPreset } from './theme/tailwind.mjs';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Navigation rendering contract (shared by web + mobile).
|
|
12
|
-
*
|
|
13
|
-
* The page TREE defines navigation STRUCTURE (parent/child + `nav_position`).
|
|
14
|
-
* A per-page render type controls PRESENTATION only — it never changes the
|
|
15
|
-
* structure or the URLs. Web and mobile each pick their own renderer from the
|
|
16
|
-
* stored value, so the same subtree can render differently per platform.
|
|
17
|
-
*
|
|
18
|
-
* - `web_nav_render` selects the web renderer for a page's children.
|
|
19
|
-
* - `mobile_nav_render` selects the mobile renderer for a page's children.
|
|
20
|
-
*
|
|
21
|
-
* Both fields are OPTIONAL on a page; when unset the platform applies its
|
|
22
|
-
* default (web `tabs`, mobile `segmented-tabs` for a navigation page's
|
|
23
|
-
* children; the GLOBAL app menu defaults to web `header-dropdown` and mobile
|
|
24
|
-
* `bottom-tabs`).
|
|
25
|
-
*/
|
|
26
|
-
type TWebNavRender = 'header-dropdown' | 'tabs' | 'sidebar-drawer' | 'hero-cards';
|
|
27
|
-
type TMobileNavRender = 'segmented-tabs' | 'bottom-tabs' | 'drawer' | 'hero-cards';
|
|
28
|
-
declare const WEB_NAV_RENDER_VALUES: readonly TWebNavRender[];
|
|
29
|
-
declare const MOBILE_NAV_RENDER_VALUES: readonly TMobileNavRender[];
|
|
30
|
-
/** Default renderer for a navigation page's CHILDREN. */
|
|
31
|
-
declare const DEFAULT_WEB_NAV_RENDER: TWebNavRender;
|
|
32
|
-
declare const DEFAULT_MOBILE_NAV_RENDER: TMobileNavRender;
|
|
33
|
-
/** Default renderer for the GLOBAL app menu (header / shell). */
|
|
34
|
-
declare const DEFAULT_WEB_GLOBAL_NAV_RENDER: TWebNavRender;
|
|
35
|
-
declare const DEFAULT_MOBILE_GLOBAL_NAV_RENDER: TMobileNavRender;
|
|
36
|
-
interface INavRenderOption<T extends string> {
|
|
37
|
-
value: T;
|
|
38
|
-
/** Friendly label for the admin select. */
|
|
39
|
-
label: string;
|
|
40
|
-
/** Short, plain-language explanation shown under the select. */
|
|
41
|
-
description: string;
|
|
42
|
-
}
|
|
43
|
-
/** Option metadata for the admin "Web menu style" select. */
|
|
44
|
-
declare const WEB_NAV_RENDER_OPTIONS: readonly INavRenderOption<TWebNavRender>[];
|
|
45
|
-
/** Option metadata for the admin "Mobile menu style" select. */
|
|
46
|
-
declare const MOBILE_NAV_RENDER_OPTIONS: readonly INavRenderOption<TMobileNavRender>[];
|
|
47
|
-
declare function isWebNavRender(value: unknown): value is TWebNavRender;
|
|
48
|
-
declare function isMobileNavRender(value: unknown): value is TMobileNavRender;
|
|
49
|
-
/**
|
|
50
|
-
* Resolve a stored `web_nav_render` value to a concrete renderer, falling back
|
|
51
|
-
* to the supplied default (page-children default by default).
|
|
52
|
-
*/
|
|
53
|
-
declare function resolveWebNavRender(value: unknown, fallback?: TWebNavRender): TWebNavRender;
|
|
54
|
-
/**
|
|
55
|
-
* Resolve a stored `mobile_nav_render` value to a concrete renderer, falling
|
|
56
|
-
* back to the supplied default (page-children default by default).
|
|
57
|
-
*/
|
|
58
|
-
declare function resolveMobileNavRender(value: unknown, fallback?: TMobileNavRender): TMobileNavRender;
|
|
59
|
-
|
|
60
10
|
/**
|
|
61
11
|
* Comprehensive page type system, single source of truth for both apps.
|
|
62
12
|
*/
|
|
@@ -90,8 +40,6 @@ interface IBasePageInfo {
|
|
|
90
40
|
url: string | null;
|
|
91
41
|
parent_page_id: number | null;
|
|
92
42
|
is_headless: boolean;
|
|
93
|
-
navPosition: number | null;
|
|
94
|
-
footerPosition: number | null;
|
|
95
43
|
is_system?: boolean;
|
|
96
44
|
}
|
|
97
45
|
interface IPageAccessTypeInfo {
|
|
@@ -116,10 +64,6 @@ interface IPageItem extends IBasePageInfo {
|
|
|
116
64
|
icon?: string | null;
|
|
117
65
|
/** Mobile menu icon (curated lucide name, e.g. `Home`). Page property field `mobile_icon`. */
|
|
118
66
|
mobile_icon?: string | null;
|
|
119
|
-
/** How this page renders its children as navigation on web. Page property field `web_nav_render`. */
|
|
120
|
-
web_nav_render?: TWebNavRender | null;
|
|
121
|
-
/** How this page renders its children as navigation on mobile. Page property field `mobile_nav_render`. */
|
|
122
|
-
mobile_nav_render?: TMobileNavRender | null;
|
|
123
67
|
children?: IPageItem[];
|
|
124
68
|
}
|
|
125
69
|
interface IPageContent {
|
|
@@ -150,18 +94,12 @@ interface IPageContent {
|
|
|
150
94
|
* `modal_height` page property field.
|
|
151
95
|
*/
|
|
152
96
|
modal_height?: string | null;
|
|
153
|
-
nav_position: number | null;
|
|
154
|
-
footer_position: number | null;
|
|
155
97
|
title?: string | null;
|
|
156
98
|
description?: string | null;
|
|
157
99
|
/** Web menu icon (Tabler component name). Mirrors the `icon` page property field. */
|
|
158
100
|
icon?: string | null;
|
|
159
101
|
/** Mobile menu icon (curated lucide name). Mirrors the `mobile_icon` page property field. */
|
|
160
102
|
mobile_icon?: string | null;
|
|
161
|
-
/** Web child-navigation render type. Mirrors the `web_nav_render` page property field. */
|
|
162
|
-
web_nav_render?: TWebNavRender | null;
|
|
163
|
-
/** Mobile child-navigation render type. Mirrors the `mobile_nav_render` page property field. */
|
|
164
|
-
mobile_nav_render?: TMobileNavRender | null;
|
|
165
103
|
/**
|
|
166
104
|
* Snake_case route params extracted from the matched public URL pattern
|
|
167
105
|
* (e.g. `{ user_id: '42', token: 'abc' }` or `{ record_id: '7' }`). Present
|
|
@@ -1834,6 +1772,14 @@ declare const ENDPOINTS: {
|
|
|
1834
1772
|
*/
|
|
1835
1773
|
readonly RESOLVE: (path: string) => string;
|
|
1836
1774
|
};
|
|
1775
|
+
readonly NAVIGATION: {
|
|
1776
|
+
readonly GET: "/cms-api/v1/navigation";
|
|
1777
|
+
readonly LAST_VISITED: "/cms-api/v1/navigation/last-visited";
|
|
1778
|
+
};
|
|
1779
|
+
readonly SEARCH: {
|
|
1780
|
+
readonly CONTENT: "/cms-api/v1/search";
|
|
1781
|
+
readonly PAGES: "/cms-api/v1/search/pages";
|
|
1782
|
+
};
|
|
1837
1783
|
readonly LANGUAGES: "/cms-api/v1/languages";
|
|
1838
1784
|
readonly FORMS: {
|
|
1839
1785
|
readonly SUBMIT: "/cms-api/v1/forms/submit";
|
|
@@ -2089,6 +2035,150 @@ declare function hasInlineFormatting(value: string | null | undefined): boolean;
|
|
|
2089
2035
|
*/
|
|
2090
2036
|
declare function stripHtmlToText(value: string | null | undefined): string;
|
|
2091
2037
|
|
|
2038
|
+
/**
|
|
2039
|
+
* Global web header presentation presets (menu-builder `web_header` menu).
|
|
2040
|
+
*/
|
|
2041
|
+
type TWebHeaderPreset = 'simple' | 'dropdown' | 'mega-menu' | 'tabs' | 'double-dropdown' | 'double-mega-menu';
|
|
2042
|
+
declare const WEB_HEADER_PRESET_VALUES: readonly TWebHeaderPreset[];
|
|
2043
|
+
declare const DEFAULT_WEB_HEADER_PRESET: TWebHeaderPreset;
|
|
2044
|
+
interface IWebHeaderPresetOption {
|
|
2045
|
+
value: TWebHeaderPreset;
|
|
2046
|
+
label: string;
|
|
2047
|
+
description: string;
|
|
2048
|
+
}
|
|
2049
|
+
declare const WEB_HEADER_PRESET_OPTIONS: readonly IWebHeaderPresetOption[];
|
|
2050
|
+
declare function isWebHeaderPreset(value: unknown): value is TWebHeaderPreset;
|
|
2051
|
+
declare function resolveWebHeaderPreset(value: unknown, fallback?: TWebHeaderPreset): TWebHeaderPreset;
|
|
2052
|
+
|
|
2053
|
+
type TNavigationMenuKey = 'web_header' | 'web_footer' | 'mobile_drawer' | 'mobile_bottom_tabs';
|
|
2054
|
+
type TNavigationMenuItemType = 'page' | 'external_url' | 'group';
|
|
2055
|
+
type TNavigationChildSource = 'manual' | 'page_children' | 'manual_plus_suggestions';
|
|
2056
|
+
type TNavigationSearchMode = 'off' | 'menu_pages' | 'searchable_pages' | 'content_index';
|
|
2057
|
+
type TNavigationStartMode = 'fixed_page' | 'last_visited_then_fixed_page';
|
|
2058
|
+
type TNavigationMobileStartSource = 'same_as_web' | 'custom_mobile_pages';
|
|
2059
|
+
interface INavigationResolvedPageRef {
|
|
2060
|
+
id: number;
|
|
2061
|
+
keyword: string;
|
|
2062
|
+
url: string | null;
|
|
2063
|
+
title: string | null;
|
|
2064
|
+
icon?: string | null;
|
|
2065
|
+
mobile_icon?: string | null;
|
|
2066
|
+
has_content?: boolean;
|
|
2067
|
+
section_count?: number;
|
|
2068
|
+
}
|
|
2069
|
+
interface INavigationMenuItem {
|
|
2070
|
+
id: number | string;
|
|
2071
|
+
item_type: TNavigationMenuItemType;
|
|
2072
|
+
label: string;
|
|
2073
|
+
description?: string | null;
|
|
2074
|
+
aria_label?: string | null;
|
|
2075
|
+
icon?: string | null;
|
|
2076
|
+
position: number;
|
|
2077
|
+
external_url?: string | null;
|
|
2078
|
+
page?: INavigationResolvedPageRef | null;
|
|
2079
|
+
is_virtual?: boolean;
|
|
2080
|
+
is_active?: boolean;
|
|
2081
|
+
child_source?: TNavigationChildSource;
|
|
2082
|
+
children?: INavigationMenuItem[];
|
|
2083
|
+
}
|
|
2084
|
+
interface INavigationMenu {
|
|
2085
|
+
key: TNavigationMenuKey;
|
|
2086
|
+
platform: 'web' | 'mobile';
|
|
2087
|
+
surface: 'header' | 'footer' | 'drawer' | 'bottom_tabs';
|
|
2088
|
+
preset?: TWebHeaderPreset | string | null;
|
|
2089
|
+
max_depth?: number | null;
|
|
2090
|
+
item_limit?: number | null;
|
|
2091
|
+
items: INavigationMenuItem[];
|
|
2092
|
+
}
|
|
2093
|
+
interface INavigationStartupConfig {
|
|
2094
|
+
web_guest_start_page: INavigationResolvedPageRef | null;
|
|
2095
|
+
web_user_start_page: INavigationResolvedPageRef | null;
|
|
2096
|
+
web_user_start_mode: TNavigationStartMode;
|
|
2097
|
+
web_user_last_visited_page?: INavigationResolvedPageRef | null;
|
|
2098
|
+
mobile_guest_start_page: INavigationResolvedPageRef | null;
|
|
2099
|
+
mobile_user_start_page: INavigationResolvedPageRef | null;
|
|
2100
|
+
mobile_user_start_mode: TNavigationStartMode;
|
|
2101
|
+
mobile_user_last_visited_page?: INavigationResolvedPageRef | null;
|
|
2102
|
+
mobile_start_page_source: TNavigationMobileStartSource;
|
|
2103
|
+
}
|
|
2104
|
+
interface INavigationSearchConfig {
|
|
2105
|
+
mode: TNavigationSearchMode;
|
|
2106
|
+
min_chars: number;
|
|
2107
|
+
result_limit: number;
|
|
2108
|
+
default_visibility: string;
|
|
2109
|
+
field_policy: string;
|
|
2110
|
+
}
|
|
2111
|
+
interface INavigationPayload {
|
|
2112
|
+
menus: Record<TNavigationMenuKey, INavigationMenu>;
|
|
2113
|
+
startup: INavigationStartupConfig;
|
|
2114
|
+
search: INavigationSearchConfig;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
declare function collectPageIdsFromMenuItems(items: INavigationMenuItem[]): Set<number>;
|
|
2118
|
+
declare function isPageInMenuTree(items: INavigationMenuItem[], pageId: number): boolean;
|
|
2119
|
+
declare function isPageInResolvedMenus(menus: Partial<Record<TNavigationMenuKey, INavigationMenu>>, menuKeys: TNavigationMenuKey[], pageId: number): boolean;
|
|
2120
|
+
declare function isOnAnyMobileMenu(menus: Partial<Record<TNavigationMenuKey, INavigationMenu>>, pageId: number): boolean;
|
|
2121
|
+
declare function findMenuItemByPageId(items: INavigationMenuItem[], pageId: number): INavigationMenuItem | null;
|
|
2122
|
+
/** Resolved page metadata from any public menu tree (for holder redirects, etc.). */
|
|
2123
|
+
declare function findPageRefInNavigationPayload(payload: INavigationPayload, pageId: number): INavigationResolvedPageRef | null;
|
|
2124
|
+
|
|
2125
|
+
interface IBranchNavSegment {
|
|
2126
|
+
pageId: number;
|
|
2127
|
+
keyword: string;
|
|
2128
|
+
url: string | null;
|
|
2129
|
+
label: string;
|
|
2130
|
+
icon?: string | null;
|
|
2131
|
+
mobile_icon?: string | null;
|
|
2132
|
+
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Resolve the sibling/child segment group for in-page branch navigation.
|
|
2135
|
+
*
|
|
2136
|
+
* 1. If current page has menu-visible children in resolved menus → show children.
|
|
2137
|
+
* 2. Else if parent has menu-visible siblings → show sibling group.
|
|
2138
|
+
* 3. Else null.
|
|
2139
|
+
*/
|
|
2140
|
+
declare function resolveBranchNavGroup(payload: INavigationPayload, currentPageId: number, menuKeys: Array<keyof INavigationPayload['menus']>): IBranchNavSegment[] | null;
|
|
2141
|
+
declare function resolveMobileSegmentGroup(payload: INavigationPayload, currentPageId: number): IBranchNavSegment[] | null;
|
|
2142
|
+
declare function resolveWebBranchNavGroup(payload: INavigationPayload, currentPageId: number): IBranchNavSegment[] | null;
|
|
2143
|
+
type TMobilePagePresentation = 'route' | 'modal';
|
|
2144
|
+
declare function resolveMobilePagePresentation(payload: INavigationPayload, pageId: number): TMobilePagePresentation;
|
|
2145
|
+
declare function isOnAnyMobileMenuFromPayload(payload: INavigationPayload, pageId: number): boolean;
|
|
2146
|
+
/**
|
|
2147
|
+
* When a page is a holder (no authored content) but has menu-visible children,
|
|
2148
|
+
* return the first child route to auto-select.
|
|
2149
|
+
*/
|
|
2150
|
+
declare function resolveHolderRedirectPath(payload: INavigationPayload, currentPageId: number, platform: 'web' | 'mobile', hasContent: boolean): string | null;
|
|
2151
|
+
/**
|
|
2152
|
+
* Returns the top-level bottom-tab item that owns a nested page, if any.
|
|
2153
|
+
*/
|
|
2154
|
+
declare function findNearestBottomTabMenuItemForPage(tabs: INavigationMenuItem[], pageId: number): INavigationMenuItem | null;
|
|
2155
|
+
/**
|
|
2156
|
+
* Active state for a flat bottom-tab item, including descendants on the current path.
|
|
2157
|
+
*/
|
|
2158
|
+
declare function isBottomTabMenuItemActive(item: INavigationMenuItem, pathname: string): boolean;
|
|
2159
|
+
|
|
2160
|
+
declare function getNavigationItemLabel(item: INavigationMenuItem): string;
|
|
2161
|
+
declare function getNavigationItemHref(item: INavigationMenuItem): string;
|
|
2162
|
+
declare function flattenNavigationMenuItems(items: INavigationMenuItem[]): INavigationMenuItem[];
|
|
2163
|
+
declare function getNavigationItemKeyword(item: INavigationMenuItem): string | null;
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* Map a CMS page canonical URL + keyword to an Expo Router path.
|
|
2167
|
+
*
|
|
2168
|
+
* Wave 1 uses keyword-based routes (`[keyword].tsx`), not file `[...slug]`
|
|
2169
|
+
* segments. Nested public URLs (`/parent/child`) still navigate by keyword.
|
|
2170
|
+
*/
|
|
2171
|
+
declare function pageUrlToMobileRoute(url: string | null | undefined, keyword: string): string;
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* Menu visibility helpers for the menu-builder model.
|
|
2175
|
+
*/
|
|
2176
|
+
|
|
2177
|
+
declare function isPageOnAnyMenu(payload: INavigationPayload, pageId: number): boolean;
|
|
2178
|
+
declare function isPageOnWebMenu(payload: INavigationPayload, pageId: number): boolean;
|
|
2179
|
+
declare function isPageOnMobileMenu(payload: INavigationPayload, pageId: number): boolean;
|
|
2180
|
+
declare function flattenMenuItems(items: INavigationMenuItem[]): INavigationMenuItem[];
|
|
2181
|
+
|
|
2092
2182
|
/**
|
|
2093
2183
|
* Curated mobile icon set — the SINGLE source of truth shared by the admin
|
|
2094
2184
|
* `select-icon-mobile` picker (web frontend, drawn with `lucide-react`) and the
|
|
@@ -2117,26 +2207,23 @@ declare function isMobileIconName(value: unknown): value is string;
|
|
|
2117
2207
|
/** Resolve a stored `mobile_icon` to a drawable name, falling back to the default. */
|
|
2118
2208
|
declare function resolveMobileIcon(value: unknown): string;
|
|
2119
2209
|
|
|
2120
|
-
/**
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
* Footer-only pages (`footerPosition != null && navPosition == null`), headless
|
|
2127
|
-
* pages, and ACL-pruned pages (never in the tree to begin with) are NOT menu
|
|
2128
|
-
* pages, so they never appear in a navigation block.
|
|
2129
|
-
*/
|
|
2210
|
+
/** Resolve the mobile Expo Router path for cold start / index redirect. */
|
|
2211
|
+
declare function resolveMobileStartupRoute(startup: INavigationStartupConfig, isLoggedIn: boolean): string;
|
|
2212
|
+
/** Keyword for the CMS page rendered on `/index` when startup maps to home. */
|
|
2213
|
+
declare function resolveMobileStartupKeyword(startup: INavigationStartupConfig, isLoggedIn: boolean): string;
|
|
2214
|
+
/** Resolve a public web path for guest/user startup (leading slash). */
|
|
2215
|
+
declare function resolveWebStartupPath(startup: INavigationStartupConfig, isLoggedIn: boolean): string | null;
|
|
2130
2216
|
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2217
|
+
interface IMenuSearchHit {
|
|
2218
|
+
page_id: number;
|
|
2219
|
+
keyword: string;
|
|
2220
|
+
url: string | null;
|
|
2221
|
+
title: string;
|
|
2222
|
+
}
|
|
2134
2223
|
/**
|
|
2135
|
-
*
|
|
2136
|
-
* auto-render rule additionally requires the page to have no visible body
|
|
2137
|
-
* sections (decided by the caller, which has the resolved page content).
|
|
2224
|
+
* Client-side search over resolved menu trees (`menu_pages` search mode).
|
|
2138
2225
|
*/
|
|
2139
|
-
declare function
|
|
2226
|
+
declare function searchMenuPagesInPayload(payload: INavigationPayload, query: string, limit?: number): IMenuSearchHit[];
|
|
2140
2227
|
|
|
2141
2228
|
/**
|
|
2142
2229
|
* Parse the unified `spacing` field. The CMS
|
|
@@ -2168,28 +2255,7 @@ declare function spacingToClasses(spacing: ISpacingValue, spacingToTailwind: Rec
|
|
|
2168
2255
|
/**
|
|
2169
2256
|
* Backend → frontend page-shape transformer.
|
|
2170
2257
|
*
|
|
2171
|
-
*
|
|
2172
|
-
* (`nav_position`, `footer_position`, `id_pages`, `id_parent_page`,
|
|
2173
|
-
* `id_page_types`, `id_page_access_types`). The web and mobile apps
|
|
2174
|
-
* prefer camelCase (`navPosition`, `footerPosition`) at the type-system
|
|
2175
|
-
* level. This helper bridges the two so consumers don't have to know
|
|
2176
|
-
* about the snake-case wire format.
|
|
2177
|
-
*
|
|
2178
|
-
* It is the single source of truth for the conversion. Web frontend
|
|
2179
|
-
* and mobile both import it from `@selfhelp/shared`.
|
|
2180
|
-
*
|
|
2181
|
-
* NOTE: Pre-release breaking-change cutover (`db_naming_cutover_*`)
|
|
2182
|
-
* removed all legacy aliases (`parent`, `id_type`,
|
|
2183
|
-
* `id_pageAccessTypes`). The backend is the single source of canonical
|
|
2184
|
-
* keys; the transformer no longer accepts the legacy shapes.
|
|
2185
|
-
*
|
|
2186
|
-
* ROUTE METADATA (issue #30): this transformer deliberately does NOT carry
|
|
2187
|
-
* `route_params` / `matched_url_pattern` / `canonical_url`. Those are
|
|
2188
|
-
* resolve-time fields of a single page's full content (`IPageContent`, returned
|
|
2189
|
-
* by `GET /pages/resolve`) and are consumed directly off that type. `IPageItem`
|
|
2190
|
-
* is the navigation/menu projection of the page tree (keyword, url,
|
|
2191
|
-
* nav/footer position, parent/children) and never participates in URL
|
|
2192
|
-
* resolution, so adding a route passthrough here would be dead weight.
|
|
2258
|
+
* Menu membership is no longer projected on pages. Use `GET /navigation` for menus.
|
|
2193
2259
|
*/
|
|
2194
2260
|
|
|
2195
2261
|
interface IRawPage {
|
|
@@ -2200,18 +2266,12 @@ interface IRawPage {
|
|
|
2200
2266
|
id_parent_page?: number | null;
|
|
2201
2267
|
parent_page_id?: number | null;
|
|
2202
2268
|
is_headless?: number | boolean | null;
|
|
2203
|
-
nav_position?: number | null;
|
|
2204
|
-
navPosition?: number | null;
|
|
2205
|
-
footer_position?: number | null;
|
|
2206
|
-
footerPosition?: number | null;
|
|
2207
2269
|
is_system?: number | boolean | null;
|
|
2208
2270
|
is_open_access?: number | boolean | null;
|
|
2209
2271
|
title?: string | null;
|
|
2210
2272
|
description?: string | null;
|
|
2211
2273
|
icon?: string | null;
|
|
2212
2274
|
mobile_icon?: string | null;
|
|
2213
|
-
web_nav_render?: TWebNavRender | string | null;
|
|
2214
|
-
mobile_nav_render?: TMobileNavRender | string | null;
|
|
2215
2275
|
id_users?: number;
|
|
2216
2276
|
acl_select?: 0 | 1;
|
|
2217
2277
|
acl_insert?: 0 | 1;
|
|
@@ -2229,4 +2289,4 @@ declare function transformPageData(apiPage: IRawPage): IPageItem;
|
|
|
2229
2289
|
*/
|
|
2230
2290
|
declare function transformPagesData(pages: IRawPage[] | null | undefined): IPageItem[];
|
|
2231
2291
|
|
|
2232
|
-
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease,
|
|
2292
|
+
export { API_VERSION_PREFIX, type AdvisoryAffected, type AdvisoryFeed, type AdvisorySeverity, type BackupManifest, type BackupRetentionPolicy, type BackupSchedulePolicy, type BundledPluginRef, CLASS_PATTERNS, CLASS_REMAP, CLIENT_TYPE_MOBILE, CLIENT_TYPE_MOBILE_AND_WEB, CLIENT_TYPE_WEB, COLOR_NAMES, type CheckSeverity, type CompatibilityRules, type CoreRelease, DEFAULT_MOBILE_ICON, DEFAULT_WEB_HEADER_PRESET, type DatabaseMigrationMetadata, ENDPOINTS, type FrontendRelease, HEADER_CLIENT_TYPE, type IApiError, type IApiMeta, type IAssetSource, type IBaseApiResponse, type IBasePageInfo, type IBasePageSection, type IBranchNavSegment, type IClassPattern, type IClassRemap, type ICompatibilityError, type IConditionContext, IContentField, type IEvaluatedCondition, type IForgotPasswordRequest, type IForgotPasswordResponse, type IFormDeleteRequest, type IFormDeleteResponse, type IFormResultLegacyFields, type IFormSubmitData, type IFormSubmitRequest, type IFormSubmitResponse, type IFormUpdateData, type IFormUpdateRequest, type IFormUpdateResponse, type IFrontendUpdatePreflight, type IFrontendUpdatePreflightResponse, type IFrontendUpdateReleases, type IFrontendUpdateReleasesResponse, type IFrontendUpdateRequest, type IFrontendUpdateRequestResponse, type IGetPageResponse, type IGetPagesResponse, type IInlineNode, type IJwtPayload, type ILanguage, type ILanguageItem, type ILanguagePreference, type ILanguagePreferenceUpdateResponse, type ILanguagesResponse, type ILoginRequest, type ILoginSuccessData, type ILoginSuccessResponse, type ILogoutSuccessResponse, type IMaintenanceSetRequest, type IMenuSearchHit, type IMeta, type IMobileAdapterBaseProps, type IMobileButtonProps, type IMobileCardProps, type IMobileCheckboxProps, type IMobileContainerProps, type IMobileIconEntry, type IMobileInputProps, type IMobileModalProps, type IMobilePreviewExchangeData, type IMobilePreviewExchangeRequest, type IMobilePreviewExchangeResponse, type IMobilePreviewSessionData, type IMobilePreviewSessionRequest, type IMobilePreviewSessionResponse, type IMobilePreviewUpdatePreflight, type IMobilePreviewUpdatePreflightResponse, type IMobilePreviewUpdateReleases, type IMobilePreviewUpdateReleasesResponse, type IMobilePreviewUpdateRequest, type IMobilePreviewUpdateRequestResponse, type IMobileSelectOption, type IMobileSelectProps, type IMobileSwitchProps, type IMobileTextProps, type IMobileTextareaProps, type IMobileUiAdapters, type INavigationMenu, type INavigationMenuItem, type INavigationPayload, type INavigationResolvedPageRef, type INavigationSearchConfig, type INavigationStartupConfig, type IPageAccessTypeInfo, type IPageContent, type IPageField, type IPageFieldTranslation, type IPageFieldsData, type IPageItem, type IPageRoute, type IPageSectionWithFields, type IPageSectionsData, type IPreviewNavigateCommand, type IPreviewNavigatedMessage, type IPreviewPreferences, type IPreviewPreferencesChangedMessage, type IPreviewReadyMessage, type IPreviewSetPreferencesCommand, type IRefreshRequest, type IRefreshSuccessResponse, type IResetPasswordRequest, type IResetPasswordResponse, type IResolvePageResponse, type ISpacingValue, type ISystemAdvisories, type ISystemAdvisoriesResponse, type ISystemAdvisory, type ISystemAdvisoryAffected, type ISystemHealth, type ISystemHealthComponent, type ISystemHealthResponse, type ISystemInstalledPlugin, type ISystemMaintenance, type ISystemMaintenanceResponse, type ISystemVersion, type ISystemVersionResponse, type ITwoFactorRequiredData, type ITwoFactorRequiredResponse, type ITwoFactorVerifyRequest, type ITwoFactorVerifySuccessResponse, type IUpdatePreflight, type IUpdatePreflightCheck, type IUpdatePreflightOption, type IUpdatePreflightResponse, type IUpdateRelease, type IUpdateReleases, type IUpdateReleasesResponse, type IUpdateRequest, type IUpdateRequestResponse, type IUpdateStatus, type IUpdateStatusManager, type IUpdateStatusResponse, type IUpdateStep, type IUserData, type IUserDataResponse, type IWebHeaderPresetOption, type ImageRef, type InstalledPlugin, type InstanceImages, type InstanceLock, type InstanceManifest, type InstanceMode, type InstanceResourceConfig, type InstanceRouting, type InstanceStatus, type InstanceVersions, type InventoryInstanceEntry, LITERAL_CLASSES, type LockPluginEntry, type LockServiceEntry, MOBILE_ICON_NAMES, MOBILE_ICON_SET, MOBILE_PREVIEW_ENDPOINTS, type MobilePreviewRelease, PERMISSIONS, PREVIEW_BRIDGE_MESSAGE, PREVIEW_PARENT_ORIGIN_PARAM, PREVIEW_SHELL_PARAM, type PluginRelease, type PreflightCheck, type PreflightOption, type PreflightStatus, RELEASE_CHANNELS, type RegistryIndex, type RegistryReleaseRef, type ReleaseChannel, type RuntimeServicePolicy, type RuntimeServiceRange, SIZE_VALUES, SPACING_VALUES, SYSTEM_ENDPOINTS, type SchedulerRelease, type SecurityAdvisory, type ServerInventory, type ServiceBackendCompatibility, type SignatureBlock, type SupportBundleMeta, type TCalcedValues, type TClassDecision, type TClientType, THeroUiButtonVariant, THeroUiSize, TMobileButtonFeedback, TMobileFieldVariant, type TMobilePagePresentation, TMobileSelectPresentation, type TNavigationChildSource, type TNavigationMenuItemType, type TNavigationMenuKey, type TNavigationMobileStartSource, type TNavigationSearchMode, type TNavigationStartMode, type TPermission, type TPlatform, type TPreviewBridgeMessage, type TPreviewBridgeMessageType, type TPreviewColorScheme, type TPreviewFrameSource, TStyleName, type TSystemAdvisorySeverity, type TSystemComponentStatus, type TSystemDeployment, type TSystemHealthOverall, type TUpdateCheckSeverity, type TUpdateKind, type TUpdateOperationStatus, type TUpdatePreflightStatus, type TWebHeaderPreset, type TrustLevel, type TrustedKey, type TrustedKeysFile, type UpdatePreflightResult, WEB_HEADER_PRESET_OPTIONS, WEB_HEADER_PRESET_VALUES, type WorkerRelease, arePreviewPreferencesEqual, buildConditionContext, classifyClass, classifyClassString, collectPageIdsFromMenuItems, evaluateCondition, findMenuItemByPageId, findNearestBottomTabMenuItemForPage, findPageRefInNavigationPayload, findRemap, flattenMenuItems, flattenNavigationMenuItems, getNavigationItemHref, getNavigationItemKeyword, getNavigationItemLabel, hasInlineFormatting, isBottomTabMenuItemActive, isMobileIconName, isOnAnyMobileMenu, isOnAnyMobileMenuFromPayload, isPageInMenuTree, isPageInResolvedMenus, isPageOnAnyMenu, isPageOnMobileMenu, isPageOnWebMenu, isPreviewBridgeMessage, isWebHeaderPreset, pageUrlToMobileRoute, parseInlineRich, parseSpacing, previewKeywordFromPath, replaceCalcedValues, resolveAssetSources, resolveAssetUrl, resolveBranchNavGroup, resolveHolderRedirectPath, resolveMobileIcon, resolveMobilePagePresentation, resolveMobileSegmentGroup, resolveMobileStartupKeyword, resolveMobileStartupRoute, resolveWebBranchNavGroup, resolveWebHeaderPreset, resolveWebStartupPath, searchMenuPagesInPayload, spacingToClasses, stripHtmlToText, transformPageData, transformPagesData };
|