react-semaphor 0.1.158 → 0.1.161

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 (27) hide show
  1. package/dist/chunks/{dashboard-controls-BrA9bfEH.js → dashboard-controls-Bj4t5-el.js} +191 -190
  2. package/dist/chunks/{dashboard-controls-DCikywwc.js → dashboard-controls-BlxwV3BR.js} +6 -6
  3. package/dist/chunks/{dashboard-export-dialog-CgY7xu9K.js → dashboard-export-dialog-CIzU-4eS.js} +22 -22
  4. package/dist/chunks/{dashboard-export-dialog-DmiGLzpJ.js → dashboard-export-dialog-CT050NhP.js} +1 -1
  5. package/dist/chunks/{dashboard-json-BXikY_Pb.js → dashboard-json-BozpGO6V.js} +1 -1
  6. package/dist/chunks/{dashboard-json-VCE4QVLn.js → dashboard-json-rd13AclB.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-DnbmVSBV.js → edit-dashboard-visual-CfKKFELr.js} +1 -1
  8. package/dist/chunks/{edit-dashboard-visual-BncKHExl.js → edit-dashboard-visual-CxCLmkDv.js} +656 -656
  9. package/dist/chunks/{editor-action-buttons-7JVpVMr_.js → editor-action-buttons-Bu2ZxWgU.js} +1 -1
  10. package/dist/chunks/{editor-action-buttons-CoPIk5d_.js → editor-action-buttons-Ca2pHbvu.js} +2 -2
  11. package/dist/chunks/{index-DKPrD9E9.js → index-BXm1zeXQ.js} +131 -136
  12. package/dist/chunks/{index-DxPc6NRF.js → index-CO0YJSQz.js} +17284 -17369
  13. package/dist/chunks/resource-management-panel-C7J2WWQy.js +6 -0
  14. package/dist/chunks/{resource-management-panel-MW870OP_.js → resource-management-panel-DTJwukgb.js} +343 -335
  15. package/dist/chunks/use-role-aware-display-preferences-CBkOVEcY.js +1 -0
  16. package/dist/chunks/use-role-aware-display-preferences-CJv8NgDG.js +29 -0
  17. package/dist/chunks/{use-visual-utils-Dae2BjCh.js → use-visual-utils-8weKmT25.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-C85nqyUR.js → use-visual-utils-B39LEQMe.js} +24 -24
  19. package/dist/dashboard/index.cjs +1 -1
  20. package/dist/dashboard/index.js +1 -1
  21. package/dist/index.cjs +2 -2
  22. package/dist/index.js +67 -65
  23. package/dist/surfboard/index.cjs +1 -1
  24. package/dist/surfboard/index.js +1 -1
  25. package/dist/types/main.d.ts +68 -1
  26. package/package.json +1 -1
  27. package/dist/chunks/resource-management-panel-CegmHckB.js +0 -6
