: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 { useActions, useValues } from 'kea'
import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'
import { TeamMembershipLevel } from 'lib/constants'
import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
import { CONFIDENCE_LEVEL_OPTIONS } from 'products/experiments/frontend/constants'
import { experimentsConfigLogic } from './experimentsConfigLogic'
export function DefaultExperimentConfidenceLevel(): JSX.Element {
const { experimentsConfig, experimentsConfigLoading } = useValues(experimentsConfigLogic)
const { updateExperimentsConfig } = useActions(experimentsConfigLogic)
const restrictedReason = useRestrictedArea({
scope: RestrictionScope.Project,
minimumAccessLevel: TeamMembershipLevel.Admin,
})
const currentValue = Number(experimentsConfig?.default_experiment_confidence_level ?? 0.95)
const handleChange = (value: number | null): void => {
if (value === null) {
return
}
updateExperimentsConfig({ default_experiment_confidence_level: value })
}
return (
<LemonSelect
value={currentValue}
onChange={handleChange}
options={CONFIDENCE_LEVEL_OPTIONS}
disabledReason={experimentsConfigLoading ? 'Loading...' : restrictedReason}
/>
)
}