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

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 (134) hide show
  1. package/LICENSE.md +3 -0
  2. package/README.md +1 -1
  3. package/android/src/main/java/com/reactnativecometchatuikit/{RNSoundModule.java → CometChatSoundModule.java} +22 -22
  4. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -1
  5. package/ios/{RNSound.h → CometChatSoundModule.h} +1 -1
  6. package/ios/{RNSound.m → CometChatSoundModule.m} +2 -2
  7. package/package.json +3 -3
  8. package/src/AI/AIConversationStarter/AIConversationStarter.ts +33 -0
  9. package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +231 -0
  10. package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +8 -0
  11. package/src/AI/AIConversationStarter/configuration.ts +18 -0
  12. package/src/AI/AIConversationStarter/style.ts +76 -0
  13. package/src/AI/AIEnabler.ts +115 -0
  14. package/src/AI/AIEnablerDecorator.tsx +324 -0
  15. package/src/AI/AIExtensionDataSource.ts +12 -0
  16. package/src/AI/AISmartReplies/AISmartReplies.ts +28 -0
  17. package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +18 -0
  18. package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +16 -0
  19. package/src/AI/AISmartReplies/configuration.ts +17 -0
  20. package/src/AI/CardView.tsx +81 -0
  21. package/src/AI/CardViewStyle.ts +37 -0
  22. package/src/AI/configuration.ts +17 -0
  23. package/src/AI/resources/ai-empty.png +0 -0
  24. package/src/AI/resources/ai-error.png +0 -0
  25. package/src/AI/resources/ai.png +0 -0
  26. package/src/AI/resources/index.ts +11 -0
  27. package/src/AI/resources/spineer.png +0 -0
  28. package/src/AI/style.ts +177 -0
  29. package/src/AI/utils.ts +39 -0
  30. package/src/CometChatConversations/CometChatConversations.tsx +56 -46
  31. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +13 -4
  32. package/src/CometChatMessageHeader/listners.ts +5 -4
  33. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +35 -35
  34. package/src/CometChatMessageList/CometChatMessageList.tsx +274 -158
  35. package/src/CometChatMessages/CometChatMessages.tsx +4 -3
  36. package/src/CometChatTabs/CometChatTabs.tsx +1 -1
  37. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +4 -10
  38. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +4 -2
  39. package/src/index.ts +61 -4
  40. package/src/shared/CometChatUiKit/CometChatUIKit.ts +108 -7
  41. package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -0
  42. package/src/shared/constants/UIKitConstants.ts +81 -47
  43. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +46 -0
  44. package/src/shared/events/CometChatUIEventHandler/Listener.ts +66 -3
  45. package/src/shared/events/CometChatUIEvents.ts +1 -0
  46. package/src/shared/events/ListenerInitializer.ts +73 -0
  47. package/src/shared/events/messages.ts +14 -0
  48. package/src/shared/framework/DataSource.ts +12 -1
  49. package/src/shared/framework/DataSourceDecorator.tsx +37 -2
  50. package/src/shared/framework/MessageDataSource.tsx +85 -5
  51. package/src/shared/index.ts +44 -0
  52. package/src/shared/modals/InteractiveData/InteractiveActions/APIAction.ts +118 -0
  53. package/src/shared/modals/InteractiveData/InteractiveActions/CustomAction.ts +19 -0
  54. package/src/shared/modals/InteractiveData/InteractiveActions/URLNavigationAction.ts +34 -0
  55. package/src/shared/modals/InteractiveData/InteractiveActions/index.ts +3 -0
  56. package/src/shared/modals/InteractiveData/InteractiveData/InteractiveCardData.ts +69 -0
  57. package/src/shared/modals/InteractiveData/InteractiveData/InteractiveFormData.ts +119 -0
  58. package/src/shared/modals/InteractiveData/InteractiveData/index.ts +2 -0
  59. package/src/shared/modals/InteractiveData/InteractiveElements/BaseInputElement.ts +102 -0
  60. package/src/shared/modals/InteractiveData/InteractiveElements/BaseInteractiveElement.ts +45 -0
  61. package/src/shared/modals/InteractiveData/InteractiveElements/ButtonElement.ts +61 -0
  62. package/src/shared/modals/InteractiveData/InteractiveElements/CheckboxElement.ts +75 -0
  63. package/src/shared/modals/InteractiveData/InteractiveElements/DropdownElement.ts +83 -0
  64. package/src/shared/modals/InteractiveData/InteractiveElements/LabelElement.ts +32 -0
  65. package/src/shared/modals/InteractiveData/InteractiveElements/OptionElement.ts +39 -0
  66. package/src/shared/modals/InteractiveData/InteractiveElements/RadioButtonElement.ts +76 -0
  67. package/src/shared/modals/InteractiveData/InteractiveElements/SingleSelectElement.ts +76 -0
  68. package/src/shared/modals/InteractiveData/InteractiveElements/TextInputElement.ts +101 -0
  69. package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +10 -0
  70. package/src/shared/modals/InteractiveData/InteractiveEntities/ActionEntity.ts +41 -0
  71. package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +64 -0
  72. package/src/shared/modals/InteractiveData/InteractiveEntities/index.ts +2 -0
  73. package/src/shared/modals/InteractiveData/InteractiveMessage/CardMessage.ts +142 -0
  74. package/src/shared/modals/InteractiveData/InteractiveMessage/CustomInteractiveMessage.ts +38 -0
  75. package/src/shared/modals/InteractiveData/InteractiveMessage/FormMessage.ts +152 -0
  76. package/src/shared/modals/InteractiveData/InteractiveMessage/index.ts +3 -0
  77. package/src/shared/modals/InteractiveData/index.ts +28 -0
  78. package/src/shared/modals/index.ts +19 -0
  79. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +8 -1
  80. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +8 -1
  81. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +8 -1
  82. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +8 -1
  83. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +8 -1
  84. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +8 -1
  85. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +8 -1
  86. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +8 -1
  87. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +8 -1
  88. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +8 -1
  89. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +8 -1
  90. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +8 -1
  91. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +8 -1
  92. package/src/shared/resources/CometChatSoundManager/CometChatSoundManager.js +2 -2
  93. package/src/shared/resources/CometChatSoundManager/sound.js +35 -35
  94. package/src/shared/utils/InteractiveMessageUtils.ts +20 -0
  95. package/src/shared/utils/NetworkUtils.tsx +20 -0
  96. package/src/shared/utils/conversationUtils.ts +9 -6
  97. package/src/shared/views/CometChatButton/CometChatButton.tsx +32 -22
  98. package/src/shared/views/CometChatCardBubble/CardBubbleStyle.tsx +47 -0
  99. package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +173 -0
  100. package/src/shared/views/CometChatCardBubble/index.tsx +1 -0
  101. package/src/shared/views/CometChatCheckBox/CheckBoxStyle.tsx +43 -0
  102. package/src/shared/views/CometChatCheckBox/CometChatCheckBox.tsx +79 -0
  103. package/src/shared/views/CometChatDate/CometChatDate.tsx +2 -3
  104. package/src/shared/views/CometChatDropDown/CometChatDropDown.tsx +126 -0
  105. package/src/shared/views/CometChatDropDown/DropDownStyle.tsx +39 -0
  106. package/src/shared/views/CometChatDropDown/resources/downArrowIcon.png +0 -0
  107. package/src/shared/views/CometChatDropDown/resources/index.js +5 -0
  108. package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +464 -0
  109. package/src/shared/views/CometChatFormBubble/FormBubbleStyle.tsx +91 -0
  110. package/src/shared/views/CometChatFormBubble/index.tsx +1 -0
  111. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +13 -5
  112. package/src/shared/views/CometChatImageBubble/ImageBubbleStyle.ts +14 -3
  113. package/src/shared/views/CometChatLabel/CometChatLabel.tsx +27 -0
  114. package/src/shared/views/CometChatLabel/LabelStyle.ts +19 -0
  115. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +5 -4
  116. package/src/shared/views/CometChatQuickView/CometChatQuickView.tsx +66 -0
  117. package/src/shared/views/CometChatQuickView/QuickViewStyle.ts +55 -0
  118. package/src/shared/views/CometChatRadioButton/CometChatRadioButton.tsx +67 -0
  119. package/src/shared/views/CometChatRadioButton/RadioButtonStyle.tsx +38 -0
  120. package/src/shared/views/CometChatSingleSelect/CometChatSingleSelect.tsx +63 -0
  121. package/src/shared/views/CometChatSingleSelect/SingleStyle.tsx +35 -0
  122. package/src/shared/views/CometChatTextInput/CometChatTextInput.tsx +67 -0
  123. package/src/shared/views/CometChatTextInput/TextInputStyle.tsx +26 -0
  124. package/src/shared/views/index.ts +7 -1
  125. package/LICENSE +0 -21
  126. package/android/.idea/.gitignore +0 -3
  127. package/android/local.properties +0 -8
  128. package/src/.DS_Store +0 -0
  129. package/src/CometChatMessageInformation/.DS_Store +0 -0
  130. package/src/calls/CometChatCallHistory/.DS_Store +0 -0
  131. package/src/shared/framework/.DS_Store +0 -0
  132. package/src/shared/views/.DS_Store +0 -0
  133. package/src/shared/views/CometChatAudioBubble/.DS_Store +0 -0
  134. 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
