import type { UsageCollectionSetup } from 'src/plugins/usage_collection/public' ; import { METRIC_TYPE } from '@kbn/analytics' ; import { PLUGIN_ID } from '../../../common/constants/app' ; import { MlUsageEvent } from '../../../common/constants/usage_collection' ; export function mlUsageCollectionProvider ( usageCollection ? ) { if ( usageCollection === undefined ) { const noop = ( eventNames , count ? ) => undefined ; return { click : noop , count : noop , } ; } return { click : ( eventNames , count ? ) => usageCollection . reportUiCounter ( PLUGIN_ID , METRIC_TYPE . CLICK , eventNames , count ) , count : ( eventNames , count ? ) => usageCollection . reportUiCounter ( PLUGIN_ID , METRIC_TYPE . COUNT , eventNames , count ) , } ; }