@burdenoff/website-sdk 2026.922.2 → 2026.922.3

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.
@@ -17,6 +17,18 @@
17
17
  */
18
18
  type ExploreMessageRole = "USER" | "ASSISTANT";
19
19
  type ExploreMessageStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED";
20
+ /** `enum ExploreFeedbackRating` — the visitor's verdict on one answer. */
21
+ type ExploreFeedbackRating = "HELPFUL" | "NOT_HELPFUL";
22
+ /**
23
+ * The reasons offered alongside `NOT_HELPFUL`, in the order the chooser shows them.
24
+ *
25
+ * `reason` is `String` on the wire, not an enum, so this list is the SDK's half of the
26
+ * agreement rather than something the schema enforces — the same treatment
27
+ * {@link ExploreCtaKind} gets. Use the union when you are *producing* a reason; read one
28
+ * back as a plain string.
29
+ */
30
+ declare const EXPLORE_FEEDBACK_REASONS: readonly ["INACCURATE", "INCOMPLETE", "OFF_TOPIC", "HARD_TO_FOLLOW", "OTHER"];
31
+ type ExploreFeedbackReason = (typeof EXPLORE_FEEDBACK_REASONS)[number];
20
32
  /**
21
33
  * The `ExploreCta.kind` values enumerated in CONTRACT.md §1.
22
34
  *
@@ -56,6 +68,21 @@ interface ExploreCtaLink {
56
68
  url: string;
57
69
  product?: string | null;
58
70
  }
71
+ /**
72
+ * `type ExploreFeedback` — what is on record for one answer, as the server holds it.
73
+ *
74
+ * A rating REPLACES the previous one (the server upserts on `messageId`), so this is the
75
+ * visitor's current opinion and never a history. `reason` is null for `HELPFUL` by
76
+ * definition, and typed `string` rather than the union because it is `String` on the wire —
77
+ * a reason added server-side must read back, not break the build of 38 websites.
78
+ */
79
+ interface ExploreFeedback {
80
+ rating: ExploreFeedbackRating;
81
+ /** One of {@link EXPLORE_FEEDBACK_REASONS}. Null for `HELPFUL`. */
82
+ reason?: string | null;
83
+ comment?: string | null;
84
+ createdAt: string;
85
+ }
59
86
  /** `type ExploreMessage`. `content` is `""` while the turn is PENDING. */