+ }
@@ -19,7 +19,7 @@ import {
19
19
  } from "./resources";
20
20
  import { ConversationsStyle, ConversationsStyleInterface } from "./ConversationsStyle";
21
21
  import { ImageType } from "../shared";
22
- import { GroupTypeConstants, MessageStatusConstants, PASSWORD_GROUP_COLOR, PRIVATE_GROUP_COLOR, ReceiverTypeConstants } from "../shared/constants/UIKitConstants";
22
+ import { GroupTypeConstants, MessageCategoryConstants, MessageStatusConstants, PASSWORD_GROUP_COLOR, PRIVATE_GROUP_COLOR, ReceiverTypeConstants } from "../shared/constants/UIKitConstants";
23
23
  import { AvatarStyle, BadgeStyle, CometChatBadge, CometChatDate, CometChatListItem, CometChatReceipt, DateStyle, StatusIndicatorStyle } from "../shared";
24
24
  import { ListItemStyle, ListItemStyleInterface } from "../shared";
25
25
  import { CometChatContextType, MessageReceipt, SelectionMode } from "../shared/base/Types";
@@ -31,6 +31,7 @@ import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandle
31
31
  import { StatusIndicatorStyleInterface } from "../shared/views/CometChatStatusIndicator/StatusIndicatorStyle";
