@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
|
@@ -135,6 +135,14 @@ var EN = {
|
|
|
135
135
|
closeVideo: "Close video",
|
|
136
136
|
enterFullScreen: "Full screen",
|
|
137
137
|
exitFullScreen: "Exit full screen",
|
|
138
|
+
panelTitle: "AI assistant",
|
|
139
|
+
panelViews: "Assistant views",
|
|
140
|
+
tabChat: "Chat",
|
|
141
|
+
tabAvatar: "Avatar",
|
|
142
|
+
closePanel: "Close",
|
|
143
|
+
liveAvatar: "Live avatar",
|
|
144
|
+
avatarComingSoon: "Live avatar coming soon",
|
|
145
|
+
continueInChat: "Continue in Chat",
|
|
138
146
|
videoUnavailable: "This video can't be played right now.",
|
|
139
147
|
groundedIn: "What this answer is based on",
|
|
140
148
|
sourceCountOne: "1 source",
|
|
@@ -243,6 +251,14 @@ var ZH = {
|
|
|
243
251
|
closeVideo: "\u5173\u95ED\u89C6\u9891",
|
|
244
252
|
enterFullScreen: "\u5168\u5C4F",
|
|
245
253
|
exitFullScreen: "\u9000\u51FA\u5168\u5C4F",
|
|
254
|
+
panelTitle: "AI \u52A9\u624B",
|
|
255
|
+
panelViews: "\u52A9\u624B\u89C6\u56FE",
|
|
256
|
+
tabChat: "\u804A\u5929",
|
|
257
|
+
tabAvatar: "\u865A\u62DF\u5F62\u8C61",
|
|
258
|
+
closePanel: "\u5173\u95ED",
|
|
259
|
+
liveAvatar: "\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61",
|
|
260
|
+
avatarComingSoon: "\u5B9E\u65F6\u865A\u62DF\u5F62\u8C61\u5373\u5C06\u63A8\u51FA",
|
|
261
|
+
continueInChat: "\u5728\u804A\u5929\u4E2D\u7EE7\u7EED",
|
|
246
262
|
videoUnavailable: "\u6682\u65F6\u65E0\u6CD5\u64AD\u653E\u6B64\u89C6\u9891\u3002",
|
|
247
263
|
groundedIn: "\u8FD9\u4E2A\u56DE\u7B54\u7684\u4F9D\u636E",
|
|
248
264
|
sourceCountOne: "1 \u4E2A\u6765\u6E90",
|
|
@@ -347,6 +363,14 @@ var HI = {
|
|
|
347
363
|
closeVideo: "\u0935\u0940\u0921\u093F\u092F\u094B \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
348
364
|
enterFullScreen: "\u092A\u0942\u0930\u094D\u0923 \u0938\u094D\u0915\u094D\u0930\u0940\u0928",
|
|
349
365
|
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",
|
|
366
|
+
panelTitle: "AI \u0938\u0939\u093E\u092F\u0915",
|
|
367
|
+
panelViews: "\u0938\u0939\u093E\u092F\u0915 \u0926\u0943\u0936\u094D\u092F",
|
|
368
|
+
tabChat: "\u091A\u0948\u091F",
|
|
369
|
+
tabAvatar: "\u0905\u0935\u0924\u093E\u0930",
|
|
370
|
+
closePanel: "\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
371
|
+
liveAvatar: "\u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930",
|
|
372
|
+
avatarComingSoon: "\u0932\u093E\u0907\u0935 \u0905\u0935\u0924\u093E\u0930 \u091C\u0932\u094D\u0926 \u0906 \u0930\u0939\u093E \u0939\u0948",
|
|
373
|
+
continueInChat: "\u091A\u0948\u091F \u092E\u0947\u0902 \u091C\u093E\u0930\u0940 \u0930\u0916\u0947\u0902",
|
|
350
374
|
videoUnavailable: "\u092F\u0939 \u0935\u0940\u0921\u093F\u092F\u094B \u0905\u092D\u0940 \u0928\u0939\u0940\u0902 \u091A\u0932 \u0938\u0915\u0924\u093E\u0964",
|
|
351
375
|
groundedIn: "\u092F\u0939 \u0909\u0924\u094D\u0924\u0930 \u0915\u093F\u0938 \u092A\u0930 \u0906\u0927\u093E\u0930\u093F\u0924 \u0939\u0948",
|
|
352
376
|
sourceCountOne: "1 \u0938\u094D\u0930\u094B\u0924",
|
|
@@ -455,6 +479,14 @@ var ES = {
|
|
|
455
479
|
closeVideo: "Cerrar v\xEDdeo",
|
|
456
480
|
enterFullScreen: "Pantalla completa",
|
|
457
481
|
exitFullScreen: "Salir de pantalla completa",
|
|
482
|
+
panelTitle: "Asistente de IA",
|
|
483
|
+
panelViews: "Vistas del asistente",
|
|
484
|
+
tabChat: "Chat",
|
|
485
|
+
tabAvatar: "Avatar",
|
|
486
|
+
closePanel: "Cerrar",
|
|
487
|
+
liveAvatar: "Avatar en vivo",
|
|
488
|
+
avatarComingSoon: "Avatar en vivo: pr\xF3ximamente",
|
|
489
|
+
continueInChat: "Continuar en el chat",
|
|
458
490
|
videoUnavailable: "Ahora mismo no se puede reproducir este v\xEDdeo.",
|
|
459
491
|
groundedIn: "En qu\xE9 se basa esta respuesta",
|
|
460
492
|
sourceCountOne: "1 fuente",
|
|
@@ -563,6 +595,14 @@ var AR = {
|
|
|
563
595
|
closeVideo: "\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0641\u064A\u062F\u064A\u0648",
|
|
564
596
|
enterFullScreen: "\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",
|
|
565
597
|
exitFullScreen: "\u0627\u0644\u062E\u0631\u0648\u062C \u0645\u0646 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",
|
|
598
|
+
panelTitle: "\u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",
|
|
599
|
+
panelViews: "\u0637\u0631\u0642 \u0639\u0631\u0636 \u0627\u0644\u0645\u0633\u0627\u0639\u062F",
|
|
600
|
+
tabChat: "\u062F\u0631\u062F\u0634\u0629",
|
|
601
|
+
tabAvatar: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631",
|
|
602
|
+
closePanel: "\u0625\u063A\u0644\u0627\u0642",
|
|
603
|
+
liveAvatar: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631",
|
|
604
|
+
avatarComingSoon: "\u0627\u0644\u0623\u0641\u0627\u062A\u0627\u0631 \u0627\u0644\u0645\u0628\u0627\u0634\u0631 \u0642\u0631\u064A\u0628\u064B\u0627",
|
|
605
|
+
continueInChat: "\u0627\u0644\u0645\u062A\u0627\u0628\u0639\u0629 \u0641\u064A \u0627\u0644\u062F\u0631\u062F\u0634\u0629",
|
|
566
606
|
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.",
|
|
567
607
|
groundedIn: "\u0639\u0644\u0649 \u0645\u0627\u0630\u0627 \u062A\u0633\u062A\u0646\u062F \u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629",
|
|
568
608
|
sourceCountOne: "\u0645\u0635\u062F\u0631 \u0648\u0627\u062D\u062F",
|
|
@@ -671,6 +711,14 @@ var TA = {
|
|
|
671
711
|
closeVideo: "\u0BB5\u0BC0\u0B9F\u0BBF\u0BAF\u0BCB\u0BB5\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1",
|
|
672
712
|
enterFullScreen: "\u0BAE\u0BC1\u0BB4\u0BC1\u0BA4\u0BCD \u0BA4\u0BBF\u0BB0\u0BC8",
|
|
673
713
|
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",
|
|
714
|
+
panelTitle: "AI \u0B89\u0BA4\u0BB5\u0BBF\u0BAF\u0BBE\u0BB3\u0BB0\u0BCD",
|
|
715
|
+
panelViews: "\u0B89\u0BA4\u0BB5\u0BBF\u0BAF\u0BBE\u0BB3\u0BB0\u0BCD \u0B95\u0BBE\u0B9F\u0BCD\u0B9A\u0BBF\u0B95\u0BB3\u0BCD",
|
|
716
|
+
tabChat: "\u0B85\u0BB0\u0B9F\u0BCD\u0B9F\u0BC8",
|
|
717
|
+
tabAvatar: "\u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD",
|
|
718
|
+
closePanel: "\u0BAE\u0BC2\u0B9F\u0BC1",
|
|
719
|
+
liveAvatar: "\u0BA8\u0BC7\u0BB0\u0BB2\u0BC8 \u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD",
|
|
720
|
+
avatarComingSoon: "\u0BA8\u0BC7\u0BB0\u0BB2\u0BC8 \u0B85\u0BB5\u0BA4\u0BBE\u0BB0\u0BCD \u0BB5\u0BBF\u0BB0\u0BC8\u0BB5\u0BBF\u0BB2\u0BCD",
|
|
721
|
+
continueInChat: "\u0B85\u0BB0\u0B9F\u0BCD\u0B9F\u0BC8\u0BAF\u0BBF\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0BB0\u0BB5\u0BC1\u0BAE\u0BCD",
|
|
674
722
|
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.",
|
|
675
723
|
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",
|
|
676
724
|
sourceCountOne: "1 \u0BAE\u0BC2\u0BB2\u0BAE\u0BCD",
|
|
@@ -1687,392 +1735,6 @@ function ExploreAnswerBody({
|
|
|
1687
1735
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("boff-prose boff-explore-body min-w-0", className), children: /* @__PURE__ */ jsxRuntime.jsx(AnswerScopeContext.Provider, { value: scope, children: /* @__PURE__ */ jsxRuntime.jsx(Markdown, { components: overrides, rehypePlugins, children }) }) });
|
|
1688
1736
|
}
|
|
1689
1737
|
|
|
1690
|
-
// src/components/explore-types.ts
|
|
1691
|
-
var EXPLORE_FEEDBACK_REASONS = [
|
|
1692
|
-
"INACCURATE",
|
|
1693
|
-
"INCOMPLETE",
|
|
1694
|
-
"OFF_TOPIC",
|
|
1695
|
-
"HARD_TO_FOLLOW",
|
|
1696
|
-
"OTHER"
|
|
1697
|
-
];
|
|
1698
|
-
var EXPLORE_MESSAGE_FIELDS = (
|
|
1699
|
-
/* GraphQL */
|
|
1700
|
-
`
|
|
1701
|
-
id
|
|
1702
|
-
conversationId
|
|
1703
|
-
role
|
|
1704
|
-
status
|
|
1705
|
-
content
|
|
1706
|
-
partialContent
|
|
1707
|
-
activity
|
|
1708
|
-
references {
|
|
1709
|
-
url
|
|
1710
|
-
title
|
|
1711
|
-
description
|
|
1712
|
-
product
|
|
1713
|
-
imageUrl
|
|
1714
|
-
index
|
|
1715
|
-
}
|
|
1716
|
-
ctas {
|
|
1717
|
-
kind
|
|
1718
|
-
label
|
|
1719
|
-
url
|
|
1720
|
-
product
|
|
1721
|
-
}
|
|
1722
|
-
followUps
|
|
1723
|
-
answered
|
|
1724
|
-
attachments {
|
|
1725
|
-
name
|
|
1726
|
-
mimeType
|
|
1727
|
-
size
|
|
1728
|
-
textExtracted
|
|
1729
|
-
}
|
|
1730
|
-
errorCode
|
|
1731
|
-
createdAt
|
|
1732
|
-
completedAt
|
|
1733
|
-
`
|
|
1734
|
-
);
|
|
1735
|
-
var EXPLORE_OWN_MESSAGE_FIELDS = (
|
|
1736
|
-
/* GraphQL */
|
|
1737
|
-
`
|
|
1738
|
-
${EXPLORE_MESSAGE_FIELDS}
|
|
1739
|
-
feedback {
|
|
1740
|
-
rating
|
|
1741
|
-
reason
|
|
1742
|
-
comment
|
|
1743
|
-
createdAt
|
|
1744
|
-
}
|
|
1745
|
-
`
|
|
1746
|
-
);
|
|
1747
|
-
var EXPLORE_CATALOG_ESTABLISHED_FIELDS = (
|
|
1748
|
-
/* GraphQL */
|
|
1749
|
-
`
|
|
1750
|
-
enabled
|
|
1751
|
-
products {
|
|
1752
|
-
slug
|
|
1753
|
-
name
|
|
1754
|
-
tagline
|
|
1755
|
-
website
|
|
1756
|
-
}
|
|
1757
|
-
examplePrompts
|
|
1758
|
-
welcomeTitle
|
|
1759
|
-
welcomeBody
|
|
1760
|
-
limits {
|
|
1761
|
-
maxMessageLength
|
|
1762
|
-
maxTurnsPerConversation
|
|
1763
|
-
messagesPerDay
|
|
1764
|
-
historyTurns
|
|
1765
|
-
}
|
|
1766
|
-
captchaRequired
|
|
1767
|
-
recaptchaSiteKey`
|
|
1768
|
-
);
|
|
1769
|
-
var EXPLORE_CATALOG_HIGHLIGHT_FIELD = (
|
|
1770
|
-
/* GraphQL */
|
|
1771
|
-
`
|
|
1772
|
-
conceptHighlights {
|
|
1773
|
-
product
|
|
1774
|
-
productName
|
|
1775
|
-
title
|
|
1776
|
-
url
|
|
1777
|
-
imageUrl
|
|
1778
|
-
alt
|
|
1779
|
-
}`
|
|
1780
|
-
);
|
|
1781
|
-
function exploreCatalogDocument(extraFields) {
|
|
1782
|
-
return (
|
|
1783
|
-
/* GraphQL */
|
|
1784
|
-
`
|
|
1785
|
-
query ExploreCatalog($productSlug: String) {
|
|
1786
|
-
exploreCatalog(productSlug: $productSlug) {${EXPLORE_CATALOG_ESTABLISHED_FIELDS}${extraFields}
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
`
|
|
1790
|
-
);
|
|
1791
|
-
}
|
|
1792
|
-
var EXPLORE_CATALOG_QUERY = exploreCatalogDocument(
|
|
1793
|
-
EXPLORE_CATALOG_HIGHLIGHT_FIELD
|
|
1794
|
-
);
|
|
1795
|
-
var EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS = exploreCatalogDocument("");
|
|
1796
|
-
var EXPLORE_MESSAGE_QUERY = (
|
|
1797
|
-
/* GraphQL */
|
|
1798
|
-
`
|
|
1799
|
-
query ExploreMessage($conversationToken: String!, $id: ID!) {
|
|
1800
|
-
exploreMessage(conversationToken: $conversationToken, id: $id) {
|
|
1801
|
-
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
`
|
|
1805
|
-
);
|
|
1806
|
-
var SEND_EXPLORE_MESSAGE_MUTATION = (
|
|
1807
|
-
/* GraphQL */
|
|
1808
|
-
`
|
|
1809
|
-
mutation SendExploreMessage($input: SendExploreMessageInput!) {
|
|
1810
|
-
sendExploreMessage(input: $input) {
|
|
1811
|
-
conversation {
|
|
1812
|
-
id
|
|
1813
|
-
token
|
|
1814
|
-
productSlug
|
|
1815
|
-
turnCount
|
|
1816
|
-
createdAt
|
|
1817
|
-
}
|
|
1818
|
-
userMessage {
|
|
1819
|
-
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
1820
|
-
}
|
|
1821
|
-
assistantMessage {
|
|
1822
|
-
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
1823
|
-
}
|
|
1824
|
-
remainingToday
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
`
|
|
1828
|
-
);
|
|
1829
|
-
var RECORD_EXPLORE_CLICK_MUTATION = (
|
|
1830
|
-
/* GraphQL */
|
|
1831
|
-
`
|
|
1832
|
-
mutation RecordExploreClick($input: RecordExploreClickInput!) {
|
|
1833
|
-
recordExploreClick(input: $input) {
|
|
1834
|
-
recorded
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
`
|
|
1838
|
-
);
|
|
1839
|
-
var SUBMIT_EXPLORE_FEEDBACK_MUTATION = (
|
|
1840
|
-
/* GraphQL */
|
|
1841
|
-
`
|
|
1842
|
-
mutation SubmitExploreFeedback($input: SubmitExploreFeedbackInput!) {
|
|
1843
|
-
submitExploreFeedback(input: $input) {
|
|
1844
|
-
recorded
|
|
1845
|
-
feedback {
|
|
1846
|
-
rating
|
|
1847
|
-
reason
|
|
1848
|
-
comment
|
|
1849
|
-
createdAt
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
}
|
|
1853
|
-
`
|
|
1854
|
-
);
|
|
1855
|
-
var EXPLORE_FEEDBACK_COMMENT_SOFT_MAX = 500;
|
|
1856
|
-
var ESCALATE_EXPLORE_CONVERSATION_MUTATION = (
|
|
1857
|
-
/* GraphQL */
|
|
1858
|
-
`
|
|
1859
|
-
mutation EscalateExploreConversation(
|
|
1860
|
-
$input: EscalateExploreConversationInput!
|
|
1861
|
-
) {
|
|
1862
|
-
escalateExploreConversation(input: $input) {
|
|
1863
|
-
created
|
|
1864
|
-
escalation {
|
|
1865
|
-
email
|
|
1866
|
-
createdAt
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
`
|
|
1871
|
-
);
|
|
1872
|
-
var EXPLORE_ESCALATION_NOTE_SOFT_MAX = 2e3;
|
|
1873
|
-
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,}$/;
|
|
1874
|
-
function looksLikeDeliverableEmail(value) {
|
|
1875
|
-
const trimmed = value.trim();
|
|
1876
|
-
if (trimmed.length === 0 || trimmed.length > 254) return false;
|
|
1877
|
-
return DELIVERABLE_EMAIL.test(trimmed);
|
|
1878
|
-
}
|
|
1879
|
-
var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
|
|
1880
|
-
/* GraphQL */
|
|
1881
|
-
`
|
|
1882
|
-
mutation CreateExploreShareLink($conversationToken: String!) {
|
|
1883
|
-
createExploreShareLink(conversationToken: $conversationToken) {
|
|
1884
|
-
shareToken
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
`
|
|
1888
|
-
);
|
|
1889
|
-
var EXPLORE_SHARED_CONVERSATION_QUERY = (
|
|
1890
|
-
/* GraphQL */
|
|
1891
|
-
`
|
|
1892
|
-
query ExploreSharedConversation($shareToken: String!) {
|
|
1893
|
-
exploreSharedConversation(shareToken: $shareToken) {
|
|
1894
|
-
${EXPLORE_MESSAGE_FIELDS}
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
`
|
|
1898
|
-
);
|
|
1899
|
-
var PROSE_CSS = `
|
|
1900
|
-
.boff-prose {
|
|
1901
|
-
max-width: none;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
.boff-prose h1 {
|
|
1905
|
-
font-size: 2.25rem;
|
|
1906
|
-
font-weight: 800;
|
|
1907
|
-
line-height: 1.2;
|
|
1908
|
-
margin-top: 0;
|
|
1909
|
-
margin-bottom: 1rem;
|
|
1910
|
-
color: hsl(var(--foreground));
|
|
1911
|
-
}
|
|
1912
|
-
|
|
1913
|
-
.boff-prose h2 {
|
|
1914
|
-
font-size: 1.75rem;
|
|
1915
|
-
font-weight: 700;
|
|
1916
|
-
line-height: 1.3;
|
|
1917
|
-
margin-top: 2rem;
|
|
1918
|
-
margin-bottom: 1rem;
|
|
1919
|
-
color: hsl(var(--foreground));
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
.boff-prose h3 {
|
|
1923
|
-
font-size: 1.5rem;
|
|
1924
|
-
font-weight: 600;
|
|
1925
|
-
line-height: 1.4;
|
|
1926
|
-
margin-top: 1.5rem;
|
|
1927
|
-
margin-bottom: 0.75rem;
|
|
1928
|
-
color: hsl(var(--foreground));
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
.boff-prose h4 {
|
|
1932
|
-
font-size: 1.25rem;
|
|
1933
|
-
font-weight: 600;
|
|
1934
|
-
line-height: 1.5;
|
|
1935
|
-
margin-top: 1.25rem;
|
|
1936
|
-
margin-bottom: 0.5rem;
|
|
1937
|
-
color: hsl(var(--foreground));
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
.boff-prose p {
|
|
1941
|
-
margin-bottom: 1rem;
|
|
1942
|
-
line-height: 1.75;
|
|
1943
|
-
color: hsl(var(--foreground));
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
.boff-prose ul,
|
|
1947
|
-
.boff-prose ol {
|
|
1948
|
-
margin-bottom: 1rem;
|
|
1949
|
-
padding-left: 1.5rem;
|
|
1950
|
-
}
|
|
1951
|
-
|
|
1952
|
-
.boff-prose ul {
|
|
1953
|
-
list-style-type: disc;
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
.boff-prose ol {
|
|
1957
|
-
list-style-type: decimal;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
.boff-prose li {
|
|
1961
|
-
margin-bottom: 0.25rem;
|
|
1962
|
-
line-height: 1.75;
|
|
1963
|
-
color: hsl(var(--foreground));
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
.boff-prose li > ul,
|
|
1967
|
-
.boff-prose li > ol {
|
|
1968
|
-
margin-top: 0.25rem;
|
|
1969
|
-
margin-bottom: 0.25rem;
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
.boff-prose a {
|
|
1973
|
-
color: hsl(var(--primary));
|
|
1974
|
-
text-decoration: underline;
|
|
1975
|
-
text-underline-offset: 2px;
|
|
1976
|
-
}
|
|
1977
|
-
|
|
1978
|
-
.boff-prose a:hover {
|
|
1979
|
-
opacity: 0.8;
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
.boff-prose hr {
|
|
1983
|
-
border: none;
|
|
1984
|
-
height: 1px;
|
|
1985
|
-
background-color: hsl(var(--border));
|
|
1986
|
-
margin: 2rem 0;
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
.boff-prose blockquote {
|
|
1990
|
-
border-left: 4px solid hsl(var(--border));
|
|
1991
|
-
padding-left: 1rem;
|
|
1992
|
-
margin: 1.5rem 0;
|
|
1993
|
-
font-style: italic;
|
|
1994
|
-
color: hsl(var(--muted-foreground));
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
.boff-prose strong {
|
|
1998
|
-
font-weight: 700;
|
|
1999
|
-
color: hsl(var(--foreground));
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
.boff-prose code {
|
|
2003
|
-
background-color: hsl(var(--muted));
|
|
2004
|
-
padding: 0.125rem 0.25rem;
|
|
2005
|
-
border-radius: 0.25rem;
|
|
2006
|
-
font-size: 0.875em;
|
|
2007
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
2008
|
-
}
|
|
2009
|
-
|
|
2010
|
-
.boff-prose pre {
|
|
2011
|
-
background-color: hsl(var(--muted));
|
|
2012
|
-
padding: 1rem;
|
|
2013
|
-
border-radius: 0.5rem;
|
|
2014
|
-
overflow-x: auto;
|
|
2015
|
-
margin-bottom: 1rem;
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
.boff-prose pre code {
|
|
2019
|
-
background-color: transparent;
|
|
2020
|
-
padding: 0;
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
.boff-prose img {
|
|
2024
|
-
max-width: 100%;
|
|
2025
|
-
height: auto;
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
.boff-prose table {
|
|
2029
|
-
width: 100%;
|
|
2030
|
-
border-collapse: collapse;
|
|
2031
|
-
margin-bottom: 1rem;
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
.boff-prose th,
|
|
2035
|
-
.boff-prose td {
|
|
2036
|
-
border: 1px solid hsl(var(--border));
|
|
2037
|
-
padding: 0.5rem;
|
|
2038
|
-
text-align: left;
|
|
2039
|
-
}
|
|
2040
|
-
|
|
2041
|
-
.boff-prose th {
|
|
2042
|
-
font-weight: 600;
|
|
2043
|
-
background-color: hsl(var(--muted));
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
/* Smaller variant used inside cards and compact panels */
|
|
2047
|
-
.boff-prose-sm {
|
|
2048
|
-
font-size: 0.875rem;
|
|
2049
|
-
}
|
|
2050
|
-
|
|
2051
|
-
.boff-prose-sm h1 {
|
|
2052
|
-
font-size: 1.75rem;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
.boff-prose-sm h2 {
|
|
2056
|
-
font-size: 1.5rem;
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
.boff-prose-sm h3 {
|
|
2060
|
-
font-size: 1.25rem;
|
|
2061
|
-
}
|
|
2062
|
-
|
|
2063
|
-
.boff-prose-sm h4 {
|
|
2064
|
-
font-size: 1.125rem;
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
.boff-prose-sm p,
|
|
2068
|
-
.boff-prose-sm li {
|
|
2069
|
-
line-height: 1.625;
|
|
2070
|
-
}
|
|
2071
|
-
`;
|
|
2072
|
-
function ProseStyles() {
|
|
2073
|
-
return /* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: PROSE_CSS } });
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
1738
|
// src/client/security.ts
|
|
2077
1739
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
|
|
2078
1740
|
var RESERVED_HEADERS = /* @__PURE__ */ new Set([
|
|
@@ -2275,27 +1937,237 @@ var _WebSDKClient = class _WebSDKClient {
|
|
|
2275
1937
|
_WebSDKClient.RETRY_BASE_DELAY_MS * (i + 1) + Math.random() * 200
|
|
2276
1938
|
);
|
|
2277
1939
|
}
|
|
2278
|
-
return last;
|
|
1940
|
+
return last;
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
__publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
|
|
1944
|
+
// 5 minutes
|
|
1945
|
+
__publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
|
|
1946
|
+
__publicField(_WebSDKClient, "DEFAULT_TIMEOUT_MS", 12e3);
|
|
1947
|
+
__publicField(_WebSDKClient, "DEFAULT_MAX_RETRIES", 1);
|
|
1948
|
+
__publicField(_WebSDKClient, "RETRY_BASE_DELAY_MS", 400);
|
|
1949
|
+
var WebSDKContext = React.createContext(null);
|
|
1950
|
+
function useWebSDK() {
|
|
1951
|
+
const client = React.useContext(WebSDKContext);
|
|
1952
|
+
if (!client) {
|
|
1953
|
+
throw new Error("useWebSDK must be used within a WebSDKProvider");
|
|
1954
|
+
}
|
|
1955
|
+
return client;
|
|
1956
|
+
}
|
|
1957
|
+
function useWebSDKConfig() {
|
|
1958
|
+
const client = useWebSDK();
|
|
1959
|
+
return client.getConfig();
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// src/components/explore-types.ts
|
|
1963
|
+
var EXPLORE_FEEDBACK_REASONS = [
|
|
1964
|
+
"INACCURATE",
|
|
1965
|
+
"INCOMPLETE",
|
|
1966
|
+
"OFF_TOPIC",
|
|
1967
|
+
"HARD_TO_FOLLOW",
|
|
1968
|
+
"OTHER"
|
|
1969
|
+
];
|
|
1970
|
+
var EXPLORE_MESSAGE_FIELDS = (
|
|
1971
|
+
/* GraphQL */
|
|
1972
|
+
`
|
|
1973
|
+
id
|
|
1974
|
+
conversationId
|
|
1975
|
+
role
|
|
1976
|
+
status
|
|
1977
|
+
content
|
|
1978
|
+
partialContent
|
|
1979
|
+
activity
|
|
1980
|
+
references {
|
|
1981
|
+
url
|
|
1982
|
+
title
|
|
1983
|
+
description
|
|
1984
|
+
product
|
|
1985
|
+
imageUrl
|
|
1986
|
+
index
|
|
1987
|
+
}
|
|
1988
|
+
ctas {
|
|
1989
|
+
kind
|
|
1990
|
+
label
|
|
1991
|
+
url
|
|
1992
|
+
product
|
|
1993
|
+
}
|
|
1994
|
+
followUps
|
|
1995
|
+
answered
|
|
1996
|
+
attachments {
|
|
1997
|
+
name
|
|
1998
|
+
mimeType
|
|
1999
|
+
size
|
|
2000
|
+
textExtracted
|
|
2001
|
+
}
|
|
2002
|
+
errorCode
|
|
2003
|
+
createdAt
|
|
2004
|
+
completedAt
|
|
2005
|
+
`
|
|
2006
|
+
);
|
|
2007
|
+
var EXPLORE_OWN_MESSAGE_FIELDS = (
|
|
2008
|
+
/* GraphQL */
|
|
2009
|
+
`
|
|
2010
|
+
${EXPLORE_MESSAGE_FIELDS}
|
|
2011
|
+
feedback {
|
|
2012
|
+
rating
|
|
2013
|
+
reason
|
|
2014
|
+
comment
|
|
2015
|
+
createdAt
|
|
2016
|
+
}
|
|
2017
|
+
`
|
|
2018
|
+
);
|
|
2019
|
+
var EXPLORE_CATALOG_ESTABLISHED_FIELDS = (
|
|
2020
|
+
/* GraphQL */
|
|
2021
|
+
`
|
|
2022
|
+
enabled
|
|
2023
|
+
products {
|
|
2024
|
+
slug
|
|
2025
|
+
name
|
|
2026
|
+
tagline
|
|
2027
|
+
website
|
|
2028
|
+
}
|
|
2029
|
+
examplePrompts
|
|
2030
|
+
welcomeTitle
|
|
2031
|
+
welcomeBody
|
|
2032
|
+
limits {
|
|
2033
|
+
maxMessageLength
|
|
2034
|
+
maxTurnsPerConversation
|
|
2035
|
+
messagesPerDay
|
|
2036
|
+
historyTurns
|
|
2037
|
+
}
|
|
2038
|
+
captchaRequired
|
|
2039
|
+
recaptchaSiteKey`
|
|
2040
|
+
);
|
|
2041
|
+
var EXPLORE_CATALOG_HIGHLIGHT_FIELD = (
|
|
2042
|
+
/* GraphQL */
|
|
2043
|
+
`
|
|
2044
|
+
conceptHighlights {
|
|
2045
|
+
product
|
|
2046
|
+
productName
|
|
2047
|
+
title
|
|
2048
|
+
url
|
|
2049
|
+
imageUrl
|
|
2050
|
+
alt
|
|
2051
|
+
}`
|
|
2052
|
+
);
|
|
2053
|
+
function exploreCatalogDocument(extraFields) {
|
|
2054
|
+
return (
|
|
2055
|
+
/* GraphQL */
|
|
2056
|
+
`
|
|
2057
|
+
query ExploreCatalog($productSlug: String) {
|
|
2058
|
+
exploreCatalog(productSlug: $productSlug) {${EXPLORE_CATALOG_ESTABLISHED_FIELDS}${extraFields}
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
`
|
|
2062
|
+
);
|
|
2063
|
+
}
|
|
2064
|
+
var EXPLORE_CATALOG_QUERY = exploreCatalogDocument(
|
|
2065
|
+
EXPLORE_CATALOG_HIGHLIGHT_FIELD
|
|
2066
|
+
);
|
|
2067
|
+
var EXPLORE_CATALOG_QUERY_WITHOUT_HIGHLIGHTS = exploreCatalogDocument("");
|
|
2068
|
+
var EXPLORE_MESSAGE_QUERY = (
|
|
2069
|
+
/* GraphQL */
|
|
2070
|
+
`
|
|
2071
|
+
query ExploreMessage($conversationToken: String!, $id: ID!) {
|
|
2072
|
+
exploreMessage(conversationToken: $conversationToken, id: $id) {
|
|
2073
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
`
|
|
2077
|
+
);
|
|
2078
|
+
var SEND_EXPLORE_MESSAGE_MUTATION = (
|
|
2079
|
+
/* GraphQL */
|
|
2080
|
+
`
|
|
2081
|
+
mutation SendExploreMessage($input: SendExploreMessageInput!) {
|
|
2082
|
+
sendExploreMessage(input: $input) {
|
|
2083
|
+
conversation {
|
|
2084
|
+
id
|
|
2085
|
+
token
|
|
2086
|
+
productSlug
|
|
2087
|
+
turnCount
|
|
2088
|
+
createdAt
|
|
2089
|
+
}
|
|
2090
|
+
userMessage {
|
|
2091
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
2092
|
+
}
|
|
2093
|
+
assistantMessage {
|
|
2094
|
+
${EXPLORE_OWN_MESSAGE_FIELDS}
|
|
2095
|
+
}
|
|
2096
|
+
remainingToday
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
`
|
|
2100
|
+
);
|
|
2101
|
+
var RECORD_EXPLORE_CLICK_MUTATION = (
|
|
2102
|
+
/* GraphQL */
|
|
2103
|
+
`
|
|
2104
|
+
mutation RecordExploreClick($input: RecordExploreClickInput!) {
|
|
2105
|
+
recordExploreClick(input: $input) {
|
|
2106
|
+
recorded
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
`
|
|
2110
|
+
);
|
|
2111
|
+
var SUBMIT_EXPLORE_FEEDBACK_MUTATION = (
|
|
2112
|
+
/* GraphQL */
|
|
2113
|
+
`
|
|
2114
|
+
mutation SubmitExploreFeedback($input: SubmitExploreFeedbackInput!) {
|
|
2115
|
+
submitExploreFeedback(input: $input) {
|
|
2116
|
+
recorded
|
|
2117
|
+
feedback {
|
|
2118
|
+
rating
|
|
2119
|
+
reason
|
|
2120
|
+
comment
|
|
2121
|
+
createdAt
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
`
|
|
2126
|
+
);
|
|
2127
|
+
var EXPLORE_FEEDBACK_COMMENT_SOFT_MAX = 500;
|
|
2128
|
+
var ESCALATE_EXPLORE_CONVERSATION_MUTATION = (
|
|
2129
|
+
/* GraphQL */
|
|
2130
|
+
`
|
|
2131
|
+
mutation EscalateExploreConversation(
|
|
2132
|
+
$input: EscalateExploreConversationInput!
|
|
2133
|
+
) {
|
|
2134
|
+
escalateExploreConversation(input: $input) {
|
|
2135
|
+
created
|
|
2136
|
+
escalation {
|
|
2137
|
+
email
|
|
2138
|
+
createdAt
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
`
|
|
2143
|
+
);
|
|
2144
|
+
var EXPLORE_ESCALATION_NOTE_SOFT_MAX = 2e3;
|
|
2145
|
+
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,}$/;
|
|
2146
|
+
function looksLikeDeliverableEmail(value) {
|
|
2147
|
+
const trimmed = value.trim();
|
|
2148
|
+
if (trimmed.length === 0 || trimmed.length > 254) return false;
|
|
2149
|
+
return DELIVERABLE_EMAIL.test(trimmed);
|
|
2150
|
+
}
|
|
2151
|
+
var CREATE_EXPLORE_SHARE_LINK_MUTATION = (
|
|
2152
|
+
/* GraphQL */
|
|
2153
|
+
`
|
|
2154
|
+
mutation CreateExploreShareLink($conversationToken: String!) {
|
|
2155
|
+
createExploreShareLink(conversationToken: $conversationToken) {
|
|
2156
|
+
shareToken
|
|
2157
|
+
}
|
|
2279
2158
|
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
const client = React.useContext(WebSDKContext);
|
|
2290
|
-
if (!client) {
|
|
2291
|
-
throw new Error("useWebSDK must be used within a WebSDKProvider");
|
|
2159
|
+
`
|
|
2160
|
+
);
|
|
2161
|
+
var EXPLORE_SHARED_CONVERSATION_QUERY = (
|
|
2162
|
+
/* GraphQL */
|
|
2163
|
+
`
|
|
2164
|
+
query ExploreSharedConversation($shareToken: String!) {
|
|
2165
|
+
exploreSharedConversation(shareToken: $shareToken) {
|
|
2166
|
+
${EXPLORE_MESSAGE_FIELDS}
|
|
2167
|
+
}
|
|
2292
2168
|
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
function useWebSDKConfig() {
|
|
2296
|
-
const client = useWebSDK();
|
|
2297
|
-
return client.getConfig();
|
|
2298
|
-
}
|
|
2169
|
+
`
|
|
2170
|
+
);
|
|
2299
2171
|
|
|
2300
2172
|
// src/utils/product-slug.ts
|
|
2301
2173
|
var PRODUCT_SLUG_RENAMES = Object.freeze(
|
|
@@ -2898,7 +2770,9 @@ function useExploreChat(options = {}) {
|
|
|
2898
2770
|
pollTimeoutMs = DEFAULT_POLL_TIMEOUT_MS,
|
|
2899
2771
|
storageKey = DEFAULT_STORAGE_KEY,
|
|
2900
2772
|
persist = true,
|
|
2901
|
-
onSend
|
|
2773
|
+
onSend,
|
|
2774
|
+
enabled = true,
|
|
2775
|
+
shareToken: shareTokenOption
|
|
2902
2776
|
} = options;
|
|
2903
2777
|
const client = useWebSDK();
|
|
2904
2778
|
const { productId } = useWebSDKConfig();
|
|
@@ -2936,7 +2810,7 @@ function useExploreChat(options = {}) {
|
|
|
2936
2810
|
const [hasConversation, setHasConversation] = React.useState(false);
|
|
2937
2811
|
const shareTokenRef = React.useRef(void 0);
|
|
2938
2812
|
if (shareTokenRef.current === void 0) {
|
|
2939
|
-
shareTokenRef.current = readShareToken();
|
|
2813
|
+
shareTokenRef.current = shareTokenOption === void 0 ? readShareToken() : shareTokenOption;
|
|
2940
2814
|
}
|
|
2941
2815
|
const isSharedView = shareTokenRef.current !== null;
|
|
2942
2816
|
const catalogRef = React.useRef(catalog);
|
|
@@ -2974,6 +2848,7 @@ function useExploreChat(options = {}) {
|
|
|
2974
2848
|
};
|
|
2975
2849
|
}, []);
|
|
2976
2850
|
React.useEffect(() => {
|
|
2851
|
+
if (!enabled) return;
|
|
2977
2852
|
const shareToken = shareTokenRef.current;
|
|
2978
2853
|
if (!shareToken) return;
|
|
2979
2854
|
let cancelled = false;
|
|
@@ -3008,8 +2883,9 @@ function useExploreChat(options = {}) {
|
|
|
3008
2883
|
return () => {
|
|
3009
2884
|
cancelled = true;
|
|
3010
2885
|
};
|
|
3011
|
-
}, [client]);
|
|
2886
|
+
}, [client, enabled]);
|
|
3012
2887
|
React.useEffect(() => {
|
|
2888
|
+
if (!enabled) return;
|
|
3013
2889
|
if (shareTokenRef.current !== null) return;
|
|
3014
2890
|
if (!persist) {
|
|
3015
2891
|
setHydrated(true);
|
|
@@ -3034,9 +2910,10 @@ function useExploreChat(options = {}) {
|
|
|
3034
2910
|
setTurnCount(turns);
|
|
3035
2911
|
}
|
|
3036
2912
|
setHydrated(true);
|
|
3037
|
-
}, [persist, rememberConversationToken, storageKey]);
|
|
2913
|
+
}, [persist, rememberConversationToken, storageKey, enabled]);
|
|
3038
2914
|
React.useEffect(() => {
|
|
3039
|
-
if (!persist || !hydrated || typeof window === "undefined")
|
|
2915
|
+
if (!persist || !hydrated || isSharedView || typeof window === "undefined")
|
|
2916
|
+
return;
|
|
3040
2917
|
try {
|
|
3041
2918
|
const payload = {
|
|
3042
2919
|
conversationToken: conversationTokenRef.current,
|
|
@@ -3050,10 +2927,10 @@ function useExploreChat(options = {}) {
|
|
|
3050
2927
|
window.localStorage.setItem(storageKey, JSON.stringify(payload));
|
|
3051
2928
|
} catch {
|
|
3052
2929
|
}
|
|
3053
|
-
}, [persist, hydrated, storageKey, messages, focusProduct]);
|
|
2930
|
+
}, [persist, hydrated, isSharedView, storageKey, messages, focusProduct]);
|
|
3054
2931
|
React.useEffect(() => {
|
|
3055
2932
|
messagesRef.current = messages;
|
|
3056
|
-
if (!persist || !hydrated) return;
|
|
2933
|
+
if (!persist || !hydrated || isSharedView) return;
|
|
3057
2934
|
const settled = messages.some(
|
|
3058
2935
|
(m) => m.role === "ASSISTANT" && (m.status === "COMPLETED" || m.status === "FAILED")
|
|
3059
2936
|
);
|
|
@@ -3065,8 +2942,9 @@ function useExploreChat(options = {}) {
|
|
|
3065
2942
|
focusProduct: focusProductRef.current
|
|
3066
2943
|
})
|
|
3067
2944
|
);
|
|
3068
|
-
}, [messages, persist, hydrated, storageKey]);
|
|
2945
|
+
}, [messages, persist, hydrated, isSharedView, storageKey]);
|
|
3069
2946
|
React.useEffect(() => {
|
|
2947
|
+
if (!enabled) return;
|
|
3070
2948
|
let cancelled = false;
|
|
3071
2949
|
const load = async () => {
|
|
3072
2950
|
const variables = { productSlug: productSlug ?? null };
|
|
@@ -3107,7 +2985,7 @@ function useExploreChat(options = {}) {
|
|
|
3107
2985
|
return () => {
|
|
3108
2986
|
cancelled = true;
|
|
3109
2987
|
};
|
|
3110
|
-
}, [client, productSlug, fallbackCatalog, bakedRaw]);
|
|
2988
|
+
}, [client, productSlug, fallbackCatalog, bakedRaw, enabled]);
|
|
3111
2989
|
const startPolling = React.useCallback(
|
|
3112
2990
|
(conversationToken, messageId) => {
|
|
3113
2991
|
pollGenerationRef.current += 1;
|
|
@@ -3604,6 +3482,218 @@ function makeOptimisticId() {
|
|
|
3604
3482
|
optimisticCounter += 1;
|
|
3605
3483
|
return `boff-explore-local-${Date.now()}-${optimisticCounter}`;
|
|
3606
3484
|
}
|
|
3485
|
+
var ExploreConversationContext = React.createContext(null);
|
|
3486
|
+
function useExploreConversation(options = {}) {
|
|
3487
|
+
const {
|
|
3488
|
+
productSlug,
|
|
3489
|
+
locale,
|
|
3490
|
+
examplePrompts,
|
|
3491
|
+
onSend,
|
|
3492
|
+
pageUrl,
|
|
3493
|
+
enabled,
|
|
3494
|
+
shareToken
|
|
3495
|
+
} = options;
|
|
3496
|
+
const urlAtMount = React.useMemo(
|
|
3497
|
+
() => typeof window === "undefined" ? void 0 : window.location.href,
|
|
3498
|
+
[]
|
|
3499
|
+
);
|
|
3500
|
+
const T = React.useMemo(
|
|
3501
|
+
() => exploreStrings(resolveExploreLocale(locale)),
|
|
3502
|
+
[locale]
|
|
3503
|
+
);
|
|
3504
|
+
const chat = useExploreChat({
|
|
3505
|
+
productSlug,
|
|
3506
|
+
pageUrl: pageUrl ?? urlAtMount,
|
|
3507
|
+
onSend,
|
|
3508
|
+
// Locale-aware, so a catalog outage degrades to a translated welcome rather than an English one.
|
|
3509
|
+
examplePrompts: examplePrompts ?? T.prompts,
|
|
3510
|
+
fallbackWelcome: { title: T.welcomeTitle, body: T.welcomeBody },
|
|
3511
|
+
...enabled === void 0 ? {} : { enabled },
|
|
3512
|
+
...shareToken === void 0 ? {} : { shareToken }
|
|
3513
|
+
});
|
|
3514
|
+
const [draft, setDraft] = React.useState("");
|
|
3515
|
+
const [staged, setStaged] = React.useState([]);
|
|
3516
|
+
return React.useMemo(
|
|
3517
|
+
() => ({ ...chat, draft, setDraft, staged, setStaged }),
|
|
3518
|
+
[chat, draft, staged]
|
|
3519
|
+
);
|
|
3520
|
+
}
|
|
3521
|
+
var PROSE_CSS = `
|
|
3522
|
+
.boff-prose {
|
|
3523
|
+
max-width: none;
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
.boff-prose h1 {
|
|
3527
|
+
font-size: 2.25rem;
|
|
3528
|
+
font-weight: 800;
|
|
3529
|
+
line-height: 1.2;
|
|
3530
|
+
margin-top: 0;
|
|
3531
|
+
margin-bottom: 1rem;
|
|
3532
|
+
color: hsl(var(--foreground));
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
.boff-prose h2 {
|
|
3536
|
+
font-size: 1.75rem;
|
|
3537
|
+
font-weight: 700;
|
|
3538
|
+
line-height: 1.3;
|
|
3539
|
+
margin-top: 2rem;
|
|
3540
|
+
margin-bottom: 1rem;
|
|
3541
|
+
color: hsl(var(--foreground));
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3544
|
+
.boff-prose h3 {
|
|
3545
|
+
font-size: 1.5rem;
|
|
3546
|
+
font-weight: 600;
|
|
3547
|
+
line-height: 1.4;
|
|
3548
|
+
margin-top: 1.5rem;
|
|
3549
|
+
margin-bottom: 0.75rem;
|
|
3550
|
+
color: hsl(var(--foreground));
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
.boff-prose h4 {
|
|
3554
|
+
font-size: 1.25rem;
|
|
3555
|
+
font-weight: 600;
|
|
3556
|
+
line-height: 1.5;
|
|
3557
|
+
margin-top: 1.25rem;
|
|
3558
|
+
margin-bottom: 0.5rem;
|
|
3559
|
+
color: hsl(var(--foreground));
|
|
3560
|
+
}
|
|
3561
|
+
|
|
3562
|
+
.boff-prose p {
|
|
3563
|
+
margin-bottom: 1rem;
|
|
3564
|
+
line-height: 1.75;
|
|
3565
|
+
color: hsl(var(--foreground));
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
.boff-prose ul,
|
|
3569
|
+
.boff-prose ol {
|
|
3570
|
+
margin-bottom: 1rem;
|
|
3571
|
+
padding-left: 1.5rem;
|
|
3572
|
+
}
|
|
3573
|
+
|
|
3574
|
+
.boff-prose ul {
|
|
3575
|
+
list-style-type: disc;
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
.boff-prose ol {
|
|
3579
|
+
list-style-type: decimal;
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
.boff-prose li {
|
|
3583
|
+
margin-bottom: 0.25rem;
|
|
3584
|
+
line-height: 1.75;
|
|
3585
|
+
color: hsl(var(--foreground));
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3588
|
+
.boff-prose li > ul,
|
|
3589
|
+
.boff-prose li > ol {
|
|
3590
|
+
margin-top: 0.25rem;
|
|
3591
|
+
margin-bottom: 0.25rem;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
.boff-prose a {
|
|
3595
|
+
color: hsl(var(--primary));
|
|
3596
|
+
text-decoration: underline;
|
|
3597
|
+
text-underline-offset: 2px;
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
.boff-prose a:hover {
|
|
3601
|
+
opacity: 0.8;
|
|
3602
|
+
}
|
|
3603
|
+
|
|
3604
|
+
.boff-prose hr {
|
|
3605
|
+
border: none;
|
|
3606
|
+
height: 1px;
|
|
3607
|
+
background-color: hsl(var(--border));
|
|
3608
|
+
margin: 2rem 0;
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3611
|
+
.boff-prose blockquote {
|
|
3612
|
+
border-left: 4px solid hsl(var(--border));
|
|
3613
|
+
padding-left: 1rem;
|
|
3614
|
+
margin: 1.5rem 0;
|
|
3615
|
+
font-style: italic;
|
|
3616
|
+
color: hsl(var(--muted-foreground));
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
.boff-prose strong {
|
|
3620
|
+
font-weight: 700;
|
|
3621
|
+
color: hsl(var(--foreground));
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
.boff-prose code {
|
|
3625
|
+
background-color: hsl(var(--muted));
|
|
3626
|
+
padding: 0.125rem 0.25rem;
|
|
3627
|
+
border-radius: 0.25rem;
|
|
3628
|
+
font-size: 0.875em;
|
|
3629
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
.boff-prose pre {
|
|
3633
|
+
background-color: hsl(var(--muted));
|
|
3634
|
+
padding: 1rem;
|
|
3635
|
+
border-radius: 0.5rem;
|
|
3636
|
+
overflow-x: auto;
|
|
3637
|
+
margin-bottom: 1rem;
|
|
3638
|
+
}
|
|
3639
|
+
|
|
3640
|
+
.boff-prose pre code {
|
|
3641
|
+
background-color: transparent;
|
|
3642
|
+
padding: 0;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
.boff-prose img {
|
|
3646
|
+
max-width: 100%;
|
|
3647
|
+
height: auto;
|
|
3648
|
+
}
|
|
3649
|
+
|
|
3650
|
+
.boff-prose table {
|
|
3651
|
+
width: 100%;
|
|
3652
|
+
border-collapse: collapse;
|
|
3653
|
+
margin-bottom: 1rem;
|
|
3654
|
+
}
|
|
3655
|
+
|
|
3656
|
+
.boff-prose th,
|
|
3657
|
+
.boff-prose td {
|
|
3658
|
+
border: 1px solid hsl(var(--border));
|
|
3659
|
+
padding: 0.5rem;
|
|
3660
|
+
text-align: left;
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3663
|
+
.boff-prose th {
|
|
3664
|
+
font-weight: 600;
|
|
3665
|
+
background-color: hsl(var(--muted));
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
/* Smaller variant used inside cards and compact panels */
|
|
3669
|
+
.boff-prose-sm {
|
|
3670
|
+
font-size: 0.875rem;
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3673
|
+
.boff-prose-sm h1 {
|
|
3674
|
+
font-size: 1.75rem;
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
.boff-prose-sm h2 {
|
|
3678
|
+
font-size: 1.5rem;
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
.boff-prose-sm h3 {
|
|
3682
|
+
font-size: 1.25rem;
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
.boff-prose-sm h4 {
|
|
3686
|
+
font-size: 1.125rem;
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3689
|
+
.boff-prose-sm p,
|
|
3690
|
+
.boff-prose-sm li {
|
|
3691
|
+
line-height: 1.625;
|
|
3692
|
+
}
|
|
3693
|
+
`;
|
|
3694
|
+
function ProseStyles() {
|
|
3695
|
+
return /* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: PROSE_CSS } });
|
|
3696
|
+
}
|
|
3607
3697
|
var DRAIN_TARGET_MS = 1200;
|
|
3608
3698
|
var MIN_CHARS_PER_SECOND = 90;
|
|
3609
3699
|
var MAX_CHARS_PER_SECOND = 2200;
|
|
@@ -6374,15 +6464,17 @@ function WelcomeState({
|
|
|
6374
6464
|
focusProduct,
|
|
6375
6465
|
onPrompt,
|
|
6376
6466
|
onFocus,
|
|
6377
|
-
disabled
|
|
6467
|
+
disabled,
|
|
6468
|
+
heading = "h1"
|
|
6378
6469
|
}) {
|
|
6470
|
+
const Heading = heading;
|
|
6379
6471
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "boff-explore-aura mx-auto my-auto w-full max-w-3xl px-4 py-4 sm:py-5", children: [
|
|
6380
6472
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "boff-explore-rise text-center", children: [
|
|
6381
6473
|
/* @__PURE__ */ jsxRuntime.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: [
|
|
6382
6474
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3.5 w-3.5" }),
|
|
6383
6475
|
T.badge
|
|
6384
6476
|
] }),
|
|
6385
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6477
|
+
/* @__PURE__ */ jsxRuntime.jsx(Heading, { className: "mt-2 text-balance break-words text-2xl font-bold tracking-tight sm:text-3xl", children: title }),
|
|
6386
6478
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mx-auto mt-2 max-w-2xl text-pretty text-sm leading-relaxed text-muted-foreground", children: body })
|
|
6387
6479
|
] }),
|
|
6388
6480
|
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsxs(
|
|
@@ -6437,19 +6529,36 @@ function exploreQuestionHref(question, base = "/explore") {
|
|
|
6437
6529
|
const joiner = base.includes("?") ? "&" : "?";
|
|
6438
6530
|
return `${base}${joiner}q=${encodeURIComponent(trimmed)}`;
|
|
6439
6531
|
}
|
|
6440
|
-
function ExplorePage({
|
|
6532
|
+
function ExplorePage(props) {
|
|
6533
|
+
const shared = React.useContext(ExploreConversationContext);
|
|
6534
|
+
return shared ? /* @__PURE__ */ jsxRuntime.jsx(ExploreView, { ...props, conversation: shared }) : /* @__PURE__ */ jsxRuntime.jsx(StandaloneExplorePage, { ...props });
|
|
6535
|
+
}
|
|
6536
|
+
function StandaloneExplorePage(props) {
|
|
6537
|
+
const conversation = useExploreConversation({
|
|
6538
|
+
productSlug: props.productSlug,
|
|
6539
|
+
locale: props.locale,
|
|
6540
|
+
examplePrompts: props.examplePrompts,
|
|
6541
|
+
onSend: props.onSend
|
|
6542
|
+
});
|
|
6543
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ExploreView, { ...props, conversation });
|
|
6544
|
+
}
|
|
6545
|
+
function ExploreView({
|
|
6441
6546
|
seo,
|
|
6442
6547
|
productSlug,
|
|
6443
|
-
examplePrompts,
|
|
6444
6548
|
className,
|
|
6445
6549
|
heightMode = "viewport",
|
|
6446
6550
|
viewportOffset,
|
|
6447
6551
|
onNavigate,
|
|
6448
|
-
onSend,
|
|
6449
6552
|
welcomeTitle,
|
|
6450
6553
|
welcomeBody,
|
|
6451
|
-
locale
|
|
6554
|
+
locale,
|
|
6555
|
+
presentation = "page",
|
|
6556
|
+
active = true,
|
|
6557
|
+
explorePath = "/explore",
|
|
6558
|
+
conversation
|
|
6452
6559
|
}) {
|
|
6560
|
+
const panel = presentation === "panel";
|
|
6561
|
+
const viewportPage = !panel && heightMode === "viewport";
|
|
6453
6562
|
const pageUrl = React.useMemo(
|
|
6454
6563
|
() => typeof window === "undefined" ? void 0 : window.location.href,
|
|
6455
6564
|
[]
|
|
@@ -6485,26 +6594,21 @@ function ExplorePage({
|
|
|
6485
6594
|
escalate,
|
|
6486
6595
|
canEscalate,
|
|
6487
6596
|
createShareLink,
|
|
6488
|
-
isSharedView
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
// English one. `T.prompts` seeds the chips the same way.
|
|
6495
|
-
examplePrompts: examplePrompts ?? T.prompts,
|
|
6496
|
-
fallbackWelcome: { title: T.welcomeTitle, body: T.welcomeBody }
|
|
6497
|
-
});
|
|
6498
|
-
const [draft, setDraft] = React.useState("");
|
|
6597
|
+
isSharedView,
|
|
6598
|
+
draft,
|
|
6599
|
+
setDraft,
|
|
6600
|
+
staged,
|
|
6601
|
+
setStaged
|
|
6602
|
+
} = conversation;
|
|
6499
6603
|
const textareaRef = React.useRef(null);
|
|
6500
6604
|
React.useEffect(() => {
|
|
6501
|
-
if (typeof window === "undefined") return;
|
|
6605
|
+
if (typeof window === "undefined" || panel) return;
|
|
6502
6606
|
const params = new URLSearchParams(window.location.search);
|
|
6503
6607
|
if (params.has("c")) return;
|
|
6504
6608
|
const question = params.get("q")?.trim();
|
|
6505
6609
|
if (!question) return;
|
|
6506
6610
|
setDraft(question.slice(0, EXPLORE_PREFILL_MAX_LENGTH));
|
|
6507
|
-
}, []);
|
|
6611
|
+
}, [panel, setDraft]);
|
|
6508
6612
|
const [historyOpen, setHistoryOpen] = React.useState(false);
|
|
6509
6613
|
const speechStopRef = React.useRef(() => void 0);
|
|
6510
6614
|
const stopDictation = React.useCallback(() => {
|
|
@@ -6520,8 +6624,12 @@ function ExplorePage({
|
|
|
6520
6624
|
}
|
|
6521
6625
|
});
|
|
6522
6626
|
speechStopRef.current = speech.stop;
|
|
6627
|
+
React.useEffect(() => {
|
|
6628
|
+
if (active) return;
|
|
6629
|
+
stopDictation();
|
|
6630
|
+
stopSpeaking();
|
|
6631
|
+
}, [active, stopDictation]);
|
|
6523
6632
|
const [disclaimerOpen, setDisclaimerOpen] = React.useState(false);
|
|
6524
|
-
const [staged, setStaged] = React.useState([]);
|
|
6525
6633
|
const [attachmentNotice, setAttachmentNotice] = React.useState(null);
|
|
6526
6634
|
const fileInputRef = React.useRef(null);
|
|
6527
6635
|
const stagedRef = React.useRef([]);
|
|
@@ -6574,7 +6682,7 @@ function ExplorePage({
|
|
|
6574
6682
|
const [bottomInset, setBottomInset] = React.useState(0);
|
|
6575
6683
|
const paneOffsetRef = React.useRef(0);
|
|
6576
6684
|
const measurePane = React.useCallback(() => {
|
|
6577
|
-
if (
|
|
6685
|
+
if (!viewportPage) return;
|
|
6578
6686
|
const el = rootRef.current;
|
|
6579
6687
|
if (!el) return;
|
|
6580
6688
|
const layoutHeight = window.innerHeight;
|
|
@@ -6593,7 +6701,7 @@ function ExplorePage({
|
|
|
6593
6701
|
paneOffsetRef.current = top;
|
|
6594
6702
|
setPaneOffset((current) => current === top ? current : top);
|
|
6595
6703
|
setBottomInset((current) => current === inset ? current : inset);
|
|
6596
|
-
}, [
|
|
6704
|
+
}, [viewportPage]);
|
|
6597
6705
|
const [chromeOverlap, setChromeOverlap] = React.useState(0);
|
|
6598
6706
|
const measureChrome = React.useCallback(() => {
|
|
6599
6707
|
const root = rootRef.current;
|
|
@@ -6618,7 +6726,7 @@ function ExplorePage({
|
|
|
6618
6726
|
measureChrome();
|
|
6619
6727
|
}, [measurePane, measureChrome]);
|
|
6620
6728
|
React.useEffect(() => {
|
|
6621
|
-
if (typeof window === "undefined") return;
|
|
6729
|
+
if (typeof window === "undefined" || panel) return;
|
|
6622
6730
|
let frame = 0;
|
|
6623
6731
|
const run = () => {
|
|
6624
6732
|
frame = 0;
|
|
@@ -6656,12 +6764,12 @@ function ExplorePage({
|
|
|
6656
6764
|
setBottomInset(0);
|
|
6657
6765
|
setChromeOverlap(0);
|
|
6658
6766
|
};
|
|
6659
|
-
}, [remeasure]);
|
|
6767
|
+
}, [remeasure, panel]);
|
|
6660
6768
|
React.useEffect(() => {
|
|
6661
6769
|
measureChrome();
|
|
6662
6770
|
}, [measureChrome, paneOffset, bottomInset]);
|
|
6663
6771
|
React.useEffect(() => {
|
|
6664
|
-
if (
|
|
6772
|
+
if (!viewportPage || typeof window === "undefined") return;
|
|
6665
6773
|
const { history: browserHistory } = window;
|
|
6666
6774
|
const previousRestoration = "scrollRestoration" in browserHistory ? browserHistory.scrollRestoration : null;
|
|
6667
6775
|
if (previousRestoration !== null)
|
|
@@ -6729,14 +6837,14 @@ function ExplorePage({
|
|
|
6729
6837
|
if (previousRestoration !== null)
|
|
6730
6838
|
browserHistory.scrollRestoration = previousRestoration;
|
|
6731
6839
|
};
|
|
6732
|
-
}, [
|
|
6840
|
+
}, [viewportPage, remeasure]);
|
|
6733
6841
|
const handleScroll = React.useCallback(() => {
|
|
6734
6842
|
const el = scrollRef.current;
|
|
6735
6843
|
if (!el) return;
|
|
6736
6844
|
stickToBottomRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
|
|
6737
6845
|
}, []);
|
|
6738
6846
|
React.useEffect(() => {
|
|
6739
|
-
if (typeof window === "undefined") return;
|
|
6847
|
+
if (typeof window === "undefined" || panel) return;
|
|
6740
6848
|
let frame = 0;
|
|
6741
6849
|
const run = () => {
|
|
6742
6850
|
frame = 0;
|
|
@@ -6759,7 +6867,7 @@ function ExplorePage({
|
|
|
6759
6867
|
if (frame) window.cancelAnimationFrame(frame);
|
|
6760
6868
|
window.removeEventListener("scroll", schedule);
|
|
6761
6869
|
};
|
|
6762
|
-
}, []);
|
|
6870
|
+
}, [panel]);
|
|
6763
6871
|
const latestAssistantId = React.useMemo(() => {
|
|
6764
6872
|
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
6765
6873
|
const message = messages[i];
|
|
@@ -6775,7 +6883,7 @@ function ExplorePage({
|
|
|
6775
6883
|
if (!stickToBottomRef.current) return;
|
|
6776
6884
|
if (anchor.offsetHeight === 0) return;
|
|
6777
6885
|
alignedForRef.current = latestAssistantId;
|
|
6778
|
-
if (!pageOwnsScrolling(el)) {
|
|
6886
|
+
if (panel || !pageOwnsScrolling(el)) {
|
|
6779
6887
|
const delta2 = anchor.getBoundingClientRect().top - el.getBoundingClientRect().top;
|
|
6780
6888
|
el.scrollTop = Math.max(0, el.scrollTop + delta2 - 12);
|
|
6781
6889
|
return;
|
|
@@ -6784,7 +6892,7 @@ function ExplorePage({
|
|
|
6784
6892
|
anchor.getBoundingClientRect().top - paneOffsetRef.current - 12
|
|
6785
6893
|
);
|
|
6786
6894
|
if (delta !== 0) window.scrollBy({ top: delta, left: 0, behavior: "auto" });
|
|
6787
|
-
}, [latestAssistantId, messages]);
|
|
6895
|
+
}, [latestAssistantId, messages, panel]);
|
|
6788
6896
|
React.useEffect(() => {
|
|
6789
6897
|
if (messages.length === 0) return;
|
|
6790
6898
|
if (!stickToBottomRef.current) return;
|
|
@@ -6792,7 +6900,7 @@ function ExplorePage({
|
|
|
6792
6900
|
return;
|
|
6793
6901
|
const el = scrollRef.current;
|
|
6794
6902
|
if (!el) return;
|
|
6795
|
-
if (!pageOwnsScrolling(el)) {
|
|
6903
|
+
if (panel || !pageOwnsScrolling(el)) {
|
|
6796
6904
|
el.scrollTop = el.scrollHeight;
|
|
6797
6905
|
return;
|
|
6798
6906
|
}
|
|
@@ -6801,7 +6909,7 @@ function ExplorePage({
|
|
|
6801
6909
|
dock.getBoundingClientRect().bottom - visualViewportHeight()
|
|
6802
6910
|
);
|
|
6803
6911
|
if (delta > 0) window.scrollBy({ top: delta, left: 0, behavior: "auto" });
|
|
6804
|
-
}, [activity, latestAssistantId, messages]);
|
|
6912
|
+
}, [activity, latestAssistantId, messages, panel]);
|
|
6805
6913
|
const handleShare = React.useCallback(async () => {
|
|
6806
6914
|
setShareLabel(T.copying);
|
|
6807
6915
|
setShareUrl(null);
|
|
@@ -6811,7 +6919,7 @@ function ExplorePage({
|
|
|
6811
6919
|
setTimeout(() => setShareLabel(T.share), 2500);
|
|
6812
6920
|
return;
|
|
6813
6921
|
}
|
|
6814
|
-
const url = new URL(pageUrl ?? window.location.href);
|
|
6922
|
+
const url = panel ? new URL(explorePath, window.location.href) : new URL(pageUrl ?? window.location.href);
|
|
6815
6923
|
url.search = "";
|
|
6816
6924
|
url.hash = "";
|
|
6817
6925
|
url.searchParams.set("c", token);
|
|
@@ -6827,6 +6935,8 @@ function ExplorePage({
|
|
|
6827
6935
|
}, [
|
|
6828
6936
|
createShareLink,
|
|
6829
6937
|
pageUrl,
|
|
6938
|
+
panel,
|
|
6939
|
+
explorePath,
|
|
6830
6940
|
T.copied,
|
|
6831
6941
|
T.copying,
|
|
6832
6942
|
T.share,
|
|
@@ -6855,12 +6965,15 @@ function ExplorePage({
|
|
|
6855
6965
|
});
|
|
6856
6966
|
return pickQueueRef.current;
|
|
6857
6967
|
},
|
|
6858
|
-
[T]
|
|
6968
|
+
[T, setStaged]
|
|
6969
|
+
);
|
|
6970
|
+
const removeAttachment = React.useCallback(
|
|
6971
|
+
(id) => {
|
|
6972
|
+
setStaged((prev) => prev.filter((entry) => entry.id !== id));
|
|
6973
|
+
setAttachmentNotice(null);
|
|
6974
|
+
},
|
|
6975
|
+
[setStaged]
|
|
6859
6976
|
);
|
|
6860
|
-
const removeAttachment = React.useCallback((id) => {
|
|
6861
|
-
setStaged((prev) => prev.filter((entry) => entry.id !== id));
|
|
6862
|
-
setAttachmentNotice(null);
|
|
6863
|
-
}, []);
|
|
6864
6977
|
const submitDraft = React.useCallback(() => {
|
|
6865
6978
|
const text = draft.trim();
|
|
6866
6979
|
if (!text || overLimit || busy || !canSend) return;
|
|
@@ -6872,7 +6985,16 @@ function ExplorePage({
|
|
|
6872
6985
|
setStaged([]);
|
|
6873
6986
|
setAttachmentNotice(null);
|
|
6874
6987
|
textareaRef.current?.focus();
|
|
6875
|
-
}, [
|
|
6988
|
+
}, [
|
|
6989
|
+
busy,
|
|
6990
|
+
canSend,
|
|
6991
|
+
draft,
|
|
6992
|
+
overLimit,
|
|
6993
|
+
send,
|
|
6994
|
+
setDraft,
|
|
6995
|
+
setStaged,
|
|
6996
|
+
stopDictation
|
|
6997
|
+
]);
|
|
6876
6998
|
const sendPrompt = React.useCallback(
|
|
6877
6999
|
(prompt) => {
|
|
6878
7000
|
if (!canSend || busy) return;
|
|
@@ -6883,7 +7005,7 @@ function ExplorePage({
|
|
|
6883
7005
|
setStaged([]);
|
|
6884
7006
|
setAttachmentNotice(null);
|
|
6885
7007
|
},
|
|
6886
|
-
[busy, canSend, send]
|
|
7008
|
+
[busy, canSend, send, setDraft, setStaged]
|
|
6887
7009
|
);
|
|
6888
7010
|
const handleKeyDown = React.useCallback(
|
|
6889
7011
|
(event) => {
|
|
@@ -6905,7 +7027,7 @@ function ExplorePage({
|
|
|
6905
7027
|
[serverCatalogRaw]
|
|
6906
7028
|
);
|
|
6907
7029
|
const rootStyle = {};
|
|
6908
|
-
if (
|
|
7030
|
+
if (viewportPage) {
|
|
6909
7031
|
rootStyle["--boff-explore-offset"] = paneOffset === null ? normalizeOffset(viewportOffset) : `${paneOffset}px`;
|
|
6910
7032
|
if (bottomInset > 0) {
|
|
6911
7033
|
rootStyle["--boff-explore-inset"] = `${bottomInset}px`;
|
|
@@ -6918,19 +7040,19 @@ function ExplorePage({
|
|
|
6918
7040
|
"div",
|
|
6919
7041
|
{
|
|
6920
7042
|
ref: rootRef,
|
|
6921
|
-
"data-boff-explore": "page",
|
|
7043
|
+
"data-boff-explore": panel ? "panel" : "page",
|
|
6922
7044
|
"data-phase": phase,
|
|
6923
7045
|
"data-locale": activeLocale,
|
|
6924
7046
|
dir: rtl ? "rtl" : void 0,
|
|
6925
7047
|
className: cn(
|
|
6926
|
-
"flex w-full min-w-0 flex-col overflow-x-hidden bg-background text-foreground",
|
|
6927
|
-
|
|
6928
|
-
heightMode === "auto" && "min-h-[70vh]",
|
|
7048
|
+
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",
|
|
7049
|
+
viewportPage && "boff-explore-viewport",
|
|
7050
|
+
!panel && heightMode === "auto" && "min-h-[70vh]",
|
|
6929
7051
|
className
|
|
6930
7052
|
),
|
|
6931
|
-
style: rootStyle,
|
|
7053
|
+
style: panel ? void 0 : rootStyle,
|
|
6932
7054
|
children: [
|
|
6933
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7055
|
+
panel ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
6934
7056
|
PageHead,
|
|
6935
7057
|
{
|
|
6936
7058
|
title: seo?.title ?? T.seoTitle,
|
|
@@ -6943,7 +7065,11 @@ function ExplorePage({
|
|
|
6943
7065
|
),
|
|
6944
7066
|
/* @__PURE__ */ jsxRuntime.jsx(ProseStyles, {}),
|
|
6945
7067
|
/* @__PURE__ */ jsxRuntime.jsx(ExploreStyles, {}),
|
|
6946
|
-
|
|
7068
|
+
panel ? /* @__PURE__ */ jsxRuntime.jsx("style", { children: `.boff-explore-panel .boff-explore-scroll { container: boff-explore-pane / size; }
|
|
7069
|
+
@container boff-explore-pane (width < ${toRem(WELCOME_FIT_MIN_WIDTH_PX)}) {
|
|
7070
|
+
.boff-explore-panel .boff-explore-scroll .boff-explore-capabilities { display: none; }
|
|
7071
|
+
}` }) : null,
|
|
7072
|
+
!panel && bakedCatalogJson ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6947
7073
|
"script",
|
|
6948
7074
|
{
|
|
6949
7075
|
id: BAKED_CATALOG_ELEMENT_ID,
|
|
@@ -6963,7 +7089,7 @@ function ExplorePage({
|
|
|
6963
7089
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-4 w-4" })
|
|
6964
7090
|
}
|
|
6965
7091
|
),
|
|
6966
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "truncate text-sm font-semibold", children: resolvedTitle }),
|
|
7092
|
+
panel ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "truncate text-sm font-semibold", children: resolvedTitle }) : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "truncate text-sm font-semibold", children: resolvedTitle }),
|
|
6967
7093
|
focusedProductName ? /* @__PURE__ */ jsxRuntime.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,
|
|
6968
7094
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6969
7095
|
Button,
|
|
@@ -7107,6 +7233,7 @@ function ExplorePage({
|
|
|
7107
7233
|
children: showWelcome ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
7108
7234
|
WelcomeState,
|
|
7109
7235
|
{
|
|
7236
|
+
heading: panel ? "h2" : "h1",
|
|
7110
7237
|
strings: T,
|
|
7111
7238
|
title: resolvedTitle,
|
|
7112
7239
|
body: resolvedBody,
|