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