@cometchat/chat-uikit-react-native 4.0.2 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +3 -3
- package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +164 -0
- package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +22 -0
- package/src/AI/AIAssistBot/AIAssistBotStyle.ts +43 -0
- package/src/AI/AIAssistBot/AIAssistBotView.tsx +294 -0
- package/src/AI/AIAssistBot/configuration.ts +22 -0
- package/src/AI/AIAssistBot/resources/index.ts +5 -0
- package/src/AI/{configuration.ts → AIBaseConfiguration.ts} +3 -6
- package/src/AI/AIBaseStyle.ts +58 -0
- package/src/AI/AIConversationStarter/AIConversationStarter.ts +5 -19
- package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +144 -130
- package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +11 -6
- package/src/AI/AIConversationStarter/configuration.ts +10 -17
- package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +175 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +21 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +20 -0
- package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +190 -0
- package/src/AI/AIConversationSummary/configuration.ts +14 -0
- package/src/AI/AIConversationSummary/resources/close.png +0 -0
- package/src/AI/AIConversationSummary/resources/index.ts +5 -0
- package/src/AI/AIExtensionDataSource.ts +17 -12
- package/src/AI/AIOptionsStyle.ts +14 -0
- package/src/AI/AISmartReplies/AISmartReplies.ts +6 -15
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +302 -0
- package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +1 -1
- package/src/AI/AISmartReplies/configuration.ts +4 -11
- package/src/AI/resources/index.ts +0 -2
- package/src/AI/utils.ts +3 -3
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +118 -5
- package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +3 -0
- package/src/CometChatMessageComposer/resources/index.ts +2 -0
- package/src/CometChatMessageComposer/styles.ts +1 -4
- package/src/CometChatMessageList/CometChatMessageList.tsx +33 -24
- package/src/CometChatMessages/CometChatMessages.tsx +4 -13
- package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
- package/src/calls/CallUtils.ts +106 -45
- package/src/calls/CallingDetailsUtils.tsx +133 -15
- package/src/calls/CallingPackage.ts +16 -2
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +9 -10
- package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +116 -0
- package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +36 -0
- package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +308 -0
- package/src/calls/CometChatCallLogDetails/index.ts +12 -0
- package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
- package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/style.ts +1 -0
- package/src/calls/{CometChatCallHistory/CallHistoryConfiguration.ts → CometChatCallLogHistory/CallLogHistoryConfiguration.ts} +15 -27
- package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +46 -0
- package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +337 -0
- package/src/calls/CometChatCallLogHistory/index.ts +12 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/index.ts +29 -0
- package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
- package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/style.ts +2 -1
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +61 -0
- package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +59 -0
- package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +220 -0
- package/src/calls/CometChatCallLogParticipants/index.ts +12 -0
- package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogParticipants/resources/index.ts +4 -0
- package/src/calls/CometChatCallLogParticipants/style.ts +24 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +63 -0
- package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +63 -0
- package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +253 -0
- package/src/calls/CometChatCallLogRecordings/index.ts +12 -0
- package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
- package/src/calls/CometChatCallLogRecordings/resources/index.ts +6 -0
- package/src/calls/CometChatCallLogRecordings/style.ts +24 -0
- package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +87 -0
- package/src/calls/CometChatCallLogs/CallLogsStyle.ts +95 -0
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +482 -0
- package/src/calls/CometChatCallLogs/index.ts +12 -0
- package/src/calls/CometChatCallLogs/resources/Back.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Selection.png +0 -0
- package/src/calls/CometChatCallLogs/resources/Spinner.png +0 -0
- package/src/calls/CometChatCallLogs/resources/check.png +0 -0
- package/src/calls/CometChatCallLogs/resources/incomingcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/incomingvideo.png +0 -0
- package/src/calls/CometChatCallLogs/resources/index.ts +25 -0
- package/src/calls/CometChatCallLogs/resources/missedcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/missedvideo.png +0 -0
- package/src/calls/CometChatCallLogs/resources/outgoingcall.png +0 -0
- package/src/calls/CometChatCallLogs/resources/outgoingvideo.png +0 -0
- package/src/calls/CometChatCallLogs/style.ts +24 -0
- package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +9 -0
- package/src/calls/{CometChatCallHistoryWithDetails/CometChatCallHistoryWithDetails.tsx → CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx} +17 -16
- package/src/calls/CometChatCallLogsWithDetails/index.ts +7 -0
- package/src/calls/index.ts +40 -1
- package/src/calls/resources/index.ts +3 -1
- package/src/calls/resources/nextarrow.png +0 -0
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +3 -5
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +1 -1
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -3
- package/src/extensions/ThumbnailGeneration/resources/empty.png +0 -0
- package/src/extensions/ThumbnailGeneration/resources/index.ts +5 -0
- package/src/index.ts +79 -4
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +154 -130
- package/src/shared/CometChatUiKit/UIKitSettings.ts +2 -2
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +1 -1
- package/src/shared/framework/DataSource.ts +4 -0
- package/src/shared/framework/DataSourceDecorator.tsx +5 -0
- package/src/shared/framework/MessageDataSource.tsx +4 -1
- package/src/shared/index.ts +4 -0
- package/src/shared/modals/CometChatCallLogDetailsOptions.ts +23 -0
- package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +16 -0
- package/src/shared/modals/index.ts +5 -1
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +21 -7
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +19 -5
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +19 -4
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +19 -5
- package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
- package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +1 -1
- package/src/shared/views/CometChatAICard/CometChatAICard.tsx +71 -0
- package/src/shared/views/CometChatAICard/resources/errormessage.png +0 -0
- package/src/shared/views/CometChatAICard/resources/index.ts +4 -0
- package/src/shared/views/CometChatAICard/resources/nomessage.png +0 -0
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +4 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +11 -7
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +56 -47
- package/src/shared/views/CometChatBottomSheet/style.ts +0 -2
- package/src/shared/views/CometChatDate/CometChatDate.tsx +7 -3
- package/src/shared/views/CometChatDate/DateConfiguration.ts +4 -0
- package/src/shared/views/CometChatDate/style.ts +1 -1
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +31 -19
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -2
- package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -0
- package/src/shared/views/CometChatPanel/PanelStyle.tsx +43 -0
- package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
- package/src/shared/views/CometChatPanel/resources/index.ts +5 -0
- package/src/AI/AIEnabler.ts +0 -115
- package/src/AI/AIEnablerDecorator.tsx +0 -324
- package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +0 -18
- package/src/calls/CometChatCallDetails/CallDetailsConfiguration.ts +0 -68
- package/src/calls/CometChatCallDetails/CallDetailsStyle.ts +0 -52
- package/src/calls/CometChatCallDetails/CometChatCallDetails.tsx +0 -268
- package/src/calls/CometChatCallDetails/index.ts +0 -9
- package/src/calls/CometChatCallHistory/CallHistoryStyle.ts +0 -34
- package/src/calls/CometChatCallHistory/CometChatCallHistory.tsx +0 -422
- package/src/calls/CometChatCallHistory/index.ts +0 -9
- package/src/calls/CometChatCallHistory/resources/index.ts +0 -17
- package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsConfiguration.ts +0 -7
- package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsStyle.ts +0 -3
- package/src/calls/CometChatCallHistoryWithDetails/index.ts +0 -8
- /package/src/{calls/CometChatCallDetails → AI/AIAssistBot}/resources/CloseIcon.png +0 -0
- /package/src/{AI → CometChatMessageComposer}/resources/ai.png +0 -0
- /package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/resources/index.ts +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Back.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Call.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Info.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Selection.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Spineer.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Video.png +0 -0
- /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/check.png +0 -0
- /package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts +0 -0
|
@@ -1,33 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AIConversationStarterDecorator } from "./AIConversationStarterDecorator";
|
|
2
|
+
import { ChatConfigurator } from "../../shared";
|
|
3
3
|
import { AIExtensionDataSource } from "../AIExtensionDataSource";
|
|
4
4
|
import { AIConversationStarterConfiguration } from "./configuration";
|
|
5
|
-
import { AIEnablerConfiguration } from "../configuration";
|
|
6
5
|
export class AIConversationStarterExtension extends AIExtensionDataSource {
|
|
7
|
-
configuration?:AIConversationStarterConfiguration;
|
|
8
|
-
constructor(configuration?:AIConversationStarterConfiguration){
|
|
6
|
+
configuration?: AIConversationStarterConfiguration;
|
|
7
|
+
constructor(configuration?: AIConversationStarterConfiguration) {
|
|
9
8
|
super()
|
|
10
9
|
this.configuration = configuration
|
|
11
10
|
|
|
12
11
|
}
|
|
13
12
|
override addExtension(): void {
|
|
14
|
-
ChatConfigurator.enable((dataSource: any) => new AIConversationStarterDecorator(dataSource,this.configuration));
|
|
13
|
+
ChatConfigurator.enable((dataSource: any) => new AIConversationStarterDecorator(dataSource, this.configuration));
|
|
15
14
|
}
|
|
16
15
|
override getExtensionId(): string {
|
|
17
16
|
return "conversation-starter";
|
|
18
17
|
}
|
|
19
|
-
override enable(): void {
|
|
20
|
-
this.addExtension()
|
|
21
|
-
}
|
|
22
|
-
override getConfiguration():AIConversationStarterConfiguration{
|
|
23
|
-
return this.configuration
|
|
24
|
-
}
|
|
25
|
-
override setConfiguration(config?:AIEnablerConfiguration):void{
|
|
26
|
-
this.configuration = {...this.configuration,...config}
|
|
27
|
-
this.configuration.conversationStarterStyle = {
|
|
28
|
-
...this.configuration.conversationStarterStyle,
|
|
29
|
-
...(config?.listItemStyle || config?.listStyle)
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
18
|
|
|
33
19
|
}
|
|
@@ -1,179 +1,156 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, View, Text, ScrollView } from "react-native";
|
|
3
3
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
|
+
import { CometChatTheme, CometChatUIEventHandler, CometChatUIEvents, DataSource, DataSourceDecorator, MessageEvents, localize } from "../../shared";
|
|
4
5
|
import { MessageStatusConstants, ReceiverTypeConstants, ViewAlignment } from "../../shared/constants/UIKitConstants";
|
|
5
|
-
import { Image, TouchableOpacity,View,Text,ScrollView } from "react-native";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { loadingIcon,emptyIcon,errorIcon } from "../resources";
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
import { getCardViewStyle , getRepliesWrapperStyle, getRepliesStyle,getloadingStateStyle} from "./style";
|
|
7
|
+
import { getCardViewStyle, getRepliesWrapperStyle, getRepliesStyle } from "./style";
|
|
11
8
|
import { State } from "../utils";
|
|
12
9
|
import { AIConversationStarterConfiguration } from "./configuration";
|
|
13
10
|
import { CardViewStyle } from "../CardViewStyle";
|
|
11
|
+
import CometChatAICard from "../../shared/views/CometChatAICard/CometChatAICard";
|
|
14
12
|
export class AIConversationStarterDecorator extends DataSourceDecorator {
|
|
15
|
-
public configuration?:AIConversationStarterConfiguration;
|
|
16
|
-
public currentMessage:CometChat.BaseMessage | null = null;
|
|
17
|
-
public loggedInUser!:CometChat.User | null;
|
|
13
|
+
public configuration?: AIConversationStarterConfiguration;
|
|
14
|
+
public currentMessage: CometChat.BaseMessage | null = null;
|
|
15
|
+
public loggedInUser!: CometChat.User | null;
|
|
18
16
|
messageListenerId = 'message_' + new Date().getTime();
|
|
19
17
|
public user!: CometChat.User;
|
|
20
18
|
public group!: CometChat.Group;
|
|
21
|
-
public cardViewStyle:CardViewStyle = {};
|
|
22
|
-
public errorStateText:string = localize("SOMETHING_WRONG");
|
|
23
|
-
public emptyStateText:string = localize("NO_MESSAGES_FOUND");
|
|
24
|
-
public theme:CometChatTheme;
|
|
25
|
-
constructor(dataSource:DataSource, configuration?:AIConversationStarterConfiguration){
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if(theme){
|
|
44
|
-
this.theme = theme;
|
|
45
|
-
}
|
|
46
|
-
else{
|
|
47
|
-
this.theme = new CometChatTheme({});
|
|
48
|
-
}
|
|
49
|
-
if(!message && !parentMessageId){
|
|
50
|
-
this.attachMessageListener()
|
|
51
|
-
this.showDefaultPanel(State.loading)
|
|
52
|
-
this.getConversationStarter().then((replies) => {
|
|
53
|
-
if(!replies || (replies?.length && replies.length <= 0)){
|
|
19
|
+
public cardViewStyle: CardViewStyle = {};
|
|
20
|
+
public errorStateText: string = localize("SOMETHING_WRONG");
|
|
21
|
+
public emptyStateText: string = localize("NO_MESSAGES_FOUND");
|
|
22
|
+
public theme: CometChatTheme;
|
|
23
|
+
constructor(dataSource: DataSource, configuration?: AIConversationStarterConfiguration) {
|
|
24
|
+
|
|
25
|
+
super(dataSource);
|
|
26
|
+
|
|
27
|
+
this.configuration = configuration;
|
|
28
|
+
|
|
29
|
+
setTimeout(() => {
|
|
30
|
+
this.listeners();
|
|
31
|
+
}, 1000);
|
|
32
|
+
}
|
|
33
|
+
override getId(): string {
|
|
34
|
+
return "aiconversationstarter";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private loadConversationStarter(): void {
|
|
38
|
+
this.getConversationStarter()
|
|
39
|
+
.then((replies) => {
|
|
40
|
+
if (!replies || (replies?.length && replies.length <= 0)) {
|
|
54
41
|
this.showDefaultPanel(State.empty)
|
|
55
|
-
|
|
56
42
|
}
|
|
57
|
-
else{
|
|
43
|
+
else {
|
|
58
44
|
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.showPanel, {
|
|
59
45
|
alignment: ViewAlignment.composerTop,
|
|
60
46
|
child: () => (
|
|
61
|
-
<View style={{boxShadow:this.cardViewStyle?.boxShadow,
|
|
47
|
+
<View style={{ boxShadow: this.cardViewStyle?.boxShadow, width: this.cardViewStyle?.width || "100%", height: this.cardViewStyle?.height || 130, backgroundColor: this.cardViewStyle?.backgroundColor, borderRadius: this.cardViewStyle?.borderRadius, ...this.cardViewStyle?.border }}>
|
|
62
48
|
<ScrollView style={{ height: "100%", width: "100%" }}>
|
|
63
49
|
{replies}
|
|
64
50
|
</ScrollView>
|
|
65
|
-
|
|
66
|
-
|
|
67
51
|
</View>
|
|
68
|
-
|
|
69
52
|
),
|
|
70
53
|
});
|
|
71
54
|
}
|
|
72
55
|
|
|
73
56
|
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
console.log(err);
|
|
59
|
+
this.showDefaultPanel(State.error)
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private getLoadingView(): JSX.Element {
|
|
65
|
+
let LoadingView: JSX.Element = this.configuration?.LoadingStateView
|
|
66
|
+
return (
|
|
67
|
+
<CometChatAICard
|
|
68
|
+
state={State.loading}
|
|
69
|
+
style={this.configuration?.conversationStarterStyle}
|
|
70
|
+
loadingIconURL={this.configuration?.loadingIconURL}// || loadingIconURL}
|
|
71
|
+
loadingStateText={localize("GENERATIONG_ICEBREAKER")}
|
|
72
|
+
>
|
|
73
|
+
{LoadingView ? <LoadingView /> : null}
|
|
74
|
+
</CometChatAICard>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private getEmptyView(): JSX.Element {
|
|
79
|
+
let EmptyView: JSX.Element = this.configuration?.EmptyStateView
|
|
80
|
+
return (
|
|
81
|
+
<CometChatAICard
|
|
82
|
+
state={State.empty}
|
|
83
|
+
style={this.configuration?.conversationStarterStyle}
|
|
84
|
+
emptyIconURL={this.configuration?.emptyIconURL}// || emptyIcon}
|
|
85
|
+
emptyStateText={this.emptyStateText}
|
|
86
|
+
>
|
|
87
|
+
{EmptyView ? <EmptyView /> : null}
|
|
88
|
+
</CometChatAICard>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private getErrorView(error?: CometChat.CometChatException): JSX.Element {
|
|
93
|
+
return (
|
|
94
|
+
<CometChatAICard
|
|
95
|
+
state={State.error}
|
|
96
|
+
style={this.configuration?.conversationStarterStyle}
|
|
97
|
+
errorIconURL={this.configuration?.errorIconURL}// || errorIcon}
|
|
98
|
+
errorStateText={this.errorStateText}
|
|
99
|
+
>
|
|
100
|
+
{this.configuration?.ErrorStateView ? this.configuration?.ErrorStateView(error) : null}
|
|
101
|
+
</CometChatAICard>
|
|
102
|
+
)
|
|
92
103
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
let EmptyView:JSX.Element = this.configuration?.EmptyStateView
|
|
104
|
+
|
|
105
|
+
showDefaultPanel(state: State = State.loading, error?: CometChat.CometChatException) {
|
|
96
106
|
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.showPanel, {
|
|
97
107
|
alignment: ViewAlignment.composerTop,
|
|
98
108
|
child: () => (
|
|
99
|
-
<View style={{ width: this.cardViewStyle?.width || "100%", height: 'auto', backgroundColor: this.cardViewStyle?.backgroundColor, borderRadius:this.cardViewStyle?.borderRadius, ...this.cardViewStyle?.border, justifyContent: "center", alignItems: "center" }}>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
source={this.configuration?.loadingIconURL ?? loadingIcon}
|
|
103
|
-
style={{ height: 32, width: 32,tintColor:this.cardViewStyle?.loadingIconTint}}
|
|
104
|
-
/>
|
|
105
|
-
<Text style={getloadingStateStyle(this.theme,this.configuration)}> {localize("GENERATIONG_ICEBREAKER")}</Text>
|
|
106
|
-
</View>
|
|
107
|
-
|
|
108
|
-
:
|
|
109
|
-
|
|
110
|
-
state == State.empty ? EmptyView ? <EmptyView/> : <View style={{ width: this.cardViewStyle?.width || "100%", height: 'auto', backgroundColor: this.cardViewStyle?.backgroundColor, borderRadius:this.cardViewStyle?.borderRadius, ...this.cardViewStyle?.border, justifyContent: "center", alignItems: "center" ,flexDirection:"row",paddingBottom:8}}>
|
|
111
|
-
<Image
|
|
112
|
-
source={this.configuration?.emptyIconURL ?? emptyIcon}
|
|
113
|
-
style={{ height: 32, width: 32,tintColor:this.cardViewStyle?.emptyIconTint}}
|
|
114
|
-
/>
|
|
115
|
-
<Text style={emptyLabelStyle(this.cardViewStyle)} >{this.emptyStateText}</Text>
|
|
116
|
-
</View>
|
|
117
|
-
: this.configuration?.ErrorStateView ? this.configuration?.ErrorStateView(error) :
|
|
118
|
-
<View style={{ width: this.cardViewStyle?.width || "100%", height: 'auto', backgroundColor: this.cardViewStyle?.backgroundColor, borderRadius:this.cardViewStyle?.borderRadius, ...this.cardViewStyle?.border, justifyContent: "center", alignItems: "center",flexDirection:"row",paddingBottom:8 }}>
|
|
119
|
-
<Image
|
|
120
|
-
source={this.configuration?.errorIconURL ?? errorIcon}
|
|
121
|
-
style={{ height: 32, width: 32,tintColor:this.cardViewStyle?.errorIconTint}}
|
|
122
|
-
/>
|
|
123
|
-
<Text style={errorLabelStyle(this.cardViewStyle)} >{this.errorStateText}</Text>
|
|
124
|
-
</View>
|
|
125
|
-
|
|
109
|
+
<View style={{ width: this.cardViewStyle?.width || "100%", height: 'auto', backgroundColor: this.cardViewStyle?.backgroundColor, borderRadius: this.cardViewStyle?.borderRadius, ...this.cardViewStyle?.border, justifyContent: "center", alignItems: "center" }}>
|
|
110
|
+
{state == State.loading ? this.getLoadingView()
|
|
111
|
+
: state == State.empty ? this.getEmptyView() : this.getErrorView(error)
|
|
126
112
|
}
|
|
113
|
+
</View>
|
|
127
114
|
|
|
128
|
-
|
|
129
|
-
</View>
|
|
130
|
-
|
|
131
115
|
),
|
|
132
116
|
});
|
|
133
117
|
}
|
|
118
|
+
|
|
134
119
|
editReply(reply: string) {
|
|
135
|
-
this.closePanel();
|
|
120
|
+
this.closePanel();
|
|
136
121
|
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.ccComposeMessage, { text: reply });
|
|
137
122
|
}
|
|
123
|
+
|
|
138
124
|
closePanel = () => {
|
|
139
125
|
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.hidePanel, {
|
|
140
126
|
alignment: ViewAlignment.composerTop,
|
|
141
127
|
child: () => (null),
|
|
142
128
|
});
|
|
143
129
|
}
|
|
144
|
-
|
|
145
|
-
|
|
130
|
+
|
|
131
|
+
closeIfMessageReceived(message) {
|
|
132
|
+
if (message?.receiverId == this.loggedInUser?.uid) {
|
|
146
133
|
this.closePanel()
|
|
147
134
|
}
|
|
148
135
|
}
|
|
136
|
+
|
|
149
137
|
getConversationStarter(): Promise<JSX.Element> {
|
|
150
138
|
return new Promise((resolve, reject) => {
|
|
151
139
|
let receiverId: string = this.user ? this.user?.getUid() : this.group?.getGuid();
|
|
152
140
|
let receiverType: string = this.user ? ReceiverTypeConstants.user : ReceiverTypeConstants.group;
|
|
153
141
|
if (this.configuration?.customView) {
|
|
154
142
|
CometChat.getConversationStarter(receiverId, receiverType).then((response: any) => {
|
|
155
|
-
this.configuration.customView(response).then((res)=>{
|
|
143
|
+
this.configuration.customView(response).then((res) => {
|
|
156
144
|
return resolve((<View>{res}</View>))
|
|
157
|
-
|
|
158
145
|
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
146
|
+
.catch((err: CometChat.CometChatException) => {
|
|
147
|
+
return reject(err)
|
|
148
|
+
})
|
|
163
149
|
})
|
|
164
150
|
.catch((err: CometChat.CometChatException) => {
|
|
165
151
|
return reject(err)
|
|
166
152
|
})
|
|
167
153
|
}
|
|
168
|
-
else if (this.configuration?.onLoad) {
|
|
169
|
-
this.configuration?.onLoad(this.user, this.group).then((response: any) => {
|
|
170
|
-
return resolve((<View>{response}</View>))
|
|
171
|
-
})
|
|
172
|
-
.catch((err: CometChat.CometChatException) => {
|
|
173
|
-
return reject(err)
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
}
|
|
177
154
|
else {
|
|
178
155
|
CometChat.getConversationStarter(receiverId, receiverType).then((response: any) => {
|
|
179
156
|
let view: JSX.Element[] = [];
|
|
@@ -182,19 +159,15 @@ this.closePanel();
|
|
|
182
159
|
view.push(
|
|
183
160
|
(<TouchableOpacity
|
|
184
161
|
style={getRepliesWrapperStyle(this.theme, this.configuration?.conversationStarterStyle)}
|
|
185
|
-
key={response[reply]}
|
|
162
|
+
key={response[reply]}
|
|
186
163
|
onPress={() => this.editReply(response[reply])}
|
|
187
164
|
>
|
|
188
165
|
<Text style={getRepliesStyle(this.theme, this.configuration?.conversationStarterStyle)}>{response[reply]}</Text>
|
|
189
166
|
</TouchableOpacity>)
|
|
190
|
-
|
|
191
167
|
)
|
|
192
168
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
169
|
})
|
|
196
170
|
return resolve((<View>{view}</View>))
|
|
197
|
-
|
|
198
171
|
})
|
|
199
172
|
.catch((err: CometChat.CometChatException) => {
|
|
200
173
|
return reject(err)
|
|
@@ -203,27 +176,68 @@ this.closePanel();
|
|
|
203
176
|
|
|
204
177
|
})
|
|
205
178
|
}
|
|
206
|
-
attachMessageListener(){
|
|
207
179
|
|
|
208
|
-
|
|
180
|
+
attachMessageListener() {
|
|
181
|
+
this.cardViewStyle = getCardViewStyle(this.theme, this.configuration?.conversationStarterStyle)
|
|
209
182
|
CometChatUIEventHandler.addMessageListener(
|
|
210
183
|
this.messageListenerId,
|
|
211
184
|
{
|
|
212
185
|
onTextMessageReceived: (textMessage) => {
|
|
213
186
|
this.closeIfMessageReceived(textMessage)
|
|
214
|
-
|
|
215
187
|
},
|
|
216
188
|
onMediaMessageReceived: (mediaMessage) => {
|
|
217
189
|
this.closeIfMessageReceived(mediaMessage)
|
|
218
|
-
|
|
219
190
|
},
|
|
220
191
|
onCustomMessageReceived: (customMessage) => {
|
|
221
192
|
this.closeIfMessageReceived(customMessage)
|
|
222
|
-
|
|
193
|
+
},
|
|
194
|
+
onFormMessageReceived: (formMessage) => {
|
|
195
|
+
this.closeIfMessageReceived(formMessage)
|
|
196
|
+
},
|
|
197
|
+
onCardMessageReceived: (cardMessage) => {
|
|
198
|
+
this.closeIfMessageReceived(cardMessage)
|
|
199
|
+
},
|
|
200
|
+
onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
|
|
201
|
+
this.closeIfMessageReceived(customInteractiveMessage)
|
|
223
202
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private listeners() {
|
|
207
|
+
|
|
208
|
+
CometChat.getLoggedinUser()
|
|
209
|
+
.then((u) => {
|
|
210
|
+
this.loggedInUser = u;
|
|
211
|
+
})
|
|
212
|
+
.catch((err) => console.log(err));
|
|
213
|
+
|
|
214
|
+
CometChatUIEventHandler.addMessageListener(
|
|
215
|
+
MessageEvents.ccActiveChatChanged + "_STARTER",
|
|
216
|
+
{
|
|
217
|
+
ccActiveChatChanged: ({ message, user, group, theme, parentMessageId }) => {
|
|
218
|
+
this.user = user;
|
|
219
|
+
this.group = group;
|
|
220
|
+
if (theme) {
|
|
221
|
+
this.theme = theme;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this.theme = new CometChatTheme({});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (!message && !parentMessageId) {
|
|
228
|
+
this.attachMessageListener()
|
|
229
|
+
this.showDefaultPanel(State.loading)
|
|
230
|
+
this.loadConversationStarter();
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
ccMessageSent: ({ message, status }) => {
|
|
234
|
+
if (status == MessageStatusConstants.success && message?.sender?.uid == this.loggedInUser?.uid) {
|
|
235
|
+
this.closePanel();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
|
|
227
241
|
}
|
|
228
242
|
}
|
|
229
243
|
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AIBaseStyle } from "../AIBaseStyle";
|
|
2
2
|
|
|
3
|
-
export class AIConversationStarterStyle extends
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export class AIConversationStarterStyle extends AIBaseStyle {
|
|
4
|
+
repliesTextFont?: string;
|
|
5
|
+
repliesTextBorder?: string;
|
|
6
|
+
repliesTextBorderRadius?: string;
|
|
7
|
+
repliesTextColor?: string;
|
|
8
|
+
repliesTextBackground?: string;
|
|
9
|
+
constructor(props: Partial<AIConversationStarterStyle>) {
|
|
10
|
+
super({});
|
|
6
11
|
Object.assign(this, props);
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {CometChat} from '@cometchat/chat-sdk-react-native'
|
|
2
1
|
import { AIConversationStarterStyle } from './AIConversationStarterStyle';
|
|
3
|
-
import {
|
|
4
|
-
export class AIConversationStarterConfiguration {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
emptyIconURL?:string = emptyIcon;
|
|
14
|
-
constructor(props: Partial<AIConversationStarterConfiguration>) {
|
|
15
|
-
Object.assign(this, props);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
2
|
+
import { AIBaseConfiguration } from '../AIBaseConfiguration';
|
|
3
|
+
export class AIConversationStarterConfiguration extends AIBaseConfiguration {
|
|
4
|
+
conversationStarterStyle?: AIConversationStarterStyle;
|
|
5
|
+
customView?: (response: Object) => Promise<Object>;
|
|
6
|
+
constructor(props: Partial<AIConversationStarterConfiguration>) {
|
|
7
|
+
super({})
|
|
8
|
+
Object.assign(this, props);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
3
|
+
import AIConversationSummaryView from "./AIConversationSummaryView";
|
|
4
|
+
import { CometChatMessageComposerActionInterface, CometChatTheme, CometChatUIEventHandler, CometChatUIEvents, DataSource, DataSourceDecorator, MessageEvents, localize } from "../../shared";
|
|
5
|
+
import { MessageStatusConstants, ReceiverTypeConstants, ViewAlignment } from "../../shared/constants/UIKitConstants";
|
|
6
|
+
import { AIConversationSummaryConfiguration } from "./configuration";
|
|
7
|
+
import { AIOptionsStyle } from "../AIOptionsStyle";
|
|
8
|
+
|
|
9
|
+
export class AIConversationSummaryDecorator extends DataSourceDecorator {
|
|
10
|
+
public configuration?: AIConversationSummaryConfiguration;
|
|
11
|
+
public newDataSource!: DataSource;
|
|
12
|
+
public currentMessage: CometChat.BaseMessage | null = null;
|
|
13
|
+
public unreadMessageCount: number = 0;
|
|
14
|
+
public loggedInUser!: CometChat.User | null;
|
|
15
|
+
public user!: CometChat.User;
|
|
16
|
+
public group!: CometChat.Group;
|
|
17
|
+
public theme: CometChatTheme = new CometChatTheme({});
|
|
18
|
+
private LISTENER_ID: string = "aiconversationsummary__listener";
|
|
19
|
+
|
|
20
|
+
constructor(
|
|
21
|
+
dataSource: DataSource,
|
|
22
|
+
configuration?: AIConversationSummaryConfiguration
|
|
23
|
+
) {
|
|
24
|
+
super(dataSource);
|
|
25
|
+
this.newDataSource = dataSource;
|
|
26
|
+
this.configuration = configuration!;
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
this.addMessageListener();
|
|
29
|
+
}, 1000);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
override getId(): string {
|
|
33
|
+
return "aiconversationsummary";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
editReply(reply: string) {
|
|
37
|
+
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.ccComposeMessage, { text: reply });
|
|
38
|
+
this.closePanel();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
closePanel = () => {
|
|
42
|
+
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.hidePanel, {
|
|
43
|
+
alignment: ViewAlignment.composerTop,
|
|
44
|
+
child: () => (null),
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
closeIfMessageReceived(message: CometChat.BaseMessage) {
|
|
49
|
+
if (message?.getReceiverId() === this.loggedInUser?.getUid()) {
|
|
50
|
+
this.closePanel();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getConversationSummary = (theme?: CometChatTheme): Promise<string> => {
|
|
55
|
+
this.theme = theme ?? new CometChatTheme({});
|
|
56
|
+
return new Promise(async (resolve, reject) => {
|
|
57
|
+
try {
|
|
58
|
+
let receiverId: string = this.user
|
|
59
|
+
? this.user?.getUid()
|
|
60
|
+
: this.group?.getGuid();
|
|
61
|
+
let receiverType: string = this.user
|
|
62
|
+
? ReceiverTypeConstants.user
|
|
63
|
+
: ReceiverTypeConstants.group;
|
|
64
|
+
let configuration;
|
|
65
|
+
if (this.configuration?.apiConfiguration) {
|
|
66
|
+
configuration = await this.configuration?.apiConfiguration(
|
|
67
|
+
this.user,
|
|
68
|
+
this.group
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const response = await CometChat.getConversationSummary(
|
|
72
|
+
receiverId,
|
|
73
|
+
receiverType,
|
|
74
|
+
configuration ? configuration : {}
|
|
75
|
+
);
|
|
76
|
+
return resolve(response);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
reject(e);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
private loadConversationSummary(): void {
|
|
84
|
+
this.onClose();
|
|
85
|
+
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.showPanel, {
|
|
86
|
+
alignment: ViewAlignment.messageListBottom,
|
|
87
|
+
child: () => (
|
|
88
|
+
<AIConversationSummaryView configuration={this.configuration} getConversationSummaryCallback={this.getConversationSummary}
|
|
89
|
+
theme={this.theme} editReplyCallback={this.editReply} onPanelClose={this.onClose} />
|
|
90
|
+
),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private onClose = () => {
|
|
95
|
+
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.hidePanel, {
|
|
96
|
+
alignment: ViewAlignment.messageListBottom,
|
|
97
|
+
child: () => (null),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
override getAIOptions(user: CometChat.User | null, group: CometChat.Group | null, theme: CometChatTheme, id?: any, AIOptionsStyle?: AIOptionsStyle): CometChatMessageComposerActionInterface[] {
|
|
102
|
+
this.user = user!;
|
|
103
|
+
this.group = group!;
|
|
104
|
+
if (!id?.parentMessageId) {
|
|
105
|
+
const messageComposerActions: CometChatMessageComposerActionInterface[] = super.getAIOptions(user, group, theme, id, AIOptionsStyle);
|
|
106
|
+
let newAction = {
|
|
107
|
+
title: localize("GENERATE_SUMMARY"),
|
|
108
|
+
onPress: () => { this.loadConversationSummary() },
|
|
109
|
+
id: "ai-conversation-summary",
|
|
110
|
+
iconURL: '',
|
|
111
|
+
iconTint: '',
|
|
112
|
+
titleColor: this.configuration?.conversationSummaryStyle?.buttonTextColor || AIOptionsStyle.listItemTitleColor,
|
|
113
|
+
titleFont: this.configuration?.conversationSummaryStyle?.buttonTextFont || AIOptionsStyle.listItemTitleFont,
|
|
114
|
+
background: this.configuration?.conversationSummaryStyle?.backgroundColor || AIOptionsStyle.listItemBackground,
|
|
115
|
+
cornerRadius: this.configuration?.conversationSummaryStyle?.buttonBorderRadius || AIOptionsStyle.listItemBorderRadius,
|
|
116
|
+
};
|
|
117
|
+
messageComposerActions.push(newAction);
|
|
118
|
+
return messageComposerActions;
|
|
119
|
+
} else {
|
|
120
|
+
return super.getAIOptions(user, group, theme, id, AIOptionsStyle);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private addMessageListener(): void {
|
|
125
|
+
CometChat.getLoggedinUser().then((user: CometChat.User | null) => {
|
|
126
|
+
if (user) {
|
|
127
|
+
this.loggedInUser = user;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
CometChatUIEventHandler.addMessageListener(this.LISTENER_ID, {
|
|
132
|
+
onTextMessageReceived: (message: CometChat.TextMessage) => {
|
|
133
|
+
this.closeIfMessageReceived(message);
|
|
134
|
+
},
|
|
135
|
+
onCustomMessageReceived: (message: CometChat.CustomMessage) => {
|
|
136
|
+
this.closeIfMessageReceived(message);
|
|
137
|
+
},
|
|
138
|
+
onMediaMessageReceived: (message: CometChat.MediaMessage) => {
|
|
139
|
+
this.closeIfMessageReceived(message);
|
|
140
|
+
},
|
|
141
|
+
onFormMessageReceived: (formMessage) => {
|
|
142
|
+
this.closeIfMessageReceived(formMessage)
|
|
143
|
+
},
|
|
144
|
+
onCardMessageReceived: (cardMessage) => {
|
|
145
|
+
this.closeIfMessageReceived(cardMessage)
|
|
146
|
+
},
|
|
147
|
+
onCustomInteractiveMessageReceived: (customInteractiveMessage) => {
|
|
148
|
+
this.closeIfMessageReceived(customInteractiveMessage)
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
CometChatUIEventHandler.addMessageListener(
|
|
153
|
+
MessageEvents.ccActiveChatChanged,
|
|
154
|
+
{
|
|
155
|
+
ccActiveChatChanged: (data) => {
|
|
156
|
+
this.currentMessage = data.message!;
|
|
157
|
+
this.user = data.user!;
|
|
158
|
+
this.group = data.group!;
|
|
159
|
+
this.unreadMessageCount = data.unreadMessageCount ?? 0;
|
|
160
|
+
if (this.unreadMessageCount >= (this.configuration?.unreadMessageThreshold ?? 30)) {
|
|
161
|
+
this.loadConversationSummary();
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
ccMessageSent: ({ message, status }) => {
|
|
165
|
+
if (status == MessageStatusConstants.success && message?.sender?.uid == this.loggedInUser?.uid) {
|
|
166
|
+
this.closePanel();
|
|
167
|
+
this.currentMessage = null;
|
|
168
|
+
this.unreadMessageCount = 0;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChatConfigurator } from "../../shared";
|
|
2
|
+
import { AIExtensionDataSource } from "../AIExtensionDataSource";
|
|
3
|
+
import { AIConversationSummaryDecorator } from "./AIConversationSummaryDecorator";
|
|
4
|
+
import { AIConversationSummaryConfiguration } from "./configuration";
|
|
5
|
+
|
|
6
|
+
export class AIConversationSummaryExtension extends AIExtensionDataSource {
|
|
7
|
+
private configuration?: AIConversationSummaryConfiguration;
|
|
8
|
+
|
|
9
|
+
constructor(configuration?: AIConversationSummaryConfiguration) {
|
|
10
|
+
super();
|
|
11
|
+
this.configuration = configuration;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override addExtension(): void {
|
|
15
|
+
ChatConfigurator.enable((dataSource: any) => new AIConversationSummaryDecorator(dataSource, this.configuration));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override getExtensionId(): string {
|
|
19
|
+
return "conversation-summary";
|
|
20
|
+
}
|
|
21
|
+
}
|