@headwai/chat-bubble 2.0.6 → 2.0.8

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.dev.md CHANGED
@@ -1,17 +1,8 @@
1
- # Chat Bubble Svelte
1
+ # Headwai Chat Bubble
2
2
 
3
3
  The chat bubble is based on a Svelte integration for the [deep-chat](https://www.npmjs.com/package/deep-chat) component, providing an easy-to-use AI chat interface for your web applications.
4
4
 
5
- ## Features
6
-
7
- - 🚀 Easy integration
8
- - 🔧 Configurable via environment variables
9
- - 💬 Support for various AI providers (LocalChat, OpenAI and more)
10
- - 📱 Responsive design
11
- - 🎨 Customizable UI components
12
- - 🔄 Real-time messaging with WebSocket support
13
-
14
- ## Installation
5
+ ## Development
15
6
 
16
7
  ### Prerequisites
17
8
 
@@ -43,171 +34,34 @@ cp .env.example .env
43
34
  npm run dev
44
35
  ```
45
36
 
46
- ## Configuration
47
-
48
- The deep-chat component can be configured using environment variables. Create a `.env` file in your project root with the following variables:
49
-
50
- ### Required Environment Variables
51
-
52
- ```env
53
- # API Configuration
54
- VITE_CHAT_BUBBLE_API_URL=https://your-api-endpoint.com/api/chat/completions
55
- VITE_CHAT_BUBBLE_API_KEY=your-api-key-here
56
- VITE_CHAT_BUBBLE_MODEL_ID=gpt-3.5-turbo
57
-
58
- # Connection Type (websocket, openAI, etc.)
59
- VITE_CHAT_BUBBLE_CONNECTION_TYPE=websocket
60
- ```
61
-
62
- ### Optional Environment Variables
63
-
64
- ```env
65
- # Additional Headers
66
- VITE_CHAT_BUBBLE_CONTENT_TYPE=application/json
67
-
68
- # Request Configuration
69
- VITE_CHAT_BUBBLE_MAX_MESSAGES=0
70
-
71
- # UI Configuration
72
- VITE_CHAT_BUBBLE_PLACEHOLDER_TEXT=Welcome to the chat!
73
- VITE_CHAT_BUBBLE_DEMO_MODE=false
74
- VITE_CHAT_BUBBLE_FAVICON_PATH=/icons/favicon.svg
75
- ```
76
-
77
- ## Usage
78
-
79
- ### Basic Integration
80
-
81
- To integrate the deep-chat component into your Svelte application:
82
-
83
- 1. **Install the package** (if using as a standalone package):
37
+ 6. Open embedded Headwai Chat Bubble in Browser
84
38
  ```bash
85
- npm install deep-chat
86
- ```
87
-
88
- 2. **Import and use in your Svelte component**:
89
-
90
- ```svelte
91
- <script>
92
- import { DeepChat } from "deep-chat";
93
-
94
- // Configuration using environment variables
95
- const connect = {
96
- type: import.meta.env.VITE_CHAT_BUBBLE_CONNECTION_TYPE || "websocket",
97
- url: import.meta.env.VITE_CHAT_BUBBLE_API_URL,
98
- headers: {
99
- Authorization: `Bearer ${import.meta.env.VITE_CHAT_BUBBLE_API_KEY}`,
100
- "Content-Type": import.meta.env.VITE_CHAT_BUBBLE_CONTENT_TYPE || "application/json"
101
- },
102
- additionalBodyProps: {
103
- model: import.meta.env.VITE_CHAT_BUBBLE_MODEL_ID
104
- }
105
- };
106
-
107
- const requestBodyLimits = {
108
- maxMessages: parseInt(import.meta.env.VITE_CHAT_BUBBLE_MAX_MESSAGES) || 0
109
- };
110
-
111
- const textInputConfig = {
112
- placeholder: {
113
- text: import.meta.env.VITE_CHAT_BUBBLE_PLACEHOLDER_TEXT || "Type your message..."
114
- }
115
- };
116
-
117
- // Message transformation for OpenAI compatibility
118
- const requestInterceptor = (details) => {
119
- if (details.body && details.body.messages) {
120
- details.body.messages = details.body.messages.map(message => ({
121
- role: message.role === "ai" ? "assistant" : message.role,
122
- content: message.text || message.content
123
- }));
124
- }
125
- return details;
126
- };
127
-
128
- const responseInterceptor = (response) => {
129
- if (response.choices && response.choices[0] && response.choices[0].message) {
130
- const message = response.choices[0].message;
131
- return {
132
- text: message.content,
133
- role: message.role === "assistant" ? "ai" : message.role
134
- };
135
- }
136
-
137
- if (response.text || response.html || response.files) {
138
- return response;
139
- }
140
-
141
- if (typeof response === 'string') {
142
- return { text: response };
143
- }
144
-
145
- return response;
146
- };
147
- </script>
148
-
149
- <deep-chat
150
- demo={import.meta.env.VITE_CHAT_BUBBLE_DEMO_MODE === 'true'}
151
- textInput={textInputConfig}
152
- connect={connect}
153
- requestBodyLimits={requestBodyLimits}
154
- requestInterceptor={requestInterceptor}
155
- responseInterceptor={responseInterceptor}
156
- />
39
+ http://localhost:5174/
157
40
  ```
158
41
 
159
- ### Including Chat Bubble in Customer Websites
160
-
161
- #### Customizing Message Colors
42
+ 7. Alternatively, build and test deployed veersion:
43
+ [Build and Deploy](#build-and-deploy) and open `./test-widget.html` in a browser.
162
44
 
163
- You can customize the background colors and text colors of user and AI messages, as well as the assistant icon color, in several ways:
45
+ ## Configuration
164
46
 
165
- **Via environment variables (.env file):**
166
- ```env
167
- # Message styling
168
- VITE_CHAT_BUBBLE_USER_MESSAGE_BG_COLOR=#007bff
169
- VITE_CHAT_BUBBLE_AI_MESSAGE_BG_COLOR=#f1f3f4
170
- VITE_CHAT_BUBBLE_USER_MESSAGE_TEXT_COLOR=#ffffff
171
- VITE_CHAT_BUBBLE_AI_MESSAGE_TEXT_COLOR=#000000
47
+ The Headwai Chat Bubble can be configured using environment variables or by changing the attributes of the instance.
172
48
 
173
- # Assistant icon styling (creates a gradient automatically)
174
- VITE_CHAT_BUBBLE_FAVICON_BG_COLOR=#667eea
175
- ```
49
+ ### Environment Variables
50
+ Create a `.env` by copying `.env.example` file in your project root with the following variables:
176
51
 
177
- **Via runtime configuration (Script Embed - Option 2):**
52
+ ### Window Object Configuration
178
53
  ```html
179
- <script>
180
- window.DEEP_CHAT_CONFIG = {
181
- apiUrl: 'https://customer-api.com/chat',
182
- apiKey: 'customer-api-key',
183
- userMessageBackgroundColor: '#4a90e2', // Blue background for user messages
184
- aiMessageBackgroundColor: '#e8f5e8', // Light green background for AI messages
185
- userMessageTextColor: '#ffffff', // White text for user messages
186
- aiMessageTextColor: '#2d5016', // Dark green text for AI messages
187
- faviconBackgroundColor: '#28a745' // Green icon (gradient auto-generated)
188
- };
189
- </script>
190
- ```
191
-
192
- **Via props (NPM Package - Option 3):**
193
- ```svelte
194
- <script>
195
- import { ChatBubble } from '@headwai/chat-bubble';
196
- </script>
197
-
198
- <ChatBubble
199
- apiUrl="https://api.example.com/chat"
200
- apiKey="your-api-key"
201
- userMessageBackgroundColor="#ff6b6b" <!-- Red background for user messages -->
202
- aiMessageBackgroundColor="#4ecdc4" <!-- Teal background for AI messages -->
203
- userMessageTextColor="#ffffff" <!-- White text for user messages -->
204
- aiMessageTextColor="#2c3e50" <!-- Dark blue text for AI messages -->
205
- faviconBackgroundColor="#e74c3c" <!-- Red icon (gradient auto-generated) -->
206
- {/* ...other props */}
207
- />
54
+ <script>
55
+ // Runtime configuration override
56
+ window.HEADWAI_CHAT_BUBBLE_CONFIG = {
57
+ apiUrl: 'https://customer-api.com/chat',
58
+ apiKey: 'customer-api-key',
59
+ modelId: 'gpt-4'
60
+ };
61
+ </script>
208
62
  ```
209
63
 
210
- **Via data attributes (Multiple chat bubbles):**
64
+ ### Via data attributes (Multiple chat bubbles):**
211
65
  ```html
212
66
  <div data-chat-bubble
213
67
  data-chat-bubble-api-url="https://api1.com/chat"
@@ -219,22 +73,16 @@ VITE_CHAT_BUBBLE_FAVICON_BG_COLOR=#667eea
219
73
  data-chat-bubble-favicon-background-color="#ff6f00"></div>
220
74
  ```
221
75
 
222
- **Color Suggestions for Assistant Icon:**
223
- - **Corporate Blue:** `#0066cc` (creates blue gradient)
224
- - **Success Green:** `#28a745` (creates green gradient)
225
- - **Warning Orange:** `#fd7e14` (creates orange gradient)
226
- - **Danger Red:** `#dc3545` (creates red gradient)
227
- - **Purple:** `#6f42c1` (creates purple gradient)
228
- - **Teal:** `#20c997` (creates teal gradient)
76
+ ## Including Chat Bubble in Customer Websites
229
77
 
230
- The component automatically creates a beautiful linear gradient by making the second color 20% darker than your chosen base color.
78
+ For simple integration instructions, see [README.md](README.md) which provides a streamlined guide for customers.
231
79
 
232
- #### Option 1: Build and Deploy (Complete Application)
80
+ ## Build and Deploy
233
81
 
234
- This option bundles everything into a ready-to-use application including all interceptors and logic.
82
+ This project builds a standalone widget that can be integrated into any website.
235
83
 
236
84
  **What gets bundled:**
237
- - ✅ Request/Response interceptors (OpenAI compatibility)
85
+ - ✅ All logic and request/response interceptors
238
86
  - ✅ Environment variable configuration
239
87
  - ✅ All chat functionality
240
88
  - ✅ UI components and styling
@@ -246,229 +94,26 @@ This option bundles everything into a ready-to-use application including all int
246
94
  VITE_CHAT_BUBBLE_API_URL=https://api.customer-domain.com/chat
247
95
  VITE_CHAT_BUBBLE_API_KEY=prod-api-key
248
96
  VITE_CHAT_BUBBLE_MODEL_ID=gpt-4
249
- VITE_CHAT_BUBBLE_CONNECTION_TYPE=websocket
250
- VITE_CHAT_BUBBLE_DEMO_MODE=false
251
- ```
252
-
253
- 2. **Build the widget**:
254
- ```bash
255
- npm run build:widget
256
- ```
257
-
258
- 3. **Deploy the `dist-widget` folder** to your web server or CDN.
259
-
260
- **Result:** Customers get a complete chat application - no additional coding required!
261
-
262
- #### Option 2: Embed Chat Bubble as Script (Plug-and-Play)
263
-
264
- After building the widget, you can include the chat component in any website as a complete widget.
265
-
266
- **Build steps:**
267
- 1. **Build the widget**:
268
- ```bash
269
- npm run build:widget
270
- ```
271
-
272
- 2. **Publish to NPM** (for jsDelivr access):
273
- ```bash
274
- npm publish
275
- ```
276
-
277
- **Customer integration:**
278
- ```html
279
- <!DOCTYPE html>
280
- <html>
281
- <head>
282
- <title>Customer Website</title>
283
- <!-- Configure via global variables -->
284
- <script>
285
- // Runtime configuration override
286
- window.DEEP_CHAT_CONFIG = {
287
- apiUrl: 'https://customer-api.com/chat',
288
- apiKey: 'customer-api-key',
289
- modelId: 'gpt-4',
290
- connectionType: 'websocket'
291
- };
292
- </script>
293
- </head>
294
- <body>
295
- <!-- Your existing content -->
296
-
297
- <!-- Chat Bubble Integration - Auto-initializes! -->
298
- <div id="chat-bubble-container"></div>
299
-
300
- <!-- Include from jsDelivr CDN -->
301
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist-widget/chat-bubble.css">
302
- <script src="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist-widget/chat-bubble.js"></script>
303
- </body>
304
- </html>
305
- ```
306
-
307
- **Alternative: Multiple chat bubbles with data attributes:**
308
- ```html
309
- <!-- Chat bubble with specific configuration -->
310
- <div data-chat-bubble
311
- data-chat-bubble-api-url="https://api1.com/chat"
312
- data-chat-bubble-api-key="key1"></div>
313
-
314
- <!-- Another chat bubble with different config -->
315
- <div data-chat-bubble
316
- data-chat-bubble-api-url="https://api2.com/chat"
317
- data-chat-bubble-api-key="key2"></div>
318
-
319
- <script src="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist-widget/chat-bubble.js"></script>
320
- ```
321
-
322
- **What customers get:**
323
- - ✅ Complete chat interface
324
- - ✅ All interceptors included
325
- - ✅ OpenAI API compatibility built-in
326
- - ✅ Just needs API configuration
327
- - ✅ Auto-initialization on page load
328
-
329
- #### Option 3: NPM Package Integration (Developer Integration)
330
-
331
- For developers who need full control and customization.
332
-
333
- **Build and publish steps:**
334
- 1. **Build the library**:
335
- ```bash
336
- npm run build:lib
337
- ```
338
-
339
- 2. **Publish to NPM**:
340
- ```bash
341
- npm publish
342
- ```
343
-
344
- **Customer installation:**
345
- ```bash
346
- # Install in customer's project
347
- npm install @headwai/chat-bubble
348
- ```
349
-
350
- **For Svelte projects:**
351
- ```svelte
352
- <!-- Customer's Svelte component -->
353
- <script>
354
- import { ChatBubble } from '@headwai/chat-bubble';
355
-
356
- // Customers MUST implement these interceptors themselves
357
- const requestInterceptor = (details) => {
358
- if (details.body && details.body.messages) {
359
- details.body.messages = details.body.messages.map(message => ({
360
- role: message.role === "ai" ? "assistant" : message.role,
361
- content: message.text || message.content
362
- }));
363
- }
364
- return details;
365
- };
366
-
367
- const responseInterceptor = (response) => {
368
- if (response.choices && response.choices[0] && response.choices[0].message) {
369
- const message = response.choices[0].message;
370
- return {
371
- text: message.content,
372
- role: message.role === "assistant" ? "ai" : message.role
373
- };
374
- }
375
- return response;
376
- };
377
-
378
- const connect = {
379
- type: "websocket",
380
- url: process.env.API_URL,
381
- headers: {
382
- Authorization: `Bearer ${process.env.API_KEY}`,
383
- "Content-Type": "application/json"
384
- },
385
- additionalBodyProps: {
386
- model: process.env.MODEL_NAME
387
- }
388
- };
389
- </script>
390
-
391
- <ChatBubble
392
- connect={connect}
393
- requestInterceptor={requestInterceptor}
394
- responseInterceptor={responseInterceptor}
395
- />
396
97
  ```
397
98
 
398
- **For vanilla JavaScript projects:**
399
- ```html
400
- <script type="module">
401
- import { createChatBubble } from 'https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist/index.js';
402
-
403
- // Initialize manually with custom configuration
404
- const chatBubble = createChatBubble(
405
- document.getElementById('chat-container'),
406
- {
407
- apiUrl: 'https://api.example.com/chat',
408
- apiKey: 'your-api-key',
409
- // ... other props
410
- }
411
- );
412
- </script>
413
- ```
414
-
415
- **What customers need to implement:**
416
- - ❌ Request/Response interceptors (manual setup required)
417
- - ❌ Environment variable handling
418
- - ❌ API configuration logic
419
- - ✅ Deep chat component only
420
-
421
- ## Deployment Options Comparison
422
-
423
- | Feature | Built App (Option 1) | Script Embed (Option 2) | NPM Package (Option 3) |
424
- |---------|----------------------|--------------------------|-------------------------|
425
- | **Build Command** | `npm run build:widget` | `npm run build:widget` + publish | `npm run build:lib` + publish |
426
- | **Interceptors Included** | ✅ Yes, automatically | ✅ Yes, automatically | ❌ No, manual setup required |
427
- | **Environment Variables** | ✅ Built-in support | ✅ Runtime configuration | ❌ Customer implements |
428
- | **OpenAI Compatibility** | ✅ Ready to use | ✅ Ready to use | ❌ Customer implements |
429
- | **Setup Complexity** | 🟢 Minimal (just config) | � Minimal (script tag) | �🟡 Moderate (coding required) |
430
- | **Customization** | 🟡 Limited to env vars | � Limited to config object | �🟢 Full control |
431
- | **File Size** | 🟡 Larger (complete app) | � Larger (complete app) | �🟢 Smaller (just component) |
432
- | **Use Case** | Self-hosted deployment | CDN/jsDelivr embedding | Developers, custom integration |
433
- | **Auto-initialization** | ✅ Yes | ✅ Yes | ❌ Manual setup |
434
-
435
- ### Recommended Approach
436
-
437
- **For most customers:** Use **Option 2** (Script Embed via jsDelivr)
438
- - ✅ No coding required
439
- - ✅ All interceptors included
440
- - ✅ Easy CDN access via jsDelivr
441
- - ✅ Just configure via JavaScript object
442
- - ✅ Ready-to-deploy solution
443
- - ✅ Auto-initialization
444
-
445
- **For self-hosted deployments:** Use **Option 1** (Built Application)
446
- - ✅ Complete control over hosting
447
- - ✅ No external CDN dependencies
448
- - ✅ All interceptors included
449
- - ✅ Environment variable configuration
450
-
451
- **For developers who need customization:** Use **Option 3** (NPM Package)
452
- - ✅ Full control over interceptors
453
- - ✅ Custom API integrations
454
- - ✅ Smaller bundle size
455
- - ❌ More setup required
99
+ 2. **Bump package version**
100
+ Bump up the `version` in `package.json`
456
101
 
457
102
  ## Publishing to NPM and jsDelivr Access
458
103
 
459
104
  ### Publishing Steps
460
105
 
461
- 1. **Build both library and widget**:
106
+ 3. **Build widget**:
462
107
  ```bash
463
108
  npm run build
464
109
  ```
465
110
 
466
- 2. **Login to NPM** (if not already logged in):
111
+ 4. **Login to NPM** (if not already logged in):
467
112
  ```bash
468
113
  npm login
469
114
  ```
470
115
 
471
- 3. **Publish the package**:
116
+ 5. **Publish the package**:
472
117
  ```bash
473
118
  npm publish
474
119
  ```
@@ -477,7 +122,7 @@ npm publish
477
122
 
478
123
  Once published to NPM, your package is automatically available on jsDelivr:
479
124
 
480
- **For Widget/Script Embed (Options 1 & 2):**
125
+ **For Widget/Script Embed:**
481
126
  ```html
482
127
  <!-- Latest version -->
483
128
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist-widget/chat-bubble.css">
@@ -488,51 +133,6 @@ Once published to NPM, your package is automatically available on jsDelivr:
488
133
  <script src="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@1.0.0/dist-widget/chat-bubble.js"></script>
489
134
  ```
490
135
 
491
- **For Library/Module Import (Option 3):**
492
- ```html
493
- <!-- ES Module -->
494
- <script type="module">
495
- import { ChatBubble, createChatBubble } from 'https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist/index.js';
496
- </script>
497
-
498
- <!-- UMD (Universal Module Definition) -->
499
- <script src="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist/index.umd.js"></script>
500
- ```
501
-
502
- ### File Structure After Build
503
-
504
- ```
505
- dist/ # NPM package (Option 3)
506
- ├── index.js # ES module
507
- ├── index.umd.js # UMD module
508
- └── style.css # Component styles
509
-
510
- dist-widget/ # Standalone widget (Options 1 & 2)
511
- ├── widget.html # Demo page
512
- ├── chat-bubble.js # Complete widget with auto-init
513
- ├── chat-bubble.css # Widget styles
514
- └── assets/ # Additional assets
515
- ```
516
-
517
- ## Environment Variables Reference
518
-
519
- | Variable | Description | Default | Required |
520
- |----------|-------------|---------|----------|
521
- | `VITE_CHAT_BUBBLE_API_URL` | The API endpoint URL | - | ✅ |
522
- | `VITE_CHAT_BUBBLE_API_KEY` | API authentication key | - | ✅ |
523
- | `VITE_CHAT_BUBBLE_MODEL_ID` | AI model name to use | `gpt-3.5-turbo` | ✅ |
524
- | `VITE_CHAT_BUBBLE_CONNECTION_TYPE` | Connection type (websocket, openAI, etc.) | `websocket` | ✅ |
525
- | `VITE_CHAT_BUBBLE_CONTENT_TYPE` | HTTP Content-Type header | `application/json` | ❌ |
526
- | `VITE_CHAT_BUBBLE_MAX_MESSAGES` | Maximum messages in conversation history | `0` (unlimited) | ❌ |
527
- | `VITE_CHAT_BUBBLE_PLACEHOLDER_TEXT` | Chat input placeholder text | `Type your message...` | ❌ |
528
- | `VITE_CHAT_BUBBLE_DEMO_MODE` | Enable demo mode | `false` | ❌ |
529
- | `VITE_CHAT_BUBBLE_FAVICON_PATH` | Path to favicon/icon for chat toggle button | `/icons/favicon.svg` | ❌ |
530
- | `VITE_CHAT_BUBBLE_USER_MESSAGE_BG_COLOR` | Background color for user messages | `#007bff` | ❌ |
531
- | `VITE_CHAT_BUBBLE_AI_MESSAGE_BG_COLOR` | Background color for AI messages | `#f1f3f4` | ❌ |
532
- | `VITE_CHAT_BUBBLE_USER_MESSAGE_TEXT_COLOR` | Text color for user messages | `#000000` | ❌ |
533
- | `VITE_CHAT_BUBBLE_AI_MESSAGE_TEXT_COLOR` | Text color for AI messages | `#000000` | ❌ |
534
- | `VITE_CHAT_BUBBLE_FAVICON_BG_COLOR` | Base color for assistant icon gradient | `#667eea` | ❌ |
535
-
536
136
  ## API Compatibility
537
137
 
538
138
  This component is designed to work with OpenAI-compatible APIs. The request and response interceptors handle the message format transformation between deep-chat and OpenAI formats.
@@ -550,51 +150,23 @@ This component is designed to work with OpenAI-compatible APIs. The request and
550
150
  ### Scripts
551
151
 
552
152
  - `npm run dev` - Start development server
553
- - `npm run build` - Build both library and widget for production
554
- - `npm run build:lib` - Build NPM package (Option 3)
555
- - `npm run build:widget` - Build standalone widget (Options 1 & 2)
556
- - `npm run build:app` - Build demo application
153
+ - `npm run build` - Build widget for production
154
+ - `npm run build:widget` - Build standalone widget
557
155
  - `npm run preview` - Preview production build
558
156
 
559
- ### Project Structure
560
-
561
- ```
562
- chat-bubble/
563
- ├── src/
564
- │ ├── App.svelte # Main chat component
565
- │ ├── main.js # Development entry point
566
- │ ├── lib.js # NPM package entry point
567
- │ └── widget.js # Widget/standalone entry point
568
- ├── dist/ # NPM package build output
569
- ├── dist-widget/ # Widget build output
570
- ├── package.json # Dependencies and scripts
571
- ├── vite.config.js # Default Vite configuration
572
- ├── vite.lib.config.js # Library build configuration
573
- ├── vite.widget.config.js # Widget build configuration
574
- ├── vite.app.config.js # App build configuration
575
- ├── svelte.config.js # Svelte configuration
576
- ├── index.html # Development HTML
577
- ├── widget.html # Widget HTML template
578
- └── README.md # This file
579
- ```
580
-
581
157
  ## Troubleshooting
582
158
 
583
159
  ### Common Issues
584
160
 
585
- 1. **CORS Errors**: Ensure your API endpoint allows requests from your domain
586
- 2. **Authentication Failures**: Verify your API key is correct and has proper permissions
587
- 3. **WebSocket Connection Issues**: Check if your API supports WebSocket connections
588
- 4. **Environment Variables Not Loading**: Ensure variables are prefixed with `VITE_CHAT_BUBBLE_`
589
-
590
- ### Debug Mode
591
-
592
- Enable debug mode by setting:
593
- ```env
594
- VITE_CHAT_BUBBLE_DEMO_MODE=true
595
- ```
596
-
597
- This will enable demo features that can help test the component without a real API connection.
161
+ **CORS Errors**: Ensure your API endpoint allows requests from your domain
162
+ **Authentication Failures**: Verify your API key is correct and has proper permissions
163
+ **Environment Variables Not Loading**: Ensure variables are prefixed with `VITE_CHAT_BUBBLE_`
164
+ **CDN Version Delays**: Sometimes the `@latest` tag on jsDelivr CDN takes time to propagate to all edge servers and may not deliver the newest version immediately. If you need the latest features or fixes, specify the exact version number instead of using `@latest`:
165
+ ```html
166
+ <!-- Instead of @latest -->
167
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@1.2.3/dist-widget/chat-bubble.css">
168
+ <script src="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@1.2.3/dist-widget/chat-bubble.js"></script>
169
+ ```
598
170
 
599
171
  ## Support
600
172
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ Add the Headwai Chat Bubble to the respective .html file.
21
21
  <!-- Configure via global variables -->
22
22
  <script>
23
23
  // Runtime configuration override
24
- window.DEEP_CHAT_CONFIG = {
24
+ window.HEADWAI_CHAT_BUBBLE_CONFIG = {
25
25
  apiUrl: 'https://company.localchat.at', // required
26
26
  apiKey: 'customer-support-user-api-key', // required
27
27
  modelId: 'customer-support-model-id', // required
@@ -53,8 +53,6 @@ Add the Headwai Chat Bubble to the respective .html file.
53
53
  Set the configuration of the Headwai Chat Bubble in the `<script>` tag of the `<head>`.
54
54
  Get the desired version of the JavaScript and CSS in your `<body>`.
55
55
 
56
-
57
-
58
56
  ```html
59
57
  <!-- Latest version -->
60
58
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@latest/dist-widget/chat-bubble.css">
@@ -240,6 +238,13 @@ When using data attributes for multiple chat bubbles, convert camelCase property
240
238
 
241
239
  ### Common Issues
242
240
 
243
- 1. **CORS Errors**: Ensure your API endpoint allows requests from your domain
244
- 2. **Authentication Failures**: Verify your API key is correct and has proper permissions
241
+ **CORS Errors**: Ensure your API endpoint allows requests from your domain
242
+ **Authentication Failures**: Verify your API key is correct and has proper permissions
243
+ **CDN Version Delays**: Sometimes the `@latest` tag on jsDelivr CDN takes time to propagate to all edge servers and may not deliver the newest version immediately. If you need the latest features or fixes, specify the exact version number instead of using `@latest`:
244
+ ```html
245
+ <!-- Instead of @latest -->
246
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@1.2.3/dist-widget/chat-bubble.css">
247
+ <script src="https://cdn.jsdelivr.net/npm/@headwai/chat-bubble@1.2.3/dist-widget/chat-bubble.js"></script>
248
+ ```
249
+
245
250
 
@@ -1 +1 @@
1
- main.svelte-bjand4.svelte-bjand4{font-family:sans-serif;position:relative;height:100vh;width:100vw}.ai-assistant-icon.svelte-bjand4.svelte-bjand4{position:fixed;bottom:20px;right:20px;width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 20px #00000026;transition:all .3s ease;z-index:1000}.ai-assistant-icon.svelte-bjand4.svelte-bjand4:hover{transform:scale(1.1);box-shadow:0 6px 25px #0003}.ai-assistant-icon.svelte-bjand4.svelte-bjand4:active{transform:scale(.95)}.ai-assistant-icon.svelte-bjand4 img.svelte-bjand4{width:36px;height:36px;object-fit:contain}.chat-container.svelte-bjand4.svelte-bjand4{position:fixed;bottom:20px;right:20px;width:400px;height:600px;border-radius:12px;box-shadow:0 8px 32px #00000026;overflow:hidden;z-index:999;background:#fff;animation:svelte-bjand4-slideIn .3s ease-out}.chat-container.svelte-bjand4 deep-chat{width:100%!important;height:100%!important;position:relative!important;display:block!important;top:0!important;left:0!important;box-sizing:border-box!important}.chat-container.svelte-bjand4 deep-chat>*{width:100%!important;height:100%!important;box-sizing:border-box!important}@keyframes svelte-bjand4-slideIn{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){.chat-container.svelte-bjand4.svelte-bjand4{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;border-radius:0}.ai-assistant-icon.svelte-bjand4.svelte-bjand4{bottom:30px;right:30px}}
1
+ html,body{margin:0;padding:0;overflow:hidden;width:100%;height:100%}main.svelte-mbs169.svelte-mbs169{font-family:sans-serif;position:fixed;top:0;left:0;right:0;bottom:0;margin:0;padding:0;overflow:hidden}.ai-assistant-icon.svelte-mbs169.svelte-mbs169{position:fixed;bottom:20px;right:20px;width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 20px #00000026;transition:all .3s ease;z-index:1000}.ai-assistant-icon.svelte-mbs169.svelte-mbs169:hover{transform:scale(1.1);box-shadow:0 6px 25px #0003}.ai-assistant-icon.svelte-mbs169.svelte-mbs169:active{transform:scale(.95)}.ai-assistant-icon.svelte-mbs169 img.svelte-mbs169{width:36px;height:36px;object-fit:contain}.chat-container.svelte-mbs169.svelte-mbs169{position:fixed;bottom:20px;right:20px;width:400px;height:600px;border-radius:12px;box-shadow:0 8px 32px #00000026;overflow:hidden;z-index:999;background:#fff;animation:svelte-mbs169-slideIn .3s ease-out}.chat-container.svelte-mbs169 deep-chat{width:100%!important;height:100%!important;position:relative!important;display:block!important;top:0!important;left:0!important;box-sizing:border-box!important}.chat-container.svelte-mbs169 deep-chat>*{width:100%!important;height:100%!important;box-sizing:border-box!important}@keyframes svelte-mbs169-slideIn{0%{opacity:0;transform:translateY(20px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){.chat-container.svelte-mbs169.svelte-mbs169{position:fixed;top:0;left:0;right:0;bottom:0;width:100vw;height:100vh;border-radius:0}.ai-assistant-icon.svelte-mbs169.svelte-mbs169{bottom:30px;right:30px}}