stream-chat-angular 5.11.2 → 5.12.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 (36) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/esm2020/assets/version.mjs +2 -2
  3. package/esm2020/lib/custom-templates.service.mjs +6 -2
  4. package/esm2020/lib/message/message.component.mjs +41 -127
  5. package/esm2020/lib/message-input/message-input.component.mjs +12 -4
  6. package/esm2020/lib/message-text/message-text.component.mjs +137 -0
  7. package/esm2020/lib/stream-chat.module.mjs +8 -3
  8. package/esm2020/lib/types.mjs +1 -1
  9. package/esm2020/public-api.mjs +2 -1
  10. package/fesm2015/stream-chat-angular.mjs +223 -161
  11. package/fesm2015/stream-chat-angular.mjs.map +1 -1
  12. package/fesm2020/stream-chat-angular.mjs +215 -154
  13. package/fesm2020/stream-chat-angular.mjs.map +1 -1
  14. package/lib/custom-templates.service.d.ts +6 -2
  15. package/lib/message/message.component.d.ts +5 -21
  16. package/lib/message-input/message-input.component.d.ts +3 -2
  17. package/lib/message-text/message-text.component.d.ts +45 -0
  18. package/lib/stream-chat.module.d.ts +8 -7
  19. package/lib/types.d.ts +5 -0
  20. package/package.json +1 -1
  21. package/public-api.d.ts +1 -0
  22. package/src/assets/styles/css/index.css +2 -2
  23. package/src/assets/styles/css/index.layout.css +2 -2
  24. package/src/assets/styles/scss/AIStateIndicator/AIStateIndicator-layout.scss +3 -0
  25. package/src/assets/styles/scss/AIStateIndicator/AIStateIndicator-theme.scss +7 -0
  26. package/src/assets/styles/scss/Avatar/Avatar-layout.scss +48 -0
  27. package/src/assets/styles/scss/Avatar/Avatar-theme.scss +5 -0
  28. package/src/assets/styles/scss/ChannelPreview/ChannelPreview-layout.scss +24 -0
  29. package/src/assets/styles/scss/ChannelPreview/ChannelPreview-theme.scss +18 -0
  30. package/src/assets/styles/scss/Message/Message-layout.scss +12 -5
  31. package/src/assets/styles/scss/MessageInput/MessageInput-layout.scss +7 -1
  32. package/src/assets/styles/scss/MessageInput/MessageInput-theme.scss +9 -3
  33. package/src/assets/styles/scss/_icons.scss +1 -0
  34. package/src/assets/styles/scss/index.layout.scss +1 -0
  35. package/src/assets/styles/scss/index.scss +1 -0
  36. package/src/assets/version.ts +1 -1
@@ -1,13 +1,13 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, ChannelPreviewInfoContext, CommandAutocompleteListItemContext, CustomAttachmentListContext, CustomAttachmentPreviewListContext, CustomAttachmentUploadContext, CustomMetadataContext, DateSeparatorContext, DefaultStreamChatGenerics, DeliveredStatusContext, EmojiPickerContext, IconContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageReactionsContext, MessageReactionsSelectorContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, ThreadReplyButtonContext, TypingIndicatorContext, UnreadMessagesIndicatorContext, UnreadMessagesNotificationContext } from './types';
3
+ import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, ChannelPreviewInfoContext, CommandAutocompleteListItemContext, CustomAttachmentListContext, CustomAttachmentPreviewListContext, CustomAttachmentUploadContext, CustomMetadataContext, DateSeparatorContext, DefaultStreamChatGenerics, DeliveredStatusContext, EmojiPickerContext, IconContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageReactionsContext, MessageReactionsSelectorContext, MessageTextContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, ThreadReplyButtonContext, TypingIndicatorContext, UnreadMessagesIndicatorContext, UnreadMessagesNotificationContext } from './types';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * A central location for registering your custom templates to override parts of the chat application.
7
7
  *
8
8
  * 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).
9
9
  *
