: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, connect, kea, path, selectors } from 'kea'
import { userLogic } from 'scenes/userLogic'
import { PendingInviteForCurrentUser } from '~/types'
import type { UserType } from '../../../types'
export type { PendingInviteForCurrentUser }
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface pendingInvitesLogicValues {
user: UserType | null // userLogic
pendingInvites: PendingInviteForCurrentUser[]
pendingInvitesLabel: string | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface pendingInvitesLogicMeta {
__keaTypeGenInternalSelectorTypes: {
pendingInvites: (user: UserType | null) => PendingInviteForCurrentUser[]
pendingInvitesLabel: (pendingInvites: PendingInviteForCurrentUser[]) => string | null
}
}
export type pendingInvitesLogicType = MakeLogicType<
pendingInvitesLogicValues,
{},
Record<string, any>,
pendingInvitesLogicMeta
>
export const pendingInvitesLogic = kea<pendingInvitesLogicType>([
path(['lib', 'components', 'Account', 'pendingInvitesLogic']),
connect(() => ({
values: [userLogic, ['user']],
})),
selectors({
pendingInvites: [
(s) => [s.user],
(user: null | import('~/types').UserType): PendingInviteForCurrentUser[] => user?.pending_invites ?? [],
],
pendingInvitesLabel: [
(s) => [s.pendingInvites],
(pendingInvites: PendingInviteForCurrentUser[]): string | null => {
if (pendingInvites.length === 0) {
return null
}
return pendingInvites.length === 1
? `You have a pending invite to join ${pendingInvites[0].organization_name}.`
: `You have pending invites to join ${pendingInvites.length} organizations.`
},
],
}),
])