stream-chat-angular 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +81 -46
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/channel-header/channel-header.component.js +29 -9
- package/esm2015/lib/channel-preview/channel-preview.component.js +23 -11
- package/esm2015/lib/channel.service.js +3 -3
- package/esm2015/lib/get-channel-display-text.js +15 -0
- package/esm2015/lib/list-users.js +12 -0
- package/esm2015/lib/message/message.component.js +3 -3
- package/esm2015/public-api.js +2 -2
- package/fesm2015/stream-chat-angular.js +71 -46
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/channel-header/channel-header.component.d.ts +5 -1
- package/lib/channel-preview/channel-preview.component.d.ts +3 -1
- package/lib/channel.service.d.ts +4 -2
- package/lib/get-channel-display-text.d.ts +3 -0
- package/lib/list-users.d.ts +2 -0
- package/lib/message/message.component.d.ts +3 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
- package/src/assets/version.ts +1 -1
- package/esm2015/lib/message/read-by-text.js +0 -29
- package/lib/message/read-by-text.d.ts +0 -2
|
@@ -2,6 +2,7 @@ import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core
|
|
|
2
2
|
import { Channel } from 'stream-chat';
|
|
3
3
|
import { ChannelListToggleService } from '../channel-list/channel-list-toggle.service';
|
|
4
4
|
import { ChannelService } from '../channel.service';
|
|
5
|
+
import { ChatClientService } from '../chat-client.service';
|
|
5
6
|
import { CustomTemplatesService } from '../custom-templates.service';
|
|
6
7
|
import { ChannelActionsContext, DefaultStreamChatGenerics } from '../types';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
@@ -13,11 +14,12 @@ export declare class ChannelHeaderComponent implements OnInit, OnDestroy {
|
|
|
13
14
|
private channelListToggleService;
|
|
14
15
|
private customTemplatesService;
|
|
15
16
|
private cdRef;
|
|
17
|
+
private chatClientService;
|
|
16
18
|
channelActionsTemplate?: TemplateRef<ChannelActionsContext>;
|
|
17
19
|
activeChannel: Channel<DefaultStreamChatGenerics> | undefined;
|
|
18
20
|
canReceiveConnectEvents: boolean | undefined;
|
|
19
21
|
private subscriptions;
|
|
20
|
-
constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef);
|
|
22
|
+
constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, chatClientService: ChatClientService);
|
|
21
23
|
ngOnInit(): void;
|
|
22
24
|
ngOnDestroy(): void;
|
|
23
25
|
toggleMenu(event: Event): void;
|
|
@@ -28,6 +30,8 @@ export declare class ChannelHeaderComponent implements OnInit, OnDestroy {
|
|
|
28
30
|
get watcherCountParam(): {
|
|
29
31
|
watcherCount: number;
|
|
30
32
|
};
|
|
33
|
+
get displayText(): string | undefined;
|
|
34
|
+
get avatarName(): string | undefined;
|
|
31
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelHeaderComponent, never>;
|
|
32
36
|
static ɵcmp: i0.ɵɵComponentDeclaration<ChannelHeaderComponent, "stream-channel-header", never, {}, {}, never, never>;
|
|
33
37
|
}
|
|
@@ -2,6 +2,7 @@ import { NgZone, OnDestroy, OnInit } from '@angular/core';
|
|
|
2
2
|
import { Channel } from 'stream-chat';
|
|
3
3
|
import { ChannelService } from '../channel.service';
|
|
4
4
|
import { DefaultStreamChatGenerics } from '../types';
|
|
5
|
+
import { ChatClientService } from '../chat-client.service';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/**
|
|
7
8
|
* The `ChannelPreview` component displays a channel preview in the channel list, it consists of the image, name and latest message of the channel.
|
|
@@ -9,6 +10,7 @@ import * as i0 from "@angular/core";
|
|
|
9
10
|
export declare class ChannelPreviewComponent implements OnInit, OnDestroy {
|
|
10
11
|
private channelService;
|
|
11
12
|
private ngZone;
|
|
13
|
+
private chatClientService;
|
|
12
14
|
/**
|
|
13
15
|
* The channel to be displayed
|
|
14
16
|
*/
|
|
@@ -18,7 +20,7 @@ export declare class ChannelPreviewComponent implements OnInit, OnDestroy {
|
|
|
18
20
|
latestMessage: string;
|
|
19
21
|
private subscriptions;
|
|
20
22
|
private canSendReadEvents;
|
|
21
|
-
constructor(channelService: ChannelService, ngZone: NgZone);
|
|
23
|
+
constructor(channelService: ChannelService, ngZone: NgZone, chatClientService: ChatClientService);
|
|
22
24
|
ngOnInit(): void;
|
|
23
25
|
ngOnDestroy(): void;
|
|
24
26
|
get avatarImage(): string | undefined;
|
package/lib/channel.service.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
|
|
|
46
46
|
* :::important
|
|
47
47
|
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](../concepts/change-detection.mdx) explains this in detail.
|
|
48
48
|
* :::
|
|
49
|
+
*
|
|
50
|
+
* The active channel will always be marked as read when a new message is received
|
|
49
51
|
*/
|
|
50
52
|
activeChannel$: Observable<Channel<T> | undefined>;
|
|
51
53
|
/**
|
|
@@ -159,7 +161,7 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
|
|
|
159
161
|
private parentMessageSetter;
|
|
160
162
|
constructor(chatClientService: ChatClientService<T>, ngZone: NgZone);
|
|
161
163
|
/**
|
|
162
|
-
* Sets the given `channel` as active.
|
|
164
|
+
* Sets the given `channel` as active and marks it as read.
|
|
163
165
|
* @param channel
|
|
164
166
|
*/
|
|
165
167
|
setAsActiveChannel(channel: Channel<T>): void;
|
|
@@ -181,7 +183,7 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
|
|
|
181
183
|
*/
|
|
182
184
|
loadMoreThreadReplies(): Promise<void>;
|
|
183
185
|
/**
|
|
184
|
-
* Queries the channels with the given filters, sorts and options. More info about [channel querying](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript) can be found in the platform documentation.
|
|
186
|
+
* Queries the channels with the given filters, sorts and options. More info about [channel querying](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript) can be found in the platform documentation. By default the first channel in the list will be set as active channel and will be marked as read.
|
|
185
187
|
* @param filters
|
|
186
188
|
* @param sort
|
|
187
189
|
* @param options
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Channel, UserResponse } from 'stream-chat';
|
|
2
|
+
import { DefaultStreamChatGenerics } from './types';
|
|
3
|
+
export declare const getChannelDisplayText: (channel: Channel<DefaultStreamChatGenerics>, currentUser: UserResponse<DefaultStreamChatGenerics>) => string | undefined;
|
|
@@ -69,6 +69,9 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
69
69
|
get canDisplayReadStatus(): boolean;
|
|
70
70
|
get quotedMessageAttachments(): import("stream-chat").Attachment<{
|
|
71
71
|
attachmentType: import("stream-chat").UR & import("../types").UnknownType & {
|
|
72
|
+
/**
|
|
73
|
+
* The `Message` component displays a message with additional information such as sender and date, and enables [interaction with the message (i.e. edit or react)](../concepts/message-interactions.mdx).
|
|
74
|
+
*/
|
|
72
75
|
asset_url?: string | undefined;
|
|
73
76
|
id?: string | undefined;
|
|
74
77
|
images?: import("stream-chat").Attachment<DefaultStreamChatGenerics>[] | undefined;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export * from './lib/channel-list/channel-list.component';
|
|
|
17
17
|
export * from './lib/channel-list/channel-list-toggle.service';
|
|
18
18
|
export * from './lib/message/message.component';
|
|
19
19
|
export * from './lib/message/parse-date';
|
|
20
|
-
export * from './lib/
|
|
20
|
+
export * from './lib/list-users';
|
|
21
21
|
export * from './lib/message-input/message-input.component';
|
|
22
22
|
export * from './lib/message-input/textarea/textarea.component';
|
|
23
23
|
export * from './lib/message-input/autocomplete-textarea/autocomplete-textarea.component';
|
package/src/assets/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.
|
|
1
|
+
export const version = '3.2.0';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export const getReadByText = (users) => {
|
|
2
|
-
let outStr = '';
|
|
3
|
-
const slicedArr = users.map((item) => item.name || item.id).slice(0, 5);
|
|
4
|
-
const restLength = users.length - slicedArr.length;
|
|
5
|
-
if (slicedArr.length === 1) {
|
|
6
|
-
outStr = `${slicedArr[0]} `;
|
|
7
|
-
}
|
|
8
|
-
else if (slicedArr.length === 2) {
|
|
9
|
-
// joins all with "and" but =no commas
|
|
10
|
-
// example: "bob and sam"
|
|
11
|
-
outStr = `${slicedArr[0]} and ${slicedArr[1]}`;
|
|
12
|
-
}
|
|
13
|
-
else if (slicedArr.length > 2) {
|
|
14
|
-
// joins all with commas, but last one gets ", and" (oxford comma!)
|
|
15
|
-
// example: "bob, joe, sam and 4 more"
|
|
16
|
-
if (restLength === 0) {
|
|
17
|
-
// mutate slicedArr to remove last user to display it separately
|
|
18
|
-
const lastUser = slicedArr.splice(slicedArr.length - 2, 1)[0];
|
|
19
|
-
const commaSeparatedUsers = slicedArr.join(', ');
|
|
20
|
-
outStr = `${commaSeparatedUsers}, and ${lastUser}`;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
const commaSeparatedUsers = slicedArr.join(', ');
|
|
24
|
-
outStr = `${commaSeparatedUsers} and ${restLength} more`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return outStr;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVhZC1ieS10ZXh0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvc3RyZWFtLWNoYXQtYW5ndWxhci9zcmMvbGliL21lc3NhZ2UvcmVhZC1ieS10ZXh0LnRzIl0sIm5hbWVzIjpbXSwib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