stream-chat-angular 2.20.0 → 3.0.0-beta.3

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 (61) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/bundles/stream-chat-angular.umd.js +623 -399
  3. package/bundles/stream-chat-angular.umd.js.map +1 -1
  4. package/esm2015/assets/version.js +2 -2
  5. package/esm2015/lib/attachment-list/attachment-list.component.js +27 -15
  6. package/esm2015/lib/attachment-preview-list/attachment-preview-list.component.js +28 -22
  7. package/esm2015/lib/avatar-placeholder/avatar-placeholder.component.js +41 -0
  8. package/esm2015/lib/channel-header/channel-header.component.js +26 -12
  9. package/esm2015/lib/channel-list/channel-list.component.js +23 -13
  10. package/esm2015/lib/channel-preview/channel-preview.component.js +3 -3
  11. package/esm2015/lib/channel.service.js +1 -1
  12. package/esm2015/lib/custom-templates.service.js +99 -0
  13. package/esm2015/lib/icon-placeholder/icon-placeholder.component.js +34 -0
  14. package/esm2015/lib/loading-indicator-placeholder/loading-indicator-placeholder.component.js +42 -0
  15. package/esm2015/lib/message/message.component.js +73 -23
  16. package/esm2015/lib/message-actions-box/message-actions-box.component.js +123 -95
  17. package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +13 -13
  18. package/esm2015/lib/message-input/message-input-config.service.js +1 -1
  19. package/esm2015/lib/message-input/message-input.component.js +43 -45
  20. package/esm2015/lib/message-input/textarea.directive.js +2 -18
  21. package/esm2015/lib/message-input/textarea.interface.js +1 -1
  22. package/esm2015/lib/message-list/message-list.component.js +32 -93
  23. package/esm2015/lib/message-reactions/message-reactions.component.js +3 -3
  24. package/esm2015/lib/modal/modal.component.js +9 -6
  25. package/esm2015/lib/notification/notification.component.js +5 -2
  26. package/esm2015/lib/notification-list/notification-list.component.js +12 -10
  27. package/esm2015/lib/stream-avatar.module.js +5 -4
  28. package/esm2015/lib/stream-chat.module.js +13 -3
  29. package/esm2015/lib/thread/thread.component.js +19 -11
  30. package/esm2015/lib/types.js +1 -1
  31. package/esm2015/public-api.js +5 -1
  32. package/fesm2015/stream-chat-angular.js +570 -318
  33. package/fesm2015/stream-chat-angular.js.map +1 -1
  34. package/lib/attachment-list/attachment-list.component.d.ts +7 -3
  35. package/lib/attachment-preview-list/attachment-preview-list.component.d.ts +17 -7
  36. package/lib/avatar-placeholder/avatar-placeholder.component.d.ts +25 -0
  37. package/lib/channel-header/channel-header.component.d.ts +13 -10
  38. package/lib/channel-list/channel-list.component.d.ts +12 -9
  39. package/lib/channel.service.d.ts +1 -2
  40. package/lib/custom-templates.service.d.ts +92 -0
  41. package/lib/icon-placeholder/icon-placeholder.component.d.ts +22 -0
  42. package/lib/loading-indicator-placeholder/loading-indicator-placeholder.component.d.ts +21 -0
  43. package/lib/message/message.component.d.ts +21 -28
  44. package/lib/message-actions-box/message-actions-box.component.d.ts +20 -25
  45. package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +6 -10
  46. package/lib/message-input/message-input-config.service.d.ts +0 -19
  47. package/lib/message-input/message-input.component.d.ts +15 -25
  48. package/lib/message-input/textarea.directive.d.ts +2 -5
  49. package/lib/message-input/textarea.interface.d.ts +1 -4
  50. package/lib/message-list/message-list.component.d.ts +10 -34
  51. package/lib/message-reactions/message-reactions.component.d.ts +1 -2
  52. package/lib/modal/modal.component.d.ts +7 -3
  53. package/lib/notification/notification.component.d.ts +6 -1
  54. package/lib/notification-list/notification-list.component.d.ts +4 -2
  55. package/lib/stream-avatar.module.d.ts +4 -3
  56. package/lib/stream-chat.module.d.ts +6 -4
  57. package/lib/thread/thread.component.d.ts +6 -3
  58. package/lib/types.d.ts +99 -1
  59. package/package.json +1 -1
  60. package/public-api.d.ts +4 -0
  61. package/src/assets/version.ts +1 -1
