@cometchat/chat-uikit-react 5.0.2 → 6.0.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 (53) hide show
  1. package/README.md +3 -3
  2. package/SUPPORT.md +1 -1
  3. package/dist/index.d.ts +212 -5618
  4. package/dist/index.js +2 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/styles/CometChatFullScreenViewer.css +1 -1
  7. package/dist/styles/{CometChatThreadedMessagePreview.css → CometChatThreadHeader.css} +23 -23
  8. package/dist/styles/CometChatUsers.css +1 -1
  9. package/dist/styles/components/CometChatFullScreenViewer.css +1 -1
  10. package/dist/styles/components/{CometChatThreadedMessagePreview.css → CometChatThreadHeader.css} +23 -23
  11. package/dist/styles/components/CometChatUsers.css +1 -1
  12. package/dist/styles/components/index.css +1 -1
  13. package/dist/styles/index.css +1 -1
  14. package/dist/types/CometChatUIKit/CometChatUIKitUtility.d.ts +1 -0
  15. package/dist/types/Enums/Enums.d.ts +0 -10
  16. package/dist/types/components/BaseComponents/CometChatAudioBubble/src/webaudio.d.ts +2 -2
  17. package/dist/types/components/BaseComponents/CometChatDate/CometChatDate.d.ts +2 -3
  18. package/dist/types/components/BaseComponents/CometChatEmojiKeyboard/emojis.d.ts +8 -8
  19. package/dist/types/components/BaseComponents/CometChatEmojiKeyboard/useCometChatEmojiKeyboard.d.ts +1 -0
  20. package/dist/types/components/BaseComponents/CometChatFullScreenViewer/CometChatFullScreenViewer.d.ts +5 -5
  21. package/dist/types/components/BaseComponents/CometChatMessageBubble/CometChatMessageBubble.d.ts +1 -0
  22. package/dist/types/components/Calling/CallingConfiguration.d.ts +2 -0
  23. package/dist/types/components/Calling/CallingExtensionDecorator.d.ts +6 -0
  24. package/dist/types/components/Calling/CometChatCallLogs/CometChatCallLogs.d.ts +5 -4
  25. package/dist/types/components/Calling/CometChatIncomingCall/CometChatIncomingCall.d.ts +1 -0
  26. package/dist/types/components/Calling/CometChatOutgoingCall/CometChatOutgoingCall.d.ts +1 -0
  27. package/dist/types/components/Calling/OutgoingCallConfiguration.d.ts +1 -0
  28. package/dist/types/components/Calling/Utils/utils.d.ts +0 -1
  29. package/dist/types/components/CometChatConversations/CometChatConversations.d.ts +4 -3
  30. package/dist/types/components/CometChatConversations/controller.d.ts +1 -0
  31. package/dist/types/components/CometChatMessageHeader/CometChatMessageHeader.d.ts +5 -0
  32. package/dist/types/components/CometChatMessageInformation/CometChatMessageInformation.d.ts +9 -0
  33. package/dist/types/components/CometChatMessageList/CometChatMessageList.d.ts +19 -9
  34. package/dist/types/components/{CometChatThreadedMessagePreview/CometChatThreadedMessagePreview.d.ts → CometChatThreadHeader/CometChatThreadHeader.d.ts} +14 -4
  35. package/dist/types/components/CometChatUserMemberWrapper/CometChatUserMemberWrapper.d.ts +1 -0
  36. package/dist/types/components/CometChatUsers/controller.d.ts +1 -0
  37. package/dist/types/components/Extensions/Stickers/StickersExtensionDecorator.d.ts +1 -0
  38. package/dist/types/components/Extensions/ThumbnailGeneration/ThumbnailGenerationExtensionDecorator.d.ts +1 -0
  39. package/dist/types/events/CometChatMessageEvents.d.ts +0 -2
  40. package/dist/types/index.d.ts +4 -1
  41. package/dist/types/modals/CometChatActionsView.d.ts +1 -0
  42. package/dist/types/modals/CometChatMessageTemplate.d.ts +4 -2
  43. package/dist/types/resources/CometChatLocalize/cometchat-localize.d.ts +46 -5541
  44. package/dist/types/utils/CalendarObject.d.ts +2 -2
  45. package/dist/types/utils/DataSource.d.ts +4 -2
  46. package/dist/types/utils/DataSourceDecorator.d.ts +4 -2
  47. package/dist/types/utils/Interface.d.ts +3 -16
  48. package/dist/types/utils/MessageUtils.d.ts +3 -2
  49. package/dist/types/utils/MessagesDataSource.d.ts +22 -3
  50. package/dist/types/utils/util.d.ts +4 -0
  51. package/package.json +2 -2
  52. package/screenshots/sample_app_overview.png +0 -0
  53. package/dist/types/components/BaseComponents/CometChatDate/useCometChatDate.d.ts +0 -8
