Reorganiza el routing multi-tenant: funnel por slug, B2B en raíz

- / y /b2b sirven la landing B2B estática (rewrites beforeFiles)
- /{slug} resuelve el funnel del reformista (app/[slug]/page.tsx) con
  branding propio (TenantBrand) y atribución de leads por tenant
- crearLead(slug) y páginas /solicitud usan el tenant del lead
- Panel: edición del slug del funnel + URL pública en /panel/empresa
- Helper de slugs reservados para evitar colisiones con rutas reales

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Carlos Narro
2026-06-01 11:09:44 +02:00
parent e26e6be38b
commit 1a1caaf0df
15 changed files with 268 additions and 86 deletions

View File

@@ -5,6 +5,7 @@ import { getCurrentTenantId as getTenantId } from '@/lib/auth/current-user';
export type TenantPerfil = {
nombreEmpresa: string;
slug: string;
logoUrl: string | null;
provincia: string | null;
cif: string | null;
@@ -19,6 +20,7 @@ export async function getTenantPerfil(): Promise<TenantPerfil> {
const [row] = await db
.select({
nombreEmpresa: tenants.nombreEmpresa,
slug: tenants.slug,
logoUrl: tenants.logoUrl,
provincia: tenants.provincia,
cif: tenants.cif,
@@ -34,6 +36,7 @@ export async function getTenantPerfil(): Promise<TenantPerfil> {
return (
row ?? {
nombreEmpresa: 'Reformix',
slug: '',
logoUrl: null,
provincia: null,
cif: null,