@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
@@ -30,7 +30,7 @@
30
30
  "YESTERDAY": "昨天",
31
31
  "TYPING": "輸入...",
32
32
  "IS_TYPING": "正在輸入...",
33
- "SUGGEST_A_REPLIES":"建議回覆",
33
+ "SUGGEST_A_REPLY":"建議回覆",
34
34
  "GENERATIONG_ICEBREAKER":"生成破冰船",
35
35
  "CLOSE": "關閉",
36
36
  "ENTER_GROUP_NAME": "輸入群組名稱",
@@ -79,7 +79,7 @@
79
79
  "UNANSWERED_AUDIO_CALL": "未接聽的音訊通話",
80
80
  "UNANSWERED_VIDEO_CALL": "未接聽的視訊通話",
81
81
  "CALL_ENDED": "通話結束",
82
- "CALL_CANCELLED": "通話已取消",
82
+ "CANCELLED_CALL": "已取消通話",
83
83
  "CALL_BUSY": "對方正在忙碌",
84
84
  "CALLING": "正在撥打...",
85
85
  "ADD": "新增",
@@ -149,7 +149,7 @@
149
149
  "ADDED": "添加",
150
150
  "UNBANNED": "取消封鎖",
151
151
  "MADE": "製作",
152
- "CALL_UNANSWERED": "未接聽來電",
152
+ "UNANSWERED_CALL": "未接聽的電話",
153
153
  "MISSED_AUDIO_CALL": "未接聽的音訊通話",
154
154
  "ENTER_YOUR_PASSWORD": "輸入您的密碼",
155
155
  "DOCS": "文件",
@@ -264,14 +264,28 @@
264
264
  "TEXT": "文字",
265
265
  "INCOMING_CALL": "來電",
266
266
  "OUTGOING_CALL": "撥出電話",
267
- "CALL_MISSED": "未接來電",
267
+ "MISSED_CALL": "未接來電",
268
268
  "NEW_CONVERSATION": "新聊天",
269
269
  "FORWARDING": "正在傳送訊息..",
270
270
  "READ": "閱讀",
271
271
  "No_RECIPIENT": "沒有收件人",
272
272
  "RECEIPT_INFORMATION": "收據資料",
273
273
  "MESSAGE": "留言",
274
+ "GENERATING_SUMMARY":"產生摘要",
275
+ "CONVERSATION_SUMMARY":"對話摘要",
276
+ "GENERATE_SUMMARY":"產生摘要",
277
+ "COMETCHAT_BOT_FIRST_MESSAGE":"我該如何幫助您進行這個對話?請問我一個問題,我會給你建議 🙂",
278
+ "COMETCHAT_ASK_BOT":"詢問",
279
+ "COMETCHAT_ASK_AI_BOT":"詢問 AI 機器人",
280
+ "COMETCHAT_ASK_BOT_SUBTITLE":"人工智能機器人",
274
281
  "FORM_COMPLETION_MESSAGE": "感謝您填寫表格。",
275
282
  "FORM":"表格",
276
- "CARD":"卡"
283
+ "CARD":"卡",
284
+ "RECORDINGS":"錄音",
285
+ "PARTICIPANTS":"參加者",
286
+ "NO_PARTICIPANTS":"沒有參加者",
287
+ "NO_RECORDINGS":"沒有錄音",
288
+ "CALL_LOGS":"通話記錄",
289
+ "CANCELLED_AUDIO_CALL":"已取消音訊通話",
290
+ "CANCELLED_VIDEO_CALL":"已取消視頻通話"
277
291
  }
