stream-chat-angular 4.1.0 → 4.2.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 (32) hide show
  1. package/assets/version.d.ts +1 -1
  2. package/bundles/stream-chat-angular.umd.js +148 -47
  3. package/bundles/stream-chat-angular.umd.js.map +1 -1
  4. package/esm2015/assets/version.js +2 -2
  5. package/esm2015/lib/attachment-configuration.service.js +92 -17
  6. package/esm2015/lib/attachment-list/attachment-list.component.js +49 -21
  7. package/esm2015/lib/attachment.service.js +4 -1
  8. package/esm2015/lib/channel.service.js +5 -3
  9. package/esm2015/lib/message/message.component.js +7 -8
  10. package/esm2015/lib/message-list/message-list.component.js +2 -2
  11. package/esm2015/lib/types.js +1 -1
  12. package/fesm2015/stream-chat-angular.js +154 -47
  13. package/fesm2015/stream-chat-angular.js.map +1 -1
  14. package/lib/attachment-configuration.service.d.ts +17 -6
  15. package/lib/attachment-list/attachment-list.component.d.ts +9 -7
  16. package/lib/message/message.component.d.ts +1 -20
  17. package/lib/types.d.ts +4 -0
  18. package/package.json +1 -1
  19. package/src/assets/styles/css/index.css +1 -1
  20. package/src/assets/styles/css/index.css.map +1 -1
  21. package/src/assets/styles/scss/Attachment.scss +45 -2
  22. package/src/assets/styles/scss/Gallery.scss +12 -6
  23. package/src/assets/styles/scss/Message.scss +2 -1
  24. package/src/assets/styles/v2/css/index.css +1 -1
  25. package/src/assets/styles/v2/css/index.css.map +1 -1
  26. package/src/assets/styles/v2/css/index.layout.css +1 -1
  27. package/src/assets/styles/v2/css/index.layout.css.map +1 -1
  28. package/src/assets/styles/v2/scss/AttachmentList/AttachmentList-layout.scss +72 -46
  29. package/src/assets/styles/v2/scss/Message/Message-layout.scss +0 -16
  30. package/src/assets/styles/v2/scss/MessageReactions/MessageReactions-layout.scss +1 -10
  31. package/src/assets/styles/v2/scss/Tooltip/Tooltip-layout.scss +2 -23
  32. package/src/assets/version.ts +1 -1
@@ -1,18 +1,18 @@
1
1
  import { Attachment } from 'stream-chat';
2
- import { AttachmentConfigration, DefaultStreamChatGenerics } from './types';
2
+ import { AttachmentConfigration, DefaultStreamChatGenerics, VideoAttachmentConfiguration } from './types';
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
- * The `AttachmentConfigurationService` provides customization for certain attributes of attachments displayed inside the message component.
5
+ * The `AttachmentConfigurationService` provides customization for certain attributes of attachments displayed inside the message component. If you're using your own CDN, you can integrate resizing features of it by providing your own handlers.
6
6
  */
