@convai/web-sdk 0.1.1-beta.4 → 0.2.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.
Files changed (202) hide show
  1. package/README.md +735 -189
  2. package/dist/core/AudioManager.d.ts +8 -0
  3. package/dist/core/AudioManager.d.ts.map +1 -1
  4. package/dist/core/AudioManager.js +45 -5
  5. package/dist/core/AudioManager.js.map +1 -1
  6. package/dist/core/ConvaiClient.d.ts +22 -9
  7. package/dist/core/ConvaiClient.d.ts.map +1 -1
  8. package/dist/core/ConvaiClient.js +92 -41
  9. package/dist/core/ConvaiClient.js.map +1 -1
  10. package/dist/core/MessageHandler.d.ts.map +1 -1
  11. package/dist/core/MessageHandler.js +27 -24
  12. package/dist/core/MessageHandler.js.map +1 -1
  13. package/dist/core/ScreenShareManager.d.ts.map +1 -1
  14. package/dist/core/ScreenShareManager.js +4 -0
  15. package/dist/core/ScreenShareManager.js.map +1 -1
  16. package/dist/core/VideoManager.d.ts.map +1 -1
  17. package/dist/core/VideoManager.js +2 -0
  18. package/dist/core/VideoManager.js.map +1 -1
  19. package/dist/core/types.d.ts +13 -1
  20. package/dist/core/types.d.ts.map +1 -1
  21. package/dist/react/components/ConvaiWidget.d.ts +3 -0
  22. package/dist/react/components/ConvaiWidget.d.ts.map +1 -1
  23. package/dist/react/components/ConvaiWidget.js +25 -22
  24. package/dist/react/components/ConvaiWidget.js.map +1 -1
  25. package/dist/react/components/index.d.ts +0 -1
  26. package/dist/react/components/index.d.ts.map +1 -1
  27. package/dist/react/components/index.js +0 -2
  28. package/dist/react/components/index.js.map +1 -1
  29. package/dist/react/hooks/useConvaiClient.d.ts +3 -0
  30. package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
  31. package/dist/react/hooks/useConvaiClient.js +46 -9
  32. package/dist/react/hooks/useConvaiClient.js.map +1 -1
  33. package/dist/types/index.d.ts +1 -3
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/vanilla/AudioRenderer.d.ts +45 -0
  36. package/dist/vanilla/AudioRenderer.d.ts.map +1 -0
  37. package/dist/vanilla/AudioRenderer.js +126 -0
  38. package/dist/vanilla/AudioRenderer.js.map +1 -0
  39. package/dist/vanilla/ConvaiWidget.d.ts +39 -0
  40. package/dist/vanilla/ConvaiWidget.d.ts.map +1 -0
  41. package/dist/vanilla/ConvaiWidget.js +1835 -0
  42. package/dist/vanilla/ConvaiWidget.js.map +1 -0
  43. package/dist/vanilla/icons.d.ts +34 -0
  44. package/dist/vanilla/icons.d.ts.map +1 -0
  45. package/dist/vanilla/icons.js +215 -0
  46. package/dist/vanilla/icons.js.map +1 -0
  47. package/dist/vanilla/index.d.ts +35 -0
  48. package/dist/vanilla/index.d.ts.map +1 -0
  49. package/dist/vanilla/index.js +37 -0
  50. package/dist/vanilla/index.js.map +1 -0
  51. package/dist/{components/rtc-widget/styles/theme.d.ts → vanilla/styles.d.ts} +14 -50
  52. package/dist/vanilla/styles.d.ts.map +1 -0
  53. package/dist/vanilla/styles.js +287 -0
  54. package/dist/vanilla/styles.js.map +1 -0
  55. package/dist/vanilla/types.d.ts +38 -0
  56. package/dist/vanilla/types.d.ts.map +1 -0
  57. package/dist/vanilla/types.js +2 -0
  58. package/dist/vanilla/types.js.map +1 -0
  59. package/package.json +12 -5
  60. package/dist/components/ConvaiWidget.d.ts +0 -59
  61. package/dist/components/ConvaiWidget.d.ts.map +0 -1
  62. package/dist/components/ConvaiWidget.js +0 -421
  63. package/dist/components/ConvaiWidget.js.map +0 -1
  64. package/dist/components/index.d.ts +0 -3
  65. package/dist/components/index.d.ts.map +0 -1
  66. package/dist/components/index.js +0 -5
  67. package/dist/components/index.js.map +0 -1
  68. package/dist/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -10
  69. package/dist/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
  70. package/dist/components/rtc-widget/components/AudioSettingsPanel.js +0 -316
  71. package/dist/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
  72. package/dist/components/rtc-widget/components/ConviMessage.d.ts +0 -10
  73. package/dist/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
  74. package/dist/components/rtc-widget/components/ConviMessage.js +0 -14
  75. package/dist/components/rtc-widget/components/ConviMessage.js.map +0 -1
  76. package/dist/components/rtc-widget/components/FloatingVideo.d.ts +0 -9
  77. package/dist/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
  78. package/dist/components/rtc-widget/components/FloatingVideo.js +0 -122
  79. package/dist/components/rtc-widget/components/FloatingVideo.js.map +0 -1
  80. package/dist/components/rtc-widget/components/MarkdownRenderer.d.ts +0 -7
  81. package/dist/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
  82. package/dist/components/rtc-widget/components/MarkdownRenderer.js +0 -68
  83. package/dist/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
  84. package/dist/components/rtc-widget/components/MessageBubble.d.ts +0 -10
  85. package/dist/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
  86. package/dist/components/rtc-widget/components/MessageBubble.js +0 -23
  87. package/dist/components/rtc-widget/components/MessageBubble.js.map +0 -1
  88. package/dist/components/rtc-widget/components/MessageList.d.ts +0 -11
  89. package/dist/components/rtc-widget/components/MessageList.d.ts.map +0 -1
  90. package/dist/components/rtc-widget/components/MessageList.js +0 -89
  91. package/dist/components/rtc-widget/components/MessageList.js.map +0 -1
  92. package/dist/components/rtc-widget/components/UserMessage.d.ts +0 -9
  93. package/dist/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
  94. package/dist/components/rtc-widget/components/UserMessage.js +0 -15
  95. package/dist/components/rtc-widget/components/UserMessage.js.map +0 -1
  96. package/dist/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -6
  97. package/dist/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
  98. package/dist/components/rtc-widget/components/conviComponents/ConviButton.js +0 -15
  99. package/dist/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
  100. package/dist/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -25
  101. package/dist/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
  102. package/dist/components/rtc-widget/components/conviComponents/ConviFooter.js +0 -172
  103. package/dist/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
  104. package/dist/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -17
  105. package/dist/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
  106. package/dist/components/rtc-widget/components/conviComponents/ConviHeader.js +0 -66
  107. package/dist/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
  108. package/dist/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -12
  109. package/dist/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
  110. package/dist/components/rtc-widget/components/conviComponents/SettingsTray.js +0 -68
  111. package/dist/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
  112. package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -8
  113. package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
  114. package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -199
  115. package/dist/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
  116. package/dist/components/rtc-widget/components/conviComponents/index.d.ts +0 -6
  117. package/dist/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
  118. package/dist/components/rtc-widget/components/conviComponents/index.js +0 -6
  119. package/dist/components/rtc-widget/components/conviComponents/index.js.map +0 -1
  120. package/dist/components/rtc-widget/components/index.d.ts +0 -8
  121. package/dist/components/rtc-widget/components/index.d.ts.map +0 -1
  122. package/dist/components/rtc-widget/components/index.js +0 -13
  123. package/dist/components/rtc-widget/components/index.js.map +0 -1
  124. package/dist/components/rtc-widget/index.d.ts +0 -6
  125. package/dist/components/rtc-widget/index.d.ts.map +0 -1
  126. package/dist/components/rtc-widget/index.js +0 -9
  127. package/dist/components/rtc-widget/index.js.map +0 -1
  128. package/dist/components/rtc-widget/styles/framerConfig.d.ts +0 -116
  129. package/dist/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
  130. package/dist/components/rtc-widget/styles/framerConfig.js +0 -73
  131. package/dist/components/rtc-widget/styles/framerConfig.js.map +0 -1
  132. package/dist/components/rtc-widget/styles/icons.d.ts +0 -28
  133. package/dist/components/rtc-widget/styles/icons.d.ts.map +0 -1
  134. package/dist/components/rtc-widget/styles/icons.js +0 -257
  135. package/dist/components/rtc-widget/styles/icons.js.map +0 -1
  136. package/dist/components/rtc-widget/styles/index.d.ts +0 -6
  137. package/dist/components/rtc-widget/styles/index.d.ts.map +0 -1
  138. package/dist/components/rtc-widget/styles/index.js +0 -9
  139. package/dist/components/rtc-widget/styles/index.js.map +0 -1
  140. package/dist/components/rtc-widget/styles/styledComponents.d.ts +0 -90
  141. package/dist/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
  142. package/dist/components/rtc-widget/styles/styledComponents.js +0 -661
  143. package/dist/components/rtc-widget/styles/styledComponents.js.map +0 -1
  144. package/dist/components/rtc-widget/styles/theme.d.ts.map +0 -1
  145. package/dist/components/rtc-widget/styles/theme.js +0 -290
  146. package/dist/components/rtc-widget/styles/theme.js.map +0 -1
  147. package/dist/components/rtc-widget/types/index.d.ts +0 -60
  148. package/dist/components/rtc-widget/types/index.d.ts.map +0 -1
  149. package/dist/components/rtc-widget/types/index.js +0 -2
  150. package/dist/components/rtc-widget/types/index.js.map +0 -1
  151. package/dist/hooks/index.d.ts +0 -13
  152. package/dist/hooks/index.d.ts.map +0 -1
  153. package/dist/hooks/index.js +0 -14
  154. package/dist/hooks/index.js.map +0 -1
  155. package/dist/hooks/useAudioControls.d.ts +0 -41
  156. package/dist/hooks/useAudioControls.d.ts.map +0 -1
  157. package/dist/hooks/useAudioControls.js +0 -208
  158. package/dist/hooks/useAudioControls.js.map +0 -1
  159. package/dist/hooks/useCharacterInfo.d.ts +0 -17
  160. package/dist/hooks/useCharacterInfo.d.ts.map +0 -1
  161. package/dist/hooks/useCharacterInfo.js +0 -60
  162. package/dist/hooks/useCharacterInfo.js.map +0 -1
  163. package/dist/hooks/useConvaiClient.d.ts +0 -30
  164. package/dist/hooks/useConvaiClient.d.ts.map +0 -1
  165. package/dist/hooks/useConvaiClient.js +0 -349
  166. package/dist/hooks/useConvaiClient.js.map +0 -1
  167. package/dist/hooks/useDynamicInfoUpdater.d.ts +0 -33
  168. package/dist/hooks/useDynamicInfoUpdater.d.ts.map +0 -1
  169. package/dist/hooks/useDynamicInfoUpdater.js +0 -49
  170. package/dist/hooks/useDynamicInfoUpdater.js.map +0 -1
  171. package/dist/hooks/useLocalCameraTrack.d.ts +0 -22
  172. package/dist/hooks/useLocalCameraTrack.d.ts.map +0 -1
  173. package/dist/hooks/useLocalCameraTrack.js +0 -34
  174. package/dist/hooks/useLocalCameraTrack.js.map +0 -1
  175. package/dist/hooks/useMessageHandler.d.ts +0 -28
  176. package/dist/hooks/useMessageHandler.d.ts.map +0 -1
  177. package/dist/hooks/useMessageHandler.js +0 -267
  178. package/dist/hooks/useMessageHandler.js.map +0 -1
  179. package/dist/hooks/useScreenShare.d.ts +0 -45
  180. package/dist/hooks/useScreenShare.d.ts.map +0 -1
  181. package/dist/hooks/useScreenShare.js +0 -186
  182. package/dist/hooks/useScreenShare.js.map +0 -1
  183. package/dist/hooks/useTemplateKeysUpdater.d.ts +0 -35
  184. package/dist/hooks/useTemplateKeysUpdater.d.ts.map +0 -1
  185. package/dist/hooks/useTemplateKeysUpdater.js +0 -51
  186. package/dist/hooks/useTemplateKeysUpdater.js.map +0 -1
  187. package/dist/hooks/useTriggerMessageSender.d.ts +0 -28
  188. package/dist/hooks/useTriggerMessageSender.d.ts.map +0 -1
  189. package/dist/hooks/useTriggerMessageSender.js +0 -46
  190. package/dist/hooks/useTriggerMessageSender.js.map +0 -1
  191. package/dist/hooks/useTtsToggle.d.ts +0 -37
  192. package/dist/hooks/useTtsToggle.d.ts.map +0 -1
  193. package/dist/hooks/useTtsToggle.js +0 -63
  194. package/dist/hooks/useTtsToggle.js.map +0 -1
  195. package/dist/hooks/useUserTextMessageSender.d.ts +0 -28
  196. package/dist/hooks/useUserTextMessageSender.d.ts.map +0 -1
  197. package/dist/hooks/useUserTextMessageSender.js +0 -58
  198. package/dist/hooks/useUserTextMessageSender.js.map +0 -1
  199. package/dist/hooks/useVideoControls.d.ts +0 -39
  200. package/dist/hooks/useVideoControls.d.ts.map +0 -1
  201. package/dist/hooks/useVideoControls.js +0 -193
  202. package/dist/hooks/useVideoControls.js.map +0 -1
