Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
nit
  • Loading branch information
christian-byrne committed Nov 26, 2025
commit 40cba7b98de7b2ac85f0564eb786cf00c4876082
4 changes: 2 additions & 2 deletions src/platform/remoteConfig/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { TelemetryEventName } from '@/platform/telemetry/types'

/**
* Server health alert configuration from the backend
*/
Expand All @@ -23,8 +25,6 @@ type FirebaseRuntimeConfig = {
* Remote configuration type
* Configuration fetched from the server at runtime
*/
import type { TelemetryEventName } from '@/platform/telemetry/types'

export type RemoteConfig = {
mixpanel_token?: string
subscription_required?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import type { RemoteConfig } from '@/platform/remoteConfig/types'
import { TelemetryEvents } from '../../types'
import { normalizeSurveyResponses } from '../../utils/surveyNormalization'

const DEFAULT_DISABLED_EVENTS: TelemetryEventName[] = [
const DEFAULT_DISABLED_EVENTS = [
TelemetryEvents.WORKFLOW_OPENED,
TelemetryEvents.PAGE_VISIBILITY_CHANGED,
TelemetryEvents.TAB_COUNT_TRACKING,
Expand All @@ -60,7 +60,7 @@ const DEFAULT_DISABLED_EVENTS: TelemetryEventName[] = [
TelemetryEvents.HELP_CENTER_CLOSED,
TelemetryEvents.WORKFLOW_CREATED,
TelemetryEvents.UI_BUTTON_CLICKED
]
] as const satisfies TelemetryEventName[]

const TELEMETRY_EVENT_SET = new Set<TelemetryEventName>(
Object.values(TelemetryEvents) as TelemetryEventName[]
Expand Down Expand Up @@ -95,9 +95,13 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
this.configureDisabledEvents(
(window.__CONFIG__ as Partial<RemoteConfig> | undefined) ?? null
)
watch(remoteConfig, (config) => {
this.configureDisabledEvents(config)
})
watch(
remoteConfig,
(config) => {
this.configureDisabledEvents(config)
},
{ immediate: true }
)
const token = window.__CONFIG__?.mixpanel_token

if (token) {
Expand Down Expand Up @@ -187,13 +191,17 @@ export class MixpanelTelemetryProvider implements TelemetryProvider {
}

private buildEventSet(values: TelemetryEventName[]): Set<TelemetryEventName> {
const normalized = new Set<TelemetryEventName>()
values.forEach((value) => {
if (TELEMETRY_EVENT_SET.has(value)) {
normalized.add(value)
}
})
return normalized
return new Set(
values.filter((value) => {
const isValid = TELEMETRY_EVENT_SET.has(value)
if (!isValid && import.meta.env.DEV) {
console.warn(
`Unknown telemetry event name in disabled list: ${value}`
)
}
return isValid
})
)
}

trackSignupOpened(): void {
Expand Down
Loading