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:
@@ -0,0 +1,44 @@
|
||||
// Cross Events licence tiers, billed on a site's event income over the last 12 months (the
|
||||
// `eventIncome12m` band, Cross Events 2.0.2+). The public prices are in crosscode-site
|
||||
// src/data/pricing.mjs: change both together. Every tier edge is also a band edge on the install
|
||||
// (BAND_TOPS in hope-events backend/src/hub/report.js), so a band always falls in one tier.
|
||||
|
||||
export type Tier = { name: string; upTo: number | null; monthly: number | null; founding: number | null };
|
||||
|
||||
export const TIERS: Tier[] = [
|
||||
{ name: "Seed", upTo: 50_000, monthly: 350, founding: 230 },
|
||||
{ name: "Sprout", upTo: 150_000, monthly: 550, founding: 360 },
|
||||
{ name: "Grow", upTo: 400_000, monthly: 850, founding: 550 },
|
||||
{ name: "Flourish", upTo: 1_000_000, monthly: 1350, founding: 880 },
|
||||
{ name: "Harvest", upTo: 2_500_000, monthly: 2100, founding: 1370 },
|
||||
{ name: "Abundance", upTo: 5_000_000, monthly: 3200, founding: 2080 },
|
||||
{ name: "Movement", upTo: 10_000_000, monthly: 4800, founding: 3120 },
|
||||
{ name: "Network", upTo: null, monthly: null, founding: null }, // priced per church, from R7 500
|
||||
];
|
||||
|
||||
/** Licence plans offered on a licence: the tiers, plus a trial. */
|
||||
export const PLANS = ["Trial", ...TIERS.map(t => t.name)];
|
||||
|
||||
/** The highest rand amount in a band label ("R100 001–R150 000" → 150000; "over R10 000 000" → Infinity). */
|
||||
function bandTop(band: string): number | null {
|
||||
if (/^over /i.test(band)) return Infinity;
|
||||
const parts = band.split("–");
|
||||
if (parts.length !== 2) return null;
|
||||
const n = Number(parts[1].replace(/[^\d]/g, ""));
|
||||
return Number.isFinite(n) && parts[1].trim() !== "" ? n : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The tier a band falls in, or null when it can't tell. An older install's "over R100 000" can't
|
||||
* be placed (it could be any tier from Sprout up).
|
||||
*/
|
||||
export function tierForBand(band: string | null | undefined): Tier | null {
|
||||
if (!band) return null;
|
||||
if (band === "over R100 000") return null;
|
||||
const top = bandTop(band);
|
||||
if (top == null) return null;
|
||||
return TIERS.find(t => t.upTo == null || top <= t.upTo) || null;
|
||||
}
|
||||
|
||||
export const tierPrice = (t: Tier) =>
|
||||
t.monthly == null ? "priced per church" : `R${t.monthly.toLocaleString("en-ZA")}/month (founding R${t.founding?.toLocaleString("en-ZA")})`;
|
||||
@@ -61,7 +61,7 @@ export type Stats = {
|
||||
paymentProviders?: string[];
|
||||
campuses?: boolean;
|
||||
campusCount?: number;
|
||||
income?: { last30d?: string; allTime?: string };
|
||||
income?: { last30d?: string; allTime?: string; eventIncome12m?: string };
|
||||
};
|
||||
|
||||
export type InstallEvent = { id: string; type: string; level: Problem["level"]; message: string; createdAt: string; resolvedAt: string | null; install?: { id: string; name: string; url: string } };
|
||||
|
||||
Reference in New Issue
Block a user