Spaces:
Running
Running
File size: 8,716 Bytes
30247fe 64378fa 30247fe 64378fa 30247fe 64378fa 30247fe 64378fa cecfe55 64378fa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | import { html, useState } from "./runtime.js";
import { useCloud, money, planPeriod } from "./cloud.js";
import { Copy } from "./copy.js";
import { Icon, Notice, Pill } from "./components.js";
const RIBBONS = {
"model-library": "Best value",
student: "Most popular",
"exam-season": "Everything included"
};
const DAY_LINES = {
student: "that is about 13p a day",
scholar: "that is about 30p a day",
examiner: "that is about 63p a day"
};
// How much AI a plan includes, in plain language. Never show the money
// allowance on the shop front: it reads as a poor deal next to the price.
const ALLOWANCES = {
"paragraph-lite": "Fully offline — nothing to run out of",
"model-library": "Fully offline — nothing to run out of",
"exam-season": "5× the AI of Student, included",
"ai-booster": "+4× the AI of Student",
student: "A generous AI allowance every month",
scholar: "3× the AI of Student",
examiner: "8× the AI of Student"
};
function allowanceLine(plan) {
if (ALLOWANCES[plan.id]) return ALLOWANCES[plan.id];
if (!plan.cost_limit_cents) return "Fully offline — nothing to run out of";
return "A generous AI allowance";
}
function PlanCard({ plan, current, onBuy, busy, signedIn }) {
const isSub = plan.kind === "subscription";
const ribbon = RIBBONS[plan.id];
const cta = current ? "Already yours" : signedIn ? (isSub ? "Join " + plan.name : "Get " + plan.name) : "Sign in to continue";
return html`<div class=${"card plan-card" + (current ? " current" : "") + (ribbon === "Most popular" ? " featured" : "")}>
${ribbon && html`<span class="plan-ribbon">${ribbon}</span>`}
<div class="plan-top">
<span class="plan-name">${plan.name}</span>
${isSub && html`<span class="pill neutral">Membership</span>`}
${!isSub && html`<span class="pill green">One payment</span>`}
</div>
<div class="plan-price">
${money(plan.price_cents, plan.currency).replace(".00", "")}
<span class="plan-period">${isSub ? "/ " + (plan.interval || "month") : "once"}</span>
</div>
<div class="plan-subline">${isSub ? DAY_LINES[plan.id] || "cancel any time" : "no renewal, ever"}</div>
<p class="plan-blurb">${plan.blurb}</p>
<div class="plan-limit">
<${Icon} name="sparkle" size=${12} />
<span>${allowanceLine(plan)}</span>
</div>
<ul class="plan-features">
${(plan.features || []).map((f, i) => html`<li key=${i}><${Icon} name="check" size=${12} /> <span>${f}</span></li>`)}
</ul>
<button class=${"btn plan-cta " + (isSub ? "primary" : "green")} onClick=${() => onBuy(plan)} disabled=${busy || current}>
${busy ? html`<span class="spin"></span>` : current ? html`<${Icon} name="check" size=${13} />` : ""} ${cta}
</button>
<div class="plan-foot">${isSub ? "Cancel any time. Access runs to the end of the month you paid for." : "One payment. Nothing renews."}</div>
</div>`;
}
function Group({ title, note, plans, cloud, buy, busy }) {
return html`<div style=${{ marginTop: "20px" }}>
<div class="section-head" style=${{ alignItems: "baseline" }}>
<h2 class="section-title">${title}</h2>
<span class="tiny faint">${note}</span>
</div>
<div class="plan-grid">
${plans.map(
(plan) => html`<${PlanCard} key=${plan.id} plan=${plan} current=${!!cloud.plan && cloud.plan.id === plan.id} onBuy=${buy} busy=${busy === plan.id} signedIn=${!!cloud.user} />`
)}
</div>
</div>`;
}
export function Pricing() {
const cloud = useCloud();
const [busy, setBusy] = useState("");
const [error, setError] = useState("");
const plans = cloud.plans.filter((p) => p.active !== false).sort((a, b) => (a.sort || 0) - (b.sort || 0));
const oneOff = plans.filter((p) => p.kind === "one_time");
const subs = plans.filter((p) => p.kind === "subscription");
const buy = async (plan) => {
setError("");
if (!cloud.user) {
window.location.hash = "#/account";
return;
}
setBusy(plan.id);
try {
await cloud.startCheckout(plan);
} catch (err) {
setError(err && err.message ? err.message : "Checkout could not start.");
setBusy("");
}
};
return html`<main class="page">
<section class="price-hero">
<div class="deal-pill"><${Icon} name="sparkle" size=${12} /> Every plan includes the full marking engine</div>
<h1 class="price-title"><${Copy} id="pricing.title">Get the marks. Keep the change.</${Copy}></h1>
<p class="price-lede">
<${Copy} id="pricing.subtitle">Marking is free, forever. When you want the bigger models for the long essays, pick a pack once — or a membership you can leave whenever you like.</${Copy}>
</p>
<div class="price-chips">
<span><${Icon} name="check" size=${12} /> No card to start</span>
<span><${Icon} name="check" size=${12} /> One-off options</span>
<span><${Icon} name="check" size=${12} /> Cancel in two taps</span>
<span><${Icon} name="check" size=${12} /> Works offline</span>
</div>
</section>
${!cloud.configured &&
html`<div style=${{ marginTop: "14px" }}>
<${Notice} kind="warn">This is the preview shop front — connect Supabase and PayPal in the developer console to take real payments.<//>
</div>`}
${error && html`<div style=${{ marginTop: "14px" }}><${Notice} kind="error">${error}<//></div>`}
<div class="free-strip">
<div>
<div class="free-strip-title">Everything a student actually needs is free.</div>
<div class="free-strip-body">Paragraph, essay, poetry and mock-exam marking · the full process log · exports · your own AI key</div>
</div>
<a class="btn small" href="#/coach">Start marking</a>
</div>
<${Group} title="Pay once, keep forever" note="No renewal. No card kept on file." plans=${oneOff} cloud=${cloud} buy=${buy} busy=${busy} />
<${Group} title="Memberships" note="For the terms when you want the whole shelf." plans=${subs} cloud=${cloud} buy=${buy} busy=${busy} />
<div class="grid three" style=${{ marginTop: "26px" }}>
<div class="card value-card">
<div class="value-icon"><${Icon} name="book" size=${17} /></div>
<div class="value-title">Marked the way examiners mark</div>
<div class="value-body">Every paragraph is scored against the real AQA criteria, with the one change that lifts the grade next.</div>
</div>
<div class="card value-card">
<div class="value-icon"><${Icon} name="lock" size=${17} /></div>
<div class="value-title">Your writing stays yours</div>
<div class="value-body">Drafts live on your device. Offline models mean you can revise on a train with no signal at all.</div>
</div>
<div class="card value-card">
<div class="value-icon"><${Icon} name="sparkle" size=${17} /></div>
<div class="value-title">Less than a tutor, by a mile</div>
<div class="value-body">One hour with a tutor costs more than a whole year here. Buy once, or pay monthly and leave whenever.</div>
</div>
</div>
<div class="section-head" style=${{ marginTop: "26px" }}><h2 class="section-title">Good questions</h2></div>
<div class="card faq">
<details>
<summary>Do I need a plan to use Explication?</summary>
<p>No. Paragraph, essay, poetry and mock-exam marking, the process log and every export are free and always will be. Plans add the AI models.</p>
</details>
<details>
<summary>What is hosted AI?</summary>
<p>The bigger models run for you, so you do not need a powerful laptop. Each month (or each one-off pack) comes with an allowance of AI usage. When it runs out, the free tools and any offline models keep working.</p>
</details>
<details>
<summary>Can I cancel?</summary>
<p>Any time, in two taps from your account. You keep access until the end of the month you paid for, and nothing renews after that.</p>
</details>
<details>
<summary>What if I run out mid-term?</summary>
<p>Add an AI Booster once, or put in your own key from any AI provider and keep going without touching your allowance.</p>
</details>
<details>
<summary>Do downloads work without internet?</summary>
<p>Yes. Download a model once and it runs entirely on your device — on the bus, on a plane, in a hall with the Wi-Fi switched off.</p>
</details>
</div>
<p class="tiny faint" style=${{ marginTop: "16px" }}>
Prices in ${cloud.settings.currency || "GBP"}, including VAT where it applies. Cancel any time; access runs to the end of the period you paid for.
</p>
</main>`;
}
|