tia-chatbot 0.0.1

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 ADDED
@@ -0,0 +1,129 @@
1
+ # Tia Chatbot Widget
2
+
3
+ A pluggable chatbot widget built with React and Vite, designed to be easily embedded in any web application.
4
+
5
+ ## Installation
6
+
7
+ ### Via NPM/Yarn/PNPM
8
+
9
+ ```bash
10
+ npm install tia-chatbot
11
+ # or
12
+ yarn add tia-chatbot
13
+ # or
14
+ pnpm add tia-chatbot
15
+ ```
16
+
17
+ ### Via CDN
18
+
19
+ ```html
20
+ <script src="https://unpkg.com/tia-chatbot@latest/dist/tia-widget.umd.js"></script>
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### In React Apps
26
+
27
+ ```jsx
28
+ import { initTiaWidget, ChatWindow } from 'tia-chatbot';
29
+
30
+ function App() {
31
+ // Initialize the widget
32
+ useEffect(() => {
33
+ initTiaWidget();
34
+ }, []);
35
+
36
+ return (
37
+ <div>
38
+ {/* Your app content */}
39
+ <ChatWindow />
40
+ </div>
41
+ );
42
+ }
43
+ ```
44
+
45
+ ### In Non-React Apps (HTML/JS)
46
+
47
+ ```html
48
+ <!DOCTYPE html>
49
+ <html>
50
+ <head>
51
+ <title>My App</title>
52
+ <script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
53
+ <script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
54
+ <script src="https://unpkg.com/tia-chatbot@latest/dist/tia-widget.umd.js"></script>
55
+ </head>
56
+ <body>
57
+ <h1>My App</h1>
58
+
59
+ <script>
60
+ // Initialize the widget
61
+ TiaWidget.initTiaWidget();
62
+ </script>
63
+ </body>
64
+ </html>
65
+ ```
66
+
67
+ ### Via Script Tag
68
+
69
+ ```html
70
+ <!DOCTYPE html>
71
+ <html>
72
+ <head>
73
+ <title>My App</title>
74
+ </head>
75
+ <body>
76
+ <h1>My App</h1>
77
+
78
+ <!-- Load React and ReactDOM -->
79
+ <script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
80
+ <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
81
+
82
+ <!-- Load the Tia Widget -->
83
+ <script src="dist/tia-widget.umd.js"></script>
84
+
85
+ <script>
86
+ // Initialize the widget
87
+ TiaWidget.initTiaWidget();
88
+ </script>
89
+ </body>
90
+ </html>
91
+ ```
92
+
93
+ ## API
94
+
95
+ ### `initTiaWidget(options?)`
96
+
97
+ Initializes the Tia chatbot widget.
98
+
99
+ **Parameters:**
100
+ - `options` (optional): Configuration object
101
+ - `containerId` (string): ID of the container element to mount the widget in (default: mounts as fixed overlay)
102
+
103
+ ### `ChatWindow`
104
+
105
+ React component for the chat window.
106
+
107
+ **Props:**
108
+ - `isOpen` (boolean): Whether the chat window is open
109
+ - `setIsOpen` (function): Function to toggle the chat window
110
+
111
+ ## Development
112
+
113
+ ```bash
114
+ # Install dependencies
115
+ pnpm install
116
+
117
+ # Start development server
118
+ pnpm run dev
119
+
120
+ # Build for production
121
+ pnpm run build
122
+
123
+ # Preview production build
124
+ pnpm run preview
125
+ ```
126
+
127
+ ## License
128
+
129
+ MIT