Use PlanType enum when formatting usage-limit CTA (#3495)

- Started using Play type struct
- Added CTA for team/business 
- Refactored a bit to unify the logic
This commit is contained in:
Ahmed Ibrahim
2025-09-11 18:01:25 -04:00
committed by GitHub
parent 8f7b22b652
commit 44587c2443
4 changed files with 125 additions and 41 deletions

View File

@@ -17,6 +17,7 @@ use std::time::Duration;
use codex_protocol::mcp_protocol::AuthMode;
use crate::token_data::PlanType;
use crate::token_data::TokenData;
use crate::token_data::parse_id_token;
@@ -134,9 +135,9 @@ impl CodexAuth {
self.get_current_token_data().and_then(|t| t.account_id)
}
pub fn get_plan_type(&self) -> Option<String> {
pub(crate) fn get_plan_type(&self) -> Option<PlanType> {
self.get_current_token_data()
.and_then(|t| t.id_token.chatgpt_plan_type.as_ref().map(|p| p.as_string()))
.and_then(|t| t.id_token.chatgpt_plan_type)
}
fn get_current_auth_json(&self) -> Option<AuthDotJson> {