stream-chat-angular 2.12.1 → 2.13.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.
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +355 -54
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/attachment.service.js +29 -1
- package/esm2015/lib/channel-list/channel-list-toggle.service.js +20 -1
- package/esm2015/lib/channel.service.js +83 -2
- package/esm2015/lib/chat-client.service.js +25 -1
- package/esm2015/lib/message/message.component.js +5 -1
- package/esm2015/lib/message-actions-box/message-actions-box.component.js +1 -1
- package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +21 -9
- package/esm2015/lib/message-input/emoji-input.service.js +23 -0
- package/esm2015/lib/message-input/message-input-config.service.js +16 -1
- package/esm2015/lib/message-input/message-input.component.js +22 -13
- package/esm2015/lib/message-input/textarea/textarea.component.js +22 -6
- package/esm2015/lib/message-list/image-load.service.js +7 -1
- package/esm2015/lib/message-reactions/message-reactions.component.js +2 -2
- package/esm2015/lib/notification.service.js +19 -1
- package/esm2015/lib/stream-i18n.service.js +9 -1
- package/esm2015/lib/theme.service.js +37 -3
- package/esm2015/lib/transliteration.service.js +9 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/stream-chat-angular.js +337 -39
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/attachment.service.d.ts +34 -0
- package/lib/channel-list/channel-list-toggle.service.d.ts +22 -0
- package/lib/channel.service.d.ts +156 -0
- package/lib/chat-client.service.d.ts +39 -0
- package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +3 -1
- package/lib/message-input/emoji-input.service.d.ts +14 -0
- package/lib/message-input/message-input-config.service.d.ts +27 -1
- package/lib/message-input/message-input.component.d.ts +5 -2
- package/lib/message-input/textarea/textarea.component.d.ts +7 -3
- package/lib/message-list/image-load.service.d.ts +6 -0
- package/lib/notification.service.d.ts +21 -0
- package/lib/stream-i18n.service.d.ts +8 -0
- package/lib/theme.service.d.ts +23 -0
- package/lib/transliteration.service.d.ts +8 -0
- package/package.json +3 -2
- package/public-api.d.ts +1 -0
- package/src/assets/version.ts +1 -1
|
@@ -4,19 +4,53 @@ import { ChannelService } from './channel.service';
|
|
|
4
4
|
import { NotificationService } from './notification.service';
|
|
5
5
|
import { AttachmentUpload } from './types';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* The `AttachmentService` manages the uploads of a message input.
|
|
9
|
+
*/
|
|
7
10
|
export declare class AttachmentService {
|
|
8
11
|
private channelService;
|
|
9
12
|
private notificationService;
|
|
13
|
+
/**
|
|
14
|
+
* Emits the number of uploads in progress.
|
|
15
|
+
*/
|
|
10
16
|
attachmentUploadInProgressCounter$: Observable<number>;
|
|
17
|
+
/**
|
|
18
|
+
* Emits the state of the uploads ([`AttachmentUpload[]`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts)), it adds a state (`success`, `error` or `uploading`) to each file the user selects for upload. It is used by the [`AttachmentPreviewList`](../components/attachment-preview-list.mdx) to display the attachment previews.
|
|
19
|
+
*/
|
|
11
20
|
attachmentUploads$: Observable<AttachmentUpload[]>;
|
|
12
21
|
private attachmentUploadInProgressCounterSubject;
|
|
13
22
|
private attachmentUploadsSubject;
|
|
14
23
|
constructor(channelService: ChannelService, notificationService: NotificationService);
|
|
24
|
+
/**
|
|
25
|
+
* Resets the attachments uploads (for example after the message with the attachments sent successfully)
|
|
26
|
+
*/
|
|
15
27
|
resetAttachmentUploads(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Uploads the selected files, and creates preview for image files. The result is propagated throught the `attachmentUploads$` stream.
|
|
30
|
+
* @param fileList The files selected by the user
|
|
31
|
+
* @returns A promise with the result
|
|
32
|
+
*/
|
|
16
33
|
filesSelected(fileList: FileList | null): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Retries to upload an attachment.
|
|
36
|
+
* @param file
|
|
37
|
+
* @returns A promise with the result
|
|
38
|
+
*/
|
|
17
39
|
retryAttachmentUpload(file: File): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Deletes an attachment, the attachment can have any state (`error`, `uploading` or `success`).
|
|
42
|
+
* @param upload
|
|
43
|
+
*/
|
|
18
44
|
deleteAttachment(upload: AttachmentUpload): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Maps the current uploads to a format that can be sent along with the message to the Stream API.
|
|
47
|
+
* @returns the attachments
|
|
48
|
+
*/
|
|
19
49
|
mapToAttachments(): Attachment<import("stream-chat").UR>[];
|
|
50
|
+
/**
|
|
51
|
+
* Maps attachments received from the Stream API to uploads. This is useful when editing a message.
|
|
52
|
+
* @param attachments Attachemnts received with the message
|
|
53
|
+
*/
|
|
20
54
|
createFromAttachments(attachments: Attachment[]): void;
|
|
21
55
|
private createPreview;
|
|
22
56
|
private uploadAttachments;
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* The `ChannelListToggleService` can be used to toggle the channel list.
|
|
5
|
+
*/
|
|
3
6
|
export declare class ChannelListToggleService {
|
|
7
|
+
/**
|
|
8
|
+
* Emits `true` if the channel list is in open state, otherwise it emits `false`
|
|
9
|
+
*/
|
|
4
10
|
isOpen$: Observable<boolean>;
|
|
5
11
|
private isOpenSubject;
|
|
6
12
|
private menuElement;
|
|
7
13
|
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Opens the channel list.
|
|
16
|
+
*/
|
|
8
17
|
open(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Closes the channel list.
|
|
20
|
+
*/
|
|
9
21
|
close(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Opens the channel list if it was closed, and closes if it was opened.
|
|
24
|
+
*/
|
|
10
25
|
toggle(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the channel list element, on mobile screen size if the user opens the channel list, and clicks outside, the service automatically closes the channel list if a reference to the HTML element is provided.
|
|
28
|
+
* @param element
|
|
29
|
+
*/
|
|
11
30
|
setMenuElement(element: HTMLElement | undefined): void;
|
|
31
|
+
/**
|
|
32
|
+
* This method should be called if a channel was selected, if on mobile, the channel list will be closed.
|
|
33
|
+
*/
|
|
12
34
|
channelSelected(): void;
|
|
13
35
|
private watchForOutsideClicks;
|
|
14
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelListToggleService, never>;
|
package/lib/channel.service.d.ts
CHANGED
|
@@ -5,25 +5,102 @@ import { ChatClientService, Notification } from './chat-client.service';
|
|
|
5
5
|
import { MessageReactionType } from './message-reactions/message-reactions.component';
|
|
6
6
|
import { AttachmentUpload, StreamMessage } from './types';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* The `ChannelService` provides data and interaction for the channel list and message list. TEST
|
|
10
|
+
*/
|
|
8
11
|
export declare class ChannelService {
|
|
9
12
|
private chatClientService;
|
|
10
13
|
private ngZone;
|
|
14
|
+
/**
|
|
15
|
+
* Emits `false` if there are no more pages of channels that can be loaded.
|
|
16
|
+
*/
|
|
11
17
|
hasMoreChannels$: Observable<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Emits the currently loaded and [watched](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript) channel list.
|
|
20
|
+
*
|
|
21
|
+
* :::important
|
|
22
|
+
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](../concepts/change-detection.mdx) explains this in detail.
|
|
23
|
+
* :::
|
|
24
|
+
*
|
|
25
|
+
* Apart from pagination, the channel list is also updated on the following events:
|
|
26
|
+
*
|
|
27
|
+
* | Event type | Default behavior | Custom handler to override |
|
|
28
|
+
* | ----------------------------------- | ------------------------------------------------------------------ | --------------------------------------------- |
|
|
29
|
+
* | `channel.deleted` | Remove channel from the list | `customChannelDeletedHandler` |
|
|
30
|
+
* | `channel.hidden` | Remove channel from the list | `customChannelHiddenHandler` |
|
|
31
|
+
* | `channel.truncated` | Updates the channel | `customChannelTruncatedHandler` |
|
|
32
|
+
* | `channel.updated` | Updates the channel | `customChannelUpdatedHandler` |
|
|
33
|
+
* | `channel.visible` | Adds the channel to the list | `customChannelVisibleHandler` |
|
|
34
|
+
* | `message.new` | Moves the channel to top of the list | `customNewMessageHandler` |
|
|
35
|
+
* | `notification.added_to_channel` | Adds the new channel to the top of the list and starts watching it | `customAddedToChannelNotificationHandler` |
|
|
36
|
+
* | `notification.message_new` | Adds the new channel to the top of the list and starts watching it | `customNewMessageNotificationHandler` |
|
|
37
|
+
* | `notification.removed_from_channel` | Removes the channel from the list | `customRemovedFromChannelNotificationHandler` |
|
|
38
|
+
*
|
|
39
|
+
* It's important to note that filters don't apply to updates to the list from events.
|
|
40
|
+
*
|
|
41
|
+
* Our platform documentation covers the topic of [channel events](https://getstream.io/chat/docs/javascript/event_object/?language=javascript#events) in depth.
|
|
42
|
+
*/
|
|
12
43
|
channels$: Observable<Channel[] | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Emits the currently active channel.
|
|
46
|
+
*
|
|
47
|
+
* :::important
|
|
48
|
+
* If you want to subscribe to channel events, you need to manually reenter Angular's change detection zone, our [Change detection guide](../concepts/change-detection.mdx) explains this in detail.
|
|
49
|
+
* :::
|
|
50
|
+
*/
|
|
13
51
|
activeChannel$: Observable<Channel | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Emits the list of currently loaded messages of the active channel.
|
|
54
|
+
*/
|
|
14
55
|
activeChannelMessages$: Observable<StreamMessage[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Emits the id of the currently selected parent message. If no message is selected, it emits undefined.
|
|
58
|
+
*/
|
|
15
59
|
activeParentMessageId$: Observable<string | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Emits the list of currently loaded thread replies belonging to the selected parent message. If there is no currently active thread it emits an empty array.
|
|
62
|
+
*/
|
|
16
63
|
activeThreadMessages$: Observable<StreamMessage[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Emits the currently selected parent message. If no message is selected, it emits undefined.
|
|
66
|
+
*/
|
|
17
67
|
activeParentMessage$: Observable<StreamMessage | undefined>;
|
|
18
68
|
messageToQuote$: Observable<StreamMessage | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* 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)
|
|
71
|
+
*/
|
|
19
72
|
customNewMessageNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
|
|
73
|
+
/**
|
|
74
|
+
* 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)
|
|
75
|
+
*/
|
|
20
76
|
customAddedToChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
|
|
77
|
+
/**
|
|
78
|
+
* 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)
|
|
79
|
+
*/
|
|
21
80
|
customRemovedFromChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
|
|
81
|
+
/**
|
|
82
|
+
* 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)
|
|
83
|
+
*/
|
|
22
84
|
customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
85
|
+
/**
|
|
86
|
+
* 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)
|
|
87
|
+
*/
|
|
23
88
|
customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
89
|
+
/**
|
|
90
|
+
* 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)
|
|
91
|
+
*/
|
|
24
92
|
customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
93
|
+
/**
|
|
94
|
+
* 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)
|
|
95
|
+
*/
|
|
25
96
|
customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
97
|
+
/**
|
|
98
|
+
* 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)
|
|
99
|
+
*/
|
|
26
100
|
customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
101
|
+
/**
|
|
102
|
+
* 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)
|
|
103
|
+
*/
|
|
27
104
|
customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
28
105
|
private channelsSubject;
|
|
29
106
|
private activeChannelSubject;
|
|
@@ -42,23 +119,102 @@ export declare class ChannelService {
|
|
|
42
119
|
private threadListSetter;
|
|
43
120
|
private parentMessageSetter;
|
|
44
121
|
constructor(chatClientService: ChatClientService, ngZone: NgZone);
|
|
122
|
+
/**
|
|
123
|
+
* Sets the given `channel` as active.
|
|
124
|
+
* @param channel
|
|
125
|
+
*/
|
|
45
126
|
setAsActiveChannel(channel: Channel): void;
|
|
127
|
+
/**
|
|
128
|
+
* Sets the given `message` as an active parent message. If `undefined` is provided, it will deleselect the current parent message.
|
|
129
|
+
* @param message
|
|
130
|
+
*/
|
|
46
131
|
setAsActiveParentMessage(message: StreamMessage | undefined): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Loads the next page of messages of the active channel. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
|
|
134
|
+
*/
|
|
47
135
|
loadMoreMessages(): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Loads the next page of messages of the active thread. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
|
|
138
|
+
*/
|
|
48
139
|
loadMoreThreadReplies(): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Queries the channels with the given filters, sorts and options. More info about [channel querying](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript) can be found in the platform documentation.
|
|
142
|
+
* @param filters
|
|
143
|
+
* @param sort
|
|
144
|
+
* @param options
|
|
145
|
+
*/
|
|
49
146
|
init(filters: ChannelFilters, sort?: ChannelSort, options?: ChannelOptions): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./chat-client.mdx/#disconnectuser).
|
|
149
|
+
*/
|
|
50
150
|
reset(): void;
|
|
151
|
+
/**
|
|
152
|
+
* Loads the next page of channels. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
|
|
153
|
+
*/
|
|
51
154
|
loadMoreChannels(): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Adds a reaction to a message.
|
|
157
|
+
* @param messageId The id of the message to add the reaction to
|
|
158
|
+
* @param reactionType The type of the reaction
|
|
159
|
+
*/
|
|
52
160
|
addReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Removes a reaction from a message.
|
|
163
|
+
* @param messageId The id of the message to remove the reaction from
|
|
164
|
+
* @param reactionType Thr type of reaction to remove
|
|
165
|
+
*/
|
|
53
166
|
removeReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Sends a message to the active channel. The message is immediately added to the message list, if an error occurs and the message can't be sent, the error is indicated in `state` of the message.
|
|
169
|
+
* @param text The text of the message
|
|
170
|
+
* @param attachments The attachments
|
|
171
|
+
* @param mentionedUsers Mentioned users
|
|
172
|
+
* @param parentId Id of the parent message (if sending a thread reply)
|
|
173
|
+
* @param quotedMessageId Id of the message to quote (if sending a quote reply)
|
|
174
|
+
*/
|
|
54
175
|
sendMessage(text: string, attachments?: Attachment[], mentionedUsers?: UserResponse[], parentId?: string | undefined, quotedMessageId?: string | undefined): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Resends the given message to the active channel
|
|
178
|
+
* @param message The message to resend
|
|
179
|
+
*/
|
|
55
180
|
resendMessage(message: StreamMessage): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Updates the message in the active channel
|
|
183
|
+
* @param message Mesage to be updated
|
|
184
|
+
*/
|
|
56
185
|
updateMessage(message: StreamMessage): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Deletes the message from the active channel
|
|
188
|
+
* @param message Message to be deleted
|
|
189
|
+
*/
|
|
57
190
|
deleteMessage(message: StreamMessage): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* Uploads files to the channel. If you want to know more about [file uploads](https://getstream.io/chat/docs/javascript/file_uploads/?language=javascript) check out the platform documentation.
|
|
193
|
+
* @param uploads the attachments to upload (output of the [`AttachmentService`](./AttachmentService.mdx))
|
|
194
|
+
* @returns the result of file upload requests
|
|
195
|
+
*/
|
|
58
196
|
uploadAttachments(uploads: AttachmentUpload[]): Promise<AttachmentUpload[]>;
|
|
197
|
+
/**
|
|
198
|
+
* Deletes an uploaded file by URL. If you want to know more about [file uploads](https://getstream.io/chat/docs/javascript/file_uploads/?language=javascript) check out the platform documentation
|
|
199
|
+
* @param attachmentUpload Attachment to be deleted (output of the [`AttachmentService`](./AttachmentService.mdx))
|
|
200
|
+
*/
|
|
59
201
|
deleteAttachment(attachmentUpload: AttachmentUpload): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Returns the autocomplete options for current channel members. If the channel has less than 100 members, it returns the channel members, otherwise sends a [search request](https://getstream.io/chat/docs/javascript/query_members/?language=javascript#pagination-and-ordering) with the given search term.
|
|
204
|
+
* @param searchTerm Text to search for in the names of members
|
|
205
|
+
* @returns The list of members matching the search filter
|
|
206
|
+
*/
|
|
60
207
|
autocompleteMembers(searchTerm: string): Promise<import("stream-chat").ChannelMemberResponse<import("stream-chat").UR>[]>;
|
|
208
|
+
/**
|
|
209
|
+
* [Runs a message action](https://getstream.io/chat/docs/rest/#messages-runmessageaction) in the current channel. Updates the message list based on the action result (if no message is returned, the message will be removed from the message list).
|
|
210
|
+
* @param messageId
|
|
211
|
+
* @param formData
|
|
212
|
+
*/
|
|
61
213
|
sendAction(messageId: string, formData: Record<string, string>): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Selects or deselects the current message to quote reply to
|
|
216
|
+
* @param message The message to select, if called with `undefined`, it deselects the message
|
|
217
|
+
*/
|
|
62
218
|
selectMessageToQuote(message: StreamMessage | undefined): void;
|
|
63
219
|
private sendMessageRequest;
|
|
64
220
|
private handleNotification;
|
|
@@ -8,21 +8,60 @@ export declare type Notification = {
|
|
|
8
8
|
eventType: string;
|
|
9
9
|
event: Event;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* The `ChatClient` service connects the user to the Stream chat.
|
|
13
|
+
*/
|
|
11
14
|
export declare class ChatClientService {
|
|
12
15
|
private ngZone;
|
|
13
16
|
private notificationService;
|
|
17
|
+
/**
|
|
18
|
+
* The [StreamChat client](https://github.com/GetStream/stream-chat-js/blob/master/src/client.ts) instance. In general you shouldn't need to access the client, but it's there if you want to use it.
|
|
19
|
+
*/
|
|
14
20
|
chatClient: StreamChat;
|
|
21
|
+
/**
|
|
22
|
+
* Emits [`Notification`](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/chat-client.service.ts) events. The platform documentation covers [the list of client and notification events](https://getstream.io/chat/docs/javascript/event_object/?language=javascript).
|
|
23
|
+
* :::important
|
|
24
|
+
* For performance reasons this Observable operates outside of the Angular change detection zone. If you subscribe to it, you need to manually reenter Angular's change detection zone, our [Change detection guide](../concepts/change-detection.mdx) explains this in detail.
|
|
25
|
+
* :::
|
|
26
|
+
*/
|
|
15
27
|
notification$: Observable<Notification>;
|
|
28
|
+
/**
|
|
29
|
+
* Emits the current [application settings](https://getstream.io/chat/docs/javascript/app_setting_overview/?language=javascript). Since getting the application settings is an expensive API call and we don't always need the result, this is not initialized by default, you need to call `getApplicationSettings` to load them.
|
|
30
|
+
*/
|
|
16
31
|
appSettings$: Observable<AppSettings | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Emits the current connection state of the user (`online` or `offline`)
|
|
34
|
+
*/
|
|
17
35
|
connectionState$: Observable<'offline' | 'online'>;
|
|
18
36
|
private notificationSubject;
|
|
19
37
|
private connectionStateSubject;
|
|
20
38
|
private appSettingsSubject;
|
|
21
39
|
constructor(ngZone: NgZone, notificationService: NotificationService);
|
|
40
|
+
/**
|
|
41
|
+
* 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.
|
|
42
|
+
* @param apiKey
|
|
43
|
+
* @param userOrId
|
|
44
|
+
* @param userTokenOrProvider
|
|
45
|
+
*/
|
|
22
46
|
init(apiKey: string, userOrId: string | OwnUserResponse | UserResponse, userTokenOrProvider: TokenOrProvider): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Disconnects the current user, and closes the WebSocket connection. Useful when disconnecting a chat user, use in combination with [`reset`](./ChannelService.mdx/#reset).
|
|
49
|
+
*/
|
|
23
50
|
disconnectUser(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Loads the current [application settings](https://getstream.io/chat/docs/javascript/app_setting_overview/?language=javascript), if the application settings have already been loaded, it does nothing.
|
|
53
|
+
*/
|
|
24
54
|
getAppSettings(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Flag the message with the given ID. If you want to know [more about flags](https://getstream.io/chat/docs/javascript/moderation/?language=javascript) check out the platform documentation.
|
|
57
|
+
* @param messageId
|
|
58
|
+
*/
|
|
25
59
|
flagMessage(messageId: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Searches for users in the application that have ID or name matching the provided search term
|
|
62
|
+
* @param searchTerm
|
|
63
|
+
* @returns The users matching the search
|
|
64
|
+
*/
|
|
26
65
|
autocompleteUsers(searchTerm: string): Promise<UserResponse<import("stream-chat").UR>[]>;
|
|
27
66
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChatClientService, never>;
|
|
28
67
|
static ɵprov: i0.ɵɵInjectableDeclaration<ChatClientService>;
|
|
@@ -6,11 +6,13 @@ import { ChannelService } from '../../channel.service';
|
|
|
6
6
|
import { TextareaInterface } from '../textarea.interface';
|
|
7
7
|
import { ChatClientService } from '../../chat-client.service';
|
|
8
8
|
import { TransliterationService } from '../../transliteration.service';
|
|
9
|
+
import { EmojiInputService } from '../emoji-input.service';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
export declare class AutocompleteTextareaComponent implements TextareaInterface, OnChanges {
|
|
11
12
|
private channelService;
|
|
12
13
|
private chatClientService;
|
|
13
14
|
private transliterationService;
|
|
15
|
+
private emojiInputService;
|
|
14
16
|
class: string;
|
|
15
17
|
value: string;
|
|
16
18
|
areMentionsEnabled: boolean | undefined;
|
|
@@ -30,7 +32,7 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
|
|
|
30
32
|
private userMentionConfig;
|
|
31
33
|
private slashCommandConfig;
|
|
32
34
|
private searchTerm$;
|
|
33
|
-
constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService);
|
|
35
|
+
constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService, emojiInputService: EmojiInputService);
|
|
34
36
|
ngOnChanges(changes: SimpleChanges): void;
|
|
35
37
|
filter(searchString: string, items: {
|
|
36
38
|
autocompleteLabel: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class EmojiInputService {
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
emojiInput$: Subject<string>;
|
|
11
|
+
constructor();
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmojiInputService, never>;
|
|
13
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EmojiInputService>;
|
|
14
|
+
}
|
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
import { TemplateRef } from '@angular/core';
|
|
2
2
|
import { CommandAutocompleteListItemContext, MentionAutcompleteListItemContext } from '../types';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* The `MessageInputConfigService` is used to keep a consistent configuration among the different [`MessageInput`](../components/message-input.mdx) components if your UI has more than one input component.
|
|
6
|
+
*/
|
|
4
7
|
export declare class MessageInputConfigService {
|
|
8
|
+
/**
|
|
9
|
+
* 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).
|
|
10
|
+
*/
|
|
5
11
|
isFileUploadEnabled: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* 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
|
+
*/
|
|
6
15
|
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
|
+
*/
|
|
7
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
|
+
*/
|
|
8
23
|
commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
|
|
9
24
|
/**
|
|
10
|
-
*
|
|
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
|
+
/**
|
|
29
|
+
* 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.
|
|
30
|
+
* @deprecated use [application settings](https://getstream.io/chat/docs/javascript/app_setting_overview/?language=javascript#file-uploads) instead
|
|
11
31
|
*/
|
|
12
32
|
acceptedFileTypes: string[] | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* If `false`, users can only upload one attachment per message
|
|
35
|
+
*/
|
|
13
36
|
isMultipleFileUploadEnabled: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The scope for user mentions, either members of the current channel of members of the application
|
|
39
|
+
*/
|
|
14
40
|
mentionScope: 'channel' | 'application' | undefined;
|
|
15
41
|
constructor();
|
|
16
42
|
static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputConfigService, never>;
|
|
@@ -8,6 +8,7 @@ import { NotificationService } from '../notification.service';
|
|
|
8
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
|
+
import { EmojiInputService } from './emoji-input.service';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
export declare class MessageInputComponent implements OnChanges, OnDestroy, AfterViewInit {
|
|
13
14
|
private channelService;
|
|
@@ -18,11 +19,13 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
|
|
|
18
19
|
private componentFactoryResolver;
|
|
19
20
|
private cdRef;
|
|
20
21
|
private chatClient;
|
|
22
|
+
emojiInputService: EmojiInputService;
|
|
21
23
|
isFileUploadEnabled: boolean | undefined;
|
|
22
24
|
areMentionsEnabled: boolean | undefined;
|
|
23
25
|
mentionScope: 'channel' | 'application' | undefined;
|
|
24
26
|
mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
|
|
25
27
|
commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
|
|
28
|
+
emojiPickerTemplate: TemplateRef<void> | undefined;
|
|
26
29
|
mode: 'thread' | 'main';
|
|
27
30
|
/**
|
|
28
31
|
* @deprecated https://getstream.io/chat/docs/sdk/angular/components/message-input/#caution-acceptedfiletypes
|
|
@@ -46,7 +49,7 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
|
|
|
46
49
|
private isViewInited;
|
|
47
50
|
private appSettings;
|
|
48
51
|
private channel;
|
|
49
|
-
constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService);
|
|
52
|
+
constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, chatClient: ChatClientService, emojiInputService: EmojiInputService);
|
|
50
53
|
ngAfterViewInit(): void;
|
|
51
54
|
ngOnChanges(changes: SimpleChanges): void;
|
|
52
55
|
ngOnDestroy(): void;
|
|
@@ -62,5 +65,5 @@ export declare class MessageInputComponent implements OnChanges, OnDestroy, Afte
|
|
|
62
65
|
private areAttachemntsValid;
|
|
63
66
|
private setCanSendMessages;
|
|
64
67
|
static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, 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>;
|
|
68
|
+
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>;
|
|
66
69
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { EventEmitter, OnChanges } from '@angular/core';
|
|
1
|
+
import { EventEmitter, OnChanges, OnDestroy } from '@angular/core';
|
|
2
|
+
import { EmojiInputService } from '../emoji-input.service';
|
|
2
3
|
import { TextareaInterface } from '../textarea.interface';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class TextareaComponent implements TextareaInterface, OnChanges {
|
|
5
|
+
export declare class TextareaComponent implements TextareaInterface, OnChanges, OnDestroy {
|
|
6
|
+
private emojiInputService;
|
|
5
7
|
class: string;
|
|
6
8
|
value: string;
|
|
7
9
|
readonly valueChange: EventEmitter<string>;
|
|
8
10
|
readonly send: EventEmitter<void>;
|
|
9
11
|
private messageInput;
|
|
10
|
-
|
|
12
|
+
private subscriptions;
|
|
13
|
+
constructor(emojiInputService: EmojiInputService);
|
|
11
14
|
ngOnChanges(): void;
|
|
15
|
+
ngOnDestroy(): void;
|
|
12
16
|
inputChanged(): void;
|
|
13
17
|
sent(event: Event): void;
|
|
14
18
|
static ɵfac: i0.ɵɵFactoryDeclaration<TextareaComponent, never>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Subject } from 'rxjs';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* The `ImageLoadService` is used to position the scrollbar in the message list
|
|
5
|
+
*/
|
|
3
6
|
export declare class ImageLoadService {
|
|
7
|
+
/**
|
|
8
|
+
* A subject that can be used to notify the message list if an image attachment finished loading
|
|
9
|
+
*/
|
|
4
10
|
imageLoad$: Subject<void>;
|
|
5
11
|
constructor();
|
|
6
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<ImageLoadService, never>;
|
|
@@ -6,11 +6,32 @@ export declare type NotificationPayload = {
|
|
|
6
6
|
text: string;
|
|
7
7
|
translateParams?: Object;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/notifications.mdx) component displays the currently active notifications.
|
|
11
|
+
*/
|
|
9
12
|
export declare class NotificationService {
|
|
13
|
+
/**
|
|
14
|
+
* Emits the currently active [notifications](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/notification.service.ts).
|
|
15
|
+
*/
|
|
10
16
|
notifications$: Observable<NotificationPayload[]>;
|
|
11
17
|
private notificationsSubject;
|
|
12
18
|
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Displays a notification for the given amount of time.
|
|
21
|
+
* @param text The text of the notification
|
|
22
|
+
* @param type The type of the notification
|
|
23
|
+
* @param timeout The number of milliseconds while the notification should be visible
|
|
24
|
+
* @param translateParams Translation parameters for the `text`
|
|
25
|
+
* @returns A method to clear the notification (before the timeout).
|
|
26
|
+
*/
|
|
13
27
|
addTemporaryNotification(text: string, type?: NotificationType, timeout?: number, translateParams?: Object): () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Displays a notification, that will be visible until it's removed.
|
|
30
|
+
* @param text The text of the notification
|
|
31
|
+
* @param type The type of the notification
|
|
32
|
+
* @param translateParams Translation parameters for the `text`
|
|
33
|
+
* @returns A method to clear the notification.
|
|
34
|
+
*/
|
|
14
35
|
addPermanentNotification(text: string, type?: NotificationType, translateParams?: Object): () => void;
|
|
15
36
|
private addNotification;
|
|
16
37
|
private removeNotification;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { TranslateService } from '@ngx-translate/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* The `StreamI18nService` can be used to customize the labels of the chat UI. Our [translation guide](../concepts/translation.mdx) covers this topic in detail.
|
|
5
|
+
*/
|
|
3
6
|
export declare class StreamI18nService {
|
|
4
7
|
private translteService;
|
|
5
8
|
constructor(translteService: TranslateService);
|
|
9
|
+
/**
|
|
10
|
+
* Registers the translation to the [ngx-translate](https://github.com/ngx-translate/core) TranslateService.
|
|
11
|
+
* @param lang The language key to register the translation to
|
|
12
|
+
* @param overrides An object which keys are translation keys, and the values are custom translations
|
|
13
|
+
*/
|
|
6
14
|
setTranslation(lang?: string, overrides?: {
|
|
7
15
|
[key: string]: string;
|
|
8
16
|
}): void;
|
package/lib/theme.service.d.ts
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare type Theme = 'light' | 'dark';
|
|
4
|
+
/**
|
|
5
|
+
* The `ThemeService` can be used to change the theme of the chat UI and to customize the theme. Our [themeing guide](../concepts/themeing-and-css.mdx) gives a complete overview about the topic.
|
|
6
|
+
*/
|
|
4
7
|
export declare class ThemeService {
|
|
8
|
+
/**
|
|
9
|
+
* A Subject that can be used to get or set the currently active theme.
|
|
10
|
+
*/
|
|
5
11
|
theme$: BehaviorSubject<Theme>;
|
|
6
12
|
private _customLightThemeVariables;
|
|
7
13
|
private _customDarkThemeVariables;
|
|
8
14
|
private defaultDarkModeVariables;
|
|
15
|
+
private variablesToDelete;
|
|
9
16
|
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* A getter that returns the currently set custom light theme variables.
|
|
19
|
+
* @returns An object where the keys are theme variables, and the values are the currently set CSS values.
|
|
20
|
+
*/
|
|
10
21
|
get customLightThemeVariables(): {
|
|
11
22
|
[key: string]: string;
|
|
12
23
|
} | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* A setter that can be used to overwrite the values of the CSS theme variables of the light theme.
|
|
26
|
+
* @param variables An object where the keys are theme variables, and the values are CSS values.
|
|
27
|
+
*/
|
|
13
28
|
set customLightThemeVariables(variables: {
|
|
14
29
|
[key: string]: string;
|
|
15
30
|
} | undefined);
|
|
31
|
+
/**
|
|
32
|
+
* A getter that returns the currently set custom dark theme variables.
|
|
33
|
+
* @returns An object where the keys are theme variables, and the values are the currently set CSS values.
|
|
34
|
+
*/
|
|
16
35
|
get customDarkThemeVariables(): {
|
|
17
36
|
[key: string]: string;
|
|
18
37
|
} | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* A setter that can be used to overwrite the values of the CSS theme variables of the dark theme.
|
|
40
|
+
* @param variables An object where the keys are theme variables, and the values are CSS values.
|
|
41
|
+
*/
|
|
19
42
|
set customDarkThemeVariables(variables: {
|
|
20
43
|
[key: string]: string;
|
|
21
44
|
} | undefined);
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* The `TransliterationService` wraps the [@sindresorhus/transliterate](https://www.npmjs.com/package/@sindresorhus/transliterate) library
|
|
4
|
+
*/
|
|
2
5
|
export declare class TransliterationService {
|
|
3
6
|
constructor();
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param s the string to be transliterated
|
|
10
|
+
* @returns the result of the transliteration
|
|
11
|
+
*/
|
|
4
12
|
transliterate(s: string): string;
|
|
5
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<TransliterationService, never>;
|
|
6
14
|
static ɵprov: i0.ɵɵInjectableDeclaration<TransliterationService>;
|