Files
co-lite/solvway-admin-portal/app/lib/routeModules.ts
T
ngqileandClaude Opus 5.5 62d919941b feat(portal): WhatsApp inbox page
List with Mine (plus Unassigned and All for a WhatsApp Admin), search,
unread and owner; the chat with bubbles, delivery state and failures with
Retry, media through the portal proxy, the 24-hour window, the text
composer and the template picker, and reassignment for admins. The list
polls every 30 s and an open chat every 10 s; opening an unread chat marks
it read and refreshes the sidebar badge. /whatsapp is gated by BO_WHATSAPP
(the route list test now includes it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
2026-12-02 11:13:43 +08:00

26 lines
986 B
TypeScript

// Route -> required module name. Values are the seeded aclMenu `name` column (BO_USERS, ...), NOT the `desc`
// display label: the route gate RequireModule -> useAdminAuth().hasModule(x) matches a flattened aclMenu node by
// `name` or `url` only, so a desc label here never matches and a granted user would wrongly see the
// not-authorised state.
export const ROUTE_MODULES: Record<string, string> = {
"/users": "BO_USERS",
"/roles": "BO_ROLES",
"/events": "BO_EVENTS",
"/interests": "BO_INTERESTS",
"/event-leads": "BO_EVENT_LEADS",
"/leads": "BO_LEADS",
"/emails": "BO_EMAILS",
"/login-security": "BO_LOGIN_SECURITY",
"/audit-log": "BO_AUDIT_LOG",
"/whatsapp": "BO_WHATSAPP",
};
export function requiredModuleFor(pathname: string): string | undefined {
return ROUTE_MODULES[pathname];
}
export function requiredModulesFor(pathname: string): readonly string[] | undefined {
const single = ROUTE_MODULES[pathname];
return single ? [single] : undefined;
}