Skip to content

: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.

714 B
Raw Blame
/** A report's state on Today: open, or closed by a verdict or on the server. */
export type TodayReportState = 'open' | 'done' | 'dismissed'

const STATE_LABELS: Record<TodayReportState, string | null> = {
    open: null,
    done: 'Resolved',
    dismissed: 'Dismissed',
}

const REPORT_STATUS_STATES: Record<string, TodayReportState> = {
    resolved: 'done',
    suppressed: 'dismissed',
    deleted: 'dismissed',
}

/** What happened to the report, or null while it is still open. */
export function reportStateLabel(state: TodayReportState): string | null {
    return STATE_LABELS[state]
}

export function reportState(status: string): TodayReportState {
    return REPORT_STATUS_STATES[status] ?? 'open'
}