@factorialco/f0-react 1.408.0 → 1.409.0

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.
@@ -1 +1 @@
1
- .grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle,.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing,.grid-stack-animate .grid-stack-item.grid-stack-placeholder{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0%}.grid-stack-item .ui-resizable-handle{bottom:12px;right:12px;--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));overflow:hidden;border-radius:.625rem}.grid-stack-item .ui-resizable-se:after{content:"";position:absolute;inset:0;background-image:url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.1904 11.6904C17.4443 11.4366 17.8565 11.4366 18.1104 11.6904C18.3641 11.9443 18.3642 12.3565 18.1104 12.6104L12.6104 18.1104C12.3565 18.3642 11.9443 17.3641 11.6904 18.1104C11.4366 17.8565 11.4366 17.4443 11.6904 17.1904L17.1904 11.6904ZM16.1904 6.19043C16.4443 5.93659 16.8565 5.93659 17.1104 6.19043C17.3641 6.44427 17.3642 6.85653 17.1104 7.11035L7.11035 17.1104C6.85653 17.3642 6.44427 17.3641 6.19043 17.1104C5.93659 16.8565 5.93659 16.4443 6.19043 16.1904L16.1904 6.19043Z' fill='%23A1ABBD'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center;background-size:contain;width:100%;height:100%;background-color:#fff}.ui-draggable-dragging>.grid-stack-item-content{background-color:transparent!important;--tw-shadow: 0 0 #0000 !important;--tw-shadow-colored: 0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui-draggable-dragging>.grid-stack-item-content>*{transform-origin:24px 24px;--tw-scale-x: .95 !important;--tw-scale-y: .95 !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important;cursor:grabbing;border-radius:.875rem;border-color:hsl(var(--neutral-40));--tw-shadow: 0 6px 12px 0 hsl(var(--shadow)/.06),0 16px 24px -12px hsl(var(--shadow)/.05);--tw-shadow-colored: 0 6px 12px 0 var(--tw-shadow-color), 0 16px 24px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui.draggable-dragging{cursor:grabbing!important}.grid-stack-placeholder>.placeholder-content{border-radius:.875rem;background-color:hsl(var(--neutral-100) / .05);opacity:.5;--tw-blur: blur(2px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grid-stack-item>.grid-stack-item-content{overflow:visible!important}.ui-resizable-resizing>.grid-stack-item-content{border-radius:.875rem}
1
+ .grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0;top:0;left:0;width:var(--gs-column-width);height:var(--gs-cell-height)}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack>.grid-stack-item>.grid-stack-item-content,.grid-stack>.grid-stack-placeholder>.placeholder-content{top:var(--gs-item-margin-top);right:var(--gs-item-margin-right);bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle,.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23666" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 20 20"><path d="m10 3 2 2H8l2-2v14l-2-2h4l-2 2"/></svg>');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:var(--gs-item-margin-top);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:var(--gs-item-margin-top);left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:var(--gs-item-margin-top);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px;right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);right:var(--gs-item-margin-right)}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:var(--gs-item-margin-bottom);right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;bottom:var(--gs-item-margin-bottom);left:var(--gs-item-margin-left)}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px;left:var(--gs-item-margin-left)}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing,.grid-stack-animate .grid-stack-item.grid-stack-placeholder{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0%}.grid-stack-item .ui-resizable-handle{bottom:12px;right:12px;--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));overflow:hidden;border-radius:.625rem}.grid-stack-item .ui-resizable-se:after{content:"";position:absolute;inset:0;background-image:url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.1904 11.6904C17.4443 11.4366 17.8565 11.4366 18.1104 11.6904C18.3641 11.9443 18.3642 12.3565 18.1104 12.6104L12.6104 18.1104C12.3565 18.3642 11.9443 17.3641 11.6904 18.1104C11.4366 17.8565 11.4366 17.4443 11.6904 17.1904L17.1904 11.6904ZM16.1904 6.19043C16.4443 5.93659 16.8565 5.93659 17.1104 6.19043C17.3641 6.44427 17.3642 6.85653 17.1104 7.11035L7.11035 17.1104C6.85653 17.3642 6.44427 17.3641 6.19043 17.1104C5.93659 16.8565 5.93659 16.4443 6.19043 16.1904L16.1904 6.19043Z' fill='%23A1ABBD'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center;background-size:contain;width:100%;height:100%;background-color:#fff}.ui-draggable-dragging>.grid-stack-item-content{background-color:transparent!important;--tw-shadow: 0 0 #0000 !important;--tw-shadow-colored: 0 0 #0000 !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)!important;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui-draggable-dragging>.grid-stack-item-content>*{transform-origin:24px 24px;--tw-scale-x: .95 !important;--tw-scale-y: .95 !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important;cursor:grabbing;border-radius:.875rem;border-color:hsl(var(--neutral-40));--tw-shadow: 0 6px 12px 0 hsl(var(--shadow)/.06),0 16px 24px -12px hsl(var(--shadow)/.05);--tw-shadow-colored: 0 6px 12px 0 var(--tw-shadow-color), 0 16px 24px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.ui.draggable-dragging{cursor:grabbing!important}.grid-stack-placeholder>.placeholder-content{border-radius:.875rem;background-color:hsl(var(--neutral-100) / .05);opacity:.5;--tw-blur: blur(2px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grid-stack-item>.grid-stack-item-content{overflow:visible!important}.ui-resizable-resizing>.grid-stack-item-content{border-radius:.875rem}._rfx31ssb:before{border-radius:50%}._15m6ys7w:before{border-color:var(--stroke-color)}._3l8810ly:before{border-width:var(--stroke-width)}._kzdanqa1:before{border-style:solid}._13y0usvi:before{box-sizing:border-box}._154ifghn{top:var(--line-main-axis-start)}._154ihv0e{top:var(--main-axis-offset)}._19wo70hn:before{bottom:var(--terminal-cross-axis-offset)}._1auk70hn:before{top:var(--terminal-cross-axis-offset)}._1aukuj5p:before{top:var(--terminal-main-axis-start)}._1bsb10ly{width:var(--stroke-width)}._1cs8stnw:before{position:absolute}._1e02fghn{inset-inline-start:var(--line-main-axis-start)}._1e0c1ule{display:block}._1kt9b3bt:before{content:""}._1ltvhv0e{left:var(--main-axis-offset)}._1mp4vjfa:before{width:var(--terminal-diameter)}._1pbykb7n{z-index:1}._1xi2hv0e{right:var(--main-axis-offset)}._4t3i10ly{height:var(--stroke-width)}._94n5hv0e{bottom:var(--main-axis-offset)}._94n5idpf{bottom:0}._bfhkys7w{background-color:var(--stroke-color)}._cfu11ld9:before{display:var(--terminal-display)}._kfgtvjfa:before{height:var(--terminal-diameter)}._kqswstnw{position:absolute}._lcxvglyw{pointer-events:none}._ooun70hn:before{right:var(--terminal-cross-axis-offset)}._qnec70hn:before{left:var(--terminal-cross-axis-offset)}._rjxpidpf{inset-inline-end:0}._z5wtuj5p:before{inset-inline-start:var(--terminal-main-axis-start)}
@@ -0,0 +1,292 @@
1
+ import { jsx as $ } from "react/jsx-runtime";
2
+ import { useRef as w, useCallback as v, useState as j, useEffect as R, useMemo as D } from "react";
3
+ import { F as P } from "./F0AnalyticsDashboard-BpLckkpk.js";
4
+ function _(t, e, n) {
5
+ const r = w(null), y = w(), i = w(t);
6
+ i.current = t;
7
+ const l = w(e);
8
+ l.current = e;
9
+ const b = w(n);
10
+ b.current = n;
11
+ const u = v(
12
+ (h, f) => {
13
+ const S = `${b.current}:${JSON.stringify(f)}`;
14
+ if (r.current?.key === S)
15
+ return r.current.promise.then(
16
+ (d) => d.results[h] ?? { error: "No result for item" }
17
+ );
18
+ r.current?.controller.abort();
19
+ const o = new AbortController(), s = i.current, a = l.current, g = {};
20
+ for (const [d, m] of Object.entries(f))
21
+ Array.isArray(m) && m.length > 0 && (g[d] = m.map(String));
22
+ const c = {
23
+ fetchSpecs: s.fetchSpecs,
24
+ items: s.items,
25
+ filters: s.filters,
26
+ filterValues: Object.keys(g).length > 0 ? g : void 0
27
+ }, F = fetch(`${a.baseUrl}/dashboard/compute`, {
28
+ method: "POST",
29
+ credentials: "include",
30
+ headers: {
31
+ "Content-Type": "application/json",
32
+ ...a.headers
33
+ },
34
+ body: JSON.stringify(c),
35
+ signal: o.signal
36
+ }).then(async (d) => {
37
+ if (!d.ok) {
38
+ const k = await d.text().catch(() => "");
39
+ throw new Error(`Dashboard compute failed: ${d.status} ${k}`);
40
+ }
41
+ const m = await d.json();
42
+ return y.current = m, m;
43
+ });
44
+ return r.current = { key: S, promise: F, controller: o }, F.then(
45
+ (d) => d.results[h] ?? { error: "No result for item" }
46
+ );
47
+ },
48
+ []
49
+ ), p = v(
50
+ () => y.current?.filterOptions,
51
+ []
52
+ );
53
+ return { fetchItem: u, getFilterOptions: p };
54
+ }
55
+ function A(t) {
56
+ if (t)
57
+ switch (t.type) {
58
+ case "number":
59
+ return (e) => e.toLocaleString();
60
+ case "currency": {
61
+ const e = t.currency ?? "EUR";
62
+ return (n) => {
63
+ try {
64
+ return n.toLocaleString(void 0, {
65
+ style: "currency",
66
+ currency: e,
67
+ maximumFractionDigits: 0
68
+ });
69
+ } catch {
70
+ return `${n}`;
71
+ }
72
+ };
73
+ }
74
+ case "percent":
75
+ return (e) => `${e}%`;
76
+ case "compact":
77
+ return (e) => Math.abs(e) >= 1e6 ? `${(e / 1e6).toFixed(1)}M` : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : `${e}`;
78
+ default:
79
+ return;
80
+ }
81
+ }
82
+ function I(t) {
83
+ const e = A(
84
+ "valueFormat" in t ? t.valueFormat : void 0
85
+ );
86
+ switch (t.type) {
87
+ case "bar": {
88
+ const { valueFormat: n, ...r } = t;
89
+ return { ...r, ...e ? { valueFormatter: e } : {} };
90
+ }
91
+ case "line": {
92
+ const { valueFormat: n, ...r } = t;
93
+ return { ...r, ...e ? { valueFormatter: e } : {} };
94
+ }
95
+ case "funnel": {
96
+ const { valueFormat: n, ...r } = t;
97
+ return { ...r, ...e ? { valueFormatter: e } : {} };
98
+ }
99
+ case "radar": {
100
+ const { valueFormat: n, ...r } = t;
101
+ return { ...r, ...e ? { valueFormatter: e } : {} };
102
+ }
103
+ case "pie": {
104
+ const { valueFormat: n, ...r } = t;
105
+ return { ...r, ...e ? { valueFormatter: e } : {} };
106
+ }
107
+ case "gauge": {
108
+ const { valueFormat: n, ...r } = t;
109
+ return { ...r, ...e ? { valueFormatter: e } : {} };
110
+ }
111
+ case "heatmap": {
112
+ const { valueFormat: n, ...r } = t;
113
+ return { ...r, ...e ? { valueFormatter: e } : {} };
114
+ }
115
+ }
116
+ }
117
+ const x = 20;
118
+ function C({
119
+ config: t,
120
+ apiConfig: e,
121
+ refreshKey: n = 0,
122
+ editMode: r,
123
+ onLayoutChange: y
124
+ }) {
125
+ const { fetchItem: i, getFilterOptions: l } = _(
126
+ t,
127
+ e,
128
+ n
129
+ ), [b, u] = j(), p = w(!1);
130
+ R(() => {
131
+ p.current = !1;
132
+ }, [n]), R(() => {
133
+ if (p.current) return;
134
+ const o = setInterval(() => {
135
+ const s = l();
136
+ s && (u(s), p.current = !0, clearInterval(o));
137
+ }, 100);
138
+ return () => clearInterval(o);
139
+ }, [l, n]);
140
+ const h = D(() => {
141
+ const o = t.filters;
142
+ if (!o || Object.keys(o).length === 0 || !b) return;
143
+ const s = {};
144
+ for (const [a, g] of Object.entries(o)) {
145
+ const c = b[a] ?? [];
146
+ c.length !== 0 && (s[a] = {
147
+ type: "in",
148
+ label: g.label,
149
+ options: {
150
+ options: c.map((F) => ({ value: F, label: F }))
151
+ }
152
+ });
153
+ }
154
+ if (Object.keys(s).length !== 0)
155
+ return s;
156
+ }, [t.filters, b]), f = v(
157
+ (o) => (s) => {
158
+ const a = {};
159
+ for (const [g, c] of Object.entries(s))
160
+ Array.isArray(c) && c.length > 0 && (a[g] = c);
161
+ return i(o, a).then((g) => {
162
+ const c = l();
163
+ return c && !p.current && (u(c), p.current = !0), g;
164
+ });
165
+ },
166
+ [i, l]
167
+ ), S = D(
168
+ () => t.items.map((o) => {
169
+ switch (o.type) {
170
+ case "chart":
171
+ return E(o, f(o.id));
172
+ case "metric":
173
+ return L(o, f(o.id));
174
+ case "collection":
175
+ return M(o, f(o.id));
176
+ }
177
+ }),
178
+ [t.items, f]
179
+ );
180
+ return /* @__PURE__ */ $(
181
+ P,
182
+ {
183
+ filters: h,
184
+ items: S,
185
+ editMode: r,
186
+ onLayoutChange: y
187
+ },
188
+ n
189
+ );
190
+ }
191
+ C.displayName = "F0ChatDashboard";
192
+ function E(t, e) {
193
+ return {
194
+ id: t.id,
195
+ title: t.title,
196
+ description: O(t.description, t.sourceDescription),
197
+ colSpan: t.colSpan,
198
+ rowSpan: t.rowSpan,
199
+ x: t.x,
200
+ y: t.y,
201
+ type: "chart",
202
+ chart: I(t.chart),
203
+ fetchData: (n) => e(n).then((r) => r.chart ?? { categories: [], series: [] })
204
+ };
205
+ }
206
+ function O(t, e) {
207
+ return e ? t ? `${t}
208
+ ${e}` : e : t;
209
+ }
210
+ function L(t, e) {
211
+ return {
212
+ id: t.id,
213
+ title: t.title,
214
+ description: O(t.description, t.sourceDescription),
215
+ colSpan: t.colSpan,
216
+ rowSpan: t.rowSpan,
217
+ x: t.x,
218
+ y: t.y,
219
+ type: "metric",
220
+ format: t.format,
221
+ decimals: t.decimals,
222
+ fetchData: (n) => e(n).then((r) => r.metric ?? { value: 0 })
223
+ };
224
+ }
225
+ function M(t, e) {
226
+ return {
227
+ id: t.id,
228
+ title: t.title,
229
+ description: O(t.description, t.sourceDescription),
230
+ colSpan: t.colSpan ?? 12,
231
+ rowSpan: t.rowSpan,
232
+ x: t.x,
233
+ y: t.y,
234
+ type: "collection",
235
+ createSource: (n) => {
236
+ let r = null;
237
+ const y = e(n).then((i) => (r = i.collection?.rows ?? [], r));
238
+ return {
239
+ dataAdapter: {
240
+ paginationType: "pages",
241
+ perPage: x,
242
+ fetchData: async ({
243
+ pagination: i,
244
+ search: l
245
+ }) => {
246
+ let u = r ?? await y;
247
+ if (l) {
248
+ const o = l.toLowerCase();
249
+ u = u.filter(
250
+ (s) => Object.values(s).some(
251
+ (a) => a != null && String(a).toLowerCase().includes(o)
252
+ )
253
+ );
254
+ }
255
+ const p = i?.currentPage ?? 1, h = i?.perPage ?? x, f = (p - 1) * h;
256
+ return {
257
+ type: "pages",
258
+ records: u.slice(f, f + h),
259
+ total: u.length,
260
+ currentPage: p,
261
+ perPage: h,
262
+ pagesCount: Math.ceil(u.length / h)
263
+ };
264
+ }
265
+ },
266
+ search: {
267
+ enabled: !0,
268
+ sync: !0
269
+ }
270
+ };
271
+ },
272
+ visualizations: [
273
+ {
274
+ type: "table",
275
+ options: {
276
+ columns: t.columns.map((n) => ({
277
+ label: n.label,
278
+ id: n.id,
279
+ ...n.width ? { width: n.width } : {},
280
+ render: (r) => {
281
+ const y = r[n.id];
282
+ return y == null ? "-" : String(y);
283
+ }
284
+ }))
285
+ }
286
+ }
287
+ ]
288
+ };
289
+ }
290
+ export {
291
+ C as F
292
+ };
@@ -0,0 +1,364 @@
1
+ import { JSX as JSX_2 } from 'react';
2
+
3
+ export declare type AggregationType = "count" | "sum" | "avg" | "min" | "max" | "countDistinct";
4
+
5
+ export declare interface ChartComputation {
6
+ datasetId: string;
7
+ xAxis: string;
8
+ yAxis: string;
9
+ aggregation: AggregationType;
10
+ series?: string;
11
+ sortBy?: "value" | "category";
12
+ sortOrder?: "asc" | "desc";
13
+ limit?: number;
14
+ }
15
+
16
+ export declare interface ChatDashboardBarChartConfig extends ChatDashboardChartConfigBase {
17
+ type: "bar";
18
+ orientation?: "vertical" | "horizontal";
19
+ stacked?: boolean;
20
+ }
21
+
22
+ export declare type ChatDashboardChartConfig = ChatDashboardBarChartConfig | ChatDashboardLineChartConfig | ChatDashboardFunnelChartConfig | ChatDashboardRadarChartConfig | ChatDashboardPieChartConfig | ChatDashboardGaugeChartConfig | ChatDashboardHeatmapChartConfig;
23
+
24
+ declare interface ChatDashboardChartConfigBase {
25
+ showLegend?: boolean;
26
+ showGrid?: boolean;
27
+ showLabels?: boolean;
28
+ valueFormat?: FormatPreset;
29
+ }
30
+
31
+ export declare interface ChatDashboardChartItem extends ChatDashboardItemBase {
32
+ type: "chart";
33
+ chart: ChatDashboardChartConfig;
34
+ computation: ChartComputation | RadarComputation | PieComputation | GaugeComputation | HeatmapComputation;
35
+ }
36
+
37
+ export declare interface ChatDashboardCollectionItem extends ChatDashboardItemBase {
38
+ type: "collection";
39
+ columns: ChatDashboardColumn[];
40
+ computation: CollectionComputation;
41
+ }
42
+
43
+ export declare interface ChatDashboardColumn {
44
+ /** Column key — must match a key in each row object */
45
+ id: string;
46
+ /** Display header label */
47
+ label: string;
48
+ /** Optional fixed width in pixels */
49
+ width?: number;
50
+ }
51
+
52
+ /**
53
+ * Complete dashboard configuration received via `displayDashboard`.
54
+ * Contains fetchSpecs that describe how to obtain data server-side —
55
+ * no raw data is included. Fully JSON-serializable.
56
+ */
57
+ export declare interface ChatDashboardConfig {
58
+ /** Dashboard title displayed in the canvas header and chat report card */
59
+ title: string;
60
+ /** Filter definitions — keys become filter IDs */
61
+ filters?: Record<string, ChatDashboardFilterDefinition>;
62
+ /** Ordered list of dashboard items with computation specs */
63
+ items: ChatDashboardItem[];
64
+ /** Fetch specs for server-side data retrieval, keyed by datasetId */
65
+ fetchSpecs: Record<string, DashboardFetchSpec>;
66
+ }
67
+
68
+ export declare interface ChatDashboardFilterDefinition {
69
+ type: "in";
70
+ label: string;
71
+ column: string;
72
+ datasetId: string;
73
+ }
74
+
75
+ export declare interface ChatDashboardFunnelChartConfig {
76
+ type: "funnel";
77
+ sort?: "descending" | "ascending" | "none";
78
+ orient?: "horizontal" | "vertical";
79
+ labelPosition?: "inside" | "outside";
80
+ showLegend?: boolean;
81
+ showLabels?: boolean;
82
+ showConversion?: boolean;
83
+ valueFormat?: FormatPreset;
84
+ }
85
+
86
+ declare interface ChatDashboardGaugeChartConfig {
87
+ type: "gauge";
88
+ min?: number;
89
+ max?: number;
90
+ showValue?: boolean;
91
+ valueFormat?: FormatPreset;
92
+ }
93
+
94
+ declare interface ChatDashboardHeatmapChartConfig {
95
+ type: "heatmap";
96
+ min?: number;
97
+ max?: number;
98
+ showLabels?: boolean;
99
+ showVisualMap?: boolean;
100
+ valueFormat?: FormatPreset;
101
+ }
102
+
103
+ export declare type ChatDashboardItem = ChatDashboardChartItem | ChatDashboardMetricItem | ChatDashboardCollectionItem;
104
+
105
+ declare interface ChatDashboardItemBase {
106
+ id: string;
107
+ title: string;
108
+ description?: string;
109
+ /** Source attribution shown as a subtitle (e.g. "Based on 8 feedbacks from 3 evaluators") */
110
+ sourceDescription?: string;
111
+ colSpan?: number;
112
+ rowSpan?: number;
113
+ x?: number;
114
+ y?: number;
115
+ }
116
+
117
+ export declare interface ChatDashboardLineChartConfig extends ChatDashboardChartConfigBase {
118
+ type: "line";
119
+ lineType?: "linear" | "smooth" | "step";
120
+ showArea?: boolean;
121
+ showDots?: boolean;
122
+ }
123
+
124
+ export declare type ChatDashboardMetricFormat = {
125
+ type: "number";
126
+ } | {
127
+ type: "currency";
128
+ currency?: string;
129
+ } | {
130
+ type: "percent";
131
+ } | {
132
+ type: "custom";
133
+ suffix?: string;
134
+ prefix?: string;
135
+ };
136
+
137
+ export declare interface ChatDashboardMetricItem extends ChatDashboardItemBase {
138
+ type: "metric";
139
+ format?: ChatDashboardMetricFormat;
140
+ decimals?: number;
141
+ computation: MetricComputation;
142
+ }
143
+
144
+ declare interface ChatDashboardPieChartConfig {
145
+ type: "pie";
146
+ innerRadius?: number;
147
+ showLegend?: boolean;
148
+ showLabels?: boolean;
149
+ showPercentage?: boolean;
150
+ valueFormat?: FormatPreset;
151
+ }
152
+
153
+ declare interface ChatDashboardRadarChartConfig extends ChatDashboardChartConfigBase {
154
+ type: "radar";
155
+ showArea?: boolean;
156
+ }
157
+
158
+ export declare interface CollectionComputation {
159
+ datasetId: string;
160
+ sortBy?: string;
161
+ sortOrder?: "asc" | "desc";
162
+ limit?: number;
163
+ }
164
+
165
+ export declare interface DashboardFetchSpec {
166
+ fetch: Array<{
167
+ toolId: string;
168
+ args: Record<string, unknown>;
169
+ }>;
170
+ query: string | null;
171
+ columnLabels?: Record<string, string>;
172
+ }
173
+
174
+ /**
175
+ * Minimal descriptor of a dashboard item's position and size.
176
+ * Used by `onLayoutChange` so the consumer can reconcile layout
177
+ * edits against its own source-of-truth config items.
178
+ */
179
+ declare type DashboardItemLayout = {
180
+ id: string;
181
+ colSpan: number;
182
+ rowSpan: number;
183
+ x: number;
184
+ y: number;
185
+ };
186
+
187
+ /**
188
+ * Renders an F0AnalyticsDashboard from a server-computed config.
189
+ *
190
+ * All data computation happens server-side via POST /api/dashboard/compute.
191
+ * Multiple widget fetchData calls within the same filter state share a
192
+ * single batch request.
193
+ */
194
+ export declare function F0ChatDashboard({ config, apiConfig, refreshKey, editMode, onLayoutChange, }: F0ChatDashboardProps): JSX_2.Element;
195
+
196
+ export declare namespace F0ChatDashboard {
197
+ var displayName: string;
198
+ }
199
+
200
+ export declare interface F0ChatDashboardProps {
201
+ config: ChatDashboardConfig;
202
+ apiConfig: {
203
+ baseUrl: string;
204
+ headers: Record<string, string>;
205
+ };
206
+ refreshKey?: number;
207
+ editMode?: boolean;
208
+ onLayoutChange?: (layout: DashboardItemLayout[]) => void;
209
+ }
210
+
211
+ /**
212
+ * A preset formatting instruction the LLM can specify instead of a
213
+ * real formatter function. The wrapper component maps these to actual
214
+ * `(value: number) => string` functions at render time.
215
+ */
216
+ export declare type FormatPreset = {
217
+ type: "number";
218
+ } | {
219
+ type: "currency";
220
+ currency?: string;
221
+ } | {
222
+ type: "percent";
223
+ } | {
224
+ type: "compact";
225
+ };
226
+
227
+ declare interface GaugeComputation {
228
+ datasetId: string;
229
+ aggregation: AggregationType;
230
+ column?: string;
231
+ min?: number;
232
+ max?: number;
233
+ name?: string;
234
+ }
235
+
236
+ declare interface HeatmapComputation {
237
+ datasetId: string;
238
+ xAxis: string;
239
+ yAxis: string;
240
+ valueColumn: string;
241
+ aggregation: AggregationType;
242
+ }
243
+
244
+ export declare interface MetricComputation {
245
+ datasetId: string;
246
+ aggregation: AggregationType;
247
+ column?: string;
248
+ }
249
+
250
+ declare interface PieComputation {
251
+ datasetId: string;
252
+ nameColumn: string;
253
+ valueColumn: string;
254
+ aggregation: AggregationType;
255
+ sortBy?: "value" | "name";
256
+ sortOrder?: "asc" | "desc";
257
+ limit?: number;
258
+ }
259
+
260
+ declare interface RadarComputation {
261
+ datasetId: string;
262
+ seriesColumn: string;
263
+ indicators: Array<{
264
+ column: string;
265
+ label: string;
266
+ max?: number;
267
+ }>;
268
+ limit?: number;
269
+ sortBy?: string;
270
+ sortOrder?: "asc" | "desc";
271
+ }
272
+
273
+ export { }
274
+
275
+
276
+ declare global {
277
+ interface Window {
278
+ XRay: {
279
+ enable: (filter?: ComponentTypes[]) => void;
280
+ disable: () => void;
281
+ };
282
+ }
283
+ }
284
+
285
+
286
+ declare namespace _DaytimePage {
287
+ var displayName: string;
288
+ }
289
+
290
+
291
+ declare namespace _Page {
292
+ var displayName: string;
293
+ }
294
+
295
+ declare module "gridstack" {
296
+ interface GridStackWidget {
297
+ id?: string;
298
+ allowedSizes?: Array<{
299
+ w: number;
300
+ h: number;
301
+ }>;
302
+ meta?: Record<string, unknown>;
303
+ }
304
+ interface GridStackNode {
305
+ allowedSizes?: Array<{
306
+ w: number;
307
+ h: number;
308
+ }>;
309
+ }
310
+ }
311
+
312
+
313
+ declare namespace Calendar {
314
+ var displayName: string;
315
+ }
316
+
317
+
318
+ declare module "@tiptap/core" {
319
+ interface Commands<ReturnType> {
320
+ enhanceHighlight: {
321
+ setEnhanceHighlight: (from: number, to: number) => ReturnType;
322
+ clearEnhanceHighlight: () => ReturnType;
323
+ };
324
+ }
325
+ }
326
+
327
+
328
+ declare module "@tiptap/core" {
329
+ interface Commands<ReturnType> {
330
+ aiBlock: {
331
+ insertAIBlock: (data: AIBlockData, config: AIBlockConfig) => ReturnType;
332
+ executeAIAction: (actionType: string, config: AIBlockConfig) => ReturnType;
333
+ };
334
+ }
335
+ }
336
+
337
+
338
+ declare module "@tiptap/core" {
339
+ interface Commands<ReturnType> {
340
+ moodTracker: {
341
+ insertMoodTracker: (data: MoodTrackerData) => ReturnType;
342
+ };
343
+ }
344
+ }
345
+
346
+
347
+ declare module "@tiptap/core" {
348
+ interface Commands<ReturnType> {
349
+ transcript: {
350
+ insertTranscript: (data: TranscriptData) => ReturnType;
351
+ };
352
+ }
353
+ }
354
+
355
+
356
+ declare module "@tiptap/core" {
357
+ interface Commands<ReturnType> {
358
+ videoEmbed: {
359
+ setVideoEmbed: (options: {
360
+ src: string;
361
+ }) => ReturnType;
362
+ };
363
+ }
364
+ }
@@ -0,0 +1,4 @@
1
+ import { F as r } from "./F0ChatDashboard-Cb5hmJwl.js";
2
+ export {
3
+ r as F0ChatDashboard
4
+ };