Use same lock values as mobile clients
[ProtonMail-WebClient.git] / packages / shared / lib / helpers / filters.ts
bloba258e05f546d360b255c2ae915323c3c9801501b
1 import type { Filter } from '@proton/components/containers/filters/interfaces';
2 import { FILTER_STATUS, FREE_USER_ACTIVE_FILTERS_LIMIT } from '@proton/shared/lib/constants';
3 import type { UserModel } from '@proton/shared/lib/interfaces';
5 export const hasReachedFiltersLimit = (user: UserModel, userFilters: Filter[]) => {
6     const { hasPaidMail } = user;
8     const enabledFilters = userFilters.filter((filter) => filter.Status === FILTER_STATUS.ENABLED);
10     return !hasPaidMail && enabledFilters.length >= FREE_USER_ACTIVE_FILTERS_LIMIT;