@cometchat/chat-uikit-react 5.0.3 → 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 (38) hide show
  1. package/README.md +3 -3
  2. package/SUPPORT.md +1 -1
  3. package/dist/index.d.ts +177 -5630
  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/components/CometChatFullScreenViewer.css +1 -1
  9. package/dist/styles/components/{CometChatThreadedMessagePreview.css → CometChatThreadHeader.css} +23 -23
  10. package/dist/styles/components/index.css +1 -1
  11. package/dist/styles/index.css +1 -1
  12. package/dist/types/Enums/Enums.d.ts +0 -10
  13. package/dist/types/components/BaseComponents/CometChatDate/CometChatDate.d.ts +2 -3
  14. package/dist/types/components/BaseComponents/CometChatEmojiKeyboard/emojis.d.ts +8 -8
  15. package/dist/types/components/BaseComponents/CometChatFullScreenViewer/CometChatFullScreenViewer.d.ts +5 -5
  16. package/dist/types/components/Calling/CallingConfiguration.d.ts +2 -0
  17. package/dist/types/components/Calling/CallingExtensionDecorator.d.ts +6 -0
  18. package/dist/types/components/Calling/CometChatCallLogs/CometChatCallLogs.d.ts +4 -4
  19. package/dist/types/components/Calling/Utils/utils.d.ts +0 -1
  20. package/dist/types/components/CometChatConversations/CometChatConversations.d.ts +4 -3
  21. package/dist/types/components/CometChatMessageHeader/CometChatMessageHeader.d.ts +5 -0
  22. package/dist/types/components/CometChatMessageInformation/CometChatMessageInformation.d.ts +9 -0
  23. package/dist/types/components/CometChatMessageList/CometChatMessageList.d.ts +18 -9
  24. package/dist/types/components/{CometChatThreadedMessagePreview/CometChatThreadedMessagePreview.d.ts → CometChatThreadHeader/CometChatThreadHeader.d.ts} +13 -4
  25. package/dist/types/events/CometChatMessageEvents.d.ts +0 -2
  26. package/dist/types/index.d.ts +4 -1
  27. package/dist/types/modals/CometChatMessageTemplate.d.ts +3 -2
  28. package/dist/types/resources/CometChatLocalize/cometchat-localize.d.ts +46 -5587
  29. package/dist/types/utils/CalendarObject.d.ts +27 -0
  30. package/dist/types/utils/DataSource.d.ts +3 -2
  31. package/dist/types/utils/DataSourceDecorator.d.ts +3 -2
  32. package/dist/types/utils/Interface.d.ts +24 -0
  33. package/dist/types/utils/MessageUtils.d.ts +3 -2
  34. package/dist/types/utils/MessagesDataSource.d.ts +20 -3
  35. package/dist/types/utils/util.d.ts +4 -0
  36. package/package.json +3 -4
  37. package/screenshots/sample_app_overview.png +0 -0
  38. package/dist/types/components/BaseComponents/CometChatDate/useCometChatDate.d.ts +0 -8
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Represents the configuration for a calendar object.
3
+ */
4
+ export declare class CalendarObject {
5
+ /** Custom formatting for dates that fall on the same day. */
6
+ today?: string;
7
+ /** Custom formatting for dates that fall on the previous day. */
8
+ yesterday?: string;
9
+ /** Custom formatting for dates within the last week. */
10
+ lastWeek?: string;
11
+ /** Custom formatting for dates that do not fit other categories. */
12
+ otherDays?: string;
13
+ /**
14
+ * Relative time formatting for specific time units.
15
+ */
16
+ relativeTime?: {
17
+ /** Formatting for minutes (singular). */
18
+ minute?: string;
19
+ /** Formatting for minutes (plural). */
20
+ minutes?: string;
21
+ /** Formatting for hours (singular). */
22
+ hour?: string;
23
+ /** Formatting for hours (plural). */
24
+ hours?: string;
25
+ };
26
+ constructor(calendaObject: CalendarObject);
27
+ }
@@ -4,8 +4,9 @@ import { CometChatTextFormatter } from "../formatters/CometChatFormatters/CometC
4
4
  import { CometChatUrlsFormatter } from "../formatters/CometChatFormatters/CometChatUrlsFormatter/CometChatUrlsFormatter";
5
5
  import { additionalParams } from "./ConversationUtils";
6
6
  import { CometChatActionsIcon, CometChatActionsView, CometChatMessageComposerAction, CometChatMessageTemplate } from "../modals/";
7
- import { DatePatterns, MessageBubbleAlignment } from "../Enums/Enums";
7
+ import { MessageBubbleAlignment } from "../Enums/Enums";
8
8
  import { ComposerId } from "./MessagesDataSource";
9
+ import { CalendarObject } from "./CalendarObject";
9
10
  /**
10
11
  * Class for providing message options and views.
11
12
  * It is used in AI and calling module and utils related to messages.
@@ -17,7 +18,7 @@ export declare abstract class DataSource {
17
18
  abstract getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
18
19
  abstract getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
19
20
  abstract getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment): Element | JSX.Element | null;
20
- 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;
21
22
  abstract getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignment, otherParams: Object | undefined): Element | JSX.Element;
22
23
  abstract getImageMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
23
24
  abstract getVideoMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): Element | JSX.Element;
@@ -6,7 +6,8 @@ import { CometChatMentionsFormatter } from "../formatters/CometChatFormatters/Co
6
6
  import { CometChatTextFormatter } from "../formatters/CometChatFormatters/CometChatTextFormatter";
7
7
  import { additionalParams } from "./ConversationUtils";
8
8
  import { CometChatActionsIcon, CometChatActionsView, CometChatMessageComposerAction, CometChatMessageTemplate } from "../modals";
9
- import { DatePatterns, MessageBubbleAlignment } from "../Enums/Enums";
9
+ import { MessageBubbleAlignment } from "../Enums/Enums";
10
+ import { CalendarObject } from "./CalendarObject";
10
11
  /**
11
12
  * This class is used in AI, calling and Extension modules.
12
13
  */
