@vaniai/chat-ui-sdk 0.1.0
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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +193 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react.d.ts +2 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -0
- package/dist/vanilla/index.d.ts +2 -0
- package/dist/vanilla/index.d.ts.map +1 -0
- package/dist/vanilla/index.js +2 -0
- package/dist/vanilla/index.js.map +1 -0
- package/dist/vanilla.d.ts +2 -0
- package/dist/vanilla.d.ts.map +1 -0
- package/dist/vanilla.js +2 -0
- package/dist/vanilla.js.map +1 -0
- package/package.json +82 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-06-23
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of Vani AI Chat UI SDK
|
|
12
|
+
- Core client library (`@vaniai/chat-ui-core`)
|
|
13
|
+
- VaniChatClient for headless chat integration
|
|
14
|
+
- Configuration management
|
|
15
|
+
- Session storage support
|
|
16
|
+
- Markdown rendering utilities
|
|
17
|
+
- Theme customization
|
|
18
|
+
- React component library (`@vaniai/chat-ui-sdk/react`)
|
|
19
|
+
- VaniChat component with full UI
|
|
20
|
+
- Support for embedded, floating, inline, and popup modes
|
|
21
|
+
- CSS styling included
|
|
22
|
+
- TypeScript declarations
|
|
23
|
+
- Vanilla JavaScript library (`@vaniai/chat-ui-sdk/vanilla`)
|
|
24
|
+
- VaniAIChat global object
|
|
25
|
+
- No framework dependencies
|
|
26
|
+
- Works with plain HTML/JS
|
|
27
|
+
- Unified SDK with subpath exports
|
|
28
|
+
- Comprehensive documentation and examples
|
|
29
|
+
- TypeScript support with full type declarations
|
|
30
|
+
- ESM module support
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
- Multiple integration modes (floating, embedded, inline, popup)
|
|
34
|
+
- Customizable themes (light, dark, system)
|
|
35
|
+
- Session persistence
|
|
36
|
+
- Streaming message support
|
|
37
|
+
- Markdown message rendering
|
|
38
|
+
- Configurable positioning
|
|
39
|
+
- Responsive design
|
|
40
|
+
- Framework-agnostic core
|
|
41
|
+
|
|
42
|
+
[0.1.0]: https://github.com/vaniai/chat-ui/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Vani AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Vani AI Chat UI SDK
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@vaniai/chat-ui-sdk)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A comprehensive, embeddable chat UI SDK for integrating Vani AI conversations into your web applications. Supports multiple frameworks and vanilla JavaScript.
|
|
7
|
+
|
|
8
|
+
## 📦 Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @vaniai/chat-ui-sdk
|
|
12
|
+
# or
|
|
13
|
+
yarn add @vaniai/chat-ui-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 🚀 Quick Start
|
|
17
|
+
|
|
18
|
+
### React
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { VaniChat } from '@vaniai/chat-ui-sdk/react';
|
|
22
|
+
import '@vaniai/chat-ui-sdk/react/styles.css';
|
|
23
|
+
|
|
24
|
+
function App() {
|
|
25
|
+
return (
|
|
26
|
+
<VaniChat
|
|
27
|
+
agentId="your-agent-id"
|
|
28
|
+
publicApiKey="your-public-key"
|
|
29
|
+
baseUrl="https://api.vaniai.com"
|
|
30
|
+
mode="embedded"
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Vanilla JavaScript
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<!DOCTYPE html>
|
|
40
|
+
<html>
|
|
41
|
+
<head>
|
|
42
|
+
<script type="module">
|
|
43
|
+
import { VaniAIChat } from '@vaniai/chat-ui-sdk/vanilla';
|
|
44
|
+
|
|
45
|
+
VaniAIChat.init({
|
|
46
|
+
agentId: 'your-agent-id',
|
|
47
|
+
publicApiKey: 'your-public-key',
|
|
48
|
+
baseUrl: 'https://api.vaniai.com',
|
|
49
|
+
mode: 'floating'
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
</head>
|
|
53
|
+
<body>
|
|
54
|
+
<!-- Chat widget will be injected here -->
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Core API (Headless)
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { VaniChatClient } from '@vaniai/chat-ui-sdk';
|
|
63
|
+
|
|
64
|
+
const client = new VaniChatClient({
|
|
65
|
+
agentId: 'your-agent-id',
|
|
66
|
+
publicApiKey: 'your-public-key',
|
|
67
|
+
baseUrl: 'https://api.vaniai.com'
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await client.ready();
|
|
71
|
+
|
|
72
|
+
await client.streamMessage({
|
|
73
|
+
message: 'Hello!',
|
|
74
|
+
onDelta: (delta) => console.log(delta),
|
|
75
|
+
onDone: (response) => console.log('Complete:', response)
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 📚 Documentation
|
|
80
|
+
|
|
81
|
+
### Configuration Options
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
interface VaniChatConfig {
|
|
85
|
+
agentId?: string;
|
|
86
|
+
publicApiKey?: string;
|
|
87
|
+
baseUrl?: string;
|
|
88
|
+
mode?: 'floating' | 'embedded' | 'inline' | 'popup';
|
|
89
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
90
|
+
theme?: {
|
|
91
|
+
mode?: 'light' | 'dark' | 'system';
|
|
92
|
+
colors?: {
|
|
93
|
+
primary?: string;
|
|
94
|
+
background?: string;
|
|
95
|
+
surface?: string;
|
|
96
|
+
text?: string;
|
|
97
|
+
// ... more color options
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
messages?: {
|
|
101
|
+
title?: string;
|
|
102
|
+
subtitle?: string;
|
|
103
|
+
welcomeMessage?: string;
|
|
104
|
+
placeholder?: string;
|
|
105
|
+
// ... more message customization
|
|
106
|
+
};
|
|
107
|
+
onReady?: () => void;
|
|
108
|
+
onOpen?: () => void;
|
|
109
|
+
onClose?: () => void;
|
|
110
|
+
onMessage?: (message: VaniChatMessage) => void;
|
|
111
|
+
onError?: (error: Error) => void;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 🏗️ Project Structure
|
|
116
|
+
|
|
117
|
+
This is a monorepo containing three packages:
|
|
118
|
+
|
|
119
|
+
- **`@vaniai/chat-ui-core`** - Core client library and utilities
|
|
120
|
+
- **`@vaniai/chat-ui-react`** - React components
|
|
121
|
+
- **`@vaniai/chat-ui-vanilla`** - Vanilla JavaScript implementation
|
|
122
|
+
|
|
123
|
+
All packages are bundled together as `@vaniai/chat-ui-sdk` with subpath exports:
|
|
124
|
+
- `@vaniai/chat-ui-sdk` (core)
|
|
125
|
+
- `@vaniai/chat-ui-sdk/react`
|
|
126
|
+
- `@vaniai/chat-ui-sdk/vanilla`
|
|
127
|
+
|
|
128
|
+
## 🛠️ Development
|
|
129
|
+
|
|
130
|
+
### Setup
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
yarn install
|
|
134
|
+
yarn build
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Build
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Build all packages
|
|
141
|
+
yarn build
|
|
142
|
+
|
|
143
|
+
# Build individual packages
|
|
144
|
+
yarn build:packages
|
|
145
|
+
|
|
146
|
+
# Build unified SDK
|
|
147
|
+
yarn build:sdk
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Clean
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
yarn clean
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Testing
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Test imports
|
|
160
|
+
node test-sdk.mjs
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 📦 Publishing
|
|
164
|
+
|
|
165
|
+
### Individual Packages
|
|
166
|
+
|
|
167
|
+
Each package can be published separately:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
cd packages/core && npm publish
|
|
171
|
+
cd packages/react && npm publish
|
|
172
|
+
cd packages/vanilla && npm publish
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Unified SDK
|
|
176
|
+
|
|
177
|
+
To publish the unified SDK:
|
|
178
|
+
|
|
179
|
+
1. Remove `"private": true` from root `package.json`
|
|
180
|
+
2. Run `npm publish` or `yarn publish`
|
|
181
|
+
|
|
182
|
+
## 📄 License
|
|
183
|
+
|
|
184
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
185
|
+
|
|
186
|
+
## 🤝 Contributing
|
|
187
|
+
|
|
188
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
189
|
+
|
|
190
|
+
## 📧 Support
|
|
191
|
+
|
|
192
|
+
For support, email support@vaniai.com or open an issue in the repository.
|
|
193
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
package/dist/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vanilla.d.ts","sourceRoot":"","sources":["../src/vanilla.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/dist/vanilla.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vanilla.js","sourceRoot":"","sources":["../src/vanilla.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vaniai/chat-ui-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Unified SDK for Vani AI Chat UI (core, react, and vanilla) with subpath exports.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"private": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/vaniai/chat-ui"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"chat",
|
|
14
|
+
"ui",
|
|
15
|
+
"chatbot",
|
|
16
|
+
"ai",
|
|
17
|
+
"vani",
|
|
18
|
+
"react",
|
|
19
|
+
"vanilla",
|
|
20
|
+
"sdk",
|
|
21
|
+
"widget"
|
|
22
|
+
],
|
|
23
|
+
"author": "Vani AI",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/vaniai/chat-ui/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/vaniai/chat-ui#readme",
|
|
28
|
+
"workspaces": [
|
|
29
|
+
"packages/*"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"clean": "rimraf dist",
|
|
33
|
+
"build:packages": "yarn workspaces run build",
|
|
34
|
+
"build:sdk": "tsc -p tsconfig.build.json",
|
|
35
|
+
"build": "yarn build:packages && yarn build:sdk",
|
|
36
|
+
"type-check": "yarn build:packages && tsc -p tsconfig.build.json --noEmit",
|
|
37
|
+
"test": "node test-sdk.mjs",
|
|
38
|
+
"pack": "npm pack --silent",
|
|
39
|
+
"pack:tgz": "npm pack --silent --filename vaniai-chat-ui-sdk.tgz",
|
|
40
|
+
"prepublishOnly": "echo 'skip prepublishOnly (build/test handled by scripts/publish.mjs)'",
|
|
41
|
+
"publish:sdk": "yarn build && npm publish --access public",
|
|
42
|
+
"publish:packages": "yarn workspaces run npm publish --access public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=16.8"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"react": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/react": "^18.2.0",
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"rimraf": "^6.0.1",
|
|
56
|
+
"typescript": "^5.5.4"
|
|
57
|
+
},
|
|
58
|
+
"exports": {
|
|
59
|
+
".": {
|
|
60
|
+
"types": "./dist/core/index.d.ts",
|
|
61
|
+
"import": "./dist/core/index.js",
|
|
62
|
+
"default": "./dist/core/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./react": {
|
|
65
|
+
"types": "./dist/react/index.d.ts",
|
|
66
|
+
"import": "./dist/react/index.js",
|
|
67
|
+
"default": "./dist/react/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./react/styles.css": "./dist/react-internal/styles.css",
|
|
70
|
+
"./vanilla": {
|
|
71
|
+
"types": "./dist/vanilla/index.d.ts",
|
|
72
|
+
"import": "./dist/vanilla/index.js",
|
|
73
|
+
"default": "./dist/vanilla/index.js"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"files": [
|
|
77
|
+
"dist",
|
|
78
|
+
"LICENSE",
|
|
79
|
+
"README.md",
|
|
80
|
+
"CHANGELOG.md"
|
|
81
|
+
]
|
|
82
|
+
}
|