@waniwani/sdk 0.14.0 → 0.14.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.
@@ -62,7 +62,28 @@ interface KbClient {
62
62
  sources(): Promise<KbSource[]>;
63
63
  }
64
64
 
65
- type EventType = "session.started" | "tool.called" | "quote.requested" | "quote.succeeded" | "quote.failed" | "link.clicked" | "purchase.completed" | "widget_render" | "widget_click" | "widget_link_click" | "widget_error" | "widget_scroll" | "widget_form_field" | "widget_form_submit" | "user.identified" | "price_shown" | "prices_compared" | "option_selected" | "lead" | "converted";
65
+ type EventType = "session.started" | "page.viewed" | "tool.called" | "quote.requested" | "quote.succeeded" | "quote.failed" | "link.clicked" | "purchase.completed" | "widget_render" | "widget_click" | "widget_link_click" | "widget_error" | "widget_scroll" | "widget_form_field" | "widget_form_submit" | "user.identified" | "price_shown" | "prices_compared" | "option_selected" | "lead" | "converted";
66
+ /**
67
+ * Properties for `page.viewed` — emitted once when the chat widget initializes
68
+ * on a host page (the top of the funnel). Attributed to the anonymous
69
+ * `visitorId` (mapped to `externalUserId`), never to a session: a page view
70
+ * must not create a session, otherwise sessions would equal page views and the
71
+ * "landed → started a conversation" funnel collapses.
72
+ */
73
+ interface PageViewedProperties {
74
+ /** Full URL of the host page the widget loaded on. */
75
+ url?: string;
76
+ /** Referrer of the host page, if any. */
77
+ referrer?: string;
78
+ /** Embed mode the widget initialized in. */
79
+ mode?: "inline" | "floating";
80
+ /** Resolved device type from the visitor context. */
81
+ deviceType?: "mobile" | "tablet" | "desktop";
82
+ /** Primary browser language (BCP-47). */
83
+ language?: string;
84
+ /** IANA timezone of the visitor. */
85
+ timezone?: string;
86
+ }
66
87
  interface ToolCalledProperties {
67
88
  name?: string;
68
89
  type?: "pricing" | "product_info" | "availability" | "support" | "other";
@@ -137,6 +158,9 @@ interface BaseTrackEvent extends TrackingContext {
137
158
  }
138
159
  type TrackEvent = ({
139
160
  event: "session.started";
161
+ } & BaseTrackEvent) | ({
162
+ event: "page.viewed";
163
+ properties?: PageViewedProperties;
140
164
  } & BaseTrackEvent) | ({
141
165
  event: "tool.called";
142
166
  properties?: ToolCalledProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waniwani/sdk",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "MCP distribution SDK. Build sales funnels, lead generation, booking, and quote apps on top of your MCP server. Event tracking, flows, widgets, knowledge base.",
5
5
  "type": "module",
6
6
  "exports": {