stream-chat-angular 4.29.1 → 4.31.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 (45) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/bundles/stream-chat-angular.umd.js +164 -78
  3. package/bundles/stream-chat-angular.umd.js.map +1 -1
  4. package/esm2015/assets/version.js +2 -2
  5. package/esm2015/lib/avatar-placeholder/avatar-placeholder.component.js +14 -4
  6. package/esm2015/lib/channel-list/channel-list.component.js +2 -7
  7. package/esm2015/lib/custom-templates.service.js +5 -1
  8. package/esm2015/lib/date-parser.service.js +40 -0
  9. package/esm2015/lib/icon-placeholder/icon-placeholder.component.js +5 -4
  10. package/esm2015/lib/message/message.component.js +17 -16
  11. package/esm2015/lib/message-input/message-input.component.js +3 -1
  12. package/esm2015/lib/message-list/message-list.component.js +42 -20
  13. package/esm2015/lib/parse-date.js +19 -0
  14. package/esm2015/lib/types.js +1 -1
  15. package/esm2015/public-api.js +3 -2
  16. package/fesm2015/stream-chat-angular.js +142 -60
  17. package/fesm2015/stream-chat-angular.js.map +1 -1
  18. package/lib/avatar-placeholder/avatar-placeholder.component.d.ts +4 -2
  19. package/lib/channel-list/channel-list.component.d.ts +0 -1
  20. package/lib/custom-templates.service.d.ts +5 -1
  21. package/lib/date-parser.service.d.ts +29 -0
  22. package/lib/icon-placeholder/icon-placeholder.component.d.ts +4 -2
  23. package/lib/message/message.component.d.ts +3 -1
  24. package/lib/message-list/message-list.component.d.ts +16 -4
  25. package/lib/parse-date.d.ts +1 -0
  26. package/lib/types.d.ts +4 -0
  27. package/package.json +1 -1
  28. package/public-api.d.ts +2 -1
  29. package/src/assets/styles/css/index.css +1 -1
  30. package/src/assets/styles/css/index.css.map +1 -1
  31. package/src/assets/styles/scss/Card.scss +27 -2
  32. package/src/assets/styles/v2/css/index.css +1 -1
  33. package/src/assets/styles/v2/css/index.css.map +1 -1
  34. package/src/assets/styles/v2/css/index.layout.css +1 -1
  35. package/src/assets/styles/v2/css/index.layout.css.map +1 -1
  36. package/src/assets/styles/v2/scss/Channel/Channel-layout.scss +4 -0
  37. package/src/assets/styles/v2/scss/Message/Message-layout.scss +4 -2
  38. package/src/assets/styles/v2/scss/MessageList/MessageList-layout.scss +4 -0
  39. package/src/assets/styles/v2/scss/Thread/Thread-layout.scss +5 -0
  40. package/src/assets/styles/v2/scss/TypingIndicator/TypingIndicator-layout.scss +4 -0
  41. package/src/assets/styles/v2/scss/_emoji-replacement.scss +40 -0
  42. package/src/assets/styles/v2/scss/index.layout.scss +1 -0
  43. package/src/assets/version.ts +1 -1
  44. package/esm2015/lib/message/parse-date.js +0 -8
  45. package/lib/message/parse-date.d.ts +0 -1
@@ -1,3 +1,4 @@
1
+ import { OnChanges } from '@angular/core';
1
2
  import { Channel, User } from 'stream-chat';
2
3
  import { CustomTemplatesService } from '../custom-templates.service';
3
4
  import { AvatarContext, AvatarLocation, AvatarType, DefaultStreamChatGenerics } from '../types';
@@ -5,7 +6,7 @@ import * as i0 from "@angular/core";
5
6
  /**
6
7
  * The `AvatarPlaceholder` component displays the [default avatar](./AvatarComponent.mdx) unless a [custom template](../services/CustomTemplatesService.mdx) is provided. This component is used by the SDK internally, you likely won't need to use it.
7
8
  */
