@burdenoff/website-sdk 2026.829.2 → 2026.829.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.js +62 -2
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +63 -3
- 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 +22 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +22 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +62 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{use-explore-chat-8eL7WdLc.d.mts → use-explore-chat-B-E7jN1H.d.mts} +5 -0
- package/dist/{use-explore-chat-8eL7WdLc.d.ts → use-explore-chat-B-E7jN1H.d.ts} +5 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { createContext, useMemo, useState, useRef, useCallback, useEffect, useContext } from 'react';
|
|
3
|
-
import { Sparkles, RotateCcw, History, Trash2, Mic, Square, ArrowUp, BookOpenText, Layers,
|
|
3
|
+
import { Sparkles, RotateCcw, Link2, History, Trash2, Mic, Square, ArrowUp, BookOpenText, Layers, TriangleAlert, ChevronLeft, ChevronRight, ExternalLink } from 'lucide-react';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
5
5
|
import rehypeSanitize from 'rehype-sanitize';
|
|
6
6
|
import remarkGfm from 'remark-gfm';
|
|
@@ -548,6 +548,16 @@ var RECORD_EXPLORE_CLICK_MUTATION = (
|
|
|
548
548
|
}
|
|
549
549
|
`
|
|
550
550
|
);
|
|
551
|
+
var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
|
|
552
|
+
/* GraphQL */
|
|
553
|
+
`
|
|
554
|
+
mutation CreateExploreShareLink($conversationToken: String!) {
|
|
555
|
+
createExploreShareLink(conversationToken: $conversationToken) {
|
|
556
|
+
shareToken
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
`
|
|
560
|
+
);
|
|
551
561
|
|
|
552
562
|
// src/data/products.ts
|
|
553
563
|
var ECOSYSTEM_PRODUCTS = [
|
|
@@ -1480,6 +1490,16 @@ function useExploreChat(options = {}) {
|
|
|
1480
1490
|
return null;
|
|
1481
1491
|
}, [messages]);
|
|
1482
1492
|
const canSend = (phase === "ready" || phase === "error") && catalog.enabled && turnCount < catalog.limits.maxTurnsPerConversation;
|
|
1493
|
+
const createShareLink = useCallback(async () => {
|
|
1494
|
+
const token = conversationTokenRef.current;
|
|
1495
|
+
if (!token) return null;
|
|
1496
|
+
try {
|
|
1497
|
+
const result = await client.mutate(CREATE_EXPLORE_SHARE_LINK_MUTATION, { conversationToken: token });
|
|
1498
|
+
return result?.data?.createExploreShareLink?.shareToken ?? null;
|
|
1499
|
+
} catch {
|
|
1500
|
+
return null;
|
|
1501
|
+
}
|
|
1502
|
+
}, [client]);
|
|
1483
1503
|
const recordClick = useCallback(
|
|
1484
1504
|
(messageId, kind, url) => {
|
|
1485
1505
|
const token = conversationTokenRef.current;
|
|
@@ -1512,7 +1532,8 @@ function useExploreChat(options = {}) {
|
|
|
1512
1532
|
openConversation,
|
|
1513
1533
|
deleteConversation,
|
|
1514
1534
|
clearHistory,
|
|
1515
|
-
recordClick
|
|
1535
|
+
recordClick,
|
|
1536
|
+
createShareLink
|
|
1516
1537
|
};
|
|
1517
1538
|
}
|
|
1518
1539
|
var optimisticCounter = 0;
|
|
@@ -2640,7 +2661,8 @@ function ExplorePage({
|
|
|
2640
2661
|
openConversation,
|
|
2641
2662
|
deleteConversation,
|
|
2642
2663
|
clearHistory,
|
|
2643
|
-
recordClick
|
|
2664
|
+
recordClick,
|
|
2665
|
+
createShareLink
|
|
2644
2666
|
} = useExploreChat({ productSlug, pageUrl, onSend, examplePrompts });
|
|
2645
2667
|
const [draft, setDraft] = useState("");
|
|
2646
2668
|
const textareaRef = useRef(null);
|
|
@@ -2660,6 +2682,7 @@ function ExplorePage({
|
|
|
2660
2682
|
});
|
|
2661
2683
|
speechStopRef.current = speech.stop;
|
|
2662
2684
|
const [disclaimerOpen, setDisclaimerOpen] = useState(false);
|
|
2685
|
+
const [shareLabel, setShareLabel] = useState("Share");
|
|
2663
2686
|
const scrollRef = useRef(null);
|
|
2664
2687
|
const latestAssistantRef = useRef(null);
|
|
2665
2688
|
const alignedForRef = useRef(null);
|
|
@@ -2714,6 +2737,25 @@ function ExplorePage({
|
|
|
2714
2737
|
if (!el) return;
|
|
2715
2738
|
el.scrollTop = el.scrollHeight;
|
|
2716
2739
|
}, [activity, latestAssistantId, messages]);
|
|
2740
|
+
const handleShare = useCallback(async () => {
|
|
2741
|
+
setShareLabel("Copying\u2026");
|
|
2742
|
+
const token = await createShareLink();
|
|
2743
|
+
if (!token) {
|
|
2744
|
+
setShareLabel("Unavailable");
|
|
2745
|
+
setTimeout(() => setShareLabel("Share"), 2500);
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
const base = (pageUrl ?? window.location.href).split("?")[0];
|
|
2749
|
+
const url = `${base}?c=${encodeURIComponent(token)}`;
|
|
2750
|
+
try {
|
|
2751
|
+
await navigator.clipboard.writeText(url);
|
|
2752
|
+
setShareLabel("Copied");
|
|
2753
|
+
} catch {
|
|
2754
|
+
window.prompt("Copy this link", url);
|
|
2755
|
+
setShareLabel("Share");
|
|
2756
|
+
}
|
|
2757
|
+
setTimeout(() => setShareLabel("Share"), 2500);
|
|
2758
|
+
}, [createShareLink, pageUrl]);
|
|
2717
2759
|
const submitDraft = useCallback(() => {
|
|
2718
2760
|
const text = draft.trim();
|
|
2719
2761
|
if (!text || overLimit || busy || !canSend) return;
|
|
@@ -2796,6 +2838,24 @@ function ExplorePage({
|
|
|
2796
2838
|
]
|
|
2797
2839
|
}
|
|
2798
2840
|
),
|
|
2841
|
+
messages.length > 0 ? /* @__PURE__ */ jsxs(
|
|
2842
|
+
Button,
|
|
2843
|
+
{
|
|
2844
|
+
"data-boff-explore": "share",
|
|
2845
|
+
type: "button",
|
|
2846
|
+
size: "sm",
|
|
2847
|
+
variant: "ghost",
|
|
2848
|
+
className: "shrink-0 text-muted-foreground",
|
|
2849
|
+
title: "Copy a read-only link to this conversation",
|
|
2850
|
+
onClick: () => {
|
|
2851
|
+
void handleShare();
|
|
2852
|
+
},
|
|
2853
|
+
children: [
|
|
2854
|
+
/* @__PURE__ */ jsx(Link2, { className: "h-3.5 w-3.5" }),
|
|
2855
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: shareLabel })
|
|
2856
|
+
]
|
|
2857
|
+
}
|
|
2858
|
+
) : null,
|
|
2799
2859
|
history.length > 0 ? /* @__PURE__ */ jsxs(
|
|
2800
2860
|
Button,
|
|
2801
2861
|
{
|