Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / pass / hooks / usePlanFeatures.ts
blob82b8714f0b1900f83f16594b132f1b5fb78550a0
1 import { useMemo } from 'react';
2 import { useSelector } from 'react-redux';
4 import { getPlanFeatures } from '@proton/pass/components/Monitor/utils';
5 import type { UpsellType } from '@proton/pass/components/Upsell/UpsellingModal';
6 import type { FeatureType } from '@proton/pass/components/Upsell/types';
7 import { selectPassPlan } from '@proton/pass/store/selectors';
8 import { UserPassPlan } from '@proton/pass/types/api/plan';
10 type UpsellPlanFeatures = {
11     features: FeatureType[];
12     upsellType: UpsellType;
13     upgradePath: string;
16 export const useUpsellPlanFeatures = () => {
17     const plan = useSelector(selectPassPlan);
18     const planFeatures = useMemo(() => getPlanFeatures(), []);
20     return useMemo(() => {
21         const { features, upsellType, upgradePath }: UpsellPlanFeatures =
22             plan === UserPassPlan.BUSINESS
23                 ? {
24                       features: planFeatures.business,
25                       upsellType: 'pass-monitor-business',
26                       upgradePath: 'pass/signup/business',
27                   }
28                 : { features: planFeatures.individuals, upsellType: 'pass-monitor', upgradePath: 'pass/signup' };
30         return { plan, features, upsellType, upgradePath };
31     }, [plan]);