Files
supabase/apps/studio/lib/posthog.ts
Alaister Young 2b419c70a1 chore: add usercentrics for consent management (#35384)
* chore: add usercentrics for consent management

* client component to make next.js happy

* address feedback

* move consent state to common

* fix import

* ensure page events are sent correctly

* add feature flag provider to ui library site

* fix ui lib 500 error

* skip in test env

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2025-05-05 13:18:48 +08:00

17 lines
553 B
TypeScript

import { components } from 'api-types'
import { hasConsented } from 'common'
import { handleError, post } from 'data/fetchers'
import { IS_PLATFORM } from './constants'
type TrackFeatureFlagVariables = components['schemas']['TelemetryFeatureFlagBodyDto']
export async function trackFeatureFlag(body: TrackFeatureFlagVariables) {
const consent = hasConsented()
if (!consent || !IS_PLATFORM) return undefined
const { data, error } = await post(`/platform/telemetry/feature-flags/track`, { body })
if (error) handleError(error)
return data
}