:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { useState } from 'react'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { CODE_BADGE } from '../suggestionTopics'
export interface CodeBadge {
visible: boolean
label: string
introOpen: boolean
openIntro: () => void
closeIntro: () => void
}
export function useCodeBadge(): CodeBadge {
const visible = useFeatureFlag('PRODUCT_AUTONOMY')
// Intro-modal visibility is pure view state, so it stays local instead of in a logic
const [introOpen, setIntroOpen] = useState(false)
return {
visible,
label: CODE_BADGE.label,
introOpen,
openIntro: () => setIntroOpen(true),
closeIntro: () => setIntroOpen(false),
}
}