Skip to content

Conversation

sestinj
Copy link
Contributor

@sestinj sestinj commented Sep 25, 2025

Description

this pr makes language changes necessary for updated billing + makes general improvements to onboarding flows


Summary by cubic

Revamped onboarding to use credits-based billing instead of the free trial. Adds credit status APIs and starter credits UI, updates out-of-credits handling, and removes legacy free-trial flows.

  • New Features

    • Credit status endpoint and client: controlPlane/getCreditStatus → ide/credits with CreditStatus fields.
    • Starter credits UI: new button and hook to view usage, refresh, and go to billing/API keys.
    • Out-of-credits handling in chat: detects zero credits and shows an OutOfCreditsDialog.
    • CLI onboarding now links to settings/billing.
  • Refactors

    • Renamed usesFreeTrialApiKey to usesCreditsBasedApiKey and updated tests.
    • Protocol changes: replaced getFreeTrialStatus; removed getModelsAddOnUpgradeUrl.
    • Removed free-trial components and local storage (FreeTrialButton, progress bar, ModelsAddOnLimitDialog, ftc).
    • Updated onboarding copy and routes; “Upgrade” tab is now “Credits”.

@sestinj sestinj requested a review from a team as a code owner September 25, 2025 03:10
@sestinj sestinj requested review from RomneyDa and removed request for a team September 25, 2025 03:10
@sestinj sestinj marked this pull request as draft September 25, 2025 03:10
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Sep 25, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 27 files

Prompt for AI agents (all 6 issues)

Understand the root cause of the following 6 issues and fix them.


<file name="core/protocol/passThrough.ts">

<violation number="1" location="core/protocol/passThrough.ts:86">
New message type requires corresponding IntelliJ ContinueBrowser update; missing mapping may break webview→core pass-through in IntelliJ.</violation>
</file>

<file name="extensions/cli/src/ui/FreeTrialTransitionUI.tsx">

<violation number="1" location="extensions/cli/src/ui/FreeTrialTransitionUI.tsx:179">
Updated URL to &quot;settings/billing&quot; conflicts with tests expecting &quot;setup-models&quot;; update tests or ensure route mapping to avoid failures.</violation>
</file>

<file name="gui/src/pages/gui/OutOfCreditsDialog.tsx">

<violation number="1" location="gui/src/pages/gui/OutOfCreditsDialog.tsx:22">
Use ideMessenger.request for controlPlane/openUrl and include orgSlug: undefined per project rules to ensure consistent behavior and org scoping.</violation>
</file>

<file name="gui/src/components/StarterCreditsButton.tsx">

<violation number="1" location="gui/src/components/StarterCreditsButton.tsx:59">
Progress bar uses inconsistent currency units (total=50 while values are treated as cents), causing incorrect display and percentage.</violation>
</file>

<file name="gui/src/components/OnboardingCard/components/OnboardingModelsAddOnTab.tsx">

<violation number="1" location="gui/src/components/OnboardingCard/components/OnboardingModelsAddOnTab.tsx:35">
Use ideMessenger.request for controlPlane/openUrl per project rule; replace post with await request to ensure consistency and reliable handling.</violation>

<violation number="2" location="gui/src/components/OnboardingCard/components/OnboardingModelsAddOnTab.tsx:50">
Use ideMessenger.request for controlPlane/openUrl instead of post to follow project rules; keep void to intentionally ignore the promise.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

"controlPlane/getEnvironment",
"controlPlane/getFreeTrialStatus",
"controlPlane/getModelsAddOnUpgradeUrl",
"controlPlane/getCreditStatus",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New message type requires corresponding IntelliJ ContinueBrowser update; missing mapping may break webview→core pass-through in IntelliJ.

Prompt for AI agents
Address the following comment on core/protocol/passThrough.ts at line 86:

<comment>New message type requires corresponding IntelliJ ContinueBrowser update; missing mapping may break webview→core pass-through in IntelliJ.</comment>

<file context>
@@ -83,8 +83,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] =
     &quot;controlPlane/getEnvironment&quot;,
-    &quot;controlPlane/getFreeTrialStatus&quot;,
-    &quot;controlPlane/getModelsAddOnUpgradeUrl&quot;,
+    &quot;controlPlane/getCreditStatus&quot;,
     &quot;controlPlane/openUrl&quot;,
     &quot;isItemTooBig&quot;,
</file context>
Fix with Cubic

// Option 1: Open models setup page
setCurrentStep("processing");
const modelsUrl = new URL("setup-models", env.appUrl).toString();
const modelsUrl = new URL("settings/billing", env.appUrl).toString();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated URL to "settings/billing" conflicts with tests expecting "setup-models"; update tests or ensure route mapping to avoid failures.

