feat(conversion): vender el plan (no top-ups) en el momento del muro de cuota
De 76 impactos del muro 402 en 72h solo 4 llegaron a checkout y la única compra fue un top-up: la modal antigua ofrecía packs de minutos sueltos como opción principal, el upgrade a plan era un párrafo NO clickable y un StarBanner empujaba a GitHub en pleno momento de compra. Nueva modal (mismo fichero/props, cero cambios en App.jsx): - Starter destacado + Creator al lado como ancla de precio; bullets del valor real de pagar: 5x/15x minutos, sin watermark, clips permanentes (los free caducan a 7 dias) y prioridad de cola sobre free — todo cierto, sin escasez inventada ni cuentas atras falsas. - Copy goal-gradient con los datos del 402: "this video needs X min and you have Y left — upgrade and it starts processing right away". - "cancel anytime" como reversion de riesgo; top-ups relegados a un link discreto que expande; StarBanner fuera. - Eventos QuotaWallSeen / QuotaWallCheckout para medir la conversion del muro, que hasta ahora era invisible. El email de sin-minutos replica el mismo mensaje (perdida + plan concreto + CTA unico) y por fin deja rastro en logs al enviarse. Verificado end-to-end en local: usuario free con cuota agotada via DB, 402 real de /api/process, modal con datos reales y packs expandibles.
This commit is contained in:
parent
77905a9790
commit
95a9a5ff1e
4 changed files with 157 additions and 41 deletions
|
|
@ -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"""
|
||||
<div style="font-family:system-ui,sans-serif;max-width:480px;margin:0 auto">
|
||||
<h2>You've used your free minutes 🚀</h2>
|
||||
<p>You've hit this month's free allowance. That usually means the clips
|
||||
are working for you — Starter gives you <strong>100 minutes a month</strong>,
|
||||
no watermark, and a durable clip library.</p>
|
||||
<h2>Your video is still waiting 🎬</h2>
|
||||
<p>You've used this month's 20 free minutes — which usually means the
|
||||
clips are working for you. Here's what <strong>Starter ($12/mo)</strong>
|
||||
changes today:</p>
|
||||
<ul style="line-height:1.9;padding-left:20px">
|
||||
<li><strong>100 minutes</strong> every month (5× your free quota)</li>
|
||||
<li><strong>No watermark</strong> on your clips</li>
|
||||
<li>Clips stored <strong>forever</strong> — free clips are deleted after 7 days</li>
|
||||
</ul>
|
||||
<p><a href="{upgrade_url}" style="display:inline-block;background:#111;color:#fff;
|
||||
padding:12px 20px;border-radius:8px;text-decoration:none">See plans</a></p>
|
||||
<p style="color:#666;font-size:13px">Your free minutes reset on the 1st of
|
||||
every month.</p>
|
||||
padding:12px 20px;border-radius:8px;text-decoration:none">Upgrade and finish your video</a></p>
|
||||
<p style="color:#666;font-size:13px">Cancel anytime. Your free minutes
|
||||
reset on the 1st of every month.</p>
|
||||
</div>
|
||||
"""
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ export default function PricingSection({ onRequireLogin }) {
|
|||
className={`relative card p-6 flex flex-col ${highlight ? 'border-brass' : ''}`}
|
||||
>
|
||||
{highlight && (
|
||||
<span className="absolute -top-3 left-1/2 -translate-x-1/2 badge-brass">
|
||||
<span className="absolute -top-3 left-1/2 -translate-x-1/2 badge-float">
|
||||
Most popular
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<Modal isOpen onClose={onClose} eyebrow="QUOTA" title="You're out of minutes" size="md">
|
||||
<div className="flex items-start gap-3 mb-5">
|
||||
<div className="p-2 bg-paper3 rounded-input text-warn shrink-0"><Zap size={18} /></div>
|
||||
<p className="text-muted text-sm pt-1">
|
||||
{typeof required === 'number'
|
||||
? <>This video needs <b className="text-ink font-medium">{required} min</b> but you have <b className="text-ink font-medium">{Math.round((remaining || 0) * 10) / 10} min</b> left.</>
|
||||
: 'Add more minutes to keep generating.'}
|
||||
</p>
|
||||
<Modal isOpen onClose={onClose} eyebrow="UPGRADE" title="Your video is ready to clip" size="xl">
|
||||
{/* Goal-gradient framing: they're one step from the thing they came for. */}
|
||||
<p className="text-muted text-sm mb-5">
|
||||
{blockedByLength
|
||||
? <>This video needs <b className="text-ink font-medium">{required} min</b> and you have{' '}
|
||||
<b className="text-ink font-medium">{Math.max(0, Math.round((remaining || 0) * 10) / 10)} min</b> 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.</>}
|
||||
</p>
|
||||
|
||||
<div className="grid sm:grid-cols-3 gap-3">
|
||||
{plans.map((entry) => {
|
||||
const highlight = entry.plan === 'creator';
|
||||
return (
|
||||
<div key={entry.price_id}
|
||||
className={`relative card p-5 flex flex-col ${highlight ? 'border-brass' : ''}`}>
|
||||
{highlight && (
|
||||
<span className="absolute -top-3 left-1/2 -translate-x-1/2 badge-float">
|
||||
Most popular
|
||||
</span>
|
||||
)}
|
||||
<h3 className="font-display lowercase text-lg text-ink">{entry.plan}</h3>
|
||||
<p className="text-muted text-xs mb-3 lowercase">{PLAN_BLURBS[entry.plan] || ''}</p>
|
||||
<div className="mb-3 flex items-baseline gap-1.5">
|
||||
<span className="font-display text-3xl text-ink tabular-nums">{fmt(entry.amount, entry.currency)}</span>
|
||||
<span className="readout">/mo</span>
|
||||
</div>
|
||||
<ul className="space-y-1.5 text-sm text-ink2 mb-4 flex-1">
|
||||
<li className="flex items-start gap-2">
|
||||
<Check size={15} className="text-ok shrink-0 mt-0.5" />
|
||||
<span><b>{entry.minutes} min</b> every month ({Math.round(entry.minutes / 20)}× your free quota)</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<Check size={15} className="text-ok shrink-0 mt-0.5" />
|
||||
<span><b>No watermark</b> on your clips</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<Check size={15} className="text-ok shrink-0 mt-0.5" />
|
||||
<span>Clips stored <b>forever</b> — free clips delete after 7 days</span>
|
||||
</li>
|
||||
<li className="flex items-start gap-2">
|
||||
<Zap size={15} className="text-brass shrink-0 mt-0.5" />
|
||||
<span>Skips the free queue</span>
|
||||
</li>
|
||||
</ul>
|
||||
<button onClick={() => buy(entry, 'subscription')} disabled={busyPrice !== null}
|
||||
className={`w-full ${highlight ? 'btn-primary' : 'btn-ghost'}`}>
|
||||
{busyPrice === entry.price_id
|
||||
? <Loader2 size={18} className="animate-spin" />
|
||||
: `Get ${entry.plan}`}
|
||||
</button>
|
||||
<p className="text-center text-xs text-muted mt-2 lowercase">cancel anytime.</p>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{plans.length === 0 && (
|
||||
<div className="sm:col-span-3 flex justify-center py-8">
|
||||
<Loader2 className="animate-spin text-brass" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{topups.map((t) => (
|
||||
<button key={t.price_id} onClick={() => buy(t.price_id)} disabled={busy}
|
||||
className="border border-rule hover:border-brass rounded-card p-4 text-left transition-colors disabled:opacity-50">
|
||||
<div className="text-ink font-medium">+{t.minutes} min</div>
|
||||
<div className="readout mt-1">{fmt(t.amount, t.currency)}</div>
|
||||
|
||||
{/* Secondary escape hatch: one-time packs, deliberately de-emphasized. */}
|
||||
<div className="mt-4 text-center">
|
||||
{!showTopups ? (
|
||||
<button onClick={() => setShowTopups(true)}
|
||||
className="text-xs text-muted underline underline-offset-2 lowercase hover:text-ink2">
|
||||
just need a few extra minutes? one-time packs
|
||||
</button>
|
||||
))}
|
||||
{topups.length === 0 && <div className="col-span-2 flex justify-center py-4"><Loader2 className="animate-spin text-brass" /></div>}
|
||||
</div>
|
||||
<p className="text-muted text-xs mt-4 text-center lowercase">Or upgrade your plan for more monthly minutes.</p>
|
||||
<div className="mt-4">
|
||||
<StarBanner message="Not ready to buy?" />
|
||||
) : (
|
||||
<div className="grid grid-cols-2 gap-3 mt-2">
|
||||
{topups.map((t) => (
|
||||
<button key={t.price_id} onClick={() => buy(t, 'topup')} disabled={busyPrice !== null}
|
||||
className="border border-rule hover:border-brass rounded-card p-3 text-left transition-colors disabled:opacity-50">
|
||||
<div className="text-ink text-sm font-medium flex items-center gap-1.5">
|
||||
<Clock size={14} className="text-muted" />+{t.minutes} min
|
||||
</div>
|
||||
<div className="readout mt-0.5">{fmt(t.amount, t.currency)} · one-time</div>
|
||||
</button>
|
||||
))}
|
||||
{topups.length === 0 && (
|
||||
<div className="col-span-2 flex justify-center py-3">
|
||||
<Loader2 className="animate-spin text-brass" size={18} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue