stream-chat-angular 6.3.1 → 6.4.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.
@@ -187,6 +187,12 @@ export declare class ChannelService {
187
187
  * The provided method will be called before a message is sent to Stream's API for update. You can use this hook to tranfrom or enrich the message being updated.
188
188
  */
189
189
  beforeUpdateMessage?: (message: StreamMessage) => StreamMessage | Promise<StreamMessage>;
190
+ /**
191
+ * Since switching channels changes the state of multiple obserables, this observable can be used to check if all observables are updated.
192
+ * - `end` means all observables are in stable state
193
+ * - `start` means all observables are in unstable state
194
+ */
195
+ channelSwitchState$: Observable<'start' | 'end'>;
190
196
  /**
191
197
  * @internal
192
198
  */
@@ -216,6 +222,7 @@ export declare class ChannelService {
216
222
  private clientEventsSubscription;
217
223
  private isStateRecoveryInProgress;
218
224
  private channelQueryStateSubject;
225
+ private channelSwitchStateSubject;
219
226
  private channelQuery?;
220
227
  private _customPaginator;
221
228
  private channelListSetter;
@@ -367,7 +374,7 @@ export declare class ChannelService {
367
374
  * Selects or deselects the current message to quote reply to
368
375
  * @param message The message to select, if called with `undefined`, it deselects the message
369
376
  */
370
- selectMessageToQuote(message: StreamMessage | undefined): void;
377
+ selectMessageToQuote(message: StreamMessage | undefined | MessageResponse): void;
371
378
  /**
372
379
  * Add a new channel to the channel list
373
380
  * The channel will be added to the beginning of the channel list
@@ -1,6 +1,6 @@
1
1
  import { AfterViewInit, ChangeDetectorRef, ComponentFactoryResolver, ComponentRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef, Type } from '@angular/core';
2
2
  import { Observable, Subject } from 'rxjs';
3
- import { Attachment, UserResponse } from 'stream-chat';
3
+ import { Attachment, DraftMessagePayload, DraftResponse, UserResponse } from 'stream-chat';
4
4
  import { AttachmentService } from '../attachment.service';
5
5
  import { ChannelService } from '../channel.service';
6
6
  import { NotificationService } from '../notification.service';
@@ -89,6 +89,20 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
89
89
  readonly messageUpdate: EventEmitter<{
90
90
  message: StreamMessage;
91
91
  }>;
92
+ /**
93
+ * Emits the messsage draft whenever the composed message changes.
94
+ * - If the user clears the message input, or sends the message, undefined is emitted.
95
+ * - If active channel changes, nothing is emitted.
96
+ *
97
+ * To save and fetch message drafts, you can use the [Stream message drafts API](https://getstream.io/chat/docs/javascript/drafts/).
98
+ *
99
+ * Message draft only works for new messages, nothing is emitted when input is in edit mode (if `message` input is set).
100
+ *
101
+ * To load a message draft into the input, use the `loadDraft` method.
102
+ * - If channel id doesn't match the active channel id, the draft is ignored.
103
+ * - If a thread message is loaded, and the input isn't in thread mode or parent ids don't match, the draft is ignored.
104
+ */
105
+ readonly messageDraftChange: EventEmitter<DraftMessagePayload | undefined>;
92
106
  voiceRecorderRef: TemplateRef<{
93
107
  service: VoiceRecorderService;
94
108
  }> | undefined;
@@ -125,6 +139,9 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
125
139
  private readonly slowModeTextareaPlaceholder;
126
140
  private messageToEdit?;
127
141
  private pollId;
142
+ private isChannelChangeResetInProgress;
143
+ private isSendingMessage;
144
+ private isLoadingDraft;
128
145
  constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver, cdRef: ChangeDetectorRef, emojiInputService: EmojiInputService, customTemplatesService: CustomTemplatesService, messageActionsService: MessageActionsService, voiceRecorderService: VoiceRecorderService, audioRecorder?: AudioRecorderService | undefined);
129
146
  ngOnInit(): void;
130
147
  ngAfterViewInit(): void;
@@ -146,8 +163,18 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
146
163
  openPollComposer(): void;
147
164
  closePollComposer: () => void;
148
165
  addPoll: (pollId: string) => void;
166
+ userMentionsChanged(userMentions: UserResponse[]): void;
167
+ updateMessageDraft(): void;
149
168
  voiceRecordingReady(recording: AudioRecording): Promise<void>;
150
169
  get isUpdate(): boolean;
170
+ /**
171
+ *
172
+ * @param draft DraftResponse to load into the message input.
173
+ * - Draft messages are only supported for new messages, input is ignored in edit mode (if `message` input is set).
174
+ * - If channel id doesn't match the active channel id, the draft is ignored.
175
+ * - If a thread message is loaded, and the input isn't in thread mode or parent ids don't match, the draft is ignored.
176
+ */
177
+ loadDraft(draft: DraftResponse): void;
151
178
  private deleteUpload;
152
179
  private retryUpload;
153
180
  private clearFileInput;
@@ -159,5 +186,5 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
159
186
  private checkIfInEditMode;
160
187
  private messageToUpdateChanged;
161
188
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, [null, null, null, null, null, null, null, null, null, null, null, { optional: true; }]>;
162
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mode": "mode"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; "sendMessage$": "sendMessage$"; "inputMode": "inputMode"; "autoFocus": "autoFocus"; "watchForMessageToEdit": "watchForMessageToEdit"; "displaySendButton": "displaySendButton"; "displayVoiceRecordingButton": "displayVoiceRecordingButton"; "displayPollCreateButton": "displayPollCreateButton"; }, { "messageUpdate": "messageUpdate"; }, ["voiceRecorderRef"], ["[message-input-start]", "[message-input-end]"], false, never>;
189
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mode": "mode"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; "sendMessage$": "sendMessage$"; "inputMode": "inputMode"; "autoFocus": "autoFocus"; "watchForMessageToEdit": "watchForMessageToEdit"; "displaySendButton": "displaySendButton"; "displayVoiceRecordingButton": "displayVoiceRecordingButton"; "displayPollCreateButton": "displayPollCreateButton"; }, { "messageUpdate": "messageUpdate"; "messageDraftChange": "messageDraftChange"; }, ["voiceRecorderRef"], ["[message-input-start]", "[message-input-end]"], false, never>;
163
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "6.3.1",
3
+ "version": "6.4.0",
4
4
  "description": "Angular components to create chat conversations or livestream style chat",
5
5
  "author": "GetStream",
6
6
  "homepage": "https://getstream.io/chat/",
@@ -1 +1 @@
1
- export const version = '6.3.1';
1
+ export const version = '6.4.0';