@helpai/elements 1.6.0 → 1.7.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.
package/index.d.ts CHANGED
@@ -3207,11 +3207,12 @@ type HookListener = (instance: ChatWidgetInstance, event: EventName, data: unkno
3207
3207
  /**
3208
3208
  * Host-element command bus.
3209
3209
  *
3210
- * The programmatic API (`chat.open()`, `.close()`, `.expand()`)
3211
- * dispatches `CustomEvent`s on the shadow host element. The App listens
3212
- * for those same events and routes them to its state handlers. That
3213
- * keeps the two modules decoupled — `index.ts` doesn't hold a ref to App
3214
- * state, App doesn't know about the public instance handle.
3210
+ * The programmatic API (`chat.open()`, `.close()`, `.ask()`, …) and the
3211
+ * `<web-ai-chat>` element's methods dispatch `CustomEvent`s on the shadow
3212
+ * host element. The App listens for those same events and routes them to
3213
+ * its state handlers. That keeps the two modules decoupled — `index.ts`
3214
+ * doesn't hold a ref to App state, App doesn't know about the public
3215
+ * instance handle.
3215
3216
  *
3216
3217
  * This module is the single source of truth for the event names + the
3217
3218
  * tiny helpers on both sides of the bridge.
@@ -3284,6 +3285,17 @@ export interface ChatWidgetInstance {
3284
3285
  * if no form with that id + a `manual` trigger exists.
3285
3286
  */
3286
3287
  openForm: (id: string) => void;
3288
+ /**
3289
+ * Open the chat and send `text` as the visitor's message in the current conversation — for a site's own "Ask
3290
+ * about pricing" button. The message waits until the chat can take it (still connecting, a pre-chat form to
3291
+ * answer, a reply still arriving), then goes out.
3292
+ *
3293
+ * @example
3294
+ * ```ts
3295
+ * chat.ask('How do I book a session?');
3296
+ * ```
3297
+ */
3298
+ ask: (text: string) => void;
3287
3299
  /**
3288
3300
  * Subscribe to a lifecycle event. Returns an `off` function. See
3289
3301
  * {@link EventMap} for the full set + payload shapes — currently