mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

[web] Editor redesign: Add full project search GitOrigin-RevId: b4327c4ba0ddd7387ec8d6640e31200ca0fe4a6e
36 lines
914 B
TypeScript
36 lines
914 B
TypeScript
import { sendMB } from '@/infrastructure/event-tracking'
|
|
|
|
type SearchEventSegmentation = {
|
|
'search-open':
|
|
| ({
|
|
searchType: 'full-project'
|
|
} & (
|
|
| { method: 'keyboard' }
|
|
| { method: 'button'; location: 'toolbar' | 'search-form' | 'rail' }
|
|
))
|
|
| ({
|
|
searchType: 'document'
|
|
mode: 'visual' | 'source'
|
|
} & ({ method: 'keyboard' } | { method: 'button'; location: 'toolbar' }))
|
|
|
|
'search-execute': {
|
|
searchType: 'full-project'
|
|
totalDocs: number
|
|
totalResults: number
|
|
}
|
|
'search-result-click': {
|
|
searchType: 'full-project'
|
|
}
|
|
'search-replace-click': {
|
|
searchType: 'document'
|
|
method: 'keyboard' | 'button'
|
|
action: 'replace' | 'replace-all'
|
|
}
|
|
}
|
|
|
|
export const sendSearchEvent = <T extends keyof SearchEventSegmentation>(
|
|
eventName: T,
|
|
segmentation: SearchEventSegmentation[T]
|
|
) => {
|
|
sendMB(eventName, segmentation)
|
|
}
|