agenticaichat 1.0.0 → 1.0.3

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 (48) hide show
  1. package/README.md +83 -26
  2. package/bin/cli.js +301 -84
  3. package/dist/core/ChatbotEngine.d.ts +9 -1
  4. package/dist/core/ChatbotEngine.js +52 -19
  5. package/dist/core/EngineFactory.d.ts +45 -0
  6. package/dist/core/EngineFactory.js +126 -0
  7. package/dist/core/NLToSQLConverter.d.ts +6 -15
  8. package/dist/core/NLToSQLConverter.js +9 -114
  9. package/dist/engines/base/DatabaseEngine.d.ts +46 -0
  10. package/dist/engines/base/DatabaseEngine.js +42 -0
  11. package/dist/engines/nosql/MongoEngine.d.ts +13 -0
  12. package/dist/engines/nosql/MongoEngine.js +194 -0
  13. package/dist/engines/nosql/NoSqlEngine.d.ts +20 -0
  14. package/dist/engines/nosql/NoSqlEngine.js +29 -0
  15. package/dist/engines/sql/SqlEngine.d.ts +19 -0
  16. package/dist/engines/sql/SqlEngine.js +52 -0
  17. package/dist/engines/sql/dialects/MySQLDialect.d.ts +12 -0
  18. package/dist/engines/sql/dialects/MySQLDialect.js +109 -0
  19. package/dist/engines/sql/dialects/PostgresDialect.d.ts +11 -0
  20. package/dist/engines/sql/dialects/PostgresDialect.js +109 -0
  21. package/dist/engines/sql/dialects/SQLiteDialect.d.ts +10 -0
  22. package/dist/engines/sql/dialects/SQLiteDialect.js +101 -0
  23. package/dist/index.d.ts +17 -4
  24. package/dist/index.js +44 -8
  25. package/dist/llm/LLMFactory.d.ts +25 -0
  26. package/dist/llm/LLMFactory.js +137 -0
  27. package/dist/llm/providers/ClaudeProvider.d.ts +13 -0
  28. package/dist/llm/providers/ClaudeProvider.js +132 -0
  29. package/dist/llm/providers/DeepInfraProvider.d.ts +14 -0
  30. package/dist/llm/providers/DeepInfraProvider.js +144 -0
  31. package/dist/llm/providers/GeminiProvider.d.ts +13 -0
  32. package/dist/llm/providers/GeminiProvider.js +105 -0
  33. package/dist/llm/providers/GrokProvider.d.ts +14 -0
  34. package/dist/llm/providers/GrokProvider.js +144 -0
  35. package/dist/llm/providers/GroqProvider.d.ts +0 -0
  36. package/dist/llm/providers/GroqProvider.js +148 -0
  37. package/dist/llm/providers/OpenAIProvider.d.ts +13 -0
  38. package/dist/llm/providers/OpenAIProvider.js +136 -0
  39. package/dist/llm/providers/TogetherAIProvider.d.ts +14 -0
  40. package/dist/llm/providers/TogetherAIProvider.js +144 -0
  41. package/dist/llm/types.d.ts +34 -0
  42. package/dist/llm/types.js +2 -0
  43. package/dist/types/index.d.ts +23 -3
  44. package/dist/widget/ChatbotWidget.d.ts +1 -1
  45. package/dist/widget/ChatbotWidget.js +406 -125
  46. package/package.json +24 -5
  47. package/scripts/postinstall.js +126 -0
  48. package/templates/api-route.template.ts +24 -14
@@ -36,183 +36,464 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ChatbotWidget = void 0;
37
37
  const react_1 = __importStar(require("react"));
38
38
  const lucide_react_1 = require("lucide-react");
