Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / applications / calendar / src / app / interfaces / Invite.ts
blob8e54ee69d0988523dfe0fde3e600ca49bf15ee2e
1 import type { ICAL_ATTENDEE_STATUS, RECURRING_TYPES } from '@proton/shared/lib/calendar/constants';
2 import type { Address, RequireSome } from '@proton/shared/lib/interfaces';
3 import type { CalendarEvent, VcalAttendeeProperty, VcalVeventComponent } from '@proton/shared/lib/interfaces/calendar';
4 import type { SimpleMap } from '@proton/shared/lib/interfaces/utils';
6 import type { AugmentedSendPreferences } from '../containers/calendar/interface';
8 export enum INVITE_ACTION_TYPES {
9     NONE,
10     CHANGE_PARTSTAT,
11     DECLINE_INVITATION,
12     DECLINE_DISABLED,
13     SEND_INVITATION, // organizer creates new invitation, or just adds/removes attendees
14     SEND_UPDATE, // organizer updates event details and/or attendees
15     CANCEL_INVITATION, // organizer deletes invitation
16     CANCEL_DISABLED, // organizer deletes invitation but can't notify attendees
19 export interface InviteActions {
20     type: INVITE_ACTION_TYPES;
21     sharedEventID?: string;
22     sharedSessionKey?: string;
23     isProtonProtonInvite?: boolean;
24     partstat?: ICAL_ATTENDEE_STATUS;
25     sendCancellationNotice?: boolean;
26     resetSingleEditsPartstat?: boolean;
27     deleteSingleEdits?: boolean;
28     selfAddress?: Address;
29     selfAttendeeIndex?: number;
30     addedAttendees?: VcalAttendeeProperty[];
31     removedAttendees?: VcalAttendeeProperty[];
32     hasRemovedAllAttendees?: boolean;
33     hasModifiedRole?: boolean;
34     recurringType?: RECURRING_TYPES;
37 export interface RecurringActionData {
38     type: RECURRING_TYPES;
39     inviteActions: InviteActions;
42 export interface SendIcsActionData {
43     inviteActions: InviteActions;
44     vevent?: VcalVeventComponent;
45     cancelVevent?: VcalVeventComponent;
46     noCheckSendPrefs?: boolean;
47     sendPreferencesMap?: SimpleMap<AugmentedSendPreferences>;
50 export type SendIcs = {
51     (
52         data: RequireSome<SendIcsActionData, 'vevent'>,
53         calendarID?: string
54     ): Promise<{
55         veventComponent: VcalVeventComponent;
56         inviteActions: InviteActions;
57         timestamp: number;
58         sendPreferencesMap: SimpleMap<AugmentedSendPreferences>;
59     }>;
60     (
61         data: SendIcsActionData,
62         calendarID?: string
63     ): Promise<{
64         veventComponent?: VcalVeventComponent;
65         inviteActions: InviteActions;
66         timestamp: number;
67         sendPreferencesMap: SimpleMap<AugmentedSendPreferences>;
68     }>;
71 export type OnSendPrefsErrors = {
72     (data: RequireSome<SendIcsActionData, 'vevent'>): Promise<RequireSome<CleanSendIcsActionData, 'vevent'>>;
73     (data: SendIcsActionData): Promise<CleanSendIcsActionData>;
76 export interface ReencryptInviteActionData {
77     calendarEvent: CalendarEvent;
78     calendarID: string;
81 export interface CleanSendIcsActionData extends SendIcsActionData {
82     sendPreferencesMap: SimpleMap<AugmentedSendPreferences>;
85 export interface UpdatePartstatOperation {
86     data: {
87         calendarID: string;
88         eventID: string;
89         attendeeID: string;
90         partstat: ICAL_ATTENDEE_STATUS;
91         updateTime: number;
92     };
93     silence: boolean;
96 export interface UpdatePersonalPartOperation {
97     data: {
98         calendarID: string;
99         eventID: string;
100         eventComponent?: VcalVeventComponent;
101         hasDefaultNotifications?: boolean;
102         color?: string;
103     };
106 export interface AttendeeDeleteSingleEditOperation {
107     data: {
108         addressID: string;
109         calendarID: string;
110         eventID: string;
111         eventComponent: VcalVeventComponent;
112     };