Spaces:
Running

quantilimited commited on
Commit
30247fe
·
1 Parent(s): 28ddfde

Serve the paid Explication build with Paragraph model downloads

Browse files
Files changed (13) hide show
  1. SETUP.html +27 -120
  2. js/admin.js +2 -90
  3. js/app.js +2 -3
  4. js/cloud.js +63 -129
  5. js/components.js +1 -1
  6. js/config.js +2 -6
  7. js/engine.js +10 -129
  8. js/pricing.js +10 -309
  9. js/screens-extra.js +30 -31
  10. js/screens.js +4 -4
  11. schema.sql +0 -15
  12. style.css +0 -28
  13. styles.css +0 -169
SETUP.html CHANGED
@@ -84,8 +84,8 @@
84
  <div class="wrap">
85
  <span class="badge">● Explication setup</span>
86
  <h1>From an empty folder to taking payments.</h1>
87
- <p class="lede">Ten screens for the website, then one for the iPhone app. Each tells you exactly where to click, what to copy and where to paste it. No terminal, no code, no guessing.</p>
88
- <div class="meta"><span><i class="dot"></i> About 20 minutes</span><span><i class="dot"></i> Free tiers are enough</span><span><i class="dot"></i> Money straight to your bank</span></div>
89
  </div>
90
  </header>
91
 
@@ -274,8 +274,8 @@
274
  <div class="step-head">
275
  <div class="num">7</div>
276
  <div>
277
- <h2>Take payments into your bank account</h2>
278
- <p class="why">No Stripe, no card details, no fees. The buyer sends the money straight to your account and you switch their plan on. The account details live in Supabase secrets, never in the site's files.</p>
279
  </div>
280
  </div>
281
  <div class="body">
@@ -283,25 +283,25 @@
283
  <div class="chrome"><i></i><i></i><i></i><span class="url">dashboard.stripe.com → Products</span></div>
284
  <div class="pane">
285
  <div class="rail">
286
- <div class="item"><span class="ic">ƒ</span> Functions</div>
287
- <div class="item on"><span class="ic">⚿</span> Secrets</div>
288
- <div class="item"><span class="ic">▦</span> Plans</div>
289
  </div>
290
  <div class="canvas">
291
- <h4>Edge Function secrets</h4>
292
- <p>Read only by the bank-transfer function.</p>
293
- <div class="field"><span><span class="lab">BANK_SORT_CODE</span><code>••-••-••</code></span><span class="pin">6</span></div>
294
- <div class="field"><span><span class="lab">BANK_ACCOUNT_NUMBER</span><code>••••••••</code></span></div>
295
- <div class="field"><span><span class="lab">BANK_ACCOUNT_NAME</span><code>Lucas Owen</code></span><span class="pin">7</span></div>
296
  </div>
297
  </div>
298
  </div>
299
  <div class="do">
300
- <b>Already done for you.</b> The <b>bank-transfer</b> function is deployed and the three secrets are set, so the shop works as it is. Nothing to paste into the site: the sort code and account number are not in any file a visitor can download.
301
- <br><br><b>To change the account</b> <span class="pin">6</span>: Supabase → <b>Edge Functions → Secrets</b>, edit the value, save. To change the name on the payment panel <span class="pin">7</span>, edit <b>BANK_ACCOUNT_NAME</b> the same way.
302
  </div>
303
  <table class="where">
304
- <tr><th>Plan</th><th>Amount to send</th><th>Type</th></tr>
305
  <tr><td>Paragraph Lite</td><td>£4.00</td><td>One-off</td></tr>
306
  <tr><td>Model Library</td><td>£14.00</td><td>One-off</td></tr>
307
  <tr><td>Exam Season</td><td>£24.00</td><td>One-off</td></tr>
@@ -310,10 +310,7 @@
310
  <tr><td>Scholar</td><td>£9.00</td><td>Monthly, recurring</td></tr>
311
  <tr><td>Examiner</td><td>£19.00</td><td>Monthly, recurring</td></tr>
312
  </table>
313
- <div class="tip">The buyer only sees the account details after signing in and confirming their email, and only when they open the checkout page inside the site. The page shows the amount, the sort code, the account number and a reference like <code class="inline">EX-4F2A9C31</code>. Opening it creates an order, so <b>Developer → People</b> shows their reference, email and plan even before they say they have paid.</div>
314
- <div class="do">
315
- <b>Stripe is still there if you ever want cards.</b> Developer → Stripe takes payment links or the <code class="inline">stripe-checkout</code> function, and <code class="inline">supabase/SETUP.md</code> has the keys. Leave it empty and the shop uses bank transfer.
316
- </div>
317
  </div>
318
  </section>
319
 
@@ -321,8 +318,8 @@
321
  <div class="step-head">
322
  <div class="num">8</div>
323
  <div>
324
- <h2>Try it, then approve the payment</h2>
325
- <p class="why">A bank transfer cannot tell the site anything, so you approve each buyer by hand — one click.</p>
326
  </div>
327
  </div>
328
  <div class="body">
@@ -330,15 +327,15 @@
330
  <div class="chrome"><i></i><i></i><i></i><span class="url">your site → Developer → People</span></div>
331
  <div class="pane">
332
  <div class="canvas">
333
- <h4>Bank transfers</h4>
334
- <div class="field"><span><span class="lab">Reference</span><code>EX-4F2A9C31</code></span><span class="pin">8</span></div>
335
- <div class="field"><span><span class="lab">Buyer</span><code>student@example.com · Student · £4.00</code></span></div>
336
- <div class="row"><button class="btn green">Mark paid</button></div>
337
  </div>
338
  </div>
339
  </div>
340
- <div class="do"><b>Do this:</b> sign in, open <b>Plans</b> and press one. The checkout page opens with the amount and one <b>Confirm purchase</b> button — exactly what a buyer sees — and an order appears in <b>Developer → People</b> straight away. Press <b>Confirm purchase</b>, then check your bank and press <b>Mark paid</b> <span class="pin">8</span> on the order. That records the payment and puts the plan on their Account page in one click.</div>
341
- <div class="warn">Bank transfer is manual by design: the money arrives with the reference, and you match it to the person. Orders show "Opened" until the buyer confirms, then "Confirmed — check the bank". Automatic unlocking needs a card processor — that is the Stripe route in <code class="inline">supabase/SETUP.md</code>.</div>
342
  </div>
343
  </section>
344
 
@@ -355,99 +352,12 @@
355
  <b>Before you upload:</b> open <code class="inline">js/config.js</code> in a text editor and paste your Project URL and anon key into the two empty quotes (the same two values from step 4). That is what makes the plans, wording and prices identical for every visitor — without it, each visitor is asked to connect their own project.
356
  <b>Then:</b> upload the <b>dist</b> folder — it is the upload copy of the site, with the Supabase function files left out so hosts do not think a build is needed. On Cloudflare go to <b>Workers &amp; Pages → Create → Upload and deploy</b>; on Netlify drag it onto <a href="https://app.netlify.com/drop" target="_blank" rel="noreferrer">app.netlify.com/drop</a>. You get an address like <code class="inline">explication.netlify.app</code> or <code class="inline">explication.you.workers.dev</code>.
357
  Go back to Supabase → <b>Authentication → URL Configuration</b> and add that address to <b>Redirect URLs</b>.
358
- Finally set the same address in the Mac app (see <code class="inline">supabase/SETUP.md</code>). The iPhone app sells through the App Store instead — the next screen after the Hugging Face one covers it.
359
  </div>
