@cometchat/chat-uikit-react-native 4.0.0 → 4.0.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 (198) hide show
  1. package/LICENSE.md +3 -0
  2. package/README.md +1 -1
  3. package/lib/AI/AIConversationStarter/AIConversationStarter.d.ts +12 -0
  4. package/lib/AI/AIConversationStarter/AIConversationStarter.js +31 -0
  5. package/lib/AI/AIConversationStarter/AIConversationStarter.js.map +1 -0
  6. package/lib/AI/AIConversationStarter/AIConversationStarterDecorator.d.ts +25 -0
  7. package/lib/AI/AIConversationStarter/AIConversationStarterDecorator.js +175 -0
  8. package/lib/AI/AIConversationStarter/AIConversationStarterDecorator.js.map +1 -0
  9. package/lib/AI/AIConversationStarter/AIConversationStarterStyle.d.ts +4 -0
  10. package/lib/AI/AIConversationStarter/AIConversationStarterStyle.js +8 -0
  11. package/lib/AI/AIConversationStarter/AIConversationStarterStyle.js.map +1 -0
  12. package/lib/AI/AIConversationStarter/configuration.d.ts +14 -0
  13. package/lib/AI/AIConversationStarter/configuration.js +16 -0
  14. package/lib/AI/AIConversationStarter/configuration.js.map +1 -0
  15. package/lib/AI/AIConversationStarter/style.d.ts +31 -0
  16. package/lib/AI/AIConversationStarter/style.js +62 -0
  17. package/lib/AI/AIConversationStarter/style.js.map +1 -0
  18. package/lib/AI/AIEnabler.d.ts +10 -0
  19. package/lib/AI/AIEnabler.js +102 -0
  20. package/lib/AI/AIEnabler.js.map +1 -0
  21. package/lib/AI/AIEnablerDecorator.d.ts +43 -0
  22. package/lib/AI/AIEnablerDecorator.js +251 -0
  23. package/lib/AI/AIEnablerDecorator.js.map +1 -0
  24. package/lib/AI/AIExtensionDataSource.d.ts +6 -0
  25. package/lib/AI/AIExtensionDataSource.js +10 -0
  26. package/lib/AI/AIExtensionDataSource.js.map +1 -0
  27. package/lib/AI/AISmartReplies/AISmartReplies.d.ts +10 -0
  28. package/lib/AI/AISmartReplies/AISmartReplies.js +23 -0
  29. package/lib/AI/AISmartReplies/AISmartReplies.js.map +1 -0
  30. package/lib/AI/AISmartReplies/AISmartRepliesDecorator.d.ts +7 -0
  31. package/lib/AI/AISmartReplies/AISmartRepliesDecorator.js +12 -0
  32. package/lib/AI/AISmartReplies/AISmartRepliesDecorator.js.map +1 -0
  33. package/lib/AI/AISmartReplies/AISmartRepliesStyle.d.ts +12 -0
  34. package/lib/AI/AISmartReplies/AISmartRepliesStyle.js +15 -0
  35. package/lib/AI/AISmartReplies/AISmartRepliesStyle.js.map +1 -0
  36. package/lib/AI/AISmartReplies/configuration.d.ts +14 -0
  37. package/lib/AI/AISmartReplies/configuration.js +16 -0
  38. package/lib/AI/AISmartReplies/configuration.js.map +1 -0
  39. package/lib/AI/CardView.d.ts +19 -0
  40. package/lib/AI/CardView.js +45 -0
  41. package/lib/AI/CardView.js.map +1 -0
  42. package/lib/AI/CardViewStyle.d.ts +29 -0
  43. package/lib/AI/CardViewStyle.js +36 -0
  44. package/lib/AI/CardViewStyle.js.map +1 -0
  45. package/lib/AI/configuration.d.ts +14 -0
  46. package/lib/AI/configuration.js +16 -0
  47. package/lib/AI/configuration.js.map +1 -0
  48. package/lib/AI/resources/index.d.ts +5 -0
  49. package/lib/AI/resources/index.js +6 -0
  50. package/lib/AI/resources/index.js.map +1 -0
  51. package/lib/AI/style.d.ts +115 -0
  52. package/lib/AI/style.js +139 -0
  53. package/lib/AI/style.js.map +1 -0
  54. package/lib/AI/utils.d.ts +38 -0
  55. package/lib/AI/utils.js +28 -0
  56. package/lib/AI/utils.js.map +1 -0
  57. package/lib/CometChatConversations/ConversationsConfiguration.d.ts +0 -1
  58. package/lib/CometChatDetails/DetailsConfiguration.d.ts +0 -1
  59. package/lib/CometChatGroupMembers/GroupMemberConfiguration.d.ts +0 -1
  60. package/lib/CometChatGroups/GroupsConfiguration.d.ts +0 -1
  61. package/lib/CometChatMessageComposer/CometChatMessageComposer.js +7 -1
  62. package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
  63. package/lib/CometChatMessageHeader/MessageHeaderConfiguration.d.ts +0 -1
  64. package/lib/CometChatMessageList/CometChatMessageList.js +49 -18
  65. package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
  66. package/lib/CometChatMessageList/MessageListConfiguration.d.ts +0 -1
  67. package/lib/CometChatMessages/MessagesConfiguration.d.ts +0 -1
  68. package/lib/CometChatTabs/TabItems.d.ts +0 -1
  69. package/lib/CometChatThreadedMessages/ThreadedMessagesConfiguration.d.ts +0 -1
  70. package/lib/calls/CometChatCallDetails/CallDetailsConfiguration.d.ts +0 -1
  71. package/lib/calls/CometChatCallHistory/CallHistoryConfiguration.d.ts +0 -1
  72. package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js +3 -3
  73. package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js.map +1 -1
  74. package/lib/extensions/ImageModeration/ImageModerationDecorator.d.ts +0 -1
  75. package/lib/extensions/ImageModeration/ImageModerationFilter.js +4 -4
  76. package/lib/extensions/ImageModeration/ImageModerationFilter.js.map +1 -1
  77. package/lib/extensions/LinkPreview/LinkPreviewExtentionDecorator.d.ts +0 -1
  78. package/lib/extensions/MessageTranslation/MessageTranslationDecorator.d.ts +0 -1
  79. package/lib/extensions/SmartReplies/SmartRepliesDecorator.js +1 -1
  80. package/lib/extensions/SmartReplies/SmartRepliesDecorator.js.map +1 -1
  81. package/lib/extensions/Stickers/StickersExtensionDecorator.d.ts +1 -1
  82. package/lib/extensions/Stickers/StickersExtensionDecorator.js +4 -2
  83. package/lib/extensions/Stickers/StickersExtensionDecorator.js.map +1 -1
  84. package/lib/extensions/TextModeration/TextModerationExtensionDecorator.d.ts +0 -1
  85. package/lib/index.d.ts +13 -0
  86. package/lib/index.js +14 -0
  87. package/lib/index.js.map +1 -1
  88. package/lib/shared/CometChatUiKit/CometChatUIKit.d.ts +2 -0
  89. package/lib/shared/CometChatUiKit/CometChatUIKit.js +13 -2
  90. package/lib/shared/CometChatUiKit/CometChatUIKit.js.map +1 -1
  91. package/lib/shared/CometChatUiKit/UIKitSettings.d.ts +5 -1
  92. package/lib/shared/CometChatUiKit/UIKitSettings.js +3 -1
  93. package/lib/shared/CometChatUiKit/UIKitSettings.js.map +1 -1
  94. package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js +2 -0
  95. package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js.map +1 -1
  96. package/lib/shared/events/CometChatUIEventHandler/Listener.d.ts +3 -1
  97. package/lib/shared/events/CometChatUIEventHandler/Listener.js +4 -1
  98. package/lib/shared/events/CometChatUIEventHandler/Listener.js.map +1 -1
  99. package/lib/shared/events/CometChatUIEvents.d.ts +2 -1
  100. package/lib/shared/events/CometChatUIEvents.js +1 -0
  101. package/lib/shared/events/CometChatUIEvents.js.map +1 -1
  102. package/lib/shared/framework/DataSource.d.ts +1 -2
  103. package/lib/shared/framework/DataSourceDecorator.d.ts +1 -2
  104. package/lib/shared/framework/DataSourceDecorator.js +2 -2
  105. package/lib/shared/framework/DataSourceDecorator.js.map +1 -1
  106. package/lib/shared/framework/MessageDataSource.d.ts +1 -1
  107. package/lib/shared/framework/MessageDataSource.js +2 -2
  108. package/lib/shared/framework/MessageDataSource.js.map +1 -1
  109. package/lib/shared/helper/types/index.d.ts +0 -1
  110. package/lib/shared/modals/CometChatDetailsOption.d.ts +0 -1
  111. package/lib/shared/modals/CometChatMessageOption.d.ts +0 -1
  112. package/lib/shared/modals/CometChatMessageTemplate.d.ts +0 -1
  113. package/lib/shared/resources/CometChatLocalize/CometChatLocalize.d.ts +230 -153
  114. package/lib/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -0
  115. package/lib/shared/resources/CometChatLocalize/resources/de/translation.json +4 -0
  116. package/lib/shared/resources/CometChatLocalize/resources/en/translation.json +4 -0
  117. package/lib/shared/resources/CometChatLocalize/resources/es/translation.json +4 -0
  118. package/lib/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -0
  119. package/lib/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -0
  120. package/lib/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -0
  121. package/lib/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -0
  122. package/lib/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -0
  123. package/lib/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -0
  124. package/lib/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -0
  125. package/lib/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -0
  126. package/lib/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -0
  127. package/package.json +3 -3
  128. package/src/AI/AIConversationStarter/AIConversationStarter.ts +33 -0
  129. package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +232 -0
  130. package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +8 -0
  131. package/src/AI/AIConversationStarter/configuration.ts +18 -0
  132. package/src/AI/AIConversationStarter/style.ts +76 -0
  133. package/src/AI/AIEnabler.ts +115 -0
  134. package/src/AI/AIEnablerDecorator.tsx +324 -0
  135. package/src/AI/AIExtensionDataSource.ts +12 -0
  136. package/src/AI/AISmartReplies/AISmartReplies.ts +28 -0
  137. package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +18 -0
  138. package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +16 -0
  139. package/src/AI/AISmartReplies/configuration.ts +17 -0
  140. package/src/AI/CardView.tsx +81 -0
  141. package/src/AI/CardViewStyle.ts +37 -0
  142. package/src/AI/configuration.ts +17 -0
  143. package/src/AI/resources/ai-empty.png +0 -0
  144. package/src/AI/resources/ai-error.png +0 -0
  145. package/src/AI/resources/ai.png +0 -0
  146. package/src/AI/resources/index.ts +11 -0
  147. package/src/AI/resources/spineer.png +0 -0
  148. package/src/AI/style.ts +177 -0
  149. package/src/AI/utils.ts +39 -0
  150. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +13 -4
  151. package/src/CometChatMessageList/CometChatMessageList.tsx +24 -17
  152. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +1 -1
  153. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +4 -2
  154. package/src/index.ts +15 -0
  155. package/src/shared/CometChatUiKit/CometChatUIKit.ts +20 -7
  156. package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -0
  157. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +2 -0
  158. package/src/shared/events/CometChatUIEventHandler/Listener.ts +5 -1
  159. package/src/shared/events/CometChatUIEvents.ts +1 -0
  160. package/src/shared/framework/DataSource.ts +1 -1
  161. package/src/shared/framework/DataSourceDecorator.tsx +2 -2
  162. package/src/shared/framework/MessageDataSource.tsx +2 -2
  163. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -0
  164. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +4 -0
  165. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +4 -0
  166. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +4 -0
  167. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -0
  168. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -0
  169. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -0
  170. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -0
  171. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -0
  172. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -0
  173. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -0
  174. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -0
  175. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -0
  176. package/LICENSE +0 -21
  177. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  178. package/android/.gradle/7.4/checksums/md5-checksums.bin +0 -0
  179. package/android/.gradle/7.4/checksums/sha1-checksums.bin +0 -0
  180. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  181. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  182. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  183. package/android/.gradle/7.4/gc.properties +0 -0
  184. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  185. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  186. package/android/.gradle/vcs-1/gc.properties +0 -0
  187. package/android/.idea/.gitignore +0 -3
  188. package/android/.idea/gradle.xml +0 -13
  189. package/android/.idea/misc.xml +0 -9
  190. package/android/.idea/vcs.xml +0 -6
  191. package/android/local.properties +0 -8
  192. package/src/.DS_Store +0 -0
  193. package/src/CometChatMessageInformation/.DS_Store +0 -0
  194. package/src/calls/CometChatCallHistory/.DS_Store +0 -0
  195. package/src/shared/framework/.DS_Store +0 -0
  196. package/src/shared/views/.DS_Store +0 -0
  197. package/src/shared/views/CometChatAudioBubble/.DS_Store +0 -0
  198. package/src/shared/views/CometChatFileBubble/.DS_Store +0 -0
