@burdenoff/fe-libs 2026.1114.4 → 2026.1114.6
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/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +1261 -1250
- package/dist/shared/assistant/ui/AssistantPageHost.d.ts +10 -1
- package/dist/shared/assistant/ui/AssistantPageHost.js +21 -13
- package/dist/shared/assistant/ui/assistantPageStart.d.ts +9 -0
- package/dist/shared/assistant/ui/assistantPageStart.js +36 -0
- package/dist/shared/graphql/client.js +188 -185
- package/dist/shared/graphql/links/sse-link.d.ts +16 -0
- package/dist/shared/graphql/links/sse-link.js +37 -27
- package/dist/shared/utils/backendErrors.js +1 -1
- package/dist/shared-assistant.js +67 -66
- package/package.json +1 -1
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
/** A page's own content for a new chat, around the message box. */
|
|
3
|
+
export interface AssistantPageStart {
|
|
4
|
+
/** Above the box (say, a greeting). */
|
|
5
|
+
above?: ReactNode;
|
|
6
|
+
/** Below the box (say, suggestions and cards). */
|
|
7
|
+
below?: ReactNode;
|
|
8
|
+
}
|
|
2
9
|
export interface AssistantPageHostProps {
|
|
3
10
|
/** Size and place the host; the panel fills it. */
|
|
4
11
|
className?: string;
|
|
@@ -7,5 +14,7 @@ export interface AssistantPageHostProps {
|
|
|
7
14
|
* or one without `pageSurface`. Default: nothing.
|
|
8
15
|
*/
|
|
9
16
|
fallback?: ReactNode;
|
|
17
|
+
/** The page's own content for a new chat, around the message box. Absent: the assistant's own empty state. */
|
|
18
|
+
start?: AssistantPageStart;
|
|
10
19
|
}
|
|
11
|
-
export declare function AssistantPageHost({ className, fallback }: AssistantPageHostProps): import('react').JSX.Element;
|
|
20
|
+
export declare function AssistantPageHost({ className, fallback, start }: AssistantPageHostProps): import('react').JSX.Element;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { cn as e } from "../../../shared-utils.js";
|
|
2
2
|
import { useAssistantOverlayOrNull as t } from "./AssistantOverlay.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { offerAssistantPageStart as n, useAssistantPageStartSlot as r } from "./assistantPageStart.js";
|
|
4
|
+
import { useCallback as i, useEffect as a } from "react";
|
|
5
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
import { createPortal as l } from "react-dom";
|
|
5
7
|
// src/shared/assistant/ui/AssistantPageHost.tsx
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
function u({ className: u, fallback: d = null, start: f }) {
|
|
9
|
+
let p = t()?.registerPageHost, m = p !== void 0 && f !== void 0;
|
|
10
|
+
a(() => m ? n() : void 0, [m]);
|
|
11
|
+
let h = r("above"), g = r("below"), _ = i((e) => {
|
|
12
|
+
if (e && p) return p(e);
|
|
13
|
+
}, [p]);
|
|
14
|
+
return p ? /* @__PURE__ */ c(o, { children: [
|
|
15
|
+
/* @__PURE__ */ s("div", {
|
|
16
|
+
ref: _,
|
|
17
|
+
className: e("flex min-h-0 flex-col", u),
|
|
18
|
+
"data-testid": "assistant-page-host",
|
|
19
|
+
"data-assistant-page-host": ""
|
|
20
|
+
}),
|
|
21
|
+
m && h && f?.above ? l(f.above, h) : null,
|
|
22
|
+
m && g && f?.below ? l(f.below, g) : null
|
|
23
|
+
] }) : /* @__PURE__ */ s(o, { children: d });
|
|
16
24
|
}
|
|
17
|
-
export {
|
|
25
|
+
export { u as AssistantPageHost };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type AssistantPageStartSlot = 'above' | 'below';
|
|
2
|
+
/** A page offers start content while it is mounted. Returns the release (idempotent). */
|
|
3
|
+
export declare function offerAssistantPageStart(): () => void;
|
|
4
|
+
/** True while a mounted page offers start content. */
|
|
5
|
+
export declare function useAssistantPageStartOffered(): boolean;
|
|
6
|
+
/** Where the page's start content goes: the chat area's slot, or null while none is drawn. */
|
|
7
|
+
export declare function useAssistantPageStartSlot(slot: AssistantPageStartSlot): HTMLElement | null;
|
|
8
|
+
/** The chat area's slot elements, from its ref callbacks (null when a slot goes). */
|
|
9
|
+
export declare function setAssistantPageStartSlot(slot: AssistantPageStartSlot, element: HTMLElement | null): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useSyncExternalStore as e } from "react";
|
|
2
|
+
// src/shared/assistant/ui/assistantPageStart.ts
|
|
3
|
+
var t = {
|
|
4
|
+
offers: 0,
|
|
5
|
+
above: null,
|
|
6
|
+
below: null
|
|
7
|
+
}, n = /* @__PURE__ */ new Set();
|
|
8
|
+
function r(e) {
|
|
9
|
+
t = {
|
|
10
|
+
...t,
|
|
11
|
+
...e
|
|
12
|
+
};
|
|
13
|
+
for (let e of [...n]) e();
|
|
14
|
+
}
|
|
15
|
+
function i(e) {
|
|
16
|
+
return n.add(e), () => {
|
|
17
|
+
n.delete(e);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function a() {
|
|
21
|
+
r({ offers: t.offers + 1 });
|
|
22
|
+
let e = !1;
|
|
23
|
+
return () => {
|
|
24
|
+
e || (e = !0, r({ offers: t.offers - 1 }));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function o() {
|
|
28
|
+
return e(i, () => t.offers > 0, () => !1);
|
|
29
|
+
}
|
|
30
|
+
function s(n) {
|
|
31
|
+
return e(i, () => t[n], () => null);
|
|
32
|
+
}
|
|
33
|
+
function c(e, n) {
|
|
34
|
+
t[e] !== n && r(e === "above" ? { above: n } : { below: n });
|
|
35
|
+
}
|
|
36
|
+
export { a as offerAssistantPageStart, c as setAssistantPageStartSlot, o as useAssistantPageStartOffered, s as useAssistantPageStartSlot };
|