cloud_llm_client: Add another Plan variant (#37852)

This PR adds a corresponding `FreeV2` variant to the `Plan`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2025-09-09 15:51:22 +00:00
committed by GitHub
parent 2e7607c0e7
commit ad02f6b9e3
10 changed files with 72 additions and 44 deletions
+10 -5
View File
@@ -2,18 +2,22 @@ use std::sync::Arc;
use ai_onboarding::{AgentPanelOnboardingCard, PlanDefinitions};
use client::zed_urls;
use feature_flags::{BillingV2FeatureFlag, FeatureFlagAppExt as _};
use cloud_llm_client::Plan;
use gpui::{AnyElement, App, IntoElement, RenderOnce, Window};
use ui::{Divider, Tooltip, prelude::*};
#[derive(IntoElement, RegisterComponent)]
pub struct EndTrialUpsell {
plan: Plan,
dismiss_upsell: Arc<dyn Fn(&mut Window, &mut App)>,
}
impl EndTrialUpsell {
pub fn new(dismiss_upsell: Arc<dyn Fn(&mut Window, &mut App)>) -> Self {
Self { dismiss_upsell }
pub fn new(plan: Plan, dismiss_upsell: Arc<dyn Fn(&mut Window, &mut App)>) -> Self {
Self {
plan,
dismiss_upsell,
}
}
}
@@ -32,7 +36,7 @@ impl RenderOnce for EndTrialUpsell {
)
.child(Divider::horizontal()),
)
.child(PlanDefinitions.pro_plan(cx.has_flag::<BillingV2FeatureFlag>(), false))
.child(PlanDefinitions.pro_plan(self.plan.is_v2(), false))
.child(
Button::new("cta-button", "Upgrade to Zed Pro")
.full_width()
@@ -63,7 +67,7 @@ impl RenderOnce for EndTrialUpsell {
)
.child(Divider::horizontal()),
)
.child(PlanDefinitions.free_plan(cx.has_flag::<BillingV2FeatureFlag>()));
.child(PlanDefinitions.free_plan(self.plan.is_v2()));
AgentPanelOnboardingCard::new()
.child(Headline::new("Your Zed Pro Trial has expired"))
@@ -108,6 +112,7 @@ impl Component for EndTrialUpsell {
Some(
v_flex()
.child(EndTrialUpsell {
plan: Plan::ZedFree,
dismiss_upsell: Arc::new(|_, _| {}),
})
.into_any_element(),
@@ -38,7 +38,7 @@ impl RenderOnce for UsageCallout {
let (title, message, button_text, url) = if is_limit_reached {
match self.plan {
Plan::ZedFree => (
Plan::ZedFree | Plan::ZedFreeV2 => (
"Out of free prompts",
"Upgrade to continue, wait for the next reset, or switch to API key."
.to_string(),