Skip to content

[PREMIUM-001] Add premium plan and entitlements - #90

Open
chev0004 wants to merge 7 commits into
developfrom
feat/premium-001
Open

[PREMIUM-001] Add premium plan and entitlements#90
chev0004 wants to merge 7 commits into
developfrom
feat/premium-001

Conversation

@chev0004

@chev0004 chev0004 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Outline

Summary

Adds the central premium entitlement system: named entitlement keys with free and premium values, a server-side isPremiumUser check backed by the subscription table and the env allowlist, server-enforced caps on profile saves and bumps, and a premium flag on discovery profile data so cards render premium cosmetics for real subscribers.


Changes & Enhancements

  • Type of Change:
    • Feature
    • Bugfix
    • Refactor
    • Chore
  • Changes:
    • (Entitlements):
      • Rework src/lib/entitlements.ts around named keys: profile.targetLanguages, profile.tags, and discovery.bumpCooldownMs limits plus premium-only features (profile.voiceIntro, profile.cardThemes, privacy.hiddenVisits, notifications.profileViews).
      • Add src/lib/entitlements.server.ts with isPremiumUser, combining the env allowlist and active subscription state.
      • Source the scattered language, tag, and bump-cooldown constants from the entitlement table.
    • (Server):
      • Profile save enforces the language and tag caps at the caller's real entitlement level (premium users could previously never save past the free language cap).
      • Bump cooldown and discovery page use isPremiumUser so a paid subscription grants the shorter cooldown without env changes.
    • (Discovery):
      • Profile queries join subscriptions and set premium on discovery profiles, so premium card themes and badges reflect actual entitlement.
    • (Profile editor):
      • The profile route passes the viewer's entitlement, unlocking premium caps, card themes, and the voice intro editor for subscribers.

Page / App Changes

Affected Next.js Routes (Local):

  • /[lang]/profile (premium caps and unlocked premium controls for subscribers)
  • /[lang] (discovery cards carry real premium status)
Before (Screenshot)
After (Screenshot)

Component / Storybook Changes

Affected Storybook Components (Local):

Before (Screenshot)
After (Screenshot)

Not Doing


Other (Remarks)

Builds on #89 and includes its commits until that merges; merge #89 first and this PR's diff reduces to the entitlement work.


Checklists

  • Code is well-documented (comments, JSDoc, etc.).
  • Existing comments were updated as needed.
  • No out-of-scope changes are included.
  • Write TODO comments where future work is required.
  • Removed unnecessary debug code (e.g., console.log, debugger).
  • Self-reviewed and tested locally.

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