mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Merge pull request #19788 from overleaf/mj-cite-key-search-ref-providers
[web] Add ref provider info to cite-key-search event GitOrigin-RevId: 1f3828e3f5305f06190332b637860fde606f7484
This commit is contained in:
parent
d2289379cd
commit
7aaa78e635
1 changed files with 8 additions and 1 deletions
|
@ -30,6 +30,7 @@ import {
|
|||
import { snippet } from './completions/data/environments'
|
||||
import { syntaxTree } from '@codemirror/language'
|
||||
import { sendMBSampled } from '@/infrastructure/event-tracking'
|
||||
import getMeta from '@/utils/meta'
|
||||
|
||||
function blankCompletions(): Completions {
|
||||
return {
|
||||
|
@ -242,6 +243,7 @@ const debouncedCounter = (
|
|||
const CITE_ANALYTICS_REPORT_TIMEOUT = 4000
|
||||
|
||||
const analyticsSourceBuilder = (debounceTimes: number[]) => {
|
||||
const user = getMeta('ol-user')
|
||||
let timeoutId = 0
|
||||
const counters = debounceTimes.map(debounceTime => {
|
||||
if (debounceTime >= CITE_ANALYTICS_REPORT_TIMEOUT) {
|
||||
|
@ -265,7 +267,12 @@ const analyticsSourceBuilder = (debounceTimes: number[]) => {
|
|||
clearTimeout(timeoutId)
|
||||
}
|
||||
timeoutId = window.setTimeout(() => {
|
||||
const result: Record<string, number> = {}
|
||||
const result: Record<string, number | boolean | undefined> = {
|
||||
mendeley: Boolean(
|
||||
user?.features?.mendeley && user?.refProviders?.mendeley
|
||||
),
|
||||
zotero: Boolean(user?.features?.zotero && user?.refProviders?.zotero),
|
||||
}
|
||||
counters.forEach(debouncedCounter => {
|
||||
result[`${debouncedCounter.debounceTime}ms`] = debouncedCounter.counter
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue