: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
export type CupedSelection = 'default' | 'enabled' | 'disabled'
type CupedConfig = { enabled?: boolean; lookback_days?: number } | null | undefined
export function getCupedSelection(cuped: CupedConfig): CupedSelection {
const explicit = cuped?.enabled
if (explicit === undefined) {
return 'default'
}
return explicit ? 'enabled' : 'disabled'
}
export function resolveCupedEnabled(cuped: CupedConfig, teamDefaultEnabled: boolean): boolean {
return cuped?.enabled === undefined ? teamDefaultEnabled : !!cuped.enabled
}
export function resolveCupedLookbackDays(
cuped: CupedConfig,
teamDefaultLookbackDays: number | null | undefined,
fallbackLookbackDays: number
): number {
if (typeof cuped?.lookback_days === 'number') {
return cuped.lookback_days
}
if (typeof teamDefaultLookbackDays === 'number') {
return teamDefaultLookbackDays
}
return fallbackLookbackDays
}