@convai/web-widget 0.1.4 → 0.2.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.
Files changed (47) hide show
  1. package/README.md +55 -11
  2. package/chunks/lightbox-Dxfdw3VU.js +683 -0
  3. package/index.d.ts +26 -0
  4. package/index.js +4 -0
  5. package/package.json +53 -2
  6. package/react.d.ts +23 -0
  7. package/react.js +3551 -0
  8. package/runtime.js +12588 -18085
  9. package/types.d.ts +62 -0
  10. package/ui/react/components/ConvaiWidget.d.ts +86 -0
  11. package/ui/react/components/index.d.ts +1 -0
  12. package/ui/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +9 -0
  13. package/ui/react/components/rtc-widget/components/AudioVisualizer.d.ts +35 -0
  14. package/ui/react/components/rtc-widget/components/ConviMessage.d.ts +13 -0
  15. package/ui/react/components/rtc-widget/components/FloatingVideo.d.ts +8 -0
  16. package/ui/react/components/rtc-widget/components/MarkdownRenderer.d.ts +31 -0
  17. package/ui/react/components/rtc-widget/components/MessageBubble.d.ts +9 -0
  18. package/ui/react/components/rtc-widget/components/MessageList.d.ts +14 -0
  19. package/ui/react/components/rtc-widget/components/SiteCard.d.ts +15 -0
  20. package/ui/react/components/rtc-widget/components/UserMessage.d.ts +9 -0
  21. package/ui/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +6 -0
  22. package/ui/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +24 -0
  23. package/ui/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +16 -0
  24. package/ui/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +12 -0
  25. package/ui/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +14 -0
  26. package/ui/react/components/rtc-widget/components/conviComponents/index.d.ts +5 -0
  27. package/ui/react/components/rtc-widget/components/index.d.ts +8 -0
  28. package/ui/react/components/rtc-widget/index.d.ts +5 -0
  29. package/ui/react/components/rtc-widget/styles/framerConfig.d.ts +115 -0
  30. package/ui/react/components/rtc-widget/styles/icons.d.ts +27 -0
  31. package/ui/react/components/rtc-widget/styles/index.d.ts +5 -0
  32. package/ui/react/components/rtc-widget/styles/styledComponents.d.ts +53 -0
  33. package/ui/react/components/rtc-widget/styles/theme.d.ts +187 -0
  34. package/ui/react/components/rtc-widget/types/index.d.ts +59 -0
  35. package/ui/react/hooks/useCharacterInfo.d.ts +18 -0
  36. package/ui/react/hooks/useLocalCameraTrack.d.ts +21 -0
  37. package/ui/react/icons.d.ts +37 -0
  38. package/ui/shared/lightbox.d.ts +15 -0
  39. package/ui/shared/linkStyles.d.ts +64 -0
  40. package/ui/shared/logger.d.ts +30 -0
  41. package/ui/vanilla/ConvaiWidget.d.ts +46 -0
  42. package/ui/vanilla/WidgetEventSubscriptions.d.ts +14 -0
  43. package/ui/vanilla/icons.d.ts +34 -0
  44. package/ui/vanilla/styles.d.ts +168 -0
  45. package/ui/vanilla/types.d.ts +170 -0
  46. package/vanilla.d.ts +21 -0
  47. 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.1.4/v1.js" async></script>
13
+ <script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.2.0-beta.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.1.4/v1.js" async></script>
26
+ <script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.2.0-beta.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
- > **Do not `import` this package into an app bundle.** The loader derives the
37
- > runtime chunk's URL from its own `<script src>`, so a bundled import (or a
38
- > `<script type="module">`) leaves it with nothing to derive from: the bubble
39
- > paints and then fails on click with `could not resolve the runtime URL`. Load
40
- > it from a script tag. The npm package exists so you can self-host `v1.js` and
41
- > `runtime.js` from your own origin.
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.1.4` is a stable release: `npm install @convai/web-widget` and
145
+ `0.2.0-beta.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.1.4/v1.js" async></script>
150
+ <script src="https://cdn.jsdelivr.net/npm/@convai/web-widget@0.2.0-beta.0/v1.js" async></script>
107
151
  ```
108
152
 
109
153
  ```bash
110
- npm install @convai/web-widget@0.1.4 # only needed to self-host the two files
154
+ npm install @convai/web-widget@0.2.0-beta.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