1 import type { ShareItem } from '@proton/pass/store/reducers';
2 import type { Share, ShareGetResponse } from '@proton/pass/types';
3 import { ShareRole, ShareType } from '@proton/pass/types';
5 /* overload for subtypes */
6 export function isVaultShare(share: ShareItem): share is ShareItem<ShareType.Vault>;
7 export function isVaultShare(share: Share): share is Share<ShareType.Vault> {
8 return share.targetType === ShareType.Vault;
11 export const isShareManageable = <T extends Share>(share: T) => share.owner || share.shareRoleId === ShareRole.ADMIN;
13 export const hasShareAccessChanged = (current: Share, incoming: ShareGetResponse) =>
14 current.owner !== incoming.Owner ||
15 current.shareRoleId !== incoming.ShareRoleID ||
16 current.shared !== incoming.Shared ||
17 current.targetMembers !== incoming.TargetMembers ||
18 current.newUserInvitesReady !== incoming.NewUserInvitesReady ||
19 current.targetMaxMembers !== incoming.TargetMaxMembers;