react-semaphor 0.1.340 → 0.1.341
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/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +1 -1
- package/dist/chunks/{calendar-preferences-dialog-8-KE5sVX.js → calendar-preferences-dialog-_u4Xm011.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-2IbYrrP1.js → calendar-preferences-dialog-hS6POgEs.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CcqDPVke.js → dashboard-briefing-launcher-D18qNhwa.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DtxDRAiu.js → dashboard-briefing-launcher-DHzIiaKF.js} +3 -3
- package/dist/chunks/{dashboard-controls-By7aKmDj.js → dashboard-controls-CilLVS_Q.js} +1 -1
- package/dist/chunks/{dashboard-controls-Bi98DhYD.js → dashboard-controls-g1OcteYf.js} +3 -3
- package/dist/chunks/{dashboard-json-CGxIsTEP.js → dashboard-json-BjnGSaxC.js} +1 -1
- package/dist/chunks/{dashboard-json-BOyLuhS6.js → dashboard-json-ClH0kTga.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BuXlHmJH.js → edit-dashboard-visual-C_3NYnPz.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-Ba8LenNc.js → edit-dashboard-visual-DbVMVMKM.js} +3 -3
- package/dist/chunks/{index-DT9osgRT.js → index-BNZjkxPH.js} +3 -3
- package/dist/chunks/{index-DVPvpd8u.js → index-CuSvSh86.js} +7 -6
- package/dist/chunks/{resource-management-panel-98Hy6SYB.js → resource-management-panel-DxjN2uw4.js} +2 -2
- package/dist/chunks/{resource-management-panel-ByR-FD3h.js → resource-management-panel-N5iUOE89.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-uNxArZdj.js → use-create-flow-overlay-state-CSjc7cXZ.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-D5uvjbwY.js → use-create-flow-overlay-state-CXPnnXh1.js} +2 -2
- package/dist/chunks/{use-visual-utils-CpaqIHoc.js → use-visual-utils-C3MRLrHu.js} +1 -1
- package/dist/chunks/{use-visual-utils-BLh9mKic.js → use-visual-utils-DsoGoqPF.js} +1 -1
- package/dist/chunks/validators-Caj7EMd1.js +1 -0
- package/dist/chunks/{validators-CPEQojnV.js → validators-YtnkRA1G.js} +66 -43
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +1 -1
- package/dist/dashboard-authoring/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +1 -1
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +120 -113
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +12 -1
- package/dist/types/dashboard-authoring.d.ts +4 -0
- package/dist/types/dashboard.d.ts +2 -0
- package/dist/types/data-app-builder.d.ts +3 -0
- package/dist/types/data-app-sdk.d.ts +3 -0
- package/dist/types/main.d.ts +5 -0
- package/dist/types/shared.d.ts +1 -0
- package/dist/types/surfboard.d.ts +2 -0
- package/dist/types/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunks/validators-CfP-49k9.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../chunks/validators-Caj7EMd1.js"),K=require("../chunks/index-BxM99sFL.js"),u=require("react"),F=require("react/jsx-runtime");function x(e){var n;const t=z(e);return{version:1,kind:"metric",id:e.id,label:e.label,source:D(e),metrics:t,primaryMetric:U(e,t),dateField:e.dateField?c(e.dateField,"date"):void 0,timeGrain:e.timeGrain,dimensions:(n=e.dimensions)==null?void 0:n.map(o=>c(o,"dimension")),comparison:Q(e.comparison),inputs:k(e.inputs),limit:e.limit}}function U(e,t){if(!e.primaryMetric)return t[0]||{name:"",role:"measure"};const n=c(e.primaryMetric,"measure"),o=n.source?t.find(r=>y.semaphorFieldRefsMatch(r,n)):(()=>{const r=t.filter(i=>i.name===n.name);return r.length===1?r[0]:void 0})();return o?E(n,o):n}function z(e){const t=[];for(const n of e.metrics.map(o=>c(o,"measure"))){if(!n.name)continue;const o=t.findIndex(r=>y.semaphorFieldRefsMatch(r,n));if(o===-1){t.push(n);continue}t[o]=E(t[o],n)}return t}function E(e,t){if(e.aggregate&&t.aggregate&&e.aggregate!==t.aggregate)throw new Error(`Metric "${e.name}" was requested with conflicting aggregate semantics: ${e.aggregate} and ${t.aggregate}.`);return{...y.preferSemaphorFieldRefMetadata(e,t),aggregate:e.aggregate||t.aggregate}}function q(e){if("sort"in e)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!L(e))throw new Error("useSemaphorRecords needs at least one field.");const t=V(e.fields);return{version:1,kind:"records",id:e.id,label:e.label,source:D(e),fields:t,dateField:e.dateField?c(e.dateField,"date"):void 0,timeGrain:e.timeGrain,orderBy:e.orderBy?{field:c(e.orderBy.field),direction:e.orderBy.direction}:void 0,inputs:k(e.inputs),limit:e.limit}}function V(e){return e.map(t=>{const n=c(t);if(!n.role)throw new Error(`useSemaphorRecords field "${n.name}" needs an explicit role.`);return n})}function w(e){return{version:1,kind:"inputOptions",id:e.id,label:e.label,source:D(e),field:c(e.field,"dimension"),search:e.search,limit:e.limit}}function O(e){if("toAnalyticsInput"in e){const t=e.toAnalyticsInput();return{inputId:t.inputId,...t.field?{field:t.field}:{}}}return{inputId:e.inputId,...e.field?{field:e.field}:{}}}function j(e){const t=k(e);return t.length>0?t:void 0}function $(e){return(e||[]).map(N)}function A(e){return $(e).filter(t=>t.isActive)}function B(e){return e.kind==="filter"?{inputId:e.id,kind:e.kind,label:e.label,field:c(e.field,"dimension"),operator:e.operator||"in"}:{inputId:e.id,kind:e.kind,label:e.label}}function C(e=[]){return e.map(t=>typeof t=="object"?t:{label:String(t),value:t})}function S(e){return e==null?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e.trim().length>0:!0}function N(e){return"toAnalyticsInput"in e?e.toAnalyticsInput():"kind"in e&&"isActive"in e?e:{...e,kind:"filter",isActive:S(e.value),value:e.value}}function D(e){return e.source}function L(e){var t;return!!((t=e.fields)!=null&&t.length)}function c(e,t){return{...e,role:e.role||t}}function k(e){return(e||[]).map(O)}function Q(e){if(e)return e}function T(){return{executeMetric:(e,t)=>v(e,t),executeRecords:(e,t)=>v(e,t),executeInputOptions:(e,t)=>v(e,t)}}async function v(e,t){if(!t.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const n=await fetch(W(t),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.token}`},body:JSON.stringify({intent:e,activeInputs:t.activeInputs,resultShape:e.kind})}),o=await G(n);if(!n.ok||o.error)throw new Error(o.error||`Semaphor Data App execution failed with status ${n.status}.`);return o}async function G(e){const t=await e.text().catch(()=>"");if(!t.trim())return e.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(t)}catch{return e.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:t}:{error:J(e,t),details:t}}}function J(e,t){const n=e.statusText?` ${e.statusText}`:"",o=t.replace(/\s+/g," ").trim();return o?`Semaphor Data App execution failed with status ${e.status}${n}: ${o.slice(0,240)}`:`Semaphor Data App execution failed with status ${e.status}${n}.`}function W(e){const t=H(e).replace(/\/+$/,"");return t?t.endsWith("/api")?`${t}/v1/data-app/execute`:`${t}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function H(e){if(e.apiBaseUrl)return e.apiBaseUrl;if(!e.token)return"";try{return K.jwtDecode(e.token).apiServiceUrl||""}catch{return""}}const R=u.createContext({});function P(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function _(){return u.useContext(R)}function X({token:e,apiBaseUrl:t,executor:n,children:o}){var l;const r=P(),i=((l=r==null?void 0:r.authToken)==null?void 0:l.accessToken)||e,a=(r==null?void 0:r.dataApiBaseUrl)||(r==null?void 0:r.apiBaseUrl)||t,m=u.useMemo(()=>T(),[]),s=n||m,p=u.useMemo(()=>({token:i,apiBaseUrl:a,executor:s}),[a,s,i]);return F.jsx(R.Provider,{value:p,children:o})}const g={value:null},Y={records:[]},I={options:[]};function Z(e){const t=A(e.inputs);try{const n=x(e),o=M(n);return o?{error:o,activeInputs:t,queryKey:d(void 0,t,o),idleData:g}:{intent:n,error:null,activeInputs:t,queryKey:d(n,t),idleData:g}}catch(n){const o=h(n);return{error:o,activeInputs:t,queryKey:d(void 0,t,o),idleData:g}}}function ee(e){const t=A(e.inputs),n=Y;try{const o=q(e),r=M(o);return r?{error:r,activeInputs:t,queryKey:d(void 0,t,r),idleData:n}:{intent:o,error:null,activeInputs:t,queryKey:d(o,t),idleData:n}}catch(o){const r=h(o);return{error:r,activeInputs:t,queryKey:d(void 0,t,r),idleData:n}}}function te(e){try{const t=w(e),n=M(t);return n?{error:n,queryKey:d(void 0,void 0,n),idleData:I}:{intent:t,error:null,queryKey:d(t),idleData:I}}catch(t){const n=h(t);return{error:n,queryKey:d(void 0,void 0,n),idleData:I}}}function h(e){return e instanceof Error?e:new Error(String(e))}function M(e){const t=y.validateSemaphorAnalyticsIntent(e);if(t.ok)return null;const n=t.errors.map(o=>o.path?`${o.code} at ${o.path}: ${o.message}`:`${o.code}: ${o.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${n}`)}function d(e,t,n){return JSON.stringify({intent:e,activeInputs:t,error:n==null?void 0:n.message})}function re(e){const[t,n]=u.useState(e.defaultValue),o=Object.prototype.hasOwnProperty.call(e,"value"),r=o?e.value:t,i=u.useMemo(()=>C(e.options),[e.options]),a=u.useCallback(s=>{var l;const p=s;(l=e.onValueChange)==null||l.call(e,p),o||n(p)},[o,e]),m=u.useCallback(()=>a(void 0),[a]);return u.useMemo(()=>{const s=B(e);return{id:e.id,kind:e.kind,label:e.label,field:s.field,operator:s.operator,controlRole:e.kind==="control"?e.role:void 0,value:r,options:i,isActive:S(r),setValue:a,clear:m,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:e.kind,label:e.label,value:r,isActive:S(r),operator:s.operator,controlRole:e.kind==="control"?e.role:void 0})}},[m,i,a,e,r])}function ne(e){const t=u.useMemo(()=>Z(e),[e]),n=u.useCallback(i=>{var a;return t.intent?(a=i.executor)==null?void 0:a.executeMetric(t.intent,i):void 0},[t.intent]),o=b(t.queryKey,n,t.idleData,t.activeInputs),r=t.error?t.idleData:o.data;return{id:e.id,intent:t.intent,value:(r==null?void 0:r.value)??null,metrics:r==null?void 0:r.metrics,comparisonValue:r==null?void 0:r.comparisonValue,delta:r==null?void 0:r.delta,deltaPercent:r==null?void 0:r.deltaPercent,records:r==null?void 0:r.records,status:t.error?"error":o.status,isLoading:!t.error&&o.status==="loading",error:t.error||o.error}}function oe(e){const t=u.useMemo(()=>ee(e),[e]),n=u.useCallback(i=>{var a;return t.intent?(a=i.executor)==null?void 0:a.executeRecords(t.intent,i):void 0},[t.intent]),o=b(t.queryKey,n,t.idleData,t.activeInputs),r=t.error?t.idleData:o.data;return{id:e.id,intent:t.intent,records:(r==null?void 0:r.records)||[],columns:r==null?void 0:r.columns,rowCount:r==null?void 0:r.rowCount,status:t.error?"error":o.status,isLoading:!t.error&&o.status==="loading",error:t.error||o.error}}function ie(e){const t=u.useMemo(()=>te(e),[e]),n=u.useCallback(i=>{var a;return t.intent?(a=i.executor)==null?void 0:a.executeInputOptions(t.intent,i):void 0},[t.intent]),o=b(t.queryKey,n,t.idleData),r=t.error?t.idleData:o.data;return{id:e.id,intent:t.intent,options:(r==null?void 0:r.options)||[],status:t.error?"error":o.status,isLoading:!t.error&&o.status==="loading",error:t.error||o.error}}function b(e,t,n,o){const r=_(),i=u.useRef(t),a=u.useRef(o),[m,s]=u.useState({status:"idle",data:n,error:null});return i.current=t,a.current=o,u.useEffect(()=>{let p;try{p=i.current({...r,activeInputs:a.current})}catch(f){s({status:"error",data:n,error:h(f)});return}if(!p){s({status:"idle",data:n,error:null});return}let l=!1;return s(f=>({status:"loading",data:f.data,error:null})),p.then(f=>{l||s({status:"success",data:f,error:null})}).catch(f=>{l||s({status:"error",data:n,error:h(f)})}),()=>{l=!0}},[n,e,r]),m}exports.SemaphorDataAppContext=R;exports.SemaphorDataAppProvider=X;exports.createSemaphorDataAppExecutor=T;exports.hasSemaphorInputValue=S;exports.normalizeSemaphorInputOptions=C;exports.readWindowRuntime=P;exports.toSemaphorActiveInputSnapshots=A;exports.toSemaphorInputBinding=O;exports.toSemaphorInputBindings=j;exports.toSemaphorInputOptionsIntent=w;exports.toSemaphorInputSnapshots=$;exports.toSemaphorInputSpec=B;exports.toSemaphorMetricIntent=x;exports.toSemaphorRecordsIntent=q;exports.useSemaphorDataAppRuntime=_;exports.useSemaphorInput=re;exports.useSemaphorInputOptions=ie;exports.useSemaphorMetric=ne;exports.useSemaphorRecords=oe;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { e as b, f as
|
|
2
|
-
import { j as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { jsx as
|
|
5
|
-
function
|
|
1
|
+
import { e as b, f as q, v as O } from "../chunks/validators-YtnkRA1G.js";
|
|
2
|
+
import { j as B } from "../chunks/index-CuHybtft.js";
|
|
3
|
+
import { createContext as T, useContext as _, useMemo as p, useState as R, useCallback as h, useRef as x, useEffect as K } from "react";
|
|
4
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
5
|
+
function C(t) {
|
|
6
6
|
var n;
|
|
7
|
-
const e =
|
|
7
|
+
const e = F(t);
|
|
8
8
|
return {
|
|
9
9
|
version: 1,
|
|
10
10
|
kind: "metric",
|
|
11
11
|
id: t.id,
|
|
12
12
|
label: t.label,
|
|
13
|
-
source:
|
|
13
|
+
source: A(t),
|
|
14
14
|
metrics: e,
|
|
15
|
-
primaryMetric:
|
|
15
|
+
primaryMetric: U(t, e),
|
|
16
16
|
dateField: t.dateField ? d(t.dateField, "date") : void 0,
|
|
17
17
|
timeGrain: t.timeGrain,
|
|
18
18
|
dimensions: (n = t.dimensions) == null ? void 0 : n.map((o) => d(o, "dimension")),
|
|
19
|
-
comparison:
|
|
20
|
-
inputs:
|
|
19
|
+
comparison: W(t.comparison),
|
|
20
|
+
inputs: D(t.inputs),
|
|
21
21
|
limit: t.limit
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function U(t, e) {
|
|
25
25
|
if (!t.primaryMetric)
|
|
26
26
|
return e[0] || { name: "", role: "measure" };
|
|
27
27
|
const n = d(t.primaryMetric, "measure"), o = n.source ? e.find((r) => b(r, n)) : (() => {
|
|
@@ -30,9 +30,9 @@ function C(t, e) {
|
|
|
30
30
|
);
|
|
31
31
|
return r.length === 1 ? r[0] : void 0;
|
|
32
32
|
})();
|
|
33
|
-
return o ?
|
|
33
|
+
return o ? M(n, o) : n;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function F(t) {
|
|
36
36
|
const e = [];
|
|
37
37
|
for (const n of t.metrics.map((o) => d(o, "measure"))) {
|
|
38
38
|
if (!n.name)
|
|
@@ -44,29 +44,36 @@ function U(t) {
|
|
|
44
44
|
e.push(n);
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
e[o] =
|
|
48
|
-
e[o],
|
|
49
|
-
n
|
|
50
|
-
);
|
|
47
|
+
e[o] = M(e[o], n);
|
|
51
48
|
}
|
|
52
49
|
return e;
|
|
53
50
|
}
|
|
54
|
-
function
|
|
51
|
+
function M(t, e) {
|
|
52
|
+
if (t.aggregate && e.aggregate && t.aggregate !== e.aggregate)
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Metric "${t.name}" was requested with conflicting aggregate semantics: ${t.aggregate} and ${e.aggregate}.`
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
...q(t, e),
|
|
58
|
+
aggregate: t.aggregate || e.aggregate
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function z(t) {
|
|
55
62
|
if ("sort" in t)
|
|
56
63
|
throw new Error(
|
|
57
64
|
"useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet."
|
|
58
65
|
);
|
|
59
|
-
if (!
|
|
66
|
+
if (!H(t))
|
|
60
67
|
throw new Error(
|
|
61
68
|
"useSemaphorRecords needs at least one field."
|
|
62
69
|
);
|
|
63
|
-
const e =
|
|
70
|
+
const e = V(t.fields);
|
|
64
71
|
return {
|
|
65
72
|
version: 1,
|
|
66
73
|
kind: "records",
|
|
67
74
|
id: t.id,
|
|
68
75
|
label: t.label,
|
|
69
|
-
source:
|
|
76
|
+
source: A(t),
|
|
70
77
|
fields: e,
|
|
71
78
|
dateField: t.dateField ? d(t.dateField, "date") : void 0,
|
|
72
79
|
timeGrain: t.timeGrain,
|
|
@@ -74,11 +81,11 @@ function F(t) {
|
|
|
74
81
|
field: d(t.orderBy.field),
|
|
75
82
|
direction: t.orderBy.direction
|
|
76
83
|
} : void 0,
|
|
77
|
-
inputs:
|
|
84
|
+
inputs: D(t.inputs),
|
|
78
85
|
limit: t.limit
|
|
79
86
|
};
|
|
80
87
|
}
|
|
81
|
-
function
|
|
88
|
+
function V(t) {
|
|
82
89
|
return t.map((e) => {
|
|
83
90
|
const n = d(e);
|
|
84
91
|
if (!n.role)
|
|
@@ -88,19 +95,19 @@ function z(t) {
|
|
|
88
95
|
return n;
|
|
89
96
|
});
|
|
90
97
|
}
|
|
91
|
-
function
|
|
98
|
+
function j(t) {
|
|
92
99
|
return {
|
|
93
100
|
version: 1,
|
|
94
101
|
kind: "inputOptions",
|
|
95
102
|
id: t.id,
|
|
96
103
|
label: t.label,
|
|
97
|
-
source:
|
|
104
|
+
source: A(t),
|
|
98
105
|
field: d(t.field, "dimension"),
|
|
99
106
|
search: t.search,
|
|
100
107
|
limit: t.limit
|
|
101
108
|
};
|
|
102
109
|
}
|
|
103
|
-
function
|
|
110
|
+
function N(t) {
|
|
104
111
|
if ("toAnalyticsInput" in t) {
|
|
105
112
|
const e = t.toAnalyticsInput();
|
|
106
113
|
return {
|
|
@@ -113,17 +120,17 @@ function j(t) {
|
|
|
113
120
|
...t.field ? { field: t.field } : {}
|
|
114
121
|
};
|
|
115
122
|
}
|
|
116
|
-
function
|
|
117
|
-
const e =
|
|
123
|
+
function ft(t) {
|
|
124
|
+
const e = D(t);
|
|
118
125
|
return e.length > 0 ? e : void 0;
|
|
119
126
|
}
|
|
120
|
-
function
|
|
121
|
-
return (t || []).map(
|
|
127
|
+
function L(t) {
|
|
128
|
+
return (t || []).map(J);
|
|
122
129
|
}
|
|
123
|
-
function
|
|
124
|
-
return
|
|
130
|
+
function w(t) {
|
|
131
|
+
return L(t).filter((e) => e.isActive);
|
|
125
132
|
}
|
|
126
|
-
function
|
|
133
|
+
function Q(t) {
|
|
127
134
|
return t.kind === "filter" ? {
|
|
128
135
|
inputId: t.id,
|
|
129
136
|
kind: t.kind,
|
|
@@ -136,7 +143,7 @@ function L(t) {
|
|
|
136
143
|
label: t.label
|
|
137
144
|
};
|
|
138
145
|
}
|
|
139
|
-
function
|
|
146
|
+
function G(t = []) {
|
|
140
147
|
return t.map(
|
|
141
148
|
(e) => typeof e == "object" ? e : {
|
|
142
149
|
label: String(e),
|
|
@@ -144,23 +151,23 @@ function Q(t = []) {
|
|
|
144
151
|
}
|
|
145
152
|
);
|
|
146
153
|
}
|
|
147
|
-
function
|
|
154
|
+
function I(t) {
|
|
148
155
|
return t == null ? !1 : Array.isArray(t) ? t.length > 0 : typeof t == "string" ? t.trim().length > 0 : !0;
|
|
149
156
|
}
|
|
150
|
-
function
|
|
157
|
+
function J(t) {
|
|
151
158
|
return "toAnalyticsInput" in t ? t.toAnalyticsInput() : "kind" in t && "isActive" in t ? t : {
|
|
152
159
|
...t,
|
|
153
160
|
kind: "filter",
|
|
154
|
-
isActive:
|
|
161
|
+
isActive: I(
|
|
155
162
|
t.value
|
|
156
163
|
),
|
|
157
164
|
value: t.value
|
|
158
165
|
};
|
|
159
166
|
}
|
|
160
|
-
function
|
|
167
|
+
function A(t) {
|
|
161
168
|
return t.source;
|
|
162
169
|
}
|
|
163
|
-
function
|
|
170
|
+
function H(t) {
|
|
164
171
|
var e;
|
|
165
172
|
return !!((e = t.fields) != null && e.length);
|
|
166
173
|
}
|
|
@@ -170,14 +177,14 @@ function d(t, e) {
|
|
|
170
177
|
role: t.role || e
|
|
171
178
|
};
|
|
172
179
|
}
|
|
173
|
-
function
|
|
174
|
-
return (t || []).map(
|
|
180
|
+
function D(t) {
|
|
181
|
+
return (t || []).map(N);
|
|
175
182
|
}
|
|
176
|
-
function
|
|
183
|
+
function W(t) {
|
|
177
184
|
if (t)
|
|
178
185
|
return t;
|
|
179
186
|
}
|
|
180
|
-
function
|
|
187
|
+
function X() {
|
|
181
188
|
return {
|
|
182
189
|
executeMetric: (t, e) => v(t, e),
|
|
183
190
|
executeRecords: (t, e) => v(t, e),
|
|
@@ -187,7 +194,7 @@ function W() {
|
|
|
187
194
|
async function v(t, e) {
|
|
188
195
|
if (!e.token)
|
|
189
196
|
throw new Error("SemaphorDataAppProvider needs a token to execute queries.");
|
|
190
|
-
const n = await fetch(
|
|
197
|
+
const n = await fetch(tt(e), {
|
|
191
198
|
method: "POST",
|
|
192
199
|
headers: {
|
|
193
200
|
"Content-Type": "application/json",
|
|
@@ -198,14 +205,14 @@ async function v(t, e) {
|
|
|
198
205
|
activeInputs: e.activeInputs,
|
|
199
206
|
resultShape: t.kind
|
|
200
207
|
})
|
|
201
|
-
}), o = await
|
|
208
|
+
}), o = await Y(n);
|
|
202
209
|
if (!n.ok || o.error)
|
|
203
210
|
throw new Error(
|
|
204
211
|
o.error || `Semaphor Data App execution failed with status ${n.status}.`
|
|
205
212
|
);
|
|
206
213
|
return o;
|
|
207
214
|
}
|
|
208
|
-
async function
|
|
215
|
+
async function Y(t) {
|
|
209
216
|
const e = await t.text().catch(() => "");
|
|
210
217
|
if (!e.trim())
|
|
211
218
|
return t.ok ? {
|
|
@@ -218,46 +225,46 @@ async function X(t) {
|
|
|
218
225
|
error: "Semaphor Data App execution returned invalid JSON.",
|
|
219
226
|
details: e
|
|
220
227
|
} : {
|
|
221
|
-
error:
|
|
228
|
+
error: Z(t, e),
|
|
222
229
|
details: e
|
|
223
230
|
};
|
|
224
231
|
}
|
|
225
232
|
}
|
|
226
|
-
function
|
|
233
|
+
function Z(t, e) {
|
|
227
234
|
const n = t.statusText ? ` ${t.statusText}` : "", o = e.replace(/\s+/g, " ").trim();
|
|
228
235
|
return o ? `Semaphor Data App execution failed with status ${t.status}${n}: ${o.slice(0, 240)}` : `Semaphor Data App execution failed with status ${t.status}${n}.`;
|
|
229
236
|
}
|
|
230
|
-
function
|
|
231
|
-
const e =
|
|
237
|
+
function tt(t) {
|
|
238
|
+
const e = et(t).replace(/\/+$/, "");
|
|
232
239
|
return e ? e.endsWith("/api") ? `${e}/v1/data-app/execute` : `${e}/api/v1/data-app/execute` : "/api/v1/data-app/execute";
|
|
233
240
|
}
|
|
234
|
-
function
|
|
241
|
+
function et(t) {
|
|
235
242
|
if (t.apiBaseUrl)
|
|
236
243
|
return t.apiBaseUrl;
|
|
237
244
|
if (!t.token)
|
|
238
245
|
return "";
|
|
239
246
|
try {
|
|
240
|
-
return
|
|
247
|
+
return B(t.token).apiServiceUrl || "";
|
|
241
248
|
} catch {
|
|
242
249
|
return "";
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
|
-
const
|
|
246
|
-
function
|
|
252
|
+
const $ = T({});
|
|
253
|
+
function rt() {
|
|
247
254
|
if (!(typeof window > "u"))
|
|
248
255
|
return window.__SEMAPHOR_DATA_APP_RUNTIME__;
|
|
249
256
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
257
|
+
function nt() {
|
|
258
|
+
return _($);
|
|
252
259
|
}
|
|
253
|
-
function
|
|
260
|
+
function pt({
|
|
254
261
|
token: t,
|
|
255
262
|
apiBaseUrl: e,
|
|
256
263
|
executor: n,
|
|
257
264
|
children: o
|
|
258
265
|
}) {
|
|
259
266
|
var s;
|
|
260
|
-
const r =
|
|
267
|
+
const r = rt(), i = ((s = r == null ? void 0 : r.authToken) == null ? void 0 : s.accessToken) || t, a = (r == null ? void 0 : r.dataApiBaseUrl) || (r == null ? void 0 : r.apiBaseUrl) || e, m = p(() => X(), []), u = n || m, c = p(
|
|
261
268
|
() => ({
|
|
262
269
|
token: i,
|
|
263
270
|
apiBaseUrl: a,
|
|
@@ -265,24 +272,24 @@ function ft({
|
|
|
265
272
|
}),
|
|
266
273
|
[a, u, i]
|
|
267
274
|
);
|
|
268
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ P($.Provider, { value: c, children: o });
|
|
269
276
|
}
|
|
270
|
-
const
|
|
271
|
-
function
|
|
272
|
-
const e =
|
|
277
|
+
const g = { value: null }, ot = { records: [] }, S = { options: [] };
|
|
278
|
+
function it(t) {
|
|
279
|
+
const e = w(t.inputs);
|
|
273
280
|
try {
|
|
274
|
-
const n =
|
|
281
|
+
const n = C(t), o = k(n);
|
|
275
282
|
return o ? {
|
|
276
283
|
error: o,
|
|
277
284
|
activeInputs: e,
|
|
278
285
|
queryKey: l(void 0, e, o),
|
|
279
|
-
idleData:
|
|
286
|
+
idleData: g
|
|
280
287
|
} : {
|
|
281
288
|
intent: n,
|
|
282
289
|
error: null,
|
|
283
290
|
activeInputs: e,
|
|
284
291
|
queryKey: l(n, e),
|
|
285
|
-
idleData:
|
|
292
|
+
idleData: g
|
|
286
293
|
};
|
|
287
294
|
} catch (n) {
|
|
288
295
|
const o = y(n);
|
|
@@ -290,14 +297,14 @@ function ot(t) {
|
|
|
290
297
|
error: o,
|
|
291
298
|
activeInputs: e,
|
|
292
299
|
queryKey: l(void 0, e, o),
|
|
293
|
-
idleData:
|
|
300
|
+
idleData: g
|
|
294
301
|
};
|
|
295
302
|
}
|
|
296
303
|
}
|
|
297
|
-
function
|
|
298
|
-
const e =
|
|
304
|
+
function at(t) {
|
|
305
|
+
const e = w(t.inputs), n = ot;
|
|
299
306
|
try {
|
|
300
|
-
const o =
|
|
307
|
+
const o = z(t), r = k(o);
|
|
301
308
|
return r ? {
|
|
302
309
|
error: r,
|
|
303
310
|
activeInputs: e,
|
|
@@ -320,33 +327,33 @@ function it(t) {
|
|
|
320
327
|
};
|
|
321
328
|
}
|
|
322
329
|
}
|
|
323
|
-
function
|
|
330
|
+
function ut(t) {
|
|
324
331
|
try {
|
|
325
|
-
const e =
|
|
332
|
+
const e = j(t), n = k(e);
|
|
326
333
|
return n ? {
|
|
327
334
|
error: n,
|
|
328
335
|
queryKey: l(void 0, void 0, n),
|
|
329
|
-
idleData:
|
|
336
|
+
idleData: S
|
|
330
337
|
} : {
|
|
331
338
|
intent: e,
|
|
332
339
|
error: null,
|
|
333
340
|
queryKey: l(e),
|
|
334
|
-
idleData:
|
|
341
|
+
idleData: S
|
|
335
342
|
};
|
|
336
343
|
} catch (e) {
|
|
337
344
|
const n = y(e);
|
|
338
345
|
return {
|
|
339
346
|
error: n,
|
|
340
347
|
queryKey: l(void 0, void 0, n),
|
|
341
|
-
idleData:
|
|
348
|
+
idleData: S
|
|
342
349
|
};
|
|
343
350
|
}
|
|
344
351
|
}
|
|
345
352
|
function y(t) {
|
|
346
353
|
return t instanceof Error ? t : new Error(String(t));
|
|
347
354
|
}
|
|
348
|
-
function
|
|
349
|
-
const e =
|
|
355
|
+
function k(t) {
|
|
356
|
+
const e = O(t);
|
|
350
357
|
if (e.ok)
|
|
351
358
|
return null;
|
|
352
359
|
const n = e.errors.map(
|
|
@@ -361,9 +368,9 @@ function l(t, e, n) {
|
|
|
361
368
|
error: n == null ? void 0 : n.message
|
|
362
369
|
});
|
|
363
370
|
}
|
|
364
|
-
function
|
|
365
|
-
const [e, n] =
|
|
366
|
-
() =>
|
|
371
|
+
function mt(t) {
|
|
372
|
+
const [e, n] = R(t.defaultValue), o = Object.prototype.hasOwnProperty.call(t, "value"), r = o ? t.value : e, i = p(
|
|
373
|
+
() => G(t.options),
|
|
367
374
|
[t.options]
|
|
368
375
|
), a = h(
|
|
369
376
|
(u) => {
|
|
@@ -374,7 +381,7 @@ function pt(t) {
|
|
|
374
381
|
[o, t]
|
|
375
382
|
), m = h(() => a(void 0), [a]);
|
|
376
383
|
return p(() => {
|
|
377
|
-
const u =
|
|
384
|
+
const u = Q(t);
|
|
378
385
|
return {
|
|
379
386
|
id: t.id,
|
|
380
387
|
kind: t.kind,
|
|
@@ -384,7 +391,7 @@ function pt(t) {
|
|
|
384
391
|
controlRole: t.kind === "control" ? t.role : void 0,
|
|
385
392
|
value: r,
|
|
386
393
|
options: i,
|
|
387
|
-
isActive:
|
|
394
|
+
isActive: I(r),
|
|
388
395
|
setValue: a,
|
|
389
396
|
clear: m,
|
|
390
397
|
toAnalyticsInput: () => ({
|
|
@@ -393,21 +400,21 @@ function pt(t) {
|
|
|
393
400
|
kind: t.kind,
|
|
394
401
|
label: t.label,
|
|
395
402
|
value: r,
|
|
396
|
-
isActive:
|
|
403
|
+
isActive: I(r),
|
|
397
404
|
operator: u.operator,
|
|
398
405
|
controlRole: t.kind === "control" ? t.role : void 0
|
|
399
406
|
})
|
|
400
407
|
};
|
|
401
408
|
}, [m, i, a, t, r]);
|
|
402
409
|
}
|
|
403
|
-
function
|
|
404
|
-
const e = p(() =>
|
|
410
|
+
function ht(t) {
|
|
411
|
+
const e = p(() => it(t), [t]), n = h(
|
|
405
412
|
(i) => {
|
|
406
413
|
var a;
|
|
407
414
|
return e.intent ? (a = i.executor) == null ? void 0 : a.executeMetric(e.intent, i) : void 0;
|
|
408
415
|
},
|
|
409
416
|
[e.intent]
|
|
410
|
-
), o =
|
|
417
|
+
), o = E(
|
|
411
418
|
e.queryKey,
|
|
412
419
|
n,
|
|
413
420
|
e.idleData,
|
|
@@ -427,14 +434,14 @@ function mt(t) {
|
|
|
427
434
|
error: e.error || o.error
|
|
428
435
|
};
|
|
429
436
|
}
|
|
430
|
-
function
|
|
431
|
-
const e = p(() =>
|
|
437
|
+
function yt(t) {
|
|
438
|
+
const e = p(() => at(t), [t]), n = h(
|
|
432
439
|
(i) => {
|
|
433
440
|
var a;
|
|
434
441
|
return e.intent ? (a = i.executor) == null ? void 0 : a.executeRecords(e.intent, i) : void 0;
|
|
435
442
|
},
|
|
436
443
|
[e.intent]
|
|
437
|
-
), o =
|
|
444
|
+
), o = E(
|
|
438
445
|
e.queryKey,
|
|
439
446
|
n,
|
|
440
447
|
e.idleData,
|
|
@@ -451,14 +458,14 @@ function ht(t) {
|
|
|
451
458
|
error: e.error || o.error
|
|
452
459
|
};
|
|
453
460
|
}
|
|
454
|
-
function
|
|
455
|
-
const e = p(() =>
|
|
461
|
+
function vt(t) {
|
|
462
|
+
const e = p(() => ut(t), [t]), n = h(
|
|
456
463
|
(i) => {
|
|
457
464
|
var a;
|
|
458
465
|
return e.intent ? (a = i.executor) == null ? void 0 : a.executeInputOptions(e.intent, i) : void 0;
|
|
459
466
|
},
|
|
460
467
|
[e.intent]
|
|
461
|
-
), o =
|
|
468
|
+
), o = E(
|
|
462
469
|
e.queryKey,
|
|
463
470
|
n,
|
|
464
471
|
e.idleData
|
|
@@ -472,13 +479,13 @@ function yt(t) {
|
|
|
472
479
|
error: e.error || o.error
|
|
473
480
|
};
|
|
474
481
|
}
|
|
475
|
-
function
|
|
476
|
-
const r =
|
|
482
|
+
function E(t, e, n, o) {
|
|
483
|
+
const r = nt(), i = x(e), a = x(o), [m, u] = R({
|
|
477
484
|
status: "idle",
|
|
478
485
|
data: n,
|
|
479
486
|
error: null
|
|
480
487
|
});
|
|
481
|
-
return i.current = e, a.current = o,
|
|
488
|
+
return i.current = e, a.current = o, K(() => {
|
|
482
489
|
let c;
|
|
483
490
|
try {
|
|
484
491
|
c = i.current({
|
|
@@ -516,23 +523,23 @@ function g(t, e, n, o) {
|
|
|
516
523
|
}, [n, t, r]), m;
|
|
517
524
|
}
|
|
518
525
|
export {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
526
|
+
$ as SemaphorDataAppContext,
|
|
527
|
+
pt as SemaphorDataAppProvider,
|
|
528
|
+
X as createSemaphorDataAppExecutor,
|
|
529
|
+
I as hasSemaphorInputValue,
|
|
530
|
+
G as normalizeSemaphorInputOptions,
|
|
531
|
+
rt as readWindowRuntime,
|
|
532
|
+
w as toSemaphorActiveInputSnapshots,
|
|
533
|
+
N as toSemaphorInputBinding,
|
|
534
|
+
ft as toSemaphorInputBindings,
|
|
535
|
+
j as toSemaphorInputOptionsIntent,
|
|
536
|
+
L as toSemaphorInputSnapshots,
|
|
537
|
+
Q as toSemaphorInputSpec,
|
|
538
|
+
C as toSemaphorMetricIntent,
|
|
539
|
+
z as toSemaphorRecordsIntent,
|
|
540
|
+
nt as useSemaphorDataAppRuntime,
|
|
541
|
+
mt as useSemaphorInput,
|
|
542
|
+
vt as useSemaphorInputOptions,
|
|
543
|
+
ht as useSemaphorMetric,
|
|
544
|
+
yt as useSemaphorRecords
|
|
538
545
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DT9osgRT.js"),d=require("./chunks/common-types-C73-Ud1-.js"),P=require("./chunks/calendar-preferences-dialog-8-KE5sVX.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-DYRgERrC.js"),C=require("react"),N=require("./chunks/resource-management-panel-ByR-FD3h.js"),y=require("./types/index.cjs"),_=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const r=require("./chunks/dashboard-briefing-launcher-CcqDPVke.js"),S=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");require("./chunks/index-BxM99sFL.js");function R(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const n in o)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(o,n);Object.defineProperty(i,n,u.get?u:{enumerable:!0,get:()=>o[n]})}}return i.default=o,Object.freeze(i)}const h=R(C);function j(o){const{displayPreferences:i,cardId:n,...u}=o,s={...u,id:o.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:o.cardId}),t.jsx(e.UXProvider,{appearance:o.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:i,children:t.jsx(e.Container,{type:"visual",cardId:n,...s,children:t.jsx(w,{cardId:n})})})})]})})}function w({cardId:o}){const i=a.useDashboardStore(s=>{var c;return(c=s.dashboard)==null?void 0:c.sheets}),{card:n,frame:u}=C.useMemo(()=>{const s=i==null?void 0:i.flatMap(l=>l.frames),c=s==null?void 0:s.flatMap(l=>l==null?void 0:l.cards),D=c==null?void 0:c.find(l=>(l==null?void 0:l.id)===o),E=s==null?void 0:s.find(l=>{var p;return(p=l==null?void 0:l.cards)==null?void 0:p.find(g=>(g==null?void 0:g.id)===o)});return{card:D,frame:E}},[i,o]);return!n||!u?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${o}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:u})})})}function M(o,i,n,u){C.useEffect(()=>{o&&!n&&i&&u(e.cloneDeep(i))},[o,n,i,u])}function L({name:o,items:i,value:n,onChange:u,isLoading:s,isError:c,refetch:D,className:E,icon:l,showNone:p=!1}){const g=h.useRef(null),[b,T]=h.useState(!1),[B,A]=h.useState("100%"),x=p?[...i||[],{id:"none",name:"None"}]:i;h.useLayoutEffect(()=>{g.current&&A(g.current.offsetWidth)},[]);function F(){var f;return s?"Loading...":c?"Error":n?(f=i==null?void 0:i.find(m=>m.id===n))==null?void 0:f.name:`Select ${o}`}function v(f,m){u(m),T(!1)}return t.jsxs(a.Popover,{open:b,onOpenChange:T,children:[t.jsx(a.PopoverTrigger,{asChild:!0,children:t.jsxs(a.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:a.cn("flex h-9 w-full justify-between",E),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[l&&t.jsx("div",{className:"mr-2",children:l}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:F()})]}),t.jsx(a.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(a.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:D,children:t.jsx(e.RefreshCw,{className:a.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",o==null?void 0:o.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:m=>v(m,f.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(a.Check,{className:a.cn("size-4",n===f.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function I(o,i){C.useEffect(()=>(o&&i&&(window.__SEMAPHOR_PRINT_STATE__={...i}),()=>{o&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[o,i])}exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;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.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createExport=e.createExport;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.CalendarPreferencesDialog=P.CalendarPreferencesDialog;exports.createEmptyKpiConfig=a.createEmptyKpiConfig;exports.createSqlGenConfig=a.createSqlGenConfig;exports.emitDashboardLoad=a.emitDashboardLoad;exports.emitDashboardUnload=a.emitDashboardUnload;exports.fmt=a.fmt;exports.getColumnDataType=a.getColumnDataType;exports.getFilterValueType=a.getFilterValueType;exports.getFormattedTableNameForQuery=a.getFormattedTableNameForQuery;exports.getQualifiedTableName=a.getQualifiedTableName;exports.getSql=a.getSql;exports.invalidateToken=a.invalidateToken;exports.isBooleanDataType=a.isBooleanDataType;exports.isColumnInSqlGen=a.isColumnInSqlGen;exports.isDateDataType=a.isDateDataType;exports.isNumberDataType=a.isNumberDataType;exports.isTextDataType=a.isTextDataType;exports.resolveDataType=a.resolveDataType;exports.resolveDatamodelName=a.resolveDatamodelName;exports.useCurrentActiveCard=a.useCurrentActiveCard;exports.useCurrentCardConfig=a.useCurrentCardConfig;exports.useCurrentSheetActiveCards=a.useCurrentSheetActiveCards;exports.useDashboardActions=a.useDashboardActions;exports.useDashboardStore=a.useDashboardStore;exports.useEditorActions=a.useEditorActions;exports.useEditorStore=a.useEditorStore;exports.ResourceManagementPanel=N.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=y.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=y.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.useDebouncedDirtyCheck=_.useDebouncedDirtyCheck;exports.AdvancedModeToggle=r.AdvancedModeToggle;exports.BriefingAuthor=r.BriefingAuthor;exports.BriefingsApiError=r.BriefingsApiError;exports.DashboardBriefingLauncher=r.DashboardBriefingLauncher;exports.DashboardControlsSettings=r.DashboardControlsSettings;exports.DashboardFilterControlsButton=r.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=r.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=r.DocumentControlsSettings;exports.ExportNotificationItem=r.ExportNotificationItem;exports.ExportNotificationList=r.ExportNotificationList;exports.NotificationBell=r.NotificationBell;exports.UnsavedChangesAlert=r.UnsavedChangesAlert;exports.VisualEditingControls=r.VisualEditingControls;exports.WatchDashboardButton=r.WatchDashboardButton;exports.applyBriefingFormPatch=r.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=r.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=r.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=r.briefingToFormDraft;exports.cancelBriefingRun=r.cancelBriefingRun;exports.createBriefing=r.createBriefing;exports.createBriefingFormDraft=r.createBriefingFormDraft;exports.deleteBriefing=r.deleteBriefing;exports.deleteBriefingRun=r.deleteBriefingRun;exports.getBriefing=r.getBriefing;exports.getBriefingArtifact=r.getBriefingArtifact;exports.getBriefingEvidence=r.getBriefingEvidence;exports.getBriefingPreviewRun=r.getBriefingPreviewRun;exports.getBriefingRun=r.getBriefingRun;exports.listBriefingRuns=r.listBriefingRuns;exports.listBriefingTenantSummaries=r.listBriefingTenantSummaries;exports.listBriefings=r.listBriefings;exports.pauseBriefing=r.pauseBriefing;exports.polishBriefingText=r.polishBriefingText;exports.previewBriefingPlan=r.previewBriefingPlan;exports.resumeBriefing=r.resumeBriefing;exports.runBriefingNow=r.runBriefingNow;exports.runBriefingPreview=r.runBriefingPreview;exports.updateBriefing=r.updateBriefing;exports.useExportPolling=r.useExportPolling;exports.useExportRecovery=r.useExportRecovery;exports.validateBriefingFormDraft=r.validateBriefingFormDraft;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=L;exports.Visual=j;exports.useExposePrintState=I;exports.usePristineSnapshotInitializer=M;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-BNZjkxPH.js"),d=require("./chunks/common-types-C73-Ud1-.js"),P=require("./chunks/calendar-preferences-dialog-_u4Xm011.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-DYRgERrC.js"),C=require("react"),N=require("./chunks/resource-management-panel-N5iUOE89.js"),y=require("./types/index.cjs"),_=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const r=require("./chunks/dashboard-briefing-launcher-D18qNhwa.js"),S=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");require("./chunks/index-BxM99sFL.js");function R(o){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const n in o)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(o,n);Object.defineProperty(i,n,u.get?u:{enumerable:!0,get:()=>o[n]})}}return i.default=o,Object.freeze(i)}const h=R(C);function j(o){const{displayPreferences:i,cardId:n,...u}=o,s={...u,id:o.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:o.cardId}),t.jsx(e.UXProvider,{appearance:o.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:i,children:t.jsx(e.Container,{type:"visual",cardId:n,...s,children:t.jsx(w,{cardId:n})})})})]})})}function w({cardId:o}){const i=a.useDashboardStore(s=>{var c;return(c=s.dashboard)==null?void 0:c.sheets}),{card:n,frame:u}=C.useMemo(()=>{const s=i==null?void 0:i.flatMap(l=>l.frames),c=s==null?void 0:s.flatMap(l=>l==null?void 0:l.cards),D=c==null?void 0:c.find(l=>(l==null?void 0:l.id)===o),E=s==null?void 0:s.find(l=>{var p;return(p=l==null?void 0:l.cards)==null?void 0:p.find(g=>(g==null?void 0:g.id)===o)});return{card:D,frame:E}},[i,o]);return!n||!u?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${o}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:u})})})}function M(o,i,n,u){C.useEffect(()=>{o&&!n&&i&&u(e.cloneDeep(i))},[o,n,i,u])}function L({name:o,items:i,value:n,onChange:u,isLoading:s,isError:c,refetch:D,className:E,icon:l,showNone:p=!1}){const g=h.useRef(null),[b,T]=h.useState(!1),[B,A]=h.useState("100%"),x=p?[...i||[],{id:"none",name:"None"}]:i;h.useLayoutEffect(()=>{g.current&&A(g.current.offsetWidth)},[]);function F(){var f;return s?"Loading...":c?"Error":n?(f=i==null?void 0:i.find(m=>m.id===n))==null?void 0:f.name:`Select ${o}`}function v(f,m){u(m),T(!1)}return t.jsxs(a.Popover,{open:b,onOpenChange:T,children:[t.jsx(a.PopoverTrigger,{asChild:!0,children:t.jsxs(a.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:a.cn("flex h-9 w-full justify-between",E),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[l&&t.jsx("div",{className:"mr-2",children:l}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:F()})]}),t.jsx(a.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(a.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:D,children:t.jsx(e.RefreshCw,{className:a.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",o==null?void 0:o.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:m=>v(m,f.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(a.Check,{className:a.cn("size-4",n===f.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function I(o,i){C.useEffect(()=>(o&&i&&(window.__SEMAPHOR_PRINT_STATE__={...i}),()=>{o&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[o,i])}exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.ExportError=e.ExportError;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.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createExport=e.createExport;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.CalendarPreferencesDialog=P.CalendarPreferencesDialog;exports.createEmptyKpiConfig=a.createEmptyKpiConfig;exports.createSqlGenConfig=a.createSqlGenConfig;exports.emitDashboardLoad=a.emitDashboardLoad;exports.emitDashboardUnload=a.emitDashboardUnload;exports.fmt=a.fmt;exports.getColumnDataType=a.getColumnDataType;exports.getFilterValueType=a.getFilterValueType;exports.getFormattedTableNameForQuery=a.getFormattedTableNameForQuery;exports.getQualifiedTableName=a.getQualifiedTableName;exports.getSql=a.getSql;exports.invalidateToken=a.invalidateToken;exports.isBooleanDataType=a.isBooleanDataType;exports.isColumnInSqlGen=a.isColumnInSqlGen;exports.isDateDataType=a.isDateDataType;exports.isNumberDataType=a.isNumberDataType;exports.isTextDataType=a.isTextDataType;exports.resolveDataType=a.resolveDataType;exports.resolveDatamodelName=a.resolveDatamodelName;exports.useCurrentActiveCard=a.useCurrentActiveCard;exports.useCurrentCardConfig=a.useCurrentCardConfig;exports.useCurrentSheetActiveCards=a.useCurrentSheetActiveCards;exports.useDashboardActions=a.useDashboardActions;exports.useDashboardStore=a.useDashboardStore;exports.useEditorActions=a.useEditorActions;exports.useEditorStore=a.useEditorStore;exports.ResourceManagementPanel=N.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=y.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=y.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.useDebouncedDirtyCheck=_.useDebouncedDirtyCheck;exports.AdvancedModeToggle=r.AdvancedModeToggle;exports.BriefingAuthor=r.BriefingAuthor;exports.BriefingsApiError=r.BriefingsApiError;exports.DashboardBriefingLauncher=r.DashboardBriefingLauncher;exports.DashboardControlsSettings=r.DashboardControlsSettings;exports.DashboardFilterControlsButton=r.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=r.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=r.DocumentControlsSettings;exports.ExportNotificationItem=r.ExportNotificationItem;exports.ExportNotificationList=r.ExportNotificationList;exports.NotificationBell=r.NotificationBell;exports.UnsavedChangesAlert=r.UnsavedChangesAlert;exports.VisualEditingControls=r.VisualEditingControls;exports.WatchDashboardButton=r.WatchDashboardButton;exports.applyBriefingFormPatch=r.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=r.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=r.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=r.briefingToFormDraft;exports.cancelBriefingRun=r.cancelBriefingRun;exports.createBriefing=r.createBriefing;exports.createBriefingFormDraft=r.createBriefingFormDraft;exports.deleteBriefing=r.deleteBriefing;exports.deleteBriefingRun=r.deleteBriefingRun;exports.getBriefing=r.getBriefing;exports.getBriefingArtifact=r.getBriefingArtifact;exports.getBriefingEvidence=r.getBriefingEvidence;exports.getBriefingPreviewRun=r.getBriefingPreviewRun;exports.getBriefingRun=r.getBriefingRun;exports.listBriefingRuns=r.listBriefingRuns;exports.listBriefingTenantSummaries=r.listBriefingTenantSummaries;exports.listBriefings=r.listBriefings;exports.pauseBriefing=r.pauseBriefing;exports.polishBriefingText=r.polishBriefingText;exports.previewBriefingPlan=r.previewBriefingPlan;exports.resumeBriefing=r.resumeBriefing;exports.runBriefingNow=r.runBriefingNow;exports.runBriefingPreview=r.runBriefingPreview;exports.updateBriefing=r.updateBriefing;exports.useExportPolling=r.useExportPolling;exports.useExportRecovery=r.useExportRecovery;exports.validateBriefingFormDraft=r.validateBriefingFormDraft;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=L;exports.Visual=j;exports.useExposePrintState=I;exports.usePristineSnapshotInitializer=M;
|