stream-chat-angular 4.17.0 → 4.18.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.
@@ -18,7 +18,7 @@ export declare class AttachmentPreviewListComponent {
18
18
  /**
19
19
  * An output to notify the parent component if the user wants to delete a file
20
20
  */
21
- readonly deleteAttachment: EventEmitter<AttachmentUpload>;
21
+ readonly deleteAttachment: EventEmitter<AttachmentUpload<import("../types").DefaultStreamChatGenerics>>;
22
22
  themeVersion: '1' | '2';
23
23
  constructor(themeService: ThemeService);
24
24
  attachmentUploadRetried(file: File): void;
@@ -2,12 +2,12 @@ import { 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
- import { AttachmentUpload } from './types';
5
+ import { AttachmentUpload, DefaultStreamChatGenerics } from './types';
6
6
  import * as i0 from "@angular/core";
7
7
  /**
8
8
  * The `AttachmentService` manages the uploads of a message input.
9
9
  */
10
- export declare class AttachmentService {
10
+ export declare class AttachmentService<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> {
11
11
  private channelService;
12
12
  private notificationService;
13
13
  /**
@@ -31,6 +31,14 @@ export declare class AttachmentService {
31
31
  * @returns A promise with the result
32
32
  */
33
33
  filesSelected(fileList: FileList | null): Promise<void>;
34
+ /**
35
+ * You can add custom `image`, `video` and `file` attachments using this method.
36
+ *
37
+ * Note: If you just want to use your own CDN for file uploads, you don't necessary need this method, you can just specify you own upload function in the [`ChannelService`](./ChannelService.mdx)
38
+ *
39
+ * @param attachment
40
+ */
41
+ addAttachment(attachment: Attachment<T>): void;
34
42
  /**
35
43
  * Retries to upload an attachment.
36
44
  * @param file
@@ -51,9 +59,9 @@ export declare class AttachmentService {
51
59
  * Maps attachments received from the Stream API to uploads. This is useful when editing a message.
52
60
  * @param attachments Attachemnts received with the message
53
61
  */
54
- createFromAttachments(attachments: Attachment[]): void;
62
+ createFromAttachments(attachments: Attachment<T>[]): void;
55
63
  private createPreview;
56
64
  private uploadAttachments;
57
- static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentService, never>;
58
- static ɵprov: i0.ɵɵInjectableDeclaration<AttachmentService>;
65
+ static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentService<any>, never>;
66
+ static ɵprov: i0.ɵɵInjectableDeclaration<AttachmentService<any>>;
59
67
  }
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, ThreadHeaderContext, TypingIndicatorContext } from './types';
3
+ import { AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, ThreadHeaderContext, TypingIndicatorContext } 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.
@@ -128,20 +128,34 @@ export declare class CustomTemplatesService {
128
128
  threadHeaderTemplate$: BehaviorSubject<TemplateRef<ThreadHeaderContext> | undefined>;
129
129
  /**
130
130
  * The template used for displaying the delivered state of the message inside the [message component](../components/MessageComponent.mdx)
131
+ *
132
+ * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
131
133
  */
132
134
  deliveredStatusTemplate$: BehaviorSubject<TemplateRef<DeliveredStatusContext> | undefined>;
133
135
  /**
134
136
  * The template used for displaying the sending state of the message inside the [message component](../components/MessageComponent.mdx)
137
+ *
138
+ * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
135
139
  */
136
140
  sendingStatusTemplate$: BehaviorSubject<TemplateRef<SendingStatusContext> | undefined>;
137
141
  /**
138
142
  * The template used for displaying the sent state of the message inside the [message component](../components/MessageComponent.mdx)
143
+ *
144
+ * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
139
145
  */
140
146
  readStatusTemplate$: BehaviorSubject<TemplateRef<ReadStatusContext> | undefined>;
141
147
  /**
142
148
  * The template used to display additional information about a channel under the channel name inside the [channel header component](../components/ChannelHeaderComponent.mdx)
149
+ *
150
+ * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
143
151
  */
144
152
  channelHeaderInfoTemplate$: BehaviorSubject<TemplateRef<ChannelHeaderInfoContext<import("./types").DefaultStreamChatGenerics>> | undefined>;
153
+ /**
154
+ * The template used for displaying file upload/attachment selector inside the [message input](../components/MessageInputComponent.mdx)
155
+ *
156
+ * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
157
+ */
158
+ customAttachmentUploadTemplate$: BehaviorSubject<TemplateRef<CustomAttachmentUploadContext> | undefined>;
145
159
  constructor();
146
160
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService, never>;
147
161
  static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService>;
@@ -5,7 +5,7 @@ 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 { AttachmentPreviewListContext, AttachmentUpload, DefaultStreamChatGenerics, EmojiPickerContext, StreamMessage } from '../types';
8
+ import { AttachmentPreviewListContext, AttachmentUpload, CustomAttachmentUploadContext, DefaultStreamChatGenerics, 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';
@@ -76,6 +76,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
76
76
  cooldown$: Observable<number> | undefined;
77
77
  isCooldownInProgress: boolean;
78
78
  emojiPickerTemplate: TemplateRef<EmojiPickerContext> | undefined;
79
+ customAttachmentUploadTemplate: TemplateRef<CustomAttachmentUploadContext> | undefined;
79
80
  attachmentPreviewListTemplate: TemplateRef<AttachmentPreviewListContext> | undefined;
80
81
  textareaPlaceholder: string;
81
82
  themeVersion: '1' | '2';
@@ -103,6 +104,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
103
104
  id?: string | undefined;
104
105
  images?: import("stream-chat").Attachment<DefaultStreamChatGenerics>[] | undefined;
105
106
  mime_type?: string | undefined;
107
+ isCustomAttachment?: boolean | undefined;
106
108
  };
107
109
  channelType: import("stream-chat").UR & import("../types").UnknownType & {
108
110
  image?: string | undefined;
@@ -122,6 +124,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
122
124
  deselectMessageToQuote(): void;
123
125
  getEmojiPickerContext(): EmojiPickerContext;
124
126
  getAttachmentPreviewListContext(): AttachmentPreviewListContext;
127
+ getAttachmentUploadContext(): CustomAttachmentUploadContext;
125
128
  private deleteUpload;
126
129
  private retryUpload;
127
130
  private clearFileInput;
package/lib/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { Observable, Subject } from 'rxjs';
3
3
  import type { Attachment, Channel, ChannelMemberResponse, CommandResponse, Event, ExtendableGenerics, FormatMessageResponse, LiteralStringForUnion, MessageResponseBase, Mute, ReactionResponse, User, UserResponse } from 'stream-chat';
4
+ import { AttachmentService } from './attachment.service';
4
5
  import { Icon } from './icon/icon.component';
5
6
  export declare type UnknownType = Record<string, unknown>;
6
7
  export declare type CustomTrigger = {
@@ -23,6 +24,7 @@ export declare type DefaultAttachmentType = UnknownType & {
23
24
  id?: string;
24
25
  images?: Array<Attachment<DefaultStreamChatGenerics>>;
25
26
  mime_type?: string;
27
+ isCustomAttachment?: boolean;
26
28
  };
27
29
  export declare type DefaultChannelType = UnknownType & {
28
30
  image?: string;
@@ -48,13 +50,14 @@ export declare type DefaultUserType = UnknownType & DefaultUserTypeInternal & {
48
50
  mutes?: Array<Mute<DefaultStreamChatGenerics>>;
49
51
  };
50
52
  export declare type StreamMessage<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = FormatMessageResponse<T>;
51
- export declare type AttachmentUpload = {
53
+ export declare type AttachmentUpload<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
52
54
  file: File;
53
55
  state: 'error' | 'success' | 'uploading';
54
56
  url?: string;
55
57
  type: 'image' | 'file' | 'video';
56
58
  previewUri?: string | ArrayBuffer;
57
59
  thumb_url?: string;
60
+ fromAttachment?: Attachment<T>;
58
61
  };
59
62
  export declare type MentionAutcompleteListItemContext = {
60
63
  item: MentionAutcompleteListItem;
@@ -209,3 +212,7 @@ export declare type ReadStatusContext = {
209
212
  export declare type ChannelHeaderInfoContext<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
210
213
  channel: Channel<T>;
211
214
  };
215
+ export declare type CustomAttachmentUploadContext = {
216
+ isMultipleFileUploadEnabled: boolean | undefined;
217
+ attachmentService: AttachmentService;
218
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.17.0",
3
+ "version": "4.18.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 = '4.17.0';
1
+ export const version = '4.18.0';