trackAdvancedAnalyticsEvent.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import {coreUIEventMap, CoreUIEventParameters} from './coreuiAnalyticsEvents';
  2. import {dashboardsEventMap, DashboardsEventParameters} from './dashboardsAnalyticsEvents';
  3. import {discoverEventMap, DiscoverEventParameters} from './discoverAnalyticsEvents';
  4. import {growthEventMap, GrowthEventParameters} from './growthAnalyticsEvents';
  5. import {issueEventMap, IssueEventParameters} from './issueAnalyticsEvents';
  6. import makeAnalyticsFunction from './makeAnalyticsFunction';
  7. import {
  8. performanceEventMap,
  9. PerformanceEventParameters,
  10. } from './performanceAnalyticsEvents';
  11. import {profilingEventMap, ProfilingEventParameters} from './profilingAnalyticsEvents';
  12. import {releasesEventMap, ReleasesEventParameters} from './releasesAnalyticsEvents';
  13. import {samplingEventMap, SamplingEventParameters} from './samplingAnalyticsEvents';
  14. import {searchEventMap, SearchEventParameters} from './searchAnalyticsEvents';
  15. import {settingsEventMap, SettingsEventParameters} from './settingsAnalyticsEvents';
  16. import {TeamInsightsEventParameters, workflowEventMap} from './workflowAnalyticsEvents';
  17. type EventParameters = GrowthEventParameters &
  18. CoreUIEventParameters &
  19. DashboardsEventParameters &
  20. DiscoverEventParameters &
  21. IssueEventParameters &
  22. PerformanceEventParameters &
  23. ProfilingEventParameters &
  24. SearchEventParameters &
  25. SettingsEventParameters &
  26. SamplingEventParameters &
  27. TeamInsightsEventParameters &
  28. ReleasesEventParameters;
  29. const allEventMap: Record<string, string | null> = {
  30. ...coreUIEventMap,
  31. ...dashboardsEventMap,
  32. ...discoverEventMap,
  33. ...growthEventMap,
  34. ...issueEventMap,
  35. ...performanceEventMap,
  36. ...profilingEventMap,
  37. ...samplingEventMap,
  38. ...searchEventMap,
  39. ...settingsEventMap,
  40. ...workflowEventMap,
  41. ...releasesEventMap,
  42. };
  43. /**
  44. * Generic typed analytics function for growth, issue, and performance events.
  45. * Can split up analytics functions to a smaller set of events like we do for trackIntegrationAnalytics
  46. */
  47. const trackAdvancedAnalyticsEvent = makeAnalyticsFunction<EventParameters>(allEventMap);
  48. export default trackAdvancedAnalyticsEvent;