(plan: string | null | undefined)
| 143 | } |
| 144 | |
| 145 | export function getDisplayPlanName(plan: string | null | undefined): string { |
| 146 | if (!plan || isFree(plan)) return 'Free' |
| 147 | if (isEnterprise(plan)) return 'Enterprise' |
| 148 | const credits = getPlanTierCredits(plan) |
| 149 | const tier = CREDIT_TIERS.find((t) => t.credits === credits) |
| 150 | const isLegacy = plan === 'pro' || plan === 'team' |
| 151 | const tierName = tier?.name ?? (plan === 'team' ? 'Max' : 'Pro') |
| 152 | const prefix = isLegacy ? 'Legacy ' : '' |
| 153 | const suffix = isTeam(plan) ? ' for Teams' : '' |
| 154 | return `${prefix}${tierName}${suffix}` |
| 155 | } |
no test coverage detected