32
32
  import { DateStyleInterface } from "../shared/views/CometChatDate/DateStyle";
33
33
  import { BadgeStyleInterface } from "../shared/views/CometChatBadge";
34
+ import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
34
35
 
35
36
  const conversationListenerId = "chatlist_" + new Date().getTime();
36
37
  const userListenerId = "chatlist_user_" + new Date().getTime();
@@ -371,7 +372,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
371
372
  // console.log("typing event", conversation);
372
373
  let isTyping = args[1];
373
374
  let newConversation = conversation
374
- if (isTyping) {
375
+ if (isTyping && newConversation?.['lastMessage']?.["typing"]) {
375
376
  newConversation['lastMessage']["typing"] = args[0].receiverType === 'group' ?
376
377
  `${args[0].sender.name} : ${localize("IS_TYPING")}` :
377
378
  localize("IS_TYPING");
@@ -390,6 +391,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
390
391
  const updateLastMessage = (newMessage) => {
391
392
  CometChat.CometChatHelper.getConversationFromMessage(newMessage)
392
393
  .then(conversation => {
394
+ if (newMessage.getCategory() === MessageCategoryConstants.interactive) {
395
+ newMessage = InteractiveMessageUtils.convertInteractiveMessage(newMessage);
396
+ }
393
397
  const oldConversation: CometChat.Conversation = conversationListRef.current.getListItem(conversation['conversationId']);
394
398
  if (oldConversation == undefined) {
395
399
  CometChat.CometChatHelper.getConversationFromMessage(newMessage)
@@ -442,7 +446,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
442
446
  * When a text message / media message / custom message is received
443
447
  */
444
448
  const messageEventHandler = (...args) => {
445
- const message = args[0];
449
+ let message = args[0];
446
450
  !disableReadReceipt && markMessageAsDelivered(message);
447
451
  updateLastMessage(message);
448
452
  }
@@ -458,10 +462,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
458
462
  conversation.setLastMessage(message);
459
463
  conversationListRef.current.updateList(conversation);
460
464
  } else {
461
- CometChat.CometChatHelper.getConversationFromMessage(message)
462
- .then(newConversation => {
463
- conversationListRef.current.addItemToList(newConversation, 0);
464
- });
465
+ CometChat.CometChatHelper.getConversationFromMessage(message)
466
+ .then(newConversation => {
467
+ conversationListRef.current.addItemToList(newConversation, 0);
468
+ });
465
469
  }
466
470
  }
467
471
 
@@ -737,42 +741,6 @@ export const CometChatConversations = (props: ConversationInterface) => {
737
741
  })
738
742
  );
739
743
 
740
- CometChat.addMessageListener(
741
- conversationListenerId,
742
- new CometChat.MessageListener({
743
- onTextMessageReceived: (textMessage) => {
744
- messageEventHandler(textMessage);
745
- CometChatSoundManager.play("incomingMessage");
746
- },
747
- onMediaMessageReceived: (mediaMessage) => {
748
- messageEventHandler(mediaMessage);
749
- CometChatSoundManager.play("incomingMessage");
750
- },
751
- onCustomMessageReceived: (customMessage) => {
752
- messageEventHandler(customMessage);
753
- CometChatSoundManager.play("incomingMessage");
754
- },
755
- onMessageDeleted: (deletedMessage) => {
756
- messageEventHandler(deletedMessage);
757
- },
758
- onMessageEdited: (editedMessage) => {
759
- messageEventHandler(editedMessage);
760
- },
761
- onMessagesRead: (messageReceipt) => {
762
- messageEventHandler(messageReceipt);
763
- },
764
- onMessagesDelivered: (messageReveipt) => {
765
- messageEventHandler(messageReveipt);
766
- },
767
- onTypingStarted: (typingIndicator) => {
768
- typingEventHandler(typingIndicator, true);
769
- },
770
- onTypingEnded: (typingIndicator) => {
771
- typingEventHandler(typingIndicator, false);
772
- },
773
- })
774
- );
775
-
776
744
  CometChatUIEventHandler.addConversationListener(
777
745
  conversationListenerId,
778
746
  {
@@ -829,6 +797,49 @@ export const CometChatConversations = (props: ConversationInterface) => {
829
797
  conversationListRef.current.updateList(conversation)
830
798
  }
831
799
  })
800
+ },
801
+ onTextMessageReceived: (textMessage) => {
802
+ console.log("onTextMessageReceived", textMessage);
803
+ messageEventHandler(textMessage);
804
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
805
+ },
806
+ onMediaMessageReceived: (mediaMessage) => {
807
+ messageEventHandler(mediaMessage);
808
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
809
+ },
810
+ onCustomMessageReceived: (customMessage) => {
811
+ messageEventHandler(customMessage);
812
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
813
+ },
814
+ onMessageDeleted: (deletedMessage) => {
815
+ messageEventHandler(deletedMessage);
816
+ },
817
+ onMessageEdited: (editedMessage) => {
818
+ messageEventHandler(editedMessage);
819
+ },
820
+ onMessagesRead: (messageReceipt) => {
821
+ messageEventHandler(messageReceipt);
822
+ },
823
+ onMessagesDelivered: (messageReveipt) => {
824
+ messageEventHandler(messageReveipt);
825
+ },
826
+ onTypingStarted: (typingIndicator) => {
827
+ typingEventHandler(typingIndicator, true);
828
+ },
829
+ onTypingEnded: (typingIndicator) => {
830
+ typingEventHandler(typingIndicator, false);
831
+ },
832
+ onFormMessageReceived: (formMessage) => {
833
+ messageEventHandler(formMessage);
834
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
835
+ },
836
+ onCardMessageReceived: (cardMessage) => {
837
+ messageEventHandler(cardMessage);
838
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
839
+ },
840
+ onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
841
+ messageEventHandler(customInteractiveMessage);
842
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
832
843
  }
