import type { MappableRouteDefinition } from '@microsoft/fast-router'; import type { FoundationAppContext } from '../context'; import type { FoundationRouteNavItem } from './navItems'; /** * @beta * @remarks * Base FoundationRouteSettings which all custom router configs should extend. */ export type FoundationRouteSettings = { public?: boolean; /** * @remarks * Can be set for route access checks. Omit or return `true` if the user is permitted to view the route. * @example * ```ts * async configure() { * this.configureRoutePermittedChecks(); * this.routes.map({ * path: 'dashboard', * ... * settings: { * isPermitted: () => this.user.hasPermission(['VIEW_DASHBOARD']), * } * }) * } * ``` */ isPermitted?: () => boolean; /** * @remarks * Can be set to re-route a not permitted user to a specific or conditional path instead of the router default. * @example * ```ts * async configure() { * this.configureRoutePermittedChecks(); * this.routes.map({ * path: 'dashboard', * ... * settings: { * notPermittedPath: () => this.user.hasProfile(['SUPPORT']) ? 'request-access' : this.notPermittedPath, * } * }) * } * ``` */ notPermittedPath?: () => string; [key: string]: any; }; /** * @beta */ export type FoundationRoute = MappableRouteDefinition & { navItems?: FoundationRouteNavItem[]; /** * Used by the AppRoutesBehavior in foundation-shell as a runtime predicate to include or exclude dynamic routes. * * @remarks * Use {@link FoundationRouteSettings.isPermitted} for app navigation phase based predication. */ predicate?: (context?: TContext) => boolean; }; //# sourceMappingURL=types.d.ts.map