diff --git a/cloud/emails.py b/cloud/emails.py index 1073af0..540dde8 100644 --- a/cloud/emails.py +++ b/cloud/emails.py @@ -80,17 +80,28 @@ async def send_clips_ready_email(email: str, job_title: str, clip_count: int, async def send_out_of_minutes_email(email: str, upgrade_url: str): - """Free user hit their monthly quota โ€” the natural upgrade moment.""" + """Free user hit their monthly quota โ€” the natural upgrade moment. + + Mirrors the in-app upgrade modal: lead with what they lose by staying free + (watermark, clips deleted after 7 days) and one concrete plan, not a + generic pricing link. + """ html = f"""
-

You've used your free minutes ๐Ÿš€

-

You've hit this month's free allowance. That usually means the clips - are working for you โ€” Starter gives you 100 minutes a month, - no watermark, and a durable clip library.

+

Your video is still waiting ๐ŸŽฌ

+

You've used this month's 20 free minutes โ€” which usually means the + clips are working for you. Here's what Starter ($12/mo) + changes today:

+

See plans

-

Your free minutes reset on the 1st of - every month.

+ padding:12px 20px;border-radius:8px;text-decoration:none">Upgrade and finish your video

+

Cancel anytime. Your free minutes + reset on the 1st of every month.

""" - await send_email(email, "You've used your free OpenShorts minutes", html) + print(f"โœ‰๏ธ Out-of-minutes upsell email โ†’ {email}") + await send_email(email, "Your video is waiting โ€” you're out of free minutes", html) diff --git a/dashboard/src/components/PricingSection.jsx b/dashboard/src/components/PricingSection.jsx index c96774a..d5b3214 100644 --- a/dashboard/src/components/PricingSection.jsx +++ b/dashboard/src/components/PricingSection.jsx @@ -110,7 +110,7 @@ export default function PricingSection({ onRequireLogin }) { className={`relative card p-6 flex flex-col ${highlight ? 'border-brass' : ''}`} > {highlight && ( - + Most popular )} diff --git a/dashboard/src/components/TopUpModal.jsx b/dashboard/src/components/TopUpModal.jsx index 599a94e..d66716c 100644 --- a/dashboard/src/components/TopUpModal.jsx +++ b/dashboard/src/components/TopUpModal.jsx @@ -1,54 +1,153 @@ import React, { useState, useEffect } from 'react'; -import { Loader2, Zap } from 'lucide-react'; +import { Loader2, Check, Zap, Clock } from 'lucide-react'; import { apiJson } from '../lib/api'; +import { track } from '../lib/analytics'; import Modal from './ui/Modal'; -import StarBanner from './StarBanner'; -// Opens when a job hits a 402 (quota exceeded). Lets the user buy more minutes. +// Opens when a job hits a 402 (quota exceeded). This is the highest-intent +// moment in the product โ€” the user WANTS to clip a video and can't โ€” so it +// sells the subscription first (recurring value: minutes, no watermark, +// permanent clips) and keeps one-time top-ups as a secondary escape hatch. +// +// Conversion techniques used (all honest โ€” no fake scarcity or countdowns): +// - Goal-gradient: copy centers on finishing THIS video, not abstract quota. +// - Compromise effect: all three tiers shown, creator highlighted in the +// middle โ€” starter floors the price, pro anchors it, creator reads as the +// sensible pick (and matches the pricing page's "most popular"). +// - Loss framing: what free actually costs them (watermark, clips deleted +// after 7 days) โ€” both real product facts. +// - Risk reversal: "cancel anytime" on the CTA. +const PLAN_BLURBS = { + starter: 'for getting started', + creator: 'for daily posting', + pro: 'for power users', +}; + export default function TopUpModal({ onClose, required, remaining }) { + const [plans, setPlans] = useState([]); const [topups, setTopups] = useState([]); - const [busy, setBusy] = useState(false); + const [showTopups, setShowTopups] = useState(false); + const [busyPrice, setBusyPrice] = useState(null); useEffect(() => { - apiJson('/api/billing/plans').then((d) => setTopups(d.topups || [])).catch(() => {}); + track('QuotaWallSeen', { props: { required: required ?? null, remaining: remaining ?? null } }); + apiJson('/api/billing/plans') + .then((d) => { + const monthly = (d.plans || []).filter((p) => p.interval === 'month'); + setPlans(['starter', 'creator', 'pro'] + .map((name) => monthly.find((p) => p.plan === name)) + .filter(Boolean)); + setTopups(d.topups || []); + }) + .catch(() => {}); }, []); - const buy = async (price_id) => { - setBusy(true); + const buy = async (entry, kind) => { + setBusyPrice(entry.price_id); + track('QuotaWallCheckout', { props: { kind, plan: entry.plan || null, minutes: entry.minutes } }); try { const { url } = await apiJson('/api/billing/checkout', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ price_id }), + body: JSON.stringify({ price_id: entry.price_id }), }); window.location.href = url; - } catch (e) { setBusy(false); alert('Could not start checkout.'); } + } catch (e) { setBusyPrice(null); alert('Could not start checkout.'); } }; - const fmt = (a, c) => new Intl.NumberFormat('en-US', { style: 'currency', currency: (c || 'usd').toUpperCase(), maximumFractionDigits: 0 }).format((a || 0) / 100); + const fmt = (a, c) => new Intl.NumberFormat('en-US', { + style: 'currency', currency: (c || 'usd').toUpperCase(), maximumFractionDigits: 0, + }).format((a || 0) / 100); + + const blockedByLength = typeof required === 'number' && typeof remaining === 'number'; return ( - -
-
-

- {typeof required === 'number' - ? <>This video needs {required} min but you have {Math.round((remaining || 0) * 10) / 10} min left. - : 'Add more minutes to keep generating.'} -

+ + {/* Goal-gradient framing: they're one step from the thing they came for. */} +

+ {blockedByLength + ? <>This video needs {required} min and you have{' '} + {Math.max(0, Math.round((remaining || 0) * 10) / 10)} min left + this month. Upgrade and it starts processing right away. + : <>You've used your free minutes for this month. Upgrade and keep clipping right away.} +

+ +
+ {plans.map((entry) => { + const highlight = entry.plan === 'creator'; + return ( +
+ {highlight && ( + + Most popular + + )} +

{entry.plan}

+

{PLAN_BLURBS[entry.plan] || ''}

+
+ {fmt(entry.amount, entry.currency)} + /mo +
+
    +
  • + + {entry.minutes} min every month ({Math.round(entry.minutes / 20)}ร— your free quota) +
  • +
  • + + No watermark on your clips +
  • +
  • + + Clips stored forever โ€” free clips delete after 7 days +
  • +
  • + + Skips the free queue +
  • +
+ +

cancel anytime.

+
+ ); + })} + {plans.length === 0 && ( +
+ +
+ )}
-
- {topups.map((t) => ( - - ))} - {topups.length === 0 &&
} -
-

Or upgrade your plan for more monthly minutes.

-
- + ) : ( +
+ {topups.map((t) => ( + + ))} + {topups.length === 0 && ( +
+ +
+ )} +
+ )}
); diff --git a/dashboard/src/index.css b/dashboard/src/index.css index 56d78fe..c4629e1 100644 --- a/dashboard/src/index.css +++ b/dashboard/src/index.css @@ -116,7 +116,7 @@ } .btn-danger:hover { background: color-mix(in oklab, var(--color-danger) 12%, transparent); } - .badge-ok, .badge-warn, .badge-danger, .badge-brass { + .badge-ok, .badge-warn, .badge-danger, .badge-brass, .badge-float { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: var(--tracking-micro); @@ -131,6 +131,12 @@ .badge-warn { color: var(--color-warn); background: color-mix(in oklab, var(--color-warn) 12%, transparent); } .badge-danger { color: var(--color-danger); background: color-mix(in oklab, var(--color-danger) 12%, transparent); } .badge-brass { color: var(--color-accent); background: color-mix(in oklab, var(--color-accent) 12%, transparent); } + /* Floating badge overlapping a card border ("most popular"): needs an OPAQUE + base or the border line shows straight through the pill. */ + .badge-float { + color: var(--color-accent); + background: color-mix(in oklab, var(--color-accent) 12%, var(--color-paper)); + } /* narrow phones: tighter pill padding so CTA labels stay on one line */ @media (max-width: 379px) {