react-semaphor 0.1.326 → 0.1.328
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/brand-studio/index.cjs +5 -5
- package/dist/brand-studio/index.js +23 -24
- package/dist/chunks/_commonjsHelpers-BVfed4GL.js +28 -0
- package/dist/chunks/_commonjsHelpers-DwTZ_eVU.js +1 -0
- package/dist/chunks/{braces-DVaMJoCd.js → braces-CG8viaD2.js} +1 -1
- package/dist/chunks/{braces-dHeaioTd.js → braces-DSaa_4Oc.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-mqU_uOmY.js → calendar-preferences-dialog-DD_qAthL.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog--2jD-eKu.js → calendar-preferences-dialog-JRmNJptJ.js} +3 -3
- package/dist/chunks/{chevrons-up-down-DNQE-uEp.js → chevrons-up-down-CBa0uh0X.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CLbzBHoI.js → chevrons-up-down-ChDNqVP7.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-BKdJFwH5.js +106 -0
- package/dist/chunks/{dashboard-briefing-launcher-DsjXUPFq.js → dashboard-briefing-launcher-BfyNkd8i.js} +1106 -1108
- package/dist/chunks/{dashboard-controls-DgNkM1yT.js → dashboard-controls-0pZDLvFL.js} +218 -218
- package/dist/chunks/{dashboard-controls-XCa9PZuU.js → dashboard-controls-C0xm1QMR.js} +10 -10
- package/dist/chunks/dashboard-json-BW5OVZ6m.js +1 -0
- package/dist/chunks/{dashboard-json-DkA6Bf0Y.js → dashboard-json-DsruhRPD.js} +14 -13
- package/dist/chunks/date-formatter-B4EBSe9C.js +1 -0
- package/dist/chunks/date-formatter-CzcPZx39.js +416 -0
- package/dist/chunks/edit-dashboard-visual-DQyJ7SSv.js +178 -0
- package/dist/chunks/{edit-dashboard-visual-Q5hW5MXk.js → edit-dashboard-visual-g5SZZahJ.js} +8242 -7784
- package/dist/chunks/index-1JWDPCun.js +1935 -0
- package/dist/chunks/index-BdjXTQt4.js +1444 -0
- package/dist/chunks/{index-DwfDwtv2.js → index-BmKr-K7J.js} +117670 -113627
- package/dist/chunks/index-C1l78BIx.js +3247 -0
- package/dist/chunks/lib-Ce3zosXY.js +38 -0
- package/dist/chunks/lib-DFvr9fM4.js +5500 -0
- package/dist/chunks/{palette-DtmNws9a.js → palette-D0YmAqBS.js} +1 -1
- package/dist/chunks/{palette-DpcvHAiY.js → palette-DQgq3edH.js} +1 -1
- package/dist/chunks/{resource-management-panel-CGwWKZOP.js → resource-management-panel-CIfBh46E.js} +1 -1
- package/dist/chunks/{resource-management-panel-D2oAQkKi.js → resource-management-panel-Cj19pw9M.js} +145 -145
- package/dist/chunks/switch-BvTzw2AW.js +173 -0
- package/dist/chunks/{switch-j3AThLFk.js → switch-De31SR3q.js} +2752 -2717
- package/dist/chunks/typescript-Cmizj1hi.js +446 -0
- package/dist/chunks/typescript-H1EwZsOb.js +159820 -0
- package/dist/chunks/use-create-flow-overlay-state-BTQiKRD1.js +26 -0
- package/dist/chunks/{use-create-flow-overlay-state-CP6GDQAX.js → use-create-flow-overlay-state-IcHP0l39.js} +150 -151
- package/dist/chunks/{use-visual-utils-CSXU-96k.js → use-visual-utils-DQ5zGYD2.js} +13 -13
- package/dist/chunks/{use-visual-utils-NpOW5uZ1.js → use-visual-utils-XF-AqV8o.js} +1 -1
- package/dist/chunks/{validators-DvTxl9i0.js → validators-DDAweCzB.js} +67 -48
- package/dist/chunks/validators-odlRJblR.js +2 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +907 -527
- package/dist/data-app-builder/index.cjs +1 -0
- package/dist/data-app-builder/index.js +4 -0
- package/dist/data-app-builder-browser-runtime/index.cjs +1 -0
- package/dist/data-app-builder-browser-runtime/index.js +10 -0
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +208 -196
- package/dist/format-utils/index.cjs +4 -4
- package/dist/format-utils/index.js +22 -21
- package/dist/index.cjs +1 -1
- package/dist/index.js +14 -14
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +1 -0
- package/dist/types/dashboard-authoring.d.ts +79 -2
- package/dist/types/dashboard.d.ts +17 -2
- package/dist/types/data-app-builder-browser-runtime.d.ts +185 -0
- package/dist/types/data-app-builder.d.ts +630 -0
- package/dist/types/data-app-sdk.d.ts +15 -1
- package/dist/types/format-utils.d.ts +25 -0
- package/dist/types/main.d.ts +67 -10
- package/dist/types/shared.d.ts +17 -2
- package/dist/types/surfboard.d.ts +17 -2
- package/dist/types/types.d.ts +32 -3
- package/package.json +11 -1
- package/dist/chunks/dashboard-briefing-launcher-DguNfFr8.js +0 -106
- package/dist/chunks/dashboard-json-DiBd65Xf.js +0 -1
- package/dist/chunks/date-formatter-D9Bvw5Qk.js +0 -1
- package/dist/chunks/date-formatter-DyIOb6uC.js +0 -333
- package/dist/chunks/edit-dashboard-visual-BC9eOc4U.js +0 -178
- package/dist/chunks/index-B1-46PoR.js +0 -1303
- package/dist/chunks/save-BY7WF62U.js +0 -21
- package/dist/chunks/save-Cv_XRb94.js +0 -6
- package/dist/chunks/switch-5aQ_jcLH.js +0 -168
- package/dist/chunks/use-create-flow-overlay-state-BQPXP0AM.js +0 -26
- package/dist/chunks/validators-DJUMR5An.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-BdjXTQt4.js");exports.DataAppBuilder=e.DataAppBuilder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=async(r="semaphor-browser-runtime")=>{if(r!=="semaphor-browser-runtime")throw new Error("Custom browser runtime specifiers are not supported in the bundled App Builder. Install or link semaphor-browser-runtime.");return Promise.resolve().then(()=>require("../chunks/index-1JWDPCun.js"))};exports.loadSemaphorBrowserRuntime=e;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const e = async (r = "semaphor-browser-runtime") => {
|
|
2
|
+
if (r !== "semaphor-browser-runtime")
|
|
3
|
+
throw new Error(
|
|
4
|
+
"Custom browser runtime specifiers are not supported in the bundled App Builder. Install or link semaphor-browser-runtime."
|
|
5
|
+
);
|
|
6
|
+
return import("../chunks/index-C1l78BIx.js");
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
e as loadSemaphorBrowserRuntime
|
|
10
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../chunks/index-BxM99sFL.js"),u=require("react"),P=require("react/jsx-runtime"),K=require("../chunks/validators-odlRJblR.js");function x(t){var e;return{version:1,kind:"metric",id:t.id,label:t.label,source:k(t),metric:t.metric,metrics:t.metrics,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,dimensions:(e=t.dimensions)==null?void 0:e.map(o=>m(o,"dimension")),comparison:L(t.comparison),inputs:g(t.inputs),limit:t.limit}}function R(t){if("sort"in t)throw new Error("useSemaphorRecords supports orderBy for a single deterministic sort. Multiple sort clauses are not supported by the analytics protocol yet.");if(!N(t))throw new Error("useSemaphorRecords needs at least one field, dimension, or measure.");const e=F(t.fields,t.dimensions,t.measures);return{version:1,kind:"records",id:t.id,label:t.label,source:k(t),fields:e,measures:t.measures,dateField:t.dateField?m(t.dateField,"date"):void 0,timeGrain:t.timeGrain,orderBy:t.orderBy,inputs:g(t.inputs),limit:t.limit}}function q(t){return{version:1,kind:"inputOptions",id:t.id,label:t.label,source:k(t),field:m(t.field,"dimension"),search:t.search,limit:t.limit}}function O(t){if("toAnalyticsInput"in t){const e=t.toAnalyticsInput();return{inputId:e.inputId,field:e.field}}return{inputId:t.inputId,field:t.field}}function U(t){const e=g(t);return e.length>0?e:void 0}function M(t){return(t||[]).map(V)}function A(t){return M(t).filter(e=>e.isActive)}function w(t){return t.kind==="filter"?{inputId:t.id,kind:t.kind,label:t.label,field:m(t.field,"dimension"),operator:t.operator||"in",source:t.source}:{inputId:t.id,kind:t.kind,label:t.label}}function $(t=[]){return t.map(e=>typeof e=="object"?e:{label:String(e),value:e})}function S(t){return t==null?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t.trim().length>0:!0}function V(t){return"toAnalyticsInput"in t?t.toAnalyticsInput():"kind"in t&&"isActive"in t?t:{...t,kind:"filter",isActive:S(t.value),value:t.value}}function k(t){if("source"in t&&t.source)return t.source;const e=t.datasetName||t.dataset;if(!e)throw new Error("Semaphor data app source needs datasetName or dataset.");return{kind:"semantic",domainId:t.domainId,datasetName:e,datasetId:t.datasetId,connectionId:t.connectionId,label:t.sourceLabel}}function N(t){var e,o,n;return!!((e=t.fields)!=null&&e.length||(o=t.dimensions)!=null&&o.length||(n=t.measures)!=null&&n.length)}function j(t){return!!(t!=null&&t.length)}function F(t,e,o){const n=[],r=new Set,a=i=>{const l=`${i.role||""}:${i.name}`;r.has(l)||(r.add(l),n.push(i))};return j(t)&&t.map(i=>m(i)).forEach(a),e==null||e.map(i=>m(i,"dimension")).forEach(a),o==null||o.map(i=>m(i,"measure")).forEach(a),n}function m(t,e){return typeof t=="string"?e?{name:t,role:e}:{name:t}:{...t,role:t.role||e}}function g(t){return(t||[]).map(O)}function L(t){if(!(!t||t==="none"))return typeof t=="object"?t:t==="same_period_last_year"?{kind:"previous_year"}:{kind:t}}function B(){return{executeMetric:(t,e)=>y(t,e),executeRecords:(t,e)=>y(t,e),executeInputOptions:(t,e)=>y(t,e)}}async function y(t,e){if(!e.token)throw new Error("SemaphorDataAppProvider needs a token to execute queries.");const o=await fetch(G(e),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({intent:t,activeInputs:e.activeInputs,resultShape:t.kind})}),n=await z(o);if(!o.ok||n.error)throw new Error(n.error||`Semaphor Data App execution failed with status ${o.status}.`);return n}async function z(t){const e=await t.text().catch(()=>"");if(!e.trim())return t.ok?{error:"Semaphor Data App execution returned an empty response."}:{};try{return JSON.parse(e)}catch{return t.ok?{error:"Semaphor Data App execution returned invalid JSON.",details:e}:{error:Q(t,e),details:e}}}function Q(t,e){const o=t.statusText?` ${t.statusText}`:"",n=e.replace(/\s+/g," ").trim();return n?`Semaphor Data App execution failed with status ${t.status}${o}: ${n.slice(0,240)}`:`Semaphor Data App execution failed with status ${t.status}${o}.`}function G(t){const e=J(t).replace(/\/+$/,"");return e?e.endsWith("/api")?`${e}/v1/data-app/execute`:`${e}/api/v1/data-app/execute`:"/api/v1/data-app/execute"}function J(t){if(t.apiBaseUrl)return t.apiBaseUrl;if(!t.token)return"";try{return T.jwtDecode(t.token).apiServiceUrl||""}catch{return""}}const D=u.createContext({});function _(){if(!(typeof window>"u"))return window.__SEMAPHOR_DATA_APP_RUNTIME__}function C(){return u.useContext(D)}function W({token:t,apiBaseUrl:e,executor:o,children:n}){var d;const r=_(),a=((d=r==null?void 0:r.authToken)==null?void 0:d.accessToken)||t,i=(r==null?void 0:r.dataApiBaseUrl)||(r==null?void 0:r.apiBaseUrl)||e,l=u.useMemo(()=>B(),[]),s=o||l,p=u.useMemo(()=>({token:a,apiBaseUrl:i,executor:s}),[i,s,a]);return P.jsx(D.Provider,{value:p,children:n})}const I={value:null},H={records:[]},v={options:[]};function X(t){const e=A(t.inputs);try{const o=x(t),n=b(o);return n?{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}:{intent:o,error:null,activeInputs:e,queryKey:c(o,e),idleData:I}}catch(o){const n=h(o);return{error:n,activeInputs:e,queryKey:c(void 0,e,n),idleData:I}}}function Y(t){const e=A(t.inputs),o=H;try{const n=R(t),r=b(n);return r?{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}:{intent:n,error:null,activeInputs:e,queryKey:c(n,e),idleData:o}}catch(n){const r=h(n);return{error:r,activeInputs:e,queryKey:c(void 0,e,r),idleData:o}}}function Z(t){try{const e=q(t),o=b(e);return o?{error:o,queryKey:c(void 0,void 0,o),idleData:v}:{intent:e,error:null,queryKey:c(e),idleData:v}}catch(e){const o=h(e);return{error:o,queryKey:c(void 0,void 0,o),idleData:v}}}function h(t){return t instanceof Error?t:new Error(String(t))}function b(t){const e=K.validateSemaphorAnalyticsIntent(t);if(e.ok)return null;const o=e.errors.map(n=>n.path?`${n.code} at ${n.path}: ${n.message}`:`${n.code}: ${n.message}`).join("; ");return new Error(`Invalid Semaphor analytics intent. ${o}`)}function c(t,e,o){return JSON.stringify({intent:t,activeInputs:e,error:o==null?void 0:o.message})}function tt(t){const[e,o]=u.useState(t.defaultValue),n=Object.prototype.hasOwnProperty.call(t,"value"),r=n?t.value:e,a=u.useMemo(()=>$(t.options),[t.options]),i=u.useCallback(s=>{var d;const p=s;(d=t.onValueChange)==null||d.call(t,p),n||o(p)},[n,t]),l=u.useCallback(()=>i(void 0),[i]);return u.useMemo(()=>{const s=w(t);return{id:t.id,kind:t.kind,label:t.label,field:s.field,operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0,value:r,options:a,isActive:S(r),setValue:i,clear:l,toAnalyticsInput:()=>({inputId:s.inputId,field:s.field,kind:t.kind,label:t.label,value:r,isActive:S(r),operator:s.operator,source:s.source,controlRole:t.kind==="control"?t.role:void 0})}},[l,a,i,t,r])}function et(t){const e=u.useMemo(()=>X(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeMetric(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.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:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function rt(t){const e=u.useMemo(()=>Y(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeRecords(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData,e.activeInputs),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,records:(r==null?void 0:r.records)||[],columns:r==null?void 0:r.columns,rowCount:r==null?void 0:r.rowCount,status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function nt(t){const e=u.useMemo(()=>Z(t),[t]),o=u.useCallback(a=>{var i;return e.intent?(i=a.executor)==null?void 0:i.executeInputOptions(e.intent,a):void 0},[e.intent]),n=E(e.queryKey,o,e.idleData),r=e.error?e.idleData:n.data;return{id:t.id,intent:e.intent,options:(r==null?void 0:r.options)||[],status:e.error?"error":n.status,isLoading:!e.error&&n.status==="loading",error:e.error||n.error}}function E(t,e,o,n){const r=C(),a=u.useRef(e),i=u.useRef(n),[l,s]=u.useState({status:"idle",data:o,error:null});return a.current=e,i.current=n,u.useEffect(()=>{let p;try{p=a.current({...r,activeInputs:i.current})}catch(f){s({status:"error",data:o,error:h(f)});return}if(!p){s({status:"idle",data:o,error:null});return}let d=!1;return s(f=>({status:"loading",data:f.data,error:null})),p.then(f=>{d||s({status:"success",data:f,error:null})}).catch(f=>{d||s({status:"error",data:o,error:h(f)})}),()=>{d=!0}},[o,t,r]),l}exports.SemaphorDataAppContext=D;exports.SemaphorDataAppProvider=W;exports.createSemaphorDataAppExecutor=B;exports.hasSemaphorInputValue=S;exports.normalizeSemaphorInputOptions=$;exports.readWindowRuntime=_;exports.toSemaphorActiveInputSnapshots=A;exports.toSemaphorInputBinding=O;exports.toSemaphorInputBindings=U;exports.toSemaphorInputOptionsIntent=q;exports.toSemaphorInputSnapshots=M;exports.toSemaphorInputSpec=w;exports.toSemaphorMetricIntent=x;exports.toSemaphorRecordsIntent=R;exports.useSemaphorDataAppRuntime=C;exports.useSemaphorInput=tt;exports.useSemaphorInputOptions=nt;exports.useSemaphorMetric=et;exports.useSemaphorRecords=rt;
|