stream-chat-angular 4.23.2 → 4.25.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.
@@ -101,7 +101,7 @@ export declare class CustomTemplatesService {
101
101
  *
102
102
  * For code examples to the different customizations see our [customizations example application](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example), specifically the [AppComponent](https://github.com/GetStream/stream-chat-angular/tree/master/projects/customizations-example/src/app) (see [README](https://github.com/GetStream/stream-chat-angular/blob/master/README.md#customization-examples) for instructions on how to start the application).
103
103
  */
104
- messageActionsBoxItemTemplate$: BehaviorSubject<TemplateRef<MessageActionBoxItemContext> | undefined>;
104
+ messageActionsBoxItemTemplate$: BehaviorSubject<TemplateRef<MessageActionBoxItemContext<import("./types").DefaultStreamChatGenerics>> | undefined>;
105
105
  /**
106
106
  * The template used to display the reactions of a [message](../components/MessageComponent.mdx), and the selector to add a reaction to a message (instead of the [default message reactions component](../components/MessageReactionsComponent.mdx))
107
107
  *
@@ -2,7 +2,7 @@ import { TemplateRef, OnChanges, SimpleChanges, OnDestroy, OnInit, ChangeDetecto
2
2
  import { UserResponse } from 'stream-chat';
3
3
  import { ChannelService } from '../channel.service';
4
4
  import { ChatClientService } from '../chat-client.service';
5
- import { AttachmentListContext, MentionTemplateContext, MessageActionsBoxContext, MessageReactionsContext, DefaultStreamChatGenerics, StreamMessage, DeliveredStatusContext, SendingStatusContext, ReadStatusContext } from '../types';
5
+ import { AttachmentListContext, MentionTemplateContext, MessageActionsBoxContext, MessageReactionsContext, DefaultStreamChatGenerics, StreamMessage, DeliveredStatusContext, SendingStatusContext, ReadStatusContext, CustomMessageActionItem } from '../types';
6
6
  import { CustomTemplatesService } from '../custom-templates.service';
7
7
  import { ThemeService } from '../theme.service';
8
8
  import { NgxPopperjsTriggers, NgxPopperjsPlacements } from 'ngx-popperjs';
@@ -40,6 +40,10 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
40
40
  * Highlighting is used to add visual emphasize to a message when jumping to the message
41
41
  */
42
42
  isHighlighted: boolean;
43
+ /**
44
+ * A list of custom message actions to be displayed in the action box
45
+ */
46
+ customActions: CustomMessageActionItem[];
43
47
  readonly themeVersion: '1' | '2';
44
48
  canReceiveReadEvents: boolean | undefined;
45
49
  canReactToMessage: boolean | undefined;
@@ -102,6 +106,6 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
102
106
  private fixEmojiDisplay;
103
107
  private wrapLinskWithAnchorTag;
104
108
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageComponent, never>;
105
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "message": "message"; "enabledMessageActions": "enabledMessageActions"; "isLastSentMessage": "isLastSentMessage"; "mode": "mode"; "isHighlighted": "isHighlighted"; }, {}, never, never>;
109
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "message": "message"; "enabledMessageActions": "enabledMessageActions"; "isLastSentMessage": "isLastSentMessage"; "mode": "mode"; "isHighlighted": "isHighlighted"; "customActions": "customActions"; }, {}, never, never>;
106
110
  }
107
111
  export {};
@@ -4,7 +4,7 @@ import { ChannelService } from '../channel.service';
4
4
  import { ChatClientService } from '../chat-client.service';
5
5
  import { CustomTemplatesService } from '../custom-templates.service';
6
6
  import { NotificationService } from '../notification.service';
7
- import { MessageActionBoxItemContext, MessageActionItem, MessageInputContext, ModalContext, StreamMessage } from '../types';
7
+ import { CustomMessageActionItem, MessageActionBoxItemContext, MessageActionItem, MessageInputContext, ModalContext, StreamMessage } from '../types';
8
8
  import * as i0 from "@angular/core";
