@schmitech/chatbot-widget 0.4.1 → 0.4.2
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 +50 -11
- package/package.json +1 -1
- package/dist/chatbot-widget.bundle.js +0 -765
- package/dist/chatbot-widget.css +0 -1
- package/dist/chatbot-widget.es.js +0 -24339
- package/dist/chatbot-widget.umd.js +0 -755
package/README.md
CHANGED
|
@@ -40,14 +40,17 @@ Add this code to your website:
|
|
|
40
40
|
},
|
|
41
41
|
suggestedQuestions: [
|
|
42
42
|
{
|
|
43
|
-
text: "How can you help me?",
|
|
44
|
-
query: "What can you do?"
|
|
43
|
+
text: "How can you help me?", // Display text (truncated based on maxSuggestedQuestionLength)
|
|
44
|
+
query: "What can you do?" // Query sent to API (truncated based on maxSuggestedQuestionQueryLength)
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
|
-
text: "Contact support",
|
|
48
|
-
query: "How do I contact support?"
|
|
47
|
+
text: "Contact support", // Display text
|
|
48
|
+
query: "How do I contact support?" // Query sent to API
|
|
49
49
|
}
|
|
50
50
|
],
|
|
51
|
+
// Optional: Customize length limits for suggested questions
|
|
52
|
+
maxSuggestedQuestionLength: 60, // Display length limit (default: 50)
|
|
53
|
+
maxSuggestedQuestionQueryLength: 300, // Query length limit (default: 200)
|
|
51
54
|
theme: {
|
|
52
55
|
primary: '#4f46e5',
|
|
53
56
|
secondary: '#7c3aed',
|
|
@@ -66,10 +69,8 @@ Add this code to your website:
|
|
|
66
69
|
userText: '#ffffff'
|
|
67
70
|
},
|
|
68
71
|
suggestedQuestions: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
text: '#4338ca'
|
|
72
|
-
},
|
|
72
|
+
text: '#4338ca'
|
|
73
|
+
},
|
|
73
74
|
chatButton: {
|
|
74
75
|
background: '#ffffff',
|
|
75
76
|
hoverBackground: '#f8fafc'
|
|
@@ -99,7 +100,9 @@ Add this code to your website:
|
|
|
99
100
|
| `containerSelector` | string | CSS selector for custom container (defaults to bottom-right corner) |
|
|
100
101
|
| `header` | object | Widget header configuration |
|
|
101
102
|
| `welcome` | object | Welcome message configuration |
|
|
102
|
-
| `suggestedQuestions` | array | Array of suggested question buttons |
|
|
103
|
+
| `suggestedQuestions` | array | Array of suggested question buttons (max 50 chars per question, max 200 chars per query) |
|
|
104
|
+
| `maxSuggestedQuestionLength` | number | Maximum display length for suggested question text (default: 50) |
|
|
105
|
+
| `maxSuggestedQuestionQueryLength` | number | Maximum length for suggested question queries sent to API (default: 200) |
|
|
103
106
|
| `theme` | object | Theme customization options |
|
|
104
107
|
| `icon` | string | Widget icon type |
|
|
105
108
|
|
|
@@ -198,6 +201,40 @@ The demo includes several professional themes:
|
|
|
198
201
|
- **Lavender** - Elegant purple theme
|
|
199
202
|
- **Monochrome** - Sophisticated grayscale
|
|
200
203
|
|
|
204
|
+
## Suggested Questions Length Configuration
|
|
205
|
+
|
|
206
|
+
The widget provides flexible length controls for suggested questions:
|
|
207
|
+
|
|
208
|
+
### Display Length (`maxSuggestedQuestionLength`)
|
|
209
|
+
- Controls how much text is shown on the suggestion buttons
|
|
210
|
+
- Default: 50 characters
|
|
211
|
+
- Text longer than this limit will be truncated with "..."
|
|
212
|
+
- Example: "This is a very long question that will be truncated..."
|
|
213
|
+
|
|
214
|
+
### Query Length (`maxSuggestedQuestionQueryLength`)
|
|
215
|
+
- Controls the maximum length of the actual query sent to your API
|
|
216
|
+
- Default: 200 characters
|
|
217
|
+
- Queries longer than this limit will be truncated (no ellipsis)
|
|
218
|
+
- Helps prevent overly long API requests
|
|
219
|
+
|
|
220
|
+
### Usage Example
|
|
221
|
+
|
|
222
|
+
```javascript
|
|
223
|
+
window.initChatbotWidget({
|
|
224
|
+
apiUrl: 'https://your-api-url.com',
|
|
225
|
+
apiKey: 'your-api-key',
|
|
226
|
+
sessionId: 'your-session-id',
|
|
227
|
+
suggestedQuestions: [
|
|
228
|
+
{
|
|
229
|
+
text: "Tell me about your company's history and founding story", // 52 chars - will be truncated if maxSuggestedQuestionLength < 52
|
|
230
|
+
query: "I'd like to learn about your company's history, founding story, key milestones, and how you've grown over the years" // 127 chars - will be truncated if maxSuggestedQuestionQueryLength < 127
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
maxSuggestedQuestionLength: 40, // Button shows: "Tell me about your company's histor..."
|
|
234
|
+
maxSuggestedQuestionQueryLength: 100 // API receives: "I'd like to learn about your company's history, founding story, key milestones, and how you'"
|
|
235
|
+
});
|
|
236
|
+
```
|
|
237
|
+
|
|
201
238
|
## Available Icons
|
|
202
239
|
|
|
203
240
|
Choose from these built-in icons:
|
|
@@ -223,10 +260,12 @@ Choose from these built-in icons:
|
|
|
223
260
|
},
|
|
224
261
|
suggestedQuestions: [ // Array of suggested questions
|
|
225
262
|
{
|
|
226
|
-
text: string; // Button text
|
|
227
|
-
query: string; // Question to send when clicked
|
|
263
|
+
text: string; // Button text (truncated based on maxSuggestedQuestionLength)
|
|
264
|
+
query: string; // Question to send when clicked (truncated based on maxSuggestedQuestionQueryLength)
|
|
228
265
|
}
|
|
229
266
|
],
|
|
267
|
+
maxSuggestedQuestionLength?: number; // Display length limit (default: 50)
|
|
268
|
+
maxSuggestedQuestionQueryLength?: number; // Query length limit (default: 200)
|
|
230
269
|
theme: { /* theme object */ },
|
|
231
270
|
icon: string; // Widget icon type
|
|
232
271
|
}
|