import { type ReactNode } from 'react'; import type { CamundaApp, Cluster } from '../../utils/camunda.types'; import type { LinkProps } from './c3-navigation-v2.types'; import type { GroupDescriptor, GroupItemDescriptor } from './use-c3-navigation-v2'; type ActiveMatcher = boolean | string | ((activeItemKey: string) => boolean); export interface UseClusterSidebarEntriesOptions { /** * Hide apps the current user can't see. Receives the canonical app key * from the iteration list (e.g. `'admin'`), never the resolved `identity` * alias, so consumers don't have to branch on version. */ isAppVisible?: (app: CamundaApp, cluster: Cluster) => boolean; /** * Resolves the parent cluster's click target. When it returns link props, * the entry renders as a `group-item` (clickable + expandable). When * omitted or returning `undefined`, it renders as a pure `group`. */ resolveClusterLinkProps?: (cluster: Cluster) => LinkProps | undefined; /** * Active-state matcher for the cluster row. Mirrors the sidebar descriptor * `isActive` shape (boolean, string, or `(activeItemKey) => boolean`). * Ignored when the cluster renders as a pure group (no clickable target). */ isClusterActive?: (cluster: Cluster) => ActiveMatcher | undefined; /** * Fallback link props for paused or unhealthy clusters, per app. Keyable by * either the canonical iteration value (`'admin'`) or the resolved alias * (`'identity'`); both are checked, alias first. */ appTeaserRoutes?: Partial>; /** * Consumer-provided labels, keyed by the display alias * (`'admin'` or `'identity'` after version resolution). Fallback: * `getReadableAppName(resolvedApp)`. */ appLabels?: Partial>; /** Per-cluster trailing badge (stage tag, etc.). */ renderTrailingElement?: (cluster: Cluster) => ReactNode; /** Override the app list. Default: operate, tasklist, optimize, admin. */ apps?: CamundaApp[]; } /** * Pure builder used by `useClusterSidebarEntries`. Kept as a separate * function so stories and tests can drive it with synthetic data without * mocking `useC3Profile`. Not exported from the package surface; consumers * use the hook. */ declare function buildClusterSidebarEntries(clusters: Cluster[], { isAppVisible, resolveClusterLinkProps, isClusterActive, appTeaserRoutes, appLabels, renderTrailingElement, apps, }: UseClusterSidebarEntriesOptions): Array; export { buildClusterSidebarEntries }; /** * Builds cluster sidebar entries for consumers that list clusters in their * sidebar (web modeler, console). Reads clusters from `useC3Profile`, iterates * each cluster's available webapps, respects the identity/admin alias per * cluster version, filters invisible or missing entries, and returns the * sibling nodes ready to drop into a `SidebarSection`. Returns `[]` when * nothing is renderable. */ export declare function useClusterSidebarEntries(options?: UseClusterSidebarEntriesOptions): Array;