react-semaphor 0.1.159 → 0.1.162

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-DIo_VMBS.js → dashboard-controls-4GSRkLCI.js} +6 -6
  2. package/dist/chunks/{dashboard-controls-DnlJRUpY.js → dashboard-controls-CeSBs5Hq.js} +191 -190
  3. package/dist/chunks/{dashboard-export-dialog-CZhtshog.js → dashboard-export-dialog-D514_qGz.js} +1 -1
  4. package/dist/chunks/{dashboard-export-dialog-D6bmvl-v.js → dashboard-export-dialog-MpHrSiyY.js} +22 -22
  5. package/dist/chunks/{dashboard-json-Bagczd1F.js → dashboard-json-O63iXsoj.js} +1 -1
  6. package/dist/chunks/{dashboard-json-D1jy0qDk.js → dashboard-json-UCoG-_cW.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-ANoND-SH.js → edit-dashboard-visual-DsBEfgxL.js} +1 -1
  8. package/dist/chunks/{edit-dashboard-visual-B6Q0AUbn.js → edit-dashboard-visual-E6Kq46ex.js} +656 -656
  9. package/dist/chunks/{editor-action-buttons-CMNOhq91.js → editor-action-buttons-CMCgCcUE.js} +2 -2
  10. package/dist/chunks/{editor-action-buttons-B1yfEUpI.js → editor-action-buttons-Cm7pHxM_.js} +1 -1
  11. package/dist/chunks/{index-CMymongy.js → index-B9l7fpA-.js} +18375 -18463
  12. package/dist/chunks/{index-Dy-VUjSy.js → index-oMb4lVSV.js} +222 -222
  13. package/dist/chunks/{resource-management-panel-BPl4Mk9m.js → resource-management-panel-BxvT3mn3.js} +343 -335
  14. package/dist/chunks/resource-management-panel-yBYy59zu.js +6 -0
  15. package/dist/chunks/use-role-aware-display-preferences-97_9jIzt.js +29 -0
  16. package/dist/chunks/use-role-aware-display-preferences-jONtUniC.js +1 -0
  17. package/dist/chunks/{use-visual-utils-BH4FZWUV.js → use-visual-utils-D6xUgbea.js} +1 -1
  18. package/dist/chunks/{use-visual-utils-H7arppWh.js → use-visual-utils-lD1p2yII.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--vwXhI58.js +0 -6
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-oMb4lVSV.js"),c=require("react"),de=require("./use-visual-utils-D6xUgbea.js"),pe=require("./use-role-aware-display-preferences-jONtUniC.js");/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const fe=t.createLucideIcon("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);function ge(s,f={}){const{enabled:m=!0,eventType:r="mousedown"}=f,o=c.useRef(null);return c.useEffect(()=>{const g=j=>{const a=j.target;o.current&&o.current.contains(a)||a instanceof Element&&(a.closest("[data-radix-popper-content-wrapper]")||a.closest("[data-radix-select-content]")||a.closest("[data-radix-popover-content]")||a.closest("[data-radix-dropdown-menu-content]")||a.closest("[data-radix-tooltip-content]")||a.closest('[role="listbox"]')||a.closest('[role="option"]')||a.closest('[role="combobox"]'))||a instanceof Element&&a.hasAttribute("data-radix-")||s()};return m&&document.addEventListener(r,g),()=>{document.removeEventListener(r,g)}},[s,m,r]),o}function ce(){return e.jsx("div",{className:"space-y-1 px-2 py-2",children:[...Array(5)].map((s,f)=>e.jsxs("div",{className:"flex animate-pulse items-start gap-3 rounded-md px-2 py-2",children:[e.jsx("div",{className:"mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-3/5 rounded bg-muted/60"}),e.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40"})]})]},f))})}const je=s=>{const f=t.useDashboardStore(o=>o.isVisualEditing),m=t.useDashboardStore(o=>o.selectedFrameId),r=t.useEditorStore(o=>o.frame);return!!(f&&m&&(r==null?void 0:r.visualId)===s)};function De({visual:s,isDeleting:f,isDuplicating:m,onAddVisual:r,onOpenVisual:o,onEditDetails:g,onDeleteClick:j,onDuplicateVisual:a,onShareVisual:D,formatDate:y}){var T,S,M,C;const{selectVisual:d}=t.useManagementActions(),u=t.useIsVisualSelected(s.id),x=je(s.id),{isConsoleMode:b}=t.useDashboardPreferences(),E=c.useRef(null),[w,v]=c.useState(!1),[A,V]=c.useState(!1);c.useEffect(()=>{m?(v(!0),V(!0)):A&&(v(!1),V(!1))},[m,A]),c.useEffect(()=>{x&&E.current&&E.current.scrollIntoView({behavior:"smooth",block:"center"})},[x]);const O=()=>{d(s),o==null||o(s)};return e.jsxs("div",{ref:E,className:t.cn("group flex cursor-pointer items-start gap-3 rounded-md px-2 py-2 transition-colors hover:bg-muted",x?"bg-purple-500/10":u&&"bg-muted/80"),onClick:O,children:[e.jsx(t.ChartLine,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-muted-foreground/50"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",title:s.title||"Untitled Visual",children:s.title||"Untitled Visual"}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:s.description||"No description",children:(T=s.description)!=null&&T.trim()?s.description:"No description"})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",onClick:p=>p.stopPropagation(),children:[e.jsx("div",{className:"opacity-0 transition-opacity group-hover:opacity-100",children:e.jsxs(t.DropdownMenu,{modal:!1,open:w,onOpenChange:v,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",children:e.jsx(t.EllipsisVertical,{className:"h-3 w-3"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",className:"z-[51] w-40",children:[e.jsxs(t.DropdownMenuItem,{onClick:p=>{p.stopPropagation(),r(s)},children:[e.jsx(t.Plus,{className:"mr-2 h-3 w-3"}),"Add"]}),e.jsxs(t.DropdownMenuItem,{onClick:p=>{p.stopPropagation(),o==null||o(s)},children:[e.jsx(fe,{className:"mr-2 h-3 w-3"}),"Open"]}),e.jsxs(t.DropdownMenuItem,{onClick:p=>{p.preventDefault(),p.stopPropagation(),a(s.id)},disabled:m,children:[m?e.jsx(t.LoaderCircle,{className:"mr-2 h-3 w-3 animate-spin"}):e.jsx(t.Copy,{className:"mr-2 h-3 w-3"}),m?"Duplicating...":"Duplicate"]}),s.ownership.isOwner&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:p=>{p.stopPropagation(),g==null||g(s)},children:[e.jsx(t.PenLine,{className:"mr-2 h-3 w-3"}),"Edit details"]}),e.jsxs(t.DropdownMenuItem,{onClick:p=>{p.stopPropagation(),D(s)},children:[e.jsx(t.Users,{className:"mr-2 h-3 w-3"}),"Share"]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs(t.DropdownMenuItem,{onClick:p=>{p.stopPropagation(),j(s)},className:"text-destructive",disabled:f,children:[e.jsx(t.Trash2,{className:"mr-2 h-3 w-3"}),f?"Deleting...":"Delete"]})]}),e.jsx(t.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400",children:[(((S=s.ownership.createdBy)==null?void 0:S.type)==="tenant"||((M=s.ownership.createdBy)==null?void 0:M.type)==="organization"&&b)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.User,{className:"h-3 w-3"}),e.jsx("span",{children:((C=s.ownership.createdBy)==null?void 0:C.name)||"Unknown"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:y(s.lastModified)})]})]})]})]})}),e.jsx(t.IconButton,{tooltip:"Add to dashboard",buttonProps:{variant:"ghost",size:"sm",onClick:p=>{p.stopPropagation(),r(s)}},className:"h-6 w-6 p-0",children:e.jsx(t.Plus,{className:"h-3.5 w-3.5"})})]})]})})]},s.id)}function Ne({searchQuery:s}){const[f,m]=c.useState(!1),[r,o]=c.useState(null),[g,j]=c.useState(!1),[a,D]=c.useState(null),[y,d]=c.useState(null),[u,x]=c.useState(null),{selectVisual:b}=t.useManagementActions(),{handleEditLibraryVisual:E,handleAddLibraryVisual:w}=de.useVisualUtils(),{resources:v,isLoading:A,isError:V,isFetching:O,updateResource:T,deleteResource:S,duplicateResource:M,isDeleting:C,isDuplicating:p,isUpdating:B}=t.useVisualManagement(()=>{j(!1),D(null)});t.useCurrentUserInfo();const Q=v.filter(i=>{var L,l;return((L=i==null?void 0:i.title)==null?void 0:L.toLowerCase().includes(s.toLowerCase()))||((l=i==null?void 0:i.description)==null?void 0:l.toLowerCase().includes(s.toLowerCase()))}),U=i=>new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),K=i=>{D(i),j(!0)},q=()=>{a&&S(a.id)},{startUpdating:X,stopUpdating:R,isUpdating:Z}=t.useResourceUpdateState(),$=(i,L,l)=>{var ee;const W=Object.fromEntries(Object.entries(L).filter(([,I])=>I!==void 0));if(Object.keys(W).length===0){(ee=l==null?void 0:l.onSuccess)==null||ee.call(l);return}const Y=Object.keys(W),J=Y.length===1?Y[0]:void 0;X(i,J),T({resourceId:i,data:W},{onSuccess:()=>{var I;R(i,J),(I=l==null?void 0:l.onSuccess)==null||I.call(l)},onError:()=>{var I;R(i,J),(I=l==null?void 0:l.onError)==null||I.call(l)}})},z=i=>{d(i),M(i,{onSettled:()=>d(null)})},F=i=>{E(i)},_=i=>{w(i)},N=i=>{const L=v.find(l=>l.id===i);L&&T({resourceId:i,data:{isPrivate:!L.isPrivate}})},G=i=>{o(i),m(!0)},k=i=>{x(i)},te=()=>{x(null)},se=({title:i,description:L})=>{if(!u)return;const l={};i!==u.title&&(l.title=i),(u.description||"")!==L&&(l.description=L),$(u.id,l,{onSuccess:()=>{x(null)}})};return A?e.jsx(ce,{}):V?e.jsx(t.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"text-sm text-destructive",children:"Failed to load visuals"}),e.jsx(t.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>window.location.reload(),children:"Retry"})]})}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-3 overflow-y-auto",children:Q.length===0?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx("div",{className:"mb-3",children:e.jsx(t.Grid3x3,{className:"mx-auto h-12 w-12 text-muted-foreground/50"})}),e.jsx("h3",{className:"mb-1 font-medium text-foreground",children:s?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s?"Try adjusting your search":'Click "Create" above to add your first visual'})]}):Q.map(i=>e.jsx(De,{visual:i,onAddVisual:_,onOpenVisual:F,onEditDetails:k,onDeleteClick:K,onDuplicateVisual:z,onTogglePrivacy:N,onShareVisual:G,isDeleting:C,isDuplicating:y===i.id,formatDate:U},i.id))}),f&&r&&e.jsx(t.ShareDialog,{resource:r,resourceType:t.ResourceType.VISUAL,onClose:()=>{m(!1),o(null)}}),u&&e.jsx(t.ResourceEditDialog,{open:!!u,resourceLabel:"Visual",initialTitle:u.title||"",initialDescription:u.description||"",onClose:te,onSave:se,isSaving:Z(u.id)}),e.jsx(t.AlertDialog,{open:g,onOpenChange:i=>{!i&&C||(j(i),i||D(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Visual"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',a==null?void 0:a.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:C,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:i=>{i.preventDefault(),i.stopPropagation(),q()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:C,children:[C?e.jsx(t.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"mr-2 h-3.5 w-3.5"}),C?"Deleting...":"Delete"]})]})]})})]})}function we({dashboard:s,isDeleting:f,isDuplicating:m,isDefault:r,onLoadDashboard:o,onEditDetails:g,onDeleteClick:j,onDuplicateDashboard:a,onShareDashboard:D,formatDate:y,onDashboardItemClick:d}){var T,S;const{selectDashboard:u}=t.useManagementActions(),x=t.useIsDashboardSelected(s.id),{userContext:b,isLoading:E}=t.useCurrentUserInfo(),{mutate:w}=t.useDefaultDashboardMutation(),v=((T=b==null?void 0:b.permissions)==null?void 0:T.canEdit)??!1,A=E||!v,V=()=>{u(s),o(s.id),d==null||d(s.id)},O=M=>{M.stopPropagation(),w({dashboardId:r?null:s.id})};return e.jsx(t.TooltipProvider,{children:e.jsxs("div",{className:t.cn("group flex cursor-pointer items-start gap-3 rounded-md px-2 py-2 transition-colors hover:bg-muted",x&&"bg-muted/80"),onClick:V,children:[e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{asChild:!0,children:e.jsx("button",{onClick:O,className:"mt-0.5 flex-shrink-0 rounded p-0.5 hover:bg-muted",children:e.jsx(t.Star,{className:t.cn("h-4 w-4 transition-colors",r?"fill-yellow-400 text-yellow-400":"text-muted-foreground/40 hover:text-yellow-400")})})}),e.jsx(t.TooltipContent,{side:"right",className:"text-xs",children:r?"Remove as default":"Set as default"})]}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",title:s.title||"Untitled Dashboard",children:s.title||"Untitled Dashboard"}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:s.description||"No description",children:(S=s.description)!=null&&S.trim()?s.description:"No description"})]}),e.jsx("div",{className:"flex-shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:e.jsx(t.DashboardActionsMenu,{dashboard:s,isDeleting:f,isDuplicating:m,shouldHideActions:A,onEditDetails:g,onDeleteClick:j,onDuplicateDashboard:a,onShareDashboard:D,formatDate:y})})]})})]},s.id)})}function Ce({onRetry:s}){return e.jsx(t.ScrollArea,{className:"w-full flex-1 pr-2",children:e.jsxs("div",{className:"py-8 text-center text-muted-foreground",children:[e.jsx("p",{className:"text-sm text-destructive",children:"Failed to load dashboards"}),e.jsx(t.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:s,children:"Retry"})]})})}function ve(s){var ae,re;const{searchQuery:f,onLoadDashboard:m,onEditDashboard:r,onDashboardItemClick:o}=s,[g,j]=c.useState(!1),[a,D]=c.useState(null),[y,d]=c.useState(!1),[u,x]=c.useState(null),[b,E]=c.useState(null),[w,v]=c.useState(null),A=t.useManagementStore(n=>n.lastSelectedDashboard),V=t.useManagementStore(n=>n.selectedDashboard),O=t.useManagementStore(n=>n.actions.selectDashboard),T=t.useManagementStore(n=>n.actions.clearSelectedDashboard),{tokenProps:S,id:M}=t.useSemaphorContext();pe.useRoleAwareDisplayPreferences();const{resources:C,isLoading:p,isError:B,isFetching:Q,updateResource:U,deleteResource:K,duplicateResource:q,isUpdating:X,isDeleting:R,isDuplicating:Z,refetch:$}=t.useDashboardManagement(()=>{d(!1);const n=u==null?void 0:u.id;x(null),(V==null?void 0:V.id)===n&&(!(S!=null&&S.dashboard_id)&&!M?T():A&&A.id!==n&&O(A))}),{currentUser:z,userContext:F}=t.useCurrentUserInfo(),_=((ae=F==null?void 0:F.permissions)==null?void 0:ae.canCreateDashboard)??!1,{data:N}=t.useUserPreferences(),G=((re=N==null?void 0:N.preference)==null?void 0:re.defaultDashboardId)||null,k=C.filter(n=>{var P,h;return((P=n==null?void 0:n.title)==null?void 0:P.toLowerCase().includes(f.toLowerCase()))||((h=n==null?void 0:n.description)==null?void 0:h.toLowerCase().includes(f.toLowerCase()))}),te=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),se=n=>{m==null||m(n)},i=n=>{x(n),d(!0)},L=()=>{u&&K(u.id)},l=n=>{E(n),q(n,{onSettled:()=>E(null)})},{startUpdating:W,stopUpdating:Y,isUpdating:J}=t.useResourceUpdateState(),ee=(n,P,h)=>{var le;const ne=Object.fromEntries(Object.entries(P).filter(([,H])=>H!==void 0));if(Object.keys(ne).length===0){(le=h==null?void 0:h.onSuccess)==null||le.call(h);return}const oe=Object.keys(ne),ie=oe.length===1?oe[0]:void 0;W(n,ie),U({resourceId:n,data:ne},{onSuccess:()=>{var H;Y(n,ie),(H=h==null?void 0:h.onSuccess)==null||H.call(h)},onError:()=>{var H;Y(n,ie),(H=h==null?void 0:h.onError)==null||H.call(h)}})},I=n=>{const P=C.find(h=>h.id===n);P&&U({resourceId:n,data:{isPrivate:!P.isPrivate}})},ue=n=>{D(n),z==null||z.type,j(!0)},he=n=>{r==null||r(n.id),v(n)},me=()=>{v(null)},xe=({title:n,description:P})=>{if(!w)return;const h={};n!==w.title&&(h.title=n),(w.description||"")!==P&&(h.description=P),ee(w.id,h,{onSuccess:()=>{v(null)}})};return p?e.jsx(ce,{}):B?e.jsx(Ce,{onRetry:()=>window.location.reload()}):e.jsxs("div",{className:"flex h-full flex-1 flex-col",children:[e.jsx("div",{className:"flex flex-1 basis-0 flex-col gap-3 overflow-y-auto",children:k.length===0?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx("div",{className:"mb-3",children:e.jsx(t.ChartColumn,{className:"mx-auto h-12 w-12 text-muted-foreground/50"})}),e.jsx("h3",{className:"mb-1 font-medium text-foreground",children:f?"No dashboards found":"No dashboards yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:f?"Try adjusting your search":_?'Click "Create" above to add your first dashboard':"No dashboards have been shared with you yet"})]}):k.map(n=>e.jsx(we,{dashboard:n,isDeleting:R,isDuplicating:b===n.id,isDefault:n.id===G,onLoadDashboard:se,onEditDetails:he,onDeleteClick:i,onDuplicateDashboard:l,onTogglePrivacy:I,onShareDashboard:ue,formatDate:te,onDashboardItemClick:o},n.id))}),g&&a&&e.jsx(t.ShareDialog,{resource:a,resourceType:t.ResourceType.DASHBOARD,onClose:()=>{j(!1),D(null)}}),e.jsx(t.AlertDialog,{open:y,onOpenChange:n=>{!n&&R||(d(n),n||x(null))},children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:"Delete Dashboard"}),e.jsxs(t.AlertDialogDescription,{children:['Are you sure you want to delete "',u==null?void 0:u.title,'"? This action cannot be undone.']})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{disabled:R,children:"Cancel"}),e.jsxs(t.AlertDialogAction,{onClick:n=>{n.preventDefault(),n.stopPropagation(),L()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:R,children:[R?e.jsx(t.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):e.jsx(t.Trash2,{className:"mr-2 h-3.5 w-3.5"}),R?"Deleting...":"Delete"]})]})]})}),w&&e.jsx(t.ResourceEditDialog,{open:!!w,resourceLabel:"Dashboard",initialTitle:w.title||"",initialDescription:w.description||"",onClose:me,onSave:xe,isSaving:J(w.id)})]})}function ye({open:s,onOpenChange:f,onSubmit:m,isCreating:r}){const[o,g]=c.useState(""),[j,a]=c.useState("");c.useEffect(()=>{s||(g(""),a(""))},[s]);const D=()=>{o.trim()&&m({title:o,description:j})},y=d=>{f(d)};return e.jsx(t.Dialog,{open:s,onOpenChange:y,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Create New Visual"}),e.jsx(t.DialogDescription,{children:"Add a new visual to your library. You can configure it after creation."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"title",children:"Visual Title"}),e.jsx(t.Input,{id:"title",placeholder:"Enter visual title...",value:o,onChange:d=>g(d.target.value),disabled:r,onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),D())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Input,{id:"description",placeholder:"Enter visual description...",value:j,onChange:d=>a(d.target.value),disabled:r})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>y(!1),disabled:r,children:"Cancel"}),e.jsx(t.Button,{onClick:D,disabled:!o.trim()||r,children:r?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Visual"})]})]})})}function Se({isOpen:s,onClose:f,className:m,onDashboardItemClick:r,variant:o="inline"}){var F,_;const g=t.useDashboardStore(N=>N.isDashboardEditing),[j,a]=c.useState(!1),[D,y]=c.useState(""),[d,u]=c.useState(!1),{currentUser:x,userContext:b}=t.useCurrentUserInfo(),E=((F=b==null?void 0:b.permissions)==null?void 0:F.canCreateDashboard)??!1,{onCreateSuccess:w}=t.useDashboardCreation({onDashboardSelect:r}),{selectVisual:v}=t.useManagementActions(),{handleEditLibraryVisual:A}=de.useVisualUtils(),{createResource:V,isCreating:O,refetch:T}=t.useDashboardManagement(),{createResource:S,isCreating:M}=t.useVisualManagement(void 0,N=>{a(!1),N&&(v(N),A(N))}),C=o==="overlay",p=((x==null?void 0:x.name)??"").trim(),B=((x==null?void 0:x.email)??"").trim(),U=p&&p.toLowerCase()!=="undefined"?p:B||"Current user",K=((_=U.charAt(0))==null?void 0:_.toUpperCase())||"?",q=B&&B.toLowerCase()!=="undefined"?B:"",X=ge(f,{enabled:s&&C}),R=t.cn("flex h-full flex-col border-r bg-background",C?t.cn("absolute inset-y-0 left-0 z-[51] w-60 shadow-lg transition-transform duration-300 ease-in-out",s?"translate-x-0":"pointer-events-none -translate-x-full"):"w-full max-w-[17rem] min-w-[11rem] overflow-hidden shadow-sm",m),Z=N=>{},$=N=>{console.log("Editing dashboard:",N)},z=N=>{V(N,{onSuccess:G=>{a(!1),w(G,T)}})};return e.jsx(e.Fragment,{children:(!C||s)&&e.jsxs("div",{ref:X,className:R,children:[e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("h2",{className:"whitespace-nowrap text-sm font-semibold",children:g?"Visuals":"Dashboards"})}),e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsx(t.Button,{size:"sm",variant:"ghost",onClick:()=>u(!d),className:"h-8 w-8 p-0",children:e.jsx(t.Search,{className:"h-3.5 w-3.5"})}),(g||E)&&e.jsx(t.Button,{size:"sm",variant:"ghost",className:"h-8 w-8 whitespace-nowrap p-0",onClick:()=>a(!0),children:e.jsx(t.Plus,{className:"h-3.5 w-3.5"})})]})]}),d&&e.jsx("div",{className:"bg-muted/30 px-4 pb-3",children:e.jsx(t.Input,{placeholder:"Search...",value:D,onChange:N=>y(N.target.value),className:"h-8 border-muted-foreground/20 bg-background text-sm focus-visible:border-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0",autoFocus:!0})})]}),e.jsx("div",{className:"flex flex-1 flex-col overflow-auto px-2 py-2",children:g?e.jsx(Ne,{searchQuery:D}):e.jsx(ve,{searchQuery:D,onLoadDashboard:Z,onEditDashboard:$,onDashboardItemClick:r})}),x&&e.jsx(t.TooltipProvider,{children:e.jsx("div",{className:"border-t border-border px-4 py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(t.Tooltip,{children:[e.jsx(t.TooltipTrigger,{asChild:!0,children:e.jsx("div",{className:"flex h-6 w-6 cursor-default items-center justify-center rounded-full bg-primary/10",children:e.jsx("span",{className:"text-xs font-medium text-primary",children:K})})}),e.jsx(t.TooltipContent,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-medium",children:U}),q&&e.jsx("div",{className:"text-xs text-muted-foreground",children:q}),x.role&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Role: ",t.toTitleCase(x.role.replace(/_/g," "))]})]})})]}),e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:U})]})})}),g?e.jsx(ye,{open:j,onOpenChange:a,onSubmit:S,isCreating:M}):e.jsx(t.CreateDashboardDialog,{open:j,onOpenChange:a,onSubmit:z,isCreating:O})]})})}exports.ResourceManagementPanel=Se;
@@ -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-B9l7fpA-.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
+ };
@@ -0,0 +1 @@
1
+ "use strict";const a=require("./index-oMb4lVSV.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 +1 @@
1
- "use strict";const o=require("./index-Dy-VUjSy.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-oMb4lVSV.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-CMymongy.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-B9l7fpA-.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-Dy-VUjSy.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-oMb4lVSV.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-CMymongy.js";
1
+ import { D as a } from "../chunks/index-B9l7fpA-.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-Dy-VUjSy.js"),E=require("./types/index.cjs"),a=require("react/jsx-runtime"),g=require("react"),j=require("./chunks/resource-management-panel--vwXhI58.js"),c=require("./chunks/dashboard-export-dialog-CZhtshog.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-oMb4lVSV.js"),E=require("./types/index.cjs"),a=require("react/jsx-runtime"),x=require("react"),j=require("./chunks/resource-management-panel-yBYy59zu.js"),c=require("./chunks/dashboard-export-dialog-D514_qGz.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-CMymongy.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-CMymongy.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-B9l7fpA-.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-B9l7fpA-.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-BPl4Mk9m.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-D6bmvl-v.js";
7
+ import { ResourceManagementPanel as ee } from "./chunks/resource-management-panel-BxvT3mn3.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-MpHrSiyY.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-Dy-VUjSy.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-oMb4lVSV.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-CMymongy.js";
1
+ import { a } from "../chunks/index-B9l7fpA-.js";
2
2
  import { EMPTY_SELECTION as E } from "../types/index.js";
3
3
  export {
4
4
  E as EMPTY_SELECTION,