@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/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,7 @@ function ExplorePage({
7001
7023
  });
7002
7024
  speechStopRef.current = speech.stop;
7003
7025
  const [disclaimerOpen, setDisclaimerOpen] = useState(false);
7026
+ const [shareLabel, setShareLabel] = useState("Share");
7004
7027
  const scrollRef = useRef(null);
7005
7028
  const latestAssistantRef = useRef(null);
7006
7029
  const alignedForRef = useRef(null);
@@ -7055,6 +7078,25 @@ function ExplorePage({
7055
7078
  if (!el) return;
7056
7079
  el.scrollTop = el.scrollHeight;
7057
7080
  }, [activity, latestAssistantId, messages]);
7081
+ const handleShare = useCallback(async () => {
7082
+ setShareLabel("Copying\u2026");
7083
+ const token = await createShareLink();
7084
+ if (!token) {
7085
+ setShareLabel("Unavailable");
7086
+ setTimeout(() => setShareLabel("Share"), 2500);
7087
+ return;
7088
+ }
7089
+ const base = (pageUrl ?? window.location.href).split("?")[0];
7090
+ const url = `${base}?c=${encodeURIComponent(token)}`;
7091
+ try {
7092
+ await navigator.clipboard.writeText(url);
7093
+ setShareLabel("Copied");
7094
+ } catch {
7095
+ window.prompt("Copy this link", url);
7096
+ setShareLabel("Share");
7097
+ }
7098
+ setTimeout(() => setShareLabel("Share"), 2500);
7099
+ }, [createShareLink, pageUrl]);
7058
7100
  const submitDraft = useCallback(() => {
7059
7101
  const text = draft.trim();
7060
7102
  if (!text || overLimit || busy || !canSend) return;
@@ -7137,6 +7179,24 @@ function ExplorePage({
7137
7179
  ]
7138
7180
  }
7139
7181
  ),
7182
+ messages.length > 0 ? /* @__PURE__ */ jsxs(
7183
+ Button,
7184
+ {
7185
+ "data-boff-explore": "share",
7186
+ type: "button",
7187
+ size: "sm",
7188
+ variant: "ghost",
7189
+ className: "shrink-0 text-muted-foreground",
7190
+ title: "Copy a read-only link to this conversation",
7191
+ onClick: () => {
7192
+ void handleShare();
7193
+ },
7194
+ children: [
7195
+ /* @__PURE__ */ jsx(Link2, { className: "h-3.5 w-3.5" }),
7196
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: shareLabel })
7197
+ ]
7198
+ }
7199
+ ) : null,
7140
7200
  history.length > 0 ? /* @__PURE__ */ jsxs(
7141
7201
  Button,
7142
7202
  {