@waniwani/sdk 0.19.5 → 0.19.7
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 +67 -67
- package/dist/chat/embed.js.map +1 -1
- package/dist/chat/express-js/index.d.ts +15 -1
- package/dist/chat/index.d.ts +23 -1
- package/dist/chat/index.js +7 -7
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/next-js/index.d.ts +15 -1
- package/dist/chat/styles.css +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/legacy/chat/express-js/index.d.ts +15 -1
- package/dist/legacy/chat/next-js/index.d.ts +15 -1
- package/dist/legacy/index.d.ts +15 -1
- package/dist/mcp/index.d.ts +17 -3
- package/dist/mcp/index.js +5 -5
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/react/skybridge.d.ts +15 -1
- package/dist/mcp/react.d.ts +15 -1
- package/package.json +1 -1
|
@@ -68,8 +68,12 @@ interface KbClient {
|
|
|
68
68
|
* first-class names at runtime (the widget transport passes these through
|
|
69
69
|
* verbatim instead of namespacing them as custom widget events).
|
|
70
70
|
*/
|
|
71
|
-
declare const EVENT_TYPES: readonly ["session.started", "page.viewed", "tool.called", "link.clicked", "widget_render", "user.identified", "price_shown", "prices_compared", "option_selected", "lead_qualified", "converted"];
|
|
71
|
+
declare const EVENT_TYPES: readonly ["session.started", "page.viewed", "tool.called", "link.clicked", "widget_render", "user.identified", "price_shown", "prices_compared", "option_selected", "lead_qualified", "converted", "session.error"];
|
|
72
72
|
type EventType = (typeof EVENT_TYPES)[number];
|
|
73
|
+
declare const SESSION_ERROR_CODES: readonly ["agent_failed", "tool_failed", "upstream_failed"];
|
|
74
|
+
type SessionErrorCodeType = (typeof SESSION_ERROR_CODES)[number];
|
|
75
|
+
declare const ERROR_CAUSES: readonly ["timeout", "rate_limited", "upstream_4xx", "upstream_5xx", "network", "invalid_output", "flow_dead_end", "flow_unknown_node", "flow_loop", "unknown"];
|
|
76
|
+
type ErrorCauseType = (typeof ERROR_CAUSES)[number];
|
|
73
77
|
/**
|
|
74
78
|
* Properties for `page.viewed` — emitted once when the chat widget initializes
|
|
75
79
|
* on a host page (the top of the funnel). Attributed to the anonymous
|
|
@@ -96,6 +100,7 @@ interface ToolCalledProperties {
|
|
|
96
100
|
type?: "pricing" | "product_info" | "availability" | "support" | "other";
|
|
97
101
|
/** Retrieval traces for kb.search() calls made inside this tool handler. */
|
|
98
102
|
kbSearch?: KbSearchTrace[];
|
|
103
|
+
cause?: ErrorCauseType;
|
|
99
104
|
}
|
|
100
105
|
interface LinkClickedProperties {
|
|
101
106
|
url?: string;
|
|
@@ -142,6 +147,12 @@ interface ConvertedProperties {
|
|
|
142
147
|
/** When the conversion actually happened — for backdated off-platform sales. */
|
|
143
148
|
occurredAt?: string;
|
|
144
149
|
}
|
|
150
|
+
interface SessionErrorProperties {
|
|
151
|
+
code: SessionErrorCodeType;
|
|
152
|
+
cause: ErrorCauseType;
|
|
153
|
+
tool?: string;
|
|
154
|
+
node?: string;
|
|
155
|
+
}
|
|
145
156
|
interface TrackingContext {
|
|
146
157
|
/**
|
|
147
158
|
* MCP request metadata passed through to the API.
|
|
@@ -208,6 +219,9 @@ type TrackEvent = ({
|
|
|
208
219
|
} & BaseTrackEvent) | ({
|
|
209
220
|
event: "converted";
|
|
210
221
|
properties?: ConvertedProperties;
|
|
222
|
+
} & BaseTrackEvent) | ({
|
|
223
|
+
event: "session.error";
|
|
224
|
+
properties?: SessionErrorProperties;
|
|
211
225
|
} & BaseTrackEvent);
|
|
212
226
|
/**
|
|
213
227
|
* Legacy tracking shape supported for existing integrations.
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -22,8 +22,12 @@ interface KbSearchTrace {
|
|
|
22
22
|
* first-class names at runtime (the widget transport passes these through
|
|
23
23
|
* verbatim instead of namespacing them as custom widget events).
|
|
24
24
|
*/
|
|
25
|
-
declare const EVENT_TYPES: readonly ["session.started", "page.viewed", "tool.called", "link.clicked", "widget_render", "user.identified", "price_shown", "prices_compared", "option_selected", "lead_qualified", "converted"];
|
|
25
|
+
declare const EVENT_TYPES: readonly ["session.started", "page.viewed", "tool.called", "link.clicked", "widget_render", "user.identified", "price_shown", "prices_compared", "option_selected", "lead_qualified", "converted", "session.error"];
|
|
26
26
|
type EventType = (typeof EVENT_TYPES)[number];
|
|
27
|
+
declare const SESSION_ERROR_CODES: readonly ["agent_failed", "tool_failed", "upstream_failed"];
|
|
28
|
+
type SessionErrorCodeType = (typeof SESSION_ERROR_CODES)[number];
|
|
29
|
+
declare const ERROR_CAUSES: readonly ["timeout", "rate_limited", "upstream_4xx", "upstream_5xx", "network", "invalid_output", "flow_dead_end", "flow_unknown_node", "flow_loop", "unknown"];
|
|
30
|
+
type ErrorCauseType = (typeof ERROR_CAUSES)[number];
|
|
27
31
|
/**
|
|
28
32
|
* Properties for `page.viewed` — emitted once when the chat widget initializes
|
|
29
33
|
* on a host page (the top of the funnel). Attributed to the anonymous
|
|
@@ -50,6 +54,7 @@ interface ToolCalledProperties {
|
|
|
50
54
|
type?: "pricing" | "product_info" | "availability" | "support" | "other";
|
|
51
55
|
/** Retrieval traces for kb.search() calls made inside this tool handler. */
|
|
52
56
|
kbSearch?: KbSearchTrace[];
|
|
57
|
+
cause?: ErrorCauseType;
|
|
53
58
|
}
|
|
54
59
|
interface LinkClickedProperties {
|
|
55
60
|
url?: string;
|
|
@@ -96,6 +101,12 @@ interface ConvertedProperties {
|
|
|
96
101
|
/** When the conversion actually happened — for backdated off-platform sales. */
|
|
97
102
|
occurredAt?: string;
|
|
98
103
|
}
|
|
104
|
+
interface SessionErrorProperties {
|
|
105
|
+
code: SessionErrorCodeType;
|
|
106
|
+
cause: ErrorCauseType;
|
|
107
|
+
tool?: string;
|
|
108
|
+
node?: string;
|
|
109
|
+
}
|
|
99
110
|
interface TrackingContext {
|
|
100
111
|
/**
|
|
101
112
|
* MCP request metadata passed through to the API.
|
|
@@ -162,6 +173,9 @@ type TrackEvent = ({
|
|
|
162
173
|
} & BaseTrackEvent) | ({
|
|
163
174
|
event: "converted";
|
|
164
175
|
properties?: ConvertedProperties;
|
|
176
|
+
} & BaseTrackEvent) | ({
|
|
177
|
+
event: "session.error";
|
|
178
|
+
properties?: SessionErrorProperties;
|
|
165
179
|
} & BaseTrackEvent);
|
|
166
180
|
/**
|
|
167
181
|
* Legacy tracking shape supported for existing integrations.
|
|
@@ -774,6 +788,14 @@ interface ChatEmbedProps extends Omit<ChatBaseProps, "api" | "onCallTool"> {
|
|
|
774
788
|
* should leave this unset.
|
|
775
789
|
*/
|
|
776
790
|
initializing?: boolean;
|
|
791
|
+
/**
|
|
792
|
+
* @internal
|
|
793
|
+
* Whether the chat is actually on screen. `false` suppresses
|
|
794
|
+
* `suggestions.shown` impressions, so a mount kept hidden behind other
|
|
795
|
+
* chrome (the floating dock) never reports pills the visitor cannot see.
|
|
796
|
+
* Defaults to `true`; standalone `ChatEmbed` callers should leave it unset.
|
|
797
|
+
*/
|
|
798
|
+
onScreen?: boolean;
|
|
777
799
|
}
|
|
778
800
|
interface ChatHandle {
|
|
779
801
|
/** Programmatically send a user message into the chat */
|