8
- export declare class AvatarPlaceholderComponent {
9
+ export declare class AvatarPlaceholderComponent implements OnChanges {
9
10
  customTemplatesService: CustomTemplatesService;
10
11
  /**
11
12
  * An optional name of the image, used for fallback image or image title (if `imageUrl` is provided)
@@ -39,8 +40,9 @@ export declare class AvatarPlaceholderComponent {
39
40
  * If channel/user image isn't provided the initials of the name of the channel/user is shown instead, you can choose how the initals should be computed
40
41
  */
41
42
  initialsType: 'first-letter-of-first-word' | 'first-letter-of-each-word';
43
+ context: AvatarContext;
42
44
  constructor(customTemplatesService: CustomTemplatesService);
43
- getAvatarContext(): AvatarContext;
45
+ ngOnChanges(): void;
44
46
  static ɵfac: i0.ɵɵFactoryDeclaration<AvatarPlaceholderComponent, never>;
45
47
  static ɵcmp: i0.ɵɵComponentDeclaration<AvatarPlaceholderComponent, "stream-avatar-placeholder", never, { "name": "name"; "imageUrl": "imageUrl"; "size": "size"; "location": "location"; "channel": "channel"; "user": "user"; "type": "type"; "initialsType": "initialsType"; }, {}, never, never>;
46
48
  }
@@ -31,7 +31,6 @@ export declare class ChannelListComponent implements AfterViewInit, OnDestroy {
31
31
  loadMoreChannels(): Promise<void>;
32
32
  trackByChannelId(index: number, item: Channel<DefaultStreamChatGenerics>): string;
33
33
  channelSelected(): void;
34
- getChannelPreviewContext(channel: Channel<DefaultStreamChatGenerics>): ChannelPreviewContext<DefaultStreamChatGenerics>;
35
34
  static ɵfac: i0.ɵɵFactoryDeclaration<ChannelListComponent, never>;
36
35
  static ɵcmp: i0.ɵɵComponentDeclaration<ChannelListComponent, "stream-channel-list", never, {}, {}, never, ["[channel-list-top]", "[channel-list-bottom]"]>;
37
36
  }
@@ -1,6 +1,6 @@
1
1
  import { TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject } from 'rxjs';
3
- import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext } from './types';
3
+ import { AttachmentContext, AttachmentListContext, AttachmentPreviewListContext, AvatarContext, ChannelActionsContext, ChannelHeaderInfoContext, ChannelPreviewContext, CommandAutocompleteListItemContext, CustomAttachmentUploadContext, DateSeparatorContext, DeliveredStatusContext, EmojiPickerContext, IconContext, LoadingIndicatorContext, MentionAutcompleteListItemContext, MentionTemplateContext, MessageActionBoxItemContext, MessageActionsBoxContext, MessageContext, MessageInputContext, MessageReactionsContext, ModalContext, NotificationContext, ReadStatusContext, SendingStatusContext, SystemMessageContext, ThreadHeaderContext, TypingIndicatorContext } 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.
@@ -184,6 +184,10 @@ export declare class CustomTemplatesService {
184
184
  * The template used to display [system messages](https://getstream.io/chat/docs/javascript/silent_messages/?language=javascript&q=system) indise the [message component](../components/MessageComponent.mdx)
185
185
  */
186
186
  systemMessageTemplate$: BehaviorSubject<TemplateRef<SystemMessageContext> | undefined>;
187
+ /**
188
+ * The template used to display the date separator inside the [message list](../components/MessageListComponent.mdx)
189
+ */
190
+ dateSeparatorTemplate$: BehaviorSubject<TemplateRef<DateSeparatorContext> | undefined>;
187
191
  constructor();
188
192
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomTemplatesService, never>;
189
193
  static ɵprov: i0.ɵɵInjectableDeclaration<CustomTemplatesService>;
@@ -0,0 +1,29 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * The `DateParserService` parses dates into user-friendly string representations.
4
+ */
5
+ export declare class DateParserService {
6
+ /**
7
+ * Custom parser to override `parseDate`
8
+ */
9
+ customDateParser?: (date: Date) => string;
10
+ /**
11
+ * Custom parser to override `parseDateTime`
12
+ */
13
+ customDateTimeParser?: (date: Date) => string;
14
+ constructor();
15
+ /**
16
+ * Return a user-friendly string representation of the date (year, month and date)
17
+ * @param date
18
+ * @returns
19
+ */
20
+ parseDate(date: Date): string;
21
+ /**
22
+ * Return a user-friendly string representation of the date and time
23
+ * @param date
24
+ * @returns
25
+ */
26
+ parseDateTime(date: Date): string;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<DateParserService, never>;
28
+ static ɵprov: i0.ɵɵInjectableDeclaration<DateParserService>;
29
+ }
@@ -1,3 +1,4 @@
1
+ import { OnChanges } from '@angular/core';
1
2
  import { CustomTemplatesService } from '../custom-templates.service';
2
3
  import { Icon } from '../icon/icon.component';
3
4
  import { IconContext } from '../types';
@@ -5,7 +6,7 @@ import * as i0 from "@angular/core";
5
6
  /**
6
7
  * The `IconPlaceholder` component displays the [default icons](./IconComponent.mdx) unless a [custom template](../services/CustomTemplatesService.mdx) is provided. This component is used by the SDK internally, you likely won't need to use it.
7
8
  */
8
- export declare class IconPlaceholderComponent {
9
+ export declare class IconPlaceholderComponent implements OnChanges {
9
10
  customTemplatesService: CustomTemplatesService;
10
11
  /**
11
12
  * The icon to display, the list of [supported icons](https://github.com/GetStream/stream-chat-angular/tree/master/projects/stream-chat-angular/src/lib/icon/icon.component.ts) can be found on GitHub.
@@ -15,8 +16,9 @@ export declare class IconPlaceholderComponent {
15
16
  * The size of the icon (in pixels)
16
17
  */
17
18
  size: number | undefined;
19
+ iconContext: IconContext;
18
20
  constructor(customTemplatesService: CustomTemplatesService);
19
- getIconContext(): IconContext;
21
+ ngOnChanges(): void;
20
22
  static ɵfac: i0.ɵɵFactoryDeclaration<IconPlaceholderComponent, never>;
21
23
  static ɵcmp: i0.ɵɵComponentDeclaration<IconPlaceholderComponent, "stream-icon-placeholder", never, { "icon": "icon"; "size": "size"; }, {}, never, never>;
22
24
  }
@@ -6,6 +6,7 @@ import { AttachmentListContext, MentionTemplateContext, MessageActionsBoxContext
6
6
  import { CustomTemplatesService } from '../custom-templates.service';
7
7
  import { ThemeService } from '../theme.service';
8
8
  import { NgxPopperjsTriggers, NgxPopperjsPlacements } from 'ngx-popperjs';
9
+ import { DateParserService } from '../date-parser.service';
9
10
  import * as i0 from "@angular/core";
10
11
  declare type MessagePart = {
11
12
  content: string;
@@ -20,6 +21,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
20
21
  private channelService;
21
22
  private customTemplatesService;
22
23
  private cdRef;
24
+ private dateParser;
23
25
  /**
24
26
  * The message to be displayed
25
27
  */
@@ -70,7 +72,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
70
72
  private user;
71
73
  private subscriptions;
72
74
  private container;
73
- constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, themeService: ThemeService);
75
+ constructor(chatClientService: ChatClientService, channelService: ChannelService, customTemplatesService: CustomTemplatesService, cdRef: ChangeDetectorRef, themeService: ThemeService, dateParser: DateParserService);
74
76
  ngOnInit(): void;
75
77
  ngOnChanges(changes: SimpleChanges): void;
76
78
  ngOnDestroy(): void;
@@ -1,11 +1,12 @@
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, CustomMessageActionItem } from '../types';
4
+ import { MessageContext, StreamMessage, TypingIndicatorContext, CustomMessageActionItem, DateSeparatorContext } from '../types';
5
5
  import { ChatClientService } from '../chat-client.service';
6
6
  import { GroupStyle } from './group-styles';
7
7
  import { UserResponse } from 'stream-chat';
8
8
  import { CustomTemplatesService } from '../custom-templates.service';
9
+ import { DateParserService } from '../date-parser.service';
9
10
  import * as i0 from "@angular/core";
10
11
  /**
11
12
  * The `MessageList` component renders a scrollable list of messages.
@@ -14,6 +15,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
14
15
  private channelService;
15
16
  private chatClientService;
16
17
  private customTemplatesService;
18
+ private dateParser;
17
19
  /**
18
20
  * Determines if the message list should display channel messages or [thread messages](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
19
21
  */
@@ -35,7 +37,16 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
35
37
  * A list of custom message actions to be displayed in the message action box
36
38
  */
37
39
  customMessageActions: CustomMessageActionItem<any>[];
40
+ /**
41
+ * If `true` date separators will be displayed
42
+ */
43
+ displayDateSeparator: boolean;
44
+ /**
45
+ * If date separators are displayed, you can set the horizontal position of the date text.
46
+ */
47
+ dateSeparatorTextPos: 'center' | 'right' | 'left';
38
48
  messageTemplate: TemplateRef<MessageContext> | undefined;
49
+ customDateSeparatorTemplate: TemplateRef<DateSeparatorContext> | undefined;
39
50
  messages$: Observable<StreamMessage[]>;
40
51
  enabledMessageActions: string[];
41
52
  private class;
@@ -62,7 +73,7 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
62
73
  private usersTypingInChannel$;
63
74
  private usersTypingInThread$;
64
75
  private isLatestMessageInList;
65
- constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService);
76
+ constructor(channelService: ChannelService, chatClientService: ChatClientService, customTemplatesService: CustomTemplatesService, dateParser: DateParserService);
66
77
  ngOnInit(): void;
67
78
  ngOnChanges(changes: SimpleChanges): void;
68
79
  ngAfterViewInit(): void;
@@ -75,8 +86,9 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
75
86
  scrollToTop(): void;
76
87
  scrolled(): void;
77
88
  getTypingIndicatorContext(): TypingIndicatorContext;
78
- getMessageContext(message: StreamMessage): MessageContext;
79
89
  getTypingIndicatorText(users: UserResponse[]): string;
90
+ areOnSeparateDates(message: StreamMessage, nextMessage?: StreamMessage): boolean;
91
+ parseDate(date: Date): string;
80
92
  get replyCountParam(): {
81
93
  replyCount: number | undefined;
82
94
  };
@@ -90,5 +102,5 @@ export declare class MessageListComponent implements AfterViewChecked, OnChanges
90
102
  private scrollToLatestMessage;
91
103
  private newMessageReceived;
92
104
  static ɵfac: i0.ɵɵFactoryDeclaration<MessageListComponent, never>;
93
- static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; }, {}, never, never>;
105
+ static ɵcmp: i0.ɵɵComponentDeclaration<MessageListComponent, "stream-message-list", never, { "mode": "mode"; "direction": "direction"; "messageOptionsTrigger": "messageOptionsTrigger"; "hideJumpToLatestButtonDuringScroll": "hideJumpToLatestButtonDuringScroll"; "customMessageActions": "customMessageActions"; "displayDateSeparator": "displayDateSeparator"; "dateSeparatorTextPos": "dateSeparatorTextPos"; }, {}, never, never>;
94
106
  }
