'use client' import { useSendTelemetryEvent } from '~/lib/telemetry' import { PREFERRED_SOURCE_URL } from 'common/markdown-affordance' import type { MarkdownAffordancePageType } from 'common/telemetry-constants' import { AiTools as SharedAiTools, type AiAgent, type AiToolsProps } from 'ui-patterns/AiTools' import { SITE_ORIGIN } from '@/lib/constants' type Props = { pagePath: string pageType: MarkdownAffordancePageType showPreferredSource?: boolean } & Pick export function AiTools({ pagePath, pageType, showPreferredSource = false, orientation, titleClassName, className, }: Props) { const sendTelemetryEvent = useSendTelemetryEvent() function handleMarkdownCopy() { sendTelemetryEvent({ action: 'copy_as_markdown_clicked', properties: { pageType } }) } function handlePreferredSourceClick() { sendTelemetryEvent({ action: 'preferred_source_clicked', properties: { pageType } }) } function handleAskAiClick(agent: AiAgent) { sendTelemetryEvent({ action: 'ask_ai_clicked', properties: { agent, pageType } }) } return ( ) }