Files
supabase/apps/docs/hooks/useDocsCommandMenuTelemetry.ts
Francesco Sansalvadore af43adb9a4 chore: command events (#39775)
* add CommandMenuTriggerInput in ui-patterns
* optimize search input responsiveness
* add event on commandMenu opened
* add event on debounced commandMenu input submission
* add event on commandMenu command selection
* add commandMenu telemetry to studio, www and docs

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-10-24 11:06:31 +02:00

29 lines
632 B
TypeScript

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