in shared/productResponse.ts [257:279]
export const getMainPlan: (subscription: Subscription) => SubscriptionPlan = (
subscription: Subscription,
) => {
if (subscription.currentPlans.length > 0) {
if (subscription.currentPlans.length > 1) {
Sentry.captureException(
"User with more than one 'current plan' for a given subscription",
);
}
return subscription.currentPlans[0];
} else if (subscription.futurePlans.length > 0) {
// fallback to use the first future plan (contributions for example are always future plans)
return subscription.futurePlans[0];
}
return {
name: null,
start: subscription.start,
shouldBeVisible: true,
currency: subscription.plan?.currency,
currencyISO: subscription.plan?.currencyISO,
billingPeriod: subscription.plan?.billingPeriod,
};
};