drizzle-cube 0.4.35 → 0.4.37
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/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +3 -3
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +3 -3
- package/dist/adapters/{handler-DzUX7CBs.cjs → handler-dHHEEbG9.cjs} +1 -1
- package/dist/adapters/{handler-J55KQKe5.js → handler-fto6TSVn.js} +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +3 -3
- package/dist/adapters/{mcp-transport-Dmf2vbIb.cjs → mcp-transport-ro4OL4BW.cjs} +4 -4
- package/dist/adapters/{mcp-transport-Cdisv8il.js → mcp-transport-tB5a7Het.js} +71 -18
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +3 -3
- package/dist/adapters/{utils-CDExg9uP.cjs → utils-2MwxiQ2o.cjs} +1 -1
- package/dist/adapters/{utils-DkKcpkx5.js → utils-_2o905Fi.js} +2 -1
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.d.ts +2 -0
- package/dist/adapters/utils.js +1 -1
- package/dist/client/charts.js +3 -3
- package/dist/client/chunks/{DashboardEditModal-DsxYiMct.js → DashboardEditModal-B083DSGL.js} +7 -7
- package/dist/client/chunks/DashboardEditModal-B083DSGL.js.map +1 -0
- package/dist/client/chunks/{FieldSearchModal-CSzgVPdG.js → FieldSearchModal-BxQ5JhWz.js} +2 -2
- package/dist/client/chunks/{FieldSearchModal-CSzgVPdG.js.map → FieldSearchModal-BxQ5JhWz.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-CxXZDfFR.js → analysis-builder-BFb3zjl5.js} +1783 -2561
- package/dist/client/chunks/analysis-builder-BFb3zjl5.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-shared-fwyLiZ48.js → analysis-builder-shared-BFzd2jx_.js} +1498 -716
- package/dist/client/chunks/analysis-builder-shared-BFzd2jx_.js.map +1 -0
- package/dist/client/chunks/{chart-data-table-CGG-_R93.js → chart-data-table-CW_qZDpt.js} +12 -2
- package/dist/client/chunks/chart-data-table-CW_qZDpt.js.map +1 -0
- package/dist/client/chunks/{chart-kpi-delta-D9eNhKR6.js → chart-kpi-delta-BPexzOe7.js} +2 -2
- package/dist/client/chunks/{chart-kpi-delta-D9eNhKR6.js.map → chart-kpi-delta-BPexzOe7.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-IJWReEix.js → chart-kpi-number-BBtGBtZL.js} +3 -3
- package/dist/client/chunks/{chart-kpi-number-IJWReEix.js.map → chart-kpi-number-BBtGBtZL.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-Dsr7nPmz.js → chart-kpi-text-BqHhmJEB.js} +2 -2
- package/dist/client/chunks/{chart-kpi-text-Dsr7nPmz.js.map → chart-kpi-text-BqHhmJEB.js.map} +1 -1
- package/dist/client/chunks/{charts-loader-DSdXpr7e.js → charts-loader-gZjOqZwG.js} +5 -5
- package/dist/client/chunks/{charts-loader-DSdXpr7e.js.map → charts-loader-gZjOqZwG.js.map} +1 -1
- package/dist/client/chunks/{schema-visualization-CBQrcxb8.js → schema-visualization-XLFzV_7p.js} +2 -2
- package/dist/client/chunks/{schema-visualization-CBQrcxb8.js.map → schema-visualization-XLFzV_7p.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-BbYqb134.js → useDebounce-C_wstEud.js} +2 -2
- package/dist/client/chunks/{useDebounce-BbYqb134.js.map → useDebounce-C_wstEud.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-CbAR-1p5.js → useExplainAI-C9ytXRIC.js} +21 -18
- package/dist/client/chunks/{useExplainAI-CbAR-1p5.js.map → useExplainAI-C9ytXRIC.js.map} +1 -1
- package/dist/client/chunks/{utils-BxLeWUeg.js → utils-3FNmeZJR.js} +2 -2
- package/dist/client/chunks/{utils-BxLeWUeg.js.map → utils-3FNmeZJR.js.map} +1 -1
- package/dist/client/chunks/{vendor-QBbbDL5y.js → vendor-BPRWulB7.js} +2 -2
- package/dist/client/chunks/{vendor-QBbbDL5y.js.map → vendor-BPRWulB7.js.map} +1 -1
- package/dist/client/components/AIAssistant/utils.d.ts +1 -1
- package/dist/client/components/DataBrowser/DataBrowserSidebar.d.ts +16 -0
- package/dist/client/components/DataBrowser/DataBrowserTable.d.ts +16 -0
- package/dist/client/components/DataBrowser/DataBrowserToolbar.d.ts +22 -0
- package/dist/client/components/DataBrowser/index.d.ts +28 -0
- package/dist/client/components.js +3 -3
- package/dist/client/hooks/useDataBrowser.d.ts +67 -0
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons/types.d.ts +1 -0
- package/dist/client/icons.js +1 -1
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +774 -192
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers/CubeApiProvider.d.ts +1 -0
- package/dist/client/providers.js +1 -1
- package/dist/client/stores/dataBrowserStore.d.ts +34 -0
- package/dist/client/styles.css +1 -1
- package/dist/client/types.d.ts +2 -0
- package/dist/client/utils.js +3 -3
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +3 -3
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.js +69 -16
- package/package.json +1 -1
- package/dist/client/chunks/DashboardEditModal-DsxYiMct.js.map +0 -1
- package/dist/client/chunks/analysis-builder-CxXZDfFR.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-fwyLiZ48.js.map +0 -1
- package/dist/client/chunks/chart-data-table-CGG-_R93.js.map +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-
|
|
2
|
-
import { S as s } from "./chart-data-table-
|
|
3
|
-
import { C as
|
|
4
|
-
import { a as
|
|
5
|
-
import { r as
|
|
6
|
-
import { A as
|
|
7
|
-
import { a as
|
|
8
|
-
import { L as
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-BPRWulB7.js";
|
|
2
|
+
import { S as s, d as c } from "./chart-data-table-CW_qZDpt.js";
|
|
3
|
+
import { C as l, D as u, E as d, O as f, T as p, a as m, b as h, l as g, n as _, r as v, s as y, t as b } from "./useDebounce-C_wstEud.js";
|
|
4
|
+
import { a as x, i as ee } from "./useExplainAI-C9ytXRIC.js";
|
|
5
|
+
import { r as te, s as S } from "./chart-funnel-C9JRW79j.js";
|
|
6
|
+
import { A as ne } from "./chart-activity-grid-wR2Twpo7.js";
|
|
7
|
+
import { a as C, s as w, t as T } from "./retention-UEXlSdZ-.js";
|
|
8
|
+
import { L as E, R as re, a as D, c as O, d as k, f as A, g as j, h as M, l as ie, o as N, s as P, t as ae, x as F } from "./FieldSearchModal-BxQ5JhWz.js";
|
|
9
|
+
import { n as oe } from "./charts-core-CJlGzwsW.js";
|
|
10
|
+
import I, { createContext as se, memo as L, useCallback as R, useContext as ce, useEffect as z, useMemo as B, useRef as V, useState as H } from "react";
|
|
11
|
+
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
11
12
|
//#region src/shared/date-utils.ts
|
|
12
|
-
function
|
|
13
|
+
function le(e) {
|
|
13
14
|
let t = /* @__PURE__ */ new Date(), n = e.toLowerCase().trim(), r = t.getUTCFullYear(), i = t.getUTCMonth(), a = t.getUTCDate(), o = t.getUTCDay();
|
|
14
15
|
if (n === "today") {
|
|
15
16
|
let e = new Date(t);
|
|
@@ -122,7 +123,7 @@ function ne(e) {
|
|
|
122
123
|
}
|
|
123
124
|
return null;
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function ue(e) {
|
|
126
127
|
if (Array.isArray(e)) {
|
|
127
128
|
if (e.length < 2) return null;
|
|
128
129
|
let t = new Date(e[0]), n = new Date(e[1]);
|
|
@@ -131,12 +132,12 @@ function re(e) {
|
|
|
131
132
|
end: n
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
return
|
|
135
|
+
return le(e);
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
+
function de(e) {
|
|
137
138
|
return e.toISOString().split("T")[0];
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
+
function fe(e, t) {
|
|
140
141
|
let n = t.getTime() - e.getTime(), r = Math.ceil(n / (1e3 * 60 * 60 * 24)), i = new Date(e);
|
|
141
142
|
i.setUTCDate(i.getUTCDate() - 1), i.setUTCHours(23, 59, 59, 999);
|
|
142
143
|
let a = new Date(i);
|
|
@@ -147,27 +148,27 @@ function ie(e, t) {
|
|
|
147
148
|
}
|
|
148
149
|
//#endregion
|
|
149
150
|
//#region src/client/components/AnalysisBuilder/utils/filterUtils.ts
|
|
150
|
-
function
|
|
151
|
+
function pe(e, t) {
|
|
151
152
|
for (let n of e) if ("type" in n && "filters" in n) {
|
|
152
|
-
let e =
|
|
153
|
+
let e = pe(n.filters, t);
|
|
153
154
|
if (e) return e;
|
|
154
155
|
} else if ("member" in n) {
|
|
155
156
|
let e = n;
|
|
156
157
|
if (e.member === t && e.operator === "inDateRange" && e.dateRange) return { dateRange: e.dateRange };
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
-
let n =
|
|
160
|
+
function me(e, t) {
|
|
161
|
+
let n = pe(t, e);
|
|
161
162
|
if (!n?.dateRange) return;
|
|
162
|
-
let r =
|
|
163
|
+
let r = ue(n.dateRange);
|
|
163
164
|
if (!r) return;
|
|
164
|
-
let i =
|
|
165
|
-
return [[
|
|
165
|
+
let i = fe(r.start, r.end);
|
|
166
|
+
return [[de(r.start), de(r.end)], [de(i.start), de(i.end)]];
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function he(e, t) {
|
|
168
169
|
return e.reduce((e, n) => {
|
|
169
170
|
if ("type" in n && "filters" in n) {
|
|
170
|
-
let r = n, i =
|
|
171
|
+
let r = n, i = he(r.filters, t);
|
|
171
172
|
i.length > 0 && e.push({
|
|
172
173
|
type: r.type,
|
|
173
174
|
filters: i
|
|
@@ -181,10 +182,10 @@ function se(e, t) {
|
|
|
181
182
|
}
|
|
182
183
|
//#endregion
|
|
183
184
|
//#region src/client/components/AnalysisBuilder/utils/queryUtils.ts
|
|
184
|
-
function
|
|
185
|
+
function ge(e, t, n, r, i = !1) {
|
|
185
186
|
let a = t.filter((e) => e.isTimeDimension && e.enableComparison).map((e) => e.field), o = n;
|
|
186
|
-
if (!i) for (let e of a) o =
|
|
187
|
-
o = o.filter((e) =>
|
|
187
|
+
if (!i) for (let e of a) o = he(o, e);
|
|
188
|
+
o = o.filter((e) => F(e));
|
|
188
189
|
let s = {
|
|
189
190
|
measures: e.map((e) => e.field),
|
|
190
191
|
dimensions: t.filter((e) => !e.isTimeDimension).map((e) => e.field),
|
|
@@ -194,7 +195,7 @@ function ce(e, t, n, r, i = !1) {
|
|
|
194
195
|
granularity: e.granularity || "day"
|
|
195
196
|
};
|
|
196
197
|
if (e.enableComparison) {
|
|
197
|
-
let r =
|
|
198
|
+
let r = me(e.field, n);
|
|
198
199
|
r && (t.compareDateRange = r);
|
|
199
200
|
}
|
|
200
201
|
return t;
|
|
@@ -204,7 +205,7 @@ function ce(e, t, n, r, i = !1) {
|
|
|
204
205
|
};
|
|
205
206
|
return s.measures?.length === 0 && delete s.measures, s.dimensions?.length === 0 && delete s.dimensions, s.timeDimensions?.length === 0 && delete s.timeDimensions, s;
|
|
206
207
|
}
|
|
207
|
-
function
|
|
208
|
+
function K() {
|
|
208
209
|
return {
|
|
209
210
|
metrics: [],
|
|
210
211
|
breakdowns: [],
|
|
@@ -215,24 +216,805 @@ function U() {
|
|
|
215
216
|
};
|
|
216
217
|
}
|
|
217
218
|
//#endregion
|
|
219
|
+
//#region src/client/components/AnalysisBuilder/FilterConfigModal.tsx
|
|
220
|
+
var _e = c("close"), ve = c("chevronDown"), q = c("dimension"), J = c("timeDimension"), Y = c("measure");
|
|
221
|
+
function ye({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i }) {
|
|
222
|
+
let [a, o] = H(e), [s, c] = H(!1), [m, h] = H(!1), [g, v] = H(!1), [y, x] = H("this_month"), [ee, te] = H(1), [S, ne] = H(""), [C, w] = H(null), [T, E] = H(-1), re = V(null), D = V(null), k = b(S, 300), A = O(a.member, t), j = A?.field.type || "string", M = j === "time", N = A?.fieldType === "measure", P = A?.fieldType === "dimension", ae = ie(a.member, t), F = f[a.operator], oe = p(j), I = M && a.operator === "inDateRange", se = R(() => [
|
|
223
|
+
"equals",
|
|
224
|
+
"notEquals",
|
|
225
|
+
"in",
|
|
226
|
+
"notIn"
|
|
227
|
+
].includes(a.operator) && P && !M, [
|
|
228
|
+
a.operator,
|
|
229
|
+
P,
|
|
230
|
+
M
|
|
231
|
+
])(), { values: L, loading: ce, error: B, searchValues: le } = _(a.member, se);
|
|
232
|
+
z(() => {
|
|
233
|
+
if (!i) {
|
|
234
|
+
w(null);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
let e = i.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom, r = t > 500 || t > n, a = Math.max(16, Math.min(e.left, window.innerWidth - 400 - 16));
|
|
238
|
+
w(r ? {
|
|
239
|
+
bottom: window.innerHeight - e.top + 8,
|
|
240
|
+
left: a
|
|
241
|
+
} : {
|
|
242
|
+
top: e.bottom + 8,
|
|
243
|
+
left: a
|
|
244
|
+
});
|
|
245
|
+
}, [i]), z(() => {
|
|
246
|
+
let e = (e) => {
|
|
247
|
+
re.current && !re.current.contains(e.target) && (c(!1), h(!1), v(!1));
|
|
248
|
+
};
|
|
249
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
250
|
+
}, []), z(() => {
|
|
251
|
+
m && se && le && le("", !0), m || E(-1);
|
|
252
|
+
}, [
|
|
253
|
+
m,
|
|
254
|
+
se,
|
|
255
|
+
le
|
|
256
|
+
]), z(() => {
|
|
257
|
+
if (T >= 0 && D.current) {
|
|
258
|
+
let e = D.current.children[T];
|
|
259
|
+
e && e.scrollIntoView({ block: "nearest" });
|
|
260
|
+
}
|
|
261
|
+
}, [T]), z(() => {
|
|
262
|
+
m && se && le && k !== void 0 && le(k);
|
|
263
|
+
}, [
|
|
264
|
+
k,
|
|
265
|
+
m,
|
|
266
|
+
se,
|
|
267
|
+
le
|
|
268
|
+
]), z(() => {
|
|
269
|
+
if (!(!I || !a.dateRange)) if (Array.isArray(a.dateRange)) x("custom");
|
|
270
|
+
else {
|
|
271
|
+
let e = a.dateRange.match(/^last (\d+) (days|weeks|months|quarters|years)$/), t = !e && a.dateRange.match(/^last (day|week|month|quarter|year)$/);
|
|
272
|
+
if (e) {
|
|
273
|
+
let [, t, n] = e;
|
|
274
|
+
x(`last_n_${n}`), te(parseInt(t) || 1);
|
|
275
|
+
} else if (t) {
|
|
276
|
+
let [, e] = t;
|
|
277
|
+
x(`last_n_${e === "day" ? "days" : e === "week" ? "weeks" : e === "month" ? "months" : e === "quarter" ? "quarters" : "years"}`), te(1);
|
|
278
|
+
} else {
|
|
279
|
+
let e = !1;
|
|
280
|
+
for (let t of u) if (t.value !== "custom" && !d(t.value) && l(t.value) === a.dateRange) {
|
|
281
|
+
x(t.value), e = !0;
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
e || x("custom");
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}, [a.dateRange, I]);
|
|
288
|
+
let ue = R((e) => {
|
|
289
|
+
o({
|
|
290
|
+
member: a.member,
|
|
291
|
+
operator: e,
|
|
292
|
+
values: []
|
|
293
|
+
}), c(!1);
|
|
294
|
+
}, [a.member]), de = R((e, t) => {
|
|
295
|
+
let n = t?.shiftKey ?? !1, r = a.values || [];
|
|
296
|
+
F?.supportsMultipleValues ? (r.includes(e) ? o({
|
|
297
|
+
...a,
|
|
298
|
+
values: r.filter((t) => t !== e)
|
|
299
|
+
}) : o({
|
|
300
|
+
...a,
|
|
301
|
+
values: [...r, e]
|
|
302
|
+
}), n || h(!1)) : (o({
|
|
303
|
+
...a,
|
|
304
|
+
values: [e]
|
|
305
|
+
}), h(!1)), ne(""), E(-1);
|
|
306
|
+
}, [a, F?.supportsMultipleValues]), fe = R((e) => {
|
|
307
|
+
let t = (a.values || []).filter((t) => t !== e);
|
|
308
|
+
o({
|
|
309
|
+
...a,
|
|
310
|
+
values: t
|
|
311
|
+
});
|
|
312
|
+
}, [a]), pe = R((e) => {
|
|
313
|
+
if (!(!m || L.length === 0)) switch (e.key) {
|
|
314
|
+
case "ArrowDown":
|
|
315
|
+
e.preventDefault(), E((e) => e < L.length - 1 ? e + 1 : 0);
|
|
316
|
+
break;
|
|
317
|
+
case "ArrowUp":
|
|
318
|
+
e.preventDefault(), E((e) => e > 0 ? e - 1 : L.length - 1);
|
|
319
|
+
break;
|
|
320
|
+
case "Enter":
|
|
321
|
+
e.preventDefault(), T >= 0 && T < L.length && de(L[T], { shiftKey: e.shiftKey });
|
|
322
|
+
break;
|
|
323
|
+
case "Escape":
|
|
324
|
+
e.preventDefault(), h(!1), E(-1);
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
}, [
|
|
328
|
+
m,
|
|
329
|
+
L,
|
|
330
|
+
T,
|
|
331
|
+
de
|
|
332
|
+
]), me = R((e) => {
|
|
333
|
+
let t = e.target.value;
|
|
334
|
+
if (F?.valueType === "number") {
|
|
335
|
+
let e = parseFloat(t);
|
|
336
|
+
isNaN(e) ? (t === "" || t === "-") && o({
|
|
337
|
+
...a,
|
|
338
|
+
values: []
|
|
339
|
+
}) : o({
|
|
340
|
+
...a,
|
|
341
|
+
values: [e]
|
|
342
|
+
});
|
|
343
|
+
} else o({
|
|
344
|
+
...a,
|
|
345
|
+
values: t ? [t] : []
|
|
346
|
+
});
|
|
347
|
+
}, [a, F?.valueType]), he = R((e) => {
|
|
348
|
+
let t = parseFloat(e.target.value), n = [isNaN(t) ? "" : t, (a.values?.length >= 2 ? a.values : ["", ""])[1]].filter((e) => e !== "");
|
|
349
|
+
o({
|
|
350
|
+
...a,
|
|
351
|
+
values: n
|
|
352
|
+
});
|
|
353
|
+
}, [a]), ge = R((e) => {
|
|
354
|
+
let t = parseFloat(e.target.value), n = [(a.values?.length >= 2 ? a.values : ["", ""])[0], isNaN(t) ? "" : t].filter((e) => e !== "");
|
|
355
|
+
o({
|
|
356
|
+
...a,
|
|
357
|
+
values: n
|
|
358
|
+
});
|
|
359
|
+
}, [a]), K = R((e) => {
|
|
360
|
+
let t = e.target.value;
|
|
361
|
+
o({
|
|
362
|
+
...a,
|
|
363
|
+
values: t ? [t] : []
|
|
364
|
+
});
|
|
365
|
+
}, [a]), ye = R((e) => {
|
|
366
|
+
x(e), v(!1);
|
|
367
|
+
let t;
|
|
368
|
+
if (e === "custom") {
|
|
369
|
+
let e = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
370
|
+
t = [e, e];
|
|
371
|
+
} else t = d(e) ? l(e, ee) : l(e);
|
|
372
|
+
o({
|
|
373
|
+
...a,
|
|
374
|
+
dateRange: t
|
|
375
|
+
});
|
|
376
|
+
}, [a, ee]), be = R((e) => {
|
|
377
|
+
if (te(e), d(y)) {
|
|
378
|
+
let t = l(y, e);
|
|
379
|
+
o({
|
|
380
|
+
...a,
|
|
381
|
+
dateRange: t
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}, [a, y]), xe = R((e) => {
|
|
385
|
+
let t = e.target.value, n = (Array.isArray(a.dateRange) ? a.dateRange : [a.dateRange || "", ""])[1] || t;
|
|
386
|
+
o({
|
|
387
|
+
...a,
|
|
388
|
+
dateRange: [t, n]
|
|
389
|
+
});
|
|
390
|
+
}, [a]), Se = R((e) => {
|
|
391
|
+
let t = e.target.value, n = (Array.isArray(a.dateRange) ? a.dateRange : ["", a.dateRange || ""])[0] || t;
|
|
392
|
+
o({
|
|
393
|
+
...a,
|
|
394
|
+
dateRange: [n, t]
|
|
395
|
+
});
|
|
396
|
+
}, [a]), Ce = oe.find((e) => e.operator === a.operator)?.label || a.operator, we = u.find((e) => e.value === y)?.label || "Select range", Te = M ? J : N ? Y : q, Ee = () => F?.requiresValues ? I ? /* @__PURE__ */ G("div", {
|
|
397
|
+
className: "dc:space-y-2",
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ G("div", {
|
|
400
|
+
className: "dc:relative",
|
|
401
|
+
children: [/* @__PURE__ */ G("button", {
|
|
402
|
+
onClick: () => {
|
|
403
|
+
c(!1), h(!1), v(!g);
|
|
404
|
+
},
|
|
405
|
+
className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
406
|
+
children: [/* @__PURE__ */ W("span", {
|
|
407
|
+
className: "dc:truncate",
|
|
408
|
+
children: we
|
|
409
|
+
}), /* @__PURE__ */ W(ve, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${g ? "dc:rotate-180" : ""}` })]
|
|
410
|
+
}), g && /* @__PURE__ */ W("div", {
|
|
411
|
+
className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
|
|
412
|
+
children: u.map((e) => /* @__PURE__ */ W("button", {
|
|
413
|
+
onClick: () => ye(e.value),
|
|
414
|
+
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.value === y ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
|
|
415
|
+
children: e.label
|
|
416
|
+
}, e.value))
|
|
417
|
+
})]
|
|
418
|
+
}),
|
|
419
|
+
d(y) && /* @__PURE__ */ G("div", {
|
|
420
|
+
className: "dc:flex dc:items-center dc:gap-2",
|
|
421
|
+
children: [/* @__PURE__ */ W("input", {
|
|
422
|
+
type: "number",
|
|
423
|
+
min: "1",
|
|
424
|
+
max: "1000",
|
|
425
|
+
value: ee,
|
|
426
|
+
onChange: (e) => be(Math.max(1, parseInt(e.target.value) || 1)),
|
|
427
|
+
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text dc:w-20"
|
|
428
|
+
}), /* @__PURE__ */ W("span", {
|
|
429
|
+
className: "dc:text-sm text-dc-text-muted",
|
|
430
|
+
children: y.replace("last_n_", "")
|
|
431
|
+
})]
|
|
432
|
+
}),
|
|
433
|
+
y === "custom" && /* @__PURE__ */ G("div", {
|
|
434
|
+
className: "dc:flex dc:items-center dc:gap-2",
|
|
435
|
+
children: [
|
|
436
|
+
/* @__PURE__ */ W("input", {
|
|
437
|
+
type: "date",
|
|
438
|
+
value: Array.isArray(a.dateRange) ? a.dateRange[0] : "",
|
|
439
|
+
onChange: xe,
|
|
440
|
+
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-2 dc:py-2 bg-dc-surface text-dc-text"
|
|
441
|
+
}),
|
|
442
|
+
/* @__PURE__ */ W("span", {
|
|
443
|
+
className: "dc:text-sm text-dc-text-muted",
|
|
444
|
+
children: "to"
|
|
445
|
+
}),
|
|
446
|
+
/* @__PURE__ */ W("input", {
|
|
447
|
+
type: "date",
|
|
448
|
+
value: Array.isArray(a.dateRange) ? a.dateRange[1] : "",
|
|
449
|
+
onChange: Se,
|
|
450
|
+
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-2 dc:py-2 bg-dc-surface text-dc-text"
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
})
|
|
454
|
+
]
|
|
455
|
+
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */ G("div", {
|
|
456
|
+
className: "dc:flex dc:items-center dc:gap-2",
|
|
457
|
+
children: [
|
|
458
|
+
/* @__PURE__ */ W("input", {
|
|
459
|
+
type: "number",
|
|
460
|
+
value: a.values?.[0] ?? "",
|
|
461
|
+
onChange: he,
|
|
462
|
+
placeholder: "Min",
|
|
463
|
+
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
464
|
+
}),
|
|
465
|
+
/* @__PURE__ */ W("span", {
|
|
466
|
+
className: "dc:text-sm text-dc-text-muted",
|
|
467
|
+
children: "to"
|
|
468
|
+
}),
|
|
469
|
+
/* @__PURE__ */ W("input", {
|
|
470
|
+
type: "number",
|
|
471
|
+
value: a.values?.[1] ?? "",
|
|
472
|
+
onChange: ge,
|
|
473
|
+
placeholder: "Max",
|
|
474
|
+
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
}) : F?.valueType === "date" ? /* @__PURE__ */ W("input", {
|
|
478
|
+
type: "date",
|
|
479
|
+
value: a.values?.[0] || "",
|
|
480
|
+
onChange: K,
|
|
481
|
+
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
482
|
+
}) : F?.valueType === "number" ? /* @__PURE__ */ W("input", {
|
|
483
|
+
type: "number",
|
|
484
|
+
value: a.values?.[0] ?? "",
|
|
485
|
+
onChange: me,
|
|
486
|
+
placeholder: "Enter number",
|
|
487
|
+
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
488
|
+
}) : se ? /* @__PURE__ */ G("div", {
|
|
489
|
+
className: "dc:space-y-2",
|
|
490
|
+
children: [
|
|
491
|
+
a.values && a.values.length > 0 && /* @__PURE__ */ W("div", {
|
|
492
|
+
className: "dc:flex dc:flex-wrap dc:gap-1.5",
|
|
493
|
+
children: a.values.map((e, t) => /* @__PURE__ */ G("span", {
|
|
494
|
+
className: "dc:inline-flex dc:items-center dc:gap-1 bg-dc-primary/10 text-dc-primary dc:text-sm dc:px-2 dc:py-1 dc:rounded",
|
|
495
|
+
children: [/* @__PURE__ */ W("span", {
|
|
496
|
+
className: "dc:max-w-[150px] dc:truncate",
|
|
497
|
+
children: String(e)
|
|
498
|
+
}), /* @__PURE__ */ W("button", {
|
|
499
|
+
onClick: () => fe(e),
|
|
500
|
+
className: "hover:text-dc-danger",
|
|
501
|
+
children: /* @__PURE__ */ W(_e, { className: "dc:w-3.5 dc:h-3.5" })
|
|
502
|
+
})]
|
|
503
|
+
}, t))
|
|
504
|
+
}),
|
|
505
|
+
/* @__PURE__ */ G("div", {
|
|
506
|
+
className: "dc:relative",
|
|
507
|
+
children: [/* @__PURE__ */ G("button", {
|
|
508
|
+
onClick: () => {
|
|
509
|
+
c(!1), v(!1), h(!m);
|
|
510
|
+
},
|
|
511
|
+
className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
512
|
+
children: [/* @__PURE__ */ W("span", {
|
|
513
|
+
className: "text-dc-text-muted dc:truncate",
|
|
514
|
+
children: ce ? "Loading..." : "Select value..."
|
|
515
|
+
}), /* @__PURE__ */ W(ve, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${m ? "dc:rotate-180" : ""}` })]
|
|
516
|
+
}), m && /* @__PURE__ */ G("div", {
|
|
517
|
+
className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-56 dc:overflow-hidden",
|
|
518
|
+
children: [/* @__PURE__ */ W("div", {
|
|
519
|
+
className: "dc:p-2 dc:border-b border-dc-border",
|
|
520
|
+
children: /* @__PURE__ */ W("input", {
|
|
521
|
+
type: "text",
|
|
522
|
+
value: S,
|
|
523
|
+
onChange: (e) => {
|
|
524
|
+
ne(e.target.value), E(-1);
|
|
525
|
+
},
|
|
526
|
+
onKeyDown: pe,
|
|
527
|
+
placeholder: "Search...",
|
|
528
|
+
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text",
|
|
529
|
+
autoFocus: !0
|
|
530
|
+
})
|
|
531
|
+
}), /* @__PURE__ */ W("div", {
|
|
532
|
+
ref: D,
|
|
533
|
+
className: "dc:max-h-40 dc:overflow-y-auto",
|
|
534
|
+
children: ce ? /* @__PURE__ */ W("div", {
|
|
535
|
+
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
536
|
+
children: "Loading..."
|
|
537
|
+
}) : B ? /* @__PURE__ */ G("div", {
|
|
538
|
+
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-error",
|
|
539
|
+
children: ["Error: ", B]
|
|
540
|
+
}) : L.length === 0 ? /* @__PURE__ */ W("div", {
|
|
541
|
+
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
542
|
+
children: "No values found"
|
|
543
|
+
}) : L.map((e, t) => {
|
|
544
|
+
let n = a.values?.includes(e);
|
|
545
|
+
return /* @__PURE__ */ G("button", {
|
|
546
|
+
onClick: (t) => de(e, t),
|
|
547
|
+
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm dc:transition-colors ${t === T ? "bg-dc-surface-hover" : ""} ${n ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text hover:bg-dc-surface-hover"}`,
|
|
548
|
+
children: [String(e), n && /* @__PURE__ */ W("span", {
|
|
549
|
+
className: "dc:float-right",
|
|
550
|
+
children: "✓"
|
|
551
|
+
})]
|
|
552
|
+
}, `${e}-${t}`);
|
|
553
|
+
})
|
|
554
|
+
})]
|
|
555
|
+
})]
|
|
556
|
+
}),
|
|
557
|
+
F?.supportsMultipleValues && /* @__PURE__ */ W("p", {
|
|
558
|
+
className: "dc:text-xs text-dc-text-muted",
|
|
559
|
+
children: "Hold Shift to select multiple values"
|
|
560
|
+
})
|
|
561
|
+
]
|
|
562
|
+
}) : /* @__PURE__ */ W("input", {
|
|
563
|
+
type: "text",
|
|
564
|
+
value: a.values?.[0] ?? "",
|
|
565
|
+
onChange: me,
|
|
566
|
+
placeholder: "Enter value...",
|
|
567
|
+
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text placeholder-dc-text-muted"
|
|
568
|
+
}) : /* @__PURE__ */ W("div", {
|
|
569
|
+
className: "dc:text-sm text-dc-text-muted dc:italic dc:py-2",
|
|
570
|
+
children: "No value required"
|
|
571
|
+
});
|
|
572
|
+
return /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W("div", {
|
|
573
|
+
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${C ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
|
|
574
|
+
onClick: r,
|
|
575
|
+
children: /* @__PURE__ */ G("div", {
|
|
576
|
+
ref: re,
|
|
577
|
+
className: C ? "bg-dc-surface rounded-lg border border-dc-border" : "bg-dc-surface rounded-lg border border-dc-border max-w-md w-full",
|
|
578
|
+
style: {
|
|
579
|
+
...C ? {
|
|
580
|
+
position: "fixed",
|
|
581
|
+
...C,
|
|
582
|
+
maxWidth: "400px",
|
|
583
|
+
width: "100%"
|
|
584
|
+
} : {},
|
|
585
|
+
boxShadow: "var(--dc-shadow-xl)"
|
|
586
|
+
},
|
|
587
|
+
onClick: (e) => e.stopPropagation(),
|
|
588
|
+
children: [
|
|
589
|
+
/* @__PURE__ */ G("div", {
|
|
590
|
+
className: "dc:flex dc:items-center dc:justify-between dc:p-4 dc:border-b border-dc-border",
|
|
591
|
+
children: [/* @__PURE__ */ W("h2", {
|
|
592
|
+
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
593
|
+
children: "Edit Filter"
|
|
594
|
+
}), /* @__PURE__ */ W("button", {
|
|
595
|
+
onClick: r,
|
|
596
|
+
className: "dc:p-1 text-dc-text-muted hover:text-dc-text dc:transition-colors",
|
|
597
|
+
children: /* @__PURE__ */ W(_e, { className: "dc:w-5 dc:h-5" })
|
|
598
|
+
})]
|
|
599
|
+
}),
|
|
600
|
+
/* @__PURE__ */ G("div", {
|
|
601
|
+
className: "dc:p-4 dc:space-y-4",
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("label", {
|
|
604
|
+
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
605
|
+
children: "Field"
|
|
606
|
+
}), /* @__PURE__ */ G("div", {
|
|
607
|
+
className: "dc:flex dc:items-center dc:gap-2 dc:p-3 bg-dc-surface-secondary dc:rounded",
|
|
608
|
+
children: [/* @__PURE__ */ W(Te, { className: "dc:w-5 dc:h-5 text-dc-filter-text" }), /* @__PURE__ */ W("span", {
|
|
609
|
+
className: "dc:text-sm dc:font-medium text-dc-text",
|
|
610
|
+
children: ae
|
|
611
|
+
})]
|
|
612
|
+
})] }),
|
|
613
|
+
/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("label", {
|
|
614
|
+
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
615
|
+
children: "Operator"
|
|
616
|
+
}), /* @__PURE__ */ G("div", {
|
|
617
|
+
className: "dc:relative",
|
|
618
|
+
children: [/* @__PURE__ */ G("button", {
|
|
619
|
+
onClick: () => {
|
|
620
|
+
h(!1), v(!1), c(!s);
|
|
621
|
+
},
|
|
622
|
+
className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
623
|
+
children: [/* @__PURE__ */ W("span", {
|
|
624
|
+
className: "dc:truncate",
|
|
625
|
+
children: Ce
|
|
626
|
+
}), /* @__PURE__ */ W(ve, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${s ? "dc:rotate-180" : ""}` })]
|
|
627
|
+
}), s && /* @__PURE__ */ W("div", {
|
|
628
|
+
className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
|
|
629
|
+
children: oe.map((e) => /* @__PURE__ */ W("button", {
|
|
630
|
+
onClick: () => ue(e.operator),
|
|
631
|
+
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.operator === a.operator ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
|
|
632
|
+
children: e.label
|
|
633
|
+
}, e.operator))
|
|
634
|
+
})]
|
|
635
|
+
})] }),
|
|
636
|
+
/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("label", {
|
|
637
|
+
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
638
|
+
children: "Value"
|
|
639
|
+
}), Ee()] })
|
|
640
|
+
]
|
|
641
|
+
}),
|
|
642
|
+
/* @__PURE__ */ G("div", {
|
|
643
|
+
className: "dc:flex dc:items-center dc:justify-end dc:gap-2 dc:p-4 dc:border-t border-dc-border",
|
|
644
|
+
children: [/* @__PURE__ */ W("button", {
|
|
645
|
+
onClick: r,
|
|
646
|
+
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
647
|
+
children: "Cancel"
|
|
648
|
+
}), /* @__PURE__ */ W("button", {
|
|
649
|
+
onClick: () => n(a),
|
|
650
|
+
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-primary-content bg-dc-primary hover:bg-dc-primary-hover dc:rounded dc:transition-colors",
|
|
651
|
+
children: "Save"
|
|
652
|
+
})]
|
|
653
|
+
})
|
|
654
|
+
]
|
|
655
|
+
})
|
|
656
|
+
}) });
|
|
657
|
+
}
|
|
658
|
+
//#endregion
|
|
659
|
+
//#region src/client/components/AnalysisBuilder/AnalysisFilterItem.tsx
|
|
660
|
+
var be = c("close"), xe = c("dimension"), Se = c("timeDimension"), Ce = c("measure");
|
|
661
|
+
function we({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
662
|
+
let [i, a] = H(!1), o = V(null), s = O(e.member, t), c = (s?.field.type || "string") === "time", l = s?.fieldType === "measure", u = ie(e.member, t), d = f[e.operator], p = d?.label || e.operator, m = Te(e, d), h = c ? Se : l ? Ce : xe;
|
|
663
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G("div", {
|
|
664
|
+
className: "dc:flex dc:items-start dc:gap-2 dc:px-2 dc:py-1.5 bg-dc-surface-secondary dc:rounded-lg dc:group hover:bg-dc-surface-tertiary dc:transition-all dc:duration-150 dc:w-full",
|
|
665
|
+
children: [
|
|
666
|
+
/* @__PURE__ */ W("span", {
|
|
667
|
+
className: `dc:w-6 dc:h-6 dc:flex dc:items-center dc:justify-center dc:rounded ${c ? "bg-dc-time-dimension" : l ? "bg-dc-measure" : "bg-dc-dimension"} ${c ? "text-dc-time-dimension-text" : l ? "text-dc-measure-text" : "text-dc-dimension-text"} dc:flex-shrink-0 dc:mt-0.5`,
|
|
668
|
+
children: h && /* @__PURE__ */ W(h, { className: "dc:w-4 dc:h-4" })
|
|
669
|
+
}),
|
|
670
|
+
/* @__PURE__ */ W("button", {
|
|
671
|
+
ref: o,
|
|
672
|
+
onClick: () => a(!0),
|
|
673
|
+
className: "dc:flex-1 dc:min-w-0 dc:text-left",
|
|
674
|
+
title: `${u} ${p} ${m}`,
|
|
675
|
+
children: /* @__PURE__ */ G("div", {
|
|
676
|
+
className: "dc:text-sm text-dc-text dc:break-words",
|
|
677
|
+
children: [
|
|
678
|
+
/* @__PURE__ */ W("span", {
|
|
679
|
+
className: "dc:font-medium",
|
|
680
|
+
children: u
|
|
681
|
+
}),
|
|
682
|
+
/* @__PURE__ */ W("span", {
|
|
683
|
+
className: "text-dc-text-muted dc:mx-1",
|
|
684
|
+
children: p
|
|
685
|
+
}),
|
|
686
|
+
/* @__PURE__ */ W("span", {
|
|
687
|
+
className: "text-dc-primary",
|
|
688
|
+
children: m
|
|
689
|
+
})
|
|
690
|
+
]
|
|
691
|
+
})
|
|
692
|
+
}),
|
|
693
|
+
/* @__PURE__ */ W("button", {
|
|
694
|
+
onClick: n,
|
|
695
|
+
className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:opacity-100 dc:sm:opacity-0 dc:sm:group-hover:opacity-100 dc:transition-opacity dc:flex-shrink-0 dc:mt-0.5",
|
|
696
|
+
title: "Remove filter",
|
|
697
|
+
children: be && /* @__PURE__ */ W(be, { className: "dc:w-4 dc:h-4" })
|
|
698
|
+
})
|
|
699
|
+
]
|
|
700
|
+
}), i && /* @__PURE__ */ W(ye, {
|
|
701
|
+
filter: e,
|
|
702
|
+
schema: t,
|
|
703
|
+
onSave: (e) => {
|
|
704
|
+
r(e), a(!1);
|
|
705
|
+
},
|
|
706
|
+
onCancel: () => a(!1),
|
|
707
|
+
anchorElement: o.current
|
|
708
|
+
})] });
|
|
709
|
+
}
|
|
710
|
+
function Te(e, t) {
|
|
711
|
+
if (!t?.requiresValues) return "";
|
|
712
|
+
if (e.dateRange) return Array.isArray(e.dateRange) ? `${e.dateRange[0]} to ${e.dateRange[1]}` : e.dateRange;
|
|
713
|
+
let n = e.values || [];
|
|
714
|
+
return n.length === 0 ? "(empty)" : n.length === 1 ? String(n[0]) : n.length === 2 ? `${n[0]}, ${n[1]}` : `${n[0]}, ${n[1]}, +${n.length - 2} more`;
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
717
|
+
//#region src/client/components/AnalysisBuilder/AnalysisFilterGroup.tsx
|
|
718
|
+
var Ee = c("add"), De = c("close");
|
|
719
|
+
function Oe(e) {
|
|
720
|
+
return "member" in e && typeof e.member == "string";
|
|
721
|
+
}
|
|
722
|
+
function ke(e) {
|
|
723
|
+
return "type" in e && (e.type === "and" || e.type === "or");
|
|
724
|
+
}
|
|
725
|
+
function Ae({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
|
|
726
|
+
let [s, c] = H(!1), l = V(null);
|
|
727
|
+
z(() => {
|
|
728
|
+
let e = (e) => {
|
|
729
|
+
l.current && !l.current.contains(e.target) && c(!1);
|
|
730
|
+
};
|
|
731
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
732
|
+
}, []);
|
|
733
|
+
let u = R(() => {
|
|
734
|
+
let t = e.type === "and" ? "or" : "and";
|
|
735
|
+
n({
|
|
736
|
+
...e,
|
|
737
|
+
type: t
|
|
738
|
+
});
|
|
739
|
+
}, [e, n]), d = R((t, r) => {
|
|
740
|
+
let i = [...e.filters];
|
|
741
|
+
i[t] = r, n({
|
|
742
|
+
...e,
|
|
743
|
+
filters: i
|
|
744
|
+
});
|
|
745
|
+
}, [e, n]), f = R((t) => {
|
|
746
|
+
let i = e.filters.filter((e, n) => n !== t);
|
|
747
|
+
i.length === 0 ? r() : n({
|
|
748
|
+
...e,
|
|
749
|
+
filters: i
|
|
750
|
+
});
|
|
751
|
+
}, [
|
|
752
|
+
e,
|
|
753
|
+
n,
|
|
754
|
+
r,
|
|
755
|
+
a
|
|
756
|
+
]), p = R((t) => {
|
|
757
|
+
let r = {
|
|
758
|
+
type: t,
|
|
759
|
+
filters: []
|
|
760
|
+
};
|
|
761
|
+
n({
|
|
762
|
+
...e,
|
|
763
|
+
filters: [...e.filters, r]
|
|
764
|
+
}), c(!1);
|
|
765
|
+
}, [e, n]), m = R(() => {
|
|
766
|
+
i([]), c(!1);
|
|
767
|
+
}, [i]), h = R((e) => (t = []) => {
|
|
768
|
+
i([e, ...t]);
|
|
769
|
+
}, [i]), g = () => a % 2 == 0 ? "border-dc-border" : "border-dc-border dark:border-dc-border", _ = () => e.type === "and" ? "bg-dc-info-bg/50" : "bg-dc-warning-bg/50", v = e.filters.length, y = v === 1 ? "condition" : "conditions";
|
|
770
|
+
return /* @__PURE__ */ G("div", {
|
|
771
|
+
className: `dc:border ${g()} dc:rounded-lg bg-dc-surface dc:w-full`,
|
|
772
|
+
children: [/* @__PURE__ */ G("div", {
|
|
773
|
+
className: `dc:flex dc:items-center dc:justify-between dc:px-2 dc:py-1.5 dc:border-b border-dc-border/50 dc:rounded-t-lg ${_()}`,
|
|
774
|
+
children: [/* @__PURE__ */ G("div", {
|
|
775
|
+
className: "dc:flex dc:items-center dc:gap-2",
|
|
776
|
+
children: [/* @__PURE__ */ W("button", {
|
|
777
|
+
onClick: u,
|
|
778
|
+
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-semibold dc:rounded dc:transition-colors ${e.type === "and" ? "bg-dc-info-bg text-dc-info dc:hover:opacity-80" : "bg-dc-warning-bg text-dc-warning dc:hover:opacity-80"}`,
|
|
779
|
+
title: `Click to switch to ${e.type === "and" ? "OR" : "AND"}`,
|
|
780
|
+
children: e.type.toUpperCase()
|
|
781
|
+
}), /* @__PURE__ */ G("span", {
|
|
782
|
+
className: "dc:text-xs text-dc-text-muted",
|
|
783
|
+
children: [
|
|
784
|
+
v,
|
|
785
|
+
" ",
|
|
786
|
+
y
|
|
787
|
+
]
|
|
788
|
+
})]
|
|
789
|
+
}), /* @__PURE__ */ G("div", {
|
|
790
|
+
className: "dc:flex dc:items-center dc:gap-1",
|
|
791
|
+
children: [/* @__PURE__ */ G("div", {
|
|
792
|
+
className: "dc:relative",
|
|
793
|
+
ref: l,
|
|
794
|
+
children: [/* @__PURE__ */ W("button", {
|
|
795
|
+
onClick: () => c(!s),
|
|
796
|
+
className: "dc:p-1 text-dc-text-secondary hover:text-dc-primary hover:bg-dc-surface-hover dc:rounded dc:transition-colors",
|
|
797
|
+
title: "Add condition",
|
|
798
|
+
children: /* @__PURE__ */ W(Ee, { className: "dc:w-4 dc:h-4" })
|
|
799
|
+
}), s && /* @__PURE__ */ G("div", {
|
|
800
|
+
className: "dc:absolute dc:right-0 dc:mt-1 dc:z-40 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:py-1 dc:min-w-[120px]",
|
|
801
|
+
children: [
|
|
802
|
+
/* @__PURE__ */ W("button", {
|
|
803
|
+
onClick: m,
|
|
804
|
+
className: "dc:w-full dc:text-left dc:px-3 dc:py-1.5 dc:text-xs text-dc-text hover:bg-dc-surface-hover",
|
|
805
|
+
children: "Add Filter"
|
|
806
|
+
}),
|
|
807
|
+
/* @__PURE__ */ W("button", {
|
|
808
|
+
onClick: () => p("and"),
|
|
809
|
+
className: "dc:w-full dc:text-left dc:px-3 dc:py-1.5 dc:text-xs text-dc-text hover:bg-dc-surface-hover",
|
|
810
|
+
children: "Add AND Group"
|
|
811
|
+
}),
|
|
812
|
+
/* @__PURE__ */ W("button", {
|
|
813
|
+
onClick: () => p("or"),
|
|
814
|
+
className: "dc:w-full dc:text-left dc:px-3 dc:py-1.5 dc:text-xs text-dc-text hover:bg-dc-surface-hover",
|
|
815
|
+
children: "Add OR Group"
|
|
816
|
+
})
|
|
817
|
+
]
|
|
818
|
+
})]
|
|
819
|
+
}), !o && /* @__PURE__ */ W("button", {
|
|
820
|
+
onClick: r,
|
|
821
|
+
className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:transition-colors",
|
|
822
|
+
title: "Remove group",
|
|
823
|
+
children: /* @__PURE__ */ W(De, { className: "dc:w-4 dc:h-4" })
|
|
824
|
+
})]
|
|
825
|
+
})]
|
|
826
|
+
}), /* @__PURE__ */ W("div", {
|
|
827
|
+
className: "dc:p-1.5 dc:flex dc:flex-wrap dc:gap-2",
|
|
828
|
+
children: e.filters.length === 0 ? /* @__PURE__ */ G("div", {
|
|
829
|
+
className: "dc:text-center dc:py-3",
|
|
830
|
+
children: [/* @__PURE__ */ W("p", {
|
|
831
|
+
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
832
|
+
children: "No conditions in this group"
|
|
833
|
+
}), /* @__PURE__ */ W("button", {
|
|
834
|
+
onClick: () => i([]),
|
|
835
|
+
className: "dc:text-xs text-dc-primary dc:hover:underline",
|
|
836
|
+
children: "Add a filter"
|
|
837
|
+
})]
|
|
838
|
+
}) : e.filters.map((e, n) => Oe(e) ? /* @__PURE__ */ W(we, {
|
|
839
|
+
filter: e,
|
|
840
|
+
schema: t,
|
|
841
|
+
onUpdate: (e) => d(n, e),
|
|
842
|
+
onRemove: () => f(n)
|
|
843
|
+
}, `filter-${n}`) : ke(e) ? /* @__PURE__ */ W(Ae, {
|
|
844
|
+
group: e,
|
|
845
|
+
schema: t,
|
|
846
|
+
onUpdate: (e) => d(n, e),
|
|
847
|
+
onRemove: () => f(n),
|
|
848
|
+
onAddFilter: h(n),
|
|
849
|
+
depth: a + 1
|
|
850
|
+
}, `group-${n}`) : null)
|
|
851
|
+
})]
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region src/client/components/AnalysisBuilder/AnalysisFilterSection.tsx
|
|
856
|
+
var je = c("add");
|
|
857
|
+
function Me(e) {
|
|
858
|
+
return "member" in e && typeof e.member == "string";
|
|
859
|
+
}
|
|
860
|
+
function Ne(e) {
|
|
861
|
+
return "type" in e && (e.type === "and" || e.type === "or");
|
|
862
|
+
}
|
|
863
|
+
function Pe(e) {
|
|
864
|
+
let t = 0;
|
|
865
|
+
for (let n of e) Me(n) ? t++ : Ne(n) && (t += Pe(n.filters));
|
|
866
|
+
return t;
|
|
867
|
+
}
|
|
868
|
+
function Fe(e) {
|
|
869
|
+
let t = [];
|
|
870
|
+
for (let n of e) Me(n) ? t.push(n.member) : Ne(n) && t.push(...Fe(n.filters));
|
|
871
|
+
return t;
|
|
872
|
+
}
|
|
873
|
+
function Ie(e, t, n) {
|
|
874
|
+
if (t.length === 0) return e.length === 0 ? [n] : e.length === 1 && Me(e[0]) ? [{
|
|
875
|
+
type: "and",
|
|
876
|
+
filters: [e[0], n]
|
|
877
|
+
}] : e.length === 1 && Ne(e[0]) ? [{
|
|
878
|
+
...e[0],
|
|
879
|
+
filters: [...e[0].filters, n]
|
|
880
|
+
}] : [{
|
|
881
|
+
type: "and",
|
|
882
|
+
filters: [...e, n]
|
|
883
|
+
}];
|
|
884
|
+
let [r, ...i] = t, a = [...e], o = a[r];
|
|
885
|
+
return Ne(o) && (i.length === 0 ? a[r] = {
|
|
886
|
+
...o,
|
|
887
|
+
filters: [...o.filters, n]
|
|
888
|
+
} : a[r] = {
|
|
889
|
+
...o,
|
|
890
|
+
filters: Ie(o.filters, i, n)
|
|
891
|
+
}), a;
|
|
892
|
+
}
|
|
893
|
+
function Le({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dimensionsOnly: i = !1 }) {
|
|
894
|
+
let [a, o] = H(!1), [s, c] = H(!1), u = V([]), d = Pe(e), f = R((e) => {
|
|
895
|
+
e.preventDefault(), e.stopPropagation(), c(!0);
|
|
896
|
+
}, []), p = R((e) => {
|
|
897
|
+
e.preventDefault(), e.stopPropagation(), c(!1);
|
|
898
|
+
}, []), m = R((e) => {
|
|
899
|
+
e.preventDefault(), e.stopPropagation(), c(!1);
|
|
900
|
+
try {
|
|
901
|
+
let t = JSON.parse(e.dataTransfer.getData("text/plain"));
|
|
902
|
+
t.field && r && r(t.field);
|
|
903
|
+
} catch {}
|
|
904
|
+
}, [r]), h = Fe(e), g = R((t, r, i) => {
|
|
905
|
+
let a = t.type === "time", s = a ? "inDateRange" : "equals", c = {
|
|
906
|
+
member: t.name,
|
|
907
|
+
operator: s,
|
|
908
|
+
values: []
|
|
909
|
+
};
|
|
910
|
+
a && s === "inDateRange" && (c.dateRange = l("this_month")), n(Ie(e, u.current, c)), o(!1), u.current = [];
|
|
911
|
+
}, [e, n]), _ = R((t, r) => {
|
|
912
|
+
let i = [...e];
|
|
913
|
+
i[t] = r, n(i);
|
|
914
|
+
}, [e, n]), v = R((t) => {
|
|
915
|
+
let r = e.filter((e, n) => n !== t);
|
|
916
|
+
if (r.length === 1 && Ne(r[0])) {
|
|
917
|
+
let e = r[0];
|
|
918
|
+
if (e.filters.length === 1) {
|
|
919
|
+
n([e.filters[0]]);
|
|
920
|
+
return;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
n(r);
|
|
924
|
+
}, [e, n]), y = R(() => {
|
|
925
|
+
n([]);
|
|
926
|
+
}, [n]), b = R(() => {
|
|
927
|
+
u.current = [], o(!0);
|
|
928
|
+
}, []), x = R((e) => (t = []) => {
|
|
929
|
+
u.current = [...e, ...t], o(!0);
|
|
930
|
+
}, []), ee = (n, r, i = []) => {
|
|
931
|
+
let a = [...i, r];
|
|
932
|
+
return Me(n) ? /* @__PURE__ */ W(we, {
|
|
933
|
+
filter: n,
|
|
934
|
+
schema: t,
|
|
935
|
+
onUpdate: (e) => _(r, e),
|
|
936
|
+
onRemove: () => v(r)
|
|
937
|
+
}, `filter-${a.join("-")}`) : Ne(n) ? /* @__PURE__ */ W(Ae, {
|
|
938
|
+
group: n,
|
|
939
|
+
schema: t,
|
|
940
|
+
onUpdate: (e) => _(r, e),
|
|
941
|
+
onRemove: () => v(r),
|
|
942
|
+
onAddFilter: x(a),
|
|
943
|
+
hideRemoveButton: e.length === 1
|
|
944
|
+
}, `group-${a.join("-")}`) : null;
|
|
945
|
+
};
|
|
946
|
+
return /* @__PURE__ */ G("div", { children: [
|
|
947
|
+
/* @__PURE__ */ G("button", {
|
|
948
|
+
onClick: b,
|
|
949
|
+
className: "dc:flex dc:items-center dc:justify-between dc:mb-3 dc:w-full dc:py-1 dc:px-2 dc:-ml-2 dc:rounded-lg hover:bg-dc-primary/10 dc:transition-colors dc:group",
|
|
950
|
+
title: "Add filter",
|
|
951
|
+
children: [/* @__PURE__ */ G(oe, { children: ["Filter", d > 0 && /* @__PURE__ */ G("span", {
|
|
952
|
+
className: "dc:ml-1.5 dc:text-xs dc:font-normal text-dc-text-muted dc:normal-case dc:tracking-normal",
|
|
953
|
+
children: [
|
|
954
|
+
"(",
|
|
955
|
+
d,
|
|
956
|
+
")"
|
|
957
|
+
]
|
|
958
|
+
})] }), /* @__PURE__ */ G("div", {
|
|
959
|
+
className: "dc:flex dc:items-center dc:gap-2",
|
|
960
|
+
children: [d > 0 && /* @__PURE__ */ W("span", {
|
|
961
|
+
role: "button",
|
|
962
|
+
tabIndex: 0,
|
|
963
|
+
onClick: (e) => {
|
|
964
|
+
e.stopPropagation(), y();
|
|
965
|
+
},
|
|
966
|
+
onKeyDown: (e) => {
|
|
967
|
+
(e.key === "Enter" || e.key === " ") && (e.stopPropagation(), y());
|
|
968
|
+
},
|
|
969
|
+
className: "dc:text-xs text-dc-text-muted hover:text-dc-error dc:underline dc:cursor-pointer",
|
|
970
|
+
children: "Clear all"
|
|
971
|
+
}), /* @__PURE__ */ W(je, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })]
|
|
972
|
+
})]
|
|
973
|
+
}),
|
|
974
|
+
/* @__PURE__ */ W("div", {
|
|
975
|
+
onDragOver: r ? f : void 0,
|
|
976
|
+
onDragLeave: r ? p : void 0,
|
|
977
|
+
onDrop: r ? m : void 0,
|
|
978
|
+
className: `dc:p-2 dc:-mx-2 dc:rounded-lg dc:border-2 dc:border-dashed dc:transition-all ${s ? "border-dc-primary bg-dc-primary/5" : "border-transparent"}`,
|
|
979
|
+
children: e.length === 0 ? /* @__PURE__ */ W("p", {
|
|
980
|
+
className: `dc:text-sm ${s ? "text-dc-primary dc:font-medium" : "text-dc-text-muted"}`,
|
|
981
|
+
children: s ? "Drop to add filter" : "No filters applied"
|
|
982
|
+
}) : /* @__PURE__ */ W("div", {
|
|
983
|
+
className: "dc:flex dc:flex-wrap dc:gap-2",
|
|
984
|
+
children: e.map((e, t) => ee(e, t))
|
|
985
|
+
})
|
|
986
|
+
}),
|
|
987
|
+
/* @__PURE__ */ W(ae, {
|
|
988
|
+
isOpen: a,
|
|
989
|
+
onClose: () => {
|
|
990
|
+
o(!1), u.current = [];
|
|
991
|
+
},
|
|
992
|
+
onSelect: g,
|
|
993
|
+
mode: i ? "dimensionFilter" : "filter",
|
|
994
|
+
schema: t,
|
|
995
|
+
selectedFields: h
|
|
996
|
+
})
|
|
997
|
+
] });
|
|
998
|
+
}
|
|
999
|
+
//#endregion
|
|
218
1000
|
//#region src/client/shared/chartDefaults.ts
|
|
219
|
-
function
|
|
1001
|
+
function Re(e) {
|
|
220
1002
|
return e.isTimeDimension;
|
|
221
1003
|
}
|
|
222
|
-
function
|
|
223
|
-
return e.find(
|
|
1004
|
+
function ze(e) {
|
|
1005
|
+
return e.find(Re);
|
|
224
1006
|
}
|
|
225
|
-
function
|
|
1007
|
+
function Be(e) {
|
|
226
1008
|
return e.find((e) => !e.isTimeDimension);
|
|
227
1009
|
}
|
|
228
|
-
function
|
|
1010
|
+
function Ve(e) {
|
|
229
1011
|
return e.filter((e) => !e.isTimeDimension);
|
|
230
1012
|
}
|
|
231
|
-
function
|
|
232
|
-
return e.filter(
|
|
1013
|
+
function He(e) {
|
|
1014
|
+
return e.filter(Re);
|
|
233
1015
|
}
|
|
234
|
-
function
|
|
235
|
-
let r = t.length, i =
|
|
1016
|
+
function Ue(e, t, n) {
|
|
1017
|
+
let r = t.length, i = Ve(n).length, a = He(n).length, o = n.length;
|
|
236
1018
|
switch (e) {
|
|
237
1019
|
case "table":
|
|
238
1020
|
case "markdown": return { available: !0 };
|
|
@@ -315,7 +1097,7 @@ function W(e, t, n) {
|
|
|
315
1097
|
default: return { available: !0 };
|
|
316
1098
|
}
|
|
317
1099
|
}
|
|
318
|
-
function
|
|
1100
|
+
function We(e, t) {
|
|
319
1101
|
let n = [
|
|
320
1102
|
"activityGrid",
|
|
321
1103
|
"area",
|
|
@@ -333,23 +1115,23 @@ function me(e, t) {
|
|
|
333
1115
|
"table",
|
|
334
1116
|
"treemap"
|
|
335
1117
|
], r = {};
|
|
336
|
-
for (let i of n) r[i] =
|
|
1118
|
+
for (let i of n) r[i] = Ue(i, e, t);
|
|
337
1119
|
return r;
|
|
338
1120
|
}
|
|
339
|
-
function
|
|
340
|
-
if (
|
|
341
|
-
let r =
|
|
1121
|
+
function Ge(e, t, n) {
|
|
1122
|
+
if (Ue(n, e, t).available || e.length === 0 && t.length === 0) return n;
|
|
1123
|
+
let r = He(t).length > 0, i = Ve(t).length > 0, a = e.length > 0;
|
|
342
1124
|
return r && a ? "line" : i && a ? "bar" : a && !i && !r ? "kpiNumber" : "table";
|
|
343
1125
|
}
|
|
344
|
-
function
|
|
345
|
-
let r =
|
|
1126
|
+
function Ke(e, t, n) {
|
|
1127
|
+
let r = Ge(e, t, n);
|
|
346
1128
|
return {
|
|
347
1129
|
chartType: r,
|
|
348
|
-
chartConfig:
|
|
1130
|
+
chartConfig: qe(r, e, t)
|
|
349
1131
|
};
|
|
350
1132
|
}
|
|
351
|
-
function
|
|
352
|
-
let r =
|
|
1133
|
+
function qe(e, t, n) {
|
|
1134
|
+
let r = ze(n), i = Be(n), a = Ve(n), o = n;
|
|
353
1135
|
switch (e) {
|
|
354
1136
|
case "line":
|
|
355
1137
|
case "area": return {
|
|
@@ -402,35 +1184,35 @@ function _e(e, t, n) {
|
|
|
402
1184
|
};
|
|
403
1185
|
}
|
|
404
1186
|
}
|
|
405
|
-
function
|
|
406
|
-
if (r &&
|
|
407
|
-
let i =
|
|
1187
|
+
function Je(e, t, n, r) {
|
|
1188
|
+
if (r && Ue(n, e, t).available) return null;
|
|
1189
|
+
let i = Ge(e, t, n);
|
|
408
1190
|
return i === n ? null : i;
|
|
409
1191
|
}
|
|
410
1192
|
//#endregion
|
|
411
1193
|
//#region src/client/components/AnalysisBuilder/ExplainAIPanel.tsx
|
|
412
|
-
function
|
|
1194
|
+
function Ye(e) {
|
|
413
1195
|
return typeof e == "string" ? e : typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "");
|
|
414
1196
|
}
|
|
415
|
-
var
|
|
1197
|
+
var Xe = {
|
|
416
1198
|
good: "bg-dc-success-bg text-dc-success border-dc-success",
|
|
417
1199
|
warning: "bg-dc-warning-bg text-dc-warning border-dc-warning",
|
|
418
1200
|
critical: "bg-dc-danger-bg text-dc-error border-dc-error"
|
|
419
|
-
},
|
|
1201
|
+
}, Ze = {
|
|
420
1202
|
critical: "bg-dc-danger-bg text-dc-error",
|
|
421
1203
|
warning: "bg-dc-warning-bg text-dc-warning",
|
|
422
1204
|
suggestion: "bg-dc-accent-bg text-dc-accent"
|
|
423
|
-
},
|
|
1205
|
+
}, Qe = {
|
|
424
1206
|
high: "text-dc-error",
|
|
425
1207
|
medium: "text-dc-warning",
|
|
426
1208
|
low: "text-dc-text-muted"
|
|
427
1209
|
};
|
|
428
|
-
function
|
|
429
|
-
return /* @__PURE__ */
|
|
430
|
-
className: `dc:p-4 dc:rounded-lg dc:border ${
|
|
431
|
-
children: [/* @__PURE__ */
|
|
1210
|
+
function $e({ assessment: e, reason: t }) {
|
|
1211
|
+
return /* @__PURE__ */ G("div", {
|
|
1212
|
+
className: `dc:p-4 dc:rounded-lg dc:border ${Xe[e]}`,
|
|
1213
|
+
children: [/* @__PURE__ */ W("div", {
|
|
432
1214
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-1",
|
|
433
|
-
children: /* @__PURE__ */
|
|
1215
|
+
children: /* @__PURE__ */ G("span", {
|
|
434
1216
|
className: "dc:font-semibold dc:uppercase dc:text-base",
|
|
435
1217
|
children: [
|
|
436
1218
|
e === "good" && "✓ ",
|
|
@@ -443,33 +1225,33 @@ function J({ assessment: e, reason: t }) {
|
|
|
443
1225
|
}[e]
|
|
444
1226
|
]
|
|
445
1227
|
})
|
|
446
|
-
}), /* @__PURE__ */
|
|
1228
|
+
}), /* @__PURE__ */ W("p", {
|
|
447
1229
|
className: "dc:text-sm",
|
|
448
|
-
children:
|
|
1230
|
+
children: Ye(t)
|
|
449
1231
|
})]
|
|
450
1232
|
});
|
|
451
1233
|
}
|
|
452
|
-
function
|
|
453
|
-
return /* @__PURE__ */
|
|
1234
|
+
function et({ issue: e }) {
|
|
1235
|
+
return /* @__PURE__ */ G("div", {
|
|
454
1236
|
className: "dc:flex dc:items-start dc:gap-2 dc:py-2",
|
|
455
|
-
children: [/* @__PURE__ */
|
|
456
|
-
className: `dc:text-sm ${
|
|
1237
|
+
children: [/* @__PURE__ */ G("span", {
|
|
1238
|
+
className: `dc:text-sm ${Qe[e.severity]}`,
|
|
457
1239
|
children: [
|
|
458
1240
|
e.severity === "high" && "●",
|
|
459
1241
|
e.severity === "medium" && "○",
|
|
460
1242
|
e.severity === "low" && "○"
|
|
461
1243
|
]
|
|
462
|
-
}), /* @__PURE__ */
|
|
1244
|
+
}), /* @__PURE__ */ W("span", {
|
|
463
1245
|
className: "dc:text-sm text-dc-text-secondary",
|
|
464
|
-
children:
|
|
1246
|
+
children: Ye(e.description)
|
|
465
1247
|
})]
|
|
466
1248
|
});
|
|
467
1249
|
}
|
|
468
|
-
function
|
|
469
|
-
let [t, n] =
|
|
470
|
-
return
|
|
1250
|
+
function tt({ text: e }) {
|
|
1251
|
+
let [t, n] = I.useState(!1), r = I.useRef(null);
|
|
1252
|
+
return I.useEffect(() => () => {
|
|
471
1253
|
r.current && clearTimeout(r.current);
|
|
472
|
-
}, []), /* @__PURE__ */
|
|
1254
|
+
}, []), /* @__PURE__ */ W("button", {
|
|
473
1255
|
onClick: async () => {
|
|
474
1256
|
try {
|
|
475
1257
|
await navigator.clipboard.writeText(e), n(!0), r.current && clearTimeout(r.current), r.current = setTimeout(() => n(!1), 2e3);
|
|
@@ -482,110 +1264,110 @@ function xe({ text: e }) {
|
|
|
482
1264
|
children: t ? "Copied!" : "Copy"
|
|
483
1265
|
});
|
|
484
1266
|
}
|
|
485
|
-
function
|
|
486
|
-
return /* @__PURE__ */
|
|
1267
|
+
function nt({ rec: e }) {
|
|
1268
|
+
return /* @__PURE__ */ G("div", {
|
|
487
1269
|
className: "dc:p-4 dc:border border-dc-border dc:rounded-lg bg-dc-surface",
|
|
488
1270
|
children: [
|
|
489
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ G("div", {
|
|
490
1272
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-2",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
492
|
-
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${
|
|
1273
|
+
children: [/* @__PURE__ */ W("span", {
|
|
1274
|
+
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${Ze[e.severity]}`,
|
|
493
1275
|
children: {
|
|
494
1276
|
index: "INDEX",
|
|
495
1277
|
table: "TABLE",
|
|
496
1278
|
cube: "CUBE",
|
|
497
1279
|
general: "TIP"
|
|
498
1280
|
}[e.type]
|
|
499
|
-
}), /* @__PURE__ */
|
|
1281
|
+
}), /* @__PURE__ */ W("h5", {
|
|
500
1282
|
className: "dc:font-medium text-dc-text",
|
|
501
|
-
children:
|
|
1283
|
+
children: Ye(e.title)
|
|
502
1284
|
})]
|
|
503
1285
|
}),
|
|
504
|
-
/* @__PURE__ */
|
|
1286
|
+
/* @__PURE__ */ W("p", {
|
|
505
1287
|
className: "dc:text-sm text-dc-text-secondary dc:mb-3",
|
|
506
|
-
children:
|
|
1288
|
+
children: Ye(e.description)
|
|
507
1289
|
}),
|
|
508
|
-
e.sql && /* @__PURE__ */
|
|
1290
|
+
e.sql && /* @__PURE__ */ W("div", {
|
|
509
1291
|
className: "dc:mt-2",
|
|
510
|
-
children: /* @__PURE__ */
|
|
1292
|
+
children: /* @__PURE__ */ W(j, {
|
|
511
1293
|
code: e.sql,
|
|
512
1294
|
language: "sql",
|
|
513
|
-
headerRight: /* @__PURE__ */
|
|
1295
|
+
headerRight: /* @__PURE__ */ W(tt, { text: e.sql })
|
|
514
1296
|
})
|
|
515
1297
|
}),
|
|
516
|
-
e.cubeCode && /* @__PURE__ */
|
|
1298
|
+
e.cubeCode && /* @__PURE__ */ G("div", {
|
|
517
1299
|
className: "dc:mt-2",
|
|
518
|
-
children: [e.cubeName && /* @__PURE__ */
|
|
1300
|
+
children: [e.cubeName && /* @__PURE__ */ G("p", {
|
|
519
1301
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
520
1302
|
children: [
|
|
521
1303
|
"Add to ",
|
|
522
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ W("code", {
|
|
523
1305
|
className: "bg-dc-surface-secondary dc:px-1 dc:rounded",
|
|
524
1306
|
children: e.cubeName
|
|
525
1307
|
}),
|
|
526
1308
|
" cube:"
|
|
527
1309
|
]
|
|
528
|
-
}), /* @__PURE__ */
|
|
1310
|
+
}), /* @__PURE__ */ G("div", {
|
|
529
1311
|
className: "dc:relative",
|
|
530
|
-
children: [/* @__PURE__ */
|
|
1312
|
+
children: [/* @__PURE__ */ W("pre", {
|
|
531
1313
|
className: "dc:p-3 dc:text-xs bg-dc-surface-secondary dc:rounded dc:overflow-x-auto dc:font-mono text-dc-text",
|
|
532
1314
|
children: e.cubeCode
|
|
533
|
-
}), /* @__PURE__ */
|
|
1315
|
+
}), /* @__PURE__ */ W("div", {
|
|
534
1316
|
className: "dc:absolute dc:top-1 dc:right-1",
|
|
535
|
-
children: /* @__PURE__ */
|
|
1317
|
+
children: /* @__PURE__ */ W(tt, { text: e.cubeCode })
|
|
536
1318
|
})]
|
|
537
1319
|
})]
|
|
538
1320
|
}),
|
|
539
|
-
e.estimatedImpact && /* @__PURE__ */
|
|
1321
|
+
e.estimatedImpact && /* @__PURE__ */ G("p", {
|
|
540
1322
|
className: "dc:text-xs text-dc-text-muted dc:mt-2",
|
|
541
1323
|
children: [
|
|
542
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ W("strong", { children: "Expected impact:" }),
|
|
543
1325
|
" ",
|
|
544
|
-
|
|
1326
|
+
Ye(e.estimatedImpact)
|
|
545
1327
|
]
|
|
546
1328
|
})
|
|
547
1329
|
]
|
|
548
1330
|
});
|
|
549
1331
|
}
|
|
550
|
-
function
|
|
1332
|
+
function rt({ analysis: e, onClose: t, onClear: n }) {
|
|
551
1333
|
let r = t || n;
|
|
552
|
-
return
|
|
1334
|
+
return I.useEffect(() => {
|
|
553
1335
|
let e = (e) => {
|
|
554
1336
|
e.key === "Escape" && r && r();
|
|
555
1337
|
};
|
|
556
1338
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
557
|
-
}, [r]),
|
|
1339
|
+
}, [r]), I.useEffect(() => (document.body.style.overflow = "hidden", () => {
|
|
558
1340
|
document.body.style.overflow = "";
|
|
559
|
-
}), []), /* @__PURE__ */
|
|
1341
|
+
}), []), /* @__PURE__ */ G("div", {
|
|
560
1342
|
className: "dc:fixed dc:inset-0 dc:z-50 dc:flex dc:items-center dc:justify-center dc:p-4 bg-black/50",
|
|
561
|
-
children: [/* @__PURE__ */
|
|
1343
|
+
children: [/* @__PURE__ */ W("div", {
|
|
562
1344
|
className: "dc:absolute dc:inset-0",
|
|
563
1345
|
onClick: r,
|
|
564
1346
|
"aria-hidden": "true"
|
|
565
|
-
}), /* @__PURE__ */
|
|
1347
|
+
}), /* @__PURE__ */ G("div", {
|
|
566
1348
|
className: "dc:relative dc:w-full dc:max-w-4xl dc:max-h-[90vh] bg-dc-surface dc:rounded-lg dc:shadow-xl dc:flex dc:flex-col",
|
|
567
1349
|
children: [
|
|
568
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ G("div", {
|
|
569
1351
|
className: "dc:flex dc:items-center dc:justify-between dc:px-6 dc:py-4 dc:border-b border-dc-border dc:flex-shrink-0",
|
|
570
|
-
children: [/* @__PURE__ */
|
|
1352
|
+
children: [/* @__PURE__ */ G("div", {
|
|
571
1353
|
className: "dc:flex dc:items-center dc:gap-3",
|
|
572
|
-
children: [/* @__PURE__ */
|
|
1354
|
+
children: [/* @__PURE__ */ W("span", {
|
|
573
1355
|
className: "dc:text-lg",
|
|
574
1356
|
children: "✨"
|
|
575
|
-
}), /* @__PURE__ */
|
|
1357
|
+
}), /* @__PURE__ */ W("h3", {
|
|
576
1358
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
577
1359
|
children: "AI Performance Analysis"
|
|
578
1360
|
})]
|
|
579
|
-
}), /* @__PURE__ */
|
|
1361
|
+
}), /* @__PURE__ */ W("button", {
|
|
580
1362
|
onClick: r,
|
|
581
1363
|
className: "dc:p-2 dc:rounded-lg hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
582
1364
|
"aria-label": "Close",
|
|
583
|
-
children: /* @__PURE__ */
|
|
1365
|
+
children: /* @__PURE__ */ W("svg", {
|
|
584
1366
|
className: "dc:w-5 dc:h-5",
|
|
585
1367
|
fill: "none",
|
|
586
1368
|
stroke: "currentColor",
|
|
587
1369
|
viewBox: "0 0 24 24",
|
|
588
|
-
children: /* @__PURE__ */
|
|
1370
|
+
children: /* @__PURE__ */ W("path", {
|
|
589
1371
|
strokeLinecap: "round",
|
|
590
1372
|
strokeLinejoin: "round",
|
|
591
1373
|
strokeWidth: 2,
|
|
@@ -594,65 +1376,65 @@ function Ce({ analysis: e, onClose: t, onClear: n }) {
|
|
|
594
1376
|
})
|
|
595
1377
|
})]
|
|
596
1378
|
}),
|
|
597
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ G("div", {
|
|
598
1380
|
className: "dc:flex-1 dc:overflow-y-auto dc:px-6 dc:py-4 dc:space-y-6",
|
|
599
1381
|
children: [
|
|
600
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ W($e, {
|
|
601
1383
|
assessment: e.assessment,
|
|
602
1384
|
reason: e.assessmentReason
|
|
603
1385
|
}),
|
|
604
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h4", {
|
|
605
1387
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
606
1388
|
children: "Summary"
|
|
607
|
-
}), /* @__PURE__ */
|
|
1389
|
+
}), /* @__PURE__ */ W("p", {
|
|
608
1390
|
className: "text-dc-text",
|
|
609
|
-
children:
|
|
1391
|
+
children: Ye(e.summary)
|
|
610
1392
|
})] }),
|
|
611
|
-
e.queryUnderstanding && /* @__PURE__ */
|
|
1393
|
+
e.queryUnderstanding && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h4", {
|
|
612
1394
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
613
1395
|
children: "Query Analysis"
|
|
614
|
-
}), /* @__PURE__ */
|
|
1396
|
+
}), /* @__PURE__ */ W("p", {
|
|
615
1397
|
className: "text-dc-text-secondary",
|
|
616
|
-
children:
|
|
1398
|
+
children: Ye(e.queryUnderstanding)
|
|
617
1399
|
})] }),
|
|
618
|
-
e.issues && e.issues.length > 0 && /* @__PURE__ */
|
|
1400
|
+
e.issues && e.issues.length > 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("h4", {
|
|
619
1401
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
620
1402
|
children: [
|
|
621
1403
|
"Issues Found (",
|
|
622
1404
|
e.issues.length,
|
|
623
1405
|
")"
|
|
624
1406
|
]
|
|
625
|
-
}), /* @__PURE__ */
|
|
1407
|
+
}), /* @__PURE__ */ W("div", {
|
|
626
1408
|
className: "dc:space-y-1 bg-dc-surface-secondary dc:rounded-lg dc:p-3",
|
|
627
|
-
children: e.issues.map((e, t) => /* @__PURE__ */
|
|
1409
|
+
children: e.issues.map((e, t) => /* @__PURE__ */ W(et, { issue: e }, t))
|
|
628
1410
|
})] }),
|
|
629
|
-
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */
|
|
1411
|
+
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ G("h4", {
|
|
630
1412
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-3",
|
|
631
1413
|
children: [
|
|
632
1414
|
"Recommendations (",
|
|
633
1415
|
e.recommendations.length,
|
|
634
1416
|
")"
|
|
635
1417
|
]
|
|
636
|
-
}), /* @__PURE__ */
|
|
1418
|
+
}), /* @__PURE__ */ W("div", {
|
|
637
1419
|
className: "dc:space-y-4",
|
|
638
|
-
children: e.recommendations.map((e, t) => /* @__PURE__ */
|
|
1420
|
+
children: e.recommendations.map((e, t) => /* @__PURE__ */ W(nt, { rec: e }, t))
|
|
639
1421
|
})] }),
|
|
640
|
-
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */
|
|
1422
|
+
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */ W("div", {
|
|
641
1423
|
className: "text-dc-text-muted dc:italic dc:p-4 bg-dc-surface-secondary dc:rounded-lg",
|
|
642
1424
|
children: "No specific recommendations. The query appears to be well-optimized."
|
|
643
1425
|
})
|
|
644
1426
|
]
|
|
645
1427
|
}),
|
|
646
|
-
/* @__PURE__ */
|
|
1428
|
+
/* @__PURE__ */ G("div", {
|
|
647
1429
|
className: "dc:flex dc:items-center dc:justify-between dc:px-6 dc:py-3 dc:border-t border-dc-border dc:flex-shrink-0 bg-dc-surface-secondary",
|
|
648
|
-
children: [e._meta && /* @__PURE__ */
|
|
1430
|
+
children: [e._meta && /* @__PURE__ */ G("div", {
|
|
649
1431
|
className: "dc:text-xs text-dc-text-muted",
|
|
650
1432
|
children: [
|
|
651
1433
|
"Model: ",
|
|
652
1434
|
e._meta.model,
|
|
653
1435
|
e._meta.usingUserKey && " (using your API key)"
|
|
654
1436
|
]
|
|
655
|
-
}), /* @__PURE__ */
|
|
1437
|
+
}), /* @__PURE__ */ W("button", {
|
|
656
1438
|
onClick: r,
|
|
657
1439
|
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium dc:rounded-lg bg-dc-primary text-white hover:bg-dc-primary-hover dc:transition-colors",
|
|
658
1440
|
children: "Close"
|
|
@@ -664,93 +1446,93 @@ function Ce({ analysis: e, onClose: t, onClear: n }) {
|
|
|
664
1446
|
}
|
|
665
1447
|
//#endregion
|
|
666
1448
|
//#region src/client/components/AnalysisBuilder/ExecutionPlanPanel.tsx
|
|
667
|
-
var
|
|
668
|
-
let [v, y] =
|
|
1449
|
+
var it = L(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r = "Add metrics to generate SQL", explainResult: i, explainLoading: a = !1, explainHasRun: o = !1, explainError: s, runExplain: c, aiAnalysis: l, aiAnalysisLoading: u = !1, aiAnalysisError: d, runAIAnalysis: f, clearAIAnalysis: p, enableAI: m = !1, query: h, title: g = "Generated SQL", height: _ = "16rem" }) {
|
|
1450
|
+
let [v, y] = H(!1), [b, x] = H(!1), ee = e ? e.sql + (e.params && e.params.length > 0 ? "\n\n-- Parameters:\n" + JSON.stringify(e.params, null, 2) : "") : "", te = () => {
|
|
669
1451
|
f && i && h && (f(i, h), x(!0));
|
|
670
|
-
},
|
|
1452
|
+
}, S = () => {
|
|
671
1453
|
x(!1);
|
|
672
|
-
},
|
|
673
|
-
onClick:
|
|
1454
|
+
}, ne = m && i ? /* @__PURE__ */ W("button", {
|
|
1455
|
+
onClick: te,
|
|
674
1456
|
disabled: u,
|
|
675
1457
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded bg-dc-accent text-white hover:bg-dc-accent-hover dc:disabled:opacity-50 dc:disabled:cursor-not-allowed dc:flex dc:items-center dc:gap-1",
|
|
676
|
-
children: u ? /* @__PURE__ */
|
|
1458
|
+
children: u ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("span", {
|
|
677
1459
|
className: "dc:animate-spin",
|
|
678
1460
|
children: "⟳"
|
|
679
|
-
}), "Analyzing..."] }) : /* @__PURE__ */
|
|
1461
|
+
}), "Analyzing..."] }) : /* @__PURE__ */ W(U, { children: "✨ AI Analysis" })
|
|
680
1462
|
}) : null;
|
|
681
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ G("div", {
|
|
682
1464
|
className: "dc:space-y-3",
|
|
683
1465
|
children: [
|
|
684
|
-
t ? /* @__PURE__ */
|
|
1466
|
+
t ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("h4", {
|
|
685
1467
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
686
1468
|
children: g
|
|
687
|
-
}), /* @__PURE__ */
|
|
1469
|
+
}), /* @__PURE__ */ W("div", {
|
|
688
1470
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
|
|
689
1471
|
style: { height: _ },
|
|
690
1472
|
children: "Loading SQL..."
|
|
691
|
-
})] }) : n ? /* @__PURE__ */
|
|
1473
|
+
})] }) : n ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("h4", {
|
|
692
1474
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
693
1475
|
children: g
|
|
694
|
-
}), /* @__PURE__ */
|
|
1476
|
+
}), /* @__PURE__ */ W("div", {
|
|
695
1477
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
696
1478
|
style: { height: _ },
|
|
697
1479
|
children: n.message
|
|
698
|
-
})] }) : e ? /* @__PURE__ */
|
|
699
|
-
code:
|
|
1480
|
+
})] }) : e ? /* @__PURE__ */ W(j, {
|
|
1481
|
+
code: ee,
|
|
700
1482
|
language: "sql",
|
|
701
1483
|
title: g,
|
|
702
1484
|
height: _,
|
|
703
|
-
headerRight: /* @__PURE__ */
|
|
1485
|
+
headerRight: /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G("label", {
|
|
704
1486
|
className: "dc:flex dc:items-center dc:gap-1 dc:text-xs text-dc-text-secondary dc:cursor-pointer",
|
|
705
|
-
children: [/* @__PURE__ */
|
|
1487
|
+
children: [/* @__PURE__ */ W("input", {
|
|
706
1488
|
type: "checkbox",
|
|
707
1489
|
checked: v,
|
|
708
1490
|
onChange: (e) => y(e.target.checked),
|
|
709
1491
|
className: "dc:w-3 dc:h-3 dc:rounded border-dc-border text-dc-accent focus:ring-dc-accent"
|
|
710
1492
|
}), "Include timing"]
|
|
711
|
-
}), /* @__PURE__ */
|
|
1493
|
+
}), /* @__PURE__ */ W("button", {
|
|
712
1494
|
onClick: () => c({ analyze: v }),
|
|
713
1495
|
disabled: a,
|
|
714
1496
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded dc:border border-dc-border bg-dc-surface hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors dc:disabled:opacity-50 dc:disabled:cursor-not-allowed",
|
|
715
1497
|
children: a ? "Running..." : "Explain Plan"
|
|
716
1498
|
})] })
|
|
717
|
-
}) : /* @__PURE__ */
|
|
1499
|
+
}) : /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("h4", {
|
|
718
1500
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
719
1501
|
children: g
|
|
720
|
-
}), /* @__PURE__ */
|
|
1502
|
+
}), /* @__PURE__ */ W("div", {
|
|
721
1503
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm",
|
|
722
1504
|
style: { height: _ },
|
|
723
1505
|
children: r
|
|
724
1506
|
})] }),
|
|
725
|
-
o && /* @__PURE__ */
|
|
1507
|
+
o && /* @__PURE__ */ W("div", { children: a ? /* @__PURE__ */ G("div", {
|
|
726
1508
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
|
|
727
1509
|
children: [
|
|
728
1510
|
"Running EXPLAIN",
|
|
729
1511
|
v ? " ANALYZE" : "",
|
|
730
1512
|
"..."
|
|
731
1513
|
]
|
|
732
|
-
}) : s ? /* @__PURE__ */
|
|
1514
|
+
}) : s ? /* @__PURE__ */ G("div", {
|
|
733
1515
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
734
1516
|
children: [
|
|
735
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ W("strong", { children: "Explain Error:" }),
|
|
736
1518
|
" ",
|
|
737
1519
|
s.message
|
|
738
1520
|
]
|
|
739
|
-
}) : i ? /* @__PURE__ */
|
|
1521
|
+
}) : i ? /* @__PURE__ */ G("div", {
|
|
740
1522
|
className: "dc:space-y-3",
|
|
741
1523
|
children: [
|
|
742
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ G("div", {
|
|
743
1525
|
className: "dc:flex dc:flex-wrap dc:items-center dc:gap-2",
|
|
744
1526
|
children: [
|
|
745
|
-
/* @__PURE__ */
|
|
1527
|
+
/* @__PURE__ */ W("span", {
|
|
746
1528
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-accent text-white dc:rounded",
|
|
747
1529
|
children: i.summary.database.toUpperCase()
|
|
748
1530
|
}),
|
|
749
|
-
i.summary.hasSequentialScans && /* @__PURE__ */
|
|
1531
|
+
i.summary.hasSequentialScans && /* @__PURE__ */ W("span", {
|
|
750
1532
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-warning-bg text-dc-warning dc:border border-dc-warning dc:rounded",
|
|
751
1533
|
children: "Sequential Scans Detected"
|
|
752
1534
|
}),
|
|
753
|
-
i.summary.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1535
|
+
i.summary.usedIndexes.length > 0 && /* @__PURE__ */ G("span", {
|
|
754
1536
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-success-bg text-dc-success dc:border border-dc-success dc:rounded",
|
|
755
1537
|
children: [
|
|
756
1538
|
i.summary.usedIndexes.length,
|
|
@@ -759,7 +1541,7 @@ var we = N(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r
|
|
|
759
1541
|
" Used"
|
|
760
1542
|
]
|
|
761
1543
|
}),
|
|
762
|
-
i.summary.executionTime !== void 0 && /* @__PURE__ */
|
|
1544
|
+
i.summary.executionTime !== void 0 && /* @__PURE__ */ G("span", {
|
|
763
1545
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-surface-secondary text-dc-text-secondary dc:border border-dc-border dc:rounded",
|
|
764
1546
|
children: [
|
|
765
1547
|
"Execution: ",
|
|
@@ -767,7 +1549,7 @@ var we = N(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r
|
|
|
767
1549
|
"ms"
|
|
768
1550
|
]
|
|
769
1551
|
}),
|
|
770
|
-
i.summary.planningTime !== void 0 && /* @__PURE__ */
|
|
1552
|
+
i.summary.planningTime !== void 0 && /* @__PURE__ */ G("span", {
|
|
771
1553
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-surface-secondary text-dc-text-secondary dc:border border-dc-border dc:rounded",
|
|
772
1554
|
children: [
|
|
773
1555
|
"Planning: ",
|
|
@@ -775,47 +1557,47 @@ var we = N(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r
|
|
|
775
1557
|
"ms"
|
|
776
1558
|
]
|
|
777
1559
|
}),
|
|
778
|
-
i.summary.totalCost !== void 0 && /* @__PURE__ */
|
|
1560
|
+
i.summary.totalCost !== void 0 && /* @__PURE__ */ G("span", {
|
|
779
1561
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-surface-secondary text-dc-text-secondary dc:border border-dc-border dc:rounded",
|
|
780
1562
|
children: ["Cost: ", i.summary.totalCost.toFixed(2)]
|
|
781
1563
|
})
|
|
782
1564
|
]
|
|
783
1565
|
}),
|
|
784
|
-
i.summary.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1566
|
+
i.summary.usedIndexes.length > 0 && /* @__PURE__ */ G("div", {
|
|
785
1567
|
className: "dc:text-xs text-dc-text-muted",
|
|
786
1568
|
children: [
|
|
787
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ W("strong", { children: "Indexes:" }),
|
|
788
1570
|
" ",
|
|
789
1571
|
i.summary.usedIndexes.join(", ")
|
|
790
1572
|
]
|
|
791
1573
|
}),
|
|
792
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ W(j, {
|
|
793
1575
|
code: i.raw,
|
|
794
1576
|
language: "sql",
|
|
795
1577
|
title: `Execution Plan (${i.summary.database})`,
|
|
796
1578
|
height: "16rem",
|
|
797
|
-
headerRight:
|
|
1579
|
+
headerRight: ne
|
|
798
1580
|
})
|
|
799
1581
|
]
|
|
800
1582
|
}) : null }),
|
|
801
|
-
d && /* @__PURE__ */
|
|
1583
|
+
d && /* @__PURE__ */ G("div", {
|
|
802
1584
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
803
1585
|
children: [
|
|
804
|
-
/* @__PURE__ */
|
|
1586
|
+
/* @__PURE__ */ W("strong", { children: "AI Analysis Error:" }),
|
|
805
1587
|
" ",
|
|
806
1588
|
d.message
|
|
807
1589
|
]
|
|
808
1590
|
}),
|
|
809
|
-
b && l && /* @__PURE__ */
|
|
1591
|
+
b && l && /* @__PURE__ */ W(rt, {
|
|
810
1592
|
analysis: l,
|
|
811
|
-
onClose:
|
|
1593
|
+
onClose: S
|
|
812
1594
|
})
|
|
813
1595
|
]
|
|
814
1596
|
});
|
|
815
1597
|
});
|
|
816
1598
|
//#endregion
|
|
817
1599
|
//#region src/client/adapters/queryModeAdapter.ts
|
|
818
|
-
function
|
|
1600
|
+
function at() {
|
|
819
1601
|
return {
|
|
820
1602
|
metrics: [],
|
|
821
1603
|
breakdowns: [],
|
|
@@ -825,10 +1607,10 @@ function Te() {
|
|
|
825
1607
|
validationError: null
|
|
826
1608
|
};
|
|
827
1609
|
}
|
|
828
|
-
function
|
|
1610
|
+
function ot(e) {
|
|
829
1611
|
return e.map((e) => e.field);
|
|
830
1612
|
}
|
|
831
|
-
function
|
|
1613
|
+
function st(e, t) {
|
|
832
1614
|
let n = [], r = [];
|
|
833
1615
|
for (let i of e) if (i.isTimeDimension) {
|
|
834
1616
|
let e = {
|
|
@@ -836,7 +1618,7 @@ function De(e, t) {
|
|
|
836
1618
|
granularity: i.granularity || "day"
|
|
837
1619
|
};
|
|
838
1620
|
if (i.enableComparison) {
|
|
839
|
-
let n =
|
|
1621
|
+
let n = me(i.field, t);
|
|
840
1622
|
n && (e.compareDateRange = n);
|
|
841
1623
|
}
|
|
842
1624
|
r.push(e);
|
|
@@ -846,31 +1628,31 @@ function De(e, t) {
|
|
|
846
1628
|
timeDimensions: r
|
|
847
1629
|
};
|
|
848
1630
|
}
|
|
849
|
-
function
|
|
850
|
-
let { dimensions: t, timeDimensions: n } =
|
|
851
|
-
measures:
|
|
1631
|
+
function ct(e) {
|
|
1632
|
+
let { dimensions: t, timeDimensions: n } = st(e.breakdowns, e.filters), r = {
|
|
1633
|
+
measures: ot(e.metrics),
|
|
852
1634
|
dimensions: t
|
|
853
1635
|
};
|
|
854
1636
|
return n.length > 0 && (r.timeDimensions = n), e.filters.length > 0 && (r.filters = e.filters), e.order && Object.keys(e.order).length > 0 && (r.order = e.order), r;
|
|
855
1637
|
}
|
|
856
|
-
function
|
|
1638
|
+
function lt(e) {
|
|
857
1639
|
return e.map((e, t) => ({
|
|
858
|
-
id:
|
|
1640
|
+
id: k(),
|
|
859
1641
|
field: e,
|
|
860
|
-
label:
|
|
1642
|
+
label: A(t)
|
|
861
1643
|
}));
|
|
862
1644
|
}
|
|
863
|
-
function
|
|
1645
|
+
function ut(e) {
|
|
864
1646
|
let t = [];
|
|
865
1647
|
if (e.dimensions) for (let n of e.dimensions) t.push({
|
|
866
|
-
id:
|
|
1648
|
+
id: k(),
|
|
867
1649
|
field: n,
|
|
868
1650
|
isTimeDimension: !1
|
|
869
1651
|
});
|
|
870
1652
|
if (e.timeDimensions) for (let n of e.timeDimensions) {
|
|
871
1653
|
let e = !!(n.compareDateRange && n.compareDateRange.length > 0);
|
|
872
1654
|
t.push({
|
|
873
|
-
id:
|
|
1655
|
+
id: k(),
|
|
874
1656
|
field: n.dimension,
|
|
875
1657
|
granularity: n.granularity,
|
|
876
1658
|
isTimeDimension: !0,
|
|
@@ -879,24 +1661,24 @@ function Ae(e) {
|
|
|
879
1661
|
}
|
|
880
1662
|
return t;
|
|
881
1663
|
}
|
|
882
|
-
function
|
|
1664
|
+
function dt(e) {
|
|
883
1665
|
return {
|
|
884
|
-
metrics:
|
|
885
|
-
breakdowns:
|
|
1666
|
+
metrics: lt(e.measures || []),
|
|
1667
|
+
breakdowns: ut(e),
|
|
886
1668
|
filters: e.filters || [],
|
|
887
1669
|
order: e.order,
|
|
888
1670
|
validationStatus: "idle",
|
|
889
1671
|
validationError: null
|
|
890
1672
|
};
|
|
891
1673
|
}
|
|
892
|
-
function
|
|
1674
|
+
function ft(e) {
|
|
893
1675
|
return typeof e == "object" && !!e && "queries" in e && Array.isArray(e.queries);
|
|
894
1676
|
}
|
|
895
|
-
var
|
|
1677
|
+
var X = {
|
|
896
1678
|
type: "query",
|
|
897
1679
|
createInitial() {
|
|
898
1680
|
return {
|
|
899
|
-
queryStates: [
|
|
1681
|
+
queryStates: [at()],
|
|
900
1682
|
activeQueryIndex: 0,
|
|
901
1683
|
mergeStrategy: "concat"
|
|
902
1684
|
};
|
|
@@ -916,22 +1698,22 @@ var Y = {
|
|
|
916
1698
|
load(e) {
|
|
917
1699
|
if (e.analysisType !== "query") throw Error(`Cannot load ${e.analysisType} config with query adapter`);
|
|
918
1700
|
let t = e;
|
|
919
|
-
if (
|
|
920
|
-
let e = t.query, n = e.queries.map(
|
|
921
|
-
return n.length === 0 && n.push(
|
|
1701
|
+
if (ft(t.query)) {
|
|
1702
|
+
let e = t.query, n = e.queries.map(dt);
|
|
1703
|
+
return n.length === 0 && n.push(at()), {
|
|
922
1704
|
queryStates: n,
|
|
923
1705
|
activeQueryIndex: 0,
|
|
924
1706
|
mergeStrategy: e.mergeStrategy || "concat"
|
|
925
1707
|
};
|
|
926
1708
|
}
|
|
927
1709
|
return {
|
|
928
|
-
queryStates: [
|
|
1710
|
+
queryStates: [dt(t.query)],
|
|
929
1711
|
activeQueryIndex: 0,
|
|
930
1712
|
mergeStrategy: "concat"
|
|
931
1713
|
};
|
|
932
1714
|
},
|
|
933
1715
|
save(e, t, n) {
|
|
934
|
-
let r = e.queryStates.map(
|
|
1716
|
+
let r = e.queryStates.map(ct), i = r.length === 1 && e.mergeStrategy === "concat" ? r[0] : {
|
|
935
1717
|
queries: r,
|
|
936
1718
|
mergeStrategy: e.mergeStrategy
|
|
937
1719
|
};
|
|
@@ -975,36 +1757,36 @@ var Y = {
|
|
|
975
1757
|
}
|
|
976
1758
|
};
|
|
977
1759
|
}
|
|
978
|
-
},
|
|
979
|
-
function
|
|
980
|
-
|
|
1760
|
+
}, Z = /* @__PURE__ */ new Map(), pt = !1;
|
|
1761
|
+
function mt() {
|
|
1762
|
+
pt ||= (Z.has("query") || Z.set("query", X), Z.has("funnel") || Z.set("funnel", P), Z.has("flow") || Z.set("flow", N), Z.has("retention") || Z.set("retention", D), !0);
|
|
981
1763
|
}
|
|
982
|
-
var
|
|
1764
|
+
var Q = {
|
|
983
1765
|
register(e) {
|
|
984
|
-
|
|
1766
|
+
Z.has(e.type) && console.warn(`[adapterRegistry] Overwriting existing adapter for type: ${e.type}`), Z.set(e.type, e);
|
|
985
1767
|
},
|
|
986
1768
|
get(e) {
|
|
987
|
-
|
|
988
|
-
let t =
|
|
989
|
-
if (!t) throw Error(`[adapterRegistry] No adapter registered for type: ${e}. Available types: ${Array.from(
|
|
1769
|
+
mt();
|
|
1770
|
+
let t = Z.get(e);
|
|
1771
|
+
if (!t) throw Error(`[adapterRegistry] No adapter registered for type: ${e}. Available types: ${Array.from(Z.keys()).join(", ") || "none"}`);
|
|
990
1772
|
return t;
|
|
991
1773
|
},
|
|
992
1774
|
has(e) {
|
|
993
|
-
return
|
|
1775
|
+
return mt(), Z.has(e);
|
|
994
1776
|
},
|
|
995
1777
|
getRegisteredTypes() {
|
|
996
|
-
return
|
|
1778
|
+
return mt(), Array.from(Z.keys());
|
|
997
1779
|
},
|
|
998
1780
|
clear() {
|
|
999
|
-
|
|
1781
|
+
Z.clear(), pt = !1;
|
|
1000
1782
|
}
|
|
1001
|
-
},
|
|
1783
|
+
}, ht = () => ({
|
|
1002
1784
|
analysisType: "query",
|
|
1003
1785
|
charts: {
|
|
1004
|
-
query:
|
|
1005
|
-
funnel:
|
|
1006
|
-
flow:
|
|
1007
|
-
retention:
|
|
1786
|
+
query: X.getDefaultChartConfig(),
|
|
1787
|
+
funnel: P.getDefaultChartConfig(),
|
|
1788
|
+
flow: N.getDefaultChartConfig(),
|
|
1789
|
+
retention: D.getDefaultChartConfig()
|
|
1008
1790
|
},
|
|
1009
1791
|
activeViews: {
|
|
1010
1792
|
query: "chart",
|
|
@@ -1014,12 +1796,12 @@ var Z = {
|
|
|
1014
1796
|
},
|
|
1015
1797
|
userManuallySelectedChart: !1,
|
|
1016
1798
|
localPaletteName: "default"
|
|
1017
|
-
}),
|
|
1018
|
-
...
|
|
1799
|
+
}), gt = (e, t, n) => ({
|
|
1800
|
+
...ht(),
|
|
1019
1801
|
setAnalysisType: (t) => {
|
|
1020
1802
|
e((e) => {
|
|
1021
1803
|
let n = { ...e.charts };
|
|
1022
|
-
n[t] || (n[t] =
|
|
1804
|
+
n[t] || (n[t] = Q.get(t).getDefaultChartConfig());
|
|
1023
1805
|
let r = { ...e.activeViews };
|
|
1024
1806
|
return r[t] || (r[t] = "chart"), {
|
|
1025
1807
|
analysisType: t,
|
|
@@ -1166,11 +1948,11 @@ var Z = {
|
|
|
1166
1948
|
});
|
|
1167
1949
|
},
|
|
1168
1950
|
save: () => {
|
|
1169
|
-
let e = t(), n =
|
|
1951
|
+
let e = t(), n = Q.get(e.analysisType), r = n.extractState(e);
|
|
1170
1952
|
return n.save(r, e.charts, e.activeViews[e.analysisType] ?? e.activeView ?? "chart");
|
|
1171
1953
|
},
|
|
1172
1954
|
load: (n) => {
|
|
1173
|
-
let r =
|
|
1955
|
+
let r = Q.get(n.analysisType);
|
|
1174
1956
|
if (!r.canLoad(n)) {
|
|
1175
1957
|
console.warn("[coreSlice] Invalid config, cannot load");
|
|
1176
1958
|
return;
|
|
@@ -1191,7 +1973,7 @@ var Z = {
|
|
|
1191
1973
|
});
|
|
1192
1974
|
},
|
|
1193
1975
|
saveWorkspace: () => {
|
|
1194
|
-
let e = t(), n = e, r =
|
|
1976
|
+
let e = t(), n = e, r = Q.get("query"), i = r.extractState(n), a = r.save(i, e.charts, e.activeViews.query ?? e.activeView ?? "chart"), o = Q.get("funnel"), s = o.extractState(n), c = o.save(s, e.charts, e.activeViews.funnel ?? e.activeView ?? "chart"), l = Q.get("flow"), u = l.extractState(n), d = l.save(u, e.charts, e.activeViews.flow ?? e.activeView ?? "chart"), f = Q.get("retention"), p = f.extractState(n), m = f.save(p, e.charts, e.activeViews.retention ?? e.activeView ?? "chart");
|
|
1195
1977
|
return {
|
|
1196
1978
|
version: 1,
|
|
1197
1979
|
activeType: e.analysisType,
|
|
@@ -1204,7 +1986,7 @@ var Z = {
|
|
|
1204
1986
|
};
|
|
1205
1987
|
},
|
|
1206
1988
|
loadWorkspace: (n) => {
|
|
1207
|
-
let r =
|
|
1989
|
+
let r = Q.get("query"), i = Q.get("funnel"), a = Q.get("flow"), o = Q.get("retention"), s = {}, c = {}, l = {}, u = {}, d = { ...t().charts }, f = { ...t().activeViews };
|
|
1208
1990
|
n.modes.query && r.canLoad(n.modes.query) && (s = r.load(n.modes.query), d = {
|
|
1209
1991
|
...d,
|
|
1210
1992
|
...n.modes.query.charts
|
|
@@ -1228,22 +2010,22 @@ var Z = {
|
|
|
1228
2010
|
...u
|
|
1229
2011
|
});
|
|
1230
2012
|
}
|
|
1231
|
-
}),
|
|
1232
|
-
queryStates: [
|
|
2013
|
+
}), _t = () => ({
|
|
2014
|
+
queryStates: [K()],
|
|
1233
2015
|
activeQueryIndex: 0,
|
|
1234
2016
|
mergeStrategy: "concat"
|
|
1235
|
-
}),
|
|
1236
|
-
...
|
|
2017
|
+
}), vt = (e, t, n) => ({
|
|
2018
|
+
..._t(),
|
|
1237
2019
|
setQueryStates: (t) => e({ queryStates: t }),
|
|
1238
2020
|
updateQueryState: (t, n) => e((e) => {
|
|
1239
2021
|
let r = [...e.queryStates];
|
|
1240
|
-
return r[t] = n(r[t] ||
|
|
2022
|
+
return r[t] = n(r[t] || K()), { queryStates: r };
|
|
1241
2023
|
}),
|
|
1242
2024
|
setActiveQueryIndex: (t) => e({ activeQueryIndex: t }),
|
|
1243
2025
|
setMergeStrategy: (t) => e({ mergeStrategy: t }),
|
|
1244
2026
|
addQuery: () => e((e) => {
|
|
1245
|
-
let t = e.queryStates[e.activeQueryIndex] ||
|
|
1246
|
-
...
|
|
2027
|
+
let t = e.queryStates[e.activeQueryIndex] || K(), n = {
|
|
2028
|
+
...K(),
|
|
1247
2029
|
metrics: [...t.metrics],
|
|
1248
2030
|
breakdowns: [...t.breakdowns],
|
|
1249
2031
|
filters: [...t.filters]
|
|
@@ -1262,10 +2044,10 @@ var Z = {
|
|
|
1262
2044
|
};
|
|
1263
2045
|
}),
|
|
1264
2046
|
addMetric: (t, n) => e((e) => {
|
|
1265
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
1266
|
-
id:
|
|
2047
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || K(), o = {
|
|
2048
|
+
id: k(),
|
|
1267
2049
|
field: t,
|
|
1268
|
-
label: n ||
|
|
2050
|
+
label: n || A(a.metrics.length)
|
|
1269
2051
|
};
|
|
1270
2052
|
return i[r] = {
|
|
1271
2053
|
...a,
|
|
@@ -1273,7 +2055,7 @@ var Z = {
|
|
|
1273
2055
|
}, { queryStates: i };
|
|
1274
2056
|
}),
|
|
1275
2057
|
removeMetric: (t) => e((e) => {
|
|
1276
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2058
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || K(), a = i.metrics.find((e) => e.id === t)?.field, o = i.metrics.filter((e) => e.id !== t), s = i.order;
|
|
1277
2059
|
return a && s && s[a] && (s = { ...s }, delete s[a], Object.keys(s).length === 0 && (s = void 0)), r[n] = {
|
|
1278
2060
|
...i,
|
|
1279
2061
|
metrics: o,
|
|
@@ -1281,16 +2063,16 @@ var Z = {
|
|
|
1281
2063
|
}, { queryStates: r };
|
|
1282
2064
|
}),
|
|
1283
2065
|
toggleMetric: (t) => e((e) => {
|
|
1284
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2066
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || K(), a = i.metrics.findIndex((e) => e.field === t);
|
|
1285
2067
|
if (a >= 0) r[n] = {
|
|
1286
2068
|
...i,
|
|
1287
2069
|
metrics: i.metrics.filter((e, t) => t !== a)
|
|
1288
2070
|
};
|
|
1289
2071
|
else {
|
|
1290
2072
|
let e = {
|
|
1291
|
-
id:
|
|
2073
|
+
id: k(),
|
|
1292
2074
|
field: t,
|
|
1293
|
-
label:
|
|
2075
|
+
label: A(i.metrics.length)
|
|
1294
2076
|
};
|
|
1295
2077
|
r[n] = {
|
|
1296
2078
|
...i,
|
|
@@ -1300,17 +2082,17 @@ var Z = {
|
|
|
1300
2082
|
return { queryStates: r };
|
|
1301
2083
|
}),
|
|
1302
2084
|
reorderMetrics: (t, n) => e((e) => {
|
|
1303
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2085
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || K(), o = [...a.metrics], [s] = o.splice(t, 1);
|
|
1304
2086
|
return o.splice(n, 0, s), i[r] = {
|
|
1305
2087
|
...a,
|
|
1306
2088
|
metrics: o
|
|
1307
2089
|
}, { queryStates: i };
|
|
1308
2090
|
}),
|
|
1309
2091
|
addBreakdown: (t, n, r) => e((e) => {
|
|
1310
|
-
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] ||
|
|
2092
|
+
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || K();
|
|
1311
2093
|
if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
|
|
1312
2094
|
let s = {
|
|
1313
|
-
id:
|
|
2095
|
+
id: k(),
|
|
1314
2096
|
field: t,
|
|
1315
2097
|
isTimeDimension: n,
|
|
1316
2098
|
granularity: n ? r || "month" : void 0
|
|
@@ -1321,7 +2103,7 @@ var Z = {
|
|
|
1321
2103
|
}, { queryStates: a };
|
|
1322
2104
|
}),
|
|
1323
2105
|
removeBreakdown: (t) => e((e) => {
|
|
1324
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2106
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || K(), a = i.breakdowns.find((e) => e.id === t)?.field, o = i.breakdowns.filter((e) => e.id !== t), s = i.order;
|
|
1325
2107
|
return a && s && s[a] && (s = { ...s }, delete s[a], Object.keys(s).length === 0 && (s = void 0)), r[n] = {
|
|
1326
2108
|
...i,
|
|
1327
2109
|
breakdowns: o,
|
|
@@ -1329,7 +2111,7 @@ var Z = {
|
|
|
1329
2111
|
}, { queryStates: r };
|
|
1330
2112
|
}),
|
|
1331
2113
|
toggleBreakdown: (t, n, r) => e((e) => {
|
|
1332
|
-
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] ||
|
|
2114
|
+
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || K(), s = o.breakdowns.findIndex((e) => e.field === t);
|
|
1333
2115
|
if (s >= 0) a[i] = {
|
|
1334
2116
|
...o,
|
|
1335
2117
|
breakdowns: o.breakdowns.filter((e, t) => t !== s)
|
|
@@ -1337,7 +2119,7 @@ var Z = {
|
|
|
1337
2119
|
else {
|
|
1338
2120
|
if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
|
|
1339
2121
|
let s = {
|
|
1340
|
-
id:
|
|
2122
|
+
id: k(),
|
|
1341
2123
|
field: t,
|
|
1342
2124
|
isTimeDimension: n,
|
|
1343
2125
|
granularity: n ? r || "month" : void 0
|
|
@@ -1360,20 +2142,20 @@ var Z = {
|
|
|
1360
2142
|
}, { queryStates: o };
|
|
1361
2143
|
}),
|
|
1362
2144
|
toggleBreakdownComparison: (t) => e((e) => {
|
|
1363
|
-
let { mergeStrategy: n, activeQueryIndex: r, queryStates: i, charts: a, analysisType: o } = e, s = [...i],
|
|
2145
|
+
let { mergeStrategy: n, activeQueryIndex: r, queryStates: i, charts: a, analysisType: o } = e, s = [...i], c = n === "merge" && r > 0 ? 0 : r, u = s[c].breakdowns.find((e) => e.id === t), d = u && !u.enableComparison, f = s[c].breakdowns.map((e) => e.id === t ? {
|
|
1364
2146
|
...e,
|
|
1365
2147
|
enableComparison: !e.enableComparison
|
|
1366
2148
|
} : e.isTimeDimension && e.enableComparison ? {
|
|
1367
2149
|
...e,
|
|
1368
2150
|
enableComparison: !1
|
|
1369
2151
|
} : e);
|
|
1370
|
-
s[
|
|
1371
|
-
...s[
|
|
2152
|
+
s[c] = {
|
|
2153
|
+
...s[c],
|
|
1372
2154
|
breakdowns: f
|
|
1373
2155
|
};
|
|
1374
2156
|
let p = { queryStates: s };
|
|
1375
2157
|
if (d && u?.isTimeDimension && u.field) {
|
|
1376
|
-
let t = s[
|
|
2158
|
+
let t = s[c].filters || [];
|
|
1377
2159
|
if (!t.some((e) => {
|
|
1378
2160
|
if ("member" in e) {
|
|
1379
2161
|
let t = e;
|
|
@@ -1385,10 +2167,10 @@ var Z = {
|
|
|
1385
2167
|
member: u.field,
|
|
1386
2168
|
operator: "inDateRange",
|
|
1387
2169
|
values: [],
|
|
1388
|
-
dateRange:
|
|
2170
|
+
dateRange: l("last_n_months", 3)
|
|
1389
2171
|
};
|
|
1390
|
-
s[
|
|
1391
|
-
...s[
|
|
2172
|
+
s[c] = {
|
|
2173
|
+
...s[c],
|
|
1392
2174
|
filters: [...t, e]
|
|
1393
2175
|
}, p.queryStates = s;
|
|
1394
2176
|
}
|
|
@@ -1407,7 +2189,7 @@ var Z = {
|
|
|
1407
2189
|
return p;
|
|
1408
2190
|
}),
|
|
1409
2191
|
reorderBreakdowns: (t, n) => e((e) => {
|
|
1410
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2192
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || K(), o = [...a.breakdowns], [s] = o.splice(t, 1);
|
|
1411
2193
|
return o.splice(n, 0, s), i[r] = {
|
|
1412
2194
|
...a,
|
|
1413
2195
|
breakdowns: o
|
|
@@ -1421,7 +2203,7 @@ var Z = {
|
|
|
1421
2203
|
}, { queryStates: r };
|
|
1422
2204
|
}),
|
|
1423
2205
|
dropFieldToFilter: (t) => e((e) => {
|
|
1424
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2206
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || K(), a = i.filters || [];
|
|
1425
2207
|
if (a.some((e) => "member" in e && e.member === t)) return e;
|
|
1426
2208
|
let o = {
|
|
1427
2209
|
member: t,
|
|
@@ -1445,7 +2227,7 @@ var Z = {
|
|
|
1445
2227
|
}, { queryStates: r };
|
|
1446
2228
|
}),
|
|
1447
2229
|
setOrder: (t, n) => e((e) => {
|
|
1448
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2230
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || K(), o = { ...a.order || {} };
|
|
1449
2231
|
return n === null ? delete o[t] : o[t] = n, i[r] = {
|
|
1450
2232
|
...a,
|
|
1451
2233
|
order: Object.keys(o).length > 0 ? o : void 0
|
|
@@ -1453,7 +2235,7 @@ var Z = {
|
|
|
1453
2235
|
}),
|
|
1454
2236
|
getCurrentState: () => {
|
|
1455
2237
|
let e = t();
|
|
1456
|
-
return e.queryStates[e.activeQueryIndex] ||
|
|
2238
|
+
return e.queryStates[e.activeQueryIndex] || K();
|
|
1457
2239
|
},
|
|
1458
2240
|
getMergeKeys: () => {
|
|
1459
2241
|
let e = t();
|
|
@@ -1466,12 +2248,12 @@ var Z = {
|
|
|
1466
2248
|
return e.queryStates.length <= 1 ? !1 : e.queryStates.filter((e) => e.metrics.length > 0 || e.breakdowns.length > 0).length > 1;
|
|
1467
2249
|
},
|
|
1468
2250
|
buildCurrentQuery: () => {
|
|
1469
|
-
let e = t(), n = e.queryStates[e.activeQueryIndex] ||
|
|
1470
|
-
return
|
|
2251
|
+
let e = t(), n = e.queryStates[e.activeQueryIndex] || K();
|
|
2252
|
+
return ge(n.metrics, n.breakdowns, n.filters, n.order);
|
|
1471
2253
|
},
|
|
1472
2254
|
buildAllQueries: () => {
|
|
1473
2255
|
let e = t(), n = e.queryStates[0]?.breakdowns || [];
|
|
1474
|
-
return e.queryStates.map((t, r) =>
|
|
2256
|
+
return e.queryStates.map((t, r) => ge(t.metrics, e.mergeStrategy === "merge" && r > 0 ? n : t.breakdowns, t.filters, t.order));
|
|
1475
2257
|
},
|
|
1476
2258
|
buildMultiQueryConfig: () => {
|
|
1477
2259
|
let e = t();
|
|
@@ -1484,18 +2266,18 @@ var Z = {
|
|
|
1484
2266
|
queryLabels: n.map((e, t) => `Q${t + 1}`)
|
|
1485
2267
|
};
|
|
1486
2268
|
}
|
|
1487
|
-
}),
|
|
2269
|
+
}), yt = () => ({
|
|
1488
2270
|
funnelCube: null,
|
|
1489
2271
|
funnelSteps: [],
|
|
1490
2272
|
activeFunnelStepIndex: 0,
|
|
1491
2273
|
funnelTimeDimension: null,
|
|
1492
2274
|
funnelBindingKey: null,
|
|
1493
2275
|
stepTimeToConvert: []
|
|
1494
|
-
}),
|
|
1495
|
-
...
|
|
2276
|
+
}), bt = (e, t, n) => ({
|
|
2277
|
+
...yt(),
|
|
1496
2278
|
addFunnelStep: () => e((e) => {
|
|
1497
2279
|
let t = e.funnelSteps[e.funnelSteps.length - 1], n = {
|
|
1498
|
-
id:
|
|
2280
|
+
id: k(),
|
|
1499
2281
|
name: `Step ${e.funnelSteps.length + 1}`,
|
|
1500
2282
|
cube: e.funnelCube || "",
|
|
1501
2283
|
filters: t?.filters ? JSON.parse(JSON.stringify(t.filters)) : [],
|
|
@@ -1560,7 +2342,7 @@ var Z = {
|
|
|
1560
2342
|
let e = t();
|
|
1561
2343
|
return e.analysisType !== "funnel" || !e.funnelBindingKey || !e.funnelTimeDimension || e.funnelSteps.length < 2 ? !1 : e.funnelSteps.filter((e) => e.cube && e.name).length >= 2;
|
|
1562
2344
|
}
|
|
1563
|
-
}),
|
|
2345
|
+
}), xt = () => ({
|
|
1564
2346
|
flowCube: null,
|
|
1565
2347
|
flowBindingKey: null,
|
|
1566
2348
|
flowTimeDimension: null,
|
|
@@ -1572,8 +2354,8 @@ var Z = {
|
|
|
1572
2354
|
stepsAfter: 3,
|
|
1573
2355
|
eventDimension: null,
|
|
1574
2356
|
joinStrategy: "auto"
|
|
1575
|
-
}),
|
|
1576
|
-
...
|
|
2357
|
+
}), St = (e, t, n) => ({
|
|
2358
|
+
...xt(),
|
|
1577
2359
|
setFlowCube: (t) => e(() => ({
|
|
1578
2360
|
flowCube: t,
|
|
1579
2361
|
flowBindingKey: null,
|
|
@@ -1643,8 +2425,8 @@ var Z = {
|
|
|
1643
2425
|
joinStrategy: e.joinStrategy
|
|
1644
2426
|
} };
|
|
1645
2427
|
}
|
|
1646
|
-
}),
|
|
1647
|
-
...
|
|
2428
|
+
}), Ct = () => ({ ...C }), wt = (e, t, n) => ({
|
|
2429
|
+
...Ct(),
|
|
1648
2430
|
setRetentionCube: (t) => e(() => ({
|
|
1649
2431
|
retentionCube: t,
|
|
1650
2432
|
retentionTimeDimension: null,
|
|
@@ -1719,22 +2501,22 @@ var Z = {
|
|
|
1719
2501
|
warnings: r
|
|
1720
2502
|
};
|
|
1721
2503
|
}
|
|
1722
|
-
}),
|
|
2504
|
+
}), Tt = {
|
|
1723
2505
|
isOpen: !1,
|
|
1724
2506
|
userPrompt: "",
|
|
1725
2507
|
isGenerating: !1,
|
|
1726
2508
|
error: null,
|
|
1727
2509
|
hasGeneratedQuery: !1,
|
|
1728
2510
|
previousState: null
|
|
1729
|
-
},
|
|
2511
|
+
}, Et = () => ({
|
|
1730
2512
|
activeTab: "query",
|
|
1731
2513
|
activeView: "chart",
|
|
1732
2514
|
displayLimit: 100,
|
|
1733
2515
|
showFieldModal: !1,
|
|
1734
2516
|
fieldModalMode: "metrics",
|
|
1735
|
-
aiState:
|
|
1736
|
-
}),
|
|
1737
|
-
...
|
|
2517
|
+
aiState: Tt
|
|
2518
|
+
}), Dt = (e, t, n) => ({
|
|
2519
|
+
...Et(),
|
|
1738
2520
|
setActiveTab: (t) => e({ activeTab: t }),
|
|
1739
2521
|
setActiveView: (t) => e((e) => ({
|
|
1740
2522
|
activeView: t,
|
|
@@ -1804,7 +2586,7 @@ var Z = {
|
|
|
1804
2586
|
if (!t) return e;
|
|
1805
2587
|
let n = e.activeQueryIndex, r = [...e.queryStates];
|
|
1806
2588
|
return r[n] = {
|
|
1807
|
-
...r[n] ||
|
|
2589
|
+
...r[n] || K(),
|
|
1808
2590
|
metrics: t.metrics,
|
|
1809
2591
|
breakdowns: t.breakdowns,
|
|
1810
2592
|
filters: t.filters
|
|
@@ -1818,19 +2600,19 @@ var Z = {
|
|
|
1818
2600
|
displayConfig: t.displayConfig
|
|
1819
2601
|
}
|
|
1820
2602
|
},
|
|
1821
|
-
aiState: { ...
|
|
2603
|
+
aiState: { ...Tt }
|
|
1822
2604
|
};
|
|
1823
2605
|
})
|
|
1824
2606
|
});
|
|
1825
2607
|
//#endregion
|
|
1826
2608
|
//#region src/client/stores/analysisBuilderStore.tsx
|
|
1827
|
-
function
|
|
2609
|
+
function Ot(e) {
|
|
1828
2610
|
let t = e.filters ? [...e.filters] : [], n = e.timeDimensions || [], r = [...(e.dimensions || []).map((e) => ({
|
|
1829
|
-
id:
|
|
2611
|
+
id: k(),
|
|
1830
2612
|
field: e,
|
|
1831
2613
|
isTimeDimension: !1
|
|
1832
2614
|
})), ...n.map((e) => ({
|
|
1833
|
-
id:
|
|
2615
|
+
id: k(),
|
|
1834
2616
|
field: e.dimension,
|
|
1835
2617
|
granularity: e.granularity,
|
|
1836
2618
|
isTimeDimension: !0,
|
|
@@ -1856,24 +2638,24 @@ function Je(e) {
|
|
|
1856
2638
|
}
|
|
1857
2639
|
}
|
|
1858
2640
|
return {
|
|
1859
|
-
...
|
|
2641
|
+
...K(),
|
|
1860
2642
|
metrics: (e.measures || []).map((e, t) => ({
|
|
1861
|
-
id:
|
|
2643
|
+
id: k(),
|
|
1862
2644
|
field: e,
|
|
1863
|
-
label:
|
|
2645
|
+
label: A(t)
|
|
1864
2646
|
})),
|
|
1865
2647
|
breakdowns: r,
|
|
1866
2648
|
filters: i,
|
|
1867
2649
|
order: e.order
|
|
1868
2650
|
};
|
|
1869
2651
|
}
|
|
1870
|
-
function
|
|
2652
|
+
function kt(e) {
|
|
1871
2653
|
return "queries" in e && Array.isArray(e.queries);
|
|
1872
2654
|
}
|
|
1873
|
-
function
|
|
2655
|
+
function At(e) {
|
|
1874
2656
|
if (e.initialAnalysisType === "funnel" && e.initialFunnelState) {
|
|
1875
|
-
let t =
|
|
1876
|
-
return
|
|
2657
|
+
let t = P.getDefaultChartConfig();
|
|
2658
|
+
return P.save({
|
|
1877
2659
|
funnelCube: e.initialFunnelState.funnelCube ?? null,
|
|
1878
2660
|
funnelSteps: e.initialFunnelState.funnelSteps || [],
|
|
1879
2661
|
activeFunnelStepIndex: 0,
|
|
@@ -1886,8 +2668,8 @@ function Xe(e) {
|
|
|
1886
2668
|
} }, e.initialActiveView || "chart");
|
|
1887
2669
|
}
|
|
1888
2670
|
if (e.initialAnalysisType === "flow" && e.initialFlowState) {
|
|
1889
|
-
let t =
|
|
1890
|
-
return
|
|
2671
|
+
let t = N.getDefaultChartConfig();
|
|
2672
|
+
return N.save({
|
|
1891
2673
|
flowCube: e.initialFlowState.flowCube ?? null,
|
|
1892
2674
|
flowBindingKey: e.initialFlowState.flowBindingKey ?? null,
|
|
1893
2675
|
flowTimeDimension: e.initialFlowState.flowTimeDimension ?? null,
|
|
@@ -1906,12 +2688,12 @@ function Xe(e) {
|
|
|
1906
2688
|
} }, e.initialActiveView || "chart");
|
|
1907
2689
|
}
|
|
1908
2690
|
if (e.initialAnalysisType === "retention" && e.initialRetentionState) {
|
|
1909
|
-
let t =
|
|
2691
|
+
let t = D.getDefaultChartConfig(), n = {
|
|
1910
2692
|
chartType: e.initialChartConfig?.chartType || t.chartType,
|
|
1911
2693
|
chartConfig: e.initialChartConfig?.chartConfig || t.chartConfig,
|
|
1912
2694
|
displayConfig: e.initialChartConfig?.displayConfig || t.displayConfig
|
|
1913
|
-
}, r =
|
|
1914
|
-
return
|
|
2695
|
+
}, r = w(T);
|
|
2696
|
+
return D.save({
|
|
1915
2697
|
retentionCube: e.initialRetentionState.retentionCube ?? null,
|
|
1916
2698
|
retentionBindingKey: e.initialRetentionState.retentionBindingKey ?? null,
|
|
1917
2699
|
retentionTimeDimension: e.initialRetentionState.retentionTimeDimension ?? null,
|
|
@@ -1926,9 +2708,9 @@ function Xe(e) {
|
|
|
1926
2708
|
}
|
|
1927
2709
|
if (e.initialQuery) {
|
|
1928
2710
|
let t = e.initialQuery, n, r = "concat";
|
|
1929
|
-
|
|
1930
|
-
let i =
|
|
1931
|
-
return
|
|
2711
|
+
kt(t) ? (n = t.queries.map(Ot), t.mergeStrategy && (r = t.mergeStrategy)) : n = [Ot(t)];
|
|
2712
|
+
let i = X.getDefaultChartConfig();
|
|
2713
|
+
return X.save({
|
|
1932
2714
|
queryStates: n,
|
|
1933
2715
|
activeQueryIndex: 0,
|
|
1934
2716
|
mergeStrategy: r
|
|
@@ -1939,37 +2721,37 @@ function Xe(e) {
|
|
|
1939
2721
|
} }, e.initialActiveView || "chart");
|
|
1940
2722
|
}
|
|
1941
2723
|
if (e.initialChartConfig) {
|
|
1942
|
-
let t =
|
|
2724
|
+
let t = X.getDefaultChartConfig(), n = {
|
|
1943
2725
|
chartType: e.initialChartConfig.chartType || t.chartType,
|
|
1944
2726
|
chartConfig: e.initialChartConfig.chartConfig || t.chartConfig,
|
|
1945
2727
|
displayConfig: e.initialChartConfig.displayConfig || t.displayConfig
|
|
1946
2728
|
};
|
|
1947
|
-
return
|
|
1948
|
-
queryStates: [
|
|
2729
|
+
return X.save({
|
|
2730
|
+
queryStates: [K()],
|
|
1949
2731
|
activeQueryIndex: 0,
|
|
1950
2732
|
mergeStrategy: "concat"
|
|
1951
2733
|
}, { query: n }, e.initialActiveView || "chart");
|
|
1952
2734
|
}
|
|
1953
|
-
return e.initialActiveView ?
|
|
1954
|
-
queryStates: [
|
|
2735
|
+
return e.initialActiveView ? X.save({
|
|
2736
|
+
queryStates: [K()],
|
|
1955
2737
|
activeQueryIndex: 0,
|
|
1956
2738
|
mergeStrategy: "concat"
|
|
1957
|
-
}, { query:
|
|
2739
|
+
}, { query: X.getDefaultChartConfig() }, e.initialActiveView) : null;
|
|
1958
2740
|
}
|
|
1959
|
-
function
|
|
2741
|
+
function jt(e, t) {
|
|
1960
2742
|
return {
|
|
1961
2743
|
reset: () => {
|
|
1962
2744
|
e({
|
|
1963
|
-
...
|
|
1964
|
-
...
|
|
1965
|
-
...
|
|
1966
|
-
...
|
|
1967
|
-
...
|
|
2745
|
+
...ht(),
|
|
2746
|
+
..._t(),
|
|
2747
|
+
...yt(),
|
|
2748
|
+
...xt(),
|
|
2749
|
+
...Ct(),
|
|
1968
2750
|
charts: {
|
|
1969
|
-
query:
|
|
1970
|
-
funnel:
|
|
1971
|
-
flow:
|
|
1972
|
-
retention:
|
|
2751
|
+
query: X.getDefaultChartConfig(),
|
|
2752
|
+
funnel: P.getDefaultChartConfig(),
|
|
2753
|
+
flow: N.getDefaultChartConfig(),
|
|
2754
|
+
retention: D.getDefaultChartConfig()
|
|
1973
2755
|
},
|
|
1974
2756
|
activeViews: {
|
|
1975
2757
|
query: "chart",
|
|
@@ -1982,62 +2764,62 @@ function Ze(e, t) {
|
|
|
1982
2764
|
clearCurrentMode: () => e((e) => {
|
|
1983
2765
|
switch (e.analysisType) {
|
|
1984
2766
|
case "funnel": return {
|
|
1985
|
-
...
|
|
2767
|
+
...yt(),
|
|
1986
2768
|
charts: {
|
|
1987
2769
|
...e.charts,
|
|
1988
|
-
funnel:
|
|
2770
|
+
funnel: P.getDefaultChartConfig()
|
|
1989
2771
|
}
|
|
1990
2772
|
};
|
|
1991
2773
|
case "flow": return {
|
|
1992
|
-
...
|
|
2774
|
+
...xt(),
|
|
1993
2775
|
charts: {
|
|
1994
2776
|
...e.charts,
|
|
1995
|
-
flow:
|
|
2777
|
+
flow: N.getDefaultChartConfig()
|
|
1996
2778
|
}
|
|
1997
2779
|
};
|
|
1998
2780
|
case "retention": return {
|
|
1999
|
-
...
|
|
2781
|
+
...Ct(),
|
|
2000
2782
|
charts: {
|
|
2001
2783
|
...e.charts,
|
|
2002
|
-
retention:
|
|
2784
|
+
retention: D.getDefaultChartConfig()
|
|
2003
2785
|
}
|
|
2004
2786
|
};
|
|
2005
2787
|
default: return {
|
|
2006
|
-
...
|
|
2788
|
+
..._t(),
|
|
2007
2789
|
userManuallySelectedChart: !1,
|
|
2008
2790
|
charts: {
|
|
2009
2791
|
...e.charts,
|
|
2010
|
-
query:
|
|
2792
|
+
query: X.getDefaultChartConfig()
|
|
2011
2793
|
}
|
|
2012
2794
|
};
|
|
2013
2795
|
}
|
|
2014
2796
|
}),
|
|
2015
2797
|
clearQuery: () => e((e) => {
|
|
2016
2798
|
let t = [...e.queryStates];
|
|
2017
|
-
return t[e.activeQueryIndex] =
|
|
2799
|
+
return t[e.activeQueryIndex] = K(), {
|
|
2018
2800
|
queryStates: t,
|
|
2019
2801
|
userManuallySelectedChart: !1,
|
|
2020
2802
|
charts: {
|
|
2021
2803
|
...e.charts,
|
|
2022
|
-
query:
|
|
2804
|
+
query: X.getDefaultChartConfig()
|
|
2023
2805
|
}
|
|
2024
2806
|
};
|
|
2025
2807
|
}),
|
|
2026
2808
|
getValidation: () => {
|
|
2027
|
-
let e = t(), n =
|
|
2809
|
+
let e = t(), n = Q.get(e.analysisType), r = n.extractState(e);
|
|
2028
2810
|
return n.validate(r);
|
|
2029
2811
|
}
|
|
2030
2812
|
};
|
|
2031
2813
|
}
|
|
2032
|
-
function
|
|
2033
|
-
let r =
|
|
2034
|
-
...
|
|
2035
|
-
...
|
|
2036
|
-
...
|
|
2037
|
-
...
|
|
2038
|
-
...
|
|
2039
|
-
...
|
|
2040
|
-
...
|
|
2814
|
+
function Mt(n = {}) {
|
|
2815
|
+
let r = At(n), o = (e, t, n) => ({
|
|
2816
|
+
...gt(e, t, n),
|
|
2817
|
+
...vt(e, t, n),
|
|
2818
|
+
...bt(e, t, n),
|
|
2819
|
+
...St(e, t, n),
|
|
2820
|
+
...wt(e, t, n),
|
|
2821
|
+
...Dt(e, t, n),
|
|
2822
|
+
...jt(e, t)
|
|
2041
2823
|
});
|
|
2042
2824
|
if (n.disableLocalStorage) {
|
|
2043
2825
|
let t = a()(i(e(o), { name: "AnalysisBuilderStore (no-persist)" }));
|
|
@@ -2046,10 +2828,10 @@ function Qe(n = {}) {
|
|
|
2046
2828
|
return a()(i(e(t(o, {
|
|
2047
2829
|
name: n.storageKey || "drizzle-cube-analysis-builder-v3",
|
|
2048
2830
|
partialize: (e) => e.saveWorkspace(),
|
|
2049
|
-
merge: (e, t) => e &&
|
|
2831
|
+
merge: (e, t) => e && re(e) ? {
|
|
2050
2832
|
...t,
|
|
2051
2833
|
_persistedWorkspace: e
|
|
2052
|
-
} : e &&
|
|
2834
|
+
} : e && E(e) ? {
|
|
2053
2835
|
...t,
|
|
2054
2836
|
_persistedConfig: e
|
|
2055
2837
|
} : r ? {
|
|
@@ -2072,10 +2854,10 @@ function Qe(n = {}) {
|
|
|
2072
2854
|
}
|
|
2073
2855
|
})), { name: "AnalysisBuilderStore" }));
|
|
2074
2856
|
}
|
|
2075
|
-
var
|
|
2076
|
-
function
|
|
2077
|
-
let u =
|
|
2078
|
-
return u.current ||=
|
|
2857
|
+
var Nt = se(null);
|
|
2858
|
+
function Pt({ children: e, initialQuery: t, initialChartConfig: n, disableLocalStorage: r, storageKey: i, initialAnalysisType: a, initialFunnelState: o, initialFlowState: s, initialRetentionState: c, initialActiveView: l }) {
|
|
2859
|
+
let u = V(null);
|
|
2860
|
+
return u.current ||= Mt({
|
|
2079
2861
|
initialQuery: t,
|
|
2080
2862
|
initialChartConfig: n,
|
|
2081
2863
|
disableLocalStorage: r,
|
|
@@ -2085,22 +2867,22 @@ function et({ children: e, initialQuery: t, initialChartConfig: n, disableLocalS
|
|
|
2085
2867
|
initialFlowState: s,
|
|
2086
2868
|
initialRetentionState: c,
|
|
2087
2869
|
initialActiveView: l
|
|
2088
|
-
}), /* @__PURE__ */
|
|
2870
|
+
}), /* @__PURE__ */ W(Nt.Provider, {
|
|
2089
2871
|
value: u.current,
|
|
2090
2872
|
children: e
|
|
2091
2873
|
});
|
|
2092
2874
|
}
|
|
2093
|
-
function
|
|
2094
|
-
let t =
|
|
2875
|
+
function $(e) {
|
|
2876
|
+
let t = ce(Nt);
|
|
2095
2877
|
if (!t) throw Error("useAnalysisBuilderStore must be used within AnalysisBuilderStoreProvider");
|
|
2096
2878
|
return r(t, e);
|
|
2097
2879
|
}
|
|
2098
|
-
function
|
|
2099
|
-
let e =
|
|
2880
|
+
function Ft() {
|
|
2881
|
+
let e = ce(Nt);
|
|
2100
2882
|
if (!e) throw Error("useAnalysisBuilderStoreApi must be used within AnalysisBuilderStoreProvider");
|
|
2101
2883
|
return e;
|
|
2102
2884
|
}
|
|
2103
|
-
var
|
|
2885
|
+
var It = (e) => e.queryStates[e.activeQueryIndex] || K(), Lt = (e) => It(e).metrics, Rt = (e) => It(e).breakdowns, zt = (e) => It(e).filters, Bt = (e) => {
|
|
2104
2886
|
let t = e.charts[e.analysisType];
|
|
2105
2887
|
return t ? {
|
|
2106
2888
|
chartType: t.chartType,
|
|
@@ -2115,18 +2897,18 @@ var nt = (e) => e.queryStates[e.activeQueryIndex] || U(), rt = (e) => nt(e).metr
|
|
|
2115
2897
|
showTooltip: !0
|
|
2116
2898
|
}
|
|
2117
2899
|
};
|
|
2118
|
-
},
|
|
2900
|
+
}, Vt = (e) => ({
|
|
2119
2901
|
activeTab: e.activeTab,
|
|
2120
2902
|
activeView: e.activeView,
|
|
2121
2903
|
displayLimit: e.displayLimit,
|
|
2122
2904
|
showFieldModal: e.showFieldModal,
|
|
2123
2905
|
fieldModalMode: e.fieldModalMode
|
|
2124
|
-
}),
|
|
2906
|
+
}), Ht = (e) => ({
|
|
2125
2907
|
queryStates: e.queryStates,
|
|
2126
2908
|
activeQueryIndex: e.activeQueryIndex,
|
|
2127
2909
|
mergeStrategy: e.mergeStrategy,
|
|
2128
2910
|
isMultiQueryMode: e.analysisType === "query" && e.queryStates.length > 1
|
|
2129
|
-
}),
|
|
2911
|
+
}), Ut = (e) => ({
|
|
2130
2912
|
funnelCube: e.funnelCube,
|
|
2131
2913
|
funnelSteps: e.funnelSteps,
|
|
2132
2914
|
activeFunnelStepIndex: e.activeFunnelStepIndex,
|
|
@@ -2137,16 +2919,16 @@ var nt = (e) => e.queryStates[e.activeQueryIndex] || U(), rt = (e) => nt(e).metr
|
|
|
2137
2919
|
});
|
|
2138
2920
|
//#endregion
|
|
2139
2921
|
//#region src/client/utils/multiQueryValidation.ts
|
|
2140
|
-
function
|
|
2922
|
+
function Wt(e) {
|
|
2141
2923
|
return e.timeDimensions || [];
|
|
2142
2924
|
}
|
|
2143
|
-
function
|
|
2925
|
+
function Gt(e) {
|
|
2144
2926
|
let t = [];
|
|
2145
2927
|
if (e.length < 2) return t;
|
|
2146
|
-
let n =
|
|
2928
|
+
let n = Wt(e[0]);
|
|
2147
2929
|
if (n.length === 0) return t;
|
|
2148
2930
|
for (let r = 1; r < e.length; r++) {
|
|
2149
|
-
let i =
|
|
2931
|
+
let i = Wt(e[r]);
|
|
2150
2932
|
if (i.length === 0 && n.length > 0) {
|
|
2151
2933
|
t.push({
|
|
2152
2934
|
type: "missing_time_dimension",
|
|
@@ -2172,7 +2954,7 @@ function ut(e) {
|
|
|
2172
2954
|
}
|
|
2173
2955
|
return t;
|
|
2174
2956
|
}
|
|
2175
|
-
function
|
|
2957
|
+
function Kt(e, t) {
|
|
2176
2958
|
let n = [];
|
|
2177
2959
|
if (e.length < 2 || t.length === 0) return n;
|
|
2178
2960
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -2186,7 +2968,7 @@ function dt(e, t) {
|
|
|
2186
2968
|
}
|
|
2187
2969
|
return n;
|
|
2188
2970
|
}
|
|
2189
|
-
function
|
|
2971
|
+
function qt(e) {
|
|
2190
2972
|
let t = [];
|
|
2191
2973
|
if (e.length < 2) return t;
|
|
2192
2974
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -2205,7 +2987,7 @@ function ft(e) {
|
|
|
2205
2987
|
affectedMeasures: r
|
|
2206
2988
|
}), t;
|
|
2207
2989
|
}
|
|
2208
|
-
function
|
|
2990
|
+
function Jt(e) {
|
|
2209
2991
|
let t = [];
|
|
2210
2992
|
if (e.length < 2) return t;
|
|
2211
2993
|
let n = e.map((e) => e.timeDimensions?.[0]?.dateRange);
|
|
@@ -2215,39 +2997,39 @@ function pt(e) {
|
|
|
2215
2997
|
message: "Queries have different date ranges - some data points may be missing in merged results"
|
|
2216
2998
|
}), t;
|
|
2217
2999
|
}
|
|
2218
|
-
function
|
|
3000
|
+
function Yt(e, t, n = []) {
|
|
2219
3001
|
let r = [], i = [];
|
|
2220
3002
|
return e.length < 2 ? {
|
|
2221
3003
|
isValid: !0,
|
|
2222
3004
|
errors: r,
|
|
2223
3005
|
warnings: i
|
|
2224
|
-
} : (i.push(...
|
|
3006
|
+
} : (i.push(...qt(e)), i.push(...Jt(e)), t === "merge" && (r.push(...Gt(e)), n.length > 0 && r.push(...Kt(e, n))), {
|
|
2225
3007
|
isValid: r.length === 0,
|
|
2226
3008
|
errors: r,
|
|
2227
3009
|
warnings: i
|
|
2228
3010
|
});
|
|
2229
3011
|
}
|
|
2230
|
-
function
|
|
3012
|
+
function Xt(e) {
|
|
2231
3013
|
return e.filter((e) => (e.measures?.length || 0) + (e.dimensions?.length || 0) + (e.timeDimensions?.length || 0) > 0).length >= 2;
|
|
2232
3014
|
}
|
|
2233
|
-
function
|
|
3015
|
+
function Zt(e) {
|
|
2234
3016
|
if (e.isValid && e.warnings.length === 0) return "Configuration is valid";
|
|
2235
3017
|
let t = [];
|
|
2236
3018
|
return e.errors.length > 0 && t.push(`${e.errors.length} error${e.errors.length > 1 ? "s" : ""}`), e.warnings.length > 0 && t.push(`${e.warnings.length} warning${e.warnings.length > 1 ? "s" : ""}`), t.join(", ");
|
|
2237
3019
|
}
|
|
2238
3020
|
//#endregion
|
|
2239
3021
|
//#region src/client/hooks/useAnalysisQueryBuilder.ts
|
|
2240
|
-
function
|
|
2241
|
-
let e =
|
|
3022
|
+
function Qt() {
|
|
3023
|
+
let e = $((e) => e.queryStates), t = $((e) => e.activeQueryIndex), n = $((e) => e.mergeStrategy), r = $((e) => e.setActiveQueryIndex), i = $((e) => e.setMergeStrategy), a = $((e) => e.addQuery), o = $((e) => e.removeQuery), s = $((e) => e.getCurrentState), c = $((e) => e.getMergeKeys), l = $((e) => e.isMultiQueryMode), u = s(), d = l(), f = c(), p = B(() => {
|
|
2242
3024
|
let n = e[t] || u;
|
|
2243
|
-
return
|
|
3025
|
+
return ge(n.metrics, n.breakdowns, n.filters, n.order);
|
|
2244
3026
|
}, [
|
|
2245
3027
|
e,
|
|
2246
3028
|
t,
|
|
2247
3029
|
u
|
|
2248
|
-
]), m =
|
|
3030
|
+
]), m = B(() => {
|
|
2249
3031
|
let t = e[0]?.breakdowns || [];
|
|
2250
|
-
return e.map((e, r) =>
|
|
3032
|
+
return e.map((e, r) => ge(e.metrics, n === "merge" && r > 0 ? t : e.breakdowns, e.filters, e.order));
|
|
2251
3033
|
}, [e, n]);
|
|
2252
3034
|
return {
|
|
2253
3035
|
queryState: u,
|
|
@@ -2258,7 +3040,7 @@ function _t() {
|
|
|
2258
3040
|
mergeKeys: f,
|
|
2259
3041
|
currentQuery: p,
|
|
2260
3042
|
allQueries: m,
|
|
2261
|
-
multiQueryConfig:
|
|
3043
|
+
multiQueryConfig: B(() => {
|
|
2262
3044
|
if (e.length <= 1) return null;
|
|
2263
3045
|
let t = m.filter((e) => e.measures && e.measures.length > 0 || e.dimensions && e.dimensions.length > 0 || e.timeDimensions && e.timeDimensions.length > 0);
|
|
2264
3046
|
return t.length < 2 ? null : {
|
|
@@ -2273,13 +3055,13 @@ function _t() {
|
|
|
2273
3055
|
n,
|
|
2274
3056
|
f
|
|
2275
3057
|
]),
|
|
2276
|
-
multiQueryValidation:
|
|
3058
|
+
multiQueryValidation: B(() => d ? Yt(m, n, f || []) : null, [
|
|
2277
3059
|
d,
|
|
2278
3060
|
m,
|
|
2279
3061
|
n,
|
|
2280
3062
|
f
|
|
2281
3063
|
]),
|
|
2282
|
-
isValidQuery:
|
|
3064
|
+
isValidQuery: B(() => p.measures && p.measures.length > 0 || p.dimensions && p.dimensions.length > 0 || p.timeDimensions && p.timeDimensions.length > 0, [p]),
|
|
2283
3065
|
setActiveQueryIndex: r,
|
|
2284
3066
|
setMergeStrategy: i,
|
|
2285
3067
|
addQuery: a,
|
|
@@ -2288,10 +3070,10 @@ function _t() {
|
|
|
2288
3070
|
}
|
|
2289
3071
|
//#endregion
|
|
2290
3072
|
//#region src/client/hooks/useAnalysisCombinedFields.ts
|
|
2291
|
-
function
|
|
3073
|
+
function $t(e) {
|
|
2292
3074
|
let { queryState: t, queryStates: n, isMultiQueryMode: r, mergeStrategy: i, activeQueryIndex: a } = e;
|
|
2293
3075
|
return {
|
|
2294
|
-
combinedMetrics:
|
|
3076
|
+
combinedMetrics: B(() => {
|
|
2295
3077
|
if (!r) return t.metrics;
|
|
2296
3078
|
let e = /* @__PURE__ */ new Set(), i = [];
|
|
2297
3079
|
for (let t = 0; t < n.length; t++) {
|
|
@@ -2310,7 +3092,7 @@ function vt(e) {
|
|
|
2310
3092
|
n,
|
|
2311
3093
|
t.metrics
|
|
2312
3094
|
]),
|
|
2313
|
-
combinedBreakdowns:
|
|
3095
|
+
combinedBreakdowns: B(() => {
|
|
2314
3096
|
if (!r) return t.breakdowns;
|
|
2315
3097
|
let e = /* @__PURE__ */ new Set(), i = [];
|
|
2316
3098
|
for (let t of n) for (let n of t.breakdowns) e.has(n.field) || (e.add(n.field), i.push(n));
|
|
@@ -2320,7 +3102,7 @@ function vt(e) {
|
|
|
2320
3102
|
n,
|
|
2321
3103
|
t.breakdowns
|
|
2322
3104
|
]),
|
|
2323
|
-
effectiveBreakdowns:
|
|
3105
|
+
effectiveBreakdowns: B(() => i === "merge" && a > 0 ? n[0]?.breakdowns || [] : t.breakdowns, [
|
|
2324
3106
|
i,
|
|
2325
3107
|
a,
|
|
2326
3108
|
n,
|
|
@@ -2330,129 +3112,129 @@ function vt(e) {
|
|
|
2330
3112
|
}
|
|
2331
3113
|
//#endregion
|
|
2332
3114
|
//#region src/client/hooks/useAnalysisQueryExecution.ts
|
|
2333
|
-
function
|
|
2334
|
-
let { currentQuery: t, allQueries: n, multiQueryConfig: r, isMultiQueryMode: i, isValidQuery: a, initialData: o, mergeStrategy: s, funnelBindingKey: c, isFunnelModeEnabled:
|
|
2335
|
-
|
|
2336
|
-
|
|
3115
|
+
function en(e) {
|
|
3116
|
+
let { currentQuery: t, allQueries: n, multiQueryConfig: r, isMultiQueryMode: i, isValidQuery: a, initialData: o, mergeStrategy: s, funnelBindingKey: c, isFunnelModeEnabled: l, analysisType: u, serverFunnelQuery: d, serverFlowQuery: f, serverRetentionQuery: p, retentionValidation: _ } = e, { getFieldLabel: b } = ne(), S = u === "funnel" || l, C = u === "flow", w = u === "retention", T = u === "query" && i, E = u === "query" && !i, re = u === "funnel" && !!d, D = B(() => re || !S || !c || n.length < 2 ? null : te(n, c), [
|
|
3117
|
+
re,
|
|
3118
|
+
S,
|
|
2337
3119
|
c,
|
|
2338
3120
|
n
|
|
2339
|
-
]),
|
|
2340
|
-
skip: !a || !
|
|
3121
|
+
]), O = h(t, {
|
|
3122
|
+
skip: !a || !E,
|
|
2341
3123
|
debounceMs: 300
|
|
2342
|
-
}),
|
|
2343
|
-
skip: !r || !
|
|
3124
|
+
}), k = g(r, {
|
|
3125
|
+
skip: !r || !T,
|
|
2344
3126
|
debounceMs: 300
|
|
2345
|
-
}),
|
|
2346
|
-
skip: !
|
|
3127
|
+
}), A = y(D, {
|
|
3128
|
+
skip: !S || !D && !d,
|
|
2347
3129
|
debounceMs: 300,
|
|
2348
|
-
prebuiltServerQuery:
|
|
2349
|
-
}),
|
|
2350
|
-
skip: !
|
|
3130
|
+
prebuiltServerQuery: re ? d : void 0
|
|
3131
|
+
}), j = m(f ?? null, {
|
|
3132
|
+
skip: !C || !f,
|
|
2351
3133
|
debounceMs: 300
|
|
2352
|
-
}),
|
|
2353
|
-
skip: !
|
|
3134
|
+
}), M = v(p ?? null, {
|
|
3135
|
+
skip: !w || !p,
|
|
2354
3136
|
debounceMs: 300,
|
|
2355
|
-
getFieldLabel:
|
|
2356
|
-
}),
|
|
3137
|
+
getFieldLabel: b
|
|
3138
|
+
}), ie = ee({
|
|
2357
3139
|
queries: i ? n : [t],
|
|
2358
3140
|
isMultiQueryMode: i,
|
|
2359
|
-
skip: !a ||
|
|
2360
|
-
}),
|
|
2361
|
-
|
|
3141
|
+
skip: !a || S || C || w
|
|
3142
|
+
}), N = x(A.serverQuery, { skip: !S || !A.serverQuery }), P = x(j.serverQuery, { skip: !C || !j.serverQuery }), ae = x(p, { skip: !w || !p }), F = w ? M.isLoading || M.isDebouncing : C ? j.isLoading || j.isDebouncing : S ? A.isExecuting || A.isDebouncing : T ? k.isLoading : O.isLoading, oe = w ? M.isFetching : C ? j.isFetching : S ? A.isExecuting : T ? k.isFetching : O.isFetching, I = w ? M.error : C ? j.error : S ? A.error : T ? k.error : O.error, se = !!(O.debouncedQuery || k.debouncedConfig || !A.isDebouncing || !j.isDebouncing || !M.isDebouncing), L = R((e) => {
|
|
3143
|
+
w ? M.execute(e) : C ? j.refetch(e) : S ? A.execute(e) : T ? k.refetch(e) : O.refetch(e);
|
|
2362
3144
|
}, [
|
|
2363
|
-
|
|
2364
|
-
|
|
3145
|
+
w,
|
|
3146
|
+
C,
|
|
3147
|
+
S,
|
|
2365
3148
|
T,
|
|
2366
|
-
O,
|
|
2367
|
-
I,
|
|
2368
|
-
F,
|
|
2369
|
-
N,
|
|
2370
3149
|
M,
|
|
2371
|
-
j
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
3150
|
+
j,
|
|
3151
|
+
A,
|
|
3152
|
+
k,
|
|
3153
|
+
O
|
|
3154
|
+
]), ce = B(() => {
|
|
3155
|
+
let e = w ? M.chartData : C ? j.data : S ? A.chartData : T ? k.data : O.rawData;
|
|
3156
|
+
return o && o.length > 0 && !e ? "success" : a ? F && !e ? "loading" : oe && e ? "refreshing" : I ? "error" : e ? "success" : "idle" : "idle";
|
|
2375
3157
|
}, [
|
|
2376
3158
|
a,
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
3159
|
+
F,
|
|
3160
|
+
oe,
|
|
3161
|
+
I,
|
|
3162
|
+
O.rawData,
|
|
3163
|
+
k.data,
|
|
3164
|
+
A.chartData,
|
|
3165
|
+
j.data,
|
|
3166
|
+
M.chartData,
|
|
2385
3167
|
o,
|
|
2386
|
-
O,
|
|
2387
3168
|
T,
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
3169
|
+
S,
|
|
3170
|
+
C,
|
|
3171
|
+
w
|
|
3172
|
+
]), z = B(() => w && M.chartData ? M.chartData.rows.map((e) => ({
|
|
2391
3173
|
"Retention.period": `P${e.period}`,
|
|
2392
3174
|
"Retention.rate": e.retentionRate,
|
|
2393
3175
|
"Retention.retained": e.retainedUsers,
|
|
2394
3176
|
"Retention.cohortSize": e.cohortSize,
|
|
2395
3177
|
"Retention.segment": e.breakdownValue || "All Users"
|
|
2396
|
-
})) :
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
3178
|
+
})) : C && j.data ? [j.data] : S && A.chartData ? A.chartData : T && k.data ? k.data : O.rawData ? O.rawData : o && o.length > 0 ? o : null, [
|
|
3179
|
+
O.rawData,
|
|
3180
|
+
k.data,
|
|
3181
|
+
A.chartData,
|
|
3182
|
+
j.data,
|
|
3183
|
+
M.chartData,
|
|
2402
3184
|
o,
|
|
2403
|
-
O,
|
|
2404
3185
|
T,
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
3186
|
+
S,
|
|
3187
|
+
C,
|
|
3188
|
+
w
|
|
3189
|
+
]), V = B(() => S && A.stepResults ? A.stepResults.map((e) => e.data) : !T || !k.perQueryData ? null : k.perQueryData, [
|
|
2409
3190
|
T,
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
3191
|
+
S,
|
|
3192
|
+
k.perQueryData,
|
|
3193
|
+
A.stepResults
|
|
3194
|
+
]), H = S && A.executedQueries?.length > 0 ? A.executedQueries : null, U = S ? A.serverQuery : null, W = S ? N.debugData : null, G = C ? j.serverQuery : null, le = C ? j.data : null, ue = C ? P.debugData : null, de = w ? p ?? null : null, fe = w ? M.chartData : null, pe = w ? ae.debugData : null, me = B(() => w ? M.needsRefresh : C ? j.needsRefresh : S ? A.needsRefresh : T ? !1 : O.needsRefresh, [
|
|
3195
|
+
w,
|
|
3196
|
+
C,
|
|
3197
|
+
S,
|
|
2415
3198
|
T,
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
}, [k, j.warnings]);
|
|
3199
|
+
M.needsRefresh,
|
|
3200
|
+
j.needsRefresh,
|
|
3201
|
+
A.needsRefresh,
|
|
3202
|
+
O.needsRefresh
|
|
3203
|
+
]), he = B(() => {
|
|
3204
|
+
if (E && O.warnings) return O.warnings;
|
|
3205
|
+
}, [E, O.warnings]);
|
|
2424
3206
|
return {
|
|
2425
|
-
executionStatus:
|
|
2426
|
-
executionResults:
|
|
2427
|
-
perQueryResults:
|
|
2428
|
-
isLoading:
|
|
2429
|
-
isFetching:
|
|
2430
|
-
error:
|
|
2431
|
-
debugDataPerQuery:
|
|
2432
|
-
hasDebounced:
|
|
2433
|
-
refetch:
|
|
2434
|
-
funnelExecutedQueries:
|
|
3207
|
+
executionStatus: ce,
|
|
3208
|
+
executionResults: z,
|
|
3209
|
+
perQueryResults: V,
|
|
3210
|
+
isLoading: F,
|
|
3211
|
+
isFetching: oe,
|
|
3212
|
+
error: I,
|
|
3213
|
+
debugDataPerQuery: ie.debugDataPerQuery,
|
|
3214
|
+
hasDebounced: se,
|
|
3215
|
+
refetch: L,
|
|
3216
|
+
funnelExecutedQueries: H,
|
|
2435
3217
|
funnelServerQuery: U,
|
|
2436
|
-
funnelDebugData:
|
|
2437
|
-
flowServerQuery:
|
|
2438
|
-
flowChartData:
|
|
2439
|
-
flowDebugData:
|
|
2440
|
-
retentionServerQuery:
|
|
2441
|
-
retentionChartData:
|
|
2442
|
-
retentionDebugData:
|
|
2443
|
-
retentionValidation:
|
|
2444
|
-
needsRefresh:
|
|
2445
|
-
warnings:
|
|
3218
|
+
funnelDebugData: W,
|
|
3219
|
+
flowServerQuery: G,
|
|
3220
|
+
flowChartData: le,
|
|
3221
|
+
flowDebugData: ue,
|
|
3222
|
+
retentionServerQuery: de,
|
|
3223
|
+
retentionChartData: fe,
|
|
3224
|
+
retentionDebugData: pe,
|
|
3225
|
+
retentionValidation: _ ?? null,
|
|
3226
|
+
needsRefresh: me,
|
|
3227
|
+
warnings: he
|
|
2446
3228
|
};
|
|
2447
3229
|
}
|
|
2448
3230
|
//#endregion
|
|
2449
3231
|
//#region src/client/hooks/useAnalysisChartDefaults.ts
|
|
2450
|
-
function
|
|
2451
|
-
let { externalColorPalette: t, combinedMetrics: r, combinedBreakdowns: i, hasDebounced: a } = e, o =
|
|
3232
|
+
function tn(e) {
|
|
3233
|
+
let { externalColorPalette: t, combinedMetrics: r, combinedBreakdowns: i, hasDebounced: a } = e, o = $((e) => e.analysisType), { chartType: s, chartConfig: c, displayConfig: l } = $(n(Bt)), u = $((e) => e.userManuallySelectedChart), d = $((e) => e.localPaletteName), f = $((e) => e.setChartTypeManual), p = $((e) => e.setChartConfig), m = $((e) => e.setDisplayConfig), h = $((e) => e.setFunnelChartType), g = $((e) => e.setFunnelChartConfig), _ = $((e) => e.setFunnelDisplayConfig), v = $((e) => e.setLocalPaletteName), y = $((e) => e.setUserManuallySelectedChart), b = R((e) => {
|
|
2452
3234
|
if (o === "funnel") h(e);
|
|
2453
3235
|
else {
|
|
2454
3236
|
f(e);
|
|
2455
|
-
let { chartConfig: t } =
|
|
3237
|
+
let { chartConfig: t } = Ke(r, i, e);
|
|
2456
3238
|
p(t);
|
|
2457
3239
|
}
|
|
2458
3240
|
}, [
|
|
@@ -2462,25 +3244,25 @@ function bt(e) {
|
|
|
2462
3244
|
h,
|
|
2463
3245
|
f,
|
|
2464
3246
|
p
|
|
2465
|
-
]), x =
|
|
3247
|
+
]), x = R((e) => {
|
|
2466
3248
|
o === "funnel" ? g(e) : p(e);
|
|
2467
3249
|
}, [
|
|
2468
3250
|
o,
|
|
2469
3251
|
g,
|
|
2470
3252
|
p
|
|
2471
|
-
]),
|
|
3253
|
+
]), ee = R((e) => {
|
|
2472
3254
|
o === "funnel" ? _(e) : m(e);
|
|
2473
3255
|
}, [
|
|
2474
3256
|
o,
|
|
2475
3257
|
_,
|
|
2476
3258
|
m
|
|
2477
|
-
]),
|
|
3259
|
+
]), te = B(() => We(r, i), [r, i]), S = B(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
|
|
2478
3260
|
name: "custom",
|
|
2479
3261
|
label: "Custom",
|
|
2480
3262
|
colors: t,
|
|
2481
3263
|
gradient: t
|
|
2482
|
-
} : t :
|
|
2483
|
-
return
|
|
3264
|
+
} : t : M(d), [t, d]), ne = V("");
|
|
3265
|
+
return z(() => {
|
|
2484
3266
|
if (!a || r.length === 0 && i.length === 0) return;
|
|
2485
3267
|
let e = JSON.stringify({
|
|
2486
3268
|
metrics: r.map((e) => e.field),
|
|
@@ -2489,14 +3271,14 @@ function bt(e) {
|
|
|
2489
3271
|
isTime: e.isTimeDimension
|
|
2490
3272
|
}))
|
|
2491
3273
|
});
|
|
2492
|
-
if (e ===
|
|
2493
|
-
|
|
2494
|
-
let t =
|
|
3274
|
+
if (e === ne.current) return;
|
|
3275
|
+
ne.current = e;
|
|
3276
|
+
let t = Je(r, i, s, u);
|
|
2495
3277
|
if (t) {
|
|
2496
|
-
let { chartConfig: e } =
|
|
3278
|
+
let { chartConfig: e } = Ke(r, i, t);
|
|
2497
3279
|
b(t), x(e), y(!1);
|
|
2498
3280
|
} else if ((r.length > 0 || i.length > 0) && !c.xAxis?.length && !c.yAxis?.length && !c.series?.length) {
|
|
2499
|
-
let { chartConfig: e } =
|
|
3281
|
+
let { chartConfig: e } = Ke(r, i, s);
|
|
2500
3282
|
x(e);
|
|
2501
3283
|
}
|
|
2502
3284
|
}, [
|
|
@@ -2513,20 +3295,20 @@ function bt(e) {
|
|
|
2513
3295
|
chartType: s,
|
|
2514
3296
|
chartConfig: c,
|
|
2515
3297
|
displayConfig: l,
|
|
2516
|
-
colorPalette:
|
|
3298
|
+
colorPalette: S,
|
|
2517
3299
|
localPaletteName: d,
|
|
2518
|
-
chartAvailability:
|
|
3300
|
+
chartAvailability: te,
|
|
2519
3301
|
userManuallySelectedChart: u,
|
|
2520
3302
|
setChartType: b,
|
|
2521
3303
|
setChartConfig: x,
|
|
2522
|
-
setDisplayConfig:
|
|
3304
|
+
setDisplayConfig: ee,
|
|
2523
3305
|
setLocalPaletteName: v
|
|
2524
3306
|
};
|
|
2525
3307
|
}
|
|
2526
3308
|
//#endregion
|
|
2527
3309
|
//#region src/client/hooks/useAnalysisUIState.ts
|
|
2528
|
-
function
|
|
2529
|
-
let e =
|
|
3310
|
+
function nn() {
|
|
3311
|
+
let e = $((e) => e.activeTab), t = $((e) => e.activeView), n = $((e) => e.displayLimit), r = $((e) => e.showFieldModal), i = $((e) => e.fieldModalMode), a = $((e) => e.userManuallySelectedChart), o = $((e) => e.setActiveTab), s = $((e) => e.setActiveView), c = $((e) => e.setDisplayLimit), l = $((e) => e.closeFieldModal), [u, d] = H(0);
|
|
2530
3312
|
return {
|
|
2531
3313
|
activeTab: e,
|
|
2532
3314
|
activeView: t,
|
|
@@ -2544,42 +3326,42 @@ function xt() {
|
|
|
2544
3326
|
}
|
|
2545
3327
|
//#endregion
|
|
2546
3328
|
//#region src/client/utils/shareUtils.ts
|
|
2547
|
-
var
|
|
2548
|
-
function
|
|
2549
|
-
return (0,
|
|
3329
|
+
var rn = o(), an = 1800, on = "share=";
|
|
3330
|
+
function sn(e) {
|
|
3331
|
+
return (0, rn.compressToEncodedURIComponent)(JSON.stringify(e));
|
|
2550
3332
|
}
|
|
2551
|
-
function
|
|
3333
|
+
function cn(e) {
|
|
2552
3334
|
try {
|
|
2553
|
-
let t = (0,
|
|
3335
|
+
let t = (0, rn.decompressFromEncodedURIComponent)(e);
|
|
2554
3336
|
if (!t) return null;
|
|
2555
3337
|
let n = JSON.parse(t);
|
|
2556
|
-
return
|
|
3338
|
+
return E(n) ? n : (console.warn("[shareUtils] Invalid AnalysisConfig in share URL"), null);
|
|
2557
3339
|
} catch {
|
|
2558
3340
|
return null;
|
|
2559
3341
|
}
|
|
2560
3342
|
}
|
|
2561
|
-
function
|
|
2562
|
-
let t =
|
|
3343
|
+
function ln(e) {
|
|
3344
|
+
let t = sn(e);
|
|
2563
3345
|
return {
|
|
2564
|
-
ok: t.length <=
|
|
3346
|
+
ok: t.length <= an,
|
|
2565
3347
|
size: t.length,
|
|
2566
|
-
maxSize:
|
|
3348
|
+
maxSize: an
|
|
2567
3349
|
};
|
|
2568
3350
|
}
|
|
2569
|
-
function
|
|
2570
|
-
let t =
|
|
2571
|
-
if (t.length <=
|
|
3351
|
+
function un(e) {
|
|
3352
|
+
let t = sn(e);
|
|
3353
|
+
if (t.length <= an) return {
|
|
2572
3354
|
encoded: t,
|
|
2573
3355
|
queryOnly: !1
|
|
2574
3356
|
};
|
|
2575
|
-
let n =
|
|
3357
|
+
let n = sn({
|
|
2576
3358
|
version: e.version,
|
|
2577
3359
|
analysisType: e.analysisType,
|
|
2578
3360
|
activeView: e.activeView,
|
|
2579
3361
|
charts: {},
|
|
2580
3362
|
query: e.query
|
|
2581
3363
|
});
|
|
2582
|
-
return n.length <=
|
|
3364
|
+
return n.length <= an ? {
|
|
2583
3365
|
encoded: n,
|
|
2584
3366
|
queryOnly: !0
|
|
2585
3367
|
} : {
|
|
@@ -2587,40 +3369,40 @@ function Ot(e) {
|
|
|
2587
3369
|
queryOnly: !0
|
|
2588
3370
|
};
|
|
2589
3371
|
}
|
|
2590
|
-
function
|
|
2591
|
-
let { encoded: t } =
|
|
2592
|
-
return t ? `${window.location.origin}${window.location.pathname}#${
|
|
3372
|
+
function dn(e) {
|
|
3373
|
+
let { encoded: t } = un(e);
|
|
3374
|
+
return t ? `${window.location.origin}${window.location.pathname}#${on}${t}` : null;
|
|
2593
3375
|
}
|
|
2594
|
-
function
|
|
3376
|
+
function fn() {
|
|
2595
3377
|
if (typeof window > "u") return null;
|
|
2596
3378
|
let e = window.location.hash;
|
|
2597
|
-
return !e || !e.startsWith(`#${
|
|
3379
|
+
return !e || !e.startsWith(`#${on}`) ? null : e.slice(7);
|
|
2598
3380
|
}
|
|
2599
|
-
function
|
|
3381
|
+
function pn() {
|
|
2600
3382
|
if (typeof window > "u") return;
|
|
2601
3383
|
let e = new URL(window.location.href);
|
|
2602
3384
|
e.hash = "", window.history.replaceState(null, "", e.toString());
|
|
2603
3385
|
}
|
|
2604
|
-
function
|
|
2605
|
-
let e =
|
|
2606
|
-
return e ?
|
|
3386
|
+
function mn() {
|
|
3387
|
+
let e = fn();
|
|
3388
|
+
return e ? cn(e) : null;
|
|
2607
3389
|
}
|
|
2608
3390
|
//#endregion
|
|
2609
3391
|
//#region src/client/hooks/useAnalysisInitialization.ts
|
|
2610
|
-
function
|
|
2611
|
-
let { currentQuery: t, isValidQuery: n, chartType: r, chartConfig: i, displayConfig: a, onQueryChange: o, onChartConfigChange: s } = e, c =
|
|
2612
|
-
|
|
3392
|
+
function hn(e) {
|
|
3393
|
+
let { currentQuery: t, isValidQuery: n, chartType: r, chartConfig: i, displayConfig: a, onQueryChange: o, onChartConfigChange: s } = e, c = $((e) => e.load), l = V(!1);
|
|
3394
|
+
z(() => {
|
|
2613
3395
|
if (l.current) return;
|
|
2614
3396
|
l.current = !0;
|
|
2615
|
-
let e =
|
|
2616
|
-
e && (c(e),
|
|
2617
|
-
}, [c]),
|
|
3397
|
+
let e = mn();
|
|
3398
|
+
e && (c(e), pn());
|
|
3399
|
+
}, [c]), z(() => {
|
|
2618
3400
|
o && n && o(t);
|
|
2619
3401
|
}, [
|
|
2620
3402
|
t,
|
|
2621
3403
|
n,
|
|
2622
3404
|
o
|
|
2623
|
-
]),
|
|
3405
|
+
]), z(() => {
|
|
2624
3406
|
s && s({
|
|
2625
3407
|
chartType: r,
|
|
2626
3408
|
chartConfig: i,
|
|
@@ -2635,99 +3417,99 @@ function Nt(e) {
|
|
|
2635
3417
|
}
|
|
2636
3418
|
//#endregion
|
|
2637
3419
|
//#region src/client/hooks/useAnalysisBuilderHook.ts
|
|
2638
|
-
function
|
|
2639
|
-
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o =
|
|
3420
|
+
function gn(e = {}) {
|
|
3421
|
+
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o = Ft(), c = Qt(), l = $t({
|
|
2640
3422
|
queryState: c.queryState,
|
|
2641
3423
|
queryStates: c.queryStates,
|
|
2642
3424
|
isMultiQueryMode: c.isMultiQueryMode,
|
|
2643
3425
|
mergeStrategy: c.mergeStrategy,
|
|
2644
3426
|
activeQueryIndex: c.activeQueryIndex
|
|
2645
|
-
}), u =
|
|
3427
|
+
}), u = $((e) => e.funnelBindingKey), d = $((e) => e.analysisType), f = $((e) => e.funnelCube), p = $((e) => e.funnelSteps), m = $((e) => e.activeFunnelStepIndex), h = $((e) => e.funnelTimeDimension), g = B(() => d !== "funnel" || !u?.dimension || !h || !p || p.length < 2 ? !1 : p.every((e) => e.filters.length > 0), [
|
|
2646
3428
|
d,
|
|
2647
3429
|
u,
|
|
2648
3430
|
h,
|
|
2649
3431
|
p
|
|
2650
|
-
]), _ =
|
|
3432
|
+
]), _ = $((e) => e.charts.funnel?.chartType) || "funnel", v = $((e) => e.charts.funnel?.chartConfig), y = B(() => v || {}, [v]), b = $((e) => e.flowCube), x = $((e) => e.flowBindingKey), ee = $((e) => e.flowTimeDimension), te = $((e) => e.eventDimension), S = $((e) => e.startingStep), ne = $((e) => e.stepsBefore), C = $((e) => e.stepsAfter), w = $((e) => e.joinStrategy), T = $((e) => e.charts.flow?.displayConfig), E = B(() => T || {
|
|
2651
3433
|
showLegend: !0,
|
|
2652
3434
|
showGrid: !0,
|
|
2653
3435
|
showTooltip: !0
|
|
2654
|
-
}, [
|
|
3436
|
+
}, [T]), re = $((e) => e.charts.flow?.chartType) || "sankey", D = $((e) => e.buildFunnelQueryFromSteps), O = B(() => d === "funnel" ? D() : null, [
|
|
2655
3437
|
d,
|
|
2656
|
-
|
|
3438
|
+
D,
|
|
2657
3439
|
p
|
|
2658
|
-
]),
|
|
3440
|
+
]), k = $((e) => e.buildFlowQuery), A = B(() => d === "flow" ? k() : null, [
|
|
2659
3441
|
d,
|
|
2660
|
-
|
|
3442
|
+
k,
|
|
2661
3443
|
b,
|
|
2662
3444
|
x,
|
|
3445
|
+
ee,
|
|
3446
|
+
te,
|
|
2663
3447
|
S,
|
|
2664
|
-
C,
|
|
2665
|
-
w,
|
|
2666
|
-
T,
|
|
2667
|
-
E,
|
|
2668
|
-
A,
|
|
2669
|
-
D
|
|
2670
|
-
]), F = Q((e) => e.retentionCube), I = Q((e) => e.retentionBindingKey), R = Q((e) => e.retentionTimeDimension), z = Q((e) => e.retentionDateRange), B = Q((e) => e.retentionCohortFilters), V = Q((e) => e.retentionActivityFilters), ne = Q((e) => e.retentionBreakdowns), re = Q((e) => e.retentionViewGranularity), H = Q((e) => e.retentionPeriods), ie = Q((e) => e.retentionType), ae = Q((e) => e.buildRetentionQuery), oe = Q((e) => e.getRetentionValidation), se = Q((e) => e.charts.retention?.displayConfig), ce = Q((e) => e.setRetentionCube), U = Q((e) => e.setRetentionBindingKey), le = Q((e) => e.setRetentionTimeDimension), ue = Q((e) => e.setRetentionDateRange), de = Q((e) => e.setRetentionCohortFilters), fe = Q((e) => e.setRetentionActivityFilters), pe = Q((e) => e.setRetentionBreakdowns), W = Q((e) => e.addRetentionBreakdown), me = Q((e) => e.removeRetentionBreakdown), he = Q((e) => e.setRetentionViewGranularity), ge = Q((e) => e.setRetentionPeriods), _e = Q((e) => e.setRetentionType), ve = L(() => d === "retention" ? ae() : null, [
|
|
2671
|
-
d,
|
|
2672
|
-
ae,
|
|
2673
|
-
F,
|
|
2674
|
-
I,
|
|
2675
|
-
R,
|
|
2676
|
-
z,
|
|
2677
3448
|
ne,
|
|
3449
|
+
C,
|
|
2678
3450
|
re,
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
B,
|
|
2682
|
-
V
|
|
2683
|
-
]), G = L(() => d === "retention" ? oe() : null, [
|
|
3451
|
+
w
|
|
3452
|
+
]), j = $((e) => e.retentionCube), M = $((e) => e.retentionBindingKey), ie = $((e) => e.retentionTimeDimension), N = $((e) => e.retentionDateRange), P = $((e) => e.retentionCohortFilters), ae = $((e) => e.retentionActivityFilters), F = $((e) => e.retentionBreakdowns), oe = $((e) => e.retentionViewGranularity), I = $((e) => e.retentionPeriods), se = $((e) => e.retentionType), L = $((e) => e.buildRetentionQuery), ce = $((e) => e.getRetentionValidation), z = $((e) => e.charts.retention?.displayConfig), H = $((e) => e.setRetentionCube), U = $((e) => e.setRetentionBindingKey), W = $((e) => e.setRetentionTimeDimension), G = $((e) => e.setRetentionDateRange), le = $((e) => e.setRetentionCohortFilters), ue = $((e) => e.setRetentionActivityFilters), de = $((e) => e.setRetentionBreakdowns), fe = $((e) => e.addRetentionBreakdown), pe = $((e) => e.removeRetentionBreakdown), me = $((e) => e.setRetentionViewGranularity), he = $((e) => e.setRetentionPeriods), ge = $((e) => e.setRetentionType), K = B(() => d === "retention" ? L() : null, [
|
|
2684
3453
|
d,
|
|
2685
|
-
|
|
3454
|
+
L,
|
|
3455
|
+
j,
|
|
3456
|
+
M,
|
|
3457
|
+
ie,
|
|
3458
|
+
N,
|
|
2686
3459
|
F,
|
|
3460
|
+
oe,
|
|
2687
3461
|
I,
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
3462
|
+
se,
|
|
3463
|
+
P,
|
|
3464
|
+
ae
|
|
3465
|
+
]), _e = B(() => d === "retention" ? ce() : null, [
|
|
2691
3466
|
d,
|
|
2692
|
-
|
|
2693
|
-
N,
|
|
3467
|
+
ce,
|
|
2694
3468
|
j,
|
|
3469
|
+
M,
|
|
3470
|
+
ie,
|
|
3471
|
+
N
|
|
3472
|
+
]), ve = B(() => d === "retention" ? K !== null : d === "flow" ? A !== null : d === "funnel" ? O !== null : c.isValidQuery ?? !1, [
|
|
3473
|
+
d,
|
|
3474
|
+
K,
|
|
3475
|
+
A,
|
|
3476
|
+
O,
|
|
2695
3477
|
c.isValidQuery
|
|
2696
|
-
]),
|
|
3478
|
+
]), q = en({
|
|
2697
3479
|
currentQuery: c.currentQuery,
|
|
2698
3480
|
allQueries: c.allQueries,
|
|
2699
3481
|
multiQueryConfig: c.multiQueryConfig,
|
|
2700
3482
|
isMultiQueryMode: c.isMultiQueryMode,
|
|
2701
|
-
isValidQuery:
|
|
3483
|
+
isValidQuery: ve,
|
|
2702
3484
|
initialData: t,
|
|
2703
3485
|
mergeStrategy: c.mergeStrategy,
|
|
2704
3486
|
funnelBindingKey: u,
|
|
2705
3487
|
isFunnelModeEnabled: g,
|
|
2706
3488
|
analysisType: d,
|
|
2707
|
-
serverFunnelQuery:
|
|
2708
|
-
serverFlowQuery:
|
|
2709
|
-
serverRetentionQuery:
|
|
2710
|
-
retentionValidation:
|
|
2711
|
-
}),
|
|
3489
|
+
serverFunnelQuery: O,
|
|
3490
|
+
serverFlowQuery: A,
|
|
3491
|
+
serverRetentionQuery: K,
|
|
3492
|
+
retentionValidation: _e
|
|
3493
|
+
}), J = tn({
|
|
2712
3494
|
externalColorPalette: n,
|
|
2713
3495
|
combinedMetrics: l.combinedMetrics,
|
|
2714
3496
|
combinedBreakdowns: l.combinedBreakdowns,
|
|
2715
|
-
hasDebounced:
|
|
2716
|
-
}),
|
|
2717
|
-
|
|
3497
|
+
hasDebounced: q.hasDebounced
|
|
3498
|
+
}), Y = nn();
|
|
3499
|
+
hn({
|
|
2718
3500
|
currentQuery: c.currentQuery,
|
|
2719
3501
|
isValidQuery: c.isValidQuery ?? !1,
|
|
2720
|
-
chartType:
|
|
2721
|
-
chartConfig:
|
|
2722
|
-
displayConfig:
|
|
3502
|
+
chartType: J.chartType,
|
|
3503
|
+
chartConfig: J.chartConfig,
|
|
3504
|
+
displayConfig: J.displayConfig,
|
|
2723
3505
|
onQueryChange: r,
|
|
2724
3506
|
onChartConfigChange: i
|
|
2725
3507
|
});
|
|
2726
|
-
let
|
|
3508
|
+
let ye = $((e) => e.openMetricsModal), be = $((e) => e.addMetric), xe = $((e) => e.removeMetric), Se = $((e) => e.toggleMetric), Ce = $((e) => e.reorderMetrics), we = $((e) => e.openBreakdownsModal), Te = $((e) => e.addBreakdown), Ee = $((e) => e.removeBreakdown), De = $((e) => e.toggleBreakdown), Oe = $((e) => e.setBreakdownGranularity), ke = $((e) => e.toggleBreakdownComparison), Ae = $((e) => e.reorderBreakdowns), je = $((e) => e.setFilters), Me = $((e) => e.dropFieldToFilter), Ne = $((e) => e.setOrder), Pe = $((e) => e.clearQuery), Fe = $((e) => e.clearCurrentMode), Ie = $((e) => e.setFunnelBindingKey), Le = $((e) => e.setAnalysisType), Re = $((e) => e.setFunnelCube), ze = $((e) => e.addFunnelStep), Be = $((e) => e.removeFunnelStep), Ve = $((e) => e.updateFunnelStep), He = $((e) => e.setActiveFunnelStepIndex), Ue = $((e) => e.reorderFunnelSteps), We = $((e) => e.setFunnelTimeDimension), Ge = $((e) => e.charts.funnel?.displayConfig), Ke = B(() => Ge || {
|
|
2727
3509
|
showLegend: !0,
|
|
2728
3510
|
showGrid: !0,
|
|
2729
3511
|
showTooltip: !0
|
|
2730
|
-
}, [
|
|
3512
|
+
}, [Ge]), qe = $((e) => e.setFunnelDisplayConfig), Je = $((e) => e.setFlowCube), Ye = $((e) => e.setFlowBindingKey), Xe = $((e) => e.setFlowTimeDimension), Ze = $((e) => e.setEventDimension), Qe = $((e) => e.setStartingStepName), $e = $((e) => e.setStartingStepFilters), et = $((e) => e.setStepsBefore), tt = $((e) => e.setStepsAfter), nt = $((e) => e.setJoinStrategy), rt = R((e) => {
|
|
2731
3513
|
o.setState((t) => ({ charts: {
|
|
2732
3514
|
...t.charts,
|
|
2733
3515
|
flow: {
|
|
@@ -2739,7 +3521,7 @@ function Pt(e = {}) {
|
|
|
2739
3521
|
displayConfig: e
|
|
2740
3522
|
}
|
|
2741
3523
|
} }));
|
|
2742
|
-
}, [o]),
|
|
3524
|
+
}, [o]), it = R((e) => {
|
|
2743
3525
|
o.setState((t) => ({ charts: {
|
|
2744
3526
|
...t.charts,
|
|
2745
3527
|
retention: {
|
|
@@ -2751,7 +3533,7 @@ function Pt(e = {}) {
|
|
|
2751
3533
|
displayConfig: e
|
|
2752
3534
|
}
|
|
2753
3535
|
} }));
|
|
2754
|
-
}, [o]),
|
|
3536
|
+
}, [o]), at = $((e) => e.aiState), ot = $((e) => e.openAI), st = $((e) => e.closeAI), ct = $((e) => e.setAIPrompt), lt = $((e) => e.setAIGenerating), ut = $((e) => e.setAIError), dt = $((e) => e.setAIHasGeneratedQuery), ft = $((e) => e.saveAIPreviousState), X = $((e) => e.restoreAIPreviousState), Z = V("idle"), pt = ve, mt = $((e) => e.getValidation), Q = B(() => mt(), [
|
|
2755
3537
|
mt,
|
|
2756
3538
|
c.queryStates,
|
|
2757
3539
|
d,
|
|
@@ -2760,46 +3542,46 @@ function Pt(e = {}) {
|
|
|
2760
3542
|
h,
|
|
2761
3543
|
b,
|
|
2762
3544
|
x,
|
|
3545
|
+
ee,
|
|
3546
|
+
te,
|
|
2763
3547
|
S,
|
|
3548
|
+
ne,
|
|
2764
3549
|
C,
|
|
2765
|
-
w
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
D
|
|
2769
|
-
]), gt = P((e, t, n, r) => {
|
|
2770
|
-
J.fieldModalMode === "metrics" && t === "measure" ? Ce(e.name) : J.fieldModalMode === "breakdown" && (d === "retention" && t === "dimension" ? W({ field: e.name }) : Oe(e.name, t === "timeDimension")), r || J.closeFieldModal();
|
|
3550
|
+
w
|
|
3551
|
+
]), ht = R((e, t, n, r) => {
|
|
3552
|
+
Y.fieldModalMode === "metrics" && t === "measure" ? Se(e.name) : Y.fieldModalMode === "breakdown" && (d === "retention" && t === "dimension" ? fe({ field: e.name }) : De(e.name, t === "timeDimension")), r || Y.closeFieldModal();
|
|
2771
3553
|
}, [
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
3554
|
+
Y,
|
|
3555
|
+
Se,
|
|
3556
|
+
De,
|
|
3557
|
+
fe,
|
|
2776
3558
|
d
|
|
2777
|
-
]),
|
|
3559
|
+
]), gt = R(async () => {
|
|
2778
3560
|
if (a?.aiEndpoint) {
|
|
2779
|
-
|
|
3561
|
+
ft(), lt(!0), ut(null);
|
|
2780
3562
|
try {
|
|
2781
|
-
await new Promise((e) => setTimeout(e, 1e3)),
|
|
3563
|
+
await new Promise((e) => setTimeout(e, 1e3)), dt(!0);
|
|
2782
3564
|
} catch (e) {
|
|
2783
|
-
|
|
3565
|
+
ut(e instanceof Error ? e.message : "Failed to generate query");
|
|
2784
3566
|
} finally {
|
|
2785
|
-
|
|
3567
|
+
lt(!1);
|
|
2786
3568
|
}
|
|
2787
3569
|
}
|
|
2788
3570
|
}, [
|
|
2789
3571
|
a?.aiEndpoint,
|
|
3572
|
+
ft,
|
|
3573
|
+
lt,
|
|
2790
3574
|
ut,
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
]),
|
|
2795
|
-
|
|
2796
|
-
}, [
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
ft.current = "copied", setTimeout(() => {
|
|
2800
|
-
ft.current = "idle";
|
|
3575
|
+
dt
|
|
3576
|
+
]), _t = R(() => {
|
|
3577
|
+
st(), dt(!1);
|
|
3578
|
+
}, [st, dt]), vt = R(() => {
|
|
3579
|
+
X(), st();
|
|
3580
|
+
}, [X, st]), yt = R(async () => {
|
|
3581
|
+
Z.current = "copied", setTimeout(() => {
|
|
3582
|
+
Z.current = "idle";
|
|
2801
3583
|
}, 2e3);
|
|
2802
|
-
}, []),
|
|
3584
|
+
}, []), bt = R(() => {
|
|
2803
3585
|
let e = o.getState();
|
|
2804
3586
|
return e.analysisType === "funnel" ? e.buildFunnelQueryFromSteps() || e.buildCurrentQuery() : e.queryStates.length > 1 ? {
|
|
2805
3587
|
queries: e.buildAllQueries(),
|
|
@@ -2809,23 +3591,23 @@ function Pt(e = {}) {
|
|
|
2809
3591
|
funnelBindingKey: e.funnelBindingKey,
|
|
2810
3592
|
stepTimeToConvert: e.stepTimeToConvert
|
|
2811
3593
|
} : e.buildCurrentQuery();
|
|
2812
|
-
}, [o]),
|
|
3594
|
+
}, [o]), xt = R(() => {
|
|
2813
3595
|
let e = o.getState(), t = e.charts[e.analysisType];
|
|
2814
3596
|
return t ? {
|
|
2815
3597
|
chartType: t.chartType,
|
|
2816
3598
|
chartConfig: t.chartConfig,
|
|
2817
3599
|
displayConfig: t.displayConfig
|
|
2818
3600
|
} : {
|
|
2819
|
-
chartType:
|
|
2820
|
-
chartConfig:
|
|
2821
|
-
displayConfig:
|
|
3601
|
+
chartType: J.chartType,
|
|
3602
|
+
chartConfig: J.chartConfig,
|
|
3603
|
+
displayConfig: J.displayConfig
|
|
2822
3604
|
};
|
|
2823
3605
|
}, [
|
|
2824
3606
|
o,
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
]),
|
|
3607
|
+
J.chartType,
|
|
3608
|
+
J.chartConfig,
|
|
3609
|
+
J.displayConfig
|
|
3610
|
+
]), St = R(() => o.getState().analysisType, [o]);
|
|
2829
3611
|
return {
|
|
2830
3612
|
queryState: c.queryState,
|
|
2831
3613
|
queryStates: c.queryStates,
|
|
@@ -2846,154 +3628,154 @@ function Pt(e = {}) {
|
|
|
2846
3628
|
funnelTimeDimension: h,
|
|
2847
3629
|
funnelChartType: _,
|
|
2848
3630
|
funnelChartConfig: y,
|
|
2849
|
-
funnelDisplayConfig:
|
|
3631
|
+
funnelDisplayConfig: Ke,
|
|
2850
3632
|
flowCube: b,
|
|
2851
3633
|
flowBindingKey: x,
|
|
2852
|
-
flowTimeDimension:
|
|
2853
|
-
eventDimension:
|
|
2854
|
-
startingStep:
|
|
2855
|
-
stepsBefore:
|
|
2856
|
-
stepsAfter:
|
|
2857
|
-
joinStrategy:
|
|
2858
|
-
flowDisplayConfig:
|
|
2859
|
-
retentionCube:
|
|
2860
|
-
retentionBindingKey:
|
|
2861
|
-
retentionTimeDimension:
|
|
2862
|
-
retentionDateRange:
|
|
2863
|
-
retentionCohortFilters:
|
|
2864
|
-
retentionActivityFilters:
|
|
2865
|
-
retentionBreakdowns:
|
|
2866
|
-
retentionViewGranularity:
|
|
2867
|
-
retentionPeriods:
|
|
2868
|
-
retentionType:
|
|
2869
|
-
retentionDisplayConfig:
|
|
2870
|
-
executionStatus:
|
|
2871
|
-
executionResults:
|
|
2872
|
-
perQueryResults:
|
|
2873
|
-
isLoading:
|
|
2874
|
-
isFetching:
|
|
2875
|
-
error:
|
|
2876
|
-
isValidQuery:
|
|
2877
|
-
debugDataPerQuery:
|
|
2878
|
-
needsRefresh:
|
|
2879
|
-
warnings:
|
|
2880
|
-
funnelExecutedQueries:
|
|
2881
|
-
funnelServerQuery:
|
|
2882
|
-
funnelDebugData:
|
|
2883
|
-
flowServerQuery:
|
|
2884
|
-
flowDebugData:
|
|
2885
|
-
retentionServerQuery:
|
|
2886
|
-
retentionDebugData:
|
|
2887
|
-
retentionChartData:
|
|
2888
|
-
retentionValidation:
|
|
2889
|
-
chartType:
|
|
2890
|
-
chartConfig:
|
|
2891
|
-
displayConfig:
|
|
2892
|
-
colorPalette:
|
|
2893
|
-
localPaletteName:
|
|
2894
|
-
chartAvailability:
|
|
3634
|
+
flowTimeDimension: ee,
|
|
3635
|
+
eventDimension: te,
|
|
3636
|
+
startingStep: S,
|
|
3637
|
+
stepsBefore: ne,
|
|
3638
|
+
stepsAfter: C,
|
|
3639
|
+
joinStrategy: w,
|
|
3640
|
+
flowDisplayConfig: E,
|
|
3641
|
+
retentionCube: j,
|
|
3642
|
+
retentionBindingKey: M,
|
|
3643
|
+
retentionTimeDimension: ie,
|
|
3644
|
+
retentionDateRange: N,
|
|
3645
|
+
retentionCohortFilters: P,
|
|
3646
|
+
retentionActivityFilters: ae,
|
|
3647
|
+
retentionBreakdowns: F,
|
|
3648
|
+
retentionViewGranularity: oe,
|
|
3649
|
+
retentionPeriods: I,
|
|
3650
|
+
retentionType: se,
|
|
3651
|
+
retentionDisplayConfig: z,
|
|
3652
|
+
executionStatus: q.executionStatus,
|
|
3653
|
+
executionResults: q.executionResults,
|
|
3654
|
+
perQueryResults: q.perQueryResults,
|
|
3655
|
+
isLoading: q.isLoading,
|
|
3656
|
+
isFetching: q.isFetching,
|
|
3657
|
+
error: q.error,
|
|
3658
|
+
isValidQuery: ve,
|
|
3659
|
+
debugDataPerQuery: q.debugDataPerQuery,
|
|
3660
|
+
needsRefresh: q.needsRefresh,
|
|
3661
|
+
warnings: q.warnings,
|
|
3662
|
+
funnelExecutedQueries: q.funnelExecutedQueries,
|
|
3663
|
+
funnelServerQuery: q.funnelServerQuery,
|
|
3664
|
+
funnelDebugData: q.funnelDebugData,
|
|
3665
|
+
flowServerQuery: q.flowServerQuery,
|
|
3666
|
+
flowDebugData: q.flowDebugData,
|
|
3667
|
+
retentionServerQuery: q.retentionServerQuery,
|
|
3668
|
+
retentionDebugData: q.retentionDebugData,
|
|
3669
|
+
retentionChartData: q.retentionChartData,
|
|
3670
|
+
retentionValidation: q.retentionValidation,
|
|
3671
|
+
chartType: J.chartType,
|
|
3672
|
+
chartConfig: J.chartConfig,
|
|
3673
|
+
displayConfig: J.displayConfig,
|
|
3674
|
+
colorPalette: J.colorPalette,
|
|
3675
|
+
localPaletteName: J.localPaletteName,
|
|
3676
|
+
chartAvailability: J.chartAvailability,
|
|
2895
3677
|
combinedMetrics: l.combinedMetrics,
|
|
2896
3678
|
combinedBreakdowns: l.combinedBreakdowns,
|
|
2897
3679
|
effectiveBreakdowns: l.effectiveBreakdowns,
|
|
2898
|
-
activeTab:
|
|
2899
|
-
activeView:
|
|
2900
|
-
displayLimit:
|
|
2901
|
-
showFieldModal:
|
|
2902
|
-
fieldModalMode:
|
|
2903
|
-
activeTableIndex:
|
|
2904
|
-
userManuallySelectedChart:
|
|
3680
|
+
activeTab: Y.activeTab,
|
|
3681
|
+
activeView: Y.activeView,
|
|
3682
|
+
displayLimit: Y.displayLimit,
|
|
3683
|
+
showFieldModal: Y.showFieldModal,
|
|
3684
|
+
fieldModalMode: Y.fieldModalMode,
|
|
3685
|
+
activeTableIndex: Y.activeTableIndex,
|
|
3686
|
+
userManuallySelectedChart: Y.userManuallySelectedChart,
|
|
2905
3687
|
aiState: {
|
|
2906
|
-
isOpen:
|
|
2907
|
-
userPrompt:
|
|
2908
|
-
isGenerating:
|
|
2909
|
-
error:
|
|
2910
|
-
hasGeneratedQuery:
|
|
3688
|
+
isOpen: at.isOpen,
|
|
3689
|
+
userPrompt: at.userPrompt,
|
|
3690
|
+
isGenerating: at.isGenerating,
|
|
3691
|
+
error: at.error,
|
|
3692
|
+
hasGeneratedQuery: at.hasGeneratedQuery
|
|
2911
3693
|
},
|
|
2912
|
-
shareButtonState:
|
|
3694
|
+
shareButtonState: Z.current,
|
|
2913
3695
|
canShare: pt,
|
|
2914
|
-
adapterValidation:
|
|
3696
|
+
adapterValidation: Q,
|
|
2915
3697
|
actions: {
|
|
2916
3698
|
setActiveQueryIndex: c.setActiveQueryIndex,
|
|
2917
3699
|
setMergeStrategy: c.setMergeStrategy,
|
|
2918
|
-
openMetricsModal:
|
|
2919
|
-
addMetric:
|
|
2920
|
-
removeMetric:
|
|
2921
|
-
toggleMetric:
|
|
2922
|
-
reorderMetrics:
|
|
2923
|
-
openBreakdownsModal:
|
|
2924
|
-
addBreakdown:
|
|
2925
|
-
removeBreakdown:
|
|
2926
|
-
toggleBreakdown:
|
|
2927
|
-
setBreakdownGranularity:
|
|
2928
|
-
toggleBreakdownComparison:
|
|
2929
|
-
reorderBreakdowns:
|
|
2930
|
-
setFilters:
|
|
2931
|
-
dropFieldToFilter:
|
|
2932
|
-
setOrder:
|
|
3700
|
+
openMetricsModal: ye,
|
|
3701
|
+
addMetric: be,
|
|
3702
|
+
removeMetric: xe,
|
|
3703
|
+
toggleMetric: Se,
|
|
3704
|
+
reorderMetrics: Ce,
|
|
3705
|
+
openBreakdownsModal: we,
|
|
3706
|
+
addBreakdown: Te,
|
|
3707
|
+
removeBreakdown: Ee,
|
|
3708
|
+
toggleBreakdown: De,
|
|
3709
|
+
setBreakdownGranularity: Oe,
|
|
3710
|
+
toggleBreakdownComparison: ke,
|
|
3711
|
+
reorderBreakdowns: Ae,
|
|
3712
|
+
setFilters: je,
|
|
3713
|
+
dropFieldToFilter: Me,
|
|
3714
|
+
setOrder: Ne,
|
|
2933
3715
|
addQuery: c.addQuery,
|
|
2934
3716
|
removeQuery: c.removeQuery,
|
|
2935
|
-
setFunnelBindingKey:
|
|
2936
|
-
setAnalysisType:
|
|
2937
|
-
setFunnelCube:
|
|
2938
|
-
addFunnelStep:
|
|
2939
|
-
removeFunnelStep:
|
|
2940
|
-
updateFunnelStep:
|
|
2941
|
-
setActiveFunnelStepIndex:
|
|
2942
|
-
reorderFunnelSteps:
|
|
2943
|
-
setFunnelTimeDimension:
|
|
2944
|
-
setFunnelDisplayConfig:
|
|
2945
|
-
setFlowCube:
|
|
2946
|
-
setFlowBindingKey:
|
|
2947
|
-
setFlowTimeDimension:
|
|
2948
|
-
setEventDimension:
|
|
2949
|
-
setStartingStepName:
|
|
2950
|
-
setStartingStepFilters:
|
|
2951
|
-
setStepsBefore:
|
|
2952
|
-
setStepsAfter:
|
|
2953
|
-
setJoinStrategy:
|
|
2954
|
-
setFlowDisplayConfig:
|
|
2955
|
-
setRetentionCube:
|
|
3717
|
+
setFunnelBindingKey: Ie,
|
|
3718
|
+
setAnalysisType: Le,
|
|
3719
|
+
setFunnelCube: Re,
|
|
3720
|
+
addFunnelStep: ze,
|
|
3721
|
+
removeFunnelStep: Be,
|
|
3722
|
+
updateFunnelStep: Ve,
|
|
3723
|
+
setActiveFunnelStepIndex: He,
|
|
3724
|
+
reorderFunnelSteps: Ue,
|
|
3725
|
+
setFunnelTimeDimension: We,
|
|
3726
|
+
setFunnelDisplayConfig: qe,
|
|
3727
|
+
setFlowCube: Je,
|
|
3728
|
+
setFlowBindingKey: Ye,
|
|
3729
|
+
setFlowTimeDimension: Xe,
|
|
3730
|
+
setEventDimension: Ze,
|
|
3731
|
+
setStartingStepName: Qe,
|
|
3732
|
+
setStartingStepFilters: $e,
|
|
3733
|
+
setStepsBefore: et,
|
|
3734
|
+
setStepsAfter: tt,
|
|
3735
|
+
setJoinStrategy: nt,
|
|
3736
|
+
setFlowDisplayConfig: rt,
|
|
3737
|
+
setRetentionCube: H,
|
|
2956
3738
|
setRetentionBindingKey: U,
|
|
2957
|
-
setRetentionTimeDimension:
|
|
2958
|
-
setRetentionDateRange:
|
|
2959
|
-
setRetentionCohortFilters:
|
|
2960
|
-
setRetentionActivityFilters:
|
|
2961
|
-
setRetentionBreakdowns:
|
|
2962
|
-
addRetentionBreakdown:
|
|
2963
|
-
removeRetentionBreakdown:
|
|
2964
|
-
setRetentionViewGranularity:
|
|
2965
|
-
setRetentionPeriods:
|
|
2966
|
-
setRetentionType:
|
|
2967
|
-
setRetentionDisplayConfig:
|
|
2968
|
-
setChartType:
|
|
2969
|
-
setChartConfig:
|
|
2970
|
-
setDisplayConfig:
|
|
2971
|
-
setLocalPaletteName:
|
|
2972
|
-
setActiveTab:
|
|
2973
|
-
setActiveView:
|
|
2974
|
-
setDisplayLimit:
|
|
2975
|
-
closeFieldModal:
|
|
2976
|
-
setActiveTableIndex:
|
|
2977
|
-
openAI:
|
|
2978
|
-
closeAI:
|
|
2979
|
-
setAIPrompt:
|
|
2980
|
-
generateAI:
|
|
2981
|
-
acceptAI:
|
|
2982
|
-
cancelAI:
|
|
2983
|
-
share:
|
|
2984
|
-
clearQuery:
|
|
2985
|
-
clearCurrentMode:
|
|
2986
|
-
refetch:
|
|
2987
|
-
handleFieldSelected:
|
|
3739
|
+
setRetentionTimeDimension: W,
|
|
3740
|
+
setRetentionDateRange: G,
|
|
3741
|
+
setRetentionCohortFilters: le,
|
|
3742
|
+
setRetentionActivityFilters: ue,
|
|
3743
|
+
setRetentionBreakdowns: de,
|
|
3744
|
+
addRetentionBreakdown: fe,
|
|
3745
|
+
removeRetentionBreakdown: pe,
|
|
3746
|
+
setRetentionViewGranularity: me,
|
|
3747
|
+
setRetentionPeriods: he,
|
|
3748
|
+
setRetentionType: ge,
|
|
3749
|
+
setRetentionDisplayConfig: it,
|
|
3750
|
+
setChartType: J.setChartType,
|
|
3751
|
+
setChartConfig: J.setChartConfig,
|
|
3752
|
+
setDisplayConfig: J.setDisplayConfig,
|
|
3753
|
+
setLocalPaletteName: J.setLocalPaletteName,
|
|
3754
|
+
setActiveTab: Y.setActiveTab,
|
|
3755
|
+
setActiveView: Y.setActiveView,
|
|
3756
|
+
setDisplayLimit: Y.setDisplayLimit,
|
|
3757
|
+
closeFieldModal: Y.closeFieldModal,
|
|
3758
|
+
setActiveTableIndex: Y.setActiveTableIndex,
|
|
3759
|
+
openAI: ot,
|
|
3760
|
+
closeAI: st,
|
|
3761
|
+
setAIPrompt: ct,
|
|
3762
|
+
generateAI: gt,
|
|
3763
|
+
acceptAI: _t,
|
|
3764
|
+
cancelAI: vt,
|
|
3765
|
+
share: yt,
|
|
3766
|
+
clearQuery: Pe,
|
|
3767
|
+
clearCurrentMode: Fe,
|
|
3768
|
+
refetch: q.refetch,
|
|
3769
|
+
handleFieldSelected: ht
|
|
2988
3770
|
},
|
|
2989
|
-
getQueryConfig:
|
|
2990
|
-
getChartConfig:
|
|
2991
|
-
getAnalysisType:
|
|
3771
|
+
getQueryConfig: bt,
|
|
3772
|
+
getChartConfig: xt,
|
|
3773
|
+
getAnalysisType: St
|
|
2992
3774
|
};
|
|
2993
3775
|
}
|
|
2994
3776
|
//#endregion
|
|
2995
3777
|
//#region src/client/utils/funnelValidation.ts
|
|
2996
|
-
function
|
|
3778
|
+
function _n(e, t) {
|
|
2997
3779
|
let n = [];
|
|
2998
3780
|
if (!t?.cubes) return n;
|
|
2999
3781
|
if (typeof e.dimension == "string") {
|
|
@@ -3017,7 +3799,7 @@ function Ft(e, t) {
|
|
|
3017
3799
|
}
|
|
3018
3800
|
return n;
|
|
3019
3801
|
}
|
|
3020
|
-
function
|
|
3802
|
+
function vn(e) {
|
|
3021
3803
|
let t = [];
|
|
3022
3804
|
for (let n = 0; n < e.length; n++) {
|
|
3023
3805
|
let r = e[n], i = r.query;
|
|
@@ -3029,17 +3811,17 @@ function It(e) {
|
|
|
3029
3811
|
}
|
|
3030
3812
|
return t;
|
|
3031
3813
|
}
|
|
3032
|
-
function
|
|
3814
|
+
function yn(e, t) {
|
|
3033
3815
|
if (typeof e.dimension == "string") return !0;
|
|
3034
|
-
let n =
|
|
3816
|
+
let n = S(t);
|
|
3035
3817
|
return n ? e.dimension.some((e) => e.cube === n) : !1;
|
|
3036
3818
|
}
|
|
3037
|
-
function
|
|
3819
|
+
function bn(e, t) {
|
|
3038
3820
|
let n = [];
|
|
3039
3821
|
for (let r = 0; r < t.length; r++) {
|
|
3040
3822
|
let i = t[r];
|
|
3041
|
-
if (!
|
|
3042
|
-
let e =
|
|
3823
|
+
if (!yn(e, i.query)) {
|
|
3824
|
+
let e = S(i.query) || "unknown";
|
|
3043
3825
|
n.push({
|
|
3044
3826
|
type: "cross_cube",
|
|
3045
3827
|
message: `Step ${r + 1} uses cube "${e}" but no binding key mapping exists for it`,
|
|
@@ -3049,26 +3831,26 @@ function Rt(e, t) {
|
|
|
3049
3831
|
}
|
|
3050
3832
|
return n;
|
|
3051
3833
|
}
|
|
3052
|
-
function
|
|
3834
|
+
function xn(e) {
|
|
3053
3835
|
return e ? /^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/.test(e) ? null : {
|
|
3054
3836
|
type: "time_window",
|
|
3055
3837
|
message: `Invalid time window format "${e}". Expected ISO 8601 duration (e.g., P7D, PT1H)`
|
|
3056
3838
|
} : null;
|
|
3057
3839
|
}
|
|
3058
|
-
function
|
|
3840
|
+
function Sn(e, t) {
|
|
3059
3841
|
let n = [], r = [];
|
|
3060
3842
|
e.steps.length < 2 && n.push({
|
|
3061
3843
|
type: "general",
|
|
3062
3844
|
message: "Funnel requires at least 2 steps"
|
|
3063
|
-
}), e.bindingKey?.dimension ? (n.push(...
|
|
3845
|
+
}), e.bindingKey?.dimension ? (n.push(..._n(e.bindingKey, t)), n.push(...bn(e.bindingKey, e.steps))) : n.push({
|
|
3064
3846
|
type: "binding_key",
|
|
3065
3847
|
message: "Binding key dimension is required"
|
|
3066
|
-
}), n.push(...
|
|
3848
|
+
}), n.push(...vn(e.steps));
|
|
3067
3849
|
for (let t = 0; t < e.steps.length; t++) {
|
|
3068
|
-
let r = e.steps[t], i =
|
|
3850
|
+
let r = e.steps[t], i = xn(r.timeToConvert);
|
|
3069
3851
|
i && (i.stepIndex = t, n.push(i));
|
|
3070
3852
|
}
|
|
3071
|
-
let i =
|
|
3853
|
+
let i = xn(e.globalTimeWindow);
|
|
3072
3854
|
return i && n.push(i), e.steps.length > 5 && r.push({
|
|
3073
3855
|
type: "general",
|
|
3074
3856
|
message: "Funnels with more than 5 steps may have reduced performance"
|
|
@@ -3078,7 +3860,7 @@ function Bt(e, t) {
|
|
|
3078
3860
|
warnings: r
|
|
3079
3861
|
};
|
|
3080
3862
|
}
|
|
3081
|
-
function
|
|
3863
|
+
function Cn(e, t) {
|
|
3082
3864
|
return t < 2 ? {
|
|
3083
3865
|
isValid: !1,
|
|
3084
3866
|
message: "Add at least 2 steps for funnel"
|
|
@@ -3087,7 +3869,7 @@ function Vt(e, t) {
|
|
|
3087
3869
|
message: "Select a binding key dimension"
|
|
3088
3870
|
} : { isValid: !0 };
|
|
3089
3871
|
}
|
|
3090
|
-
function
|
|
3872
|
+
function wn(e) {
|
|
3091
3873
|
if (!e?.cubes) return [];
|
|
3092
3874
|
let t = [];
|
|
3093
3875
|
for (let n of e.cubes) if (n.dimensions) for (let e of n.dimensions) (e.type === "string" || e.type === "number") && t.push({
|
|
@@ -3097,7 +3879,7 @@ function Ht(e) {
|
|
|
3097
3879
|
});
|
|
3098
3880
|
return t;
|
|
3099
3881
|
}
|
|
3100
|
-
function
|
|
3882
|
+
function Tn(e) {
|
|
3101
3883
|
if (!e?.dimension) return "Select binding key...";
|
|
3102
3884
|
if (typeof e.dimension == "string") return e.dimension.split(".")[1] || e.dimension;
|
|
3103
3885
|
if (e.dimension.length > 0) {
|
|
@@ -3107,6 +3889,6 @@ function Ut(e) {
|
|
|
3107
3889
|
return "Select binding key...";
|
|
3108
3890
|
}
|
|
3109
3891
|
//#endregion
|
|
3110
|
-
export {
|
|
3892
|
+
export { Ht as A, Pt as C, zt as D, It as E, rt as F, Le as I, $ as M, Ft as N, Ut as O, it as P, Gt as S, Bt as T, qt as _, bn as a, Kt as b, gn as c, cn as d, dn as f, Jt as g, mn as h, _n as i, Vt as j, Lt as k, sn as l, fn as m, Tn as n, Sn as o, ln as p, Cn as r, vn as s, wn as t, un as u, Zt as v, Rt as w, Yt as x, Xt as y };
|
|
3111
3893
|
|
|
3112
|
-
//# sourceMappingURL=analysis-builder-shared-
|
|
3894
|
+
//# sourceMappingURL=analysis-builder-shared-BFzd2jx_.js.map
|