@waniwani/sdk 0.17.2 → 0.18.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.
@@ -336,64 +336,6 @@ type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T extends ob
336
336
  } : T;
337
337
  type MessageOverrides = DeepPartial<Messages>;
338
338
 
339
- /**
340
- * A visitor id to apply, or a resolver that produces one. The resolver may be
341
- * sync (`() => posthog.get_distinct_id()`) or async
342
- * (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is only
343
- * available after they bootstrap.
344
- */
345
- type VisitorIdInput = string | (() => string | undefined | null | Promise<string | undefined | null>);
346
-
347
- /** Surface the widget is mounted on. */
348
- type WidgetMode = "inline" | "floating";
349
- interface WidgetEventBase {
350
- /** Surface the widget is mounted on. */
351
- mode: WidgetMode;
352
- /**
353
- * Conversation session id, when one exists. Assigned on the first
354
- * exchange, so it is `undefined` for events that precede it.
355
- */
356
- sessionId?: string;
357
- /** Epoch milliseconds at emit time. */
358
- timestamp: number;
359
- }
360
- /**
361
- * Per-event discriminant and extra properties. Events in the first branch
362
- * carry no `properties` object.
363
- */
364
- type WidgetEventDetail = {
365
- name: "chat.ready" | "chat.opened" | "chat.closed" | "message.sent" | "message.received";
366
- } | {
367
- name: "session.started";
368
- properties: {
369
- sessionId: string;
370
- };
371
- } | {
372
- name: "thread.changed";
373
- properties: {
374
- threadId: string;
375
- };
376
- } | {
377
- name: "chat.error";
378
- properties: {
379
- message: string;
380
- };
381
- } | {
382
- name: "suggestion.clicked";
383
- properties: {
384
- text: string;
385
- index: number;
386
- };
387
- } | {
388
- name: "link.clicked";
389
- properties: {
390
- url: string;
391
- };
392
- };
393
- /** Payload handed to `onEvent` subscribers. Discriminated on `name`. */
394
- type WidgetEvent = WidgetEventBase & WidgetEventDetail;
395
- type WidgetEventName = WidgetEventDetail["name"];
396
-
397
339
  /**
398
340
  * Built-in theme presets. `auto` follows the host's `prefers-color-scheme`
399
341
  * and switches at runtime without re-rendering.
@@ -552,21 +494,6 @@ interface ChatBaseProps {
552
494
  appearance?: ChatAppearance;
553
495
  /** Per-slot class name overrides. See {@link ChatClassNames}. */
554
496
  classNames?: ChatClassNames;
555
- /**
556
- * Override the anonymous visitor id the widget generates with one you
557
- * already track (a PostHog / Amplitude / Segment distinct id, your own
558
- * cookie, etc.). The chat sends it on every request, so Waniwani sessions
559
- * and events correlate to the same visitor, and server-side MCP tools and
560
- * flows read it back as `context.waniwani.visitorId`.
561
- *
562
- * A string, or a resolver that returns one — sync
563
- * (`() => posthog.get_distinct_id()`) or async
564
- * (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is
565
- * only ready after they bootstrap. A blank / failed result is ignored, so
566
- * the auto-generated, `localStorage`-persisted id is kept. Leave unset to
567
- * always use the auto id.
568
- */
569
- visitorId?: VisitorIdInput;
570
497
  /** Additional headers to send with chat API requests */
571
498
  headers?: Record<string, string>;
572
499
  /** Additional body fields to send with each chat request */
@@ -1018,22 +945,6 @@ interface WaniwaniChatProps {
1018
945
  token: string;
1019
946
  /** Agent channel ID — routes the conversation to the right agent. */
1020
947
  channelId?: string;
1021
- /**
1022
- * Override the anonymous visitor id the widget generates with one you
1023
- * already track (a PostHog / Amplitude / Segment distinct id, your own
1024
- * cookie, etc.). The chat sends it on every request, so Waniwani sessions
1025
- * and events correlate to the same visitor, and server-side MCP tools and
1026
- * flows read it back as `context.waniwani.visitorId`.
1027
- *
1028
- * A string, or a resolver that returns one — sync
1029
- * (`() => posthog.get_distinct_id()`) or async
1030
- * (`async () => (await sdk.ready()).id`), for analytics SDKs whose id is only
1031
- * ready after they bootstrap. Read live on each request, so updating it
1032
- * applies to the next message. A blank / failed result is ignored, keeping
1033
- * the auto-generated, `localStorage`-persisted id. Leave unset to always use
1034
- * the auto id.
1035
- */
1036
- visitorId?: VisitorIdInput;
1037
948
  /** Additional class names applied to the root element. */
1038
949
  className?: string;
1039
950
  /**
@@ -1043,16 +954,6 @@ interface WaniwaniChatProps {
1043
954
  * can't be serialized to the dashboard).
1044
955
  */
1045
956
  overrides?: WaniwaniChatOverrides;
1046
- /**
1047
- * Callback fired on chat lifecycle events (`chat.ready`, `message.sent`,
1048
- * `message.received`, `session.started`, `thread.changed`, `chat.error`,
1049
- * `suggestion.clicked`, `link.clicked`; `chat.opened`/`chat.closed` are
1050
- * floating-embed-only and never fire here). Message events never include
1051
- * the message text. Use it to mirror widget activity into the host page's
1052
- * analytics. Exceptions thrown by the callback are swallowed and never
1053
- * break the chat.
1054
- */
1055
- onEvent?: (event: WidgetEvent) => void;
1056
957
  }
1057
958
  declare const WaniwaniChat: react.ForwardRefExoticComponent<WaniwaniChatProps & react.RefAttributes<ChatHandle>>;
1058
959
 
@@ -1068,4 +969,4 @@ declare function mergeTheme(userTheme?: ChatTheme): Required<ChatTheme>;
1068
969
  */
1069
970
  declare function themeToCSSProperties(theme: ChatTheme): Record<string, string>;
1070
971
 
1071
- export { type ChatAppearance, type ChatBaseProps, ChatCard, type ChatCardProps, ChatEmbed, type ChatEmbedMcpConfig, type ChatEmbedProps, type ChatHandle, type ChatTheme, DARK_THEME, DEFAULT_THEME, type McpAppDisplayMode, McpAppFrame, type McpAppFrameProps, type ShowToolCalls, type SuggestionsConfig, type ThemePreset, WaniwaniChat, type WaniwaniChatOverrides, type WaniwaniChatProps, type WelcomeConfig, type WidgetEvent, type WidgetEventName, type WidgetMode, mergeTheme, themeToCSSProperties };
972
+ export { type ChatAppearance, type ChatBaseProps, ChatCard, type ChatCardProps, ChatEmbed, type ChatEmbedMcpConfig, type ChatEmbedProps, type ChatHandle, type ChatTheme, DARK_THEME, DEFAULT_THEME, type McpAppDisplayMode, McpAppFrame, type McpAppFrameProps, type ShowToolCalls, type SuggestionsConfig, type ThemePreset, WaniwaniChat, type WaniwaniChatOverrides, type WaniwaniChatProps, type WelcomeConfig, mergeTheme, themeToCSSProperties };