@@ -1,19 +1,20 @@
1
- import { AfterViewInit, ChangeDetectorRef, ComponentFactoryResolver, ComponentRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges, TemplateRef, Type } from '@angular/core';
1
+ import { AfterViewInit, ChangeDetectorRef, ComponentFactoryResolver, ComponentRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef, Type } from '@angular/core';
2
2
  import { ChatClientService } from '../chat-client.service';
3
3
  import { Observable, Subject } from 'rxjs';
4
4
  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, CommandAutocompleteListItemContext, MentionAutcompleteListItemContext, StreamMessage } from '../types';
8
+ import { AttachmentPreviewListContext, AttachmentUpload, EmojiPickerContext, StreamMessage } from '../types';
9
9
  import { MessageInputConfigService } from './message-input-config.service';
10
10
  import { TextareaInterface } from './textarea.interface';
11
11
  import { EmojiInputService } from './emoji-input.service';
12
+ import { CustomTemplatesService } from '../custom-templates.service';
12
13
  import * as i0 from "@angular/core";
13
14
  /**
14
15
  * The `MessageInput` component displays an input where users can type their messages and upload files, and sends the message to the active channel. The component can be used to compose new messages or update existing ones. To send messages, the chat user needs to have the necessary [channel capability](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript).
15
16
  */
16
- export declare class MessageInputComponent implements OnChanges, OnDestroy, AfterViewInit {
17
+ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestroy, AfterViewInit {
17
18
  private channelService;
18
19
  private notificationService;
19
20
  private attachmentService;
@@ -22,7 +23,8 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
22
23
  private componentFactoryResolver;
23
24
  private cdRef;
24
25
  private chatClient;
25
- emojiInputService: EmojiInputService;
26
+ private emojiInputService;
27
+ private customTemplatesService;
26
28
  /**
27
29
  * If file upload is enabled, the user can open a file selector from the input. Please note that the user also needs to have the necessary [channel capability](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript). If no value is provided, it is set from the [`MessageInputConfigService`](../services/MessageInputConfigService.mdx).
28
30
  */
@@ -35,28 +37,10 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
35
37
  * The scope for user mentions, either members of the current channel of members of the application. If no value is provided, it is set from the [`MessageInputConfigService`](../services/MessageInputConfigService.mdx).
36
38
  */
37
39
  mentionScope: 'channel' | 'application' | undefined;
38
- /**
39
- * You can provide your own template for the autocomplete list for user mentions. You also [need to use the `AutocompleteTextarea`](../concepts/opt-in-architecture.mdx) for this feature to work. If no value is provided, it is set from the [`MessageInputConfigService`](../services/MessageInputConfigService.mdx).
40
- */
41
- mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
42
- /**
43
- * You can provide your own template for the autocomplete list for commands. You also [need to use the `AutocompleteTextarea`](../concepts/opt-in-architecture.mdx) for this feature to work. If no value is provided, it is set from the [`MessageInputConfigService`](../services/MessageInputConfigService.mdx).
44
- */
45
- commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
46
- /**
47
- * You can add an emoji picker by [providing your own emoji picker template](../code-examples/emoji-picker.mdx)
48
- */
49
- emojiPickerTemplate: TemplateRef<void> | undefined;
50
40
  /**
51
41
  * Determines if the message is being dispalyed in a channel or in a [thread](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
52
42
  */
53
43
  mode: 'thread' | 'main';
54
- /**
55
- * You can narrow the accepted file types by providing the [accepted types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept). By default every file type is accepted.
56
- * If no value is provided, it is set from the [`MessageInputConfigService`](../services/MessageInputConfigService.mdx).
57
- * @deprecated use [application settings](https://getstream.io/chat/docs/javascript/app_setting_overview/?language=javascript#file-uploads) instead
58
- */
59
- acceptedFileTypes: string[] | undefined;
60
44
  /**
61
45
  * If true, users can select multiple files to upload. If no value is provided, it is set from the [`MessageInputConfigService`](../services/MessageInputConfigService.mdx).
62
46
  */
@@ -80,6 +64,8 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
80
64
  typingStart$: Subject<void>;
81
65
  cooldown$: Observable<number> | undefined;
82
66
  isCooldownInProgress: boolean;
67
+ emojiPickerTemplate: TemplateRef<EmojiPickerContext> | undefined;
68
+ attachmentPreviewListTemplate: TemplateRef<AttachmentPreviewListContext> | undefined;
83
69
  private fileInput;
84
70
  private textareaAnchor;
85
71
  private subscriptions;
@@ -87,17 +73,21 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
87
73
  private isViewInited;
88
74
  private appSettings;
89
75
  private channel;
90
- constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService, emojiInputService: EmojiInputService);
76
+ constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService, emojiInputService: EmojiInputService, customTemplatesService: CustomTemplatesService);
77
+ ngOnInit(): void;
91
78
  ngAfterViewInit(): void;
