stream-chat-angular 2.18.0 → 2.20.1

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,3 +1,4 @@
1
+ import { TemplateRef } from '@angular/core';
1
2
  import { Channel } from 'stream-chat';
2
3
  import { ChannelListToggleService } from '../channel-list/channel-list-toggle.service';
3
4
  import { ChannelService } from '../channel.service';
@@ -8,6 +9,12 @@ import * as i0 from "@angular/core";
8
9
  export declare class ChannelHeaderComponent {
9
10
  private channelService;
10
11
  private channelListToggleService;
12
+ /**
13
+ * Template that can be used to add actions (such as edit, invite) to the channel header
14
+ */
15
+ channelActionsTemplate?: TemplateRef<{
16
+ channel: Channel;
17
+ }>;
11
18
  activeChannel: Channel | undefined;
12
19
  canReceiveConnectEvents: boolean | undefined;
13
20
  constructor(channelService: ChannelService, channelListToggleService: ChannelListToggleService);
@@ -19,5 +26,5 @@ export declare class ChannelHeaderComponent {
19
26
  watcherCount: number;
20
27
  };
21
28
  static ɵfac: i0.ɵɵFactoryDeclaration<ChannelHeaderComponent, never>;
22
- static ɵcmp: i0.ɵɵComponentDeclaration<ChannelHeaderComponent, "stream-channel-header", never, {}, {}, never, never>;
29
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChannelHeaderComponent, "stream-channel-header", never, { "channelActionsTemplate": "channelActionsTemplate"; }, {}, never, never>;
23
30
  }
@@ -1,6 +1,6 @@
1
1
  import { NgZone } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelSort, Event, UserResponse } from 'stream-chat';
