@cometchat/chat-uikit-react-native 5.3.7 → 5.3.9
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/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +6 -3
- package/src/CometChatMessageList/CometChatMessageList.tsx +17 -1
- package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +12 -4
- package/src/CometChatSearch/CometChatSearch.tsx +16 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +58 -0
- package/src/shared/constants/UIKitConstants.ts +5 -1
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +5 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
- package/src/shared/events/CometChatUIEvents.ts +1 -0
- package/src/shared/events/ListenerInitializer.ts +3 -0
- package/src/shared/framework/DataSource.ts +10 -0
- package/src/shared/framework/DataSourceDecorator.tsx +13 -0
- package/src/shared/framework/MessageDataSource.tsx +56 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +501 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +1 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +521 -520
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +521 -520
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +7 -0
- package/src/shared/utils/conversationUtils.ts +8 -0
- package/src/shared/utils/stripRichText.ts +41 -0
- package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +107 -48
- package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +118 -0
- package/src/shared/views/CometChatCardBubble/index.ts +2 -0
- package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +63 -0
- package/src/shared/views/index.ts +2 -0
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import { useTheme } from "../theme";
|
|
|
12
12
|
import { Icon } from "../shared/icons/Icon";
|
|
13
13
|
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
14
14
|
import { DeepPartial } from "../shared/helper/types";
|
|
15
|
+
import { stripRichText } from "../shared/utils/stripRichText";
|
|
15
16
|
import { ChatHistoryStyle, getChatHistoryStyleLight } from "./style";
|
|
16
17
|
import { Skeleton } from "./Skeleton";
|
|
17
18
|
import { CometChatTooltipMenu } from "../shared/views/CometChatTooltipMenu";
|
|
@@ -225,7 +226,9 @@ const CometChatAIAssistantChatHistory: React.FC<CometChatAIAssistantChatHistoryP
|
|
|
225
226
|
const getMessageText = useCallback((message: CometChat.BaseMessage): string => {
|
|
226
227
|
try {
|
|
227
228
|
if (message instanceof CometChat.TextMessage) {
|
|
228
|
-
|
|
229
|
+
// Plain text only in the history list — strip rich-text markup (e.g. <u>…</u>,
|
|
230
|
+
// **bold**) so titles read cleanly instead of showing raw tags/markers.
|
|
231
|
+
return stripRichText(message.getText());
|
|
229
232
|
} else if (message instanceof CometChat.MediaMessage) {
|
|
230
233
|
return `${message.getType()} message`;
|
|
231
234
|
} else if (message instanceof CometChat.CustomMessage) {
|
|
@@ -233,9 +236,9 @@ const CometChatAIAssistantChatHistory: React.FC<CometChatAIAssistantChatHistoryP
|
|
|
233
236
|
if (message.getType() === 'assistant' && message.getData()) {
|
|
234
237
|
const data = message.getData();
|
|
235
238
|
if (data.assistantMessageData?.getText) {
|
|
236
|
-
return data.assistantMessageData.getText();
|
|
239
|
+
return stripRichText(data.assistantMessageData.getText());
|
|
237
240
|
} else if (data.text) {
|
|
238
|
-
return data.text;
|
|
241
|
+
return stripRichText(data.text);
|
|
239
242
|
}
|
|
240
243
|
}
|
|
241
244
|
return 'Custom message';
|
|
@@ -708,9 +708,11 @@ export const CometChatMessageList = memo(
|
|
|
708
708
|
.setGUID(group.getGuid());
|
|
709
709
|
}
|
|
710
710
|
|
|
711
|
+
|
|
711
712
|
_defaultRequestBuilder.setTypes(ChatConfigurator.dataSource.getAllMessageTypes());
|
|
712
713
|
_defaultRequestBuilder.setCategories(ChatConfigurator.dataSource.getAllMessageCategories());
|
|
713
714
|
|
|
715
|
+
|
|
714
716
|
//updating users request builder
|
|
715
717
|
let _updatedCustomRequestBuilder = _defaultRequestBuilder;
|
|
716
718
|
if (messageRequestBuilder) {
|
|
@@ -2914,7 +2916,18 @@ export const CometChatMessageList = memo(
|
|
|
2914
2916
|
newMessage(formMessage);
|
|
2915
2917
|
},
|
|
2916
2918
|
onCardMessageReceived: (cardMessage: any) => {
|
|
2917
|
-
|
|
2919
|
+
if (isAgenticUser) {
|
|
2920
|
+
if (
|
|
2921
|
+
cardMessage.getSender?.()?.getRole?.() === "@agentic" ||
|
|
2922
|
+
cardMessage.getCategory?.() === MessageCategoryConstants.agentic ||
|
|
2923
|
+
cardMessage.getCategory?.() ===
|
|
2924
|
+
CometChatUiKitConstants.MessageCategoryConstants.stream
|
|
2925
|
+
) {
|
|
2926
|
+
newMessage(cardMessage);
|
|
2927
|
+
}
|
|
2928
|
+
} else {
|
|
2929
|
+
newMessage(cardMessage);
|
|
2930
|
+
}
|
|
2918
2931
|
},
|
|
2919
2932
|
onSchedulerMessageReceived: (schedulerMessage: any) => {
|
|
2920
2933
|
newMessage(schedulerMessage);
|
|
@@ -3830,6 +3843,9 @@ export const CometChatMessageList = memo(
|
|
|
3830
3843
|
// (from mergeObjects during history fetch dedup) overwrote `category` and `type`
|
|
3831
3844
|
let lookupCategory: string = message.getCategory();
|
|
3832
3845
|
let lookupType: string = message.getType();
|
|
3846
|
+
if (lookupCategory === MessageCategoryConstants.card) {
|
|
3847
|
+
lookupType = MessageTypeConstants.card;
|
|
3848
|
+
}
|
|
3833
3849
|
|
|
3834
3850
|
const hasInteractiveData =
|
|
3835
3851
|
typeof (message as any).getInteractiveData === 'function' &&
|
|
@@ -9,6 +9,12 @@ import { CometChatTheme } from '../../theme/type';
|
|
|
9
9
|
import { CometChatMessageTemplate } from '../../shared/modals/CometChatMessageTemplate';
|
|
10
10
|
import { getModerationStatus } from '../../shared/utils/MessageUtils';
|
|
11
11
|
|
|
12
|
+
const WINDOW_HEIGHT = Dimensions.get('window').height;
|
|
13
|
+
const SHEET_MAX_HEIGHT_RATIO = 0.52;
|
|
14
|
+
// Quick reactions row height (~56) + sheet paddingTop (25) + safety margin
|
|
15
|
+
const RESERVED_HEIGHT = 100;
|
|
16
|
+
const ACTION_SHEET_MAX_HEIGHT = WINDOW_HEIGHT * SHEET_MAX_HEIGHT_RATIO - RESERVED_HEIGHT;
|
|
17
|
+
|
|
12
18
|
interface MessageOptionsSheetProps {
|
|
13
19
|
bottomSheetRef: React.RefObject<any>;
|
|
14
20
|
isOpen: boolean;
|
|
@@ -122,10 +128,12 @@ export const MessageOptionsSheet: React.FC<MessageOptionsSheetProps> = ({
|
|
|
122
128
|
/>
|
|
123
129
|
)}
|
|
124
130
|
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
<View style={{ maxHeight: ACTION_SHEET_MAX_HEIGHT }}>
|
|
132
|
+
<CometChatActionSheet
|
|
133
|
+
actions={showMessageOptions}
|
|
134
|
+
style={mergedTheme.messageListStyles.messageOptionsStyles}
|
|
135
|
+
/>
|
|
136
|
+
</View>
|
|
129
137
|
</View>
|
|
130
138
|
)}
|
|
131
139
|
</CometChatBottomSheet>
|
|
@@ -1833,6 +1833,14 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
1833
1833
|
return formatted || messageType || 'Message';
|
|
1834
1834
|
}
|
|
1835
1835
|
|
|
1836
|
+
// For developer card messages, show the card's text content
|
|
1837
|
+
// (detected by category — the card `type` is arbitrary).
|
|
1838
|
+
if (message.getCategory() === MessageCategoryConstants.card) {
|
|
1839
|
+
const cardText =
|
|
1840
|
+
(typeof (message as any).getText === 'function' && (message as any).getText()) || '';
|
|
1841
|
+
return cardText || t('CARD_MESSAGE') || 'Card Message';
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1836
1844
|
// For custom messages, try to localize the type
|
|
1837
1845
|
const customTypeKey = `CUSTOM_MESSAGE_${messageType.toUpperCase()}`;
|
|
1838
1846
|
const localizedType = t(customTypeKey);
|
|
@@ -2105,6 +2113,14 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
2105
2113
|
return formatted || msgType || 'Message';
|
|
2106
2114
|
}
|
|
2107
2115
|
|
|
2116
|
+
// For developer card messages, show the card's text content
|
|
2117
|
+
// (detected by category — the card `type` is arbitrary).
|
|
2118
|
+
if (message.getCategory() === MessageCategoryConstants.card) {
|
|
2119
|
+
const cardText =
|
|
2120
|
+
(typeof (message as any).getText === 'function' && (message as any).getText()) || '';
|
|
2121
|
+
return cardText || t('CARD_MESSAGE') || 'Card Message';
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2108
2124
|
// For custom messages, try to localize the type
|
|
2109
2125
|
const customTypeKey = `CUSTOM_MESSAGE_${msgType.toUpperCase()}`;
|
|
2110
2126
|
const localizedType = t(customTypeKey);
|
|
@@ -76,6 +76,64 @@ export class CometChatUIKit {
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* File-based init for AI agent skills.
|
|
81
|
+
* Calls CometChat.initFromSettings(settings) which writes
|
|
82
|
+
* integrationSource = "ai-agent" to persistent storage.
|
|
83
|
+
*/
|
|
84
|
+
static initFromSettings(settings: CometChat.CometChatSettings) {
|
|
85
|
+
// Extract authKey from credentials (UIKit uses this for login — SDK ignores it)
|
|
86
|
+
const authKey = settings.credentials?.authKey;
|
|
87
|
+
|
|
88
|
+
// Extract UIKit-specific settings
|
|
89
|
+
const subscribePresence =
|
|
90
|
+
(settings.uiKit as { subscribePresenceForAllUsers?: boolean })
|
|
91
|
+
?.subscribePresenceForAllUsers ?? true;
|
|
92
|
+
|
|
93
|
+
// Store internally so login/createUser/updateUser keep working
|
|
94
|
+
CometChatUIKit.uiKitSettings = {
|
|
95
|
+
appId: settings.appId,
|
|
96
|
+
region: settings.region,
|
|
97
|
+
authKey,
|
|
98
|
+
subscriptionType: subscribePresence
|
|
99
|
+
? CometChat.AppSettings.SUBSCRIPTION_TYPE_ALL_USERS as UIKitSettings["subscriptionType"]
|
|
100
|
+
: undefined,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
CometChatUIKit.attachListener();
|
|
104
|
+
|
|
105
|
+
// CRITICAL: Call initFromSettings — NOT init(). Only initFromSettings writes "ai-agent".
|
|
106
|
+
return CometChat.initFromSettings(settings).then(
|
|
107
|
+
async () => {
|
|
108
|
+
CometChat.setSource("uikit-v5", Platform.OS, "react-native");
|
|
109
|
+
ListenerInitializer.attachListeners();
|
|
110
|
+
await CometChat.getLoggedinUser()
|
|
111
|
+
.then((user: any) => {
|
|
112
|
+
CometChatUIKit.setLoggedInUser(user);
|
|
113
|
+
if (user) {
|
|
114
|
+
this.enableExtensions();
|
|
115
|
+
}
|
|
116
|
+
CometChat.getConversationUpdateSettings().then(
|
|
117
|
+
(conversationUpdateSettings: CometChat.ConversationUpdateSettings) => {
|
|
118
|
+
CometChatUIKit.setConversationUpdateSettings(conversationUpdateSettings);
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
permissionUtil.init().then((res) => {
|
|
122
|
+
if (res !== true) {
|
|
123
|
+
console.warn("[IOS] Permission initialization failed.");
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
})
|
|
127
|
+
.catch((error: any) => {
|
|
128
|
+
// CometChatUIKit.setLoggedInUser(null);
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
(error: any) => {
|
|
132
|
+
// console.log("Initialization failed with error:", error);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
79
137
|
static defaultExtensions: ExtensionsDataSource[] = [
|
|
80
138
|
new StickersExtension(),
|
|
81
139
|
new CollaborativeWhiteboardExtension(),
|
|
@@ -159,6 +159,7 @@ export const MessageCategoryConstants = {
|
|
|
159
159
|
call: CometChat.CATEGORY_CALL,
|
|
160
160
|
interactive: CometChat.CATEGORY_INTERACTIVE,
|
|
161
161
|
agentic: CometChat.CATEGORY_AGENTIC,
|
|
162
|
+
card: CometChat.CATEGORY_CARD,
|
|
162
163
|
stream: "stream_message",
|
|
163
164
|
};
|
|
164
165
|
|
|
@@ -207,7 +208,10 @@ export const streamMessageTypes = {
|
|
|
207
208
|
tool_call_start: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_STARTED,
|
|
208
209
|
tool_call_end: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_ENDED,
|
|
209
210
|
tool_call_args: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_ARGUMENT,
|
|
210
|
-
tool_call_result: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_RESULT
|
|
211
|
+
tool_call_result: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_RESULT,
|
|
212
|
+
card_start: CometChat.AI_ASSISTANT_EVENTS.CARD_START,
|
|
213
|
+
card: CometChat.AI_ASSISTANT_EVENTS.CARD,
|
|
214
|
+
card_end: CometChat.AI_ASSISTANT_EVENTS.CARD_END,
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
export const ReceiverTypeConstants = {
|
|
@@ -400,6 +400,11 @@ export class CometChatUIEventHandler {
|
|
|
400
400
|
param as { id: string; data: Array<SuggestionItem> }
|
|
401
401
|
);
|
|
402
402
|
break;
|
|
403
|
+
case listener._eventListener?.ccCardActionClicked?.name:
|
|
404
|
+
listener._eventListener?.ccCardActionClicked?.(
|
|
405
|
+
param as { message: any; action: any }
|
|
406
|
+
);
|
|
407
|
+
break;
|
|
403
408
|
}
|
|
404
409
|
});
|
|
405
410
|
}
|
|
@@ -234,6 +234,7 @@ type UIEvents = {
|
|
|
234
234
|
ccComposeMessage?: (item: any) => void;
|
|
235
235
|
// ccMentionClick?:(item)=>void,
|
|
236
236
|
ccSuggestionData?: (item: { id: string | number; data: Array<SuggestionItem> }) => void;
|
|
237
|
+
ccCardActionClicked?: (item: { message: any; action: any }) => void;
|
|
237
238
|
};
|
|
238
239
|
export class UIEventListener {
|
|
239
240
|
showPanel?: (item: any) => void;
|
|
@@ -243,6 +244,7 @@ export class UIEventListener {
|
|
|
243
244
|
ccComposeMessage?: (item: any) => void;
|
|
244
245
|
// ccMentionClick?:(item)=>void;
|
|
245
246
|
ccSuggestionData?: (item: { id: string | number; data: Array<SuggestionItem> }) => void;
|
|
247
|
+
ccCardActionClicked?: (item: { message: any; action: any }) => void;
|
|
246
248
|
constructor({
|
|
247
249
|
showPanel,
|
|
248
250
|
hidePanel,
|
|
@@ -251,6 +253,7 @@ export class UIEventListener {
|
|
|
251
253
|
ccComposeMessage,
|
|
252
254
|
// ccMentionClick,
|
|
253
255
|
ccSuggestionData,
|
|
256
|
+
ccCardActionClicked,
|
|
254
257
|
}: UIEvents) {
|
|
255
258
|
if (!isFalsy(hidePanel)) this.hidePanel = hidePanel;
|
|
256
259
|
if (!isFalsy(showPanel)) this.showPanel = showPanel;
|
|
@@ -259,6 +262,7 @@ export class UIEventListener {
|
|
|
259
262
|
if (!isFalsy(ccComposeMessage)) this.ccComposeMessage = ccComposeMessage;
|
|
260
263
|
// if (!isFalsy(ccMentionClick)) this.ccMentionClick = ccMentionClick;
|
|
261
264
|
if (!isFalsy(ccSuggestionData)) this.ccSuggestionData = ccSuggestionData;
|
|
265
|
+
if (!isFalsy(ccCardActionClicked)) this.ccCardActionClicked = ccCardActionClicked;
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
268
|
export class GroupUIEventListener {
|
|
@@ -97,6 +97,9 @@ export class ListenerInitializer {
|
|
|
97
97
|
},
|
|
98
98
|
onMessagesReadByAll: (messageReceipt: CometChat.MessageReceipt) => {
|
|
99
99
|
CometChatUIEventHandler.emitMessageEvent(MessageEvents.onMessagesReadByAll, messageReceipt);
|
|
100
|
+
},
|
|
101
|
+
onCardMessageReceived: (cardMessage: any) => {
|
|
102
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.onCardMessageReceived, cardMessage);
|
|
100
103
|
}
|
|
101
104
|
});
|
|
102
105
|
}
|
|
@@ -192,6 +192,16 @@ export interface DataSource {
|
|
|
192
192
|
theme: CometChatTheme,
|
|
193
193
|
additionalParams?: AdditionalParams
|
|
194
194
|
): CometChatMessageTemplate;
|
|
195
|
+
getCardBubbleTemplate(
|
|
196
|
+
theme: CometChatTheme,
|
|
197
|
+
additionalParams?: AdditionalParams
|
|
198
|
+
): CometChatMessageTemplate;
|
|
199
|
+
getCardBubbleContentView(
|
|
200
|
+
message: CometChat.BaseMessage,
|
|
201
|
+
alignment: MessageBubbleAlignmentType,
|
|
202
|
+
theme: CometChatTheme,
|
|
203
|
+
additionalParams?: AdditionalParams
|
|
204
|
+
): JSX.Element;
|
|
195
205
|
|
|
196
206
|
//attachment options
|
|
197
207
|
// getAttachmentOptions(theme: CometChatTheme, conversation: CometChat.User | CometChat.Group): Array<CometChatMessageComposerAction>
|
|
@@ -225,6 +225,19 @@ export class DataSourceDecorator implements DataSource {
|
|
|
225
225
|
return this.dataSource.getCardMessageTemplate(theme, additionalParams);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
getCardBubbleTemplate(theme: CometChatTheme, additionalParams?: AdditionalParams): CometChatMessageTemplate {
|
|
229
|
+
return this.dataSource.getCardBubbleTemplate(theme, additionalParams);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
getCardBubbleContentView(
|
|
233
|
+
message: CometChat.BaseMessage,
|
|
234
|
+
alignment: MessageBubbleAlignmentType,
|
|
235
|
+
theme: CometChatTheme,
|
|
236
|
+
additionalParams?: AdditionalParams
|
|
237
|
+
): JSX.Element {
|
|
238
|
+
return this.dataSource.getCardBubbleContentView(message, alignment, theme, additionalParams);
|
|
239
|
+
}
|
|
240
|
+
|
|
228
241
|
getAudioMessageTemplate(theme: CometChatTheme, additionalParams?: AdditionalParams): CometChatMessageTemplate {
|
|
229
242
|
return this.dataSource.getAudioMessageTemplate(theme, additionalParams);
|
|
230
243
|
}
|
|
@@ -38,6 +38,7 @@ import { CometChatTextBubble } from "../views/CometChatTextBubble";
|
|
|
38
38
|
import { CometChatVideoBubble } from "../views/CometChatVideoBubble";
|
|
39
39
|
import CometChatAIAssistantMessageBubble from '../views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble';
|
|
40
40
|
import CometChatStreamMessageBubble from '../views/CometChatStreamMessageBubble/CometChatStreamMessageBubble';
|
|
41
|
+
import { CometChatCardBubble } from "../views/CometChatCardBubble";
|
|
41
42
|
import { ChatConfigurator } from "./ChatConfigurator";
|
|
42
43
|
import { DataSource } from "./DataSource";
|
|
43
44
|
import { CommonUtils } from "../utils/CommonUtils";
|
|
@@ -1733,6 +1734,53 @@ export class MessageDataSource implements DataSource {
|
|
|
1733
1734
|
});
|
|
1734
1735
|
}
|
|
1735
1736
|
|
|
1737
|
+
// --- Developer card (category: "card") ----------------------------------
|
|
1738
|
+
getCardBubbleContentView(
|
|
1739
|
+
message: CometChat.BaseMessage,
|
|
1740
|
+
alignment: MessageBubbleAlignmentType,
|
|
1741
|
+
theme: CometChatTheme,
|
|
1742
|
+
additionalParams?: AdditionalParams
|
|
1743
|
+
): JSX.Element {
|
|
1744
|
+
return <CometChatCardBubble message={message} theme={theme} />;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
getCardBubbleTemplate(
|
|
1748
|
+
theme: CometChatTheme,
|
|
1749
|
+
additionalParams?: AdditionalParams
|
|
1750
|
+
): CometChatMessageTemplate {
|
|
1751
|
+
return new CometChatMessageTemplate({
|
|
1752
|
+
// Sentinel type; developer card `type` is arbitrary and resolved on category alone.
|
|
1753
|
+
type: MessageTypeConstants.card,
|
|
1754
|
+
category: MessageCategoryConstants.card,
|
|
1755
|
+
ContentView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
1756
|
+
if (isDeletedMessage(message)) {
|
|
1757
|
+
return ChatConfigurator.dataSource.getDeleteMessageBubble(message, theme);
|
|
1758
|
+
}
|
|
1759
|
+
return ChatConfigurator.dataSource.getCardBubbleContentView(
|
|
1760
|
+
message,
|
|
1761
|
+
alignment,
|
|
1762
|
+
theme,
|
|
1763
|
+
additionalParams
|
|
1764
|
+
);
|
|
1765
|
+
},
|
|
1766
|
+
// Same option set as the text bubble, minus edit and copy.
|
|
1767
|
+
options: (loggedInuser, message, theme, group) =>
|
|
1768
|
+
ChatConfigurator.dataSource
|
|
1769
|
+
.getTextMessageOptions(loggedInuser, message, theme, group, additionalParams)
|
|
1770
|
+
.filter(
|
|
1771
|
+
(o: CometChatMessageOption) =>
|
|
1772
|
+
o.id !== MessageOptionConstants.editMessage &&
|
|
1773
|
+
o.id !== MessageOptionConstants.copyMessage
|
|
1774
|
+
),
|
|
1775
|
+
ReplyView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
1776
|
+
return ChatConfigurator.dataSource.getReplyView?.(message, theme, additionalParams) || null;
|
|
1777
|
+
},
|
|
1778
|
+
BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
|
|
1779
|
+
return ChatConfigurator.dataSource.getBottomView(message, alignment);
|
|
1780
|
+
},
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1736
1784
|
getAllMessageTemplates(
|
|
1737
1785
|
theme: CometChatTheme,
|
|
1738
1786
|
additionalParams?: AdditionalParams
|
|
@@ -1748,6 +1796,7 @@ export class MessageDataSource implements DataSource {
|
|
|
1748
1796
|
ChatConfigurator.dataSource.getFormMessageTemplate(theme, additionalParams),
|
|
1749
1797
|
ChatConfigurator.dataSource.getSchedulerMessageTemplate(theme, additionalParams),
|
|
1750
1798
|
ChatConfigurator.dataSource.getCardMessageTemplate(theme, additionalParams),
|
|
1799
|
+
ChatConfigurator.dataSource.getCardBubbleTemplate(theme, additionalParams),
|
|
1751
1800
|
ChatConfigurator.dataSource.getAgentAssistantMessageTemplate(theme, additionalParams),
|
|
1752
1801
|
];
|
|
1753
1802
|
}
|
|
@@ -1764,6 +1813,11 @@ export class MessageDataSource implements DataSource {
|
|
|
1764
1813
|
//in case of call message return undefined
|
|
1765
1814
|
if (MessageCategory == MessageCategoryConstants.call) return null;
|
|
1766
1815
|
|
|
1816
|
+
// Developer card: resolve on category alone (developer `type` is arbitrary).
|
|
1817
|
+
if (MessageCategory == MessageCategoryConstants.card) {
|
|
1818
|
+
return ChatConfigurator.dataSource.getCardBubbleTemplate(theme, additionalParams);
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1767
1821
|
switch (messageType) {
|
|
1768
1822
|
case MessageTypeConstants.text:
|
|
1769
1823
|
template = ChatConfigurator.dataSource.getTextMessageTemplate(theme, additionalParams);
|
|
@@ -1819,7 +1873,8 @@ export class MessageDataSource implements DataSource {
|
|
|
1819
1873
|
MessageCategoryConstants.message,
|
|
1820
1874
|
MessageCategoryConstants.action,
|
|
1821
1875
|
MessageCategoryConstants.interactive,
|
|
1822
|
-
MessageCategoryConstants.agentic
|
|
1876
|
+
MessageCategoryConstants.agentic,
|
|
1877
|
+
MessageCategoryConstants.card
|
|
1823
1878
|
];
|
|
1824
1879
|
}
|
|
1825
1880
|
getAuxiliaryOptions(
|