9
9
  /**
10
10
  * The `MessageActionsBox` component displays a list of message actions (i.e edit), that can be opened or closed. You can find the [list of the supported actions](../concepts/message-interactions.mdx) in the message interaction guide.
@@ -31,6 +31,10 @@ export declare class MessageActionsBoxComponent implements OnChanges, OnDestroy
31
31
  * The list of [channel capabilities](https://getstream.io/chat/docs/javascript/channel_capabilities/?language=javascript) that are enabled for the current user, the list of [supported interactions](../concepts/message-interactions.mdx) can be found in our message interaction guide. Unathorized actions won't be displayed on the UI.
32
32
  */
33
33
  enabledActions: string[];
34
+ /**
35
+ * A list of custom message actions to be displayed in the action box
36
+ */
37
+ customActions: CustomMessageActionItem[];
34
38
  /**
35
39
  * The number of authorized actions (it can be less or equal than the number of enabled actions)
36
40
  */
@@ -44,7 +48,7 @@ export declare class MessageActionsBoxComponent implements OnChanges, OnDestroy
44
48
  messageActionItemTemplate: TemplateRef<MessageActionBoxItemContext> | undefined;
45
49
  modalTemplate: TemplateRef<ModalContext> | undefined;
46
50
  subscriptions: Subscription[];
47
- visibleMessageActionItems: MessageActionItem[];
51
+ visibleMessageActionItems: (MessageActionItem | CustomMessageActionItem)[];
48
52
  sendMessage$: Observable<void>;
49
53
  private readonly messageActionItems;
50
54
  private modalContent;
@@ -52,12 +56,12 @@ export declare class MessageActionsBoxComponent implements OnChanges, OnDestroy
52
56
  constructor(chatClientService: ChatClientService, notificationService: NotificationService, channelService: ChannelService, customTemplatesService: CustomTemplatesService);
53
57
  ngOnChanges(changes: SimpleChanges): void;
54
58
  ngOnDestroy(): void;
55
- getActionLabel(actionLabelOrTranslationKey: (() => string) | string): string;
59
+ getActionLabel(actionLabelOrTranslationKey: ((message: StreamMessage) => string) | string): string;
56
60
  sendClicked(): void;
57
61
  modalClosed: () => void;
58
62
  getMessageInputContext(): MessageInputContext;
59
63
  getEditModalContext(): ModalContext;
60
- trackByActionName(_: number, item: MessageActionItem): "delete" | "flag" | "quote" | "pin" | "edit";
64
+ trackByActionName(_: number, item: MessageActionItem | CustomMessageActionItem): string;
61
65
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageActionsBoxComponent, never>;
62
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageActionsBoxComponent, "stream-message-actions-box", never, { "isOpen": "isOpen"; "isMine": "isMine"; "message": "message"; "enabledActions": "enabledActions"; }, { "displayedActionsCount": "displayedActionsCount"; "isEditing": "isEditing"; }, never, never>;
66
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageActionsBoxComponent, "stream-message-actions-box", never, { "isOpen": "isOpen"; "isMine": "isMine"; "message": "message"; "enabledActions": "enabledActions"; "customActions": "customActions"; }, { "displayedActionsCount": "displayedActionsCount"; "isEditing": "isEditing"; }, never, never>;
63
67
  }
@@ -1,7 +1,7 @@
1
1
  import { AfterViewChecked, AfterViewInit, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
2
  import { ChannelService } from '../channel.service';
3
3
  import { Observable } from 'rxjs';
4
- import { MessageContext, StreamMessage, TypingIndicatorContext } from '../types';
4
+ import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem } from '../types';
5
5
  import { ChatClientService } from '../chat-client.service';
6
6
  import { GroupStyle } from './group-styles';
7
7
  import { UserResponse } from 'stream-chat';
