import React from 'react'; import { BLACK_CIRCLE } from '../../constants/figures.js'; import { Box, Text } from '@anthropic/ink'; import { useDebouncedDigitInput } from './useDebouncedDigitInput.js'; export type TranscriptShareResponse = 'yes' | 'no' | 'dont_ask_again'; type Props = { onSelect: (option: TranscriptShareResponse) => void; inputValue: string; setInputValue: (value: string) => void; }; const RESPONSE_INPUTS = ['1', '2', '3'] as const; type ResponseInput = (typeof RESPONSE_INPUTS)[number]; const inputToResponse: Record = { '1': 'yes', '2': 'no', '3': 'dont_ask_again', } as const; const isValidResponseInput = (input: string): input is ResponseInput => (RESPONSE_INPUTS as readonly string[]).includes(input); export function TranscriptSharePrompt({ onSelect, inputValue, setInputValue }: Props): React.ReactNode { useDebouncedDigitInput({ inputValue, setInputValue, isValidDigit: isValidResponseInput, onDigit: digit => onSelect(inputToResponse[digit]), }); return ( {BLACK_CIRCLE} Can Anthropic look at your session transcript to help us improve Claude Code? Learn more: https://code.claude.com/docs/en/data-usage#session-quality-surveys 1: Yes 2: No 3: Don't ask again ); }