@waniwani/sdk 0.19.3 → 0.19.5
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/dist/chat/embed.js +59 -59
- package/dist/chat/embed.js.map +1 -1
- package/dist/chat/index.d.ts +36 -36
- package/dist/chat/index.js +7 -7
- package/dist/chat/index.js.map +1 -1
- package/dist/legacy/index.d.ts +33 -27
- package/dist/legacy/index.js +13 -13
- package/dist/legacy/index.js.map +1 -1
- package/dist/mcp/index.js +4 -4
- package/dist/mcp/index.js.map +1 -1
- package/package.json +1 -1
package/dist/legacy/index.d.ts
CHANGED
|
@@ -1437,6 +1437,30 @@ type MessageOverrides = DeepPartial<Messages>;
|
|
|
1437
1437
|
*/
|
|
1438
1438
|
type VisitorIdInput = string | (() => string | undefined | null | Promise<string | undefined | null>);
|
|
1439
1439
|
|
|
1440
|
+
/** One pill. `id` is null unless it came from an authored per-page prompt. */
|
|
1441
|
+
interface Suggestion {
|
|
1442
|
+
id: string | null;
|
|
1443
|
+
text: string;
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* One field per origin. `null` means the origin has nothing to say — no entry
|
|
1447
|
+
* on this turn, or the rung no longer applies.
|
|
1448
|
+
*
|
|
1449
|
+
* `flow` alone treats `[]` as authoritative: it clears the row and suppresses
|
|
1450
|
+
* every weaker rung. Elsewhere `[]` and `null` are the same.
|
|
1451
|
+
*/
|
|
1452
|
+
interface SuggestionCandidates {
|
|
1453
|
+
flow: Suggestion[] | null;
|
|
1454
|
+
followup: Suggestion[] | null;
|
|
1455
|
+
page: Suggestion[] | null;
|
|
1456
|
+
channel: Suggestion[] | null;
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* The rungs an embed host reads from `/config`. Grouped because they share a
|
|
1460
|
+
* source and a lifetime: both stop applying at the visitor's first message.
|
|
1461
|
+
*/
|
|
1462
|
+
type PreChatSuggestions = Pick<SuggestionCandidates, "page" | "channel">;
|
|
1463
|
+
|
|
1440
1464
|
/**
|
|
1441
1465
|
* Built-in theme presets. `auto` follows the host's `prefers-color-scheme`
|
|
1442
1466
|
* and switches at runtime without re-rendering.
|
|
@@ -1546,32 +1570,12 @@ interface WelcomeConfig {
|
|
|
1546
1570
|
/** Suggestion cards shown in the welcome screen. Disappear after the first message. */
|
|
1547
1571
|
suggestions?: string[];
|
|
1548
1572
|
}
|
|
1549
|
-
/** Where a suggestion pill came from. */
|
|
1550
|
-
/**
|
|
1551
|
-
* Every place a suggestion pill can come from. The single source of truth:
|
|
1552
|
-
* {@link SuggestionOrigin} derives from it, and runtime validation reads it,
|
|
1553
|
-
* so adding an origin is a one-line change.
|
|
1554
|
-
*/
|
|
1555
|
-
declare const SUGGESTION_ORIGINS: readonly ["channel", "page", "flow", "followup"];
|
|
1556
|
-
/** Where a suggestion pill came from. */
|
|
1557
|
-
type SuggestionOrigin = (typeof SUGGESTION_ORIGINS)[number];
|
|
1558
1573
|
interface SuggestionsConfig {
|
|
1559
1574
|
/**
|
|
1560
|
-
*
|
|
1575
|
+
* Starter prompts shown before the user sends their first message.
|
|
1561
1576
|
* Defaults to an empty array.
|
|
1562
1577
|
*/
|
|
1563
1578
|
initial?: string[];
|
|
1564
|
-
/**
|
|
1565
|
-
* Which providers may fill the pill row. Omitted, this defaults to
|
|
1566
|
-
* `["channel", "page", "followup"]`: starter prompts and generated
|
|
1567
|
-
* follow-ups render, flow-driven pills stay opt-in.
|
|
1568
|
-
*/
|
|
1569
|
-
origins?: SuggestionOrigin[];
|
|
1570
|
-
/**
|
|
1571
|
-
* @deprecated Use `origins`. `true` maps to every origin, `false` to none.
|
|
1572
|
-
* Will be removed in a future minor release.
|
|
1573
|
-
*/
|
|
1574
|
-
dynamic?: boolean;
|
|
1575
1579
|
}
|
|
1576
1580
|
/**
|
|
1577
1581
|
* Per-slot class name overrides for the chat widget. Each string is appended
|
|
@@ -1651,13 +1655,15 @@ interface ChatBaseProps {
|
|
|
1651
1655
|
/** Callback fired when a response is received */
|
|
1652
1656
|
onResponseReceived?: () => void;
|
|
1653
1657
|
/**
|
|
1654
|
-
* Suggestion
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1657
|
-
* `
|
|
1658
|
-
*
|
|
1658
|
+
* Suggestion pills. The row obeys a fixed hierarchy — flow > followup >
|
|
1659
|
+
* page > channel — and every origin is always active.
|
|
1660
|
+
*
|
|
1661
|
+
* `false` hides the row; `true` / unset is the default. `{ initial: [...] }`
|
|
1662
|
+
* sets starter prompts. Embed hosts pass the resolved
|
|
1663
|
+
* {@link PreChatSuggestions} from `useSuggestions(config)` instead, which
|
|
1664
|
+
* carries the prompt ids needed for click attribution.
|
|
1659
1665
|
*/
|
|
1660
|
-
suggestions?: boolean | SuggestionsConfig;
|
|
1666
|
+
suggestions?: boolean | SuggestionsConfig | PreChatSuggestions;
|
|
1661
1667
|
/**
|
|
1662
1668
|
* Handler for MCP tool calls from widgets.
|
|
1663
1669
|
* Called when a widget uses `callServerTool` (MCP Apps standard).
|