* feat(analytics): track navigation entry clicks, preset switches, and new-session sends Rebuilds the click events of #6600 on the region-owned More menus in release/dsh-0.2.1. Exposure events, creator_mode_enter, and the ui-workspace onOpened observer are not included. - sidebar_menu_click gains position plus the new_session and more entries: New Session (sidebar button, brand, titlebar), Plugins and Automation rows, the left sidebar More button, and entries opened from its menu. - more_menu_item_click records Browse other plugins and Create your plugin per region. - agent_preset_switch reports applied or unbound staged picks; the seat controller now returns an explicit apply outcome. - code_work_view_toggle reports a successful change of the setting. - send_button_click adds is_new_session and the Session's preset category. Co-authored-by: imccyu <[email protected]> * test(analytics): cover navigation, preset switch, toggle, and send analytics Co-authored-by: imccyu <[email protected]> * docs(analytics): document click events and regenerate catalogs Co-authored-by: imccyu <[email protected]> * test(ui): reuse the developer tools row accessor without a new unknown cast Co-authored-by: imccyu <[email protected]> * fix(analytics): classify preset switches by preset id only agent_preset_switch now maps the preset id the same way send_button_click does: cordis is creator, ptc, minimal and standard keep their ids, and any other id is other; a published preset name no longer changes the category. Co-authored-by: imccyu <[email protected]> --------- Co-authored-by: dingyifan <[email protected]> Co-authored-by: imccyu <[email protected]>
81 lines
4.0 KiB
TypeScript
81 lines
4.0 KiB
TypeScript
/** Desktop analytics fields selected by product event owners. */
|
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
import type { MessageId } from '@deepseek-ai/dsh-llm/brand'
|
|
|
|
/** Event names and their selected product attributes. */
|
|
export interface ProductEventMap {
|
|
desktop_app_launch: Record<string, never>
|
|
auth_page_view: Record<string, never>
|
|
auth_page_click: { button_name: 'sign_in' | 'api-key' }
|
|
api_key_save_click: Record<string, never>
|
|
onboarding_page_view: { page_name: OnboardingPage }
|
|
onboarding_page_click: {
|
|
page_name: OnboardingPage
|
|
button_name: 'next' | 'back' | 'skip' | 'charge' | 'later' | 'continue'
|
|
selected_content?: 'office' | 'code' | 'code_office' | 'focus_result' | 'key_detail' | 'full_process'
|
|
}
|
|
onboarding_popup_view: { popup_name: 'skip_charge' | 'skip_setting' }
|
|
onboarding_popup_click: { popup_name: 'skip_charge' | 'skip_setting'; button_name: 'charge' | 'know' | 'enter' | 'setting' | 'close' }
|
|
desktop_upgrade_click: Record<string, never>
|
|
desktop_upgrade_download_result: { is_success: boolean; error_reason?: string }
|
|
desktop_upgrade_install_restart_click: Record<string, never>
|
|
send_button_click: {
|
|
session_id?: SessionId
|
|
model_name?: string
|
|
thinking_effort?: string
|
|
run_mode: 'plan' | 'goal' | 'default'
|
|
msg_type: 'default' | 'steer' | 'queue'
|
|
/** Whether the message is the first one of a blank Session. */
|
|
is_new_session: boolean
|
|
/** Fixed category of the Session's Agent preset, when known. */
|
|
agent_preset?: AnalyticsPreset | 'other'
|
|
}
|
|
model_switch: { session_id?: SessionId; switch_from: string; switch_to: string }
|
|
thinking_level_switch: { session_id?: SessionId; switch_from: string; switch_to: string; model_name: string }
|
|
context_compression: { session_id: SessionId; trigger_type: 'auto' | 'manual' }
|
|
branch_session_click: {
|
|
session_id: SessionId
|
|
parent_session_id: SessionId
|
|
parent_message_id?: MessageId
|
|
click_position: 'footer' | 'sidebar'
|
|
}
|
|
sidebar_menu_click: { menu_name: SidebarAnalyticsEntry; position?: SidebarAnalyticsPosition }
|
|
more_menu_item_click: { region: EntryAnalyticsRegion; action: 'browse_plugins' | 'create_plugin' }
|
|
agent_preset_switch: { switch_from: AnalyticsPreset | 'other'; switch_to: AnalyticsPreset; code_work_view_enabled: boolean }
|
|
code_work_view_toggle: { is_enabled: boolean }
|
|
plugin_toggle: { plugin_name: string; plugin_type: 'plugin' | 'bundle'; is_enabled: boolean; is_builtin: boolean }
|
|
plugin_add_button_click: Record<string, never>
|
|
plugin_install_click: { input_value: string }
|
|
install_plugin_result: {
|
|
input_value: string
|
|
is_success: boolean
|
|
error_reason?: string
|
|
duration: number
|
|
plugin_name?: string
|
|
}
|
|
confirm_uninstall_plugin: { plugin_name: string }
|
|
}
|
|
|
|
/** Official navigation entries; third-party identifiers are never analytics dimensions. */
|
|
export type SidebarAnalyticsEntry = 'new_session' | 'plugin' | 'cron' | 'more'
|
|
|
|
/** Physical navigation placement, independent of the selected destination. */
|
|
export type SidebarAnalyticsPosition = 'sidebar' | 'sidebar_more' | 'titlebar'
|
|
|
|
/** Entry-customization menu regions. */
|
|
export type EntryAnalyticsRegion = 'sidebar' | 'conversation' | 'rightbar'
|
|
|
|
/** Built-in presets, independent of localized names and custom preset identifiers. */
|
|
export type AnalyticsPreset = 'creator' | 'ptc' | 'minimal' | 'standard'
|
|
|
|
/** Public page names independent of internal onboarding state names. */
|
|
export type OnboardingPage = 'onboarding_welcome' | 'onboarding_recharge' | 'onboarding_use_case' | 'onboarding_process'
|
|
|
|
/** Correlated event name and attributes for the authenticated analytics RPC. */
|
|
export type ProductEvent = {
|
|
[K in keyof ProductEventMap]: { eventName: K; attributes: ProductEventMap[K]; timestamp: number }
|
|
}[keyof ProductEventMap]
|
|
|
|
/** Callback passed into presentation components; omitted when collection is disabled. */
|
|
export type TrackProductEvent = <K extends keyof ProductEventMap>(name: K, attributes: ProductEventMap[K]) => void
|