// Copyright: © 2026 TWWIM UG. All rights reserved. (www.twwim.com) /** * "Request contact" button — sits next to the intercept/release controls * in the ConversationDetail header. Only enabled while the operator is * actively driving the conversation (`status === 'intercepted'`). * * Click → POST /conversations/:id/request-contact via * useRequestContactMutation. No success toast; the next /captured-contact * poll surfaces the submitted data, and the SYSTEM bubble appears in the * transcript on its own. */ import { Mail } from 'lucide-react'; import { useTranslation } from '@/i18n/TranslationProvider'; import type { ConversationStatus } from '../lib/types'; import { useRequestContactMutation } from '../hooks/useRequestContactMutation'; interface RequestContactButtonProps { conversationId: string; conversationStatus: ConversationStatus; } export function RequestContactButton({ conversationId, conversationStatus }: RequestContactButtonProps) { const { t } = useTranslation(); const mutation = useRequestContactMutation(); const isIntercepted = conversationStatus === 'intercepted'; const disabled = !isIntercepted || mutation.isPending; const title = isIntercepted ? t('conversations.composer.requestContact') : t('conversations.composer.requestContactDisabled'); const handleClick = () => { if (disabled) return; mutation.mutate(conversationId); }; return ( ); }