feat: add trial detection to desktop app via JWT claims #2405
+129
−4
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
Adds trial detection capability to the desktop app by extending JWT claims with subscription status and trial end date. Previously, the desktop app could only detect if a user had
hyprnote_proentitlement but couldn't distinguish between trial and paid subscriptions or know when the trial would expire.Changes:
custom_access_token_hookto includesubscription_status("trialing" | "active") andtrial_end(Unix timestamp) fromstripe.subscriptionsbilling.tsxextracts new claims and exposesisTrialingandtrialDaysRemainingvia BillingContextReview & Testing Checklist for Human
trial_endextraction(s.trial_end #>> '{}')::bigintworks correctly with actual Stripe subscription data (the field is stored as jsonb)Recommended Test Plan
Notes
Link to Devin run: https://app.devin.ai/sessions/9b6fe60fb4b048ecb70be93263634607
Requested by: yujonglee (@yujonglee)