@askly/widget 1.1.0 → 1.1.2
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 +20 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Alternatively, initialize automatically via a single script tag:
|
|
|
45
45
|
></script>
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
> The widget talks to Askly's hosted backend
|
|
48
|
+
> The widget talks to Askly's hosted backend automatically — there is nothing else to configure.
|
|
49
49
|
|
|
50
50
|
## Configuration
|
|
51
51
|
|
|
@@ -53,34 +53,30 @@ The `Askly.init()` method accepts an object with the following configuration opt
|
|
|
53
53
|
|
|
54
54
|
| Option | Type | Required | Default | Description |
|
|
55
55
|
| :--- | :--- | :--- | :--- | :--- |
|
|
56
|
-
| `widgetId` | `string` | Yes | - | Your widget ID, from the tenant portal's Widget setup screen. |
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `signature` | `string` | No | - | HMAC request signature. |
|
|
73
|
-
| `turnstileSiteKey` | `string` | No | - | Cloudflare Turnstile key. |
|
|
74
|
-
| `excludePaths` | `string[]` | No | `[]` | URL path prefixes to exclude widget. |
|
|
56
|
+
| `widgetId` | `string` | **Yes** | - | Your widget ID, from the tenant portal's Widget setup screen. |
|
|
57
|
+
|
|
58
|
+
### Configured in the portal
|
|
59
|
+
|
|
60
|
+
The widget's appearance and behaviour — display name, logo, theme color, welcome message, position, voice, sounds, timestamps, "powered by" text, and so on — are set on the **Widget setup** screen in your Askly portal and loaded automatically by `widgetId`. **You do not pass these in code.** (They remain accepted as optional `init()` overrides for advanced cases, but the portal is the source of truth.)
|
|
61
|
+
|
|
62
|
+
### Identifying an authenticated user
|
|
63
|
+
|
|
64
|
+
Pass these only when you want to tie a conversation to a logged-in user on your site. `timestamp` and `signature` are an HMAC generated **on your backend** using your Widget Secret Key — never in browser JS.
|
|
65
|
+
|
|
66
|
+
| Option | Type | Description |
|
|
67
|
+
| :--- | :--- | :--- |
|
|
68
|
+
| `userId` | `string` | Authenticated user ID. |
|
|
69
|
+
| `timestamp` | `number` | Signature timestamp. |
|
|
70
|
+
| `signature` | `string` | HMAC request signature. |
|
|
71
|
+
| `excludePaths` | `string[]` | URL path prefixes where the widget should not render. |
|
|
75
72
|
|
|
76
73
|
## Lifecycle Callbacks
|
|
77
74
|
|
|
78
|
-
|
|
75
|
+
Callbacks are functions, so they can only be attached in code (not from the portal):
|
|
79
76
|
|
|
80
77
|
```javascript
|
|
81
78
|
Askly.init({
|
|
82
|
-
|
|
83
|
-
orgServerRoute: "https://your-backend.com/api/chat",
|
|
79
|
+
widgetId: "your-widget-id",
|
|
84
80
|
onMessageSent: (message) => console.log("Sent:", message),
|
|
85
81
|
onMessageReceived: (reply) => console.log("Received:", reply),
|
|
86
82
|
onChatOpened: () => console.log("Opened"),
|
|
@@ -91,22 +87,7 @@ Askly.init({
|
|
|
91
87
|
|
|
92
88
|
## Backend Integration
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```json
|
|
97
|
-
{
|
|
98
|
-
"message": "User's message",
|
|
99
|
-
"orgId": "your-org-id"
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
The response must return the reply:
|
|
104
|
-
|
|
105
|
-
```json
|
|
106
|
-
{
|
|
107
|
-
"reply": "Agent response text"
|
|
108
|
-
}
|
|
109
|
-
```
|
|
90
|
+
None required. The widget talks to Askly's hosted backend automatically — you only provide a `widgetId`.
|
|
110
91
|
|
|
111
92
|
## Development
|
|
112
93
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askly/widget",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Embeddable AI support chat widget with voice capabilities, RAG integration, and extensive customization options.",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|