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