package/README.md CHANGED
@@ -1,293 +1,840 @@
1
1
  # @convai/web-sdk
2
2
 
3
- React SDK for Convai AI voice assistants. Build voice-powered AI interactions for web applications with real-time audio/video streaming.
3
+ JavaScript/TypeScript SDK for Convai AI voice assistants. Build voice-powered AI interactions for web applications with real-time audio/video streaming. Supports both React and Vanilla JavaScript/TypeScript.
4
4
 
5
- ## 🌟 Features
6
-
7
- - **React Support**: Purpose-built React hooks and components
8
- - **Tree-Shakeable**: Import only what you need for optimal bundle size
9
- - **Voice & Video**: Real-time audio/video conversations with AI characters
10
- - **Screen Sharing**: Share your screen with the AI assistant
11
- - **TypeScript**: Fully typed for excellent developer experience
12
- - **WebRTC Powered**: Built on LiveKit for robust real-time communication
13
- - **Customizable UI**: Pre-built widgets or build your own
14
-
15
- ## Installation
5
+ ## Installation
16
6
 
17
7
  ```bash
18
8
  npm install @convai/web-sdk
19
9
  ```
20
10
 
21
- ## Quick Start
11
+ ## Basic Setup
22
12
 
23
13
  ### React
24
14
 
