collab: Add use_new_billing to LlmTokenClaims (#29739)

This PR adds a `use_new_billing` field to the LLM token claims, based on
the `new-billing` feature flag.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-01 11:43:53 -04:00 committed by GitHub
parent f891dfb358
commit 5bf1b4f0a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,6 +32,8 @@ pub struct LlmTokenClaims {
pub has_llm_subscription: bool, pub has_llm_subscription: bool,
pub max_monthly_spend_in_cents: u32, pub max_monthly_spend_in_cents: u32,
pub custom_llm_monthly_allowance_in_cents: Option<u32>, pub custom_llm_monthly_allowance_in_cents: Option<u32>,
#[serde(default)]
pub use_new_billing: bool,
pub plan: Plan, pub plan: Plan,
#[serde(default)] #[serde(default)]
pub has_extended_trial: bool, pub has_extended_trial: bool,
@ -90,6 +92,7 @@ impl LlmTokenClaims {
custom_llm_monthly_allowance_in_cents: user custom_llm_monthly_allowance_in_cents: user
.custom_llm_monthly_allowance_in_cents .custom_llm_monthly_allowance_in_cents
.map(|allowance| allowance as u32), .map(|allowance| allowance as u32),
use_new_billing: feature_flags.iter().any(|flag| flag == "new-billing"),
plan: subscription plan: subscription
.as_ref() .as_ref()
.and_then(|subscription| subscription.kind) .and_then(|subscription| subscription.kind)