react-semaphor 0.1.180 → 0.1.182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{dashboard-controls-CS3pAVZi.js → dashboard-controls-BnBXzFOj.js} +4 -4
- package/dist/chunks/{dashboard-controls-Baw7eUyM.js → dashboard-controls-pGlGtKRR.js} +1 -1
- package/dist/chunks/{dashboard-json-Cz4bNnCC.js → dashboard-json-CiIyCwJi.js} +1 -1
- package/dist/chunks/{dashboard-json-ClalWYi4.js → dashboard-json-UVBr47Qj.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BMElXt-n.js → edit-dashboard-visual-CXvyi_qa.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DFJ5FJ7y.js → edit-dashboard-visual-DoP_x_tT.js} +2 -2
- package/dist/chunks/{editor-action-buttons-MtNYw1Bb.js → editor-action-buttons-5UEhKl88.js} +2 -2
- package/dist/chunks/{editor-action-buttons-DVWnnC_r.js → editor-action-buttons-Bftd6Bfx.js} +1 -1
- package/dist/chunks/{index-CfPKTeUk.js → index-D59dkH2b.js} +111 -111
- package/dist/chunks/{index-CAeKp6K8.js → index-ahdw_esL.js} +5656 -5614
- package/dist/chunks/{notification-bell-YZ8VqdwA.js → notification-bell-CKI2j8jH.js} +153 -146
- package/dist/chunks/{notification-bell-2dZI5OV0.js → notification-bell-DtWcBdzp.js} +3 -8
- package/dist/chunks/{resource-management-panel-Buhi-kvP.js → resource-management-panel-BLiCtZZE.js} +1 -1
- package/dist/chunks/{resource-management-panel-pxL28GXq.js → resource-management-panel-qkl060k8.js} +3 -3
- package/dist/chunks/{use-role-aware-display-preferences-B_i2f9tn.js → use-role-aware-display-preferences-CLf3yEts.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-JljRcjrP.js → use-role-aware-display-preferences-JstD5WLE.js} +1 -1
- package/dist/chunks/{use-visual-utils-D3HjbsKO.js → use-visual-utils-BbN7rxtD.js} +1 -1
- package/dist/chunks/{use-visual-utils-DPEHcmFT.js → use-visual-utils-TGjvLx_R.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
"use strict";const f=require("react"),t=require("./index-
|
|
1
|
+
"use strict";const f=require("react"),t=require("./index-D59dkH2b.js"),e=require("react/jsx-runtime"),N=require("./editor-action-buttons-Bftd6Bfx.js"),T=require("./use-visual-utils-TGjvLx_R.js"),I=require("./index-8Crk3ROJ.js");/**
|
|
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 P=t.createLucideIcon("
|
|
7
|
-
* @license lucide-react v0.453.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const V=t.createLucideIcon("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
|
|
6
|
+
*/const P=t.createLucideIcon("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
|
|
12
7
|
* @license lucide-react v0.453.0 - ISC
|
|
13
8
|
*
|
|
14
9
|
* This source code is licensed under the ISC license.
|
|
@@ -18,4 +13,4 @@
|
|
|
18
13
|
*
|
|
19
14
|
* This source code is licensed under the ISC license.
|
|
20
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const M=t.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"}]]),R=1e4,B=15e3,z=3e4,O=3e4,$=12e4,U=2*60*60*1e3;function q(s){const r=Date.now()-s.getTime();return r<O?R:r<$?B:z}function H(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),c=t.useExportStore(v=>v.activeExports),[o,h]=f.useState(typeof document<"u"?!document.hidden:!0),i=f.useRef(null),n=f.useRef(!1),a=f.useRef(void 0),m=r==null?void 0:r.apiServiceUrl,d=s==null?void 0:s.accessToken,g=f.useCallback(()=>{const v=t.useExportStore.getState().activeExports;return Array.from(v.values()).filter(b=>t.isExportInProgress(b.status))},[]);f.useEffect(()=>{if(typeof document>"u")return;const v=()=>{h(!document.hidden)};return document.addEventListener("visibilitychange",v),()=>{document.removeEventListener("visibilitychange",v)}},[]);const C=f.useCallback(async()=>{if(!m||!d){n.current=!1;return}const v=g();if(v.length===0){n.current=!1;return}const b=Date.now(),E=v.filter(x=>b-x.startedAt.getTime()>U);if(E.length>0){const{updateExport:x}=t.useExportStore.getState().actions;for(const l of E)x(l.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const p=v.filter(x=>b-x.startedAt.getTime()<=U);if(p.length===0){n.current=!1;return}const j=await Promise.allSettled(p.map(async x=>{try{const l=await t.getExportStatus(m,d,x.id);let w;if(l.status==="completed")try{w=await t.getDownloadUrl(m,d,x.id)}catch(D){console.error(`[useExportPolling] Failed to get download URL for ${x.id}:`,D)}return{id:x.id,status:l.status,progress:l.progress,completedChunks:l.completedChunks,completedAt:l.completedAt?new Date(l.completedAt):void 0,lastUpdatedAt:new Date,fileSize:l.fileSize,error:l.error,downloadUrl:w}}catch(l){return console.error(`[useExportPolling] Failed to poll export ${x.id}:`,l),null}})),{updateExport:S}=t.useExportStore.getState().actions;for(const x of j)x.status==="fulfilled"&&x.value&&S(x.value.id,x.value);const u=g();if(u.length>0&&!document.hidden){const x=u.reduce((w,D)=>D.startedAt<w?D.startedAt:w,u[0].startedAt),l=q(x);i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{var w;(w=a.current)==null||w.call(a)},l)}else n.current=!1},[m,d,g]);return f.useEffect(()=>{a.current=C},[C]),f.useEffect(()=>{var b;g().length>0&&o&&!n.current&&(n.current=!0,(b=a.current)==null||b.call(a))},[c,o,g]),f.useEffect(()=>{var b;const v=g();o&&v.length>0&&!n.current&&(n.current=!0,(b=a.current)==null||b.call(a))},[o,g]),f.useEffect(()=>{!o&&i.current&&(clearTimeout(i.current),i.current=null,n.current=!1)},[o]),f.useEffect(()=>()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),{isPolling:n.current,isTabVisible:o,inProgressCount:g().length}}function _(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),c=t.useExportStore(a=>a.activeExports),{addExport:o}=t.useExportActions(),h=f.useRef(!1),i=r==null?void 0:r.apiServiceUrl,n=s==null?void 0:s.accessToken;f.useEffect(()=>{if(h.current||!i||!n)return;(async()=>{try{const{exports:m}=await t.getExports(i,n,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const d of m){if(c.has(d.id))continue;const g=d.totalChunks?Math.round(d.completedChunks/d.totalChunks*100):0;let C;if(d.status==="completed")try{C=await t.getDownloadUrl(i,n,d.id)}catch(b){console.error(`[useExportRecovery] Failed to get download URL for ${d.id}:`,b)}const v={id:d.id,status:d.status,progress:g,title:X(d),totalRows:d.totalRows,totalChunks:d.totalChunks,completedChunks:d.completedChunks,startedAt:new Date(d.createdAt),lastUpdatedAt:new Date,completedAt:d.completedAt?new Date(d.completedAt):void 0,fileSize:d.fileSize,error:d.error,expiresAt:new Date(d.expiresAt),downloadUrl:C};o(v)}h.current=!0}catch(m){console.error("[useExportRecovery] Failed to recover exports:",m),h.current=!0}})()},[i,n,o,c])}function X(s){return s.title?s.title:t.isExportInProgress(s.status)?"Export in progress...":s.status==="completed"?"Export completed":s.status==="failed"?"Export failed":"Export"}function G({open:s,onOpenChange:r,isLibraryVisual:c,currentVisualName:o,isSaving:h=!1,onConfirm:i}){const[n,a]=f.useState(c&&o?`Copy of ${o}`:o||""),[m,d]=f.useState(""),[g,C]=f.useState(!c),[v,b]=f.useState(!0);f.useEffect(()=>{s&&(a(c&&o?`Copy of ${o}`:o||""),d(""),C(!c),b(!0))},[s,c,o]);const E=()=>{n.trim()&&(!g&&!v||i({name:n.trim(),description:m.trim()||void 0,saveToLibrary:g,saveToCurrentDashboard:v}))},p=n.trim()&&(g||v);return e.jsx(t.Dialog,{open:s,onOpenChange:r,children:e.jsxs(t.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Save Visual As"}),e.jsx(t.DialogDescription,{children:c?"Create a copy of this visual with a new name":"Save this visual to make it reusable"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"name",children:"Name"}),e.jsx(t.Input,{id:"name",value:n,onChange:j=>a(j.target.value),placeholder:"Enter visual name",disabled:h})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Textarea,{id:"description",value:m,onChange:j=>d(j.target.value),placeholder:"Enter visual description",rows:3,disabled:h})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(t.Label,{children:"Save to:"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(t.Checkbox,{id:"save-to-dashboard",checked:v,onCheckedChange:j=>b(!!j),disabled:h}),e.jsxs("label",{htmlFor:"save-to-dashboard",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Current Dashboard",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c?"(add copy to this dashboard)":"(keep as local visual)"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(t.Checkbox,{id:"save-to-library",checked:g,onCheckedChange:j=>C(!!j),disabled:h}),e.jsxs("label",{htmlFor:"save-to-library",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Visual Library",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c?"(save as new reusable visual)":"(make available to all dashboards)"})]})]})]}),!g&&!v&&e.jsx("p",{className:"text-sm text-destructive",children:"Please select at least one destination"})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>r(!1),disabled:h,children:"Cancel"}),e.jsxs(t.Button,{onClick:E,disabled:!p||h,children:[h&&e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),h?"Saving...":"Save"]})]})]})})}function W(){const[s,r]=f.useState(!1),[c,o]=f.useState(!1),[h,i]=f.useState(null),n=t.useEditorStore(l=>l.frame),a=t.useEditorStore(l=>l.card),m=t.useSelectedVisual(),d=t.useDashboardStore(l=>l.selectedSheetId),g=t.useDashboardStore(l=>l.actions.setIsDashboardPanelOpen),{getUpdatedFrame:C}=T.useVisualUtils(),{selectVisual:v}=t.useManagementActions(),{addFrame:b,setSelectedFrameId:E,setIsVisualEditing:p}=t.useDashboardActions(),j=!!(n!=null&&n.visualId),S=(()=>{var l,w;return((l=n==null?void 0:n.cards)==null?void 0:l.length)===1&&((w=n.cards[0])!=null&&w.title)?n.cards[0].title:m!=null&&m.title?m.title:(a==null?void 0:a.title)||"Untitled Visual"})(),u=t.useCreateVisualWithFrame(l=>{if(l!=null&&l.id){if(v(l),c&&h&&d){const w={...h,id:t.v4(),visualId:l.id};b(d,w,"end"),E(w.id),o(!1),i(null),p(!1)}g(!0),r(!1)}});return{saveAsDialogOpen:s,setSaveAsDialogOpen:r,handleSaveAs:async l=>{if(!d){t.ue.error("No sheet selected");return}const w=C(),A=w.cards.length===1?{...w,cards:w.cards.map(y=>({...y,title:l.name}))}:w;if(l.saveToLibrary){o(l.saveToCurrentDashboard),i(A);const y={title:l.name,description:l.description,frameObject:A,isPrivate:!1};u.mutate(y)}else if(l.saveToCurrentDashboard){const y={...A,id:t.v4(),visualId:void 0};b(d,y,"end"),E(y.id),t.ue.success("Visual saved to dashboard"),r(!1),p(!1)}},isLibraryVisual:j,currentVisualName:S,isSaving:u.isPending}}function Q({className:s}){const r=t.useEditorStore(u=>u.frame),c=t.useEditorStore(u=>u.card),o=t.useManagementStore(u=>u.selectedVisual),h=t.useDashboardStore(u=>u.selectedFrameId),i=t.useDashboardStore(u=>u.selectedSheetId),{setIsVisualEditing:n}=t.useDashboardActions(),a=!!(r!=null&&r.visualId||o!=null&&o.id),m=!!(r!=null&&r.visualId&&h),d=a&&!m,{saveAsDialogOpen:g,setSaveAsDialogOpen:C,handleSaveAs:v,isLibraryVisual:b,currentVisualName:E,isSaving:p}=W(),{handleAddLibraryVisual:j}=T.useVisualUtils(),S=async()=>{if(!i){t.ue.error("No dashboard sheet selected");return}if(!o){t.ue.error("No visual selected");return}const u=await j(o);u.success?(t.ue.success("Visual added to dashboard"),n(!1)):t.ue.error(u.error||"Failed to add visual to dashboard")};return e.jsxs(e.Fragment,{children:[!a&&e.jsx(N.EditorAcceptButton,{className:s,variant:"default"}),a&&e.jsxs(e.Fragment,{children:[m&&e.jsx(N.VisualApplyLocalButton,{className:s}),d&&i&&c&&(c.sql||t.hasValidCardConfig(c.config))&&e.jsxs(t.Button,{onClick:S,className:t.cn(s),size:"sm",variant:"outline",children:[e.jsx(V,{className:"mr-2 size-4 font-bold"}),"Add to Dashboard"]}),d&&e.jsx(N.VisualSaveButton,{className:s,variant:"default"}),m&&e.jsx(N.VisualSaveAndApplyButton,{className:s}),e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.Button,{variant:"outline",size:"sm",className:t.cn(s,"w-8 p-0"),children:e.jsx(t.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsx(t.DropdownMenuContent,{align:"end",children:e.jsxs(t.DropdownMenuItem,{onClick:u=>{u.stopPropagation(),C(!0)},children:[e.jsx(N.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]})]}),!a&&e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.Button,{variant:"outline",size:"sm",className:t.cn(s,"w-8 p-0"),children:e.jsx(t.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsx(t.DropdownMenuContent,{align:"end",children:e.jsxs(t.DropdownMenuItem,{onClick:()=>C(!0),children:[e.jsx(N.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]}),e.jsx(N.EditorCancelButton,{className:s}),e.jsx(G,{open:g,onOpenChange:u=>{p||C(u)},isLibraryVisual:b,currentVisualName:E,isSaving:p,onConfirm:v})]})}function Y({className:s,switchClassName:r}){const c=t.useEditorStore(a=>a.isDevMode),o=t.useDashboardStore(a=>a.isVisualEditing),{setIsDevMode:h}=t.useEditorActions(),{config:i}=f.useContext(t.SemaphorContext).tokenProps,n=(i==null?void 0:i.showAdvancedMode)!==!1;return!o||!n?null:e.jsxs("div",{className:t.cn("flex items-center space-x-2",s),children:[e.jsx(t.DevModeSwitch,{className:t.cn("",r),checked:c,onCheckedChange:()=>h(!c),id:"advanced-mode",icon:e.jsx(t.CodeXml,{className:"h-4 w-4"}),tooltip:"Advanced Mode"}),e.jsx("label",{htmlFor:"advanced-mode",className:"sr-only",children:"Advanced Mode"})]})}function Z({open:s,onOpenChange:r,onSave:c,onDiscard:o,isSaving:h}){const i=n=>{!n&&h||r(n)};return e.jsx(t.AlertDialog,{open:s,onOpenChange:i,children:e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100",children:e.jsx(t.TriangleAlert,{className:"h-5 w-5 text-amber-600"})}),e.jsx(t.AlertDialogTitle,{className:"text-xl",children:"Unsaved Changes"})]}),e.jsx(t.AlertDialogDescription,{className:"pt-2 text-base leading-relaxed",children:"You have unsaved changes to this dashboard. What would you like to do?"})]}),e.jsxs(t.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsx(t.AlertDialogCancel,{disabled:h,className:"order-1 m-0 border-border/50 sm:order-1",children:"Cancel"}),e.jsx("button",{onClick:o,disabled:h,className:"order-2 rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",children:"Discard"}),e.jsx(t.AlertDialogAction,{onClick:c,disabled:h,className:"order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",children:h?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save & Close"})]})]})})}function J(s,r,c,o){f.useEffect(()=>{s&&!c&&r&&o(t.cloneDeep(r))},[s,c,r,o])}function K({triggerButtonClassName:s}){const[r,c]=f.useState(!1),o=t.useDashboardStore(a=>{var m;return(m=a.dashboard)==null?void 0:m.id}),h=t.useDashboardStore(a=>{var m;return(m=a.dashboard)==null?void 0:m.title}),i=t.useDashboardStore(a=>{var m;return(m=a.dashboard)==null?void 0:m.sheets}),n=t.useDashboardStore(a=>a.selectedSheetId);return i==null||i.find(a=>a.id===n),o?e.jsxs(e.Fragment,{children:[e.jsx(t.IconButton,{tooltip:"Schedule Dashboard",className:t.cn("h-7 p-2",s),onClick:()=>c(!0),children:e.jsx(t.Clock,{className:"size-4"})}),e.jsx(t.EmailScheduleDialog,{open:r,onOpenChange:c,dashboardId:o,dashboardName:h})]}):null}function F({export:s,onRemove:r}){const c=()=>{s.downloadUrl&&window.open(s.downloadUrl,"_blank")},o=a=>{a.stopPropagation(),r==null||r(s.id)},h=()=>{switch(s.status){case"completed":return e.jsx(P,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return e.jsx(N.CircleX,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return e.jsx(t.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},i=t.isExportInProgress(s.status),n=(()=>{switch(s.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return e.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[h(),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:s.title}),s.status==="completed"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.totalRows.toLocaleString()," rows"]}),s.fileSize&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t.formatFileSize(s.fileSize)})]})]}),i&&e.jsx("div",{className:"text-xs text-muted-foreground",children:n}),s.status==="failed"&&e.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:s.error||"Export failed"})]})]}),e.jsx(t.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:o,"aria-label":"Remove notification",children:e.jsx(t.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"ml-8",children:[s.status==="completed"&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})}),s.downloadUrl&&e.jsxs(t.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:c,children:[e.jsx(t.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),i&&e.jsxs("div",{children:[e.jsx(t.Progress,{value:s.progress,className:"h-1.5"}),e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[s.progress,"% complete"]})]}),s.status==="failed"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})})]})]})}function L(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),c=t.useExportStore(p=>p.activeExports),{clearCompleted:o,removeExport:h,updateExport:i}=t.useExportActions(),[n,a]=f.useState(!1),[m,d]=f.useState(!1),g=Array.from(c.values()).sort((p,j)=>j.startedAt.getTime()-p.startedAt.getTime()),C=g.some(p=>p.status==="completed"||p.status==="failed"),v=f.useCallback(async()=>{const p=r==null?void 0:r.apiServiceUrl,j=s==null?void 0:s.accessToken;if(!(!p||!j)){a(!0);try{const S=Array.from(c.values());await Promise.all(S.map(async u=>{try{const x=await t.getExportStatus(p,j,u.id);let l;if(x.status==="completed")try{l=await t.getDownloadUrl(p,j,u.id)}catch(w){console.error(`Failed to get download URL for ${u.id}:`,w)}i(u.id,{status:x.status,progress:x.progress,completedChunks:x.completedChunks,completedAt:x.completedAt?new Date(x.completedAt):void 0,lastUpdatedAt:new Date,fileSize:x.fileSize,error:x.error,downloadUrl:l})}catch(x){console.error(`Failed to refresh export ${u.id}:`,x)}}))}finally{a(!1)}}},[c,s==null?void 0:s.accessToken,r==null?void 0:r.apiServiceUrl,i]),b=f.useCallback(async()=>{const p=r==null?void 0:r.apiServiceUrl,j=s==null?void 0:s.accessToken;if(!p||!j){o();return}d(!0);try{const S=g.filter(u=>u.status==="completed"||u.status==="failed");await Promise.all(S.map(u=>t.cancelExport(p,j,u.id).catch(x=>console.error(`Failed to delete export ${u.id}:`,x)))),o()}finally{d(!1)}},[g,r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,o]),E=f.useCallback(async p=>{const j=r==null?void 0:r.apiServiceUrl,S=s==null?void 0:s.accessToken;if(j&&S)try{await t.cancelExport(j,S,p)}catch(u){console.error(`Failed to cancel export ${p}:`,u)}h(p)},[r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,h]);return g.length===0?e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(k,{className:"h-8 w-8 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Large exports will appear here"})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"px-4 py-3 border-b flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h4",{className:"font-semibold",children:"Exports"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:v,disabled:n,title:"Refresh status",children:e.jsx(M,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),C&&e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 text-sm px-2",onClick:b,disabled:m,children:m?"Clearing...":"Clear all"})]})]}),e.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:e.jsx("div",{className:"divide-y",children:g.map(p=>e.jsx(F,{export:p,onRemove:E},p.id))})}),e.jsxs("div",{className:"px-4 py-2 border-t text-sm text-muted-foreground text-center",children:[g.length," total export",g.length!==1?"s":""]})]})}function ee(){const s=t.useExportStore(a=>a.activeExports),r=t.useInProgressExportsCount(),c=s.size>0,o=Array.from(s.values()).some(a=>a.status==="completed"||a.status==="failed"),i=r>0?r>9?"9+":String(r):null,n=c;return e.jsxs(t.Popover,{children:[e.jsx(t.PopoverTrigger,{asChild:!0,children:e.jsxs(t.Button,{variant:"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Export notifications",children:[e.jsx(t.Bell,{className:"h-4 w-4"}),n&&e.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${i?"-right-0.5 -top-0.5 h-4 min-w-4 px-0.5 text-[10px] font-semibold":"right-0.5 top-0.5 h-2 w-2"}`,children:i})]})}),e.jsx(t.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:e.jsx(L,{})})]})}exports.AdvancedModeToggle=Y;exports.ExportNotificationItem=F;exports.ExportNotificationList=L;exports.NotificationBell=ee;exports.RefreshCw=M;exports.ScheduleDashboard=K;exports.UnsavedChangesAlert=Z;exports.VisualEditingControls=Q;exports.useExportPolling=H;exports.useExportRecovery=_;exports.usePristineSnapshotInitializer=J;
|
|
16
|
+
*/const M=t.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"}]]),V=1e4,R=15e3,B=3e4,z=3e4,O=12e4,U=2*60*60*1e3;function $(s){const r=Date.now()-s.getTime();return r<z?V:r<O?R:B}function q(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),c=t.useExportStore(g=>g.activeExports),[o,h]=f.useState(typeof document<"u"?!document.hidden:!0),i=f.useRef(null),n=f.useRef(!1),a=f.useRef(void 0),m=r==null?void 0:r.apiServiceUrl,d=s==null?void 0:s.accessToken,v=f.useCallback(()=>{const g=t.useExportStore.getState().activeExports;return Array.from(g.values()).filter(b=>t.isExportInProgress(b.status))},[]);f.useEffect(()=>{if(typeof document>"u")return;const g=()=>{h(!document.hidden)};return document.addEventListener("visibilitychange",g),()=>{document.removeEventListener("visibilitychange",g)}},[]);const C=f.useCallback(async()=>{if(!m||!d){n.current=!1;return}const g=v();if(g.length===0){n.current=!1;return}const b=Date.now(),E=g.filter(x=>b-x.startedAt.getTime()>U);if(E.length>0){const{updateExport:x}=t.useExportStore.getState().actions;for(const l of E)x(l.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const p=g.filter(x=>b-x.startedAt.getTime()<=U);if(p.length===0){n.current=!1;return}const j=await Promise.allSettled(p.map(async x=>{try{const l=await t.getExportStatus(m,d,x.id);let w;if(l.status==="completed")try{w=await t.getDownloadUrl(m,d,x.id)}catch(y){console.error(`[useExportPolling] Failed to get download URL for ${x.id}:`,y)}return{id:x.id,status:l.status,progress:l.progress,completedChunks:l.completedChunks,completedAt:l.completedAt?new Date(l.completedAt):void 0,lastUpdatedAt:new Date,fileSize:l.fileSize,error:l.error,downloadUrl:w}}catch(l){return console.error(`[useExportPolling] Failed to poll export ${x.id}:`,l),null}})),{updateExport:S}=t.useExportStore.getState().actions;for(const x of j)x.status==="fulfilled"&&x.value&&S(x.value.id,x.value);const u=v();if(u.length>0&&!document.hidden){const x=u.reduce((w,y)=>y.startedAt<w?y.startedAt:w,u[0].startedAt),l=$(x);i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{var w;(w=a.current)==null||w.call(a)},l)}else n.current=!1},[m,d,v]);return f.useEffect(()=>{a.current=C},[C]),f.useEffect(()=>{var b;v().length>0&&o&&!n.current&&(n.current=!0,(b=a.current)==null||b.call(a))},[c,o,v]),f.useEffect(()=>{var b;const g=v();o&&g.length>0&&!n.current&&(n.current=!0,(b=a.current)==null||b.call(a))},[o,v]),f.useEffect(()=>{!o&&i.current&&(clearTimeout(i.current),i.current=null,n.current=!1)},[o]),f.useEffect(()=>()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),{isPolling:n.current,isTabVisible:o,inProgressCount:v().length}}function H(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),c=t.useExportStore(a=>a.activeExports),{addExport:o}=t.useExportActions(),h=f.useRef(!1),i=r==null?void 0:r.apiServiceUrl,n=s==null?void 0:s.accessToken;f.useEffect(()=>{if(h.current||!i||!n)return;(async()=>{try{const{exports:m}=await t.getExports(i,n,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const d of m){if(c.has(d.id))continue;const v=d.totalChunks?Math.round(d.completedChunks/d.totalChunks*100):0;let C;if(d.status==="completed")try{C=await t.getDownloadUrl(i,n,d.id)}catch(b){console.error(`[useExportRecovery] Failed to get download URL for ${d.id}:`,b)}const g={id:d.id,status:d.status,progress:v,title:_(d),totalRows:d.totalRows,totalChunks:d.totalChunks,completedChunks:d.completedChunks,startedAt:new Date(d.createdAt),lastUpdatedAt:new Date,completedAt:d.completedAt?new Date(d.completedAt):void 0,fileSize:d.fileSize,error:d.error,expiresAt:new Date(d.expiresAt),downloadUrl:C};o(g)}h.current=!0}catch(m){console.error("[useExportRecovery] Failed to recover exports:",m),h.current=!0}})()},[i,n,o,c])}function _(s){return s.title?s.title:t.isExportInProgress(s.status)?"Export in progress...":s.status==="completed"?"Export completed":s.status==="failed"?"Export failed":"Export"}function X({open:s,onOpenChange:r,isLibraryVisual:c,currentVisualName:o,isSaving:h=!1,onConfirm:i}){const[n,a]=f.useState(c&&o?`Copy of ${o}`:o||""),[m,d]=f.useState(""),[v,C]=f.useState(!c),[g,b]=f.useState(!0);f.useEffect(()=>{s&&(a(c&&o?`Copy of ${o}`:o||""),d(""),C(!c),b(!0))},[s,c,o]);const E=()=>{n.trim()&&(!v&&!g||i({name:n.trim(),description:m.trim()||void 0,saveToLibrary:v,saveToCurrentDashboard:g}))},p=n.trim()&&(v||g);return e.jsx(t.Dialog,{open:s,onOpenChange:r,children:e.jsxs(t.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:"Save Visual As"}),e.jsx(t.DialogDescription,{children:c?"Create a copy of this visual with a new name":"Save this visual to make it reusable"})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"name",children:"Name"}),e.jsx(t.Input,{id:"name",value:n,onChange:j=>a(j.target.value),placeholder:"Enter visual name",disabled:h})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Textarea,{id:"description",value:m,onChange:j=>d(j.target.value),placeholder:"Enter visual description",rows:3,disabled:h})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(t.Label,{children:"Save to:"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(t.Checkbox,{id:"save-to-dashboard",checked:g,onCheckedChange:j=>b(!!j),disabled:h}),e.jsxs("label",{htmlFor:"save-to-dashboard",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Current Dashboard",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c?"(add copy to this dashboard)":"(keep as local visual)"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(t.Checkbox,{id:"save-to-library",checked:v,onCheckedChange:j=>C(!!j),disabled:h}),e.jsxs("label",{htmlFor:"save-to-library",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:["Visual Library",e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:c?"(save as new reusable visual)":"(make available to all dashboards)"})]})]})]}),!v&&!g&&e.jsx("p",{className:"text-sm text-destructive",children:"Please select at least one destination"})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>r(!1),disabled:h,children:"Cancel"}),e.jsxs(t.Button,{onClick:E,disabled:!p||h,children:[h&&e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),h?"Saving...":"Save"]})]})]})})}function G(){const[s,r]=f.useState(!1),[c,o]=f.useState(!1),[h,i]=f.useState(null),n=t.useEditorStore(l=>l.frame),a=t.useEditorStore(l=>l.card),m=t.useSelectedVisual(),d=t.useDashboardStore(l=>l.selectedSheetId),v=t.useDashboardStore(l=>l.actions.setIsDashboardPanelOpen),{getUpdatedFrame:C}=T.useVisualUtils(),{selectVisual:g}=t.useManagementActions(),{addFrame:b,setSelectedFrameId:E,setIsVisualEditing:p}=t.useDashboardActions(),j=!!(n!=null&&n.visualId),S=(()=>{var l,w;return((l=n==null?void 0:n.cards)==null?void 0:l.length)===1&&((w=n.cards[0])!=null&&w.title)?n.cards[0].title:m!=null&&m.title?m.title:(a==null?void 0:a.title)||"Untitled Visual"})(),u=t.useCreateVisualWithFrame(l=>{if(l!=null&&l.id){if(g(l),c&&h&&d){const w={...h,id:t.v4(),visualId:l.id};b(d,w,"end"),E(w.id),o(!1),i(null),p(!1)}v(!0),r(!1)}});return{saveAsDialogOpen:s,setSaveAsDialogOpen:r,handleSaveAs:async l=>{if(!d){t.ue.error("No sheet selected");return}const w=C(),A=w.cards.length===1?{...w,cards:w.cards.map(D=>({...D,title:l.name}))}:w;if(l.saveToLibrary){o(l.saveToCurrentDashboard),i(A);const D={title:l.name,description:l.description,frameObject:A,isPrivate:!1};u.mutate(D)}else if(l.saveToCurrentDashboard){const D={...A,id:t.v4(),visualId:void 0};b(d,D,"end"),E(D.id),t.ue.success("Visual saved to dashboard"),r(!1),p(!1)}},isLibraryVisual:j,currentVisualName:S,isSaving:u.isPending}}function W({className:s}){const r=t.useEditorStore(u=>u.frame),c=t.useEditorStore(u=>u.card),o=t.useManagementStore(u=>u.selectedVisual),h=t.useDashboardStore(u=>u.selectedFrameId),i=t.useDashboardStore(u=>u.selectedSheetId),{setIsVisualEditing:n}=t.useDashboardActions(),a=!!(r!=null&&r.visualId||o!=null&&o.id),m=!!(r!=null&&r.visualId&&h),d=a&&!m,{saveAsDialogOpen:v,setSaveAsDialogOpen:C,handleSaveAs:g,isLibraryVisual:b,currentVisualName:E,isSaving:p}=G(),{handleAddLibraryVisual:j}=T.useVisualUtils(),S=async()=>{if(!i){t.ue.error("No dashboard sheet selected");return}if(!o){t.ue.error("No visual selected");return}const u=await j(o);u.success?(t.ue.success("Visual added to dashboard"),n(!1)):t.ue.error(u.error||"Failed to add visual to dashboard")};return e.jsxs(e.Fragment,{children:[!a&&e.jsx(N.EditorAcceptButton,{className:s,variant:"default"}),a&&e.jsxs(e.Fragment,{children:[m&&e.jsx(N.VisualApplyLocalButton,{className:s}),d&&i&&c&&(c.sql||t.hasValidCardConfig(c.config))&&e.jsxs(t.Button,{onClick:S,className:t.cn(s),size:"sm",variant:"outline",children:[e.jsx(P,{className:"mr-2 size-4 font-bold"}),"Add to Dashboard"]}),d&&e.jsx(N.VisualSaveButton,{className:s,variant:"default"}),m&&e.jsx(N.VisualSaveAndApplyButton,{className:s}),e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.Button,{variant:"outline",size:"sm",className:t.cn(s,"w-8 p-0"),children:e.jsx(t.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsx(t.DropdownMenuContent,{align:"end",children:e.jsxs(t.DropdownMenuItem,{onClick:u=>{u.stopPropagation(),C(!0)},children:[e.jsx(N.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]})]}),!a&&e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.Button,{variant:"outline",size:"sm",className:t.cn(s,"w-8 p-0"),children:e.jsx(t.EllipsisVertical,{className:"h-4 w-4"})})}),e.jsx(t.DropdownMenuContent,{align:"end",children:e.jsxs(t.DropdownMenuItem,{onClick:()=>C(!0),children:[e.jsx(N.Save,{className:"mr-2 h-4 w-4"}),"Save As..."]})})]}),e.jsx(N.EditorCancelButton,{className:s}),e.jsx(X,{open:v,onOpenChange:u=>{p||C(u)},isLibraryVisual:b,currentVisualName:E,isSaving:p,onConfirm:g})]})}function Q({className:s,switchClassName:r}){const c=t.useEditorStore(a=>a.isDevMode),o=t.useDashboardStore(a=>a.isVisualEditing),{setIsDevMode:h}=t.useEditorActions(),{config:i}=f.useContext(t.SemaphorContext).tokenProps,n=(i==null?void 0:i.showAdvancedMode)!==!1;return!o||!n?null:e.jsxs("div",{className:t.cn("flex items-center space-x-2",s),children:[e.jsx(t.DevModeSwitch,{className:t.cn("",r),checked:c,onCheckedChange:()=>h(!c),id:"advanced-mode",icon:e.jsx(t.CodeXml,{className:"h-4 w-4"}),tooltip:"Advanced Mode"}),e.jsx("label",{htmlFor:"advanced-mode",className:"sr-only",children:"Advanced Mode"})]})}function Y({open:s,onOpenChange:r,onSave:c,onDiscard:o,isSaving:h}){const i=n=>{!n&&h||r(n)};return e.jsx(t.AlertDialog,{open:s,onOpenChange:i,children:e.jsxs(t.AlertDialogContent,{className:"max-w-md",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100",children:e.jsx(t.TriangleAlert,{className:"h-5 w-5 text-amber-600"})}),e.jsx(t.AlertDialogTitle,{className:"text-xl",children:"Unsaved Changes"})]}),e.jsx(t.AlertDialogDescription,{className:"pt-2 text-base leading-relaxed",children:"You have unsaved changes to this dashboard. What would you like to do?"})]}),e.jsxs(t.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:gap-2",children:[e.jsx(t.AlertDialogCancel,{disabled:h,className:"order-1 m-0 border-border/50 sm:order-1",children:"Cancel"}),e.jsx("button",{onClick:o,disabled:h,className:"order-2 rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",children:"Discard"}),e.jsx(t.AlertDialogAction,{onClick:c,disabled:h,className:"order-3 m-0 bg-primary text-primary-foreground hover:bg-primary/90 sm:order-3",children:h?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save & Close"})]})]})})}function Z(s,r,c,o){f.useEffect(()=>{s&&!c&&r&&o(t.cloneDeep(r))},[s,c,r,o])}function J({triggerButtonClassName:s}){const[r,c]=f.useState(!1),o=t.useDashboardStore(a=>{var m;return(m=a.dashboard)==null?void 0:m.id}),h=t.useDashboardStore(a=>{var m;return(m=a.dashboard)==null?void 0:m.title}),i=t.useDashboardStore(a=>{var m;return(m=a.dashboard)==null?void 0:m.sheets}),n=t.useDashboardStore(a=>a.selectedSheetId);return i==null||i.find(a=>a.id===n),o?e.jsxs(e.Fragment,{children:[e.jsx(t.IconButton,{tooltip:"Schedule Dashboard",className:t.cn("h-7 p-2",s),onClick:()=>c(!0),children:e.jsx(t.Clock,{className:"size-4"})}),e.jsx(t.EmailScheduleDialog,{open:r,onOpenChange:c,dashboardId:o,dashboardName:h})]}):null}function F({export:s,onRemove:r}){const c=()=>{s.downloadUrl&&window.open(s.downloadUrl,"_blank")},o=a=>{a.stopPropagation(),r==null||r(s.id)},h=()=>{switch(s.status){case"completed":return e.jsx(t.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return e.jsx(N.CircleX,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return e.jsx(t.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},i=t.isExportInProgress(s.status),n=(()=>{switch(s.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return e.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[h(),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:s.title}),s.status==="completed"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.totalRows.toLocaleString()," rows"]}),s.fileSize&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t.formatFileSize(s.fileSize)})]})]}),i&&e.jsx("div",{className:"text-xs text-muted-foreground",children:n}),s.status==="failed"&&e.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:s.error||"Export failed"})]})]}),e.jsx(t.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:o,"aria-label":"Remove notification",children:e.jsx(t.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"ml-8",children:[s.status==="completed"&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})}),s.downloadUrl&&e.jsxs(t.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:c,children:[e.jsx(t.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),i&&e.jsxs("div",{children:[e.jsx(t.Progress,{value:s.progress,className:"h-1.5"}),e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[s.progress,"% complete"]})]}),s.status==="failed"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})})]})]})}function L(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),c=t.useExportStore(p=>p.activeExports),{clearCompleted:o,removeExport:h,updateExport:i}=t.useExportActions(),[n,a]=f.useState(!1),[m,d]=f.useState(!1),v=Array.from(c.values()).sort((p,j)=>j.startedAt.getTime()-p.startedAt.getTime()),C=v.some(p=>p.status==="completed"||p.status==="failed"),g=f.useCallback(async()=>{const p=r==null?void 0:r.apiServiceUrl,j=s==null?void 0:s.accessToken;if(!(!p||!j)){a(!0);try{const S=Array.from(c.values());await Promise.all(S.map(async u=>{try{const x=await t.getExportStatus(p,j,u.id);let l;if(x.status==="completed")try{l=await t.getDownloadUrl(p,j,u.id)}catch(w){console.error(`Failed to get download URL for ${u.id}:`,w)}i(u.id,{status:x.status,progress:x.progress,completedChunks:x.completedChunks,completedAt:x.completedAt?new Date(x.completedAt):void 0,lastUpdatedAt:new Date,fileSize:x.fileSize,error:x.error,downloadUrl:l})}catch(x){console.error(`Failed to refresh export ${u.id}:`,x)}}))}finally{a(!1)}}},[c,s==null?void 0:s.accessToken,r==null?void 0:r.apiServiceUrl,i]),b=f.useCallback(async()=>{const p=r==null?void 0:r.apiServiceUrl,j=s==null?void 0:s.accessToken;if(!p||!j){o();return}d(!0);try{const S=v.filter(u=>u.status==="completed"||u.status==="failed");await Promise.all(S.map(u=>t.cancelExport(p,j,u.id).catch(x=>console.error(`Failed to delete export ${u.id}:`,x)))),o()}finally{d(!1)}},[v,r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,o]),E=f.useCallback(async p=>{const j=r==null?void 0:r.apiServiceUrl,S=s==null?void 0:s.accessToken;if(j&&S)try{await t.cancelExport(j,S,p)}catch(u){console.error(`Failed to cancel export ${p}:`,u)}h(p)},[r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,h]);return v.length===0?e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(k,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h4",{className:"font-semibold",children:"Exports"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:g,disabled:n,title:"Refresh status",children:e.jsx(M,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),C&&e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:b,disabled:m,children:m?"Clearing...":"Clear all"})]})]}),e.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:e.jsx("div",{className:"divide-y",children:v.map(p=>e.jsx(F,{export:p,onRemove:E},p.id))})})]})}function K(){const s=t.useExportStore(a=>a.activeExports),r=t.useInProgressExportsCount(),c=s.size>0,o=Array.from(s.values()).some(a=>a.status==="completed"||a.status==="failed"),i=r>0?r>9?"9+":String(r):null,n=c;return e.jsxs(t.Popover,{children:[e.jsx(t.PopoverTrigger,{asChild:!0,children:e.jsxs(t.Button,{variant:"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Export notifications",children:[e.jsx(t.Bell,{className:"h-4 w-4"}),n&&e.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${i?"-right-0.5 -top-0.5 h-4 min-w-4 px-0.5 text-[10px] font-semibold":"right-0.5 top-0.5 h-2 w-2"}`,children:i})]})}),e.jsx(t.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:e.jsx(L,{})})]})}exports.AdvancedModeToggle=Q;exports.ExportNotificationItem=F;exports.ExportNotificationList=L;exports.NotificationBell=K;exports.RefreshCw=M;exports.ScheduleDashboard=J;exports.UnsavedChangesAlert=Y;exports.VisualEditingControls=W;exports.useExportPolling=q;exports.useExportRecovery=H;exports.usePristineSnapshotInitializer=Z;
|
package/dist/chunks/{resource-management-panel-Buhi-kvP.js → resource-management-panel-BLiCtZZE.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-D59dkH2b.js"),c=require("react"),de=require("./use-visual-utils-TGjvLx_R.js"),pe=require("./use-role-aware-display-preferences-JstD5WLE.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/chunks/{resource-management-panel-pxL28GXq.js → resource-management-panel-qkl060k8.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
-
import { aF as Ze, u as me, au as $e, aO as re, aS as Je, aT as Qe, c as J, aU as ke, aV as et, aW as tt, B as _, aX as st, aY as at, aZ as W, a_ as pe, aG as oe, a$ as nt, b0 as it, b1 as rt, b2 as ve, b3 as De, b4 as ot, b5 as lt, I as dt, b6 as ye, e as le, b7 as Se, b8 as Ee, b9 as ct, L as Ve, R as Le, ba as Ae, bb as Te, bc as Oe, bd as Re, be as Pe, bf as Ue, bg as Ie, bh as je, bi as Fe, bj as ut, bk as ht, bl as Me, bm as ze, bn as Be, bo as mt, bp as He, bq as pt, A as ne, aN as ft, br as _e, bs as gt, bt as Dt, bu as xt, bv as bt, bw as Nt, bx as wt, by as vt, bz as Ce, bA as fe, bB as Ct, bC as yt, bD as St, bE as Et, bF as Vt } from "./index-
|
|
2
|
+
import { aF as Ze, u as me, au as $e, aO as re, aS as Je, aT as Qe, c as J, aU as ke, aV as et, aW as tt, B as _, aX as st, aY as at, aZ as W, a_ as pe, aG as oe, a$ as nt, b0 as it, b1 as rt, b2 as ve, b3 as De, b4 as ot, b5 as lt, I as dt, b6 as ye, e as le, b7 as Se, b8 as Ee, b9 as ct, L as Ve, R as Le, ba as Ae, bb as Te, bc as Oe, bd as Re, be as Pe, bf as Ue, bg as Ie, bh as je, bi as Fe, bj as ut, bk as ht, bl as Me, bm as ze, bn as Be, bo as mt, bp as He, bq as pt, A as ne, aN as ft, br as _e, bs as gt, bt as Dt, bu as xt, bv as bt, bw as Nt, bx as wt, by as vt, bz as Ce, bA as fe, bB as Ct, bC as yt, bD as St, bE as Et, bF as Vt } from "./index-ahdw_esL.js";
|
|
3
3
|
import Lt, { useRef as At, useEffect as ie, useState as x } from "react";
|
|
4
|
-
import { a as Ge } from "./use-visual-utils-
|
|
5
|
-
import { u as Tt } from "./use-role-aware-display-preferences-
|
|
4
|
+
import { a as Ge } from "./use-visual-utils-BbN7rxtD.js";
|
|
5
|
+
import { u as Tt } from "./use-role-aware-display-preferences-CLf3yEts.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
@@ -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-
|
|
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-ahdw_esL.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-
|
|
1
|
+
"use strict";const a=require("./index-D59dkH2b.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aM as G, aN as Y, aH as J, aI as K, aO as X, av as Q, as as Z, u as v, aP as q, aQ as ee, aL as V, aR as te, au as f } from "./index-
|
|
1
|
+
import { aM as G, aN as Y, aH as J, aI as K, aO as X, av as Q, as as Z, u as v, aP as q, aQ as ee, aL as V, aR as te, au as f } from "./index-ahdw_esL.js";
|
|
2
2
|
import { useState as T, useEffect as re, useCallback as N } from "react";
|
|
3
3
|
function se(e) {
|
|
4
4
|
const o = e.toUpperCase().indexOf("WHERE"), t = e.toUpperCase().indexOf("GROUP BY"), r = e.toUpperCase().indexOf("LIMIT"), n = e.toUpperCase().indexOf("ORDER BY");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./index-
|
|
1
|
+
"use strict";const s=require("./index-D59dkH2b.js"),g=require("react");function H(e){const a=e.toUpperCase().indexOf("WHERE"),t=e.toUpperCase().indexOf("GROUP BY"),r=e.toUpperCase().indexOf("LIMIT"),c=e.toUpperCase().indexOf("ORDER BY");let d=e.length;if(c!==-1&&(d=c),r!==-1&&r<d&&(d=r),a!==-1){const i=e.substring(0,a),o=e.substring(a);return`${i} {{ filters | where }} AND ${o.substring(6)}`}else if(t!==-1){const i=e.substring(0,t),o=e.substring(t);return`${i} {{ filters | where }} ${o}`}else{const i=e.substring(0,d),o=e.substring(d);return console.log("beforeClause",i),console.log("afterClause",o),o?`${i} {{ filters | where }} ${o}`:`${i.replace(/;$/,"")} {{ filters | where }}`}}function B(e){const[a,t]=g.useState(null),[r,c]=g.useState(null),d=s.useEnsureReactGlobals();return g.useEffect(()=>{if(!e||e.trim()===""){t(null),c(null);return}if(!d)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const l=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(l,{method:"HEAD"})).ok)throw new Error(`Module not found at ${l}`)}catch{}const h=await import(l);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");t(()=>h.useChartStore),c(null)}catch(o){const l=o instanceof Error?o.message:"Unknown error";console.error("Failed to load remote chart store:",l),c(l),t(null)}})()},[e,d]),a}function Q(e,a){if(e.length===0)return"";if(a){const t=e.find(r=>r.id===a);if(t){const r=t.tabTitle;if(r=="All__Header")return e[0].id;if(r&&r.endsWith("__Header")){const d=r.split("__")[0],i=e.find(o=>o.tabTitle===d);return i?i.id:e[0].id}return a}}return e[0].id}async function j(e,a,t,r){if(!a||!t)throw new Error("Missing auth token or visual ID");const c=["resource-by-id","visual",t],d=r.getQueryData(c);if(d)return console.log("Using cached visual data for:",t),{data:d,fromCache:!0};console.log("Fetching visual data from network for:",t);const i=s.ue.loading("Loading visual...",{position:"top-center"});try{const o=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${a}`}});if(!o.ok)throw new Error("Failed to load visual");const l=await o.json();return r.setQueryData(c,l),s.ue.dismiss(i),{data:l,fromCache:!1}}catch(o){throw s.ue.dismiss(i),o}}function T(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function z(e,a){var d,i;const t=(e==null?void 0:e.frameObject)??((d=e==null?void 0:e.visual)==null?void 0:d.frameObject);if(!t)return!1;const r=T(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const c=(i=r.cards)==null?void 0:i.find(o=>o.id===r.activeCardId);return c?(s.setupEditorWithCard({...a,frame:r,card:c,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function G(){var C;const{setCardSql:e}=s.useEditorActions(),a=s.useEditorStore(n=>n.frame),t=s.useEditorStore(n=>n.card),r=s.useEditorStore(n=>n.isDevMode),c=B(((C=t.customCardPreferences)==null?void 0:C.url)||""),d=s.useEditorStore(n=>n.selectedSchemaName),i=s.useEditorStore(n=>n.selectedDatamodelId),o=s.useEditorStore(n=>n.selectedDatabaseName),l=s.useEditorStore(n=>n.selectedTableName),h=s.useEditorStore(n=>n.selectedConnectionId),m=s.useEditorStore(n=>n.isShowingVisual),S=t.sql;return{getUpdatedFrame:g.useCallback(()=>{var I;let n=S;S&&!S.includes("{{")&&(n=H(S),e(n));const w=(I=c==null?void 0:c.getState())==null?void 0:I.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:d,lastSelectedDatamodelId:i,lastSelectedDatabase:o,lastSelectedTable:l,connectionId:h,sql:r?n:void 0,python:r?t.python:void 0,config:r?void 0:t.config,customCfg:m?t.customCfg:null,preferences:t.preferences,...w&&{customCardPreferences:{...t.customCardPreferences,settings:w}}},E=a.cards.map(p=>p.id===t.id?v:p);return{...a,cards:E,activeCardId:Q(E,a.activeCardId)}},[t,a,r,m,d,i,o,l,h,e,c,S])}}function Y(){const{authToken:e,tokenProps:a}=s.useSemaphorContext(),t=s.useQueryClient(),r=s.useSelectedVisual(),{selectVisual:c}=s.useManagementActions(),{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I}=s.useEditorActions(),{setIsDashboardEditing:p,setIsVisualEditing:$,setSelectedFrameId:D,clearSelectedFrameId:A,addFrame:N,setIsDashboardPanelOpen:R}=s.useDashboardActions(),y=s.useDashboardStore(u=>u.selectedSheetId),O=s.useDashboardStore(u=>u.selectedFrameId),x=s.useDashboardStore(u=>u.dashboard),W=s.useDashboardStore(u=>u.filterValues),F=s.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),k=g.useCallback(async u=>{try{c(u),A();const{data:b,fromCache:f}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!z(b,{setFrame:d,setCard:i,setIsDevMode:o,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:S,setSelectedConnectionId:V,setSelectedDatabaseName:C,setSelectedSchemaName:n,setSelectedTableName:w,setSelectedDatamodelId:v,setFilterValues:E,setApplyFilters:I,setIsDashboardEditing:p,setIsVisualEditing:$,dashboard:x,selectedSheetId:y,selectedFrameId:O,filterValues:W}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(b){return console.error("Error editing visual:",b),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,d,i,p,$,o,l,h,m,S,V,C,n,w,v,E,I,A,x,y,O,W]),_=g.useCallback(async u=>{var b;try{if(c(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:M}=await j(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),L=(f==null?void 0:f.frameObject)??((b=f==null?void 0:f.visual)==null?void 0:b.frameObject);if(!L)return{success:!1,error:"Visual has no frame data"};const U=T(L);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const P={...s.cloneFrameWithNewIds(U),visualId:u.id};return N(y,P,"end"),p(!0),D(P.id),R(!1),{success:!0,fromCache:M}}catch(f){return console.error("Error adding visual:",f),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,t,c,y,N,p,D,R]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:k,handleAddLibraryVisual:_,getUpdatedFrame:G().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=B;exports.useVisualUtils=Y;
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-D59dkH2b.js"),r=require("../types/index.cjs");exports.Dashboard=e.Dashboard;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-D59dkH2b.js"),v=require("./types/index.cjs"),o=require("react/jsx-runtime"),f=require("react"),P=require("./chunks/resource-management-panel-BLiCtZZE.js"),i=require("./chunks/notification-bell-DtWcBdzp.js");require("react-dom");function j(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,l.get?l:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const x=j(f);function N(t){const{displayPreferences:r,...s}=t,l={...s,id:t.dashboardId};return o.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:o.jsxs(e.SemaphorContextProvider,{dashboardProps:l,children:[o.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:t.cardId}),o.jsx(e.UXProvider,{children:o.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:o.jsx(e.Container,{type:"visual",...l,children:o.jsx(A,{cardId:t.cardId})})})})]})})}function A({cardId:t}){const r=e.useDashboardStore(n=>{var u;return(u=n.dashboard)==null?void 0:u.sheets}),{card:s,frame:l}=f.useMemo(()=>{const n=r==null?void 0:r.flatMap(a=>a.frames),u=n==null?void 0:n.flatMap(a=>a==null?void 0:a.cards),m=u==null?void 0:u.find(a=>(a==null?void 0:a.id)===t),E=n==null?void 0:n.find(a=>{var h;return(h=a==null?void 0:a.cards)==null?void 0:h.find(c=>(c==null?void 0:c.id)===t)});return{card:m,frame:E}},[r,t]);return!s||!l?o.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${t}`}):o.jsx("main",{className:"flex h-full grow flex-col",children:o.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:u})=>o.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:o.jsx(e.DashboardCard,{card:s,frame:l})})})}function _({name:t,items:r,value:s,onChange:l,isLoading:n,isError:u,refetch:m,className:E,icon:a,showNone:h=!1}){const c=x.useRef(null),[g,D]=x.useState(!1),[b,S]=x.useState("100%"),C=h?[...r||[],{id:"none",name:"None"}]:r;x.useLayoutEffect(()=>{c.current&&S(c.current.offsetWidth)},[]);function T(){var d;return n?"Loading...":u?"Error":s?(d=r==null?void 0:r.find(p=>p.id===s))==null?void 0:d.name:`Select ${t}`}function y(d,p){l(p),D(!1)}return o.jsxs(e.Popover,{open:g,onOpenChange:D,children:[o.jsx(e.PopoverTrigger,{asChild:!0,children:o.jsxs(e.Button,{ref:c,variant:"outline",role:"combobox","aria-expanded":g,className:e.cn("flex h-9 w-full justify-between",E),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[a&&o.jsx("div",{className:"mr-2",children:a}),o.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:T()})]}),o.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),o.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:b},children:o.jsxs(e.Command,{children:[o.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[o.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),o.jsx(e.IconButton,{className:"h-7",onClick:m,children:o.jsx(i.RefreshCw,{className:e.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),o.jsxs(e.CommandList,{children:[o.jsxs(e.CommandEmpty,{children:["No ",t==null?void 0:t.toLowerCase()," found."]}),o.jsx(e.CommandGroup,{children:C==null?void 0:C.map(d=>o.jsx(e.CommandItem,{className:"overflow-x-auto",value:d.name,onSelect:p=>y(p,d.id),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(e.Check,{className:e.cn("size-4",s===d.id?"opacity-100":"opacity-0")}),o.jsx("div",{title:d.name,children:d.name})]})},d.id))})]})]})})]})}function M(t,r){f.useEffect(()=>(t&&r&&(window.__SEMAPHOR_PRINT_STATE__={...r}),()=>{t&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[t,r])}exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;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.Surfboard=e.DashboardPlus;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createEmptyKpiConfig=e.createEmptyKpiConfig;exports.createExport=e.createExport;exports.createSqlGenConfig=e.createSqlGenConfig;exports.downloadPdf=e.downloadPdf;exports.emitDashboardLoad=e.emitDashboardLoad;exports.emitDashboardUnload=e.emitDashboardUnload;exports.fmt=e.fmt;exports.formatFileSize=e.formatFileSize;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.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.resolveDataType=e.resolveDataType;exports.resolveDatamodelName=e.resolveDatamodelName;exports.useActiveExports=e.useActiveExports;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.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.EMPTY_SELECTION=v.EMPTY_SELECTION;exports.ResourceManagementPanel=P.ResourceManagementPanel;exports.AdvancedModeToggle=i.AdvancedModeToggle;exports.ExportNotificationItem=i.ExportNotificationItem;exports.ExportNotificationList=i.ExportNotificationList;exports.NotificationBell=i.NotificationBell;exports.ScheduleDashboard=i.ScheduleDashboard;exports.UnsavedChangesAlert=i.UnsavedChangesAlert;exports.VisualEditingControls=i.VisualEditingControls;exports.useExportPolling=i.useExportPolling;exports.useExportRecovery=i.useExportRecovery;exports.usePristineSnapshotInitializer=i.usePristineSnapshotInitializer;exports.Combobox=_;exports.Visual=N;exports.useExposePrintState=M;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { E as b, F as N, S as P, l as w, U as _, m as A, C as I, u as M, n as D, o as R, P as F, p as k, B as L, c as E, q as B, r as V, s as O, t as U, I as z, v as H, w as W, x as j, y as q, z as Q } from "./chunks/index-
|
|
2
|
-
import { a4 as ia, a5 as la, D as da, _ as ca, Q as ua, aB as pa, a9 as ha, R as ma, K as fa, K as Ca, L as Ea, a as xa, aA as ga, W as Da, at as ba, aw as va, ag as ya, Z as Ta, T as Sa, V as Na, aa as Pa, aE as wa, ai as _a, az as Aa, ay as Ia, ax as Ma, ah as Ra, al as Fa, am as ka, af as La, Y as Ba, ae as Va, a7 as Oa, a8 as Ua, a6 as za, aj as Ha, ad as Wa, aD as ja, aC as qa, ac as Qa, ab as Ga, an as Ka, ak as Ya, a2 as $a, O as Ja, ap as Xa, ar as Za, aq as ae, as as ee, N as se, G as oe, $ as re, H as te, av as ne, ao as ie, au as le, a1 as de, a0 as ce, a3 as ue, A as pe, M as he, J as me } from "./chunks/index-
|
|
1
|
+
import { E as b, F as N, S as P, l as w, U as _, m as A, C as I, u as M, n as D, o as R, P as F, p as k, B as L, c as E, q as B, r as V, s as O, t as U, I as z, v as H, w as W, x as j, y as q, z as Q } from "./chunks/index-ahdw_esL.js";
|
|
2
|
+
import { a4 as ia, a5 as la, D as da, _ as ca, Q as ua, aB as pa, a9 as ha, R as ma, K as fa, K as Ca, L as Ea, a as xa, aA as ga, W as Da, at as ba, aw as va, ag as ya, Z as Ta, T as Sa, V as Na, aa as Pa, aE as wa, ai as _a, az as Aa, ay as Ia, ax as Ma, ah as Ra, al as Fa, am as ka, af as La, Y as Ba, ae as Va, a7 as Oa, a8 as Ua, a6 as za, aj as Ha, ad as Wa, aD as ja, aC as qa, ac as Qa, ab as Ga, an as Ka, ak as Ya, a2 as $a, O as Ja, ap as Xa, ar as Za, aq as ae, as as ee, N as se, G as oe, $ as re, H as te, av as ne, ao as ie, au as le, a1 as de, a0 as ce, a3 as ue, A as pe, M as he, J as me } from "./chunks/index-ahdw_esL.js";
|
|
3
3
|
import { EMPTY_SELECTION as Ce } from "./types/index.js";
|
|
4
4
|
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
import * as h from "react";
|
|
6
6
|
import { useMemo as G, useEffect as K } from "react";
|
|
7
|
-
import { ResourceManagementPanel as xe } from "./chunks/resource-management-panel-
|
|
8
|
-
import { R as Y } from "./chunks/notification-bell-
|
|
9
|
-
import { A as De, a as be, E as ve, N as ye, S as Te, U as Se, V as Ne, u as Pe, b as we, c as _e } from "./chunks/notification-bell-
|
|
7
|
+
import { ResourceManagementPanel as xe } from "./chunks/resource-management-panel-qkl060k8.js";
|
|
8
|
+
import { R as Y } from "./chunks/notification-bell-CKI2j8jH.js";
|
|
9
|
+
import { A as De, a as be, E as ve, N as ye, S as Te, U as Se, V as Ne, u as Pe, b as we, c as _e } from "./chunks/notification-bell-CKI2j8jH.js";
|
|
10
10
|
import "react-dom";
|
|
11
11
|
function sa(e) {
|
|
12
12
|
const { displayPreferences: s, ...l } = e, d = {
|