@helpai/elements 1.11.0 → 1.12.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/docs/analytics.md CHANGED
@@ -28,8 +28,13 @@ internal event bus, and you subscribe as many listeners as you want.
28
28
  <!-- 2. Load the widget -->
29
29
  <script src="https://cdn.help.ai/sdk/js/elements/latest/elements.js" data-public-key="agent_pk_..." data-ai-agent-deployment-id="01900000-0000-7000-8000-000000000000" defer></script>
30
30
 
31
- <!-- 3. Subscribe to every widget event with one wildcard hook -->
31
+ <!-- 3. Subscribe to every widget event with one wildcard hook. The stub queues the call until the deferred script runs. -->
32
32
  <script>
33
+ window.HelpAI =
34
+ window.HelpAI ||
35
+ function () {
36
+ (HelpAI.q = HelpAI.q || []).push(arguments);
37
+ };
33
38
  HelpAI('hook', 'default', '*', (chat, event, payload) => {
34
39
  gtag('event', `chat_${event}`, flatten(payload));
35
40
  });
@@ -478,8 +478,8 @@ The auto-boot parser exposes the documented flat `data-*` subset.
478
478
 
479
479
  Full attribute list: [Installation § script data attributes](./installation.md#attributes).
480
480
 
481
- `data-no-autoboot` — loads the bundle but doesn't auto-mount. For
482
- deferred init via JS.
481
+ Leave out `data-ai-agent-deployment-id` to load the bundle without mounting, then call
482
+ `HelpAI.init({ … })` from JavaScript ([Installation § Load without mounting](./installation.md#load-without-mounting)).
483
483
 
484
484
  ---
485
485
 
@@ -22,7 +22,7 @@ Both deliver the same event stream. Both are safe to mix.
22
22
  | ----------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
23
23
  | `open` | Panel opens (floating mode) | `void` |
24
24
  | `close` | Panel closes | `void` |
25
- | `message` | User sends a message + assistant finishes a reply | `{ role: "user" \| "assistant"; text: string }` |
25
+ | `message` | User sends a message, or a reply from the AI agent or a team member finishes | `{ role: "user" \| "assistant" \| "operator"; text: string }` |
26
26
  | `error` | Transport error or mid-stream error | `unknown` (error object or message) |
27
27
  | `expand` | Expanded tier toggled (⤢) | `boolean` (new state) |
28
28
  | `fullscreen` | Fullscreen tier toggled (⛶) | `boolean` (new state) |
@@ -100,13 +100,13 @@ Unknown attributes are ignored. Full option semantics:
100
100
  > one re-handshakes with the same anonymous visitor/conversation. This
101
101
  > context is informational for the AI, never an auth credential.
102
102
 
103
- ### `data-no-autoboot`
103
+ ### Load without mounting
104
104
 
105
- Add this flag to load the bundle **without** automatically mounting.
106
- Useful when you want to `init()` later from JavaScript:
105
+ The script tag mounts the widget only when it carries `data-ai-agent-deployment-id`. Leave that attribute out to
106
+ load the bundle **without** mounting, then call `init()` from JavaScript when you're ready:
107
107
 
108
108
  ```html
109
- <script src="https://cdn.help.ai/sdk/js/elements/latest/elements.js" data-no-autoboot></script>
109
+ <script src="https://cdn.help.ai/sdk/js/elements/latest/elements.js"></script>
110
110
  <script>
111
111
  // Mount later, conditionally
112
112
  document.addEventListener('DOMContentLoaded', () => {
@@ -487,10 +487,13 @@ and anyone can base64url-decode it. Never put a secret in context.
487
487
 
488
488
  ### Key rotation
489
489
 
490
- - **public keys** — rotate from the dashboard. Old keys are deactivated
491
- instantly; update your embeds.
492
- - **secret key** — user tokens signed with a replaced secret key stop verifying, so every verified user is signed out
493
- until your server signs new ones with the new key.
490
+ The dashboard has no key rotation today.
491
+
492
+ - **public key** — public by design: it only names the deployment. Limit where it works with the deployment's
493
+ **Allowed websites**.
494
+ - **secret key** — keep it on your server. If it leaks, create a new deployment (it gets new keys), move your embed
495
+ and your token signing to it, and delete the old one. User tokens signed with the old key stop verifying, so every
496
+ verified user is signed out until your server signs new ones.
494
497
 
495
498
  ---
496
499