@burdenoff/website-sdk 2026.1024.1 → 2026.1026.1
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-cta.d.mts +10 -1
- package/dist/components/explore-cta.d.ts +10 -1
- package/dist/components/explore-cta.js +82 -74
- package/dist/components/explore-cta.js.map +1 -1
- package/dist/components/explore-cta.mjs +83 -75
- package/dist/components/explore-cta.mjs.map +1 -1
- package/dist/components/explore.d.mts +2 -2
- package/dist/components/explore.d.ts +2 -2
- package/dist/components/explore.js +590 -463
- package/dist/components/explore.js.map +1 -1
- package/dist/components/explore.mjs +591 -464
- package/dist/components/explore.mjs.map +1 -1
- package/dist/{explore-POqE7J8r.d.mts → explore-BRfKFfvI.d.mts} +21 -2
- package/dist/{explore-D6kon7uz.d.ts → explore-DkfcKgp6.d.ts} +21 -2
- package/dist/{explore-types-BB8HNFzX.d.mts → explore-types-_9UJu6EA.d.mts} +1 -1
- package/dist/{explore-types-BB8HNFzX.d.ts → explore-types-_9UJu6EA.d.ts} +1 -1
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +15 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +15 -9
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +123 -7
- package/dist/index.d.ts +123 -7
- package/dist/index.js +922 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +922 -120
- package/dist/index.mjs.map +1 -1
- package/dist/{use-progressive-reveal-Kr6DwGXG.d.mts → use-progressive-reveal-BFPWbEXy.d.mts} +25 -2
- package/dist/{use-progressive-reveal-BVJn9NIr.d.ts → use-progressive-reveal-C0hkdu_i.d.ts} +25 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { createContext,
|
|
2
|
+
import { createContext, useContext, useMemo, useRef, useEffect, useState, useCallback, Children, isValidElement, cloneElement, useId } from 'react';
|
|
3
3
|
import { Sparkles, RotateCcw, Link2, History, Trash2, Paperclip, X, Mic, Square, ArrowUp, BookOpenText, Layers, TriangleAlert, ChevronLeft, ChevronRight, ExternalLink, Check, Copy, ThumbsUp, ThumbsDown, Volume2, Film, Play, Minimize, Maximize, VideoOff } from 'lucide-react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -109,6 +109,14 @@ var EN = {
|
|
|
109
109
|
closeVideo: "Close video",
|
|
110
110
|
enterFullScreen: "Full screen",
|
|
111
111
|
exitFullScreen: "Exit full screen",
|
|
112
|
+
panelTitle: "AI assistant",
|
|
113
|
+
panelViews: "Assistant views",
|
|
114
|
+
tabChat: "Chat",
|
|
115
|
+
tabAvatar: "Avatar",
|
|
116
|
+
closePanel: "Close",
|
|
117
|
+
liveAvatar: "Live avatar",
|
|
118
|
+
avatarComingSoon: "Live avatar coming soon",
|
|
119
|
+
continueInChat: "Continue in Chat",
|
|
112
120
|
videoUnavailable: "This video can't be played right now.",
|
|
113
121
|
groundedIn: "What this answer is based on",
|
|
114
122
|
sourceCountOne: "1 source",
|
|
@@ -217,6 +225,14 @@ var ZH = {
|
|
|
217
225
|
closeVideo: "\u5173\u95ED\u89C6\u9891",
|
|
218
226
|
enterFullScreen: "\u5168\u5C4F",
|
|
219
227
|
exitFullScreen: "\u9000\u51FA\u5168\u5C4F",
|
|
228
|
+
panelTitle: "AI \u52A9\u624B",
|
|
229
|
+
panelViews: "\u52A9\u624B\u89C6\u56FE",
|
|
230
|
+
tabChat: "\u804A\u5929",
|
|
231
|
+
tabAvatar: "\u865A\u62DF\u5F62\u8C61",
|
|
232
|
+
closePanel: "\u5173\u95ED",
|
|
233
|
+
liveAvatar: "\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61",
|
|
234
|
+
avatarComingSoon: "\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61\u5373\u5C06\u63A8\u51FA",
|
|
235
|
+
continueInChat: "\u5728\u804A\u5929\u4E2D\u7EE7\u7EED",
|
|
220
236
|
videoUnavailable: "\u6682\u65F6\u65E0\u6CD5\u64AD\u653E\u6B64\u89C6\u9891\u3002",
|
|
221
237
|
groundedIn: "\u8FD9\u4E2A\u56DE\u7B54\u7684\u4F9D\u636E",
|
|
222
238
|
sourceCountOne: "1 \u4E2A\u6765\u6E90",
|
|
@@ -321,6 +337,14 @@ var HI = {
|
|
|
321
337
|
closeVideo: "\u0935\u0940\u0921\u093F\u092F\u094B \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
322
338
|
enterFullScreen: "\u092A\u0942\u0930\u094D\u0923 \u0938\u094D\u0915\u094D\u0930\u0940\u0928",
|
|
323
339
|
exitFullScreen: "\u092A\u0942\u0930\u094D\u0923 \u0938\u094D\u0915\u094D\u0930\u0940\u0928 \u0938\u0947 \u092C\u093E\u0939\u0930 \u0928\u093F\u0915\u0932\u0947\u0902",
|
|
340
|
+
panelTitle: "AI \u0938\u0939\u093E\u092F\u0915",
|
|
341
|
+
panelViews: "\u0938\u0939\u093E\u092F\u0915 \u0926\u0943\u0936\u094D\u092F",
|
|
342
|
+
tabChat: "\u091A\u0948\u091F",
|
|
343
|
+
tabAvatar: "\u0905\u0935\u0924\u093E\u0930",
|
|
344
|
+
closePanel: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
345
|
+
liveAvatar: "\u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930",
|
|
346
|
+
avatarComingSoon: "\u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930 \u091C\u0932\u094D\u0926 \u0906 \u0930\u0939\u093E \u0939\u0948",
|
|
347
|
+
continueInChat: "\u091A\u0948\u091F \u092E\u0947\u0902 \u091C\u093E\u0930\u0940 \u0930\u0916\u0947\u0902",
|
|
324
348
|
videoUnavailable: "\u092F\u0939 \u0935\u0940\u0921\u093F\u092F\u094B \u0905\u092D\u0940 \u0928\u0939\u0940\u0902 \u091A\u0932 \u0938\u0915\u0924\u093E\u0964",
|
|
325
349
|
groundedIn: "\u092F\u0939 \u0909\u0924\u094D\u0924\u0930 \u0915\u093F\u0938 \u092A\u0930 \u0906\u0927\u093E\u0930\u093F\u0924 \u0939\u0948",
|
|
326
350
|
sourceCountOne: "1 \u0938\u094D\u0930\u094B\u0924",
|
|
@@ -429,6 +453,14 @@ var ES = {
|
|
|
429
453
|
closeVideo: "Cerrar v\xEDdeo",
|
|
430
454
|
enterFullScreen: "Pantalla completa",
|
|
431
455
|
exitFullScreen: "Salir de pantalla completa",
|
|
456
|
+
panelTitle: "Asistente de IA",
|
|
457
|
+
panelViews: "Vistas del asistente",
|
|
458
|
+
tabChat: "Chat",
|
|
459
|
+
tabAvatar: "Avatar",
|
|
460
|
+
closePanel: "Cerrar",
|
|
461
|
+
liveAvatar: "Avatar en vivo",
|
|
462
|
+
avatarComingSoon: "Avatar en vivo: pr\xF3ximamente",
|
|
463
|
+
continueInChat: "Continuar en el chat",
|
|
432
464
|
videoUnavailable: "Ahora mismo no se puede reproducir este v\xEDdeo.",
|
|
433
465
|
groundedIn: "En qu\xE9 se basa esta respuesta",
|
|
434
466
|
sourceCountOne: "1 fuente",
|
|
@@ -537,6 +569,14 @@ var AR = {
|
|
|
537
569
|
closeVideo: "\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0641\u064A\u062F\u064A\u0648",
|
|
538
570
|
enterFullScreen: "\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",
|
|
539
571
|
exitFullScreen: "\u0627\u0644\u062E\u0631\u0648\u062C \u0645\u0646 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",
|
|
572
|
+
panelTitle: "\u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",
|
|
573
|
+
panelViews: "\u0637\u0631\u0642 \u0639\u0631\u0636 \u0627\u0644\u0645\u0633\u0627\u0639\u062F",
|
|
574
|
+
tabChat: "\u062F\u0631\u062F\u0634\u0629",
|
|
575
|
+
tabAvatar: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631",
|
|
576
|
+
closePanel: "\u0625\u063A\u0644\u0627\u0642",
|
|
577
|
+
liveAvatar: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631",
|
|
578
|
+
avatarComingSoon: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631 \u0642\u0631\u064A\u0628\u064B\u0627",
|
|
579
|
+
continueInChat: "\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629 \u0641\u064A \u0627\u0644\u062F\u0631\u062F\u0634\u0629",
|
|
540
580
|
videoUnavailable: "\u062A\u0639\u0630\u0651\u0631 \u062A\u0634\u063A\u064A\u0644 \u0647\u0630\u0627 \u0627\u0644\u0641\u064A\u062F\u064A\u0648 \u0627\u0644\u0622\u0646.",
|
|
541
581
|
groundedIn: "\u0639\u0644\u0649 \u0645\u0627\u0630\u0627 \u062A\u0633\u062A\u0646\u062F \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",
|
|
542
582
|
sourceCountOne: "\u0645\u0635\u062F\u0631 \u0648\u0627\u062D\u062F",
|
|
@@ -645,6 +685,14 @@ var TA = {
|
|
|
645
685
|
closeVideo: "\u0BB5\u0BC0\u0B9F\u0BBF\u0BAF\u0BCB\u0BB5\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1",
|
|
646
686
|
enterFullScreen: "\u0BAE\u0BC1\u0BB4\u0BC1\u0BA4\u0BCD \u0BA4\u0BBF\u0BB0\u0BC8",
|
|
647
687
|
exitFullScreen: "\u0BAE\u0BC1\u0BB4\u0BC1\u0BA4\u0BCD \u0BA4\u0BBF\u0BB0\u0BC8\u0BAF\u0BBF\u0BB2\u0BBF\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4\u0BC1 \u0BB5\u0BC6\u0BB3\u0BBF\u0BAF\u0BC7\u0BB1\u0BC1",
|
|
688
|
+
panelTitle: "AI \u0B89\u0BA4\u0BB5\u0BBF\u0BAF\u0BBE\u0BB3\u0BB0\u0BCD",
|
|
689
|
+
panelViews: "\u0B89\u0BA4\u0BB5\u0BBF\u0BAF\u0BBE\u0BB3\u0BB0\u0BCD \u0B95\u0BBE\u0B9F\u0BCD\u0B9A\u0BBF\u0B95\u0BB3\u0BCD",
|
|
690
|
+
tabChat: "\u0B85\u0BB0\u0B9F\u0BCD\u0B9F\u0BC8",
|
|
691
|
+
tabAvatar: "\u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD",
|
|
692
|
+
closePanel: "\u0BAE\u0BC2\u0B9F\u0BC1",
|
|
693
|
+
liveAvatar: "\u0BA8\u0BC7\u0BB0\u0BB2\u0BC8 \u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD",
|
|
694
|
+
avatarComingSoon: "\u0BA8\u0BC7\u0BB0\u0BB2\u0BC8 \u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD \u0BB5\u0BBF\u0BB0\u0BC8\u0BB5\u0BBF\u0BB2\u0BCD",
|
|
695
|
+
continueInChat: "\u0B85\u0BB0\u0B9F\u0BCD\u0B9F\u0BC8\u0BAF\u0BBF\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0BB0\u0BB5\u0BC1\u0BAE\u0BCD",
|
|
648
696
|
videoUnavailable: "\u0B87\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC0\u0B9F\u0BBF\u0BAF\u0BCB\u0BB5\u0BC8 \u0B87\u0BAA\u0BCD\u0BAA\u0BCB\u0BA4\u0BC1 \u0B87\u0BAF\u0B95\u0BCD\u0B95 \u0BAE\u0BC1\u0B9F\u0BBF\u0BAF\u0BB5\u0BBF\u0BB2\u0BCD\u0BB2\u0BC8.",
|
|
649
697
|
groundedIn: "\u0B87\u0BA8\u0BCD\u0BA4\u0BAA\u0BCD \u0BAA\u0BA4\u0BBF\u0BB2\u0BCD \u0B8E\u0BA4\u0BC8 \u0B85\u0B9F\u0BBF\u0BAA\u0BCD\u0BAA\u0B9F\u0BC8\u0BAF\u0BBE\u0B95\u0B95\u0BCD \u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BA4\u0BC1",
|
|
650
698
|
sourceCountOne: "1 \u0BAE\u0BC2\u0BB2\u0BAE\u0BCD",
|
|
@@ -1661,392 +1709,6 @@ function ExploreAnswerBody({
|
|
|
1661
1709
|
return /* @__PURE__ */ jsx("div", { className: cn("boff-prose boff-explore-body min-w-0", className), children: /* @__PURE__ */ jsx(AnswerScopeContext.Provider, { value: scope, children: /* @__PURE__ */ jsx(Markdown, { components: overrides, rehypePlugins, children }) }) });
|
|
1662
1710
|
}
|
|
1663
1711
|
|
|
1664
|
-
// src/components/explore-types.ts
|
|
1665
|
-
var EXPLORE_FEEDBACK_REASONS = [
|
|
1666
|
-
"INACCURATE",
|
|
1667
|
-
"INCOMPLETE",
|
|
1668
|
-
"OFF_TOPIC",
|
|
1669
|
-
"HARD_TO_FOLLOW",
|
|
1670
|
-
"OTHER"
|
|
1671
|
-
];
|
|
1672
|
-
var EXPLORE_MESSAGE_FIELDS = (
|
|
1673
|
-
/* GraphQL */
|
|
1674
|
-
`
|
|
1675
|
-
id
|
|
1676
|
-
conversationId
|
|
1677
|
-
role
|
|
1678
|
-
status
|
|
1679
|
-
content
|
|
1680
|
-
partialContent
|
|
1681
|
-
activity
|
|
1682
|
-
references {
|
|
1683
|
-
url
|
|
1684
|
-
title
|
|
1685
|
-
description
|
|
1686
|
-
product
|
|
1687
|
-
imageUrl
|
|
1688
|
-
index
|
|
1689
|
-
}
|
|
1690
|
-
ctas {
|
|
1691
|
-
kind
|
|
1692
|
-
label
|
|
1693
|
-
url
|
|
1694
|
-
product
|
|
1695
|
-
}
|
|
1696
|
-
followUps
|
|
1697
|
-
answered
|
|
1698
|
-
attachments {
|
|
1699
|
-
name
|
|
1700
|
-
mimeType
|
|
1701
|
-
size
|
|
1702
|
-
textExtracted
|
|
1703
|
-
}
|
|
1704
|
-
errorCode
|
|
1705
|
-
createdAt
|
|
1706
|
-
completedAt
|
|
1707
|
-
`
|
|
1708
|
-
);
|
|
1709
|
-
var EXPLORE_OWN_MESSAGE_FIELDS = (
|
|
1710
|
-
/* GraphQL */
|
|
1711
|
-
`
|
|
1712
|
-
${EXPLORE_MESSAGE_FIELDS}
|
|
1713
|
-
feedback {
|
|
1714
|
-
rating
|
|
1715
|
-
reason
|
|
1716
|
-
comment
|
|
1717
|
-
createdAt
|
|
1718
|
-
}
|
|
1719
|
-
`
|
|
1720
|
-
);
|
|
1721
|
-
var EXPLORE_CATALOG_ESTABLISHED_FIELDS = (
|
|
1722
|
-
/* GraphQL */
|
|
1723
|
-
`
|
|
1724
|
-
enabled
|
|
1725
|
-
products {
|
|
1726
|
-
slug
|
|
1727
|
-
name
|
|
1728
|
-
tagline
|
|
1729
|
-
website
|
|
1730
|
-
}
|
|
1731
|
-
examplePrompts
|
|
1732
|
-
welcomeTitle
|
|
1733
|
-
welcomeBody
|
|
1734
|
-
limits {
|
|
1735
|
-
maxMessageLength
|
|
1736
|
-
maxTurnsPerConversation
|
|
1737
|
-
messagesPerDay
|
|
1738
|
-
historyTurns
|
|
1739
|
-
}
|
|
1740
|
-
captchaRequired
|
|
1741
|
-
recaptchaSiteKey`
|
|
1742
|
-
);
|
|
1743
|
-
var EXPLORE_CATALOG_HIGHLIGHT_FIELD = (
|
|
1744
|
-
/* GraphQL */
|
|
1745
|
-
`
|
|
1746
|
-
conceptHighlights {
|
|
1747
|
-
product
|
|
1748
|
-
productName
|
|
1749
|
-
title
|
|
1750
|
-
url
|
|
1751
|
-
imageUrl
|
|
1752
|
-
alt
|
|
1753
|
-
}`
|
|
1754
|
-
);
|
|
1755
|
-
function exploreCatalogDocument(extraFields) {
|
|
1756
|
-
return (
|
|
1757
|
-
/* GraphQL */
|
|
1758
|
-
`
|
|
1759
|
-
query ExploreCatalog($productSlug: String) {
|
|
1760
|
-
exploreCatalog(productSlug: $productSlug) {${EXPLORE_CATALOG_ESTABLISHED_FIELDS}${extraFields}
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
`
|
|
1764
|
-
);
|
|
1765
|
-
}
|
|
1766
|
-
var EXPLORE_CATALOG_QUERY = exploreCatalogDocument(
|
|
1767
|
-
EXPLORE_CATALOG_HIGHLIGHT_FIELD
|
|
1768
|
-
);
|
|
1769
|
-
var EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS = exploreCatalogDocument("");
|
|
1770
|
-
var EXPLORE_MESSAGE_QUERY = (
|
|
1771
|
-
/* GraphQL */
|
|
1772
|
-
`
|
|
1773
|
-
query ExploreMessage($conversationToken: String!, $id: ID!) {
|
|
1774
|
-
exploreMessage(conversationToken: $conversationToken, id: $id) {
|
|
1775
|
-
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
`
|
|
1779
|
-
);
|
|
1780
|
-
var SEND_EXPLORE_MESSAGE_MUTATION = (
|
|
1781
|
-
/* GraphQL */
|
|
1782
|
-
`
|
|
1783
|
-
mutation SendExploreMessage($input: SendExploreMessageInput!) {
|
|
1784
|
-
sendExploreMessage(input: $input) {
|
|
1785
|
-
conversation {
|
|
1786
|
-
id
|
|
1787
|
-
token
|
|
1788
|
-
productSlug
|
|
1789
|
-
turnCount
|
|
1790
|
-
createdAt
|
|
1791
|
-
}
|
|
1792
|
-
userMessage {
|
|
1793
|
-
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
1794
|
-
}
|
|
1795
|
-
assistantMessage {
|
|
1796
|
-
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
1797
|
-
}
|
|
1798
|
-
remainingToday
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
`
|
|
1802
|
-
);
|
|
1803
|
-
var RECORD_EXPLORE_CLICK_MUTATION = (
|
|
1804
|
-
/* GraphQL */
|
|
1805
|
-
`
|
|
1806
|
-
mutation RecordExploreClick($input: RecordExploreClickInput!) {
|
|
1807
|
-
recordExploreClick(input: $input) {
|
|
1808
|
-
recorded
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
`
|
|
1812
|
-
);
|
|
1813
|
-
var SUBMIT_EXPLORE_FEEDBACK_MUTATION = (
|
|
1814
|
-
/* GraphQL */
|
|
1815
|
-
`
|
|
1816
|
-
mutation SubmitExploreFeedback($input: SubmitExploreFeedbackInput!) {
|
|
1817
|
-
submitExploreFeedback(input: $input) {
|
|
1818
|
-
recorded
|
|
1819
|
-
feedback {
|
|
1820
|
-
rating
|
|
1821
|
-
reason
|
|
1822
|
-
comment
|
|
1823
|
-
createdAt
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
`
|
|
1828
|
-
);
|
|
1829
|
-
var EXPLORE_FEEDBACK_COMMENT_SOFT_MAX = 500;
|
|
1830
|
-
var ESCALATE_EXPLORE_CONVERSATION_MUTATION = (
|
|
1831
|
-
/* GraphQL */
|
|
1832
|
-
`
|
|
1833
|
-
mutation EscalateExploreConversation(
|
|
1834
|
-
$input: EscalateExploreConversationInput!
|
|
1835
|
-
) {
|
|
1836
|
-
escalateExploreConversation(input: $input) {
|
|
1837
|
-
created
|
|
1838
|
-
escalation {
|
|
1839
|
-
email
|
|
1840
|
-
createdAt
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
`
|
|
1845
|
-
);
|
|
1846
|
-
var EXPLORE_ESCALATION_NOTE_SOFT_MAX = 2e3;
|
|
1847
|
-
var DELIVERABLE_EMAIL = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z]{2,}$/;
|
|
1848
|
-
function looksLikeDeliverableEmail(value) {
|
|
1849
|
-
const trimmed = value.trim();
|
|
1850
|
-
if (trimmed.length === 0 || trimmed.length > 254) return false;
|
|
1851
|
-
return DELIVERABLE_EMAIL.test(trimmed);
|
|
1852
|
-
}
|
|
1853
|
-
var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
|
|
1854
|
-
/* GraphQL */
|
|
1855
|
-
`
|
|
1856
|
-
mutation CreateExploreShareLink($conversationToken: String!) {
|
|
1857
|
-
createExploreShareLink(conversationToken: $conversationToken) {
|
|
1858
|
-
shareToken
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
`
|
|
1862
|
-
);
|
|
1863
|
-
var EXPLORE_SHARED_CONVERSATION_QUERY = (
|
|
1864
|
-
/* GraphQL */
|
|
1865
|
-
`
|
|
1866
|
-
query ExploreSharedConversation($shareToken: String!) {
|
|
1867
|
-
exploreSharedConversation(shareToken: $shareToken) {
|
|
1868
|
-
${EXPLORE_MESSAGE_FIELDS}
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
`
|
|
1872
|
-
);
|
|
1873
|
-
var PROSE_CSS = `
|
|
1874
|
-
.boff-prose {
|
|
1875
|
-
max-width: none;
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
.boff-prose h1 {
|
|
1879
|
-
font-size: 2.25rem;
|
|
1880
|
-
font-weight: 800;
|
|
1881
|
-
line-height: 1.2;
|
|
1882
|
-
margin-top: 0;
|
|
1883
|
-
margin-bottom: 1rem;
|
|
1884
|
-
color: hsl(var(--foreground));
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
.boff-prose h2 {
|
|
1888
|
-
font-size: 1.75rem;
|
|
1889
|
-
font-weight: 700;
|
|
1890
|
-
line-height: 1.3;
|
|
1891
|
-
margin-top: 2rem;
|
|
1892
|
-
margin-bottom: 1rem;
|
|
1893
|
-
color: hsl(var(--foreground));
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
.boff-prose h3 {
|
|
1897
|
-
font-size: 1.5rem;
|
|
1898
|
-
font-weight: 600;
|
|
1899
|
-
line-height: 1.4;
|
|
1900
|
-
margin-top: 1.5rem;
|
|
1901
|
-
margin-bottom: 0.75rem;
|
|
1902
|
-
color: hsl(var(--foreground));
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
.boff-prose h4 {
|
|
1906
|
-
font-size: 1.25rem;
|
|
1907
|
-
font-weight: 600;
|
|
1908
|
-
line-height: 1.5;
|
|
1909
|
-
margin-top: 1.25rem;
|
|
1910
|
-
margin-bottom: 0.5rem;
|
|
1911
|
-
color: hsl(var(--foreground));
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
.boff-prose p {
|
|
1915
|
-
margin-bottom: 1rem;
|
|
1916
|
-
line-height: 1.75;
|
|
1917
|
-
color: hsl(var(--foreground));
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
.boff-prose ul,
|
|
1921
|
-
.boff-prose ol {
|
|
1922
|
-
margin-bottom: 1rem;
|
|
1923
|
-
padding-left: 1.5rem;
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
.boff-prose ul {
|
|
1927
|
-
list-style-type: disc;
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
.boff-prose ol {
|
|
1931
|
-
list-style-type: decimal;
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
.boff-prose li {
|
|
1935
|
-
margin-bottom: 0.25rem;
|
|
1936
|
-
line-height: 1.75;
|
|
1937
|
-
color: hsl(var(--foreground));
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
.boff-prose li > ul,
|
|
1941
|
-
.boff-prose li > ol {
|
|
1942
|
-
margin-top: 0.25rem;
|
|
1943
|
-
margin-bottom: 0.25rem;
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
.boff-prose a {
|
|
1947
|
-
color: hsl(var(--primary));
|
|
1948
|
-
text-decoration: underline;
|
|
1949
|
-
text-underline-offset: 2px;
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
.boff-prose a:hover {
|
|
1953
|
-
opacity: 0.8;
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
.boff-prose hr {
|
|
1957
|
-
border: none;
|
|
1958
|
-
height: 1px;
|
|
1959
|
-
background-color: hsl(var(--border));
|
|
1960
|
-
margin: 2rem 0;
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
.boff-prose blockquote {
|
|
1964
|
-
border-left: 4px solid hsl(var(--border));
|
|
1965
|
-
padding-left: 1rem;
|
|
1966
|
-
margin: 1.5rem 0;
|
|
1967
|
-
font-style: italic;
|
|
1968
|
-
color: hsl(var(--muted-foreground));
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
.boff-prose strong {
|
|
1972
|
-
font-weight: 700;
|
|
1973
|
-
color: hsl(var(--foreground));
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
.boff-prose code {
|
|
1977
|
-
background-color: hsl(var(--muted));
|
|
1978
|
-
padding: 0.125rem 0.25rem;
|
|
1979
|
-
border-radius: 0.25rem;
|
|
1980
|
-
font-size: 0.875em;
|
|
1981
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
|
-
.boff-prose pre {
|
|
1985
|
-
background-color: hsl(var(--muted));
|
|
1986
|
-
padding: 1rem;
|
|
1987
|
-
border-radius: 0.5rem;
|
|
1988
|
-
overflow-x: auto;
|
|
1989
|
-
margin-bottom: 1rem;
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
.boff-prose pre code {
|
|
1993
|
-
background-color: transparent;
|
|
1994
|
-
padding: 0;
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
.boff-prose img {
|
|
1998
|
-
max-width: 100%;
|
|
1999
|
-
height: auto;
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
.boff-prose table {
|
|
2003
|
-
width: 100%;
|
|
2004
|
-
border-collapse: collapse;
|
|
2005
|
-
margin-bottom: 1rem;
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
.boff-prose th,
|
|
2009
|
-
.boff-prose td {
|
|
2010
|
-
border: 1px solid hsl(var(--border));
|
|
2011
|
-
padding: 0.5rem;
|
|
2012
|
-
text-align: left;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
.boff-prose th {
|
|
2016
|
-
font-weight: 600;
|
|
2017
|
-
background-color: hsl(var(--muted));
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
/* Smaller variant used inside cards and compact panels */
|
|
2021
|
-
.boff-prose-sm {
|
|
2022
|
-
font-size: 0.875rem;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
.boff-prose-sm h1 {
|
|
2026
|
-
font-size: 1.75rem;
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
.boff-prose-sm h2 {
|
|
2030
|
-
font-size: 1.5rem;
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
.boff-prose-sm h3 {
|
|
2034
|
-
font-size: 1.25rem;
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
.boff-prose-sm h4 {
|
|
2038
|
-
font-size: 1.125rem;
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
.boff-prose-sm p,
|
|
2042
|
-
.boff-prose-sm li {
|
|
2043
|
-
line-height: 1.625;
|
|
2044
|
-
}
|
|
2045
|
-
`;
|
|
2046
|
-
function ProseStyles() {
|
|
2047
|
-
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: PROSE_CSS } });
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
1712
|
// src/client/security.ts
|
|
2051
1713
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
|
|
2052
1714
|
var RESERVED_HEADERS = /* @__PURE__ */ new Set([
|
|
@@ -2249,27 +1911,237 @@ var _WebSDKClient = class _WebSDKClient {
|
|
|
2249
1911
|
_WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
|
|
2250
1912
|
);
|
|
2251
1913
|
}
|
|
2252
|
-
return last;
|
|
1914
|
+
return last;
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
__publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
|
|
1918
|
+
// 5 minutes
|
|
1919
|
+
__publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
|
|
1920
|
+
__publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
|
|
1921
|
+
__publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
|
|
1922
|
+
__publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
|
|
1923
|
+
var WebSDKContext = createContext(null);
|
|
1924
|
+
function useWebSDK() {
|
|
1925
|
+
const client = useContext(WebSDKContext);
|
|
1926
|
+
if (!client) {
|
|
1927
|
+
throw new Error("useWebSDK must be used within a WebSDKProvider");
|
|
1928
|
+
}
|
|
1929
|
+
return client;
|
|
1930
|
+
}
|
|
1931
|
+
function useWebSDKConfig() {
|
|
1932
|
+
const client = useWebSDK();
|
|
1933
|
+
return client.getConfig();
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
// src/components/explore-types.ts
|
|
1937
|
+
var EXPLORE_FEEDBACK_REASONS = [
|
|
1938
|
+
"INACCURATE",
|
|
1939
|
+
"INCOMPLETE",
|
|
1940
|
+
"OFF_TOPIC",
|
|
1941
|
+
"HARD_TO_FOLLOW",
|
|
1942
|
+
"OTHER"
|
|
1943
|
+
];
|
|
1944
|
+
var EXPLORE_MESSAGE_FIELDS = (
|
|
1945
|
+
/* GraphQL */
|
|
1946
|
+
`
|
|
1947
|
+
id
|
|
1948
|
+
conversationId
|
|
1949
|
+
role
|
|
1950
|
+
status
|
|
1951
|
+
content
|
|
1952
|
+
partialContent
|
|
1953
|
+
activity
|
|
1954
|
+
references {
|
|
1955
|
+
url
|
|
1956
|
+
title
|
|
1957
|
+
description
|
|
1958
|
+
product
|
|
1959
|
+
imageUrl
|
|
1960
|
+
index
|
|
1961
|
+
}
|
|
1962
|
+
ctas {
|
|
1963
|
+
kind
|
|
1964
|
+
label
|
|
1965
|
+
url
|
|
1966
|
+
product
|
|
1967
|
+
}
|
|
1968
|
+
followUps
|
|
1969
|
+
answered
|
|
1970
|
+
attachments {
|
|
1971
|
+
name
|
|
1972
|
+
mimeType
|
|
1973
|
+
size
|
|
1974
|
+
textExtracted
|
|
1975
|
+
}
|
|
1976
|
+
errorCode
|
|
1977
|
+
createdAt
|
|
1978
|
+
completedAt
|
|
1979
|
+
`
|
|
1980
|
+
);
|
|
1981
|
+
var EXPLORE_OWN_MESSAGE_FIELDS = (
|
|
1982
|
+
/* GraphQL */
|
|
1983
|
+
`
|
|
1984
|
+
${EXPLORE_MESSAGE_FIELDS}
|
|
1985
|
+
feedback {
|
|
1986
|
+
rating
|
|
1987
|
+
reason
|
|
1988
|
+
comment
|
|
1989
|
+
createdAt
|
|
1990
|
+
}
|
|
1991
|
+
`
|
|
1992
|
+
);
|
|
1993
|
+
var EXPLORE_CATALOG_ESTABLISHED_FIELDS = (
|
|
1994
|
+
/* GraphQL */
|
|
1995
|
+
`
|
|
1996
|
+
enabled
|
|
1997
|
+
products {
|
|
1998
|
+
slug
|
|
1999
|
+
name
|
|
2000
|
+
tagline
|
|
2001
|
+
website
|
|
2002
|
+
}
|
|
2003
|
+
examplePrompts
|
|
2004
|
+
welcomeTitle
|
|
2005
|
+
welcomeBody
|
|
2006
|
+
limits {
|
|
2007
|
+
maxMessageLength
|
|
2008
|
+
maxTurnsPerConversation
|
|
2009
|
+
messagesPerDay
|
|
2010
|
+
historyTurns
|
|
2011
|
+
}
|
|
2012
|
+
captchaRequired
|
|
2013
|
+
recaptchaSiteKey`
|
|
2014
|
+
);
|
|
2015
|
+
var EXPLORE_CATALOG_HIGHLIGHT_FIELD = (
|
|
2016
|
+
/* GraphQL */
|
|
2017
|
+
`
|
|
2018
|
+
conceptHighlights {
|
|
2019
|
+
product
|
|
2020
|
+
productName
|
|
2021
|
+
title
|
|
2022
|
+
url
|
|
2023
|
+
imageUrl
|
|
2024
|
+
alt
|
|
2025
|
+
}`
|
|
2026
|
+
);
|
|
2027
|
+
function exploreCatalogDocument(extraFields) {
|
|
2028
|
+
return (
|
|
2029
|
+
/* GraphQL */
|
|
2030
|
+
`
|
|
2031
|
+
query ExploreCatalog($productSlug: String) {
|
|
2032
|
+
exploreCatalog(productSlug: $productSlug) {${EXPLORE_CATALOG_ESTABLISHED_FIELDS}${extraFields}
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
`
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
var EXPLORE_CATALOG_QUERY = exploreCatalogDocument(
|
|
2039
|
+
EXPLORE_CATALOG_HIGHLIGHT_FIELD
|
|
2040
|
+
);
|
|
2041
|
+
var EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS = exploreCatalogDocument("");
|
|
2042
|
+
var EXPLORE_MESSAGE_QUERY = (
|
|
2043
|
+
/* GraphQL */
|
|
2044
|
+
`
|
|
2045
|
+
query ExploreMessage($conversationToken: String!, $id: ID!) {
|
|
2046
|
+
exploreMessage(conversationToken: $conversationToken, id: $id) {
|
|
2047
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
`
|
|
2051
|
+
);
|
|
2052
|
+
var SEND_EXPLORE_MESSAGE_MUTATION = (
|
|
2053
|
+
/* GraphQL */
|
|
2054
|
+
`
|
|
2055
|
+
mutation SendExploreMessage($input: SendExploreMessageInput!) {
|
|
2056
|
+
sendExploreMessage(input: $input) {
|
|
2057
|
+
conversation {
|
|
2058
|
+
id
|
|
2059
|
+
token
|
|
2060
|
+
productSlug
|
|
2061
|
+
turnCount
|
|
2062
|
+
createdAt
|
|
2063
|
+
}
|
|
2064
|
+
userMessage {
|
|
2065
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
2066
|
+
}
|
|
2067
|
+
assistantMessage {
|
|
2068
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
2069
|
+
}
|
|
2070
|
+
remainingToday
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
`
|
|
2074
|
+
);
|
|
2075
|
+
var RECORD_EXPLORE_CLICK_MUTATION = (
|
|
2076
|
+
/* GraphQL */
|
|
2077
|
+
`
|
|
2078
|
+
mutation RecordExploreClick($input: RecordExploreClickInput!) {
|
|
2079
|
+
recordExploreClick(input: $input) {
|
|
2080
|
+
recorded
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
`
|
|
2084
|
+
);
|
|
2085
|
+
var SUBMIT_EXPLORE_FEEDBACK_MUTATION = (
|
|
2086
|
+
/* GraphQL */
|
|
2087
|
+
`
|
|
2088
|
+
mutation SubmitExploreFeedback($input: SubmitExploreFeedbackInput!) {
|
|
2089
|
+
submitExploreFeedback(input: $input) {
|
|
2090
|
+
recorded
|
|
2091
|
+
feedback {
|
|
2092
|
+
rating
|
|
2093
|
+
reason
|
|
2094
|
+
comment
|
|
2095
|
+
createdAt
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
`
|
|
2100
|
+
);
|
|
2101
|
+
var EXPLORE_FEEDBACK_COMMENT_SOFT_MAX = 500;
|
|
2102
|
+
var ESCALATE_EXPLORE_CONVERSATION_MUTATION = (
|
|
2103
|
+
/* GraphQL */
|
|
2104
|
+
`
|
|
2105
|
+
mutation EscalateExploreConversation(
|
|
2106
|
+
$input: EscalateExploreConversationInput!
|
|
2107
|
+
) {
|
|
2108
|
+
escalateExploreConversation(input: $input) {
|
|
2109
|
+
created
|
|
2110
|
+
escalation {
|
|
2111
|
+
email
|
|
2112
|
+
createdAt
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
`
|
|
2117
|
+
);
|
|
2118
|
+
var EXPLORE_ESCALATION_NOTE_SOFT_MAX = 2e3;
|
|
2119
|
+
var DELIVERABLE_EMAIL = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z]{2,}$/;
|
|
2120
|
+
function looksLikeDeliverableEmail(value) {
|
|
2121
|
+
const trimmed = value.trim();
|
|
2122
|
+
if (trimmed.length === 0 || trimmed.length > 254) return false;
|
|
2123
|
+
return DELIVERABLE_EMAIL.test(trimmed);
|
|
2124
|
+
}
|
|
2125
|
+
var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
|
|
2126
|
+
/* GraphQL */
|
|
2127
|
+
`
|
|
2128
|
+
mutation CreateExploreShareLink($conversationToken: String!) {
|
|
2129
|
+
createExploreShareLink(conversationToken: $conversationToken) {
|
|
2130
|
+
shareToken
|
|
2131
|
+
}
|
|
2253
2132
|
}
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
const client = useContext(WebSDKContext);
|
|
2264
|
-
if (!client) {
|
|
2265
|
-
throw new Error("useWebSDK must be used within a WebSDKProvider");
|
|
2133
|
+
`
|
|
2134
|
+
);
|
|
2135
|
+
var EXPLORE_SHARED_CONVERSATION_QUERY = (
|
|
2136
|
+
/* GraphQL */
|
|
2137
|
+
`
|
|
2138
|
+
query ExploreSharedConversation($shareToken: String!) {
|
|
2139
|
+
exploreSharedConversation(shareToken: $shareToken) {
|
|
2140
|
+
${EXPLORE_MESSAGE_FIELDS}
|
|
2141
|
+
}
|
|
2266
2142
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
function useWebSDKConfig() {
|
|
2270
|
-
const client = useWebSDK();
|
|
2271
|
-
return client.getConfig();
|
|
2272
|
-
}
|
|
2143
|
+
`
|
|
2144
|
+
);
|
|
2273
2145
|
|
|
2274
2146
|
// src/utils/product-slug.ts
|
|
2275
2147
|
var PRODUCT_SLUG_RENAMES = Object.freeze(
|
|
@@ -2872,7 +2744,9 @@ function useExploreChat(options = {}) {
|
|
|
2872
2744
|
pollTimeoutMs = DEFAULT_POLL_TIMEOUT_MS,
|
|
2873
2745
|
storageKey = DEFAULT_STORAGE_KEY,
|
|
2874
2746
|
persist = true,
|
|
2875
|
-
onSend
|
|
2747
|
+
onSend,
|
|
2748
|
+
enabled = true,
|
|
2749
|
+
shareToken: shareTokenOption
|
|
2876
2750
|
} = options;
|
|
2877
2751
|
const client = useWebSDK();
|
|
2878
2752
|
const { productId } = useWebSDKConfig();
|
|
@@ -2910,7 +2784,7 @@ function useExploreChat(options = {}) {
|
|
|
2910
2784
|
const [hasConversation, setHasConversation] = useState(false);
|
|
2911
2785
|
const shareTokenRef = useRef(void 0);
|
|
2912
2786
|
if (shareTokenRef.current === void 0) {
|
|
2913
|
-
shareTokenRef.current = readShareToken();
|
|
2787
|
+
shareTokenRef.current = shareTokenOption === void 0 ? readShareToken() : shareTokenOption;
|
|
2914
2788
|
}
|
|
2915
2789
|
const isSharedView = shareTokenRef.current !== null;
|
|
2916
2790
|
const catalogRef = useRef(catalog);
|
|
@@ -2948,6 +2822,7 @@ function useExploreChat(options = {}) {
|
|
|
2948
2822
|
};
|
|
2949
2823
|
}, []);
|
|
2950
2824
|
useEffect(() => {
|
|
2825
|
+
if (!enabled) return;
|
|
2951
2826
|
const shareToken = shareTokenRef.current;
|
|
2952
2827
|
if (!shareToken) return;
|
|
2953
2828
|
let cancelled = false;
|
|
@@ -2982,8 +2857,9 @@ function useExploreChat(options = {}) {
|
|
|
2982
2857
|
return () => {
|
|
2983
2858
|
cancelled = true;
|
|
2984
2859
|
};
|
|
2985
|
-
}, [client]);
|
|
2860
|
+
}, [client, enabled]);
|
|
2986
2861
|
useEffect(() => {
|
|
2862
|
+
if (!enabled) return;
|
|
2987
2863
|
if (shareTokenRef.current !== null) return;
|
|
2988
2864
|
if (!persist) {
|
|
2989
2865
|
setHydrated(true);
|
|
@@ -3008,9 +2884,10 @@ function useExploreChat(options = {}) {
|
|
|
3008
2884
|
setTurnCount(turns);
|
|
3009
2885
|
}
|
|
3010
2886
|
setHydrated(true);
|
|
3011
|
-
}, [persist, rememberConversationToken, storageKey]);
|
|
2887
|
+
}, [persist, rememberConversationToken, storageKey, enabled]);
|
|
3012
2888
|
useEffect(() => {
|
|
3013
|
-
if (!persist || !hydrated || typeof window === "undefined")
|
|
2889
|
+
if (!persist || !hydrated || isSharedView || typeof window === "undefined")
|
|
2890
|
+
return;
|
|
3014
2891
|
try {
|
|
3015
2892
|
const payload = {
|
|
3016
2893
|
conversationToken: conversationTokenRef.current,
|
|
@@ -3024,10 +2901,10 @@ function useExploreChat(options = {}) {
|
|
|
3024
2901
|
window.localStorage.setItem(storageKey, JSON.stringify(payload));
|
|
3025
2902
|
} catch {
|
|
3026
2903
|
}
|
|
3027
|
-
}, [persist, hydrated, storageKey, messages, focusProduct]);
|
|
2904
|
+
}, [persist, hydrated, isSharedView, storageKey, messages, focusProduct]);
|
|
3028
2905
|
useEffect(() => {
|
|
3029
2906
|
messagesRef.current = messages;
|
|
3030
|
-
if (!persist || !hydrated) return;
|
|
2907
|
+
if (!persist || !hydrated || isSharedView) return;
|
|
3031
2908
|
const settled = messages.some(
|
|
3032
2909
|
(m) => m.role === "ASSISTANT" && (m.status === "COMPLETED" || m.status === "FAILED")
|
|
3033
2910
|
);
|
|
@@ -3039,8 +2916,9 @@ function useExploreChat(options = {}) {
|
|
|
3039
2916
|
focusProduct: focusProductRef.current
|
|
3040
2917
|
})
|
|
3041
2918
|
);
|
|
3042
|
-
}, [messages, persist, hydrated, storageKey]);
|
|
2919
|
+
}, [messages, persist, hydrated, isSharedView, storageKey]);
|
|
3043
2920
|
useEffect(() => {
|
|
2921
|
+
if (!enabled) return;
|
|
3044
2922
|
let cancelled = false;
|
|
3045
2923
|
const load = async () => {
|
|
3046
2924
|
const variables = { productSlug: productSlug ?? null };
|
|
@@ -3081,7 +2959,7 @@ function useExploreChat(options = {}) {
|
|
|
3081
2959
|
return () => {
|
|
3082
2960
|
cancelled = true;
|
|
3083
2961
|
};
|
|
3084
|
-
}, [client, productSlug, fallbackCatalog, bakedRaw]);
|
|
2962
|
+
}, [client, productSlug, fallbackCatalog, bakedRaw, enabled]);
|
|
3085
2963
|
const startPolling = useCallback(
|
|
3086
2964
|
(conversationToken, messageId) => {
|
|
3087
2965
|
pollGenerationRef.current += 1;
|
|
@@ -3578,6 +3456,218 @@ function makeOptimisticId() {
|
|
|
3578
3456
|
optimisticCounter += 1;
|
|
3579
3457
|
return `boff-explore-local-${Date.now()}-${optimisticCounter}`;
|
|
3580
3458
|
}
|
|
3459
|
+
var ExploreConversationContext = createContext(null);
|
|
3460
|
+
function useExploreConversation(options = {}) {
|
|
3461
|
+
const {
|
|
3462
|
+
productSlug,
|
|
3463
|
+
locale,
|
|
3464
|
+
examplePrompts,
|
|
3465
|
+
onSend,
|
|
3466
|
+
pageUrl,
|
|
3467
|
+
enabled,
|
|
3468
|
+
shareToken
|
|
3469
|
+
} = options;
|
|
3470
|
+
const urlAtMount = useMemo(
|
|
3471
|
+
() => typeof window === "undefined" ? void 0 : window.location.href,
|
|
3472
|
+
[]
|
|
3473
|
+
);
|
|
3474
|
+
const T = useMemo(
|
|
3475
|
+
() => exploreStrings(resolveExploreLocale(locale)),
|
|
3476
|
+
[locale]
|
|
3477
|
+
);
|
|
3478
|
+
const chat = useExploreChat({
|
|
3479
|
+
productSlug,
|
|
3480
|
+
pageUrl: pageUrl ?? urlAtMount,
|
|
3481
|
+
onSend,
|
|
3482
|
+
// Locale-aware, so a catalog outage degrades to a translated welcome rather than an English one.
|
|
3483
|
+
examplePrompts: examplePrompts ?? T.prompts,
|
|
3484
|
+
fallbackWelcome: { title: T.welcomeTitle, body: T.welcomeBody },
|
|
3485
|
+
...enabled === void 0 ? {} : { enabled },
|
|
3486
|
+
...shareToken === void 0 ? {} : { shareToken }
|
|
3487
|
+
});
|
|
3488
|
+
const [draft, setDraft] = useState("");
|
|
3489
|
+
const [staged, setStaged] = useState([]);
|
|
3490
|
+
return useMemo(
|
|
3491
|
+
() => ({ ...chat, draft, setDraft, staged, setStaged }),
|
|
3492
|
+
[chat, draft, staged]
|
|
3493
|
+
);
|
|
3494
|
+
}
|
|
3495
|
+
var PROSE_CSS = `
|
|
3496
|
+
.boff-prose {
|
|
3497
|
+
max-width: none;
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3500
|
+
.boff-prose h1 {
|
|
3501
|
+
font-size: 2.25rem;
|
|
3502
|
+
font-weight: 800;
|
|
3503
|
+
line-height: 1.2;
|
|
3504
|
+
margin-top: 0;
|
|
3505
|
+
margin-bottom: 1rem;
|
|
3506
|
+
color: hsl(var(--foreground));
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
.boff-prose h2 {
|
|
3510
|
+
font-size: 1.75rem;
|
|
3511
|
+
font-weight: 700;
|
|
3512
|
+
line-height: 1.3;
|
|
3513
|
+
margin-top: 2rem;
|
|
3514
|
+
margin-bottom: 1rem;
|
|
3515
|
+
color: hsl(var(--foreground));
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
.boff-prose h3 {
|
|
3519
|
+
font-size: 1.5rem;
|
|
3520
|
+
font-weight: 600;
|
|
3521
|
+
line-height: 1.4;
|
|
3522
|
+
margin-top: 1.5rem;
|
|
3523
|
+
margin-bottom: 0.75rem;
|
|
3524
|
+
color: hsl(var(--foreground));
|
|
3525
|
+
}
|
|
3526
|
+
|
|
3527
|
+
.boff-prose h4 {
|
|
3528
|
+
font-size: 1.25rem;
|
|
3529
|
+
font-weight: 600;
|
|
3530
|
+
line-height: 1.5;
|
|
3531
|
+
margin-top: 1.25rem;
|
|
3532
|
+
margin-bottom: 0.5rem;
|
|
3533
|
+
color: hsl(var(--foreground));
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
.boff-prose p {
|
|
3537
|
+
margin-bottom: 1rem;
|
|
3538
|
+
line-height: 1.75;
|
|
3539
|
+
color: hsl(var(--foreground));
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
.boff-prose ul,
|
|
3543
|
+
.boff-prose ol {
|
|
3544
|
+
margin-bottom: 1rem;
|
|
3545
|
+
padding-left: 1.5rem;
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
.boff-prose ul {
|
|
3549
|
+
list-style-type: disc;
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
.boff-prose ol {
|
|
3553
|
+
list-style-type: decimal;
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
.boff-prose li {
|
|
3557
|
+
margin-bottom: 0.25rem;
|
|
3558
|
+
line-height: 1.75;
|
|
3559
|
+
color: hsl(var(--foreground));
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
.boff-prose li > ul,
|
|
3563
|
+
.boff-prose li > ol {
|
|
3564
|
+
margin-top: 0.25rem;
|
|
3565
|
+
margin-bottom: 0.25rem;
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
.boff-prose a {
|
|
3569
|
+
color: hsl(var(--primary));
|
|
3570
|
+
text-decoration: underline;
|
|
3571
|
+
text-underline-offset: 2px;
|
|
3572
|
+
}
|
|
3573
|
+
|
|
3574
|
+
.boff-prose a:hover {
|
|
3575
|
+
opacity: 0.8;
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
.boff-prose hr {
|
|
3579
|
+
border: none;
|
|
3580
|
+
height: 1px;
|
|
3581
|
+
background-color: hsl(var(--border));
|
|
3582
|
+
margin: 2rem 0;
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
.boff-prose blockquote {
|
|
3586
|
+
border-left: 4px solid hsl(var(--border));
|
|
3587
|
+
padding-left: 1rem;
|
|
3588
|
+
margin: 1.5rem 0;
|
|
3589
|
+
font-style: italic;
|
|
3590
|
+
color: hsl(var(--muted-foreground));
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
.boff-prose strong {
|
|
3594
|
+
font-weight: 700;
|
|
3595
|
+
color: hsl(var(--foreground));
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
.boff-prose code {
|
|
3599
|
+
background-color: hsl(var(--muted));
|
|
3600
|
+
padding: 0.125rem 0.25rem;
|
|
3601
|
+
border-radius: 0.25rem;
|
|
3602
|
+
font-size: 0.875em;
|
|
3603
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
.boff-prose pre {
|
|
3607
|
+
background-color: hsl(var(--muted));
|
|
3608
|
+
padding: 1rem;
|
|
3609
|
+
border-radius: 0.5rem;
|
|
3610
|
+
overflow-x: auto;
|
|
3611
|
+
margin-bottom: 1rem;
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
.boff-prose pre code {
|
|
3615
|
+
background-color: transparent;
|
|
3616
|
+
padding: 0;
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
.boff-prose img {
|
|
3620
|
+
max-width: 100%;
|
|
3621
|
+
height: auto;
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
.boff-prose table {
|
|
3625
|
+
width: 100%;
|
|
3626
|
+
border-collapse: collapse;
|
|
3627
|
+
margin-bottom: 1rem;
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
.boff-prose th,
|
|
3631
|
+
.boff-prose td {
|
|
3632
|
+
border: 1px solid hsl(var(--border));
|
|
3633
|
+
padding: 0.5rem;
|
|
3634
|
+
text-align: left;
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3637
|
+
.boff-prose th {
|
|
3638
|
+
font-weight: 600;
|
|
3639
|
+
background-color: hsl(var(--muted));
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
/* Smaller variant used inside cards and compact panels */
|
|
3643
|
+
.boff-prose-sm {
|
|
3644
|
+
font-size: 0.875rem;
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
.boff-prose-sm h1 {
|
|
3648
|
+
font-size: 1.75rem;
|
|
3649
|
+
}
|
|
3650
|
+
|
|
3651
|
+
.boff-prose-sm h2 {
|
|
3652
|
+
font-size: 1.5rem;
|
|
3653
|
+
}
|
|
3654
|
+
|
|
3655
|
+
.boff-prose-sm h3 {
|
|
3656
|
+
font-size: 1.25rem;
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
.boff-prose-sm h4 {
|
|
3660
|
+
font-size: 1.125rem;
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3663
|
+
.boff-prose-sm p,
|
|
3664
|
+
.boff-prose-sm li {
|
|
3665
|
+
line-height: 1.625;
|
|
3666
|
+
}
|
|
3667
|
+
`;
|
|
3668
|
+
function ProseStyles() {
|
|
3669
|
+
return /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: PROSE_CSS } });
|
|
3670
|
+
}
|
|
3581
3671
|
var DRAIN_TARGET_MS = 1200;
|
|
3582
3672
|
var MIN_CHARS_PER_SECOND = 90;
|
|
3583
3673
|
var MAX_CHARS_PER_SECOND = 2200;
|
|
@@ -6348,15 +6438,17 @@ function WelcomeState({
|
|
|
6348
6438
|
focusProduct,
|
|
6349
6439
|
onPrompt,
|
|
6350
6440
|
onFocus,
|
|
6351
|
-
disabled
|
|
6441
|
+
disabled,
|
|
6442
|
+
heading = "h1"
|
|
6352
6443
|
}) {
|
|
6444
|
+
const Heading = heading;
|
|
6353
6445
|
return /* @__PURE__ */ jsxs("div", { className: "boff-explore-aura mx-auto my-auto w-full max-w-3xl px-4 py-4 sm:py-5", children: [
|
|
6354
6446
|
/* @__PURE__ */ jsxs("div", { className: "boff-explore-rise text-center", children: [
|
|
6355
6447
|
/* @__PURE__ */ jsxs("span", { className: "boff-explore-hero-badge inline-flex items-center gap-1.5 rounded-full border border-border bg-muted px-3 py-1 text-xs font-medium text-muted-foreground", children: [
|
|
6356
6448
|
/* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5" }),
|
|
6357
6449
|
T.badge
|
|
6358
6450
|
] }),
|
|
6359
|
-
/* @__PURE__ */ jsx(
|
|
6451
|
+
/* @__PURE__ */ jsx(Heading, { className: "mt-2 text-balance break-words text-2xl font-bold tracking-tight sm:text-3xl", children: title }),
|
|
6360
6452
|
/* @__PURE__ */ jsx("p", { className: "mx-auto mt-2 max-w-2xl text-pretty text-sm leading-relaxed text-muted-foreground", children: body })
|
|
6361
6453
|
] }),
|
|
6362
6454
|
/* @__PURE__ */ jsx("ul", { className: "boff-explore-capabilities boff-explore-rise boff-explore-rise-1 mt-4 grid grid-cols-3 gap-2 sm:gap-2.5", children: CAPABILITIES.map(({ icon: Icon, body: capBody }, i) => /* @__PURE__ */ jsxs(
|
|
@@ -6411,19 +6503,36 @@ function exploreQuestionHref(question, base = "/explore") {
|
|
|
6411
6503
|
const joiner = base.includes("?") ? "&" : "?";
|
|
6412
6504
|
return `${base}${joiner}q=${encodeURIComponent(trimmed)}`;
|
|
6413
6505
|
}
|
|
6414
|
-
function ExplorePage({
|
|
6506
|
+
function ExplorePage(props) {
|
|
6507
|
+
const shared = useContext(ExploreConversationContext);
|
|
6508
|
+
return shared ? /* @__PURE__ */ jsx(ExploreView, { ...props, conversation: shared }) : /* @__PURE__ */ jsx(StandaloneExplorePage, { ...props });
|
|
6509
|
+
}
|
|
6510
|
+
function StandaloneExplorePage(props) {
|
|
6511
|
+
const conversation = useExploreConversation({
|
|
6512
|
+
productSlug: props.productSlug,
|
|
6513
|
+
locale: props.locale,
|
|
6514
|
+
examplePrompts: props.examplePrompts,
|
|
6515
|
+
onSend: props.onSend
|
|
6516
|
+
});
|
|
6517
|
+
return /* @__PURE__ */ jsx(ExploreView, { ...props, conversation });
|
|
6518
|
+
}
|
|
6519
|
+
function ExploreView({
|
|
6415
6520
|
seo,
|
|
6416
6521
|
productSlug,
|
|
6417
|
-
examplePrompts,
|
|
6418
6522
|
className,
|
|
6419
6523
|
heightMode = "viewport",
|
|
6420
6524
|
viewportOffset,
|
|
6421
6525
|
onNavigate,
|
|
6422
|
-
onSend,
|
|
6423
6526
|
welcomeTitle,
|
|
6424
6527
|
welcomeBody,
|
|
6425
|
-
locale
|
|
6528
|
+
locale,
|
|
6529
|
+
presentation = "page",
|
|
6530
|
+
active = true,
|
|
6531
|
+
explorePath = "/explore",
|
|
6532
|
+
conversation
|
|
6426
6533
|
}) {
|
|
6534
|
+
const panel = presentation === "panel";
|
|
6535
|
+
const viewportPage = !panel && heightMode === "viewport";
|
|
6427
6536
|
const pageUrl = useMemo(
|
|
6428
6537
|
() => typeof window === "undefined" ? void 0 : window.location.href,
|
|
6429
6538
|
[]
|
|
@@ -6459,26 +6568,21 @@ function ExplorePage({
|
|
|
6459
6568
|
escalate,
|
|
6460
6569
|
canEscalate,
|
|
6461
6570
|
createShareLink,
|
|
6462
|
-
isSharedView
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
// English one. `T.prompts` seeds the chips the same way.
|
|
6469
|
-
examplePrompts: examplePrompts ?? T.prompts,
|
|
6470
|
-
fallbackWelcome: { title: T.welcomeTitle, body: T.welcomeBody }
|
|
6471
|
-
});
|
|
6472
|
-
const [draft, setDraft] = useState("");
|
|
6571
|
+
isSharedView,
|
|
6572
|
+
draft,
|
|
6573
|
+
setDraft,
|
|
6574
|
+
staged,
|
|
6575
|
+
setStaged
|
|
6576
|
+
} = conversation;
|
|
6473
6577
|
const textareaRef = useRef(null);
|
|
6474
6578
|
useEffect(() => {
|
|
6475
|
-
if (typeof window === "undefined") return;
|
|
6579
|
+
if (typeof window === "undefined" || panel) return;
|
|
6476
6580
|
const params = new URLSearchParams(window.location.search);
|
|
6477
6581
|
if (params.has("c")) return;
|
|
6478
6582
|
const question = params.get("q")?.trim();
|
|
6479
6583
|
if (!question) return;
|
|
6480
6584
|
setDraft(question.slice(0, EXPLORE_PREFILL_MAX_LENGTH));
|
|
6481
|
-
}, []);
|
|
6585
|
+
}, [panel, setDraft]);
|
|
6482
6586
|
const [historyOpen, setHistoryOpen] = useState(false);
|
|
6483
6587
|
const speechStopRef = useRef(() => void 0);
|
|
6484
6588
|
const stopDictation = useCallback(() => {
|
|
@@ -6494,8 +6598,12 @@ function ExplorePage({
|
|
|
6494
6598
|
}
|
|
6495
6599
|
});
|
|
6496
6600
|
speechStopRef.current = speech.stop;
|
|
6601
|
+
useEffect(() => {
|
|
6602
|
+
if (active) return;
|
|
6603
|
+
stopDictation();
|
|
6604
|
+
stopSpeaking();
|
|
6605
|
+
}, [active, stopDictation]);
|
|
6497
6606
|
const [disclaimerOpen, setDisclaimerOpen] = useState(false);
|
|
6498
|
-
const [staged, setStaged] = useState([]);
|
|
6499
6607
|
const [attachmentNotice, setAttachmentNotice] = useState(null);
|
|
6500
6608
|
const fileInputRef = useRef(null);
|
|
6501
6609
|
const stagedRef = useRef([]);
|
|
@@ -6548,7 +6656,7 @@ function ExplorePage({
|
|
|
6548
6656
|
const [bottomInset, setBottomInset] = useState(0);
|
|
6549
6657
|
const paneOffsetRef = useRef(0);
|
|
6550
6658
|
const measurePane = useCallback(() => {
|
|
6551
|
-
if (
|
|
6659
|
+
if (!viewportPage) return;
|
|
6552
6660
|
const el = rootRef.current;
|
|
6553
6661
|
if (!el) return;
|
|
6554
6662
|
const layoutHeight = window.innerHeight;
|
|
@@ -6567,7 +6675,7 @@ function ExplorePage({
|
|
|
6567
6675
|
paneOffsetRef.current = top;
|
|
6568
6676
|
setPaneOffset((current) => current === top ? current : top);
|
|
6569
6677
|
setBottomInset((current) => current === inset ? current : inset);
|
|
6570
|
-
}, [
|
|
6678
|
+
}, [viewportPage]);
|
|
6571
6679
|
const [chromeOverlap, setChromeOverlap] = useState(0);
|
|
6572
6680
|
const measureChrome = useCallback(() => {
|
|
6573
6681
|
const root = rootRef.current;
|
|
@@ -6592,7 +6700,7 @@ function ExplorePage({
|
|
|
6592
6700
|
measureChrome();
|
|
6593
6701
|
}, [measurePane, measureChrome]);
|
|
6594
6702
|
useEffect(() => {
|
|
6595
|
-
if (typeof window === "undefined") return;
|
|
6703
|
+
if (typeof window === "undefined" || panel) return;
|
|
6596
6704
|
let frame = 0;
|
|
6597
6705
|
const run = () => {
|
|
6598
6706
|
frame = 0;
|
|
@@ -6630,12 +6738,12 @@ function ExplorePage({
|
|
|
6630
6738
|
setBottomInset(0);
|
|
6631
6739
|
setChromeOverlap(0);
|
|
6632
6740
|
};
|
|
6633
|
-
}, [remeasure]);
|
|
6741
|
+
}, [remeasure, panel]);
|
|
6634
6742
|
useEffect(() => {
|
|
6635
6743
|
measureChrome();
|
|
6636
6744
|
}, [measureChrome, paneOffset, bottomInset]);
|
|
6637
6745
|
useEffect(() => {
|
|
6638
|
-
if (
|
|
6746
|
+
if (!viewportPage || typeof window === "undefined") return;
|
|
6639
6747
|
const { history: browserHistory } = window;
|
|
6640
6748
|
const previousRestoration = "scrollRestoration" in browserHistory ? browserHistory.scrollRestoration : null;
|
|
6641
6749
|
if (previousRestoration !== null)
|
|
@@ -6703,14 +6811,14 @@ function ExplorePage({
|
|
|
6703
6811
|
if (previousRestoration !== null)
|
|
6704
6812
|
browserHistory.scrollRestoration = previousRestoration;
|
|
6705
6813
|
};
|
|
6706
|
-
}, [
|
|
6814
|
+
}, [viewportPage, remeasure]);
|
|
6707
6815
|
const handleScroll = useCallback(() => {
|
|
6708
6816
|
const el = scrollRef.current;
|
|
6709
6817
|
if (!el) return;
|
|
6710
6818
|
stickToBottomRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
|
|
6711
6819
|
}, []);
|
|
6712
6820
|
useEffect(() => {
|
|
6713
|
-
if (typeof window === "undefined") return;
|
|
6821
|
+
if (typeof window === "undefined" || panel) return;
|
|
6714
6822
|
let frame = 0;
|
|
6715
6823
|
const run = () => {
|
|
6716
6824
|
frame = 0;
|
|
@@ -6733,7 +6841,7 @@ function ExplorePage({
|
|
|
6733
6841
|
if (frame) window.cancelAnimationFrame(frame);
|
|
6734
6842
|
window.removeEventListener("scroll", schedule);
|
|
6735
6843
|
};
|
|
6736
|
-
}, []);
|
|
6844
|
+
}, [panel]);
|
|
6737
6845
|
const latestAssistantId = useMemo(() => {
|
|
6738
6846
|
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
6739
6847
|
const message = messages[i];
|
|
@@ -6749,7 +6857,7 @@ function ExplorePage({
|
|
|
6749
6857
|
if (!stickToBottomRef.current) return;
|
|
6750
6858
|
if (anchor.offsetHeight === 0) return;
|
|
6751
6859
|
alignedForRef.current = latestAssistantId;
|
|
6752
|
-
if (!pageOwnsScrolling(el)) {
|
|
6860
|
+
if (panel || !pageOwnsScrolling(el)) {
|
|
6753
6861
|
const delta2 = anchor.getBoundingClientRect().top - el.getBoundingClientRect().top;
|
|
6754
6862
|
el.scrollTop = Math.max(0, el.scrollTop + delta2 - 12);
|
|
6755
6863
|
return;
|
|
@@ -6758,7 +6866,7 @@ function ExplorePage({
|
|
|
6758
6866
|
anchor.getBoundingClientRect().top - paneOffsetRef.current - 12
|
|
6759
6867
|
);
|
|
6760
6868
|
if (delta !== 0) window.scrollBy({ top: delta, left: 0, behavior: "auto" });
|
|
6761
|
-
}, [latestAssistantId, messages]);
|
|
6869
|
+
}, [latestAssistantId, messages, panel]);
|
|
6762
6870
|
useEffect(() => {
|
|
6763
6871
|
if (messages.length === 0) return;
|
|
6764
6872
|
if (!stickToBottomRef.current) return;
|
|
@@ -6766,7 +6874,7 @@ function ExplorePage({
|
|
|
6766
6874
|
return;
|
|
6767
6875
|
const el = scrollRef.current;
|
|
6768
6876
|
if (!el) return;
|
|
6769
|
-
if (!pageOwnsScrolling(el)) {
|
|
6877
|
+
if (panel || !pageOwnsScrolling(el)) {
|
|
6770
6878
|
el.scrollTop = el.scrollHeight;
|
|
6771
6879
|
return;
|
|
6772
6880
|
}
|
|
@@ -6775,7 +6883,7 @@ function ExplorePage({
|
|
|
6775
6883
|
dock.getBoundingClientRect().bottom - visualViewportHeight()
|
|
6776
6884
|
);
|
|
6777
6885
|
if (delta > 0) window.scrollBy({ top: delta, left: 0, behavior: "auto" });
|
|
6778
|
-
}, [activity, latestAssistantId, messages]);
|
|
6886
|
+
}, [activity, latestAssistantId, messages, panel]);
|
|
6779
6887
|
const handleShare = useCallback(async () => {
|
|
6780
6888
|
setShareLabel(T.copying);
|
|
6781
6889
|
setShareUrl(null);
|
|
@@ -6785,7 +6893,7 @@ function ExplorePage({
|
|
|
6785
6893
|
setTimeout(() => setShareLabel(T.share), 2500);
|
|
6786
6894
|
return;
|
|
6787
6895
|
}
|
|
6788
|
-
const url = new URL(pageUrl ?? window.location.href);
|
|
6896
|
+
const url = panel ? new URL(explorePath, window.location.href) : new URL(pageUrl ?? window.location.href);
|
|
6789
6897
|
url.search = "";
|
|
6790
6898
|
url.hash = "";
|
|
6791
6899
|
url.searchParams.set("c", token);
|
|
@@ -6801,6 +6909,8 @@ function ExplorePage({
|
|
|
6801
6909
|
}, [
|
|
6802
6910
|
createShareLink,
|
|
6803
6911
|
pageUrl,
|
|
6912
|
+
panel,
|
|
6913
|
+
explorePath,
|
|
6804
6914
|
T.copied,
|
|
6805
6915
|
T.copying,
|
|
6806
6916
|
T.share,
|
|
@@ -6829,12 +6939,15 @@ function ExplorePage({
|
|
|
6829
6939
|
});
|
|
6830
6940
|
return pickQueueRef.current;
|
|
6831
6941
|
},
|
|
6832
|
-
[T]
|
|
6942
|
+
[T, setStaged]
|
|
6943
|
+
);
|
|
6944
|
+
const removeAttachment = useCallback(
|
|
6945
|
+
(id) => {
|
|
6946
|
+
setStaged((prev) => prev.filter((entry) => entry.id !== id));
|
|
6947
|
+
setAttachmentNotice(null);
|
|
6948
|
+
},
|
|
6949
|
+
[setStaged]
|
|
6833
6950
|
);
|
|
6834
|
-
const removeAttachment = useCallback((id) => {
|
|
6835
|
-
setStaged((prev) => prev.filter((entry) => entry.id !== id));
|
|
6836
|
-
setAttachmentNotice(null);
|
|
6837
|
-
}, []);
|
|
6838
6951
|
const submitDraft = useCallback(() => {
|
|
6839
6952
|
const text = draft.trim();
|
|
6840
6953
|
if (!text || overLimit || busy || !canSend) return;
|
|
@@ -6846,7 +6959,16 @@ function ExplorePage({
|
|
|
6846
6959
|
setStaged([]);
|
|
6847
6960
|
setAttachmentNotice(null);
|
|
6848
6961
|
textareaRef.current?.focus();
|
|
6849
|
-
}, [
|
|
6962
|
+
}, [
|
|
6963
|
+
busy,
|
|
6964
|
+
canSend,
|
|
6965
|
+
draft,
|
|
6966
|
+
overLimit,
|
|
6967
|
+
send,
|
|
6968
|
+
setDraft,
|
|
6969
|
+
setStaged,
|
|
6970
|
+
stopDictation
|
|
6971
|
+
]);
|
|
6850
6972
|
const sendPrompt = useCallback(
|
|
6851
6973
|
(prompt) => {
|
|
6852
6974
|
if (!canSend || busy) return;
|
|
@@ -6857,7 +6979,7 @@ function ExplorePage({
|
|
|
6857
6979
|
setStaged([]);
|
|
6858
6980
|
setAttachmentNotice(null);
|
|
6859
6981
|
},
|
|
6860
|
-
[busy, canSend, send]
|
|
6982
|
+
[busy, canSend, send, setDraft, setStaged]
|
|
6861
6983
|
);
|
|
6862
6984
|
const handleKeyDown = useCallback(
|
|
6863
6985
|
(event) => {
|
|
@@ -6879,7 +7001,7 @@ function ExplorePage({
|
|
|
6879
7001
|
[serverCatalogRaw]
|
|
6880
7002
|
);
|
|
6881
7003
|
const rootStyle = {};
|
|
6882
|
-
if (
|
|
7004
|
+
if (viewportPage) {
|
|
6883
7005
|
rootStyle["--boff-explore-offset"] = paneOffset === null ? normalizeOffset(viewportOffset) : `${paneOffset}px`;
|
|
6884
7006
|
if (bottomInset > 0) {
|
|
6885
7007
|
rootStyle["--boff-explore-inset"] = `${bottomInset}px`;
|
|
@@ -6892,19 +7014,19 @@ function ExplorePage({
|
|
|
6892
7014
|
"div",
|
|
6893
7015
|
{
|
|
6894
7016
|
ref: rootRef,
|
|
6895
|
-
"data-boff-explore": "page",
|
|
7017
|
+
"data-boff-explore": panel ? "panel" : "page",
|
|
6896
7018
|
"data-phase": phase,
|
|
6897
7019
|
"data-locale": activeLocale,
|
|
6898
7020
|
dir: rtl ? "rtl" : void 0,
|
|
6899
7021
|
className: cn(
|
|
6900
|
-
"flex w-full min-w-0 flex-col overflow-x-hidden bg-background text-foreground",
|
|
6901
|
-
|
|
6902
|
-
heightMode === "auto" && "min-h-[70vh]",
|
|
7022
|
+
panel ? "boff-explore-panel flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-background text-foreground" : "flex w-full min-w-0 flex-col overflow-x-hidden bg-background text-foreground",
|
|
7023
|
+
viewportPage && "boff-explore-viewport",
|
|
7024
|
+
!panel && heightMode === "auto" && "min-h-[70vh]",
|
|
6903
7025
|
className
|
|
6904
7026
|
),
|
|
6905
|
-
style: rootStyle,
|
|
7027
|
+
style: panel ? void 0 : rootStyle,
|
|
6906
7028
|
children: [
|
|
6907
|
-
/* @__PURE__ */ jsx(
|
|
7029
|
+
panel ? null : /* @__PURE__ */ jsx(
|
|
6908
7030
|
PageHead,
|
|
6909
7031
|
{
|
|
6910
7032
|
title: seo?.title ?? T.seoTitle,
|
|
@@ -6917,7 +7039,11 @@ function ExplorePage({
|
|
|
6917
7039
|
),
|
|
6918
7040
|
/* @__PURE__ */ jsx(ProseStyles, {}),
|
|
6919
7041
|
/* @__PURE__ */ jsx(ExploreStyles, {}),
|
|
6920
|
-
|
|
7042
|
+
panel ? /* @__PURE__ */ jsx("style", { children: `.boff-explore-panel .boff-explore-scroll { container: boff-explore-pane / size; }
|
|
7043
|
+
@container boff-explore-pane (width < ${toRem(WELCOME_FIT_MIN_WIDTH_PX)}) {
|
|
7044
|
+
.boff-explore-panel .boff-explore-scroll .boff-explore-capabilities { display: none; }
|
|
7045
|
+
}` }) : null,
|
|
7046
|
+
!panel && bakedCatalogJson ? /* @__PURE__ */ jsx(
|
|
6921
7047
|
"script",
|
|
6922
7048
|
{
|
|
6923
7049
|
id: BAKED_CATALOG_ELEMENT_ID,
|
|
@@ -6937,7 +7063,7 @@ function ExplorePage({
|
|
|
6937
7063
|
children: /* @__PURE__ */ jsx(Sparkles, { className: "h-4 w-4" })
|
|
6938
7064
|
}
|
|
6939
7065
|
),
|
|
6940
|
-
/* @__PURE__ */ jsx("h1", { className: "truncate text-sm font-semibold", children: resolvedTitle }),
|
|
7066
|
+
panel ? /* @__PURE__ */ jsx("h2", { className: "truncate text-sm font-semibold", children: resolvedTitle }) : /* @__PURE__ */ jsx("h1", { className: "truncate text-sm font-semibold", children: resolvedTitle }),
|
|
6941
7067
|
focusedProductName ? /* @__PURE__ */ jsx("span", { className: "hidden shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-secondary-foreground sm:inline", children: focusedProductName }) : null,
|
|
6942
7068
|
/* @__PURE__ */ jsxs(
|
|
6943
7069
|
Button,
|
|
@@ -7081,6 +7207,7 @@ function ExplorePage({
|
|
|
7081
7207
|
children: showWelcome ? /* @__PURE__ */ jsx(
|
|
7082
7208
|
WelcomeState,
|
|
7083
7209
|
{
|
|
7210
|
+
heading: panel ? "h2" : "h1",
|
|
7084
7211
|
strings: T,
|
|
7085
7212
|
title: resolvedTitle,
|
|
7086
7213
|
body: resolvedBody,
|