@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.
- package/LICENSE.md +3 -0
- package/README.md +1 -1
- package/android/src/main/java/com/reactnativecometchatuikit/{RNSoundModule.java → CometChatSoundModule.java} +22 -22
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -1
- package/ios/{RNSound.h → CometChatSoundModule.h} +1 -1
- package/ios/{RNSound.m → CometChatSoundModule.m} +2 -2
- package/package.json +3 -3
- package/src/AI/AIConversationStarter/AIConversationStarter.ts +33 -0
- package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +231 -0
- package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +8 -0
- package/src/AI/AIConversationStarter/configuration.ts +18 -0
- package/src/AI/AIConversationStarter/style.ts +76 -0
- package/src/AI/AIEnabler.ts +115 -0
- package/src/AI/AIEnablerDecorator.tsx +324 -0
- package/src/AI/AIExtensionDataSource.ts +12 -0
- package/src/AI/AISmartReplies/AISmartReplies.ts +28 -0
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +18 -0
- package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +16 -0
- package/src/AI/AISmartReplies/configuration.ts +17 -0
- package/src/AI/CardView.tsx +81 -0
- package/src/AI/CardViewStyle.ts +37 -0
- package/src/AI/configuration.ts +17 -0
- package/src/AI/resources/ai-empty.png +0 -0
- package/src/AI/resources/ai-error.png +0 -0
- package/src/AI/resources/ai.png +0 -0
- package/src/AI/resources/index.ts +11 -0
- package/src/AI/resources/spineer.png +0 -0
- package/src/AI/style.ts +177 -0
- package/src/AI/utils.ts +39 -0
- package/src/CometChatConversations/CometChatConversations.tsx +56 -46
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +13 -4
- package/src/CometChatMessageHeader/listners.ts +5 -4
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +35 -35
- package/src/CometChatMessageList/CometChatMessageList.tsx +274 -158
- package/src/CometChatMessages/CometChatMessages.tsx +4 -3
- package/src/CometChatTabs/CometChatTabs.tsx +1 -1
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +4 -10
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +4 -2
- package/src/index.ts +61 -4
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +108 -7
- package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -0
- package/src/shared/constants/UIKitConstants.ts +81 -47
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +46 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +66 -3
- package/src/shared/events/CometChatUIEvents.ts +1 -0
- package/src/shared/events/ListenerInitializer.ts +73 -0
- package/src/shared/events/messages.ts +14 -0
- package/src/shared/framework/DataSource.ts +12 -1
- package/src/shared/framework/DataSourceDecorator.tsx +37 -2
- package/src/shared/framework/MessageDataSource.tsx +85 -5
- package/src/shared/index.ts +44 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/APIAction.ts +118 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/CustomAction.ts +19 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/URLNavigationAction.ts +34 -0
- package/src/shared/modals/InteractiveData/InteractiveActions/index.ts +3 -0
- package/src/shared/modals/InteractiveData/InteractiveData/InteractiveCardData.ts +69 -0
- package/src/shared/modals/InteractiveData/InteractiveData/InteractiveFormData.ts +119 -0
- package/src/shared/modals/InteractiveData/InteractiveData/index.ts +2 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/BaseInputElement.ts +102 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/BaseInteractiveElement.ts +45 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/ButtonElement.ts +61 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/CheckboxElement.ts +75 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/DropdownElement.ts +83 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/LabelElement.ts +32 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/OptionElement.ts +39 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/RadioButtonElement.ts +76 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/SingleSelectElement.ts +76 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/TextInputElement.ts +101 -0
- package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +10 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/ActionEntity.ts +41 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +64 -0
- package/src/shared/modals/InteractiveData/InteractiveEntities/index.ts +2 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/CardMessage.ts +142 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/CustomInteractiveMessage.ts +38 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/FormMessage.ts +152 -0
- package/src/shared/modals/InteractiveData/InteractiveMessage/index.ts +3 -0
- package/src/shared/modals/InteractiveData/index.ts +28 -0
- package/src/shared/modals/index.ts +19 -0
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +8 -1
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +8 -1
- package/src/shared/resources/CometChatSoundManager/CometChatSoundManager.js +2 -2
- package/src/shared/resources/CometChatSoundManager/sound.js +35 -35
- package/src/shared/utils/InteractiveMessageUtils.ts +20 -0
- package/src/shared/utils/NetworkUtils.tsx +20 -0
- package/src/shared/utils/conversationUtils.ts +9 -6
- package/src/shared/views/CometChatButton/CometChatButton.tsx +32 -22
- package/src/shared/views/CometChatCardBubble/CardBubbleStyle.tsx +47 -0
- package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +173 -0
- package/src/shared/views/CometChatCardBubble/index.tsx +1 -0
- package/src/shared/views/CometChatCheckBox/CheckBoxStyle.tsx +43 -0
- package/src/shared/views/CometChatCheckBox/CometChatCheckBox.tsx +79 -0
- package/src/shared/views/CometChatDate/CometChatDate.tsx +2 -3
- package/src/shared/views/CometChatDropDown/CometChatDropDown.tsx +126 -0
- package/src/shared/views/CometChatDropDown/DropDownStyle.tsx +39 -0
- package/src/shared/views/CometChatDropDown/resources/downArrowIcon.png +0 -0
- package/src/shared/views/CometChatDropDown/resources/index.js +5 -0
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +464 -0
- package/src/shared/views/CometChatFormBubble/FormBubbleStyle.tsx +91 -0
- package/src/shared/views/CometChatFormBubble/index.tsx +1 -0
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +13 -5
- package/src/shared/views/CometChatImageBubble/ImageBubbleStyle.ts +14 -3
- package/src/shared/views/CometChatLabel/CometChatLabel.tsx +27 -0
- package/src/shared/views/CometChatLabel/LabelStyle.ts +19 -0
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +5 -4
- package/src/shared/views/CometChatQuickView/CometChatQuickView.tsx +66 -0
- package/src/shared/views/CometChatQuickView/QuickViewStyle.ts +55 -0
- package/src/shared/views/CometChatRadioButton/CometChatRadioButton.tsx +67 -0
- package/src/shared/views/CometChatRadioButton/RadioButtonStyle.tsx +38 -0
- package/src/shared/views/CometChatSingleSelect/CometChatSingleSelect.tsx +63 -0
- package/src/shared/views/CometChatSingleSelect/SingleStyle.tsx +35 -0
- package/src/shared/views/CometChatTextInput/CometChatTextInput.tsx +67 -0
- package/src/shared/views/CometChatTextInput/TextInputStyle.tsx +26 -0
- package/src/shared/views/index.ts +7 -1
- package/LICENSE +0 -21
- package/android/.idea/.gitignore +0 -3
- package/android/local.properties +0 -8
- package/src/.DS_Store +0 -0
- package/src/CometChatMessageInformation/.DS_Store +0 -0
- package/src/calls/CometChatCallHistory/.DS_Store +0 -0
- package/src/shared/framework/.DS_Store +0 -0
- package/src/shared/views/.DS_Store +0 -0
- package/src/shared/views/CometChatAudioBubble/.DS_Store +0 -0
- package/src/shared/views/CometChatFileBubble/.DS_Store +0 -0
|
@@ -118,16 +118,16 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
|
|
|
118
118
|
}, [showComponent]);
|
|
119
119
|
|
|
120
120
|
useEffect(() => {
|
|
121
|
-
|
|
121
|
+
CometChatUIEventHandler.addMessageListener(
|
|
122
122
|
msgListenerId,
|
|
123
|
-
|
|
123
|
+
{
|
|
124
124
|
onTransientMessageReceived: (transientMessage) => {
|
|
125
125
|
const { reaction, type } = transientMessage['data'];
|
|
126
126
|
if (type == MetadataConstants.liveReaction) {
|
|
127
127
|
setShowLiveReaction(!showLiveReaction);
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
CometChat.getLoggedinUser().then(user => {
|
|
@@ -300,6 +300,7 @@ export const CometChatMessages = (props: CometChatMessagesInterface) => {
|
|
|
300
300
|
emptyStateText={localize("NO_MESSAGES_FOUND")}
|
|
301
301
|
errorStateText={localize("SOMETHING_WRONG")}
|
|
302
302
|
dateSeperatorPattern={_listConfiguration.dateSeperatorPattern}
|
|
303
|
+
disableSoundForMessages={disableSoundForMessages}
|
|
303
304
|
onThreadRepliesPress={(msg, view) => {
|
|
304
305
|
threadedMessageInfo.current = { message: msg, view }
|
|
305
306
|
setShowComponent(ComponentNames.Thread);
|
|
@@ -166,7 +166,7 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
166
166
|
|
|
167
167
|
return (
|
|
168
168
|
<View style={{ flex: 1 }}>
|
|
169
|
-
<View style={{display: tabAlignment == 'bottom' ? "none" : "flex"}}>
|
|
169
|
+
<View style={{display: tabAlignment == 'bottom' ? "none" : "flex", margin: 15, marginTop: 0}}>
|
|
170
170
|
{
|
|
171
171
|
tabAlignment == "top" && <TabsList />
|
|
172
172
|
}
|
|
@@ -19,7 +19,6 @@ import { SmartRepliesConfigurationInterface } from './SmartRepliesExtension';
|
|
|
19
19
|
|
|
20
20
|
export class SmartRepliesDecorator extends DataSourceDecorator {
|
|
21
21
|
smartRepliesConfiguration?: SmartRepliesConfigurationInterface;
|
|
22
|
-
messageListenerId = 'message_' + new Date().getTime();
|
|
23
22
|
|
|
24
23
|
loggedInUser: CometChat.User;
|
|
25
24
|
|
|
@@ -38,21 +37,16 @@ export class SmartRepliesDecorator extends DataSourceDecorator {
|
|
|
38
37
|
})
|
|
39
38
|
.catch((err) => console.log(err));
|
|
40
39
|
|
|
41
|
-
CometChat.addMessageListener(
|
|
42
|
-
this.messageListenerId,
|
|
43
|
-
new CometChat.MessageListener({
|
|
44
|
-
onTextMessageReceived: (textMessage) => {
|
|
45
|
-
this.getReplies(textMessage);
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
);
|
|
49
40
|
CometChatUIEventHandler.addMessageListener(
|
|
50
41
|
MessageEvents.ccActiveChatChanged,
|
|
51
42
|
{
|
|
52
43
|
ccActiveChatChanged: ({message}) => {
|
|
53
|
-
if(message['sender']?.['uid'] != this.loggedInUser.getUid())
|
|
44
|
+
if(message && message['sender']?.['uid'] != this.loggedInUser.getUid())
|
|
54
45
|
this.getReplies(message);
|
|
55
46
|
},
|
|
47
|
+
onTextMessageReceived: (textMessage) => {
|
|
48
|
+
this.getReplies(textMessage);
|
|
49
|
+
},
|
|
56
50
|
}
|
|
57
51
|
);
|
|
58
52
|
}
|
|
@@ -89,7 +89,8 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
|
|
|
89
89
|
CometChatUIKit.sendCustomMessage(customMessage,null, null);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
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
|
@@ -116,9 +116,29 @@ import {
|
|
|
116
116
|
CometChatMediaRecorder,
|
|
117
117
|
CometChatMediaRecorderInterface,
|
|
118
118
|
MediaRecorderStyleInterface,
|
|
119
|
-
MediaRecorderStyle
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
MediaRecorderStyle,
|
|
120
|
+
CometChatFormBubble,
|
|
121
|
+
CometChatFormBubbleInterface,
|
|
122
|
+
CometChatCardBubble,
|
|
123
|
+
CometChatCardBubbleInterface,
|
|
124
|
+
APIAction,
|
|
125
|
+
ActionEntity,
|
|
126
|
+
BaseInputElement,
|
|
127
|
+
BaseInteractiveElement,
|
|
128
|
+
ButtonElement,
|
|
129
|
+
CardMessage,
|
|
130
|
+
CheckboxElement,
|
|
131
|
+
CustomAction,
|
|
132
|
+
CustomInteractiveMessage,
|
|
133
|
+
DropdownElement,
|
|
134
|
+
ElementEntity,
|
|
135
|
+
FormMessage,
|
|
136
|
+
LabelElement,
|
|
137
|
+
OptionElement,
|
|
138
|
+
RadioButtonElement,
|
|
139
|
+
SingleSelectElement,
|
|
140
|
+
TextInputElement,
|
|
141
|
+
URLNavigationAction
|
|
122
142
|
} from './shared';
|
|
123
143
|
|
|
124
144
|
import {
|
|
@@ -557,5 +577,42 @@ export {
|
|
|
557
577
|
CometChatMessageInformation,
|
|
558
578
|
CometChatMessageInformationInterface,
|
|
559
579
|
MessageInformationConfigurationInterface,
|
|
560
|
-
MessageInformationStyleInterface
|
|
580
|
+
MessageInformationStyleInterface,
|
|
581
|
+
CometChatFormBubble,
|
|
582
|
+
CometChatFormBubbleInterface,
|
|
583
|
+
CometChatCardBubble,
|
|
584
|
+
CometChatCardBubbleInterface,
|
|
585
|
+
APIAction,
|
|
586
|
+
ActionEntity,
|
|
587
|
+
BaseInputElement,
|
|
588
|
+
BaseInteractiveElement,
|
|
589
|
+
ButtonElement,
|
|
590
|
+
CardMessage,
|
|
591
|
+
CheckboxElement,
|
|
592
|
+
CustomAction,
|
|
593
|
+
CustomInteractiveMessage,
|
|
594
|
+
DropdownElement,
|
|
595
|
+
ElementEntity,
|
|
596
|
+
FormMessage,
|
|
597
|
+
LabelElement,
|
|
598
|
+
OptionElement,
|
|
599
|
+
RadioButtonElement,
|
|
600
|
+
SingleSelectElement,
|
|
601
|
+
TextInputElement,
|
|
602
|
+
URLNavigationAction
|
|
561
603
|
};
|
|
604
|
+
|
|
605
|
+
// AI
|
|
606
|
+
export { AIConversationStarterExtension } from './AI/AIConversationStarter/AIConversationStarter'
|
|
607
|
+
export { AIConversationStarterDecorator } from './AI/AIConversationStarter/AIConversationStarterDecorator'
|
|
608
|
+
export { AIConversationStarterStyle } from './AI/AIConversationStarter/AIConversationStarterStyle'
|
|
609
|
+
export { AIConversationStarterConfiguration } from './AI/AIConversationStarter/configuration'
|
|
610
|
+
export { AIEnabler } from './AI/AIEnabler'
|
|
611
|
+
export { AIEnablerDecorator } from './AI/AIEnablerDecorator'
|
|
612
|
+
export { AIExtensionDataSource } from './AI/AIExtensionDataSource'
|
|
613
|
+
export { AISmartRepliesExtension } from './AI/AISmartReplies/AISmartReplies'
|
|
614
|
+
export { AISmartRepliesExtensionDecorator } from './AI/AISmartReplies/AISmartRepliesDecorator'
|
|
615
|
+
export { AISmartRepliesStyle } from './AI/AISmartReplies/AISmartRepliesStyle'
|
|
616
|
+
export { AISmartRepliesConfiguration } from './AI/AISmartReplies/configuration'
|
|
617
|
+
export { CardStyle, CardViewStyle } from './AI/CardViewStyle'
|
|
618
|
+
export { AIEnablerConfiguration } from './AI/configuration'
|
|
@@ -19,27 +19,37 @@ 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 { CardMessage, CustomInteractiveMessage, FormMessage } from "../modals/InteractiveData";
|
|
23
|
+
import { ListenerInitializer } from "../events/ListenerInitializer";
|
|
24
|
+
import { AIEnabler } from "../../AI/AIEnabler";
|
|
25
|
+
import { AIConversationStarterExtension } from "../../AI/AIConversationStarter/AIConversationStarter";
|
|
22
26
|
|
|
23
27
|
export class CometChatUIKit {
|
|
24
28
|
static uiKitSettings: UIKitSettings;
|
|
25
|
-
|
|
29
|
+
static aiFeatures: AIEnabler
|
|
26
30
|
static init(uiKitSettings: UIKitSettings): Promise<boolean> {
|
|
27
31
|
|
|
28
32
|
//perform sdk init taking values from uiKitSettings
|
|
29
33
|
CometChatUIKit.uiKitSettings = {
|
|
30
34
|
...uiKitSettings
|
|
31
35
|
};
|
|
32
|
-
|
|
36
|
+
console.log(uiKitSettings?.overrideAdminHost, uiKitSettings.overrideClientHost)
|
|
33
37
|
var appSetting = new CometChat.AppSettingsBuilder()
|
|
34
38
|
.subscribePresenceForAllUsers()
|
|
35
39
|
.autoEstablishSocketConnection(uiKitSettings.autoEstablishSocketConnection)
|
|
40
|
+
.overrideAdminHost(uiKitSettings?.overrideAdminHost)
|
|
41
|
+
.overrideClientHost(uiKitSettings?.overrideClientHost)
|
|
36
42
|
.setRegion(uiKitSettings.region)
|
|
43
|
+
.overrideAdminHost(uiKitSettings.overrideAdminHost)
|
|
44
|
+
.overrideClientHost(uiKitSettings.overrideClientHost)
|
|
45
|
+
|
|
37
46
|
|
|
38
47
|
appSetting.subscriptionType = uiKitSettings.subscriptionType;
|
|
39
48
|
|
|
40
49
|
return CometChat.init(uiKitSettings.appId, appSetting.build()).then(
|
|
41
50
|
() => {
|
|
42
51
|
CometChat.setSource("uikit-v4", Platform.OS, "react-native")
|
|
52
|
+
ListenerInitializer.attachListeners();
|
|
43
53
|
}, error => {
|
|
44
54
|
// console.log("Initialization failed with error:", error);
|
|
45
55
|
}
|
|
@@ -67,12 +77,21 @@ export class CometChatUIKit {
|
|
|
67
77
|
if (CallingPackage.isCallingPackageInstalled)
|
|
68
78
|
new CallingExtension().enable();
|
|
69
79
|
}
|
|
70
|
-
let extensionList: ExtensionsDataSource[] = this.defaultExtensions;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
let extensionList: ExtensionsDataSource[] = this.uiKitSettings?.extensions || this.defaultExtensions;
|
|
81
|
+
|
|
82
|
+
if (extensionList.length > 0) {
|
|
83
|
+
extensionList.forEach((extension: ExtensionsDataSource) => {
|
|
84
|
+
extension?.enable();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (this.uiKitSettings.aiFeatures) {
|
|
88
|
+
this.uiKitSettings.aiFeatures?.enable()
|
|
75
89
|
}
|
|
90
|
+
else {
|
|
91
|
+
new AIEnabler().enable()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
76
95
|
}
|
|
77
96
|
|
|
78
97
|
static async getLoggedInUser(): Promise<CometChat.User> {
|
|
@@ -211,6 +230,88 @@ export class CometChatUIKit {
|
|
|
211
230
|
})
|
|
212
231
|
}
|
|
213
232
|
|
|
233
|
+
/**
|
|
234
|
+
* Sends a FormMessage message and emits events based on the message status.
|
|
235
|
+
* @param message - The FormMessage message to be sent.
|
|
236
|
+
* @param disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false.
|
|
237
|
+
*/
|
|
238
|
+
static sendFormMessage(message: FormMessage, disableLocalEvents: boolean = false, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void) {
|
|
239
|
+
if (!disableLocalEvents) {
|
|
240
|
+
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
241
|
+
}
|
|
242
|
+
CometChat.sendInteractiveMessage(message)
|
|
243
|
+
.then((message: CometChat.BaseMessage) => {
|
|
244
|
+
console.log("message sent successfully", message.getSentAt())
|
|
245
|
+
if (!disableLocalEvents) {
|
|
246
|
+
CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
|
|
247
|
+
}
|
|
248
|
+
onSuccess && onSuccess(message);
|
|
249
|
+
})
|
|
250
|
+
.catch((error: CometChat.CometChatException) => {
|
|
251
|
+
console.log("error while sending message", { error })
|
|
252
|
+
message.setMetadata({ error });
|
|
253
|
+
// if (!disableLocalEvents) {
|
|
254
|
+
// CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
|
|
255
|
+
// }
|
|
256
|
+
onError && onError(error);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Sends a Card message and emits events based on the message status.
|
|
262
|
+
* @param message - The Card message to be sent.
|
|
263
|
+
* @param disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false.
|
|
264
|
+
*/
|
|
265
|
+
static sendCardMessage(message: CardMessage, disableLocalEvents: boolean = false, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void) {
|
|
266
|
+
if (!disableLocalEvents) {
|
|
267
|
+
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
268
|
+
}
|
|
269
|
+
console.log("message", JSON.stringify(message))
|
|
270
|
+
CometChat.sendInteractiveMessage(message)
|
|
271
|
+
.then((message: CometChat.BaseMessage) => {
|
|
272
|
+
console.log("message sent successfully", message.getSentAt())
|
|
273
|
+
if (!disableLocalEvents) {
|
|
274
|
+
CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
|
|
275
|
+
}
|
|
276
|
+
onSuccess && onSuccess(message);
|
|
277
|
+
})
|
|
278
|
+
.catch((error: CometChat.CometChatException) => {
|
|
279
|
+
console.log("error while sending message", { error })
|
|
280
|
+
message.setMetadata({ error });
|
|
281
|
+
// if (!disableLocalEvents) {
|
|
282
|
+
// CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
|
|
283
|
+
// }
|
|
284
|
+
onError && onError(error);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Sends a Custom Interactive message and emits events based on the message status.
|
|
290
|
+
* @param message - The Custom Interactive message to be sent.
|
|
291
|
+
* @param disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false.
|
|
292
|
+
*/
|
|
293
|
+
static sendCustomInteractiveMessage(message: CustomInteractiveMessage, disableLocalEvents: boolean = false, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void) {
|
|
294
|
+
if (!disableLocalEvents) {
|
|
295
|
+
CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
|
|
296
|
+
}
|
|
297
|
+
CometChat.sendInteractiveMessage(message)
|
|
298
|
+
.then((message: CometChat.BaseMessage) => {
|
|
299
|
+
console.log("message sent successfully", message.getSentAt())
|
|
300
|
+
if (!disableLocalEvents) {
|
|
301
|
+
CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
|
|
302
|
+
}
|
|
303
|
+
onSuccess && onSuccess(message);
|
|
304
|
+
})
|
|
305
|
+
.catch((error: CometChat.CometChatException) => {
|
|
306
|
+
console.log("error while sending message", { error })
|
|
307
|
+
message.setMetadata({ error });
|
|
308
|
+
// if (!disableLocalEvents) {
|
|
309
|
+
// CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
|
|
310
|
+
// }
|
|
311
|
+
onError && onError(error);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
|
|
214
315
|
static getDataSource() {
|
|
215
316
|
return ChatConfigurator.getDataSource();
|
|
216
317
|
}
|
|
@@ -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
|
}
|
|
@@ -53,38 +53,38 @@ export const PASSWORD_GROUP_COLOR = "rgb(247, 165, 0)";
|
|
|
53
53
|
const wordBoundary = {
|
|
54
54
|
start: `(?:^|:|;|'|"|,|{|}|\\.|\\s|\\!|\\?|\\(|\\)|\\[|\\]|\\*)`,
|
|
55
55
|
end: `(?=$|:|;|'|"|,|{|}|\\.|\\s|\\!|\\?|\\(|\\)|\\[|\\]|\\*)`,
|
|
56
|
-
|
|
56
|
+
};
|
|
57
57
|
|
|
58
58
|
export const emailPattern =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
wordBoundary.start +
|
|
60
|
+
`[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,6}` +
|
|
61
|
+
wordBoundary.end
|
|
62
62
|
|
|
63
63
|
export const urlPattern =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
wordBoundary.start +
|
|
65
|
+
`((https?://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?)` +
|
|
66
|
+
wordBoundary.end
|
|
67
67
|
|
|
68
68
|
export const phoneNumPattern =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
wordBoundary.start +
|
|
70
|
+
`(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)` +
|
|
71
|
+
wordBoundary.end
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
export const MetadataConstants = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
liveReaction: "live_reaction",
|
|
76
|
+
file: "file",
|
|
77
|
+
extensions: {
|
|
78
|
+
thumbnailGeneration: "thumbnail-generation",
|
|
79
|
+
polls: "polls",
|
|
80
|
+
document: "document",
|
|
81
|
+
whiteboard: "whiteboard",
|
|
82
|
+
xssFilter: "xss-filter",
|
|
83
|
+
dataMasking: "data-masking",
|
|
84
|
+
profanityFilter: "profanity-filter",
|
|
85
|
+
reactions: "reactions",
|
|
86
|
+
linkPreview: "link-preview",
|
|
87
|
+
},
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
export const GroupOptionConstants = {
|
|
@@ -106,7 +106,7 @@ export const GroupMemberOptionConstants = {
|
|
|
106
106
|
ban: "ban",
|
|
107
107
|
unban: "unban",
|
|
108
108
|
changeScope: "changeScope",
|
|
109
|
-
view:'viewMember',
|
|
109
|
+
view: 'viewMember',
|
|
110
110
|
addMembers: 'addMembers',
|
|
111
111
|
deleteGroup: 'deleteGroup',
|
|
112
112
|
leave: 'leave',
|
|
@@ -157,9 +157,9 @@ export const GroupMemberOptionChangeScope: string[] = [
|
|
|
157
157
|
export const ONE_SECOND_IN_MS = 1000;
|
|
158
158
|
|
|
159
159
|
export const PATTERN = [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
1 * ONE_SECOND_IN_MS,
|
|
161
|
+
2 * ONE_SECOND_IN_MS,
|
|
162
|
+
3 * ONE_SECOND_IN_MS
|
|
163
163
|
];
|
|
164
164
|
|
|
165
165
|
export const CallContstatnts = {
|
|
@@ -183,10 +183,11 @@ export const MessageCategoryConstants = {
|
|
|
183
183
|
custom: CometChat.CATEGORY_CUSTOM,
|
|
184
184
|
action: CometChat.CATEGORY_ACTION,
|
|
185
185
|
call: CometChat.CATEGORY_CALL,
|
|
186
|
+
interactive: CometChat.CATEGORY_INTERACTIVE,
|
|
186
187
|
};
|
|
187
188
|
|
|
188
189
|
export const DefaultActionSheetItems = {
|
|
189
|
-
takeAPhoto:
|
|
190
|
+
takeAPhoto: "takeAPhoto",
|
|
190
191
|
photoAndVideoLibrary: "photoAndVideoLibrary",
|
|
191
192
|
document: "photoAndVideoLibrary",
|
|
192
193
|
poll: "poll",
|
|
@@ -197,27 +198,30 @@ export const DefaultActionSheetItems = {
|
|
|
197
198
|
|
|
198
199
|
|
|
199
200
|
export const MessageTypeConstants = {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
201
|
+
text: CometChat.MESSAGE_TYPE.TEXT,
|
|
202
|
+
file: CometChat.MESSAGE_TYPE.FILE,
|
|
203
|
+
image: CometChat.MESSAGE_TYPE.IMAGE,
|
|
204
|
+
takePhoto: 'takePhoto',
|
|
205
|
+
audio: CometChat.MESSAGE_TYPE.AUDIO,
|
|
206
|
+
video: CometChat.MESSAGE_TYPE.VIDEO,
|
|
207
|
+
groupMember: CometChat.ACTION_TYPE.TYPE_GROUP_MEMBER,
|
|
208
|
+
messageEdited: CometChat.ACTION_TYPE.MESSAGE_EDITED,
|
|
209
|
+
messageDeleted: CometChat.ACTION_TYPE.MESSSAGE_DELETED,
|
|
210
|
+
poll: "extension_poll",
|
|
211
|
+
sticker: "extension_sticker",
|
|
212
|
+
document: "extension_document",
|
|
213
|
+
whiteboard: "extension_whiteboard",
|
|
214
|
+
meeting: "meeting",
|
|
215
|
+
location: "location",
|
|
216
|
+
groupActions: "groupActions",
|
|
217
|
+
form: "form",
|
|
218
|
+
card: "card",
|
|
219
|
+
customInteractive: "customInteractive",
|
|
216
220
|
};
|
|
217
221
|
|
|
218
222
|
export const ReceiverTypeConstants = {
|
|
219
|
-
|
|
220
|
-
|
|
223
|
+
user: CometChat.RECEIVER_TYPE.USER,
|
|
224
|
+
group: CometChat.RECEIVER_TYPE.GROUP,
|
|
221
225
|
};
|
|
222
226
|
|
|
223
227
|
export const UserStatusConstants = {
|
|
@@ -345,4 +349,34 @@ export const ComponentIds = {
|
|
|
345
349
|
VIEW_MEMBERS: 'ViewMembers',
|
|
346
350
|
BANNED_MEMBERS: 'BannedMembers',
|
|
347
351
|
TRANSFER_OWNERSHIP: 'TransferOwnership'
|
|
348
|
-
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export enum ElementType {
|
|
355
|
+
label = "label",
|
|
356
|
+
text = "textInput",
|
|
357
|
+
dropdown = "dropdown",
|
|
358
|
+
checkbox = "checkbox",
|
|
359
|
+
radio = "radio",
|
|
360
|
+
button = "button",
|
|
361
|
+
singleSelect = "singleSelect",
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export enum ButtonAction {
|
|
365
|
+
apiAction = "apiAction",
|
|
366
|
+
urlNavigation = "urlNavigation",
|
|
367
|
+
custom = "custom"
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export enum HTTPSRequestMethods {
|
|
371
|
+
POST = "POST",
|
|
372
|
+
PUT = "PUT",
|
|
373
|
+
DELETE = "DELETE",
|
|
374
|
+
PATCH = "PATCH",
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export enum goalType {
|
|
378
|
+
allOf = CometChat.GoalType.ALL_OF,
|
|
379
|
+
anyOf = CometChat.GoalType.ANY_OF,
|
|
380
|
+
anyAction = CometChat.GoalType.ANY_ACTION,
|
|
381
|
+
none = CometChat.GoalType.NONE
|
|
382
|
+
}
|
|
@@ -127,6 +127,49 @@ export class CometChatUIEventHandler {
|
|
|
127
127
|
case listener._eventListener.ccActiveChatChanged?.name:
|
|
128
128
|
listener._eventListener.ccActiveChatChanged(param);
|
|
129
129
|
break
|
|
130
|
+
case listener._eventListener.onTextMessageReceived?.name:
|
|
131
|
+
listener._eventListener.onTextMessageReceived(param);
|
|
132
|
+
break
|
|
133
|
+
case listener._eventListener.onMediaMessageReceived?.name:
|
|
134
|
+
listener._eventListener.onMediaMessageReceived(param);
|
|
135
|
+
break
|
|
136
|
+
case listener._eventListener.onCustomMessageReceived?.name:
|
|
137
|
+
listener._eventListener.onCustomMessageReceived(param);
|
|
138
|
+
break
|
|
139
|
+
case listener._eventListener.onTypingStarted?.name:
|
|
140
|
+
listener._eventListener.onTypingStarted(param);
|
|
141
|
+
break
|
|
142
|
+
case listener._eventListener.onTypingEnded?.name:
|
|
143
|
+
listener._eventListener.onTypingEnded(param);
|
|
144
|
+
break
|
|
145
|
+
case listener._eventListener.onMessagesDelivered?.name:
|
|
146
|
+
listener._eventListener.onMessagesDelivered(param);
|
|
147
|
+
break
|
|
148
|
+
case listener._eventListener.onMessagesRead?.name:
|
|
149
|
+
listener._eventListener.onMessagesRead(param);
|
|
150
|
+
break
|
|
151
|
+
case listener._eventListener.onMessageEdited?.name:
|
|
152
|
+
listener._eventListener.onMessageEdited(param);
|
|
153
|
+
break
|
|
154
|
+
case listener._eventListener.onMessageDeleted?.name:
|
|
155
|
+
listener._eventListener.onMessageDeleted(param);
|
|
156
|
+
break
|
|
157
|
+
case listener._eventListener.onTransientMessageReceived?.name:
|
|
158
|
+
listener._eventListener.onTransientMessageReceived(param);
|
|
159
|
+
break
|
|
160
|
+
case listener._eventListener.onFormMessageReceived?.name:
|
|
161
|
+
listener._eventListener.onFormMessageReceived(param);
|
|
162
|
+
break
|
|
163
|
+
case listener._eventListener.onCardMessageReceived?.name:
|
|
164
|
+
listener._eventListener.onCardMessageReceived(param);
|
|
165
|
+
break
|
|
166
|
+
case listener._eventListener.onCustomInteractiveMessageReceived?.name:
|
|
167
|
+
listener._eventListener.onCustomInteractiveMessageReceived(param);
|
|
168
|
+
break
|
|
169
|
+
case listener._eventListener.onInteractionGoalCompleted?.name:
|
|
170
|
+
listener._eventListener.onInteractionGoalCompleted(param);
|
|
171
|
+
break
|
|
172
|
+
|
|
130
173
|
}
|
|
131
174
|
});
|
|
132
175
|
}
|
|
@@ -302,6 +345,9 @@ export class CometChatUIEventHandler {
|
|
|
302
345
|
case listener._eventListener.ccToggleBottomSheet?.name:
|
|
303
346
|
listener._eventListener.ccToggleBottomSheet(param);
|
|
304
347
|
break;
|
|
348
|
+
case listener._eventListener.ccComposeMessage?.name:
|
|
349
|
+
listener._eventListener.ccComposeMessage(param);
|
|
350
|
+
break;
|
|
305
351
|
}
|
|
306
352
|
})
|
|
307
353
|
}
|