3
+ import { Attachment, Channel, ChannelFilters, ChannelOptions, ChannelResponse, 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';
@@ -78,7 +78,7 @@ export declare class ChannelService {
78
78
  */
79
79
  usersTypingInThread$: Observable<UserResponse[]>;
80
80
  /**
81
- * Emits a map that contains the date of the latest message sent by the current user by channels (this is used to detect is slow mode countdown should be started)
81
+ * 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
82
  */
83
83
  latestMessageDateByUserByChannels$: Observable<{
84
84
  [key: string]: Date;
@@ -86,39 +86,39 @@ export declare class ChannelService {
86
86
  /**
87
87
  * 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
88
  */
89
- customNewMessageNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
89
+ customNewMessageNotificationHandler?: (notification: Notification, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void) => void;
90
90
  /**
91
91
  * 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
92
  */
93
- customAddedToChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
93
+ customAddedToChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void) => void;
94
94
  /**
95
95
  * 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
96
  */
97
- customRemovedFromChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: Channel[]) => void) => void;
97
+ customRemovedFromChannelNotificationHandler?: (notification: Notification, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void) => void;
98
98
  /**
99
99
  * 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
100
  */
101
- customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
101
+ customChannelDeletedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
102
102
  /**
103
103
  * 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
104
  */
105
- customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
105
+ customChannelUpdatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
106
106
  /**
107
107
  * 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
108
  */
109
- customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
109
+ customChannelTruncatedHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
110
110
  /**
111
111
  * 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
112
  */
113
- customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
113
+ customChannelHiddenHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
114
114
  /**
115
115
  * 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
116
  */
117
- customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
117
+ customChannelVisibleHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
118
118
  /**
119
119
  * 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
120
  */
121
- customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: Channel[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
121
+ customNewMessageHandler?: (event: Event, channel: Channel, channelListSetter: (channels: (Channel | ChannelResponse)[]) => void, messageListSetter: (messages: StreamMessage[]) => void, threadListSetter: (messages: StreamMessage[]) => void, parentMessageSetter: (message: StreamMessage | undefined) => void) => void;
122
122
  private channelsSubject;
123
123
  private activeChannelSubject;
124
124
  private activeChannelMessagesSubject;
@@ -241,8 +241,8 @@ export declare class ChannelService {
241
241
  private handleRemovedFromChannelNotification;
242
242
  private handleNewMessageNotification;
243
243
  private handleAddedToChannelNotification;
244
- private addChannelFromNotification;
245
- private removeFromChannelList;
244
+ private addChannelsFromNotification;
245
+ private removeChannelsFromChannelList;
246
246
  private watchForActiveChannelEvents;
247
247
  /**
248
248
  * Call this method if user started typing in the active channel
@@ -1,6 +1,6 @@
1
1
  import { NgZone } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
- import { OwnUserResponse, UserResponse } from 'stream-chat';
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
6
  import * as i0 from "@angular/core";
@@ -33,9 +33,14 @@ export declare class ChatClientService {
33
33
  * Emits the current connection state of the user (`online` or `offline`)
34
34
  */
35
35
  connectionState$: Observable<'offline' | 'online'>;
36
+ /**
37
+ * 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
+ pendingInvites$: Observable<(ChannelResponse | Channel)[]>;
36
40
  private notificationSubject;
37
41
  private connectionStateSubject;
38
42
  private appSettingsSubject;
43
+ private pendingInvitesSubject;
39
44
  constructor(ngZone: NgZone, notificationService: NotificationService);
40
45
  /**
41
46
  * Creates a [`StreamChat`](https://github.com/GetStream/stream-chat-js/blob/668b3e5521339f4e14fc657834531b4c8bf8176b/src/client.ts#L124) instance using the provided `apiKey`, and connects a user with the given meta data and token. More info about [connecting users](https://getstream.io/chat/docs/javascript/init_and_users/?language=javascript) can be found in the platform documentation.
@@ -63,6 +68,7 @@ export declare class ChatClientService {
63
68
  * @returns The users matching the search
64
69
  */
65
70
  autocompleteUsers(searchTerm: string): Promise<UserResponse<import("stream-chat").UR>[]>;
71
+ private updatePendingInvites;
66
72
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatClientService, never>;
67
73
  static ɵprov: i0.ɵɵInjectableDeclaration<ChatClientService>;
68
74
  }
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- export declare type Icon = 'action-icon' | 'delivered-icon' | 'reaction-icon' | 'connection-error' | 'send' | 'file-upload' | 'retry' | 'close' | 'file' | 'reply' | 'close-no-outline' | 'reply-in-thread' | 'arrow-left' | 'arrow-right';
2
+ export declare type Icon = 'action-icon' | 'delivered-icon' | 'reaction-icon' | 'connection-error' | 'send' | 'file-upload' | 'retry' | 'close' | 'file' | 'reply' | 'close-no-outline' | 'reply-in-thread' | 'arrow-left' | 'arrow-right' | 'menu';
3
3
  /**
4
4
  * The `Icon` component can be used to display different icons (i. e. message delivered icon).
5
5
  */
@@ -1,4 +1,4 @@
1
- import { NotificationType } from '../notification.service';
1
+ import { NotificationType } from '../types';
2
2
  import * as i0 from "@angular/core";
3
3
  /**
4
4
  * The `Notification` component displays a notification within the [`NotificationList`](./NotificationListComponent.mdx)
@@ -1,5 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
- import { NotificationPayload, NotificationService } from '../notification.service';
2
+ import { NotificationService } from '../notification.service';
3
+ import { NotificationPayload } from '../types';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * The `NotificationList` component displays the list of active notifications.
@@ -8,7 +9,10 @@ export declare class NotificationListComponent {
8
9
  private notificationService;
9
10
  notifications$: Observable<NotificationPayload[]>;
10
11
  constructor(notificationService: NotificationService);
11
- trackByItem(_: number, item: NotificationPayload): NotificationPayload;
12
+ trackById(_: number, item: NotificationPayload): string;
13
+ getTemplateContext(notification: NotificationPayload): {
14
+ dismissFn: Function;
15
+ };
12
16
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationListComponent, never>;
13
17
  static ɵcmp: i0.ɵɵComponentDeclaration<NotificationListComponent, "stream-notification-list", never, {}, {}, never, never>;
14
18
  }
@@ -1,11 +1,7 @@
1
+ import { TemplateRef } from '@angular/core';
1
2
  import { Observable } from 'rxjs';
3
+ import { NotificationPayload, NotificationType } from './types';
2
4
  import * as i0 from "@angular/core";
3
- export declare type NotificationType = 'success' | 'error';
4
- export declare type NotificationPayload = {
5
- type: NotificationType;
6
- text: string;
7
- translateParams?: Object;
8
- };
9
5
  /**
10
6
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
11
7
  */
@@ -18,22 +14,27 @@ export declare class NotificationService {
18
14
  constructor();
19
15
  /**
20
16
  * Displays a notification for the given amount of time.
21
- * @param text The text of the notification
17
+ * @param content The text of the notification or the HTML template for the notification
22
18
  * @param type The type of the notification
23
19
  * @param timeout The number of milliseconds while the notification should be visible
24
- * @param translateParams Translation parameters for the `text`
20
+ * @param translateParams Translation parameters for the `content` (for text notifications)
21
+ * @param templateContext The input of the notification template (for HTML notifications)
25
22
  * @returns A method to clear the notification (before the timeout).
26
23
  */
27
- addTemporaryNotification(text: string, type?: NotificationType, timeout?: number, translateParams?: Object): () => void;
24
+ addTemporaryNotification<T>(content: string | TemplateRef<T>, type?: NotificationType, timeout?: number, translateParams?: Object, templateContext?: T): () => void;
28
25
  /**
29
26
  * Displays a notification, that will be visible until it's removed.
30
- * @param text The text of the notification
27
+ * @param content The text of the notification or the HTML template for the notification
31
28
  * @param type The type of the notification
32
- * @param translateParams Translation parameters for the `text`
29
+ * @param translateParams Translation parameters for the `content` (for text notifications)
30
+ * @param templateContext The input of the notification template (for HTML notifications)
33
31
  * @returns A method to clear the notification.
34
32
  */
35
- addPermanentNotification(text: string, type?: NotificationType, translateParams?: Object): () => void;
36
- private addNotification;
33
+ addPermanentNotification<T = {
34
+ [key: string]: any;
35
+ dismissFn: () => {};
36
+ }>(content: string | TemplateRef<T>, type?: NotificationType, translateParams?: Object, templateContext?: T): () => void;
37
+ private createNotification;
37
38
  private removeNotification;
38
39
  static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
39
40
  static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
package/lib/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { TemplateRef } from '@angular/core';
1
2
  import type { Attachment, ChannelMemberResponse, CommandResponse, Event, FormatMessageResponse, LiteralStringForUnion, Mute, UserResponse } from 'stream-chat';
2
3
  export declare type UnknownType = Record<string, unknown>;
3
4
  export declare type CustomTrigger = {
@@ -55,3 +56,13 @@ export declare type MentionAutcompleteListItem = (ChannelMemberResponse | UserRe
55
56
  export declare type ComandAutocompleteListItem = CommandResponse & {
56
57
  autocompleteLabel: string;
57
58
  };
59
+ export declare type NotificationType = 'success' | 'error' | 'info';
60
+ export declare type NotificationPayload<T = {}> = {
61
+ id: string;
62
+ type: NotificationType;
63
+ text?: string;
64
+ translateParams?: Object;
65
+ template?: TemplateRef<T>;
66
+ templateContext?: T;
67
+ dismissFn: Function;
68
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "2.18.0",
3
+ "version": "2.20.1",
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,7 +13,7 @@
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 || ^5.0.0",
16
- "@stream-io/stream-chat-css": "2.5.0"
16
+ "@stream-io/stream-chat-css": "2.6.0"
17
17
  },
18
18
  "dependencies": {
19
19
  "angular-mentions": "^1.4.0",
@@ -1 +1 @@
1
- export const version = '2.18.0';
1
+ export const version = '2.20.1';