@burdenoff/website-sdk 2026.922.1 → 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.
- package/dist/components/explore.d.mts +12 -2
- package/dist/components/explore.d.ts +12 -2
- package/dist/components/explore.js +588 -193
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +589 -194
- package/dist/components/explore.mjs.map +1 -1
- package/dist/{explore-types-CLw19R76.d.mts → explore-types-CPF1QoMn.d.mts} +40 -3
- package/dist/{explore-types-CLw19R76.d.ts → explore-types-CPF1QoMn.d.ts} +40 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +74 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +74 -9
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +588 -193
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +589 -194
- package/dist/index.mjs.map +1 -1
- package/dist/{use-explore-chat-CvW-kyIm.d.mts → use-explore-chat--CxNtkrJ.d.ts} +19 -1
- package/dist/{use-explore-chat-DdGBimiz.d.ts → use-explore-chat-C6Y8JQMj.d.mts} +19 -1
- package/package.json +1 -1
|
@@ -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,
|
|
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,
|
|
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 };
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -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-
|
|
2
|
-
import '../explore-types-
|
|
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. */
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -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
|
|
2
|
-
import '../explore-types-
|
|
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. */
|
package/dist/hooks/index.js
CHANGED
|
@@ -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
|
-
${
|
|
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
|
-
${
|
|
330
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
319
331
|
}
|
|
320
332
|
assistantMessage {
|
|
321
|
-
${
|
|
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
|
`
|
|
@@ -618,13 +646,13 @@ var FALLBACK_EXPLORE_LIMITS = {
|
|
|
618
646
|
historyTurns: 6
|
|
619
647
|
};
|
|
620
648
|
var DEFAULT_EXPLORE_EXAMPLE_PROMPTS = [
|
|
621
|
-
"
|
|
622
|
-
"
|
|
623
|
-
"
|
|
624
|
-
"
|
|
649
|
+
"Every course we run lives in a different spreadsheet.",
|
|
650
|
+
"We only hear a machine is down after the line has stopped.",
|
|
651
|
+
"Members quietly stop showing up and we never know why.",
|
|
652
|
+
"Which of your products fits a problem like mine?"
|
|
625
653
|
];
|
|
626
|
-
var FALLBACK_WELCOME_TITLE = "
|
|
627
|
-
var FALLBACK_WELCOME_BODY = "
|
|
654
|
+
var FALLBACK_WELCOME_TITLE = "What problem are you trying to solve?";
|
|
655
|
+
var FALLBACK_WELCOME_BODY = "Describe the problem you're facing, in your own words. You can also ask about a specific product or compare a few. Every answer comes straight from our documentation.";
|
|
628
656
|
function buildFallbackCatalog(examplePrompts, welcome) {
|
|
629
657
|
return {
|
|
630
658
|
enabled: true,
|
|
@@ -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
|
};
|