@@ -0,0 +1,11 @@
1
+ import AIBotIcon from "./ai.png";
2
+ import loadingIcon from './spineer.png'
3
+ import errorIcon from './ai-error.png'
4
+ import emptyIcon from './ai-empty.png'
5
+
6
+ export {
7
+ AIBotIcon,
8
+ loadingIcon,
9
+ errorIcon,
10
+ emptyIcon
11
+ }
Binary file
@@ -0,0 +1,177 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { BorderStyle, CometChatTheme } from '../shared';
3
+ import { CardStyle, CardViewStyle } from './CardViewStyle';
4
+ import { AIButtonsStyle } from './utils';
5
+ import { AISmartRepliesStyle } from './AISmartReplies/AISmartRepliesStyle';
6
+
7
+ export function viewContainerStyle(style:CardViewStyle) {
8
+ return {
9
+ justifyContent: 'center',
10
+ alignItems: 'center',
11
+ position: 'absolute',
12
+ bottom: 8,
13
+ width: '100%',
14
+ // height: '100%',
15
+ };
16
+ }
17
+
18
+ export function defaultViewStyle(style:CardViewStyle) {
19
+ return {
20
+ justifyContent: 'center',
21
+ alignItems: 'center',
22
+ textAlign: 'center',
23
+ };
24
+ }
25
+
26
+
27
+
28
+ export function errorLabelStyle(style:CardViewStyle, aiStyles?:AISmartRepliesStyle) {
29
+ return {
30
+ ...aiStyles?.errorStateTextFont || style?.errorStateTextFont,
31
+ color: aiStyles?.errorStateTextColor || style?.errorStateTextColor,
32
+ };
33
+ }
34
+
35
+ export function emptyLabelStyle(style:CardViewStyle, aiStyles?:AISmartRepliesStyle) {
36
+ return {
37
+ ...aiStyles?.emptyStateTextFont || style?.emptyStateTextFont,
38
+ color: aiStyles?.emptyStateTextColor || style?.emptyStateTextColor,
39
+ };
40
+ }
41
+
42
+
43
+
44
+ export function tabButtonStyle(style:CardViewStyle) {
45
+ return {
46
+ alignItems: 'center',
47
+ opacity: 1,
48
+ cursor: 'pointer',
49
+ height: style?.height,
50
+ width: style?.width,
51
+ flexDirection: 'row-reverse',
52
+ justifyContent: 'space-between',
53
+ padding: 8,
54
+ ...style?.border,
55
+ borderRadius: style?.borderRadius,
56
+ backgroundColor: style?.backgroundColor,
57
+ };
58
+ }
59
+
60
+ export function getPopoverStyle(style:CardViewStyle) {
61
+ return StyleSheet.create({
62
+ height: style?.height || 'auto',
63
+ // flex: 1,
64
+ width: style?.width || '100%',
65
+ backgroundColor: style.backgroundColor,
66
+ ...style.border,
67
+ borderRadius: style.borderRadius,
68
+ flexDirection: 'column',
69
+ alignItems: 'center',
70
+
71
+ });
72
+ }
73
+ export function getloadingStateStyle(theme, configStyles?:CardViewStyle, AIStyle?:AISmartRepliesStyle){
74
+ let fontFamily = AIStyle?.loadingStateTextFont || configStyles?.loadingStateTextFont || theme?.typography?.title2;
75
+
76
+ return StyleSheet.create({
77
+
78
+ ...fontFamily,
79
+ color: AIStyle?.loadingStateTextColor || configStyles?.loadingStateTextColor || theme?.palette?.getAccent700(),
80
+
81
+ });
82
+ }
83
+ export function getCardViewStyle(theme:CometChatTheme, style:CardViewStyle,AiStyles?:AISmartRepliesStyle) {
84
+ const defaultStyle = StyleSheet.create({
85
+ tintColor: theme?.palette?.getAccent600(),
86
+ emptyStateTextColor: theme?.palette?.getAccent600(),
87
+ errorStateTextColor: theme?.palette?.getAccent600(),
88
+ emptyStateTextFont: theme?.typography?.title2,
89
+ errorStateTextFont: theme?.typography?.title2,
90
+ loadingStateTextColor: theme?.palette?.getAccent600(),
91
+ loadingIconTint: theme?.palette?.getAccent600(),
92
+ loadingStateTextFont: theme?.typography?.title2,
93
+ errorIconTint: theme?.palette?.getAccent(),
94
+ emptyIconTint: theme?.palette?.getAccent600(),
95
+ backgroundColor: theme?.palette?.getBackgroundColor(),
96
+ border: {},
97
+ borderRadius: 8,
98
+ width: "100%",
99
+ buttonTintColor: theme?.palette?.getAccent600(),
100
+
101
+ });
102
+
103
+ return StyleSheet.flatten([defaultStyle,style,AiStyles]);
104
+ }
105
+
106
+ export const containerStyle = StyleSheet.create({
107
+
108
+ overflow: 'hidden',
109
+ width: '100%',
110
+ position: 'relative',
111
+ justifyContent: 'flex-start',
112
+ alignItems: "center",
113
+ flexDirection: 'column',
114
+
115
+ });
116
+
117
+ export const contentContainerStyle = StyleSheet.create({
118
+
119
+ alignItems: 'flex-start',
120
+ width: '100%' ,
121
+ flexDirection: 'column',
122
+ justifyContent: 'center',
123
+ backgroundColor: 'transparent',
124
+ overflow: 'hidden',
125
+ padding: 8,
126
+
127
+ height:'auto',
128
+
129
+ });
130
+
131
+
132
+
133
+ export function getRepliesStyle(theme, configStyles,cardStyle?:CardStyle) {
134
+ let fontFamily = configStyles?.repliesTextFont || cardStyle?.repliesTextFont || theme?.typography?.text3;
135
+ return StyleSheet.create({
136
+
137
+ ...fontFamily,
138
+ color: configStyles?.repliesTextColor || cardStyle?.repliesTextColor || theme?.palette?.getAccent(),
139
+ backgroundColor: 'transparent',
140
+ textAlign: 'left',
141
+
142
+ });
143
+ }
144
+
145
+ export function getRepliesWrapperStyle(theme:CometChatTheme, configStyles:AIButtonsStyle,cardStyle?:CardStyle) {
146
+
147
+ return StyleSheet.create({
148
+
149
+ flexDirection: 'row',
150
+ padding: 8,
151
+ marginVertical: 4,
152
+ backgroundColor: configStyles?.repliesTextBackgroundColor || cardStyle?.repliesTextBackgroundColor || theme?.palette?.getBackgroundColor(),
153
+ ...configStyles?.repliesTextBorder || cardStyle?.repliesTextBorder || {borderBottomWidth:1,borderStyle:"solid",borderBottomColor:theme?.palette.getAccent200()},
154
+
155
+
156
+ borderRadius: configStyles?.repliesTextBorderRadius || cardStyle?.repliesTextBorderRadius || 8,
157
+ boxSizing: 'border-box',
158
+ cursor: 'pointer',
159
+
160
+ });
161
+ }
162
+
163
+ export function getButtonStyles(theme:CometChatTheme, style:AISmartRepliesStyle, cardStyle?:CardStyle) {
164
+ let fontFamily = style?.buttonTextFont || cardStyle?.buttonTextFont || theme?.typography?.text1;
165
+ return StyleSheet.create({
166
+ paddingHorizontal: 8,
167
+ justifyContent:"center",
168
+ alignItems:"flex-start",
169
+ ...style?.buttonBorder || cardStyle?.buttonBorder,
170
+ backgroundColor: style?.buttonBackgroundColor || cardStyle?.buttonBackgroundColor || theme?.palette?.getBackgroundColor(),
171
+ ...fontFamily,
172
+ color: style?.buttonTextColor || cardStyle?.buttonTextColor || theme?.palette?.getAccent(),
173
+ marginBottom: 8,
174
+ height:style?.buttonHeight || cardStyle?.buttonHeight,
175
+ width:style?.buttonWidth || cardStyle?.buttonWidth || "100%"
176
+ });
177
+ }
@@ -0,0 +1,39 @@
1
+ import { BaseStyle, FontStyleInterface, BorderStyleInterface } from "../shared";
2
+ import { Card } from "./CardView";
3
+
4
+ export interface AIConfigurations {
5
+ "smart-replies"?: { enabled: boolean, configuration?: any},
6
+ "conversation-starter"?: { enabled: boolean, configuration?: any}
7
+ }
8
+ export interface ICard {
9
+ smartReply?: Card,
10
+ conversationStarter?: Card
11
+ }
12
+
13
+ export class AIButtonsStyle extends BaseStyle {
14
+ repliesTextFont?:FontStyleInterface;
15
+ repliesTextBorder?:BorderStyleInterface;
16
+ repliesTextBorderRadius?:string;
17
+ repliesTextColor?:string;
18
+ repliesTextBackgroundColor?:string;
19
+ emptyStateTextFont?: FontStyleInterface;
20
+ emptyStateTextColor?: string;
21
+ loadingStateTextFont?: FontStyleInterface;
22
+ loadingStateTextColor?: string;
23
+ loadingIconTint?:string;
24
+ emptyIconTint?:string;
25
+ errorIconTint?:string;
26
+ errorStateTextFont?: FontStyleInterface;
27
+ errorStateTextColor?:string;
28
+ constructor(props: Partial<AIButtonsStyle>) {
29
+ super({...props})
30
+ Object.assign(this, props);
31
+ }
32
+ }
33
+
34
+
35
+ export enum State {
36
+ loading,
37
+ error,
38
+ empty
39
+ }
@@ -511,13 +511,14 @@ export const CometChatMessageComposer = React.forwardRef(
511
511
  ChatConfigurator.dataSource.getAttachmentOptions(user, group, id);
512
512
 
513
513
  const composerIdMap = new Map().set('parentMessageId', parentMessageId);
514
-
515
- const defaultAuxiliaryButtonOptions =
516
- ChatConfigurator.dataSource.getAuxiliaryOptions(
514
+ const defaultAuxiliaryButtonOptions =
515
+ ChatConfigurator.getDataSource().getAuxiliaryOptions(
517
516
  user,
518
517
  group,
519
- composerIdMap
518
+ composerIdMap,
519
+ theme
520
520
  );
521
+
521
522
 
522
523
  const loggedInUser = React.useRef<any>({});
523
524
  const chatWith = React.useRef<any>(null);
@@ -1068,6 +1069,13 @@ export const CometChatMessageComposer = React.forwardRef(
1068
1069
  ccToggleBottomSheet: (item) => {
1069
1070
  setIsVisible(false);
1070
1071
  bottomSheetRef.current?.togglePanel();
1072
+ },
1073
+ ccComposeMessage: (text)=>{
1074
+ setIsVisible(false);
1075
+ bottomSheetRef.current?.togglePanel();
1076
+
1077
+ setInputMessage(text?.text)
1078
+
1071
1079
  }
1072
1080
  })
1073
1081
  return () => {
@@ -1140,6 +1148,7 @@ export const CometChatMessageComposer = React.forwardRef(
1140
1148
  Style.container,
1141
1149
  {
1142
1150
  backgroundColor: theme.palette.getAccent100(),
1151
+ paddingTop: CustomViewHeader ? 0 : 8
1143
1152
  },
1144
1153
  messageComposerStyle,
1145
1154
  ]}
@@ -289,15 +289,20 @@ export const CometChatMessageList = forwardRef<
289
289
  messageRequest.current.fetchPrevious()
290
290
  .then(msgs => {
291
291
  let reversed = msgs.reverse();
292
- if (messagesList.length === 0 && reversed?.length > 0) {
292
+ if (messagesList.length === 0 && msgs?.length > 0) {
293
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0],user:user,group:group,theme:theme,parentMessageId:parentMessageId });
293
294
  if (conversationId.current == null)
294
295
  conversationId.current = reversed[0].getConversationId();
295
- CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0] });
296
+
297
+ }
298
+ else if(messagesList.length === 0 && !props?.parentMessageId){
299
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccActiveChatChanged, { message: reversed[0],user:user,group:group,theme:theme,parentMessageId:parentMessageId });
296
300
 