39
- const ChatbotWidget = ({ fullScreen = false }) => {
39
+ const ChatbotWidget = ({ fullScreen = false, }) => {
40
40
  const [isOpen, setIsOpen] = (0, react_1.useState)(fullScreen);
41
+ const [isMaximized, setIsMaximized] = (0, react_1.useState)(fullScreen);
42
+ const [isHidden, setIsHidden] = (0, react_1.useState)(false);
43
+ const [position, setPosition] = (0, react_1.useState)("bottom-right");
44
+ const [showPositionMenu, setShowPositionMenu] = (0, react_1.useState)(false);
41
45
  const [messages, setMessages] = (0, react_1.useState)([
42
46
  {
43
47
  id: 1,
44
- type: 'bot',
45
- text: 'नमस्ते! 👋 मैं आपके बिजनेस के बारे में सवालों का जवाब दे सकता हूँ।'
46
- }
48
+ type: "bot",
49
+ text: "Hello! 👋 Welcome to our support chat. How can I assist you today?",
50
+ timestamp: new Date(),
51
+ },
47
52
  ]);
48
- const [input, setInput] = (0, react_1.useState)('');
53
+ const [input, setInput] = (0, react_1.useState)("");
49
54
  const [loading, setLoading] = (0, react_1.useState)(false);
50
55
  const messagesEndRef = (0, react_1.useRef)(null);
51
- // Auto-scroll to bottom
56
+ const menuRef = (0, react_1.useRef)(null);
57
+ // Load position from localStorage on mount
58
+ (0, react_1.useEffect)(() => {
59
+ const savedPosition = localStorage.getItem("chatbot-position");
60
+ if (savedPosition) {
61
+ setPosition(savedPosition);
62
+ }
63
+ }, []);
64
+ // Close menu when clicking outside
52
65
  (0, react_1.useEffect)(() => {
53
- messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
66
+ const handleClickOutside = (event) => {
67
+ if (menuRef.current && !menuRef.current.contains(event.target)) {
68
+ setShowPositionMenu(false);
69
+ }
70
+ };
71
+ if (showPositionMenu) {
72
+ document.addEventListener("mousedown", handleClickOutside);
73
+ }
74
+ return () => {
75
+ document.removeEventListener("mousedown", handleClickOutside);
76
+ };
77
+ }, [showPositionMenu]);
78
+ (0, react_1.useEffect)(() => {
79
+ messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
54
80
  }, [messages]);
55
81
  const handleSend = async () => {
56
82
  if (!input.trim() || loading)
57
83
  return;
58
- // Add user message
59
84
  const userMessage = {
60
85
  id: messages.length + 1,
61
- type: 'user',
62
- text: input
86
+ type: "user",
87
+ text: input,
88
+ timestamp: new Date(),
63
89
  };
64
- setMessages(prev => [...prev, userMessage]);
90
+ setMessages((prev) => [...prev, userMessage]);
65
91
  const currentInput = input;
66
- setInput('');
92
+ setInput("");
67
93
  setLoading(true);
68
94
  try {
69
- // Call backend API
70
- const response = await fetch('/api/chatbot/query', {
71
- method: 'POST',
95
+ const response = await fetch("/api/chatbot/query", {
96
+ method: "POST",
72
97
  headers: {
73
- 'Content-Type': 'application/json',
98
+ "Content-Type": "application/json",
74
99
  },
75
- body: JSON.stringify({ query: currentInput })
100
+ body: JSON.stringify({ query: currentInput }),
76
101
  });
77
102
  if (!response.ok) {
78
- throw new Error('API request failed');
103
+ throw new Error("API request failed");
79
104
  }
80
105
  const data = await response.json();
81
106
  const botMessage = {
82
107
  id: messages.length + 2,
83
- type: 'bot',
84
- text: data.success ? data.answer : 'Sorry, I could not process your query.'
108
+ type: "bot",
109
+ text: data.success
110
+ ? data.answer
111
+ : "I apologize, but I could not process your request.",
112
+ timestamp: new Date(),
85
113
  };
86
- setMessages(prev => [...prev, botMessage]);
114
+ setMessages((prev) => [...prev, botMessage]);
87
115
  }
88
116
  catch (error) {
89
- console.error('Chatbot error:', error);
117
+ console.error("Chatbot error:", error);
90
118
  const errorMessage = {
91
119
  id: messages.length + 2,
92
- type: 'bot',
93
- text: '❌ Sorry, कुछ गड़बड़ी हुई। Please try again.'
120
+ type: "bot",
121
+ text: "Sorry, something went wrong. Please try again.",
122
+ timestamp: new Date(),
94
123
  };
95
- setMessages(prev => [...prev, errorMessage]);
124
+ setMessages((prev) => [...prev, errorMessage]);
96
125
  }
97
126
  finally {
98
127
  setLoading(false);
99
128
  }
100
129
  };
130
+ const formatTime = (date) => {
131
+ return date.toLocaleTimeString("en-US", {
132
+ hour: "2-digit",
133
+ minute: "2-digit",
134
+ });
135
+ };
136
+ const handlePositionChange = (newPosition) => {
137
+ setPosition(newPosition);
138
+ localStorage.setItem("chatbot-position", newPosition);
139
+ setShowPositionMenu(false);
140
+ };
141
+ const handleHide = () => {
142
+ setIsHidden(true);
143
+ setShowPositionMenu(false);
144
+ };
145
+ // Get position styles
146
+ const getButtonPosition = () => {
147
+ const base = { position: "fixed", zIndex: 9999 };
148
+ switch (position) {
149
+ case "top-left":
150
+ return { ...base, top: "24px", left: "24px" };
151
+ case "top-right":
152
+ return { ...base, top: "24px", right: "24px" };
153
+ case "bottom-left":
154
+ return { ...base, bottom: "24px", left: "24px" };
155
+ case "bottom-right":
156
+ default:
157
+ return { ...base, bottom: "24px", right: "24px" };
158
+ }
159
+ };
160
+ const getChatPosition = () => {
161
+ const base = { position: "fixed", zIndex: 9999 };
162
+ if (isMaximized) {
163
+ return { ...base, top: 0, left: 0, right: 0, bottom: 0 };
164
+ }
165
+ switch (position) {
166
+ case "top-left":
167
+ return { ...base, top: "24px", left: "24px" };
168
+ case "top-right":
169
+ return { ...base, top: "24px", right: "24px" };
170
+ case "bottom-left":
171
+ return { ...base, bottom: "24px", left: "24px" };
172
+ case "bottom-right":
173
+ default:
174
+ return { ...base, bottom: "24px", right: "24px" };
175
+ }
176
+ };
177
+ // Hidden state (reload to show again)
178
+ if (isHidden && !fullScreen) {
179
+ return null;
180
+ }
101
181
  // Floating button view
102
182
  if (!fullScreen && !isOpen) {
103
- return (react_1.default.createElement("button", { onClick: () => setIsOpen(true), style: {
104
- position: 'fixed',
105
- bottom: '20px',
106
- right: '20px',
107
- width: '60px',
108
- height: '60px',
109
- borderRadius: '50%',
110
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
111
- border: 'none',
112
- cursor: 'pointer',
113
- display: 'flex',
114
- alignItems: 'center',
115
- justifyContent: 'center',
116
- color: 'white',
117
- boxShadow: '0 4px 12px rgba(102, 126, 234, 0.4)',
118
- zIndex: 9999,
119
- transition: 'transform 0.2s'
120
- }, onMouseOver: (e) => e.currentTarget.style.transform = 'scale(1.1)', onMouseOut: (e) => e.currentTarget.style.transform = 'scale(1)' },
121
- react_1.default.createElement(lucide_react_1.MessageCircle, { size: 28 })));
183
+ return (react_1.default.createElement("div", { style: { ...getButtonPosition() } },
184
+ showPositionMenu && (react_1.default.createElement("div", { ref: menuRef, style: {
185
+ position: "absolute",
186
+ bottom: position.startsWith("bottom") ? "70px" : "auto",
187
+ top: position.startsWith("top") ? "70px" : "auto",
188
+ right: position.endsWith("right") ? "0" : "auto",
189
+ left: position.endsWith("left") ? "0" : "auto",
190
+ background: "#fff",
191
+ borderRadius: "12px",
192
+ boxShadow: "0 10px 40px rgba(0, 0, 0, 0.15)",
193
+ padding: "8px",
194
+ minWidth: "200px",
195
+ border: "1px solid #e5e7eb",
196
+ zIndex: 10000,
197
+ } },
198
+ [
199
+ { label: "Top Left", value: "top-left" },
200
+ { label: "Top Right", value: "top-right" },
201
+ { label: "Bottom Left", value: "bottom-left" },
202
+ { label: "Bottom Right", value: "bottom-right" },
203
+ ].map((pos) => (react_1.default.createElement("button", { key: pos.value, onClick: () => handlePositionChange(pos.value), style: {
204
+ width: "100%",
205
+ padding: "10px 12px",
206
+ background: position === pos.value ? "#f3f4f6" : "transparent",
207
+ border: "none",
208
+ borderRadius: "8px",
209
+ textAlign: "left",
210
+ cursor: "pointer",
211
+ fontSize: "14px",
212
+ color: "#1f2937",
213
+ transition: "background 0.2s",
214
+ display: "flex",
215
+ alignItems: "center",
216
+ gap: "8px",
217
+ }, onMouseOver: (e) => (e.currentTarget.style.background = "#f3f4f6"), onMouseOut: (e) => (e.currentTarget.style.background =
218
+ position === pos.value ? "#f3f4f6" : "transparent") },
219
+ position === pos.value && (react_1.default.createElement("span", { style: { color: "#4f46e5" } }, "\u2713")),
220
+ pos.label))),
221
+ react_1.default.createElement("div", { style: { height: "1px", background: "#e5e7eb", margin: "8px 0" } }),
222
+ react_1.default.createElement("button", { onClick: handleHide, style: {
223
+ width: "100%",
224
+ padding: "10px 12px",
225
+ background: "transparent",
226
+ border: "none",
227
+ borderRadius: "8px",
228
+ textAlign: "left",
229
+ cursor: "pointer",
230
+ fontSize: "14px",
231
+ color: "#dc2626",
232
+ transition: "background 0.2s",
233
+ }, onMouseOver: (e) => (e.currentTarget.style.background = "#fef2f2"), onMouseOut: (e) => (e.currentTarget.style.background = "transparent") }, "Hide Widget"))),
234
+ react_1.default.createElement("div", { style: { position: "relative" } },
235
+ react_1.default.createElement("button", { onClick: () => setIsOpen(true), style: {
236
+ width: "56px",
237
+ height: "56px",
238
+ borderRadius: "50%",
239
+ background: "#fff",
240
+ border: "1px solid #e5e7eb",
241
+ cursor: "pointer",
242
+ display: "flex",
243
+ alignItems: "center",
244
+ justifyContent: "center",
245
+ color: "#4f46e5",
246
+ boxShadow: "0 10px 25px rgba(0, 0, 0, 0.1)",
247
+ transition: "all 0.3s ease",
248
+ }, onMouseOver: (e) => {
249
+ e.currentTarget.style.transform = "scale(1.05)";
250
+ e.currentTarget.style.boxShadow =
251
+ "0 15px 35px rgba(0, 0, 0, 0.15)";
252
+ }, onMouseOut: (e) => {
253
+ e.currentTarget.style.transform = "scale(1)";
254
+ e.currentTarget.style.boxShadow =
255
+ "0 10px 25px rgba(0, 0, 0, 0.1)";
256
+ } },
257
+ react_1.default.createElement(lucide_react_1.MessageCircle, { size: 24, strokeWidth: 2 })),
258
+ react_1.default.createElement("button", { onClick: (e) => {
259
+ e.stopPropagation();
260
+ setShowPositionMenu(!showPositionMenu);
261
+ }, style: {
262
+ position: "absolute",
263
+ top: "-8px",
264
+ right: "-8px",
265
+ width: "24px",
266
+ height: "24px",
267
+ borderRadius: "50%",
268
+ background: "#ffffffff",
269
+ border: "none",
270
+ cursor: "pointer",
271
+ display: "flex",
272
+ alignItems: "center",
273
+ justifyContent: "center",
274
+ color: "#000000ff",
275
+ boxShadow: "0 2px 8px rgba(79, 70, 229, 0.4)",
276
+ transition: "all 0.2s",
277
+ }, onMouseOver: (e) => {
278
+ e.currentTarget.style.background = "#ffffffff";
279
+ e.currentTarget.style.transform = "scale(1.1)";
280
+ }, onMouseOut: (e) => {
281
+ e.currentTarget.style.background = "#ffffffff";
282
+ e.currentTarget.style.transform = "scale(1)";
283
+ } },
284
+ react_1.default.createElement(lucide_react_1.MoreHorizontal, { size: 14 })))));
122
285
  }
123
286
  // Chat box view
287
+ const chatWidth = isMaximized ? "100vw" : "420px";
288
+ const chatHeight = isMaximized ? "100vh" : "650px";
124
289
  return (react_1.default.createElement("div", { style: {
125
- position: 'fixed',
126
- bottom: fullScreen ? 0 : '20px',
127
- right: fullScreen ? 0 : '20px',
128
- width: fullScreen ? '100vw' : '400px',
129
- height: fullScreen ? '100vh' : '600px',
130
- background: 'white',
131
- borderRadius: fullScreen ? 0 : '12px',
132
- boxShadow: '0 5px 40px rgba(0, 0, 0, 0.16)',
133
- display: 'flex',
134
- flexDirection: 'column',
135
- zIndex: 9999,
136
- fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
290
+ ...getChatPosition(),
291
+ width: chatWidth,
292
+ height: chatHeight,
293
+ background: "#ffffff",
294
+ borderRadius: isMaximized ? 0 : "16px",
295
+ boxShadow: "0 20px 60px rgba(0, 0, 0, 0.15)",
296
+ display: "flex",
297
+ flexDirection: "column",
298
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif',
299
+ border: "1px solid #e5e7eb",
300
+ overflow: "hidden",
137
301
  } },
138
302
  react_1.default.createElement("div", { style: {
139
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
140
- color: 'white',
141
- padding: '16px',
142
- borderRadius: fullScreen ? 0 : '12px 12px 0 0',
143
- display: 'flex',
144
- justifyContent: 'space-between',
145
- alignItems: 'center'
303
+ background: "#ffffff",
304
+ color: "#1f2937",
305
+ padding: "10px 24px",
306
+ borderBottom: "1px solid #e5e7eb",
307
+ display: "flex",
308
+ justifyContent: "space-between",
309
+ alignItems: "center",
146
310
  } },
147
- react_1.default.createElement("h3", { style: { margin: 0, fontSize: '16px' } }, "\uD83E\uDD16 AI Assistant"),
148
- !fullScreen && (react_1.default.createElement("button", { onClick: () => setIsOpen(false), style: {
149
- background: 'none',
150
- border: 'none',
151
- color: 'white',
152
- cursor: 'pointer',
153
- display: 'flex',
154
- alignItems: 'center',
155
- justifyContent: 'center',
156
- padding: '4px'
157
- } },
158
- react_1.default.createElement(lucide_react_1.X, { size: 20 })))),
311
+ react_1.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: "12px" } },
312
+ react_1.default.createElement("div", { style: {
313
+ width: "40px",
314
+ height: "40px",
315
+ borderRadius: "50%",
316
+ background: "linear-gradient(135deg, #2563eb, #06b6d4)",
317
+ display: "flex",
318
+ alignItems: "center",
319
+ justifyContent: "center",
320
+ boxShadow: "0 4px 10px rgba(37, 99, 235, 0.35)",
321
+ } },
322
+ react_1.default.createElement("span", { style: {
323
+ color: "#fff",
324
+ fontSize: "18px",
325
+ fontWeight: "600",
326
+ transform: "translateY(-1px)",
327
+ } }, "\u27C1")),
328
+ react_1.default.createElement("div", null,
329
+ react_1.default.createElement("h3", { style: {
330
+ margin: 0,
331
+ fontSize: "16px",
332
+ fontWeight: "600",
333
+ color: "#111827",
334
+ } }, "AgenticAiChat"),
335
+ react_1.default.createElement("p", { style: { margin: 0, fontSize: "12px", color: "#6b7280" } }, "Online \u2022 Ready to help"))),
336
+ react_1.default.createElement("div", { style: { display: "flex", gap: "8px" } },
337
+ !fullScreen && (react_1.default.createElement("button", { onClick: () => setIsMaximized(!isMaximized), style: {
338
+ background: "none",
339
+ border: "none",
340
+ color: "#6b7280",
341
+ cursor: "pointer",
342
+ display: "flex",
343
+ alignItems: "center",
344
+ justifyContent: "center",
345
+ padding: "8px",
346
+ borderRadius: "8px",
347
+ transition: "all 0.2s",
348
+ }, onMouseOver: (e) => {
349
+ e.currentTarget.style.background = "#f3f4f6";
350
+ e.currentTarget.style.color = "#111827";
351
+ }, onMouseOut: (e) => {
352
+ e.currentTarget.style.background = "none";
353
+ e.currentTarget.style.color = "#6b7280";
354
+ } }, isMaximized ? react_1.default.createElement(lucide_react_1.Minimize2, { size: 18 }) : react_1.default.createElement(lucide_react_1.Maximize2, { size: 18 }))),
355
+ !fullScreen && (react_1.default.createElement("button", { onClick: () => setIsOpen(false), style: {
356
+ background: "none",
357
+ border: "none",
358
+ color: "#6b7280",
359
+ cursor: "pointer",
360
+ display: "flex",
361
+ alignItems: "center",
362
+ justifyContent: "center",
363
+ padding: "8px",
364
+ borderRadius: "8px",
365
+ transition: "all 0.2s",
366
+ }, onMouseOver: (e) => {
367
+ e.currentTarget.style.background = "#f3f4f6";
368
+ e.currentTarget.style.color = "#111827";
369
+ }, onMouseOut: (e) => {
370
+ e.currentTarget.style.background = "none";
371
+ e.currentTarget.style.color = "#6b7280";
372
+ } },
373
+ react_1.default.createElement(lucide_react_1.X, { size: 18 }))))),
159
374
  react_1.default.createElement("div", { style: {
160
375
  flex: 1,
161
- overflowY: 'auto',
162
- padding: '16px',
163
- display: 'flex',
164
- flexDirection: 'column',
165
- gap: '12px',
166
- background: '#f9f9f9'
376
+ overflowY: "auto",
377
+ padding: "14px",
378
+ display: "flex",
379
+ flexDirection: "column",
380
+ gap: "2px",
381
+ background: "#fafafa",
167
382
  } },
168
- messages.map(msg => (react_1.default.createElement("div", { key: msg.id, style: {
169
- maxWidth: '80%',
170
- padding: '10px 14px',
171
- borderRadius: '8px',
172
- alignSelf: msg.type === 'user' ? 'flex-end' : 'flex-start',
173
- background: msg.type === 'user' ? '#667eea' : 'white',
174
- color: msg.type === 'user' ? 'white' : '#333',
175
- boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
176
- wordWrap: 'break-word',
177
- animation: 'fadeIn 0.3s ease'
178
- } }, msg.text))),
383
+ messages.map((msg) => (react_1.default.createElement("div", { key: msg.id, style: {
384
+ display: "flex",
385
+ flexDirection: "column",
386
+ alignItems: msg.type === "user" ? "flex-end" : "flex-start",
387
+ animation: "fadeIn 0.3s ease",
388
+ } },
389
+ react_1.default.createElement("div", { style: {
390
+ maxWidth: "75%",
391
+ padding: "12px 16px",
392
+ borderRadius: msg.type === "user"
393
+ ? "16px 16px 4px 16px"
394
+ : "16px 16px 16px 4px",
395
+ background: msg.type === "user" ? "#ffffffff" : "#ffffff",
396
+ color: msg.type === "user" ? "#1f2937" : "#1f2937",
397
+ boxShadow: msg.type === "user"
398
+ ? "0 2px 8px rgba(79, 70, 229, 0.2)"
399
+ : "0 2px 8px rgba(0, 0, 0, 0.08)",
400
+ wordWrap: "break-word",
401
+ fontSize: "12px",
402
+ lineHeight: "1.5",
403
+ border: msg.type === "bot" ? "1px solid #e5e7eb" : "none",
404
+ } }, msg.text),
405
+ react_1.default.createElement("span", { style: {
406
+ fontSize: "10px",
407
+ color: "#9ca3af",
408
+ marginTop: "4px",
409
+ padding: "0 4px",
410
+ } }, formatTime(msg.timestamp))))),
179
411
  loading && (react_1.default.createElement("div", { style: {
180
- alignSelf: 'flex-start',
181
- fontStyle: 'italic',
182
- color: '#999',
183
- padding: '8px'
184
- } }, "Typing...")),
412
+ display: "flex",
413
+ alignItems: "center",
414
+ gap: "8px",
415
+ padding: "12px 16px",
416
+ background: "#ffffff",
417
+ borderRadius: "16px 16px 16px 4px",
418
+ maxWidth: "75%",
419
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.08)",
420
+ border: "1px solid #e5e7eb",
421
+ } },
422
+ react_1.default.createElement("div", { style: {
423
+ display: "flex",
424
+ gap: "4px",
425
+ } }, [0, 1, 2].map((i) => (react_1.default.createElement("div", { key: i, style: {
426
+ width: "8px",
427
+ height: "8px",
428
+ borderRadius: "50%",
429
+ background: "#d1d5db",
430
+ animation: `bounce 1.4s infinite ease-in-out ${i * 0.16}s`,
431
+ } })))),
432
+ react_1.default.createElement("style", null, `
433
+ @keyframes bounce {
434
+ 0%, 80%, 100% { transform: scale(0); }
435
+ 40% { transform: scale(1); }
436
+ }
437
+ @keyframes fadeIn {
438
+ from { opacity: 0; transform: translateY(10px); }
439
+ to { opacity: 1; transform: translateY(0); }
440
+ }
441
+ `))),
185
442
  react_1.default.createElement("div", { ref: messagesEndRef })),
