@helpai/elements 6.15.0 → 7.0.0

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.
@@ -94,8 +94,10 @@ function PricingHelp() {
94
94
  the server render sees the initial state. The commands are stable across renders and do nothing until the widget
95
95
  has mounted (`state.ready`). `ask(text)` fills the composer; `ask(text, { send: true })` sends it. Call `reset()`
96
96
  when your user logs out.
97
- - **One import path.** The kit carries the whole widget API (`getInstance`, `hook`, the types), so import everything
98
- from `@helpai/elements/react`; the package's other entries are separate copies with their own widgets.
97
+ - **One import path.** The kit carries the widget API a React app uses (`getInstance`, `getAllInstances`, `hook`,
98
+ `version`, `brand`, the types), so import everything from `@helpai/elements/react`; the package's other entries are
99
+ separate copies with their own widgets. `<HelpAI />` is how the kit mounts the widget: it has no `init`, `mount` or
100
+ `destroy`.
99
101
  - **Two widgets** on one page: give each `<HelpAI widgetId='support' … />` and read it with `useHelpAI('support')`.
100
102
  - **Page tools:** `useHelpAITool(tool)` gives the agent a tool while the component is mounted, or pass
101
103
  `<HelpAI tools={[...]} />` ([Page tools](./page-tools.md)). `execute` can be a new function on every render; the
@@ -106,7 +108,9 @@ function PricingHelp() {
106
108
  To open your own login modal from the widget's Log in button, `hook('default', 'loginRequested', fn)`
107
109
  (Logging in).
108
110
 
109
- The kit bundles the widget and imports only React from your app, so you don't need Preact installed.
111
+ The kit carries the widget and imports only React from your app, so you don't need Preact installed. The widget
112
+ itself (about 150 kB gzipped) is a separate chunk that `<HelpAI />` loads once it mounts in the browser, so it stays
113
+ out of your app's first load; the hooks work from the start and pick the widget up when it is ready.
110
114
 
111
115
  ### React 19 — use the web component directly
112
116
 
@@ -479,16 +479,16 @@ The web-component bundle self-registers `<web-ai-chat>` on import:
479
479
 
480
480
  ### File catalog (every `dist/<brand>/` ships these)
481
481
 
482
- | File | Purpose | Use with |
483
- | --------------------------------- | ------------------------------------------------------ | --------------------------------------- |
484
- | `elements.js` | IIFE bundle, defines `window.HelpAI` | Plain `<script>` (no `type="module"`) |
485
- | `elements.esm.js` | **Standalone ESM, fully bundled** | `<script type="module">` import |
486
- | `elements-web-component.esm.js` | **Standalone ESM, registers `<web-ai-chat>`** | `<script type="module">` import (no JS) |
487
- | `index.mjs` / `web-component.mjs` | tsdown ESM with bare imports (`import "preact"` etc.) | Bundlers (Vite, webpack, esbuild) |
488
- | `react.mjs` / `react.d.ts` | React kit: `<HelpAI />`, `useHelpAI()`, widget bundled | React apps, `@helpai/elements/react` |
489
- | `style.css` | Standalone stylesheet — host-element tokens + layout | `<link rel="stylesheet">` |
490
- | `loader.js`, `loader.min.js` | GA-style queueing loader stub | Tag managers / analytics pipelines |
491
- | `index.d.ts` | TypeScript declarations | NPM consumers |
482
+ | File | Purpose | Use with |
483
+ | --------------------------------- | ------------------------------------------------------------------------------------ | --------------------------------------- |
484
+ | `elements.js` | IIFE bundle, defines `window.HelpAI` | Plain `<script>` (no `type="module"`) |
485
+ | `elements.esm.js` | **Standalone ESM, fully bundled** | `<script type="module">` import |
486
+ | `elements-web-component.esm.js` | **Standalone ESM, registers `<web-ai-chat>`** | `<script type="module">` import (no JS) |
487
+ | `index.mjs` / `web-component.mjs` | tsdown ESM with bare imports (`import "preact"` etc.) | Bundlers (Vite, webpack, esbuild) |
488
+ | `react.mjs` / `react.d.ts` | React kit: `<HelpAI />`, `useHelpAI()`; the widget is `react-*.mjs`, loaded on mount | React apps, `@helpai/elements/react` |
489
+ | `style.css` | Standalone stylesheet — host-element tokens + layout | `<link rel="stylesheet">` |
490
+ | `loader.js`, `loader.min.js` | GA-style queueing loader stub | Tag managers / analytics pipelines |
491
+ | `index.d.ts` | TypeScript declarations | NPM consumers |
492
492
 
493
493
  ### CDN URL forms
494
494