@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.
@@ -574,6 +574,16 @@ var RECORD_EXPLORE_CLICK_MUTATION = (
574
574
  }
575
575
  `
576
576
  );
577
+ var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
578
+ /* GraphQL */
579
+ `
580
+ mutation CreateExploreShareLink($conversationToken: String!) {
581
+ createExploreShareLink(conversationToken: $conversationToken) {
582
+ shareToken
583
+ }
584
+ }
585
+ `
586
+ );
577
587
 
578
588
  // src/data/products.ts
579
589
  var ECOSYSTEM_PRODUCTS = [
@@ -1506,6 +1516,16 @@ function useExploreChat(options = {}) {
1506
1516
  return null;
1507
1517
  }, [messages]);
1508
1518
  const canSend = (phase === "ready" || phase === "error") && catalog.enabled && turnCount < catalog.limits.maxTurnsPerConversation;
1519
+ const createShareLink = React.useCallback(async () => {
1520
+ const token = conversationTokenRef.current;
1521
+ if (!token) return null;
1522
+ try {
1523
+ const result = await client.mutate(CREATE_EXPLORE_SHARE_LINK_MUTATION, { conversationToken: token });
1524
+ return result?.data?.createExploreShareLink?.shareToken ?? null;
1525
+ } catch {
1526
+ return null;
1527
+ }
1528
+ }, [client]);
1509
1529
  const recordClick = React.useCallback(
1510
1530
  (messageId, kind, url) => {
1511
1531
  const token = conversationTokenRef.current;
@@ -1538,7 +1558,8 @@ function useExploreChat(options = {}) {
1538
1558
  openConversation,
1539
1559
  deleteConversation,
1540
1560
  clearHistory,
1541
- recordClick
1561
+ recordClick,
1562
+ createShareLink
1542
1563
  };
1543
1564
  }
1544
1565
  var optimisticCounter = 0;
@@ -2666,7 +2687,8 @@ function ExplorePage({
2666
2687
  openConversation,
2667
2688
  deleteConversation,
2668
2689
  clearHistory,
2669
- recordClick
2690
+ recordClick,
2691
+ createShareLink
2670
2692
  } = useExploreChat({ productSlug, pageUrl, onSend, examplePrompts });
2671
2693
  const [draft, setDraft] = React.useState("");
2672
2694
  const textareaRef = React.useRef(null);
@@ -2686,6 +2708,7 @@ function ExplorePage({
2686
2708
  });
2687
2709
  speechStopRef.current = speech.stop;
2688
2710
  const [disclaimerOpen, setDisclaimerOpen] = React.useState(false);
2711
+ const [shareLabel, setShareLabel] = React.useState("Share");
2689
2712
  const scrollRef = React.useRef(null);
2690
2713
  const latestAssistantRef = React.useRef(null);
2691
2714
  const alignedForRef = React.useRef(null);
@@ -2740,6 +2763,25 @@ function ExplorePage({
2740
2763
  if (!el) return;
2741
2764
  el.scrollTop = el.scrollHeight;
2742
2765
  }, [activity, latestAssistantId, messages]);
2766
+ const handleShare = React.useCallback(async () => {
2767
+ setShareLabel("Copying\u2026");
2768
+ const token = await createShareLink();
2769
+ if (!token) {
2770
+ setShareLabel("Unavailable");
2771
+ setTimeout(() => setShareLabel("Share"), 2500);
2772
+ return;
2773
+ }
2774
+ const base = (pageUrl ?? window.location.href).split("?")[0];
2775
+ const url = `${base}?c=${encodeURIComponent(token)}`;
2776
+ try {
2777
+ await navigator.clipboard.writeText(url);
2778
+ setShareLabel("Copied");
2779
+ } catch {
2780
+ window.prompt("Copy this link", url);
2781
+ setShareLabel("Share");
2782
+ }
2783
+ setTimeout(() => setShareLabel("Share"), 2500);
2784
+ }, [createShareLink, pageUrl]);
2743
2785
  const submitDraft = React.useCallback(() => {
2744
2786
  const text = draft.trim();
2745
2787
  if (!text || overLimit || busy || !canSend) return;
@@ -2822,6 +2864,24 @@ function ExplorePage({
2822
2864
  ]
2823
2865
  }
2824
2866
  ),
2867
+ messages.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
2868
+ Button,
2869
+ {
2870
+ "data-boff-explore": "share",
2871
+ type: "button",
2872
+ size: "sm",
2873
+ variant: "ghost",
2874
+ className: "shrink-0 text-muted-foreground",
2875
+ title: "Copy a read-only link to this conversation",
2876
+ onClick: () => {
2877
+ void handleShare();
2878
+ },
2879
+ children: [
2880
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, { className: "h-3.5 w-3.5" }),
2881
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:inline", children: shareLabel })
2882
+ ]
2883
+ }
2884
+ ) : null,
2825
2885
  history.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
2826
2886
  Button,
2827
2887
  {