@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 CHANGED
@@ -12,32 +12,36 @@ Include the widget script on your website:
12
12
 
13
13
  ## Usage
14
14
 
15
- ### Method 1: Config-based (Recommended for Production)
15
+ ### Method 1: Agent Resolution (Recommended)
16
16
 
17
- Add the widget element to your HTML with a widget ID:
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
- widget-id="widget_abc123"
22
- api-url="https://your-api-endpoint.com"
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 typically reply within minutes">
26
+ subtitle="We're here to help!">
27
27
  </ariaflow-widget>
28
28
  ```
29
29
 
30
- ### Method 2: Direct Agent Connection (Great for Development/Debugging)
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
- Connect directly to an agent WebSocket endpoint:
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="ws://localhost:3333/agents/chat"
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
- | `widget-id` | string | - | Widget config ID (when using config-based setup) |
49
- | `api-url` | string | - | API endpoint for widget config (when using config-based setup) |
50
- | `agent-url` | string | - | Direct WebSocket URL to agent (bypasses config endpoint) |
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 |