useFeaturePreviews.ts 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import { LOCAL_STORAGE_KEYS, useFlag } from 'common'
  2. export type FeaturePreview = {
  3. key: string
  4. name: string
  5. discussionsUrl?: string
  6. isNew: boolean
  7. /** If feature flag is only relevant for the hosted platform */
  8. isPlatformOnly: boolean
  9. /** If feature flag should be enabled by default for users, if not yet toggled before */
  10. isDefaultOptIn: boolean
  11. /** Visibility in the feature preview modal (For feature flagging a feature preview) */
  12. enabled: boolean
  13. }
  14. export const useFeaturePreviews = (): FeaturePreview[] => {
  15. const isUnifiedLogsPreviewAvailable = useFlag('unifiedLogs')
  16. const pgDeltaDiffEnabled = useFlag('pgdeltaDiff')
  17. const platformWebhooksEnabled = useFlag('platformWebhooks')
  18. const jitDbAccessEnabled = useFlag('jitDbAccess')
  19. return [
  20. {
  21. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_RLS_TESTER,
  22. name: 'RLS Tester',
  23. discussionsUrl: 'https://github.com/orgs/briven/discussions/45233',
  24. enabled: true,
  25. isNew: true,
  26. isPlatformOnly: false,
  27. isDefaultOptIn: false,
  28. },
  29. {
  30. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS,
  31. name: 'Updated Logs interface',
  32. discussionsUrl: 'https://github.com/orgs/briven/discussions/37234',
  33. enabled: isUnifiedLogsPreviewAvailable,
  34. isNew: true,
  35. isPlatformOnly: true,
  36. isDefaultOptIn: false,
  37. },
  38. {
  39. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_ADVISOR_RULES,
  40. name: 'Disable Advisor rules',
  41. discussionsUrl: undefined,
  42. enabled: true,
  43. isNew: false,
  44. isPlatformOnly: true,
  45. isDefaultOptIn: false,
  46. },
  47. {
  48. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_PG_DELTA_DIFF,
  49. name: 'PG Delta Diff',
  50. discussionsUrl: undefined,
  51. isNew: false,
  52. isPlatformOnly: true,
  53. isDefaultOptIn: true,
  54. enabled: pgDeltaDiffEnabled,
  55. },
  56. {
  57. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_PLATFORM_WEBHOOKS,
  58. name: 'Platform webhooks',
  59. discussionsUrl: undefined,
  60. isNew: true,
  61. isPlatformOnly: true,
  62. isDefaultOptIn: false,
  63. enabled: platformWebhooksEnabled,
  64. },
  65. {
  66. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_JIT_DB_ACCESS,
  67. name: 'Temporary access',
  68. discussionsUrl: undefined,
  69. isNew: true,
  70. isPlatformOnly: true,
  71. isDefaultOptIn: false,
  72. enabled: jitDbAccessEnabled,
  73. },
  74. {
  75. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS,
  76. name: 'Column-level privileges',
  77. discussionsUrl: 'https://github.com/orgs/briven/discussions/20295',
  78. enabled: true,
  79. isNew: false,
  80. isPlatformOnly: false,
  81. isDefaultOptIn: false,
  82. },
  83. {
  84. key: LOCAL_STORAGE_KEYS.UI_PREVIEW_MARKETPLACE,
  85. name: 'Marketplace',
  86. discussionsUrl: undefined,
  87. enabled: true,
  88. isNew: true,
  89. isPlatformOnly: false,
  90. isDefaultOptIn: true,
  91. },
  92. ].sort((a, b) => Number(b.isNew) - Number(a.isNew))
  93. }