react-semaphor 0.1.209 → 0.1.210

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 (41) hide show
  1. package/dist/chunks/dashboard-controls-BAOrAMV9.js +42 -0
  2. package/dist/chunks/{dashboard-controls-BNTI4r0_.js → dashboard-controls-C08300Wi.js} +504 -456
  3. package/dist/chunks/{dashboard-json-kIoBtmBF.js → dashboard-json-DlEE5-WA.js} +1 -1
  4. package/dist/chunks/{dashboard-json-BjOqpGbW.js → dashboard-json-GjDBGO26.js} +1 -1
  5. package/dist/chunks/{dashboard-summary-settings-dialog-BoX18wiA.js → dashboard-summary-settings-dialog-QUuhhXU9.js} +1 -1
  6. package/dist/chunks/{dashboard-summary-settings-dialog-CO1SwHHD.js → dashboard-summary-settings-dialog-THx-gjnG.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-DG4VLoJF.js → edit-dashboard-visual-Bsmow1Pa.js} +3422 -3536
  8. package/dist/chunks/edit-dashboard-visual-PfWJXb2-.js +164 -0
  9. package/dist/chunks/editor-action-buttons-DNbp_ZWy.js +404 -0
  10. package/dist/chunks/editor-action-buttons-FPyaC09X.js +21 -0
  11. package/dist/chunks/{index-D0TdW88i.js → index-CAVrkf9d.js} +2196 -2180
  12. package/dist/chunks/{index-DSA80lEg.js → index-CXKjmjfB.js} +67 -67
  13. package/dist/chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js +1 -0
  14. package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
  15. package/dist/chunks/notification-bell-BqvKQSw9.js +6 -0
  16. package/dist/chunks/notification-bell-C3a7wC1u.js +871 -0
  17. package/dist/chunks/{resource-management-panel-DS_WEv1x.js → resource-management-panel-BVTgbma8.js} +343 -332
  18. package/dist/chunks/resource-management-panel-C5NjrVsA.js +6 -0
  19. package/dist/chunks/{use-role-aware-display-preferences-DfihB5pN.js → use-role-aware-display-preferences-DxCPoCgr.js} +1 -1
  20. package/dist/chunks/{use-role-aware-display-preferences-D8j5_cnK.js → use-role-aware-display-preferences-l7NFLYnn.js} +1 -1
  21. package/dist/chunks/{use-visual-utils-CzcVz3zB.js → use-visual-utils-B82Q-Ytl.js} +1 -1
  22. package/dist/chunks/{use-visual-utils-BfLXO_vi.js → use-visual-utils-D9IJz9R0.js} +1 -1
  23. package/dist/dashboard/index.cjs +1 -1
  24. package/dist/dashboard/index.js +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.js +44 -40
  27. package/dist/shared/index.cjs +1 -0
  28. package/dist/shared/index.js +6 -0
  29. package/dist/style.css +1 -1
  30. package/dist/surfboard/index.cjs +1 -1
  31. package/dist/surfboard/index.js +2 -2
  32. package/dist/types/main.d.ts +39 -1
  33. package/dist/types/shared.d.ts +1762 -0
  34. package/package.json +6 -1
  35. package/dist/chunks/dashboard-controls-Dcpx9_an.js +0 -42
  36. package/dist/chunks/edit-dashboard-visual-B9HuGExj.js +0 -179
  37. package/dist/chunks/editor-action-buttons-CDTIx_Jc.js +0 -11
  38. package/dist/chunks/editor-action-buttons-CszdZ4Fw.js +0 -345
  39. package/dist/chunks/notification-bell-D2V1-ARa.js +0 -11
  40. package/dist/chunks/notification-bell-DFiRaeJQ.js +0 -862
  41. package/dist/chunks/resource-management-panel-BhiWNPcw.js +0 -6
