searchAnalyticsEvents.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. type SearchEventBase = {
  2. query: string;
  3. search_type: string;
  4. search_source?: string;
  5. };
  6. type OpenEvent = {};
  7. type SelectEvent = {result_type: string; source_type: string; query?: string};
  8. type QueryEvent = {query: string};
  9. type ProjectSelectorEvent = {path: string};
  10. export type SearchEventParameters = {
  11. 'command_palette.open': OpenEvent;
  12. 'command_palette.query': QueryEvent;
  13. 'command_palette.select': SelectEvent;
  14. 'organization_saved_search.selected': {
  15. id: number;
  16. search_type: string;
  17. };
  18. 'projectselector.clear': ProjectSelectorEvent;
  19. 'projectselector.direct_selection': ProjectSelectorEvent;
  20. 'projectselector.multi_button_clicked': ProjectSelectorEvent & {
  21. button_type: 'all' | 'my';
  22. };
  23. 'projectselector.toggle': ProjectSelectorEvent & {
  24. action: 'added' | 'removed';
  25. };
  26. 'projectselector.update': ProjectSelectorEvent & {
  27. count: number;
  28. multi: boolean;
  29. };
  30. 'search.operator_autocompleted': SearchEventBase & {search_operator: string};
  31. 'search.searched': SearchEventBase & {search_source?: string};
  32. 'settings_search.open': OpenEvent;
  33. 'settings_search.query': QueryEvent;
  34. 'settings_search.select': SelectEvent;
  35. 'sidebar_help.open': OpenEvent;
  36. 'sidebar_help.query': QueryEvent;
  37. 'sidebar_help.select': SelectEvent;
  38. };
  39. export type SearchEventKey = keyof SearchEventParameters;
  40. export const searchEventMap: Record<SearchEventKey, string | null> = {
  41. 'search.searched': 'Search: Performed search',
  42. 'search.operator_autocompleted': 'Search: Operator Autocompleted',
  43. 'organization_saved_search.selected':
  44. 'Organization Saved Search: Selected saved search',
  45. 'settings_search.open': 'settings_search Open',
  46. 'command_palette.open': 'command_palette Open',
  47. 'sidebar_help.open': 'sidebar_help Open',
  48. 'settings_search.select': 'settings_search Select',
  49. 'command_palette.select': 'command_palette Select',
  50. 'sidebar_help.select': 'sidebar_help Select',
  51. 'settings_search.query': 'settings_search Query',
  52. 'command_palette.query': 'command_palette Query',
  53. 'sidebar_help.query': 'sidebar_help Query',
  54. 'projectselector.direct_selection': 'Project Selector: Direct Selection',
  55. 'projectselector.update': 'Project Selector: Update',
  56. 'projectselector.clear': 'Project Selector: Clear',
  57. 'projectselector.toggle': 'Project Selector: Toggle',
  58. 'projectselector.multi_button_clicked': 'Project Selector: Multi Button Clicked',
  59. };