|
| 1 | +--- |
| 2 | +id: upgrade-v2 |
| 3 | +title: Upgrade from v2 |
| 4 | +--- |
| 5 | + |
| 6 | +## About v3 |
| 7 | + |
| 8 | +This version's main focus was to enhance the customizability of the SDK, the two main features are: |
| 9 | + |
| 10 | +- there are many new customization points where you can provide your own template to override the default UI - our [customization guide](../concepts/customization.mdx) covers this topic in detail |
| 11 | +- you can take advantage of TypeScript generics to define custom fields for messages, message reactions, attachments, commands, channels or events - our [generics guide](../concepts/generics.mdx) explain this topic in more details |
| 12 | + |
| 13 | +Below you can find the list of breaking changes and instructions on how to update your code. |
| 14 | + |
| 15 | +## Peer dependencies |
| 16 | + |
| 17 | +### stream-chat |
| 18 | + |
| 19 | +Upgrade to stream-chat `^6.4.0`. |
| 20 | + |
| 21 | +You might need to update your code if you created custom components/services that used `stream-chat` in your application. |
| 22 | + |
| 23 | +The biggest change is that generic parameters were refactored into a single generic parameter, this has two major implications: |
| 24 | + |
| 25 | +- If you used generic parameters for handling messages, message reactions, attachments, commands, channels or events you have to change those generic parameters, the SDK uses the [`DefaultStreamChatGenerics`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts) parameter instead of the individual `DefaultAttachmentType`, `DefaultChannelType`, `DefaultCommandType`, `DefaultEventType` `DefaultMessageType`, `DefaultReactionType` and `DefaultUserType` parameters. |
| 26 | +- If you are interacting with the `ChannelService` or `ChatClientService` you'll have to provide the [`DefaultStreamChatGenerics`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts) parameter (or a descended) for message reactions, attachments, commands, channels or events (you don't need to provide it for messages as it's already part of the [`StreamMessage`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts) class) |
| 27 | + |
| 28 | +Our [generics guide](../concepts/generics.mdx) explains this topic in more details. |
| 29 | + |
| 30 | +You can find the full list of breaking changes in stream-chat [v5](https://github.com/GetStream/stream-chat-js/releases/tag/v5.0.0) and [v6](https://github.com/GetStream/stream-chat-js/releases/tag/v6.0.0) on GitHub. |
| 31 | + |
| 32 | +#### Angular 13 |
| 33 | + |
| 34 | +Run the following command to updgrade if you're using Angular 13: |
| 35 | + |
| 36 | +``` |
| 37 | + |
| 38 | +``` |
| 39 | + |
| 40 | +#### Angular 12 |
| 41 | + |
| 42 | +Run the following command to updgrade if you're using Angular 12: |
| 43 | + |
| 44 | +``` |
| 45 | +npm install [email protected] stream-chat-angular@3 --legacy-peer-deps |
| 46 | +``` |
| 47 | + |
| 48 | +### stream-chat-css |
| 49 | + |
| 50 | +You can drop the `@stream-io/stream-chat-css` dependency because going forward `stream-chat-angular` will encapsulate the library. |
| 51 | + |
| 52 | +Rewrite your stylesheet imports to this: |
| 53 | + |
| 54 | +`~stream-chat-angular/src/assets/styles/scss/index.scss` |
| 55 | + |
| 56 | +Or this if you were using CSS: |
| 57 | + |
| 58 | +`~stream-chat-angular/src/assets/styles/css/index.css` |
| 59 | + |
| 60 | +It's still possible to individually import stylesheets you just have to replace the `~@stream-io/stream-chat-css/dist` prefix with `~stream-chat-angular/src/assets/styles`. |
| 61 | + |
| 62 | +## Inputs removed in favor of channel capabilities |
| 63 | + |
| 64 | +The following inputs are removed: |
| 65 | + |
| 66 | +| Component/service | Input name | Replacement | |
| 67 | +| ------------------------------------------------------------------------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 68 | +| [`MessageListComponent`](../components/MessageListComponent.mdx) | `enabledMessageActionsInput` | Use our [permission framework](https://getstream.io/chat/docs/javascript/chat_permission_policies/?language=javascript&q=slow%20mode) to control what actions are available to different users | |
| 69 | +| [`MessageListComponent`](../components/MessageListComponent.mdx) | `areReactionsEnabled` | Use our [permission framework](https://getstream.io/chat/docs/javascript/chat_permission_policies/?language=javascript&q=slow%20mode) to control what actions are available to different users | |
| 70 | +| [`MessageInputConfigService`](../services/MessageInputConfigService.mdx) | `acceptedFileTypes` | Use [application settings](https://getstream.io/chat/docs/javascript/app_setting_overview/?language=javascript#file-uploads) to control the accepted file types | |
| 71 | +| [`MessageInputComponent`](../components/MessageInputComponent.mdx) | `acceptedFileTypes` | Use [application settings](https://getstream.io/chat/docs/javascript/app_setting_overview/?language=javascript#file-uploads) to control the accepted file types | |
| 72 | +| [`MessageComponent`](../components/MessageComponent.mdx) | `areReactionsEnabled` | Use our [permission framework](https://getstream.io/chat/docs/javascript/chat_permission_policies/?language=javascript&q=slow%20mode) to control what actions are available to different users. Please note that existing reactions of a message will be displayed, even if reacting is disabled. | |
| 73 | +| [`MessageComponent`](../components/MessageComponent.mdx) | `canReactToMessage` | Use our [permission framework](https://getstream.io/chat/docs/javascript/chat_permission_policies/?language=javascript&q=slow%20mode) to control what actions are available to different users. Please note that existing reactions of a message will be displayed, even if reacting is disabled. | |
| 74 | +| [`MessageComponent`](../components/MessageComponent.mdx) | `canReceiveReadEvents` | Use our [permission framework](https://getstream.io/chat/docs/javascript/chat_permission_policies/?language=javascript&q=slow%20mode) to control what actions are available to different users | |
| 75 | + |
| 76 | +## Centralized customizations |
| 77 | + |
| 78 | +| Description | Old option | New option | |
| 79 | +| ----------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | |
| 80 | +| The autocomplete list item template for mentioning users | `AutocompleteTextareaComponent.mentionAutocompleteItemTemplate` | [`CustomTemplatesService.mentionAutocompleteItemTemplate$`](../services/CustomTemplatesService.mdx) | |
| 81 | +| The autocomplete list item template for commands | `AutocompleteTextareaComponent.commandAutocompleteItemTemplate` | [`CustomTemplatesService.commandAutocompleteItemTemplate$`](../services/CustomTemplatesService.mdx) | |
| 82 | +| Item in the channel list | `ChannelListComponent.customChannelPreviewTemplate` | [`CustomTemplatesService.customChannelPreviewTemplate$`](../services/CustomTemplatesService.mdx) | |
| 83 | +| The message input template used when editing a message | `MessageActionsBoxComponent.messageInputTemplate` | [`CustomTemplatesService.messageInputTemplate$`](../services/CustomTemplatesService.mdx) | |
| 84 | +| The message input template used when editing a message | `MessageComponent.messageInputTemplate` | [`CustomTemplatesService.messageInputTemplate$`](../services/CustomTemplatesService.mdx) | |
| 85 | +| The template used for displaying a mention inside a message | `MessageComponent.mentionTemplate` | [`CustomTemplatesService.mentionTemplate$`](../services/CustomTemplatesService.mdx) | |
| 86 | +| The autocomplete list item template for mentioning users | `MessageInputComponent.mentionAutocompleteItemTemplate` | [`CustomTemplatesService.mentionAutocompleteItemTemplate$`](../services/CustomTemplatesService.mdx) | |
| 87 | +| The autocomplete list item template for commands | `MessageInputComponent.commandAutocompleteItemTemplate` | [`CustomTemplatesService.commandAutocompleteItemTemplate$`](../services/CustomTemplatesService.mdx) | |
| 88 | +| The template for emoji picker | `MessageInputComponent.emojiPickerTemplate$` | [`CustomTemplatesService.emojiPickerTemplate$`](../services/CustomTemplatesService.mdx) | |
| 89 | +| The template used to display a message in the message list | `MessageListComponent.messageTemplate` | [`CustomTemplatesService.messageTemplate$ `](../services/CustomTemplatesService.mdx) | |
| 90 | +| The message input template used when editing a message | `MessageListComponent.messageInputTemplate` | [`CustomTemplatesService.messageInputTemplate$`](../services/CustomTemplatesService.mdx) | |
| 91 | +| The template used for displaying a mention inside a message | `MessageListComponent.mentionTemplate` | [`CustomTemplatesService.mentionTemplate$`](../services/CustomTemplatesService.mdx) | |
| 92 | +| The typing indicator template used in the message list | `MessageListComponent.typingIndicatorTemplate` | [`CustomTemplatesService.typingIndicatorTemplate$`](../services/CustomTemplatesService.mdx) | |
| 93 | +| The typing indicator template used in the message list | `MessageReactionsComponent.typingIndicatorTemplate` | [`CustomTemplatesService.typingIndicatorTemplate$`](../services/CustomTemplatesService.mdx) | |
| 94 | +| The autocomplete list item template for commands | `MessageInputConfigService.commandAutocompleteItemTemplate` | [`CustomTemplatesService.commandAutocompleteItemTemplate$`](../services/CustomTemplatesService.mdx) | |
| 95 | +| The autocomplete list item template for mentioning users | `MessageInputConfigService.mentionAutocompleteItemTemplate` | [`CustomTemplatesService.mentionAutocompleteItemTemplate$`](../services/CustomTemplatesService.mdx) | |
| 96 | +| The template for emoji picker | `MessageInputConfigService.emojiPickerTemplate` | [`CustomTemplatesService.emojiPickerTemplate$`](../services/CustomTemplatesService.mdx) | |
| 97 | +| The template for channel actions | `ChannelHeaderComponent.channelActionsTemplate` | [`CustomTemplatesService.channelActionsTemplate$`](../services/CustomTemplatesService.mdx) | |
| 98 | + |
| 99 | +## `ChatClient.notification$` renamed to `events$` |
| 100 | + |
| 101 | +The `notification$` stream on the [`ChatClientService`](../services/ChatClientService.mdx) was renamed to `events$` as it better represents what this Observable does. |
| 102 | + |
| 103 | +The `events$` stream emits the received [client, notification and user presence events](https://getstream.io/chat/docs/javascript/event_object/?language=javascript). |
| 104 | + |
| 105 | +The payload of this Observable was renamed from `Notification` to `ClientEvent`. |
| 106 | + |
| 107 | +## Custom action names removed |
| 108 | + |
| 109 | +Use our [permission framework](https://getstream.io/chat/docs/javascript/chat_permission_policies/?language=javascript&q=slow%20mode) to control the authorization of the following message actions: |
| 110 | + |
| 111 | +| Custom action name | Channel capability | Comment | |
| 112 | +| ------------------ | -------------------- | -------------------------------------------- | |
| 113 | +| `quote` | `quote-message` | | |
| 114 | +| `pin` | `pin-message` | Currently turned off because not implemented | |
| 115 | +| `flag` | `flag-message` | | |
| 116 | +| `edit` | `update-own-message` | | |
| 117 | +| `edit-any` | `update-any-message` | | |
| 118 | + |
| 119 | +The `mute` action is removed. |
0 commit comments