stream-chat-angular 2.8.2 → 2.12.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.
Files changed (47) hide show
  1. package/assets/i18n/en.d.ts +2 -0
  2. package/assets/version.d.ts +1 -1
  3. package/bundles/stream-chat-angular.umd.js +804 -338
  4. package/bundles/stream-chat-angular.umd.js.map +1 -1
  5. package/esm2015/assets/i18n/en.js +3 -1
  6. package/esm2015/assets/version.js +2 -2
  7. package/esm2015/lib/attachment-list/attachment-list.component.js +21 -8
  8. package/esm2015/lib/channel/channel.component.js +3 -2
  9. package/esm2015/lib/channel.service.js +191 -38
  10. package/esm2015/lib/chat-client.service.js +6 -1
  11. package/esm2015/lib/icon/icon.component.js +2 -2
  12. package/esm2015/lib/message/message.component.js +67 -42
  13. package/esm2015/lib/message-actions-box/message-actions-box.component.js +20 -9
  14. package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +35 -9
  15. package/esm2015/lib/message-input/message-input-config.service.js +1 -1
  16. package/esm2015/lib/message-input/message-input.component.js +69 -13
  17. package/esm2015/lib/message-input/textarea.directive.js +10 -2
  18. package/esm2015/lib/message-input/textarea.interface.js +1 -1
  19. package/esm2015/lib/message-list/message-list.component.js +130 -55
  20. package/esm2015/lib/message-preview.js +4 -2
  21. package/esm2015/lib/stream-chat.module.js +8 -3
  22. package/esm2015/lib/thread/thread.component.js +37 -0
  23. package/esm2015/lib/types.js +1 -1
  24. package/esm2015/public-api.js +2 -1
  25. package/fesm2015/stream-chat-angular.js +659 -250
  26. package/fesm2015/stream-chat-angular.js.map +1 -1
  27. package/lib/attachment-list/attachment-list.component.d.ts +8 -3
  28. package/lib/channel/channel.component.d.ts +2 -1
  29. package/lib/channel.service.d.ts +23 -7
  30. package/lib/chat-client.service.d.ts +1 -0
  31. package/lib/icon/icon.component.d.ts +1 -1
  32. package/lib/message/message.component.d.ts +26 -8
  33. package/lib/message-actions-box/message-actions-box.component.d.ts +4 -1
  34. package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +6 -3
  35. package/lib/message-input/message-input-config.service.d.ts +2 -1
  36. package/lib/message-input/message-input.component.d.ts +9 -2
  37. package/lib/message-input/textarea.directive.d.ts +3 -2
  38. package/lib/message-input/textarea.interface.d.ts +2 -1
  39. package/lib/message-list/message-list.component.d.ts +21 -7
  40. package/lib/message-preview.d.ts +1 -1
  41. package/lib/stream-chat.module.d.ts +5 -4
  42. package/lib/thread/thread.component.d.ts +18 -0
  43. package/lib/types.d.ts +7 -1
  44. package/package.json +2 -11
  45. package/public-api.d.ts +1 -0
  46. package/src/assets/i18n/en.ts +4 -0
  47. package/src/assets/version.ts +1 -1
@@ -1,13 +1,16 @@
1
1
  import { OnChanges } from '@angular/core';
2
- import { Attachment } from 'stream-chat';
2
+ import { Action, Attachment } from 'stream-chat';
3
3
  import { ImageLoadService } from '../message-list/image-load.service';
4
4
  import { DefaultAttachmentType } from '../types';
