@veluai/velu 0.2.45 → 0.2.47
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/package.json +1 -1
- package/src/runtime/App.jsx +6 -4
package/package.json
CHANGED
package/src/runtime/App.jsx
CHANGED
|
@@ -89,6 +89,8 @@ function docsAuthActionUrl(action) {
|
|
|
89
89
|
// Resolve it to a relative base. Do not read `window` here: prerender runs
|
|
90
90
|
// this useMemo during renderToString in Node.
|
|
91
91
|
function resolvePublicApiBase(configuredBase) {
|
|
92
|
+
// Private readers must reach the router that verifies and forwards their session.
|
|
93
|
+
if (site.readerPrivate) return BASE_PATH;
|
|
92
94
|
if (!configuredBase) return null;
|
|
93
95
|
if (configuredBase !== '__VELU_SAME_ORIGIN__') return configuredBase;
|
|
94
96
|
return BASE_PATH;
|
|
@@ -801,7 +803,7 @@ function DocsPage() {
|
|
|
801
803
|
// URL path — e.g. essentials/markdown.mdx lives under the "Writing Content"
|
|
802
804
|
// group). Page rows show the path to the page; anchor rows include the page.
|
|
803
805
|
const searchDocs = React.useCallback(async (q) => {
|
|
804
|
-
const results = site.readerRestricted ? await fetch((import.meta.env.BASE_URL || '/') + '
|
|
806
|
+
const results = site.readerRestricted ? await fetch((import.meta.env.BASE_URL || '/') + 'api/v1/public/search?q=' + encodeURIComponent(q), {credentials:'same-origin',cache:'no-store'}).then(r=>r.ok?r.json():[]) : await pagefindSearch(q);
|
|
805
807
|
if (!Array.isArray(results)) return results;
|
|
806
808
|
return results.map((r) => {
|
|
807
809
|
const res = resolve(r.href.split('#')[0], navigation, pages);
|
|
@@ -817,7 +819,7 @@ function DocsPage() {
|
|
|
817
819
|
// Otherwise `ask` stays undefined and the Chatbot uses its canned demo answer
|
|
818
820
|
// (dev preview, or a site that hasn't enabled the assistant).
|
|
819
821
|
const assistant = React.useMemo(() => {
|
|
820
|
-
if (IS_DEV_PREVIEW
|
|
822
|
+
if (IS_DEV_PREVIEW) return null;
|
|
821
823
|
const apiBase = resolvePublicApiBase(site.assistant?.apiBase);
|
|
822
824
|
if (apiBase == null) return null;
|
|
823
825
|
return createDocsAssistant({ apiBase, host: site.assistant?.host });
|
|
@@ -826,7 +828,7 @@ function DocsPage() {
|
|
|
826
828
|
// Hide the Ask-AI widget when the docs owner's plan/credits disable it (the
|
|
827
829
|
// backend bootstrap returns ask_ai_enabled:false). Only applies to a real
|
|
828
830
|
// configured assistant — the dev-preview/demo widget stays visible.
|
|
829
|
-
const [askAiHidden, setAskAiHidden] = React.useState(
|
|
831
|
+
const [askAiHidden, setAskAiHidden] = React.useState(false);
|
|
830
832
|
React.useEffect(() => {
|
|
831
833
|
if (!assistant) return undefined;
|
|
832
834
|
let alive = true;
|
|
@@ -841,7 +843,7 @@ function DocsPage() {
|
|
|
841
843
|
// widget can POST to /api/v1/public/feedback. Null in the dev preview, where
|
|
842
844
|
// the widget stays purely visual.
|
|
843
845
|
const pageFeedback = React.useMemo(() => {
|
|
844
|
-
if (IS_DEV_PREVIEW
|
|
846
|
+
if (IS_DEV_PREVIEW) return null;
|
|
845
847
|
const apiBase = resolvePublicApiBase(site.assistant?.apiBase);
|
|
846
848
|
if (apiBase == null) return null;
|
|
847
849
|
return createPageFeedback({ apiBase, host: site.assistant?.host });
|