@botuyo/chat-widget-standalone 1.0.61 → 1.0.63
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/LICENSE +21 -21
- package/README.md +302 -323
- package/dist/Avatar3D-LfNJe183.js.map +1 -1
- package/dist/botuyo-chat.es.js +35 -36
- package/dist/botuyo-chat.es.js.map +1 -1
- package/dist/botuyo-chat.umd.js +1 -1
- package/dist/botuyo-chat.umd.js.map +1 -1
- package/dist/{chunk-audio-BWzosE4G.js → chunk-audio-D3yXcqpi.js} +2 -2
- package/dist/chunk-audio-D3yXcqpi.js.map +1 -0
- package/dist/{chunk-chat-ui-DdO5hnyL.js → chunk-chat-ui-DHu5_wQn.js} +32 -32
- package/dist/chunk-chat-ui-DHu5_wQn.js.map +1 -0
- package/dist/{chunk-gallery-D3t-QnJv.js → chunk-gallery-CJ1ehwV0.js} +2 -2
- package/dist/chunk-gallery-CJ1ehwV0.js.map +1 -0
- package/dist/src/chat-widget/ChatWidget.d.ts.map +1 -1
- package/dist/src/chat-widget/components/Gallery.stories.d.ts.map +1 -1
- package/dist/src/chat-widget/components/MessageBubble.d.ts.map +1 -1
- package/dist/src/chat-widget/components/MessageList.d.ts.map +1 -1
- package/dist/src/chat-widget/hooks/useChatSocket.d.ts.map +1 -1
- package/dist/src/chat-widget/hooks/useWidgetTheme.d.ts +1 -1
- package/dist/src/chat-widget/types/index.d.ts +20 -0
- package/dist/src/chat-widget/types/index.d.ts.map +1 -1
- package/dist/src/chat-widget/utils/theme.d.ts +3 -2
- package/dist/src/chat-widget/utils/theme.d.ts.map +1 -1
- package/dist/standalone.d.ts +6 -1
- package/dist/standalone.d.ts.map +1 -1
- package/dist/stats-umd.html +1 -1
- package/dist/stats.html +1 -1
- package/package.json +155 -155
- package/dist/ShadowChatWidget.d.ts +0 -25
- package/dist/ShadowChatWidget.d.ts.map +0 -1
- package/dist/chunk-audio-BWzosE4G.js.map +0 -1
- package/dist/chunk-chat-ui-DdO5hnyL.js.map +0 -1
- package/dist/chunk-gallery-D3t-QnJv.js.map +0 -1
- package/dist/src/chat-widget/utils/theme.examples.d.ts +0 -47
- package/dist/src/chat-widget/utils/theme.examples.d.ts.map +0 -1
- package/dist/src/chat-widget/utils/themes/index.d.ts +0 -12
- package/dist/src/chat-widget/utils/themes/index.d.ts.map +0 -1
- package/examples/cdn-example.html +0 -226
- package/examples/nextjs-example.js +0 -188
- package/examples/nextjs-example.tsx +0 -229
- package/examples/react-example.js +0 -168
- package/examples/react-example.tsx +0 -221
package/README.md
CHANGED
|
@@ -1,323 +1,302 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
##
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
|
281
|
-
|
|
282
|
-
|
|
|
283
|
-
|
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
npm
|
|
296
|
-
|
|
297
|
-
#
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
# Solo UMD bundle
|
|
304
|
-
npm run build:umd
|
|
305
|
-
|
|
306
|
-
# Tests
|
|
307
|
-
npm test
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
## 🔗 Links
|
|
313
|
-
|
|
314
|
-
- **NPM**: [npmjs.com/package/@botuyo/chat-widget-standalone](https://www.npmjs.com/package/@botuyo/chat-widget-standalone)
|
|
315
|
-
- **CDN BotUyo**: `https://cdn-chatbot.botuyo.com/latest/`
|
|
316
|
-
- **CDN jsDelivr**: `https://cdn.jsdelivr.net/npm/@botuyo/chat-widget-standalone@1.0.4/dist/`
|
|
317
|
-
- **Documentación**: [docs.botuyo.com](https://docs.botuyo.com)
|
|
318
|
-
|
|
319
|
-
---
|
|
320
|
-
|
|
321
|
-
## 📄 Licencia
|
|
322
|
-
|
|
323
|
-
MIT License - © 2026 BotUyo
|
|
1
|
+
# @botuyo/chat-widget
|
|
2
|
+
|
|
3
|
+
> AI-powered chat widget with Shadow DOM isolation, dark mode, voice chat, and full white-labeling. Works as a CDN script tag or NPM React component.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Start — CDN (Standalone)
|
|
8
|
+
|
|
9
|
+
Add a single script tag to any HTML page. No build step required.
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<script src="https://cdn.botuyo.com/widget/botuyo-chat.js"></script>
|
|
13
|
+
<script>
|
|
14
|
+
BotUyoChat.init({
|
|
15
|
+
apiKey: 'YOUR_API_KEY'
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
That's it. The widget connects to the BotUyo backend, receives the agent configuration (name, avatar, colors, voice settings), and renders itself in a Shadow DOM so it never conflicts with your site's CSS.
|
|
21
|
+
|
|
22
|
+
### CDN — Custom Theme Override
|
|
23
|
+
|
|
24
|
+
You can override any server-sent value locally:
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<script src="https://cdn.botuyo.com/widget/botuyo-chat.js"></script>
|
|
28
|
+
<script>
|
|
29
|
+
BotUyoChat.init({
|
|
30
|
+
apiKey: 'YOUR_API_KEY',
|
|
31
|
+
theme: {
|
|
32
|
+
botName: 'Soporte',
|
|
33
|
+
position: 'bottom-left',
|
|
34
|
+
welcomeMessage: '¡Hola! ¿En qué te puedo ayudar?',
|
|
35
|
+
inputPlaceholder: 'Escribí tu mensaje...',
|
|
36
|
+
cssVariables: {
|
|
37
|
+
primary: '210 100% 50%', // Blue
|
|
38
|
+
primaryForeground: '0 0% 100%', // White text on blue
|
|
39
|
+
background: '0 0% 100%', // White background
|
|
40
|
+
foreground: '210 20% 12%', // Dark text
|
|
41
|
+
radius: '0.75rem',
|
|
42
|
+
},
|
|
43
|
+
darkCssVariables: {
|
|
44
|
+
background: '220 40% 3%',
|
|
45
|
+
foreground: '210 20% 98%',
|
|
46
|
+
card: '220 40% 5%',
|
|
47
|
+
muted: '220 30% 10%',
|
|
48
|
+
border: '220 30% 12%',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### CDN — Programmatic API
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
BotUyoChat.open(); // Open the chat window
|
|
59
|
+
BotUyoChat.close(); // Close the chat window
|
|
60
|
+
BotUyoChat.sendMessage('Hola!'); // Send a message
|
|
61
|
+
BotUyoChat.destroy(); // Remove widget from page
|
|
62
|
+
|
|
63
|
+
// Update config at runtime
|
|
64
|
+
BotUyoChat.update({
|
|
65
|
+
theme: { botName: 'New Name' }
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## NPM — React / Next.js
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install @botuyo/chat-widget-standalone
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Option 1: Drop-in Component (Shadow DOM)
|
|
78
|
+
|
|
79
|
+
The default `ChatWidget` export renders inside Shadow DOM for full CSS isolation:
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { ChatWidget } from '@botuyo/chat-widget-standalone';
|
|
83
|
+
|
|
84
|
+
export default function App() {
|
|
85
|
+
return (
|
|
86
|
+
<ChatWidget
|
|
87
|
+
apiKey="YOUR_API_KEY"
|
|
88
|
+
theme={{
|
|
89
|
+
position: 'bottom-right',
|
|
90
|
+
cssVariables: {
|
|
91
|
+
primary: '210 100% 50%',
|
|
92
|
+
},
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Option 2: Provider + Hook (Programmatic Control)
|
|
100
|
+
|
|
101
|
+
Use `ChatWidgetProvider` to access the widget state from any component:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { ChatWidgetProvider, useChatWidget } from '@botuyo/chat-widget-standalone';
|
|
105
|
+
|
|
106
|
+
function App() {
|
|
107
|
+
return (
|
|
108
|
+
<ChatWidgetProvider apiKey="YOUR_API_KEY">
|
|
109
|
+
<MyPage />
|
|
110
|
+
</ChatWidgetProvider>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function MyPage() {
|
|
115
|
+
const { open, close, isOpen, unreadCount, sendMessage } = useChatWidget();
|
|
116
|
+
|
|
117
|
+
return (
|
|
118
|
+
<button onClick={open}>
|
|
119
|
+
Chat {unreadCount > 0 && `(${unreadCount})`}
|
|
120
|
+
</button>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Option 3: Unstyled Component (No Shadow DOM)
|
|
126
|
+
|
|
127
|
+
If you want the widget in your own DOM tree (useful inside existing design systems):
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { ChatWidgetUnstyled } from '@botuyo/chat-widget-standalone';
|
|
131
|
+
import '@botuyo/chat-widget-standalone/style.css';
|
|
132
|
+
|
|
133
|
+
export default function App() {
|
|
134
|
+
return <ChatWidgetUnstyled apiKey="YOUR_API_KEY" />;
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Configuration Reference
|
|
141
|
+
|
|
142
|
+
### `ChatWidgetProps`
|
|
143
|
+
|
|
144
|
+
| Prop | Type | Default | Description |
|
|
145
|
+
|------|------|---------|-------------|
|
|
146
|
+
| `apiKey` | `string` | **(required)** | Your public API key |
|
|
147
|
+
| `apiBaseUrl` | `string` | `https://api.botuyo.com` | Backend gateway URL |
|
|
148
|
+
| `agentId` | `string` | — | Connect to a specific agent flow |
|
|
149
|
+
| `theme` | `ChatTheme` | — | Visual configuration (see below) |
|
|
150
|
+
| `mediaConfig` | `MediaConfig` | — | Toggle images, audio, files, location, voice |
|
|
151
|
+
| `userContext` | `{ token?, metadata? }` | — | Pass authenticated user info |
|
|
152
|
+
| `pageContext` | `PageContext` | — | Page-level context sent with each message |
|
|
153
|
+
| `includeSEOMetadata` | `boolean` | `false` | Auto-capture page SEO data |
|
|
154
|
+
| `onNavigate` | `(url) => void` | — | Bot requests navigation |
|
|
155
|
+
| `onLogin` | `(userData) => void` | — | Bot completes authentication |
|
|
156
|
+
| `onEvent` | `(name, data) => void` | — | Widget lifecycle events |
|
|
157
|
+
| `onStateChange` | `(isOpen) => void` | — | Window open/close callback |
|
|
158
|
+
|
|
159
|
+
### `ChatTheme`
|
|
160
|
+
|
|
161
|
+
| Property | Type | Description |
|
|
162
|
+
|----------|------|-------------|
|
|
163
|
+
| `botName` | `string` | Bot display name |
|
|
164
|
+
| `logoUrl` | `string` | Bot avatar URL |
|
|
165
|
+
| `headerText` | `string` | Header bar text (overrides botName in header) |
|
|
166
|
+
| `position` | `'bottom-right' \| 'bottom-left'` | Launcher position |
|
|
167
|
+
| `welcomeMessage` | `string` | First message shown to user |
|
|
168
|
+
| `inputPlaceholder` | `string` | Input field placeholder |
|
|
169
|
+
| `starterPrompt` | `string` | Prompt bubble shown when chat is closed |
|
|
170
|
+
| `defaultLocale` | `'es' \| 'en' \| 'pt' \| 'fr'` | Widget language |
|
|
171
|
+
| `avatarScale` | `number` | Avatar zoom (e.g., `1.2` = 20% bigger) |
|
|
172
|
+
| `showPromptAvatar` | `boolean` | Show mini avatar in prompt bubble |
|
|
173
|
+
| `isHidden` | `boolean` | Hide widget (draft/paused agents) |
|
|
174
|
+
| `cssVariables` | `CSSVariables` | Light mode colors and layout (see below) |
|
|
175
|
+
| `darkCssVariables` | `Partial<CSSVariables>` | Dark mode color overrides |
|
|
176
|
+
| `animations` | `AnimationConfig` | Animation toggles |
|
|
177
|
+
| `effects` | `EffectsConfig` | Visual effect toggles |
|
|
178
|
+
| `avatars` | `EmotionAvatarMap` | Per-emotion avatar URLs |
|
|
179
|
+
| `avatar3dUrl` | `string` | URL to `.vrm`/`.glb` 3D model for voice calls |
|
|
180
|
+
| `bubbleStyles` | `BubbleStyles` | Fine-grained bubble/card styling |
|
|
181
|
+
|
|
182
|
+
### `cssVariables` — Design Tokens (HSL format)
|
|
183
|
+
|
|
184
|
+
All color values use **HSL without the `hsl()` wrapper**, e.g., `"210 100% 50%"`.
|
|
185
|
+
|
|
186
|
+
| Variable | CSS Property | Default (Light) | Description |
|
|
187
|
+
|----------|-------------|-----------------|-------------|
|
|
188
|
+
| `background` | `--background` | `0 0% 100%` | Page/widget background |
|
|
189
|
+
| `foreground` | `--foreground` | `240 10% 3.9%` | Main text color |
|
|
190
|
+
| `card` | `--card` | `0 0% 100%` | Card background |
|
|
191
|
+
| `cardForeground` | `--card-foreground` | `240 10% 3.9%` | Card text |
|
|
192
|
+
| `primary` | `--primary` | `160 84% 39%` | Brand/accent color |
|
|
193
|
+
| `primaryForeground` | `--primary-foreground` | `0 0% 100%` | Text on primary bg |
|
|
194
|
+
| `muted` | `--muted` | `240 4.8% 95.9%` | Muted backgrounds |
|
|
195
|
+
| `mutedForeground` | `--muted-foreground` | `240 3.8% 46.1%` | Muted text |
|
|
196
|
+
| `border` | `--border` | `240 5.9% 90%` | Border color |
|
|
197
|
+
| `destructive` | `--destructive` | `0 84.2% 60.2%` | Error/danger color |
|
|
198
|
+
| `radius` | `--radius` | `0.5rem` | Base border radius |
|
|
199
|
+
|
|
200
|
+
**Layout variables:**
|
|
201
|
+
|
|
202
|
+
| Variable | CSS Property | Default | Description |
|
|
203
|
+
|----------|-------------|---------|-------------|
|
|
204
|
+
| `windowBorderRadius` | `--window-border-radius` | `24px` | Chat window corner radius |
|
|
205
|
+
| `launcherBorderRadius` | `--launcher-border-radius` | `50%` | Launcher button radius |
|
|
206
|
+
| `windowHeight` | `--window-height` | `700px` | Chat window height (desktop) |
|
|
207
|
+
| `windowBottom` | `--window-bottom` | `24px` | Distance from bottom edge |
|
|
208
|
+
|
|
209
|
+
**Spacing variables:**
|
|
210
|
+
|
|
211
|
+
| Variable | CSS Property | Default |
|
|
212
|
+
|----------|-------------|---------|
|
|
213
|
+
| `spacing1` | `--spacing-1` | `0.25rem` (4px) |
|
|
214
|
+
| `spacing2` | `--spacing-2` | `0.5rem` (8px) |
|
|
215
|
+
| `spacing3` | `--spacing-3` | `0.75rem` (12px) |
|
|
216
|
+
| `spacing4` | `--spacing-4` | `1rem` (16px) |
|
|
217
|
+
| `spacing5` | `--spacing-5` | `0.75rem` (12px) |
|
|
218
|
+
| `spacing6` | `--spacing-6` | `1.5rem` (24px) |
|
|
219
|
+
| `spacing7` | `--spacing-7` | `1.75rem` (28px) |
|
|
220
|
+
| `spacing8` | `--spacing-8` | `2rem` (32px) |
|
|
221
|
+
|
|
222
|
+
### `darkCssVariables`
|
|
223
|
+
|
|
224
|
+
Same keys as `cssVariables`. Only override surface colors — `primary` and `primaryForeground` are preserved from the light theme by default:
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
darkCssVariables: {
|
|
228
|
+
background: '220 40% 3%',
|
|
229
|
+
foreground: '210 20% 98%',
|
|
230
|
+
card: '220 40% 5%',
|
|
231
|
+
muted: '220 30% 10%',
|
|
232
|
+
border: '220 30% 12%',
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### `AnimationConfig`
|
|
237
|
+
|
|
238
|
+
| Property | Type | Default | Description |
|
|
239
|
+
|----------|------|---------|-------------|
|
|
240
|
+
| `enabled` | `boolean` | `true` | Master toggle |
|
|
241
|
+
| `messageEntry` | `'slide' \| 'fade' \| 'scale' \| 'spring' \| 'none'` | `'spring'` | Message entry style |
|
|
242
|
+
| `typingIndicator` | `'dots' \| 'wave' \| 'pulse' \| 'none'` | `'dots'` | Typing animation |
|
|
243
|
+
| `buttonEffects` | `boolean` | `true` | Hover/press effects |
|
|
244
|
+
| `smoothScroll` | `boolean` | `true` | Smooth scroll in messages |
|
|
245
|
+
| `launcherPulse` | `boolean` | `true` | Launcher pulse animation |
|
|
246
|
+
| `windowTransitions` | `boolean` | `true` | Window open/close animation |
|
|
247
|
+
|
|
248
|
+
### `EffectsConfig`
|
|
249
|
+
|
|
250
|
+
| Property | Type | Default | Description |
|
|
251
|
+
|----------|------|---------|-------------|
|
|
252
|
+
| `glassmorphism` | `boolean` | `true` | Blur effect on headers |
|
|
253
|
+
| `gradients` | `boolean` | `true` | Gradient backgrounds |
|
|
254
|
+
| `softShadows` | `boolean` | `true` | Soft shadow effects |
|
|
255
|
+
| `glowEffects` | `boolean` | `true` | Hover/focus glow |
|
|
256
|
+
| `shimmerLoading` | `boolean` | `true` | Shimmer loading skeleton |
|
|
257
|
+
| `hoverLift` | `boolean` | `true` | Card hover lift effect |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Dark Mode
|
|
262
|
+
|
|
263
|
+
The widget auto-detects dark mode via:
|
|
264
|
+
1. `data-theme="dark"` attribute on `<html>`
|
|
265
|
+
2. `prefers-color-scheme: dark` media query
|
|
266
|
+
|
|
267
|
+
When dark mode is active, colors are applied in this priority:
|
|
268
|
+
1. **User-provided `darkCssVariables`** (highest priority)
|
|
269
|
+
2. **Server-sent `darkCssVariables`** (from agent config)
|
|
270
|
+
3. **Built-in dark defaults** (fallback)
|
|
271
|
+
|
|
272
|
+
`primary` and `primaryForeground` are **never overridden** by dark defaults — they always come from your brand configuration.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Events
|
|
277
|
+
|
|
278
|
+
Listen to widget lifecycle events via `onEvent`:
|
|
279
|
+
|
|
280
|
+
| Event Name | Data | Description |
|
|
281
|
+
|-----------|------|-------------|
|
|
282
|
+
| `backend_config` | `config` | Agent config received from server |
|
|
283
|
+
| `history_loaded` | `{ messages }` | Chat history loaded |
|
|
284
|
+
| `message_sent` | `{ id }` | Message delivered successfully |
|
|
285
|
+
| `message_failed` | `{ id, payload }` | Message delivery failed |
|
|
286
|
+
| `queued_message` | `{ id, payload }` | Message queued (offline) |
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Development
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
npm run dev # Start dev server
|
|
294
|
+
npm run build # Production build (ES + UMD + types)
|
|
295
|
+
npm run test:run # Run all tests
|
|
296
|
+
npm run lint # ESLint
|
|
297
|
+
npm run typecheck # TypeScript check
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
MIT
|