@cliniq360/eigi-chat 0.1.0 → 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/README.md +496 -104
- package/dist/eigi-chat.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,60 +1,100 @@
|
|
|
1
|
-
# @eigi
|
|
1
|
+
# @cliniq360/eigi-chat
|
|
2
2
|
|
|
3
|
-
Embeddable AI chat dialog with voice and text capabilities. A standalone, lightweight
|
|
3
|
+
Embeddable AI chat dialog with voice and text capabilities. A standalone, lightweight web component for adding AI-powered conversations to any website.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
6
9
|
|
|
7
10
|
- 🎯 **Full-screen Dialog** - Clean modal interface with Welcome, Chat, and Talk screens
|
|
8
|
-
- 💬 **Text Chat** - Real-time chat with streaming responses
|
|
11
|
+
- 💬 **Text Chat** - Real-time chat with streaming AI responses
|
|
9
12
|
- 🎤 **Voice Calls** - Live voice conversations powered by Pipecat + Daily
|
|
10
13
|
- 🎨 **Themeable** - Automatically applies your agent's theme configuration
|
|
11
14
|
- 🔒 **CSS Isolated** - Uses Shadow DOM to prevent style conflicts with host page
|
|
12
15
|
- 📦 **Self-contained** - Single script bundle, no external dependencies at runtime
|
|
16
|
+
- 🌐 **Universal** - Works on any website, CMS, or no-code platform
|
|
17
|
+
|
|
18
|
+
---
|
|
13
19
|
|
|
14
|
-
## Installation
|
|
20
|
+
## 📦 Installation
|
|
15
21
|
|
|
16
22
|
### Via CDN (Recommended)
|
|
17
23
|
|
|
18
24
|
```html
|
|
19
|
-
<!-- Add the widget element -->
|
|
20
25
|
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
21
|
-
|
|
22
|
-
<!-- Load the script -->
|
|
23
|
-
<script src="https://unpkg.com/@eigi/chat@latest/dist/eigi-chat.js"></script>
|
|
26
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
### Via NPM
|
|
27
30
|
|
|
28
31
|
```bash
|
|
29
|
-
npm install @eigi
|
|
32
|
+
npm install @cliniq360/eigi-chat
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import '@cliniq360/eigi-chat';
|
|
30
37
|
```
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
---
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
## 🚀 Quick Start
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
### Basic HTML Usage
|
|
37
44
|
|
|
38
45
|
```html
|
|
39
46
|
<!DOCTYPE html>
|
|
40
47
|
<html>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
<body>
|
|
49
|
+
<button onclick="window.EigiChat.open()">Chat with AI</button>
|
|
50
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
51
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
54
|
+
```
|
|
44
55
|
|
|
45
|
-
|
|
46
|
-
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
56
|
+
### Auto-Initialize from Script Tag
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
```html
|
|
59
|
+
<script
|
|
60
|
+
src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"
|
|
61
|
+
data-agent-id="YOUR_AGENT_ID"
|
|
62
|
+
data-metadata='{"userId": "123", "sessionId": "abc"}'
|
|
63
|
+
></script>
|
|
52
64
|
```
|
|
53
65
|
|
|
54
|
-
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 📖 Global JavaScript API (window.EigiChat)
|
|
69
|
+
|
|
70
|
+
The widget exposes a global `window.EigiChat` object with the following methods:
|
|
71
|
+
|
|
72
|
+
### Core Methods
|
|
73
|
+
|
|
74
|
+
| Method | Description | Returns |
|
|
75
|
+
|--------|-------------|---------|
|
|
76
|
+
| `open()` | Opens the dialog to the Welcome screen | `void` |
|
|
77
|
+
| `close()` | Closes the dialog | `void` |
|
|
78
|
+
| `toggle()` | Toggles the dialog open/close | `void` |
|
|
79
|
+
| `isOpen()` | Checks if the dialog is currently open | `boolean` |
|
|
80
|
+
|
|
81
|
+
### Direct Screen Access
|
|
82
|
+
|
|
83
|
+
| Method | Description | Returns |
|
|
84
|
+
|--------|-------------|---------|
|
|
85
|
+
| `openChat()` | Opens directly to Chat screen (text mode) | `void` |
|
|
86
|
+
| `openTalk()` | Opens directly to Talk screen (voice mode) | `void` |
|
|
87
|
+
|
|
88
|
+
### Initialization
|
|
89
|
+
|
|
90
|
+
| Method | Description | Returns |
|
|
91
|
+
|--------|-------------|---------|
|
|
92
|
+
| `init({ agentId, metadata })` | Initialize with agent ID and optional metadata | `void` |
|
|
93
|
+
|
|
94
|
+
### Example Usage
|
|
55
95
|
|
|
56
96
|
```javascript
|
|
57
|
-
// Open the dialog
|
|
97
|
+
// Open the chat dialog
|
|
58
98
|
window.EigiChat.open();
|
|
59
99
|
|
|
60
100
|
// Close the dialog
|
|
@@ -63,143 +103,495 @@ window.EigiChat.close();
|
|
|
63
103
|
// Toggle open/close
|
|
64
104
|
window.EigiChat.toggle();
|
|
65
105
|
|
|
66
|
-
// Check if
|
|
67
|
-
|
|
106
|
+
// Check if open
|
|
107
|
+
if (window.EigiChat.isOpen()) {
|
|
108
|
+
console.log('Chat is open');
|
|
109
|
+
}
|
|
68
110
|
|
|
69
|
-
//
|
|
111
|
+
// Skip welcome screen and go directly to chat
|
|
70
112
|
window.EigiChat.openChat();
|
|
71
113
|
|
|
72
|
-
//
|
|
114
|
+
// Skip welcome screen and start a voice call
|
|
73
115
|
window.EigiChat.openTalk();
|
|
74
116
|
|
|
75
|
-
// Initialize
|
|
117
|
+
// Initialize programmatically (creates element if needed)
|
|
76
118
|
window.EigiChat.init({
|
|
77
|
-
agentId:
|
|
119
|
+
agentId: 'YOUR_AGENT_ID',
|
|
78
120
|
metadata: {
|
|
79
|
-
userId:
|
|
80
|
-
sessionId:
|
|
81
|
-
|
|
121
|
+
userId: '12345',
|
|
122
|
+
sessionId: 'session-abc',
|
|
123
|
+
customField: 'any data you need'
|
|
124
|
+
}
|
|
82
125
|
});
|
|
83
126
|
```
|
|
84
127
|
|
|
85
|
-
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🏷️ HTML Element Attributes
|
|
131
|
+
|
|
132
|
+
### <eigi-chat> Element
|
|
133
|
+
|
|
134
|
+
| Attribute | Type | Required | Description |
|
|
135
|
+
|-----------|------|----------|-------------|
|
|
136
|
+
| `agent-id` | string | Yes | Your Eigi agent ID |
|
|
137
|
+
| `metadata` | JSON string | No | Additional metadata to send with messages |
|
|
138
|
+
| `action` | string | No | Trigger actions via attributes (for platforms that can't call JS) |
|
|
86
139
|
|
|
87
|
-
|
|
140
|
+
### Action Attribute Values
|
|
141
|
+
|
|
142
|
+
For platforms like Wix that can't directly call JavaScript methods, you can use the `action` attribute:
|
|
143
|
+
|
|
144
|
+
| Action Value | Effect |
|
|
145
|
+
|--------------|--------|
|
|
146
|
+
| `open` | Opens the dialog |
|
|
147
|
+
| `close` | Closes the dialog |
|
|
148
|
+
| `toggle` | Toggles the dialog |
|
|
149
|
+
| `openChat` | Opens directly to chat screen |
|
|
150
|
+
| `openTalk` | Opens directly to voice call screen |
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
// Example: Setting action via JavaScript
|
|
154
|
+
document.querySelector('eigi-chat').setAttribute('action', 'open');
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 🎨 Dialog Screens
|
|
160
|
+
|
|
161
|
+
### Welcome Screen
|
|
162
|
+
Shows the agent's avatar, name, and two call-to-action buttons:
|
|
163
|
+
- **Talk** - Start a voice conversation
|
|
164
|
+
- **Chat** - Start a text conversation
|
|
165
|
+
|
|
166
|
+
### Chat Screen
|
|
167
|
+
Text-based chat interface with:
|
|
168
|
+
- Message bubbles (user on right, agent on left)
|
|
169
|
+
- Text input with send button
|
|
170
|
+
- Switch to voice button in header
|
|
171
|
+
- Streaming responses
|
|
172
|
+
|
|
173
|
+
### Talk Screen
|
|
174
|
+
Voice call interface with:
|
|
175
|
+
- Agent avatar with connection status indicator
|
|
176
|
+
- Real-time transcripts (if enabled)
|
|
177
|
+
- Mute/unmute button
|
|
178
|
+
- End call button
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 🔌 Integration Examples
|
|
183
|
+
|
|
184
|
+
### Vanilla JavaScript
|
|
88
185
|
|
|
89
186
|
```html
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
187
|
+
<!DOCTYPE html>
|
|
188
|
+
<html>
|
|
189
|
+
<head>
|
|
190
|
+
<title>My Website</title>
|
|
191
|
+
</head>
|
|
192
|
+
<body>
|
|
193
|
+
<button id="chat-btn" style="
|
|
194
|
+
position: fixed;
|
|
195
|
+
bottom: 20px;
|
|
196
|
+
right: 20px;
|
|
197
|
+
padding: 16px 24px;
|
|
198
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
199
|
+
color: white;
|
|
200
|
+
border: none;
|
|
201
|
+
border-radius: 50px;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
font-size: 16px;
|
|
204
|
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
|
205
|
+
">
|
|
206
|
+
💬 Chat with Us
|
|
207
|
+
</button>
|
|
208
|
+
|
|
209
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
210
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
211
|
+
|
|
212
|
+
<script>
|
|
213
|
+
document.getElementById('chat-btn').addEventListener('click', function() {
|
|
214
|
+
window.EigiChat.open();
|
|
215
|
+
});
|
|
216
|
+
</script>
|
|
217
|
+
</body>
|
|
218
|
+
</html>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### React
|
|
222
|
+
|
|
223
|
+
```jsx
|
|
224
|
+
import { useEffect } from 'react';
|
|
225
|
+
|
|
226
|
+
function App() {
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
const script = document.createElement('script');
|
|
229
|
+
script.src = 'https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js'\;
|
|
230
|
+
document.body.appendChild(script);
|
|
231
|
+
|
|
232
|
+
const chat = document.createElement('eigi-chat');
|
|
233
|
+
chat.setAttribute('agent-id', 'YOUR_AGENT_ID');
|
|
234
|
+
document.body.appendChild(chat);
|
|
235
|
+
|
|
236
|
+
return () => {
|
|
237
|
+
script.remove();
|
|
238
|
+
chat.remove();
|
|
239
|
+
};
|
|
240
|
+
}, []);
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<button onClick={() => window.EigiChat?.open()}>
|
|
244
|
+
Open Chat
|
|
245
|
+
</button>
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Vue.js
|
|
251
|
+
|
|
252
|
+
```vue
|
|
253
|
+
<template>
|
|
254
|
+
<button @click="openChat">Open Chat</button>
|
|
255
|
+
</template>
|
|
256
|
+
|
|
257
|
+
<script>
|
|
258
|
+
export default {
|
|
259
|
+
mounted() {
|
|
260
|
+
const script = document.createElement('script');
|
|
261
|
+
script.src = 'https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js'\;
|
|
262
|
+
document.body.appendChild(script);
|
|
263
|
+
|
|
264
|
+
const chat = document.createElement('eigi-chat');
|
|
265
|
+
chat.setAttribute('agent-id', 'YOUR_AGENT_ID');
|
|
266
|
+
document.body.appendChild(chat);
|
|
267
|
+
},
|
|
268
|
+
methods: {
|
|
269
|
+
openChat() {
|
|
270
|
+
window.EigiChat?.open();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
</script>
|
|
95
275
|
```
|
|
96
276
|
|
|
97
|
-
###
|
|
277
|
+
### Next.js
|
|
278
|
+
|
|
279
|
+
```jsx
|
|
280
|
+
'use client';
|
|
281
|
+
import { useEffect } from 'react';
|
|
282
|
+
import Script from 'next/script';
|
|
283
|
+
|
|
284
|
+
export default function ChatWidget() {
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
const chat = document.createElement('eigi-chat');
|
|
287
|
+
chat.setAttribute('agent-id', 'YOUR_AGENT_ID');
|
|
288
|
+
document.body.appendChild(chat);
|
|
289
|
+
return () => chat.remove();
|
|
290
|
+
}, []);
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<>
|
|
294
|
+
<Script
|
|
295
|
+
src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"
|
|
296
|
+
strategy="lazyOnload"
|
|
297
|
+
/>
|
|
298
|
+
<button onClick={() => window.EigiChat?.open()}>
|
|
299
|
+
Open Chat
|
|
300
|
+
</button>
|
|
301
|
+
</>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 🌐 No-Code Platform Integration
|
|
309
|
+
|
|
310
|
+
### Wix
|
|
311
|
+
|
|
312
|
+
Wix runs Velo code in a sandboxed worker that **cannot access window.EigiChat directly**. Use the HTML Component Bridge pattern:
|
|
98
313
|
|
|
99
|
-
1
|
|
100
|
-
|
|
314
|
+
#### Step 1: Add Custom Code (Body End)
|
|
315
|
+
|
|
316
|
+
Go to **Settings → Custom Code → Body End** and add:
|
|
101
317
|
|
|
102
318
|
```html
|
|
103
|
-
<eigi-chat
|
|
104
|
-
<script
|
|
319
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
320
|
+
<script>
|
|
321
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
322
|
+
var chat = document.createElement("eigi-chat");
|
|
323
|
+
chat.setAttribute("agent-id", "YOUR_AGENT_ID");
|
|
324
|
+
document.body.appendChild(chat);
|
|
325
|
+
|
|
326
|
+
window.addEventListener("message", function(event) {
|
|
327
|
+
if (event.data) {
|
|
328
|
+
if (event.data.type === "eigiChatOpen" && window.EigiChat) {
|
|
329
|
+
window.EigiChat.open();
|
|
330
|
+
}
|
|
331
|
+
if (event.data.type === "eigiChatClose" && window.EigiChat) {
|
|
332
|
+
window.EigiChat.close();
|
|
333
|
+
}
|
|
334
|
+
if (event.data.type === "eigiChatOpenChat" && window.EigiChat) {
|
|
335
|
+
window.EigiChat.openChat();
|
|
336
|
+
}
|
|
337
|
+
if (event.data.type === "eigiChatOpenTalk" && window.EigiChat) {
|
|
338
|
+
window.EigiChat.openTalk();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
</script>
|
|
105
344
|
```
|
|
106
345
|
|
|
107
|
-
|
|
346
|
+
#### Step 2: Add HTML Component Bridge
|
|
347
|
+
|
|
348
|
+
Add an **Embed HTML** component (can be 1x1 pixel, hidden):
|
|
349
|
+
|
|
350
|
+
```html
|
|
351
|
+
<script>
|
|
352
|
+
window.onmessage = function(event) {
|
|
353
|
+
if (event.data) {
|
|
354
|
+
if (event.data.type === "openEigiChat") {
|
|
355
|
+
window.parent.postMessage({ type: "eigiChatOpen" }, "*");
|
|
356
|
+
}
|
|
357
|
+
if (event.data.type === "closeEigiChat") {
|
|
358
|
+
window.parent.postMessage({ type: "eigiChatClose" }, "*");
|
|
359
|
+
}
|
|
360
|
+
if (event.data.type === "openEigiChatDirect") {
|
|
361
|
+
window.parent.postMessage({ type: "eigiChatOpenChat" }, "*");
|
|
362
|
+
}
|
|
363
|
+
if (event.data.type === "openEigiTalkDirect") {
|
|
364
|
+
window.parent.postMessage({ type: "eigiChatOpenTalk" }, "*");
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
</script>
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### Step 3: Add Velo Code
|
|
108
372
|
|
|
109
373
|
```javascript
|
|
110
374
|
$w.onReady(function () {
|
|
111
375
|
$w("#chatButton").onClick(() => {
|
|
112
|
-
|
|
376
|
+
$w("#html1").postMessage({ type: "openEigiChat" });
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
$w("#closeButton").onClick(() => {
|
|
380
|
+
$w("#html1").postMessage({ type: "closeEigiChat" });
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
$w("#textChatButton").onClick(() => {
|
|
384
|
+
$w("#html1").postMessage({ type: "openEigiChatDirect" });
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
$w("#voiceCallButton").onClick(() => {
|
|
388
|
+
$w("#html1").postMessage({ type: "openEigiTalkDirect" });
|
|
113
389
|
});
|
|
114
390
|
});
|
|
115
391
|
```
|
|
116
392
|
|
|
117
|
-
|
|
393
|
+
Replace `#html1` with your actual HTML component ID.
|
|
118
394
|
|
|
119
|
-
|
|
395
|
+
---
|
|
120
396
|
|
|
121
|
-
|
|
397
|
+
### Squarespace
|
|
122
398
|
|
|
123
|
-
|
|
124
|
-
- **Chat** - Start a text conversation
|
|
399
|
+
Add via **Code Injection** (Settings → Advanced → Code Injection → Footer):
|
|
125
400
|
|
|
126
|
-
|
|
401
|
+
```html
|
|
402
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
403
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
404
|
+
|
|
405
|
+
<button onclick="window.EigiChat.open()" style="
|
|
406
|
+
position: fixed;
|
|
407
|
+
bottom: 20px;
|
|
408
|
+
right: 20px;
|
|
409
|
+
padding: 16px 24px;
|
|
410
|
+
background: #3B82F6;
|
|
411
|
+
color: white;
|
|
412
|
+
border: none;
|
|
413
|
+
border-radius: 50px;
|
|
414
|
+
cursor: pointer;
|
|
415
|
+
z-index: 9999;
|
|
416
|
+
font-size: 16px;
|
|
417
|
+
">
|
|
418
|
+
💬 Chat
|
|
419
|
+
</button>
|
|
420
|
+
```
|
|
127
421
|
|
|
128
|
-
|
|
422
|
+
---
|
|
129
423
|
|
|
130
|
-
|
|
131
|
-
- Text input with send button
|
|
132
|
-
- Switch to voice button in header
|
|
424
|
+
### WordPress
|
|
133
425
|
|
|
134
|
-
|
|
426
|
+
Add to your theme's footer or use "Insert Headers and Footers" plugin:
|
|
135
427
|
|
|
136
|
-
|
|
428
|
+
```html
|
|
429
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
430
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
137
431
|
|
|
138
|
-
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
432
|
+
<script>
|
|
433
|
+
document.querySelectorAll('.open-chat').forEach(function(el) {
|
|
434
|
+
el.addEventListener('click', function() {
|
|
435
|
+
window.EigiChat.open();
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
</script>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Then add `class="open-chat"` to any button or link in WordPress editor.
|
|
143
442
|
|
|
144
|
-
|
|
443
|
+
---
|
|
145
444
|
|
|
146
|
-
|
|
445
|
+
### Webflow
|
|
446
|
+
|
|
447
|
+
Add to **Site Settings → Custom Code → Footer Code**:
|
|
448
|
+
|
|
449
|
+
```html
|
|
450
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
451
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
452
|
+
```
|
|
147
453
|
|
|
148
|
-
|
|
149
|
-
- The widget's CSS will **not** leak to your page
|
|
150
|
-
- Multiple widgets can coexist without conflicts
|
|
151
|
-
- Theme is applied via CSS custom properties
|
|
454
|
+
Then add custom attribute to your button: **onclick** = `window.EigiChat.open()`
|
|
152
455
|
|
|
153
|
-
|
|
456
|
+
---
|
|
154
457
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
458
|
+
### Shopify
|
|
459
|
+
|
|
460
|
+
Add to **Themes → Edit Code → theme.liquid** (before `</body>`):
|
|
461
|
+
|
|
462
|
+
```html
|
|
463
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
464
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
### Framer
|
|
470
|
+
|
|
471
|
+
Add to Site Settings → Custom Code → End of body:
|
|
472
|
+
|
|
473
|
+
```html
|
|
474
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
475
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Then use Embed component with:
|
|
479
|
+
|
|
480
|
+
```html
|
|
481
|
+
<button onclick="window.parent.EigiChat?.open()" style="
|
|
482
|
+
padding: 16px 32px;
|
|
483
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
484
|
+
color: white;
|
|
485
|
+
border: none;
|
|
486
|
+
border-radius: 50px;
|
|
487
|
+
cursor: pointer;
|
|
488
|
+
">
|
|
489
|
+
Chat with Us
|
|
490
|
+
</button>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
### Carrd
|
|
496
|
+
|
|
497
|
+
Add an **Embed** element with:
|
|
498
|
+
|
|
499
|
+
```html
|
|
500
|
+
<eigi-chat agent-id="YOUR_AGENT_ID"></eigi-chat>
|
|
501
|
+
<script src="https://unpkg.com/@cliniq360/eigi-chat@latest/dist/eigi-chat.js"></script>
|
|
502
|
+
<button onclick="window.EigiChat.open()" style="
|
|
503
|
+
padding: 12px 24px;
|
|
504
|
+
background: #3B82F6;
|
|
505
|
+
color: white;
|
|
506
|
+
border: none;
|
|
507
|
+
border-radius: 8px;
|
|
508
|
+
cursor: pointer;
|
|
509
|
+
">
|
|
510
|
+
Chat Now
|
|
511
|
+
</button>
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## 🛡️ Shadow DOM & CSS Isolation
|
|
517
|
+
|
|
518
|
+
This widget uses **Shadow DOM** to completely isolate its styles:
|
|
519
|
+
|
|
520
|
+
- ✅ Your page's CSS will **not** affect the widget
|
|
521
|
+
- ✅ The widget's CSS will **not** leak to your page
|
|
522
|
+
- ✅ Multiple widgets can coexist without conflicts
|
|
523
|
+
- ✅ Theme is applied via CSS custom properties
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
## 📱 Browser Support
|
|
528
|
+
|
|
529
|
+
| Browser | Version |
|
|
530
|
+
|---------|---------|
|
|
531
|
+
| Chrome | 73+ |
|
|
532
|
+
| Safari | 16.4+ |
|
|
533
|
+
| Firefox | 101+ |
|
|
534
|
+
| Edge | 79+ |
|
|
159
535
|
|
|
160
536
|
Older browsers use a fallback method for CSS injection.
|
|
161
537
|
|
|
162
|
-
|
|
538
|
+
---
|
|
163
539
|
|
|
164
|
-
|
|
540
|
+
## 🔧 Advanced Configuration
|
|
165
541
|
|
|
166
|
-
|
|
167
|
-
| ---------- | ----------- | -------- | ----------------------------------------- |
|
|
168
|
-
| `agent-id` | string | Yes | Your Eigi agent ID |
|
|
169
|
-
| `metadata` | JSON string | No | Additional metadata to send with messages |
|
|
542
|
+
### Passing Custom Metadata
|
|
170
543
|
|
|
171
|
-
|
|
544
|
+
Send additional context with every chat/call:
|
|
172
545
|
|
|
173
|
-
|
|
546
|
+
```html
|
|
547
|
+
<eigi-chat
|
|
548
|
+
agent-id="YOUR_AGENT_ID"
|
|
549
|
+
metadata='{"userId": "user123", "plan": "premium", "page": "pricing"}'
|
|
550
|
+
></eigi-chat>
|
|
551
|
+
```
|
|
174
552
|
|
|
175
|
-
|
|
553
|
+
Or programmatically:
|
|
176
554
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
555
|
+
```javascript
|
|
556
|
+
window.EigiChat.init({
|
|
557
|
+
agentId: 'YOUR_AGENT_ID',
|
|
558
|
+
metadata: {
|
|
559
|
+
userId: 'user123',
|
|
560
|
+
plan: 'premium',
|
|
561
|
+
page: window.location.pathname
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
```
|
|
186
565
|
|
|
187
|
-
|
|
566
|
+
### Dynamic Agent Switching
|
|
188
567
|
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
|
|
568
|
+
```javascript
|
|
569
|
+
window.EigiChat.init({
|
|
570
|
+
agentId: 'DIFFERENT_AGENT_ID'
|
|
571
|
+
});
|
|
572
|
+
```
|
|
192
573
|
|
|
193
|
-
|
|
194
|
-
npm run dev
|
|
574
|
+
---
|
|
195
575
|
|
|
196
|
-
|
|
197
|
-
npm run build
|
|
576
|
+
## 🛠️ Development
|
|
198
577
|
|
|
199
|
-
|
|
200
|
-
npm
|
|
578
|
+
```bash
|
|
579
|
+
npm install # Install dependencies
|
|
580
|
+
npm run dev # Start development server
|
|
581
|
+
npm run build # Build for production
|
|
582
|
+
npm run preview # Preview production build
|
|
201
583
|
```
|
|
202
584
|
|
|
203
|
-
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## 📄 License
|
|
204
588
|
|
|
205
589
|
MIT © [eigi.ai](https://eigi.ai)
|
|
590
|
+
|
|
591
|
+
---
|
|
592
|
+
|
|
593
|
+
## 🆘 Support
|
|
594
|
+
|
|
595
|
+
- **Documentation**: [https://docs.eigi.ai](https://docs.eigi.ai)
|
|
596
|
+
- **Issues**: [GitHub Issues](https://github.com/eigi-ai/eigi-chat/issues)
|
|
597
|
+
- **Email**: support@eigi.ai
|