@@ -0,0 +1,6 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-CXKjmjfB.js"),c=require("react"),le=require("./use-visual-utils-B82Q-Ytl.js"),he=require("./use-role-aware-display-preferences-l7NFLYnn.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 me=s.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 xe(t,g={}){const{enabled:p=!0,eventType:o="mousedown"}=g,r=c.useRef(null);return c.useEffect(()=>{const u=j=>{const a=j.target;r.current&&r.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-")||t()};return p&&document.addEventListener(o,u),()=>{document.removeEventListener(o,u)}},[t,p,o]),r}function de(){return e.jsx("div",{className:"space-y-1 px-2 py-2",children:[...Array(5)].map((t,g)=>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"})]})]},g))})}const pe=t=>{const g=s.useDashboardStore(r=>r.isVisualEditing),p=s.useDashboardStore(r=>r.selectedFrameId),o=s.useEditorStore(r=>r.frame);return!!(g&&p&&(o==null?void 0:o.visualId)===t)};function fe({visual:t,isDeleting:g,isDuplicating:p,onAddVisual:o,onOpenVisual:r,onEditDetails:u,onDeleteClick:j,onDuplicateVisual:a,onShareVisual:N,formatDate:v}){var R,P,w,B;const{selectVisual:h}=s.useManagementActions(),m=s.useIsVisualSelected(t.id),d=pe(t.id),A=s.useDashboardStore(f=>f.isVisualEditing),{isConsoleMode:L}=s.useDashboardPreferences(),D=c.useRef(null),[E,S]=c.useState(!1),[y,I]=c.useState(!1);c.useEffect(()=>{p?(S(!0),I(!0)):y&&(S(!1),I(!1))},[p,y]),c.useEffect(()=>{d&&D.current&&D.current.scrollIntoView({behavior:"smooth",block:"center"})},[d]);const O=()=>{h(t),r==null||r(t)};return e.jsx("div",{ref:D,className:s.cn("group flex cursor-pointer items-start rounded-md px-2 py-2 transition-colors hover:bg-muted",d?"bg-purple-500/10":m&&"bg-muted/80"),onClick:O,children: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:t.title||"Untitled Visual",children:t.title||"Untitled Visual"}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:t.description||"No description",children:(R=t.description)!=null&&R.trim()?t.description:"No description"})]}),e.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",onClick:f=>f.stopPropagation(),children:e.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-md border border-input",children:[e.jsxs(s.Button,{size:"sm",variant:"outline",className:"h-7 gap-1 rounded-none border-0 px-2 text-xs shadow-none",disabled:A,onClick:f=>{f.stopPropagation(),o(t)},children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Add"]}),e.jsxs(s.DropdownMenu,{modal:!1,open:E,onOpenChange:S,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.Button,{size:"sm",variant:"outline",className:"h-7 w-7 rounded-none border-0 border-l border-input p-0 shadow-none","aria-label":"Open visual actions",children:e.jsx(s.EllipsisVertical,{className:"h-3 w-3"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"z-[51] w-40",children:[e.jsxs(s.DropdownMenuItem,{onClick:f=>{f.stopPropagation(),o(t)},disabled:A,children:[e.jsx(s.Plus,{className:"mr-2 h-3 w-3"}),"Add"]}),e.jsxs(s.DropdownMenuItem,{onClick:f=>{f.stopPropagation(),r==null||r(t)},children:[e.jsx(me,{className:"mr-2 h-3 w-3"}),"Open"]}),e.jsxs(s.DropdownMenuItem,{onClick:f=>{f.preventDefault(),f.stopPropagation(),a(t.id)},disabled:p,children:[p?e.jsx(s.LoaderCircle,{className:"mr-2 h-3 w-3 animate-spin"}):e.jsx(s.Copy,{className:"mr-2 h-3 w-3"}),p?"Duplicating...":"Duplicate"]}),t.ownership.isOwner&&e.jsxs(e.Fragment,{children:[e.jsxs(s.DropdownMenuItem,{onClick:f=>{f.stopPropagation(),u==null||u(t)},children:[e.jsx(s.PenLine,{className:"mr-2 h-3 w-3"}),"Edit details"]}),e.jsxs(s.DropdownMenuItem,{onClick:f=>{f.stopPropagation(),N(t)},children:[e.jsx(s.Users,{className:"mr-2 h-3 w-3"}),"Share"]}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuItem,{onClick:f=>{f.stopPropagation(),j(t)},className:"text-destructive",disabled:g,children:[e.jsx(s.Trash2,{className:"mr-2 h-3 w-3"}),g?"Deleting...":"Delete"]})]}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-2 text-xs text-slate-500 dark:text-slate-400",children:[(((P=t.ownership.createdBy)==null?void 0:P.type)==="tenant"||((w=t.ownership.createdBy)==null?void 0:w.type)==="organization"&&L)&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(s.User,{className:"h-3 w-3"}),e.jsx("span",{children:((B=t.ownership.createdBy)==null?void 0:B.name)||"Unknown"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(s.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:v(t.lastModified)})]})]})]})]})]})})]})})},t.id)}function ge({searchQuery:t}){const[g,p]=c.useState(!1),[o,r]=c.useState(null),[u,j]=c.useState(!1),[a,N]=c.useState(null),[v,h]=c.useState(null),[m,d]=c.useState(null),{selectVisual:A}=s.useManagementActions(),{handleEditLibraryVisual:L,handleAddLibraryVisual:D}=le.useVisualUtils(),{resources:E,isLoading:S,isError:y,isFetching:I,updateResource:O,deleteResource:R,duplicateResource:P,isDeleting:w,isDuplicating:B,isUpdating:f}=s.useVisualManagement(()=>{j(!1),N(null)});s.useCurrentUserInfo();const W=E.filter(i=>{var V,l;return((V=i==null?void 0:i.title)==null?void 0:V.toLowerCase().includes(t.toLowerCase()))||((l=i==null?void 0:i.description)==null?void 0:l.toLowerCase().includes(t.toLowerCase()))}),_=i=>new Date(i).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),F=i=>{N(i),j(!0)},U=()=>{a&&R(a.id)},{startUpdating:te,stopUpdating:b,isUpdating:k}=s.useResourceUpdateState(),Y=(i,V,l)=>{var se;const X=Object.fromEntries(Object.entries(V).filter(([,M])=>M!==void 0));if(Object.keys(X).length===0){(se=l==null?void 0:l.onSuccess)==null||se.call(l);return}const ee=Object.keys(X),Z=ee.length===1?ee[0]:void 0;te(i,Z),O({resourceId:i,data:X},{onSuccess:()=>{var M;b(i,Z),(M=l==null?void 0:l.onSuccess)==null||M.call(l)},onError:()=>{var M;b(i,Z),(M=l==null?void 0:l.onError)==null||M.call(l)}})},z=i=>{h(i),P(i,{onSettled:()=>h(null)})},H=i=>{L(i)},J=i=>{D(i)},$=i=>{const V=E.find(l=>l.id===i);V&&O({resourceId:i,data:{isPrivate:!V.isPrivate}})},Q=i=>{r(i),p(!0)},K=i=>{d(i)},G=()=>{d(null)},C=({title:i,description:V})=>{if(!m)return;const l={};i!==m.title&&(l.title=i),(m.description||"")!==V&&(l.description=V),Y(m.id,l,{onSuccess:()=>{d(null)}})};return S?e.jsx(de,{}):y?e.jsx(s.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(s.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:W.length===0?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx("div",{className:"mb-3",children:e.jsx(s.Grid3x3,{className:"mx-auto h-12 w-12 text-muted-foreground/50"})}),e.jsx("h3",{className:"mb-1 font-medium text-foreground",children:t?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t?"Try adjusting your search":'Click "New" above to add your first visual'})]}):W.map(i=>e.jsx(fe,{visual:i,onAddVisual:J,onOpenVisual:H,onEditDetails:K,onDeleteClick:F,onDuplicateVisual:z,onTogglePrivacy:$,onShareVisual:Q,isDeleting:w,isDuplicating:v===i.id,formatDate:_},i.id))}),g&&o&&e.jsx(s.ShareDialog,{resource:o,resourceType:s.ResourceType.VISUAL,onClose:()=>{p(!1),r(null)}}),m&&e.jsx(s.ResourceEditDialog,{open:!!m,resourceLabel:"Visual",initialTitle:m.title||"",initialDescription:m.description||"",onClose:G,onSave:C,isSaving:k(m.id)}),e.jsx(s.AlertDialog,{open:u,onOpenChange:i=>{!i&&w||(j(i),i||N(null))},children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Visual"}),e.jsxs(s.AlertDialogDescription,{children:['Are you sure you want to delete "',a==null?void 0:a.title,'"? This action cannot be undone.']})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{disabled:w,children:"Cancel"}),e.jsxs(s.AlertDialogAction,{onClick:i=>{i.preventDefault(),i.stopPropagation(),U()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:w,children:[w?e.jsx(s.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):e.jsx(s.Trash2,{className:"mr-2 h-3.5 w-3.5"}),w?"Deleting...":"Delete"]})]})]})})]})}function je({dashboard:t,isDeleting:g,isDuplicating:p,onLoadDashboard:o,onEditDetails:r,onDeleteClick:u,onDuplicateDashboard:j,onShareDashboard:a,formatDate:N,onDashboardItemClick:v}){var S,y;const{selectDashboard:h}=s.useManagementActions(),m=s.useIsDashboardSelected(t.id),{userContext:d,isLoading:A}=s.useCurrentUserInfo(),L=((S=d==null?void 0:d.permissions)==null?void 0:S.canEdit)??!1,D=A||!L,E=()=>{h(t),o(t.id),v==null||v(t.id)};return e.jsx("div",{className:s.cn("group flex cursor-pointer items-start rounded-md px-2 py-2 transition-colors hover:bg-muted",m&&"bg-muted/80"),onClick:E,children: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:t.title||"Untitled Dashboard",children:t.title||"Untitled Dashboard"}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:t.description||"No description",children:(y=t.description)!=null&&y.trim()?t.description:"No description"})]}),e.jsx("div",{className:"flex-shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:e.jsx(s.DashboardActionsMenu,{dashboard:t,isDeleting:g,isDuplicating:p,shouldHideActions:D,onEditDetails:r,onDeleteClick:u,onDuplicateDashboard:j,onShareDashboard:a,formatDate:N})})]})})},t.id)}function De({onRetry:t}){return e.jsx(s.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(s.Button,{variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})})}function Ne(t){var ae;const{searchQuery:g,onLoadDashboard:p,onEditDashboard:o,onDashboardItemClick:r}=t,[u,j]=c.useState(!1),[a,N]=c.useState(null),[v,h]=c.useState(!1),[m,d]=c.useState(null),[A,L]=c.useState(null),[D,E]=c.useState(null),S=s.useManagementStore(n=>n.lastSelectedDashboard),y=s.useManagementStore(n=>n.selectedDashboard),I=s.useManagementStore(n=>n.actions.selectDashboard),O=s.useManagementStore(n=>n.actions.clearSelectedDashboard),{tokenProps:R,id:P}=s.useSemaphorContext();he.useRoleAwareDisplayPreferences();const{resources:w,isLoading:B,isError:f,isFetching:W,updateResource:_,deleteResource:F,duplicateResource:U,isUpdating:te,isDeleting:b,isDuplicating:k,refetch:Y}=s.useDashboardManagement(()=>{h(!1);const n=m==null?void 0:m.id;d(null),(y==null?void 0:y.id)===n&&(!(R!=null&&R.dashboard_id)&&!P?O():S&&S.id!==n&&I(S))}),{currentUser:z,userContext:H}=s.useCurrentUserInfo(),J=((ae=H==null?void 0:H.permissions)==null?void 0:ae.canCreateDashboard)??!1,$=w.filter(n=>{var T,x;return((T=n==null?void 0:n.title)==null?void 0:T.toLowerCase().includes(g.toLowerCase()))||((x=n==null?void 0:n.description)==null?void 0:x.toLowerCase().includes(g.toLowerCase()))}),Q=n=>new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),K=n=>{p==null||p(n)},G=n=>{d(n),h(!0)},C=()=>{m&&F(m.id)},i=n=>{L(n),U(n,{onSettled:()=>L(null)})},{startUpdating:V,stopUpdating:l,isUpdating:X}=s.useResourceUpdateState(),ee=(n,T,x)=>{var oe;const ne=Object.fromEntries(Object.entries(T).filter(([,q])=>q!==void 0));if(Object.keys(ne).length===0){(oe=x==null?void 0:x.onSuccess)==null||oe.call(x);return}const re=Object.keys(ne),ie=re.length===1?re[0]:void 0;V(n,ie),_({resourceId:n,data:ne},{onSuccess:()=>{var q;l(n,ie),(q=x==null?void 0:x.onSuccess)==null||q.call(x)},onError:()=>{var q;l(n,ie),(q=x==null?void 0:x.onError)==null||q.call(x)}})},Z=n=>{const T=w.find(x=>x.id===n);T&&_({resourceId:n,data:{isPrivate:!T.isPrivate}})},se=n=>{N(n),z==null||z.type,j(!0)},M=n=>{o==null||o(n.id),E(n)},ce=()=>{E(null)},ue=({title:n,description:T})=>{if(!D)return;const x={};n!==D.title&&(x.title=n),(D.description||"")!==T&&(x.description=T),ee(D.id,x,{onSuccess:()=>{E(null)}})};return B?e.jsx(de,{}):f?e.jsx(De,{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:$.length===0?e.jsxs("div",{className:"py-8 text-center",children:[e.jsx("div",{className:"mb-3",children:e.jsx(s.ChartColumn,{className:"mx-auto h-12 w-12 text-muted-foreground/50"})}),e.jsx("h3",{className:"mb-1 font-medium text-foreground",children:g?"No dashboards found":"No dashboards yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:g?"Try adjusting your search":J?'Click "New" above to add your first dashboard':"No dashboards have been shared with you yet"})]}):$.map(n=>e.jsx(je,{dashboard:n,isDeleting:b,isDuplicating:A===n.id,onLoadDashboard:K,onEditDetails:M,onDeleteClick:G,onDuplicateDashboard:i,onTogglePrivacy:Z,onShareDashboard:se,formatDate:Q,onDashboardItemClick:r},n.id))}),u&&a&&e.jsx(s.ShareDialog,{resource:a,resourceType:s.ResourceType.DASHBOARD,onClose:()=>{j(!1),N(null)}}),e.jsx(s.AlertDialog,{open:v,onOpenChange:n=>{!n&&b||(h(n),n||d(null))},children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Dashboard"}),e.jsxs(s.AlertDialogDescription,{children:['Are you sure you want to delete "',m==null?void 0:m.title,'"? This action cannot be undone.']})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{disabled:b,children:"Cancel"}),e.jsxs(s.AlertDialogAction,{onClick:n=>{n.preventDefault(),n.stopPropagation(),C()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:b,children:[b?e.jsx(s.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):e.jsx(s.Trash2,{className:"mr-2 h-3.5 w-3.5"}),b?"Deleting...":"Delete"]})]})]})}),D&&e.jsx(s.ResourceEditDialog,{open:!!D,resourceLabel:"Dashboard",initialTitle:D.title||"",initialDescription:D.description||"",onClose:ce,onSave:ue,isSaving:X(D.id)})]})}function we({open:t,onOpenChange:g,onSubmit:p,isCreating:o}){const[r,u]=c.useState(""),[j,a]=c.useState("");c.useEffect(()=>{t||(u(""),a(""))},[t]);const N=()=>{r.trim()&&p({title:r,description:j})},v=h=>{g(h)};return e.jsx(s.Dialog,{open:t,onOpenChange:v,children:e.jsxs(s.DialogContent,{children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:"Create New Visual"}),e.jsx(s.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(s.Label,{htmlFor:"title",children:"Visual Title"}),e.jsx(s.Input$1,{id:"title",placeholder:"Enter visual title...",value:r,onChange:h=>u(h.target.value),disabled:o,onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),N())}})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(s.Input$1,{id:"description",placeholder:"Enter visual description...",value:j,onChange:h=>a(h.target.value),disabled:o})]})]}),e.jsxs(s.DialogFooter,{children:[e.jsx(s.Button,{variant:"outline",onClick:()=>v(!1),disabled:o,children:"Cancel"}),e.jsx(s.Button,{onClick:N,disabled:!r.trim()||o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Visual"})]})]})})}function Ce({isOpen:t,onClose:g,className:p,onDashboardItemClick:o,variant:r="inline"}){var K,G;const u=s.useDashboardStore(C=>C.isDashboardEditing),[j,a]=c.useState(!1),[N,v]=c.useState(""),[h,m]=c.useState(!1),{currentUser:d,userContext:A}=s.useCurrentUserInfo(),L=((K=A==null?void 0:A.permissions)==null?void 0:K.canCreateDashboard)??!1,{onCreateSuccess:D}=s.useDashboardCreation({onDashboardSelect:o}),{selectVisual:E}=s.useManagementActions(),{handleEditLibraryVisual:S}=le.useVisualUtils(),{createResource:y,isCreating:I,refetch:O}=s.useDashboardManagement(),{createResource:R,isCreating:P}=s.useVisualManagement(void 0,C=>{a(!1),C&&(E(C),S(C))}),w=r==="overlay",B=u?"New Visual":"New",f=u?"New Visual":"New Dashboard",W=u?"Search visuals...":"Search dashboards...",_=u?"Collapse visuals panel":"Collapse dashboard panel",F=((d==null?void 0:d.name)??"").trim(),U=((d==null?void 0:d.email)??"").trim(),b=F&&F.toLowerCase()!=="undefined"?F:U||"Current user",k=((G=b.charAt(0))==null?void 0:G.toUpperCase())||"?",Y=U&&U.toLowerCase()!=="undefined"?U:"",z=xe(g,{enabled:t&&w}),H=s.cn("flex h-full flex-col border-r bg-background",w?s.cn("absolute inset-y-0 left-0 z-[51] w-60 shadow-lg transition-transform duration-300 ease-in-out",t?"translate-x-0":"pointer-events-none -translate-x-full"):"w-full max-w-[17rem] min-w-[11rem] overflow-hidden shadow-sm",p),J=C=>{},$=C=>{console.log("Editing dashboard:",C)},Q=C=>{y(C,{onSuccess:i=>{a(!1),D(i,O)}})};return e.jsx(e.Fragment,{children:(!w||t)&&e.jsxs("div",{ref:z,className:H,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:u?"Visuals":"Dashboards"})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>m(!h),className:"h-8 w-8 p-0","aria-label":h?"Hide search":"Show search",children:e.jsx(s.Search,{className:"h-3.5 w-3.5"})}),(u||L)&&e.jsxs(s.Button,{size:"sm",variant:"ghost",className:"h-8 gap-1.5 whitespace-nowrap px-2 text-xs",onClick:()=>a(!0),"aria-label":f,children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),B]}),e.jsx(s.Button,{size:"sm",variant:"secondary",className:"h-7 w-7 p-0.5",onClick:g,"aria-label":_,children:e.jsx(s.ChevronLeft,{className:"h-3.5 w-3.5"})})]})]}),h&&e.jsx("div",{className:"bg-muted/30 px-4 pb-3",children:e.jsx(s.Input$1,{placeholder:W,value:N,onChange:C=>v(C.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:u?e.jsx(ge,{searchQuery:N}):e.jsx(Ne,{searchQuery:N,onLoadDashboard:J,onEditDashboard:$,onDashboardItemClick:o})}),d&&e.jsx(s.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(s.Tooltip,{children:[e.jsx(s.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(s.TooltipContent,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"font-medium",children:b}),Y&&e.jsx("div",{className:"text-xs text-muted-foreground",children:Y}),d.role&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Role: ",s.toTitleCase(d.role.replace(/_/g," "))]})]})})]}),e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:b})]})})}),u?e.jsx(we,{open:j,onOpenChange:a,onSubmit:R,isCreating:P}):e.jsx(s.CreateDashboardDialog,{open:j,onOpenChange:a,onSubmit:Q,isCreating:I})]})})}exports.ResourceManagementPanel=Ce;
@@ -1,4 +1,4 @@
1
- import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-D0TdW88i.js";
1
+ import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-CAVrkf9d.js";
2
2
  import { useMemo as i } from "react";
3
3
  function S() {
4
4
  const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
@@ -1 +1 @@
1
- "use strict";const a=require("./index-DSA80lEg.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
1
+ "use strict";const a=require("./index-CXKjmjfB.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 a=require("./index-DSA80lEg.js"),g=require("react");function H(e){const n=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),s=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(s!==-1&&(c=s),r!==-1&&r<c&&(c=r),n!==-1){const d=e.substring(0,n),o=e.substring(n);return`${d} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const d=e.substring(0,t),o=e.substring(t);return`${d} {{ filters | where }} ${o}`}else{const d=e.substring(0,c),o=e.substring(c);return console.log("beforeClause",d),console.log("afterClause",o),o?`${d} {{ filters | where }} ${o}`:`${d.replace(/;$/,"")} {{ filters | where }}`}}function k(e){const[n,t]=g.useState(null),[r,s]=g.useState(null),c=a.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),s(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 h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),s(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),s(l),t(null)}})()},[e,c]),n}function Q(e,n){if(e.length===0)return"";const t=e.find(r=>{var s,c;return((s=r.customCardPreferences)==null?void 0:s.visualType)==="multiple"||!!((c=r.customCardPreferences)!=null&&c.dataInputCardIds)});if(t)return t.id;if(n){const r=e.find(s=>s.id===n);if(r){const s=r.tabTitle;if(s=="All__Header")return e[0].id;if(s&&s.endsWith("__Header")){const d=s.split("__")[0],o=e.find(l=>l.tabTitle===d);return o?o.id:e[0].id}return n}}return e[0].id}const z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:n,...t}=e;return t};async function W(e,n,t,r){if(!n||!t)throw new Error("Missing auth token or visual ID");const s=["resource-by-id","visual",t],c=r.getQueryData(s);if(c)return console.log("Using cached visual data for:",t),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",t);const d=a.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${n}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(s,l),a.ue.dismiss(d),{data:l,fromCache:!1}}catch(o){throw a.ue.dismiss(d),o}}function L(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function G(e,n){var c,d;const t=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!t)return!1;const r=L(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const s=(d=r.cards)==null?void 0:d.find(o=>o.id===r.activeCardId);return s?(a.setupEditorWithCard({...n,frame:r,card:s,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function Y(){var C;const{setCardSql:e}=a.useEditorActions(),n=a.useEditorStore(i=>i.frame),t=a.useEditorStore(i=>i.card),r=a.useEditorStore(i=>i.isDevMode),s=k(((C=t.customCardPreferences)==null?void 0:C.url)||""),c=a.useEditorStore(i=>i.selectedSchemaName),d=a.useEditorStore(i=>i.selectedDatamodelId),o=a.useEditorStore(i=>i.selectedDatabaseName),l=a.useEditorStore(i=>i.selectedTableName),h=a.useEditorStore(i=>i.selectedConnectionId),m=a.useEditorStore(i=>i.isShowingVisual),p=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let i=p;p&&!p.includes("{{")&&(i=H(p),e(i));const E=(I=s==null?void 0:s.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:c,lastSelectedDatamodelId:d,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?i:void 0,python:r?t.python:void 0,config:r?void 0:z(t.config),customCfg:m?t.customCfg:null,preferences:t.preferences,...E&&{customCardPreferences:{...t.customCardPreferences,settings:E}}},w=n.cards.map(S=>S.id===t.id?v:S);return{...n,cards:w,activeCardId:Q(w,n.activeCardId)}},[t,n,r,m,c,d,o,l,h,e,s,p])}}function J(){const{authToken:e,tokenProps:n}=a.useSemaphorContext(),t=a.useQueryClient(),r=a.useSelectedVisual(),{selectVisual:s}=a.useManagementActions(),{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I}=a.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:V,setSelectedFrameId:$,clearSelectedFrameId:A,addFrame:R,setIsDashboardPanelOpen:N}=a.useDashboardActions(),y=a.useDashboardStore(u=>u.selectedSheetId),O=a.useDashboardStore(u=>u.selectedFrameId),T=a.useDashboardStore(u=>u.dashboard),x=a.useDashboardStore(u=>u.filterValues),F=a.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),j=g.useCallback(async u=>{try{s(u),A();const{data:b,fromCache:f}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!G(b,{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I,setIsDashboardEditing:S,setIsVisualEditing:V,dashboard:T,selectedSheetId:y,selectedFrameId:O,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,c,d,S,V,o,l,h,m,p,D,C,i,E,v,w,I,A,T,y,O,x]),_=g.useCallback(async u=>{var b;try{if(s(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:B}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),M=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!M)return{success:!1,error:"Visual has no frame data"};const U=L(M);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...a.cloneLinkedFrameWithSourceMapping(U),visualId:u.id};return R(y,P,"end"),S(!0),$(P.id),N(!1),{success:!0,fromCache:B}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,y,R,S,$,N]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:j,handleAddLibraryVisual:_,getUpdatedFrame:Y().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=k;exports.useVisualUtils=J;
1
+ "use strict";const a=require("./index-CXKjmjfB.js"),g=require("react");function H(e){const n=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),s=e.toUpperCase().indexOf("ORDER BY");let c=e.length;if(s!==-1&&(c=s),r!==-1&&r<c&&(c=r),n!==-1){const d=e.substring(0,n),o=e.substring(n);return`${d} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const d=e.substring(0,t),o=e.substring(t);return`${d} {{ filters | where }} ${o}`}else{const d=e.substring(0,c),o=e.substring(c);return console.log("beforeClause",d),console.log("afterClause",o),o?`${d} {{ filters | where }} ${o}`:`${d.replace(/;$/,"")} {{ filters | where }}`}}function k(e){const[n,t]=g.useState(null),[r,s]=g.useState(null),c=a.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),s(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 h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),s(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),s(l),t(null)}})()},[e,c]),n}function Q(e,n){if(e.length===0)return"";const t=e.find(r=>{var s,c;return((s=r.customCardPreferences)==null?void 0:s.visualType)==="multiple"||!!((c=r.customCardPreferences)!=null&&c.dataInputCardIds)});if(t)return t.id;if(n){const r=e.find(s=>s.id===n);if(r){const s=r.tabTitle;if(s=="All__Header")return e[0].id;if(s&&s.endsWith("__Header")){const d=s.split("__")[0],o=e.find(l=>l.tabTitle===d);return o?o.id:e[0].id}return n}}return e[0].id}const z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:n,...t}=e;return t};async function W(e,n,t,r){if(!n||!t)throw new Error("Missing auth token or visual ID");const s=["resource-by-id","visual",t],c=r.getQueryData(s);if(c)return console.log("Using cached visual data for:",t),{data:c,fromCache:!0};console.log("Fetching visual data from network for:",t);const d=a.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${n}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(s,l),a.ue.dismiss(d),{data:l,fromCache:!1}}catch(o){throw a.ue.dismiss(d),o}}function L(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function G(e,n){var c,d;const t=(e==null?void 0:e.frameObject)??((c=e==null?void 0:e.visual)==null?void 0:c.frameObject);if(!t)return!1;const r=L(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const s=(d=r.cards)==null?void 0:d.find(o=>o.id===r.activeCardId);return s?(a.setupEditorWithCard({...n,frame:r,card:s,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function Y(){var C;const{setCardSql:e}=a.useEditorActions(),n=a.useEditorStore(i=>i.frame),t=a.useEditorStore(i=>i.card),r=a.useEditorStore(i=>i.isDevMode),s=k(((C=t.customCardPreferences)==null?void 0:C.url)||""),c=a.useEditorStore(i=>i.selectedSchemaName),d=a.useEditorStore(i=>i.selectedDatamodelId),o=a.useEditorStore(i=>i.selectedDatabaseName),l=a.useEditorStore(i=>i.selectedTableName),h=a.useEditorStore(i=>i.selectedConnectionId),m=a.useEditorStore(i=>i.isShowingVisual),p=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let i=p;p&&!p.includes("{{")&&(i=H(p),e(i));const E=(I=s==null?void 0:s.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:c,lastSelectedDatamodelId:d,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?i:void 0,python:r?t.python:void 0,config:r?void 0:z(t.config),customCfg:m?t.customCfg:null,preferences:t.preferences,...E&&{customCardPreferences:{...t.customCardPreferences,settings:E}}},w=n.cards.map(S=>S.id===t.id?v:S);return{...n,cards:w,activeCardId:Q(w,n.activeCardId)}},[t,n,r,m,c,d,o,l,h,e,s,p])}}function J(){const{authToken:e,tokenProps:n}=a.useSemaphorContext(),t=a.useQueryClient(),r=a.useSelectedVisual(),{selectVisual:s}=a.useManagementActions(),{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I}=a.useEditorActions(),{setIsDashboardEditing:S,setIsVisualEditing:V,setSelectedFrameId:$,clearSelectedFrameId:A,addFrame:R,setIsDashboardPanelOpen:N}=a.useDashboardActions(),y=a.useDashboardStore(u=>u.selectedSheetId),O=a.useDashboardStore(u=>u.selectedFrameId),T=a.useDashboardStore(u=>u.dashboard),x=a.useDashboardStore(u=>u.filterValues),F=a.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),j=g.useCallback(async u=>{try{s(u),A();const{data:b,fromCache:f}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!G(b,{setFrame:c,setCard:d,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:C,setSelectedSchemaName:i,setSelectedTableName:E,setSelectedDatamodelId:v,setFilterValues:w,setApplyFilters:I,setIsDashboardEditing:S,setIsVisualEditing:V,dashboard:T,selectedSheetId:y,selectedFrameId:O,filterValues:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,c,d,S,V,o,l,h,m,p,D,C,i,E,v,w,I,A,T,y,O,x]),_=g.useCallback(async u=>{var b;try{if(s(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:B}=await W(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),M=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!M)return{success:!1,error:"Visual has no frame data"};const U=L(M);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...a.cloneLinkedFrameWithSourceMapping(U),visualId:u.id};return R(y,P,"end"),S(!0),$(P.id),N(!1),{success:!0,fromCache:B}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,y,R,S,$,N]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:j,handleAddLibraryVisual:_,getUpdatedFrame:Y().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=k;exports.useVisualUtils=J;
@@ -1,4 +1,4 @@
1
- import { bI as G, l as J, bJ as K, bK as Y, bL as X, by as _, bs as Z, u as v, bM as q, bN as ee, I as V, bO as te, bA as f } from "./index-D0TdW88i.js";
1
+ import { bI as G, l as J, bJ as K, bK as Y, bL as X, by as _, bs as Z, u as v, bM as q, bN as ee, I as V, bO as te, bA as f } from "./index-CAVrkf9d.js";
2
2
  import { useState as j, useEffect as re, useCallback as A } from "react";
3
3
  function se(e) {
4
4
  const a = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), s = e.toUpperCase().indexOf("ORDER BY");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-DSA80lEg.js"),o=require("../chunks/common-types-CfJLrTJd.js");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=o.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CXKjmjfB.js"),o=require("../chunks/common-types-CfJLrTJd.js");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=o.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as a } from "../chunks/index-D0TdW88i.js";
1
+ import { D as a } from "../chunks/index-CAVrkf9d.js";
2
2
  import { E as s } from "../chunks/common-types-DhqlRVrq.js";
3
3
  export {
4
4
  a as Dashboard,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DSA80lEg.js"),j=require("./chunks/common-types-CfJLrTJd.js"),D=require("./chunks/dashboard-summary-settings-dialog-BoX18wiA.js"),t=require("react/jsx-runtime"),C=require("react"),v=require("./chunks/resource-management-panel-BhiWNPcw.js"),N=require("./types/index.cjs");require("react-dom");const c=require("./chunks/notification-bell-D2V1-ARa.js");function P(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(a,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}return a.default=r,Object.freeze(a)}const h=P(C);function M(r){const{displayPreferences:a,...o}=r,i={...o,id:r.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",...i,children:t.jsx(_,{cardId:r.cardId})})})})]})})}function _({cardId:r}){const a=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:o,frame:i}=C.useMemo(()=>{const n=a==null?void 0:a.flatMap(s=>s.frames),l=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),x=l==null?void 0:l.find(s=>(s==null?void 0:s.id)===r),u=n==null?void 0:n.find(s=>{var p;return(p=s==null?void 0:s.cards)==null?void 0:p.find(m=>(m==null?void 0:m.id)===r)});return{card:x,frame:u}},[a,r]);return!o||!i?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>t.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:o,frame:i})})})}function I({name:r,items:a,value:o,onChange:i,isLoading:n,isError:l,refetch:x,className:u,icon:s,showNone:p=!1}){const m=h.useRef(null),[f,y]=h.useState(!1),[E,S]=h.useState("100%"),g=p?[...a||[],{id:"none",name:"None"}]:a;h.useLayoutEffect(()=>{m.current&&S(m.current.offsetWidth)},[]);function b(){var d;return n?"Loading...":l?"Error":o?(d=a==null?void 0:a.find(A=>A.id===o))==null?void 0:d.name:`Select ${r}`}function T(d,A){i(A),y(!1)}return t.jsxs(e.Popover,{open:f,onOpenChange:y,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:m,variant:"outline",role:"combobox","aria-expanded":f,className:e.cn("flex h-9 w-full justify-between",u),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[s&&t.jsx("div",{className:"mr-2",children:s}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:b()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:E},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:x,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:g==null?void 0:g.map(d=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:A=>T(A,d.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",o===d.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function R(r,a){C.useEffect(()=>(r&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,a])}function w(){var l,x;const{quotasQuery:r,usageQuery:a}=e.useAlertQuotas(),o=((l=r.data)==null?void 0:l.quotas)||[],i=((x=a.data)==null?void 0:x.usage)||[],n=new Map(i.map(u=>[u.tenantId||"org",u]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>{r.refetch(),a.refetch()},children:"Refresh"})]}),r.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:o.map(u=>{const s=u.tenantId||"org",p=n.get(s);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:s}),t.jsx("td",{className:"px-3 py-2",children:(p==null?void 0:p.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:u.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[u.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:u.policy.maxContextSources})]},s)})})]})})]})}exports.AlertCreationDialog=e.AlertCreationDialog;exports.AlertManagementPage=e.AlertManagementPage;exports.AlertsApiError=e.AlertsApiError;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;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.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.deleteAlert=e.deleteAlert;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.interpretAlertContext=e.interpretAlertContext;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.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAlertActions=e.useAlertActions;exports.useAlertBacktest=e.useAlertBacktest;exports.useAlertContextBuilder=e.useAlertContextBuilder;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;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.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=j.EMPTY_SELECTION;exports.CalendarPreferencesDialog=D.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=D.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=v.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=N.DEFAULT_CALENDAR_CONTEXT;exports.AdvancedModeToggle=c.AdvancedModeToggle;exports.ExportNotificationItem=c.ExportNotificationItem;exports.ExportNotificationList=c.ExportNotificationList;exports.NotificationBell=c.NotificationBell;exports.ScheduleDashboard=c.ScheduleDashboard;exports.UnsavedChangesAlert=c.UnsavedChangesAlert;exports.VisualEditingControls=c.VisualEditingControls;exports.useExportPolling=c.useExportPolling;exports.useExportRecovery=c.useExportRecovery;exports.usePristineSnapshotInitializer=c.usePristineSnapshotInitializer;exports.Combobox=I;exports.TenantQuotaPage=w;exports.Visual=M;exports.useExposePrintState=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CXKjmjfB.js"),v=require("./chunks/common-types-CfJLrTJd.js"),E=require("./chunks/dashboard-summary-settings-dialog-QUuhhXU9.js"),t=require("react/jsx-runtime"),C=require("react"),N=require("./chunks/resource-management-panel-C5NjrVsA.js"),P=require("./types/index.cjs"),D=require("./chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js");require("react-dom");const c=require("./chunks/notification-bell-BqvKQSw9.js");function M(r){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(a,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}return a.default=r,Object.freeze(a)}const A=M(C);function _(r){const{displayPreferences:a,...o}=r,i={...o,id:r.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:r.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",...i,children:t.jsx(I,{cardId:r.cardId})})})})]})})}function I({cardId:r}){const a=e.useDashboardStore(n=>{var l;return(l=n.dashboard)==null?void 0:l.sheets}),{card:o,frame:i}=C.useMemo(()=>{const n=a==null?void 0:a.flatMap(s=>s.frames),l=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),x=l==null?void 0:l.find(s=>(s==null?void 0:s.id)===r),u=n==null?void 0:n.find(s=>{var p;return(p=s==null?void 0:s.cards)==null?void 0:p.find(m=>(m==null?void 0:m.id)===r)});return{card:x,frame:u}},[a,r]);return!o||!i?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${r}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:l})=>t.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:l,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:o,frame:i})})})}function R({name:r,items:a,value:o,onChange:i,isLoading:n,isError:l,refetch:x,className:u,icon:s,showNone:p=!1}){const m=A.useRef(null),[f,y]=A.useState(!1),[S,b]=A.useState("100%"),g=p?[...a||[],{id:"none",name:"None"}]:a;A.useLayoutEffect(()=>{m.current&&b(m.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":l?"Error":o?(d=a==null?void 0:a.find(h=>h.id===o))==null?void 0:d.name:`Select ${r}`}function j(d,h){i(h),y(!1)}return t.jsxs(e.Popover,{open:f,onOpenChange:y,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:m,variant:"outline",role:"combobox","aria-expanded":f,className:e.cn("flex h-9 w-full justify-between",u),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[s&&t.jsx("div",{className:"mr-2",children:s}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:S},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:x,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",r==null?void 0:r.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:g==null?void 0:g.map(d=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:h=>j(h,d.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",o===d.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function F(r,a){C.useEffect(()=>(r&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{r&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[r,a])}function w(){var l,x;const{quotasQuery:r,usageQuery:a}=e.useAlertQuotas(),o=((l=r.data)==null?void 0:l.quotas)||[],i=((x=a.data)==null?void 0:x.usage)||[],n=new Map(i.map(u=>[u.tenantId||"org",u]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>{r.refetch(),a.refetch()},children:"Refresh"})]}),r.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:o.map(u=>{const s=u.tenantId||"org",p=n.get(s);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:s}),t.jsx("td",{className:"px-3 py-2",children:(p==null?void 0:p.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:u.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[u.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:u.policy.maxContextSources})]},s)})})]})})]})}exports.AlertCreationDialog=e.AlertCreationDialog;exports.AlertManagementPage=e.AlertManagementPage;exports.AlertsApiError=e.AlertsApiError;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;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.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.deleteAlert=e.deleteAlert;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getColumnDataType=e.getColumnDataType;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.getFilterValueType=e.getFilterValueType;exports.getFormattedTableNameForQuery=e.getFormattedTableNameForQuery;exports.getQualifiedTableName=e.getQualifiedTableName;exports.getSql=e.getSql;exports.interpretAlertContext=e.interpretAlertContext;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.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.isNumberDataType=e.isNumberDataType;exports.isTextDataType=e.isTextDataType;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAlertActions=e.useAlertActions;exports.useAlertBacktest=e.useAlertBacktest;exports.useAlertContextBuilder=e.useAlertContextBuilder;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;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.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorActions=e.useEditorActions;exports.useEditorAside=e.useEditorAside;exports.useEditorStore=e.useEditorStore;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.CalendarPreferencesDialog=E.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=E.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=N.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=P.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=D.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=D.serializeDashboardForDirtyCheck;exports.useDebouncedDirtyCheck=D.useDebouncedDirtyCheck;exports.AdvancedModeToggle=c.AdvancedModeToggle;exports.ExportNotificationItem=c.ExportNotificationItem;exports.ExportNotificationList=c.ExportNotificationList;exports.NotificationBell=c.NotificationBell;exports.ScheduleDashboard=c.ScheduleDashboard;exports.UnsavedChangesAlert=c.UnsavedChangesAlert;exports.VisualEditingControls=c.VisualEditingControls;exports.useExportPolling=c.useExportPolling;exports.useExportRecovery=c.useExportRecovery;exports.usePristineSnapshotInitializer=c.usePristineSnapshotInitializer;exports.Combobox=R;exports.TenantQuotaPage=w;exports.Visual=_;exports.useExposePrintState=F;
package/dist/index.js CHANGED
@@ -1,14 +1,15 @@
1
- import { T as y, U as T, V as P, W as _, Y as w, Z as M, _ as I, u as R, $ as g, a0 as F, P as L, s as k, B as E, a1 as B, c as A, t as Q, v as U, w as V, a2 as q, a3 as z, x as H, y as O, z as j, A as W, E as G, a4 as K } from "./chunks/index-D0TdW88i.js";
2
- import { a5 as ie, a6 as de, a7 as ce, a8 as ue, a9 as me, aa as pe, ab as he, D as be, ac as fe, ad as Ae, ae as xe, af as Ce, ag as ge, ah as ye, ah as Ee, ai as Ne, aj as De, a as ve, ak as Se, al as Te, am as Pe, an as _e, ao as we, ap as Me, aq as Ie, ar as Re, as as Fe, at as Le, au as ke, av as Be, aw as Qe, ax as Ue, ay as Ve, az as qe, aA as ze, aB as He, aC as Oe, aD as je, aE as We, aF as Ge, aG as Ke, aH as Ye, aI as $e, aJ as Xe, aK as Ze, aL as Je, aM as ea, aN as aa, aO as sa, aP as ta, aQ as ra, aR as oa, aS as na, aT as la, aU as ia, aV as da, aW as ca, aX as ua, aY as ma, aZ as pa, a_ as ha, a$ as ba, b0 as fa, b1 as Aa, b2 as xa, b3 as Ca, b4 as ga, b5 as ya, b6 as Ea, b7 as Na, b8 as Da, b9 as va, ba as Sa, bb as Ta, bc as Pa, bd as _a, be as wa, bf as Ma, bg as Ia, bh as Ra, bi as Fa, bj as La, bk as ka, bl as Ba, bm as Qa, bn as Ua, bo as Va, bp as qa, bq as za, br as Ha, bs as Oa, bt as ja, bu as Wa, bv as Ga, bw as Ka, bx as Ya, by as $a, bz as Xa, bA as Za, bB as Ja, bC as es, bD as as, bE as ss, bF as ts, bG as rs, bH as os } from "./chunks/index-D0TdW88i.js";
1
+ import { T as y, U as T, V as P, W as _, Y as w, Z as M, _ as I, u as R, $ as g, a0 as F, P as k, s as L, B as E, a1 as B, c as A, t as Q, v as z, w as U, a2 as V, a3 as q, x as H, y as O, z as j, A as W, E as G, a4 as K } from "./chunks/index-CAVrkf9d.js";
2
+ import { a5 as ie, a6 as de, a7 as ce, a8 as ue, a9 as me, aa as pe, ab as he, D as be, ac as fe, ad as Ae, ae as xe, af as Ce, ag as ge, ah as ye, ah as Ee, ai as De, aj as Ne, a as ve, ak as Se, al as Te, am as Pe, an as _e, ao as we, ap as Me, aq as Ie, ar as Re, as as Fe, at as ke, au as Le, av as Be, aw as Qe, ax as ze, ay as Ue, az as Ve, aA as qe, aB as He, aC as Oe, aD as je, aE as We, aF as Ge, aG as Ke, aH as Ye, aI as $e, aJ as Xe, aK as Ze, aL as Je, aM as ea, aN as aa, aO as sa, aP as ta, aQ as ra, aR as oa, aS as na, aT as la, aU as ia, aV as da, aW as ca, aX as ua, aY as ma, aZ as pa, a_ as ha, a$ as ba, b0 as fa, b1 as Aa, b2 as xa, b3 as Ca, b4 as ga, b5 as ya, b6 as Ea, b7 as Da, b8 as Na, b9 as va, ba as Sa, bb as Ta, bc as Pa, bd as _a, be as wa, bf as Ma, bg as Ia, bh as Ra, bi as Fa, bj as ka, bk as La, bl as Ba, bm as Qa, bn as za, bo as Ua, bp as Va, bq as qa, br as Ha, bs as Oa, bt as ja, bu as Wa, bv as Ga, bw as Ka, bx as Ya, by as $a, bz as Xa, bA as Za, bB as Ja, bC as es, bD as as, bE as ss, bF as ts, bG as rs, bH as os } from "./chunks/index-CAVrkf9d.js";
3
3
  import { E as ls } from "./chunks/common-types-DhqlRVrq.js";
4
- import { C as ds, D as cs } from "./chunks/dashboard-summary-settings-dialog-CO1SwHHD.js";
4
+ import { C as ds, D as cs } from "./chunks/dashboard-summary-settings-dialog-THx-gjnG.js";
5
5
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
6
6
  import * as b from "react";
7
7
  import { useMemo as Y, useEffect as $ } from "react";
8
- import { ResourceManagementPanel as ms } from "./chunks/resource-management-panel-DS_WEv1x.js";
8
+ import { ResourceManagementPanel as ms } from "./chunks/resource-management-panel-BVTgbma8.js";
9
9
  import { DEFAULT_CALENDAR_CONTEXT as hs } from "./types/index.js";
10
+ import { n as fs, s as As, u as xs } from "./chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js";
10
11
  import "react-dom";
11
- import { A as fs, E as As, a as xs, N as Cs, S as gs, U as ys, V as Es, u as Ns, b as Ds, c as vs } from "./chunks/notification-bell-DFiRaeJQ.js";
12
+ import { A as gs, E as ys, a as Es, N as Ds, S as Ns, U as vs, V as Ss, u as Ts, b as Ps, c as _s } from "./chunks/notification-bell-C3a7wC1u.js";
12
13
  function se(a) {
13
14
  const { displayPreferences: s, ...i } = a, c = {
14
15
  ...i,
@@ -71,9 +72,9 @@ function te({
71
72
  icon: t,
72
73
  showNone: u = !1
73
74
  }) {
74
- const m = b.useRef(null), [x, C] = b.useState(!1), [N, D] = b.useState("100%"), f = u ? [...s || [], { id: "none", name: "None" }] : s;
75
+ const m = b.useRef(null), [x, C] = b.useState(!1), [D, N] = b.useState("100%"), f = u ? [...s || [], { id: "none", name: "None" }] : s;
75
76
  b.useLayoutEffect(() => {
76
- m.current && D(m.current.offsetWidth);
77
+ m.current && N(m.current.offsetWidth);
77
78
  }, []);
78
79
  function v() {
79
80
  var d;
@@ -82,8 +83,8 @@ function te({
82
83
  function S(d, h) {
83
84
  c(h), C(!1);
84
85
  }
85
- return /* @__PURE__ */ o(L, { open: x, onOpenChange: C, children: [
86
- /* @__PURE__ */ e(k, { asChild: !0, children: /* @__PURE__ */ o(
86
+ return /* @__PURE__ */ o(k, { open: x, onOpenChange: C, children: [
87
+ /* @__PURE__ */ e(L, { asChild: !0, children: /* @__PURE__ */ o(
87
88
  E,
88
89
  {
89
90
  ref: m,
@@ -104,12 +105,12 @@ function te({
104
105
  Q,
105
106
  {
106
107
  className: "w-full p-0",
107
- style: { minWidth: N },
108
- children: /* @__PURE__ */ o(U, { children: [
108
+ style: { minWidth: D },
109
+ children: /* @__PURE__ */ o(z, { children: [
109
110
  /* @__PURE__ */ o("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
110
- /* @__PURE__ */ e(V, { className: "h-9", placeholder: "Search..." }),
111
- /* @__PURE__ */ e(q, { className: "h-7", onClick: p, children: /* @__PURE__ */ e(
112
- z,
111
+ /* @__PURE__ */ e(U, { className: "h-9", placeholder: "Search..." }),
112
+ /* @__PURE__ */ e(V, { className: "h-7", onClick: p, children: /* @__PURE__ */ e(
113
+ q,
113
114
  {
114
115
  className: A(
115
116
  "size-3.5 opacity-50",
@@ -202,7 +203,7 @@ function oe() {
202
203
  ] });
203
204
  }
204
205
  export {
205
- fs as AdvancedModeToggle,
206
+ gs as AdvancedModeToggle,
206
207
  ie as AlertCreationDialog,
207
208
  de as AlertManagementPage,
208
209
  ce as AlertsApiError,
@@ -219,23 +220,23 @@ export {
219
220
  Ae as DashboardWC,
220
221
  ls as EMPTY_SELECTION,
221
222
  xe as ExportError,
222
- As as ExportNotificationItem,
223
- xs as ExportNotificationList,
224
- Cs as NotificationBell,
223
+ ys as ExportNotificationItem,
224
+ Es as ExportNotificationList,
225
+ Ds as NotificationBell,
225
226
  Ce as PivotMarkerEnum,
226
227
  ms as ResourceManagementPanel,
227
228
  ge as ResourceType,
228
- gs as ScheduleDashboard,
229
+ Ns as ScheduleDashboard,
229
230
  P as SemaphorContextProvider,
230
231
  ye as SemaphorDataProvider,
231
232
  Ee as SemaphorQueryClient,
232
- Ne as ShareDialog,
233
- De as SummaryCard,
233
+ De as ShareDialog,
234
+ Ne as SummaryCard,
234
235
  ve as Surfboard,
235
236
  oe as TenantQuotaPage,
236
- ys as UnsavedChangesAlert,
237
+ vs as UnsavedChangesAlert,
237
238
  se as Visual,
238
- Es as VisualEditingControls,
239
+ Ss as VisualEditingControls,
239
240
  Se as backtestAlert,
240
241
  Te as cancelExport,
241
242
  Pe as cloneDeep,
@@ -245,14 +246,14 @@ export {
245
246
  Ie as createSqlGenConfig,
246
247
  Re as deleteAlert,
247
248
  Fe as downloadPdf,
248
- Le as emitDashboardLoad,
249
- ke as emitDashboardUnload,
249
+ ke as emitDashboardLoad,
250
+ Le as emitDashboardUnload,
250
251
  Be as fmt,
251
252
  Qe as formatFileSize,
252
- Ue as getAlert,
253
- Ve as getAlertContextSources,
254
- qe as getAlertHistory,
255
- ze as getAlertQuotaUsage,
253
+ ze as getAlert,
254
+ Ue as getAlertContextSources,
255
+ Ve as getAlertHistory,
256
+ qe as getAlertQuotaUsage,
256
257
  He as getAlertRunDeliveries,
257
258
  Oe as getAlertRunSteps,
258
259
  je as getAlertRuns,
@@ -279,16 +280,18 @@ export {
279
280
  ma as isTextDataType,
280
281
  pa as listAlertQuotas,
281
282
  ha as listAlerts,
283
+ fs as normalizeDashboardForDirtyCheck,
282
284
  ba as previewAlertDeliverable,
283
285
  fa as resolveDataType,
284
286
  Aa as resolveDatamodelName,
287
+ As as serializeDashboardForDirtyCheck,
285
288
  xa as triggerAlertNow,
286
289
  Ca as updateAlert,
287
290
  ga as updateAlertContextSources,
288
291
  ya as updateAlertQuota,
289
292
  Ea as useActiveExports,
290
- Na as useAlertActions,
291
- Da as useAlertBacktest,
293
+ Da as useAlertActions,
294
+ Na as useAlertBacktest,
292
295
  va as useAlertContextBuilder,
293
296
  Sa as useAlertDeliveries,
294
297
  Ta as useAlertDetail,
@@ -300,14 +303,14 @@ export {
300
303
  Ia as useAlertState,
301
304
  Ra as useAlertStore,
302
305
  Fa as useAlerts,
303
- La as useAlertsBootstrap,
304
- ka as useAlertsById,
306
+ ka as useAlertsBootstrap,
307
+ La as useAlertsById,
305
308
  Ba as useAlertsForCard,
306
309
  Qa as useCard,
307
- Ua as useCardAlertMap,
308
- Va as useCardSummary,
309
- qa as useCurrentActiveCard,
310
- za as useCurrentCardConfig,
310
+ za as useCardAlertMap,
311
+ Ua as useCardSummary,
312
+ Va as useCurrentActiveCard,
313
+ qa as useCurrentCardConfig,
311
314
  Ha as useCurrentSheetActiveCards,
312
315
  Oa as useDashboardActions,
313
316
  ja as useDashboardById,
@@ -316,17 +319,18 @@ export {
316
319
  Ga as useDashboardSummary,
317
320
  Ka as useDataColumns,
318
321
  Ya as useDateFilterHook,
322
+ xs as useDebouncedDirtyCheck,
319
323
  $a as useEditorActions,
320
324
  Xa as useEditorAside,
321
325
  Za as useEditorStore,
322
326
  Ja as useExportActions,
323
- Ns as useExportPolling,
324
- Ds as useExportRecovery,
327
+ Ts as useExportPolling,
328
+ Ps as useExportRecovery,
325
329
  es as useExportStore,
326
330
  re as useExposePrintState,
327
331
  as as useInProgressExportsCount,
328
332
  ss as useManagementStore,
329
- vs as usePristineSnapshotInitializer,
333
+ _s as usePristineSnapshotInitializer,
330
334
  ts as useResourceManagement,
331
335
  rs as useSelectedAlertId,
332
336
  os as useTextFilterHook
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/normalize-dashboard-for-dirty-check-D9x96J2F.js");exports.normalizeDashboardForDirtyCheck=e.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=e.serializeDashboardForDirtyCheck;exports.useDebouncedDirtyCheck=e.useDebouncedDirtyCheck;
@@ -0,0 +1,6 @@
1
+ import { n as a, s as o, u as s } from "../chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js";
2
+ export {
3
+ a as normalizeDashboardForDirtyCheck,
4
+ o as serializeDashboardForDirtyCheck,
5
+ s as useDebouncedDirtyCheck
6
+ };