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