stream-chat-angular 5.4.3 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/esm2020/assets/version.mjs +2 -2
  3. package/esm2020/lib/attachment-list/attachment-list.component.mjs +37 -16
  4. package/esm2020/lib/attachment-preview-list/attachment-preview-list.component.mjs +23 -10
  5. package/esm2020/lib/attachment.service.mjs +38 -10
  6. package/esm2020/lib/custom-templates.service.mjs +9 -1
  7. package/esm2020/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.mjs +16 -12
  8. package/esm2020/lib/message-input/message-input-config.service.mjs +1 -1
  9. package/esm2020/lib/message-input/message-input.component.mjs +16 -3
  10. package/esm2020/lib/message-input/textarea/textarea.component.mjs +13 -9
  11. package/esm2020/lib/message-input/textarea.directive.mjs +6 -2
  12. package/esm2020/lib/message-input/textarea.interface.mjs +1 -1
  13. package/esm2020/lib/message.service.mjs +18 -1
  14. package/esm2020/lib/types.mjs +1 -1
  15. package/fesm2015/stream-chat-angular.mjs +191 -80
  16. package/fesm2015/stream-chat-angular.mjs.map +1 -1
  17. package/fesm2020/stream-chat-angular.mjs +190 -80
  18. package/fesm2020/stream-chat-angular.mjs.map +1 -1
  19. package/lib/attachment-list/attachment-list.component.d.ts +11 -4
  20. package/lib/attachment-preview-list/attachment-preview-list.component.d.ts +14 -4
  21. package/lib/attachment.service.d.ts +15 -4
  22. package/lib/custom-templates.service.d.ts +9 -1
  23. package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +6 -4
  24. package/lib/message-input/message-input-config.service.d.ts +12 -0
  25. package/lib/message-input/message-input.component.d.ts +5 -3
  26. package/lib/message-input/textarea/textarea.component.d.ts +10 -4
  27. package/lib/message-input/textarea.directive.d.ts +2 -1
  28. package/lib/message-input/textarea.interface.d.ts +1 -0
  29. package/lib/message.service.d.ts +19 -3
  30. package/lib/types.d.ts +8 -2
  31. package/package.json +1 -1
  32. package/src/assets/version.ts +1 -1
@@ -1,17 +1,19 @@
1
- import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
1
+ import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { Action, Attachment } from 'stream-chat';
3
- import { ModalContext, DefaultStreamChatGenerics, AttachmentConfigration, VideoAttachmentConfiguration, ImageAttachmentConfiguration, AttachmentContext } from '../types';
3
+ import { ModalContext, DefaultStreamChatGenerics, AttachmentConfigration, VideoAttachmentConfiguration, ImageAttachmentConfiguration, AttachmentContext, CustomAttachmentListContext } from '../types';
4
4
  import { ChannelService } from '../channel.service';
5
5
  import { CustomTemplatesService } from '../custom-templates.service';
6
6
  import { AttachmentConfigurationService } from '../attachment-configuration.service';
7
+ import { MessageService } from '../message.service';
7
8
  import * as i0 from "@angular/core";
8
9
  /**
9
10
  * The `AttachmentList` component displays the attachments of a message
10
11
  */
