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.4 KB
Raw Blame
import { MakeLogicType, actions, kea, key, path, props, reducers } from 'kea'

export type LemonBannerLogicProps = {
    /** The key to be used for persisting the fact this modal is dismissed */
    dismissKey: string
}

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

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface lemonBannerLogicActions {
    dismiss: () => {
        value: true
    }
    resetDismissKey: () => {
        value: true
    }
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface lemonBannerLogicMeta {
    key: string
}

export type lemonBannerLogicType = MakeLogicType<
    lemonBannerLogicValues,
    lemonBannerLogicActions,
    LemonBannerLogicProps,
    lemonBannerLogicMeta
>

export const lemonBannerLogic = kea<lemonBannerLogicType>([
    path((key) => ['components', 'lemon-banner', 'lemonBannerLogic', key]),
    key(({ dismissKey }) => dismissKey),
    props({} as LemonBannerLogicProps),
    actions({
        dismiss: true,
        resetDismissKey: true,
    }),
    reducers({
        isDismissed: [
            false,
            { persist: true },
            {
                dismiss: () => true,
                resetDismissKey: () => false,
            },
        ],
    }),
])