constants.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. export const SUPPORTED_PROVIDERS = ['email', 'slack', 'msteams'] as const;
  2. export type SupportedProviders = (typeof SUPPORTED_PROVIDERS)[number];
  3. export type ProviderValue = 'always' | 'never';
  4. interface NotificationBaseObject {
  5. id: string;
  6. scopeIdentifier: string;
  7. scopeType: string;
  8. type: string;
  9. }
  10. export interface NotificationOptionsObject extends NotificationBaseObject {
  11. value: ProviderValue | 'subscribe_only' | 'committed_only';
  12. }
  13. export interface NotificationProvidersObject extends NotificationBaseObject {
  14. provider: SupportedProviders;
  15. value: ProviderValue;
  16. }
  17. export interface DefaultSettings {
  18. providerDefaults: SupportedProviders[];
  19. typeDefaults: Record<string, ProviderValue>;
  20. }
  21. export const NOTIFICATION_SETTINGS_TYPES = [
  22. 'alerts',
  23. 'workflow',
  24. 'deploy',
  25. 'approval',
  26. 'quota',
  27. 'reports',
  28. 'email',
  29. 'spikeProtection',
  30. 'brokenMonitors',
  31. ] as const;
  32. export const SELF_NOTIFICATION_SETTINGS_TYPES = [
  33. 'personalActivityNotifications',
  34. 'selfAssignOnResolve',
  35. ];
  36. // 'alerts' | 'workflow' ...
  37. type NotificationSettingsType = (typeof NOTIFICATION_SETTINGS_TYPES)[number];
  38. export const NOTIFICATION_SETTINGS_PATHNAMES: Record<NotificationSettingsType, string> = {
  39. alerts: 'alerts',
  40. workflow: 'workflow',
  41. deploy: 'deploy',
  42. approval: 'approval',
  43. quota: 'quota',
  44. reports: 'reports',
  45. email: 'email',
  46. spikeProtection: 'spike-protection',
  47. brokenMonitors: 'broken-monitors',
  48. };
  49. export const NOTIFICATION_FEATURE_MAP: Partial<
  50. Record<NotificationSettingsType, string | string[]>
  51. > = {
  52. quota: ['spend-visibility-notifications', 'user-spend-notifications-settings'],
  53. spikeProtection: 'spike-projections',
  54. };