import { Link, Outlet, useLocation } from 'react-router-dom'; import { formatDayMonthYear } from '../../../../utils/dateUtils'; import { MSA_ROUTE, type MsaEntry } from '../../../../utils/msaAgreement'; // What the owner can still reach while an MSA update is overdue: the agreement itself, their profile and support. // Signing out is an action, not a page. Nobody else's entry is ever restricted. const SERVED_WHILE_OVERDUE = [MSA_ROUTE, '/dashboard/profile', '/dashboard/support']; const servedWhileOverdue = (path: string) => SERVED_WHILE_OVERDUE.some((served) => path === served || path.startsWith(served + '/')); /** * The owner's practice entry against the MSA: a notice while an update can still be accepted, the practice pages held * until acceptance once its date has passed, and a retry notice when standing could not be read. It never says either * agreement expired: an overdue update is an acceptance still owed. */ const MsaOwnerGate = ({ entry, onRetry }: { entry: MsaEntry; onRetry: () => void }) => { const { pathname } = useLocation(); const onAgreement = pathname === MSA_ROUTE; if (entry.kind === 'restricted' && !servedWhileOverdue(pathname)) { return (