mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-24 17:51:51 +02:00
Add analytics event for context menu, comment, track changes, and jump to location GitOrigin-RevId: 8412cc3c8039cd1582ccee20b162b4bef4467dea
45 lines
962 B
TypeScript
45 lines
962 B
TypeScript
import { sendMB } from '@/infrastructure/event-tracking'
|
|
|
|
export type ContextMenuItemSegmentation =
|
|
| 'cut'
|
|
| 'copy'
|
|
| 'paste'
|
|
| 'paste-without-formatting'
|
|
| 'paste-with-formatting'
|
|
| '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)
|
|
}
|