: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, kea, key, path, props } from 'kea'
import { lazyLoaders } from 'kea-loaders'
import { getPersonPushNotifications, MessageAsset } from 'products/workflows/frontend/Workflows/messageAssetsApi'
export interface PersonPushNotificationsLogicProps {
teamId: number
personId: string
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface personPushNotificationsLogicValues {
pushNotifications: MessageAsset[]
pushNotificationsLoading: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface personPushNotificationsLogicActions {
loadPushNotifications: () => any
loadPushNotificationsFailure: (
error: string,
errorObject?: any
) => {
error: string
errorObject?: any
}
loadPushNotificationsSuccess: (
pushNotifications: MessageAsset[],
payload?: any
) => {
pushNotifications: MessageAsset[]
payload?: any
}
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface personPushNotificationsLogicMeta {
key: string
}
export type personPushNotificationsLogicType = MakeLogicType<
personPushNotificationsLogicValues,
personPushNotificationsLogicActions,
PersonPushNotificationsLogicProps,
personPushNotificationsLogicMeta
>
export const personPushNotificationsLogic = kea<personPushNotificationsLogicType>([
path(['scenes', 'persons', 'personPushNotificationsLogic']),
props({} as PersonPushNotificationsLogicProps),
key((props) => `${props.teamId}-${props.personId}`),
lazyLoaders(({ props }) => ({
pushNotifications: [
[] as MessageAsset[],
{
loadPushNotifications: async () => {
if (!props.personId) {
return []
}
return await getPersonPushNotifications(props.teamId, props.personId)
},
},
],
})),
])