stream-chat-angular 1.3.0 → 2.0.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 (64) hide show
  1. package/assets/i18n/en.d.ts +1 -0
  2. package/assets/version.d.ts +1 -1
  3. package/bundles/stream-chat-angular.umd.js +1196 -365
  4. package/bundles/stream-chat-angular.umd.js.map +1 -1
  5. package/esm2015/assets/i18n/en.js +2 -1
  6. package/esm2015/assets/version.js +2 -2
  7. package/esm2015/lib/attachment-list/attachment-list.component.js +3 -4
  8. package/esm2015/lib/attachment-preview-list/attachment-preview-list.component.js +38 -0
  9. package/esm2015/lib/attachment.service.js +190 -0
  10. package/esm2015/lib/channel.service.js +53 -4
  11. package/esm2015/lib/chat-client.service.js +16 -1
  12. package/esm2015/lib/injection-tokens.js +3 -0
  13. package/esm2015/lib/is-image-attachment.js +6 -0
  14. package/esm2015/lib/message/highlight-mentions.pipe.js +23 -0
  15. package/esm2015/lib/message/message.component.js +3 -2
  16. package/esm2015/lib/message-actions-box/message-actions-box.component.js +43 -12
  17. package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +145 -0
  18. package/esm2015/lib/message-input/message-input-config.service.js +19 -0
  19. package/esm2015/lib/message-input/message-input.component.js +122 -140
  20. package/esm2015/lib/message-input/textarea/textarea.component.js +42 -0
  21. package/esm2015/lib/message-input/textarea.directive.js +69 -0
  22. package/esm2015/lib/message-input/textarea.interface.js +2 -0
  23. package/esm2015/lib/message-list/message-list.component.js +19 -3
  24. package/esm2015/lib/message-preview.js +3 -2
  25. package/esm2015/lib/modal/modal.component.js +63 -0
  26. package/esm2015/lib/notification-list/notification-list.component.js +1 -1
  27. package/esm2015/lib/notification.service.js +1 -1
  28. package/esm2015/lib/stream-autocomplete-textarea.module.js +33 -0
  29. package/esm2015/lib/stream-avatar.module.js +19 -0
  30. package/esm2015/lib/stream-chat.module.js +25 -11
  31. package/esm2015/lib/stream-textarea.module.js +31 -0
  32. package/esm2015/lib/types.js +1 -1
  33. package/esm2015/public-api.js +19 -1
  34. package/fesm2015/stream-chat-angular.js +955 -241
  35. package/fesm2015/stream-chat-angular.js.map +1 -1
  36. package/lib/attachment-preview-list/attachment-preview-list.component.d.ts +14 -0
  37. package/lib/attachment.service.d.ts +25 -0
  38. package/lib/channel.service.d.ts +6 -2
  39. package/lib/chat-client.service.d.ts +1 -0
  40. package/lib/injection-tokens.d.ts +3 -0
  41. package/lib/is-image-attachment.d.ts +2 -0
  42. package/lib/message/highlight-mentions.pipe.d.ts +8 -0
  43. package/lib/message/message.component.d.ts +1 -0
  44. package/lib/message-actions-box/message-actions-box.component.d.ts +11 -4
  45. package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +42 -0
  46. package/lib/message-input/message-input-config.service.d.ts +14 -0
  47. package/lib/message-input/message-input.component.d.ts +30 -20
  48. package/lib/message-input/textarea/textarea.component.d.ts +16 -0
  49. package/lib/message-input/textarea.directive.d.ts +21 -0
  50. package/lib/message-input/textarea.interface.d.ts +12 -0
  51. package/lib/message-list/message-list.component.d.ts +1 -1
  52. package/lib/message-preview.d.ts +1 -1
  53. package/lib/modal/modal.component.d.ts +16 -0
  54. package/lib/notification-list/notification-list.component.d.ts +3 -3
  55. package/lib/notification.service.d.ts +2 -2
  56. package/lib/stream-autocomplete-textarea.module.d.ts +11 -0
  57. package/lib/stream-avatar.module.d.ts +9 -0
  58. package/lib/stream-chat.module.d.ts +23 -19
  59. package/lib/stream-textarea.module.d.ts +9 -0
  60. package/lib/types.d.ts +7 -1
  61. package/package.json +3 -2
  62. package/public-api.d.ts +18 -0
  63. package/src/assets/i18n/en.ts +1 -0
  64. package/src/assets/version.ts +1 -1
