1 import { createAction } from '@reduxjs/toolkit';
3 import type { Filter } from '@proton/components/containers/filters/interfaces';
4 import type { SavedPaymentMethod } from '@proton/payments';
5 import type { EventItemUpdate } from '@proton/shared/lib/helpers/updateCollection';
9 BreachAlertUpdateEvent,
14 IncomingAddressForwarding,
20 OutgoingAddressForwarding,
26 } from '@proton/shared/lib/interfaces';
27 import type { Category } from '@proton/shared/lib/interfaces/Category';
28 import type { CalendarUserSettings } from '@proton/shared/lib/interfaces/calendar';
31 CalendarMemberEventManager,
32 } from '@proton/shared/lib/interfaces/calendar/EventManager';
33 import type { Contact, ContactEmail } from '@proton/shared/lib/interfaces/contacts';
34 import type { AuthDeviceOutput, MemberAuthDeviceOutput } from '@proton/shared/lib/keys/device';
36 export interface EventLoop {
37 AuthDevices?: EventItemUpdate<AuthDeviceOutput, 'AuthDevice'>[];
38 MemberAuthDevices?: EventItemUpdate<MemberAuthDeviceOutput, 'MemberAuthDevice'>[];
40 Filters?: EventItemUpdate<Filter, 'Filter'>[];
41 Domains?: EventItemUpdate<Domain, 'Domain'>[];
42 Addresses?: EventItemUpdate<Address, 'Address'>[];
43 CalendarUserSettings?: CalendarUserSettings;
44 Contacts?: EventItemUpdate<Contact, 'Contact'>[];
45 ContactEmails?: EventItemUpdate<ContactEmail, 'ContactEmail'>[];
46 Calendars?: CalendarEventManager[];
47 CalendarMembers?: CalendarMemberEventManager[];
48 Organization?: Omit<Organization, 'Settings'>;
49 OrganizationSettings?: OrganizationSettings;
50 UserSettings?: UserSettings;
51 MailSettings?: MailSettings;
52 UserInvitations?: EventItemUpdate<PendingInvitation, 'UserInvitation'>[];
53 Labels?: EventItemUpdate<Category, 'Label'>[];
54 Members?: EventItemUpdate<Member, 'Member'>[];
55 MessageCounts?: LabelCount[];
56 ConversationCounts?: LabelCount[];
57 PaymentMethods?: EventItemUpdate<SavedPaymentMethod, 'PaymentMethod'>[];
58 IncomingAddressForwardings?: EventItemUpdate<IncomingAddressForwarding, 'IncomingAddressForwarding'>[];
59 OutgoingAddressForwardings?: EventItemUpdate<OutgoingAddressForwarding, 'OutgoingAddressForwarding'>[];
60 Subscription?: Subscription & { UpcomingSubscription?: Subscription };
61 Config?: ApiEnvironmentConfig;
62 SSO?: EventItemUpdate<SSO, 'SSO'>[];
63 UsedSpace?: User['UsedSpace'];
64 UsedBaseSpace?: User['UsedBaseSpace'];
65 UsedDriveSpace?: User['UsedDriveSpace'];
66 ProductUsedSpace?: User['ProductUsedSpace'];
68 BreachAlerts?: BreachAlertUpdateEvent[];
69 Groups?: EventItemUpdate<Group, 'Group'>[];
70 GroupMembers?: EventItemUpdate<GroupMember, 'GroupMember'>[];
71 GroupMemberships?: EventItemUpdate<GroupMembership, 'GroupMembership'>[];
74 export const serverEvent = createAction('server event', (payload: EventLoop) => ({ payload }));