5
+ import { ChannelService } from '../channel.service';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class AttachmentListComponent implements OnChanges {
7
8
  private imageLoadService;
9
+ private channelService;
10
+ messageId: string | undefined;
8
11
  attachments: Attachment<DefaultAttachmentType>[];
9
12
  orderedAttachments: Attachment<DefaultAttachmentType>[];
10
- constructor(imageLoadService: ImageLoadService);
13
+ constructor(imageLoadService: ImageLoadService, channelService: ChannelService);
11
14
  ngOnChanges(): void;
12
15
  trackById(index: number): number;
13
16
  isImage(attachment: Attachment): boolean;
@@ -17,6 +20,8 @@ export declare class AttachmentListComponent implements OnChanges {
17
20
  hasFileSize(attachment: Attachment<DefaultAttachmentType>): boolean | 0 | undefined;
18
21
  getFileSize(attachment: Attachment<DefaultAttachmentType>): string;
19
22
  trimUrl(url?: string | null): string | null;
23
+ sendAction(action: Action): void;
24
+ trackByActionValue(_: number, item: Action): string | undefined;
20
25
  static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentListComponent, never>;
21
- static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentListComponent, "stream-attachment-list", never, { "attachments": "attachments"; }, {}, never, never>;
26
+ static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentListComponent, "stream-attachment-list", never, { "messageId": "messageId"; "attachments": "attachments"; }, {}, never, never>;
22
27
  }
@@ -5,8 +5,9 @@ export declare class ChannelComponent {
5
5
  private channelService;
6
6
  isError$: Observable<boolean>;
7
7
  isInitializing$: Observable<boolean>;
8
+ isActiveThread$: Observable<boolean>;
8
9
  subscriptions: Subscription[];
9
10
  constructor(channelService: ChannelService);
10
11
  static ɵfac: i0.ɵɵFactoryDeclaration<ChannelComponent, never>;
11
- static ɵcmp: i0.ɵɵComponentDeclaration<ChannelComponent, "stream-channel", never, {}, {}, never, ["*"]>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChannelComponent, "stream-channel", never, {}, {}, never, ["*", "[name=\"thread\"]"]>;
12
13
  }
@@ -12,39 +12,54 @@ export declare class ChannelService {
12
12
  channels$: Observable<Channel[] | undefined>;
13
13
  activeChannel$: Observable<Channel | undefined>;
14
14
  activeChannelMessages$: Observable<StreamMessage[]>;
15
+ activeParentMessageId$: Observable<string | undefined>;
16
+ activeThreadMessages$: Observable<StreamMessage[]>;
17
+ activeParentMessage$: Observable<StreamMessage | undefined>;
18
+ messageToQuote$: Observable<StreamMessage | undefined>;
15
19
  customNewMessageNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
16
20
  customAddedToChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
17
21
  customRemovedFromChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
18
- customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void) => void;
19
- customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void) => void;
20
- customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void) => void;
21
- customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void) => void;
22
- customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void) => void;
23
- customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void) => void;
22
+ customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
23
+ customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
24
+ customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
25
+ customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
26
+ customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
27
+ customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
24
28
  private channelsSubject;
25
29
  private activeChannelSubject;
26
30
  private activeChannelMessagesSubject;
27
31
  private hasMoreChannelsSubject;
28
32
  private activeChannelSubscriptions;
33
+ private activeParentMessageIdSubject;
34
+ private activeThreadMessagesSubject;
29
35
  private filters;
30
36
  private sort;
31
37
  private options;
38
+ private readonly messagePageSize;
39
+ private messageToQuoteSubject;
32
40
  private channelListSetter;
33
41
  private messageListSetter;
42
+ private threadListSetter;
43
+ private parentMessageSetter;
34
44
  constructor(chatClientService: ChatClientService, ngZone: NgZone);
35
45
  setAsActiveChannel(channel: Channel): void;
46
+ setAsActiveParentMessage(message: StreamMessage | undefined): Promise<void>;
36
47
  loadMoreMessages(): Promise<void>;
