Skip to content

Commit 42299de

Browse files
authored
Merge pull request #259 from GetStream/beta
Beta
2 parents 8d97c98 + a932ba5 commit 42299de

File tree

144 files changed

+4366
-1745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+4366
-1745
lines changed

.github/workflows/workflow.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ on:
33
push:
44
branches:
55
- master
6+
- beta
67
pull_request:
78
branches:
89
- master
10+
- beta
911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
@@ -17,7 +19,6 @@ jobs:
1719
- uses: actions/checkout@v2
1820
with:
1921
fetch-depth: 0
20-
2122
- name: Cache node modules
2223
uses: actions/cache@v1
2324
with:
@@ -60,6 +61,6 @@ jobs:
6061
- name: Push to docusaurus
6162
uses: GetStream/push-stream-chat-docusaurus-action@main
6263
with:
63-
target-branch: ${{ github.ref == 'refs/heads/master' && 'production' || 'staging' }}
64+
target-branch: ${{ github.ref == 'refs/heads/master' && 'staging' || 'staging' }}
6465
env:
6566
DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ Thumbs.db
5454

5555
# Angular environment.ts
5656
/**/environments/environment.ts
57+
58+
# Encapsulated stream-chat-css
59+
projects/stream-chat-angular/src/assets/styles

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ Check out our current openings and apply via [Stream's website](https://getstrea
5454
Run the following command if you are using **Angular 13**:
5555

5656
```shell
57-
npm install stream-chat-angular @stream-io/stream-chat-css stream-chat @ngx-translate/core
57+
npm install stream-chat-angular stream-chat @ngx-translate/core
5858
```
5959

6060
Run this command if you are using **Angular 12**:
6161

6262
```shell
63-
npm install stream-chat-angular @stream-io/stream-chat-css stream-chat@5 @ngx-translate/core --legacy-peer-deps
63+
npm install stream-chat-angular stream-chat@5 @ngx-translate/core --legacy-peer-deps
6464
```
6565

6666
## Sample App
@@ -79,6 +79,22 @@ STREAM_USER_TOKEN=<Your user token>
7979

8080
Run `npm start` and navigate to `http://localhost:4200/`.
8181

82+
## Customization examples
83+
84+
This repository includes a sample app that showcases how you can provide your own template for different components within the SDK:
85+
86+
To run the app:
87+
88+
Create a file named `.env` in the root directory with the following content:
89+
90+
```
91+
STREAM_API_KEY=<Your API key>
92+
STREAM_USER_ID=<Your user ID>
93+
STREAM_USER_TOKEN=<Your user token>
94+
```
95+
96+
Run `npm start:customizations-example` and navigate to `http://localhost:4200/`.
97+
8298
## Local development
8399

84100
Run `npm install` in the root of the project. You can use the `npm run start:dev` command to start the SampleApp with automatic reloading.

angular.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,114 @@
213213
}
214214
}
215215
}
216+
},
217+
"customizations-example": {
218+
"projectType": "application",
219+
"schematics": {
220+
"@schematics/angular:component": {
221+
"style": "scss"
222+
},
223+
"@schematics/angular:application": {
224+
"strict": true
225+
}
226+
},
227+
"root": "projects/customizations-example",
228+
"sourceRoot": "projects/customizations-example/src",
229+
"prefix": "app",
230+
"architect": {
231+
"build": {
232+
"builder": "@angular-devkit/build-angular:browser",
233+
"options": {
234+
"outputPath": "dist/customizations-example",
235+
"index": "projects/customizations-example/src/index.html",
236+
"main": "projects/customizations-example/src/main.ts",
237+
"polyfills": "projects/customizations-example/src/polyfills.ts",
238+
"tsConfig": "projects/customizations-example/tsconfig.app.json",
239+
"inlineStyleLanguage": "scss",
240+
"assets": [
241+
"projects/customizations-example/src/favicon.ico",
242+
"projects/customizations-example/src/assets"
243+
],
244+
"styles": ["projects/customizations-example/src/styles.scss"],
245+
"scripts": []
246+
},
247+
"configurations": {
248+
"production": {
249+
"budgets": [
250+
{
251+
"type": "initial",
252+
"maximumWarning": "500kb",
253+
"maximumError": "1mb"
254+
},
255+
{
256+
"type": "anyComponentStyle",
257+
"maximumWarning": "2kb",
258+
"maximumError": "4kb"
259+
}
260+
],
261+
"fileReplacements": [
262+
{
263+
"replace": "projects/customizations-example/src/environments/environment.ts",
264+
"with": "projects/customizations-example/src/environments/environment.prod.ts"
265+
}
266+
],
267+
"outputHashing": "all"
268+
},
269+
"development": {
270+
"buildOptimizer": false,
271+
"optimization": false,
272+
"vendorChunk": true,
273+
"extractLicenses": false,
274+
"sourceMap": true,
275+
"namedChunks": true
276+
}
277+
},
278+
"defaultConfiguration": "production"
279+
},
280+
"serve": {
281+
"builder": "@angular-devkit/build-angular:dev-server",
282+
"configurations": {
283+
"production": {
284+
"browserTarget": "customizations-example:build:production"
285+
},
286+
"development": {
287+
"browserTarget": "customizations-example:build:development"
288+
}
289+
},
290+
"defaultConfiguration": "development"
291+
},
292+
"extract-i18n": {
293+
"builder": "@angular-devkit/build-angular:extract-i18n",
294+
"options": {
295+
"browserTarget": "customizations-example:build"
296+
}
297+
},
298+
"test": {
299+
"builder": "@angular-devkit/build-angular:karma",
300+
"options": {
301+
"main": "projects/customizations-example/src/test.ts",
302+
"polyfills": "projects/customizations-example/src/polyfills.ts",
303+
"tsConfig": "projects/customizations-example/tsconfig.spec.json",
304+
"karmaConfig": "projects/customizations-example/karma.conf.js",
305+
"inlineStyleLanguage": "scss",
306+
"assets": [
307+
"projects/customizations-example/src/favicon.ico",
308+
"projects/customizations-example/src/assets"
309+
],
310+
"styles": ["projects/customizations-example/src/styles.scss"],
311+
"scripts": []
312+
}
313+
},
314+
"lint": {
315+
"builder": "@angular-eslint/builder:lint",
316+
"options": {
317+
"lintFilePatterns": [
318+
"projects/customizations-example/**/*.ts",
319+
"projects/customizations-example/**/*.html"
320+
]
321+
}
322+
}
323+
}
216324
}
217325
},
218326
"defaultProject": "stream-chat-angular"

copy-generated-service-docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fs.readdir(sourcePath, (err: any, files: string[]) => {
3131
}
3232

3333
// Remove the thre prefix from the title
34-
const result = data.replace(/# Class:/g, '#');
34+
const result = data.replace(/# Class:/g, '#').replace('<T\\>', '');
3535

3636
fs.writeFile(`${sourcePath}/${file}`, result, 'utf8', (err: any) => {
3737
if (err) {
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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

Comments
 (0)