Line data Source code
1 : import { useTelemetry } from '@comfyorg/telemetry'
2 : import type { PropertiesPanelTab } from '@/renderer/extensions/propertiesPanel/propertiesPanelStore'
3 :
4 : /**
5 : * Tabs whose opening we want discoverability telemetry for, mapped to the
6 : * button_id reported on `trackUiButtonClicked`. Tabs not listed here are
7 : * intentionally left untracked.
8 : */
9 2355 : const TAB_OPENED_BUTTON_IDS: Partial<Record<PropertiesPanelTab, string>> = {
10 : settings: 'right_side_panel_settings_tab_opened',
11 : info: 'right_side_panel_info_tab_opened'
12 : }
13 :
14 : /**
15 : * Fires a `trackUiButtonClicked` event when the properties panel switches to
16 : * a tab tracked in {@link TAB_OPENED_BUTTON_IDS}. No-op for any other tab.
17 : */
18 42 : export function trackPropertiesPanelTabOpened(tab: PropertiesPanelTab): void {
19 42 : const buttonId = TAB_OPENED_BUTTON_IDS[tab]
20 42 : if (!buttonId) return
21 :
22 42 : useTelemetry()?.trackUiButtonClicked({
23 : button_id: buttonId,
24 : element_group: 'right_side_panel'
25 : })
26 : }
|