fix: harmonize account settings between browser and desktop app#3308
Closed
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Closed
fix: harmonize account settings between browser and desktop app#3308devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Conversation
- Add subscription_status and trial_end claims to JWT via auth hook - Update desktop billing context to extract and expose subscription status - Update account settings UI to show 'TRIAL' for trialing users instead of 'PRO' - Add trial end date display when available - Export SubscriptionStatus type from @hypr/supabase package This fixes the discrepancy where browser showed 'Trial' but desktop showed 'PRO' for users on trial subscriptions. Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for howto-fix-macos-audio-selection canceled.
|
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for hyprnote-storybook canceled.
|
… @hypr/supabase The desktop app doesn't have @hypr/supabase as a dependency, so we define the SubscriptionStatus type locally to avoid the 'Cannot find module' error. Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
The syncAfterSuccess function was returning the first subscription found (sorted by creation date) regardless of status. This could return a canceled or old trialing subscription instead of the active one. Now it explicitly searches for 'active' subscriptions first, then falls back to 'trialing' if no active subscription exists. This ensures paid Pro users see 'Pro' instead of 'Trial' in their web account settings. Co-Authored-By: john@hyprnote.com <john@hyprnote.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two related billing display issues:
Desktop showing "PRO" for trial users: The desktop app only checked for
hyprnote_proentitlement without distinguishing subscription status. Now it readssubscription_statusfrom JWT claims to show "TRIAL (ends [date])" for trialing users.Web showing "Trial" for paid Pro users: The
syncAfterSuccessfunction was returning the first subscription found (sorted by creation date) regardless of status, which could return a canceled or old trialing subscription. Now it explicitly prioritizesactivesubscriptions overtrialing.Changes:
subscription_statusandtrial_endclaims to JWT via a new Supabase auth hook migrationSubscriptionStatustype locally in desktop billing.tsx (also exported from@hypr/supabase)Updates since last revision
syncAfterSuccessnow searches foractivesubscriptions first, then falls back totrialing, instead of blindly taking the first subscription returned by Stripe APIReview & Testing Checklist for Human
(s.trial_end #>> '{}')::bigintextraction from jsonb should be tested in staging first; malformed or missingtrial_endvalues could cause the auth hook to error, breaking login for all userslimit: 1from the Stripe API call. Verify it correctly finds the active subscription among multiple (canceled, trialing, active). This is the highest-risk behavioral change on the web side.trial_endclaim (Unix seconds → JS milliseconds conversion)Recommended test plan:
Notes
stripe.subscriptionsforsupabase_auth_admin— required for the auth hook to query subscription dataSubscriptionStatustype is duplicated betweenpackages/supabase/src/jwt.tsandapps/desktop/src/billing.tsxto avoid adding a new package dependency to the desktop app — these could drift if one is updated without the otherlimit: 1from Stripe API call to allow searching through all subscriptions for the active oneLink to Devin run: https://app.devin.ai/sessions/1b9ae9acc87349e393883ca54ed961c6
Requested by: @ComputelessComputer