Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / shared / lib / interfaces / Member.ts
blobf66e3d66b19a023dc59f37268a64519fec145571
1 import type { Address } from '@proton/shared/lib/interfaces/Address';
3 import type { ADDRESS_STATUS, ADDRESS_TYPE, MEMBER_PRIVATE, MEMBER_ROLE, MEMBER_TYPE } from '../constants';
4 import type { Key } from './Key';
6 export interface PartialMemberAddress {
7     ID: string;
8     Email: string;
9     Status: ADDRESS_STATUS;
10     Type: ADDRESS_TYPE;
11     Permissions: number;
14 export enum MEMBER_STATE {
15     STATUS_DISABLED = 0,
16     STATUS_ENABLED = 1,
17     STATUS_INVITED = 2,
20 export enum MEMBER_ORG_KEY_STATE {
21     /** The member does not and should not have access to the org key (e.g. not an admin) */
22     NoKey = 0,
23     /** The member has full access to the most recent copy of the org key */
24     Active = 1,
25     /** The member does not have access to the most recent copy of the org key (including legacy keys) */
26     Missing = 2,
27     /** The member has been invited to but needs to activate the most recent copy of the org key */
28     Pending = 3,
31 export interface MemberInvitationData {
32     Address: string;
33     Revision: number;
36 export enum MemberUnprivatizationState {
37     Declined,
38     Pending,
39     Ready,
42 export enum CreateMemberMode {
43     Password,
44     Invitation,
47 export interface PublicMemberUnprivatizationOutput {
48     State: MemberUnprivatizationState;
49     InvitationData: string;
50     InvitationSignature: string;
51     InvitationEmail: string;
52     AdminEmail: string;
53     OrgKeyFingerprintSignature: string;
54     OrgPublicKey: string;
55     PrivateIntent: false;
58 export type PrivateMemberUnprivatizationOutput = {
59     State: MemberUnprivatizationState;
60     InvitationData: null;
61     InvitationSignature: null;
62     InvitationEmail: string;
63     AdminEmail: string;
64     OrgKeyFingerprintSignature: null;
65     OrgPublicKey: null;
66     PrivateIntent: true;
68 export type MemberUnprivatizationOutput = PublicMemberUnprivatizationOutput | PrivateMemberUnprivatizationOutput;
70 export type MemberUnprivatization = {
71     State: MemberUnprivatizationState;
72     PrivateKeys: string[] | null;
73     ActivationToken: string | null;
74     PrivateIntent: boolean;
75     InvitationData: string | null;
76     InvitationSignature: string | null;
77     InvitationEmail: string | null;
80 export type MemberUnprivatizationReadyForUnprivatization = {
81     State: MemberUnprivatizationState.Ready;
82     PrivateKeys: string[];
83     ActivationToken: string;
84     PrivateIntent: false;
85     InvitationData: string;
86     InvitationSignature: string;
87     InvitationEmail: string;
90 export type MemberUnprivatizationReadyForUnprivatizationApproval = {
91     State: MemberUnprivatizationState.Ready;
92     PrivateKeys: string[];
93     ActivationToken: string;
94     PrivateIntent: false;
95     InvitationData: null;
96     InvitationSignature: null;
97     InvitationEmail: null;
100 export interface Member {
101     ID: string;
102     Role: MEMBER_ROLE;
103     Private: MEMBER_PRIVATE;
104     Type: MEMBER_TYPE;
105     AccessToOrgKey: MEMBER_ORG_KEY_STATE;
106     ToMigrate: 0 | 1 | 2;
107     MaxSpace: number;
108     MaxVPN: number;
109     NumAI: number;
110     Name: string;
111     UsedSpace: number;
112     Self: number;
113     Subscriber: number;
114     Keys: Key[];
115     PublicKey: string;
116     BrokenSKL: 0 | 1;
117     Addresses?: PartialMemberAddress[];
118     '2faStatus': number;
119     State: MEMBER_STATE;
120     TwoFactorRequiredTime: number;
121     SSO: 1 | 0;
122     Unprivatization: null | MemberUnprivatization;
125 export interface MemberReadyForUnprivatization extends Member {
126     Unprivatization: MemberUnprivatizationReadyForUnprivatization;
129 export interface MemberReadyForUnprivatizationApproval extends Member {
130     Unprivatization: MemberUnprivatizationReadyForUnprivatization;
133 export type EnhancedMember = Member &
134     (
135         | { addressState: 'stale' | 'partial' | 'pending' | 'rejected' }
136         | {
137               addressState: 'full';
138               Addresses: Address[];
139           }
140     );