@levo-so/studio 0.3.10 → 0.3.12
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-CvRmZGdq.js → BillingStep-BG4hhiaE.js} +1 -1
- package/{Button-Dza3e6Mv.js → Button-CYXSFoBr.js} +1 -1
- package/{EntryCard-BpcaCqXU.js → EntryCard-Btvieg4y.js} +1 -1
- package/{KBChatWidget-ChIYlltB.js → KBChatWidget-aK7vt64V.js} +280 -281
- package/{LoginCard-B_anBE4b.js → LoginCard-HUsLBH9Y.js} +1 -1
- package/{PendingApprovalCard-DbYp0nSk.js → PendingApprovalCard-Cf58Fj0h.js} +1 -1
- package/{PopupBody-BI-MJqmd-BrzdFaaE.js → PopupBody-BI-MJqmd-Cj3VgwnW.js} +1 -1
- package/{PopupRenderer-D66Gx63H-GHfJebm6.js → PopupRenderer-D66Gx63H-CU-scfrr.js} +1 -1
- package/{ProfileCard-DmAnVf5R.js → ProfileCard-WC8XhXzF.js} +1 -1
- package/{bookingCard-CLhIpOpR.js → bookingCard-CmsUeDr3.js} +2 -2
- package/collection.d.ts +6 -0
- package/collection.js +1 -1
- package/{dist-D5mTOitS.js → dist-CveI0e3_.js} +56 -51
- package/index.d.ts +7 -1
- package/index.js +6 -6
- package/kbChat-DfcTNf0n.js +173 -0
- package/package.json +4 -4
- package/{pillChrome-wmdnlFIE.js → pillChrome-QDjBETmP.js} +7 -7
- package/kbChat-BLHDnA-T.js +0 -173
package/kbChat-BLHDnA-T.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { S as e, a as t, c as n, f as r, h as i, l as a, m as o, n as s, o as c, p as l, r as u, t as d, u as f } from "./pillChrome-wmdnlFIE.js";
|
|
3
|
-
import { useEffect as p, useRef as m, useState as h } from "react";
|
|
4
|
-
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
5
|
-
import { ArrowUp as v, Sparkles as y } from "lucide-react";
|
|
6
|
-
//#region ../../libraries/ai-chat/src/useActiveAgent.ts
|
|
7
|
-
var b = (t) => e("active_agent", t), x = (e) => {
|
|
8
|
-
let t = b(e);
|
|
9
|
-
if (!t || typeof window > "u") return null;
|
|
10
|
-
try {
|
|
11
|
-
let e = window.sessionStorage.getItem(t);
|
|
12
|
-
if (!e) return null;
|
|
13
|
-
let n = JSON.parse(e);
|
|
14
|
-
return typeof n?.id != "string" || n.id.length === 0 ? null : n;
|
|
15
|
-
} catch {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
}, S = (e, t) => {
|
|
19
|
-
let n = b(e);
|
|
20
|
-
if (!(!n || typeof window > "u")) try {
|
|
21
|
-
t === null ? window.sessionStorage.removeItem(n) : window.sessionStorage.setItem(n, JSON.stringify(t));
|
|
22
|
-
} catch {}
|
|
23
|
-
}, C = ({ url: e, workspaceId: t, headers: n, path: r }) => {
|
|
24
|
-
let [i, a] = h({ status: "loading" });
|
|
25
|
-
p(() => {
|
|
26
|
-
let e = x(t);
|
|
27
|
-
a(e ? {
|
|
28
|
-
status: "ready",
|
|
29
|
-
agent: e
|
|
30
|
-
} : (e) => e.status === "ready" ? { status: "loading" } : e);
|
|
31
|
-
}, [t]);
|
|
32
|
-
let o = m(n);
|
|
33
|
-
return o.current = n, p(() => {
|
|
34
|
-
if (!t || !e) return;
|
|
35
|
-
let n = r ? `${e}${e.includes("?") ? "&" : "?"}path=${encodeURIComponent(r)}` : e, i = new AbortController();
|
|
36
|
-
return (async () => {
|
|
37
|
-
try {
|
|
38
|
-
let e = await fetch(n, {
|
|
39
|
-
method: "GET",
|
|
40
|
-
credentials: "include",
|
|
41
|
-
headers: o.current,
|
|
42
|
-
signal: i.signal
|
|
43
|
-
});
|
|
44
|
-
if (!e.ok) {
|
|
45
|
-
S(t, null), a({ status: "missing" });
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
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
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
S(t, r), a({
|
|
54
|
-
status: "ready",
|
|
55
|
-
agent: r
|
|
56
|
-
});
|
|
57
|
-
} catch (e) {
|
|
58
|
-
if (e?.name === "AbortError") return;
|
|
59
|
-
console.warn("[levo-kb-chat] active-agent boot failed:", e), a({ status: "error" });
|
|
60
|
-
}
|
|
61
|
-
})(), () => i.abort();
|
|
62
|
-
}, [
|
|
63
|
-
t,
|
|
64
|
-
e,
|
|
65
|
-
r
|
|
66
|
-
]), i;
|
|
67
|
-
}, w = (...e) => e.filter(Boolean).join(" "), T = () => import("./KBChatWidget-ChIYlltB.js"), E = (e) => {
|
|
68
|
-
let [t, n] = h(null), [r, i] = h(!1), [a, o] = h("");
|
|
69
|
-
return t ? /* @__PURE__ */ g(t, {
|
|
70
|
-
initialOpen: !0,
|
|
71
|
-
initialDraft: a,
|
|
72
|
-
...e
|
|
73
|
-
}) : /* @__PURE__ */ g(O, {
|
|
74
|
-
siteName: e.siteName,
|
|
75
|
-
draft: a,
|
|
76
|
-
loading: r,
|
|
77
|
-
onDraftChange: o,
|
|
78
|
-
onActivate: () => {
|
|
79
|
-
r || t || (i(!0), T().then((e) => n(() => e.KBChatWidget)).catch((e) => {
|
|
80
|
-
i(!1), console.warn("[levo-kb-chat] widget load failed:", e);
|
|
81
|
-
}));
|
|
82
|
-
},
|
|
83
|
-
onPrefetch: () => {
|
|
84
|
-
T().catch(() => {});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}, D = () => /* @__PURE__ */ g("span", {
|
|
88
|
-
"aria-hidden": !0,
|
|
89
|
-
className: "h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
90
|
-
}), O = ({ siteName: e, draft: p, loading: b, onDraftChange: x, onActivate: S, onPrefetch: C }) => {
|
|
91
|
-
let T = m(null), E = m(null), O = i(e), [k, A] = h(!1);
|
|
92
|
-
return /* @__PURE__ */ g("div", {
|
|
93
|
-
onPointerEnter: C,
|
|
94
|
-
className: w("ai-chat-launcher fixed bottom-8 left-1/2 z-[60] -translate-x-1/2", l),
|
|
95
|
-
children: /* @__PURE__ */ g("div", {
|
|
96
|
-
className: w(s, n, "ai-chat-intro-morph"),
|
|
97
|
-
children: /* @__PURE__ */ _("div", {
|
|
98
|
-
ref: E,
|
|
99
|
-
className: w(f, k && "ai-chat-pill-surface--stacked"),
|
|
100
|
-
children: [
|
|
101
|
-
/* @__PURE__ */ g("button", {
|
|
102
|
-
type: "button",
|
|
103
|
-
onClick: S,
|
|
104
|
-
onFocus: C,
|
|
105
|
-
"aria-label": "Open AI chat",
|
|
106
|
-
className: a,
|
|
107
|
-
children: b ? /* @__PURE__ */ g(D, {}) : /* @__PURE__ */ g(y, { className: "h-5 w-5" })
|
|
108
|
-
}),
|
|
109
|
-
/* @__PURE__ */ _("div", {
|
|
110
|
-
className: u,
|
|
111
|
-
children: [/* @__PURE__ */ g("textarea", {
|
|
112
|
-
ref: T,
|
|
113
|
-
rows: 1,
|
|
114
|
-
autoComplete: "off",
|
|
115
|
-
autoCorrect: "off",
|
|
116
|
-
autoCapitalize: "none",
|
|
117
|
-
inputMode: "text",
|
|
118
|
-
value: p,
|
|
119
|
-
"aria-label": O,
|
|
120
|
-
onFocus: S,
|
|
121
|
-
onChange: (e) => {
|
|
122
|
-
let t = e.currentTarget;
|
|
123
|
-
x(t.value), E.current && A(o(E.current, t));
|
|
124
|
-
},
|
|
125
|
-
className: r
|
|
126
|
-
}), !p && /* @__PURE__ */ g("span", {
|
|
127
|
-
className: w("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", "ai-chat-intro-label"),
|
|
128
|
-
"aria-hidden": !0,
|
|
129
|
-
children: O
|
|
130
|
-
})]
|
|
131
|
-
}),
|
|
132
|
-
/* @__PURE__ */ g("div", {
|
|
133
|
-
className: d,
|
|
134
|
-
children: /* @__PURE__ */ g("button", {
|
|
135
|
-
type: "button",
|
|
136
|
-
onClick: S,
|
|
137
|
-
"aria-label": "Open AI chat",
|
|
138
|
-
className: t,
|
|
139
|
-
style: c,
|
|
140
|
-
children: b ? /* @__PURE__ */ g(D, {}) : /* @__PURE__ */ g(v, { className: "h-5 w-5 stroke-[2.5px]" })
|
|
141
|
-
})
|
|
142
|
-
})
|
|
143
|
-
]
|
|
144
|
-
})
|
|
145
|
-
})
|
|
146
|
-
});
|
|
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({
|
|
149
|
-
url: `${A(i)}/v1/intelligence/site-agent/get-active`,
|
|
150
|
-
workspaceId: e,
|
|
151
|
-
headers: e ? {
|
|
152
|
-
...a,
|
|
153
|
-
"Levo-Workspace": e
|
|
154
|
-
} : a,
|
|
155
|
-
path: c
|
|
156
|
-
});
|
|
157
|
-
return l.status === "ready" ? /* @__PURE__ */ g("div", {
|
|
158
|
-
"data-ai-chat-root": !0,
|
|
159
|
-
children: /* @__PURE__ */ g(E, {
|
|
160
|
-
workspaceId: e,
|
|
161
|
-
siteName: t,
|
|
162
|
-
siteLogo: n,
|
|
163
|
-
siteIcon: r,
|
|
164
|
-
agentId: l.agent.id,
|
|
165
|
-
apiBaseUrl: i,
|
|
166
|
-
authHeaders: a,
|
|
167
|
-
showBranding: o,
|
|
168
|
-
siteSlug: s
|
|
169
|
-
})
|
|
170
|
-
}) : null;
|
|
171
|
-
};
|
|
172
|
-
//#endregion
|
|
173
|
-
export { j as default };
|