fix(billing): hide billing portal for lifetime licenses (#427)

Lifetime licenses have no recurring subscription, so the Lemon Squeezy
customer portal cannot generate a URL. The Manage Subscription button in
Settings already had the isLifetime guard, but the Billing button in the
profile dropdown did not, causing a confusing "No billing portal
available" error.

- Add !license.isLifetime guard to UserProfileDropdown (matches
  LicenseSection pattern)
- Move lifetime detection into getBillingPortalUrl() so the service owns
  all billing eligibility logic
- Change return type to { url } | { error } discriminated union for
  clear error propagation
This commit is contained in:
Anso
2026-04-08 09:51:27 -04:00
committed by GitHub
parent f6d2199978
commit be7eda85f1
5 changed files with 20 additions and 13 deletions
@@ -77,7 +77,7 @@ export function UserProfileDropdown({ theme, setTheme, onOpenSettings }: UserPro
<Settings className="w-4 h-4 text-muted-foreground" />
Settings
</button>
{license?.status === 'active' && (
{license?.status === 'active' && !license?.isLifetime && (
<button
onClick={openBillingPortal}
disabled={billingLoading}