feat: agency portfolio with per-client integrations hub

Admin home lists tenants, alerts, and connection health; header
selector enables superadmin context; Meta/GA4/GSC/GTM/CRM/email
slots live per tenant (manual status until OAuth).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-09-22 01:31:47 +02:00
parent 9d1609c88b
commit 791976a3d8
19 changed files with 1503 additions and 20 deletions

View File

@@ -77,8 +77,12 @@ export async function middleware(req: NextRequest) {
}
if (user && path === '/login') {
const role = user?.app_metadata?.role || user?.user_metadata?.role || 'client';
const dashboardUrl = req.nextUrl.clone();
dashboardUrl.pathname = '/dashboard/kpis';
dashboardUrl.pathname =
role === 'admin' || role === 'team'
? '/dashboard/agencia'
: '/dashboard/kpis';
return withSecurityHeaders(NextResponse.redirect(dashboardUrl));
}