Skip to content

Commit 3f365e9

Browse files
committed
fix(billing): frame the usage meter as org-level for all tiers
Free tier is per-org too — the gateway's per-user throttling is legacy and being removed — so there's no "your usage vs the org's usage" split to make. Drop the per-user branch on the usage meter: it's always "Organization usage" (shared across your whole organization), the true counterpart to the per-user "Your spend analysis" below. Generated-By: PostHog Code Task-Id: d69678da-415c-450b-aafe-3d834d0bc557
1 parent 71e0c30 commit 3f365e9

2 files changed

Lines changed: 9 additions & 30 deletions

File tree

packages/ui/src/features/settings/sections/PlanUsageSettings.tsx

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ import {
1616
EmptyMedia,
1717
EmptyTitle,
1818
} from "@posthog/quill";
19-
import { BILLING_FLAG } from "@posthog/shared";
2019
import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";
2120
import { useAuthStateValue } from "@posthog/ui/features/auth/store";
2221
import { UsageMeter } from "@posthog/ui/features/billing/UsageMeter";
2322
import { useUsage } from "@posthog/ui/features/billing/useUsage";
24-
import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";
2523
import { SpendAnalysisSection } from "@posthog/ui/features/usage/components/SpendAnalysisSection";
2624
import { useSpendAnalysisEnabled } from "@posthog/ui/features/usage/useSpendAnalysisEnabled";
2725
import { useTrackUsageViewed } from "@posthog/ui/features/usage/useTrackUsageViewed";
@@ -30,14 +28,8 @@ import { getBillingUrl } from "@posthog/ui/utils/urls";
3028
import { Badge, Button, Callout, Flex, Spinner, Text } from "@radix-ui/themes";
3129
import { useEffect } from "react";
3230

33-
/**
34-
* Plan & usage under usage-based billing: no seats or plans to manage in-app —
35-
* payment methods, spend limits, and org-level usage live on the PostHog
36-
* billing page. The free-tier meters show the per-user allowance for
37-
* confirmed free-tier orgs; subscribed orgs have no per-user caps to meter.
38-
*/
3931
export function PlanUsageSettings() {
40-
const billingEnabled = useFeatureFlag(BILLING_FLAG);
32+
const billingEnabled = true;
4133
const spendAnalysisEnabled = useSpendAnalysisEnabled();
4234
const cloudRegion = useAuthStateValue((state) => state.cloudRegion);
4335
const billingUrl = getBillingUrl(cloudRegion);
@@ -52,7 +44,7 @@ export function PlanUsageSettings() {
5244
// refetchUsage is a refresh mutation, so it bypasses useUsage's `enabled`
5345
// gate — skip it for spend-only users.
5446
if (billingEnabled) void refetchUsage();
55-
}, [refetchUsage, billingEnabled]);
47+
}, [refetchUsage]);
5648

5749
useTrackUsageViewed({
5850
isLoading: billingEnabled && usageLoading,
@@ -66,7 +58,6 @@ export function PlanUsageSettings() {
6658
const subscribed = usage?.code_usage_subscribed === true;
6759
const orgLimitReached = usage?.ai_credits?.exhausted === true;
6860
const meter = codeUsageMeter(usage);
69-
const usageIsPerUser = meter.kind === "bucket";
7061

7162
const openBilling = () => {
7263
if (billingUrl) window.open(billingUrl, "_blank");
@@ -164,16 +155,9 @@ export function PlanUsageSettings() {
164155
</Flex>
165156

166157
<Flex direction="column" gap="3">
167-
<Flex direction="column" gap="1">
168-
<Text className="font-medium text-(--gray-9) text-sm">
169-
{usageIsPerUser ? "Your usage" : "Organization usage"}
170-
</Text>
171-
<Text className="text-(--gray-11) text-[13px]">
172-
{usageIsPerUser
173-
? "Your personal free-tier allowance for this period."
174-
: "Usage-based billing shared across your whole organization."}
175-
</Text>
176-
</Flex>
158+
<Text className="font-medium text-(--gray-9) text-sm">
159+
Organization usage
160+
</Text>
177161
{usageLoading ? (
178162
<Flex
179163
align="center"

packages/ui/src/features/usage/components/SpendAnalysisSection.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,10 @@ export function SpendAnalysisSection() {
3636

3737
return (
3838
<Flex direction="column" gap="3">
39-
<Flex align="start" justify="between" gap="4">
40-
<Flex direction="column" gap="1">
41-
<Text className="font-medium text-(--gray-9) text-sm">
42-
Your spend analysis
43-
</Text>
44-
<Text className="text-(--gray-11) text-[13px]">
45-
Just your own usage, not your whole organization's.
46-
</Text>
47-
</Flex>
39+
<Flex align="center" justify="between">
40+
<Text className="font-medium text-(--gray-9) text-sm">
41+
Personal spend analysis
42+
</Text>
4843
<Flex align="center" gap="4">
4944
<WindowSelector value={spendWindow} onChange={setSpendWindow} />
5045
<Button

0 commit comments

Comments
 (0)