92
79
  ngOnChanges(changes: SimpleChanges): void;
93
80
  ngOnDestroy(): void;
94
81
  messageSent(): Promise<void>;
95
82
  get containsLinks(): boolean;
96
- get accept(): string;
97
83
  get quotedMessageAttachments(): import("stream-chat").Attachment<import("../types").DefaultAttachmentType>[];
98
84
  get disabledTextareaText(): "" | "streamChat.You can't send thread replies in this channel" | "streamChat.You can't send messages in this channel" | "streamChat.Slow Mode ON";
99
85
  filesSelected(fileList: FileList | null): Promise<void>;
100
86
  deselectMessageToQuote(): void;
87
+ getEmojiPickerContext(): EmojiPickerContext;
88
+ getAttachmentPreviewListContext(): AttachmentPreviewListContext;
89
+ private deleteUpload;
90
+ private retryUpload;
101
91
  private clearFileInput;
102
92
  private get isUpdate();
103
93
  private initTextarea;
@@ -107,5 +97,5 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
107
97
  private startCooldown;
108
98
  private stopCooldown;
109
99
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, never>;
110
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "commandAutocompleteItemTemplate": "commandAutocompleteItemTemplate"; "emojiPickerTemplate": "emojiPickerTemplate"; "mode": "mode"; "acceptedFileTypes": "acceptedFileTypes"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; }, { "messageUpdate": "messageUpdate"; }, never, never>;
100
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mode": "mode"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; }, { "messageUpdate": "messageUpdate"; }, never, never>;
111
101
  }
