@askly/widget 2.2.1 → 2.3.1

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
@@ -15,51 +15,38 @@ Askly is an **embeddable AI support chat widget** for React and plain HTML. Drop
15
15
  - 📚 **RAG (docs-grounded)** — replies grounded in your own documentation, not hallucinated.
16
16
  - 🎙️ **Voice chat** — customers can talk to the assistant, not just type.
17
17
  - 🙋 **Human handoff** — one-click escalation to a live agent when needed.
18
- - ⚛️ **React + CDN** — use as an npm module or a single `<script>` tag.
18
+ - ⚛️ **React + CDN** — use as an npm module, or a single `<script>` tag on any site (no React required).
19
19
  - 🎨 **Fully themeable** — colors, logo, position, and copy configured in the portal.
20
20
 
21
21
  ## Installation
22
22
 
23
- ### NPM
24
- ```bash
25
- npm install @askly/widget
26
- ```
23
+ ### Script tag (any website)
27
24
 
28
- ### CDN
29
- Include the UMD build directly in your HTML:
30
- ```html
31
- <!-- React Dependencies -->
32
- <script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
33
- <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
25
+ One line, before `</body>`. The bundle is self-contained — no React or other dependencies on your page:
34
26
 
35
- <!-- Askly SDK -->
36
- <script src="https://unpkg.com/@askly/widget@latest/dist/index.umd.js"></script>
27
+ ```html
28
+ <script src="https://unpkg.com/@askly/widget@latest/dist/widget.js" data-app-id="YOUR_APP_ID" async></script>
37
29
  ```
38
30
 
39
- ## Quick Start
31
+ That's the whole install. Your branding — name, logo, theme, welcome message — loads automatically from your Askly portal settings.
40
32
 
41
- All you need is your `widgetId` — copy it from the **Widget setup** screen in your Askly tenant portal. Everything else (name, theme, logo, welcome message, voice, etc.) is configured there and loaded automatically; the init props below are optional overrides.
33
+ ### NPM (React / bundlers)
34
+
35
+ ```bash
36
+ npm install @askly/widget
37
+ ```
42
38
 
43
39
  ```javascript
44
40
  import Askly from '@askly/widget';
45
41
 
46
- Askly.init({ widgetId: "your-widget-id" });
42
+ Askly.init({ appId: "YOUR_APP_ID" });
47
43
  ```
48
44
 
49
- For CDN initialization:
50
- ```html
51
- <script>
52
- Askly.init({ widgetId: "your-widget-id" });
53
- </script>
54
- ```
45
+ The npm builds (`index.esm.js` / `index.umd.js`) treat React as a peer dependency, so your bundle isn't double-shipping it.
55
46
 
56
- Alternatively, initialize automatically via a single script tag:
57
- ```html
58
- <script
59
- src="https://unpkg.com/@askly/widget@latest/dist/index.umd.js"
60
- data-widget-id="your-widget-id"
61
- ></script>
62
- ```
47
+ ## Quick Start
48
+
49
+ All you need is your `appId` — copy it from **Widget → Install Code** in your Askly tenant portal. Everything else (name, theme, logo, welcome message, voice, etc.) is configured there and loaded automatically; the init props below are optional overrides.
63
50
 
64
51
  > The widget talks to Askly's hosted backend automatically — there is nothing else to configure.
65
52
 
@@ -69,11 +56,13 @@ The `Askly.init()` method accepts an object with the following configuration opt
69
56
 
70
57
  | Option | Type | Required | Default | Description |
71
58
  | :--- | :--- | :--- | :--- | :--- |
72
- | `widgetId` | `string` | **Yes** | - | Your widget ID, from the tenant portal's Widget setup screen. |
59
+ | `appId` | `string` | **Yes** | - | Your app ID, from the tenant portal's **Widget → Install Code** screen. Script tag: `data-app-id`. |
60
+
61
+ > `widgetId` and `orgId` are still accepted as deprecated aliases for `appId`, so existing embeds keep working.
73
62
 
74
63
  ### Configured in the portal
75
64
 
76
- 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.)
65
+ 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** screen in your Askly portal and loaded automatically by `appId`. Logos are uploaded right there and apply instantly. **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.)
77
66
 
78
67
  ### Identifying an authenticated user
79
68
 
@@ -151,10 +140,10 @@ Control where the widget appears using URL **path prefixes** (matched against `w
151
140
 
