@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
|
@@ -17,8 +17,12 @@ interface KbSearchTrace {
|
|
|
17
17
|
* first-class names at runtime (the widget transport passes these through
|
|
18
18
|
* verbatim instead of namespacing them as custom widget events).
|
|
19
19
|
*/
|
|
20
|
-
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"];
|
|
20
|
+
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"];
|
|
21
21
|
type EventType = (typeof EVENT_TYPES)[number];
|
|
22
|
+
declare const SESSION_ERROR_CODES: readonly ["agent_failed", "tool_failed", "upstream_failed"];
|
|
23
|
+
type SessionErrorCodeType = (typeof SESSION_ERROR_CODES)[number];
|
|
24
|
+
declare const ERROR_CAUSES: readonly ["timeout", "rate_limited", "upstream_4xx", "upstream_5xx", "network", "invalid_output", "flow_dead_end", "flow_unknown_node", "flow_loop", "unknown"];
|
|
25
|
+
type ErrorCauseType = (typeof ERROR_CAUSES)[number];
|
|
22
26
|
/**
|
|
23
27
|
* Properties for `page.viewed` — emitted once when the chat widget initializes
|
|
24
28
|
* on a host page (the top of the funnel). Attributed to the anonymous
|
|
@@ -45,6 +49,7 @@ interface ToolCalledProperties {
|
|
|
45
49
|
type?: "pricing" | "product_info" | "availability" | "support" | "other";
|
|
46
50
|
/** Retrieval traces for kb.search() calls made inside this tool handler. */
|
|
47
51
|
kbSearch?: KbSearchTrace[];
|
|
52
|
+
cause?: ErrorCauseType;
|
|
48
53
|
}
|
|
49
54
|
interface LinkClickedProperties {
|
|
50
55
|
url?: string;
|
|
@@ -91,6 +96,12 @@ interface ConvertedProperties {
|
|
|
91
96
|
/** When the conversion actually happened — for backdated off-platform sales. */
|
|
92
97
|
occurredAt?: string;
|
|
93
98
|
}
|
|
99
|
+
interface SessionErrorProperties {
|
|
100
|
+
code: SessionErrorCodeType;
|
|
101
|
+
cause: ErrorCauseType;
|
|
102
|
+
tool?: string;
|
|
103
|
+
node?: string;
|
|
104
|
+
}
|
|
94
105
|
interface TrackingContext {
|
|
95
106
|
/**
|
|
96
107
|
* MCP request metadata passed through to the API.
|
|
@@ -157,6 +168,9 @@ type TrackEvent = ({
|
|
|
157
168
|
} & BaseTrackEvent) | ({
|
|
158
169
|
event: "converted";
|
|
159
170
|
properties?: ConvertedProperties;
|
|
171
|
+
} & BaseTrackEvent) | ({
|
|
172
|
+
event: "session.error";
|
|
173
|
+
properties?: SessionErrorProperties;
|
|
160
174
|
} & BaseTrackEvent);
|
|
161
175
|
/**
|
|
162
176
|
* Legacy tracking shape supported for existing integrations.
|
package/dist/mcp/react.d.ts
CHANGED
|
@@ -661,8 +661,12 @@ interface KbSearchTrace {
|
|
|
661
661
|
* first-class names at runtime (the widget transport passes these through
|
|
662
662
|
* verbatim instead of namespacing them as custom widget events).
|
|
663
663
|
*/
|
|
664
|
-
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"];
|
|
664
|
+
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"];
|
|
665
665
|
type EventType = (typeof EVENT_TYPES)[number];
|
|
666
|
+
declare const SESSION_ERROR_CODES: readonly ["agent_failed", "tool_failed", "upstream_failed"];
|
|
667
|
+
type SessionErrorCodeType = (typeof SESSION_ERROR_CODES)[number];
|
|
668
|
+
declare const ERROR_CAUSES: readonly ["timeout", "rate_limited", "upstream_4xx", "upstream_5xx", "network", "invalid_output", "flow_dead_end", "flow_unknown_node", "flow_loop", "unknown"];
|
|
669
|
+
type ErrorCauseType = (typeof ERROR_CAUSES)[number];
|
|
666
670
|
/**
|
|
667
671
|
* Properties for `page.viewed` — emitted once when the chat widget initializes
|
|
668
672
|
* on a host page (the top of the funnel). Attributed to the anonymous
|
|
@@ -689,6 +693,7 @@ interface ToolCalledProperties {
|
|
|
689
693
|
type?: "pricing" | "product_info" | "availability" | "support" | "other";
|
|
690
694
|
/** Retrieval traces for kb.search() calls made inside this tool handler. */
|
|
691
695
|
kbSearch?: KbSearchTrace[];
|
|
696
|
+
cause?: ErrorCauseType;
|
|
692
697
|
}
|
|
693
698
|
interface LinkClickedProperties {
|
|
694
699
|
url?: string;
|
|
@@ -735,6 +740,12 @@ interface ConvertedProperties {
|
|
|
735
740
|
/** When the conversion actually happened — for backdated off-platform sales. */
|
|
736
741
|
occurredAt?: string;
|
|
737
742
|
}
|
|
743
|
+
interface SessionErrorProperties {
|
|
744
|
+
code: SessionErrorCodeType;
|
|
745
|
+
cause: ErrorCauseType;
|
|
746
|
+
tool?: string;
|
|
747
|
+
node?: string;
|
|
748
|
+
}
|
|
738
749
|
interface TrackingContext {
|
|
739
750
|
/**
|
|
740
751
|
* MCP request metadata passed through to the API.
|
|
@@ -801,6 +812,9 @@ type TrackEvent = ({
|
|
|
801
812
|
} & BaseTrackEvent) | ({
|
|
802
813
|
event: "converted";
|
|
803
814
|
properties?: ConvertedProperties;
|
|
815
|
+
} & BaseTrackEvent) | ({
|
|
816
|
+
event: "session.error";
|
|
817
|
+
properties?: SessionErrorProperties;
|
|
804
818
|
} & BaseTrackEvent);
|
|
805
819
|
/**
|
|
806
820
|
* Legacy tracking shape supported for existing integrations.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waniwani/sdk",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.7",
|
|
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": {
|