Files
supabase/apps/www/hooks/useWwwCommandMenuTelemetry.ts
2026-03-12 14:34:55 +01:00

29 lines
674 B
TypeScript

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 }
}