stream-chat-angular 4.58.4 → 4.59.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.
@@ -17,6 +17,7 @@ export declare class ChannelPreviewComponent implements OnInit, OnDestroy {
17
17
  */
18
18
  channel: Channel<DefaultStreamChatGenerics> | undefined;
19
19
  isActive: boolean;
20
+ isUnreadMessageWasCalled: boolean;
20
21
  isUnread: boolean;
21
22
  unreadCount: number | undefined;
22
23
  latestMessage: string;
@@ -104,9 +104,17 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
104
104
  [key: string]: Date;
105
105
  }>;
106
106
  /**
107
- * The last read message id of the active channel, it's only set once, when a new active channel is set. It's used by the message list to jump to the latest read message
107
+ * The last read message id of the active channel, it's used by the message list component to display unread UI, and jump to latest read message
108
+ *
109
+ * This property isn't always updated, please use `channel.read` to display up-to-date read information
108
110
  */
109
111
  activeChannelLastReadMessageId?: string;
112
+ /**
113
+ * The unread count of the active channel, it's used by the message list component to display unread UI
114
+ *
115
+ * This property isn't always updated, please use `channel.read` to display up-to-date read information
116
+ */
117
+ activeChannelUnreadCount?: number;
110
118
  /**
111
119
  * Custom event handler to call if a new message received from a channel that is not being watched, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
112
120
  */
@@ -216,6 +224,7 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
216
224
  private parentMessageSetter;
217
225
  private dismissErrorNotification?;
218
226
  private nextPageConfiguration?;
227
+ private areReadEventsPaused;
219
228
  constructor(chatClientService: ChatClientService<T>, ngZone: NgZone, notificationService: NotificationService);
220
229
  /**
221
230
  * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
@@ -335,6 +344,7 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
335
344
  }) | undefined;
336
345
  latest_reactions?: ReactionResponse<T>[] | undefined;
337
346
  mentioned_users?: UserResponse<T>[] | undefined;
347
+ moderation_details?: import("stream-chat").ModerationDetailsResponse | undefined;
338
348
  own_reactions?: ReactionResponse<T>[] | null | undefined;
339
349
  pin_expires?: string | null | undefined;
340
350
  pinned_at?: string | null | undefined;
@@ -354,7 +364,13 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
354
364
  quoted_message?: import("stream-chat").MessageResponseBase<T> | undefined;
355
365
  } & Omit<MessageResponse<{
356
366
  attachmentType: import("stream-chat").UR;
357
- channelType: import("stream-chat").UR;
367
+ channelType: import("stream-chat").UR; /**
368
+ * By default the SDK uses an offset based pagination, you can change/extend this by providing your own custom paginator method.
369
+ *
370
+ * The method will be called with the result of the latest channel query.
371
+ *
372
+ * You can return either an offset, or a filter using the [`$lte`/`$gte` operator](https://getstream.io/chat/docs/javascript/query_syntax_operators/). If you return a filter, it will be merged with the filter provided for the `init` method.
373
+ */
358
374
  commandType: import("stream-chat").LiteralStringForUnion;
359
375
  eventType: import("stream-chat").UR;
360
376
  messageType: {};
@@ -458,6 +474,12 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
458
474
  * @returns all reactions of a message
459
475
  */
460
476
  getMessageReactions(messageId: string): Promise<ReactionResponse<T>[]>;
477
+ /**
478
+ * Marks the channel from the given message as unread
479
+ * @param messageId
480
+ * @returns the result of the request
481
+ */
482
+ markMessageUnread(messageId: string): Promise<import("stream-chat").APIResponse | null | undefined>;
461
483
  private messageUpdated;
462
484
  private messageReactionEventReceived;
463
485
  private formatMessage;
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, CustomMetadataContext, DateSeparatorContext, DefaultStreamChatGenerics, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext } from './types';
3
+ import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, CustomMetadataContext, DateSeparatorContext, DefaultStreamChatGenerics, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext, UnreadMessagesIndicatorContext, UnreadMessagesNotificationContext } from './types';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * A central location for registering your custom templates to override parts of the chat application.
@@ -201,9 +201,17 @@ export declare class CustomTemplatesService<T extends DefaultStreamChatGenerics
201
201
  */
202
202
  dateSeparatorTemplate$: BehaviorSubject<TemplateRef<DateSeparatorContext> | undefined>;
203
203
  /**
204
- * The template used to display the new messages indicator inside the [message list](../components/MessageListComponent.mdx)
204
+ * The template used to display unread messages indicator inside the [message list](../components/MessageListComponent.mdx) when the channel is opened
205
+ *
206
+ * This UI element is used to separate unread messages from read messages
207
+ */
208
+ newMessagesIndicatorTemplate$: BehaviorSubject<TemplateRef<UnreadMessagesIndicatorContext> | undefined>;
209
+ /**
210
+ * The template used to display unread messages notification inside the [message list](../components/MessageListComponent.mdx) when the channel is opened
211
+ *
212
+ * Users can use this notification to jump to the first unread message when it's clicked
205
213
  */