186
443
  react_1.default.createElement("div", { style: {
187
- padding: '12px',
188
- borderTop: '1px solid #eee',
189
- display: 'flex',
190
- gap: '8px',
191
- background: 'white',
192
- borderRadius: fullScreen ? 0 : '0 0 12px 12px'
444
+ padding: "16px 24px 20px",
445
+ borderTop: "1px solid #e5e7eb",
446
+ background: "#ffffff",
193
447
  } },
194
- react_1.default.createElement("input", { type: "text", value: input, onChange: (e) => setInput(e.target.value), onKeyPress: (e) => e.key === 'Enter' && handleSend(), placeholder: "\u0905\u092A\u0928\u093E \u0938\u0935\u093E\u0932 \u092A\u0942\u091B\u094B...", disabled: loading, style: {
195
- flex: 1,
196
- padding: '10px 16px',
197
- border: '1px solid #ddd',
198
- borderRadius: '20px',
199
- outline: 'none',
200
- fontSize: '14px',
201
- transition: 'border-color 0.2s'
202
- }, onFocus: (e) => e.currentTarget.style.borderColor = '#667eea', onBlur: (e) => e.currentTarget.style.borderColor = '#ddd' }),
203
- react_1.default.createElement("button", { onClick: handleSend, disabled: loading || !input.trim(), style: {
204
- width: '40px',
205
- height: '40px',
206
- borderRadius: '50%',
207
- background: loading || !input.trim() ? '#ccc' : '#667eea',
208
- border: 'none',
209
- color: 'white',
210
- cursor: loading || !input.trim() ? 'not-allowed' : 'pointer',
211
- display: 'flex',
212
- alignItems: 'center',
213
- justifyContent: 'center',
214
- transition: 'background 0.2s'
448
+ react_1.default.createElement("div", { style: {
449
+ display: "flex",
450
+ gap: "12px",
451
+ alignItems: "center",
452
+ background: "#f9fafb",
453
+ borderRadius: "24px",
454
+ padding: "4px 4px 4px 20px",
455
+ border: "1px solid #e5e7eb",
456
+ transition: "all 0.2s",
457
+ }, onFocus: (e) => {
458
+ e.currentTarget.style.borderColor = "#4f46e5";
459
+ e.currentTarget.style.background = "#ffffff";
460
+ }, onBlur: (e) => {
461
+ e.currentTarget.style.borderColor = "#e5e7eb";
462
+ e.currentTarget.style.background = "#f9fafb";
215
463
  } },
216
- react_1.default.createElement(lucide_react_1.Send, { size: 18 })))));
464
+ react_1.default.createElement("input", { type: "text", value: input, onChange: (e) => setInput(e.target.value), onKeyPress: (e) => e.key === "Enter" && handleSend(), placeholder: "Type your message...", disabled: loading, style: {
465
+ flex: 1,
466
+ padding: "10px 0",
467
+ border: "none",
468
+ background: "transparent",
469
+ outline: "none",
470
+ fontSize: "14px",
471
+ color: "#1f2937",
472
+ } }),
473
+ react_1.default.createElement("button", { onClick: handleSend, disabled: loading || !input.trim(), style: {
474
+ width: "40px",
475
+ height: "40px",
476
+ borderRadius: "50%",
477
+ background: loading || !input.trim() ? "#e5e7eb" : "#4f46e5",
478
+ border: "none",
479
+ color: "white",
480
+ cursor: loading || !input.trim() ? "not-allowed" : "pointer",
481
+ display: "flex",
482
+ alignItems: "center",
483
+ justifyContent: "center",
484
+ transition: "all 0.2s",
485
+ flexShrink: 0,
486
+ }, onMouseOver: (e) => {
487
+ if (!loading && input.trim()) {
488
+ e.currentTarget.style.background = "#4338ca";
489
+ e.currentTarget.style.transform = "scale(1.05)";
490
+ }
491
+ }, onMouseOut: (e) => {
492
+ if (!loading && input.trim()) {
493
+ e.currentTarget.style.background = "#4f46e5";
494
+ e.currentTarget.style.transform = "scale(1)";
495
+ }
496
+ } },
497
+ react_1.default.createElement(lucide_react_1.Send, { size: 18 }))))));
217
498
  };
218
499
  exports.ChatbotWidget = ChatbotWidget;