From 7aaa78e6350ab91b0d99485ecc821b3cc1a57d22 Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Tue, 6 Aug 2024 09:28:15 +0100 Subject: [PATCH] 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 --- .../features/source-editor/languages/latex/complete.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/source-editor/languages/latex/complete.ts b/services/web/frontend/js/features/source-editor/languages/latex/complete.ts index 88b68b04be..83ba4827bf 100644 --- a/services/web/frontend/js/features/source-editor/languages/latex/complete.ts +++ b/services/web/frontend/js/features/source-editor/languages/latex/complete.ts @@ -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 = {} + const result: Record = { + 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 })