-
Notifications
You must be signed in to change notification settings - Fork 51
Introduced Pro+ subscription tier with monthly and yearly pricing options #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ated logic - Introduced 'pro-plus' subscription tier across various components and APIs. - Updated entitlement checks to include 'pro-plus' in subscription logic. - Modified pricing features and plan headers to reflect the new tier. - Adjusted user interface components to support 'pro-plus' features and upgrade paths. - Refactored related functions and types to accommodate the new subscription structure. This change improves the flexibility of subscription offerings and enhances user experience by providing more options.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a new "pro-plus" subscription tier across types, entitlement detection, pricing, UI, upgrade flows, token/rate-limit logic, and backend entitlement checks; simplifies paid-plan token limits and removes an entitlement-based file limit helper. Changes
Sequence Diagram(s)sequenceDiagram
participant User as Client (UI)
participant Front as Frontend/API
participant Auth as Auth Service
participant Billing as Billing/Subcribe API
participant Convex as Backend/Convex DB
User->>Front: Click "Upgrade to Pro+"
Front->>Auth: validate session
Auth-->>Front: userId, entitlements
Front->>Billing: POST /api/subscribe (pro-plus plan)
Billing->>Convex: persist subscription / create payment session
Convex-->>Billing: subscription created / metadata (pro-plus)
Billing-->>Front: subscribe response / session URL
Front->>User: redirect to payment
Billing->>Convex: webhook -> update entitlements
Convex-->>Front: entitlements updated
Front->>Auth: refresh entitlements (entitlements route)
Auth-->>Front: hasProPlus=true
Front->>User: UI updates (Pro+ features, badges, token limits)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@convex/memories.ts`:
- Around line 44-45: The comment above the tokenLimit assignment is misleading;
update it to clarify that MAX_TOKENS_PAID (the 100k context window in
token-utils.ts) refers to the model's overall context window while the local
variable tokenLimit (used in memories.ts) is the memory-specific budget (5000
for "free", 15000 for paid). Locate the tokenLimit assignment and replace the
comment with a concise note referencing MAX_TOKENS_PAID vs tokenLimit so future
readers understand the distinction between the model context window and the
memory token budget.
In `@convex/notes.ts`:
- Around line 181-182: The existing comment above the tokenLimit assignment is
misleading—replace it with a concise, accurate comment that explains this value
is the notes token budget (not the model's context/window) and reflect the
actual numbers used: free users get 5000 tokens and paid users get 15000 tokens;
do not reference a 100k context window here. Update the comment near the
tokenLimit variable (tokenLimit and args.subscription) to state that it’s the
notes token budget and list the free vs paid token amounts.
🧹 Nitpick comments (2)
lib/rate-limit/token-bucket.ts (1)
225-244: Consider extracting duplicateupgradeHintlogic into a helper.The
upgradeHintconstruction logic is duplicated at lines 225-230 and 239-244. Both blocks are identical.♻️ Proposed refactor to eliminate duplication
+const getUpgradeHint = (subscription: SubscriptionTier): string => { + if (subscription === "pro") { + return " or upgrade to Pro+ or Ultra for higher limits"; + } + if (subscription === "pro-plus") { + return " or upgrade to Ultra for higher limits"; + } + return ""; +}; + export const checkAgentRateLimit = async ( // ... existing code ...Then replace both occurrences:
- const upgradeHint = - subscription === "pro" - ? " or upgrade to Pro+ or Ultra for higher limits" - : subscription === "pro-plus" - ? " or upgrade to Ultra for higher limits" - : ""; + const upgradeHint = getUpgradeHint(subscription);app/components/PricingDialog.tsx (1)
254-261: Minor UX inconsistency in button text for Pro+ users.When a pro-plus user views the Pro plan card, the button shows "Pro" instead of a more descriptive text like "Downgrade unavailable" or keeping it consistent with other disabled states showing "Current Plan". This differs from the pattern where disabled buttons typically indicate why they're disabled.
Consider clarifying the button text for better UX.
💡 Suggested improvement
} else if (user && subscription === "pro-plus") { // Pro+ users can't downgrade to Pro return { - text: "Pro", + text: "Included in Pro+", disabled: true, className: "opacity-50 cursor-not-allowed", variant: "secondary" as const, };
…queries to enhance code clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@convex/memories.ts`:
- Around line 43-45: The token limit calculation uses args.subscription but that
field is optional and currently falls back to the paid limit when omitted;
update the logic that computes tokenLimit (the line setting tokenLimit based on
args.subscription) to treat a missing/undefined subscription as "free" (or
alternatively make the subscription argument required in the function
signature), e.g., normalize args.subscription before the ternary or explicitly
check for undefined and default to "free" so callers who omit args.subscription
get the 5000-token free limit; update any related type/interface for args if you
choose to make subscription required.
In `@convex/notes.ts`:
- Around line 180-182: The token-limit logic incorrectly treats an undefined
args.subscription as paid; update the calculation in the function that declares
tokenLimit (using args.subscription) so that undefined defaults to "free" rather
than premium—for example, explicitly check for "paid" (or coalesce
args.subscription to "free") before assigning tokenLimit (the variables to
update are tokenLimit and the use of args.subscription in convex/notes.ts) so
omitted subscriptions receive the free-tier limit.
When subscription parameter was not provided, the ternary expression would evaluate to 15000 (paid tier) instead of 5000 (free tier). Changed logic to explicitly check for undefined/missing subscription and default to free tier limits. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This change improves the flexibility of subscription offerings and enhances user experience by providing more options.
Summary by CodeRabbit
New Features
Updates
✏️ Tip: You can customize this high-level summary in your review settings.