152
141
  ```javascript
153
142
  // Show ONLY on support & docs pages
154
- Askly.init({ widgetId: "your-widget-id", includePaths: ["/support", "/docs"] });
143
+ Askly.init({ appId: "YOUR_APP_ID", includePaths: ["/support", "/docs"] });
155
144
 
156
145
  // Show everywhere EXCEPT admin & checkout
157
- Askly.init({ widgetId: "your-widget-id", excludePaths: ["/admin", "/checkout"] });
146
+ Askly.init({ appId: "YOUR_APP_ID", excludePaths: ["/admin", "/checkout"] });
158
147
  ```
159
148
 
160
149
  Via script tag, use comma-separated values: `data-include-paths="/support,/docs"` or `data-exclude-paths="/admin,/checkout"`.
@@ -172,7 +161,7 @@ Callbacks are functions, so they can only be attached in code (not from the port
172
161
 
173
162
  ```javascript
174
163
  Askly.init({
175
- widgetId: "your-widget-id",
164
+ appId: "YOUR_APP_ID",
176
165
  onMessageSent: (message) => console.log("Sent:", message),
177
166
  onMessageReceived: (reply) => console.log("Received:", reply),
178
167
  onChatOpened: () => console.log("Opened"),
@@ -183,7 +172,7 @@ Askly.init({
183
172
 
184
173
  ## Backend Integration
185
174
 
186
- None required. The widget talks to Askly's hosted backend automatically — you only provide a `widgetId`.
175
+ None required. The widget talks to Askly's hosted backend automatically — you only provide an `appId`.
187
176
 
188
177
  ## Development
189
178
 
@@ -195,6 +184,25 @@ npm install
195
184
  npm run build
196
185
  ```
197
186
 
187
+ ### Releasing
188
+
189
+ ```bash
190
+ npm version <patch|minor|major>
191
+ npm publish # prepublishOnly rebuilds dist/
192
+ ```
193
+
194
+ **Publishing is not the last step.** The tenant portal bundles this package
195
+ (`AsklyWidget.tsx` and the help centre both `import("@askly/widget")`), and its Docker build runs
196
+ `npm ci` — which installs whatever `package-lock.json` pins and ignores the `^` range entirely. So
197
+ a new version does not reach Askly's own site until the portal's lockfile is bumped:
198
+
199
+ ```bash
200
+ cd ../tenant-portal && npm install @askly/widget@latest # updates package-lock.json
201
+ ```
202
+
203
+ Skipping this is how 2.2.0 shipped to npm while the portal kept serving 2.1.0 for a day — visitors
204
+ were unrecognisable there, and every message showed as a separate person in the Inbox.
205
+
198
206
  ## Why Askly?
199
207
 
200
208
  **Is this an AI customer support widget I can embed in React?**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type AsklyIdentity } from "./identity";
2
2
  export interface AsklyConfig {
3
+ appId?: string;
3
4
  widgetId?: string;
4
5
  orgId?: string;
5
6
  orgServerRoute?: string;
@@ -62,5 +63,11 @@ declare const Askly: {
62
63
  reset: () => void;
63
64
  /** Remove the widget from the page. Also resets identity, as on logout. */
64
65
  shutdown: () => void;
66
+ /** Open the chat panel — for host-page CTAs like a "Contact us" button. */
67
+ open: () => void;
68
+ /** Close the chat panel. */
69
+ close: () => void;
70
+ /** Toggle the chat panel. */
71
+ toggle: () => void;
65
72
  };
66
73
  export default Askly;