react-semaphor 0.1.176 → 0.1.178

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.
Files changed (28) hide show
  1. package/dist/chunks/dashboard-controls-00cjSeD7.js +42 -0
  2. package/dist/chunks/dashboard-controls-C9IWIFfW.js +1624 -0
  3. package/dist/chunks/{dashboard-json-BnCOeWny.js → dashboard-json--ke9XK9p.js} +1 -1
  4. package/dist/chunks/{dashboard-json-CY8Vbmi5.js → dashboard-json-BDjl-3ej.js} +1 -1
  5. package/dist/chunks/{edit-dashboard-visual-BXBPQpCA.js → edit-dashboard-visual-BBsC9feJ.js} +2 -2
  6. package/dist/chunks/{edit-dashboard-visual-BX-hJR3k.js → edit-dashboard-visual-BroCdmtP.js} +1 -1
  7. package/dist/chunks/{editor-action-buttons-DUp8ZHiE.js → editor-action-buttons-CHoiNw7F.js} +2 -2
  8. package/dist/chunks/{editor-action-buttons-B-m2BOfh.js → editor-action-buttons-JE9t84-4.js} +1 -1
  9. package/dist/chunks/{index-D9Vg4Ioz.js → index-CdfFCbJb.js} +194 -225
  10. package/dist/chunks/{index-Cskof6E0.js → index-DZjcALSv.js} +16075 -16385
  11. package/dist/chunks/{resource-management-panel-DxRvAR5Q.js → resource-management-panel-C96ElLa5.js} +1 -1
  12. package/dist/chunks/{resource-management-panel-N2ZpMRwr.js → resource-management-panel-DE8DnPSl.js} +3 -3
  13. package/dist/chunks/{schedule-dashboard-Cd9H79qL.js → schedule-dashboard-BFa0Uljc.js} +3 -3
  14. package/dist/chunks/{schedule-dashboard-CmpnXuyb.js → schedule-dashboard-CzU0ziLB.js} +1 -1
  15. package/dist/chunks/{use-role-aware-display-preferences-0BX-GN_0.js → use-role-aware-display-preferences-Dovp_VmV.js} +1 -1
  16. package/dist/chunks/{use-role-aware-display-preferences-Cl52AceY.js → use-role-aware-display-preferences-Rd1BhDG4.js} +1 -1
  17. package/dist/chunks/{use-visual-utils-DsrKjvLV.js → use-visual-utils-BkRr5LoD.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-Czmg35Mw.js → use-visual-utils-Cnju2tnE.js} +1 -1
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/surfboard/index.cjs +1 -1
  24. package/dist/surfboard/index.js +1 -1
  25. package/dist/types/main.d.ts +6 -3
  26. package/package.json +2 -2
  27. package/dist/chunks/dashboard-controls-BtrmT5hV.js +0 -1509
  28. package/dist/chunks/dashboard-controls-DR6ruxzW.js +0 -26
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-D9Vg4Ioz.js"),c=require("react"),de=require("./use-visual-utils-Czmg35Mw.js"),pe=require("./use-role-aware-display-preferences-Cl52AceY.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CdfFCbJb.js"),c=require("react"),de=require("./use-visual-utils-Cnju2tnE.js"),pe=require("./use-role-aware-display-preferences-Rd1BhDG4.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,8 +1,8 @@
1
1
  import { jsx as e, jsxs as a, Fragment as ge } from "react/jsx-runtime";
