@convai/web-widget 0.1.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.
- package/README.md +55 -11
- package/chunks/lightbox-Dxfdw3VU.js +683 -0
- package/index.d.ts +26 -0
- package/index.js +4 -0
- package/package.json +53 -2
- package/react.d.ts +23 -0
- package/react.js +3551 -0
- package/runtime.js +12588 -18085
- package/types.d.ts +62 -0
- package/ui/react/components/ConvaiWidget.d.ts +86 -0
- package/ui/react/components/index.d.ts +1 -0
- package/ui/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +9 -0
- package/ui/react/components/rtc-widget/components/AudioVisualizer.d.ts +35 -0
- package/ui/react/components/rtc-widget/components/ConviMessage.d.ts +13 -0
- package/ui/react/components/rtc-widget/components/FloatingVideo.d.ts +8 -0
- package/ui/react/components/rtc-widget/components/MarkdownRenderer.d.ts +31 -0
- package/ui/react/components/rtc-widget/components/MessageBubble.d.ts +9 -0
- package/ui/react/components/rtc-widget/components/MessageList.d.ts +14 -0
- package/ui/react/components/rtc-widget/components/SiteCard.d.ts +15 -0
- package/ui/react/components/rtc-widget/components/UserMessage.d.ts +9 -0
- package/ui/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +6 -0
- package/ui/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +24 -0
- package/ui/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +16 -0
- package/ui/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +12 -0
- package/ui/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +14 -0
- package/ui/react/components/rtc-widget/components/conviComponents/index.d.ts +5 -0
- package/ui/react/components/rtc-widget/components/index.d.ts +8 -0
- package/ui/react/components/rtc-widget/index.d.ts +5 -0
- package/ui/react/components/rtc-widget/styles/framerConfig.d.ts +115 -0
- package/ui/react/components/rtc-widget/styles/icons.d.ts +27 -0
- package/ui/react/components/rtc-widget/styles/index.d.ts +5 -0
- package/ui/react/components/rtc-widget/styles/styledComponents.d.ts +53 -0
- package/ui/react/components/rtc-widget/styles/theme.d.ts +187 -0
- package/ui/react/components/rtc-widget/types/index.d.ts +59 -0
- package/ui/react/hooks/useCharacterInfo.d.ts +18 -0
- package/ui/react/hooks/useLocalCameraTrack.d.ts +21 -0
- package/ui/react/icons.d.ts +37 -0
- package/ui/shared/lightbox.d.ts +15 -0
- package/ui/shared/linkStyles.d.ts +64 -0
- package/ui/shared/logger.d.ts +30 -0
- package/ui/vanilla/ConvaiWidget.d.ts +46 -0
- package/ui/vanilla/WidgetEventSubscriptions.d.ts +14 -0
- package/ui/vanilla/icons.d.ts +34 -0
- package/ui/vanilla/styles.d.ts +168 -0
- package/ui/vanilla/types.d.ts +170 -0
- package/vanilla.d.ts +21 -0
- package/vanilla.js +2512 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ production** — [step two](#before-you-ship) moves it to your server.
|
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<convai-widget character-id="YOUR_CHARACTER_ID" api-key="YOUR_API_KEY"></convai-widget>
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.2.0/v1.js" async></script>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
A launcher bubble appears in the bottom-right corner. Click it: the runtime
|
|
@@ -23,7 +23,7 @@ The script tag goes in your HTML shell; the element is ordinary JSX.
|
|
|
23
23
|
|
|
24
24
|
```html
|
|
25
25
|
<!-- index.html -->
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.2.0/v1.js" async></script>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```jsx
|
|
@@ -33,12 +33,56 @@ The script tag goes in your HTML shell; the element is ordinary JSX.
|
|
|
33
33
|
In Next.js, use `next/script` with `strategy="afterInteractive"` — it injects a
|
|
34
34
|
classic script tag, which is what the loader needs.
|
|
35
35
|
|
|
36
|
-
> **
|
|
37
|
-
> runtime chunk's URL from its own `<script src>`, so a bundled import (or a
|
|
38
|
-
> `<script type="module">`) leaves it
|
|
39
|
-
>
|
|
40
|
-
>
|
|
41
|
-
>
|
|
36
|
+
> **Load `v1.js` from a script tag, never from a bundle.** The loader derives
|
|
37
|
+
> the runtime chunk's URL from its own `<script src>`, so a bundled import (or a
|
|
38
|
+
> `<script type="module">`) leaves it nothing to derive from: the bubble paints
|
|
39
|
+
> and then fails on click with `could not resolve the runtime URL`. That applies
|
|
40
|
+
> to the element only. If you are building an app, you probably want the
|
|
41
|
+
> library entries below instead.
|
|
42
|
+
|
|
43
|
+
## Already using `@convai/web-sdk` or `@convai/embody`?
|
|
44
|
+
|
|
45
|
+
Then you already have a `ConvaiClient`, and you should not let the element build
|
|
46
|
+
a second one: that is two connections, two conversation histories and two
|
|
47
|
+
billed sessions against the same character, with no error to tell you.
|
|
48
|
+
|
|
49
|
+
Import the chat UI instead and hand it the client you have. These entries keep
|
|
50
|
+
`@convai/web-sdk`, React and `livekit-client` external, so your bundler links
|
|
51
|
+
one copy of each — the app's own.
|
|
52
|
+
|
|
53
|
+
**React**
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { useConvaiClient } from '@convai/web-sdk/react'
|
|
57
|
+
import { ConvaiWidget } from '@convai/web-widget/react'
|
|
58
|
+
|
|
59
|
+
export function Chat() {
|
|
60
|
+
const client = useConvaiClient({ apiKey: API_KEY, characterId: CHARACTER_ID })
|
|
61
|
+
return <ConvaiWidget convaiClient={client} />
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**No framework**
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { ConvaiClient } from '@convai/web-sdk/core'
|
|
69
|
+
import { createConvaiWidget } from '@convai/web-widget/vanilla'
|
|
70
|
+
|
|
71
|
+
const client = new ConvaiClient({ apiKey: API_KEY, characterId: CHARACTER_ID })
|
|
72
|
+
createConvaiWidget(document.body, { convaiClient: client })
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The vanilla entry is hand-written DOM and CSS. It imports no React,
|
|
76
|
+
styled-components or framer-motion, so none of them reach your bundle.
|
|
77
|
+
|
|
78
|
+
| Entry | What it is | For |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `v1.js` (script tag) | the `<convai-widget>` element, SDK bundled in | a page with no build step |
|
|
81
|
+
| `@convai/web-widget/react` | `ConvaiWidget`, `MarkdownRenderer`, `useCharacterInfo` | React apps |
|
|
82
|
+
| `@convai/web-widget/vanilla` | `createConvaiWidget` | apps without a framework |
|
|
83
|
+
|
|
84
|
+
These moved here from `@convai/web-sdk`, which now creates clients and ships no
|
|
85
|
+
UI. Install `@convai/web-sdk` alongside this package; it is a peer dependency.
|
|
42
86
|
|
|
43
87
|
## Before you ship
|
|
44
88
|
|
|
@@ -98,16 +142,16 @@ guide; theming and `::part()` hooks; CSP requirements; and guidance on
|
|
|
98
142
|
|
|
99
143
|
## Versioning
|
|
100
144
|
|
|
101
|
-
`0.
|
|
145
|
+
`0.2.0` is a stable release: `npm install @convai/web-widget` and
|
|
102
146
|
jsDelivr's unversioned URL both resolve it. Pin the exact version anyway for
|
|
103
147
|
reproducible deploys —
|
|
104
148
|
|
|
105
149
|
```html
|
|
106
|
-
<script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.
|
|
150
|
+
<script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.2.0/v1.js" async></script>
|
|
107
151
|
```
|
|
108
152
|
|
|
109
153
|
```bash
|
|
110
|
-
npm install @convai/web-widget@0.
|
|
154
|
+
npm install @convai/web-widget@0.2.0 # only needed to self-host the two files
|
|
111
155
|
```
|
|
112
156
|
|
|
113
157
|
This package is early, and it bundles a prerelease of `@convai/web-sdk`. The
|