@inkeep/agents-ui 0.0.0-dev-20260408223123 → 0.0.0-dev-20260430182933
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/color-mode/index.js +4 -4
- package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +9 -0
- package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +2 -2
- package/dist/primitives/atoms/cmdk/index.cjs +1 -1
- package/dist/primitives/atoms/cmdk/index.js +14 -2
- package/dist/primitives/atoms/combobox.d.ts +104 -0
- package/dist/primitives/atoms/portal.js +3 -3
- package/dist/primitives/atoms/select.cjs +1 -1
- package/dist/primitives/atoms/select.js +2 -2
- package/dist/primitives/atoms/shadow/context.js +4 -4
- package/dist/primitives/components/embedded-chat/chat-error-helpers.cjs +3 -0
- package/dist/primitives/components/embedded-chat/chat-error-helpers.d.ts +26 -0
- package/dist/primitives/components/embedded-chat/chat-error-helpers.js +32 -0
- package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +1 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.js +119 -116
- package/dist/primitives/components/embedded-chat/image-preview-modal.js +3 -3
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -4
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +1 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +305 -278
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +1 -1
- package/dist/primitives/components/embedded-chat.cjs +3 -3
- package/dist/primitives/components/embedded-chat.d.ts +1 -2
- package/dist/primitives/components/embedded-chat.js +28 -28
- package/dist/primitives/components/embedded-search/search-provider.js +3 -3
- package/dist/primitives/components/embedded-search.cjs +1 -1
- package/dist/primitives/components/embedded-search.d.ts +1 -1
- package/dist/primitives/components/embedded-search.js +3 -3
- package/dist/primitives/components/modal/modal-provider.js +2 -2
- package/dist/primitives/components/modal.js +3 -3
- package/dist/primitives/components/sidebar-chat/index.js +1 -1
- package/dist/primitives/hooks/use-simple-scroll.cjs +1 -1
- package/dist/primitives/hooks/use-simple-scroll.d.ts +6 -0
- package/dist/primitives/hooks/use-simple-scroll.js +28 -28
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +22 -22
- package/dist/primitives/providers/chat-bubble-provider.js +1 -1
- package/dist/primitives/providers/chat-form-provider.d.ts +1 -1
- package/dist/primitives/providers/chat-form-provider.js +4 -4
- package/dist/primitives/providers/chat-history-provider.js +3 -3
- package/dist/primitives/providers/config-provider.js +3 -3
- package/dist/primitives/providers/feedback-provider.cjs +1 -1
- package/dist/primitives/providers/feedback-provider.js +30 -25
- package/dist/primitives/providers/form-field-provider.js +3 -3
- package/dist/primitives/providers/help-menu-provider.js +4 -4
- package/dist/primitives/providers/hover-popover-provider.js +3 -3
- package/dist/primitives/providers/image-preview-provider.js +5 -5
- package/dist/primitives/providers/markdown-provider.js +2 -2
- package/dist/primitives/providers/message-provider.js +1 -1
- package/dist/primitives/providers/sidebar-chat-provider.js +3 -3
- package/dist/primitives/providers/source-item-provider.js +3 -3
- package/dist/primitives/providers/widget-provider.js +2 -2
- package/dist/primitives/utils/default-settings.cjs +1 -1
- package/dist/primitives/utils/default-settings.d.ts +1 -0
- package/dist/primitives/utils/default-settings.js +6 -5
- package/dist/primitives/utils/misc.cjs +1 -1
- package/dist/primitives/utils/misc.js +2 -2
- package/dist/react/chat-button.js +1 -1
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +5 -5
- package/dist/react/embedded-search.cjs +1 -1
- package/dist/react/embedded-search.js +18 -18
- package/dist/styled/components/chat-bubble.js +4 -4
- package/dist/styled/components/chat-button.cjs +1 -1
- package/dist/styled/components/chat-button.js +9 -9
- package/dist/styled/components/chat-history.cjs +1 -1
- package/dist/styled/components/chat-history.js +22 -22
- package/dist/styled/components/embedded-chat/file-upload-input.cjs +1 -1
- package/dist/styled/components/embedded-chat/file-upload-input.js +71 -72
- package/dist/styled/components/embedded-chat/image-preview-modal.js +5 -5
- package/dist/styled/components/embedded-chat.cjs +1 -1
- package/dist/styled/components/embedded-chat.js +198 -198
- package/dist/styled/components/embedded-search.cjs +1 -1
- package/dist/styled/components/embedded-search.js +65 -65
- package/dist/styled/components/loading-indicator.cjs +1 -1
- package/dist/styled/components/loading-indicator.js +1 -1
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +93 -93
- package/dist/styled/components/modal.js +3 -3
- package/dist/styled/components/searchbar.js +8 -8
- package/dist/styled/components/sidebar-chat.cjs +1 -1
- package/dist/styled/components/sidebar-chat.js +5 -5
- package/dist/styled/inkeep.css.cjs +13 -3
- package/dist/styled/inkeep.css.js +13 -3
- package/dist/theme/utils/generate-theme-variables.js +6 -6
- package/dist/types/config/ai.d.ts +7 -0
- package/package.json +1 -1
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +0 -9
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +0 -0
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -0
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/shim/index.cjs +0 -0
- /package/dist/node_modules/.pnpm/{use-sync-external-store@1.5.0_react@19.0.0 → use-sync-external-store@1.6.0_react@19.3.0-canary-87ae75b3-20260128}/node_modules/use-sync-external-store/shim/index.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const o =
|
|
3
|
+
import { useContext as n, createContext as c } from "react";
|
|
4
|
+
const o = c(void 0), d = ({ children: t, modal: e }) => /* @__PURE__ */ r(o.Provider, { value: e, children: t }), i = () => n(o);
|
|
5
5
|
export {
|
|
6
6
|
d as ModalProvider,
|
|
7
7
|
i as useModal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import { Overlay as d, Root as s,
|
|
3
|
+
import { Overlay as d, Root as s, Close as m, Content as c } from "../atoms/dialog.js";
|
|
4
4
|
import { ikp as n } from "./factory.js";
|
|
5
5
|
import { CustomIcon as p } from "../atoms/icons/custom-icon.js";
|
|
6
6
|
import { useInkeepModal as C } from "./modal/use-inkeep-modal.js";
|
|
@@ -22,13 +22,13 @@ const O = n(s, {
|
|
|
22
22
|
) });
|
|
23
23
|
}, H = n(d, {
|
|
24
24
|
_id: "modal__Overlay"
|
|
25
|
-
}), y = n(
|
|
25
|
+
}), y = n(c, {
|
|
26
26
|
_id: "modal__Content",
|
|
27
27
|
"aria-describedby": void 0
|
|
28
28
|
}), K = (o) => {
|
|
29
29
|
const t = v("(max-width: 768px)");
|
|
30
30
|
return /* @__PURE__ */ e(y, { "data-mobile": _(t), tabIndex: -1, ...o });
|
|
31
|
-
}, b = n(
|
|
31
|
+
}, b = n(m, {
|
|
32
32
|
_id: "modal__Close",
|
|
33
33
|
children: /* @__PURE__ */ e(p, { iconKey: "close" })
|
|
34
34
|
}), Q = (o) => f() ? /* @__PURE__ */ e(b, { ...o }) : null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as n } from "react";
|
|
3
3
|
import { ikp as a } from "../factory.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useSidebarChat as m, useInkeepSidebarChat as p, SidebarChatProvider as c } from "../../providers/sidebar-chat-provider.js";
|
|
5
5
|
import { useSidebarChatResizer as h } from "./use-sidebar-chat-resizer.js";
|
|
6
6
|
import { Presence as u } from "../presence.js";
|
|
7
7
|
import { dataAttr as C } from "../../utils/misc.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),h=10;function T(f={}){const{isStreaming:r=!1,enabled:a=!0}=f,o=e.useRef(null),n=e.useRef(!0),s=e.useRef(!1),l=e.useRef(null),u=e.useCallback(()=>{const t=o.current;if(!t)return!0;const{scrollTop:c,scrollHeight:m,clientHeight:R}=t;return m-c-R<=h},[]),i=e.useCallback((t=!0)=>{const c=o.current;c&&(s.current||!n.current||c.scrollTo({top:c.scrollHeight,behavior:t?"smooth":"auto"}))},[]),S=e.useCallback(()=>{o.current&&(s.current=!0,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s.current=!1,r&&u()&&(n.current=!0)},150),r&&!u()&&(n.current=!1))},[r,u]);e.useEffect(()=>{if(!a||!r)return;const t=o.current;if(!t)return;const c=new MutationObserver(()=>{n.current&&!s.current&&r&&i(!1)});return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>c.disconnect()},[r,i,a]),e.useEffect(()=>{r&&(n.current=u())},[r,u]),e.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);const b=e.useCallback(()=>{n.current=!0},[]);return{containerRef:o,scrollToBottom:i,handleScroll:S,isAtBottom:u,enableAutoScroll:b,shouldAutoScroll:()=>n.current}}exports.useSimpleScroll=T;
|
|
@@ -5,6 +5,12 @@ export interface UseSimpleScrollOptions {
|
|
|
5
5
|
* When true, auto-scroll behavior is enabled.
|
|
6
6
|
*/
|
|
7
7
|
isStreaming?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether auto-scroll is enabled at all.
|
|
10
|
+
* When false, all auto-scroll behavior is disabled.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
enabled?: boolean;
|
|
8
14
|
}
|
|
9
15
|
export declare function useSimpleScroll(options?: UseSimpleScrollOptions): {
|
|
10
16
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRef as s, useCallback as i, useEffect as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const { isStreaming: r = !1 } =
|
|
6
|
-
const t = o.current;
|
|
7
|
-
if (!t) return !0;
|
|
8
|
-
const { scrollTop: e, scrollHeight: T, clientHeight: b } = t;
|
|
9
|
-
return T - e - b <= R;
|
|
10
|
-
}, []), f = i((t = !0) => {
|
|
2
|
+
import { useRef as s, useCallback as i, useEffect as f } from "react";
|
|
3
|
+
const d = 10;
|
|
4
|
+
function p(S = {}) {
|
|
5
|
+
const { isStreaming: r = !1, enabled: m = !0 } = S, o = s(null), n = s(!0), l = s(!1), u = s(null), c = i(() => {
|
|
11
6
|
const e = o.current;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
if (!e) return !0;
|
|
8
|
+
const { scrollTop: t, scrollHeight: T, clientHeight: R } = e;
|
|
9
|
+
return T - t - R <= d;
|
|
10
|
+
}, []), a = i((e = !0) => {
|
|
11
|
+
const t = o.current;
|
|
12
|
+
t && (l.current || !n.current || t.scrollTo({
|
|
13
|
+
top: t.scrollHeight,
|
|
14
|
+
behavior: e ? "smooth" : "auto"
|
|
15
15
|
}));
|
|
16
|
-
}, []),
|
|
16
|
+
}, []), h = i(() => {
|
|
17
17
|
o.current && (l.current = !0, u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
18
18
|
l.current = !1, r && c() && (n.current = !0);
|
|
19
19
|
}, 150), r && !c() && (n.current = !1));
|
|
20
20
|
}, [r, c]);
|
|
21
|
-
|
|
22
|
-
if (!r)
|
|
21
|
+
f(() => {
|
|
22
|
+
if (!m || !r)
|
|
23
23
|
return;
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
const
|
|
27
|
-
n.current && !l.current && r &&
|
|
24
|
+
const e = o.current;
|
|
25
|
+
if (!e) return;
|
|
26
|
+
const t = new MutationObserver(() => {
|
|
27
|
+
n.current && !l.current && r && a(!1);
|
|
28
28
|
});
|
|
29
|
-
return
|
|
29
|
+
return t.observe(e, {
|
|
30
30
|
childList: !0,
|
|
31
31
|
subtree: !0,
|
|
32
32
|
characterData: !0
|
|
33
|
-
}), () =>
|
|
34
|
-
}, [r,
|
|
33
|
+
}), () => t.disconnect();
|
|
34
|
+
}, [r, a, m]), f(() => {
|
|
35
35
|
r && (n.current = c());
|
|
36
|
-
}, [r, c]),
|
|
36
|
+
}, [r, c]), f(() => () => {
|
|
37
37
|
u.current && clearTimeout(u.current);
|
|
38
38
|
}, []);
|
|
39
|
-
const
|
|
39
|
+
const b = i(() => {
|
|
40
40
|
n.current = !0;
|
|
41
41
|
}, []);
|
|
42
42
|
return {
|
|
43
43
|
containerRef: o,
|
|
44
|
-
scrollToBottom:
|
|
45
|
-
handleScroll:
|
|
44
|
+
scrollToBottom: a,
|
|
45
|
+
handleScroll: h,
|
|
46
46
|
isAtBottom: c,
|
|
47
|
-
enableAutoScroll:
|
|
47
|
+
enableAutoScroll: b,
|
|
48
48
|
/** Whether auto-scroll is currently active (not hijacked by user) */
|
|
49
49
|
shouldAutoScroll: () => n.current
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
export {
|
|
53
|
-
|
|
53
|
+
p as useSimpleScroll
|
|
54
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),p=require("./config-provider.cjs"),u=t.createContext(void 0),g=({children:e})=>{const{baseSettings:s,componentType:n}=p.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i="0.16.1",c=t.useMemo(()=>({widgetLibraryVersion:i,componentType:n,tags:o}),[n,o,i]),v={logEvent:t.useCallback(async a=>{const d={...c,...a.properties,...r},E={eventName:a.eventName,properties:d};return s.onEvent?.(E)},[s,c,r])};return l.jsx(u.Provider,{value:v,children:e})},m=()=>{const e=t.useContext(u);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=g;exports.useBaseEvents=m;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
const
|
|
6
|
-
const { baseSettings: t, componentType: o } =
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as E, useCallback as d, useContext as l, createContext as g } from "react";
|
|
4
|
+
import { useInkeepConfig as x } from "./config-provider.js";
|
|
5
|
+
const c = g(void 0), b = ({ children: e }) => {
|
|
6
|
+
const { baseSettings: t, componentType: o } = x(), { tags: s, analyticsProperties: n } = t, r = "0.16.1", i = E(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion:
|
|
8
|
+
widgetLibraryVersion: r,
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|
|
12
|
-
[o, s]
|
|
13
|
-
),
|
|
14
|
-
async (
|
|
15
|
-
const
|
|
16
|
-
...
|
|
17
|
-
...
|
|
12
|
+
[o, s, r]
|
|
13
|
+
), v = { logEvent: d(
|
|
14
|
+
async (a) => {
|
|
15
|
+
const m = {
|
|
16
|
+
...i,
|
|
17
|
+
...a.properties,
|
|
18
18
|
...n
|
|
19
|
-
},
|
|
20
|
-
eventName:
|
|
21
|
-
properties:
|
|
19
|
+
}, p = {
|
|
20
|
+
eventName: a.eventName,
|
|
21
|
+
properties: m
|
|
22
22
|
};
|
|
23
|
-
return t.onEvent?.(
|
|
23
|
+
return t.onEvent?.(p);
|
|
24
24
|
},
|
|
25
|
-
[t,
|
|
25
|
+
[t, i, n]
|
|
26
26
|
) };
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
},
|
|
29
|
-
const e = l(
|
|
27
|
+
return /* @__PURE__ */ u(c.Provider, { value: v, children: e });
|
|
28
|
+
}, w = () => {
|
|
29
|
+
const e = l(c);
|
|
30
30
|
if (!e)
|
|
31
31
|
throw new Error("useBaseEvents must be used within a BaseEventsProvider");
|
|
32
32
|
return e;
|
|
33
33
|
};
|
|
34
34
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
b as BaseEventsProvider,
|
|
36
|
+
w as useBaseEvents
|
|
37
37
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext as o, createContext as u } from "react";
|
|
4
4
|
import { useInkeepOpenState as b } from "../hooks/use-inkeep-open-state.js";
|
|
5
5
|
const t = u(void 0), i = ({ children: e, value: r }) => /* @__PURE__ */ n(t.Provider, { value: r, children: e }), h = () => {
|
|
6
6
|
const e = o(t);
|
|
@@ -17,7 +17,7 @@ export declare function useChatFormState(): {
|
|
|
17
17
|
}> | undefined;
|
|
18
18
|
getFields: (conversationId?: string) => FormField[];
|
|
19
19
|
errors: FieldErrors<Record<string, any>>;
|
|
20
|
-
control: Control<Record<string, any>, any
|
|
20
|
+
control: Control<Record<string, any>, any, Record<string, any>>;
|
|
21
21
|
defaultValues: Record<string, any>;
|
|
22
22
|
};
|
|
23
23
|
export declare const ChatFormProvider: React.FC<{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as N } from "react/jsx-runtime";
|
|
3
|
-
import { useState as d, useCallback as a, useMemo as v, useEffect as
|
|
3
|
+
import { useContext as P, useState as d, useCallback as a, useMemo as v, useEffect as T, createContext as k } from "react";
|
|
4
4
|
import { useForm as G } from "react-hook-form";
|
|
5
5
|
import { useModal as W } from "../components/modal/modal-provider.js";
|
|
6
6
|
import { getFormDefaultValues as j } from "../utils/form.js";
|
|
7
7
|
import { useBaseEvents as A } from "./base-events-provider.js";
|
|
8
|
-
const B = "root.serverError", y =
|
|
8
|
+
const B = "root.serverError", y = k(void 0);
|
|
9
9
|
function D() {
|
|
10
10
|
const [e, c] = d(null), [u, f] = d(null), [w, p] = d(!1), h = W(), { logEvent: b } = A(), x = a(
|
|
11
11
|
(o, t) => {
|
|
@@ -37,7 +37,7 @@ function D() {
|
|
|
37
37
|
} = G({
|
|
38
38
|
defaultValues: n
|
|
39
39
|
});
|
|
40
|
-
|
|
40
|
+
T(() => {
|
|
41
41
|
n && E(n);
|
|
42
42
|
}, [E, n]);
|
|
43
43
|
const F = a(
|
|
@@ -97,7 +97,7 @@ const U = ({ children: e }) => {
|
|
|
97
97
|
const c = D();
|
|
98
98
|
return /* @__PURE__ */ N(y.Provider, { value: c, children: e });
|
|
99
99
|
}, X = () => {
|
|
100
|
-
const e =
|
|
100
|
+
const e = P(y);
|
|
101
101
|
if (!e)
|
|
102
102
|
throw new Error("useChatForm must be used within a ChatFormProvider");
|
|
103
103
|
return e;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as se } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext as re, useState as h, useRef as c, useEffect as H, useCallback as S, createContext as oe } from "react";
|
|
4
4
|
import { useChat as ie } from "../components/embedded-chat/chat-provider.js";
|
|
5
5
|
import { useInkeepConfig as ae } from "./config-provider.js";
|
|
6
6
|
import { useInkeepApiClient as ce } from "../hooks/use-inkeep-api-client.js";
|
|
7
|
-
const z =
|
|
7
|
+
const z = oe(void 0), q = 25;
|
|
8
8
|
function ue(e) {
|
|
9
9
|
const {
|
|
10
10
|
stop: u,
|
|
@@ -99,7 +99,7 @@ const ge = ({ layout: e, children: u }) => {
|
|
|
99
99
|
const f = ue(e);
|
|
100
100
|
return /* @__PURE__ */ se(z.Provider, { value: f, children: typeof u == "function" ? u(f) : u });
|
|
101
101
|
}, ve = () => {
|
|
102
|
-
const e =
|
|
102
|
+
const e = re(z);
|
|
103
103
|
if (!e)
|
|
104
104
|
throw new Error("useChatHistory must be used within a ChatHistoryProvider");
|
|
105
105
|
return e;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as C } from "react/jsx-runtime";
|
|
3
3
|
import { mergeAndCompare as g } from "merge-anything";
|
|
4
|
-
import { useMemo as m,
|
|
4
|
+
import { useMemo as m, useContext as S, createContext as u } from "react";
|
|
5
5
|
import { defaultInkeepSearchSettings as f, defaultInkeepBaseSettings as p, defaultInkeepAIChatSettings as b } from "../utils/default-settings.js";
|
|
6
6
|
import { useShadow as l } from "../atoms/shadow/context.js";
|
|
7
7
|
const I = {
|
|
@@ -19,7 +19,7 @@ const I = {
|
|
|
19
19
|
baseSettings: p,
|
|
20
20
|
searchSettings: f,
|
|
21
21
|
componentType: I.EmbeddedChat
|
|
22
|
-
}, o =
|
|
22
|
+
}, o = u(a), A = ({ children: t, value: n }) => {
|
|
23
23
|
const i = l(), s = (e, r, h) => ["baseSettings", "searchSettings", "aiChatSettings"].includes(h) && !r ? e : r, d = {
|
|
24
24
|
baseSettings: i ?? {}
|
|
25
25
|
}, c = m(() => {
|
|
@@ -28,7 +28,7 @@ const I = {
|
|
|
28
28
|
}, [n]);
|
|
29
29
|
return /* @__PURE__ */ C(o.Provider, { value: c, children: t });
|
|
30
30
|
}, T = () => {
|
|
31
|
-
const t =
|
|
31
|
+
const t = S(o);
|
|
32
32
|
if (!t)
|
|
33
33
|
throw new Error("useInkeepConfig must be used within a ConfigProvider");
|
|
34
34
|
return t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),a=require("react"),T=require("../components/embedded-chat/chat-provider.cjs"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react/jsx-runtime"),a=require("react"),T=require("../components/embedded-chat/chat-provider.cjs"),F=require("../utils/misc.cjs"),A=require("./config-provider.cjs"),E=require("./base-events-provider.cjs"),j=require("../hooks/use-feedback-api.cjs"),l=a.createContext(void 0);function y(){const{baseSettings:t,aiChatSettings:c}=A.useInkeepConfig(),[p,g]=a.useState(null),[f,C]=a.useState({}),{conversationId:o,messages:r,authToken:m,getCaptchaHeader:h,invalidateCaptcha:P,refreshSession:q}=T.useChat(),{analyticsProperties:d}=t,{logEvent:b}=E.useBaseEvents(),{submitFeedback:k}=j.useFeedbackApi({baseUrl:c.baseUrl,appId:c.appId,authToken:m,getCaptchaHeader:h,invalidateCaptcha:P,refreshSession:q}),i=a.useCallback(async(e,s,u)=>{C(n=>({...n,[e]:{type:s,messageId:e,details:u}})),t.onFeedback?t.onFeedback({type:s,messageId:e,details:u,properties:d}).catch(n=>console.warn("[feedback] onFeedback error:",n)):k({conversationId:o,messageId:e,type:s,details:u}).catch(n=>console.warn("[feedback] submitFeedbackToApi error:",n));const v=r.findIndex(n=>n.id===e),x=r[v],S={conversationId:o,question:F.getMessageContent(r[v-1]),answer:F.getMessageContent(x),messageId:e,details:u};b({eventName:s==="positive"?"assistant_positive_feedback_submitted":"assistant_negative_feedback_submitted",properties:S}),s==="negative"&&b({eventName:"user_escalation_indicated",properties:{escalationType:"downvote",conversationId:o}})},[r,o,d,t,b,k]),_=a.useCallback(async e=>{i(e,"positive")},[i]),w=a.useCallback(async(e,s)=>{i(e,"negative",s)},[i]);return{feedback:f,currentFeedback:p,setCurrentFeedback:g,submitPositiveFeedback:_,submitNegativeFeedback:w}}const N=({children:t})=>{const c=y();return M.jsx(l.Provider,{value:c,children:t})},R=()=>{const t=a.useContext(l);if(!t)throw new Error("useFeedback must be used within a FeedbackProvider");return t};exports.FeedbackProvider=N;exports.useMessageFeedback=R;
|
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as E } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext as N, useState as m, useCallback as d, createContext as M } from "react";
|
|
4
4
|
import { useChat as U } from "../components/embedded-chat/chat-provider.js";
|
|
5
|
-
import { getMessageContent as
|
|
5
|
+
import { getMessageContent as v } from "../utils/misc.js";
|
|
6
6
|
import { useInkeepConfig as j } from "./config-provider.js";
|
|
7
7
|
import { useBaseEvents as q } from "./base-events-provider.js";
|
|
8
8
|
import { useFeedbackApi as y } from "../hooks/use-feedback-api.js";
|
|
9
|
-
const
|
|
9
|
+
const f = M(void 0);
|
|
10
10
|
function B() {
|
|
11
|
-
const { baseSettings: t, aiChatSettings: n } = j(), [
|
|
11
|
+
const { baseSettings: t, aiChatSettings: n } = j(), [F, l] = m(null), [C, g] = m({}), {
|
|
12
|
+
conversationId: a,
|
|
13
|
+
messages: c,
|
|
14
|
+
authToken: h,
|
|
15
|
+
getCaptchaHeader: _,
|
|
16
|
+
invalidateCaptcha: w,
|
|
17
|
+
refreshSession: x
|
|
18
|
+
} = U(), { analyticsProperties: u } = t, { logEvent: b } = q(), { submitFeedback: k } = y({
|
|
12
19
|
baseUrl: n.baseUrl,
|
|
13
20
|
appId: n.appId,
|
|
14
|
-
authToken:
|
|
15
|
-
getCaptchaHeader:
|
|
16
|
-
invalidateCaptcha:
|
|
17
|
-
refreshSession:
|
|
18
|
-
}), r =
|
|
21
|
+
authToken: h,
|
|
22
|
+
getCaptchaHeader: _,
|
|
23
|
+
invalidateCaptcha: w,
|
|
24
|
+
refreshSession: x
|
|
25
|
+
}), r = d(
|
|
19
26
|
async (e, s, i) => {
|
|
20
|
-
|
|
21
|
-
(o) => console.warn("[feedback] onFeedback error:", o)
|
|
22
|
-
) : x({ conversationId: a, messageId: e, type: s, details: i }).catch(
|
|
27
|
+
g((o) => ({ ...o, [e]: { type: s, messageId: e, details: i } })), t.onFeedback ? t.onFeedback({ type: s, messageId: e, details: i, properties: u }).catch((o) => console.warn("[feedback] onFeedback error:", o)) : k({ conversationId: a, messageId: e, type: s, details: i }).catch(
|
|
23
28
|
(o) => console.warn("[feedback] submitFeedbackToApi error:", o)
|
|
24
29
|
);
|
|
25
|
-
const
|
|
30
|
+
const p = c.findIndex((o) => o.id === e), T = c[p], A = {
|
|
26
31
|
conversationId: a,
|
|
27
|
-
question:
|
|
28
|
-
answer:
|
|
32
|
+
question: v(c[p - 1]),
|
|
33
|
+
answer: v(T),
|
|
29
34
|
messageId: e,
|
|
30
35
|
details: i
|
|
31
36
|
};
|
|
32
|
-
|
|
37
|
+
b({
|
|
33
38
|
eventName: s === "positive" ? "assistant_positive_feedback_submitted" : "assistant_negative_feedback_submitted",
|
|
34
39
|
properties: A
|
|
35
|
-
}), s === "negative" &&
|
|
40
|
+
}), s === "negative" && b({
|
|
36
41
|
eventName: "user_escalation_indicated",
|
|
37
42
|
properties: {
|
|
38
43
|
escalationType: "downvote",
|
|
@@ -40,31 +45,31 @@ function B() {
|
|
|
40
45
|
}
|
|
41
46
|
});
|
|
42
47
|
},
|
|
43
|
-
[c, a]
|
|
44
|
-
), P =
|
|
48
|
+
[c, a, u, t, b, k]
|
|
49
|
+
), P = d(
|
|
45
50
|
async (e) => {
|
|
46
51
|
r(e, "positive");
|
|
47
52
|
},
|
|
48
53
|
[r]
|
|
49
|
-
), S =
|
|
54
|
+
), S = d(
|
|
50
55
|
async (e, s) => {
|
|
51
56
|
r(e, "negative", s);
|
|
52
57
|
},
|
|
53
58
|
[r]
|
|
54
59
|
);
|
|
55
60
|
return {
|
|
56
|
-
feedback:
|
|
57
|
-
currentFeedback:
|
|
58
|
-
setCurrentFeedback:
|
|
61
|
+
feedback: C,
|
|
62
|
+
currentFeedback: F,
|
|
63
|
+
setCurrentFeedback: l,
|
|
59
64
|
submitPositiveFeedback: P,
|
|
60
65
|
submitNegativeFeedback: S
|
|
61
66
|
};
|
|
62
67
|
}
|
|
63
68
|
const L = ({ children: t }) => {
|
|
64
69
|
const n = B();
|
|
65
|
-
return /* @__PURE__ */ E(
|
|
70
|
+
return /* @__PURE__ */ E(f.Provider, { value: n, children: t });
|
|
66
71
|
}, O = () => {
|
|
67
|
-
const t =
|
|
72
|
+
const t = N(f);
|
|
68
73
|
if (!t)
|
|
69
74
|
throw new Error("useFeedback must be used within a FeedbackProvider");
|
|
70
75
|
return t;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as m } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext as F, createContext as u } from "react";
|
|
4
4
|
import { useChatForm as c } from "./chat-form-provider.js";
|
|
5
|
-
const e =
|
|
5
|
+
const e = u(void 0), a = ({ children: r, field: o, fieldProps: t, autoFocus: n }) => {
|
|
6
6
|
const { errors: i } = c(), s = i[o.name];
|
|
7
7
|
return /* @__PURE__ */ m(e.Provider, { value: { field: o, fieldProps: t, error: s, autoFocus: n }, children: r });
|
|
8
8
|
}, v = () => {
|
|
9
|
-
const r =
|
|
9
|
+
const r = F(e);
|
|
10
10
|
if (!r)
|
|
11
11
|
throw new Error("useFormField must be used within a FormFieldProvider");
|
|
12
12
|
return r;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const n =
|
|
3
|
+
import { useContext as r, useState as u, createContext as s } from "react";
|
|
4
|
+
const n = s(void 0);
|
|
5
5
|
function c() {
|
|
6
|
-
const [e, t] =
|
|
6
|
+
const [e, t] = u(!1);
|
|
7
7
|
return { open: e, setOpen: t };
|
|
8
8
|
}
|
|
9
9
|
const l = ({ children: e, value: t }) => /* @__PURE__ */ o(n.Provider, { value: t, children: e }), x = () => {
|
|
10
|
-
const e =
|
|
10
|
+
const e = r(n);
|
|
11
11
|
if (!e)
|
|
12
12
|
throw new Error("useHelpMenu must be used within a HelpMenuProvider");
|
|
13
13
|
return e;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as v } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const e =
|
|
5
|
-
const o =
|
|
3
|
+
import { useContext as n, createContext as s } from "react";
|
|
4
|
+
const e = s(void 0), p = ({ children: o, open: r, setOpen: t }) => /* @__PURE__ */ v(e.Provider, { value: { open: r, setOpen: t }, children: o }), P = () => {
|
|
5
|
+
const o = n(e);
|
|
6
6
|
if (!o)
|
|
7
7
|
throw new Error("useHoverPopover must be used within a HoverPopoverProvider");
|
|
8
8
|
return o;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const s =
|
|
5
|
-
const [r, t] =
|
|
3
|
+
import { useContext as v, useState as c, useCallback as i, useMemo as w, createContext as P } from "react";
|
|
4
|
+
const s = P(void 0), I = ({ children: e }) => {
|
|
5
|
+
const [r, t] = c(null), o = i((m) => {
|
|
6
6
|
t(m);
|
|
7
7
|
}, []), n = i(() => {
|
|
8
8
|
t(null);
|
|
9
|
-
}, []), a =
|
|
9
|
+
}, []), a = w(
|
|
10
10
|
() => ({ imagePreview: r, openImagePreview: o, closeImagePreview: n }),
|
|
11
11
|
[r, o, n]
|
|
12
12
|
);
|
|
13
13
|
return /* @__PURE__ */ u(s.Provider, { value: a, children: e });
|
|
14
14
|
}, x = () => {
|
|
15
|
-
const e =
|
|
15
|
+
const e = v(s);
|
|
16
16
|
if (!e)
|
|
17
17
|
throw new Error("useImagePreview must be used within an ImagePreviewProvider");
|
|
18
18
|
return e;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const o =
|
|
3
|
+
import { useContext as n, createContext as a } from "react";
|
|
4
|
+
const o = a(void 0), x = ({ children: t, componentStyles: e }) => /* @__PURE__ */ r(o.Provider, { value: { componentStyles: e }, children: t }), d = () => n(o);
|
|
5
5
|
export {
|
|
6
6
|
x as ChatMarkdownProvider,
|
|
7
7
|
d as useChatMarkdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext as s, createContext as n } from "react";
|
|
4
4
|
const t = n(void 0), u = ({ children: e, message: o }) => /* @__PURE__ */ r(t.Provider, { value: { message: o }, children: e }), a = () => {
|
|
5
5
|
const e = s(t);
|
|
6
6
|
if (!e)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useState as b, useContext as s, createContext as p } from "react";
|
|
4
4
|
import { useInkeepOpenState as S } from "../hooks/use-inkeep-open-state.js";
|
|
5
|
-
const r =
|
|
5
|
+
const r = p(void 0), v = ({ children: t, value: e }) => /* @__PURE__ */ C(r.Provider, { value: e, children: t }), g = () => {
|
|
6
6
|
const t = s(r);
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error("useSidebarChat must be used within a SidebarChatProvider");
|
|
@@ -17,7 +17,7 @@ const r = b(void 0), v = ({ children: t, value: e }) => /* @__PURE__ */ C(r.Prov
|
|
|
17
17
|
const { autoCloseThreshold: i = 0.7 } = n ?? {}, { isOpen: c, setOpen: d } = S(n, {
|
|
18
18
|
eventNamePrefix: "sidebar_chat",
|
|
19
19
|
defaultTriggerSelector: "[data-inkeep-sidebar-chat-trigger]"
|
|
20
|
-
}), [h, u] =
|
|
20
|
+
}), [h, u] = b(Math.min(a, Math.floor((e + o) / 2)));
|
|
21
21
|
return {
|
|
22
22
|
width: h,
|
|
23
23
|
setWidth: u,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const t =
|
|
5
|
-
const e =
|
|
3
|
+
import { useContext as u, createContext as n } from "react";
|
|
4
|
+
const t = n(void 0), i = ({ children: e, source: r }) => /* @__PURE__ */ o(t.Provider, { value: { source: r }, children: e }), m = () => {
|
|
5
|
+
const e = u(t);
|
|
6
6
|
if (!e)
|
|
7
7
|
throw new Error("useSourceItem must be used within a SourceItemProvider");
|
|
8
8
|
return e;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
const e =
|
|
3
|
+
import { useContext as n, createContext as i } from "react";
|
|
4
|
+
const e = i(void 0), x = ({ children: t, widget: o }) => /* @__PURE__ */ r(e.Provider, { value: o, children: t }), d = () => n(e);
|
|
5
5
|
export {
|
|
6
6
|
x as WidgetProvider,
|
|
7
7
|
d as useWidget
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../theme/index.cjs"),t=require("../../theme/colors.cjs"),s={baseUrl:"https://api.agents.inkeep.com",placeholder:"How do I get started?",aiAssistantName:void 0,shouldOpenLinksInNewTab:!0,disclaimerSettings:{isEnabled:!1,label:"Usage policy"},isShareButtonVisible:!1,isViewOnly:!1,isChatHistoryButtonVisible:!0,exampleQuestionsLabel:"Example questions",exampleQuestions:[],isFirstExampleQuestionHighlighted:!0,isCopyChatButtonVisible:!1,getHelpOptions:[],toolbarButtonLabels:{clear:"Clear",share:"Share",getHelp:"Get help",stop:"Stop",copyChat:"Copy"},context:{}},a={shouldBypassCaptcha:!1,tags:[],userProperties:{},primaryBrandColor:t.DEFAULT_PRIMARY_BRAND_COLOR,theme:{varsClassName:"inkeep-widget-vars",...e.theme}},
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../theme/index.cjs"),t=require("../../theme/colors.cjs"),s={baseUrl:"https://api.agents.inkeep.com",placeholder:"How do I get started?",aiAssistantName:void 0,shouldOpenLinksInNewTab:!0,disclaimerSettings:{isEnabled:!1,label:"Usage policy"},isShareButtonVisible:!1,isViewOnly:!1,isChatHistoryButtonVisible:!0,exampleQuestionsLabel:"Example questions",exampleQuestions:[],isFirstExampleQuestionHighlighted:!0,isCopyChatButtonVisible:!1,getHelpOptions:[],toolbarButtonLabels:{clear:"Clear",share:"Share",getHelp:"Get help",stop:"Stop",copyChat:"Copy"},context:{},shouldAutoScroll:!0},a={shouldBypassCaptcha:!1,tags:[],userProperties:{},primaryBrandColor:t.DEFAULT_PRIMARY_BRAND_COLOR,theme:{varsClassName:"inkeep-widget-vars",...e.theme}},l={shouldOpenLinksInNewTab:!1,defaultQuery:"",debounceTimeMs:0,tabs:["All","Publications","PDFs","GitHub","Forums","Discord","Slack","StackOverflow"],placeholder:"Search for anything...",view:"single-pane"};exports.defaultInkeepAIChatSettings=s;exports.defaultInkeepBaseSettings=a;exports.defaultInkeepSearchSettings=l;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { theme as e } from "../../theme/index.js";
|
|
3
3
|
import { DEFAULT_PRIMARY_BRAND_COLOR as t } from "../../theme/colors.js";
|
|
4
|
-
const
|
|
4
|
+
const l = {
|
|
5
5
|
baseUrl: "https://api.agents.inkeep.com",
|
|
6
6
|
placeholder: "How do I get started?",
|
|
7
7
|
aiAssistantName: void 0,
|
|
@@ -25,8 +25,9 @@ const i = {
|
|
|
25
25
|
stop: "Stop",
|
|
26
26
|
copyChat: "Copy"
|
|
27
27
|
},
|
|
28
|
-
context: {}
|
|
29
|
-
|
|
28
|
+
context: {},
|
|
29
|
+
shouldAutoScroll: !0
|
|
30
|
+
}, i = {
|
|
30
31
|
shouldBypassCaptcha: !1,
|
|
31
32
|
tags: [],
|
|
32
33
|
userProperties: {},
|
|
@@ -44,7 +45,7 @@ const i = {
|
|
|
44
45
|
view: "single-pane"
|
|
45
46
|
};
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
l as defaultInkeepAIChatSettings,
|
|
49
|
+
i as defaultInkeepBaseSettings,
|
|
49
50
|
o as defaultInkeepSearchSettings
|
|
50
51
|
};
|