2
- import { l as $e, u as me, n as Qe, aB as re, b9 as Xe, ba as Ze, c as X, bb as ke, aS as et, aT as tt, B as _, aU as st, aV as at, aW as W, bc as pe, L as oe, bd as nt, be as it, bf as rt, bg as ve, bh as De, bi as ot, bj as lt, K as dt, bk as ye, e as le, bl as Se, bm as Ve, bn as ct, _ as Ee, V as Le, bo as Ae, a_ as Te, a$ as Oe, b0 as Re, b2 as Pe, b3 as Ue, b4 as Ie, b5 as je, b6 as Me, bp as ut, bq as ht, br as Fe, bs as Be, bt as ze, bu as mt, bv as He, bw as pt, R as ne, aA as ft, bx as _e, by as gt, bz as Dt, aF as xt, aG as Nt, aH as bt, aI as wt, aJ as vt, aK as Ce, aL as fe, aO as Ct, bA as yt, bB as St, bC as Vt, bD as Et } from "./index-Cskof6E0.js";
2
+ import { l as $e, u as me, n as Qe, aB as re, b9 as Xe, ba as Ze, c as X, bb as ke, aS as et, aT as tt, B as _, aU as st, aV as at, aW as W, bc as pe, L as oe, bd as nt, be as it, bf as rt, bg as ve, bh as De, bi as ot, bj as lt, K as dt, bk as ye, e as le, bl as Se, bm as Ve, bn as ct, _ as Ee, V as Le, bo as Ae, a_ as Te, a$ as Oe, b0 as Re, b2 as Pe, b3 as Ue, b4 as Ie, b5 as je, b6 as Me, bp as ut, bq as ht, br as Fe, bs as Be, bt as ze, bu as mt, bv as He, bw as pt, R as ne, aA as ft, bx as _e, by as gt, bz as Dt, aF as xt, aG as Nt, aH as bt, aI as wt, aJ as vt, aK as Ce, aL as fe, aO as Ct, bA as yt, bB as St, bC as Vt, bD as Et } from "./index-DZjcALSv.js";
3
3
  import Lt, { useRef as At, useEffect as ie, useState as x } from "react";
