@inkeep/agents-ui 0.0.0-dev-20260316195110 → 0.0.0-dev-20260317194422
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/primitives/components/chat-history/index.cjs +1 -1
- package/dist/primitives/components/chat-history/index.d.ts +1 -1
- package/dist/primitives/components/chat-history/index.js +65 -64
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),e=require("../factory.cjs"),s=require("../../providers/chat-history-provider.cjs"),x=require("../../utils/misc.cjs"),m=require("../../utils/compose-event-handlers.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),e=require("../factory.cjs"),s=require("../../providers/chat-history-provider.cjs"),x=require("../../providers/chat-form-provider.cjs"),E=require("../../utils/misc.cjs"),m=require("../../utils/compose-event-handlers.cjs"),T=require("../../atoms/icons/custom-icon.cjs"),w=e.ikp("div",{_id:"aiChatHistory"}),H=t=>{const{isOpen:i}=s.useChatHistory(),{form:o}=x.useChatForm();return o?null:r.jsx(w,{"data-hidden":E.dataAttr(!i),...t})},d=e.ikp("div",{_id:"aiChatHistory__Header"}),R=e.ikp(T.CustomIcon,{_id:"aiChatHistory__BackButtonIcon"}),l=a.memo(t=>r.jsx(R,{...t,iconKey:"backToChat"})),q=e.ikp("button",{_id:"aiChatHistory__BackButton"}),P=({onClick:t,...i})=>{const{setIsOpen:o}=s.useChatHistory();return r.jsx(q,{type:"button",onClick:m.composeEventHandlers(t,()=>o(!1)),...i})},_=e.ikp("h2",{_id:"aiChatHistory__Title"}),F=e.ikp("div",{_id:"aiChatHistory__List"}),p=a.forwardRef(({children:t,...i},o)=>{const{hasMore:n,loadMore:u,isLoading:h,sessions:b}=s.useChatHistory(),y=a.useRef(null),c=b.length>0&&n;return a.useEffect(()=>{const C=y.current;if(!C||!c)return;const v=new IntersectionObserver(j=>{j[0]?.isIntersecting&&n&&!h&&u()},{threshold:.1});return v.observe(C),()=>v.disconnect()},[n,h,u,c]),r.jsxs(F,{ref:o,...i,children:[t,c&&r.jsx("div",{ref:y,"data-part":"sentinel","aria-hidden":"true",style:{height:1}})]})}),N=e.ikp("button",{_id:"aiChatHistory__Item"}),k=a.memo(({sessionId:t,onClick:i,...o})=>{const{loadSession:n}=s.useChatHistory();return r.jsx(N,{type:"button",onClick:m.composeEventHandlers(i,()=>n(t)),...o})}),B=e.ikp("span",{_id:"aiChatHistory__ItemTitle"}),I=e.ikp("span",{_id:"aiChatHistory__ItemDate"}),D=e.ikp("div",{_id:"aiChatHistory__EmptyState"}),f=t=>{const{sessions:i,isLoading:o}=s.useChatHistory();return i.length>0||o?null:r.jsx(D,{...t})},O=e.ikp("div",{_id:"aiChatHistory__LoadingState"}),g=t=>{const{isLoading:i}=s.useChatHistory();return i?r.jsx(O,{...t}):null},S=e.ikp("div",{_id:"aiChatHistory__Footer"}),M=e.ikp("button",{_id:"aiChatHistory__NewConversationButton"}),L=({onClick:t,...i})=>{const{startNewConversation:o}=s.useChatHistory();return r.jsx(M,{type:"button",onClick:m.composeEventHandlers(t,o),...i})};exports.BackButton=P;exports.BackButtonIcon=l;exports.ChatHistoryPrimitiveBackButton=P;exports.ChatHistoryPrimitiveBackButtonIcon=l;exports.ChatHistoryPrimitiveEmptyState=f;exports.ChatHistoryPrimitiveFooter=S;exports.ChatHistoryPrimitiveHeader=d;exports.ChatHistoryPrimitiveItem=k;exports.ChatHistoryPrimitiveItemDate=I;exports.ChatHistoryPrimitiveItemTitle=B;exports.ChatHistoryPrimitiveList=p;exports.ChatHistoryPrimitiveLoadingState=g;exports.ChatHistoryPrimitiveNewConversationButton=L;exports.ChatHistoryPrimitiveRoot=H;exports.ChatHistoryPrimitiveTitle=_;exports.EmptyState=f;exports.Footer=S;exports.Header=d;exports.Item=k;exports.ItemDate=I;exports.ItemTitle=B;exports.List=p;exports.LoadingState=g;exports.NewConversationButton=L;exports.Root=H;exports.Title=_;
|
|
@@ -2,7 +2,7 @@ import { ComponentPropsWithRef, ForwardRefExoticComponent, DetailedHTMLProps, HT
|
|
|
2
2
|
import { PolymorphicProps } from '..';
|
|
3
3
|
import { CustomIconProps } from '../..';
|
|
4
4
|
declare const PrimitiveRoot: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
5
|
-
export declare const ChatHistoryPrimitiveRoot: (props: ComponentPropsWithRef<typeof PrimitiveRoot>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const ChatHistoryPrimitiveRoot: (props: ComponentPropsWithRef<typeof PrimitiveRoot>) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export declare const ChatHistoryPrimitiveHeader: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
|
|
7
7
|
declare const PrimitiveBackButtonIcon: ForwardRefExoticComponent< PolymorphicProps & Omit< CustomIconProps, "_id"> & Partial<Pick< CustomIconProps, "_id">>>;
|
|
8
8
|
export declare const ChatHistoryPrimitiveBackButtonIcon: MemoExoticComponent<(props: ComponentPropsWithRef<typeof PrimitiveBackButtonIcon>) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsx as r, jsxs as H } from "react/jsx-runtime";
|
|
2
|
+
import { memo as v, forwardRef as l, useRef as p, useEffect as f } from "react";
|
|
3
3
|
import { ikp as o } from "../factory.js";
|
|
4
|
-
import { useChatHistory as
|
|
4
|
+
import { useChatHistory as s } from "../../providers/chat-history-provider.js";
|
|
5
|
+
import { useChatForm as P } from "../../providers/chat-form-provider.js";
|
|
5
6
|
import { dataAttr as B } from "../../utils/misc.js";
|
|
6
7
|
import { composeEventHandlers as c } from "../../utils/compose-event-handlers.js";
|
|
7
|
-
import { CustomIcon as
|
|
8
|
-
const
|
|
9
|
-
const { isOpen: i } =
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
},
|
|
8
|
+
import { CustomIcon as I } from "../../atoms/icons/custom-icon.js";
|
|
9
|
+
const k = o("div", { _id: "aiChatHistory" }), A = (t) => {
|
|
10
|
+
const { isOpen: i } = s(), { form: e } = P();
|
|
11
|
+
return e ? null : /* @__PURE__ */ r(k, { "data-hidden": B(!i), ...t });
|
|
12
|
+
}, K = o("div", { _id: "aiChatHistory__Header" }), g = o(I, {
|
|
12
13
|
_id: "aiChatHistory__BackButtonIcon"
|
|
13
|
-
}),
|
|
14
|
-
(t) => /* @__PURE__ */
|
|
15
|
-
),
|
|
14
|
+
}), q = v(
|
|
15
|
+
(t) => /* @__PURE__ */ r(g, { ...t, iconKey: "backToChat" })
|
|
16
|
+
), L = o("button", { _id: "aiChatHistory__BackButton" }), z = ({
|
|
16
17
|
onClick: t,
|
|
17
18
|
...i
|
|
18
19
|
}) => {
|
|
19
|
-
const { setIsOpen: e } =
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
20
|
+
const { setIsOpen: e } = s();
|
|
21
|
+
return /* @__PURE__ */ r(
|
|
22
|
+
L,
|
|
22
23
|
{
|
|
23
24
|
type: "button",
|
|
24
25
|
onClick: c(t, () => e(!1)),
|
|
25
26
|
...i
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
|
-
},
|
|
29
|
-
const { hasMore: n, loadMore: m, isLoading: d, sessions: _ } =
|
|
30
|
-
return
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
29
|
+
}, G = o("h2", { _id: "aiChatHistory__Title" }), b = o("div", { _id: "aiChatHistory__List" }), J = l(({ children: t, ...i }, e) => {
|
|
30
|
+
const { hasMore: n, loadMore: m, isLoading: d, sessions: _ } = s(), u = p(null), a = _.length > 0 && n;
|
|
31
|
+
return f(() => {
|
|
32
|
+
const h = u.current;
|
|
33
|
+
if (!h || !a) return;
|
|
34
|
+
const C = new IntersectionObserver(
|
|
34
35
|
(y) => {
|
|
35
36
|
y[0]?.isIntersecting && n && !d && m();
|
|
36
37
|
},
|
|
37
38
|
{ threshold: 0.1 }
|
|
38
39
|
);
|
|
39
|
-
return
|
|
40
|
-
}, [n, d, m, a]), /* @__PURE__ */ H(
|
|
40
|
+
return C.observe(h), () => C.disconnect();
|
|
41
|
+
}, [n, d, m, a]), /* @__PURE__ */ H(b, { ref: e, ...i, children: [
|
|
41
42
|
t,
|
|
42
|
-
a && /* @__PURE__ */
|
|
43
|
+
a && /* @__PURE__ */ r("div", { ref: u, "data-part": "sentinel", "aria-hidden": "true", style: { height: 1 } })
|
|
43
44
|
] });
|
|
44
|
-
}),
|
|
45
|
+
}), S = o("button", { _id: "aiChatHistory__Item" }), Q = v(
|
|
45
46
|
({ sessionId: t, onClick: i, ...e }) => {
|
|
46
|
-
const { loadSession: n } =
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
47
|
+
const { loadSession: n } = s();
|
|
48
|
+
return /* @__PURE__ */ r(
|
|
49
|
+
S,
|
|
49
50
|
{
|
|
50
51
|
type: "button",
|
|
51
52
|
onClick: c(i, () => n(t)),
|
|
@@ -53,21 +54,21 @@ const I = o("div", { _id: "aiChatHistory" }), j = (t) => {
|
|
|
53
54
|
}
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
|
-
),
|
|
57
|
-
const { sessions: i, isLoading: e } =
|
|
58
|
-
return i.length > 0 || e ? null : /* @__PURE__ */
|
|
59
|
-
},
|
|
60
|
-
const { isLoading: i } =
|
|
61
|
-
return i ? /* @__PURE__ */
|
|
62
|
-
},
|
|
57
|
+
), U = o("span", { _id: "aiChatHistory__ItemTitle" }), V = o("span", { _id: "aiChatHistory__ItemDate" }), w = o("div", { _id: "aiChatHistory__EmptyState" }), W = (t) => {
|
|
58
|
+
const { sessions: i, isLoading: e } = s();
|
|
59
|
+
return i.length > 0 || e ? null : /* @__PURE__ */ r(w, { ...t });
|
|
60
|
+
}, T = o("div", { _id: "aiChatHistory__LoadingState" }), X = (t) => {
|
|
61
|
+
const { isLoading: i } = s();
|
|
62
|
+
return i ? /* @__PURE__ */ r(T, { ...t }) : null;
|
|
63
|
+
}, Y = o("div", { _id: "aiChatHistory__Footer" }), E = o("button", {
|
|
63
64
|
_id: "aiChatHistory__NewConversationButton"
|
|
64
|
-
}),
|
|
65
|
+
}), Z = ({
|
|
65
66
|
onClick: t,
|
|
66
67
|
...i
|
|
67
68
|
}) => {
|
|
68
|
-
const { startNewConversation: e } =
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
|
|
69
|
+
const { startNewConversation: e } = s();
|
|
70
|
+
return /* @__PURE__ */ r(
|
|
71
|
+
E,
|
|
71
72
|
{
|
|
72
73
|
type: "button",
|
|
73
74
|
onClick: c(t, e),
|
|
@@ -76,30 +77,30 @@ const I = o("div", { _id: "aiChatHistory" }), j = (t) => {
|
|
|
76
77
|
);
|
|
77
78
|
};
|
|
78
79
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
80
|
+
z as BackButton,
|
|
81
|
+
q as BackButtonIcon,
|
|
82
|
+
z as ChatHistoryPrimitiveBackButton,
|
|
83
|
+
q as ChatHistoryPrimitiveBackButtonIcon,
|
|
84
|
+
W as ChatHistoryPrimitiveEmptyState,
|
|
85
|
+
Y as ChatHistoryPrimitiveFooter,
|
|
86
|
+
K as ChatHistoryPrimitiveHeader,
|
|
87
|
+
Q as ChatHistoryPrimitiveItem,
|
|
88
|
+
V as ChatHistoryPrimitiveItemDate,
|
|
89
|
+
U as ChatHistoryPrimitiveItemTitle,
|
|
90
|
+
J as ChatHistoryPrimitiveList,
|
|
91
|
+
X as ChatHistoryPrimitiveLoadingState,
|
|
92
|
+
Z as ChatHistoryPrimitiveNewConversationButton,
|
|
93
|
+
A as ChatHistoryPrimitiveRoot,
|
|
94
|
+
G as ChatHistoryPrimitiveTitle,
|
|
95
|
+
W as EmptyState,
|
|
96
|
+
Y as Footer,
|
|
97
|
+
K as Header,
|
|
98
|
+
Q as Item,
|
|
99
|
+
V as ItemDate,
|
|
100
|
+
U as ItemTitle,
|
|
101
|
+
J as List,
|
|
102
|
+
X as LoadingState,
|
|
103
|
+
Z as NewConversationButton,
|
|
104
|
+
A as Root,
|
|
105
|
+
G as Title
|
|
105
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.18",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
|
|
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
|
|
|
5
5
|
const a = d(void 0), P = ({ children: e }) => {
|
|
6
6
|
const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion: "0.15.
|
|
8
|
+
widgetLibraryVersion: "0.15.18",
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|