@@ -0,0 +1,14 @@
1
+ import { Observable } from 'rxjs';
2
+ import { AttachmentService } from '../attachment.service';
3
+ import { AttachmentUpload } from '../types';
4
+ import * as i0 from "@angular/core";
5
+ export declare class AttachmentPreviewListComponent {
6
+ private attachmentService;
7
+ attachmentUploads$: Observable<AttachmentUpload[]>;
8
+ constructor(attachmentService: AttachmentService);
9
+ retryAttachmentUpload(file: File): Promise<void>;
10
+ deleteAttachment(upload: AttachmentUpload): Promise<void>;
11
+ trackByFile(_: number, item: AttachmentUpload): File;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentPreviewListComponent, never>;
13
+ static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentPreviewListComponent, "stream-attachment-preview-list", never, {}, {}, never, never>;
14
+ }
@@ -0,0 +1,25 @@
1
+ import { Observable } from 'rxjs';
2
+ import { Attachment } from 'stream-chat';
3
+ import { ChannelService } from './channel.service';
4
+ import { NotificationService } from './notification.service';
5
+ import { AttachmentUpload } from './types';
6
+ import * as i0 from "@angular/core";
7
+ export declare class AttachmentService {
8
+ private channelService;
9
+ private notificationService;
10
+ attachmentUploadInProgressCounter$: Observable<number>;
11
+ attachmentUploads$: Observable<AttachmentUpload[]>;
12
+ private attachmentUploadInProgressCounterSubject;
13
+ private attachmentUploadsSubject;
14
+ constructor(channelService: ChannelService, notificationService: NotificationService);
15
+ resetAttachmentUploads(): void;
16
+ filesSelected(fileList: FileList | null): Promise<void>;
17
+ retryAttachmentUpload(file: File): Promise<void>;
18
+ deleteAttachment(upload: AttachmentUpload): Promise<void>;
19
+ mapToAttachments(): Attachment<import("stream-chat").UnknownType>[];
20
+ createFromAttachments(attachments: Attachment[]): void;
21
+ private createPreview;
22
+ private uploadAttachments;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentService, never>;
24
+ static ɵprov: i0.ɵɵInjectableDeclaration<AttachmentService>;
25
+ }
@@ -1,6 +1,6 @@
1
1
  import { ApplicationRef, NgZone } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelSort, Event } from 'stream-chat';
3
+ import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelSort, Event, UserResponse } from 'stream-chat';
4
4
  import { ChatClientService, Notification } from './chat-client.service';
5
5
  import { MessageReactionType } from './message-reactions/message-reactions.component';
6
6
  import { AttachmentUpload, StreamMessage } from './types';