48
+ loadMoreThreadReplies(): Promise<void>;
37
49
  init(filters: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<void>;
50
+ reset(): void;
38
51
  loadMoreChannels(): Promise<void>;
39
52
  addReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
40
53
  removeReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
41
- sendMessage(text: string, attachments?: Attachment[], mentionedUsers?: UserResponse[]): Promise<void>;
54
+ sendMessage(text: string, attachments?: Attachment[], mentionedUsers?: UserResponse[], parentId?: string | undefined, quotedMessageId?: string | undefined): Promise<void>;
42
55
  resendMessage(message: StreamMessage): Promise<void>;
43
56
  updateMessage(message: StreamMessage): Promise<void>;
44
57
  deleteMessage(message: StreamMessage): Promise<void>;
45
58
  uploadAttachments(uploads: AttachmentUpload[]): Promise<AttachmentUpload[]>;
46
59
  deleteAttachment(attachmentUpload: AttachmentUpload): Promise<void>;
47
60
  autocompleteMembers(searchTerm: string): Promise<import("stream-chat").ChannelMemberResponse<import("stream-chat").UR>[]>;
61
+ sendAction(messageId: string, formData: Record<string, string>): Promise<void>;
62
+ selectMessageToQuote(message: StreamMessage | undefined): void;
48
63
  private sendMessageRequest;
49
64
  private handleNotification;
50
65
  private handleRemovedFromChannelNotification;
@@ -69,6 +84,7 @@ export declare class ChannelService {
69
84
  private handleChannelTruncate;
70
85
  private get channels();
71
86
  private get canSendReadEvents();
87
+ private transformToStreamMessage;
72
88
  static ɵfac: i0.ɵɵFactoryDeclaration<ChannelService, never>;
73
89
  static ɵprov: i0.ɵɵInjectableDeclaration<ChannelService>;
74
90
  }
@@ -20,6 +20,7 @@ export declare class ChatClientService {
20
20
  private appSettingsSubject;
21
21
  constructor(ngZone: NgZone, notificationService: NotificationService);
22
22
  init(apiKey: string, userOrId: string | OwnUserResponse | UserResponse, userTokenOrProvider: TokenOrProvider): Promise<void>;
23
+ disconnectUser(): Promise<void>;
23
24
  getAppSettings(): Promise<void>;
24
25
  flagMessage(messageId: string): Promise<void>;
25
26
  autocompleteUsers(searchTerm: string): Promise<UserResponse<import("stream-chat").UR>[]>;
@@ -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';
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';
3
3
  export declare class IconComponent {
4
4
  icon: Icon | undefined;
5
5
  size: number | undefined;
@@ -2,30 +2,40 @@ import { TemplateRef, OnChanges, SimpleChanges } 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';
5
- import { MessageActions } from '../message-actions-box/message-actions-box.component';
6
5
  import { DefaultUserType, StreamMessage } from '../types';
7
6
  import * as i0 from "@angular/core";
7
+ declare type MessagePart = {
8
+ content: string;
9
+ type: 'text' | 'mention';
10
+ user?: UserResponse;
11
+ };
8
12
  export declare class MessageComponent implements OnChanges {
9
13
  private chatClientService;
10
14
  private channelService;
11
15
  messageInputTemplate: TemplateRef<any> | undefined;
12
16
  mentionTemplate: TemplateRef<any> | undefined;
13
17
  message: StreamMessage | undefined;
14
- enabledMessageActions: MessageActions[];
18
+ enabledMessageActions: string[];
19
+ /**
20
+ * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message_list/#caution-arereactionsenabled-deprecated
21
+ */
15
22
  areReactionsEnabled: boolean | undefined;
23
+ /**
24
+ * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message_list/#canreacttomessage-deprecated
25
+ */
16
26
  canReactToMessage: boolean | undefined;
17
27
  isLastSentMessage: boolean | undefined;
28
+ /**
29
+ * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message_list/#canreceivereadevents-deprecated
30
+ */
18
31
  canReceiveReadEvents: boolean | undefined;
32
+ mode: 'thread' | 'main';
19
33
  isEditing: boolean | undefined;
20
34
  isActionBoxOpen: boolean;
21
35
  isReactionSelectorOpen: boolean;
22
36
  isPressedOnMobile: boolean;
23
37
  visibleMessageActionsCount: number;
24
- messageTextParts: {
25
- content: string;
26
- type: 'text' | 'mention';
27
- user?: UserResponse;
28
- }[];
38
+ messageTextParts: MessagePart[];
29
39
  private user;
30
40
  private container;
31
41
  constructor(chatClientService: ChatClientService, channelService: ChannelService);
@@ -40,8 +50,16 @@ export declare class MessageComponent implements OnChanges {
40
50
  get areOptionsVisible(): boolean;
41
51
  get hasAttachment(): boolean;
42
52
  get hasReactions(): boolean;
53
+ get replyCountParam(): {
54
+ replyCount: number | undefined;
55
+ };
56
+ get canDisplayReadStatus(): boolean;
57
+ get quotedMessageAttachments(): import("stream-chat").Attachment<import("../types").DefaultAttachmentType>[];
43
58
  resendMessage(): void;
44
59
  textClicked(): void;
60
+ setAsActiveParentMessage(): void;
61
+ private createMessageParts;
45
62
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageComponent, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "messageInputTemplate": "messageInputTemplate"; "mentionTemplate": "mentionTemplate"; "message": "message"; "enabledMessageActions": "enabledMessageActions"; "areReactionsEnabled": "areReactionsEnabled"; "canReactToMessage": "canReactToMessage"; "isLastSentMessage": "isLastSentMessage"; "canReceiveReadEvents": "canReceiveReadEvents"; }, {}, never, never>;
63
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "messageInputTemplate": "messageInputTemplate"; "mentionTemplate": "mentionTemplate"; "message": "message"; "enabledMessageActions": "enabledMessageActions"; "areReactionsEnabled": "areReactionsEnabled"; "canReactToMessage": "canReactToMessage"; "isLastSentMessage": "isLastSentMessage"; "canReceiveReadEvents": "canReceiveReadEvents"; "mode": "mode"; }, {}, never, never>;
47
64
  }
65
+ export {};
@@ -4,6 +4,9 @@ import { ChatClientService } from '../chat-client.service';
4
4
  import { NotificationService } from '../notification.service';
5
5
  import { StreamMessage } from '../types';
6
6
  import * as i0 from "@angular/core";
7
+ /**
8
+ * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message-actions/#required-enabledactions
9
+ */
7
10
  export declare type MessageActions = 'edit' | 'delete' | 'edit-any' | 'delete-any' | 'pin' | 'quote' | 'flag' | 'mute';
8
11
  export declare class MessageActionsBoxComponent implements OnChanges {
9
12
  private chatClientService;
@@ -13,7 +16,7 @@ export declare class MessageActionsBoxComponent implements OnChanges {
13
16
  isOpen: boolean;
14
17
  isMine: boolean;
15
18
  message: StreamMessage | undefined;
16
- enabledActions: MessageActions[];
19
+ enabledActions: string[];
17
20
  readonly displayedActionsCount: EventEmitter<number>;
18
21
  readonly isEditing: EventEmitter<boolean>;
19
22
  isEditModalOpen: boolean;
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { MentionConfig } from 'angular-mentions';
3
- import { MentionAutcompleteListItemContext, MentionAutcompleteListItem } from '../../types';
3
+ import { MentionAutcompleteListItemContext, MentionAutcompleteListItem, CommandAutocompleteListItemContext } from '../../types';
4
4
  import { UserResponse } from 'stream-chat';
5
5
  import { ChannelService } from '../../channel.service';
6
6
  import { TextareaInterface } from '../textarea.interface';
@@ -15,17 +15,20 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
15
15
  value: string;
16
16
  areMentionsEnabled: boolean | undefined;
17
17
  mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
18
+ commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
18
19
  mentionScope: 'channel' | 'application';
19
20
  readonly valueChange: EventEmitter<string>;
20
21
  readonly send: EventEmitter<void>;
21
22
  readonly userMentions: EventEmitter<UserResponse<import("stream-chat").UR>[]>;
22
- private readonly labelKey;
23
+ private readonly autocompleteKey;
23
24
  private readonly mentionTriggerChar;
25
+ private readonly commandTriggerChar;
24
26
  autocompleteConfig: MentionConfig;
25
27
  private messageInput;
26
28
  private subscriptions;
27
29
  private mentionedUsers;
28
30
  private userMentionConfig;
31
+ private slashCommandConfig;
29
32
  private searchTerm$;
30
33
  constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService);
31
34
  ngOnChanges(changes: SimpleChanges): void;
@@ -43,5 +46,5 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
43
46
  private updateMentionOptions;
44
47
  private updateMentionedUsersFromText;
45
48
  static ɵfac: i0.ɵɵFactoryDeclaration<AutocompleteTextareaComponent, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteTextareaComponent, "stream-autocomplete-textarea", never, { "value": "value"; "areMentionsEnabled": "areMentionsEnabled"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "mentionScope": "mentionScope"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never, never>;
49
+ static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteTextareaComponent, "stream-autocomplete-textarea", never, { "value": "value"; "areMentionsEnabled": "areMentionsEnabled"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "commandAutocompleteItemTemplate": "commandAutocompleteItemTemplate"; "mentionScope": "mentionScope"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never, never>;
47
50
  }
@@ -1,10 +1,11 @@
1
1
  import { TemplateRef } from '@angular/core';
2
- import { MentionAutcompleteListItemContext } from '../types';
2
+ import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class MessageInputConfigService {
5
5
  isFileUploadEnabled: boolean | undefined;
6
6
  areMentionsEnabled: boolean | undefined;
7
7
  mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
8
+ commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
8
9
  /**
9
10
  * @deprecated https://getstream.io/chat/docs/sdk/angular/services/message-input-config/#overview
10
11
  */
@@ -5,7 +5,7 @@ import { UserResponse } from 'stream-chat';
5
5
  import { AttachmentService } from '../attachment.service';
6
6
  import { ChannelService } from '../channel.service';
7
7
  import { NotificationService } from '../notification.service';
8
- import { AttachmentUpload, MentionAutcompleteListItemContext, StreamMessage } from '../types';
8
+ import { AttachmentUpload, CommandAutocompleteListItemContext, MentionAutcompleteListItemContext, StreamMessage } from '../types';
9
9
  import { MessageInputConfigService } from './message-input-config.service';
10
10
  import { TextareaInterface } from './textarea.interface';
11
11
  import * as i0 from "@angular/core";
@@ -22,6 +22,8 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
22
22
  areMentionsEnabled: boolean | undefined;
23
23
  mentionScope: 'channel' | 'application' | undefined;
24
24
  mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
25
+ commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
26
+ mode: 'thread' | 'main';
25
27
  /**
26
28
  * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message-input/#caution-acceptedfiletypes
27
29
  */
@@ -36,12 +38,14 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
36
38
  textareaValue: string;
37
39
  textareaRef: ComponentRef<TextareaInterface> | undefined;
38
40
  mentionedUsers: UserResponse[];
41
+ quotedMessage: undefined | StreamMessage;
39
42
  private fileInput;
40
43
  private textareaAnchor;
41
44
  private subscriptions;
42
45
  private hideNotification;
43
46
  private isViewInited;
44
47
  private appSettings;
48
+ private channel;
45
49
  constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService);
46
50
  ngAfterViewInit(): void;
47
51
  ngOnChanges(changes: SimpleChanges): void;
@@ -49,11 +53,14 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
49
53
  messageSent(): Promise<void>;
50
54
  get containsLinks(): boolean;
51
55
  get accept(): string;
56
+ get quotedMessageAttachments(): import("stream-chat").Attachment<import("../types").DefaultAttachmentType>[];
52
57
  filesSelected(fileList: FileList | null): Promise<void>;
58
+ deselectMessageToQuote(): void;
53
59
  private clearFileInput;
54
60
  private get isUpdate();
55
61
  private initTextarea;
56
62
  private areAttachemntsValid;
63
+ private setCanSendMessages;
57
64
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, never>;
58
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "acceptedFileTypes": "acceptedFileTypes"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; }, { "messageUpdate": "messageUpdate"; }, never, never>;
65
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "commandAutocompleteItemTemplate": "commandAutocompleteItemTemplate"; "mode": "mode"; "acceptedFileTypes": "acceptedFileTypes"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; }, { "messageUpdate": "messageUpdate"; }, never, never>;
59
66
  }
@@ -1,6 +1,6 @@
1
1
  import { ComponentRef, EventEmitter, OnChanges, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
2
2
  import { UserResponse } from 'stream-chat';
3
- import { MentionAutcompleteListItemContext } from '../types';
3
+ import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
4
4
  import { TextareaInterface } from './textarea.interface';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class TextareaDirective implements OnChanges {
@@ -9,6 +9,7 @@ export declare class TextareaDirective implements OnChanges {
9
9
  areMentionsEnabled: boolean | undefined;
10
10
  mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
11
11
  mentionScope?: 'channel' | 'application';
12
+ commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
12
13
  value: string;
13
14
  readonly valueChange: EventEmitter<string>;
14
15
  readonly send: EventEmitter<void>;
@@ -18,5 +19,5 @@ export declare class TextareaDirective implements OnChanges {
18
19
  constructor(viewContainerRef: ViewContainerRef);
19
20
  ngOnChanges(changes: SimpleChanges): void;
20
21
  static ɵfac: i0.ɵɵFactoryDeclaration<TextareaDirective, never>;
21
- static ɵdir: i0.ɵɵDirectiveDeclaration<TextareaDirective, "[streamTextarea]", never, { "componentRef": "componentRef"; "areMentionsEnabled": "areMentionsEnabled"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "mentionScope": "mentionScope"; "value": "value"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never>;
22
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TextareaDirective, "[streamTextarea]", never, { "componentRef": "componentRef"; "areMentionsEnabled": "areMentionsEnabled"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "mentionScope": "mentionScope"; "commandAutocompleteItemTemplate": "commandAutocompleteItemTemplate"; "value": "value"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never>;
22
23
  }
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter, OnChanges, TemplateRef } from '@angular/core';
2
2
  import { UserResponse } from 'stream-chat';
3
- import { MentionAutcompleteListItemContext } from '../types';
3
+ import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
4
4
  export interface TextareaInterface extends OnChanges {
5
5
  value: string;
6
6
  valueChange: EventEmitter<string>;
@@ -8,5 +8,6 @@ export interface TextareaInterface extends OnChanges {
8
8
  userMentions?: EventEmitter<UserResponse[]>;
9
9
  areMentionsEnabled?: boolean;
10
10
  mentionAutocompleteItemTemplate?: TemplateRef<MentionAutcompleteListItemContext> | undefined;
11
+ commandAutocompleteItemTemplate?: TemplateRef<CommandAutocompleteListItemContext> | undefined;
11
12
  mentionScope?: 'channel' | 'application';
12
13
  }
@@ -1,31 +1,39 @@
1
- import { AfterViewChecked, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
1
+ import { AfterViewChecked, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { ChannelService } from '../channel.service';
3
3
  import { Observable } from 'rxjs';
4
4
  import { StreamMessage } from '../types';
5
5
  import { ChatClientService } from '../chat-client.service';
6
6
  import { GroupStyle } from './group-styles';
7
7
  import { ImageLoadService } from './image-load.service';
8
- import { MessageActions } from '../message-actions-box/message-actions-box.component';
9
8
  import * as i0 from "@angular/core";
10
- export declare class MessageListComponent implements AfterViewChecked, OnChanges {
9
+ export declare class MessageListComponent implements AfterViewChecked, OnChanges, OnInit, OnDestroy {
11
10
  private channelService;
12
11
  private chatClientService;
13
12
  private imageLoadService;
14
13
  messageTemplate: TemplateRef<any> | undefined;
15
14
  messageInputTemplate: TemplateRef<any> | undefined;
16
15
  mentionTemplate: TemplateRef<any> | undefined;
17
- areReactionsEnabled: boolean;
18
- enabledMessageActionsInput: MessageActions[];
16
+ /**
17
+ * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message_list/#caution-arereactionsenabled-deprecated
18
+ */
19
+ areReactionsEnabled: boolean | undefined;
20
+ /**
21
+ * @deprecated https://getstream.io/chat/docs/sdk/angular/components/message_list/#caution-enabledmessageactions-deprecated
22
+ */
23
+ enabledMessageActionsInput: string[] | undefined;
24
+ mode: 'main' | 'thread';
19
25
  messages$: Observable<StreamMessage[]>;
20
26
  canReactToMessage: boolean | undefined;
21
27
  canReceiveReadEvents: boolean | undefined;
22
- enabledMessageActions: MessageActions[];
28
+ enabledMessageActions: string[];
23
29
  private class;
24
30
  unreadMessageCount: number;
25
31
  isUserScrolledUp: boolean | undefined;
26
32
  groupStyles: GroupStyle[];
27
33
  lastSentMessageId: string | undefined;
34
+ parentMessage: StreamMessage | undefined;
28
35
  private scrollContainer;
36
+ private parentMessageElement;
29
37
  private latestMessageDate;
30
38
  private hasNewMessages;
31
39
  private containerHeight;
@@ -34,14 +42,20 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
34
42
  private isNewMessageSentByUser;
35
43
  private authorizedMessageActions;
36
44
  private readonly isUserScrolledUpThreshold;
45
+ private subscriptions;
46
+ private prevScrollTop;
37
47
  constructor(channelService: ChannelService, chatClientService: ChatClientService, imageLoadService: ImageLoadService);
48
+ ngOnInit(): void;
38
49
  ngOnChanges(changes: SimpleChanges): void;
39
50
  ngAfterViewChecked(): void;
51
+ ngOnDestroy(): void;
40
52
  trackByMessageId(index: number, item: StreamMessage): string;
41
53
  scrollToBottom(): void;
42
54
  scrolled(): void;
43
55
  private preserveScrollbarPosition;
44
56
  private setEnabledActions;
57
+ private setMessages$;
58
+ private resetScrollState;
45
59
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "messageTemplate": "messageTemplate"; "messageInputTemplate": "messageInputTemplate"; "mentionTemplate": "mentionTemplate"; "areReactionsEnabled": "areReactionsEnabled"; "enabledMessageActionsInput": "enabledMessageActions"; }, {}, never, never>;
60
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "messageTemplate": "messageTemplate"; "messageInputTemplate": "messageInputTemplate"; "mentionTemplate": "mentionTemplate"; "areReactionsEnabled": "areReactionsEnabled"; "enabledMessageActionsInput": "enabledMessageActions"; "mode": "mode"; }, {}, never, never>;
47
61
  }
@@ -1,2 +1,2 @@
1
1
  import { Attachment, MessageResponse, UserResponse } from 'stream-chat';
2
- export declare const createMessagePreview: (user: UserResponse, text: string, attachments: Attachment[], mentionedUsers: UserResponse[]) => MessageResponse<import("stream-chat").UR, import("stream-chat").UR, import("stream-chat").LiteralStringForUnion, import("stream-chat").UR, import("stream-chat").UR, import("stream-chat").UR>;
2
+ export declare const createMessagePreview: (user: UserResponse, text: string, attachments?: Attachment[], mentionedUsers?: UserResponse[], parentId?: undefined | string, quotedMessageId?: undefined | string) => MessageResponse<import("stream-chat").UR, import("stream-chat").UR, import("stream-chat").LiteralStringForUnion, import("stream-chat").UR, import("stream-chat").UR, import("stream-chat").UR>;
@@ -16,11 +16,12 @@ import * as i14 from "./notification-list/notification-list.component";
16
16
  import * as i15 from "./attachment-preview-list/attachment-preview-list.component";
17
17
  import * as i16 from "./modal/modal.component";
18
18
  import * as i17 from "./message-input/textarea.directive";
19
- import * as i18 from "@angular/common";
20
- import * as i19 from "@ngx-translate/core";
21
- import * as i20 from "./stream-avatar.module";
19
+ import * as i18 from "./thread/thread.component";
20
+ import * as i19 from "@angular/common";
21
+ import * as i20 from "@ngx-translate/core";
22
+ import * as i21 from "./stream-avatar.module";
22
23
  export declare class StreamChatModule {
23
24
  static ɵfac: i0.ɵɵFactoryDeclaration<StreamChatModule, never>;
24
- static ɵmod: i0.ɵɵNgModuleDeclaration<StreamChatModule, [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.LoadingIndicatorComponent, typeof i9.IconComponent, typeof i10.MessageActionsBoxComponent, typeof i11.AttachmentListComponent, typeof i12.MessageReactionsComponent, typeof i13.NotificationComponent, typeof i14.NotificationListComponent, typeof i15.AttachmentPreviewListComponent, typeof i16.ModalComponent, typeof i17.TextareaDirective], [typeof i18.CommonModule, typeof i19.TranslateModule, typeof i20.StreamAvatarModule], [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.LoadingIndicatorComponent, typeof i9.IconComponent, typeof i10.MessageActionsBoxComponent, typeof i11.AttachmentListComponent, typeof i12.MessageReactionsComponent, typeof i13.NotificationComponent, typeof i14.NotificationListComponent, typeof i15.AttachmentPreviewListComponent, typeof i16.ModalComponent, typeof i20.StreamAvatarModule]>;
25
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StreamChatModule, [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.LoadingIndicatorComponent, typeof i9.IconComponent, typeof i10.MessageActionsBoxComponent, typeof i11.AttachmentListComponent, typeof i12.MessageReactionsComponent, typeof i13.NotificationComponent, typeof i14.NotificationListComponent, typeof i15.AttachmentPreviewListComponent, typeof i16.ModalComponent, typeof i17.TextareaDirective, typeof i18.ThreadComponent], [typeof i19.CommonModule, typeof i20.TranslateModule, typeof i21.StreamAvatarModule], [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.LoadingIndicatorComponent, typeof i9.IconComponent, typeof i10.MessageActionsBoxComponent, typeof i11.AttachmentListComponent, typeof i12.MessageReactionsComponent, typeof i13.NotificationComponent, typeof i14.NotificationListComponent, typeof i15.AttachmentPreviewListComponent, typeof i16.ModalComponent, typeof i21.StreamAvatarModule, typeof i18.ThreadComponent]>;
25
26
  static ɵinj: i0.ɵɵInjectorDeclaration<StreamChatModule>;
26
27
  }
@@ -0,0 +1,18 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { ChannelService } from '../channel.service';
3
+ import { StreamMessage } from '../types';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ThreadComponent implements OnDestroy {
6
+ private channelService;
7
+ private class;
8
+ parentMessage: StreamMessage | undefined;
9
+ private subscriptions;
10
+ constructor(channelService: ChannelService);
11
+ ngOnDestroy(): void;
12
+ get replyCountParam(): {
13
+ replyCount: number | undefined;
14
+ };
15
+ closeThread(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThreadComponent, never>;
17
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThreadComponent, "stream-thread", never, {}, {}, never, ["[name=\"thread-message-list\"]", "[name=\"thread-message-input\"]"]>;
18
+ }
package/lib/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ChannelMemberResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
1
+ import type { ChannelMemberResponse, CommandResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
2
2
  export declare type UnknownType = Record<string, unknown>;
3
3
  export declare type CustomTrigger = {
4
4
  [key: string]: {
@@ -50,6 +50,12 @@ export declare type AttachmentUpload = {
50
50
  export declare type MentionAutcompleteListItemContext = {
51
51
  item: MentionAutcompleteListItem;
52
52
  };
53
+ export declare type CommandAutocompleteListItemContext = {
54
+ item: ComandAutocompleteListItem;
55
+ };
53
56
  export declare type MentionAutcompleteListItem = (ChannelMemberResponse | UserResponse) & {
54
57
  autocompleteLabel: string;
55
58
  };
59
+ export declare type ComandAutocompleteListItem = CommandResponse & {
60
+ autocompleteLabel: string;
61
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "2.8.2",
3
+ "version": "2.12.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/",
@@ -13,16 +13,7 @@
13
13
  "@angular/core": "^12.2.0 || ^13.0.0",
14
14
  "@ngx-translate/core": "^13.0.0 || ^14.0.0",
15
15
  "stream-chat": ">=4.3.0",
16
- "stream-chat-css": "1.0.23",
17
- "@stream-io/stream-chat-css": "2.0.1"
18
- },
19
- "peerDependenciesMeta": {
20
- "stream-chat-css": {
21
- "optional": true
22
- },
23
- "@stream-io/stream-chat-css": {
24
- "optional": true
25
- }
16
+ "@stream-io/stream-chat-css": "2.2.0"
26
17
  },
27
18
  "dependencies": {
28
19
  "angular-mentions": "^1.4.0",
package/public-api.d.ts CHANGED
@@ -29,6 +29,7 @@ export * from './lib/attachment-preview-list/attachment-preview-list.component';
29
29
  export * from './lib/message-reactions/message-reactions.component';
30
30
  export * from './lib/notification/notification.component';
31
31
  export * from './lib/notification-list/notification-list.component';
32
+ export * from './lib/thread/thread.component';
32
33
  export * from './lib/modal/modal.component';
33
34
  export * from './lib/read-by';
34
35
  export * from './lib/is-image-attachment';
@@ -31,6 +31,8 @@ export const en = {
31
31
  Flag: 'Flag',
32
32
  'Message Failed': 'Message Failed',
33
33
  'Message Failed · Unauthorized': 'Message Failed · Unauthorized',
34
+ 'Message Failed · Click to try again':
35
+ 'Message Failed · Click to try again',
34
36
  'Message deleted': 'Message deleted',
35
37
  'Message has been successfully flagged':
36
38
  'Message has been successfully flagged',
@@ -90,6 +92,8 @@ export const en = {
90
92
  'Sending links is not allowed in this conversation',
91
93
  "You can't send messages in this channel":
92
94
  "You can't send messages in this channel",
95
+ "You can't send thread replies in this channel":
96
+ "You can't send thread replies in this channel",
93
97
  'Unsupported file type: {{type}}': 'Unsupported file type: {{type}}',
94
98
  },
95
99
  };
@@ -1 +1 @@
1
- export const version = '2.8.2';
1
+ export const version = '2.12.0';