833
844
  }
834
845
  );
@@ -853,10 +864,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
853
864
  })
854
865
 
855
866
  },
856
- ccGroupMemberBanned: ({message}) => {
867
+ ccGroupMemberBanned: ({ message }) => {
857
868
  groupHandler(message);
858
869
  },
859
- ccGroupMemberUnBanned: ({message}) => {
870
+ ccGroupMemberUnBanned: ({ message }) => {
860
871
  groupHandler(message)
861
872
  },
862
873
  ccOwnershipChanged: ({ message }) => {
@@ -931,7 +942,6 @@ export const CometChatConversations = (props: ConversationInterface) => {
931
942
  )
932
943
 
933
944
  return () => {
934
- CometChat.removeMessageListener(conversationListenerId);
935
945
  CometChat.removeUserListener(userListenerId);
936
946
  CometChat.removeCallListener(callListenerId);
937
947
  CometChat.removeGroupListener(groupListenerId);
@@ -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
  ]}
@@ -1,5 +1,6 @@
1
1
  //@ts-ignore
2
2
  import { CometChat } from '@cometchat/chat-sdk-react-native';
3
+ import { CometChatUIEventHandler } from '../shared';
3
4
 
4
5
  export const listners = {
5
6
  addListener: {
@@ -18,9 +19,9 @@ export const listners = {
18
19
  })
19
20
  ),
20
21
  messageListener: ({ msgTypingListenerId, msgTypingIndicator }) =>
21
- CometChat.addMessageListener(
22
+ CometChatUIEventHandler.addMessageListener(
22
23
  msgTypingListenerId,
23
- new CometChat.MessageListener({
24
+ {
24
25
  onTypingStarted: (typistDetails) => {
25
26
  console.log('onTypingStarted', typistDetails);
26
27
 
@@ -30,7 +31,7 @@ export const listners = {
30
31
  console.log('onTypingEnded', typistDetails);
31
32
  msgTypingIndicator(typistDetails, '');
32
33
  },
33
- })
34
+ }
34
35
  ),
35
36
  groupListener: ({ groupListenerId, handleGroupListener }) =>
36
37
  CometChat.addGroupListener(
@@ -65,7 +66,7 @@ export const listners = {
65
66
  CometChat.removeUserListener(userStatusListenerId),
66
67
 
67
68
  removeMessageListener: ({ msgTypingListenerId }) =>
68
- CometChat.removeMessageListener(msgTypingListenerId),
69
+ CometChatUIEventHandler.removeMessageListener(msgTypingListenerId),
69
70
 
70
71
  removeGroupListener: ({ groupListenerId }) =>
71
72
  CometChat.removeGroupListener(groupListenerId),
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, useEffect, useState } from 'react'
2
2
  import { Dimensions, FlatList, Image, Text, TouchableOpacity, View, ScrollView } from 'react-native'
3
3
  import { CometChat } from '@cometchat/chat-sdk-react-native'
4
- import { AvatarStyleInterface, CometChatContext, CometChatDate, CometChatListItem, CometChatMessageTemplate, CometChatReceipt, ImageType, ListItemStyleInterface, StatusIndicatorStyleInterface, localize } from '../shared'
4
+ import { AvatarStyleInterface, CometChatContext, CometChatDate, CometChatListItem, CometChatMessageTemplate, CometChatReceipt, CometChatUIEventHandler, ImageType, ListItemStyleInterface, StatusIndicatorStyleInterface, localize } from '../shared'
5
5
  import { MessageInformationStyleInterface } from './MessageInformationStyle'
6
6
  import { MessageUtils } from '../shared/utils/MessageUtils'
7
7
  import { Style } from "./styles";
@@ -191,16 +191,16 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
191
191
 
192
192
  useEffect(() => {
193
193
  //add listener for message delivery
194
- CometChat.addMessageListener(
194
+ CometChatUIEventHandler.addMessageListener(
195
195
  listenerId,
196
- new CometChat.MessageListener({
196
+ {
197
197
  onMessagesDelivered: (messageReceipt) => {
198
198
  updateMessageReceipt(messageReceipt);
199
199
  },
200
200
  onMessagesRead: (messageReceipt) => {
201
201
  updateMessageReceipt(messageReceipt);
202
202
  },
203
- })
203
+ }
204
204
  )
205
205
  }, []);
206
206
 
@@ -210,28 +210,28 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
210
210
 
211
211
  const LoadingView = () => {
212
212
  if (LoadingStateView)
213
- return <LoadingStateView />
213
+ return <LoadingStateView />
214
214
  return <View style={[Style.viewContainer]}>
215
- <Image source={loadingIcon || LoadingIcon} style={[Style.imageStyle, { tintColor: "black" }]} />
215
+ <Image source={loadingIcon || LoadingIcon} style={[Style.imageStyle, { tintColor: "black" }]} />
216
216
  </View>
217
217
  }
218
218
 
219
219
  const ErrorView = () => {
220
- if (ErrorStateView)
221
- return <ErrorStateView />
222
- return <View style={[Style.viewContainer]}>
223
- <Text>{errorStateText || localize("SOMETHING_WRONG")}</Text>
224
- </View>
220
+ if (ErrorStateView)
221
+ return <ErrorStateView />
222
+ return <View style={[Style.viewContainer]}>
223
+ <Text>{errorStateText || localize("SOMETHING_WRONG")}</Text>
224
+ </View>
225
225
  }
226
226
 
227
227
  const EmptyView = () => {
228
- if (EmptyStateView)
229
- return <EmptyStateView />
230
- return (
231
- <View style={[Style.viewContainer]}>
232
- <Text>{emptyStateText || localize("No_RECIPIENT")}</Text>
233
- </View>
234
- )
228
+ if (EmptyStateView)
229
+ return <EmptyStateView />
230
+ return (
231
+ <View style={[Style.viewContainer]}>
232
+ <Text>{emptyStateText || localize("No_RECIPIENT")}</Text>
233
+ </View>
234
+ )
235
235
  }
236
236
 
237
237
  return (
@@ -245,7 +245,7 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
245
245
  Style.container,
246
246
  border
247
247
  ]}>
248
- <View style={{flexDirection: "row"}}>
248
+ <View style={{ flexDirection: "row" }}>
249
249
  <TouchableOpacity onPress={onBack}>
250
250
  <Image
251
251
  source={backIcon}
@@ -256,13 +256,13 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
256
256
  }}
257
257
  />
258
258
  </TouchableOpacity>
259
- <View style={{flex: 1, alignItems: "center"}}>
260
- <Text style={{color: titleTextColor, ...titleTextFont}}>{title}</Text>
259
+ <View style={{ flex: 1, alignItems: "center" }}>
260
+ <Text style={{ color: titleTextColor, ...titleTextFont }}>{title}</Text>
261
261
  </View>
262
262
  </View>
263
263
 
264
264
  <View>
265
- <Text style={{color: dividerTint || theme.palette.getAccent500(), ...theme.typography.text1 }}>{localize("MESSAGE")}</Text>
265
+ <Text style={{ color: dividerTint || theme.palette.getAccent500(), ...theme.typography.text1 }}>{localize("MESSAGE")}</Text>
266
266
  </View>
267
267
  <View style={[Style.divider, { backgroundColor: dividerTint || theme.palette.getAccent200() }]} />
268
268
  <View style={Style.msgBubbleContainer}>
@@ -276,26 +276,26 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
276
276
  alignment: "right",
277
277
  theme
278
278
  })
279
- }
280
- </ScrollView>
279
+ }
280
+ </ScrollView>
281
281
  </View>
