import { ASSISTANT_CONTEXTS } from './contexts'; /** * Where the Owliver dashboard panel appears. * * The assistant occupies a permanent column in the page layout, so enabling it * on a page is a layout decision, not a feature flag — which is exactly why the * decision lives in one table rather than being scattered across pages. * * Matching is exact, not prefix-based: `/candidates` must not leak an assistant * onto a future `/candidates/:id`, and `/positions/:id` must not inherit one * from `/positions`. */ const PLACEMENT = { admin: { '/admin': 'admin.controlCenter', '/admin/candidates-analysis': 'admin.candidates', '/admin/activity': 'admin.activity', }, }; /** * Pages that must never carry the assistant, listed explicitly so the intent is * documented rather than implied by omission. * * Admin: every page except Control Center, Candidates Analysis and Activity. * Employer: every page. The contextual panel is an Admin capability. * Talent: every page. The talent portal has the standalone Owliver product, * with its own voice experience, branding and workflow. */ export const EXCLUDED_ROUTES = [ // Every Employer and Talent route: the contextual panel is Admin-only. '/', '/positions', '/positions/new', '/positions/:id', '/candidates', '/hired', '/talent-pool', '/analytics', '/profile', '/apply', '/university', '/university/:id', '/me', '/identity', '/employee', '/owliver', '/design-system', // Admin management surfaces stay focused on their own workflow. '/admin/positions', '/admin/candidates', '/admin/hired', '/admin/talent-pool', '/admin/analytics', '/admin/profile', '/admin/login', ]; /** Returns the context for a role and path, or `null` to render no assistant. */ export function resolveAssistantContext(role, pathname) { const id = PLACEMENT[role]?.[pathname]; return id ? ASSISTANT_CONTEXTS[id] : null; } /** Every enabled role/route pair — used by the placement verification. */ export function enabledRoutes() { return Object.entries(PLACEMENT).flatMap(([role, routes]) => Object.entries(routes).map(([path, contextId]) => ({ role, path, contextId })) ); }