206
- newMessagesIndicatorTemplate$: BehaviorSubject<TemplateRef<void> | undefined>;
214
+ newMessagesNotificationTemplate$: BehaviorSubject<TemplateRef<UnreadMessagesNotificationContext> | undefined>;
207
215
  /**
208
216
  * The template to show if the main message list is empty
209
217
  */
@@ -1,3 +1,3 @@
1
1
  import { StreamMessage } from '../types';
2
2
  export declare type GroupStyle = '' | 'middle' | 'top' | 'bottom' | 'single';
3
- export declare const getGroupStyles: (message: StreamMessage, previousMessage?: StreamMessage<import("../types").DefaultStreamChatGenerics> | undefined, nextMessage?: StreamMessage<import("../types").DefaultStreamChatGenerics> | undefined, noGroupByUser?: boolean) => GroupStyle;
3
+ export declare const getGroupStyles: (message: StreamMessage, previousMessage?: StreamMessage<import("../types").DefaultStreamChatGenerics> | undefined, nextMessage?: StreamMessage<import("../types").DefaultStreamChatGenerics> | undefined, noGroupByUser?: boolean, lastReadMessageId?: string | undefined) => GroupStyle;
@@ -1,7 +1,7 @@
1
1
  import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { ChannelService } from '../channel.service';
3
3
  import { Observable } from 'rxjs';
4
- import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem, DateSeparatorContext } from '../types';
4
+ import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem, DateSeparatorContext, UnreadMessagesNotificationContext, UnreadMessagesIndicatorContext } from '../types';
5
5
  import { ChatClientService } from '../chat-client.service';
6
6
  import { GroupStyle } from './group-styles';
7
7
  import { UserResponse } from 'stream-chat';
@@ -50,13 +50,18 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
50
50
  displayDateSeparator: boolean;
51
51
  /**
52
52
  * If date separators are displayed, you can set the horizontal position of the date text.
53
- * If `openMessageListAt` is `last-read-message` it will also set the text position of the new messages indicator.
54
53
  */
55
54
  dateSeparatorTextPos: 'center' | 'right' | 'left';
56
55
  /**
57
56
  * `last-message` option will open the message list at the last message, `last-read-message` will open the list at the last unread message. This option only works if mode is `main`.
58
57
  */
59
58
  openMessageListAt: 'last-message' | 'last-read-message';
59
+ /**
60
+ * If the user has unread messages when they open the channel the UI shows the unread indicator / notification which features the unread count by default. This count will be increased every time a user receives a new message. If you don't want to show the unread count, you can turn that off.
61
+ *
62
+ * This is only applicable for `main` mode, as threads doesn't have read infromation.
63
+ */
64
+ hideUnreadCountForNotificationAndIndicator: boolean;
60
65
  /**
61
66
  * You can turn on and off the loading indicator that signals to users that more messages are being loaded to the message list
62
67
  */
@@ -64,13 +69,14 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
64
69
  typingIndicatorTemplate: TemplateRef<TypingIndicatorContext> | undefined;
65
70
  messageTemplate: TemplateRef<MessageContext> | undefined;
66
71
  customDateSeparatorTemplate: TemplateRef<DateSeparatorContext> | undefined;
67
- customnewMessagesIndicatorTemplate: TemplateRef<void> | undefined;
72
+ customnewMessagesIndicatorTemplate: TemplateRef<UnreadMessagesIndicatorContext> | undefined;
73
+ customnewMessagesNotificationTemplate: TemplateRef<UnreadMessagesNotificationContext> | undefined;
68
74
  emptyMainMessageListTemplate: TemplateRef<void> | null;
69
75
  emptyThreadMessageListTemplate: TemplateRef<void> | null;
70
76
  messages$: Observable<StreamMessage[]>;
71
77
  enabledMessageActions: string[];
72
78
  isEmpty: boolean;
73
- unreadMessageCount: number;
79
+ newMessageCountWhileBeingScrolled: number;
74
80
  isUserScrolled: boolean | undefined;
75
81
  groupStyles: GroupStyle[];
76
82
  isNextMessageOnSeparateDate: boolean[];
@@ -80,6 +86,9 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
80
86
  isLoading: boolean;
81
87
  scrollEndTimeout: any;
82
88
  lastReadMessageId?: string;
89
+ isUnreadNotificationVisible: boolean;
90
+ firstUnreadMessageId?: string;
91
+ unreadCount?: number;
83
92
  isJumpingToLatestUnreadMessage: boolean;
84
93
  private scrollContainer;
