react-semaphor 0.1.294 → 0.1.295
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-DfDQiR3J.js → braces-BdoTYzuj.js} +1 -1
- package/dist/chunks/{braces-DR-GdaLC.js → braces-DWldEFn5.js} +1 -1
- package/dist/chunks/{dashboard-controls-DGEVXgP5.js → dashboard-controls-B3lrnI_r.js} +1 -1
- package/dist/chunks/{dashboard-controls-C3Z9bpYE.js → dashboard-controls-D7U6E1sB.js} +5 -5
- package/dist/chunks/{dashboard-filter-controls-button-BIYT1ucX.js → dashboard-filter-controls-button-D0AsV28-.js} +1 -1
- package/dist/chunks/{dashboard-filter-controls-button-DxgGUl00.js → dashboard-filter-controls-button-XwenlcXw.js} +3 -3
- package/dist/chunks/{dashboard-json-BvTeHePu.js → dashboard-json-CU55qPXj.js} +1 -1
- package/dist/chunks/{dashboard-json-DQW8TN0I.js → dashboard-json-V6m6lJ_c.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-q7fx3YAK.js → dashboard-summary-settings-dialog-0CIiWsKc.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BsmKiGud.js → dashboard-summary-settings-dialog-DRLPzp1P.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-RVl9nbDZ.js → edit-dashboard-visual-8ha6EM_g.js} +407 -364
- package/dist/chunks/{edit-dashboard-visual-ChKj-Lzr.js → edit-dashboard-visual-sSLAkmgf.js} +3 -3
- package/dist/chunks/{index-DerPpfv0.js → index-14M0TnH6.js} +29597 -28801
- package/dist/chunks/{index-BlspGR07.js → index-Ze8VskG1.js} +252 -252
- package/dist/chunks/{resource-management-panel-DnZ1rw1A.js → resource-management-panel-BL5-5ouC.js} +2 -2
- package/dist/chunks/{resource-management-panel-epydPwyM.js → resource-management-panel-CcDAn86l.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bcg4EgoD.js → use-create-flow-overlay-state-BbQVNDCj.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-C5vdfXhM.js → use-create-flow-overlay-state-D3PxfjYv.js} +2 -2
- package/dist/chunks/{use-visual-utils-D9Kknvjl.js → use-visual-utils-CdIOq4nt.js} +1 -1
- package/dist/chunks/{use-visual-utils-Dw_yw9zU.js → use-visual-utils-kh8p2QFm.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +37 -0
- package/dist/types/main.d.ts +37 -0
- package/dist/types/shared.d.ts +37 -0
- package/dist/types/surfboard.d.ts +37 -0
- package/dist/types/types.d.ts +37 -0
- package/package.json +1 -1
package/dist/chunks/{resource-management-panel-DnZ1rw1A.js → resource-management-panel-BL5-5ouC.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import { c as je, u as ne, W as Fe, N as de, cD as ze, cE as Be, b as Q, B as I, cw as ie, cF as He, cG as Ke, cH as _e, cI as We, cJ as J, x as se, cK as Xe, cL as Ge, cM as Ye, cN as fe, ck as ce, cO as $e, cP as Je, cQ as we, cR as Ne, cS as be, cT as Qe, ao as ye, ak as Ce, cU as ve, cV as Se, cW as Ee, cX as Ve, cY as Le, cZ as Ae, c_ as Oe, c$ as Re, d0 as Te, d1 as Ze, d2 as ue, d3 as ke, ai as te, d as qe, d4 as Ue, d5 as et, e as tt, f as nt, g as at, h as st, i as ot, L as ge, I as xe, w as rt, d6 as it, d7 as De, X as lt, d8 as dt, bU as ct, bV as ut, bW as ht, bX as pt, d9 as mt, da as ft } from "./index-
|
|
2
|
+
import { c as je, u as ne, W as Fe, N as de, cD as ze, cE as Be, b as Q, B as I, cw as ie, cF as He, cG as Ke, cH as _e, cI as We, cJ as J, x as se, cK as Xe, cL as Ge, cM as Ye, cN as fe, ck as ce, cO as $e, cP as Je, cQ as we, cR as Ne, cS as be, cT as Qe, ao as ye, ak as Ce, cU as ve, cV as Se, cW as Ee, cX as Ve, cY as Le, cZ as Ae, c_ as Oe, c$ as Re, d0 as Te, d1 as Ze, d2 as ue, d3 as ke, ai as te, d as qe, d4 as Ue, d5 as et, e as tt, f as nt, g as at, h as st, i as ot, L as ge, I as xe, w as rt, d6 as it, d7 as De, X as lt, d8 as dt, bU as ct, bV as ut, bW as ht, bX as pt, d9 as mt, da as ft } from "./index-14M0TnH6.js";
|
|
3
3
|
import gt, { useRef as xt, useEffect as ae, useState as w } from "react";
|
|
4
|
-
import { u as Ie } from "./use-visual-utils-
|
|
4
|
+
import { u as Ie } from "./use-visual-utils-CdIOq4nt.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|
|
7
7
|
*
|
package/dist/chunks/{resource-management-panel-epydPwyM.js → resource-management-panel-CcDAn86l.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-Ze8VskG1.js"),h=require("react"),ne=require("./use-visual-utils-kh8p2QFm.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./index-
|
|
1
|
+
"use strict";const t=require("./index-Ze8VskG1.js"),e=require("react/jsx-runtime"),v=require("react"),se=require("./use-visual-utils-kh8p2QFm.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as ie, W as _, bO as Ke, bP as pt, bQ as mt, bR as ft, bS as ht, bT as bt, u as le, ai as gt, bU as yt, bV as xt, bW as vt, af as Ct, b as ne, bX as kt, bY as Nt, B as V, t as St, J as de, Q as Pe, M as Ye, bZ as Xe, x as Ge, b_ as Dt, O as Se, b$ as He, X as Je, y as O, c0 as wt, c1 as Tt, c2 as It, c3 as re, c4 as Le, c5 as Ae, c6 as he, c7 as be, c8 as Vt, c9 as ze, ca as Et, cb as qt, cc as se, cd as Ft, ce as Oe, cf as _t, a9 as Me, cg as Be, ch as We, ci as Ze, cj as et, ck as Lt, L as X, I as tt, z as ge, A as ye, E as xe, F as ve, G as Ce, cl as at, cm as At, cn as zt, co as rt, cp as st, cq as Ot, cr as Mt, cs as Bt, ct as Qt, cu as Rt, cv as jt, cw as Ut, cx as Qe, cy as $t, cz as Re, cA as Kt, cB as ke, cC as Pt } from "./index-
|
|
1
|
+
import { c as ie, W as _, bO as Ke, bP as pt, bQ as mt, bR as ft, bS as ht, bT as bt, u as le, ai as gt, bU as yt, bV as xt, bW as vt, af as Ct, b as ne, bX as kt, bY as Nt, B as V, t as St, J as de, Q as Pe, M as Ye, bZ as Xe, x as Ge, b_ as Dt, O as Se, b$ as He, X as Je, y as O, c0 as wt, c1 as Tt, c2 as It, c3 as re, c4 as Le, c5 as Ae, c6 as he, c7 as be, c8 as Vt, c9 as ze, ca as Et, cb as qt, cc as se, cd as Ft, ce as Oe, cf as _t, a9 as Me, cg as Be, ch as We, ci as Ze, cj as et, ck as Lt, L as X, I as tt, z as ge, A as ye, E as xe, F as ve, G as Ce, cl as at, cm as At, cn as zt, co as rt, cp as st, cq as Ot, cr as Mt, cs as Bt, ct as Qt, cu as Rt, cv as jt, cw as Ut, cx as Qe, cy as $t, cz as Re, cA as Kt, cB as ke, cC as Pt } from "./index-14M0TnH6.js";
|
|
2
2
|
import { jsx as t, jsxs as d, Fragment as $ } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo as A, useState as M, useRef as Ne, useCallback as z, useEffect as De, Fragment as Yt } from "react";
|
|
4
|
-
import { u as we } from "./use-visual-utils-
|
|
4
|
+
import { u as we } from "./use-visual-utils-CdIOq4nt.js";
|
|
5
5
|
/**
|
|
6
6
|
* @license lucide-react v0.453.0 - ISC
|
|
7
7
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as G, d as Y, J as X, K as Z, M as ee, N as te, O as re, Q as se, u as b, T as ae, U as oe, y as v, V as ne, W as B, Y as ie } from "./index-
|
|
1
|
+
import { H as G, d as Y, J as X, K as Z, M as ee, N as te, O as re, Q as se, u as b, T as ae, U as oe, y as v, V as ne, W as B, Y as ie } from "./index-14M0TnH6.js";
|
|
2
2
|
import { useState as H, useEffect as ce, useCallback as A } from "react";
|
|
3
3
|
function de(e) {
|
|
4
4
|
const [a, s] = H(null), [r, t] = H(null), o = G();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index-
|
|
1
|
+
"use strict";const a=require("./index-Ze8VskG1.js"),p=require("react");function G(e){const[o,s]=p.useState(null),[r,t]=p.useState(null),n=a.useEnsureReactGlobals();return p.useEffect(()=>{if(!e||e.trim()===""){s(null),t(null);return}if(!n)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 h=await import(c);if(typeof h.useChartStore!="function")throw new Error("useChartStore is not a function");s(()=>h.useChartStore),t(null)}catch(i){const c=i instanceof Error?i.message:"Unknown error";console.error("Failed to load remote chart store:",c),t(c),s(null)}})()},[e,n]),o}function J(e,o){if(e.length===0)return"";const s=e.find(r=>{var t,n;return((t=r.customCardPreferences)==null?void 0:t.visualType)==="multiple"||!!((n=r.customCardPreferences)!=null&&n.dataInputCardIds)});if(s)return s.id;if(o){const r=e.find(t=>t.id===o);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const u=t.split("__")[0],i=e.find(c=>c.tabTitle===u);return i?i.id:e[0].id}return o}}return e[0].id}const D=new Set;function K(e){return D.add(e),()=>{D.delete(e)}}function B(){D.forEach(e=>{e()})}const X=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:o,...s}=e;return s};async function x(e,o,s,r){if(!o||!s)throw new Error("Missing auth token or visual ID");const t=["resource-by-id","visual",s],n=r.getQueryData(t);if(n)return console.log("Using cached visual data for:",s),{data:n,fromCache:!0};console.log("Fetching visual data from network for:",s);const u=a.ue.loading("Loading visual...",{position:"top-center"});try{const i=await fetch(`${e}/management/v1/visuals/${s}`,{headers:{Authorization:`Bearer ${o}`}});if(!i.ok)throw new Error("Failed to load visual");const c=await i.json();return r.setQueryData(t,c),a.ue.dismiss(u),{data:c,fromCache:!1}}catch(i){throw a.ue.dismiss(u),i}}function q(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function Y(e,o){var n,u;const s=(e==null?void 0:e.frameObject)??((n=e==null?void 0:e.visual)==null?void 0:n.frameObject);if(!s)return!1;const r=q(s);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const t=(u=r.cards)==null?void 0:u.find(i=>i.id===r.activeCardId);return t?(a.setupEditorWithCard({...o,frame:r,card:t,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function Z(){const e=a.useEditorStore(r=>{var t;return((t=r.card.customCardPreferences)==null?void 0:t.url)||""}),o=G(e);return{getUpdatedFrame:p.useCallback(()=>{var g;B();const{frame:r,card:t,isDevMode:n,isShowingVisual:u,selectedSchemaName:i,selectedDatamodelId:c,selectedDatabaseName:h,selectedTableName:m,selectedConnectionId:C}=a.useEditorStore.getState(),y=t.sql,I=(g=o==null?void 0:o.getState())==null?void 0:g.settings,U=a.buildSavedEditorCard(t,{isDevMode:n,cardSql:y,isShowingVisual:u,selectedSchemaName:i,selectedDatamodelId:c,selectedDatabaseName:h,selectedTableName:m,selectedConnectionId:C,remoteChartSettings:I,stripConfig:X}),S=r.cards.map(b=>b.id===t.id?U:b);return{...r,cards:S,activeCardId:J(S,r.activeCardId)}},[o])}}function ee(){const{authToken:e,tokenProps:o}=a.useSemaphorContext(),s=a.useQueryClient(),r=a.useAddFrameWithFreshSemanticExecutionPayload(),t=a.useSelectedVisual(),{selectVisual:n}=a.useManagementActions(),{setFrame:u,setCard:i,setIsDevMode:c,initializeModeDrafts:h,setActiveTabCardId:m,updateDataSource:C,setQueryResultColumns:y,setSelectedConnectionId:I,setSelectedDatabaseName:U,setSelectedSchemaName:S,setSelectedTableName:g,setSelectedDatamodelId:b,setFilterValues:A,setInlineFilterValuesMap:P,setApplyFilters:M}=a.useEditorActions(),{setIsDashboardEditing:V,setIsVisualEditing:k,setSelectedFrameId:L,clearSelectedFrameId:T,setIsDashboardPanelOpen:j}=a.useDashboardActions(),E=a.useDashboardStore(d=>d.selectedSheetId),N=a.useDashboardStore(d=>d.selectedFrameId),R=a.useDashboardStore(d=>d.dashboard),W=a.useDashboardStore(d=>d.filterValues),$=a.useDashboardStore(d=>d.inlineFilterValuesMap),w=a.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),z=p.useCallback(async d=>{try{n(d),T();const{data:f,fromCache:v}=await x(o.apiServiceUrl,(e==null?void 0:e.accessToken)||"",d.id,s);if(!Y(f,{setFrame:u,setCard:i,setIsDevMode:c,initializeModeDrafts:h,setActiveTabCardId:m,updateDataSource:C,setQueryResultColumns:y,setSelectedConnectionId:I,setSelectedDatabaseName:U,setSelectedSchemaName:S,setSelectedTableName:g,setSelectedDatamodelId:b,setFilterValues:A,setInlineFilterValuesMap:P,setApplyFilters:M,setIsDashboardEditing:V,setIsVisualEditing:k,dashboard:R,selectedSheetId:E,selectedFrameId:N,filterValues:W,inlineFilterValuesMap:$}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:v}}catch(f){return console.error("Error editing visual:",f),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,o.apiServiceUrl,s,n,u,i,V,k,c,h,m,C,y,I,U,S,g,b,A,P,M,T,R,E,N,W,$]),H=p.useCallback(async d=>{var v;const f=l=>(a.ue.error(l),{success:!1,error:l});try{if(n(d),!E)return f("No sheet selected. Please select a sheet first.");const{data:l,fromCache:Q}=await x(o.apiServiceUrl,(e==null?void 0:e.accessToken)||"",d.id,s),O=(l==null?void 0:l.frameObject)??((v=l==null?void 0:l.visual)==null?void 0:v.frameObject);if(!O)return f("Visual has no frame data");const F=q(O);if(!(F!=null&&F.cards)||F.cards.length===0)return f("Visual frame is malformed");const _={...a.cloneLinkedFrameWithSourceMapping(F),visualId:d.id};return await r(E,_,"end"),V(!0),L(_.id),j(!1),{success:!0,fromCache:Q}}catch(l){return console.error("Error adding visual:",l),f(l instanceof Error?l.message:"Failed to add visual to dashboard")}},[e==null?void 0:e.accessToken,o.apiServiceUrl,s,n,E,V,L,j,r]);return{visual:w.data,isLoading:w.isLoading,isError:w.isError,error:w.error,handleEditLibraryVisual:z,handleAddLibraryVisual:H,getUpdatedFrame:Z().getUpdatedFrame,refetch:w.refetch}}exports.flushPendingEditorDrafts=B;exports.registerPendingEditorDraftFlusher=K;exports.useVisualUtils=ee;
|
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-Ze8VskG1.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-BlspGR07.js"),_=require("./types/index.cjs"),M=require("./chunks/dashboard-summary-settings-dialog-BsmKiGud.js"),t=require("react/jsx-runtime"),u=require("react"),O=require("./chunks/resource-management-panel-epydPwyM.js"),U=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const C=require("./chunks/dashboard-filter-controls-button-BIYT1ucX.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(u);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}=u.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),m=c==null?void 0:c.find(i=>(i==null?void 0:i.id)===s),a=l==null?void 0:l.find(i=>{var h;return(h=i==null?void 0:i.cards)==null?void 0:h.find(f=>(f==null?void 0:f.id)===s)});return{card:m,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(s,r,n,o){u.useEffect(()=>{s&&!n&&r&&o(e.cloneDeep(r))},[s,n,r,o])}function H({name:s,items:r,value:n,onChange:o,isLoading:l,isError:c,refetch:m,className:a,icon:i,showNone:h=!1}){const f=R.useRef(null),[D,A]=R.useState(!1),[b,j]=R.useState("100%"),y=h?[...r||[],{id:"none",name:"None"}]:r;R.useLayoutEffect(()=>{f.current&&j(f.current.offsetWidth)},[]);function I(){var x;return l?"Loading...":c?"Error":n?(x=r==null?void 0:r.find(S=>S.id===n))==null?void 0:x.name:`Select ${s}`}function T(x,S){o(S),A(!1)}return t.jsxs(e.Popover,{open:D,onOpenChange:A,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:m,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(x=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:x.name,onSelect:S=>T(S,x.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===x.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:x.name,children:x.name})]})},x.id))})]})]})})]})}function $({triggerButtonClassName:s,variant:r="ghost"}){const[n,o]=u.useState(!1),l=e.useDashboardStore(m=>{var a;return(a=m.dashboard)==null?void 0:a.id}),c=e.useDashboardStore(m=>{var a;return(a=m.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 G(s,r){u.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 K(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 Y({alertId:s,onBack:r}){var x,S,F,w;const{authToken:n,tokenProps:o}=e.useSemaphorContext(),{data:l,isLoading:c,refetch:m}=e.useAlertDetail(s),a=(l==null?void 0:l.alert)??null,[i,h]=u.useState([]),[f,D]=u.useState([]),[A,b]=u.useState(null),j=u.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=A&&N.some(B=>B.id===A)?A:((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,A,o]),y=u.useCallback(async d=>{const p=o==null?void 0:o.apiServiceUrl,g=n==null?void 0:n.accessToken,v=d??A;if(!p||!g||!s||!v){h([]);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();h(Array.isArray(N.attempts)?N.attempts:[])}else h([])}catch{h([])}},[s,n,A,o]),I=u.useCallback(async()=>{await m();const d=await j();await y(d)},[y,j,m]);u.useEffect(()=>{j().catch(()=>{})},[j]),u.useEffect(()=>{y().catch(()=>{})},[y]);const T=u.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:K(a)}),((x=a.alertState)==null?void 0:x.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===A?"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 X(){var c,m;const{quotasQuery:s,usageQuery:r}=e.useAlertQuotas(),n=((c=s.data)==null?void 0:c.quotas)||[],o=((m=r.data)==null?void 0:m.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",h=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:(h==null?void 0:h.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=C.AdvancedModeToggle;exports.DashboardControlsSettings=C.DashboardControlsSettings;exports.DashboardFilterControlsButton=C.DashboardFilterControlsButton;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.normalizeDashboardForDirtyCheck=L.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=L.serializeDashboardForDirtyCheck;exports.AlertDetailPageEmbedded=Y;exports.Combobox=H;exports.ScheduleDashboard=$;exports.TenantQuotaPage=X;exports.Visual=q;exports.useAlertBacktest=Q;exports.useExposePrintState=G;exports.usePristineSnapshotInitializer=W;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-Ze8VskG1.js"),_=require("./types/index.cjs"),M=require("./chunks/dashboard-summary-settings-dialog-DRLPzp1P.js"),t=require("react/jsx-runtime"),u=require("react"),O=require("./chunks/resource-management-panel-CcDAn86l.js"),U=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");const C=require("./chunks/dashboard-filter-controls-button-D0AsV28-.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(u);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}=u.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),m=c==null?void 0:c.find(i=>(i==null?void 0:i.id)===s),a=l==null?void 0:l.find(i=>{var h;return(h=i==null?void 0:i.cards)==null?void 0:h.find(f=>(f==null?void 0:f.id)===s)});return{card:m,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(s,r,n,o){u.useEffect(()=>{s&&!n&&r&&o(e.cloneDeep(r))},[s,n,r,o])}function H({name:s,items:r,value:n,onChange:o,isLoading:l,isError:c,refetch:m,className:a,icon:i,showNone:h=!1}){const f=R.useRef(null),[D,A]=R.useState(!1),[b,j]=R.useState("100%"),y=h?[...r||[],{id:"none",name:"None"}]:r;R.useLayoutEffect(()=>{f.current&&j(f.current.offsetWidth)},[]);function I(){var x;return l?"Loading...":c?"Error":n?(x=r==null?void 0:r.find(S=>S.id===n))==null?void 0:x.name:`Select ${s}`}function T(x,S){o(S),A(!1)}return t.jsxs(e.Popover,{open:D,onOpenChange:A,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:m,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(x=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:x.name,onSelect:S=>T(S,x.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(e.Check,{className:e.cn("size-4",n===x.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:x.name,children:x.name})]})},x.id))})]})]})})]})}function $({triggerButtonClassName:s,variant:r="ghost"}){const[n,o]=u.useState(!1),l=e.useDashboardStore(m=>{var a;return(a=m.dashboard)==null?void 0:a.id}),c=e.useDashboardStore(m=>{var a;return(a=m.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 G(s,r){u.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 K(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 Y({alertId:s,onBack:r}){var x,S,F,w;const{authToken:n,tokenProps:o}=e.useSemaphorContext(),{data:l,isLoading:c,refetch:m}=e.useAlertDetail(s),a=(l==null?void 0:l.alert)??null,[i,h]=u.useState([]),[f,D]=u.useState([]),[A,b]=u.useState(null),j=u.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=A&&N.some(B=>B.id===A)?A:((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,A,o]),y=u.useCallback(async d=>{const p=o==null?void 0:o.apiServiceUrl,g=n==null?void 0:n.accessToken,v=d??A;if(!p||!g||!s||!v){h([]);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();h(Array.isArray(N.attempts)?N.attempts:[])}else h([])}catch{h([])}},[s,n,A,o]),I=u.useCallback(async()=>{await m();const d=await j();await y(d)},[y,j,m]);u.useEffect(()=>{j().catch(()=>{})},[j]),u.useEffect(()=>{y().catch(()=>{})},[y]);const T=u.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:K(a)}),((x=a.alertState)==null?void 0:x.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===A?"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 X(){var c,m;const{quotasQuery:s,usageQuery:r}=e.useAlertQuotas(),n=((c=s.data)==null?void 0:c.quotas)||[],o=((m=r.data)==null?void 0:m.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",h=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:(h==null?void 0:h.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=C.AdvancedModeToggle;exports.DashboardControlsSettings=C.DashboardControlsSettings;exports.DashboardFilterControlsButton=C.DashboardFilterControlsButton;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.normalizeDashboardForDirtyCheck=L.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=L.serializeDashboardForDirtyCheck;exports.AlertDetailPageEmbedded=Y;exports.Combobox=H;exports.ScheduleDashboard=$;exports.TenantQuotaPage=X;exports.Visual=q;exports.useAlertBacktest=Q;exports.useExposePrintState=G;exports.usePristineSnapshotInitializer=W;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { d as j, Z as q, _ as H, $ as Q, a0 as G, a1 as K, a2 as X, a3 as Y, a4 as J, a5 as Z, u as L, a6 as O, a7 as ee, a8 as ae, P as te, k as se, B as T, b as _, a9 as re, m as ne, n as ie, o as oe, aa as W, ab as le, p as de, q as ce, r as ue, s as me, t as he, ac as pe, ad as fe, ae as be, af as E, ag as ge, ah as xe } from "./chunks/index-
|
|
2
|
-
import { aW as Le, aY as Ue, bE as ze, a_ as Be, aX as Oe, az as je, a$ as Qe, D as We, ax as Ve, as as $e, bK as qe, b3 as He, ak as Ge, an as Ke, an as Xe, ao as Ye, ay as Je, a as Ze, bJ as ea, bp as aa, bm as ta, bF as sa, ba as ra, br as na, aw as ia, at as oa, au as la, b4 as da, bN as ca, bo as ua, by as ma, bv as ha, bC as pa, bw as fa, bx as ba, bu as ga, bt as xa, bc as Na, bI as va, bH as ya, bG as Aa, bb as Ca, bf as Sa, bg as Da, b9 as Ea, av as Ta, b8 as wa, b1 as Ra, b2 as Ia, b0 as _a, bd as Pa, b7 as ka, bM as Ma, bL as Fa, b6 as La, b5 as Ua, bB as za, bn as Ba, bA as Oa, bh as ja, be as Qa, bs as Wa, bq as Va, bz as $a, bD as qa, aG as Ha, aD as Ga, aP as Ka, aN as Xa, aV as Ya, aU as Ja, aM as Za, aL as et, aK as at, aO as tt, aZ as st, aI as rt, aJ as nt, aQ as it, aS as ot, ar as lt, aR as dt, aB as ct, bj as ut, bl as mt, bk as ht, Q as pt, aq as ft, aj as bt, aA as gt, aC as xt, al as Nt, O as vt, bi as yt, W as At, aF as Ct, aE as St, aH as Dt, ai as Et, ap as Tt, aT as wt, am as Rt } from "./chunks/index-
|
|
1
|
+
import { d as j, Z as q, _ as H, $ as Q, a0 as G, a1 as K, a2 as X, a3 as Y, a4 as J, a5 as Z, u as L, a6 as O, a7 as ee, a8 as ae, P as te, k as se, B as T, b as _, a9 as re, m as ne, n as ie, o as oe, aa as W, ab as le, p as de, q as ce, r as ue, s as me, t as he, ac as pe, ad as fe, ae as be, af as E, ag as ge, ah as xe } from "./chunks/index-14M0TnH6.js";
|
|
2
|
+
import { aW as Le, aY as Ue, bE as ze, a_ as Be, aX as Oe, az as je, a$ as Qe, D as We, ax as Ve, as as $e, bK as qe, b3 as He, ak as Ge, an as Ke, an as Xe, ao as Ye, ay as Je, a as Ze, bJ as ea, bp as aa, bm as ta, bF as sa, ba as ra, br as na, aw as ia, at as oa, au as la, b4 as da, bN as ca, bo as ua, by as ma, bv as ha, bC as pa, bw as fa, bx as ba, bu as ga, bt as xa, bc as Na, bI as va, bH as ya, bG as Aa, bb as Ca, bf as Sa, bg as Da, b9 as Ea, av as Ta, b8 as wa, b1 as Ra, b2 as Ia, b0 as _a, bd as Pa, b7 as ka, bM as Ma, bL as Fa, b6 as La, b5 as Ua, bB as za, bn as Ba, bA as Oa, bh as ja, be as Qa, bs as Wa, bq as Va, bz as $a, bD as qa, aG as Ha, aD as Ga, aP as Ka, aN as Xa, aV as Ya, aU as Ja, aM as Za, aL as et, aK as at, aO as tt, aZ as st, aI as rt, aJ as nt, aQ as it, aS as ot, ar as lt, aR as dt, aB as ct, bj as ut, bl as mt, bk as ht, Q as pt, aq as ft, aj as bt, aA as gt, aC as xt, al as Nt, O as vt, bi as yt, W as At, aF as Ct, aE as St, aH as Dt, ai as Et, ap as Tt, aT as wt, am as Rt } from "./chunks/index-14M0TnH6.js";
|
|
3
3
|
import { CONTROL_CARD_DEFAULT_VALUE as _t, DEFAULT_CALENDAR_CONTEXT as Pt, DEFAULT_SEMANTIC_DOMAIN_ACCESS as kt, EMPTY_SELECTION as Mt } from "./types/index.js";
|
|
4
|
-
import { C as Lt, D as Ut } from "./chunks/dashboard-summary-settings-dialog-
|
|
4
|
+
import { C as Lt, D as Ut } from "./chunks/dashboard-summary-settings-dialog-0CIiWsKc.js";
|
|
5
5
|
import { jsx as e, jsxs as r, Fragment as Ne } from "react/jsx-runtime";
|
|
6
6
|
import * as R from "react";
|
|
7
7
|
import { useMemo as V, useEffect as k, useState as P, useCallback as F } from "react";
|
|
8
|
-
import { ResourceManagementPanel as Bt } from "./chunks/resource-management-panel-
|
|
8
|
+
import { ResourceManagementPanel as Bt } from "./chunks/resource-management-panel-BL5-5ouC.js";
|
|
9
9
|
import { u as jt } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
10
10
|
import "react-dom";
|
|
11
|
-
import { A as Wt, D as Vt, c as $t, a as qt, E as Ht, N as Gt, U as Kt, V as Xt, u as Yt, b as Jt } from "./chunks/dashboard-filter-controls-button-
|
|
11
|
+
import { A as Wt, D as Vt, c as $t, a as qt, E as Ht, N as Gt, U as Kt, V as Xt, u as Yt, b as Jt } from "./chunks/dashboard-filter-controls-button-XwenlcXw.js";
|
|
12
12
|
import { n as es, s as as } from "./chunks/normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
13
13
|
function Ee(a) {
|
|
14
14
|
const { authToken: t, tokenProps: n } = j();
|