// Server-side contribution config. // Parallel to app/config/contributions.js but also hosts getHelcimPlanId, // which is server-only (depends on runtime config). export const CONTRIBUTION_PRESETS = [ { amount: 0, label: "I need support right now" }, { amount: 5, label: "I can contribute" }, { amount: 15, label: "I can sustain the community" }, { amount: 30, label: "I can support others too" }, { amount: 50, label: "I want to sponsor multiple members" }, ] export const requiresPayment = (amount) => amount > 0 export const isValidContributionAmount = (amount) => Number.isInteger(amount) && amount >= 0 export const getGuidanceLabel = (amount) => { if (amount === null || amount === undefined) return null const n = Number(amount) if (!Number.isFinite(n) || n < 0) return null const match = CONTRIBUTION_PRESETS.findLast(p => p.amount <= n) return match?.label ?? null } // Cadence-keyed plan-id lookup. Unrelated to the tier concept. export function getHelcimPlanId(cadence) { const config = useRuntimeConfig() if (cadence === 'annual') return config.helcimAnnualPlanId || null return config.helcimMonthlyPlanId || null }