@convai/web-sdk 1.9.2 → 2.0.0-beta.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 +22 -11
- package/dist/core/types.d.ts +2 -2
- package/dist/react/hooks/index.d.ts +0 -2
- package/dist/react/hooks/index.js +0 -3
- package/dist/react/index.d.ts +0 -3
- package/dist/react/index.js +3 -10
- package/dist/vanilla/index.d.ts +6 -18
- package/dist/vanilla/index.js +7 -19
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +9 -8
- package/dist/react/components/ConvaiWidget.d.ts +0 -86
- package/dist/react/components/ConvaiWidget.js +0 -610
- package/dist/react/components/index.d.ts +0 -1
- package/dist/react/components/index.js +0 -2
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -9
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +0 -315
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +0 -35
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js +0 -285
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +0 -12
- package/dist/react/components/rtc-widget/components/ConviMessage.js +0 -13
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +0 -8
- package/dist/react/components/rtc-widget/components/FloatingVideo.js +0 -120
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +0 -31
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +0 -140
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +0 -9
- package/dist/react/components/rtc-widget/components/MessageBubble.js +0 -22
- package/dist/react/components/rtc-widget/components/MessageList.d.ts +0 -13
- package/dist/react/components/rtc-widget/components/MessageList.js +0 -88
- package/dist/react/components/rtc-widget/components/SiteCard.d.ts +0 -14
- package/dist/react/components/rtc-widget/components/SiteCard.js +0 -34
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts +0 -8
- package/dist/react/components/rtc-widget/components/UserMessage.js +0 -14
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -5
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +0 -14
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -24
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +0 -170
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -16
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +0 -64
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -11
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +0 -65
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -13
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -298
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +0 -5
- package/dist/react/components/rtc-widget/components/conviComponents/index.js +0 -5
- package/dist/react/components/rtc-widget/components/index.d.ts +0 -8
- package/dist/react/components/rtc-widget/components/index.js +0 -14
- package/dist/react/components/rtc-widget/index.d.ts +0 -5
- package/dist/react/components/rtc-widget/index.js +0 -8
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +0 -115
- package/dist/react/components/rtc-widget/styles/framerConfig.js +0 -72
- package/dist/react/components/rtc-widget/styles/icons.d.ts +0 -27
- package/dist/react/components/rtc-widget/styles/icons.js +0 -256
- package/dist/react/components/rtc-widget/styles/index.d.ts +0 -5
- package/dist/react/components/rtc-widget/styles/index.js +0 -8
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +0 -89
- package/dist/react/components/rtc-widget/styles/styledComponents.js +0 -662
- package/dist/react/components/rtc-widget/styles/theme.d.ts +0 -187
- package/dist/react/components/rtc-widget/styles/theme.js +0 -289
- package/dist/react/components/rtc-widget/types/index.d.ts +0 -59
- package/dist/react/components/rtc-widget/types/index.js +0 -1
- package/dist/react/hooks/useCharacterInfo.d.ts +0 -18
- package/dist/react/hooks/useCharacterInfo.js +0 -65
- package/dist/react/hooks/useLocalCameraTrack.d.ts +0 -21
- package/dist/react/hooks/useLocalCameraTrack.js +0 -33
- package/dist/react/icons.d.ts +0 -37
- package/dist/react/icons.js +0 -53
- package/dist/utils/lightbox.d.ts +0 -15
- package/dist/utils/lightbox.js +0 -94
- package/dist/vanilla/ConvaiWidget.d.ts +0 -46
- package/dist/vanilla/ConvaiWidget.js +0 -2866
- package/dist/vanilla/WidgetEventSubscriptions.d.ts +0 -14
- package/dist/vanilla/WidgetEventSubscriptions.js +0 -36
- package/dist/vanilla/icons.d.ts +0 -34
- package/dist/vanilla/icons.js +0 -268
- package/dist/vanilla/styles.d.ts +0 -168
- package/dist/vanilla/styles.js +0 -407
- package/dist/vanilla/types.d.ts +0 -170
- package/dist/vanilla/types.js +0 -1
package/README.md
CHANGED
|
@@ -6,11 +6,18 @@
|
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
9
|
-
TypeScript-first SDK for embedding Convai AI characters into React and vanilla JS applications. Voice, text, lipsync, emotions, video, and screen share
|
|
9
|
+
TypeScript-first SDK for embedding Convai AI characters into React and vanilla JS applications. Voice, text, lipsync, emotions, video, and screen share. The ready-made chat UI is the companion package [`@convai/web-widget`](https://www.npmjs.com/package/@convai/web-widget).
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## What's new in
|
|
13
|
+
## What's new in 2.0 (beta)
|
|
14
|
+
|
|
15
|
+
Install the beta with `npm install @convai/web-sdk@beta @convai/web-widget`.
|
|
16
|
+
|
|
17
|
+
- **Headless core.** The SDK ships no UI. `ConvaiWidget`, `MarkdownRenderer`, `AudioRenderer`/`AudioContext` (the React ones) and `createConvaiWidget` are now in [`@convai/web-widget`](https://www.npmjs.com/package/@convai/web-widget) (`/react`, `/vanilla`). Moving them is an import change; the [CHANGELOG](./CHANGELOG.md) has the before/after.
|
|
18
|
+
- **A lighter install.** `styled-components`, `framer-motion` and `@livekit/components-react` no longer come with the SDK, and `react` is an optional peer, needed only for `@convai/web-sdk/react`.
|
|
19
|
+
|
|
20
|
+
### Previously in 1.9.0
|
|
14
21
|
|
|
15
22
|
> **Breaking for 1.8.0 users:** the `<convai-chat>` custom element and the `./embed/browser` entry point (`dist/embed/chat-embed-v1.js`) are removed. The copy/paste published-chat embed is now `<convai-widget>` from [`@convai/web-widget`](https://www.npmjs.com/package/@convai/web-widget); the [CHANGELOG](./CHANGELOG.md) has the before/after snippet.
|
|
16
23
|
|
|
@@ -66,7 +73,7 @@ TypeScript-first SDK for embedding Convai AI characters into React and vanilla J
|
|
|
66
73
|
|
|
67
74
|
## Features
|
|
68
75
|
|
|
69
|
-
- **React & vanilla JS** — `useConvaiClient` hook
|
|
76
|
+
- **React & vanilla JS** — `useConvaiClient` hook and a framework-agnostic core; the prebuilt chat UI (`ConvaiWidget`, `createConvaiWidget`) is in `@convai/web-widget`
|
|
70
77
|
- **Real-time audio/video** — full-duplex WebRTC with echo cancellation, camera, and screen share
|
|
71
78
|
- **Lipsync** — ARKit and MetaHuman blendshape streams for facial animation
|
|
72
79
|
- **Emotions & state of mind** — per-turn emotion detection with intensity scale, plus a settable generation mood
|
|
@@ -87,14 +94,16 @@ TypeScript-first SDK for embedding Convai AI characters into React and vanilla J
|
|
|
87
94
|
## Installation
|
|
88
95
|
|
|
89
96
|
```bash
|
|
90
|
-
npm install @convai/web-sdk
|
|
97
|
+
npm install @convai/web-sdk @convai/web-widget
|
|
91
98
|
# or
|
|
92
|
-
pnpm add @convai/web-sdk
|
|
99
|
+
pnpm add @convai/web-sdk @convai/web-widget
|
|
93
100
|
# or
|
|
94
|
-
yarn add @convai/web-sdk
|
|
101
|
+
yarn add @convai/web-sdk @convai/web-widget
|
|
95
102
|
```
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
`@convai/web-widget` is the ready-made chat UI (`ConvaiWidget` for React, `createConvaiWidget` for vanilla). Since 2.0 the SDK ships no UI, so skip the widget if you build your own interface.
|
|
105
|
+
|
|
106
|
+
**React peer dependency:** `react` `^18 || ^19`, needed only for `@convai/web-sdk/react`.
|
|
98
107
|
|
|
99
108
|
**Runtime requirement:** secure context (`https://` or `http://localhost`) for microphone/camera access.
|
|
100
109
|
|
|
@@ -105,7 +114,8 @@ yarn add @convai/web-sdk
|
|
|
105
114
|
### React
|
|
106
115
|
|
|
107
116
|
```tsx
|
|
108
|
-
import { useConvaiClient
|
|
117
|
+
import { useConvaiClient } from "@convai/web-sdk";
|
|
118
|
+
import { ConvaiWidget } from "@convai/web-widget/react";
|
|
109
119
|
|
|
110
120
|
export function App() {
|
|
111
121
|
const client = useConvaiClient({
|
|
@@ -120,7 +130,8 @@ export function App() {
|
|
|
120
130
|
### Vanilla TypeScript
|
|
121
131
|
|
|
122
132
|
```ts
|
|
123
|
-
import { ConvaiClient
|
|
133
|
+
import { ConvaiClient } from "@convai/web-sdk/vanilla";
|
|
134
|
+
import { createConvaiWidget } from "@convai/web-widget/vanilla";
|
|
124
135
|
|
|
125
136
|
const client = new ConvaiClient({
|
|
126
137
|
apiKey: import.meta.env.VITE_CONVAI_API_KEY,
|
|
@@ -277,9 +288,9 @@ Full documentation is at **<a href="https://docs.convai.com/api-docs/plugins-and
|
|
|
277
288
|
|
|
278
289
|
| Import path | Contents |
|
|
279
290
|
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
280
|
-
| `@convai/web-sdk` | React hooks
|
|
291
|
+
| `@convai/web-sdk` | React hooks and re-exported core types (no UI; see `@convai/web-widget`) |
|
|
281
292
|
| `@convai/web-sdk/react` | Same as default (React-explicit alias) |
|
|
282
|
-
| `@convai/web-sdk/vanilla` | `ConvaiClient
|
|
293
|
+
| `@convai/web-sdk/vanilla` | `ConvaiClient` and the headless `AudioRenderer` (the widget is `@convai/web-widget/vanilla`) |
|
|
283
294
|
| `@convai/web-sdk/core` | Framework-agnostic `ConvaiClient`, managers, and all types |
|
|
284
295
|
| `@convai/web-sdk/embed` | Server-safe publication descriptor and grant helpers |
|
|
285
296
|
| `@convai/web-sdk/lipsync-helpers` | Blendshape format utilities and queue helpers |
|
package/dist/core/types.d.ts
CHANGED
|
@@ -933,8 +933,8 @@ export interface ConvaiConfig {
|
|
|
933
933
|
*
|
|
934
934
|
* The server does not sanitise schemes: a markdown link keeps its target
|
|
935
935
|
* whatever the scheme, `[x](javascript:…)` included (only bare URLs are
|
|
936
|
-
* limited to http(s)).
|
|
937
|
-
* renderer must check every href with `isSafeHref`.
|
|
936
|
+
* limited to http(s)). @convai/web-widget's renderers allow only safe schemes;
|
|
937
|
+
* a custom renderer must check every href with `isSafeHref`.
|
|
938
938
|
*
|
|
939
939
|
* Both widgets render the preserved form as clickable links, with inline
|
|
940
940
|
* previews for image and video URLs. If you render `chatMessages` yourself,
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { useConvaiClient } from './hooks/useConvaiClient.js';
|
|
2
|
-
export { ConvaiWidget } from './components/ConvaiWidget.js';
|
|
3
|
-
export { MarkdownRenderer } from './components/rtc-widget/components/MarkdownRenderer.js';
|
|
4
2
|
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
5
3
|
export type { InlineNode, MediaKind } from '../utils/inlineMarkdown.js';
|
|
6
4
|
export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
|
|
@@ -11,4 +9,3 @@ export * from './hooks/index.js';
|
|
|
11
9
|
export * from '../core/types.js';
|
|
12
10
|
export { getDisconnectReasonMessage } from '../core/types.js';
|
|
13
11
|
export { ActionResultAckError, ConvaiClient } from '../core/index.js';
|
|
14
|
-
export { RoomAudioRenderer as AudioRenderer, RoomContext as AudioContext } from '@livekit/components-react';
|
package/dist/react/index.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
// Main hook (backward compatible)
|
|
2
2
|
export { useConvaiClient } from './hooks/useConvaiClient.js';
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
// `media={false}` on the user's own bubble: previews are a bot-side
|
|
7
|
-
// affordance, and rendering them on a line the user typed lets any pasted URL
|
|
8
|
-
// pull remote media into the transcript.
|
|
9
|
-
export { MarkdownRenderer } from './components/rtc-widget/components/MarkdownRenderer.js';
|
|
10
|
-
// The tokenizer behind it, for building a renderer from scratch.
|
|
3
|
+
// No UI ships from the SDK since 2.0: ConvaiWidget, MarkdownRenderer,
|
|
4
|
+
// AudioRenderer and AudioContext are in @convai/web-widget/react.
|
|
5
|
+
// The bubble tokenizer, for building a renderer from scratch.
|
|
11
6
|
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
12
7
|
export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
|
|
13
8
|
export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
|
|
@@ -19,5 +14,3 @@ export * from '../core/types.js';
|
|
|
19
14
|
export { getDisconnectReasonMessage } from '../core/types.js';
|
|
20
15
|
// Re-export core client for advanced usage
|
|
21
16
|
export { ActionResultAckError, ConvaiClient } from '../core/index.js';
|
|
22
|
-
// Re-export LiveKit components for convenience (backward compatible)
|
|
23
|
-
export { RoomAudioRenderer as AudioRenderer, RoomContext as AudioContext } from '@livekit/components-react';
|
package/dist/vanilla/index.d.ts
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Convai Web SDK - Vanilla JavaScript/TypeScript Export
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The client and its helpers, for non-React applications. The SDK ships no UI
|
|
5
|
+
* since 2.0: `createConvaiWidget` is in `@convai/web-widget/vanilla`.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* import { ConvaiClient
|
|
9
|
+
* import { ConvaiClient } from '@convai/web-sdk/vanilla';
|
|
10
|
+
* import { createConvaiWidget } from '@convai/web-widget/vanilla';
|
|
10
11
|
*
|
|
11
|
-
* // Pass config to constructor (same pattern as React's useConvaiClient)
|
|
12
12
|
* const client = new ConvaiClient({
|
|
13
13
|
* apiKey: 'your-api-key',
|
|
14
14
|
* characterId: 'your-character-id',
|
|
15
|
-
* enableVideo: true,
|
|
16
15
|
* });
|
|
17
16
|
*
|
|
18
|
-
* //
|
|
19
|
-
*
|
|
20
|
-
* convaiClient: client
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* // Client has all functions for advanced usage:
|
|
24
|
-
* // - client.connect() - manual connection
|
|
25
|
-
* // - client.disconnect() - disconnect
|
|
26
|
-
* // - client.reconnect() - reconnect
|
|
27
|
-
* // - client.sendUserTextMessage() - send messages
|
|
28
|
-
* // - client.audioControls, videoControls, etc.
|
|
17
|
+
* // The widget auto-connects on first click.
|
|
18
|
+
* createConvaiWidget(document.body, { convaiClient: client });
|
|
29
19
|
* ```
|
|
30
20
|
*/
|
|
31
21
|
export { ActionResultAckError, ConvaiClient } from '../core/ConvaiClient.js';
|
|
32
22
|
export { CharacterVersionManager, CharacterApiError } from '../core/CharacterVersionManager.js';
|
|
33
23
|
export { ConvaiRoomError } from '../core/ConvaiRoomError.js';
|
|
34
24
|
export { AudioRenderer } from './AudioRenderer.js';
|
|
35
|
-
export { createConvaiWidget, destroyConvaiWidget } from './ConvaiWidget.js';
|
|
36
25
|
export * from '../core/types.js';
|
|
37
26
|
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
38
27
|
export type { InlineNode, MediaKind } from '../utils/inlineMarkdown.js';
|
|
@@ -40,4 +29,3 @@ export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
|
|
|
40
29
|
export type { LinkKind } from '../utils/linkPresentation.js';
|
|
41
30
|
export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
|
|
42
31
|
export type { LinkPreviewMeta, LinkPreviewResolver } from '../utils/linkPreview.js';
|
|
43
|
-
export type { VanillaWidget, VanillaWidgetOptions, WidgetPlacement, } from './types.js';
|
package/dist/vanilla/index.js
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Convai Web SDK - Vanilla JavaScript/TypeScript Export
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The client and its helpers, for non-React applications. The SDK ships no UI
|
|
5
|
+
* since 2.0: `createConvaiWidget` is in `@convai/web-widget/vanilla`.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* import { ConvaiClient
|
|
9
|
+
* import { ConvaiClient } from '@convai/web-sdk/vanilla';
|
|
10
|
+
* import { createConvaiWidget } from '@convai/web-widget/vanilla';
|
|
10
11
|
*
|
|
11
|
-
* // Pass config to constructor (same pattern as React's useConvaiClient)
|
|
12
12
|
* const client = new ConvaiClient({
|
|
13
13
|
* apiKey: 'your-api-key',
|
|
14
14
|
* characterId: 'your-character-id',
|
|
15
|
-
* enableVideo: true,
|
|
16
15
|
* });
|
|
17
16
|
*
|
|
18
|
-
* //
|
|
19
|
-
*
|
|
20
|
-
* convaiClient: client
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* // Client has all functions for advanced usage:
|
|
24
|
-
* // - client.connect() - manual connection
|
|
25
|
-
* // - client.disconnect() - disconnect
|
|
26
|
-
* // - client.reconnect() - reconnect
|
|
27
|
-
* // - client.sendUserTextMessage() - send messages
|
|
28
|
-
* // - client.audioControls, videoControls, etc.
|
|
17
|
+
* // The widget auto-connects on first click.
|
|
18
|
+
* createConvaiWidget(document.body, { convaiClient: client });
|
|
29
19
|
* ```
|
|
30
20
|
*/
|
|
31
21
|
// Main client for managing connections
|
|
@@ -34,11 +24,9 @@ export { CharacterVersionManager, CharacterApiError } from '../core/CharacterVer
|
|
|
34
24
|
export { ConvaiRoomError } from '../core/ConvaiRoomError.js';
|
|
35
25
|
// AudioRenderer for custom UI builders (handles audio playback)
|
|
36
26
|
export { AudioRenderer } from './AudioRenderer.js';
|
|
37
|
-
// Vanilla widget - complete UI solution
|
|
38
|
-
export { createConvaiWidget, destroyConvaiWidget } from './ConvaiWidget.js';
|
|
39
27
|
// Re-export ALL core types for complete parity with React
|
|
40
28
|
export * from '../core/types.js';
|
|
41
|
-
// Inline markdown tokenizer, for building
|
|
29
|
+
// Inline markdown tokenizer, for building your own chat UI.
|
|
42
30
|
export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
|
|
43
31
|
export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
|
|
44
32
|
export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "2.0.0-beta.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@convai/web-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "Build web apps with lifelike AI characters. The Convai Web SDK gives you real-time voice, lipsync, emotions, and dynamic context — with first-class support for React and vanilla TypeScript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -129,8 +129,7 @@
|
|
|
129
129
|
"peerDependencies": {
|
|
130
130
|
"@pipecat-ai/client-js": "^1.7.0",
|
|
131
131
|
"@pipecat-ai/websocket-transport": "^1.6.2",
|
|
132
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
133
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
132
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
134
133
|
},
|
|
135
134
|
"peerDependenciesMeta": {
|
|
136
135
|
"@pipecat-ai/client-js": {
|
|
@@ -138,16 +137,17 @@
|
|
|
138
137
|
},
|
|
139
138
|
"@pipecat-ai/websocket-transport": {
|
|
140
139
|
"optional": true
|
|
140
|
+
},
|
|
141
|
+
"react": {
|
|
142
|
+
"optional": true
|
|
141
143
|
}
|
|
142
144
|
},
|
|
143
145
|
"dependencies": {
|
|
144
|
-
"
|
|
145
|
-
"framer-motion": "^11.18.0",
|
|
146
|
-
"livekit-client": ">=2.17.2 <3",
|
|
147
|
-
"styled-components": "^6.1.15"
|
|
146
|
+
"livekit-client": ">=2.17.2 <3"
|
|
148
147
|
},
|
|
149
148
|
"devDependencies": {
|
|
150
149
|
"@changesets/cli": "^2.29.5",
|
|
150
|
+
"@convai/web-widget": "0.2.0",
|
|
151
151
|
"@pipecat-ai/client-js": "^1.7.0",
|
|
152
152
|
"@pipecat-ai/websocket-transport": "^1.6.2",
|
|
153
153
|
"@types/node": "^20.17.13",
|
|
@@ -155,7 +155,8 @@
|
|
|
155
155
|
"@types/react-dom": "^18.3.5",
|
|
156
156
|
"esbuild": "^0.28.2",
|
|
157
157
|
"happy-dom": "^15.11.7",
|
|
158
|
-
"react
|
|
158
|
+
"react": "^18.3.1",
|
|
159
|
+
"react-dom": "^18.3.1",
|
|
159
160
|
"rimraf": "^5.0.0",
|
|
160
161
|
"typescript": "^5.7.3",
|
|
161
162
|
"vitest": "^3.2.4"
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { LinkPreviewResolver } from "../../utils/linkPreview.js";
|
|
2
|
-
import type { IConvaiClient, PublishedChatConnectOptions } from "../../core/types.js";
|
|
3
|
-
import type { PublishedChatDescriptor } from "../../embed/publicationApi.js";
|
|
4
|
-
interface ConvaiWidgetProps {
|
|
5
|
-
/** Convai client instance (required) */
|
|
6
|
-
convaiClient: IConvaiClient & {
|
|
7
|
-
activity?: string;
|
|
8
|
-
isAudioMuted: boolean;
|
|
9
|
-
isVideoEnabled: boolean;
|
|
10
|
-
isScreenShareActive: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Show video toggle button in settings (default: true).
|
|
14
|
-
* Only works if connection type is "video". If false, hides the video button.
|
|
15
|
-
*/
|
|
16
|
-
showVideo?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Show screen share toggle button in settings (default: true).
|
|
19
|
-
* Only works if connection type is "video". If false, hides the screen share button.
|
|
20
|
-
*/
|
|
21
|
-
showScreenShare?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Start in voice mode by default when widget opens (default: true).
|
|
24
|
-
* When true, the widget will open directly in voice mode with microphone enabled.
|
|
25
|
-
*/
|
|
26
|
-
defaultVoiceMode?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Mint a fresh single-use grant when a published-chat session is reopened.
|
|
29
|
-
* Required when using this widget with connectWithPublicationGrant().
|
|
30
|
-
*/
|
|
31
|
-
requestPublicationGrant?: () => Promise<string>;
|
|
32
|
-
/** Core endpoint override used with requestPublicationGrant. */
|
|
33
|
-
publishedChatConnectOptions?: PublishedChatConnectOptions;
|
|
34
|
-
/**
|
|
35
|
-
* Open Graph lookup for plain web links the character sends. Supply a
|
|
36
|
-
* function that asks your backend for a page's metadata and each such link
|
|
37
|
-
* gets a site card (favicon, site name, title, description, image) once it
|
|
38
|
-
* resolves. Omit it and links render as before. See
|
|
39
|
-
* docs/convai_link_previews.md, "Site cards".
|
|
40
|
-
*/
|
|
41
|
-
linkPreviewResolver?: LinkPreviewResolver;
|
|
42
|
-
/** Public descriptor used to label a credential-free published session. */
|
|
43
|
-
publishedChatDescriptor?: Pick<PublishedChatDescriptor, "display_name" | "image_url">;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* ConvaiWidget - A consolidated chat widget component for real-time conversations
|
|
47
|
-
*
|
|
48
|
-
* This component provides a complete UI for interacting with Convai characters.
|
|
49
|
-
* Connection configuration should be handled via useConvaiClient.connect().
|
|
50
|
-
*
|
|
51
|
-
* Features:
|
|
52
|
-
* - Collapsed circular button with status indicator
|
|
53
|
-
* - Expandable/collapsible chat interface
|
|
54
|
-
* - Voice mode support
|
|
55
|
-
* - Real-time message streaming
|
|
56
|
-
* - Audio controls (mute/unmute)
|
|
57
|
-
* - Settings tray with session reset
|
|
58
|
-
* - Optional video and screen share (when connection type supports it)
|
|
59
|
-
*
|
|
60
|
-
* @param {ConvaiWidgetProps} props - Component props
|
|
61
|
-
* @param {ConvaiClient} props.convaiClient - Convai client instance (required)
|
|
62
|
-
* @param {boolean} props.showVideo - Show video toggle in settings (default: true)
|
|
63
|
-
* @param {boolean} props.showScreenShare - Show screen share toggle in settings (default: true)
|
|
64
|
-
* @param {boolean} props.defaultVoiceMode - Start in voice mode when widget opens (default: true)
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```tsx
|
|
68
|
-
* function App() {
|
|
69
|
-
* const convaiClient = useConvaiClient({
|
|
70
|
-
* apiKey: 'your-api-key',
|
|
71
|
-
* characterId: 'your-character-id',
|
|
72
|
-
* enableVideo: true,
|
|
73
|
-
* });
|
|
74
|
-
*
|
|
75
|
-
* return (
|
|
76
|
-
* <ConvaiWidget
|
|
77
|
-
* convaiClient={convaiClient}
|
|
78
|
-
* showVideo={true}
|
|
79
|
-
* showScreenShare={true}
|
|
80
|
-
* />
|
|
81
|
-
* );
|
|
82
|
-
* }
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare const ConvaiWidget: React.FC<ConvaiWidgetProps>;
|
|
86
|
-
export {};
|