7
7
  export declare class AttachmentConfigurationService<T extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> {
8
8
  /**
9
9
  * A custom handler can be provided to override the default image attachment (images uploaded from files) configuration. By default the SDK uses fixed image height (a size that's known before image is loaded), if you override that with dynamic image height (for example: height: 100%) the scrolling logic inside the message list can break.
10
10
  */
11
- customImageAttachmentConfigurationHandler?: (a: Attachment<T>, type: 'gallery' | 'single' | 'carousel') => AttachmentConfigration;
11
+ customImageAttachmentConfigurationHandler?: (a: Attachment<T>, type: 'gallery' | 'single' | 'carousel', containerElement: HTMLElement) => AttachmentConfigration;
12
12
  /**
13
13
  * A custom handler can be provided to override the default video attachment (videos uploaded from files) configuration. By default the SDK uses fixed height (a size that's known before video is loaded), if you override that with dynamic height (for example: height: 100%) the scrolling logic inside the message list can break.
14
14
  */
15
- customVideoAttachmentConfigurationHandler?: (a: Attachment<T>) => AttachmentConfigration;
15
+ customVideoAttachmentConfigurationHandler?: (a: Attachment<T>, containerElement: HTMLElement) => VideoAttachmentConfiguration;
16
16
  /**
17
17
  * A custom handler can be provided to override the default giphy attachment (GIFs sent with the /giphy command) configuration. By default the SDK uses fixed height (a size that's known before the GIF is loaded), if you override that with dynamic height (for example: height: 100%) the scrolling logic inside the message list can break.
18
18
  */
@@ -21,17 +21,23 @@ export declare class AttachmentConfigurationService<T extends DefaultStreamChatG
21
21
  * A custom handler can be provided to override the default scraped image attachment (images found in links inside messages) configuration. By default the SDK uses fixed height (a size that's known before image is loaded), if you override that with dynamic height (for example: height: 100%) the scrolling logic inside the message list can break.
22
22
  */
23
23
  customScrapedImageAttachmentConfigurationHandler?: (a: Attachment<T>) => AttachmentConfigration;
24
+ /**
25
+ * You can turn on/off thumbnail generation for video attachments
26
+ */
27
+ shouldGenerateVideoThumbnail: boolean;
24
28
  /**
25
29
  * Handles the configuration for image attachments, it's possible to provide your own function to override the default logic
26
30
  * @param attachment The attachment to configure
27
31
  * @param location Specifies where the image is being displayed
32
+ * @param element The default resizing logics reads the height/max-height and max-width propperties of this element and reduces file size based on the given values. File size reduction is done by Stream's CDN.
28
33
  */
29
- getImageAttachmentConfiguration(attachment: Attachment<T>, location: 'gallery' | 'single' | 'carousel'): AttachmentConfigration;
34
+ getImageAttachmentConfiguration(attachment: Attachment<T>, location: 'gallery' | 'single' | 'carousel', element: HTMLElement): AttachmentConfigration;
30
35
  /**
31
36
  * Handles the configuration for video attachments, it's possible to provide your own function to override the default logic
32
37
  * @param attachment The attachment to configure
38
+ * @param element The default resizing logics reads the height/max-height and max-width propperties of this element and reduces file size based on the given values. File size reduction is done by Stream's CDN.
33
39
  */
34
- getVideoAttachmentConfiguration(attachment: Attachment<T>): AttachmentConfigration;
40
+ getVideoAttachmentConfiguration(attachment: Attachment<T>, element: HTMLElement): VideoAttachmentConfiguration;
35
41
  /**
36
42
  * Handles the configuration for giphy attachments, it's possible to provide your own function to override the default logic
37
43
  * @param attachment The attachment to configure
@@ -42,6 +48,11 @@ export declare class AttachmentConfigurationService<T extends DefaultStreamChatG
42
48
  * @param attachment The attachment to configure
43
49
  */
44
50
  getScrapedImageAttachmentConfiguration(attachment: Attachment<T>): AttachmentConfigration;
51
+ private addResizingParamsToUrl;
52
+ private getSizingRestrictions;
53
+ private getSizeRestrictions;
54
+ private getCSSSizeRestriction;
55
+ private getValueRepresentationOfCSSProperty;
45
56
  static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentConfigurationService<any>, never>;
46
57
  static ɵprov: i0.ɵɵInjectableDeclaration<AttachmentConfigurationService<any>>;
47
58
  }
@@ -1,6 +1,6 @@
1
- import { OnChanges } from '@angular/core';
1
+ import { OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { Action, Attachment } from 'stream-chat';
3
- import { ModalContext, DefaultStreamChatGenerics } from '../types';
3
+ import { ModalContext, DefaultStreamChatGenerics, AttachmentConfigration, VideoAttachmentConfiguration } from '../types';
4
4
  import { ChannelService } from '../channel.service';
5
5
  import { CustomTemplatesService } from '../custom-templates.service';
6
6
  import { AttachmentConfigurationService } from '../attachment-configuration.service';
@@ -31,9 +31,10 @@ export declare class AttachmentListComponent implements OnChanges {
31
31
  imagesToViewCurrentIndex: number;
32
32
  themeVersion: '1' | '2';
33
33
  private modalContent;
34
+ private attachmentConfigurations;
34
35
  constructor(customTemplatesService: CustomTemplatesService, channelService: ChannelService, attachmentConfigurationService: AttachmentConfigurationService, themeService: ThemeService);
35
- ngOnChanges(): void;
36
- trackById(index: number): number;
36
+ ngOnChanges(changes: SimpleChanges): void;
37
+ trackByUrl(_: number, attachment: Attachment): unknown;
37
38
  isImage(attachment: Attachment): boolean;
38
39
  isSvg(attachment: Attachment): boolean;
39
40
  isFile(attachment: Attachment): boolean;
@@ -49,9 +50,10 @@ export declare class AttachmentListComponent implements OnChanges {
49
50
  openImageModal(attachments: Attachment[], selectedIndex?: number): void;
50
51
  stepImages(dir: -1 | 1): void;
51
52
  trackByImageUrl(_: number, item: Attachment): unknown;
52
- getImageAttachmentConfiguration(attachment: Attachment, type: 'gallery' | 'single' | 'carousel'): import("../types").AttachmentConfigration;
53
- getVideoAttachmentConfiguration(attachment: Attachment): import("../types").AttachmentConfigration;
54
- getCardAttachmentConfiguration(attachment: Attachment): import("../types").AttachmentConfigration;
53
+ getImageAttachmentConfiguration(attachment: Attachment, type: 'gallery' | 'single', element: HTMLElement): AttachmentConfigration;
54
+ getCarouselImageAttachmentConfiguration(attachment: Attachment, element: HTMLElement): AttachmentConfigration;
55
+ getVideoAttachmentConfiguration(attachment: Attachment, element: HTMLElement): VideoAttachmentConfiguration;
56
+ getCardAttachmentConfiguration(attachment: Attachment): AttachmentConfigration;
55
57
  get isImageModalPrevButtonVisible(): boolean;
56
58
  get isImageModalNextButtonVisible(): boolean;
57
59
  private createGallery;
@@ -55,6 +55,7 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
55
55
  popperTriggerClick: NgxPopperjsTriggers;
56
56
  popperTriggerHover: NgxPopperjsTriggers;
57
57
  popperPlacementAuto: NgxPopperjsPlacements;
58
+ private quotedMessageAttachments;
58
59
  private user;
59
60
  private subscriptions;
60
61
  private container;
@@ -77,26 +78,6 @@ export declare class MessageComponent implements OnInit, OnChanges, OnDestroy {
77
78
  replyCount: number | undefined;
78
79
  };
79
80
  get canDisplayReadStatus(): boolean;
80
- get quotedMessageAttachments(): import("stream-chat").Attachment<{
81
- attachmentType: import("stream-chat").UR & import("../types").UnknownType & {
82
- asset_url?: string | undefined;
83
- id?: string | undefined;
84
- images?: import("stream-chat").Attachment<DefaultStreamChatGenerics>[] | undefined;
85
- mime_type?: string | undefined;
86
- };
87
- channelType: import("stream-chat").UR & import("../types").UnknownType & {
88
- image?: string | undefined;
89
- member_count?: number | undefined;
90
- subtitle?: string | undefined;
91
- };
92
- commandType: string & {};
93
- eventType: import("stream-chat").UR & import("../types").UnknownType;
94
- messageType: {};
95
- reactionType: import("stream-chat").UR & import("../types").UnknownType;
96
- userType: import("stream-chat").UR & import("../types").UnknownType & import("../types").DefaultUserTypeInternal & {
97
- mutes?: import("stream-chat").Mute<DefaultStreamChatGenerics>[] | undefined;
98
- };
99
- }>[];
100
81
  getAttachmentListContext(): AttachmentListContext;
101
82
  getQuotedMessageAttachmentListContext(): AttachmentListContext;
102
83
  getMessageReactionsContext(): MessageReactionsContext;
package/lib/types.d.ts CHANGED
@@ -52,6 +52,7 @@ export declare type AttachmentUpload = {
52
52
  url?: string;
53
53
  type: 'image' | 'file' | 'video';
54
54
  previewUri?: string | ArrayBuffer;
55
+ thumb_url?: string;
55
56
  };
56
57
  export declare type MentionAutcompleteListItemContext = {
57
58
  item: MentionAutcompleteListItem;
@@ -185,3 +186,6 @@ export declare type AttachmentConfigration = {
185
186
  height: string;
186
187
  width: string;
187
188
  };
189
+ export declare type VideoAttachmentConfiguration = AttachmentConfigration & {
190
+ thumbUrl?: string;
191
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat-angular",
3
- "version": "4.1.0",
3
+ "version": "4.2.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/",