@cometchat/chat-uikit-react-native 5.1.1 → 5.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.
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.d.ts +40 -0
- package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.js +467 -0
- package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.js.map +1 -0
- package/lib/CometChatAIAssistantChatHistory/Skeleton.d.ts +24 -0
- package/lib/CometChatAIAssistantChatHistory/Skeleton.js +130 -0
- package/lib/CometChatAIAssistantChatHistory/Skeleton.js.map +1 -0
- package/lib/CometChatAIAssistantChatHistory/index.d.ts +1 -0
- package/lib/CometChatAIAssistantChatHistory/index.js +2 -0
- package/lib/CometChatAIAssistantChatHistory/index.js.map +1 -0
- package/lib/CometChatAIAssistantChatHistory/style.d.ts +30 -0
- package/lib/CometChatAIAssistantChatHistory/style.js +122 -0
- package/lib/CometChatAIAssistantChatHistory/style.js.map +1 -0
- package/lib/CometChatConversations/CometChatConversations.js +26 -5
- package/lib/CometChatConversations/CometChatConversations.js.map +1 -1
- package/lib/CometChatMessageComposer/CometChatMessageComposer.d.ts +7 -0
- package/lib/CometChatMessageComposer/CometChatMessageComposer.js +101 -13
- package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
- package/lib/CometChatMessageHeader/CometChatMessageHeader.d.ts +16 -0
- package/lib/CometChatMessageHeader/CometChatMessageHeader.js +63 -13
- package/lib/CometChatMessageHeader/CometChatMessageHeader.js.map +1 -1
- package/lib/CometChatMessageList/CometChatMessageList.d.ts +33 -0
- package/lib/CometChatMessageList/CometChatMessageList.js +535 -76
- package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
- package/lib/CometChatMessageList/style.js +74 -2
- package/lib/CometChatMessageList/style.js.map +1 -1
- package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js +6 -12
- package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js.map +1 -1
- package/lib/calls/CometChatOutgoingCall/CometChatOutgoingCall.js +4 -3
- package/lib/calls/CometChatOutgoingCall/CometChatOutgoingCall.js.map +1 -1
- package/lib/extensions/Polls/Polls.js +38 -17
- package/lib/extensions/Polls/Polls.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +6 -2
- package/lib/index.js.map +1 -1
- package/lib/shared/constants/UIKitConstants.d.ts +16 -0
- package/lib/shared/constants/UIKitConstants.js +16 -0
- package/lib/shared/constants/UIKitConstants.js.map +1 -1
- package/lib/shared/events/CometChatMessageEvents/index.d.ts +3 -0
- package/lib/shared/events/CometChatMessageEvents/index.js +3 -0
- package/lib/shared/events/CometChatMessageEvents/index.js.map +1 -1
- package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js +3 -0
- package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js.map +1 -1
- package/lib/shared/events/CometChatUIEventHandler/Listener.d.ts +3 -1
- package/lib/shared/events/CometChatUIEventHandler/Listener.js +4 -1
- package/lib/shared/events/CometChatUIEventHandler/Listener.js.map +1 -1
- package/lib/shared/events/ListenerInitializer.d.ts +3 -1
- package/lib/shared/events/ListenerInitializer.js +5 -1
- package/lib/shared/events/ListenerInitializer.js.map +1 -1
- package/lib/shared/events/messages.d.ts +2 -1
- package/lib/shared/events/messages.js +1 -0
- package/lib/shared/events/messages.js.map +1 -1
- package/lib/shared/framework/DataSource.d.ts +3 -1
- package/lib/shared/framework/DataSourceDecorator.d.ts +3 -1
- package/lib/shared/framework/DataSourceDecorator.js +8 -2
- package/lib/shared/framework/DataSourceDecorator.js.map +1 -1
- package/lib/shared/framework/MessageDataSource.d.ts +6 -0
- package/lib/shared/framework/MessageDataSource.js +64 -1
- package/lib/shared/framework/MessageDataSource.js.map +1 -1
- package/lib/shared/icons/components/ai-chat-history.d.ts +8 -0
- package/lib/shared/icons/components/ai-chat-history.js +9 -0
- package/lib/shared/icons/components/ai-chat-history.js.map +1 -0
- package/lib/shared/icons/components/ai-copy-option.d.ts +8 -0
- package/lib/shared/icons/components/ai-copy-option.js +9 -0
- package/lib/shared/icons/components/ai-copy-option.js.map +1 -0
- package/lib/shared/icons/components/ai-new-chat.d.ts +8 -0
- package/lib/shared/icons/components/ai-new-chat.js +9 -0
- package/lib/shared/icons/components/ai-new-chat.js.map +1 -0
- package/lib/shared/icons/components/ai-send-button.d.ts +8 -0
- package/lib/shared/icons/components/ai-send-button.js +9 -0
- package/lib/shared/icons/components/ai-send-button.js.map +1 -0
- package/lib/shared/icons/components/right-arrow.d.ts +3 -0
- package/lib/shared/icons/components/right-arrow.js +6 -0
- package/lib/shared/icons/components/right-arrow.js.map +1 -0
- package/lib/shared/icons/components/stop-fill.js +8 -7
- package/lib/shared/icons/components/stop-fill.js.map +1 -1
- package/lib/shared/icons/icon-mapping.d.ts +11 -0
- package/lib/shared/icons/icon-mapping.js +11 -0
- package/lib/shared/icons/icon-mapping.js.map +1 -1
- package/lib/shared/modals/CometChatAIAssistantTools.d.ts +47 -0
- package/lib/shared/modals/CometChatAIAssistantTools.js +44 -0
- package/lib/shared/modals/CometChatAIAssistantTools.js.map +1 -0
- package/lib/shared/modals/StreamMessage.d.ts +4 -0
- package/lib/shared/modals/StreamMessage.js +11 -0
- package/lib/shared/modals/StreamMessage.js.map +1 -0
- package/lib/shared/modals/index.d.ts +3 -1
- package/lib/shared/modals/index.js +3 -1
- package/lib/shared/modals/index.js.map +1 -1
- package/lib/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.d.ts +126 -0
- package/lib/shared/resources/CometChatLocalizeNew/resources/de/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/en/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/es/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/it/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +7 -1
- package/lib/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +7 -1
- package/lib/shared/services/stream-message.service.d.ts +84 -0
- package/lib/shared/services/stream-message.service.js +406 -0
- package/lib/shared/services/stream-message.service.js.map +1 -0
- package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.d.ts +9 -0
- package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.js +248 -0
- package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.js.map +1 -0
- package/lib/shared/views/CometChatAIAssistantMessageBubble/index.d.ts +3 -0
- package/lib/shared/views/CometChatAIAssistantMessageBubble/index.js +4 -0
- package/lib/shared/views/CometChatAIAssistantMessageBubble/index.js.map +1 -0
- package/lib/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.js +5 -2
- package/lib/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.js.map +1 -1
- package/lib/shared/views/CometChatImageBubble/CometChatImageLoader.js +1 -1
- package/lib/shared/views/CometChatImageBubble/CometChatImageLoader.js.map +1 -1
- package/lib/shared/views/CometChatImageViewerModal/ImageViewerModal.js +52 -32
- package/lib/shared/views/CometChatImageViewerModal/ImageViewerModal.js.map +1 -1
- package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.d.ts +10 -0
- package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.js +54 -0
- package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.js.map +1 -0
- package/lib/shared/views/CometChatSendButtonView/index.d.ts +1 -0
- package/lib/shared/views/CometChatSendButtonView/index.js +2 -0
- package/lib/shared/views/CometChatSendButtonView/index.js.map +1 -0
- package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.d.ts +8 -0
- package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.js +436 -0
- package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.js.map +1 -0
- package/lib/shared/views/CometChatStreamMessageBubble/index.d.ts +3 -0
- package/lib/shared/views/CometChatStreamMessageBubble/index.js +3 -0
- package/lib/shared/views/CometChatStreamMessageBubble/index.js.map +1 -0
- package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.d.ts +14 -6
- package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.js +82 -57
- package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.js.map +1 -1
- package/lib/theme/context.d.ts +96 -15
- package/lib/theme/type.d.ts +14 -1
- package/package.json +6 -3
- package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +627 -0
- package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +228 -0
- package/src/CometChatAIAssistantChatHistory/index.ts +2 -0
- package/src/CometChatAIAssistantChatHistory/style.ts +160 -0
- package/src/CometChatConversations/CometChatConversations.tsx +36 -10
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +137 -19
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +106 -18
- package/src/CometChatMessageList/CometChatMessageList.tsx +721 -116
- package/src/CometChatMessageList/style.ts +74 -2
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +13 -29
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +8 -5
- package/src/extensions/Polls/Polls.tsx +50 -22
- package/src/index.ts +31 -1
- package/src/shared/constants/UIKitConstants.ts +17 -0
- package/src/shared/events/CometChatMessageEvents/index.ts +3 -1
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +3 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
- package/src/shared/events/ListenerInitializer.ts +6 -1
- package/src/shared/events/messages.ts +1 -0
- package/src/shared/framework/DataSource.ts +4 -2
- package/src/shared/framework/DataSourceDecorator.tsx +10 -2
- package/src/shared/framework/MessageDataSource.tsx +75 -2
- package/src/shared/icons/Icon.tsx +1 -1
- package/src/shared/icons/components/ai-chat-history.tsx +21 -0
- package/src/shared/icons/components/ai-copy-option.tsx +21 -0
- package/src/shared/icons/components/ai-new-chat.tsx +21 -0
- package/src/shared/icons/components/ai-send-button.tsx +24 -0
- package/src/shared/icons/components/right-arrow.tsx +13 -0
- package/src/shared/icons/components/stop-fill.tsx +14 -12
- package/src/shared/icons/icon-mapping.tsx +14 -0
- package/src/shared/modals/CometChatAIAssistantTools.ts +65 -0
- package/src/shared/modals/StreamMessage.ts +12 -0
- package/src/shared/modals/index.ts +5 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +7 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +7 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +7 -1
- package/src/shared/services/stream-message.service.ts +470 -0
- package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +262 -0
- package/src/shared/views/CometChatAIAssistantMessageBubble/index.ts +4 -0
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -1
- package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +1 -0
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +57 -45
- package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +86 -0
- package/src/shared/views/CometChatSendButtonView/index.ts +1 -0
- package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +493 -0
- package/src/shared/views/CometChatStreamMessageBubble/index.ts +9 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +121 -74
- package/src/theme/type.ts +14 -1
- package/lib/shared/resources/CometChatLocalize/CometChatLocalize.d.ts +0 -79
- package/lib/shared/resources/CometChatLocalize/CometChatLocalize.js +0 -152
- package/lib/shared/resources/CometChatLocalize/CometChatLocalize.js.map +0 -1
- package/lib/shared/resources/CometChatLocalize/index.d.ts +0 -2
- package/lib/shared/resources/CometChatLocalize/index.js +0 -3
- package/lib/shared/resources/CometChatLocalize/index.js.map +0 -1
- package/lib/shared/resources/CometChatLocalize/resources/ar/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/de/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/en/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/es/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/fr/translation.json +0 -446
- package/lib/shared/resources/CometChatLocalize/resources/hi/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/hu/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/lt/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/ms/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/pt/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/ru/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/sv/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/zh/translation.json +0 -447
- package/lib/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +0 -446
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.d.ts +0 -29
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +0 -29
- package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js.map +0 -1
|
@@ -93,7 +93,7 @@ export const getMessageListStylesLight = (
|
|
|
93
93
|
): CometChatTheme["messageListStyles"] => {
|
|
94
94
|
return {
|
|
95
95
|
containerStyle: {
|
|
96
|
-
backgroundColor: color.
|
|
96
|
+
backgroundColor: color.background3,
|
|
97
97
|
flex: 1,
|
|
98
98
|
},
|
|
99
99
|
scrollToBottomButtonStyle: {
|
|
@@ -269,6 +269,42 @@ export const getMessageListStylesLight = (
|
|
|
269
269
|
paddingRight: spacing.padding.p1,
|
|
270
270
|
},
|
|
271
271
|
},
|
|
272
|
+
assistantBubbleStyles: {
|
|
273
|
+
containerStyle: {
|
|
274
|
+
backgroundColor: "transparent",
|
|
275
|
+
borderRadius: spacing.radius.r3,
|
|
276
|
+
minWidth: 90,
|
|
277
|
+
alignSelf: "flex-start",
|
|
278
|
+
marginTop: -16,
|
|
279
|
+
},
|
|
280
|
+
textStyle: {
|
|
281
|
+
fontFamily: typography.fontFamily,
|
|
282
|
+
color: color.receiveBubbleText,
|
|
283
|
+
...typography.body.regular,
|
|
284
|
+
},
|
|
285
|
+
placeholderTextStyle: {
|
|
286
|
+
fontFamily: typography.fontFamily,
|
|
287
|
+
color: color.receiveBubbleText,
|
|
288
|
+
...typography.body.regular,
|
|
289
|
+
opacity: 0.6,
|
|
290
|
+
},
|
|
291
|
+
copyButtonStyle: {
|
|
292
|
+
backgroundColor: color.primary,
|
|
293
|
+
padding: spacing.padding.p1,
|
|
294
|
+
borderRadius: spacing.radius.r1,
|
|
295
|
+
},
|
|
296
|
+
errorContainerStyle: {
|
|
297
|
+
backgroundColor: color.error,
|
|
298
|
+
padding: spacing.padding.p2,
|
|
299
|
+
borderRadius: spacing.radius.r2,
|
|
300
|
+
marginTop: spacing.margin.m1,
|
|
301
|
+
},
|
|
302
|
+
errorTextStyle: {
|
|
303
|
+
color: color.background1,
|
|
304
|
+
fontFamily: typography.fontFamily,
|
|
305
|
+
...typography.caption1.regular,
|
|
306
|
+
},
|
|
307
|
+
},
|
|
272
308
|
audioBubbleStyles: getAudioBubbleStyleLight(color, spacing, typography)
|
|
273
309
|
.incomingAudioBubbleStyle,
|
|
274
310
|
fileBubbleStyles: getFileBubbleStyleLight(color, spacing, typography).incomingFileBubbleStyle,
|
|
@@ -537,7 +573,7 @@ export const getMessageListStylesDark = (
|
|
|
537
573
|
): CometChatTheme["messageListStyles"] => {
|
|
538
574
|
return {
|
|
539
575
|
containerStyle: {
|
|
540
|
-
backgroundColor: color.
|
|
576
|
+
backgroundColor: color.background3,
|
|
541
577
|
flex: 1,
|
|
542
578
|
},
|
|
543
579
|
scrollToBottomButtonStyle: {
|
|
@@ -715,6 +751,42 @@ export const getMessageListStylesDark = (
|
|
|
715
751
|
paddingRight: spacing.padding.p1,
|
|
716
752
|
},
|
|
717
753
|
},
|
|
754
|
+
assistantBubbleStyles: {
|
|
755
|
+
containerStyle: {
|
|
756
|
+
backgroundColor: "transparent",
|
|
757
|
+
borderRadius: spacing.radius.r3,
|
|
758
|
+
minWidth: 90,
|
|
759
|
+
alignSelf: "flex-start",
|
|
760
|
+
marginTop: -14,
|
|
761
|
+
},
|
|
762
|
+
textStyle: {
|
|
763
|
+
fontFamily: typography.fontFamily,
|
|
764
|
+
color: color.receiveBubbleText,
|
|
765
|
+
...typography.body.regular,
|
|
766
|
+
},
|
|
767
|
+
placeholderTextStyle: {
|
|
768
|
+
fontFamily: typography.fontFamily,
|
|
769
|
+
color: color.receiveBubbleText,
|
|
770
|
+
...typography.body.regular,
|
|
771
|
+
opacity: 0.6,
|
|
772
|
+
},
|
|
773
|
+
copyButtonStyle: {
|
|
774
|
+
backgroundColor: color.primary,
|
|
775
|
+
padding: spacing.padding.p1,
|
|
776
|
+
borderRadius: spacing.radius.r1,
|
|
777
|
+
},
|
|
778
|
+
errorContainerStyle: {
|
|
779
|
+
backgroundColor: color.error,
|
|
780
|
+
padding: spacing.padding.p2,
|
|
781
|
+
borderRadius: spacing.radius.r2,
|
|
782
|
+
marginTop: spacing.margin.m1,
|
|
783
|
+
},
|
|
784
|
+
errorTextStyle: {
|
|
785
|
+
color: color.background1,
|
|
786
|
+
fontFamily: typography.fontFamily,
|
|
787
|
+
...typography.caption1.regular,
|
|
788
|
+
},
|
|
789
|
+
},
|
|
718
790
|
audioBubbleStyles: getAudioBubbleStyleDark(color, spacing, typography)
|
|
719
791
|
.incomingAudioBubbleStyle,
|
|
720
792
|
fileBubbleStyles: getFileBubbleStyleDark(color, spacing, typography).incomingFileBubbleStyle,
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
Text,
|
|
5
|
-
TouchableOpacity,
|
|
6
|
-
View,
|
|
7
|
-
SafeAreaView,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
} from "react-native";
|
|
3
|
+
import { Text, TouchableOpacity, View, StyleSheet } from "react-native";
|
|
10
4
|
import { CometChatAvatar, CometChatSoundManager } from "../../shared";
|
|
11
5
|
import {
|
|
12
6
|
CallTypeConstants,
|
|
@@ -24,6 +18,7 @@ import { deepMerge } from "../../shared/helper/helperFunctions";
|
|
|
24
18
|
import { DeepPartial } from "../../shared/helper/types";
|
|
25
19
|
import { JSX } from "react";
|
|
26
20
|
import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
|
|
21
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
27
22
|
|
|
28
23
|
const listnerID = "CALL_LISTENER_" + new Date().getTime();
|
|
29
24
|
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
@@ -90,7 +85,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
|
|
|
90
85
|
} = props;
|
|
91
86
|
|
|
92
87
|
const theme = useTheme();
|
|
93
|
-
const {t}= useCometChatTranslation()
|
|
88
|
+
const { t } = useCometChatTranslation();
|
|
94
89
|
const [showCallScreen, setShowCallScreen] = useState(false);
|
|
95
90
|
const acceptedCall = useRef<CometChat.Call>(undefined);
|
|
96
91
|
|
|
@@ -260,12 +255,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
|
|
|
260
255
|
*/
|
|
261
256
|
return (
|
|
262
257
|
<SafeAreaView style={styles.overlay}>
|
|
263
|
-
<View
|
|
264
|
-
style={[
|
|
265
|
-
incomingCallStyle.containerStyle,
|
|
266
|
-
{ width: "100%" },
|
|
267
|
-
]}
|
|
268
|
-
>
|
|
258
|
+
<View style={[incomingCallStyle.containerStyle, { width: "100%" }]}>
|
|
269
259
|
{/* Top row: LeadingView, Title/Subtitle, TrailingView */}
|
|
270
260
|
<View style={styles.topRow}>
|
|
271
261
|
{LeadingView && LeadingView(call)}
|
|
@@ -282,7 +272,11 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
|
|
|
282
272
|
SubtitleView(call)
|
|
283
273
|
) : (
|
|
284
274
|
<View style={styles.rowInline}>
|
|
285
|
-
<Icon
|
|
275
|
+
<Icon
|
|
276
|
+
name='call-fill'
|
|
277
|
+
size={16}
|
|
278
|
+
containerStyle={{ marginTop: 4, marginRight: 4 }}
|
|
279
|
+
/>
|
|
286
280
|
<Text style={incomingCallStyle.subtitleTextStyle}>
|
|
287
281
|
{call?.["type"] === CallTypeConstants.audio
|
|
288
282
|
? t("INCOMING_AUDIO_CALL")
|
|
@@ -305,22 +299,12 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
|
|
|
305
299
|
|
|
306
300
|
{/* Buttons row */}
|
|
307
301
|
<View style={[styles.bottomRow, { marginTop: 16 }]}>
|
|
308
|
-
<TouchableOpacity
|
|
309
|
-
|
|
310
|
-
style={incomingCallStyle.declineCallButtonStyle}
|
|
311
|
-
>
|
|
312
|
-
<Text style={incomingCallStyle.declineCallTextStyle}>
|
|
313
|
-
{t("DECLINE")}
|
|
314
|
-
</Text>
|
|
302
|
+
<TouchableOpacity onPress={endCall} style={incomingCallStyle.declineCallButtonStyle}>
|
|
303
|
+
<Text style={incomingCallStyle.declineCallTextStyle}>{t("DECLINE")}</Text>
|
|
315
304
|
</TouchableOpacity>
|
|
316
305
|
|
|
317
|
-
<TouchableOpacity
|
|
318
|
-
|
|
319
|
-
style={incomingCallStyle.acceptCallButtonStyle}
|
|
320
|
-
>
|
|
321
|
-
<Text style={incomingCallStyle.acceptCallTextStyle}>
|
|
322
|
-
{t("ACCEPT")}
|
|
323
|
-
</Text>
|
|
306
|
+
<TouchableOpacity onPress={acceptCall} style={incomingCallStyle.acceptCallButtonStyle}>
|
|
307
|
+
<Text style={incomingCallStyle.acceptCallTextStyle}>{t("ACCEPT")}</Text>
|
|
324
308
|
</TouchableOpacity>
|
|
325
309
|
</View>
|
|
326
310
|
</View>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
2
|
import React, { JSX, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { Modal,
|
|
3
|
+
import { Modal, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import {
|
|
5
5
|
MessageCategoryConstants,
|
|
6
6
|
MessageTypeConstants,
|
|
@@ -17,6 +17,7 @@ import { deepMerge } from "../../shared/helper/helperFunctions";
|
|
|
17
17
|
import { OutgoingCallStyle } from "./styles";
|
|
18
18
|
import { DeepPartial } from "../../shared/helper/types";
|
|
19
19
|
import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
|
|
20
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
20
21
|
|
|
21
22
|
const listenerId = "callListener_" + new Date().getTime();
|
|
22
23
|
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
@@ -113,7 +114,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
|
|
|
113
114
|
const isCallEnded = useRef<null | boolean>(undefined);
|
|
114
115
|
|
|
115
116
|
const theme = useTheme();
|
|
116
|
-
const {t}= useCometChatTranslation()
|
|
117
|
+
const { t } = useCometChatTranslation();
|
|
117
118
|
|
|
118
119
|
// Merge default and custom styles for the outgoing call.
|
|
119
120
|
const outgoingCallStyle = useMemo(() => {
|
|
@@ -154,7 +155,9 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
|
|
|
154
155
|
) {
|
|
155
156
|
ongoingCall.current = call;
|
|
156
157
|
if (call.getType() == MessageTypeConstants.meeting) {
|
|
157
|
-
callSessionId.current = (
|
|
158
|
+
callSessionId.current = (
|
|
159
|
+
(call as CometChat.CustomMessage).getCustomData() as any
|
|
160
|
+
)?.sessionId;
|
|
158
161
|
}
|
|
159
162
|
if (call.getCategory() === MessageCategoryConstants.call) {
|
|
160
163
|
callSessionId.current = call["sessionId"];
|
|
@@ -273,7 +276,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
|
|
|
273
276
|
return (
|
|
274
277
|
<Modal
|
|
275
278
|
transparent
|
|
276
|
-
animationType=
|
|
279
|
+
animationType='fade'
|
|
277
280
|
visible={isModalVisible}
|
|
278
281
|
onRequestClose={handleModalClose}
|
|
279
282
|
>
|
|
@@ -317,7 +320,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
|
|
|
317
320
|
onPress={handleModalClose}
|
|
318
321
|
>
|
|
319
322
|
<Icon
|
|
320
|
-
name=
|
|
323
|
+
name='call-end-fill'
|
|
321
324
|
size={32}
|
|
322
325
|
height={outgoingCallStyle.endCallIconStyle.height}
|
|
323
326
|
width={outgoingCallStyle.endCallIconStyle.width}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
KeyboardAvoidingView,
|
|
8
8
|
NativeModules,
|
|
9
9
|
Platform,
|
|
10
|
-
SafeAreaView,
|
|
11
10
|
Text,
|
|
12
11
|
TextInput,
|
|
13
12
|
TouchableOpacity,
|
|
@@ -19,6 +18,7 @@ import { commonVars } from "../../shared/base/vars";
|
|
|
19
18
|
import { Icon } from "../../shared/icons/Icon";
|
|
20
19
|
import { useTheme } from "../../theme";
|
|
21
20
|
import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
|
|
21
|
+
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
22
22
|
|
|
23
23
|
const { CommonUtil } = NativeModules;
|
|
24
24
|
|
|
@@ -128,11 +128,13 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
128
128
|
const [loader, setLoader] = useState(false);
|
|
129
129
|
const loggedInUser = useRef<CometChat.User | null>(null);
|
|
130
130
|
const theme = useTheme();
|
|
131
|
-
const {t} =useCometChatTranslation()
|
|
131
|
+
const { t } = useCometChatTranslation();
|
|
132
132
|
const answerRefs = useRef<(TextInput | null)[]>([]);
|
|
133
133
|
const [lastRemovedIndex, setLastRemovedIndex] = useState<number | null>(null);
|
|
134
134
|
const [newlyAddedIndex, setNewlyAddedIndex] = useState<number | null>(null);
|
|
135
135
|
const flatListRef = useRef<FlatList>(null);
|
|
136
|
+
const insets = useSafeAreaInsets();
|
|
137
|
+
const LIMIT_ERROR = t("REACHED_MAX_LIMIT");
|
|
136
138
|
|
|
137
139
|
/**
|
|
138
140
|
* Validates the poll question and answer inputs.
|
|
@@ -204,12 +206,9 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
204
206
|
paddingHorizontal: 15,
|
|
205
207
|
}}
|
|
206
208
|
>
|
|
207
|
-
<Icon name=
|
|
209
|
+
<Icon name='info' color={theme.color.error} size={20} />
|
|
208
210
|
<Text
|
|
209
|
-
style={[
|
|
210
|
-
theme.typography.caption1.regular,
|
|
211
|
-
{ color: theme.color.error, marginLeft: 10 },
|
|
212
|
-
]}
|
|
211
|
+
style={[theme.typography.caption1.regular, { color: theme.color.error, marginLeft: 10 }]}
|
|
213
212
|
>
|
|
214
213
|
{error}
|
|
215
214
|
</Text>
|
|
@@ -239,7 +238,7 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
239
238
|
let existingAnswers = [...answers];
|
|
240
239
|
existingAnswers[index] = text;
|
|
241
240
|
setAnswers(existingAnswers);
|
|
242
|
-
if (error) {
|
|
241
|
+
if (error && error !== LIMIT_ERROR) {
|
|
243
242
|
setError("");
|
|
244
243
|
}
|
|
245
244
|
if (index >= 2 && text.trim() === "") {
|
|
@@ -274,7 +273,7 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
274
273
|
setAnswers(existingAnswers);
|
|
275
274
|
setNewlyAddedIndex(existingAnswers.length - 1);
|
|
276
275
|
} else {
|
|
277
|
-
setError(
|
|
276
|
+
setError(LIMIT_ERROR);
|
|
278
277
|
}
|
|
279
278
|
}
|
|
280
279
|
|
|
@@ -325,7 +324,7 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
325
324
|
*/
|
|
326
325
|
function AddAnswer() {
|
|
327
326
|
if (answers.length >= 12) {
|
|
328
|
-
return
|
|
327
|
+
return <View style={{ height: 10 }} />;
|
|
329
328
|
}
|
|
330
329
|
return (
|
|
331
330
|
<TouchableOpacity
|
|
@@ -398,6 +397,20 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
398
397
|
}
|
|
399
398
|
}, [answers.length]);
|
|
400
399
|
|
|
400
|
+
useEffect(() => {
|
|
401
|
+
if (error === LIMIT_ERROR && answers.length < 12) {
|
|
402
|
+
setError("");
|
|
403
|
+
}
|
|
404
|
+
}, [answers, error]);
|
|
405
|
+
|
|
406
|
+
useEffect(() => {
|
|
407
|
+
const isMaxAndAllFilled = answers.length >= 12 && answers.every((a) => a.trim() !== "");
|
|
408
|
+
if (isMaxAndAllFilled) {
|
|
409
|
+
setError(LIMIT_ERROR);
|
|
410
|
+
}
|
|
411
|
+
// do nothing when condition not met — the other effect you already added clears LIMIT_ERROR when answers < 12
|
|
412
|
+
}, [answers]);
|
|
413
|
+
|
|
401
414
|
useEffect(() => {
|
|
402
415
|
let answerslist = new Array(defaultAnswers).fill("");
|
|
403
416
|
setAnswers(answerslist);
|
|
@@ -420,7 +433,10 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
420
433
|
}, []);
|
|
421
434
|
|
|
422
435
|
return (
|
|
423
|
-
<SafeAreaView
|
|
436
|
+
<SafeAreaView
|
|
437
|
+
style={{ flex: 1, backgroundColor: theme.color.background1 }}
|
|
438
|
+
edges={["top", "left", "right"]}
|
|
439
|
+
>
|
|
424
440
|
<KeyboardAvoidingView
|
|
425
441
|
style={{ flex: 1 }}
|
|
426
442
|
enabled={Platform.OS === "ios"}
|
|
@@ -429,12 +445,18 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
429
445
|
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
|
|
430
446
|
<View style={{ flex: 1 }}>
|
|
431
447
|
{/* Header */}
|
|
432
|
-
<View
|
|
448
|
+
<View
|
|
449
|
+
style={{
|
|
450
|
+
flexDirection: "row",
|
|
451
|
+
alignItems: "center",
|
|
452
|
+
paddingTop: Platform.OS === "ios" ? insets.top : 0,
|
|
453
|
+
}}
|
|
454
|
+
>
|
|
433
455
|
<TouchableOpacity
|
|
434
456
|
onPress={onClose}
|
|
435
457
|
style={{ flexDirection: "row", paddingVertical: 20, paddingLeft: 10 }}
|
|
436
458
|
>
|
|
437
|
-
<Icon name=
|
|
459
|
+
<Icon name='arrow-back' />
|
|
438
460
|
</TouchableOpacity>
|
|
439
461
|
<Text
|
|
440
462
|
style={[
|
|
@@ -490,16 +512,17 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
490
512
|
data={answers}
|
|
491
513
|
keyExtractor={(item, index) => index.toString()}
|
|
492
514
|
renderItem={renderAnswerItem}
|
|
493
|
-
|
|
494
|
-
|
|
515
|
+
// render a footer only when needed, avoiding a permanently present wrapper that causes extra space
|
|
516
|
+
ListFooterComponent={() => (
|
|
517
|
+
<View style={{ paddingBottom: answers.length >= 12 ? 10 : 20 }}>
|
|
495
518
|
<AddAnswer />
|
|
496
519
|
</View>
|
|
497
|
-
}
|
|
520
|
+
)}
|
|
498
521
|
removeClippedSubviews={false}
|
|
499
|
-
keyboardShouldPersistTaps=
|
|
500
|
-
keyboardDismissMode=
|
|
522
|
+
keyboardShouldPersistTaps='always'
|
|
523
|
+
keyboardDismissMode='interactive'
|
|
501
524
|
contentContainerStyle={{
|
|
502
|
-
paddingBottom:
|
|
525
|
+
paddingBottom: 20,
|
|
503
526
|
paddingTop: 10,
|
|
504
527
|
paddingHorizontal: 20,
|
|
505
528
|
}}
|
|
@@ -523,15 +546,18 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
523
546
|
backgroundColor: "rgba(0,0,0,0.3)",
|
|
524
547
|
}}
|
|
525
548
|
>
|
|
526
|
-
<ActivityIndicator size=
|
|
549
|
+
<ActivityIndicator size='large' color={theme.color.primary} />
|
|
527
550
|
</View>
|
|
528
551
|
)}
|
|
529
552
|
{/* Fixed Create Button */}
|
|
530
553
|
<View
|
|
531
554
|
style={{
|
|
532
555
|
paddingHorizontal: 20,
|
|
533
|
-
paddingVertical: 10,
|
|
534
556
|
backgroundColor: theme.color.background1,
|
|
557
|
+
paddingBottom: Platform.select({
|
|
558
|
+
ios: Math.max(insets.bottom, 10),
|
|
559
|
+
android: 10,
|
|
560
|
+
}),
|
|
535
561
|
}}
|
|
536
562
|
>
|
|
537
563
|
{error && <ErrorView />}
|
|
@@ -546,7 +572,9 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
546
572
|
marginBottom: Platform.select({ ios: 0, android: 10 }),
|
|
547
573
|
}}
|
|
548
574
|
>
|
|
549
|
-
<Text
|
|
575
|
+
<Text
|
|
576
|
+
style={[theme.typography.button.medium, { color: theme.color.primaryButtonText }]}
|
|
577
|
+
>
|
|
550
578
|
{t("CREATE")}
|
|
551
579
|
</Text>
|
|
552
580
|
</TouchableOpacity>
|
package/src/index.ts
CHANGED
|
@@ -83,6 +83,11 @@ import {
|
|
|
83
83
|
getCurrentLanguage,
|
|
84
84
|
} from "./shared";
|
|
85
85
|
|
|
86
|
+
import { stopStreamingForRunId, startStreamingForRunId, streamingState$, getStreamSpeed, setAIAssistantTools, setQueueCompletionCallback, removeQueueCompletionCallback, IStreamData,QueueCompletionCallback,checkAndTriggerQueueCompletion, getAIAssistantTools, handleWebsocketMessage, messageStream, notifyStreamRenderComplete, onConnected, onConnectionError, onDisconnected, setStreamSpeed, storeAIAssistantMessage, streamConnection$ } from "./shared/services/stream-message.service";
|
|
87
|
+
|
|
88
|
+
import { StreamMessage} from "./shared/modals/StreamMessage";
|
|
89
|
+
import {CometChatAIAssistantTools} from "./shared/modals/CometChatAIAssistantTools";
|
|
90
|
+
|
|
86
91
|
import {
|
|
87
92
|
CometChatUsers,
|
|
88
93
|
CometChatUsersActionsInterface,
|
|
@@ -114,6 +119,8 @@ import {
|
|
|
114
119
|
CometChatMessageComposerInterface,
|
|
115
120
|
} from "./CometChatMessageComposer";
|
|
116
121
|
|
|
122
|
+
import { CometChatAIAssistantChatHistory } from "./CometChatAIAssistantChatHistory";
|
|
123
|
+
|
|
117
124
|
import { CometChatThreadHeader, CometChatThreadHeaderInterface } from "./CometChatThreadHeader";
|
|
118
125
|
|
|
119
126
|
import {
|
|
@@ -196,6 +203,7 @@ export {
|
|
|
196
203
|
CometChatGroups,
|
|
197
204
|
CometChatGroupsEvents,
|
|
198
205
|
CometChatGroupMembers,
|
|
206
|
+
CometChatAIAssistantChatHistory,
|
|
199
207
|
CometChatImageBubble,
|
|
200
208
|
CometChatIncomingCall,
|
|
201
209
|
//
|
|
@@ -252,7 +260,29 @@ export {
|
|
|
252
260
|
messageStatus,
|
|
253
261
|
Icon,
|
|
254
262
|
getCometChatTranslation,
|
|
255
|
-
getCurrentLanguage
|
|
263
|
+
getCurrentLanguage,
|
|
264
|
+
CometChatAIAssistantTools,
|
|
265
|
+
StreamMessage,
|
|
266
|
+
stopStreamingForRunId,
|
|
267
|
+
startStreamingForRunId,
|
|
268
|
+
streamingState$,
|
|
269
|
+
getStreamSpeed,
|
|
270
|
+
setAIAssistantTools,
|
|
271
|
+
setQueueCompletionCallback,
|
|
272
|
+
removeQueueCompletionCallback,
|
|
273
|
+
IStreamData,
|
|
274
|
+
QueueCompletionCallback,
|
|
275
|
+
checkAndTriggerQueueCompletion,
|
|
276
|
+
getAIAssistantTools,
|
|
277
|
+
handleWebsocketMessage,
|
|
278
|
+
messageStream,
|
|
279
|
+
notifyStreamRenderComplete,
|
|
280
|
+
onConnected,
|
|
281
|
+
onConnectionError,
|
|
282
|
+
onDisconnected,
|
|
283
|
+
setStreamSpeed,
|
|
284
|
+
storeAIAssistantMessage,
|
|
285
|
+
streamConnection$
|
|
256
286
|
};
|
|
257
287
|
export { CometChatThemeProvider, useTheme } from "./theme";
|
|
258
288
|
|
|
@@ -157,6 +157,8 @@ export const MessageCategoryConstants = {
|
|
|
157
157
|
action: CometChat.CATEGORY_ACTION,
|
|
158
158
|
call: CometChat.CATEGORY_CALL,
|
|
159
159
|
interactive: CometChat.CATEGORY_INTERACTIVE,
|
|
160
|
+
agentic: CometChat.CATEGORY_AGENTIC,
|
|
161
|
+
stream: "stream_message",
|
|
160
162
|
};
|
|
161
163
|
|
|
162
164
|
export const DefaultActionSheetItems = {
|
|
@@ -190,8 +192,23 @@ export const MessageTypeConstants = {
|
|
|
190
192
|
form: "form",
|
|
191
193
|
card: "card",
|
|
192
194
|
customInteractive: "customInteractive",
|
|
195
|
+
assistant: CometChat.MESSAGE_TYPE.ASSISTANT,
|
|
196
|
+
toolArguments: CometChat.MESSAGE_TYPE.TOOL_ARGUMENTS,
|
|
197
|
+
toolResults: CometChat.MESSAGE_TYPE.TOOL_RESULT,
|
|
193
198
|
};
|
|
194
199
|
|
|
200
|
+
export const streamMessageTypes = {
|
|
201
|
+
run_started: CometChat.AI_ASSISTANT_EVENTS.RUN_STARTED,
|
|
202
|
+
text_message_start: CometChat.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_START,
|
|
203
|
+
text_message_content: CometChat.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_CONTENT,
|
|
204
|
+
text_message_end: CometChat.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_END,
|
|
205
|
+
run_finished: CometChat.AI_ASSISTANT_EVENTS.RUN_FINISHED,
|
|
206
|
+
tool_call_start: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_STARTED,
|
|
207
|
+
tool_call_end: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_ENDED,
|
|
208
|
+
tool_call_args: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_ARGUMENT,
|
|
209
|
+
tool_call_result: CometChat.AI_ASSISTANT_EVENTS.TOOL_CALL_RESULT
|
|
210
|
+
}
|
|
211
|
+
|
|
195
212
|
export const ReceiverTypeConstants = {
|
|
196
213
|
user: CometChat.RECEIVER_TYPE.USER,
|
|
197
214
|
group: CometChat.RECEIVER_TYPE.GROUP,
|
|
@@ -31,7 +31,9 @@ export class CometChatMessageEvents {
|
|
|
31
31
|
static previewMessageForEdit = Symbol("previewMessageForEdit");
|
|
32
32
|
|
|
33
33
|
static onBackButtonClick = Symbol("onBackButtonClick");
|
|
34
|
-
|
|
34
|
+
static onAIAssistantMessageReceived = Symbol("onAIAssistantMessageReceived");
|
|
35
|
+
static onAIToolResultReceived = Symbol("onAIToolResultReceived");
|
|
36
|
+
static onAIToolArgumentsReceived = Symbol("onAIToolArgumentsReceived");
|
|
35
37
|
static _triggers = {};
|
|
36
38
|
|
|
37
39
|
static emit = (...args) => {
|
|
@@ -188,6 +188,9 @@ export class CometChatUIEventHandler {
|
|
|
188
188
|
case listener._eventListener?.onMessagesReadByAll?.name:
|
|
189
189
|
listener._eventListener?.onMessagesReadByAll?.(param);
|
|
190
190
|
break;
|
|
191
|
+
case listener._eventListener?.onAIAssistantMessageReceived?.name:
|
|
192
|
+
listener._eventListener?.onAIAssistantMessageReceived?.(param);
|
|
193
|
+
break;
|
|
191
194
|
}
|
|
192
195
|
});
|
|
193
196
|
}
|
|
@@ -36,6 +36,7 @@ type MessageUIEvents = {
|
|
|
36
36
|
onMessageReactionRemoved?: Function;
|
|
37
37
|
onMessagesDeliveredToAll?: Function;
|
|
38
38
|
onMessagesReadByAll?: Function;
|
|
39
|
+
onAIAssistantMessageReceived?: Function;
|
|
39
40
|
};
|
|
40
41
|
export class MessageUIEventListener {
|
|
41
42
|
ccMessageSent?: Function = undefined;
|
|
@@ -64,6 +65,7 @@ export class MessageUIEventListener {
|
|
|
64
65
|
onMessageReactionRemoved?: Function = undefined;
|
|
65
66
|
onMessagesDeliveredToAll?: Function = undefined;
|
|
66
67
|
onMessagesReadByAll?: Function = undefined;
|
|
68
|
+
onAIAssistantMessageReceived?: Function = undefined;
|
|
67
69
|
constructor({
|
|
68
70
|
ccMessageSent,
|
|
69
71
|
ccMessageEdited,
|
|
@@ -91,6 +93,7 @@ export class MessageUIEventListener {
|
|
|
91
93
|
onMessageReactionRemoved,
|
|
92
94
|
onMessagesDeliveredToAll,
|
|
93
95
|
onMessagesReadByAll,
|
|
96
|
+
onAIAssistantMessageReceived,
|
|
94
97
|
}: MessageUIEvents) {
|
|
95
98
|
if (!isFalsy(ccMessageError)) this.ccMessageError = ccMessageError;
|
|
96
99
|
if (!isFalsy(ccMessageDelivered)) this.ccMessageDelivered = ccMessageDelivered;
|
|
@@ -125,6 +128,7 @@ export class MessageUIEventListener {
|
|
|
125
128
|
if (!isFalsy(onMessagesDeliveredToAll))
|
|
126
129
|
this.onMessagesDeliveredToAll = onMessagesDeliveredToAll;
|
|
127
130
|
if (!isFalsy(onMessagesReadByAll)) this.onMessagesReadByAll = onMessagesReadByAll;
|
|
131
|
+
if (!isFalsy(onAIAssistantMessageReceived)) this.onAIAssistantMessageReceived = onAIAssistantMessageReceived;
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
|
|
@@ -2,11 +2,13 @@ import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
|
2
2
|
import { MessageTypeConstants } from "../constants/UIKitConstants";
|
|
3
3
|
import { CometChatUIEventHandler } from "./CometChatUIEventHandler/CometChatUIEventHandler";
|
|
4
4
|
import { MessageEvents } from "./messages";
|
|
5
|
+
import * as CometChatUIKitConstants from '../constants/UIKitConstants';
|
|
5
6
|
|
|
6
7
|
export class ListenerInitializer {
|
|
7
8
|
private static messageListenerId = `ListenerInitializer_listener`;
|
|
9
|
+
static streamListenerId: string = "agent_" + new Date().getTime();
|
|
8
10
|
|
|
9
|
-
public static attachListeners() {
|
|
11
|
+
public static attachListeners(user?: CometChat.User) {
|
|
10
12
|
CometChat.addMessageListener(this.messageListenerId, this.getMessageListenerObject());
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -83,6 +85,9 @@ export class ListenerInitializer {
|
|
|
83
85
|
onMessageReactionRemoved: (message: CometChat.ReactionEvent) => {
|
|
84
86
|
CometChatUIEventHandler.emitMessageEvent(MessageEvents.onMessageReactionRemoved, message);
|
|
85
87
|
},
|
|
88
|
+
onAIAssistantMessageReceived: (message: CometChat.AIAssistantMessage) => {
|
|
89
|
+
CometChatUIEventHandler.emitMessageEvent(MessageEvents.onAIAssistantMessageReceived, message);
|
|
90
|
+
}
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
93
|
}
|
|
@@ -24,4 +24,5 @@ export enum MessageEvents {
|
|
|
24
24
|
onCustomInteractiveMessageReceived = "onCustomInteractiveMessageReceived",
|
|
25
25
|
onMessageReactionAdded = "onMessageReactionAdded",
|
|
26
26
|
onMessageReactionRemoved = "onMessageReactionRemoved",
|
|
27
|
+
onAIAssistantMessageReceived = "onAIAssistantMessageReceived",
|
|
27
28
|
}
|
|
@@ -109,7 +109,8 @@ export interface DataSource {
|
|
|
109
109
|
theme: CometChatTheme
|
|
110
110
|
): JSX.Element;
|
|
111
111
|
getGroupActionBubble(message: CometChat.BaseMessage, theme: CometChatTheme): JSX.Element | null;
|
|
112
|
-
|
|
112
|
+
getAgentAssistantMessageBubble: (message: CometChat.BaseMessage, theme: CometChatTheme) => JSX.Element;
|
|
113
|
+
getAgentAssistantMessageTemplate: (theme: CometChatTheme, additionalParams?: AdditionalParams) => CometChatMessageTemplate;
|
|
113
114
|
//content views
|
|
114
115
|
getTextMessageContentView(
|
|
115
116
|
message: CometChat.BaseMessage,
|
|
@@ -167,7 +168,8 @@ export interface DataSource {
|
|
|
167
168
|
messageType: string,
|
|
168
169
|
MessageCategory: string,
|
|
169
170
|
theme: CometChatTheme,
|
|
170
|
-
additionalParams?: AdditionalParams
|
|
171
|
+
additionalParams?: AdditionalParams,
|
|
172
|
+
message?: CometChat.BaseMessage
|
|
171
173
|
): CometChatMessageTemplate | null;
|
|
172
174
|
getGroupActionTemplate(
|
|
173
175
|
theme: CometChatTheme,
|
|
@@ -158,6 +158,13 @@ export class DataSourceDecorator implements DataSource {
|
|
|
158
158
|
return this.dataSource.getGroupActionBubble(message, theme);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
getAgentAssistantMessageBubble(message: CometChat.BaseMessage, theme: CometChatTheme): JSX.Element {
|
|
162
|
+
return this.dataSource.getAgentAssistantMessageBubble(message, theme);
|
|
163
|
+
}
|
|
164
|
+
getAgentAssistantMessageTemplate(theme: CometChatTheme, additionalParams?: AdditionalParams): CometChatMessageTemplate {
|
|
165
|
+
return this.dataSource.getAgentAssistantMessageTemplate(theme, additionalParams);
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
getTextMessageContentView(
|
|
162
169
|
message: CometChat.BaseMessage,
|
|
163
170
|
alignment: MessageBubbleAlignmentType,
|
|
@@ -245,9 +252,10 @@ export class DataSourceDecorator implements DataSource {
|
|
|
245
252
|
messageType: string,
|
|
246
253
|
MessageCategory: string,
|
|
247
254
|
theme: CometChatTheme,
|
|
248
|
-
additionalParams?: AdditionalParams
|
|
255
|
+
additionalParams?: AdditionalParams,
|
|
256
|
+
message?: CometChat.BaseMessage
|
|
249
257
|
): CometChatMessageTemplate | null {
|
|
250
|
-
return this.dataSource.getMessageTemplate(messageType, MessageCategory, theme, additionalParams);
|
|
258
|
+
return this.dataSource.getMessageTemplate(messageType, MessageCategory, theme, additionalParams, message);
|
|
251
259
|
}
|
|
252
260
|
|
|
253
261
|
getGroupActionTemplate(theme: CometChatTheme): CometChatMessageTemplate {
|