Skip to content

Commit 85d5b4e

Browse files
authored
fix!: ship the CustomChannelData typing and remove dead exports and the transliterate dependency (#3403)
BREAKING CHANGE: unused exports and the transliterate dependency are removed, and stream-chat-react now types channel custom data for apps. - `Root` and `Header` are no longer exported from the package root. They are the parts of `Alert`; use `Alert.Root` and `Alert.Header`. - `UploadIcon`, `BinIcon`, `PauseIcon` and `PlayIcon` are removed. Copy the SVG into the app, or use `IconPlus` / `IconAttachment`, `IconDelete`, `IconPauseFill` and `IconPlayFill` from the v15 icon set. - `@stream-io/transliterate` is no longer an optional dependency. Apps that import it must add it to their own dependencies. For mention search, pass a `transliterate` function to stream-chat's mentions middleware. - Importing `stream-chat-react` now types `channel.data.custom.name` and `.image` (`string | undefined`). Delete the app's own `name` / `image` declarations on `CustomChannelData`; a declaration with another type overrides the SDK's under `skipLibCheck` and fails with TS2430 without it. - `DefaultChannelData` no longer has `subtitle` or `team`. Declare them on `CustomChannelData` if the app stores them under `custom`; read the channel's team from `channel.data.team`. - The translation key `messageComposer.icons.attachFiles.text` is removed. See ai-docs/v15-breaking-changes.md (BC-101) and ai-docs/ai-migration-v14-v15.md.
1 parent 059f939 commit 85d5b4e

19 files changed

Lines changed: 145 additions & 206 deletions

File tree

‎ai-docs/ai-migration-v14-v15.md‎

Lines changed: 37 additions & 12 deletions
Large diffs are not rendered by default.

‎ai-docs/i18n-v15-key-map.json‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$comment": "Migration table: natural-language translation key (v14) -> namespaced key (v15). Hand-reviewed; nothing regenerates it. Integrators who passed translationsForLanguage/registerTranslation dictionaries keyed on the old strings should use this to rename their keys. Where one v14 key became several v15 keys, `key` is the first and `also` lists the rest: copy the translation to each. See ai-docs/i18n-v15-migration.md.",
3-
"count": 661,
3+
"count": 660,
44
"keys": {
55
"aria/Active": {
66
"key": "a11y.accessibleLabel.active.ariaLabel",
@@ -2020,10 +2020,6 @@
20202020
"key": "messageComposer.geolocationPreview.sharedLocation.title",
20212021
"prose": true
20222022
},
2023-
"Attach files": {
2024-
"key": "messageComposer.icons.attachFiles.text",
2025-
"prose": true
2026-
},
20272023
"aria/Cancel Reply": {
20282024
"key": "messageComposer.quotedMessagePreview.cancelReply.ariaLabel",
20292025
"prose": true

‎ai-docs/i18n-v15-migration.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ imported and copied into `Streami18n` at construction, so they shipped even if y
3636

3737
## Renaming your keys
3838

39-
Every old key that v15 still has maps to a new key ([some were removed](#keys-removed-without-a-replacement)). A few now feed two: their entry lists the second under `also`, and the translation goes on both. The full table (661 rows, covering the `aiComponents.*` keys of `stream-chat-react/ai-components` except the attachment's `Image`, which the plugin README maps) is
39+
Every old key that v15 still has maps to a new key ([some were removed](#keys-removed-without-a-replacement)). A few now feed two: their entry lists the second under `also`, and the translation goes on both. The full table (660 rows, covering the `aiComponents.*` keys of `stream-chat-react/ai-components` except the attachment's `Image`, which the plugin README maps) is
4040
[`i18n-v15-key-map.json`](https://github.com/GetStream/stream-chat-react/blob/master/ai-docs/i18n-v15-key-map.json):
4141

4242
```json
@@ -107,7 +107,7 @@ nothing catches a stale one there. The extra plural categories some languages us
107107
These v14 keys (from `src/i18n/en.json` at `v14.10.0`, plural suffixes folded) have no entry in the key map. A `t()` call on one of them no longer compiles (`TS2769`), and a dictionary entry for one never matches. Copy you still need is app-owned now: give it a key of your own through `asDynamicKey`, with the English inline, and keep its translations in your dictionaries ([Calling `t` in your own components](#calling-t-in-your-own-components)).
108108

109109
```text
110-
{{ imageCount }} more | {{ user }} is typing... | {{ users }} and {{ user }} are typing... | {{ users }} and more are typing... | +{{ imageCount }} | Allow comments | Allow option suggestion | aria/Collapse sidebar | aria/Expand sidebar | aria/Unblock User | Attachment | Channel members | Close emoji picker | Commands matching | Connection failure, reconnecting now... | Create | Delete for me | Download attachment {{ name }} | Drag your files here to add to your post | Emoji matching | End | End vote | Error connecting to chat, refresh the page to try again. | Error removing members | Error uploading file | Error uploading image | Failed to delete the message | Failed to load channels | Failed to load more channels | Failed to mark channel as read | File is too large: {{ size }}, maximum upload size is {{ limit }} | Image | Link | live | Manage members | Maximum number of votes (from 2 to 10) | mention/Channel | mention/Here | Menu | Messages have been marked unread. | Missing permissions to upload the attachment | network error | New | No chats here yet… | Nobody will be able to vote in this poll anymore. | Ok | Open emoji picker | People matching | Remove | Remove {{ count }} members | Remove channel members | Removed {{ count }} members | Reply to Message | Searching... | searchResultsCount | Select a thread to continue the conversation | Shared live location | Slow Mode ON | Submit | Thread reply | Upload type: "{{ type }}" is not allowed | You've reached the maximum number of files
110+
{{ imageCount }} more | {{ user }} is typing... | {{ users }} and {{ user }} are typing... | {{ users }} and more are typing... | +{{ imageCount }} | Allow comments | Allow option suggestion | aria/Collapse sidebar | aria/Expand sidebar | aria/Unblock User | Attach files | Attachment | Channel members | Close emoji picker | Commands matching | Connection failure, reconnecting now... | Create | Delete for me | Download attachment {{ name }} | Drag your files here to add to your post | Emoji matching | End | End vote | Error connecting to chat, refresh the page to try again. | Error removing members | Error uploading file | Error uploading image | Failed to delete the message | Failed to load channels | Failed to load more channels | Failed to mark channel as read | File is too large: {{ size }}, maximum upload size is {{ limit }} | Image | Link | live | Manage members | Maximum number of votes (from 2 to 10) | mention/Channel | mention/Here | Menu | Messages have been marked unread. | Missing permissions to upload the attachment | network error | New | No chats here yet… | Nobody will be able to vote in this poll anymore. | Ok | Open emoji picker | People matching | Remove | Remove {{ count }} members | Remove channel members | Removed {{ count }} members | Reply to Message | Searching... | searchResultsCount | Select a thread to continue the conversation | Shared live location | Slow Mode ON | Submit | Thread reply | Upload type: "{{ type }}" is not allowed | You've reached the maximum number of files
111111
```
112112

113113
```tsx

‎ai-docs/v15-breaking-changes.md‎

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ yarn api-surface check --doc ai-docs/v15-breaking-changes.md --diff diff.json
6464

6565
## Index
6666

67-
96 entries.
67+
98 entries.
6868

6969
| ID | Title | Group |
7070
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
@@ -163,6 +163,8 @@ yarn api-surface check --doc ai-docs/v15-breaking-changes.md --diff diff.json
163163
| [BC-093](#bc-093) | `MessageContextValue.onMentionsClickMessage` / `onMentionsHoverMessage` and `useMentionsHandler`'s handlers are `undefined` without a handler | Messages and message lists |
164164
| [BC-094](#bc-094) | `mentionsMarkdownPlugin` and `createMentionPluginAndDisplayTextSet` take mention entities only | Messages and message lists |
165165
| [BC-095](#bc-095) | `disableQuotedMessages` is removed from `MessageProps`, `MessageListProps` and `useMessagePermissions` | Messages and message lists |
166+
| [BC-097](#bc-097) | channel detail views render no close button outside a modal without `onClose`; `ChannelDetail` calls `onLayoutChange` | Chat, ChatView and layout |
167+
| [BC-101](#bc-101) | `Root`, `Header`, `UploadIcon`, `BinIcon`, `PauseIcon`, `PlayIcon` unexported; `@stream-io/transliterate` dropped; `CustomChannelData` typed for apps; `DefaultChannelData` holds only `name` and `image` | Package and runtime |
166168
| [BC-102](#bc-102) | `initialMessage` is removed from `MessageProps` and `MessageContextValue`; `useIsRenderedAsThreadParent()` tells the thread's parent message apart | Messages and message lists |
167169

168170
## Package and runtime
@@ -246,6 +248,77 @@ export const DayDivider = ({ message }: { message: LocalMessage }) => {
246248
};
247249
```
248250

251+
<a id="bc-101"></a>
252+
253+
### BC-101: `Root`, `Header`, `UploadIcon`, `BinIcon`, `PauseIcon` and `PlayIcon` are no longer exported; `@stream-io/transliterate` is no longer a dependency; `CustomChannelData` is typed for apps and `DefaultChannelData` holds only `name` and `image`
254+
255+
- Status: confirmed
256+
- Area: package / exports / types
257+
- User impact:
258+
- compile error (`TS2305`) on importing `Root` or `Header` from `stream-chat-react`, and `undefined` in plain JS. They are the parts of `Alert`, exported under generic names; `Alert.Root`, `Alert.Header` and `Alert.Actions` are unchanged.
259+
- compile error (`TS2305`) on importing `UploadIcon`, `BinIcon`, `PauseIcon` or `PlayIcon`. No SDK component rendered them in v14 or v15.
260+
- install: `@stream-io/transliterate` is no longer installed with this package. No SDK code imported it in v14 or v15; an app that imports it without declaring it gets a module-not-found error.
261+
- types: `channel.data.custom.name` and `.image` are typed `string | undefined` in every app that imports `stream-chat-react`. v14 and earlier v15 release candidates declared the merge of `DefaultChannelData` into `CustomChannelData` in a file `tsc` did not emit, so apps saw `CustomChannelData` without those fields. An app that augments `CustomChannelData` with `name` or `image` under another type gets no error with `skipLibCheck: true` (its own type wins), and `TS2430` inside `stream-chat`'s `custom_types.d.ts` without it.
262+
- types: `DefaultChannelData` loses `subtitle` and `team`. No SDK code read them; `team` is a top-level channel field in `stream-chat` v10 (`channel.data.team`), not custom data. Code that reads `DefaultChannelData['team']`, or relies on `extends DefaultChannelData` to type `custom.subtitle` / `custom.team`, gets `TS2339`.
263+
- Old API:
264+
- `Root`, `Header` (`src/components/Dialog/components/Alert.tsx`), re-exported from the package root through `Dialog/components/index.ts`
265+
- `UploadIcon`, `BinIcon`, `PauseIcon`, `PlayIcon` (`src/components/MessageComposer/icons.tsx`), re-exported through `MessageComposer/index.ts`
266+
- `optionalDependencies['@stream-io/transliterate']: ^1.5.5`
267+
- `DefaultChannelData`: `image`, `name`, `subtitle`, `team` (all `string | undefined`)
268+
- `src/@types/stream-chat-custom-data.d.ts`, a declaration-only file that `tsc` never copies to `dist/types`
269+
- Replacement:
270+
- `Root` / `Header`: `Alert.Root` / `Alert.Header`, the same components.
271+
- The icons: copy the SVG into the app, or use the v15 icon set: `IconPlus` or `IconAttachment` for `UploadIcon`, `IconDelete` for `BinIcon`, `IconPauseFill` for `PauseIcon`, `IconPlayFill` for `PlayIcon`. They follow the v15 design, not the v14 shapes, and take `BaseIconProps`.
272+
- `@stream-io/transliterate`: add it to the app's own dependencies if the app imports it. Mention search in `stream-chat` takes a `transliterate` function on its mentions middleware.
273+
- `CustomChannelData`: delete an app's own `name?: string` / `image?: string` declarations, which are now redundant, and keep the augmentation for the app's other fields. Rename a field the app declares as `name` or `image` with another type. Declare `subtitle?: string` / `team?: string` on `CustomChannelData` if the app stores them under `custom`; read the channel's team from `channel.data.team`.
274+
- Evidence:
275+
- `release-v14:src/components/Dialog/components/Alert.tsx:6`, `:25` `export const Root` / `export const Header`; `master:src/components/Dialog/components/Alert.tsx` declares both without `export` and exports them as `Alert.Root` / `Alert.Header`, like `Prompt` and `Viewer`
276+
- `release-v14:src/components/MessageComposer/icons.tsx:3`, `:30`, `:36`, `:47`; `release-v14:src/components/MessageComposer/index.ts:19` `export * from './icons'`; no other reference in `src` or `examples` on either branch
277+
- `release-v14:package.json:122` `"@stream-io/transliterate": "^1.5.5"`; no import in `src` on either branch
278+
- `release-v14:src/@types/stream-chat-custom-data.d.ts:19` `interface CustomChannelData extends DefaultChannelData {}`; `release-v14:tsconfig.lib.json` emits declarations from `.ts` sources only, so `dist/types/@types` does not exist. `master:src/types/defaultDataInterfaces.ts` declares `DefaultChannelData` with `image` and `name` only, declares the merge and ships as `dist/types/types/defaultDataInterfaces.d.ts`, re-exported from `dist/types/index.d.ts`
279+
- commit: REACT-1306
280+
- Docs impact:
281+
- `02-state/01-state-and-entities/06-data-conventions.md` (the `CustomChannelData` augmentation sample), `08-release-guides/01-upgrade-to-v15.md`
282+
- Example needed: yes
283+
284+
Before (v14):
285+
286+
```tsx
287+
import { Header, Root } from 'stream-chat-react';
288+
289+
declare module 'stream-chat' {
290+
interface CustomChannelData {
291+
image?: string;
292+
name?: string;
293+
priority?: number;
294+
}
295+
}
296+
297+
export const DeleteWarning = () => (
298+
<Root>
299+
<Header title='Delete channel?' />
300+
</Root>
301+
);
302+
```
303+
304+
After (v15):
305+
306+
```tsx
307+
import { Alert } from 'stream-chat-react';
308+
309+
declare module 'stream-chat' {
310+
interface CustomChannelData {
311+
priority?: number;
312+
}
313+
}
314+
315+
export const DeleteWarning = () => (
316+
<Alert.Root>
317+
<Alert.Header title='Delete channel?' />
318+
</Alert.Root>
319+
);
320+
```
321+
249322
## Contexts and customization
250323

251324
<a id="bc-003"></a>

‎examples/tutorial/src/3-core-component-setup/stream-chat.d.ts‎

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import type { DefaultAttachmentData, DefaultChannelData } from 'stream-chat-react';
1+
import type { DefaultAttachmentData } from 'stream-chat-react';
22

33
declare module 'stream-chat' {
44
interface CustomAttachmentData extends DefaultAttachmentData {
55
image?: string;
66
name?: string;
77
url?: string;
88
}
9-
10-
interface CustomChannelData extends DefaultChannelData {
11-
image?: string;
12-
}
139
}

‎examples/vite/src/i18n/de.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ export const deTranslations = {
613613
'messageComposer.geolocationPreview.removeLocationAttachment.ariaLabel':
614614
'Standortanhang entfernen',
615615
'messageComposer.geolocationPreview.sharedLocation.title': 'Geteilter Standort',
616-
'messageComposer.icons.attachFiles.text': 'Dateien anhängen',
617616
'messageComposer.quotedMessagePreview.cancelReply.ariaLabel': 'Antwort abbrechen',
618617
'messageComposer.quotedMessagePreview.files.label_one': '{{ count }} Datei',
619618
'messageComposer.quotedMessagePreview.files.label_other': '{{ count }} Dateien',

‎examples/vite/src/i18n/it.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ export const itTranslations = {
607607
'messageComposer.geolocationPreview.removeLocationAttachment.ariaLabel':
608608
'Rimuovi l’allegato di posizione',
609609
'messageComposer.geolocationPreview.sharedLocation.title': 'Posizione condivisa',
610-
'messageComposer.icons.attachFiles.text': 'Allega file',
611610
'messageComposer.quotedMessagePreview.cancelReply.ariaLabel': 'Annulla risposta',
612611
'messageComposer.quotedMessagePreview.files.label_one': '{{ count }} file',
613612
'messageComposer.quotedMessagePreview.files.label_other': '{{ count }} file',

‎package.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@
152152
"use-sync-external-store": "^1.7.0",
153153
"zod": "^4.2.0"
154154
},
155-
"optionalDependencies": {
156-
"@stream-io/transliterate": "^1.5.5"
157-
},
158155
"peerDependencies": {
159156
"@a2ui/react": "~0.15.0",
160157
"@a2ui/web_core": "~0.15.0",

‎src/@types/stream-chat-custom-data.d.ts‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)