Skip to content

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

feat: add in-app plan switching with proration preview dialog

Gabriel Steinfa77321d1400
diff --git a/preload.js b/preload.js
index 2dca5ca73..91952914e 100644
--- a/preload.js
+++ b/preload.js
@@ -379,6 +379,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
cloudUsage: () => ipcRenderer.invoke("cloud-usage"),
cloudCheckout: (opts) => ipcRenderer.invoke("cloud-checkout", opts),
cloudBillingPortal: () => ipcRenderer.invoke("cloud-billing-portal"),
+ cloudSwitchPlan: (opts) => ipcRenderer.invoke("cloud-switch-plan", opts),
+ cloudPreviewSwitch: (opts) => ipcRenderer.invoke("cloud-preview-switch", opts),
getSttConfig: () => ipcRenderer.invoke("get-stt-config"),
// Cloud audio file transcription
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index e8dd67710..9178d5bc7 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -42,6 +42,7 @@ import {
DialogHeader,
DialogTitle,
DialogDescription,
+ DialogFooter,
} from "./ui/dialog";
import { Alert, AlertTitle, AlertDescription } from "./ui/alert";
import { useSettings } from "../hooks/useSettings";
@@ -77,6 +78,9 @@ import { cn } from "./lib/utils";
import { startMigration, useMigration } from "../stores/noteStore.js";
import { formatBytes } from "../utils/formatBytes";
+const formatAmount = (cents: number, currency: string) =>
+ (cents / 100).toLocaleString(undefined, { style: "currency", currency });
+
export type SettingsSectionType =
| "account"
| "plansBilling"
@@ -1034,6 +1038,16 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
pro: true,
business: true,
});
+ const [switchPreview, setSwitchPreview] = useState<{
+ plan: "monthly" | "annual";
+ tier: "pro" | "business";
+ immediateAmount: number;
+ currency: string;
+ newPriceAmount: number;
+ newInterval: string;
+ nextBillingDate: string | null;
+ } | null>(null);
+ const [previewLoading, setPreviewLoading] = useState(false);
const startOnboarding = useCallback(() => {
localStorage.setItem("pendingCloudMigration", "true");
@@ -1042,6 +1056,77 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
window.location.reload();
}, []);
+ const handleBillingPortal = useCallback(async () => {
+ const result = await usage.openBillingPortal();
+ if (!result.success) {
+ toast({
+ title: t("settingsPage.account.checkout.couldNotOpenTitle"),
+ description: t("settingsPage.account.checkout.couldNotOpenDescription"),
+ });
+ }
+ }, [usage, toast, t]);
+
+ const handleSwitchPlan = useCallback(
+ async (plan: "monthly" | "annual", tier: "pro" | "business") => {
+ setPreviewLoading(true);
+ try {
+ const preview = await usage.previewSwitchPlan({ plan, tier });
+ if (!preview.success) {
+ toast({
+ title: t("settingsPage.account.checkout.couldNotOpenTitle"),
+ description:
+ preview.error || t("settingsPage.account.checkout.couldNotOpenDescription"),
+ });
+ return;
+ }
+ if (preview.alreadyOnPlan) {
+ toast({ title: t("settingsPage.account.pricing.planSwitched") });
+ return;
+ }
+ setSwitchPreview({
+ plan,
+ tier,
+ immediateAmount: preview.immediateAmount ?? 0,
+ currency: preview.currency ?? "usd",
+ newPriceAmount: preview.newPriceAmount ?? 0,
+ newInterval: preview.newInterval ?? "month",
+ nextBillingDate: preview.nextBillingDate ?? null,
+ });
+ } finally {
+ setPreviewLoading(false);
+ }
+ },
+ [usage, toast, t]
+ );
+
+ const confirmSwitchPlan = useCallback(async () => {
+ if (!switchPreview) return;
+ const { plan, tier } = switchPreview;
+ setSwitchPreview(null);
+ const result = await usage.switchPlan({ plan, tier });
+ if (result.success) {
+ toast({ title: t("settingsPage.account.pricing.planSwitched") });
+ } else {
+ toast({
+ title: t("settingsPage.account.checkout.couldNotOpenTitle"),
+ description: result.error || t("settingsPage.account.checkout.couldNotOpenDescription"),
+ });
+ }
+ }, [switchPreview, usage, toast, t]);
+
+ const handleCheckout = useCallback(
+ async (plan: "monthly" | "annual", tier: "pro" | "business") => {
+ const result = await usage.openCheckout({ plan, tier });
+ if (!result.success) {
+ toast({
+ title: t("settingsPage.account.checkout.couldNotOpenTitle"),
+ description: t("settingsPage.account.checkout.couldNotOpenDescription"),
+ });
+ }
+ },
+ [usage, toast, t]
+ );
+
const handleSignOut = useCallback(async () => {
setIsSigningOut(true);
try {
@@ -1236,13 +1321,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
</li>
))}
</ul>
- {isSignedIn && !usage?.isSubscribed && !usage?.isTrial ? (
- <div className="mt-2 text-center">
- <span className="text-[9px] font-medium text-primary/70">
- {t("settingsPage.account.pricing.currentPlan")}
- </span>
- </div>
- ) : !isSignedIn ? (
+ {!isSignedIn ? (
<Button
onClick={startOnboarding}
variant="outline"
@@ -1251,7 +1330,22 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
>
{t("settingsPage.account.signedOutPlans.button")}
</Button>
- ) : null}
+ ) : usage?.isSubscribed && !usage?.isTrial ? (
+ <Button
+ onClick={handleBillingPortal}
+ variant="outline"
+ size="sm"
+ className="mt-2 w-full h-6 text-[10px]"
+ >
+ {t("settingsPage.account.pricing.downgrade")}
+ </Button>
+ ) : (
+ <div className="mt-2 text-center">
+ <span className="text-[9px] font-medium text-primary/70">
+ {t("settingsPage.account.pricing.currentPlan")}
+ </span>
+ </div>
+ )}
</div>
{/* Pro */}
@@ -1267,15 +1361,21 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
{t("settingsPage.account.pricing.pro.name")}
</p>
<button
- onClick={() => setBillingState(prev => ({ ...prev, pro: !prev.pro }))}
+ onClick={() => setBillingState((prev) => ({ ...prev, pro: !prev.pro }))}
role="switch"
aria-checked={billingState.pro}
className="flex items-center gap-1.5 mt-1"
>
- <div className={`relative w-7 h-4 rounded-full transition-colors ${billingState.pro ? "bg-primary" : "bg-muted"}`}>
- <div className={`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${billingState.pro ? "translate-x-3" : ""}`} />
+ <div
+ className={`relative w-7 h-4 rounded-full transition-colors ${billingState.pro ? "bg-primary" : "bg-muted"}`}
+ >
+ <div
+ className={`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${billingState.pro ? "translate-x-3" : ""}`}
+ />
</div>
- <span className="text-[9px] text-muted-foreground">{t("settingsPage.account.pricing.billedYearly")}</span>
+ <span className="text-[9px] text-muted-foreground">
+ {t("settingsPage.account.pricing.billedYearly")}
+ </span>
</button>
<div className="flex items-baseline gap-0.5 mt-1">
<span className="text-lg font-bold text-foreground">
@@ -1305,24 +1405,35 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
</li>
))}
</ul>
- {(usage?.isSubscribed && usage?.plan === "pro" && !usage?.isTrial) || usage?.isTrial ? (
+ {(usage?.isSubscribed && usage?.plan === "pro" && !usage?.isTrial) ||
+ usage?.isTrial ? (
<div className="mt-2 text-center">
<span className="text-[9px] font-medium text-primary">
{t("settingsPage.account.pricing.currentPlan")}
</span>
</div>
+ ) : usage?.isSubscribed && usage?.plan === "business" ? (
+ <Button
+ onClick={() =>
+ handleSwitchPlan(billingState.pro ? "annual" : "monthly", "pro")
+ }
+ disabled={previewLoading || usage.checkoutLoading}
+ variant="outline"
+ size="sm"
+ className="mt-2 w-full h-6 text-[10px]"
+ >
+ {previewLoading ? (
+ <Loader2 size={10} className="animate-spin" />
+ ) : (
+ t("settingsPage.account.pricing.downgrade")
+ )}
+ </Button>
) : (
<Button
- onClick={async () => {
- const result = await usage.openCheckout({ plan: billingState.pro ? "annual" : "monthly", tier: "pro" });
- if (!result.success) {
- toast({
- title: t("settingsPage.account.checkout.couldNotOpenTitle"),
- description: t("settingsPage.account.checkout.couldNotOpenDescription"),
- });
- }
- }}
- disabled={usage.checkoutLoading}
+ onClick={() =>
+ handleCheckout(billingState.pro ? "annual" : "monthly", "pro")
+ }
+ disabled={usage?.checkoutLoading}
size="sm"
className="mt-2 w-full h-6 text-[10px]"
>
@@ -1331,7 +1442,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
)}
</div>
- {/* Business (featured) */}
+ {/* Business */}
<div className="rounded-md border-2 border-primary/50 bg-primary/8 dark:border-primary/40 dark:bg-primary/10 p-2.5 flex flex-col relative">
<span className="absolute -top-2.5 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground text-[8px] font-semibold px-2.5 py-0.5 rounded-full whitespace-nowrap shadow-sm">
{t("settingsPage.account.pricing.business.badge")}
@@ -1340,15 +1451,23 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
{t("settingsPage.account.pricing.business.name")}
</p>
<button
- onClick={() => setBillingState(prev => ({ ...prev, business: !prev.business }))}
+ onClick={() =>
+ setBillingState((prev) => ({ ...prev, business: !prev.business }))
+ }
role="switch"
aria-checked={billingState.business}
className="flex items-center gap-1.5 mt-1"
>
- <div className={`relative w-7 h-4 rounded-full transition-colors ${billingState.business ? "bg-primary" : "bg-muted"}`}>
- <div className={`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${billingState.business ? "translate-x-3" : ""}`} />
+ <div
+ className={`relative w-7 h-4 rounded-full transition-colors ${billingState.business ? "bg-primary" : "bg-muted"}`}
+ >
+ <div
+ className={`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${billingState.business ? "translate-x-3" : ""}`}
+ />
</div>
- <span className="text-[9px] text-muted-foreground">{t("settingsPage.account.pricing.billedYearly")}</span>
+ <span className="text-[9px] text-muted-foreground">
+ {t("settingsPage.account.pricing.billedYearly")}
+ </span>
</button>
<div className="flex items-baseline gap-0.5 mt-1">
<span className="text-lg font-bold text-foreground">
@@ -1384,18 +1503,27 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
{t("settingsPage.account.pricing.currentPlan")}
</span>
</div>
+ ) : usage?.isSubscribed && usage?.plan === "pro" && !usage?.isTrial ? (
+ <Button
+ onClick={() =>
+ handleSwitchPlan(billingState.business ? "annual" : "monthly", "business")
+ }
+ disabled={previewLoading || usage.checkoutLoading}
+ size="sm"
+ className="mt-2 w-full h-6 text-[10px]"
+ >
+ {previewLoading ? (
+ <Loader2 size={10} className="animate-spin" />
+ ) : (
+ t("settingsPage.account.pricing.upgrade")
+ )}
+ </Button>
) : (
<Button
- onClick={async () => {
- const result = await usage.openCheckout({ plan: billingState.business ? "annual" : "monthly", tier: "business" });
- if (!result.success) {
- toast({
- title: t("settingsPage.account.checkout.couldNotOpenTitle"),
- description: t("settingsPage.account.checkout.couldNotOpenDescription"),
- });
- }
- }}
- disabled={usage.checkoutLoading}
+ onClick={() =>
+ handleCheckout(billingState.business ? "annual" : "monthly", "business")
+ }
+ disabled={usage?.checkoutLoading}
size="sm"
className="mt-2 w-full h-6 text-[10px]"
>
@@ -1452,6 +1580,92 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
</div>
</div>
+ <Dialog
+ open={!!switchPreview}
+ onOpenChange={(open) => !open && setSwitchPreview(null)}
+ >
+ <DialogContent className="sm:max-w-[360px]">
+ <DialogHeader>
+ <DialogTitle>
+ {t("settingsPage.account.pricing.confirmSwitch.title")}
+ </DialogTitle>
+ <DialogDescription>
+ {switchPreview &&
+ t("settingsPage.account.pricing.confirmSwitch.description", {
+ plan: switchPreview.tier === "pro" ? "Pro" : "Business",
+ interval:
+ switchPreview.plan === "annual"
+ ? t("settingsPage.account.pricing.confirmSwitch.yearly")
+ : t("settingsPage.account.pricing.confirmSwitch.monthly"),
+ })}
+ </DialogDescription>
+ </DialogHeader>
+ {switchPreview && (
+ <div className="rounded-lg border border-border/50 dark:border-border-subtle/60 overflow-hidden">
+ <div className="flex justify-between items-center px-3 py-2.5 bg-muted/40 dark:bg-surface-2/50">
+ <span className="text-xs text-muted-foreground">
+ {switchPreview.immediateAmount < 0
+ ? t("settingsPage.account.pricing.confirmSwitch.accountCredit")
+ : t("settingsPage.account.pricing.confirmSwitch.chargeToday")}
+ </span>
+ <span
+ className={cn(
+ "text-sm font-semibold",
+ switchPreview.immediateAmount < 0
+ ? "text-emerald-600 dark:text-emerald-400"
+ : "text-foreground"
+ )}
+ >
+ {formatAmount(
+ Math.abs(switchPreview.immediateAmount),
+ switchPreview.currency
+ )}
+ </span>
+ </div>
+ <div className="divide-y divide-border/40">
+ <div className="flex justify-between items-center px-3 py-2">
+ <span className="text-xs text-muted-foreground">
+ {t("settingsPage.account.pricing.confirmSwitch.newPrice")}
+ </span>
+ <span className="text-xs font-medium text-foreground">
+ {formatAmount(switchPreview.newPriceAmount, switchPreview.currency)}/
+ {switchPreview.newInterval === "year"
+ ? t("settingsPage.account.pricing.confirmSwitch.yr")
+ : t("settingsPage.account.pricing.confirmSwitch.mo")}
+ </span>
+ </div>
+ {switchPreview.nextBillingDate && (
+ <div className="flex justify-between items-center px-3 py-2">
+ <span className="text-xs text-muted-foreground">
+ {t("settingsPage.account.pricing.confirmSwitch.nextBilling")}
+ </span>
+ <span className="text-xs font-medium text-foreground">
+ {new Date(switchPreview.nextBillingDate).toLocaleDateString()}
+ </span>
+ </div>
+ )}
+ </div>
+ </div>
+ )}
+ <DialogFooter>
+ <Button variant="outline" size="sm" onClick={() => setSwitchPreview(null)}>
+ {t("settingsPage.account.pricing.confirmSwitch.cancel")}
+ </Button>
+ <Button
+ size="sm"
+ onClick={confirmSwitchPlan}
+ disabled={usage?.checkoutLoading}
+ >
+ {usage?.checkoutLoading ? (
+ <Loader2 size={14} className="animate-spin" />
+ ) : (
+ t("settingsPage.account.pricing.confirmSwitch.confirm")
+ )}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+
{isSignedIn ? (
<>
<SectionHeader title={t("settingsPage.account.planTitle")} />
@@ -1646,7 +1860,10 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
) : (
<Button
onClick={async () => {
- const result = await usage.openCheckout({ plan: billingState.pro ? "annual" : "monthly", tier: "pro" });
+ const result = await usage.openCheckout({
+ plan: billingState.pro ? "annual" : "monthly",
+ tier: "pro",
+ });
if (!result.success) {
toast({
title: t("settingsPage.account.checkout.couldNotOpenTitle"),
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 3ec23d528..67d99cbb2 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -993,7 +993,10 @@ class IPCHandlers {
await this.whisperManager.stopServer().catch(() => {});
return { success: true };
} catch (error) {
- debugLogger.error("CUDA binary download failed", { error: error.message, stack: error.stack });
+ debugLogger.error("CUDA binary download failed", {
+ error: error.message,
+ stack: error.stack,
+ });
return { success: false, error: error.message };
}
});
@@ -1791,7 +1794,10 @@ class IPCHandlers {
return result;
} catch (error) {
- debugLogger.error("Vulkan binary download failed", { error: error.message, stack: error.stack });
+ debugLogger.error("Vulkan binary download failed", {
+ error: error.message,
+ stack: error.stack,
+ });
return { success: false, error: error.message };
}
});
@@ -2689,18 +2695,71 @@ class IPCHandlers {
};
ipcMain.handle("cloud-checkout", (event, opts) =>
- fetchStripeUrl(
- event,
- "/api/stripe/checkout",
- "Cloud checkout error",
- opts || undefined
- )
+ fetchStripeUrl(event, "/api/stripe/checkout", "Cloud checkout error", opts || undefined)
);
ipcMain.handle("cloud-billing-portal", (event) =>
fetchStripeUrl(event, "/api/stripe/portal", "Cloud billing portal error")
);
+ ipcMain.handle("cloud-switch-plan", async (event, opts) => {
+ try {
+ const apiUrl = getApiUrl();
+ if (!apiUrl) throw new Error("OpenWhispr API URL not configured");
+
+ const cookieHeader = await getSessionCookies(event);
+ if (!cookieHeader) throw new Error("No session cookies available");
+
+ const response = await fetch(`${apiUrl}/api/stripe/switch-plan`, {
+ method: "POST",
+ headers: { Cookie: cookieHeader, "Content-Type": "application/json" },
+ body: JSON.stringify(opts),
+ });
+
+ if (response.status === 401) {
+ return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };
+ }
+
+ const data = await response.json();
+ if (!response.ok) {
+ return { success: false, error: data.error || "Failed to switch plan" };
+ }
+ return data;
+ } catch (error) {
+ debugLogger.error(`Cloud switch plan error: ${error.message}`);
+ return { success: false, error: error.message };
+ }
+ });
+
+ ipcMain.handle("cloud-preview-switch", async (event, opts) => {
+ try {
+ const apiUrl = getApiUrl();
+ if (!apiUrl) throw new Error("OpenWhispr API URL not configured");
+
+ const cookieHeader = await getSessionCookies(event);
+ if (!cookieHeader) throw new Error("No session cookies available");
+
+ const response = await fetch(`${apiUrl}/api/stripe/preview-switch`, {
+ method: "POST",
+ headers: { Cookie: cookieHeader, "Content-Type": "application/json" },
+ body: JSON.stringify(opts),
+ });
+
+ if (response.status === 401) {
+ return { success: false, error: "Session expired", code: "AUTH_EXPIRED" };
+ }
+
+ const data = await response.json();
+ if (!response.ok) {
+ return { success: false, error: data.error || "Failed to preview plan change" };
+ }
+ return { success: true, ...data };
+ } catch (error) {
+ debugLogger.error(`Cloud preview switch error: ${error.message}`);
+ return { success: false, error: error.message };
+ }
+ });
+
ipcMain.handle("get-stt-config", async (event) => {
try {
const apiUrl = getApiUrl();
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index 786eaa0bd..f64df9acc 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -962,6 +962,7 @@ class WindowManager {
this.notificationWindow.showInactive();
}
};
+
if (this.notificationWindow.webContents.isLoading()) {
this.notificationWindow.webContents.once("did-finish-load", sendAndShow);
} else {
diff --git a/src/hooks/useUsage.ts b/src/hooks/useUsage.ts
index 19b90656a..66c51b49b 100644
--- a/src/hooks/useUsage.ts
+++ b/src/hooks/useUsage.ts
@@ -37,8 +37,27 @@ interface UseUsageResult {
error: string | null;
checkoutLoading: boolean;
refetch: () => Promise<void>;
- openCheckout: (opts?: { plan?: "monthly" | "annual"; tier?: "pro" | "business" }) => Promise<{ success: boolean; error?: string }>;
+ openCheckout: (opts?: {
+ plan?: "monthly" | "annual";
+ tier?: "pro" | "business";
+ }) => Promise<{ success: boolean; error?: string }>;
openBillingPortal: () => Promise<{ success: boolean; error?: string }>;
+ switchPlan: (opts: {
+ plan: "monthly" | "annual";
+ tier: "pro" | "business";
+ }) => Promise<{ success: boolean; alreadyOnPlan?: boolean; error?: string }>;
+ previewSwitchPlan: (opts: { plan: "monthly" | "annual"; tier: "pro" | "business" }) => Promise<{
+ success: boolean;
+ immediateAmount?: number;
+ currency?: string;
+ currentPriceAmount?: number;
+ currentInterval?: string;
+ newPriceAmount?: number;
+ newInterval?: string;
+ nextBillingDate?: string;
+ alreadyOnPlan?: boolean;
+ error?: string;
+ }>;
}
const USAGE_CACHE_TTL = CACHE_CONFIG.API_KEY_TTL; // 1 hour
@@ -124,7 +143,10 @@ export function useUsage(): UseUsageResult | null {
}, [isLoaded, isSignedIn, fetchUsage]);
const openCheckout = useCallback(
- async (opts?: { plan?: "monthly" | "annual"; tier?: "pro" | "business" }): Promise<{ success: boolean; error?: string }> => {
+ async (opts?: {
+ plan?: "monthly" | "annual";
+ tier?: "pro" | "business";
+ }): Promise<{ success: boolean; error?: string }> => {
if (checkoutInFlightRef.current)
return { success: false, error: "Checkout already in progress" };
if (!window.electronAPI?.cloudCheckout || !window.electronAPI?.openExternal) {
@@ -169,6 +191,41 @@ export function useUsage(): UseUsageResult | null {
}
}, []);
+ const switchPlan = useCallback(
+ async (opts: {
+ plan: "monthly" | "annual";
+ tier: "pro" | "business";
+ }): Promise<{ success: boolean; alreadyOnPlan?: boolean; error?: string }> => {
+ if (checkoutInFlightRef.current) return { success: false, error: "Already loading" };
+ if (!window.electronAPI?.cloudSwitchPlan) {
+ return { success: false, error: "App not ready" };
+ }
+ checkoutInFlightRef.current = true;
+ setCheckoutLoading(true);
+ try {
+ const result = await window.electronAPI.cloudSwitchPlan(opts);
+ if (result.success) {
+ await fetchUsage();
+ }
+ return result;
+ } finally {
+ checkoutInFlightRef.current = false;
+ setCheckoutLoading(false);
+ }
+ },
+ [fetchUsage]
+ );
+
+ const previewSwitchPlan = useCallback(
+ async (opts: { plan: "monthly" | "annual"; tier: "pro" | "business" }) => {
+ if (!window.electronAPI?.cloudPreviewSwitch) {
+ return { success: false as const, error: "App not ready" };
+ }
+ return window.electronAPI.cloudPreviewSwitch(opts);
+ },
+ []
+ );
+
if (!isSignedIn) return null;
const wordsUsed = data?.wordsUsed ?? 0;
@@ -201,5 +258,7 @@ export function useUsage(): UseUsageResult | null {
refetch: fetchUsage,
openCheckout,
openBillingPortal,
+ switchPlan,
+ previewSwitchPlan,
};
}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 49b60efc4..45cbebeed 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -966,7 +966,24 @@
],
"cta": "Kontakt aufnehmen"
},
- "currentPlan": "Aktueller Tarif"
+ "currentPlan": "Aktueller Tarif",
+ "upgrade": "Upgrade",
+ "downgrade": "Downgrade",
+ "planSwitched": "Plan erfolgreich aktualisiert",
+ "confirmSwitch": {
+ "title": "Planwechsel bestätigen",
+ "description": "Zu {{plan}} ({{interval}}) wechseln",
+ "monthly": "monatlich",
+ "yearly": "jährlich",
+ "chargeToday": "Heutige Belastung",
+ "accountCredit": "Kontoguthaben",
+ "newPrice": "Neuer Preis",
+ "nextBilling": "Nächste Abrechnung",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Abbrechen",
+ "confirm": "Bestätigen"
+ }
},
"rollingWeeklyLimit": "Rollierendes Wochenlimit",
"signOut": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index f1651c731..6d4f0996f 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -1024,7 +1024,24 @@
],
"cta": "Contact Us"
},
- "currentPlan": "Current plan"
+ "currentPlan": "Current plan",
+ "upgrade": "Upgrade",
+ "downgrade": "Downgrade",
+ "planSwitched": "Plan updated successfully",
+ "confirmSwitch": {
+ "title": "Confirm plan change",
+ "description": "Switch to {{plan}} ({{interval}})",
+ "monthly": "monthly",
+ "yearly": "yearly",
+ "chargeToday": "Charge today",
+ "accountCredit": "Account credit",
+ "newPrice": "New price",
+ "nextBilling": "Next billing",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Cancel",
+ "confirm": "Confirm"
+ }
},
"rollingWeeklyLimit": "Rolling weekly limit",
"signOut": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index b49296bb8..1475b6700 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -966,7 +966,24 @@
],
"cta": "Contáctanos"
},
- "currentPlan": "Plan actual"
+ "currentPlan": "Plan actual",
+ "upgrade": "Mejorar plan",
+ "downgrade": "Reducir plan",
+ "planSwitched": "Plan actualizado correctamente",
+ "confirmSwitch": {
+ "title": "Confirmar cambio de plan",
+ "description": "Cambiar a {{plan}} ({{interval}})",
+ "monthly": "mensual",
+ "yearly": "anual",
+ "chargeToday": "Cargo hoy",
+ "accountCredit": "Crédito en cuenta",
+ "newPrice": "Nuevo precio",
+ "nextBilling": "Próxima facturación",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Cancelar",
+ "confirm": "Confirmar"
+ }
},
"rollingWeeklyLimit": "Límite semanal móvil",
"signOut": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index f68e8f022..5d3954239 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -966,7 +966,24 @@
],
"cta": "Nous contacter"
},
- "currentPlan": "Forfait actuel"
+ "currentPlan": "Forfait actuel",
+ "upgrade": "Passer au supérieur",
+ "downgrade": "Rétrograder",
+ "planSwitched": "Forfait mis à jour avec succès",
+ "confirmSwitch": {
+ "title": "Confirmer le changement",
+ "description": "Passer à {{plan}} ({{interval}})",
+ "monthly": "mensuel",
+ "yearly": "annuel",
+ "chargeToday": "Montant aujourd'hui",
+ "accountCredit": "Crédit sur le compte",
+ "newPrice": "Nouveau prix",
+ "nextBilling": "Prochaine facturation",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Annuler",
+ "confirm": "Confirmer"
+ }
},
"rollingWeeklyLimit": "Limite hebdomadaire glissante",
"signOut": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 11128b0f8..e9a6552b7 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -986,7 +986,24 @@
],
"cta": "Contattaci"
},
- "currentPlan": "Piano attuale"
+ "currentPlan": "Piano attuale",
+ "upgrade": "Upgrade",
+ "downgrade": "Downgrade",
+ "planSwitched": "Piano aggiornato con successo",
+ "confirmSwitch": {
+ "title": "Conferma cambio piano",
+ "description": "Passa a {{plan}} ({{interval}})",
+ "monthly": "mensile",
+ "yearly": "annuale",
+ "chargeToday": "Addebito oggi",
+ "accountCredit": "Credito sull'account",
+ "newPrice": "Nuovo prezzo",
+ "nextBilling": "Prossima fatturazione",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Annulla",
+ "confirm": "Conferma"
+ }
},
"signedOutPlans": {
"button": "Crea account gratuito"
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 552673631..c9b5ad84f 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -966,7 +966,24 @@
],
"cta": "お問い合わせ"
},
- "currentPlan": "現在のプラン"
+ "currentPlan": "現在のプラン",
+ "upgrade": "アップグレード",
+ "downgrade": "ダウングレード",
+ "planSwitched": "プランが正常に更新されました",
+ "confirmSwitch": {
+ "title": "プラン変更の確認",
+ "description": "{{plan}}({{interval}})に変更",
+ "monthly": "月額",
+ "yearly": "年額",
+ "chargeToday": "本日のご請求",
+ "accountCredit": "アカウントクレジット",
+ "newPrice": "新しい料金",
+ "nextBilling": "次回請求日",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "キャンセル",
+ "confirm": "確認"
+ }
},
"rollingWeeklyLimit": "週間利用上限(ローリング)",
"signOut": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index c71d049cf..b61a818b9 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -958,7 +958,24 @@
],
"cta": "Fale conosco"
},
- "currentPlan": "Plano atual"
+ "currentPlan": "Plano atual",
+ "upgrade": "Fazer upgrade",
+ "downgrade": "Fazer downgrade",
+ "planSwitched": "Plano atualizado com sucesso",
+ "confirmSwitch": {
+ "title": "Confirmar alteração de plano",
+ "description": "Mudar para {{plan}} ({{interval}})",
+ "monthly": "mensal",
+ "yearly": "anual",
+ "chargeToday": "Cobrança hoje",
+ "accountCredit": "Crédito na conta",
+ "newPrice": "Novo preço",
+ "nextBilling": "Próxima cobrança",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Cancelar",
+ "confirm": "Confirmar"
+ }
},
"signedOutPlans": {
"button": "Criar conta gratuita"
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index e81489b23..0cea0d2a5 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -986,7 +986,24 @@
],
"cta": "Связаться с нами"
},
- "currentPlan": "Текущий тариф"
+ "currentPlan": "Текущий тариф",
+ "upgrade": "Улучшить план",
+ "downgrade": "Понизить план",
+ "planSwitched": "План успешно обновлён",
+ "confirmSwitch": {
+ "title": "Подтвердите смену плана",
+ "description": "Перейти на {{plan}} ({{interval}})",
+ "monthly": "ежемесячно",
+ "yearly": "ежегодно",
+ "chargeToday": "Списание сегодня",
+ "accountCredit": "Кредит на счёте",
+ "newPrice": "Новая цена",
+ "nextBilling": "Следующее списание",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "Отмена",
+ "confirm": "Подтвердить"
+ }
},
"signedOutPlans": {
"button": "Создать бесплатный аккаунт"
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index f53654c62..4c11ef99e 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -986,7 +986,24 @@
],
"cta": "联系我们"
},
- "currentPlan": "当前套餐"
+ "currentPlan": "当前套餐",
+ "upgrade": "升级",
+ "downgrade": "降级",
+ "planSwitched": "套餐已成功更新",
+ "confirmSwitch": {
+ "title": "确认更换套餐",
+ "description": "切换至 {{plan}}({{interval}})",
+ "monthly": "月付",
+ "yearly": "年付",
+ "chargeToday": "今日收费",
+ "accountCredit": "账户余额",
+ "newPrice": "新价格",
+ "nextBilling": "下次计费",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "取消",
+ "confirm": "确认"
+ }
},
"signedOutPlans": {
"button": "免费创建账户"
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 5f61e5bf5..a0f7285de 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -986,7 +986,24 @@
],
"cta": "聯絡我們"
},
- "currentPlan": "目前方案"
+ "currentPlan": "目前方案",
+ "upgrade": "升級",
+ "downgrade": "降級",
+ "planSwitched": "方案已成功更新",
+ "confirmSwitch": {
+ "title": "確認更換方案",
+ "description": "切換至 {{plan}}({{interval}})",
+ "monthly": "月付",
+ "yearly": "年付",
+ "chargeToday": "今日收費",
+ "accountCredit": "帳戶餘額",
+ "newPrice": "新價格",
+ "nextBilling": "下次計費",
+ "mo": "mo",
+ "yr": "yr",
+ "cancel": "取消",
+ "confirm": "確認"
+ }
},
"signedOutPlans": {
"button": "建立免費帳號"
diff --git a/src/main.jsx b/src/main.jsx
index 3350dbfd2..777fa35d1 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -19,9 +19,7 @@ const agentOverlayImport = () => import("./components/AgentOverlay.tsx");
const ControlPanel = React.lazy(controlPanelImport);
const OnboardingFlow = React.lazy(onboardingFlowImport);
const AgentOverlay = React.lazy(agentOverlayImport);
-const MeetingNotificationOverlay = React.lazy(
- () => import("./components/MeetingNotificationOverlay.tsx")
-);
+import MeetingNotificationOverlay from "./components/MeetingNotificationOverlay.tsx";
let root = null;
@@ -278,11 +276,7 @@ function AppRouter() {
const isMeetingNotification = window.location.search.includes("meeting-notification=true");
if (isMeetingNotification) {
- return (
- <Suspense fallback={<div />}>
- <MeetingNotificationOverlay />
- </Suspense>
- );
+ return <MeetingNotificationOverlay />;
}
return <MainApp />;
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 75775143c..c692f3000 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -819,7 +819,10 @@ declare global {
error?: string;
code?: string;
}>;
- cloudCheckout?: (opts?: { plan?: "monthly" | "annual"; tier?: "pro" | "business" }) => Promise<{
+ cloudCheckout?: (opts?: {
+ plan?: "monthly" | "annual";
+ tier?: "pro" | "business";
+ }) => Promise<{
success: boolean;
url?: string;
error?: string;
@@ -831,6 +834,29 @@ declare global {
error?: string;
code?: string;
}>;
+ cloudSwitchPlan?: (opts: {
+ plan: "monthly" | "annual";
+ tier: "pro" | "business";
+ }) => Promise<{
+ success: boolean;
+ alreadyOnPlan?: boolean;
+ error?: string;
+ }>;
+ cloudPreviewSwitch?: (opts: {
+ plan: "monthly" | "annual";
+ tier: "pro" | "business";
+ }) => Promise<{
+ success: boolean;
+ immediateAmount?: number;
+ currency?: string;
+ currentPriceAmount?: number;
+ currentInterval?: string;
+ newPriceAmount?: number;
+ newInterval?: string;
+ nextBillingDate?: string;
+ alreadyOnPlan?: boolean;
+ error?: string;
+ }>;
// Cloud audio file transcription
transcribeAudioFileCloud?: (filePath: string) => Promise<{