react-semaphor 0.1.259 → 0.1.261
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-0hbftZxY.js +42 -0
- package/dist/chunks/dashboard-controls-BYi_r2lH.js +1971 -0
- package/dist/chunks/dashboard-filter-controls-button-BPCw1GMh.js +1066 -0
- package/dist/chunks/dashboard-filter-controls-button-f4pDkDUL.js +11 -0
- package/dist/chunks/{dashboard-json-B43n1l6C.js → dashboard-json-2NJCXsDD.js} +1 -1
- package/dist/chunks/{dashboard-json-D0oSxmLa.js → dashboard-json-Dpy-zKf2.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CxZAMb8B.js → dashboard-summary-settings-dialog-B9zRCvc-.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DMWYgbwB.js → dashboard-summary-settings-dialog-Be3JilRI.js} +1 -1
- package/dist/chunks/edit-dashboard-visual-Bon08erH.js +188 -0
- package/dist/chunks/{edit-dashboard-visual-CCoz1oGX.js → edit-dashboard-visual-CqTlmuYL.js} +5970 -5492
- package/dist/chunks/index-BoJEr_9F.js +1114 -0
- package/dist/chunks/{index-DpSxZvI0.js → index-C2c-_lPE.js} +48682 -45193
- package/dist/chunks/{normalize-dashboard-for-dirty-check-Bn27S0PN.js → normalize-dashboard-for-dirty-check-5KpZN8xr.js} +20 -19
- package/dist/chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js +1 -0
- package/dist/chunks/{resource-management-panel-L51m1i4h.js → resource-management-panel-BtLPW2b4.js} +1 -1
- package/dist/chunks/{resource-management-panel-B_bDGuq_.js → resource-management-panel-Bva2_0OU.js} +70 -70
- package/dist/chunks/use-create-flow-overlay-state-9X7GyUzl.js +21 -0
- package/dist/chunks/use-create-flow-overlay-state-Vyd5mSnf.js +1445 -0
- package/dist/chunks/{use-visual-utils-V6paZich.js → use-visual-utils-Jv4hWSLm.js} +1 -1
- package/dist/chunks/{use-visual-utils-Cp5KVbr6.js → use-visual-utils-OPk_1t4I.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +5 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +102 -99
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +5 -4
- package/dist/types/dashboard.d.ts +105 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -3
- package/dist/types/main.d.ts +175 -1
- package/dist/types/shared.d.ts +89 -0
- package/dist/types/surfboard.d.ts +105 -0
- package/dist/types/types.d.ts +113 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-51P6aUVB.js +0 -1847
- package/dist/chunks/dashboard-controls-BC3hDGwD.js +0 -47
- package/dist/chunks/edit-dashboard-visual-D1mwhPGF.js +0 -193
- package/dist/chunks/editor-action-buttons-B6ElCCo2.js +0 -412
- package/dist/chunks/editor-action-buttons-Dbs6eczj.js +0 -21
- package/dist/chunks/index-DAhkssOV.js +0 -1109
- package/dist/chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js +0 -1
- package/dist/chunks/notification-bell-DoIAAZqX.js +0 -6
- package/dist/chunks/notification-bell-cYCkxEbp.js +0 -839
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./index-
|
|
1
|
+
"use strict";const o=require("./index-BoJEr_9F.js"),b=require("react");function z(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),a=e.substring(n);return`${d} {{ filters | where }} AND ${a.substring(6)}`}else if(t!==-1){const d=e.substring(0,t),a=e.substring(t);return`${d} {{ filters | where }} ${a}`}else{const d=e.substring(0,c),a=e.substring(c);return console.log("beforeClause",d),console.log("afterClause",a),a?`${d} {{ filters | where }} ${a}`:`${d.replace(/;$/,"")} {{ filters | where }}`}}function j(e){const[n,t]=b.useState(null),[r,s]=b.useState(null),c=o.useEnsureReactGlobals();return b.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(a){const l=a instanceof Error?a.message:"Unknown error";console.error("Failed to load remote chart store:",l),s(l),t(null)}})()},[e,c]),n}function G(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],a=e.find(l=>l.tabTitle===d);return a?a.id:e[0].id}return n}}return e[0].id}const Y=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:n,...t}=e;return t};async function L(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=o.ue.loading("Loading visual...",{position:"top-center"});try{const a=await fetch(`${e}/management/v1/visuals/${t}`,{headers:{Authorization:`Bearer ${n}`}});if(!a.ok)throw new Error("Failed to load visual");const l=await a.json();return r.setQueryData(s,l),o.ue.dismiss(d),{data:l,fromCache:!1}}catch(a){throw o.ue.dismiss(d),a}}function _(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function J(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=_(t);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const s=(d=r.cards)==null?void 0:d.find(a=>a.id===r.activeCardId);return s?(o.setupEditorWithCard({...n,frame:r,card:s,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function K(){var g;const{setCardSql:e}=o.useEditorActions(),n=o.useEditorStore(i=>i.frame),t=o.useEditorStore(i=>i.card),r=o.useEditorStore(i=>i.isDevMode),s=j(((g=t.customCardPreferences)==null?void 0:g.url)||""),c=o.useEditorStore(i=>i.selectedSchemaName),d=o.useEditorStore(i=>i.selectedDatamodelId),a=o.useEditorStore(i=>i.selectedDatabaseName),l=o.useEditorStore(i=>i.selectedTableName),h=o.useEditorStore(i=>i.selectedConnectionId),m=o.useEditorStore(i=>i.isShowingVisual),p=t.sql;return{getUpdatedFrame:b.useCallback(()=>{var w;let i=p;p&&!p.includes("{{")&&(i=z(p),e(i));const C=(w=s==null?void 0:s.getState())==null?void 0:w.settings,v={...t,dataSource:t.dataSource||{mode:"directSource"},lastSelectedSchema:c,lastSelectedDatamodelId:d,lastSelectedDatabase:a,lastSelectedTable:l,connectionId:h,sql:r?i:void 0,python:r?t.python:void 0,config:r?void 0:Y(t.config),customCfg:m?t.customCfg:null,preferences:t.preferences,...C&&{customCardPreferences:{...t.customCardPreferences,settings:C}}},E=n.cards.map(I=>I.id===t.id?v:I);return{...n,cards:E,activeCardId:G(E,n.activeCardId)}},[t,n,r,m,c,d,a,l,h,e,s,p])}}function X(){const{authToken:e,tokenProps:n}=o.useSemaphorContext(),t=o.useQueryClient(),r=o.useSelectedVisual(),{selectVisual:s}=o.useManagementActions(),{setFrame:c,setCard:d,setIsDevMode:a,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:v,setFilterValues:E,setInlineFilterValuesMap:w,setApplyFilters:I}=o.useEditorActions(),{setIsDashboardEditing:V,setIsVisualEditing:$,setSelectedFrameId:M,clearSelectedFrameId:A,addFrame:R,setIsDashboardPanelOpen:N}=o.useDashboardActions(),y=o.useDashboardStore(u=>u.selectedSheetId),O=o.useDashboardStore(u=>u.selectedFrameId),T=o.useDashboardStore(u=>u.dashboard),x=o.useDashboardStore(u=>u.filterValues),B=o.useDashboardStore(u=>u.inlineFilterValuesMap),F=o.useVisualById((r==null?void 0:r.id)||"",{enabled:!!(r!=null&&r.id)&&!!(e!=null&&e.accessToken)}),H=b.useCallback(async u=>{try{s(u),A();const{data:S,fromCache:f}=await L(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t);if(!J(S,{setFrame:c,setCard:d,setIsDevMode:a,initializeModeDrafts:l,setActiveTabCardId:h,updateDataSource:m,setQueryResultColumns:p,setSelectedConnectionId:D,setSelectedDatabaseName:g,setSelectedSchemaName:i,setSelectedTableName:C,setSelectedDatamodelId:v,setFilterValues:E,setInlineFilterValuesMap:w,setApplyFilters:I,setIsDashboardEditing:V,setIsVisualEditing:$,dashboard:T,selectedSheetId:y,selectedFrameId:O,filterValues:x,inlineFilterValuesMap:B}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:f}}catch(S){return console.error("Error editing visual:",S),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,n.apiServiceUrl,t,s,c,d,V,$,a,l,h,m,p,D,g,i,C,v,E,w,I,A,T,y,O,x,B]),Q=b.useCallback(async u=>{var S;try{if(s(u),!y)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:f,fromCache:P}=await L(n.apiServiceUrl,(e==null?void 0:e.accessToken)||"",u.id,t),W=(f==null?void 0:f.frameObject)??((S=f==null?void 0:f.visual)==null?void 0:S.frameObject);if(!W)return{success:!1,error:"Visual has no frame data"};const U=_(W);if(!(U!=null&&U.cards)||U.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const k={...o.cloneLinkedFrameWithSourceMapping(U),visualId:u.id};return R(y,k,"end"),V(!0),M(k.id),N(!1),{success:!0,fromCache:P}}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,V,M,N]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:H,handleAddLibraryVisual:Q,getUpdatedFrame:K().getUpdatedFrame,refetch:F.refetch}}exports.useRemoteChartStore=j;exports.useVisualUtils=X;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as K, b as Y, H as X, J as Z, K as q, M as _, N as ee, u as U, O as te, Q as re, x as M, T as se, U as f } from "./index-
|
|
1
|
+
import { G as K, b as Y, H as X, J as Z, K as q, M as _, N as ee, u as U, O as te, Q as re, x as M, T as se, U as f } from "./index-C2c-_lPE.js";
|
|
2
2
|
import { useState as H, useEffect as oe, useCallback as D } from "react";
|
|
3
3
|
function ae(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");
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-BoJEr_9F.js"),e=require("../types/index.cjs");exports.Dashboard=r.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
|
package/dist/dashboard/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { EMPTY_SELECTION as
|
|
1
|
+
import { D as E } from "../chunks/index-C2c-_lPE.js";
|
|
2
|
+
import { CONTROL_CARD_DEFAULT_VALUE as L, EMPTY_SELECTION as T } from "../types/index.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
L as CONTROL_CARD_DEFAULT_VALUE,
|
|
5
|
+
E as Dashboard,
|
|
6
|
+
T as EMPTY_SELECTION
|
|
6
7
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DAhkssOV.js"),w=require("./types/index.cjs"),F=require("./chunks/dashboard-summary-settings-dialog-DMWYgbwB.js"),t=require("react/jsx-runtime"),x=require("react"),z=require("./chunks/resource-management-panel-L51m1i4h.js"),O=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const C=require("./chunks/notification-bell-DoIAAZqX.js"),L=require("./chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js");function Q(s){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>s[n]})}}return r.default=s,Object.freeze(r)}const P=Q(x);function U(s){const{authToken:r,tokenProps:n}=e.useSemaphorContext();return e.useMutation({mutationFn:async o=>e.backtestAlert(n.apiServiceUrl,r.accessToken,s,o)})}function q(s){const{displayPreferences:r,...n}=s,o={...n,id:s.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:o,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:s.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:t.jsx(e.Container,{type:"visual",...o,children:t.jsx(W,{cardId:s.cardId})})})})]})})}function W({cardId:s}){const r=e.useDashboardStore(l=>{var c;return(c=l.dashboard)==null?void 0:c.sheets}),{card:n,frame:o}=x.useMemo(()=>{const l=r==null?void 0:r.flatMap(i=>i.frames),c=l==null?void 0:l.flatMap(i=>i==null?void 0:i.cards),u=c==null?void 0:c.find(i=>(i==null?void 0:i.id)===s),a=l==null?void 0:l.find(i=>{var m;return(m=i==null?void 0:i.cards)==null?void 0:m.find(f=>(f==null?void 0:f.id)===s)});return{card:u,frame:a}},[r,s]);return!n||!o?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${s}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:l,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:l,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:o})})})}function V({name:s,items:r,value:n,onChange:o,isLoading:l,isError:c,refetch:u,className:a,icon:i,showNone:m=!1}){const f=P.useRef(null),[b,A]=P.useState(!1),[j,D]=P.useState("100%"),y=m?[...r||[],{id:"none",name:"None"}]:r;P.useLayoutEffect(()=>{f.current&&D(f.current.offsetWidth)},[]);function R(){var h;return l?"Loading...":c?"Error":n?(h=r==null?void 0:r.find(S=>S.id===n))==null?void 0:h.name:`Select ${s}`}function T(h,S){o(S),A(!1)}return t.jsxs(e.Popover,{open:b,onOpenChange:A,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:f,variant:"outline",role:"combobox","aria-expanded":b,className:e.cn("flex h-9 w-full justify-between",a),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[i&&t.jsx("div",{className:"mr-2",children:i}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:R()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:j},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:u,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",l&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",s==null?void 0:s.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:y==null?void 0:y.map(h=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:h.name,onSelect:S=>T(S,h.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===h.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:h.name,children:h.name})]})},h.id))})]})]})})]})}function H({triggerButtonClassName:s,variant:r="ghost"}){const[n,o]=x.useState(!1),l=e.useDashboardStore(u=>{var a;return(a=u.dashboard)==null?void 0:a.id}),c=e.useDashboardStore(u=>{var a;return(a=u.dashboard)==null?void 0:a.title});return l?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",s),buttonProps:{variant:r},onClick:()=>o(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:n,onOpenChange:o,dashboardId:l,dashboardName:c})]}):null}function $(s,r){x.useEffect(()=>(s&&r&&(window.__SEMAPHOR_PRINT_STATE__={...r}),()=>{s&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[s,r])}function I(s){if(!s)return"--";const r=new Date(s);return Number.isNaN(r.getTime())?"--":r.toLocaleString()}function G(s){var r;return((r=s.alertState)==null?void 0:r.currentState)==="FIRING"?"Signal surfaced":s.status==="ACTIVE"?"Watching":s.status==="PAUSED"?"Paused":s.status}function K({alertId:s,onBack:r}){var h,S,k,M;const{authToken:n,tokenProps:o}=e.useSemaphorContext(),{data:l,isLoading:c,refetch:u}=e.useAlertDetail(s),a=(l==null?void 0:l.alert)??null,[i,m]=x.useState([]),[f,b]=x.useState([]),[A,j]=x.useState(null),D=x.useCallback(async()=>{var g;const d=o==null?void 0:o.apiServiceUrl,p=n==null?void 0:n.accessToken;if(!d||!p||!s)return null;try{const N=await fetch(`${d}/v1/alerts/${s}/runs?limit=20`,{headers:{Authorization:`Bearer ${p}`}});if(N.ok){const E=await N.json(),v=Array.isArray(E.runs)?E.runs:[],_=A&&v.some(B=>B.id===A)?A:((g=v[0])==null?void 0:g.id)??null;return b(v),j(_),_}b([]),j(null)}catch{return b([]),j(null),null}return null},[s,n,A,o]),y=x.useCallback(async d=>{const p=o==null?void 0:o.apiServiceUrl,g=n==null?void 0:n.accessToken,N=d??A;if(!p||!g||!s||!N){m([]);return}try{const E=await fetch(`${p}/v1/alerts/${s}/runs/${N}/deliveries`,{headers:{Authorization:`Bearer ${g}`}});if(E.ok){const v=await E.json();m(Array.isArray(v.attempts)?v.attempts:[])}else m([])}catch{m([])}},[s,n,A,o]),R=x.useCallback(async()=>{await u();const d=await D();await y(d)},[y,D,u]);x.useEffect(()=>{D().catch(()=>{})},[D]),x.useEffect(()=>{y().catch(()=>{})},[y]);const T=x.useMemo(()=>{const d={};for(const p of i)d[p.channel]||(d[p.channel]=[]),d[p.channel].push(p);return d},[i]);return c?t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading signal detail..."}):a?t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[r&&t.jsx(e.Button,{variant:"outline",size:"sm",onClick:r,children:"Back"}),t.jsx("h2",{className:"text-lg font-semibold",children:a.name}),t.jsx(e.Badge,{variant:a.status==="ACTIVE"?"default":"secondary",children:G(a)}),((h=a.alertState)==null?void 0:h.currentState)&&t.jsx(e.Badge,{variant:a.alertState.currentState==="FIRING"?"destructive":"outline",children:a.alertState.currentState==="FIRING"?"Signal surfaced":"Stable"})]}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>void R(),children:"Refresh"})]}),a.description&&t.jsx("p",{className:"text-sm text-muted-foreground",children:a.description}),t.jsxs("div",{className:"rounded-md border bg-muted/30 p-4 text-sm",children:[t.jsx("p",{className:"font-medium",children:"What changed"}),t.jsx("p",{className:"mt-1 text-muted-foreground",children:"Review the latest signal activity, then investigate the underlying dashboard context if you need more detail."})]}),t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Signal Watch"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Watching for:"})," ",e.formatSignalCondition(a.jobConfig.operator,a.jobConfig.threshold)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Severity:"})," ",a.jobConfig.severity]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Evaluated:"})," ",I((S=a.alertState)==null?void 0:S.lastEvaluatedAt)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Surfaced:"})," ",I((k=a.alertState)==null?void 0:k.lastTriggeredAt)]})]})]}),((M=a.deliveryConfig)==null?void 0:M.channels)&&a.deliveryConfig.channels.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Where It Surfaces"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:a.deliveryConfig.channels.map(d=>t.jsx(e.Badge,{variant:"outline",children:d},d))})]}),f.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Recent Delivery Activity"}),f.length>1&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(d=>t.jsx(e.Button,{variant:d.id===A?"default":"outline",size:"sm",onClick:()=>j(d.id),children:I(d.scheduledFor)},d.id))}),Object.keys(T).length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No delivery attempts were recorded for this run."}):Object.entries(T).map(([d,p])=>t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(e.Badge,{variant:"secondary",className:"text-xs",children:d})}),t.jsx("div",{className:"overflow-hidden rounded border",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Recipient"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Status"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Time"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Error"})]})}),t.jsx("tbody",{children:p.map(g=>t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-2 py-1",children:g.recipient}),t.jsx("td",{className:"px-2 py-1",children:t.jsx(e.Badge,{variant:g.status==="SENT"?"default":"destructive",className:"text-[10px]",children:g.status})}),t.jsx("td",{className:"px-2 py-1",children:I(g.createdAt)}),t.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:g.error||"--"})]},g.id))})]})})]},d))]})]}):t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Signal not found."})}function Y(){var c,u;const{quotasQuery:s,usageQuery:r}=e.useAlertQuotas(),n=((c=s.data)==null?void 0:c.quotas)||[],o=((u=r.data)==null?void 0:u.usage)||[],l=new Map(o.map(a=>[a.tenantId||"org",a]));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:()=>{s.refetch(),r.refetch()},children:"Refresh"})]}),s.isLoading||r.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:n.map(a=>{const i=a.tenantId||"org",m=l.get(i);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:i}),t.jsx("td",{className:"px-3 py-2",children:(m==null?void 0:m.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:a.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[a.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:a.policy.maxContextSources})]},i)})})]})})]})}exports.AlertManagementPage=e.AlertManagementPage;exports.AlertWizardDialog=e.AlertWizardDialog;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.EmailScheduleDialog=e.EmailScheduleDialog;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.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.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;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.useAlertWizard=e.useAlertWizard;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.DEFAULT_CALENDAR_CONTEXT=w.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=w.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.EMPTY_SELECTION=w.EMPTY_SELECTION;exports.CalendarPreferencesDialog=F.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=F.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=z.ResourceManagementPanel;exports.useDebouncedDirtyCheck=O.useDebouncedDirtyCheck;exports.AdvancedModeToggle=C.AdvancedModeToggle;exports.ExportNotificationItem=C.ExportNotificationItem;exports.ExportNotificationList=C.ExportNotificationList;exports.NotificationBell=C.NotificationBell;exports.UnsavedChangesAlert=C.UnsavedChangesAlert;exports.VisualEditingControls=C.VisualEditingControls;exports.useExportPolling=C.useExportPolling;exports.useExportRecovery=C.useExportRecovery;exports.usePristineSnapshotInitializer=C.usePristineSnapshotInitializer;exports.normalizeDashboardForDirtyCheck=L.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=L.serializeDashboardForDirtyCheck;exports.AlertDetailPageEmbedded=K;exports.Combobox=V;exports.ScheduleDashboard=H;exports.TenantQuotaPage=Y;exports.Visual=q;exports.useAlertBacktest=U;exports.useExposePrintState=$;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BoJEr_9F.js"),_=require("./types/index.cjs"),M=require("./chunks/dashboard-summary-settings-dialog-Be3JilRI.js"),t=require("react/jsx-runtime"),x=require("react"),O=require("./chunks/resource-management-panel-BtLPW2b4.js"),U=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const A=require("./chunks/dashboard-filter-controls-button-f4pDkDUL.js"),L=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");function z(s){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>s[n]})}}return r.default=s,Object.freeze(r)}const R=z(x);function Q(s){const{authToken:r,tokenProps:n}=e.useSemaphorContext();return e.useMutation({mutationFn:async o=>e.backtestAlert(n.apiServiceUrl,r.accessToken,s,o)})}function q(s){const{displayPreferences:r,cardId:n,...o}=s,l={...o,id:s.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:l,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:s.cardId}),t.jsx(e.UXProvider,{children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:r,children:t.jsx(e.Container,{type:"visual",cardId:n,...l,children:t.jsx(V,{cardId:n})})})})]})})}function V({cardId:s}){const r=e.useDashboardStore(l=>{var c;return(c=l.dashboard)==null?void 0:c.sheets}),{card:n,frame:o}=x.useMemo(()=>{const l=r==null?void 0:r.flatMap(i=>i.frames),c=l==null?void 0:l.flatMap(i=>i==null?void 0:i.cards),u=c==null?void 0:c.find(i=>(i==null?void 0:i.id)===s),a=l==null?void 0:l.find(i=>{var m;return(m=i==null?void 0:i.cards)==null?void 0:m.find(f=>(f==null?void 0:f.id)===s)});return{card:u,frame:a}},[r,s]);return!n||!o?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${s}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:l,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:l,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:o})})})}function W({name:s,items:r,value:n,onChange:o,isLoading:l,isError:c,refetch:u,className:a,icon:i,showNone:m=!1}){const f=R.useRef(null),[D,C]=R.useState(!1),[b,j]=R.useState("100%"),y=m?[...r||[],{id:"none",name:"None"}]:r;R.useLayoutEffect(()=>{f.current&&j(f.current.offsetWidth)},[]);function I(){var h;return l?"Loading...":c?"Error":n?(h=r==null?void 0:r.find(S=>S.id===n))==null?void 0:h.name:`Select ${s}`}function T(h,S){o(S),C(!1)}return t.jsxs(e.Popover,{open:D,onOpenChange:C,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{ref:f,variant:"outline",role:"combobox","aria-expanded":D,className:e.cn("flex h-9 w-full justify-between",a),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[i&&t.jsx("div",{className:"mr-2",children:i}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:I()})]}),t.jsx(e.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(e.PopoverContent,{className:"w-full p-0",style:{minWidth:b},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:u,children:t.jsx(e.RefreshCw,{className:e.cn("size-3.5 opacity-50",l&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",s==null?void 0:s.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:y==null?void 0:y.map(h=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:h.name,onSelect:S=>T(S,h.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===h.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:h.name,children:h.name})]})},h.id))})]})]})})]})}function H({triggerButtonClassName:s,variant:r="ghost"}){const[n,o]=x.useState(!1),l=e.useDashboardStore(u=>{var a;return(a=u.dashboard)==null?void 0:a.id}),c=e.useDashboardStore(u=>{var a;return(a=u.dashboard)==null?void 0:a.title});return l?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:e.cn("h-7 p-2",s),buttonProps:{variant:r},onClick:()=>o(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:n,onOpenChange:o,dashboardId:l,dashboardName:c})]}):null}function $(s,r){x.useEffect(()=>(s&&r&&(window.__SEMAPHOR_PRINT_STATE__={...r}),()=>{s&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[s,r])}function P(s){if(!s)return"--";const r=new Date(s);return Number.isNaN(r.getTime())?"--":r.toLocaleString()}function G(s){var r;return((r=s.alertState)==null?void 0:r.currentState)==="FIRING"?"Signal surfaced":s.status==="ACTIVE"?"Watching":s.status==="PAUSED"?"Paused":s.status}function K({alertId:s,onBack:r}){var h,S,F,w;const{authToken:n,tokenProps:o}=e.useSemaphorContext(),{data:l,isLoading:c,refetch:u}=e.useAlertDetail(s),a=(l==null?void 0:l.alert)??null,[i,m]=x.useState([]),[f,D]=x.useState([]),[C,b]=x.useState(null),j=x.useCallback(async()=>{var g;const d=o==null?void 0:o.apiServiceUrl,p=n==null?void 0:n.accessToken;if(!d||!p||!s)return null;try{const v=await fetch(`${d}/v1/alerts/${s}/runs?limit=20`,{headers:{Authorization:`Bearer ${p}`}});if(v.ok){const E=await v.json(),N=Array.isArray(E.runs)?E.runs:[],k=C&&N.some(B=>B.id===C)?C:((g=N[0])==null?void 0:g.id)??null;return D(N),b(k),k}D([]),b(null)}catch{return D([]),b(null),null}return null},[s,n,C,o]),y=x.useCallback(async d=>{const p=o==null?void 0:o.apiServiceUrl,g=n==null?void 0:n.accessToken,v=d??C;if(!p||!g||!s||!v){m([]);return}try{const E=await fetch(`${p}/v1/alerts/${s}/runs/${v}/deliveries`,{headers:{Authorization:`Bearer ${g}`}});if(E.ok){const N=await E.json();m(Array.isArray(N.attempts)?N.attempts:[])}else m([])}catch{m([])}},[s,n,C,o]),I=x.useCallback(async()=>{await u();const d=await j();await y(d)},[y,j,u]);x.useEffect(()=>{j().catch(()=>{})},[j]),x.useEffect(()=>{y().catch(()=>{})},[y]);const T=x.useMemo(()=>{const d={};for(const p of i)d[p.channel]||(d[p.channel]=[]),d[p.channel].push(p);return d},[i]);return c?t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading signal detail..."}):a?t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[r&&t.jsx(e.Button,{variant:"outline",size:"sm",onClick:r,children:"Back"}),t.jsx("h2",{className:"text-lg font-semibold",children:a.name}),t.jsx(e.Badge,{variant:a.status==="ACTIVE"?"default":"secondary",children:G(a)}),((h=a.alertState)==null?void 0:h.currentState)&&t.jsx(e.Badge,{variant:a.alertState.currentState==="FIRING"?"destructive":"outline",children:a.alertState.currentState==="FIRING"?"Signal surfaced":"Stable"})]}),t.jsx(e.Button,{variant:"outline",size:"sm",onClick:()=>void I(),children:"Refresh"})]}),a.description&&t.jsx("p",{className:"text-sm text-muted-foreground",children:a.description}),t.jsxs("div",{className:"rounded-md border bg-muted/30 p-4 text-sm",children:[t.jsx("p",{className:"font-medium",children:"What changed"}),t.jsx("p",{className:"mt-1 text-muted-foreground",children:"Review the latest signal activity, then investigate the underlying dashboard context if you need more detail."})]}),t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Signal Watch"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Watching for:"})," ",e.formatSignalCondition(a.jobConfig.operator,a.jobConfig.threshold)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Severity:"})," ",a.jobConfig.severity]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Evaluated:"})," ",P((S=a.alertState)==null?void 0:S.lastEvaluatedAt)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Surfaced:"})," ",P((F=a.alertState)==null?void 0:F.lastTriggeredAt)]})]})]}),((w=a.deliveryConfig)==null?void 0:w.channels)&&a.deliveryConfig.channels.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Where It Surfaces"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:a.deliveryConfig.channels.map(d=>t.jsx(e.Badge,{variant:"outline",children:d},d))})]}),f.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Recent Delivery Activity"}),f.length>1&&t.jsx("div",{className:"flex flex-wrap gap-2",children:f.map(d=>t.jsx(e.Button,{variant:d.id===C?"default":"outline",size:"sm",onClick:()=>b(d.id),children:P(d.scheduledFor)},d.id))}),Object.keys(T).length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No delivery attempts were recorded for this run."}):Object.entries(T).map(([d,p])=>t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(e.Badge,{variant:"secondary",className:"text-xs",children:d})}),t.jsx("div",{className:"overflow-hidden rounded border",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Recipient"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Status"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Time"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Error"})]})}),t.jsx("tbody",{children:p.map(g=>t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-2 py-1",children:g.recipient}),t.jsx("td",{className:"px-2 py-1",children:t.jsx(e.Badge,{variant:g.status==="SENT"?"default":"destructive",className:"text-[10px]",children:g.status})}),t.jsx("td",{className:"px-2 py-1",children:P(g.createdAt)}),t.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:g.error||"--"})]},g.id))})]})})]},d))]})]}):t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Signal not found."})}function Y(){var c,u;const{quotasQuery:s,usageQuery:r}=e.useAlertQuotas(),n=((c=s.data)==null?void 0:c.quotas)||[],o=((u=r.data)==null?void 0:u.usage)||[],l=new Map(o.map(a=>[a.tenantId||"org",a]));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:()=>{s.refetch(),r.refetch()},children:"Refresh"})]}),s.isLoading||r.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:n.map(a=>{const i=a.tenantId||"org",m=l.get(i);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:i}),t.jsx("td",{className:"px-3 py-2",children:(m==null?void 0:m.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:a.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[a.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:a.policy.maxContextSources})]},i)})})]})})]})}exports.AlertManagementPage=e.AlertManagementPage;exports.AlertWizardDialog=e.AlertWizardDialog;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.EmailScheduleDialog=e.EmailScheduleDialog;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.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.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;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.useAlertWizard=e.useAlertWizard;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.CONTROL_CARD_DEFAULT_VALUE=_.CONTROL_CARD_DEFAULT_VALUE;exports.DEFAULT_CALENDAR_CONTEXT=_.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=_.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.EMPTY_SELECTION=_.EMPTY_SELECTION;exports.CalendarPreferencesDialog=M.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=M.DashboardSummarySettingsDialog;exports.ResourceManagementPanel=O.ResourceManagementPanel;exports.useDebouncedDirtyCheck=U.useDebouncedDirtyCheck;exports.AdvancedModeToggle=A.AdvancedModeToggle;exports.DashboardControlsSettings=A.DashboardControlsSettings;exports.DashboardFilterControlsButton=A.DashboardFilterControlsButton;exports.ExportNotificationItem=A.ExportNotificationItem;exports.ExportNotificationList=A.ExportNotificationList;exports.NotificationBell=A.NotificationBell;exports.UnsavedChangesAlert=A.UnsavedChangesAlert;exports.VisualEditingControls=A.VisualEditingControls;exports.useExportPolling=A.useExportPolling;exports.useExportRecovery=A.useExportRecovery;exports.usePristineSnapshotInitializer=A.usePristineSnapshotInitializer;exports.normalizeDashboardForDirtyCheck=L.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=L.serializeDashboardForDirtyCheck;exports.AlertDetailPageEmbedded=K;exports.Combobox=W;exports.ScheduleDashboard=H;exports.TenantQuotaPage=Y;exports.Visual=q;exports.useAlertBacktest=Q;exports.useExposePrintState=$;
|
package/dist/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import { aT as Me, aV as Fe, bB as Le, aX as
|
|
3
|
-
import { DEFAULT_CALENDAR_CONTEXT as
|
|
4
|
-
import { C as
|
|
1
|
+
import { b as j, V as q, W as H, Y as W, Z as G, _ as K, $ as Y, a0 as X, a1 as J, a2 as Z, u as F, a3 as O, a4 as ee, P as ae, k as te, B as T, c as _, a5 as se, l as re, m as ne, n as ie, a6 as Q, a7 as oe, o as le, p as de, q as ce, r as ue, s as me, a8 as he, a9 as pe, aa as fe, ab as E, ac as be, ad as ge } from "./chunks/index-C2c-_lPE.js";
|
|
2
|
+
import { aT as Me, aV as Fe, bB as Le, aX as Ue, aU as ze, aw as Be, aY as Oe, D as je, au as We, ao as Qe, bH as Ve, b0 as $e, ag as qe, aj as He, aj as Ge, ak as Ke, av as Ye, a as Xe, bG as Je, ar as Ze, bm as ea, bj as aa, bC as ta, b7 as sa, bo as ra, at as na, ap as ia, aq as oa, b1 as la, bK as da, bl as ca, bv as ua, bs as ma, bz as ha, bt as pa, bu as fa, br as ba, bq as ga, b9 as xa, bF as Na, bE as va, bD as ya, b8 as Aa, bc as Ca, bd as Sa, b6 as Da, as as Ea, b5 as Ta, a_ as wa, a$ as Ra, aZ as Ia, ba as _a, b4 as Pa, bJ as ka, bI as Ma, b3 as Fa, b2 as La, by as Ua, bk as za, bx as Ba, be as Oa, bb as ja, bp as Wa, bn as Qa, bw as Va, bA as $a, aD as qa, aA as Ha, aM as Ga, aK as Ka, aS as Ya, aR as Xa, aJ as Ja, aI as Za, aH as et, aL as at, aW as tt, aF as st, aG as rt, aN as nt, aP as it, an as ot, aO as lt, ay as dt, bg as ct, bi as ut, bh as mt, N as ht, am as pt, af as ft, ax as bt, az as gt, ah as xt, M as Nt, bf as vt, U as yt, aC as At, aB as Ct, aE as St, ae as Dt, al as Et, aQ as Tt, ai as wt } from "./chunks/index-C2c-_lPE.js";
|
|
3
|
+
import { CONTROL_CARD_DEFAULT_VALUE as It, DEFAULT_CALENDAR_CONTEXT as _t, DEFAULT_SEMANTIC_DOMAIN_ACCESS as Pt, EMPTY_SELECTION as kt } from "./types/index.js";
|
|
4
|
+
import { C as Ft, D as Lt } from "./chunks/dashboard-summary-settings-dialog-B9zRCvc-.js";
|
|
5
5
|
import { jsx as e, jsxs as r, Fragment as xe } from "react/jsx-runtime";
|
|
6
|
-
import * as
|
|
7
|
-
import { useMemo as V, useState as
|
|
8
|
-
import { ResourceManagementPanel as zt } from "./chunks/resource-management-panel-
|
|
9
|
-
import { u as
|
|
6
|
+
import * as R from "react";
|
|
7
|
+
import { useMemo as V, useState as P, useEffect as L, useCallback as M } from "react";
|
|
8
|
+
import { ResourceManagementPanel as zt } from "./chunks/resource-management-panel-Bva2_0OU.js";
|
|
9
|
+
import { u as Ot } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
10
10
|
import "react-dom";
|
|
11
|
-
import { A as
|
|
12
|
-
import { n as
|
|
11
|
+
import { A as Wt, D as Qt, c as Vt, a as $t, E as qt, N as Ht, U as Gt, V as Kt, u as Yt, b as Xt, d as Jt } from "./chunks/dashboard-filter-controls-button-BPCw1GMh.js";
|
|
12
|
+
import { n as es, s as as } from "./chunks/normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
13
13
|
function De(a) {
|
|
14
|
-
const { authToken: s, tokenProps:
|
|
14
|
+
const { authToken: s, tokenProps: i } = j();
|
|
15
15
|
return q({
|
|
16
|
-
mutationFn: async (
|
|
17
|
-
|
|
16
|
+
mutationFn: async (l) => H(
|
|
17
|
+
i.apiServiceUrl,
|
|
18
18
|
s.accessToken,
|
|
19
19
|
a,
|
|
20
|
-
|
|
20
|
+
l
|
|
21
21
|
)
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function Ee(a) {
|
|
25
|
-
const { displayPreferences: s, ...
|
|
26
|
-
...
|
|
25
|
+
const { displayPreferences: s, cardId: i, ...l } = a, n = {
|
|
26
|
+
...l,
|
|
27
27
|
id: a.dashboardId
|
|
28
28
|
// override the id to the dashboard id so that the dashboard is not loaded
|
|
29
29
|
};
|
|
30
|
-
return /* @__PURE__ */ e(W, { FallbackComponent: G, children: /* @__PURE__ */ r(K, { dashboardProps:
|
|
30
|
+
return /* @__PURE__ */ e(W, { FallbackComponent: G, children: /* @__PURE__ */ r(K, { dashboardProps: n, children: [
|
|
31
31
|
/* @__PURE__ */ e(Y, { componentType: "visual", componentId: a.cardId }),
|
|
32
|
-
/* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(J, { displayPreferences: s, children: /* @__PURE__ */ e(Z, { type: "visual",
|
|
32
|
+
/* @__PURE__ */ e(X, { children: /* @__PURE__ */ e(J, { displayPreferences: s, children: /* @__PURE__ */ e(Z, { type: "visual", cardId: i, ...n, children: /* @__PURE__ */ e(Ne, { cardId: i }) }) }) })
|
|
33
33
|
] }) });
|
|
34
34
|
}
|
|
35
35
|
function Ne({ cardId: a }) {
|
|
36
|
-
const s = F((
|
|
36
|
+
const s = F((n) => {
|
|
37
37
|
var c;
|
|
38
|
-
return (c =
|
|
39
|
-
}), { card:
|
|
40
|
-
const
|
|
38
|
+
return (c = n.dashboard) == null ? void 0 : c.sheets;
|
|
39
|
+
}), { card: i, frame: l } = V(() => {
|
|
40
|
+
const n = s == null ? void 0 : s.flatMap((o) => o.frames), c = n == null ? void 0 : n.flatMap((o) => o == null ? void 0 : o.cards), u = c == null ? void 0 : c.find((o) => (o == null ? void 0 : o.id) === a), t = n == null ? void 0 : n.find(
|
|
41
41
|
(o) => {
|
|
42
42
|
var m;
|
|
43
43
|
return (m = o == null ? void 0 : o.cards) == null ? void 0 : m.find((b) => (b == null ? void 0 : b.id) === a);
|
|
@@ -45,8 +45,8 @@ function Ne({ cardId: a }) {
|
|
|
45
45
|
);
|
|
46
46
|
return { card: u, frame: t };
|
|
47
47
|
}, [s, a]);
|
|
48
|
-
return !
|
|
49
|
-
|
|
48
|
+
return !i || !l ? /* @__PURE__ */ e(
|
|
49
|
+
O,
|
|
50
50
|
{
|
|
51
51
|
error: new Error("Card not found"),
|
|
52
52
|
resetErrorBoundary: () => {
|
|
@@ -57,42 +57,42 @@ function Ne({ cardId: a }) {
|
|
|
57
57
|
W,
|
|
58
58
|
{
|
|
59
59
|
FallbackComponent: ({
|
|
60
|
-
error:
|
|
60
|
+
error: n,
|
|
61
61
|
resetErrorBoundary: c
|
|
62
62
|
}) => /* @__PURE__ */ e(
|
|
63
|
-
|
|
63
|
+
O,
|
|
64
64
|
{
|
|
65
|
-
error:
|
|
65
|
+
error: n,
|
|
66
66
|
resetErrorBoundary: c,
|
|
67
67
|
customerFacingMessage: "Error creating visual. Please try again."
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
|
-
children: /* @__PURE__ */ e(ee, { card:
|
|
70
|
+
children: /* @__PURE__ */ e(ee, { card: i, frame: l })
|
|
71
71
|
}
|
|
72
72
|
) });
|
|
73
73
|
}
|
|
74
74
|
function Te({
|
|
75
75
|
name: a,
|
|
76
76
|
items: s,
|
|
77
|
-
value:
|
|
78
|
-
onChange:
|
|
79
|
-
isLoading:
|
|
77
|
+
value: i,
|
|
78
|
+
onChange: l,
|
|
79
|
+
isLoading: n,
|
|
80
80
|
isError: c,
|
|
81
81
|
refetch: u,
|
|
82
82
|
className: t,
|
|
83
83
|
icon: o,
|
|
84
84
|
showNone: m = !1
|
|
85
85
|
}) {
|
|
86
|
-
const b =
|
|
87
|
-
|
|
86
|
+
const b = R.useRef(null), [v, g] = R.useState(!1), [y, A] = R.useState("100%"), x = m ? [...s || [], { id: "none", name: "None" }] : s;
|
|
87
|
+
R.useLayoutEffect(() => {
|
|
88
88
|
b.current && A(b.current.offsetWidth);
|
|
89
89
|
}, []);
|
|
90
|
-
function
|
|
90
|
+
function k() {
|
|
91
91
|
var h;
|
|
92
|
-
return
|
|
92
|
+
return n ? "Loading..." : c ? "Error" : i ? (h = s == null ? void 0 : s.find((N) => N.id === i)) == null ? void 0 : h.name : `Select ${a}`;
|
|
93
93
|
}
|
|
94
94
|
function w(h, N) {
|
|
95
|
-
|
|
95
|
+
l(N), g(!1);
|
|
96
96
|
}
|
|
97
97
|
return /* @__PURE__ */ r(ae, { open: v, onOpenChange: g, children: [
|
|
98
98
|
/* @__PURE__ */ e(te, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -102,11 +102,11 @@ function Te({
|
|
|
102
102
|
variant: "outline",
|
|
103
103
|
role: "combobox",
|
|
104
104
|
"aria-expanded": v,
|
|
105
|
-
className:
|
|
105
|
+
className: _("flex h-9 w-full justify-between", t),
|
|
106
106
|
children: [
|
|
107
107
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
108
108
|
o && /* @__PURE__ */ e("div", { className: "mr-2", children: o }),
|
|
109
|
-
/* @__PURE__ */ e("span", { className: "max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap", children:
|
|
109
|
+
/* @__PURE__ */ e("span", { className: "max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap", children: k() })
|
|
110
110
|
] }),
|
|
111
111
|
/* @__PURE__ */ e(se, { className: "size-4 opacity-50" })
|
|
112
112
|
]
|
|
@@ -123,9 +123,9 @@ function Te({
|
|
|
123
123
|
/* @__PURE__ */ e(Q, { className: "h-7", onClick: u, children: /* @__PURE__ */ e(
|
|
124
124
|
oe,
|
|
125
125
|
{
|
|
126
|
-
className:
|
|
126
|
+
className: _(
|
|
127
127
|
"size-3.5 opacity-50",
|
|
128
|
-
|
|
128
|
+
n && "animate-spin"
|
|
129
129
|
)
|
|
130
130
|
}
|
|
131
131
|
) })
|
|
@@ -146,9 +146,9 @@ function Te({
|
|
|
146
146
|
/* @__PURE__ */ e(
|
|
147
147
|
me,
|
|
148
148
|
{
|
|
149
|
-
className:
|
|
149
|
+
className: _(
|
|
150
150
|
"size-4",
|
|
151
|
-
|
|
151
|
+
i === h.id ? "opacity-100" : "opacity-0"
|
|
152
152
|
)
|
|
153
153
|
}
|
|
154
154
|
),
|
|
@@ -167,43 +167,43 @@ function we({
|
|
|
167
167
|
triggerButtonClassName: a,
|
|
168
168
|
variant: s = "ghost"
|
|
169
169
|
}) {
|
|
170
|
-
const [
|
|
170
|
+
const [i, l] = P(!1), n = F((u) => {
|
|
171
171
|
var t;
|
|
172
172
|
return (t = u.dashboard) == null ? void 0 : t.id;
|
|
173
173
|
}), c = F((u) => {
|
|
174
174
|
var t;
|
|
175
175
|
return (t = u.dashboard) == null ? void 0 : t.title;
|
|
176
176
|
});
|
|
177
|
-
return
|
|
177
|
+
return n ? /* @__PURE__ */ r(xe, { children: [
|
|
178
178
|
/* @__PURE__ */ e(
|
|
179
179
|
Q,
|
|
180
180
|
{
|
|
181
181
|
tooltip: "Schedule Dashboard",
|
|
182
|
-
className:
|
|
182
|
+
className: _("h-7 p-2", a),
|
|
183
183
|
buttonProps: { variant: s },
|
|
184
|
-
onClick: () =>
|
|
184
|
+
onClick: () => l(!0),
|
|
185
185
|
children: /* @__PURE__ */ e(he, { className: "size-4" })
|
|
186
186
|
}
|
|
187
187
|
),
|
|
188
188
|
/* @__PURE__ */ e(
|
|
189
189
|
pe,
|
|
190
190
|
{
|
|
191
|
-
open:
|
|
192
|
-
onOpenChange:
|
|
193
|
-
dashboardId:
|
|
191
|
+
open: i,
|
|
192
|
+
onOpenChange: l,
|
|
193
|
+
dashboardId: n,
|
|
194
194
|
dashboardName: c
|
|
195
195
|
}
|
|
196
196
|
)
|
|
197
197
|
] }) : null;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Re(a, s) {
|
|
200
200
|
L(() => (a && s && (window.__SEMAPHOR_PRINT_STATE__ = {
|
|
201
201
|
...s
|
|
202
202
|
}), () => {
|
|
203
203
|
a && window.__SEMAPHOR_PRINT_STATE__ && delete window.__SEMAPHOR_PRINT_STATE__;
|
|
204
204
|
}), [a, s]);
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function I(a) {
|
|
207
207
|
if (!a) return "--";
|
|
208
208
|
const s = new Date(a);
|
|
209
209
|
return Number.isNaN(s.getTime()) ? "--" : s.toLocaleString();
|
|
@@ -212,11 +212,11 @@ function ve(a) {
|
|
|
212
212
|
var s;
|
|
213
213
|
return ((s = a.alertState) == null ? void 0 : s.currentState) === "FIRING" ? "Signal surfaced" : a.status === "ACTIVE" ? "Watching" : a.status === "PAUSED" ? "Paused" : a.status;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
var h, N,
|
|
217
|
-
const { authToken:
|
|
215
|
+
function Ie({ alertId: a, onBack: s }) {
|
|
216
|
+
var h, N, U, z;
|
|
217
|
+
const { authToken: i, tokenProps: l } = j(), { data: n, isLoading: c, refetch: u } = fe(a), t = (n == null ? void 0 : n.alert) ?? null, [o, m] = P([]), [b, v] = P([]), [g, y] = P(null), A = M(async () => {
|
|
218
218
|
var f;
|
|
219
|
-
const d =
|
|
219
|
+
const d = l == null ? void 0 : l.apiServiceUrl, p = i == null ? void 0 : i.accessToken;
|
|
220
220
|
if (!d || !p || !a) return null;
|
|
221
221
|
try {
|
|
222
222
|
const S = await fetch(`${d}/v1/alerts/${a}/runs?limit=20`, {
|
|
@@ -231,8 +231,8 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
231
231
|
return v([]), y(null), null;
|
|
232
232
|
}
|
|
233
233
|
return null;
|
|
234
|
-
}, [a,
|
|
235
|
-
const p =
|
|
234
|
+
}, [a, i, g, l]), x = M(async (d) => {
|
|
235
|
+
const p = l == null ? void 0 : l.apiServiceUrl, f = i == null ? void 0 : i.accessToken, S = d ?? g;
|
|
236
236
|
if (!p || !f || !a || !S) {
|
|
237
237
|
m([]);
|
|
238
238
|
return;
|
|
@@ -252,7 +252,7 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
252
252
|
} catch {
|
|
253
253
|
m([]);
|
|
254
254
|
}
|
|
255
|
-
}, [a,
|
|
255
|
+
}, [a, i, g, l]), k = M(async () => {
|
|
256
256
|
await u();
|
|
257
257
|
const d = await A();
|
|
258
258
|
await x(d);
|
|
@@ -278,7 +278,7 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
278
278
|
/* @__PURE__ */ e(E, { variant: t.status === "ACTIVE" ? "default" : "secondary", children: ve(t) }),
|
|
279
279
|
((h = t.alertState) == null ? void 0 : h.currentState) && /* @__PURE__ */ e(E, { variant: t.alertState.currentState === "FIRING" ? "destructive" : "outline", children: t.alertState.currentState === "FIRING" ? "Signal surfaced" : "Stable" })
|
|
280
280
|
] }),
|
|
281
|
-
/* @__PURE__ */ e(T, { variant: "outline", size: "sm", onClick: () => void
|
|
281
|
+
/* @__PURE__ */ e(T, { variant: "outline", size: "sm", onClick: () => void k(), children: "Refresh" })
|
|
282
282
|
] }),
|
|
283
283
|
t.description && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t.description }),
|
|
284
284
|
/* @__PURE__ */ r("div", { className: "rounded-md border bg-muted/30 p-4 text-sm", children: [
|
|
@@ -301,16 +301,16 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
301
301
|
/* @__PURE__ */ r("div", { children: [
|
|
302
302
|
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Last Evaluated:" }),
|
|
303
303
|
" ",
|
|
304
|
-
|
|
304
|
+
I((N = t.alertState) == null ? void 0 : N.lastEvaluatedAt)
|
|
305
305
|
] }),
|
|
306
306
|
/* @__PURE__ */ r("div", { children: [
|
|
307
307
|
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: "Last Surfaced:" }),
|
|
308
308
|
" ",
|
|
309
|
-
|
|
309
|
+
I((U = t.alertState) == null ? void 0 : U.lastTriggeredAt)
|
|
310
310
|
] })
|
|
311
311
|
] })
|
|
312
312
|
] }),
|
|
313
|
-
((
|
|
313
|
+
((z = t.deliveryConfig) == null ? void 0 : z.channels) && t.deliveryConfig.channels.length > 0 && /* @__PURE__ */ r("div", { className: "rounded-md border bg-background p-4 space-y-2", children: [
|
|
314
314
|
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: "Where It Surfaces" }),
|
|
315
315
|
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2", children: t.deliveryConfig.channels.map((d) => /* @__PURE__ */ e(E, { variant: "outline", children: d }, d)) })
|
|
316
316
|
] }),
|
|
@@ -322,7 +322,7 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
322
322
|
variant: d.id === g ? "default" : "outline",
|
|
323
323
|
size: "sm",
|
|
324
324
|
onClick: () => y(d.id),
|
|
325
|
-
children:
|
|
325
|
+
children: I(d.scheduledFor)
|
|
326
326
|
},
|
|
327
327
|
d.id
|
|
328
328
|
)) }),
|
|
@@ -345,7 +345,7 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
345
345
|
children: f.status
|
|
346
346
|
}
|
|
347
347
|
) }),
|
|
348
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-1", children:
|
|
348
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1", children: I(f.createdAt) }),
|
|
349
349
|
/* @__PURE__ */ e("td", { className: "px-2 py-1 text-muted-foreground", children: f.error || "--" })
|
|
350
350
|
] }, f.id)) })
|
|
351
351
|
] }) })
|
|
@@ -353,9 +353,9 @@ function Re({ alertId: a, onBack: s }) {
|
|
|
353
353
|
] })
|
|
354
354
|
] }) : /* @__PURE__ */ e("div", { className: "p-4 text-sm text-muted-foreground", children: "Signal not found." });
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function _e() {
|
|
357
357
|
var c, u;
|
|
358
|
-
const { quotasQuery: a, usageQuery: s } = ge(),
|
|
358
|
+
const { quotasQuery: a, usageQuery: s } = ge(), i = ((c = a.data) == null ? void 0 : c.quotas) || [], l = ((u = s.data) == null ? void 0 : u.usage) || [], n = new Map(l.map((t) => [t.tenantId || "org", t]));
|
|
359
359
|
return /* @__PURE__ */ r("div", { className: "space-y-4 p-4", children: [
|
|
360
360
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
361
361
|
/* @__PURE__ */ e("h2", { className: "text-xl font-semibold", children: "Alert Quotas" }),
|
|
@@ -380,8 +380,8 @@ function Pe() {
|
|
|
380
380
|
/* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium", children: "Min Cadence" }),
|
|
381
381
|
/* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium", children: "Max Context Sources" })
|
|
382
382
|
] }) }),
|
|
383
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
384
|
-
const o = t.tenantId || "org", m =
|
|
383
|
+
/* @__PURE__ */ e("tbody", { children: i.map((t) => {
|
|
384
|
+
const o = t.tenantId || "org", m = n.get(o);
|
|
385
385
|
return /* @__PURE__ */ r("tr", { className: "border-t", children: [
|
|
386
386
|
/* @__PURE__ */ e("td", { className: "px-3 py-2", children: o }),
|
|
387
387
|
/* @__PURE__ */ e("td", { className: "px-3 py-2", children: (m == null ? void 0 : m.activeAlerts) ?? 0 }),
|
|
@@ -397,29 +397,32 @@ function Pe() {
|
|
|
397
397
|
] });
|
|
398
398
|
}
|
|
399
399
|
export {
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
Wt as AdvancedModeToggle,
|
|
401
|
+
Ie as AlertDetailPageEmbedded,
|
|
402
402
|
Me as AlertManagementPage,
|
|
403
403
|
Fe as AlertWizardDialog,
|
|
404
404
|
Le as AlertsApiError,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
Ue as CALCULATED_FIELD_ENTITY_MARKER,
|
|
406
|
+
It as CONTROL_CARD_DEFAULT_VALUE,
|
|
407
|
+
Ft as CalendarPreferencesDialog,
|
|
408
|
+
ze as CardAlertIndicator,
|
|
408
409
|
Be as CardSummary,
|
|
409
410
|
Te as Combobox,
|
|
410
|
-
|
|
411
|
-
|
|
411
|
+
Oe as DATE_FORMAT_VALUES,
|
|
412
|
+
_t as DEFAULT_CALENDAR_CONTEXT,
|
|
412
413
|
Pt as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
|
|
413
|
-
|
|
414
|
+
je as Dashboard,
|
|
415
|
+
Qt as DashboardControlsSettings,
|
|
414
416
|
We as DashboardExportDialog,
|
|
415
|
-
|
|
417
|
+
Vt as DashboardFilterControlsButton,
|
|
418
|
+
Lt as DashboardSummarySettingsDialog,
|
|
416
419
|
Qe as DashboardWC,
|
|
417
420
|
kt as EMPTY_SELECTION,
|
|
418
421
|
pe as EmailScheduleDialog,
|
|
419
422
|
Ve as ExportError,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
+
$t as ExportNotificationItem,
|
|
424
|
+
qt as ExportNotificationList,
|
|
425
|
+
Ht as NotificationBell,
|
|
423
426
|
$e as PivotMarkerEnum,
|
|
424
427
|
zt as ResourceManagementPanel,
|
|
425
428
|
qe as ResourceType,
|
|
@@ -430,10 +433,10 @@ export {
|
|
|
430
433
|
Ke as ShareDialog,
|
|
431
434
|
Ye as SummaryCard,
|
|
432
435
|
Xe as Surfboard,
|
|
433
|
-
|
|
434
|
-
|
|
436
|
+
_e as TenantQuotaPage,
|
|
437
|
+
Gt as UnsavedChangesAlert,
|
|
435
438
|
Ee as Visual,
|
|
436
|
-
|
|
439
|
+
Kt as VisualEditingControls,
|
|
437
440
|
H as backtestAlert,
|
|
438
441
|
Je as cancelExport,
|
|
439
442
|
Ze as cloneDeep,
|
|
@@ -466,21 +469,21 @@ export {
|
|
|
466
469
|
Ea as invalidateToken,
|
|
467
470
|
Ta as isBooleanDataType,
|
|
468
471
|
wa as isCalculatedDimension,
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
Ra as isCalculatedField,
|
|
473
|
+
Ia as isCalculatedMetric,
|
|
474
|
+
_a as isColumnInSqlGen,
|
|
475
|
+
Pa as isDateDataType,
|
|
476
|
+
ka as isExportComplete,
|
|
474
477
|
Ma as isExportInProgress,
|
|
475
478
|
Fa as isNumberDataType,
|
|
476
479
|
La as isTextDataType,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
+
Ua as listAlertQuotas,
|
|
481
|
+
za as listAlerts,
|
|
482
|
+
es as normalizeDashboardForDirtyCheck,
|
|
480
483
|
Ba as previewAlertDeliverable,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
+
Oa as resolveDataType,
|
|
485
|
+
ja as resolveDatamodelName,
|
|
486
|
+
as as serializeDashboardForDirtyCheck,
|
|
484
487
|
Wa as triggerAlertNow,
|
|
485
488
|
Qa as updateAlert,
|
|
486
489
|
Va as updateAlertContextSources,
|
|
@@ -516,18 +519,18 @@ export {
|
|
|
516
519
|
bt as useDashboardSummary,
|
|
517
520
|
gt as useDataColumns,
|
|
518
521
|
xt as useDateFilterHook,
|
|
519
|
-
|
|
522
|
+
Ot as useDebouncedDirtyCheck,
|
|
520
523
|
Nt as useEditorActions,
|
|
521
524
|
vt as useEditorAside,
|
|
522
525
|
yt as useEditorStore,
|
|
523
526
|
At as useExportActions,
|
|
524
|
-
|
|
525
|
-
|
|
527
|
+
Yt as useExportPolling,
|
|
528
|
+
Xt as useExportRecovery,
|
|
526
529
|
Ct as useExportStore,
|
|
527
|
-
|
|
530
|
+
Re as useExposePrintState,
|
|
528
531
|
St as useInProgressExportsCount,
|
|
529
532
|
Dt as useManagementStore,
|
|
530
|
-
|
|
533
|
+
Jt as usePristineSnapshotInitializer,
|
|
531
534
|
Et as useResourceManagement,
|
|
532
535
|
Tt as useSelectedAlertId,
|
|
533
536
|
wt as useTextFilterHook
|
package/dist/shared/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/use-debounced-dirty-check-XHSwAefL.js"),e=require("../chunks/normalize-dashboard-for-dirty-check-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/use-debounced-dirty-check-XHSwAefL.js"),e=require("../chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");exports.useDebouncedDirtyCheck=r.useDebouncedDirtyCheck;exports.normalizeDashboardForDirtyCheck=e.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=e.serializeDashboardForDirtyCheck;
|
package/dist/shared/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { u as o } from "../chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
2
|
-
import { n as s, s as i } from "../chunks/normalize-dashboard-for-dirty-check-
|
|
2
|
+
import { n as s, s as i } from "../chunks/normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
3
3
|
export {
|
|
4
4
|
s as normalizeDashboardForDirtyCheck,
|
|
5
5
|
i as serializeDashboardForDirtyCheck,
|