@levo-so/studio 0.3.1 → 0.3.2
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/{BillingStep-DNg2PTXV.js → BillingStep-D3OVeo3H.js} +1 -1
- package/{Button-DUBI4k7m.js → Button-H07AsyeH.js} +31 -29
- package/{EntryCard-B3wpp5oI.js → EntryCard-BfwGbFzQ.js} +1 -1
- package/{KBChatWidget-BAvoYVFq.js → KBChatWidget-BqcuZ1UF.js} +375 -424
- package/{LoginCard-CaLgm9c4.js → LoginCard-DIZD6tfi.js} +1 -1
- package/{PendingApprovalCard-ARwwmFAe.js → PendingApprovalCard-BlyH59Vy.js} +1 -1
- package/{PopupRenderer-Bncp54gB-DTM3Wdxp.js → PopupRenderer-DBKtkdmH-Ws7F9GmP.js} +234 -228
- package/{ProfileCard-CnL0X_Ui.js → ProfileCard-DFgmQMUO.js} +1 -1
- package/{bookingCard-C0_NNfko.js → bookingCard-BKfK_WbW.js} +2 -2
- package/{dist-DanVCpXe.js → dist-Ckw19x6H.js} +5 -4
- package/index.d.ts +11 -2
- package/index.js +1167 -1149
- package/{kbChat-DnIItqUJ.js → kbChat-CfxwD3hz.js} +31 -26
- package/package.json +3 -3
- package/pillChrome-CrJ9a5vj.js +30 -0
- package/studio.css +1 -1
- package/pillChrome-BHFzM9re.js +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as e, c as t, f as n, h as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u, u as d,
|
|
2
|
+
import { a as e, c as t, f as n, h as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u, u as d, y as f } from "./pillChrome-CrJ9a5vj.js";
|
|
3
3
|
import { useEffect as p, useRef as m, useState as h } from "react";
|
|
4
4
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
5
5
|
import { ArrowUp as v, Sparkles as y } from "lucide-react";
|
|
@@ -20,47 +20,51 @@ var b = (e) => f("active_agent", e), x = (e) => {
|
|
|
20
20
|
if (!(!n || typeof window > "u")) try {
|
|
21
21
|
t === null ? window.sessionStorage.removeItem(n) : window.sessionStorage.setItem(n, JSON.stringify(t));
|
|
22
22
|
} catch {}
|
|
23
|
-
}, C = ({ url: e, workspaceId: t, headers: n }) => {
|
|
24
|
-
let [
|
|
23
|
+
}, C = ({ url: e, workspaceId: t, headers: n, path: r }) => {
|
|
24
|
+
let [i, a] = h({ status: "loading" });
|
|
25
25
|
p(() => {
|
|
26
26
|
let e = x(t);
|
|
27
|
-
|
|
27
|
+
a(e ? {
|
|
28
28
|
status: "ready",
|
|
29
29
|
agent: e
|
|
30
30
|
} : (e) => e.status === "ready" ? { status: "loading" } : e);
|
|
31
31
|
}, [t]);
|
|
32
|
-
let
|
|
33
|
-
return
|
|
32
|
+
let o = m(n);
|
|
33
|
+
return o.current = n, p(() => {
|
|
34
34
|
if (!t || !e) return;
|
|
35
|
-
let n = new AbortController();
|
|
35
|
+
let n = r ? `${e}${e.includes("?") ? "&" : "?"}path=${encodeURIComponent(r)}` : e, i = new AbortController();
|
|
36
36
|
return (async () => {
|
|
37
37
|
try {
|
|
38
|
-
let
|
|
38
|
+
let e = await fetch(n, {
|
|
39
39
|
method: "GET",
|
|
40
40
|
credentials: "include",
|
|
41
|
-
headers:
|
|
42
|
-
signal:
|
|
41
|
+
headers: o.current,
|
|
42
|
+
signal: i.signal
|
|
43
43
|
});
|
|
44
|
-
if (!
|
|
45
|
-
S(t, null),
|
|
44
|
+
if (!e.ok) {
|
|
45
|
+
S(t, null), a({ status: "missing" });
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
let
|
|
49
|
-
if (!
|
|
50
|
-
S(t, null),
|
|
48
|
+
let r = (await e.json())?.content?.data;
|
|
49
|
+
if (!r || typeof r.id != "string" || r.id.length === 0) {
|
|
50
|
+
S(t, null), a({ status: "missing" });
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
S(t,
|
|
53
|
+
S(t, r), a({
|
|
54
54
|
status: "ready",
|
|
55
|
-
agent:
|
|
55
|
+
agent: r
|
|
56
56
|
});
|
|
57
57
|
} catch (e) {
|
|
58
58
|
if (e?.name === "AbortError") return;
|
|
59
|
-
console.warn("[levo-kb-chat] active-agent boot failed:", e),
|
|
59
|
+
console.warn("[levo-kb-chat] active-agent boot failed:", e), a({ status: "error" });
|
|
60
60
|
}
|
|
61
|
-
})(), () =>
|
|
62
|
-
}, [
|
|
63
|
-
|
|
61
|
+
})(), () => i.abort();
|
|
62
|
+
}, [
|
|
63
|
+
t,
|
|
64
|
+
e,
|
|
65
|
+
r
|
|
66
|
+
]), i;
|
|
67
|
+
}, w = (...e) => e.filter(Boolean).join(" "), T = () => import("./KBChatWidget-BqcuZ1UF.js"), E = (e) => {
|
|
64
68
|
let [t, n] = h(null), [r, i] = h(!1), [a, o] = h("");
|
|
65
69
|
return t ? /* @__PURE__ */ g(t, {
|
|
66
70
|
initialOpen: !0,
|
|
@@ -140,23 +144,24 @@ var b = (e) => f("active_agent", e), x = (e) => {
|
|
|
140
144
|
})
|
|
141
145
|
})
|
|
142
146
|
});
|
|
143
|
-
}, k = "/.levo/public/api/v1/agents/kb-chat/public", A = (e) => e.replace(/\/v1\/agents\/kb-chat\/public\/?$/, ""), j = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, apiBaseUrl: i = k, authHeaders: a, showBranding: o, siteSlug: s }) => {
|
|
144
|
-
let
|
|
147
|
+
}, k = "/.levo/public/api/v1/agents/kb-chat/public", A = (e) => e.replace(/\/v1\/agents\/kb-chat\/public\/?$/, ""), j = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, apiBaseUrl: i = k, authHeaders: a, showBranding: o, siteSlug: s, path: c }) => {
|
|
148
|
+
let l = C({
|
|
145
149
|
url: `${A(i)}/v1/intelligence/site-agent/get-active`,
|
|
146
150
|
workspaceId: e,
|
|
147
151
|
headers: e ? {
|
|
148
152
|
...a,
|
|
149
153
|
"Levo-Workspace": e
|
|
150
|
-
} : a
|
|
154
|
+
} : a,
|
|
155
|
+
path: c
|
|
151
156
|
});
|
|
152
|
-
return
|
|
157
|
+
return l.status === "ready" ? /* @__PURE__ */ g("div", {
|
|
153
158
|
"data-ai-chat-root": !0,
|
|
154
159
|
children: /* @__PURE__ */ g(E, {
|
|
155
160
|
workspaceId: e,
|
|
156
161
|
siteName: t,
|
|
157
162
|
siteLogo: n,
|
|
158
163
|
siteIcon: r,
|
|
159
|
-
agentId:
|
|
164
|
+
agentId: l.agent.id,
|
|
160
165
|
apiBaseUrl: i,
|
|
161
166
|
authHeaders: a,
|
|
162
167
|
showBranding: o,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levo-so/studio",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"author": "Levo Engineering <devs@theinternetfolks.com>",
|
|
5
5
|
"description": "Levo Studio components and utilities for building block-based pages",
|
|
6
6
|
"type": "module",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"react": ">=19",
|
|
120
120
|
"next": ">=14",
|
|
121
121
|
"react-dom": ">=19",
|
|
122
|
-
"@levo-so/insights": "0.2.1",
|
|
123
122
|
"@levo-so/core": "0.2.1",
|
|
124
|
-
"@levo-so/react": "0.2.1"
|
|
123
|
+
"@levo-so/react": "0.2.1",
|
|
124
|
+
"@levo-so/insights": "0.2.1"
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../libraries/ai-chat/src/helpers.ts
|
|
2
|
+
var e = (e, t = {
|
|
3
|
+
hour: "numeric",
|
|
4
|
+
minute: "2-digit"
|
|
5
|
+
}) => {
|
|
6
|
+
if (!e) return "";
|
|
7
|
+
let n = e instanceof Date ? e : new Date(e);
|
|
8
|
+
return Number.isNaN(n.getTime()) ? "" : n.toLocaleTimeString([], t);
|
|
9
|
+
}, t = (e, t) => t ? `levo.site_chat.${e}.${t}` : null, n = (e, t) => {
|
|
10
|
+
e.style.height = "auto", e.style.height = t === void 0 ? `${e.scrollHeight}px` : `${Math.min(e.scrollHeight, t)}px`;
|
|
11
|
+
}, r = (e, t) => {
|
|
12
|
+
e.setText(t);
|
|
13
|
+
let n = document.activeElement?.closest("[data-ai-chat-root]") ?? document;
|
|
14
|
+
requestAnimationFrame(() => {
|
|
15
|
+
let e = n.querySelector("textarea[data-ai-chat-composer]");
|
|
16
|
+
if (!e) return;
|
|
17
|
+
e.focus();
|
|
18
|
+
let t = e.value.length;
|
|
19
|
+
e.setSelectionRange(t, t);
|
|
20
|
+
});
|
|
21
|
+
}, i = "w-72", a = "ai-chat-pill-gradient relative rounded-[30px] p-[2px] transition-shadow duration-300", o = "shadow-lg shadow-zinc-950/10", s = "shadow-md", c = "ai-chat-pill-surface min-h-14 w-full rounded-[28px] bg-white p-1.5", l = "ai-chat-pill-surface--stacked", u = "ai-chat-pill-input relative min-w-0", d = "ai-chat-pill-actions flex items-center gap-1.5", f = "ai-chat-pill-spark flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full text-blue-500 transition-[background-color,transform] duration-150 hover:bg-zinc-50 active:scale-95", p = "flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-[transform,box-shadow] duration-150 hover:scale-105 hover:shadow-md active:scale-95", m = "block h-6 max-h-[120px] w-full resize-none overflow-y-auto bg-transparent text-base text-zinc-900 leading-6 placeholder:text-zinc-400 focus:outline-none", h = 24, g = (e, t) => {
|
|
22
|
+
e.classList.remove(l), t.style.height = "auto";
|
|
23
|
+
let r = t.scrollHeight > h + 4;
|
|
24
|
+
return e.classList.toggle(l, r), n(t, 120), r;
|
|
25
|
+
}, _ = "ai-chat-pill-label pointer-events-none absolute inset-y-0 left-0 flex max-w-full items-center truncate bg-clip-text font-semibold text-[15px] text-transparent", v = {
|
|
26
|
+
backgroundColor: "var(--color-brand, #0a0a0a)",
|
|
27
|
+
color: "var(--color-brand-foreground, #fff)"
|
|
28
|
+
}, y = (e) => e ? `Ask ${e}` : "Ask AI";
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as _, p as a, o as c, l as d, m as f, n as g, y as h, _ as i, f as l, g as m, a as n, v as o, i as p, u as r, s, d as t, c as u, e as v, t as y };
|