@waniwani/sdk 0.18.1 → 0.19.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.
@@ -361,6 +361,8 @@ type WidgetEventDetail = {
361
361
  properties: {
362
362
  text: string;
363
363
  index: number;
364
+ /** Which provider supplied the clicked pill: `"channel"` (starter prompts), `"page"` (per-URL starter prompts), `"flow"` (an MCP flow's `interrupt({ suggestions })`), or `"followup"` (generated from the conversation). */
365
+ origin: SuggestionOrigin;
364
366
  };
365
367
  } | {
366
368
  name: "link.clicked";
@@ -474,6 +476,15 @@ interface WelcomeConfig {
474
476
  /** Suggestion cards shown in the welcome screen. Disappear after the first message. */
475
477
  suggestions?: string[];
476
478
  }
479
+ /** Where a suggestion pill came from. */
480
+ /**
481
+ * Every place a suggestion pill can come from. The single source of truth:
482
+ * {@link SuggestionOrigin} derives from it, and runtime validation reads it,
483
+ * so adding an origin is a one-line change.
484
+ */
485
+ declare const SUGGESTION_ORIGINS: readonly ["channel", "page", "flow", "followup"];
486
+ /** Where a suggestion pill came from. */
487
+ type SuggestionOrigin = (typeof SUGGESTION_ORIGINS)[number];
477
488
  interface SuggestionsConfig {
478
489
  /**
479
490
  * Initial suggestions to show before the user sends their first message.
@@ -481,8 +492,14 @@ interface SuggestionsConfig {
481
492
  */
482
493
  initial?: string[];
483
494
  /**
484
- * Enable AI-generated suggestions after each response.
485
- * Defaults to `true` when suggestions config is provided.
495
+ * Which providers may fill the pill row. Omitted, this defaults to
496
+ * `["channel", "page", "followup"]`: starter prompts and generated
497
+ * follow-ups render, flow-driven pills stay opt-in.
498
+ */
499
+ origins?: SuggestionOrigin[];
500
+ /**
501
+ * @deprecated Use `origins`. `true` maps to every origin, `false` to none.
502
+ * Will be removed in a future minor release.
486
503
  */
487
504
  dynamic?: boolean;
488
505
  }
@@ -564,8 +581,11 @@ interface ChatBaseProps {
564
581
  /** Callback fired when a response is received */
565
582
  onResponseReceived?: () => void;
566
583
  /**
567
- * Enable AI-generated suggestions after each response.
568
- * `true` enables with defaults (3 suggestions), object allows config, `false`/undefined disables.
584
+ * Suggestion pill configuration. Unset: no suggestions. An object sets
585
+ * starter prompts (`initial`) and which origins may fill the per-turn
586
+ * pill row (`origins`); `origins: ["flow"]` (or any list including
587
+ * `"flow"`) opts into flow-driven pills. `true` enables every origin with
588
+ * defaults; `false` hides the pill row entirely.
569
589
  */
570
590
  suggestions?: boolean | SuggestionsConfig;
571
591
  /**
@@ -903,6 +923,15 @@ interface WaniwaniChatOverrides {
903
923
  placeholder?: string;
904
924
  /** Initial suggestion chips. */
905
925
  suggestions?: string[];
926
+ /**
927
+ * Which providers may fill the per-turn pill row. Defaults to
928
+ * `["channel", "page", "followup"]` when unset: starter prompts and
929
+ * generated follow-ups render, flow-driven pills stay opt-in — include
930
+ * `"flow"` to render the pills a flow drives via
931
+ * `interrupt({ suggestions })`. Starter prompts (`suggestions`) are
932
+ * unaffected by this field and show either way.
933
+ */
934
+ suggestionOrigins?: SuggestionOrigin[];
906
935
  /** Persist conversations across reloads in IndexedDB. */
907
936
  enableThreadHistory?: boolean;
908
937
  /**