11
- export declare class AttachmentListComponent implements OnChanges {
12
+ export declare class AttachmentListComponent implements OnChanges, OnInit, OnDestroy {
12
13
  readonly customTemplatesService: CustomTemplatesService;
13
14
  private channelService;
14
15
  private attachmentConfigurationService;
16
+ private messageService;
15
17
  /**
16
18
  * The id of the message the attachments belong to
17
19
  */
@@ -30,12 +32,17 @@ export declare class AttachmentListComponent implements OnChanges {
30
32
  readonly imageModalStateChange: EventEmitter<"closed" | "opened">;
31
33
  class: string;
32
34
  orderedAttachments: Attachment<DefaultStreamChatGenerics>[];
35
+ customAttachments: Attachment<DefaultStreamChatGenerics>[];
33
36
  imagesToView: Attachment<DefaultStreamChatGenerics>[];
34
37
  imagesToViewCurrentIndex: number;
38
+ customAttachmentsTemplate?: TemplateRef<CustomAttachmentListContext>;
35
39
  private modalContent;
36
40
  private attachmentConfigurations;
37
- constructor(customTemplatesService: CustomTemplatesService, channelService: ChannelService, attachmentConfigurationService: AttachmentConfigurationService);
41
+ private subscriptions;
42
+ constructor(customTemplatesService: CustomTemplatesService, channelService: ChannelService, attachmentConfigurationService: AttachmentConfigurationService, messageService: MessageService);
43
+ ngOnInit(): void;
38
44
  ngOnChanges(changes: SimpleChanges): void;
45
+ ngOnDestroy(): void;
39
46
  trackByUrl(_: number, attachment: Attachment): {} | undefined;
40
47
  isImage(attachment: Attachment): boolean;
41
48
  isSvg(attachment: Attachment): boolean;
@@ -1,11 +1,16 @@
1
- import { EventEmitter } from '@angular/core';
1
+ import { EventEmitter, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { AttachmentUpload } from '../types';
3
+ import { AttachmentUpload, CustomAttachmentPreviewListContext } from '../types';
4
+ import { CustomTemplatesService } from '../custom-templates.service';
5
+ import { AttachmentService } from '../attachment.service';
6
+ import { Attachment } from 'stream-chat';
4
7
  import * as i0 from "@angular/core";
5
8
  /**
6
9
  * The `AttachmentPreviewList` component displays a preview of the attachments uploaded to a message. Users can delete attachments using the preview component, or retry upload if it failed previously.
7
10
  */
8
- export declare class AttachmentPreviewListComponent {
11
+ export declare class AttachmentPreviewListComponent implements OnInit, OnDestroy {
12
+ private customTemplateService;
13
+ readonly attachmentService: AttachmentService;
9
14
  /**
10
15
  * A stream that emits the current file uploads and their states
11
16
  */
@@ -18,7 +23,12 @@ export declare class AttachmentPreviewListComponent {
18
23
  * An output to notify the parent component if the user wants to delete a file
19
24
  */
20
25
  readonly deleteAttachment: EventEmitter<AttachmentUpload<import("../types").DefaultStreamChatGenerics>>;
21
- constructor();
26
+ customAttachments: Attachment[];
27
+ customAttachmentsPreview?: TemplateRef<CustomAttachmentPreviewListContext>;
28
+ private subscriptions;
29
+ constructor(customTemplateService: CustomTemplatesService, attachmentService: AttachmentService);
30
+ ngOnInit(): void;
31
+ ngOnDestroy(): void;
22
32
  attachmentUploadRetried(file: File): void;
23
33
  attachmentDeleted(upload: AttachmentUpload): void;
24
34
  trackByFile(_: number, item: AttachmentUpload): File;
@@ -1,9 +1,10 @@
1
- import { Observable } from 'rxjs';
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
2
  import { Attachment } from 'stream-chat';
3
3
  import { ChannelService } from './channel.service';
4
4
  import { NotificationService } from './notification.service';
5
5
  import { AttachmentUpload, AudioRecording, DefaultStreamChatGenerics } from './types';
6
6
  import { ChatClientService } from './chat-client.service';
7
+ import { MessageService } from './message.service';
7
8
  import * as i0 from "@angular/core";
8
9
  /**
9
10
  * The `AttachmentService` manages the uploads of a message input.
@@ -14,18 +15,28 @@ export declare class AttachmentService<T extends DefaultStreamChatGenerics = Def
14
15
  private channelService;
15
16
  private notificationService;
16
17
  private chatClientService;
18
+ private messageService;
17
19
  /**
18
20
  * Emits the number of uploads in progress.
21
+ *
22
+ * You can increment and decrement this counter if you're using custom attachments and want to disable message sending until all attachments are uploaded.
23
+ *
24
+ * The SDK will handle updating this counter for built-in attachments, but for custom attachments you should take care of this.
19
25
  */
20
- attachmentUploadInProgressCounter$: Observable<number>;
26
+ attachmentUploadInProgressCounter$: BehaviorSubject<number>;
21
27
  /**
22
28
  * 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/AttachmentPreviewListComponent.mdx) to display the attachment previews.
23
29
  */
24
30
  attachmentUploads$: Observable<AttachmentUpload[]>;
25
- private attachmentUploadInProgressCounterSubject;
31
+ /**
32
+ * You can get and set the list if uploaded custom attachments
33
+ *
34
+ * By default the SDK components won't display these, but you can provide your own `customAttachmentPreviewListTemplate$` and `customAttachmentListTemplate$` for the [`CustomTemplatesService`](../../services/CustomTemplatesService).
35
+ */
36
+ customAttachments$: BehaviorSubject<Attachment<T>[]>;
26
37
  private attachmentUploadsSubject;
27
38
  private appSettings;
28
- constructor(channelService: ChannelService, notificationService: NotificationService, chatClientService: ChatClientService);
39
+ constructor(channelService: ChannelService, notificationService: NotificationService, chatClientService: ChatClientService, messageService: MessageService);
29
40
  /**
30
41
  * Resets the attachments uploads (for example after the message with the attachments sent successfully)
31
42
  */
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, ChannelPreviewInfoContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, CustomMetadataContext, DateSeparatorContext, DefaultStreamChatGenerics, DeliveredStatusContext, EmojiPickerContext, IconContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageReactionsContext, MessageReactionsSelectorContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext, UnreadMessagesIndicatorContext, UnreadMessagesNotificationContext } from './types';
3
+ import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, ChannelPreviewInfoContext, CommandAutocompleteListItemContext, CustomAttachmentListContext, CustomAttachmentPreviewListContext, CustomAttachmentUploadContext, CustomMetadataContext, DateSeparatorContext, DefaultStreamChatGenerics, DeliveredStatusContext, EmojiPickerContext, IconContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageReactionsContext, MessageReactionsSelectorContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext, UnreadMessagesIndicatorContext, UnreadMessagesNotificationContext } from './types';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * A central location for registering your custom templates to override parts of the chat application.
@@ -209,6 +209,14 @@ export declare class CustomTemplatesService<T extends DefaultStreamChatGenerics
209
209
  *
210
210
  */
211
211
  channelPreviewInfoTemplate$: BehaviorSubject<TemplateRef<ChannelPreviewInfoContext<DefaultStreamChatGenerics>> | undefined>;
212
+ /**
213
+ * The template used to display custom attachment previews in the [message input component](../../components/MessageInputComponent.mdx)
214
+ */
215
+ customAttachmentPreviewListTemplate$: BehaviorSubject<TemplateRef<CustomAttachmentPreviewListContext<DefaultStreamChatGenerics>> | undefined>;
216
+ /**
217
+ * The template used to display custom attachments in the [message component](../../components/MessageComponent.mdx)
218
+ */
219
+ customAttachmentListTemplate$: BehaviorSubject<TemplateRef<CustomAttachmentListContext<DefaultStreamChatGenerics>> | undefined>;
212
220
  constructor();
213
221
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService<any>, never>;
214
222
  static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService<any>>;
@@ -8,7 +8,6 @@ import { ChatClientService } from '../../chat-client.service';
8
8
  import { TransliterationService } from '../../transliteration.service';
9
9
  import { EmojiInputService } from '../emoji-input.service';
10
10
  import { CustomTemplatesService } from '../../custom-templates.service';
11
- import { ThemeService } from '../../theme.service';
12
11
  import * as i0 from "@angular/core";
13
12
  /**
14
13
  * The `AutocompleteTextarea` component is used by the [`MessageInput`](./MessageInputComponent.mdx) component to display the input HTML element where users can type their message.
@@ -19,7 +18,6 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
19
18
  private transliterationService;
20
19
  private emojiInputService;
21
20
  private customTemplatesService;
22
- private themeService;
23
21
  private cdRef;
24
22
  class: string;
25
23
  /**
@@ -58,6 +56,10 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
58
56
  * 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.
59
57
  */
60
58
  readonly userMentions: EventEmitter<UserResponse<import("stream-chat").DefaultGenerics>[]>;
59
+ /**
60
+ * Emits any paste event that occured inside the textarea
61
+ */
62
+ readonly pasteFromClipboard: EventEmitter<ClipboardEvent>;
61
63
  mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
62
64
  commandAutocompleteItemTemplate: TemplateRef<CommandAutocompleteListItemContext> | undefined;
63
65
  private readonly autocompleteKey;
@@ -71,7 +73,7 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
71
73
  private slashCommandConfig;
72
74
  private searchTerm$;
73
75
  private isViewInited;
74
- constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService, emojiInputService: EmojiInputService, customTemplatesService: CustomTemplatesService, themeService: ThemeService, cdRef: ChangeDetectorRef);
76
+ constructor(channelService: ChannelService, chatClientService: ChatClientService, transliterationService: TransliterationService, emojiInputService: EmojiInputService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef);
75
77
  ngOnChanges(changes: SimpleChanges): void;
76
78
  ngAfterViewInit(): void;
77
79
  filter(searchString: string, items: {
@@ -89,5 +91,5 @@ export declare class AutocompleteTextareaComponent implements TextareaInterface,
89
91
  private updateMentionOptions;
90
92
  private updateMentionedUsersFromText;
91
93
  static ɵfac: i0.ɵɵFactoryDeclaration<AutocompleteTextareaComponent, never>;
92
- static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteTextareaComponent, "stream-autocomplete-textarea", never, { "value": "value"; "placeholder": "placeholder"; "areMentionsEnabled": "areMentionsEnabled"; "inputMode": "inputMode"; "mentionScope": "mentionScope"; "autoFocus": "autoFocus"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never, never, false, never>;
94
+ static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteTextareaComponent, "stream-autocomplete-textarea", never, { "value": "value"; "placeholder": "placeholder"; "areMentionsEnabled": "areMentionsEnabled"; "inputMode": "inputMode"; "mentionScope": "mentionScope"; "autoFocus": "autoFocus"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; "pasteFromClipboard": "pasteFromClipboard"; }, never, never, false, never>;
93
95
  }
@@ -1,3 +1,4 @@
1
+ import { MessageInputComponent } from './message-input.component';
1
2
  import * as i0 from "@angular/core";
2
3
  /**
3
4
  * 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.
@@ -28,6 +29,17 @@ export declare class MessageInputConfigService {
28
29
  * If `false`, the recording will added to the attachment preview, and users can continue composing the message.
29
30
  */
30
31
  sendVoiceRecordingImmediately: boolean;
32
+ /**
33
+ * Override the message input's default event handler for [paste events](https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event)
34
+ *
35
+ * The event handler will receive the event object, and the [message input component](../../components/MessageInputComponent).
36
+ *
37
+ * You can use the public API of the message input component to update the composer. Typically you want to update the message text and/or attachments, this is how you can do these:
38
+ * - Change message text: `inputComponent.textareaValue = '<new value>'`
39
+ * - Upload file or image attachments: `inputComponent.attachmentService.filesSelected(<files>)`
40
+ * - Upload custom attachments: `inputComponent.attachmentService.customAttachments$.next(<custom attachments>)`
41
+ */
42
+ customPasteEventHandler?: (event: ClipboardEvent, inputComponent: MessageInputComponent) => void;
31
43
  constructor();
32
44
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputConfigService, never>;
33
45
  static ɵprov: i0.ɵɵInjectableDeclaration<MessageInputConfigService>;
@@ -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 { UserResponse } from 'stream-chat';
3
+ import { Attachment, 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';
@@ -94,6 +94,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
94
94
  canSendLinks: boolean | undefined;
95
95
  canSendMessages: boolean | undefined;
96
96
  attachmentUploads$: Observable<AttachmentUpload[]>;
97
+ customAttachments$: Observable<Attachment[]>;
97
98
  attachmentUploadInProgressCounter$: Observable<number>;
98
99
  textareaValue: string;
99
100
  textareaRef: ComponentRef<TextareaInterface & Partial<OnChanges>> | undefined;
@@ -124,11 +125,11 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
124
125
  ngOnDestroy(): void;
125
126
  messageSent(): Promise<void>;
126
127
  get containsLinks(): boolean;
127
- get quotedMessageAttachments(): import("stream-chat").Attachment<{
128
+ get quotedMessageAttachments(): Attachment<{
128
129
  attachmentType: import("stream-chat").UR & import("../types").UnknownType & {
129
130
  asset_url?: string | undefined;
130
131
  id?: string | undefined;
131
- images?: import("stream-chat").Attachment<DefaultStreamChatGenerics>[] | undefined;
132
+ images?: Attachment<DefaultStreamChatGenerics>[] | undefined;
132
133
  mime_type?: string | undefined;
133
134
  isCustomAttachment?: boolean | undefined;
134
135
  };
@@ -148,6 +149,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
148
149
  };
149
150
  }>[];
150
151
  get disabledTextareaText(): "" | "streamChat.You can't send thread replies in this channel" | "streamChat.You can't send messages in this channel";
152
+ itemsPasted(event: ClipboardEvent): void;
151
153
  filesSelected(fileList: FileList | null): Promise<void>;
152
154
  deselectMessageToQuote(): void;
153
155
  deselectMessageToEdit(): void;
@@ -1,14 +1,13 @@
1
1
  import { AfterViewInit, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
2
- import { ThemeService } from '../../theme.service';
3
2
  import { EmojiInputService } from '../emoji-input.service';
4
3
  import { TextareaInterface } from '../textarea.interface';
4
+ import { UserResponse } from 'stream-chat';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * The `Textarea` component is used by the [`MessageInput`](./MessageInputComponent.mdx) component to display the input HTML element where users can type their message.
8
8
  */
9
9
  export declare class TextareaComponent implements TextareaInterface, OnChanges, OnDestroy, AfterViewInit {
10
10
  private emojiInputService;
11
- private themeService;
12
11
  class: string;
13
12
  /**
14
13
  * The value of the input HTML element.
@@ -34,10 +33,17 @@ export declare class TextareaComponent implements TextareaInterface, OnChanges,
34
33
  * Emits when a user triggers a message send event (this happens when they hit the `Enter` key).
35
34
  */
36
35
  readonly send: EventEmitter<void>;
36
+ /**
37
+ * Emits any paste event that occured inside the textarea
38
+ */
39
+ readonly pasteFromClipboard: EventEmitter<ClipboardEvent>;
37
40
  private messageInput;
41
+ userMentions?: EventEmitter<UserResponse[]> | undefined;
42
+ areMentionsEnabled?: boolean | undefined;
43
+ mentionScope?: 'channel' | 'application' | undefined;
38
44
  private subscriptions;
39
45
  private isViewInited;
40
- constructor(emojiInputService: EmojiInputService, themeService: ThemeService);
46
+ constructor(emojiInputService: EmojiInputService);
41
47
  ngOnChanges(changes: SimpleChanges): void;
42
48
  ngAfterViewInit(): void;
43
49
  ngOnDestroy(): void;
@@ -45,5 +51,5 @@ export declare class TextareaComponent implements TextareaInterface, OnChanges,
45
51
  enterHit(event: Event): void;
46
52
  private adjustTextareaHeight;
47
53
  static ɵfac: i0.ɵɵFactoryDeclaration<TextareaComponent, never>;
48
- static ɵcmp: i0.ɵɵComponentDeclaration<TextareaComponent, "stream-textarea", never, { "value": "value"; "placeholder": "placeholder"; "inputMode": "inputMode"; "autoFocus": "autoFocus"; }, { "valueChange": "valueChange"; "send": "send"; }, never, never, false, never>;
54
+ static ɵcmp: i0.ɵɵComponentDeclaration<TextareaComponent, "stream-textarea", never, { "value": "value"; "placeholder": "placeholder"; "inputMode": "inputMode"; "autoFocus": "autoFocus"; }, { "valueChange": "valueChange"; "send": "send"; "pasteFromClipboard": "pasteFromClipboard"; }, never, never, false, never>;
49
55
  }
@@ -14,10 +14,11 @@ export declare class TextareaDirective implements OnChanges {
14
14
  readonly valueChange: EventEmitter<string>;
15
15
  readonly send: EventEmitter<void>;
16
16
  readonly userMentions: EventEmitter<UserResponse<import("stream-chat").DefaultGenerics>[]>;
17
+ readonly pasteFromClipboard: EventEmitter<ClipboardEvent>;
17
18
  private subscriptions;
18
19
  private unpropagatedChanges;
19
20
  constructor(viewContainerRef: ViewContainerRef);
20
21
  ngOnChanges(changes: SimpleChanges): void;
21
22
  static ɵfac: i0.ɵɵFactoryDeclaration<TextareaDirective, never>;
22
- static ɵdir: i0.ɵɵDirectiveDeclaration<TextareaDirective, "[streamTextarea]", never, { "componentRef": "componentRef"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "inputMode": "inputMode"; "value": "value"; "placeholder": "placeholder"; "autoFocus": "autoFocus"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never, never, false, never>;
23
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TextareaDirective, "[streamTextarea]", never, { "componentRef": "componentRef"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "inputMode": "inputMode"; "value": "value"; "placeholder": "placeholder"; "autoFocus": "autoFocus"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; "pasteFromClipboard": "pasteFromClipboard"; }, never, never, false, never>;
23
24
  }
@@ -5,6 +5,7 @@ export interface TextareaInterface {
5
5
  valueChange: EventEmitter<string>;
6
6
  send: EventEmitter<void>;
7
7
  userMentions?: EventEmitter<UserResponse[]>;
8
+ pasteFromClipboard: EventEmitter<ClipboardEvent>;
8
9
  areMentionsEnabled?: boolean;
9
10
  mentionScope?: 'channel' | 'application';
10
11
  placeholder?: string;
@@ -1,8 +1,10 @@
1
+ import { Attachment } from 'stream-chat';
2
+ import { DefaultStreamChatGenerics } from './types';
1
3
  import * as i0 from "@angular/core";
2
4
  /**
3
5
  * The message service contains configuration options related to displaying the message content
4
6
  */
5
- export declare class MessageService {
7
+ export declare class MessageService<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> {
6
8
  /**
7
9
  * Decides if the message content should be formatted as text or HTML
8
10
  *
@@ -17,7 +19,21 @@ export declare class MessageService {
17
19
  * @returns the HTML markup as a string for the link
18
20
  */
19
21
  customLinkRenderer?: (url: string) => string;
22
+ /**
23
+ * The SDK supports the following attachment types: `image`, `file`, `giphy`, `video` and `voiceRecording` attachments.
24
+ *
25
+ * All other types are treated as custom attachments, however it's possible to override this logic, and provide a custom filtering method which can be used to treat some built-in attachments as custom.
26
+ *
27
+ * Provide a method which retruns `true` if an attachment should be considered as custom.
28
+ */
29
+ filterCustomAttachment?: (attachment: Attachment<T>) => boolean;
20
30
  constructor();
21
- static ɵfac: i0.ɵɵFactoryDeclaration<MessageService, never>;
22
- static ɵprov: i0.ɵɵInjectableDeclaration<MessageService>;
31
+ /**
32
+ * Tells if an attachment is custom (you need to provide your own template to display them) or built-in (the SDK supports it out-of-the-box)
33
+ * @param attachment
34
+ * @returns `true` if the attachment is custom
35
+ */
36
+ isCustomAttachment(attachment: Attachment<T>): boolean;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<MessageService<any>, never>;
38
+ static ɵprov: i0.ɵɵInjectableDeclaration<MessageService<any>>;
23
39
  }
package/lib/types.d.ts CHANGED
@@ -132,10 +132,12 @@ export declare type MessageContext = {
132
132
  export declare type ChannelActionsContext<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
133
133
  channel: Channel<T>;
134
134
  };
135
- export declare type AttachmentListContext = {
135
+ export declare type CustomAttachmentListContext<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
136
136
  messageId: string;
137
- attachments: Attachment<DefaultStreamChatGenerics>[];
137
+ attachments: Attachment<T>[];
138
138
  parentMessageId?: string;
139
+ };
140
+ export declare type AttachmentListContext = CustomAttachmentListContext & {
139
141
  imageModalStateChangeHandler?: (state: 'opened' | 'closed') => void;
140
142
  };
141
143
  export declare type AvatarType = 'channel' | 'user';
@@ -158,6 +160,7 @@ export declare type AttachmentPreviewListContext = {
158
160
  attachmentUploads$: Observable<AttachmentUpload[]> | undefined;
159
161
  retryUploadHandler: (f: File) => void;
160
162
  deleteUploadHandler: (u: AttachmentUpload) => void;
163
+ service: AttachmentService;
161
164
  };
162
165
  export declare type IconContext = {
163
166
  icon: Icon | undefined;
@@ -329,4 +332,7 @@ export declare type MediaRecording = {
329
332
  mime_type: string;
330
333
  asset_url: string | ArrayBuffer | undefined;
331
334
  };
335
+ export declare type CustomAttachmentPreviewListContext<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
336
+ attachmentService: AttachmentService<T>;
337
+ };
332
338
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "5.4.3",
3
+ "version": "5.6.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 = '5.4.3';
1
+ export const version = '5.6.0';