@schmitech/chatbot-widget 0.4.0 → 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 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
- background: '#eef2ff',
70
- hoverBackground: '#e0e7ff',
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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@schmitech/chatbot-widget",
3
3
  "private": false,
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "type": "module",
6
6
  "main": "./dist/chatbot-widget.umd.js",
7
7
  "module": "./dist/chatbot-widget.es.js",
@@ -29,9 +29,14 @@
29
29
  "dependencies": {
30
30
  "@schmitech/chatbot-api": "^0.4.4",
31
31
  "clsx": "^2.1.0",
32
+ "katex": "^0.16.8",
32
33
  "lucide-react": "^0.344.0",
33
34
  "react": "^18.3.1",
34
35
  "react-dom": "^18.3.1",
36
+ "react-markdown": "^10.1.0",
37
+ "rehype-katex": "^7.0.0",
38
+ "remark-gfm": "^4.0.1",
39
+ "remark-math": "^6.0.0",
35
40
  "zustand": "^4.5.0"
36
41
  },
37
42
  "devDependencies": {
@@ -47,10 +52,8 @@
47
52
  "eslint-plugin-react-refresh": "^0.4.11",
48
53
  "globals": "^15.9.0",
49
54
  "postcss": "^8.4.35",
50
- "react-markdown": "^10.1.0",
51
55
  "rehype-highlight": "^7.0.2",
52
56
  "rehype-sanitize": "^6.0.0",
53
- "remark-gfm": "^4.0.1",
54
57
  "tailwindcss": "^3.4.1",
55
58
  "typescript": "^5.5.3",
56
59
  "typescript-eslint": "^8.3.0",