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