@kaifusion/widget 1.0.4 → 1.0.6
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 +49 -0
- package/dist/widget.iife.js +452 -0
- package/package.json +10 -1
- package/src/KaiChatWidget.tsx +113 -34
- package/src/embed.tsx +94 -0
- package/src/index.css +2 -0
- package/dist/KaiChatWidget.d.ts +0 -10
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -66505
- package/dist/index.es.js.map +0 -1
package/README.md
CHANGED
|
@@ -69,3 +69,52 @@ export default App;
|
|
|
69
69
|
| `position` | `"left" \| "right"` | No | `"right"` | Position of the widget on the screen (bottom-left or bottom-right). |
|
|
70
70
|
| `color` | `string` | No | `"#526cfe"` | Main theme color of the widget (Hex code). |
|
|
71
71
|
| `icon` | `ReactNode` | No | `MessageSquare` | Custom icon for the toggle button. |
|
|
72
|
+
|
|
73
|
+
## Standalone Usage (HTML / MkDocs)
|
|
74
|
+
|
|
75
|
+
You can also use the widget in non-React projects or static sites (like MkDocs) by including the standalone script.
|
|
76
|
+
|
|
77
|
+
### HTML Integration
|
|
78
|
+
|
|
79
|
+
Add the following script tag to your HTML file:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<script
|
|
83
|
+
src="https://cdn.jsdelivr.net/npm/@kaifusion/widget@1.0.5/dist/widget.iife.js"
|
|
84
|
+
data-title="KAI Fusion Assistant"
|
|
85
|
+
data-auth-token="your-auth-token"
|
|
86
|
+
data-workflow-id="your-workflow-id"
|
|
87
|
+
data-target-url="http://localhost:8000"
|
|
88
|
+
data-position="right"
|
|
89
|
+
data-color="#526cfe"
|
|
90
|
+
defer
|
|
91
|
+
></script>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### MkDocs Integration
|
|
95
|
+
|
|
96
|
+
For MkDocs, you can inject the script dynamically using JavaScript.
|
|
97
|
+
|
|
98
|
+
1. Create a javascript file (e.g `docs/js/kai-widget.js`) with the following content:
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
102
|
+
const script = document.createElement("script");
|
|
103
|
+
script.src =
|
|
104
|
+
"https://cdn.jsdelivr.net/npm/@kaifusion/widget@1.0.5/dist/widget.iife.js"; // Adjust URL to your source
|
|
105
|
+
script.dataset.title = "KAI Fusion Assistant";
|
|
106
|
+
script.dataset.authToken = "your-auth-token";
|
|
107
|
+
script.dataset.workflowId = "your-workflow-id";
|
|
108
|
+
script.dataset.targetUrl = "http://localhost:8000";
|
|
109
|
+
script.dataset.position = "right";
|
|
110
|
+
script.dataset.color = "#526cfe";
|
|
111
|
+
document.body.appendChild(script);
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
2. Register the script in your `mkdocs.yml`:
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
extra_javascript:
|
|
119
|
+
- js/kai-widget.js
|
|
120
|
+
```
|