stream-chat-angular 2.20.2 → 3.0.0-beta.10
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/README.md +44 -12
- package/assets/version.d.ts +1 -1
- package/bundles/stream-chat-angular.umd.js +780 -534
- package/bundles/stream-chat-angular.umd.js.map +1 -1
- package/esm2015/assets/version.js +2 -2
- package/esm2015/lib/attachment-list/attachment-list.component.js +27 -15
- package/esm2015/lib/attachment-preview-list/attachment-preview-list.component.js +28 -22
- package/esm2015/lib/attachment.service.js +11 -5
- package/esm2015/lib/avatar-placeholder/avatar-placeholder.component.js +41 -0
- package/esm2015/lib/channel-header/channel-header.component.js +26 -12
- package/esm2015/lib/channel-list/channel-list.component.js +23 -13
- package/esm2015/lib/channel-preview/channel-preview.component.js +3 -3
- package/esm2015/lib/channel.service.js +28 -35
- package/esm2015/lib/chat-client.service.js +5 -4
- package/esm2015/lib/custom-templates.service.js +139 -0
- package/esm2015/lib/icon-placeholder/icon-placeholder.component.js +34 -0
- package/esm2015/lib/loading-indicator-placeholder/loading-indicator-placeholder.component.js +42 -0
- package/esm2015/lib/message/message.component.js +74 -29
- package/esm2015/lib/message-actions-box/message-actions-box.component.js +114 -99
- package/esm2015/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.js +13 -13
- package/esm2015/lib/message-input/message-input-config.service.js +1 -1
- package/esm2015/lib/message-input/message-input.component.js +56 -45
- package/esm2015/lib/message-input/textarea.directive.js +2 -18
- package/esm2015/lib/message-input/textarea.interface.js +1 -1
- package/esm2015/lib/message-list/message-list.component.js +32 -93
- package/esm2015/lib/message-preview.js +4 -17
- package/esm2015/lib/message-reactions/message-reactions.component.js +3 -3
- package/esm2015/lib/modal/modal.component.js +9 -6
- package/esm2015/lib/notification/notification.component.js +5 -2
- package/esm2015/lib/notification-list/notification-list.component.js +12 -10
- package/esm2015/lib/read-by.js +1 -1
- package/esm2015/lib/stream-avatar.module.js +5 -4
- package/esm2015/lib/stream-chat.module.js +13 -3
- package/esm2015/lib/thread/thread.component.js +19 -11
- package/esm2015/lib/types.js +1 -1
- package/esm2015/public-api.js +5 -1
- package/fesm2015/stream-chat-angular.js +723 -449
- package/fesm2015/stream-chat-angular.js.map +1 -1
- package/lib/attachment-list/attachment-list.component.d.ts +12 -8
- package/lib/attachment-preview-list/attachment-preview-list.component.d.ts +17 -7
- package/lib/attachment.service.d.ts +1 -1
- package/lib/avatar-placeholder/avatar-placeholder.component.d.ts +25 -0
- package/lib/channel-header/channel-header.component.d.ts +15 -12
- package/lib/channel-list/channel-list.component.d.ts +14 -11
- package/lib/channel-preview/channel-preview.component.d.ts +3 -2
- package/lib/channel.service.d.ts +32 -31
- package/lib/chat-client.service.d.ts +12 -11
- package/lib/custom-templates.service.d.ts +132 -0
- package/lib/icon-placeholder/icon-placeholder.component.d.ts +22 -0
- package/lib/loading-indicator-placeholder/loading-indicator-placeholder.component.d.ts +21 -0
- package/lib/message/message.component.d.ts +42 -30
- package/lib/message-actions-box/message-actions-box.component.d.ts +22 -26
- package/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.d.ts +7 -11
- package/lib/message-input/message-input-config.service.d.ts +0 -19
- package/lib/message-input/message-input.component.d.ts +40 -26
- package/lib/message-input/textarea.directive.d.ts +3 -6
- package/lib/message-input/textarea.interface.d.ts +1 -4
- package/lib/message-list/group-styles.d.ts +1 -1
- package/lib/message-list/message-list.component.d.ts +10 -34
- package/lib/message-preview.d.ts +2 -1
- package/lib/message-reactions/message-reactions.component.d.ts +4 -5
- package/lib/modal/modal.component.d.ts +7 -3
- package/lib/notification/notification.component.d.ts +6 -1
- package/lib/notification-list/notification-list.component.d.ts +4 -2
- package/lib/read-by.d.ts +2 -1
- package/lib/stream-avatar.module.d.ts +4 -3
- package/lib/stream-chat.module.d.ts +6 -4
- package/lib/thread/thread.component.d.ts +6 -3
- package/lib/types.d.ts +115 -9
- package/package.json +2 -3
- package/public-api.d.ts +4 -0
- package/src/assets/styles/assets/EmojiOneColor.woff2 +0 -0
- package/src/assets/styles/assets/NotoColorEmoji-flags.woff2 +0 -0
- package/src/assets/styles/assets/Poweredby_100px-White_VertText.png +0 -0
- package/src/assets/styles/assets/str-chat__reaction-list-sprite@1x.png +0 -0
- package/src/assets/styles/assets/str-chat__reaction-list-sprite@2x.png +0 -0
- package/src/assets/styles/assets/str-chat__reaction-list-sprite@3x.png +0 -0
- package/src/assets/styles/css/index.css +1 -0
- package/src/assets/styles/css/index.css.map +1 -0
- package/src/assets/styles/scss/ActionsBox.scss +56 -0
- package/src/assets/styles/scss/Attachment.scss +227 -0
- package/src/assets/styles/scss/AttachmentActions.scss +44 -0
- package/src/assets/styles/scss/Audio.scss +112 -0
- package/src/assets/styles/scss/Avatar.scss +79 -0
- package/src/assets/styles/scss/Card.scss +100 -0
- package/src/assets/styles/scss/ChannelHeader.scss +284 -0
- package/src/assets/styles/scss/ChannelList.scss +117 -0
- package/src/assets/styles/scss/ChannelListMessenger.scss +9 -0
- package/src/assets/styles/scss/ChannelPreview.scss +108 -0
- package/src/assets/styles/scss/ChannelSearch.scss +111 -0
- package/src/assets/styles/scss/ChatDown.scss +15 -0
- package/src/assets/styles/scss/DateSeparator.scss +51 -0
- package/src/assets/styles/scss/EditMessageForm.scss +112 -0
- package/src/assets/styles/scss/EventComponent.scss +48 -0
- package/src/assets/styles/scss/Gallery.scss +135 -0
- package/src/assets/styles/scss/InfiniteScrollPaginator.scss +6 -0
- package/src/assets/styles/scss/LoadMoreButton.scss +44 -0
- package/src/assets/styles/scss/LoadingChannels.scss +70 -0
- package/src/assets/styles/scss/LoadingIndicator.scss +38 -0
- package/src/assets/styles/scss/Message.scss +1261 -0
- package/src/assets/styles/scss/MessageActions.scss +112 -0
- package/src/assets/styles/scss/MessageCommerce.scss +564 -0
- package/src/assets/styles/scss/MessageInput.scss +385 -0
- package/src/assets/styles/scss/MessageInputFlat.scss +305 -0
- package/src/assets/styles/scss/MessageList.scss +203 -0
- package/src/assets/styles/scss/MessageLivestream.scss +325 -0
- package/src/assets/styles/scss/MessageNotification.scss +49 -0
- package/src/assets/styles/scss/MessageRepliesCountButton.scss +33 -0
- package/src/assets/styles/scss/MessageTeam.scss +617 -0
- package/src/assets/styles/scss/Modal.scss +77 -0
- package/src/assets/styles/scss/ReactionList.scss +183 -0
- package/src/assets/styles/scss/ReactionSelector.scss +212 -0
- package/src/assets/styles/scss/SendButton.scss +14 -0
- package/src/assets/styles/scss/SimpleReactionsList.scss +76 -0
- package/src/assets/styles/scss/SmallMessageInput.scss +172 -0
- package/src/assets/styles/scss/Thread.scss +306 -0
- package/src/assets/styles/scss/Tooltip.scss +38 -0
- package/src/assets/styles/scss/TypingIndicator.scss +75 -0
- package/src/assets/styles/scss/VirtualMessage.scss +291 -0
- package/src/assets/styles/scss/_base.scss +206 -0
- package/src/assets/styles/scss/_variables.scss +158 -0
- package/src/assets/styles/scss/index.scss +50 -0
- package/src/assets/styles/scss/vendor/emoji-mart.scss +495 -0
- package/src/assets/styles/scss/vendor/mml-react.scss +1749 -0
- package/src/assets/styles/scss/vendor/react-file-utils.scss +378 -0
- package/src/assets/styles/scss/vendor/react-image-gallery.scss +224 -0
- package/src/assets/version.ts +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { OnChanges } from '@angular/core';
|
|
2
2
|
import { Action, Attachment } from 'stream-chat';
|
|
3
3
|
import { ImageLoadService } from '../message-list/image-load.service';
|
|
4
|
-
import {
|
|
4
|
+
import { ModalContext, DefaultStreamChatGenerics } from '../types';
|
|
5
5
|
import { ChannelService } from '../channel.service';
|
|
6
|
+
import { CustomTemplatesService } from '../custom-templates.service';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
8
|
/**
|
|
8
9
|
* The `AttachmentList` compontent displays the attachments of a message
|
|
9
10
|
*/
|
|
10
11
|
export declare class AttachmentListComponent implements OnChanges {
|
|
12
|
+
readonly customTemplatesService: CustomTemplatesService;
|
|
11
13
|
private imageLoadService;
|
|
12
14
|
private channelService;
|
|
13
15
|
/**
|
|
@@ -17,11 +19,12 @@ export declare class AttachmentListComponent implements OnChanges {
|
|
|
17
19
|
/**
|
|
18
20
|
* The attachments to display
|
|
19
21
|
*/
|
|
20
|
-
attachments: Attachment<
|
|
21
|
-
orderedAttachments: Attachment<
|
|
22
|
-
imagesToView: Attachment<
|
|
22
|
+
attachments: Attachment<DefaultStreamChatGenerics>[];
|
|
23
|
+
orderedAttachments: Attachment<DefaultStreamChatGenerics>[];
|
|
24
|
+
imagesToView: Attachment<DefaultStreamChatGenerics>[];
|
|
23
25
|
imagesToViewCurrentIndex: number;
|
|
24
|
-
|
|
26
|
+
private modalContent;
|
|
27
|
+
constructor(customTemplatesService: CustomTemplatesService, imageLoadService: ImageLoadService, channelService: ChannelService);
|
|
25
28
|
ngOnChanges(): void;
|
|
26
29
|
trackById(index: number): number;
|
|
27
30
|
isImage(attachment: Attachment): boolean;
|
|
@@ -29,18 +32,19 @@ export declare class AttachmentListComponent implements OnChanges {
|
|
|
29
32
|
isGallery(attachment: Attachment): boolean;
|
|
30
33
|
isCard(attachment: Attachment): boolean;
|
|
31
34
|
imageLoaded(): void;
|
|
32
|
-
hasFileSize(attachment: Attachment<
|
|
33
|
-
getFileSize(attachment: Attachment<
|
|
35
|
+
hasFileSize(attachment: Attachment<DefaultStreamChatGenerics>): boolean | "" | 0 | undefined;
|
|
36
|
+
getFileSize(attachment: Attachment<DefaultStreamChatGenerics>): string;
|
|
37
|
+
getModalContext(): ModalContext;
|
|
34
38
|
trimUrl(url?: string | null): string | null;
|
|
35
39
|
sendAction(action: Action): void;
|
|
36
40
|
trackByActionValue(_: number, item: Action): string | undefined;
|
|
37
41
|
openImageModal(attachments: Attachment[], selectedIndex?: number): void;
|
|
38
|
-
closeImageModal(): void;
|
|
39
42
|
stepImages(dir: -1 | 1): void;
|
|
40
43
|
trackByImageUrl(_: number, item: Attachment): unknown;
|
|
41
44
|
get isImageModalPrevButtonVisible(): boolean;
|
|
42
45
|
get isImageModalNextButtonVisible(): boolean;
|
|
43
46
|
private createGallery;
|
|
47
|
+
private closeImageModal;
|
|
44
48
|
static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentListComponent, never>;
|
|
45
49
|
static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentListComponent, "stream-attachment-list", never, { "messageId": "messageId"; "attachments": "attachments"; }, {}, never, never>;
|
|
46
50
|
}
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
1
2
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { AttachmentService } from '../attachment.service';
|
|
3
3
|
import { AttachmentUpload } from '../types';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
6
6
|
* The `AttachmentPreviewList` compontent 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
7
|
*/
|
|
8
8
|
export declare class AttachmentPreviewListComponent {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A stream that emits the current file uploads and their states
|
|
11
|
+
*/
|
|
12
|
+
attachmentUploads$: Observable<AttachmentUpload[]> | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* An output to notify the parent component if the user tries to retry a failed upload
|
|
15
|
+
*/
|
|
16
|
+
readonly retryAttachmentUpload: EventEmitter<File>;
|
|
17
|
+
/**
|
|
18
|
+
* An output to notify the parent component if the user wants to delete a file
|
|
19
|
+
*/
|
|
20
|
+
readonly deleteAttachment: EventEmitter<AttachmentUpload>;
|
|
21
|
+
constructor();
|
|
22
|
+
attachmentUploadRetried(file: File): void;
|
|
23
|
+
attachmentDeleted(upload: AttachmentUpload): void;
|
|
14
24
|
trackByFile(_: number, item: AttachmentUpload): File;
|
|
15
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentPreviewListComponent, never>;
|
|
16
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentPreviewListComponent, "stream-attachment-preview-list", never, {}, {}, never, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentPreviewListComponent, "stream-attachment-preview-list", never, { "attachmentUploads$": "attachmentUploads$"; }, { "retryAttachmentUpload": "retryAttachmentUpload"; "deleteAttachment": "deleteAttachment"; }, never, never>;
|
|
17
27
|
}
|
|
@@ -46,7 +46,7 @@ export declare class AttachmentService {
|
|
|
46
46
|
* Maps the current uploads to a format that can be sent along with the message to the Stream API.
|
|
47
47
|
* @returns the attachments
|
|
48
48
|
*/
|
|
49
|
-
mapToAttachments(): Attachment<import("stream-chat").
|
|
49
|
+
mapToAttachments(): Attachment<import("stream-chat").DefaultGenerics>[];
|
|
50
50
|
/**
|
|
51
51
|
* Maps attachments received from the Stream API to uploads. This is useful when editing a message.
|
|
52
52
|
* @param attachments Attachemnts received with the message
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CustomTemplatesService } from '../custom-templates.service';
|
|
2
|
+
import { AvatarContext } from '../types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* The `AvatarPlaceholder` component displays the [default avatar](./AvatarComponent.mdx) unless a [custom template](../services/CustomTemplatesService.mdx) is provided. This componet is used by the SDK internally, you likely won't need to use it.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AvatarPlaceholderComponent {
|
|
8
|
+
customTemplatesService: CustomTemplatesService;
|
|
9
|
+
/**
|
|
10
|
+
* An optional name of the image, used for fallback image or image title (if `imageUrl` is provided)
|
|
11
|
+
*/
|
|
12
|
+
name: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The URL of the image to be displayed. If the image can't be displayed the first letter of the name input is displayed.
|
|
15
|
+
*/
|
|
16
|
+
imageUrl: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The size in pixels of the avatar image.
|
|
19
|
+
*/
|
|
20
|
+
size: number;
|
|
21
|
+
constructor(customTemplatesService: CustomTemplatesService);
|
|
22
|
+
getAvatarContext(): AvatarContext;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvatarPlaceholderComponent, never>;
|
|
24
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AvatarPlaceholderComponent, "stream-avatar-placeholder", never, { "name": "name"; "imageUrl": "imageUrl"; "size": "size"; }, {}, never, never>;
|
|
25
|
+
}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { TemplateRef } from '@angular/core';
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core';
|
|
2
2
|
import { Channel } from 'stream-chat';
|
|
3
3
|
import { ChannelListToggleService } from '../channel-list/channel-list-toggle.service';
|
|
4
4
|
import { ChannelService } from '../channel.service';
|
|
5
|
+
import { CustomTemplatesService } from '../custom-templates.service';
|
|
6
|
+
import { ChannelActionsContext, DefaultStreamChatGenerics } from '../types';
|
|
5
7
|
import * as i0 from "@angular/core";
|
|
6
8
|
/**
|
|
7
9
|
* The `ChannelHeader` component displays the avatar and name of the currently active channel along with member and watcher information. You can read about [the difference between members and watchers](https://getstream.io/chat/docs/javascript/watch_channel/?language=javascript#watchers-vs-members) in the platform documentation. Please note that number of watchers is only displayed if the user has [`connect-events` capability](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript)
|
|
8
10
|
*/
|
|
9
|
-
export declare class ChannelHeaderComponent {
|
|
11
|
+
export declare class ChannelHeaderComponent implements OnInit, OnDestroy {
|
|
10
12
|
private channelService;
|
|
11
13
|
private channelListToggleService;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
channel: Channel;
|
|
17
|
-
}>;
|
|
18
|
-
activeChannel: Channel | undefined;
|
|
14
|
+
private customTemplatesService;
|
|
15
|
+
private cdRef;
|
|
16
|
+
channelActionsTemplate?: TemplateRef<ChannelActionsContext>;
|
|
17
|
+
activeChannel: Channel<DefaultStreamChatGenerics> | undefined;
|
|
19
18
|
canReceiveConnectEvents: boolean | undefined;
|
|
20
|
-
|
|
19
|
+
private subscriptions;
|
|
20
|
+
constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef);
|
|
21
|
+
ngOnInit(): void;
|
|
22
|
+
ngOnDestroy(): void;
|
|
21
23
|
toggleMenu(event: Event): void;
|
|
24
|
+
getChannelActionsContext(): ChannelActionsContext;
|
|
22
25
|
get memberCountParam(): {
|
|
23
|
-
memberCount:
|
|
26
|
+
memberCount: number;
|
|
24
27
|
};
|
|
25
28
|
get watcherCountParam(): {
|
|
26
29
|
watcherCount: number;
|
|
27
30
|
};
|
|
28
31
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelHeaderComponent, never>;
|
|
29
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ChannelHeaderComponent, "stream-channel-header", never, {
|
|
32
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChannelHeaderComponent, "stream-channel-header", never, {}, {}, never, never>;
|
|
30
33
|
}
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import { AfterViewInit, TemplateRef } from '@angular/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { AfterViewInit, OnDestroy, TemplateRef } from '@angular/core';
|
|
2
|
+
import { Observable, Subscription } from 'rxjs';
|
|
3
3
|
import { Channel } from 'stream-chat';
|
|
4
4
|
import { ChannelService } from '../channel.service';
|
|
5
|
+
import { CustomTemplatesService } from '../custom-templates.service';
|
|
6
|
+
import { ChannelPreviewContext, DefaultStreamChatGenerics } from '../types';
|
|
5
7
|
import { ChannelListToggleService } from './channel-list-toggle.service';
|
|
6
8
|
import * as i0 from "@angular/core";
|
|
7
9
|
/**
|
|
8
10
|
* The `ChannelList` component renders the list of channels.
|
|
9
11
|
*/
|
|
10
|
-
export declare class ChannelListComponent implements AfterViewInit {
|
|
12
|
+
export declare class ChannelListComponent implements AfterViewInit, OnDestroy {
|
|
11
13
|
private channelService;
|
|
12
14
|
private channelListToggleService;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
customChannelPreviewTemplate: TemplateRef<any> | undefined;
|
|
17
|
-
channels$: Observable<Channel[] | undefined>;
|
|
15
|
+
private customTemplatesService;
|
|
16
|
+
channels$: Observable<Channel<DefaultStreamChatGenerics>[] | undefined>;
|
|
18
17
|
isError$: Observable<boolean>;
|
|
19
18
|
isInitializing$: Observable<boolean>;
|
|
20
19
|
isLoadingMoreChannels: boolean;
|
|
21
20
|
isOpen$: Observable<boolean>;
|
|
22
21
|
hasMoreChannels$: Observable<boolean>;
|
|
22
|
+
customChannelPreviewTemplate: TemplateRef<ChannelPreviewContext> | undefined;
|
|
23
|
+
subscriptions: Subscription[];
|
|
23
24
|
private container;
|
|
24
|
-
constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService);
|
|
25
|
+
constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService, customTemplatesService: CustomTemplatesService);
|
|
25
26
|
ngAfterViewInit(): void;
|
|
27
|
+
ngOnDestroy(): void;
|
|
26
28
|
loadMoreChannels(): Promise<void>;
|
|
27
|
-
trackByChannelId(index: number, item: Channel): string;
|
|
29
|
+
trackByChannelId(index: number, item: Channel<DefaultStreamChatGenerics>): string;
|
|
28
30
|
channelSelected(): void;
|
|
31
|
+
getChannelPreviewContext(channel: Channel<DefaultStreamChatGenerics>): ChannelPreviewContext<DefaultStreamChatGenerics>;
|
|
29
32
|
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelListComponent, never>;
|
|
30
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ChannelListComponent, "stream-channel-list", never, {
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChannelListComponent, "stream-channel-list", never, {}, {}, never, never>;
|
|
31
34
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NgZone, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { Channel } from 'stream-chat';
|
|
3
3
|
import { ChannelService } from '../channel.service';
|
|
4
|
+
import { DefaultStreamChatGenerics } from '../types';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* The `ChannelPreview` component displays a channel preview in the channel list, it consists of the image, name and latest message of the channel.
|
|
@@ -11,7 +12,7 @@ export declare class ChannelPreviewComponent implements OnInit, OnDestroy {
|
|
|
11
12
|
/**
|
|
12
13
|
* The channel to be displayed
|
|
13
14
|
*/
|
|
14
|
-
channel: Channel | undefined;
|
|
15
|
+
channel: Channel<DefaultStreamChatGenerics> | undefined;
|
|
15
16
|
isActive: boolean;
|
|
16
17
|
isUnread: boolean;
|
|
17
18
|
latestMessage: string;
|
|
@@ -20,7 +21,7 @@ export declare class ChannelPreviewComponent implements OnInit, OnDestroy {
|
|
|
20
21
|
constructor(channelService: ChannelService, ngZone: NgZone);
|
|
21
22
|
ngOnInit(): void;
|
|
22
23
|
ngOnDestroy(): void;
|
|
23
|
-
get avatarImage():
|
|
24
|
+
get avatarImage(): string | undefined;
|
|
24
25
|
get avatarName(): string | undefined;
|
|
25
26
|
get title(): string | undefined;
|
|
26
27
|
setAsActiveChannel(): void;
|
package/lib/channel.service.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { NgZone } from '@angular/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelResponse, ChannelSort, Event, UserResponse } from 'stream-chat';
|
|
4
|
-
import { ChatClientService,
|
|
5
|
-
import { MessageReactionType } from './
|
|
6
|
-
import { AttachmentUpload, StreamMessage } from './types';
|
|
4
|
+
import { ChatClientService, ClientEvent } from './chat-client.service';
|
|
5
|
+
import { AttachmentUpload, DefaultStreamChatGenerics, MessageReactionType, StreamMessage } from './types';
|
|
7
6
|
import * as i0 from "@angular/core";
|
|
8
7
|
/**
|
|
9
8
|
* The `ChannelService` provides data and interaction for the channel list and message list. TEST
|
|
10
9
|
*/
|
|
11
|
-
export declare class ChannelService {
|
|
10
|
+
export declare class ChannelService<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> {
|
|
12
11
|
private chatClientService;
|
|
13
12
|
private ngZone;
|
|
14
13
|
/**
|
|
@@ -40,7 +39,7 @@ export declare class ChannelService {
|
|
|
40
39
|
*
|
|
41
40
|
* Our platform documentation covers the topic of [channel events](https://getstream.io/chat/docs/javascript/event_object/?language=javascript#events) in depth.
|
|
42
41
|
*/
|
|
43
|
-
channels$: Observable<Channel[] | undefined>;
|
|
42
|
+
channels$: Observable<Channel<T>[] | undefined>;
|
|
44
43
|
/**
|
|
45
44
|
* Emits the currently active channel.
|
|
46
45
|
*
|
|
@@ -48,11 +47,11 @@ export declare class ChannelService {
|
|
|
48
47
|
* 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
48
|
* :::
|
|
50
49
|
*/
|
|
51
|
-
activeChannel$: Observable<Channel | undefined>;
|
|
50
|
+
activeChannel$: Observable<Channel<T> | undefined>;
|
|
52
51
|
/**
|
|
53
52
|
* Emits the list of currently loaded messages of the active channel.
|
|
54
53
|
*/
|
|
55
|
-
activeChannelMessages$: Observable<StreamMessage[]>;
|
|
54
|
+
activeChannelMessages$: Observable<StreamMessage<T>[]>;
|
|
56
55
|
/**
|
|
57
56
|
* Emits the id of the currently selected parent message. If no message is selected, it emits undefined.
|
|
58
57
|
*/
|
|
@@ -60,23 +59,23 @@ export declare class ChannelService {
|
|
|
60
59
|
/**
|
|
61
60
|
* 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
61
|
*/
|
|
63
|
-
activeThreadMessages$: Observable<StreamMessage[]>;
|
|
62
|
+
activeThreadMessages$: Observable<StreamMessage<T>[]>;
|
|
64
63
|
/**
|
|
65
64
|
* Emits the currently selected parent message. If no message is selected, it emits undefined.
|
|
66
65
|
*/
|
|
67
|
-
activeParentMessage$: Observable<StreamMessage | undefined>;
|
|
66
|
+
activeParentMessage$: Observable<StreamMessage<T> | undefined>;
|
|
68
67
|
/**
|
|
69
68
|
* Emits the currently selected message to quote
|
|
70
69
|
*/
|
|
71
|
-
messageToQuote$: Observable<StreamMessage | undefined>;
|
|
70
|
+
messageToQuote$: Observable<StreamMessage<T> | undefined>;
|
|
72
71
|
/**
|
|
73
72
|
* Emits the list of users that are currently typing in the channel (current user is not included)
|
|
74
73
|
*/
|
|
75
|
-
usersTypingInChannel$: Observable<UserResponse[]>;
|
|
74
|
+
usersTypingInChannel$: Observable<UserResponse<T>[]>;
|
|
76
75
|
/**
|
|
77
76
|
* Emits the list of users that are currently typing in the active thread (current user is not included)
|
|
78
77
|
*/
|
|
79
|
-
usersTypingInThread$: Observable<UserResponse[]>;
|
|
78
|
+
usersTypingInThread$: Observable<UserResponse<T>[]>;
|
|
80
79
|
/**
|
|
81
80
|
* Emits a map that contains the date of the latest message sent by the current user by channels (this is used to detect if slow mode countdown should be started)
|
|
82
81
|
*/
|
|
@@ -86,39 +85,39 @@ export declare class ChannelService {
|
|
|
86
85
|
/**
|
|
87
86
|
* 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)
|
|
88
87
|
*/
|
|
89
|
-
customNewMessageNotificationHandler?: (
|
|
88
|
+
customNewMessageNotificationHandler?: (clientEvent: ClientEvent, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void) => void;
|
|
90
89
|
/**
|
|
91
90
|
* 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)
|
|
92
91
|
*/
|
|
93
|
-
customAddedToChannelNotificationHandler?: (
|
|
92
|
+
customAddedToChannelNotificationHandler?: (clientEvent: ClientEvent, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void) => void;
|
|
94
93
|
/**
|
|
95
94
|
* 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)
|
|
96
95
|
*/
|
|
97
|
-
customRemovedFromChannelNotificationHandler?: (
|
|
96
|
+
customRemovedFromChannelNotificationHandler?: (clientEvent: ClientEvent, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void) => void;
|
|
98
97
|
/**
|
|
99
98
|
* 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)
|
|
100
99
|
*/
|
|
101
|
-
customChannelDeletedHandler?: (event: Event, channel: Channel
|
|
100
|
+
customChannelDeletedHandler?: (event: Event, channel: Channel<T>, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void, messageListSetter: (messages: StreamMessage<T>[]) => void, threadListSetter: (messages: StreamMessage<T>[]) => void, parentMessageSetter: (message: StreamMessage<T> | undefined) => void) => void;
|
|
102
101
|
/**
|
|
103
102
|
* 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)
|
|
104
103
|
*/
|
|
105
|
-
customChannelUpdatedHandler?: (event: Event, channel: Channel
|
|
104
|
+
customChannelUpdatedHandler?: (event: Event, channel: Channel<T>, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
|
|
106
105
|
/**
|
|
107
106
|
* 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)
|
|
108
107
|
*/
|
|
109
|
-
customChannelTruncatedHandler?: (event: Event, channel: Channel
|
|
108
|
+
customChannelTruncatedHandler?: (event: Event, channel: Channel<T>, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void, messageListSetter: (messages: StreamMessage<T>[]) => void, threadListSetter: (messages: StreamMessage<T>[]) => void, parentMessageSetter: (message: StreamMessage<T> | undefined) => void) => void;
|
|
110
109
|
/**
|
|
111
110
|
* 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)
|
|
112
111
|
*/
|
|
113
|
-
customChannelHiddenHandler?: (event: Event, channel: Channel
|
|
112
|
+
customChannelHiddenHandler?: (event: Event, channel: Channel<T>, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void, messageListSetter: (messages: StreamMessage<T>[]) => void, threadListSetter: (messages: StreamMessage<T>[]) => void, parentMessageSetter: (message: StreamMessage<T> | undefined) => void) => void;
|
|
114
113
|
/**
|
|
115
114
|
* 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)
|
|
116
115
|
*/
|
|
117
|
-
customChannelVisibleHandler?: (event: Event, channel: Channel
|
|
116
|
+
customChannelVisibleHandler?: (event: Event, channel: Channel<T>, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void, messageListSetter: (messages: StreamMessage<T>[]) => void, threadListSetter: (messages: StreamMessage<T>[]) => void, parentMessageSetter: (message: StreamMessage<T> | undefined) => void) => void;
|
|
118
117
|
/**
|
|
119
118
|
* 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)
|
|
120
119
|
*/
|
|
121
|
-
customNewMessageHandler?: (event: Event, channel: Channel
|
|
120
|
+
customNewMessageHandler?: (event: Event, channel: Channel<T>, channelListSetter: (channels: (Channel<T> | ChannelResponse<T>)[]) => void, messageListSetter: (messages: StreamMessage<T>[]) => void, threadListSetter: (messages: StreamMessage<T>[]) => void, parentMessageSetter: (message: StreamMessage<T> | undefined) => void) => void;
|
|
122
121
|
private channelsSubject;
|
|
123
122
|
private activeChannelSubject;
|
|
124
123
|
private activeChannelMessagesSubject;
|
|
@@ -138,17 +137,17 @@ export declare class ChannelService {
|
|
|
138
137
|
private messageListSetter;
|
|
139
138
|
private threadListSetter;
|
|
140
139
|
private parentMessageSetter;
|
|
141
|
-
constructor(chatClientService: ChatClientService
|
|
140
|
+
constructor(chatClientService: ChatClientService<T>, ngZone: NgZone);
|
|
142
141
|
/**
|
|
143
142
|
* Sets the given `channel` as active.
|
|
144
143
|
* @param channel
|
|
145
144
|
*/
|
|
146
|
-
setAsActiveChannel(channel: Channel): void;
|
|
145
|
+
setAsActiveChannel(channel: Channel<T>): void;
|
|
147
146
|
/**
|
|
148
147
|
* Sets the given `message` as an active parent message. If `undefined` is provided, it will deleselect the current parent message.
|
|
149
148
|
* @param message
|
|
150
149
|
*/
|
|
151
|
-
setAsActiveParentMessage(message: StreamMessage | undefined): Promise<void>;
|
|
150
|
+
setAsActiveParentMessage(message: StreamMessage<T> | undefined): Promise<void>;
|
|
152
151
|
/**
|
|
153
152
|
* 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.
|
|
154
153
|
*/
|
|
@@ -163,7 +162,7 @@ export declare class ChannelService {
|
|
|
163
162
|
* @param sort
|
|
164
163
|
* @param options
|
|
165
164
|
*/
|
|
166
|
-
init(filters: ChannelFilters
|
|
165
|
+
init(filters: ChannelFilters<T>, sort?: ChannelSort<T>, options?: ChannelOptions): Promise<void>;
|
|
167
166
|
/**
|
|
168
167
|
* Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
|
|
169
168
|
*/
|
|
@@ -176,8 +175,9 @@ export declare class ChannelService {
|
|
|
176
175
|
* Adds a reaction to a message.
|
|
177
176
|
* @param messageId The id of the message to add the reaction to
|
|
178
177
|
* @param reactionType The type of the reaction
|
|
178
|
+
* @param customData
|
|
179
179
|
*/
|
|
180
|
-
addReaction(messageId: string, reactionType: MessageReactionType): Promise<void>;
|
|
180
|
+
addReaction(messageId: string, reactionType: MessageReactionType, customData?: T['reactionType']): Promise<void>;
|
|
181
181
|
/**
|
|
182
182
|
* Removes a reaction from a message.
|
|
183
183
|
* @param messageId The id of the message to remove the reaction from
|
|
@@ -191,8 +191,9 @@ export declare class ChannelService {
|
|
|
191
191
|
* @param mentionedUsers Mentioned users
|
|
192
192
|
* @param parentId Id of the parent message (if sending a thread reply)
|
|
193
193
|
* @param quotedMessageId Id of the message to quote (if sending a quote reply)
|
|
194
|
+
* @param customData
|
|
194
195
|
*/
|
|
195
|
-
sendMessage(text: string, attachments?: Attachment[], mentionedUsers?: UserResponse[], parentId?: string | undefined, quotedMessageId?: string | undefined): Promise<void>;
|
|
196
|
+
sendMessage(text: string, attachments?: Attachment<T>[], mentionedUsers?: UserResponse<T>[], parentId?: string | undefined, quotedMessageId?: string | undefined, customData?: undefined | Partial<T['messageType']>): Promise<void>;
|
|
196
197
|
/**
|
|
197
198
|
* Resends the given message to the active channel
|
|
198
199
|
* @param message The message to resend
|
|
@@ -202,7 +203,7 @@ export declare class ChannelService {
|
|
|
202
203
|
* Updates the message in the active channel
|
|
203
204
|
* @param message Mesage to be updated
|
|
204
205
|
*/
|
|
205
|
-
updateMessage(message: StreamMessage): Promise<void>;
|
|
206
|
+
updateMessage(message: StreamMessage<T>): Promise<void>;
|
|
206
207
|
/**
|
|
207
208
|
* Deletes the message from the active channel
|
|
208
209
|
* @param message Message to be deleted
|
|
@@ -224,7 +225,7 @@ export declare class ChannelService {
|
|
|
224
225
|
* @param searchTerm Text to search for in the names of members
|
|
225
226
|
* @returns The list of members matching the search filter
|
|
226
227
|
*/
|
|
227
|
-
autocompleteMembers(searchTerm: string): Promise<import("stream-chat").ChannelMemberResponse<
|
|
228
|
+
autocompleteMembers(searchTerm: string): Promise<import("stream-chat").ChannelMemberResponse<T>[]>;
|
|
228
229
|
/**
|
|
229
230
|
* [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).
|
|
230
231
|
* @param messageId
|
|
@@ -274,6 +275,6 @@ export declare class ChannelService {
|
|
|
274
275
|
private handleTypingStartEvent;
|
|
275
276
|
private handleTypingStopEvent;
|
|
276
277
|
private updateLatestMessages;
|
|
277
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelService
|
|
278
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ChannelService
|
|
278
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChannelService<any>, never>;
|
|
279
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ChannelService<any>>;
|
|
279
280
|
}
|
|
@@ -3,28 +3,29 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { Channel, ChannelResponse, OwnUserResponse, UserResponse } from 'stream-chat';
|
|
4
4
|
import { AppSettings, Event, StreamChat, TokenOrProvider } from 'stream-chat';
|
|
5
5
|
import { NotificationService } from './notification.service';
|
|
6
|
+
import { DefaultStreamChatGenerics } from './types';
|
|
6
7
|
import * as i0 from "@angular/core";
|
|
7
|
-
export declare type
|
|
8
|
+
export declare type ClientEvent<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
|
|
8
9
|
eventType: string;
|
|
9
|
-
event: Event
|
|
10
|
+
event: Event<T>;
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* The `ChatClient` service connects the user to the Stream chat.
|
|
13
14
|
*/
|
|
14
|
-
export declare class ChatClientService {
|
|
15
|
+
export declare class ChatClientService<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> {
|
|
15
16
|
private ngZone;
|
|
16
17
|
private notificationService;
|
|
17
18
|
/**
|
|
18
19
|
* 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
20
|
*/
|
|
20
|
-
chatClient: StreamChat
|
|
21
|
+
chatClient: StreamChat<T>;
|
|
21
22
|
/**
|
|
22
|
-
* Emits [`
|
|
23
|
+
* Emits [`ClientEvent`](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, user presence and notification events](https://getstream.io/chat/docs/javascript/event_object/?language=javascript).
|
|
23
24
|
* :::important
|
|
24
25
|
* 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
|
* :::
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
events$: Observable<ClientEvent<T>>;
|
|
28
29
|
/**
|
|
29
30
|
* 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
31
|
*/
|
|
@@ -36,7 +37,7 @@ export declare class ChatClientService {
|
|
|
36
37
|
/**
|
|
37
38
|
* Emits the list of pending invites of the user. It emits every pending invitation during initialization and then extends the list when a new invite is received. More information can be found in the [channel invitations](../code-examples/channel-invites.mdx) guide.
|
|
38
39
|
*/
|
|
39
|
-
pendingInvites$: Observable<(ChannelResponse | Channel)[]>;
|
|
40
|
+
pendingInvites$: Observable<(ChannelResponse<T> | Channel<T>)[]>;
|
|
40
41
|
private notificationSubject;
|
|
41
42
|
private connectionStateSubject;
|
|
42
43
|
private appSettingsSubject;
|
|
@@ -48,7 +49,7 @@ export declare class ChatClientService {
|
|
|
48
49
|
* @param userOrId
|
|
49
50
|
* @param userTokenOrProvider
|
|
50
51
|
*/
|
|
51
|
-
init(apiKey: string, userOrId: string | OwnUserResponse | UserResponse
|
|
52
|
+
init(apiKey: string, userOrId: string | OwnUserResponse<T> | UserResponse<T>, userTokenOrProvider: TokenOrProvider): Promise<void>;
|
|
52
53
|
/**
|
|
53
54
|
* Disconnects the current user, and closes the WebSocket connection. Useful when disconnecting a chat user, use in combination with [`reset`](./ChannelService.mdx/#reset).
|
|
54
55
|
*/
|
|
@@ -67,8 +68,8 @@ export declare class ChatClientService {
|
|
|
67
68
|
* @param searchTerm
|
|
68
69
|
* @returns The users matching the search
|
|
69
70
|
*/
|
|
70
|
-
autocompleteUsers(searchTerm: string): Promise<UserResponse<
|
|
71
|
+
autocompleteUsers(searchTerm: string): Promise<UserResponse<T>[]>;
|
|
71
72
|
private updatePendingInvites;
|
|
72
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ChatClientService
|
|
73
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ChatClientService
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatClientService<any>, never>;
|
|
74
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ChatClientService<any>>;
|
|
74
75
|
}
|