@@ -18,7 +19,7 @@ export declare abstract class DataSourceDecorator implements DataSource {
18
19
  getVideoMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
19
20
  getAudioMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
20
21
  getFileMessageOptions(loggedInUser: CometChat.User, messageObject: CometChat.BaseMessage, group?: CometChat.Group, additionalParams?: Object | undefined): Array<CometChatActionsIcon | CometChatActionsView>;
21
- 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;
22
23
  getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignment): JSX.Element | Element | null;
23
24
  getTextMessageContentView(message: CometChat.TextMessage, alignment: MessageBubbleAlignment, additionalConfigurations?: Object | undefined): JSX.Element | Element;
24
25
  getImageMessageContentView(message: CometChat.MediaMessage, alignment: MessageBubbleAlignment): JSX.Element | Element;
@@ -0,0 +1,24 @@
1
+ import { CalendarObject } from "./CalendarObject";
2
+ /**
3
+ * Represents the localization settings for an application or component.
4
+ */
5
+ export interface LocalizationSettings {
6
+ /** The language code (e.g., 'en', 'fr') for the current localization. */
7
+ language?: string;
8
+ /** Object containing key-value pairs for translations in the current language. */
9
+ translationsForLanguage?: {
10
+ [key: string]: any;
11
+ };
12
+ /** Whether to disable automatic language detection. */
13
+ disableAutoDetection?: boolean;
14
+ /** The fallback language code to use if the primary language is not available. */
15
+ fallbackLanguage?: string;
16
+ /** Whether to disable localization for date and time values. */
17
+ disableDateTimeLocalization?: boolean;
18
+ /** The timezone for date and time formatting. */
19
+ timezone?: string;
20
+ /** Custom calendar formatting defined using a CalendarObject. */
21
+ calendarObject?: CalendarObject;
22
+ /** Function to handle missing translation keys. */
23
+ missingKeyHandler?: (key: string) => void;
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
@@ -6,7 +6,8 @@ import { CometChatMentionsFormatter } from "../formatters/CometChatFormatters/Co
6
6
  import { CometChatUrlsFormatter } from "../formatters/CometChatFormatters/CometChatUrlsFormatter/CometChatUrlsFormatter";
7
7
  import { CometChatTextFormatter } from "../formatters/CometChatFormatters/CometChatTextFormatter";
8
8
  import { CometChatActionsIcon, CometChatActionsView, CometChatMessageComposerAction, CometChatMessageTemplate } from "../modals";
9
- import { DatePatterns, MentionsTargetElement, MessageBubbleAlignment } from "../Enums/Enums";
9
+ import { MentionsTargetElement, MessageBubbleAlignment } from "../Enums/Enums";
10
+ import { CalendarObject } from "./CalendarObject";
10
11
  export type ComposerId = {
11
12
  parentMessageId: number | null;
12
13
  user: string | null;
@@ -49,12 +50,28 @@ export declare class MessagesDataSource implements DataSource {
49
50
  */
50
51
  getBubbleStatusInfoReceipt: (item: CometChat.BaseMessage, hideReceipt?: boolean) => JSX.Element | null;
51
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
+ /**
52
69
  * Function to get status and date for message bubble
53
70
  * @param {CometChat.BaseMessage} item - The message bubble for which the information needs to be fetched
54
71
  * @returns {JSX.Element | null} Returns JSX.Element for status and date of a message bubble or null
55
72
  */
56
- getBubbleStatusInfoDate: (item: CometChat.BaseMessage, datePattern?: DatePatterns) => JSX.Element | null;
57
- 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;
58
75
  getBottomView(_messageObject: CometChat.BaseMessage, _alignment: MessageBubbleAlignment): null;
59
76
  getTextMessageTemplate(additionalConfigurations?: additionalParams): CometChatMessageTemplate;
60
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,12 +1,11 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react",
3
- "version": "5.0.3",
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": {
7
7
  "@cometchat/chat-sdk-javascript": "^4.0.10",
8
8
  "@rollup/plugin-json": "^6.1.0",
9
- "postcss": "^8.5.2",
10
9
  "rxjs": "^7.8.1"
11
10
  },
12
11
  "scripts": {
@@ -42,7 +41,7 @@
42
41
  "webpack-dev-server": "^4.7.4"
43
42
  },
44
43
  "homepage": "https://www.cometchat.com",
45
- "repository": "https://github.com/cometchat/cometchat-uikit-react",
44
+ "repository": "https://github.com/cometchat/cometchat-uikit-react/tree/v6",
46
45
  "main": "dist/index.js",
47
46
  "types": "dist/index.d.ts",
48
47
  "keywords": [
@@ -68,4 +67,4 @@
68
67
  "bugs": {
69
68
  "url": "https://help.cometchat.com/hc/en-us"
70
69
  }
71
- }
70
+ }
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
- };