import { flatten } from 'lodash' ; import { UsageCounter } from 'src/plugins/usage_collection/server' ; export const LEGACY_TERMS = [ 'alertTypeId' , 'actionTypeId' ] ; export function trackLegacyTerminology ( terms , usageCounter ? ) { if ( ! usageCounter ) { return null ; } if ( ! terms || terms . length === 0 ) { return null ; } for ( const legacyTerm of LEGACY_TERMS ) { for ( const term of flatten ( terms ) ) { if ( term . includes ( legacyTerm ) ) { usageCounter . incrementCounter ( { counterName : `legacyTerm_${ legacyTerm }` , counterType : 'legacyTerminology' , incrementBy : 1 , } ) ; } } } }