10
- * You can find the type definitions of the context that is provided for each template [on GitHub](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angu)
10
+ * You can find the type definitions of the context that is provided for each template [on GitHub](https://github.com/GetStream/stream-chat-angular/blob/master/projects/stream-chat-angular/src/lib/types.ts)
11
11
  */
12
12
  export declare class CustomTemplatesService<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> {
13
13
  /**
@@ -227,6 +227,10 @@ export declare class CustomTemplatesService<T extends DefaultStreamChatGenerics
227
227
  * To properly position your template you should override the `grid-template-areas` of the `.str-chat__message-inner` selector
228
228
  */
229
229
  customMessageMetadataInsideBubbleTemplate$: BehaviorSubject<TemplateRef<CustomMetadataContext<DefaultStreamChatGenerics>> | undefined>;
230
+ /**
231
+ * Template to display the text content inside the [message component](/chat/docs/sdk/angular/components/MessageComponent/). The default component is [stream-message-text](/chat/docs/sdk/angular/components/MessageTextComponent/)
232
+ */
233
+ messageTextTemplate$: BehaviorSubject<TemplateRef<MessageTextContext> | undefined>;
230
234
  constructor();
231
235
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService<any>, never>;
232
236
  static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService<any>>;
@@ -2,20 +2,14 @@ import { OnChanges, SimpleChanges, OnDestroy, OnInit, ChangeDetectorRef, AfterVi
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, SystemMessageContext, CustomMetadataContext } from '../types';
5
+ import { AttachmentListContext, MessageActionsBoxContext, MessageReactionsContext, DefaultStreamChatGenerics, StreamMessage, DeliveredStatusContext, SendingStatusContext, ReadStatusContext, SystemMessageContext, CustomMetadataContext, MessageTextContext } from '../types';
6
6
  import { Observable } from 'rxjs';
7
7
  import { CustomTemplatesService } from '../custom-templates.service';
8
8
  import { DateParserService } from '../date-parser.service';
9
- import { MessageService } from '../message.service';
10
9
  import { MessageActionsService } from '../message-actions.service';
11
10
  import { NgxFloatUiContentComponent, NgxFloatUiLooseDirective } from 'ngx-float-ui';
12
11
  import { TranslateService } from '@ngx-translate/core';
13
12
  import * as i0 from "@angular/core";
14
- declare type MessagePart = {
15
- content: string;
16
- type: 'text' | 'mention';
17
- user?: UserResponse;
18
- };
19
13
  /**
20
14
  * 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)](/chat/docs/sdk/angular/concepts/message-interactions/).
21
15
  */
@@ -25,7 +19,6 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, A
25
19
  customTemplatesService: CustomTemplatesService;
26
20
  private cdRef;
27
21
  private dateParser;
28
- private messageService;
29
22
  messageActionsService: MessageActionsService;
30
23
  private ngZone;
31
24
  private translateService;
@@ -56,15 +49,12 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, A
56
49
  canReceiveReadEvents: boolean | undefined;
57
50
  canReactToMessage: boolean | undefined;
58
51
  isEditedFlagOpened: boolean;
59
- messageTextParts: MessagePart[] | undefined;
60
- messageText?: string;
61
52
  shouldDisplayTranslationNotice: boolean;
62
53
  displayedMessageTextContent: 'original' | 'translation';
63
54
  imageAttachmentModalState: 'opened' | 'closed';
64
55
  shouldDisplayThreadLink: boolean;
65
56
  isSentByCurrentUser: boolean;
66
57
  readByText: string;
67
- displayAs: 'text' | 'html';
68
58
  lastReadUser: UserResponse<DefaultStreamChatGenerics> | undefined;
69
59
  isOnlyReadByMe: boolean;
70
60
  isReadByMultipleUsers: boolean;
@@ -84,8 +74,6 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, A
84
74
  private subscriptions;
85
75
  private isViewInited;
86
76
  private userId?;
87
- private readonly urlRegexp;
88
- private emojiRegexp;
89
77
  messageMenuTrigger: NgxFloatUiLooseDirective;
90
78
  messageMenuFloat: NgxFloatUiContentComponent;
91
79
  messageTextElement?: ElementRef<HTMLElement>;
@@ -94,7 +82,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, A
94
82
  private shouldPreventMessageMenuClose;
95
83
  private _visibleMessageActionsCount;
96
84
  private channelMemberCount?;
97
- constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, dateParser: DateParserService, messageService: MessageService, messageActionsService: MessageActionsService, ngZone: NgZone, translateService: TranslateService);
85
+ constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, dateParser: DateParserService, messageActionsService: MessageActionsService, ngZone: NgZone, translateService: TranslateService);
98
86
  get visibleMessageActionsCount(): number;
