Merge branch 'renovate/playwright' into 'main'
[ProtonMail-WebClient.git] / packages / account / eventLoop.ts
blobdde25d955e090796abfb7f5da1e06afc5bc6759a
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';
6 import type {
7     Address,
8     ApiEnvironmentConfig,
9     BreachAlertUpdateEvent,
10     Domain,
11     Group,
12     GroupMember,
13     GroupMembership,
14     IncomingAddressForwarding,
15     LabelCount,
16     MailSettings,
17     Member,
18     Organization,
19     OrganizationSettings,
20     OutgoingAddressForwarding,
21     PendingInvitation,
22     SSO,
23     Subscription,
24     User,
25     UserSettings,
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';
29 import type {
30     CalendarEventManager,
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'>[];
39     User?: User;
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'];
67     Refresh?: number;
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 }));