agora-appbuilder-core 4.1.0-beta-2 → 4.1.0-beta-4
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/package.json +1 -1
- package/template/customization-api/atoms.ts +1 -0
- package/template/customization-api/customize.tsx +11 -0
- package/template/customization-api/sub-components.ts +2 -0
- package/template/src/ai-agent/assets/join-call.png +0 -0
- package/template/src/ai-agent/assets/leave-call.png +0 -0
- package/template/src/ai-agent/components/AgentControls/AgentConnectionWrapper.tsx +248 -0
- package/template/src/ai-agent/components/AgentControls/AgentContext.tsx +23 -1
- package/template/src/ai-agent/components/AgentControls/const.ts +38 -5
- package/template/src/ai-agent/components/AgentControls/index.tsx +60 -257
- package/template/src/ai-agent/components/AudioVisualizer.tsx +32 -20
- package/template/src/ai-agent/components/Bottombar.tsx +114 -51
- package/template/src/ai-agent/components/{CustomSidePanel.tsx → CustomChatPanel.tsx} +3 -3
- package/template/src/ai-agent/components/CustomCreate.tsx +7 -185
- package/template/src/ai-agent/components/CustomSettingsPanel.tsx +193 -0
- package/template/src/ai-agent/components/SelectAiAgent.tsx +74 -0
- package/template/src/ai-agent/components/SelectAiAgentVoice.tsx +68 -0
- package/template/src/ai-agent/components/UserPrompt.tsx +64 -0
- package/template/src/ai-agent/components/agent-chat-panel/agent-chat-ui.tsx +13 -11
- package/template/src/ai-agent/components/mobile/Bottombar.tsx +55 -39
- package/template/src/ai-agent/components/mobile/MobileLayoutComponent.tsx +1 -1
- package/template/src/ai-agent/components/mobile/Topbar.tsx +10 -27
- package/template/src/ai-agent/components/utils.ts +17 -0
- package/template/src/ai-agent/index.tsx +61 -206
- package/template/src/atoms/Dropdown.tsx +1 -1
- package/template/src/auth/AuthProvider.tsx +19 -0
- package/template/src/components/SettingsView.tsx +7 -3
- package/template/src/components/room-info/useRoomInfo.tsx +21 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +18 -3
- package/template/src/subComponents/FallbackLogo.tsx +1 -3
- package/template/src/subComponents/SelectDevice.tsx +7 -7
- package/template/src/subComponents/SidePanelHeader.tsx +2 -2
- package/template/src/utils/useJoinRoom.ts +40 -8
- package/template/src/ai-agent/components/AgentControls/LeaveCall.png +0 -0
- package/template/src/ai-agent/components/AgentControls/Vector.svg +0 -3
- package/template/src/ai-agent/components/CustomCreateNative.tsx +0 -265
- package/template/src/ai-agent/components/icons.tsx +0 -227
|
@@ -1,86 +1,22 @@
|
|
|
1
|
-
import React, {useContext
|
|
1
|
+
import React, {useContext} from 'react';
|
|
2
2
|
import {AI_AGENT_STATE, AgentState} from './const';
|
|
3
|
-
import {TouchableOpacity, Text, ActivityIndicator} from 'react-native';
|
|
3
|
+
import {TouchableOpacity, Text, ActivityIndicator, Image} from 'react-native';
|
|
4
4
|
import {AgentContext} from './AgentContext';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
useHistory,
|
|
12
|
-
useStorageContext,
|
|
13
|
-
Toast,
|
|
14
|
-
} from 'customization-api';
|
|
5
|
+
import {ThemeConfig} from 'customization-api';
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
import JoinCallIcon from '../../assets/join-call.png';
|
|
8
|
+
//@ts-ignore
|
|
9
|
+
import LeaveCallIcon from '../../assets/leave-call.png';
|
|
10
|
+
import {AgentConnectionContext} from './AgentConnectionWrapper';
|
|
15
11
|
import {isMobileUA} from '../../../utils/common';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
const connectToAIAgent = async (
|
|
19
|
-
agentAction: 'start' | 'stop',
|
|
20
|
-
channel_name: string,
|
|
21
|
-
localUid: UidType,
|
|
22
|
-
agentAuthToken: string,
|
|
23
|
-
): Promise<{}> => {
|
|
24
|
-
// const apiUrl = '/api/proxy';
|
|
25
|
-
const apiUrl = $config.BACKEND_ENDPOINT + '/v1/convoai';
|
|
26
|
-
const requestBody = {
|
|
27
|
-
channel_name: channel_name,
|
|
28
|
-
uid: localUid, // user uid // localUid or 0
|
|
29
|
-
};
|
|
30
|
-
console.log({requestBody});
|
|
31
|
-
const headers: HeadersInit = {
|
|
32
|
-
'Content-Type': 'application/json',
|
|
33
|
-
Authorization: `Bearer ${agentAuthToken}`,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
const response = await fetch(`${apiUrl}/${agentAction}`, {
|
|
38
|
-
method: 'POST',
|
|
39
|
-
headers: headers,
|
|
40
|
-
body: JSON.stringify(requestBody),
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
if (!response.ok) {
|
|
44
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const data = await response.json();
|
|
48
|
-
|
|
49
|
-
// console.log({data}, "X-Client-ID start stop")
|
|
50
|
-
console.log(
|
|
51
|
-
`AI agent ${agentAction === 'start' ? 'connected' : 'disconnected'}`,
|
|
52
|
-
data,
|
|
53
|
-
);
|
|
54
|
-
if (agentAction === 'start') {
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error(`Failed to ${agentAction} AI agent connection:`, error);
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const AgentControl: React.FC<{channel_name: string}> = ({
|
|
64
|
-
channel_name,
|
|
65
|
-
}) => {
|
|
66
|
-
const {
|
|
67
|
-
agentConnectionState,
|
|
68
|
-
setAgentConnectionState,
|
|
69
|
-
agentAuthToken,
|
|
70
|
-
setAgentAuthToken,
|
|
71
|
-
agentUID,
|
|
72
|
-
setAgentUID,
|
|
73
|
-
} = useContext(AgentContext);
|
|
74
|
-
// console.log("X-Client-ID state", clientId)
|
|
75
|
-
// const { users } = useContext(UserContext)
|
|
76
|
-
const {activeUids: users} = useContent();
|
|
77
|
-
const endcall = useEndCall();
|
|
78
|
-
const history = useHistory();
|
|
79
|
-
const {store} = useStorageContext();
|
|
80
|
-
const localUid = useLocalUid();
|
|
12
|
+
import {useIsAgentAvailable} from '../utils';
|
|
81
13
|
|
|
14
|
+
export const AgentControl: React.FC = () => {
|
|
15
|
+
const {agentConnectionState} = useContext(AgentContext);
|
|
16
|
+
const {toggleAgentConnection} = useContext(AgentConnectionContext);
|
|
82
17
|
// stop_agent API is successful, but agent has not yet left the RTC channel
|
|
83
18
|
const isAwaitingLeave = agentConnectionState === AgentState.AWAITING_LEAVE;
|
|
19
|
+
const isAgentAvailable = useIsAgentAvailable();
|
|
84
20
|
|
|
85
21
|
console.log(
|
|
86
22
|
'Agent Control--',
|
|
@@ -88,153 +24,6 @@ export const AgentControl: React.FC<{channel_name: string}> = ({
|
|
|
88
24
|
{bth: AI_AGENT_STATE[agentConnectionState]},
|
|
89
25
|
);
|
|
90
26
|
|
|
91
|
-
const handleConnectionToggle = async () => {
|
|
92
|
-
try {
|
|
93
|
-
// connect to agent when agent is in not connected state or when earlier connect failed
|
|
94
|
-
if (
|
|
95
|
-
agentConnectionState === AgentState.NOT_CONNECTED ||
|
|
96
|
-
agentConnectionState === AgentState.AGENT_REQUEST_FAILED ||
|
|
97
|
-
isAwaitingLeave
|
|
98
|
-
) {
|
|
99
|
-
try {
|
|
100
|
-
setAgentConnectionState(AgentState.REQUEST_SENT);
|
|
101
|
-
const data = await connectToAIAgent(
|
|
102
|
-
'start',
|
|
103
|
-
channel_name,
|
|
104
|
-
localUid,
|
|
105
|
-
store.token,
|
|
106
|
-
);
|
|
107
|
-
// console.log("response X-Client-ID", newClientId, typeof newClientId)
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
const {agent_uid = null} = data;
|
|
110
|
-
|
|
111
|
-
//setClientId(agent_id);
|
|
112
|
-
setAgentUID(agent_uid);
|
|
113
|
-
|
|
114
|
-
setAgentConnectionState(AgentState.AWAITING_JOIN);
|
|
115
|
-
|
|
116
|
-
Toast.show({
|
|
117
|
-
leadingIconName: 'tick-fill',
|
|
118
|
-
type: 'success',
|
|
119
|
-
text1: 'Agent requested to join',
|
|
120
|
-
text2: null,
|
|
121
|
-
visibilityTime: 3000,
|
|
122
|
-
primaryBtn: null,
|
|
123
|
-
secondaryBtn: null,
|
|
124
|
-
leadingIcon: null,
|
|
125
|
-
});
|
|
126
|
-
} catch (agentConnectError) {
|
|
127
|
-
setAgentConnectionState(AgentState.AGENT_REQUEST_FAILED);
|
|
128
|
-
|
|
129
|
-
if (agentConnectError.toString().indexOf('401') !== -1) {
|
|
130
|
-
Toast.show({
|
|
131
|
-
leadingIconName: 'alert',
|
|
132
|
-
type: 'error',
|
|
133
|
-
text1: 'Your session is expired. Please sign in to join call.',
|
|
134
|
-
text2: null,
|
|
135
|
-
visibilityTime: 5000,
|
|
136
|
-
primaryBtn: null,
|
|
137
|
-
secondaryBtn: null,
|
|
138
|
-
leadingIcon: null,
|
|
139
|
-
});
|
|
140
|
-
// window.location.href = '/create'
|
|
141
|
-
await endcall();
|
|
142
|
-
setAgentAuthToken(null);
|
|
143
|
-
return;
|
|
144
|
-
} else {
|
|
145
|
-
Toast.show({
|
|
146
|
-
leadingIconName: 'alert',
|
|
147
|
-
type: 'error',
|
|
148
|
-
text1: 'Uh oh! Agent failed to connect',
|
|
149
|
-
text2: null,
|
|
150
|
-
visibilityTime: 5000,
|
|
151
|
-
primaryBtn: null,
|
|
152
|
-
secondaryBtn: null,
|
|
153
|
-
leadingIcon: null,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
throw agentConnectError;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
// disconnect agent with agent is already connected or when earlier disconnect failed
|
|
161
|
-
if (
|
|
162
|
-
agentConnectionState === AgentState.AGENT_CONNECTED ||
|
|
163
|
-
agentConnectionState === AgentState.AGENT_DISCONNECT_FAILED
|
|
164
|
-
) {
|
|
165
|
-
if (isMobileUA()) {
|
|
166
|
-
await endcall();
|
|
167
|
-
setAgentConnectionState(AgentState.NOT_CONNECTED);
|
|
168
|
-
setAgentAuthToken(null);
|
|
169
|
-
return; // check later
|
|
170
|
-
}
|
|
171
|
-
try {
|
|
172
|
-
setAgentConnectionState(AgentState.AGENT_DISCONNECT_REQUEST);
|
|
173
|
-
await connectToAIAgent('stop', channel_name, localUid, store.token);
|
|
174
|
-
setAgentConnectionState(AgentState.AWAITING_LEAVE);
|
|
175
|
-
|
|
176
|
-
Toast.show({
|
|
177
|
-
leadingIconName: 'tick-fill',
|
|
178
|
-
type: 'success',
|
|
179
|
-
text1: 'Agent disconnected',
|
|
180
|
-
text2: null,
|
|
181
|
-
visibilityTime: 3000,
|
|
182
|
-
primaryBtn: null,
|
|
183
|
-
secondaryBtn: null,
|
|
184
|
-
leadingIcon: null,
|
|
185
|
-
});
|
|
186
|
-
} catch (agentDisconnectError) {
|
|
187
|
-
setAgentConnectionState(AgentState.AGENT_DISCONNECT_FAILED);
|
|
188
|
-
|
|
189
|
-
Toast.show({
|
|
190
|
-
leadingIconName: 'alert',
|
|
191
|
-
type: 'error',
|
|
192
|
-
text1: 'Uh oh! Agent failed to disconnect',
|
|
193
|
-
text2: null,
|
|
194
|
-
visibilityTime: 5000,
|
|
195
|
-
primaryBtn: null,
|
|
196
|
-
secondaryBtn: null,
|
|
197
|
-
leadingIcon: null,
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
throw agentDisconnectError;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
} catch (error) {
|
|
204
|
-
console.log(`Agent failed to connect/disconnect - ${error}`);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
useEffect(() => {
|
|
209
|
-
console.log('agent contrl', {users});
|
|
210
|
-
// welcome agent
|
|
211
|
-
const aiAgentUID = users.filter(item => item === agentUID);
|
|
212
|
-
if (
|
|
213
|
-
aiAgentUID.length &&
|
|
214
|
-
agentConnectionState === AgentState.AWAITING_JOIN
|
|
215
|
-
) {
|
|
216
|
-
setAgentConnectionState(AgentState.AGENT_CONNECTED);
|
|
217
|
-
|
|
218
|
-
Toast.show({
|
|
219
|
-
leadingIconName: 'tick-fill',
|
|
220
|
-
type: 'success',
|
|
221
|
-
text1: 'Say Hi!!',
|
|
222
|
-
text2: null,
|
|
223
|
-
visibilityTime: 3000,
|
|
224
|
-
primaryBtn: null,
|
|
225
|
-
secondaryBtn: null,
|
|
226
|
-
leadingIcon: null,
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
// when agent leaves, show left toast, and set agent to not connected state
|
|
230
|
-
if (
|
|
231
|
-
!aiAgentUID.length &&
|
|
232
|
-
agentConnectionState === AgentState.AWAITING_LEAVE
|
|
233
|
-
) {
|
|
234
|
-
setAgentConnectionState(AgentState.NOT_CONNECTED);
|
|
235
|
-
}
|
|
236
|
-
}, [users]);
|
|
237
|
-
|
|
238
27
|
const isLoading =
|
|
239
28
|
agentConnectionState === AgentState.REQUEST_SENT ||
|
|
240
29
|
agentConnectionState === AgentState.AGENT_DISCONNECT_REQUEST ||
|
|
@@ -249,45 +38,59 @@ export const AgentControl: React.FC<{channel_name: string}> = ({
|
|
|
249
38
|
agentConnectionState === AgentState.AGENT_CONNECTED ||
|
|
250
39
|
agentConnectionState === AgentState.AGENT_DISCONNECT_FAILED;
|
|
251
40
|
|
|
252
|
-
const backgroundColorStyle =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const fontcolorStyle =
|
|
256
|
-
|
|
257
|
-
: {color: isEndAgent ? '#FF414D' : '#00C2FF'};
|
|
41
|
+
const backgroundColorStyle = {
|
|
42
|
+
backgroundColor: isEndAgent ? $config.SEMANTIC_ERROR : '#0097D4',
|
|
43
|
+
};
|
|
44
|
+
const fontcolorStyle = {color: $config.FONT_COLOR};
|
|
45
|
+
|
|
258
46
|
return (
|
|
259
47
|
<TouchableOpacity
|
|
260
|
-
style={
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
48
|
+
style={[
|
|
49
|
+
isMobileUA()
|
|
50
|
+
? {
|
|
51
|
+
display: 'flex',
|
|
52
|
+
height: 48,
|
|
53
|
+
width: 48,
|
|
54
|
+
marginHorizontal: 24,
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
borderRadius: 40,
|
|
58
|
+
flexDirection: 'row',
|
|
59
|
+
...backgroundColorStyle,
|
|
60
|
+
}
|
|
61
|
+
: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
height: 48,
|
|
64
|
+
padding: 20,
|
|
65
|
+
justifyContent: 'space-between',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
borderRadius: 40,
|
|
68
|
+
flexDirection: 'row',
|
|
69
|
+
...backgroundColorStyle,
|
|
70
|
+
},
|
|
71
|
+
{opacity: !isAgentAvailable ? 0.6 : 1},
|
|
72
|
+
]}
|
|
73
|
+
onPress={() => toggleAgentConnection()}
|
|
74
|
+
disabled={isLoading || !isAgentAvailable}>
|
|
275
75
|
{isLoading ? (
|
|
276
|
-
<ActivityIndicator
|
|
277
|
-
size="small"
|
|
278
|
-
color={isMobileUA() ? '#FFFFFF' : '#00C2FF'}
|
|
279
|
-
/>
|
|
76
|
+
<ActivityIndicator size="small" color={$config.FONT_COLOR} />
|
|
280
77
|
) : isStartAgent ? (
|
|
281
|
-
<
|
|
78
|
+
<Image style={{width: 24, height: 24}} source={JoinCallIcon} />
|
|
282
79
|
) : (
|
|
283
|
-
<
|
|
80
|
+
<Image style={{width: 24, height: 24}} source={LeaveCallIcon} />
|
|
81
|
+
)}
|
|
82
|
+
{!isMobileUA() && !(agentConnectionState === 'AGENT_CONNECTED') ? (
|
|
83
|
+
<Text
|
|
84
|
+
style={{
|
|
85
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
86
|
+
fontSize: 18,
|
|
87
|
+
lineHeight: 18,
|
|
88
|
+
fontWeight: '600',
|
|
89
|
+
...fontcolorStyle,
|
|
90
|
+
}}>{`${AI_AGENT_STATE[agentConnectionState]}`}</Text>
|
|
91
|
+
) : (
|
|
92
|
+
<></>
|
|
284
93
|
)}
|
|
285
|
-
|
|
286
|
-
<Text
|
|
287
|
-
style={{
|
|
288
|
-
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
289
|
-
...fontcolorStyle,
|
|
290
|
-
}}>{`${AI_AGENT_STATE[agentConnectionState]}`}</Text>
|
|
291
94
|
</TouchableOpacity>
|
|
292
95
|
);
|
|
293
96
|
};
|
|
@@ -1,34 +1,46 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {Text, View} from 'react-native';
|
|
2
|
+
import {Text, View, StyleSheet} from 'react-native';
|
|
3
3
|
import {LiveAudioVisualizer} from './react-audio-visualize';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import ThemeConfig from '../../theme';
|
|
5
|
+
import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
|
|
6
|
+
import {Spacer} from 'customization-api';
|
|
6
7
|
|
|
7
8
|
export const DisconnectedView = ({isConnected}) => {
|
|
8
9
|
return (
|
|
9
|
-
<View
|
|
10
|
-
style={
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
display: 'flex',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
}}>
|
|
17
|
-
{/* big circle that covers the parent view */}
|
|
18
|
-
{isMobileUA() ? <DisconnectedIconMobile /> : <DisconnectedIconDesktop />}
|
|
19
|
-
<Text
|
|
20
|
-
style={{
|
|
21
|
-
color: '#B3B3B3',
|
|
22
|
-
fontSize: 20,
|
|
23
|
-
fontWeight: '400',
|
|
24
|
-
marginTop: 20,
|
|
25
|
-
}}>
|
|
10
|
+
<View style={DisconnectedViewStyles.container}>
|
|
11
|
+
<View style={DisconnectedViewStyles.circleView} />
|
|
12
|
+
<Spacer size={16} />
|
|
13
|
+
<Text style={DisconnectedViewStyles.textStyle}>
|
|
26
14
|
{isConnected ? '' : 'Not Joined'}
|
|
27
15
|
</Text>
|
|
28
16
|
</View>
|
|
29
17
|
);
|
|
30
18
|
};
|
|
31
19
|
|
|
20
|
+
const DisconnectedViewStyles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
backgroundColor: $config.VIDEO_AUDIO_TILE_COLOR,
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
justifyContent: 'center',
|
|
27
|
+
},
|
|
28
|
+
circleView: {
|
|
29
|
+
width: 210,
|
|
30
|
+
height: 210,
|
|
31
|
+
borderRadius: 210 / 2,
|
|
32
|
+
borderWidth: 15,
|
|
33
|
+
borderColor: $config.SEMANTIC_NEUTRAL,
|
|
34
|
+
},
|
|
35
|
+
textStyle: {
|
|
36
|
+
color: $config.FONT_COLOR + hexadecimalTransparency['40%'],
|
|
37
|
+
fontSize: 16,
|
|
38
|
+
lineHeight: 18,
|
|
39
|
+
fontWeight: '400',
|
|
40
|
+
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
32
44
|
function createSilentAudioTrack(): MediaStreamTrack {
|
|
33
45
|
const audioContext = new (window.AudioContext ||
|
|
34
46
|
(window as any).webkitAudioContext)();
|
|
@@ -2,50 +2,112 @@ import {
|
|
|
2
2
|
ToolbarPreset,
|
|
3
3
|
ToolbarComponents,
|
|
4
4
|
useSidePanel,
|
|
5
|
-
|
|
5
|
+
IconButton,
|
|
6
|
+
SidePanelType,
|
|
7
|
+
useActionSheet,
|
|
8
|
+
IconButtonProps,
|
|
9
|
+
ToolbarItem,
|
|
6
10
|
} from 'customization-api';
|
|
7
|
-
import ThemeConfig from '../../theme';
|
|
8
11
|
import {isMobileUA} from '../../utils/common';
|
|
9
|
-
import React, {useEffect
|
|
10
|
-
import {Text, View} from 'react-native';
|
|
12
|
+
import React, {useEffect} from 'react';
|
|
11
13
|
import {AgentControl} from './AgentControls';
|
|
12
|
-
import {LogoIcon} from './icons';
|
|
13
14
|
|
|
14
|
-
export const
|
|
15
|
+
export const CustomSettingButton = () => {
|
|
16
|
+
const {sidePanel, setSidePanel} = useSidePanel();
|
|
17
|
+
|
|
18
|
+
const isPanelActive = sidePanel === 'custom-settings-panel';
|
|
19
|
+
const onPress = () => {
|
|
20
|
+
isPanelActive
|
|
21
|
+
? setSidePanel(SidePanelType.None)
|
|
22
|
+
: setSidePanel('custom-settings-panel');
|
|
23
|
+
};
|
|
24
|
+
const {isOnActionSheet} = useActionSheet();
|
|
25
|
+
let iconButtonProps: IconButtonProps = {
|
|
26
|
+
onPress: onPress,
|
|
27
|
+
|
|
28
|
+
iconProps: {
|
|
29
|
+
name: 'settings',
|
|
30
|
+
tintColor: isPanelActive
|
|
31
|
+
? $config.PRIMARY_ACTION_TEXT_COLOR
|
|
32
|
+
: $config.SECONDARY_ACTION_COLOR,
|
|
33
|
+
iconBackgroundColor: isPanelActive
|
|
34
|
+
? $config.PRIMARY_ACTION_BRAND_COLOR
|
|
35
|
+
: '',
|
|
36
|
+
},
|
|
37
|
+
btnTextProps: {
|
|
38
|
+
text: '',
|
|
39
|
+
textColor: $config.FONT_COLOR,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
iconButtonProps.isOnActionSheet = isOnActionSheet;
|
|
43
|
+
if (isOnActionSheet) {
|
|
44
|
+
iconButtonProps.btnTextProps.textStyle = {
|
|
45
|
+
color: $config.FONT_COLOR,
|
|
46
|
+
marginTop: 8,
|
|
47
|
+
fontSize: 12,
|
|
48
|
+
fontWeight: '400',
|
|
49
|
+
fontFamily: 'Source Sans Pro',
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return (
|
|
54
|
+
<ToolbarItem>
|
|
55
|
+
{' '}
|
|
56
|
+
<IconButton {...iconButtonProps} />{' '}
|
|
57
|
+
</ToolbarItem>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const CustomTranscriptButton = () => {
|
|
62
|
+
const {sidePanel, setSidePanel} = useSidePanel();
|
|
63
|
+
|
|
64
|
+
const isPanelActive = sidePanel === 'agent-transcript-panel';
|
|
65
|
+
const onPress = () => {
|
|
66
|
+
isPanelActive
|
|
67
|
+
? setSidePanel(SidePanelType.None)
|
|
68
|
+
: setSidePanel('agent-transcript-panel');
|
|
69
|
+
};
|
|
70
|
+
const {isOnActionSheet} = useActionSheet();
|
|
71
|
+
let iconButtonProps: IconButtonProps = {
|
|
72
|
+
onPress: onPress,
|
|
73
|
+
|
|
74
|
+
iconProps: {
|
|
75
|
+
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIpSURBVHgB7dv/TcJAFAfwL8b/ZYRzA5lA3AAmECcAJkAnQCaQDYQJqBPIBnQD2KC+S4+kIem9El+l1O8nuZTQpxzf/r4WgIiIiIiIiKhhOlULsyzryqQv7QHXbdvpdFawJOEMpO2z9thJG1T57uoaFP7RJ9ppqK1NVQLaycShnQ7S7iWkQ1nBTeyvw9rj0F5+v/oYK4gGhOvfIVfRi83UAvr3GJCCASkYkIIBKRiQggEpGJCCASkYkIIBKRiQ4ha2UmlvYTqWFhuUWkhLkA85WHHSZjAcgbAO6EnGVtLwOpHhkj3yIYVTS6mboAbymYlMdjBiuYmlhXCO1iW1X6hJ6EMKI5YBOVl67uS9ssGo6CDVb4Q+OBix3sQ20sFpeP2M8o6OpM7ve9aw5TfnOQxZB+RQfYB/Elqj8TCvYEAKBqRgQAoGpLA+inkJDE/UkB+6/f05F6nxpwyrUNOHIeuApnIm+w5jWf5kyQblNzJ7x7N4qR3J5ANGLDexQx3heOHe+aJk9rp4iSOvl2jopUbduiXv351RezbLgLqyes9Qg3B9NS6Z3Zf5k0Kt74NZQNb7oNfQWcsxHs8p8+eFhWMWjlfHUawL406e8bnmeB6kYEAKBqRgQAoGpNAC2qL9vmMzo48Bh2sgfwvlEoftv+DvxNzHCqJrULgGekF7TbUCdR8UnkQfwnYI49L8glefsvcq/5jFCw+WX/2PWaQlsafriYiIiIiIiBrtB7K/UdV6QM6CAAAAAElFTkSuQmCC',
|
|
76
|
+
tintColor: isPanelActive
|
|
77
|
+
? $config.PRIMARY_ACTION_TEXT_COLOR
|
|
78
|
+
: $config.SECONDARY_ACTION_COLOR,
|
|
79
|
+
iconBackgroundColor: isPanelActive
|
|
80
|
+
? $config.PRIMARY_ACTION_BRAND_COLOR
|
|
81
|
+
: '',
|
|
82
|
+
},
|
|
83
|
+
btnTextProps: {
|
|
84
|
+
text: '',
|
|
85
|
+
textColor: $config.FONT_COLOR,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
iconButtonProps.isOnActionSheet = isOnActionSheet;
|
|
89
|
+
if (isOnActionSheet) {
|
|
90
|
+
iconButtonProps.btnTextProps.textStyle = {
|
|
91
|
+
color: $config.FONT_COLOR,
|
|
92
|
+
marginTop: 8,
|
|
93
|
+
fontSize: 12,
|
|
94
|
+
fontWeight: '400',
|
|
95
|
+
fontFamily: 'Source Sans Pro',
|
|
96
|
+
textAlign: 'center',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
15
99
|
return (
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
justifyContent: 'center',
|
|
21
|
-
gap: 8,
|
|
22
|
-
marginRight: 20,
|
|
23
|
-
}}>
|
|
24
|
-
<LogoIcon />
|
|
25
|
-
<Text
|
|
26
|
-
style={{
|
|
27
|
-
color: '#C3C3C3',
|
|
28
|
-
textAlign: 'center',
|
|
29
|
-
fontSize: 18,
|
|
30
|
-
fontStyle: 'normal',
|
|
31
|
-
fontWeight: '600',
|
|
32
|
-
lineHeight: 18,
|
|
33
|
-
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
34
|
-
}}>
|
|
35
|
-
AI Builder Demo
|
|
36
|
-
</Text>
|
|
37
|
-
</View>
|
|
100
|
+
<ToolbarItem>
|
|
101
|
+
<IconButton {...iconButtonProps} />
|
|
102
|
+
</ToolbarItem>
|
|
38
103
|
);
|
|
39
104
|
};
|
|
40
105
|
|
|
41
106
|
const Bottombar = () => {
|
|
42
|
-
const {MeetingTitleToolbarItem
|
|
43
|
-
ToolbarComponents;
|
|
107
|
+
const {MeetingTitleToolbarItem} = ToolbarComponents;
|
|
44
108
|
const {setSidePanel} = useSidePanel();
|
|
45
|
-
const {data} = useRoomInfo();
|
|
46
|
-
const [clientId, setClientId] = useState<string | null>(null);
|
|
47
109
|
useEffect(() => {
|
|
48
|
-
!isMobileUA() && setSidePanel('
|
|
110
|
+
!isMobileUA() && setSidePanel('custom-settings-panel');
|
|
49
111
|
}, []);
|
|
50
112
|
return (
|
|
51
113
|
<ToolbarPreset
|
|
@@ -54,35 +116,36 @@ const Bottombar = () => {
|
|
|
54
116
|
layout: {hide: true},
|
|
55
117
|
invite: {hide: true},
|
|
56
118
|
more: {hide: true},
|
|
57
|
-
logo: {
|
|
58
|
-
align: 'start',
|
|
59
|
-
order: 0,
|
|
60
|
-
component: () => <LogoComponent />,
|
|
61
|
-
},
|
|
62
119
|
'meeting-title': {
|
|
63
120
|
align: 'start',
|
|
64
121
|
component: MeetingTitleToolbarItem,
|
|
65
122
|
order: 1,
|
|
66
|
-
hide:
|
|
123
|
+
hide: false,
|
|
67
124
|
},
|
|
68
125
|
'participant-count': {
|
|
69
|
-
align: 'start',
|
|
70
|
-
component: ParticipantCountToolbarItem,
|
|
71
|
-
order: 2,
|
|
72
126
|
hide: true,
|
|
73
127
|
},
|
|
74
|
-
|
|
75
|
-
'connect-agent': {
|
|
76
|
-
align: 'end',
|
|
77
|
-
label: 'Agent',
|
|
78
|
-
component: () => <AgentControl channel_name={data.channel} />,
|
|
79
|
-
order: 3,
|
|
80
|
-
},
|
|
81
128
|
'local-video': {hide: true},
|
|
129
|
+
'local-audio': {align: 'center', order: 1},
|
|
82
130
|
screenshare: {hide: true},
|
|
83
131
|
recording: {hide: true},
|
|
84
|
-
'
|
|
85
|
-
|
|
132
|
+
'connect-agent': {
|
|
133
|
+
align: 'center',
|
|
134
|
+
label: 'Agent',
|
|
135
|
+
component: AgentControl,
|
|
136
|
+
order: 2,
|
|
137
|
+
},
|
|
138
|
+
'end-call': {align: 'center', order: 3, hide: true},
|
|
139
|
+
'custom-transcript': {
|
|
140
|
+
align: 'end',
|
|
141
|
+
order: 0,
|
|
142
|
+
component: CustomTranscriptButton,
|
|
143
|
+
},
|
|
144
|
+
'custom-settings': {
|
|
145
|
+
align: 'end',
|
|
146
|
+
order: 2,
|
|
147
|
+
component: CustomSettingButton,
|
|
148
|
+
},
|
|
86
149
|
}}
|
|
87
150
|
/>
|
|
88
151
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
1
|
+
import {StyleSheet, View} from 'react-native';
|
|
2
2
|
import React, {useContext} from 'react';
|
|
3
3
|
import {useRtc} from 'customization-api';
|
|
4
4
|
import {AgentContext} from './AgentControls/AgentContext';
|
|
@@ -118,9 +118,9 @@ const CustomSidePanel = () => {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
|
-
<
|
|
121
|
+
<View style={styles.container}>
|
|
122
122
|
<ChatScreen />
|
|
123
|
-
</
|
|
123
|
+
</View>
|
|
124
124
|
);
|
|
125
125
|
};
|
|
126
126
|
|