25
15
  ```tsx
26
- import { useConvaiClient, ConvaiWidget } from '@convai/web-sdk';
16
+ import { useConvaiClient, ConvaiWidget } from "@convai/web-sdk";
27
17
 
28
18
  function App() {
29
19
  const convaiClient = useConvaiClient({
30
- apiKey: 'your-api-key',
31
- characterId: 'your-character-id',
32
- // endUserId: 'user-uuid', // Optional: enables memory & analytics
33
- enableVideo: true
20
+ apiKey: "your-api-key",
21
+ characterId: "your-character-id",
34
22
  });
35
23
 
36
24
  return <ConvaiWidget convaiClient={convaiClient} />;
37
25
  }
38
26
  ```
39
27
 
40
- [**→ Full React Guide**](./docs/REACT_USAGE.md)
28
+ ### Vanilla TypeScript
29
+
30
+ ```typescript
31
+ import { ConvaiClient, createConvaiWidget } from "@convai/web-sdk/vanilla";
32
+
33
+ // Create client with configuration
34
+ const client = new ConvaiClient({
35
+ apiKey: "your-api-key",
36
+ characterId: "your-character-id",
37
+ });
38
+
39
+ // Create widget - auto-connects on first user click
40
+ const widget = createConvaiWidget(document.body, {
41
+ convaiClient: client,
42
+ });
43
+
44
+ // Cleanup when done
45
+ widget.destroy();
46
+ ```
47
+
48
+ ## Exports
49
+
50
+ ### React Exports (`@convai/web-sdk` or `@convai/web-sdk/react`)
51
+
52
+ **Components:**
53
+
54
+ - `ConvaiWidget` - Main chat widget component
55
+
56
+ **Hooks:**
57
+
58
+ - `useConvaiClient(config?)` - Main client hook
59
+ - `useCharacterInfo(characterId, apiKey)` - Fetch character metadata
60
+ - `useLocalCameraTrack()` - Get local camera track
61
+
62
+ **Core Client:**
63
+
64
+ - `ConvaiClient` - Core client class
65
+
66
+ **Types:**
67
+
68
+ - `ConvaiConfig` - Configuration interface
69
+ - `ConvaiClientState` - Client state interface
70
+ - `ChatMessage` - Message interface
71
+ - `IConvaiClient` - Client interface
72
+ - `AudioControls` - Audio control interface
73
+ - `VideoControls` - Video control interface
74
+ - `ScreenShareControls` - Screen share control interface
75
+
76
+ **Components:**
77
+
78
+ - `AudioRenderer` - Audio playback component
79
+ - `AudioContext` - Audio context provider
80
+
81
+ ### Vanilla Exports (`@convai/web-sdk/vanilla`)
82
+
83
+ **Functions:**
84
+
85
+ - `createConvaiWidget(container, options)` - Create widget instance
86
+ - `destroyConvaiWidget(widget)` - Destroy widget instance
87
+
88
+ **Classes:**
89
+
90
+ - `ConvaiClient` - Core client class
91
+ - `AudioRenderer` - Audio playback handler
92
+
93
+ **Types:**
94
+
95
+ - `VanillaWidget` - Widget instance interface
96
+ - `VanillaWidgetOptions` - Widget options interface
97
+ - `IConvaiClient` - Client interface
98
+ - `ConvaiConfig` - Configuration interface
99
+ - `ConvaiClientState` - Client state interface
100
+ - `ChatMessage` - Message interface
101
+
102
+ ### Core Exports (`@convai/web-sdk/core`)
103
+
104
+ **Classes:**
105
+
106
+ - `ConvaiClient` - Main client class
107
+ - `AudioManager` - Audio management
108
+ - `VideoManager` - Video management
109
+ - `ScreenShareManager` - Screen share management
110
+ - `MessageHandler` - Message handling
111
+ - `EventEmitter` - Event emitter base class
112
+
113
+ **Types:**
114
+
115
+ - All types from React/Vanilla exports
116
+ - `ConvaiClientType` - Type alias for ConvaiClient
117
+
118
+ ## Props and Configuration
119
+
120
+ ### ConvaiWidget Props (React)
121
+
122
+ ```tsx
123
+ interface ConvaiWidgetProps {
124
+ /** Convai client instance (required) */
125
+ convaiClient: IConvaiClient & {
126
+ activity?: string;
127
+ isAudioMuted: boolean;
128
+ isVideoEnabled: boolean;
129
+ isScreenShareActive: boolean;
130
+ };
131
+ /** Show video toggle button in settings (default: true) */
132
+ showVideo?: boolean;
133
+ /** Show screen share toggle button in settings (default: true) */
134
+ showScreenShare?: boolean;
135
+ }
136
+ ```
137
+
138
+ ### createConvaiWidget Options (Vanilla)
41
139
 
