: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { MakeLogicType, actions, connect, kea, path, reducers, selectors } from 'kea'
import { getBackendHost } from 'lib/utils/oauthClient'
import { teamLogic } from 'scenes/teamLogic'
import type { TeamType } from '~/types'
import type { TeamPublicType } from '../../../../frontend/src/types'
import { mcpAnalyticsSetupPrompt } from './mcpAnalyticsSetupPrompt'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface mcpAnalyticsSetupLogicValues {
currentTeam: TeamPublicType | TeamType | null // teamLogic
agentPrompt: string | null
agentPromptOpen: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface mcpAnalyticsSetupLogicActions {
setAgentPromptOpen: (open: boolean) => {
open: boolean
}
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface mcpAnalyticsSetupLogicMeta {
__keaTypeGenInternalSelectorTypes: {
agentPrompt: (currentTeam: TeamPublicType | TeamType | null) => string | null
}
}
export type mcpAnalyticsSetupLogicType = MakeLogicType<
mcpAnalyticsSetupLogicValues,
mcpAnalyticsSetupLogicActions,
Record<string, any>,
mcpAnalyticsSetupLogicMeta
>
export const mcpAnalyticsSetupLogic = kea<mcpAnalyticsSetupLogicType>([
path(['products', 'mcp_analytics', 'frontend', 'emptyState', 'mcpAnalyticsSetupLogic']),
connect(() => ({ values: [teamLogic, ['currentTeam']] })),
actions({ setAgentPromptOpen: (open: boolean) => ({ open }) }),
reducers({ agentPromptOpen: [false, { setAgentPromptOpen: (_, { open }) => open }] }),
selectors({
agentPrompt: [
(s) => [s.currentTeam],
(team: TeamPublicType | TeamType | null): string | null =>
team ? mcpAnalyticsSetupPrompt(team.id, getBackendHost() || window.location.origin) : null,
],
}),
])