@helpai/elements 1.7.0 → 1.8.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
@@ -3222,6 +3222,11 @@ interface OpenTarget {
3222
3222
  to: 'home' | 'chats' | 'help' | 'news';
3223
3223
  id?: string;
3224
3224
  }
3225
+ /** How `ask(text, options)` lands: in the composer for the visitor to send (default), or sent right away. */
3226
+ interface AskOptions {
3227
+ /** Send the text as the visitor's message instead of filling the composer with it. Default `false`. */
3228
+ send?: boolean;
3229
+ }
3225
3230
  /**
3226
3231
  * Comprehensive logger for the widget runtime.
3227
3232
  *
@@ -3286,16 +3291,17 @@ export interface ChatWidgetInstance {
3286
3291
  */
3287
3292
  openForm: (id: string) => void;
3288
3293
  /**
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.
3294
+ * Open the chat with `text` in the composer, ready for the visitor to edit and send — for a site's own "Ask about
3295
+ * pricing" button. With `{ send: true }` it goes out as the visitor's message instead. Either way it waits until
3296
+ * the chat can take it (still connecting, a pre-chat form to answer; a send also waits for a reply still arriving).
3292
3297
  *
3293
3298
  * @example
3294
3299
  * ```ts
3295
- * chat.ask('How do I book a session?');
3300
+ * chat.ask('How do I book a session?'); // open the chat with the question in the composer
3301
+ * chat.ask('How do I book a session?', { send: true }); // open the chat and send it
3296
3302
  * ```
3297
3303
  */
3298
- ask: (text: string) => void;
3304
+ ask: (text: string, options?: AskOptions) => void;
3299
3305
  /**
3300
3306
  * Subscribe to a lifecycle event. Returns an `off` function. See
3301
3307
  * {@link EventMap} for the full set + payload shapes — currently
@@ -3439,4 +3445,4 @@ export declare const brand: {
3439
3445
  readonly domain: string;
3440
3446
  readonly siteUrl: string;
3441
3447
  };
3442
- export type { Asset, BlocksConfig, ChatWidgetOptions, ConnectionConfig, ConnectionConfigPartial, EventMap, EventName, HandshakeResponse, HookListener, Link, LogEntry, LogLevel, OpenTarget, ResolvedOptions, ServerConfig, SiteConfig, WidgetConfig, WidgetConfigPartial, WidgetSettings, WidgetSettingsPartial };
3448
+ export type { AskOptions, Asset, BlocksConfig, ChatWidgetOptions, ConnectionConfig, ConnectionConfigPartial, EventMap, EventName, HandshakeResponse, HookListener, Link, LogEntry, LogLevel, OpenTarget, ResolvedOptions, ServerConfig, SiteConfig, WidgetConfig, WidgetConfigPartial, WidgetSettings, WidgetSettingsPartial };