@levo-so/studio 0.1.114 → 0.2.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.
Files changed (49) hide show
  1. package/{BillingStep-DjNmSVkY.js → BillingStep-D4P_J_PJ.js} +1 -1
  2. package/Button-CmwbMGFV.js +505 -0
  3. package/{CollectionField-DrJuHNsg.js → CollectionField-D25BVweU.js} +29 -77
  4. package/{DateTimeWidget-CzBq92zC.js → DateTimeWidget-CG9ylSgA.js} +8 -8
  5. package/{EntryCard-C2KA5HMX.js → EntryCard-FxB1uCis.js} +4 -4
  6. package/{KBChatWidget-CPrg_etS.js → KBChatWidget-_kcueoxi.js} +388 -360
  7. package/{LoginCard-S_2jls6v.js → LoginCard-D8ZVZjbR.js} +3 -3
  8. package/{LoginForm-DeYsk4kd.js → LoginForm-Cg5F4guy.js} +2 -2
  9. package/{LoginModal-BbDfB4S9.js → LoginModal-Cn6Nsuz3.js} +4 -4
  10. package/{MessageCard-x6jPClGi.js → MessageCard-Bx6pC8wW.js} +2 -2
  11. package/{MessageFooter-CHuPnL_D.js → MessageFooter-CsY4uBIJ.js} +2 -2
  12. package/{ModalManager-DQVNPEuG.js → ModalManager-BIKunQ8D.js} +1 -1
  13. package/{PendingApprovalCard-C06B_Tg-.js → PendingApprovalCard-0ORO4y9v.js} +3 -3
  14. package/{PhoneWidget-DdX8_-2v.js → PhoneWidget-CZr1PZ4G.js} +3 -3
  15. package/{PopupRenderer-Bncp54gB-DysCmUdR.js → PopupRenderer-Bncp54gB-BOJj-taW.js} +15 -16
  16. package/{ProfileCard-DGanb4BY.js → ProfileCard-C2lXYYkC.js} +9 -8
  17. package/RichTextWidget-Dcq-NsEi.js +748 -0
  18. package/{RteThemeProvider-LFGzAYi1.js → RteThemeProvider-DxYOzcck.js} +1 -1
  19. package/Spinner-wdUA5kVe.js +7 -0
  20. package/{StripePaymentModal-BsYNQ4MB.js → StripePaymentModal-DfFlmYsp.js} +17 -17
  21. package/{bookingCard-CUv7WgqT.js → bookingCard-CZ3Jj9sL.js} +218 -217
  22. package/{dialog-LRLdr3kq.js → dialog-CznAfWcE.js} +32 -32
  23. package/{dist-D-y51gmU.js → dist-B91ZHPA-.js} +1103 -1261
  24. package/index.d.ts +0 -2
  25. package/index.js +2719 -2269
  26. package/kbChat-BpJkUcpv.js +163 -0
  27. package/{nodeAlignment-BC_Uferw.js → nodeAlignment-DS9_DLGB.js} +31 -23
  28. package/package.json +10 -10
  29. package/pillChrome-B4uuWJhY.js +16 -0
  30. package/studio.css +1 -1
  31. package/{useLogin-B2HHZxTi.js → useLogin-mEuzGlb2.js} +1 -1
  32. package/Button-Uwxgkriw.js +0 -1657
  33. package/RichTextWidget-BfZ3sCcx.js +0 -113
  34. package/Toolbar-6IXR9qAh.js +0 -645
  35. package/collection.d.ts +0 -500
  36. package/collection.js +0 -30
  37. package/inlineRteTheme-abXxag3B.js +0 -9
  38. package/kbChat-DCrdcXir.js +0 -166
  39. package/pillChrome-CQoJfFk3.js +0 -16
  40. package/utils-NDllPDUz.js +0 -5
  41. /package/{AuthProvider-C6bvedwF.js → AuthProvider-CFQqiIf1.js} +0 -0
  42. /package/{Beams-DboMUgCv.js → Beams-CDt4Mt3M.js} +0 -0
  43. /package/{Dots-a8xSboDv.js → Dots-DadBreAs.js} +0 -0
  44. /package/{Gradient-NacpoDCM.js → Gradient-CPoU73FR.js} +0 -0
  45. /package/{Grid-BJQvxnks.js → Grid-CAXyHMvM.js} +0 -0
  46. /package/{Popover-C_IQMM8H.js → Popover-Dt4--ulK.js} +0 -0
  47. /package/{Waves-DUuT_IFr.js → Waves-DPbfUhRX.js} +0 -0
  48. /package/{authentication-TdyaDNTn.js → authentication-BSNkm1-l.js} +0 -0
  49. /package/{card-D5fPArfa.js → card-DFSlAwCq.js} +0 -0