@@ -1,15 +1,12 @@
1
- import { ComponentRef, EventEmitter, OnChanges, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
1
+ import { ComponentRef, EventEmitter, OnChanges, SimpleChanges, ViewContainerRef } from '@angular/core';
2
2
  import { UserResponse } from 'stream-chat';
3
- import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
4
3
  import { TextareaInterface } from './textarea.interface';
5
4
  import * as i0 from "@angular/core";
6
5
  export declare class TextareaDirective implements OnChanges {
7
6
  viewContainerRef: ViewContainerRef;
8
7
  componentRef: ComponentRef<TextareaInterface> | undefined;
9
8
  areMentionsEnabled: boolean | undefined;
10
- mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
11
9
  mentionScope?: 'channel' | 'application';
12
- commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
13
10
  value: string;
14
11
  readonly valueChange: EventEmitter<string>;
15
12
  readonly send: EventEmitter<void>;
@@ -19,5 +16,5 @@ export declare class TextareaDirective implements OnChanges {
19
16
  constructor(viewContainerRef: ViewContainerRef);
20
17
  ngOnChanges(changes: SimpleChanges): void;
21
18
  static ɵfac: i0.ɵɵFactoryDeclaration<TextareaDirective, 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>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TextareaDirective, "[streamTextarea]", never, { "componentRef": "componentRef"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "value": "value"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never>;
23
20
  }
@@ -1,13 +1,10 @@
1
- import { EventEmitter, OnChanges, TemplateRef } from '@angular/core';
1
+ import { EventEmitter, OnChanges } from '@angular/core';
2
2
  import { UserResponse } from 'stream-chat';
3
- import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
4
3
  export interface TextareaInterface extends OnChanges {
5
4
  value: string;
6
5
  valueChange: EventEmitter<string>;
7
6
  send: EventEmitter<void>;
8
7
  userMentions?: EventEmitter<UserResponse[]>;
9
8
  areMentionsEnabled?: boolean;
10
- mentionAutocompleteItemTemplate?: TemplateRef<MentionAutcompleteListItemContext> | undefined;
11
- commandAutocompleteItemTemplate?: TemplateRef<CommandAutocompleteListItemContext> | undefined;
12
9
  mentionScope?: 'channel' | 'application';
13
10
  }
@@ -1,11 +1,12 @@
1
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
- import { DefaultUserType, StreamMessage } from '../types';
4
+ import { MessageContext, StreamMessage, TypingIndicatorContext } 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
8
  import { UserResponse } from 'stream-chat';
9
+ import { CustomTemplatesService } from '../custom-templates.service';
9
10
  import * as i0 from "@angular/core";
10
11
  /**
11
12
  * The `MessageList` component renders a scrollable list of messages.
@@ -14,39 +15,14 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
14
15
  private channelService;
15
16
  private chatClientService;
16
17
  private imageLoadService;
17
- /**
18
- * By default, the [default message component](./MessageComponent.mdx) is used. To change the contents of the message, provide [your own custom message template](./MessageComponent.mdx/#customization).
19
- */
20
- messageTemplate: TemplateRef<any> | undefined;
21
- /**
22
- * The input used for message edit. By default, the [default message input component](./MessageInputComponent.mdx) is used. To change the input for message edit, provide [your own custom template](./MessageInputComponent.mdx/#customization).
23
- */
24
- messageInputTemplate: TemplateRef<any> | undefined;
25
- /**
26
- * The template used to display a mention in a message. It receives the mentioned user in a variable called `user` with the type [`UserResponse`](https://github.com/GetStream/stream-chat-js/blob/master/src/types.ts). You can provide your own template if you want to [add actions to mentions](../code-examples/mention-actions.mdx).
27
- */
28
- mentionTemplate: TemplateRef<any> | undefined;
29
- /**
30
- * You can provide your own typing indicator template instead of the default one.
31
- */
32
- typingIndicatorTemplate: TemplateRef<{
33
- usersTyping$: Observable<UserResponse<DefaultUserType>[]>;
34
- }> | undefined;
35
- /**
36
- * @deprecated use [channel capabilities](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript) instead. If true, the message reactions are displayed. Users can also react to messages if they have the necessary [channel capability](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript).
37
- */
38
- areReactionsEnabled: boolean | undefined;
39
- /**
40
- * @deprecated use [channel capabilities](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript) instead. The list of [actions that are enabled](./MessageActionsBoxComponent.mdx), please note that the user also has to have the necessary [channel capabilities](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript) for actions to work. Unathorized actions won't be displayed on the UI. The `MessgaeList` component makes the necessary checks before passing the actions to the `Message` component.
41
- */
42
- enabledMessageActionsInput: string[] | undefined;
18
+ private customTemplatesService;
43
19
  /**
44
20
  * Determines if the message list should display channel messages or [thread messages](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
45
21
  */
46
22
  mode: 'main' | 'thread';
23
+ typingIndicatorTemplate: TemplateRef<TypingIndicatorContext> | undefined;
24
+ messageTemplate: TemplateRef<MessageContext> | undefined;
47
25
  messages$: Observable<StreamMessage[]>;
48
- canReactToMessage: boolean | undefined;
49
- canReceiveReadEvents: boolean | undefined;
50
26
  enabledMessageActions: string[];
51
27
  private class;
52
28
  unreadMessageCount: number;
@@ -62,26 +38,26 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
62
38
  private oldestMessageDate;
63
39
  private olderMassagesLoaded;
64
40
  private isNewMessageSentByUser;
65
- private authorizedMessageActions;
66
41
  private readonly isUserScrolledUpThreshold;
67
42
  private subscriptions;
68
43
  private prevScrollTop;
69
44
  private usersTypingInChannel$;
70
45
  private usersTypingInThread$;
71
- constructor(channelService: ChannelService, chatClientService: ChatClientService, imageLoadService: ImageLoadService);
46
+ constructor(channelService: ChannelService, chatClientService: ChatClientService, imageLoadService: ImageLoadService, customTemplatesService: CustomTemplatesService);
72
47
  ngOnInit(): void;
73
48
  ngOnChanges(changes: SimpleChanges): void;
74
49
  ngAfterViewChecked(): void;
75
50
  ngOnDestroy(): void;
76
- get usersTyping$(): Observable<UserResponse<DefaultUserType<import("../types").DefaultUserTypeInternal>>[]>;
77
51
  trackByMessageId(index: number, item: StreamMessage): string;
78
52
  trackByUserId(index: number, user: UserResponse): string;
79
53
  scrollToBottom(): void;
80
54
  scrolled(): void;
55
+ getTypingIndicatorContext(): TypingIndicatorContext;
56
+ getMessageContext(message: StreamMessage): MessageContext;
81
57
  private preserveScrollbarPosition;
82
- private setEnabledActions;
83
58
  private setMessages$;
84
59
  private resetScrollState;
60
+ private get usersTyping$();
85
61
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
86
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "messageTemplate": "messageTemplate"; "messageInputTemplate": "messageInputTemplate"; "mentionTemplate": "mentionTemplate"; "typingIndicatorTemplate": "typingIndicatorTemplate"; "areReactionsEnabled": "areReactionsEnabled"; "enabledMessageActionsInput": "enabledMessageActions"; "mode": "mode"; }, {}, never, never>;
62
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; }, {}, never, never>;
87
63
  }
