@burdenoff/website-sdk 2026.829.1 → 2026.829.2
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.js +221 -66
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +221 -66
- package/dist/components/explore.mjs.map +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +29 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +29 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +221 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +221 -66
- package/dist/index.mjs.map +1 -1
- package/dist/{use-explore-chat-DhvZhH8f.d.mts → use-explore-chat-8eL7WdLc.d.mts} +16 -2
- package/dist/{use-explore-chat-DhvZhH8f.d.ts → use-explore-chat-8eL7WdLc.d.ts} +16 -2
- package/package.json +1 -1
|
@@ -489,6 +489,7 @@ var EXPLORE_MESSAGE_FIELDS = (
|
|
|
489
489
|
description
|
|
490
490
|
product
|
|
491
491
|
imageUrl
|
|
492
|
+
index
|
|
492
493
|
}
|
|
493
494
|
ctas {
|
|
494
495
|
kind
|
|
@@ -496,6 +497,8 @@ var EXPLORE_MESSAGE_FIELDS = (
|
|
|
496
497
|
url
|
|
497
498
|
product
|
|
498
499
|
}
|
|
500
|
+
followUps
|
|
501
|
+
answered
|
|
499
502
|
errorCode
|
|
500
503
|
createdAt
|
|
501
504
|
completedAt
|
|
@@ -561,6 +564,16 @@ var SEND_EXPLORE_MESSAGE_MUTATION = (
|
|
|
561
564
|
}
|
|
562
565
|
`
|
|
563
566
|
);
|
|
567
|
+
var RECORD_EXPLORE_CLICK_MUTATION = (
|
|
568
|
+
/* GraphQL */
|
|
569
|
+
`
|
|
570
|
+
mutation RecordExploreClick($input: RecordExploreClickInput!) {
|
|
571
|
+
recordExploreClick(input: $input) {
|
|
572
|
+
recorded
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
`
|
|
576
|
+
);
|
|
564
577
|
|
|
565
578
|
// src/data/products.ts
|
|
566
579
|
var ECOSYSTEM_PRODUCTS = [
|
|
@@ -1493,6 +1506,20 @@ function useExploreChat(options = {}) {
|
|
|
1493
1506
|
return null;
|
|
1494
1507
|
}, [messages]);
|
|
1495
1508
|
const canSend = (phase === "ready" || phase === "error") && catalog.enabled && turnCount < catalog.limits.maxTurnsPerConversation;
|
|
1509
|
+
const recordClick = React.useCallback(
|
|
1510
|
+
(messageId, kind, url) => {
|
|
1511
|
+
const token = conversationTokenRef.current;
|
|
1512
|
+
if (!token) return;
|
|
1513
|
+
try {
|
|
1514
|
+
void client.mutate(RECORD_EXPLORE_CLICK_MUTATION, {
|
|
1515
|
+
input: { conversationToken: token, messageId, kind, url }
|
|
1516
|
+
}).catch(() => {
|
|
1517
|
+
});
|
|
1518
|
+
} catch {
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
[client]
|
|
1522
|
+
);
|
|
1496
1523
|
return {
|
|
1497
1524
|
phase,
|
|
1498
1525
|
catalog,
|
|
@@ -1510,7 +1537,8 @@ function useExploreChat(options = {}) {
|
|
|
1510
1537
|
history: archive,
|
|
1511
1538
|
openConversation,
|
|
1512
1539
|
deleteConversation,
|
|
1513
|
-
clearHistory
|
|
1540
|
+
clearHistory,
|
|
1541
|
+
recordClick
|
|
1514
1542
|
};
|
|
1515
1543
|
}
|
|
1516
1544
|
var optimisticCounter = 0;
|
|
@@ -2007,7 +2035,10 @@ function logoUrlOf(url) {
|
|
|
2007
2035
|
return null;
|
|
2008
2036
|
}
|
|
2009
2037
|
}
|
|
2010
|
-
function ReferenceCard({
|
|
2038
|
+
function ReferenceCard({
|
|
2039
|
+
reference,
|
|
2040
|
+
onFollow
|
|
2041
|
+
}) {
|
|
2011
2042
|
const [imageFailed, setImageFailed] = React.useState(false);
|
|
2012
2043
|
const [logoFailed, setLogoFailed] = React.useState(false);
|
|
2013
2044
|
const host = hostnameOf(reference.url);
|
|
@@ -2029,9 +2060,11 @@ function ReferenceCard({ reference }) {
|
|
|
2029
2060
|
"a",
|
|
2030
2061
|
{
|
|
2031
2062
|
"data-boff-explore": "reference",
|
|
2063
|
+
"data-index": reference.index ?? void 0,
|
|
2032
2064
|
href: reference.url,
|
|
2033
2065
|
target: "_blank",
|
|
2034
2066
|
rel: "noopener noreferrer",
|
|
2067
|
+
onClick: () => onFollow?.(reference.url),
|
|
2035
2068
|
className: "group flex flex-row items-center gap-3 overflow-hidden rounded-xl border border-border bg-card p-2 transition-colors hover:border-primary/40 hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring sm:flex-col sm:items-stretch sm:gap-0 sm:p-0",
|
|
2036
2069
|
children: [
|
|
2037
2070
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-11 w-11 shrink-0 overflow-hidden rounded-lg bg-muted sm:hidden", children: logoImg }),
|
|
@@ -2055,7 +2088,10 @@ function ReferenceCard({ reference }) {
|
|
|
2055
2088
|
}
|
|
2056
2089
|
) }) : letterPlate }),
|
|
2057
2090
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5 sm:gap-1.5 sm:p-3", children: [
|
|
2058
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2091
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "line-clamp-2 text-sm font-semibold leading-snug text-card-foreground", children: [
|
|
2092
|
+
reference.index ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1.5 inline-flex h-4 min-w-4 items-center justify-center rounded bg-primary/10 px-1 text-[10px] font-bold text-primary", children: reference.index }) : null,
|
|
2093
|
+
reference.title || host || reference.url
|
|
2094
|
+
] }),
|
|
2059
2095
|
reference.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "line-clamp-2 text-xs leading-relaxed text-muted-foreground max-sm:hidden", children: reference.description }) : null,
|
|
2060
2096
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:mt-auto sm:pt-2", children: [
|
|
2061
2097
|
reference.product ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-secondary-foreground max-sm:hidden", children: reference.product }) : null,
|
|
@@ -2071,7 +2107,8 @@ function ReferenceCard({ reference }) {
|
|
|
2071
2107
|
}
|
|
2072
2108
|
function CtaButton({
|
|
2073
2109
|
cta,
|
|
2074
|
-
onNavigate
|
|
2110
|
+
onNavigate,
|
|
2111
|
+
onFollow
|
|
2075
2112
|
}) {
|
|
2076
2113
|
const variant = CTA_VARIANTS[cta.kind] ?? "outline";
|
|
2077
2114
|
const internal = isInternalPath(cta.url);
|
|
@@ -2084,7 +2121,10 @@ function CtaButton({
|
|
|
2084
2121
|
type: "button",
|
|
2085
2122
|
size: "sm",
|
|
2086
2123
|
variant,
|
|
2087
|
-
onClick: () =>
|
|
2124
|
+
onClick: () => {
|
|
2125
|
+
onFollow?.(cta.url);
|
|
2126
|
+
onNavigate(cta.url);
|
|
2127
|
+
},
|
|
2088
2128
|
children: cta.label
|
|
2089
2129
|
}
|
|
2090
2130
|
);
|
|
@@ -2095,6 +2135,7 @@ function CtaButton({
|
|
|
2095
2135
|
"data-boff-explore": "cta",
|
|
2096
2136
|
"data-kind": cta.kind,
|
|
2097
2137
|
href: cta.url,
|
|
2138
|
+
onClick: () => onFollow?.(cta.url),
|
|
2098
2139
|
...internal ? {} : { target: "_blank", rel: "noopener noreferrer" },
|
|
2099
2140
|
children: [
|
|
2100
2141
|
cta.label,
|
|
@@ -2146,7 +2187,9 @@ function AssistantBubble({
|
|
|
2146
2187
|
message,
|
|
2147
2188
|
activity,
|
|
2148
2189
|
onNavigate,
|
|
2149
|
-
anchorRef
|
|
2190
|
+
anchorRef,
|
|
2191
|
+
onFollow,
|
|
2192
|
+
onFollowUp
|
|
2150
2193
|
}) {
|
|
2151
2194
|
const streaming = message.status === "PENDING" || message.status === "RUNNING";
|
|
2152
2195
|
const body = message.content || message.partialContent || "";
|
|
@@ -2168,6 +2211,34 @@ function AssistantBubble({
|
|
|
2168
2211
|
}
|
|
2169
2212
|
),
|
|
2170
2213
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1 space-y-3", children: [
|
|
2214
|
+
message.status === "COMPLETED" && message.answered === false ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2215
|
+
"div",
|
|
2216
|
+
{
|
|
2217
|
+
"data-boff-explore": "no-answer",
|
|
2218
|
+
className: "flex items-start gap-2 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-foreground",
|
|
2219
|
+
children: [
|
|
2220
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlert, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400" }),
|
|
2221
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2222
|
+
"I couldn't find this in our documentation, so the answer below is not grounded in a source. Try rephrasing, or",
|
|
2223
|
+
" ",
|
|
2224
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2225
|
+
"a",
|
|
2226
|
+
{
|
|
2227
|
+
href: "/contact",
|
|
2228
|
+
className: "underline underline-offset-2 hover:text-primary",
|
|
2229
|
+
onClick: (event) => {
|
|
2230
|
+
if (!onNavigate) return;
|
|
2231
|
+
event.preventDefault();
|
|
2232
|
+
onNavigate("/contact");
|
|
2233
|
+
},
|
|
2234
|
+
children: "ask a human"
|
|
2235
|
+
}
|
|
2236
|
+
),
|
|
2237
|
+
"."
|
|
2238
|
+
] })
|
|
2239
|
+
]
|
|
2240
|
+
}
|
|
2241
|
+
) : null,
|
|
2171
2242
|
body ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl rounded-tl-md border border-border bg-card px-4 py-3 shadow-sm", children: [
|
|
2172
2243
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "boff-prose boff-prose-sm boff-explore-body min-w-0 text-card-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { children: body }) }),
|
|
2173
2244
|
streaming ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "boff-explore-caret", "aria-hidden": "true" }) : null
|
|
@@ -2176,16 +2247,41 @@ function AssistantBubble({
|
|
|
2176
2247
|
failed && !body ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-2xl rounded-tl-md border border-border bg-muted px-4 py-3 text-sm text-muted-foreground", children: "That answer didn't come through. Try asking again." }) : null,
|
|
2177
2248
|
message.references.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2178
2249
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Sources" }),
|
|
2179
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3", children: message.references.map((reference) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2250
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3", children: message.references.map((reference) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2251
|
+
ReferenceCard,
|
|
2252
|
+
{
|
|
2253
|
+
reference,
|
|
2254
|
+
onFollow: (url) => onFollow?.("REFERENCE", url)
|
|
2255
|
+
},
|
|
2256
|
+
reference.url
|
|
2257
|
+
)) })
|
|
2180
2258
|
] }) : null,
|
|
2181
2259
|
message.ctas.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 pt-0.5", children: message.ctas.map((cta) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2182
2260
|
CtaButton,
|
|
2183
2261
|
{
|
|
2184
2262
|
cta,
|
|
2185
|
-
onNavigate
|
|
2263
|
+
onNavigate,
|
|
2264
|
+
onFollow: (url) => onFollow?.("CTA", url)
|
|
2186
2265
|
},
|
|
2187
2266
|
`${cta.kind}-${cta.url}`
|
|
2188
|
-
)) }) : null
|
|
2267
|
+
)) }) : null,
|
|
2268
|
+
message.status === "COMPLETED" && (message.followUps?.length ?? 0) > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5 pt-0.5", children: [
|
|
2269
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: "Next you could ask" }),
|
|
2270
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1.5", children: (message.followUps ?? []).map((question) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2271
|
+
"button",
|
|
2272
|
+
{
|
|
2273
|
+
"data-boff-explore": "follow-up",
|
|
2274
|
+
type: "button",
|
|
2275
|
+
onClick: () => onFollowUp?.(question),
|
|
2276
|
+
className: "group inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1 text-left text-xs text-card-foreground transition-colors hover:border-primary/40 hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2277
|
+
children: [
|
|
2278
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: question }),
|
|
2279
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-3 w-3 shrink-0 rotate-45 text-muted-foreground transition-colors group-hover:text-primary" })
|
|
2280
|
+
]
|
|
2281
|
+
},
|
|
2282
|
+
question
|
|
2283
|
+
)) })
|
|
2284
|
+
] }) : null
|
|
2189
2285
|
] })
|
|
2190
2286
|
]
|
|
2191
2287
|
}
|
|
@@ -2259,6 +2355,9 @@ function PromptCarousel({
|
|
|
2259
2355
|
"div",
|
|
2260
2356
|
{
|
|
2261
2357
|
className: "flex min-w-0 items-center gap-1.5",
|
|
2358
|
+
role: "group",
|
|
2359
|
+
"aria-roledescription": "carousel",
|
|
2360
|
+
"aria-label": "Example questions",
|
|
2262
2361
|
onMouseEnter: () => setPaused(true),
|
|
2263
2362
|
onMouseLeave: () => setPaused(false),
|
|
2264
2363
|
onFocusCapture: () => setPaused(true),
|
|
@@ -2281,6 +2380,8 @@ function PromptCarousel({
|
|
|
2281
2380
|
"data-chip-kind": "prompt",
|
|
2282
2381
|
type: "button",
|
|
2283
2382
|
disabled,
|
|
2383
|
+
"aria-label": `Ask: ${current}`,
|
|
2384
|
+
"aria-live": paused ? "polite" : "off",
|
|
2284
2385
|
onClick: () => onPrompt(current),
|
|
2285
2386
|
className: "boff-explore-fade group flex min-w-0 flex-1 items-center gap-2 rounded-full border border-border bg-card px-4 py-2 text-left text-sm text-card-foreground shadow-sm transition-colors hover:border-primary/50 hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2286
2387
|
children: [
|
|
@@ -2315,72 +2416,108 @@ function ProductStrip({
|
|
|
2315
2416
|
"shrink-0 rounded-full border px-3 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2316
2417
|
active ? "border-primary bg-primary text-primary-foreground" : "border-border bg-card text-muted-foreground hover:bg-accent hover:text-accent-foreground"
|
|
2317
2418
|
);
|
|
2318
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2419
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2420
|
+
"div",
|
|
2421
|
+
{
|
|
2422
|
+
className: "flex min-w-0 items-center gap-2",
|
|
2423
|
+
role: "group",
|
|
2424
|
+
"aria-label": "Focus the assistant on one product",
|
|
2425
|
+
children: [
|
|
2426
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2427
|
+
"div",
|
|
2428
|
+
{
|
|
2429
|
+
className: cn(
|
|
2430
|
+
"boff-explore-strip flex min-w-0 flex-1 gap-2",
|
|
2431
|
+
expanded ? "flex-wrap" : "flex-nowrap overflow-x-auto"
|
|
2432
|
+
),
|
|
2433
|
+
children: [
|
|
2434
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2435
|
+
"button",
|
|
2436
|
+
{
|
|
2437
|
+
"data-boff-explore": "chip",
|
|
2438
|
+
"data-chip-kind": "product",
|
|
2439
|
+
"data-product": "all",
|
|
2440
|
+
type: "button",
|
|
2441
|
+
"aria-pressed": focusProduct === null,
|
|
2442
|
+
onClick: () => onFocus(null),
|
|
2443
|
+
className: chipClass(focusProduct === null),
|
|
2444
|
+
children: "All products"
|
|
2445
|
+
}
|
|
2446
|
+
),
|
|
2447
|
+
products.map((product) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2448
|
+
"button",
|
|
2449
|
+
{
|
|
2450
|
+
"data-boff-explore": "chip",
|
|
2451
|
+
"data-chip-kind": "product",
|
|
2452
|
+
"data-product": product.slug,
|
|
2453
|
+
type: "button",
|
|
2454
|
+
"aria-pressed": focusProduct === product.slug,
|
|
2455
|
+
title: product.tagline ?? product.name,
|
|
2456
|
+
onClick: () => onFocus(focusProduct === product.slug ? null : product.slug),
|
|
2457
|
+
className: chipClass(focusProduct === product.slug),
|
|
2458
|
+
children: product.name
|
|
2459
|
+
},
|
|
2460
|
+
product.slug
|
|
2461
|
+
))
|
|
2462
|
+
]
|
|
2463
|
+
}
|
|
2325
2464
|
),
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
products.map((product) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2341
|
-
"button",
|
|
2342
|
-
{
|
|
2343
|
-
"data-boff-explore": "chip",
|
|
2344
|
-
"data-chip-kind": "product",
|
|
2345
|
-
"data-product": product.slug,
|
|
2346
|
-
type: "button",
|
|
2347
|
-
"aria-pressed": focusProduct === product.slug,
|
|
2348
|
-
title: product.tagline ?? product.name,
|
|
2349
|
-
onClick: () => onFocus(focusProduct === product.slug ? null : product.slug),
|
|
2350
|
-
className: chipClass(focusProduct === product.slug),
|
|
2351
|
-
children: product.name
|
|
2352
|
-
},
|
|
2353
|
-
product.slug
|
|
2354
|
-
))
|
|
2355
|
-
]
|
|
2356
|
-
}
|
|
2357
|
-
),
|
|
2358
|
-
products.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2359
|
-
"button",
|
|
2360
|
-
{
|
|
2361
|
-
type: "button",
|
|
2362
|
-
"data-boff-explore": "products-toggle",
|
|
2363
|
-
onClick: () => setExpanded((v) => !v),
|
|
2364
|
-
className: "shrink-0 whitespace-nowrap rounded-full px-2 py-1 text-xs font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2365
|
-
children: expanded ? "Show less" : `All ${products.length}`
|
|
2366
|
-
}
|
|
2367
|
-
) : null
|
|
2368
|
-
] });
|
|
2465
|
+
products.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2466
|
+
"button",
|
|
2467
|
+
{
|
|
2468
|
+
type: "button",
|
|
2469
|
+
"data-boff-explore": "products-toggle",
|
|
2470
|
+
"aria-expanded": expanded,
|
|
2471
|
+
onClick: () => setExpanded((v) => !v),
|
|
2472
|
+
className: "shrink-0 whitespace-nowrap rounded-full px-2 py-1 text-xs font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
2473
|
+
children: expanded ? "Show less" : `All ${products.length}`
|
|
2474
|
+
}
|
|
2475
|
+
) : null
|
|
2476
|
+
]
|
|
2477
|
+
}
|
|
2478
|
+
);
|
|
2369
2479
|
}
|
|
2370
2480
|
function DisclaimerDialog({
|
|
2371
2481
|
open,
|
|
2372
2482
|
onClose,
|
|
2373
2483
|
captchaOn
|
|
2374
2484
|
}) {
|
|
2485
|
+
const panelRef = React.useRef(null);
|
|
2375
2486
|
const closeRef = React.useRef(null);
|
|
2487
|
+
const titleId = "boff-explore-disclaimer-title";
|
|
2376
2488
|
React.useEffect(() => {
|
|
2377
2489
|
if (!open) return;
|
|
2490
|
+
const opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
2491
|
+
const focusable = () => Array.from(
|
|
2492
|
+
panelRef.current?.querySelectorAll(
|
|
2493
|
+
'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])'
|
|
2494
|
+
) ?? []
|
|
2495
|
+
);
|
|
2378
2496
|
const onKey = (event) => {
|
|
2379
|
-
if (event.key === "Escape")
|
|
2497
|
+
if (event.key === "Escape") {
|
|
2498
|
+
onClose();
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
if (event.key !== "Tab") return;
|
|
2502
|
+
const items = focusable();
|
|
2503
|
+
if (items.length === 0) return;
|
|
2504
|
+
const first = items[0];
|
|
2505
|
+
const last = items[items.length - 1];
|
|
2506
|
+
const active = document.activeElement;
|
|
2507
|
+
if (event.shiftKey && (active === first || !panelRef.current?.contains(active))) {
|
|
2508
|
+
event.preventDefault();
|
|
2509
|
+
last?.focus();
|
|
2510
|
+
} else if (!event.shiftKey && active === last) {
|
|
2511
|
+
event.preventDefault();
|
|
2512
|
+
first?.focus();
|
|
2513
|
+
}
|
|
2380
2514
|
};
|
|
2381
2515
|
document.addEventListener("keydown", onKey);
|
|
2382
2516
|
closeRef.current?.focus();
|
|
2383
|
-
return () =>
|
|
2517
|
+
return () => {
|
|
2518
|
+
document.removeEventListener("keydown", onKey);
|
|
2519
|
+
opener?.focus();
|
|
2520
|
+
};
|
|
2384
2521
|
}, [open, onClose]);
|
|
2385
2522
|
if (!open) return null;
|
|
2386
2523
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2389,19 +2526,34 @@ function DisclaimerDialog({
|
|
|
2389
2526
|
"data-boff-explore": "disclaimer-dialog",
|
|
2390
2527
|
role: "dialog",
|
|
2391
2528
|
"aria-modal": "true",
|
|
2392
|
-
"aria-
|
|
2529
|
+
"aria-labelledby": titleId,
|
|
2393
2530
|
className: "fixed inset-0 z-50 flex items-end justify-center bg-foreground/40 p-4 backdrop-blur-sm sm:items-center",
|
|
2394
2531
|
onClick: onClose,
|
|
2395
2532
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2396
2533
|
"div",
|
|
2397
2534
|
{
|
|
2535
|
+
ref: panelRef,
|
|
2398
2536
|
className: "w-full max-w-md rounded-2xl border border-border bg-card p-5 shadow-xl",
|
|
2399
2537
|
onClick: (event) => event.stopPropagation(),
|
|
2400
2538
|
children: [
|
|
2401
2539
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
2402
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2540
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2541
|
+
"span",
|
|
2542
|
+
{
|
|
2543
|
+
"aria-hidden": "true",
|
|
2544
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",
|
|
2545
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TriangleAlert, { className: "h-4 w-4" })
|
|
2546
|
+
}
|
|
2547
|
+
),
|
|
2403
2548
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
2404
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2549
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2550
|
+
"p",
|
|
2551
|
+
{
|
|
2552
|
+
id: titleId,
|
|
2553
|
+
className: "text-sm font-semibold text-card-foreground",
|
|
2554
|
+
children: "How this assistant works"
|
|
2555
|
+
}
|
|
2556
|
+
),
|
|
2405
2557
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 space-y-2 text-xs leading-relaxed text-muted-foreground", children: [
|
|
2406
2558
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Answers are generated from our public documentation and can be imperfect \u2014 check anything important against the linked sources." }),
|
|
2407
2559
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Conversations are saved in this browser so you can come back to them, and are also stored on our servers to help us improve these answers. Please don't share personal or confidential information." }),
|
|
@@ -2513,7 +2665,8 @@ function ExplorePage({
|
|
|
2513
2665
|
history,
|
|
2514
2666
|
openConversation,
|
|
2515
2667
|
deleteConversation,
|
|
2516
|
-
clearHistory
|
|
2668
|
+
clearHistory,
|
|
2669
|
+
recordClick
|
|
2517
2670
|
} = useExploreChat({ productSlug, pageUrl, onSend, examplePrompts });
|
|
2518
2671
|
const [draft, setDraft] = React.useState("");
|
|
2519
2672
|
const textareaRef = React.useRef(null);
|
|
@@ -2787,7 +2940,9 @@ function ExplorePage({
|
|
|
2787
2940
|
message,
|
|
2788
2941
|
activity,
|
|
2789
2942
|
onNavigate,
|
|
2790
|
-
anchorRef: message.id === latestAssistantId ? latestAssistantRef : void 0
|
|
2943
|
+
anchorRef: message.id === latestAssistantId ? latestAssistantRef : void 0,
|
|
2944
|
+
onFollow: (kind, url) => recordClick(message.id, kind, url),
|
|
2945
|
+
onFollowUp: sendPrompt
|
|
2791
2946
|
},
|
|
2792
2947
|
message.id
|
|
2793
2948
|
)
|