@schmitech/chatbot-widget 0.1.0

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.
@@ -0,0 +1,91 @@
1
+ import { default as default_2 } from 'react';
2
+ import { StoreApi } from 'zustand';
3
+ import { UseBoundStore } from 'zustand';
4
+
5
+ export declare interface ChatConfig {
6
+ welcome: {
7
+ title: string;
8
+ description: string;
9
+ };
10
+ suggestedQuestions: {
11
+ text: string;
12
+ query: string;
13
+ }[];
14
+ header: {
15
+ title: string;
16
+ };
17
+ theme: ThemeConfig;
18
+ icon?: IconType;
19
+ }
20
+
21
+ declare interface ChatState {
22
+ messages: Message[];
23
+ isLoading: boolean;
24
+ error: string | null;
25
+ voiceEnabled: boolean;
26
+ toggleVoice: () => void;
27
+ sendMessage: (content: string) => Promise<void>;
28
+ appendToLastMessage: (content: string) => void;
29
+ clearMessages: () => void;
30
+ }
31
+
32
+ declare const ChatWidget: default_2.FC<ChatWidgetProps>;
33
+ export { ChatWidget }
34
+ export default ChatWidget;
35
+
36
+ export declare interface ChatWidgetProps extends Partial<ChatConfig> {
37
+ config?: never;
38
+ }
39
+
40
+ export declare function getApiUrl(): string;
41
+
42
+ export declare const getChatConfig: () => ChatConfig;
43
+
44
+ declare type IconType = 'heart' | 'message-square' | 'message-circle' | 'help-circle' | 'info' | 'bot' | 'sparkles';
45
+
46
+ export declare function injectChatWidget(config: {
47
+ apiUrl: string;
48
+ containerSelector?: string;
49
+ widgetConfig?: Partial<ChatConfig>;
50
+ }): void;
51
+
52
+ declare interface Message {
53
+ role: MessageRole;
54
+ content: string;
55
+ }
56
+
57
+ declare type MessageRole = 'user' | 'assistant' | 'system';
58
+
59
+ export declare function setApiUrl(url: string): void;
60
+
61
+ declare interface ThemeConfig {
62
+ primary: string;
63
+ secondary: string;
64
+ background: string;
65
+ text: {
66
+ primary: string;
67
+ secondary: string;
68
+ inverse: string;
69
+ };
70
+ input: {
71
+ background: string;
72
+ border: string;
73
+ };
74
+ message: {
75
+ user: string;
76
+ assistant: string;
77
+ userText: string;
78
+ };
79
+ suggestedQuestions: {
80
+ background: string;
81
+ hoverBackground: string;
82
+ text: string;
83
+ };
84
+ iconColor: string;
85
+ }
86
+
87
+ export declare function updateWidgetConfig(config: Partial<ChatConfig>): void;
88
+
89
+ export declare const useChatStore: UseBoundStore<StoreApi<ChatState>>;
90
+
91
+ export { }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@schmitech/chatbot-widget",
3
+ "private": false,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "main": "./dist/chatbot-widget.umd.js",
7
+ "module": "./dist/chatbot-widget.es.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/chatbot-widget.es.js",
12
+ "require": "./dist/chatbot-widget.umd.js"
13
+ },
14
+ "./bundle": "./dist/chatbot-widget.bundle.js",
15
+ "./style.css": "./dist/chatbot-widget.css"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "scripts": {
22
+ "dev": "vite",
23
+ "build": "tsc && vite build",
24
+ "build:bundle": "node scripts/bundle.js",
25
+ "lint": "eslint .",
26
+ "preview": "vite preview"
27
+ },
28
+ "dependencies": {
29
+ "@schmitech/chatbot-api": "^0.1.1",
30
+ "clsx": "^2.1.0",
31
+ "lucide-react": "^0.344.0",
32
+ "react": "^18.3.1",
33
+ "react-dom": "^18.3.1",
34
+ "react-markdown": "^9.0.1",
35
+ "zustand": "^4.5.0"
36
+ },
37
+ "devDependencies": {
38
+ "@eslint/js": "^9.9.1",
39
+ "@types/node": "^22.13.11",
40
+ "@types/react": "^18.3.5",
41
+ "@types/react-dom": "^18.3.0",
42
+ "@vitejs/plugin-react": "^4.3.1",
43
+ "autoprefixer": "^10.4.18",
44
+ "eslint": "^9.9.1",
45
+ "eslint-plugin-react-hooks": "^5.1.0-rc.0",
46
+ "eslint-plugin-react-refresh": "^0.4.11",
47
+ "globals": "^15.9.0",
48
+ "postcss": "^8.4.35",
49
+ "tailwindcss": "^3.4.1",
50
+ "typescript": "^5.5.3",
51
+ "typescript-eslint": "^8.3.0",
52
+ "vite": "^5.4.2",
53
+ "vite-plugin-dts": "^4.5.3"
54
+ },
55
+ "peerDependencies": {
56
+ "react": "^18.3.1",
57
+ "react-dom": "^18.3.1"
58
+ }
59
+ }