84 lines
3.1 KiB
Markdown
84 lines
3.1 KiB
Markdown
# Feature flags
|
|
|
|
Every feature is gated by a flag. Flags default **on**. Override per-flag with an env var, or
|
|
per-mount with a `flags` prop on `<MessagingInboxProvider>`.
|
|
|
|
## How it works
|
|
|
|
- Env var name = `NEXT_PUBLIC_FEATURE_` + the flag key in `UPPER_SNAKE_CASE`.
|
|
e.g. `scheduledSend` → `NEXT_PUBLIC_FEATURE_SCHEDULED_SEND`.
|
|
- Accepted truthy values: `true`, `1`, `on`, `yes`. Falsy: `false`, `0`, `off`, `no`.
|
|
- Resolution order (last wins): built-in defaults → env → Provider props.
|
|
- In components: `const on = useFeature("huddles")` or `const flags = useFeatureFlags()`.
|
|
|
|
## The flags
|
|
|
|
### Top-level surfaces
|
|
| Flag | Env | Effect when off |
|
|
|---|---|---|
|
|
| `messaging` | `NEXT_PUBLIC_FEATURE_MESSAGING` | Hides channels/DMs in the sidebar & rail |
|
|
| `inbox` | `NEXT_PUBLIC_FEATURE_INBOX` | Removes the Inbox nav + queue |
|
|
| `support` | `NEXT_PUBLIC_FEATURE_SUPPORT` | Removes the Support Center surface |
|
|
| `activity` | `NEXT_PUBLIC_FEATURE_ACTIVITY` | Reserved activity feed |
|
|
|
|
### Messaging sub-features
|
|
| Flag | Effect when off |
|
|
|---|---|
|
|
| `threads` | No "reply in thread", no thread panel/summaries |
|
|
| `reactions` | No emoji reactions or the reaction picker |
|
|
| `mentions` | No @-mention button/highlighting |
|
|
| `pins` | No pin action or pinned bar |
|
|
| `savedItems` | No save/bookmark action or Saved page |
|
|
| `fileUpload` | Hides the attach button |
|
|
| `richComposer` | Composer drops its formatting toolbar |
|
|
| `slashCommands` | Hides the `/` command affordance |
|
|
| `scheduledSend` | Removes schedule-send menu + Drafts |
|
|
| `drafts` | Hides Drafts & sent |
|
|
| `huddles` | Removes huddle/call buttons + the huddle bar |
|
|
| `presence` | Hides presence dots |
|
|
| `typingIndicator` | No "… is typing" |
|
|
| `readReceipts` | (reserved) |
|
|
| `emojiPicker` | Removes emoji picker buttons |
|
|
| `channelBrowser` | Hides "Add channels" / browse |
|
|
| `directMessages` | Hides the DM section |
|
|
| `groupDms` | (reserved) treats group DMs like channels |
|
|
|
|
### Support sub-features
|
|
| Flag | Effect when off |
|
|
|---|---|
|
|
| `supportTickets` | (reserved) core tickets always render in Support |
|
|
| `supportEscalate` | Removes the Escalate action |
|
|
| `supportCallback` | Removes "Request callback" |
|
|
| `supportAvailability` | Removes the online/offline availability pill |
|
|
|
|
### Global
|
|
| Flag | Effect when off |
|
|
|---|---|
|
|
| `search` | Removes the header search + palette trigger |
|
|
| `commandPalette` | (reserved) ⌘K behaviour |
|
|
| `notifications` | Removes the bell + panel |
|
|
| `themeToggle` | Removes the light/dark toggle |
|
|
| `themingPanel` | Removes the live Appearance panel |
|
|
| `workspaceSwitcher` | Removes the far-left workspace rail switcher |
|
|
| `aiAssist` | (reserved) AI assist affordances |
|
|
|
|
## Examples
|
|
|
|
```bash
|
|
# A lean messaging-only build
|
|
NEXT_PUBLIC_FEATURE_SUPPORT=false
|
|
NEXT_PUBLIC_FEATURE_INBOX=false
|
|
NEXT_PUBLIC_FEATURE_HUDDLES=false
|
|
NEXT_PUBLIC_FEATURE_SCHEDULED_SEND=false
|
|
```
|
|
|
|
```tsx
|
|
// Per-mount override (e.g. embed a read-only chat)
|
|
<MessagingInboxProvider flags={{ richComposer: false, huddles: false, support: false }}>
|
|
…
|
|
</MessagingInboxProvider>
|
|
```
|
|
|
|
Add a new flag: extend `FeatureFlags` + `defaultFlags` in
|
|
`packages/messaging-inbox-sdk/src/config.ts`; the env mapping is automatic.
|