@cometchat/chat-uikit-react-native 4.0.2 → 4.1.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.
Files changed (169) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -3
  3. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +164 -0
  4. package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +22 -0
  5. package/src/AI/AIAssistBot/AIAssistBotStyle.ts +43 -0
  6. package/src/AI/AIAssistBot/AIAssistBotView.tsx +294 -0
  7. package/src/AI/AIAssistBot/configuration.ts +22 -0
  8. package/src/AI/AIAssistBot/resources/index.ts +5 -0
  9. package/src/AI/{configuration.ts → AIBaseConfiguration.ts} +3 -6
  10. package/src/AI/AIBaseStyle.ts +58 -0
  11. package/src/AI/AIConversationStarter/AIConversationStarter.ts +5 -19
  12. package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +144 -130
  13. package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +11 -6
  14. package/src/AI/AIConversationStarter/configuration.ts +10 -17
  15. package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +175 -0
  16. package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +21 -0
  17. package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +20 -0
  18. package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +190 -0
  19. package/src/AI/AIConversationSummary/configuration.ts +14 -0
  20. package/src/AI/AIConversationSummary/resources/close.png +0 -0
  21. package/src/AI/AIConversationSummary/resources/index.ts +5 -0
  22. package/src/AI/AIExtensionDataSource.ts +17 -12
  23. package/src/AI/AIOptionsStyle.ts +14 -0
  24. package/src/AI/AISmartReplies/AISmartReplies.ts +6 -15
  25. package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +302 -0
  26. package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +1 -1
  27. package/src/AI/AISmartReplies/configuration.ts +4 -11
  28. package/src/AI/resources/index.ts +0 -2
  29. package/src/AI/utils.ts +3 -3
  30. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +118 -5
  31. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +3 -0
  32. package/src/CometChatMessageComposer/resources/index.ts +2 -0
  33. package/src/CometChatMessageComposer/styles.ts +1 -4
  34. package/src/CometChatMessageList/CometChatMessageList.tsx +33 -24
  35. package/src/CometChatMessages/CometChatMessages.tsx +4 -13
  36. package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
  37. package/src/calls/CallUtils.ts +106 -45
  38. package/src/calls/CallingDetailsUtils.tsx +133 -15
  39. package/src/calls/CallingPackage.ts +16 -2
  40. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +9 -10
  41. package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +116 -0
  42. package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +36 -0
  43. package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +308 -0
  44. package/src/calls/CometChatCallLogDetails/index.ts +12 -0
  45. package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
  46. package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/style.ts +1 -0
  47. package/src/calls/{CometChatCallHistory/CallHistoryConfiguration.ts → CometChatCallLogHistory/CallLogHistoryConfiguration.ts} +15 -27
  48. package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +46 -0
  49. package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +337 -0
  50. package/src/calls/CometChatCallLogHistory/index.ts +12 -0
  51. package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
  52. package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
  53. package/src/calls/CometChatCallLogHistory/resources/index.ts +29 -0
  54. package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
  55. package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
  56. package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
  57. package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
  58. package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/style.ts +2 -1
  59. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +61 -0
  60. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +59 -0
  61. package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +220 -0
  62. package/src/calls/CometChatCallLogParticipants/index.ts +12 -0
  63. package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
  64. package/src/calls/CometChatCallLogParticipants/resources/index.ts +4 -0
  65. package/src/calls/CometChatCallLogParticipants/style.ts +24 -0
  66. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +63 -0
  67. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +63 -0
  68. package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +253 -0
  69. package/src/calls/CometChatCallLogRecordings/index.ts +12 -0
  70. package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
  71. package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
  72. package/src/calls/CometChatCallLogRecordings/resources/index.ts +6 -0
  73. package/src/calls/CometChatCallLogRecordings/style.ts +24 -0
  74. package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +87 -0
  75. package/src/calls/CometChatCallLogs/CallLogsStyle.ts +95 -0
  76. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +482 -0
  77. package/src/calls/CometChatCallLogs/index.ts +12 -0
  78. package/src/calls/CometChatCallLogs/resources/Back.png +0 -0
  79. package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
  80. package/src/calls/CometChatCallLogs/resources/Selection.png +0 -0
  81. package/src/calls/CometChatCallLogs/resources/Spinner.png +0 -0
  82. package/src/calls/CometChatCallLogs/resources/check.png +0 -0
  83. package/src/calls/CometChatCallLogs/resources/incomingcall.png +0 -0
  84. package/src/calls/CometChatCallLogs/resources/incomingvideo.png +0 -0
  85. package/src/calls/CometChatCallLogs/resources/index.ts +25 -0
  86. package/src/calls/CometChatCallLogs/resources/missedcall.png +0 -0
  87. package/src/calls/CometChatCallLogs/resources/missedvideo.png +0 -0
  88. package/src/calls/CometChatCallLogs/resources/outgoingcall.png +0 -0
  89. package/src/calls/CometChatCallLogs/resources/outgoingvideo.png +0 -0
  90. package/src/calls/CometChatCallLogs/style.ts +24 -0
  91. package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +9 -0
  92. package/src/calls/{CometChatCallHistoryWithDetails/CometChatCallHistoryWithDetails.tsx → CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx} +17 -16
  93. package/src/calls/CometChatCallLogsWithDetails/index.ts +7 -0
  94. package/src/calls/index.ts +40 -1
  95. package/src/calls/resources/index.ts +3 -1
  96. package/src/calls/resources/nextarrow.png +0 -0
  97. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +3 -5
  98. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +1 -1
  99. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -3
  100. package/src/extensions/ThumbnailGeneration/resources/empty.png +0 -0
  101. package/src/extensions/ThumbnailGeneration/resources/index.ts +5 -0
  102. package/src/index.ts +79 -4
  103. package/src/shared/CometChatUiKit/CometChatUIKit.ts +154 -130
  104. package/src/shared/CometChatUiKit/UIKitSettings.ts +2 -2
  105. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +1 -1
  106. package/src/shared/framework/DataSource.ts +4 -0
  107. package/src/shared/framework/DataSourceDecorator.tsx +5 -0
  108. package/src/shared/framework/MessageDataSource.tsx +4 -1
  109. package/src/shared/index.ts +4 -0
  110. package/src/shared/modals/CometChatCallLogDetailsOptions.ts +23 -0
  111. package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +16 -0
  112. package/src/shared/modals/index.ts +5 -1
  113. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +19 -5
  114. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +19 -5
  115. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +21 -7
  116. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +19 -5
  117. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +19 -5
  118. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +19 -5
  119. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +19 -5
  120. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +19 -5
  121. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +19 -5
  122. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +19 -5
  123. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +19 -5
  124. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +19 -4
  125. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +19 -5
  126. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  127. package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +1 -1
  128. package/src/shared/views/CometChatAICard/CometChatAICard.tsx +71 -0
  129. package/src/shared/views/CometChatAICard/resources/errormessage.png +0 -0
  130. package/src/shared/views/CometChatAICard/resources/index.ts +4 -0
  131. package/src/shared/views/CometChatAICard/resources/nomessage.png +0 -0
  132. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +4 -0
  133. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +11 -7
  134. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +56 -47
  135. package/src/shared/views/CometChatBottomSheet/style.ts +0 -2
  136. package/src/shared/views/CometChatDate/CometChatDate.tsx +7 -3
  137. package/src/shared/views/CometChatDate/DateConfiguration.ts +4 -0
  138. package/src/shared/views/CometChatDate/style.ts +1 -1
  139. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +31 -19
  140. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -2
  141. package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -0
  142. package/src/shared/views/CometChatPanel/PanelStyle.tsx +43 -0
  143. package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
  144. package/src/shared/views/CometChatPanel/resources/index.ts +5 -0
  145. package/src/AI/AIEnabler.ts +0 -115
  146. package/src/AI/AIEnablerDecorator.tsx +0 -324
  147. package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +0 -18
  148. package/src/calls/CometChatCallDetails/CallDetailsConfiguration.ts +0 -68
  149. package/src/calls/CometChatCallDetails/CallDetailsStyle.ts +0 -52
  150. package/src/calls/CometChatCallDetails/CometChatCallDetails.tsx +0 -268
  151. package/src/calls/CometChatCallDetails/index.ts +0 -9
  152. package/src/calls/CometChatCallHistory/CallHistoryStyle.ts +0 -34
  153. package/src/calls/CometChatCallHistory/CometChatCallHistory.tsx +0 -422
  154. package/src/calls/CometChatCallHistory/index.ts +0 -9
  155. package/src/calls/CometChatCallHistory/resources/index.ts +0 -17
  156. package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsConfiguration.ts +0 -7
  157. package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsStyle.ts +0 -3
  158. package/src/calls/CometChatCallHistoryWithDetails/index.ts +0 -8
  159. /package/src/{calls/CometChatCallDetails → AI/AIAssistBot}/resources/CloseIcon.png +0 -0
  160. /package/src/{AI → CometChatMessageComposer}/resources/ai.png +0 -0
  161. /package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/resources/index.ts +0 -0
  162. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Back.png +0 -0
  163. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Call.png +0 -0
  164. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Info.png +0 -0
  165. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Selection.png +0 -0
  166. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Spineer.png +0 -0
  167. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Video.png +0 -0
  168. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/check.png +0 -0
  169. /package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts +0 -0
