react-semaphor 0.1.112 → 0.1.114
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/chunks/{dashboard-controls-DkWaHy_5.js → dashboard-controls-BdvApPn1.js} +1 -1
- package/dist/chunks/{dashboard-controls-VimgiX8G.js → dashboard-controls-Dx3SP8_O.js} +3 -3
- package/dist/chunks/{dashboard-json-DawgqwNk.js → dashboard-json-BBUvHSx-.js} +1 -1
- package/dist/chunks/{dashboard-json-DNTtZ5pv.js → dashboard-json-CLmj5Xgn.js} +1 -1
- package/dist/chunks/edit-dashboard-visual-DYXisS8S.js +170 -0
- package/dist/chunks/{edit-dashboard-visual-BG7-vrl3.js → edit-dashboard-visual-F01R1pb1.js} +5061 -4662
- package/dist/chunks/{editor-action-buttons-B44i9J2T.js → editor-action-buttons-CCki6g0i.js} +47 -64
- package/dist/chunks/{editor-action-buttons-Bnm--1Q3.js → editor-action-buttons-D-aEUYpS.js} +2 -7
- package/dist/chunks/{index-B4KWd6kb.js → index-BB_Q9BeP.js} +18021 -16999
- package/dist/chunks/{index-BSu9QpLt.js → index-C2IITrDh.js} +212 -212
- package/dist/chunks/{resource-management-panel-CYYD4npf.js → resource-management-panel-BWpWiCnv.js} +1 -1
- package/dist/chunks/{resource-management-panel-BK6mk6Yh.js → resource-management-panel-C6G5vwpR.js} +49 -49
- package/dist/chunks/{schedule-dashboard-DY5u0lrr.js → schedule-dashboard-Bcu7Wcl2.js} +3 -3
- package/dist/chunks/{schedule-dashboard-BfRq8Eyv.js → schedule-dashboard-CNmepTOh.js} +1 -1
- package/dist/chunks/{use-visual-utils-D6mJYimZ.js → use-visual-utils-CQb_-z3Z.js} +54 -54
- package/dist/chunks/{use-visual-utils-BHAJGn9v.js → use-visual-utils-VFO0nbRa.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +22 -22
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/dashboard.d.ts +50 -1
- package/dist/types/main.d.ts +51 -2
- package/dist/types/surfboard.d.ts +50 -1
- package/dist/types/types.d.ts +50 -1
- package/package.json +1 -1
- package/dist/chunks/edit-dashboard-visual-D6fYDuaG.js +0 -170
package/dist/chunks/{resource-management-panel-CYYD4npf.js → resource-management-panel-BWpWiCnv.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-C2IITrDh.js"),m=require("react"),ae=require("./use-visual-utils-VFO0nbRa.js"),le=require("./use-click-outside-B9T3lmcw.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/chunks/{resource-management-panel-BK6mk6Yh.js → resource-management-panel-C6G5vwpR.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t, Fragment as ve } from "react/jsx-runtime";
|
|
2
|
-
import { b as Ce, aM as pe, u as de,
|
|
2
|
+
import { b as Ce, aM as pe, u as de, f as Ge, ak as $, aN as Ke, aO as We, aP as ye, c as q, aQ as Se, aR as ce, B as j, aS as xe, aC as Ye, aD as qe, aT as Je, aF as Qe, aG as G, aU as ue, L as k, aV as Xe, aW as be, aX as fe, aY as Ze, aZ as $e, I as ke, a_ as Ve, a$ as ee, b0 as Le, b1 as et, J as Ee, R as Te, b2 as Oe, b3 as Ae, b4 as Pe, b5 as Ue, b6 as Re, b7 as Ie, b8 as Me, b9 as je, ba as Fe, bb as tt, bc as st, bd as at, aA as Z, aj as nt, be as it, bf as ze, bg as rt, ao as ot, ap as lt, aq as dt, ar as ct, as as ut, at as we, au as he, ax as ht, bh as mt, bi as pt, bj as ft, bk as gt, bl as Dt, bm as Nt, bn as xt, bo as bt } from "./index-BB_Q9BeP.js";
|
|
3
3
|
import wt, { useState as D, useEffect as me } from "react";
|
|
4
|
-
import { a as Be } from "./use-visual-utils-
|
|
4
|
+
import { a as Be } from "./use-visual-utils-CQb_-z3Z.js";
|
|
5
5
|
import { u as vt } from "./use-click-outside-CMeO_QFI.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -59,11 +59,11 @@ function Vt({
|
|
|
59
59
|
formatDate: v
|
|
60
60
|
}) {
|
|
61
61
|
var U, S, T, M;
|
|
62
|
-
const { selectVisual: h } =
|
|
62
|
+
const { selectVisual: h } = $(), o = Ke(s.id), d = St(s.id), { isConsoleMode: P } = We(), L = wt.useRef(null), [w, C] = D(!1), [E, y] = D(!1);
|
|
63
63
|
me(() => {
|
|
64
|
-
p ? (C(!0), y(!0)) :
|
|
65
|
-
}, [p,
|
|
66
|
-
d &&
|
|
64
|
+
p ? (C(!0), y(!0)) : E && (C(!1), y(!1));
|
|
65
|
+
}, [p, E]), me(() => {
|
|
66
|
+
d && L.current && L.current.scrollIntoView({
|
|
67
67
|
behavior: "smooth",
|
|
68
68
|
block: "center"
|
|
69
69
|
});
|
|
@@ -74,7 +74,7 @@ function Vt({
|
|
|
74
74
|
return /* @__PURE__ */ e(
|
|
75
75
|
ye,
|
|
76
76
|
{
|
|
77
|
-
ref:
|
|
77
|
+
ref: L,
|
|
78
78
|
className: q(
|
|
79
79
|
"group cursor-pointer border border-border/50 p-2 shadow-none transition-colors hover:bg-muted/50",
|
|
80
80
|
d ? "border-purple-500/50 bg-purple-500/10" : o && "border-primary/50 bg-muted/30"
|
|
@@ -140,8 +140,8 @@ function Vt({
|
|
|
140
140
|
open: w,
|
|
141
141
|
onOpenChange: C,
|
|
142
142
|
children: [
|
|
143
|
-
/* @__PURE__ */ e(qe, { asChild: !0, children: /* @__PURE__ */ e(j, { size: "sm", variant: "ghost", className: "h-6 w-6 p-0", children: /* @__PURE__ */ e(
|
|
144
|
-
/* @__PURE__ */ t(
|
|
143
|
+
/* @__PURE__ */ e(qe, { asChild: !0, children: /* @__PURE__ */ e(j, { size: "sm", variant: "ghost", className: "h-6 w-6 p-0", children: /* @__PURE__ */ e(Je, { className: "h-3 w-3" }) }) }),
|
|
144
|
+
/* @__PURE__ */ t(Qe, { align: "end", className: "z-[51] w-40", children: [
|
|
145
145
|
/* @__PURE__ */ t(
|
|
146
146
|
G,
|
|
147
147
|
{
|
|
@@ -174,7 +174,7 @@ function Vt({
|
|
|
174
174
|
},
|
|
175
175
|
disabled: p,
|
|
176
176
|
children: [
|
|
177
|
-
p ? /* @__PURE__ */ e(k, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(
|
|
177
|
+
p ? /* @__PURE__ */ e(k, { className: "mr-2 h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Xe, { className: "mr-2 h-3 w-3" }),
|
|
178
178
|
p ? "Duplicating..." : "Duplicate"
|
|
179
179
|
]
|
|
180
180
|
}
|
|
@@ -223,11 +223,11 @@ function Vt({
|
|
|
223
223
|
/* @__PURE__ */ e(be, {}),
|
|
224
224
|
/* @__PURE__ */ t("div", { className: "space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400", children: [
|
|
225
225
|
(((S = s.ownership.createdBy) == null ? void 0 : S.type) === "tenant" || ((T = s.ownership.createdBy) == null ? void 0 : T.type) === "organization" && P) && /* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
|
|
226
|
-
/* @__PURE__ */ e(
|
|
226
|
+
/* @__PURE__ */ e(Ze, { className: "h-3 w-3" }),
|
|
227
227
|
/* @__PURE__ */ e("span", { children: ((M = s.ownership.createdBy) == null ? void 0 : M.name) || "Unknown" })
|
|
228
228
|
] }),
|
|
229
229
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: [
|
|
230
|
-
/* @__PURE__ */ e(
|
|
230
|
+
/* @__PURE__ */ e($e, { className: "h-3 w-3" }),
|
|
231
231
|
/* @__PURE__ */ e("span", { children: v(s.lastModified) })
|
|
232
232
|
] })
|
|
233
233
|
] })
|
|
@@ -263,14 +263,14 @@ function Vt({
|
|
|
263
263
|
s.id
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function Lt({ searchQuery: s }) {
|
|
267
267
|
const [g, p] = D(!1), [l, i] = D(
|
|
268
268
|
null
|
|
269
269
|
), [f, x] = D(!1), [m, b] = D(null), [v, h] = D(null), [o, d] = D(
|
|
270
270
|
null
|
|
271
|
-
), { selectVisual: P } =
|
|
271
|
+
), { selectVisual: P } = $(), { handleEditLibraryVisual: L, handleAddLibraryVisual: w } = Be(), {
|
|
272
272
|
resources: C,
|
|
273
|
-
isLoading:
|
|
273
|
+
isLoading: E,
|
|
274
274
|
isError: y,
|
|
275
275
|
updateResource: O,
|
|
276
276
|
deleteResource: F,
|
|
@@ -297,16 +297,16 @@ function Et({ searchQuery: s }) {
|
|
|
297
297
|
startUpdating: K,
|
|
298
298
|
stopUpdating: _,
|
|
299
299
|
isUpdating: A
|
|
300
|
-
} =
|
|
301
|
-
var
|
|
300
|
+
} = Le(), N = (n, V, r) => {
|
|
301
|
+
var X;
|
|
302
302
|
const W = Object.fromEntries(
|
|
303
303
|
Object.entries(V).filter(([, I]) => I !== void 0)
|
|
304
304
|
);
|
|
305
305
|
if (Object.keys(W).length === 0) {
|
|
306
|
-
(
|
|
306
|
+
(X = r == null ? void 0 : r.onSuccess) == null || X.call(r);
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
|
-
const
|
|
309
|
+
const Q = Object.keys(W), Y = Q.length === 1 ? Q[0] : void 0;
|
|
310
310
|
K(n, Y), O(
|
|
311
311
|
{
|
|
312
312
|
resourceId: n,
|
|
@@ -328,8 +328,8 @@ function Et({ searchQuery: s }) {
|
|
|
328
328
|
onSettled: () => h(null)
|
|
329
329
|
});
|
|
330
330
|
}, te = (n) => {
|
|
331
|
-
|
|
332
|
-
},
|
|
331
|
+
L(n);
|
|
332
|
+
}, J = (n) => {
|
|
333
333
|
w(n);
|
|
334
334
|
}, se = (n) => {
|
|
335
335
|
const V = C.find((r) => r.id === n);
|
|
@@ -358,7 +358,7 @@ function Et({ searchQuery: s }) {
|
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
360
|
};
|
|
361
|
-
return
|
|
361
|
+
return E ? /* @__PURE__ */ e(He, {}) : y ? /* @__PURE__ */ e(pe, { className: "w-full flex-1 pr-2", children: /* @__PURE__ */ t("div", { className: "py-8 text-center text-muted-foreground", children: [
|
|
362
362
|
/* @__PURE__ */ e("p", { className: "text-sm text-destructive", children: "Failed to load visuals" }),
|
|
363
363
|
/* @__PURE__ */ e(
|
|
364
364
|
j,
|
|
@@ -379,7 +379,7 @@ function Et({ searchQuery: s }) {
|
|
|
379
379
|
Vt,
|
|
380
380
|
{
|
|
381
381
|
visual: n,
|
|
382
|
-
onAddVisual:
|
|
382
|
+
onAddVisual: J,
|
|
383
383
|
onOpenVisual: te,
|
|
384
384
|
onEditDetails: ne,
|
|
385
385
|
onDeleteClick: c,
|
|
@@ -393,7 +393,7 @@ function Et({ searchQuery: s }) {
|
|
|
393
393
|
n.id
|
|
394
394
|
)) }),
|
|
395
395
|
g && l && /* @__PURE__ */ e(
|
|
396
|
-
|
|
396
|
+
Ee,
|
|
397
397
|
{
|
|
398
398
|
resource: l,
|
|
399
399
|
resourceType: Te.VISUAL,
|
|
@@ -452,7 +452,7 @@ function Et({ searchQuery: s }) {
|
|
|
452
452
|
)
|
|
453
453
|
] });
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function Et({
|
|
456
456
|
dashboard: s,
|
|
457
457
|
isDeleting: g,
|
|
458
458
|
isDuplicating: p,
|
|
@@ -465,7 +465,7 @@ function Lt({
|
|
|
465
465
|
onDashboardItemClick: v
|
|
466
466
|
}) {
|
|
467
467
|
var y, O;
|
|
468
|
-
const { selectDashboard: h } =
|
|
468
|
+
const { selectDashboard: h } = $(), o = tt(s.id), { userContext: d, isLoading: P } = ee(), L = ((y = d == null ? void 0 : d.permissions) == null ? void 0 : y.canEdit) ?? !1, w = P || !L, C = () => /* @__PURE__ */ e(at, { className: "h-4 w-4" }), E = () => {
|
|
469
469
|
h(s), l(s.id), v == null || v(s.id);
|
|
470
470
|
};
|
|
471
471
|
return /* @__PURE__ */ e(
|
|
@@ -475,7 +475,7 @@ function Lt({
|
|
|
475
475
|
"group cursor-pointer border border-border/50 p-2 shadow-none transition-colors hover:bg-muted/50",
|
|
476
476
|
o && "border-primary/50 bg-muted/30"
|
|
477
477
|
),
|
|
478
|
-
onClick:
|
|
478
|
+
onClick: E,
|
|
479
479
|
children: /* @__PURE__ */ t("div", { className: "flex items-start gap-3", children: [
|
|
480
480
|
/* @__PURE__ */ e("div", { className: "mt-0.5 rounded bg-muted p-1.5", children: C() }),
|
|
481
481
|
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1 flex flex-col", children: [
|
|
@@ -533,13 +533,13 @@ function Ot(s) {
|
|
|
533
533
|
var ge;
|
|
534
534
|
const { searchQuery: g, onLoadDashboard: p, onEditDashboard: l, onDashboardItemClick: i } = s, [f, x] = D(!1), [m, b] = D(
|
|
535
535
|
null
|
|
536
|
-
), [v, h] = D(!1), [o, d] = D(null), [P,
|
|
536
|
+
), [v, h] = D(!1), [o, d] = D(null), [P, L] = D(null), [w, C] = D(null), E = Z(
|
|
537
537
|
(a) => a.lastSelectedDashboard
|
|
538
|
-
), y =
|
|
538
|
+
), y = Z(
|
|
539
539
|
(a) => a.selectedDashboard
|
|
540
|
-
), O =
|
|
540
|
+
), O = Z(
|
|
541
541
|
(a) => a.actions.selectDashboard
|
|
542
|
-
), F =
|
|
542
|
+
), F = Z(
|
|
543
543
|
(a) => a.actions.clearSelectedDashboard
|
|
544
544
|
), { tokenProps: U, id: S } = nt();
|
|
545
545
|
it();
|
|
@@ -554,8 +554,8 @@ function Ot(s) {
|
|
|
554
554
|
} = ze(() => {
|
|
555
555
|
h(!1);
|
|
556
556
|
const a = o == null ? void 0 : o.id;
|
|
557
|
-
d(null), (y == null ? void 0 : y.id) === a && (!(U != null && U.dashboard_id) && !S ? F() :
|
|
558
|
-
}), { currentUser: N, userContext: z } = ee(), te = ((ge = z == null ? void 0 : z.permissions) == null ? void 0 : ge.canCreateDashboard) ?? !1,
|
|
557
|
+
d(null), (y == null ? void 0 : y.id) === a && (!(U != null && U.dashboard_id) && !S ? F() : E && E.id !== a && O(E));
|
|
558
|
+
}), { currentUser: N, userContext: z } = ee(), te = ((ge = z == null ? void 0 : z.permissions) == null ? void 0 : ge.canCreateDashboard) ?? !1, J = T.filter(
|
|
559
559
|
(a) => {
|
|
560
560
|
var R, u;
|
|
561
561
|
return ((R = a == null ? void 0 : a.title) == null ? void 0 : R.toLowerCase().includes(g.toLowerCase())) || ((u = a == null ? void 0 : a.description) == null ? void 0 : u.toLowerCase().includes(g.toLowerCase()));
|
|
@@ -571,14 +571,14 @@ function Ot(s) {
|
|
|
571
571
|
}, ie = () => {
|
|
572
572
|
o && K(o.id);
|
|
573
573
|
}, re = (a) => {
|
|
574
|
-
|
|
575
|
-
onSettled: () =>
|
|
574
|
+
L(a), _(a, {
|
|
575
|
+
onSettled: () => L(null)
|
|
576
576
|
});
|
|
577
577
|
}, {
|
|
578
578
|
startUpdating: n,
|
|
579
579
|
stopUpdating: V,
|
|
580
580
|
isUpdating: r
|
|
581
|
-
} =
|
|
581
|
+
} = Le(), W = (a, R, u) => {
|
|
582
582
|
var Ne;
|
|
583
583
|
const oe = Object.fromEntries(
|
|
584
584
|
Object.entries(R).filter(([, B]) => B !== void 0)
|
|
@@ -604,7 +604,7 @@ function Ot(s) {
|
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
606
|
);
|
|
607
|
-
},
|
|
607
|
+
}, Q = (a) => {
|
|
608
608
|
const R = T.find(
|
|
609
609
|
(u) => u.id === a
|
|
610
610
|
);
|
|
@@ -616,7 +616,7 @@ function Ot(s) {
|
|
|
616
616
|
});
|
|
617
617
|
}, Y = (a) => {
|
|
618
618
|
b(a), N == null || N.type, x(!0);
|
|
619
|
-
},
|
|
619
|
+
}, X = (a) => {
|
|
620
620
|
l == null || l(a.id), C(a);
|
|
621
621
|
}, I = () => {
|
|
622
622
|
C(null);
|
|
@@ -634,21 +634,21 @@ function Ot(s) {
|
|
|
634
634
|
});
|
|
635
635
|
};
|
|
636
636
|
return M ? /* @__PURE__ */ e(He, {}) : c ? /* @__PURE__ */ e(Tt, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ t("div", { className: "flex h-full flex-1 flex-col", children: [
|
|
637
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children:
|
|
637
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-3 overflow-y-auto", children: J.length === 0 ? /* @__PURE__ */ t("div", { className: "py-8 text-center", children: [
|
|
638
638
|
/* @__PURE__ */ e("div", { className: "mb-3", children: /* @__PURE__ */ e(rt, { className: "mx-auto h-12 w-12 text-muted-foreground/50" }) }),
|
|
639
639
|
/* @__PURE__ */ e("h3", { className: "mb-1 font-medium text-foreground", children: g ? "No dashboards found" : "No dashboards yet" }),
|
|
640
640
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: g ? "Try adjusting your search" : te ? 'Click "Create" above to add your first dashboard' : "No dashboards have been shared with you yet" })
|
|
641
|
-
] }) :
|
|
642
|
-
|
|
641
|
+
] }) : J.map((a) => /* @__PURE__ */ e(
|
|
642
|
+
Et,
|
|
643
643
|
{
|
|
644
644
|
dashboard: a,
|
|
645
645
|
isDeleting: A,
|
|
646
646
|
isDuplicating: P === a.id,
|
|
647
647
|
onLoadDashboard: ae,
|
|
648
|
-
onEditDetails:
|
|
648
|
+
onEditDetails: X,
|
|
649
649
|
onDeleteClick: ne,
|
|
650
650
|
onDuplicateDashboard: re,
|
|
651
|
-
onTogglePrivacy:
|
|
651
|
+
onTogglePrivacy: Q,
|
|
652
652
|
onShareDashboard: Y,
|
|
653
653
|
formatDate: se,
|
|
654
654
|
onDashboardItemClick: i
|
|
@@ -656,7 +656,7 @@ function Ot(s) {
|
|
|
656
656
|
a.id
|
|
657
657
|
)) }),
|
|
658
658
|
f && m && /* @__PURE__ */ e(
|
|
659
|
-
|
|
659
|
+
Ee,
|
|
660
660
|
{
|
|
661
661
|
resource: m,
|
|
662
662
|
resourceType: Te.DASHBOARD,
|
|
@@ -800,9 +800,9 @@ function jt({
|
|
|
800
800
|
var A;
|
|
801
801
|
const f = de(
|
|
802
802
|
(N) => N.isDashboardEditing
|
|
803
|
-
), [x, m] = D(!1), [b, v] = D(""), [h, o] = D(!1), { currentUser: d, userContext: P } = ee(),
|
|
803
|
+
), [x, m] = D(!1), [b, v] = D(""), [h, o] = D(!1), { currentUser: d, userContext: P } = ee(), L = ((A = P == null ? void 0 : P.permissions) == null ? void 0 : A.canCreateDashboard) ?? !1, { onCreateSuccess: w } = mt({
|
|
804
804
|
onDashboardSelect: l
|
|
805
|
-
}), { selectVisual: C } =
|
|
805
|
+
}), { selectVisual: C } = $(), { handleEditLibraryVisual: E } = Be(), {
|
|
806
806
|
createResource: y,
|
|
807
807
|
isCreating: O,
|
|
808
808
|
refetch: F
|
|
@@ -810,7 +810,7 @@ function jt({
|
|
|
810
810
|
void 0,
|
|
811
811
|
// onDeleteSuccess (not needed here)
|
|
812
812
|
(N) => {
|
|
813
|
-
m(!1), N && (C(N),
|
|
813
|
+
m(!1), N && (C(N), E(N));
|
|
814
814
|
}
|
|
815
815
|
), T = i === "overlay", M = vt(g, {
|
|
816
816
|
enabled: s && T
|
|
@@ -847,7 +847,7 @@ function jt({
|
|
|
847
847
|
}
|
|
848
848
|
)
|
|
849
849
|
] }),
|
|
850
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: (f ||
|
|
850
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: (f || L) && /* @__PURE__ */ t(
|
|
851
851
|
j,
|
|
852
852
|
{
|
|
853
853
|
size: "sm",
|
|
@@ -872,7 +872,7 @@ function jt({
|
|
|
872
872
|
}
|
|
873
873
|
) })
|
|
874
874
|
] }),
|
|
875
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-4 py-4", children: f ? /* @__PURE__ */ e(
|
|
875
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col overflow-auto px-4 py-4", children: f ? /* @__PURE__ */ e(Lt, { searchQuery: b }) : /* @__PURE__ */ e(
|
|
876
876
|
Ot,
|
|
877
877
|
{
|
|
878
878
|
searchQuery: b,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r, Fragment as E } from "react/jsx-runtime";
|
|
2
|
-
import { b as W, ao as _, ap as $, aq as G, ar as J, as as K, at as M, au as R, av as X, aw as T, ax as Q, B as k,
|
|
3
|
-
import { E as he, V as ue, a as me, b as ve, S as U, c as pe } from "./editor-action-buttons-
|
|
2
|
+
import { b as W, ao as _, ap as $, aq as G, ar as J, as as K, at as M, au as R, av as X, aw as T, ax as Q, B as k, L as Y, f as N, i as Z, u as g, ak as ee, g as q, ay as ae, az as B, l as w, aA as se, aB as te, c as y, aC as O, aD as P, aE as L, aF as z, aG as j, e as ne, aH as de, aI as le, aJ as re, I as ie, aK as oe, aL as ce } from "./index-BB_Q9BeP.js";
|
|
3
|
+
import { E as he, V as ue, a as me, b as ve, S as U, c as pe } from "./editor-action-buttons-CCki6g0i.js";
|
|
4
4
|
import fe, { useState as C, useContext as be } from "react";
|
|
5
|
-
import { a as H } from "./use-visual-utils-
|
|
5
|
+
import { a as H } from "./use-visual-utils-CQb_-z3Z.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),e=require("./index-
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),e=require("./index-C2IITrDh.js"),f=require("./editor-action-buttons-D-aEUYpS.js"),p=require("react"),y=require("./use-visual-utils-VFO0nbRa.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ai as G, aj as z,
|
|
1
|
+
import { ai as G, aj as z, h as Y, i as J, ak as K, e as _, g as X, u as U, al as Z, am as q, l as v, an as ee, f as h } from "./index-BB_Q9BeP.js";
|
|
2
2
|
import { useState as T, useEffect as te, useCallback as V } from "react";
|
|
3
3
|
function re(e) {
|
|
4
|
-
const
|
|
4
|
+
const o = e.toUpperCase().indexOf("WHERE"), r = e.toUpperCase().indexOf("GROUP BY"), t = e.toUpperCase().indexOf("LIMIT"), i = e.toUpperCase().indexOf("ORDER BY");
|
|
5
5
|
let n = e.length;
|
|
6
|
-
if (i !== -1 && (n = i), t !== -1 && t < n && (n = t),
|
|
7
|
-
const
|
|
8
|
-
return `${
|
|
6
|
+
if (i !== -1 && (n = i), t !== -1 && t < n && (n = t), o !== -1) {
|
|
7
|
+
const a = e.substring(0, o), s = e.substring(o);
|
|
8
|
+
return `${a} {{ filters | where }} AND ${s.substring(
|
|
9
9
|
6
|
|
10
10
|
)}`;
|
|
11
11
|
} else if (r !== -1) {
|
|
12
|
-
const
|
|
13
|
-
return `${
|
|
12
|
+
const a = e.substring(0, r), s = e.substring(r);
|
|
13
|
+
return `${a} {{ filters | where }} ${s}`;
|
|
14
14
|
} else {
|
|
15
|
-
const
|
|
16
|
-
return console.log("beforeClause",
|
|
15
|
+
const a = e.substring(0, n), s = e.substring(n);
|
|
16
|
+
return console.log("beforeClause", a), console.log("afterClause", s), s ? `${a} {{ filters | where }} ${s}` : `${a.replace(/;$/, "")} {{ filters | where }}`;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function se(e) {
|
|
20
|
-
const [
|
|
20
|
+
const [o, r] = T(null), [t, i] = T(null), n = G();
|
|
21
21
|
return te(() => {
|
|
22
22
|
if (!e || e.trim() === "") {
|
|
23
23
|
r(null), i(null);
|
|
@@ -53,36 +53,36 @@ function se(e) {
|
|
|
53
53
|
console.error("Failed to load remote chart store:", d), i(d), r(null);
|
|
54
54
|
}
|
|
55
55
|
})();
|
|
56
|
-
}, [e, n]),
|
|
56
|
+
}, [e, n]), o;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function oe(e, o) {
|
|
59
59
|
if (e.length === 0)
|
|
60
60
|
return "";
|
|
61
|
-
if (
|
|
62
|
-
const r = e.find((t) => t.id ===
|
|
61
|
+
if (o) {
|
|
62
|
+
const r = e.find((t) => t.id === o);
|
|
63
63
|
if (r) {
|
|
64
64
|
const t = r.tabTitle;
|
|
65
65
|
if (t == "All__Header")
|
|
66
66
|
return e[0].id;
|
|
67
67
|
if (t && t.endsWith("__Header")) {
|
|
68
|
-
const n = t.split("__")[0],
|
|
68
|
+
const n = t.split("__")[0], a = e.find(
|
|
69
69
|
(s) => s.tabTitle === n
|
|
70
70
|
);
|
|
71
|
-
return
|
|
71
|
+
return a ? a.id : e[0].id;
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return o;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
return e[0].id;
|
|
77
77
|
}
|
|
78
|
-
async function M(e,
|
|
79
|
-
if (!
|
|
78
|
+
async function M(e, o, r, t) {
|
|
79
|
+
if (!o || !r)
|
|
80
80
|
throw new Error("Missing auth token or visual ID");
|
|
81
81
|
const i = ["resource-by-id", "visual", r], n = t.getQueryData(i);
|
|
82
82
|
if (n)
|
|
83
83
|
return console.log("Using cached visual data for:", r), { data: n, fromCache: !0 };
|
|
84
84
|
console.log("Fetching visual data from network for:", r);
|
|
85
|
-
const
|
|
85
|
+
const a = v.loading("Loading visual...", {
|
|
86
86
|
position: "top-center"
|
|
87
87
|
});
|
|
88
88
|
try {
|
|
@@ -90,16 +90,16 @@ async function M(e, a, r, t) {
|
|
|
90
90
|
`${e}/management/v1/visuals/${r}`,
|
|
91
91
|
{
|
|
92
92
|
headers: {
|
|
93
|
-
Authorization: `Bearer ${
|
|
93
|
+
Authorization: `Bearer ${o}`
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
if (!s.ok)
|
|
98
98
|
throw new Error("Failed to load visual");
|
|
99
99
|
const d = await s.json();
|
|
100
|
-
return t.setQueryData(i, d), v.dismiss(
|
|
100
|
+
return t.setQueryData(i, d), v.dismiss(a), { data: d, fromCache: !1 };
|
|
101
101
|
} catch (s) {
|
|
102
|
-
throw v.dismiss(
|
|
102
|
+
throw v.dismiss(a), s;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
function k(e) {
|
|
@@ -109,33 +109,33 @@ function k(e) {
|
|
|
109
109
|
return e;
|
|
110
110
|
throw new Error("Invalid frame object format");
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
var n,
|
|
112
|
+
function ae(e, o) {
|
|
113
|
+
var n, a;
|
|
114
114
|
const r = (e == null ? void 0 : e.frameObject) ?? ((n = e == null ? void 0 : e.visual) == null ? void 0 : n.frameObject);
|
|
115
115
|
if (!r)
|
|
116
116
|
return !1;
|
|
117
117
|
const t = k(r);
|
|
118
118
|
if (!(t != null && t.cards) || t.cards.length === 0)
|
|
119
119
|
return !1;
|
|
120
|
-
const i = (
|
|
120
|
+
const i = (a = t.cards) == null ? void 0 : a.find(
|
|
121
121
|
(s) => s.id === t.activeCardId
|
|
122
122
|
);
|
|
123
123
|
return i ? (ee({
|
|
124
|
-
...
|
|
124
|
+
...o,
|
|
125
125
|
frame: t,
|
|
126
126
|
card: i,
|
|
127
127
|
visualId: (e == null ? void 0 : e.id) || t.visualId
|
|
128
128
|
}), !0) : !1;
|
|
129
129
|
}
|
|
130
130
|
function ne() {
|
|
131
|
-
var
|
|
132
|
-
const { setCardSql: e } = _(),
|
|
133
|
-
((
|
|
131
|
+
var b;
|
|
132
|
+
const { setCardSql: e } = _(), o = h((c) => c.frame), r = h((c) => c.card), t = se(
|
|
133
|
+
((b = r.customCardPreferences) == null ? void 0 : b.url) || ""
|
|
134
134
|
), i = h(
|
|
135
135
|
(c) => c.selectedSchemaName
|
|
136
136
|
), n = h(
|
|
137
137
|
(c) => c.selectedDatamodelId
|
|
138
|
-
),
|
|
138
|
+
), a = h(
|
|
139
139
|
(c) => c.selectedDatabaseName
|
|
140
140
|
), s = h((c) => c.selectedTableName), d = h(
|
|
141
141
|
(c) => c.selectedConnectionId
|
|
@@ -149,7 +149,7 @@ function ne() {
|
|
|
149
149
|
dataSource: r.dataSource || { mode: "directSource" },
|
|
150
150
|
lastSelectedSchema: i,
|
|
151
151
|
lastSelectedDatamodelId: n,
|
|
152
|
-
lastSelectedDatabase:
|
|
152
|
+
lastSelectedDatabase: a,
|
|
153
153
|
lastSelectedTable: s,
|
|
154
154
|
connectionId: d,
|
|
155
155
|
// type: isShowingVisual ? card.type : 'table', /// CHECK THIS!!!!
|
|
@@ -163,21 +163,21 @@ function ne() {
|
|
|
163
163
|
settings: S
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
}, w =
|
|
166
|
+
}, w = o.cards.map(
|
|
167
167
|
(p) => p.id === r.id ? F : p
|
|
168
168
|
);
|
|
169
169
|
return {
|
|
170
|
-
...
|
|
170
|
+
...o,
|
|
171
171
|
cards: w,
|
|
172
|
-
activeCardId:
|
|
172
|
+
activeCardId: oe(w, o.activeCardId)
|
|
173
173
|
};
|
|
174
174
|
}, [
|
|
175
175
|
r,
|
|
176
|
-
|
|
176
|
+
o,
|
|
177
177
|
m,
|
|
178
178
|
i,
|
|
179
179
|
n,
|
|
180
|
-
|
|
180
|
+
a,
|
|
181
181
|
s,
|
|
182
182
|
d,
|
|
183
183
|
e,
|
|
@@ -186,15 +186,15 @@ function ne() {
|
|
|
186
186
|
]) };
|
|
187
187
|
}
|
|
188
188
|
function de() {
|
|
189
|
-
const { authToken: e, tokenProps:
|
|
189
|
+
const { authToken: e, tokenProps: o } = z(), r = Y(), t = J(), { selectVisual: i } = K(), {
|
|
190
190
|
setFrame: n,
|
|
191
|
-
setCard:
|
|
191
|
+
setCard: a,
|
|
192
192
|
setIsDevMode: s,
|
|
193
193
|
setActiveTabCardId: d,
|
|
194
194
|
updateDataSource: m,
|
|
195
195
|
setQueryResultColumns: u,
|
|
196
196
|
setSelectedConnectionId: $,
|
|
197
|
-
setSelectedDatabaseName:
|
|
197
|
+
setSelectedDatabaseName: b,
|
|
198
198
|
setSelectedSchemaName: c,
|
|
199
199
|
setSelectedTableName: S,
|
|
200
200
|
setSelectedDatamodelId: F,
|
|
@@ -213,21 +213,21 @@ function de() {
|
|
|
213
213
|
async (l) => {
|
|
214
214
|
try {
|
|
215
215
|
i(l), O();
|
|
216
|
-
const { data:
|
|
217
|
-
|
|
216
|
+
const { data: g, fromCache: f } = await M(
|
|
217
|
+
o.apiServiceUrl,
|
|
218
218
|
(e == null ? void 0 : e.accessToken) || "",
|
|
219
219
|
l.id,
|
|
220
220
|
r
|
|
221
221
|
);
|
|
222
|
-
if (!
|
|
222
|
+
if (!ae(g, {
|
|
223
223
|
setFrame: n,
|
|
224
|
-
setCard:
|
|
224
|
+
setCard: a,
|
|
225
225
|
setIsDevMode: s,
|
|
226
226
|
setActiveTabCardId: d,
|
|
227
227
|
updateDataSource: m,
|
|
228
228
|
setQueryResultColumns: u,
|
|
229
229
|
setSelectedConnectionId: $,
|
|
230
|
-
setSelectedDatabaseName:
|
|
230
|
+
setSelectedDatabaseName: b,
|
|
231
231
|
setSelectedSchemaName: c,
|
|
232
232
|
setSelectedTableName: S,
|
|
233
233
|
setSelectedDatamodelId: F,
|
|
@@ -242,17 +242,17 @@ function de() {
|
|
|
242
242
|
}))
|
|
243
243
|
throw new Error("Failed to setup editor with visual data");
|
|
244
244
|
return { success: !0, fromCache: f };
|
|
245
|
-
} catch (
|
|
246
|
-
return console.error("Error editing visual:",
|
|
245
|
+
} catch (g) {
|
|
246
|
+
return console.error("Error editing visual:", g), { success: !1, error: "Failed to load visual for editing" };
|
|
247
247
|
}
|
|
248
248
|
},
|
|
249
249
|
[
|
|
250
250
|
e == null ? void 0 : e.accessToken,
|
|
251
|
-
|
|
251
|
+
o.apiServiceUrl,
|
|
252
252
|
r,
|
|
253
253
|
i,
|
|
254
254
|
n,
|
|
255
|
-
|
|
255
|
+
a,
|
|
256
256
|
p,
|
|
257
257
|
N,
|
|
258
258
|
s,
|
|
@@ -260,7 +260,7 @@ function de() {
|
|
|
260
260
|
m,
|
|
261
261
|
u,
|
|
262
262
|
$,
|
|
263
|
-
|
|
263
|
+
b,
|
|
264
264
|
c,
|
|
265
265
|
S,
|
|
266
266
|
F,
|
|
@@ -274,7 +274,7 @@ function de() {
|
|
|
274
274
|
]
|
|
275
275
|
), Q = V(
|
|
276
276
|
async (l) => {
|
|
277
|
-
var
|
|
277
|
+
var g;
|
|
278
278
|
try {
|
|
279
279
|
if (i(l), !I)
|
|
280
280
|
return {
|
|
@@ -282,11 +282,11 @@ function de() {
|
|
|
282
282
|
error: "No sheet selected. Please select a sheet first."
|
|
283
283
|
};
|
|
284
284
|
const { data: f, fromCache: L } = await M(
|
|
285
|
-
|
|
285
|
+
o.apiServiceUrl,
|
|
286
286
|
(e == null ? void 0 : e.accessToken) || "",
|
|
287
287
|
l.id,
|
|
288
288
|
r
|
|
289
|
-
), P = (f == null ? void 0 : f.frameObject) ?? ((
|
|
289
|
+
), P = (f == null ? void 0 : f.frameObject) ?? ((g = f == null ? void 0 : f.visual) == null ? void 0 : g.frameObject);
|
|
290
290
|
if (!P)
|
|
291
291
|
return { success: !1, error: "Visual has no frame data" };
|
|
292
292
|
const E = k(P);
|
|
@@ -304,7 +304,7 @@ function de() {
|
|
|
304
304
|
},
|
|
305
305
|
[
|
|
306
306
|
e == null ? void 0 : e.accessToken,
|
|
307
|
-
|
|
307
|
+
o.apiServiceUrl,
|
|
308
308
|
r,
|
|
309
309
|
i,
|
|
310
310
|
I,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./index-
|
|
1
|
+
"use strict";const o=require("./index-C2IITrDh.js"),b=require("react");function _(e){const a=e.toUpperCase().indexOf("WHERE"),r=e.toUpperCase().indexOf("GROUP BY"),t=e.toUpperCase().indexOf("LIMIT"),d=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(d!==-1&&(c=d),t!==-1&&t<c&&(c=t),a!==-1){const n=e.substring(0,a),s=e.substring(a);return`${n} {{ filters | where }} AND ${s.substring(6)}`}else if(r!==-1){const n=e.substring(0,r),s=e.substring(r);return`${n} {{ filters | where }} ${s}`}else{const n=e.substring(0,c),s=e.substring(c);return console.log("beforeClause",n),console.log("afterClause",s),s?`${n} {{ filters | where }} ${s}`:`${n.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,r]=b.useState(null),[t,d]=b.useState(null),c=o.useEnsureReactGlobals();return b.useEffect(()=>{if(!e||e.trim()===""){r(null),d(null);return}if(!c)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const m=await import(l);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");r(()=>m.useChartStore),d(null)}catch(s){const l=s instanceof Error?s.message:"Unknown error";console.error("Failed to load remote chart store:",l),d(l),r(null)}})()},[e,c]),a}function H(e,a){if(e.length===0)return"";if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const c=t.split("__")[0],n=e.find(s=>s.tabTitle===c);return n?n.id:e[0].id}return a}}return e[0].id}async function j(e,a,r,t){if(!a||!r)throw new Error("Missing auth token or visual ID");const d=["resource-by-id","visual",r],c=t.getQueryData(d);if(c)return console.log("Using cached visual data for:",r),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",r);const n=o.ue.loading("Loading visual...",{position:"top-center"});try{const s=await fetch(`${e}/management/v1/visuals/${r}`,{headers:{Authorization:`Bearer ${a}`}});if(!s.ok)throw new Error("Failed to load visual");const l=await s.json();return t.setQueryData(d,l),o.ue.dismiss(n),{data:l,fromCache:!1}}catch(s){throw o.ue.dismiss(n),s}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Q(e,a){var c,n;const r=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!r)return!1;const t=T(r);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const d=(n=t.cards)==null?void 0:n.find(s=>s.id===t.activeCardId);return d?(o.setupEditorWithCard({...a,frame:t,card:d,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function G(){var g;const{setCardSql:e}=o.useEditorActions(),a=o.useEditorStore(i=>i.frame),r=o.useEditorStore(i=>i.card),t=B(((g=r.customCardPreferences)==null?void 0:g.url)||""),d=o.useEditorStore(i=>i.selectedSchemaName),c=o.useEditorStore(i=>i.selectedDatamodelId),n=o.useEditorStore(i=>i.selectedDatabaseName),s=o.useEditorStore(i=>i.selectedTableName),l=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),f=r.sql;return{getUpdatedFrame:b.useCallback(()=>{var E;let i=f;f&&!f.includes("{{")&&(i=_(f),e(i));const C=(E=t==null?void 0:t.getState())==null?void 0:E.settings,U={...r,dataSource:r.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:c,lastSelectedDatabase:n,lastSelectedTable:s,connectionId:l,sql:i,customCfg:m?r.customCfg:null,preferences:r.preferences,...C&&{customCardPreferences:{...r.customCardPreferences,settings:C}}},w=a.cards.map(S=>S.id===r.id?U:S);return{...a,cards:w,activeCardId:H(w,a.activeCardId)}},[r,a,m,d,c,n,s,l,e,t,f])}}function z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),r=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:d}=o.useManagementActions(),{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E}=o.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:$,setSelectedFrameId:v,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=o.useDashboardActions(),I=o.useDashboardStore(u=>u.selectedSheetId),D=o.useDashboardStore(u=>u.selectedFrameId),O=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),y=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),M=b.useCallback(async u=>{try{d(u),A();const{data:p,fromCache:h}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r);if(!Q(p,{setFrame:c,setCard:n,setIsDevMode:s,setActiveTabCardId:l,updateDataSource:m,setQueryResultColumns:f,setSelectedConnectionId:V,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:U,setFilterValues:w,setApplyFilters:E,setIsDashboardEditing:S,setIsVisualEditing:$,dashboard:O,selectedSheetId:I,selectedFrameId:D,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:h}}catch(p){return console.error("Error editing visual:",p),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,c,n,S,$,s,l,m,f,V,g,i,C,U,w,E,A,O,I,D,x]),k=b.useCallback(async u=>{var p;try{if(d(u),!I)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:h,fromCache:W}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,r),L=(h==null?void 0:h.frameObject)??((p=h==null?void 0:h.visual)==null?void 0:p.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const F=T(L);if(!(F!=null&&F.cards)||F.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...o.cloneFrameWithNewIds(F),visualId:u.id};return N(I,P,"end"),S(!0),v(P.id),R(!1),{success:!0,fromCache:W}}catch(h){return console.error("Error adding visual:",h),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,r,d,I,N,S,v,R]);return{visual:y.data,isLoading:y.isLoading,isError:y.isError,error:y.error,handleEditLibraryVisual:M,handleAddLibraryVisual:k,getUpdatedFrame:G().getUpdatedFrame,refetch:y.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=z;
|