import { EntityRef, ReactionValue } from '../../../services/feedback/types'; /** * Configuración del componente content-reaction. */ export interface ContentReactionMetadata { /** Referencia a la entidad (requerido) */ entityRef: EntityRef; /** Pregunta a mostrar (default: "¿Te resultó útil este contenido?") */ question?: string; /** Mostrar campo de comentario (default: true) */ showComment?: boolean; /** Placeholder del comentario */ commentPlaceholder?: string; /** Máximo de caracteres del comentario (default: 500) */ maxCommentLength?: number; /** * Variante visual de los botones de reacción. * - `'buttons'` (default): botones de texto redondeados ("Sí, mucho" / "No tanto"). * - `'emoji'`: iconos grandes configurables (caras, estrellas, thumbs, etc.). * Pasar `emojis` implica `variant: 'emoji'` aunque no se declare explícitamente. */ variant?: 'buttons' | 'emoji'; /** Emojis personalizados [negative, neutral, positive] | [negative, positive] */ emojis?: [string, string, string] | [string, string]; /** Labels para emojis (accesibilidad) */ emojiLabels?: [string, string, string] | [string, string]; /** * Valores de reacción para los que mostrar el campo de comentario. * Si se omite, se usa `showComment` como antes (default: todos). * Ejemplo: `['negative']` muestra el comment solo cuando el usuario elige negativo. */ commentOnValues?: ReactionValue[]; /** Mostrar toast de agradecimiento (default: true) */ showThankYou?: boolean; /** Mensaje de agradecimiento personalizado */ thankYouMessage?: string; /** Deshabilitar interacción */ disabled?: boolean; /** Modo readonly (solo mostrar selección previa) */ readonly?: boolean; /** * Valor inicial (para Storybook o cuando ya se conoce el estado). * Si se proporciona, no se consultará la API/Firebase. */ initialValue?: ReactionValue; /** * Omitir consulta de feedback previo al cargar. * Útil para Storybook o cuando se usa initialValue. */ skipInitialCheck?: boolean; /** * Permitir feedback anónimo (sin autenticación). * Usado para blogs, FAQs y contenido público. * Default: false */ allowAnonymous?: boolean; } /** * Estado interno del componente. */ export interface ContentReactionState { /** Valor seleccionado actualmente */ selectedValue: ReactionValue | null; /** Comentario del usuario */ comment: string; /** Indica si está cargando */ isLoading: boolean; /** Indica si ya envió la reacción */ isSubmitted: boolean; /** Indica si tenía reacción previa */ hadPreviousReaction: boolean; /** Error message if any */ error: string | null; } /** * Evento emitido al enviar reacción. */ export interface ReactionSubmitEvent { value: ReactionValue; comment?: string; entityRef: EntityRef; isUpdate: boolean; } /** * Evento emitido al cambiar selección. */ export interface ReactionChangeEvent { value: ReactionValue | null; previousValue: ReactionValue | null; }