1 import { PassCrypto } from '@proton/pass/lib/crypto';
2 import type { ShareItem } from '@proton/pass/store/reducers';
3 import { type Share, ShareRole, ShareType } from '@proton/pass/types';
5 export const isActiveVault = <T extends Share>({ targetType, shareId }: T) =>
6 targetType === ShareType.Vault && PassCrypto.canOpenShare(shareId);
8 export const isWritableVault = <T extends Share>({ targetType, shareRoleId }: T) =>
9 targetType === ShareType.Vault && shareRoleId !== ShareRole.READ;
11 export const isOwnVault = <T extends Share>({ targetType, owner }: T) => targetType === ShareType.Vault && owner;
13 export const isSharedVault = <T extends Share>({ targetType, shared }: T) => targetType === ShareType.Vault && shared;
15 export const isVaultMemberLimitReached = ({
20 }: ShareItem) => invites.length + members.length + newUserInvites.length >= targetMaxMembers;
22 export const hasNewUserInvitesReady = (vault: ShareItem<ShareType.Vault>) => vault.newUserInvitesReady > 0;