282
282
  <View style={[Style.divider, { backgroundColor: dividerTint || theme.palette.getAccent200() }]} />
283
283
  <View>
284
- <Text style={{color: dividerTint || theme.palette.getAccent500(), ...theme.typography.text1 }}>{localize("RECEIPT_INFORMATION")}</Text>
284
+ <Text style={{ color: dividerTint || theme.palette.getAccent500(), ...theme.typography.text1 }}>{localize("RECEIPT_INFORMATION")}</Text>
285
285
  </View>
286
286
  <View style={[Style.divider, { backgroundColor: dividerTint || theme.palette.getAccent200() }]} />
287
287
  {
288
288
  listState == "loading" && recipients.length == 0 ?
289
- <LoadingView /> :
290
- listState == "error" && recipients.length == 0 ?
291
- <ErrorView /> :
292
- recipients.length == 0 ?
293
- <EmptyView /> :
294
- <FlatList
295
- style={{ flex: 1, backgroundColor: 'transparent' }}
296
- data={recipients}
297
- renderItem={renderReceipients}
298
- />
289
+ <LoadingView /> :
290
+ listState == "error" && recipients.length == 0 ?
291
+ <ErrorView /> :
292
+ recipients.length == 0 ?
293
+ <EmptyView /> :
294
+ <FlatList
295
+ style={{ flex: 1, backgroundColor: 'transparent' }}
296
+ data={recipients}
297
+ renderItem={renderReceipients}
298
+ />
299
299
  }
300
300
  </View>
301
301
  )