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;
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
24 features: planFeatures.business,
25 upsellType: 'pass-monitor-business',
26 upgradePath: 'pass/signup/business',
28 : { features: planFeatures.individuals, upsellType: 'pass-monitor', upgradePath: 'pass/signup' };
30 return { plan, features, upsellType, upgradePath };