@irisidea/kalrav-ai 1.0.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/LICENSE +21 -0
- package/README.md +600 -0
- package/dist/angular.d.mts +28 -0
- package/dist/angular.d.ts +28 -0
- package/dist/angular.js +321 -0
- package/dist/angular.js.map +1 -0
- package/dist/angular.mjs +295 -0
- package/dist/angular.mjs.map +1 -0
- package/dist/index.d.mts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +175 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +147 -0
- package/dist/index.mjs.map +1 -0
- package/dist/nextjs.d.mts +10 -0
- package/dist/nextjs.d.ts +10 -0
- package/dist/nextjs.js +216 -0
- package/dist/nextjs.js.map +1 -0
- package/dist/nextjs.mjs +188 -0
- package/dist/nextjs.mjs.map +1 -0
- package/dist/react.d.mts +10 -0
- package/dist/react.d.ts +10 -0
- package/dist/react.js +205 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +177 -0
- package/dist/react.mjs.map +1 -0
- package/dist/routeye-widget.js +1 -0
- package/dist/types-coZ9jHpG.d.mts +28 -0
- package/dist/types-coZ9jHpG.d.ts +28 -0
- package/dist/vue.d.mts +57 -0
- package/dist/vue.d.ts +57 -0
- package/dist/vue.js +237 -0
- package/dist/vue.js.map +1 -0
- package/dist/vue.mjs +215 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +108 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kalrav 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,600 @@
|
|
|
1
|
+
# Kalrav AI
|
|
2
|
+
|
|
3
|
+
> **AI-powered chatbot widget for React, Next.js, Vue, and Angular**
|
|
4
|
+
|
|
5
|
+
Kalrav AI is a cross-framework chatbot widget that seamlessly integrates into your web applications. Install once, use everywhere.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/kalrav-ai)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
## ✨ Features
|
|
11
|
+
|
|
12
|
+
- 🚀 **Multi-Framework Support**: React, Next.js, Vue 3, Angular, and Vanilla JS
|
|
13
|
+
- 📦 **Tiny Bundle Size**: Optimized for performance
|
|
14
|
+
- 🎨 **Customizable**: Match your brand with custom colors
|
|
15
|
+
- 🔒 **Type-Safe**: Full TypeScript support
|
|
16
|
+
- 💛 **JavaScript First**: Works perfectly with plain JavaScript
|
|
17
|
+
- ⚡ **SSR Compatible**: Works with Next.js server-side rendering
|
|
18
|
+
- 🎯 **Zero Config**: Works out of the box
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install kalrav-ai
|
|
24
|
+
# or
|
|
25
|
+
yarn add kalrav-ai
|
|
26
|
+
# or
|
|
27
|
+
pnpm add kalrav-ai
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Works with both JavaScript and TypeScript!** All examples below work in `.js`, `.jsx`, `.ts`, and `.tsx` files.
|
|
31
|
+
|
|
32
|
+
## 🎯 How It Works
|
|
33
|
+
|
|
34
|
+
**Only 2 required props**: `apiKey` and `agentId`
|
|
35
|
+
|
|
36
|
+
Everything else is automatically fetched from your agent's dashboard configuration:
|
|
37
|
+
- ✅ Agent name and logo
|
|
38
|
+
- ✅ Custom colors (layout, user input, bot response, icons, fonts)
|
|
39
|
+
- ✅ Default questions and placeholder text
|
|
40
|
+
- ✅ Feature toggles (file uploads, audio recording, text-to-speech, download chat)
|
|
41
|
+
- ✅ Language settings
|
|
42
|
+
- ✅ Feedback questions
|
|
43
|
+
|
|
44
|
+
The widget automatically calls:
|
|
45
|
+
```
|
|
46
|
+
https://kalrav-central-system-api.kalrav.ai/api/agent-ui/{agentId}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
### React
|
|
52
|
+
|
|
53
|
+
**TypeScript:**
|
|
54
|
+
```tsx
|
|
55
|
+
import { KalravWidget } from 'kalrav-ai/react';
|
|
56
|
+
|
|
57
|
+
function App() {
|
|
58
|
+
return (
|
|
59
|
+
<div>
|
|
60
|
+
<h1>My App</h1>
|
|
61
|
+
<KalravWidget
|
|
62
|
+
apiKey="your-api-key"
|
|
63
|
+
agentId="your-agent-id"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**JavaScript:**
|
|
71
|
+
```jsx
|
|
72
|
+
import { KalravWidget } from 'kalrav-ai/react';
|
|
73
|
+
|
|
74
|
+
function App() {
|
|
75
|
+
return (
|
|
76
|
+
<div>
|
|
77
|
+
<h1>My App</h1>
|
|
78
|
+
<KalravWidget
|
|
79
|
+
apiKey="your-api-key"
|
|
80
|
+
agentId="your-agent-id"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Programmatic Control:**
|
|
88
|
+
|
|
89
|
+
```jsx
|
|
90
|
+
import { useKalrav } from 'kalrav-ai/react';
|
|
91
|
+
|
|
92
|
+
function ChatButton() {
|
|
93
|
+
const kalrav = useKalrav({
|
|
94
|
+
apiKey: 'your-api-key',
|
|
95
|
+
agentId: 'your-agent-id',
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<button onClick={() => kalrav?.open()}>
|
|
100
|
+
Open Chat
|
|
101
|
+
</button>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Next.js
|
|
109
|
+
|
|
110
|
+
**App Router** (`app/layout.js` or `app/layout.tsx`):
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
import { KalravWidget } from 'kalrav-ai/nextjs';
|
|
114
|
+
|
|
115
|
+
export default function RootLayout({ children }) {
|
|
116
|
+
return (
|
|
117
|
+
<html lang="en">
|
|
118
|
+
<body>
|
|
119
|
+
{children}
|
|
120
|
+
<KalravWidget
|
|
121
|
+
apiKey="your-api-key"
|
|
122
|
+
agentId="your-agent-id"
|
|
123
|
+
/>
|
|
124
|
+
</body>
|
|
125
|
+
</html>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Pages Router** (`pages/_app.js` or `pages/_app.tsx`):
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { KalravWidget } from 'kalrav-ai/nextjs';
|
|
134
|
+
|
|
135
|
+
function MyApp({ Component, pageProps }) {
|
|
136
|
+
return (
|
|
137
|
+
<>
|
|
138
|
+
<Component {...pageProps} />
|
|
139
|
+
<KalravWidget
|
|
140
|
+
apiKey="your-api-key"
|
|
141
|
+
agentId="your-agent-id"
|
|
142
|
+
/>
|
|
143
|
+
</>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Programmatic Control:**
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
'use client';
|
|
152
|
+
|
|
153
|
+
import { useKalrav } from 'kalrav-ai/nextjs';
|
|
154
|
+
|
|
155
|
+
function ChatButton() {
|
|
156
|
+
const kalrav = useKalrav({
|
|
157
|
+
apiKey: 'your-api-key',
|
|
158
|
+
agentId: 'your-agent-id',
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<button onClick={() => kalrav?.open()}>
|
|
163
|
+
Open Chat
|
|
164
|
+
</button>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### Vue 3
|
|
172
|
+
|
|
173
|
+
```vue
|
|
174
|
+
<template>
|
|
175
|
+
<div>
|
|
176
|
+
<h1>My App</h1>
|
|
177
|
+
<KalravWidget
|
|
178
|
+
api-key="your-api-key"
|
|
179
|
+
agent-id="your-agent-id"
|
|
180
|
+
primary-color="#4F46E5"
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
</template>
|
|
184
|
+
|
|
185
|
+
<script setup>
|
|
186
|
+
import { KalravWidget } from 'kalrav-ai/vue';
|
|
187
|
+
</script>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Programmatic Control:**
|
|
191
|
+
|
|
192
|
+
```vue
|
|
193
|
+
<template>
|
|
194
|
+
<button @click="kalrav?.open()">
|
|
195
|
+
Open Chat
|
|
196
|
+
</button>
|
|
197
|
+
</template>
|
|
198
|
+
|
|
199
|
+
<script setup>
|
|
200
|
+
import { useKalrav } from 'kalrav-ai/vue';
|
|
201
|
+
|
|
202
|
+
const kalrav = useKalrav({
|
|
203
|
+
apiKey: 'your-api-key',
|
|
204
|
+
agentId: 'your-agent-id',
|
|
205
|
+
});
|
|
206
|
+
</script>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### Angular
|
|
212
|
+
|
|
213
|
+
**Module Import** (`app.module.ts`):
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import { NgModule } from '@angular/core';
|
|
217
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
218
|
+
import { KalravModule } from 'kalrav-ai/angular';
|
|
219
|
+
import { AppComponent } from './app.component';
|
|
220
|
+
|
|
221
|
+
@NgModule({
|
|
222
|
+
declarations: [AppComponent],
|
|
223
|
+
imports: [
|
|
224
|
+
BrowserModule,
|
|
225
|
+
KalravModule
|
|
226
|
+
],
|
|
227
|
+
bootstrap: [AppComponent]
|
|
228
|
+
})
|
|
229
|
+
export class AppModule {}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Component Usage** (`app.component.ts`):
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
import { Component } from '@angular/core';
|
|
236
|
+
|
|
237
|
+
@Component({
|
|
238
|
+
selector: 'app-root',
|
|
239
|
+
template: `
|
|
240
|
+
<h1>My App</h1>
|
|
241
|
+
<kalrav-widget
|
|
242
|
+
[apiKey]="'your-api-key'"
|
|
243
|
+
[agentId]="'your-agent-id'"
|
|
244
|
+
[primaryColor]="'#4F46E5'">
|
|
245
|
+
</kalrav-widget>
|
|
246
|
+
`
|
|
247
|
+
})
|
|
248
|
+
export class AppComponent {}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Programmatic Control with Service:**
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { Component } from '@angular/core';
|
|
255
|
+
import { KalravService } from 'kalrav-ai/angular';
|
|
256
|
+
|
|
257
|
+
@Component({
|
|
258
|
+
selector: 'app-chat-button',
|
|
259
|
+
template: '<button (click)="openChat()">Open Chat</button>'
|
|
260
|
+
})
|
|
261
|
+
export class ChatButtonComponent {
|
|
262
|
+
constructor(private kalrav: KalravService) {
|
|
263
|
+
// Initialize the service
|
|
264
|
+
this.kalrav.initialize({
|
|
265
|
+
apiKey: 'your-api-key',
|
|
266
|
+
agentId: 'your-agent-id'
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
openChat() {
|
|
271
|
+
this.kalrav.open();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
### Vanilla JavaScript
|
|
279
|
+
|
|
280
|
+
**No framework? No problem!** Use it in any HTML page:
|
|
281
|
+
|
|
282
|
+
```html
|
|
283
|
+
<!DOCTYPE html>
|
|
284
|
+
<html>
|
|
285
|
+
<head>
|
|
286
|
+
<title>My Site</title>
|
|
287
|
+
</head>
|
|
288
|
+
<body>
|
|
289
|
+
<h1>Welcome</h1>
|
|
290
|
+
<button id="chatBtn">Chat with us</button>
|
|
291
|
+
|
|
292
|
+
<script type="module">
|
|
293
|
+
import { createKalrav } from 'https://cdn.jsdelivr.net/npm/kalrav-ai@latest/dist/index.mjs';
|
|
294
|
+
|
|
295
|
+
const kalrav = createKalrav({
|
|
296
|
+
apiKey: 'your-api-key',
|
|
297
|
+
agentId: 'your-agent-id',
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
document.getElementById('chatBtn').onclick = () => kalrav.open();
|
|
301
|
+
</script>
|
|
302
|
+
</body>
|
|
303
|
+
</html>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**With npm/bundler:**
|
|
307
|
+
```javascript
|
|
308
|
+
import { createKalrav } from 'kalrav-ai';
|
|
309
|
+
|
|
310
|
+
const kalrav = createKalrav({
|
|
311
|
+
apiKey: 'your-api-key',
|
|
312
|
+
agentId: 'your-agent-id',
|
|
313
|
+
primaryColor: '#4F46E5',
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
kalrav.open();
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
📖 **[See full Vanilla JS guide](examples/vanilla-js-example.md)** for CDN, module, and script tag examples.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## ⚙️ Configuration Options
|
|
324
|
+
|
|
325
|
+
| Option | Type | Required | Default | Description |
|
|
326
|
+
|--------|------|----------|---------|-------------|
|
|
327
|
+
| `apiKey` | `string` | ✅ Yes | - | Your Kalrav API key |
|
|
328
|
+
| `agentId` | `string` | ✅ Yes | - | Your agent/bot ID |
|
|
329
|
+
| `primaryColor` | `string` | No | `#4F46E5` | Primary color for the widget |
|
|
330
|
+
| `autoLoad` | `boolean` | No | `true` | Auto-load widget on mount |
|
|
331
|
+
| `widgetUrl` | `string` | No | `https://widget.kalrav.ai/routeye-widget.js` | Custom widget script URL |
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## 🎯 API Methods
|
|
336
|
+
|
|
337
|
+
All widget instances expose the following methods:
|
|
338
|
+
|
|
339
|
+
### `load(): Promise<void>`
|
|
340
|
+
Manually load the widget script.
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
await kalrav.load();
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### `unload(): void`
|
|
347
|
+
Remove the widget from the page.
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
kalrav.unload();
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### `open(): void`
|
|
354
|
+
Open the chat widget.
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
kalrav.open();
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### `close(): void`
|
|
361
|
+
Close the chat widget.
|
|
362
|
+
|
|
363
|
+
```typescript
|
|
364
|
+
kalrav.close();
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### `isLoaded(): boolean`
|
|
368
|
+
Check if the widget is loaded.
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
if (kalrav.isLoaded()) {
|
|
372
|
+
console.log('Widget is ready!');
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### `call(method: string, ...args: any[]): void`
|
|
377
|
+
Call custom widget methods.
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
kalrav.call('customMethod', arg1, arg2);
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## 🔧 Advanced Usage
|
|
386
|
+
|
|
387
|
+
### Vanilla JavaScript/TypeScript
|
|
388
|
+
|
|
389
|
+
You can also use the core library without any framework. Perfect for static sites, legacy apps, or projects without build tools!
|
|
390
|
+
|
|
391
|
+
**JavaScript:**
|
|
392
|
+
```javascript
|
|
393
|
+
import { createKalrav } from 'kalrav-ai';
|
|
394
|
+
|
|
395
|
+
const kalrav = createKalrav({
|
|
396
|
+
apiKey: 'your-api-key',
|
|
397
|
+
agentId: 'your-agent-id',
|
|
398
|
+
primaryColor: '#4F46E5',
|
|
399
|
+
autoLoad: true
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// Control the widget
|
|
403
|
+
kalrav.open();
|
|
404
|
+
kalrav.close();
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**TypeScript:**
|
|
408
|
+
```typescript
|
|
409
|
+
import { createKalrav } from 'kalrav-ai';
|
|
410
|
+
import type { KalravConfig } from 'kalrav-ai';
|
|
411
|
+
|
|
412
|
+
const config: KalravConfig = {
|
|
413
|
+
apiKey: 'your-api-key',
|
|
414
|
+
agentId: 'your-agent-id',
|
|
415
|
+
primaryColor: '#4F46E5',
|
|
416
|
+
autoLoad: true
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
const kalrav = createKalrav(config);
|
|
420
|
+
|
|
421
|
+
// Control the widget
|
|
422
|
+
kalrav.open();
|
|
423
|
+
kalrav.close();
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Custom Widget URL
|
|
427
|
+
|
|
428
|
+
If you're self-hosting the widget script:
|
|
429
|
+
|
|
430
|
+
```tsx
|
|
431
|
+
<KalravWidget
|
|
432
|
+
apiKey="your-api-key"
|
|
433
|
+
agentId="your-agent-id"
|
|
434
|
+
widgetUrl="https://your-domain.com/widget.js"
|
|
435
|
+
/>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Lazy Loading
|
|
439
|
+
|
|
440
|
+
Disable auto-load and manually control when to load:
|
|
441
|
+
|
|
442
|
+
```tsx
|
|
443
|
+
const kalrav = useKalrav({
|
|
444
|
+
apiKey: 'your-api-key',
|
|
445
|
+
agentId: 'your-agent-id',
|
|
446
|
+
autoLoad: false
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
// Load later
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
kalrav?.load();
|
|
452
|
+
}, [someCondition]);
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## 🔐 Environment Variables
|
|
458
|
+
|
|
459
|
+
For better security, store credentials in environment variables:
|
|
460
|
+
|
|
461
|
+
**React / Next.js**
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
# .env.local
|
|
465
|
+
NEXT_PUBLIC_KALRAV_API_KEY=your-api-key
|
|
466
|
+
NEXT_PUBLIC_KALRAV_AGENT_ID=your-agent-id
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
```tsx
|
|
470
|
+
<KalravWidget
|
|
471
|
+
apiKey={process.env.NEXT_PUBLIC_KALRAV_API_KEY!}
|
|
472
|
+
agentId={process.env.NEXT_PUBLIC_KALRAV_AGENT_ID!}
|
|
473
|
+
/>
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
**Vue / Vite**
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# .env
|
|
480
|
+
VITE_KALRAV_API_KEY=your-api-key
|
|
481
|
+
VITE_KALRAV_AGENT_ID=your-agent-id
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
```vue
|
|
485
|
+
<KalravWidget
|
|
486
|
+
:api-key="import.meta.env.VITE_KALRAV_API_KEY"
|
|
487
|
+
:agent-id="import.meta.env.VITE_KALRAV_AGENT_ID"
|
|
488
|
+
/>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## 📝 TypeScript Support
|
|
494
|
+
|
|
495
|
+
Kalrav AI is written in TypeScript and provides full type definitions out of the box.
|
|
496
|
+
|
|
497
|
+
```typescript
|
|
498
|
+
import type { KalravConfig, KalravWidget } from 'kalrav-ai/react';
|
|
499
|
+
|
|
500
|
+
const config: KalravConfig = {
|
|
501
|
+
apiKey: 'your-api-key',
|
|
502
|
+
agentId: 'your-agent-id',
|
|
503
|
+
primaryColor: '#4F46E5'
|
|
504
|
+
};
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
## 🌐 Browser Support
|
|
510
|
+
|
|
511
|
+
- Chrome (latest)
|
|
512
|
+
- Firefox (latest)
|
|
513
|
+
- Safari (latest)
|
|
514
|
+
- Edge (latest)
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## 🛠️ Local Development
|
|
519
|
+
|
|
520
|
+
### Testing with npm link
|
|
521
|
+
|
|
522
|
+
When developing the library locally:
|
|
523
|
+
|
|
524
|
+
1. **Link the library:**
|
|
525
|
+
```bash
|
|
526
|
+
cd agent-widget-js
|
|
527
|
+
npm run build
|
|
528
|
+
npm link
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
2. **Link in your test project:**
|
|
532
|
+
```bash
|
|
533
|
+
cd your-test-app
|
|
534
|
+
npm link kalrav-ai
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
3. **Use local Docker widget URL:**
|
|
538
|
+
```tsx
|
|
539
|
+
<KalravWidget
|
|
540
|
+
apiKey="your-api-key"
|
|
541
|
+
agentId="your-agent-id"
|
|
542
|
+
widgetUrl="http://localhost:9090/routeye-widget.js" // Point to local Docker
|
|
543
|
+
/>
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Running Local Docker Widget
|
|
547
|
+
|
|
548
|
+
Build and run the widget locally for testing:
|
|
549
|
+
|
|
550
|
+
```bash
|
|
551
|
+
# Build Docker image
|
|
552
|
+
docker-compose build
|
|
553
|
+
|
|
554
|
+
# Start container
|
|
555
|
+
docker-compose up -d
|
|
556
|
+
|
|
557
|
+
# Widget available at: http://localhost:9090/routeye-widget.js
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Test it:
|
|
561
|
+
```bash
|
|
562
|
+
# Open test HTML file
|
|
563
|
+
open test-local-docker.html
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Build Commands
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
# Install dependencies
|
|
570
|
+
npm install
|
|
571
|
+
|
|
572
|
+
# Build both npm package and widget bundle
|
|
573
|
+
npm run build
|
|
574
|
+
|
|
575
|
+
# Watch mode (npm package only)
|
|
576
|
+
npm run dev
|
|
577
|
+
|
|
578
|
+
# Build widget bundle only
|
|
579
|
+
npm run build:widget
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## 📄 License
|
|
585
|
+
|
|
586
|
+
MIT © [Kalrav AI](https://kalrav.ai)
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## 🤝 Support
|
|
591
|
+
|
|
592
|
+
- 📧 Email: support@kalrav.ai
|
|
593
|
+
- 🌐 Website: [kalrav.ai](https://kalrav.ai)
|
|
594
|
+
- 📚 Documentation: [docs.kalrav.ai](https://docs.kalrav.ai)
|
|
595
|
+
|
|
596
|
+
---
|
|
597
|
+
|
|
598
|
+
## 🎉 Credits
|
|
599
|
+
|
|
600
|
+
Made with ❤️ by the Kalrav AI team
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { a as KalravConfig, K as KalravWidget$1 } from './types-coZ9jHpG.mjs';
|
|
3
|
+
|
|
4
|
+
declare class KalravModule {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare class KalravWidget implements OnInit, OnDestroy {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
agentId: string;
|
|
10
|
+
primaryColor: string;
|
|
11
|
+
autoLoad: boolean;
|
|
12
|
+
widgetUrl: string;
|
|
13
|
+
private kalravInstance;
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class KalravService {
|
|
19
|
+
private kalravInstance;
|
|
20
|
+
initialize(config: KalravConfig): void;
|
|
21
|
+
getWidget(): KalravWidget$1 | null;
|
|
22
|
+
open(): void;
|
|
23
|
+
close(): void;
|
|
24
|
+
isLoaded(): boolean;
|
|
25
|
+
unload(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { KalravConfig, KalravModule, KalravService, KalravWidget, KalravWidget$1 as KalravWidgetInstance };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { a as KalravConfig, K as KalravWidget$1 } from './types-coZ9jHpG.js';
|
|
3
|
+
|
|
4
|
+
declare class KalravModule {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare class KalravWidget implements OnInit, OnDestroy {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
agentId: string;
|
|
10
|
+
primaryColor: string;
|
|
11
|
+
autoLoad: boolean;
|
|
12
|
+
widgetUrl: string;
|
|
13
|
+
private kalravInstance;
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare class KalravService {
|
|
19
|
+
private kalravInstance;
|
|
20
|
+
initialize(config: KalravConfig): void;
|
|
21
|
+
getWidget(): KalravWidget$1 | null;
|
|
22
|
+
open(): void;
|
|
23
|
+
close(): void;
|
|
24
|
+
isLoaded(): boolean;
|
|
25
|
+
unload(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { KalravConfig, KalravModule, KalravService, KalravWidget, KalravWidget$1 as KalravWidgetInstance };
|