Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

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_pro entitlement but couldn't distinguish between trial and paid subscriptions or know when the trial would expire.

Changes:

  • SQL migration updates custom_access_token_hook to include subscription_status ("trialing" | "active") and trial_end (Unix timestamp) from stripe.subscriptions
  • billing.tsx extracts new claims and exposes isTrialing and trialDaysRemaining via BillingContext
  • Account settings UI now shows trial-specific messaging (e.g., "Your trial ends in 5 days")

Review & Testing Checklist for Human

  • Verify SQL migration on staging: The auth hook is critical infrastructure. Test that the trial_end extraction (s.trial_end #>> '{}')::bigint works correctly with actual Stripe subscription data (the field is stored as jsonb)
  • Test with a trial user: Verify the UI shows correct trial days remaining and updates after session refresh
  • Test edge cases: trial ending today (shows "ends today"), trial ended (shows 0 days), no subscription (shows FREE), active paid subscription (shows PRO without trial messaging)
  • Verify backward compatibility: Existing users with old tokens (without new claims) should continue to work normally until their token refreshes

Recommended Test Plan

  1. Apply migration to staging/dev Supabase instance
  2. Create a test user and start a trial via the existing flow
  3. Sign in on desktop app and verify account settings shows trial status
  4. Manually refresh session and verify trial days update correctly

Notes

  • Users will see updated trial info after their JWT refreshes (~1 hour default, or on app restart)
  • The migration is additive - it replaces the auth hook function but maintains backward compatibility with existing entitlements logic

Link to Devin run: https://app.devin.ai/sessions/9b6fe60fb4b048ecb70be93263634607
Requested by: yujonglee (@yujonglee)

- Add SQL migration to update auth hook with subscription_status and trial_end claims
- Update billing.tsx to extract new JWT claims (subscription_status, trial_end)
- Add isTrialing and trialDaysRemaining to BillingContext
- Update account settings UI to show trial status and days remaining

Co-Authored-By: yujonglee <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for hyprnote-storybook ready!

Name Link
🔨 Latest commit 570e4e0
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6944af0434d62c0008b1c746
😎 Deploy Preview https://deploy-preview-2405--hyprnote-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 19, 2025

Deploy Preview for hyprnote ready!

Name Link
🔨 Latest commit 570e4e0
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6944af04ad90eb0008e99542
😎 Deploy Preview https://deploy-preview-2405--hyprnote.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant