stream-chat-angular 3.3.0 → 3.5.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.
@@ -1,8 +1,12 @@
1
+ import { Channel, User } from 'stream-chat';
2
+ import { ChatClientService } from '../chat-client.service';
3
+ import { AvatarLocation, AvatarType, DefaultStreamChatGenerics } from '../types';
1
4
  import * as i0 from "@angular/core";
2
5
  /**
3
6
  * The `Avatar` component displays the provided image, with fallback to the first letter of the optional name input.
4
7
  */
5
8
  export declare class AvatarComponent {
9
+ private chatClientService;
6
10
  /**
7
11
  * An optional name of the image, used for fallback image or image title (if `imageUrl` is provided)
8
12
  */
@@ -15,10 +19,26 @@ export declare class AvatarComponent {
15
19
  * The size in pixels of the avatar image.
16
20
  */
17
21
  size: number;
22
+ /**
23
+ * The location the avatar will be displayed in
24
+ */
25
+ location: AvatarLocation | undefined;
26
+ /**
27
+ * The channel the avatar belongs to (if avatar of a channel is displayed)
28
+ */
29
+ channel?: Channel<DefaultStreamChatGenerics>;
30
+ /**
31
+ * The user the avatar belongs to (if avatar of a user is displayed)
32
+ */
33
+ user?: User<DefaultStreamChatGenerics>;
34
+ /**
35
+ * The type of the avatar: channel if channel avatar is displayed, user if user avatar is displayed
36
+ */
37
+ type: AvatarType | undefined;
18
38
  isLoaded: boolean;
19
39
  isError: boolean;
20
- constructor();
40
+ constructor(chatClientService: ChatClientService);
21
41
  get initials(): string;
22
42
  static ɵfac: i0.ɵɵFactoryDeclaration<AvatarComponent, never>;
23
- static ɵcmp: i0.ɵɵComponentDeclaration<AvatarComponent, "stream-avatar", never, { "name": "name"; "imageUrl": "imageUrl"; "size": "size"; }, {}, never, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<AvatarComponent, "stream-avatar", never, { "name": "name"; "imageUrl": "imageUrl"; "size": "size"; "location": "location"; "channel": "channel"; "user": "user"; "type": "type"; }, {}, never, never>;
24
44
  }
@@ -1,5 +1,6 @@
1
+ import { Channel, User } from 'stream-chat';
1
2
  import { CustomTemplatesService } from '../custom-templates.service';
2
- import { AvatarContext } from '../types';
3
+ import { AvatarContext, AvatarLocation, AvatarType, DefaultStreamChatGenerics } from '../types';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * 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.
@@ -18,8 +19,24 @@ export declare class AvatarPlaceholderComponent {
18
19
  * The size in pixels of the avatar image.
19
20
  */
20
21
  size: number;
22
+ /**
23
+ * The location the avatar will be displayed in
24
+ */
25
+ location: AvatarLocation | undefined;
26
+ /**
27
+ * The channel the avatar belongs to (if avatar of a channel is displayed)
28
+ */
29
+ channel?: Channel<DefaultStreamChatGenerics>;
30
+ /**
31
+ * The user the avatar belongs to (if avatar of a user is displayed)
32
+ */
33
+ user?: User<DefaultStreamChatGenerics>;
34
+ /**
35
+ * The type of the avatar: channel if channel avatar is displayed, user if user avatar is displayed
36
+ */
37
+ type: AvatarType | undefined;
21
38
  constructor(customTemplatesService: CustomTemplatesService);
22
39
  getAvatarContext(): AvatarContext;
23
40
  static ɵfac: i0.ɵɵFactoryDeclaration<AvatarPlaceholderComponent, never>;
24
- static ɵcmp: i0.ɵɵComponentDeclaration<AvatarPlaceholderComponent, "stream-avatar-placeholder", never, { "name": "name"; "imageUrl": "imageUrl"; "size": "size"; }, {}, never, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<AvatarPlaceholderComponent, "stream-avatar-placeholder", never, { "name": "name"; "imageUrl": "imageUrl"; "size": "size"; "location": "location"; "channel": "channel"; "user": "user"; "type": "type"; }, {}, never, never>;
25
42
  }
@@ -140,10 +140,6 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
140
140
  * You can override the default image delete request - override this if you use your own CDN
141
141
  */
142
142
  customImageDeleteRequest?: (url: string, channel: Channel<T>) => Promise<void>;
143
- /**
144
- * If set to false, read events won't be sent as new messages are received
145
- */
146
- shouldMarkActiveChannelAsRead: boolean;
147
143
  private channelsSubject;
148
144
  private activeChannelSubject;
149
145
  private activeChannelMessagesSubject;
@@ -159,11 +155,22 @@ export declare class ChannelService<T extends DefaultStreamChatGenerics = Defaul
159
155
  private messageToQuoteSubject;
160
156
  private usersTypingInChannelSubject;
161
157
  private usersTypingInThreadSubject;
158
+ private _shouldMarkActiveChannelAsRead;
159
+ private shouldSetActiveChannel;
160
+ private clientEventsSubscription;
162
161
  private channelListSetter;
163
162
  private messageListSetter;
164
163
  private threadListSetter;
165
164
  private parentMessageSetter;
166
165
  constructor(chatClientService: ChatClientService<T>, ngZone: NgZone);
166
+ /**
167
+ * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
168
+ */
169
+ get shouldMarkActiveChannelAsRead(): boolean;
170
+ /**
171
+ * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
172
+ */
173
+ set shouldMarkActiveChannelAsRead(shouldMarkActiveChannelAsRead: boolean);
167
174
  /**
168
175
  * Sets the given `channel` as active and marks it as read.
169
176
  * @param channel
@@ -69,9 +69,6 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
69
69
  get canDisplayReadStatus(): boolean;
70
70
  get quotedMessageAttachments(): import("stream-chat").Attachment<{
71
71
  attachmentType: import("stream-chat").UR & import("../types").UnknownType & {
72
- /**
73
- * The `Message` component displays a message with additional information such as sender and date, and enables [interaction with the message (i.e. edit or react)](../concepts/message-interactions.mdx).
74
- */
75
72
  asset_url?: string | undefined;
76
73
  id?: string | undefined;
77
74
  images?: import("stream-chat").Attachment<DefaultStreamChatGenerics>[] | undefined;
package/lib/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { Observable, Subject } from 'rxjs';
3
- import type { Attachment, Channel, ChannelMemberResponse, CommandResponse, Event, ExtendableGenerics, FormatMessageResponse, LiteralStringForUnion, Mute, ReactionResponse, UserResponse } from 'stream-chat';
3
+ import type { Attachment, Channel, ChannelMemberResponse, CommandResponse, Event, ExtendableGenerics, FormatMessageResponse, LiteralStringForUnion, Mute, ReactionResponse, User, UserResponse } from 'stream-chat';
4
4
  import { Icon } from './icon/icon.component';
5
5
  export declare type UnknownType = Record<string, unknown>;
6
6
  export declare type CustomTrigger = {
@@ -111,10 +111,16 @@ export declare type AttachmentListContext = {
111
111
  messageId: string;
112
112
  attachments: Attachment<DefaultStreamChatGenerics>[];
113
113
  };
114
+ export declare type AvatarType = 'channel' | 'user';
115
+ export declare type AvatarLocation = 'channel-preview' | 'channel-header' | 'message-sender' | 'message-reader' | 'quoted-message-sender' | 'autocomplete-item' | 'typing-indicator' | 'reaction';
114
116
  export declare type AvatarContext = {
115
117
  name: string | undefined;
116
118
  imageUrl: string | undefined;
117
119
  size: number | undefined;
120
+ type: AvatarType | undefined;
121
+ location: AvatarLocation | undefined;
122
+ channel?: Channel<DefaultStreamChatGenerics>;
123
+ user?: User<DefaultStreamChatGenerics>;
118
124
  };
119
125
  export declare type AttachmentPreviewListContext = {
120
126
  attachmentUploads$: Observable<AttachmentUpload[]> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "3.3.0",
3
+ "version": "3.5.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 = '3.3.0';
1
+ export const version = '3.5.0';