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