react-semaphor 0.1.291 → 0.1.292
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/braces-0bzwctGp.js +23 -0
- package/dist/chunks/braces-hczcJsV8.js +6 -0
- package/dist/chunks/dashboard-controls-Db0F38eK.js +47 -0
- package/dist/chunks/dashboard-controls-DeUHM4uL.js +1970 -0
- package/dist/chunks/{dashboard-filter-controls-button-C4AMu723.js → dashboard-filter-controls-button-DDqEus_E.js} +54 -52
- package/dist/chunks/dashboard-filter-controls-button-DSQHVjjX.js +11 -0
- package/dist/chunks/{dashboard-json-C13EJaTK.js → dashboard-json-BDyKcoGT.js} +1 -1
- package/dist/chunks/{dashboard-json-BKs1UTLL.js → dashboard-json-COXiPm3N.js} +6 -6
- package/dist/chunks/{dashboard-summary-settings-dialog-fL9l0wUO.js → dashboard-summary-settings-dialog-CryMC_4x.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-T6aUgPAf.js → dashboard-summary-settings-dialog-DbcWMZsr.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CKB34ird.js → edit-dashboard-visual-BqfzqW4i.js} +4 -9
- package/dist/chunks/{edit-dashboard-visual-CnVx0Xi7.js → edit-dashboard-visual-DLyimx6x.js} +11 -29
- package/dist/chunks/{index-Cr9Smn6Q.js → index-72yod5pb.js} +523 -516
- package/dist/chunks/{index-Cwg2SRSi.js → index-BQ6qu8FI.js} +93 -93
- package/dist/chunks/resource-management-panel-CSLGSJjC.js +6 -0
- package/dist/chunks/{resource-management-panel-DJgYduN9.js → resource-management-panel-DwPION_M.js} +22 -22
- package/dist/chunks/{use-create-flow-overlay-state-NGb4c5Ye.js → use-create-flow-overlay-state-UruHbtfS.js} +53 -53
- package/dist/chunks/{use-create-flow-overlay-state-DnI1SSKD.js → use-create-flow-overlay-state-zz9TYhdC.js} +1 -1
- package/dist/chunks/{use-visual-utils-ivCDI1cO.js → use-visual-utils-Bm-ZnkON.js} +1 -1
- package/dist/chunks/{use-visual-utils-BbxYtbzK.js → use-visual-utils-DPBqTRUC.js} +11 -11
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +21 -21
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-BSbG43wo.js +0 -42
- package/dist/chunks/dashboard-controls-LtQ98rvL.js +0 -1938
- package/dist/chunks/dashboard-filter-controls-button-CgoIPOZZ.js +0 -11
- package/dist/chunks/resource-management-panel-Dv18tosO.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./index-
|
|
1
|
+
"use strict";const o=require("./index-BQ6qu8FI.js"),p=require("react");function x(e){const[a,s]=p.useState(null),[t,r]=p.useState(null),i=o.useEnsureReactGlobals();return p.useEffect(()=>{if(!e||e.trim()===""){s(null),r(null);return}if(!i)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 c=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(c,{method:"HEAD"})).ok)throw new Error(`Module not found at ${c}`)}catch{}const f=await import(c);if(typeof f.useChartStore!="function")throw new Error("useChartStore is not a function");s(()=>f.useChartStore),r(null)}catch(n){const c=n instanceof Error?n.message:"Unknown error";console.error("Failed to load remote chart store:",c),r(c),s(null)}})()},[e,i]),a}function G(e,a){if(e.length===0)return"";const s=e.find(t=>{var r,i;return((r=t.customCardPreferences)==null?void 0:r.visualType)==="multiple"||!!((i=t.customCardPreferences)!=null&&i.dataInputCardIds)});if(s)return s.id;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 l=r.split("__")[0],n=e.find(c=>c.tabTitle===l);return n?n.id:e[0].id}return a}}return e[0].id}const V=new Set;function J(e){return V.add(e),()=>{V.delete(e)}}function q(){V.forEach(e=>{e()})}const K=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:a,...s}=e;return s};async function B(e,a,s,t){if(!a||!s)throw new Error("Missing auth token or visual ID");const r=["resource-by-id","visual",s],i=t.getQueryData(r);if(i)return console.log("Using cached visual data for:",s),{data:i,fromCache:!0};console.log("Fetching visual data from network for:",s);const l=o.ue.loading("Loading visual...",{position:"top-center"});try{const n=await fetch(`${e}/management/v1/visuals/${s}`,{headers:{Authorization:`Bearer ${a}`}});if(!n.ok)throw new Error("Failed to load visual");const c=await n.json();return t.setQueryData(r,c),o.ue.dismiss(l),{data:c,fromCache:!1}}catch(n){throw o.ue.dismiss(l),n}}function z(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function X(e,a){var i,l;const s=(e==null?void 0:e.frameObject)??((i=e==null?void 0:e.visual)==null?void 0:i.frameObject);if(!s)return!1;const t=z(s);if(!(t!=null&&t.cards)||t.cards.length===0)return!1;const r=(l=t.cards)==null?void 0:l.find(n=>n.id===t.activeCardId);return r?(o.setupEditorWithCard({...a,frame:t,card:r,visualId:(e==null?void 0:e.id)||t.visualId}),!0):!1}function Y(){const e=o.useEditorStore(t=>{var r;return((r=t.card.customCardPreferences)==null?void 0:r.url)||""}),a=x(e);return{getUpdatedFrame:p.useCallback(()=>{var g;q();const{frame:t,card:r,isDevMode:i,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:c,selectedDatabaseName:f,selectedTableName:h,selectedConnectionId:F}=o.useEditorStore.getState(),y=r.sql,I=(g=a==null?void 0:a.getState())==null?void 0:g.settings,U=o.buildSavedEditorCard(r,{isDevMode:i,cardSql:y,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:c,selectedDatabaseName:f,selectedTableName:h,selectedConnectionId:F,remoteChartSettings:I,stripConfig:K}),S=t.cards.map(b=>b.id===r.id?U:b);return{...t,cards:S,activeCardId:G(S,t.activeCardId)}},[a])}}function Z(){const{authToken:e,tokenProps:a}=o.useSemaphorContext(),s=o.useQueryClient(),t=o.useSelectedVisual(),{selectVisual:r}=o.useManagementActions(),{setFrame:i,setCard:l,setIsDevMode:n,initializeModeDrafts:c,setActiveTabCardId:f,updateDataSource:h,setQueryResultColumns:F,setSelectedConnectionId:y,setSelectedDatabaseName:I,setSelectedSchemaName:U,setSelectedTableName:S,setSelectedDatamodelId:g,setFilterValues:b,setInlineFilterValuesMap:D,setApplyFilters:M}=o.useEditorActions(),{setIsDashboardEditing:v,setIsVisualEditing:A,setSelectedFrameId:P,clearSelectedFrameId:k,addFrame:L,setIsDashboardPanelOpen:T}=o.useDashboardActions(),E=o.useDashboardStore(d=>d.selectedSheetId),j=o.useDashboardStore(d=>d.selectedFrameId),N=o.useDashboardStore(d=>d.dashboard),R=o.useDashboardStore(d=>d.filterValues),$=o.useDashboardStore(d=>d.inlineFilterValuesMap),w=o.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),H=p.useCallback(async d=>{try{r(d),k();const{data:m,fromCache:u}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",d.id,s);if(!X(m,{setFrame:i,setCard:l,setIsDevMode:n,initializeModeDrafts:c,setActiveTabCardId:f,updateDataSource:h,setQueryResultColumns:F,setSelectedConnectionId:y,setSelectedDatabaseName:I,setSelectedSchemaName:U,setSelectedTableName:S,setSelectedDatamodelId:g,setFilterValues:b,setInlineFilterValuesMap:D,setApplyFilters:M,setIsDashboardEditing:v,setIsVisualEditing:A,dashboard:N,selectedSheetId:E,selectedFrameId:j,filterValues:R,inlineFilterValuesMap:$}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:u}}catch(m){return console.error("Error editing visual:",m),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,r,i,l,v,A,n,c,f,h,F,y,I,U,S,g,b,D,M,k,N,E,j,R,$]),Q=p.useCallback(async d=>{var m;try{if(r(d),!E)return{success:!1,error:"No sheet selected. Please select a sheet first."};const{data:u,fromCache:O}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",d.id,s),W=(u==null?void 0:u.frameObject)??((m=u==null?void 0:u.visual)==null?void 0:m.frameObject);if(!W)return{success:!1,error:"Visual has no frame data"};const C=z(W);if(!(C!=null&&C.cards)||C.cards.length===0)return{success:!1,error:"Visual frame is malformed"};const _={...o.cloneLinkedFrameWithSourceMapping(C),visualId:d.id};return L(E,_,"end"),v(!0),P(_.id),T(!1),{success:!0,fromCache:O}}catch(u){return console.error("Error adding visual:",u),{success:!1,error:"Failed to add visual to dashboard"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,r,E,L,v,P,T]);return{visual:w.data,isLoading:w.isLoading,isError:w.isError,error:w.error,handleEditLibraryVisual:H,handleAddLibraryVisual:Q,getUpdatedFrame:Y().getUpdatedFrame,refetch:w.refetch}}exports.flushPendingEditorDrafts=q;exports.registerPendingEditorDraftFlusher=J;exports.useVisualUtils=Z;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as K, d as G, J as X, K as Y, M as Z, N as ee, O as te, u as E, Q as re, T as se, y as v, U as ae, V as H, W as oe } from "./index-72yod5pb.js";
|
|
2
2
|
import { useState as Q, useEffect as ne, useCallback as V } from "react";
|
|
3
3
|
function ie(e) {
|
|
4
|
-
const [a, s] = Q(null), [t, r] = Q(null), n =
|
|
4
|
+
const [a, s] = Q(null), [t, r] = Q(null), n = K();
|
|
5
5
|
return ne(() => {
|
|
6
6
|
if (!e || e.trim() === "") {
|
|
7
7
|
s(null), r(null);
|
|
@@ -84,7 +84,7 @@ const le = (e) => {
|
|
|
84
84
|
const { detailTableBackup: a, ...s } = e;
|
|
85
85
|
return s;
|
|
86
86
|
};
|
|
87
|
-
async function
|
|
87
|
+
async function z(e, a, s, t) {
|
|
88
88
|
if (!a || !s)
|
|
89
89
|
throw new Error("Missing auth token or visual ID");
|
|
90
90
|
const r = ["resource-by-id", "visual", s], n = t.getQueryData(r);
|
|
@@ -111,7 +111,7 @@ async function x(e, a, s, t) {
|
|
|
111
111
|
throw v.dismiss(d), o;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function x(e) {
|
|
115
115
|
if (typeof e == "string")
|
|
116
116
|
return JSON.parse(e);
|
|
117
117
|
if (typeof e == "object")
|
|
@@ -123,7 +123,7 @@ function ue(e, a) {
|
|
|
123
123
|
const s = (e == null ? void 0 : e.frameObject) ?? ((n = e == null ? void 0 : e.visual) == null ? void 0 : n.frameObject);
|
|
124
124
|
if (!s)
|
|
125
125
|
return !1;
|
|
126
|
-
const t =
|
|
126
|
+
const t = x(s);
|
|
127
127
|
if (!(t != null && t.cards) || t.cards.length === 0)
|
|
128
128
|
return !1;
|
|
129
129
|
const r = (d = t.cards) == null ? void 0 : d.find(
|
|
@@ -178,7 +178,7 @@ function fe() {
|
|
|
178
178
|
}, [a]) };
|
|
179
179
|
}
|
|
180
180
|
function ge() {
|
|
181
|
-
const { authToken: e, tokenProps: a } =
|
|
181
|
+
const { authToken: e, tokenProps: a } = G(), s = X(), t = Y(), { selectVisual: r } = Z(), {
|
|
182
182
|
setFrame: n,
|
|
183
183
|
setCard: d,
|
|
184
184
|
setIsDevMode: o,
|
|
@@ -209,7 +209,7 @@ function ge() {
|
|
|
209
209
|
async (c) => {
|
|
210
210
|
try {
|
|
211
211
|
r(c), N();
|
|
212
|
-
const { data: h, fromCache: l } = await
|
|
212
|
+
const { data: h, fromCache: l } = await z(
|
|
213
213
|
a.apiServiceUrl,
|
|
214
214
|
(e == null ? void 0 : e.accessToken) || "",
|
|
215
215
|
c.id,
|
|
@@ -274,7 +274,7 @@ function ge() {
|
|
|
274
274
|
O,
|
|
275
275
|
R
|
|
276
276
|
]
|
|
277
|
-
),
|
|
277
|
+
), J = V(
|
|
278
278
|
async (c) => {
|
|
279
279
|
var h;
|
|
280
280
|
try {
|
|
@@ -283,7 +283,7 @@ function ge() {
|
|
|
283
283
|
success: !1,
|
|
284
284
|
error: "No sheet selected. Please select a sheet first."
|
|
285
285
|
};
|
|
286
|
-
const { data: l, fromCache: W } = await
|
|
286
|
+
const { data: l, fromCache: W } = await z(
|
|
287
287
|
a.apiServiceUrl,
|
|
288
288
|
(e == null ? void 0 : e.accessToken) || "",
|
|
289
289
|
c.id,
|
|
@@ -291,7 +291,7 @@ function ge() {
|
|
|
291
291
|
), _ = (l == null ? void 0 : l.frameObject) ?? ((h = l == null ? void 0 : l.visual) == null ? void 0 : h.frameObject);
|
|
292
292
|
if (!_)
|
|
293
293
|
return { success: !1, error: "Visual has no frame data" };
|
|
294
|
-
const w =
|
|
294
|
+
const w = x(_);
|
|
295
295
|
if (!(w != null && w.cards) || w.cards.length === 0)
|
|
296
296
|
return { success: !1, error: "Visual frame is malformed" };
|
|
297
297
|
const B = {
|
|
@@ -322,7 +322,7 @@ function ge() {
|
|
|
322
322
|
isError: b.isError,
|
|
323
323
|
error: b.error,
|
|
324
324
|
handleEditLibraryVisual: q,
|
|
325
|
-
handleAddLibraryVisual:
|
|
325
|
+
handleAddLibraryVisual: J,
|
|
326
326
|
getUpdatedFrame: fe().getUpdatedFrame,
|
|
327
327
|
refetch: b.refetch
|
|
328
328
|
};
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-BQ6qu8FI.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
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-Cwg2SRSi.js"),_=require("./types/index.cjs"),M=require("./chunks/dashboard-summary-settings-dialog-fL9l0wUO.js"),t=require("react/jsx-runtime"),x=require("react"),O=require("./chunks/resource-management-panel-Dv18tosO.js"),U=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const A=require("./chunks/dashboard-filter-controls-button-CgoIPOZZ.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=$;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BQ6qu8FI.js"),_=require("./types/index.cjs"),M=require("./chunks/dashboard-summary-settings-dialog-CryMC_4x.js"),t=require("react/jsx-runtime"),x=require("react"),O=require("./chunks/resource-management-panel-CSLGSJjC.js"),U=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const A=require("./chunks/dashboard-filter-controls-button-DSQHVjjX.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,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { d as j, Y as q, Z as H, _ as Q, $ as G, a0 as K, a1 as Y, a2 as X, a3 as J, a4 as Z, u as F, a5 as O, a6 as ee, P as ae, k as te, B as T, b as _, a7 as se, m as re, n as ne, o as ie, a8 as V, a9 as oe, p as le, q as de, r as ce, s as ue, t as me, aa as he, ab as pe, ac as fe, ad as E, ae as be, af as ge } from "./chunks/index-72yod5pb.js";
|
|
2
|
+
import { aV as Me, aX as Fe, bD as Le, aZ as Ue, aW as ze, ay as Be, a_ as Oe, D as je, aw as Qe, aq as Ve, bJ as We, b2 as $e, ai as qe, al as He, al as Ge, am as Ke, ax as Ye, a as Xe, bI as Je, at as Ze, bo as ea, bl as aa, bE as ta, b9 as sa, bq as ra, av as na, ar as ia, as as oa, b3 as la, bM as da, bn as ca, bx as ua, bu as ma, bB as ha, bv as pa, bw as fa, bt as ba, bs as ga, bb as xa, bH as Na, bG as va, bF as ya, ba as Aa, be as Ca, bf as Sa, b8 as Da, au as Ea, b7 as Ta, b0 as wa, b1 as Ra, a$ as Ia, bc as _a, b6 as Pa, bL as ka, bK as Ma, b5 as Fa, b4 as La, bA as Ua, bm as za, bz as Ba, bg as Oa, bd as ja, br as Qa, bp as Va, by as Wa, bC as $a, aF as qa, aC as Ha, aO as Ga, aM as Ka, aU as Ya, aT as Xa, aL as Ja, aK as Za, aJ as et, aN as at, aY as tt, aH as st, aI as rt, aP as nt, aR as it, ap as ot, aQ as lt, aA as dt, bi as ct, bk as ut, bj as mt, O as ht, ao as pt, ah as ft, az as bt, aB as gt, aj as xt, N as Nt, bh as vt, V as yt, aE as At, aD as Ct, aG as St, ag as Dt, an as Et, aS as Tt, ak as wt } from "./chunks/index-72yod5pb.js";
|
|
3
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-
|
|
4
|
+
import { C as Ft, D as Lt } from "./chunks/dashboard-summary-settings-dialog-DbcWMZsr.js";
|
|
5
5
|
import { jsx as e, jsxs as r, Fragment as xe } from "react/jsx-runtime";
|
|
6
6
|
import * as R from "react";
|
|
7
|
-
import { useMemo as
|
|
8
|
-
import { ResourceManagementPanel as zt } from "./chunks/resource-management-panel-
|
|
7
|
+
import { useMemo as W, useState as P, useEffect as L, useCallback as M } from "react";
|
|
8
|
+
import { ResourceManagementPanel as zt } from "./chunks/resource-management-panel-DwPION_M.js";
|
|
9
9
|
import { u as Ot } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
10
10
|
import "react-dom";
|
|
11
|
-
import { A as
|
|
11
|
+
import { A as Qt, D as Vt, c as Wt, 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-DDqEus_E.js";
|
|
12
12
|
import { n as es, s as as } from "./chunks/normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
13
13
|
function De(a) {
|
|
14
14
|
const { authToken: s, tokenProps: i } = j();
|
|
@@ -27,7 +27,7 @@ function Ee(a) {
|
|
|
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(
|
|
30
|
+
return /* @__PURE__ */ e(Q, { FallbackComponent: G, children: /* @__PURE__ */ r(K, { dashboardProps: n, children: [
|
|
31
31
|
/* @__PURE__ */ e(Y, { componentType: "visual", componentId: a.cardId }),
|
|
32
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
|
] }) });
|
|
@@ -36,7 +36,7 @@ function Ne({ cardId: a }) {
|
|
|
36
36
|
const s = F((n) => {
|
|
37
37
|
var c;
|
|
38
38
|
return (c = n.dashboard) == null ? void 0 : c.sheets;
|
|
39
|
-
}), { card: i, frame: l } =
|
|
39
|
+
}), { card: i, frame: l } = W(() => {
|
|
40
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;
|
|
@@ -54,7 +54,7 @@ function Ne({ cardId: a }) {
|
|
|
54
54
|
customerFacingMessage: `Card not found with ID: ${a}`
|
|
55
55
|
}
|
|
56
56
|
) : /* @__PURE__ */ e("main", { className: "flex h-full grow flex-col", children: /* @__PURE__ */ e(
|
|
57
|
-
|
|
57
|
+
Q,
|
|
58
58
|
{
|
|
59
59
|
FallbackComponent: ({
|
|
60
60
|
error: n,
|
|
@@ -120,7 +120,7 @@ function Te({
|
|
|
120
120
|
children: /* @__PURE__ */ r(ne, { children: [
|
|
121
121
|
/* @__PURE__ */ r("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
|
|
122
122
|
/* @__PURE__ */ e(ie, { className: "h-9", placeholder: "Search..." }),
|
|
123
|
-
/* @__PURE__ */ e(
|
|
123
|
+
/* @__PURE__ */ e(V, { className: "h-7", onClick: u, children: /* @__PURE__ */ e(
|
|
124
124
|
oe,
|
|
125
125
|
{
|
|
126
126
|
className: _(
|
|
@@ -176,7 +176,7 @@ function we({
|
|
|
176
176
|
});
|
|
177
177
|
return n ? /* @__PURE__ */ r(xe, { children: [
|
|
178
178
|
/* @__PURE__ */ e(
|
|
179
|
-
|
|
179
|
+
V,
|
|
180
180
|
{
|
|
181
181
|
tooltip: "Schedule Dashboard",
|
|
182
182
|
className: _("h-7 p-2", a),
|
|
@@ -264,7 +264,7 @@ function Ie({ alertId: a, onBack: s }) {
|
|
|
264
264
|
x().catch(() => {
|
|
265
265
|
});
|
|
266
266
|
}, [x]);
|
|
267
|
-
const w =
|
|
267
|
+
const w = W(() => {
|
|
268
268
|
const d = {};
|
|
269
269
|
for (const p of o)
|
|
270
270
|
d[p.channel] || (d[p.channel] = []), d[p.channel].push(p);
|
|
@@ -397,7 +397,7 @@ function _e() {
|
|
|
397
397
|
] });
|
|
398
398
|
}
|
|
399
399
|
export {
|
|
400
|
-
|
|
400
|
+
Qt as AdvancedModeToggle,
|
|
401
401
|
Ie as AlertDetailPageEmbedded,
|
|
402
402
|
Me as AlertManagementPage,
|
|
403
403
|
Fe as AlertWizardDialog,
|
|
@@ -412,14 +412,14 @@ export {
|
|
|
412
412
|
_t as DEFAULT_CALENDAR_CONTEXT,
|
|
413
413
|
Pt as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
|
|
414
414
|
je as Dashboard,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
Vt as DashboardControlsSettings,
|
|
416
|
+
Qe as DashboardExportDialog,
|
|
417
|
+
Wt as DashboardFilterControlsButton,
|
|
418
418
|
Lt as DashboardSummarySettingsDialog,
|
|
419
|
-
|
|
419
|
+
Ve as DashboardWC,
|
|
420
420
|
kt as EMPTY_SELECTION,
|
|
421
421
|
pe as EmailScheduleDialog,
|
|
422
|
-
|
|
422
|
+
We as ExportError,
|
|
423
423
|
$t as ExportNotificationItem,
|
|
424
424
|
qt as ExportNotificationList,
|
|
425
425
|
Ht as NotificationBell,
|
|
@@ -484,9 +484,9 @@ export {
|
|
|
484
484
|
Oa as resolveDataType,
|
|
485
485
|
ja as resolveDatamodelName,
|
|
486
486
|
as as serializeDashboardForDirtyCheck,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
Qa as triggerAlertNow,
|
|
488
|
+
Va as updateAlert,
|
|
489
|
+
Wa as updateAlertContextSources,
|
|
490
490
|
$a as updateAlertQuota,
|
|
491
491
|
qa as useActiveExports,
|
|
492
492
|
Ha as useAddNewFrame,
|