85
94
  private parentMessageElement;
@@ -98,8 +107,11 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
98
107
  private channelId?;
99
108
  private parsedDates;
100
109
  private isViewInited;
110
+ private checkIfUnreadNotificationIsVisibleTimeout?;
101
111
  private get class();
102
112
  constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService, dateParser: DateParserService, ngZone: NgZone, cdRef: ChangeDetectorRef, messageActionsService: MessageActionsService);
113
+ messageNotificationJumpClicked: () => void;
114
+ messageNotificationDismissClicked: () => void;
103
115
  ngOnInit(): void;
104
116
  ngOnChanges(changes: SimpleChanges): void;
105
117
  ngAfterViewInit(): void;
@@ -111,6 +123,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
111
123
  scrollToBottom(): void;
112
124
  scrollToTop(): void;
113
125
  scrolled(): void;
126
+ jumpToFirstUnreadMessage(): void;
114
127
  getTypingIndicatorContext(): TypingIndicatorContext;
115
128
  getTypingIndicatorText(users: UserResponse[]): string;
116
129
  isSentByCurrentUser(message?: StreamMessage): boolean;
@@ -131,5 +144,5 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
131
144
  private newMessageReceived;
132
145
  private checkIfOnSeparateDates;
133
146
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
134
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; "displayDateSeparator": "displayDateSeparator"; "dateSeparatorTextPos": "dateSeparatorTextPos"; "openMessageListAt": "openMessageListAt"; "displayLoadingIndicator": "displayLoadingIndicator"; }, {}, never, never>;
147
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; "displayDateSeparator": "displayDateSeparator"; "dateSeparatorTextPos": "dateSeparatorTextPos"; "openMessageListAt": "openMessageListAt"; "hideUnreadCountForNotificationAndIndicator": "hideUnreadCountForNotificationAndIndicator"; "displayLoadingIndicator": "displayLoadingIndicator"; }, {}, never, never>;
135
148
  }
package/lib/types.d.ts CHANGED
@@ -193,7 +193,7 @@ declare type MessageActionItemBase<T extends DefaultStreamChatGenerics = Default
193
193
  actionHandler: (message: StreamMessage<T>, isMine: boolean) => any;
194
194
  };
195
195
  export declare type MessageActionItem<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = MessageActionItemBase<T> & {
196
- actionName: 'quote' | 'pin' | 'flag' | 'edit' | 'delete';
196
+ actionName: 'quote' | 'pin' | 'flag' | 'edit' | 'delete' | 'mark-unread';
197
197
  };
198
198
  export declare type CustomMessageActionItem<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = MessageActionItemBase<T> & {
199
199
  actionName: string;
@@ -263,7 +263,13 @@ export declare type SystemMessageContext = MessageContext & {
263
263
  export declare type DateSeparatorContext = {
264
264
  date: Date;
265
265
  parsedDate: string;
266
- isNewMessage: boolean;
266
+ };
267
+ export declare type UnreadMessagesIndicatorContext = {
268
+ unreadCount: number;
269
+ };
270
+ export declare type UnreadMessagesNotificationContext = UnreadMessagesIndicatorContext & {
271
+ onJump: Function;
272
+ onDismiss: Function;
267
273
  };
268
274
  export declare type ChannelQueryState = {
269
275
  state: 'in-progress' | 'success' | 'error';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.58.4",
3
+ "version": "4.59.0",
4
4
  "description": "Angular components to create chat conversations or livestream style chat",
5
5
  "author": "GetStream",
6
6
  "homepage": "https://getstream.io/chat/",
@@ -12,7 +12,7 @@
12
12
  "@angular/common": "^12.2.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
13
13
  "@angular/core": "^12.2.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0",
14
14
  "@ngx-translate/core": "^13.0.0 || ^14.0.0 || ^15.0.0",
15
- "stream-chat": "^8.11.0"
15
+ "stream-chat": "^8.15.0"
16
16
  },
17
17
  "dependencies": {
18
18
  "angular-mentions": "^1.4.0",
@@ -107,5 +107,12 @@ export const en = {
107
107
  'See original (automatically translated)':
108
108
  'See original (automatically translated)',
109
109
  'See translation': 'See translation',
110
+ 'Mark as unread': 'Mark as unread',
111
+ 'Error marking message as unread': 'Error marking message as unread',
112
+ 'Error, only the first {{count}} message can be marked as unread':
113
+ 'Error, only the first {{count}} message can be marked as unread',
114
+ 'Unread messages': 'Unread messages',
115
+ '{{count}} unread messages': '{{count}} unread messages',
116
+ '{{count}} unread message': '{{count}} unread message',
110
117
  },
111
118
  };
@@ -1 +1 @@
1
- export const version = '4.58.4';
1
+ export const version = '4.59.0';