297
301
  }
302
+
298
303
  for (let index = 0; index < reversed.length; index++) {
299
304
  const message: CometChat.BaseMessage = reversed[index];
300
- if (!disableReceipt && !message.hasOwnProperty("readAt") && loggedInUser.current.getUid() != message['sender']['uid']) {
305
+ if (message && !disableReceipt && !message.hasOwnProperty("readAt") && loggedInUser.current.getUid() != message['sender']['uid']) {
301
306
  CometChat.markAsRead(message);
302
307
  if (index == 0)
303
308
  CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageRead, { message });
@@ -305,10 +310,12 @@ export const CometChatMessageList = forwardRef<
305
310
  break;
306
311
  }
307
312
  setMessagesList([...messagesList, ...reversed]);
313
+
308
314
  if (messagesList.length == 0)
309
315
  setListState("");
310
316
  else
311
317
  setLoadingMessages(false);
318
+
312
319
  })
313
320
  .catch(e => {
314
321
  if (messagesList.length == 0)
@@ -1198,20 +1205,20 @@ export const CometChatMessageList = forwardRef<
1198
1205
  const getEmptyTextView = () => {
1199
1206
  if (EmptyStateView)
1200
1207
  return <EmptyStateView />
1201
-
1202
- return (
1203
- <View style={Style.msgContainerStyle}>
1204
- <Text
1205
- style={[
1206
- Style.msgTxtStyle, {
1207
- ...(messageListStyle?.emptyStateTextFont),
1208
- color: messageListStyle?.emptyStateTextColor
1209
- }]}
1210
- >
1211
- {emptyStateText}
1212
- </Text>
1213
- </View >
1214
- )
1208
+ return undefined;
1209
+ // return (
1210
+ // <View style={Style.msgContainerStyle}>
1211
+ // <Text
1212
+ // style={[
1213
+ // Style.msgTxtStyle, {
1214
+ // ...(messageListStyle?.emptyStateTextFont),
1215
+ // color: messageListStyle?.emptyStateTextColor
1216
+ // }]}
1217
+ // >
1218
+ // {emptyStateText}
1219
+ // </Text>
1220
+ // </View >
1221
+ // )
1215
1222
  }
1216
1223
 
1217
1224
  const getErrorStateView = () => {
@@ -50,7 +50,7 @@ export class SmartRepliesDecorator extends DataSourceDecorator {
50
50
  MessageEvents.ccActiveChatChanged,
51
51
  {
52
52
  ccActiveChatChanged: ({message}) => {
53
- if(message['sender']?.['uid'] != this.loggedInUser.getUid())
53
+ if(message && message['sender']?.['uid'] != this.loggedInUser.getUid())
54
54
  this.getReplies(message);
55
55
  },
56
56
  }
@@ -89,7 +89,8 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
89
89
  CometChatUIKit.sendCustomMessage(customMessage,null, null);
90
90
  }
91
91
 
92
- return <TouchableOpacity onPress={() => {
92
+ let views:JSX.Element[] = super.getAuxiliaryOptions(user,group,id)
93
+ views.push(<TouchableOpacity onPress={() => {
93
94
  setShowKeyboard(true);
94
95
  }} style={{justifyContent: "center"}}>
95
96
  <Image
@@ -107,7 +108,8 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
107
108
  }} />
108
109
  </CometChatBottomSheet>
109
110
  }
110
- </TouchableOpacity>;
111
+ </TouchableOpacity>)
112
+ return views
111
113
  }
112
114
 
113
115
  getAllMessageCategories(): string[] {
package/src/index.ts CHANGED
@@ -559,3 +559,18 @@ export {
559
559
  MessageInformationConfigurationInterface,
560
560
  MessageInformationStyleInterface
561
561
  };
562
+
563
+ // AI
564
+ export {AIConversationStarterExtension} from './AI/AIConversationStarter/AIConversationStarter'
565
+ export {AIConversationStarterDecorator} from './AI/AIConversationStarter/AIConversationStarterDecorator'
566
+ export {AIConversationStarterStyle} from './AI/AIConversationStarter/AIConversationStarterStyle'
567
+ export {AIConversationStarterConfiguration} from './AI/AIConversationStarter/configuration'
568
+ export {AIEnabler} from './AI/AIEnabler'
569
+ export {AIEnablerDecorator} from './AI/AIEnablerDecorator'
570
+ export {AIExtensionDataSource} from './AI/AIExtensionDataSource'
571
+ export {AISmartRepliesExtension} from './AI/AISmartReplies/AISmartReplies'
572
+ export {AISmartRepliesExtensionDecorator} from './AI/AISmartReplies/AISmartRepliesDecorator'
573
+ export {AISmartRepliesStyle} from './AI/AISmartReplies/AISmartRepliesStyle'
574
+ export {AISmartRepliesConfiguration} from './AI/AISmartReplies/configuration'
575
+ export {CardStyle,CardViewStyle} from './AI/CardViewStyle'
576
+ export {AIEnablerConfiguration} from './AI/configuration'
@@ -19,20 +19,24 @@ import { TextModerationExtension } from "../../extensions/TextModeration";
19
19
  import { ThumbnailGenerationExtension } from "../../extensions/ThumbnailGeneration";
20
20
  import { CometChatSoundManager } from "../utils";
21
21
  import { CometChatLocalize } from "../resources";
22
+ import { AIEnabler } from "../../AI/AIEnabler";
23
+ import { AIConversationStarterExtension } from "../../AI/AIConversationStarter/AIConversationStarter";
22
24
 
23
25
  export class CometChatUIKit {
24
26
  static uiKitSettings: UIKitSettings;
25
-
27
+ static aiFeatures:AIEnabler
26
28
  static init(uiKitSettings: UIKitSettings): Promise<boolean> {
27
29
 
28
30
  //perform sdk init taking values from uiKitSettings
29
31
  CometChatUIKit.uiKitSettings = {
30
32
  ...uiKitSettings
31
33
  };
32
-
34
+ console.log(uiKitSettings?.overrideAdminHost,uiKitSettings.overrideClientHost)
33
35
  var appSetting = new CometChat.AppSettingsBuilder()
34
36
  .subscribePresenceForAllUsers()
35
37
  .autoEstablishSocketConnection(uiKitSettings.autoEstablishSocketConnection)
38
+ .overrideAdminHost(uiKitSettings?.overrideAdminHost)
39
+ .overrideClientHost(uiKitSettings?.overrideClientHost)
36
40
  .setRegion(uiKitSettings.region)
37
41
 
38
42
  appSetting.subscriptionType = uiKitSettings.subscriptionType;
@@ -67,12 +71,21 @@ export class CometChatUIKit {
67
71
  if (CallingPackage.isCallingPackageInstalled)
68
72
  new CallingExtension().enable();
69
73
  }
70
- let extensionList: ExtensionsDataSource[] = this.defaultExtensions;
71
- if (extensionList?.length > 0) {
72
- (extensionList as ExtensionsDataSource[]).forEach((extension: ExtensionsDataSource) => {
73
- extension?.enable()
74
- })
74
+ let extensionList: ExtensionsDataSource[] = this.uiKitSettings?.extensions || this.defaultExtensions;
75
+
76
+ if (extensionList.length > 0) {
77
+ extensionList.forEach((extension: ExtensionsDataSource) => {
78
+ extension?.enable();
79
+ });
80
+ }
81
+ if(this.uiKitSettings.aiFeatures){
82
+ this.uiKitSettings.aiFeatures?.enable()
83
+ }
84
+ else{
85
+ new AIEnabler().enable()
75
86
  }
87
+
88
+
76
89
  }
77
90
 
78
91
  static async getLoggedInUser(): Promise<CometChat.User> {
@@ -1,3 +1,5 @@
1
+ import { AIEnabler } from "../../AI/AIEnabler"
2
+ import { ExtensionsDataSource } from "../framework"
1
3
 
2
4
  export type UIKitSettings = {
3
5
  appId: string,
@@ -10,6 +12,8 @@ export type UIKitSettings = {
10
12
  deviceToken?: string,
11
13
  googleApiKey?: string,
12
14
  disableCalling?: boolean,
15
+ aiFeatures?:AIEnabler,
16
+ extensions?:ExtensionsDataSource[]
13
17
  }
14
18
 
15
19
  export function UIKitSettings({
@@ -23,6 +27,8 @@ export function UIKitSettings({
23
27
  deviceToken,
24
28
  googleApiKey,
25
29
  disableCalling,
30
+ aiFeatures,
31
+ extensions
26
32
  }: UIKitSettings): UIKitSettings {
27
33
  return {
28
34
  appId,
@@ -35,5 +41,7 @@ export function UIKitSettings({
35
41
  deviceToken,
36
42
  googleApiKey,
37
43
  disableCalling,
44
+ aiFeatures,
45
+ extensions
38
46
  }
39
47
  }
@@ -301,6 +301,8 @@ export class CometChatUIEventHandler {
301
301
  break;
302
302
  case listener._eventListener.ccToggleBottomSheet?.name:
303
303
  listener._eventListener.ccToggleBottomSheet(param);
304
+ case listener._eventListener.ccComposeMessage?.name:
305
+ listener._eventListener.ccComposeMessage(param);
304
306
  break;
305
307
  }
306
308
  })
@@ -145,22 +145,26 @@ type UIEvents = {
145
145
  hidePanel?: (item)=>void,
146
146
  ccToggleBottomSheet?: (item)=>void,
147
147
  openChat?: (item)=>void,
148
+ ccComposeMessage?:(item)=>void,
148
149
  }
149
150
  export class UIEventListener {
150
151
  showPanel?: (item)=>void;
151
152
  hidePanel?: (item)=>void;
152
153
  ccToggleBottomSheet?: (item)=>void;
153
154
  openChat?: (item)=>void;
155
+ ccComposeMessage?:(item)=>void;
154
156
  constructor({
155
157
  showPanel,
156
158
  hidePanel,
157
159
  ccToggleBottomSheet,
158
- openChat
160
+ openChat,
161
+ ccComposeMessage
159
162
  }: UIEvents) {
160
163
  if (!isFalsy(hidePanel)) this.hidePanel = hidePanel;
161
164
  if (!isFalsy(showPanel)) this.showPanel = showPanel;
162
165
  if (!isFalsy(openChat)) this.openChat = openChat;
163
166
  if (!isFalsy(ccToggleBottomSheet)) this.ccToggleBottomSheet = ccToggleBottomSheet;
167
+ if (!isFalsy(ccComposeMessage)) this.ccComposeMessage = ccComposeMessage;
164
168
  }
165
169
  }
166
170
  export class GroupUIEventListener {
@@ -14,5 +14,6 @@ export enum CometChatUIEvents {
14
14
  hidePanel = 'hidePanel',
15
15
  openChat = 'openChat',
16
16
  ccToggleBottomSheet = 'ccToggleBottomSheet',
17
+ ccComposeMessage = "ccComposeMessage"
17
18
 
18
19
  }
@@ -56,7 +56,7 @@ export interface DataSource {
56
56
  getAllMessageCategories():Array<string>
57
57
 
58
58
  //auxiliary options
59
- getAuxiliaryOptions(user: CometChat.User, group: CometChat.Group, id: Map<string, any>): JSX.Element
59
+ getAuxiliaryOptions(user: CometChat.User, group: CometChat.Group, id: Map<string, any>, theme?:CometChatTheme): JSX.Element[]
60
60
 
61
61
  getId():string
62
62
 
@@ -138,8 +138,8 @@ export class DataSourceDecorator implements DataSource {
138
138
  return this.dataSource.getAllMessageCategories();
139
139
  }
140
140
 
141
- getAuxiliaryOptions(user: CometChat.User, group: CometChat.Group, id: Map<string, any>) {
142
- return this.dataSource.getAuxiliaryOptions(user, group, id);
141
+ getAuxiliaryOptions(user: CometChat.User, group: CometChat.Group, id: Map<string, any>, theme?:CometChatTheme) {
142
+ return this.dataSource.getAuxiliaryOptions(user, group, id,theme);
143
143
  }
144
144
 
145
145
  getMessageTypeToSubtitle(messageType: string): string {
@@ -498,8 +498,8 @@ export class MessageDataSource implements DataSource {
498
498
  getAllMessageCategories(): string[] {
499
499
  return [MessageCategoryConstants.message, MessageCategoryConstants.action];
500
500
  }
501
- getAuxiliaryOptions(user: CometChat.User, group: CometChat.Group, id: Map<string, any>): JSX.Element {
502
- return null;
501
+ getAuxiliaryOptions(user: CometChat.User, group: CometChat.Group, id: Map<string, any>, theme?:CometChatTheme): JSX.Element[] {
502
+ return [];
503
503
  }
504
504
  getAuxiliaryHeaderAppbarOptions(user?: CometChat.User, group?: CometChat.Group): JSX.Element {
505
505
  return null;
@@ -13,10 +13,14 @@
13
13
  "CUSTOM_MESSAGE_POLL": "📊 استطلاع للرأي",
14
14
  "CUSTOM_MESSAGE_STICKER": "💟 ملصق",
15
15
  "CUSTOM_MESSAGE_DOCUMENT": "📃 وثيقة",
16
+ "NO_REPLIES_FOUND":"لم يتم العثور على أي ردود",
16
17
  "CUSTOM_MESSAGE_WHITEBOARD": "📝 السبورة",
17
18
  "ONLINE": "عبر الإنترنت",
18
19
  "ADMINISTRATOR": "مدير",
19
20
  "MODERATOR": "مدير الجلسة",
21
+ "SUGGEST_A_REPLIES":"اقترح ردًا",
22
+ "GENERATIONG_ICEBREAKER":"توليد كاسحات الجليد",
23
+ "GENERATING_REPLIES":"توليد الردود",
20
24
  "PARTICIPANT": "مشارك",
21
25
  "PUBLIC": "عامة",
22
26
  "PRIVATE": "خاص",
@@ -13,13 +13,17 @@
13
13
  "CUSTOM_MESSAGE_POLL": "📊 Umfrage",
14
14
  "CUSTOM_MESSAGE_STICKER": "💟 Aufkleber",
15
15
  "CUSTOM_MESSAGE_DOCUMENT": "📃 Dokument",
16
+ "NO_REPLIES_FOUND":"Keine Antworten gefunden",
16
17
  "CUSTOM_MESSAGE_WHITEBOARD": "📝 Whiteboard",
17
18
  "ONLINE": "Online",
18
19
  "ADMINISTRATOR": "Verwalter",
19
20
  "MODERATOR": "Moderator",
21
+ "GENERATING_REPLIES":"Antworten generieren",
20
22
  "PARTICIPANT": "Teilnehmerin",
21
23
  "PUBLIC": "Öffentlich",
22
24
  "PRIVATE": "Privat",
25
+ "SUGGEST_A_REPLIES":"Schlage eine Antwort vor",
26
+ "GENERATIONG_ICEBREAKER":"Eisbrecher erzeugen",
23
27
  "PASSWORD_PROTECTED": "Passwort-geschützt",
24
28
  "PRIVACY_AND_SECURITY": "Datenschutz und Sicherheit",
25
29
  "PREFERENCES": "Präferenzen",
@@ -18,7 +18,10 @@
18
18
  "ADMINISTRATOR": "Administrator",
19
19
  "MODERATOR": "Moderator",
20
20
  "PARTICIPANT": "Participant",
21
+ "SUGGEST_A_REPLIES" : "Suggest a reply",
22
+ "GENERATIONG_ICEBREAKER" : "Generating icebreakers",
21
23
  "PUBLIC": "Public",
24
+ "NO_REPLIES_FOUND":"No Replies Found",
22
25
  "PRIVATE": "Private",
23
26
  "PASSWORD_PROTECTED": "Password Protected",
24
27
  "PRIVACY_AND_SECURITY": "Privacy and Security",
@@ -215,6 +218,7 @@
215
218
  "NO_PHOTOS": "No Photos",
216
219
  "NO_VIDEOS": "No Videos",
217
220
  "NO_DOCUMENTS": "No Documents",
221
+ "GENERATING_REPLIES":"Generating replies",
218
222
  "JOIN": "Join",
219
223
  "DELETE_CONFIRM_MESSAGE": "Would you like to delete this conversation? This conversation will be deleted from all of your devices.",
220
224
  "CHAT_ERROR_MESSAGE": "Can't load chats. Please try again",
@@ -17,7 +17,11 @@
17
17
  "ONLINE": "En línea",
18
18
  "ADMINISTRATOR": "Administrador",
19
19
  "MODERATOR": "Moderador",
20
+ "NO_REPLIES_FOUND":"No se encontraron respuestas",
20
21
  "PARTICIPANT": "Participante",
22
+ "GENERATING_REPLIES":"Generación de respuestas",
23
+ "SUGGEST_A_REPLIES":"Sugerir una respuesta",
24
+ "GENERATIONG_ICEBREAKER":"Generando rompehielos",
21
25
  "PUBLIC": "Público",
22
26
  "PRIVATE": "Privado",
23
27
  "PASSWORD_PROTECTED": "Protegido con contraseña",
@@ -17,8 +17,12 @@
17
17
  "ONLINE": "En ligne",
18
18
  "ADMINISTRATOR": "Administrateur",
19
19
  "MODERATOR": "Modérateur",
20
+ "NO_REPLIES_FOUND":"Aucune réponse trouvée",
20
21
  "PARTICIPANT": "Participant",
22
+ "GENERATING_REPLIES":"Génération de réponses",
21
23
  "PUBLIC": "Public",
24
+ "SUGGEST_A_REPLIES":"Suggérer une réponse",
25
+ "GENERATIONG_ICEBREAKER":"Génération de brise-glaces",
22
26
  "PRIVATE": "Privé",
23
27
  "PASSWORD_PROTECTED": "Mot de passe",
24
28
  "PRIVACY_AND_SECURITY": "Confidentialité et sécurité",
@@ -13,12 +13,16 @@
13
13
  "CUSTOM_MESSAGE_POLL": "📊 पोल",
14
14
  "CUSTOM_MESSAGE_STICKER": "💟 स्टीकर",
15
15
  "CUSTOM_MESSAGE_DOCUMENT": "📃 दस्तावेज़",
16
+ "SUGGEST_A_REPLIES":"जवाब सुझाएं",
17
+ "GENERATIONG_ICEBREAKER":"आइसब्रेकर उत्पन्न करना",
16
18
  "CUSTOM_MESSAGE_WHITEBOARD": "📝 व्हाइटबोर्ड",
17
19
  "ONLINE": "ऑनलाइन",
20
+ "NO_REPLIES_FOUND":"कोई जवाब नहीं मिला",
18
21
  "ADMINISTRATOR": "प्रशासक",
19
22
  "MODERATOR": "मॉडरेटर",
20
23
  "PARTICIPANT": "प्रतिभागी",
21
24
  "PUBLIC": "पब्लिक",
25
+ "GENERATING_REPLIES":"जवाब जनरेट करना",
22
26
  "PRIVATE": "निजी",
23
27
  "PASSWORD_PROTECTED": "कूटशब्द सुरक्षित",
24
28
  "PRIVACY_AND_SECURITY": "गोपनीयता और सुरक्षा",