Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- master
- feat/ngx-translate-v18-support
- feat/stream-chat-v10
pull_request:
branches:
- master
Expand Down
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Official Angular SDK for [Stream Chat](https://getstream.io/chat/sdk/react/)
# Official Angular SDK for [Stream Chat](https://getstream.io/chat/sdk/angular/)

> The official Angular components for Stream Chat, a service for building chat applications.

Expand All @@ -9,8 +9,9 @@
**Quick Links**

- [Register](https://getstream.io/chat/trial/) to get an API key for Stream Chat
- [Angular Chat Tutorial](https://getstream.io/chat/angular/tutorial/)
- [Docs](https://getstream.io/chat/docs/sdk/angular/)
- [Angular Chat Tutorial](https://getstream.io/chat/sdk/angular/tutorial/)
- [Docs](https://getstream.io/chat/docs/sdk/angular/v8/)
- [Upgrade guide to v8](https://getstream.io/chat/docs/sdk/angular/v8/basics/upgrade-to-v8/)
- [Chat UI Kit](https://getstream.io/chat/ui-kit/)
- [Demo application](https://angular-chat-demo-getstreamio.vercel.app/)
- [Codesandbox](https://codesandbox.io/p/devbox/stream-chat-angular-sample-app-rc3hyw)
Expand All @@ -24,7 +25,7 @@ With our component library, you can build a variety of chat use cases, including

## Angular Chat Tutorial

The best way to get started is to follow the [Angular Chat Tutorial](https://getstream.io/chat/angular/tutorial/). It shows you how to use this SDK to build a fully functional chat application and includes common customizations.
The best way to get started is to follow the [Angular Chat Tutorial](https://getstream.io/chat/sdk/angular/tutorial/). It shows you how to use this SDK to build a fully functional chat application and includes common customizations.

## Free for Makers

Expand All @@ -33,9 +34,9 @@ For complete pricing and details visit our [Chat Pricing Page](https://getstream

## Docs

The [docs](https://getstream.io/chat/docs/sdk/angular/) provide a brief description about the components and services in the library.
The [docs](https://getstream.io/chat/docs/sdk/angular/v8/) provide a brief description about the components and services in the library.

The Angular library is created using the [stream-chat-js](https://github.com/getstream/stream-chat-js) library. For the most common use cases our services should give a nice abstraction over this library, however you might need it for more advanced customization, the [documentation](https://getstream.io/chat/docs/js/) is on our website.
The Angular library is created using the [stream-chat-js](https://github.com/getstream/stream-chat-js) library. For the most common use cases our services should give a nice abstraction over this library, however you might need it for more advanced customization, the [documentation](https://getstream.io/chat/docs/javascript/) is on our website.

## Contributing

Expand All @@ -52,6 +53,8 @@ Check out our current openings and apply via [Stream's website](https://getstrea

### Install with NPM

> v8 is currently a release candidate, published under the `rc` tag on npm. It is built on [`stream-chat`](https://github.com/getstream/stream-chat-js) v10, which is also published under the `rc` tag. If you are upgrading from v7, follow the [upgrade guide](https://getstream.io/chat/docs/sdk/angular/v8/basics/upgrade-to-v8/).

Supported Angular versions: **Angular 17-22**

_Zoneless mode isn't yet supported_
Expand All @@ -61,42 +64,42 @@ _Zoneless mode isn't yet supported_
Run this command if you are using **Angular 22**:

```shell
npm install stream-chat-angular stream-chat @ngx-translate/core ngx-float-ui@21 --legacy-peer-deps
npm install stream-chat-angular@rc stream-chat@rc @ngx-translate/core ngx-float-ui@21 --legacy-peer-deps
```

> `ngx-float-ui` does not have an Angular 22 build yet, so install its latest (v21) with `--legacy-peer-deps` until an Angular 22 release is available.

Run this command if you are using **Angular 21**:

```shell
npm install stream-chat-angular stream-chat @ngx-translate/core ngx-float-ui@21
npm install stream-chat-angular@rc stream-chat@rc @ngx-translate/core ngx-float-ui@21
```

Run this command if you are using **Angular 20**:

```shell
npm install stream-chat-angular stream-chat @ngx-translate/core ngx-float-ui@20
npm install stream-chat-angular@rc stream-chat@rc @ngx-translate/core ngx-float-ui@20
```

Run this command if you are using **Angular 19**:

```shell
npm install stream-chat-angular stream-chat @ngx-translate/core ngx-float-ui@19
npm install stream-chat-angular@rc stream-chat@rc @ngx-translate/core ngx-float-ui@19
```

Run this command if you are using **Angular 18**:

```shell
npm install stream-chat-angular stream-chat @ngx-translate/core ngx-float-ui@18
npm install stream-chat-angular@rc stream-chat@rc @ngx-translate/core ngx-float-ui@18
```

Run this command if you are using **Angular 17**:

```shell
npm install stream-chat-angular stream-chat @ngx-translate/core@17 ngx-float-ui@17
npm install stream-chat-angular@rc stream-chat@rc @ngx-translate/core@17 ngx-float-ui@17
```

Supported node verisons: 18+
Supported Node versions: 22.18+

## Sample App

Expand All @@ -112,7 +115,7 @@ STREAM_USER_ID=<Your user ID>
STREAM_USER_TOKEN=<Your user token>
```

The easiest way to generate a token for testing purposes is to use our [token generator](https://getstream.io/chat/docs/react/token_generator/).
The easiest way to generate a token for testing purposes is to use our [token generator](https://getstream.io/chat/docs/javascript/tokens-and-authentication/).

Run `npm install` to install dependencies.

Expand Down
9 changes: 6 additions & 3 deletions copy-generated-component-docs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs');
const { normalizeGeneratedDocs } = require('./normalize-generated-docs');

const generatedDocsPath = 'temp-component-docs/classes';
const componentDocsPath = process.argv[2];
Expand Down Expand Up @@ -32,9 +33,11 @@ const insertGeneratedParts = (
fileContent: string,
generatedContent: string[]
) => {
generatedContent = generatedContent.map((l) =>
l.replace(/•\s/g, '').replace(/▸\s/g, '')
);
generatedContent = normalizeGeneratedDocs(
generatedContent
.map((l) => l.replace(/•\s/g, '').replace(/▸\s/g, ''))
.join('\n')
).split('\n');
const lines: string[] = fileContent.split('\n');
const startOfGeneratedContentLineNumber = lines.indexOf(
startOfGeneratedContentMark
Expand Down
23 changes: 8 additions & 15 deletions copy-generated-service-docs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const fs = require('fs');
const {
normalizeGeneratedDocs,
servicesDocsBaseUrl,
} = require('./normalize-generated-docs');

const sourcePath = 'temp-service-docs/classes';
const serviceDocsTargetPath = process.argv[2];
Expand Down Expand Up @@ -30,26 +34,15 @@ fs.readdir(sourcePath, (err: any, files: string[]) => {
throw err;
}

// Remove the thre prefix from the title
const result =
`---` +
`\n` +
`title: ${file.replace('.md', '')}` +
`\n` +
`slug: /chat/docs/sdk/angular/services/${file.replace('.md', '')}/` +
`\n` +
`---` +
'\n\n' +
// Title and slug come from the sidebar config, so no frontmatter is added
const result = normalizeGeneratedDocs(
data
.replace(`# Class: ${file.replace('.md', '')}`, '')
.replace(
/\b(?!README)(\w+)\.md\b/g,
'/chat/docs/sdk/angular/services/$1'
)
.replace(/\b(?!README)(\w+)\.md\b/g, `${servicesDocsBaseUrl}/$1/`)
.replace(/•\s/g, '')
.replace(/▸\s/g, '')
.replace('<T\\>', '')
.replace('\\', '');
);

fs.writeFile(`${sourcePath}/${file}`, result, 'utf8', (err: any) => {
if (err) {
Expand Down
85 changes: 85 additions & 0 deletions normalize-generated-docs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// typedoc-plugin-markdown splits generic types into multiple code spans with escaped angle brackets (`Promise`\<`void`\>)
// The docs site renders markdown as MDX, so these are merged into a single code span (`Promise<void>`)
const typeGroupStart = /^(`\w+`\\?<|\\<|\\\{)/;

const findEndOfTypeGroup = (line: string, start: number) => {
let depth = 0;
let i = start;
while (i < line.length) {
if (line.startsWith('=>', i)) {
i += 2;
continue;
}
if (line.startsWith('\\<', i) || line.startsWith('\\{', i)) {
depth++;
i += 2;
continue;
}
if (line[i] === '<' || line[i] === '{') {
depth++;
} else if (
line.startsWith('\\>', i) ||
line[i] === '>' ||
line[i] === '}'
) {
depth--;
const length = line[i] === '\\' ? 2 : 1;
if (depth === 0) {
return i + length;
}
i += length;
continue;
}
i += line[i] === '\\' ? 2 : 1;
}
return -1;
};

const normalizeGenericTypes = (line: string) => {
const isTableRow = line.trimStart().startsWith('|');
let result = '';
let i = 0;
while (i < line.length) {
const end = typeGroupStart.test(line.slice(i))
? findEndOfTypeGroup(line, i)
: -1;
if (end === -1) {
result += line[i];
i++;
continue;
}
const type = line
.slice(i, end)
.replace(/`/g, '')
.replace(/\\([<>{}])/g, '$1')
.replace(/\\\|/g, isTableRow ? '\\|' : '|')
.replace(/ {2,}/g, ' ');
result += '`' + type + '`';
i = end;
}
return (
result
// Merge intersection types into a single code span
.replace(/`([^`]+)` & `([^`]+)`/g, '`$1 & $2`')
.replace(/\\_/g, '_')
);
};

const docsBaseUrl = '/chat/docs/sdk/angular/v8';

// Links in the source code point to the unversioned docs, generated docs link to the docs version they belong to
const normalizeLinks = (line: string) =>
line
.replace(/\]\(\/chat\/docs\/sdk\/angular\/(?!v\d)/g, `](${docsBaseUrl}/`)
// Heading anchors don't contain $ (for example #querystate$)
.replace(/(\]\([^)#\s]*#[\w-]+)\$\)/g, '$1)');

export const servicesDocsBaseUrl = `${docsBaseUrl}/services`;

export const normalizeGeneratedDocs = (content: string) =>
content
.split('\n')
// typedoc emits a lone backslash as a line break in some class descriptions
.filter((line) => line !== '\\')
.map((line) => normalizeLinks(normalizeGenericTypes(line)))
.join('\n');
Loading
Loading