import type { WeeklyReportResponse } from '../../service/visibility/visibility.interface'; /** The questions offered when the week's scan wrote none of its own. */ export const FALLBACK_STARTERS: readonly string[] = [ 'What changed in my AI visibility this week?', 'Which competitors are gaining on me?', 'Which pages of my site have the weakest SEO?', ]; /** How many questions sit under the composer. A short list reads as a * suggestion; a long one reads as a menu. */ export const MAX_STARTERS = 3; /** * The questions under HQ's composer: the ones the week's scan wrote, in the * brand's own language and grounded in that week's numbers, or the generic * ones when it wrote none. The two are never mixed: tapping one is the first * message of the conversation, so an English question beside Romanian ones * would decide the language of every reply after it. * * @param {WeeklyReportResponse | null} report - This week's report. * @returns {string[]} The questions to offer. */ export const starterPrompts = ( report: WeeklyReportResponse | null ): string[] => { const written: string[] = (report?.conversation_starters ?? []).filter( (question: string) => question.trim() !== '' ); return (written.length > 0 ? written : [...FALLBACK_STARTERS]).slice( 0, MAX_STARTERS ); };