99
87
  set visibleMessageActionsCount(count: number);
100
88
  ngOnInit(): void;
@@ -110,25 +98,22 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, A
110
98
  messageActionsBoxClicked(floatingContent: NgxFloatUiContentComponent): void;
111
99
  getAttachmentListContext(): AttachmentListContext;
112
100
  getMessageContext(): SystemMessageContext;
101
+ getMessageTextContext(): MessageTextContext;
102
+ getQuotedMessageTextContext(): MessageTextContext;
113
103
  getQuotedMessageAttachmentListContext(): AttachmentListContext;
114
104
  getMessageReactionsContext(): MessageReactionsContext;
115
105
  messageClicked(): void;
116
106
  resendMessage(): void;
117
107
  setAsActiveParentMessage(): void;
118
- getMentionContext(messagePart: MessagePart): MentionTemplateContext;
119
108
  getMessageActionsBoxContext(): MessageActionsBoxContext;
120
109
  getDeliveredStatusContext(): DeliveredStatusContext;
121
110
  getSendingStatusContext(): SendingStatusContext;
122
111
  getReadStatusContext(): ReadStatusContext;
123
112
  getMessageMetadataContext(): CustomMetadataContext;
124
113
  jumpToMessage(messageId: string, parentMessageId?: string): void;
114
+ openMessageBouncePrompt(): void;
125
115
  displayTranslatedMessage(): void;
126
116
  displayOriginalMessage(): void;
127
- openMessageBouncePrompt(): void;
128
- private createMessageParts;
129
- private getMessageContent;
130
- private fixEmojiDisplay;
131
- private wrapLinksWithAnchorTag;
132
117
  private updateReadByText;
133
118
  private setIsSentByCurrentUser;
134
119
  private setLastReadUser;
@@ -138,4 +123,3 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy, A
138
123
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageComponent, never>;
139
124
  static ɵcmp: i0.ɵɵComponentDeclaration<MessageComponent, "stream-message", never, { "message": "message"; "enabledMessageActions": "enabledMessageActions"; "isLastSentMessage": "isLastSentMessage"; "mode": "mode"; "isHighlighted": "isHighlighted"; "scroll$": "scroll$"; }, {}, never, never, false, never>;
140
125
  }
141
- export {};
@@ -4,7 +4,7 @@ import { Attachment, UserResponse } from 'stream-chat';
4
4
  import { AttachmentService } from '../attachment.service';
5
5
  import { ChannelService } from '../channel.service';
6
6
  import { NotificationService } from '../notification.service';
7
- import { AttachmentPreviewListContext, AttachmentUpload, AudioRecording, CustomAttachmentUploadContext, DefaultStreamChatGenerics, EmojiPickerContext, StreamMessage } from '../types';
7
+ import { AttachmentPreviewListContext, AttachmentUpload, AudioRecording, CustomAttachmentUploadContext, DefaultStreamChatGenerics, EmojiPickerContext, MessageTextContext, StreamMessage } from '../types';
8
8
  import { MessageInputConfigService } from './message-input-config.service';
9
9
  import { TextareaInterface } from './textarea.interface';
10
10
  import { EmojiInputService } from './emoji-input.service';
@@ -25,7 +25,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
25
25
  private componentFactoryResolver;
26
26
  private cdRef;
27
27
  private emojiInputService;
28
- private customTemplatesService;
28
+ readonly customTemplatesService: CustomTemplatesService;
29
29
  private messageActionsService;
30
30
  readonly voiceRecorderService: VoiceRecorderService;
31
31
  audioRecorder?: AudioRecorderService | undefined;
