@cas0570/chat-widget 0.0.1 → 0.0.2
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 +55 -5
- package/dist/geoapps-chat-widget.embed.js +837 -0
- package/dist/style.css +1 -1
- package/package.json +81 -80
- package/dist/components/ChatBubble.d.ts +0 -8
- package/dist/components/ChatWidget.d.ts +0 -3
- package/dist/components/ChatWindow.d.ts +0 -18
- package/dist/components/Icons.d.ts +0 -26
- package/dist/components/MarkdownRenderer.d.ts +0 -6
- package/dist/components/MessageInput.d.ts +0 -8
- package/dist/components/MessageList.d.ts +0 -9
- package/dist/components/PopoutWindow.d.ts +0 -25
- package/dist/components/ToggleButton.d.ts +0 -9
- package/dist/components/TypingIndicator.d.ts +0 -1
- package/dist/components/__tests__/ChatBubble.test.d.ts +0 -1
- package/dist/components/__tests__/ChatWidget.test.d.ts +0 -1
- package/dist/components/__tests__/ChatWindow.test.d.ts +0 -1
- package/dist/components/__tests__/Icons.test.d.ts +0 -1
- package/dist/components/__tests__/MarkdownRenderer.test.d.ts +0 -1
- package/dist/components/__tests__/MessageInput.test.d.ts +0 -1
- package/dist/components/__tests__/MessageList.test.d.ts +0 -1
- package/dist/components/__tests__/PopoutWindow.test.d.ts +0 -1
- package/dist/components/__tests__/ToggleButton.test.d.ts +0 -1
- package/dist/components/__tests__/TypingIndicator.test.d.ts +0 -1
- package/dist/components/__tests__/index.test.d.ts +0 -1
- package/dist/components/index.d.ts +0 -9
- package/dist/embed.d.ts +0 -17
- package/dist/geoapps-chat-widget.js +0 -1471
- package/dist/geoapps-chat-widget.umd.cjs +0 -597
- package/dist/hooks/__tests__/useChat.test.d.ts +0 -1
- package/dist/hooks/useChat.d.ts +0 -17
- package/dist/index.d.ts +0 -9
- package/dist/main.d.ts +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/utils/__tests__/chatPersistence.test.d.ts +0 -1
- package/dist/utils/chatPersistence.d.ts +0 -44
- package/dist/utils/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -52,7 +52,6 @@ function App() {
|
|
|
52
52
|
| 🎨 **Customizable** | Full control over colors, text, positioning |
|
|
53
53
|
| 📱 **Responsive** | Works on desktop and mobile |
|
|
54
54
|
| ♿ **Accessible** | WCAG compliant with keyboard navigation |
|
|
55
|
-
| 🌐 **Framework Agnostic** | Works with any frontend via script tag |
|
|
56
55
|
|
|
57
56
|
---
|
|
58
57
|
|
|
@@ -126,6 +125,56 @@ export default function Page() {
|
|
|
126
125
|
}
|
|
127
126
|
```
|
|
128
127
|
|
|
128
|
+
### Script Tag (CDN)
|
|
129
|
+
|
|
130
|
+
Voor websites zonder build system kun je de embed bundle direct gebruiken via een script tag.
|
|
131
|
+
|
|
132
|
+
#### Methode 1: Data Attributen (eenvoudigste)
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<script
|
|
136
|
+
src="https://cdn.example.com/geoapps-chat-widget.embed.js"
|
|
137
|
+
data-api-url="https://api.geoapps.nl/api/v1/chat"
|
|
138
|
+
data-title="GeoApps Help"
|
|
139
|
+
data-subtitle="Vraag me iets over GeoApps"
|
|
140
|
+
data-greeting="Hallo! Hoe kan ik je helpen met GeoApps?"
|
|
141
|
+
data-placeholder="Typ je vraag..."
|
|
142
|
+
data-primary-color="#3b82f6"
|
|
143
|
+
data-position="bottom-right"
|
|
144
|
+
data-default-open="false"
|
|
145
|
+
></script>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Methode 2: JavaScript API
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<script src="https://cdn.example.com/geoapps-chat-widget.embed.js"></script>
|
|
152
|
+
<script>
|
|
153
|
+
GeoAppsChatWidget.embed({
|
|
154
|
+
apiUrl: 'https://api.geoapps.nl/api/v1/chat',
|
|
155
|
+
title: 'GeoApps Help',
|
|
156
|
+
subtitle: 'Vraag me iets over GeoApps',
|
|
157
|
+
greeting: 'Hallo! Hoe kan ik je helpen met GeoApps?',
|
|
158
|
+
placeholder: 'Typ je vraag...',
|
|
159
|
+
primaryColor: '#3b82f6',
|
|
160
|
+
position: 'bottom-right'
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Beschikbare Data Attributen
|
|
166
|
+
|
|
167
|
+
| Attribuut | Omschrijving |
|
|
168
|
+
| --------- | ------------ |
|
|
169
|
+
| `data-api-url` | **Verplicht.** Chat API endpoint URL |
|
|
170
|
+
| `data-title` | Header titel |
|
|
171
|
+
| `data-subtitle` | Header subtitel |
|
|
172
|
+
| `data-greeting` | Initieel welkomstbericht |
|
|
173
|
+
| `data-placeholder` | Input placeholder tekst |
|
|
174
|
+
| `data-primary-color` | Accent kleur (hex) |
|
|
175
|
+
| `data-position` | `bottom-right`, `bottom-left`, `top-right`, `top-left` |
|
|
176
|
+
| `data-default-open` | `true` of `false` - start open of gesloten |
|
|
177
|
+
|
|
129
178
|
---
|
|
130
179
|
|
|
131
180
|
## API Reference
|
|
@@ -139,7 +188,7 @@ export default function Page() {
|
|
|
139
188
|
| `title` | `string` | `"Chat"` | Dialog header title |
|
|
140
189
|
| `subtitle` | `string` | `""` | Dialog header subtitle |
|
|
141
190
|
| `placeholder` | `string` | `"Typ een bericht..."` | Input placeholder text |
|
|
142
|
-
| `greeting` | `string` | `""` | Initial
|
|
191
|
+
| `greeting` | `string` | `""` | Initial bot message |
|
|
143
192
|
| `primaryColor` | `string` | `"#3b82f6"` | Main accent color (hex) or var() |
|
|
144
193
|
| `position` | `Position` | `"bottom-right"` | Widget position |
|
|
145
194
|
| `defaultOpen` | `boolean` | `false` | Default open state |
|
|
@@ -170,8 +219,8 @@ export default function Page() {
|
|
|
170
219
|
| ------ | ------ | ------------- |
|
|
171
220
|
| `onOpen` | `() => void` | Called when chat dialog opens |
|
|
172
221
|
| `onClose` | `() => void` | Called when chat dialog closes |
|
|
173
|
-
| `onMessageSent` | `(message: string) => void` | Called when message is sent |
|
|
174
|
-
| `onResponseReceived` | `(response: string) => void` | Called when a
|
|
222
|
+
| `onMessageSent` | `(message: string) => void` | Called when a message is sent |
|
|
223
|
+
| `onResponseReceived` | `(response: string) => void` | Called when a message is received |
|
|
175
224
|
|
|
176
225
|
### Example with Callbacks
|
|
177
226
|
|
|
@@ -180,7 +229,8 @@ export default function Page() {
|
|
|
180
229
|
apiUrl="https://api.geoapps.nl/api/v1/chat"
|
|
181
230
|
onOpen={() => analytics.track('chat_opened')}
|
|
182
231
|
onClose={() => analytics.track('chat_closed')}
|
|
183
|
-
|
|
232
|
+
onMessage={(msg) => console.log('Message:', msg)}
|
|
233
|
+
onError={(err) => console.error('Chat error:', err)}
|
|
184
234
|
/>
|
|
185
235
|
```
|
|
186
236
|
|