stream-chat-angular 3.0.1 → 3.2.1

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.
Files changed (34) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/bundles/stream-chat-angular.umd.js +195 -113
  3. package/bundles/stream-chat-angular.umd.js.map +1 -1
  4. package/esm2015/assets/version.js +2 -2
  5. package/esm2015/lib/channel-header/channel-header.component.js +29 -9
  6. package/esm2015/lib/channel-preview/channel-preview.component.js +23 -11
  7. package/esm2015/lib/channel.service.js +3 -3
  8. package/esm2015/lib/get-channel-display-text.js +15 -0
  9. package/esm2015/lib/icon/icon.component.js +2 -2
  10. package/esm2015/lib/list-users.js +12 -0
  11. package/esm2015/lib/message/message.component.js +3 -3
  12. package/esm2015/lib/message-input/message-input.component.js +5 -1
  13. package/esm2015/lib/message-list/message-list.component.js +87 -43
  14. package/esm2015/public-api.js +2 -2
  15. package/fesm2015/stream-chat-angular.js +171 -99
  16. package/fesm2015/stream-chat-angular.js.map +1 -1
  17. package/lib/channel-header/channel-header.component.d.ts +5 -1
  18. package/lib/channel-preview/channel-preview.component.d.ts +3 -1
  19. package/lib/channel.service.d.ts +4 -2
  20. package/lib/get-channel-display-text.d.ts +3 -0
  21. package/lib/icon/icon.component.d.ts +1 -1
  22. package/lib/list-users.d.ts +2 -0
  23. package/lib/message/message.component.d.ts +3 -0
  24. package/lib/message-list/message-list.component.d.ts +9 -2
  25. package/package.json +1 -1
  26. package/public-api.d.ts +1 -1
  27. package/src/assets/styles/css/index.css +1 -1
  28. package/src/assets/styles/css/index.css.map +1 -1
  29. package/src/assets/styles/scss/Attachment.scss +1 -1
  30. package/src/assets/styles/scss/MessageNotification.scss +6 -18
  31. package/src/assets/styles/scss/Thread.scss +10 -3
  32. package/src/assets/version.ts +1 -1
  33. package/esm2015/lib/message/read-by-text.js +0 -29
  34. 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;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- export declare type Icon = 'action-icon' | 'delivered-icon' | 'reaction-icon' | 'connection-error' | 'send' | 'file-upload' | 'retry' | 'close' | 'file' | 'reply' | 'close-no-outline' | 'reply-in-thread' | 'arrow-left' | 'arrow-right' | 'menu';
2
+ export declare type Icon = 'action-icon' | 'delivered-icon' | 'reaction-icon' | 'connection-error' | 'send' | 'file-upload' | 'retry' | 'close' | 'file' | 'reply' | 'close-no-outline' | 'reply-in-thread' | 'arrow-left' | 'arrow-right' | 'menu' | 'arrow-up' | 'arrow-down';
3
3
  /**
4
4
  * The `Icon` component can be used to display different icons (i. e. message delivered icon).
5
5
  */
@@ -0,0 +1,2 @@
1
+ import { UserResponse } from 'stream-chat';
2
+ export declare const listUsers: (users: UserResponse[]) => string;
@@ -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;
@@ -20,13 +20,17 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
20
20
  * Determines if the message list should display channel messages or [thread messages](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
21
21
  */
22
22
  mode: 'main' | 'thread';
23
+ /**
24
+ * The direction of the messages in the list, `bottom-to-top` means newest message is at the bottom of the message list and users scroll upwards to load older messages
25
+ */
26
+ direction: 'bottom-to-top' | 'top-to-bottom';
23
27
  typingIndicatorTemplate: TemplateRef<TypingIndicatorContext> | undefined;
24
28
  messageTemplate: TemplateRef<MessageContext> | undefined;
25
29
  messages$: Observable<StreamMessage[]>;
26
30
  enabledMessageActions: string[];
27
31
  private class;
28
32
  unreadMessageCount: number;
29
- isUserScrolledUp: boolean | undefined;
33
+ isUserScrolled: boolean | undefined;
30
34
  groupStyles: GroupStyle[];
31
35
  lastSentMessageId: string | undefined;
32
36
  parentMessage: StreamMessage | undefined;
@@ -50,14 +54,17 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
50
54
  ngOnDestroy(): void;
51
55
  trackByMessageId(index: number, item: StreamMessage): string;
52
56
  trackByUserId(index: number, user: UserResponse): string;
57
+ scrollToLatestMessage(): void;
53
58
  scrollToBottom(): void;
59
+ scrollToTop(): void;
54
60
  scrolled(): void;
55
61
  getTypingIndicatorContext(): TypingIndicatorContext;
56
62
  getMessageContext(message: StreamMessage): MessageContext;
57
63
  private preserveScrollbarPosition;
64
+ private shouldLoadMoreMessages;
58
65
  private setMessages$;
59
66
  private resetScrollState;
60
67
  private get usersTyping$();
61
68
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
62
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; }, {}, never, never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; }, {}, never, never>;
63
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "3.0.1",
3
+ "version": "3.2.1",
4
4
  "description": "Angular components to create chat conversations or livestream style chat",
5
5
  "author": "GetStream",
6
6
  "homepage": "https://getstream.io/chat/",
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/message/read-by-text';
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';