The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
surface getCurrentPlan and upgrade errors in BillingPanel
shanud49c8c5d0005
diff --git a/app/src/components/settings/panels/BillingPanel.test.tsx b/app/src/components/settings/panels/BillingPanel.test.tsxindex 12d5c193d2..fb227360d4 100644--- a/app/src/components/settings/panels/BillingPanel.test.tsx+++ b/app/src/components/settings/panels/BillingPanel.test.tsx@@ -115,4 +115,24 @@ describe('<BillingPanel />', () => {fireEvent.click(screen.getByRole('button', { name: 'Back to settings' }));expect(navigateBack).toHaveBeenCalledTimes(2);});++ it('shows an error message when getCurrentPlan rejects', async () => {+ getCurrentPlanMock.mockRejectedValue(new Error('Network error'));++ render(<BillingPanel />);++ await waitFor(() => expect(screen.getByText('Network error')).toBeInTheDocument());+ });++ it('shows an error message when purchasePlan rejects', async () => {+ purchasePlanMock.mockRejectedValue(new Error('Payment failed'));++ render(<BillingPanel />);+ await waitFor(() => expect(getCurrentPlanMock).toHaveBeenCalledTimes(1));++ const upgradeButtons = screen.getAllByRole('button', { name: 'Upgrade' });+ fireEvent.click(upgradeButtons[0]);++ await waitFor(() => expect(screen.getByText('Payment failed')).toBeInTheDocument());+ });});diff --git a/app/src/components/settings/panels/BillingPanel.tsx b/app/src/components/settings/panels/BillingPanel.tsxindex 58a1d11ba9..7d2ab16657 100644--- a/app/src/components/settings/panels/BillingPanel.tsx+++ b/app/src/components/settings/panels/BillingPanel.tsx@@ -6,6 +6,7 @@ import type { PlanTier } from '../../../types/api';import { BILLING_DASHBOARD_URL } from '../../../utils/links';import { openUrl } from '../../../utils/openUrl';import Button from '../../ui/Button';+import { SettingsStatusLine } from '../controls';import { useSettingsNavigation } from '../hooks/useSettingsNavigation';import SettingsPanel from '../layout/SettingsPanel';import SubscriptionPlans from './billing/SubscriptionPlans';@@ -19,16 +20,18 @@ const BillingPanel = () => {const [paymentMethod, setPaymentMethod] = useState<'card' | 'crypto'>('card');const [isPurchasing, setIsPurchasing] = useState(false);const [purchasingTier, setPurchasingTier] = useState<PlanTier | null>(null);+ const [error, setError] = useState<string | null>(null);const paymentConfirmed = false;useEffect(() => {billingApi.getCurrentPlan().then(data => setCurrentTier(data.plan))- .catch(() => {});+ .catch(err => setError(err instanceof Error ? err.message : String(err)));}, []);const handleUpgrade = async (tier: PlanTier): Promise<void> => {+ setError(null);setIsPurchasing(true);setPurchasingTier(tier);try {@@ -41,8 +44,8 @@ const BillingPanel = () => {await openUrl(session.checkoutUrl);}}- } catch {- // errors surface through the standard error boundary+ } catch (err) {+ setError(err instanceof Error ? err.message : String(err));} finally {setIsPurchasing(false);setPurchasingTier(null);@@ -51,6 +54,7 @@ const BillingPanel = () => {return (<SettingsPanel>+ <SettingsStatusLine saving={false} error={error} savingLabel="" /><SubscriptionPlanscurrentTier={currentTier}billingInterval={billingInterval}