@verba-ai/chat-sdk 1.0.5 → 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 +59 -56
- package/dist/chat-sdk.es.js +99 -83
- package/dist/chat-sdk.es.js.map +1 -1
- package/dist/chat-sdk.umd.cjs +1 -1
- package/dist/chat-sdk.umd.cjs.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/types.d.ts +2 -2
- package/package.json +53 -42
package/README.md
CHANGED
|
@@ -11,30 +11,33 @@ The SDK acts as a secure, high-performance orchestration layer that manages the
|
|
|
11
11
|
The easiest way to integrate the chat. It creates a fixed-position action button in the bottom corner of your screen that toggles the chat window.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { ChatSDK } from
|
|
14
|
+
import { ChatSDK } from '@verba-ai/chat-sdk'
|
|
15
15
|
|
|
16
16
|
const chat = new ChatSDK({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
// Required: Your unique Verba tagId
|
|
18
|
+
tagId: 'your-tag-id',
|
|
19
|
+
|
|
20
|
+
// Optional
|
|
21
|
+
theme: {
|
|
22
|
+
primaryColor: '#6366f1',
|
|
23
|
+
backgroundColor: '#080b14',
|
|
24
|
+
textColor: '#f1f5f9',
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
// You can also our default theme presets
|
|
28
|
+
// theme: 'light' | 'dark',
|
|
29
|
+
|
|
30
|
+
// Optional: Configuration for the floating bubble
|
|
31
|
+
bubble: {
|
|
32
|
+
position: 'bottom-right',
|
|
33
|
+
color: '#8b5cf6', // custom background gradient/color
|
|
34
|
+
size: 56, // size in pixels
|
|
35
|
+
icon: '<link>', // src to <img> tag
|
|
36
|
+
},
|
|
37
|
+
})
|
|
35
38
|
|
|
36
39
|
// Inject the bubble into the DOM
|
|
37
|
-
chat.init()
|
|
40
|
+
chat.init()
|
|
38
41
|
|
|
39
42
|
// Optional programmatic controls
|
|
40
43
|
// chat.show();
|
|
@@ -47,26 +50,26 @@ chat.init();
|
|
|
47
50
|
If you want to render the chat inside a specific part of your page (like a dashboard panel or a dedicated contact page).
|
|
48
51
|
|
|
49
52
|
```typescript
|
|
50
|
-
import { ChatSDK } from
|
|
53
|
+
import { ChatSDK } from '@verba-ai/chat-sdk'
|
|
51
54
|
|
|
52
55
|
// Ensure the container exists in your DOM
|
|
53
56
|
// <div id="my-chat-container" style="height: 600px;"></div>
|
|
54
57
|
|
|
55
58
|
const chat = new ChatSDK({
|
|
56
|
-
|
|
59
|
+
tagId: 'your-tag-id',
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
// Target a CSS selector or pass an HTMLElement directly
|
|
62
|
+
container: '#my-chat-container',
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
})
|
|
64
|
+
// Optional: Advanced visual theming
|
|
65
|
+
theme: {
|
|
66
|
+
primaryColor: '#6366f1',
|
|
67
|
+
backgroundColor: '#080b14',
|
|
68
|
+
textColor: '#f1f5f9',
|
|
69
|
+
},
|
|
70
|
+
})
|
|
68
71
|
|
|
69
|
-
chat.init()
|
|
72
|
+
chat.init()
|
|
70
73
|
```
|
|
71
74
|
|
|
72
75
|
### 3. Usage via CDN (UMD)
|
|
@@ -76,9 +79,9 @@ If you aren't using a bundler (Webpack/Vite/Rollup), you can load the SDK direct
|
|
|
76
79
|
```html
|
|
77
80
|
<script src="https://unpkg.com/@verba-ai/chat-sdk@latest/dist/chat-sdk.umd.cjs"></script>
|
|
78
81
|
<script>
|
|
79
|
-
|
|
82
|
+
const { ChatSDK } = window.VerbaChatSDK
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
new ChatSDK({ tagId: 'your-tag-id' }).init()
|
|
82
85
|
</script>
|
|
83
86
|
```
|
|
84
87
|
|
|
@@ -107,17 +110,17 @@ The main entry point for the widget.
|
|
|
107
110
|
|
|
108
111
|
```typescript
|
|
109
112
|
interface ChatSDKConfig {
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
/** Your Verba tag ID (Required) */
|
|
114
|
+
tagId: string
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
/** Where to mount the widget. Omit for floating bubble. */
|
|
117
|
+
container?: string | HTMLElement
|
|
115
118
|
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
/** Visual theme. String preset or detailed config. */
|
|
120
|
+
theme?: 'light' | 'dark' | ThemeConfig
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
/** Configuration for the floating bubble. */
|
|
123
|
+
bubble?: ChatBubbleConfig
|
|
121
124
|
}
|
|
122
125
|
```
|
|
123
126
|
|
|
@@ -125,20 +128,20 @@ interface ChatSDKConfig {
|
|
|
125
128
|
|
|
126
129
|
```typescript
|
|
127
130
|
interface ChatBubbleConfig {
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
/** Corner position of the floating bubble (Default: 'bottom-right') */
|
|
132
|
+
position?: 'bottom-right' | 'bottom-left'
|
|
130
133
|
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
/** Background color of the bubble (Default: '#ffffff') */
|
|
135
|
+
color?: string
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
/** Size of the bubble in pixels (Default: 56) */
|
|
138
|
+
size?: number
|
|
136
139
|
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
/** SVG string for a custom open (chat) icon */
|
|
141
|
+
icon?: string
|
|
139
142
|
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
/** Color of the close (X) icon (Default: '#ffffff') */
|
|
144
|
+
closeIconColor?: string
|
|
142
145
|
}
|
|
143
146
|
```
|
|
144
147
|
|
|
@@ -146,9 +149,9 @@ interface ChatBubbleConfig {
|
|
|
146
149
|
|
|
147
150
|
```typescript
|
|
148
151
|
interface ThemeConfig {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
primaryColor?: string
|
|
153
|
+
textColor?: string
|
|
154
|
+
backgroundColor?: string
|
|
155
|
+
fontFamily?: string
|
|
153
156
|
}
|
|
154
157
|
```
|