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.

758 B
Raw Blame
import { useActions, useValues } from 'kea'

import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'
import { billingLogic } from 'lib/logic/billing/billingLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'

export function BillingUpgradeCTA({ children, disabledReason, ...props }: LemonButtonProps): JSX.Element {
    const { reportBillingCTAShown } = useActions(eventUsageLogic)
    const { selfServeBillingDisabledReason } = useValues(billingLogic)
    useOnMountEffect(reportBillingCTAShown)

    return (
        <LemonButton {...props} disabledReason={selfServeBillingDisabledReason || disabledReason}>
            {children}
        </LemonButton>
    )
}