@waniwani/sdk 0.17.0 → 0.17.2
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 +93 -93
- package/dist/chat/embed.js.map +1 -1
- package/dist/chat/index.d.ts +100 -1
- package/dist/chat/index.js +7 -7
- package/dist/chat/index.js.map +1 -1
- package/dist/legacy/index.d.ts +38 -0
- package/dist/legacy/index.js +13 -13
- package/dist/legacy/index.js.map +1 -1
- package/dist/mcp/index.d.ts +15 -0
- package/dist/mcp/index.js +5 -5
- package/dist/mcp/index.js.map +1 -1
- package/package.json +1 -1
package/dist/legacy/index.d.ts
CHANGED
|
@@ -435,6 +435,21 @@ interface ScopedWaniWaniClient {
|
|
|
435
435
|
* `sessionId` later). `undefined` when the host provided no session id.
|
|
436
436
|
*/
|
|
437
437
|
readonly sessionId?: string;
|
|
438
|
+
/**
|
|
439
|
+
* The anonymous visitor id, resolved from the request meta. Present on the
|
|
440
|
+
* web chat surface (a persisted per-device id threaded through as
|
|
441
|
+
* `waniwani/visitorId`); `undefined` on hosts that do not supply one, such
|
|
442
|
+
* as Claude. Ingest accepts it as an identity in its own right, so use it
|
|
443
|
+
* to correlate events before a session or user id exists.
|
|
444
|
+
*/
|
|
445
|
+
readonly visitorId?: string;
|
|
446
|
+
/**
|
|
447
|
+
* The external user id, resolved from the request meta (e.g. `openai/userId`
|
|
448
|
+
* for ChatGPT's anonymous users, or a host-provided `externalUserId`). Read
|
|
449
|
+
* it alongside `sessionId`/`visitorId` — whichever the current host provides.
|
|
450
|
+
* `undefined` when the host supplied no user id.
|
|
451
|
+
*/
|
|
452
|
+
readonly externalUserId?: string;
|
|
438
453
|
/**
|
|
439
454
|
* Track an event — request meta is automatically merged. Also exposes the
|
|
440
455
|
* revenue helpers flat (`track.priceShown()`, `track.converted()`, …), which
|
|
@@ -1436,6 +1451,14 @@ type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T extends ob
|
|
|
1436
1451
|
} : T;
|
|
1437
1452
|
type MessageOverrides = DeepPartial<Messages>;
|
|
1438
1453
|
|
|
1454
|
+
/**
|
|
1455
|
+
* A visitor id to apply, or a resolver that produces one. The resolver may be
|
|
1456
|
+
* sync (`() => posthog.get_distinct_id()`) or async
|
|
1457
|
+
* (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is only
|
|
1458
|
+
* available after they bootstrap.
|
|
1459
|
+
*/
|
|
1460
|
+
type VisitorIdInput = string | (() => string | undefined | null | Promise<string | undefined | null>);
|
|
1461
|
+
|
|
1439
1462
|
/**
|
|
1440
1463
|
* Built-in theme presets. `auto` follows the host's `prefers-color-scheme`
|
|
1441
1464
|
* and switches at runtime without re-rendering.
|
|
@@ -1594,6 +1617,21 @@ interface ChatBaseProps {
|
|
|
1594
1617
|
appearance?: ChatAppearance;
|
|
1595
1618
|
/** Per-slot class name overrides. See {@link ChatClassNames}. */
|
|
1596
1619
|
classNames?: ChatClassNames;
|
|
1620
|
+
/**
|
|
1621
|
+
* Override the anonymous visitor id the widget generates with one you
|
|
1622
|
+
* already track (a PostHog / Amplitude / Segment distinct id, your own
|
|
1623
|
+
* cookie, etc.). The chat sends it on every request, so Waniwani sessions
|
|
1624
|
+
* and events correlate to the same visitor, and server-side MCP tools and
|
|
1625
|
+
* flows read it back as `context.waniwani.visitorId`.
|
|
1626
|
+
*
|
|
1627
|
+
* A string, or a resolver that returns one — sync
|
|
1628
|
+
* (`() => posthog.get_distinct_id()`) or async
|
|
1629
|
+
* (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is
|
|
1630
|
+
* only ready after they bootstrap. A blank / failed result is ignored, so
|
|
1631
|
+
* the auto-generated, `localStorage`-persisted id is kept. Leave unset to
|
|
1632
|
+
* always use the auto id.
|
|
1633
|
+
*/
|
|
1634
|
+
visitorId?: VisitorIdInput;
|
|
1597
1635
|
/** Additional headers to send with chat API requests */
|
|
1598
1636
|
headers?: Record<string, string>;
|
|
1599
1637
|
/** Additional body fields to send with each chat request */
|