Billing tiers on the install page, plan picker on licences (1.6.2)
- Install page shows the 12-month event-income band (Cross Events 2.0.2+), the tier it falls in with its price and founding price, and flags a licence whose plan is a different tier. - Licence card: Plan picker (Trial or Seed to Network). - Protocol doc: 14 income bands and eventIncome12m. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import { ArrowLeft } from "lucide-react";
|
||||
import { api, errorText } from "@/lib/api";
|
||||
import { ago, bytes, fmtDate, rand, randFine } from "@/lib/format";
|
||||
import { usePaged } from "@/lib/paging";
|
||||
import { tierForBand, tierPrice } from "@/lib/tiers";
|
||||
import type { AiHelperUse, AiMonth, AiStatus, Health, InstallEvent, InstallSummary, Licence, Stats } from "@/lib/types";
|
||||
import { Badge, Loading, Message, PageTitle, Pager } from "@/components/ui";
|
||||
|
||||
@@ -43,6 +44,7 @@ export default function InstallPage() {
|
||||
if (!d) return msg ? <Message msg={msg} /> : <Loading />;
|
||||
const h = d.health || {};
|
||||
const s = d.stats || {};
|
||||
const tier = tierForBand(s.income?.eventIncome12m);
|
||||
const diskPct = h.disk && h.disk.totalBytes ? Math.round((h.disk.freeBytes / h.disk.totalBytes) * 100) : null;
|
||||
// One point per day for the last 30 days: registrations in the last 30 days, as reported.
|
||||
const daily = new Map<string, number>();
|
||||
@@ -94,7 +96,7 @@ export default function InstallPage() {
|
||||
<Row k="Tickets (30 days / total)" v={s.tickets ? `${s.tickets.last30d ?? 0} / ${s.tickets.total ?? 0}` : "—"} />
|
||||
<Row k="Check-ins (30 days)" v={s.checkIns?.last30d ?? "—"} />
|
||||
<Row k="Messages (30 days)" v={s.messages ? `${s.messages.email30d ?? 0} email, ${s.messages.whatsapp30d ?? 0} WhatsApp` : "—"} />
|
||||
<Row k="Income (30 days / all time)" v={s.income ? `${s.income.last30d || "—"} / ${s.income.allTime || "—"}` : "—"} />
|
||||
<Row k="Income (30 days / all time, with donations)" v={s.income ? `${s.income.last30d || "—"} / ${s.income.allTime || "—"}` : "—"} />
|
||||
<Row k="Payment providers" v={s.paymentProviders?.join(", ") || "—"} />
|
||||
<Row k="Campuses" v={s.campuses == null ? "—" : s.campuses ? `On${s.campusCount != null ? ` — ${s.campusCount} active` : ""}` : "Off"} />
|
||||
{points.length > 1 && (
|
||||
@@ -115,6 +117,14 @@ export default function InstallPage() {
|
||||
<Row k="Status" v={<Badge value={d.licence.status} />} />
|
||||
<Row k="Expires" v={d.licence.expiresAt ? fmtDate(d.licence.expiresAt, false) : "no end date"} />
|
||||
<Row k="Grace" v={`${d.licence.graceDays} days`} />
|
||||
<Row k="Plan" v={d.licence.plan || "—"} />
|
||||
<Row k="Event income (12 months)" v={s.income?.eventIncome12m || "not sent (Cross Events before 2.0.2)"} />
|
||||
{tier && (
|
||||
<Row
|
||||
k="Tier for that income"
|
||||
v={<>{tier.name} · {tierPrice(tier)}{d.licence.plan !== tier.name && d.licence.plan !== "Trial" && <span className="ml-1 text-amber-700">(plan is {d.licence.plan})</span>}</>}
|
||||
/>
|
||||
)}
|
||||
<Row k="AI cap" v={d.licence.aiMonthlyCapCents ? `${rand(d.licence.aiMonthlyCapCents)} / month` : "off"} />
|
||||
<Row k="AI markup" v={d.licence.aiMarkupPercent == null ? "default" : `${d.licence.aiMarkupPercent}%`} />
|
||||
<Link href={`/customers/${d.customer.id}`} className="mt-3 inline-block text-sm text-indigo-600 hover:underline">Change the licence →</Link>
|
||||
|
||||
Reference in New Issue
Block a user