@@ -1,9 +1,8 @@
1
1
  import { AfterViewChecked, ChangeDetectorRef, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { ReactionResponse } from 'stream-chat';
3
3
  import { ChannelService } from '../channel.service';
4
- import { DefaultReactionType, DefaultUserType } from '../types';
4
+ import { DefaultReactionType, DefaultUserType, MessageReactionType } from '../types';
5
5
  import * as i0 from "@angular/core";
6
- export declare type MessageReactionType = 'angry' | 'haha' | 'like' | 'love' | 'sad' | 'wow';
7
6
  /**
8
7
  * The `MessageReactions` component displays the reactions of a message, the current user can add and remove reactions. You can read more about [message reactions](https://getstream.io/chat/docs/javascript/send_reaction/?language=javascript) in the platform documentation.
9
8
  */
@@ -1,4 +1,4 @@
1
- import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
1
+ import { EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  /**
4
4
  * The `Modal` component displays its content in an overlay. The modal can be closed with a close button, if the user clicks outside of the modal content, or if the escape button is pressed. The modal can also be closed from outside.
@@ -8,11 +8,15 @@ export declare class ModalComponent implements OnChanges {
8
8
  * If `true` the modal will be displayed, if `false` the modal will be hidden
9
9
  */
10
10
  isOpen: boolean;
11
+ /**
12
+ * The content of the modal (can also be provided using `ng-content`)
13
+ */
14
+ content: TemplateRef<void> | undefined;
11
15
  /**
12
16
  * Emits `true` if the modal becomes visible, and `false` if the modal is closed.
13
17
  */
14
18
  readonly isOpenChange: EventEmitter<boolean>;
15
- private content;
19
+ private innerContainer;
16
20
  constructor();
17
21
  ngOnChanges(changes: SimpleChanges): void;
18
22
  close(): void;
@@ -21,5 +25,5 @@ export declare class ModalComponent implements OnChanges {
21
25
  private watchForOutsideClicks;
22
26
  private stopWatchForOutsideClicks;
23
27
  static ɵfac: i0.ɵɵFactoryDeclaration<ModalComponent, never>;
24
- static ɵcmp: i0.ɵɵComponentDeclaration<ModalComponent, "stream-modal", never, { "isOpen": "isOpen"; }, { "isOpenChange": "isOpenChange"; }, never, ["*"]>;
28
+ static ɵcmp: i0.ɵɵComponentDeclaration<ModalComponent, "stream-modal", never, { "isOpen": "isOpen"; "content": "content"; }, { "isOpenChange": "isOpenChange"; }, never, ["*"]>;
25
29
  }
@@ -1,3 +1,4 @@
1
+ import { TemplateRef } from '@angular/core';
1
2
  import { NotificationType } from '../types';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
@@ -8,7 +9,11 @@ export declare class NotificationComponent {
8
9
  * The type of the notification
9
10
  */
10
11
  type: NotificationType | undefined;
12
+ /**
13
+ * The content of the notification (can also be provided using `ng-content`)
14
+ */
15
+ content: TemplateRef<void> | undefined;
11
16
  constructor();
12
17
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationComponent, never>;
13
- static ɵcmp: i0.ɵɵComponentDeclaration<NotificationComponent, "stream-notification", never, { "type": "type"; }, {}, never, ["*"]>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<NotificationComponent, "stream-notification", never, { "type": "type"; "content": "content"; }, {}, never, ["*"]>;
14
19
  }
@@ -1,4 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { CustomTemplatesService } from '../custom-templates.service';
2
3
  import { NotificationService } from '../notification.service';
3
4
  import { NotificationPayload } from '../types';
4
5
  import * as i0 from "@angular/core";
@@ -6,11 +7,12 @@ import * as i0 from "@angular/core";
6
7
  * The `NotificationList` component displays the list of active notifications.
7
8
  */
8
9
  export declare class NotificationListComponent {
10
+ readonly customTemplatesService: CustomTemplatesService;
9
11
  private notificationService;
10
12
  notifications$: Observable<NotificationPayload[]>;
11
- constructor(notificationService: NotificationService);
13
+ constructor(customTemplatesService: CustomTemplatesService, notificationService: NotificationService);
12
14
  trackById(_: number, item: NotificationPayload): string;
13
- getTemplateContext(notification: NotificationPayload): {
15
+ getNotificationContentContext(notification: NotificationPayload): {
14
16
  dismissFn: Function;
15
17
  };
16
18
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationListComponent, never>;
@@ -1,9 +1,10 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./avatar/avatar.component";
3
- import * as i2 from "@angular/common";
4
- import * as i3 from "@ngx-translate/core";
3
+ import * as i2 from "./avatar-placeholder/avatar-placeholder.component";
4
+ import * as i3 from "@angular/common";
5
+ import * as i4 from "@ngx-translate/core";
5
6
  export declare class StreamAvatarModule {
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<StreamAvatarModule, never>;
7
- static ɵmod: i0.ɵɵNgModuleDeclaration<StreamAvatarModule, [typeof i1.AvatarComponent], [typeof i2.CommonModule, typeof i3.TranslateModule], [typeof i1.AvatarComponent]>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StreamAvatarModule, [typeof i1.AvatarComponent, typeof i2.AvatarPlaceholderComponent], [typeof i3.CommonModule, typeof i4.TranslateModule], [typeof i1.AvatarComponent, typeof i2.AvatarPlaceholderComponent]>;
8
9
  static ɵinj: i0.ɵɵInjectorDeclaration<StreamAvatarModule>;
9
10
  }
@@ -17,11 +17,13 @@ import * as i15 from "./attachment-preview-list/attachment-preview-list.componen
17
17
  import * as i16 from "./modal/modal.component";
18
18
  import * as i17 from "./message-input/textarea.directive";
19
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";
20
+ import * as i19 from "./icon-placeholder/icon-placeholder.component";
21
+ import * as i20 from "./loading-indicator-placeholder/loading-indicator-placeholder.component";
22
+ import * as i21 from "@angular/common";
23
+ import * as i22 from "@ngx-translate/core";
24
+ import * as i23 from "./stream-avatar.module";
23
25
  export declare class StreamChatModule {
24
26
  static ɵfac: i0.ɵɵFactoryDeclaration<StreamChatModule, never>;
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]>;
27
+ 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.IconPlaceholderComponent, typeof i20.LoadingIndicatorPlaceholderComponent], [typeof i21.CommonModule, typeof i22.TranslateModule, typeof i23.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 i23.StreamAvatarModule, typeof i18.ThreadComponent, typeof i19.IconPlaceholderComponent, typeof i20.LoadingIndicatorPlaceholderComponent]>;
26
28
  static ɵinj: i0.ɵɵInjectorDeclaration<StreamChatModule>;
27
29
  }
@@ -1,18 +1,21 @@
1
1
  import { OnDestroy } from '@angular/core';
2
2
  import { ChannelService } from '../channel.service';
3
- import { StreamMessage } from '../types';
3
+ import { CustomTemplatesService } from '../custom-templates.service';
4
+ import { StreamMessage, ThreadHeaderContext } from '../types';
4
5
  import * as i0 from "@angular/core";
5
6
  /**
6
7
  * The `Thread` component represents a [message thread](https://getstream.io/chat/docs/javascript/threads/?language=javascript), it is a container component that displays a thread with a header, [`MessageList`](./MessageListComponent.mdx) and [`MessageInput`](./MessageInputComponent.mdx) components.
7
8
  */
8
9
  export declare class ThreadComponent implements OnDestroy {
10
+ customTemplatesService: CustomTemplatesService;
9
11
  private channelService;
10
12
  private class;
11
13
  parentMessage: StreamMessage | undefined;
12
14
  private subscriptions;
13
- constructor(channelService: ChannelService);
15
+ constructor(customTemplatesService: CustomTemplatesService, channelService: ChannelService);
14
16
  ngOnDestroy(): void;
15
- get replyCountParam(): {
17
+ getThreadHeaderContext(): ThreadHeaderContext;
18
+ getReplyCountParam(parentMessage: StreamMessage | undefined): {
16
19
  replyCount: number | undefined;
17
20
  };
18
21
  closeThread(): void;
package/lib/types.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { TemplateRef } from '@angular/core';
2
- import type { Attachment, ChannelMemberResponse, CommandResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
2
+ import { Observable, Subject } from 'rxjs';
3
+ import type { Attachment, Channel, ChannelMemberResponse, CommandResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, ReactionResponse, UserResponse } from 'stream-chat';
4
+ import { Icon } from './icon/icon.component';
3
5
  export declare type UnknownType = Record<string, unknown>;
4
6
  export declare type CustomTrigger = {
5
7
  [key: string]: {
@@ -66,3 +68,99 @@ export declare type NotificationPayload<T = {}> = {
66
68
  templateContext?: T;
67
69
  dismissFn: Function;
68
70
  };
71
+ export declare type ChannelPreviewContext = {
72
+ channel: Channel;
73
+ };
74
+ export declare type MessageInputContext = {
75
+ isFileUploadEnabled: boolean | undefined;
76
+ areMentionsEnabled: boolean | undefined;
77
+ mentionScope: 'channel' | 'application' | undefined;
78
+ mode: 'thread' | 'main' | undefined;
79
+ isMultipleFileUploadEnabled: boolean | undefined;
80
+ message: StreamMessage | undefined;
81
+ messageUpdateHandler: Function | undefined;
82
+ };
83
+ export declare type MentionTemplateContext = {
84
+ content: string;
85
+ user: UserResponse;
86
+ };
87
+ export declare type EmojiPickerContext = {
88
+ emojiInput$: Subject<string>;
89
+ };
90
+ export declare type TypingIndicatorContext = {
91
+ usersTyping$: Observable<UserResponse<DefaultUserType>[]>;
92
+ };
93
+ export declare type MessageContext = {
94
+ message: StreamMessage | undefined;
95
+ enabledMessageActions: string[];
96
+ isLastSentMessage: boolean | undefined;
97
+ mode: 'thread' | 'main';
98
+ };
99
+ export declare type ChannelActionsContext = {
100
+ channel: Channel;
101
+ };
102
+ export declare type AttachmentListContext = {
103
+ messageId: string;
104
+ attachments: Attachment<DefaultAttachmentType>[];
105
+ };
106
+ export declare type AvatarContext = {
107
+ name: string | undefined;
108
+ imageUrl: string | undefined;
109
+ size: number | undefined;
110
+ };
111
+ export declare type AttachmentPreviewListContext = {
112
+ attachmentUploads$: Observable<AttachmentUpload[]> | undefined;
113
+ retryUploadHandler: (f: File) => any;
114
+ deleteUploadHandler: (u: AttachmentUpload) => any;
115
+ };
116
+ export declare type IconContext = {
117
+ icon: Icon | undefined;
118
+ size: number | undefined;
119
+ };
120
+ export declare type LoadingIndicatorContext = {
121
+ size: number | undefined;
122
+ color: string | undefined;
123
+ };
124
+ export declare type MessageActionsBoxContext = {
125
+ isOpen: boolean;
126
+ isMine: boolean;
127
+ message: StreamMessage | undefined;
128
+ enabledActions: string[];
129
+ displayedActionsCountChaneHanler: (count: number) => any;
130
+ isEditingChangeHandler: (isEditing: boolean) => any;
131
+ };
132
+ export declare type MessageActionBoxItemContext = {
133
+ actionName: 'quote' | 'pin' | 'flag' | 'mute' | 'edit' | 'delete';
134
+ actionLabelOrTranslationKey: (() => string) | string;
135
+ actionHandler: () => any;
136
+ };
137
+ export declare type MessageActionItem = {
138
+ actionName: 'quote' | 'pin' | 'flag' | 'mute' | 'edit' | 'delete';
139
+ actionLabelOrTranslationKey: (() => string) | string;
140
+ isVisible: (enabledActions: string[], isMine: boolean, message: StreamMessage) => boolean;
141
+ actionHandler: (message: StreamMessage, isMine: boolean) => any;
142
+ };
143
+ export declare type MessageReactionsContext = {
144
+ messageId: string | undefined;
145
+ messageReactionCounts: {
146
+ [key in MessageReactionType]?: number;
147
+ };
148
+ isSelectorOpen: boolean;
149
+ latestReactions: ReactionResponse<DefaultReactionType, DefaultUserType>[];
150
+ ownReactions: ReactionResponse<DefaultReactionType, DefaultUserType>[];
151
+ isSelectorOpenChangeHandler: (isOpen: boolean) => any;
152
+ };
153
+ export declare type ModalContext = {
154
+ isOpen: boolean;
155
+ isOpenChangeHandler: (isOpen: boolean) => any;
156
+ content: TemplateRef<void>;
157
+ };
158
+ export declare type NotificationContext = {
159
+ type: NotificationType | undefined;
160
+ content: TemplateRef<void> | undefined;
161
+ };
162
+ export declare type ThreadHeaderContext = {
163
+ parentMessage: StreamMessage | undefined;
164
+ closeThreadHandler: Function;
165
+ };
166
+ export declare type MessageReactionType = 'angry' | 'haha' | 'like' | 'love' | 'sad' | 'wow';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "2.20.0",
3
+ "version": "3.0.0-beta.3",
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
@@ -4,8 +4,11 @@ export * from './lib/theme.service';
4
4
  export * from './lib/attachment.service';
5
5
  export * from './lib/stream-i18n.service';
6
6
  export * from './lib/avatar/avatar.component';
7
+ export * from './lib/avatar-placeholder/avatar-placeholder.component';
7
8
  export * from './lib/icon/icon.component';
9
+ export * from './lib/icon-placeholder/icon-placeholder.component';
8
10
  export * from './lib/loading-indicator/loading-indicator.component';
11
+ export * from './lib/loading-indicator-placeholder/loading-indicator-placeholder.component';
9
12
  export * from './lib/message-actions-box/message-actions-box.component';
10
13
  export * from './lib/channel/channel.component';
11
14
  export * from './lib/channel-header/channel-header.component';
@@ -44,4 +47,5 @@ export * from './lib/stream-avatar.module';
44
47
  export * from './lib/stream-autocomplete-textarea.module';
45
48
  export * from './lib/stream-textarea.module';
46
49
  export * from './lib/injection-tokens';
50
+ export * from './lib/custom-templates.service';
47
51
  export * from './lib/types';
@@ -1 +1 @@
1
- export const version = '2.20.0';
1
+ export const version = '3.0.0-beta.3';