constants.tsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. 'activeRelease',
  28. 'workflow',
  29. 'deploy',
  30. 'approval',
  31. 'quota',
  32. 'reports',
  33. 'email',
  34. 'spikeProtection',
  35. ] as const;
  36. export const SELF_NOTIFICATION_SETTINGS_TYPES = [
  37. 'personalActivityNotifications',
  38. 'selfAssignOnResolve',
  39. ];
  40. // 'alerts' | 'activeRelease' | 'workflow' ...
  41. export type NotificationSettingsType = typeof NOTIFICATION_SETTINGS_TYPES[number];
  42. export const NOTIFICATION_SETTINGS_PATHNAMES: Record<NotificationSettingsType, string> = {
  43. alerts: 'alerts',
  44. activeRelease: 'activeRelease',
  45. workflow: 'workflow',
  46. deploy: 'deploy',
  47. approval: 'approval',
  48. quota: 'quota',
  49. reports: 'reports',
  50. email: 'email',
  51. spikeProtection: 'spike-protection',
  52. };
  53. export const CONFIRMATION_MESSAGE = (
  54. <div>
  55. <p style={{marginBottom: '20px'}}>
  56. <strong>Are you sure you want to disable these notifications?</strong>
  57. </p>
  58. <p>
  59. {t(
  60. 'Turning this off will irreversibly overwrite all of your fine-tuning settings to "off".'
  61. )}
  62. </p>
  63. </div>
  64. );
  65. export const NOTIFICATION_FEATURE_MAP: Partial<Record<NotificationSettingsType, string>> =
  66. {
  67. quota: 'slack-overage-notifications',
  68. activeRelease: 'active-release-monitor-alpha',
  69. spikeProtection: 'spike-projections',
  70. };