42
- ### Core Only (Framework Agnostic)
140
+ ```typescript
141
+ interface VanillaWidgetOptions {
142
+ /** Convai client instance (required) */
143
+ convaiClient: IConvaiClient & {
144
+ activity?: string;
145
+ chatMessages: ChatMessage[];
146
+ };
147
+ /** Show video toggle button in settings (default: true) */
148
+ showVideo?: boolean;
149
+ /** Show screen share toggle button in settings (default: true) */
150
+ showScreenShare?: boolean;
151
+ }
152
+ ```
43
153
 
44
- For custom framework integrations:
154
+ ### ConvaiConfig
45
155
 
46
156
  ```typescript
47
- import { ConvaiClient } from '@convai/web-sdk/core';
157
+ interface ConvaiConfig {
158
+ /** Your Convai API key from convai.com dashboard (required) */
159
+ apiKey: string;
160
+ /** The Character ID to connect to (required) */
161
+ characterId: string;
162
+ /**
163
+ * End user identifier for speaker management (optional).
164
+ * When provided: enables long-term memory and analytics
165
+ * When not provided: anonymous mode, no persistent memory
166
+ */
167
+ endUserId?: string;
168
+ /** Custom Convai API URL (optional, defaults to production endpoint) */
169
+ url?: string;
170
+ /**
171
+ * Enable video capability (default: false).
172
+ * If true, connection_type will be "video" (supports audio, video, and screenshare).
173
+ * If false, connection_type will be "audio" (audio only).
174
+ */
175
+ enableVideo?: boolean;
176
+ /**
177
+ * Start with video camera on when connecting (default: false).
178
+ * Only works if enableVideo is true.
179
+ */
180
+ startWithVideoOn?: boolean;
181
+ /**
182
+ * Start with microphone on when connecting (default: false).
183
+ * If false, microphone stays off until user enables it.
184
+ */
185
+ startWithAudioOn?: boolean;
186
+ /** Enable text-to-speech audio generation (default: true) */
187
+ ttsEnabled?: boolean;
188
+ }
189
+ ```
48
190
 
49
- const client = new ConvaiClient();
191
+ ## Features
50
192
 
51
- // Listen for events
52
- client.on('stateChange', (state) => {
53
- console.log('State:', state.agentState);
54
- });
193
+ ### Video Enabled Chat
55
194
 
56
- client.on('message', (message) => {
57
- console.log('New message:', message.content);
58
- });
195
+ To enable video capabilities, set `enableVideo: true` in your configuration. This enables audio, video, and screen sharing.
59
196
 
60
- // Connect
61
- await client.connect({
62
- apiKey: 'your-api-key',
63
- characterId: 'your-character-id',
64
- // endUserId: 'user-uuid' // Optional: enables memory & analytics
65
- });
197
+ **React:**
198
+
199
+ ```tsx
200
+ import { useConvaiClient, ConvaiWidget } from "@convai/web-sdk";
66
201
 
67
- // Send message
68
- client.sendUserTextMessage('Hello!');
202
+ function App() {
203
+ const convaiClient = useConvaiClient({
204
+ apiKey: "your-api-key",
205
+ characterId: "your-character-id",
206
+ enableVideo: true,
207
+ startWithVideoOn: false, // Camera off by default
208
+ });
209
+
210
+ return (
211
+ <ConvaiWidget
212
+ convaiClient={convaiClient}
213
+ showVideo={true}
214
+ showScreenShare={true}
215
+ />
216
+ );
217
+ }
69
218
  ```
70
219
 
71
- ## 📖 Documentation
220
+ **Vanilla:**
72
221
 
73
- - [**React Usage Guide**](./docs/REACT_USAGE.md) - Hooks, components, and React integration
74
- - [**API Reference**](./API_REFERENCE.md) - Complete API documentation
222
+ ```typescript
223
+ import { ConvaiClient, createConvaiWidget } from "@convai/web-sdk/vanilla";
75
224
 
76
- ## Import Options
225
+ const client = new ConvaiClient({
226
+ apiKey: "your-api-key",
227
+ characterId: "your-character-id",
228
+ enableVideo: true,
229
+ startWithVideoOn: false,
230
+ });
231
+
232
+ const widget = createConvaiWidget(document.body, {
233
+ convaiClient: client,
234
+ showVideo: true,
235
+ showScreenShare: true,
236
+ });
237
+ ```
77
238
 
78
- The SDK supports multiple import paths for tree-shaking:
239
+ **Manual Video Controls:**
79
240
 
80
241
  ```typescript
81
- // Default: React version (backward compatible)
82
- import { useConvaiClient, ConvaiWidget } from '@convai/web-sdk';
242
+ // Enable video camera
243
+ await convaiClient.videoControls.enableVideo();
83
244
 
84
- // Explicit React import
85
- import { useConvaiClient, ConvaiWidget } from '@convai/web-sdk/react';
245
+ // Disable video camera
246
+ await convaiClient.videoControls.disableVideo();
86
247
 
87
- // Core only (no UI, framework agnostic)
88
- import { ConvaiClient } from '@convai/web-sdk/core';
248
+ // Toggle video
249
+ await convaiClient.videoControls.toggleVideo();
250
+
251
+ // Check video state
252
+ const isVideoEnabled = convaiClient.videoControls.isVideoEnabled;
253
+
254
+ // Set video quality
255
+ await convaiClient.videoControls.setVideoQuality("high"); // 'low' | 'medium' | 'high'
256
+
257
+ // Get available video devices
258
+ const devices = await convaiClient.videoControls.getVideoDevices();
259
+
260
+ // Set specific video device
261
+ await convaiClient.videoControls.setVideoDevice(deviceId);
89
262
  ```
90
263
 
91
- ## 🔑 Get Convai Credentials
264
+ **Screen Sharing:**
92
265
 
