@cometchat/chat-uikit-react-native 4.0.2 → 4.1.1

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 (175) hide show
  1. package/README.md +1 -1
  2. package/ios/FileManager.m +1 -1
  3. package/package.json +3 -3
  4. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +164 -0
  5. package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +22 -0
  6. package/src/AI/AIAssistBot/AIAssistBotStyle.ts +43 -0
  7. package/src/AI/AIAssistBot/AIAssistBotView.tsx +294 -0
  8. package/src/AI/AIAssistBot/configuration.ts +22 -0
  9. package/src/AI/AIAssistBot/resources/index.ts +5 -0
  10. package/src/AI/{configuration.ts → AIBaseConfiguration.ts} +3 -6
  11. package/src/AI/AIBaseStyle.ts +58 -0
  12. package/src/AI/AIConversationStarter/AIConversationStarter.ts +5 -19
  13. package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +144 -130
  14. package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +11 -6
  15. package/src/AI/AIConversationStarter/configuration.ts +10 -17
  16. package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +175 -0
  17. package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +21 -0
  18. package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +20 -0
  19. package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +190 -0
  20. package/src/AI/AIConversationSummary/configuration.ts +14 -0
  21. package/src/AI/AIConversationSummary/resources/close.png +0 -0
  22. package/src/AI/AIConversationSummary/resources/index.ts +5 -0
  23. package/src/AI/AIExtensionDataSource.ts +17 -12
  24. package/src/AI/AIOptionsStyle.ts +14 -0
  25. package/src/AI/AISmartReplies/AISmartReplies.ts +6 -15
  26. package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +302 -0
  27. package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +1 -1
  28. package/src/AI/AISmartReplies/configuration.ts +4 -11
  29. package/src/AI/resources/index.ts +0 -2
  30. package/src/AI/utils.ts +3 -3
  31. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +118 -5
  32. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +3 -0
  33. package/src/CometChatMessageComposer/resources/index.ts +2 -0
  34. package/src/CometChatMessageComposer/styles.ts +1 -4
  35. package/src/CometChatMessageList/CometChatMessageList.tsx +52 -35
  36. package/src/CometChatMessages/CometChatMessages.tsx +4 -13
  37. package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
  38. package/src/calls/CallEvents.ts +1 -0
  39. package/src/calls/CallUtils.ts +106 -45
  40. package/src/calls/CallingDetailsUtils.tsx +133 -15
  41. package/src/calls/CallingExtentionDecorator.tsx +56 -45
  42. package/src/calls/CallingPackage.ts +16 -2
  43. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +9 -10
  44. package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +116 -0
  45. package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +36 -0
  46. package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +308 -0
  47. package/src/calls/CometChatCallLogDetails/index.ts +12 -0
  48. package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
  49. package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/style.ts +1 -0
  50. package/src/calls/{CometChatCallHistory/CallHistoryConfiguration.ts → CometChatCallLogHistory/CallLogHistoryConfiguration.ts} +15 -27
  51. package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +46 -0
  52. package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +337 -0
  53. package/src/calls/CometChatCallLogHistory/index.ts +12 -0
  54. package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
  55. package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
  56. package/src/calls/CometChatCallLogHistory/resources/index.ts +29 -0
  57. package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
  58. package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
  59. package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
  60. package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
  61. package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/style.ts +2 -1
  62. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +61 -0
  63. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +59 -0
  64. package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +220 -0
  65. package/src/calls/CometChatCallLogParticipants/index.ts +12 -0
  66. package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
  67. package/src/calls/CometChatCallLogParticipants/resources/index.ts +4 -0
  68. package/src/calls/CometChatCallLogParticipants/style.ts +24 -0
  69. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +63 -0
  70. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +63 -0
  71. package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +253 -0
  72. package/src/calls/CometChatCallLogRecordings/index.ts +12 -0
  73. package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
  74. package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
  75. package/src/calls/CometChatCallLogRecordings/resources/index.ts +6 -0
  76. package/src/calls/CometChatCallLogRecordings/style.ts +24 -0
  77. package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +87 -0
  78. package/src/calls/CometChatCallLogs/CallLogsStyle.ts +95 -0
  79. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +482 -0
  80. package/src/calls/CometChatCallLogs/index.ts +12 -0
  81. package/src/calls/CometChatCallLogs/resources/Back.png +0 -0
  82. package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
  83. package/src/calls/CometChatCallLogs/resources/Selection.png +0 -0
  84. package/src/calls/CometChatCallLogs/resources/Spinner.png +0 -0
  85. package/src/calls/CometChatCallLogs/resources/check.png +0 -0
  86. package/src/calls/CometChatCallLogs/resources/incomingcall.png +0 -0
  87. package/src/calls/CometChatCallLogs/resources/incomingvideo.png +0 -0
  88. package/src/calls/CometChatCallLogs/resources/index.ts +25 -0
  89. package/src/calls/CometChatCallLogs/resources/missedcall.png +0 -0
  90. package/src/calls/CometChatCallLogs/resources/missedvideo.png +0 -0
  91. package/src/calls/CometChatCallLogs/resources/outgoingcall.png +0 -0
  92. package/src/calls/CometChatCallLogs/resources/outgoingvideo.png +0 -0
  93. package/src/calls/CometChatCallLogs/style.ts +24 -0
  94. package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +9 -0
  95. package/src/calls/{CometChatCallHistoryWithDetails/CometChatCallHistoryWithDetails.tsx → CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx} +17 -16
  96. package/src/calls/CometChatCallLogsWithDetails/index.ts +7 -0
  97. package/src/calls/index.ts +40 -1
  98. package/src/calls/resources/index.ts +3 -1
  99. package/src/calls/resources/nextarrow.png +0 -0
  100. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +3 -5
  101. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +1 -1
  102. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -3
  103. package/src/extensions/ThumbnailGeneration/resources/empty.png +0 -0
  104. package/src/extensions/ThumbnailGeneration/resources/index.ts +5 -0
  105. package/src/index.ts +79 -4
  106. package/src/shared/CometChatUiKit/CometChatUIKit.ts +154 -130
  107. package/src/shared/CometChatUiKit/UIKitSettings.ts +2 -2
  108. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +4 -1
  109. package/src/shared/events/CometChatUIEventHandler/Listener.ts +5 -1
  110. package/src/shared/framework/DataSource.ts +4 -0
  111. package/src/shared/framework/DataSourceDecorator.tsx +5 -0
  112. package/src/shared/framework/MessageDataSource.tsx +4 -1
  113. package/src/shared/index.ts +4 -0
  114. package/src/shared/modals/CometChatCallLogDetailsOptions.ts +23 -0
  115. package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +16 -0
  116. package/src/shared/modals/index.ts +5 -1
  117. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +19 -5
  118. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +19 -5
  119. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +21 -7
  120. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +19 -5
  121. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +19 -5
  122. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +19 -5
  123. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +19 -5
  124. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +19 -5
  125. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +19 -5
  126. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +19 -5
  127. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +19 -5
  128. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +19 -4
  129. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +19 -5
  130. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  131. package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +1 -1
  132. package/src/shared/utils/conversationUtils.ts +1 -1
  133. package/src/shared/views/CometChatAICard/CometChatAICard.tsx +71 -0
  134. package/src/shared/views/CometChatAICard/resources/errormessage.png +0 -0
  135. package/src/shared/views/CometChatAICard/resources/index.ts +4 -0
  136. package/src/shared/views/CometChatAICard/resources/nomessage.png +0 -0
  137. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +4 -0
  138. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +11 -7
  139. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +56 -47
  140. package/src/shared/views/CometChatBottomSheet/style.ts +0 -2
  141. package/src/shared/views/CometChatDate/CometChatDate.tsx +7 -3
  142. package/src/shared/views/CometChatDate/DateConfiguration.ts +4 -0
  143. package/src/shared/views/CometChatDate/style.ts +1 -1
  144. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +31 -19
  145. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -2
  146. package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -0
  147. package/src/shared/views/CometChatPanel/PanelStyle.tsx +43 -0
  148. package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
  149. package/src/shared/views/CometChatPanel/resources/index.ts +5 -0
  150. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +7 -5
  151. package/src/AI/AIEnabler.ts +0 -115
  152. package/src/AI/AIEnablerDecorator.tsx +0 -324
  153. package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +0 -18
  154. package/src/calls/CometChatCallDetails/CallDetailsConfiguration.ts +0 -68
  155. package/src/calls/CometChatCallDetails/CallDetailsStyle.ts +0 -52
  156. package/src/calls/CometChatCallDetails/CometChatCallDetails.tsx +0 -268
  157. package/src/calls/CometChatCallDetails/index.ts +0 -9
  158. package/src/calls/CometChatCallHistory/CallHistoryStyle.ts +0 -34
  159. package/src/calls/CometChatCallHistory/CometChatCallHistory.tsx +0 -422
  160. package/src/calls/CometChatCallHistory/index.ts +0 -9
  161. package/src/calls/CometChatCallHistory/resources/index.ts +0 -17
  162. package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsConfiguration.ts +0 -7
  163. package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsStyle.ts +0 -3
  164. package/src/calls/CometChatCallHistoryWithDetails/index.ts +0 -8
  165. /package/src/{calls/CometChatCallDetails → AI/AIAssistBot}/resources/CloseIcon.png +0 -0
  166. /package/src/{AI → CometChatMessageComposer}/resources/ai.png +0 -0
  167. /package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/resources/index.ts +0 -0
  168. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Back.png +0 -0
  169. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Call.png +0 -0
  170. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Info.png +0 -0
  171. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Selection.png +0 -0
  172. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Spineer.png +0 -0
  173. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Video.png +0 -0
  174. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/check.png +0 -0
  175. /package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts +0 -0
