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 {
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 = {
52 data: RequireSome<SendIcsActionData, 'vevent'>,
55 veventComponent: VcalVeventComponent;
56 inviteActions: InviteActions;
58 sendPreferencesMap: SimpleMap<AugmentedSendPreferences>;
61 data: SendIcsActionData,
64 veventComponent?: VcalVeventComponent;
65 inviteActions: InviteActions;
67 sendPreferencesMap: SimpleMap<AugmentedSendPreferences>;
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;
81 export interface CleanSendIcsActionData extends SendIcsActionData {
82 sendPreferencesMap: SimpleMap<AugmentedSendPreferences>;
85 export interface UpdatePartstatOperation {
90 partstat: ICAL_ATTENDEE_STATUS;
96 export interface UpdatePersonalPartOperation {
100 eventComponent?: VcalVeventComponent;
101 hasDefaultNotifications?: boolean;
106 export interface AttendeeDeleteSingleEditOperation {
111 eventComponent: VcalVeventComponent;