Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

feat(prompts): give Starter a $1 trial of Improve, with an upgrade once it's spent (#1296)

Cihan93f336573935
diff --git a/server/src/config/plans.js b/server/src/config/plans.js
index 7eb3bdc10..bee236b63 100644
--- a/server/src/config/plans.js
+++ b/server/src/config/plans.js
@@ -52,7 +52,10 @@ export const PLANS = {
maxDomainsPerBrand: 3,
maxVolumeAnalyses: 4,
maxBriefGenerations: 10,
- improveMonthlyBudgetUsd: 0,
+ // A $1 trial of Improve, not 1% of the $49 price: enough for a few
+ // generations a month, so Starter can see what it does (Growth+ was
+ // PROMPT-003's call). Shared with the Content Editor's AI later.
+ improveMonthlyBudgetUsd: 1,
// 0.1% of the $49 price, spent rating suggestions' relevance (VIS-011).
relevanceMonthlyBudgetUsd: 0.049,
maxOpportunitiesPerMonth: 10,
@@ -81,6 +84,7 @@ export const PLANS = {
'custom_reports',
'api_access',
'ai_agent',
+ 'prompt_improve',
],
},
},
diff --git a/server/src/lib/prompt-improve.test.js b/server/src/lib/prompt-improve.test.js
index 369b2503e..b0b306182 100644
--- a/server/src/lib/prompt-improve.test.js
+++ b/server/src/lib/prompt-improve.test.js
@@ -311,11 +311,10 @@ describe('improveRangeKey', () => {
});
describe('Improve plan limits', () => {
- it('is a Growth+ feature with a budget of 1% of the plan price', async () => {
+ it('is on every plan: a $1 trial on Starter, 1% of the plan price above it', async () => {
const { PLANS } = await import('../config/plans.js');
- expect(PLANS.starter.limits.features).not.toContain('prompt_improve');
- expect(PLANS.starter.limits.improveMonthlyBudgetUsd).toBe(0);
- for (const id of ['growth', 'enterprise', 'self_hosted']) {
+ expect(PLANS.starter.limits.improveMonthlyBudgetUsd).toBe(1);
+ for (const id of ['starter', 'growth', 'enterprise', 'self_hosted']) {
expect(PLANS[id].limits.features).toContain('prompt_improve');
}
expect(PLANS.growth.limits.improveMonthlyBudgetUsd).toBe(2.49);
diff --git a/web/messages/en.json b/web/messages/en.json
index 75edc85d3..5c529cae1 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -4267,6 +4267,14 @@
"none": "No prompts are {label} in this range.",
"showAll": "Show all performance",
"order": "Furthest behind first: late or missing on the most AI platforms, then the worse average position."
+ },
+ "improve": {
+ "quota": {
+ "left": "{count, plural, one {About # generation left this month} other {About # generations left this month}}",
+ "percentLeft": "{percent}% of this month's budget left",
+ "usedUp": "This month's suggestion budget is used up. It resets when your subscription renews.",
+ "upgrade": "Upgrade for more"
+ }
}
},
"mentions": {
diff --git a/web/src/components/prompts/prompt-improve-tab.test.tsx b/web/src/components/prompts/prompt-improve-tab.test.tsx
new file mode 100644
index 000000000..3a7c1977f
--- /dev/null
+++ b/web/src/components/prompts/prompt-improve-tab.test.tsx
@@ -0,0 +1,111 @@
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { NextIntlClientProvider } from 'next-intl';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import messages from '../../../messages/en.json';
+import type { PlanId } from '@/config/plans';
+import type { ImproveQuota } from '@/lib/prompt-improve';
+import { ImproveTab, type ImproveController } from './prompt-improve-tab';
+
+vi.mock('@/i18n/navigation', () => ({
+ Link: ({ href, children, ...props }: { href: string; children: React.ReactNode }) => (
+ <a href={href} {...props}>
+ {children}
+ </a>
+ ),
+}));
+
+(
+ globalThis as typeof globalThis & {
+ IS_REACT_ACT_ENVIRONMENT: boolean;
+ }
+).IS_REACT_ACT_ENVIRONMENT = true;
+
+let container: HTMLDivElement;
+let root: Root;
+
+const controller = (quota: ImproveQuota | null, planId: PlanId | null): ImproveController => ({
+ status: 'ready',
+ set: null,
+ quota,
+ planId,
+ drafts: [],
+ setDrafts: vi.fn(),
+ error: null,
+ dirty: false,
+ count: null,
+ generate: vi.fn(),
+ reload: vi.fn(),
+ send: vi.fn(),
+ sending: false,
+});
+
+async function render(quota: ImproveQuota | null, planId: PlanId | null) {
+ await act(async () => {
+ root.render(
+ <NextIntlClientProvider locale="en" messages={messages}>
+ <ImproveTab improve={controller(quota, planId)} />
+ </NextIntlClientProvider>,
+ );
+ });
+}
+
+const generateButton = () =>
+ [...container.querySelectorAll('button')].find((b) =>
+ b.textContent?.includes('Generate suggestions'),
+ )!;
+
+beforeEach(() => {
+ container = document.createElement('div');
+ document.body.appendChild(container);
+ root = createRoot(container);
+});
+
+afterEach(() => {
+ act(() => root.unmount());
+ container.remove();
+});
+
+describe('the Improve tab’s budget', () => {
+ it('says how many generations are left', async () => {
+ await render(
+ { unlimited: false, exhausted: false, generationsLeft: 3, percentLeft: 60 },
+ 'starter',
+ );
+ expect(container.textContent).toContain('About 3 generations left this month');
+ expect(container.querySelector('[title="60% of this month\'s budget left"]')).not.toBeNull();
+ expect(generateButton().disabled).toBe(false);
+ expect(container.querySelector('a[href="/dashboard/settings?tab=billing"]')).toBeNull();
+ });
+
+ it('offers Starter the upgrade once its $1 trial is spent', async () => {
+ await render(
+ { unlimited: false, exhausted: true, generationsLeft: 0, percentLeft: 0 },
+ 'starter',
+ );
+ expect(container.textContent).toContain(
+ "This month's suggestion budget is used up. It resets when your subscription renews.",
+ );
+ const upgrade = container.querySelector('a[href="/dashboard/settings?tab=billing"]')!;
+ expect(upgrade.textContent).toBe('Upgrade for more');
+ expect(generateButton().disabled).toBe(true);
+ });
+
+ it('says when the budget resets on a paid plan, with no upgrade', async () => {
+ await render(
+ { unlimited: false, exhausted: true, generationsLeft: 0, percentLeft: 0 },
+ 'growth',
+ );
+ expect(container.textContent).toContain("This month's suggestion budget is used up.");
+ expect(container.querySelector('a[href="/dashboard/settings?tab=billing"]')).toBeNull();
+ });
+
+ it('says nothing on an unlimited plan', async () => {
+ await render(
+ { unlimited: true, exhausted: false, generationsLeft: null, percentLeft: null },
+ 'self_hosted',
+ );
+ expect(container.textContent).not.toContain('generations left');
+ expect(container.textContent).not.toContain('used up');
+ });
+});
diff --git a/web/src/components/prompts/prompt-improve-tab.tsx b/web/src/components/prompts/prompt-improve-tab.tsx
index 3dc1f1e64..b03bc72f3 100644
--- a/web/src/components/prompts/prompt-improve-tab.tsx
+++ b/web/src/components/prompts/prompt-improve-tab.tsx
@@ -25,6 +25,7 @@ import {
Sparkles,
X,
} from 'lucide-react';
+import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
import { Link } from '@/i18n/navigation';
import { Badge } from '@/components/ui/badge';
@@ -65,6 +66,8 @@ export interface ImproveController {
set: ImproveSet | null;
/** Generations left this period; null while unknown. */
quota: ImproveQuota | null;
+ /** The org's plan: a Starter whose budget is spent is offered an upgrade. */
+ planId: PlanId | null;
drafts: DraftSuggestion[];
setDrafts: React.Dispatch<React.SetStateAction<DraftSuggestion[]>>;
error: string | null;
@@ -128,8 +131,15 @@ export function useImprove({
// failed read lands on the error state, whose Retry reads again: a
// retry should never be a paid call the user didn't ask for.
if (op === 'generate' && result.code !== 'plan_limit') {
- setState((s) => ({ ...s, key: forKey, status: 'ready', error: result.error }));
- if (result.code === 'quota_exceeded') {
+ // A spent budget is said by the quota note, with the way out.
+ const spent = result.code === 'quota_exceeded';
+ setState((s) => ({
+ ...s,
+ key: forKey,
+ status: 'ready',
+ error: spent ? null : result.error,
+ }));
+ if (spent) {
setQuota((q) =>
q ? { ...q, exhausted: true, generationsLeft: 0, percentLeft: 0 } : q,
);
@@ -222,6 +232,7 @@ export function useImprove({
status,
set,
quota,
+ planId,
drafts,
setDrafts,
error: current?.error ?? null,
@@ -238,8 +249,20 @@ export function useImprove({
// ─── Tab ──────────────────────────────────────────────────────────────────────
export function ImproveTab({ improve }: { improve: ImproveController }) {
- const { status, set, quota, drafts, setDrafts, error, dirty, generate, reload, send, sending } =
- improve;
+ const {
+ status,
+ set,
+ quota,
+ planId,
+ drafts,
+ setDrafts,
+ error,
+ dirty,
+ generate,
+ reload,
+ send,
+ sending,
+ } = improve;
const [confirmRegenerate, setConfirmRegenerate] = useState(false);
const outOfQuota = !!quota?.exhausted;
@@ -277,7 +300,7 @@ export function ImproveTab({ improve }: { improve: ImproveController }) {
<Sparkles />
Generate suggestions
</Button>
- <QuotaNote quota={quota} />
+ <QuotaNote quota={quota} planId={planId} />
</div>
</div>
);
@@ -358,7 +381,7 @@ export function ImproveTab({ improve }: { improve: ImproveController }) {
<span className="ml-2 text-muted-foreground/70">
Generated {new Date(set.generatedAt).toLocaleString()}
</span>
- <QuotaNote quota={quota} className="ml-2" />
+ <QuotaNote quota={quota} planId={planId} className="ml-2" />
{sentLatest && (
<span className="mt-1 flex items-center gap-1 text-emerald-700 dark:text-emerald-400">
<CircleCheck className="h-3.5 w-3.5" />
@@ -421,10 +444,22 @@ function friendlyError(error: string | null, fallback = 'Failed to generate sugg
return error || fallback;
}
-/** "About 185 generations left this month"; nothing on unlimited plans. */
-function QuotaNote({ quota, className }: { quota: ImproveQuota | null; className?: string }) {
+/**
+ * "About 185 generations left this month"; nothing on unlimited plans. A
+ * spent budget says when it resets, and offers Starter, on its $1 trial,
+ * the upgrade.
+ */
+function QuotaNote({
+ quota,
+ planId,
+ className,
+}: {
+ quota: ImproveQuota | null;
+ planId: PlanId | null;
+ className?: string;
+}) {
+ const t = useTranslations('prompts.improve.quota');
if (!quota || quota.unlimited) return null;
- const n = quota.generationsLeft ?? 0;
return (
<span
className={cn(
@@ -433,12 +468,21 @@ function QuotaNote({ quota, className }: { quota: ImproveQuota | null; className
className,
)}
title={
- quota.percentLeft !== null ? `${quota.percentLeft}% of this month's budget left` : undefined
+ quota.percentLeft !== null ? t('percentLeft', { percent: quota.percentLeft }) : undefined
}
>
- {quota.exhausted
- ? "This month's suggestion budget is used up. It resets when your subscription renews."
- : `About ${n} generation${n === 1 ? '' : 's'} left this month`}
+ {quota.exhausted ? t('usedUp') : t('left', { count: quota.generationsLeft ?? 0 })}
+ {quota.exhausted && planId === 'starter' && (
+ <>
+ {' '}
+ <Link
+ href="/dashboard/settings?tab=billing"
+ className="font-medium text-foreground underline underline-offset-2"
+ >
+ {t('upgrade')}
+ </Link>
+ </>
+ )}
</span>
);
}
diff --git a/web/src/config/plans.ts b/web/src/config/plans.ts
index 101a33851..79cac11e4 100644
--- a/web/src/config/plans.ts
+++ b/web/src/config/plans.ts
@@ -45,9 +45,9 @@ export interface PlanLimits {
maxBriefGenerations: number;
/**
* Monthly USD budget for Improve-tab model calls (Positions panel,
- * PROMPT-003): 1% of the plan price, enforced on the server from each
- * call's real token cost so it holds whichever model is configured.
- * -1 = unlimited (self-host).
+ * PROMPT-003): 1% of the plan price ($1 on Starter, a trial), enforced on
+ * the server from each call's real token cost so it holds whichever
+ * model is configured. -1 = unlimited (self-host).
*/
improveMonthlyBudgetUsd: number;
/**
@@ -161,7 +161,10 @@ export const PLANS: Record<PlanId, Plan> = {
maxDomainsPerBrand: 3,
maxVolumeAnalyses: 4,
maxBriefGenerations: 10,
- improveMonthlyBudgetUsd: 0,
+ // A $1 trial of Improve, not 1% of the $49 price: enough for a few
+ // generations a month, so Starter can see what it does (Growth+ was
+ // PROMPT-003's call). Shared with the Content Editor's AI later.
+ improveMonthlyBudgetUsd: 1,
// 0.1% of the $49 price, spent rating suggestions' relevance (VIS-011).
relevanceMonthlyBudgetUsd: 0.049,
maxOpportunitiesPerMonth: 10,
@@ -189,6 +192,8 @@ export const PLANS: Record<PlanId, Plan> = {
// longer gates the feature — only "did you paste a key?" does.
// Self-host gets the feature unconditionally via env.
'ai_agent',
+ // Improve on a $1 trial budget (above).
+ 'prompt_improve',
],
},
},