@kvsnguyen/chatbot-widget 0.0.9 → 0.1.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 +52 -0
- package/dist/widget.global.js +11 -23
- package/package.json +1 -1
- package/dist/widget.global.js.map +0 -1
package/README.md
CHANGED
|
@@ -37,3 +37,55 @@ Copy-paste **1 script tag** into your HTML:
|
|
|
37
37
|
</body>
|
|
38
38
|
</html>
|
|
39
39
|
```
|
|
40
|
+
|
|
41
|
+
## 2️⃣ Use via npm package
|
|
42
|
+
|
|
43
|
+
Install the package:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install @kvsnguyen/chatbot-widget
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Import in your React / Next.js project:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { useEffect } from "react";
|
|
53
|
+
import "@kvsnguyen/chatbot-widget/dist/widget.global.js"; // auto-mounts
|
|
54
|
+
|
|
55
|
+
export default function App() {
|
|
56
|
+
return <div>Your App</div>;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 3️⃣ Development
|
|
61
|
+
|
|
62
|
+
Clone the repo:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone <repo-url>
|
|
66
|
+
cd chatbot-widget
|
|
67
|
+
npm install
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Build the widget:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run build
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Output bundle: **dist/widget.global.js**
|
|
77
|
+
|
|
78
|
+
## 4️⃣ Publish to npm
|
|
79
|
+
|
|
80
|
+
**1.** Ensure "private": false in package.json.
|
|
81
|
+
**2.** Build:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm run build
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**3.** Publish:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm publish --access public
|
|
91
|
+
```
|