93
- 1. Visit [convai.com](https://convai.com) and create an account
94
- 2. Navigate to your dashboard
95
- 3. Create a new character or use an existing one
96
- 4. Copy your **API Key** from the dashboard
97
- 5. Copy your **Character ID** from the character details
266
+ ```typescript
267
+ // Enable screen share
268
+ await convaiClient.screenShareControls.enableScreenShare();
98
269
 
99
- ## Core Features
270
+ // Enable screen share with audio
271
+ await convaiClient.screenShareControls.enableScreenShareWithAudio();
100
272
 
101
- ### Connection Management
273
+ // Disable screen share
274
+ await convaiClient.screenShareControls.disableScreenShare();
275
+
276
+ // Toggle screen share
277
+ await convaiClient.screenShareControls.toggleScreenShare();
278
+
279
+ // Check screen share state
280
+ const isActive = convaiClient.screenShareControls.isScreenShareActive;
281
+ ```
282
+
283
+ **Video State Monitoring:**
102
284
 
103
285
  ```typescript
104
- // Connect
105
- await client.connect(config);
286
+ // React
287
+ const { isVideoEnabled } = convaiClient;
106
288
 
107
- // Disconnect
108
- await client.disconnect();
289
+ // Core API (event-based)
290
+ convaiClient.videoControls.on("videoStateChange", (state) => {
291
+ console.log("Video enabled:", state.isVideoEnabled);
292
+ console.log("Video hidden:", state.isVideoHidden);
293
+ });
294
+ ```
109
295
 
110
- // Reset session (clear history)
111
- client.resetSession();
296
+ ### Interruption
112
297
 
113
- // Reconnect
114
- await client.reconnect();
298
+ Interrupt the character's current response to allow the user to speak immediately.
299
+
300
+ **React:**
301
+
302
+ ```tsx
303
+ function ChatInterface() {
304
+ const convaiClient = useConvaiClient({
305
+ /* config */
306
+ });
307
+
308
+ const handleInterrupt = () => {
309
+ // Interrupt the bot's current response
310
+ convaiClient.sendInterruptMessage();
311
+ };
312
+
313
+ return <button onClick={handleInterrupt}>Interrupt</button>;
314
+ }
115
315
  ```
116
316
 
117
- ### Messaging
317
+ **Vanilla:**
118
318
 
119
319
  ```typescript
120
- // Send text message
121
- client.sendUserTextMessage('Hello!');
320
+ const interruptButton = document.getElementById("interrupt-btn");
321
+
322
+ interruptButton.addEventListener("click", () => {
323
+ client.sendInterruptMessage();
324
+ });
325
+ ```
122
326
 
123
- // Send trigger for specific actions
124
- client.sendTriggerMessage('greet', 'User entered room');
327
+ **Voice Mode Interruption Pattern:**
125
328
 
126
- // Update context
127
- client.updateTemplateKeys({ user_name: 'John' });
128
- client.updateDynamicInfo({ text: 'User is happy' });
329
+ When implementing voice mode, interrupt the bot when the user starts speaking:
330
+
331
+ ```typescript
332
+ // When user enters voice mode
333
+ const enterVoiceMode = async () => {
334
+ // Interrupt any ongoing bot response
335
+ convaiClient.sendInterruptMessage();
336
+
337
+ // Unmute microphone
338
+ await convaiClient.audioControls.unmuteAudio();
339
+ };
340
+
341
+ // When user exits voice mode
342
+ const exitVoiceMode = async () => {
343
+ // Interrupt any ongoing bot response
344
+ convaiClient.sendInterruptMessage();
345
+
346
+ // Mute microphone
347
+ await convaiClient.audioControls.muteAudio();
348
+ };
129
349
  ```
130
350
 
131
- ### Media Controls
351
+ ### User Microphone Mute/Unmute
352
+
353
+ Control the user's microphone input.
354
+
355
+ **React:**
356
+
357
+ ```tsx
358
+ function AudioControls() {
359
+ const convaiClient = useConvaiClient({
360
+ /* config */
361
+ });
362
+
363
+ const handleMute = async () => {
364
+ await convaiClient.audioControls.muteAudio();
365
+ };
366
+
367
+ const handleUnmute = async () => {
368
+ await convaiClient.audioControls.unmuteAudio();
369
+ };
370
+
371
+ const handleToggle = async () => {
372
+ await convaiClient.audioControls.toggleAudio();
373
+ };
374
+
375
+ return (
376
+ <div>
377
+ <button onClick={handleMute}>Mute</button>
378
+ <button onClick={handleUnmute}>Unmute</button>
379
+ <button onClick={handleToggle}>Toggle</button>
380
+ <p>Muted: {convaiClient.audioControls.isAudioMuted ? "Yes" : "No"}</p>
381
+ </div>
382
+ );
383
+ }
384
+ ```
385
+
386
+ **Vanilla:**
132
387
 
133
388
  ```typescript
134
- // Audio (always available)
135
- await client.audioControls.toggleAudio();
389
+ // Mute microphone
136
390
  await client.audioControls.muteAudio();
391
+
392
+ // Unmute microphone
137
393
  await client.audioControls.unmuteAudio();
138
394
 
139
- // Video (if enableVideo: true)
140
- await client.videoControls.toggleVideo();
141
- await client.videoControls.enableVideo();
142
- await client.videoControls.disableVideo();
395
+ // Toggle mute state
396
+ await client.audioControls.toggleAudio();
397
+
398
+ // Check mute state
399
+ const isMuted = client.audioControls.isAudioMuted;
400
+
401
+ // Enable audio (request permissions if needed)
402
+ await client.audioControls.enableAudio();
143
403
 
144
- // Screen Share (if enableVideo: true)
145
- await client.screenShareControls.toggleScreenShare();
404
+ // Disable audio
405
+ await client.audioControls.disableAudio();
146
406
  ```
147
407
 
148
- ### State Monitoring
408
+ **Audio Device Management:**
409
+
410
+ ```typescript
411
+ // Get available audio devices
412
+ const devices = await convaiClient.audioControls.getAudioDevices();
413
+
414
+ // Set specific audio device
415
+ await convaiClient.audioControls.setAudioDevice(deviceId);
416
+
417
+ // Monitor audio level
418
+ convaiClient.audioControls.startAudioLevelMonitoring();
419
+
420
+ convaiClient.audioControls.on("audioLevelChange", (level) => {
421
+ console.log("Audio level:", level);
422
+ // level is a number between 0 and 1
423
+ });
424
+
425
+ convaiClient.audioControls.stopAudioLevelMonitoring();
426
+ ```
427
+
428
+ **Audio State Monitoring:**
149
429
 
150
430
  ```typescript
151
431
  // React
152
- const { state, chatMessages, userTranscription } = convaiClient;
432
+ const { isAudioMuted } = convaiClient;
153
433
 
154
434
  // Core API (event-based)
155
- client.on('stateChange', (state) => {
156
- console.log(state.agentState); // 'listening' | 'thinking' | 'speaking'
435
+ convaiClient.audioControls.on("audioStateChange", (state) => {
436
+ console.log("Audio enabled:", state.isAudioEnabled);
437
+ console.log("Audio muted:", state.isAudioMuted);
438
+ console.log("Audio level:", state.audioLevel);
439
+ });
440
+ ```
441
+
442
+ ### Character TTS Mute/Unmute
443
+
444
+ Control whether the character's responses are spoken aloud (text-to-speech).
445
+
446
+ **React:**
447
+
448
+ ```tsx
449
+ function TTSControls() {
450
+ const convaiClient = useConvaiClient({
451
+ /* config */
452
+ });
453
+
454
+ const handleToggleTTS = (enabled: boolean) => {
455
+ convaiClient.toggleTts(enabled);
456
+ };
457
+
458
+ return (
459
+ <div>
460
+ <button onClick={() => handleToggleTTS(true)}>Enable TTS</button>
461
+ <button onClick={() => handleToggleTTS(false)}>Disable TTS</button>
462
+ </div>
463
+ );
464
+ }
465
+ ```
466
+
467
+ **Vanilla:**
468
+
469
+ ```typescript
470
+ // Enable text-to-speech (character will speak responses)
471
+ client.toggleTts(true);
472
+
473
+ // Disable text-to-speech (character will only send text, no audio)
474
+ client.toggleTts(false);
475
+ ```
476
+
477
+ **Initial TTS Configuration:**
478
+
479
+ ```typescript
480
+ // Set TTS state during connection
481
+ const client = new ConvaiClient({
482
+ apiKey: "your-api-key",
483
+ characterId: "your-character-id",
484
+ ttsEnabled: true, // Enable TTS by default
157
485
  });
158
486
 
159
- client.on('message', (message) => {
160
- console.log('New message:', message);
487
+ // Or disable initially
488
+ const client = new ConvaiClient({
489
+ apiKey: "your-api-key",
490
+ characterId: "your-character-id",
491
+ ttsEnabled: false, // Disable TTS
161
492
  });
162
493
  ```
163
494
 
164
- ## 🎨 UI Components
495
+ ### Voice Mode Implementation
165
496
 
166
- ### Pre-built Widget
497
+ Voice mode allows users to speak instead of typing. The widget automatically handles voice mode, but you can implement it manually.
167
498
 
168
- React version includes a complete chat widget:
499
+ **React - Manual Voice Mode:**
169
500
 
170
- - Expandable circular button
171
- - Chat interface with message history
172
- - Voice/text input modes
173
- - Video controls (when enabled)
174
- - Screen sharing (when enabled)
175
- - Auto-connects on first interaction
501
+ ```tsx
502
+ import { useConvaiClient } from "@convai/web-sdk";
503
+ import { useState, useEffect } from "react";
176
504
 
177
- ### Custom UI
505
+ function CustomChatInterface() {
506
+ const convaiClient = useConvaiClient({
507
+ /* config */
508
+ });
509
+ const [isVoiceMode, setIsVoiceMode] = useState(false);
178
510
 
179
- Build your own UI using the client API. The client handles all the AI logic while you control the presentation.
511
+ const enterVoiceMode = async () => {
512
+ // Interrupt any ongoing bot response
513
+ convaiClient.sendInterruptMessage();
180
514
 
181
- ## Message Types
515
+ // Unmute microphone
516
+ await convaiClient.audioControls.unmuteAudio();
182
517
 
183
- The SDK handles various message types:
518
+ setIsVoiceMode(true);
519
+ };
184
520
 
185
- - `user-transcription` - Real-time speech-to-text
186
- - `bot-llm-text` - AI character responses
187
- - `bot-emotion` - Character emotional states
188
- - `action` - Action executions
189
- - `behavior-tree` - Behavior responses
521
+ const exitVoiceMode = async () => {
522
+ // Interrupt any ongoing bot response
523
+ convaiClient.sendInterruptMessage();
190
524
 
191
- ## 🔧 Configuration
525
+ // Mute microphone
526
+ await convaiClient.audioControls.muteAudio();
192
527
 
193
- ```typescript
194
- interface ConvaiConfig {
195
- apiKey: string; // Required
196
- characterId: string; // Required
197
- endUserId?: string; // Optional: unique ID for memory & analytics
198
- url?: string; // Optional: API URL
199
- enableVideo?: boolean; // Optional: Enable video (default: false)
200
- startWithVideoOn?: boolean; // Optional: Start with camera on
201
- ttsEnabled?: boolean; // Optional: Enable TTS (default: true)
202
- actionConfig?: { // Optional: Actions & context
203
- actions: string[];
204
- characters: Array<{ name: string; bio: string }>;
205
- objects: Array<{ name: string; description: string }>;
528
+ setIsVoiceMode(false);
206
529
  };
530
+
531
+ // Monitor user transcription for voice input
532
+ useEffect(() => {
533
+ const transcription = convaiClient.userTranscription;
534
+ if (transcription && isVoiceMode) {
535
+ // Display real-time transcription
536
+ console.log("User is saying:", transcription);
537
+ }
538
+ }, [convaiClient.userTranscription, isVoiceMode]);
539
+
540
+ return (
541
+ <div>
542
+ {isVoiceMode ? (
543
+ <div>
544
+ <p>Listening: {convaiClient.userTranscription}</p>
545
+ <button onClick={exitVoiceMode}>Stop Voice Mode</button>
546
+ </div>
547
+ ) : (
548
+ <button onClick={enterVoiceMode}>Start Voice Mode</button>
549
+ )}
550
+ </div>
551
+ );
207
552
  }
208
553
  ```
209
554
 
210
- ### About endUserId
555
+ **Vanilla - Manual Voice Mode:**
556
+
557
+ ```typescript
558
+ let isVoiceMode = false;
559
+
560
+ const enterVoiceMode = async () => {
561
+ // Interrupt any ongoing bot response
562
+ client.sendInterruptMessage();
211
563
 
212
- The `endUserId` parameter is **optional** and serves two important purposes:
564
+ // Unmute microphone
565
+ await client.audioControls.unmuteAudio();
213
566
 
214
- 1. **Long-term Memory**: When provided, the character remembers context from previous conversations with this user, enabling personalized and continuous interactions across sessions.
567
+ isVoiceMode = true;
568
+ updateUI();
569
+ };
215
570
 
216
- 2. **Analytics & Tracking**: Track user engagement, behavior patterns, and conversation metrics for your application.
571
+ const exitVoiceMode = async () => {
572
+ // Interrupt any ongoing bot response
573
+ client.sendInterruptMessage();
217
574
 
218
- **Usage:**
219
- - **With endUserId**: Pass a unique identifier (UUID, device ID, or user ID) to enable persistent memory and analytics
220
- - **Without endUserId**: Anonymous mode - each session is independent with no conversation history or tracking
575
+ // Mute microphone
576
+ await client.audioControls.muteAudio();
577
+
578
+ isVoiceMode = false;
579
+ updateUI();
580
+ };
581
+
582
+ // Monitor user transcription
583
+ client.on("userTranscriptionChange", (transcription) => {
584
+ if (isVoiceMode && transcription) {
585
+ // Display real-time transcription
586
+ document.getElementById("transcription").textContent = transcription;
587
+ }
588
+ });
589
+
590
+ function updateUI() {
591
+ const voiceButton = document.getElementById("voice-btn");
592
+ const transcriptionDiv = document.getElementById("transcription");
593
+
594
+ if (isVoiceMode) {
595
+ voiceButton.textContent = "Stop Voice Mode";
596
+ transcriptionDiv.style.display = "block";
597
+ } else {
598
+ voiceButton.textContent = "Start Voice Mode";
599
+ transcriptionDiv.style.display = "none";
600
+ }
601
+ }
602
+ ```
603
+
604
+ **Voice Mode with State Monitoring:**
221
605
 
222
606
  ```typescript
223
- // With persistent memory and analytics
224
- await client.connect({
225
- apiKey: 'your-api-key',
226
- characterId: 'your-character-id',
227
- endUserId: 'user-12345' // User will be remembered
607
+ // Monitor agent state to handle voice mode transitions
608
+ convaiClient.on("stateChange", (state) => {
609
+ if (isVoiceMode) {
610
+ switch (state.agentState) {
611
+ case "listening":
612
+ // User can speak
613
+ console.log("Bot is listening");
614
+ break;
615
+ case "thinking":
616
+ // Bot is processing
617
+ console.log("Bot is thinking");
618
+ break;
619
+ case "speaking":
620
+ // Bot is responding
621
+ console.log("Bot is speaking");
622
+ // Optionally interrupt if user wants to speak
623
+ break;
624
+ }
625
+ }
626
+ });
627
+ ```
628
+
629
+ ### Connection Management
630
+
631
+ **Connect:**
632
+
633
+ ```typescript
634
+ // React - config passed to hook
635
+ const convaiClient = useConvaiClient({
636
+ apiKey: "your-api-key",
637
+ characterId: "your-character-id",
638
+ });
639
+
640
+ // Or connect manually
641
+ await convaiClient.connect({
642
+ apiKey: "your-api-key",
643
+ characterId: "your-character-id",
228
644
  });
229
645
 
230
- // Anonymous mode (no memory, no tracking)
646
+ // Vanilla
647
+ const client = new ConvaiClient();
231
648
  await client.connect({
232
- apiKey: 'your-api-key',
233
- characterId: 'your-character-id'
234
- // No endUserId = anonymous
649
+ apiKey: "your-api-key",
650
+ characterId: "your-character-id",
235
651
  });
236
652
  ```
237
653
 
238
- ## Browser Support
654
+ **Disconnect:**
239
655
 
240
- - Chrome/Edge: Full support
241
- - Firefox: Full support
242
- - Safari: Full support
243
- - Mobile browsers: Supported
656
+ ```typescript
657
+ await convaiClient.disconnect();
658
+ ```
244
659
 
245
- ## Package Structure
660
+ **Reconnect:**
246
661
 
662
+ ```typescript
663
+ await convaiClient.reconnect();
247
664
  ```
248
- @convai/web-sdk
249
- ├── /core # Framework-agnostic core (ConvaiClient)
250
- ├── /react # React hooks and components
251
- └── (default) # React (backward compatible)
665
+
666
+ **Reset Session:**
667
+
668
+ ```typescript
669
+ // Clear conversation history and start new session
670
+ convaiClient.resetSession();
252
671
  ```
253
672
 
254
- ## 🔄 Migration from Previous Versions
673
+ **Connection State:**
255
674
 
256
- ### Backward Compatible
675
+ ```typescript
676
+ // React
677
+ const { state } = convaiClient;
678
+ console.log("Connected:", state.isConnected);
679
+ console.log("Connecting:", state.isConnecting);
680
+ console.log("Agent state:", state.agentState); // 'disconnected' | 'connected' | 'listening' | 'thinking' | 'speaking'
257
681
 
258
- No breaking changes! Existing code continues to work:
682
+ // Core API (event-based)
683
+ convaiClient.on("stateChange", (state) => {
684
+ console.log("State changed:", state);
685
+ });
259
686
 
260
- ```tsx
261
- // Still works
262
- import { useConvaiClient, ConvaiWidget } from '@convai/web-sdk';
687
+ convaiClient.on("connect", () => {
688
+ console.log("Connected");
689
+ });
690
+
691
+ convaiClient.on("disconnect", () => {
692
+ console.log("Disconnected");
693
+ });
263
694
  ```
264
695
 
265
- ### New Features Available
696
+ ### Messaging
266
697
 
267
- ```tsx
268
- // New: Explicit React import
269
- import { useConvaiClient } from '@convai/web-sdk/react';
698
+ **Send Text Message:**
270
699
 
271
- // New: Core-only for custom frameworks
272
- import { ConvaiClient } from '@convai/web-sdk/core';
700
+ ```typescript
701
+ convaiClient.sendUserTextMessage("Hello, how are you?");
273
702
  ```
274
703
 
275
- ## 🎓 Examples
704
+ **Send Trigger Message:**
276
705
 
277
- - [React Example](./examples/react/) - Complete React application
706
+ ```typescript
707
+ // Trigger specific character action
708
+ convaiClient.sendTriggerMessage("greet", "User entered the room");
709
+
710
+ // Trigger without message
711
+ convaiClient.sendTriggerMessage("wave");
712
+ ```
278
713
 
279
- ## Best Practices
714
+ **Update Context:**
280
715
 
281
- 1. **Single Client Instance**: Create one client per application
282
- 2. **State Management**: Check `state.isConnected` before sending messages
283
- 3. **Session Management**: Use `resetSession()` when changing contexts
284
- 4. **Error Handling**: Always wrap connect/disconnect in try-catch
285
- 5. **Resource Cleanup**: Disconnect when done to free resources
286
- 6. **Tree Shaking**: Import from specific paths to reduce bundle size
716
+ ```typescript
717
+ // Update template keys (e.g., user name, location)
718
+ convaiClient.updateTemplateKeys({
719
+ user_name: "John",
720
+ location: "New York",
721
+ });
287
722
 
288
- ## TypeScript Support
723
+ // Update dynamic information
724
+ convaiClient.updateDynamicInfo({
725
+ text: "User is currently browsing the products page",
726
+ });
727
+ ```
289
728
 
290
- Fully typed with TypeScript:
729
+ **Message History:**
730
+
731
+ ```typescript
732
+ // React
733
+ const { chatMessages } = convaiClient;
734
+
735
+ // Core API (event-based)
736
+ convaiClient.on("message", (message: ChatMessage) => {
737
+ console.log("New message:", message.content);
738
+ console.log("Message type:", message.type);
739
+ });
740
+
741
+ convaiClient.on("messagesChange", (messages: ChatMessage[]) => {
742
+ console.log("All messages:", messages);
743
+ });
744
+ ```
745
+
746
+ **Message Types:**
747
+
748
+ ```typescript
749
+ type ChatMessageType =
750
+ | "user" // User's sent message
751
+ | "convai" // Character's response
752
+ | "user-transcription" // Real-time speech-to-text from user
753
+ | "bot-llm-text" // Character's LLM-generated text
754
+ | "emotion" // Character's emotional state
755
+ | "behavior-tree" // Behavior tree response
756
+ | "action" // Action execution
757
+ | "bot-emotion" // Bot emotional response
758
+ | "user-llm-text" // User text processed by LLM
759
+ | "interrupt-bot"; // Interrupt message
760
+ ```
761
+
762
+ ### State Monitoring
763
+
764
+ **Agent State:**
765
+
766
+ ```typescript
767
+ // React
768
+ const { state } = convaiClient;
769
+
770
+ // Check specific states
771
+ if (state.isListening) {
772
+ console.log("Bot is listening");
773
+ }
774
+
775
+ if (state.isThinking) {
776
+ console.log("Bot is thinking");
777
+ }
778
+
779
+ if (state.isSpeaking) {
780
+ console.log("Bot is speaking");
781
+ }
782
+
783
+ // Combined state
784
+ console.log(state.agentState); // 'disconnected' | 'connected' | 'listening' | 'thinking' | 'speaking'
785
+ ```
786
+
787
+ **User Transcription:**
788
+
789
+ ```typescript
790
+ // React
791
+ const { userTranscription } = convaiClient;
792
+
793
+ // Core API (event-based)
794
+ convaiClient.on("userTranscriptionChange", (transcription: string) => {
795
+ console.log("User is saying:", transcription);
796
+ });
797
+ ```
798
+
799
+ **Bot Ready State:**
800
+
801
+ ```typescript
802
+ // React
803
+ const { isBotReady } = convaiClient;
804
+
805
+ // Core API (event-based)
806
+ convaiClient.on("botReady", () => {
807
+ console.log("Bot is ready to receive messages");
808
+ });
809
+ ```
810
+
811
+ ## Getting Convai Credentials
812
+
813
+ 1. Visit [convai.com](https://convai.com) and create an account
814
+ 2. Navigate to your dashboard
815
+ 3. Create a new character or use an existing one
816
+ 4. Copy your **API Key** from the dashboard
817
+ 5. Copy your **Character ID** from the character details
818
+
819
+ ## Import Paths
820
+
821
+ ```typescript
822
+ // Default: React version (backward compatible)
823
+ import { useConvaiClient, ConvaiWidget } from "@convai/web-sdk";
824
+
825
+ // Explicit React import
826
+ import { useConvaiClient, ConvaiWidget } from "@convai/web-sdk/react";
827
+
828
+ // Vanilla JS/TS
829
+ import { ConvaiClient, createConvaiWidget } from "@convai/web-sdk/vanilla";
830
+
831
+ // Core only (no UI, framework agnostic)
832
+ import { ConvaiClient } from "@convai/web-sdk/core";
833
+ ```
834
+
835
+ ## TypeScript Support
836
+
837
+ All exports are fully typed:
291
838
 
292
839
  ```typescript
293
840
  import type {
@@ -298,37 +845,36 @@ import type {
298
845
  AudioControls,
299
846
  VideoControls,
300
847
  ScreenShareControls,
301
- } from '@convai/web-sdk';
848
+ IConvaiClient,
849
+ } from "@convai/web-sdk";
302
850
  ```
303
851
 
304
- ## 🔗 Dependencies
852
+ ## Browser Support
305
853
 
306
- ### Core
307
- - `livekit-client` - WebRTC functionality
854
+ - Chrome/Edge: Full support
855
+ - Firefox: Full support
856
+ - Safari: Full support
857
+ - Mobile browsers: Supported
858
+
859
+ ## Dependencies
860
+
861
+ ### Peer Dependencies (React)
308
862
 
309
- ### React (Peer)
310
863
  - `react ^18.0.0`
311
864
  - `react-dom ^18.0.0`
312
- - `@livekit/components-react`
313
- - `styled-components`
314
- - `framer-motion`
315
- - `react-icons`
316
865
 
317
- ## 📄 License
866
+ ### Included Dependencies
867
+
868
+ - `styled-components` - Styling
869
+ - `framer-motion` - Animations
870
+ - `react-icons` - Icon components
871
+
872
+ ## License
318
873
 
319
874
  MIT
320
875
 
321
- ## 🆘 Support
876
+ ## Support
322
877
 
323
878
  - [GitHub Issues](https://github.com/convai/web-sdk/issues)
324
- - [Documentation](./docs/)
325
879
  - [API Reference](./API_REFERENCE.md)
326
880
  - [Convai Website](https://convai.com)
327
-
328
- ## 🤝 Contributing
329
-
330
- Contributions are welcome! Please read our contributing guidelines before submitting PRs.
331
-
332
- ---
333
-
334
- Built by [Convai](https://convai.com)