import { useFormContext } from 'react-hook-form' import { CampoTexto, CampoSelect } from '../components/Campos' import SectionCard from '../components/SectionCard' import { compararConDatos } from '../lib/curp' import { ESTADOS_CIVILES, REGIMENES_BIENES, TIPOS_VIVIENDA, TIPOS_COMPRA } from '../data/constantes' interface Props { prefix: string compacto?: boolean } /** Campos de datos generales; reutilizable con prefijo (cliente y co-acreditado) */ export default function DatosGeneralesCampos({ prefix, compacto = false }: Props) { const { watch } = useFormContext() const p = (campo: string) => `${prefix}${campo}` const estadoCivil = watch(p('estadoCivil')) as string const curp = (watch(p('curp')) as string) ?? '' const fechaNacimiento = (watch(p('fechaNacimiento')) as string) ?? '' const lugarNacimiento = (watch(p('lugarNacimiento')) as string) ?? '' // Advertencias ámbar en vivo: no bloquean, solo alertan inconsistencias con la CURP const advertenciasCurp = compararConDatos(curp, { fechaNacimiento, lugarNacimiento }) return ( {!compacto && } {advertenciasCurp.length > 0 && (
{advertenciasCurp.map((aviso) => (

{aviso}

))}
)} {estadoCivil === 'CASADO' && ( )} {!compacto && ( )}
) }