@@ -0,0 +1 @@
1
+ "use strict";const a=require("./index-BXm1zeXQ.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;
@@ -0,0 +1,29 @@
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-CO0YJSQz.js";
2
+ import { useMemo as i } from "react";
3
+ function S() {
4
+ const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
5
+ () => D(a),
6
+ [a]
7
+ ), p = i(() => (e) => r && r[e] !== void 0 && r[e] === !1 ? !1 : c(e), [r, c, n]), f = i(
8
+ () => {
9
+ var e, o, d, l, h;
10
+ return {
11
+ canEdit: ((e = s == null ? void 0 : s.permissions) == null ? void 0 : e.canEdit) ?? g(a),
12
+ canUseFilters: ((o = s == null ? void 0 : s.permissions) == null ? void 0 : o.canEdit) ?? E(a),
13
+ canManageDashboards: ((d = s == null ? void 0 : s.permissions) == null ? void 0 : d.canCreateDashboard) ?? u(a),
14
+ canCreateDashboards: ((l = s == null ? void 0 : s.permissions) == null ? void 0 : l.canCreateDashboard) ?? b(a),
15
+ canAccessVisuals: ((h = s == null ? void 0 : s.permissions) == null ? void 0 : h.canEdit) ?? U(a)
16
+ };
17
+ },
18
+ [a, s]
19
+ );
20
+ return {
21
+ displayPreferences: n,
22
+ shouldShowElement: p,
23
+ permissions: f,
24
+ currentUser: a
25
+ };
26
+ }
27
+ export {
28
+ S as u
29
+ };
@@ -1 +1 @@
1
- "use strict";const o=require("./index-DKPrD9E9.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;
1
+ "use strict";const o=require("./index-BXm1zeXQ.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;
@@ -1,4 +1,4 @@
1
- import { an as G, ao as z, h as Y, i as J, ap as K, e as _, g as X, u as U, aq as Z, ar as q, l as v, as as ee, f as h } from "./index-DxPc6NRF.js";
1
+ import { ax as z, ay as G, p as Y, q as J, az as K, m as _, o as X, u as U, aA as Z, aB as q, t as v, aC as ee, n as h } from "./index-CO0YJSQz.js";
2
2
  import { useState as T, useEffect as te, useCallback as V } from "react";
3
3
  function re(e) {
4
4
  const o = e.toUpperCase().indexOf("WHERE"), r = e.toUpperCase().indexOf("GROUP BY"), t = e.toUpperCase().indexOf("LIMIT"), i = e.toUpperCase().indexOf("ORDER BY");
@@ -17,7 +17,7 @@ function re(e) {
17
17
  }
18
18
  }
19
19
  function se(e) {
20
- const [o, r] = T(null), [t, i] = T(null), n = G();
20
+ const [o, r] = T(null), [t, i] = T(null), n = z();
21
21
  return te(() => {
22
22
  if (!e || e.trim() === "") {
23
23
  r(null), i(null);
@@ -186,7 +186,7 @@ function ne() {
186
186
  ]) };
187
187
  }
188
188
  function de() {
189
- const { authToken: e, tokenProps: o } = z(), r = Y(), t = J(), { selectVisual: i } = K(), {
189
+ const { authToken: e, tokenProps: o } = G(), r = Y(), t = J(), { selectVisual: i } = K(), {
190
190
  setFrame: n,
191
191
  setCard: a,
192
192
  setIsDevMode: s,
@@ -202,17 +202,17 @@ function de() {
202
202
  setApplyFilters: C
203
203
  } = _(), {
204
204
  setIsDashboardEditing: p,
205
- setIsVisualEditing: N,
206
- setSelectedFrameId: A,
207
- clearSelectedFrameId: O,
208
- addFrame: x,
205
+ setIsVisualEditing: A,
206
+ setSelectedFrameId: N,
207
+ clearSelectedFrameId: x,
208
+ addFrame: O,
209
209
  setIsDashboardPanelOpen: R
210
- } = X(), I = U((l) => l.selectedSheetId), W = U((l) => l.selectedFrameId), D = U((l) => l.dashboard), L = U((l) => l.filterValues), y = Z((t == null ? void 0 : t.id) || "", {
210
+ } = X(), I = U((l) => l.selectedSheetId), W = U((l) => l.selectedFrameId), B = U((l) => l.dashboard), D = U((l) => l.filterValues), y = Z((t == null ? void 0 : t.id) || "", {
211
211
  enabled: !!(t != null && t.id) && !!(e != null && e.accessToken)
212
212
  }), Q = V(
213
213
  async (l) => {
214
214
  try {
215
- i(l), O();
215
+ i(l), x();
216
216
  const { data: g, fromCache: f } = await M(
217
217
  o.apiServiceUrl,
218
218
  (e == null ? void 0 : e.accessToken) || "",
@@ -234,11 +234,11 @@ function de() {
234
234
  setFilterValues: w,
235
235
  setApplyFilters: C,
236
236
  setIsDashboardEditing: p,
237
- setIsVisualEditing: N,
238
- dashboard: D,
237
+ setIsVisualEditing: A,
238
+ dashboard: B,
239
239
  selectedSheetId: I,
240
240
  selectedFrameId: W,
241
- filterValues: L
241
+ filterValues: D
242
242
  }))
243
243
  throw new Error("Failed to setup editor with visual data");
244
244
  return { success: !0, fromCache: f };
@@ -254,7 +254,7 @@ function de() {
254
254
  n,
255
255
  a,
256
256
  p,
257
- N,
257
+ A,
258
258
  s,
259
259
  d,
260
260
  m,
@@ -266,11 +266,11 @@ function de() {
266
266
  F,
267
267
  w,
268
268
  C,
269
- O,
270
- D,
269
+ x,
270
+ B,
271
271
  I,
272
272
  W,
273
- L
273
+ D
274
274
  ]
275
275
  ), k = V(
276
276
  async (l) => {
@@ -281,23 +281,23 @@ function de() {
281
281
  success: !1,
282
282
  error: "No sheet selected. Please select a sheet first."
283
283
  };
284
- const { data: f, fromCache: P } = await M(
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
- ), j = (f == null ? void 0 : f.frameObject) ?? ((g = f == null ? void 0 : f.visual) == null ? void 0 : g.frameObject);
290
- if (!j)
289
+ ), P = (f == null ? void 0 : f.frameObject) ?? ((g = f == null ? void 0 : f.visual) == null ? void 0 : g.frameObject);
290
+ if (!P)
291
291
  return { success: !1, error: "Visual has no frame data" };
292
- const E = H(j);
292
+ const E = H(P);
293
293
  if (!(E != null && E.cards) || E.cards.length === 0)
294
294
  return { success: !1, error: "Visual frame is malformed" };
295
- const B = {
295
+ const j = {
296
296
  ...q(E),
297
297
  visualId: l.id
298
298
  // Link this frame to the library visual
299
299
  };
300
- return x(I, B, "end"), p(!0), A(B.id), R(!1), { success: !0, fromCache: P };
300
+ return O(I, j, "end"), p(!0), N(j.id), R(!1), { success: !0, fromCache: L };
301
301
  } catch (f) {
302
302
  return console.error("Error adding visual:", f), { success: !1, error: "Failed to add visual to dashboard" };
303
303
  }
@@ -308,9 +308,9 @@ function de() {
308
308
  r,
309
309
  i,
310
310
  I,
311
- x,
311
+ O,
312
312
  p,
313
- A,
313
+ N,
314
314
  R
315
315
  ]
316
316
  );
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DKPrD9E9.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-BXm1zeXQ.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-DxPc6NRF.js";
1
+ import { D as a } from "../chunks/index-CO0YJSQz.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,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DKPrD9E9.js"),E=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),j=require("./chunks/resource-management-panel-CegmHckB.js"),c=require("./chunks/dashboard-export-dialog-DmiGLzpJ.js");require("react-dom");function P(r){const t=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(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}return t.default=r,Object.freeze(t)}const C=P(g);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BXm1zeXQ.js"),E=require("./types/index.cjs"),a=require("react/jsx-runtime"),x=require("react"),j=require("./chunks/resource-management-panel-C7J2WWQy.js"),c=require("./chunks/dashboard-export-dialog-CT050NhP.js");require("react-dom");function M(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=M(x);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const M=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function N(r){const{displayPreferences:t,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsx(e.SemaphorContextProvider,{dashboardProps:i,children:a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:t,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})})})}function A({cardId:r}){const t=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=g.useMemo(()=>{const n=t==null?void 0:t.flatMap(o=>o.frames),l=n==null?void 0:n.flatMap(o=>o==null?void 0:o.cards),m=l==null?void 0:l.find(o=>(o==null?void 0:o.id)===r),f=n==null?void 0:n.find(o=>{var p;return(p=o==null?void 0:o.cards)==null?void 0:p.find(u=>(u==null?void 0:u.id)===r)});return{card:m,frame:f}},[t,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:r,items:t,value:s,onChange:i,isLoading:n,isError:l,refetch:m,className:f,icon:o,showNone:p=!1}){const u=C.useRef(null),[b,x]=C.useState(!1),[y,v]=C.useState("100%"),D=p?[...t||[],{id:"none",name:"None"}]:t;C.useLayoutEffect(()=>{u.current&&v(u.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":l?"Error":s?(d=t==null?void 0:t.find(h=>h.id===s))==null?void 0:d.name:`Select ${r}`}function S(d,h){i(h),x(!1)}return a.jsxs(e.Popover,{open:b,onOpenChange:x,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,variant:"outline",role:"combobox","aria-expanded":b,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[o&&a.jsx("div",{className:"mr-2",children:o}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:m,children:a.jsx(M,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:h=>S(h,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useManagementStore=e.useManagementStore;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=E.EMPTY_SELECTION;exports.ResourceManagementPanel=j.ResourceManagementPanel;exports.AdvancedModeToggle=c.AdvancedModeToggle;exports.DashboardExportDialog=c.DashboardExportDialog;exports.ScheduleDashboard=c.ScheduleDashboard;exports.UnsavedChangesAlert=c.UnsavedChangesAlert;exports.VisualEditingControls=c.VisualEditingControls;exports.usePristineSnapshotInitializer=c.usePristineSnapshotInitializer;exports.Combobox=k;exports.Visual=N;
6
+ */const P=e.createLucideIcon("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function N(r){const{displayPreferences:o,...s}=r,i={...s,id:r.dashboardId};return a.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:a.jsx(e.SemaphorContextProvider,{dashboardProps:i,children:a.jsx(e.UXProvider,{children:a.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:a.jsx(e.Container,{type:"visual",...i,children:a.jsx(A,{cardId:r.cardId})})})})})})}function A({cardId:r}){const o=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:s,frame:i}=x.useMemo(()=>{const n=o==null?void 0:o.flatMap(t=>t.frames),l=n==null?void 0:n.flatMap(t=>t==null?void 0:t.cards),C=l==null?void 0:l.find(t=>(t==null?void 0:t.id)===r),f=n==null?void 0:n.find(t=>{var p;return(p=t==null?void 0:t.cards)==null?void 0:p.find(u=>(u==null?void 0:u.id)===r)});return{card:C,frame:f}},[o,r]);return!s||!i?a.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):a.jsx("main",{className:"flex h-full grow flex-col",children:a.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>a.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:a.jsx(e.DashboardCard,{card:s,frame:i})})})}function k({name:r,items:o,value:s,onChange:i,isLoading:n,isError:l,refetch:C,className:f,icon:t,showNone:p=!1}){const u=m.useRef(null),[b,g]=m.useState(!1),[y,v]=m.useState("100%"),D=p?[...o||[],{id:"none",name:"None"}]:o;m.useLayoutEffect(()=>{u.current&&v(u.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":l?"Error":s?(d=o==null?void 0:o.find(h=>h.id===s))==null?void 0:d.name:`Select ${r}`}function S(d,h){i(h),g(!1)}return a.jsxs(e.Popover,{open:b,onOpenChange:g,children:[a.jsx(e.PopoverTrigger,{asChild:!0,children:a.jsxs(e.Button,{ref:u,variant:"outline",role:"combobox","aria-expanded":b,className:e.cn("flex h-9 w-full justify-between",f),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx("div",{className:"mr-2",children:t}),a.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),a.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),a.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:a.jsxs(e.Command,{children:[a.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[a.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),a.jsx(e.IconButton,{className:"h-7",onClick:C,children:a.jsx(P,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),a.jsxs(e.CommandList,{children:[a.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),a.jsx(e.CommandGroup,{children:D==null?void 0:D.map(d=>a.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:h=>S(h,d.id),children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),a.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardWC=e.DashboardWC;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.Surfboard=e.DashboardPlus;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.getColumnDataType=e.getColumnDataType;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.invalidateToken=e.invalidateToken;exports.isBooleanDataType=e.isBooleanDataType;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedField=e.isCalculatedField;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isColumnInSqlGen=e.isColumnInSqlGen;exports.isDateDataType=e.isDateDataType;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useCard=e.useCard;exports.useCurrentActiveCard=e.useCurrentActiveCard;exports.useCurrentCardConfig=e.useCurrentCardConfig;exports.useCurrentSheetActiveCards=e.useCurrentSheetActiveCards;exports.useDashboardActions=e.useDashboardActions;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardStore=e.useDashboardStore;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=E.EMPTY_SELECTION;exports.ResourceManagementPanel=j.ResourceManagementPanel;exports.AdvancedModeToggle=c.AdvancedModeToggle;exports.DashboardExportDialog=c.DashboardExportDialog;exports.ScheduleDashboard=c.ScheduleDashboard;exports.UnsavedChangesAlert=c.UnsavedChangesAlert;exports.VisualEditingControls=c.VisualEditingControls;exports.usePristineSnapshotInitializer=c.usePristineSnapshotInitializer;exports.Combobox=k;exports.Visual=N;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { b as T, E as y, F as P, S as w, U as M, m as k, n as A, u as F, o as g, p as L, P as R, q as I, B as V, c as v, r as _, s as U, t as B, v as W, I as j, w as q, x as z, y as O, z as Q, C as G } from "./chunks/index-DxPc6NRF.js";
2
- import { _ as oa, $ as na, D as ta, O as ia, a3 as la, R as da, K as ca, K as ua, M as ha, a as pa, V as fa, am as ma, aa as Ca, Y as va, Q as ba, T as Da, a4 as ga, ac as ya, ab as xa, af as Ea, ag as Na, a9 as Sa, W as Ta, a8 as Pa, a1 as wa, a2 as Ma, a0 as ka, ad as Aa, a7 as Fa, a6 as La, a5 as Ra, ah as Ia, ae as Va, N as _a, aj as Ua, al as Ba, ak as Wa, g as ja, G as qa, Z as za, H as Oa, e as Qa, ai as Ga, f as Ha, A as Ka, J as Ya } from "./chunks/index-DxPc6NRF.js";
3
- import { EMPTY_SELECTION as Ja } from "./types/index.js";
4
- import { jsx as a, jsxs as l } from "react/jsx-runtime";
1
+ import { l as T, E as g, F as w, S as M, U as P, v as k, w as A, u as F, x as y, y as L, P as R, z as I, B as V, c as v, A as _, G as B, H as U, I as W, J as j, K as q, M as z, N as O, O as Q, C as G } from "./chunks/index-CO0YJSQz.js";
2
+ import { a8 as oa, a9 as na, D as ta, a1 as ia, ad as da, T as la, Y as ca, Y as ua, Z as ha, a as pa, a4 as ma, aw as fa, ak as Ca, a6 as va, a2 as Da, a3 as ba, ae as ya, am as ga, al as xa, ap as Ea, aq as Na, aj as Sa, a5 as Ta, ai as wa, ab as Ma, ac as Pa, aa as ka, an as Aa, ah as Fa, ag as La, af as Ra, ar as Ia, ao as Va, a0 as _a, at as Ba, av as Ua, au as Wa, o as ja, $ as qa, R as za, a7 as Oa, V as Qa, m as Ga, as as Ha, n as Ya, Q as Ka, _ as $a, W as Ja } from "./chunks/index-CO0YJSQz.js";
3
+ import { EMPTY_SELECTION as Za } from "./types/index.js";
4
+ import { jsx as a, jsxs as d } from "react/jsx-runtime";
5
5
  import * as p from "react";
6
6
  import { useMemo as H } from "react";
7
- import { ResourceManagementPanel as Za } from "./chunks/resource-management-panel-MW870OP_.js";
8
- import { A as ee, D as se, S as re, U as oe, V as ne, u as te } from "./chunks/dashboard-export-dialog-CgY7xu9K.js";
7
+ import { ResourceManagementPanel as ee } from "./chunks/resource-management-panel-DTJwukgb.js";
8
+ import { A as re, D as oe, S as ne, U as te, V as ie, u as de } from "./chunks/dashboard-export-dialog-CIzU-4eS.js";
9
9
  import "react-dom";
10
10
  /**
11
11
  * @license lucide-react v0.453.0 - ISC
@@ -13,35 +13,35 @@ import "react-dom";
13
13
  * This source code is licensed under the ISC license.
14
14
  * See the LICENSE file in the root directory of this source tree.
15
15
  */
16
- const K = T("RefreshCw", [
16
+ const Y = T("RefreshCw", [
17
17
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
18
18
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
19
19
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
20
20
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
21
21
  ]);
22
22
  function aa(s) {
23
- const { displayPreferences: o, ...i } = s, d = {
23
+ const { displayPreferences: o, ...i } = s, l = {
24
24
  ...i,
25
25
  id: s.dashboardId
26
26
  // override the id to the dashboard id so that the dashboard is not loaded
27
27
  };
28
- return /* @__PURE__ */ a(y, { FallbackComponent: P, children: /* @__PURE__ */ a(w, { dashboardProps: d, children: /* @__PURE__ */ a(M, { children: /* @__PURE__ */ a(k, { displayPreferences: o, children: /* @__PURE__ */ a(A, { type: "visual", ...d, children: /* @__PURE__ */ a(Y, { cardId: s.cardId }) }) }) }) }) });
28
+ return /* @__PURE__ */ a(g, { FallbackComponent: w, children: /* @__PURE__ */ a(M, { dashboardProps: l, children: /* @__PURE__ */ a(P, { children: /* @__PURE__ */ a(k, { displayPreferences: o, children: /* @__PURE__ */ a(A, { type: "visual", ...l, children: /* @__PURE__ */ a(K, { cardId: s.cardId }) }) }) }) }) });
29
29
  }
30
- function Y({ cardId: s }) {
30
+ function K({ cardId: s }) {
31
31
  const o = F((r) => {
32
32
  var n;
33
33
  return (n = r.dashboard) == null ? void 0 : n.sheets;
34
- }), { card: i, frame: d } = H(() => {
35
- const r = o == null ? void 0 : o.flatMap((e) => e.frames), n = r == null ? void 0 : r.flatMap((e) => e == null ? void 0 : e.cards), f = n == null ? void 0 : n.find((e) => (e == null ? void 0 : e.id) === s), m = r == null ? void 0 : r.find(
34
+ }), { card: i, frame: l } = H(() => {
35
+ const r = o == null ? void 0 : o.flatMap((e) => e.frames), n = r == null ? void 0 : r.flatMap((e) => e == null ? void 0 : e.cards), m = n == null ? void 0 : n.find((e) => (e == null ? void 0 : e.id) === s), f = r == null ? void 0 : r.find(
36
36
  (e) => {
37
37
  var h;
38
38
  return (h = e == null ? void 0 : e.cards) == null ? void 0 : h.find((c) => (c == null ? void 0 : c.id) === s);
39
39
  }
40
40
  );
41
- return { card: f, frame: m };
41
+ return { card: m, frame: f };
42
42
  }, [o, s]);
43
- return !i || !d ? /* @__PURE__ */ a(
44
- g,
43
+ return !i || !l ? /* @__PURE__ */ a(
44
+ y,
45
45
  {
46
46
  error: new Error("Card not found"),
47
47
  resetErrorBoundary: () => {
@@ -49,20 +49,20 @@ function Y({ cardId: s }) {
49
49
  customerFacingMessage: `Card not found with ID: ${s}`
50
50
  }
51
51
  ) : /* @__PURE__ */ a("main", { className: "flex h-full grow flex-col", children: /* @__PURE__ */ a(
52
- y,
52
+ g,
53
53
  {
54
54
  FallbackComponent: ({
55
55
  error: r,
56
56
  resetErrorBoundary: n
57
57
  }) => /* @__PURE__ */ a(
58
- g,
58
+ y,
59
59
  {
60
60
  error: r,
61
61
  resetErrorBoundary: n,
62
62
  customerFacingMessage: "Error creating visual. Please try again."
63
63
  }
64
64
  ),
65
- children: /* @__PURE__ */ a(L, { card: i, frame: d })
65
+ children: /* @__PURE__ */ a(L, { card: i, frame: l })
66
66
  }
67
67
  ) });
68
68
  }
@@ -70,15 +70,15 @@ function ea({
70
70
  name: s,
71
71
  items: o,
72
72
  value: i,
73
- onChange: d,
73
+ onChange: l,
74
74
  isLoading: r,
75
75
  isError: n,
76
- refetch: f,
77
- className: m,
76
+ refetch: m,
77
+ className: f,
78
78
  icon: e,
79
79
  showNone: h = !1
80
80
  }) {
81
- const c = p.useRef(null), [b, D] = p.useState(!1), [x, E] = p.useState("100%"), C = h ? [...o || [], { id: "none", name: "None" }] : o;
81
+ const c = p.useRef(null), [D, b] = p.useState(!1), [x, E] = p.useState("100%"), C = h ? [...o || [], { id: "none", name: "None" }] : o;
82
82
  p.useLayoutEffect(() => {
83
83
  c.current && E(c.current.offsetWidth);
84
84
  }, []);
@@ -87,19 +87,19 @@ function ea({
87
87
  return r ? "Loading..." : n ? "Error" : i ? (t = o == null ? void 0 : o.find((u) => u.id === i)) == null ? void 0 : t.name : `Select ${s}`;
88
88
  }
89
89
  function S(t, u) {
90
- d(u), D(!1);
90
+ l(u), b(!1);
91
91
  }
92
- return /* @__PURE__ */ l(R, { open: b, onOpenChange: D, children: [
93
- /* @__PURE__ */ a(I, { asChild: !0, children: /* @__PURE__ */ l(
92
+ return /* @__PURE__ */ d(R, { open: D, onOpenChange: b, children: [
93
+ /* @__PURE__ */ a(I, { asChild: !0, children: /* @__PURE__ */ d(
94
94
  V,
95
95
  {
96
96
  ref: c,
97
97
  variant: "outline",
98
98
  role: "combobox",
99
- "aria-expanded": b,
100
- className: v("flex h-9 w-full justify-between", m),
99
+ "aria-expanded": D,
100
+ className: v("flex h-9 w-full justify-between", f),
101
101
  children: [
102
- /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
102
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
103
103
  e && /* @__PURE__ */ a("div", { className: "mr-2", children: e }),
104
104
  /* @__PURE__ */ a("span", { className: "max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap", children: N() })
105
105
  ] }),
@@ -108,15 +108,15 @@ function ea({
108
108
  }
109
109
  ) }),
110
110
  /* @__PURE__ */ a(
111
- U,
111
+ B,
112
112
  {
113
113
  className: "w-full p-0",
114
114
  style: { minWidth: x },
115
- children: /* @__PURE__ */ l(B, { children: [
116
- /* @__PURE__ */ l("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
115
+ children: /* @__PURE__ */ d(U, { children: [
116
+ /* @__PURE__ */ d("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
117
117
  /* @__PURE__ */ a(W, { className: "h-9", placeholder: "Search..." }),
118
- /* @__PURE__ */ a(j, { className: "h-7", onClick: f, children: /* @__PURE__ */ a(
119
- K,
118
+ /* @__PURE__ */ a(j, { className: "h-7", onClick: m, children: /* @__PURE__ */ a(
119
+ Y,
120
120
  {
121
121
  className: v(
122
122
  "size-3.5 opacity-50",
@@ -125,8 +125,8 @@ function ea({
125
125
  }
126
126
  ) })
127
127
  ] }),
128
- /* @__PURE__ */ l(q, { children: [
129
- /* @__PURE__ */ l(z, { children: [
128
+ /* @__PURE__ */ d(q, { children: [
129
+ /* @__PURE__ */ d(z, { children: [
130
130
  "No ",
131
131
  s == null ? void 0 : s.toLowerCase(),
132
132
  " found."
@@ -137,7 +137,7 @@ function ea({
137
137
  className: "overflow-x-auto",
138
138
  value: t.name,
139
139
  onSelect: (u) => S(u, t.id),
140
- children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
140
+ children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
141
141
  /* @__PURE__ */ a(
142
142
  G,
143
143
  {
@@ -159,42 +159,42 @@ function ea({
159
159
  ] });
160
160
  }
161
161
  export {
162
- ee as AdvancedModeToggle,
162
+ re as AdvancedModeToggle,
163
163
  oa as CALCULATED_FIELD_ENTITY_MARKER,
164
164
  ea as Combobox,
165
165
  na as DATE_FORMAT_VALUES,
166
166
  ta as Dashboard,
167
- se as DashboardExportDialog,
167
+ oe as DashboardExportDialog,
168
168
  ia as DashboardWC,
169
- Ja as EMPTY_SELECTION,
170
- la as PivotMarkerEnum,
171
- Za as ResourceManagementPanel,
172
- da as ResourceType,
173
- re as ScheduleDashboard,
174
- w as SemaphorContextProvider,
169
+ Za as EMPTY_SELECTION,
170
+ da as PivotMarkerEnum,
171
+ ee as ResourceManagementPanel,
172
+ la as ResourceType,
173
+ ne as ScheduleDashboard,
174
+ M as SemaphorContextProvider,
175
175
  ca as SemaphorDataProvider,
176
176
  ua as SemaphorQueryClient,
177
177
  ha as ShareDialog,
178
178
  pa as Surfboard,
179
- oe as UnsavedChangesAlert,
179
+ te as UnsavedChangesAlert,
180
180
  aa as Visual,
181
- ne as VisualEditingControls,
182
- fa as cloneDeep,
183
- ma as createEmptyKpiConfig,
181
+ ie as VisualEditingControls,
182
+ ma as cloneDeep,
183
+ fa as createEmptyKpiConfig,
184
184
  Ca as createSqlGenConfig,
185
185
  va as downloadPdf,
186
- ba as emitDashboardLoad,
187
- Da as emitDashboardUnload,
188
- ga as fmt,
189
- ya as getColumnDataType,
186
+ Da as emitDashboardLoad,
187
+ ba as emitDashboardUnload,
188
+ ya as fmt,
189
+ ga as getColumnDataType,
190
190
  xa as getFilterValueType,
191
191
  Ea as getFormattedTableNameForQuery,
192
192
  Na as getQualifiedTableName,
193
193
  Sa as getSql,
194
194
  Ta as invalidateToken,
195
- Pa as isBooleanDataType,
196
- wa as isCalculatedDimension,
197
- Ma as isCalculatedField,
195
+ wa as isBooleanDataType,
196
+ Ma as isCalculatedDimension,
197
+ Pa as isCalculatedField,
198
198
  ka as isCalculatedMetric,
199
199
  Aa as isColumnInSqlGen,
200
200
  Fa as isDateDataType,
@@ -203,18 +203,20 @@ export {
203
203
  Ia as resolveDataType,
204
204
  Va as resolveDatamodelName,
205
205
  _a as useCard,
206
- Ua as useCurrentActiveCard,
207
- Ba as useCurrentCardConfig,
206
+ Ba as useCurrentActiveCard,
207
+ Ua as useCurrentCardConfig,
208
208
  Wa as useCurrentSheetActiveCards,
209
209
  ja as useDashboardActions,
210
- qa as useDashboardQuery,
210
+ qa as useDashboardById,
211
+ za as useDashboardQuery,
211
212
  F as useDashboardStore,
212
- za as useDataColumns,
213
- Oa as useDateFilterHook,
214
- Qa as useEditorActions,
215
- Ga as useEditorAside,
216
- Ha as useEditorStore,
213
+ Oa as useDataColumns,
214
+ Qa as useDateFilterHook,
215
+ Ga as useEditorActions,
216
+ Ha as useEditorAside,
217
+ Ya as useEditorStore,
217
218
  Ka as useManagementStore,
218
- te as usePristineSnapshotInitializer,
219
- Ya as useTextFilterHook
219
+ de as usePristineSnapshotInitializer,
220
+ $a as useResourceManagement,
221
+ Ja as useTextFilterHook
220
222
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DKPrD9E9.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-BXm1zeXQ.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-DxPc6NRF.js";
1
+ import { a } from "../chunks/index-CO0YJSQz.js";
2
2
  import { EMPTY_SELECTION as E } from "../types/index.js";
3
3
  export {
4
4
  E as EMPTY_SELECTION,
@@ -11,6 +11,8 @@ import * as React_2 from 'react';
11
11
  import { RefetchOptions } from '@tanstack/query-core';
12
12
  import { StoreApi } from 'zustand';
13
13
  import { UseBoundStore } from 'zustand';
14
+ import { UseMutateFunction } from '@tanstack/react-query';
15
+ import { UseQueryResult } from '@tanstack/react-query';
14
16
  import { WritableDraft } from 'immer';
15
17
 
16
18
  declare type Actions = {
@@ -670,6 +672,12 @@ export declare type ContainerId = 'groupBy' | 'metrics' | 'pivotBy' | 'sortBy' |
670
672
  */
671
673
  export declare const createEmptyKpiConfig: () => CardConfig;
672
674
 
675
+ declare interface CreateResourceRequest {
676
+ title: string;
677
+ description?: string;
678
+ isPrivate?: boolean;
679
+ }
680
+
673
681
  export declare function createSqlGenConfig(column: TDataColumn, preSqlGen: SqlGen, calc?: AggregateCalc): SqlGen;
674
682
 
675
683
  export declare type CustomCard = CardWithContent | CardWithFooter;
@@ -1917,7 +1925,7 @@ export declare function resolveDatamodelName(datamodelName: string): string;
1917
1925
 
1918
1926
  export declare const resolveDataType: (value: any) => string;
1919
1927
 
1920
- declare interface ResourceListItem {
1928
+ export declare interface ResourceListItem {
1921
1929
  id: string;
1922
1930
  title: string;
1923
1931
  description: string;
@@ -2001,6 +2009,18 @@ declare interface ShareDialogProps {
2001
2009
  onRemoveSuccess?: () => void;
2002
2010
  }
2003
2011
 
2012
+ declare interface ShareResourceRequest {
2013
+ shares: Array<{
2014
+ scope: ShareScope;
2015
+ tenantId?: string;
2016
+ tenantUserId?: string;
2017
+ role: 'VIEWER' | 'EDITOR' | 'CONTRIBUTOR' | 'OWNER' | 'NONE';
2018
+ }>;
2019
+ message?: string;
2020
+ }
2021
+
2022
+ declare type ShareScope = 'specific_tenant_user' | 'all_tenant_users' | 'specific_org_user' | 'all_org_users' | 'org_users_only' | 'all_tenants_only';
2023
+
2004
2024
  export declare interface SortByField extends Field {
2005
2025
  role: 'sortby';
2006
2026
  direction: 'asc' | 'desc';
@@ -2976,6 +2996,16 @@ declare type UnsavedChangesAlertProps = {
2976
2996
  isSaving: boolean;
2977
2997
  };
2978
2998
 
2999
+ declare interface UpdateDashboardTemplateRequest {
3000
+ template: TDashboard;
3001
+ }
3002
+
3003
+ declare interface UpdateResourceRequest {
3004
+ title?: string;
3005
+ description?: string;
3006
+ isPrivate?: boolean;
3007
+ }
3008
+
2979
3009
  export declare interface UpdateUserPreferenceRequest {
2980
3010
  defaultDashboardId: string | null;
2981
3011
  }
@@ -3034,6 +3064,10 @@ export declare const useCurrentSheetActiveCards: () => TCard[];
3034
3064
 
3035
3065
  export declare const useDashboardActions: () => Actions_2;
3036
3066
 
3067
+ export declare function useDashboardById(dashboardId: string, options?: {
3068
+ enabled?: boolean;
3069
+ }): UseQueryResult<any, Error>;
3070
+
3037
3071
  export declare function useDashboardQuery(): {
3038
3072
  data: GetDashboardResponse | null | undefined;
3039
3073
  isLoading: boolean;
@@ -3134,6 +3168,39 @@ setState(nextStateOrUpdater: ManagementStore | Partial<ManagementStore> | ((stat
3134
3168
  */
3135
3169
  export declare function usePristineSnapshotInitializer(isDashboardEditing: boolean, dashboardState: TDashboard, pristineDashboard: TDashboard | null, setPristineDashboard: (dashboard: TDashboard) => void): void;
3136
3170
 
3171
+ export declare function useResourceManagement(resourceType: ResourceType, onDeleteSuccess?: () => void, onCreateSuccess?: (data?: any) => void): {
3172
+ resources: any;
3173
+ isLoading: boolean;
3174
+ isError: boolean;
3175
+ isFetching: boolean;
3176
+ error: Error | null;
3177
+ createResource: UseMutateFunction<any, Error, CreateResourceRequest, void>;
3178
+ updateResource: UseMutateFunction<any, Error, {
3179
+ resourceId: string;
3180
+ data: UpdateResourceRequest | UpdateDashboardTemplateRequest;
3181
+ }, void>;
3182
+ deleteResource: UseMutateFunction<any, Error, string, void>;
3183
+ duplicateResource: UseMutateFunction<any, Error, string, void>;
3184
+ shareResource: UseMutateFunction<any, Error, {
3185
+ resourceType: ResourceType;
3186
+ resourceId: string;
3187
+ data: ShareResourceRequest;
3188
+ }, void>;
3189
+ removeResourceShares: UseMutateFunction<any, Error, {
3190
+ resourceType: ResourceType;
3191
+ resourceId: string;
3192
+ data: ShareResourceRequest;
3193
+ }, void>;
3194
+ isCreating: boolean;
3195
+ isUpdating: boolean;
3196
+ isDeleting: boolean;
3197
+ isDuplicating: boolean;
3198
+ isSharing: boolean;
3199
+ isRemovingShares: boolean;
3200
+ isUpdatingShares: boolean;
3201
+ refetch: (options?: RefetchOptions) => Promise<QueryObserverResult<any, Error>>;
3202
+ };
3203
+
3137
3204
  export declare interface UserPreference {
3138
3205
  id: string;
3139
3206
  actorType: 'ORG_USER' | 'TENANT_USER';