vanilla-agent 1.23.0 → 1.24.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.
- package/dist/index.cjs +21 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -6
- package/dist/index.d.ts +33 -6
- package/dist/index.global.js +43 -43
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +33 -6
- package/src/utils/code-generators.ts +237 -0
package/dist/index.d.cts
CHANGED
|
@@ -146,6 +146,23 @@ type AgentWidgetMessageFeedback = {
|
|
|
146
146
|
};
|
|
147
147
|
/**
|
|
148
148
|
* Configuration for message action buttons (copy, upvote, downvote)
|
|
149
|
+
*
|
|
150
|
+
* **Client Token Mode**: When using `clientToken`, feedback is automatically
|
|
151
|
+
* sent to your Travrse backend. Just enable the buttons and you're done!
|
|
152
|
+
* The `onFeedback` and `onCopy` callbacks are optional for additional local handling.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* // With clientToken - feedback is automatic!
|
|
157
|
+
* config: {
|
|
158
|
+
* clientToken: 'ct_live_...',
|
|
159
|
+
* messageActions: {
|
|
160
|
+
* showUpvote: true,
|
|
161
|
+
* showDownvote: true,
|
|
162
|
+
* // No onFeedback needed - sent to backend automatically
|
|
163
|
+
* }
|
|
164
|
+
* }
|
|
165
|
+
* ```
|
|
149
166
|
*/
|
|
150
167
|
type AgentWidgetMessageActionsConfig = {
|
|
151
168
|
/**
|
|
@@ -159,13 +176,15 @@ type AgentWidgetMessageActionsConfig = {
|
|
|
159
176
|
*/
|
|
160
177
|
showCopy?: boolean;
|
|
161
178
|
/**
|
|
162
|
-
* Show upvote button
|
|
163
|
-
*
|
|
179
|
+
* Show upvote button.
|
|
180
|
+
* When using `clientToken`, feedback is sent to the backend automatically.
|
|
181
|
+
* @default false
|
|
164
182
|
*/
|
|
165
183
|
showUpvote?: boolean;
|
|
166
184
|
/**
|
|
167
|
-
* Show downvote button
|
|
168
|
-
*
|
|
185
|
+
* Show downvote button.
|
|
186
|
+
* When using `clientToken`, feedback is sent to the backend automatically.
|
|
187
|
+
* @default false
|
|
169
188
|
*/
|
|
170
189
|
showDownvote?: boolean;
|
|
171
190
|
/**
|
|
@@ -186,11 +205,19 @@ type AgentWidgetMessageActionsConfig = {
|
|
|
186
205
|
*/
|
|
187
206
|
layout?: "pill-inside" | "row-inside";
|
|
188
207
|
/**
|
|
189
|
-
* Callback when user submits feedback (upvote/downvote)
|
|
208
|
+
* Callback when user submits feedback (upvote/downvote).
|
|
209
|
+
*
|
|
210
|
+
* **Note**: When using `clientToken`, feedback is AUTOMATICALLY sent to your
|
|
211
|
+
* backend via `/v1/client/feedback`. This callback is called IN ADDITION to
|
|
212
|
+
* the automatic submission, useful for updating local UI or analytics.
|
|
190
213
|
*/
|
|
191
214
|
onFeedback?: (feedback: AgentWidgetMessageFeedback) => void;
|
|
192
215
|
/**
|
|
193
|
-
* Callback when user copies a message
|
|
216
|
+
* Callback when user copies a message.
|
|
217
|
+
*
|
|
218
|
+
* **Note**: When using `clientToken`, copy events are AUTOMATICALLY tracked
|
|
219
|
+
* via `/v1/client/feedback`. This callback is called IN ADDITION to the
|
|
220
|
+
* automatic tracking.
|
|
194
221
|
*/
|
|
195
222
|
onCopy?: (message: AgentWidgetMessage) => void;
|
|
196
223
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,23 @@ type AgentWidgetMessageFeedback = {
|
|
|
146
146
|
};
|
|
147
147
|
/**
|
|
148
148
|
* Configuration for message action buttons (copy, upvote, downvote)
|
|
149
|
+
*
|
|
150
|
+
* **Client Token Mode**: When using `clientToken`, feedback is automatically
|
|
151
|
+
* sent to your Travrse backend. Just enable the buttons and you're done!
|
|
152
|
+
* The `onFeedback` and `onCopy` callbacks are optional for additional local handling.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* // With clientToken - feedback is automatic!
|
|
157
|
+
* config: {
|
|
158
|
+
* clientToken: 'ct_live_...',
|
|
159
|
+
* messageActions: {
|
|
160
|
+
* showUpvote: true,
|
|
161
|
+
* showDownvote: true,
|
|
162
|
+
* // No onFeedback needed - sent to backend automatically
|
|
163
|
+
* }
|
|
164
|
+
* }
|
|
165
|
+
* ```
|
|
149
166
|
*/
|
|
150
167
|
type AgentWidgetMessageActionsConfig = {
|
|
151
168
|
/**
|
|
@@ -159,13 +176,15 @@ type AgentWidgetMessageActionsConfig = {
|
|
|
159
176
|
*/
|
|
160
177
|
showCopy?: boolean;
|
|
161
178
|
/**
|
|
162
|
-
* Show upvote button
|
|
163
|
-
*
|
|
179
|
+
* Show upvote button.
|
|
180
|
+
* When using `clientToken`, feedback is sent to the backend automatically.
|
|
181
|
+
* @default false
|
|
164
182
|
*/
|
|
165
183
|
showUpvote?: boolean;
|
|
166
184
|
/**
|
|
167
|
-
* Show downvote button
|
|
168
|
-
*
|
|
185
|
+
* Show downvote button.
|
|
186
|
+
* When using `clientToken`, feedback is sent to the backend automatically.
|
|
187
|
+
* @default false
|
|
169
188
|
*/
|
|
170
189
|
showDownvote?: boolean;
|
|
171
190
|
/**
|
|
@@ -186,11 +205,19 @@ type AgentWidgetMessageActionsConfig = {
|
|
|
186
205
|
*/
|
|
187
206
|
layout?: "pill-inside" | "row-inside";
|
|
188
207
|
/**
|
|
189
|
-
* Callback when user submits feedback (upvote/downvote)
|
|
208
|
+
* Callback when user submits feedback (upvote/downvote).
|
|
209
|
+
*
|
|
210
|
+
* **Note**: When using `clientToken`, feedback is AUTOMATICALLY sent to your
|
|
211
|
+
* backend via `/v1/client/feedback`. This callback is called IN ADDITION to
|
|
212
|
+
* the automatic submission, useful for updating local UI or analytics.
|
|
190
213
|
*/
|
|
191
214
|
onFeedback?: (feedback: AgentWidgetMessageFeedback) => void;
|
|
192
215
|
/**
|
|
193
|
-
* Callback when user copies a message
|
|
216
|
+
* Callback when user copies a message.
|
|
217
|
+
*
|
|
218
|
+
* **Note**: When using `clientToken`, copy events are AUTOMATICALLY tracked
|
|
219
|
+
* via `/v1/client/feedback`. This callback is called IN ADDITION to the
|
|
220
|
+
* automatic tracking.
|
|
194
221
|
*/
|
|
195
222
|
onCopy?: (message: AgentWidgetMessage) => void;
|
|
196
223
|
};
|