1 import { c } from 'ttag';
3 import type { CreateNotificationOptions } from '@proton/components';
4 import { EMAIL_PLACEHOLDER, USERNAME_PLACEHOLDER } from '@proton/shared/lib/constants';
6 import { ImportProvider, MailImportGmailCategories, OAUTH_PROVIDER, TIME_PERIOD } from './interface';
8 export const G_OAUTH_SCOPE_DEFAULT = ['email', 'openid'];
10 export const G_OAUTH_SCOPE_MAIL_READONLY = ['https://www.googleapis.com/auth/gmail.readonly'];
12 export const G_OAUTH_SCOPE_CONTACTS = ['https://www.googleapis.com/auth/contacts.readonly'];
13 export const G_OAUTH_SCOPE_CALENDAR = ['https://www.googleapis.com/auth/calendar.readonly'];
14 // export const G_OAUTH_SCOPE_DRIVE = [];
16 export const O_OAUTH_SCOPE_DEFAULT = ['email', 'openid', 'User.Read', 'offline_access'];
17 export const O_OAUTH_SCOPE_MAIL = ['Mail.read'];
18 export const O_OAUTH_SCOPE_CONTACTS = ['Contacts.read'];
19 export const O_OAUTH_SCOPE_CALENDAR = ['Calendars.read'];
21 export const IA_PATHNAME_REGEX = /\/easy-switch/;
25 export const GMAIL_CATEGORIES = Object.values(MailImportGmailCategories);
27 export const getTimeUnitLabels = () => ({
28 [TIME_PERIOD.BIG_BANG]: c('Label').t`Import all messages`,
29 [TIME_PERIOD.LAST_YEAR]: c('Label').t`Last 12 months only`,
30 [TIME_PERIOD.LAST_3_MONTHS]: c('Label').t`Last 3 months only`,
31 [TIME_PERIOD.LAST_MONTH]: c('Label').t`Last month only`,
34 export const MAX_FOLDERS_DEPTH = 3;
35 export const MAX_FOLDER_LIMIT = 20000;
37 export const IMAPS = {
38 [OAUTH_PROVIDER.GOOGLE]: 'imap.gmail.com',
39 [ImportProvider.YAHOO]: 'export.imap.mail.yahoo.com',
40 [ImportProvider.OUTLOOK]: 'outlook.office365.com',
41 [OAUTH_PROVIDER.OUTLOOK]: 'outlook.office365.com',
44 export const EASY_SWITCH_EMAIL_PLACEHOLDER = {
45 [ImportProvider.YAHOO]: `${USERNAME_PLACEHOLDER}@yahoo.com`,
46 [ImportProvider.OUTLOOK]: `${USERNAME_PLACEHOLDER}@outlook.com`,
47 [ImportProvider.GOOGLE]: `${USERNAME_PLACEHOLDER}@google.com`,
48 [ImportProvider.DEFAULT]: EMAIL_PLACEHOLDER,
51 /* Calendar specific */
53 export const CALENDAR_TO_BE_CREATED_PREFIX = '###TO_BE_CREATED###';
57 export const SYNC_G_OAUTH_SCOPES = [...G_OAUTH_SCOPE_DEFAULT, G_OAUTH_SCOPE_MAIL_READONLY];
58 export const SYNC_SUCCESS_NOTIFICATION: CreateNotificationOptions = {
60 text: c('account').t`Forwarding will start soon. New emails will appear in your inbox.`,