Files
codex/codex-rs/tui/src/subscription.rs
T
Eric Traut fe50d010e2 Update and centralize TUI subscription labels (#49079)
## What changed

Use a shared subscription label mapping for status and analytics views. Rename
`Pro Extra` to `Pro 200`, `Pro Standard` to `Pro 100`, and `Pro Max` to `Pro 500`,
while preserving the existing differences between status and analytics labels
for other plans.

## Testing

Update the status plan-label test expectations for the three Pro tiers.

GitOrigin-RevId: 47af1e7d56ef9f7701caff8af315f530087920b8
2026-09-28 20:59:25 +00:00

39 lines
1.6 KiB
Rust

//! Subscription labels for TUI surfaces, preserving status-specific plan detail.
use codex_protocol::account::PlanType;
pub(crate) enum SubscriptionDisplay {
Status,
Analytics,
}
impl SubscriptionDisplay {
pub(crate) fn label(&self, plan: PlanType) -> &'static str {
match (plan, self) {
(PlanType::Free, _) => "Free",
(PlanType::Go, _) => "Go",
(PlanType::Plus, _) => "Plus",
(PlanType::Pro, _) => "Pro 200",
(PlanType::ProLite, _) => "Pro 100",
(PlanType::ProMax, _) => "Pro 500",
(PlanType::Team | PlanType::SelfServeBusinessUsageBased, _) => "Business",
(PlanType::Business, Self::Status) => "Enterprise",
(PlanType::SelfServeBusinessProLite, Self::Status) => "Business Premium",
(PlanType::Business | PlanType::SelfServeBusinessProLite, Self::Analytics) => {
"Business"
}
(PlanType::EnterpriseCbpAutomation, Self::Status) => "Enterprise (Automation)",
(PlanType::EnterpriseCbpAutomation, Self::Analytics)
| (PlanType::Enterprise | PlanType::Ent26 | PlanType::EnterpriseCbpUsageBased, _) => {
"Enterprise"
}
(PlanType::Edu, Self::Status) => "Edu",
(PlanType::EduPlus, Self::Status) => "Edu Plus",
(PlanType::EduPro, Self::Status) => "Edu Pro",
(PlanType::Edu | PlanType::EduPlus | PlanType::EduPro, Self::Analytics) => "Education",
(PlanType::Unknown, Self::Status) => "Unknown",
(PlanType::Unknown, Self::Analytics) => "Account",
}
}
}