stream-chat-angular 4.42.1 → 4.44.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.
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
3
3
  import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelResponse, ChannelSort, Event, MessageResponse, UserResponse } from 'stream-chat';
4
4
  import { ChatClientService, ClientEvent } from './chat-client.service';
5
5
  import { NotificationService } from './notification.service';
6
- import { AttachmentUpload, ChannelQueryState, DefaultStreamChatGenerics, MessageReactionType, StreamMessage } from './types';
6
+ import { AttachmentUpload, ChannelQueryState, DefaultStreamChatGenerics, MessageInput, MessageReactionType, StreamMessage } from './types';
7
7
  import * as i0 from "@angular/core";
8
8
  /**
9
9
  * The `ChannelService` provides data and interaction for the channel list and message list.
@@ -165,6 +165,14 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
165
165
  * The provided method will be called before deleting a message. If the returned Promise resolves to `true` to deletion will go ahead. If `false` is returned, the message won't be deleted.
166
166
  */
167
167
  messageDeleteConfirmationHandler?: (message: StreamMessage<T>) => Promise<boolean>;
168
+ /**
169
+ * The provided method will be called before a new message is sent to Stream's API. You can use this hook to tranfrom or enrich the message being sent.
170
+ */
171
+ beforeSendMessage?: (input: MessageInput<T>) => MessageInput<T> | Promise<MessageInput<T>>;
172
+ /**
173
+ * The provided method will be called before a message is sent to Stream's API for update. You can use this hook to tranfrom or enrich the message being updated.
174
+ */
175
+ beforeUpdateMessage?: (message: StreamMessage<T>) => StreamMessage<T> | Promise<StreamMessage<T>>;
168
176
  private channelsSubject;
169
177
  private activeChannelSubject;
170
178
  private activeChannelMessagesSubject;
@@ -223,7 +231,7 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
223
231
  * Loads the next page of messages of the active channel. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
224
232
  * @param direction
225
233
  */
226
- loadMoreMessages(direction?: 'older' | 'newer'): Promise<void>;
234
+ loadMoreMessages(direction?: 'older' | 'newer'): false | Promise<import("stream-chat").QueryChannelAPIResponse<T>> | undefined;
227
235
  /**
228
236
  * Loads the next page of messages of the active thread. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
229
237
  * @param direction
@@ -324,9 +332,7 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
324
332
  reply_count?: number | undefined;
325
333
  shadowed?: boolean | undefined;
326
334
  status?: string | undefined;
327
- thread_participants?: UserResponse<T>[] | undefined; /**
328
- * 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.
329
- */
335
+ thread_participants?: UserResponse<T>[] | undefined;
330
336
  updated_at?: string | undefined;
