stream-chat-angular 3.0.0-beta.1 → 3.0.0-beta.2

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 (44) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/bundles/stream-chat-angular.umd.js +366 -273
  3. package/bundles/stream-chat-angular.umd.js.map +1 -1
  4. package/esm2015/assets/version.js +2 -2
  5. package/esm2015/lib/channel-header/channel-header.component.js +26 -9
  6. package/esm2015/lib/channel-list/channel-list.component.js +23 -13
  7. package/esm2015/lib/channel.service.js +71 -59
  8. package/esm2015/lib/chat-client.service.js +26 -2
  9. package/esm2015/lib/custom-templates.service.js +55 -0
  10. package/esm2015/lib/message/message.component.js +26 -17
  11. package/esm2015/lib/message-actions-box/message-actions-box.component.js +28 -12
  12. package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +13 -13
  13. package/esm2015/lib/message-input/message-input-config.service.js +1 -1
  14. package/esm2015/lib/message-input/message-input.component.js +25 -34
  15. package/esm2015/lib/message-input/textarea.directive.js +2 -18
  16. package/esm2015/lib/message-input/textarea.interface.js +1 -1
  17. package/esm2015/lib/message-list/message-list.component.js +31 -22
  18. package/esm2015/lib/notification/notification.component.js +1 -1
  19. package/esm2015/lib/notification-list/notification-list.component.js +7 -4
  20. package/esm2015/lib/notification.service.js +34 -18
  21. package/esm2015/lib/types.js +1 -1
  22. package/esm2015/public-api.js +2 -1
  23. package/fesm2015/stream-chat-angular.js +317 -182
  24. package/fesm2015/stream-chat-angular.js.map +1 -1
  25. package/lib/channel-header/channel-header.component.d.ts +12 -2
  26. package/lib/channel-list/channel-list.component.d.ts +12 -9
  27. package/lib/channel.service.d.ts +13 -13
  28. package/lib/chat-client.service.d.ts +7 -1
  29. package/lib/custom-templates.service.d.ts +48 -0
  30. package/lib/message/message.component.d.ts +11 -13
  31. package/lib/message-actions-box/message-actions-box.component.d.ts +12 -9
  32. package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +6 -10
  33. package/lib/message-input/message-input-config.service.d.ts +0 -14
  34. package/lib/message-input/message-input.component.d.ts +11 -18
  35. package/lib/message-input/textarea.directive.d.ts +2 -5
  36. package/lib/message-input/textarea.interface.d.ts +1 -4
  37. package/lib/message-list/message-list.component.d.ts +10 -22
  38. package/lib/notification/notification.component.d.ts +1 -1
  39. package/lib/notification-list/notification-list.component.d.ts +6 -2
  40. package/lib/notification.service.d.ts +14 -13
  41. package/lib/types.d.ts +44 -1
  42. package/package.json +1 -1
  43. package/public-api.d.ts +1 -0
  44. package/src/assets/version.ts +1 -1
@@ -1,17 +1,27 @@
1
+ import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core';
1
2
  import { Channel } from 'stream-chat';
2
3
  import { ChannelListToggleService } from '../channel-list/channel-list-toggle.service';
3
4
  import { ChannelService } from '../channel.service';
5
+ import { CustomTemplatesService } from '../custom-templates.service';
6
+ import { ChannelActionsContext } from '../types';
4
7
  import * as i0 from "@angular/core";
5
8
  /**
6
9
  * The `ChannelHeader` component displays the avatar and name of the currently active channel along with member and watcher information. You can read about [the difference between members and watchers](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript#watchers-vs-members) in the platform documentation. Please note that number of watchers is only displayed if the user has [`connect-events` capability](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript)
7
10
  */
8
- export declare class ChannelHeaderComponent {
11
+ export declare class ChannelHeaderComponent implements OnInit, OnDestroy {
9
12
  private channelService;
10
13
  private channelListToggleService;
14
+ private customTemplatesService;
15
+ private cdRef;
16
+ channelActionsTemplate?: TemplateRef<ChannelActionsContext>;
11
17
  activeChannel: Channel | undefined;
12
18
  canReceiveConnectEvents: boolean | undefined;
13
- constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService);
19
+ private subscriptions;
20
+ constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef);
21
+ ngOnInit(): void;
22
+ ngOnDestroy(): void;
14
23
  toggleMenu(event: Event): void;
24
+ getChannelActionsContext(): ChannelActionsContext;
15
25
  get memberCountParam(): {
16
26
  memberCount: unknown;
17
27
  };