360
  <div class="warn">Local files (<code class="inline">file://</code>) cannot sign in. Always open the site through <code class="inline">Start Explication.command</code> or the published address.</div>
361
  </div>
362
  </section>
363
 
364
- <section class="step">
365
- <div class="step-head">
366
- <div class="num">◈</div>
367
- <div>
368
- <h2>Put a copy on Hugging Face</h2>
369
- <p class="why">Hugging Face Spaces will serve the same files for free, with no build step and no server to look after. It is a second address for the site — Supabase is still the backend.</p>
370
- </div>
371
- </div>
372
- <div class="body">
373
- <div class="window">
374
- <div class="chrome"><i></i><i></i><i></i><span class="url">huggingface.co/new-space</span></div>
375
- <div class="pane">
376
- <div class="rail">
377
- <div class="item on"><span class="ic">+</span> New Space</div>
378
- <div class="item"><span class="ic">▦</span> Spaces</div>
379
- <div class="item"><span class="ic">⚙</span> Settings</div>
380
- </div>
381
- <div class="canvas">
382
- <h4>Create a new Space</h4>
383
- <p>Free, and it needs nothing but the files.</p>
384
- <div class="field"><span><span class="lab">Space name</span><code>explication</code></span><span class="pin">9</span></div>
385
- <div class="field"><span><span class="lab">SDK</span><code>Static · Blank</code></span></div>
386
- <div class="field"><span><span class="lab">Visibility</span><code>Public</code></span></div>
387
- <div class="row"><button class="btn green">Create Space</button></div>
388
- </div>
389
- </div>
390
- </div>
391
- <div class="do">
392
- <b>Do this:</b> sign in at <a href="https://huggingface.co" target="_blank" rel="noreferrer">huggingface.co</a> and click <b>New → Space</b> <span class="pin">9</span>. Name it <b>explication</b>, choose the <b>Static</b> SDK and the <b>Blank</b> template — Static Spaces are free — leave <b>Public</b> selected, and press <b>Create Space</b>.
393
- </div>
394
- <div class="do">
395
- <b>Then upload the site.</b> In the new Space open <b>Files</b> → <b>Contribute → Upload files</b> <span class="pin">10</span>. Open the <b>dist</b> folder on your Mac and drag its <i>contents</i> — not the folder itself — onto the page: <code class="inline">index.html</code>, <code class="inline">SETUP.html</code>, <code class="inline">styles.css</code>, <code class="inline">favicon.svg</code>, <code class="inline">schema.sql</code>, and the <b>js</b> and <b>vendor</b> folders. The page lists every file with its folder in the name; press <b>Commit changes to main</b> and wait for <b>Running</b>.
396
- </div>
397
- <div class="warn">The <b>js</b> and <b>vendor</b> folders must keep their names. If the Space loads with no styling and no buttons, they were flattened on upload — delete those files in the Space and upload the folders again.</div>
398
- <div class="do">
399
- <b>The address.</b> The page at <code class="inline">huggingface.co/spaces/YOURNAME/explication</code> shows the site inside Hugging Face's frame. The address to share is the direct one: <code class="inline">https://YOURNAME-explication.static.hf.space</code> — your own username in lowercase, a dash, the Space name, then <code class="inline">.static.hf.space</code>. Open it once to check the site loads on its own.
400
- </div>
401
- <div class="do">
402
- <b>Tell Supabase about it.</b> Supabase → <b>Authentication → URL Configuration → Redirect URLs</b> → add <code class="inline">https://YOURNAME-explication.static.hf.space</code>. Without it, a password-reset link sends people to an address Supabase refuses.
403
- </div>
404
- <table class="where">
405
- <tr><th>What</th><th>Hugging Face</th></tr>
406
- <tr><td>Cost</td><td>Free for static Spaces, no card needed</td></tr>
407
- <tr><td>Address</td><td><code class="inline">https://YOURNAME-explication.static.hf.space</code></td></tr>
408
- <tr><td>Your own domain</td><td>Needs Hugging Face PRO — <code class="inline">explication.uk</code> stays on Cloudflare</td></tr>
409
- <tr><td>Updating the site</td><td><b>Contribute → Upload files</b> again; uploading a file with the same name replaces it</td></tr>
410
- <tr><td>What is public</td><td>Every uploaded file. Only the public anon key is in there — never add <code class="inline">.secrets.local</code></td></tr>
411
- </table>
412
- <div class="tip">The <b>dist</b> folder is already the safe upload copy: it leaves out <code class="inline">supabase/</code>, <code class="inline">emails/</code> and the secrets file. Keep Cloudflare as the main address and treat the Space as a free mirror, or as a place to test a change before it goes live.</div>
413
- </div>
414
- </section>
415
-
416
- <section class="step">
417
- <div class="step-head">
418
- <div class="num">◎</div>
419
- <div>
420
- <h2>The iPhone app: Supabase and the App Store</h2>
421
- <p class="why">The app reads the same plan table from Supabase, and sells through Apple's in-app purchase instead of sending anyone to the website.</p>
422
- </div>
423
- </div>
424
- <div class="body">
425
- <div class="do">
426
- <b>Supabase is already connected.</b> The app ships with your Project URL and anon key in <code class="inline">Explication/Core/Cloud/SupabaseCatalog.swift</code> — the same two values from step 4. Its Plans screen reads <code class="inline">explication_plans</code> (only <code class="inline">active</code> rows, ordered by <code class="inline">sort</code>), so names, prices and copy match the site automatically. It never writes, and the anon key is safe to ship: the row-level security policies in <code class="inline">schema.sql</code> allow reads only.
427
- </div>
428
- <div class="do">
429
- <b>Purchases use StoreKit, not the website.</b> Create one product per plan in <b>App Store Connect → My Apps → Explication → Monetization</b>. The identifiers must match exactly, including the capital letters.
430
- </div>
431
- <table class="where">
432
- <tr><th>Plan</th><th>Product ID</th><th>Type</th><th>Price</th></tr>
433
- <tr><td>Paragraph Lite</td><td><code class="inline">app.explication.coach.paragraphLite</code></td><td>Non-consumable</td><td>£4.00</td></tr>
434
- <tr><td>Model Library</td><td><code class="inline">app.explication.coach.modelLibrary</code></td><td>Non-consumable</td><td>£14.00</td></tr>
435
- <tr><td>Exam Season</td><td><code class="inline">app.explication.coach.examSeason</code></td><td>Non-consumable</td><td>£24.00</td></tr>
436
- <tr><td>AI Booster</td><td><code class="inline">app.explication.coach.aiBooster</code></td><td>Consumable</td><td>£6.00</td></tr>
437
- <tr><td>Student</td><td><code class="inline">app.explication.coach.student</code></td><td>Auto-renewable subscription</td><td>£4.00 / month</td></tr>
438
- <tr><td>Scholar</td><td><code class="inline">app.explication.coach.scholar</code></td><td>Auto-renewable subscription</td><td>£9.00 / month</td></tr>
439
- <tr><td>Examiner</td><td><code class="inline">app.explication.coach.examiner</code></td><td>Auto-renewable subscription</td><td>£19.00 / month</td></tr>
440
- </table>
441
- <div class="do">
442
- <b>Do this:</b> for the three memberships, make one subscription group called <b>Explication</b> and add the three durations inside it. Give every product a display name, a description in at least one language and a review screenshot — Apple will not put a product on sale without them. Sign <b>Agreements, Tax, and Banking → Paid Apps</b> first, or every product stays unavailable.
443
- </div>
444
- <div class="do">
445
- <b>Then just build it.</b> Double-click <code class="inline">Install on iPhone.command</code> in the project folder with the iPhone plugged in, unlocked and trusted. It builds, signs with your existing development profile and installs. In Xcode you can also open <code class="inline">Explication.xcodeproj</code>, pick the iPhone and press Run.
446
- </div>
447
- <div class="warn">Until the products exist in App Store Connect, the Plans screen says the App Store has none for this build — that is expected, not a bug. StoreKit shows Apple's local price once they are live. Website bank-transfer purchases and App Store purchases are separate: a plan bought on the website does not unlock in the app, and the other way round.</div>
448
- </div>
449
- </section>
450
-
451
  <section class="step">
452
  <div class="step-head">
453
  <div class="num">✉</div>
@@ -527,14 +437,13 @@
527
  <tr><td>Prices, plan names, wording of a plan</td><td>Site → <b>Developer → Plans → Edit</b></td></tr>
528
  <tr><td>Any sentence on any page</td><td>Site → <b>Developer → Wording → edit mode</b>, then click the words</td></tr>
529
  <tr><td>Model keys and endpoints</td><td>Site → <b>Developer → Models &amp; keys</b></td></tr>
530
- <tr><td>The account payments go into</td><td>Supabase → <b>Edge Functions → Secrets</b> → <code class="inline">BANK_SORT_CODE</code>, <code class="inline">BANK_ACCOUNT_NUMBER</code>, <code class="inline">BANK_ACCOUNT_NAME</code></td></tr>
531
  <tr><td>Who has a plan</td><td>Site → <b>Developer → People</b></td></tr>
532
  <tr><td>Stripe keys (advanced)</td><td>Supabase → <b>Edge Functions → Secrets</b></td></tr>
533
  <tr><td>The project address and key</td><td>Supabase → <b>Project Settings → API</b>; site → <b>Developer → Supabase</b></td></tr>
534
  <tr><td>Emails students receive</td><td>Supabase → <b>Authentication → Emails</b></td></tr>
535
  <tr><td>Which address students see as the sender</td><td>Supabase → <b>Authentication → Emails → SMTP Settings</b></td></tr>
536
  <tr><td>Mail sent to hello@yourdomain</td><td>Cloudflare → <b>Email → Email Routing</b></td></tr>
537
- <tr><td>The site's other address (Hugging Face)</td><td>huggingface.co → your Spaces → <b>explication</b> → Files</td></tr>
538
  </table>
539
  </div>
540
  </section>
@@ -553,10 +462,8 @@
553
  <tr><td>No developer console in the sidebar</td><td>You are signed in as a different email. Sign out, sign in as lucas.owen13@icloud.com.</td></tr>
554
  <tr><td>"Supabase could not be reached"</td><td>Project URL or anon key pasted wrong. Developer → Supabase → paste again from Project Settings → API.</td></tr>
555
  <tr><td>Plans page is empty</td><td>Step 2 did not run. Supabase → SQL Editor → paste the file → Run.</td></tr>
556
- <tr><td>"The bank details could not be loaded"</td><td>The <b>bank-transfer</b> function is missing or its secrets are empty. Supabase → Edge Functions: check <b>bank-transfer</b> is deployed and the three <code class="inline">BANK_…</code> secrets are set.</td></tr>
557
- <tr><td>"Confirm your email first"</td><td>The buyer signed up but has not opened the confirmation email. That is deliberate: the account details are only released to confirmed accounts.</td></tr>
558
  <tr><td>Sign-up says "check your email" but nothing arrives</td><td>Confirmation is on and Supabase's built-in sender only reaches your own team. Connect Resend (last section), or turn Confirm email off in Authentication → Providers → Email.</td></tr>
559
- <tr><td>Hugging Face copy has no styling or buttons</td><td>The <b>js</b> and <b>vendor</b> folders were flattened on upload. Delete those files in the Space and upload them again as folders.</td></tr>
560
  </table>
561
  </div>
562
  </section>
 
84
  <div class="wrap">
85
  <span class="badge">● Explication setup</span>
86
  <h1>From an empty folder to taking payments.</h1>
87
+ <p class="lede">Nine screens. Each one tells you exactly where to click, what to copy and where to paste it. No terminal, no code, no guessing.</p>
88
+ <div class="meta"><span><i class="dot"></i> About 20 minutes</span><span><i class="dot"></i> Free tiers are enough</span><span><i class="dot"></i> Test mode first, real money later</span></div>
89
  </div>
90
  </header>
91
 
 
274
  <div class="step-head">
275
  <div class="num">7</div>
276
  <div>
277
+ <h2>Make a Stripe payment link for one plan</h2>
278
+ <p class="why">This is the simple route: no keys, no webhooks. Stripe hosts the checkout page, the site just sends people there.</p>
279
  </div>
280
  </div>
281
  <div class="body">
 
283
  <div class="chrome"><i></i><i></i><i></i><span class="url">dashboard.stripe.com → Products</span></div>
284
  <div class="pane">
285
  <div class="rail">
286
+ <div class="item on"><span class="ic">▦</span> Products</div>
287
+ <div class="item"><span class="ic">↗</span> Payment links</div>
288
+ <div class="item"><span class="ic">◍</span> Test mode</div>
289
  </div>
290
  <div class="canvas">
291
+ <h4>Add a product</h4>
292
+ <p>Name it like the plan. One price, then create the link.</p>
293
+ <div class="field"><span><span class="lab">Name</span><code>Student</code></span></div>
294
+ <div class="field"><span><span class="lab">Price</span><code>£4.00 · monthly · recurring</code></span><span class="pin">6</span></div>
295
+ <div class="row"><button class="btn green">Create payment link</button><span class="pin">7</span></div>
296
  </div>
297
  </div>
298
  </div>
299
  <div class="do">
300
+ <b>Do this:</b> in Stripe flip <b>Test mode</b> on (top right). Go to <b>Products → Add product</b>, name it <b>Student</b>, add a price of <b>£4.00</b>, <b>monthly</b>, recurring <span class="pin">6</span>. Save, then press <b>Create payment link</b> <span class="pin">7</span> and copy the link.
301
+ On the site open <b>Developer → Plans → Edit</b> on Student, paste it into <b>Stripe payment link</b>, and save. Repeat for the other six — the table below has every name, price and type.
302
  </div>
303
  <table class="where">
304
+ <tr><th>Product name</th><th>Price in Stripe</th><th>Type</th></tr>
305
  <tr><td>Paragraph Lite</td><td>£4.00</td><td>One-off</td></tr>
306
  <tr><td>Model Library</td><td>£14.00</td><td>One-off</td></tr>
307
  <tr><td>Exam Season</td><td>£24.00</td><td>One-off</td></tr>
 
310
  <tr><td>Scholar</td><td>£9.00</td><td>Monthly, recurring</td></tr>
311
  <tr><td>Examiner</td><td>£19.00</td><td>Monthly, recurring</td></tr>
312
  </table>
313
+ <div class="tip">Test mode and live mode have different links. Keep test links while you practise, then swap them for live ones before launch.</div>
 
 
 
314
  </div>
315
  </section>
316
 
 
318
  <div class="step-head">
319
  <div class="num">8</div>
320
  <div>
321
+ <h2>Try it, then give yourself the plan</h2>
322
+ <p class="why">With payment links, Stripe takes the money but the site does not hear about it automatically. You approve the buyer by hand — one click.</p>
323
  </div>
324
  </div>
325
  <div class="body">
 
327
  <div class="chrome"><i></i><i></i><i></i><span class="url">your site → Developer → People</span></div>
328
  <div class="pane">
329
  <div class="canvas">
330
+ <h4>Give someone a plan</h4>
331
+ <div class="field"><span><span class="lab">Buyer's email</span><code>lucas.owen13@icloud.com</code></span></div>
332
+ <div class="field"><span><span class="lab">Plan</span><code>Student · £4.00</code></span></div>
333
+ <div class="row"><button class="btn green">Grant access</button><span class="pin">8</span></div>
334
  </div>
335
  </div>
336
  </div>
337
+ <div class="do"><b>Do this:</b> buy your own plan with test card <code class="inline">4242 4242 4242 4242</code>, any future date, any CVC. Then on the site open <b>Developer → People</b>, type the buyer's email, pick the plan and press <b>Grant access</b> <span class="pin">8</span>. The plan shows on their Account page immediately.</div>
338
+ <div class="warn">Want purchases to unlock themselves? That is the optional checkout-function route in <code class="inline">supabase/SETUP.md</code>, step 3. It needs five terminal commands. Everything works without it — you just approve each sale.</div>
339
  </div>
340
  </section>
341
 
 
352
  <b>Before you upload:</b> open <code class="inline">js/config.js</code> in a text editor and paste your Project URL and anon key into the two empty quotes (the same two values from step 4). That is what makes the plans, wording and prices identical for every visitor — without it, each visitor is asked to connect their own project.
353
  <b>Then:</b> upload the <b>dist</b> folder — it is the upload copy of the site, with the Supabase function files left out so hosts do not think a build is needed. On Cloudflare go to <b>Workers &amp; Pages → Create → Upload and deploy</b>; on Netlify drag it onto <a href="https://app.netlify.com/drop" target="_blank" rel="noreferrer">app.netlify.com/drop</a>. You get an address like <code class="inline">explication.netlify.app</code> or <code class="inline">explication.you.workers.dev</code>.
354
  Go back to Supabase → <b>Authentication → URL Configuration</b> and add that address to <b>Redirect URLs</b>.
355
+ Finally set the same address in the iPhone and Mac apps (see <code class="inline">supabase/SETUP.md</code>) so their plan buttons open the right site.
356
  </div>
357
  <div class="warn">Local files (<code class="inline">file://</code>) cannot sign in. Always open the site through <code class="inline">Start Explication.command</code> or the published address.</div>
358
  </div>
359
  </section>
360
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  <section class="step">
362
  <div class="step-head">
363
  <div class="num">✉</div>
 
437
  <tr><td>Prices, plan names, wording of a plan</td><td>Site → <b>Developer → Plans → Edit</b></td></tr>
438
  <tr><td>Any sentence on any page</td><td>Site → <b>Developer → Wording → edit mode</b>, then click the words</td></tr>
439
  <tr><td>Model keys and endpoints</td><td>Site → <b>Developer → Models &amp; keys</b></td></tr>
440
+ <tr><td>Payment links</td><td>Site → <b>Developer → Plans</b> → Stripe payment link field</td></tr>
441
  <tr><td>Who has a plan</td><td>Site → <b>Developer → People</b></td></tr>
442
  <tr><td>Stripe keys (advanced)</td><td>Supabase → <b>Edge Functions → Secrets</b></td></tr>
443
  <tr><td>The project address and key</td><td>Supabase → <b>Project Settings → API</b>; site → <b>Developer → Supabase</b></td></tr>
444
  <tr><td>Emails students receive</td><td>Supabase → <b>Authentication → Emails</b></td></tr>
445
  <tr><td>Which address students see as the sender</td><td>Supabase → <b>Authentication → Emails → SMTP Settings</b></td></tr>
446
  <tr><td>Mail sent to hello@yourdomain</td><td>Cloudflare → <b>Email → Email Routing</b></td></tr>
 
447
  </table>
448
  </div>
449
  </section>
 
462
  <tr><td>No developer console in the sidebar</td><td>You are signed in as a different email. Sign out, sign in as lucas.owen13@icloud.com.</td></tr>
463
  <tr><td>"Supabase could not be reached"</td><td>Project URL or anon key pasted wrong. Developer → Supabase → paste again from Project Settings → API.</td></tr>
464
  <tr><td>Plans page is empty</td><td>Step 2 did not run. Supabase → SQL Editor → paste the file → Run.</td></tr>
465
+ <tr><td>"This plan has no Stripe payment link yet"</td><td>Add the link to that plan in Developer → Plans, or you are in live mode with a test link.</td></tr>
 
466
  <tr><td>Sign-up says "check your email" but nothing arrives</td><td>Confirmation is on and Supabase's built-in sender only reaches your own team. Connect Resend (last section), or turn Confirm email off in Authentication → Providers → Email.</td></tr>
 
467
  </table>
468
  </div>
469
  </section>
js/admin.js CHANGED
@@ -489,10 +489,6 @@ function PeopleTab() {
489
  const [planId, setPlanId] = useState(cloud.plans[0] ? cloud.plans[0].id : "");
490
  const [error, setError] = useState("");
491
  const [busy, setBusy] = useState(false);
492
- const [busyOrder, setBusyOrder] = useState("");
493
-
494
- const pending = cloud.orders.filter((o) => o.status === "opened" || o.status === "sent");
495
- const recent = cloud.orders.filter((o) => o.status === "paid" || o.status === "cancelled").slice(0, 8);
496
 
497
  const grant = async () => {
498
  setError("");
@@ -509,102 +505,18 @@ function PeopleTab() {
509
  setBusy(false);
510
  };
511
 
512
- const markPaid = async (order) => {
513
- setError("");
514
- setBusyOrder(order.id);
515
- try {
516
- await cloud.markOrderPaid(order);
517
- cloud.flash("Marked paid — " + (order.plan_name || order.plan_id) + " is on for " + order.email + ".");
518
- } catch (err) {
519
- setError(err && err.message ? err.message : "Could not record that payment.");
520
- }
521
- setBusyOrder("");
522
- };
523
-
524
- const dismiss = async (order) => {
525
- setError("");
526
- try {
527
- await cloud.dismissOrder(order);
528
- cloud.flash("Order dismissed.");
529
- } catch (err) {
530
- setError(err && err.message ? err.message : "Could not dismiss that order.");
531
- }
532
- };
533
-
534
  return html`<div>
535
- ${error && html`<div style=${{ marginBottom: "12px" }}><${Notice} kind="error">${error}<//></div>`}
536
-
537
- ${pending.length > 0 &&
538
- html`<div class="card" style=${{ marginBottom: "12px" }}>
539
- <div class="row between wrap" style=${{ marginBottom: "8px" }}>
540
- <div class="section-title">Bank transfers</div>
541
- <span class="pill warn">${pending.length} to check</span>
542
- </div>
543
- <div class="tiny faint" style=${{ marginBottom: "8px", lineHeight: 1.55 }}>
544
- An order appears the moment someone opens the payment page. "Confirmed" means they have placed the order and been shown the bank details — check your bank, then press Mark paid.
545
- </div>
546
- <div class="list">
547
- ${pending.map(
548
- (o) => html`<div class="list-row" key=${o.id}>
549
- <div class="main">
550
- <div class="t">
551
- <span class="mono">${o.reference}</span>
552
- <span class=${"pill " + (o.status === "sent" ? "warn" : "neutral")} style=${{ marginLeft: "6px" }}>
553
- ${o.status === "sent" ? "Confirmed — check the bank" : "Opened, not confirmed"}
554
- </span>
555
- </div>
556
- <div class="s">${o.email} · ${o.plan_name || o.plan_id} · ${money(o.amount_cents, o.currency)}</div>
557
- <div class="s">
558
- Opened ${new Date(o.created_at || Date.now()).toLocaleDateString("en-GB")}
559
- ${o.sent_at ? " · confirmed purchase " + new Date(o.sent_at).toLocaleString("en-GB") : ""}
560
- ${o.payer_note ? " · “" + o.payer_note + "”" : ""}
561
- </div>
562
- </div>
563
- <button class="btn small primary" disabled=${busyOrder === o.id} onClick=${() => markPaid(o)}>
564
- ${busyOrder === o.id ? html`<span class="spin"></span>` : "Mark paid"}
565
- </button>
566
- <button class="btn small ghost" onClick=${() => dismiss(o)}>Dismiss</button>
567
- </div>`
568
- )}
569
- </div>
570
- </div>`}
571
-
572
- ${recent.length > 0 &&
573
- html`<div class="card" style=${{ marginBottom: "12px" }}>
574
- <div class="row between" style=${{ marginBottom: "8px" }}>
575
- <div class="section-title">Recent orders</div>
576
- <span class="tiny faint">last ${recent.length}</span>
577
- </div>
578
- <div class="list">
579
- ${recent.map(
580
- (o) => html`<div class="list-row" key=${o.id}>
581
- <div class="main">
582
- <div class="t">
583
- <span class="mono">${o.reference}</span>
584
- <span class=${"pill " + (o.status === "paid" ? "green" : "neutral")} style=${{ marginLeft: "6px" }}>
585
- ${o.status === "paid" ? "Paid" : "Cancelled"}
586
- </span>
587
- </div>
588
- <div class="s">
589
- ${o.email} · ${o.plan_name || o.plan_id} · ${money(o.amount_cents, o.currency)}
590
- ${o.confirmed_at ? " · confirmed " + new Date(o.confirmed_at).toLocaleDateString("en-GB") : ""}
591
- </div>
592
- </div>
593
- </div>`
594
- )}
595
- </div>
596
- </div>`}
597
-
598
  <div class="card">
599
  <div class="section-title" style=${{ marginBottom: "8px" }}>Give someone a plan</div>
600
  <div class="tiny faint" style=${{ marginBottom: "10px", lineHeight: 1.55 }}>
601
- For payments taken outside the site, or to fix a transfer that never appeared above. The plan stays until you revoke it.
602
  </div>
603
  <div class="grid two">
604
  <${Text} label="Buyer's email" value=${email} onChange=${setEmail} placeholder="student@example.com" />
605
  <${Select} label="Plan" value=${planId} onChange=${setPlanId}
606
  options=${cloud.plans.map((p) => ({ value: p.id, label: p.name + " · " + money(p.price_cents, p.currency) }))} />
607
  </div>
 
608
  <button class="btn primary small" style=${{ marginTop: "10px" }} onClick=${grant} disabled=${busy}>${busy ? html`<span class="spin"></span>` : "Grant access"}</button>
609
  </div>
610
 
 
489
  const [planId, setPlanId] = useState(cloud.plans[0] ? cloud.plans[0].id : "");
490
  const [error, setError] = useState("");
491
  const [busy, setBusy] = useState(false);
 
 
 
 
492
 
493
  const grant = async () => {
494
  setError("");
 
505
  setBusy(false);
506
  };
507
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  return html`<div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
  <div class="card">
510
  <div class="section-title" style=${{ marginBottom: "8px" }}>Give someone a plan</div>
511
  <div class="tiny faint" style=${{ marginBottom: "10px", lineHeight: 1.55 }}>
512
+ For payments taken outside Stripe, or to fix a webhook that missed. The plan stays until you revoke it.
513
  </div>
514
  <div class="grid two">
515
  <${Text} label="Buyer's email" value=${email} onChange=${setEmail} placeholder="student@example.com" />
516
  <${Select} label="Plan" value=${planId} onChange=${setPlanId}
517
  options=${cloud.plans.map((p) => ({ value: p.id, label: p.name + " · " + money(p.price_cents, p.currency) }))} />
518
  </div>
519
+ ${error && html`<div style=${{ marginTop: "8px" }}><${Notice} kind="error">${error}<//></div>`}
520
  <button class="btn primary small" style=${{ marginTop: "10px" }} onClick=${grant} disabled=${busy}>${busy ? html`<span class="spin"></span>` : "Grant access"}</button>
521
  </div>
522
 
js/app.js CHANGED
@@ -6,7 +6,7 @@ import { EditModeProvider, useEditMode } from "./copy.js";
6
  import { Sidebar, Drawer, TopBar, SECTIONS, Icon } from "./components.js";
7
  import { Dashboard, Chat, Coach, Essay, Poetry, Improve } from "./screens.js";
8
  import { ModelAnswers, MockExam, ProcessLog, Settings } from "./screens-extra.js";
9
- import { Pricing, Checkout } from "./pricing.js";
10
  import { Account, Connect, Welcome, NewPassword, LinkProblem } from "./auth.js";
11
  import { Developer } from "./admin.js";
12
 
@@ -14,7 +14,7 @@ import { Developer } from "./admin.js";
14
  const HIDDEN_ROUTES = ["connect", "welcome", "new-password", "link-problem"];
15
 
16
  function isRoute(id) {
17
- return SECTIONS.some((s) => s.id === id) || HIDDEN_ROUTES.includes(id) || id.startsWith("pay/");
18
  }
19
 
20
  function currentSection() {
@@ -149,7 +149,6 @@ function Shell() {
149
  case "developer":
150
  return html`<${Developer} />`;
151
  default:
152
- if (section.startsWith("pay/")) return html`<${Checkout} planId=${section.slice(4)} />`;
153
  return html`<${Dashboard} onNavigate=${navigate} />`;
154
  }
155
  })();
 
6
  import { Sidebar, Drawer, TopBar, SECTIONS, Icon } from "./components.js";
7
  import { Dashboard, Chat, Coach, Essay, Poetry, Improve } from "./screens.js";
8
  import { ModelAnswers, MockExam, ProcessLog, Settings } from "./screens-extra.js";
9
+ import { Pricing } from "./pricing.js";
10
  import { Account, Connect, Welcome, NewPassword, LinkProblem } from "./auth.js";
11
  import { Developer } from "./admin.js";
12
 
 
14
  const HIDDEN_ROUTES = ["connect", "welcome", "new-password", "link-problem"];
15
 
16
  function isRoute(id) {
17
+ return SECTIONS.some((s) => s.id === id) || HIDDEN_ROUTES.includes(id);
18
  }
19
 
20
  function currentSection() {
 
149
  case "developer":
150
  return html`<${Developer} />`;
151
  default:
 
152
  return html`<${Dashboard} onNavigate=${navigate} />`;
153
  }
154
  })();
js/cloud.js CHANGED
@@ -22,7 +22,6 @@ const T = {
22
  secrets: "explication_model_secrets",
23
  content: "explication_content",
24
  entitlements: "explication_entitlements",
25
- orders: "explication_orders",
26
  usage: "explication_usage"
27
  };
28
 
@@ -87,8 +86,8 @@ export const DEFAULT_PLANS = [
87
  interval: null,
88
  blurb: "The little model that started it all, yours to keep. Download it once and mark paragraphs on the bus, on the train, anywhere.",
89
  features: [
90
- "Paragraph Lite model, yours for good",
91
- "Runs fully offline after one download",
92
  "Every marking tool, forever",
93
  "Use your own AI key if you have one"
94
  ],
@@ -107,11 +106,11 @@ export const DEFAULT_PLANS = [
107
  price_cents: 1400,
108
  currency: "GBP",
109
  interval: null,
110
- blurb: "All four models in one go: the quick one, the strong one, and the two in between. Nothing else to buy.",
111
  features: [
112
- "All four offline models unlocked",
 
113
  "Download on every device you own",
114
- "Works on a plane, offline, forever",
115
  "Free updates when new models arrive"
116
  ],
117
  cost_limit_cents: 0,
@@ -131,7 +130,7 @@ export const DEFAULT_PLANS = [
131
  interval: null,
132
  blurb: "Everything unlocked for the run-up to the exams, including a pot of hosted AI for the nights you want the big models.",
133
  features: [
134
- "All four offline models",
135
  "Priority access to the hosted models",
136
  "One payment, nothing renews"
137
  ],
@@ -171,10 +170,10 @@ export const DEFAULT_PLANS = [
171
  price_cents: 400,
172
  currency: "GBP",
173
  interval: "month",
174
- blurb: "The whole shelf of hosted models, plus two offline downloads. About the price of a coffee a month.",
175
  features: [
176
  "Every hosted model, including the big ones",
177
- "Download Lite and 1.5B for offline use",
178
  "Use your own key and keep it free of limits"
179
  ],
180
  cost_limit_cents: 120,
@@ -192,10 +191,10 @@ export const DEFAULT_PLANS = [
192
  price_cents: 900,
193
  currency: "GBP",
194
  interval: "month",
195
- blurb: "For long essays and heavy revision weeks: more AI, more downloads, and the 3B model offline.",
196
  features: [
197
  "Everything in Student",
198
- "Download the 3B model as well",
199
  "Priority when the hosted models are busy"
200
  ],
201
  cost_limit_cents: 400,
@@ -216,7 +215,7 @@ export const DEFAULT_PLANS = [
216
  blurb: "The full shelf, the biggest budget and every model offline. For the year it really matters.",
217
  features: [
218
  "Everything in Scholar",
219
- "Download all four models, including 7B",
220
  "Early access to new models and marking prompts"
221
  ],
222
  cost_limit_cents: 1000,
@@ -229,60 +228,87 @@ export const DEFAULT_PLANS = [
229
  }
230
  ];
231
 
 
 
 
232
  export const DEFAULT_MODELS = [
233
  {
234
- id: "Qwen2.5-0.5B-Instruct-q4f16_1-MLC",
235
  name: "Paragraph Lite",
236
- host: "Browser (WebGPU)",
237
  endpoint_url: "",
238
- model_name: "Qwen2.5 0.5B Instruct",
 
 
 
 
 
 
239
  cost_in_per_million: 0,
240
  cost_out_per_million: 0,
241
  min_tier: 1,
242
- download_size: "~0.4 GB",
243
- note: "Quickest to load. Enough for short feedback.",
244
  enabled: true,
245
  sort: 1
246
  },
247
  {
248
- id: "Qwen2.5-1.5B-Instruct-q4f16_1-MLC",
249
- name: "Qwen2.5 1.5B",
250
- host: "Browser (WebGPU)",
251
  endpoint_url: "",
252
- model_name: "Qwen2.5 1.5B Instruct",
 
 
 
 
 
 
253
  cost_in_per_million: 0,
254
  cost_out_per_million: 0,
255
  min_tier: 2,
256
- download_size: "~1.1 GB",
257
- note: "The default when WebGPU is available.",
258
  enabled: true,
259
  sort: 2
260
  },
261
  {
262
- id: "Qwen2.5-3B-Instruct-q4f16_1-MLC",
263
- name: "Qwen2.5 3B",
264
- host: "Browser (WebGPU)",
265
  endpoint_url: "",
266
- model_name: "Qwen2.5 3B Instruct",
 
 
 
 
 
 
267
  cost_in_per_million: 0,
268
  cost_out_per_million: 0,
269
  min_tier: 3,
270
- download_size: "~2.0 GB",
271
- note: "Better analysis; needs a stronger GPU.",
272
  enabled: true,
273
  sort: 3
274
  },
275
  {
276
- id: "Qwen2.5-7B-Instruct-q4f16_1-MLC",
277
- name: "Qwen2.5 7B",
278
- host: "Browser (WebGPU)",
279
  endpoint_url: "",
280
- model_name: "Qwen2.5 7B Instruct",
 
 
 
 
 
 
281
  cost_in_per_million: 0,
282
  cost_out_per_million: 0,
283
  min_tier: 4,
284
- download_size: "~4.5 GB",
285
- note: "Best feedback here, but only on a capable GPU.",
286
  enabled: true,
287
  sort: 4
288
  }
@@ -359,7 +385,6 @@ export function CloudProvider({ children }) {
359
  models: [],
360
  content: {},
361
  entitlements: [],
362
- orders: [],
363
  usage: []
364
  });
365
  const [busy, setBusy] = useState(false);
@@ -395,17 +420,14 @@ export function CloudProvider({ children }) {
395
  map[row.key] = row.value;
396
  });
397
  let entitlements = [];
398
- let orders = [];
399
  let usage = [];
400
  if (who) {
401
- const [entRes, useRes, orderRes] = await Promise.all([
402
  sb.from(T.entitlements).select("*").order("granted_at", { ascending: false }),
403
- sb.from(T.usage).select("*").order("created_at", { ascending: false }).limit(2000),
404
- sb.from(T.orders).select("*").order("created_at", { ascending: false })
405
  ]);
406
  entitlements = entRes.data || [];
407
  usage = useRes.data || [];
408
- orders = orderRes.data || [];
409
  }
410
  if (!mounted.current) return;
411
  setCloud({
@@ -414,7 +436,6 @@ export function CloudProvider({ children }) {
414
  models: modelsRes.data || [],
415
  content: map,
416
  entitlements,
417
- orders,
418
  usage
419
  });
420
  setError("");
@@ -472,7 +493,6 @@ export function CloudProvider({ children }) {
472
  }, []);
473
 
474
  const entitlements = config.ready ? cloud.entitlements : preview.entitlements;
475
- const orders = config.ready ? cloud.orders : [];
476
  const usage = config.ready ? cloud.usage : preview.usage;
477
 
478
  const activeEntitlements = useMemo(() => {
@@ -775,82 +795,6 @@ export function CloudProvider({ children }) {
775
  [user, client, config.ready, cloud.settings, preview.settings]
776
  );
777
 
778
- // The bank details never exist in this file. They live in Supabase secrets and
779
- // are released by the bank-transfer function to a signed-in, confirmed account.
780
- const startBankTransfer = useCallback(
781
- async (chosen) => {
782
- if (!chosen) throw new Error("Pick a plan first.");
783
- if (!user) throw new Error("Sign in first, so the payment can be matched to your account.");
784
- if (!config.ready) throw new Error("Payments need the published site, not a preview.");
785
- const { data, error: err } = await client.functions.invoke("bank-transfer", {
786
- body: { plan_id: chosen.id }
787
- });
788
- if (err) throw err;
789
- if (!data || !data.accountNumber) {
790
- throw new Error((data && data.message) || "The bank details could not be loaded.");
791
- }
792
- return data;
793
- },
794
- [user, client, config.ready]
795
- );
796
-
797
- // The buyer confirms on the payment page. The function checks the order belongs
798
- // to them and moves it to 'sent' — the site itself cannot mark anything paid.
799
- const confirmBankTransfer = useCallback(
800
- async (orderId, note) => {
801
- if (!orderId) throw new Error("There is no order to confirm.");
802
- if (!config.ready) throw new Error("Payments need the published site, not a preview.");
803
- const { data, error: err } = await client.functions.invoke("bank-transfer", {
804
- body: { action: "sent", order_id: orderId, note: String(note || "") }
805
- });
806
- if (err) throw err;
807
- if (!data || data.ok === false) throw new Error((data && data.message) || "That could not be recorded.");
808
- await refresh(client);
809
- return data;
810
- },
811
- [client, config.ready, refresh]
812
- );
813
-
814
- // Developer only: the money arrived, so record it and grant the plan in one go.
815
- const markOrderPaid = useCallback(
816
- async (order) => {
817
- if (!order) throw new Error("No order picked.");
818
- if (!config.ready) throw new Error("Connect Supabase first.");
819
- // Grant first: if the second write fails, the plan is never lost — the
820
- // order stays in the list and can be pressed again.
821
- const { error: grantErr } = await client.from(T.entitlements).insert({
822
- user_id: order.user_id || null,
823
- email: String(order.email || "").toLowerCase(),
824
- plan_id: order.plan_id,
825
- source: "bank",
826
- expires_at: null
827
- });
828
- if (grantErr) throw grantErr;
829
- const { error: err } = await client
830
- .from(T.orders)
831
- .update({
832
- status: "paid",
833
- confirmed_at: new Date().toISOString(),
834
- confirmed_by: (user && user.email) || ""
835
- })
836
- .eq("id", order.id);
837
- if (err) throw err;
838
- await refresh(client);
839
- },
840
- [client, config.ready, refresh, user]
841
- );
842
-
843
- const dismissOrder = useCallback(
844
- async (order) => {
845
- if (!order) return;
846
- if (!config.ready) return;
847
- const { error: err } = await client.from(T.orders).update({ status: "cancelled" }).eq("id", order.id);
848
- if (err) throw err;
849
- await refresh(client);
850
- },
851
- [client, config.ready, refresh]
852
- );
853
-
854
  const hostedChat = useCallback(
855
  async (model, messages, onToken) => {
856
  if (!config.ready) throw new Error("Hosted models need Supabase. Connect it in Developer settings.");
@@ -930,7 +874,6 @@ export function CloudProvider({ children }) {
930
  models,
931
  content: config.ready ? cloud.content : preview.content,
932
  entitlements,
933
- orders,
934
  usage,
935
  plan,
936
  entitlement: activeEntitlement,
@@ -955,10 +898,6 @@ export function CloudProvider({ children }) {
955
  grantPlan,
956
  revokeGrant,
957
  startCheckout,
958
- startBankTransfer,
959
- confirmBankTransfer,
960
- markOrderPaid,
961
- dismissOrder,
962
  hostedChat,
963
  refresh: () => refresh(client),
964
  canDownload: (tier) => Number(tier || 0) <= 1 || (!!plan && Number(plan.download_tier || 0) >= Number(tier || 0)),
@@ -978,7 +917,6 @@ export function CloudProvider({ children }) {
978
  plans,
979
  models,
980
  entitlements,
981
- orders,
982
  usage,
983
  plan,
984
  activeEntitlement,
@@ -1004,10 +942,6 @@ export function CloudProvider({ children }) {
1004
  grantPlan,
1005
  revokeGrant,
1006
  startCheckout,
1007
- startBankTransfer,
1008
- confirmBankTransfer,
1009
- markOrderPaid,
1010
- dismissOrder,
1011
  hostedChat,
1012
  refresh
1013
  ]
 
22
  secrets: "explication_model_secrets",
23
  content: "explication_content",
24
  entitlements: "explication_entitlements",
 
25
  usage: "explication_usage"
26
  };
27
 
 
86
  interval: null,
87
  blurb: "The little model that started it all, yours to keep. Download it once and mark paragraphs on the bus, on the train, anywhere.",
88
  features: [
89
+ "Paragraph Lite — 2.5 GB, trained on 300 essays",
90
+ "Qwen3-4B base, runs offline after one download",
91
  "Every marking tool, forever",
92
  "Use your own AI key if you have one"
93
  ],
 
106
  price_cents: 1400,
107
  currency: "GBP",
108
  interval: null,
109
+ blurb: "All four Paragraph models in one go: Lite, Turbo, Novel and Ace. Nothing else to buy.",
110
  features: [
111
+ "Paragraph Lite (2.5 GB) and Turbo (5.8 GB)",
112
+ "Paragraph Novel (7.4 GB) and Ace (61 GB)",
113
  "Download on every device you own",
 
114
  "Free updates when new models arrive"
115
  ],
116
  cost_limit_cents: 0,
 
130
  interval: null,
131
  blurb: "Everything unlocked for the run-up to the exams, including a pot of hosted AI for the nights you want the big models.",
132
  features: [
133
+ "All four Paragraph models",
134
  "Priority access to the hosted models",
135
  "One payment, nothing renews"
136
  ],
 
170
  price_cents: 400,
171
  currency: "GBP",
172
  interval: "month",
173
+ blurb: "The whole shelf of hosted models, plus two Paragraph downloads. About the price of a coffee a month.",
174
  features: [
175
  "Every hosted model, including the big ones",
176
+ "Paragraph Lite (2.5 GB) and Turbo (5.8 GB) offline",
177
  "Use your own key and keep it free of limits"
178
  ],
179
  cost_limit_cents: 120,
 
191
  price_cents: 900,
192
  currency: "GBP",
193
  interval: "month",
194
+ blurb: "For long essays and heavy revision weeks: more AI, more downloads, and Novel offline.",
195
  features: [
196
  "Everything in Student",
197
+ "Adds Paragraph Novel (7.4 GB)",
198
  "Priority when the hosted models are busy"
199
  ],
200
  cost_limit_cents: 400,
 
215
  blurb: "The full shelf, the biggest budget and every model offline. For the year it really matters.",
216
  features: [
217
  "Everything in Scholar",
218
+ "All four Paragraph models, including Ace (61 GB)",
219
  "Early access to new models and marking prompts"
220
  ],
221
  cost_limit_cents: 1000,
 
228
  }
229
  ];
230
 
231
+ // The Paragraph family, exactly as published by quantilimited on Hugging Face.
232
+ // Sizes are the real file sizes. Ace is safetensors-only, so it has no GGUF
233
+ // download, but it is still the fourth and largest tier.
234
  export const DEFAULT_MODELS = [
235
  {
236
+ id: "paragraph-lite",
237
  name: "Paragraph Lite",
238
+ host: "GGUF · Q4_K_M",
239
  endpoint_url: "",
240
+ model_name: "Qwen3-4B-Instruct-2507",
241
+ base_model: "Qwen3-4B-Instruct-2507",
242
+ params: "4B",
243
+ essays: 300,
244
+ format: "GGUF · Q4_K_M",
245
+ download_url: "https://huggingface.co/quantilimited/Paragraph-Lite/resolve/main/Qwen3-4B-Instruct-2507.Q4_K_M.gguf",
246
+ card_url: "https://huggingface.co/quantilimited/Paragraph-Lite",
247
  cost_in_per_million: 0,
248
  cost_out_per_million: 0,
249
  min_tier: 1,
250
+ download_size: "2.5 GB",
251
+ note: "The fast tier. Small enough for an 8 GB iPhone, iPad or Mac.",
252
  enabled: true,
253
  sort: 1
254
  },
255
  {
256
+ id: "paragraph-turbo",
257
+ name: "Paragraph Turbo",
258
+ host: "GGUF · Q4_K_M",
259
  endpoint_url: "",
260
+ model_name: "Qwen3.5-9B",
261
+ base_model: "Qwen3.5-9B",
262
+ params: "9B",
263
+ essays: 500,
264
+ format: "GGUF · Q4_K_M",
265
+ download_url: "https://huggingface.co/quantilimited/Paragraph-Turbo-gguf/resolve/main/Qwen3.5-9B.Q4_K_M.gguf",
266
+ card_url: "https://huggingface.co/quantilimited/Paragraph-Turbo",
267
  cost_in_per_million: 0,
268
  cost_out_per_million: 0,
269
  min_tier: 2,
270
+ download_size: "5.8 GB",
271
+ note: "Sharper method and effect analysis. Needs about 16 GB of memory.",
272
  enabled: true,
273
  sort: 2
274
  },
275
  {
276
+ id: "paragraph-novel",
277
+ name: "Paragraph Novel",
278
+ host: "GGUF · Q4_K_M",
279
  endpoint_url: "",
280
+ model_name: "Gemma 4 12B",
281
+ base_model: "Gemma 4 12B",
282
+ params: "12B",
283
+ essays: 750,
284
+ format: "GGUF · Q4_K_M",
285
+ download_url: "https://huggingface.co/quantilimited/Paragraph-Novel/resolve/main/gemma-4-12b-it.Q4_K_M.gguf",
286
+ card_url: "https://huggingface.co/quantilimited/Paragraph-Novel",
287
  cost_in_per_million: 0,
288
  cost_out_per_million: 0,
289
  min_tier: 3,
290
+ download_size: "7.4 GB",
291
+ note: "12B Gemma 4 for voice, structure and whole-text argument. Needs about 16 GB.",
292
  enabled: true,
293
  sort: 3
294
  },
295
  {
296
+ id: "paragraph-ace",
297
+ name: "Paragraph Ace",
298
+ host: "Safetensors · 16 shards",
299
  endpoint_url: "",
300
+ model_name: "Qwen3-30B-A3B-Instruct-2507",
301
+ base_model: "Qwen3-30B-A3B-Instruct-2507",
302
+ params: "30B MoE · 3B active",
303
+ essays: 1000,
304
+ format: "Safetensors · 16 shards",
305
+ download_url: "",
306
+ card_url: "https://huggingface.co/quantilimited/Paragraph-Ace",
307
  cost_in_per_million: 0,
308
  cost_out_per_million: 0,
309
  min_tier: 4,
310
+ download_size: "61 GB",
311
+ note: "The full 30B mixture-of-experts checkpoint. Published as safetensors; there is no GGUF build yet.",
312
  enabled: true,
313
  sort: 4
314
  }
 
385
  models: [],
386
  content: {},
387
  entitlements: [],
 
388
  usage: []
389
  });
390
  const [busy, setBusy] = useState(false);
 
420
  map[row.key] = row.value;
421
  });
422
  let entitlements = [];
 
423
  let usage = [];
424
  if (who) {
425
+ const [entRes, useRes] = await Promise.all([
426
  sb.from(T.entitlements).select("*").order("granted_at", { ascending: false }),
427
+ sb.from(T.usage).select("*").order("created_at", { ascending: false }).limit(2000)
 
428
  ]);
429
  entitlements = entRes.data || [];
430
  usage = useRes.data || [];
 
431
  }
432
  if (!mounted.current) return;
433
  setCloud({
 
436
  models: modelsRes.data || [],
437
  content: map,
438
  entitlements,
 
439
  usage
440
  });
441
  setError("");
 
493
  }, []);
494
 
495
  const entitlements = config.ready ? cloud.entitlements : preview.entitlements;
 
496
  const usage = config.ready ? cloud.usage : preview.usage;
497
 
498
  const activeEntitlements = useMemo(() => {
 
795
  [user, client, config.ready, cloud.settings, preview.settings]
796
  );
797
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798
  const hostedChat = useCallback(
799
  async (model, messages, onToken) => {
800
  if (!config.ready) throw new Error("Hosted models need Supabase. Connect it in Developer settings.");
 
874
  models,
875
  content: config.ready ? cloud.content : preview.content,
876
  entitlements,
 
877
  usage,
878
  plan,
879
  entitlement: activeEntitlement,
 
898
  grantPlan,
899
  revokeGrant,
900
  startCheckout,
 
 
 
 
901
  hostedChat,
902
  refresh: () => refresh(client),
903
  canDownload: (tier) => Number(tier || 0) <= 1 || (!!plan && Number(plan.download_tier || 0) >= Number(tier || 0)),
 
917
  plans,
918
  models,
919
  entitlements,
 
920
  usage,
921
  plan,
922
  activeEntitlement,
 
942
  grantPlan,
943
  revokeGrant,
944
  startCheckout,
 
 
 
 
945
  hostedChat,
946
  refresh
947
  ]
js/components.js CHANGED
@@ -168,7 +168,7 @@ export function TopBar({ section, onMenu, onNavigate }) {
168
  const app = useApp();
169
  const engine = useEngine();
170
  const cloud = useCloud();
171
- const title = section.startsWith("pay/") ? "Checkout" : (SECTIONS.find((s) => s.id === section) || SECTIONS[0]).title;
172
  return html`<header class="topbar">
173
  <button class="icon-btn menu-btn" onClick=${onMenu} aria-label="Open menu"><${Icon} name="menu" size=${18} /></button>
174
  <h1>${title}</h1>
 
168
  const app = useApp();
169
  const engine = useEngine();
170
  const cloud = useCloud();
171
+ const title = (SECTIONS.find((s) => s.id === section) || SECTIONS[0]).title;
172
  return html`<header class="topbar">
173
  <button class="icon-btn menu-btn" onClick=${onMenu} aria-label="Open menu"><${Icon} name="menu" size=${18} /></button>
174
  <h1>${title}</h1>
js/config.js CHANGED
@@ -1,9 +1,5 @@
1
- // Deployment-wide defaults. The server address and public key entered in the
2
- // in-app setup screen are stored in this browser too; values here apply to
3
- // every visitor of this copy of the site.
4
- //
5
- // Fill these in before you share the folder, or leave them empty and use the
6
- // "Connect Supabase" screen on first open.
7
  window.EXPLICATION_CONFIG = {
8
  supabaseUrl: "https://jjybpqlrdmioiccejnti.supabase.co",
9
  supabaseAnonKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpqeWJwcWxyZG1pb2ljY2VqbnRpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3OTU1NDg3MTMsImV4cCI6MjExMTEyNDcxM30.h8nSMsKH0Oee5jiLJD_1GyLiAd4tsB9xT683d5gUMGA"
 
1
+ // Deployment-wide defaults. Safe to ship: this is the public anon key, and
2
+ // every table is protected by row-level security.
 
 
 
 
3
  window.EXPLICATION_CONFIG = {
4
  supabaseUrl: "https://jjybpqlrdmioiccejnti.supabase.co",
5
  supabaseAnonKey: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpqeWJwcWxyZG1pb2ljY2VqbnRpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3OTU1NDg3MTMsImV4cCI6MjExMTEyNDcxM30.h8nSMsKH0Oee5jiLJD_1GyLiAd4tsB9xT683d5gUMGA"
js/engine.js CHANGED
@@ -1,32 +1,10 @@
1
- import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, html } from "./runtime.js";
2
  import { useCloud } from "./cloud.js";
3
 
4
- export const WEB_MODELS = [
5
- {
6
- id: "Qwen2.5-0.5B-Instruct-q4f16_1-MLC",
7
- name: "Qwen2.5 0.5B",
8
- size: "~0.4 GB",
9
- note: "Quickest to load. Enough for short feedback."
10
- },
11
- {
12
- id: "Qwen2.5-1.5B-Instruct-q4f16_1-MLC",
13
- name: "Qwen2.5 1.5B",
14
- size: "~1.1 GB",
15
- note: "The default when WebGPU is available."
16
- },
17
- {
18
- id: "Qwen2.5-3B-Instruct-q4f16_1-MLC",
19
- name: "Qwen2.5 3B",
20
- size: "~2.0 GB",
21
- note: "Better analysis; needs a stronger GPU."
22
- },
23
- {
24
- id: "Qwen2.5-7B-Instruct-q4f16_1-MLC",
25
- name: "Qwen2.5 7B",
26
- size: "~4.5 GB",
27
- note: "Best feedback here, but only on a capable GPU."
28
- }
29
- ];
30
 
31
  const EngineContext = createContext(null);
32
 
@@ -40,13 +18,6 @@ function readEndpoint(key) {
40
 
41
  export function EngineProvider({ children }) {
42
  const cloud = useCloud();
43
- const [status, setStatus] = useState("idle"); // idle | loading | ready | error
44
- const [progress, setProgress] = useState(0);
45
- const [progressText, setProgressText] = useState("");
46
- const [error, setError] = useState("");
47
- const [loadedModel, setLoadedModel] = useState("");
48
- const engineRef = useRef(null);
49
- const webgpu = typeof navigator !== "undefined" && !!navigator.gpu;
50
 
51
  // The developer's hosted models (paid for with the plan's budget), chosen here.
52
  const [hostedId, setHostedId] = useState(() => readEndpoint("explication.hosted.model"));
@@ -64,55 +35,6 @@ export function EngineProvider({ children }) {
64
  );
65
  const hostedReady = !!hosted && !!hosted.endpoint_url && cloud.canHost(hosted);
66
 
67
- const unload = useCallback(async () => {
68
- try {
69
- if (engineRef.current && engineRef.current.unload) await engineRef.current.unload();
70
- } catch {
71
- // ignore
72
- }
73
- engineRef.current = null;
74
- setLoadedModel("");
75
- setStatus("idle");
76
- setProgress(0);
77
- setProgressText("");
78
- }, []);
79
-
80
- const load = useCallback(async (modelId) => {
81
- const chosen = cloud.models.find((m) => m.id === modelId);
82
- if (chosen && !cloud.canDownload(chosen.min_tier)) {
83
- setStatus("error");
84
- setError(`${chosen.name} needs a plan that includes it. See Plans, or keep using the free model.`);
85
- return;
86
- }
87
- if (!navigator.gpu) {
88
- setStatus("error");
89
- setError("This browser has no WebGPU, so it cannot run a model locally. Connect an OpenAI-compatible endpoint in Settings instead.");
90
- return;
91
- }
92
- setStatus("loading");
93
- setError("");
94
- setProgress(0);
95
- setProgressText("Preparing the model…");
96
- try {
97
- const webllm = await import("https://esm.sh/@mlc-ai/web-llm@0.2.88");
98
- const engine = await webllm.CreateMLCEngine(modelId, {
99
- initProgressCallback: (report) => {
100
- setProgressText(report.text || "Loading…");
101
- const match = /(\d+)%/.exec(report.text || "");
102
- if (match) setProgress(Number(match[1]) / 100);
103
- }
104
- });
105
- engineRef.current = engine;
106
- setLoadedModel(modelId);
107
- setStatus("ready");
108
- setProgress(1);
109
- setProgressText("Model ready.");
110
- } catch (err) {
111
- setStatus("error");
112
- setError(err && err.message ? err.message : "The model could not be loaded.");
113
- }
114
- }, [cloud.models, cloud.plan]);
115
-
116
  const [endpoint, setEndpointState] = useState(() => ({
117
  baseUrl: readEndpoint("explication.endpoint.baseUrl").trim(),
118
  model: readEndpoint("explication.endpoint.model").trim(),
@@ -193,67 +115,26 @@ export function EngineProvider({ children }) {
193
  return cloud.hostedChat(hosted, messages, onToken);
194
  }
195
 
196
- if (!engineRef.current) {
197
- throw new Error("No model is loaded. Open Settings to load a browser model, connect an endpoint or pick a hosted model.");
198
- }
199
- const stream = await engineRef.current.chat.completions.create({
200
- messages,
201
- temperature: 0.4,
202
- stream: true
203
- });
204
- let full = "";
205
- for await (const chunk of stream) {
206
- const delta = chunk?.choices?.[0]?.delta?.content || "";
207
- if (delta) {
208
- full += delta;
209
- onToken && onToken(full);
210
- }
211
- }
212
- return full;
213
  },
214
  [hasEndpoint, endpoint, hostedReady, hosted, cloud]
215
  );
216
 
217
  const value = useMemo(
218
  () => ({
219
- status,
220
- progress,
221
- progressText,
222
- error,
223
- loadedModel,
224
- webgpu,
225
  endpoint,
226
  hasEndpoint,
227
- models: cloud.models,
228
  hosted,
229
  hostedId,
230
  hostedReady,
231
  setHostedModel,
232
- canGenerate: hasEndpoint || status === "ready" || hostedReady,
233
- load,
234
- unload,
235
  chat,
236
  setEndpoint
237
  }),
238
- [
239
- status,
240
- progress,
241
- progressText,
242
- error,
243
- loadedModel,
244
- webgpu,
245
- endpoint,
246
- hasEndpoint,
247
- cloud.models,
248
- hosted,
249
- hostedId,
250
- hostedReady,
251
- setHostedModel,
252
- load,
253
- unload,
254
- chat,
255
- setEndpoint
256
- ]
257
  );
258
 
259
  return html`<${EngineContext.Provider} value=${value}>${children}<//>`;
 
1
+ import { createContext, useCallback, useContext, useMemo, useState, html } from "./runtime.js";
2
  import { useCloud } from "./cloud.js";
3
 
4
+ // Chat runs against the user's own OpenAI-compatible endpoint, or against a
5
+ // hosted model included in a plan. The Paragraph models are 2.5–61 GB
6
+ // checkpoints: they are downloaded for the Mac/iOS app or any GGUF runner, not
7
+ // executed inside a browser tab.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  const EngineContext = createContext(null);
10
 
 
18
 
19
  export function EngineProvider({ children }) {
20
  const cloud = useCloud();
 
 
 
 
 
 
 
21
 
22
  // The developer's hosted models (paid for with the plan's budget), chosen here.
23
  const [hostedId, setHostedId] = useState(() => readEndpoint("explication.hosted.model"));
 
35
  );
36
  const hostedReady = !!hosted && !!hosted.endpoint_url && cloud.canHost(hosted);
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  const [endpoint, setEndpointState] = useState(() => ({
39
  baseUrl: readEndpoint("explication.endpoint.baseUrl").trim(),
40
  model: readEndpoint("explication.endpoint.model").trim(),
 
115
  return cloud.hostedChat(hosted, messages, onToken);
116
  }
117
 
118
+ throw new Error(
119
+ "No model is connected. Add an OpenAI-compatible endpoint in Settings, or download a Paragraph model and run it on your own machine."
120
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  },
122
  [hasEndpoint, endpoint, hostedReady, hosted, cloud]
123
  );
124
 
125
  const value = useMemo(
126
  () => ({
 
 
 
 
 
 
127
  endpoint,
128
  hasEndpoint,
 
129
  hosted,
130
  hostedId,
131
  hostedReady,
132
  setHostedModel,
133
+ canGenerate: hasEndpoint || hostedReady,
 
 
134
  chat,
135
  setEndpoint
136
  }),
137
+ [endpoint, hasEndpoint, hosted, hostedId, hostedReady, setHostedModel, chat, setEndpoint]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  );
139
 
140
  return html`<${EngineContext.Provider} value=${value}>${children}<//>`;
js/pricing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { html, useEffect, useState } from "./runtime.js";
2
  import { useCloud, money, planPeriod } from "./cloud.js";
3
  import { Copy } from "./copy.js";
4
  import { Icon, Notice, Pill } from "./components.js";
@@ -82,310 +82,6 @@ function Group({ title, note, plans, cloud, buy, busy }) {
82
  </div>`;
83
  }
84
 
85
- function PayField({ label, value }) {
86
- return html`<div class="pay-field">
87
- <span class="lab">${label}</span>
88
- <span class="val">${value}</span>
89
- </div>`;
90
- }
91
-
92
- function OrderSummary({ order, plan, email, showRef }) {
93
- const name = (plan && plan.name) || order.planName || "Your plan";
94
- const features = (plan && plan.features) || [];
95
- const period = order.kind === "subscription" ? "per " + (order.interval || "month") : "once";
96
- return html`<aside class="card checkout-summary">
97
- <div class="eyebrow">Your order</div>
98
- <div class="checkout-plan">${name}</div>
99
- <div class="checkout-price">${order.amount} <span>${period}</span></div>
100
- ${features.length > 0 &&
101
- html`<ul class="plan-features">
102
- ${features.map((f, i) => html`<li key=${i}><${Icon} name="check" size=${12} /> <span>${f}</span></li>`)}
103
- </ul>`}
104
- <div class="divider" style=${{ margin: "14px 0 10px" }}></div>
105
- <div class="row between"><span class="tiny muted">Account</span><span class="tiny mono">${email}</span></div>
106
- ${showRef &&
107
- html`<div class="row between" style=${{ marginTop: "6px" }}><span class="tiny muted">Reference</span><span class="tiny mono">${order.reference}</span></div>`}
108
- <div class="tiny faint" style=${{ marginTop: "12px", lineHeight: 1.6 }}>
109
- ${order.kind === "subscription"
110
- ? "Monthly. Nothing is taken automatically — you send each month you want to keep it."
111
- : "One payment. Nothing renews."}
112
- </div>
113
- </aside>`;
114
- }
115
-
116
- function TransferDetails({ order, copied, copy }) {
117
- const text = [
118
- "Explication — " + order.planName,
119
- "Amount: " + order.amount,
120
- "Account name: " + order.accountName,
121
- "Sort code: " + order.sortCode,
122
- "Account number: " + order.accountNumber,
123
- "Reference: " + order.reference
124
- ].join("\n");
125
- return html`<div class="pay-step">
126
- <div class="pay-step-head">
127
- <span class="pay-step-num"><${Icon} name="check" size=${12} /></span>
128
- <div>
129
- <div class="pay-step-title">Send ${order.amount} from your bank app</div>
130
- <div class="tiny muted" style=${{ marginTop: "2px", lineHeight: 1.6 }}>
131
- Use the reference below, so the transfer is matched to this order.
132
- </div>
133
- </div>
134
- </div>
135
- <div class="pay-grid">
136
- <${PayField} label="Account name" value=${order.accountName} />
137
- <${PayField} label="Sort code" value=${order.sortCode} />
138
- <${PayField} label="Account number" value=${order.accountNumber} />
139
- </div>
140
- <div class="pay-ref">
141
- <div>
142
- <span class="lab">Payment reference</span>
143
- <span class="val">${order.reference}</span>
144
- </div>
145
- <button class="btn small" onClick=${() => copy("ref", order.reference)}>${copied === "ref" ? "Copied" : "Copy"}</button>
146
- </div>
147
- <div class="row between wrap" style=${{ marginTop: "10px" }}>
148
- <span class="tiny faint" style=${{ maxWidth: "430px", lineHeight: 1.55 }}>
149
- These details are fetched from our server each time this page opens. They are not stored in the site's files.
150
- </span>
151
- <button class="btn small" onClick=${() => copy("all", text)}>${copied === "all" ? "Copied" : "Copy all details"}</button>
152
- </div>
153
- </div>`;
154
- }
155
-
156
- export function Checkout({ planId }) {
157
- const cloud = useCloud();
158
- const [order, setOrder] = useState(null);
159
- const [loading, setLoading] = useState(true);
160
- const [error, setError] = useState("");
161
- const [copied, setCopied] = useState("");
162
- const [busy, setBusy] = useState(false);
163
-
164
- const plan = cloud.plans.find((p) => p.id === planId) || null;
165
- const signedIn = !!cloud.user;
166
- const userId = cloud.user ? cloud.user.id : "";
167
- const ownsPlan = (cloud.entitlements || []).some((e) => {
168
- if (e.plan_id !== planId || e.revoked) return false;
169
- return !e.expires_at || new Date(e.expires_at).getTime() > Date.now();
170
- });
171
-
172
- // Opening this page is what creates the order, so the developer can see the
173
- // reference, email and plan before the money arrives.
174
- useEffect(() => {
175
- let live = true;
176
- setOrder(null);
177
- setError("");
178
- if (!userId || ownsPlan) {
179
- setLoading(false);
180
- return () => {
181
- live = false;
182
- };
183
- }
184
- setLoading(true);
185
- cloud
186
- .startBankTransfer({ id: planId })
187
- .then((data) => {
188
- if (!live) return;
189
- setOrder(data);
190
- })
191
- .catch((err) => {
192
- if (live) setError(err && err.message ? err.message : "The payment details could not be loaded.");
193
- })
194
- .finally(() => {
195
- if (live) setLoading(false);
196
- });
197
- return () => {
198
- live = false;
199
- };
200
- }, [planId, userId, ownsPlan]);
201
-
202
- const copy = (what, text) => {
203
- navigator.clipboard
204
- .writeText(text)
205
- .then(() => {
206
- setCopied(what);
207
- setTimeout(() => setCopied(""), 2000);
208
- })
209
- .catch(() => {});
210
- };
211
-
212
- const confirm = async () => {
213
- setBusy(true);
214
- setError("");
215
- try {
216
- const data = await cloud.confirmBankTransfer(order.orderId, "");
217
- setOrder(data);
218
- window.scrollTo({ top: 0, behavior: "instant" });
219
- } catch (err) {
220
- setError(err && err.message ? err.message : "That could not be recorded.");
221
- }
222
- setBusy(false);
223
- };
224
-
225
- if (!signedIn) {
226
- return html`<main class="page narrow">
227
- <div class="eyebrow">Checkout</div>
228
- <h1 class="page-title">Pay by bank transfer</h1>
229
- <p class="subtitle">Sign in first, so the payment is attached to your account and your plan.</p>
230
- <div class="card" style=${{ marginTop: "16px" }}>
231
- <div class="row between wrap">
232
- <div>
233
- <div style=${{ fontWeight: 600 }}>${plan ? plan.name + " · " + money(plan.price_cents, plan.currency) : "Your plan"}</div>
234
- <div class="tiny faint" style=${{ marginTop: "4px" }}>The payment page opens as soon as you are signed in.</div>
235
- </div>
236
- <div class="row">
237
- <a class="btn small" href="#/pricing">Back to plans</a>
238
- <a class="btn small primary" href="#/account">Sign in</a>
239
- </div>
240
- </div>
241
- </div>
242
- </main>`;
243
- }
244
-
245
- if (ownsPlan) {
246
- return html`<main class="page narrow">
247
- <div class="eyebrow">Checkout</div>
248
- <h1 class="page-title">You already have this</h1>
249
- <p class="subtitle">${(plan && plan.name) || "This plan"} is active on your account. There is nothing else to pay.</p>
250
- <div class="row" style=${{ marginTop: "14px" }}>
251
- <a class="btn small primary" href="#/account">See your plan</a>
252
- <a class="btn small ghost" href="#/pricing">Back to plans</a>
253
- </div>
254
- </main>`;
255
- }
256
-
257
- if (loading) {
258
- return html`<main class="page narrow">
259
- <div class="card" style=${{ marginTop: "16px" }}>
260
- <div class="row"><span class="spin"></span><span class="tiny muted">Preparing your payment page…</span></div>
261
- </div>
262
- </main>`;
263
- }
264
-
265
- if (!order) {
266
- return html`<main class="page narrow">
267
- <div class="eyebrow">Checkout</div>
268
- <h1 class="page-title">Payment page</h1>
269
- <div style=${{ marginTop: "14px" }}><${Notice} kind="error">${error || "This plan is not on sale."}<//></div>
270
- <div class="row" style=${{ marginTop: "12px" }}><a class="btn small" href="#/pricing">Back to plans</a></div>
271
- </main>`;
272
- }
273
-
274
- if (order.status === "cancelled") {
275
- return html`<main class="page narrow">
276
- <div class="eyebrow">Checkout</div>
277
- <h1 class="page-title">This order was cancelled</h1>
278
- <p class="subtitle">Nothing was charged. You can start again whenever you like.</p>
279
- <div class="row" style=${{ marginTop: "14px" }}>
280
- <a class="btn small primary" href="#/pricing">Choose a plan</a>
281
- <a class="btn small ghost" href="#/account">My account</a>
282
- </div>
283
- </main>`;
284
- }
285
-
286
- // Two clicks: Join on the plans page, then Confirm purchase here. Only after
287
- // that is the buyer shown what to send, so there is nothing to fill in.
288
- if (order.status === "opened") {
289
- return html`<main class="page">
290
- <div class="row between wrap" style=${{ alignItems: "flex-end" }}>
291
- <div>
292
- <div class="eyebrow">Checkout</div>
293
- <h1 class="page-title">Confirm your plan</h1>
294
- <p class="subtitle">${order.planName} · ${order.amount} ${order.kind === "subscription" ? "a month" : "once"}. Bank transfer, no card.</p>
295
- </div>
296
- <a class="btn small ghost" href="#/pricing">Back to plans</a>
297
- </div>
298
-
299
- ${error && html`<div style=${{ marginTop: "12px" }}><${Notice} kind="error">${error}<//></div>`}
300
-
301
- <div class="checkout">
302
- <${OrderSummary} order=${order} plan=${plan} email=${cloud.user.email} />
303
-
304
- <section>
305
- <div class="card checkout-buy">
306
- <div class="eyebrow">Ready when you are</div>
307
- <div class="checkout-total">
308
- <span>Total today</span>
309
- <strong>${order.amount}</strong>
310
- </div>
311
- <button class="btn primary checkout-buy-btn" onClick=${confirm} disabled=${busy}>
312
- ${busy ? html`<span class="spin"></span>` : "Confirm purchase"}
313
- </button>
314
- <div class="tiny faint" style=${{ marginTop: "10px", lineHeight: 1.6 }}>
315
- One click. The next screen shows the account details and your reference to send the transfer.
316
- </div>
317
- </div>
318
-
319
- <div class="checkout-steps">
320
- <div>
321
- <span>1</span>
322
- <div><strong>Confirm purchase</strong><div class="tiny muted">This opens your order and reserves your reference. No money is taken.</div></div>
323
- </div>
324
- <div>
325
- <span>2</span>
326
- <div><strong>Send the transfer</strong><div class="tiny muted">Copy the account details into your bank app.</div></div>
327
- </div>
328
- <div>
329
- <span>3</span>
330
- <div><strong>We switch it on</strong><div class="tiny muted">Every transfer is checked by hand — usually within one working day.</div></div>
331
- </div>
332
- </div>
333
-
334
- <p class="tiny faint" style=${{ marginTop: "12px", lineHeight: 1.6 }}>
335
- ${order.note || "One payment. Nothing renews."}
336
- </p>
337
- </section>
338
- </div>
339
- </main>`;
340
- }
341
-
342
- const paid = order.status === "paid";
343
- return html`<main class="page">
344
- <div class="row between wrap" style=${{ alignItems: "flex-end" }}>
345
- <div>
346
- <div class="eyebrow">${paid ? "Paid" : "Order confirmed"}</div>
347
- <h1 class="page-title">${paid ? "Your plan is active" : "One transfer to go"}</h1>
348
- <p class="subtitle">
349
- ${paid
350
- ? order.planName + " is on your account."
351
- : "Send " + order.amount + " with your reference, and we will switch " + order.planName + " on."}
352
- </p>
353
- </div>
354
- <a class="btn small ghost" href="#/account">My account</a>
355
- </div>
356
-
357
- ${error && html`<div style=${{ marginTop: "12px" }}><${Notice} kind="error">${error}<//></div>`}
358
-
359
- <div class="checkout">
360
- <${OrderSummary} order=${order} plan=${plan} email=${cloud.user.email} showRef />
361
-
362
- <section>
363
- ${paid
364
- ? html`<div class="pay-step">
365
- <div class="pay-step-head">
366
- <span class="pay-step-num"><${Icon} name="check" size=${12} /></span>
367
- <div>
368
- <div class="pay-step-title">Payment confirmed</div>
369
- <div class="tiny muted" style=${{ marginTop: "2px", lineHeight: 1.6 }}>
370
- We checked the transfer and switched your plan on. Nothing else to do.
371
- </div>
372
- </div>
373
- </div>
374
- <div class="row" style=${{ marginTop: "12px" }}><a class="btn small primary" href="#/account">See your plan</a></div>
375
- </div>`
376
- : html`<${TransferDetails} order=${order} copied=${copied} copy=${copy} />
377
- <div class="callout green" style=${{ marginTop: "12px" }}>
378
- <strong>Order confirmed.</strong> Your reference is ${order.reference}. We check every transfer by hand and switch your plan on as soon as it lands — usually within one working day.
379
- </div>`}
380
-
381
- <p class="tiny faint" style=${{ marginTop: "4px", lineHeight: 1.6 }}>
382
- ${order.note || "One payment. Nothing renews."}
383
- </p>
384
- </section>
385
- </div>
386
- </main>`;
387
- }
388
-
389
  export function Pricing() {
390
  const cloud = useCloud();
391
  const [busy, setBusy] = useState("");
@@ -395,14 +91,19 @@ export function Pricing() {
395
  const oneOff = plans.filter((p) => p.kind === "one_time");
396
  const subs = plans.filter((p) => p.kind === "subscription");
397
 
398
- const buy = (plan) => {
399
  setError("");
400
- setBusy("");
401
  if (!cloud.user) {
402
  window.location.hash = "#/account";
403
  return;
404
  }
405
- window.location.hash = "#/pay/" + plan.id;
 
 
 
 
 
 
406
  };
407
 
408
  return html`<main class="page">
@@ -413,7 +114,7 @@ export function Pricing() {
413
  <${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}>
414
  </p>
415
  <div class="price-chips">
416
- <span><${Icon} name="check" size=${12} /> Bank transfer — no card</span>
417
  <span><${Icon} name="check" size=${12} /> One-off options</span>
418
  <span><${Icon} name="check" size=${12} /> Cancel in two taps</span>
419
  <span><${Icon} name="check" size=${12} /> Works offline</span>
 
1
+ import { html, useState } from "./runtime.js";
2
  import { useCloud, money, planPeriod } from "./cloud.js";
3
  import { Copy } from "./copy.js";
4
  import { Icon, Notice, Pill } from "./components.js";
 
82
  </div>`;
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  export function Pricing() {
86
  const cloud = useCloud();
87
  const [busy, setBusy] = useState("");
 
91
  const oneOff = plans.filter((p) => p.kind === "one_time");
92
  const subs = plans.filter((p) => p.kind === "subscription");
93
 
94
+ const buy = async (plan) => {
95
  setError("");
 
96
  if (!cloud.user) {
97
  window.location.hash = "#/account";
98
  return;
99
  }
100
+ setBusy(plan.id);
101
+ try {
102
+ await cloud.startCheckout(plan);
103
+ } catch (err) {
104
+ setError(err && err.message ? err.message : "Checkout could not start.");
105
+ setBusy("");
106
+ }
107
  };
108
 
109
  return html`<main class="page">
 
114
  <${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}>
115
  </p>
116
  <div class="price-chips">
117
+ <span><${Icon} name="check" size=${12} /> No card to start</span>
118
  <span><${Icon} name="check" size=${12} /> One-off options</span>
119
  <span><${Icon} name="check" size=${12} /> Cancel in two taps</span>
120
  <span><${Icon} name="check" size=${12} /> Works offline</span>
js/screens-extra.js CHANGED
@@ -94,7 +94,7 @@ export function ModelAnswers() {
94
  <datalist id="answer-questions">${SUGGESTED_QUESTIONS.map((q) => html`<option key=${q} value=${q}></option>`)}</datalist>
95
  </div>
96
  </div>
97
- ${!engine.canGenerate && html`<div style=${{ marginTop: "10px" }}><${Notice} kind="warn">No model is connected. <a href="#/settings">Open Settings</a> to load a browser model or add an endpoint.<//></div>`}
98
  ${error && html`<div style=${{ marginTop: "10px" }}><${Notice} kind="error">${error}<//></div>`}
99
  <div class="row between" style=${{ marginTop: "12px" }}>
100
  <span class="tiny faint">${app.credits} credits available</span>
@@ -323,11 +323,6 @@ export function Settings() {
323
  const app = useApp();
324
  const engine = useEngine();
325
  const cloud = useCloud();
326
- const [chosenId, setChosenId] = useState("");
327
- const selectedModel =
328
- cloud.models.find((m) => m.id === chosenId) || cloud.models.find((m) => Number(m.min_tier || 0) <= 1) || cloud.models[0] || null;
329
- const modelId = selectedModel ? selectedModel.id : "";
330
- const downloadAllowed = selectedModel ? cloud.canDownload(selectedModel.min_tier) : false;
331
  const [baseUrl, setBaseUrl] = useState(engine.endpoint.baseUrl);
332
  const [endpointModel, setEndpointModel] = useState(engine.endpoint.model);
333
  const [key, setKey] = useState(engine.endpoint.key);
@@ -378,35 +373,39 @@ export function Settings() {
378
  <div class="divider"></div>
379
  <div class="row between">
380
  <div>
381
- <div style=${{ fontWeight: 600 }}>Browser model <span class="tiny faint">WebGPU</span></div>
382
- <div class="tiny faint" style=${{ marginTop: "3px" }}>
383
- ${engine.webgpu ? "This browser can run a model locally. The weights download once, then work offline." : "This browser does not expose WebGPU, so a local model cannot run here. Use an endpoint below, or keep using rule-based review."}
384
  </div>
385
  </div>
386
- <${Pill} tone=${engine.webgpu ? "green" : "neutral"}>${engine.webgpu ? "Available" : "Unavailable"}</${Pill}>
387
  </div>
388
- ${engine.webgpu &&
389
- html`<div class="row wrap" style=${{ marginTop: "10px" }}>
390
- <select class="select" style=${{ maxWidth: "300px" }} value=${modelId} onChange=${(e) => setChosenId(e.target.value)}>
391
- ${cloud.models.filter((m) => m.enabled !== false).map(
392
- (m) => html`<option key=${m.id} value=${m.id}>${m.name} · ${m.download_size}${cloud.canDownload(m.min_tier) ? "" : " · needs a plan"}</option>`
393
- )}
394
- </select>
395
- <button class="btn" onClick=${() => engine.load(modelId)} disabled=${engine.status === "loading" || !downloadAllowed}>
396
- ${engine.status === "loading" ? html`<span class="spin"></span>` : html`<${Icon} name=${downloadAllowed ? "download" : "lock"} size=${13} />`} ${engine.status === "ready" ? "Reload" : "Load model"}
397
- </button>
398
- ${engine.status === "ready" && html`<button class="btn ghost" onClick=${engine.unload}>Unload</button>`}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  </div>
400
- ${!downloadAllowed &&
401
- html`<div class="tiny" style=${{ marginTop: "6px", color: "var(--warning)" }}>
402
- ${selectedModel ? selectedModel.name : "This model"} is part of a paid plan. <a href="#/pricing">See plans</a>
403
- </div>`}`}
404
- ${engine.status === "loading" &&
405
- html`<div style=${{ marginTop: "10px" }}>
406
- <div class="bar"><i style=${{ width: Math.round(engine.progress * 100) + "%" }}></i></div>
407
- <div class="tiny faint" style=${{ marginTop: "4px" }}>${engine.progressText || "Loading…"}</div>
408
- </div>`}
409
- ${engine.error && html`<div style=${{ marginTop: "10px" }}><${Notice} kind="error">${engine.error}<//></div>`}
410
 
411
  <div class="divider"></div>
412
  <div style=${{ fontWeight: 600 }}>Your OpenAI-compatible endpoint</div>
 
94
  <datalist id="answer-questions">${SUGGESTED_QUESTIONS.map((q) => html`<option key=${q} value=${q}></option>`)}</datalist>
95
  </div>
96
  </div>
97
+ ${!engine.canGenerate && html`<div style=${{ marginTop: "10px" }}><${Notice} kind="warn">No model is connected. <a href="#/settings">Open Settings</a> to download a Paragraph model or add an endpoint.<//></div>`}
98
  ${error && html`<div style=${{ marginTop: "10px" }}><${Notice} kind="error">${error}<//></div>`}
99
  <div class="row between" style=${{ marginTop: "12px" }}>
100
  <span class="tiny faint">${app.credits} credits available</span>
 
323
  const app = useApp();
324
  const engine = useEngine();
325
  const cloud = useCloud();
 
 
 
 
 
326
  const [baseUrl, setBaseUrl] = useState(engine.endpoint.baseUrl);
327
  const [endpointModel, setEndpointModel] = useState(engine.endpoint.model);
328
  const [key, setKey] = useState(engine.endpoint.key);
 
373
  <div class="divider"></div>
374
  <div class="row between">
375
  <div>
376
+ <div style=${{ fontWeight: 600 }}>Paragraph models <span class="tiny faint">offline</span></div>
377
+ <div class="tiny faint" style=${{ maxWidth: "560px", marginTop: "3px", lineHeight: 1.55 }}>
378
+ The real Paragraph family, published by quantilimited. Download a model once and run it in the Mac or iOS app, or any GGUF runner. The weights are not loaded in this browser tab.
379
  </div>
380
  </div>
381
+ <${Pill} tone="green">${cloud.models.filter((m) => m.enabled !== false).length} models</${Pill}>
382
  </div>
383
+ <div class="grid two" style=${{ marginTop: "12px" }}>
384
+ ${cloud.models
385
+ .filter((m) => m.enabled !== false)
386
+ .map((m) => {
387
+ const allowed = cloud.canDownload(m.min_tier);
388
+ return html`<div class="card" style=${{ padding: "12px" }}>
389
+ <div class="row between">
390
+ <div style=${{ fontWeight: 600 }}>${m.name}</div>
391
+ <span class="pill neutral">Tier ${m.min_tier}</span>
392
+ </div>
393
+ <div class="tiny faint" style=${{ marginTop: "2px" }}>${m.base_model || m.model_name}${m.params ? " · " + m.params : ""}</div>
394
+ <div class="tiny faint" style=${{ marginTop: "2px" }}>
395
+ ${m.download_size}${m.format ? " · " + m.format : ""}${m.essays ? " · " + m.essays + " essays" : ""}
396
+ </div>
397
+ <p class="tiny faint" style=${{ marginTop: "6px", lineHeight: 1.5 }}>${m.note}</p>
398
+ <div class="row wrap" style=${{ gap: "8px", marginTop: "8px" }}>
399
+ ${m.card_url && html`<a class="btn small" href=${m.card_url} target="_blank" rel="noopener">Model card</a>`}
400
+ ${m.download_url
401
+ ? allowed
402
+ ? html`<a class="btn small primary" href=${m.download_url} target="_blank" rel="noopener"><${Icon} name="download" size=${12} /> Download</a>`
403
+ : html`<span class="tiny faint"><${Icon} name="lock" size=${12} /> Included in a plan · <a href="#/pricing">See plans</a></span>`
404
+ : html`<span class="tiny faint">Safetensors only — no GGUF build yet</span>`}
405
+ </div>
406
+ </div>`;
407
+ })}
408
  </div>
 
 
 
 
 
 
 
 
 
 
409
 
410
  <div class="divider"></div>
411
  <div style=${{ fontWeight: 600 }}>Your OpenAI-compatible endpoint</div>
js/screens.js CHANGED
@@ -1,6 +1,6 @@
1
  import { React, html, useEffect, useMemo, useRef, useState } from "./runtime.js";
2
  import { useApp } from "./store.js";
3
- import { useEngine, WEB_MODELS } from "./engine.js";
4
  import { Copy } from "./copy.js";
5
  import {
6
  Mark,
@@ -79,8 +79,8 @@ function EngineHint({ compact = false }) {
79
  return html`<${Notice} kind="info">Model connected — ${engine.hasEndpoint ? "using your endpoint." : "running in this browser."} Chat and model answers are available.<//>`;
80
  }
81
  return html`<${Notice} kind="warn">
82
- AI chat and model answers need a model. ${engine.webgpu ? "Load a browser model" : "This browser has no WebGPU"}${" "}
83
- <a href="#/settings">in Settings</a> or connect an OpenAI-compatible endpoint. The marking tools below work without one.
84
  <//>`;
85
  }
86
 
@@ -136,7 +136,7 @@ export function Dashboard({ onNavigate }) {
136
  <div class="row" style=${{ gap: "7px" }}><i style=${{ width: 6, height: 6, borderRadius: "50%", background: engine.canGenerate ? "var(--success)" : "var(--warning)" }}></i>
137
  <span class="mini-label" style=${{ color: "var(--secondary)" }}>${engine.canGenerate ? "Model connected" : "Rule-based review"}</span>
138
  </div>
139
- <div style=${{ fontWeight: 600, marginTop: "6px" }}>${engine.hasEndpoint ? "Your endpoint" : engine.status === "ready" ? "Browser model" : "Marks in this browser"}</div>
140
  <div class="tiny faint" style=${{ marginTop: "2px", lineHeight: 1.5 }}>
141
  ${engine.canGenerate
142
  ? "Chat, model answers and AI suggestions are available. Marking still checks the rubric point by point."
 
1
  import { React, html, useEffect, useMemo, useRef, useState } from "./runtime.js";
2
  import { useApp } from "./store.js";
3
+ import { useEngine } from "./engine.js";
4
  import { Copy } from "./copy.js";
5
  import {
6
  Mark,
 
79
  return html`<${Notice} kind="info">Model connected — ${engine.hasEndpoint ? "using your endpoint." : "running in this browser."} Chat and model answers are available.<//>`;
80
  }
81
  return html`<${Notice} kind="warn">
82
+ AI chat and model answers need a model. Download a Paragraph model in
83
+ <a href="#/settings">Settings</a> to run it on your own machine, or connect an OpenAI-compatible endpoint. The marking tools below work without one.
84
  <//>`;
85
  }
86
 
 
136
  <div class="row" style=${{ gap: "7px" }}><i style=${{ width: 6, height: 6, borderRadius: "50%", background: engine.canGenerate ? "var(--success)" : "var(--warning)" }}></i>
137
  <span class="mini-label" style=${{ color: "var(--secondary)" }}>${engine.canGenerate ? "Model connected" : "Rule-based review"}</span>
138
  </div>
139
+ <div style=${{ fontWeight: 600, marginTop: "6px" }}>${engine.hasEndpoint ? "Your endpoint" : engine.hostedReady ? "Hosted model" : "Marks in this browser"}</div>
140
  <div class="tiny faint" style=${{ marginTop: "2px", lineHeight: 1.5 }}>
141
  ${engine.canGenerate
142
  ? "Chat, model answers and AI suggestions are available. Marking still checks the rubric point by point."
schema.sql CHANGED
@@ -254,18 +254,3 @@ on conflict (id) do update set
254
  sort = excluded.sort,
255
  active = excluded.active,
256
  updated_at = now();
257
-
258
- -- ---------------------------------------------------------------------------
259
- -- Grants
260
- -- ---------------------------------------------------------------------------
261
- -- Supabase's API roles need table privileges before row-level security can do
262
- -- its job. Without these, the REST API answers 401/42501 even though the
263
- -- policies are right.
264
-
265
- grant usage on schema public to anon, authenticated, service_role;
266
- grant all on all tables in schema public to anon, authenticated, service_role;
267
- grant all on all sequences in schema public to anon, authenticated, service_role;
268
- grant all on all functions in schema public to anon, authenticated, service_role;
269
- alter default privileges in schema public grant all on tables to anon, authenticated, service_role;
270
- alter default privileges in schema public grant all on sequences to anon, authenticated, service_role;
271
- alter default privileges in schema public grant all on functions to anon, authenticated, service_role;
 
254
  sort = excluded.sort,
255
  active = excluded.active,
256
  updated_at = now();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
style.css DELETED
@@ -1,28 +0,0 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
styles.css CHANGED
@@ -430,172 +430,3 @@ a { color: var(--accent); text-decoration: none; }
430
  .price-title { font-size: 33px; }
431
  .price-lede { font-size: 13px; }
432
  }
433
-
434
- /* ---------- Checkout ---------- */
435
- .checkout {
436
- display: grid;
437
- grid-template-columns: 310px minmax(0, 1fr);
438
- gap: 16px;
439
- align-items: start;
440
- margin-top: 16px;
441
- }
442
- .checkout-summary { position: sticky; top: 70px; }
443
- .checkout-plan {
444
- font-family: var(--serif);
445
- font-size: 22px;
446
- font-weight: 600;
447
- letter-spacing: -.02em;
448
- margin-top: 8px;
449
- }
450
- .checkout-price {
451
- font-size: 29px;
452
- font-weight: 600;
453
- letter-spacing: -.02em;
454
- margin-top: 2px;
455
- }
456
- .checkout-price span {
457
- font-size: 12px;
458
- font-weight: 500;
459
- color: var(--faint);
460
- letter-spacing: 0;
461
- }
462
- .pay-step {
463
- border: 1px solid var(--hairline);
464
- border-radius: 14px;
465
- background: #fff;
466
- padding: 16px;
467
- margin-bottom: 12px;
468
- }
469
- .pay-step-head { display: flex; gap: 10px; align-items: flex-start; }
470
- .pay-step-num {
471
- width: 22px;
472
- height: 22px;
473
- border-radius: 50%;
474
- background: var(--accent-soft);
475
- color: var(--accent);
476
- display: grid;
477
- place-items: center;
478
- font-size: 11px;
479
- font-weight: 700;
480
- flex: none;
481
- }
482
- .pay-step-title {
483
- font-family: var(--serif);
484
- font-size: 16px;
485
- font-weight: 600;
486
- letter-spacing: -.01em;
487
- }
488
- .pay-grid {
489
- display: grid;
490
- grid-template-columns: repeat(3, minmax(0, 1fr));
491
- gap: 8px;
492
- margin-top: 14px;
493
- }
494
- .pay-field {
495
- border: 1px solid var(--hairline);
496
- border-radius: 10px;
497
- padding: 9px 11px;
498
- background: var(--deep);
499
- min-width: 0;
500
- }
501
- .pay-field .lab {
502
- display: block;
503
- font-size: 9px;
504
- letter-spacing: .07em;
505
- text-transform: uppercase;
506
- color: var(--faint);
507
- font-weight: 700;
508
- }
509
- .pay-field .val {
510
- display: block;
511
- font-family: var(--mono);
512
- font-size: 13px;
513
- font-weight: 600;
514
- margin-top: 3px;
515
- overflow: hidden;
516
- text-overflow: ellipsis;
517
- }
518
- .pay-ref {
519
- display: flex;
520
- align-items: center;
521
- justify-content: space-between;
522
- gap: 10px;
523
- margin-top: 10px;
524
- padding: 11px 12px;
525
- border: 1px dashed #cfdcd4;
526
- background: #fbfdfb;
527
- border-radius: 10px;
528
- }
529
- .pay-ref .lab {
530
- display: block;
531
- font-size: 9px;
532
- letter-spacing: .07em;
533
- text-transform: uppercase;
534
- color: var(--faint);
535
- font-weight: 700;
536
- }
537
- .pay-ref .val {
538
- font-family: var(--mono);
539
- font-size: 15px;
540
- font-weight: 700;
541
- letter-spacing: .04em;
542
- }
543
- @media (max-width: 900px) {
544
- .checkout { grid-template-columns: 1fr; }
545
- .checkout-summary { position: static; }
546
- .pay-grid { grid-template-columns: 1fr 1fr; }
547
- }
548
- @media (max-width: 520px) {
549
- .pay-grid { grid-template-columns: 1fr; }
550
- }
551
-
552
- /* Two-click checkout */
553
- .checkout-buy { padding: 18px; }
554
- .checkout-total {
555
- display: flex;
556
- align-items: baseline;
557
- justify-content: space-between;
558
- gap: 12px;
559
- margin: 4px 0 14px;
560
- }
561
- .checkout-total span {
562
- font-size: 10px;
563
- letter-spacing: .08em;
564
- text-transform: uppercase;
565
- color: var(--faint);
566
- font-weight: 700;
567
- }
568
- .checkout-total strong {
569
- font-size: 30px;
570
- font-weight: 650;
571
- letter-spacing: -.02em;
572
- }
573
- .checkout-buy-btn {
574
- width: 100%;
575
- padding: 13px 18px;
576
- font-size: 15px;
577
- }
578
- .checkout-steps {
579
- display: grid;
580
- gap: 12px;
581
- margin-top: 16px;
582
- padding: 0 2px;
583
- }
584
- .checkout-steps > div {
585
- display: flex;
586
- gap: 10px;
587
- align-items: flex-start;
588
- }
589
- .checkout-steps > div > span {
590
- width: 22px;
591
- height: 22px;
592
- border-radius: 50%;
593
- border: 1px solid var(--hairline);
594
- display: inline-flex;
595
- align-items: center;
596
- justify-content: center;
597
- font-size: 11px;
598
- font-weight: 700;
599
- flex: none;
600
- }
601
- .checkout-steps strong { font-size: 13px; font-weight: 600; }
 
430
  .price-title { font-size: 33px; }
431
  .price-lede { font-size: 13px; }
432
  }