Prompt for AI agents
Address the following comment on extensions/cli/src/ui/FreeTrialTransitionUI.tsx at line 179:

<comment>Updated URL to &quot;settings/billing&quot; conflicts with tests expecting &quot;setup-models&quot;; update tests or ensure route mapping to avoid failures.</comment>

<file context>
@@ -176,7 +176,7 @@ const FreeTrialTransitionUI: React.FC&lt;FreeTrialTransitionUIProps&gt; = ({
       // Option 1: Open models setup page
       setCurrentStep(&quot;processing&quot;);
-      const modelsUrl = new URL(&quot;setup-models&quot;, env.appUrl).toString();
+      const modelsUrl = new URL(&quot;settings/billing&quot;, env.appUrl).toString();
       setWasModelsSetup(true); // Track that user went through models setup
 
</file context>
Fix with Cubic

<SecondaryButton
className="flex flex-row items-center gap-2 hover:opacity-70"
onClick={() => {
ideMessenger.post("controlPlane/openUrl", {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ideMessenger.request for controlPlane/openUrl and include orgSlug: undefined per project rules to ensure consistent behavior and org scoping.

Prompt for AI agents
Address the following comment on gui/src/pages/gui/OutOfCreditsDialog.tsx at line 22:

<comment>Use ideMessenger.request for controlPlane/openUrl and include orgSlug: undefined per project rules to ensure consistent behavior and org scoping.</comment>

<file context>
@@ -0,0 +1,34 @@
+          &lt;SecondaryButton
+            className=&quot;flex flex-row items-center gap-2 hover:opacity-70&quot;
+            onClick={() =&gt; {
+              ideMessenger.post(&quot;controlPlane/openUrl&quot;, {
+                path: &quot;/settings/billing&quot;,
+              });
</file context>
Fix with Cubic

<ProgressBar
label="Starter credits usage"
current={creditStatus.creditBalance ?? 0}
total={50}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Progress bar uses inconsistent currency units (total=50 while values are treated as cents), causing incorrect display and percentage.

Prompt for AI agents
Address the following comment on gui/src/components/StarterCreditsButton.tsx at line 59:

<comment>Progress bar uses inconsistent currency units (total=50 while values are treated as cents), causing incorrect display and percentage.</comment>

<file context>
@@ -0,0 +1,211 @@
+    &lt;ProgressBar
+      label=&quot;Starter credits usage&quot;
+      current={creditStatus.creditBalance ?? 0}
+      total={50}
+    /&gt;
+  );
</file context>
Fix with Cubic

}

function openPricingPage() {
void ideMessenger.post("controlPlane/openUrl", {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ideMessenger.request for controlPlane/openUrl instead of post to follow project rules; keep void to intentionally ignore the promise.

Prompt for AI agents
Address the following comment on gui/src/components/OnboardingCard/components/OnboardingModelsAddOnTab.tsx at line 50:

<comment>Use ideMessenger.request for controlPlane/openUrl instead of post to follow project rules; keep void to intentionally ignore the promise.</comment>

<file context>
@@ -63,6 +46,12 @@ export function OnboardingModelsAddOnTab() {
   }
 
+  function openPricingPage() {
+    void ideMessenger.post(&quot;controlPlane/openUrl&quot;, {
+      path: &quot;pricing&quot;,
+    });
</file context>
Suggested change
void ideMessenger.post("controlPlane/openUrl", {
void ideMessenger.request("controlPlane/openUrl", {
Fix with Cubic

console.error("Failed to get upgrade URL");
openPricingPage();
}
ideMessenger.post("controlPlane/openUrl", {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ideMessenger.request for controlPlane/openUrl per project rule; replace post with await request to ensure consistency and reliable handling.

Prompt for AI agents
Address the following comment on gui/src/components/OnboardingCard/components/OnboardingModelsAddOnTab.tsx at line 35:

<comment>Use ideMessenger.request for controlPlane/openUrl per project rule; replace post with await request to ensure consistency and reliable handling.</comment>

<file context>
@@ -30,30 +30,13 @@ export function OnboardingModelsAddOnTab() {
-        console.error(&quot;Failed to get upgrade URL&quot;);
-        openPricingPage();
-      }
+      ideMessenger.post(&quot;controlPlane/openUrl&quot;, {
+        path: &quot;settings/billing&quot;,
+      });
</file context>
Suggested change
ideMessenger.post("controlPlane/openUrl", {
await ideMessenger.request("controlPlane/openUrl", {
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant