: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, kea, path, reducers } from 'kea'
import type { AgentPromptDestination } from './AgentPromptButton'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface agentPromptButtonLogicValues {
rememberedActionKeys: Record<string, string>
rememberedAgentKey: AgentPromptDestination | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface agentPromptButtonLogicActions {
rememberAction: (
actionSetKey: string,
actionKey: string
) => {
actionKey: string
actionSetKey: string
}
rememberAgent: (agentKey: AgentPromptDestination) => {
agentKey: AgentPromptDestination
}
}
export type agentPromptButtonLogicType = MakeLogicType<agentPromptButtonLogicValues, agentPromptButtonLogicActions>
export const agentPromptButtonLogic = kea<agentPromptButtonLogicType>([
// pinned: the persisted localStorage keys derive from this path, so changing it resets every remembered choice
path(['lib', 'components', 'AgentPromptButton', 'agentPromptButtonLogic']),
actions({
rememberAgent: (agentKey: AgentPromptDestination) => ({ agentKey }),
rememberAction: (actionSetKey: string, actionKey: string) => ({ actionSetKey, actionKey }),
}),
reducers({
rememberedAgentKey: [
null as AgentPromptDestination | null,
{ persist: true },
{
rememberAgent: (_, { agentKey }) => agentKey,
},
],
rememberedActionKeys: [
{} as Record<string, string>,
{ persist: true },
{
rememberAction: (state, { actionSetKey, actionKey }) => ({ ...state, [actionSetKey]: actionKey }),
},
],
}),
])