@@ -0,0 +1 @@
1
+ export declare const parseDate: (date: Date, format?: 'date' | 'date-time') => string;
package/lib/types.d.ts CHANGED
@@ -236,4 +236,8 @@ export declare type AttachmentContext = {
236
236
  export declare type SystemMessageContext = MessageContext & {
237
237
  parsedDate: string | undefined;
238
238
  };
239
+ export declare type DateSeparatorContext = {
240
+ date: Date;
241
+ parsedDate: string;
242
+ };
239
243
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.29.1",
3
+ "version": "4.31.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
@@ -17,7 +17,7 @@ export * from './lib/channel-preview/channel-preview.component';
17
17
  export * from './lib/channel-list/channel-list.component';
18
18
  export * from './lib/channel-list/channel-list-toggle.service';
19
19
  export * from './lib/message/message.component';
20
- export * from './lib/message/parse-date';
20
+ export * from './lib/parse-date';
21
21
  export * from './lib/list-users';
22
22
  export * from './lib/message-input/message-input.component';
23
23
  export * from './lib/message-input/textarea/textarea.component';
@@ -51,4 +51,5 @@ export * from './lib/stream-textarea.module';
51
51
  export * from './lib/injection-tokens';
52
52
  export * from './lib/custom-templates.service';
53
53
  export * from './lib/message-reactions.service';
54
+ export * from './lib/date-parser.service';
54
55
  export * from './lib/types';