stream-chat-angular 4.58.4 → 4.59.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.
@@ -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';
@@ -33,9 +33,8 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
33
33
  */
34
34
  messageOptionsTrigger: 'message-row' | 'message-bubble';
35
35
  /**
36
- * You can hide the "jump to latest" button while scrolling. A potential use-case for this input would be to [workaround a known issue on iOS Safar](https://github.com/GetStream/stream-chat-angular/issues/418)
36
+ * You can hide the "jump to latest" button while scrolling. A potential use-case for this input would be to [workaround a known issue on iOS Safar webview](https://github.com/GetStream/stream-chat-angular/issues/418)
37
37
  *
38
- * @deprecated This scroll issue has been resolved, no need to use this workaround anymore.
39
38
  */
40
39
  hideJumpToLatestButtonDuringScroll: boolean;
41
40
  /**
@@ -50,13 +49,18 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
50
49
  displayDateSeparator: boolean;
51
50
  /**
52
51
  * 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
52
  */
55
53
  dateSeparatorTextPos: 'center' | 'right' | 'left';
56
54
  /**
57
55
  * `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
56
  */
59
57
  openMessageListAt: 'last-message' | 'last-read-message';
58
+ /**
59
+ * 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.
60
+ *
61
+ * This is only applicable for `main` mode, as threads doesn't have read infromation.
62
+ */
63
+ hideUnreadCountForNotificationAndIndicator: boolean;
60
64
  /**
61
65
  * You can turn on and off the loading indicator that signals to users that more messages are being loaded to the message list
62
66
  */
@@ -64,13 +68,14 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
64
68
  typingIndicatorTemplate: TemplateRef<TypingIndicatorContext> | undefined;
65
69
  messageTemplate: TemplateRef<MessageContext> | undefined;
66
70
  customDateSeparatorTemplate: TemplateRef<DateSeparatorContext> | undefined;
67
- customnewMessagesIndicatorTemplate: TemplateRef<void> | undefined;
71
+ customnewMessagesIndicatorTemplate: TemplateRef<UnreadMessagesIndicatorContext> | undefined;
72
+ customnewMessagesNotificationTemplate: TemplateRef<UnreadMessagesNotificationContext> | undefined;
68
73
  emptyMainMessageListTemplate: TemplateRef<void> | null;
69
74
  emptyThreadMessageListTemplate: TemplateRef<void> | null;
70
75
  messages$: Observable<StreamMessage[]>;
71
76
  enabledMessageActions: string[];
72
77
  isEmpty: boolean;
73
- unreadMessageCount: number;
78
+ newMessageCountWhileBeingScrolled: number;
74
79
  isUserScrolled: boolean | undefined;
75
80
  groupStyles: GroupStyle[];
76
81
  isNextMessageOnSeparateDate: boolean[];
@@ -80,7 +85,11 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
80
85
  isLoading: boolean;
81
86
  scrollEndTimeout: any;
82
87
  lastReadMessageId?: string;
88
+ isUnreadNotificationVisible: boolean;
89
+ firstUnreadMessageId?: string;
90
+ unreadCount?: number;
83
91
  isJumpingToLatestUnreadMessage: boolean;
92
+ isJumpToLatestButtonVisible: boolean;
84
93
  private scrollContainer;
85
94
  private parentMessageElement;
86
95
  private latestMessage;
@@ -98,8 +107,12 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
98
107
  private channelId?;
99
108
  private parsedDates;
100
109
  private isViewInited;
110
+ private checkIfUnreadNotificationIsVisibleTimeout?;
111
+ private jumpToLatestButtonVisibilityTimeout?;
101
112
  private get class();
102
113
  constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService, dateParser: DateParserService, ngZone: NgZone, cdRef: ChangeDetectorRef, messageActionsService: MessageActionsService);
114
+ messageNotificationJumpClicked: () => void;
115
+ messageNotificationDismissClicked: () => void;
103
116
  ngOnInit(): void;
104
117
  ngOnChanges(changes: SimpleChanges): void;
105
118
  ngAfterViewInit(): void;
@@ -111,6 +124,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
111
124
  scrollToBottom(): void;
112
125
  scrollToTop(): void;
113
126
  scrolled(): void;
127
+ jumpToFirstUnreadMessage(): void;
114
128
  getTypingIndicatorContext(): TypingIndicatorContext;
115
129
  getTypingIndicatorText(users: UserResponse[]): string;
116
130
  isSentByCurrentUser(message?: StreamMessage): boolean;
@@ -131,5 +145,5 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
131
145
  private newMessageReceived;
132
146
  private checkIfOnSeparateDates;
133
147
  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>;
148
+ 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
149
  }
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.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/",
@@ -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.1';