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.

1.3 KB
Raw Blame
import { MakeLogicType, actions, kea, path, reducers } from 'kea'

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface conversationsDraftModeLogicValues {
    draftModeDefault: boolean
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface conversationsDraftModeLogicActions {
    setDraftModeDefault: (enabled: boolean) => {
        enabled: boolean
    }
}

export type conversationsDraftModeLogicType = MakeLogicType<
    conversationsDraftModeLogicValues,
    conversationsDraftModeLogicActions
>

// Browser-local default for the ticket composer's draft mode. Each ticket seeds its own
// toggle from this on open; flipping the per-ticket toggle does not write back here.
export const conversationsDraftModeLogic = kea<conversationsDraftModeLogicType>([
    path(['products', 'conversations', 'frontend', 'scenes', 'settings', 'conversationsDraftModeLogic']),
    actions({
        setDraftModeDefault: (enabled: boolean) => ({ enabled }),
    }),
    reducers({
        draftModeDefault: [
            false,
            { persist: true, storageKey: 'conversations_draft_mode_default' },
            {
                setDraftModeDefault: (_, { enabled }) => enabled,
            },
        ],
    }),
])