331
337
  } & {
332
338
  quoted_message?: import("stream-chat").MessageResponseBase<T> | undefined;
@@ -1,4 +1,4 @@
1
- import { OnChanges, SimpleChanges, OnDestroy, OnInit, ChangeDetectorRef } from '@angular/core';
1
+ import { OnChanges, SimpleChanges, OnDestroy, OnInit, ChangeDetectorRef, NgZone, AfterViewInit } from '@angular/core';
2
2
  import { UserResponse } from 'stream-chat';
3
3
  import { ChannelService } from '../channel.service';
4
4
  import { ChatClientService } from '../chat-client.service';
@@ -16,12 +16,13 @@ declare type MessagePart = {
16
16
  /**
17
17
  * 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).
18
18
  */
19
- export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
19
+ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, AfterViewInit {
20
20
  private chatClientService;
21
21
  private channelService;
22
22
  customTemplatesService: CustomTemplatesService;
23
23
  private cdRef;
24
24
  private dateParser;
25
+ private ngZone;
25
26
  /**
26
27
  * The message to be displayed
27
28
  */
@@ -53,7 +54,8 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
53
54
  isActionBoxOpen: boolean;
54
55
  isReactionSelectorOpen: boolean;
55
56
  visibleMessageActionsCount: number;
56
- messageTextParts: MessagePart[];
57
+ messageTextParts: MessagePart[] | undefined;
58
+ messageText?: string;
57
59
  popperTriggerClick: NgxPopperjsTriggers;
58
60
  popperTriggerHover: NgxPopperjsTriggers;
59
61
  popperPlacementAuto: NgxPopperjsPlacements;
@@ -79,9 +81,12 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
79
81
  user: UserResponse<DefaultStreamChatGenerics> | undefined;
80
82
  private subscriptions;
81
83
  private container;
82
- constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, themeService: ThemeService, dateParser: DateParserService);
84
+ private readonly urlRegexp;
85
+ private emojiRegexp;
86
+ constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, themeService: ThemeService, dateParser: DateParserService, ngZone: NgZone);
83
87
  ngOnInit(): void;
84
88
  ngOnChanges(changes: SimpleChanges): void;
89
+ ngAfterViewInit(): void;
85
90
  ngOnDestroy(): void;
86
91
  getAttachmentListContext(): AttachmentListContext;
87
92
  getMessageContext(): SystemMessageContext;
@@ -97,6 +102,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
97
102
  jumpToMessage(messageId: string, parentMessageId?: string): void;
98
103
  displayTranslatedMessage(): void;
99
104
  displayOriginalMessage(): void;
105
+ mouseLeft(): void;
100
106
  private createMessageParts;
101
107
  private getMessageContent;
102
108
  private fixEmojiDisplay;
@@ -1,4 +1,4 @@
1
- import { AfterViewChecked, AfterViewInit, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
1
+ import { AfterViewChecked, AfterViewInit, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { ChannelService } from '../channel.service';
3
3
  import { Observable } from 'rxjs';
4
4
  import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem, DateSeparatorContext } from '../types';
@@ -16,6 +16,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
16
16
  private chatClientService;
17
17
  private customTemplatesService;
18
18
  private dateParser;
19
+ private ngZone;
19
20
  /**
20
21
  * Determines if the message list should display channel messages or [thread messages](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
21
22
  */
@@ -65,6 +66,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
65
66
  unreadMessageCount: number;
66
67
  isUserScrolled: boolean | undefined;
67
68
  groupStyles: GroupStyle[];
69
+ isNextMessageOnSeparateDate: boolean[];
68
70
  lastSentMessageId: string | undefined;
69
71
  parentMessage: StreamMessage | undefined;
70
72
  highlightedMessageId: string | undefined;
@@ -88,7 +90,8 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
88
90
  private usersTypingInThread$;
89
91
  private isLatestMessageInList;
90
92
  private channelId?;
91
- constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService, dateParser: DateParserService);
93
+ private parsedDates;
94
+ constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService, dateParser: DateParserService, ngZone: NgZone);
92
95
  ngOnInit(): void;
93
96
  ngOnChanges(changes: SimpleChanges): void;
94
97
  ngAfterViewInit(): void;
@@ -102,9 +105,8 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
102
105
  scrolled(): void;
103
106
  getTypingIndicatorContext(): TypingIndicatorContext;
104
107
  getTypingIndicatorText(users: UserResponse[]): string;
105
- areOnSeparateDates(message?: StreamMessage, nextMessage?: StreamMessage): boolean;
106
108
  isSentByCurrentUser(message?: StreamMessage): boolean;
107
- parseDate(date: Date): string;
109
+ parseDate(date: Date): string | undefined;
108
110
  get replyCountParam(): {
109
111
  replyCount: number | undefined;
110
112
  };
@@ -118,6 +120,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
118
120
  private scrollMessageIntoView;
119
121
  private scrollToLatestMessage;
120
122
  private newMessageReceived;
123
+ private checkIfOnSeparateDates;
121
124
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
122
125
  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>;
123
126
  }
package/lib/types.d.ts CHANGED
@@ -246,4 +246,12 @@ export declare type ChannelQueryState = {
246
246
  state: 'in-progress' | 'success' | 'error';
247
247
  error?: unknown;
248
248
  };
249
+ export declare type MessageInput<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
250
+ text: string;
251
+ attachments: Attachment<T>[];
252
+ mentionedUsers: UserResponse<T>[];
253
+ parentId: string | undefined;
254
+ quotedMessageId: string | undefined;
255
+ customData: undefined | Partial<T['messageType']>;
256
+ };
249
257
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.42.1",
3
+ "version": "4.44.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/",
@@ -1 +1 @@
1
- export const version = '4.42.1';
1
+ export const version = '4.44.0';