4
- import { a as Ke } from "./use-visual-utils-DsrKjvLV.js";
5
- import { u as Tt } from "./use-role-aware-display-preferences-0BX-GN_0.js";
4
+ import { a as Ke } from "./use-visual-utils-BkRr5LoD.js";
5
+ import { u as Tt } from "./use-role-aware-display-preferences-Dovp_VmV.js";
6
6
  /**
7
7
  * @license lucide-react v0.453.0 - ISC
8
8
  *
@@ -1,8 +1,8 @@
1
1
  import { jsx as e, jsxs as a, Fragment as F } from "react/jsx-runtime";
2
- import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-Cskof6E0.js";
3
- import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-DUp8ZHiE.js";
2
+ import { l as _, aF as $, aG as q, aH as K, aI as X, aJ as Y, aK as T, aL as G, aM as J, aN as E, aO as Q, B as I, L as H, n as k, q as Z, u as g, aB as ee, o as R, aP as ae, aQ as O, t as y, R as se, aR as te, c as w, aS as B, aT as P, aU as L, aV as U, aW as z, m as de, aX as le, aY as ne, aZ as re, a_ as oe, a$ as ie, b0 as ce, b1 as he, b2 as ue, b3 as me, b4 as ve, b5 as pe, b6 as be, a5 as fe, K as ge, b7 as Ce, b8 as De } from "./index-DZjcALSv.js";
3
+ import { E as xe, V as Ae, a as Se, b as Ne, S as j, c as ye } from "./editor-action-buttons-CHoiNw7F.js";
4
4
  import we, { useState as D, useContext as Ie, useEffect as ke } from "react";
5
- import { a as W } from "./use-visual-utils-DsrKjvLV.js";
5
+ import { a as W } from "./use-visual-utils-BkRr5LoD.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-D9Vg4Ioz.js"),C=require("./editor-action-buttons-B-m2BOfh.js"),x=require("react"),y=require("./use-visual-utils-Czmg35Mw.js");/**
1
+ "use strict";const s=require("react/jsx-runtime"),e=require("./index-CdfFCbJb.js"),C=require("./editor-action-buttons-JE9t84-4.js"),x=require("react"),y=require("./use-visual-utils-Cnju2tnE.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-Cskof6E0.js";
1
+ import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-DZjcALSv.js";
2
2
  import { useMemo as i } from "react";
3
3
  function S() {
4
4
  const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
@@ -1 +1 @@
1
- "use strict";const a=require("./index-D9Vg4Ioz.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
1
+ "use strict";const a=require("./index-CdfFCbJb.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
@@ -1,4 +1,4 @@
1
- import { az as G, aA as Y, p as J, q as K, aB as X, m as z, o as Z, u as v, aC as q, aD as ee, t as V, aE as te, n as f } from "./index-Cskof6E0.js";
1
+ import { az as G, aA as Y, p as J, q as K, aB as X, m as z, o as Z, u as v, aC as q, aD as ee, t as V, aE as te, n as f } from "./index-DZjcALSv.js";
2
2
  import { useState as T, useEffect as re, useCallback as A } from "react";
3
3
  function se(e) {
4
4
  const o = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), n = e.toUpperCase().indexOf("ORDER BY");
@@ -1 +1 @@
1
- "use strict";const s=require("./index-D9Vg4Ioz.js"),g=require("react");function H(e){const a=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),c=e.toUpperCase().indexOf("ORDER BY");let d=e.length;if(c!==-1&&(d=c),r!==-1&&r<d&&(d=r),a!==-1){const i=e.substring(0,a),o=e.substring(a);return`${i} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const i=e.substring(0,t),o=e.substring(t);return`${i} {{ filters | where }} ${o}`}else{const i=e.substring(0,d),o=e.substring(d);return console.log("beforeClause",i),console.log("afterClause",o),o?`${i} {{ filters | where }} ${o}`:`${i.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,t]=g.useState(null),[r,c]=g.useState(null),d=s.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),c(null);return}if(!d)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 h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),c(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),c(l),t(null)}})()},[e,d]),a}function Q(e,a){if(e.length===0)return"";if(a){const t=e.find(r=>r.id===a);if(t){const r=t.tabTitle;if(r=="All__Header")return e[0].id;if(r&&r.endsWith("__Header")){const d=r.split("__")[0],i=e.find(o=>o.tabTitle===d);return i?i.id:e[0].id}return a}}return e[0].id}async function j(e,a,t,r){if(!a||!t)throw new Error("Missing auth token or visual ID");const c=["resource-by-id","visual",t],d=r.getQueryData(c);if(d)return console.log("Using cached visual data for:",t),{data:d,fromCache:!0};console.log("Fetching visual data from network for:",t);const i=s.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${a}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(c,l),s.ue.dismiss(i),{data:l,fromCache:!1}}catch(o){throw s.ue.dismiss(i),o}}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 z(e,a){var d,i;const t=(e==null?void 0:e.frameObject)??((d=e==null?void 0:e.visual)==null?void 0:d.frameObject);if(!t)return!1;const r=T(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const c=(i=r.cards)==null?void 0:i.find(o=>o.id===r.activeCardId);return c?(s.setupEditorWithCard({...a,frame:r,card:c,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function G(){var C;const{setCardSql:e}=s.useEditorActions(),a=s.useEditorStore(n=>n.frame),t=s.useEditorStore(n=>n.card),r=s.useEditorStore(n=>n.isDevMode),c=B(((C=t.customCardPreferences)==null?void 0:C.url)||""),d=s.useEditorStore(n=>n.selectedSchemaName),i=s.useEditorStore(n=>n.selectedDatamodelId),o=s.useEditorStore(n=>n.selectedDatabaseName),l=s.useEditorStore(n=>n.selectedTableName),h=s.useEditorStore(n=>n.selectedConnectionId),m=s.useEditorStore(n=>n.isShowingVisual),S=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let n=S;S&&!S.includes("{{")&&(n=H(S),e(n));const w=(I=c==null?void 0:c.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:i,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?n:void 0,python:r?t.python:void 0,config:r?void 0:t.config,customCfg:m?t.customCfg:null,preferences:t.preferences,...w&&{customCardPreferences:{...t.customCardPreferences,settings:w}}},E=a.cards.map(p=>p.id===t.id?v:p);return{...a,cards:E,activeCardId:Q(E,a.activeCardId)}},[t,a,r,m,d,i,o,l,h,e,c,S])}}function Y(){const{authToken:e,tokenProps:a}=s.useSemaphorContext(),t=s.useQueryClient(),r=s.useSelectedVisual(),{selectVisual:c}=s.useManagementActions(),{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I}=s.useEditorActions(),{setIsDashboardEditing:p,setIsVisualEditing:$,setSelectedFrameId:D,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=s.useDashboardActions(),y=s.useDashboardStore(u=>u.selectedSheetId),O=s.useDashboardStore(u=>u.selectedFrameId),x=s.useDashboardStore(u=>u.dashboard),W=s.useDashboardStore(u=>u.filterValues),F=s.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),k=g.useCallback(async u=>{try{c(u),A();const{data:b,fromCache:f}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!z(b,{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I,setIsDashboardEditing:p,setIsVisualEditing:$,dashboard:x,selectedSheetId:y,selectedFrameId:O,filterValues:W}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,d,i,p,$,o,l,h,m,S,V,C,n,w,v,E,I,A,x,y,O,W]),_=g.useCallback(async u=>{var b;try{if(c(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:M}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),L=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const U=T(L);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...s.cloneFrameWithNewIds(U),visualId:u.id};return N(y,P,"end"),p(!0),D(P.id),R(!1),{success:!0,fromCache:M}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,y,N,p,D,R]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:k,handleAddLibraryVisual:_,getUpdatedFrame:G().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=Y;
1
+ "use strict";const s=require("./index-CdfFCbJb.js"),g=require("react");function H(e){const a=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),c=e.toUpperCase().indexOf("ORDER BY");let d=e.length;if(c!==-1&&(d=c),r!==-1&&r<d&&(d=r),a!==-1){const i=e.substring(0,a),o=e.substring(a);return`${i} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const i=e.substring(0,t),o=e.substring(t);return`${i} {{ filters | where }} ${o}`}else{const i=e.substring(0,d),o=e.substring(d);return console.log("beforeClause",i),console.log("afterClause",o),o?`${i} {{ filters | where }} ${o}`:`${i.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,t]=g.useState(null),[r,c]=g.useState(null),d=s.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),c(null);return}if(!d)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 h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),c(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),c(l),t(null)}})()},[e,d]),a}function Q(e,a){if(e.length===0)return"";if(a){const t=e.find(r=>r.id===a);if(t){const r=t.tabTitle;if(r=="All__Header")return e[0].id;if(r&&r.endsWith("__Header")){const d=r.split("__")[0],i=e.find(o=>o.tabTitle===d);return i?i.id:e[0].id}return a}}return e[0].id}async function j(e,a,t,r){if(!a||!t)throw new Error("Missing auth token or visual ID");const c=["resource-by-id","visual",t],d=r.getQueryData(c);if(d)return console.log("Using cached visual data for:",t),{data:d,fromCache:!0};console.log("Fetching visual data from network for:",t);const i=s.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${a}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(c,l),s.ue.dismiss(i),{data:l,fromCache:!1}}catch(o){throw s.ue.dismiss(i),o}}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 z(e,a){var d,i;const t=(e==null?void 0:e.frameObject)??((d=e==null?void 0:e.visual)==null?void 0:d.frameObject);if(!t)return!1;const r=T(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const c=(i=r.cards)==null?void 0:i.find(o=>o.id===r.activeCardId);return c?(s.setupEditorWithCard({...a,frame:r,card:c,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function G(){var C;const{setCardSql:e}=s.useEditorActions(),a=s.useEditorStore(n=>n.frame),t=s.useEditorStore(n=>n.card),r=s.useEditorStore(n=>n.isDevMode),c=B(((C=t.customCardPreferences)==null?void 0:C.url)||""),d=s.useEditorStore(n=>n.selectedSchemaName),i=s.useEditorStore(n=>n.selectedDatamodelId),o=s.useEditorStore(n=>n.selectedDatabaseName),l=s.useEditorStore(n=>n.selectedTableName),h=s.useEditorStore(n=>n.selectedConnectionId),m=s.useEditorStore(n=>n.isShowingVisual),S=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let n=S;S&&!S.includes("{{")&&(n=H(S),e(n));const w=(I=c==null?void 0:c.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:i,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?n:void 0,python:r?t.python:void 0,config:r?void 0:t.config,customCfg:m?t.customCfg:null,preferences:t.preferences,...w&&{customCardPreferences:{...t.customCardPreferences,settings:w}}},E=a.cards.map(p=>p.id===t.id?v:p);return{...a,cards:E,activeCardId:Q(E,a.activeCardId)}},[t,a,r,m,d,i,o,l,h,e,c,S])}}function Y(){const{authToken:e,tokenProps:a}=s.useSemaphorContext(),t=s.useQueryClient(),r=s.useSelectedVisual(),{selectVisual:c}=s.useManagementActions(),{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I}=s.useEditorActions(),{setIsDashboardEditing:p,setIsVisualEditing:$,setSelectedFrameId:D,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=s.useDashboardActions(),y=s.useDashboardStore(u=>u.selectedSheetId),O=s.useDashboardStore(u=>u.selectedFrameId),x=s.useDashboardStore(u=>u.dashboard),W=s.useDashboardStore(u=>u.filterValues),F=s.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),k=g.useCallback(async u=>{try{c(u),A();const{data:b,fromCache:f}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!z(b,{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I,setIsDashboardEditing:p,setIsVisualEditing:$,dashboard:x,selectedSheetId:y,selectedFrameId:O,filterValues:W}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,d,i,p,$,o,l,h,m,S,V,C,n,w,v,E,I,A,x,y,O,W]),_=g.useCallback(async u=>{var b;try{if(c(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:M}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),L=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const U=T(L);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...s.cloneFrameWithNewIds(U),visualId:u.id};return N(y,P,"end"),p(!0),D(P.id),R(!1),{success:!0,fromCache:M}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,y,N,p,D,R]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:k,handleAddLibraryVisual:_,getUpdatedFrame:G().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-D9Vg4Ioz.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CdfFCbJb.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-Cskof6E0.js";
1
+ import { D as a } from "../chunks/index-DZjcALSv.js";
2
2
  import { EMPTY_SELECTION as e } from "../types/index.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-D9Vg4Ioz.js"),v=require("./types/index.cjs"),a=require("react/jsx-runtime"),b=require("react"),j=require("./chunks/resource-management-panel-DxRvAR5Q.js"),h=require("./chunks/schedule-dashboard-CmpnXuyb.js");require("react-dom");function P(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=P(b);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CdfFCbJb.js"),v=require("./types/index.cjs"),a=require("react/jsx-runtime"),b=require("react"),j=require("./chunks/resource-management-panel-C96ElLa5.js"),h=require("./chunks/schedule-dashboard-CzU0ziLB.js");require("react-dom");function P(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(o,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return o.default=r,Object.freeze(o)}const m=P(b);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-Cskof6E0.js";
2
- import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-Cskof6E0.js";
1
+ import { l as w, E as T, F as N, S as _, v as P, U as M, w as A, x as I, u as R, y as D, z as k, P as F, A as L, B as V, c as v, G as O, H as B, I as H, J as U, K as W, M as j, N as q, O as z, Q, C as G } from "./chunks/index-DZjcALSv.js";
2
+ import { aa as ia, ab as da, D as la, a8 as ca, a2 as ua, af as ha, V as pa, Z as ma, Z as fa, _ as Ca, a as va, a5 as ya, ay as ba, am as Da, a7 as Ta, a3 as ga, a4 as Ea, ag as Sa, ao as xa, an as wa, ar as Na, as as _a, al as Pa, a6 as Ma, ak as Aa, ad as Ia, ae as Ra, ac as ka, ap as Fa, aj as La, ai as Va, ah as Oa, at as Ba, aq as Ha, a1 as Ua, av as Wa, ax as ja, aw as qa, o as za, a0 as Qa, T as Ga, a9 as Ka, W as Ya, m as $a, au as Za, n as Ja, R as Xa, $ as ae, Y as ee } from "./chunks/index-DZjcALSv.js";
3
3
  import { EMPTY_SELECTION as oe } from "./types/index.js";
4
4
  import { jsx as a, jsxs as i } from "react/jsx-runtime";
5
5
  import * as p from "react";
6
6
  import { useMemo as K, useEffect as Y } from "react";
7
- import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-N2ZpMRwr.js";
8
- import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-Cd9H79qL.js";
7
+ import { ResourceManagementPanel as ne } from "./chunks/resource-management-panel-DE8DnPSl.js";
8
+ import { A as ie, S as de, U as le, V as ce, u as ue } from "./chunks/schedule-dashboard-BFa0Uljc.js";
9
9
  import "react-dom";
10
10
  /**
11
11
  * @license lucide-react v0.453.0 - ISC
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-D9Vg4Ioz.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CdfFCbJb.js"),r=require("../types/index.cjs");exports.Surfboard=e.DashboardPlus;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { a } from "../chunks/index-Cskof6E0.js";
1
+ import { a } from "../chunks/index-DZjcALSv.js";
2
2
  import { EMPTY_SELECTION as E } from "../types/index.js";
3
3
  export {
4
4
  E as EMPTY_SELECTION,
@@ -3150,7 +3150,8 @@ export declare function useDashboardQuery(): {
3150
3150
  };
3151
3151
 
3152
3152
  export declare const useDashboardStore: UseBoundStore<Omit<StoreApi<DashboardStore>, "setState"> & {
3153
- setState(nextStateOrUpdater: DashboardStore | Partial<DashboardStore> | ((state: WritableDraft<DashboardStore>) => void), shouldReplace?: boolean | undefined): void;
3153
+ setState(nextStateOrUpdater: DashboardStore | Partial<DashboardStore> | ((state: WritableDraft<DashboardStore>) => void), shouldReplace?: false): void;
3154
+ setState(nextStateOrUpdater: DashboardStore | ((state: WritableDraft<DashboardStore>) => void), shouldReplace: true): void;
3154
3155
  }>;
3155
3156
 
3156
3157
  export declare function useDataColumns(token?: AuthToken): {
@@ -3228,7 +3229,8 @@ export declare function useEditorAside(token?: AuthToken, _connectionQueryKey?:
3228
3229
  };
3229
3230
 
3230
3231
  export declare const useEditorStore: UseBoundStore<Omit<StoreApi<EditorStore>, "setState"> & {
3231
- setState(nextStateOrUpdater: EditorStore | Partial<EditorStore> | ((state: WritableDraft<EditorStore>) => void), shouldReplace?: boolean | undefined): void;
3232
+ setState(nextStateOrUpdater: EditorStore | Partial<EditorStore> | ((state: WritableDraft<EditorStore>) => void), shouldReplace?: false): void;
3233
+ setState(nextStateOrUpdater: EditorStore | ((state: WritableDraft<EditorStore>) => void), shouldReplace: true): void;
3232
3234
  }>;
3233
3235
 
3234
3236
  /**
@@ -3252,7 +3254,8 @@ setState(nextStateOrUpdater: EditorStore | Partial<EditorStore> | ((state: Writa
3252
3254
  export declare function useExposePrintState(isPdfRender: boolean, printState: PrintState | null): void;
3253
3255
 
3254
3256
  export declare const useManagementStore: UseBoundStore<Omit<StoreApi<ManagementStore>, "setState"> & {
3255
- setState(nextStateOrUpdater: ManagementStore | Partial<ManagementStore> | ((state: WritableDraft<ManagementStore>) => void), shouldReplace?: boolean | undefined): void;
3257
+ setState(nextStateOrUpdater: ManagementStore | Partial<ManagementStore> | ((state: WritableDraft<ManagementStore>) => void), shouldReplace?: false): void;
3258
+ setState(nextStateOrUpdater: ManagementStore | ((state: WritableDraft<ManagementStore>) => void), shouldReplace: true): void;
3256
3259
  }>;
3257
3260
 
3258
3261
  /**
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.176",
8
+ "version": "0.1.178",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",
@@ -129,7 +129,7 @@
129
129
  "tailwind-merge": "^2.1.0",
130
130
  "tailwindcss-animate": "^1.0.7",
131
131
  "uuid": "^9.0.1",
132
- "zustand": "^4.4.7"
132
+ "zustand": "^5.0.9"
133
133
  },
134
134
  "peerDependencies": {
135
135
  "react": "^18.0.0 || ^19.0.0",