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