Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat: handle past_due subscriptions and improve user-facing copy
Gabriel Stein26c7c40581b3
diff --git a/src/components/AuthenticationStep.tsx b/src/components/AuthenticationStep.tsxindex 506c0f2c1..30ccaba7c 100644--- a/src/components/AuthenticationStep.tsx+++ b/src/components/AuthenticationStep.tsx@@ -197,7 +197,7 @@ export default function AuthenticationStep({e.preventDefault();if (!authClient) {- setError("Authentication service is not configured. Please contact support.");+ setError("Authentication isn't set up yet. Please contact support.");return;}@@ -221,10 +221,12 @@ export default function AuthenticationStep({errorMessageIncludes(result.error.message, ["already exists", "already registered"])) {setAuthMode("sign-in");- setError("Account exists. Please sign in.");+ setError("Looks like you already have an account. Sign in instead.");setPassword("");} else {- setError(result.error.message || "Failed to create account");+ setError(+ result.error.message || "We couldn't create your account. Please try again."+ );}} else {updateLastSignInTime();@@ -256,10 +258,12 @@ export default function AuthenticationStep({if (result.error) {if (errorMessageIncludes(result.error.message, ["not found", "no user"])) {setAuthMode("sign-up");- setError("No account found. Let's create one.");+ setError("We didn't find an account with that email. Let's create one.");setPassword("");} else {- setError(result.error.message || "Invalid email or password");+ setError(+ result.error.message || "That email or password doesn't look right. Try again."+ );}} else {updateLastSignInTime();@@ -268,7 +272,7 @@ export default function AuthenticationStep({}} catch (err: unknown) {const errorMessage =- err instanceof Error ? err.message : "An error occurred. Please try again.";+ err instanceof Error ? err.message : "Something went wrong. Please try again.";setError(errorMessage);} finally {setIsSubmitting(false);@@ -326,7 +330,7 @@ export default function AuthenticationStep({<div className="bg-warning/5 p-2.5 rounded border border-warning/20"><p className="text-[10px] text-warning text-center leading-snug">- Cloud features not configured. You can still use OpenWhispr locally.+ Cloud features aren't set up yet. You can still use OpenWhispr locally.</p></div>diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsxindex 2fe2ca4e3..b4c5cfa44 100644--- a/src/components/ControlPanel.tsx+++ b/src/components/ControlPanel.tsx@@ -11,6 +11,7 @@ import {Sparkles,Cloud,X,+ AlertTriangle,} from "lucide-react";import type { SettingsSectionType } from "./SettingsModal";import TitleBar from "./TitleBar";@@ -24,6 +25,7 @@ import { useToast } from "./ui/Toast";import { useUpdater } from "../hooks/useUpdater";import { useSettings } from "../hooks/useSettings";import { useAuth } from "../hooks/useAuth";+import { useUsage } from "../hooks/useUsage";import {useTranscriptions,initializeTranscriptions,@@ -51,6 +53,7 @@ export default function ControlPanel() {const { toast } = useToast();const { useReasoningModel, setUseLocalWhisper, setCloudTranscriptionMode } = useSettings();const { isSignedIn, isLoaded: authLoaded } = useAuth();+ const usage = useUsage();const {status: updateStatus,@@ -78,8 +81,8 @@ export default function ControlPanel() {useEffect(() => {if (updateStatus.updateDownloaded && !isDownloading) {toast({- title: "Update Ready",- description: "Click 'Install Update' to restart and apply the update.",+ title: "Update ready to install",+ description: "Click 'Install Update' to restart with the latest version.",variant: "success",});}@@ -88,8 +91,8 @@ export default function ControlPanel() {useEffect(() => {if (updateError) {toast({- title: "Update Error",- description: "Failed to update. Please try again later.",+ title: "Update ran into a problem",+ description: "We couldn't complete the update. Please try again later.",variant: "destructive",});}@@ -104,8 +107,9 @@ export default function ControlPanel() {setShowUpgradePrompt(true);} else {toast({- title: "Daily Limit Reached",- description: "Resets at midnight UTC. Upgrade to Pro or use your own API key.",+ title: "Weekly limit reached",+ description:+ "Your limit resets on a rolling basis. Upgrade to Pro or use your own API key for unlimited use.",duration: 5000,});}@@ -117,6 +121,19 @@ export default function ControlPanel() {};}, [toast]);+ useEffect(() => {+ if (!usage?.isPastDue || !usage.hasLoaded) return;+ if (sessionStorage.getItem("pastDueNotified")) return;+ sessionStorage.setItem("pastDueNotified", "true");+ toast({+ title: "We couldn't process your payment",+ description:+ "Don't worry — you're on the free plan for now. Update your payment in Settings to get back to Pro.",+ variant: "destructive",+ duration: 8000,+ });+ }, [usage?.isPastDue, usage?.hasLoaded, toast]);+useEffect(() => {if (!authLoaded || !isSignedIn || cloudMigrationProcessed.current) return;const isPending = localStorage.getItem("pendingCloudMigration") === "true";@@ -136,8 +153,9 @@ export default function ControlPanel() {await initializeTranscriptions();} catch (error) {showAlertDialog({- title: "Unable to load history",- description: "Please try again in a moment.",+ title: "Couldn't load your history",+ description:+ "Something went wrong loading your transcriptions. Try closing and reopening the app.",});} finally {setIsLoading(false);@@ -156,8 +174,8 @@ export default function ControlPanel() {});} catch (err) {toast({- title: "Copy Failed",- description: "Failed to copy text to clipboard",+ title: "Couldn't copy",+ description: "Something went wrong copying to your clipboard. Try again.",variant: "destructive",});}@@ -168,7 +186,7 @@ export default function ControlPanel() {const clearHistory = useCallback(async () => {showConfirmDialog({title: "Clear History",- description: "Are you sure you want to clear all transcriptions? This cannot be undone.",+ description: "This will remove all your transcriptions. You can't undo this.",onConfirm: async () => {try {const result = await window.electronAPI.clearTranscriptions();@@ -181,8 +199,8 @@ export default function ControlPanel() {});} catch (error) {toast({- title: "Failed to clear",- description: "Please try again",+ title: "Couldn't clear history",+ description: "Something went wrong. Please try again.",variant: "destructive",});}@@ -195,7 +213,7 @@ export default function ControlPanel() {async (id: number) => {showConfirmDialog({title: "Delete Transcription",- description: "Are you certain you wish to remove this inscription from your records?",+ description: "This transcription will be permanently removed.",onConfirm: async () => {try {const result = await window.electronAPI.deleteTranscription(id);@@ -203,14 +221,14 @@ export default function ControlPanel() {removeFromStore(id);} else {showAlertDialog({- title: "Delete Failed",- description: "Failed to delete transcription. It may have already been removed.",+ title: "Couldn't delete",+ description: "This transcription may have already been removed.",});}} catch (error) {showAlertDialog({- title: "Delete Failed",- description: "Failed to delete transcription. Please try again.",+ title: "Couldn't delete",+ description: "Something went wrong. Please try again.",});}},@@ -225,14 +243,14 @@ export default function ControlPanel() {showConfirmDialog({title: "Install Update",description:- "The update will be installed and the app will restart. Make sure you've saved any work.",+ "OpenWhispr will restart to apply the update. Any in-progress work will be saved.",onConfirm: async () => {try {await installUpdate();} catch (error) {toast({- title: "Install Failed",- description: "Failed to install update. Please try again.",+ title: "Couldn't install update",+ description: "Something went wrong. Please try again.",variant: "destructive",});}@@ -243,8 +261,8 @@ export default function ControlPanel() {await downloadUpdate();} catch (error) {toast({- title: "Download Failed",- description: "Failed to download update. Please try again.",+ title: "Couldn't download update",+ description: "Check your internet connection and try again.",variant: "destructive",});}@@ -362,6 +380,36 @@ export default function ControlPanel() {<div className="p-4"><div className="max-w-3xl mx-auto">+ {usage?.isPastDue && (+ <div className="mb-3 rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/50 p-3">+ <div className="flex items-start gap-3">+ <div className="shrink-0 w-8 h-8 rounded-md bg-amber-100 dark:bg-amber-900/50 flex items-center justify-center">+ <AlertTriangle size={16} className="text-amber-600 dark:text-amber-400" />+ </div>+ <div className="flex-1 min-w-0">+ <p className="text-[13px] font-medium text-amber-900 dark:text-amber-200 mb-0.5">+ We couldn't process your payment+ </p>+ <p className="text-[12px] text-amber-700 dark:text-amber-300/80 mb-2">+ You're on the free plan for now — you still get {usage.limit.toLocaleString()}{" "}+ words per week. Update your payment to get back to Pro.+ </p>+ <Button+ variant="default"+ size="sm"+ className="h-7 text-[11px]"+ onClick={() => {+ setSettingsSection("account");+ setShowSettings(true);+ }}+ >+ Update Payment+ </Button>+ </div>+ </div>+ </div>+ )}+<div className="flex items-center justify-between mb-3 px-1"><div className="flex items-center gap-2"><FileText size={14} className="text-primary" />diff --git a/src/components/DeveloperSection.tsx b/src/components/DeveloperSection.tsxindex e4ef42868..f548a7fe5 100644--- a/src/components/DeveloperSection.tsx+++ b/src/components/DeveloperSection.tsx@@ -25,8 +25,8 @@ export default function DeveloperSection() {} catch (error) {console.error("Failed to load debug state:", error);toast({- title: "Error loading debug state",- description: "Could not retrieve debug logging status",+ title: "Couldn't load debug settings",+ description: "Something went wrong. Try reopening Settings.",variant: "destructive",});} finally {@@ -58,8 +58,8 @@ export default function DeveloperSection() {});} catch (error) {toast({- title: "Error",- description: `Failed to toggle debug logging: ${error}`,+ title: "Couldn't update debug logging",+ description: "Something went wrong. Please try again.",variant: "destructive",});} finally {@@ -75,8 +75,8 @@ export default function DeveloperSection() {}} catch (error) {toast({- title: "Error",- description: `Failed to open logs folder: ${error}`,+ title: "Couldn't open logs folder",+ description: "The folder might not exist yet. Try enabling debug mode first.",variant: "destructive",});}@@ -97,8 +97,8 @@ export default function DeveloperSection() {setTimeout(() => setCopiedPath(false), 2000);} catch (error) {toast({- title: "Copy Failed",- description: "Could not copy path to clipboard",+ title: "Couldn't copy",+ description: "Something went wrong copying to your clipboard.",variant: "destructive",});}diff --git a/src/components/EmailVerificationStep.tsx b/src/components/EmailVerificationStep.tsxindex 8113dc2fd..6adb84022 100644--- a/src/components/EmailVerificationStep.tsx+++ b/src/components/EmailVerificationStep.tsx@@ -61,10 +61,10 @@ export default function EmailVerificationStep({ email, onVerified }: EmailVerifisetResendCooldown(60);} else {const data = await res.json();- setError(data.error || "Failed to resend email");+ setError(data.error || "We couldn't resend the email. Please try again.");}} catch {- setError("Network error. Please try again.");+ setError("Couldn't reach the server. Check your connection and try again.");} finally {setIsResending(false);}diff --git a/src/components/ForgotPasswordView.tsx b/src/components/ForgotPasswordView.tsxindex 1ed52380a..bcf8e4d1c 100644--- a/src/components/ForgotPasswordView.tsx+++ b/src/components/ForgotPasswordView.tsx@@ -45,7 +45,7 @@ export default function ForgotPasswordView({<div className="space-y-3"><div className="bg-warning/5 p-2.5 rounded border border-warning/20"><p className="text-[10px] text-warning text-center leading-snug">- Authentication is not configured.+ Authentication isn't set up yet.</p></div><Button onClick={onBack} variant="outline" className="w-full h-9">diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex 46e002af5..d51d482cc 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -232,9 +232,9 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {const result = await window.electronAPI.updateHotkey(hotkey);if (result && !result.success) {showAlertDialog({- title: "Hotkey Not Registered",+ title: "Couldn't register that hotkey",description:- result.message || "We couldn't register that key. Please choose another hotkey.",+ result.message || "That key combination might already be in use. Try a different one.",});return false;}@@ -242,8 +242,8 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {} catch (error) {console.error("Failed to register onboarding hotkey", error);showAlertDialog({- title: "Hotkey Error",- description: "We couldn't register that key. Please choose another hotkey.",+ title: "Couldn't register that hotkey",+ description: "That key combination might already be in use. Try a different one.",});return false;}diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex facaf62bf..79b7b793f 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -17,6 +17,8 @@ import {Cloud,Key,Sparkles,+ AlertTriangle,+ Loader2,} from "lucide-react";import { useAuth } from "../hooks/useAuth";import { NEON_AUTH_URL, signOut } from "../lib/neonAuth";@@ -27,6 +29,7 @@ import PermissionCard from "./ui/PermissionCard";import PasteToolsInfo from "./ui/PasteToolsInfo";import TranscriptionModelPicker from "./TranscriptionModelPicker";import { ConfirmDialog, AlertDialog } from "./ui/dialog";+import { Alert, AlertTitle, AlertDescription } from "./ui/alert";import { useSettings } from "../hooks/useSettings";import { useDialogs } from "../hooks/useDialogs";import { useAgentName } from "../utils/agentName";@@ -688,8 +691,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageif (usage?.isApproachingLimit && !hasShownApproachingToast.current) {hasShownApproachingToast.current = true;toast({- title: "Approaching Weekly Limit",- description: `You've used ${usage.wordsUsed.toLocaleString()} of ${usage.limit.toLocaleString()} free words this week.`,+ title: "Getting close to your weekly limit",+ description: `You've used ${usage.wordsUsed.toLocaleString()} of ${usage.limit.toLocaleString()} free words this week. Upgrade to Pro for unlimited use.`,duration: 6000,});}@@ -813,10 +816,9 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageuseEffect(() => {if (updateError) {showAlertDialog({- title: "Update Error",+ title: "Update ran into a problem",description:- updateError.message ||- "The updater encountered a problem. Please try again or download the latest release manually.",+ "We couldn't complete the update. Please try again, or download the latest version from openwhispr.com.",});}}, [updateError, showAlertDialog]);@@ -828,9 +830,9 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage}installTimeoutRef.current = setTimeout(() => {showAlertDialog({- title: "Still Running",+ title: "Almost there",description:- "OpenWhispr didn't restart automatically. Please quit the app manually to finish installing the update.",+ "OpenWhispr didn't restart on its own. Quit and reopen the app to finish installing the update.",});}, 10000);} else if (installTimeoutRef.current) {@@ -847,7 +849,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage}, [installInitiated, showAlertDialog]);const resetAccessibilityPermissions = () => {- const message = `To fix accessibility permissions:\n\n1. Open System Settings > Privacy & Security > Accessibility\n2. Remove any old OpenWhispr or Electron entries\n3. Click (+) and add the current OpenWhispr app\n4. Make sure the checkbox is enabled\n5. Restart OpenWhispr\n\nClick OK to open System Settings.`;+ const message = `Here's how to fix accessibility permissions:\n\n1. Open System Settings > Privacy & Security > Accessibility\n2. Remove any old OpenWhispr or Electron entries\n3. Click (+) and add OpenWhispr\n4. Make sure the checkbox is enabled\n5. Restart OpenWhispr\n\nWe'll open System Settings for you.`;showConfirmDialog({title: "Reset Accessibility Permissions",@@ -873,9 +875,9 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage.then((result) => {if (!result?.success) {showAlertDialog({- title: "Unable to Remove Models",+ title: "Couldn't remove models",description:- result?.error || "Something went wrong while deleting the cached models.",+ "Something went wrong deleting the cached models. Try again or remove them manually from the folder.",});return;}@@ -883,15 +885,16 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagewindow.dispatchEvent(new Event("openwhispr-models-cleared"));showAlertDialog({- title: "Models Removed",+ title: "Models removed",description:- "All downloaded Whisper models were deleted. You can re-download any model from the picker when needed.",+ "All downloaded models have been cleared. You can re-download them anytime from the model picker.",});})- .catch((error) => {+ .catch(() => {showAlertDialog({- title: "Unable to Remove Models",- description: error?.message || "An unknown error occurred.",+ title: "Couldn't remove models",+ description:+ "Something went wrong. Try again or remove them manually from the folder.",});}).finally(() => {@@ -903,6 +906,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageconst { isSignedIn, isLoaded, user } = useAuth();const [isSigningOut, setIsSigningOut] = useState(false);+ const [isOpeningBilling, setIsOpeningBilling] = useState(false);const handleSignOut = useCallback(async () => {setIsSigningOut(true);@@ -912,8 +916,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage} catch (error) {logger.error("Sign out failed", error, "auth");showAlertDialog({- title: "Sign Out Failed",- description: "Unable to sign out. Please try again.",+ title: "Couldn't sign out",+ description: "Something went wrong. Please try again.",});} finally {setIsSigningOut(false);@@ -985,21 +989,49 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage</SettingsPanel>) : (<SettingsPanel>+ {usage.isPastDue && (+ <SettingsPanelRow>+ <Alert+ variant="warning"+ className="dark:bg-amber-950/50 dark:border-amber-800 dark:text-amber-200 dark:[&>svg]:text-amber-400"+ >+ <AlertTriangle className="h-4 w-4" />+ <AlertTitle>We couldn't process your payment</AlertTitle>+ <AlertDescription>+ You're on the free plan for now. Update your payment method to get back+ to Pro.+ </AlertDescription>+ </Alert>+ </SettingsPanelRow>+ )}+<SettingsPanelRow><SettingsRow- label={usage.isSubscribed ? (usage.isTrial ? "Trial" : "Pro") : "Free"}+ label={+ usage.isTrial+ ? "Trial"+ : usage.isPastDue+ ? "Free"+ : usage.isSubscribed+ ? "Pro"+ : "Free"+ }description={usage.isTrial? `${usage.trialDaysLeft} ${usage.trialDaysLeft === 1 ? "day" : "days"} remaining \u2014 unlimited transcriptions`- : usage.isSubscribed- ? usage.currentPeriodEnd- ? `Next billing: ${new Date(usage.currentPeriodEnd).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`- : "Unlimited transcriptions"- : `${usage.wordsUsed.toLocaleString()} / ${usage.limit.toLocaleString()} words this week`+ : usage.isPastDue+ ? `${usage.wordsUsed.toLocaleString()} / ${usage.limit.toLocaleString()} free words this week \u2014 update payment to restore Pro`+ : usage.isSubscribed+ ? usage.currentPeriodEnd+ ? `Next billing: ${new Date(usage.currentPeriodEnd).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`+ : "Unlimited transcriptions"+ : `${usage.wordsUsed.toLocaleString()} / ${usage.limit.toLocaleString()} words this week`}>{usage.isTrial ? (<Badge variant="info">Trial</Badge>+ ) : usage.isPastDue ? (+ <Badge variant="destructive">Past due</Badge>) : usage.isSubscribed ? (<Badge variant="success">Pro</Badge>) : usage.isOverLimit ? (@@ -1046,14 +1078,46 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage)}<SettingsPanelRow>- {usage.isSubscribed && !usage.isTrial ? (+ {usage.isPastDue ? (+ <Button+ onClick={async () => {+ setIsOpeningBilling(true);+ try {+ const result = await usage.openBillingPortal();+ if (!result.success) {+ toast({+ title: "Couldn't open billing",+ description:+ "We had trouble opening the billing page. Please try again.",+ variant: "destructive",+ });+ }+ } finally {+ setIsOpeningBilling(false);+ }+ }}+ disabled={isOpeningBilling}+ size="sm"+ className="w-full"+ >+ {isOpeningBilling ? (+ <>+ <Loader2 size={14} className="animate-spin" />+ Opening...+ </>+ ) : (+ "Update Payment Method"+ )}+ </Button>+ ) : usage.isSubscribed && !usage.isTrial ? (<ButtononClick={async () => {const result = await usage.openBillingPortal();if (!result.success) {toast({title: "Couldn't open billing",- description: result.error,+ description:+ "We had trouble opening the billing page. Please try again.",variant: "destructive",});}@@ -1072,7 +1136,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageif (!result.success) {toast({title: "Couldn't open checkout",- description: result.error,+ description:+ "We had trouble opening the checkout page. Please try again.",variant: "destructive",});}@@ -1216,8 +1281,9 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage}} catch (error: any) {showAlertDialog({- title: "Update Check Failed",- description: `Error checking for updates: ${error.message}`,+ title: "Couldn't check for updates",+ description:+ "Make sure you're connected to the internet and try again.",});}}}@@ -1241,8 +1307,8 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageawait downloadUpdate();} catch (error: any) {showAlertDialog({- title: "Download Failed",- description: `Failed to download update: ${error.message}`,+ title: "Couldn't download update",+ description: "Check your internet connection and try again.",});}}}@@ -1285,8 +1351,9 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageawait installUpdateAction();} catch (error: any) {showAlertDialog({- title: "Install Failed",- description: `Failed to install update: ${error.message}`,+ title: "Couldn't install update",+ description:+ "Something went wrong. Try downloading the latest version from openwhispr.com.",});}},@@ -1710,9 +1777,11 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage<ButtononClick={() => {setAgentName(agentName.trim());- showAlertDialog({- title: "Agent Name Updated",- description: `Your agent is now named "${agentName.trim()}". Address it by saying "Hey ${agentName.trim()}" followed by your instructions.`,+ toast({+ title: `Agent name set to "${agentName.trim()}"`,+ description: `Say "Hey ${agentName.trim()}" followed by your instructions to use it.`,+ variant: "success",+ duration: 4000,});}}disabled={!agentName.trim()}@@ -1969,18 +2038,19 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage?.cleanupApp().then(() => {showAlertDialog({- title: "Reset Complete",+ title: "All done",description:- "All app data has been removed. The app will reload.",+ "Everything has been reset. The app will reload now.",});setTimeout(() => {window.location.reload();}, 1000);})- .catch((error) => {+ .catch(() => {showAlertDialog({- title: "Reset Failed",- description: `Failed to reset: ${error.message}`,+ title: "Couldn't reset",+ description:+ "Something went wrong. Please try again or reinstall the app.",});});},diff --git a/src/components/UpgradePrompt.tsx b/src/components/UpgradePrompt.tsxindex 08ac15d9c..333b10cb1 100644--- a/src/components/UpgradePrompt.tsx+++ b/src/components/UpgradePrompt.tsx@@ -16,31 +16,55 @@ export default function UpgradePrompt({limit = 2000,}: UpgradePromptProps) {const usage = useUsage();+ const isPastDue = usage?.isPastDue ?? false;return (<Dialog open={open} onOpenChange={onOpenChange}><DialogContent className="max-w-md"><div className="text-center space-y-2 pt-2"><h2 className="text-xl font-semibold text-foreground">- You've reached your weekly limit+ {isPastDue ? "We couldn't process your payment" : "You've reached your weekly limit"}</h2><p className="text-sm text-muted-foreground">- {wordsUsed.toLocaleString()} of {limit.toLocaleString()} words used.- <br />- Your transcription was saved and pasted.+ {isPastDue ? (+ <>+ You're on the free plan for now — don't worry, you still get{" "}+ {limit.toLocaleString()} words per week.+ <br />+ Update your payment method to get back to unlimited Pro.+ </>+ ) : (+ <>+ {wordsUsed.toLocaleString()} of {limit.toLocaleString()} words used.+ <br />+ Your transcription was saved and pasted.+ </>+ )}</p></div><div className="space-y-2 pt-2">- <OptionCard- title="Upgrade to Pro"- description="Unlimited transcriptions. $9/month."- onClick={() => {- usage?.openCheckout();- }}- highlighted- disabled={usage?.checkoutLoading}- />+ {isPastDue ? (+ <OptionCard+ title="Update payment method"+ description="Get back to unlimited Pro transcriptions."+ onClick={() => {+ usage?.openBillingPortal();+ }}+ highlighted+ disabled={usage?.checkoutLoading}+ />+ ) : (+ <OptionCard+ title="Upgrade to Pro"+ description="Unlimited transcriptions. $9/month."+ onClick={() => {+ usage?.openCheckout();+ }}+ highlighted+ disabled={usage?.checkoutLoading}+ />+ )}<OptionCardtitle="Use your own API key"description="Bring your own key for unlimited use."diff --git a/src/hooks/useUsage.ts b/src/hooks/useUsage.tsindex 99dd573d3..f4f7f45bd 100644--- a/src/hooks/useUsage.ts+++ b/src/hooks/useUsage.ts@@ -8,6 +8,7 @@ interface UsageData {wordsRemaining: number;limit: number;plan: string;+ status: string;isSubscribed: boolean;isTrial: boolean;trialDaysLeft: number | null;@@ -17,6 +18,8 @@ interface UsageData {interface UseUsageResult {plan: string;+ status: string;+ isPastDue: boolean;wordsUsed: number;wordsRemaining: number;limit: number;@@ -55,7 +58,6 @@ export function useUsage(): UseUsageResult | null {setError(null);try {- // Use withSessionRefresh to handle AUTH_EXPIRED automaticallyawait withSessionRefresh(async () => {const result = await window.electronAPI.cloudUsage();if (result.success) {@@ -64,6 +66,7 @@ export function useUsage(): UseUsageResult | null {wordsRemaining: result.wordsRemaining ?? 0,limit: result.limit ?? 2000,plan: result.plan ?? "free",+ status: result.status ?? "active",isSubscribed: result.isSubscribed ?? false,isTrial: result.isTrial ?? false,trialDaysLeft: result.trialDaysLeft ?? null,@@ -72,7 +75,6 @@ export function useUsage(): UseUsageResult | null {});lastFetchRef.current = Date.now();} else {- // Throw error to trigger withSessionRefresh retry logic if neededconst error: any = new Error(result.error || "Failed to fetch usage");error.code = result.code;throw error;@@ -144,11 +146,15 @@ export function useUsage(): UseUsageResult | null {const wordsUsed = data?.wordsUsed ?? 0;const limit = data?.limit ?? 2000;const isSubscribed = data?.isSubscribed ?? false;+ const status = data?.status ?? "active";+ const isPastDue = data?.plan === "pro" && status === "past_due";const isOverLimit = !isSubscribed && limit > 0 && wordsUsed >= limit;const isApproachingLimit = !isSubscribed && limit > 0 && wordsUsed >= limit * 0.8 && !isOverLimit;return {plan: data?.plan ?? "free",+ status,+ isPastDue,wordsUsed,wordsRemaining: data?.wordsRemaining ?? (limit > 0 ? limit - wordsUsed : -1),limit,diff --git a/src/types/electron.ts b/src/types/electron.tsindex 5f71e40b5..34a8cab0c 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -452,6 +452,7 @@ declare global {wordsRemaining?: number;limit?: number;plan?: string;+ status?: string;isSubscribed?: boolean;isTrial?: boolean;trialDaysLeft?: number | null;