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

export type NavPanelAdvertisementLogicProps = {
    /** Identifies the card whose dismissal this instance holds, e.g. `broadcast-<slug>`. */
    dismissKey: string
}

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

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

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

export type navPanelAdvertisementLogicType = MakeLogicType<
    navPanelAdvertisementLogicValues,
    navPanelAdvertisementLogicActions,
    NavPanelAdvertisementLogicProps,
    navPanelAdvertisementLogicMeta
>

export const navPanelAdvertisementLogic = kea<navPanelAdvertisementLogicType>([
    path(['lib', 'components', 'NavPanelAdvertisementLogic']),
    props({} as NavPanelAdvertisementLogicProps),
    key(({ dismissKey }) => dismissKey),
    actions(() => ({
        hideAdvertisement: () => true,
        showAdvertisement: () => false,
    })),
    reducers(() => ({
        hidden: [
            false as boolean,
            { persist: true },
            {
                hideAdvertisement: () => true,
                showAdvertisement: () => false,
            },
        ],
    })),
])