-
Notifications
You must be signed in to change notification settings - Fork 554
/
constants.ts
1069 lines (923 loc) · 27 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import type { enums } from '@proton/crypto';
import { EncryptionConfig } from './interfaces';
export const DEFAULT_TIMEOUT = 30000; // default fetch timeout
export const RETRY_DELAY_MAX = 10; // seconds
export const RETRY_ATTEMPTS_MAX = 5; // how many times to try the same request
export const OFFLINE_RETRY_DELAY = 2000; // how much time in ms to wait before retrying an offline request
export const OFFLINE_RETRY_ATTEMPTS_MAX = 0; // how many times to try the same request when offline
export const SECOND = 1000;
export const MINUTE = 60 * SECOND;
export const HOUR = 60 * MINUTE;
export const DAY = 24 * HOUR;
export const WEEK = 7 * DAY;
export const MONTH = 4 * WEEK;
export const YEAR = 12 * MONTH;
export const MINUTE_IN_SECONDS = 60;
export const HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS;
export const DAY_IN_SECONDS = 24 * HOUR_IN_SECONDS;
// Max quantity for all addons
export const MAX_VPN_ADDON = 2000;
export const MAX_MEMBER_ADDON = 5000;
export const MAX_DOMAIN_PRO_ADDON = 99;
export const MAX_DOMAIN_PLUS_ADDON = 10;
export const MAX_ADDRESS_ADDON = 10;
export const MAX_SPACE_ADDON = 20;
export const DOMAIN_PLACEHOLDER = 'example.com';
export const EMAIL_PLACEHOLDER = 'john.doe@example.com';
export const USERNAME_PLACEHOLDER = 'john.doe';
export const BRAND_NAME = 'Proton';
export const MAIL_SHORT_APP_NAME = 'Mail';
export const MAIL_APP_NAME = `${BRAND_NAME} ${MAIL_SHORT_APP_NAME}`;
export const CONTACTS_SHORT_APP_NAME = 'Contacts';
export const CONTACTS_APP_NAME = `${BRAND_NAME} ${CONTACTS_SHORT_APP_NAME}`;
export const CALENDAR_SHORT_APP_NAME = 'Calendar';
export const CALENDAR_APP_NAME = `${BRAND_NAME} ${CALENDAR_SHORT_APP_NAME}`;
export const DRIVE_SHORT_APP_NAME = 'Drive';
export const DRIVE_APP_NAME = `${BRAND_NAME} ${DRIVE_SHORT_APP_NAME}`;
export const PASS_SHORT_APP_NAME = 'Pass';
export const PASS_APP_NAME = `${BRAND_NAME} ${PASS_SHORT_APP_NAME}`;
export const VPN_SHORT_APP_NAME = 'VPN';
export const VPN_APP_NAME = `${BRAND_NAME} ${VPN_SHORT_APP_NAME}`;
export const VERIFY_APP_NAME = 'Proton Verify';
export const REFERRER_CODE_MAIL_TRIAL = 'MAILPLUSTRIAL';
export const PROTON_SENTINEL_NAME = 'Proton Sentinel';
export const APPS = {
PROTONACCOUNT: 'proton-account',
PROTONACCOUNTLITE: 'proton-account-lite',
PROTONVPNBROWSEREXTENSION: 'proton-vpn-browser-extension',
PROTONMAIL: 'proton-mail',
PROTONCONTACTS: 'proton-contacts',
PROTONDRIVE: 'proton-drive',
PROTONCALENDAR: 'proton-calendar',
PROTONPASS: 'proton-pass',
PROTONVPN_SETTINGS: 'proton-vpn-settings',
PROTONADMIN: 'proton-admin',
PROTONVERIFICATION: 'proton-verify',
PROTONEXTENSION: 'proton-extension',
PROTONPASSBROWSEREXTENSION: 'proton-pass-extension',
} as const;
interface AppConfiguration {
publicPath: string;
subdomain: string;
name: string;
bareName: string;
clientID: string;
icon: string;
settingsSlug: string;
}
export const APPS_CONFIGURATION: { [key in APP_NAMES]: AppConfiguration } = {
[APPS.PROTONACCOUNT]: {
publicPath: '',
subdomain: 'account',
name: 'Proton Account',
bareName: 'Account',
clientID: 'web-account',
icon: 'brand-proton',
settingsSlug: 'account',
},
[APPS.PROTONACCOUNTLITE]: {
publicPath: '',
subdomain: 'account',
name: 'Proton Account',
bareName: 'Account',
clientID: 'web-account-lite',
icon: 'brand-proton',
settingsSlug: 'account',
},
[APPS.PROTONVPNBROWSEREXTENSION]: {
publicPath: '',
subdomain: '',
name: 'Proton VPN Browser Extension',
bareName: 'Browser VPN Extension',
clientID: 'browser-vpn',
icon: 'brand-proton-vpn',
settingsSlug: '',
},
[APPS.PROTONMAIL]: {
publicPath: '',
subdomain: 'mail',
name: MAIL_APP_NAME,
bareName: MAIL_SHORT_APP_NAME,
clientID: 'web-mail',
icon: 'brand-proton-mail',
settingsSlug: 'mail',
},
[APPS.PROTONCONTACTS]: {
publicPath: '/contacts',
subdomain: 'contacts',
name: 'ProtonContacts',
bareName: 'Contacts',
clientID: 'web-contacts',
icon: 'brand-proton',
settingsSlug: 'contacts',
},
[APPS.PROTONDRIVE]: {
publicPath: '/drive',
subdomain: 'drive',
name: DRIVE_APP_NAME,
bareName: DRIVE_SHORT_APP_NAME,
clientID: 'web-drive',
icon: 'brand-proton-drive',
settingsSlug: 'drive',
},
[APPS.PROTONCALENDAR]: {
publicPath: '/calendar',
subdomain: 'calendar',
name: CALENDAR_APP_NAME,
bareName: CALENDAR_SHORT_APP_NAME,
clientID: 'web-calendar',
icon: 'brand-proton-calendar',
settingsSlug: 'calendar',
},
[APPS.PROTONPASS]: {
publicPath: '/pass',
subdomain: '',
name: PASS_APP_NAME,
bareName: PASS_SHORT_APP_NAME,
clientID: 'web-pass',
icon: 'brand-proton-pass',
settingsSlug: 'pass',
},
[APPS.PROTONEXTENSION]: {
publicPath: '',
subdomain: '',
name: PASS_APP_NAME,
bareName: PASS_SHORT_APP_NAME,
clientID: 'browser-pass',
icon: '',
settingsSlug: '',
},
[APPS.PROTONPASSBROWSEREXTENSION]: {
publicPath: '',
subdomain: '',
name: PASS_APP_NAME,
bareName: PASS_SHORT_APP_NAME,
clientID: 'browser-pass',
icon: '',
settingsSlug: '',
},
[APPS.PROTONVPN_SETTINGS]: {
publicPath: '',
subdomain: '',
name: VPN_APP_NAME,
bareName: VPN_SHORT_APP_NAME,
clientID: 'web-vpn-settings',
icon: 'brand-proton-vpn',
settingsSlug: 'vpn',
},
[APPS.PROTONADMIN]: {
publicPath: '',
subdomain: '',
name: '',
bareName: 'Admin',
clientID: 'web-admin',
icon: 'brand-proton',
settingsSlug: '',
},
[APPS.PROTONVERIFICATION]: {
publicPath: '',
subdomain: 'verify',
name: VERIFY_APP_NAME,
bareName: 'Verify',
clientID: 'web-verify',
icon: 'brand-proton',
settingsSlug: '',
},
};
export enum PRODUCT_BIT {
Mail = 1,
Drive = 2,
VPN = 4,
PASS = 8,
}
export type APP_KEYS = keyof typeof APPS;
export type APP_NAMES = (typeof APPS)[APP_KEYS];
export type APP_CLIENT_IDS =
| (typeof APPS_CONFIGURATION)[keyof typeof APPS_CONFIGURATION]['clientID']
| 'android_tv-vpn';
export const SSO_PATHS = {
OAUTH_AUTHORIZE: '/oauth/authorize',
OAUTH_CONFIRM_FORK: '/oauth/confirm',
AUTHORIZE: '/authorize',
FORK: '/login',
SWITCH: '/switch',
LOGIN: '/login',
RESET_PASSWORD: '/reset-password',
FORGOT_USERNAME: '/forgot-username',
MAIL_SIGNUP: '/mail/signup',
MAIL_SIGN_IN: '/mail',
CALENDAR_SIGNUP: '/calendar/signup',
CALENDAR_SIGN_IN: '/calendar',
DRIVE_SIGNUP: '/drive/signup',
DRIVE_SIGN_IN: '/drive',
VPN_SIGNUP: '/vpn/signup',
VPN_SIGN_IN: '/vpn',
PASS_SIGNUP: '/pass/signup',
PASS_SIGN_IN: '/pass',
SIGNUP: '/signup',
PRICING: '/pricing',
INVITE: '/pre-invite',
REFER: '/refer-a-friend',
TRIAL: '/trial',
} as const;
export const SETUP_ADDRESS_PATH = '/setup-address';
export const VPN_HOSTNAME = 'account.protonvpn.com';
export enum HTTP_STATUS_CODE {
OK = 200,
BAD_REQUEST = 400,
FORBIDDEN = 403,
NOT_FOUND = 404,
UNPROCESSABLE_ENTITY = 422,
TOO_MANY_REQUESTS = 429,
INTERNAL_SERVER_ERROR = 500,
}
export enum API_CODES {
GLOBAL_SUCCESS = 1001,
SINGLE_SUCCESS = 1000,
}
export const GET_VTIMEZONES_API_LIMIT = 10;
export const GET_CANONICAL_EMAILS_API_LIMIT = 100;
export enum ACCOUNT_DELETION_REASONS {
DIFFERENT_ACCOUNT = 'DIFFERENT_ACCOUNT',
TOO_EXPENSIVE = 'TOO_EXPENSIVE',
MISSING_FEATURE = 'MISSING_FEATURE',
USE_OTHER_SERVICE = 'USE_OTHER_SERVICE',
OTHER = 'OTHER',
}
export const FORBIDDEN_LABEL_NAMES = ['inbox', 'drafts', 'sent', 'starred', 'archive', 'spam', 'trash', 'outbox'];
export enum SUBSCRIPTION_CANCELLATION_REASONS {
DIFFERENT_ACCOUNT = 'DIFFERENT_ACCOUNT',
TOO_EXPENSIVE = 'TOO_EXPENSIVE',
MISSING_FEATURE = 'MISSING_FEATURE',
QUALITY_ISSUE = 'QUALITY_ISSUE',
STREAMING_SERVICE_UNSUPPORTED = 'STREAMING_SERVICE_UNSUPPORTED',
SWITCHING_TO_DIFFERENT_SERVICE = 'SWITCHING_TO_DIFFERENT_SERVICE',
TEMPORARY = 'TEMPORARY',
OTHER = 'OTHER',
}
export const MAIN_USER_KEY = 'USER_KEYS';
export const SECURE_SESSION_STORAGE_KEY = 'SECURE';
export const MAILBOX_PASSWORD_KEY = 'proton:mailbox_pwd';
export const UID_KEY = 'proton:oauth:UID';
export const USER_ID_KEY = 'proton:userID';
export const LOCAL_ID_KEY = 'proton:localID';
export const PERSIST_SESSION_KEY = 'proton:persistSession';
export const TRUST_SESSION_KEY = 'proton:trustSession';
export const INTERVAL_EVENT_TIMER = 30 * 1000;
export const MAX_SIZE_SCREENSHOT = 500 * 1000;
export enum EVENT_ACTIONS {
DELETE = 0,
CREATE = 1,
UPDATE = 2,
UPDATE_DRAFT = 2,
UPDATE_FLAGS = 3,
}
export enum USER_ROLES {
FREE_ROLE = 0,
MEMBER_ROLE = 1,
ADMIN_ROLE = 2,
}
export const ELEMENTS_PER_PAGE = 10;
export enum INVOICE_OWNER {
USER = 0,
ORGANIZATION = 1,
}
export const PGP_SIGN = 1;
export const DEFAULT_CURRENCY = 'EUR';
export const CURRENCIES = ['EUR', 'USD', 'CHF'] as const;
export const MIN_DONATION_AMOUNT = 100;
export const MIN_CREDIT_AMOUNT = 500;
export const MIN_BITCOIN_AMOUNT = 500;
export const MAX_BITCOIN_AMOUNT = 4000000;
export const DEFAULT_CREDITS_AMOUNT = 5000;
export enum INVOICE_TYPE {
OTHER = 0,
SUBSCRIPTION = 1,
CANCELLATION = 2,
CREDIT = 3,
DONATION = 4,
CHARGEBACK = 5,
RENEWAL = 6,
REFUND = 7,
MODIFICATION = 8,
ADDITION = 9,
}
export enum INVOICE_STATE {
UNPAID = 0,
PAID = 1,
VOID = 2,
BILLED = 3,
WRITEOFF = 4,
}
export enum UNPAID_STATE {
NOT_UNPAID = 0,
AVAILABLE = 1,
OVERDUE = 2,
DELINQUENT = 3,
NO_RECEIVE = 4,
}
export const BASE_SIZE = 1024;
export const GIGA = BASE_SIZE ** 3;
export enum MEMBER_TYPE {
PROTON = 0,
MANAGED = 1,
}
export enum DOMAIN_STATE {
DOMAIN_STATE_DEFAULT = 0, // Domain's State before verify or after deactivation
DOMAIN_STATE_ACTIVE = 1, // active once verified
DOMAIN_STATE_WARN = 2, // detected backward DNS change after ACTIVE
}
export enum VERIFY_STATE {
VERIFY_STATE_DEFAULT = 0, // 0 is default, no good
VERIFY_STATE_EXIST = 1, // 1 is has code but doesn't match DB's, no good
VERIFY_STATE_GOOD = 2, // 2 is has code and matches DB's, good!
}
export enum MX_STATE {
MX_STATE_DEFAULT = 0, // 0 is default, no good
MX_STATE_NO_US = 1, // 1 is set but does not have us
MX_STATE_INC_US = 2, // 2 is includes our MX but priority no good
MX_STATE_GOOD = 3, // 3 is includes our MX and we are highest and pri is legit, good!
}
export enum SPF_STATE {
SPF_STATE_DEFAULT = 0, // 0 is default, no spf record
SPF_STATE_ONE = 1, // 1 is has spf record but not us
SPF_STATE_MULT = 2, // 2 is has multiple spf records, no good
SPF_STATE_GOOD = 3, // 3 is has spf record and includes us, good!
}
export enum DKIM_STATE {
DKIM_STATE_DEFAULT = 0,
DKIM_STATE_ERROR = 3,
DKIM_STATE_GOOD = 4,
DKIM_STATE_WARNING = 6,
}
export enum DMARC_STATE {
DMARC_STATE_DEFAULT = 0, // 0 is default, no dmarc record
DMARC_STATE_ONE = 1, // 1 is found entries but format wrong
DMARC_STATE_MULT = 2, // 2 is multiple dmarc records, no good
DMARC_STATE_GOOD = 3, // 3 is good!
}
export enum ADDRESS_STATUS {
STATUS_DISABLED = 0,
STATUS_ENABLED = 1,
STATUS_DELETING = 2, // not used by clients yet; coming in the future
}
export enum ADDRESS_TYPE {
TYPE_ORIGINAL = 1,
TYPE_ALIAS = 2,
TYPE_CUSTOM_DOMAIN = 3,
TYPE_PREMIUM = 4,
TYPE_EXTERNAL = 5,
}
export enum ADDRESS_RECEIVE {
RECEIVE_YES = 1,
RECEIVE_NO = 0,
}
export enum ADDRESS_SEND {
SEND_YES = 1,
SEND_NO = 0,
}
export enum ADDRESS_FLAGS {
FLAG_DISABLE_E2EE = 16,
FLAG_DISABLE_EXPECTED_SIGNED = 32,
}
export enum MEMBER_PRIVATE {
READABLE = 0,
UNREADABLE = 1,
}
export enum MEMBER_ROLE {
ORGANIZATION_NONE = 0,
ORGANIZATION_MEMBER = 1,
ORGANIZATION_ADMIN = 2,
}
export enum MEMBER_SUBSCRIBER {
NON_PAYER = 0,
PAYER = 1,
}
export enum PACKAGE_TYPE {
SEND_PM = 1,
SEND_EO = 2,
SEND_CLEAR = 4,
SEND_PGP_INLINE = 8,
SEND_PGP_MIME = 16,
SEND_CLEAR_MIME = 32,
}
export enum PACKAGE_SIGNATURES_MODE {
SIGNATURES_NONE = 0,
SIGNATURES_ATTACHMENTS = 1,
SIGNATURES_BODY = 2,
}
export enum PGP_SCHEMES {
PGP_INLINE = 'pgp-inline',
PGP_MIME = 'pgp-mime',
}
export enum PGP_SCHEMES_MORE {
GLOBAL_DEFAULT = '',
}
export type CONTACT_PGP_SCHEMES = PGP_SCHEMES | PGP_SCHEMES_MORE;
export enum MIME_TYPES {
MIME = 'multipart/mixed',
PLAINTEXT = 'text/plain',
DEFAULT = 'text/html',
ICS = 'text/calendar',
APPLICATION_ICS = 'application/ics', // Google's special one that doesn't have standard newlines
}
export enum MIME_TYPES_MORE {
AUTOMATIC = '',
}
export type DRAFT_MIME_TYPES = MIME_TYPES.PLAINTEXT | MIME_TYPES.DEFAULT;
export type CONTACT_MIME_TYPES = MIME_TYPES.PLAINTEXT | MIME_TYPES.DEFAULT | MIME_TYPES_MORE.AUTOMATIC;
export enum RECIPIENT_TYPES {
TYPE_INTERNAL = 1,
TYPE_EXTERNAL = 2,
}
export enum SHOW_IMAGES {
SHOW = 0,
HIDE = 1,
}
export enum IMAGE_PROXY_FLAGS {
NONE = 0,
INCORPORATOR = 1,
PROXY = 2,
ALL = 3,
}
export enum COMPOSER_MODE {
POPUP = 0,
MAXIMIZED = 1,
}
export enum VIEW_LAYOUT {
COLUMN = 0,
ROW = 1,
}
export enum STICKY_LABELS {
OFF = 0,
ON = 1,
}
export enum VIEW_MODE {
GROUP = 0,
SINGLE = 1,
}
export enum SHOW_MOVED {
NONE = 0,
DRAFTS = 1,
SENT = 2,
DRAFTS_AND_SENT = 3,
}
export enum DRAFT_TYPE {
NORMAL = 'text/html',
PLAIN_TEXT = 'text/plain',
}
export enum RIGHT_TO_LEFT {
OFF = 0,
ON = 1,
}
export enum ORGANIZATION_FLAGS {
LOYAL = 1,
COVID = 2,
SMTP_SUBMISSION = 4,
NO_CYCLE_SCHEDULED = 8,
DISSIDENT = 64,
PROTON = 128,
}
export enum ORGANIZATION_TWOFA_SETTING {
NOT_REQUIRED = 0,
REQUIRED_ADMIN_ONLY = 1,
REQUIRED_ALL = 2,
}
export enum APP_UPSELL_REF_PATH {
MAIL_UPSELL_REF_PATH = 'upsell_mail-',
CALENDAR_UPSELL_REF_PATH = 'upsell_calendar-',
DRIVE_UPSELL_REF_PATH = 'upsell_drive-',
VPN_UPSELL_REF_PATH = 'upsell_vpn-',
}
export enum UPSELL_COMPONENT {
BANNER = 'banner-',
MODAL = 'modal-',
BUTTON = 'button-',
}
export enum MAIL_UPSELL_PATHS {
AUTO_REPLY = 'auto-reply',
DOMAIN_NAMES = 'domain-names',
CATCH_ALL = 'catch-all',
BRIDGE = 'bridge',
PM_ME = 'pm-me',
SHORT_ADDRESS = 'short-address',
AUTO_DELETE = 'auto-delete',
SCHEDULE_SEND = 'schedule-send',
STORAGE_FULL = 'storage-full',
GET_STARTED_CHECKLIST = 'get-started-checklist',
MAIL_FOOTER = 'mail-footer',
UNLIMITED_FOLDERS = 'unlimited-folders',
UNLIMITED_LABELS = 'unlimited-labels',
UNLIMITED_FILTERS = 'unlimited-filters',
UNLIMITED_ADDRESSES = 'unlimited-addresses',
}
export enum CALENDAR_UPSELL_PATHS {
MULTI_CAL = 'multi-cal',
SHARE_CAL = 'share-cal',
MAX_CAL = 'max-cal',
}
export enum SHARED_UPSELL_PATHS {
MULTI_USER = 'multi-user',
CONTACT_GROUP = 'contact-groups',
STORAGE = 'storage',
STORAGE_PERCENTAGE = 'storage-percentage',
ORGANIZATION_CAPACITY = 'organization-capacity',
}
export const LOYAL_BONUS_STORAGE = 5 * GIGA;
export const LOYAL_BONUS_CONNECTION = 2;
export const COVID_PLUS_BONUS_STORAGE = 5 * GIGA;
export const COVID_PROFESSIONAL_BONUS_STORAGE = 5 * GIGA;
export const COVID_VISIONARY_BONUS_STORAGE = 10 * GIGA;
export const DEFAULT_CYCLE = 24;
export const VPN_CONNECTIONS = 10;
export enum CYCLE {
MONTHLY = 1,
YEARLY = 12,
TWO_YEARS = 24,
THIRTY = 30,
FIFTEEN = 15,
}
export const BLACK_FRIDAY = {
COUPON_CODE: 'BF2022',
START: new Date(Date.UTC(2021, 10, 1, 5)), // 6 AM CET
END: new Date(Date.UTC(2022, 0, 1, 17)), // 6 PM CET
CYBER_START: new Date(Date.UTC(2020, 10, 30, 6)),
CYBER_END: new Date(Date.UTC(2020, 11, 1, 6)),
};
export const PRODUCT_PAYER = {
START: new Date(Date.UTC(2020, 9, 28, 6)),
END: new Date(Date.UTC(2020, 11, 15, 6)),
};
export const MIN_PAYPAL_AMOUNT = 499;
export const MAX_PAYPAL_AMOUNT = 99999900;
export enum NEWS {
ANNOUNCEMENTS = 1 << 0,
FEATURES = 1 << 1,
NEWSLETTER = 1 << 2,
BETA = 1 << 3,
BUSINESS = 1 << 4,
OFFERS = 1 << 5,
ONBOARDING = 1 << 7,
}
export const CONTACT_EMAILS_LIMIT = 1000;
export const CONTACTS_LIMIT = 1000;
export const EXPORT_CONTACTS_LIMIT = 50; // Maximum page size for export is 50 from API
export const CONTACTS_REQUESTS_PER_SECOND = 10;
export const ALL_MEMBERS_ID = -100;
export enum LABEL_EXCLUSIVE {
FOLDER = 1,
LABEL = 0,
}
export const REGEX_IMAGE_EXTENSION = /\.(gif|jpe?g|tiff|png)$/i;
export const DARK_MODE_CLASS = 'isDarkMode';
export enum LINK_WARNING {
KEY = 'link_warning',
VALUE = 'dontAsk',
}
export enum ADDON_NAMES {
ADDRESS = '5address',
MEMBER = '1member',
DOMAIN = '1domain',
SPACE = '1gb',
VPN = '1vpn',
MEMBER_DRIVE_PRO = '1member-drivepro2022',
MEMBER_MAIL_PRO = '1member-mailpro2022',
MEMBER_BUNDLE_PRO = '1member-bundlepro2022',
DOMAIN_BUNDLE_PRO = '1domain-bundlepro2022',
MEMBER_ENTERPRISE = '1member-enterprise2022',
DOMAIN_ENTERPRISE = '1domain-enterprise2022',
}
export enum PLAN_TYPES {
PLAN = 1,
ADDON = 0,
}
export enum PLAN_SERVICES {
MAIL = 1,
DRIVE = 2,
VPN = 4,
}
// You don't need more, use `user.isPaid`
export const FREE_SUBSCRIPTION = {
isFreeSubscription: true,
};
export function isFreeSubscription(obj: any): obj is typeof FREE_SUBSCRIPTION {
return !!obj && obj.isFreeSubscription;
}
export const FREE_ORGANIZATION = {}; // You don't need more, use `user.isPaid`
export enum PLANS {
FREE = 'free',
// Old plans
PLUS = 'plus',
PROFESSIONAL = 'professional',
VISIONARY = 'visionary',
VPNBASIC = 'vpnbasic',
VPNPLUS = 'vpnplus',
// New plans
DRIVE = 'drive2022',
DRIVE_PRO = 'drivepro2022',
PASS_PLUS = 'pass2023',
MAIL = 'mail2022',
MAIL_PRO = 'mailpro2022',
VPN = 'vpn2022',
BUNDLE = 'bundle2022',
BUNDLE_PRO = 'bundlepro2022',
ENTERPRISE = 'enterprise2022',
FAMILY = 'family2022',
NEW_VISIONARY = 'visionary2022',
}
export const PLAN_NAMES = {
[PLANS.FREE]: 'Free',
[PLANS.PLUS]: 'Plus',
[PLANS.PROFESSIONAL]: 'Professional',
[PLANS.VISIONARY]: 'Visionary',
[PLANS.VPNBASIC]: 'Basic',
[PLANS.VPNPLUS]: 'Plus',
[PLANS.DRIVE]: 'Drive Plus',
[PLANS.DRIVE_PRO]: 'Drive Essentials',
[PLANS.PASS_PLUS]: 'Pass Plus',
[PLANS.MAIL]: 'Mail Plus',
[PLANS.MAIL_PRO]: 'Mail Essentials',
[PLANS.VPN]: 'VPN Plus',
[PLANS.BUNDLE]: 'Proton Unlimited',
[PLANS.BUNDLE_PRO]: 'Business',
[PLANS.ENTERPRISE]: 'Enterprise',
[PLANS.FAMILY]: 'Proton Family',
[PLANS.NEW_VISIONARY]: 'Visionary',
};
export const MEMBER_PLAN_MAPPING = {
[ADDON_NAMES.MEMBER_BUNDLE_PRO]: PLANS.BUNDLE_PRO,
[ADDON_NAMES.MEMBER_MAIL_PRO]: PLANS.MAIL_PRO,
[ADDON_NAMES.MEMBER_DRIVE_PRO]: PLANS.DRIVE_PRO,
[ADDON_NAMES.MEMBER_ENTERPRISE]: PLANS.ENTERPRISE,
};
export enum COUPON_CODES {
BUNDLE = 'BUNDLE',
PROTONTEAM = 'PROTONTEAM',
BLACK_FRIDAY_2018 = 'TWO4ONE2018',
BLACK_FRIDAY_2019 = 'BF2019',
BLACK_FRIDAY_2020 = 'BF2020',
BLACK_FRIDAY_2022 = 'BF2022',
MAIL_BLACK_FRIDAY_2022 = 'MAILBF2022',
VPN_BLACK_FRIDAY_2022 = 'VPNBF2022',
LIFETIME = 'LIFETIME',
VISIONARYFOREVER = 'VISIONARYFOREVER',
REFERRAL = 'REFERRAL',
ANNIVERSARY23 = 'ANNIVERSARY23',
}
export const GIFT_CODE_LENGTH = 16;
export enum MESSAGE_BUTTONS {
READ_UNREAD = 0,
UNREAD_READ = 1,
}
export const KEY_FILE_EXTENSION = '.asc';
export enum ENCRYPTION_TYPES {
CURVE25519 = 'CURVE25519',
RSA4096 = 'RSA4096',
}
export const DEFAULT_ENCRYPTION_CONFIG = ENCRYPTION_TYPES.CURVE25519;
export const ENCRYPTION_CONFIGS: { [key: string]: EncryptionConfig } = {
[ENCRYPTION_TYPES.CURVE25519]: { type: 'ecc', curve: 'ed25519' as enums.curve }, // casting is just informational
[ENCRYPTION_TYPES.RSA4096]: { type: 'rsa', rsaBits: 4096 },
};
export enum KEY_FLAG {
FLAG_EMAIL_NO_SIGN = 8,
/**
* Key can't be used to encrypt email. There are multiple scenarios where this can happen
* - the key is associated to a product without Mail, like Drive or VPN
* - the key is associated to an external address
* - the key is associated to an internal address e2e encryption disabled (e.g. because of forwarding)
*/
FLAG_EMAIL_NO_ENCRYPT = 4,
// Key can be used to encrypt
FLAG_NOT_OBSOLETE = 2,
// Key can be used to verify signatures
FLAG_NOT_COMPROMISED = 1,
}
export enum USER_STATUS {
DELETED = 0,
DISABLED = 1,
USER = 2,
VPN_ADMIN = 3,
ADMIN = 4,
SUPER_ADMIN = 5,
}
export enum MAILBOX_IDENTIFIERS {
inbox = '0',
allDrafts = '1',
allSent = '2',
trash = '3',
spam = '4',
allmail = '5',
starred = '10',
archive = '6',
sent = '7',
drafts = '8',
outbox = '9',
search = 'search',
label = 'label',
}
export enum INCOMING_DEFAULTS_LOCATION {
INBOX = Number(MAILBOX_IDENTIFIERS.inbox),
SPAM = Number(MAILBOX_IDENTIFIERS.spam),
BLOCKED = 14,
}
/* eslint no-useless-escape: "off" */
export const REGEX_EMAIL =
/(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/i;
export enum FILTER_STATUS {
ENABLED = 1,
DISABLED = 0,
}
export const FREE_USER_ACTIVE_FILTERS_LIMIT = 1;
export const FREE_USER_FOLDERS_LIMIT = 3;
export const FREE_USER_LABELS_LIMIT = 3;
export const VCARD_VERSION = '4.0';
export enum CONTACT_CARD_TYPE {
ENCRYPTED_AND_SIGNED = 3,
SIGNED = 2,
ENCRYPTED = 1,
CLEAR_TEXT = 0,
}
export enum LABEL_TYPE {
MESSAGE_LABEL = 1,
CONTACT_GROUP = 2,
MESSAGE_FOLDER = 3,
SYSTEM_FOLDER = 4,
}
export const DEFAULT_LOCALE = 'en_US';
export enum PASSWORD_MODE {
SINGLE = 1,
TWO_PASSWORD = 2,
}
export enum SORT_DIRECTION {
ASC = 'ASC',
DESC = 'DESC',
}
export enum SERVER_FEATURES {
SECURE_CORE = 1,
TOR = 2,
P2P = 4,
XOR = 8,
IPV6 = 16,
}
export enum CLIENT_TYPES {
MAIL = 1,
VPN = 2,
PASS = 5,
}
export enum TOKEN_TYPES {
EMAIL = 'email',
SMS = 'sms',
INVITE = 'invite',
COUPON = 'coupon',
CAPTCHA = 'captcha',
}
export enum MAILBOX_LABEL_IDS {
INBOX = '0',
ALL_DRAFTS = '1',
ALL_SENT = '2',
TRASH = '3',
SPAM = '4',
ALL_MAIL = '5',
STARRED = '10',
ARCHIVE = '6',
SENT = '7',
DRAFTS = '8',
OUTBOX = '9',
SCHEDULED = '12',
ALMOST_ALL_MAIL = '15',
}
export const LINKED_LABEL_IDS: { [key in MAILBOX_LABEL_IDS]?: MAILBOX_LABEL_IDS } = {
[MAILBOX_LABEL_IDS.ALL_DRAFTS]: MAILBOX_LABEL_IDS.DRAFTS,
[MAILBOX_LABEL_IDS.ALL_SENT]: MAILBOX_LABEL_IDS.SENT,
[MAILBOX_LABEL_IDS.ALL_MAIL]: MAILBOX_LABEL_IDS.ALMOST_ALL_MAIL,
[MAILBOX_LABEL_IDS.DRAFTS]: MAILBOX_LABEL_IDS.ALL_DRAFTS,
[MAILBOX_LABEL_IDS.SENT]: MAILBOX_LABEL_IDS.ALL_SENT,
[MAILBOX_LABEL_IDS.ALMOST_ALL_MAIL]: MAILBOX_LABEL_IDS.ALL_MAIL,
};
export enum AutoReplyDuration {
FIXED = 0,
DAILY = 1,
WEEKLY = 2,
MONTHLY = 3,
PERMANENT = 4,
}
export const DKIM_RSA_1024 = 0;
export const DKIM_RSA_2048 = 1;
export enum DKIM_KEY_STATUS {
ACTIVE = 0,
PENDING = 1,
RETIRED = 2,
DECEASED = 3,
}
export enum DKIM_KEY_DNS_STATUS {
NOT_SET = 0,
GOOD = 1,
INVALID = 2,
}
export enum DENSITY {
COMFORTABLE = 0,
COMPACT = 1,
}
export enum SPAM_SCORE {
PM_SPOOFED = 100,
DMARC_FAILED = 101,
PHISHING = 102,
}
export const COLLAPSE_MENU_KEY = 'collapse-menu';
export const ROOT_FOLDER = 0;
export const USER_SCOPES = {
DRIVE: 68719476736,
};
export const DOH_DOMAINS = ['.compute.amazonaws.com'];
export const PROTON_DOMAINS = [
'protonmail.com',
'protonmail.ch',
'protonvpn.com',
'protonstatus.com',
'gdpr.eu',
'protonvpn.net',
'pm.me',
'protonmailrmez3lotccipshtkleegetolb73fuirgj7r4o4vfu7ozyd.onion',
'proton.me',
];
export enum LINK_TYPES {
WEB = 'web',
EMAIL = 'email',
PHONE = 'phone',
}
declare const WEBPACK_FEATURE_FLAGS: string;
// This is a definition coming from webpack. Hide behind typeof for the test env.
export const FEATURE_FLAGS = typeof WEBPACK_FEATURE_FLAGS === 'undefined' ? '' : WEBPACK_FEATURE_FLAGS;
declare const WEBPACK_APP_MODE: string;
export const APP_MODE = typeof WEBPACK_APP_MODE === 'undefined' ? '' : WEBPACK_APP_MODE;
export const isSSOMode = APP_MODE === 'sso';
export const isStandaloneMode = APP_MODE === 'standalone';
declare const WEBPACK_PUBLIC_PATH: string;
export const PUBLIC_PATH = typeof WEBPACK_PUBLIC_PATH === 'undefined' ? '' : WEBPACK_PUBLIC_PATH;
interface OpenPGPFile {
filepath: string;
integrity?: string;
}
const DUMMY_FILE = {
filepath: '/',
};
declare const WEBPACK_OPENPGP: { main: OpenPGPFile; compat: OpenPGPFile; elliptic: OpenPGPFile; worker: OpenPGPFile };
export const OPENPGP =
typeof WEBPACK_OPENPGP === 'undefined'
? { main: DUMMY_FILE, compat: DUMMY_FILE, elliptic: DUMMY_FILE, worker: DUMMY_FILE }