@cas0570/chat-widget 0.0.1 → 0.0.3
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 +6 -12
- package/dist/geoapps-chat-widget.js +288 -341
- package/dist/geoapps-chat-widget.umd.cjs +16 -16
- package/dist/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/package.json +79 -80
- package/dist/embed.d.ts +0 -17
package/README.md
CHANGED
|
@@ -29,7 +29,6 @@ npm install @geoapps/chat-widget
|
|
|
29
29
|
|
|
30
30
|
```tsx
|
|
31
31
|
import { ChatWidget } from '@geoapps/chat-widget'
|
|
32
|
-
import '@geoapps/chat-widget/style.css'
|
|
33
32
|
|
|
34
33
|
function App() {
|
|
35
34
|
return (
|
|
@@ -52,7 +51,6 @@ function App() {
|
|
|
52
51
|
| 🎨 **Customizable** | Full control over colors, text, positioning |
|
|
53
52
|
| 📱 **Responsive** | Works on desktop and mobile |
|
|
54
53
|
| ♿ **Accessible** | WCAG compliant with keyboard navigation |
|
|
55
|
-
| 🌐 **Framework Agnostic** | Works with any frontend via script tag |
|
|
56
54
|
|
|
57
55
|
---
|
|
58
56
|
|
|
@@ -76,7 +74,6 @@ pnpm add @geoapps/chat-widget
|
|
|
76
74
|
|
|
77
75
|
```tsx
|
|
78
76
|
import { ChatWidget } from '@geoapps/chat-widget'
|
|
79
|
-
import '@geoapps/chat-widget/style.css'
|
|
80
77
|
|
|
81
78
|
function App() {
|
|
82
79
|
return (
|
|
@@ -104,7 +101,6 @@ function App() {
|
|
|
104
101
|
|
|
105
102
|
<script setup>
|
|
106
103
|
import { ChatWidget } from '@geoapps/chat-widget'
|
|
107
|
-
import '@geoapps/chat-widget/style.css'
|
|
108
104
|
</script>
|
|
109
105
|
```
|
|
110
106
|
|
|
@@ -114,7 +110,6 @@ import '@geoapps/chat-widget/style.css'
|
|
|
114
110
|
'use client'
|
|
115
111
|
|
|
116
112
|
import dynamic from 'next/dynamic'
|
|
117
|
-
import '@geoapps/chat-widget/style.css'
|
|
118
113
|
|
|
119
114
|
const ChatWidget = dynamic(
|
|
120
115
|
() => import('@geoapps/chat-widget').then(mod => mod.ChatWidget),
|
|
@@ -139,7 +134,7 @@ export default function Page() {
|
|
|
139
134
|
| `title` | `string` | `"Chat"` | Dialog header title |
|
|
140
135
|
| `subtitle` | `string` | `""` | Dialog header subtitle |
|
|
141
136
|
| `placeholder` | `string` | `"Typ een bericht..."` | Input placeholder text |
|
|
142
|
-
| `greeting` | `string` | `""` | Initial
|
|
137
|
+
| `greeting` | `string` | `""` | Initial bot message |
|
|
143
138
|
| `primaryColor` | `string` | `"#3b82f6"` | Main accent color (hex) or var() |
|
|
144
139
|
| `position` | `Position` | `"bottom-right"` | Widget position |
|
|
145
140
|
| `defaultOpen` | `boolean` | `false` | Default open state |
|
|
@@ -170,8 +165,8 @@ export default function Page() {
|
|
|
170
165
|
| ------ | ------ | ------------- |
|
|
171
166
|
| `onOpen` | `() => void` | Called when chat dialog opens |
|
|
172
167
|
| `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
|
|
168
|
+
| `onMessageSent` | `(message: string) => void` | Called when a message is sent |
|
|
169
|
+
| `onResponseReceived` | `(response: string) => void` | Called when a message is received |
|
|
175
170
|
|
|
176
171
|
### Example with Callbacks
|
|
177
172
|
|
|
@@ -180,7 +175,8 @@ export default function Page() {
|
|
|
180
175
|
apiUrl="https://api.geoapps.nl/api/v1/chat"
|
|
181
176
|
onOpen={() => analytics.track('chat_opened')}
|
|
182
177
|
onClose={() => analytics.track('chat_closed')}
|
|
183
|
-
|
|
178
|
+
onMessage={(msg) => console.log('Message:', msg)}
|
|
179
|
+
onError={(err) => console.error('Chat error:', err)}
|
|
184
180
|
/>
|
|
185
181
|
```
|
|
186
182
|
|
|
@@ -244,7 +240,6 @@ import { ChatWidget, ChatBubble } from '@geoapps/chat-widget'
|
|
|
244
240
|
geoapps-chat-widget/
|
|
245
241
|
├── src/
|
|
246
242
|
│ ├── index.ts # Package exports
|
|
247
|
-
│ ├── embed.ts # IIFE entry for script tag
|
|
248
243
|
│ ├── components/
|
|
249
244
|
│ │ ├── ChatWidget.tsx # Main widget component
|
|
250
245
|
│ │ ├── ChatBubble.tsx # Floating button
|
|
@@ -264,7 +259,6 @@ geoapps-chat-widget/
|
|
|
264
259
|
├── dist/ # Built files
|
|
265
260
|
│ ├── index.js # ESM bundle
|
|
266
261
|
│ ├── index.cjs # CommonJS bundle
|
|
267
|
-
│ ├── embed.iife.js # Script tag bundle
|
|
268
262
|
│ └── style.css # Styles
|
|
269
263
|
├── package.json
|
|
270
264
|
├── tsconfig.json
|
|
@@ -339,7 +333,7 @@ npm publish --access public
|
|
|
339
333
|
| Widget not appearing | Check z-index conflicts |
|
|
340
334
|
| CORS errors | Ensure API allows your domain in CORS_ORIGINS |
|
|
341
335
|
| Messages not sending | Verify apiUrl is correct and API is running |
|
|
342
|
-
| Styles not loading |
|
|
336
|
+
| Styles not loading | CSS is auto-included; check bundler CSS support |
|
|
343
337
|
| SSR errors (Next.js) | Use dynamic import with `ssr: false` |
|
|
344
338
|
|
|
345
339
|
---
|