@@ -157,6 +157,7 @@ export declare class MessageInputComponent implements OnInit, OnChanges, OnDestr
157
157
  getEmojiPickerContext(): EmojiPickerContext;
158
158
  getAttachmentPreviewListContext(): AttachmentPreviewListContext;
159
159
  getAttachmentUploadContext(): CustomAttachmentUploadContext;
160
+ getQuotedMessageTextContext(): MessageTextContext;
160
161
  startVoiceRecording(): Promise<void>;
161
162
  voiceRecordingReady(recording: AudioRecording): Promise<void>;
162
163
  get isUpdate(): boolean;
@@ -0,0 +1,45 @@
1
+ import { OnChanges, SimpleChanges } from '@angular/core';
2
+ import { DefaultStreamChatGenerics, MentionTemplateContext, StreamMessage } from '../types';
3
+ import { MessageResponseBase, UserResponse } from 'stream-chat';
4
+ import { MessageService } from '../message.service';
5
+ import { CustomTemplatesService } from '../custom-templates.service';
6
+ import * as i0 from "@angular/core";
7
+ declare type MessagePart = {
8
+ content: string;
9
+ type: 'text' | 'mention';
10
+ user?: UserResponse;
11
+ };
12
+ /**
13
+ * The `MessageTextComponent` displays the text content of a message.
14
+ */
15
+ export declare class MessageTextComponent implements OnChanges {
16
+ private messageService;
17
+ readonly customTemplatesService: CustomTemplatesService;
18
+ /**
19
+ * The message which text should be displayed
20
+ */
21
+ message: StreamMessage<DefaultStreamChatGenerics> | undefined | MessageResponseBase<DefaultStreamChatGenerics>;
22
+ /**
23
+ * `true` if the component displayes a message quote
24
+ */
25
+ isQuoted: boolean;
26
+ /**
27
+ * `true` if the
28
+ */
29
+ shouldTranslate: boolean;
30
+ messageTextParts: MessagePart[] | undefined;
31
+ messageText?: string;
32
+ displayAs: 'text' | 'html';
33
+ private readonly urlRegexp;
34
+ private emojiRegexp;
35
+ constructor(messageService: MessageService, customTemplatesService: CustomTemplatesService);
36
+ ngOnChanges(changes: SimpleChanges): void;
37
+ getMentionContext(messagePart: MessagePart): MentionTemplateContext;
38
+ private createMessageParts;
39
+ private getMessageContent;
40
+ private fixEmojiDisplay;
41
+ private wrapLinksWithAnchorTag;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<MessageTextComponent, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageTextComponent, "stream-message-text", never, { "message": "message"; "isQuoted": "isQuoted"; "shouldTranslate": "shouldTranslate"; }, {}, never, never, false, never>;
44
+ }
45
+ export {};
@@ -19,14 +19,15 @@ import * as i17 from "./message-bounce-prompt/message-bounce-prompt.component";
19
19
  import * as i18 from "./message-reactions-selector/message-reactions-selector.component";
20
20
  import * as i19 from "./user-list/user-list.component";
21
21
  import * as i20 from "./paginated-list/paginated-list.component";
