react-semaphor 0.1.314 → 0.1.316
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.js +65 -65
- package/dist/briefings/index.cjs +1 -0
- package/dist/briefings/index.js +848 -0
- package/dist/chunks/{braces-CWi8x9ww.js → braces-CDPz6CF2.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-D70CuT-1.js → calendar-preferences-dialog-9NlFzHX8.js} +3 -3
- package/dist/chunks/{calendar-preferences-dialog-BzpQ5u4h.js → calendar-preferences-dialog-BDdxi7Xm.js} +1 -1
- package/dist/chunks/{chevrons-up-down-B2viXO2I.js → chevrons-up-down-BsdQRmJL.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-5fM_KJoT.js +7321 -0
- package/dist/chunks/dashboard-briefing-launcher-CVxLt10p.js +96 -0
- package/dist/chunks/dashboard-controls-9YV-D1tD.js +2009 -0
- package/dist/chunks/dashboard-controls-UR_m0wD1.js +57 -0
- package/dist/chunks/{dashboard-json-CJCAen1R.js → dashboard-json-CKPID8Am.js} +2 -2
- package/dist/chunks/{dashboard-json-v2C6Tmqf.js → dashboard-json-ws4tortP.js} +1 -1
- package/dist/chunks/edit-dashboard-visual-CmxnZI8I.js +178 -0
- package/dist/chunks/{edit-dashboard-visual-DljWvnMy.js → edit-dashboard-visual-ifKJLMTS.js} +807 -822
- package/dist/chunks/index-Xdag_85e.js +1298 -0
- package/dist/chunks/{index-P5hPTTzm.js → index-gcA9Rs35.js} +41178 -46390
- package/dist/chunks/{palette-CIuwlEiG.js → palette-BlxLchHy.js} +1 -1
- package/dist/chunks/{resource-management-panel-CAxXzMdi.js → resource-management-panel-BduJanWW.js} +1 -1
- package/dist/chunks/{resource-management-panel-Dk0DzgVm.js → resource-management-panel-paSAzVj2.js} +81 -81
- package/dist/chunks/{save-_ALpoMy6.js → save-DVRQBMeb.js} +1 -1
- package/dist/chunks/{switch-B6fh8nb-.js → switch-sauemjyY.js} +199 -199
- package/dist/chunks/{use-create-flow-overlay-state-Cqf7GaFm.js → use-create-flow-overlay-state-DKV6tIc5.js} +254 -225
- package/dist/chunks/use-create-flow-overlay-state-DWnzVVlP.js +26 -0
- package/dist/chunks/{use-visual-utils-CQQ3jvDn.js → use-visual-utils-C8PDxg2w.js} +1 -1
- package/dist/chunks/{use-visual-utils-CPMQLBYR.js → use-visual-utils-Cs0-baCK.js} +48 -48
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +232 -485
- 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 +240 -0
- package/dist/types/dashboard.d.ts +1 -0
- package/dist/types/main.d.ts +619 -1017
- package/dist/types/surfboard.d.ts +1 -0
- package/dist/types/types.d.ts +411 -261
- package/package.json +7 -2
- package/dist/chunks/dashboard-controls-BS_aZcxs.js +0 -57
- package/dist/chunks/dashboard-controls-DbKtbw1V.js +0 -2021
- package/dist/chunks/dashboard-filter-controls-launcher-C8Wm2Smj.js +0 -1540
- package/dist/chunks/dashboard-filter-controls-launcher-CMXpudFJ.js +0 -11
- package/dist/chunks/edit-dashboard-visual-lRn3FeaP.js +0 -183
- package/dist/chunks/index-XYIIY48z.js +0 -1330
- package/dist/chunks/use-create-flow-overlay-state-DMZTflFt.js +0 -16
|
@@ -1,2021 +0,0 @@
|
|
|
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 ua, h as Za, L as ea, x as de, a as W, aE as _e, aF as es, aG as as, I as Zs, f as X, aH as et, aI as at, aJ as aa, T as ss, k as ts, l as Pe, n as Te, m as sa, aK as rs, aC as st, i as Va, s as tt, t as rt, v as nt, w as ot, K as it, aL as ct } from "./switch-B6fh8nb-.js";
|
|
3
|
-
import { ch as lt, u as j, b as ma, ci as dt, bl as ta, c as ha, d as pa, e as fa, f as ns, n as ut, cj as le, by as Oe, ck as mt, cl as ja, cm as os, cn as is, co as ht, bO as ga, cp as pt, cq as ft, cr as gt, cs as vt, ct as bt, cu as yt, q as Ue, M as Re, o as M, bV as xt, cv as St, cw as Nt, bS as ra, cx as na, bx as va, bc as cs, ba as ls, cy as wt, bF as ds, bG as us, bH as ms, bI as hs, bJ as ps, bK as fs, bL as gs, bM as oa, bp as Dt, cz as Ct, cA as Et, W as Lt, V as ke, a0 as Mt, X as Qe, cB as At, cC as kt, cD as It, ac as Ot, cE as Pt, I as Je, cF as Tt, cG as _t, cH as Ut, cf as Rt, bq as Gt, br as Ft, bs as $t, bt as zt, bu as F, bZ as Ht, K as qt, bA as Vt, bv as Ba, cI as jt, cJ as Bt, cK as Kt, $ as Qt, L as Jt, cL as Wt, H as ia } from "./index-P5hPTTzm.js";
|
|
4
|
-
import * as k from "react";
|
|
5
|
-
import vs, { useState as x, useMemo as q, useEffect as We, useCallback as Xt } from "react";
|
|
6
|
-
import "./index-CJdxSyQq.js";
|
|
7
|
-
import "react-dom";
|
|
8
|
-
import { b as Yt, u as Zt, A as er, V as ar, e as sr, N as tr, U as rr } from "./dashboard-filter-controls-launcher-C8Wm2Smj.js";
|
|
9
|
-
import { d as nr } from "./index-DFOb_6HB.js";
|
|
10
|
-
import { C as or } from "./calendar-preferences-dialog-D70CuT-1.js";
|
|
11
|
-
import { u as ir } 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 Ka } from "./save-_ALpoMy6.js";
|
|
14
|
-
import { P as cr } from "./palette-CIuwlEiG.js";
|
|
15
|
-
import { B as lr } from "./braces-CWi8x9ww.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 dr = 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 ur = 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 mr = 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 hr = 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 pr = 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 fr = 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 gr = 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 ca = 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 la = { exports: {} }, Ye = {};
|
|
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 Qa;
|
|
127
|
-
function vr() {
|
|
128
|
-
if (Qa) return Ye;
|
|
129
|
-
Qa = 1;
|
|
130
|
-
var a = vs;
|
|
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, n = a.useEffect, d = a.useLayoutEffect, l = a.useDebugValue;
|
|
135
|
-
function u(p, h) {
|
|
136
|
-
var f = h(), o = s({ inst: { value: f, getSnapshot: h } }), y = o[0].inst, w = o[1];
|
|
137
|
-
return d(
|
|
138
|
-
function() {
|
|
139
|
-
y.value = f, y.getSnapshot = h, g(y) && w({ inst: y });
|
|
140
|
-
},
|
|
141
|
-
[p, f, h]
|
|
142
|
-
), n(
|
|
143
|
-
function() {
|
|
144
|
-
return g(y) && w({ inst: y }), p(function() {
|
|
145
|
-
g(y) && w({ 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 Ye.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : m, Ye;
|
|
166
|
-
}
|
|
167
|
-
var Ze = {};
|
|
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 Ja;
|
|
178
|
-
function br() {
|
|
179
|
-
return Ja || (Ja = 1, process.env.NODE_ENV !== "production" && function() {
|
|
180
|
-
function a(f, o) {
|
|
181
|
-
return f === o && (f !== 0 || 1 / f === 1 / o) || f !== f && o !== o;
|
|
182
|
-
}
|
|
183
|
-
function r(f, o) {
|
|
184
|
-
m || n.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 = o();
|
|
188
|
-
if (!p) {
|
|
189
|
-
var w = o();
|
|
190
|
-
d(y, w) || (console.error(
|
|
191
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
192
|
-
), p = !0);
|
|
193
|
-
}
|
|
194
|
-
w = l({
|
|
195
|
-
inst: { value: y, getSnapshot: o }
|
|
196
|
-
});
|
|
197
|
-
var D = w[0].inst, N = w[1];
|
|
198
|
-
return g(
|
|
199
|
-
function() {
|
|
200
|
-
D.value = y, D.getSnapshot = o, t(D) && N({ inst: D });
|
|
201
|
-
},
|
|
202
|
-
[f, y, o]
|
|
203
|
-
), u(
|
|
204
|
-
function() {
|
|
205
|
-
return t(D) && N({ inst: D }), f(function() {
|
|
206
|
-
t(D) && N({ inst: D });
|
|
207
|
-
});
|
|
208
|
-
},
|
|
209
|
-
[f]
|
|
210
|
-
), b(y), y;
|
|
211
|
-
}
|
|
212
|
-
function t(f) {
|
|
213
|
-
var o = f.getSnapshot;
|
|
214
|
-
f = f.value;
|
|
215
|
-
try {
|
|
216
|
-
var y = o();
|
|
217
|
-
return !d(f, y);
|
|
218
|
-
} catch {
|
|
219
|
-
return !0;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function s(f, o) {
|
|
223
|
-
return o();
|
|
224
|
-
}
|
|
225
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
226
|
-
var n = vs, d = typeof Object.is == "function" ? Object.is : a, l = n.useState, u = n.useEffect, g = n.useLayoutEffect, b = n.useDebugValue, m = !1, p = !1, h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : r;
|
|
227
|
-
Ze.useSyncExternalStore = n.useSyncExternalStore !== void 0 ? n.useSyncExternalStore : h, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
228
|
-
}()), Ze;
|
|
229
|
-
}
|
|
230
|
-
process.env.NODE_ENV === "production" ? la.exports = vr() : la.exports = br();
|
|
231
|
-
var yr = la.exports;
|
|
232
|
-
const Ie = ["light", "dark", "system"];
|
|
233
|
-
function xr() {
|
|
234
|
-
const { theme: a, setTheme: r } = lt(), 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 n = a === "light" ? fr : a === "dark" ? hr : mr, 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(n, { className: "h-3.5 w-3.5", strokeWidth: 1.5 })
|
|
253
|
-
}
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
async function Sr(a, r, t, s, n) {
|
|
257
|
-
if (!n)
|
|
258
|
-
return null;
|
|
259
|
-
const d = JSON.stringify(t), l = `${a}/v1/lens`;
|
|
260
|
-
return await ua(l, n, {
|
|
261
|
-
name: r,
|
|
262
|
-
template: d,
|
|
263
|
-
filterValues: s,
|
|
264
|
-
operation: "create"
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
async function da(a, r, t) {
|
|
268
|
-
if (!t)
|
|
269
|
-
return null;
|
|
270
|
-
const { id: s, template: n, filterValues: d, isDefault: l, shared: u } = r, g = `${a}/v1/lens`;
|
|
271
|
-
return await ua(g, t, {
|
|
272
|
-
lensId: s,
|
|
273
|
-
template: n,
|
|
274
|
-
filterValues: d,
|
|
275
|
-
isDefault: l,
|
|
276
|
-
shared: u,
|
|
277
|
-
operation: "update"
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
async function Nr(a, r, t) {
|
|
281
|
-
if (!t)
|
|
282
|
-
return null;
|
|
283
|
-
const s = `${a}/v1/lens`;
|
|
284
|
-
return await ua(s, t, {
|
|
285
|
-
operation: "delete",
|
|
286
|
-
lensId: r
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
const wr = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
290
|
-
function Dr({
|
|
291
|
-
open: a,
|
|
292
|
-
onOpenChange: r
|
|
293
|
-
} = {}) {
|
|
294
|
-
const [t, s] = x(""), [n, d] = x(!1), l = S((E) => E.lenses), { setLenses: u, setSelectedLensId: g } = Za(), [b, m] = x(!1), [p, h] = x(!1), f = a !== void 0, o = f ? a : p, y = (E) => {
|
|
295
|
-
f || h(E), r == null || r(E);
|
|
296
|
-
}, w = S((E) => E.dashboard), D = S((E) => E.filterValues), { authToken: N, tokenProps: C } = j();
|
|
297
|
-
async function T() {
|
|
298
|
-
m(!0);
|
|
299
|
-
const E = await Sr(
|
|
300
|
-
C.apiServiceUrl,
|
|
301
|
-
t,
|
|
302
|
-
w,
|
|
303
|
-
D,
|
|
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(ma, { open: o, onOpenChange: y, children: [
|
|
309
|
-
f ? null : /* @__PURE__ */ e(dt, { asChild: !0, children: /* @__PURE__ */ i(A, { variant: "secondary", size: "xs", children: [
|
|
310
|
-
/* @__PURE__ */ e(ta, { className: "h-3.5 w-3.5" }),
|
|
311
|
-
"Lens"
|
|
312
|
-
] }) }),
|
|
313
|
-
/* @__PURE__ */ i(ha, { className: "rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control", children: [
|
|
314
|
-
/* @__PURE__ */ i(pa, { children: [
|
|
315
|
-
/* @__PURE__ */ e(fa, { className: "text-[15px]", children: "Create lens" }),
|
|
316
|
-
/* @__PURE__ */ e(ns, { 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(ea, { htmlFor: "lens-name", className: wr, 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
|
-
n && /* @__PURE__ */ e("p", { className: "text-[12px] text-destructive", children: "A lens with this name already exists. Pick a different one." })
|
|
331
|
-
] }),
|
|
332
|
-
/* @__PURE__ */ i(ut, { 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 Cr({ includeLabel: a = !1 } = {}) {
|
|
349
|
-
const r = S((m) => m.lenses), t = S((m) => m.selectedLensId), { setLenses: s, setSelectedLensId: n } = Za(), { authToken: d, tokenProps: l } = j();
|
|
350
|
-
async function u(m) {
|
|
351
|
-
n(m);
|
|
352
|
-
}
|
|
353
|
-
async function g(m) {
|
|
354
|
-
if (await Nr(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 || []), n("original");
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
async function b(m) {
|
|
360
|
-
const p = r == null ? void 0 : r.map((o) => o.id === m.id ? {
|
|
361
|
-
...o,
|
|
362
|
-
isDefault: !m.isDefault
|
|
363
|
-
} : {
|
|
364
|
-
...o,
|
|
365
|
-
isDefault: !1
|
|
366
|
-
});
|
|
367
|
-
s(p || []);
|
|
368
|
-
const h = {
|
|
369
|
-
...m,
|
|
370
|
-
isDefault: !m.isDefault
|
|
371
|
-
};
|
|
372
|
-
await da(l.apiServiceUrl, h, d == null ? void 0 : d.accessToken);
|
|
373
|
-
const f = r == null ? void 0 : r.find((o) => o.isDefault);
|
|
374
|
-
if (f && f.id !== m.id) {
|
|
375
|
-
const o = {
|
|
376
|
-
...f,
|
|
377
|
-
isDefault: !1
|
|
378
|
-
};
|
|
379
|
-
await da(l.apiServiceUrl, o, 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
|
-
mt,
|
|
389
|
-
{
|
|
390
|
-
value: t,
|
|
391
|
-
onValueChange: u,
|
|
392
|
-
children: [
|
|
393
|
-
/* @__PURE__ */ e(ja, { value: "original", children: "Original" }),
|
|
394
|
-
r == null ? void 0 : r.map((m) => /* @__PURE__ */ i(
|
|
395
|
-
ja,
|
|
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
|
-
os,
|
|
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
|
-
is,
|
|
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 Er() {
|
|
439
|
-
const { displayPreferences: a, shouldShowElement: r } = ht(), { currentUser: t, userContext: s } = ga(), n = q(
|
|
440
|
-
() => pt(t),
|
|
441
|
-
[t]
|
|
442
|
-
), d = q(() => (u) => n && n[u] !== void 0 && n[u] === !1 ? !1 : r(u), [n, r, a]), l = q(
|
|
443
|
-
() => {
|
|
444
|
-
var u, g, b, m, p;
|
|
445
|
-
return {
|
|
446
|
-
canEdit: ((u = s == null ? void 0 : s.permissions) == null ? void 0 : u.canEdit) ?? yt(t),
|
|
447
|
-
canUseFilters: ((g = s == null ? void 0 : s.permissions) == null ? void 0 : g.canEdit) ?? bt(t),
|
|
448
|
-
canManageDashboards: ((b = s == null ? void 0 : s.permissions) == null ? void 0 : b.canCreateDashboard) ?? vt(t),
|
|
449
|
-
canCreateDashboards: ((m = s == null ? void 0 : s.permissions) == null ? void 0 : m.canCreateDashboard) ?? gt(t),
|
|
450
|
-
canAccessVisuals: ((p = s == null ? void 0 : s.permissions) == null ? void 0 : p.canEdit) ?? ft(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 Lr = async (a, r, t) => {
|
|
463
|
-
const s = `${a}/management/v1/groups`;
|
|
464
|
-
return await as(s, r, t);
|
|
465
|
-
}, Mr = async (a, r, t) => {
|
|
466
|
-
const s = `${a}/management/v1/groups/${t}`;
|
|
467
|
-
await es(s, r, "DELETE");
|
|
468
|
-
}, Ar = async (a, r, t, s) => {
|
|
469
|
-
const n = `${a}/management/v1/groups/${t}/members`;
|
|
470
|
-
return await as(n, r, s);
|
|
471
|
-
}, kr = async (a, r, t, s) => {
|
|
472
|
-
const n = `${a}/management/v1/groups/${t}/members`;
|
|
473
|
-
await es(n, r, "DELETE", s);
|
|
474
|
-
};
|
|
475
|
-
function Ir() {
|
|
476
|
-
const { authToken: a, tokenProps: r } = j(), t = Ue();
|
|
477
|
-
return Re({
|
|
478
|
-
mutationFn: (s) => Lr(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 Or() {
|
|
490
|
-
const { authToken: a, tokenProps: r } = j(), t = Ue();
|
|
491
|
-
return Re({
|
|
492
|
-
mutationFn: (s) => Mr(r.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s),
|
|
493
|
-
onSuccess: (s, n) => {
|
|
494
|
-
t.invalidateQueries({ queryKey: ["groups"] }), t.removeQueries({ queryKey: ["group", n] }), 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 Pr() {
|
|
504
|
-
const { authToken: a, tokenProps: r } = j(), t = Ue();
|
|
505
|
-
return Re({
|
|
506
|
-
mutationFn: ({
|
|
507
|
-
groupId: s,
|
|
508
|
-
data: n
|
|
509
|
-
}) => Ar(r.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s, n),
|
|
510
|
-
onSuccess: (s, n) => {
|
|
511
|
-
t.invalidateQueries({ queryKey: ["group", n.groupId] }), t.invalidateQueries({
|
|
512
|
-
queryKey: ["group-members", n.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 Tr() {
|
|
523
|
-
const { authToken: a, tokenProps: r } = j(), t = Ue();
|
|
524
|
-
return Re({
|
|
525
|
-
mutationFn: ({
|
|
526
|
-
groupId: s,
|
|
527
|
-
data: n
|
|
528
|
-
}) => kr(r.apiServiceUrl, (a == null ? void 0 : a.accessToken) || "", s, n),
|
|
529
|
-
onSuccess: (s, n) => {
|
|
530
|
-
t.invalidateQueries({ queryKey: ["group", n.groupId] }), t.invalidateQueries({
|
|
531
|
-
queryKey: ["group-members", n.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 Wa = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
|
|
542
|
-
function _r({
|
|
543
|
-
onSuccess: a,
|
|
544
|
-
tenantId: r,
|
|
545
|
-
isTenantUser: t
|
|
546
|
-
}) {
|
|
547
|
-
const [s, n] = x(""), [d, l] = x(""), [u, g] = x({}), b = Ir(), 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), n(""), l(""), g({}), a();
|
|
561
|
-
} catch (o) {
|
|
562
|
-
console.error("Failed to create group:", o);
|
|
563
|
-
}
|
|
564
|
-
}, className: "space-y-4", children: [
|
|
565
|
-
/* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
566
|
-
/* @__PURE__ */ i(ea, { htmlFor: "group-name", className: Wa, 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
|
-
n(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(ea, { htmlFor: "group-description", className: Wa, children: "Description (optional)" }),
|
|
588
|
-
/* @__PURE__ */ e(
|
|
589
|
-
xt,
|
|
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(Zs, { 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
|
-
n(""), 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 Ur(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 D;
|
|
649
|
-
const { scope: h, children: f, ...o } = p, y = ((D = h == null ? void 0 : h[a]) == null ? void 0 : D[g]) || u, w = k.useMemo(() => o, Object.values(o));
|
|
650
|
-
return /* @__PURE__ */ e(y.Provider, { value: w, 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, o = k.useContext(f);
|
|
656
|
-
if (o) return o;
|
|
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 n = () => {
|
|
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 n.scopeName = a, [s, Rr(n, ...r)];
|
|
673
|
-
}
|
|
674
|
-
function Rr(...a) {
|
|
675
|
-
const r = a[0];
|
|
676
|
-
if (a.length === 1) return r;
|
|
677
|
-
const t = () => {
|
|
678
|
-
const s = a.map((n) => ({
|
|
679
|
-
useScope: n(),
|
|
680
|
-
scopeName: n.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 Gr = [
|
|
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
|
-
], ba = Gr.reduce((a, r) => {
|
|
711
|
-
const t = et(`Primitive.${r}`), s = k.forwardRef((n, d) => {
|
|
712
|
-
const { asChild: l, ...u } = n, 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 Fr() {
|
|
718
|
-
return yr.useSyncExternalStore(
|
|
719
|
-
$r,
|
|
720
|
-
() => !0,
|
|
721
|
-
() => !1
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
function $r() {
|
|
725
|
-
return () => {
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
var ya = "Avatar", [zr] = Ur(ya), [Hr, bs] = zr(ya), ys = k.forwardRef(
|
|
729
|
-
(a, r) => {
|
|
730
|
-
const { __scopeAvatar: t, ...s } = a, [n, d] = k.useState("idle");
|
|
731
|
-
return /* @__PURE__ */ e(
|
|
732
|
-
Hr,
|
|
733
|
-
{
|
|
734
|
-
scope: t,
|
|
735
|
-
imageLoadingStatus: n,
|
|
736
|
-
onImageLoadingStatusChange: d,
|
|
737
|
-
children: /* @__PURE__ */ e(ba.span, { ...s, ref: r })
|
|
738
|
-
}
|
|
739
|
-
);
|
|
740
|
-
}
|
|
741
|
-
);
|
|
742
|
-
ys.displayName = ya;
|
|
743
|
-
var xs = "AvatarImage", Ss = k.forwardRef(
|
|
744
|
-
(a, r) => {
|
|
745
|
-
const { __scopeAvatar: t, src: s, onLoadingStatusChange: n = () => {
|
|
746
|
-
}, ...d } = a, l = bs(xs, t), u = qr(s, d), g = at((b) => {
|
|
747
|
-
n(b), l.onImageLoadingStatusChange(b);
|
|
748
|
-
});
|
|
749
|
-
return aa(() => {
|
|
750
|
-
u !== "idle" && g(u);
|
|
751
|
-
}, [u, g]), u === "loaded" ? /* @__PURE__ */ e(ba.img, { ...d, ref: r, src: s }) : null;
|
|
752
|
-
}
|
|
753
|
-
);
|
|
754
|
-
Ss.displayName = xs;
|
|
755
|
-
var Ns = "AvatarFallback", ws = k.forwardRef(
|
|
756
|
-
(a, r) => {
|
|
757
|
-
const { __scopeAvatar: t, delayMs: s, ...n } = a, d = bs(Ns, 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(ba.span, { ...n, ref: r }) : null;
|
|
764
|
-
}
|
|
765
|
-
);
|
|
766
|
-
ws.displayName = Ns;
|
|
767
|
-
function Xa(a, r) {
|
|
768
|
-
return a ? r ? (a.src !== r && (a.src = r), a.complete && a.naturalWidth > 0 ? "loaded" : "loading") : "error" : "idle";
|
|
769
|
-
}
|
|
770
|
-
function qr(a, { referrerPolicy: r, crossOrigin: t }) {
|
|
771
|
-
const s = Fr(), n = k.useRef(null), d = s ? (n.current || (n.current = new window.Image()), n.current) : null, [l, u] = k.useState(
|
|
772
|
-
() => Xa(d, a)
|
|
773
|
-
);
|
|
774
|
-
return aa(() => {
|
|
775
|
-
u(Xa(d, a));
|
|
776
|
-
}, [d, a]), aa(() => {
|
|
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 Ds = ys, Cs = Ss, Es = ws;
|
|
788
|
-
const xa = k.forwardRef(({ className: a, ...r }, t) => /* @__PURE__ */ e(
|
|
789
|
-
Ds,
|
|
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
|
-
xa.displayName = Ds.displayName;
|
|
800
|
-
const Vr = k.forwardRef(({ className: a, ...r }, t) => /* @__PURE__ */ e(
|
|
801
|
-
Cs,
|
|
802
|
-
{
|
|
803
|
-
ref: t,
|
|
804
|
-
className: W("aspect-square h-full w-full", a),
|
|
805
|
-
...r
|
|
806
|
-
}
|
|
807
|
-
));
|
|
808
|
-
Vr.displayName = Cs.displayName;
|
|
809
|
-
const Sa = k.forwardRef(({ className: a, ...r }, t) => /* @__PURE__ */ e(
|
|
810
|
-
Es,
|
|
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
|
-
Sa.displayName = Es.displayName;
|
|
821
|
-
function jr({
|
|
822
|
-
open: a,
|
|
823
|
-
onOpenChange: r,
|
|
824
|
-
group: t,
|
|
825
|
-
onUpdate: s
|
|
826
|
-
}) {
|
|
827
|
-
const [n, d] = x("members"), [l, u] = x(""), [g, b] = x([]), [m, p] = x([]), { data: h, isLoading: f, refetch: o } = St(t.id), y = t.type === "TENANT_GROUP" ? "tenant" : "organization", { users: w, isLoading: D } = Nt({
|
|
828
|
-
type: y,
|
|
829
|
-
tenantId: t.tenantId || void 0,
|
|
830
|
-
active: !0,
|
|
831
|
-
limit: 100
|
|
832
|
-
}), N = Pr(), C = Tr(), T = (h == null ? void 0 : h.members) || [], E = q(() => new Set(T.map((v) => v.userId)), [T]), $ = q(() => w.filter((v) => !E.has(v.id)), [w, E]), K = q(() => {
|
|
833
|
-
if (!l) return $;
|
|
834
|
-
const v = l.toLowerCase();
|
|
835
|
-
return $.filter(
|
|
836
|
-
(I) => {
|
|
837
|
-
var G, H;
|
|
838
|
-
return ((G = I.name) == null ? void 0 : G.toLowerCase().includes(v)) || ((H = I.email) == null ? void 0 : H.toLowerCase().includes(v));
|
|
839
|
-
}
|
|
840
|
-
);
|
|
841
|
-
}, [$, l]), L = q(() => {
|
|
842
|
-
if (!l) return T;
|
|
843
|
-
const v = l.toLowerCase();
|
|
844
|
-
return T.filter(
|
|
845
|
-
(I) => {
|
|
846
|
-
var G, H, me, ee;
|
|
847
|
-
return ((H = (G = I.user) == null ? void 0 : G.name) == null ? void 0 : H.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"), o(), 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([]), o(), 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((G) => G !== v) : [...I, v]
|
|
878
|
-
);
|
|
879
|
-
}, Z = (v) => {
|
|
880
|
-
p(
|
|
881
|
-
(I) => I.includes(v) ? I.filter((G) => G !== v) : [...I, v]
|
|
882
|
-
);
|
|
883
|
-
};
|
|
884
|
-
return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(ma, { open: a, onOpenChange: r, children: /* @__PURE__ */ i(ha, { className: "max-w-3xl max-h-[80vh]", "aria-describedby": "group-members-description", children: [
|
|
885
|
-
/* @__PURE__ */ i(pa, { children: [
|
|
886
|
-
/* @__PURE__ */ e(fa, { 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(ss, { value: n, onValueChange: (v) => {
|
|
899
|
-
d(v), u(""), p([]);
|
|
900
|
-
}, className: "mt-4", children: [
|
|
901
|
-
/* @__PURE__ */ i(ts, { 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(ra, { 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(sa, { 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(na, { 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(va, { 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
|
-
Br,
|
|
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(cs, { 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(ra, { 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(sa, { className: "h-[300px]", children: D ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((v) => /* @__PURE__ */ e(na, { 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(ca, { 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
|
-
Kr,
|
|
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(ca, { className: "mr-2 h-4 w-4" }),
|
|
999
|
-
"Add Members"
|
|
1000
|
-
] })
|
|
1001
|
-
}
|
|
1002
|
-
)
|
|
1003
|
-
] })
|
|
1004
|
-
] })
|
|
1005
|
-
] })
|
|
1006
|
-
] }) }) });
|
|
1007
|
-
}
|
|
1008
|
-
function Br({
|
|
1009
|
-
member: a,
|
|
1010
|
-
selected: r,
|
|
1011
|
-
onToggle: t
|
|
1012
|
-
}) {
|
|
1013
|
-
var n, d, l, u;
|
|
1014
|
-
const s = ((d = (n = a.user) == null ? void 0 : n.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(ls, { checked: r }),
|
|
1022
|
-
/* @__PURE__ */ e(xa, { className: "h-8 w-8", children: /* @__PURE__ */ e(Sa, { 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 Kr({
|
|
1032
|
-
user: a,
|
|
1033
|
-
selected: r,
|
|
1034
|
-
onToggle: t
|
|
1035
|
-
}) {
|
|
1036
|
-
var n;
|
|
1037
|
-
const s = ((n = a.name) == null ? void 0 : n.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(ls, { checked: r }),
|
|
1045
|
-
/* @__PURE__ */ e(xa, { className: "h-8 w-8", children: /* @__PURE__ */ e(Sa, { 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 Qr({
|
|
1055
|
-
open: a,
|
|
1056
|
-
onOpenChange: r
|
|
1057
|
-
}) {
|
|
1058
|
-
const [t, s] = x("groups"), [n, d] = x(""), [l, u] = x(null), [g, b] = x(!1), [m, p] = x(null), { tokenProps: h } = j(), { currentUser: f } = ga(), o = Or(), y = (f == null ? void 0 : f.type) === "tenant", w = h == null ? void 0 : h.tenantId, { groups: D, isLoading: N, refetch: C } = wt({
|
|
1059
|
-
type: y ? "TENANT_GROUP" : "all",
|
|
1060
|
-
tenantId: y ? w : void 0,
|
|
1061
|
-
includeMembers: !1
|
|
1062
|
-
}), T = D.filter(
|
|
1063
|
-
(L) => {
|
|
1064
|
-
var Q;
|
|
1065
|
-
return L.name.toLowerCase().includes(n.toLowerCase()) || ((Q = L.description) == null ? void 0 : Q.toLowerCase().includes(n.toLowerCase()));
|
|
1066
|
-
}
|
|
1067
|
-
), E = async () => {
|
|
1068
|
-
if (m)
|
|
1069
|
-
try {
|
|
1070
|
-
await o.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(ma, { open: a, onOpenChange: r, children: /* @__PURE__ */ i(ha, { className: "max-h-[80vh] max-w-3xl rounded-[6px] border-border/60 sm:rounded-[6px]", children: [
|
|
1081
|
-
/* @__PURE__ */ i(pa, { children: [
|
|
1082
|
-
/* @__PURE__ */ e(fa, { className: "text-[15px]", children: "Group management" }),
|
|
1083
|
-
/* @__PURE__ */ e(ns, { className: "text-[13px] leading-5", children: "Manage groups, create new ones, and control membership." })
|
|
1084
|
-
] }),
|
|
1085
|
-
/* @__PURE__ */ i(
|
|
1086
|
-
ss,
|
|
1087
|
-
{
|
|
1088
|
-
value: t,
|
|
1089
|
-
onValueChange: s,
|
|
1090
|
-
className: "mt-2",
|
|
1091
|
-
children: [
|
|
1092
|
-
/* @__PURE__ */ i(ts, { 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(ra, { 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: n,
|
|
1119
|
-
onChange: (L) => d(L.target.value),
|
|
1120
|
-
className: "pl-7"
|
|
1121
|
-
}
|
|
1122
|
-
)
|
|
1123
|
-
] }),
|
|
1124
|
-
/* @__PURE__ */ e(sa, { className: "h-[400px]", children: N ? /* @__PURE__ */ e("div", { className: "space-y-2", children: [1, 2, 3].map((L) => /* @__PURE__ */ e(
|
|
1125
|
-
na,
|
|
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: n ? "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
|
-
Jr,
|
|
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
|
-
_r,
|
|
1146
|
-
{
|
|
1147
|
-
onSuccess: K,
|
|
1148
|
-
tenantId: w,
|
|
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
|
-
ds,
|
|
1167
|
-
{
|
|
1168
|
-
open: !!m,
|
|
1169
|
-
onOpenChange: () => p(null),
|
|
1170
|
-
children: /* @__PURE__ */ i(us, { children: [
|
|
1171
|
-
/* @__PURE__ */ i(ms, { children: [
|
|
1172
|
-
/* @__PURE__ */ e(hs, { children: "Delete group" }),
|
|
1173
|
-
/* @__PURE__ */ i(ps, { 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(fs, { children: [
|
|
1180
|
-
/* @__PURE__ */ e(gs, { children: "Cancel" }),
|
|
1181
|
-
/* @__PURE__ */ e(
|
|
1182
|
-
oa,
|
|
1183
|
-
{
|
|
1184
|
-
onClick: E,
|
|
1185
|
-
disabled: o.isPending,
|
|
1186
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1187
|
-
children: o.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 Jr({
|
|
1200
|
-
group: a,
|
|
1201
|
-
onManageMembers: r,
|
|
1202
|
-
onDelete: t,
|
|
1203
|
-
currentUserId: s
|
|
1204
|
-
}) {
|
|
1205
|
-
const n = 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(va, { className: "h-3 w-3" }),
|
|
1213
|
-
a.memberCount,
|
|
1214
|
-
" ",
|
|
1215
|
-
a.memberCount === 1 ? "member" : "members"
|
|
1216
|
-
] }),
|
|
1217
|
-
/* @__PURE__ */ i("span", { children: [
|
|
1218
|
-
"Created ",
|
|
1219
|
-
nr(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(ca, { className: "h-3.5 w-3.5" })
|
|
1234
|
-
}
|
|
1235
|
-
),
|
|
1236
|
-
n && /* @__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(cs, { 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 n = (l = (d = rs(a, r)) == null ? void 0 : d.controls) == null ? void 0 : l.find(
|
|
1259
|
-
(u) => u.id === t
|
|
1260
|
-
);
|
|
1261
|
-
return (n == null ? void 0 : n.label) || t;
|
|
1262
|
-
}
|
|
1263
|
-
function ce(a, r) {
|
|
1264
|
-
var t;
|
|
1265
|
-
return ((t = rs(a, r)) == null ? void 0 : t.title) || r;
|
|
1266
|
-
}
|
|
1267
|
-
function Wr(a) {
|
|
1268
|
-
const { errors: r, dashboard: t } = a;
|
|
1269
|
-
if (!t)
|
|
1270
|
-
return r;
|
|
1271
|
-
const s = /* @__PURE__ */ new Map();
|
|
1272
|
-
for (const n of r) {
|
|
1273
|
-
const d = n.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 = n.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 = n.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 = n.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 = n.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(n, n);
|
|
1349
|
-
}
|
|
1350
|
-
return Array.from(s.values());
|
|
1351
|
-
}
|
|
1352
|
-
function Ya(a, r) {
|
|
1353
|
-
return {
|
|
1354
|
-
dashboard: ia(a),
|
|
1355
|
-
semanticExecutionPayload: ia(r)
|
|
1356
|
-
};
|
|
1357
|
-
}
|
|
1358
|
-
function hn() {
|
|
1359
|
-
var Ra, Ga, Fa, $a, za, Ha;
|
|
1360
|
-
Yt(), Zt();
|
|
1361
|
-
const {
|
|
1362
|
-
authToken: a,
|
|
1363
|
-
tokenProps: r,
|
|
1364
|
-
id: t
|
|
1365
|
-
} = j(), { isLocalDev: s } = Dt(), { openBrandStudioPreview: n } = Ct(), { permissions: d } = Er(), l = Et(), { isLoading: u } = Lt(), 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), o = S((c) => c.dashboard), y = S((c) => c.selectedSheetId), w = (Ra = o == null ? void 0 : o.sheets) == null ? void 0 : Ra.find(
|
|
1368
|
-
(c) => c.id === y
|
|
1369
|
-
), D = st(w), N = D ? (Ga = w == null ? void 0 : w.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), [G, H] = x(!1), [me, ee] = x(!1), [Ls, he] = x(!1), [pe, fe] = x(null), [Na, ge] = x([]), [wa, ve] = x(!1), Ms = S((c) => c.isDashboardPanelOpen), As = S(
|
|
1372
|
-
(c) => c.actions.setIsDashboardPanelOpen
|
|
1373
|
-
), ks = S((c) => c.filterValues), U = S((c) => c.isVisualEditing);
|
|
1374
|
-
Va((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), Va((c) => c.frame);
|
|
1381
|
-
const ye = ae ? ($a = ae == null ? void 0 : ae.permissions) == null ? void 0 : $a.canEdit : (Fa = be == null ? void 0 : be.permissions) == null ? void 0 : Fa.canEdit, Da = S(
|
|
1382
|
-
(c) => c.showDashboardJSON
|
|
1383
|
-
), Ge = S((c) => c.onSaveFunction), {
|
|
1384
|
-
setIsDashboardEditing: Ca,
|
|
1385
|
-
setShowDashboardJSON: Ea
|
|
1386
|
-
} = S((c) => c.actions), { setInitialDashboard: La, clearSelectedDashboard: Fe } = ke(
|
|
1387
|
-
(c) => c.actions
|
|
1388
|
-
), { resources: xe } = Mt(Qe.DASHBOARD), { data: $e } = At(), Is = ((za = $e == null ? void 0 : $e.preference) == null ? void 0 : za.defaultDashboardId) || null, { mutate: Os, isPending: Ps } = kt(), { currentUser: Ts } = ga(), _s = It(Ts), J = ae || be, Ma = J ? {
|
|
1389
|
-
id: J.id,
|
|
1390
|
-
title: (o == null ? void 0 : o.title) || J.title || "Dashboard"
|
|
1391
|
-
} : null, { handleAddNewFrame: Us } = Ot(), [ze, He] = x(!1), [Rs, se] = x(!1), [qe, Se] = x("close"), te = Pt(Qe.DASHBOARD), [R, Ne] = x(null), Gs = async (c, O) => {
|
|
1392
|
-
if (!(o != null && o.id)) {
|
|
1393
|
-
console.log("No dashboard ID found");
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1396
|
-
console.log("Updating dashboard title:", {
|
|
1397
|
-
dashboardId: o.id,
|
|
1398
|
-
newTitle: c,
|
|
1399
|
-
previousTitle: O
|
|
1400
|
-
}), te.mutate(
|
|
1401
|
-
{
|
|
1402
|
-
resourceId: o.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
|
-
We(() => {
|
|
1416
|
-
if (xe && xe.length > 0) {
|
|
1417
|
-
const c = o == null ? void 0 : o.id;
|
|
1418
|
-
if (c) {
|
|
1419
|
-
const O = xe.find(
|
|
1420
|
-
(z) => z.id === c
|
|
1421
|
-
);
|
|
1422
|
-
O && La(O);
|
|
1423
|
-
}
|
|
1424
|
-
}
|
|
1425
|
-
}, [xe, o == null ? void 0 : o.id, La]);
|
|
1426
|
-
const re = r.orgUserId || r.tenantId, Ve = q(
|
|
1427
|
-
() => Xr({
|
|
1428
|
-
accessToken: a == null ? void 0 : a.accessToken,
|
|
1429
|
-
dashboardId: (o == null ? void 0 : o.id) || t || r.dashboard_id,
|
|
1430
|
-
selectedSheetId: D ? 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
|
-
o == null ? void 0 : o.id,
|
|
1439
|
-
D,
|
|
1440
|
-
N == null ? void 0 : N.orientation,
|
|
1441
|
-
N == null ? void 0 : N.size,
|
|
1442
|
-
y,
|
|
1443
|
-
g,
|
|
1444
|
-
r.dashboard_id
|
|
1445
|
-
]
|
|
1446
|
-
), Aa = C && !U && re && ye, { setDashboard: ka } = S((c) => c.actions), Ia = S(
|
|
1447
|
-
(c) => c.semanticExecutionPayload
|
|
1448
|
-
), Fs = () => {
|
|
1449
|
-
Ca(!0);
|
|
1450
|
-
}, je = () => {
|
|
1451
|
-
Ca(!1), Ea(!1), Ne(null);
|
|
1452
|
-
};
|
|
1453
|
-
We(() => {
|
|
1454
|
-
if (!C) {
|
|
1455
|
-
R && Ne(null);
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1458
|
-
R || !o || u || Ne(
|
|
1459
|
-
Ya(
|
|
1460
|
-
o,
|
|
1461
|
-
Ia
|
|
1462
|
-
)
|
|
1463
|
-
);
|
|
1464
|
-
}, [
|
|
1465
|
-
o,
|
|
1466
|
-
R,
|
|
1467
|
-
C,
|
|
1468
|
-
u,
|
|
1469
|
-
Ia
|
|
1470
|
-
]);
|
|
1471
|
-
const we = (R == null ? void 0 : R.dashboard) ?? null, { isDirty: Oa, isDirtyPending: $s, resetDirty: De } = ir(
|
|
1472
|
-
o,
|
|
1473
|
-
we,
|
|
1474
|
-
300,
|
|
1475
|
-
1e3,
|
|
1476
|
-
Xe
|
|
1477
|
-
), Pa = Xt(() => we ? Xe(o) !== Xe(we) : !1, [o, we]), Ta = Oa || $s, Ce = ze || te.isPending, zs = () => {
|
|
1478
|
-
Pa() ? (Se("close"), se(!0)) : (je(), De());
|
|
1479
|
-
}, Hs = async () => {
|
|
1480
|
-
await Be({
|
|
1481
|
-
closeAfterSave: !0,
|
|
1482
|
-
navigateHomeAfterSave: qe === "home"
|
|
1483
|
-
});
|
|
1484
|
-
}, qs = () => {
|
|
1485
|
-
R && ka(R.dashboard, {
|
|
1486
|
-
semanticExecutionPayload: R.semanticExecutionPayload
|
|
1487
|
-
}), je(), qe === "home" && Fe(), Se("close"), se(!1), De();
|
|
1488
|
-
}, Vs = () => {
|
|
1489
|
-
R && (ka(R.dashboard, {
|
|
1490
|
-
semanticExecutionPayload: R.semanticExecutionPayload
|
|
1491
|
-
}), De());
|
|
1492
|
-
}, js = () => {
|
|
1493
|
-
if (C && Pa()) {
|
|
1494
|
-
Se("home"), se(!0);
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
Fe();
|
|
1498
|
-
};
|
|
1499
|
-
async function Be(c) {
|
|
1500
|
-
const O = S.getState().dashboard;
|
|
1501
|
-
if (!O)
|
|
1502
|
-
return;
|
|
1503
|
-
const z = (c == null ? void 0 : c.closeAfterSave) ?? wa, Ws = (c == null ? void 0 : c.navigateHomeAfterSave) ?? !1;
|
|
1504
|
-
ve(z), z && se(!1);
|
|
1505
|
-
const Xs = ia(O);
|
|
1506
|
-
he(!0), fe(null), ge([]), He(!0);
|
|
1507
|
-
const Ys = {
|
|
1508
|
-
template: O
|
|
1509
|
-
};
|
|
1510
|
-
te.mutate(
|
|
1511
|
-
{
|
|
1512
|
-
resourceId: O.id,
|
|
1513
|
-
data: Ys
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
onSuccess: (_) => {
|
|
1517
|
-
var Le, Me, qa;
|
|
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) || ((qa = _ == null ? void 0 : _.template) == null ? void 0 : qa.id) || null;
|
|
1519
|
-
if (!O.id && B) {
|
|
1520
|
-
const Ke = ct.getState(), Ae = Ke.pendingDashboardDraftMigration;
|
|
1521
|
-
(Ae == null ? void 0 : Ae.scopeKey) === m ? Ke.actions.setPendingDashboardDraftMigrationExpectedDashboardId(
|
|
1522
|
-
B
|
|
1523
|
-
) : Ae && Ke.actions.clearPendingDashboardDraftMigration();
|
|
1524
|
-
}
|
|
1525
|
-
He(!1), M.success("Dashboard saved!"), Ne(
|
|
1526
|
-
Ya(
|
|
1527
|
-
Xs,
|
|
1528
|
-
S.getState().semanticExecutionPayload
|
|
1529
|
-
)
|
|
1530
|
-
), he(!1), ve(!1), z && (je(), De(), Ws && Fe()), Se("close");
|
|
1531
|
-
},
|
|
1532
|
-
onError: (_) => {
|
|
1533
|
-
He(!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
|
-
Wr({
|
|
1541
|
-
errors: Le,
|
|
1542
|
-
dashboard: O || void 0
|
|
1543
|
-
})
|
|
1544
|
-
), M.error("Failed to save dashboard");
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
);
|
|
1548
|
-
}
|
|
1549
|
-
async function Bs() {
|
|
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: ks
|
|
1560
|
-
};
|
|
1561
|
-
await da(
|
|
1562
|
-
r.apiServiceUrl,
|
|
1563
|
-
z,
|
|
1564
|
-
a == null ? void 0 : a.accessToken
|
|
1565
|
-
), M.success("Lens saved"), Ge == null || Ge(c), $(!1);
|
|
1566
|
-
}
|
|
1567
|
-
const _a = (f == null ? void 0 : f.name) || o.title, ne = !!(o != null && o.id);
|
|
1568
|
-
te.isPending && console.log("Title during update:", {
|
|
1569
|
-
title: _a,
|
|
1570
|
-
dashboardStateTitle: o.title,
|
|
1571
|
-
dashboardId: o == null ? void 0 : o.id,
|
|
1572
|
-
currentLensName: f == null ? void 0 : f.name
|
|
1573
|
-
});
|
|
1574
|
-
const Ua = r.orgUserId || r.tenantId && r.endUserId && r.endUserEmail, Ks = !!Ua && !!(a != null && a.accessToken) && !!(r != null && r.apiServiceUrl);
|
|
1575
|
-
We(() => {
|
|
1576
|
-
!ne && Y && Z(!1);
|
|
1577
|
-
}, [ne, Y]);
|
|
1578
|
-
const Qs = l, oe = (o == null ? void 0 : o.id) || null, Ee = !!oe && Is === oe, Js = () => {
|
|
1579
|
-
oe && Os({
|
|
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
|
-
Ua && /* @__PURE__ */ i(P, { children: [
|
|
1591
|
-
/* @__PURE__ */ e(
|
|
1592
|
-
Je,
|
|
1593
|
-
{
|
|
1594
|
-
"aria-label": "Manage Dashboards",
|
|
1595
|
-
tooltip: "Manage Dashboards",
|
|
1596
|
-
onClick: () => {
|
|
1597
|
-
As(!Ms);
|
|
1598
|
-
},
|
|
1599
|
-
className: "h-7 w-7 px-0",
|
|
1600
|
-
buttonProps: { size: "xs" },
|
|
1601
|
-
children: /* @__PURE__ */ e(ur, { className: "h-3.5 w-3.5" })
|
|
1602
|
-
}
|
|
1603
|
-
),
|
|
1604
|
-
Qs && !U && /* @__PURE__ */ e(
|
|
1605
|
-
Je,
|
|
1606
|
-
{
|
|
1607
|
-
"aria-label": "Dashboard Hub",
|
|
1608
|
-
tooltip: "Dashboard Hub",
|
|
1609
|
-
onClick: js,
|
|
1610
|
-
className: "h-7 w-7 px-0",
|
|
1611
|
-
buttonProps: { size: "xs" },
|
|
1612
|
-
children: /* @__PURE__ */ e(os, { 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
|
-
Tt,
|
|
1627
|
-
{
|
|
1628
|
-
value: _a || "Untitled Dashboard",
|
|
1629
|
-
onSave: (c) => {
|
|
1630
|
-
console.log("EditableText onSave called:", {
|
|
1631
|
-
newTitle: c,
|
|
1632
|
-
canEditDashboard: ye,
|
|
1633
|
-
dashboardId: o == null ? void 0 : o.id
|
|
1634
|
-
});
|
|
1635
|
-
const O = (o == null ? void 0 : o.title) || "";
|
|
1636
|
-
T(c), Gs(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
|
-
Ks && oe && /* @__PURE__ */ e(tt, { children: /* @__PURE__ */ i(rt, { children: [
|
|
1646
|
-
/* @__PURE__ */ e(nt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1647
|
-
A,
|
|
1648
|
-
{
|
|
1649
|
-
variant: "ghost",
|
|
1650
|
-
size: "xs",
|
|
1651
|
-
onClick: Js,
|
|
1652
|
-
disabled: Ps || !(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
|
-
_t,
|
|
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(ot, { 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(er, {}),
|
|
1673
|
-
/* @__PURE__ */ e(ar, {})
|
|
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(Ut, { className: "h-3.5 w-3.5" }),
|
|
1683
|
-
"Share"
|
|
1684
|
-
]
|
|
1685
|
-
}
|
|
1686
|
-
),
|
|
1687
|
-
!U && C && d.canUseFilters && l && /* @__PURE__ */ e(sr, {}),
|
|
1688
|
-
C && !U && re && f && s && l && /* @__PURE__ */ i(
|
|
1689
|
-
A,
|
|
1690
|
-
{
|
|
1691
|
-
variant: "secondary",
|
|
1692
|
-
size: "xs",
|
|
1693
|
-
disabled: E,
|
|
1694
|
-
onClick: Bs,
|
|
1695
|
-
children: [
|
|
1696
|
-
/* @__PURE__ */ e(Ka, { className: "h-3.5 w-3.5" }),
|
|
1697
|
-
"Save Lens"
|
|
1698
|
-
]
|
|
1699
|
-
}
|
|
1700
|
-
),
|
|
1701
|
-
C && !U && l && !D && /* @__PURE__ */ i(
|
|
1702
|
-
A,
|
|
1703
|
-
{
|
|
1704
|
-
variant: "outline",
|
|
1705
|
-
size: "xs",
|
|
1706
|
-
disabled: !C,
|
|
1707
|
-
onClick: () => Us(),
|
|
1708
|
-
children: [
|
|
1709
|
-
/* @__PURE__ */ e(ta, { className: "h-3.5 w-3.5" }),
|
|
1710
|
-
"Visual"
|
|
1711
|
-
]
|
|
1712
|
-
}
|
|
1713
|
-
),
|
|
1714
|
-
!U && !C && ye && l && /* @__PURE__ */ i(A, { size: "xs", onClick: Fs, children: [
|
|
1715
|
-
/* @__PURE__ */ e(Rt, { className: "h-3.5 w-3.5" }),
|
|
1716
|
-
"Edit"
|
|
1717
|
-
] }),
|
|
1718
|
-
Aa && l && Oa && /* @__PURE__ */ i(
|
|
1719
|
-
A,
|
|
1720
|
-
{
|
|
1721
|
-
variant: "outline",
|
|
1722
|
-
size: "xs",
|
|
1723
|
-
onClick: Vs,
|
|
1724
|
-
disabled: Ce,
|
|
1725
|
-
children: [
|
|
1726
|
-
/* @__PURE__ */ e(gr, { className: "h-3.5 w-3.5" }),
|
|
1727
|
-
"Undo"
|
|
1728
|
-
]
|
|
1729
|
-
}
|
|
1730
|
-
),
|
|
1731
|
-
Aa && l && /* @__PURE__ */ i(
|
|
1732
|
-
A,
|
|
1733
|
-
{
|
|
1734
|
-
size: "xs",
|
|
1735
|
-
className: W(!Ta && "opacity-60"),
|
|
1736
|
-
disabled: Ce || !Ta,
|
|
1737
|
-
onClick: () => Be(),
|
|
1738
|
-
children: [
|
|
1739
|
-
Ce ? /* @__PURE__ */ e(X, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Ka, { 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: zs, children: [
|
|
1745
|
-
/* @__PURE__ */ e(is, { className: "h-3.5 w-3.5" }),
|
|
1746
|
-
"Close"
|
|
1747
|
-
] }),
|
|
1748
|
-
!U && l && /* @__PURE__ */ e("div", { className: "ml-2", children: /* @__PURE__ */ e(tr, {}) }),
|
|
1749
|
-
!U && s && /* @__PURE__ */ e(xr, {}),
|
|
1750
|
-
!U && l && /* @__PURE__ */ i(Gt, { children: [
|
|
1751
|
-
/* @__PURE__ */ e(Ft, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1752
|
-
Je,
|
|
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($t, { className: "h-3.5 w-3.5" })
|
|
1762
|
-
}
|
|
1763
|
-
) }),
|
|
1764
|
-
/* @__PURE__ */ i(
|
|
1765
|
-
zt,
|
|
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
|
-
F,
|
|
1773
|
-
{
|
|
1774
|
-
disabled: b,
|
|
1775
|
-
onSelect: () => ee(!0),
|
|
1776
|
-
children: [
|
|
1777
|
-
/* @__PURE__ */ e(Ht, { className: "h-3.5 w-3.5" }),
|
|
1778
|
-
"Export"
|
|
1779
|
-
]
|
|
1780
|
-
}
|
|
1781
|
-
),
|
|
1782
|
-
/* @__PURE__ */ i(
|
|
1783
|
-
F,
|
|
1784
|
-
{
|
|
1785
|
-
disabled: !ne,
|
|
1786
|
-
onSelect: () => {
|
|
1787
|
-
ne && Z(!0);
|
|
1788
|
-
},
|
|
1789
|
-
children: [
|
|
1790
|
-
/* @__PURE__ */ e(qt, { className: "h-3.5 w-3.5" }),
|
|
1791
|
-
"Schedule"
|
|
1792
|
-
]
|
|
1793
|
-
}
|
|
1794
|
-
),
|
|
1795
|
-
/* @__PURE__ */ e(Oe, {}),
|
|
1796
|
-
_s && /* @__PURE__ */ i(P, { children: [
|
|
1797
|
-
/* @__PURE__ */ e(le, { children: "Access" }),
|
|
1798
|
-
/* @__PURE__ */ i(
|
|
1799
|
-
F,
|
|
1800
|
-
{
|
|
1801
|
-
onClick: () => ue(!0),
|
|
1802
|
-
children: [
|
|
1803
|
-
/* @__PURE__ */ e(va, { 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(F, { onClick: () => I(!0), children: [
|
|
1812
|
-
/* @__PURE__ */ e(Vt, { className: "h-3.5 w-3.5" }),
|
|
1813
|
-
"Calendar Preferences"
|
|
1814
|
-
] }),
|
|
1815
|
-
s && l && /* @__PURE__ */ i(P, { children: [
|
|
1816
|
-
/* @__PURE__ */ e(Oe, {}),
|
|
1817
|
-
/* @__PURE__ */ e(le, { children: "Developer" }),
|
|
1818
|
-
/* @__PURE__ */ i(
|
|
1819
|
-
F,
|
|
1820
|
-
{
|
|
1821
|
-
onSelect: () => {
|
|
1822
|
-
var c;
|
|
1823
|
-
a != null && a.accessToken && ((c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText ? navigator.clipboard.writeText(a.accessToken).then(
|
|
1824
|
-
() => M.success("Token copied to clipboard")
|
|
1825
|
-
).catch(() => M.error("Unable to copy token")) : M.error("Clipboard not available"));
|
|
1826
|
-
},
|
|
1827
|
-
children: [
|
|
1828
|
-
/* @__PURE__ */ e(Ba, { className: "h-3.5 w-3.5" }),
|
|
1829
|
-
"Copy token"
|
|
1830
|
-
]
|
|
1831
|
-
}
|
|
1832
|
-
),
|
|
1833
|
-
D && /* @__PURE__ */ i(
|
|
1834
|
-
F,
|
|
1835
|
-
{
|
|
1836
|
-
disabled: !Ve,
|
|
1837
|
-
onSelect: () => {
|
|
1838
|
-
var c;
|
|
1839
|
-
if (!Ve) {
|
|
1840
|
-
M.error(
|
|
1841
|
-
"Open a document sheet with a token to copy the local PDF URL"
|
|
1842
|
-
);
|
|
1843
|
-
return;
|
|
1844
|
-
}
|
|
1845
|
-
(c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText ? navigator.clipboard.writeText(Ve).then(
|
|
1846
|
-
() => M.success(
|
|
1847
|
-
"Local document PDF URL copied to clipboard"
|
|
1848
|
-
)
|
|
1849
|
-
).catch(
|
|
1850
|
-
() => M.error(
|
|
1851
|
-
"Unable to copy local document PDF URL"
|
|
1852
|
-
)
|
|
1853
|
-
) : M.error("Clipboard not available");
|
|
1854
|
-
},
|
|
1855
|
-
children: [
|
|
1856
|
-
/* @__PURE__ */ e(Ba, { className: "h-3.5 w-3.5" }),
|
|
1857
|
-
"Copy local document PDF URL"
|
|
1858
|
-
]
|
|
1859
|
-
}
|
|
1860
|
-
),
|
|
1861
|
-
/* @__PURE__ */ i(
|
|
1862
|
-
F,
|
|
1863
|
-
{
|
|
1864
|
-
onSelect: () => it(r.apiServiceUrl),
|
|
1865
|
-
children: [
|
|
1866
|
-
/* @__PURE__ */ e(pr, { className: "h-3.5 w-3.5" }),
|
|
1867
|
-
"Invalidate token"
|
|
1868
|
-
]
|
|
1869
|
-
}
|
|
1870
|
-
),
|
|
1871
|
-
/* @__PURE__ */ i(F, { onSelect: n, children: [
|
|
1872
|
-
/* @__PURE__ */ e(cr, { className: "h-3.5 w-3.5" }),
|
|
1873
|
-
"Brand Studio"
|
|
1874
|
-
] }),
|
|
1875
|
-
C && /* @__PURE__ */ i(
|
|
1876
|
-
F,
|
|
1877
|
-
{
|
|
1878
|
-
onSelect: () => Ea(!Da),
|
|
1879
|
-
children: [
|
|
1880
|
-
/* @__PURE__ */ e(lr, { className: "h-3.5 w-3.5" }),
|
|
1881
|
-
Da ? "Hide dashboard JSON" : "Show dashboard JSON"
|
|
1882
|
-
]
|
|
1883
|
-
}
|
|
1884
|
-
),
|
|
1885
|
-
re && C && /* @__PURE__ */ i(F, { onSelect: () => H(!0), children: [
|
|
1886
|
-
/* @__PURE__ */ e(ta, { className: "h-3.5 w-3.5" }),
|
|
1887
|
-
"Add lens"
|
|
1888
|
-
] }),
|
|
1889
|
-
re && /* @__PURE__ */ i(jt, { children: [
|
|
1890
|
-
/* @__PURE__ */ i(Bt, { children: [
|
|
1891
|
-
/* @__PURE__ */ e(dr, { className: "h-3.5 w-3.5" }),
|
|
1892
|
-
"Lenses"
|
|
1893
|
-
] }),
|
|
1894
|
-
/* @__PURE__ */ e(Kt, { className: "w-60", children: /* @__PURE__ */ e(Cr, {}) })
|
|
1895
|
-
] })
|
|
1896
|
-
] })
|
|
1897
|
-
]
|
|
1898
|
-
}
|
|
1899
|
-
)
|
|
1900
|
-
] }),
|
|
1901
|
-
K && Ma && /* @__PURE__ */ e(
|
|
1902
|
-
Qt,
|
|
1903
|
-
{
|
|
1904
|
-
resource: Ma,
|
|
1905
|
-
resourceType: Qe.DASHBOARD,
|
|
1906
|
-
onClose: () => L(!1)
|
|
1907
|
-
}
|
|
1908
|
-
),
|
|
1909
|
-
/* @__PURE__ */ e(
|
|
1910
|
-
Qr,
|
|
1911
|
-
{
|
|
1912
|
-
open: Q,
|
|
1913
|
-
onOpenChange: ue
|
|
1914
|
-
}
|
|
1915
|
-
),
|
|
1916
|
-
ne && (o == null ? void 0 : o.id) && /* @__PURE__ */ e(
|
|
1917
|
-
Jt,
|
|
1918
|
-
{
|
|
1919
|
-
open: Y,
|
|
1920
|
-
onOpenChange: Z,
|
|
1921
|
-
dashboardId: o.id,
|
|
1922
|
-
dashboardName: o == null ? void 0 : o.title
|
|
1923
|
-
}
|
|
1924
|
-
),
|
|
1925
|
-
/* @__PURE__ */ e(
|
|
1926
|
-
or,
|
|
1927
|
-
{
|
|
1928
|
-
open: v,
|
|
1929
|
-
onOpenChange: I
|
|
1930
|
-
}
|
|
1931
|
-
),
|
|
1932
|
-
s && re && l && /* @__PURE__ */ e(Dr, { open: G, onOpenChange: H }),
|
|
1933
|
-
l && /* @__PURE__ */ e(
|
|
1934
|
-
Wt,
|
|
1935
|
-
{
|
|
1936
|
-
open: me,
|
|
1937
|
-
onOpenChange: ee
|
|
1938
|
-
}
|
|
1939
|
-
),
|
|
1940
|
-
/* @__PURE__ */ e(
|
|
1941
|
-
ds,
|
|
1942
|
-
{
|
|
1943
|
-
open: Ls,
|
|
1944
|
-
onOpenChange: (c) => {
|
|
1945
|
-
!c && ze && !pe || (he(c), c || (fe(null), ge([]), ve(!1)));
|
|
1946
|
-
},
|
|
1947
|
-
children: /* @__PURE__ */ i(us, { className: "max-w-sm", children: [
|
|
1948
|
-
/* @__PURE__ */ i(ms, { children: [
|
|
1949
|
-
/* @__PURE__ */ e(hs, { children: pe ? "Save failed" : "Saving dashboard" }),
|
|
1950
|
-
/* @__PURE__ */ e(ps, { className: "pt-2", children: pe ? "We could not save the dashboard. Please try again." : "Please wait while we save your changes." }),
|
|
1951
|
-
Na.length > 0 && /* @__PURE__ */ i("div", { className: "space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left", children: [
|
|
1952
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-destructive", children: "What needs attention" }),
|
|
1953
|
-
/* @__PURE__ */ e("ul", { className: "list-disc space-y-1 pl-4 text-xs text-muted-foreground", children: Na.slice(0, 5).map((c) => /* @__PURE__ */ e("li", { children: c }, c)) })
|
|
1954
|
-
] })
|
|
1955
|
-
] }),
|
|
1956
|
-
/* @__PURE__ */ e(fs, { className: "flex-col gap-2 sm:flex-row sm:justify-end", children: pe ? /* @__PURE__ */ i(P, { children: [
|
|
1957
|
-
/* @__PURE__ */ e(
|
|
1958
|
-
gs,
|
|
1959
|
-
{
|
|
1960
|
-
onClick: () => {
|
|
1961
|
-
he(!1), fe(null), ge([]), ve(!1);
|
|
1962
|
-
},
|
|
1963
|
-
className: "m-0",
|
|
1964
|
-
children: "Close"
|
|
1965
|
-
}
|
|
1966
|
-
),
|
|
1967
|
-
/* @__PURE__ */ e(
|
|
1968
|
-
oa,
|
|
1969
|
-
{
|
|
1970
|
-
onClick: () => Be({
|
|
1971
|
-
closeAfterSave: wa,
|
|
1972
|
-
navigateHomeAfterSave: qe === "home"
|
|
1973
|
-
}),
|
|
1974
|
-
className: "m-0",
|
|
1975
|
-
children: "Retry"
|
|
1976
|
-
}
|
|
1977
|
-
)
|
|
1978
|
-
] }) : /* @__PURE__ */ i(oa, { disabled: !0, className: "m-0 cursor-default", children: [
|
|
1979
|
-
/* @__PURE__ */ e(X, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1980
|
-
"Saving..."
|
|
1981
|
-
] }) })
|
|
1982
|
-
] })
|
|
1983
|
-
}
|
|
1984
|
-
),
|
|
1985
|
-
/* @__PURE__ */ e(
|
|
1986
|
-
rr,
|
|
1987
|
-
{
|
|
1988
|
-
open: Rs,
|
|
1989
|
-
onOpenChange: (c) => {
|
|
1990
|
-
se(c);
|
|
1991
|
-
},
|
|
1992
|
-
onSave: Hs,
|
|
1993
|
-
onDiscard: qs,
|
|
1994
|
-
isSaving: ze,
|
|
1995
|
-
saveLabel: "Save",
|
|
1996
|
-
discardLabel: "Discard"
|
|
1997
|
-
}
|
|
1998
|
-
)
|
|
1999
|
-
] })
|
|
2000
|
-
]
|
|
2001
|
-
}
|
|
2002
|
-
);
|
|
2003
|
-
}
|
|
2004
|
-
function Xr({
|
|
2005
|
-
accessToken: a,
|
|
2006
|
-
dashboardId: r,
|
|
2007
|
-
selectedSheetId: t,
|
|
2008
|
-
pageSize: s,
|
|
2009
|
-
orientation: n,
|
|
2010
|
-
theme: d
|
|
2011
|
-
}) {
|
|
2012
|
-
if (!a || !t)
|
|
2013
|
-
return null;
|
|
2014
|
-
const l = new URL("http://localhost:5173/print-document");
|
|
2015
|
-
l.searchParams.set("token", a), r && l.searchParams.set("dashboardId", r), l.searchParams.set("selectedSheetId", t), d && l.searchParams.set("theme", d);
|
|
2016
|
-
const u = new URL("http://127.0.0.1:3002/");
|
|
2017
|
-
return u.searchParams.set("pdfMode", "document"), u.searchParams.set("pageSize", s || "letter"), u.searchParams.set("orientation", n || "portrait"), u.searchParams.set("url", l.toString()), u.toString();
|
|
2018
|
-
}
|
|
2019
|
-
export {
|
|
2020
|
-
hn as default
|
|
2021
|
-
};
|