mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
I changed Studio's feature-flag tracking call to send `platform: 'studio'`, so `$feature_flag_called` events captured by the management API carry the same app marker as Studio's other events (#53078). I held this step back until the API's strict flag-track body schema accepted the field in production, which it has since 2026-11-09. **Note:** I regenerated `packages/api-types` with a full `codegen:prod` run, so it also includes other recent production API additions. The `verify-production-api-types` check diffs every type file against production, so a single-type update would fail it. ## To test Accept the cookie banner first: flag tracking only fires after consent. Tested on the PR preview: - [x] Sign in to the studio-staging preview, open any project page, and find the `POST /platform/telemetry/feature-flags/track` request in DevTools: expect the body to include `"platform":"studio"` and a 2xx response (a 400 means the field was rejected). Observed `{"feature_flag_name":"proBenefitWording","feature_flag_value":"variant-a","platform":"studio"}` with a 201, and every `/platform/telemetry/feature-flags` GET returned 200. ## Linear - fixes GROWTH-1461
20 lines
622 B
TypeScript
20 lines
622 B
TypeScript
import { components } from 'api-types'
|
|
import { hasConsented } from 'common'
|
|
|
|
import { IS_PLATFORM } from './constants'
|
|
import { handleError, post } from '@/data/fetchers'
|
|
|
|
type TrackFeatureFlagVariables = components['schemas']['TelemetryFeatureFlagBody']
|
|
|
|
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: { ...body, platform: 'studio' },
|
|
})
|
|
|
|
if (error) handleError(error, { reportImmediately: true })
|
|
return data
|
|
}
|