latex-ub/services/web/frontend/js/features/subscription/util/show-downgrade-option.ts
2025-05-05 12:24:05 +00:00

18 lines
522 B
TypeScript

import { Nullable } from '../../../../../types/utils'
import isInFreeTrial from './is-in-free-trial'
import isMonthlyCollaboratorPlan from './is-monthly-collaborator-plan'
export default function showDowngradeOption(
planCode: string,
isGroupPlan?: boolean,
trialEndsAt?: string | null,
pausedAt?: Nullable<string>,
remainingPauseCycles?: Nullable<number>
) {
return (
!pausedAt &&
!remainingPauseCycles &&
isMonthlyCollaboratorPlan(planCode, isGroupPlan) &&
!isInFreeTrial(trialEndsAt)
)
}