The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/lib/getUpgradeTabType.ts

38 lines
760 B

export type UpgradeTabVariant = 'goFullyFeatured' | 'goFullyFeaturedRegistered' | 'trialGold' | 'trialEnterprise' | 'upgradeYourPlan';
type UpgradeTabConditions = {
registered: boolean;
hasValidLicense: boolean;
isTrial: boolean;
hadExpiredTrials: boolean;
hasGoldLicense: boolean;
};
export const getUpgradeTabType = ({
registered,
hasValidLicense,
isTrial,
hasGoldLicense,
hadExpiredTrials,
}: UpgradeTabConditions): UpgradeTabVariant | false => {
if (!hasValidLicense) {
if (hadExpiredTrials) {
return 'upgradeYourPlan';
}
if (registered) {
return 'goFullyFeaturedRegistered';
}
return 'goFullyFeatured';
}
if (isTrial) {
if (hasGoldLicense) {
return 'trialGold';
}
return 'trialEnterprise';
}
return false;
};