1 import type { ThemeColor } from '@proton/colors/types';
2 import type { IconName } from '@proton/components/components/icon/Icon';
3 import type { OfflineKey } from '@proton/shared/lib/authentication/offlineKey';
4 import type { APPS } from '@proton/shared/lib/constants';
5 import type { Environment } from '@proton/shared/lib/interfaces';
7 import type { User as tsUser } from '../interfaces';
8 import type { VCardContact } from '../interfaces/contacts/VCard';
9 import type { ThemeSetting } from '../themes/themes';
11 export enum DRAWER_NATIVE_APPS {
12 QUICK_SETTINGS = 'quick-settings',
13 CONTACTS = 'contacts',
14 SECURITY_CENTER = 'security-center',
16 export type DrawerApp = typeof APPS.PROTONCALENDAR | `${DRAWER_NATIVE_APPS}`;
17 export type IframeSrcMap = Partial<Record<DrawerApp, string | undefined>>;
19 export interface OpenDrawerArgs {
24 export interface DrawerLocalStorageValue {
30 * Events sent from or to the drawer app
32 export enum DRAWER_EVENTS {
33 // Global inside iframe events
39 API_REQUEST = 'api-request',
40 API_RESPONSE = 'api-response',
41 ABORT_REQUEST = 'api-request-abort',
42 CHILD_URL_UPDATE = 'child-url-update',
44 // Global outside iframe events
45 CALL_EVENT_MANAGER_FROM_OUTSIDE = 'outside-call-event-manager',
46 UPDATE_THEME = 'outside-update-theme',
48 // Calendar inside iframe events
50 // Calendar outside iframe events
51 CALENDAR_OPEN_EVENT = 'outside-calendar-open-event',
52 CALL_CALENDAR_EVENT_MANAGER = 'outside-call-calendar-event-manager',
53 SET_WIDGET_EVENT = 'outside-set-widget-event',
54 UNSET_WIDGET_EVENT = 'outside-unset-widget-event',
56 // Calendar to mail events
57 REQUEST_OPEN_EVENTS = 'outside-request-open-events',
58 REFRESH_WIDGET = 'outside-refresh-widget',
59 OPEN_CONTACT_MODAL = 'open-contact-modal',
62 // Global inside iframe events
64 type: DRAWER_EVENTS.CLOSE;
67 closeDefinitely?: boolean;
72 type: DRAWER_EVENTS.SHOW;
76 type: DRAWER_EVENTS.SWITCH;
83 type: DRAWER_EVENTS.READY;
86 export interface SESSION_MESSAGE {
87 type: DRAWER_EVENTS.SESSION;
94 offlineKey: OfflineKey | undefined;
101 interface API_REQUEST {
102 type: DRAWER_EVENTS.API_REQUEST;
107 hasAbortController?: boolean;
111 interface API_RESPONSE {
112 type: DRAWER_EVENTS.API_RESPONSE;
116 isApiError?: boolean;
123 interface API_ABORT_REQUEST {
124 type: DRAWER_EVENTS.ABORT_REQUEST;
130 interface CHILD_URL_UPDATE {
131 type: DRAWER_EVENTS.CHILD_URL_UPDATE;
138 // Global outside iframe events
139 interface CALL_EVENT_MANAGER_OUTSIDE {
140 type: DRAWER_EVENTS.CALL_EVENT_MANAGER_FROM_OUTSIDE;
143 interface DRAWER_UPDATE_THEME {
144 type: DRAWER_EVENTS.UPDATE_THEME;
146 themeSetting: ThemeSetting;
150 // Calendar inside iframe events
152 // Calendar outside iframe events
153 interface CALENDAR_OPEN_EVENT {
154 type: DRAWER_EVENTS.CALENDAR_OPEN_EVENT;
158 recurrenceID?: number;
162 interface CALENDAR_CALL_EVENT_MANAGER {
163 type: DRAWER_EVENTS.CALL_CALENDAR_EVENT_MANAGER;
169 interface SET_WIDGET_EVENT {
170 type: DRAWER_EVENTS.SET_WIDGET_EVENT;
177 interface UNSET_WIDGET_EVENT {
178 type: DRAWER_EVENTS.UNSET_WIDGET_EVENT;
185 interface REQUEST_OPEN_EVENTS {
186 type: DRAWER_EVENTS.REQUEST_OPEN_EVENTS;
189 interface REFRESH_WIDGET {
190 type: DRAWER_EVENTS.REFRESH_WIDGET;
197 type OPEN_CONTACT_MODAL =
199 type: DRAWER_EVENTS.OPEN_CONTACT_MODAL;
205 type: DRAWER_EVENTS.OPEN_CONTACT_MODAL;
207 vCardContact: VCardContact;
211 export type DRAWER_ACTION =
221 | CALL_EVENT_MANAGER_OUTSIDE
222 | DRAWER_UPDATE_THEME
223 | CALENDAR_OPEN_EVENT
224 | CALENDAR_CALL_EVENT_MANAGER
227 | REQUEST_OPEN_EVENTS
229 | OPEN_CONTACT_MODAL;
235 export const KEY_TRANSPARENCY_REMINDER_UPDATE = 'KEY_TRANSPARENCY_REMINDER_UPDATE';
237 export interface QuickSettingsReminders {
241 callback: () => void;