import { useSelector } from 'react-redux' ; import { getConfig } from '../config' ; import { trackEvent } from './mixpanel' ; import type { State } from '../types' ; import type { Config } from '../config/types' ; import type { AnalyticsEvent } from './types' ; returns { AnalyticsEvent export function useTrackEvent ( ) { const config = useSelector ( ( state ) => getConfig ( state ) ?. analytics ) ; return event => config && trackEvent ( event , config ) ; }