@@ -0,0 +1,308 @@
1
+ import React, { useEffect, useRef, useState } from 'react'
2
+ import { View, TouchableOpacity, Image, Text, SectionList } from 'react-native'
3
+ import { CometChat } from '@cometchat/chat-sdk-react-native'
4
+ import { AvatarStyle, AvatarStyleInterface, CometChatAvatar, CometChatContext, CometChatDetailsTemplate, ImageType, localize } from '../../shared'
5
+ import { Style } from './style'
6
+ import { CloseIcon } from './resources'
7
+ import { useContext } from 'react'
8
+ import { CallLogDetailsStyle, CallLogDetailsStyleInterface } from './CallLogDetailsStyle'
9
+ import { CallingDetailsUtils } from '../CallingDetailsUtils'
10
+ import { CometChatParticipants } from '../CometChatCallLogParticipants/CometChatCallLogParticipants'
11
+ import { CometChatRecordings } from '../CometChatCallLogRecordings/CometChatCallLogRecordings'
12
+ import { CallLogHistoryConfiguration, CometChatCallLogHistory } from '../CometChatCallLogHistory'
13
+ import { CallLogParticipantsConfiguration } from '../CometChatCallLogParticipants'
14
+ import { CallLogRecordingsConfiguration } from '../CometChatCallLogRecordings/CallLogRecordingsConfiguration'
15
+
16
+ const listenerId = "userListener_" + new Date().getTime();
17
+ const SCREEN = {
18
+ DETAILS: "details",
19
+ PARTICIPANTS: "participants",
20
+ RECORDINGS: "recordings",
21
+ HISTORY: "history",
22
+ }
23
+ export interface CometChatCallLogDetailsConfigurationInterface {
24
+ /**
25
+ * Pass CometChatCalls.CallUser || CometChatCalls.CallGroup object. This parameter is required
26
+ */
27
+ call: any,
28
+ /**
29
+ * title sets the string in top navigation bar.
30
+ */
31
+ title?: string,
32
+ /**
33
+ * toggle visibility of close button
34
+ */
35
+ showCloseButton?: boolean,
36
+ /**
37
+ * This will change the close button icon
38
+ */
39
+ closeButtonIconImage?: ImageType,
40
+ /**
41
+ * toggle the profile view
42
+ */
43
+ hideProfile?: boolean,
44
+ /**
45
+ * Pass the custom profile view here.
46
+ */
47
+ CustomProfileView?: (props: { user?: CometChat.User }) => JSX.Element,
48
+ /**
49
+ * List of templates tobe shown
50
+ */
51
+ data?: (props: { message: CometChat.BaseMessage, user?: CometChat.User, group?: CometChat.Group }) => CometChatDetailsTemplate[],
52
+ /**
53
+ * call back for error
54
+ */
55
+ onError?: (e: CometChat.CometChatException) => void,
56
+ /**
57
+ * custom functionality on back press
58
+ */
59
+ onBack?: () => void,
60
+ /**
61
+ * Style object for Avatar
62
+ */
63
+ avatarStyle?: AvatarStyleInterface,
64
+ /**
65
+ * Style object for CallLogDetails
66
+ */
67
+ callLogDetailsStyle?: CallLogDetailsStyleInterface,
68
+ /**
69
+ * Configuration for call history.
70
+ */
71
+ callLogHistoryConfiguration?: CallLogHistoryConfiguration;
72
+ /**
73
+ * Configuration for call log participants.
74
+ */
75
+ callLogParticipantsConfiguration?: CallLogParticipantsConfiguration;
76
+ /**
77
+ * Configuration for call log recordings.
78
+ */
79
+ callLogRecordingsConfiguration?: CallLogRecordingsConfiguration;
80
+ }
81
+
82
+ export const CometChatCallLogDetails = (props: CometChatCallLogDetailsConfigurationInterface) => {
83
+
84
+ const {
85
+ onBack,
86
+ onError,
87
+ CustomProfileView,
88
+ data,
89
+ hideProfile,
90
+ call,
91
+ closeButtonIconImage,
92
+ showCloseButton = true,
93
+ title = localize("CALL_DETAILS"),
94
+ avatarStyle,
95
+ callLogDetailsStyle,
96
+ callLogHistoryConfiguration,
97
+ callLogParticipantsConfiguration,
98
+ callLogRecordingsConfiguration
99
+ } = props;
100
+
101
+ const { theme } = useContext(CometChatContext);
102
+ const [tempates, setTemplates] = useState([]);
103
+ const [group, setGroup] = useState(undefined);
104
+ const [user, setUser] = useState(undefined);
105
+ const [error, setError] = useState(undefined);
106
+ const [screen, setScreen] = useState(SCREEN.DETAILS);
107
+ const [participantsData, setParticipantsData] = useState([]);
108
+ const [recordingsData, setRecordingsData] = useState([]);
109
+ const [callData, setCallData] = useState(call);
110
+ const loggedInUser = useRef(null);
111
+
112
+ const _avatarStyle = new AvatarStyle({
113
+ nameTextColor: theme.palette.getAccent(),
114
+ backgroundColor: theme.palette.getBackgroundColor(),
115
+ nameTextFont: theme.typography.heading,
116
+ height: 100,
117
+ width: 100,
118
+ borderRadius: 50,
119
+ ...avatarStyle
120
+ });
121
+
122
+ const _callLogDetailsStyle = new CallLogDetailsStyle({
123
+ titleColor: theme.palette.getAccent(),
124
+ titleFont: theme.typography.heading,
125
+ closeIconTint: theme.palette.getPrimary(),
126
+ backgroundColor: theme.palette.getBackgroundColor(),
127
+ ...callLogDetailsStyle
128
+ });
129
+
130
+ useEffect(() => {
131
+ CometChat.getLoggedinUser().then(
132
+ (loggedUser: CometChat.User) => {
133
+ let tmpList: CometChatDetailsTemplate[];
134
+ loggedInUser.current = loggedUser;
135
+ console.log({ callData })
136
+ let user = callData?.getReceiverType() == "user" ? loggedInUser.current?.getUid() === callData?.getInitiator()?.getUid() ? callData.getReceiver() : callData?.getInitiator() : undefined
137
+ let group = callData?.getReceiverType() == "group" ? loggedInUser.current?.getUid() === callData?.getInitiator()?.getUid() ? callData.getReceiver() : callData?.getInitiator() : undefined
138
+ console.log({ user })
139
+ if (data) {
140
+ tmpList = data({ message: callData, user, group });
141
+ } else {
142
+ let detailsTemplate = CallingDetailsUtils.getDefaultDetailsTemplates(callData, loggedInUser.current, theme);
143
+ detailsTemplate.push(CallingDetailsUtils.getSecondaryDetailsTemplate(callData, loggedInUser.current, theme));
144
+ tmpList = [...detailsTemplate];
145
+ }
146
+ setTemplates(tmpList.map(item => {
147
+ item['data'] = item.options;
148
+ return item;
149
+ }))
150
+ setUser(user);
151
+ setGroup(group);
152
+ },
153
+ (error: CometChat.CometChatException) => {
154
+ setError(localize("SOMETHING_WRONG"));
155
+ onError && onError(error);
156
+ }
157
+ );
158
+ CometChat.addUserListener(
159
+ listenerId,
160
+ new CometChat.UserListener({
161
+ onUserOnline: (user) => {
162
+ setUser(user);
163
+ },
164
+ onUserOffline: (user) => {
165
+ setUser(user);
166
+ },
167
+ })
168
+ );
169
+ return () => {
170
+ CometChat.removeUserListener(listenerId);
171
+ }
172
+ }, [callData]);
173
+
174
+ const _render = ({ item, onClick }) => {
175
+ function _onPress() {
176
+ if (onClick) {
177
+ onClick(item);
178
+ return;
179
+ } else {
180
+ if (item.id == SCREEN.PARTICIPANTS) {
181
+ setScreen(SCREEN.PARTICIPANTS);
182
+ setParticipantsData(callData?.getParticipants());
183
+ return;
184
+ } else if (item.id == SCREEN.RECORDINGS) {
185
+ setScreen(SCREEN.RECORDINGS);
186
+ setRecordingsData(callData?.getRecordings());
187
+ return;
188
+ } else if (item.id == SCREEN.HISTORY) {
189
+ setScreen(SCREEN.HISTORY);
190
+ return;
191
+ }
192
+ }
193
+ console.log("onClicked", item)
194
+ }
195
+ const { CustomView } = item;
196
+ if (item.CustomView) {
197
+ return <TouchableOpacity activeOpacity={1} onPress={_onPress}>
198
+ <CustomView />
199
+ </TouchableOpacity>
200
+ }
201
+ return <></>;
202
+ }
203
+
204
+ console.log({user, group})
205
+
206
+ return (
207
+ <View style={{ flex: 1, backgroundColor: _callLogDetailsStyle.backgroundColor }}>
208
+ {screen === SCREEN.DETAILS ? <>
209
+ {
210
+ !hideProfile &&
211
+ <View style={[Style.row, { height: 60, alignItems: "center" }]}>
212
+ {
213
+ CustomProfileView && <CustomProfileView user={user} />
214
+ }
215
+ {
216
+ showCloseButton &&
217
+ <TouchableOpacity onPress={onBack}>
218
+ <Image style={[Style.imageStyle, { tintColor: _callLogDetailsStyle.closeIconTint }]} source={closeButtonIconImage || CloseIcon} />
219
+ </TouchableOpacity>
220
+ }
221
+ <Text style={[theme.typography.heading, Style.heading, { color: theme.palette.getAccent() }]}>{title}</Text>
222
+ </View>
223
+ }
224
+ {
225
+ (error &&
226
+ <View style={{ justifyContent: "center", alignItems: "center" }}>
227
+ <Text style={{ color: theme.palette.getError() }}>{error}</Text>
228
+ </View>) ||
229
+ <>
230
+ <View style={{ alignItems: "center", justifyContent: "center" }}>
231
+ <CometChatAvatar
232
+ style={_avatarStyle}
233
+ image={user && user['avatar'] ? { uri: user['avatar'] } : group ? { uri: group['icon'] || group['avatar'] } : undefined}
234
+ name={user ? user['name'] : group ? group['name'] : undefined}
235
+ />
236
+ <Text style={[{ marginVertical: 10, color: _callLogDetailsStyle.titleColor }, _callLogDetailsStyle.titleFont]}>{user ? user['name'] : group ? group['name'] : undefined}</Text>
237
+ </View>
238
+ <SectionList
239
+ sections={tempates}
240
+ keyExtractor={(item, index) => item + index}
241
+ renderItem={_render}
242
+ renderSectionHeader={({ section }) => {
243
+ const { title, titleColor, titleFont, titleStyle } = section;
244
+ if (!title)
245
+ return null;
246
+
247
+ return (
248
+ <Text
249
+ style={[
250
+ { color: titleColor ?? theme.palette.getAccent500() },
251
+ titleFont ? titleFont : theme.typography.text2,
252
+ titleStyle ? titleStyle : {},
253
+ ]}
254
+ >
255
+ {title}
256
+ </Text>
257
+ );
258
+ }}
259
+ />
260
+ </>
261
+ }
262
+ </>
263
+ : screen === SCREEN.PARTICIPANTS ?
264
+ <>
265
+ <CometChatParticipants
266
+ call={callData}
267
+ data={participantsData}
268
+ showBackButton={true}
269
+ onBack={() => {
270
+ setScreen(SCREEN.DETAILS);
271
+ setParticipantsData([]);
272
+ }}
273
+ {...callLogParticipantsConfiguration}
274
+ />
275
+ </>
276
+ : screen === SCREEN.RECORDINGS ?
277
+ <>
278
+ <CometChatRecordings
279
+ data={recordingsData}
280
+ showBackButton={true}
281
+ onBack={() => {
282
+ setScreen(SCREEN.DETAILS);
283
+ setRecordingsData([]);
284
+ }}
285
+ {...callLogRecordingsConfiguration}
286
+ />
287
+ </>
288
+ : screen === SCREEN.HISTORY ?
289
+ <>
290
+ <CometChatCallLogHistory
291
+ user={user}
292
+ group={group}
293
+ showBackButton={true}
294
+ onBack={() => {
295
+ setScreen(SCREEN.DETAILS);
296
+ }}
297
+ onItemPress={(item) => {
298
+ console.log("item", item)
299
+ setCallData(item);
300
+ setScreen(SCREEN.DETAILS);
301
+ }}
302
+ {...callLogHistoryConfiguration}
303
+ />
304
+ </>
305
+ : null}
306
+ </View>
307
+ )
308
+ }
@@ -0,0 +1,12 @@
1
+ import { CallLogDetailsConfiguration, CallLogDetailsConfigurationInterface } from "./CallLogDetailsConfiguration";
2
+ import { CallLogDetailsStyle, CallLogDetailsStyleInterface } from "./CallLogDetailsStyle";
3
+ import { CometChatCallLogDetails, CometChatCallLogDetailsConfigurationInterface } from "./CometChatCallLogDetails";
4
+
5
+ export {
6
+ CallLogDetailsConfiguration,
7
+ CallLogDetailsConfigurationInterface,
8
+ CallLogDetailsStyle,
9
+ CallLogDetailsStyleInterface,
10
+ CometChatCallLogDetails,
11
+ CometChatCallLogDetailsConfigurationInterface
12
+ }
@@ -10,5 +10,6 @@ export const Style = StyleSheet.create({
10
10
  imageStyle: {
11
11
  height: 24,
12
12
  width: 24,
13
+ marginHorizontal: 10,
13
14
  }
14
15
  });