@@ -3,9 +3,9 @@
3
3
  */
4
4
  export declare class CalendarObject {
5
5
  /** Custom formatting for dates that fall on the same day. */
6
- sameDay?: string;
6
+ today?: string;
7
7
  /** Custom formatting for dates that fall on the previous day. */
8
- lastDay?: string;
8
+ yesterday?: string;
9
9
  /** Custom formatting for dates within the last week. */
10
10
  lastWeek?: string;
11
11
  /** Custom formatting for dates that do not fit other categories. */
@@ -1,10 +1,12 @@
1
+ /// <reference types="react" />
1
2
  import { CometChatMentionsFormatter } from "../formatters/CometChatFormatters/CometChatMentionsFormatter/CometChatMentionsFormatter";
2
3
  import { CometChatTextFormatter } from "../formatters/CometChatFormatters/CometChatTextFormatter";
3
4
  import { CometChatUrlsFormatter } from "../formatters/CometChatFormatters/CometChatUrlsFormatter/CometChatUrlsFormatter";
4
5
  import { additionalParams } from "./ConversationUtils";
5
6
  import { CometChatActionsIcon, CometChatActionsView, CometChatMessageComposerAction, CometChatMessageTemplate } from "../modals/";
6
- import { DatePatterns, MessageBubbleAlignment } from "../Enums/Enums";
7
+ import { MessageBubbleAlignment } from "../Enums/Enums";
7
8
  import { ComposerId } from "./MessagesDataSource";
9
+ import { CalendarObject } from "./CalendarObject";
8
10
  /**
9
11
  * Class for providing message options and views.
10
12
  * It is used in AI and calling module and utils related to messages.
@@ -16,7 +18,7 @@ export declare abstract class DataSource {
16
18
  abstract getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
17
19
  abstract getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
18
20
  abstract getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment): Element | JSX.Element | null;
19
- abstract getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipt?: boolean, datePattern?: DatePatterns): Element | JSX.Element | null;
21
+ abstract getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipt?: boolean, messageSentAtDateTimeFormat?: CalendarObject): Element | JSX.Element | null;
20
22
  abstract getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignment, otherParams: Object | undefined): Element | JSX.Element;
21
23
  abstract getImageMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
22
24
  abstract getVideoMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { DataSource } from "./DataSource";
2
3
  import { ComposerId } from "./MessagesDataSource";
3
4
  import { CometChatUrlsFormatter } from "../formatters/CometChatFormatters/CometChatUrlsFormatter/CometChatUrlsFormatter";
@@ -5,7 +6,8 @@ import { CometChatMentionsFormatter } from "../formatters/CometChatFormatters/Co
5
6
  import { CometChatTextFormatter } from "../formatters/CometChatFormatters/CometChatTextFormatter";
6
7
  import { additionalParams } from "./ConversationUtils";
7
8
  import { CometChatActionsIcon, CometChatActionsView, CometChatMessageComposerAction, CometChatMessageTemplate } from "../modals";
8
- import { DatePatterns, MessageBubbleAlignment } from "../Enums/Enums";
9
+ import { MessageBubbleAlignment } from "../Enums/Enums";
10
+ import { CalendarObject } from "./CalendarObject";
9
11
  /**
10
12
  * This class is used in AI, calling and Extension modules.
11
13
  */
@@ -17,7 +19,7 @@ export declare abstract class DataSourceDecorator implements DataSource {
17
19
  getVideoMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
18
20
  getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
19
21
  getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
20
- getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipt?: boolean, datePattern?: DatePatterns): JSX.Element | Element | null;
22
+ getStatusInfoView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment, hideReceipt?: boolean, messageSentAtDateTimeFormat?: CalendarObject): JSX.Element | Element | null;
21
23
  getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment): JSX.Element | Element | null;
22
24
  getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