@@ -0,0 +1,163 @@
1
+ "use client";
2
+ import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, n as s, p as c, s as l, t as u, u as d } from "./pillChrome-B4uuWJhY.js";
3
+ import { useEffect as f, useRef as p, useState as m } from "react";
4
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import { ArrowUp as _, Sparkles as v } from "lucide-react";
6
+ //#region ../../libraries/ai-chat/src/useActiveAgent.ts
7
+ var y = (e) => i("active_agent", e), b = (e) => {
8
+ let t = y(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
+ }, x = (e, t) => {
19
+ let n = y(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
+ }, S = ({ url: e, workspaceId: t, headers: n }) => {
24
+ let [r, i] = m({ status: "loading" });
25
+ f(() => {
26
+ let e = b(t);
27
+ i(e ? {
28
+ status: "ready",
29
+ agent: e
30
+ } : (e) => e.status === "ready" ? { status: "loading" } : e);
31
+ }, [t]);
32
+ let a = p(n);
33
+ return a.current = n, f(() => {
34
+ if (!t || !e) return;
35
+ let n = new AbortController();
36
+ return (async () => {
37
+ try {
38
+ let r = await fetch(e, {
39
+ method: "GET",
40
+ credentials: "include",
41
+ headers: a.current,
42
+ signal: n.signal
43
+ });
44
+ if (!r.ok) {
45
+ x(t, null), i({ status: "missing" });
46
+ return;
47
+ }
48
+ let o = (await r.json())?.content?.data;
49
+ if (!o || typeof o.id != "string" || o.id.length === 0) {
50
+ x(t, null), i({ status: "missing" });
51
+ return;
52
+ }
53
+ x(t, o), i({
54
+ status: "ready",
55
+ agent: o
56
+ });
57
+ } catch (e) {
58
+ if (e?.name === "AbortError") return;
59
+ console.warn("[levo-kb-chat] active-agent boot failed:", e), i({ status: "error" });
60
+ }
61
+ })(), () => n.abort();
62
+ }, [t, e]), r;
63
+ }, C = (...e) => e.filter(Boolean).join(" "), w = () => import("./KBChatWidget-_kcueoxi.js"), T = (e) => {
64
+ let [t, n] = m(null), [r, i] = m(!1), [a, o] = m("");
65
+ return t ? /* @__PURE__ */ h(t, {
66
+ initialOpen: !0,
67
+ initialDraft: a,
68
+ ...e
69
+ }) : /* @__PURE__ */ h(D, {
70
+ siteName: e.siteName,
71
+ draft: a,
72
+ loading: r,
73
+ onDraftChange: o,
74
+ onActivate: () => {
75
+ r || t || (i(!0), w().then((e) => n(() => e.KBChatWidget)).catch((e) => {
76
+ i(!1), console.warn("[levo-kb-chat] widget load failed:", e);
77
+ }));
78
+ },
79
+ onPrefetch: () => {
80
+ w().catch(() => {});
81
+ }
82
+ });
83
+ }, E = () => /* @__PURE__ */ h("span", {
84
+ "aria-hidden": !0,
85
+ className: "h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent"
86
+ }), D = ({ siteName: i, draft: f, loading: m, onDraftChange: y, onActivate: b, onPrefetch: x }) => {
87
+ let S = p(null), w = r(i);
88
+ return /* @__PURE__ */ h("div", {
89
+ onPointerEnter: x,
90
+ className: C("ai-chat-launcher fixed bottom-8 left-1/2 z-[60] -translate-x-1/2", n),
91
+ children: /* @__PURE__ */ h("div", {
92
+ className: C(u, l, "ai-chat-intro-morph"),
93
+ children: /* @__PURE__ */ g("div", {
94
+ className: o,
95
+ children: [
96
+ /* @__PURE__ */ h("button", {
97
+ type: "button",
98
+ onClick: b,
99
+ onFocus: x,
100
+ "aria-label": "Open AI chat",
101
+ className: t,
102
+ children: m ? /* @__PURE__ */ h(E, {}) : /* @__PURE__ */ h(v, { className: "h-5 w-5" })
103
+ }),
104
+ /* @__PURE__ */ g("div", {
105
+ className: s,
106
+ children: [/* @__PURE__ */ h("textarea", {
107
+ ref: S,
108
+ rows: 1,
109
+ autoComplete: "off",
110
+ autoCorrect: "off",
111
+ autoCapitalize: "none",
112
+ inputMode: "text",
113
+ value: f,
114
+ "aria-label": w,
115
+ onFocus: b,
116
+ onChange: (e) => {
117
+ y(e.currentTarget.value), c(e.currentTarget, 120);
118
+ },
119
+ className: d
120
+ }), !f && /* @__PURE__ */ h("span", {
121
+ className: C("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"),
122
+ "aria-hidden": !0,
123
+ children: w
124
+ })]
125
+ }),
126
+ /* @__PURE__ */ h("button", {
127
+ type: "button",
128
+ onClick: b,
129
+ "aria-label": "Open AI chat",
130
+ className: a,
131
+ style: e,
132
+ children: m ? /* @__PURE__ */ h(E, {}) : /* @__PURE__ */ h(_, { className: "h-5 w-5 stroke-[2.5px]" })
133
+ })
134
+ ]
135
+ })
136
+ })
137
+ });
138
+ }, O = "/.levo/public/api/v1/agents/kb-chat/public", k = (e) => e.replace(/\/v1\/agents\/kb-chat\/public\/?$/, ""), A = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, apiBaseUrl: i = O, authHeaders: a, showBranding: o, siteSlug: s }) => {
139
+ let c = S({
140
+ url: `${k(i)}/v1/intelligence/site-agent/get-active`,
141
+ workspaceId: e,
142
+ headers: e ? {
143
+ ...a,
144
+ "Levo-Workspace": e
145
+ } : a
146
+ });
147
+ return c.status === "ready" ? /* @__PURE__ */ h("div", {
148
+ "data-ai-chat-root": !0,
149
+ children: /* @__PURE__ */ h(T, {
150
+ workspaceId: e,
151
+ siteName: t,
152
+ siteLogo: n,
153
+ siteIcon: r,
154
+ agentId: c.agent.id,
155
+ apiBaseUrl: i,
156
+ authHeaders: a,
157
+ showBranding: o,
158
+ siteSlug: s
159
+ })
160
+ }) : null;
161
+ };
162
+ //#endregion
163
+ export { A as default };
@@ -1,23 +1,31 @@
1
- import { Extension as e, findParentNodeClosestToPos as t } from "@tiptap/core";
2
- import { NodeSelection as n } from "@tiptap/pm/state";
3
- import { CellSelection as r, cellAround as i } from "@tiptap/pm/tables";
1
+ import { n as e } from "./theme.cssm-2YTdd8Yh.js";
2
+ import { Extension as t, findParentNodeClosestToPos as n } from "@tiptap/core";
3
+ import { NodeSelection as r } from "@tiptap/pm/state";
4
+ import { CellSelection as i, cellAround as a } from "@tiptap/pm/tables";
5
+ //#region ../../libraries/editor-core/dist/styles/content.cssm.js
6
+ var o = "_12oclrg0", s = "u2k86a0", c = e({
7
+ baseSpacing: "var(--_1q6hy0o0)",
8
+ highlight: "var(--_1q6hy0o1)",
9
+ highlightForeground: "var(--_1q6hy0o2)"
10
+ });
11
+ //#endregion
4
12
  //#region ../../libraries/editor-core/dist/utils/getSelectedNodeOfType.js
