import type { ReactNode } from 'react'; export interface KeepAliveRenderContext { mandateId: string; instanceId: string; scopeKey: string; } /** Mandate-scoped persistent routes: cache (mandateId, instanceId) from the URL while hidden. */ export interface KeepAliveScopedEntry { id: string; pathRegex: RegExp; scopeRegex: RegExp; /** * If false, mount once instanceId is known (Workspace). If true, both ids required (Commcoach, Graphical Editor). */ requireMandateForMount?: boolean; /** Commcoach shell omits overflow:hidden; other routes use hidden. */ shellOverflowHidden?: boolean; render: (ctx: KeepAliveRenderContext) => ReactNode; } /** Routes kept alive without mandate/instance scope (e.g. admin). */ export interface KeepAliveUnscopedEntry { id: string; pathRegex: RegExp; render: () => ReactNode; } export type KeepAliveEntry = KeepAliveScopedEntry | KeepAliveUnscopedEntry; export function isKeepAliveScoped(entry: KeepAliveEntry): entry is KeepAliveScopedEntry { return 'scopeRegex' in entry; }