22
- import * as i21 from "@angular/common";
23
- import * as i22 from "ngx-float-ui";
24
- import * as i23 from "./stream-avatar.module";
25
- import * as i24 from "@ngx-translate/core";
26
- import * as i25 from "./voice-recording/voice-recording.module";
27
- import * as i26 from "./icon/icon.module";
22
+ import * as i21 from "./message-text/message-text.component";
23
+ import * as i22 from "@angular/common";
24
+ import * as i23 from "ngx-float-ui";
25
+ import * as i24 from "./stream-avatar.module";
26
+ import * as i25 from "@ngx-translate/core";
27
+ import * as i26 from "./voice-recording/voice-recording.module";
28
+ import * as i27 from "./icon/icon.module";
28
29
  export declare class StreamChatModule {
29
30
  static ɵfac: i0.ɵɵFactoryDeclaration<StreamChatModule, never>;
30
- 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.MessageActionsBoxComponent, typeof i9.AttachmentListComponent, typeof i10.MessageReactionsComponent, typeof i11.NotificationComponent, typeof i12.NotificationListComponent, typeof i13.AttachmentPreviewListComponent, typeof i14.ModalComponent, typeof i15.TextareaDirective, typeof i16.ThreadComponent, typeof i17.MessageBouncePromptComponent, typeof i18.MessageReactionsSelectorComponent, typeof i19.UserListComponent, typeof i20.PaginatedListComponent], [typeof i21.CommonModule, typeof i22.NgxFloatUiModule, typeof i23.StreamAvatarModule, typeof i24.TranslateModule, typeof i25.VoiceRecordingModule, typeof i26.IconModule], [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.MessageActionsBoxComponent, typeof i9.AttachmentListComponent, typeof i10.MessageReactionsComponent, typeof i11.NotificationComponent, typeof i12.NotificationListComponent, typeof i13.AttachmentPreviewListComponent, typeof i14.ModalComponent, typeof i23.StreamAvatarModule, typeof i16.ThreadComponent, typeof i17.MessageBouncePromptComponent, typeof i25.VoiceRecordingModule, typeof i18.MessageReactionsSelectorComponent, typeof i19.UserListComponent, typeof i20.PaginatedListComponent, typeof i26.IconModule]>;
31
+ 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.MessageActionsBoxComponent, typeof i9.AttachmentListComponent, typeof i10.MessageReactionsComponent, typeof i11.NotificationComponent, typeof i12.NotificationListComponent, typeof i13.AttachmentPreviewListComponent, typeof i14.ModalComponent, typeof i15.TextareaDirective, typeof i16.ThreadComponent, typeof i17.MessageBouncePromptComponent, typeof i18.MessageReactionsSelectorComponent, typeof i19.UserListComponent, typeof i20.PaginatedListComponent, typeof i21.MessageTextComponent], [typeof i22.CommonModule, typeof i23.NgxFloatUiModule, typeof i24.StreamAvatarModule, typeof i25.TranslateModule, typeof i26.VoiceRecordingModule, typeof i27.IconModule], [typeof i1.ChannelComponent, typeof i2.ChannelHeaderComponent, typeof i3.ChannelListComponent, typeof i4.ChannelPreviewComponent, typeof i5.MessageComponent, typeof i6.MessageInputComponent, typeof i7.MessageListComponent, typeof i8.MessageActionsBoxComponent, typeof i9.AttachmentListComponent, typeof i10.MessageReactionsComponent, typeof i11.NotificationComponent, typeof i12.NotificationListComponent, typeof i13.AttachmentPreviewListComponent, typeof i14.ModalComponent, typeof i24.StreamAvatarModule, typeof i16.ThreadComponent, typeof i17.MessageBouncePromptComponent, typeof i26.VoiceRecordingModule, typeof i18.MessageReactionsSelectorComponent, typeof i19.UserListComponent, typeof i20.PaginatedListComponent, typeof i27.IconModule, typeof i21.MessageTextComponent]>;
31
32
  static ɵinj: i0.ɵɵInjectorDeclaration<StreamChatModule>;
32
33
  }
package/lib/types.d.ts CHANGED
@@ -377,4 +377,9 @@ export declare type CustomAutocomplete = {
377
377
  */
378
378
  updateOptions?: (searchTerm: string) => Promise<CustomAutocompleteItem[]>;
379
379
  };
380
+ export declare type MessageTextContext = {
381
+ message: StreamMessage | undefined | MessageResponseBase;
382
+ isQuoted: boolean;
383
+ shouldTranslate: boolean;
384
+ };
380
385
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "5.11.2",
3
+ "version": "5.12.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/",
package/public-api.d.ts CHANGED
@@ -76,3 +76,4 @@ export * from './lib/voice-recorder//voice-recorder-wavebar/voice-recorder-waveb
76
76
  export * from './lib/format-duration';
77
77
  export * from './lib/message-input/voice-recorder.service';
78
78
  export * from './lib/voice-recorder/mp3-transcoder';
79
+ export * from './lib/message-text/message-text.component';