5
- function a(e, a) {
6
- let o = [], s = new Set(a);
7
- if (e instanceof r) return e.forEachCell((e, t) => {
13
+ function l(e, t) {
14
+ let o = [], s = new Set(t);
15
+ if (e instanceof i) return e.forEachCell((e, t) => {
8
16
  s.has(e.type.name) && o.push({
9
17
  node: e,
10
18
  pos: t
11
19
  });
12
20
  }), o;
13
- if (e instanceof n) {
21
+ if (e instanceof r) {
14
22
  let { node: t, from: n } = e;
15
23
  return t && s.has(t.type.name) && o.push({
16
24
  node: t,
17
25
  pos: n
18
26
  }), o;
19
27
  }
20
- let { $anchor: c } = e, l = i(c);
28
+ let { $anchor: c } = e, l = a(c);
21
29
  if (l) {
22
30
  let t = e.$anchor.doc.nodeAt(l.pos);
23
31
  if (t && s.has(t.type.name)) return o.push({
@@ -25,7 +33,7 @@ function a(e, a) {
25
33
  pos: l.pos
26
34
  }), o;
27
35
  }
28
- let u = t(c, (e) => s.has(e.type.name));
36
+ let u = n(c, (e) => s.has(e.type.name));
29
37
  return u && o.push({
30
38
  node: u.node,
31
39
  pos: u.pos
@@ -33,7 +41,7 @@ function a(e, a) {
33
41
  }
34
42
  //#endregion
35
43
  //#region ../../libraries/editor-core/dist/utils/updateNodesAttr.js
36
- function o(e, t, n, r) {
44
+ function u(e, t, n, r) {
37
45
  if (!t.length) return !1;
38
46
  let i = !1;
39
47
  for (let { pos: a } of t) {
@@ -48,12 +56,12 @@ function o(e, t, n, r) {
48
56
  }
49
57
  //#endregion
50
58
  //#region ../../libraries/editor-core/dist/extensions/nodeStyling/nodeAlignment.js
51
- function s(e, t, n) {
59
+ function d(e, t, n) {
52
60
  if (e.length === 0) return null;
53
61
  for (let r of e) if ((r.node.attrs?.[t] ?? null) !== n) return n;
54
62
  return null;
55
63
  }
56
- var c = e.create({
64
+ var f = t.create({
57
65
  name: "textAlign",
58
66
  addOptions() {
59
67
  return {
@@ -114,28 +122,28 @@ var c = e.create({
114
122
  },
115
123
  addCommands() {
116
124
  let e = (e, t) => (n) => ({ state: r, tr: i }) => {
117
- let s = a(r.selection, this.options.types);
118
- return s.length === 0 ? !1 : o(i, s, e, t(s, n));
125
+ let a = l(r.selection, this.options.types);
126
+ return a.length === 0 ? !1 : u(i, a, e, t(a, n));
119
127
  };
120
128
  return {
121
129
  setNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : t),
122
130
  unsetNodeTextAlign: e("textAlign", () => null),
123
- toggleNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : s(e, "textAlign", t)),
131
+ toggleNodeTextAlign: e("textAlign", (e, t) => !t || !this.options.textAlignValues.includes(t) ? null : d(e, "textAlign", t)),
124
132
  setNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : t),
125
133
  unsetNodeVAlign: e("nodeVerticalAlign", () => null),
126
- toggleNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : s(e, "nodeVerticalAlign", t)),
134
+ toggleNodeVAlign: e("nodeVerticalAlign", (e, t) => !t || !this.options.verticalAlignValues.includes(t) ? null : d(e, "nodeVerticalAlign", t)),
127
135
  setNodeAlignment: (e, t) => ({ state: n, tr: r }) => {
128
- let i = a(n.selection, this.options.types);
136
+ let i = l(n.selection, this.options.types);
129
137
  if (i.length === 0) return !1;
130
- let o = !1;
131
- for (let { node: n, pos: a } of i) {
138
+ let a = !1;
139
+ for (let { node: n, pos: o } of i) {
132
140
  let i = { ...n.attrs };
133
- e && this.options.textAlignValues.includes(e) && (i.textAlign = e, o = !0), t && this.options.verticalAlignValues.includes(t) && (i.nodeVerticalAlign = t, o = !0), o && r.setNodeMarkup(a, void 0, i);
141
+ e && this.options.textAlignValues.includes(e) && (i.textAlign = e, a = !0), t && this.options.verticalAlignValues.includes(t) && (i.nodeVerticalAlign = t, a = !0), a && r.setNodeMarkup(o, void 0, i);
134
142
  }
135
- return o;
143
+ return a;
136
144
  },
137
145
  unsetNodeAlignment: () => ({ state: e, tr: t }) => {
138
- let n = a(e.selection, this.options.types);
146
+ let n = l(e.selection, this.options.types);
139
147
  if (n.length === 0) return !1;
140
148
  let r = !1;
141
149
  for (let { node: e, pos: i } of n) {
@@ -155,4 +163,4 @@ var c = e.create({
155
163
  }
156
164
  });
157
165
  //#endregion
158
- export { o as n, a as r, c as t };
166
+ export { s as a, c as i, u as n, o, l as r, f as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/studio",
3
- "version": "0.1.114",
3
+ "version": "0.2.1",
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",
@@ -18,10 +18,6 @@
18
18
  "types": "./index.d.ts",
19
19
  "default": "./index.js"
20
20
  },
21
- "./collection": {
22
- "types": "./collection.d.ts",
23
- "default": "./collection.js"
24
- },
25
21
  "./setup.css": "./studio.css"
26
22
  },
27
23
  "files": [
@@ -83,8 +79,12 @@
83
79
  "@nanostores/persistent": "1.3.3",
84
80
  "@nanostores/react": "0.8.4",
85
81
  "nanostores": "0.11.4",
82
+ "@assistant-ui/react": "0.12.14",
86
83
  "@assistant-ui/react-ai-sdk": "1.3.10",
87
84
  "@assistant-ui/react-markdown": "0.12.5",
85
+ "@assistant-ui/core": "0.1.5",
86
+ "@assistant-ui/store": "0.2.2",
87
+ "@assistant-ui/tap": "0.5.2",
88
88
  "remark-gfm": "4.0.1",
89
89
  "@emotion/is-prop-valid": "1.3.1",
90
90
  "@stripe/react-stripe-js": "3.1.1",
@@ -112,15 +112,15 @@
112
112
  "react-razorpay": "3.0.1",
113
113
  "react-select": "5.10.1",
114
114
  "use-debounce": "10.0.2",
115
- "yup": "1.7.1"
115
+ "yup": "1.7.1",
116
+ "@levo/utils": "0.0.0"
116
117
  },
117
118
  "peerDependencies": {
118
- "@assistant-ui/react": ">=0.12",
119
119
  "react": ">=19",
120
120
  "next": ">=14",
121
121
  "react-dom": ">=19",
122
- "@levo-so/react": "0.1.113",
123
- "@levo-so/insights": "0.1.113",
124
- "@levo-so/core": "0.1.113"
122
+ "@levo-so/insights": "0.2.1",
123
+ "@levo-so/core": "0.2.1",
124
+ "@levo-so/react": "0.2.1"
125
125
  }
126
126
  }
@@ -0,0 +1,16 @@
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 = "w-72", i = "ai-chat-pill-gradient relative rounded-full p-[2px] transition-shadow duration-300", a = "shadow-lg shadow-zinc-950/10", o = "shadow-md", s = "flex min-h-14 w-full items-end gap-1.5 rounded-full bg-white p-1.5", c = "relative min-w-0 flex-1 py-2.5", l = "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", u = "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", d = "block h-6 max-h-[120px] w-full resize-none overflow-hidden bg-transparent text-base text-zinc-900 leading-6 placeholder:text-zinc-400 focus:outline-none", f = "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", p = {
12
+ backgroundColor: "var(--color-brand, #0a0a0a)",
13
+ color: "var(--color-brand-foreground, #fff)"
14
+ }, m = (e) => e ? `Ask ${e}` : "Ask AI";
15
+ //#endregion
16
+ export { p as a, l as c, r as d, m as f, t as h, u as i, s as l, e as m, c as n, o, n as p, f as r, a as s, i as t, d as u };