@@ -49,6 +49,7 @@ import { CometChatContextType } from '../shared/base/Types';
49
49
  import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
50
50
  import { CometChatMessageComposerActionInterface } from '../shared/helper/types';
51
51
  import { CometChatMediaRecorder, MediaRecorderStyle } from '../shared/views/CometChatMediaRecorder';
52
+ import { AIOptionsStyle } from '../AI/AIOptionsStyle';
52
53
  const { FileManager } = NativeModules;
53
54
 
54
55
  const uiEventListenerShow = 'uiEvent_show_' + new Date().getTime();
@@ -175,6 +176,35 @@ const RecordAudio = (props: any) => {
175
176
  ) : null;
176
177
  }
177
178
 
179
+ const AIOptions = (props: any) => {
180
+ const {
181
+ aiStyle,
182
+ shouldShow = false,
183
+ onClose = () => { },
184
+ cometChatBottomSheetStyle = { backgroundColor: aiStyle.backgroundColor, paddingHorizontal: 0 },
185
+ sheetRef,
186
+ aiOptions,
187
+ ...otherProps
188
+ } = props;
189
+
190
+ return shouldShow ? (
191
+ <CometChatBottomSheet
192
+ ref={sheetRef}
193
+ onClose={onClose}
194
+ style={cometChatBottomSheetStyle}
195
+ >
196
+
197
+ <CometChatActionSheet
198
+ actions={aiOptions}
199
+ style={{ ...aiStyle, paddingHorizontal: 0 }}
200
+ {...otherProps}
201
+ onPress={props.onClick}
202
+ hideHeader={true}
203
+ />
204
+ </CometChatBottomSheet>
205
+ ) : null;
206
+ }
207
+
178
208
  const LiveReaction = (props: any) => {
179
209
  const { show = false, reaction } = props;
180
210
  if (show) {
@@ -464,6 +494,14 @@ export interface CometChatMessageComposerInterface {
464
494
  * @description callback(error)→ void
465
495
  */
466
496
  onError?: (error: any) => void;
497
+ /**
498
+ * AI Icon URL.
499
+ */
500
+ AIIconURL?: string;
501
+ /**
502
+ * AI Options Style.
503
+ */
504
+ aiOptionsStyle?: AIOptionsStyle;
467
505
  }
468
506
  export const CometChatMessageComposer = React.forwardRef(
469
507
  (props: CometChatMessageComposerInterface, ref) => {
@@ -505,20 +543,21 @@ export const CometChatMessageComposer = React.forwardRef(
505
543
  deleteIconUrl,
506
544
  stopIconUrl,
507
545
  submitIconUrl,
546
+ AIIconURL,
547
+ aiOptionsStyle
508
548
  } = props;
509
549
 
510
550
  const defaultAttachmentOptions =
511
551
  ChatConfigurator.dataSource.getAttachmentOptions(user, group, id);
512
552
 
513
553
  const composerIdMap = new Map().set('parentMessageId', parentMessageId);
514
- const defaultAuxiliaryButtonOptions =
554
+ const defaultAuxiliaryButtonOptions =
515
555
  ChatConfigurator.getDataSource().getAuxiliaryOptions(
516
556
  user,
517
557
  group,
518
558
  composerIdMap,
519
559
  theme
520
560
  );
521
-
522
561
 
523
562
  const loggedInUser = React.useRef<any>({});
524
563
  const chatWith = React.useRef<any>(null);
@@ -531,6 +570,9 @@ export const CometChatMessageComposer = React.forwardRef(
531
570
  const [showEmojiboard, setShowEmojiboard] = React.useState(false);
532
571
  const [showActionSheet, setShowActionSheet] = React.useState(false);
533
572
  const [showRecordAudio, setShowRecordAudio] = React.useState(false);
573
+ const [showAIOptions, setShowAIOptions] = React.useState(false);
574
+ const [AIOptionItems, setAIOptionItems] = React.useState([]);
575
+ const [rootAIOptionItems, setRootAIOptionItems] = React.useState([]);
534
576
  const [actionSheetItems, setActionSheetItems] = React.useState([]);
535
577
  const [messagePreview, setMessagePreview] = React.useState(null);
536
578
  const [CustomView, setCustomView] = React.useState(null);
@@ -540,6 +582,18 @@ export const CometChatMessageComposer = React.forwardRef(
540
582
 
541
583
  const bottomSheetRef = React.useRef<any>(null);
542
584
 
585
+ const AIStyles = new AIOptionsStyle({
586
+ //NEED TO ADD DEFAULT STYLE HERE
587
+ backgroundColor: theme.palette.getBackgroundColor(),
588
+ listItemBackground: theme.palette.getBackgroundColor(),
589
+ listItemTitleFont: theme.typography.subtitle1,
590
+ listItemTitleColor: theme.palette.getAccent(),
591
+ listItemBorderRadius: 0,
592
+ optionsSeparatorTint: theme.palette.getAccent200(),
593
+ borderRadius: 0,
594
+ ...aiOptionsStyle,
595
+ })
596
+
543
597
  let isTyping = null;
544
598
 
545
599
  /**
@@ -898,6 +952,10 @@ export const CometChatMessageComposer = React.forwardRef(
898
952
  );
899
953
  };
900
954
 
955
+ const shouldShowAIOptions = () => {
956
+ return AIOptionItems.length > 0;
957
+ }
958
+
901
959
  const AuxiliaryButtonViewElem = () => {
902
960
  if (AuxiliaryButtonView)
903
961
  return (
@@ -906,6 +964,7 @@ export const CometChatMessageComposer = React.forwardRef(
906
964
  else if (defaultAuxiliaryButtonOptions)
907
965
  return <View style={{ flexDirection: "row", alignItems: "center" }}>
908
966
  {defaultAuxiliaryButtonOptions}
967
+ {shouldShowAIOptions() && <AIOptionsButtonView />}
909
968
  {!hideVoiceRecording && <RecordAudioButtonView />}
910
969
  </View>;
911
970
 
@@ -976,6 +1035,16 @@ export const CometChatMessageComposer = React.forwardRef(
976
1035
  onClick={() => setShowRecordAudio(true)}
977
1036
  />
978
1037
  }
1038
+ const AIOptionsButtonView = () => {
1039
+ return <ImageButton
1040
+ image={AIIconURL || ICONS.AI}
1041
+ imageStyle={Style.imageStyle}
1042
+ onClick={() => {
1043
+ setShowAIOptions(true)
1044
+ setAIOptionItems(rootAIOptionItems)
1045
+ }}
1046
+ />
1047
+ }
979
1048
 
980
1049
  //fetch logged in user
981
1050
  useEffect(() => {
@@ -1059,21 +1128,55 @@ export const CometChatMessageComposer = React.forwardRef(
1059
1128
  };
1060
1129
  })
1061
1130
  );
1131
+
1132
+ const aiOptions = ChatConfigurator.dataSource.getAIOptions(user, group, theme, composerIdMap, AIStyles);
1133
+ let newAiOptions = _getAIOptions(aiOptions);
1134
+ setAIOptionItems(newAiOptions);
1135
+ setRootAIOptionItems(newAiOptions);
1062
1136
  }, [user, group, id, parentMessageId]);
1063
1137
 
1138
+ const _getAIOptions = (options) => {
1139
+ let newOptions = [...options];
1140
+ let newAiOptions = newOptions.map((item) => {
1141
+ if (typeof item.onPress === 'function')
1142
+ return {
1143
+ ...item,
1144
+ onPress: () => {
1145
+ setShowAIOptions(false)
1146
+ item.onPress(user)
1147
+ },
1148
+ };
1149
+ return {
1150
+ ...item,
1151
+ onPress: () => { },
1152
+ };
1153
+ })
1154
+ return newAiOptions;
1155
+
1156
+ }
1157
+
1064
1158
  useEffect(() => {
1065
1159
  CometChatUIEventHandler.addMessageListener(editMessageListenerID, {
1066
1160
  ccMessageEdited: (item) => previewMessage(item),
1067
1161
  });
1068
1162
  CometChatUIEventHandler.addUIListener(UiEventListenerID, {
1069
1163
  ccToggleBottomSheet: (item) => {
1164
+ if (item?.bots) {
1165
+ let newAiOptions = _getAIOptions(item.bots)
1166
+ setAIOptionItems(newAiOptions);
1167
+ setShowAIOptions(true)
1168
+ return;
1169
+ } else if (item?.botView) {
1170
+ setCustomView(() => item.child);
1171
+ return;
1172
+ }
1070
1173
  setIsVisible(false);
1071
1174
  bottomSheetRef.current?.togglePanel();
1072
1175
  },
1073
- ccComposeMessage: (text)=>{
1176
+ ccComposeMessage: (text) => {
1074
1177
  setIsVisible(false);
1075
1178
  bottomSheetRef.current?.togglePanel();
1076
-
1179
+
1077
1180
  setInputMessage(text?.text)
1078
1181
 
1079
1182
  }
@@ -1129,7 +1232,9 @@ export const CometChatMessageComposer = React.forwardRef(
1129
1232
 
1130
1233
  return (
1131
1234
  <>
1235
+ {!isVisible && typeof CustomView === "function" && <CustomView />}
1132
1236
  <Modal
1237
+ animationType="slide"
1133
1238
  visible={isVisible}
1134
1239
  onRequestClose={() => {
1135
1240
  setIsVisible(false);
@@ -1147,7 +1252,6 @@ export const CometChatMessageComposer = React.forwardRef(
1147
1252
  style={[
1148
1253
  Style.container,
1149
1254
  {
1150
- backgroundColor: theme.palette.getAccent100(),
1151
1255
  paddingTop: CustomViewHeader ? 0 : 8
1152
1256
  },
1153
1257
  messageComposerStyle,
@@ -1218,6 +1322,15 @@ export const CometChatMessageComposer = React.forwardRef(
1218
1322
  stopIconUrl={stopIconUrl}
1219
1323
  submitIconUrl={submitIconUrl}
1220
1324
  />
1325
+ <AIOptions
1326
+ sheetRef={bottomSheetRef}
1327
+ shouldShow={showAIOptions}
1328
+ onClose={() => {
1329
+ setShowAIOptions(false)
1330
+ }}
1331
+ aiOptions={AIOptionItems}
1332
+ aiStyle={AIStyles}
1333
+ />
1221
1334
  {HeaderView ? (
1222
1335
  <HeaderView />
1223
1336
  ) : (
@@ -7,6 +7,7 @@ import {
7
7
  //@ts-ignore
8
8
  import { CometChat } from '@cometchat/chat-sdk-react-native';
9
9
  import { MediaRecorderStyle } from '../shared/views/CometChatMediaRecorder';
10
+ import { AIOptionsStyle } from '../AI/AIOptionsStyle';
10
11
  export interface MessageComposerConfigurationInterface
11
12
  extends Omit<
12
13
  CometChatMessageComposerInterface,
@@ -72,6 +73,8 @@ export class MessageComposerConfiguration {
72
73
  composerId: string | number;
73
74
  }) => JSX.Element;
74
75
  text?: string;
76
+ AIIconURL?: string;
77
+ AIOptionsStyle?: AIOptionsStyle;
75
78
  constructor(props: MessageComposerConfigurationInterface) {
76
79
  if (props)
77
80
  for (const [key, value] of Object.entries(props)) {
@@ -6,6 +6,7 @@ import IMAGE from './image.png'
6
6
  import CLOSE from './close.png';
7
7
  import STICKER from "./stickers.png";
8
8
  import MICROPHONE from "./microphone.png";
9
+ import AI from './ai.png'
9
10
 
10
11
  export const ICONS ={
11
12
  HEART,
@@ -16,4 +17,5 @@ export const ICONS ={
16
17
  CLOSE,
17
18
  STICKER,
18
19
  MICROPHONE,
20
+ AI
19
21
  }
@@ -1,11 +1,8 @@
1
- import React from 'react';
2
1
  import { StyleSheet } from 'react-native';
3
2
 
4
3
  export const Style = StyleSheet.create({
5
4
  container: {
6
- borderRadius: 8,
7
- paddingTop: 8,
8
- marginTop: 10,
5
+ paddingVertical: 8,
9
6
  },
10
7
  padding: {
11
8
  paddingStart: 8,
@@ -133,6 +133,7 @@ export const CometChatMessageList = forwardRef<
133
133
  const callListenerId = "call_" + new Date().getTime();
134
134
  const groupListenerId = "group_" + new Date().getTime();
135
135
  const uiEventListener = "uiEvent_" + new Date().getTime();
136
+ const callEventListener = 'callEvent_' + new Date().getTime();
136
137
  const uiEventListenerShow = "uiEvent_show_" + new Date().getTime();
137
138
  const uiEventListenerHide = "uiEvent_hide_" + new Date().getTime();
138
139
  const connectionListenerId = 'connectionListener_' + new Date().getTime();
@@ -242,6 +243,7 @@ export const CometChatMessageList = forwardRef<
242
243
  const [ExtensionsComponent, setExtensionsComponent] = useState(null);
243
244
  const [CustomListHeader, setCustomListHeader] = useState(null);
244
245
  const [messageInfo, setMessageInfo] = useState(false);
246
+ const [ongoingCallView, setOngoingCallView] = useState(null);
245
247
  // const [forwarding, setForwarding] = useState(false);
246
248
 
247
249
  const infoObject = useRef<CometChat.BaseMessage>();
@@ -274,14 +276,12 @@ export const CometChatMessageList = forwardRef<
274
276
  }
275
277
 
276
278
  const markUnreadMessageAsRead = () => {
277
- if (messagesList[messagesList.length - 1].getReceiverType() == ReceiverTypeConstants.user) {
278
- for (let index = 0; index < unreadCount; index++) {
279
- const message = messagesList[messagesList.length - (index + 1)];
280
- if (index == 0)
281
- CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageRead, { message });
282
- CometChat.markAsRead(message);
283
- setUnreadCount(0);
284
- }
279
+ for (let index = 0; index < unreadCount; index++) {
280
+ const message = messagesList[messagesList.length - (index + 1)];
281
+ if (index == 0)
282
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageRead, { message });
283
+ CometChat.markAsRead(message);
284
+ setUnreadCount(0);
285
285
  }
286
286
  }
287
287
 
@@ -308,16 +308,16 @@ export const CometChatMessageList = forwardRef<
308
308
  .then(msgs => {
309
309
  let reversed = msgs.reverse();
310
310
  if (messagesList.length === 0 && msgs?.length > 0) {
311
- CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0],user:user,group:group,theme:theme,parentMessageId:parentMessageId });
311
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0], user: user, group: group, theme: theme, parentMessageId: parentMessageId });
312
312
  if (conversationId.current == null)
313
313
  conversationId.current = reversed[0].getConversationId();
314
-
314
+
315
315
  }
316
- else if(messagesList.length === 0 && !props?.parentMessageId){
317
- CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0],user:user,group:group,theme:theme,parentMessageId:parentMessageId });
316
+ else if (messagesList.length === 0 && !props?.parentMessageId) {
317
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0], user: user, group: group, theme: theme, parentMessageId: parentMessageId });
318
318
 
319
319
  }
320
-
320
+
321
321
  for (let index = 0; index < reversed.length; index++) {
322
322
  const message: CometChat.BaseMessage = reversed[index];
323
323
  if (message && !disableReceipt && !message.hasOwnProperty("readAt") && loggedInUser.current.getUid() != message['sender']['uid']) {
@@ -637,6 +637,12 @@ export const CometChatMessageList = forwardRef<
637
637
  bottomSheetRef.current?.togglePanel()
638
638
  },
639
639
  });
640
+ CometChatUIEventHandler.addCallListener(callEventListener, {
641
+ ccShowOngoingCall: (CometChatOngoingComponent) => {
642
+ //show ongoing call
643
+ setOngoingCallView(CometChatOngoingComponent?.child);
644
+ },
645
+ });
640
646
  CometChat.getLoggedinUser()
641
647
  .then(u => {
642
648
  loggedInUser.current = u;
@@ -654,6 +660,7 @@ export const CometChatMessageList = forwardRef<
654
660
  CometChatUIEventHandler.removeUIListener(uiEventListenerShow)
655
661
  CometChatUIEventHandler.removeUIListener(uiEventListenerHide)
656
662
  CometChatUIEventHandler.removeUIListener(uiEventListener);
663
+ CometChatUIEventHandler.removeCallListener(callEventListener);
657
664
  onBack && onBack();
658
665
  }
659
666
  }, [])
@@ -846,15 +853,15 @@ export const CometChatMessageList = forwardRef<
846
853
  },
847
854
  onDisconnected: () => {
848
855
  console.log("ConnectionListener => On Disconnected");
849
- if (!messagesList[0].id) {
850
- for (let i = 0; i < messagesList.length; i++) {
856
+ if (!messagesList[messagesList.length - 1].id) {
857
+ for (let i = (messagesList.length - 1); i >= 0; i--) {
851
858
  if (messagesList[i].id) {
852
859
  lastID.current = messagesList[i].id;
853
860
  break;
854
861
  }
855
862
  }
856
863
  } else {
857
- lastID.current = messagesList[0].id;
864
+ lastID.current = messagesList[messagesList.length - 1].id;
858
865
  }
859
866
  }
860
867
  })
@@ -925,6 +932,7 @@ export const CometChatMessageList = forwardRef<
925
932
  style={messageBubbleDateStyle}
926
933
  pattern={"timeFormat"}
927
934
  customDateString={datePattern && datePattern(item)}
935
+ dateAlignment="center"
928
936
  />
929
937
  }
930
938
  </View>
@@ -954,6 +962,7 @@ export const CometChatMessageList = forwardRef<
954
962
  style={messageBubbleDateStyle}
955
963
  pattern={"timeFormat"}
956
964
  customDateString={datePattern && datePattern(item)}
965
+ dateAlignment="center"
957
966
  />
958
967
  {
959
968
  !disableReceipt && isSender ?
@@ -1101,7 +1110,7 @@ export const CometChatMessageList = forwardRef<
1101
1110
  // textMessage.setMuid(`${getUnixTimestamp()}`);
1102
1111
  // textMessage['_composedAt'] = getUnixTimestamp();
1103
1112
  // textMessage.setReceiverType(receiverType);
1104
- // CometChatUIKit.sendTextMessage(textMessage, resolve, reject)
1113
+ // CometChatUIKit.sendTextMessage(textMessage).then(resolve).catch(reject)
1105
1114
  // break;
1106
1115
  // case MessageTypeConstants.image:
1107
1116
  // case MessageTypeConstants.video:
@@ -1126,7 +1135,7 @@ export const CometChatMessageList = forwardRef<
1126
1135
 
1127
1136
  // mediaMessage.setData(messageToForward.current['data']);
1128
1137
 
1129
- // CometChatUIKit.sendMediaMessage(mediaMessage, resolve, reject)
1138
+ // CometChatUIKit.sendMediaMessage(mediaMessage).then(resolve).catch(reject);
1130
1139
  // break;
1131
1140
  // default:
1132
1141
  // break;
@@ -1239,7 +1248,7 @@ export const CometChatMessageList = forwardRef<
1239
1248
 
1240
1249
  const RenderMessageItem = ({ item, index }) => {
1241
1250
  let seperatorView = null;
1242
- const previousMessageDate = messagesList[index + 1] ? new Date(getSentAtTimestamp(messagesList[index + 1])) : null;
1251
+ const previousMessageDate = messagesList[index - 1] ? new Date(getSentAtTimestamp(messagesList[index - 1])) : null;
1243
1252
  const currentMessageDate = new Date(getSentAtTimestamp(item));
1244
1253
 
1245
1254
  const currentDate = isNaN(currentMessageDate.getDate()) ? undefined : `${currentMessageDate.getDate()}-${currentMessageDate.getMonth()}-${currentMessageDate.getFullYear()}`;
@@ -1254,6 +1263,7 @@ export const CometChatMessageList = forwardRef<
1254
1263
  pattern={"dayDateFormat"}
1255
1264
  style={_dateSeperatorStyle}
1256
1265
  customDateString={dateSeperatorPattern ? dateSeperatorPattern(item['sentAt']) : undefined}
1266
+ dateAlignment="center"
1257
1267
  />
1258
1268
  </View>
1259
1269
  )
@@ -1261,8 +1271,8 @@ export const CometChatMessageList = forwardRef<
1261
1271
  lastMessageDate.current = getSentAtTimestamp(item);
1262
1272
 
1263
1273
  return <React.Fragment key={index}>
1264
- <MessageView message={item} />
1265
1274
  {seperatorView}
1275
+ <MessageView message={item} />
1266
1276
  </React.Fragment>
1267
1277
  };
1268
1278
 
@@ -1273,20 +1283,22 @@ export const CometChatMessageList = forwardRef<
1273
1283
  const getEmptyTextView = useCallback(() => {
1274
1284
  if (EmptyStateView)
1275
1285
  return <EmptyStateView />
1276
- return undefined;
1277
- // return (
1278
- // <View style={Style.msgContainerStyle}>
1279
- // <Text
1280
- // style={[
1281
- // Style.msgTxtStyle, {
1282
- // ...(messageListStyle?.emptyStateTextFont),
1283
- // color: messageListStyle?.emptyStateTextColor
1284
- // }]}
1285
- // >
1286
- // {emptyStateText}
1287
- // </Text>
1288
- // </View >
1289
- // )
1286
+ return (
1287
+ <>
1288
+ <View style={Style.msgContainerStyle}>
1289
+ <Text
1290
+ style={[
1291
+ Style.msgTxtStyle, {
1292
+ ...(messageListStyle?.emptyStateTextFont),
1293
+ color: messageListStyle?.emptyStateTextColor
1294
+ }]}
1295
+ >
1296
+ {emptyStateText}
1297
+ </Text>
1298
+ </View >
1299
+ {CustomListHeader && <CustomListHeader />}
1300
+ </>
1301
+ )
1290
1302
  }, [])
1291
1303
 
1292
1304
  const getErrorStateView = useCallback(() => {
@@ -1353,7 +1365,10 @@ export const CometChatMessageList = forwardRef<
1353
1365
  } = _messageListStyle;
1354
1366
 
1355
1367
  return (
1356
- <View style={{ height, width, backgroundColor, borderRadius, ...border }}>
1368
+ <View style={{
1369
+ height, width, backgroundColor, borderRadius, ...border,
1370
+ paddingStart: 8, paddingEnd: 8,
1371
+ }}>
1357
1372
  {
1358
1373
  listState == "loading" && messagesList.length == 0 ?
1359
1374
  getLoadingStateView() :
@@ -1410,6 +1425,8 @@ export const CometChatMessageList = forwardRef<
1410
1425
  )}
1411
1426
  </ScrollView>
1412
1427
  </SafeAreaView>
1428
+ {CustomListHeader && <CustomListHeader />}
1429
+ {ongoingCallView}
1413
1430
  {
1414
1431
  FooterView && <View style={[Style.stickyHeaderFooterStyle, { bottom: 0 }]}>
1415
1432
  <FooterView
@@ -74,7 +74,7 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
74
74
  const { theme } = useContext(CometChatContext);
75
75
 
76
76
  //calcualted styles and configurations
77
- const _messageStyles = new MessageStyle({
77
+ const _messagesStyles = new MessageStyle({
78
78
  backgroundColor: theme.palette.getBackgroundColor(),
79
79
  ...messagesStyle
80
80
  });
@@ -210,10 +210,8 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
210
210
  return (
211
211
  <View style={Style.appBarStyle}>
212
212
  {
213
- ChatConfigurator.dataSource.getAuxiliaryHeaderAppbarOptions(user, group, theme)
214
- }
215
- {
216
- AuxilaryAppBarOptions && <AuxilaryAppBarOptions group={groupObject} user={userObject} />
213
+ AuxilaryAppBarOptions ? <AuxilaryAppBarOptions group={groupObject} user={userObject} />
214
+ : ChatConfigurator.dataSource.getAuxiliaryHeaderAppbarOptions(user, group, theme)
217
215
  }
218
216
  {
219
217
  !hideDetails && (
@@ -235,17 +233,10 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
235
233
  width,
236
234
  border,
237
235
  borderRadius
238
- } = _messageStyles;
236
+ } = _messagesStyles;
239
237
 
240
238
  return <View style={[
241
239
  Style.container,
242
- showComponent == ComponentNames.Details ||
243
- showComponent == ComponentNames.Thread
244
- ? {}
245
- : {
246
- paddingStart: 8,
247
- paddingEnd: 8
248
- },
249
240
  { backgroundColor, height, width, ...border, borderRadius }
250
241
  ]
251
242
  }>
@@ -21,7 +21,7 @@ export interface MessagesConfigurationInterface {
21
21
  disableSoundForMessages?: boolean,
22
22
  customSoundForIncomingMessage?: string,
23
23
  customSoundForOutgoingMessage?: string,
24
- messageStyle?: MessageStyleInterface,
24
+ messagesStyle?: MessageStyleInterface,
25
25
  AuxilaryAppBarOptions?: (props:{user?: CometChat.User, group?: CometChat.Group}) => JSX.Element
26
26
  }
27
27
 
@@ -41,7 +41,7 @@ export class MessagesConfiguration implements MessagesConfigurationInterface {
41
41
  disableSoundForMessages?: boolean
42
42
  customSoundForIncomingMessage?: string
43
43
  customSoundForOutgoingMessage?: string
44
- messageStyle?: MessageStyleInterface
44
+ messagesStyle?: MessageStyleInterface
45
45
  AuxilaryAppBarOptions?: (props:{user?: CometChat.User, group?: CometChat.Group}) => JSX.Element
46
46
 
47
47
  constructor(props: MessagesConfigurationInterface) {
@@ -6,4 +6,5 @@ export const CallUIEvents = {
6
6
  ccCallEnded: "ccCallEnded",
7
7
  ccCallJoined: "ccCallJoined",
8
8
  ccOutgoingCall: "ccOutgoingCall",
9
+ ccShowOngoingCall: "ccShowOngoingCall",
9
10
  }