ffa32a113d
Revisión con IA / ai-review (pull_request) Successful in 2m12s
Un cliente registrado por la web no lo reconocia el bot: el formulario dejaba escribir el numero en cualquier formato (1141984844, 01157260394) mientras que Meta manda el wa_id 5491141984844, asi que la busqueda por telefonoNorm no encontraba nada, mandaba al alta y ahi chocaba contra el email ya registrado. Quedaba en un callejon sin salida. Ahora el campo muestra "+54 9" fijo y grisado y el cliente completa solo la caracteristica (sin el 0) y el abonado (sin el 15), 10 digitos. El backend valida ese formato y guarda telefonoNorm ya como lo espera el bot. Se rechaza tambien un telefono repetido, que antes reventaba con el indice unico. Se agrega scripts/chat-bot.ts, que es como se encontro esto: permite conversar con el bot desde la consola contra cualquier base, sin Meta ni credenciales. Corriendolo contra una copia de la base de produccion se ve el ciclo completo: alta por web -> el bot lo reconoce por telefono -> pide el email -> reserva. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import { InputHTMLAttributes } from "react";
|
|
|
|
interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
label?: string;
|
|
error?: string;
|
|
/** Texto fijo grisado antes del campo (ej: el prefijo de país del teléfono). */
|
|
prefijo?: string;
|
|
ayuda?: string;
|
|
}
|
|
|
|
export default function Input({ label, error, prefijo, ayuda, className = "", id, ...props }: InputProps) {
|
|
const estiloInput = `border rounded-lg px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition bg-gray-100 text-gray-900 placeholder-gray-500 ${
|
|
error ? "border-red-400" : "border-gray-400"
|
|
} ${className}`;
|
|
|
|
return (
|
|
<div className="flex flex-col gap-1">
|
|
{label && (
|
|
<label htmlFor={id} className="text-sm font-medium text-gray-700">
|
|
{label}
|
|
</label>
|
|
)}
|
|
{prefijo ? (
|
|
<div
|
|
className={`flex items-center rounded-lg border bg-gray-100 focus-within:ring-2 focus-within:ring-blue-500 transition ${
|
|
error ? "border-red-400" : "border-gray-400"
|
|
}`}
|
|
>
|
|
<span className="pl-3 pr-1 text-sm text-gray-500 select-none">{prefijo}</span>
|
|
<input
|
|
id={id}
|
|
className={`flex-1 bg-transparent px-1 py-2 text-sm outline-none text-gray-900 placeholder-gray-500 ${className}`}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
) : (
|
|
<input id={id} className={estiloInput} {...props} />
|
|
)}
|
|
{ayuda && !error && <p className="text-xs text-gray-500">{ayuda}</p>}
|
|
{error && <p className="text-xs text-red-500">{error}</p>}
|
|
</div>
|
|
);
|
|
}
|