60
87
  interface ExploreMessage {
61
88
  id: string;
@@ -79,6 +106,16 @@ interface ExploreMessage {
79
106
  answered?: boolean | null;
80
107
  /** Files the visitor attached to this turn. Present on USER messages only. */
81
108
  attachments?: ExploreAttachment[] | null;
109
+ /**
110
+ * The rating this visitor already gave this answer, or null for an unrated one.
111
+ *
112
+ * Selected only by the reads scoped to a `conversationToken`, so a polled or restored
113
+ * transcript shows what was already rated instead of offering the row again. It is always
114
+ * null on a SHARED transcript — that read is performed by someone else, and the rater's
115
+ * verdict and free-text note are not theirs to receive. See
116
+ * `EXPLORE_OWN_MESSAGE_FIELDS`.
117
+ */
118
+ feedback?: ExploreFeedback | null;
82
119
  errorCode?: string | null;
83
120
  createdAt: string;
84
121
  completedAt?: string | null;
@@ -171,9 +208,9 @@ declare const EXPLORE_CATALOG_QUERY = "\n query ExploreCatalog($productSlug: St
171
208
  * default 5-minute cache would return the first PENDING snapshot forever and
172
209
  * the answer would never appear.
173
210
  */
174
- declare const EXPLORE_MESSAGE_QUERY = "\n query ExploreMessage($conversationToken: String!, $id: ID!) {\n exploreMessage(conversationToken: $conversationToken, id: $id) {\n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n }\n }\n";
211
+ declare const EXPLORE_MESSAGE_QUERY = "\n query ExploreMessage($conversationToken: String!, $id: ID!) {\n exploreMessage(conversationToken: $conversationToken, id: $id) {\n \n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n feedback {\n rating\n reason\n comment\n createdAt\n }\n\n }\n }\n";
175
212
  /** Submit half of the submit + poll pair. */
176
- declare const SEND_EXPLORE_MESSAGE_MUTATION = "\n mutation SendExploreMessage($input: SendExploreMessageInput!) {\n sendExploreMessage(input: $input) {\n conversation {\n id\n token\n productSlug\n turnCount\n createdAt\n }\n userMessage {\n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n }\n assistantMessage {\n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n }\n remainingToday\n }\n }\n";
213
+ declare const SEND_EXPLORE_MESSAGE_MUTATION = "\n mutation SendExploreMessage($input: SendExploreMessageInput!) {\n sendExploreMessage(input: $input) {\n conversation {\n id\n token\n productSlug\n turnCount\n createdAt\n }\n userMessage {\n \n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n feedback {\n rating\n reason\n comment\n createdAt\n }\n\n }\n assistantMessage {\n \n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n feedback {\n rating\n reason\n comment\n createdAt\n }\n\n }\n remainingToday\n }\n }\n";
177
214
  interface ExploreCatalogQueryData {
178
215
  exploreCatalog: ExploreCatalog;
179
216
  }
@@ -184,4 +221,4 @@ interface SendExploreMessageMutationData {
184
221
  sendExploreMessage: SendExploreMessageResult;
185
222
  }
186
223
 
187
- export { type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreLimits as a, type ExploreCatalog as b, type ExploreMessage as c, EXPLORE_CATALOG_QUERY as d, EXPLORE_MESSAGE_QUERY as e, type ExploreCatalogQueryData as f, type ExploreConversation as g, type ExploreCtaKind as h, type ExploreCtaLink as i, type ExploreErrorCode as j, type ExploreMessageQueryData as k, type ExploreMessageRole as l, type ExploreMessageStatus as m, type ExploreReference as n, type SendExploreMessageInput as o, type SendExploreMessageMutationData as p, type SendExploreMessageResult as q };
224
+ export { type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreLimits as a, type ExploreCatalog as b, type ExploreMessage as c, type ExploreFeedbackRating as d, type ExploreFeedbackReason as e, EXPLORE_CATALOG_QUERY as f, EXPLORE_MESSAGE_QUERY as g, type ExploreCatalogQueryData as h, type ExploreConversation as i, type ExploreCtaKind as j, type ExploreCtaLink as k, type ExploreErrorCode as l, type ExploreMessageQueryData as m, type ExploreMessageRole as n, type ExploreMessageStatus as o, type ExploreReference as p, type SendExploreMessageInput as q, type SendExploreMessageMutationData as r, type SendExploreMessageResult as s };
@@ -17,6 +17,18 @@
17
17
  */
18
18
  type ExploreMessageRole = "USER" | "ASSISTANT";
19
19
  type ExploreMessageStatus = "PENDING" | "RUNNING" | "COMPLETED" | "FAILED";
20
+ /** `enum ExploreFeedbackRating` — the visitor's verdict on one answer. */
21
+ type ExploreFeedbackRating = "HELPFUL" | "NOT_HELPFUL";
22
+ /**
23
+ * The reasons offered alongside `NOT_HELPFUL`, in the order the chooser shows them.
24
+ *
25
+ * `reason` is `String` on the wire, not an enum, so this list is the SDK's half of the
26
+ * agreement rather than something the schema enforces — the same treatment
27
+ * {@link ExploreCtaKind} gets. Use the union when you are *producing* a reason; read one
28
+ * back as a plain string.
29
+ */
30
+ declare const EXPLORE_FEEDBACK_REASONS: readonly ["INACCURATE", "INCOMPLETE", "OFF_TOPIC", "HARD_TO_FOLLOW", "OTHER"];
31
+ type ExploreFeedbackReason = (typeof EXPLORE_FEEDBACK_REASONS)[number];
20
32
  /**
21
33
  * The `ExploreCta.kind` values enumerated in CONTRACT.md §1.
22
34
  *
@@ -56,6 +68,21 @@ interface ExploreCtaLink {
56
68
  url: string;
57
69
  product?: string | null;
58
70
  }
71
+ /**
72
+ * `type ExploreFeedback` — what is on record for one answer, as the server holds it.
73
+ *
74
+ * A rating REPLACES the previous one (the server upserts on `messageId`), so this is the
75
+ * visitor's current opinion and never a history. `reason` is null for `HELPFUL` by
76
+ * definition, and typed `string` rather than the union because it is `String` on the wire —
77
+ * a reason added server-side must read back, not break the build of 38 websites.
78
+ */
79
+ interface ExploreFeedback {
80
+ rating: ExploreFeedbackRating;
81
+ /** One of {@link EXPLORE_FEEDBACK_REASONS}. Null for `HELPFUL`. */
82
+ reason?: string | null;
83
+ comment?: string | null;
84
+ createdAt: string;
85
+ }
59
86
  /** `type ExploreMessage`. `content` is `""` while the turn is PENDING. */
60
87
  interface ExploreMessage {
61
88
  id: string;
@@ -79,6 +106,16 @@ interface ExploreMessage {
79
106
  answered?: boolean | null;
80
107
  /** Files the visitor attached to this turn. Present on USER messages only. */
81
108
  attachments?: ExploreAttachment[] | null;
109
+ /**
110
+ * The rating this visitor already gave this answer, or null for an unrated one.
111
+ *
112
+ * Selected only by the reads scoped to a `conversationToken`, so a polled or restored
113
+ * transcript shows what was already rated instead of offering the row again. It is always
114
+ * null on a SHARED transcript — that read is performed by someone else, and the rater's
115
+ * verdict and free-text note are not theirs to receive. See
116
+ * `EXPLORE_OWN_MESSAGE_FIELDS`.
117
+ */
118
+ feedback?: ExploreFeedback | null;
82
119
  errorCode?: string | null;
83
120
  createdAt: string;
84
121
  completedAt?: string | null;
@@ -171,9 +208,9 @@ declare const EXPLORE_CATALOG_QUERY = "\n query ExploreCatalog($productSlug: St
171
208
  * default 5-minute cache would return the first PENDING snapshot forever and
172
209
  * the answer would never appear.
173
210
  */
174
- declare const EXPLORE_MESSAGE_QUERY = "\n query ExploreMessage($conversationToken: String!, $id: ID!) {\n exploreMessage(conversationToken: $conversationToken, id: $id) {\n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n }\n }\n";
211
+ declare const EXPLORE_MESSAGE_QUERY = "\n query ExploreMessage($conversationToken: String!, $id: ID!) {\n exploreMessage(conversationToken: $conversationToken, id: $id) {\n \n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n feedback {\n rating\n reason\n comment\n createdAt\n }\n\n }\n }\n";
175
212
  /** Submit half of the submit + poll pair. */
176
- declare const SEND_EXPLORE_MESSAGE_MUTATION = "\n mutation SendExploreMessage($input: SendExploreMessageInput!) {\n sendExploreMessage(input: $input) {\n conversation {\n id\n token\n productSlug\n turnCount\n createdAt\n }\n userMessage {\n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n }\n assistantMessage {\n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n }\n remainingToday\n }\n }\n";
213
+ declare const SEND_EXPLORE_MESSAGE_MUTATION = "\n mutation SendExploreMessage($input: SendExploreMessageInput!) {\n sendExploreMessage(input: $input) {\n conversation {\n id\n token\n productSlug\n turnCount\n createdAt\n }\n userMessage {\n \n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n feedback {\n rating\n reason\n comment\n createdAt\n }\n\n }\n assistantMessage {\n \n \n id\n conversationId\n role\n status\n content\n partialContent\n activity\n references {\n url\n title\n description\n product\n imageUrl\n index\n }\n ctas {\n kind\n label\n url\n product\n }\n followUps\n answered\n attachments {\n name\n mimeType\n size\n textExtracted\n }\n errorCode\n createdAt\n completedAt\n\n feedback {\n rating\n reason\n comment\n createdAt\n }\n\n }\n remainingToday\n }\n }\n";
177
214
  interface ExploreCatalogQueryData {
178
215
  exploreCatalog: ExploreCatalog;
179
216
  }
@@ -184,4 +221,4 @@ interface SendExploreMessageMutationData {
184
221
  sendExploreMessage: SendExploreMessageResult;
185
222
  }
186
223
 
187
- export { type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreLimits as a, type ExploreCatalog as b, type ExploreMessage as c, EXPLORE_CATALOG_QUERY as d, EXPLORE_MESSAGE_QUERY as e, type ExploreCatalogQueryData as f, type ExploreConversation as g, type ExploreCtaKind as h, type ExploreCtaLink as i, type ExploreErrorCode as j, type ExploreMessageQueryData as k, type ExploreMessageRole as l, type ExploreMessageStatus as m, type ExploreReference as n, type SendExploreMessageInput as o, type SendExploreMessageMutationData as p, type SendExploreMessageResult as q };
224
+ export { type ExploreProduct as E, SEND_EXPLORE_MESSAGE_MUTATION as S, type ExploreLimits as a, type ExploreCatalog as b, type ExploreMessage as c, type ExploreFeedbackRating as d, type ExploreFeedbackReason as e, EXPLORE_CATALOG_QUERY as f, EXPLORE_MESSAGE_QUERY as g, type ExploreCatalogQueryData as h, type ExploreConversation as i, type ExploreCtaKind as j, type ExploreCtaLink as k, type ExploreErrorCode as l, type ExploreMessageQueryData as m, type ExploreMessageRole as n, type ExploreMessageStatus as o, type ExploreReference as p, type SendExploreMessageInput as q, type SendExploreMessageMutationData as r, type SendExploreMessageResult as s };
@@ -1,5 +1,5 @@
1
- export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, c as UseExploreChatResult, d as classifyExploreError, u as useExploreChat } from '../use-explore-chat-DC47G-C3.mjs';
2
- import '../explore-types-CLw19R76.mjs';
1
+ export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, c as UseExploreChatResult, d as classifyExploreError, u as useExploreChat } from '../use-explore-chat-C6Y8JQMj.mjs';
2
+ import '../explore-types-CPF1QoMn.mjs';
3
3
 
4
4
  interface UseSpeechInputOptions {
5
5
  /** Receives settled text as it is recognised. Append it to the draft. */
@@ -1,5 +1,5 @@
1
- export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, c as UseExploreChatResult, d as classifyExploreError, u as useExploreChat } from '../use-explore-chat-DyPMkzXA.js';
2
- import '../explore-types-CLw19R76.js';
1
+ export { D as DEFAULT_EXPLORE_EXAMPLE_PROMPTS, E as ExploreChatError, a as ExploreChatErrorKind, b as ExploreChatPhase, F as FALLBACK_EXPLORE_LIMITS, U as UseExploreChatOptions, c as UseExploreChatResult, d as classifyExploreError, u as useExploreChat } from '../use-explore-chat--CxNtkrJ.js';
2
+ import '../explore-types-CPF1QoMn.js';
3
3
 
4
4
  interface UseSpeechInputOptions {
5
5
  /** Receives settled text as it is recognised. Append it to the draft. */
@@ -265,6 +265,18 @@ var EXPLORE_MESSAGE_FIELDS = (
265
265
  completedAt
266
266
  `
267
267
  );
268
+ var EXPLORE_OWN_MESSAGE_FIELDS = (
269
+ /* GraphQL */
270
+ `
271
+ ${EXPLORE_MESSAGE_FIELDS}
272
+ feedback {
273
+ rating
274
+ reason
275
+ comment
276
+ createdAt
277
+ }
278
+ `
279
+ );
268
280
  var EXPLORE_CATALOG_QUERY = (
269
281
  /* GraphQL */
270
282
  `
@@ -297,7 +309,7 @@ var EXPLORE_MESSAGE_QUERY = (
297
309
  `
298
310
  query ExploreMessage($conversationToken: String!, $id: ID!) {
299
311
  exploreMessage(conversationToken: $conversationToken, id: $id) {
300
- ${EXPLORE_MESSAGE_FIELDS}
312
+ ${EXPLORE_OWN_MESSAGE_FIELDS}
301
313
  }
302
314
  }
303
315
  `
@@ -315,10 +327,10 @@ var SEND_EXPLORE_MESSAGE_MUTATION = (
315
327
  createdAt
316
328
  }
317
329
  userMessage {
318
- ${EXPLORE_MESSAGE_FIELDS}
330
+ ${EXPLORE_OWN_MESSAGE_FIELDS}
319
331
  }
320
332
  assistantMessage {
321
- ${EXPLORE_MESSAGE_FIELDS}
333
+ ${EXPLORE_OWN_MESSAGE_FIELDS}
322
334
  }
323
335
  remainingToday
324
336
  }
@@ -335,6 +347,22 @@ var RECORD_EXPLORE_CLICK_MUTATION = (
335
347
  }
336
348
  `
337
349
  );
350
+ var SUBMIT_EXPLORE_FEEDBACK_MUTATION = (
351
+ /* GraphQL */
352
+ `
353
+ mutation SubmitExploreFeedback($input: SubmitExploreFeedbackInput!) {
354
+ submitExploreFeedback(input: $input) {
355
+ recorded
356
+ feedback {
357
+ rating
358
+ reason
359
+ comment
360
+ createdAt
361
+ }
362
+ }
363
+ }
364
+ `
365
+ );
338
366
  var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
339
367
  /* GraphQL */
340
368
  `
@@ -1383,6 +1411,42 @@ function useExploreChat(options = {}) {
1383
1411
  },
1384
1412
  [client]
1385
1413
  );
1414
+ const submitFeedback = react.useCallback(
1415
+ async (messageId, rating, detail) => {
1416
+ const token = conversationTokenRef.current;
1417
+ if (!token) return false;
1418
+ const comment = detail?.comment?.trim();
1419
+ const input = {
1420
+ conversationToken: token,
1421
+ messageId,
1422
+ rating,
1423
+ // Only meaningful with NOT_HELPFUL. The server stores null for HELPFUL either
1424
+ // way; sending it would just be noise the backend has to defend against.
1425
+ reason: rating === "NOT_HELPFUL" ? detail?.reason ?? null : null,
1426
+ comment: comment ? comment : null
1427
+ };
1428
+ try {
1429
+ const res = await client.mutate(
1430
+ SUBMIT_EXPLORE_FEEDBACK_MUTATION,
1431
+ { input }
1432
+ );
1433
+ const result = res?.data?.submitExploreFeedback;
1434
+ if (!result?.recorded) return false;
1435
+ const recorded = result.feedback;
1436
+ if (recorded && mountedRef.current) {
1437
+ setMessages(
1438
+ (current) => current.map(
1439
+ (message) => message.id === messageId ? { ...message, feedback: recorded } : message
1440
+ )
1441
+ );
1442
+ }
1443
+ return true;
1444
+ } catch {
1445
+ return false;
1446
+ }
1447
+ },
1448
+ [client]
1449
+ );
1386
1450
  return {
1387
1451
  phase,
1388
1452
  catalog,
@@ -1402,6 +1466,7 @@ function useExploreChat(options = {}) {
1402
1466
  deleteConversation,
1403
1467
  clearHistory,
1404
1468
  recordClick,
1469
+ submitFeedback,
1405
1470
  createShareLink,
1406
1471
  isSharedView
1407
1472
  };