@burdenoff/website-sdk 2026.829.2 → 2026.829.4

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/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { createContext, useMemo, useContext, useState, useCallback, useLayoutEffect, useRef, useEffect } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { Instagram, Youtube, Facebook, Github, Linkedin, Twitter, Mail, Phone, MapPin, Clock, Send, CheckCircle, Upload, Globe, ChevronDown, Search, Rocket, ArrowRight, Download, Sparkles, RotateCcw, History, Trash2, Mic, Square, ArrowUp, BookOpenText, Layers, Link2, TriangleAlert, ChevronLeft, ChevronRight, FileText, ExternalLink } from 'lucide-react';
4
+ import { Instagram, Youtube, Facebook, Github, Linkedin, Twitter, Mail, Phone, MapPin, Clock, Send, CheckCircle, Upload, Globe, ChevronDown, Search, Rocket, ArrowRight, Download, Sparkles, RotateCcw, Link2, History, Trash2, Mic, Square, ArrowUp, BookOpenText, Layers, TriangleAlert, ChevronLeft, ChevronRight, FileText, ExternalLink } from 'lucide-react';
5
5
  import ReCAPTCHA4 from 'react-google-recaptcha';
6
6
  import { toast } from 'sonner';
7
7
  import { Helmet } from 'react-helmet-async';
@@ -5014,6 +5014,16 @@ var RECORD_EXPLORE_CLICK_MUTATION = (
5014
5014
  }
5015
5015
  `
5016
5016
  );
5017
+ var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
5018
+ /* GraphQL */
5019
+ `
5020
+ mutation CreateExploreShareLink($conversationToken: String!) {
5021
+ createExploreShareLink(conversationToken: $conversationToken) {
5022
+ shareToken
5023
+ }
5024
+ }
5025
+ `
5026
+ );
5017
5027
 
5018
5028
  // src/data/products.ts
5019
5029
  var ECOSYSTEM_PRODUCTS = [
@@ -5946,6 +5956,16 @@ function useExploreChat(options = {}) {
5946
5956
  return null;
5947
5957
  }, [messages]);
5948
5958
  const canSend = (phase === "ready" || phase === "error") && catalog.enabled && turnCount < catalog.limits.maxTurnsPerConversation;
5959
+ const createShareLink = useCallback(async () => {
5960
+ const token = conversationTokenRef.current;
5961
+ if (!token) return null;
5962
+ try {
5963
+ const result = await client.mutate(CREATE_EXPLORE_SHARE_LINK_MUTATION, { conversationToken: token });
5964
+ return result?.data?.createExploreShareLink?.shareToken ?? null;
5965
+ } catch {
5966
+ return null;
5967
+ }
5968
+ }, [client]);
5949
5969
  const recordClick = useCallback(
5950
5970
  (messageId, kind, url) => {
5951
5971
  const token = conversationTokenRef.current;
@@ -5978,7 +5998,8 @@ function useExploreChat(options = {}) {
5978
5998
  openConversation,
5979
5999
  deleteConversation,
5980
6000
  clearHistory,
5981
- recordClick
6001
+ recordClick,
6002
+ createShareLink
5982
6003
  };
5983
6004
  }
5984
6005
  var optimisticCounter = 0;
@@ -6981,7 +7002,8 @@ function ExplorePage({
6981
7002
  openConversation,
6982
7003
  deleteConversation,
6983
7004
  clearHistory,
6984
- recordClick
7005
+ recordClick,
7006
+ createShareLink
6985
7007
  } = useExploreChat({ productSlug, pageUrl, onSend, examplePrompts });
6986
7008
  const [draft, setDraft] = useState("");
6987
7009
  const textareaRef = useRef(null);
@@ -7001,6 +7023,8 @@ function ExplorePage({
7001
7023
  });
7002
7024
  speechStopRef.current = speech.stop;
7003
7025
  const [disclaimerOpen, setDisclaimerOpen] = useState(false);
7026
+ const [shareLabel, setShareLabel] = useState("Share");
7027
+ const [shareUrl, setShareUrl] = useState(null);
7004
7028
  const scrollRef = useRef(null);
7005
7029
  const latestAssistantRef = useRef(null);
7006
7030
  const alignedForRef = useRef(null);
@@ -7055,6 +7079,26 @@ function ExplorePage({
7055
7079
  if (!el) return;
7056
7080
  el.scrollTop = el.scrollHeight;
7057
7081
  }, [activity, latestAssistantId, messages]);
7082
+ const handleShare = useCallback(async () => {
7083
+ setShareLabel("Copying\u2026");
7084
+ setShareUrl(null);
7085
+ const token = await createShareLink();
7086
+ if (!token) {
7087
+ setShareLabel("Unavailable");
7088
+ setTimeout(() => setShareLabel("Share"), 2500);
7089
+ return;
7090
+ }
7091
+ const base = (pageUrl ?? window.location.href).split("?")[0];
7092
+ const url = `${base}?c=${encodeURIComponent(token)}`;
7093
+ try {
7094
+ await navigator.clipboard.writeText(url);
7095
+ setShareLabel("Copied");
7096
+ setTimeout(() => setShareLabel("Share"), 2500);
7097
+ } catch {
7098
+ setShareUrl(url);
7099
+ setShareLabel("Share");
7100
+ }
7101
+ }, [createShareLink, pageUrl]);
7058
7102
  const submitDraft = useCallback(() => {
7059
7103
  const text = draft.trim();
7060
7104
  if (!text || overLimit || busy || !canSend) return;
@@ -7137,6 +7181,24 @@ function ExplorePage({
7137
7181
  ]
7138
7182
  }
7139
7183
  ),
7184
+ messages.length > 0 ? /* @__PURE__ */ jsxs(
7185
+ Button,
7186
+ {
7187
+ "data-boff-explore": "share",
7188
+ type: "button",
7189
+ size: "sm",
7190
+ variant: "ghost",
7191
+ className: "shrink-0 text-muted-foreground",
7192
+ title: "Copy a read-only link to this conversation",
7193
+ onClick: () => {
7194
+ void handleShare();
7195
+ },
7196
+ children: [
7197
+ /* @__PURE__ */ jsx(Link2, { className: "h-3.5 w-3.5" }),
7198
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: shareLabel })
7199
+ ]
7200
+ }
7201
+ ) : null,
7140
7202
  history.length > 0 ? /* @__PURE__ */ jsxs(
7141
7203
  Button,
7142
7204
  {
@@ -7399,6 +7461,28 @@ function ExplorePage({
7399
7461
  }
7400
7462
  )
7401
7463
  ] }),
7464
+ shareUrl ? /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
7465
+ /* @__PURE__ */ jsx(
7466
+ "input",
7467
+ {
7468
+ "data-boff-explore": "share-url",
7469
+ readOnly: true,
7470
+ value: shareUrl,
7471
+ "aria-label": "Read-only link to this conversation",
7472
+ onFocus: (event) => event.currentTarget.select(),
7473
+ className: "min-w-0 flex-1 rounded-md border border-border bg-muted px-2 py-1 text-xs text-muted-foreground"
7474
+ }
7475
+ ),
7476
+ /* @__PURE__ */ jsx(
7477
+ "button",
7478
+ {
7479
+ type: "button",
7480
+ className: "shrink-0 text-xs underline underline-offset-2",
7481
+ onClick: () => setShareUrl(null),
7482
+ children: "Done"
7483
+ }
7484
+ )
7485
+ ] }) : null,
7402
7486
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground", children: [
7403
7487
  /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: "Grounded in our docs \u2014 check anything important." }),
7404
7488
  /* @__PURE__ */ jsx(