Files
Verso/services/web/frontend/js/features/source-editor/utils/context-menu-analytics.ts
T
Mathias Jakobsen 24dba36060 Merge pull request #34152 from overleaf/mj-select-all
[web] Add select all to context menu

GitOrigin-RevId: ff5fb828db8e1cd57d1361a2e572918339e5e18b
2026-06-02 08:08:08 +00:00

46 lines
979 B
TypeScript

import { sendMB } from '@/infrastructure/event-tracking'
export type ContextMenuItemSegmentation =
| 'cut'
| 'copy'
| 'paste'
| 'paste-without-formatting'
| 'paste-with-formatting'
| 'select-all'
| 'give-feedback'
| 'delete'
| 'jump-to-location-in-pdf'
| 'suggest-edits'
| 'back-to-editing'
| 'comment'
export type ContextMenuAnalyticsEvents = {
'menu-expand': {
location: 'editor-context-menu'
}
'menu-click': {
location: 'editor-context-menu'
item: ContextMenuItemSegmentation
}
'jump-to-location': {
method: 'editor-context-menu'
direction: 'code-location-in-pdf'
}
'add-comment': {
location: 'editor-context-menu'
}
'paywall-prompt': {
'paywall-type': 'track-changes'
location: 'editor-context-menu'
}
}
export const sendContextMenuEvent = <
T extends keyof ContextMenuAnalyticsEvents,
>(
eventName: T,
segmentation: ContextMenuAnalyticsEvents[T]
) => {
sendMB(eventName, segmentation)
}