react-semaphor 0.1.301 → 0.1.303
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/appearance/index.cjs +1 -0
- package/dist/appearance/index.js +9 -0
- package/dist/brand-studio/index.cjs +21 -0
- package/dist/brand-studio/index.js +1461 -0
- package/dist/chunks/dashboard-controls-BCJZOzrL.js +2226 -0
- package/dist/chunks/dashboard-controls-CVFoOPti.js +47 -0
- package/dist/chunks/dashboard-filter-controls-button-C-e7230k.js +11 -0
- package/dist/chunks/{dashboard-filter-controls-button-DjALRkvg.js → dashboard-filter-controls-button-Cfbac4Jw.js} +205 -216
- package/dist/chunks/dashboard-json-BM5ywMgp.js +1 -0
- package/dist/chunks/{dashboard-json-D-zIG46N.js → dashboard-json-BzvLPhGM.js} +14 -12
- package/dist/chunks/dashboard-summary-settings-dialog-BdxKl1UF.js +1 -0
- package/dist/chunks/{dashboard-summary-settings-dialog-D-F1eEJI.js → dashboard-summary-settings-dialog-ChK3344r.js} +64 -63
- package/dist/chunks/date-formatter-D9Bvw5Qk.js +1 -0
- package/dist/chunks/date-formatter-DyIOb6uC.js +333 -0
- package/dist/chunks/{edit-dashboard-visual-BjflrL8w.js → edit-dashboard-visual-D725CWD5.js} +6690 -6679
- package/dist/chunks/edit-dashboard-visual-nNaZ2IK1.js +183 -0
- package/dist/chunks/index-BWjB_9uz.js +1356 -0
- package/dist/chunks/index-CJdxSyQq.js +2578 -0
- package/dist/chunks/{index-DDA12yqV.js → index-CYWgnME0.js} +48994 -66425
- package/dist/chunks/index-D7KJindZ.js +1 -0
- package/dist/chunks/index-DFOb_6HB.js +1657 -0
- package/dist/chunks/index-DRlMUglg.js +4 -0
- package/dist/chunks/palette-B9DJXMGo.js +11 -0
- package/dist/chunks/palette-DGOzbtsn.js +43 -0
- package/dist/chunks/{resource-management-panel-B2558XA1.js → resource-management-panel-CE0-NcLL.js} +116 -115
- package/dist/chunks/resource-management-panel-mJmc5dMT.js +6 -0
- package/dist/chunks/rotate-ccw-Bs7YJn10.js +6 -0
- package/dist/chunks/rotate-ccw-YsjQwpKm.js +14 -0
- package/dist/chunks/save-Bj1y1rug.js +6 -0
- package/dist/chunks/save-CUrexoNl.js +21 -0
- package/dist/chunks/switch-CiEX68py.js +163 -0
- package/dist/chunks/switch-oojO-gal.js +19730 -0
- package/dist/chunks/{use-create-flow-overlay-state-BUw_JtLs.js → use-create-flow-overlay-state-BHDKxe7I.js} +396 -412
- package/dist/chunks/use-create-flow-overlay-state-D2I2wNey.js +16 -0
- package/dist/chunks/{use-visual-utils-C45OxsOf.js → use-visual-utils-CjFzlR0P.js} +54 -53
- package/dist/chunks/use-visual-utils-DYDXMl5v.js +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +210 -207
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/appearance.d.ts +176 -0
- package/dist/types/brand-studio.d.ts +245 -0
- package/dist/types/dashboard.d.ts +134 -0
- package/dist/types/main.d.ts +142 -1
- package/dist/types/surfboard.d.ts +134 -0
- package/dist/types/types.d.ts +139 -0
- package/package.json +13 -1
- package/dist/chunks/braces-Bhqo4iW1.js +0 -23
- package/dist/chunks/braces-BwK7fWd_.js +0 -6
- package/dist/chunks/dashboard-controls-BIRiWCUK.js +0 -47
- package/dist/chunks/dashboard-controls-DIlnYo96.js +0 -2219
- package/dist/chunks/dashboard-filter-controls-button-CK1-mKQh.js +0 -11
- package/dist/chunks/dashboard-json-DK4mQ1gS.js +0 -1
- package/dist/chunks/dashboard-summary-settings-dialog-DSxNqxFI.js +0 -1
- package/dist/chunks/date-formatter-CqXdM6JO.js +0 -1
- package/dist/chunks/date-formatter-vkCj9Ct-.js +0 -1982
- package/dist/chunks/edit-dashboard-visual-DCsrtJr_.js +0 -193
- package/dist/chunks/index-8GnvL1_L.js +0 -1523
- package/dist/chunks/resource-management-panel-CKp4_aem.js +0 -6
- package/dist/chunks/use-create-flow-overlay-state-CWcCdPbC.js +0 -21
- package/dist/chunks/use-visual-utils-DyaThRzf.js +0 -1
|
@@ -0,0 +1,2226 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { c as Z, u as N, B as A, ai as St, m as Nt, L as dt, I as ue, a as Y, aj as Re, ak as da, al as ua, E as ls, f as X, am as ds, an as us, ao as ut, T as ma, q as ha, r as _e, t as Ue, s as mt, ap as pa, aq as ms, n as ta, z as hs, A as ps, D as fs, F as gs, K as vs, ar as bs } from "./switch-oojO-gal.js";
|
|
3
|
+
import { ct as ys, u as K, b as Ge, cu as xs, bE as ht, c as $e, d as Ve, e as ze, f as wt, o as Ss, cv as de, bV as Te, cw as Ns, cx as aa, cy as fa, cz as ga, cA as ws, c9 as Dt, cB as Ds, cC as Cs, cD as Es, cE as Is, cF as Ms, cG as As, r as qe, z as Be, p as M, cg as Ls, cH as Os, cI as ks, cd as pt, cJ as ft, bU as Ct, bs as va, cK as gt, bn as ba, cL as Ps, c0 as ya, c1 as xa, c2 as Sa, c3 as Na, c4 as wa, c5 as Da, c6 as Ca, c7 as vt, cM as Ts, bM as _s, cN as Us, cO as Fs, X as Rs, W as ke, cP as Gs, a1 as $s, Y as nt, cQ as Vs, cR as zs, cS as qs, ad as Bs, cT as Hs, L as rt, cU as js, cV as Ks, cW as Qs, cs as Ws, cX as Js, bN as Ys, bO as Xs, bP as Zs, bQ as en, bR as $, ck as tn, N as an, bX as sn, cY as nn, bS as sa, cZ as rn, c_ as on, c$ as cn, a0 as ln, O as dn, d0 as un, K as bt } from "./index-CYWgnME0.js";
|
|
4
|
+
import * as L from "react";
|
|
5
|
+
import Ea, { useState as S, useMemo as F, useCallback as Fe, useEffect as ot } from "react";
|
|
6
|
+
import "./index-CJdxSyQq.js";
|
|
7
|
+
import "react-dom";
|
|
8
|
+
import { b as mn, u as hn, A as pn, V as fn, c as gn, D as vn, N as bn, U as yn } from "./dashboard-filter-controls-button-Cfbac4Jw.js";
|
|
9
|
+
import { d as xn } from "./index-DFOb_6HB.js";
|
|
10
|
+
import { C as Sn, D as Nn } from "./dashboard-summary-settings-dialog-ChK3344r.js";
|
|
11
|
+
import { u as wn } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
12
|
+
import { s as it } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
13
|
+
import { u as Dn, e as Cn } from "./use-create-flow-overlay-state-BHDKxe7I.js";
|
|
14
|
+
import { S as na } from "./save-CUrexoNl.js";
|
|
15
|
+
import { P as En, B as In } from "./palette-DGOzbtsn.js";
|
|
16
|
+
/**
|
|
17
|
+
* @license lucide-react v0.453.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
22
|
+
const Mn = Z("Glasses", [
|
|
23
|
+
["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
|
|
24
|
+
["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
|
|
25
|
+
["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
|
|
26
|
+
["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
|
|
27
|
+
["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
|
|
28
|
+
]);
|
|
29
|
+
/**
|
|
30
|
+
* @license lucide-react v0.453.0 - ISC
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the ISC license.
|
|
33
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/
|
|
35
|
+
const An = Z("Menu", [
|
|
36
|
+
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
37
|
+
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
38
|
+
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
39
|
+
]);
|
|
40
|
+
/**
|
|
41
|
+
* @license lucide-react v0.453.0 - ISC
|
|
42
|
+
*
|
|
43
|
+
* This source code is licensed under the ISC license.
|
|
44
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
+
*/
|
|
46
|
+
const Ln = Z("Monitor", [
|
|
47
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
48
|
+
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
49
|
+
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* @license lucide-react v0.453.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/
|
|
57
|
+
const On = Z("Moon", [
|
|
58
|
+
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
59
|
+
]);
|
|
60
|
+
/**
|
|
61
|
+
* @license lucide-react v0.453.0 - ISC
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the ISC license.
|
|
64
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
+
*/
|
|
66
|
+
const kn = Z("ShieldX", [
|
|
67
|
+
[
|
|
68
|
+
"path",
|
|
69
|
+
{
|
|
70
|
+
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
71
|
+
key: "oel41y"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
["path", { d: "m14.5 9.5-5 5", key: "17q4r4" }],
|
|
75
|
+
["path", { d: "m9.5 9.5 5 5", key: "18nt4w" }]
|
|
76
|
+
]);
|
|
77
|
+
/**
|
|
78
|
+
* @license lucide-react v0.453.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/
|
|
83
|
+
const Pn = Z("Sun", [
|
|
84
|
+
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
85
|
+
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
86
|
+
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
87
|
+
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
88
|
+
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
89
|
+
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
90
|
+
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
91
|
+
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
92
|
+
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
93
|
+
]);
|
|
94
|
+
var yt = { exports: {} }, ct = {};
|
|
95
|
+
/**
|
|
96
|
+
* @license React
|
|
97
|
+
* use-sync-external-store-shim.production.js
|
|
98
|
+
*
|
|
99
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
100
|
+
*
|
|
101
|
+
* This source code is licensed under the MIT license found in the
|
|
102
|
+
* LICENSE file in the root directory of this source tree.
|
|
103
|
+
*/
|
|
104
|
+
var ra;
|
|
105
|
+
function Tn() {
|
|
106
|
+
if (ra) return ct;
|
|
107
|
+
ra = 1;
|
|
108
|
+
var t = Ea;
|
|
109
|
+
function s(g, p) {
|
|
110
|
+
return g === p && (g !== 0 || 1 / g === 1 / p) || g !== g && p !== p;
|
|
111
|
+
}
|
|
112
|
+
var n = typeof Object.is == "function" ? Object.is : s, a = t.useState, r = t.useEffect, d = t.useLayoutEffect, l = t.useDebugValue;
|
|
113
|
+
function u(g, p) {
|
|
114
|
+
var m = p(), o = a({ inst: { value: m, getSnapshot: p } }), b = o[0].inst, C = o[1];
|
|
115
|
+
return d(
|
|
116
|
+
function() {
|
|
117
|
+
b.value = m, b.getSnapshot = p, f(b) && C({ inst: b });
|
|
118
|
+
},
|
|
119
|
+
[g, m, p]
|
|
120
|
+
), r(
|
|
121
|
+
function() {
|
|
122
|
+
return f(b) && C({ inst: b }), g(function() {
|
|
123
|
+
f(b) && C({ inst: b });
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
[g]
|
|
127
|
+
), l(m), m;
|
|
128
|
+
}
|
|
129
|
+
function f(g) {
|
|
130
|
+
var p = g.getSnapshot;
|
|
131
|
+
g = g.value;
|
|
132
|
+
try {
|
|
133
|
+
var m = p();
|
|
134
|
+
return !n(g, m);
|
|
135
|
+
} catch {
|
|
136
|
+
return !0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function v(g, p) {
|
|
140
|
+
return p();
|
|
141
|
+
}
|
|
142
|
+
var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? v : u;
|
|
143
|
+
return ct.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : h, ct;
|
|
144
|
+
}
|
|
145
|
+
var lt = {};
|
|
146
|
+
/**
|
|
147
|
+
* @license React
|
|
148
|
+
* use-sync-external-store-shim.development.js
|
|
149
|
+
*
|
|
150
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
151
|
+
*
|
|
152
|
+
* This source code is licensed under the MIT license found in the
|
|
153
|
+
* LICENSE file in the root directory of this source tree.
|
|
154
|
+
*/
|
|
155
|
+
var oa;
|
|
156
|
+
function _n() {
|
|
157
|
+
return oa || (oa = 1, process.env.NODE_ENV !== "production" && function() {
|
|
158
|
+
function t(m, o) {
|
|
159
|
+
return m === o && (m !== 0 || 1 / m === 1 / o) || m !== m && o !== o;
|
|
160
|
+
}
|
|
161
|
+
function s(m, o) {
|
|
162
|
+
h || r.startTransition === void 0 || (h = !0, console.error(
|
|
163
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
164
|
+
));
|
|
165
|
+
var b = o();
|
|
166
|
+
if (!g) {
|
|
167
|
+
var C = o();
|
|
168
|
+
d(b, C) || (console.error(
|
|
169
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
170
|
+
), g = !0);
|
|
171
|
+
}
|
|
172
|
+
C = l({
|
|
173
|
+
inst: { value: b, getSnapshot: o }
|
|
174
|
+
});
|
|
175
|
+
var w = C[0].inst, D = C[1];
|
|
176
|
+
return f(
|
|
177
|
+
function() {
|
|
178
|
+
w.value = b, w.getSnapshot = o, n(w) && D({ inst: w });
|
|
179
|
+
},
|
|
180
|
+
[m, b, o]
|
|
181
|
+
), u(
|
|
182
|
+
function() {
|
|
183
|
+
return n(w) && D({ inst: w }), m(function() {
|
|
184
|
+
n(w) && D({ inst: w });
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
[m]
|
|
188
|
+
), v(b), b;
|
|
189
|
+
}
|
|
190
|
+
function n(m) {
|
|
191
|
+
var o = m.getSnapshot;
|
|
192
|
+
m = m.value;
|
|
193
|
+
try {
|
|
194
|
+
var b = o();
|
|
195
|
+
return !d(m, b);
|
|
196
|
+
} catch {
|
|
197
|
+
return !0;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function a(m, o) {
|
|
201
|
+
return o();
|
|
202
|
+
}
|
|
203
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
204
|
+
var r = Ea, d = typeof Object.is == "function" ? Object.is : t, l = r.useState, u = r.useEffect, f = r.useLayoutEffect, v = r.useDebugValue, h = !1, g = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? a : s;
|
|
205
|
+
lt.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
206
|
+
}()), lt;
|
|
207
|
+
}
|
|
208
|
+
process.env.NODE_ENV === "production" ? yt.exports = Tn() : yt.exports = _n();
|
|
209
|
+
var Un = yt.exports;
|
|
210
|
+
const Pe = ["light", "dark", "system"];
|
|
211
|
+
function Fn() {
|
|
212
|
+
const { theme: t, setTheme: s } = ys(), n = N(
|
|
213
|
+
(l) => l.actions.setDashboardTheme
|
|
214
|
+
);
|
|
215
|
+
function a() {
|
|
216
|
+
const l = Pe.includes(t) ? t : "system", u = Pe[(Pe.indexOf(l) + 1) % Pe.length];
|
|
217
|
+
s(u), n(u);
|
|
218
|
+
}
|
|
219
|
+
const r = t === "light" ? Pn : t === "dark" ? On : Ln, d = t === "light" ? "Theme: light (click for dark)" : t === "dark" ? "Theme: dark (click for system)" : "Theme: system (click for light)";
|
|
220
|
+
return /* @__PURE__ */ e(
|
|
221
|
+
A,
|
|
222
|
+
{
|
|
223
|
+
type: "button",
|
|
224
|
+
variant: "ghost",
|
|
225
|
+
size: "xs",
|
|
226
|
+
className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
|
|
227
|
+
onClick: a,
|
|
228
|
+
"aria-label": d,
|
|
229
|
+
title: d,
|
|
230
|
+
children: /* @__PURE__ */ e(r, { className: "h-3.5 w-3.5", strokeWidth: 1.5 })
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
async function Rn(t, s, n, a, r) {
|
|
235
|
+
if (!r)
|
|
236
|
+
return null;
|
|
237
|
+
const d = JSON.stringify(n), l = `${t}/v1/lens`;
|
|
238
|
+
return await St(l, r, {
|
|
239
|
+
name: s,
|
|
240
|
+
template: d,
|
|
241
|
+
filterValues: a,
|
|
242
|
+
operation: "create"
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
async function xt(t, s, n) {
|
|
246
|
+
if (!n)
|
|
247
|
+
return null;
|
|
248
|
+
const { id: a, template: r, filterValues: d, isDefault: l, shared: u } = s, f = `${t}/v1/lens`;
|
|
249
|
+
return await St(f, n, {
|
|
250
|
+
lensId: a,
|
|
251
|
+
template: r,
|
|
252
|
+
filterValues: d,
|
|
253
|
+
isDefault: l,
|
|
254
|
+
shared: u,
|
|
255
|
+
operation: "update"
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
async function Gn(t, s, n) {
|
|
259
|
+
if (!n)
|
|
260
|
+
return null;
|
|
261
|
+
const a = `${t}/v1/lens`;
|
|
262
|
+
return await St(a, n, {
|
|
263
|
+
operation: "delete",
|
|
264
|
+
lensId: s
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
const $n = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
268
|
+
function Vn({
|
|
269
|
+
open: t,
|
|
270
|
+
onOpenChange: s
|
|
271
|
+
} = {}) {
|
|
272
|
+
const [n, a] = S(""), [r, d] = S(!1), l = N((I) => I.lenses), { setLenses: u, setSelectedLensId: f } = Nt(), [v, h] = S(!1), [g, p] = S(!1), m = t !== void 0, o = m ? t : g, b = (I) => {
|
|
273
|
+
m || p(I), s == null || s(I);
|
|
274
|
+
}, C = N((I) => I.dashboard), w = N((I) => I.filterValues), { authToken: D, tokenProps: E } = K();
|
|
275
|
+
async function O() {
|
|
276
|
+
h(!0);
|
|
277
|
+
const I = await Rn(
|
|
278
|
+
E.apiServiceUrl,
|
|
279
|
+
n,
|
|
280
|
+
C,
|
|
281
|
+
w,
|
|
282
|
+
D == null ? void 0 : D.accessToken
|
|
283
|
+
);
|
|
284
|
+
I && (u([...l || [], I]), f(I.id), b(!1)), h(!1);
|
|
285
|
+
}
|
|
286
|
+
return /* @__PURE__ */ c(Ge, { open: o, onOpenChange: b, children: [
|
|
287
|
+
m ? null : /* @__PURE__ */ e(xs, { asChild: !0, children: /* @__PURE__ */ c(A, { variant: "secondary", size: "xs", children: [
|
|
288
|
+
/* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
|
|
289
|
+
"Lens"
|
|
290
|
+
] }) }),
|
|
291
|
+
/* @__PURE__ */ c($e, { className: "rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control", children: [
|
|
292
|
+
/* @__PURE__ */ c(Ve, { children: [
|
|
293
|
+
/* @__PURE__ */ e(ze, { className: "text-[15px]", children: "Create lens" }),
|
|
294
|
+
/* @__PURE__ */ e(wt, { className: "text-[13px] leading-5", children: "Lenses are private by default and are only visible to you." })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ c("div", { className: "space-y-1.5 py-1", children: [
|
|
297
|
+
/* @__PURE__ */ e(dt, { htmlFor: "lens-name", className: $n, children: "Name" }),
|
|
298
|
+
/* @__PURE__ */ e(
|
|
299
|
+
ue,
|
|
300
|
+
{
|
|
301
|
+
id: "lens-name",
|
|
302
|
+
size: "xs",
|
|
303
|
+
value: n,
|
|
304
|
+
placeholder: "Monthly review, West region, …",
|
|
305
|
+
onChange: (I) => a(I.target.value)
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
r && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: "A lens with this name already exists. Pick a different one." })
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ c(Ss, { children: [
|
|
311
|
+
/* @__PURE__ */ e(A, { variant: "outline", size: "xs", onClick: () => b(!1), children: "Cancel" }),
|
|
312
|
+
/* @__PURE__ */ e(
|
|
313
|
+
A,
|
|
314
|
+
{
|
|
315
|
+
size: "xs",
|
|
316
|
+
type: "submit",
|
|
317
|
+
onClick: O,
|
|
318
|
+
disabled: v || !n.trim(),
|
|
319
|
+
children: v ? "Creating…" : "Create"
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
] })
|
|
323
|
+
] })
|
|
324
|
+
] });
|
|
325
|
+
}
|
|
326
|
+
function zn({ includeLabel: t = !1 } = {}) {
|
|
327
|
+
const s = N((h) => h.lenses), n = N((h) => h.selectedLensId), { setLenses: a, setSelectedLensId: r } = Nt(), { authToken: d, tokenProps: l } = K();
|
|
328
|
+
async function u(h) {
|
|
329
|
+
r(h);
|
|
330
|
+
}
|
|
331
|
+
async function f(h) {
|
|
332
|
+
if (await Gn(l.apiServiceUrl, h, d == null ? void 0 : d.accessToken)) {
|
|
333
|
+
const p = s == null ? void 0 : s.filter((m) => m.id !== h);
|
|
334
|
+
a(p || []), r("original");
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async function v(h) {
|
|
338
|
+
const g = s == null ? void 0 : s.map((o) => o.id === h.id ? {
|
|
339
|
+
...o,
|
|
340
|
+
isDefault: !h.isDefault
|
|
341
|
+
} : {
|
|
342
|
+
...o,
|
|
343
|
+
isDefault: !1
|
|
344
|
+
});
|
|
345
|
+
a(g || []);
|
|
346
|
+
const p = {
|
|
347
|
+
...h,
|
|
348
|
+
isDefault: !h.isDefault
|
|
349
|
+
};
|
|
350
|
+
await xt(l.apiServiceUrl, p, d == null ? void 0 : d.accessToken);
|
|
351
|
+
const m = s == null ? void 0 : s.find((o) => o.isDefault);
|
|
352
|
+
if (m && m.id !== h.id) {
|
|
353
|
+
const o = {
|
|
354
|
+
...m,
|
|
355
|
+
isDefault: !1
|
|
356
|
+
};
|
|
357
|
+
await xt(l.apiServiceUrl, o, d == null ? void 0 : d.accessToken);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return /* @__PURE__ */ c(T, { children: [
|
|
361
|
+
t ? /* @__PURE__ */ c(T, { children: [
|
|
362
|
+
/* @__PURE__ */ e(de, { className: "px-3", children: "Lenses" }),
|
|
363
|
+
/* @__PURE__ */ e(Te, {})
|
|
364
|
+
] }) : null,
|
|
365
|
+
/* @__PURE__ */ c(
|
|
366
|
+
Ns,
|
|
367
|
+
{
|
|
368
|
+
value: n,
|
|
369
|
+
onValueChange: u,
|
|
370
|
+
children: [
|
|
371
|
+
/* @__PURE__ */ e(aa, { value: "original", children: "Original" }),
|
|
372
|
+
s == null ? void 0 : s.map((h) => /* @__PURE__ */ c(
|
|
373
|
+
aa,
|
|
374
|
+
{
|
|
375
|
+
className: "group flex justify-between gap-2",
|
|
376
|
+
value: h.id,
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ e("p", { children: h.name }),
|
|
379
|
+
/* @__PURE__ */ c("span", { className: "flex items-center gap-3", children: [
|
|
380
|
+
/* @__PURE__ */ e(
|
|
381
|
+
fa,
|
|
382
|
+
{
|
|
383
|
+
onClick: (g) => {
|
|
384
|
+
g.preventDefault(), v(h);
|
|
385
|
+
},
|
|
386
|
+
className: Y(
|
|
387
|
+
"size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
388
|
+
{
|
|
389
|
+
invisible: !h.isDefault,
|
|
390
|
+
"text-green-500": h.isDefault
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
strokeWidth: 1.5
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ e(
|
|
397
|
+
ga,
|
|
398
|
+
{
|
|
399
|
+
onClick: (g) => {
|
|
400
|
+
g.preventDefault(), f(h.id);
|
|
401
|
+
},
|
|
402
|
+
className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
403
|
+
strokeWidth: 1.5
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
] })
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
h.id
|
|
410
|
+
))
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
)
|
|
414
|
+
] });
|
|
415
|
+
}
|
|
416
|
+
function qn() {
|
|
417
|
+
const { displayPreferences: t, shouldShowElement: s } = ws(), { currentUser: n, userContext: a } = Dt(), r = F(
|
|
418
|
+
() => Ds(n),
|
|
419
|
+
[n]
|
|
420
|
+
), d = F(() => (u) => r && r[u] !== void 0 && r[u] === !1 ? !1 : s(u), [r, s, t]), l = F(
|
|
421
|
+
() => {
|
|
422
|
+
var u, f, v, h, g;
|
|
423
|
+
return {
|
|
424
|
+
canEdit: ((u = a == null ? void 0 : a.permissions) == null ? void 0 : u.canEdit) ?? As(n),
|
|
425
|
+
canUseFilters: ((f = a == null ? void 0 : a.permissions) == null ? void 0 : f.canEdit) ?? Ms(n),
|
|
426
|
+
canManageDashboards: ((v = a == null ? void 0 : a.permissions) == null ? void 0 : v.canCreateDashboard) ?? Is(n),
|
|
427
|
+
canCreateDashboards: ((h = a == null ? void 0 : a.permissions) == null ? void 0 : h.canCreateDashboard) ?? Es(n),
|
|
428
|
+
canAccessVisuals: ((g = a == null ? void 0 : a.permissions) == null ? void 0 : g.canEdit) ?? Cs(n)
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
[n, a]
|
|
432
|
+
);
|
|
433
|
+
return {
|
|
434
|
+
displayPreferences: t,
|
|
435
|
+
shouldShowElement: d,
|
|
436
|
+
permissions: l,
|
|
437
|
+
currentUser: n
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
const Bn = async (t, s, n) => {
|
|
441
|
+
const a = `${t}/management/v1/groups`;
|
|
442
|
+
return await ua(a, s, n);
|
|
443
|
+
}, Hn = async (t, s, n) => {
|
|
444
|
+
const a = `${t}/management/v1/groups/${n}`;
|
|
445
|
+
await da(a, s, "DELETE");
|
|
446
|
+
}, jn = async (t, s, n, a) => {
|
|
447
|
+
const r = `${t}/management/v1/groups/${n}/members`;
|
|
448
|
+
return await ua(r, s, a);
|
|
449
|
+
}, Kn = async (t, s, n, a) => {
|
|
450
|
+
const r = `${t}/management/v1/groups/${n}/members`;
|
|
451
|
+
await da(r, s, "DELETE", a);
|
|
452
|
+
};
|
|
453
|
+
function Qn() {
|
|
454
|
+
const { authToken: t, tokenProps: s } = K(), n = qe();
|
|
455
|
+
return Be({
|
|
456
|
+
mutationFn: (a) => Bn(s.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", a),
|
|
457
|
+
onSuccess: () => {
|
|
458
|
+
n.invalidateQueries({ queryKey: ["groups"] }), M.success("Group created successfully");
|
|
459
|
+
},
|
|
460
|
+
onError: (a) => {
|
|
461
|
+
console.error("Failed to create group:", a), M.error("Failed to create group", {
|
|
462
|
+
description: Re(a, "Failed to create group")
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
function Wn() {
|
|
468
|
+
const { authToken: t, tokenProps: s } = K(), n = qe();
|
|
469
|
+
return Be({
|
|
470
|
+
mutationFn: (a) => Hn(s.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", a),
|
|
471
|
+
onSuccess: (a, r) => {
|
|
472
|
+
n.invalidateQueries({ queryKey: ["groups"] }), n.removeQueries({ queryKey: ["group", r] }), M.success("Group deleted successfully");
|
|
473
|
+
},
|
|
474
|
+
onError: (a) => {
|
|
475
|
+
console.error("Failed to delete group:", a), M.error("Failed to delete group", {
|
|
476
|
+
description: Re(a, "Failed to delete group")
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
function Jn() {
|
|
482
|
+
const { authToken: t, tokenProps: s } = K(), n = qe();
|
|
483
|
+
return Be({
|
|
484
|
+
mutationFn: ({
|
|
485
|
+
groupId: a,
|
|
486
|
+
data: r
|
|
487
|
+
}) => jn(s.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", a, r),
|
|
488
|
+
onSuccess: (a, r) => {
|
|
489
|
+
n.invalidateQueries({ queryKey: ["group", r.groupId] }), n.invalidateQueries({
|
|
490
|
+
queryKey: ["group-members", r.groupId]
|
|
491
|
+
}), n.invalidateQueries({ queryKey: ["groups"] }), M.success("Members added successfully");
|
|
492
|
+
},
|
|
493
|
+
onError: (a) => {
|
|
494
|
+
console.error("Failed to add group members:", a), M.error("Failed to add members", {
|
|
495
|
+
description: Re(a, "Failed to add members")
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
function Yn() {
|
|
501
|
+
const { authToken: t, tokenProps: s } = K(), n = qe();
|
|
502
|
+
return Be({
|
|
503
|
+
mutationFn: ({
|
|
504
|
+
groupId: a,
|
|
505
|
+
data: r
|
|
506
|
+
}) => Kn(s.apiServiceUrl, (t == null ? void 0 : t.accessToken) || "", a, r),
|
|
507
|
+
onSuccess: (a, r) => {
|
|
508
|
+
n.invalidateQueries({ queryKey: ["group", r.groupId] }), n.invalidateQueries({
|
|
509
|
+
queryKey: ["group-members", r.groupId]
|
|
510
|
+
}), n.invalidateQueries({ queryKey: ["groups"] }), M.success("Members removed successfully");
|
|
511
|
+
},
|
|
512
|
+
onError: (a) => {
|
|
513
|
+
console.error("Failed to remove group members:", a), M.error("Failed to remove members", {
|
|
514
|
+
description: Re(a, "Failed to remove members")
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
const ia = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
520
|
+
function Xn({
|
|
521
|
+
onSuccess: t,
|
|
522
|
+
tenantId: s,
|
|
523
|
+
isTenantUser: n
|
|
524
|
+
}) {
|
|
525
|
+
const [a, r] = S(""), [d, l] = S(""), [u, f] = S({}), v = Qn(), h = () => {
|
|
526
|
+
const p = {};
|
|
527
|
+
return a.trim() ? a.length < 3 ? p.name = "Group name must be at least 3 characters" : a.length > 50 && (p.name = "Group name must be less than 50 characters") : p.name = "Group name is required", d && d.length > 200 && (p.description = "Description must be less than 200 characters"), f(p), Object.keys(p).length === 0;
|
|
528
|
+
};
|
|
529
|
+
return /* @__PURE__ */ c("form", { onSubmit: async (p) => {
|
|
530
|
+
if (p.preventDefault(), !h()) return;
|
|
531
|
+
const m = {
|
|
532
|
+
name: a.trim(),
|
|
533
|
+
description: d.trim() || void 0,
|
|
534
|
+
type: n ? "TENANT_GROUP" : "ORG_GROUP",
|
|
535
|
+
...n && s ? { tenantId: s } : {}
|
|
536
|
+
};
|
|
537
|
+
try {
|
|
538
|
+
await v.mutateAsync(m), r(""), l(""), f({}), t();
|
|
539
|
+
} catch (o) {
|
|
540
|
+
console.error("Failed to create group:", o);
|
|
541
|
+
}
|
|
542
|
+
}, className: "space-y-4", children: [
|
|
543
|
+
/* @__PURE__ */ c("div", { className: "space-y-1.5", children: [
|
|
544
|
+
/* @__PURE__ */ c(dt, { htmlFor: "group-name", className: ia, children: [
|
|
545
|
+
"Group name ",
|
|
546
|
+
/* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ e(
|
|
549
|
+
ue,
|
|
550
|
+
{
|
|
551
|
+
id: "group-name",
|
|
552
|
+
size: "xs",
|
|
553
|
+
placeholder: "e.g., Marketing Team, Engineering Squad",
|
|
554
|
+
value: a,
|
|
555
|
+
onChange: (p) => {
|
|
556
|
+
r(p.target.value), u.name && f((m) => ({ ...m, name: "" }));
|
|
557
|
+
},
|
|
558
|
+
className: u.name ? "border-destructive" : "",
|
|
559
|
+
disabled: v.isPending
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
u.name && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: u.name })
|
|
563
|
+
] }),
|
|
564
|
+
/* @__PURE__ */ c("div", { className: "space-y-1.5", children: [
|
|
565
|
+
/* @__PURE__ */ e(dt, { htmlFor: "group-description", className: ia, children: "Description (optional)" }),
|
|
566
|
+
/* @__PURE__ */ e(
|
|
567
|
+
Ls,
|
|
568
|
+
{
|
|
569
|
+
id: "group-description",
|
|
570
|
+
placeholder: "Describe the purpose of this group…",
|
|
571
|
+
value: d,
|
|
572
|
+
onChange: (p) => {
|
|
573
|
+
l(p.target.value), u.description && f((m) => ({ ...m, description: "" }));
|
|
574
|
+
},
|
|
575
|
+
className: `text-[13px] ${u.description ? "border-destructive" : ""}`,
|
|
576
|
+
disabled: v.isPending,
|
|
577
|
+
rows: 3
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
u.description ? /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: u.description }) : /* @__PURE__ */ c("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
581
|
+
d.length,
|
|
582
|
+
"/200"
|
|
583
|
+
] })
|
|
584
|
+
] }),
|
|
585
|
+
/* @__PURE__ */ c("div", { className: "flex gap-2 text-[12px] text-muted-foreground", children: [
|
|
586
|
+
/* @__PURE__ */ e(ls, { className: "h-3.5 w-3.5 shrink-0 mt-0.5" }),
|
|
587
|
+
/* @__PURE__ */ e("p", { children: "This group will be accessible to users in your workspace. You can add members after creating it." })
|
|
588
|
+
] }),
|
|
589
|
+
/* @__PURE__ */ c("div", { className: "flex justify-end gap-1.5 pt-1", children: [
|
|
590
|
+
/* @__PURE__ */ e(
|
|
591
|
+
A,
|
|
592
|
+
{
|
|
593
|
+
type: "button",
|
|
594
|
+
variant: "outline",
|
|
595
|
+
size: "xs",
|
|
596
|
+
onClick: () => {
|
|
597
|
+
r(""), l(""), f({});
|
|
598
|
+
},
|
|
599
|
+
disabled: v.isPending,
|
|
600
|
+
children: "Clear"
|
|
601
|
+
}
|
|
602
|
+
),
|
|
603
|
+
/* @__PURE__ */ e(
|
|
604
|
+
A,
|
|
605
|
+
{
|
|
606
|
+
type: "submit",
|
|
607
|
+
size: "xs",
|
|
608
|
+
disabled: v.isPending || !a.trim(),
|
|
609
|
+
children: v.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
610
|
+
/* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
611
|
+
"Creating…"
|
|
612
|
+
] }) : "Create group"
|
|
613
|
+
}
|
|
614
|
+
)
|
|
615
|
+
] })
|
|
616
|
+
] });
|
|
617
|
+
}
|
|
618
|
+
function Zn(t, s = []) {
|
|
619
|
+
let n = [];
|
|
620
|
+
function a(d, l) {
|
|
621
|
+
const u = L.createContext(l);
|
|
622
|
+
u.displayName = d + "Context";
|
|
623
|
+
const f = n.length;
|
|
624
|
+
n = [...n, l];
|
|
625
|
+
const v = (g) => {
|
|
626
|
+
var w;
|
|
627
|
+
const { scope: p, children: m, ...o } = g, b = ((w = p == null ? void 0 : p[t]) == null ? void 0 : w[f]) || u, C = L.useMemo(() => o, Object.values(o));
|
|
628
|
+
return /* @__PURE__ */ e(b.Provider, { value: C, children: m });
|
|
629
|
+
};
|
|
630
|
+
v.displayName = d + "Provider";
|
|
631
|
+
function h(g, p) {
|
|
632
|
+
var b;
|
|
633
|
+
const m = ((b = p == null ? void 0 : p[t]) == null ? void 0 : b[f]) || u, o = L.useContext(m);
|
|
634
|
+
if (o) return o;
|
|
635
|
+
if (l !== void 0) return l;
|
|
636
|
+
throw new Error(`\`${g}\` must be used within \`${d}\``);
|
|
637
|
+
}
|
|
638
|
+
return [v, h];
|
|
639
|
+
}
|
|
640
|
+
const r = () => {
|
|
641
|
+
const d = n.map((l) => L.createContext(l));
|
|
642
|
+
return function(u) {
|
|
643
|
+
const f = (u == null ? void 0 : u[t]) || d;
|
|
644
|
+
return L.useMemo(
|
|
645
|
+
() => ({ [`__scope${t}`]: { ...u, [t]: f } }),
|
|
646
|
+
[u, f]
|
|
647
|
+
);
|
|
648
|
+
};
|
|
649
|
+
};
|
|
650
|
+
return r.scopeName = t, [a, er(r, ...s)];
|
|
651
|
+
}
|
|
652
|
+
function er(...t) {
|
|
653
|
+
const s = t[0];
|
|
654
|
+
if (t.length === 1) return s;
|
|
655
|
+
const n = () => {
|
|
656
|
+
const a = t.map((r) => ({
|
|
657
|
+
useScope: r(),
|
|
658
|
+
scopeName: r.scopeName
|
|
659
|
+
}));
|
|
660
|
+
return function(d) {
|
|
661
|
+
const l = a.reduce((u, { useScope: f, scopeName: v }) => {
|
|
662
|
+
const g = f(d)[`__scope${v}`];
|
|
663
|
+
return { ...u, ...g };
|
|
664
|
+
}, {});
|
|
665
|
+
return L.useMemo(() => ({ [`__scope${s.scopeName}`]: l }), [l]);
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
return n.scopeName = s.scopeName, n;
|
|
669
|
+
}
|
|
670
|
+
var tr = [
|
|
671
|
+
"a",
|
|
672
|
+
"button",
|
|
673
|
+
"div",
|
|
674
|
+
"form",
|
|
675
|
+
"h2",
|
|
676
|
+
"h3",
|
|
677
|
+
"img",
|
|
678
|
+
"input",
|
|
679
|
+
"label",
|
|
680
|
+
"li",
|
|
681
|
+
"nav",
|
|
682
|
+
"ol",
|
|
683
|
+
"p",
|
|
684
|
+
"select",
|
|
685
|
+
"span",
|
|
686
|
+
"svg",
|
|
687
|
+
"ul"
|
|
688
|
+
], Et = tr.reduce((t, s) => {
|
|
689
|
+
const n = ds(`Primitive.${s}`), a = L.forwardRef((r, d) => {
|
|
690
|
+
const { asChild: l, ...u } = r, f = l ? n : s;
|
|
691
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e(f, { ...u, ref: d });
|
|
692
|
+
});
|
|
693
|
+
return a.displayName = `Primitive.${s}`, { ...t, [s]: a };
|
|
694
|
+
}, {});
|
|
695
|
+
function ar() {
|
|
696
|
+
return Un.useSyncExternalStore(
|
|
697
|
+
sr,
|
|
698
|
+
() => !0,
|
|
699
|
+
() => !1
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
function sr() {
|
|
703
|
+
return () => {
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
var It = "Avatar", [nr] = Zn(It), [rr, Ia] = nr(It), Ma = L.forwardRef(
|
|
707
|
+
(t, s) => {
|
|
708
|
+
const { __scopeAvatar: n, ...a } = t, [r, d] = L.useState("idle");
|
|
709
|
+
return /* @__PURE__ */ e(
|
|
710
|
+
rr,
|
|
711
|
+
{
|
|
712
|
+
scope: n,
|
|
713
|
+
imageLoadingStatus: r,
|
|
714
|
+
onImageLoadingStatusChange: d,
|
|
715
|
+
children: /* @__PURE__ */ e(Et.span, { ...a, ref: s })
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
Ma.displayName = It;
|
|
721
|
+
var Aa = "AvatarImage", La = L.forwardRef(
|
|
722
|
+
(t, s) => {
|
|
723
|
+
const { __scopeAvatar: n, src: a, onLoadingStatusChange: r = () => {
|
|
724
|
+
}, ...d } = t, l = Ia(Aa, n), u = or(a, d), f = us((v) => {
|
|
725
|
+
r(v), l.onImageLoadingStatusChange(v);
|
|
726
|
+
});
|
|
727
|
+
return ut(() => {
|
|
728
|
+
u !== "idle" && f(u);
|
|
729
|
+
}, [u, f]), u === "loaded" ? /* @__PURE__ */ e(Et.img, { ...d, ref: s, src: a }) : null;
|
|
730
|
+
}
|
|
731
|
+
);
|
|
732
|
+
La.displayName = Aa;
|
|
733
|
+
var Oa = "AvatarFallback", ka = L.forwardRef(
|
|
734
|
+
(t, s) => {
|
|
735
|
+
const { __scopeAvatar: n, delayMs: a, ...r } = t, d = Ia(Oa, n), [l, u] = L.useState(a === void 0);
|
|
736
|
+
return L.useEffect(() => {
|
|
737
|
+
if (a !== void 0) {
|
|
738
|
+
const f = window.setTimeout(() => u(!0), a);
|
|
739
|
+
return () => window.clearTimeout(f);
|
|
740
|
+
}
|
|
741
|
+
}, [a]), l && d.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(Et.span, { ...r, ref: s }) : null;
|
|
742
|
+
}
|
|
743
|
+
);
|
|
744
|
+
ka.displayName = Oa;
|
|
745
|
+
function ca(t, s) {
|
|
746
|
+
return t ? s ? (t.src !== s && (t.src = s), t.complete && t.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
747
|
+
}
|
|
748
|
+
function or(t, { referrerPolicy: s, crossOrigin: n }) {
|
|
749
|
+
const a = ar(), r = L.useRef(null), d = a ? (r.current || (r.current = new window.Image()), r.current) : null, [l, u] = L.useState(
|
|
750
|
+
() => ca(d, t)
|
|
751
|
+
);
|
|
752
|
+
return ut(() => {
|
|
753
|
+
u(ca(d, t));
|
|
754
|
+
}, [d, t]), ut(() => {
|
|
755
|
+
const f = (g) => () => {
|
|
756
|
+
u(g);
|
|
757
|
+
};
|
|
758
|
+
if (!d) return;
|
|
759
|
+
const v = f("loaded"), h = f("error");
|
|
760
|
+
return d.addEventListener("load", v), d.addEventListener("error", h), s && (d.referrerPolicy = s), typeof n == "string" && (d.crossOrigin = n), () => {
|
|
761
|
+
d.removeEventListener("load", v), d.removeEventListener("error", h);
|
|
762
|
+
};
|
|
763
|
+
}, [d, n, s]), l;
|
|
764
|
+
}
|
|
765
|
+
var Pa = Ma, Ta = La, _a = ka;
|
|
766
|
+
const Mt = L.forwardRef(({ className: t, ...s }, n) => /* @__PURE__ */ e(
|
|
767
|
+
Pa,
|
|
768
|
+
{
|
|
769
|
+
ref: n,
|
|
770
|
+
className: Y(
|
|
771
|
+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
772
|
+
t
|
|
773
|
+
),
|
|
774
|
+
...s
|
|
775
|
+
}
|
|
776
|
+
));
|
|
777
|
+
Mt.displayName = Pa.displayName;
|
|
778
|
+
const ir = L.forwardRef(({ className: t, ...s }, n) => /* @__PURE__ */ e(
|
|
779
|
+
Ta,
|
|
780
|
+
{
|
|
781
|
+
ref: n,
|
|
782
|
+
className: Y("aspect-square h-full w-full", t),
|
|
783
|
+
...s
|
|
784
|
+
}
|
|
785
|
+
));
|
|
786
|
+
ir.displayName = Ta.displayName;
|
|
787
|
+
const At = L.forwardRef(({ className: t, ...s }, n) => /* @__PURE__ */ e(
|
|
788
|
+
_a,
|
|
789
|
+
{
|
|
790
|
+
ref: n,
|
|
791
|
+
className: Y(
|
|
792
|
+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
793
|
+
t
|
|
794
|
+
),
|
|
795
|
+
...s
|
|
796
|
+
}
|
|
797
|
+
));
|
|
798
|
+
At.displayName = _a.displayName;
|
|
799
|
+
function cr({
|
|
800
|
+
open: t,
|
|
801
|
+
onOpenChange: s,
|
|
802
|
+
group: n,
|
|
803
|
+
onUpdate: a
|
|
804
|
+
}) {
|
|
805
|
+
const [r, d] = S("members"), [l, u] = S(""), [f, v] = S([]), [h, g] = S([]), { data: p, isLoading: m, refetch: o } = Os(n.id), b = n.type === "TENANT_GROUP" ? "tenant" : "organization", { users: C, isLoading: w } = ks({
|
|
806
|
+
type: b,
|
|
807
|
+
tenantId: n.tenantId || void 0,
|
|
808
|
+
active: !0,
|
|
809
|
+
limit: 100
|
|
810
|
+
}), D = Jn(), E = Yn(), O = (p == null ? void 0 : p.members) || [], I = F(() => new Set(O.map((y) => y.userId)), [O]), V = F(() => C.filter((y) => !I.has(y.id)), [C, I]), z = F(() => {
|
|
811
|
+
if (!l) return V;
|
|
812
|
+
const y = l.toLowerCase();
|
|
813
|
+
return V.filter(
|
|
814
|
+
(k) => {
|
|
815
|
+
var G, j;
|
|
816
|
+
return ((G = k.name) == null ? void 0 : G.toLowerCase().includes(y)) || ((j = k.email) == null ? void 0 : j.toLowerCase().includes(y));
|
|
817
|
+
}
|
|
818
|
+
);
|
|
819
|
+
}, [V, l]), x = F(() => {
|
|
820
|
+
if (!l) return O;
|
|
821
|
+
const y = l.toLowerCase();
|
|
822
|
+
return O.filter(
|
|
823
|
+
(k) => {
|
|
824
|
+
var G, j, me, te;
|
|
825
|
+
return ((j = (G = k.user) == null ? void 0 : G.name) == null ? void 0 : j.toLowerCase().includes(y)) || ((te = (me = k.user) == null ? void 0 : me.email) == null ? void 0 : te.toLowerCase().includes(y));
|
|
826
|
+
}
|
|
827
|
+
);
|
|
828
|
+
}, [O, l]), B = async () => {
|
|
829
|
+
if (f.length !== 0)
|
|
830
|
+
try {
|
|
831
|
+
await D.mutateAsync({
|
|
832
|
+
groupId: n.id,
|
|
833
|
+
data: {
|
|
834
|
+
userIds: f,
|
|
835
|
+
userType: b === "tenant" ? "tenant" : "org"
|
|
836
|
+
}
|
|
837
|
+
}), v([]), d("members"), o(), a == null || a();
|
|
838
|
+
} catch (y) {
|
|
839
|
+
console.error("Failed to add members:", y);
|
|
840
|
+
}
|
|
841
|
+
}, W = async () => {
|
|
842
|
+
if (h.length !== 0)
|
|
843
|
+
try {
|
|
844
|
+
await E.mutateAsync({
|
|
845
|
+
groupId: n.id,
|
|
846
|
+
data: {
|
|
847
|
+
userIds: h
|
|
848
|
+
}
|
|
849
|
+
}), g([]), o(), a == null || a();
|
|
850
|
+
} catch (y) {
|
|
851
|
+
console.error("Failed to remove members:", y);
|
|
852
|
+
}
|
|
853
|
+
}, H = (y) => {
|
|
854
|
+
v(
|
|
855
|
+
(k) => k.includes(y) ? k.filter((G) => G !== y) : [...k, y]
|
|
856
|
+
);
|
|
857
|
+
}, ee = (y) => {
|
|
858
|
+
g(
|
|
859
|
+
(k) => k.includes(y) ? k.filter((G) => G !== y) : [...k, y]
|
|
860
|
+
);
|
|
861
|
+
};
|
|
862
|
+
return /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(Ge, { open: t, onOpenChange: s, children: /* @__PURE__ */ c($e, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
|
|
863
|
+
/* @__PURE__ */ c(Ve, { children: [
|
|
864
|
+
/* @__PURE__ */ e(ze, { children: n.name }),
|
|
865
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ c("p", { className: "text-sm text-muted-foreground", children: [
|
|
866
|
+
O.length,
|
|
867
|
+
" ",
|
|
868
|
+
O.length === 1 ? "member" : "members"
|
|
869
|
+
] }) }),
|
|
870
|
+
/* @__PURE__ */ c("p", { id: "group-members-description", className: "sr-only", children: [
|
|
871
|
+
"Add or remove members from the ",
|
|
872
|
+
n.name,
|
|
873
|
+
" group"
|
|
874
|
+
] })
|
|
875
|
+
] }),
|
|
876
|
+
/* @__PURE__ */ c(ma, { value: r, onValueChange: (y) => {
|
|
877
|
+
d(y), u(""), g([]);
|
|
878
|
+
}, className: "mt-4", children: [
|
|
879
|
+
/* @__PURE__ */ c(ha, { className: "grid w-full grid-cols-2", children: [
|
|
880
|
+
/* @__PURE__ */ e(_e, { value: "members", children: "Current Members" }),
|
|
881
|
+
/* @__PURE__ */ e(_e, { value: "add", children: "Add Members" })
|
|
882
|
+
] }),
|
|
883
|
+
/* @__PURE__ */ c(Ue, { value: "members", className: "mt-4 space-y-4", children: [
|
|
884
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
885
|
+
/* @__PURE__ */ e(pt, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
886
|
+
/* @__PURE__ */ e(
|
|
887
|
+
ue,
|
|
888
|
+
{
|
|
889
|
+
placeholder: "Search members...",
|
|
890
|
+
value: l,
|
|
891
|
+
onChange: (y) => u(y.target.value),
|
|
892
|
+
className: "pl-10"
|
|
893
|
+
}
|
|
894
|
+
)
|
|
895
|
+
] }),
|
|
896
|
+
/* @__PURE__ */ e(mt, { className: h.length > 0 ? "h-[300px]" : "h-[350px]", children: m ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((y) => /* @__PURE__ */ e(ft, { className: "h-16 w-full" }, y)) }) : x.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
897
|
+
/* @__PURE__ */ e(Ct, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
898
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: l ? "No members found" : "No members yet" }),
|
|
899
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
|
|
900
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: x.map((y) => /* @__PURE__ */ e(
|
|
901
|
+
lr,
|
|
902
|
+
{
|
|
903
|
+
member: y,
|
|
904
|
+
selected: h.includes(y.userId),
|
|
905
|
+
onToggle: () => ee(y.userId)
|
|
906
|
+
},
|
|
907
|
+
y.id
|
|
908
|
+
)) }) }),
|
|
909
|
+
h.length > 0 && /* @__PURE__ */ c("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
910
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-muted-foreground", children: [
|
|
911
|
+
h.length,
|
|
912
|
+
" member",
|
|
913
|
+
h.length !== 1 ? "s" : "",
|
|
914
|
+
" selected"
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ e(
|
|
917
|
+
A,
|
|
918
|
+
{
|
|
919
|
+
variant: "destructive",
|
|
920
|
+
size: "sm",
|
|
921
|
+
onClick: W,
|
|
922
|
+
disabled: E.isPending,
|
|
923
|
+
children: E.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
924
|
+
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
925
|
+
"Removing..."
|
|
926
|
+
] }) : /* @__PURE__ */ c(T, { children: [
|
|
927
|
+
/* @__PURE__ */ e(va, { className: "mr-2 h-4 w-4" }),
|
|
928
|
+
"Remove Selected"
|
|
929
|
+
] })
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
] })
|
|
933
|
+
] }),
|
|
934
|
+
/* @__PURE__ */ c(Ue, { value: "add", className: "mt-4 space-y-4", children: [
|
|
935
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
936
|
+
/* @__PURE__ */ e(pt, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
937
|
+
/* @__PURE__ */ e(
|
|
938
|
+
ue,
|
|
939
|
+
{
|
|
940
|
+
placeholder: "Search users to add...",
|
|
941
|
+
value: l,
|
|
942
|
+
onChange: (y) => u(y.target.value),
|
|
943
|
+
className: "pl-10"
|
|
944
|
+
}
|
|
945
|
+
)
|
|
946
|
+
] }),
|
|
947
|
+
/* @__PURE__ */ e(mt, { className: "h-[300px]", children: w ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((y) => /* @__PURE__ */ e(ft, { className: "h-16 w-full" }, y)) }) : z.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
948
|
+
/* @__PURE__ */ e(gt, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
949
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
|
|
950
|
+
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: l ? "Try a different search" : "All eligible users are already members" })
|
|
951
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: z.map((y) => /* @__PURE__ */ e(
|
|
952
|
+
dr,
|
|
953
|
+
{
|
|
954
|
+
user: y,
|
|
955
|
+
selected: f.includes(y.id),
|
|
956
|
+
onToggle: () => H(y.id)
|
|
957
|
+
},
|
|
958
|
+
y.id
|
|
959
|
+
)) }) }),
|
|
960
|
+
f.length > 0 && /* @__PURE__ */ c("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
961
|
+
/* @__PURE__ */ c("span", { className: "text-sm text-muted-foreground", children: [
|
|
962
|
+
f.length,
|
|
963
|
+
" user",
|
|
964
|
+
f.length !== 1 ? "s" : "",
|
|
965
|
+
" selected"
|
|
966
|
+
] }),
|
|
967
|
+
/* @__PURE__ */ e(
|
|
968
|
+
A,
|
|
969
|
+
{
|
|
970
|
+
onClick: B,
|
|
971
|
+
disabled: D.isPending,
|
|
972
|
+
children: D.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
973
|
+
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
974
|
+
"Adding..."
|
|
975
|
+
] }) : /* @__PURE__ */ c(T, { children: [
|
|
976
|
+
/* @__PURE__ */ e(gt, { className: "mr-2 h-4 w-4" }),
|
|
977
|
+
"Add Members"
|
|
978
|
+
] })
|
|
979
|
+
}
|
|
980
|
+
)
|
|
981
|
+
] })
|
|
982
|
+
] })
|
|
983
|
+
] })
|
|
984
|
+
] }) }) });
|
|
985
|
+
}
|
|
986
|
+
function lr({
|
|
987
|
+
member: t,
|
|
988
|
+
selected: s,
|
|
989
|
+
onToggle: n
|
|
990
|
+
}) {
|
|
991
|
+
var r, d, l, u;
|
|
992
|
+
const a = ((d = (r = t.user) == null ? void 0 : r.name) == null ? void 0 : d.split(" ").map((f) => f[0]).join("").toUpperCase()) || "?";
|
|
993
|
+
return /* @__PURE__ */ c(
|
|
994
|
+
"div",
|
|
995
|
+
{
|
|
996
|
+
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
997
|
+
onClick: n,
|
|
998
|
+
children: [
|
|
999
|
+
/* @__PURE__ */ e(ba, { checked: s }),
|
|
1000
|
+
/* @__PURE__ */ e(Mt, { className: "h-8 w-8", children: /* @__PURE__ */ e(At, { className: "text-xs", children: a }) }),
|
|
1001
|
+
/* @__PURE__ */ c("div", { className: "flex-1", children: [
|
|
1002
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((l = t.user) == null ? void 0 : l.name) || "Unknown User" }),
|
|
1003
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (u = t.user) == null ? void 0 : u.email })
|
|
1004
|
+
] })
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
);
|
|
1008
|
+
}
|
|
1009
|
+
function dr({
|
|
1010
|
+
user: t,
|
|
1011
|
+
selected: s,
|
|
1012
|
+
onToggle: n
|
|
1013
|
+
}) {
|
|
1014
|
+
var r;
|
|
1015
|
+
const a = ((r = t.name) == null ? void 0 : r.split(" ").map((d) => d[0]).join("").toUpperCase()) || "?";
|
|
1016
|
+
return /* @__PURE__ */ c(
|
|
1017
|
+
"div",
|
|
1018
|
+
{
|
|
1019
|
+
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1020
|
+
onClick: n,
|
|
1021
|
+
children: [
|
|
1022
|
+
/* @__PURE__ */ e(ba, { checked: s }),
|
|
1023
|
+
/* @__PURE__ */ e(Mt, { className: "h-8 w-8", children: /* @__PURE__ */ e(At, { className: "text-xs", children: a }) }),
|
|
1024
|
+
/* @__PURE__ */ c("div", { className: "flex-1", children: [
|
|
1025
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: t.name }),
|
|
1026
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t.email })
|
|
1027
|
+
] })
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1032
|
+
function ur({
|
|
1033
|
+
open: t,
|
|
1034
|
+
onOpenChange: s
|
|
1035
|
+
}) {
|
|
1036
|
+
const [n, a] = S("groups"), [r, d] = S(""), [l, u] = S(null), [f, v] = S(!1), [h, g] = S(null), { tokenProps: p } = K(), { currentUser: m } = Dt(), o = Wn(), b = (m == null ? void 0 : m.type) === "tenant", C = p == null ? void 0 : p.tenantId, { groups: w, isLoading: D, refetch: E } = Ps({
|
|
1037
|
+
type: b ? "TENANT_GROUP" : "all",
|
|
1038
|
+
tenantId: b ? C : void 0,
|
|
1039
|
+
includeMembers: !1
|
|
1040
|
+
}), O = w.filter(
|
|
1041
|
+
(x) => {
|
|
1042
|
+
var B;
|
|
1043
|
+
return x.name.toLowerCase().includes(r.toLowerCase()) || ((B = x.description) == null ? void 0 : B.toLowerCase().includes(r.toLowerCase()));
|
|
1044
|
+
}
|
|
1045
|
+
), I = async () => {
|
|
1046
|
+
if (h)
|
|
1047
|
+
try {
|
|
1048
|
+
await o.mutateAsync(h.id), g(null), E();
|
|
1049
|
+
} catch (x) {
|
|
1050
|
+
console.error("Failed to delete group:", x);
|
|
1051
|
+
}
|
|
1052
|
+
}, V = (x) => {
|
|
1053
|
+
u(x), v(!0);
|
|
1054
|
+
}, z = () => {
|
|
1055
|
+
a("groups"), E();
|
|
1056
|
+
};
|
|
1057
|
+
return /* @__PURE__ */ c(T, { children: [
|
|
1058
|
+
/* @__PURE__ */ e(Ge, { open: t, onOpenChange: s, children: /* @__PURE__ */ c($e, { className: "max-h-[80vh] max-w-3xl rounded-[6px] border-border/60 sm:rounded-[6px]", children: [
|
|
1059
|
+
/* @__PURE__ */ c(Ve, { children: [
|
|
1060
|
+
/* @__PURE__ */ e(ze, { className: "text-[15px]", children: "Group management" }),
|
|
1061
|
+
/* @__PURE__ */ e(wt, { className: "text-[13px] leading-5", children: "Manage groups, create new ones, and control membership." })
|
|
1062
|
+
] }),
|
|
1063
|
+
/* @__PURE__ */ c(
|
|
1064
|
+
ma,
|
|
1065
|
+
{
|
|
1066
|
+
value: n,
|
|
1067
|
+
onValueChange: a,
|
|
1068
|
+
className: "mt-2",
|
|
1069
|
+
children: [
|
|
1070
|
+
/* @__PURE__ */ c(ha, { className: "h-8 w-full justify-start gap-1 bg-transparent p-0 border-b border-border/60 rounded-none", children: [
|
|
1071
|
+
/* @__PURE__ */ e(
|
|
1072
|
+
_e,
|
|
1073
|
+
{
|
|
1074
|
+
value: "groups",
|
|
1075
|
+
className: "h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",
|
|
1076
|
+
children: "Groups"
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
/* @__PURE__ */ e(
|
|
1080
|
+
_e,
|
|
1081
|
+
{
|
|
1082
|
+
value: "create",
|
|
1083
|
+
className: "h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",
|
|
1084
|
+
children: "Create group"
|
|
1085
|
+
}
|
|
1086
|
+
)
|
|
1087
|
+
] }),
|
|
1088
|
+
/* @__PURE__ */ e(Ue, { value: "groups", className: "mt-4", children: /* @__PURE__ */ c("div", { className: "space-y-3", children: [
|
|
1089
|
+
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
1090
|
+
/* @__PURE__ */ e(pt, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
1091
|
+
/* @__PURE__ */ e(
|
|
1092
|
+
ue,
|
|
1093
|
+
{
|
|
1094
|
+
size: "xs",
|
|
1095
|
+
placeholder: "Search groups…",
|
|
1096
|
+
value: r,
|
|
1097
|
+
onChange: (x) => d(x.target.value),
|
|
1098
|
+
className: "pl-7"
|
|
1099
|
+
}
|
|
1100
|
+
)
|
|
1101
|
+
] }),
|
|
1102
|
+
/* @__PURE__ */ e(mt, { className: "h-[400px]", children: D ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((x) => /* @__PURE__ */ e(
|
|
1103
|
+
ft,
|
|
1104
|
+
{
|
|
1105
|
+
className: "h-16 w-full rounded-[6px]"
|
|
1106
|
+
},
|
|
1107
|
+
x
|
|
1108
|
+
)) }) : O.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
1109
|
+
/* @__PURE__ */ e("p", { className: "text-[13px]", children: "No groups found." }),
|
|
1110
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-[12px]", children: r ? "Try a different search." : "Create your first group to get started." })
|
|
1111
|
+
] }) : /* @__PURE__ */ e("div", { className: "space-y-2 pr-2", children: O.map((x) => /* @__PURE__ */ e(
|
|
1112
|
+
mr,
|
|
1113
|
+
{
|
|
1114
|
+
group: x,
|
|
1115
|
+
onManageMembers: () => V(x),
|
|
1116
|
+
onDelete: () => g(x),
|
|
1117
|
+
currentUserId: m == null ? void 0 : m.id
|
|
1118
|
+
},
|
|
1119
|
+
x.id
|
|
1120
|
+
)) }) })
|
|
1121
|
+
] }) }),
|
|
1122
|
+
/* @__PURE__ */ e(Ue, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
|
|
1123
|
+
Xn,
|
|
1124
|
+
{
|
|
1125
|
+
onSuccess: z,
|
|
1126
|
+
tenantId: C,
|
|
1127
|
+
isTenantUser: b
|
|
1128
|
+
}
|
|
1129
|
+
) })
|
|
1130
|
+
]
|
|
1131
|
+
}
|
|
1132
|
+
)
|
|
1133
|
+
] }) }),
|
|
1134
|
+
l && /* @__PURE__ */ e(
|
|
1135
|
+
cr,
|
|
1136
|
+
{
|
|
1137
|
+
open: f,
|
|
1138
|
+
onOpenChange: v,
|
|
1139
|
+
group: l,
|
|
1140
|
+
onUpdate: () => E()
|
|
1141
|
+
}
|
|
1142
|
+
),
|
|
1143
|
+
/* @__PURE__ */ e(
|
|
1144
|
+
ya,
|
|
1145
|
+
{
|
|
1146
|
+
open: !!h,
|
|
1147
|
+
onOpenChange: () => g(null),
|
|
1148
|
+
children: /* @__PURE__ */ c(xa, { children: [
|
|
1149
|
+
/* @__PURE__ */ c(Sa, { children: [
|
|
1150
|
+
/* @__PURE__ */ e(Na, { children: "Delete group" }),
|
|
1151
|
+
/* @__PURE__ */ c(wa, { children: [
|
|
1152
|
+
'Delete "',
|
|
1153
|
+
h == null ? void 0 : h.name,
|
|
1154
|
+
`"? This removes all members and can't be undone.`
|
|
1155
|
+
] })
|
|
1156
|
+
] }),
|
|
1157
|
+
/* @__PURE__ */ c(Da, { children: [
|
|
1158
|
+
/* @__PURE__ */ e(Ca, { children: "Cancel" }),
|
|
1159
|
+
/* @__PURE__ */ e(
|
|
1160
|
+
vt,
|
|
1161
|
+
{
|
|
1162
|
+
onClick: I,
|
|
1163
|
+
disabled: o.isPending,
|
|
1164
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1165
|
+
children: o.isPending ? /* @__PURE__ */ c(T, { children: [
|
|
1166
|
+
/* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1167
|
+
"Deleting…"
|
|
1168
|
+
] }) : "Delete group"
|
|
1169
|
+
}
|
|
1170
|
+
)
|
|
1171
|
+
] })
|
|
1172
|
+
] })
|
|
1173
|
+
}
|
|
1174
|
+
)
|
|
1175
|
+
] });
|
|
1176
|
+
}
|
|
1177
|
+
function mr({
|
|
1178
|
+
group: t,
|
|
1179
|
+
onManageMembers: s,
|
|
1180
|
+
onDelete: n,
|
|
1181
|
+
currentUserId: a
|
|
1182
|
+
}) {
|
|
1183
|
+
const r = t.createdBy === a;
|
|
1184
|
+
return /* @__PURE__ */ e("div", { className: "rounded-[6px] border border-border/60 bg-card px-3 py-2.5 transition-colors hover:bg-muted/30", children: /* @__PURE__ */ c("div", { className: "flex items-start justify-between gap-2", children: [
|
|
1185
|
+
/* @__PURE__ */ c("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
1186
|
+
/* @__PURE__ */ e("h4", { className: "text-[13px] font-medium text-foreground", children: t.name }),
|
|
1187
|
+
t.description && /* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: t.description }),
|
|
1188
|
+
/* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground", children: [
|
|
1189
|
+
/* @__PURE__ */ c("span", { className: "inline-flex items-center gap-1", children: [
|
|
1190
|
+
/* @__PURE__ */ e(Ct, { className: "h-3 w-3" }),
|
|
1191
|
+
t.memberCount,
|
|
1192
|
+
" ",
|
|
1193
|
+
t.memberCount === 1 ? "member" : "members"
|
|
1194
|
+
] }),
|
|
1195
|
+
/* @__PURE__ */ c("span", { children: [
|
|
1196
|
+
"Created ",
|
|
1197
|
+
xn(new Date(t.createdAt), "MMM d, yyyy")
|
|
1198
|
+
] })
|
|
1199
|
+
] })
|
|
1200
|
+
] }),
|
|
1201
|
+
/* @__PURE__ */ c("div", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
1202
|
+
/* @__PURE__ */ e(
|
|
1203
|
+
A,
|
|
1204
|
+
{
|
|
1205
|
+
variant: "ghost",
|
|
1206
|
+
size: "xs",
|
|
1207
|
+
className: "h-7 w-7 p-0 text-muted-foreground hover:text-foreground",
|
|
1208
|
+
onClick: s,
|
|
1209
|
+
title: "Manage members",
|
|
1210
|
+
"aria-label": "Manage members",
|
|
1211
|
+
children: /* @__PURE__ */ e(gt, { className: "h-3.5 w-3.5" })
|
|
1212
|
+
}
|
|
1213
|
+
),
|
|
1214
|
+
r && /* @__PURE__ */ e(
|
|
1215
|
+
A,
|
|
1216
|
+
{
|
|
1217
|
+
variant: "ghost",
|
|
1218
|
+
size: "xs",
|
|
1219
|
+
className: "h-7 w-7 p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
|
|
1220
|
+
onClick: n,
|
|
1221
|
+
title: "Delete group",
|
|
1222
|
+
"aria-label": "Delete group",
|
|
1223
|
+
children: /* @__PURE__ */ e(va, { className: "h-3.5 w-3.5" })
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
] })
|
|
1227
|
+
] }) });
|
|
1228
|
+
}
|
|
1229
|
+
function ce(t, s, n) {
|
|
1230
|
+
var d, l;
|
|
1231
|
+
const a = (t.controls || []).find(
|
|
1232
|
+
(u) => u.id === n
|
|
1233
|
+
);
|
|
1234
|
+
if (a)
|
|
1235
|
+
return a.label;
|
|
1236
|
+
const r = (l = (d = pa(t, s)) == null ? void 0 : d.controls) == null ? void 0 : l.find(
|
|
1237
|
+
(u) => u.id === n
|
|
1238
|
+
);
|
|
1239
|
+
return (r == null ? void 0 : r.label) || n;
|
|
1240
|
+
}
|
|
1241
|
+
function le(t, s) {
|
|
1242
|
+
var n;
|
|
1243
|
+
return ((n = pa(t, s)) == null ? void 0 : n.title) || s;
|
|
1244
|
+
}
|
|
1245
|
+
function hr(t) {
|
|
1246
|
+
const { errors: s, dashboard: n } = t;
|
|
1247
|
+
if (!n)
|
|
1248
|
+
return s;
|
|
1249
|
+
const a = /* @__PURE__ */ new Map();
|
|
1250
|
+
for (const r of s) {
|
|
1251
|
+
const d = r.match(
|
|
1252
|
+
/^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/
|
|
1253
|
+
);
|
|
1254
|
+
if (d) {
|
|
1255
|
+
const [, h, g] = d, p = `${h}:${g}:missing-metric`;
|
|
1256
|
+
a.has(p) || a.set(
|
|
1257
|
+
p,
|
|
1258
|
+
`"${le(n, h)}" has an outdated "${ce(
|
|
1259
|
+
n,
|
|
1260
|
+
h,
|
|
1261
|
+
g
|
|
1262
|
+
)}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`
|
|
1263
|
+
);
|
|
1264
|
+
continue;
|
|
1265
|
+
}
|
|
1266
|
+
const l = r.match(
|
|
1267
|
+
/^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/
|
|
1268
|
+
);
|
|
1269
|
+
if (l) {
|
|
1270
|
+
const [, h, g] = l, p = `${h}:${g}:missing-group-by`;
|
|
1271
|
+
a.has(p) || a.set(
|
|
1272
|
+
p,
|
|
1273
|
+
`"${le(n, h)}" has an outdated "${ce(
|
|
1274
|
+
n,
|
|
1275
|
+
h,
|
|
1276
|
+
g
|
|
1277
|
+
)}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`
|
|
1278
|
+
);
|
|
1279
|
+
continue;
|
|
1280
|
+
}
|
|
1281
|
+
const u = r.match(
|
|
1282
|
+
/^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/
|
|
1283
|
+
);
|
|
1284
|
+
if (u) {
|
|
1285
|
+
const [, h, g] = u, p = `${h}:${g}:invalid-metric`;
|
|
1286
|
+
a.has(p) || a.set(
|
|
1287
|
+
p,
|
|
1288
|
+
`"${le(n, h)}" has an invalid "${ce(
|
|
1289
|
+
n,
|
|
1290
|
+
h,
|
|
1291
|
+
g
|
|
1292
|
+
)}" metric mapping. Open the card controls and choose a valid metric for each option.`
|
|
1293
|
+
);
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
const f = r.match(
|
|
1297
|
+
/^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/
|
|
1298
|
+
);
|
|
1299
|
+
if (f) {
|
|
1300
|
+
const [, h, g] = f, p = `${h}:${g}:invalid-group-by`;
|
|
1301
|
+
a.has(p) || a.set(
|
|
1302
|
+
p,
|
|
1303
|
+
`"${le(n, h)}" has an invalid "${ce(
|
|
1304
|
+
n,
|
|
1305
|
+
h,
|
|
1306
|
+
g
|
|
1307
|
+
)}" field mapping. Open the card controls and choose a valid field for each option.`
|
|
1308
|
+
);
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1311
|
+
const v = r.match(
|
|
1312
|
+
/^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/
|
|
1313
|
+
);
|
|
1314
|
+
if (v) {
|
|
1315
|
+
const [, h, g] = v, p = `${h}:${g}:missing-temporal-group-by`;
|
|
1316
|
+
a.has(p) || a.set(
|
|
1317
|
+
p,
|
|
1318
|
+
`"${le(n, h)}" can no longer use "${ce(
|
|
1319
|
+
n,
|
|
1320
|
+
h,
|
|
1321
|
+
g
|
|
1322
|
+
)}" for time grain because the card does not currently group by a date field.`
|
|
1323
|
+
);
|
|
1324
|
+
continue;
|
|
1325
|
+
}
|
|
1326
|
+
a.set(r, r);
|
|
1327
|
+
}
|
|
1328
|
+
return Array.from(a.values());
|
|
1329
|
+
}
|
|
1330
|
+
const pr = [
|
|
1331
|
+
"enum",
|
|
1332
|
+
"multi_enum",
|
|
1333
|
+
"text",
|
|
1334
|
+
"number",
|
|
1335
|
+
"boolean",
|
|
1336
|
+
"date"
|
|
1337
|
+
];
|
|
1338
|
+
function fr({
|
|
1339
|
+
open: t,
|
|
1340
|
+
onOpenChange: s,
|
|
1341
|
+
initialMode: n = "manage"
|
|
1342
|
+
}) {
|
|
1343
|
+
var z;
|
|
1344
|
+
const a = n === "create", {
|
|
1345
|
+
forceClose: r,
|
|
1346
|
+
handleOpenChange: d,
|
|
1347
|
+
isCreateFlowActive: l,
|
|
1348
|
+
preventPassiveDismissDuringCreate: u,
|
|
1349
|
+
resolvedOpen: f,
|
|
1350
|
+
setIsCreateFlowActive: v
|
|
1351
|
+
} = Dn({
|
|
1352
|
+
open: t,
|
|
1353
|
+
onOpenChange: s,
|
|
1354
|
+
initialCreateFlowActive: n === "create",
|
|
1355
|
+
dismissMode: "explicit-only"
|
|
1356
|
+
}), h = N((x) => x.dashboard), g = N((x) => x.selectedSheetId), { updateSheetDocument: p } = Nt(), m = (z = h.sheets) == null ? void 0 : z.find(
|
|
1357
|
+
(x) => x.id === g
|
|
1358
|
+
), o = (m == null ? void 0 : m.kind) === "document" && !!m.document, b = F(
|
|
1359
|
+
() => o && (m != null && m.document) ? m.document.inputs || [] : [],
|
|
1360
|
+
[o, m == null ? void 0 : m.document]
|
|
1361
|
+
), C = F(
|
|
1362
|
+
() => b.filter(
|
|
1363
|
+
(x) => x.kind === "control"
|
|
1364
|
+
),
|
|
1365
|
+
[b]
|
|
1366
|
+
), w = F(
|
|
1367
|
+
() => C.map((x) => x.control),
|
|
1368
|
+
[C]
|
|
1369
|
+
), D = F(
|
|
1370
|
+
() => vr(w),
|
|
1371
|
+
[w]
|
|
1372
|
+
), E = F(
|
|
1373
|
+
() => gr(h),
|
|
1374
|
+
[h]
|
|
1375
|
+
), O = Fe(() => {
|
|
1376
|
+
if (a) {
|
|
1377
|
+
r();
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
v(!1);
|
|
1381
|
+
}, [a, r, v]), I = Fe(
|
|
1382
|
+
(x, B, W) => {
|
|
1383
|
+
!o || !(m != null && m.document) || p(m.id, (H) => ({
|
|
1384
|
+
...H,
|
|
1385
|
+
inputs: yr({
|
|
1386
|
+
currentInputs: H.inputs || [],
|
|
1387
|
+
nextControls: x,
|
|
1388
|
+
nextDefaultValues: B,
|
|
1389
|
+
change: W
|
|
1390
|
+
})
|
|
1391
|
+
}));
|
|
1392
|
+
},
|
|
1393
|
+
[o, m, p]
|
|
1394
|
+
);
|
|
1395
|
+
return !o || !(m != null && m.document) ? null : /* @__PURE__ */ e(Ge, { open: f, onOpenChange: d, children: /* @__PURE__ */ c(
|
|
1396
|
+
$e,
|
|
1397
|
+
{
|
|
1398
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
1399
|
+
onEscapeKeyDown: u,
|
|
1400
|
+
onPointerDownOutside: u,
|
|
1401
|
+
children: [
|
|
1402
|
+
/* @__PURE__ */ c(Ve, { className: l ? "space-y-0" : void 0, children: [
|
|
1403
|
+
/* @__PURE__ */ e(ze, { className: "text-[15px]", children: l ? "Add document control" : "Document Controls" }),
|
|
1404
|
+
/* @__PURE__ */ e(
|
|
1405
|
+
wt,
|
|
1406
|
+
{
|
|
1407
|
+
className: l ? "sr-only" : "text-[13px]",
|
|
1408
|
+
children: l ? "Configure and add a document-local control input." : "Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."
|
|
1409
|
+
}
|
|
1410
|
+
)
|
|
1411
|
+
] }),
|
|
1412
|
+
/* @__PURE__ */ e("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ e(
|
|
1413
|
+
Cn,
|
|
1414
|
+
{
|
|
1415
|
+
scope: "dashboard",
|
|
1416
|
+
controls: w,
|
|
1417
|
+
reservedControlIds: E,
|
|
1418
|
+
defaultValues: D,
|
|
1419
|
+
usageByControlId: {},
|
|
1420
|
+
availableFieldChoices: [],
|
|
1421
|
+
availableMetricChoices: [],
|
|
1422
|
+
structuralParticipants: [],
|
|
1423
|
+
structuralParticipantIdsByControlId: {},
|
|
1424
|
+
allowedControlTypes: pr,
|
|
1425
|
+
initialCreateFlow: n === "create",
|
|
1426
|
+
onCreateFlowActiveChange: v,
|
|
1427
|
+
onCreateFlowComplete: O,
|
|
1428
|
+
onChange: I,
|
|
1429
|
+
emptyMessage: "No document controls yet."
|
|
1430
|
+
}
|
|
1431
|
+
) })
|
|
1432
|
+
]
|
|
1433
|
+
}
|
|
1434
|
+
) });
|
|
1435
|
+
}
|
|
1436
|
+
function gr(t) {
|
|
1437
|
+
return (t.controls || []).map((s) => s.id);
|
|
1438
|
+
}
|
|
1439
|
+
function vr(t) {
|
|
1440
|
+
const s = {};
|
|
1441
|
+
for (const n of t)
|
|
1442
|
+
n.defaultValue !== void 0 && (s[n.id] = n.defaultValue);
|
|
1443
|
+
return s;
|
|
1444
|
+
}
|
|
1445
|
+
function br(t, s) {
|
|
1446
|
+
return s ? Object.prototype.hasOwnProperty.call(s, t.id) ? {
|
|
1447
|
+
...t,
|
|
1448
|
+
defaultValue: s[t.id]
|
|
1449
|
+
} : t.defaultValue === void 0 ? t : { ...t, defaultValue: void 0 } : t.defaultValue === void 0 ? t : { ...t, defaultValue: void 0 };
|
|
1450
|
+
}
|
|
1451
|
+
function yr({
|
|
1452
|
+
currentInputs: t,
|
|
1453
|
+
nextControls: s,
|
|
1454
|
+
nextDefaultValues: n,
|
|
1455
|
+
change: a
|
|
1456
|
+
}) {
|
|
1457
|
+
const r = new Map(
|
|
1458
|
+
s.map((f) => [
|
|
1459
|
+
f.id,
|
|
1460
|
+
br(f, n)
|
|
1461
|
+
])
|
|
1462
|
+
), d = (a == null ? void 0 : a.type) === "rename" ? { oldId: a.oldId, newId: a.newId } : null, l = /* @__PURE__ */ new Set(), u = [];
|
|
1463
|
+
for (const f of t) {
|
|
1464
|
+
if (f.kind !== "control") {
|
|
1465
|
+
u.push(f);
|
|
1466
|
+
continue;
|
|
1467
|
+
}
|
|
1468
|
+
const v = r.get(f.control.id) || ((d == null ? void 0 : d.oldId) === f.control.id ? r.get(d.newId) : void 0);
|
|
1469
|
+
v && (l.add(v.id), u.push({
|
|
1470
|
+
...f,
|
|
1471
|
+
label: v.label,
|
|
1472
|
+
requiredAtExecution: v.requiredAtExecution,
|
|
1473
|
+
control: v
|
|
1474
|
+
}));
|
|
1475
|
+
}
|
|
1476
|
+
for (const f of r.values())
|
|
1477
|
+
l.has(f.id) || u.push(
|
|
1478
|
+
Ts({
|
|
1479
|
+
control: f,
|
|
1480
|
+
existingInputs: u
|
|
1481
|
+
})
|
|
1482
|
+
);
|
|
1483
|
+
return u;
|
|
1484
|
+
}
|
|
1485
|
+
function la(t, s) {
|
|
1486
|
+
return {
|
|
1487
|
+
dashboard: bt(t),
|
|
1488
|
+
semanticExecutionPayload: bt(s)
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
function _r() {
|
|
1492
|
+
var Qt, Wt, Jt, Yt, Xt, Zt;
|
|
1493
|
+
mn(), hn();
|
|
1494
|
+
const {
|
|
1495
|
+
authToken: t,
|
|
1496
|
+
tokenProps: s,
|
|
1497
|
+
id: n
|
|
1498
|
+
} = K(), { isLocalDev: a } = _s(), { openBrandStudioPreview: r } = Us(), { permissions: d } = qn(), l = Fs(), { isLoading: u } = Rs(), f = N((i) => i.theme), v = N((i) => i.isDownloadingPdf), h = N(
|
|
1499
|
+
(i) => i.dashboardAssistantDraftScopeKey
|
|
1500
|
+
), g = N((i) => i.lenses), p = N((i) => i.selectedLensId), m = g == null ? void 0 : g.find((i) => i.id === p), o = N((i) => i.dashboard), b = N((i) => i.selectedSheetId), C = (Qt = o == null ? void 0 : o.sheets) == null ? void 0 : Qt.find(
|
|
1501
|
+
(i) => i.id === b
|
|
1502
|
+
), w = ms(C), D = w ? (Wt = C == null ? void 0 : C.document) == null ? void 0 : Wt.page : void 0, E = N(
|
|
1503
|
+
(i) => i.isDashboardEditing
|
|
1504
|
+
), { setDashboardTitle: O } = N((i) => i.actions), [I, V] = S(!1), [z, x] = S(!1), [B, W] = S(!1), [H, ee] = S(!1), [y, k] = S(!1), [G, j] = S(!1), [me, te] = S(!1), [Ua, Lt] = S(!1), [He, he] = S(null), [Fa, pe] = S(!1), [fe, ge] = S(null), [Ot, ve] = S([]), [kt, be] = S(!1), Ra = N((i) => i.isDashboardPanelOpen), Ga = N(
|
|
1505
|
+
(i) => i.actions.setIsDashboardPanelOpen
|
|
1506
|
+
), $a = N((i) => i.filterValues), _ = N((i) => i.isVisualEditing);
|
|
1507
|
+
ta((i) => i.card);
|
|
1508
|
+
const ae = ke(
|
|
1509
|
+
(i) => i.selectedDashboard
|
|
1510
|
+
), ye = ke(
|
|
1511
|
+
(i) => i.initialDashboard
|
|
1512
|
+
);
|
|
1513
|
+
ke((i) => i.selectedVisual), N((i) => i.selectedFrameId), ta((i) => i.frame);
|
|
1514
|
+
const xe = ae ? (Yt = ae == null ? void 0 : ae.permissions) == null ? void 0 : Yt.canEdit : (Jt = ye == null ? void 0 : ye.permissions) == null ? void 0 : Jt.canEdit, Se = N((i) => i.showFilters), Pt = Gs((i) => i.setPanelOpen), Tt = N(
|
|
1515
|
+
(i) => i.showDashboardJSON
|
|
1516
|
+
), je = N((i) => i.onSaveFunction), _t = N(
|
|
1517
|
+
(i) => i.actions.setShowFilters
|
|
1518
|
+
), {
|
|
1519
|
+
setDocumentInspectorTab: Ut,
|
|
1520
|
+
setIsDashboardEditing: Ft,
|
|
1521
|
+
setShowDashboardJSON: Rt
|
|
1522
|
+
} = N((i) => i.actions), { setInitialDashboard: Gt, clearSelectedDashboard: Ke } = ke(
|
|
1523
|
+
(i) => i.actions
|
|
1524
|
+
), { resources: Ne } = $s(nt.DASHBOARD), { data: Qe } = Vs(), Va = ((Xt = Qe == null ? void 0 : Qe.preference) == null ? void 0 : Xt.defaultDashboardId) || null, { mutate: za, isPending: qa } = zs(), { currentUser: Ba } = Dt(), Ha = qs(Ba), J = ae || ye, $t = J ? {
|
|
1525
|
+
id: J.id,
|
|
1526
|
+
title: (o == null ? void 0 : o.title) || J.title || "Dashboard"
|
|
1527
|
+
} : null, { handleAddNewFrame: ja } = Bs(), [We, Je] = S(!1), [Ka, se] = S(!1), [Ye, we] = S("close"), ne = Hs(nt.DASHBOARD), [R, De] = S(null), Vt = Fe((i) => {
|
|
1528
|
+
window.setTimeout(() => {
|
|
1529
|
+
he(i);
|
|
1530
|
+
}, 0);
|
|
1531
|
+
}, []), Qa = async (i, P) => {
|
|
1532
|
+
if (!(o != null && o.id)) {
|
|
1533
|
+
console.log("No dashboard ID found");
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
console.log("Updating dashboard title:", {
|
|
1537
|
+
dashboardId: o.id,
|
|
1538
|
+
newTitle: i,
|
|
1539
|
+
previousTitle: P
|
|
1540
|
+
}), ne.mutate(
|
|
1541
|
+
{
|
|
1542
|
+
resourceId: o.id,
|
|
1543
|
+
data: { title: i }
|
|
1544
|
+
},
|
|
1545
|
+
{
|
|
1546
|
+
onSuccess: () => {
|
|
1547
|
+
console.log("Dashboard title updated successfully"), M.success("Dashboard title updated");
|
|
1548
|
+
},
|
|
1549
|
+
onError: (q) => {
|
|
1550
|
+
console.error("Failed to update dashboard title:", q), M.error("Failed to update dashboard title"), O(P);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1554
|
+
};
|
|
1555
|
+
ot(() => {
|
|
1556
|
+
if (Ne && Ne.length > 0) {
|
|
1557
|
+
const i = o == null ? void 0 : o.id;
|
|
1558
|
+
if (i) {
|
|
1559
|
+
const P = Ne.find(
|
|
1560
|
+
(q) => q.id === i
|
|
1561
|
+
);
|
|
1562
|
+
P && Gt(P);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
}, [Ne, o == null ? void 0 : o.id, Gt]);
|
|
1566
|
+
const re = s.orgUserId || s.tenantId, Xe = F(
|
|
1567
|
+
() => xr({
|
|
1568
|
+
accessToken: t == null ? void 0 : t.accessToken,
|
|
1569
|
+
dashboardId: (o == null ? void 0 : o.id) || n || s.dashboard_id,
|
|
1570
|
+
selectedSheetId: w ? b : void 0,
|
|
1571
|
+
pageSize: D == null ? void 0 : D.size,
|
|
1572
|
+
orientation: D == null ? void 0 : D.orientation,
|
|
1573
|
+
theme: f
|
|
1574
|
+
}),
|
|
1575
|
+
[
|
|
1576
|
+
t == null ? void 0 : t.accessToken,
|
|
1577
|
+
n,
|
|
1578
|
+
o == null ? void 0 : o.id,
|
|
1579
|
+
w,
|
|
1580
|
+
D == null ? void 0 : D.orientation,
|
|
1581
|
+
D == null ? void 0 : D.size,
|
|
1582
|
+
b,
|
|
1583
|
+
f,
|
|
1584
|
+
s.dashboard_id
|
|
1585
|
+
]
|
|
1586
|
+
), zt = E && !_ && re && xe, { setDashboard: Ze } = N((i) => i.actions), et = N(
|
|
1587
|
+
(i) => i.semanticExecutionPayload
|
|
1588
|
+
), Wa = () => {
|
|
1589
|
+
Ft(!0);
|
|
1590
|
+
}, tt = () => {
|
|
1591
|
+
Ft(!1), Rt(!1), De(null), he(null);
|
|
1592
|
+
};
|
|
1593
|
+
ot(() => {
|
|
1594
|
+
if (!E) {
|
|
1595
|
+
R && De(null);
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
R || !o || u || De(
|
|
1599
|
+
la(
|
|
1600
|
+
o,
|
|
1601
|
+
et
|
|
1602
|
+
)
|
|
1603
|
+
);
|
|
1604
|
+
}, [
|
|
1605
|
+
o,
|
|
1606
|
+
R,
|
|
1607
|
+
E,
|
|
1608
|
+
u,
|
|
1609
|
+
et
|
|
1610
|
+
]);
|
|
1611
|
+
const Ce = (R == null ? void 0 : R.dashboard) ?? null, { isDirty: qt, isDirtyPending: Ja, resetDirty: Ee } = wn(
|
|
1612
|
+
o,
|
|
1613
|
+
Ce,
|
|
1614
|
+
300,
|
|
1615
|
+
1e3,
|
|
1616
|
+
it
|
|
1617
|
+
), Bt = Fe(() => Ce ? it(o) !== it(Ce) : !1, [o, Ce]), Ht = qt || Ja, Ie = We || ne.isPending, Ya = () => {
|
|
1618
|
+
Bt() ? (we("close"), se(!0)) : (tt(), Ee());
|
|
1619
|
+
}, Xa = async () => {
|
|
1620
|
+
await at({
|
|
1621
|
+
closeAfterSave: !0,
|
|
1622
|
+
navigateHomeAfterSave: Ye === "home"
|
|
1623
|
+
});
|
|
1624
|
+
}, Za = () => {
|
|
1625
|
+
R && Ze(R.dashboard, {
|
|
1626
|
+
semanticExecutionPayload: R.semanticExecutionPayload
|
|
1627
|
+
}), tt(), Ye === "home" && Ke(), we("close"), se(!1), Ee();
|
|
1628
|
+
}, es = () => {
|
|
1629
|
+
R && (Ze(R.dashboard, {
|
|
1630
|
+
semanticExecutionPayload: R.semanticExecutionPayload
|
|
1631
|
+
}), Ee());
|
|
1632
|
+
}, ts = () => {
|
|
1633
|
+
if (E && Bt()) {
|
|
1634
|
+
we("home"), se(!0);
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
Ke();
|
|
1638
|
+
};
|
|
1639
|
+
async function at(i) {
|
|
1640
|
+
const P = N.getState().dashboard;
|
|
1641
|
+
if (!P)
|
|
1642
|
+
return;
|
|
1643
|
+
const q = (i == null ? void 0 : i.closeAfterSave) ?? kt, os = (i == null ? void 0 : i.navigateHomeAfterSave) ?? !1;
|
|
1644
|
+
be(q), q && se(!1);
|
|
1645
|
+
const is = bt(P);
|
|
1646
|
+
pe(!0), ge(null), ve([]), Je(!0);
|
|
1647
|
+
const cs = {
|
|
1648
|
+
template: P
|
|
1649
|
+
};
|
|
1650
|
+
ne.mutate(
|
|
1651
|
+
{
|
|
1652
|
+
resourceId: P.id,
|
|
1653
|
+
data: cs
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
onSuccess: (U) => {
|
|
1657
|
+
var Ae, Le, ea;
|
|
1658
|
+
const Q = (U == null ? void 0 : U.id) || ((Ae = U == null ? void 0 : U.dashboard) == null ? void 0 : Ae.id) || ((Le = U == null ? void 0 : U.resource) == null ? void 0 : Le.id) || ((ea = U == null ? void 0 : U.template) == null ? void 0 : ea.id) || null;
|
|
1659
|
+
if (!P.id && Q) {
|
|
1660
|
+
const st = bs.getState(), Oe = st.pendingDashboardDraftMigration;
|
|
1661
|
+
(Oe == null ? void 0 : Oe.scopeKey) === h ? st.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
|
|
1662
|
+
Q
|
|
1663
|
+
) : Oe && st.actions.clearPendingDashboardDraftMigration();
|
|
1664
|
+
}
|
|
1665
|
+
Je(!1), M.success("Dashboard saved!"), De(
|
|
1666
|
+
la(
|
|
1667
|
+
is,
|
|
1668
|
+
N.getState().semanticExecutionPayload
|
|
1669
|
+
)
|
|
1670
|
+
), pe(!1), be(!1), q && (tt(), Ee(), os && Ke()), we("close");
|
|
1671
|
+
},
|
|
1672
|
+
onError: (U) => {
|
|
1673
|
+
Je(!1), ge("Failed to save dashboard. Please try again.");
|
|
1674
|
+
const Q = U.details, Ae = Array.isArray(
|
|
1675
|
+
Q == null ? void 0 : Q.errors
|
|
1676
|
+
) ? (Q.errors || []).filter(
|
|
1677
|
+
(Le) => typeof Le == "string"
|
|
1678
|
+
) : [];
|
|
1679
|
+
ve(
|
|
1680
|
+
hr({
|
|
1681
|
+
errors: Ae,
|
|
1682
|
+
dashboard: P || void 0
|
|
1683
|
+
})
|
|
1684
|
+
), M.error("Failed to save dashboard");
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
);
|
|
1688
|
+
}
|
|
1689
|
+
async function as() {
|
|
1690
|
+
if (V(!0), !p || !m) return;
|
|
1691
|
+
const i = N.getState().dashboard;
|
|
1692
|
+
if (!i) {
|
|
1693
|
+
V(!1);
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
const P = JSON.stringify(i), q = {
|
|
1697
|
+
...m,
|
|
1698
|
+
template: P,
|
|
1699
|
+
filterValues: $a
|
|
1700
|
+
};
|
|
1701
|
+
await xt(
|
|
1702
|
+
s.apiServiceUrl,
|
|
1703
|
+
q,
|
|
1704
|
+
t == null ? void 0 : t.accessToken
|
|
1705
|
+
), M.success("Lens saved"), je == null || je(i), V(!1);
|
|
1706
|
+
}
|
|
1707
|
+
const jt = (m == null ? void 0 : m.name) || o.title, oe = !!(o != null && o.id);
|
|
1708
|
+
ne.isPending && console.log("Title during update:", {
|
|
1709
|
+
title: jt,
|
|
1710
|
+
dashboardStateTitle: o.title,
|
|
1711
|
+
dashboardId: o == null ? void 0 : o.id,
|
|
1712
|
+
currentLensName: m == null ? void 0 : m.name
|
|
1713
|
+
});
|
|
1714
|
+
const Kt = s.orgUserId || s.tenantId && s.endUserId && s.endUserEmail, ss = !!Kt && !!(t != null && t.accessToken) && !!(s != null && s.apiServiceUrl);
|
|
1715
|
+
ot(() => {
|
|
1716
|
+
!oe && H && ee(!1);
|
|
1717
|
+
}, [oe, H]);
|
|
1718
|
+
const ns = l, ie = (o == null ? void 0 : o.id) || null, Me = !!ie && Va === ie, rs = () => {
|
|
1719
|
+
ie && za({
|
|
1720
|
+
dashboardId: Me ? null : ie
|
|
1721
|
+
});
|
|
1722
|
+
};
|
|
1723
|
+
return /* @__PURE__ */ c(
|
|
1724
|
+
"div",
|
|
1725
|
+
{
|
|
1726
|
+
className: "flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",
|
|
1727
|
+
role: "dashboard-controls",
|
|
1728
|
+
children: [
|
|
1729
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1730
|
+
Kt && /* @__PURE__ */ c(T, { children: [
|
|
1731
|
+
/* @__PURE__ */ e(
|
|
1732
|
+
rt,
|
|
1733
|
+
{
|
|
1734
|
+
"aria-label": "Manage Dashboards",
|
|
1735
|
+
tooltip: "Manage Dashboards",
|
|
1736
|
+
onClick: () => {
|
|
1737
|
+
Ga(!Ra);
|
|
1738
|
+
},
|
|
1739
|
+
className: "h-7 w-7 px-0",
|
|
1740
|
+
buttonProps: { size: "xs" },
|
|
1741
|
+
children: /* @__PURE__ */ e(An, { className: "h-3.5 w-3.5" })
|
|
1742
|
+
}
|
|
1743
|
+
),
|
|
1744
|
+
ns && !_ && /* @__PURE__ */ e(
|
|
1745
|
+
rt,
|
|
1746
|
+
{
|
|
1747
|
+
"aria-label": "Dashboard Hub",
|
|
1748
|
+
tooltip: "Dashboard Hub",
|
|
1749
|
+
onClick: ts,
|
|
1750
|
+
className: "h-7 w-7 px-0",
|
|
1751
|
+
buttonProps: { size: "xs" },
|
|
1752
|
+
children: /* @__PURE__ */ e(fa, { className: "h-3.5 w-3.5" })
|
|
1753
|
+
}
|
|
1754
|
+
)
|
|
1755
|
+
] }),
|
|
1756
|
+
!_ && l && (u ? /* @__PURE__ */ e(
|
|
1757
|
+
"div",
|
|
1758
|
+
{
|
|
1759
|
+
className: "h-4 w-28 animate-pulse rounded-md bg-muted/70",
|
|
1760
|
+
"aria-label": "Loading dashboard title",
|
|
1761
|
+
role: "status",
|
|
1762
|
+
children: /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading dashboard title" })
|
|
1763
|
+
}
|
|
1764
|
+
) : /* @__PURE__ */ c(T, { children: [
|
|
1765
|
+
/* @__PURE__ */ e(
|
|
1766
|
+
js,
|
|
1767
|
+
{
|
|
1768
|
+
value: jt || "Untitled Dashboard",
|
|
1769
|
+
onSave: (i) => {
|
|
1770
|
+
console.log("EditableText onSave called:", {
|
|
1771
|
+
newTitle: i,
|
|
1772
|
+
canEditDashboard: xe,
|
|
1773
|
+
dashboardId: o == null ? void 0 : o.id
|
|
1774
|
+
});
|
|
1775
|
+
const P = (o == null ? void 0 : o.title) || "";
|
|
1776
|
+
O(i), Qa(i, P);
|
|
1777
|
+
},
|
|
1778
|
+
isEditable: xe && !m,
|
|
1779
|
+
displayClassName: "text-[13px] font-medium",
|
|
1780
|
+
inputClassName: "text-[13px] font-medium",
|
|
1781
|
+
placeholder: "Dashboard Title",
|
|
1782
|
+
isPending: ne.isPending
|
|
1783
|
+
}
|
|
1784
|
+
),
|
|
1785
|
+
ss && ie && /* @__PURE__ */ e(hs, { children: /* @__PURE__ */ c(ps, { children: [
|
|
1786
|
+
/* @__PURE__ */ e(fs, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1787
|
+
A,
|
|
1788
|
+
{
|
|
1789
|
+
variant: "ghost",
|
|
1790
|
+
size: "xs",
|
|
1791
|
+
onClick: rs,
|
|
1792
|
+
disabled: qa || !(t != null && t.accessToken) || !(s != null && s.apiServiceUrl),
|
|
1793
|
+
className: "w-7 px-0",
|
|
1794
|
+
"aria-label": Me ? "Remove as default dashboard" : "Make this a default dashboard",
|
|
1795
|
+
children: /* @__PURE__ */ e(
|
|
1796
|
+
Ks,
|
|
1797
|
+
{
|
|
1798
|
+
className: Y(
|
|
1799
|
+
"h-3.5 w-3.5 transition-colors",
|
|
1800
|
+
Me ? "fill-foreground text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
1801
|
+
)
|
|
1802
|
+
}
|
|
1803
|
+
)
|
|
1804
|
+
}
|
|
1805
|
+
) }),
|
|
1806
|
+
/* @__PURE__ */ e(gs, { children: /* @__PURE__ */ e("p", { children: Me ? "Remove as default dashboard" : "Make this a default dashboard" }) })
|
|
1807
|
+
] }) })
|
|
1808
|
+
] }))
|
|
1809
|
+
] }),
|
|
1810
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1811
|
+
_ && /* @__PURE__ */ c(T, { children: [
|
|
1812
|
+
/* @__PURE__ */ e(pn, {}),
|
|
1813
|
+
/* @__PURE__ */ e(fn, {})
|
|
1814
|
+
] }),
|
|
1815
|
+
!_ && l && ((Zt = J == null ? void 0 : J.permissions) == null ? void 0 : Zt.canShare) && /* @__PURE__ */ c(
|
|
1816
|
+
A,
|
|
1817
|
+
{
|
|
1818
|
+
variant: "outline",
|
|
1819
|
+
size: "xs",
|
|
1820
|
+
onClick: () => x(!0),
|
|
1821
|
+
children: [
|
|
1822
|
+
/* @__PURE__ */ e(Qs, { className: "h-3.5 w-3.5" }),
|
|
1823
|
+
"Share"
|
|
1824
|
+
]
|
|
1825
|
+
}
|
|
1826
|
+
),
|
|
1827
|
+
!_ && E && d.canUseFilters && l && /* @__PURE__ */ e(
|
|
1828
|
+
gn,
|
|
1829
|
+
{
|
|
1830
|
+
showFilters: w ? !1 : Se,
|
|
1831
|
+
onToggleFilters: () => {
|
|
1832
|
+
if (w && b) {
|
|
1833
|
+
Ut(b, "inputs");
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1836
|
+
Se || Pt("dashboard", !1), _t(!Se);
|
|
1837
|
+
},
|
|
1838
|
+
onAddFilter: () => {
|
|
1839
|
+
if (w && b) {
|
|
1840
|
+
Ut(b, "inputs");
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
Se || (Pt("dashboard", !1), _t(!0));
|
|
1844
|
+
},
|
|
1845
|
+
onAddControl: () => {
|
|
1846
|
+
Vt("create");
|
|
1847
|
+
},
|
|
1848
|
+
onManageControls: () => Vt("manage")
|
|
1849
|
+
}
|
|
1850
|
+
),
|
|
1851
|
+
E && !_ && l && He ? w ? /* @__PURE__ */ e(
|
|
1852
|
+
fr,
|
|
1853
|
+
{
|
|
1854
|
+
open: !0,
|
|
1855
|
+
onOpenChange: (i) => {
|
|
1856
|
+
i || he(null);
|
|
1857
|
+
},
|
|
1858
|
+
initialMode: He
|
|
1859
|
+
}
|
|
1860
|
+
) : /* @__PURE__ */ e(
|
|
1861
|
+
vn,
|
|
1862
|
+
{
|
|
1863
|
+
open: !0,
|
|
1864
|
+
onOpenChange: (i) => {
|
|
1865
|
+
i || he(null);
|
|
1866
|
+
},
|
|
1867
|
+
showTrigger: !1,
|
|
1868
|
+
initialMode: He
|
|
1869
|
+
}
|
|
1870
|
+
) : null,
|
|
1871
|
+
E && !_ && re && m && a && l && /* @__PURE__ */ c(
|
|
1872
|
+
A,
|
|
1873
|
+
{
|
|
1874
|
+
variant: "secondary",
|
|
1875
|
+
size: "xs",
|
|
1876
|
+
disabled: I,
|
|
1877
|
+
onClick: as,
|
|
1878
|
+
children: [
|
|
1879
|
+
/* @__PURE__ */ e(na, { className: "h-3.5 w-3.5" }),
|
|
1880
|
+
"Save Lens"
|
|
1881
|
+
]
|
|
1882
|
+
}
|
|
1883
|
+
),
|
|
1884
|
+
E && !_ && l && !w && /* @__PURE__ */ c(
|
|
1885
|
+
A,
|
|
1886
|
+
{
|
|
1887
|
+
variant: "outline",
|
|
1888
|
+
size: "xs",
|
|
1889
|
+
disabled: !E,
|
|
1890
|
+
onClick: () => ja(),
|
|
1891
|
+
children: [
|
|
1892
|
+
/* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
|
|
1893
|
+
"Visual"
|
|
1894
|
+
]
|
|
1895
|
+
}
|
|
1896
|
+
),
|
|
1897
|
+
!_ && !E && xe && l && /* @__PURE__ */ c(A, { size: "xs", onClick: Wa, children: [
|
|
1898
|
+
/* @__PURE__ */ e(Ws, { className: "h-3.5 w-3.5" }),
|
|
1899
|
+
"Edit"
|
|
1900
|
+
] }),
|
|
1901
|
+
zt && l && qt && /* @__PURE__ */ c(
|
|
1902
|
+
A,
|
|
1903
|
+
{
|
|
1904
|
+
variant: "outline",
|
|
1905
|
+
size: "xs",
|
|
1906
|
+
onClick: es,
|
|
1907
|
+
disabled: Ie,
|
|
1908
|
+
children: [
|
|
1909
|
+
/* @__PURE__ */ e(Js, { className: "h-3.5 w-3.5" }),
|
|
1910
|
+
"Undo"
|
|
1911
|
+
]
|
|
1912
|
+
}
|
|
1913
|
+
),
|
|
1914
|
+
zt && l && /* @__PURE__ */ c(
|
|
1915
|
+
A,
|
|
1916
|
+
{
|
|
1917
|
+
size: "xs",
|
|
1918
|
+
className: Y(!Ht && "opacity-60"),
|
|
1919
|
+
disabled: Ie || !Ht,
|
|
1920
|
+
onClick: () => at(),
|
|
1921
|
+
children: [
|
|
1922
|
+
Ie ? /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(na, { className: "h-3.5 w-3.5" }),
|
|
1923
|
+
Ie ? "Saving..." : "Save"
|
|
1924
|
+
]
|
|
1925
|
+
}
|
|
1926
|
+
),
|
|
1927
|
+
E && !_ && l && /* @__PURE__ */ c(A, { variant: "outline", size: "xs", onClick: Ya, children: [
|
|
1928
|
+
/* @__PURE__ */ e(ga, { className: "h-3.5 w-3.5" }),
|
|
1929
|
+
"Close"
|
|
1930
|
+
] }),
|
|
1931
|
+
!_ && l && /* @__PURE__ */ e("div", { className: "ml-2", children: /* @__PURE__ */ e(bn, {}) }),
|
|
1932
|
+
!_ && a && /* @__PURE__ */ e(Fn, {}),
|
|
1933
|
+
!_ && l && /* @__PURE__ */ c(Ys, { children: [
|
|
1934
|
+
/* @__PURE__ */ e(Xs, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1935
|
+
rt,
|
|
1936
|
+
{
|
|
1937
|
+
tooltip: "More Options",
|
|
1938
|
+
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
1939
|
+
buttonProps: {
|
|
1940
|
+
size: "xs",
|
|
1941
|
+
variant: "ghost",
|
|
1942
|
+
"aria-label": "More dashboard options"
|
|
1943
|
+
},
|
|
1944
|
+
children: /* @__PURE__ */ e(Zs, { className: "h-3.5 w-3.5" })
|
|
1945
|
+
}
|
|
1946
|
+
) }),
|
|
1947
|
+
/* @__PURE__ */ c(
|
|
1948
|
+
en,
|
|
1949
|
+
{
|
|
1950
|
+
align: "end",
|
|
1951
|
+
className: "w-56 rounded-control border border-border/60 p-1 shadow-sm",
|
|
1952
|
+
children: [
|
|
1953
|
+
/* @__PURE__ */ e(de, { children: "Reports" }),
|
|
1954
|
+
/* @__PURE__ */ c(
|
|
1955
|
+
$,
|
|
1956
|
+
{
|
|
1957
|
+
disabled: v,
|
|
1958
|
+
onSelect: () => Lt(!0),
|
|
1959
|
+
children: [
|
|
1960
|
+
/* @__PURE__ */ e(tn, { className: "h-3.5 w-3.5" }),
|
|
1961
|
+
"Export"
|
|
1962
|
+
]
|
|
1963
|
+
}
|
|
1964
|
+
),
|
|
1965
|
+
/* @__PURE__ */ c(
|
|
1966
|
+
$,
|
|
1967
|
+
{
|
|
1968
|
+
disabled: !oe,
|
|
1969
|
+
onSelect: () => {
|
|
1970
|
+
oe && ee(!0);
|
|
1971
|
+
},
|
|
1972
|
+
children: [
|
|
1973
|
+
/* @__PURE__ */ e(an, { className: "h-3.5 w-3.5" }),
|
|
1974
|
+
"Schedule"
|
|
1975
|
+
]
|
|
1976
|
+
}
|
|
1977
|
+
),
|
|
1978
|
+
/* @__PURE__ */ e(Te, {}),
|
|
1979
|
+
Ha && /* @__PURE__ */ c(T, { children: [
|
|
1980
|
+
/* @__PURE__ */ e(de, { children: "Access" }),
|
|
1981
|
+
/* @__PURE__ */ c(
|
|
1982
|
+
$,
|
|
1983
|
+
{
|
|
1984
|
+
onClick: () => W(!0),
|
|
1985
|
+
children: [
|
|
1986
|
+
/* @__PURE__ */ e(Ct, { className: "h-3.5 w-3.5" }),
|
|
1987
|
+
"Manage Groups"
|
|
1988
|
+
]
|
|
1989
|
+
}
|
|
1990
|
+
),
|
|
1991
|
+
/* @__PURE__ */ e(Te, {})
|
|
1992
|
+
] }),
|
|
1993
|
+
/* @__PURE__ */ e(de, { children: "Preferences" }),
|
|
1994
|
+
/* @__PURE__ */ c($, { onClick: () => k(!0), children: [
|
|
1995
|
+
/* @__PURE__ */ e(sn, { className: "h-3.5 w-3.5" }),
|
|
1996
|
+
"Calendar Preferences"
|
|
1997
|
+
] }),
|
|
1998
|
+
/* @__PURE__ */ c($, { onClick: () => j(!0), children: [
|
|
1999
|
+
/* @__PURE__ */ e(nn, { className: "h-3.5 w-3.5" }),
|
|
2000
|
+
"Summary Settings"
|
|
2001
|
+
] }),
|
|
2002
|
+
a && l && /* @__PURE__ */ c(T, { children: [
|
|
2003
|
+
/* @__PURE__ */ e(Te, {}),
|
|
2004
|
+
/* @__PURE__ */ e(de, { children: "Developer" }),
|
|
2005
|
+
/* @__PURE__ */ c(
|
|
2006
|
+
$,
|
|
2007
|
+
{
|
|
2008
|
+
onSelect: () => {
|
|
2009
|
+
var i;
|
|
2010
|
+
t != null && t.accessToken && ((i = navigator == null ? void 0 : navigator.clipboard) != null && i.writeText ? navigator.clipboard.writeText(t.accessToken).then(
|
|
2011
|
+
() => M.success("Token copied to clipboard")
|
|
2012
|
+
).catch(() => M.error("Unable to copy token")) : M.error("Clipboard not available"));
|
|
2013
|
+
},
|
|
2014
|
+
children: [
|
|
2015
|
+
/* @__PURE__ */ e(sa, { className: "h-3.5 w-3.5" }),
|
|
2016
|
+
"Copy token"
|
|
2017
|
+
]
|
|
2018
|
+
}
|
|
2019
|
+
),
|
|
2020
|
+
w && /* @__PURE__ */ c(
|
|
2021
|
+
$,
|
|
2022
|
+
{
|
|
2023
|
+
disabled: !Xe,
|
|
2024
|
+
onSelect: () => {
|
|
2025
|
+
var i;
|
|
2026
|
+
if (!Xe) {
|
|
2027
|
+
M.error(
|
|
2028
|
+
"Open a document sheet with a token to copy the local PDF URL"
|
|
2029
|
+
);
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
(i = navigator == null ? void 0 : navigator.clipboard) != null && i.writeText ? navigator.clipboard.writeText(Xe).then(
|
|
2033
|
+
() => M.success(
|
|
2034
|
+
"Local document PDF URL copied to clipboard"
|
|
2035
|
+
)
|
|
2036
|
+
).catch(
|
|
2037
|
+
() => M.error(
|
|
2038
|
+
"Unable to copy local document PDF URL"
|
|
2039
|
+
)
|
|
2040
|
+
) : M.error("Clipboard not available");
|
|
2041
|
+
},
|
|
2042
|
+
children: [
|
|
2043
|
+
/* @__PURE__ */ e(sa, { className: "h-3.5 w-3.5" }),
|
|
2044
|
+
"Copy local document PDF URL"
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
),
|
|
2048
|
+
/* @__PURE__ */ c(
|
|
2049
|
+
$,
|
|
2050
|
+
{
|
|
2051
|
+
onSelect: () => vs(s.apiServiceUrl),
|
|
2052
|
+
children: [
|
|
2053
|
+
/* @__PURE__ */ e(kn, { className: "h-3.5 w-3.5" }),
|
|
2054
|
+
"Invalidate token"
|
|
2055
|
+
]
|
|
2056
|
+
}
|
|
2057
|
+
),
|
|
2058
|
+
/* @__PURE__ */ c($, { onSelect: r, children: [
|
|
2059
|
+
/* @__PURE__ */ e(En, { className: "h-3.5 w-3.5" }),
|
|
2060
|
+
"Brand Studio"
|
|
2061
|
+
] }),
|
|
2062
|
+
E && /* @__PURE__ */ c(
|
|
2063
|
+
$,
|
|
2064
|
+
{
|
|
2065
|
+
onSelect: () => Rt(!Tt),
|
|
2066
|
+
children: [
|
|
2067
|
+
/* @__PURE__ */ e(In, { className: "h-3.5 w-3.5" }),
|
|
2068
|
+
Tt ? "Hide dashboard JSON" : "Show dashboard JSON"
|
|
2069
|
+
]
|
|
2070
|
+
}
|
|
2071
|
+
),
|
|
2072
|
+
re && E && /* @__PURE__ */ c($, { onSelect: () => te(!0), children: [
|
|
2073
|
+
/* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
|
|
2074
|
+
"Add lens"
|
|
2075
|
+
] }),
|
|
2076
|
+
re && /* @__PURE__ */ c(rn, { children: [
|
|
2077
|
+
/* @__PURE__ */ c(on, { children: [
|
|
2078
|
+
/* @__PURE__ */ e(Mn, { className: "h-3.5 w-3.5" }),
|
|
2079
|
+
"Lenses"
|
|
2080
|
+
] }),
|
|
2081
|
+
/* @__PURE__ */ e(cn, { className: "w-60", children: /* @__PURE__ */ e(zn, {}) })
|
|
2082
|
+
] })
|
|
2083
|
+
] })
|
|
2084
|
+
]
|
|
2085
|
+
}
|
|
2086
|
+
)
|
|
2087
|
+
] }),
|
|
2088
|
+
z && $t && /* @__PURE__ */ e(
|
|
2089
|
+
ln,
|
|
2090
|
+
{
|
|
2091
|
+
resource: $t,
|
|
2092
|
+
resourceType: nt.DASHBOARD,
|
|
2093
|
+
onClose: () => x(!1)
|
|
2094
|
+
}
|
|
2095
|
+
),
|
|
2096
|
+
/* @__PURE__ */ e(
|
|
2097
|
+
ur,
|
|
2098
|
+
{
|
|
2099
|
+
open: B,
|
|
2100
|
+
onOpenChange: W
|
|
2101
|
+
}
|
|
2102
|
+
),
|
|
2103
|
+
oe && (o == null ? void 0 : o.id) && /* @__PURE__ */ e(
|
|
2104
|
+
dn,
|
|
2105
|
+
{
|
|
2106
|
+
open: H,
|
|
2107
|
+
onOpenChange: ee,
|
|
2108
|
+
dashboardId: o.id,
|
|
2109
|
+
dashboardName: o == null ? void 0 : o.title
|
|
2110
|
+
}
|
|
2111
|
+
),
|
|
2112
|
+
/* @__PURE__ */ e(
|
|
2113
|
+
Sn,
|
|
2114
|
+
{
|
|
2115
|
+
open: y,
|
|
2116
|
+
onOpenChange: k
|
|
2117
|
+
}
|
|
2118
|
+
),
|
|
2119
|
+
/* @__PURE__ */ e(
|
|
2120
|
+
Nn,
|
|
2121
|
+
{
|
|
2122
|
+
open: G,
|
|
2123
|
+
onOpenChange: j,
|
|
2124
|
+
dashboard: o,
|
|
2125
|
+
disabled: !E,
|
|
2126
|
+
onApply: (i) => Ze(
|
|
2127
|
+
{
|
|
2128
|
+
...o,
|
|
2129
|
+
summary: i
|
|
2130
|
+
},
|
|
2131
|
+
{
|
|
2132
|
+
semanticExecutionPayload: et
|
|
2133
|
+
}
|
|
2134
|
+
)
|
|
2135
|
+
}
|
|
2136
|
+
),
|
|
2137
|
+
a && re && l && /* @__PURE__ */ e(Vn, { open: me, onOpenChange: te }),
|
|
2138
|
+
l && /* @__PURE__ */ e(
|
|
2139
|
+
un,
|
|
2140
|
+
{
|
|
2141
|
+
open: Ua,
|
|
2142
|
+
onOpenChange: Lt
|
|
2143
|
+
}
|
|
2144
|
+
),
|
|
2145
|
+
/* @__PURE__ */ e(
|
|
2146
|
+
ya,
|
|
2147
|
+
{
|
|
2148
|
+
open: Fa,
|
|
2149
|
+
onOpenChange: (i) => {
|
|
2150
|
+
!i && We && !fe || (pe(i), i || (ge(null), ve([]), be(!1)));
|
|
2151
|
+
},
|
|
2152
|
+
children: /* @__PURE__ */ c(xa, { className: "max-w-sm", children: [
|
|
2153
|
+
/* @__PURE__ */ c(Sa, { children: [
|
|
2154
|
+
/* @__PURE__ */ e(Na, { children: fe ? "Save failed" : "Saving dashboard" }),
|
|
2155
|
+
/* @__PURE__ */ e(wa, { className: "pt-2", children: fe ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." }),
|
|
2156
|
+
Ot.length > 0 && /* @__PURE__ */ c("div", { className: "space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left", children: [
|
|
2157
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-destructive", children: "What needs attention" }),
|
|
2158
|
+
/* @__PURE__ */ e("ul", { className: "list-disc space-y-1 pl-4 text-xs text-muted-foreground", children: Ot.slice(0, 5).map((i) => /* @__PURE__ */ e("li", { children: i }, i)) })
|
|
2159
|
+
] })
|
|
2160
|
+
] }),
|
|
2161
|
+
/* @__PURE__ */ e(Da, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: fe ? /* @__PURE__ */ c(T, { children: [
|
|
2162
|
+
/* @__PURE__ */ e(
|
|
2163
|
+
Ca,
|
|
2164
|
+
{
|
|
2165
|
+
onClick: () => {
|
|
2166
|
+
pe(!1), ge(null), ve([]), be(!1);
|
|
2167
|
+
},
|
|
2168
|
+
className: "m-0",
|
|
2169
|
+
children: "Close"
|
|
2170
|
+
}
|
|
2171
|
+
),
|
|
2172
|
+
/* @__PURE__ */ e(
|
|
2173
|
+
vt,
|
|
2174
|
+
{
|
|
2175
|
+
onClick: () => at({
|
|
2176
|
+
closeAfterSave: kt,
|
|
2177
|
+
navigateHomeAfterSave: Ye === "home"
|
|
2178
|
+
}),
|
|
2179
|
+
className: "m-0",
|
|
2180
|
+
children: "Retry"
|
|
2181
|
+
}
|
|
2182
|
+
)
|
|
2183
|
+
] }) : /* @__PURE__ */ c(vt, { disabled: !0, className: "m-0 cursor-default", children: [
|
|
2184
|
+
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2185
|
+
"Saving..."
|
|
2186
|
+
] }) })
|
|
2187
|
+
] })
|
|
2188
|
+
}
|
|
2189
|
+
),
|
|
2190
|
+
/* @__PURE__ */ e(
|
|
2191
|
+
yn,
|
|
2192
|
+
{
|
|
2193
|
+
open: Ka,
|
|
2194
|
+
onOpenChange: (i) => {
|
|
2195
|
+
se(i);
|
|
2196
|
+
},
|
|
2197
|
+
onSave: Xa,
|
|
2198
|
+
onDiscard: Za,
|
|
2199
|
+
isSaving: We,
|
|
2200
|
+
saveLabel: "Save",
|
|
2201
|
+
discardLabel: "Discard"
|
|
2202
|
+
}
|
|
2203
|
+
)
|
|
2204
|
+
] })
|
|
2205
|
+
]
|
|
2206
|
+
}
|
|
2207
|
+
);
|
|
2208
|
+
}
|
|
2209
|
+
function xr({
|
|
2210
|
+
accessToken: t,
|
|
2211
|
+
dashboardId: s,
|
|
2212
|
+
selectedSheetId: n,
|
|
2213
|
+
pageSize: a,
|
|
2214
|
+
orientation: r,
|
|
2215
|
+
theme: d
|
|
2216
|
+
}) {
|
|
2217
|
+
if (!t || !n)
|
|
2218
|
+
return null;
|
|
2219
|
+
const l = new URL("http://localhost:5173/print-document");
|
|
2220
|
+
l.searchParams.set("token", t), s && l.searchParams.set("dashboardId", s), l.searchParams.set("selectedSheetId", n), d && l.searchParams.set("theme", d);
|
|
2221
|
+
const u = new URL("http://127.0.0.1:3002/");
|
|
2222
|
+
return u.searchParams.set("pdfMode", "document"), u.searchParams.set("pageSize", a || "letter"), u.searchParams.set("orientation", r || "portrait"), u.searchParams.set("url", l.toString()), u.toString();
|
|
2223
|
+
}
|
|
2224
|
+
export {
|
|
2225
|
+
_r as default
|
|
2226
|
+
};
|