mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #28392 from overleaf/dp-segment-editor-analytics
Add editor-redesign segmentation to a bunch of analytics events GitOrigin-RevId: e8d2091028dab09de06362c38c5a17f32253e7cc
This commit is contained in:
@@ -7,14 +7,23 @@ import {
|
||||
} from '@/infrastructure/event-tracking'
|
||||
import { useCallback } from 'react'
|
||||
|
||||
export function populateEditorRedesignSegmentation<
|
||||
SegmentationType extends Segmentation,
|
||||
>(
|
||||
segmentation: SegmentationType | undefined = {} as SegmentationType,
|
||||
editorRedesign: boolean
|
||||
): SegmentationType & { 'editor-redesign'?: 'enabled' } {
|
||||
return editorRedesign
|
||||
? { ...segmentation, 'editor-redesign': 'enabled' }
|
||||
: segmentation
|
||||
}
|
||||
|
||||
export const useEditorAnalytics = () => {
|
||||
const editorRedesign = useIsNewEditorEnabled()
|
||||
|
||||
const populateSegmentation = useCallback(
|
||||
(segmentation: Segmentation | undefined = {}): Segmentation => {
|
||||
return editorRedesign
|
||||
? { ...segmentation, 'editor-redesign': 'enabled' }
|
||||
: segmentation
|
||||
return populateEditorRedesignSegmentation(segmentation, editorRedesign)
|
||||
},
|
||||
[editorRedesign]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user