23
25
  getImageMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): JSX.Element | Element;
@@ -1,21 +1,8 @@
1
1
  import { CalendarObject } from "./CalendarObject";
2
- /**
3
- * Represents the configuration for date and time localization.
4
- */
5
- export interface DateLocaleConfig {
6
- /** Format string for displaying dates. */
7
- dateFormat?: string;
8
- /** Format string for displaying time. */
9
- timeFormat?: string;
10
- /** Format string for displaying both date and time. */
11
- dateTimeFormat?: string;
12
- /** Custom relative time formatting defined using a CalendarObject. */
13
- relativeTimeFormat?: CalendarObject;
14
- }
15
2
  /**
16
3
  * Represents the localization settings for an application or component.
17
4
  */
18
- export interface LocalisationSettings {
5
+ export interface LocalizationSettings {
19
6
  /** The language code (e.g., 'en', 'fr') for the current localization. */
20
7
  language?: string;
21
8
  /** Object containing key-value pairs for translations in the current language. */
@@ -27,11 +14,11 @@ export interface LocalisationSettings {
27
14
  /** The fallback language code to use if the primary language is not available. */
28
15
  fallbackLanguage?: string;
29
16
  /** Whether to disable localization for date and time values. */
30
- disableDateTimeLocalisation?: boolean;
17
+ disableDateTimeLocalization?: boolean;
31
18
  /** The timezone for date and time formatting. */
32
19
  timezone?: string;
33
20
  /** Custom calendar formatting defined using a CalendarObject. */
34
21
  calendarObject?: CalendarObject;
35
22
  /** Function to handle missing translation keys. */
36
- missingKeyHandler?: (key: string) => string;
23
+ missingKeyHandler?: (key: string) => void;
37
24
  }
@@ -1,5 +1,6 @@
1
1
  import { MessageBubbleAlignment } from "../Enums/Enums";
2
2
  import { CometChatMessageTemplate } from "../modals";
3
+ import { CalendarObject } from "./CalendarObject";
3
4
  /**
4
5
  * Utility class for handling message display and styling.
5
6
  * It is used in CometChatMessageInformation component.
@@ -20,7 +21,7 @@ export declare class MessageUtils {
20
21
  * @param {CometChatMessageTemplate} template - The message template to use for rendering the content view.
21
22
  * @returns {object | null} - The content view for the message, or null if not found.
22
23
  */
23
- getStatusInfoView(message: CometChat.BaseMessage, template: CometChatMessageTemplate, alignment?: MessageBubbleAlignment): any;
24
+ getStatusInfoView(message: CometChat.BaseMessage, template: CometChatMessageTemplate, alignment?: MessageBubbleAlignment, messageSentAtDateTimeFormat?: CalendarObject): any;
24
25
  /**
25
26
  * Retrieves the bubble wrapper for a message based on the provided template.
26
27
  *
@@ -38,7 +39,7 @@ export declare class MessageUtils {
38
39
  * @param {MessageBubbleAlignment} alignment - The alignment of the message bubble (left or right).
39
40
  * @returns {JSX.Element} - The message bubble component.
40
41
  */
41
- getMessageBubble(baseMessage: CometChat.BaseMessage, template: CometChatMessageTemplate, alignment: MessageBubbleAlignment): any;
42
+ getMessageBubble(baseMessage: CometChat.BaseMessage, template: CometChatMessageTemplate, alignment: MessageBubbleAlignment, messageSentAtDateTimeFormat?: CalendarObject): any;
42
43
  /**
43
44
  *
44
45
  * @param {(CometChat.User | CometChat.GroupMember | any)} user
@@ -1,10 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { CometChat } from "@cometchat/chat-sdk-javascript";
1
3
  import { DataSource } from "./DataSource";
2
4
  import { additionalParams } from "./ConversationUtils";
3
5
  import { CometChatMentionsFormatter } from "../formatters/CometChatFormatters/CometChatMentionsFormatter/CometChatMentionsFormatter";
4
6
  import { CometChatUrlsFormatter } from "../formatters/CometChatFormatters/CometChatUrlsFormatter/CometChatUrlsFormatter";
5
7
  import { CometChatTextFormatter } from "../formatters/CometChatFormatters/CometChatTextFormatter";
6
8
  import { CometChatActionsIcon, CometChatActionsView, CometChatMessageComposerAction, CometChatMessageTemplate } from "../modals";
7
- import { DatePatterns, MentionsTargetElement, MessageBubbleAlignment } from "../Enums/Enums";
9
+ import { MentionsTargetElement, MessageBubbleAlignment } from "../Enums/Enums";
10
+ import { CalendarObject } from "./CalendarObject";
8
11
  export type ComposerId = {
9
12
  parentMessageId: number | null;
10
13
  user: string | null;
@@ -47,12 +50,28 @@ export declare class MessagesDataSource implements DataSource {
47
50
  */
48
51
  getBubbleStatusInfoReceipt: (item: CometChat.BaseMessage, hideReceipt?: boolean) => JSX.Element | null;
49
52
  /**
53
+ * Function for displaying the timestamp next to messages.
54
+ * @returns CalendarObject
55
+ */
56
+ getMessageSentAtDateFormat(messageSentAtDateTimeFormat?: CalendarObject): {
57
+ today: string;
58
+ yesterday: string;
59
+ lastWeek?: string | undefined;
60
+ otherDays: string;
61
+ relativeTime?: {
62
+ minute?: string | undefined;
63
+ minutes?: string | undefined;
64
+ hour?: string | undefined;
65
+ hours?: string | undefined;
66
+ } | undefined;
67
+ };
68
+ /**
50
69
  * Function to get status and date for message bubble
51
70
  * @param {CometChat.BaseMessage} item - The message bubble for which the information needs to be fetched
52
71
  * @returns {JSX.Element | null} Returns JSX.Element for status and date of a message bubble or null
53
72
  */
54
- getBubbleStatusInfoDate: (item: CometChat.BaseMessage, datePattern?: DatePatterns) => JSX.Element | null;
55
- getStatusInfoView: (_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment, hideReceipt?: boolean, datePattern?: DatePatterns) => import("react/jsx-runtime").JSX.Element | null;
73
+ getBubbleStatusInfoDate: (item: CometChat.BaseMessage, messageSentAtDateTimeFormat?: CalendarObject) => JSX.Element | null;
74
+ getStatusInfoView: (_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment, hideReceipt?: boolean, messageSentAtDateTimeFormat?: CalendarObject) => import("react/jsx-runtime").JSX.Element | null;
56
75
  getBottomView(_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment): null;
57
76
  getTextMessageTemplate(additionalConfigurations?: additionalParams): CometChatMessageTemplate;
58
77
  getAudioMessageTemplate(): CometChatMessageTemplate;
@@ -1,4 +1,5 @@
1
1
  import WaveSurfer from "../components/BaseComponents/CometChatAudioBubble/src/wavesurfer";
2
+ import { CalendarObject } from "./CalendarObject";
2
3
  interface MediaPlayer {
3
4
  video?: HTMLVideoElement | null;
4
5
  mediaRecorder?: MediaRecorder | null;
@@ -46,4 +47,7 @@ export declare function processFileForAudio(file: File): Promise<File>;
46
47
  */
47
48
  export declare function formatDateFromTimestamp(timestamp: number): string;
48
49
  export declare function isMobileDevice(): boolean;
50
+ export declare function sanitizeCalendarObject(calendarObject?: CalendarObject): {
51
+ [k: string]: any;
52
+ };
49
53
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react",
3
- "version": "5.0.2",
3
+ "version": "6.0.0",
4
4
  "description": "Ready-to-use Chat UI Components for React(Javascript/Web)",
5
5
  "author": "CometChat",
6
6
  "dependencies": {
@@ -41,7 +41,7 @@
41
41
  "webpack-dev-server": "^4.7.4"
42
42
  },
43
43
  "homepage": "https://www.cometchat.com",
44
- "repository": "https://github.com/cometchat/cometchat-uikit-react",
44
+ "repository": "https://github.com/cometchat/cometchat-uikit-react/tree/v6",
45
45
  "main": "dist/index.js",
46
46
  "types": "dist/index.d.ts",
47
47
  "keywords": [
Binary file
@@ -1,8 +0,0 @@
1
- import { DatePatterns } from "../../../Enums/Enums";
2
- export declare const useCometChatDate: ({ timestamp, pattern, customDateString, }: {
3
- timestamp: number;
4
- pattern: DatePatterns;
5
- customDateString: string | null;
6
- }) => {
7
- getFormattedDate: () => string | null;
8
- };