@@ -31,6 +31,10 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
31
31
  * You can hide the "jump to latest" button while scrolling. A potential use-case for this input would be to [workaround a known issue on iOS Safar](https://github.com/GetStream/stream-chat-angular/issues/418)
32
32
  */
33
33
  hideJumpToLatestButtonDuringScroll: boolean;
34
+ /**
35
+ * A list of custom message actions to be displayed in the message action box
36
+ */
37
+ customMessageActions: CustomMessageActionItem<any>[];
34
38
  messageTemplate: TemplateRef<MessageContext> | undefined;
35
39
  messages$: Observable<StreamMessage[]>;
36
40
  enabledMessageActions: string[];
@@ -86,5 +90,5 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
86
90
  private scrollToLatestMessage;
87
91
  private newMessageReceived;
88
92
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
89
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; }, {}, never, never>;
93
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; }, {}, never, never>;
90
94
  }
package/lib/types.d.ts CHANGED
@@ -110,6 +110,7 @@ export declare type MessageContext = {
110
110
  isLastSentMessage: boolean | undefined;
111
111
  mode: 'thread' | 'main';
112
112
  isHighlighted: boolean;
113
+ customActions: CustomMessageActionItem[];
113
114
  };
114
115
  export declare type ChannelActionsContext<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
115
116
  channel: Channel<T>;
@@ -150,19 +151,29 @@ export declare type MessageActionsBoxContext = {
150
151
  isMine: boolean;
151
152
  message: StreamMessage | undefined;
152
153
  enabledActions: string[];
154
+ customActions: CustomMessageActionItem[];
155
+ /**
156
+ * @deprecated because the name contains typos, use the `displayedActionsCountChangeHandler` instead
157
+ */
153
158
  displayedActionsCountChaneHanler: (count: number) => any;
159
+ displayedActionsCountChangeHandler: (count: number) => any;
154
160
  isEditingChangeHandler: (isEditing: boolean) => any;
155
161
  };
156
- export declare type MessageActionBoxItemContext = {
157
- actionName: 'quote' | 'pin' | 'flag' | 'edit' | 'delete';
158
- actionLabelOrTranslationKey: (() => string) | string;
162
+ export declare type MessageActionBoxItemContext<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
163
+ actionName: 'quote' | 'pin' | 'flag' | 'edit' | 'delete' | string;
164
+ actionLabelOrTranslationKey: ((message: StreamMessage<T>) => string) | string;
159
165
  actionHandler: () => any;
160
166
  };
161
- export declare type MessageActionItem = {
167
+ declare type MessageActionItemBase<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
168
+ actionLabelOrTranslationKey: ((message: StreamMessage<T>) => string) | string;
169
+ isVisible: (enabledActions: string[], isMine: boolean, message: StreamMessage<T>) => boolean;
170
+ actionHandler: (message: StreamMessage<T>, isMine: boolean) => any;
171
+ };
172
+ export declare type MessageActionItem<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = MessageActionItemBase<T> & {
162
173
  actionName: 'quote' | 'pin' | 'flag' | 'edit' | 'delete';
163
- actionLabelOrTranslationKey: (() => string) | string;
164
- isVisible: (enabledActions: string[], isMine: boolean, message: StreamMessage) => boolean;
165
- actionHandler: (message: StreamMessage, isMine: boolean) => any;
174
+ };
175
+ export declare type CustomMessageActionItem<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = MessageActionItemBase<T> & {
176
+ actionName: string;
166
177
  };
167
178
  export declare type MessageReactionsContext = {
168
179
  messageId: string | undefined;
@@ -220,3 +231,4 @@ export declare type CustomAttachmentUploadContext = {
220
231
  export declare type AttachmentContext = {
221
232
  attachment: Attachment<DefaultStreamChatGenerics>;
222
233
  };
234
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.23.2",
3
+ "version": "4.25.0",
4
4
  "description": "Angular components to create chat conversations or livestream style chat",
5
5
  "author": "GetStream",
6
6
  "homepage": "https://getstream.io/chat/",
@@ -1 +1 @@
1
- export const version = '4.23.2';
1
+ export const version = '4.25.0';