@@ -2,72 +2,60 @@ import { StyleProp, ViewStyle } from "react-native/types";
2
2
  import { CometChat } from "@cometchat/chat-sdk-react-native";
3
3
  import { AvatarStyleInterface, CometChatOptions, ImageType, ListItemStyleInterface } from "../../shared";
4
4
  import { StatusIndicatorStyleInterface } from "../../shared/views/CometChatStatusIndicator/StatusIndicatorStyle";
5
- import { CallHistoryStyleInterface } from "./CallHistoryStyle";
6
- import { SelectionMode } from "../../shared/base/Types";
5
+ import { CallLogHistoryStyleInterface } from "./CallLogHistoryStyle";
6
+ import { DatePattern, SelectionMode } from "../../shared/base/Types";
7
7
 
8
- export interface CallHistoryConfigurationInterface {
8
+ export interface CallLogHistoryConfigurationInterface {
9
9
  SubtitleView?: (param: { call?: CometChat.Call }) => JSX.Element,
10
+ TailView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element,
10
11
  ListItemView?: (param: { call?: CometChat.Call }) => JSX.Element,
11
12
  AppBarOptions?: () => JSX.Element,
12
13
  options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[],
13
- messageRequestBuilder?: CometChat.MessagesRequestBuilder,
14
+ callLogHistoryRequestBuilder?: any,
14
15
  hideSeperator?: boolean,
16
+ datePattern?: DatePattern,
17
+ dateSeparatorPattern?: DatePattern,
15
18
  BackButton?: JSX.Element,
16
19
  showBackButton?: boolean,
17
- selectionMode?: SelectionMode,
18
- onSelection?: (items: Array<CometChat.BaseMessage>) => void,
19
20
  EmptyStateView?: () => JSX.Element,
20
- emptyStateText?: string,
21
21
  ErrorStateView?: () => JSX.Element,
22
- errorStateText?: string,
23
22
  loadingIcon?: ImageType,
24
23
  LoadingStateView?: () => JSX.Element,
25
24
  hideError?: boolean,
26
25
  onItemPress?: (item: CometChat.Call) => void,
27
- onItemLongPress?: (item: CometChat.Call) => void,
28
26
  onError?: (e: CometChat.CometChatException) => void,
29
27
  onBack?: () => void,
30
- onInfoIconPress?: (prop: { call: CometChat.Call }) => void,
31
- avatarStyle?: AvatarStyleInterface,
32
- statusIndicatorStyle?: StatusIndicatorStyleInterface,
33
28
  listItemStyle?: ListItemStyleInterface,
34
- callHistoryStyle?: CallHistoryStyleInterface,
35
- headViewContainerStyle?: StyleProp<ViewStyle>,
29
+ CallLogHistoryStyle?: CallLogHistoryStyleInterface,
36
30
  bodyViewContainerStyle?: StyleProp<ViewStyle>,
37
31
  tailViewContainerStyle?: StyleProp<ViewStyle>,
38
32
  }
39
- export class CallHistoryConfiguration implements CallHistoryConfigurationInterface {
33
+ export class CallLogHistoryConfiguration implements CallLogHistoryConfigurationInterface {
40
34
  SubtitleView?: (param: { call?: CometChat.Call }) => JSX.Element
35
+ TailView?: (param: { call?: CometChat.BaseMessage }) => JSX.Element
41
36
  ListItemView?: (param: { call?: CometChat.Call }) => JSX.Element
42
37
  AppBarOptions?: () => JSX.Element
43
38
  options?: (param: { message: CometChat.BaseMessage }) => CometChatOptions[]
44
- messageRequestBuilder?: CometChat.MessagesRequestBuilder
39
+ callLogHistoryRequestBuilder?: any
45
40
  hideSeperator?: boolean
41
+ datePattern?: DatePattern
42
+ dateSeparatorPattern?: DatePattern
46
43
  BackButton?: JSX.Element
47
44
  showBackButton?: boolean
48
- selectionMode?: SelectionMode
49
- onSelection?: (items: Array<CometChat.BaseMessage>) => void
50
45
  EmptyStateView?: () => JSX.Element
51
- emptyStateText?: string
52
46
  ErrorStateView?: () => JSX.Element
53
- errorStateText?: string
54
47
  loadingIcon?: ImageType
55
48
  LoadingStateView?: () => JSX.Element
56
49
  hideError?: boolean
57
50
  onItemPress?: (item: CometChat.Call) => void
58
- onItemLongPress?: (item: CometChat.Call) => void
59
51
  onError?: (e: CometChat.CometChatException) => void
60
52
  onBack?: () => void
61
- onInfoIconPress?: (prop: { call: CometChat.Call }) => void
62
- avatarStyle?: AvatarStyleInterface
63
- statusIndicatorStyle?: StatusIndicatorStyleInterface
64
53
  listItemStyle?: ListItemStyleInterface
65
- callHistoryStyle?: CallHistoryStyleInterface
66
- headViewContainerStyle?: StyleProp<ViewStyle>
54
+ CallLogHistoryStyle?: CallLogHistoryStyleInterface
67
55
  bodyViewContainerStyle?: StyleProp<ViewStyle>
68
56
  tailViewContainerStyle?: StyleProp<ViewStyle>
69
57
 
70
- constructor(props: CallHistoryConfigurationInterface) {
58
+ constructor(props: CallLogHistoryConfigurationInterface) {
71
59
  if (props) {
72
60
  for (const [key, value] of Object.entries(props)) {
73
61
  this[key] = value;
@@ -0,0 +1,46 @@
1
+ import { BaseStyle, BaseStyleInterface, FontStyle, FontStyleInterface } from "../../shared";
2
+
3
+ export interface CallLogHistoryStyleInterface extends BaseStyleInterface {
4
+ titleFont?: FontStyleInterface;
5
+ titleColor?: string;
6
+ loadingTint?: string;
7
+ emptyTextFont?: FontStyleInterface;
8
+ emptyTextColor?: string
9
+ errorTextFont?: FontStyleInterface;
10
+ errorTextColor?: string;
11
+ backIconTint?: string;
12
+ dateTextFont?: FontStyleInterface;
13
+ dateTextColor?: string;
14
+ dateSeparatorTextFont?: FontStyleInterface;
15
+ dateSeparatorTextColor?: string;
16
+ callDurationTextFont?: FontStyleInterface;
17
+ callDurationTextColor?: string;
18
+ callStatusTextFont?: FontStyleInterface;
19
+ callStatusTextColor?: string;
20
+ separatorColor?: string;
21
+ }
22
+
23
+ export class CallLogHistoryStyle extends BaseStyle {
24
+ titleFont?: FontStyleInterface;
25
+ titleColor?: string;
26
+ loadingTint?: string;
27
+ emptyTextFont?: FontStyleInterface;
28
+ emptyTextColor?: string
29
+ errorTextFont?: FontStyleInterface;
30
+ errorTextColor?: string;
31
+ backIconTint?: string;
32
+ dateTextFont?: FontStyleInterface;
33
+ dateTextColor?: string;
34
+ dateSeparatorTextFont?: FontStyleInterface;
35
+ dateSeparatorTextColor?: string;
36
+ callDurationTextFont?: FontStyleInterface;
37
+ callDurationTextColor?: string;
38
+ callStatusTextFont?: FontStyleInterface;
39
+ callStatusTextColor?: string;
40
+ separatorColor?: string;
41
+
42
+ constructor(style: Partial<CallLogHistoryStyle>) {
43
+ super({});
44
+ Object.assign(this, style);
45
+ }
46
+ }