@@ -98,6 +98,7 @@ class PaletteItem {
98
98
  * @param {String} mode
99
99
  * @param {Object} backgroundColor
100
100
  * @param {Object} primary
101
+ * @param {Object} primary40
101
102
  * @param {Object} secondary
102
103
  * @param {Object} error
103
104
  * @param {Object} success
@@ -118,6 +119,7 @@ class Palette {
118
119
  mode: string
119
120
  backgroundColor: PaletteItem
120
121
  primary: PaletteItem
122
+ primary40: PaletteItem
121
123
  secondary: PaletteItem
122
124
  error: PaletteItem
123
125
  success: PaletteItem
@@ -142,6 +144,10 @@ class Palette {
142
144
  [modes.light]: 'rgb(51, 153, 255)',
143
145
  [modes.dark]: 'rgb(51, 153, 255)',
144
146
  }),
147
+ primary40 = new PaletteItem({
148
+ [modes.light]: 'rgba(51, 153, 255, .04)',
149
+ [modes.dark]: 'rgba(51, 153, 255, .04)',
150
+ }),
145
151
  secondary = new PaletteItem({
146
152
  [modes.light]: 'rgba(248, 248, 248, 0.92)',
147
153
  [modes.dark]: 'rgba(248, 248, 248, 0.92)',
@@ -202,6 +208,7 @@ class Palette {
202
208
  this.mode = mode;
203
209
  this.backgroundColor = backgroundColor;
204
210
  this.primary = primary;
211
+ this.primary40 = primary40;
205
212
  this.secondary = secondary;
206
213
  this.error = error;
207
214
  this.success = success;
@@ -263,6 +270,9 @@ class Palette {
263
270
  getPrimary = () => {
264
271
  return this.primary[this.mode];
265
272
  };
273
+ getPrimary40 = () => {
274
+ return this.primary40[this.mode];
275
+ }
266
276
  getSecondary = () => {
267
277
  return this.secondary[this.mode];
268
278
  };
@@ -287,6 +297,12 @@ class Palette {
287
297
  }
288
298
  }
289
299
 
300
+ setPrimary40(colorset) {
301
+ if (colorset && colorset[modes.light] && colorset[modes.dark]) {
302
+ this.primary40 = colorset;
303
+ }
304
+ }
305
+
290
306
  setError(colorset) {
291
307
  if (colorset && colorset[modes.light] && colorset[modes.dark]) {
292
308
  this.error = colorset;
@@ -24,7 +24,7 @@ const validateDetailOptions = ({ loggedInUser, group, optionId }) => {
24
24
  let isValid = validateGroupMemberOptions(
25
25
  loggedInUser.uid === group.owner
26
26
  ? GroupMemberScope.owner
27
- : GroupMemberScope.participant,
27
+ : group.scope,
28
28
  group.scope,
29
29
  optionId
30
30
  );
@@ -15,7 +15,7 @@ export class CometChatConversationUtils {
15
15
  }
16
16
 
17
17
  static getLastMessage(conversation: CometChat.Conversation): CometChat.BaseMessage {
18
- let msg = conversation.getLastMessage();
18
+ let msg = conversation?.getLastMessage && conversation?.getLastMessage();
19
19
  if (!msg) {
20
20
  return undefined;
21
21
  }
@@ -0,0 +1,71 @@
1
+ import { View, Text, ActivityIndicator, Image } from 'react-native'
2
+ import React, { useContext } from 'react'
3
+ import { AIBaseStyle, AIBaseStyleInterface } from '../../../AI/AIBaseStyle';
4
+ import { CometChatContext } from '../../CometChatContext';
5
+ import { ErrorMessageIcon, NoMessageIcon } from './resources';
6
+
7
+ const enum States {
8
+ loading = "loading",
9
+ error = "error",
10
+ empty = "empty",
11
+ }
12
+
13
+ export interface CometChatAICardInterface {
14
+ state: "loading" | "error" | "empty",
15
+ style: AIBaseStyleInterface,
16
+ loadingIconTint?: string,
17
+ errorIconTint?: string,
18
+ emptyIconTint?: string,
19
+ loadingIconURL?: string,
20
+ errorIconURL?: string,
21
+ emptyIconURL?: string,
22
+ loadingStateText?: string,
23
+ errorStateText?: string,
24
+ emptyStateText?: string,
25
+ }
26
+
27
+ const CometChatAICard = (props: CometChatAICardInterface) => {
28
+ const { state, style,
29
+ loadingStateText, loadingIconURL,
30
+ emptyIconURL, emptyStateText,
31
+ errorIconURL, errorStateText } = props;
32
+
33
+ const { theme } = useContext(CometChatContext);
34
+
35
+ const { emptyStateTextColor, emptyStateTextFont, emptyIconTint,
36
+ errorStateTextColor, errorStateTextFont, errorIconTint,
37
+ loadingStateTextColor, loadingStateTextFont, loadingIconTint
38
+ } = new AIBaseStyle({
39
+ emptyIconTint: theme.palette.getAccent(),
40
+ emptyStateTextColor: theme.palette.getAccent(),
41
+ emptyStateTextFont: theme.typography.subtitle1,
42
+ errorIconTint: theme.palette.getAccent(),
43
+ errorStateTextColor: theme.palette.getAccent(),
44
+ errorStateTextFont: theme.typography.subtitle1,
45
+ loadingIconTint: theme.palette.getAccent(),
46
+ loadingStateTextColor: theme.palette.getAccent(),
47
+ loadingStateTextFont: theme.typography.subtitle1,
48
+ ...style,
49
+ })
50
+ return (
51
+ <View>
52
+ {props.children ? props.children :
53
+ state === States.loading ? <View style={{ flexDirection: "row", alignItems: "center", padding: 10 }}>
54
+ {!loadingIconURL ? <ActivityIndicator color={loadingIconTint} /> :
55
+ <Image style={{ width: 25, height: 25, tintColor: loadingIconTint }} source={loadingIconURL} />}
56
+ <Text style={[loadingStateTextFont, { color: loadingStateTextColor, marginLeft: 10 }]}>{loadingStateText}</Text>
57
+ </View>
58
+ : state === States.error ? <View style={{ flexDirection: "row", alignItems: "center", padding: 10 }}>
59
+ <Image style={{ width: 25, height: 25, tintColor: errorIconTint }} source={errorIconURL || ErrorMessageIcon} />
60
+ <Text style={[errorStateTextFont, { color: errorStateTextColor, marginLeft: 10 }]}>{errorStateText}</Text>
61
+ </View>
62
+ : state === States.empty ? <View style={{ flexDirection: "row", alignItems: "center", padding: 10 }}>
63
+ <Image style={{ width: 25, height: 25, tintColor: emptyIconTint }} source={emptyIconURL || NoMessageIcon} />
64
+ <Text style={[emptyStateTextFont, { color: emptyStateTextColor, marginLeft: 10 }]}>{emptyStateText}</Text>
65
+ </View>
66
+ : null}
67
+ </View>
68
+ )
69
+ }
70
+
71
+ export default CometChatAICard
@@ -0,0 +1,4 @@
1
+ import NoMessageIcon from "./nomessage.png";
2
+ import ErrorMessageIcon from "./errormessage.png";
3
+
4
+ export { NoMessageIcon, ErrorMessageIcon };
@@ -10,6 +10,7 @@ export interface ActionSheetStylesInterface extends BaseStyleInterface {
10
10
  listItemIconBackground?: string;
11
11
  listItemIconBorderRadius?: number;
12
12
  actionSheetSeparatorTint?: string;
13
+ paddingHorizontal?: number;
13
14
  }
14
15
 
15
16
  /**
@@ -26,6 +27,7 @@ export class ActionSheetStyles extends BaseStyle {
26
27
  listItemIconBackground: string;
27
28
  listItemIconBorderRadius: number;
28
29
  actionSheetSeparatorTint: string;
30
+ paddingHorizontal?: number;
29
31
  /**
30
32
  * @param {object} param0
31
33
  * @param {any} width
@@ -56,6 +58,7 @@ export class ActionSheetStyles extends BaseStyle {
56
58
  listItemIconBorderRadius = 0,
57
59
  listItemTitleFont = new FontStyle({fontSize: 17, fontWeight: "400"}),
58
60
  listItemTitleColor = "",
61
+ paddingHorizontal,
59
62
  }: ActionSheetStylesInterface) {
60
63
  super({
61
64
  width,
@@ -72,5 +75,6 @@ export class ActionSheetStyles extends BaseStyle {
72
75
  this.listItemTitleColor = listItemTitleColor;
73
76
  this.listItemIconBackground = listItemIconBackground;
74
77
  this.listItemIconBorderRadius = listItemIconBorderRadius;
78
+ this.paddingHorizontal = paddingHorizontal;
75
79
  }
76
80
  }
@@ -38,11 +38,12 @@ const OptionListView = ({
38
38
  paddingHorizontal: 10,
39
39
  borderRadius: cornerRadius || 0,
40
40
  backgroundColor: backgroundColor || theme.palette.getAccent50(),
41
+ justifyContent: !iconUrl ? 'center' : undefined,
41
42
  },
42
43
  ]}
43
44
  onPress={onPress}
44
45
  >
45
- <Image
46
+ {Boolean(iconUrl) && <Image
46
47
  source={iconUrl}
47
48
  style={[
48
49
  Style.listItemImageStyle,
@@ -57,7 +58,7 @@ const OptionListView = ({
57
58
  listItemIconBorderRadius || style?.listItemIconBorderRadius || 0,
58
59
  },
59
60
  ]}
60
- />
61
+ />}
61
62
  <Text
62
63
  style={[
63
64
  {
@@ -145,6 +146,7 @@ interface CometChatActionSheetInterface {
145
146
  hideLayoutMode: boolean;
146
147
  actions: ActionItemInterface[];
147
148
  style: ActionSheetStyles;
149
+ hideHeader?: boolean;
148
150
  }
149
151
  export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
150
152
  const { theme } = useContext<CometChatContextType>(CometChatContext);
@@ -155,6 +157,8 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
155
157
  listItemTitleColor: theme.palette.getAccent(),
156
158
  titleColor: theme.palette.getAccent(),
157
159
  titleFont: theme.typography.name,
160
+ backgroundColor: props.style?.backgroundColor,
161
+ paddingHorizontal: props.style?.paddingHorizontal
158
162
  }),
159
163
  ...props.style,
160
164
  };
@@ -166,7 +170,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
166
170
 
167
171
  const _render = ({ item }) => {
168
172
  return (
169
- <OptionListView key={item.id} {...item} iconUrl={item.icon || item.iconUrl} theme={theme} style={style} />
173
+ <OptionListView key={item.id} {...item} iconUrl={item.icon || item.iconUrl} theme={theme} backgroundColor={style.listItemBackground} style={style} />
170
174
  );
171
175
  };
172
176
  const _renderGrid = ({ item }) => (
@@ -188,7 +192,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
188
192
  style={{
189
193
  height: 1,
190
194
  backgroundColor:
191
- props.style?.actionSheetSeparatorTint ||
195
+ props.style?.actionSheetSeparatorTint || props.style?.optionsSeparatorTint ||
192
196
  theme.palette.getAccent200(),
193
197
  }}
194
198
  />
@@ -238,12 +242,12 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
238
242
  width: style?.width,
239
243
  backgroundColor: style?.backgroundColor || 'transparent',
240
244
  borderRadius: style?.borderRadius,
241
- paddingHorizontal: 10,
245
+ paddingHorizontal: style?.paddingHorizontal ?? 10,
242
246
  },
243
247
  style?.border,
244
248
  ]}
245
249
  >
246
- <View style={Style.headerStyle}>
250
+ {!props.hideHeader && <View style={Style.headerStyle}>
247
251
  <Text
248
252
  style={[
249
253
  Style.titleStyle,
@@ -259,7 +263,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
259
263
  {props.title}
260
264
  </Text>
261
265
  {getLayoutModeIcon()}
262
- </View>
266
+ </View>}
263
267
  {getList()}
264
268
  </View>
265
269
  );
@@ -7,7 +7,7 @@ import {
7
7
  PanResponder,
8
8
  TouchableOpacity,
9
9
  View,
10
- Modal,
10
+ Modal, ScrollView, KeyboardAvoidingView, Platform
11
11
  } from 'react-native';
12
12
  import { Styles } from './style';
13
13
  import { CometChatContext } from '../../CometChatContext';
@@ -26,9 +26,12 @@ export interface CometChatBottomSheetInterface {
26
26
  shadowColor?: string;
27
27
  backgroundColor?: string;
28
28
  lineColor?: string;
29
+ lineHeight?: number,
30
+ paddingHorizontal?: number,
31
+ borderRadius?: number,
29
32
  };
30
33
  }
31
- const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface,ref) => {
34
+ const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface, ref) => {
32
35
  const { theme } = useContext<CometChatContextType>(CometChatContext);
33
36
  const {
34
37
  sliderMaxHeight,
@@ -98,62 +101,68 @@ const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface,re
98
101
  BackHandler.removeEventListener('hardwareBackPress', _onBackPress);
99
102
  };
100
103
  }, []);
101
-
104
+
102
105
  return (
103
106
  <Modal
104
107
  transparent={true}
105
108
  visible={isOpen}
106
109
  onRequestClose={() => togglePanel()}
107
110
  >
108
- <View style={Styles.wrapperStyle}>
109
- <View
110
- style={Styles.greyWrapperStyle}
111
- onStartShouldSetResponder={() => togglePanel()}
112
- />
113
- <Animated.View
114
- onLayout={_setSize}
115
- {..._parentPanResponder?.panHandlers}
116
- style={{
117
- ...Styles.containerStyle,
118
- backgroundColor:
119
- style?.backgroundColor ?? theme.palette.getBackgroundColor(),
120
- shadowColor: style?.shadowColor ?? theme.palette.getAccent(),
121
- maxHeight: sliderMaxHeight,
122
- transform: [
123
- { translateY: panelHeightValue },
124
- { scale: isOpen ? 1 : 0 },
125
- ],
126
- }}
127
- >
111
+ <KeyboardAvoidingView style={{ flex: 1 }} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
112
+ >
113
+ <ScrollView contentContainerStyle={Styles.wrapperStyle}>
128
114
  <View
129
- style={Styles.outerContentStyle}
130
- {..._childPanResponder?.panHandlers}
115
+ style={Styles.greyWrapperStyle}
116
+ onStartShouldSetResponder={() => togglePanel()}
117
+ />
118
+ <Animated.View
119
+ onLayout={_setSize}
120
+ {..._parentPanResponder?.panHandlers}
121
+ style={{
122
+ ...Styles.containerStyle,
123
+ backgroundColor:
124
+ style?.backgroundColor ?? theme.palette.getBackgroundColor(),
125
+ shadowColor: style?.shadowColor ?? theme.palette.getAccent(),
126
+ maxHeight: sliderMaxHeight,
127
+ transform: [
128
+ { translateY: panelHeightValue },
129
+ { scale: isOpen ? 1 : 0 },
130
+ ],
131
+ paddingHorizontal: style?.paddingHorizontal || 5,
132
+ borderTopLeftRadius: style?.borderRadius || 30,
133
+ borderTopRightRadius: style?.borderRadius || 30,
134
+ }}
131
135
  >
132
- <TouchableOpacity
133
- onPress={togglePanel.bind(this)}
134
- activeOpacity={1}
135
- style={{ height: 30 }}
136
+ <View
137
+ style={Styles.outerContentStyle}
138
+ {..._childPanResponder?.panHandlers}
136
139
  >
137
- <View style={Styles.lineContainerStyle}>
138
- <View
139
- style={[
140
- Styles.lineStyle,
141
- {
142
- backgroundColor:
143
- style?.lineColor ?? theme.palette.getAccent200(),
144
- },
145
- ]}
146
- />
140
+ <TouchableOpacity
141
+ onPress={togglePanel.bind(this)}
142
+ activeOpacity={1}
143
+ style={{ height: style.lineHeight || 30 }}
144
+ >
145
+ <View style={Styles.lineContainerStyle}>
146
+ <View
147
+ style={[
148
+ Styles.lineStyle,
149
+ {
150
+ backgroundColor:
151
+ style?.lineColor ?? theme.palette.getAccent200(),
152
+ },
153
+ ]}
154
+ />
155
+ </View>
156
+ </TouchableOpacity>
157
+ <View style={Styles.innerContentStyle}>
158
+ {typeof children === 'function'
159
+ ? children(_handleScrollEndDrag)
160
+ : children}
147
161
  </View>
148
- </TouchableOpacity>
149
- <View style={Styles.innerContentStyle}>
150
- {typeof children === 'function'
151
- ? children(_handleScrollEndDrag)
152
- : children}
153
162
  </View>
154
- </View>
155
- </Animated.View>
156
- </View>
163
+ </Animated.View>
164
+ </ScrollView>
165
+ </KeyboardAvoidingView>
157
166
  </Modal>
158
167
  );
159
168
  });
@@ -22,8 +22,6 @@ export const Styles = StyleSheet.create({
22
22
  shadowRadius: 7.49,
23
23
  elevation: 12,
24
24
  paddingHorizontal: 5,
25
- borderTopLeftRadius: 30,
26
- borderTopRightRadius: 30,
27
25
  position: 'absolute',
28
26
  bottom: 0,
29
27
  right: 0,
@@ -65,17 +65,21 @@ export interface CometChatDateInterface {
65
65
  * object of DateStyle class.
66
66
  */
67
67
  style?: DateStyleInterface;
68
+ /**
69
+ *
70
+ */
71
+ dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
68
72
  }
69
73
 
70
74
  export const CometChatDate = (props: CometChatDateInterface) => {
71
75
  const { theme } = useContext<CometChatContextType>(CometChatContext);
72
- const { timeStamp, pattern, customDateString } = props;
76
+ const { timeStamp, pattern, customDateString, dateAlignment } = props;
73
77
 
74
78
  const defaultStyleProps = new DateStyle({
75
79
  textFont: theme.typography.caption1,
76
80
  textColor: theme.palette.getAccent500(),
77
81
  });
78
-
82
+
79
83
  const style = {
80
84
  ...defaultStyleProps,
81
85
  ...props.style,
@@ -171,7 +175,7 @@ export const CometChatDate = (props: CometChatDateInterface) => {
171
175
  ]}
172
176
  >
173
177
  <Text
174
- style={[Style.textStyle, style.textFont, { color: style.textColor }]}
178
+ style={[Style.textStyle, style.textFont, { color: style.textColor, textAlign: dateAlignment }]}
175
179
  >
176
180
  {customDateString ? customDateString : getFormattedDate()}
177
181
  </Text>
@@ -7,6 +7,7 @@ import { DateStyle, DateStyleInterface } from './DateStyle';
7
7
  export class DateConfiguration {
8
8
  pattern?: string;
9
9
  style?: DateConfigurationStyle;
10
+ dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
10
11
  /**
11
12
  * @param {Object} param0
12
13
  * @field pattern - pattern in which time should be displayed. One of ["timeFormat","dayDateFormat","dayDateTimeFormat"]
@@ -15,9 +16,11 @@ export class DateConfiguration {
15
16
  constructor({
16
17
  style = new DateStyle({}),
17
18
  pattern = 'timeFormat',
19
+ dateAlignment,
18
20
  }: DateConfigurationInterface) {
19
21
  this.pattern = pattern;
20
22
  this.style = style;
23
+ this.dateAlignment = dateAlignment;
21
24
  }
22
25
  }
23
26
 
@@ -25,4 +28,5 @@ type DateConfigurationStyle = DateStyleInterface;
25
28
  export interface DateConfigurationInterface {
26
29
  pattern?: string;
27
30
  style?: DateConfigurationStyle;
31
+ dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
28
32
  }
@@ -3,6 +3,6 @@ import { StyleSheet } from 'react-native';
3
3
 
4
4
  export const Style = StyleSheet.create({
5
5
  textStyle: {
6
- textAlign: 'center',
6
+ textAlign: 'auto',
7
7
  },
8
8
  });
@@ -39,6 +39,7 @@ export interface CometChatListItemInterface {
39
39
  options?: () => CometChatOptions[];
40
40
  TailView?: React.FC;
41
41
  hideSeparator?: boolean;
42
+ separatorColor?: string;
42
43
  listItemStyle?: ListItemStyle;
43
44
  onPress?: Function;
44
45
  onLongPress?: Function;
@@ -64,6 +65,7 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
64
65
  options,
65
66
  TailView,
66
67
  hideSeparator,
68
+ separatorColor,
67
69
  headViewContainerStyle,
68
70
  tailViewContainerStyle,
69
71
  bodyViewContainerStyle,
@@ -221,7 +223,7 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
221
223
  typeof item.icon === 'string' ? { uri: item.icon } : item.icon
222
224
  }
223
225
  />
224
- {item.title && item.title.length && (
226
+ {Boolean(item.title) && item.title.length > 0 && (
225
227
  <Text
226
228
  style={[
227
229
  Style.optionTitleStyle,
@@ -236,14 +238,26 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
236
238
  );
237
239
  };
238
240
 
241
+ let ListComponent = ((onPress && typeof onPress == 'function') || (onLongPress && typeof onLongPress == 'function')) ? TouchableOpacity : View;
242
+ let listComponentProps = ((onPress && typeof onPress == 'function') || (onLongPress && typeof onLongPress == 'function')) ? {
243
+ activeOpacity: 1,
244
+ onPress: clickHandler,
245
+ onLongPress: longPressHandler
246
+ } : {};
247
+
248
+ let WrapperComponent = swipeRowOptions.length ? SwipeRow : React.Fragment;
249
+ let wrapperComponentProps = swipeRowOptions.length ? {
250
+ key: id,
251
+ onRowDidOpen: rowOpened,
252
+ onRowDidClose: rowClosed,
253
+ disableRightSwipe: true,
254
+ disableLeftSwipe: !swipeRowOptions.length,
255
+ rightOpenValue: 0 - translate
256
+ } : {};
257
+
239
258
  return (
240
- <SwipeRow
241
- key={id}
242
- onRowDidOpen={rowOpened}
243
- onRowDidClose={rowClosed}
244
- disableRightSwipe={true}
245
- disableLeftSwipe={!swipeRowOptions.length}
246
- rightOpenValue={0 - translate}
259
+ <WrapperComponent
260
+ {...wrapperComponentProps}
247
261
  >
248
262
  <View
249
263
  style={[
@@ -264,10 +278,8 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
264
278
  )}
265
279
  </View>
266
280
  </View>
267
- <TouchableOpacity
268
- activeOpacity={1}
269
- onPress={clickHandler}
270
- onLongPress={longPressHandler}
281
+ <ListComponent
282
+ {...listComponentProps}
271
283
  style={[
272
284
  Style.container,
273
285
  {
@@ -280,21 +292,21 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
280
292
  },
281
293
  ]}
282
294
  >
283
- {(avatarURL || avatarName) && <AvatarView />}
295
+ {Boolean(avatarURL || avatarName) && <AvatarView />}
284
296
  <View
285
297
  style={[
286
298
  Style.rightContainerStyle,
287
- { borderBottomWidth: hideSeparator ? 0 : 1 },
299
+ { borderBottomWidth: hideSeparator ? 0 : 1, borderBottomColor: separatorColor || undefined },
288
300
  ]}
289
301
  >
290
302
  <View style={[Style.middleViewStyle, bodyViewContainerStyle ?? {}]}>
291
- {title && <TitleView />}
292
- {SubtitleView && <SubtitleView />}
303
+ {Boolean(title) && <TitleView />}
304
+ {Boolean(SubtitleView) && <SubtitleView />}
293
305
  </View>
294
- {TailView && <TailViewFc />}
306
+ {Boolean(TailView) && <TailViewFc />}
295
307
  </View>
296
- </TouchableOpacity>
297
- </SwipeRow>
308
+ </ListComponent>
309
+ </WrapperComponent>
298
310
  );
299
311
  };
300
312
 
@@ -122,13 +122,12 @@ export const CometChatMessageInput = (
122
122
  } = props;
123
123
 
124
124
  return (
125
- <View style={{ backgroundColor: 'transparent' }}>
125
+ <View style={{ backgroundColor: style.inputBackground ?? theme.palette.getAccent100(), marginHorizontal: 8, borderRadius: 8 }}>
126
126
  <TextInput
127
127
  ref={messageInputRef}
128
128
  style={[
129
129
  styles.textInput,
130
130
  {
131
- backgroundColor: style.inputBackground ?? 'transparent',
132
131
  color: style.textColor ?? theme.palette.getAccent(),
133
132
  maxHeight: maxHeight ?? 25 * 3,
134
133
  },