@@ -1,31 +1,34 @@
1
- import { AfterViewInit, TemplateRef } from '@angular/core';
2
- import { Observable } from 'rxjs';
1
+ import { AfterViewInit, OnDestroy, TemplateRef } from '@angular/core';
2
+ import { Observable, Subscription } from 'rxjs';
3
3
  import { Channel } from 'stream-chat';
4
4
  import { ChannelService } from '../channel.service';
5
+ import { CustomTemplatesService } from '../custom-templates.service';
6
+ import { ChannelPreviewContext } from '../types';
5
7
  import { ChannelListToggleService } from './channel-list-toggle.service';
6
8
  import * as i0 from "@angular/core";
7
9
  /**
8
10
  * The `ChannelList` component renders the list of channels.
9
11
  */
10
- export declare class ChannelListComponent implements AfterViewInit {
12
+ export declare class ChannelListComponent implements AfterViewInit, OnDestroy {
11
13
  private channelService;
12
14
  private channelListToggleService;
13
- /**
14
- * By default, the [default preview component](./ChannelPreviewComponent.mdx) is used. To change the contents of the channel list, [provide your own custom template](./ChannelPreviewComponent.mdx/#customization).
15
- */
16
- customChannelPreviewTemplate: TemplateRef<any> | undefined;
15
+ private customTemplatesService;
17
16
  channels$: Observable<Channel[] | undefined>;
18
17
  isError$: Observable<boolean>;
19
18
  isInitializing$: Observable<boolean>;
20
19
  isLoadingMoreChannels: boolean;
21
20
  isOpen$: Observable<boolean>;
22
21
  hasMoreChannels$: Observable<boolean>;
22
+ customChannelPreviewTemplate: TemplateRef<ChannelPreviewContext> | undefined;
23
+ subscriptions: Subscription[];
23
24
  private container;
24
- constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService);
25
+ constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService, customTemplatesService: CustomTemplatesService);
25
26
  ngAfterViewInit(): void;
27
+ ngOnDestroy(): void;
26
28
  loadMoreChannels(): Promise<void>;
27
29
  trackByChannelId(index: number, item: Channel): string;
28
30
  channelSelected(): void;
31
+ getChannelPreviewContext(channel: Channel): ChannelPreviewContext;
29
32
  static ɵfac: i0.ɵɵFactoryDeclaration<ChannelListComponent, never>;
30
- static ɵcmp: i0.ɵɵComponentDeclaration<ChannelListComponent, "stream-channel-list", never, { "customChannelPreviewTemplate": "customChannelPreviewTemplate"; }, {}, never, never>;
33
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChannelListComponent, "stream-channel-list", never, {}, {}, never, never>;
31
34
  }
@@ -1,6 +1,6 @@
1
1
  import { NgZone } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelSort, Event, UserResponse } from 'stream-chat';
3
+ import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelResponse, ChannelSort, Event, UserResponse } from 'stream-chat';
4
4
  import { ChatClientService, Notification } from './chat-client.service';
5
5
  import { MessageReactionType } from './message-reactions/message-reactions.component';
6
6
  import { AttachmentUpload, StreamMessage } from './types';
