: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
chore(billing): remove the legacy PostHog Desktop seats card (#93935)
Roy Cohenaea58f69a20e
diff --git a/frontend/src/scenes/billing/Billing.tsx b/frontend/src/scenes/billing/Billing.tsxindex bdf0cc2658f5..c56a657b1c79 100644--- a/frontend/src/scenes/billing/Billing.tsx+++ b/frontend/src/scenes/billing/Billing.tsx@@ -8,7 +8,6 @@ import { useEffect } from 'react'import * as judge from '@posthog/brand/hoggies/png/judge'import * as star from '@posthog/brand/hoggies/png/star'-import { IconDocument } from '@posthog/icons'import { LemonButton, LemonDivider, LemonInput, Link } from '@posthog/lemon-ui'import { pngHoggie } from 'lib/brand/hoggies'@@ -21,7 +20,6 @@ import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { toSentenceCase } from 'lib/utils/strings'import { couponLogic } from 'scenes/coupons/couponLogic'-import { getProductIcon } from 'scenes/onboarding/shared/utils'import { membersLogic } from 'scenes/organization/membersLogic'import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'import { SceneExport } from 'scenes/sceneTypes'@@ -35,7 +33,6 @@ import { billingLogic } from './billingLogic'import { BillingNoAccess } from './BillingNoAccess'import { BillingProduct } from './BillingProduct'import { BillingSummary } from './BillingSummary'-import { CodeSeatsSection } from './CodeSeatsSection'import { CreditCTAHero } from './CreditCTAHero'import { StripePortalButton } from './StripePortalButton'import { UnsubscribeCard } from './UnsubscribeCard'@@ -264,32 +261,6 @@ export function Billing(): JSX.Element {</div>))}- {featureFlags[FEATURE_FLAGS.POSTHOG_CODE_BILLING] && (- <div className="flex flex-wrap max-w-300 pb-8">- <div className="border border-primary rounded w-full bg-surface-primary">- <div className="border-b border-primary rounded-t p-4">- <div className="flex gap-4 items-center justify-between">- <div className="flex gap-x-2">- <div>{getProductIcon('IconTerminal', { className: 'text-2xl shrink-0' })}</div>- <div>- <h3 className="font-bold mb-0">PostHog Desktop</h3>- <div>Manage existing PostHog Desktop seats.</div>- </div>- </div>- <LemonButton- icon={<IconDocument />}- size="small"- to="https://posthog.com/docs/posthog-desktop"- tooltip="Read the docs"- />- </div>- </div>- <div className="p-8">- <CodeSeatsSection />- </div>- </div>- </div>- )}<div>{billing?.subscription_level == 'paid' && !!platformAndSupportProduct ? (<>diff --git a/frontend/src/scenes/billing/CodeSeatsSection.tsx b/frontend/src/scenes/billing/CodeSeatsSection.tsxdeleted file mode 100644index 98c8b7b323e5..000000000000--- a/frontend/src/scenes/billing/CodeSeatsSection.tsx+++ /dev/null@@ -1,195 +0,0 @@-import { useActions, useValues } from 'kea'--import { LemonBanner, LemonButton, LemonDialog, LemonTable, LemonTag } from '@posthog/lemon-ui'--import { dayjs } from 'lib/dayjs'-import { More } from 'lib/lemon-ui/LemonButton/More'-import { Tooltip } from 'lib/lemon-ui/Tooltip'--import { canCancelSeat, isAlphaPlanKey, isProPlanKey, seatBillingLogic, seatPriceFromPlanKey } from './seatBillingLogic'-import type { SeatData, SeatStatus } from './types'--function planLabel(planKey: string): string {- if (isAlphaPlanKey(planKey)) {- return 'Alpha'- }- if (isProPlanKey(planKey)) {- return 'Pro'- }- return 'Free'-}--function formatSeatDate(value: string | number | null): string {- if (!value) {- return '–'- }- const parsed = typeof value === 'number' ? dayjs.unix(value) : dayjs(value)- if (!parsed.isValid() || parsed.year() <= 1970) {- return '–'- }- return parsed.format('MMM D, YYYY')-}--function statusColor(status: SeatStatus): 'success' | 'warning' | 'muted' | 'primary' {- switch (status) {- case 'active':- return 'success'- case 'canceling':- return 'warning'- case 'expired':- case 'withdrawn':- return 'muted'- default:- return 'primary'- }-}--export function CodeSeatsSection(): JSX.Element {- const { displaySeats, orgSeatsLoading, isAdmin, members, activeCount, cancelingCount, monthlyTotal } =- useValues(seatBillingLogic)- const { adminCancelSeat } = useActions(seatBillingLogic)-- function getUserInfo(seat: SeatData): { name: string; email: string } | null {- if (!members) {- return null- }- const member = members.find((m) => m.user.distinct_id === seat.user_distinct_id)- if (!member) {- return null- }- return { name: member.user.first_name, email: member.user.email }- }-- return (- <div>- <div className="flex items-center justify-between mb-4">- <div>- <h3 className="mb-1 text-lg font-semibold">Desktop seats</h3>- {isAdmin && (- <span className="text-muted text-sm">- {activeCount} active{cancelingCount > 0 ? `, ${cancelingCount} canceling` : ''} ·{' '}- <Tooltip title="Reflects the monthly rate, not prorated charges">- ${monthlyTotal}/mo- </Tooltip>- </span>- )}- </div>- </div>- <LemonBanner type="info" className="mb-4">- PostHog Desktop with usage-based billing launched on July 16, 2026, and existing seats expire on the- same date. New seats, upgrades, and reactivations are no longer available. You can still cancel active- seats below.- </LemonBanner>- <LemonTable- loading={orgSeatsLoading}- dataSource={displaySeats}- defaultSorting={{ columnKey: 'user', order: 1 }}- emptyState="No Desktop seats"- columns={[- {- title: 'User',- key: 'user',- sorter: (a, b) => {- const aName = getUserInfo(a)?.name ?? a.user_distinct_id- const bName = getUserInfo(b)?.name ?? b.user_distinct_id- return aName.localeCompare(bName)- },- render: (_, seat: SeatData) => {- const info = getUserInfo(seat)- if (info) {- return (- <div>- <div className="font-semibold">{info.name}</div>- <div className="text-muted text-xs">{info.email}</div>- </div>- )- }- return <span className="text-muted">{seat.user_distinct_id.slice(0, 8)}...</span>- },- },- {- title: 'Plan',- key: 'plan',- align: 'center',- render: (_, seat: SeatData) => {- return (- <LemonTag- type={- isAlphaPlanKey(seat.plan_key)- ? 'completion'- : isProPlanKey(seat.plan_key)- ? 'primary'- : 'muted'- }- >- {planLabel(seat.plan_key)}- </LemonTag>- )- },- },- {- title: 'Status',- key: 'status',- align: 'center',- render: (_, seat: SeatData) => (- <LemonTag type={statusColor(seat.status)}>{seat.status}</LemonTag>- ),- },- {- title: 'Cost',- key: 'cost',- render: (_, seat: SeatData) => {- const price = seatPriceFromPlanKey(seat.plan_key)- return price > 0 ? `$${price}/mo` : 'Free'- },- },- {- title: 'Started',- key: 'active_from',- render: (_, seat: SeatData) => formatSeatDate(seat.active_from),- },- {- title: 'Expires',- key: 'active_until',- render: (_, seat: SeatData) => formatSeatDate(seat.active_until),- },- {- title: '',- key: 'actions',- width: 0,- render: (_, seat: SeatData) => {- if (!canCancelSeat(seat, isAdmin)) {- return null- }-- return (- <More- overlay={- <LemonButton- fullWidth- onClick={() => {- LemonDialog.open({- title: 'Cancel this seat?',- description:- 'The seat will remain active until the end of the current billing period.',- primaryButton: {- children: 'Cancel seat',- status: 'danger',- onClick: () => adminCancelSeat(seat.user_distinct_id),- },- secondaryButton: { children: 'Keep seat' },- })- }}- >- Cancel seat- </LemonButton>- }- />- )- },- },- ]}- />- </div>- )-}diff --git a/frontend/src/scenes/billing/constants.ts b/frontend/src/scenes/billing/constants.tsindex 6a849e2d8098..366300330da0 100644--- a/frontend/src/scenes/billing/constants.ts+++ b/frontend/src/scenes/billing/constants.ts@@ -39,13 +39,6 @@ export type UsageTypeValue = UsageTypeOption['value']export const ALL_USAGE_TYPES: UsageTypeValue[] = USAGE_TYPES.map((opt) => opt.value)-export const CODE_PRODUCT_KEY = 'posthog_code'-// TODO: Replace hardcoded plan keys with dynamic plan metadata from billing service-export const CODE_PLAN_ALPHA_PRO = 'posthog-code-pro-0-20260422'--export const CODE_PRO_PLAN_PREFIX = 'posthog-code-pro-'-export const CODE_FREE_PLAN_PREFIX = 'posthog-code-free'-// Date after which billing for data pipelines ends and add-on upgrades/downgrades are disabled,// in sync with billing_end_date of data_pipelines in billing plans configexport const DATA_PIPELINES_CUTOFF_DATE = '2025-09-10'diff --git a/frontend/src/scenes/billing/seatBillingLogic.spec.ts b/frontend/src/scenes/billing/seatBillingLogic.spec.tsdeleted file mode 100644index 7b60921d50e1..000000000000--- a/frontend/src/scenes/billing/seatBillingLogic.spec.ts+++ /dev/null@@ -1,72 +0,0 @@-import { canCancelSeat, isAlphaPlanKey, isFreePlanKey, isProPlanKey, seatPriceFromPlanKey } from './seatBillingLogic'--describe('seatBillingLogic plan key helpers', () => {- describe('isProPlanKey', () => {- it.each([- ['posthog-code-pro-200-20260301', true],- ['posthog-code-pro-0-20260422', true],- ['posthog-code-pro-500-20270101', true],- ['posthog-code-free-20260301', false],- ['posthog-code-200-20260301', false],- ['some-other-plan', false],- ['', false],- [null, false],- [undefined, false],- ])('isProPlanKey(%p) === %p', (planKey, expected) => {- expect(isProPlanKey(planKey)).toBe(expected)- })- })-- describe('isAlphaPlanKey', () => {- it.each([- ['posthog-code-pro-0-20260422', true],- ['posthog-code-pro-200-20260301', false],- ['posthog-code-pro-500-20270101', false],- ['posthog-code-free-20260301', false],- ['some-other-plan', false],- ['', false],- [null, false],- [undefined, false],- ])('isAlphaPlanKey(%p) === %p', (planKey, expected) => {- expect(isAlphaPlanKey(planKey)).toBe(expected)- })- })-- describe('isFreePlanKey', () => {- it.each([- ['posthog-code-free-20260301', true],- ['posthog-code-free-20270101', true],- ['posthog-code-pro-200-20260301', false],- ['posthog-code-pro-0-20260422', false],- ['some-other-plan', false],- ['', false],- [null, false],- [undefined, false],- ])('isFreePlanKey(%p) === %p', (planKey, expected) => {- expect(isFreePlanKey(planKey)).toBe(expected)- })- })-- describe('seatPriceFromPlanKey', () => {- it.each([- ['posthog-code-pro-200-20260301', 200],- ['posthog-code-pro-0-20260422', 0],- ['posthog-code-pro-500-20270101', 500],- ['posthog-code-free-20260301', 0],- ['unrecognized-plan', 0],- ])('seatPriceFromPlanKey(%p) === %p', (planKey, expected) => {- expect(seatPriceFromPlanKey(planKey)).toBe(expected)- })- })-- describe('canCancelSeat', () => {- it.each([- ['active', true, true],- ['active', false, false],- ['canceling', true, false],- ['expired', true, false],- ] as const)('canCancelSeat({ status: %p }, %p) === %p', (status, isAdmin, expected) => {- expect(canCancelSeat({ status }, isAdmin)).toBe(expected)- })- })-})diff --git a/frontend/src/scenes/billing/seatBillingLogic.ts b/frontend/src/scenes/billing/seatBillingLogic.tsdeleted file mode 100644index ba1da116e709..000000000000--- a/frontend/src/scenes/billing/seatBillingLogic.ts+++ /dev/null@@ -1,211 +0,0 @@-import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, selectors } from 'kea'-import { loaders } from 'kea-loaders'--import { lemonToast } from '@posthog/lemon-ui'--import api, { ApiError } from 'lib/api'-import { FEATURE_FLAGS, OrganizationMembershipLevel } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'-import { membersLogic } from 'scenes/organization/membersLogic'-import { organizationLogic } from 'scenes/organizationLogic'--import type { FeatureFlagsSet } from '../../lib/logic/featureFlagLogic'-import type { OrganizationMemberType, OrganizationType } from '../../types'-import { CODE_FREE_PLAN_PREFIX, CODE_PLAN_ALPHA_PRO, CODE_PRO_PLAN_PREFIX, CODE_PRODUCT_KEY } from './constants'-import type { SeatData } from './types'--export function isProPlanKey(planKey: string | null | undefined): boolean {- return !!planKey && planKey.startsWith(CODE_PRO_PLAN_PREFIX)-}--export function isFreePlanKey(planKey: string | null | undefined): boolean {- return !!planKey && planKey.startsWith(CODE_FREE_PLAN_PREFIX)-}--export function isAlphaPlanKey(planKey: string | null | undefined): boolean {- return planKey === CODE_PLAN_ALPHA_PRO-}--export function canCancelSeat(seat: Pick<SeatData, 'status'>, isAdmin: boolean): boolean {- return isAdmin && seat.status === 'active'-}--// TODO: Replace with `seat.price` once billing exposes it via SeatSerializer-export function seatPriceFromPlanKey(planKey: string): number {- if (isFreePlanKey(planKey)) {- return 0- }- const match = planKey.match(/posthog-code-pro-(\d+)/)- return match ? parseInt(match[1], 10) : 0-}--function seatErrorMessage(e: unknown, fallback: string): string {- if (e instanceof ApiError) {- return e.detail || e.data?.detail || e.data?.error || fallback- }- return fallback-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface seatBillingLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogic- members: OrganizationMemberType[] | null // membersLogic- currentOrganization: OrganizationType | null // organizationLogic- activeCount: number- cancelingCount: number- displaySeats: SeatData[]- isAdmin: boolean- monthlyTotal: number- orgSeats: SeatData[]- orgSeatsLoading: boolean-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface seatBillingLogicActions {- ensureAllMembersLoaded: () => {- value: true- } // membersLogic- adminCancelSeat: (userDistinctId: string) => {- userDistinctId: string- }- loadOrgSeats: () => any- loadOrgSeatsFailure: (- error: string,- errorObject?: any- ) => {- error: string- errorObject?: any- }- loadOrgSeatsSuccess: (- orgSeats: SeatData[],- payload?: any- ) => {- orgSeats: SeatData[]- payload?: any- }-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface seatBillingLogicMeta {- __keaTypeGenInternalSelectorTypes: {- isAdmin: (currentOrganization: OrganizationType | null) => boolean- displaySeats: (orgSeats: SeatData[]) => SeatData[]- activeCount: (displaySeats: SeatData[]) => number- cancelingCount: (displaySeats: SeatData[]) => number- monthlyTotal: (displaySeats: SeatData[]) => number- }-}--export type seatBillingLogicType = MakeLogicType<- seatBillingLogicValues,- seatBillingLogicActions,- Record<string, any>,- seatBillingLogicMeta->--export const seatBillingLogic = kea<seatBillingLogicType>([- path(['scenes', 'billing', 'seatBillingLogic']),- connect(() => ({- values: [- organizationLogic,- ['currentOrganization'],- membersLogic,- ['members'],- featureFlagLogic,- ['featureFlags'],- ],- actions: [membersLogic, ['ensureAllMembersLoaded']],- })),- actions({- adminCancelSeat: (userDistinctId: string) => ({ userDistinctId }),- }),- loaders(() => ({- orgSeats: [- [] as SeatData[],- {- loadOrgSeats: async (): Promise<SeatData[]> => {- try {- const response = await api.get(`api/seats/?product_key=${CODE_PRODUCT_KEY}`)- return Array.isArray(response) ? response : (response?.seats ?? [])- } catch (e) {- if (e instanceof ApiError && e.status === 403) {- return []- }- lemonToast.error(seatErrorMessage(e, 'Failed to load organization seats'))- return []- }- },- },- ],- })),- selectors({- isAdmin: [- (s) => [s.currentOrganization],- (currentOrganization: null | import('../../types').OrganizationType): boolean =>- !!(- currentOrganization?.membership_level &&- currentOrganization.membership_level >= OrganizationMembershipLevel.Admin- ),- ],- displaySeats: [- (s) => [s.orgSeats],- (orgSeats: SeatData[]): SeatData[] => {- const STATUS_PRIORITY: Record<string, number> = {- active: 0,- canceling: 1,- pending_payment: 2,- pending: 3,- expired: 4,- withdrawn: 5,- }- return Object.values(- orgSeats.reduce<Record<string, SeatData>>((acc, seat) => {- const existing = acc[seat.user_distinct_id]- if (- !existing ||- (STATUS_PRIORITY[seat.status] ?? 99) < (STATUS_PRIORITY[existing.status] ?? 99)- ) {- acc[seat.user_distinct_id] = seat- }- return acc- }, {})- )- },- ],- activeCount: [- (s) => [s.displaySeats],- (displaySeats: SeatData[]): number => displaySeats.filter((s: SeatData) => s.status === 'active').length,- ],- cancelingCount: [- (s) => [s.displaySeats],- (displaySeats: SeatData[]): number => displaySeats.filter((s: SeatData) => s.status === 'canceling').length,- ],- monthlyTotal: [- (s) => [s.displaySeats],- (displaySeats: SeatData[]): number =>- displaySeats- .filter((s: SeatData) => s.status === 'active')- .reduce((sum: number, s: SeatData) => sum + seatPriceFromPlanKey(s.plan_key), 0),- ],- }),- listeners(({ actions }) => ({- adminCancelSeat: async ({ userDistinctId }) => {- try {- await api.delete(`api/seats/${userDistinctId}/?product_key=${CODE_PRODUCT_KEY}`)- lemonToast.success('Seat canceled')- actions.loadOrgSeats()- } catch (e) {- lemonToast.error(seatErrorMessage(e, 'Failed to cancel seat'))- }- },- })),- afterMount(({ actions, values }) => {- if (!values.featureFlags[FEATURE_FLAGS.POSTHOG_CODE_BILLING]) {- return- }- actions.ensureAllMembersLoaded()- if (values.isAdmin) {- actions.loadOrgSeats()- }- }),-])diff --git a/frontend/src/scenes/billing/types.ts b/frontend/src/scenes/billing/types.tsindex fa27bda014cc..ec412906c9c5 100644--- a/frontend/src/scenes/billing/types.ts+++ b/frontend/src/scenes/billing/types.ts@@ -14,20 +14,6 @@ export type BillingGaugeItemType = {export type BillingSectionId = 'overview' | 'usage' | 'spend' | 'alerts'-export type SeatStatus = 'active' | 'canceling' | 'pending' | 'pending_payment' | 'expired' | 'withdrawn'--export interface SeatData {- id: string- user_distinct_id: string- product_key: string- plan_key: string- status: SeatStatus- end_reason: string | null- created_at: string | number- active_until: string | number | null- active_from: string | number | null-}-export interface BillingFilters {usage_types?: string[]team_ids?: number[]