Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | 3x 3x 3x 3x 15x 15x 15x 13x 2x 8x 8x 8x 8x 1x 7x 7x 7x 7x | /** @typedef {"free" | "basic" | "intermediate" | "premium"} PlanType */
import { alpha } from "@mui/material/styles";
/** @type {Record<PlanType, number>} */
export const PLAN_ORDER = {
free: 0,
basic: 1,
intermediate: 2,
premium: 3,
};
/** @type {Record<PlanType, { label: string; summary: string }>} */
export const PLAN_DISPLAY = {
free: {
label: "Free",
summary: "STAAR/TSI/SAT/ACT slot 1",
},
basic: {
label: "Basic",
summary: "Free tier plus additional exam slots",
},
intermediate: {
label: "Intermediate",
summary: "Basic plus Item Analysis and teacher-made tests (10)",
},
premium: {
label: "Premium",
summary: "Full product including dashboard, slot 6, and unlimited tests",
},
};
/** Tier palette — used for badges and plan card accents */
export const PLAN_COLORS = {
free: { main: "#64748b", dark: "#334155", light: "#94a3b8", contrastText: "#ffffff" },
basic: { main: "#0288d1", dark: "#01579b", light: "#4fc3f7", contrastText: "#ffffff" },
intermediate: { main: "#7c4dff", dark: "#4527a0", light: "#b388ff", contrastText: "#ffffff" },
premium: { main: "#ed6c02", dark: "#e65100", light: "#ffb74d", contrastText: "#ffffff" },
};
/** Maps legacy district plan keys to current GrowthBook tiers. */
export const LEGACY_PLAN_ALIASES = {
starter: "basic",
professional: "intermediate",
enterprise: "premium",
};
/**
* @param {string | undefined} planType
* @returns {PlanType}
*/
export function normalizePlanType(planType) {
const key = (planType || "free").toLowerCase();
const mapped = LEGACY_PLAN_ALIASES[key] ?? key;
if (mapped in PLAN_COLORS) {
return /** @type {PlanType} */ (mapped);
}
return "free";
}
/**
* Soft tier badge styles for Chip components (soft variant).
* @param {import("@mui/material/styles").Theme} theme
* @param {string | undefined} planType
* @param {"soft" | "solid"} [variant]
*/
export function getPlanBadgeSx(theme, planType, variant = "soft") {
const key = normalizePlanType(planType);
const colors = PLAN_COLORS[key];
const isDark = theme.palette.mode === "dark";
if (variant === "solid") {
return {
height: 26,
fontSize: "0.75rem",
fontWeight: 700,
letterSpacing: 0.2,
borderRadius: 9999,
fontFamily: theme.typography.fontFamily,
bgcolor: alpha(colors.main, isDark ? 0.32 : 0.16),
color: isDark ? colors.light : colors.dark,
border: "none",
boxShadow: "none",
"& .MuiChip-label": { px: 1.5 },
};
}
return {
height: 26,
fontSize: "0.75rem",
fontWeight: 600,
letterSpacing: 0.15,
borderRadius: 9999,
fontFamily: theme.typography.fontFamily,
bgcolor: alpha(colors.main, isDark ? 0.22 : 0.12),
color: isDark ? colors.light : colors.dark,
border: "none",
boxShadow: "none",
"& .MuiChip-label": { px: 1.25 },
};
}
/**
* @param {string | undefined} planType
* @returns {string}
*/
export function formatPlanLabel(planType) {
Iif (!planType) {
return "—";
}
const key = normalizePlanType(planType);
return PLAN_DISPLAY[key]?.label ?? planType.charAt(0).toUpperCase() + planType.slice(1);
}
|