diff --git a/src/components/sidebar/tabs/WorkflowsSidebarTab.vue b/src/components/sidebar/tabs/WorkflowsSidebarTab.vue index 951e11dd1..334504b1f 100644 --- a/src/components/sidebar/tabs/WorkflowsSidebarTab.vue +++ b/src/components/sidebar/tabs/WorkflowsSidebarTab.vue @@ -143,12 +143,12 @@ import WorkflowTreeLeaf from '@/components/sidebar/tabs/workflows/WorkflowTreeLe import { useTreeExpansion } from '@/composables/useTreeExpansion' import { useSettingStore } from '@/platform/settings/settingStore' import { useWorkflowService } from '@/platform/workflow/core/services/workflowService' -import { TelemetryEvents, trackTypedEvent } from '@/services/telemetryService' import { useWorkflowBookmarkStore, useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore' import { ComfyWorkflow } from '@/platform/workflow/management/stores/workflowStore' +import { TelemetryEvents, trackTypedEvent } from '@/services/telemetryService' import { useWorkspaceStore } from '@/stores/workspaceStore' import type { TreeNode } from '@/types/treeExplorerTypes' import type { TreeExplorerNode } from '@/types/treeExplorerTypes' diff --git a/src/services/telemetryService.ts b/src/services/telemetryService.ts index 4cd4536a2..04835de46 100644 --- a/src/services/telemetryService.ts +++ b/src/services/telemetryService.ts @@ -3,11 +3,18 @@ import { electronAPI, isElectron } from '@/utils/envUtil' // Allowed property value types - excludes objects, arrays, and functions to prevent sensitive data leaks type SafeTelemetryValue = string | number | boolean | undefined -// Safe telemetry properties interface with runtime validation (sensitive properties blocked in implementation) +/** + * Safe telemetry properties interface with runtime validation (sensitive properties blocked in implementation) + * @public + */ export interface TelemetryEventProperties { [key: string]: SafeTelemetryValue } +/** + * Core telemetry service interface + * @public + */ export interface TelemetryService { trackEvent(eventName: string, properties?: TelemetryEventProperties): void incrementUserProperty(propertyName: string, value: number): void @@ -206,11 +213,13 @@ class UnifiedTelemetryService implements TelemetryService { } // Singleton instance +/** @public */ export const telemetryService = new UnifiedTelemetryService() /** * Convenience function for tracking events throughout the app * Completely fail-safe - will never throw errors or break app flow + * @public */ export function trackEvent( eventName: string, @@ -304,6 +313,7 @@ export function trackEvent( /** * Convenience function for incrementing user properties * Completely fail-safe - will never throw errors or break app flow + * @public */ export function incrementUserProperty( propertyName: string, @@ -427,12 +437,17 @@ export const TelemetryEvents = { CANVAS_DOUBLE_CLICK: 'canvas:double_click' } as const +/** + * Union type of all telemetry event names + * @public + */ export type TelemetryEventName = (typeof TelemetryEvents)[keyof typeof TelemetryEvents] /** * Type-safe event tracking with predefined event names * Completely fail-safe - will never throw errors or break app flow + * @public */ export function trackTypedEvent( eventName: TelemetryEventName,