Skip to content

feat: Update usage limit modal for Pro users#2399

Merged
charlesvien merged 2 commits into
mainfrom
05-27-update_usage_limit_modal_for_pro_users
May 28, 2026
Merged

feat: Update usage limit modal for Pro users#2399
charlesvien merged 2 commits into
mainfrom
05-27-update_usage_limit_modal_for_pro_users

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented May 27, 2026

Problem

Pro users hitting the daily cap saw the same "upgrade to Pro" pitch as Free users, treating a normal reset window like a paywall.

Changes

  1. Branch modal title and copy on plan and bucket (daily vs monthly)
  2. Drop the upgrade CTA for Pro users; show a single "Got it" button
  3. Add "Get support" button on the left that opens mailto:charles@posthog.com (Pro only)
  4. Pass bucket and resetAt from the threshold event through to the store
  5. Read isPro from useSeat so the rate-limit fallback path also branches correctly

How did you test this?

Manually

Publish to changelog?

no

Copy link
Copy Markdown
Member Author

charlesvien commented May 27, 2026

@charlesvien charlesvien changed the title Update usage limit modal for Pro users feat: Update usage limit modal for Pro users May 27, 2026
@charlesvien charlesvien marked this pull request as ready for review May 27, 2026 18:34
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 27, 2026

T-Rex T-Rex Logs

What T-Rex did

  • Rendered the UsageLimitModal in Pro and Free states via component tests.
  • Tested burst and sustained usage, fallback show with invalid resetAt, and plan changes while the modal was open.
  • Exercised the See Pro, Not now, Get support, and Got it button flows.
  • Ran the existing usage limit store and reset-time utility tests for regression coverage.
  • All focused tests and checks reported passing.
Artifacts

Generated UsageLimitModal component test run

  • Evidence of the component test execution for the UsageLimitModal.

Generated UsageLimitModal component tests

  • Source code for the UsageLimitModal tests used in this PR.

Existing usageLimitStore and billing utils test run

  • Evidence of the regression tests for the usage limit store and billing utilities.

T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
apps/code/src/renderer/features/billing/subscriptions.ts:23-26
**Use event plan**

This threshold event already carries the authoritative `isPro` value from the usage monitor, but this path drops it and leaves the modal to recompute plan state from `useSeat()`. On app startup or after auth changes, the billing subscription can receive a 100% event while the seat fetch is still in flight, so a Pro user can be treated as Free and shown the `See Pro` upgrade CTA. Store the event's plan value with the modal context and use `useSeat()` only for fallback opens that do not come from a threshold event.

### Issue 2 of 3
apps/code/src/renderer/features/billing/components/UsageLimitModal.tsx:38-40
**Handle support failure**

`openExternal.mutate` returns a Promise, but this click handler drops it without `await`, `void`, or `.catch`. If the main process rejects the request or the mail client cannot be opened, the renderer gets an unhandled rejection and the user gets no feedback from the modal.

```suggestion
  const handleSupport = () => {
    void trpcClient.os.openExternal.mutate({ url: SUPPORT_MAILTO });
  };
```

### Issue 3 of 3
apps/code/src/renderer/features/billing/components/UsageLimitModal.tsx:61-63
**Preserve monthly copy**

For Free users on the sustained bucket, the title says they are out of usage for this month, but the body falls through to the generic `Free usage limit` wording. That loses the new bucket-specific message for the monthly cap and makes the modal copy disagree with itself.

```suggestion
    : `You've hit your Free ${
        isDaily ? "daily" : isMonthly ? "monthly" : "usage"
      } limit. Upgrade to Pro for 20x more usage.`;
```

Reviews (1): Last reviewed commit: "Update usage limit modal for Pro users" | Re-trigger Greptile

Comment thread apps/code/src/renderer/features/billing/subscriptions.ts
Comment on lines +12 to +13
const SUPPORT_MAILTO =
"mailto:charles@posthog.com?subject=PostHog%20Code%20%E2%80%94%20Pro%20usage%20limit";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would probably be a good place to use the conversations product so we can set up automations (like message -> slack or something)

not blocking but something to consider moving fwd!

Copy link
Copy Markdown
Member Author

charlesvien commented May 28, 2026

Merge activity

  • May 28, 1:10 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 28, 1:12 AM UTC: Graphite rebased this pull request as part of a merge.
  • May 28, 1:17 AM UTC: @charlesvien merged this pull request with Graphite.

@charlesvien charlesvien changed the base branch from 05-27-docs_update to graphite-base/2399 May 28, 2026 01:11
@charlesvien charlesvien changed the base branch from graphite-base/2399 to main May 28, 2026 01:11
@charlesvien charlesvien force-pushed the 05-27-update_usage_limit_modal_for_pro_users branch from 3414316 to aadbb5d Compare May 28, 2026 01:11
@charlesvien charlesvien merged commit dc13076 into main May 28, 2026
18 checks passed
@charlesvien charlesvien deleted the 05-27-update_usage_limit_modal_for_pro_users branch May 28, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants