import { useCallback } from 'react' import type { CommandMenuClosedEvent, CommandMenuCommandClickedEvent, CommandMenuOpenedEvent, CommandMenuSearchSubmittedEvent, } from 'common/telemetry-constants' import { useSendTelemetryEvent } from 'lib/telemetry' export function useWwwCommandMenuTelemetry() { const sendTelemetryEvent = useSendTelemetryEvent() const onTelemetry = useCallback( ( event: | CommandMenuOpenedEvent | CommandMenuClosedEvent | CommandMenuCommandClickedEvent | CommandMenuSearchSubmittedEvent ) => { sendTelemetryEvent(event) }, [sendTelemetryEvent] ) return { onTelemetry } }