82 lines
2.3 KiB
JavaScript
82 lines
2.3 KiB
JavaScript
// Central configuration for Ghost Guild Contribution Levels and Helcim Plans
|
|
export const CONTRIBUTION_TIERS = {
|
|
FREE: {
|
|
value: "0",
|
|
amount: 0,
|
|
label: "$0 - I need support right now",
|
|
tier: "free",
|
|
helcimPlanId: null, // No Helcim plan needed for free tier
|
|
},
|
|
SUPPORTER: {
|
|
value: "5",
|
|
amount: 5,
|
|
label: "$5 - I can contribute",
|
|
tier: "supporter",
|
|
helcimPlanId: "supporter-monthly-5",
|
|
},
|
|
MEMBER: {
|
|
value: "15",
|
|
amount: 15,
|
|
label: "$15 - I can sustain the community",
|
|
tier: "member",
|
|
helcimPlanId: "member-monthly-15",
|
|
},
|
|
ADVOCATE: {
|
|
value: "30",
|
|
amount: 30,
|
|
label: "$30 - I can support others too",
|
|
tier: "advocate",
|
|
helcimPlanId: "advocate-monthly-30",
|
|
},
|
|
CHAMPION: {
|
|
value: "50",
|
|
amount: 50,
|
|
label: "$50 - I want to sponsor multiple members",
|
|
tier: "champion",
|
|
helcimPlanId: "champion-monthly-50",
|
|
},
|
|
};
|
|
|
|
// Get all contribution options as an array (useful for forms)
|
|
export const getContributionOptions = () => {
|
|
return Object.values(CONTRIBUTION_TIERS);
|
|
};
|
|
|
|
// Get valid contribution values for validation
|
|
export const getValidContributionValues = () => {
|
|
return Object.values(CONTRIBUTION_TIERS).map((tier) => tier.value);
|
|
};
|
|
|
|
// Get contribution tier by value
|
|
export const getContributionTierByValue = (value) => {
|
|
return Object.values(CONTRIBUTION_TIERS).find((tier) => tier.value === value);
|
|
};
|
|
|
|
// Get Helcim plan ID for a contribution tier
|
|
export const getHelcimPlanId = (contributionValue) => {
|
|
const tier = getContributionTierByValue(contributionValue);
|
|
return tier?.helcimPlanId || null;
|
|
};
|
|
|
|
// Check if a contribution tier requires payment
|
|
export const requiresPayment = (contributionValue) => {
|
|
const tier = getContributionTierByValue(contributionValue);
|
|
return tier?.amount > 0;
|
|
};
|
|
|
|
// Check if a contribution value is valid
|
|
export const isValidContributionValue = (value) => {
|
|
return getValidContributionValues().includes(value);
|
|
};
|
|
|
|
// Get contribution tier by Helcim plan ID
|
|
export const getContributionTierByHelcimPlan = (helcimPlanId) => {
|
|
return Object.values(CONTRIBUTION_TIERS).find(
|
|
(tier) => tier.helcimPlanId === helcimPlanId,
|
|
);
|
|
};
|
|
|
|
// Get paid tiers only (excluding free tier)
|
|
export const getPaidContributionTiers = () => {
|
|
return Object.values(CONTRIBUTION_TIERS).filter((tier) => tier.amount > 0);
|
|
};
|