Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(billing): withhold the personal Pro checkout from workspace-covered members (#1582)

Gabriel Stein35eaa96d0f29
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index c3cc39f68..fb1bb2c5f 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -113,6 +113,7 @@ import {
} from "../stores/settingsStore";
import { useWorkspaceStore } from "../stores/workspaceStore";
import { highestPlan } from "../lib/usageStore";
+import { decideProPlanCardCta } from "../lib/upsell";
import {
canChangeCloudBackupPreference,
effectiveAudioRetentionDays,
@@ -1405,6 +1406,14 @@ export default function SettingsPage({
// Signed out there is nothing to load and the plan grid is purely
// promotional; signed in, no card may claim a plan until usage confirms one.
const planStateKnown = !isSignedIn || usage?.status === "success";
+ const proCardCta = decideProPlanCardCta({
+ isSignedIn,
+ planStateKnown,
+ isPersonallySubscribed: usage?.isPersonallySubscribed ?? false,
+ plan: usage?.plan ?? "free",
+ isTrial: usage?.isTrial ?? false,
+ isWorkspaceCovered,
+ });
const [isSigningOut, setIsSigningOut] = useState(false);
const [isDeletingAccount, setIsDeletingAccount] = useState(false);
const { openBillingPortal, isOpening: isOpeningBilling } = useBillingPortal(usage);
@@ -2209,16 +2218,13 @@ export default function SettingsPage({
</li>
))}
</ul>
- {(usage?.isPersonallySubscribed &&
- usage?.plan === "pro" &&
- !usage?.isTrial) ||
- usage?.isTrial ? (
+ {proCardCta === "currentPlan" ? (
<div className="mt-2 text-center">
<span className="text-[9px] font-medium text-primary">
{t("settingsPage.account.pricing.currentPlan")}
</span>
</div>
- ) : usage?.isPersonallySubscribed && usage?.plan === "business" ? (
+ ) : proCardCta === "downgradeToPro" ? (
<Button
onClick={() =>
handleSwitchPlan(billingState.pro ? "annual" : "monthly", "pro")
@@ -2234,7 +2240,21 @@ export default function SettingsPage({
t("settingsPage.account.pricing.downgrade")
)}
</Button>
- ) : planStateKnown ? (
+ ) : proCardCta === "signUp" ? (
+ <Button
+ onClick={startOnboarding}
+ size="sm"
+ className="mt-2 w-full h-6 text-[10px]"
+ >
+ {t("settingsPage.account.pricing.pro.cta")}
+ </Button>
+ ) : proCardCta === "coveredByWorkspace" ? (
+ <div className="mt-2 text-center">
+ <span className="text-[9px] font-medium text-primary">
+ {t("settingsPage.account.pricing.coveredByWorkspace")}
+ </span>
+ </div>
+ ) : proCardCta === "checkout" ? (
<Button
onClick={() =>
handleCheckout(billingState.pro ? "annual" : "monthly", "pro")
diff --git a/src/lib/upsell.ts b/src/lib/upsell.ts
index 7545eb9f4..b2456fdf9 100644
--- a/src/lib/upsell.ts
+++ b/src/lib/upsell.ts
@@ -22,3 +22,27 @@ export function decideUpsell({
if (isPastDue || hasPaidAccess) return "hide";
return "show";
}
+
+export type ProPlanCardCta =
+ "currentPlan" | "downgradeToPro" | "coveredByWorkspace" | "checkout" | "signUp" | "none";
+
+export interface ProPlanCardInput {
+ isSignedIn: boolean;
+ /** Signed out, or usage.status === "success". */
+ planStateKnown: boolean;
+ isPersonallySubscribed: boolean;
+ plan: string;
+ isTrial: boolean;
+ /** SettingsPage's usage-payload predicate — not the workspace store. */
+ isWorkspaceCovered: boolean;
+}
+
+export function decideProPlanCardCta(i: ProPlanCardInput): ProPlanCardCta {
+ if ((i.isPersonallySubscribed && i.plan === "pro" && !i.isTrial) || i.isTrial)
+ return "currentPlan";
+ if (i.isPersonallySubscribed && i.plan === "business") return "downgradeToPro";
+ if (!i.isSignedIn) return "signUp";
+ if (!i.planStateKnown) return "none"; // fail-closed while entitlement unknown
+ if (i.isWorkspaceCovered) return "coveredByWorkspace"; // the regression fix
+ return "checkout";
+}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index ead3862eb..54f1cc124 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -1592,6 +1592,7 @@
"cta": "Vertrieb kontaktieren"
},
"currentPlan": "Aktueller Tarif",
+ "coveredByWorkspace": "In Ihrem Workspace-Tarif enthalten",
"upgrade": "Upgrade",
"downgrade": "Downgrade",
"planSwitched": "Plan erfolgreich aktualisiert",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 4a11df925..0b5f1cef4 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -1592,6 +1592,7 @@
"cta": "Contact Sales"
},
"currentPlan": "Current plan",
+ "coveredByWorkspace": "Included with your workspace plan",
"upgrade": "Upgrade",
"downgrade": "Downgrade",
"planSwitched": "Plan updated successfully",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 33387bfbc..1fabefafe 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -1354,6 +1354,7 @@
"cta": "Contactar a ventas"
},
"currentPlan": "Plan actual",
+ "coveredByWorkspace": "Incluido en tu plan de espacio de trabajo",
"upgrade": "Mejorar plan",
"downgrade": "Reducir plan",
"planSwitched": "Plan actualizado correctamente",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index cb2f9ca9a..d24b4b2f0 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -1592,6 +1592,7 @@
"cta": "Contacter les ventes"
},
"currentPlan": "Forfait actuel",
+ "coveredByWorkspace": "Inclus dans votre plan d'espace de travail",
"upgrade": "Passer au supérieur",
"downgrade": "Rétrograder",
"planSwitched": "Forfait mis à jour avec succès",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index ef3055e2a..b73c0b858 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -1326,6 +1326,7 @@
"cta": "Contatta le vendite"
},
"currentPlan": "Piano attuale",
+ "coveredByWorkspace": "Incluso nel piano della tua area di lavoro",
"upgrade": "Upgrade",
"downgrade": "Downgrade",
"planSwitched": "Piano aggiornato con successo",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 71cf64107..9a240fe58 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -1306,6 +1306,7 @@
"cta": "営業に問い合わせる"
},
"currentPlan": "現在のプラン",
+ "coveredByWorkspace": "ワークスペースのプランに含まれています",
"upgrade": "アップグレード",
"downgrade": "ダウングレード",
"planSwitched": "プランが正常に更新されました",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index b6a2b0bc6..def7b2994 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -1305,6 +1305,7 @@
"cta": "Falar com Vendas"
},
"currentPlan": "Plano atual",
+ "coveredByWorkspace": "Incluído no plano do seu workspace",
"upgrade": "Fazer upgrade",
"downgrade": "Fazer downgrade",
"planSwitched": "Plano atualizado com sucesso",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 66cd36c24..62285795c 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -1330,6 +1330,7 @@
"cta": "Связаться с отделом продаж"
},
"currentPlan": "Текущий тариф",
+ "coveredByWorkspace": "Включено в тариф вашего рабочего пространства",
"upgrade": "Улучшить план",
"downgrade": "Понизить план",
"planSwitched": "План успешно обновлён",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index d82a3aaa8..d55c98853 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -1326,6 +1326,7 @@
"cta": "联系销售"
},
"currentPlan": "当前套餐",
+ "coveredByWorkspace": "已包含在您的工作区套餐中",
"upgrade": "升级",
"downgrade": "降级",
"planSwitched": "套餐已成功更新",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index ae51d1874..45e6f5953 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -1326,6 +1326,7 @@
"cta": "聯繫銷售"
},
"currentPlan": "目前方案",
+ "coveredByWorkspace": "已包含在您的工作區方案中",
"upgrade": "升級",
"downgrade": "降級",
"planSwitched": "方案已成功更新",
diff --git a/test/lib/upsell.test.js b/test/lib/upsell.test.js
index 163c291db..82402f7b0 100644
--- a/test/lib/upsell.test.js
+++ b/test/lib/upsell.test.js
@@ -1,7 +1,7 @@
const test = require("node:test");
const assert = require("node:assert/strict");
-const { decideUpsell } = require("../../src/lib/upsell.ts");
+const { decideUpsell, decideProPlanCardCta } = require("../../src/lib/upsell.ts");
test("the upgrade CTA survives sign-out and is withheld while entitlement is unknown", () => {
const decide = (overrides) =>
@@ -20,3 +20,89 @@ test("the upgrade CTA survives sign-out and is withheld while entitlement is unk
assert.equal(decide({ isPastDue: true }), "hide");
assert.equal(decide({}), "show");
});
+
+test("a workspace-covered member is never offered a personal Pro checkout", () => {
+ const decide = (o) =>
+ decideProPlanCardCta({
+ isSignedIn: true,
+ planStateKnown: true,
+ isPersonallySubscribed: false,
+ plan: "free",
+ isTrial: false,
+ isWorkspaceCovered: false,
+ ...o,
+ });
+ // THE regression (customer bought Business + a 2-seat workspace 66s apart):
+ assert.equal(decide({ isWorkspaceCovered: true }), "coveredByWorkspace");
+ // coverage lapse mid-session: refreshed usage drops the workspace ids
+ assert.equal(decide({}), "checkout");
+});
+
+test("a personal subscription keeps its manage and switch paths (double-payer)", () => {
+ // personally subscribed pro — even if a workspace also covers them
+ assert.equal(
+ decideProPlanCardCta({
+ isSignedIn: true,
+ planStateKnown: true,
+ isPersonallySubscribed: true,
+ plan: "pro",
+ isTrial: false,
+ isWorkspaceCovered: false,
+ }),
+ "currentPlan"
+ );
+ // personally subscribed business keeps the downgrade-to-pro switch
+ assert.equal(
+ decideProPlanCardCta({
+ isSignedIn: true,
+ planStateKnown: true,
+ isPersonallySubscribed: true,
+ plan: "business",
+ isTrial: false,
+ isWorkspaceCovered: false,
+ }),
+ "downgradeToPro"
+ );
+});
+
+test("no checkout renders while the entitlement is unknown", () => {
+ assert.equal(
+ decideProPlanCardCta({
+ isSignedIn: true,
+ planStateKnown: false,
+ isPersonallySubscribed: false,
+ plan: "free",
+ isTrial: false,
+ isWorkspaceCovered: false,
+ }),
+ "none"
+ );
+});
+
+test("trial reads as the current plan, not an upsell target", () => {
+ assert.equal(
+ decideProPlanCardCta({
+ isSignedIn: true,
+ planStateKnown: true,
+ isPersonallySubscribed: false,
+ plan: "free",
+ isTrial: true,
+ isWorkspaceCovered: false,
+ }),
+ "currentPlan"
+ );
+});
+
+test("a signed-out user is routed to onboarding, not a checkout", () => {
+ assert.equal(
+ decideProPlanCardCta({
+ isSignedIn: false,
+ planStateKnown: true,
+ isPersonallySubscribed: false,
+ plan: "free",
+ isTrial: false,
+ isWorkspaceCovered: false,
+ }),
+ "signUp"
+ );
+});