@waniwani/sdk 0.17.1 → 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.
@@ -1451,6 +1451,14 @@ type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T extends ob
1451
1451
  } : T;
1452
1452
  type MessageOverrides = DeepPartial<Messages>;
1453
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
+
1454
1462
  /**
1455
1463
  * Built-in theme presets. `auto` follows the host's `prefers-color-scheme`
1456
1464
  * and switches at runtime without re-rendering.
@@ -1609,6 +1617,21 @@ interface ChatBaseProps {
1609
1617
  appearance?: ChatAppearance;
1610
1618
  /** Per-slot class name overrides. See {@link ChatClassNames}. */
1611
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;
1612
1635
  /** Additional headers to send with chat API requests */
1613
1636
  headers?: Record<string, string>;
1614
1637
  /** Additional body fields to send with each chat request */