@@ -78,7 +78,7 @@ export declare class ChannelService {
78
78
  */
79
79
  usersTypingInThread$: Observable<UserResponse[]>;
80
80
  /**
81
- * Emits a map that contains the date of the latest message sent by the current user by channels (this is used to detect is slow mode countdown should be started)
81
+ * Emits a map that contains the date of the latest message sent by the current user by channels (this is used to detect if slow mode countdown should be started)
82
82
  */
83
83
  latestMessageDateByUserByChannels$: Observable<{
84
84
  [key: string]: Date;
@@ -86,39 +86,39 @@ export declare class ChannelService {
86
86
  /**
87
87
  * 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)
88
88
  */
89
- customNewMessageNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
89
+ customNewMessageNotificationHandler?: (notification: Notification, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void) => void;
90
90
  /**
91
91
  * Custom event handler to call when the user is added to a channel, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
92
92
  */
93
- customAddedToChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
93
+ customAddedToChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void) => void;
94
94
  /**
95
95
  * Custom event handler to call when the user is removed from a channel, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
96
96
  */
97
- customRemovedFromChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
97
+ customRemovedFromChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void) => void;
98
98
  /**
99
99
  * Custom event handler to call when a channel is deleted, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
100
100
  */
101
- customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
101
+ customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
102
102
  /**
103
103
  * Custom event handler to call when a channel is updated, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
104
104
  */
105
- customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
105
+ customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
106
106
  /**
107
107
  * Custom event handler to call when a channel is truncated, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
108
108
  */
109
- customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
109
+ customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
110
110
  /**
111
111
  * Custom event handler to call when a channel becomes hidden, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
112
112
  */
113
- customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
113
+ customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
114
114
  /**
115
115
  * Custom event handler to call when a channel becomes visible, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
116
116
  */
117
- customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
117
+ customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
118
118
  /**
119
119
  * Custom event handler to call if a new message received from a channel that is being watched, provide an event handler if you want to override the [default channel list ordering](./ChannelService.mdx/#channels)
120
120
  */
121
- customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
121
+ customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
122
122
  private channelsSubject;
123
123
  private activeChannelSubject;
124
124
  private activeChannelMessagesSubject;
@@ -241,8 +241,8 @@ export declare class ChannelService {
241
241
  private handleRemovedFromChannelNotification;
242
242
  private handleNewMessageNotification;
243
243
  private handleAddedToChannelNotification;
244
- private addChannelFromNotification;
245
- private removeFromChannelList;
244
+ private addChannelsFromNotification;
245
+ private removeChannelsFromChannelList;
246
246
  private watchForActiveChannelEvents;
247
247
  /**
248
248
  * Call this method if user started typing in the active channel
@@ -1,6 +1,6 @@
1
1
  import { NgZone } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { OwnUserResponse, UserResponse } from 'stream-chat';
3
+ import { Channel, ChannelResponse, OwnUserResponse, UserResponse } from 'stream-chat';
4
4
  import { AppSettings, Event, StreamChat, TokenOrProvider } from 'stream-chat';
5
5
  import { NotificationService } from './notification.service';
6
6
  import * as i0 from "@angular/core";
@@ -33,9 +33,14 @@ export declare class ChatClientService {
33
33
  * Emits the current connection state of the user (`online` or `offline`)
34
34
  */
35
35
  connectionState$: Observable<'offline' | 'online'>;
36
+ /**
37
+ * Emits the list of pending invites of the user. It emits every pending invitation during initialization and then extends the list when a new invite is received. More information can be found in the [channel invitations](../code-examples/channel-invites.mdx) guide.
38
+ */
39
+ pendingInvites$: Observable<(ChannelResponse | Channel)[]>;
36
40
  private notificationSubject;
37
41
  private connectionStateSubject;
38
42
  private appSettingsSubject;
43
+ private pendingInvitesSubject;
39
44
  constructor(ngZone: NgZone, notificationService: NotificationService);
40
45
  /**
41
46
  * Creates a [`StreamChat`](https://github.com/GetStream/stream-chat-js/blob/668b3e5521339f4e14fc657834531b4c8bf8176b/src/client.ts#L124) instance using the provided `apiKey`, and connects a user with the given meta data and token. More info about [connecting users](https://getstream.io/chat/docs/javascript/init_and_users/?language=javascript) can be found in the platform documentation.
@@ -63,6 +68,7 @@ export declare class ChatClientService {
63
68
  * @returns The users matching the search
64
69
  */
65
70
  autocompleteUsers(searchTerm: string): Promise<UserResponse<import("stream-chat").UR>[]>;
71
+ private updatePendingInvites;
66
72
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatClientService, never>;
67
73
  static ɵprov: i0.ɵɵInjectableDeclaration<ChatClientService>;
68
74
  }
@@ -0,0 +1,48 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ import { ChannelActionsContext, ChannelPreviewContext, CommandAutocompleteListItemContext, EmojiPickerContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageContext, MessageInputContext, TypingIndicatorContext } from './types';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * A central location for registering your custom templates to override parts of the chat application
7
+ */
8
+ export declare class CustomTemplatesService {
9
+ /**
10
+ * The autocomplete list item template for mentioning users
11
+ */
12
+ mentionAutocompleteItemTemplate$: BehaviorSubject<TemplateRef<MentionAutcompleteListItemContext> | undefined>;
13
+ /**
14
+ * The autocomplete list item template for commands
15
+ */
16
+ commandAutocompleteItemTemplate$: BehaviorSubject<TemplateRef<CommandAutocompleteListItemContext> | undefined>;
17
+ /**
18
+ * Item in the channel list
19
+ */
20
+ channelPreviewTemplate$: BehaviorSubject<TemplateRef<ChannelPreviewContext> | undefined>;
21
+ /**
22
+ * The message input template used when editing a message
23
+ */
24
+ messageInputTemplate$: BehaviorSubject<TemplateRef<MessageInputContext> | undefined>;
25
+ /**
26
+ * The template used for displaying a mention inside a message
27
+ */
28
+ mentionTemplate$: BehaviorSubject<TemplateRef<MentionTemplateContext> | undefined>;
29
+ /**
30
+ * The template for emoji picker
31
+ */
32
+ emojiPickerTemplate$: BehaviorSubject<TemplateRef<EmojiPickerContext> | undefined>;
33
+ /**
34
+ * The typing indicator template used in the message list
35
+ */
36
+ typingIndicatorTemplate$: BehaviorSubject<TemplateRef<TypingIndicatorContext> | undefined>;
37
+ /**
38
+ * The template used to display a message in the message list
39
+ */
40
+ messageTemplate$: BehaviorSubject<TemplateRef<MessageContext> | undefined>;
41
+ /**
42
+ * The template for channel actions
43
+ */
44
+ channelActionsTemplate$: BehaviorSubject<TemplateRef<ChannelActionsContext> | undefined>;
45
+ constructor();
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService, never>;
47
+ static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService>;
48
+ }
@@ -1,8 +1,9 @@
1
- import { TemplateRef, OnChanges, SimpleChanges } from '@angular/core';
1
+ import { TemplateRef, OnChanges, SimpleChanges, OnDestroy } 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 { DefaultUserType, StreamMessage } from '../types';
5
+ import { DefaultUserType, MentionTemplateContext, StreamMessage } from '../types';
6
+ import { CustomTemplatesService } from '../custom-templates.service';
6
7
  import * as i0 from "@angular/core";
7
8
  declare type MessagePart = {
8
9
  content: string;
@@ -12,17 +13,10 @@ declare type MessagePart = {
12
13
  /**
13
14
  * 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).
14
15
  */
15
- export declare class MessageComponent implements OnChanges {
16
+ export declare class MessageComponent implements OnChanges, OnDestroy {
16
17
  private chatClientService;
17
18
  private channelService;
18
- /**
19
- * 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).
20
- */
21
- messageInputTemplate: TemplateRef<any> | undefined;
22
- /**
23
- * 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).
24
- */
25
- mentionTemplate: TemplateRef<any> | undefined;
19
+ private customTemplatesService;
26
20
  /**
27
21
  * The message to be displayed
28
22
  */
@@ -47,10 +41,13 @@ export declare class MessageComponent implements OnChanges {
47
41
  isPressedOnMobile: boolean;
48
42
  visibleMessageActionsCount: number;
49
43
  messageTextParts: MessagePart[];
44
+ mentionTemplate: TemplateRef<MentionTemplateContext> | undefined;
50
45
  private user;
46
+ private subscriptions;
51
47
  private container;
52
- constructor(chatClientService: ChatClientService, channelService: ChannelService);
48
+ constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService);
53
49
  ngOnChanges(changes: SimpleChanges): void;
50
+ ngOnDestroy(): void;
54
51
  get isSentByCurrentUser(): boolean;
55
52
  get readByText(): string;
56
53
  get lastReadUser(): UserResponse<DefaultUserType<import("../types").DefaultUserTypeInternal>> | undefined;
@@ -69,8 +66,9 @@ export declare class MessageComponent implements OnChanges {
69
66
  resendMessage(): void;
70
67
  textClicked(): void;
71
68
  setAsActiveParentMessage(): void;
69
+ getMentionContext(messagePart: MessagePart): MentionTemplateContext;
72
70
  private createMessageParts;
73
71
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageComponent, never>;
74
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "messageInputTemplate": "messageInputTemplate"; "mentionTemplate": "mentionTemplate"; "message": "message"; "enabledMessageActions": "enabledMessageActions"; "isLastSentMessage": "isLastSentMessage"; "mode": "mode"; }, {}, never, never>;
72
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "message": "message"; "enabledMessageActions": "enabledMessageActions"; "isLastSentMessage": "isLastSentMessage"; "mode": "mode"; }, {}, never, never>;
75
73
  }
76
74
  export {};
@@ -1,20 +1,19 @@
1
- import { EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
1
+ import { EventEmitter, OnChanges, OnDestroy, SimpleChanges, TemplateRef } from '@angular/core';
2
+ import { Subscription } from 'rxjs';
2
3
  import { ChannelService } from '../channel.service';
3
4
  import { ChatClientService } from '../chat-client.service';
5
+ import { CustomTemplatesService } from '../custom-templates.service';
4
6
  import { NotificationService } from '../notification.service';
5
- import { StreamMessage } from '../types';
7
+ import { MessageInputContext, StreamMessage } from '../types';
6
8
  import * as i0 from "@angular/core";
7
9
  /**
8
10
  * The `MessageActionsBox` component displays a list of message actions (i.e edit), that can be opened or closed. You can find the [list of the supported actions](../concepts/message-interactions.mdx) in the message interaction guide.
9
11
  */
10
- export declare class MessageActionsBoxComponent implements OnChanges {
12
+ export declare class MessageActionsBoxComponent implements OnChanges, OnDestroy {
11
13
  private chatClientService;
12
14
  private notificationService;
13
15
  private channelService;
14
- /**
15
- * 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).
16
- */
17
- messageInputTemplate: TemplateRef<any> | undefined;
16
+ private customTemplatesService;
18
17
  /**
19
18
  * Indicates if the list should be opened or closed. Adding a UI element to open and close the list is the parent's component responsibility.
20
19
  */
@@ -40,9 +39,12 @@ export declare class MessageActionsBoxComponent implements OnChanges {
40
39
  */
41
40
  readonly isEditing: EventEmitter<boolean>;
42
41
  isEditModalOpen: boolean;
42
+ messageInputTemplate: TemplateRef<MessageInputContext> | undefined;
43
+ subscriptions: Subscription[];
43
44
  private messageInput;
44
- constructor(chatClientService: ChatClientService, notificationService: NotificationService, channelService: ChannelService);
45
+ constructor(chatClientService: ChatClientService, notificationService: NotificationService, channelService: ChannelService, customTemplatesService: CustomTemplatesService);
45
46
  ngOnChanges(changes: SimpleChanges): void;
47
+ ngOnDestroy(): void;
46
48
  get isQuoteVisible(): boolean;
47
49
  get isEditVisible(): boolean;
48
50
  get isDeleteVisible(): boolean;
@@ -56,7 +58,8 @@ export declare class MessageActionsBoxComponent implements OnChanges {
56
58
  editClicked(): void;
57
59
  sendClicked(): void;
58
60
  modalClosed: () => void;
61
+ getMessageInputContext(): MessageInputContext;
59
62
  deleteClicked(): Promise<void>;
60
63
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageActionsBoxComponent, never>;
61
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageActionsBoxComponent, "stream-message-actions-box", never, { "messageInputTemplate": "messageInputTemplate"; "isOpen": "isOpen"; "isMine": "isMine"; "message": "message"; "enabledActions": "enabledActions"; }, { "displayedActionsCount": "displayedActionsCount"; "isEditing": "isEditing"; }, never, never>;
64
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageActionsBoxComponent, "stream-message-actions-box", never, { "isOpen": "isOpen"; "isMine": "isMine"; "message": "message"; "enabledActions": "enabledActions"; }, { "displayedActionsCount": "displayedActionsCount"; "isEditing": "isEditing"; }, never, never>;
62
65
  }
@@ -7,6 +7,7 @@ import { TextareaInterface } from '../textarea.interface';
7
7
  import { ChatClientService } from '../../chat-client.service';
8
8
  import { TransliterationService } from '../../transliteration.service';
9
9
  import { EmojiInputService } from '../emoji-input.service';
10
+ import { CustomTemplatesService } from '../../custom-templates.service';
10
11
  import * as i0 from "@angular/core";
11
12
  /**
12
13
  * The `AutocompleteTextarea` component is used by the [`MessageInput`](./MessageInputComponent.mdx) component to display the input HTML element where users can type their message.
@@ -16,6 +17,7 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
16
17
  private chatClientService;
17
18
  private transliterationService;
18
19
  private emojiInputService;
20
+ private customTemplatesService;
19
21
  class: string;
20
22
  /**
21
23
  * The value of the input HTML element.
@@ -25,14 +27,6 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
25
27
  * If true, users can mention other users in messages. You can also set this input on the [`MessageInput`](./MessageInputComponent.mdx/#inputs-and-outputs) component.
26
28
  */
27
29
  areMentionsEnabled: boolean | undefined;
28
- /**
29
- * You can provide your own template for the autocomplete list for user mentions. You can also set this input on the [`MessageInput`](./MessageInputComponent.mdx/#inputs-and-outputs) component.
30
- */
31
- mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
32
- /**
33
- * You can provide your own template for the autocomplete list for commands. You can also set this input on the [`MessageInput`](./MessageInputComponent.mdx/#inputs-and-outputs) component.
34
- */
35
- commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
36
30
  /**
37
31
  * The scope for user mentions, either members of the current channel of members of the application. You can also set this input on the [`MessageInput`](./MessageInputComponent.mdx/#inputs-and-outputs) component.
38
32
  */
@@ -49,6 +43,8 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
49
43
  * Emits the array of users that are mentioned in the message, it is updated when a user mentions a new user or deletes a mention.
50
44
  */
51
45
  readonly userMentions: EventEmitter<UserResponse<import("stream-chat").UR>[]>;
46
+ mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
47
+ commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
52
48
  private readonly autocompleteKey;
53
49
  private readonly mentionTriggerChar;
54
50
  private readonly commandTriggerChar;
@@ -59,7 +55,7 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
59
55
  private userMentionConfig;
60
56
  private slashCommandConfig;
61
57
  private searchTerm$;
62
- constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService, emojiInputService: EmojiInputService);
58
+ constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService, emojiInputService: EmojiInputService, customTemplatesService: CustomTemplatesService);
63
59
  ngOnChanges(changes: SimpleChanges): void;
64
60
  filter(searchString: string, items: {
65
61
  autocompleteLabel: string;
@@ -75,5 +71,5 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
75
71
  private updateMentionOptions;
76
72
  private updateMentionedUsersFromText;
77
73
  static ɵfac: i0.ɵɵFactoryDeclaration<AutocompleteTextareaComponent, never>;
78
- 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>;
74
+ static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteTextareaComponent, "stream-autocomplete-textarea", never, { "value": "value"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never, never>;
79
75
  }
@@ -1,5 +1,3 @@
1
- import { TemplateRef } from '@angular/core';
2
- import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
3
1
  import * as i0 from "@angular/core";
4
2
  /**
5
3
  * The `MessageInputConfigService` is used to keep a consistent configuration among the different [`MessageInput`](../components/MessageInputComponent.mdx) components if your UI has more than one input component.
@@ -13,18 +11,6 @@ export declare class MessageInputConfigService {
13
11
  * If true, users can mention other users in messages. You also [need to use the `AutocompleteTextarea`](../concepts/opt-in-architecture.mdx) for this feature to work.
14
12
  */
15
13
  areMentionsEnabled: boolean | undefined;
16
- /**
17
- * 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.
18
- */
19
- mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
20
- /**
21
- * 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.
22
- */
23
- commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
24
- /**
25
- * You can add an emoji picker by [providing your own emoji picker template](../code-examples/emoji-picker.mdx)
26
- */
27
- emojiPickerTemplate: TemplateRef<void> | undefined;
28
14
  /**
29
15
  * If `false`, users can only upload one attachment per message
30
16
  */
@@ -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 { 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,18 +37,6 @@ 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
  */
@@ -74,6 +64,7 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
74
64
  typingStart$: Subject<void>;
75
65
  cooldown$: Observable<number> | undefined;
76
66
  isCooldownInProgress: boolean;
67
+ emojiPickerTemplate: TemplateRef<EmojiPickerContext> | undefined;
77
68
  private fileInput;
78
69
  private textareaAnchor;
79
70
  private subscriptions;
@@ -81,7 +72,8 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
81
72
  private isViewInited;
82
73
  private appSettings;
83
74
  private channel;
84
- constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService, emojiInputService: EmojiInputService);
75
+ constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService, emojiInputService: EmojiInputService, customTemplatesService: CustomTemplatesService);
76
+ ngOnInit(): void;
85
77
  ngAfterViewInit(): void;
86
78
  ngOnChanges(changes: SimpleChanges): void;
87
79
  ngOnDestroy(): void;
@@ -91,6 +83,7 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
91
83
  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";
92
84
  filesSelected(fileList: FileList | null): Promise<void>;
93
85
  deselectMessageToQuote(): void;
86
+ getEmojiPickerContext(): EmojiPickerContext;
94
87
  private clearFileInput;
95
88
  private get isUpdate();
96
89
  private initTextarea;
@@ -100,5 +93,5 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
100
93
  private startCooldown;
101
94
  private stopCooldown;
102
95
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, never>;
103
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "commandAutocompleteItemTemplate": "commandAutocompleteItemTemplate"; "emojiPickerTemplate": "emojiPickerTemplate"; "mode": "mode"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; }, { "messageUpdate": "messageUpdate"; }, never, never>;
96
+ 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>;
104
97
  }
@@ -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
  }