@@ -39,10 +39,13 @@ export declare class ChannelService {
39
39
  loadMoreChannels(): Promise<void>;
40
40
  addReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
41
41
  removeReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
42
- sendMessage(text: string, attachments?: Attachment[]): Promise<void>;
42
+ sendMessage(text: string, attachments?: Attachment[], mentionedUsers?: UserResponse[]): Promise<void>;
43
43
  resendMessage(message: StreamMessage): Promise<void>;
44
+ updateMessage(message: StreamMessage): Promise<void>;
45
+ deleteMessage(message: StreamMessage): Promise<void>;
44
46
  uploadAttachments(uploads: AttachmentUpload[]): Promise<AttachmentUpload[]>;
45
47
  deleteAttachment(attachmentUpload: AttachmentUpload): Promise<void>;
48
+ autocompleteMembers(searchTerm: string): Promise<import("stream-chat").ChannelMemberResponse<import("stream-chat").UnknownType>[]>;
46
49
  private sendMessageRequest;
47
50
  private handleNotification;
48
51
  private handleRemovedFromChannelNotification;
@@ -51,6 +54,7 @@ export declare class ChannelService {
51
54
  private addChannelFromNotification;
52
55
  private removeFromChannelList;
53
56
  private watchForActiveChannelEvents;
57
+ private messageUpdated;
54
58
  private messageReactionEventReceived;
55
59
  private formatMessage;
56
60
  private isStreamMessage;
@@ -19,6 +19,7 @@ export declare class ChatClientService {
19
19
  constructor(ngZone: NgZone, appRef: ApplicationRef, notificationService: NotificationService);
20
20
  init(apiKey: string, userId: string, userToken: string): Promise<void>;
21
21
  flagMessage(messageId: string): Promise<void>;
22
+ autocompleteUsers(searchTerm: string): Promise<import("stream-chat").UserResponse<import("stream-chat").UnknownType>[]>;
22
23
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatClientService, never>;
23
24
  static ɵprov: i0.ɵɵInjectableDeclaration<ChatClientService>;
24
25
  }
@@ -0,0 +1,3 @@
1
+ import { InjectionToken, Type } from '@angular/core';
2
+ import { TextareaInterface } from './message-input/textarea.interface';
3
+ export declare const textareaInjectionToken: InjectionToken<Type<TextareaInterface>>;
@@ -0,0 +1,2 @@
1
+ import { Attachment } from 'stream-chat';
2
+ export declare const isImageAttachment: (attachment: Attachment) => boolean;
@@ -0,0 +1,8 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import { UserResponse } from 'stream-chat';
3
+ import * as i0 from "@angular/core";
4
+ export declare class HighlightMentionsPipe implements PipeTransform {
5
+ transform(value?: string, mentionedUsers?: UserResponse[]): string;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<HighlightMentionsPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<HighlightMentionsPipe, "highlightMentions">;
8
+ }
@@ -12,6 +12,7 @@ export declare class MessageComponent {
12
12
  areReactionsEnabled: boolean | undefined;
13
13
  canReactToMessage: boolean | undefined;
14
14
  isLastSentMessage: boolean | undefined;
15
+ isEditing: boolean | undefined;
15
16
  isActionBoxOpen: boolean;
16
17
  isReactionSelectorOpen: boolean;
17
18
  isPressedOnMobile: boolean;
@@ -1,18 +1,23 @@
1
1
  import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { ChannelService } from '../channel.service';
2
3
  import { ChatClientService } from '../chat-client.service';
3
4
  import { NotificationService } from '../notification.service';
4
5
  import { StreamMessage } from '../types';
5
6
  import * as i0 from "@angular/core";
6
- export declare type MessageActions = 'edit' | 'delete' | 'pin' | 'quote' | 'flag' | 'mute';
7
+ export declare type MessageActions = 'edit' | 'delete' | 'edit-any' | 'delete-any' | 'pin' | 'quote' | 'flag' | 'mute';
7
8
  export declare class MessageActionsBoxComponent implements OnChanges {
8
9
  private chatClientService;
9
10
  private notificationService;
11
+ private channelService;
10
12
  isOpen: boolean;
11
13
  isMine: boolean;
12
14
  message: StreamMessage | undefined;
13
15
  enabledActions: MessageActions[];
14
16
  readonly displayedActionsCount: EventEmitter<number>;
15
- constructor(chatClientService: ChatClientService, notificationService: NotificationService);
17
+ readonly isEditing: EventEmitter<boolean>;
18
+ isEditModalOpen: boolean;
19
+ private messageInput;
20
+ constructor(chatClientService: ChatClientService, notificationService: NotificationService, channelService: ChannelService);
16
21
  ngOnChanges(changes: SimpleChanges): void;
17
22
  get isQuoteVisible(): boolean;
18
23
  get isEditVisible(): boolean;
@@ -25,7 +30,9 @@ export declare class MessageActionsBoxComponent implements OnChanges {
25
30
  muteClicked(): void;
26
31
  quoteClicked(): void;
27
32
  editClicked(): void;
28
- deleteClicked(): void;
33
+ sendClicked(): void;
34
+ modalClosed(): void;
35
+ deleteClicked(): Promise<void>;
29
36
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageActionsBoxComponent, never>;
30
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageActionsBoxComponent, "stream-message-actions-box", never, { "isOpen": "isOpen"; "isMine": "isMine"; "message": "message"; "enabledActions": "enabledActions"; }, { "displayedActionsCount": "displayedActionsCount"; }, never, never>;
37
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageActionsBoxComponent, "stream-message-actions-box", never, { "isOpen": "isOpen"; "isMine": "isMine"; "message": "message"; "enabledActions": "enabledActions"; }, { "displayedActionsCount": "displayedActionsCount"; "isEditing": "isEditing"; }, never, never>;
31
38
  }
@@ -0,0 +1,42 @@
1
+ import { EventEmitter, OnChanges, SimpleChanges, TemplateRef } from '@angular/core';
2
+ import { MentionConfig } from 'angular-mentions';
3
+ import { MentionAutcompleteListItemContext, MentionAutcompleteListItem } from '../../types';
4
+ import { UserResponse } from 'stream-chat';
5
+ import { ChannelService } from '../../channel.service';
6
+ import { TextareaInterface } from '../textarea.interface';
7
+ import { ChatClientService } from '../../chat-client.service';
8
+ import * as i0 from "@angular/core";
9
+ export declare class AutocompleteTextareaComponent implements TextareaInterface, OnChanges {
10
+ private channelService;
11
+ private chatClientService;
12
+ class: string;
13
+ value: string;
14
+ areMentionsEnabled: boolean | undefined;
15
+ mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
16
+ mentionScope: 'channel' | 'application';
17
+ readonly valueChange: EventEmitter<string>;
18
+ readonly send: EventEmitter<void>;
19
+ readonly userMentions: EventEmitter<UserResponse<import("stream-chat").UnknownType>[]>;
20
+ private readonly labelKey;
21
+ private readonly triggerChar;
22
+ autocompleteConfig: MentionConfig;
23
+ private messageInput;
24
+ private subscriptions;
25
+ private mentionedUsers;
26
+ private userMentionConfig;
27
+ private searchTerm$;
28
+ constructor(channelService: ChannelService, chatClientService: ChatClientService);
29
+ ngOnChanges(changes: SimpleChanges): void;
30
+ filter(searchString: string, items: {
31
+ autocompleteLabel: string;
32
+ }[]): any[];
33
+ mentioned(item: MentionAutcompleteListItem, triggerChar?: string): string;
34
+ autcompleteSearchTermChanged(searchTerm: string): void;
35
+ inputChanged(): void;
36
+ inputLeft(): void;
37
+ sent(event: Event): void;
38
+ private updateMentionOptions;
39
+ private updateMentionedUsersFromText;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<AutocompleteTextareaComponent, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<AutocompleteTextareaComponent, "stream-autocomplete-textarea", never, { "value": "value"; "areMentionsEnabled": "areMentionsEnabled"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "mentionScope": "mentionScope"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never, never>;
42
+ }
@@ -0,0 +1,14 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import { MentionAutcompleteListItemContext } from '../types';
3
+ import * as i0 from "@angular/core";
4
+ export declare class MessageInputConfigService {
5
+ isFileUploadEnabled: boolean | undefined;
6
+ areMentionsEnabled: boolean | undefined;
7
+ mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
8
+ acceptedFileTypes: string[] | undefined;
9
+ isMultipleFileUploadEnabled: boolean | undefined;
10
+ mentionScope: 'channel' | 'application' | undefined;
11
+ constructor();
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputConfigService, never>;
13
+ static ɵprov: i0.ɵɵInjectableDeclaration<MessageInputConfigService>;
14
+ }
@@ -1,36 +1,46 @@
1
- import { OnDestroy } from '@angular/core';
1
+ import { ComponentFactoryResolver, ComponentRef, EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef, Type } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+ import { UserResponse } from 'stream-chat';
4
+ import { AttachmentService } from '../attachment.service';
2
5
  import { ChannelService } from '../channel.service';
3
6
  import { NotificationService } from '../notification.service';
4
- import { AttachmentUpload } from '../types';
7
+ import { AttachmentUpload, MentionAutcompleteListItemContext, StreamMessage } from '../types';
8
+ import { MessageInputConfigService } from './message-input-config.service';
9
+ import { TextareaInterface } from './textarea.interface';
5
10
  import * as i0 from "@angular/core";
6
- export declare class MessageInputComponent implements OnDestroy {
11
+ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestroy {
7
12
  private channelService;
8
13
  private notificationService;
9
- isFileUploadEnabled: boolean;
14
+ private attachmentService;
15
+ private configService;
16
+ private textareaType;
17
+ private componentFactoryResolver;
18
+ isFileUploadEnabled: boolean | undefined;
19
+ areMentionsEnabled: boolean | undefined;
20
+ mentionScope: 'channel' | 'application' | undefined;
21
+ mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
10
22
  acceptedFileTypes: string[] | undefined;
11
- isMultipleFileUploadEnabled: boolean;
12
- attachmentUploads: AttachmentUpload[];
23
+ isMultipleFileUploadEnabled: boolean | undefined;
24
+ message: StreamMessage | undefined;
25
+ readonly messageUpdate: EventEmitter<void>;
13
26
  isFileUploadAuthorized: boolean | undefined;
14
- private attachmentUploadInProgressCounter;
15
- private messageInput;
27
+ attachmentUploads$: Observable<AttachmentUpload[]>;
28
+ textareaValue: string;
29
+ textareaRef: ComponentRef<TextareaInterface> | undefined;
30
+ mentionedUsers: UserResponse[];
16
31
  private fileInput;
32
+ private textareaAnchor;
17
33
  private subscriptions;
18
34
  private hideNotification;
19
- constructor(channelService: ChannelService, notificationService: NotificationService);
35
+ constructor(channelService: ChannelService, notificationService: NotificationService, attachmentService: AttachmentService, configService: MessageInputConfigService, textareaType: Type<TextareaInterface>, componentFactoryResolver: ComponentFactoryResolver);
36
+ ngOnInit(): void;
37
+ ngOnChanges(changes: SimpleChanges): void;
20
38
  ngOnDestroy(): void;
21
- messageSent(event?: Event): Promise<void>;
39
+ messageSent(): Promise<void>;
22
40
  get accept(): string;
23
41
  filesSelected(fileList: FileList | null): Promise<void>;
24
- retryAttachmentUpload(file: File): Promise<void>;
25
- deleteAttachment(upload: AttachmentUpload): Promise<void>;
26
- trackByFile(_: number, item: {
27
- file: File;
28
- state: 'error' | 'success' | 'uploading';
29
- url?: string;
30
- }): File;
31
- private createPreview;
32
- private uploadAttachments;
33
42
  private clearFileInput;
43
+ private get isUpdate();
34
44
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageInputComponent, never>;
35
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "acceptedFileTypes": "acceptedFileTypes"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; }, {}, never, never>;
45
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageInputComponent, "stream-message-input", never, { "isFileUploadEnabled": "isFileUploadEnabled"; "areMentionsEnabled": "areMentionsEnabled"; "mentionScope": "mentionScope"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "acceptedFileTypes": "acceptedFileTypes"; "isMultipleFileUploadEnabled": "isMultipleFileUploadEnabled"; "message": "message"; }, { "messageUpdate": "messageUpdate"; }, never, never>;
36
46
  }
@@ -0,0 +1,16 @@
1
+ import { EventEmitter, OnChanges } from '@angular/core';
2
+ import { TextareaInterface } from '../textarea.interface';
3
+ import * as i0 from "@angular/core";
4
+ export declare class TextareaComponent implements TextareaInterface, OnChanges {
5
+ class: string;
6
+ value: string;
7
+ readonly valueChange: EventEmitter<string>;
8
+ readonly send: EventEmitter<void>;
9
+ private messageInput;
10
+ constructor();
11
+ ngOnChanges(): void;
12
+ inputChanged(): void;
13
+ sent(event: Event): void;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<TextareaComponent, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<TextareaComponent, "stream-textarea", never, { "value": "value"; }, { "valueChange": "valueChange"; "send": "send"; }, never, never>;
16
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentRef, EventEmitter, OnChanges, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
2
+ import { UserResponse } from 'stream-chat';
3
+ import { MentionAutcompleteListItemContext } from '../types';
4
+ import { TextareaInterface } from './textarea.interface';
5
+ import * as i0 from "@angular/core";
6
+ export declare class TextareaDirective implements OnChanges {
7
+ viewContainerRef: ViewContainerRef;
8
+ componentRef: ComponentRef<TextareaInterface> | undefined;
9
+ areMentionsEnabled: boolean | undefined;
10
+ mentionAutocompleteItemTemplate: TemplateRef<MentionAutcompleteListItemContext> | undefined;
11
+ mentionScope?: 'channel' | 'application';
12
+ value: string;
13
+ readonly valueChange: EventEmitter<string>;
14
+ readonly send: EventEmitter<void>;
15
+ readonly userMentions: EventEmitter<UserResponse<import("stream-chat").UnknownType>[]>;
16
+ private subscriptions;
17
+ constructor(viewContainerRef: ViewContainerRef);
18
+ ngOnChanges(changes: SimpleChanges): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<TextareaDirective, never>;
20
+ static ɵdir: i0.ɵɵDirectiveDeclaration<TextareaDirective, "[streamTextarea]", never, { "componentRef": "componentRef"; "areMentionsEnabled": "areMentionsEnabled"; "mentionAutocompleteItemTemplate": "mentionAutocompleteItemTemplate"; "mentionScope": "mentionScope"; "value": "value"; }, { "valueChange": "valueChange"; "send": "send"; "userMentions": "userMentions"; }, never>;
21
+ }
@@ -0,0 +1,12 @@
1
+ import { EventEmitter, OnChanges, TemplateRef } from '@angular/core';
2
+ import { UserResponse } from 'stream-chat';
3
+ import { MentionAutcompleteListItemContext } from '../types';
4
+ export interface TextareaInterface extends OnChanges {
5
+ value: string;
6
+ valueChange: EventEmitter<string>;
7
+ send: EventEmitter<void>;
8
+ userMentions?: EventEmitter<UserResponse[]>;
9
+ areMentionsEnabled?: boolean;
10
+ mentionAutocompleteItemTemplate?: TemplateRef<MentionAutcompleteListItemContext> | undefined;
11
+ mentionScope?: 'channel' | 'application';
12
+ }
@@ -13,7 +13,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
13
13
  private imageLoadService;
14
14
  messageTemplate: TemplateRef<any> | undefined;
15
15
  areReactionsEnabled: boolean;
16
- enabledMessageActionsInput: MessageActions[] | undefined;
16
+ enabledMessageActionsInput: MessageActions[];
17
17
  messages$: Observable<StreamMessage[]>;
18
18
  canReactToMessage: boolean | undefined;
19
19
  enabledMessageActions: MessageActions[];
@@ -1,2 +1,2 @@
1
1
  import { Attachment, MessageResponse, UserResponse } from 'stream-chat';
2
- export declare const createMessagePreview: (user: UserResponse, text: string, attachments: Attachment[]) => MessageResponse<import("stream-chat").UnknownType, import("stream-chat").UnknownType, import("stream-chat").LiteralStringForUnion, import("stream-chat").UnknownType, import("stream-chat").UnknownType, import("stream-chat").UnknownType>;
2
+ export declare const createMessagePreview: (user: UserResponse, text: string, attachments: Attachment[], mentionedUsers: UserResponse[]) => MessageResponse<import("stream-chat").UnknownType, import("stream-chat").UnknownType, import("stream-chat").LiteralStringForUnion, import("stream-chat").UnknownType, import("stream-chat").UnknownType, import("stream-chat").UnknownType>;
@@ -0,0 +1,16 @@
1
+ import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ModalComponent implements OnChanges {
4
+ isOpen: boolean;
5
+ readonly isOpenChange: EventEmitter<boolean>;
6
+ private content;
7
+ constructor();
8
+ ngOnChanges(changes: SimpleChanges): void;
9
+ close(): void;
10
+ private watchForEscPress;
11
+ private stopWatchForEscPress;
12
+ private watchForOutsideClicks;
13
+ private stopWatchForOutsideClicks;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<ModalComponent, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<ModalComponent, "stream-modal", never, { "isOpen": "isOpen"; }, { "isOpenChange": "isOpenChange"; }, never, ["*"]>;
16
+ }
@@ -1,11 +1,11 @@
1
1
  import { Observable } from 'rxjs';
2
- import { Notification, NotificationService } from '../notification.service';
2
+ import { NotificationPayload, NotificationService } from '../notification.service';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class NotificationListComponent {
5
5
  private notificationService;
6
- notifications$: Observable<Notification[]>;
6
+ notifications$: Observable<NotificationPayload[]>;
7
7
  constructor(notificationService: NotificationService);
8
- trackByItem(_: number, item: Notification): Notification;
8
+ trackByItem(_: number, item: NotificationPayload): NotificationPayload;
9
9
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationListComponent, never>;
10
10
  static ɵcmp: i0.ɵɵComponentDeclaration<NotificationListComponent, "stream-notification-list", never, {}, {}, never, never>;
11
11
  }
@@ -1,12 +1,12 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare type NotificationType = 'success' | 'error';
4
- export declare type Notification = {
4
+ export declare type NotificationPayload = {
5
5
  type: NotificationType;
6
6
  text: string;
7
7
  };
8
8
  export declare class NotificationService {
9
- notifications$: Observable<Notification[]>;
9
+ notifications$: Observable<NotificationPayload[]>;
10
10
  private notificationsSubject;
11
11
  constructor();
12
12
  addTemporaryNotification(text: string, type?: NotificationType, timeout?: number): () => void;
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./message-input/autocomplete-textarea/autocomplete-textarea.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@ngx-translate/core";
5
+ import * as i4 from "angular-mentions";
6
+ import * as i5 from "./stream-avatar.module";
7
+ export declare class StreamAutocompleteTextareaModule {
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<StreamAutocompleteTextareaModule, never>;
9
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StreamAutocompleteTextareaModule, [typeof i1.AutocompleteTextareaComponent], [typeof i2.CommonModule, typeof i3.TranslateModule, typeof i4.MentionModule, typeof i5.StreamAvatarModule], [typeof i1.AutocompleteTextareaComponent]>;
10
+ static ɵinj: i0.ɵɵInjectorDeclaration<StreamAutocompleteTextareaModule>;
11
+ }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./avatar/avatar.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@ngx-translate/core";
5
+ export declare class StreamAvatarModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<StreamAvatarModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StreamAvatarModule, [typeof i1.AvatarComponent], [typeof i2.CommonModule, typeof i3.TranslateModule], [typeof i1.AvatarComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<StreamAvatarModule>;
9
+ }
@@ -1,24 +1,28 @@
1
1
  import * as i0 from "@angular/core";
2
- import * as i1 from "./avatar/avatar.component";
3
- import * as i2 from "./channel/channel.component";
4
- import * as i3 from "./channel-header/channel-header.component";
5
- import * as i4 from "./channel-list/channel-list.component";
6
- import * as i5 from "./channel-preview/channel-preview.component";
7
- import * as i6 from "./message/message.component";
8
- import * as i7 from "./message-input/message-input.component";
9
- import * as i8 from "./message-list/message-list.component";
10
- import * as i9 from "./loading-indicator/loading-indicator.component";
11
- import * as i10 from "./icon/icon.component";
12
- import * as i11 from "./message-actions-box/message-actions-box.component";
13
- import * as i12 from "./attachment-list/attachment-list.component";
14
- import * as i13 from "./message-reactions/message-reactions.component";
15
- import * as i14 from "./notification/notification.component";
16
- import * as i15 from "./notification-list/notification-list.component";
17
- import * as i16 from "@angular/common";
18
- import * as i17 from "@ctrl/ngx-emoji-mart/ngx-emoji";
19
- import * as i18 from "@ngx-translate/core";
2
+ import * as i1 from "./channel/channel.component";
3
+ import * as i2 from "./channel-header/channel-header.component";
4
+ import * as i3 from "./channel-list/channel-list.component";
5
+ import * as i4 from "./channel-preview/channel-preview.component";
6
+ import * as i5 from "./message/message.component";
7
+ import * as i6 from "./message-input/message-input.component";
8
+ import * as i7 from "./message-list/message-list.component";
9
+ import * as i8 from "./loading-indicator/loading-indicator.component";
10
+ import * as i9 from "./icon/icon.component";
11
+ import * as i10 from "./message-actions-box/message-actions-box.component";
12
+ import * as i11 from "./attachment-list/attachment-list.component";
13
+ import * as i12 from "./message-reactions/message-reactions.component";
14
+ import * as i13 from "./notification/notification.component";
15
+ import * as i14 from "./notification-list/notification-list.component";
16
+ import * as i15 from "./attachment-preview-list/attachment-preview-list.component";
17
+ import * as i16 from "./modal/modal.component";
18
+ import * as i17 from "./message-input/textarea.directive";
19
+ import * as i18 from "./message/highlight-mentions.pipe";
20
+ import * as i19 from "@angular/common";
21
+ import * as i20 from "@ctrl/ngx-emoji-mart/ngx-emoji";
22
+ import * as i21 from "@ngx-translate/core";
23
+ import * as i22 from "./stream-avatar.module";
20
24
  export declare class StreamChatModule {
21
25
  static ɵfac: i0.ɵɵFactoryDeclaration<StreamChatModule, never>;
22
- static ɵmod: i0.ɵɵNgModuleDeclaration<StreamChatModule, [typeof i1.AvatarComponent, typeof i2.ChannelComponent, typeof i3.ChannelHeaderComponent, typeof i4.ChannelListComponent, typeof i5.ChannelPreviewComponent, typeof i6.MessageComponent, typeof i7.MessageInputComponent, typeof i8.MessageListComponent, typeof i9.LoadingIndicatorComponent, typeof i10.IconComponent, typeof i11.MessageActionsBoxComponent, typeof i12.AttachmentListComponent, typeof i13.MessageReactionsComponent, typeof i14.NotificationComponent, typeof i15.NotificationListComponent], [typeof i16.CommonModule, typeof i17.EmojiModule, typeof i18.TranslateModule], [typeof i1.AvatarComponent, typeof i2.ChannelComponent, typeof i3.ChannelHeaderComponent, typeof i4.ChannelListComponent, typeof i5.ChannelPreviewComponent, typeof i6.MessageComponent, typeof i7.MessageInputComponent, typeof i8.MessageListComponent, typeof i9.LoadingIndicatorComponent, typeof i10.IconComponent, typeof i11.MessageActionsBoxComponent, typeof i12.AttachmentListComponent, typeof i13.MessageReactionsComponent, typeof i14.NotificationComponent, typeof i15.NotificationListComponent]>;
26
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StreamChatModule, [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.LoadingIndicatorComponent, typeof i9.IconComponent, typeof i10.MessageActionsBoxComponent, typeof i11.AttachmentListComponent, typeof i12.MessageReactionsComponent, typeof i13.NotificationComponent, typeof i14.NotificationListComponent, typeof i15.AttachmentPreviewListComponent, typeof i16.ModalComponent, typeof i17.TextareaDirective, typeof i18.HighlightMentionsPipe], [typeof i19.CommonModule, typeof i20.EmojiModule, typeof i21.TranslateModule, typeof i22.StreamAvatarModule], [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.LoadingIndicatorComponent, typeof i9.IconComponent, typeof i10.MessageActionsBoxComponent, typeof i11.AttachmentListComponent, typeof i12.MessageReactionsComponent, typeof i13.NotificationComponent, typeof i14.NotificationListComponent, typeof i15.AttachmentPreviewListComponent, typeof i16.ModalComponent, typeof i18.HighlightMentionsPipe]>;
23
27
  static ɵinj: i0.ɵɵInjectorDeclaration<StreamChatModule>;
24
28
  }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./message-input/textarea/textarea.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@ngx-translate/core";
5
+ export declare class StreamTextareaModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<StreamTextareaModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<StreamTextareaModule, [typeof i1.TextareaComponent], [typeof i2.CommonModule, typeof i3.TranslateModule], [typeof i1.TextareaComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<StreamTextareaModule>;
9
+ }
package/lib/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
1
+ import type { ChannelMemberResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
2
2
  export declare type UnknownType = Record<string, unknown>;
3
3
  export declare type CustomTrigger = {
4
4
  [key: string]: {
@@ -47,3 +47,9 @@ export declare type AttachmentUpload = {
47
47
  type: 'image' | 'file';
48
48
  previewUri?: string | ArrayBuffer;
49
49
  };
50
+ export declare type MentionAutcompleteListItemContext = {
51
+ item: MentionAutcompleteListItem;
52
+ };
53
+ export declare type MentionAutcompleteListItem = (ChannelMemberResponse | UserResponse) & {
54
+ autocompleteLabel: string;
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "1.3.0",
3
+ "version": "2.0.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/",
@@ -13,9 +13,10 @@
13
13
  "@angular/core": "^12.2.0 || ^13.0.0",
14
14
  "@ngx-translate/core": "^13.0.0 || ^14.0.0",
15
15
  "stream-chat": "^4.3.0",
16
- "stream-chat-css": "1.0.18"
16
+ "stream-chat-css": "^1.0.23"
17
17
  },
18
18
  "dependencies": {
19
+ "angular-mentions": "^1.4.0",
19
20
  "@ctrl/ngx-emoji-mart": "^6.0.1",
20
21
  "dayjs": "^1.10.7",
21
22
  "pretty-bytes": "^5.6.0",
package/public-api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './lib/chat-client.service';
2
2
  export * from './lib/channel.service';
3
3
  export * from './lib/theme.service';
4
+ export * from './lib/attachment.service';
4
5
  export * from './lib/stream-i18n.service';
5
6
  export * from './lib/avatar/avatar.component';
6
7
  export * from './lib/icon/icon.component';
@@ -14,12 +15,29 @@ export * from './lib/channel-list/channel-list-toggle.service';
14
15
  export * from './lib/message/message.component';
15
16
  export * from './lib/message/parse-date';
16
17
  export * from './lib/message/read-by-text';
18
+ export * from './lib/message/highlight-mentions.pipe';
17
19
  export * from './lib/message-input/message-input.component';
20
+ export * from './lib/message-input/textarea/textarea.component';
21
+ export * from './lib/message-input/autocomplete-textarea/autocomplete-textarea.component';
22
+ export * from './lib/message-input/message-input-config.service';
23
+ export * from './lib/message-input/textarea.directive';
24
+ export * from './lib/message-input/textarea.interface';
18
25
  export * from './lib/message-list/message-list.component';
19
26
  export * from './lib/message-list/image-load.service';
27
+ export * from './lib/message-list/group-styles';
20
28
  export * from './lib/attachment-list/attachment-list.component';
29
+ export * from './lib/attachment-preview-list/attachment-preview-list.component';
21
30
  export * from './lib/message-reactions/message-reactions.component';
22
31
  export * from './lib/notification/notification.component';
23
32
  export * from './lib/notification-list/notification-list.component';
33
+ export * from './lib/modal/modal.component';
34
+ export * from './lib/read-by';
35
+ export * from './lib/is-image-attachment';
36
+ export * from './lib/device-width';
37
+ export * from './lib/message-preview';
38
+ export * from './lib/notification.service';
24
39
  export * from './lib/stream-chat.module';
40
+ export * from './lib/stream-autocomplete-textarea.module';
41
+ export * from './lib/stream-textarea.module';
42
+ export * from './lib/injection-tokens';
25
43
  export * from './lib/types';
@@ -25,6 +25,7 @@ export const en = {
25
25
  'Error unmuting a user ...': 'Error unmuting a user ...',
26
26
  'Error uploading file': 'Error uploading file',
27
27
  'Error uploading image': 'Error uploading image',
28
+ 'Error deleting attachment': 'Error deleting attachment',
28
29
  'Error · Unsent': 'Error · Unsent',
29
30
  'Error: {{ errorMessage }}': 'Error: {{ errorMessage }}',
30
31
  Flag: 'Flag',
@@ -1 +1 @@
1
- export const version = '1.3.0';
1
+ export const version = '2.0.0';