react-semaphor 0.1.125 → 0.1.127
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/chunks/dashboard-controls-BFo8ClGD.js +1473 -0
- package/dist/chunks/dashboard-controls-CpNsaWbB.js +26 -0
- package/dist/chunks/dashboard-export-dialog-CKGJIz95.js +6 -0
- package/dist/chunks/dashboard-export-dialog-CKr9o8DW.js +600 -0
- package/dist/chunks/{dashboard-json-BlEVRs4V.js → dashboard-json-Bqddgxcf.js} +1 -1
- package/dist/chunks/{dashboard-json-Cn2IxIvK.js → dashboard-json-CZrxKZBn.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CHqS0-RO.js → edit-dashboard-visual-Du3rYBkf.js} +5966 -4980
- package/dist/chunks/edit-dashboard-visual-Kg8h34hs.js +195 -0
- package/dist/chunks/{editor-action-buttons-BjVPDqso.js → editor-action-buttons-BMeOcqc2.js} +2 -2
- package/dist/chunks/{editor-action-buttons-j0OdQL7Y.js → editor-action-buttons-DHk1Cdb6.js} +1 -1
- package/dist/chunks/{index-CZGIYFfM.js → index-DJmpV5Lg.js} +163 -158
- package/dist/chunks/{index-BQPGBZP4.js → index-DLxVadBx.js} +5788 -5769
- package/dist/chunks/{resource-management-panel-CaktfbhQ.js → resource-management-panel-D6gqCHWr.js} +1 -1
- package/dist/chunks/{resource-management-panel-BD6pGiUl.js → resource-management-panel-VT7LYPp8.js} +88 -88
- package/dist/chunks/{use-visual-utils-uElEhCM9.js → use-visual-utils-DpxMI5Pe.js} +1 -1
- package/dist/chunks/{use-visual-utils-Dhcu2Fn4.js → use-visual-utils-O1QcxL8l.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +25 -24
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/dashboard.d.ts +1 -1
- package/dist/types/main.d.ts +9 -2
- package/dist/types/surfboard.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-Bx-ySdim.js +0 -1561
- package/dist/chunks/dashboard-controls-CZkFeNrk.js +0 -26
- package/dist/chunks/edit-dashboard-visual-Cm5Mc4Um.js +0 -170
- package/dist/chunks/schedule-dashboard-BQ5u1NRe.js +0 -415
- package/dist/chunks/schedule-dashboard-Cul4sDBY.js +0 -6
|
@@ -1,1561 +0,0 @@
|
|
|
1
|
-
import { jsxs as r, jsx as e, Fragment as P } from "react/jsx-runtime";
|
|
2
|
-
import { b as J, br as vs, bs as Ns, u as w, aE as Ce, aF as Se, B as M, aH as ke, aI as W, bt as Me, g as Ve, al as R, aq as oe, bu as ys, aR as Le, ar as ie, as as le, at as ce, au as Pe, av as te, bv as Q, az as Qe, I as _, bw as ws, aV as xs, bx as Ds, by as ze, bz as He, c as X, bA as Be, bB as Cs, bC as Ss, bD as ks, bE as Ms, bF as Ls, l as v, T as qe, h as de, bG as ue, bH as Ke, ax as Ps, bI as Is, L as H, aU as $, bJ as As, bK as Es, bL as Fs, bM as We, bN as Je, bO as re, bP as ne, bo as be, b0 as ve, bQ as Ne, aW as Xe, bR as ye, ay as Ye, a_ as Ze, bS as Ts, b3 as Gs, b4 as Rs, b5 as Os, b6 as Us, b7 as zs, b8 as qs, b9 as _s, ba as $s, bT as js, aP as Vs, bj as Qs, bU as Hs, bV as Bs, f as _e, aC as se, bW as Ks, R as fe, bX as Ws, bY as Js, bZ as Xs, b_ as Ys, aS as Zs, Q as ea, b$ as sa, c0 as aa, c1 as ta, c2 as ra, J as na } from "./index-BQPGBZP4.js";
|
|
3
|
-
import * as S from "react";
|
|
4
|
-
import { useState as x, useMemo as ae, useEffect as oa } from "react";
|
|
5
|
-
import "react-dom";
|
|
6
|
-
import { g as we, A as ia, V as la, S as ca } from "./schedule-dashboard-BQ5u1NRe.js";
|
|
7
|
-
import { S as $e } from "./editor-action-buttons-BjVPDqso.js";
|
|
8
|
-
/**
|
|
9
|
-
* @license lucide-react v0.453.0 - ISC
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the ISC license.
|
|
12
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/
|
|
14
|
-
const da = J("Glasses", [
|
|
15
|
-
["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
|
|
16
|
-
["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
|
|
17
|
-
["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
|
|
18
|
-
["path", { d: "M2.5 13 5 7c.7-1.3 1.4-2 3-2", key: "1hm1gs" }],
|
|
19
|
-
["path", { d: "M21.5 13 19 7c-.7-1.3-1.5-2-3-2", key: "1r31ai" }]
|
|
20
|
-
]);
|
|
21
|
-
/**
|
|
22
|
-
* @license lucide-react v0.453.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/
|
|
27
|
-
const ua = J("Menu", [
|
|
28
|
-
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }],
|
|
29
|
-
["line", { x1: "4", x2: "20", y1: "6", y2: "6", key: "1owob3" }],
|
|
30
|
-
["line", { x1: "4", x2: "20", y1: "18", y2: "18", key: "yk5zj1" }]
|
|
31
|
-
]);
|
|
32
|
-
/**
|
|
33
|
-
* @license lucide-react v0.453.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/
|
|
38
|
-
const ma = J("Moon", [
|
|
39
|
-
["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
|
|
40
|
-
]);
|
|
41
|
-
/**
|
|
42
|
-
* @license lucide-react v0.453.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/
|
|
47
|
-
const ha = J("ShieldX", [
|
|
48
|
-
[
|
|
49
|
-
"path",
|
|
50
|
-
{
|
|
51
|
-
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",
|
|
52
|
-
key: "oel41y"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
["path", { d: "m14.5 9.5-5 5", key: "17q4r4" }],
|
|
56
|
-
["path", { d: "m9.5 9.5 5 5", key: "18nt4w" }]
|
|
57
|
-
]);
|
|
58
|
-
/**
|
|
59
|
-
* @license lucide-react v0.453.0 - ISC
|
|
60
|
-
*
|
|
61
|
-
* This source code is licensed under the ISC license.
|
|
62
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
-
*/
|
|
64
|
-
const pa = J("Sun", [
|
|
65
|
-
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
|
|
66
|
-
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
67
|
-
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
68
|
-
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
|
|
69
|
-
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
|
|
70
|
-
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
71
|
-
["path", { d: "M20 12h2", key: "1q8mjw" }],
|
|
72
|
-
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
|
|
73
|
-
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
|
|
74
|
-
]);
|
|
75
|
-
var ga = vs();
|
|
76
|
-
function fa() {
|
|
77
|
-
const { setTheme: s } = Ns(), n = w(
|
|
78
|
-
(a) => a.actions.setDashboardTheme
|
|
79
|
-
);
|
|
80
|
-
return /* @__PURE__ */ r(Ce, { children: [
|
|
81
|
-
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ r(M, { className: "h-7 p-2", variant: "ghost", size: "sm", children: [
|
|
82
|
-
/* @__PURE__ */ e(
|
|
83
|
-
pa,
|
|
84
|
-
{
|
|
85
|
-
strokeWidth: 1.5,
|
|
86
|
-
className: "h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
/* @__PURE__ */ e(
|
|
90
|
-
ma,
|
|
91
|
-
{
|
|
92
|
-
strokeWidth: 1.5,
|
|
93
|
-
className: "absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle theme" })
|
|
97
|
-
] }) }),
|
|
98
|
-
/* @__PURE__ */ r(ke, { align: "end", children: [
|
|
99
|
-
/* @__PURE__ */ e(
|
|
100
|
-
W,
|
|
101
|
-
{
|
|
102
|
-
onClick: () => {
|
|
103
|
-
s("light"), n("light");
|
|
104
|
-
},
|
|
105
|
-
children: "Light"
|
|
106
|
-
}
|
|
107
|
-
),
|
|
108
|
-
/* @__PURE__ */ e(
|
|
109
|
-
W,
|
|
110
|
-
{
|
|
111
|
-
onClick: () => {
|
|
112
|
-
s("dark"), n("dark");
|
|
113
|
-
},
|
|
114
|
-
children: "Dark"
|
|
115
|
-
}
|
|
116
|
-
),
|
|
117
|
-
/* @__PURE__ */ e(
|
|
118
|
-
W,
|
|
119
|
-
{
|
|
120
|
-
onClick: () => {
|
|
121
|
-
s("system"), n("system");
|
|
122
|
-
},
|
|
123
|
-
children: "System"
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
] })
|
|
127
|
-
] });
|
|
128
|
-
}
|
|
129
|
-
async function ba(s, n, a, t, i) {
|
|
130
|
-
if (!i)
|
|
131
|
-
return null;
|
|
132
|
-
const o = JSON.stringify(a), c = `${s}/v1/lens`;
|
|
133
|
-
return await Me(c, i, {
|
|
134
|
-
name: n,
|
|
135
|
-
template: o,
|
|
136
|
-
filterValues: t,
|
|
137
|
-
operation: "create"
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
async function xe(s, n, a) {
|
|
141
|
-
if (!a)
|
|
142
|
-
return null;
|
|
143
|
-
const { id: t, template: i, filterValues: o, isDefault: c, shared: m } = n, h = `${s}/v1/lens`;
|
|
144
|
-
return await Me(h, a, {
|
|
145
|
-
lensId: t,
|
|
146
|
-
template: i,
|
|
147
|
-
filterValues: o,
|
|
148
|
-
isDefault: c,
|
|
149
|
-
shared: m,
|
|
150
|
-
operation: "update"
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
async function va(s, n, a) {
|
|
154
|
-
if (!a)
|
|
155
|
-
return null;
|
|
156
|
-
const t = `${s}/v1/lens`;
|
|
157
|
-
return await Me(t, a, {
|
|
158
|
-
operation: "delete",
|
|
159
|
-
lensId: n
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function Na() {
|
|
163
|
-
const [s, n] = x(""), [a, t] = x(!1), i = w((k) => k.lenses), { setLenses: o, setSelectedLensId: c } = Ve(), [m, h] = x(!1), [f, u] = x(!1), d = w((k) => k.dashboard), p = w((k) => k.filterValues), { authToken: b, tokenProps: N } = R();
|
|
164
|
-
async function D() {
|
|
165
|
-
h(!0);
|
|
166
|
-
const k = we(
|
|
167
|
-
d
|
|
168
|
-
), I = await ba(
|
|
169
|
-
N.apiServiceUrl,
|
|
170
|
-
s,
|
|
171
|
-
k,
|
|
172
|
-
p,
|
|
173
|
-
b == null ? void 0 : b.accessToken
|
|
174
|
-
);
|
|
175
|
-
I && (o([...i || [], I]), c(I.id), u(!1)), h(!1);
|
|
176
|
-
}
|
|
177
|
-
return /* @__PURE__ */ r(oe, { open: f, onOpenChange: u, children: [
|
|
178
|
-
/* @__PURE__ */ e(ys, { asChild: !0, children: /* @__PURE__ */ r(
|
|
179
|
-
M,
|
|
180
|
-
{
|
|
181
|
-
variant: "secondary",
|
|
182
|
-
className: "h-7 p-2",
|
|
183
|
-
size: "sm",
|
|
184
|
-
children: [
|
|
185
|
-
/* @__PURE__ */ e(Le, { className: "mr-2 h-4 w-4" }),
|
|
186
|
-
"Lens"
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
) }),
|
|
190
|
-
/* @__PURE__ */ r(ie, { className: "sm:max-w-[425px]", children: [
|
|
191
|
-
/* @__PURE__ */ r(le, { children: [
|
|
192
|
-
/* @__PURE__ */ e(ce, { children: "Create Lens" }),
|
|
193
|
-
/* @__PURE__ */ e(Pe, { children: "Lenses are private by default and are only visible to you." })
|
|
194
|
-
] }),
|
|
195
|
-
/* @__PURE__ */ e("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ r("div", { className: "grid grid-cols-8 items-center gap-4", children: [
|
|
196
|
-
/* @__PURE__ */ e(te, { className: "text-right", children: "Name" }),
|
|
197
|
-
/* @__PURE__ */ e(
|
|
198
|
-
Q,
|
|
199
|
-
{
|
|
200
|
-
value: s,
|
|
201
|
-
onChange: (k) => {
|
|
202
|
-
n(k.target.value);
|
|
203
|
-
},
|
|
204
|
-
id: "name",
|
|
205
|
-
className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
|
|
206
|
-
}
|
|
207
|
-
)
|
|
208
|
-
] }) }),
|
|
209
|
-
a && /* @__PURE__ */ e("p", { className: "text-sm", children: "The lens name already exists. Use a differnet name." }),
|
|
210
|
-
/* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(
|
|
211
|
-
M,
|
|
212
|
-
{
|
|
213
|
-
size: "sm",
|
|
214
|
-
variant: "outline",
|
|
215
|
-
type: "submit",
|
|
216
|
-
onClick: D,
|
|
217
|
-
disabled: m,
|
|
218
|
-
children: m ? "Creating..." : "Add"
|
|
219
|
-
}
|
|
220
|
-
) })
|
|
221
|
-
] })
|
|
222
|
-
] });
|
|
223
|
-
}
|
|
224
|
-
function ya() {
|
|
225
|
-
const [s, n] = x(!1), a = w((d) => d.lenses), t = w((d) => d.selectedLensId), { setLenses: i, setSelectedLensId: o } = Ve(), { authToken: c, tokenProps: m } = R();
|
|
226
|
-
async function h(d) {
|
|
227
|
-
o(d);
|
|
228
|
-
}
|
|
229
|
-
async function f(d) {
|
|
230
|
-
if (await va(m.apiServiceUrl, d, c == null ? void 0 : c.accessToken)) {
|
|
231
|
-
const b = a == null ? void 0 : a.filter((N) => N.id !== d);
|
|
232
|
-
i(b || []), o("original");
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
async function u(d) {
|
|
236
|
-
const p = a == null ? void 0 : a.map((D) => D.id === d.id ? {
|
|
237
|
-
...D,
|
|
238
|
-
isDefault: !d.isDefault
|
|
239
|
-
} : {
|
|
240
|
-
...D,
|
|
241
|
-
isDefault: !1
|
|
242
|
-
});
|
|
243
|
-
i(p || []);
|
|
244
|
-
const b = {
|
|
245
|
-
...d,
|
|
246
|
-
isDefault: !d.isDefault
|
|
247
|
-
};
|
|
248
|
-
await xe(m.apiServiceUrl, b, c == null ? void 0 : c.accessToken);
|
|
249
|
-
const N = a == null ? void 0 : a.find((D) => D.isDefault);
|
|
250
|
-
if (N && N.id !== d.id) {
|
|
251
|
-
const D = {
|
|
252
|
-
...N,
|
|
253
|
-
isDefault: !1
|
|
254
|
-
};
|
|
255
|
-
await xe(m.apiServiceUrl, D, c == null ? void 0 : c.accessToken);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return /* @__PURE__ */ r(Ce, { open: s, onOpenChange: n, children: [
|
|
259
|
-
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e(_, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(da, { className: "h-4 w-4" }) }) }),
|
|
260
|
-
/* @__PURE__ */ r(ke, { align: "end", className: "w-60", children: [
|
|
261
|
-
/* @__PURE__ */ e(ws, { className: "px-3", children: "Lenses" }),
|
|
262
|
-
/* @__PURE__ */ e(xs, {}),
|
|
263
|
-
/* @__PURE__ */ r(
|
|
264
|
-
Ds,
|
|
265
|
-
{
|
|
266
|
-
value: t,
|
|
267
|
-
onValueChange: h,
|
|
268
|
-
children: [
|
|
269
|
-
/* @__PURE__ */ e(ze, { value: "original", children: "Original" }),
|
|
270
|
-
a == null ? void 0 : a.map((d) => /* @__PURE__ */ r(
|
|
271
|
-
ze,
|
|
272
|
-
{
|
|
273
|
-
className: "group flex justify-between gap-2",
|
|
274
|
-
value: d.id,
|
|
275
|
-
children: [
|
|
276
|
-
/* @__PURE__ */ e("p", { children: d.name }),
|
|
277
|
-
/* @__PURE__ */ r("span", { className: "flex items-center gap-3", children: [
|
|
278
|
-
/* @__PURE__ */ e(
|
|
279
|
-
He,
|
|
280
|
-
{
|
|
281
|
-
onClick: (p) => {
|
|
282
|
-
p.preventDefault(), u(d);
|
|
283
|
-
},
|
|
284
|
-
className: X(
|
|
285
|
-
"size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
286
|
-
{
|
|
287
|
-
invisible: !d.isDefault,
|
|
288
|
-
"text-green-500": d.isDefault
|
|
289
|
-
}
|
|
290
|
-
),
|
|
291
|
-
strokeWidth: 1.5
|
|
292
|
-
}
|
|
293
|
-
),
|
|
294
|
-
/* @__PURE__ */ e(
|
|
295
|
-
Be,
|
|
296
|
-
{
|
|
297
|
-
onClick: (p) => {
|
|
298
|
-
p.preventDefault(), f(d.id);
|
|
299
|
-
},
|
|
300
|
-
className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
|
|
301
|
-
strokeWidth: 1.5
|
|
302
|
-
}
|
|
303
|
-
)
|
|
304
|
-
] })
|
|
305
|
-
]
|
|
306
|
-
},
|
|
307
|
-
d.id
|
|
308
|
-
))
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
)
|
|
312
|
-
] })
|
|
313
|
-
] });
|
|
314
|
-
}
|
|
315
|
-
function wa({
|
|
316
|
-
iconClassName: s
|
|
317
|
-
}) {
|
|
318
|
-
const [n, a] = x(!1), [t, i] = x(""), [o, c] = x(!1), m = w((d) => d.isDownloadingPdf), { tokenProps: h } = R();
|
|
319
|
-
async function f() {
|
|
320
|
-
const d = v.loading(
|
|
321
|
-
"Generating PDF... may take up to 60 seconds"
|
|
322
|
-
);
|
|
323
|
-
try {
|
|
324
|
-
await qe(h.apiServiceUrl), v.dismiss(d), v.success("PDF downloaded successfully!", {
|
|
325
|
-
duration: 2e3
|
|
326
|
-
});
|
|
327
|
-
} catch (p) {
|
|
328
|
-
v.dismiss(d), v.error("Failed to download PDF", {
|
|
329
|
-
description: "Please try again or contact support.",
|
|
330
|
-
richColors: !0
|
|
331
|
-
}), console.error("PDF download error:", p);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
async function u() {
|
|
335
|
-
if (!t) return;
|
|
336
|
-
a(!1), i(""), c(!1);
|
|
337
|
-
const d = v.loading(
|
|
338
|
-
"Generating protected PDF... may take up to 60 seconds"
|
|
339
|
-
);
|
|
340
|
-
try {
|
|
341
|
-
await qe(h.apiServiceUrl, t), v.dismiss(d), v.success("Protected PDF downloaded successfully!", {
|
|
342
|
-
duration: 2e3,
|
|
343
|
-
position: "top-right"
|
|
344
|
-
});
|
|
345
|
-
} catch (p) {
|
|
346
|
-
v.dismiss(d), v.error("Failed to download protected PDF. Please try again."), console.error("Protected PDF download error:", p);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return /* @__PURE__ */ r(P, { children: [
|
|
350
|
-
/* @__PURE__ */ r(Ce, { modal: !1, children: [
|
|
351
|
-
/* @__PURE__ */ e(Se, { asChild: !0, children: /* @__PURE__ */ e(
|
|
352
|
-
M,
|
|
353
|
-
{
|
|
354
|
-
variant: "ghost",
|
|
355
|
-
size: "sm",
|
|
356
|
-
className: "h-7 p-2",
|
|
357
|
-
disabled: m,
|
|
358
|
-
children: /* @__PURE__ */ e(Cs, { className: X("size-4", s) })
|
|
359
|
-
}
|
|
360
|
-
) }),
|
|
361
|
-
/* @__PURE__ */ r(ke, { align: "end", children: [
|
|
362
|
-
/* @__PURE__ */ r(W, { onClick: f, children: [
|
|
363
|
-
/* @__PURE__ */ e(Ss, { className: "mr-2 h-4 w-4" }),
|
|
364
|
-
"Download PDF"
|
|
365
|
-
] }),
|
|
366
|
-
/* @__PURE__ */ r(W, { onClick: () => a(!0), children: [
|
|
367
|
-
/* @__PURE__ */ e(ks, { className: "mr-2 h-4 w-4" }),
|
|
368
|
-
"Download Protected PDF"
|
|
369
|
-
] })
|
|
370
|
-
] })
|
|
371
|
-
] }),
|
|
372
|
-
/* @__PURE__ */ e(
|
|
373
|
-
oe,
|
|
374
|
-
{
|
|
375
|
-
open: n,
|
|
376
|
-
onOpenChange: a,
|
|
377
|
-
children: /* @__PURE__ */ r(ie, { className: "sm:max-w-[425px]", children: [
|
|
378
|
-
/* @__PURE__ */ r(le, { children: [
|
|
379
|
-
/* @__PURE__ */ e(ce, { children: "Download Protected PDF" }),
|
|
380
|
-
/* @__PURE__ */ e(Pe, { children: "Enter a password to protect your PDF. The PDF will be encrypted and require this password to open." })
|
|
381
|
-
] }),
|
|
382
|
-
/* @__PURE__ */ e("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ r("div", { className: "grid gap-2", children: [
|
|
383
|
-
/* @__PURE__ */ e(te, { htmlFor: "password", children: "Password" }),
|
|
384
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
385
|
-
/* @__PURE__ */ e(
|
|
386
|
-
Q,
|
|
387
|
-
{
|
|
388
|
-
id: "password",
|
|
389
|
-
type: o ? "text" : "password",
|
|
390
|
-
value: t,
|
|
391
|
-
onChange: (d) => i(d.target.value),
|
|
392
|
-
placeholder: "Enter password",
|
|
393
|
-
className: "pr-10",
|
|
394
|
-
onKeyDown: (d) => {
|
|
395
|
-
d.key === "Enter" && t && u();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
),
|
|
399
|
-
/* @__PURE__ */ e(
|
|
400
|
-
M,
|
|
401
|
-
{
|
|
402
|
-
type: "button",
|
|
403
|
-
variant: "ghost",
|
|
404
|
-
size: "sm",
|
|
405
|
-
className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
|
|
406
|
-
onClick: () => c(!o),
|
|
407
|
-
children: o ? /* @__PURE__ */ e(Ms, { className: "h-4 w-4 text-muted-foreground" }) : /* @__PURE__ */ e(Ls, { className: "h-4 w-4 text-muted-foreground" })
|
|
408
|
-
}
|
|
409
|
-
)
|
|
410
|
-
] })
|
|
411
|
-
] }) }),
|
|
412
|
-
/* @__PURE__ */ r(Qe, { children: [
|
|
413
|
-
/* @__PURE__ */ e(
|
|
414
|
-
M,
|
|
415
|
-
{
|
|
416
|
-
variant: "outline",
|
|
417
|
-
onClick: () => a(!1),
|
|
418
|
-
children: "Cancel"
|
|
419
|
-
}
|
|
420
|
-
),
|
|
421
|
-
/* @__PURE__ */ e(M, { onClick: u, disabled: !t, children: "Download" })
|
|
422
|
-
] })
|
|
423
|
-
] })
|
|
424
|
-
}
|
|
425
|
-
)
|
|
426
|
-
] });
|
|
427
|
-
}
|
|
428
|
-
const xa = async (s, n, a) => {
|
|
429
|
-
const t = `${s}/management/v1/groups`;
|
|
430
|
-
return await Ke(t, n, a);
|
|
431
|
-
}, Da = async (s, n, a) => {
|
|
432
|
-
const t = `${s}/management/v1/groups/${a}`, i = await fetch(t, {
|
|
433
|
-
method: "DELETE",
|
|
434
|
-
headers: {
|
|
435
|
-
Authorization: `Bearer ${n}`
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
if (!i.ok) {
|
|
439
|
-
const o = await i.text();
|
|
440
|
-
throw new Error(o || "Failed to delete group");
|
|
441
|
-
}
|
|
442
|
-
}, Ca = async (s, n, a, t) => {
|
|
443
|
-
const i = `${s}/management/v1/groups/${a}/members`;
|
|
444
|
-
return await Ke(i, n, t);
|
|
445
|
-
}, Sa = async (s, n, a, t) => {
|
|
446
|
-
const i = `${s}/management/v1/groups/${a}/members`, o = await fetch(i, {
|
|
447
|
-
method: "DELETE",
|
|
448
|
-
headers: {
|
|
449
|
-
"Content-Type": "application/json",
|
|
450
|
-
Authorization: `Bearer ${n}`
|
|
451
|
-
},
|
|
452
|
-
body: JSON.stringify(t)
|
|
453
|
-
});
|
|
454
|
-
if (!o.ok) {
|
|
455
|
-
const c = await o.text();
|
|
456
|
-
throw new Error(c || "Failed to remove group members");
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
function ka() {
|
|
460
|
-
const { authToken: s, tokenProps: n } = R(), a = de();
|
|
461
|
-
return ue({
|
|
462
|
-
mutationFn: (t) => xa(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t),
|
|
463
|
-
onSuccess: () => {
|
|
464
|
-
a.invalidateQueries({ queryKey: ["groups"] }), v.success("Group created successfully");
|
|
465
|
-
},
|
|
466
|
-
onError: (t) => {
|
|
467
|
-
console.error("Failed to create group:", t), v.error("Failed to create group", {
|
|
468
|
-
description: t.message
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
function Ma() {
|
|
474
|
-
const { authToken: s, tokenProps: n } = R(), a = de();
|
|
475
|
-
return ue({
|
|
476
|
-
mutationFn: (t) => Da(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t),
|
|
477
|
-
onSuccess: (t, i) => {
|
|
478
|
-
a.invalidateQueries({ queryKey: ["groups"] }), a.removeQueries({ queryKey: ["group", i] }), v.success("Group deleted successfully");
|
|
479
|
-
},
|
|
480
|
-
onError: (t) => {
|
|
481
|
-
console.error("Failed to delete group:", t), v.error("Failed to delete group", {
|
|
482
|
-
description: t.message
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
function La() {
|
|
488
|
-
const { authToken: s, tokenProps: n } = R(), a = de();
|
|
489
|
-
return ue({
|
|
490
|
-
mutationFn: ({
|
|
491
|
-
groupId: t,
|
|
492
|
-
data: i
|
|
493
|
-
}) => Ca(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t, i),
|
|
494
|
-
onSuccess: (t, i) => {
|
|
495
|
-
a.invalidateQueries({ queryKey: ["group", i.groupId] }), a.invalidateQueries({
|
|
496
|
-
queryKey: ["group-members", i.groupId]
|
|
497
|
-
}), a.invalidateQueries({ queryKey: ["groups"] }), v.success("Members added successfully");
|
|
498
|
-
},
|
|
499
|
-
onError: (t) => {
|
|
500
|
-
console.error("Failed to add group members:", t), v.error("Failed to add members", {
|
|
501
|
-
description: t.message
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
function Pa() {
|
|
507
|
-
const { authToken: s, tokenProps: n } = R(), a = de();
|
|
508
|
-
return ue({
|
|
509
|
-
mutationFn: ({
|
|
510
|
-
groupId: t,
|
|
511
|
-
data: i
|
|
512
|
-
}) => Sa(n.apiServiceUrl, (s == null ? void 0 : s.accessToken) || "", t, i),
|
|
513
|
-
onSuccess: (t, i) => {
|
|
514
|
-
a.invalidateQueries({ queryKey: ["group", i.groupId] }), a.invalidateQueries({
|
|
515
|
-
queryKey: ["group-members", i.groupId]
|
|
516
|
-
}), a.invalidateQueries({ queryKey: ["groups"] }), v.success("Members removed successfully");
|
|
517
|
-
},
|
|
518
|
-
onError: (t) => {
|
|
519
|
-
console.error("Failed to remove group members:", t), v.error("Failed to remove members", {
|
|
520
|
-
description: t.message
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
function Ia({
|
|
526
|
-
onSuccess: s,
|
|
527
|
-
tenantId: n,
|
|
528
|
-
isTenantUser: a
|
|
529
|
-
}) {
|
|
530
|
-
const [t, i] = x(""), [o, c] = x(""), [m, h] = x({}), f = ka(), u = () => {
|
|
531
|
-
const p = {};
|
|
532
|
-
return t.trim() ? t.length < 3 ? p.name = "Group name must be at least 3 characters" : t.length > 50 && (p.name = "Group name must be less than 50 characters") : p.name = "Group name is required", o && o.length > 200 && (p.description = "Description must be less than 200 characters"), h(p), Object.keys(p).length === 0;
|
|
533
|
-
};
|
|
534
|
-
return /* @__PURE__ */ r("form", { onSubmit: async (p) => {
|
|
535
|
-
if (p.preventDefault(), !u()) return;
|
|
536
|
-
const b = {
|
|
537
|
-
name: t.trim(),
|
|
538
|
-
description: o.trim() || void 0,
|
|
539
|
-
type: a ? "TENANT_GROUP" : "ORG_GROUP",
|
|
540
|
-
...a && n ? { tenantId: n } : {}
|
|
541
|
-
};
|
|
542
|
-
try {
|
|
543
|
-
await f.mutateAsync(b), i(""), c(""), h({}), s();
|
|
544
|
-
} catch (N) {
|
|
545
|
-
console.error("Failed to create group:", N);
|
|
546
|
-
}
|
|
547
|
-
}, className: "space-y-6", children: [
|
|
548
|
-
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
549
|
-
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
550
|
-
/* @__PURE__ */ r(te, { htmlFor: "group-name", children: [
|
|
551
|
-
"Group Name ",
|
|
552
|
-
/* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
553
|
-
] }),
|
|
554
|
-
/* @__PURE__ */ e(
|
|
555
|
-
Q,
|
|
556
|
-
{
|
|
557
|
-
id: "group-name",
|
|
558
|
-
placeholder: "e.g., Marketing Team, Engineering Squad",
|
|
559
|
-
value: t,
|
|
560
|
-
onChange: (p) => {
|
|
561
|
-
i(p.target.value), m.name && h((b) => ({ ...b, name: "" }));
|
|
562
|
-
},
|
|
563
|
-
className: m.name ? "border-destructive" : "",
|
|
564
|
-
disabled: f.isPending
|
|
565
|
-
}
|
|
566
|
-
),
|
|
567
|
-
m.name && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: m.name })
|
|
568
|
-
] }),
|
|
569
|
-
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
570
|
-
/* @__PURE__ */ r(te, { htmlFor: "group-description", children: [
|
|
571
|
-
"Description",
|
|
572
|
-
/* @__PURE__ */ e("span", { className: "ml-2 text-xs text-muted-foreground", children: "(optional)" })
|
|
573
|
-
] }),
|
|
574
|
-
/* @__PURE__ */ e(
|
|
575
|
-
Ps,
|
|
576
|
-
{
|
|
577
|
-
id: "group-description",
|
|
578
|
-
placeholder: "Describe the purpose of this group...",
|
|
579
|
-
value: o,
|
|
580
|
-
onChange: (p) => {
|
|
581
|
-
c(p.target.value), m.description && h((b) => ({ ...b, description: "" }));
|
|
582
|
-
},
|
|
583
|
-
className: m.description ? "border-destructive" : "",
|
|
584
|
-
disabled: f.isPending,
|
|
585
|
-
rows: 3
|
|
586
|
-
}
|
|
587
|
-
),
|
|
588
|
-
m.description && /* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: m.description }),
|
|
589
|
-
/* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground", children: [
|
|
590
|
-
o.length,
|
|
591
|
-
"/200 characters"
|
|
592
|
-
] })
|
|
593
|
-
] }),
|
|
594
|
-
/* @__PURE__ */ e("div", { className: "rounded-lg border bg-muted/50 p-4", children: /* @__PURE__ */ r("div", { className: "flex gap-3", children: [
|
|
595
|
-
/* @__PURE__ */ e(Is, { className: "h-4 w-4 mt-0.5 text-muted-foreground" }),
|
|
596
|
-
/* @__PURE__ */ e("div", { className: "text-sm text-muted-foreground", children: "This group will be accessible to users in your workspace. You can add members after creating the group." })
|
|
597
|
-
] }) })
|
|
598
|
-
] }),
|
|
599
|
-
/* @__PURE__ */ r("div", { className: "flex justify-end gap-3", children: [
|
|
600
|
-
/* @__PURE__ */ e(
|
|
601
|
-
M,
|
|
602
|
-
{
|
|
603
|
-
type: "button",
|
|
604
|
-
variant: "outline",
|
|
605
|
-
onClick: () => {
|
|
606
|
-
i(""), c(""), h({});
|
|
607
|
-
},
|
|
608
|
-
disabled: f.isPending,
|
|
609
|
-
children: "Clear"
|
|
610
|
-
}
|
|
611
|
-
),
|
|
612
|
-
/* @__PURE__ */ e(
|
|
613
|
-
M,
|
|
614
|
-
{
|
|
615
|
-
type: "submit",
|
|
616
|
-
disabled: f.isPending || !t.trim(),
|
|
617
|
-
children: f.isPending ? /* @__PURE__ */ r(P, { children: [
|
|
618
|
-
/* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
619
|
-
"Creating..."
|
|
620
|
-
] }) : /* @__PURE__ */ r(P, { children: [
|
|
621
|
-
/* @__PURE__ */ e($, { className: "mr-2 h-4 w-4" }),
|
|
622
|
-
"Create Group"
|
|
623
|
-
] })
|
|
624
|
-
}
|
|
625
|
-
)
|
|
626
|
-
] })
|
|
627
|
-
] });
|
|
628
|
-
}
|
|
629
|
-
function Aa(s, n = []) {
|
|
630
|
-
let a = [];
|
|
631
|
-
function t(o, c) {
|
|
632
|
-
const m = S.createContext(c), h = a.length;
|
|
633
|
-
a = [...a, c];
|
|
634
|
-
const f = (d) => {
|
|
635
|
-
var I;
|
|
636
|
-
const { scope: p, children: b, ...N } = d, D = ((I = p == null ? void 0 : p[s]) == null ? void 0 : I[h]) || m, k = S.useMemo(() => N, Object.values(N));
|
|
637
|
-
return /* @__PURE__ */ e(D.Provider, { value: k, children: b });
|
|
638
|
-
};
|
|
639
|
-
f.displayName = o + "Provider";
|
|
640
|
-
function u(d, p) {
|
|
641
|
-
var D;
|
|
642
|
-
const b = ((D = p == null ? void 0 : p[s]) == null ? void 0 : D[h]) || m, N = S.useContext(b);
|
|
643
|
-
if (N) return N;
|
|
644
|
-
if (c !== void 0) return c;
|
|
645
|
-
throw new Error(`\`${d}\` must be used within \`${o}\``);
|
|
646
|
-
}
|
|
647
|
-
return [f, u];
|
|
648
|
-
}
|
|
649
|
-
const i = () => {
|
|
650
|
-
const o = a.map((c) => S.createContext(c));
|
|
651
|
-
return function(m) {
|
|
652
|
-
const h = (m == null ? void 0 : m[s]) || o;
|
|
653
|
-
return S.useMemo(
|
|
654
|
-
() => ({ [`__scope${s}`]: { ...m, [s]: h } }),
|
|
655
|
-
[m, h]
|
|
656
|
-
);
|
|
657
|
-
};
|
|
658
|
-
};
|
|
659
|
-
return i.scopeName = s, [t, Ea(i, ...n)];
|
|
660
|
-
}
|
|
661
|
-
function Ea(...s) {
|
|
662
|
-
const n = s[0];
|
|
663
|
-
if (s.length === 1) return n;
|
|
664
|
-
const a = () => {
|
|
665
|
-
const t = s.map((i) => ({
|
|
666
|
-
useScope: i(),
|
|
667
|
-
scopeName: i.scopeName
|
|
668
|
-
}));
|
|
669
|
-
return function(o) {
|
|
670
|
-
const c = t.reduce((m, { useScope: h, scopeName: f }) => {
|
|
671
|
-
const d = h(o)[`__scope${f}`];
|
|
672
|
-
return { ...m, ...d };
|
|
673
|
-
}, {});
|
|
674
|
-
return S.useMemo(() => ({ [`__scope${n.scopeName}`]: c }), [c]);
|
|
675
|
-
};
|
|
676
|
-
};
|
|
677
|
-
return a.scopeName = n.scopeName, a;
|
|
678
|
-
}
|
|
679
|
-
function Fa(s) {
|
|
680
|
-
const n = S.useRef(s);
|
|
681
|
-
return S.useEffect(() => {
|
|
682
|
-
n.current = s;
|
|
683
|
-
}), S.useMemo(() => (...a) => {
|
|
684
|
-
var t;
|
|
685
|
-
return (t = n.current) == null ? void 0 : t.call(n, ...a);
|
|
686
|
-
}, []);
|
|
687
|
-
}
|
|
688
|
-
var De = globalThis != null && globalThis.document ? S.useLayoutEffect : () => {
|
|
689
|
-
}, Ta = [
|
|
690
|
-
"a",
|
|
691
|
-
"button",
|
|
692
|
-
"div",
|
|
693
|
-
"form",
|
|
694
|
-
"h2",
|
|
695
|
-
"h3",
|
|
696
|
-
"img",
|
|
697
|
-
"input",
|
|
698
|
-
"label",
|
|
699
|
-
"li",
|
|
700
|
-
"nav",
|
|
701
|
-
"ol",
|
|
702
|
-
"p",
|
|
703
|
-
"select",
|
|
704
|
-
"span",
|
|
705
|
-
"svg",
|
|
706
|
-
"ul"
|
|
707
|
-
], Ie = Ta.reduce((s, n) => {
|
|
708
|
-
const a = As(`Primitive.${n}`), t = S.forwardRef((i, o) => {
|
|
709
|
-
const { asChild: c, ...m } = i, h = c ? a : n;
|
|
710
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ e(h, { ...m, ref: o });
|
|
711
|
-
});
|
|
712
|
-
return t.displayName = `Primitive.${n}`, { ...s, [n]: t };
|
|
713
|
-
}, {});
|
|
714
|
-
function Ga() {
|
|
715
|
-
return ga.useSyncExternalStore(
|
|
716
|
-
Ra,
|
|
717
|
-
() => !0,
|
|
718
|
-
() => !1
|
|
719
|
-
);
|
|
720
|
-
}
|
|
721
|
-
function Ra() {
|
|
722
|
-
return () => {
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
var Ae = "Avatar", [Oa] = Aa(Ae), [Ua, es] = Oa(Ae), ss = S.forwardRef(
|
|
726
|
-
(s, n) => {
|
|
727
|
-
const { __scopeAvatar: a, ...t } = s, [i, o] = S.useState("idle");
|
|
728
|
-
return /* @__PURE__ */ e(
|
|
729
|
-
Ua,
|
|
730
|
-
{
|
|
731
|
-
scope: a,
|
|
732
|
-
imageLoadingStatus: i,
|
|
733
|
-
onImageLoadingStatusChange: o,
|
|
734
|
-
children: /* @__PURE__ */ e(Ie.span, { ...t, ref: n })
|
|
735
|
-
}
|
|
736
|
-
);
|
|
737
|
-
}
|
|
738
|
-
);
|
|
739
|
-
ss.displayName = Ae;
|
|
740
|
-
var as = "AvatarImage", ts = S.forwardRef(
|
|
741
|
-
(s, n) => {
|
|
742
|
-
const { __scopeAvatar: a, src: t, onLoadingStatusChange: i = () => {
|
|
743
|
-
}, ...o } = s, c = es(as, a), m = za(t, o), h = Fa((f) => {
|
|
744
|
-
i(f), c.onImageLoadingStatusChange(f);
|
|
745
|
-
});
|
|
746
|
-
return De(() => {
|
|
747
|
-
m !== "idle" && h(m);
|
|
748
|
-
}, [m, h]), m === "loaded" ? /* @__PURE__ */ e(Ie.img, { ...o, ref: n, src: t }) : null;
|
|
749
|
-
}
|
|
750
|
-
);
|
|
751
|
-
ts.displayName = as;
|
|
752
|
-
var rs = "AvatarFallback", ns = S.forwardRef(
|
|
753
|
-
(s, n) => {
|
|
754
|
-
const { __scopeAvatar: a, delayMs: t, ...i } = s, o = es(rs, a), [c, m] = S.useState(t === void 0);
|
|
755
|
-
return S.useEffect(() => {
|
|
756
|
-
if (t !== void 0) {
|
|
757
|
-
const h = window.setTimeout(() => m(!0), t);
|
|
758
|
-
return () => window.clearTimeout(h);
|
|
759
|
-
}
|
|
760
|
-
}, [t]), c && o.imageLoadingStatus !== "loaded" ? /* @__PURE__ */ e(Ie.span, { ...i, ref: n }) : null;
|
|
761
|
-
}
|
|
762
|
-
);
|
|
763
|
-
ns.displayName = rs;
|
|
764
|
-
function je(s, n) {
|
|
765
|
-
return s ? n ? (s.src !== n && (s.src = n), s.complete && s.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
766
|
-
}
|
|
767
|
-
function za(s, { referrerPolicy: n, crossOrigin: a }) {
|
|
768
|
-
const t = Ga(), i = S.useRef(null), o = t ? (i.current || (i.current = new window.Image()), i.current) : null, [c, m] = S.useState(
|
|
769
|
-
() => je(o, s)
|
|
770
|
-
);
|
|
771
|
-
return De(() => {
|
|
772
|
-
m(je(o, s));
|
|
773
|
-
}, [o, s]), De(() => {
|
|
774
|
-
const h = (d) => () => {
|
|
775
|
-
m(d);
|
|
776
|
-
};
|
|
777
|
-
if (!o) return;
|
|
778
|
-
const f = h("loaded"), u = h("error");
|
|
779
|
-
return o.addEventListener("load", f), o.addEventListener("error", u), n && (o.referrerPolicy = n), typeof a == "string" && (o.crossOrigin = a), () => {
|
|
780
|
-
o.removeEventListener("load", f), o.removeEventListener("error", u);
|
|
781
|
-
};
|
|
782
|
-
}, [o, a, n]), c;
|
|
783
|
-
}
|
|
784
|
-
var os = ss, is = ts, ls = ns;
|
|
785
|
-
const Ee = S.forwardRef(({ className: s, ...n }, a) => /* @__PURE__ */ e(
|
|
786
|
-
os,
|
|
787
|
-
{
|
|
788
|
-
ref: a,
|
|
789
|
-
className: X(
|
|
790
|
-
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
791
|
-
s
|
|
792
|
-
),
|
|
793
|
-
...n
|
|
794
|
-
}
|
|
795
|
-
));
|
|
796
|
-
Ee.displayName = os.displayName;
|
|
797
|
-
const qa = S.forwardRef(({ className: s, ...n }, a) => /* @__PURE__ */ e(
|
|
798
|
-
is,
|
|
799
|
-
{
|
|
800
|
-
ref: a,
|
|
801
|
-
className: X("aspect-square h-full w-full", s),
|
|
802
|
-
...n
|
|
803
|
-
}
|
|
804
|
-
));
|
|
805
|
-
qa.displayName = is.displayName;
|
|
806
|
-
const Fe = S.forwardRef(({ className: s, ...n }, a) => /* @__PURE__ */ e(
|
|
807
|
-
ls,
|
|
808
|
-
{
|
|
809
|
-
ref: a,
|
|
810
|
-
className: X(
|
|
811
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
812
|
-
s
|
|
813
|
-
),
|
|
814
|
-
...n
|
|
815
|
-
}
|
|
816
|
-
));
|
|
817
|
-
Fe.displayName = ls.displayName;
|
|
818
|
-
function _a({
|
|
819
|
-
open: s,
|
|
820
|
-
onOpenChange: n,
|
|
821
|
-
group: a,
|
|
822
|
-
onUpdate: t
|
|
823
|
-
}) {
|
|
824
|
-
const [i, o] = x("members"), [c, m] = x(""), [h, f] = x([]), [u, d] = x([]), { data: p, isLoading: b, refetch: N } = Es(a.id), D = a.type === "TENANT_GROUP" ? "tenant" : "organization", { users: k, isLoading: I } = Fs({
|
|
825
|
-
type: D,
|
|
826
|
-
tenantId: a.tenantId || void 0,
|
|
827
|
-
active: !0,
|
|
828
|
-
limit: 100
|
|
829
|
-
}), O = La(), G = Pa(), A = (p == null ? void 0 : p.members) || [], j = ae(() => new Set(A.map((g) => g.userId)), [A]), y = ae(() => k.filter((g) => !j.has(g.id)), [k, j]), T = ae(() => {
|
|
830
|
-
if (!c) return y;
|
|
831
|
-
const g = c.toLowerCase();
|
|
832
|
-
return y.filter(
|
|
833
|
-
(L) => {
|
|
834
|
-
var E, z;
|
|
835
|
-
return ((E = L.name) == null ? void 0 : E.toLowerCase().includes(g)) || ((z = L.email) == null ? void 0 : z.toLowerCase().includes(g));
|
|
836
|
-
}
|
|
837
|
-
);
|
|
838
|
-
}, [y, c]), C = ae(() => {
|
|
839
|
-
if (!c) return A;
|
|
840
|
-
const g = c.toLowerCase();
|
|
841
|
-
return A.filter(
|
|
842
|
-
(L) => {
|
|
843
|
-
var E, z, Y, q;
|
|
844
|
-
return ((z = (E = L.user) == null ? void 0 : E.name) == null ? void 0 : z.toLowerCase().includes(g)) || ((q = (Y = L.user) == null ? void 0 : Y.email) == null ? void 0 : q.toLowerCase().includes(g));
|
|
845
|
-
}
|
|
846
|
-
);
|
|
847
|
-
}, [A, c]), U = async () => {
|
|
848
|
-
if (h.length !== 0)
|
|
849
|
-
try {
|
|
850
|
-
await O.mutateAsync({
|
|
851
|
-
groupId: a.id,
|
|
852
|
-
data: {
|
|
853
|
-
userIds: h,
|
|
854
|
-
userType: D === "tenant" ? "tenant" : "org"
|
|
855
|
-
}
|
|
856
|
-
}), f([]), o("members"), N(), t == null || t();
|
|
857
|
-
} catch (g) {
|
|
858
|
-
console.error("Failed to add members:", g);
|
|
859
|
-
}
|
|
860
|
-
}, me = async () => {
|
|
861
|
-
if (u.length !== 0)
|
|
862
|
-
try {
|
|
863
|
-
await G.mutateAsync({
|
|
864
|
-
groupId: a.id,
|
|
865
|
-
data: {
|
|
866
|
-
userIds: u
|
|
867
|
-
}
|
|
868
|
-
}), d([]), N(), t == null || t();
|
|
869
|
-
} catch (g) {
|
|
870
|
-
console.error("Failed to remove members:", g);
|
|
871
|
-
}
|
|
872
|
-
}, he = (g) => {
|
|
873
|
-
f(
|
|
874
|
-
(L) => L.includes(g) ? L.filter((E) => E !== g) : [...L, g]
|
|
875
|
-
);
|
|
876
|
-
}, B = (g) => {
|
|
877
|
-
d(
|
|
878
|
-
(L) => L.includes(g) ? L.filter((E) => E !== g) : [...L, g]
|
|
879
|
-
);
|
|
880
|
-
};
|
|
881
|
-
return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(oe, { open: s, onOpenChange: n, children: /* @__PURE__ */ r(ie, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
|
|
882
|
-
/* @__PURE__ */ r(le, { children: [
|
|
883
|
-
/* @__PURE__ */ e(ce, { children: a.name }),
|
|
884
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 mt-1", children: /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground", children: [
|
|
885
|
-
A.length,
|
|
886
|
-
" ",
|
|
887
|
-
A.length === 1 ? "member" : "members"
|
|
888
|
-
] }) }),
|
|
889
|
-
/* @__PURE__ */ r("p", { id: "group-members-description", className: "sr-only", children: [
|
|
890
|
-
"Add or remove members from the ",
|
|
891
|
-
a.name,
|
|
892
|
-
" group"
|
|
893
|
-
] })
|
|
894
|
-
] }),
|
|
895
|
-
/* @__PURE__ */ r(We, { value: i, onValueChange: (g) => {
|
|
896
|
-
o(g), m(""), d([]);
|
|
897
|
-
}, className: "mt-4", children: [
|
|
898
|
-
/* @__PURE__ */ r(Je, { className: "grid w-full grid-cols-2", children: [
|
|
899
|
-
/* @__PURE__ */ e(re, { value: "members", children: "Current Members" }),
|
|
900
|
-
/* @__PURE__ */ e(re, { value: "add", children: "Add Members" })
|
|
901
|
-
] }),
|
|
902
|
-
/* @__PURE__ */ r(ne, { value: "members", className: "mt-4 space-y-4", children: [
|
|
903
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
904
|
-
/* @__PURE__ */ e(be, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
905
|
-
/* @__PURE__ */ e(
|
|
906
|
-
Q,
|
|
907
|
-
{
|
|
908
|
-
placeholder: "Search members...",
|
|
909
|
-
value: c,
|
|
910
|
-
onChange: (g) => m(g.target.value),
|
|
911
|
-
className: "pl-10"
|
|
912
|
-
}
|
|
913
|
-
)
|
|
914
|
-
] }),
|
|
915
|
-
/* @__PURE__ */ e(ve, { className: u.length > 0 ? "h-[300px]" : "h-[350px]", children: b ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((g) => /* @__PURE__ */ e(Ne, { className: "h-16 w-full" }, g)) }) : C.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
916
|
-
/* @__PURE__ */ e($, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
917
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: c ? "No members found" : "No members yet" }),
|
|
918
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: c ? "Try a different search" : 'Switch to the "Add Members" tab to add people to this group' })
|
|
919
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: C.map((g) => /* @__PURE__ */ e(
|
|
920
|
-
$a,
|
|
921
|
-
{
|
|
922
|
-
member: g,
|
|
923
|
-
selected: u.includes(g.userId),
|
|
924
|
-
onToggle: () => B(g.userId)
|
|
925
|
-
},
|
|
926
|
-
g.id
|
|
927
|
-
)) }) }),
|
|
928
|
-
u.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
929
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
|
|
930
|
-
u.length,
|
|
931
|
-
" member",
|
|
932
|
-
u.length !== 1 ? "s" : "",
|
|
933
|
-
" selected"
|
|
934
|
-
] }),
|
|
935
|
-
/* @__PURE__ */ e(
|
|
936
|
-
M,
|
|
937
|
-
{
|
|
938
|
-
variant: "destructive",
|
|
939
|
-
size: "sm",
|
|
940
|
-
onClick: me,
|
|
941
|
-
disabled: G.isPending,
|
|
942
|
-
children: G.isPending ? /* @__PURE__ */ r(P, { children: [
|
|
943
|
-
/* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
944
|
-
"Removing..."
|
|
945
|
-
] }) : /* @__PURE__ */ r(P, { children: [
|
|
946
|
-
/* @__PURE__ */ e(Xe, { className: "mr-2 h-4 w-4" }),
|
|
947
|
-
"Remove Selected"
|
|
948
|
-
] })
|
|
949
|
-
}
|
|
950
|
-
)
|
|
951
|
-
] })
|
|
952
|
-
] }),
|
|
953
|
-
/* @__PURE__ */ r(ne, { value: "add", className: "mt-4 space-y-4", children: [
|
|
954
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
955
|
-
/* @__PURE__ */ e(be, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
956
|
-
/* @__PURE__ */ e(
|
|
957
|
-
Q,
|
|
958
|
-
{
|
|
959
|
-
placeholder: "Search users to add...",
|
|
960
|
-
value: c,
|
|
961
|
-
onChange: (g) => m(g.target.value),
|
|
962
|
-
className: "pl-10"
|
|
963
|
-
}
|
|
964
|
-
)
|
|
965
|
-
] }),
|
|
966
|
-
/* @__PURE__ */ e(ve, { className: "h-[300px]", children: I ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((g) => /* @__PURE__ */ e(Ne, { className: "h-16 w-full" }, g)) }) : T.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
967
|
-
/* @__PURE__ */ e(ye, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
968
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No available users" }),
|
|
969
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: c ? "Try a different search" : "All eligible users are already members" })
|
|
970
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-2", children: T.map((g) => /* @__PURE__ */ e(
|
|
971
|
-
ja,
|
|
972
|
-
{
|
|
973
|
-
user: g,
|
|
974
|
-
selected: h.includes(g.id),
|
|
975
|
-
onToggle: () => he(g.id)
|
|
976
|
-
},
|
|
977
|
-
g.id
|
|
978
|
-
)) }) }),
|
|
979
|
-
h.length > 0 && /* @__PURE__ */ r("div", { className: "flex items-center justify-between pt-4 border-t", children: [
|
|
980
|
-
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground", children: [
|
|
981
|
-
h.length,
|
|
982
|
-
" user",
|
|
983
|
-
h.length !== 1 ? "s" : "",
|
|
984
|
-
" selected"
|
|
985
|
-
] }),
|
|
986
|
-
/* @__PURE__ */ e(
|
|
987
|
-
M,
|
|
988
|
-
{
|
|
989
|
-
onClick: U,
|
|
990
|
-
disabled: O.isPending,
|
|
991
|
-
children: O.isPending ? /* @__PURE__ */ r(P, { children: [
|
|
992
|
-
/* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
993
|
-
"Adding..."
|
|
994
|
-
] }) : /* @__PURE__ */ r(P, { children: [
|
|
995
|
-
/* @__PURE__ */ e(ye, { className: "mr-2 h-4 w-4" }),
|
|
996
|
-
"Add Members"
|
|
997
|
-
] })
|
|
998
|
-
}
|
|
999
|
-
)
|
|
1000
|
-
] })
|
|
1001
|
-
] })
|
|
1002
|
-
] })
|
|
1003
|
-
] }) }) });
|
|
1004
|
-
}
|
|
1005
|
-
function $a({
|
|
1006
|
-
member: s,
|
|
1007
|
-
selected: n,
|
|
1008
|
-
onToggle: a
|
|
1009
|
-
}) {
|
|
1010
|
-
var i, o, c, m;
|
|
1011
|
-
const t = ((o = (i = s.user) == null ? void 0 : i.name) == null ? void 0 : o.split(" ").map((h) => h[0]).join("").toUpperCase()) || "?";
|
|
1012
|
-
return /* @__PURE__ */ r(
|
|
1013
|
-
"div",
|
|
1014
|
-
{
|
|
1015
|
-
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1016
|
-
onClick: a,
|
|
1017
|
-
children: [
|
|
1018
|
-
/* @__PURE__ */ e(Ye, { checked: n }),
|
|
1019
|
-
/* @__PURE__ */ e(Ee, { className: "h-8 w-8", children: /* @__PURE__ */ e(Fe, { className: "text-xs", children: t }) }),
|
|
1020
|
-
/* @__PURE__ */ r("div", { className: "flex-1", children: [
|
|
1021
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: ((c = s.user) == null ? void 0 : c.name) || "Unknown User" }),
|
|
1022
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: (m = s.user) == null ? void 0 : m.email })
|
|
1023
|
-
] })
|
|
1024
|
-
]
|
|
1025
|
-
}
|
|
1026
|
-
);
|
|
1027
|
-
}
|
|
1028
|
-
function ja({
|
|
1029
|
-
user: s,
|
|
1030
|
-
selected: n,
|
|
1031
|
-
onToggle: a
|
|
1032
|
-
}) {
|
|
1033
|
-
var i;
|
|
1034
|
-
const t = ((i = s.name) == null ? void 0 : i.split(" ").map((o) => o[0]).join("").toUpperCase()) || "?";
|
|
1035
|
-
return /* @__PURE__ */ r(
|
|
1036
|
-
"div",
|
|
1037
|
-
{
|
|
1038
|
-
className: "flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",
|
|
1039
|
-
onClick: a,
|
|
1040
|
-
children: [
|
|
1041
|
-
/* @__PURE__ */ e(Ye, { checked: n }),
|
|
1042
|
-
/* @__PURE__ */ e(Ee, { className: "h-8 w-8", children: /* @__PURE__ */ e(Fe, { className: "text-xs", children: t }) }),
|
|
1043
|
-
/* @__PURE__ */ r("div", { className: "flex-1", children: [
|
|
1044
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s.name }),
|
|
1045
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: s.email })
|
|
1046
|
-
] })
|
|
1047
|
-
]
|
|
1048
|
-
}
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
function Va({
|
|
1052
|
-
open: s,
|
|
1053
|
-
onOpenChange: n
|
|
1054
|
-
}) {
|
|
1055
|
-
const [a, t] = x("groups"), [i, o] = x(""), [c, m] = x(null), [h, f] = x(!1), [u, d] = x(null), { tokenProps: p } = R(), { currentUser: b } = Ze(), N = Ma(), D = (b == null ? void 0 : b.type) === "tenant", k = p == null ? void 0 : p.tenantId, { groups: I, isLoading: O, refetch: G } = Ts({
|
|
1056
|
-
type: D ? "TENANT_GROUP" : "all",
|
|
1057
|
-
tenantId: D ? k : void 0,
|
|
1058
|
-
includeMembers: !1
|
|
1059
|
-
}), A = I.filter(
|
|
1060
|
-
(C) => {
|
|
1061
|
-
var U;
|
|
1062
|
-
return C.name.toLowerCase().includes(i.toLowerCase()) || ((U = C.description) == null ? void 0 : U.toLowerCase().includes(i.toLowerCase()));
|
|
1063
|
-
}
|
|
1064
|
-
), j = async () => {
|
|
1065
|
-
if (u)
|
|
1066
|
-
try {
|
|
1067
|
-
await N.mutateAsync(u.id), d(null), G();
|
|
1068
|
-
} catch (C) {
|
|
1069
|
-
console.error("Failed to delete group:", C);
|
|
1070
|
-
}
|
|
1071
|
-
}, y = (C) => {
|
|
1072
|
-
m(C), f(!0);
|
|
1073
|
-
}, T = () => {
|
|
1074
|
-
t("groups"), G();
|
|
1075
|
-
};
|
|
1076
|
-
return /* @__PURE__ */ r(P, { children: [
|
|
1077
|
-
/* @__PURE__ */ e(oe, { open: s, onOpenChange: n, children: /* @__PURE__ */ r(ie, { className: "max-w-4xl max-h-[80vh]", children: [
|
|
1078
|
-
/* @__PURE__ */ r(le, { children: [
|
|
1079
|
-
/* @__PURE__ */ r(ce, { className: "flex items-center gap-2", children: [
|
|
1080
|
-
/* @__PURE__ */ e($, { className: "h-5 w-5" }),
|
|
1081
|
-
"Group Management"
|
|
1082
|
-
] }),
|
|
1083
|
-
/* @__PURE__ */ e(Pe, { children: "Manage your groups, create new groups, and control group membership" })
|
|
1084
|
-
] }),
|
|
1085
|
-
/* @__PURE__ */ r(We, { value: a, onValueChange: t, className: "mt-4", children: [
|
|
1086
|
-
/* @__PURE__ */ r(Je, { className: "grid w-full grid-cols-2", children: [
|
|
1087
|
-
/* @__PURE__ */ r(re, { value: "groups", className: "flex items-center gap-2", children: [
|
|
1088
|
-
/* @__PURE__ */ e($, { className: "h-4 w-4" }),
|
|
1089
|
-
"Groups"
|
|
1090
|
-
] }),
|
|
1091
|
-
/* @__PURE__ */ r(re, { value: "create", className: "flex items-center gap-2", children: [
|
|
1092
|
-
/* @__PURE__ */ e(Le, { className: "h-4 w-4" }),
|
|
1093
|
-
"Create Group"
|
|
1094
|
-
] })
|
|
1095
|
-
] }),
|
|
1096
|
-
/* @__PURE__ */ e(ne, { value: "groups", className: "mt-4", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
1097
|
-
/* @__PURE__ */ r("div", { className: "relative", children: [
|
|
1098
|
-
/* @__PURE__ */ e(be, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
1099
|
-
/* @__PURE__ */ e(
|
|
1100
|
-
Q,
|
|
1101
|
-
{
|
|
1102
|
-
placeholder: "Search groups...",
|
|
1103
|
-
value: i,
|
|
1104
|
-
onChange: (C) => o(C.target.value),
|
|
1105
|
-
className: "pl-10"
|
|
1106
|
-
}
|
|
1107
|
-
)
|
|
1108
|
-
] }),
|
|
1109
|
-
/* @__PURE__ */ e(ve, { className: "h-[400px]", children: O ? /* @__PURE__ */ e("div", { className: "space-y-3", children: [1, 2, 3].map((C) => /* @__PURE__ */ e(Ne, { className: "h-24 w-full" }, C)) }) : A.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-12 text-muted-foreground", children: [
|
|
1110
|
-
/* @__PURE__ */ e($, { className: "h-12 w-12 mb-3 opacity-50" }),
|
|
1111
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: "No groups found" }),
|
|
1112
|
-
/* @__PURE__ */ e("p", { className: "text-xs mt-1", children: i ? "Try a different search" : "Create your first group to get started" })
|
|
1113
|
-
] }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: A.map((C) => /* @__PURE__ */ e(
|
|
1114
|
-
Qa,
|
|
1115
|
-
{
|
|
1116
|
-
group: C,
|
|
1117
|
-
onManageMembers: () => y(C),
|
|
1118
|
-
onDelete: () => d(C),
|
|
1119
|
-
currentUserId: b == null ? void 0 : b.id
|
|
1120
|
-
},
|
|
1121
|
-
C.id
|
|
1122
|
-
)) }) })
|
|
1123
|
-
] }) }),
|
|
1124
|
-
/* @__PURE__ */ e(ne, { value: "create", className: "mt-4", children: /* @__PURE__ */ e(
|
|
1125
|
-
Ia,
|
|
1126
|
-
{
|
|
1127
|
-
onSuccess: T,
|
|
1128
|
-
tenantId: k,
|
|
1129
|
-
isTenantUser: D
|
|
1130
|
-
}
|
|
1131
|
-
) })
|
|
1132
|
-
] })
|
|
1133
|
-
] }) }),
|
|
1134
|
-
c && /* @__PURE__ */ e(
|
|
1135
|
-
_a,
|
|
1136
|
-
{
|
|
1137
|
-
open: h,
|
|
1138
|
-
onOpenChange: f,
|
|
1139
|
-
group: c,
|
|
1140
|
-
onUpdate: () => G()
|
|
1141
|
-
}
|
|
1142
|
-
),
|
|
1143
|
-
/* @__PURE__ */ e(
|
|
1144
|
-
Gs,
|
|
1145
|
-
{
|
|
1146
|
-
open: !!u,
|
|
1147
|
-
onOpenChange: () => d(null),
|
|
1148
|
-
children: /* @__PURE__ */ r(Rs, { children: [
|
|
1149
|
-
/* @__PURE__ */ r(Os, { children: [
|
|
1150
|
-
/* @__PURE__ */ e(Us, { children: "Delete Group" }),
|
|
1151
|
-
/* @__PURE__ */ r(zs, { children: [
|
|
1152
|
-
'Are you sure you want to delete "',
|
|
1153
|
-
u == null ? void 0 : u.name,
|
|
1154
|
-
'"? This action cannot be undone and will remove all members from the group.'
|
|
1155
|
-
] })
|
|
1156
|
-
] }),
|
|
1157
|
-
/* @__PURE__ */ r(qs, { children: [
|
|
1158
|
-
/* @__PURE__ */ e(_s, { children: "Cancel" }),
|
|
1159
|
-
/* @__PURE__ */ e(
|
|
1160
|
-
$s,
|
|
1161
|
-
{
|
|
1162
|
-
onClick: j,
|
|
1163
|
-
disabled: N.isPending,
|
|
1164
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1165
|
-
children: N.isPending ? /* @__PURE__ */ r(P, { children: [
|
|
1166
|
-
/* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1167
|
-
"Deleting..."
|
|
1168
|
-
] }) : "Delete Group"
|
|
1169
|
-
}
|
|
1170
|
-
)
|
|
1171
|
-
] })
|
|
1172
|
-
] })
|
|
1173
|
-
}
|
|
1174
|
-
)
|
|
1175
|
-
] });
|
|
1176
|
-
}
|
|
1177
|
-
function Qa({
|
|
1178
|
-
group: s,
|
|
1179
|
-
onManageMembers: n,
|
|
1180
|
-
onDelete: a,
|
|
1181
|
-
currentUserId: t
|
|
1182
|
-
}) {
|
|
1183
|
-
const i = s.createdBy === t;
|
|
1184
|
-
return /* @__PURE__ */ e("div", { className: "rounded-lg border bg-card p-4 transition-colors hover:bg-muted/50", children: /* @__PURE__ */ r("div", { className: "flex items-start justify-between gap-3", children: [
|
|
1185
|
-
/* @__PURE__ */ r("div", { className: "flex-1 space-y-2", children: [
|
|
1186
|
-
/* @__PURE__ */ r("div", { children: [
|
|
1187
|
-
/* @__PURE__ */ e("h4", { className: "font-medium", children: s.name }),
|
|
1188
|
-
s.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-1", children: s.description })
|
|
1189
|
-
] }),
|
|
1190
|
-
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-3 text-xs text-muted-foreground", children: [
|
|
1191
|
-
/* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
1192
|
-
/* @__PURE__ */ e($, { className: "h-3 w-3" }),
|
|
1193
|
-
s.memberCount,
|
|
1194
|
-
" ",
|
|
1195
|
-
s.memberCount === 1 ? "member" : "members"
|
|
1196
|
-
] }),
|
|
1197
|
-
/* @__PURE__ */ r("span", { children: [
|
|
1198
|
-
"Created ",
|
|
1199
|
-
js(new Date(s.createdAt), "MMM d, yyyy")
|
|
1200
|
-
] })
|
|
1201
|
-
] })
|
|
1202
|
-
] }),
|
|
1203
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-1", children: [
|
|
1204
|
-
/* @__PURE__ */ e(
|
|
1205
|
-
M,
|
|
1206
|
-
{
|
|
1207
|
-
variant: "ghost",
|
|
1208
|
-
size: "sm",
|
|
1209
|
-
onClick: n,
|
|
1210
|
-
title: "Manage members",
|
|
1211
|
-
children: /* @__PURE__ */ e(ye, { className: "h-4 w-4" })
|
|
1212
|
-
}
|
|
1213
|
-
),
|
|
1214
|
-
i && /* @__PURE__ */ e(
|
|
1215
|
-
M,
|
|
1216
|
-
{
|
|
1217
|
-
variant: "ghost",
|
|
1218
|
-
size: "sm",
|
|
1219
|
-
onClick: a,
|
|
1220
|
-
title: "Delete group",
|
|
1221
|
-
className: "text-destructive hover:text-destructive",
|
|
1222
|
-
children: /* @__PURE__ */ e(Xe, { className: "h-4 w-4" })
|
|
1223
|
-
}
|
|
1224
|
-
)
|
|
1225
|
-
] })
|
|
1226
|
-
] }) });
|
|
1227
|
-
}
|
|
1228
|
-
function Za() {
|
|
1229
|
-
var Re, Oe, Ue;
|
|
1230
|
-
const {
|
|
1231
|
-
authToken: s,
|
|
1232
|
-
tokenProps: n,
|
|
1233
|
-
id: a
|
|
1234
|
-
} = R(), { isLocalDev: t } = Vs(), { permissions: i } = Qs(), o = Hs(), { isLoading: c } = Bs();
|
|
1235
|
-
w((l) => l.theme);
|
|
1236
|
-
const m = w((l) => l.lenses), h = w((l) => l.selectedLensId), f = m == null ? void 0 : m.find((l) => l.id === h), u = w((l) => l.dashboard);
|
|
1237
|
-
w((l) => l.selectedSheetId);
|
|
1238
|
-
const d = w(
|
|
1239
|
-
(l) => l.isDashboardEditing
|
|
1240
|
-
), { setDashboardTitle: p } = w((l) => l.actions), [b, N] = x(!1), [D, k] = x(!1), [I, O] = x(!1), G = w((l) => l.isDashboardPanelOpen), A = w(
|
|
1241
|
-
(l) => l.actions.setIsDashboardPanelOpen
|
|
1242
|
-
), j = w((l) => l.filterValues), y = w((l) => l.isVisualEditing);
|
|
1243
|
-
_e((l) => l.card);
|
|
1244
|
-
const T = se(
|
|
1245
|
-
(l) => l.selectedDashboard
|
|
1246
|
-
), C = se(
|
|
1247
|
-
(l) => l.initialDashboard
|
|
1248
|
-
);
|
|
1249
|
-
se((l) => l.selectedVisual), w((l) => l.selectedFrameId), _e((l) => l.frame);
|
|
1250
|
-
const U = T ? (Oe = T == null ? void 0 : T.permissions) == null ? void 0 : Oe.canEdit : (Re = C == null ? void 0 : C.permissions) == null ? void 0 : Re.canEdit, me = w((l) => l.showFilters), he = w(
|
|
1251
|
-
(l) => l.showDashboardJSON
|
|
1252
|
-
), B = w((l) => l.onSaveFunction), g = w(
|
|
1253
|
-
(l) => l.actions.setShowFilters
|
|
1254
|
-
), { setIsDashboardEditing: L, setShowDashboardJSON: E } = w(
|
|
1255
|
-
(l) => l.actions
|
|
1256
|
-
), { setInitialDashboard: z, clearSelectedDashboard: Y } = se(
|
|
1257
|
-
(l) => l.actions
|
|
1258
|
-
), { resources: q } = Ks(fe.DASHBOARD), { currentUser: cs } = Ze(), ds = Ws(cs), V = T || C, Te = V ? {
|
|
1259
|
-
id: V.id,
|
|
1260
|
-
title: (u == null ? void 0 : u.title) || V.title || "Dashboard"
|
|
1261
|
-
} : null, { handleAddNewFrame: us } = Js(), [pe, ge] = x(!1), Z = Xs(fe.DASHBOARD), ms = async (l, F) => {
|
|
1262
|
-
if (!(u != null && u.id)) {
|
|
1263
|
-
console.log("No dashboard ID found");
|
|
1264
|
-
return;
|
|
1265
|
-
}
|
|
1266
|
-
console.log("Updating dashboard title:", {
|
|
1267
|
-
dashboardId: u.id,
|
|
1268
|
-
newTitle: l,
|
|
1269
|
-
previousTitle: F
|
|
1270
|
-
}), Z.mutate(
|
|
1271
|
-
{
|
|
1272
|
-
resourceId: u.id,
|
|
1273
|
-
data: { title: l }
|
|
1274
|
-
},
|
|
1275
|
-
{
|
|
1276
|
-
onSuccess: () => {
|
|
1277
|
-
console.log("Dashboard title updated successfully"), v.success("Dashboard title updated");
|
|
1278
|
-
},
|
|
1279
|
-
onError: (K) => {
|
|
1280
|
-
console.error("Failed to update dashboard title:", K), v.error("Failed to update dashboard title"), p(F);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
);
|
|
1284
|
-
};
|
|
1285
|
-
oa(() => {
|
|
1286
|
-
if (q && q.length > 0) {
|
|
1287
|
-
const l = u == null ? void 0 : u.id;
|
|
1288
|
-
if (l) {
|
|
1289
|
-
const F = q.find(
|
|
1290
|
-
(K) => K.id === l
|
|
1291
|
-
);
|
|
1292
|
-
F && z(F);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
}, [q, u == null ? void 0 : u.id, z]);
|
|
1296
|
-
const ee = n.orgUserId || n.tenantId, hs = d && !y && ee && U, ps = () => {
|
|
1297
|
-
L(!0);
|
|
1298
|
-
};
|
|
1299
|
-
async function gs() {
|
|
1300
|
-
const l = we(
|
|
1301
|
-
u
|
|
1302
|
-
);
|
|
1303
|
-
ge(!0);
|
|
1304
|
-
const F = {
|
|
1305
|
-
template: l
|
|
1306
|
-
};
|
|
1307
|
-
Z.mutate(
|
|
1308
|
-
{
|
|
1309
|
-
resourceId: l.id,
|
|
1310
|
-
data: F
|
|
1311
|
-
},
|
|
1312
|
-
{
|
|
1313
|
-
onSuccess: () => {
|
|
1314
|
-
ge(!1), v.success("Dashboard saved!");
|
|
1315
|
-
},
|
|
1316
|
-
onError: () => {
|
|
1317
|
-
ge(!1), v.error("Failed to save dashboard");
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
async function fs() {
|
|
1323
|
-
if (N(!0), !h || !f) return;
|
|
1324
|
-
const l = we(
|
|
1325
|
-
u
|
|
1326
|
-
), F = JSON.stringify(l), K = {
|
|
1327
|
-
...f,
|
|
1328
|
-
template: F,
|
|
1329
|
-
filterValues: j
|
|
1330
|
-
};
|
|
1331
|
-
await xe(
|
|
1332
|
-
n.apiServiceUrl,
|
|
1333
|
-
K,
|
|
1334
|
-
s == null ? void 0 : s.accessToken
|
|
1335
|
-
), v.success("Lens saved"), B == null || B(l), N(!1);
|
|
1336
|
-
}
|
|
1337
|
-
const Ge = (f == null ? void 0 : f.name) || u.title;
|
|
1338
|
-
Z.isPending && console.log("Title during update:", {
|
|
1339
|
-
title: Ge,
|
|
1340
|
-
dashboardStateTitle: u.title,
|
|
1341
|
-
dashboardId: u == null ? void 0 : u.id,
|
|
1342
|
-
currentLensName: f == null ? void 0 : f.name
|
|
1343
|
-
});
|
|
1344
|
-
const bs = n.orgUserId || n.tenantId && n.endUserId && n.endUserEmail;
|
|
1345
|
-
return /* @__PURE__ */ r(
|
|
1346
|
-
"div",
|
|
1347
|
-
{
|
|
1348
|
-
className: "flex h-11 items-center justify-between gap-2 border-b px-4 py-2",
|
|
1349
|
-
role: "dashboard-controls",
|
|
1350
|
-
children: [
|
|
1351
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1352
|
-
bs && /* @__PURE__ */ r(P, { children: [
|
|
1353
|
-
/* @__PURE__ */ e(
|
|
1354
|
-
_,
|
|
1355
|
-
{
|
|
1356
|
-
"aria-label": "Manage Dashboards",
|
|
1357
|
-
tooltip: "Manage Dashboards",
|
|
1358
|
-
onClick: () => {
|
|
1359
|
-
A(!G);
|
|
1360
|
-
},
|
|
1361
|
-
className: "h-7 p-2",
|
|
1362
|
-
children: /* @__PURE__ */ e(ua, { className: "h-4 w-4" })
|
|
1363
|
-
}
|
|
1364
|
-
),
|
|
1365
|
-
o && !y && /* @__PURE__ */ e(
|
|
1366
|
-
_,
|
|
1367
|
-
{
|
|
1368
|
-
"aria-label": "Dashboard Hub",
|
|
1369
|
-
tooltip: "Dashboard Hub",
|
|
1370
|
-
onClick: () => Y(),
|
|
1371
|
-
className: "h-7 p-2",
|
|
1372
|
-
children: /* @__PURE__ */ e(He, { className: "h-4 w-4" })
|
|
1373
|
-
}
|
|
1374
|
-
)
|
|
1375
|
-
] }),
|
|
1376
|
-
!y && o && (c ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1377
|
-
/* @__PURE__ */ e(H, { className: "h-3 w-3 animate-spin text-muted-foreground" }),
|
|
1378
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Loading..." })
|
|
1379
|
-
] }) : /* @__PURE__ */ e(
|
|
1380
|
-
Ys,
|
|
1381
|
-
{
|
|
1382
|
-
value: Ge || "Untitled Dashboard",
|
|
1383
|
-
onSave: (l) => {
|
|
1384
|
-
console.log("EditableText onSave called:", {
|
|
1385
|
-
newTitle: l,
|
|
1386
|
-
canEditDashboard: U,
|
|
1387
|
-
dashboardId: u == null ? void 0 : u.id
|
|
1388
|
-
});
|
|
1389
|
-
const F = (u == null ? void 0 : u.title) || "";
|
|
1390
|
-
p(l), ms(l, F);
|
|
1391
|
-
},
|
|
1392
|
-
isEditable: U && !f,
|
|
1393
|
-
displayClassName: "text-sm font-medium",
|
|
1394
|
-
inputClassName: "text-sm font-medium",
|
|
1395
|
-
placeholder: "Dashboard Title",
|
|
1396
|
-
isPending: Z.isPending
|
|
1397
|
-
}
|
|
1398
|
-
))
|
|
1399
|
-
] }),
|
|
1400
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1401
|
-
y && /* @__PURE__ */ r(P, { children: [
|
|
1402
|
-
/* @__PURE__ */ e(ia, { className: "mr-2" }),
|
|
1403
|
-
/* @__PURE__ */ e(la, { className: "h-7" })
|
|
1404
|
-
] }),
|
|
1405
|
-
t && !y && /* @__PURE__ */ r(P, { children: [
|
|
1406
|
-
/* @__PURE__ */ e(
|
|
1407
|
-
_,
|
|
1408
|
-
{
|
|
1409
|
-
tooltip: "Copy Token",
|
|
1410
|
-
onClick: () => {
|
|
1411
|
-
var l;
|
|
1412
|
-
s != null && s.accessToken && ((l = navigator == null ? void 0 : navigator.clipboard) != null && l.writeText ? navigator.clipboard.writeText(s.accessToken).then(() => v.success("Token copied to clipboard")).catch(() => v.error("Unable to copy token")) : v.error("Clipboard not available"));
|
|
1413
|
-
},
|
|
1414
|
-
className: "h-7 p-2",
|
|
1415
|
-
children: /* @__PURE__ */ e(Zs, { className: "h-4 w-4" })
|
|
1416
|
-
}
|
|
1417
|
-
),
|
|
1418
|
-
/* @__PURE__ */ e(
|
|
1419
|
-
_,
|
|
1420
|
-
{
|
|
1421
|
-
tooltip: "Invalidate Token",
|
|
1422
|
-
onClick: () => ea(n.apiServiceUrl),
|
|
1423
|
-
className: "h-7 p-2",
|
|
1424
|
-
children: /* @__PURE__ */ e(ha, { className: "h-4 w-4" })
|
|
1425
|
-
}
|
|
1426
|
-
)
|
|
1427
|
-
] }),
|
|
1428
|
-
!y && o && /* @__PURE__ */ e(wa, {}),
|
|
1429
|
-
!y && o && /* @__PURE__ */ e(ca, {}),
|
|
1430
|
-
!y && o && ds && /* @__PURE__ */ e(
|
|
1431
|
-
_,
|
|
1432
|
-
{
|
|
1433
|
-
tooltip: "Manage Groups",
|
|
1434
|
-
onClick: () => O(!0),
|
|
1435
|
-
className: "h-7 p-2",
|
|
1436
|
-
children: /* @__PURE__ */ e($, { className: "h-4 w-4" })
|
|
1437
|
-
}
|
|
1438
|
-
),
|
|
1439
|
-
!y && o && ((Ue = V == null ? void 0 : V.permissions) == null ? void 0 : Ue.canShare) && /* @__PURE__ */ e(
|
|
1440
|
-
_,
|
|
1441
|
-
{
|
|
1442
|
-
tooltip: "Share Dashboard",
|
|
1443
|
-
onClick: () => k(!0),
|
|
1444
|
-
className: "h-7 p-2",
|
|
1445
|
-
children: /* @__PURE__ */ e(sa, { className: "h-4 w-4" })
|
|
1446
|
-
}
|
|
1447
|
-
),
|
|
1448
|
-
!me && !y && d && i.canUseFilters && o && /* @__PURE__ */ e(
|
|
1449
|
-
M,
|
|
1450
|
-
{
|
|
1451
|
-
className: "h-7 p-2",
|
|
1452
|
-
variant: "outline",
|
|
1453
|
-
onClick: () => g(!0),
|
|
1454
|
-
size: "sm",
|
|
1455
|
-
children: /* @__PURE__ */ e(aa, { className: "h-4 w-4" })
|
|
1456
|
-
}
|
|
1457
|
-
),
|
|
1458
|
-
d && !y && ee && t && o && /* @__PURE__ */ e(Na, {}),
|
|
1459
|
-
!y && ee && t && o && /* @__PURE__ */ e(ya, {}),
|
|
1460
|
-
d && !y && ee && f && t && o && /* @__PURE__ */ r(
|
|
1461
|
-
M,
|
|
1462
|
-
{
|
|
1463
|
-
className: "h-7 p-2",
|
|
1464
|
-
variant: "secondary",
|
|
1465
|
-
disabled: b,
|
|
1466
|
-
onClick: fs,
|
|
1467
|
-
size: "sm",
|
|
1468
|
-
children: [
|
|
1469
|
-
/* @__PURE__ */ e($e, { className: "mr-2 h-4 w-4" }),
|
|
1470
|
-
"Save Lens"
|
|
1471
|
-
]
|
|
1472
|
-
}
|
|
1473
|
-
),
|
|
1474
|
-
d && !y && o && /* @__PURE__ */ r(
|
|
1475
|
-
M,
|
|
1476
|
-
{
|
|
1477
|
-
variant: "outline",
|
|
1478
|
-
className: "h-7 p-2",
|
|
1479
|
-
size: "sm",
|
|
1480
|
-
disabled: !d,
|
|
1481
|
-
onClick: () => us(),
|
|
1482
|
-
children: [
|
|
1483
|
-
/* @__PURE__ */ e(Le, { className: "mr-2 h-4 w-4" }),
|
|
1484
|
-
"Visual"
|
|
1485
|
-
]
|
|
1486
|
-
}
|
|
1487
|
-
),
|
|
1488
|
-
!y && !d && i.canEdit && o && /* @__PURE__ */ r(
|
|
1489
|
-
M,
|
|
1490
|
-
{
|
|
1491
|
-
variant: "outline",
|
|
1492
|
-
className: "h-7 p-2",
|
|
1493
|
-
onClick: ps,
|
|
1494
|
-
size: "sm",
|
|
1495
|
-
children: [
|
|
1496
|
-
/* @__PURE__ */ e(ta, { className: "mr-2 h-4 w-4" }),
|
|
1497
|
-
"Edit"
|
|
1498
|
-
]
|
|
1499
|
-
}
|
|
1500
|
-
),
|
|
1501
|
-
hs && o && /* @__PURE__ */ r(
|
|
1502
|
-
M,
|
|
1503
|
-
{
|
|
1504
|
-
className: "h-7 p-2",
|
|
1505
|
-
disabled: pe,
|
|
1506
|
-
onClick: gs,
|
|
1507
|
-
size: "sm",
|
|
1508
|
-
children: [
|
|
1509
|
-
pe ? /* @__PURE__ */ e(H, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e($e, { className: "mr-2 h-4 w-4" }),
|
|
1510
|
-
pe ? "Saving..." : "Save"
|
|
1511
|
-
]
|
|
1512
|
-
}
|
|
1513
|
-
),
|
|
1514
|
-
!y && d && t && o && /* @__PURE__ */ e("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ e(
|
|
1515
|
-
M,
|
|
1516
|
-
{
|
|
1517
|
-
className: "h-7 p-2",
|
|
1518
|
-
onClick: () => E(!he),
|
|
1519
|
-
size: "sm",
|
|
1520
|
-
variant: "ghost",
|
|
1521
|
-
children: /* @__PURE__ */ e(ra, { className: "h-4 w-4" })
|
|
1522
|
-
}
|
|
1523
|
-
) }),
|
|
1524
|
-
!y && t && /* @__PURE__ */ e(fa, {}),
|
|
1525
|
-
d && !y && o && /* @__PURE__ */ r(
|
|
1526
|
-
M,
|
|
1527
|
-
{
|
|
1528
|
-
variant: "outline",
|
|
1529
|
-
className: "h-7 p-2",
|
|
1530
|
-
onClick: () => {
|
|
1531
|
-
L(!1), E(!1);
|
|
1532
|
-
},
|
|
1533
|
-
children: [
|
|
1534
|
-
/* @__PURE__ */ e(Be, { className: "mr-2 h-4 w-4" }),
|
|
1535
|
-
"Close"
|
|
1536
|
-
]
|
|
1537
|
-
}
|
|
1538
|
-
),
|
|
1539
|
-
D && Te && /* @__PURE__ */ e(
|
|
1540
|
-
na,
|
|
1541
|
-
{
|
|
1542
|
-
resource: Te,
|
|
1543
|
-
resourceType: fe.DASHBOARD,
|
|
1544
|
-
onClose: () => k(!1)
|
|
1545
|
-
}
|
|
1546
|
-
),
|
|
1547
|
-
/* @__PURE__ */ e(
|
|
1548
|
-
Va,
|
|
1549
|
-
{
|
|
1550
|
-
open: I,
|
|
1551
|
-
onOpenChange: O
|
|
1552
|
-
}
|
|
1553
|
-
)
|
|
1554
|
-
] })
|
|
1555
|
-
]
|
|
1556
|
-
}
|
|
1557
|
-
);
|
|
1558
|
-
}
|
|
1559
|
-
export {
|
|
1560
|
-
Za as default
|
|
1561
|
-
};
|