constants.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import {t} from 'sentry/locale';
  2. export const ALL_PROVIDERS = {
  3. email: 'default',
  4. slack: 'never',
  5. msteams: 'never',
  6. };
  7. export const ALL_PROVIDER_NAMES = Object.keys(ALL_PROVIDERS);
  8. /**
  9. * These values are stolen from the DB.
  10. */
  11. export const VALUE_MAPPING = {
  12. default: 0,
  13. never: 10,
  14. always: 20,
  15. subscribe_only: 30,
  16. committed_only: 40,
  17. };
  18. export const MIN_PROJECTS_FOR_CONFIRMATION = 3;
  19. export const MIN_PROJECTS_FOR_SEARCH = 3;
  20. export const MIN_PROJECTS_FOR_PAGINATION = 100;
  21. export type NotificationSettingsByProviderObject = {[key: string]: string};
  22. export type NotificationSettingsObject = {
  23. [key: string]: {[key: string]: {[key: string]: NotificationSettingsByProviderObject}};
  24. };
  25. export const NOTIFICATION_SETTINGS_TYPES = [
  26. 'alerts',
  27. 'workflow',
  28. 'deploy',
  29. 'approval',
  30. 'quota',
  31. 'reports',
  32. 'email',
  33. 'spikeProtection',
  34. ] as const;
  35. export const SELF_NOTIFICATION_SETTINGS_TYPES = [
  36. 'personalActivityNotifications',
  37. 'selfAssignOnResolve',
  38. ];
  39. // 'alerts' | 'workflow' ...
  40. export type NotificationSettingsType = (typeof NOTIFICATION_SETTINGS_TYPES)[number];
  41. export const NOTIFICATION_SETTINGS_PATHNAMES: Record<NotificationSettingsType, string> = {
  42. alerts: 'alerts',
  43. workflow: 'workflow',
  44. deploy: 'deploy',
  45. approval: 'approval',
  46. quota: 'quota',
  47. reports: 'reports',
  48. email: 'email',
  49. spikeProtection: 'spike-protection',
  50. };
  51. export const CONFIRMATION_MESSAGE = (
  52. <div>
  53. <p style={{marginBottom: '20px'}}>
  54. <strong>Are you sure you want to disable these notifications?</strong>
  55. </p>
  56. <p>
  57. {t(
  58. 'Turning this off will irreversibly overwrite all of your fine-tuning settings to "off".'
  59. )}
  60. </p>
  61. </div>
  62. );
  63. export const NOTIFICATION_FEATURE_MAP: Partial<Record<NotificationSettingsType, string>> =
  64. {
  65. quota: 'slack-overage-notifications',
  66. spikeProtection: 'spike-projections',
  67. };