@ariaflowagents/widget 0.5.7 → 0.5.9
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 +19 -14
- package/dist/widget.js +334 -311
- package/dist/widget.umd.cjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,32 +12,36 @@ Include the widget script on your website:
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
### Method 1:
|
|
15
|
+
### Method 1: Agent Resolution (Recommended)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Use `agent-url` (HTTP base URL) and `agent-id` to dynamically resolve agent configuration:
|
|
18
18
|
|
|
19
19
|
```html
|
|
20
20
|
<ariaflow-widget
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
agent-url="https://your-api-endpoint.com"
|
|
22
|
+
agent-id="support"
|
|
23
23
|
position="bottom-right"
|
|
24
24
|
theme="light"
|
|
25
25
|
title="Chat with us"
|
|
26
|
-
subtitle="We
|
|
26
|
+
subtitle="We're here to help!">
|
|
27
27
|
</ariaflow-widget>
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
The widget will:
|
|
31
|
+
1. Call `GET https://your-api-endpoint.com/api/agent/support`
|
|
32
|
+
2. Receive WebSocket URL and agent configuration
|
|
33
|
+
3. Connect to the resolved WebSocket endpoint
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
### Method 2: Legacy Direct Connection
|
|
36
|
+
|
|
37
|
+
For backward compatibility with fallback logic:
|
|
33
38
|
|
|
34
39
|
```html
|
|
35
40
|
<ariaflow-widget
|
|
36
|
-
agent-url="
|
|
41
|
+
agent-url="wss://your-server.com"
|
|
42
|
+
agent-id="support"
|
|
37
43
|
position="bottom-right"
|
|
38
|
-
theme="light"
|
|
39
|
-
title="Chat with us"
|
|
40
|
-
subtitle="Direct agent connection">
|
|
44
|
+
theme="light">
|
|
41
45
|
</ariaflow-widget>
|
|
42
46
|
```
|
|
43
47
|
|
|
@@ -45,9 +49,10 @@ Connect directly to an agent WebSocket endpoint:
|
|
|
45
49
|
|
|
46
50
|
| Attribute | Type | Default | Description |
|
|
47
51
|
|-----------|------|---------|-------------|
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
52
|
+
| `agent-url` | string | **required** | HTTP base URL for API calls |
|
|
53
|
+
| `agent-id` | string | **required** | Agent identifier to resolve configuration |
|
|
54
|
+
| `widget-id` | string | - | Legacy: Widget config ID |
|
|
55
|
+
| `api-url` | string | - | Legacy: API endpoint for widget config |
|
|
51
56
|
| `position` | string | `"bottom-right"` | Widget position: `bottom-right`, `bottom-left`, `top-right`, `top-left` |
|
|
52
57
|
| `theme` | string | `"light"` | Theme: `light` or `dark` |
|
|
53
58
|
| `title` | string | `"Chat with us"` | Header title |
|