@inkeep/agents-ui 0.15.30 → 0.16.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/color-mode/index.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +74 -73
- 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/markdown/index.cjs +1 -1
- package/dist/primitives/atoms/markdown/index.js +41 -39
- 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 +697 -701
- 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 +7 -0
- package/dist/primitives/hooks/use-simple-scroll.js +33 -30
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +55 -54
- 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.js +3 -3
- 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 +5 -1
- package/dist/primitives/utils/misc.d.ts +2 -1
- package/dist/primitives/utils/misc.js +47 -22
- package/dist/react/chat-button.js +1 -1
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +6 -6
- package/dist/react/embedded-search.cjs +1 -1
- package/dist/react/embedded-search.js +18 -18
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +74 -73
- 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 +106 -108
- 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/index.cjs +1 -1
- package/dist/styled/index.js +60 -59
- 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,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,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as E } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useContext as N, useState as k, useCallback as b, createContext as M } from "react";
|
|
4
4
|
import { useChat as U } from "../components/embedded-chat/chat-provider.js";
|
|
5
5
|
import { getMessageContent as p } 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 m =
|
|
9
|
+
const m = M(void 0);
|
|
10
10
|
function B() {
|
|
11
11
|
const { baseSettings: t, aiChatSettings: n } = j(), [v, f] = k(null), [F, l] = k({}), { conversationId: a, messages: c, authToken: C, getCaptchaHeader: g, invalidateCaptcha: h, refreshSession: _ } = U(), { analyticsProperties: w } = t, { logEvent: d } = q(), { submitFeedback: x } = y({
|
|
12
12
|
baseUrl: n.baseUrl,
|
|
@@ -64,7 +64,7 @@ const L = ({ children: t }) => {
|
|
|
64
64
|
const n = B();
|
|
65
65
|
return /* @__PURE__ */ E(m.Provider, { value: n, children: t });
|
|
66
66
|
}, O = () => {
|
|
67
|
-
const t =
|
|
67
|
+
const t = N(m);
|
|
68
68
|
if (!t)
|
|
69
69
|
throw new Error("useFeedback must be used within a FeedbackProvider");
|
|
70
70
|
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
|
};
|
|
@@ -1 +1,5 @@
|
|
|
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 u=((...t)=>(...n)=>{for(const a of t)a?.(...n)}),l=t=>typeof t=="string";function f(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").replace(/__/g,"__").toLowerCase()}const g=t=>t?"":void 0;function d(t){const n=t.split(" "),a=n[0]??"",o=n.length>1?n[n.length-1]:"";return a&&o?`${a.charAt(0)}${o.charAt(0)}`:a.charAt(0)}function m(t,n){return typeof t=="function"?t(n):t}function i(t){return t.type==="data-artifact"&&t.data?.type?.toLowerCase()==="citation"}const y=t=>{const n=e=>e.data?.artifactSummary?.title||e.data?.name||"Source",a=t.parts?.map(e=>{if(e.type==="text")return e.text;if(e.type==="data-component")return JSON.stringify(e.data);if(i(e)){const r=e.data?.artifactSummary?.url;return r?`[${n(e)}](${r})`:null}return null}).join("")??"",o=new Set,s=t.parts?.filter(i).filter(e=>{const r=e.data?.artifactSummary?.url;return!r||o.has(r)?!1:(o.add(r),!0)})??[];if(!s.length)return a;const c=`
|
|
2
|
+
|
|
3
|
+
**Sources:**
|
|
4
|
+
`+s.map(e=>{const r=e.data?.artifactSummary?.url;return`- [${n(e)}](${r})`}).join(`
|
|
5
|
+
`);return a+c};exports.callAll=u;exports.dataAttr=g;exports.getInitials=d;exports.getMessageContent=y;exports.isCitationArtifact=i;exports.isString=l;exports.maybeRender=m;exports.toKebabCase=f;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Message } from '../../types/index.ts';
|
|
1
|
+
import { ArtifactPart, Message } from '../../types/index.ts';
|
|
2
2
|
export declare const callAll: <T extends (...a: any[]) => void>(...fns: (T | undefined)[]) => (...a: Parameters<T>) => void;
|
|
3
3
|
export declare const isString: (v: any) => v is string;
|
|
4
4
|
/**
|
|
@@ -9,4 +9,5 @@ export type Booleanish = boolean | 'true' | 'false';
|
|
|
9
9
|
export declare const dataAttr: (guard: boolean | undefined) => Booleanish;
|
|
10
10
|
export declare function getInitials(name: string): string;
|
|
11
11
|
export declare function maybeRender<T>(children: ((param: T) => React.ReactNode) | React.ReactNode, param: T): React.ReactNode;
|
|
12
|
+
export declare function isCitationArtifact(part: Message['parts'][number]): part is ArtifactPart;
|
|
12
13
|
export declare const getMessageContent: (message: Message) => string;
|
|
@@ -1,31 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const
|
|
2
|
+
const c = (
|
|
3
3
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
4
|
-
(...t) => (...e) => {
|
|
5
|
-
for (const
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
),
|
|
9
|
-
function
|
|
4
|
+
((...t) => (...e) => {
|
|
5
|
+
for (const r of t)
|
|
6
|
+
r?.(...e);
|
|
7
|
+
})
|
|
8
|
+
), l = (t) => typeof t == "string";
|
|
9
|
+
function f(t) {
|
|
10
10
|
return t.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").replace(/__/g, "__").toLowerCase();
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
const e = t.split(" "),
|
|
15
|
-
return
|
|
12
|
+
const m = (t) => t ? "" : void 0;
|
|
13
|
+
function d(t) {
|
|
14
|
+
const e = t.split(" "), r = e[0] ?? "", o = e.length > 1 ? e[e.length - 1] : "";
|
|
15
|
+
return r && o ? `${r.charAt(0)}${o.charAt(0)}` : r.charAt(0);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function y(t, e) {
|
|
18
18
|
return typeof t == "function" ? t(e) : t;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
function s(t) {
|
|
21
|
+
return t.type === "data-artifact" && t.data?.type?.toLowerCase() === "citation";
|
|
22
|
+
}
|
|
23
|
+
const g = (t) => {
|
|
24
|
+
const e = (n) => n.data?.artifactSummary?.title || n.data?.name || "Source", r = t.parts?.map((n) => {
|
|
25
|
+
if (n.type === "text") return n.text;
|
|
26
|
+
if (n.type === "data-component") return JSON.stringify(n.data);
|
|
27
|
+
if (s(n)) {
|
|
28
|
+
const a = n.data?.artifactSummary?.url;
|
|
29
|
+
return a ? `[${e(n)}](${a})` : null;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}).join("") ?? "", o = /* @__PURE__ */ new Set(), i = t.parts?.filter(s).filter((n) => {
|
|
33
|
+
const a = n.data?.artifactSummary?.url;
|
|
34
|
+
return !a || o.has(a) ? !1 : (o.add(a), !0);
|
|
35
|
+
}) ?? [];
|
|
36
|
+
if (!i.length) return r;
|
|
37
|
+
const u = `
|
|
38
|
+
|
|
39
|
+
**Sources:**
|
|
40
|
+
` + i.map((n) => {
|
|
41
|
+
const a = n.data?.artifactSummary?.url;
|
|
42
|
+
return `- [${e(n)}](${a})`;
|
|
43
|
+
}).join(`
|
|
44
|
+
`);
|
|
45
|
+
return r + u;
|
|
46
|
+
};
|
|
23
47
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
s as
|
|
29
|
-
l as
|
|
30
|
-
|
|
48
|
+
c as callAll,
|
|
49
|
+
m as dataAttr,
|
|
50
|
+
d as getInitials,
|
|
51
|
+
g as getMessageContent,
|
|
52
|
+
s as isCitationArtifact,
|
|
53
|
+
l as isString,
|
|
54
|
+
y as maybeRender,
|
|
55
|
+
f as toKebabCase
|
|
31
56
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as t, jsxs as d, Fragment as f } from "react/jsx-runtime";
|
|
3
3
|
import { ChatHistoryTrigger as y } from "../styled/components/embedded-chat.js";
|
|
4
4
|
import { Root as I, Header as O, CloseButton as v } from "../styled/components/chat-bubble.js";
|
|
5
5
|
import { Container as S, ChatButton as A, ChatButtonText as H, ChatButtonAvatarContent as T, ChatButtonAvatarImage as k, ChatButtonCloseIcon as w } from "../styled/components/chat-button.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),s=require("../styled/components/embedded-chat.cjs"),a=require("../styled/components/chat-history.cjs"),C=require("../styled/components/modal.cjs"),H=require("../styled/components/shadow.cjs"),I=require("../styled/components/message.cjs"),A=require("../primitives/providers/chat-history-provider.cjs"),b=require("../primitives/providers/config-provider.cjs"),w=require("../primitives/providers/root-provider.cjs"),k=require("../primitives/providers/widget-provider.cjs"),M=require("../primitives/components/embedded-chat/chat-provider.cjs"),f=require("../primitives/components/modal/modal-provider.cjs"),p=require("../primitives/utils/misc.cjs"),E=require("../primitives/atoms/portal-with-theme.cjs"),P=require("../primitives/atoms/error-boundary.cjs"),B=require("./modal.cjs"),L=require("../primitives/providers/image-preview-provider.cjs"),q=require("./widget-toggle.cjs"),y=require("../primitives/components/embedded-chat/file-upload-input.cjs"),i=require("../styled/components/embedded-chat/file-upload-input.cjs"),m=require("../styled/components/embedded-chat/image-preview-modal.cjs");function D(r){const{baseSettings:t,aiChatSettings:n}=r;return e.jsx(P.ErrorBoundary,{children:e.jsx(H.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(w.RootProvider,{config:{baseSettings:t,aiChatSettings:n},componentType:b.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(S,{...r})})})})}function T(r){const{children:t,onToggleView:n,isHidden:o,shouldAutoFocusInput:d=!n}=r;return e.jsx(s.Provider,{isHidden:o,shouldAutoFocusInput:d,children:t})}function S(r){return e.jsx(T,{...r,children:e.jsx(v,{...r})})}function v(r){const{onToggleView:t,variant:n,header:o=W}=r,d=f.useModal(),l=k.useWidget(),x=d&&!l?B.ModalContent:g.Fragment;return e.jsx(L.ImagePreviewProvider,{children:e.jsx(x,{children:e.jsxs(s.Wrapper,{variant:n??(t?"no-shadow":"container-with-shadow"),"data-composite":p.dataAttr(!!r.onToggleView||d?.isOpen),children:[e.jsx(Z,{}),e.jsxs(s.Root,{children:[o&&e.jsx(o,{...r}),e.jsx(N,{}),e.jsx(U,{})]}),e.jsx(z,{}),e.jsx(R,{}),e.jsx(J,{})]})})})}const W=r=>{const{onToggleView:t,askAILabel:n,searchLabel:o}=r,{aiChatSettings:d}=b.useInkeepConfig(),l=d.isChatHistoryButtonVisible,x=!!t||l;return e.jsx(s.Header,{"data-show-toolbar":p.dataAttr(x),children:x?e.jsxs(s.HeaderToolbar,{"data-show-widget-toggle":p.dataAttr(!!t),children:[e.jsx(s.HeaderToolbarWrapper,{children:l&&e.jsx(s.ChatHistoryTrigger,{})}),t&&e.jsx(q.WidgetToggle,{onToggleView:t,askAILabel:n,searchLabel:o,view:"chat"}),e.jsx(C.Close,{})]}):e.jsx(C.Close,{})})};function N(){const{isSessionLoading:r}=M.useChat();return e.jsx(s.Content,{children:e.jsxs(s.ContentScrollArea,{children:[e.jsx(s.ContentScrollAreaViewport,{children:r?e.jsx(s.MessagesSessionLoading,{}):e.jsx(V,{})}),e.jsx(s.ContentScrollAreaScrollbar,{children:e.jsx(s.ContentScrollAreaThumb,{})}),e.jsx(s.ContentScrollAreaCorner,{})]})})}function V(){const{aiChatSettings:{components:r}}=b.useInkeepConfig();return e.jsx(s.Messages,{children:({messages:t,isLoading:n,isStreaming:o})=>{const d=t.at(-1),l=(c,j)=>{const h=r?.[c];if(!h)return console.warn(`Component "${c}" not found in components config`),null;try{if(typeof h=="function"&&h.length<=1)return g.createElement(h,j);const u=h(j,document.createElement("div"),null);return g.isValidElement(u)||typeof u=="string"?u:null}catch(u){return console.error(`🔍 [renderComponent] Error rendering component "${c}":`,u),null}},x=c=>e.jsx(s.Markdown,{text:c});return e.jsxs(e.Fragment,{children:[e.jsx($,{}),t.map(c=>{const j=d?.id===c.id;return e.jsxs(s.MessageWrapper,{message:c,children:[e.jsx(F,{}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:r?.IkpMessage?e.jsx(s.DynamicComponent,{name:"IkpMessage",props:{message:c,renderComponent:l,renderMarkdown:x},componentDef:r.IkpMessage}):e.jsxs(e.Fragment,{children:[e.jsx(I.EmbeddedChatMessagePart,{isLast:j}),(!o||!j)&&e.jsx(O,{})]})}),e.jsx(_,{}),e.jsx(Q,{})]})]},c.id)}),n&&d?.parts.length&&e.jsxs(s.MessageWrapper,{message:{id:"___loader___",role:"assistant",parts:[{type:"text",text:"Thinking..."}]},children:[e.jsx(F,{}),e.jsx(s.MessageLoading,{})]})]})}})}function $(){return e.jsxs(s.IntroMessageWrapper,{children:[e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsx(s.MessageAvatarContent,{children:e.jsx(s.MessageAvatarImage,{})})}),e.jsx(s.MessageName,{})]}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:e.jsx(I.EmbeddedChatMessagePart,{isLast:!1})}),e.jsxs(s.Disclaimer,{children:[e.jsx(s.DisclaimerLabel,{}),e.jsx(s.DisclaimerTrigger,{}),e.jsxs(s.DisclaimerContent,{children:[e.jsx(s.DisclaimerText,{}),e.jsx(s.DisclaimerArrow,{})]})]}),e.jsxs(s.ExampleQuestions,{children:[e.jsx(s.ExampleQuestionsLabel,{}),e.jsx(s.ExampleQuestionsList,{children:r=>r.map(t=>e.jsx(s.ExampleQuestion,{children:e.jsx(s.ExampleQuestionButton,{question:t})},typeof t=="object"?t.label:t))})]})]})]})}function F(){return e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsx(s.MessageAvatarContent,{children:e.jsx(s.MessageAvatarImage,{})})}),e.jsx(s.MessageName,{})]})}function R(){return e.jsx(E.PortalWithTheme,{children:e.jsx(m.EmbeddedChatImagePreviewModal,{children:e.jsx(m.EmbeddedChatImagePreviewModalOverlay,{children:e.jsxs(m.EmbeddedChatImagePreviewModalContent,{children:[e.jsx(m.EmbeddedChatImagePreviewModalClose,{}),e.jsx(m.EmbeddedChatImagePreviewModalImage,{}),e.jsx(m.EmbeddedChatImagePreviewModalFooter,{children:e.jsx(m.EmbeddedChatImagePreviewModalFileName,{})})]})})})})}function _(){return e.jsx(i.EmbeddedChatMessageFiles,{children:r=>r.map((t,n)=>{const o=t.url,d=t.mediaType??"",l=d.split("/").pop(),x=t.filename??(l?`untitled.${l}`:"untitled"),c=y.isImageMimeType(d);return e.jsxs(i.EmbeddedChatMessageFile,{url:o,name:x,mediaType:d,children:[c?e.jsx(i.EmbeddedChatFileThumbnail,{}):e.jsx(i.EmbeddedChatFileTypeIcon,{}),e.jsx(i.EmbeddedChatFileName,{})]},o||n)})})}function Q(){return e.jsxs(s.MessageToolbar,{children:[e.jsx(s.MessageCustomActions,{children:r=>r.map((t,n)=>e.jsx(s.MessageCustomAction,{action:t},`action-${n}`))}),e.jsx(s.MessageAction,{action:"copy"}),e.jsx(s.MessageAction,{action:"upvote"}),e.jsx(s.MessageAction,{action:"downvote"})]})}function O(){return e.jsxs(s.MessageSources,{children:[e.jsx(s.MessageSourcesHeader,{}),e.jsx(s.MessageSourcesList,{children:r=>r.map((t,n)=>e.jsxs(s.MessageSourceItem,{href:t.url,source:t,children:[e.jsx(s.MessageSourceItemBreadcrumbs,{children:t.breadcrumbs?.map(o=>e.jsxs(g.Fragment,{children:[o,e.jsx(s.MessageSourceItemBreadcrumbIcon,{})]},o))}),e.jsx(s.MessageSourceItemIcon,{}),e.jsx(s.MessageSourceItemTitle,{}),e.jsx(s.MessageSourceItemTag,{}),e.jsx(s.MessageSourceItemDescription,{children:o=>o.map((d,l)=>e.jsx(s.MessageSourceItemDescriptionPart,{part:d},`part-${l}`))}),e.jsx(s.MessageSourceItemIndicator,{})]},n))})]})}function U(){return e.jsxs(s.Footer,{children:[e.jsx(i.EmbeddedChatInputNotification,{children:e.jsxs(i.EmbeddedChatInputNotificationContent,{children:[e.jsxs(i.EmbeddedChatInputNotificationHeader,{children:[e.jsx(i.EmbeddedChatInputNotificationTitle,{}),e.jsx(i.EmbeddedChatInputNotificationClose,{})]}),e.jsx(i.EmbeddedChatInputNotificationMessage,{})]})}),e.jsx(G,{}),e.jsx(K,{})]})}function G(){return e.jsxs(s.InputFieldset,{children:[e.jsx(i.EmbeddedChatFileInput,{}),e.jsx(i.EmbeddedChatDropZone,{children:"Drop files here to add to chat"}),e.jsx(i.EmbeddedChatFileList,{children:r=>r.map((t,n)=>{const o=y.isImageMimeType(t.type);return e.jsxs(i.EmbeddedChatFileItem,{file:t,children:[o?e.jsxs(i.EmbeddedChatFilePreviewTrigger,{children:[e.jsx(i.EmbeddedChatFileThumbnail,{}),e.jsx(i.EmbeddedChatFileName,{})]}):e.jsxs(i.EmbeddedChatFileContent,{children:[e.jsx(i.EmbeddedChatFileTypeIcon,{}),e.jsx(i.EmbeddedChatFileName,{})]}),e.jsx(i.EmbeddedChatFileRemove,{})]},`${t.name}-${t.lastModified}-${n}`)})}),e.jsxs(s.InputGroup,{children:[e.jsx(i.EmbeddedChatFileUploadButton,{}),e.jsx(s.Input,{}),e.jsx(s.SendButton,{children:e.jsx(s.SendButtonIcon,{})})]})]})}function K(){return e.jsxs(s.ActionBar,{children:[e.jsxs(s.TaglineContainer,{children:[e.jsx(s.TaglineText,{}),e.jsx(s.TaglineLogo,{})]}),e.jsxs(s.Actions,{children:[e.jsx(s.HelpActions,{children:({pinned:r,unpinned:t})=>e.jsxs(e.Fragment,{children:[r.map(n=>e.jsx(s.HelpAction,{action:n},n.name)),t.length>0&&e.jsx(s.HelpActionsTrigger,{}),e.jsxs(s.HelpActionsMenu,{children:[e.jsx(s.HelpActionsMenuArrow,{}),t.map(n=>e.jsxs(s.HelpActionsMenuItem,{action:n,children:[e.jsx(s.HelpActionsMenuItemIcon,{action:n}),n.name]},n.name))]})]})}),e.jsxs(s.ChatAction,{action:"copy",children:[e.jsx(s.ChatActionLabel,{action:"copy"}),e.jsx(s.ChatActionFeedback,{action:"copy"})]}),e.jsx(s.ChatAction,{action:"clear"}),e.jsx(s.ChatAction,{action:"stop"})]})]})}function Z(){const{sessions:r}=A.useChatHistory(),{conversationId:t}=M.useChat();return e.jsxs(a.EmbeddedChatHistoryRoot,{children:[e.jsxs(a.EmbeddedChatHistoryHeader,{children:[e.jsxs(a.EmbeddedChatHistoryBackButton,{children:[e.jsx(a.EmbeddedChatHistoryBackButtonIcon,{iconKey:"backToChat"}),"Back to chat"]}),e.jsx(a.EmbeddedChatHistoryTitle,{}),e.jsx(C.Close,{})]}),e.jsxs(a.EmbeddedChatHistoryList,{children:[r.map(n=>e.jsxs(a.EmbeddedChatHistoryItem,{sessionId:n.id,"data-active":p.dataAttr(n.id===t),children:[e.jsx(a.EmbeddedChatHistoryItemTitle,{children:n.title}),e.jsx(a.EmbeddedChatHistoryItemDate,{children:a.formatSessionDate(n.updatedAt)})]},n.id)),e.jsx(a.EmbeddedChatHistoryEmptyState,{}),e.jsx(a.EmbeddedChatHistoryLoadingState,{})]}),e.jsx(a.EmbeddedChatHistoryFooter,{children:e.jsx(a.EmbeddedChatHistoryNewConversationButton,{})})]})}function z(){return e.jsx(E.PortalWithTheme,{children:e.jsx(s.FeedbackModal,{children:e.jsx(s.FeedbackModalOverlay,{children:e.jsxs(s.FeedbackModalContent,{children:[e.jsx(s.FeedbackModalHeader,{}),e.jsx(s.FeedbackModalClose,{}),e.jsx(s.FeedbackModalBody,{children:e.jsxs(s.FeedbackForm,{children:[e.jsxs(s.FeedbackField,{children:[e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsx(s.FeedbackSubmitButton,{})]})})]})})})})}function J(){return e.jsxs(s.FormWrapper,{children:[e.jsx(s.FormClose,{}),e.jsxs(s.Form,{children:[e.jsxs(s.FormHeader,{children:[e.jsx(s.FormHeading,{}),e.jsx(s.FormDescription,{})]}),e.jsx(s.FormContent,{children:r=>e.jsxs(e.Fragment,{children:[r.map((t,n)=>e.jsxs(s.FormField,{field:t,autoFocus:n===0,children:[e.jsx(s.FormFieldLabel,{}),t.inputType==="text"&&e.jsx(s.FormFieldText,{}),t.inputType==="email"&&e.jsx(s.FormFieldEmail,{}),t.inputType==="file"&&e.jsx(s.FormFieldFile,{}),t.inputType==="textarea"&&e.jsx(s.FormFieldTextArea,{}),t.inputType==="checkbox"&&e.jsx(s.FormFieldCheckbox,{children:e.jsx(s.FormFieldCheckboxIndicator,{})}),t.inputType==="select"&&e.jsxs(s.FormFieldSelect,{children:[e.jsxs(s.FormFieldSelectTrigger,{children:[e.jsx(s.FormFieldSelectValue,{}),e.jsx(s.FormFieldSelectIcon,{})]}),e.jsx(s.FormFieldSelectContent,{children:e.jsx(s.FormFieldSelectViewport,{children:t.items.map(o=>e.jsxs(s.FormFieldSelectItem,{value:o.value,children:[e.jsx(s.FormFieldSelectItemText,{children:o.label}),e.jsx(s.FormFieldSelectItemIndicator,{})]},o.value))})})]}),t.inputType==="combobox"&&e.jsxs(s.FormFieldCombobox,{children:[e.jsxs(s.FormFieldComboboxControl,{children:["multiple"in t&&t.multiple&&e.jsx(s.FormFieldComboboxSelectedTags,{}),e.jsx(s.FormFieldComboboxInput,{}),e.jsx(s.FormFieldComboboxTrigger,{})]}),e.jsx(s.FormFieldComboboxPositioner,{children:e.jsx(s.FormFieldComboboxContent,{children:e.jsx(s.FormFieldComboboxList,{children:e.jsx(s.FormFieldComboboxListItems,{children:o=>o.length===0?e.jsx(s.FormFieldComboboxListEmpty,{}):o.map(d=>e.jsxs(s.FormFieldComboboxItem,{item:d,children:[e.jsx(s.FormFieldComboboxItemText,{children:d.label}),e.jsx(s.FormFieldComboboxItemIndicator,{})]},d.value))})})})})]}),e.jsx(s.FormFieldDescription,{}),e.jsx(s.FormFieldError,{})]},t.name)),e.jsx(s.FormError,{})]})}),e.jsxs(s.FormFooter,{children:[e.jsx(s.FormCancel,{}),e.jsx(s.FormSubmit,{})]})]}),e.jsxs(s.FormSuccess,{children:[e.jsx(s.FormSuccessHeading,{}),e.jsx(s.FormSuccessMessage,{}),e.jsx(s.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=D;exports.InkeepEmbeddedChatImpl=S;exports.InkeepEmbeddedChatImplContent=v;exports.InkeepEmbeddedChatProvider=T;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("react"),s=require("../styled/components/embedded-chat.cjs"),a=require("../styled/components/chat-history.cjs"),C=require("../styled/components/modal.cjs"),H=require("../styled/components/shadow.cjs"),I=require("../styled/components/message.cjs"),A=require("../primitives/providers/chat-history-provider.cjs"),b=require("../primitives/providers/config-provider.cjs"),w=require("../primitives/providers/root-provider.cjs"),k=require("../primitives/providers/widget-provider.cjs"),M=require("../primitives/components/embedded-chat/chat-provider.cjs"),f=require("../primitives/components/modal/modal-provider.cjs"),p=require("../primitives/utils/misc.cjs"),E=require("../primitives/atoms/portal-with-theme.cjs"),P=require("../primitives/atoms/error-boundary.cjs"),B=require("./modal.cjs"),L=require("../primitives/providers/image-preview-provider.cjs"),q=require("./widget-toggle.cjs"),y=require("../primitives/components/embedded-chat/file-upload-input.cjs"),i=require("../styled/components/embedded-chat/file-upload-input.cjs"),m=require("../styled/components/embedded-chat/image-preview-modal.cjs");function D(r){const{baseSettings:t,aiChatSettings:n}=r;return e.jsx(P.ErrorBoundary,{children:e.jsx(H.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(w.RootProvider,{config:{baseSettings:t,aiChatSettings:n},componentType:b.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(S,{...r})})})})}function T(r){const{children:t,onToggleView:n,isHidden:o,shouldAutoFocusInput:d=!n}=r;return e.jsx(s.Provider,{isHidden:o,shouldAutoFocusInput:d,children:t})}function S(r){return e.jsx(T,{...r,children:e.jsx(v,{...r})})}function v(r){const{onToggleView:t,variant:n,header:o=W}=r,d=f.useModal(),l=k.useWidget(),x=d&&!l?B.ModalContent:g.Fragment;return e.jsx(L.ImagePreviewProvider,{children:e.jsx(x,{children:e.jsxs(s.Wrapper,{variant:n??(t?"no-shadow":"container-with-shadow"),"data-composite":p.dataAttr(!!r.onToggleView||d?.isOpen),children:[e.jsx(Z,{}),e.jsxs(s.Root,{children:[o&&e.jsx(o,{...r}),e.jsx(N,{}),e.jsx(U,{})]}),e.jsx(z,{}),e.jsx(R,{}),e.jsx(J,{})]})})})}const W=r=>{const{onToggleView:t,askAILabel:n,searchLabel:o}=r,{aiChatSettings:d}=b.useInkeepConfig(),l=d.isChatHistoryButtonVisible,x=!!t||l;return e.jsx(s.Header,{"data-show-toolbar":p.dataAttr(x),children:x?e.jsxs(s.HeaderToolbar,{"data-show-widget-toggle":p.dataAttr(!!t),children:[e.jsx(s.HeaderToolbarWrapper,{children:l&&e.jsx(s.ChatHistoryTrigger,{})}),t&&e.jsx(q.WidgetToggle,{onToggleView:t,askAILabel:n,searchLabel:o,view:"chat"}),e.jsx(C.Close,{})]}):e.jsx(C.Close,{})})};function N(){const{isSessionLoading:r}=M.useChat();return e.jsx(s.Content,{children:e.jsxs(s.ContentScrollArea,{children:[e.jsx(s.ContentScrollAreaViewport,{children:r?e.jsx(s.MessagesSessionLoading,{}):e.jsx(V,{})}),e.jsx(s.ContentScrollAreaScrollbar,{children:e.jsx(s.ContentScrollAreaThumb,{})}),e.jsx(s.ContentScrollAreaCorner,{})]})})}function V(){const{aiChatSettings:{components:r}}=b.useInkeepConfig();return e.jsx(s.Messages,{children:({messages:t,isLoading:n,isStreaming:o})=>{const d=t.at(-1),l=(c,j)=>{const h=r?.[c];if(!h)return console.warn(`Component "${c}" not found in components config`),null;try{if(typeof h=="function"&&h.length<=1)return g.createElement(h,j);const u=h(j,document.createElement("div"),null);return g.isValidElement(u)||typeof u=="string"?u:null}catch(u){return console.error(`🔍 [renderComponent] Error rendering component "${c}":`,u),null}},x=c=>e.jsx(s.Markdown,{text:c});return e.jsxs(e.Fragment,{children:[e.jsx($,{}),t.map(c=>{const j=d?.id===c.id;return e.jsxs(s.MessageWrapper,{message:c,children:[e.jsx(F,{}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:r?.IkpMessage?e.jsx(s.DynamicComponent,{name:"IkpMessage",props:{message:c,renderComponent:l,renderMarkdown:x},componentDef:r.IkpMessage}):e.jsxs(e.Fragment,{children:[e.jsx(I.EmbeddedChatMessagePart,{isLast:j}),(!o||!j)&&e.jsx(O,{})]})}),e.jsx(_,{}),e.jsx(Q,{})]})]},c.id)}),n&&d?.role==="user"&&d?.parts.length&&e.jsxs(s.MessageWrapper,{message:{id:"___loader___",role:"assistant",parts:[{type:"text",text:"Thinking..."}]},children:[e.jsx(F,{}),e.jsx(s.MessageLoading,{})]})]})}})}function $(){return e.jsxs(s.IntroMessageWrapper,{children:[e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsx(s.MessageAvatarContent,{children:e.jsx(s.MessageAvatarImage,{})})}),e.jsx(s.MessageName,{})]}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:e.jsx(I.EmbeddedChatMessagePart,{isLast:!1})}),e.jsxs(s.Disclaimer,{children:[e.jsx(s.DisclaimerLabel,{}),e.jsx(s.DisclaimerTrigger,{}),e.jsxs(s.DisclaimerContent,{children:[e.jsx(s.DisclaimerText,{}),e.jsx(s.DisclaimerArrow,{})]})]}),e.jsxs(s.ExampleQuestions,{children:[e.jsx(s.ExampleQuestionsLabel,{}),e.jsx(s.ExampleQuestionsList,{children:r=>r.map(t=>e.jsx(s.ExampleQuestion,{children:e.jsx(s.ExampleQuestionButton,{question:t})},typeof t=="object"?t.label:t))})]})]})]})}function F(){return e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsx(s.MessageAvatarContent,{children:e.jsx(s.MessageAvatarImage,{})})}),e.jsx(s.MessageName,{})]})}function R(){return e.jsx(E.PortalWithTheme,{children:e.jsx(m.EmbeddedChatImagePreviewModal,{children:e.jsx(m.EmbeddedChatImagePreviewModalOverlay,{children:e.jsxs(m.EmbeddedChatImagePreviewModalContent,{children:[e.jsx(m.EmbeddedChatImagePreviewModalClose,{}),e.jsx(m.EmbeddedChatImagePreviewModalImage,{}),e.jsx(m.EmbeddedChatImagePreviewModalFooter,{children:e.jsx(m.EmbeddedChatImagePreviewModalFileName,{})})]})})})})}function _(){return e.jsx(i.EmbeddedChatMessageFiles,{children:r=>r.map((t,n)=>{const o=t.url,d=t.mediaType??"",l=d.split("/").pop(),x=t.filename??(l?`untitled.${l}`:"untitled"),c=y.isImageMimeType(d);return e.jsxs(i.EmbeddedChatMessageFile,{url:o,name:x,mediaType:d,children:[c?e.jsx(i.EmbeddedChatFileThumbnail,{}):e.jsx(i.EmbeddedChatFileTypeIcon,{}),e.jsx(i.EmbeddedChatFileName,{})]},o||n)})})}function Q(){return e.jsxs(s.MessageToolbar,{children:[e.jsx(s.MessageCustomActions,{children:r=>r.map((t,n)=>e.jsx(s.MessageCustomAction,{action:t},`action-${n}`))}),e.jsx(s.MessageAction,{action:"copy"}),e.jsx(s.MessageAction,{action:"upvote"}),e.jsx(s.MessageAction,{action:"downvote"})]})}function O(){return e.jsxs(s.MessageSources,{children:[e.jsx(s.MessageSourcesHeader,{}),e.jsx(s.MessageSourcesList,{children:r=>r.map((t,n)=>e.jsxs(s.MessageSourceItem,{href:t.url,source:t,children:[e.jsx(s.MessageSourceItemBreadcrumbs,{children:t.breadcrumbs?.map(o=>e.jsxs(g.Fragment,{children:[o,e.jsx(s.MessageSourceItemBreadcrumbIcon,{})]},o))}),e.jsx(s.MessageSourceItemIcon,{}),e.jsx(s.MessageSourceItemTitle,{}),e.jsx(s.MessageSourceItemTag,{}),e.jsx(s.MessageSourceItemDescription,{children:o=>o.map((d,l)=>e.jsx(s.MessageSourceItemDescriptionPart,{descriptionPart:d},`part-${l}`))}),e.jsx(s.MessageSourceItemIndicator,{})]},n))})]})}function U(){return e.jsxs(s.Footer,{children:[e.jsx(i.EmbeddedChatInputNotification,{children:e.jsxs(i.EmbeddedChatInputNotificationContent,{children:[e.jsxs(i.EmbeddedChatInputNotificationHeader,{children:[e.jsx(i.EmbeddedChatInputNotificationTitle,{}),e.jsx(i.EmbeddedChatInputNotificationClose,{})]}),e.jsx(i.EmbeddedChatInputNotificationMessage,{})]})}),e.jsx(G,{}),e.jsx(K,{})]})}function G(){return e.jsxs(s.InputFieldset,{children:[e.jsx(i.EmbeddedChatFileInput,{}),e.jsx(i.EmbeddedChatDropZone,{children:"Drop files here to add to chat"}),e.jsx(i.EmbeddedChatFileList,{children:r=>r.map((t,n)=>{const o=y.isImageMimeType(t.type);return e.jsxs(i.EmbeddedChatFileItem,{file:t,children:[o?e.jsxs(i.EmbeddedChatFilePreviewTrigger,{children:[e.jsx(i.EmbeddedChatFileThumbnail,{}),e.jsx(i.EmbeddedChatFileName,{})]}):e.jsxs(i.EmbeddedChatFileContent,{children:[e.jsx(i.EmbeddedChatFileTypeIcon,{}),e.jsx(i.EmbeddedChatFileName,{})]}),e.jsx(i.EmbeddedChatFileRemove,{})]},`${t.name}-${t.lastModified}-${n}`)})}),e.jsxs(s.InputGroup,{children:[e.jsx(i.EmbeddedChatFileUploadButton,{}),e.jsx(s.Input,{}),e.jsx(s.SendButton,{children:e.jsx(s.SendButtonIcon,{})})]})]})}function K(){return e.jsxs(s.ActionBar,{children:[e.jsxs(s.TaglineContainer,{children:[e.jsx(s.TaglineText,{}),e.jsx(s.TaglineLogo,{})]}),e.jsxs(s.Actions,{children:[e.jsx(s.HelpActions,{children:({pinned:r,unpinned:t})=>e.jsxs(e.Fragment,{children:[r.map(n=>e.jsx(s.HelpAction,{action:n},n.name)),t.length>0&&e.jsx(s.HelpActionsTrigger,{}),e.jsxs(s.HelpActionsMenu,{children:[e.jsx(s.HelpActionsMenuArrow,{}),t.map(n=>e.jsxs(s.HelpActionsMenuItem,{action:n,children:[e.jsx(s.HelpActionsMenuItemIcon,{action:n}),n.name]},n.name))]})]})}),e.jsxs(s.ChatAction,{action:"copy",children:[e.jsx(s.ChatActionLabel,{action:"copy"}),e.jsx(s.ChatActionFeedback,{action:"copy"})]}),e.jsx(s.ChatAction,{action:"clear"}),e.jsx(s.ChatAction,{action:"stop"})]})]})}function Z(){const{sessions:r}=A.useChatHistory(),{conversationId:t}=M.useChat();return e.jsxs(a.EmbeddedChatHistoryRoot,{children:[e.jsxs(a.EmbeddedChatHistoryHeader,{children:[e.jsxs(a.EmbeddedChatHistoryBackButton,{children:[e.jsx(a.EmbeddedChatHistoryBackButtonIcon,{iconKey:"backToChat"}),"Back to chat"]}),e.jsx(a.EmbeddedChatHistoryTitle,{}),e.jsx(C.Close,{})]}),e.jsxs(a.EmbeddedChatHistoryList,{children:[r.map(n=>e.jsxs(a.EmbeddedChatHistoryItem,{sessionId:n.id,"data-active":p.dataAttr(n.id===t),children:[e.jsx(a.EmbeddedChatHistoryItemTitle,{children:n.title}),e.jsx(a.EmbeddedChatHistoryItemDate,{children:a.formatSessionDate(n.updatedAt)})]},n.id)),e.jsx(a.EmbeddedChatHistoryEmptyState,{}),e.jsx(a.EmbeddedChatHistoryLoadingState,{})]}),e.jsx(a.EmbeddedChatHistoryFooter,{children:e.jsx(a.EmbeddedChatHistoryNewConversationButton,{})})]})}function z(){return e.jsx(E.PortalWithTheme,{children:e.jsx(s.FeedbackModal,{children:e.jsx(s.FeedbackModalOverlay,{children:e.jsxs(s.FeedbackModalContent,{children:[e.jsx(s.FeedbackModalHeader,{}),e.jsx(s.FeedbackModalClose,{}),e.jsx(s.FeedbackModalBody,{children:e.jsxs(s.FeedbackForm,{children:[e.jsxs(s.FeedbackField,{children:[e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsx(s.FeedbackSubmitButton,{})]})})]})})})})}function J(){return e.jsxs(s.FormWrapper,{children:[e.jsx(s.FormClose,{}),e.jsxs(s.Form,{children:[e.jsxs(s.FormHeader,{children:[e.jsx(s.FormHeading,{}),e.jsx(s.FormDescription,{})]}),e.jsx(s.FormContent,{children:r=>e.jsxs(e.Fragment,{children:[r.map((t,n)=>e.jsxs(s.FormField,{field:t,autoFocus:n===0,children:[e.jsx(s.FormFieldLabel,{}),t.inputType==="text"&&e.jsx(s.FormFieldText,{}),t.inputType==="email"&&e.jsx(s.FormFieldEmail,{}),t.inputType==="file"&&e.jsx(s.FormFieldFile,{}),t.inputType==="textarea"&&e.jsx(s.FormFieldTextArea,{}),t.inputType==="checkbox"&&e.jsx(s.FormFieldCheckbox,{children:e.jsx(s.FormFieldCheckboxIndicator,{})}),t.inputType==="select"&&e.jsxs(s.FormFieldSelect,{children:[e.jsxs(s.FormFieldSelectTrigger,{children:[e.jsx(s.FormFieldSelectValue,{}),e.jsx(s.FormFieldSelectIcon,{})]}),e.jsx(s.FormFieldSelectContent,{children:e.jsx(s.FormFieldSelectViewport,{children:t.items.map(o=>e.jsxs(s.FormFieldSelectItem,{value:o.value,children:[e.jsx(s.FormFieldSelectItemText,{children:o.label}),e.jsx(s.FormFieldSelectItemIndicator,{})]},o.value))})})]}),t.inputType==="combobox"&&e.jsxs(s.FormFieldCombobox,{children:[e.jsxs(s.FormFieldComboboxControl,{children:["multiple"in t&&t.multiple&&e.jsx(s.FormFieldComboboxSelectedTags,{}),e.jsx(s.FormFieldComboboxInput,{}),e.jsx(s.FormFieldComboboxTrigger,{})]}),e.jsx(s.FormFieldComboboxPositioner,{children:e.jsx(s.FormFieldComboboxContent,{children:e.jsx(s.FormFieldComboboxList,{children:e.jsx(s.FormFieldComboboxListItems,{children:o=>o.length===0?e.jsx(s.FormFieldComboboxListEmpty,{}):o.map(d=>e.jsxs(s.FormFieldComboboxItem,{item:d,children:[e.jsx(s.FormFieldComboboxItemText,{children:d.label}),e.jsx(s.FormFieldComboboxItemIndicator,{})]},d.value))})})})})]}),e.jsx(s.FormFieldDescription,{}),e.jsx(s.FormFieldError,{})]},t.name)),e.jsx(s.FormError,{})]})}),e.jsxs(s.FormFooter,{children:[e.jsx(s.FormCancel,{}),e.jsx(s.FormSubmit,{})]})]}),e.jsxs(s.FormSuccess,{children:[e.jsx(s.FormSuccessHeading,{}),e.jsx(s.FormSuccessMessage,{}),e.jsx(s.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=D;exports.InkeepEmbeddedChatImpl=S;exports.InkeepEmbeddedChatImplContent=v;exports.InkeepEmbeddedChatProvider=T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as e, jsxs as d, Fragment as b } from "react/jsx-runtime";
|
|
3
3
|
import g, { Fragment as S } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Wrapper as V, Root as N, Provider as Q, Header as $, HeaderToolbar as _, HeaderToolbarWrapper as R, ChatHistoryTrigger as O, Content as j, ContentScrollArea as G, ContentScrollAreaViewport as U, MessagesSessionLoading as K, ContentScrollAreaScrollbar as Z, ContentScrollAreaThumb as z, ContentScrollAreaCorner as J, Footer as X, FeedbackModal as Y, FeedbackModalOverlay as q, FeedbackModalContent as ee, FeedbackModalHeader as de, FeedbackModalClose as te, FeedbackModalBody as ae, FeedbackForm as oe, FeedbackField as re, FeedbackItemLabel as ne, FeedbackItemDescription as ie, FeedbackSubmitButton as me, FormWrapper as se, FormClose as le, Form as ce, FormHeader as he, FormHeading as be, FormDescription as Ce, FormContent as Fe, FormField as Ee, FormFieldLabel as ue, FormFieldText as pe, FormFieldEmail as ge, FormFieldFile as Ie, FormFieldTextArea as Me, FormFieldCheckbox as Se, FormFieldCheckboxIndicator as Te, FormFieldSelect as xe, FormFieldSelectTrigger as Ae, FormFieldSelectValue as He, FormFieldSelectIcon as ye, FormFieldSelectContent as fe, FormFieldSelectViewport as ke, FormFieldSelectItem as we, FormFieldSelectItemText as ve, FormFieldSelectItemIndicator as Le, FormFieldCombobox as De, FormFieldComboboxControl as Be, FormFieldComboboxSelectedTags as Pe, FormFieldComboboxInput as We, FormFieldComboboxTrigger as Ve, FormFieldComboboxPositioner as Ne, FormFieldComboboxContent as Qe, FormFieldComboboxList as $e, FormFieldComboboxListItems as _e, FormFieldComboboxListEmpty as Re, FormFieldComboboxItem as Oe, FormFieldComboboxItemText as je, FormFieldComboboxItemIndicator as Ge, FormFieldDescription as Ue, FormFieldError as Ke, FormError as Ze, FormFooter as ze, FormCancel as Je, FormSubmit as Xe, FormSuccess as Ye, FormSuccessHeading as qe, FormSuccessMessage as ed, FormSuccessButton as dd, Messages as td, MessageWrapper as I, MessageContentWrapper as T, MessageContent as x, DynamicComponent as ad, MessageLoading as od, InputFieldset as rd, InputGroup as nd, Input as id, SendButton as md, SendButtonIcon as sd, ActionBar as ld, TaglineContainer as cd, TaglineText as hd, TaglineLogo as bd, Actions as Cd, HelpActions as Fd, HelpAction as Ed, HelpActionsTrigger as ud, HelpActionsMenu as pd, HelpActionsMenuArrow as gd, HelpActionsMenuItem as Id, HelpActionsMenuItemIcon as Md, ChatAction as F, ChatActionLabel as Sd, ChatActionFeedback as Td, IntroMessageWrapper as xd, MessageHeader as A, MessageAvatar as H, MessageAvatarContent as y, MessageAvatarImage as f, MessageName as k, Disclaimer as Ad, DisclaimerLabel as Hd, DisclaimerTrigger as yd, DisclaimerContent as fd, DisclaimerText as kd, DisclaimerArrow as wd, ExampleQuestions as vd, ExampleQuestionsLabel as Ld, ExampleQuestionsList as Dd, ExampleQuestion as Bd, ExampleQuestionButton as Pd, Markdown as Wd, MessageSources as Vd, MessageSourcesHeader as Nd, MessageSourcesList as Qd, MessageSourceItem as $d, MessageSourceItemBreadcrumbs as _d, MessageSourceItemBreadcrumbIcon as Rd, MessageSourceItemIcon as Od, MessageSourceItemTitle as jd, MessageSourceItemTag as Gd, MessageSourceItemDescription as Ud, MessageSourceItemDescriptionPart as Kd, MessageSourceItemIndicator as Zd, MessageToolbar as zd, MessageCustomActions as Jd, MessageCustomAction as Xd, MessageAction as E } from "../styled/components/embedded-chat.js";
|
|
5
5
|
import { EmbeddedChatHistoryRoot as Yd, EmbeddedChatHistoryHeader as qd, EmbeddedChatHistoryBackButton as et, EmbeddedChatHistoryBackButtonIcon as dt, EmbeddedChatHistoryTitle as tt, EmbeddedChatHistoryList as at, EmbeddedChatHistoryItem as ot, EmbeddedChatHistoryItemTitle as rt, EmbeddedChatHistoryItemDate as nt, formatSessionDate as it, EmbeddedChatHistoryEmptyState as mt, EmbeddedChatHistoryLoadingState as st, EmbeddedChatHistoryFooter as lt, EmbeddedChatHistoryNewConversationButton as ct } from "../styled/components/chat-history.js";
|
|
6
6
|
import { Close as u } from "../styled/components/modal.js";
|
|
7
7
|
import { Shadow as ht } from "../styled/components/shadow.js";
|
|
@@ -46,7 +46,7 @@ function wa(a) {
|
|
|
46
46
|
}
|
|
47
47
|
function Gt(a) {
|
|
48
48
|
const { children: t, onToggleView: o, isHidden: r, shouldAutoFocusInput: n = !o } = a;
|
|
49
|
-
return /* @__PURE__ */ e(
|
|
49
|
+
return /* @__PURE__ */ e(Q, { isHidden: r, shouldAutoFocusInput: n, children: t });
|
|
50
50
|
}
|
|
51
51
|
function Ut(a) {
|
|
52
52
|
return /* @__PURE__ */ e(Gt, { ...a, children: /* @__PURE__ */ e(Kt, { ...a }) });
|
|
@@ -54,13 +54,13 @@ function Ut(a) {
|
|
|
54
54
|
function Kt(a) {
|
|
55
55
|
const { onToggleView: t, variant: o, header: r = Zt } = a, n = ut(), m = Et();
|
|
56
56
|
return /* @__PURE__ */ e(It, { children: /* @__PURE__ */ e(n && !m ? gt : S, { children: /* @__PURE__ */ d(
|
|
57
|
-
|
|
57
|
+
V,
|
|
58
58
|
{
|
|
59
59
|
variant: o ?? (t ? "no-shadow" : "container-with-shadow"),
|
|
60
60
|
"data-composite": C(!!a.onToggleView || n?.isOpen),
|
|
61
61
|
children: [
|
|
62
62
|
/* @__PURE__ */ e(ra, {}),
|
|
63
|
-
/* @__PURE__ */ d(
|
|
63
|
+
/* @__PURE__ */ d(N, { children: [
|
|
64
64
|
r && /* @__PURE__ */ e(r, { ...a }),
|
|
65
65
|
/* @__PURE__ */ e(zt, {}),
|
|
66
66
|
/* @__PURE__ */ e(ta, {})
|
|
@@ -137,7 +137,7 @@ function Jt() {
|
|
|
137
137
|
] })
|
|
138
138
|
] }, i.id);
|
|
139
139
|
}),
|
|
140
|
-
o && n?.parts.length && /* @__PURE__ */ d(
|
|
140
|
+
o && n?.role === "user" && n?.parts.length && /* @__PURE__ */ d(
|
|
141
141
|
I,
|
|
142
142
|
{
|
|
143
143
|
message: {
|
|
@@ -227,7 +227,7 @@ function da() {
|
|
|
227
227
|
/* @__PURE__ */ e(Ud, { children: (r) => r.map((n, m) => /* @__PURE__ */ e(
|
|
228
228
|
Kd,
|
|
229
229
|
{
|
|
230
|
-
|
|
230
|
+
descriptionPart: n
|
|
231
231
|
},
|
|
232
232
|
`part-${m}`
|
|
233
233
|
)) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../styled/components/embedded-search.cjs"),R=require("../styled/components/modal.cjs"),A=require("../styled/components/shadow.cjs"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../styled/components/embedded-search.cjs"),R=require("../styled/components/modal.cjs"),A=require("../styled/components/shadow.cjs"),u=require("../primitives/providers/config-provider.cjs"),w=require("../primitives/providers/root-provider.cjs"),S=require("../primitives/providers/widget-provider.cjs"),T=require("../primitives/components/embedded-search/search-provider.cjs"),p=require("../primitives/components/modal/modal-provider.cjs"),d=require("../primitives/utils/misc.cjs"),x=require("../primitives/atoms/cmdk/index.cjs"),v=require("../primitives/atoms/error-boundary.cjs"),a=require("react"),j=require("./widget-toggle.cjs"),k=require("./modal.cjs");function b(r){const{baseSettings:t,searchSettings:n}=r;return e.jsx(v.ErrorBoundary,{children:e.jsx(A.Shadow,{children:e.jsx(w.RootProvider,{config:{baseSettings:t,searchSettings:n},componentType:u.WebWidgetInteractionType.EmbeddedSearch,children:e.jsx(h,{...r})})})})}function I(r){const{children:t,onToggleView:n,isHidden:i,shouldAutoFocusInput:l=!n}=r;return e.jsx(s.Provider,{isHidden:i,shouldAutoFocusInput:l,children:t})}function h(r){return e.jsx(I,{...r,children:e.jsx(m,{...r})})}function m(r){const{searchSettings:{view:t}}=u.useInkeepConfig(),{onToggleView:n,shouldShowAskAICard:i=!!n&&t!=="dual-pane"}=r,l=p.useModal(),o=S.useWidget(),c=l&&!o?k.ModalContent:a.Fragment;return e.jsx(c,{children:e.jsx(s.Wrapper,{"data-show-ask-ai-card":d.dataAttr(i),"data-composite":d.dataAttr(!!n||l?.isOpen),children:e.jsxs(s.Root,{children:[e.jsx(P,{...r}),e.jsxs(s.Content,{children:[e.jsx(C,{askAICardLabel:r.askAICardLabel,askAILabel:r.askAILabel,onToggleView:r.onToggleView,shouldShowAskAICard:i}),e.jsx(L,{})]}),e.jsx(y,{})]})})})}function P(r){const{onToggleView:t,askAILabel:n,searchLabel:i}=r,l=x.useCommandState(c=>c.search),{loading:o}=T.useSearch();return e.jsxs(s.InputGroup,{children:[!o&&e.jsx(s.InputIcon,{}),e.jsx(s.Loading,{}),e.jsx(s.Input,{}),t&&e.jsx(j.WidgetToggle,{onToggleView:t,query:l,askAILabel:n,searchLabel:i,view:"search"}),e.jsx(R.Close,{})]})}function C(r){const{askAILabel:t,onToggleView:n,shouldShowAskAICard:i,askAICardLabel:l}=r,o=x.useCommandState(g=>g.search),{handleToggle:c}=j.useToggleView({onToggleView:n,query:o});return i?e.jsxs(s.AskAITrigger,{onSelect:()=>c("chat",!0),children:[e.jsx(s.AskAITriggerIcon,{}),e.jsxs(s.AskAITriggerLabel,{children:[l||t||"Ask AI",o&&e.jsx(s.AskAITriggerQuery,{children:`${o}`})]}),e.jsx(s.AskAITriggerIndicatorText,{children:"Start conversation"}),e.jsx(s.AskAITriggerIndicator,{})]}):null}function L(){return e.jsxs(s.Results,{children:[e.jsx(s.ResultsLoading,{}),e.jsx(s.ResultsTabList,{children:r=>r.map(t=>e.jsx(s.ResultsTab,{tab:t},t))}),e.jsx(s.ResultsEmpty,{}),e.jsxs(s.ResultsContent,{children:[e.jsx(q,{}),e.jsx(f,{})]})]})}function q(){return e.jsxs(s.ResultsScrollArea,{children:[e.jsx(s.ResultsScrollAreaViewport,{children:e.jsx(s.ResultsList,{children:r=>r.map(t=>e.jsxs(s.ResultsItem,{item:t,children:[e.jsx(s.ResultsItemBreadcrumbs,{children:n=>n.map((i,l)=>e.jsxs(a.Fragment,{children:[i,e.jsx(s.ResultsItemBreadcrumbIcon,{})]},`${i}-${l}`))}),e.jsx(s.ResultsItemIcon,{}),e.jsx(s.ResultsItemTitle,{}),e.jsx(s.ResultsItemTag,{}),e.jsx(s.ResultsItemDescription,{children:n=>n.map((i,l)=>e.jsx(s.ResultsItemDescriptionPart,{descriptionPart:i},`part-${l}`))}),e.jsx(s.ResultsItemIndicator,{})]},t.id))})}),e.jsx(s.ResultsScrollAreaScrollbar,{children:e.jsx(s.ResultsScrollAreaThumb,{})}),e.jsx(s.ResultsScrollAreaCorner,{})]})}function f(){return e.jsxs(s.ResultsScrollArea,{children:[e.jsx(s.ResultsScrollAreaViewport,{children:e.jsxs(s.ResultsItemPreview,{children:[e.jsxs(s.ResultsItemPreviewHeader,{children:[e.jsxs(s.ResultsItemPreviewHeading,{children:[e.jsx(s.ResultsItemPreviewTitle,{}),e.jsx(s.ResultsItemPreviewTitleLinkIcon,{})]}),e.jsx(s.ResultsItemPreviewBreadcrumbs,{children:r=>r.map((t,n)=>e.jsxs(a.Fragment,{children:[t,e.jsx(s.ResultsItemPreviewBreadcrumbIcon,{})]},`${t}-${n}`))})]}),e.jsx(s.ResultsItemPreviewBody,{}),e.jsxs(s.ResultsItemPreviewOutline,{children:[e.jsx(s.ResultsItemPreviewOutlineTitle,{}),e.jsx(s.ResultsItemPreviewOutlineList,{children:r=>r.map((t,n)=>e.jsxs(s.ResultsItemPreviewOutlineItem,{href:t.url??void 0,"data-is-match":d.dataAttr(t.isMatch),children:[e.jsx(s.ResultsItemPreviewOutlineItemIcon,{}),e.jsx(s.ResultsItemPreviewOutlineItemText,{children:t.content}),t.url&&e.jsx(s.ResultsItemPreviewOutlineItemLinkIcon,{})]},`${t.anchor}-${n}`))})]})]})}),e.jsx(s.ResultsScrollAreaScrollbar,{children:e.jsx(s.ResultsScrollAreaThumb,{})}),e.jsx(s.ResultsScrollAreaCorner,{})]})}function y(){return e.jsx(s.Footer,{children:e.jsxs(s.TaglineContainer,{children:[e.jsx(s.TaglineText,{}),e.jsx(s.TaglineLogo,{})]})})}exports.InkeepEmbeddedSearch=b;exports.InkeepEmbeddedSearchImpl=h;exports.InkeepEmbeddedSearchImplContent=m;exports.InkeepEmbeddedSearchProvider=I;
|