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.

fix(plans): treat trialing subscriptions as active in web plan-guard (#285)

Gökhan Geyike36866295e62
diff --git a/web/src/config/plans.ts b/web/src/config/plans.ts
index 04116c8b0..4f57e5f5d 100644
--- a/web/src/config/plans.ts
+++ b/web/src/config/plans.ts
@@ -222,6 +222,16 @@ export function getPlan(planId: string | null | undefined): Plan {
return PLANS[(planId as PlanId) ?? 'starter'] ?? PLANS.starter;
}
+/**
+ * Whether a Stripe subscription_status entitles the org to its paid plan.
+ * `trialing` counts — it's a paid plan inside its free-trial window — so it must
+ * NOT be downgraded to starter limits. Mirrors the server's isSubscriptionActive
+ * (server/src/config/plans.js); keep the two in sync.
+ */
+export function isSubscriptionActive(status: string | null | undefined): boolean {
+ return status === 'active' || status === 'trialing';
+}
+
export function hasFeature(plan: Plan, feature: Feature): boolean {
return plan.limits.features.includes(feature);
}
diff --git a/web/src/lib/guards/plan-guard.ts b/web/src/lib/guards/plan-guard.ts
index 34cf66a24..52082119b 100644
--- a/web/src/lib/guards/plan-guard.ts
+++ b/web/src/lib/guards/plan-guard.ts
@@ -6,6 +6,7 @@ import {
getPlan,
hasFeature,
isCloud,
+ isSubscriptionActive,
isWithinLimit,
} from '@/config/plans';
@@ -19,7 +20,10 @@ export async function getOrgPlan(organizationId: string): Promise<Plan> {
.eq('id', organizationId)
.single();
- if (data?.subscription_status !== 'active') {
+ // `trialing` is a paid plan in its trial window — treat it as active so
+ // trial customers get their actual plan's limits (seats, brands, prompts…)
+ // instead of being silently dropped to starter.
+ if (!isSubscriptionActive(data?.subscription_status)) {
return getPlan('starter');
}