@cometchat/chat-uikit-react-native 5.2.3 → 5.2.5
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.
- package/package.json +1 -1
- package/src/CometChatConversations/CometChatConversations.tsx +167 -86
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +312 -116
- package/src/CometChatMessageComposer/styles.tsx +2 -1
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +83 -17
- package/src/CometChatMessageList/CometChatMessageList.tsx +675 -122
- package/src/CometChatMessageList/style.ts +4 -2
- package/src/CometChatSearch/CometChatSearch.tsx +2165 -0
- package/src/CometChatSearch/SearchConstants.ts +46 -0
- package/src/CometChatSearch/Skeleton.tsx +192 -0
- package/src/CometChatSearch/index.ts +1 -0
- package/src/CometChatSearch/style.ts +414 -0
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +43 -7
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +45 -7
- package/src/extensions/Polls/Polls.tsx +36 -2
- package/src/extensions/Polls/PollsBubble.tsx +13 -9
- package/src/extensions/Polls/PollsDecorator.tsx +13 -1
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +50 -11
- package/src/extensions/Stickers/style.ts +0 -1
- package/src/index.ts +5 -0
- package/src/shared/base/Types.ts +8 -0
- package/src/shared/constants/UIKitConstants.ts +2 -0
- package/src/shared/events/CometChatMessageEvents/index.ts +8 -7
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +158 -27
- package/src/shared/framework/DataSource.ts +7 -0
- package/src/shared/framework/DataSourceDecorator.tsx +12 -0
- package/src/shared/framework/MessageDataSource.tsx +182 -1
- package/src/shared/helper/functions.js +0 -67
- package/src/shared/helper/helperFunctions.ts +72 -0
- package/src/shared/icons/components/documents.tsx +23 -0
- package/src/shared/icons/components/empty-search.tsx +52 -0
- package/src/shared/icons/components/message-blocked.tsx +1 -1
- package/src/shared/icons/components/unread.tsx +29 -0
- package/src/shared/icons/icon-mapping.tsx +7 -0
- package/src/shared/index.ts +2 -1
- package/src/shared/modals/CometChatMessageTemplate.ts +23 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +4 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +17 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +70 -34
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +60 -24
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +60 -24
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +40 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +38 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +40 -4
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +274 -23
- package/src/shared/utils/MessageUtils.tsx +0 -1
- package/src/shared/views/CometChatAudioBubble/style.ts +0 -2
- package/src/shared/views/CometChatFileBubble/style.ts +0 -4
- package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +1 -0
- package/src/shared/views/CometChatList/CometChatList.tsx +12 -0
- package/src/shared/views/CometChatList/Header.tsx +79 -49
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
- package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +390 -0
- package/src/shared/views/CometChatReportDialog/index.ts +3 -0
- package/src/shared/views/CometChatReportDialog/style.ts +164 -0
- package/src/shared/views/CometChatStatusIndicator/private.png +0 -0
- package/src/shared/views/CometChatStatusIndicator/protected.png +0 -0
- package/src/shared/views/CometChatStatusIndicator/styles.ts +2 -2
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +18 -2
- package/src/shared/views/index.ts +6 -0
- package/src/theme/default/default.ts +3 -0
- package/src/theme/provider.tsx +23 -12
- package/src/theme/type.ts +2 -0
|
@@ -92,7 +92,7 @@ export const getComposerStyle = (
|
|
|
92
92
|
): DeepPartial<MessageComposerStyle> => {
|
|
93
93
|
return {
|
|
94
94
|
containerStyle: {
|
|
95
|
-
backgroundColor: color.
|
|
95
|
+
backgroundColor: color.background3,
|
|
96
96
|
width: "100%",
|
|
97
97
|
},
|
|
98
98
|
messageInputStyles: {
|
|
@@ -101,6 +101,7 @@ export const getComposerStyle = (
|
|
|
101
101
|
borderWidth: spacing.spacing.s0_5 / 2,
|
|
102
102
|
borderColor: color.borderDefault,
|
|
103
103
|
backgroundColor: color.background1,
|
|
104
|
+
borderTopWidth:0,
|
|
104
105
|
},
|
|
105
106
|
textStyle: {
|
|
106
107
|
padding: spacing.padding.p3,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { JSX, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { Text, TouchableOpacity, View
|
|
2
|
+
import { Text, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import { ChatConfigurator, getLastSeenTime } from "../shared";
|
|
4
4
|
import { listners } from "./listners";
|
|
5
5
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
@@ -16,6 +16,7 @@ import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
|
16
16
|
import { DeepPartial } from "../shared/helper/types";
|
|
17
17
|
import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
|
|
18
18
|
import { CometChatAIAssistantChatHistory } from "../CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory";
|
|
19
|
+
import { CometChatTooltipMenu, MenuItemInterface } from "../shared/views/CometChatTooltipMenu";
|
|
19
20
|
|
|
20
21
|
export type CometChatMessageHeaderInterface = {
|
|
21
22
|
/**
|
|
@@ -118,6 +119,10 @@ export type CometChatMessageHeaderInterface = {
|
|
|
118
119
|
* Callback when agent chat history button is clicked (only applies to @agentic users)
|
|
119
120
|
*/
|
|
120
121
|
onChatHistoryButtonClick?: () => void;
|
|
122
|
+
/**
|
|
123
|
+
* A function to **replace** the default menu items entirely.
|
|
124
|
+
*/
|
|
125
|
+
options?: ({ user, group }: { user?: CometChat.User; group?: CometChat.Group }) => MenuItemInterface[];
|
|
121
126
|
};
|
|
122
127
|
|
|
123
128
|
interface Translations {
|
|
@@ -154,6 +159,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
154
159
|
hideChatHistoryButton = false,
|
|
155
160
|
onNewChatButtonClick,
|
|
156
161
|
onChatHistoryButtonClick,
|
|
162
|
+
options,
|
|
157
163
|
} = props;
|
|
158
164
|
|
|
159
165
|
const [groupObj, setGroupObj] = useState(group);
|
|
@@ -161,6 +167,8 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
161
167
|
const [userStatus, setUserStatus] = useState(user && user.getStatus ? user.getStatus() : "");
|
|
162
168
|
const [typingText, setTypingText] = useState("");
|
|
163
169
|
const [showHistoryModal, setShowHistoryModal] = useState(false);
|
|
170
|
+
const [showOptionsMenu, setShowOptionsMenu] = useState(false);
|
|
171
|
+
const [tooltipPosition, setTooltipPosition] = useState({ pageX: 0, pageY: 0 });
|
|
164
172
|
const receiverTypeRef = useRef(
|
|
165
173
|
user ? CometChat.RECEIVER_TYPE.USER : group ? CometChat.RECEIVER_TYPE.GROUP : null
|
|
166
174
|
);
|
|
@@ -170,6 +178,21 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
170
178
|
return userObj?.getRole?.() === '@agentic';
|
|
171
179
|
}, [userObj]);
|
|
172
180
|
|
|
181
|
+
// Build menu items following CometChat pattern
|
|
182
|
+
const buildMenuItems = useCallback((): MenuItemInterface[] => {
|
|
183
|
+
if (options) return options({ user: userObj, group: groupObj });
|
|
184
|
+
|
|
185
|
+
return [];
|
|
186
|
+
}, [options, userObj, groupObj, isAgenticUser]);
|
|
187
|
+
|
|
188
|
+
// Handle option selection
|
|
189
|
+
const handleOptionSelect = useCallback((item: MenuItemInterface) => {
|
|
190
|
+
setShowOptionsMenu(false);
|
|
191
|
+
if (item.onPress) {
|
|
192
|
+
item.onPress();
|
|
193
|
+
}
|
|
194
|
+
}, []);
|
|
195
|
+
|
|
173
196
|
|
|
174
197
|
useEffect(() => {
|
|
175
198
|
setGroupObj(group);
|
|
@@ -473,6 +496,7 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
473
496
|
);
|
|
474
497
|
};
|
|
475
498
|
|
|
499
|
+
const menuItems = buildMenuItems();
|
|
476
500
|
|
|
477
501
|
return (
|
|
478
502
|
<>
|
|
@@ -502,27 +526,69 @@ export const CometChatMessageHeader = (props: CometChatMessageHeaderInterface) =
|
|
|
502
526
|
alignItems: "center"
|
|
503
527
|
}}>
|
|
504
528
|
<View style={{ marginLeft: "auto", flexDirection: "row" }}>
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
{TrailingView && !isAgenticUser() &&
|
|
529
|
+
{(() => {
|
|
530
|
+
const isAgenticUser = userObj?.getRole?.() === '@agentic';
|
|
531
|
+
|
|
532
|
+
if (isAgenticUser && !AuxiliaryButtonView) {
|
|
533
|
+
return renderAgentAuxiliaryView();
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return AuxiliaryButtonView
|
|
537
|
+
? AuxiliaryButtonView({ user: userObj, group })
|
|
538
|
+
: ChatConfigurator.getDataSource().getAuxiliaryHeaderAppbarOptions(userObj, group, {
|
|
539
|
+
callButtonStyle: messageHeaderStyles.callButtonStyle,
|
|
540
|
+
hideVideoCallButton,
|
|
541
|
+
hideVoiceCallButton,
|
|
542
|
+
});
|
|
543
|
+
})()}
|
|
544
|
+
{TrailingView && !isAgenticUser() && (
|
|
545
|
+
<View style={{ marginLeft: theme.spacing.padding.p4 }}>
|
|
546
|
+
{TrailingView({ user: userObj, group })}
|
|
547
|
+
</View>
|
|
548
|
+
)}
|
|
549
|
+
{menuItems.length > 0 && (
|
|
550
|
+
<TouchableOpacity
|
|
551
|
+
style={{ marginLeft: theme.spacing.padding.p2 }}
|
|
552
|
+
onPress={(e) => {
|
|
553
|
+
if (e.nativeEvent) {
|
|
554
|
+
setTooltipPosition({
|
|
555
|
+
pageX: e.nativeEvent.pageX || 200,
|
|
556
|
+
pageY: e.nativeEvent.pageY || 100,
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
setShowOptionsMenu(true);
|
|
560
|
+
}}
|
|
561
|
+
>
|
|
562
|
+
<Icon
|
|
563
|
+
name="more-vert"
|
|
564
|
+
width={24}
|
|
565
|
+
height={24}
|
|
566
|
+
color={messageHeaderStyles.backButtonIconStyle.tintColor}
|
|
567
|
+
/>
|
|
568
|
+
</TouchableOpacity>
|
|
569
|
+
)}
|
|
521
570
|
</View>
|
|
522
571
|
</View>
|
|
523
572
|
</View>
|
|
524
573
|
)}
|
|
525
574
|
|
|
575
|
+
{menuItems.length > 0 && (
|
|
576
|
+
<CometChatTooltipMenu
|
|
577
|
+
visible={showOptionsMenu}
|
|
578
|
+
onClose={() => setShowOptionsMenu(false)}
|
|
579
|
+
event={{
|
|
580
|
+
nativeEvent: tooltipPosition,
|
|
581
|
+
}}
|
|
582
|
+
menuItems={menuItems.map((item) => ({
|
|
583
|
+
text: item.text,
|
|
584
|
+
onPress: () => {
|
|
585
|
+
handleOptionSelect(item);
|
|
586
|
+
},
|
|
587
|
+
icon: item.icon,
|
|
588
|
+
textStyle: item.textStyle,
|
|
589
|
+
}))}
|
|
590
|
+
/>
|
|
591
|
+
)}
|
|
526
592
|
</>
|
|
527
593
|
);
|
|
528
594
|
};
|