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:
@@ -1,3 +1,4 @@
|
||||
import { headers } from 'next/headers';
|
||||
import { getTenantPerfil } from '@/db/tenant-queries';
|
||||
import { actualizarEmpresa } from './actions';
|
||||
import LogoUploader from '@/components/panel/LogoUploader';
|
||||
@@ -7,6 +8,11 @@ export const dynamic = 'force-dynamic';
|
||||
export default async function EmpresaPage() {
|
||||
const perfil = await getTenantPerfil();
|
||||
|
||||
const h = await headers();
|
||||
const host = h.get('x-forwarded-host') ?? h.get('host') ?? 'reformix.dv3.com.es';
|
||||
const proto = h.get('x-forwarded-proto') ?? 'https';
|
||||
const funnelUrl = `${proto}://${host}/${perfil.slug}`;
|
||||
|
||||
return (
|
||||
<div className="space-y-10 max-w-2xl">
|
||||
<div>
|
||||
@@ -34,6 +40,32 @@ export default async function EmpresaPage() {
|
||||
className="w-full border border-gray-300 rounded-lg px-3 py-2"
|
||||
/>
|
||||
</label>
|
||||
<label className="text-sm md:col-span-2">
|
||||
<span className="block text-gray-500 mb-1">Enlace de tu funnel *</span>
|
||||
<div className="flex items-center border border-gray-300 rounded-lg overflow-hidden">
|
||||
<span className="px-3 py-2 text-gray-400 bg-gray-50 border-r border-gray-200 select-none whitespace-nowrap">
|
||||
{host}/
|
||||
</span>
|
||||
<input
|
||||
name="slug"
|
||||
required
|
||||
defaultValue={perfil.slug}
|
||||
pattern="[a-z0-9-]+"
|
||||
className="flex-1 px-3 py-2 outline-none min-w-0"
|
||||
/>
|
||||
</div>
|
||||
<span className="block text-gray-400 mt-1.5 text-xs">
|
||||
Esta es la dirección que compartes con tus clientes:{' '}
|
||||
<a
|
||||
href={funnelUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-black underline underline-offset-2 break-all"
|
||||
>
|
||||
{funnelUrl}
|
||||
</a>
|
||||
</span>
|
||||
</label>
|
||||
<label className="text-sm">
|
||||
<span className="block text-gray-500 mb-1">CIF / NIF</span>
|
||||
<input
|
||||
|
||||
Reference in New Issue
Block a user