drizzle-cube 0.6.3 → 0.6.4
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/compiler-DyyBaLry.cjs +166 -0
- package/dist/adapters/{compiler-LKTN9PTt.js → compiler-lG6eNsoI.js} +214 -210
- package/dist/adapters/express/index.cjs +1 -1
- package/dist/adapters/express/index.js +1 -1
- package/dist/adapters/fastify/index.cjs +1 -1
- package/dist/adapters/fastify/index.js +1 -1
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +1 -1
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.d.ts +10 -0
- package/dist/adapters/nextjs/index.js +13 -9
- package/dist/cjs/adapters/nextjs/index.d.ts +10 -0
- package/dist/cjs/client/components/AnalysisBuilder/utils/filterUtils.d.ts +4 -10
- package/dist/cjs/client/components/shared/utils.d.ts +2 -1
- package/dist/cjs/client/shared/filters/filterOperations.d.ts +95 -0
- package/dist/cjs/client/shared/filters/index.d.ts +10 -0
- package/dist/cjs/client/shared/filters/operators.d.ts +23 -0
- package/dist/cjs/client/shared/index.d.ts +3 -2
- package/dist/cjs/client/shared/types.d.ts +3 -10
- package/dist/cjs/client/shared/utils.d.ts +1 -59
- package/dist/cjs/client/utils/filterUtils.d.ts +2 -9
- package/dist/cjs/server/logical-plan/logical-plan-builder.d.ts +0 -5
- package/dist/cjs/server/logical-plan/schema-builder.d.ts +19 -0
- package/dist/client/chunks/{DashboardEditModal-CWurUU2B.js → DashboardEditModal-Cs1ig1_V.js} +1520 -1119
- package/dist/client/chunks/DashboardEditModal-Cs1ig1_V.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-Uj_Fxv0-.js → analysis-builder-B64yaeDe.js} +73 -73
- package/dist/client/chunks/{analysis-builder-Uj_Fxv0-.js.map → analysis-builder-B64yaeDe.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared-AdAYIfj_.js → analysis-builder-shared-CD0n2Nb8.js} +948 -1023
- package/dist/client/chunks/analysis-builder-shared-CD0n2Nb8.js.map +1 -0
- package/dist/client/chunks/{useDirtyStateTracking-BY_IIG1n.js → useDirtyStateTracking-BT6zqCFl.js} +249 -590
- package/dist/client/chunks/useDirtyStateTracking-BT6zqCFl.js.map +1 -0
- package/dist/client/chunks/{useExplainAI-PjMBmj2p.js → useExplainAI-Dq_meKNN.js} +2 -2
- package/dist/client/chunks/{useExplainAI-PjMBmj2p.js.map → useExplainAI-Dq_meKNN.js.map} +1 -1
- package/dist/client/components/AnalysisBuilder/utils/filterUtils.d.ts +4 -10
- package/dist/client/components/shared/utils.d.ts +2 -1
- package/dist/client/components.js +2 -2
- package/dist/client/hooks.js +2 -2
- package/dist/client/index.js +13 -13
- package/dist/client/index.js.map +1 -1
- package/dist/client/shared/filters/filterOperations.d.ts +95 -0
- package/dist/client/shared/filters/index.d.ts +10 -0
- package/dist/client/shared/filters/operators.d.ts +23 -0
- package/dist/client/shared/index.d.ts +3 -2
- package/dist/client/shared/types.d.ts +3 -10
- package/dist/client/shared/utils.d.ts +1 -59
- package/dist/client/utils/filterUtils.d.ts +2 -9
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +33 -33
- package/dist/server/index.js +1272 -1268
- package/dist/server/logical-plan/logical-plan-builder.d.ts +0 -5
- package/dist/server/logical-plan/schema-builder.d.ts +19 -0
- package/package.json +3 -3
- package/dist/adapters/compiler-ChGO4ZLU.cjs +0 -166
- package/dist/client/chunks/DashboardEditModal-CWurUU2B.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-AdAYIfj_.js.map +0 -1
- package/dist/client/chunks/useDirtyStateTracking-BY_IIG1n.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-D4jADu8t.js";
|
|
2
2
|
import { k as s, u as c, v as l, z as u } from "./chart-data-table-D4g5_jfF.js";
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
8
|
-
import { r as
|
|
9
|
-
import { n as
|
|
10
|
-
import
|
|
11
|
-
import { Fragment as
|
|
3
|
+
import { C as d, E as f, S as p, _ as m, b as h, bt as g, d as _, g as v, j as y, l as b, nt as x, rt as S, tt as C, u as w, v as T, y as E, yt as D } from "./DashboardEditModal-Cs1ig1_V.js";
|
|
4
|
+
import { a as O, s as k, t as ee } from "./retention-ChW9jYdy.js";
|
|
5
|
+
import { A, D as te, F as ne, I as j, M as re, N as M, O as ie, P as ae, S as oe, T as N, a as P, d as se, j as F, k as I, l as L, n as ce, r as le, s as ue } from "./useDirtyStateTracking-BT6zqCFl.js";
|
|
6
|
+
import { P as R, z as de } from "./chart-activity-grid-DX0SJbxs.js";
|
|
7
|
+
import { a as z, i as fe } from "./useExplainAI-Dq_meKNN.js";
|
|
8
|
+
import { r as pe, s as me } from "./chart-funnel-CToKSBaL.js";
|
|
9
|
+
import { n as he } from "./charts-core-DaXSt1Dd.js";
|
|
10
|
+
import B, { createContext as ge, memo as _e, useCallback as V, useContext as ve, useEffect as H, useMemo as U, useRef as W, useState as G } from "react";
|
|
11
|
+
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
12
12
|
//#region src/shared/date-utils.ts
|
|
13
|
-
function
|
|
13
|
+
function ye(e) {
|
|
14
14
|
let t = /* @__PURE__ */ new Date(), n = e.toLowerCase().trim(), r = t.getUTCFullYear(), i = t.getUTCMonth(), a = t.getUTCDate(), o = t.getUTCDay();
|
|
15
15
|
if (n === "today") {
|
|
16
16
|
let e = new Date(t);
|
|
@@ -123,7 +123,7 @@ function K(e) {
|
|
|
123
123
|
}
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function be(e) {
|
|
127
127
|
if (Array.isArray(e)) {
|
|
128
128
|
if (e.length < 2) return null;
|
|
129
129
|
let t = new Date(e[0]), n = new Date(e[1]);
|
|
@@ -132,12 +132,12 @@ function pe(e) {
|
|
|
132
132
|
end: n
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
return
|
|
135
|
+
return ye(e);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function xe(e) {
|
|
138
138
|
return e.toISOString().split("T")[0];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Se(e, t) {
|
|
141
141
|
let n = t.getTime() - e.getTime(), r = Math.ceil(n / (1e3 * 60 * 60 * 24)), i = new Date(e);
|
|
142
142
|
i.setUTCDate(i.getUTCDate() - 1), i.setUTCHours(23, 59, 59, 999);
|
|
143
143
|
let a = new Date(i);
|
|
@@ -148,44 +148,23 @@ function me(e, t) {
|
|
|
148
148
|
}
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/client/components/AnalysisBuilder/utils/filterUtils.ts
|
|
151
|
-
function
|
|
152
|
-
|
|
153
|
-
let e = he(n.filters, t);
|
|
154
|
-
if (e) return e;
|
|
155
|
-
} else if ("member" in n) {
|
|
156
|
-
let e = n;
|
|
157
|
-
if (e.member === t && e.operator === "inDateRange" && e.dateRange) return { dateRange: e.dateRange };
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function ge(e, t) {
|
|
161
|
-
let n = he(t, e);
|
|
151
|
+
function Ce(e, t) {
|
|
152
|
+
let n = F(t, e);
|
|
162
153
|
if (!n?.dateRange) return;
|
|
163
|
-
let r =
|
|
154
|
+
let r = be(n.dateRange);
|
|
164
155
|
if (!r) return;
|
|
165
|
-
let i =
|
|
166
|
-
return [[
|
|
156
|
+
let i = Se(r.start, r.end);
|
|
157
|
+
return [[xe(r.start), xe(r.end)], [xe(i.start), xe(i.end)]];
|
|
167
158
|
}
|
|
168
|
-
function
|
|
169
|
-
return
|
|
170
|
-
if ("type" in n && "filters" in n) {
|
|
171
|
-
let r = n, i = _e(r.filters, t);
|
|
172
|
-
i.length > 0 && e.push({
|
|
173
|
-
type: r.type,
|
|
174
|
-
filters: i
|
|
175
|
-
});
|
|
176
|
-
} else if ("member" in n) {
|
|
177
|
-
let r = n;
|
|
178
|
-
r.member === t && r.operator === "inDateRange" || e.push(n);
|
|
179
|
-
} else e.push(n);
|
|
180
|
-
return e;
|
|
181
|
-
}, []);
|
|
159
|
+
function we(e, t) {
|
|
160
|
+
return ne(e, t, "inDateRange");
|
|
182
161
|
}
|
|
183
162
|
//#endregion
|
|
184
163
|
//#region src/client/components/AnalysisBuilder/utils/queryUtils.ts
|
|
185
|
-
function
|
|
164
|
+
function Te(e, t, n, r, i = !1, a) {
|
|
186
165
|
let o = t.filter((e) => e.isTimeDimension && e.enableComparison).map((e) => e.field), s = n;
|
|
187
|
-
if (!i) for (let e of o) s =
|
|
188
|
-
s = s.filter((e) =>
|
|
166
|
+
if (!i) for (let e of o) s = we(s, e);
|
|
167
|
+
s = s.filter((e) => C(e));
|
|
189
168
|
let c = {
|
|
190
169
|
measures: e.map((e) => e.field),
|
|
191
170
|
dimensions: t.filter((e) => !e.isTimeDimension).map((e) => e.field),
|
|
@@ -195,7 +174,7 @@ function ve(e, t, n, r, i = !1, a) {
|
|
|
195
174
|
granularity: e.granularity || "day"
|
|
196
175
|
};
|
|
197
176
|
if (e.enableComparison) {
|
|
198
|
-
let r =
|
|
177
|
+
let r = Ce(e.field, n);
|
|
199
178
|
r && (t.compareDateRange = r);
|
|
200
179
|
}
|
|
201
180
|
return t;
|
|
@@ -206,7 +185,7 @@ function ve(e, t, n, r, i = !1, a) {
|
|
|
206
185
|
};
|
|
207
186
|
return c.measures?.length === 0 && delete c.measures, c.dimensions?.length === 0 && delete c.dimensions, c.timeDimensions?.length === 0 && delete c.timeDimensions, c;
|
|
208
187
|
}
|
|
209
|
-
function
|
|
188
|
+
function Y() {
|
|
210
189
|
return {
|
|
211
190
|
metrics: [],
|
|
212
191
|
breakdowns: [],
|
|
@@ -219,7 +198,7 @@ function J() {
|
|
|
219
198
|
}
|
|
220
199
|
//#endregion
|
|
221
200
|
//#region src/client/components/AnalysisBuilder/filterConfigModalUtils.ts
|
|
222
|
-
function
|
|
201
|
+
function Ee(e, t, n, r) {
|
|
223
202
|
if (!t || n === 0) return { type: "none" };
|
|
224
203
|
switch (e) {
|
|
225
204
|
case "ArrowDown": return {
|
|
@@ -240,60 +219,60 @@ function ye(e, t, n, r) {
|
|
|
240
219
|
}
|
|
241
220
|
//#endregion
|
|
242
221
|
//#region src/client/components/AnalysisBuilder/FilterValueInput.tsx
|
|
243
|
-
var
|
|
244
|
-
function
|
|
245
|
-
let { t: n } =
|
|
246
|
-
return /* @__PURE__ */
|
|
222
|
+
var De = l("close"), Oe = l("chevronDown");
|
|
223
|
+
function ke({ filter: e, dateRange: t }) {
|
|
224
|
+
let { t: n } = R(), { rangeType: r, numberValue: i, label: a, isOpen: o, onToggle: s, onRangeTypeChange: c, onNumberValueChange: l, onCustomStartDate: u, onCustomEndDate: d, onOpen: f } = t;
|
|
225
|
+
return /* @__PURE__ */ J("div", {
|
|
247
226
|
className: "dc:space-y-2",
|
|
248
227
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ J("div", {
|
|
250
229
|
className: "dc:relative",
|
|
251
|
-
children: [/* @__PURE__ */
|
|
230
|
+
children: [/* @__PURE__ */ J("button", {
|
|
252
231
|
onClick: () => {
|
|
253
232
|
f(), s(!o);
|
|
254
233
|
},
|
|
255
234
|
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",
|
|
256
|
-
children: [/* @__PURE__ */
|
|
235
|
+
children: [/* @__PURE__ */ q("span", {
|
|
257
236
|
className: "dc:truncate",
|
|
258
237
|
children: a
|
|
259
|
-
}), /* @__PURE__ */
|
|
260
|
-
}), o && /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ q(Oe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${o ? "dc:rotate-180" : ""}` })]
|
|
239
|
+
}), o && /* @__PURE__ */ q("div", {
|
|
261
240
|
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",
|
|
262
|
-
children:
|
|
241
|
+
children: m.map((e) => /* @__PURE__ */ q("button", {
|
|
263
242
|
onClick: () => c(e.value),
|
|
264
243
|
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.value === r ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
|
|
265
244
|
children: n(e.label)
|
|
266
245
|
}, e.value))
|
|
267
246
|
})]
|
|
268
247
|
}),
|
|
269
|
-
te(r) && /* @__PURE__ */
|
|
248
|
+
te(r) && /* @__PURE__ */ J("div", {
|
|
270
249
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
250
|
+
children: [/* @__PURE__ */ q("input", {
|
|
272
251
|
type: "number",
|
|
273
252
|
min: "1",
|
|
274
253
|
max: "1000",
|
|
275
254
|
value: i,
|
|
276
255
|
onChange: (e) => l(Math.max(1, parseInt(e.target.value) || 1)),
|
|
277
256
|
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"
|
|
278
|
-
}), /* @__PURE__ */
|
|
257
|
+
}), /* @__PURE__ */ q("span", {
|
|
279
258
|
className: "dc:text-sm text-dc-text-muted",
|
|
280
259
|
children: r.replace("last_n_", "")
|
|
281
260
|
})]
|
|
282
261
|
}),
|
|
283
|
-
r === "custom" && /* @__PURE__ */
|
|
262
|
+
r === "custom" && /* @__PURE__ */ J("div", {
|
|
284
263
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
285
264
|
children: [
|
|
286
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ q("input", {
|
|
287
266
|
type: "date",
|
|
288
267
|
value: Array.isArray(e.dateRange) ? e.dateRange[0] : "",
|
|
289
268
|
onChange: u,
|
|
290
269
|
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"
|
|
291
270
|
}),
|
|
292
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ q("span", {
|
|
293
272
|
className: "dc:text-sm text-dc-text-muted",
|
|
294
273
|
children: n("filter.modal.dateTo")
|
|
295
274
|
}),
|
|
296
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ q("input", {
|
|
297
276
|
type: "date",
|
|
298
277
|
value: Array.isArray(e.dateRange) ? e.dateRange[1] : "",
|
|
299
278
|
onChange: d,
|
|
@@ -304,26 +283,26 @@ function Se({ filter: e, dateRange: t }) {
|
|
|
304
283
|
]
|
|
305
284
|
});
|
|
306
285
|
}
|
|
307
|
-
function
|
|
308
|
-
let { t: n } =
|
|
309
|
-
return i ? /* @__PURE__ */
|
|
286
|
+
function Ae({ filter: e, combo: t }) {
|
|
287
|
+
let { t: n } = R(), { options: r, loading: i, error: a, highlightedIndex: o, listRef: s, onSelect: c } = t;
|
|
288
|
+
return i ? /* @__PURE__ */ q("div", {
|
|
310
289
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
311
290
|
children: n("filter.modal.loading")
|
|
312
|
-
}) : a ? /* @__PURE__ */
|
|
291
|
+
}) : a ? /* @__PURE__ */ J("div", {
|
|
313
292
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-error",
|
|
314
293
|
children: [n("filter.modal.errorPrefix"), String(a)]
|
|
315
|
-
}) : r.length === 0 ? /* @__PURE__ */
|
|
294
|
+
}) : r.length === 0 ? /* @__PURE__ */ q("div", {
|
|
316
295
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
317
296
|
children: n("filter.modal.noValues")
|
|
318
|
-
}) : /* @__PURE__ */
|
|
297
|
+
}) : /* @__PURE__ */ q("div", {
|
|
319
298
|
ref: s,
|
|
320
299
|
className: "dc:max-h-40 dc:overflow-y-auto",
|
|
321
300
|
children: r.map((t, n) => {
|
|
322
301
|
let r = e.values?.includes(t);
|
|
323
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ J("button", {
|
|
324
303
|
onClick: (e) => c(t, e),
|
|
325
304
|
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm dc:transition-colors ${n === o ? "bg-dc-surface-hover" : ""} ${r ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text hover:bg-dc-surface-hover"}`,
|
|
326
|
-
children: [String(t), r && /* @__PURE__ */
|
|
305
|
+
children: [String(t), r && /* @__PURE__ */ q("span", {
|
|
327
306
|
className: "dc:float-right",
|
|
328
307
|
children: "✓"
|
|
329
308
|
})]
|
|
@@ -331,41 +310,41 @@ function Ce({ filter: e, combo: t }) {
|
|
|
331
310
|
})
|
|
332
311
|
});
|
|
333
312
|
}
|
|
334
|
-
function
|
|
335
|
-
let { t: r } =
|
|
336
|
-
return /* @__PURE__ */
|
|
313
|
+
function je({ filter: e, operatorMeta: t, combo: n }) {
|
|
314
|
+
let { t: r } = R(), { isOpen: i, loading: a, searchText: o, onSearchTextChange: s, onHighlightedIndexChange: c, onRemove: l, onKeyDown: u, onOpen: d } = n;
|
|
315
|
+
return /* @__PURE__ */ J("div", {
|
|
337
316
|
className: "dc:space-y-2",
|
|
338
317
|
children: [
|
|
339
|
-
e.values && e.values.length > 0 && /* @__PURE__ */
|
|
318
|
+
e.values && e.values.length > 0 && /* @__PURE__ */ q("div", {
|
|
340
319
|
className: "dc:flex dc:flex-wrap dc:gap-1.5",
|
|
341
|
-
children: e.values.map((e, t) => /* @__PURE__ */
|
|
320
|
+
children: e.values.map((e, t) => /* @__PURE__ */ J("span", {
|
|
342
321
|
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",
|
|
343
|
-
children: [/* @__PURE__ */
|
|
322
|
+
children: [/* @__PURE__ */ q("span", {
|
|
344
323
|
className: "dc:max-w-[150px] dc:truncate",
|
|
345
324
|
children: String(e)
|
|
346
|
-
}), /* @__PURE__ */
|
|
325
|
+
}), /* @__PURE__ */ q("button", {
|
|
347
326
|
onClick: () => l(e),
|
|
348
327
|
className: "hover:text-dc-danger",
|
|
349
|
-
children: /* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ q(De, { className: "dc:w-3.5 dc:h-3.5" })
|
|
350
329
|
})]
|
|
351
330
|
}, t))
|
|
352
331
|
}),
|
|
353
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ J("div", {
|
|
354
333
|
className: "dc:relative",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ J("button", {
|
|
356
335
|
onClick: () => {
|
|
357
336
|
d();
|
|
358
337
|
},
|
|
359
338
|
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",
|
|
360
|
-
children: [/* @__PURE__ */
|
|
339
|
+
children: [/* @__PURE__ */ q("span", {
|
|
361
340
|
className: "text-dc-text-muted dc:truncate",
|
|
362
341
|
children: r(a ? "filter.modal.loading" : "filter.modal.selectValue")
|
|
363
|
-
}), /* @__PURE__ */
|
|
364
|
-
}), i && /* @__PURE__ */
|
|
342
|
+
}), /* @__PURE__ */ q(Oe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${i ? "dc:rotate-180" : ""}` })]
|
|
343
|
+
}), i && /* @__PURE__ */ J("div", {
|
|
365
344
|
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",
|
|
366
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ q("div", {
|
|
367
346
|
className: "dc:p-2 dc:border-b border-dc-border",
|
|
368
|
-
children: /* @__PURE__ */
|
|
347
|
+
children: /* @__PURE__ */ q("input", {
|
|
369
348
|
type: "text",
|
|
370
349
|
value: o,
|
|
371
350
|
onChange: (e) => {
|
|
@@ -376,39 +355,39 @@ function we({ filter: e, operatorMeta: t, combo: n }) {
|
|
|
376
355
|
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",
|
|
377
356
|
autoFocus: !0
|
|
378
357
|
})
|
|
379
|
-
}), /* @__PURE__ */
|
|
358
|
+
}), /* @__PURE__ */ q(Ae, {
|
|
380
359
|
filter: e,
|
|
381
360
|
combo: n
|
|
382
361
|
})]
|
|
383
362
|
})]
|
|
384
363
|
}),
|
|
385
|
-
t?.supportsMultipleValues && /* @__PURE__ */
|
|
364
|
+
t?.supportsMultipleValues && /* @__PURE__ */ q("p", {
|
|
386
365
|
className: "dc:text-xs text-dc-text-muted",
|
|
387
366
|
children: r("filter.modal.multiSelectHint")
|
|
388
367
|
})
|
|
389
368
|
]
|
|
390
369
|
});
|
|
391
370
|
}
|
|
392
|
-
function
|
|
393
|
-
let { t: i } =
|
|
394
|
-
return o?.requiresValues ? s ? /* @__PURE__ */
|
|
371
|
+
function Me({ field: e, dateRange: t, combo: n, inputs: r }) {
|
|
372
|
+
let { t: i } = R(), { filter: a, operatorMeta: o, shouldShowDateRange: s, shouldShowComboBox: c } = e, { onBetweenStart: l, onBetweenEnd: u, onDate: d, onDirect: f } = r;
|
|
373
|
+
return o?.requiresValues ? s ? /* @__PURE__ */ q(ke, {
|
|
395
374
|
filter: a,
|
|
396
375
|
dateRange: t
|
|
397
|
-
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */
|
|
376
|
+
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */ J("div", {
|
|
398
377
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
399
378
|
children: [
|
|
400
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ q("input", {
|
|
401
380
|
type: "number",
|
|
402
381
|
value: a.values?.[0] ?? "",
|
|
403
382
|
onChange: l,
|
|
404
383
|
placeholder: i("filter.modal.min"),
|
|
405
384
|
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"
|
|
406
385
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
386
|
+
/* @__PURE__ */ q("span", {
|
|
408
387
|
className: "dc:text-sm text-dc-text-muted",
|
|
409
388
|
children: i("filter.modal.to")
|
|
410
389
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
390
|
+
/* @__PURE__ */ q("input", {
|
|
412
391
|
type: "number",
|
|
413
392
|
value: a.values?.[1] ?? "",
|
|
414
393
|
onChange: u,
|
|
@@ -416,96 +395,96 @@ function Te({ field: e, dateRange: t, combo: n, inputs: r }) {
|
|
|
416
395
|
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"
|
|
417
396
|
})
|
|
418
397
|
]
|
|
419
|
-
}) : o?.valueType === "date" ? /* @__PURE__ */
|
|
398
|
+
}) : o?.valueType === "date" ? /* @__PURE__ */ q("input", {
|
|
420
399
|
type: "date",
|
|
421
400
|
value: a.values?.[0] || "",
|
|
422
401
|
onChange: d,
|
|
423
402
|
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"
|
|
424
|
-
}) : o?.valueType === "number" ? /* @__PURE__ */
|
|
403
|
+
}) : o?.valueType === "number" ? /* @__PURE__ */ q("input", {
|
|
425
404
|
type: "number",
|
|
426
405
|
value: a.values?.[0] ?? "",
|
|
427
406
|
onChange: f,
|
|
428
407
|
placeholder: i("filter.modal.enterNumber"),
|
|
429
408
|
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"
|
|
430
|
-
}) : c ? /* @__PURE__ */
|
|
409
|
+
}) : c ? /* @__PURE__ */ q(je, {
|
|
431
410
|
filter: a,
|
|
432
411
|
operatorMeta: o,
|
|
433
412
|
combo: n
|
|
434
|
-
}) : /* @__PURE__ */
|
|
413
|
+
}) : /* @__PURE__ */ q("input", {
|
|
435
414
|
type: "text",
|
|
436
415
|
value: a.values?.[0] ?? "",
|
|
437
416
|
onChange: f,
|
|
438
417
|
placeholder: i("filter.modal.enterValue"),
|
|
439
418
|
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"
|
|
440
|
-
}) : /* @__PURE__ */
|
|
419
|
+
}) : /* @__PURE__ */ q("div", {
|
|
441
420
|
className: "dc:text-sm text-dc-text-muted dc:italic dc:py-2",
|
|
442
421
|
children: i("filter.modal.noValueRequired")
|
|
443
422
|
});
|
|
444
423
|
}
|
|
445
424
|
//#endregion
|
|
446
425
|
//#region src/client/components/AnalysisBuilder/FilterConfigModal.tsx
|
|
447
|
-
var
|
|
448
|
-
function
|
|
449
|
-
let { t: a } =
|
|
426
|
+
var Ne = l("close"), Pe = l("chevronDown"), Fe = l("dimension"), Ie = l("timeDimension"), Le = l("measure");
|
|
427
|
+
function Re({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i }) {
|
|
428
|
+
let { t: a } = R(), [o, s] = G(e), [c, l] = G(!1), [u, d] = G(!1), [f, p] = G(!1), [g, _] = G("this_month"), [y, b] = G(1), [C, w] = G(""), [T, D] = G(null), [O, k] = G(-1), ee = W(null), A = W(null), ne = ce(C, 300), j = E(o.member, t), re = j?.field.type || "string", M = re === "time", ie = j?.fieldType === "measure", ae = j?.fieldType === "dimension", oe = h(o.member, t), P = x[o.operator], se = S(re), F = M && o.operator === "inDateRange", I = V(() => [
|
|
450
429
|
"equals",
|
|
451
430
|
"notEquals",
|
|
452
431
|
"in",
|
|
453
432
|
"notIn"
|
|
454
|
-
].includes(o.operator) &&
|
|
433
|
+
].includes(o.operator) && ae && !M, [
|
|
455
434
|
o.operator,
|
|
456
|
-
|
|
435
|
+
ae,
|
|
457
436
|
M
|
|
458
|
-
])(), { values:
|
|
459
|
-
|
|
437
|
+
])(), { values: L, loading: ue, error: de, searchValues: z } = le(o.member, I);
|
|
438
|
+
H(() => {
|
|
460
439
|
if (!i) {
|
|
461
|
-
|
|
440
|
+
D(null);
|
|
462
441
|
return;
|
|
463
442
|
}
|
|
464
443
|
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));
|
|
465
|
-
|
|
444
|
+
D(r ? {
|
|
466
445
|
bottom: window.innerHeight - e.top + 8,
|
|
467
446
|
left: a
|
|
468
447
|
} : {
|
|
469
448
|
top: e.bottom + 8,
|
|
470
449
|
left: a
|
|
471
450
|
});
|
|
472
|
-
}, [i]),
|
|
451
|
+
}, [i]), H(() => {
|
|
473
452
|
let e = (e) => {
|
|
474
|
-
|
|
453
|
+
ee.current && !ee.current.contains(e.target) && (l(!1), d(!1), p(!1));
|
|
475
454
|
};
|
|
476
455
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
477
|
-
}, []),
|
|
478
|
-
u &&
|
|
456
|
+
}, []), H(() => {
|
|
457
|
+
u && I && z && z("", !0), u || k(-1);
|
|
479
458
|
}, [
|
|
480
459
|
u,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
]),
|
|
484
|
-
if (
|
|
485
|
-
let e =
|
|
460
|
+
I,
|
|
461
|
+
z
|
|
462
|
+
]), H(() => {
|
|
463
|
+
if (O >= 0 && A.current) {
|
|
464
|
+
let e = A.current.children[O];
|
|
486
465
|
e && e.scrollIntoView({ block: "nearest" });
|
|
487
466
|
}
|
|
488
|
-
}, [
|
|
489
|
-
u &&
|
|
467
|
+
}, [O]), H(() => {
|
|
468
|
+
u && I && z && ne !== void 0 && z(ne);
|
|
490
469
|
}, [
|
|
491
470
|
ne,
|
|
492
471
|
u,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
]),
|
|
496
|
-
if (!
|
|
472
|
+
I,
|
|
473
|
+
z
|
|
474
|
+
]), H(() => {
|
|
475
|
+
if (!F) return;
|
|
497
476
|
let e = v(o.dateRange);
|
|
498
|
-
e && (
|
|
499
|
-
}, [o.dateRange,
|
|
500
|
-
let
|
|
477
|
+
e && (_(e.rangeType), e.numberValue !== void 0 && b(e.numberValue));
|
|
478
|
+
}, [o.dateRange, F]);
|
|
479
|
+
let fe = V((e) => {
|
|
501
480
|
s({
|
|
502
481
|
member: o.member,
|
|
503
482
|
operator: e,
|
|
504
483
|
values: []
|
|
505
484
|
}), l(!1);
|
|
506
|
-
}, [o.member]),
|
|
485
|
+
}, [o.member]), pe = V((e, t) => {
|
|
507
486
|
let n = t?.shiftKey ?? !1, r = o.values || [];
|
|
508
|
-
|
|
487
|
+
P?.supportsMultipleValues ? (r.includes(e) ? s({
|
|
509
488
|
...o,
|
|
510
489
|
values: r.filter((t) => t !== e)
|
|
511
490
|
}) : s({
|
|
@@ -514,28 +493,28 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
514
493
|
}), n || d(!1)) : (s({
|
|
515
494
|
...o,
|
|
516
495
|
values: [e]
|
|
517
|
-
}), d(!1)),
|
|
518
|
-
}, [o,
|
|
496
|
+
}), d(!1)), w(""), k(-1);
|
|
497
|
+
}, [o, P?.supportsMultipleValues]), me = V((e) => {
|
|
519
498
|
let t = (o.values || []).filter((t) => t !== e);
|
|
520
499
|
s({
|
|
521
500
|
...o,
|
|
522
501
|
values: t
|
|
523
502
|
});
|
|
524
|
-
}, [o]), he =
|
|
525
|
-
let t =
|
|
503
|
+
}, [o]), he = V((e) => {
|
|
504
|
+
let t = Ee(e.key, u, L.length, O);
|
|
526
505
|
if (t.type !== "none") {
|
|
527
|
-
if (e.preventDefault(), t.type === "highlight") return
|
|
528
|
-
if (t.type === "select") return
|
|
529
|
-
d(!1),
|
|
506
|
+
if (e.preventDefault(), t.type === "highlight") return k(t.index);
|
|
507
|
+
if (t.type === "select") return pe(L[t.index], { shiftKey: e.shiftKey });
|
|
508
|
+
d(!1), k(-1);
|
|
530
509
|
}
|
|
531
510
|
}, [
|
|
532
511
|
u,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
]),
|
|
512
|
+
L,
|
|
513
|
+
O,
|
|
514
|
+
pe
|
|
515
|
+
]), B = V((e) => {
|
|
537
516
|
let t = e.target.value;
|
|
538
|
-
if (
|
|
517
|
+
if (P?.valueType === "number") {
|
|
539
518
|
let e = parseFloat(t);
|
|
540
519
|
isNaN(e) ? (t === "" || t === "-") && s({
|
|
541
520
|
...o,
|
|
@@ -548,110 +527,110 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
548
527
|
...o,
|
|
549
528
|
values: t ? [t] : []
|
|
550
529
|
});
|
|
551
|
-
}, [o,
|
|
530
|
+
}, [o, P?.valueType]), ge = V((e) => {
|
|
552
531
|
let t = parseFloat(e.target.value), n = [isNaN(t) ? "" : t, (o.values?.length >= 2 ? o.values : ["", ""])[1]].filter((e) => e !== "");
|
|
553
532
|
s({
|
|
554
533
|
...o,
|
|
555
534
|
values: n
|
|
556
535
|
});
|
|
557
|
-
}, [o]),
|
|
536
|
+
}, [o]), _e = V((e) => {
|
|
558
537
|
let t = parseFloat(e.target.value), n = [(o.values?.length >= 2 ? o.values : ["", ""])[0], isNaN(t) ? "" : t].filter((e) => e !== "");
|
|
559
538
|
s({
|
|
560
539
|
...o,
|
|
561
540
|
values: n
|
|
562
541
|
});
|
|
563
|
-
}, [o]),
|
|
542
|
+
}, [o]), ve = V((e) => {
|
|
564
543
|
let t = e.target.value;
|
|
565
544
|
s({
|
|
566
545
|
...o,
|
|
567
546
|
values: t ? [t] : []
|
|
568
547
|
});
|
|
569
|
-
}, [o]),
|
|
570
|
-
|
|
548
|
+
}, [o]), ye = V((e) => {
|
|
549
|
+
_(e), p(!1);
|
|
571
550
|
let t;
|
|
572
551
|
if (e === "custom") {
|
|
573
552
|
let e = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
574
553
|
t = [e, e];
|
|
575
|
-
} else t = te(e) ?
|
|
554
|
+
} else t = te(e) ? N(e, y) : N(e);
|
|
576
555
|
s({
|
|
577
556
|
...o,
|
|
578
557
|
dateRange: t
|
|
579
558
|
});
|
|
580
|
-
}, [o,
|
|
581
|
-
if (
|
|
582
|
-
let t =
|
|
559
|
+
}, [o, y]), be = V((e) => {
|
|
560
|
+
if (b(e), te(g)) {
|
|
561
|
+
let t = N(g, e);
|
|
583
562
|
s({
|
|
584
563
|
...o,
|
|
585
564
|
dateRange: t
|
|
586
565
|
});
|
|
587
566
|
}
|
|
588
|
-
}, [o,
|
|
567
|
+
}, [o, g]), xe = V((e) => {
|
|
589
568
|
let t = e.target.value, n = (Array.isArray(o.dateRange) ? o.dateRange : [o.dateRange || "", ""])[1] || t;
|
|
590
569
|
s({
|
|
591
570
|
...o,
|
|
592
571
|
dateRange: [t, n]
|
|
593
572
|
});
|
|
594
|
-
}, [o]),
|
|
573
|
+
}, [o]), Se = V((e) => {
|
|
595
574
|
let t = e.target.value, n = (Array.isArray(o.dateRange) ? o.dateRange : ["", o.dateRange || ""])[0] || t;
|
|
596
575
|
s({
|
|
597
576
|
...o,
|
|
598
577
|
dateRange: [n, t]
|
|
599
578
|
});
|
|
600
|
-
}, [o]),
|
|
579
|
+
}, [o]), Ce = a(se.find((e) => e.operator === o.operator)?.label || o.operator), we = a(m.find((e) => e.value === g)?.label || "filter.modal.selectRange"), Te = {
|
|
601
580
|
filter: o,
|
|
602
|
-
operatorMeta:
|
|
603
|
-
shouldShowDateRange:
|
|
604
|
-
shouldShowComboBox:
|
|
605
|
-
},
|
|
606
|
-
rangeType:
|
|
607
|
-
numberValue:
|
|
608
|
-
label:
|
|
581
|
+
operatorMeta: P,
|
|
582
|
+
shouldShowDateRange: F,
|
|
583
|
+
shouldShowComboBox: I
|
|
584
|
+
}, Y = {
|
|
585
|
+
rangeType: g,
|
|
586
|
+
numberValue: y,
|
|
587
|
+
label: we,
|
|
609
588
|
isOpen: f,
|
|
610
589
|
onToggle: p,
|
|
611
|
-
onRangeTypeChange:
|
|
612
|
-
onNumberValueChange:
|
|
613
|
-
onCustomStartDate:
|
|
614
|
-
onCustomEndDate:
|
|
615
|
-
onOpen:
|
|
590
|
+
onRangeTypeChange: ye,
|
|
591
|
+
onNumberValueChange: be,
|
|
592
|
+
onCustomStartDate: xe,
|
|
593
|
+
onCustomEndDate: Se,
|
|
594
|
+
onOpen: V(() => {
|
|
616
595
|
l(!1), d(!1);
|
|
617
596
|
}, [])
|
|
618
|
-
},
|
|
597
|
+
}, De = {
|
|
619
598
|
isOpen: u,
|
|
620
|
-
options:
|
|
621
|
-
loading:
|
|
622
|
-
error:
|
|
623
|
-
searchText:
|
|
624
|
-
highlightedIndex:
|
|
625
|
-
listRef:
|
|
626
|
-
onSearchTextChange:
|
|
627
|
-
onHighlightedIndexChange:
|
|
628
|
-
onSelect:
|
|
599
|
+
options: L,
|
|
600
|
+
loading: ue,
|
|
601
|
+
error: de,
|
|
602
|
+
searchText: C,
|
|
603
|
+
highlightedIndex: O,
|
|
604
|
+
listRef: A,
|
|
605
|
+
onSearchTextChange: w,
|
|
606
|
+
onHighlightedIndexChange: k,
|
|
607
|
+
onSelect: pe,
|
|
629
608
|
onRemove: me,
|
|
630
609
|
onKeyDown: he,
|
|
631
|
-
onOpen:
|
|
610
|
+
onOpen: V(() => {
|
|
632
611
|
l(!1), p(!1), d((e) => !e);
|
|
633
612
|
}, [])
|
|
634
|
-
},
|
|
635
|
-
onBetweenStart:
|
|
636
|
-
onBetweenEnd:
|
|
637
|
-
onDate:
|
|
638
|
-
onDirect:
|
|
613
|
+
}, Oe = U(() => ({
|
|
614
|
+
onBetweenStart: ge,
|
|
615
|
+
onBetweenEnd: _e,
|
|
616
|
+
onDate: ve,
|
|
617
|
+
onDirect: B
|
|
639
618
|
}), [
|
|
619
|
+
ge,
|
|
640
620
|
_e,
|
|
641
621
|
ve,
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${x ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
|
|
622
|
+
B
|
|
623
|
+
]), ke = M ? Ie : ie ? Le : Fe;
|
|
624
|
+
return /* @__PURE__ */ q(K, { children: /* @__PURE__ */ q("div", {
|
|
625
|
+
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${T ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
|
|
647
626
|
onClick: r,
|
|
648
|
-
children: /* @__PURE__ */
|
|
649
|
-
ref:
|
|
650
|
-
className:
|
|
627
|
+
children: /* @__PURE__ */ J("div", {
|
|
628
|
+
ref: ee,
|
|
629
|
+
className: T ? "bg-dc-surface rounded-lg border border-dc-border" : "bg-dc-surface rounded-lg border border-dc-border max-w-md w-full",
|
|
651
630
|
style: {
|
|
652
|
-
...
|
|
631
|
+
...T ? {
|
|
653
632
|
position: "fixed",
|
|
654
|
-
...
|
|
633
|
+
...T,
|
|
655
634
|
maxWidth: "400px",
|
|
656
635
|
width: "100%"
|
|
657
636
|
} : {},
|
|
@@ -659,71 +638,71 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
659
638
|
},
|
|
660
639
|
onClick: (e) => e.stopPropagation(),
|
|
661
640
|
children: [
|
|
662
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ J("div", {
|
|
663
642
|
className: "dc:flex dc:items-center dc:justify-between dc:p-4 dc:border-b border-dc-border",
|
|
664
|
-
children: [/* @__PURE__ */
|
|
643
|
+
children: [/* @__PURE__ */ q("h2", {
|
|
665
644
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
666
645
|
children: a("filter.modal.title")
|
|
667
|
-
}), /* @__PURE__ */
|
|
646
|
+
}), /* @__PURE__ */ q("button", {
|
|
668
647
|
onClick: r,
|
|
669
648
|
className: "dc:p-1 text-dc-text-muted hover:text-dc-text dc:transition-colors",
|
|
670
|
-
children: /* @__PURE__ */
|
|
649
|
+
children: /* @__PURE__ */ q(Ne, { className: "dc:w-5 dc:h-5" })
|
|
671
650
|
})]
|
|
672
651
|
}),
|
|
673
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ J("div", {
|
|
674
653
|
className: "dc:p-4 dc:space-y-4",
|
|
675
654
|
children: [
|
|
676
|
-
/* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
|
|
677
656
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
678
657
|
children: a("filter.modal.fieldLabel")
|
|
679
|
-
}), /* @__PURE__ */
|
|
658
|
+
}), /* @__PURE__ */ J("div", {
|
|
680
659
|
className: "dc:flex dc:items-center dc:gap-2 dc:p-3 bg-dc-surface-secondary dc:rounded",
|
|
681
|
-
children: [/* @__PURE__ */
|
|
660
|
+
children: [/* @__PURE__ */ q(ke, { className: "dc:w-5 dc:h-5 text-dc-filter-text" }), /* @__PURE__ */ q("span", {
|
|
682
661
|
className: "dc:text-sm dc:font-medium text-dc-text",
|
|
683
|
-
children:
|
|
662
|
+
children: oe
|
|
684
663
|
})]
|
|
685
664
|
})] }),
|
|
686
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
|
|
687
666
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
688
667
|
children: a("filter.modal.operatorLabel")
|
|
689
|
-
}), /* @__PURE__ */
|
|
668
|
+
}), /* @__PURE__ */ J("div", {
|
|
690
669
|
className: "dc:relative",
|
|
691
|
-
children: [/* @__PURE__ */
|
|
670
|
+
children: [/* @__PURE__ */ J("button", {
|
|
692
671
|
onClick: () => {
|
|
693
672
|
d(!1), p(!1), l(!c);
|
|
694
673
|
},
|
|
695
674
|
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",
|
|
696
|
-
children: [/* @__PURE__ */
|
|
675
|
+
children: [/* @__PURE__ */ q("span", {
|
|
697
676
|
className: "dc:truncate",
|
|
698
|
-
children:
|
|
699
|
-
}), /* @__PURE__ */
|
|
700
|
-
}), c && /* @__PURE__ */
|
|
677
|
+
children: Ce
|
|
678
|
+
}), /* @__PURE__ */ q(Pe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${c ? "dc:rotate-180" : ""}` })]
|
|
679
|
+
}), c && /* @__PURE__ */ q("div", {
|
|
701
680
|
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",
|
|
702
|
-
children:
|
|
703
|
-
onClick: () =>
|
|
681
|
+
children: se.map((e) => /* @__PURE__ */ q("button", {
|
|
682
|
+
onClick: () => fe(e.operator),
|
|
704
683
|
className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.operator === o.operator ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
|
|
705
684
|
children: a(e.label)
|
|
706
685
|
}, e.operator))
|
|
707
686
|
})]
|
|
708
687
|
})] }),
|
|
709
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
|
|
710
689
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
711
690
|
children: a("filter.modal.valueLabel")
|
|
712
|
-
}), /* @__PURE__ */
|
|
713
|
-
field:
|
|
714
|
-
dateRange:
|
|
715
|
-
combo:
|
|
716
|
-
inputs:
|
|
691
|
+
}), /* @__PURE__ */ q(Me, {
|
|
692
|
+
field: Te,
|
|
693
|
+
dateRange: Y,
|
|
694
|
+
combo: De,
|
|
695
|
+
inputs: Oe
|
|
717
696
|
})] })
|
|
718
697
|
]
|
|
719
698
|
}),
|
|
720
|
-
/* @__PURE__ */
|
|
699
|
+
/* @__PURE__ */ J("div", {
|
|
721
700
|
className: "dc:flex dc:items-center dc:justify-end dc:gap-2 dc:p-4 dc:border-t border-dc-border",
|
|
722
|
-
children: [/* @__PURE__ */
|
|
701
|
+
children: [/* @__PURE__ */ q("button", {
|
|
723
702
|
onClick: r,
|
|
724
703
|
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
725
704
|
children: a("common.actions.cancel")
|
|
726
|
-
}), /* @__PURE__ */
|
|
705
|
+
}), /* @__PURE__ */ q("button", {
|
|
727
706
|
onClick: () => n(o),
|
|
728
707
|
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",
|
|
729
708
|
children: a("common.actions.save")
|
|
@@ -735,47 +714,47 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
735
714
|
}
|
|
736
715
|
//#endregion
|
|
737
716
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterItem.tsx
|
|
738
|
-
var
|
|
739
|
-
function
|
|
740
|
-
let { t: i } =
|
|
741
|
-
return /* @__PURE__ */
|
|
717
|
+
var ze = l("close"), Be = l("dimension"), Ve = l("timeDimension"), He = l("measure");
|
|
718
|
+
function Ue({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
719
|
+
let { t: i } = R(), [a, o] = G(!1), s = W(null), c = E(e.member, t), l = (c?.field.type || "string") === "time", u = c?.fieldType === "measure", d = h(e.member, t), f = x[e.operator], p = f?.label ? i(f.label) : e.operator, m = We(e, f, i), g = l ? Ve : u ? He : Be;
|
|
720
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("div", {
|
|
742
721
|
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",
|
|
743
722
|
children: [
|
|
744
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ q("span", {
|
|
745
724
|
className: `dc:w-6 dc:h-6 dc:flex dc:items-center dc:justify-center dc:rounded ${l ? "bg-dc-time-dimension" : u ? "bg-dc-measure" : "bg-dc-dimension"} ${l ? "text-dc-time-dimension-text" : u ? "text-dc-measure-text" : "text-dc-dimension-text"} dc:flex-shrink-0 dc:mt-0.5`,
|
|
746
|
-
children:
|
|
725
|
+
children: g && /* @__PURE__ */ q(g, { className: "dc:w-4 dc:h-4" })
|
|
747
726
|
}),
|
|
748
|
-
/* @__PURE__ */
|
|
727
|
+
/* @__PURE__ */ q("button", {
|
|
749
728
|
ref: s,
|
|
750
729
|
onClick: () => o(!0),
|
|
751
730
|
className: "dc:flex-1 dc:min-w-0 dc:text-left",
|
|
752
731
|
title: `${d} ${p} ${m}`,
|
|
753
|
-
children: /* @__PURE__ */
|
|
732
|
+
children: /* @__PURE__ */ J("div", {
|
|
754
733
|
className: "dc:text-sm text-dc-text dc:break-words",
|
|
755
734
|
children: [
|
|
756
|
-
/* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ q("span", {
|
|
757
736
|
className: "dc:font-medium",
|
|
758
737
|
children: d
|
|
759
738
|
}),
|
|
760
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ q("span", {
|
|
761
740
|
className: "text-dc-text-muted dc:mx-1",
|
|
762
741
|
children: p
|
|
763
742
|
}),
|
|
764
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ q("span", {
|
|
765
744
|
className: "text-dc-primary",
|
|
766
745
|
children: m
|
|
767
746
|
})
|
|
768
747
|
]
|
|
769
748
|
})
|
|
770
749
|
}),
|
|
771
|
-
/* @__PURE__ */
|
|
750
|
+
/* @__PURE__ */ q("button", {
|
|
772
751
|
onClick: n,
|
|
773
752
|
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",
|
|
774
753
|
title: i("filter.removeButton.title"),
|
|
775
|
-
children:
|
|
754
|
+
children: ze && /* @__PURE__ */ q(ze, { className: "dc:w-4 dc:h-4" })
|
|
776
755
|
})
|
|
777
756
|
]
|
|
778
|
-
}), a && /* @__PURE__ */
|
|
757
|
+
}), a && /* @__PURE__ */ q(Re, {
|
|
779
758
|
filter: e,
|
|
780
759
|
schema: t,
|
|
781
760
|
onSave: (e) => {
|
|
@@ -785,7 +764,7 @@ function Ie({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
|
785
764
|
anchorElement: s.current
|
|
786
765
|
})] });
|
|
787
766
|
}
|
|
788
|
-
function
|
|
767
|
+
function We(e, t, n) {
|
|
789
768
|
if (!t?.requiresValues) return "";
|
|
790
769
|
if (e.dateRange) return Array.isArray(e.dateRange) ? `${e.dateRange[0]} to ${e.dateRange[1]}` : e.dateRange;
|
|
791
770
|
let r = e.values || [];
|
|
@@ -793,34 +772,24 @@ function Le(e, t, n) {
|
|
|
793
772
|
}
|
|
794
773
|
//#endregion
|
|
795
774
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterGroup.tsx
|
|
796
|
-
var
|
|
797
|
-
function
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
function Ve(e) {
|
|
801
|
-
return "type" in e && (e.type === "and" || e.type === "or");
|
|
802
|
-
}
|
|
803
|
-
function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
|
|
804
|
-
let { t: s } = O(), [c, l] = H(!1), u = V(null);
|
|
805
|
-
z(() => {
|
|
775
|
+
var Ge = l("add"), Ke = l("close");
|
|
776
|
+
function qe({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
|
|
777
|
+
let { t: s } = R(), [c, l] = G(!1), u = W(null);
|
|
778
|
+
H(() => {
|
|
806
779
|
let e = (e) => {
|
|
807
780
|
u.current && !u.current.contains(e.target) && l(!1);
|
|
808
781
|
};
|
|
809
782
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
810
783
|
}, []);
|
|
811
|
-
let d =
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
...e,
|
|
815
|
-
type: t
|
|
816
|
-
});
|
|
817
|
-
}, [e, n]), f = R((t, r) => {
|
|
784
|
+
let d = V(() => {
|
|
785
|
+
n(j(e));
|
|
786
|
+
}, [e, n]), f = V((t, r) => {
|
|
818
787
|
let i = [...e.filters];
|
|
819
788
|
i[t] = r, n({
|
|
820
789
|
...e,
|
|
821
790
|
filters: i
|
|
822
791
|
});
|
|
823
|
-
}, [e, n]), p =
|
|
792
|
+
}, [e, n]), p = V((t) => {
|
|
824
793
|
let i = e.filters.filter((e, n) => n !== t);
|
|
825
794
|
i.length === 0 ? r() : n({
|
|
826
795
|
...e,
|
|
@@ -831,7 +800,7 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
831
800
|
n,
|
|
832
801
|
r,
|
|
833
802
|
a
|
|
834
|
-
]), m =
|
|
803
|
+
]), m = V((t) => {
|
|
835
804
|
let r = {
|
|
836
805
|
type: t,
|
|
837
806
|
filters: []
|
|
@@ -840,23 +809,23 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
840
809
|
...e,
|
|
841
810
|
filters: [...e.filters, r]
|
|
842
811
|
}), l(!1);
|
|
843
|
-
}, [e, n]), h =
|
|
812
|
+
}, [e, n]), h = V(() => {
|
|
844
813
|
i([]), l(!1);
|
|
845
|
-
}, [i]), g =
|
|
814
|
+
}, [i]), g = V((e) => (t = []) => {
|
|
846
815
|
i([e, ...t]);
|
|
847
816
|
}, [i]), _ = () => a % 2 == 0 ? "border-dc-border" : "border-dc-border dark:border-dc-border", v = () => e.type === "and" ? "bg-dc-info-bg/50" : "bg-dc-warning-bg/50", y = e.filters.length, b = s(y === 1 ? "filter.group.condition" : "filter.group.conditions");
|
|
848
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ J("div", {
|
|
849
818
|
className: `dc:border ${_()} dc:rounded-lg bg-dc-surface dc:w-full`,
|
|
850
|
-
children: [/* @__PURE__ */
|
|
819
|
+
children: [/* @__PURE__ */ J("div", {
|
|
851
820
|
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 ${v()}`,
|
|
852
|
-
children: [/* @__PURE__ */
|
|
821
|
+
children: [/* @__PURE__ */ J("div", {
|
|
853
822
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
854
|
-
children: [/* @__PURE__ */
|
|
823
|
+
children: [/* @__PURE__ */ q("button", {
|
|
855
824
|
onClick: d,
|
|
856
825
|
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"}`,
|
|
857
826
|
title: `Click to switch to ${e.type === "and" ? "OR" : "AND"}`,
|
|
858
827
|
children: e.type.toUpperCase()
|
|
859
|
-
}), /* @__PURE__ */
|
|
828
|
+
}), /* @__PURE__ */ J("span", {
|
|
860
829
|
className: "dc:text-xs text-dc-text-muted",
|
|
861
830
|
children: [
|
|
862
831
|
y,
|
|
@@ -864,61 +833,61 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
864
833
|
b
|
|
865
834
|
]
|
|
866
835
|
})]
|
|
867
|
-
}), /* @__PURE__ */
|
|
836
|
+
}), /* @__PURE__ */ J("div", {
|
|
868
837
|
className: "dc:flex dc:items-center dc:gap-1",
|
|
869
|
-
children: [/* @__PURE__ */
|
|
838
|
+
children: [/* @__PURE__ */ J("div", {
|
|
870
839
|
className: "dc:relative",
|
|
871
840
|
ref: u,
|
|
872
|
-
children: [/* @__PURE__ */
|
|
841
|
+
children: [/* @__PURE__ */ q("button", {
|
|
873
842
|
onClick: () => l(!c),
|
|
874
843
|
className: "dc:p-1 text-dc-text-secondary hover:text-dc-primary hover:bg-dc-surface-hover dc:rounded dc:transition-colors",
|
|
875
844
|
title: "Add condition",
|
|
876
|
-
children: /* @__PURE__ */
|
|
877
|
-
}), c && /* @__PURE__ */
|
|
845
|
+
children: /* @__PURE__ */ q(Ge, { className: "dc:w-4 dc:h-4" })
|
|
846
|
+
}), c && /* @__PURE__ */ J("div", {
|
|
878
847
|
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]",
|
|
879
848
|
children: [
|
|
880
|
-
/* @__PURE__ */
|
|
849
|
+
/* @__PURE__ */ q("button", {
|
|
881
850
|
onClick: h,
|
|
882
851
|
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",
|
|
883
852
|
children: s("filter.group.addFilter")
|
|
884
853
|
}),
|
|
885
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ q("button", {
|
|
886
855
|
onClick: () => m("and"),
|
|
887
856
|
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",
|
|
888
857
|
children: s("filter.group.addAndGroup")
|
|
889
858
|
}),
|
|
890
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ q("button", {
|
|
891
860
|
onClick: () => m("or"),
|
|
892
861
|
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",
|
|
893
862
|
children: s("filter.group.addOrGroup")
|
|
894
863
|
})
|
|
895
864
|
]
|
|
896
865
|
})]
|
|
897
|
-
}), !o && /* @__PURE__ */
|
|
866
|
+
}), !o && /* @__PURE__ */ q("button", {
|
|
898
867
|
onClick: r,
|
|
899
868
|
className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:transition-colors",
|
|
900
869
|
title: s("filter.group.removeGroup"),
|
|
901
|
-
children: /* @__PURE__ */
|
|
870
|
+
children: /* @__PURE__ */ q(Ke, { className: "dc:w-4 dc:h-4" })
|
|
902
871
|
})]
|
|
903
872
|
})]
|
|
904
|
-
}), /* @__PURE__ */
|
|
873
|
+
}), /* @__PURE__ */ q("div", {
|
|
905
874
|
className: "dc:p-1.5 dc:flex dc:flex-wrap dc:gap-2",
|
|
906
|
-
children: e.filters.length === 0 ? /* @__PURE__ */
|
|
875
|
+
children: e.filters.length === 0 ? /* @__PURE__ */ J("div", {
|
|
907
876
|
className: "dc:text-center dc:py-3",
|
|
908
|
-
children: [/* @__PURE__ */
|
|
877
|
+
children: [/* @__PURE__ */ q("p", {
|
|
909
878
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
910
879
|
children: s("filter.group.empty")
|
|
911
|
-
}), /* @__PURE__ */
|
|
880
|
+
}), /* @__PURE__ */ q("button", {
|
|
912
881
|
onClick: () => i([]),
|
|
913
882
|
className: "dc:text-xs text-dc-primary dc:hover:underline",
|
|
914
883
|
children: s("filter.group.addFilterLink")
|
|
915
884
|
})]
|
|
916
|
-
}) : e.filters.map((e, n) =>
|
|
885
|
+
}) : e.filters.map((e, n) => M(e) ? /* @__PURE__ */ q(Ue, {
|
|
917
886
|
filter: e,
|
|
918
887
|
schema: t,
|
|
919
888
|
onUpdate: (e) => f(n, e),
|
|
920
889
|
onRemove: () => p(n)
|
|
921
|
-
}, `filter-${n}`) :
|
|
890
|
+
}, `filter-${n}`) : re(e) ? /* @__PURE__ */ q(qe, {
|
|
922
891
|
group: e,
|
|
923
892
|
schema: t,
|
|
924
893
|
onUpdate: (e) => f(n, e),
|
|
@@ -931,178 +900,134 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
931
900
|
}
|
|
932
901
|
//#endregion
|
|
933
902
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterSection.tsx
|
|
934
|
-
var
|
|
935
|
-
function We(e) {
|
|
936
|
-
return "member" in e && typeof e.member == "string";
|
|
937
|
-
}
|
|
938
|
-
function Ge(e) {
|
|
939
|
-
return "type" in e && (e.type === "and" || e.type === "or");
|
|
940
|
-
}
|
|
941
|
-
function Ke(e) {
|
|
942
|
-
let t = 0;
|
|
943
|
-
for (let n of e) We(n) ? t++ : Ge(n) && (t += Ke(n.filters));
|
|
944
|
-
return t;
|
|
945
|
-
}
|
|
946
|
-
function qe(e) {
|
|
947
|
-
let t = [];
|
|
948
|
-
for (let n of e) We(n) ? t.push(n.member) : Ge(n) && t.push(...qe(n.filters));
|
|
949
|
-
return t;
|
|
950
|
-
}
|
|
951
|
-
function Je(e, t, n) {
|
|
952
|
-
if (t.length === 0) return e.length === 0 ? [n] : e.length === 1 && We(e[0]) ? [{
|
|
953
|
-
type: "and",
|
|
954
|
-
filters: [e[0], n]
|
|
955
|
-
}] : e.length === 1 && Ge(e[0]) ? [{
|
|
956
|
-
...e[0],
|
|
957
|
-
filters: [...e[0].filters, n]
|
|
958
|
-
}] : [{
|
|
959
|
-
type: "and",
|
|
960
|
-
filters: [...e, n]
|
|
961
|
-
}];
|
|
962
|
-
let [r, ...i] = t, a = [...e], o = a[r];
|
|
963
|
-
return Ge(o) && (i.length === 0 ? a[r] = {
|
|
964
|
-
...o,
|
|
965
|
-
filters: [...o.filters, n]
|
|
966
|
-
} : a[r] = {
|
|
967
|
-
...o,
|
|
968
|
-
filters: Je(o.filters, i, n)
|
|
969
|
-
}), a;
|
|
970
|
-
}
|
|
903
|
+
var Je = l("add");
|
|
971
904
|
function Ye({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dimensionsOnly: i = !1 }) {
|
|
972
|
-
let { t: a } =
|
|
905
|
+
let { t: a } = R(), [o, s] = G(!1), [c, l] = G(!1), u = W([]), d = I(e), f = V((e) => {
|
|
973
906
|
e.preventDefault(), e.stopPropagation(), l(!0);
|
|
974
|
-
}, []), p =
|
|
907
|
+
}, []), p = V((e) => {
|
|
975
908
|
e.preventDefault(), e.stopPropagation(), l(!1);
|
|
976
|
-
}, []),
|
|
909
|
+
}, []), m = V((e) => {
|
|
977
910
|
e.preventDefault(), e.stopPropagation(), l(!1);
|
|
978
911
|
try {
|
|
979
912
|
let t = JSON.parse(e.dataTransfer.getData("text/plain"));
|
|
980
913
|
t.field && r && r(t.field);
|
|
981
914
|
} catch {}
|
|
982
|
-
}, [r]),
|
|
915
|
+
}, [r]), h = A(e), g = V((t, r, i) => {
|
|
983
916
|
let a = t.type === "time", o = a ? "inDateRange" : "equals", c = {
|
|
984
917
|
member: t.name,
|
|
985
918
|
operator: o,
|
|
986
919
|
values: []
|
|
987
920
|
};
|
|
988
|
-
a && o === "inDateRange" && (c.dateRange =
|
|
989
|
-
}, [e, n]),
|
|
921
|
+
a && o === "inDateRange" && (c.dateRange = N("this_month")), n(ie(e, u.current, c)), s(!1), u.current = [];
|
|
922
|
+
}, [e, n]), _ = V((t, r) => {
|
|
990
923
|
let i = [...e];
|
|
991
924
|
i[t] = r, n(i);
|
|
992
|
-
}, [e, n]),
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
let e = r[0];
|
|
996
|
-
if (e.filters.length === 1) {
|
|
997
|
-
n([e.filters[0]]);
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
n(r);
|
|
1002
|
-
}, [e, n]), b = R(() => {
|
|
925
|
+
}, [e, n]), v = V((t) => {
|
|
926
|
+
n(ae(e, t));
|
|
927
|
+
}, [e, n]), y = V(() => {
|
|
1003
928
|
n([]);
|
|
1004
|
-
}, [n]),
|
|
929
|
+
}, [n]), b = V(() => {
|
|
1005
930
|
u.current = [], s(!0);
|
|
1006
|
-
}, []),
|
|
931
|
+
}, []), x = V((e) => (t = []) => {
|
|
1007
932
|
u.current = [...e, ...t], s(!0);
|
|
1008
|
-
}, []),
|
|
933
|
+
}, []), S = (n, r, i = []) => {
|
|
1009
934
|
let a = [...i, r];
|
|
1010
|
-
return
|
|
935
|
+
return M(n) ? /* @__PURE__ */ q(Ue, {
|
|
1011
936
|
filter: n,
|
|
1012
937
|
schema: t,
|
|
1013
|
-
onUpdate: (e) =>
|
|
1014
|
-
onRemove: () =>
|
|
1015
|
-
}, `filter-${a.join("-")}`) :
|
|
938
|
+
onUpdate: (e) => _(r, e),
|
|
939
|
+
onRemove: () => v(r)
|
|
940
|
+
}, `filter-${a.join("-")}`) : re(n) ? /* @__PURE__ */ q(qe, {
|
|
1016
941
|
group: n,
|
|
1017
942
|
schema: t,
|
|
1018
|
-
onUpdate: (e) =>
|
|
1019
|
-
onRemove: () =>
|
|
1020
|
-
onAddFilter:
|
|
943
|
+
onUpdate: (e) => _(r, e),
|
|
944
|
+
onRemove: () => v(r),
|
|
945
|
+
onAddFilter: x(a),
|
|
1021
946
|
hideRemoveButton: e.length === 1
|
|
1022
947
|
}, `group-${a.join("-")}`) : null;
|
|
1023
948
|
};
|
|
1024
|
-
return /* @__PURE__ */
|
|
1025
|
-
/* @__PURE__ */
|
|
1026
|
-
onClick:
|
|
949
|
+
return /* @__PURE__ */ J("div", { children: [
|
|
950
|
+
/* @__PURE__ */ J("button", {
|
|
951
|
+
onClick: b,
|
|
1027
952
|
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",
|
|
1028
953
|
title: "Add filter",
|
|
1029
|
-
children: [/* @__PURE__ */
|
|
954
|
+
children: [/* @__PURE__ */ J(he, { children: [a("analysis.sections.filters"), d > 0 && /* @__PURE__ */ J("span", {
|
|
1030
955
|
className: "dc:ml-1.5 dc:text-xs dc:font-normal text-dc-text-muted dc:normal-case dc:tracking-normal",
|
|
1031
956
|
children: [
|
|
1032
957
|
"(",
|
|
1033
958
|
d,
|
|
1034
959
|
")"
|
|
1035
960
|
]
|
|
1036
|
-
})] }), /* @__PURE__ */
|
|
961
|
+
})] }), /* @__PURE__ */ J("div", {
|
|
1037
962
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
1038
|
-
children: [d > 0 && /* @__PURE__ */
|
|
963
|
+
children: [d > 0 && /* @__PURE__ */ q("span", {
|
|
1039
964
|
role: "button",
|
|
1040
965
|
tabIndex: 0,
|
|
1041
966
|
onClick: (e) => {
|
|
1042
|
-
e.stopPropagation(),
|
|
967
|
+
e.stopPropagation(), y();
|
|
1043
968
|
},
|
|
1044
969
|
onKeyDown: (e) => {
|
|
1045
|
-
(e.key === "Enter" || e.key === " ") && (e.stopPropagation(),
|
|
970
|
+
(e.key === "Enter" || e.key === " ") && (e.stopPropagation(), y());
|
|
1046
971
|
},
|
|
1047
972
|
className: "dc:text-xs text-dc-text-muted hover:text-dc-error dc:underline dc:cursor-pointer",
|
|
1048
973
|
children: a("filter.section.clearAll")
|
|
1049
|
-
}), /* @__PURE__ */
|
|
974
|
+
}), /* @__PURE__ */ q(Je, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })]
|
|
1050
975
|
})]
|
|
1051
976
|
}),
|
|
1052
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ q("div", {
|
|
1053
978
|
onDragOver: r ? f : void 0,
|
|
1054
979
|
onDragLeave: r ? p : void 0,
|
|
1055
|
-
onDrop: r ?
|
|
980
|
+
onDrop: r ? m : void 0,
|
|
1056
981
|
className: `dc:p-2 dc:-mx-2 dc:rounded-lg dc:border-2 dc:border-dashed dc:transition-all ${c ? "border-dc-primary bg-dc-primary/5" : "border-transparent"}`,
|
|
1057
|
-
children: e.length === 0 ? /* @__PURE__ */
|
|
982
|
+
children: e.length === 0 ? /* @__PURE__ */ q("p", {
|
|
1058
983
|
className: `dc:text-sm ${c ? "text-dc-primary dc:font-medium" : "text-dc-text-muted"}`,
|
|
1059
984
|
children: a(c ? "filter.section.dropHint" : "filter.section.empty")
|
|
1060
|
-
}) : /* @__PURE__ */
|
|
985
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1061
986
|
className: "dc:flex dc:flex-wrap dc:gap-2",
|
|
1062
|
-
children: e.map((e, t) =>
|
|
987
|
+
children: e.map((e, t) => S(e, t))
|
|
1063
988
|
})
|
|
1064
989
|
}),
|
|
1065
|
-
/* @__PURE__ */
|
|
990
|
+
/* @__PURE__ */ q(T, {
|
|
1066
991
|
isOpen: o,
|
|
1067
992
|
onClose: () => {
|
|
1068
993
|
s(!1), u.current = [];
|
|
1069
994
|
},
|
|
1070
|
-
onSelect:
|
|
995
|
+
onSelect: g,
|
|
1071
996
|
mode: i ? "dimensionFilter" : "filter",
|
|
1072
997
|
schema: t,
|
|
1073
|
-
selectedFields:
|
|
998
|
+
selectedFields: h
|
|
1074
999
|
})
|
|
1075
1000
|
] });
|
|
1076
1001
|
}
|
|
1077
1002
|
//#endregion
|
|
1078
1003
|
//#region src/client/components/AnalysisBuilder/ExplainAIPanel.tsx
|
|
1079
|
-
function
|
|
1004
|
+
function Xe(e) {
|
|
1080
1005
|
return typeof e == "string" ? e : typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "");
|
|
1081
1006
|
}
|
|
1082
|
-
var
|
|
1007
|
+
var Ze = {
|
|
1083
1008
|
good: "bg-dc-success-bg text-dc-success border-dc-success",
|
|
1084
1009
|
warning: "bg-dc-warning-bg text-dc-warning border-dc-warning",
|
|
1085
1010
|
critical: "bg-dc-danger-bg text-dc-error border-dc-error"
|
|
1086
|
-
},
|
|
1011
|
+
}, Qe = {
|
|
1087
1012
|
critical: "bg-dc-danger-bg text-dc-error",
|
|
1088
1013
|
warning: "bg-dc-warning-bg text-dc-warning",
|
|
1089
1014
|
suggestion: "bg-dc-accent-bg text-dc-accent"
|
|
1090
|
-
},
|
|
1015
|
+
}, $e = {
|
|
1091
1016
|
high: "text-dc-error",
|
|
1092
1017
|
medium: "text-dc-warning",
|
|
1093
1018
|
low: "text-dc-text-muted"
|
|
1094
1019
|
};
|
|
1095
|
-
function
|
|
1096
|
-
let { t: n } =
|
|
1020
|
+
function et({ assessment: e, reason: t }) {
|
|
1021
|
+
let { t: n } = R(), r = {
|
|
1097
1022
|
good: n("explainAI.assessment.good"),
|
|
1098
1023
|
warning: n("explainAI.assessment.warning"),
|
|
1099
1024
|
critical: n("explainAI.assessment.critical")
|
|
1100
1025
|
};
|
|
1101
|
-
return /* @__PURE__ */
|
|
1102
|
-
className: `dc:p-4 dc:rounded-lg dc:border ${
|
|
1103
|
-
children: [/* @__PURE__ */
|
|
1026
|
+
return /* @__PURE__ */ J("div", {
|
|
1027
|
+
className: `dc:p-4 dc:rounded-lg dc:border ${Ze[e]}`,
|
|
1028
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1104
1029
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-1",
|
|
1105
|
-
children: /* @__PURE__ */
|
|
1030
|
+
children: /* @__PURE__ */ J("span", {
|
|
1106
1031
|
className: "dc:font-semibold dc:uppercase dc:text-base",
|
|
1107
1032
|
children: [
|
|
1108
1033
|
e === "good" && "✓ ",
|
|
@@ -1111,33 +1036,33 @@ function $e({ assessment: e, reason: t }) {
|
|
|
1111
1036
|
r[e]
|
|
1112
1037
|
]
|
|
1113
1038
|
})
|
|
1114
|
-
}), /* @__PURE__ */
|
|
1039
|
+
}), /* @__PURE__ */ q("p", {
|
|
1115
1040
|
className: "dc:text-sm",
|
|
1116
|
-
children:
|
|
1041
|
+
children: Xe(t)
|
|
1117
1042
|
})]
|
|
1118
1043
|
});
|
|
1119
1044
|
}
|
|
1120
|
-
function
|
|
1121
|
-
return /* @__PURE__ */
|
|
1045
|
+
function tt({ issue: e }) {
|
|
1046
|
+
return /* @__PURE__ */ J("div", {
|
|
1122
1047
|
className: "dc:flex dc:items-start dc:gap-2 dc:py-2",
|
|
1123
|
-
children: [/* @__PURE__ */
|
|
1124
|
-
className: `dc:text-sm ${
|
|
1048
|
+
children: [/* @__PURE__ */ J("span", {
|
|
1049
|
+
className: `dc:text-sm ${$e[e.severity]}`,
|
|
1125
1050
|
children: [
|
|
1126
1051
|
e.severity === "high" && "●",
|
|
1127
1052
|
e.severity === "medium" && "○",
|
|
1128
1053
|
e.severity === "low" && "○"
|
|
1129
1054
|
]
|
|
1130
|
-
}), /* @__PURE__ */
|
|
1055
|
+
}), /* @__PURE__ */ q("span", {
|
|
1131
1056
|
className: "dc:text-sm text-dc-text-secondary",
|
|
1132
|
-
children:
|
|
1057
|
+
children: Xe(e.description)
|
|
1133
1058
|
})]
|
|
1134
1059
|
});
|
|
1135
1060
|
}
|
|
1136
|
-
function
|
|
1137
|
-
let { t } =
|
|
1138
|
-
return
|
|
1061
|
+
function nt({ text: e }) {
|
|
1062
|
+
let { t } = R(), [n, r] = B.useState(!1), i = B.useRef(null);
|
|
1063
|
+
return B.useEffect(() => () => {
|
|
1139
1064
|
i.current && clearTimeout(i.current);
|
|
1140
|
-
}, []), /* @__PURE__ */
|
|
1065
|
+
}, []), /* @__PURE__ */ q("button", {
|
|
1141
1066
|
onClick: async () => {
|
|
1142
1067
|
try {
|
|
1143
1068
|
await navigator.clipboard.writeText(e), r(!0), i.current && clearTimeout(i.current), i.current = setTimeout(() => r(!1), 2e3);
|
|
@@ -1150,104 +1075,104 @@ function tt({ text: e }) {
|
|
|
1150
1075
|
children: t(n ? "explainAI.copied" : "explainAI.copy")
|
|
1151
1076
|
});
|
|
1152
1077
|
}
|
|
1153
|
-
function
|
|
1154
|
-
let { t } =
|
|
1078
|
+
function rt({ rec: e }) {
|
|
1079
|
+
let { t } = R(), n = {
|
|
1155
1080
|
index: t("explainAI.type.index"),
|
|
1156
1081
|
table: t("explainAI.type.table"),
|
|
1157
1082
|
cube: t("explainAI.type.cube"),
|
|
1158
1083
|
general: t("explainAI.type.general")
|
|
1159
1084
|
};
|
|
1160
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ J("div", {
|
|
1161
1086
|
className: "dc:p-4 dc:border border-dc-border dc:rounded-lg bg-dc-surface",
|
|
1162
1087
|
children: [
|
|
1163
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ J("div", {
|
|
1164
1089
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-2",
|
|
1165
|
-
children: [/* @__PURE__ */
|
|
1166
|
-
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${
|
|
1090
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1091
|
+
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${Qe[e.severity]}`,
|
|
1167
1092
|
children: n[e.type]
|
|
1168
|
-
}), /* @__PURE__ */
|
|
1093
|
+
}), /* @__PURE__ */ q("h5", {
|
|
1169
1094
|
className: "dc:font-medium text-dc-text",
|
|
1170
|
-
children:
|
|
1095
|
+
children: Xe(e.title)
|
|
1171
1096
|
})]
|
|
1172
1097
|
}),
|
|
1173
|
-
/* @__PURE__ */
|
|
1098
|
+
/* @__PURE__ */ q("p", {
|
|
1174
1099
|
className: "dc:text-sm text-dc-text-secondary dc:mb-3",
|
|
1175
|
-
children:
|
|
1100
|
+
children: Xe(e.description)
|
|
1176
1101
|
}),
|
|
1177
|
-
e.sql && /* @__PURE__ */
|
|
1102
|
+
e.sql && /* @__PURE__ */ q("div", {
|
|
1178
1103
|
className: "dc:mt-2",
|
|
1179
|
-
children: /* @__PURE__ */
|
|
1104
|
+
children: /* @__PURE__ */ q(y, {
|
|
1180
1105
|
code: e.sql,
|
|
1181
1106
|
language: "sql",
|
|
1182
|
-
headerRight: /* @__PURE__ */
|
|
1107
|
+
headerRight: /* @__PURE__ */ q(nt, { text: e.sql })
|
|
1183
1108
|
})
|
|
1184
1109
|
}),
|
|
1185
|
-
e.cubeCode && /* @__PURE__ */
|
|
1110
|
+
e.cubeCode && /* @__PURE__ */ J("div", {
|
|
1186
1111
|
className: "dc:mt-2",
|
|
1187
|
-
children: [e.cubeName && /* @__PURE__ */
|
|
1112
|
+
children: [e.cubeName && /* @__PURE__ */ q("p", {
|
|
1188
1113
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
1189
1114
|
children: t("explainAI.addToCube", { cubeName: e.cubeName })
|
|
1190
|
-
}), /* @__PURE__ */
|
|
1115
|
+
}), /* @__PURE__ */ J("div", {
|
|
1191
1116
|
className: "dc:relative",
|
|
1192
|
-
children: [/* @__PURE__ */
|
|
1117
|
+
children: [/* @__PURE__ */ q("pre", {
|
|
1193
1118
|
className: "dc:p-3 dc:text-xs bg-dc-surface-secondary dc:rounded dc:overflow-x-auto dc:font-mono text-dc-text",
|
|
1194
1119
|
children: e.cubeCode
|
|
1195
|
-
}), /* @__PURE__ */
|
|
1120
|
+
}), /* @__PURE__ */ q("div", {
|
|
1196
1121
|
className: "dc:absolute dc:top-1 dc:right-1",
|
|
1197
|
-
children: /* @__PURE__ */
|
|
1122
|
+
children: /* @__PURE__ */ q(nt, { text: e.cubeCode })
|
|
1198
1123
|
})]
|
|
1199
1124
|
})]
|
|
1200
1125
|
}),
|
|
1201
|
-
e.estimatedImpact && /* @__PURE__ */
|
|
1126
|
+
e.estimatedImpact && /* @__PURE__ */ J("p", {
|
|
1202
1127
|
className: "dc:text-xs text-dc-text-muted dc:mt-2",
|
|
1203
1128
|
children: [
|
|
1204
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ q("strong", { children: t("explainAI.expectedImpact") }),
|
|
1205
1130
|
" ",
|
|
1206
|
-
|
|
1131
|
+
Xe(e.estimatedImpact)
|
|
1207
1132
|
]
|
|
1208
1133
|
})
|
|
1209
1134
|
]
|
|
1210
1135
|
});
|
|
1211
1136
|
}
|
|
1212
|
-
function
|
|
1213
|
-
let { t: r } =
|
|
1214
|
-
return
|
|
1137
|
+
function it({ analysis: e, onClose: t, onClear: n }) {
|
|
1138
|
+
let { t: r } = R(), i = t || n;
|
|
1139
|
+
return B.useEffect(() => {
|
|
1215
1140
|
let e = (e) => {
|
|
1216
1141
|
e.key === "Escape" && i && i();
|
|
1217
1142
|
};
|
|
1218
1143
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1219
|
-
}, [i]),
|
|
1144
|
+
}, [i]), B.useEffect(() => (document.body.style.overflow = "hidden", () => {
|
|
1220
1145
|
document.body.style.overflow = "";
|
|
1221
|
-
}), []), /* @__PURE__ */
|
|
1146
|
+
}), []), /* @__PURE__ */ J("div", {
|
|
1222
1147
|
className: "dc:fixed dc:inset-0 dc:z-50 dc:flex dc:items-center dc:justify-center dc:p-4 bg-black/50",
|
|
1223
|
-
children: [/* @__PURE__ */
|
|
1148
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1224
1149
|
className: "dc:absolute dc:inset-0",
|
|
1225
1150
|
onClick: i,
|
|
1226
1151
|
"aria-hidden": "true"
|
|
1227
|
-
}), /* @__PURE__ */
|
|
1152
|
+
}), /* @__PURE__ */ J("div", {
|
|
1228
1153
|
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",
|
|
1229
1154
|
children: [
|
|
1230
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ J("div", {
|
|
1231
1156
|
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",
|
|
1232
|
-
children: [/* @__PURE__ */
|
|
1157
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1233
1158
|
className: "dc:flex dc:items-center dc:gap-3",
|
|
1234
|
-
children: [/* @__PURE__ */
|
|
1159
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1235
1160
|
className: "dc:text-lg",
|
|
1236
1161
|
children: "✨"
|
|
1237
|
-
}), /* @__PURE__ */
|
|
1162
|
+
}), /* @__PURE__ */ q("h3", {
|
|
1238
1163
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
1239
1164
|
children: r("explainAI.title")
|
|
1240
1165
|
})]
|
|
1241
|
-
}), /* @__PURE__ */
|
|
1166
|
+
}), /* @__PURE__ */ q("button", {
|
|
1242
1167
|
onClick: i,
|
|
1243
1168
|
className: "dc:p-2 dc:rounded-lg hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
1244
1169
|
"aria-label": "Close",
|
|
1245
|
-
children: /* @__PURE__ */
|
|
1170
|
+
children: /* @__PURE__ */ q("svg", {
|
|
1246
1171
|
className: "dc:w-5 dc:h-5",
|
|
1247
1172
|
fill: "none",
|
|
1248
1173
|
stroke: "currentColor",
|
|
1249
1174
|
viewBox: "0 0 24 24",
|
|
1250
|
-
children: /* @__PURE__ */
|
|
1175
|
+
children: /* @__PURE__ */ q("path", {
|
|
1251
1176
|
strokeLinecap: "round",
|
|
1252
1177
|
strokeLinejoin: "round",
|
|
1253
1178
|
strokeWidth: 2,
|
|
@@ -1256,50 +1181,50 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1256
1181
|
})
|
|
1257
1182
|
})]
|
|
1258
1183
|
}),
|
|
1259
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ J("div", {
|
|
1260
1185
|
className: "dc:flex-1 dc:overflow-y-auto dc:px-6 dc:py-4 dc:space-y-6",
|
|
1261
1186
|
children: [
|
|
1262
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ q(et, {
|
|
1263
1188
|
assessment: e.assessment,
|
|
1264
1189
|
reason: e.assessmentReason
|
|
1265
1190
|
}),
|
|
1266
|
-
/* @__PURE__ */
|
|
1191
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1267
1192
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1268
1193
|
children: r("explainAI.summary")
|
|
1269
|
-
}), /* @__PURE__ */
|
|
1194
|
+
}), /* @__PURE__ */ q("p", {
|
|
1270
1195
|
className: "text-dc-text",
|
|
1271
|
-
children:
|
|
1196
|
+
children: Xe(e.summary)
|
|
1272
1197
|
})] }),
|
|
1273
|
-
e.queryUnderstanding && /* @__PURE__ */
|
|
1198
|
+
e.queryUnderstanding && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1274
1199
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1275
1200
|
children: r("explainAI.queryAnalysis")
|
|
1276
|
-
}), /* @__PURE__ */
|
|
1201
|
+
}), /* @__PURE__ */ q("p", {
|
|
1277
1202
|
className: "text-dc-text-secondary",
|
|
1278
|
-
children:
|
|
1203
|
+
children: Xe(e.queryUnderstanding)
|
|
1279
1204
|
})] }),
|
|
1280
|
-
e.issues && e.issues.length > 0 && /* @__PURE__ */
|
|
1205
|
+
e.issues && e.issues.length > 0 && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1281
1206
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1282
1207
|
children: r("explainAI.issuesFound", { count: e.issues.length })
|
|
1283
|
-
}), /* @__PURE__ */
|
|
1208
|
+
}), /* @__PURE__ */ q("div", {
|
|
1284
1209
|
className: "dc:space-y-1 bg-dc-surface-secondary dc:rounded-lg dc:p-3",
|
|
1285
|
-
children: e.issues.map((e, t) => /* @__PURE__ */
|
|
1210
|
+
children: e.issues.map((e, t) => /* @__PURE__ */ q(tt, { issue: e }, t))
|
|
1286
1211
|
})] }),
|
|
1287
|
-
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */
|
|
1212
|
+
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1288
1213
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-3",
|
|
1289
1214
|
children: r("explainAI.recommendations", { count: e.recommendations.length })
|
|
1290
|
-
}), /* @__PURE__ */
|
|
1215
|
+
}), /* @__PURE__ */ q("div", {
|
|
1291
1216
|
className: "dc:space-y-4",
|
|
1292
|
-
children: e.recommendations.map((e, t) => /* @__PURE__ */
|
|
1217
|
+
children: e.recommendations.map((e, t) => /* @__PURE__ */ q(rt, { rec: e }, t))
|
|
1293
1218
|
})] }),
|
|
1294
|
-
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */
|
|
1219
|
+
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */ q("div", {
|
|
1295
1220
|
className: "text-dc-text-muted dc:italic dc:p-4 bg-dc-surface-secondary dc:rounded-lg",
|
|
1296
1221
|
children: r("explainAI.noRecommendations")
|
|
1297
1222
|
})
|
|
1298
1223
|
]
|
|
1299
1224
|
}),
|
|
1300
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ J("div", {
|
|
1301
1226
|
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",
|
|
1302
|
-
children: [e._meta && /* @__PURE__ */
|
|
1227
|
+
children: [e._meta && /* @__PURE__ */ J("div", {
|
|
1303
1228
|
className: "dc:text-xs text-dc-text-muted",
|
|
1304
1229
|
children: [
|
|
1305
1230
|
r("explainAI.modelLabel"),
|
|
@@ -1307,7 +1232,7 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1307
1232
|
e._meta.model,
|
|
1308
1233
|
e._meta.usingUserKey && ` ${r("explainAI.usingUserKey")}`
|
|
1309
1234
|
]
|
|
1310
|
-
}), /* @__PURE__ */
|
|
1235
|
+
}), /* @__PURE__ */ q("button", {
|
|
1311
1236
|
onClick: i,
|
|
1312
1237
|
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",
|
|
1313
1238
|
children: r("common.actions.close")
|
|
@@ -1319,31 +1244,31 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1319
1244
|
}
|
|
1320
1245
|
//#endregion
|
|
1321
1246
|
//#region src/client/shared/chartConfigBuilders.ts
|
|
1322
|
-
var
|
|
1323
|
-
function
|
|
1247
|
+
var at = (e) => e.map((e) => e.field), ot = (e) => e.length > 0 ? [e[0].field] : [];
|
|
1248
|
+
function st(e) {
|
|
1324
1249
|
let { metrics: t, timeDimension: n, dimension: r, dimensions: i } = e;
|
|
1325
1250
|
return {
|
|
1326
1251
|
xAxis: n ? [n.field] : r ? [r.field] : [],
|
|
1327
|
-
yAxis:
|
|
1252
|
+
yAxis: at(t),
|
|
1328
1253
|
series: i.length > 1 ? [i[1].field] : r && n ? [r.field] : []
|
|
1329
1254
|
};
|
|
1330
1255
|
}
|
|
1331
|
-
function
|
|
1256
|
+
function ct(e) {
|
|
1332
1257
|
let { metrics: t, timeDimension: n, dimension: r, dimensions: i } = e;
|
|
1333
1258
|
return {
|
|
1334
1259
|
xAxis: r ? [r.field] : n ? [n.field] : [],
|
|
1335
|
-
yAxis:
|
|
1260
|
+
yAxis: at(t),
|
|
1336
1261
|
series: i.length > 1 ? [i[1].field] : n && r ? [n.field] : []
|
|
1337
1262
|
};
|
|
1338
1263
|
}
|
|
1339
|
-
function
|
|
1264
|
+
function lt(e) {
|
|
1340
1265
|
let { metrics: t, dimension: n } = e;
|
|
1341
1266
|
return {
|
|
1342
1267
|
xAxis: n ? [n.field] : [],
|
|
1343
|
-
yAxis:
|
|
1268
|
+
yAxis: ot(t)
|
|
1344
1269
|
};
|
|
1345
1270
|
}
|
|
1346
|
-
function
|
|
1271
|
+
function ut(e) {
|
|
1347
1272
|
let { metrics: t, breakdowns: n, dimension: r, dimensions: i } = e;
|
|
1348
1273
|
return t.length >= 2 ? {
|
|
1349
1274
|
xAxis: [t[0].field],
|
|
@@ -1351,11 +1276,11 @@ function lt(e) {
|
|
|
1351
1276
|
series: r ? [r.field] : []
|
|
1352
1277
|
} : {
|
|
1353
1278
|
xAxis: n.length > 0 ? [n[0].field] : [],
|
|
1354
|
-
yAxis:
|
|
1279
|
+
yAxis: ot(t),
|
|
1355
1280
|
series: i.length > 1 ? [i[1].field] : []
|
|
1356
1281
|
};
|
|
1357
1282
|
}
|
|
1358
|
-
function
|
|
1283
|
+
function dt(e) {
|
|
1359
1284
|
let { metrics: t, timeDimension: n, dimension: r } = e;
|
|
1360
1285
|
return {
|
|
1361
1286
|
xAxis: t.length > 0 ? [t[0].field] : [],
|
|
@@ -1364,210 +1289,210 @@ function ut(e) {
|
|
|
1364
1289
|
series: r ? [r.field] : n ? [n.field] : []
|
|
1365
1290
|
};
|
|
1366
1291
|
}
|
|
1367
|
-
function
|
|
1292
|
+
function ft(e) {
|
|
1368
1293
|
let { metrics: t, dimension: n } = e;
|
|
1369
1294
|
return {
|
|
1370
1295
|
xAxis: n ? [n.field] : [],
|
|
1371
|
-
yAxis:
|
|
1296
|
+
yAxis: ot(t)
|
|
1372
1297
|
};
|
|
1373
1298
|
}
|
|
1374
|
-
function
|
|
1299
|
+
function pt(e) {
|
|
1375
1300
|
let { metrics: t, timeDimension: n } = e;
|
|
1376
1301
|
return {
|
|
1377
1302
|
dateField: n ? [n.field] : [],
|
|
1378
|
-
valueField:
|
|
1303
|
+
valueField: ot(t)
|
|
1379
1304
|
};
|
|
1380
1305
|
}
|
|
1381
|
-
function pt(e) {
|
|
1382
|
-
return { yAxis: at(e.metrics) };
|
|
1383
|
-
}
|
|
1384
1306
|
function mt(e) {
|
|
1307
|
+
return { yAxis: ot(e.metrics) };
|
|
1308
|
+
}
|
|
1309
|
+
function ht(e) {
|
|
1385
1310
|
let { metrics: t, breakdowns: n } = e;
|
|
1386
1311
|
return { xAxis: [...n.map((e) => e.field), ...t.map((e) => e.field)] };
|
|
1387
1312
|
}
|
|
1388
|
-
function
|
|
1313
|
+
function gt() {
|
|
1389
1314
|
return {};
|
|
1390
1315
|
}
|
|
1391
|
-
function
|
|
1316
|
+
function _t(e) {
|
|
1392
1317
|
let { metrics: t, breakdowns: n } = e;
|
|
1393
1318
|
return {
|
|
1394
1319
|
xAxis: n.length > 0 ? [n[0].field] : [],
|
|
1395
|
-
yAxis:
|
|
1320
|
+
yAxis: at(t)
|
|
1396
1321
|
};
|
|
1397
1322
|
}
|
|
1398
|
-
var
|
|
1399
|
-
line:
|
|
1400
|
-
area:
|
|
1401
|
-
bar:
|
|
1402
|
-
pie:
|
|
1403
|
-
scatter:
|
|
1404
|
-
bubble:
|
|
1405
|
-
radar:
|
|
1406
|
-
radialBar:
|
|
1407
|
-
treemap:
|
|
1408
|
-
activityGrid:
|
|
1409
|
-
kpiNumber:
|
|
1410
|
-
kpiDelta:
|
|
1411
|
-
kpiText:
|
|
1412
|
-
table:
|
|
1413
|
-
markdown:
|
|
1323
|
+
var vt = {
|
|
1324
|
+
line: st,
|
|
1325
|
+
area: st,
|
|
1326
|
+
bar: ct,
|
|
1327
|
+
pie: lt,
|
|
1328
|
+
scatter: ut,
|
|
1329
|
+
bubble: dt,
|
|
1330
|
+
radar: ft,
|
|
1331
|
+
radialBar: ft,
|
|
1332
|
+
treemap: ft,
|
|
1333
|
+
activityGrid: pt,
|
|
1334
|
+
kpiNumber: mt,
|
|
1335
|
+
kpiDelta: mt,
|
|
1336
|
+
kpiText: mt,
|
|
1337
|
+
table: ht,
|
|
1338
|
+
markdown: gt
|
|
1414
1339
|
};
|
|
1415
|
-
function
|
|
1416
|
-
return
|
|
1340
|
+
function yt(e) {
|
|
1341
|
+
return vt[e] || _t;
|
|
1417
1342
|
}
|
|
1418
1343
|
//#endregion
|
|
1419
1344
|
//#region src/client/shared/chartDefaults.ts
|
|
1420
|
-
function yt(e) {
|
|
1421
|
-
return e.isTimeDimension;
|
|
1422
|
-
}
|
|
1423
1345
|
function bt(e) {
|
|
1424
|
-
return e.
|
|
1346
|
+
return e.isTimeDimension;
|
|
1425
1347
|
}
|
|
1426
1348
|
function xt(e) {
|
|
1427
|
-
return e.find(
|
|
1349
|
+
return e.find(bt);
|
|
1428
1350
|
}
|
|
1429
1351
|
function St(e) {
|
|
1430
|
-
return e.
|
|
1352
|
+
return e.find((e) => !e.isTimeDimension);
|
|
1431
1353
|
}
|
|
1432
1354
|
function Ct(e) {
|
|
1433
|
-
return e.filter(
|
|
1355
|
+
return e.filter((e) => !e.isTimeDimension);
|
|
1356
|
+
}
|
|
1357
|
+
function wt(e) {
|
|
1358
|
+
return e.filter(bt);
|
|
1434
1359
|
}
|
|
1435
|
-
function
|
|
1360
|
+
function Tt(e, t) {
|
|
1436
1361
|
return {
|
|
1437
1362
|
measureCount: e.length,
|
|
1438
1363
|
dimensionCount: t.length,
|
|
1439
|
-
timeDimensionCount:
|
|
1364
|
+
timeDimensionCount: wt(t).length
|
|
1440
1365
|
};
|
|
1441
1366
|
}
|
|
1442
|
-
function
|
|
1367
|
+
function Et(e, t, n) {
|
|
1443
1368
|
let r = c[e];
|
|
1444
|
-
return !r || !r.isAvailable ? { available: !0 } : r.isAvailable(
|
|
1369
|
+
return !r || !r.isAvailable ? { available: !0 } : r.isAvailable(Tt(t, n));
|
|
1445
1370
|
}
|
|
1446
|
-
function
|
|
1371
|
+
function Dt(e, t) {
|
|
1447
1372
|
let n = Object.keys(c), r = {};
|
|
1448
|
-
for (let i of n) r[i] =
|
|
1373
|
+
for (let i of n) r[i] = Et(i, e, t);
|
|
1449
1374
|
return r;
|
|
1450
1375
|
}
|
|
1451
|
-
function
|
|
1452
|
-
if (
|
|
1453
|
-
let r =
|
|
1376
|
+
function Ot(e, t, n) {
|
|
1377
|
+
if (Et(n, e, t).available || e.length === 0 && t.length === 0) return n;
|
|
1378
|
+
let r = wt(t).length > 0, i = Ct(t).length > 0, a = e.length > 0;
|
|
1454
1379
|
return r && a ? "line" : i && a ? "bar" : a && !i && !r ? "kpiNumber" : "table";
|
|
1455
1380
|
}
|
|
1456
|
-
function
|
|
1457
|
-
let r =
|
|
1381
|
+
function kt(e, t, n) {
|
|
1382
|
+
let r = Ot(e, t, n);
|
|
1458
1383
|
return {
|
|
1459
1384
|
chartType: r,
|
|
1460
|
-
chartConfig:
|
|
1385
|
+
chartConfig: At(r, e, t)
|
|
1461
1386
|
};
|
|
1462
1387
|
}
|
|
1463
|
-
function
|
|
1464
|
-
return
|
|
1388
|
+
function At(e, t, n) {
|
|
1389
|
+
return yt(e)({
|
|
1465
1390
|
metrics: t,
|
|
1466
1391
|
breakdowns: n,
|
|
1467
|
-
timeDimension:
|
|
1468
|
-
dimension:
|
|
1469
|
-
dimensions:
|
|
1392
|
+
timeDimension: xt(n),
|
|
1393
|
+
dimension: St(n),
|
|
1394
|
+
dimensions: Ct(n)
|
|
1470
1395
|
});
|
|
1471
1396
|
}
|
|
1472
|
-
function
|
|
1473
|
-
if (r &&
|
|
1474
|
-
let i =
|
|
1397
|
+
function jt(e, t, n, r) {
|
|
1398
|
+
if (r && Et(n, e, t).available) return null;
|
|
1399
|
+
let i = Ot(e, t, n);
|
|
1475
1400
|
return i === n ? null : i;
|
|
1476
1401
|
}
|
|
1477
1402
|
//#endregion
|
|
1478
1403
|
//#region src/client/components/AnalysisBuilder/ExecutionPlanPanelParts.tsx
|
|
1479
|
-
function
|
|
1480
|
-
return /* @__PURE__ */
|
|
1404
|
+
function Mt({ title: e, height: t, className: n, children: r }) {
|
|
1405
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("h4", {
|
|
1481
1406
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
1482
1407
|
children: e
|
|
1483
|
-
}), /* @__PURE__ */
|
|
1408
|
+
}), /* @__PURE__ */ q("div", {
|
|
1484
1409
|
className: n,
|
|
1485
1410
|
style: { height: t },
|
|
1486
1411
|
children: r
|
|
1487
1412
|
})] });
|
|
1488
1413
|
}
|
|
1489
|
-
function
|
|
1490
|
-
let { t: c } =
|
|
1491
|
-
return t ? /* @__PURE__ */
|
|
1414
|
+
function Nt({ sql: e, sqlLoading: t, sqlError: n, sqlPlaceholder: r, formattedSql: i, title: a, height: o, headerRight: s }) {
|
|
1415
|
+
let { t: c } = R();
|
|
1416
|
+
return t ? /* @__PURE__ */ q(Mt, {
|
|
1492
1417
|
title: a,
|
|
1493
1418
|
height: o,
|
|
1494
1419
|
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",
|
|
1495
1420
|
children: c("results.debug.loadingSql")
|
|
1496
|
-
}) : n ? /* @__PURE__ */
|
|
1421
|
+
}) : n ? /* @__PURE__ */ q(Mt, {
|
|
1497
1422
|
title: a,
|
|
1498
1423
|
height: o,
|
|
1499
1424
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
1500
1425
|
children: n.message
|
|
1501
|
-
}) : e ? /* @__PURE__ */
|
|
1426
|
+
}) : e ? /* @__PURE__ */ q(y, {
|
|
1502
1427
|
code: i,
|
|
1503
1428
|
language: "sql",
|
|
1504
1429
|
title: a,
|
|
1505
1430
|
height: o,
|
|
1506
1431
|
headerRight: s
|
|
1507
|
-
}) : /* @__PURE__ */
|
|
1432
|
+
}) : /* @__PURE__ */ q(Mt, {
|
|
1508
1433
|
title: a,
|
|
1509
1434
|
height: o,
|
|
1510
1435
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm",
|
|
1511
1436
|
children: r
|
|
1512
1437
|
});
|
|
1513
1438
|
}
|
|
1514
|
-
function
|
|
1515
|
-
let { t } =
|
|
1516
|
-
return /* @__PURE__ */
|
|
1439
|
+
function Pt({ summary: e }) {
|
|
1440
|
+
let { t } = R();
|
|
1441
|
+
return /* @__PURE__ */ J("div", {
|
|
1517
1442
|
className: "dc:flex dc:flex-wrap dc:items-center dc:gap-2",
|
|
1518
1443
|
children: [
|
|
1519
|
-
/* @__PURE__ */
|
|
1444
|
+
/* @__PURE__ */ q("span", {
|
|
1520
1445
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-accent text-white dc:rounded",
|
|
1521
1446
|
children: e.database.toUpperCase()
|
|
1522
1447
|
}),
|
|
1523
|
-
e.hasSequentialScans && /* @__PURE__ */
|
|
1448
|
+
e.hasSequentialScans && /* @__PURE__ */ q("span", {
|
|
1524
1449
|
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",
|
|
1525
1450
|
children: t("debug.sequentialScans")
|
|
1526
1451
|
}),
|
|
1527
|
-
e.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1452
|
+
e.usedIndexes.length > 0 && /* @__PURE__ */ q("span", {
|
|
1528
1453
|
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",
|
|
1529
1454
|
children: t(e.usedIndexes.length === 1 ? "debug.indexesUsed" : "debug.indexesUsedPlural", { count: e.usedIndexes.length })
|
|
1530
1455
|
}),
|
|
1531
|
-
e.executionTime !== void 0 && /* @__PURE__ */
|
|
1456
|
+
e.executionTime !== void 0 && /* @__PURE__ */ q("span", {
|
|
1532
1457
|
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",
|
|
1533
1458
|
children: t("debug.executionTime", { time: e.executionTime.toFixed(2) })
|
|
1534
1459
|
}),
|
|
1535
|
-
e.planningTime !== void 0 && /* @__PURE__ */
|
|
1460
|
+
e.planningTime !== void 0 && /* @__PURE__ */ q("span", {
|
|
1536
1461
|
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",
|
|
1537
1462
|
children: t("debug.planningTime", { time: e.planningTime.toFixed(2) })
|
|
1538
1463
|
}),
|
|
1539
|
-
e.totalCost !== void 0 && /* @__PURE__ */
|
|
1464
|
+
e.totalCost !== void 0 && /* @__PURE__ */ q("span", {
|
|
1540
1465
|
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",
|
|
1541
1466
|
children: t("debug.cost", { cost: e.totalCost.toFixed(2) })
|
|
1542
1467
|
})
|
|
1543
1468
|
]
|
|
1544
1469
|
});
|
|
1545
1470
|
}
|
|
1546
|
-
function
|
|
1547
|
-
let { t: a } =
|
|
1548
|
-
return e ? /* @__PURE__ */
|
|
1471
|
+
function Ft({ explainLoading: e, explainError: t, explainResult: n, useAnalyze: r, aiButton: i }) {
|
|
1472
|
+
let { t: a } = R();
|
|
1473
|
+
return e ? /* @__PURE__ */ q("div", {
|
|
1549
1474
|
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",
|
|
1550
1475
|
children: a(r ? "debug.explainRunningAnalyze" : "debug.explainRunningBasic")
|
|
1551
|
-
}) : t ? /* @__PURE__ */
|
|
1476
|
+
}) : t ? /* @__PURE__ */ J("div", {
|
|
1552
1477
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
1553
1478
|
children: [
|
|
1554
|
-
/* @__PURE__ */
|
|
1479
|
+
/* @__PURE__ */ q("strong", { children: a("debug.explainError") }),
|
|
1555
1480
|
" ",
|
|
1556
1481
|
t.message
|
|
1557
1482
|
]
|
|
1558
|
-
}) : n ? /* @__PURE__ */
|
|
1483
|
+
}) : n ? /* @__PURE__ */ J("div", {
|
|
1559
1484
|
className: "dc:space-y-3",
|
|
1560
1485
|
children: [
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
n.summary.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ q(Pt, { summary: n.summary }),
|
|
1487
|
+
n.summary.usedIndexes.length > 0 && /* @__PURE__ */ J("div", {
|
|
1563
1488
|
className: "dc:text-xs text-dc-text-muted",
|
|
1564
1489
|
children: [
|
|
1565
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ q("strong", { children: a("debug.indexes") }),
|
|
1566
1491
|
" ",
|
|
1567
1492
|
n.summary.usedIndexes.join(", ")
|
|
1568
1493
|
]
|
|
1569
1494
|
}),
|
|
1570
|
-
/* @__PURE__ */
|
|
1495
|
+
/* @__PURE__ */ q(y, {
|
|
1571
1496
|
code: n.raw,
|
|
1572
1497
|
language: "sql",
|
|
1573
1498
|
title: a("debug.executionPlanTitle", { database: n.summary.database }),
|
|
@@ -1579,24 +1504,24 @@ function Pt({ explainLoading: e, explainError: t, explainResult: n, useAnalyze:
|
|
|
1579
1504
|
}
|
|
1580
1505
|
//#endregion
|
|
1581
1506
|
//#region src/client/components/AnalysisBuilder/ExecutionPlanPanel.tsx
|
|
1582
|
-
var
|
|
1583
|
-
let { t: v } =
|
|
1507
|
+
var It = _e(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" }) {
|
|
1508
|
+
let { t: v } = R(), [y, b] = G(!1), [x, S] = G(!1), C = e ? e.sql + (e.params && e.params.length > 0 ? "\n\n-- Parameters:\n" + JSON.stringify(e.params, null, 2) : "") : "", w = () => {
|
|
1584
1509
|
f && i && h && (f(i, h), S(!0));
|
|
1585
1510
|
}, T = () => {
|
|
1586
1511
|
S(!1);
|
|
1587
|
-
}, E = m && i ? /* @__PURE__ */
|
|
1512
|
+
}, E = m && i ? /* @__PURE__ */ q("button", {
|
|
1588
1513
|
onClick: w,
|
|
1589
1514
|
disabled: u,
|
|
1590
1515
|
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",
|
|
1591
|
-
children: u ? /* @__PURE__ */
|
|
1516
|
+
children: u ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("span", {
|
|
1592
1517
|
className: "dc:animate-spin",
|
|
1593
1518
|
children: "⟳"
|
|
1594
|
-
}), v("debug.aiAnalyzing")] }) : /* @__PURE__ */
|
|
1519
|
+
}), v("debug.aiAnalyzing")] }) : /* @__PURE__ */ q(K, { children: `✨ ${v("debug.aiAnalysis")}` })
|
|
1595
1520
|
}) : null;
|
|
1596
|
-
return /* @__PURE__ */
|
|
1521
|
+
return /* @__PURE__ */ J("div", {
|
|
1597
1522
|
className: "dc:space-y-3",
|
|
1598
1523
|
children: [
|
|
1599
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ q(Nt, {
|
|
1600
1525
|
sql: e,
|
|
1601
1526
|
sqlLoading: t,
|
|
1602
1527
|
sqlError: n,
|
|
@@ -1604,37 +1529,37 @@ var Ft = de(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder:
|
|
|
1604
1529
|
formattedSql: C,
|
|
1605
1530
|
title: g,
|
|
1606
1531
|
height: _,
|
|
1607
|
-
headerRight: /* @__PURE__ */
|
|
1532
|
+
headerRight: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("label", {
|
|
1608
1533
|
className: "dc:flex dc:items-center dc:gap-1 dc:text-xs text-dc-text-secondary dc:cursor-pointer",
|
|
1609
|
-
children: [/* @__PURE__ */
|
|
1534
|
+
children: [/* @__PURE__ */ q("input", {
|
|
1610
1535
|
type: "checkbox",
|
|
1611
1536
|
checked: y,
|
|
1612
1537
|
onChange: (e) => b(e.target.checked),
|
|
1613
1538
|
className: "dc:w-3 dc:h-3 dc:rounded border-dc-border text-dc-accent focus:ring-dc-accent"
|
|
1614
1539
|
}), v("debug.explainIncludeTiming")]
|
|
1615
|
-
}), /* @__PURE__ */
|
|
1540
|
+
}), /* @__PURE__ */ q("button", {
|
|
1616
1541
|
onClick: () => c({ analyze: y }),
|
|
1617
1542
|
disabled: a,
|
|
1618
1543
|
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",
|
|
1619
1544
|
children: v(a ? "debug.explainRunning" : "debug.explainPlan")
|
|
1620
1545
|
})] })
|
|
1621
1546
|
}),
|
|
1622
|
-
o && /* @__PURE__ */
|
|
1547
|
+
o && /* @__PURE__ */ q("div", { children: /* @__PURE__ */ q(Ft, {
|
|
1623
1548
|
explainLoading: a,
|
|
1624
1549
|
explainError: s,
|
|
1625
1550
|
explainResult: i,
|
|
1626
1551
|
useAnalyze: y,
|
|
1627
1552
|
aiButton: E
|
|
1628
1553
|
}) }),
|
|
1629
|
-
d && /* @__PURE__ */
|
|
1554
|
+
d && /* @__PURE__ */ J("div", {
|
|
1630
1555
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
|
|
1631
1556
|
children: [
|
|
1632
|
-
/* @__PURE__ */
|
|
1557
|
+
/* @__PURE__ */ q("strong", { children: v("debug.aiAnalysisError") }),
|
|
1633
1558
|
" ",
|
|
1634
1559
|
d.message
|
|
1635
1560
|
]
|
|
1636
1561
|
}),
|
|
1637
|
-
x && l && /* @__PURE__ */
|
|
1562
|
+
x && l && /* @__PURE__ */ q(it, {
|
|
1638
1563
|
analysis: l,
|
|
1639
1564
|
onClose: T
|
|
1640
1565
|
})
|
|
@@ -1643,7 +1568,7 @@ var Ft = de(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder:
|
|
|
1643
1568
|
});
|
|
1644
1569
|
//#endregion
|
|
1645
1570
|
//#region src/client/adapters/queryModeAdapter.ts
|
|
1646
|
-
function
|
|
1571
|
+
function Lt() {
|
|
1647
1572
|
return {
|
|
1648
1573
|
metrics: [],
|
|
1649
1574
|
breakdowns: [],
|
|
@@ -1654,10 +1579,10 @@ function It() {
|
|
|
1654
1579
|
validationError: null
|
|
1655
1580
|
};
|
|
1656
1581
|
}
|
|
1657
|
-
function
|
|
1582
|
+
function Rt(e) {
|
|
1658
1583
|
return e.map((e) => e.field);
|
|
1659
1584
|
}
|
|
1660
|
-
function
|
|
1585
|
+
function zt(e, t) {
|
|
1661
1586
|
let n = [], r = [];
|
|
1662
1587
|
for (let i of e) if (i.isTimeDimension) {
|
|
1663
1588
|
let e = {
|
|
@@ -1665,7 +1590,7 @@ function Rt(e, t) {
|
|
|
1665
1590
|
granularity: i.granularity || "day"
|
|
1666
1591
|
};
|
|
1667
1592
|
if (i.enableComparison) {
|
|
1668
|
-
let n =
|
|
1593
|
+
let n = Ce(i.field, t);
|
|
1669
1594
|
n && (e.compareDateRange = n);
|
|
1670
1595
|
}
|
|
1671
1596
|
r.push(e);
|
|
@@ -1675,31 +1600,31 @@ function Rt(e, t) {
|
|
|
1675
1600
|
timeDimensions: r
|
|
1676
1601
|
};
|
|
1677
1602
|
}
|
|
1678
|
-
function
|
|
1679
|
-
let { dimensions: t, timeDimensions: n } =
|
|
1680
|
-
measures:
|
|
1603
|
+
function Bt(e) {
|
|
1604
|
+
let { dimensions: t, timeDimensions: n } = zt(e.breakdowns, e.filters), r = {
|
|
1605
|
+
measures: Rt(e.metrics),
|
|
1681
1606
|
dimensions: t
|
|
1682
1607
|
};
|
|
1683
1608
|
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), e.limit != null && (r.limit = e.limit), r;
|
|
1684
1609
|
}
|
|
1685
|
-
function
|
|
1610
|
+
function Vt(e) {
|
|
1686
1611
|
return e.map((e, t) => ({
|
|
1687
|
-
id:
|
|
1612
|
+
id: p(),
|
|
1688
1613
|
field: e,
|
|
1689
|
-
label:
|
|
1614
|
+
label: d(t)
|
|
1690
1615
|
}));
|
|
1691
1616
|
}
|
|
1692
|
-
function
|
|
1617
|
+
function Ht(e) {
|
|
1693
1618
|
let t = [];
|
|
1694
1619
|
if (e.dimensions) for (let n of e.dimensions) t.push({
|
|
1695
|
-
id:
|
|
1620
|
+
id: p(),
|
|
1696
1621
|
field: n,
|
|
1697
1622
|
isTimeDimension: !1
|
|
1698
1623
|
});
|
|
1699
1624
|
if (e.timeDimensions) for (let n of e.timeDimensions) {
|
|
1700
1625
|
let e = !!(n.compareDateRange && n.compareDateRange.length > 0);
|
|
1701
1626
|
t.push({
|
|
1702
|
-
id:
|
|
1627
|
+
id: p(),
|
|
1703
1628
|
field: n.dimension,
|
|
1704
1629
|
granularity: n.granularity,
|
|
1705
1630
|
isTimeDimension: !0,
|
|
@@ -1708,10 +1633,10 @@ function Vt(e) {
|
|
|
1708
1633
|
}
|
|
1709
1634
|
return t;
|
|
1710
1635
|
}
|
|
1711
|
-
function
|
|
1636
|
+
function Ut(e) {
|
|
1712
1637
|
return {
|
|
1713
|
-
metrics:
|
|
1714
|
-
breakdowns:
|
|
1638
|
+
metrics: Vt(e.measures || []),
|
|
1639
|
+
breakdowns: Ht(e),
|
|
1715
1640
|
filters: e.filters || [],
|
|
1716
1641
|
order: e.order,
|
|
1717
1642
|
limit: e.limit,
|
|
@@ -1719,14 +1644,14 @@ function Ht(e) {
|
|
|
1719
1644
|
validationError: null
|
|
1720
1645
|
};
|
|
1721
1646
|
}
|
|
1722
|
-
function
|
|
1647
|
+
function Wt(e) {
|
|
1723
1648
|
return typeof e == "object" && !!e && "queries" in e && Array.isArray(e.queries);
|
|
1724
1649
|
}
|
|
1725
1650
|
var X = {
|
|
1726
1651
|
type: "query",
|
|
1727
1652
|
createInitial() {
|
|
1728
1653
|
return {
|
|
1729
|
-
queryStates: [
|
|
1654
|
+
queryStates: [Lt()],
|
|
1730
1655
|
activeQueryIndex: 0,
|
|
1731
1656
|
mergeStrategy: "concat"
|
|
1732
1657
|
};
|
|
@@ -1746,22 +1671,22 @@ var X = {
|
|
|
1746
1671
|
load(e) {
|
|
1747
1672
|
if (e.analysisType !== "query") throw Error(`Cannot load ${e.analysisType} config with query adapter`);
|
|
1748
1673
|
let t = e;
|
|
1749
|
-
if (
|
|
1750
|
-
let e = t.query, n = e.queries.map(
|
|
1751
|
-
return n.length === 0 && n.push(
|
|
1674
|
+
if (Wt(t.query)) {
|
|
1675
|
+
let e = t.query, n = e.queries.map(Ut);
|
|
1676
|
+
return n.length === 0 && n.push(Lt()), {
|
|
1752
1677
|
queryStates: n,
|
|
1753
1678
|
activeQueryIndex: 0,
|
|
1754
1679
|
mergeStrategy: e.mergeStrategy || "concat"
|
|
1755
1680
|
};
|
|
1756
1681
|
}
|
|
1757
1682
|
return {
|
|
1758
|
-
queryStates: [
|
|
1683
|
+
queryStates: [Ut(t.query)],
|
|
1759
1684
|
activeQueryIndex: 0,
|
|
1760
1685
|
mergeStrategy: "concat"
|
|
1761
1686
|
};
|
|
1762
1687
|
},
|
|
1763
1688
|
save(e, t, n) {
|
|
1764
|
-
let r = e.queryStates.map(
|
|
1689
|
+
let r = e.queryStates.map(Bt), i = r.length === 1 && e.mergeStrategy === "concat" ? r[0] : {
|
|
1765
1690
|
queries: r,
|
|
1766
1691
|
mergeStrategy: e.mergeStrategy
|
|
1767
1692
|
};
|
|
@@ -1802,35 +1727,35 @@ var X = {
|
|
|
1802
1727
|
}
|
|
1803
1728
|
};
|
|
1804
1729
|
}
|
|
1805
|
-
}, Z = /* @__PURE__ */ new Map(),
|
|
1806
|
-
function
|
|
1807
|
-
|
|
1730
|
+
}, Z = /* @__PURE__ */ new Map(), Gt = !1;
|
|
1731
|
+
function Kt() {
|
|
1732
|
+
Gt ||= (Z.has("query") || Z.set("query", X), Z.has("funnel") || Z.set("funnel", _), Z.has("flow") || Z.set("flow", w), Z.has("retention") || Z.set("retention", b), !0);
|
|
1808
1733
|
}
|
|
1809
1734
|
var Q = {
|
|
1810
1735
|
register(e) {
|
|
1811
1736
|
Z.has(e.type) && console.warn(`[adapterRegistry] Overwriting existing adapter for type: ${e.type}`), Z.set(e.type, e);
|
|
1812
1737
|
},
|
|
1813
1738
|
get(e) {
|
|
1814
|
-
|
|
1739
|
+
Kt();
|
|
1815
1740
|
let t = Z.get(e);
|
|
1816
1741
|
if (!t) throw Error(`[adapterRegistry] No adapter registered for type: ${e}. Available types: ${Array.from(Z.keys()).join(", ") || "none"}`);
|
|
1817
1742
|
return t;
|
|
1818
1743
|
},
|
|
1819
1744
|
has(e) {
|
|
1820
|
-
return
|
|
1745
|
+
return Kt(), Z.has(e);
|
|
1821
1746
|
},
|
|
1822
1747
|
getRegisteredTypes() {
|
|
1823
|
-
return
|
|
1748
|
+
return Kt(), Array.from(Z.keys());
|
|
1824
1749
|
},
|
|
1825
1750
|
clear() {
|
|
1826
|
-
Z.clear(),
|
|
1751
|
+
Z.clear(), Gt = !1;
|
|
1827
1752
|
}
|
|
1828
|
-
},
|
|
1753
|
+
}, qt = () => ({
|
|
1829
1754
|
analysisType: "query",
|
|
1830
1755
|
charts: {
|
|
1831
1756
|
query: X.getDefaultChartConfig(),
|
|
1832
|
-
funnel:
|
|
1833
|
-
flow:
|
|
1757
|
+
funnel: _.getDefaultChartConfig(),
|
|
1758
|
+
flow: w.getDefaultChartConfig(),
|
|
1834
1759
|
retention: b.getDefaultChartConfig()
|
|
1835
1760
|
},
|
|
1836
1761
|
activeViews: {
|
|
@@ -1841,8 +1766,8 @@ var Q = {
|
|
|
1841
1766
|
},
|
|
1842
1767
|
userManuallySelectedChart: !1,
|
|
1843
1768
|
localPaletteName: "default"
|
|
1844
|
-
}),
|
|
1845
|
-
...
|
|
1769
|
+
}), Jt = (e, t, n) => ({
|
|
1770
|
+
...qt(),
|
|
1846
1771
|
setAnalysisType: (t) => {
|
|
1847
1772
|
e((e) => {
|
|
1848
1773
|
let n = { ...e.charts };
|
|
@@ -2055,22 +1980,22 @@ var Q = {
|
|
|
2055
1980
|
...u
|
|
2056
1981
|
});
|
|
2057
1982
|
}
|
|
2058
|
-
}),
|
|
2059
|
-
queryStates: [
|
|
1983
|
+
}), Yt = () => ({
|
|
1984
|
+
queryStates: [Y()],
|
|
2060
1985
|
activeQueryIndex: 0,
|
|
2061
1986
|
mergeStrategy: "concat"
|
|
2062
|
-
}),
|
|
2063
|
-
...
|
|
1987
|
+
}), Xt = (e, t, n) => ({
|
|
1988
|
+
...Yt(),
|
|
2064
1989
|
setQueryStates: (t) => e({ queryStates: t }),
|
|
2065
1990
|
updateQueryState: (t, n) => e((e) => {
|
|
2066
1991
|
let r = [...e.queryStates];
|
|
2067
|
-
return r[t] = n(r[t] ||
|
|
1992
|
+
return r[t] = n(r[t] || Y()), { queryStates: r };
|
|
2068
1993
|
}),
|
|
2069
1994
|
setActiveQueryIndex: (t) => e({ activeQueryIndex: t }),
|
|
2070
1995
|
setMergeStrategy: (t) => e({ mergeStrategy: t }),
|
|
2071
1996
|
addQuery: () => e((e) => {
|
|
2072
|
-
let t = e.queryStates[e.activeQueryIndex] ||
|
|
2073
|
-
...
|
|
1997
|
+
let t = e.queryStates[e.activeQueryIndex] || Y(), n = {
|
|
1998
|
+
...Y(),
|
|
2074
1999
|
metrics: [...t.metrics],
|
|
2075
2000
|
breakdowns: [...t.breakdowns],
|
|
2076
2001
|
filters: [...t.filters]
|
|
@@ -2089,10 +2014,10 @@ var Q = {
|
|
|
2089
2014
|
};
|
|
2090
2015
|
}),
|
|
2091
2016
|
addMetric: (t, n) => e((e) => {
|
|
2092
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2093
|
-
id:
|
|
2017
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = {
|
|
2018
|
+
id: p(),
|
|
2094
2019
|
field: t,
|
|
2095
|
-
label: n ||
|
|
2020
|
+
label: n || d(a.metrics.length)
|
|
2096
2021
|
};
|
|
2097
2022
|
return i[r] = {
|
|
2098
2023
|
...a,
|
|
@@ -2100,7 +2025,7 @@ var Q = {
|
|
|
2100
2025
|
}, { queryStates: i };
|
|
2101
2026
|
}),
|
|
2102
2027
|
removeMetric: (t) => e((e) => {
|
|
2103
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2028
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.metrics.find((e) => e.id === t)?.field, o = i.metrics.filter((e) => e.id !== t), s = i.order;
|
|
2104
2029
|
return a && s && s[a] && (s = { ...s }, delete s[a], Object.keys(s).length === 0 && (s = void 0)), r[n] = {
|
|
2105
2030
|
...i,
|
|
2106
2031
|
metrics: o,
|
|
@@ -2108,16 +2033,16 @@ var Q = {
|
|
|
2108
2033
|
}, { queryStates: r };
|
|
2109
2034
|
}),
|
|
2110
2035
|
toggleMetric: (t) => e((e) => {
|
|
2111
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2036
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.metrics.findIndex((e) => e.field === t);
|
|
2112
2037
|
if (a >= 0) r[n] = {
|
|
2113
2038
|
...i,
|
|
2114
2039
|
metrics: i.metrics.filter((e, t) => t !== a)
|
|
2115
2040
|
};
|
|
2116
2041
|
else {
|
|
2117
2042
|
let e = {
|
|
2118
|
-
id:
|
|
2043
|
+
id: p(),
|
|
2119
2044
|
field: t,
|
|
2120
|
-
label:
|
|
2045
|
+
label: d(i.metrics.length)
|
|
2121
2046
|
};
|
|
2122
2047
|
r[n] = {
|
|
2123
2048
|
...i,
|
|
@@ -2127,17 +2052,17 @@ var Q = {
|
|
|
2127
2052
|
return { queryStates: r };
|
|
2128
2053
|
}),
|
|
2129
2054
|
reorderMetrics: (t, n) => e((e) => {
|
|
2130
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2055
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = [...a.metrics], [s] = o.splice(t, 1);
|
|
2131
2056
|
return o.splice(n, 0, s), i[r] = {
|
|
2132
2057
|
...a,
|
|
2133
2058
|
metrics: o
|
|
2134
2059
|
}, { queryStates: i };
|
|
2135
2060
|
}),
|
|
2136
2061
|
addBreakdown: (t, n, r) => e((e) => {
|
|
2137
|
-
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] ||
|
|
2062
|
+
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || Y();
|
|
2138
2063
|
if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
|
|
2139
2064
|
let s = {
|
|
2140
|
-
id:
|
|
2065
|
+
id: p(),
|
|
2141
2066
|
field: t,
|
|
2142
2067
|
isTimeDimension: n,
|
|
2143
2068
|
granularity: n ? r || "month" : void 0
|
|
@@ -2148,7 +2073,7 @@ var Q = {
|
|
|
2148
2073
|
}, { queryStates: a };
|
|
2149
2074
|
}),
|
|
2150
2075
|
removeBreakdown: (t) => e((e) => {
|
|
2151
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2076
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.breakdowns.find((e) => e.id === t)?.field, o = i.breakdowns.filter((e) => e.id !== t), s = i.order;
|
|
2152
2077
|
return a && s && s[a] && (s = { ...s }, delete s[a], Object.keys(s).length === 0 && (s = void 0)), r[n] = {
|
|
2153
2078
|
...i,
|
|
2154
2079
|
breakdowns: o,
|
|
@@ -2156,7 +2081,7 @@ var Q = {
|
|
|
2156
2081
|
}, { queryStates: r };
|
|
2157
2082
|
}),
|
|
2158
2083
|
toggleBreakdown: (t, n, r) => e((e) => {
|
|
2159
|
-
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] ||
|
|
2084
|
+
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || Y(), s = o.breakdowns.findIndex((e) => e.field === t);
|
|
2160
2085
|
if (s >= 0) a[i] = {
|
|
2161
2086
|
...o,
|
|
2162
2087
|
breakdowns: o.breakdowns.filter((e, t) => t !== s)
|
|
@@ -2164,7 +2089,7 @@ var Q = {
|
|
|
2164
2089
|
else {
|
|
2165
2090
|
if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
|
|
2166
2091
|
let s = {
|
|
2167
|
-
id:
|
|
2092
|
+
id: p(),
|
|
2168
2093
|
field: t,
|
|
2169
2094
|
isTimeDimension: n,
|
|
2170
2095
|
granularity: n ? r || "month" : void 0
|
|
@@ -2212,7 +2137,7 @@ var Q = {
|
|
|
2212
2137
|
member: l.field,
|
|
2213
2138
|
operator: "inDateRange",
|
|
2214
2139
|
values: [],
|
|
2215
|
-
dateRange:
|
|
2140
|
+
dateRange: N("last_n_months", 3)
|
|
2216
2141
|
};
|
|
2217
2142
|
s[c] = {
|
|
2218
2143
|
...s[c],
|
|
@@ -2234,7 +2159,7 @@ var Q = {
|
|
|
2234
2159
|
return f;
|
|
2235
2160
|
}),
|
|
2236
2161
|
reorderBreakdowns: (t, n) => e((e) => {
|
|
2237
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2162
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = [...a.breakdowns], [s] = o.splice(t, 1);
|
|
2238
2163
|
return o.splice(n, 0, s), i[r] = {
|
|
2239
2164
|
...a,
|
|
2240
2165
|
breakdowns: o
|
|
@@ -2248,7 +2173,7 @@ var Q = {
|
|
|
2248
2173
|
}, { queryStates: r };
|
|
2249
2174
|
}),
|
|
2250
2175
|
dropFieldToFilter: (t) => e((e) => {
|
|
2251
|
-
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] ||
|
|
2176
|
+
let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.filters || [];
|
|
2252
2177
|
if (a.some((e) => "member" in e && e.member === t)) return e;
|
|
2253
2178
|
let o = {
|
|
2254
2179
|
member: t,
|
|
@@ -2272,7 +2197,7 @@ var Q = {
|
|
|
2272
2197
|
}, { queryStates: r };
|
|
2273
2198
|
}),
|
|
2274
2199
|
setOrder: (t, n) => e((e) => {
|
|
2275
|
-
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] ||
|
|
2200
|
+
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = { ...a.order || {} };
|
|
2276
2201
|
return n === null ? delete o[t] : o[t] = n, i[r] = {
|
|
2277
2202
|
...a,
|
|
2278
2203
|
order: Object.keys(o).length > 0 ? o : void 0
|
|
@@ -2287,7 +2212,7 @@ var Q = {
|
|
|
2287
2212
|
}),
|
|
2288
2213
|
getCurrentState: () => {
|
|
2289
2214
|
let e = t();
|
|
2290
|
-
return e.queryStates[e.activeQueryIndex] ||
|
|
2215
|
+
return e.queryStates[e.activeQueryIndex] || Y();
|
|
2291
2216
|
},
|
|
2292
2217
|
getMergeKeys: () => {
|
|
2293
2218
|
let e = t();
|
|
@@ -2300,12 +2225,12 @@ var Q = {
|
|
|
2300
2225
|
return e.queryStates.length <= 1 ? !1 : e.queryStates.filter((e) => e.metrics.length > 0 || e.breakdowns.length > 0).length > 1;
|
|
2301
2226
|
},
|
|
2302
2227
|
buildCurrentQuery: () => {
|
|
2303
|
-
let e = t(), n = e.queryStates[e.activeQueryIndex] ||
|
|
2304
|
-
return
|
|
2228
|
+
let e = t(), n = e.queryStates[e.activeQueryIndex] || Y();
|
|
2229
|
+
return Te(n.metrics, n.breakdowns, n.filters, n.order, !1, n.limit);
|
|
2305
2230
|
},
|
|
2306
2231
|
buildAllQueries: () => {
|
|
2307
2232
|
let e = t(), n = e.queryStates[0]?.breakdowns || [];
|
|
2308
|
-
return e.queryStates.map((t, r) =>
|
|
2233
|
+
return e.queryStates.map((t, r) => Te(t.metrics, e.mergeStrategy === "merge" && r > 0 ? n : t.breakdowns, t.filters, t.order, !1, t.limit));
|
|
2309
2234
|
},
|
|
2310
2235
|
buildMultiQueryConfig: () => {
|
|
2311
2236
|
let e = t();
|
|
@@ -2318,18 +2243,18 @@ var Q = {
|
|
|
2318
2243
|
queryLabels: n.map((e, t) => `Q${t + 1}`)
|
|
2319
2244
|
};
|
|
2320
2245
|
}
|
|
2321
|
-
}),
|
|
2246
|
+
}), Zt = () => ({
|
|
2322
2247
|
funnelCube: null,
|
|
2323
2248
|
funnelSteps: [],
|
|
2324
2249
|
activeFunnelStepIndex: 0,
|
|
2325
2250
|
funnelTimeDimension: null,
|
|
2326
2251
|
funnelBindingKey: null,
|
|
2327
2252
|
stepTimeToConvert: []
|
|
2328
|
-
}),
|
|
2329
|
-
...
|
|
2253
|
+
}), Qt = (e, t, n) => ({
|
|
2254
|
+
...Zt(),
|
|
2330
2255
|
addFunnelStep: () => e((e) => {
|
|
2331
2256
|
let t = e.funnelSteps[e.funnelSteps.length - 1], n = {
|
|
2332
|
-
id:
|
|
2257
|
+
id: p(),
|
|
2333
2258
|
name: `Step ${e.funnelSteps.length + 1}`,
|
|
2334
2259
|
cube: e.funnelCube || "",
|
|
2335
2260
|
filters: t?.filters ? JSON.parse(JSON.stringify(t.filters)) : [],
|
|
@@ -2394,7 +2319,7 @@ var Q = {
|
|
|
2394
2319
|
let e = t();
|
|
2395
2320
|
return e.analysisType !== "funnel" || !e.funnelBindingKey || !e.funnelTimeDimension || e.funnelSteps.length < 2 ? !1 : e.funnelSteps.filter((e) => e.cube && e.name).length >= 2;
|
|
2396
2321
|
}
|
|
2397
|
-
}),
|
|
2322
|
+
}), $t = () => ({
|
|
2398
2323
|
flowCube: null,
|
|
2399
2324
|
flowBindingKey: null,
|
|
2400
2325
|
flowTimeDimension: null,
|
|
@@ -2406,8 +2331,8 @@ var Q = {
|
|
|
2406
2331
|
stepsAfter: 3,
|
|
2407
2332
|
eventDimension: null,
|
|
2408
2333
|
joinStrategy: "auto"
|
|
2409
|
-
}),
|
|
2410
|
-
|
|
2334
|
+
}), en = (e, t, n) => ({
|
|
2335
|
+
...$t(),
|
|
2411
2336
|
setFlowCube: (t) => e(() => ({
|
|
2412
2337
|
flowCube: t,
|
|
2413
2338
|
flowBindingKey: null,
|
|
@@ -2477,8 +2402,8 @@ var Q = {
|
|
|
2477
2402
|
joinStrategy: e.joinStrategy
|
|
2478
2403
|
} };
|
|
2479
2404
|
}
|
|
2480
|
-
}),
|
|
2481
|
-
...
|
|
2405
|
+
}), tn = () => ({ ...O }), nn = (e, t, n) => ({
|
|
2406
|
+
...tn(),
|
|
2482
2407
|
setRetentionCube: (t) => e(() => ({
|
|
2483
2408
|
retentionCube: t,
|
|
2484
2409
|
retentionTimeDimension: null,
|
|
@@ -2553,22 +2478,22 @@ var Q = {
|
|
|
2553
2478
|
warnings: r
|
|
2554
2479
|
};
|
|
2555
2480
|
}
|
|
2556
|
-
}),
|
|
2481
|
+
}), rn = {
|
|
2557
2482
|
isOpen: !1,
|
|
2558
2483
|
userPrompt: "",
|
|
2559
2484
|
isGenerating: !1,
|
|
2560
2485
|
error: null,
|
|
2561
2486
|
hasGeneratedQuery: !1,
|
|
2562
2487
|
previousState: null
|
|
2563
|
-
},
|
|
2488
|
+
}, an = () => ({
|
|
2564
2489
|
activeTab: "query",
|
|
2565
2490
|
activeView: "chart",
|
|
2566
2491
|
displayLimit: 100,
|
|
2567
2492
|
showFieldModal: !1,
|
|
2568
2493
|
fieldModalMode: "metrics",
|
|
2569
|
-
aiState:
|
|
2570
|
-
}),
|
|
2571
|
-
...
|
|
2494
|
+
aiState: rn
|
|
2495
|
+
}), on = (e, t, n) => ({
|
|
2496
|
+
...an(),
|
|
2572
2497
|
setActiveTab: (t) => e({ activeTab: t }),
|
|
2573
2498
|
setActiveView: (t) => e((e) => ({
|
|
2574
2499
|
activeView: t,
|
|
@@ -2638,7 +2563,7 @@ var Q = {
|
|
|
2638
2563
|
if (!t) return e;
|
|
2639
2564
|
let n = e.activeQueryIndex, r = [...e.queryStates];
|
|
2640
2565
|
return r[n] = {
|
|
2641
|
-
...r[n] ||
|
|
2566
|
+
...r[n] || Y(),
|
|
2642
2567
|
metrics: t.metrics,
|
|
2643
2568
|
breakdowns: t.breakdowns,
|
|
2644
2569
|
filters: t.filters
|
|
@@ -2652,19 +2577,19 @@ var Q = {
|
|
|
2652
2577
|
displayConfig: t.displayConfig
|
|
2653
2578
|
}
|
|
2654
2579
|
},
|
|
2655
|
-
aiState: { ...
|
|
2580
|
+
aiState: { ...rn }
|
|
2656
2581
|
};
|
|
2657
2582
|
})
|
|
2658
2583
|
});
|
|
2659
2584
|
//#endregion
|
|
2660
2585
|
//#region src/client/stores/optionsToAnalysisConfig.ts
|
|
2661
|
-
function
|
|
2586
|
+
function sn(e) {
|
|
2662
2587
|
let t = e.filters ? [...e.filters] : [], n = e.timeDimensions || [], r = [...(e.dimensions || []).map((e) => ({
|
|
2663
|
-
id:
|
|
2588
|
+
id: p(),
|
|
2664
2589
|
field: e,
|
|
2665
2590
|
isTimeDimension: !1
|
|
2666
2591
|
})), ...n.map((e) => ({
|
|
2667
|
-
id:
|
|
2592
|
+
id: p(),
|
|
2668
2593
|
field: e.dimension,
|
|
2669
2594
|
granularity: e.granularity,
|
|
2670
2595
|
isTimeDimension: !0,
|
|
@@ -2690,21 +2615,21 @@ function on(e) {
|
|
|
2690
2615
|
}
|
|
2691
2616
|
}
|
|
2692
2617
|
return {
|
|
2693
|
-
...
|
|
2618
|
+
...Y(),
|
|
2694
2619
|
metrics: (e.measures || []).map((e, t) => ({
|
|
2695
|
-
id:
|
|
2620
|
+
id: p(),
|
|
2696
2621
|
field: e,
|
|
2697
|
-
label:
|
|
2622
|
+
label: d(t)
|
|
2698
2623
|
})),
|
|
2699
2624
|
breakdowns: r,
|
|
2700
2625
|
filters: i,
|
|
2701
2626
|
order: e.order
|
|
2702
2627
|
};
|
|
2703
2628
|
}
|
|
2704
|
-
function
|
|
2629
|
+
function cn(e) {
|
|
2705
2630
|
return "queries" in e && Array.isArray(e.queries);
|
|
2706
2631
|
}
|
|
2707
|
-
function
|
|
2632
|
+
function ln(e, t) {
|
|
2708
2633
|
let n = e.getDefaultChartConfig();
|
|
2709
2634
|
return {
|
|
2710
2635
|
chartType: t?.chartType || n.chartType,
|
|
@@ -2712,22 +2637,22 @@ function cn(e, t) {
|
|
|
2712
2637
|
displayConfig: t?.displayConfig || n.displayConfig
|
|
2713
2638
|
};
|
|
2714
2639
|
}
|
|
2715
|
-
function
|
|
2640
|
+
function un(e) {
|
|
2716
2641
|
return e.initialActiveView || "chart";
|
|
2717
2642
|
}
|
|
2718
|
-
function
|
|
2719
|
-
let t =
|
|
2720
|
-
return
|
|
2643
|
+
function dn(e) {
|
|
2644
|
+
let t = ln(_, e.initialChartConfig), n = e.initialFunnelState ?? {};
|
|
2645
|
+
return _.save({
|
|
2721
2646
|
funnelCube: n.funnelCube ?? null,
|
|
2722
2647
|
funnelSteps: n.funnelSteps || [],
|
|
2723
2648
|
activeFunnelStepIndex: 0,
|
|
2724
2649
|
funnelTimeDimension: n.funnelTimeDimension ?? null,
|
|
2725
2650
|
funnelBindingKey: n.funnelBindingKey ?? null
|
|
2726
|
-
}, { funnel: t },
|
|
2651
|
+
}, { funnel: t }, un(e));
|
|
2727
2652
|
}
|
|
2728
|
-
function
|
|
2729
|
-
let t =
|
|
2730
|
-
return
|
|
2653
|
+
function fn(e) {
|
|
2654
|
+
let t = ln(w, e.initialChartConfig), n = e.initialFlowState ?? {};
|
|
2655
|
+
return w.save({
|
|
2731
2656
|
flowCube: n.flowCube ?? null,
|
|
2732
2657
|
flowBindingKey: n.flowBindingKey ?? null,
|
|
2733
2658
|
flowTimeDimension: n.flowTimeDimension ?? null,
|
|
@@ -2739,10 +2664,10 @@ function dn(e) {
|
|
|
2739
2664
|
stepsAfter: n.stepsAfter ?? 3,
|
|
2740
2665
|
eventDimension: n.eventDimension ?? null,
|
|
2741
2666
|
joinStrategy: n.joinStrategy ?? "auto"
|
|
2742
|
-
}, { flow: t },
|
|
2667
|
+
}, { flow: t }, un(e));
|
|
2743
2668
|
}
|
|
2744
|
-
function
|
|
2745
|
-
let t =
|
|
2669
|
+
function pn(e) {
|
|
2670
|
+
let t = ln(b, e.initialChartConfig), n = e.initialRetentionState ?? {}, r = k(ee);
|
|
2746
2671
|
return b.save({
|
|
2747
2672
|
retentionCube: n.retentionCube ?? null,
|
|
2748
2673
|
retentionBindingKey: n.retentionBindingKey ?? null,
|
|
@@ -2754,51 +2679,51 @@ function fn(e) {
|
|
|
2754
2679
|
retentionViewGranularity: n.retentionViewGranularity ?? "week",
|
|
2755
2680
|
retentionPeriods: n.retentionPeriods ?? 12,
|
|
2756
2681
|
retentionType: n.retentionType ?? "classic"
|
|
2757
|
-
}, { retention: t },
|
|
2682
|
+
}, { retention: t }, un(e));
|
|
2758
2683
|
}
|
|
2759
|
-
function
|
|
2684
|
+
function mn(e, t) {
|
|
2760
2685
|
let n, r = "concat";
|
|
2761
|
-
|
|
2762
|
-
let i =
|
|
2686
|
+
cn(t) ? (n = t.queries.map(sn), t.mergeStrategy && (r = t.mergeStrategy)) : n = [sn(t)];
|
|
2687
|
+
let i = ln(X, e.initialChartConfig);
|
|
2763
2688
|
return X.save({
|
|
2764
2689
|
queryStates: n,
|
|
2765
2690
|
activeQueryIndex: 0,
|
|
2766
2691
|
mergeStrategy: r
|
|
2767
|
-
}, { query: i },
|
|
2692
|
+
}, { query: i }, un(e));
|
|
2768
2693
|
}
|
|
2769
|
-
function
|
|
2770
|
-
let t =
|
|
2694
|
+
function hn(e) {
|
|
2695
|
+
let t = ln(X, e.initialChartConfig);
|
|
2771
2696
|
return X.save({
|
|
2772
|
-
queryStates: [
|
|
2697
|
+
queryStates: [Y()],
|
|
2773
2698
|
activeQueryIndex: 0,
|
|
2774
2699
|
mergeStrategy: "concat"
|
|
2775
|
-
}, { query: t },
|
|
2700
|
+
}, { query: t }, un(e));
|
|
2776
2701
|
}
|
|
2777
|
-
function
|
|
2702
|
+
function gn(e) {
|
|
2778
2703
|
return X.save({
|
|
2779
|
-
queryStates: [
|
|
2704
|
+
queryStates: [Y()],
|
|
2780
2705
|
activeQueryIndex: 0,
|
|
2781
2706
|
mergeStrategy: "concat"
|
|
2782
2707
|
}, { query: X.getDefaultChartConfig() }, e.initialActiveView);
|
|
2783
2708
|
}
|
|
2784
|
-
function
|
|
2785
|
-
return e.initialAnalysisType === "funnel" && e.initialFunnelState ?
|
|
2709
|
+
function _n(e) {
|
|
2710
|
+
return e.initialAnalysisType === "funnel" && e.initialFunnelState ? dn(e) : e.initialAnalysisType === "flow" && e.initialFlowState ? fn(e) : e.initialAnalysisType === "retention" && e.initialRetentionState ? pn(e) : e.initialQuery ? mn(e, e.initialQuery) : e.initialChartConfig ? hn(e) : e.initialActiveView ? gn(e) : null;
|
|
2786
2711
|
}
|
|
2787
2712
|
//#endregion
|
|
2788
2713
|
//#region src/client/stores/analysisBuilderStore.tsx
|
|
2789
|
-
function
|
|
2714
|
+
function vn(e, t) {
|
|
2790
2715
|
return {
|
|
2791
2716
|
reset: () => {
|
|
2792
2717
|
e({
|
|
2793
|
-
...
|
|
2794
|
-
...
|
|
2795
|
-
...
|
|
2796
|
-
|
|
2797
|
-
...
|
|
2718
|
+
...qt(),
|
|
2719
|
+
...Yt(),
|
|
2720
|
+
...Zt(),
|
|
2721
|
+
...$t(),
|
|
2722
|
+
...tn(),
|
|
2798
2723
|
charts: {
|
|
2799
2724
|
query: X.getDefaultChartConfig(),
|
|
2800
|
-
funnel:
|
|
2801
|
-
flow:
|
|
2725
|
+
funnel: _.getDefaultChartConfig(),
|
|
2726
|
+
flow: w.getDefaultChartConfig(),
|
|
2802
2727
|
retention: b.getDefaultChartConfig()
|
|
2803
2728
|
},
|
|
2804
2729
|
activeViews: {
|
|
@@ -2812,28 +2737,28 @@ function _n(e, t) {
|
|
|
2812
2737
|
clearCurrentMode: () => e((e) => {
|
|
2813
2738
|
switch (e.analysisType) {
|
|
2814
2739
|
case "funnel": return {
|
|
2815
|
-
...
|
|
2740
|
+
...Zt(),
|
|
2816
2741
|
charts: {
|
|
2817
2742
|
...e.charts,
|
|
2818
|
-
funnel:
|
|
2743
|
+
funnel: _.getDefaultChartConfig()
|
|
2819
2744
|
}
|
|
2820
2745
|
};
|
|
2821
2746
|
case "flow": return {
|
|
2822
|
-
|
|
2747
|
+
...$t(),
|
|
2823
2748
|
charts: {
|
|
2824
2749
|
...e.charts,
|
|
2825
|
-
flow:
|
|
2750
|
+
flow: w.getDefaultChartConfig()
|
|
2826
2751
|
}
|
|
2827
2752
|
};
|
|
2828
2753
|
case "retention": return {
|
|
2829
|
-
...
|
|
2754
|
+
...tn(),
|
|
2830
2755
|
charts: {
|
|
2831
2756
|
...e.charts,
|
|
2832
2757
|
retention: b.getDefaultChartConfig()
|
|
2833
2758
|
}
|
|
2834
2759
|
};
|
|
2835
2760
|
default: return {
|
|
2836
|
-
...
|
|
2761
|
+
...Yt(),
|
|
2837
2762
|
userManuallySelectedChart: !1,
|
|
2838
2763
|
charts: {
|
|
2839
2764
|
...e.charts,
|
|
@@ -2844,7 +2769,7 @@ function _n(e, t) {
|
|
|
2844
2769
|
}),
|
|
2845
2770
|
clearQuery: () => e((e) => {
|
|
2846
2771
|
let t = [...e.queryStates];
|
|
2847
|
-
return t[e.activeQueryIndex] =
|
|
2772
|
+
return t[e.activeQueryIndex] = Y(), {
|
|
2848
2773
|
queryStates: t,
|
|
2849
2774
|
userManuallySelectedChart: !1,
|
|
2850
2775
|
charts: {
|
|
@@ -2859,15 +2784,15 @@ function _n(e, t) {
|
|
|
2859
2784
|
}
|
|
2860
2785
|
};
|
|
2861
2786
|
}
|
|
2862
|
-
function
|
|
2863
|
-
let r =
|
|
2864
|
-
...
|
|
2865
|
-
...
|
|
2866
|
-
...
|
|
2867
|
-
|
|
2868
|
-
...
|
|
2869
|
-
...
|
|
2870
|
-
...
|
|
2787
|
+
function yn(n = {}) {
|
|
2788
|
+
let r = _n(n), o = (e, t, n) => ({
|
|
2789
|
+
...Jt(e, t, n),
|
|
2790
|
+
...Xt(e, t, n),
|
|
2791
|
+
...Qt(e, t, n),
|
|
2792
|
+
...en(e, t, n),
|
|
2793
|
+
...nn(e, t, n),
|
|
2794
|
+
...on(e, t, n),
|
|
2795
|
+
...vn(e, t)
|
|
2871
2796
|
});
|
|
2872
2797
|
if (n.disableLocalStorage) {
|
|
2873
2798
|
let t = a()(i(e(o), { name: "AnalysisBuilderStore (no-persist)" }));
|
|
@@ -2876,10 +2801,10 @@ function vn(n = {}) {
|
|
|
2876
2801
|
return a()(i(e(t(o, {
|
|
2877
2802
|
name: n.storageKey || "drizzle-cube-analysis-builder-v3",
|
|
2878
2803
|
partialize: (e) => e.saveWorkspace(),
|
|
2879
|
-
merge: (e, t) => e &&
|
|
2804
|
+
merge: (e, t) => e && g(e) ? {
|
|
2880
2805
|
...t,
|
|
2881
2806
|
_persistedWorkspace: e
|
|
2882
|
-
} : e &&
|
|
2807
|
+
} : e && D(e) ? {
|
|
2883
2808
|
...t,
|
|
2884
2809
|
_persistedConfig: e
|
|
2885
2810
|
} : r ? {
|
|
@@ -2902,10 +2827,10 @@ function vn(n = {}) {
|
|
|
2902
2827
|
}
|
|
2903
2828
|
})), { name: "AnalysisBuilderStore" }));
|
|
2904
2829
|
}
|
|
2905
|
-
var
|
|
2906
|
-
function
|
|
2907
|
-
let u =
|
|
2908
|
-
return u.current ||=
|
|
2830
|
+
var bn = ge(null);
|
|
2831
|
+
function xn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalStorage: r, storageKey: i, initialAnalysisType: a, initialFunnelState: o, initialFlowState: s, initialRetentionState: c, initialActiveView: l }) {
|
|
2832
|
+
let u = W(null);
|
|
2833
|
+
return u.current ||= yn({
|
|
2909
2834
|
initialQuery: t,
|
|
2910
2835
|
initialChartConfig: n,
|
|
2911
2836
|
disableLocalStorage: r,
|
|
@@ -2915,22 +2840,22 @@ function bn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalS
|
|
|
2915
2840
|
initialFlowState: s,
|
|
2916
2841
|
initialRetentionState: c,
|
|
2917
2842
|
initialActiveView: l
|
|
2918
|
-
}), /* @__PURE__ */
|
|
2843
|
+
}), /* @__PURE__ */ q(bn.Provider, {
|
|
2919
2844
|
value: u.current,
|
|
2920
2845
|
children: e
|
|
2921
2846
|
});
|
|
2922
2847
|
}
|
|
2923
2848
|
function $(e) {
|
|
2924
|
-
let t =
|
|
2849
|
+
let t = ve(bn);
|
|
2925
2850
|
if (!t) throw Error("useAnalysisBuilderStore must be used within AnalysisBuilderStoreProvider");
|
|
2926
2851
|
return r(t, e);
|
|
2927
2852
|
}
|
|
2928
|
-
function
|
|
2929
|
-
let e =
|
|
2853
|
+
function Sn() {
|
|
2854
|
+
let e = ve(bn);
|
|
2930
2855
|
if (!e) throw Error("useAnalysisBuilderStoreApi must be used within AnalysisBuilderStoreProvider");
|
|
2931
2856
|
return e;
|
|
2932
2857
|
}
|
|
2933
|
-
var
|
|
2858
|
+
var Cn = (e) => e.queryStates[e.activeQueryIndex] || Y(), wn = (e) => Cn(e).metrics, Tn = (e) => Cn(e).breakdowns, En = (e) => Cn(e).filters, Dn = (e) => {
|
|
2934
2859
|
let t = e.charts[e.analysisType];
|
|
2935
2860
|
return t ? {
|
|
2936
2861
|
chartType: t.chartType,
|
|
@@ -2945,18 +2870,18 @@ var Sn = (e) => e.queryStates[e.activeQueryIndex] || J(), Cn = (e) => Sn(e).metr
|
|
|
2945
2870
|
showTooltip: !0
|
|
2946
2871
|
}
|
|
2947
2872
|
};
|
|
2948
|
-
},
|
|
2873
|
+
}, On = (e) => ({
|
|
2949
2874
|
activeTab: e.activeTab,
|
|
2950
2875
|
activeView: e.activeView,
|
|
2951
2876
|
displayLimit: e.displayLimit,
|
|
2952
2877
|
showFieldModal: e.showFieldModal,
|
|
2953
2878
|
fieldModalMode: e.fieldModalMode
|
|
2954
|
-
}),
|
|
2879
|
+
}), kn = (e) => ({
|
|
2955
2880
|
queryStates: e.queryStates,
|
|
2956
2881
|
activeQueryIndex: e.activeQueryIndex,
|
|
2957
2882
|
mergeStrategy: e.mergeStrategy,
|
|
2958
2883
|
isMultiQueryMode: e.analysisType === "query" && e.queryStates.length > 1
|
|
2959
|
-
}),
|
|
2884
|
+
}), An = (e) => ({
|
|
2960
2885
|
funnelCube: e.funnelCube,
|
|
2961
2886
|
funnelSteps: e.funnelSteps,
|
|
2962
2887
|
activeFunnelStepIndex: e.activeFunnelStepIndex,
|
|
@@ -2967,16 +2892,16 @@ var Sn = (e) => e.queryStates[e.activeQueryIndex] || J(), Cn = (e) => Sn(e).metr
|
|
|
2967
2892
|
});
|
|
2968
2893
|
//#endregion
|
|
2969
2894
|
//#region src/client/utils/multiQueryValidation.ts
|
|
2970
|
-
function
|
|
2895
|
+
function jn(e) {
|
|
2971
2896
|
return e.timeDimensions || [];
|
|
2972
2897
|
}
|
|
2973
|
-
function
|
|
2898
|
+
function Mn(e) {
|
|
2974
2899
|
let t = [];
|
|
2975
2900
|
if (e.length < 2) return t;
|
|
2976
|
-
let n =
|
|
2901
|
+
let n = jn(e[0]);
|
|
2977
2902
|
if (n.length === 0) return t;
|
|
2978
2903
|
for (let r = 1; r < e.length; r++) {
|
|
2979
|
-
let i =
|
|
2904
|
+
let i = jn(e[r]);
|
|
2980
2905
|
if (i.length === 0 && n.length > 0) {
|
|
2981
2906
|
t.push({
|
|
2982
2907
|
type: "missing_time_dimension",
|
|
@@ -3002,7 +2927,7 @@ function jn(e) {
|
|
|
3002
2927
|
}
|
|
3003
2928
|
return t;
|
|
3004
2929
|
}
|
|
3005
|
-
function
|
|
2930
|
+
function Nn(e, t) {
|
|
3006
2931
|
let n = [];
|
|
3007
2932
|
if (e.length < 2 || t.length === 0) return n;
|
|
3008
2933
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -3016,7 +2941,7 @@ function Mn(e, t) {
|
|
|
3016
2941
|
}
|
|
3017
2942
|
return n;
|
|
3018
2943
|
}
|
|
3019
|
-
function
|
|
2944
|
+
function Pn(e) {
|
|
3020
2945
|
let t = [];
|
|
3021
2946
|
if (e.length < 2) return t;
|
|
3022
2947
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -3035,7 +2960,7 @@ function Nn(e) {
|
|
|
3035
2960
|
affectedMeasures: r
|
|
3036
2961
|
}), t;
|
|
3037
2962
|
}
|
|
3038
|
-
function
|
|
2963
|
+
function Fn(e) {
|
|
3039
2964
|
let t = [];
|
|
3040
2965
|
if (e.length < 2) return t;
|
|
3041
2966
|
let n = e.map((e) => e.timeDimensions?.[0]?.dateRange);
|
|
@@ -3045,46 +2970,46 @@ function Pn(e) {
|
|
|
3045
2970
|
message: "Queries have different date ranges - some data points may be missing in merged results"
|
|
3046
2971
|
}), t;
|
|
3047
2972
|
}
|
|
3048
|
-
function
|
|
2973
|
+
function In(e, t, n = []) {
|
|
3049
2974
|
let r = [], i = [];
|
|
3050
2975
|
return e.length < 2 ? {
|
|
3051
2976
|
isValid: !0,
|
|
3052
2977
|
errors: r,
|
|
3053
2978
|
warnings: i
|
|
3054
|
-
} : (i.push(...
|
|
2979
|
+
} : (i.push(...Pn(e)), i.push(...Fn(e)), t === "merge" && (r.push(...Mn(e)), n.length > 0 && r.push(...Nn(e, n))), {
|
|
3055
2980
|
isValid: r.length === 0,
|
|
3056
2981
|
errors: r,
|
|
3057
2982
|
warnings: i
|
|
3058
2983
|
});
|
|
3059
2984
|
}
|
|
3060
|
-
function
|
|
2985
|
+
function Ln(e) {
|
|
3061
2986
|
return (e.measures?.length || 0) + (e.dimensions?.length || 0) + (e.timeDimensions?.length || 0);
|
|
3062
2987
|
}
|
|
3063
|
-
function
|
|
3064
|
-
return e.filter((e) =>
|
|
2988
|
+
function Rn(e) {
|
|
2989
|
+
return e.filter((e) => Ln(e) > 0).length >= 2;
|
|
3065
2990
|
}
|
|
3066
|
-
function
|
|
2991
|
+
function zn(e, t) {
|
|
3067
2992
|
return `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
3068
2993
|
}
|
|
3069
|
-
function
|
|
2994
|
+
function Bn(e) {
|
|
3070
2995
|
if (e.isValid && e.warnings.length === 0) return "Configuration is valid";
|
|
3071
2996
|
let t = [];
|
|
3072
|
-
return e.errors.length > 0 && t.push(
|
|
2997
|
+
return e.errors.length > 0 && t.push(zn(e.errors.length, "error")), e.warnings.length > 0 && t.push(zn(e.warnings.length, "warning")), t.join(", ");
|
|
3073
2998
|
}
|
|
3074
2999
|
//#endregion
|
|
3075
3000
|
//#region src/client/hooks/useAnalysisState.ts
|
|
3076
|
-
function
|
|
3077
|
-
let { externalColorPalette: t } = e, r =
|
|
3001
|
+
function Vn(e = {}) {
|
|
3002
|
+
let { externalColorPalette: t } = e, r = Sn(), i = $((e) => e.queryStates), a = $((e) => e.activeQueryIndex), o = $((e) => e.mergeStrategy), s = $((e) => e.setActiveQueryIndex), c = $((e) => e.setMergeStrategy), l = $((e) => e.addQuery), u = $((e) => e.removeQuery), d = $((e) => e.getCurrentState), p = $((e) => e.getMergeKeys), m = $((e) => e.isMultiQueryMode), h = d(), g = m(), _ = p(), v = U(() => {
|
|
3078
3003
|
let e = i[a] || h;
|
|
3079
|
-
return
|
|
3004
|
+
return Te(e.metrics, e.breakdowns, e.filters, e.order, !1, e.limit);
|
|
3080
3005
|
}, [
|
|
3081
3006
|
i,
|
|
3082
3007
|
a,
|
|
3083
3008
|
h
|
|
3084
|
-
]), y =
|
|
3009
|
+
]), y = U(() => {
|
|
3085
3010
|
let e = i[0]?.breakdowns || [];
|
|
3086
|
-
return i.map((t, n) =>
|
|
3087
|
-
}, [i, o]), b =
|
|
3011
|
+
return i.map((t, n) => Te(t.metrics, o === "merge" && n > 0 ? e : t.breakdowns, t.filters, t.order, !1, t.limit));
|
|
3012
|
+
}, [i, o]), b = U(() => {
|
|
3088
3013
|
if (i.length <= 1) return null;
|
|
3089
3014
|
let e = y.filter((e) => e.measures && e.measures.length > 0 || e.dimensions && e.dimensions.length > 0 || e.timeDimensions && e.timeDimensions.length > 0);
|
|
3090
3015
|
return e.length < 2 ? null : {
|
|
@@ -3098,12 +3023,12 @@ function Bn(e = {}) {
|
|
|
3098
3023
|
i.length,
|
|
3099
3024
|
o,
|
|
3100
3025
|
_
|
|
3101
|
-
]), x =
|
|
3026
|
+
]), x = U(() => g ? In(y, o, _ || []) : null, [
|
|
3102
3027
|
g,
|
|
3103
3028
|
y,
|
|
3104
3029
|
o,
|
|
3105
3030
|
_
|
|
3106
|
-
]), S =
|
|
3031
|
+
]), S = U(() => v.measures && v.measures.length > 0 || v.dimensions && v.dimensions.length > 0 || v.timeDimensions && v.timeDimensions.length > 0, [v]), C = U(() => {
|
|
3107
3032
|
if (!g) return h.metrics;
|
|
3108
3033
|
let e = /* @__PURE__ */ new Set(), t = [];
|
|
3109
3034
|
for (let n = 0; n < i.length; n++) {
|
|
@@ -3121,7 +3046,7 @@ function Bn(e = {}) {
|
|
|
3121
3046
|
g,
|
|
3122
3047
|
i,
|
|
3123
3048
|
h.metrics
|
|
3124
|
-
]), w =
|
|
3049
|
+
]), w = U(() => {
|
|
3125
3050
|
if (!g) return h.breakdowns;
|
|
3126
3051
|
let e = /* @__PURE__ */ new Set(), t = [];
|
|
3127
3052
|
for (let n of i) for (let r of n.breakdowns) e.has(r.field) || (e.add(r.field), t.push(r));
|
|
@@ -3130,98 +3055,98 @@ function Bn(e = {}) {
|
|
|
3130
3055
|
g,
|
|
3131
3056
|
i,
|
|
3132
3057
|
h.breakdowns
|
|
3133
|
-
]), T =
|
|
3058
|
+
]), T = U(() => o === "merge" && a > 0 ? i[0]?.breakdowns || [] : h.breakdowns, [
|
|
3134
3059
|
o,
|
|
3135
3060
|
a,
|
|
3136
3061
|
i,
|
|
3137
3062
|
h.breakdowns
|
|
3138
|
-
]), E = $((e) => e.analysisType), D = $((e) => e.funnelBindingKey), O = $((e) => e.funnelCube), k = $((e) => e.funnelSteps),
|
|
3063
|
+
]), E = $((e) => e.analysisType), D = $((e) => e.funnelBindingKey), O = $((e) => e.funnelCube), k = $((e) => e.funnelSteps), ee = $((e) => e.activeFunnelStepIndex), A = $((e) => e.funnelTimeDimension), te = U(() => E !== "funnel" || !D?.dimension || !A || !k || k.length < 2 ? !1 : k.every((e) => e.filters.length > 0), [
|
|
3139
3064
|
E,
|
|
3140
3065
|
D,
|
|
3141
|
-
|
|
3066
|
+
A,
|
|
3142
3067
|
k
|
|
3143
|
-
]), ne = $((e) => e.charts.funnel?.chartType) || "funnel", j = $((e) => e.charts.funnel?.chartConfig), re =
|
|
3068
|
+
]), ne = $((e) => e.charts.funnel?.chartType) || "funnel", j = $((e) => e.charts.funnel?.chartConfig), re = U(() => j || {}, [j]), M = $((e) => e.charts.funnel?.displayConfig), ie = U(() => M || {
|
|
3144
3069
|
showLegend: !0,
|
|
3145
3070
|
showGrid: !0,
|
|
3146
3071
|
showTooltip: !0
|
|
3147
|
-
}, [
|
|
3072
|
+
}, [M]), ae = $((e) => e.flowCube), oe = $((e) => e.flowBindingKey), N = $((e) => e.flowTimeDimension), P = $((e) => e.eventDimension), se = $((e) => e.startingStep), F = $((e) => e.stepsBefore), I = $((e) => e.stepsAfter), L = $((e) => e.joinStrategy), ce = $((e) => e.charts.flow?.displayConfig), le = U(() => ce || {
|
|
3148
3073
|
showLegend: !0,
|
|
3149
3074
|
showGrid: !0,
|
|
3150
3075
|
showTooltip: !0
|
|
3151
|
-
}, [
|
|
3076
|
+
}, [ce]), ue = $((e) => e.charts.flow?.chartType) || "sankey", R = $((e) => e.buildFunnelQueryFromSteps), de = U(() => E === "funnel" ? R() : null, [
|
|
3152
3077
|
E,
|
|
3153
|
-
|
|
3078
|
+
R,
|
|
3154
3079
|
k
|
|
3155
|
-
]), z = $((e) => e.buildFlowQuery),
|
|
3080
|
+
]), z = $((e) => e.buildFlowQuery), fe = U(() => E === "flow" ? z() : null, [
|
|
3156
3081
|
E,
|
|
3157
3082
|
z,
|
|
3158
|
-
|
|
3159
|
-
N,
|
|
3083
|
+
ae,
|
|
3160
3084
|
oe,
|
|
3161
|
-
|
|
3085
|
+
N,
|
|
3162
3086
|
P,
|
|
3163
|
-
|
|
3087
|
+
se,
|
|
3164
3088
|
F,
|
|
3089
|
+
I,
|
|
3165
3090
|
ue,
|
|
3166
|
-
|
|
3167
|
-
]),
|
|
3091
|
+
L
|
|
3092
|
+
]), pe = $((e) => e.retentionCube), me = $((e) => e.retentionBindingKey), he = $((e) => e.retentionTimeDimension), B = $((e) => e.retentionDateRange), ge = $((e) => e.retentionCohortFilters), _e = $((e) => e.retentionActivityFilters), ve = $((e) => e.retentionBreakdowns), H = $((e) => e.retentionViewGranularity), W = $((e) => e.retentionPeriods), K = $((e) => e.retentionType), q = $((e) => e.buildRetentionQuery), J = $((e) => e.getRetentionValidation), ye = $((e) => e.charts.retention?.displayConfig), be = U(() => E === "retention" ? q() : null, [
|
|
3168
3093
|
E,
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
W,
|
|
3172
|
-
G,
|
|
3173
|
-
K,
|
|
3094
|
+
q,
|
|
3095
|
+
pe,
|
|
3174
3096
|
me,
|
|
3175
3097
|
he,
|
|
3098
|
+
B,
|
|
3099
|
+
ve,
|
|
3100
|
+
H,
|
|
3101
|
+
W,
|
|
3102
|
+
K,
|
|
3176
3103
|
ge,
|
|
3177
|
-
_e
|
|
3178
|
-
|
|
3179
|
-
q
|
|
3180
|
-
]), Se = B(() => E === "retention" ? ye() : null, [
|
|
3104
|
+
_e
|
|
3105
|
+
]), xe = U(() => E === "retention" ? J() : null, [
|
|
3181
3106
|
E,
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
]),
|
|
3107
|
+
J,
|
|
3108
|
+
pe,
|
|
3109
|
+
me,
|
|
3110
|
+
he,
|
|
3111
|
+
B
|
|
3112
|
+
]), Se = U(() => E === "retention" ? be !== null : E === "flow" ? fe !== null : E === "funnel" ? de !== null : S ?? !1, [
|
|
3188
3113
|
E,
|
|
3189
|
-
|
|
3190
|
-
V,
|
|
3114
|
+
be,
|
|
3191
3115
|
fe,
|
|
3116
|
+
de,
|
|
3192
3117
|
S
|
|
3193
|
-
]), { chartType:
|
|
3194
|
-
if (E === "funnel")
|
|
3118
|
+
]), { chartType: Ce, chartConfig: we, displayConfig: Y } = $(n(Dn)), Ee = $((e) => e.userManuallySelectedChart), De = $((e) => e.localPaletteName), Oe = $((e) => e.setChartTypeManual), ke = $((e) => e.setChartConfig), Ae = $((e) => e.setDisplayConfig), je = $((e) => e.setFunnelChartType), Me = $((e) => e.setFunnelChartConfig), Ne = $((e) => e.setFunnelDisplayConfig), Pe = $((e) => e.setLocalPaletteName), Fe = $((e) => e.setUserManuallySelectedChart), Ie = V((e) => {
|
|
3119
|
+
if (E === "funnel") je(e);
|
|
3195
3120
|
else {
|
|
3196
|
-
|
|
3197
|
-
let { chartConfig: t } =
|
|
3198
|
-
|
|
3121
|
+
Oe(e);
|
|
3122
|
+
let { chartConfig: t } = kt(C, w, e);
|
|
3123
|
+
ke(t);
|
|
3199
3124
|
}
|
|
3200
3125
|
}, [
|
|
3201
3126
|
E,
|
|
3202
3127
|
C,
|
|
3203
3128
|
w,
|
|
3129
|
+
je,
|
|
3130
|
+
Oe,
|
|
3131
|
+
ke
|
|
3132
|
+
]), Le = V((e) => {
|
|
3133
|
+
E === "funnel" ? Me(e) : ke(e);
|
|
3134
|
+
}, [
|
|
3135
|
+
E,
|
|
3204
3136
|
Me,
|
|
3205
|
-
ke
|
|
3206
|
-
|
|
3207
|
-
]), Re = R((e) => {
|
|
3137
|
+
ke
|
|
3138
|
+
]), Re = V((e) => {
|
|
3208
3139
|
E === "funnel" ? Ne(e) : Ae(e);
|
|
3209
3140
|
}, [
|
|
3210
3141
|
E,
|
|
3211
3142
|
Ne,
|
|
3212
3143
|
Ae
|
|
3213
|
-
]), ze =
|
|
3214
|
-
E === "funnel" ? Pe(e) : je(e);
|
|
3215
|
-
}, [
|
|
3216
|
-
E,
|
|
3217
|
-
Pe,
|
|
3218
|
-
je
|
|
3219
|
-
]), Be = B(() => Et(C, w), [C, w]), Ve = B(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
|
|
3144
|
+
]), ze = U(() => Dt(C, w), [C, w]), Be = U(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
|
|
3220
3145
|
name: "custom",
|
|
3221
3146
|
label: "Custom",
|
|
3222
3147
|
colors: t,
|
|
3223
3148
|
gradient: t
|
|
3224
|
-
} : t :
|
|
3149
|
+
} : t : f(De), [t, De]), Ve = V((e) => {
|
|
3225
3150
|
r.setState((t) => ({ charts: {
|
|
3226
3151
|
...t.charts,
|
|
3227
3152
|
flow: {
|
|
@@ -3233,7 +3158,7 @@ function Bn(e = {}) {
|
|
|
3233
3158
|
displayConfig: e
|
|
3234
3159
|
}
|
|
3235
3160
|
} }));
|
|
3236
|
-
}, [r]),
|
|
3161
|
+
}, [r]), He = V((e) => {
|
|
3237
3162
|
r.setState((t) => ({ charts: {
|
|
3238
3163
|
...t.charts,
|
|
3239
3164
|
retention: {
|
|
@@ -3245,31 +3170,31 @@ function Bn(e = {}) {
|
|
|
3245
3170
|
displayConfig: e
|
|
3246
3171
|
}
|
|
3247
3172
|
} }));
|
|
3248
|
-
}, [r]),
|
|
3173
|
+
}, [r]), Ue = $((e) => e.activeTab), We = $((e) => e.activeView), Ge = $((e) => e.displayLimit), Ke = $((e) => e.showFieldModal), qe = $((e) => e.fieldModalMode), Je = $((e) => e.setActiveTab), Ye = $((e) => e.setActiveView), Xe = $((e) => e.setDisplayLimit), Ze = $((e) => e.closeFieldModal), [Qe, $e] = G(0), et = $((e) => e.openMetricsModal), tt = $((e) => e.addMetric), nt = $((e) => e.removeMetric), rt = $((e) => e.toggleMetric), it = $((e) => e.reorderMetrics), at = $((e) => e.openBreakdownsModal), ot = $((e) => e.addBreakdown), st = $((e) => e.removeBreakdown), ct = $((e) => e.toggleBreakdown), lt = $((e) => e.setBreakdownGranularity), ut = $((e) => e.toggleBreakdownComparison), dt = $((e) => e.reorderBreakdowns), ft = $((e) => e.setFilters), pt = $((e) => e.dropFieldToFilter), mt = $((e) => e.setOrder), ht = $((e) => e.setLimit), gt = $((e) => e.clearQuery), _t = $((e) => e.clearCurrentMode), vt = $((e) => e.setFunnelBindingKey), yt = $((e) => e.setAnalysisType), bt = $((e) => e.setFunnelCube), xt = $((e) => e.addFunnelStep), St = $((e) => e.removeFunnelStep), Ct = $((e) => e.updateFunnelStep), wt = $((e) => e.setActiveFunnelStepIndex), Tt = $((e) => e.reorderFunnelSteps), Et = $((e) => e.setFunnelTimeDimension), Ot = $((e) => e.setFlowCube), At = $((e) => e.setFlowBindingKey), jt = $((e) => e.setFlowTimeDimension), Mt = $((e) => e.setEventDimension), Nt = $((e) => e.setStartingStepName), Pt = $((e) => e.setStartingStepFilters), Ft = $((e) => e.setStepsBefore), It = $((e) => e.setStepsAfter), Lt = $((e) => e.setJoinStrategy), Rt = $((e) => e.setRetentionCube), zt = $((e) => e.setRetentionBindingKey), Bt = $((e) => e.setRetentionTimeDimension), Vt = $((e) => e.setRetentionDateRange), Ht = $((e) => e.setRetentionCohortFilters), Ut = $((e) => e.setRetentionActivityFilters), Wt = $((e) => e.setRetentionBreakdowns), X = $((e) => e.addRetentionBreakdown), Z = $((e) => e.removeRetentionBreakdown), Gt = $((e) => e.setRetentionViewGranularity), Kt = $((e) => e.setRetentionPeriods), Q = $((e) => e.setRetentionType), qt = $((e) => e.getValidation), Jt = U(() => qt(), [
|
|
3249
3174
|
qt,
|
|
3250
3175
|
i,
|
|
3251
3176
|
E,
|
|
3252
3177
|
k,
|
|
3253
3178
|
D,
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
N,
|
|
3179
|
+
A,
|
|
3180
|
+
ae,
|
|
3257
3181
|
oe,
|
|
3258
|
-
|
|
3182
|
+
N,
|
|
3259
3183
|
P,
|
|
3260
|
-
|
|
3184
|
+
se,
|
|
3261
3185
|
F,
|
|
3262
|
-
I
|
|
3263
|
-
|
|
3264
|
-
|
|
3186
|
+
I,
|
|
3187
|
+
L
|
|
3188
|
+
]), Yt = V((e, t) => {
|
|
3189
|
+
E === "retention" && t === "dimension" ? X({ field: e.name }) : ct(e.name, t === "timeDimension");
|
|
3265
3190
|
}, [
|
|
3266
3191
|
E,
|
|
3267
|
-
|
|
3192
|
+
X,
|
|
3268
3193
|
ct
|
|
3269
|
-
]), Xt =
|
|
3270
|
-
|
|
3194
|
+
]), Xt = V((e, t, n, r) => {
|
|
3195
|
+
qe === "metrics" && t === "measure" ? rt(e.name) : qe === "breakdown" && Yt(e, t), r || Ze();
|
|
3271
3196
|
}, [
|
|
3272
|
-
|
|
3197
|
+
qe,
|
|
3273
3198
|
rt,
|
|
3274
3199
|
Yt,
|
|
3275
3200
|
Ze
|
|
@@ -3287,7 +3212,7 @@ function Bn(e = {}) {
|
|
|
3287
3212
|
multiQueryConfig: b,
|
|
3288
3213
|
multiQueryValidation: x,
|
|
3289
3214
|
isValidQuery: S,
|
|
3290
|
-
effectiveIsValidQuery:
|
|
3215
|
+
effectiveIsValidQuery: Se,
|
|
3291
3216
|
combinedMetrics: C,
|
|
3292
3217
|
combinedBreakdowns: w,
|
|
3293
3218
|
effectiveBreakdowns: T,
|
|
@@ -3296,50 +3221,50 @@ function Bn(e = {}) {
|
|
|
3296
3221
|
isFunnelModeEnabled: te,
|
|
3297
3222
|
funnelCube: O,
|
|
3298
3223
|
funnelSteps: k,
|
|
3299
|
-
activeFunnelStepIndex:
|
|
3300
|
-
funnelTimeDimension:
|
|
3224
|
+
activeFunnelStepIndex: ee,
|
|
3225
|
+
funnelTimeDimension: A,
|
|
3301
3226
|
funnelChartType: ne,
|
|
3302
3227
|
funnelChartConfig: re,
|
|
3303
|
-
funnelDisplayConfig:
|
|
3304
|
-
serverFunnelQuery:
|
|
3305
|
-
flowCube:
|
|
3306
|
-
flowBindingKey:
|
|
3307
|
-
flowTimeDimension:
|
|
3308
|
-
eventDimension:
|
|
3309
|
-
startingStep:
|
|
3310
|
-
stepsBefore:
|
|
3311
|
-
stepsAfter:
|
|
3312
|
-
joinStrategy:
|
|
3313
|
-
flowDisplayConfig:
|
|
3314
|
-
serverFlowQuery:
|
|
3315
|
-
retentionCube:
|
|
3316
|
-
retentionBindingKey:
|
|
3317
|
-
retentionTimeDimension:
|
|
3318
|
-
retentionDateRange:
|
|
3319
|
-
retentionCohortFilters:
|
|
3320
|
-
retentionActivityFilters:
|
|
3321
|
-
retentionBreakdowns:
|
|
3322
|
-
retentionViewGranularity:
|
|
3323
|
-
retentionPeriods:
|
|
3324
|
-
retentionType:
|
|
3325
|
-
retentionDisplayConfig:
|
|
3326
|
-
serverRetentionQuery:
|
|
3327
|
-
retentionValidation:
|
|
3328
|
-
chartType:
|
|
3329
|
-
chartConfig:
|
|
3330
|
-
displayConfig:
|
|
3331
|
-
colorPalette:
|
|
3332
|
-
localPaletteName:
|
|
3333
|
-
chartAvailability:
|
|
3334
|
-
userManuallySelectedChart:
|
|
3335
|
-
activeTab:
|
|
3336
|
-
activeView:
|
|
3337
|
-
displayLimit:
|
|
3338
|
-
showFieldModal:
|
|
3339
|
-
fieldModalMode:
|
|
3228
|
+
funnelDisplayConfig: ie,
|
|
3229
|
+
serverFunnelQuery: de,
|
|
3230
|
+
flowCube: ae,
|
|
3231
|
+
flowBindingKey: oe,
|
|
3232
|
+
flowTimeDimension: N,
|
|
3233
|
+
eventDimension: P,
|
|
3234
|
+
startingStep: se,
|
|
3235
|
+
stepsBefore: F,
|
|
3236
|
+
stepsAfter: I,
|
|
3237
|
+
joinStrategy: L,
|
|
3238
|
+
flowDisplayConfig: le,
|
|
3239
|
+
serverFlowQuery: fe,
|
|
3240
|
+
retentionCube: pe,
|
|
3241
|
+
retentionBindingKey: me,
|
|
3242
|
+
retentionTimeDimension: he,
|
|
3243
|
+
retentionDateRange: B,
|
|
3244
|
+
retentionCohortFilters: ge,
|
|
3245
|
+
retentionActivityFilters: _e,
|
|
3246
|
+
retentionBreakdowns: ve,
|
|
3247
|
+
retentionViewGranularity: H,
|
|
3248
|
+
retentionPeriods: W,
|
|
3249
|
+
retentionType: K,
|
|
3250
|
+
retentionDisplayConfig: ye,
|
|
3251
|
+
serverRetentionQuery: be,
|
|
3252
|
+
retentionValidation: xe,
|
|
3253
|
+
chartType: Ce,
|
|
3254
|
+
chartConfig: we,
|
|
3255
|
+
displayConfig: Y,
|
|
3256
|
+
colorPalette: Be,
|
|
3257
|
+
localPaletteName: De,
|
|
3258
|
+
chartAvailability: ze,
|
|
3259
|
+
userManuallySelectedChart: Ee,
|
|
3260
|
+
activeTab: Ue,
|
|
3261
|
+
activeView: We,
|
|
3262
|
+
displayLimit: Ge,
|
|
3263
|
+
showFieldModal: Ke,
|
|
3264
|
+
fieldModalMode: qe,
|
|
3340
3265
|
activeTableIndex: Qe,
|
|
3341
3266
|
adapterValidation: Jt,
|
|
3342
|
-
getQueryConfig:
|
|
3267
|
+
getQueryConfig: V(() => {
|
|
3343
3268
|
let e = r.getState();
|
|
3344
3269
|
return e.analysisType === "funnel" ? e.buildFunnelQueryFromSteps() || e.buildCurrentQuery() : e.queryStates.length > 1 ? {
|
|
3345
3270
|
queries: e.buildAllQueries(),
|
|
@@ -3350,24 +3275,24 @@ function Bn(e = {}) {
|
|
|
3350
3275
|
stepTimeToConvert: e.stepTimeToConvert
|
|
3351
3276
|
} : e.buildCurrentQuery();
|
|
3352
3277
|
}, [r]),
|
|
3353
|
-
getChartConfig:
|
|
3278
|
+
getChartConfig: V(() => {
|
|
3354
3279
|
let e = r.getState(), t = e.charts[e.analysisType];
|
|
3355
3280
|
return t ? {
|
|
3356
3281
|
chartType: t.chartType,
|
|
3357
3282
|
chartConfig: t.chartConfig,
|
|
3358
3283
|
displayConfig: t.displayConfig
|
|
3359
3284
|
} : {
|
|
3360
|
-
chartType:
|
|
3361
|
-
chartConfig:
|
|
3362
|
-
displayConfig:
|
|
3285
|
+
chartType: Ce,
|
|
3286
|
+
chartConfig: we,
|
|
3287
|
+
displayConfig: Y
|
|
3363
3288
|
};
|
|
3364
3289
|
}, [
|
|
3365
3290
|
r,
|
|
3291
|
+
Ce,
|
|
3366
3292
|
we,
|
|
3367
|
-
|
|
3368
|
-
Ee
|
|
3293
|
+
Y
|
|
3369
3294
|
]),
|
|
3370
|
-
getAnalysisType:
|
|
3295
|
+
getAnalysisType: V(() => r.getState().analysisType, [r]),
|
|
3371
3296
|
actions: {
|
|
3372
3297
|
setActiveQueryIndex: s,
|
|
3373
3298
|
setMergeStrategy: c,
|
|
@@ -3397,9 +3322,9 @@ function Bn(e = {}) {
|
|
|
3397
3322
|
updateFunnelStep: Ct,
|
|
3398
3323
|
setActiveFunnelStepIndex: wt,
|
|
3399
3324
|
reorderFunnelSteps: Tt,
|
|
3400
|
-
setFunnelTimeDimension:
|
|
3401
|
-
setFunnelDisplayConfig:
|
|
3402
|
-
setFlowCube:
|
|
3325
|
+
setFunnelTimeDimension: Et,
|
|
3326
|
+
setFunnelDisplayConfig: Ne,
|
|
3327
|
+
setFlowCube: Ot,
|
|
3403
3328
|
setFlowBindingKey: At,
|
|
3404
3329
|
setFlowTimeDimension: jt,
|
|
3405
3330
|
setEventDimension: Mt,
|
|
@@ -3408,27 +3333,27 @@ function Bn(e = {}) {
|
|
|
3408
3333
|
setStepsBefore: Ft,
|
|
3409
3334
|
setStepsAfter: It,
|
|
3410
3335
|
setJoinStrategy: Lt,
|
|
3411
|
-
setFlowDisplayConfig:
|
|
3336
|
+
setFlowDisplayConfig: Ve,
|
|
3412
3337
|
setRetentionCube: Rt,
|
|
3413
3338
|
setRetentionBindingKey: zt,
|
|
3414
3339
|
setRetentionTimeDimension: Bt,
|
|
3415
3340
|
setRetentionDateRange: Vt,
|
|
3416
3341
|
setRetentionCohortFilters: Ht,
|
|
3417
3342
|
setRetentionActivityFilters: Ut,
|
|
3418
|
-
setRetentionBreakdowns:
|
|
3419
|
-
addRetentionBreakdown:
|
|
3420
|
-
removeRetentionBreakdown:
|
|
3343
|
+
setRetentionBreakdowns: Wt,
|
|
3344
|
+
addRetentionBreakdown: X,
|
|
3345
|
+
removeRetentionBreakdown: Z,
|
|
3421
3346
|
setRetentionViewGranularity: Gt,
|
|
3422
|
-
setRetentionPeriods:
|
|
3423
|
-
setRetentionType:
|
|
3424
|
-
setRetentionDisplayConfig:
|
|
3425
|
-
setChartType:
|
|
3426
|
-
setChartConfig:
|
|
3427
|
-
setDisplayConfig:
|
|
3428
|
-
setLocalPaletteName:
|
|
3429
|
-
setUserManuallySelectedChart:
|
|
3430
|
-
setActiveTab:
|
|
3431
|
-
setActiveView:
|
|
3347
|
+
setRetentionPeriods: Kt,
|
|
3348
|
+
setRetentionType: Q,
|
|
3349
|
+
setRetentionDisplayConfig: He,
|
|
3350
|
+
setChartType: Ie,
|
|
3351
|
+
setChartConfig: Le,
|
|
3352
|
+
setDisplayConfig: Re,
|
|
3353
|
+
setLocalPaletteName: Pe,
|
|
3354
|
+
setUserManuallySelectedChart: Fe,
|
|
3355
|
+
setActiveTab: Je,
|
|
3356
|
+
setActiveView: Ye,
|
|
3432
3357
|
setDisplayLimit: Xe,
|
|
3433
3358
|
closeFieldModal: Ze,
|
|
3434
3359
|
setActiveTableIndex: $e,
|
|
@@ -3440,13 +3365,13 @@ function Bn(e = {}) {
|
|
|
3440
3365
|
}
|
|
3441
3366
|
//#endregion
|
|
3442
3367
|
//#region src/client/hooks/analysisQueryExecutionModes.ts
|
|
3443
|
-
function
|
|
3368
|
+
function Hn(e) {
|
|
3444
3369
|
return e.isRetentionMode ? "retention" : e.isFlowMode ? "flow" : e.isFunnelMode ? "funnel" : e.isMultiMode ? "multi" : "single";
|
|
3445
3370
|
}
|
|
3446
|
-
function
|
|
3371
|
+
function Un(e, t) {
|
|
3447
3372
|
return t[e];
|
|
3448
3373
|
}
|
|
3449
|
-
function
|
|
3374
|
+
function Wn(e) {
|
|
3450
3375
|
return {
|
|
3451
3376
|
funnelExecutedQueries: e.isFunnelMode && e.funnelExecutedQueries && e.funnelExecutedQueries.length > 0 ? e.funnelExecutedQueries : null,
|
|
3452
3377
|
funnelServerQuery: e.isFunnelMode ? e.funnelServerQuery : null,
|
|
@@ -3459,7 +3384,7 @@ function Un(e) {
|
|
|
3459
3384
|
retentionDebugData: e.isRetentionMode ? e.retentionDebugData : null
|
|
3460
3385
|
};
|
|
3461
3386
|
}
|
|
3462
|
-
function
|
|
3387
|
+
function Gn(e) {
|
|
3463
3388
|
return {
|
|
3464
3389
|
single: !e.isValidQuery || !e.isSingleMode,
|
|
3465
3390
|
multi: !e.hasMultiQueryConfig || !e.isMultiMode,
|
|
@@ -3469,11 +3394,11 @@ function Wn(e) {
|
|
|
3469
3394
|
dryRun: !!(!e.isValidQuery || e.isFunnelMode || e.isFlowMode || e.isRetentionMode)
|
|
3470
3395
|
};
|
|
3471
3396
|
}
|
|
3472
|
-
function
|
|
3397
|
+
function Kn(e) {
|
|
3473
3398
|
let { hasResults: t, initialData: n, isValidQuery: r, isLoading: i, isFetching: a, error: o } = e;
|
|
3474
3399
|
return n && n.length > 0 && !t ? "success" : r ? i && !t ? "loading" : a && t ? "refreshing" : o ? "error" : t ? "success" : "idle" : "idle";
|
|
3475
3400
|
}
|
|
3476
|
-
function
|
|
3401
|
+
function qn(e) {
|
|
3477
3402
|
return e.isRetentionMode && e.retentionChartData ? e.retentionChartData.rows.map((e) => ({
|
|
3478
3403
|
"Retention.period": `P${e.period}`,
|
|
3479
3404
|
"Retention.rate": e.retentionRate,
|
|
@@ -3484,18 +3409,18 @@ function Kn(e) {
|
|
|
3484
3409
|
}
|
|
3485
3410
|
//#endregion
|
|
3486
3411
|
//#region src/client/hooks/useAnalysisQuery.ts
|
|
3487
|
-
function
|
|
3488
|
-
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: m } = e, { getFieldLabel: h } =
|
|
3412
|
+
function Jn(e) {
|
|
3413
|
+
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: m } = e, { getFieldLabel: h } = de(), g = u === "funnel" || l, _ = u === "flow", v = u === "retention", y = u === "query" && i, b = u === "query" && !i, x = u === "funnel" && !!d, S = Hn({
|
|
3489
3414
|
isRetentionMode: v,
|
|
3490
3415
|
isFlowMode: _,
|
|
3491
3416
|
isFunnelMode: g,
|
|
3492
3417
|
isMultiMode: y
|
|
3493
|
-
}), C =
|
|
3418
|
+
}), C = U(() => x || !g || !c || n.length < 2 ? null : pe(n, c), [
|
|
3494
3419
|
x,
|
|
3495
3420
|
g,
|
|
3496
3421
|
c,
|
|
3497
3422
|
n
|
|
3498
|
-
]), w =
|
|
3423
|
+
]), w = Gn({
|
|
3499
3424
|
isValidQuery: a,
|
|
3500
3425
|
isSingleMode: b,
|
|
3501
3426
|
isMultiMode: y,
|
|
@@ -3507,49 +3432,49 @@ function qn(e) {
|
|
|
3507
3432
|
hasServerFunnelQuery: !!d,
|
|
3508
3433
|
hasServerFlowQuery: !!f,
|
|
3509
3434
|
hasServerRetentionQuery: !!p
|
|
3510
|
-
}), T =
|
|
3435
|
+
}), T = oe(t, {
|
|
3511
3436
|
skip: w.single,
|
|
3512
3437
|
debounceMs: 300
|
|
3513
|
-
}), E =
|
|
3438
|
+
}), E = se(r, {
|
|
3514
3439
|
skip: w.multi,
|
|
3515
3440
|
debounceMs: 300
|
|
3516
|
-
}), D =
|
|
3441
|
+
}), D = L(C, {
|
|
3517
3442
|
skip: w.funnel,
|
|
3518
3443
|
debounceMs: 300,
|
|
3519
3444
|
prebuiltServerQuery: x ? d : void 0
|
|
3520
|
-
}), O =
|
|
3445
|
+
}), O = ue(f ?? null, {
|
|
3521
3446
|
skip: w.flow,
|
|
3522
3447
|
debounceMs: 300
|
|
3523
|
-
}),
|
|
3448
|
+
}), k = P(p ?? null, {
|
|
3524
3449
|
skip: w.retention,
|
|
3525
3450
|
debounceMs: 300,
|
|
3526
3451
|
getFieldLabel: h
|
|
3527
|
-
}), ee =
|
|
3452
|
+
}), ee = fe({
|
|
3528
3453
|
queries: i ? n : [t],
|
|
3529
3454
|
isMultiQueryMode: i,
|
|
3530
3455
|
skip: w.dryRun
|
|
3531
|
-
}),
|
|
3532
|
-
retention:
|
|
3456
|
+
}), A = z(D.serverQuery, { skip: !g || !D.serverQuery }), te = z(O.serverQuery, { skip: !_ || !O.serverQuery }), ne = z(p, { skip: !v || !p }), j = Un(S, {
|
|
3457
|
+
retention: k.isLoading || k.isDebouncing,
|
|
3533
3458
|
flow: O.isLoading || O.isDebouncing,
|
|
3534
3459
|
funnel: D.isExecuting || D.isDebouncing,
|
|
3535
3460
|
multi: E.isLoading,
|
|
3536
3461
|
single: T.isLoading
|
|
3537
|
-
}),
|
|
3538
|
-
retention:
|
|
3462
|
+
}), re = Un(S, {
|
|
3463
|
+
retention: k.isFetching,
|
|
3539
3464
|
flow: O.isFetching,
|
|
3540
3465
|
funnel: D.isExecuting,
|
|
3541
3466
|
multi: E.isFetching,
|
|
3542
3467
|
single: T.isFetching
|
|
3543
|
-
}),
|
|
3544
|
-
retention:
|
|
3468
|
+
}), M = Un(S, {
|
|
3469
|
+
retention: k.error,
|
|
3545
3470
|
flow: O.error,
|
|
3546
3471
|
funnel: D.error,
|
|
3547
3472
|
multi: E.error,
|
|
3548
3473
|
single: T.error
|
|
3549
|
-
}),
|
|
3474
|
+
}), ie = !!(T.debouncedQuery || E.debouncedConfig || !D.isDebouncing || !O.isDebouncing || !k.isDebouncing), ae = V((e) => {
|
|
3550
3475
|
switch (S) {
|
|
3551
3476
|
case "retention":
|
|
3552
|
-
|
|
3477
|
+
k.execute(e);
|
|
3553
3478
|
break;
|
|
3554
3479
|
case "flow":
|
|
3555
3480
|
O.refetch(e);
|
|
@@ -3564,14 +3489,14 @@ function qn(e) {
|
|
|
3564
3489
|
}
|
|
3565
3490
|
}, [
|
|
3566
3491
|
S,
|
|
3567
|
-
|
|
3492
|
+
k,
|
|
3568
3493
|
O,
|
|
3569
3494
|
D,
|
|
3570
3495
|
E,
|
|
3571
3496
|
T
|
|
3572
|
-
]),
|
|
3573
|
-
hasResults:
|
|
3574
|
-
retention:
|
|
3497
|
+
]), N = U(() => Kn({
|
|
3498
|
+
hasResults: Un(S, {
|
|
3499
|
+
retention: k.chartData,
|
|
3575
3500
|
flow: O.data,
|
|
3576
3501
|
funnel: D.chartData,
|
|
3577
3502
|
multi: E.data,
|
|
@@ -3579,27 +3504,27 @@ function qn(e) {
|
|
|
3579
3504
|
}),
|
|
3580
3505
|
initialData: o,
|
|
3581
3506
|
isValidQuery: a,
|
|
3582
|
-
isLoading:
|
|
3583
|
-
isFetching:
|
|
3584
|
-
error:
|
|
3507
|
+
isLoading: j,
|
|
3508
|
+
isFetching: re,
|
|
3509
|
+
error: M
|
|
3585
3510
|
}), [
|
|
3586
3511
|
a,
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3512
|
+
j,
|
|
3513
|
+
re,
|
|
3514
|
+
M,
|
|
3590
3515
|
T.rawData,
|
|
3591
3516
|
E.data,
|
|
3592
3517
|
D.chartData,
|
|
3593
3518
|
O.data,
|
|
3594
|
-
|
|
3519
|
+
k.chartData,
|
|
3595
3520
|
o,
|
|
3596
3521
|
S
|
|
3597
|
-
]),
|
|
3522
|
+
]), F = U(() => qn({
|
|
3598
3523
|
isRetentionMode: v,
|
|
3599
3524
|
isFlowMode: _,
|
|
3600
3525
|
isFunnelMode: g,
|
|
3601
3526
|
isMultiMode: y,
|
|
3602
|
-
retentionChartData:
|
|
3527
|
+
retentionChartData: k.chartData,
|
|
3603
3528
|
flowData: O.data,
|
|
3604
3529
|
funnelChartData: D.chartData,
|
|
3605
3530
|
multiData: E.data,
|
|
@@ -3610,107 +3535,107 @@ function qn(e) {
|
|
|
3610
3535
|
E.data,
|
|
3611
3536
|
D.chartData,
|
|
3612
3537
|
O.data,
|
|
3613
|
-
|
|
3538
|
+
k.chartData,
|
|
3614
3539
|
o,
|
|
3615
3540
|
y,
|
|
3616
3541
|
g,
|
|
3617
3542
|
_,
|
|
3618
3543
|
v
|
|
3619
|
-
]),
|
|
3544
|
+
]), I = U(() => g && D.stepResults ? D.stepResults.map((e) => e.data) : !y || !E.perQueryData ? null : E.perQueryData, [
|
|
3620
3545
|
y,
|
|
3621
3546
|
g,
|
|
3622
3547
|
E.perQueryData,
|
|
3623
3548
|
D.stepResults
|
|
3624
|
-
]), { funnelExecutedQueries:
|
|
3549
|
+
]), { funnelExecutedQueries: ce, funnelServerQuery: le, funnelDebugData: R, flowServerQuery: me, flowChartData: he, flowDebugData: B, retentionServerQuery: ge, retentionChartData: _e, retentionDebugData: ve } = Wn({
|
|
3625
3550
|
isFunnelMode: g,
|
|
3626
3551
|
isFlowMode: _,
|
|
3627
3552
|
isRetentionMode: v,
|
|
3628
3553
|
funnelExecutedQueries: D.executedQueries,
|
|
3629
3554
|
funnelServerQuery: D.serverQuery,
|
|
3630
|
-
funnelDebugData:
|
|
3555
|
+
funnelDebugData: A.debugData,
|
|
3631
3556
|
flowServerQuery: O.serverQuery,
|
|
3632
3557
|
flowData: O.data,
|
|
3633
|
-
flowDebugData:
|
|
3558
|
+
flowDebugData: te.debugData,
|
|
3634
3559
|
retentionServerQuery: p ?? null,
|
|
3635
|
-
retentionChartData:
|
|
3636
|
-
retentionDebugData:
|
|
3637
|
-
}),
|
|
3638
|
-
retention:
|
|
3560
|
+
retentionChartData: k.chartData,
|
|
3561
|
+
retentionDebugData: ne.debugData
|
|
3562
|
+
}), H = U(() => Un(S, {
|
|
3563
|
+
retention: k.needsRefresh,
|
|
3639
3564
|
flow: O.needsRefresh,
|
|
3640
3565
|
funnel: D.needsRefresh,
|
|
3641
3566
|
multi: !1,
|
|
3642
3567
|
single: T.needsRefresh
|
|
3643
3568
|
}), [
|
|
3644
3569
|
S,
|
|
3645
|
-
|
|
3570
|
+
k.needsRefresh,
|
|
3646
3571
|
O.needsRefresh,
|
|
3647
3572
|
D.needsRefresh,
|
|
3648
3573
|
T.needsRefresh
|
|
3649
|
-
]),
|
|
3574
|
+
]), W = U(() => {
|
|
3650
3575
|
if (b && T.warnings) return T.warnings;
|
|
3651
3576
|
}, [b, T.warnings]);
|
|
3652
3577
|
return {
|
|
3653
|
-
executionStatus:
|
|
3654
|
-
executionResults:
|
|
3655
|
-
perQueryResults:
|
|
3656
|
-
isLoading:
|
|
3657
|
-
isFetching:
|
|
3658
|
-
error:
|
|
3578
|
+
executionStatus: N,
|
|
3579
|
+
executionResults: F,
|
|
3580
|
+
perQueryResults: I,
|
|
3581
|
+
isLoading: j,
|
|
3582
|
+
isFetching: re,
|
|
3583
|
+
error: M,
|
|
3659
3584
|
debugDataPerQuery: ee.debugDataPerQuery,
|
|
3660
|
-
hasDebounced:
|
|
3661
|
-
refetch:
|
|
3662
|
-
funnelExecutedQueries:
|
|
3663
|
-
funnelServerQuery:
|
|
3664
|
-
funnelDebugData:
|
|
3665
|
-
flowServerQuery:
|
|
3666
|
-
flowChartData:
|
|
3667
|
-
flowDebugData:
|
|
3668
|
-
retentionServerQuery:
|
|
3669
|
-
retentionChartData:
|
|
3670
|
-
retentionDebugData:
|
|
3585
|
+
hasDebounced: ie,
|
|
3586
|
+
refetch: ae,
|
|
3587
|
+
funnelExecutedQueries: ce,
|
|
3588
|
+
funnelServerQuery: le,
|
|
3589
|
+
funnelDebugData: R,
|
|
3590
|
+
flowServerQuery: me,
|
|
3591
|
+
flowChartData: he,
|
|
3592
|
+
flowDebugData: B,
|
|
3593
|
+
retentionServerQuery: ge,
|
|
3594
|
+
retentionChartData: _e,
|
|
3595
|
+
retentionDebugData: ve,
|
|
3671
3596
|
retentionValidation: m ?? null,
|
|
3672
|
-
needsRefresh:
|
|
3673
|
-
warnings:
|
|
3597
|
+
needsRefresh: H,
|
|
3598
|
+
warnings: W
|
|
3674
3599
|
};
|
|
3675
3600
|
}
|
|
3676
3601
|
//#endregion
|
|
3677
3602
|
//#region src/client/utils/shareUtils.ts
|
|
3678
|
-
var
|
|
3679
|
-
function Zn(e) {
|
|
3680
|
-
return (0, Jn.compressToEncodedURIComponent)(JSON.stringify(e));
|
|
3681
|
-
}
|
|
3603
|
+
var Yn = o(), Xn = 1800, Zn = "share=";
|
|
3682
3604
|
function Qn(e) {
|
|
3605
|
+
return (0, Yn.compressToEncodedURIComponent)(JSON.stringify(e));
|
|
3606
|
+
}
|
|
3607
|
+
function $n(e) {
|
|
3683
3608
|
try {
|
|
3684
|
-
let t = (0,
|
|
3609
|
+
let t = (0, Yn.decompressFromEncodedURIComponent)(e);
|
|
3685
3610
|
if (!t) return null;
|
|
3686
3611
|
let n = JSON.parse(t);
|
|
3687
|
-
return
|
|
3612
|
+
return D(n) ? n : (console.warn("[shareUtils] Invalid AnalysisConfig in share URL"), null);
|
|
3688
3613
|
} catch {
|
|
3689
3614
|
return null;
|
|
3690
3615
|
}
|
|
3691
3616
|
}
|
|
3692
|
-
function
|
|
3693
|
-
let t =
|
|
3617
|
+
function er(e) {
|
|
3618
|
+
let t = Qn(e);
|
|
3694
3619
|
return {
|
|
3695
|
-
ok: t.length <=
|
|
3620
|
+
ok: t.length <= Xn,
|
|
3696
3621
|
size: t.length,
|
|
3697
|
-
maxSize:
|
|
3622
|
+
maxSize: Xn
|
|
3698
3623
|
};
|
|
3699
3624
|
}
|
|
3700
|
-
function
|
|
3701
|
-
let t =
|
|
3702
|
-
if (t.length <=
|
|
3625
|
+
function tr(e) {
|
|
3626
|
+
let t = Qn(e);
|
|
3627
|
+
if (t.length <= Xn) return {
|
|
3703
3628
|
encoded: t,
|
|
3704
3629
|
queryOnly: !1
|
|
3705
3630
|
};
|
|
3706
|
-
let n =
|
|
3631
|
+
let n = Qn({
|
|
3707
3632
|
version: e.version,
|
|
3708
3633
|
analysisType: e.analysisType,
|
|
3709
3634
|
activeView: e.activeView,
|
|
3710
3635
|
charts: {},
|
|
3711
3636
|
query: e.query
|
|
3712
3637
|
});
|
|
3713
|
-
return n.length <=
|
|
3638
|
+
return n.length <= Xn ? {
|
|
3714
3639
|
encoded: n,
|
|
3715
3640
|
queryOnly: !0
|
|
3716
3641
|
} : {
|
|
@@ -3718,27 +3643,27 @@ function er(e) {
|
|
|
3718
3643
|
queryOnly: !0
|
|
3719
3644
|
};
|
|
3720
3645
|
}
|
|
3721
|
-
function
|
|
3722
|
-
let { encoded: t } =
|
|
3723
|
-
return t ? `${window.location.origin}${window.location.pathname}#${
|
|
3646
|
+
function nr(e) {
|
|
3647
|
+
let { encoded: t } = tr(e);
|
|
3648
|
+
return t ? `${window.location.origin}${window.location.pathname}#${Zn}${t}` : null;
|
|
3724
3649
|
}
|
|
3725
|
-
function
|
|
3650
|
+
function rr() {
|
|
3726
3651
|
if (typeof window > "u") return null;
|
|
3727
3652
|
let e = window.location.hash;
|
|
3728
|
-
return !e || !e.startsWith(`#${
|
|
3653
|
+
return !e || !e.startsWith(`#${Zn}`) ? null : e.slice(7);
|
|
3729
3654
|
}
|
|
3730
|
-
function
|
|
3655
|
+
function ir() {
|
|
3731
3656
|
if (typeof window > "u") return;
|
|
3732
3657
|
let e = new URL(window.location.href);
|
|
3733
3658
|
e.hash = "", window.history.replaceState(null, "", e.toString());
|
|
3734
3659
|
}
|
|
3735
|
-
function
|
|
3736
|
-
let e =
|
|
3737
|
-
return e ?
|
|
3660
|
+
function ar() {
|
|
3661
|
+
let e = rr();
|
|
3662
|
+
return e ? $n(e) : null;
|
|
3738
3663
|
}
|
|
3739
3664
|
//#endregion
|
|
3740
3665
|
//#region src/client/components/AIAssistant/utils.ts
|
|
3741
|
-
async function
|
|
3666
|
+
async function or(e, t, n = "/api/ai/generate", r) {
|
|
3742
3667
|
let i = { text: t }, a = {
|
|
3743
3668
|
"Content-Type": "application/json",
|
|
3744
3669
|
...r
|
|
@@ -3768,28 +3693,28 @@ async function ar(e, t, n = "/api/ai/generate", r) {
|
|
|
3768
3693
|
let s = await o.json();
|
|
3769
3694
|
return console.log("✅ Client: Successfully generated content"), s;
|
|
3770
3695
|
}
|
|
3771
|
-
function
|
|
3696
|
+
function sr(e) {
|
|
3772
3697
|
return (e.query || "").replace(/```json\s*/g, "").replace(/```\s*/g, "").replace(/^\s*```.*\n/gm, "").trim();
|
|
3773
3698
|
}
|
|
3774
3699
|
//#endregion
|
|
3775
3700
|
//#region src/client/hooks/useAnalysisEffects.ts
|
|
3776
|
-
function
|
|
3701
|
+
function cr(e) {
|
|
3777
3702
|
return typeof e == "object" && !!e && "funnel" in e && typeof e.funnel == "object";
|
|
3778
3703
|
}
|
|
3779
|
-
function
|
|
3780
|
-
let { state: t, query: n, aiEndpoint: r = "/api/ai", onQueryChange: i, onChartConfigChange: a } = e, { storeApi: o, actions: s } = t, { apiOptions: c } = u(), l =
|
|
3781
|
-
|
|
3704
|
+
function lr(e) {
|
|
3705
|
+
let { state: t, query: n, aiEndpoint: r = "/api/ai", onQueryChange: i, onChartConfigChange: a } = e, { storeApi: o, actions: s } = t, { apiOptions: c } = u(), l = W(!1);
|
|
3706
|
+
H(() => {
|
|
3782
3707
|
if (l.current) return;
|
|
3783
3708
|
l.current = !0;
|
|
3784
|
-
let e =
|
|
3785
|
-
e && (o.getState().load(e),
|
|
3786
|
-
}, [o]),
|
|
3709
|
+
let e = ar();
|
|
3710
|
+
e && (o.getState().load(e), ir());
|
|
3711
|
+
}, [o]), H(() => {
|
|
3787
3712
|
i && t.isValidQuery && i(t.currentQuery);
|
|
3788
3713
|
}, [
|
|
3789
3714
|
t.currentQuery,
|
|
3790
3715
|
t.isValidQuery,
|
|
3791
3716
|
i
|
|
3792
|
-
]),
|
|
3717
|
+
]), H(() => {
|
|
3793
3718
|
a && a({
|
|
3794
3719
|
chartType: t.chartType,
|
|
3795
3720
|
chartConfig: t.chartConfig,
|
|
@@ -3801,46 +3726,46 @@ function cr(e) {
|
|
|
3801
3726
|
t.displayConfig,
|
|
3802
3727
|
a
|
|
3803
3728
|
]);
|
|
3804
|
-
let { combinedMetrics:
|
|
3805
|
-
|
|
3806
|
-
if (!
|
|
3729
|
+
let { combinedMetrics: f, combinedBreakdowns: m, chartType: h, chartConfig: g, userManuallySelectedChart: _ } = t, { hasDebounced: v } = n, { setChartType: y, setChartConfig: b } = s, x = W("");
|
|
3730
|
+
H(() => {
|
|
3731
|
+
if (!v || f.length === 0 && m.length === 0) return;
|
|
3807
3732
|
let e = JSON.stringify({
|
|
3808
|
-
metrics:
|
|
3809
|
-
breakdowns:
|
|
3733
|
+
metrics: f.map((e) => e.field),
|
|
3734
|
+
breakdowns: m.map((e) => ({
|
|
3810
3735
|
field: e.field,
|
|
3811
3736
|
isTime: e.isTimeDimension
|
|
3812
3737
|
}))
|
|
3813
3738
|
});
|
|
3814
|
-
if (e ===
|
|
3815
|
-
|
|
3816
|
-
let t =
|
|
3739
|
+
if (e === x.current) return;
|
|
3740
|
+
x.current = e;
|
|
3741
|
+
let t = jt(f, m, h, _);
|
|
3817
3742
|
if (t) {
|
|
3818
|
-
let { chartConfig: e } =
|
|
3819
|
-
|
|
3820
|
-
} else if (
|
|
3821
|
-
if (
|
|
3822
|
-
let e = [...
|
|
3823
|
-
n.length > 0 &&
|
|
3824
|
-
...
|
|
3743
|
+
let { chartConfig: e } = kt(f, m, t);
|
|
3744
|
+
y(t), b(e), s.setUserManuallySelectedChart(!1);
|
|
3745
|
+
} else if (f.length > 0 || m.length > 0) {
|
|
3746
|
+
if (h === "table") {
|
|
3747
|
+
let e = [...m.map((e) => e.field), ...f.map((e) => e.field)], t = Array.isArray(g.xAxis) ? g.xAxis : [], n = e.filter((e) => !t.includes(e));
|
|
3748
|
+
n.length > 0 && b({
|
|
3749
|
+
...g,
|
|
3825
3750
|
xAxis: [...t, ...n]
|
|
3826
3751
|
});
|
|
3827
|
-
} else if (!
|
|
3828
|
-
let { chartConfig: e } =
|
|
3829
|
-
|
|
3752
|
+
} else if (!g.xAxis?.length && !g.yAxis?.length && !g.series?.length) {
|
|
3753
|
+
let { chartConfig: e } = kt(f, m, h);
|
|
3754
|
+
b(e);
|
|
3830
3755
|
}
|
|
3831
3756
|
}
|
|
3832
3757
|
}, [
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
p,
|
|
3758
|
+
v,
|
|
3759
|
+
f,
|
|
3836
3760
|
m,
|
|
3837
|
-
g,
|
|
3838
3761
|
h,
|
|
3839
|
-
|
|
3762
|
+
_,
|
|
3763
|
+
g,
|
|
3840
3764
|
y,
|
|
3765
|
+
b,
|
|
3841
3766
|
s
|
|
3842
3767
|
]);
|
|
3843
|
-
let [
|
|
3768
|
+
let [S, C] = G({
|
|
3844
3769
|
isOpen: !1,
|
|
3845
3770
|
userPrompt: "",
|
|
3846
3771
|
isGenerating: !1,
|
|
@@ -3848,7 +3773,7 @@ function cr(e) {
|
|
|
3848
3773
|
hasGeneratedQuery: !1,
|
|
3849
3774
|
previousState: null,
|
|
3850
3775
|
previousConfig: null
|
|
3851
|
-
}), w =
|
|
3776
|
+
}), w = V((e) => {
|
|
3852
3777
|
o.getState().updateQueryState(t.activeQueryIndex, (t) => {
|
|
3853
3778
|
let n = e(t);
|
|
3854
3779
|
return {
|
|
@@ -3860,7 +3785,7 @@ function cr(e) {
|
|
|
3860
3785
|
limit: n.limit
|
|
3861
3786
|
};
|
|
3862
3787
|
});
|
|
3863
|
-
}, [o, t.activeQueryIndex]), T =
|
|
3788
|
+
}, [o, t.activeQueryIndex]), T = V((e) => {
|
|
3864
3789
|
let t = {
|
|
3865
3790
|
version: 1,
|
|
3866
3791
|
analysisType: "funnel",
|
|
@@ -3873,9 +3798,9 @@ function cr(e) {
|
|
|
3873
3798
|
query: e
|
|
3874
3799
|
};
|
|
3875
3800
|
o.getState().load(t);
|
|
3876
|
-
}, [o]), E =
|
|
3801
|
+
}, [o]), E = V(() => {
|
|
3877
3802
|
let e = o.getState().save();
|
|
3878
|
-
|
|
3803
|
+
C({
|
|
3879
3804
|
isOpen: !0,
|
|
3880
3805
|
userPrompt: "",
|
|
3881
3806
|
isGenerating: !1,
|
|
@@ -3901,30 +3826,30 @@ function cr(e) {
|
|
|
3901
3826
|
t.chartConfig,
|
|
3902
3827
|
t.displayConfig,
|
|
3903
3828
|
t.analysisType
|
|
3904
|
-
]), D =
|
|
3905
|
-
|
|
3829
|
+
]), D = V(() => {
|
|
3830
|
+
C((e) => ({
|
|
3906
3831
|
...e,
|
|
3907
3832
|
isOpen: !1,
|
|
3908
3833
|
userPrompt: "",
|
|
3909
3834
|
error: null,
|
|
3910
3835
|
hasGeneratedQuery: !1
|
|
3911
3836
|
}));
|
|
3912
|
-
}, []), O =
|
|
3913
|
-
|
|
3837
|
+
}, []), O = V((e) => {
|
|
3838
|
+
C((t) => ({
|
|
3914
3839
|
...t,
|
|
3915
3840
|
userPrompt: e
|
|
3916
3841
|
}));
|
|
3917
|
-
}, []), k =
|
|
3918
|
-
if (
|
|
3919
|
-
|
|
3842
|
+
}, []), k = V(async () => {
|
|
3843
|
+
if (S.userPrompt.trim()) {
|
|
3844
|
+
C((e) => ({
|
|
3920
3845
|
...e,
|
|
3921
3846
|
isGenerating: !0,
|
|
3922
3847
|
error: null
|
|
3923
3848
|
}));
|
|
3924
3849
|
try {
|
|
3925
|
-
let e =
|
|
3926
|
-
if (
|
|
3927
|
-
s.setAnalysisType("funnel"), T(i), s.setChartType("funnel"), o && s.setChartConfig(o), s.setActiveView("chart"),
|
|
3850
|
+
let e = sr(await or("", S.userPrompt, r, c?.headers)), n = JSON.parse(e), i = "query" in n && n.query ? n.query : n, a = "chartType" in n ? n.chartType : void 0, o = "chartConfig" in n ? n.chartConfig : void 0;
|
|
3851
|
+
if (cr(i)) {
|
|
3852
|
+
s.setAnalysisType("funnel"), T(i), s.setChartType("funnel"), o && s.setChartConfig(o), s.setActiveView("chart"), C((e) => ({
|
|
3928
3853
|
...e,
|
|
3929
3854
|
isGenerating: !1,
|
|
3930
3855
|
hasGeneratedQuery: !0
|
|
@@ -3935,16 +3860,16 @@ function cr(e) {
|
|
|
3935
3860
|
w((e) => ({
|
|
3936
3861
|
...e,
|
|
3937
3862
|
metrics: (l.measures || []).map((e, t) => ({
|
|
3938
|
-
id:
|
|
3863
|
+
id: p(),
|
|
3939
3864
|
field: e,
|
|
3940
|
-
label:
|
|
3865
|
+
label: d(t)
|
|
3941
3866
|
})),
|
|
3942
3867
|
breakdowns: [...(l.dimensions || []).map((e) => ({
|
|
3943
|
-
id:
|
|
3868
|
+
id: p(),
|
|
3944
3869
|
field: e,
|
|
3945
3870
|
isTimeDimension: !1
|
|
3946
3871
|
})), ...(l.timeDimensions || []).map((e) => ({
|
|
3947
|
-
id:
|
|
3872
|
+
id: p(),
|
|
3948
3873
|
field: e.dimension,
|
|
3949
3874
|
granularity: e.granularity,
|
|
3950
3875
|
isTimeDimension: !0
|
|
@@ -3952,13 +3877,13 @@ function cr(e) {
|
|
|
3952
3877
|
filters: l.filters || [],
|
|
3953
3878
|
order: l.order || void 0,
|
|
3954
3879
|
limit: l.limit ?? void 0
|
|
3955
|
-
})), t.analysisType === "funnel" && s.setAnalysisType("query"), a && s.setChartType(a), o && s.setChartConfig(o), s.setActiveView("chart"),
|
|
3880
|
+
})), t.analysisType === "funnel" && s.setAnalysisType("query"), a && s.setChartType(a), o && s.setChartConfig(o), s.setActiveView("chart"), C((e) => ({
|
|
3956
3881
|
...e,
|
|
3957
3882
|
isGenerating: !1,
|
|
3958
3883
|
hasGeneratedQuery: !0
|
|
3959
3884
|
}));
|
|
3960
3885
|
} catch (e) {
|
|
3961
|
-
|
|
3886
|
+
C((t) => ({
|
|
3962
3887
|
...t,
|
|
3963
3888
|
isGenerating: !1,
|
|
3964
3889
|
error: e instanceof Error ? e.message : "Failed to generate query"
|
|
@@ -3966,15 +3891,15 @@ function cr(e) {
|
|
|
3966
3891
|
}
|
|
3967
3892
|
}
|
|
3968
3893
|
}, [
|
|
3969
|
-
|
|
3894
|
+
S.userPrompt,
|
|
3970
3895
|
r,
|
|
3971
3896
|
c?.headers,
|
|
3972
3897
|
w,
|
|
3973
3898
|
T,
|
|
3974
3899
|
t.analysisType,
|
|
3975
3900
|
s
|
|
3976
|
-
]),
|
|
3977
|
-
|
|
3901
|
+
]), ee = V(() => {
|
|
3902
|
+
C({
|
|
3978
3903
|
isOpen: !1,
|
|
3979
3904
|
userPrompt: "",
|
|
3980
3905
|
isGenerating: !1,
|
|
@@ -3983,13 +3908,13 @@ function cr(e) {
|
|
|
3983
3908
|
previousState: null,
|
|
3984
3909
|
previousConfig: null
|
|
3985
3910
|
});
|
|
3986
|
-
}, []),
|
|
3987
|
-
|
|
3911
|
+
}, []), A = V(() => {
|
|
3912
|
+
S.previousConfig ? o.getState().load(S.previousConfig) : S.previousState && (w((e) => ({
|
|
3988
3913
|
...e,
|
|
3989
|
-
metrics:
|
|
3990
|
-
breakdowns:
|
|
3991
|
-
filters:
|
|
3992
|
-
})), s.setChartType(
|
|
3914
|
+
metrics: S.previousState.metrics,
|
|
3915
|
+
breakdowns: S.previousState.breakdowns,
|
|
3916
|
+
filters: S.previousState.filters
|
|
3917
|
+
})), s.setChartType(S.previousState.chartType), s.setChartConfig(S.previousState.chartConfig), s.setDisplayConfig(S.previousState.displayConfig), S.previousState.analysisType && s.setAnalysisType(S.previousState.analysisType)), C({
|
|
3993
3918
|
isOpen: !1,
|
|
3994
3919
|
userPrompt: "",
|
|
3995
3920
|
isGenerating: !1,
|
|
@@ -3999,24 +3924,24 @@ function cr(e) {
|
|
|
3999
3924
|
previousConfig: null
|
|
4000
3925
|
});
|
|
4001
3926
|
}, [
|
|
4002
|
-
|
|
4003
|
-
|
|
3927
|
+
S.previousState,
|
|
3928
|
+
S.previousConfig,
|
|
4004
3929
|
o,
|
|
4005
3930
|
w,
|
|
4006
3931
|
s
|
|
4007
|
-
]), [te, ne] =
|
|
3932
|
+
]), [te, ne] = G("idle"), j = t.effectiveIsValidQuery;
|
|
4008
3933
|
return {
|
|
4009
|
-
aiState:
|
|
3934
|
+
aiState: S,
|
|
4010
3935
|
openAI: E,
|
|
4011
3936
|
closeAI: D,
|
|
4012
3937
|
setAIPrompt: O,
|
|
4013
3938
|
generateAI: k,
|
|
4014
|
-
acceptAI:
|
|
4015
|
-
cancelAI:
|
|
3939
|
+
acceptAI: ee,
|
|
3940
|
+
cancelAI: A,
|
|
4016
3941
|
shareButtonState: te,
|
|
4017
|
-
share:
|
|
3942
|
+
share: V(async () => {
|
|
4018
3943
|
if (!j) return;
|
|
4019
|
-
let { encoded: e, queryOnly: t } =
|
|
3944
|
+
let { encoded: e, queryOnly: t } = tr(o.getState().save());
|
|
4020
3945
|
if (!e) return;
|
|
4021
3946
|
let n = `${window.location.origin}${window.location.pathname}#share=${e}`;
|
|
4022
3947
|
try {
|
|
@@ -4034,8 +3959,8 @@ function cr(e) {
|
|
|
4034
3959
|
}
|
|
4035
3960
|
//#endregion
|
|
4036
3961
|
//#region src/client/hooks/useAnalysisBuilderHook.ts
|
|
4037
|
-
function
|
|
4038
|
-
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o =
|
|
3962
|
+
function ur(e = {}) {
|
|
3963
|
+
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o = Vn({ externalColorPalette: n }), c = Jn({
|
|
4039
3964
|
currentQuery: o.currentQuery,
|
|
4040
3965
|
allQueries: o.allQueries,
|
|
4041
3966
|
multiQueryConfig: o.multiQueryConfig,
|
|
@@ -4050,7 +3975,7 @@ function lr(e = {}) {
|
|
|
4050
3975
|
serverFlowQuery: o.serverFlowQuery,
|
|
4051
3976
|
serverRetentionQuery: o.serverRetentionQuery,
|
|
4052
3977
|
retentionValidation: o.retentionValidation
|
|
4053
|
-
}), l =
|
|
3978
|
+
}), l = lr({
|
|
4054
3979
|
state: o,
|
|
4055
3980
|
query: c,
|
|
4056
3981
|
aiEndpoint: a?.aiEndpoint,
|
|
@@ -4225,7 +4150,7 @@ function lr(e = {}) {
|
|
|
4225
4150
|
}
|
|
4226
4151
|
//#endregion
|
|
4227
4152
|
//#region src/client/utils/funnelValidation.ts
|
|
4228
|
-
function
|
|
4153
|
+
function dr(e, t) {
|
|
4229
4154
|
let n = [];
|
|
4230
4155
|
if (!t?.cubes) return n;
|
|
4231
4156
|
if (typeof e.dimension == "string") {
|
|
@@ -4249,7 +4174,7 @@ function ur(e, t) {
|
|
|
4249
4174
|
}
|
|
4250
4175
|
return n;
|
|
4251
4176
|
}
|
|
4252
|
-
function
|
|
4177
|
+
function fr(e) {
|
|
4253
4178
|
let t = [];
|
|
4254
4179
|
for (let n = 0; n < e.length; n++) {
|
|
4255
4180
|
let r = e[n], i = r.query;
|
|
@@ -4261,17 +4186,17 @@ function dr(e) {
|
|
|
4261
4186
|
}
|
|
4262
4187
|
return t;
|
|
4263
4188
|
}
|
|
4264
|
-
function
|
|
4189
|
+
function pr(e, t) {
|
|
4265
4190
|
if (typeof e.dimension == "string") return !0;
|
|
4266
|
-
let n =
|
|
4191
|
+
let n = me(t);
|
|
4267
4192
|
return n ? e.dimension.some((e) => e.cube === n) : !1;
|
|
4268
4193
|
}
|
|
4269
|
-
function
|
|
4194
|
+
function mr(e, t) {
|
|
4270
4195
|
let n = [];
|
|
4271
4196
|
for (let r = 0; r < t.length; r++) {
|
|
4272
4197
|
let i = t[r];
|
|
4273
|
-
if (!
|
|
4274
|
-
let e =
|
|
4198
|
+
if (!pr(e, i.query)) {
|
|
4199
|
+
let e = me(i.query) || "unknown";
|
|
4275
4200
|
n.push({
|
|
4276
4201
|
type: "cross_cube",
|
|
4277
4202
|
message: `Step ${r + 1} uses cube "${e}" but no binding key mapping exists for it`,
|
|
@@ -4281,26 +4206,26 @@ function pr(e, t) {
|
|
|
4281
4206
|
}
|
|
4282
4207
|
return n;
|
|
4283
4208
|
}
|
|
4284
|
-
function
|
|
4209
|
+
function hr(e) {
|
|
4285
4210
|
return e ? /^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/.test(e) ? null : {
|
|
4286
4211
|
type: "time_window",
|
|
4287
4212
|
message: `Invalid time window format "${e}". Expected ISO 8601 duration (e.g., P7D, PT1H)`
|
|
4288
4213
|
} : null;
|
|
4289
4214
|
}
|
|
4290
|
-
function
|
|
4215
|
+
function gr(e, t) {
|
|
4291
4216
|
let n = [], r = [];
|
|
4292
4217
|
e.steps.length < 2 && n.push({
|
|
4293
4218
|
type: "general",
|
|
4294
4219
|
message: "Funnel requires at least 2 steps"
|
|
4295
|
-
}), e.bindingKey?.dimension ? (n.push(...
|
|
4220
|
+
}), e.bindingKey?.dimension ? (n.push(...dr(e.bindingKey, t)), n.push(...mr(e.bindingKey, e.steps))) : n.push({
|
|
4296
4221
|
type: "binding_key",
|
|
4297
4222
|
message: "Binding key dimension is required"
|
|
4298
|
-
}), n.push(...
|
|
4223
|
+
}), n.push(...fr(e.steps));
|
|
4299
4224
|
for (let t = 0; t < e.steps.length; t++) {
|
|
4300
|
-
let r = e.steps[t], i =
|
|
4225
|
+
let r = e.steps[t], i = hr(r.timeToConvert);
|
|
4301
4226
|
i && (i.stepIndex = t, n.push(i));
|
|
4302
4227
|
}
|
|
4303
|
-
let i =
|
|
4228
|
+
let i = hr(e.globalTimeWindow);
|
|
4304
4229
|
return i && n.push(i), e.steps.length > 5 && r.push({
|
|
4305
4230
|
type: "general",
|
|
4306
4231
|
message: "Funnels with more than 5 steps may have reduced performance"
|
|
@@ -4310,7 +4235,7 @@ function hr(e, t) {
|
|
|
4310
4235
|
warnings: r
|
|
4311
4236
|
};
|
|
4312
4237
|
}
|
|
4313
|
-
function
|
|
4238
|
+
function _r(e, t) {
|
|
4314
4239
|
return t < 2 ? {
|
|
4315
4240
|
isValid: !1,
|
|
4316
4241
|
message: "Add at least 2 steps for funnel"
|
|
@@ -4319,7 +4244,7 @@ function gr(e, t) {
|
|
|
4319
4244
|
message: "Select a binding key dimension"
|
|
4320
4245
|
} : { isValid: !0 };
|
|
4321
4246
|
}
|
|
4322
|
-
function
|
|
4247
|
+
function vr(e) {
|
|
4323
4248
|
if (!e?.cubes) return [];
|
|
4324
4249
|
let t = [];
|
|
4325
4250
|
for (let n of e.cubes) if (n.dimensions) for (let e of n.dimensions) (e.type === "string" || e.type === "number") && t.push({
|
|
@@ -4329,7 +4254,7 @@ function _r(e) {
|
|
|
4329
4254
|
});
|
|
4330
4255
|
return t;
|
|
4331
4256
|
}
|
|
4332
|
-
function
|
|
4257
|
+
function yr(e) {
|
|
4333
4258
|
if (!e?.dimension) return "Select binding key...";
|
|
4334
4259
|
if (typeof e.dimension == "string") return e.dimension.split(".")[1] || e.dimension;
|
|
4335
4260
|
if (e.dimension.length > 0) {
|
|
@@ -4339,6 +4264,6 @@ function vr(e) {
|
|
|
4339
4264
|
return "Select binding key...";
|
|
4340
4265
|
}
|
|
4341
4266
|
//#endregion
|
|
4342
|
-
export {
|
|
4267
|
+
export { On as A, Tn as C, An as D, En as E, Ye as F, Sn as M, It as N, wn as O, it as P, xn as S, Cn as T, Bn as _, mr as a, In as b, ur as c, nr as d, er as f, Pn as g, Fn as h, dr as i, $ as j, kn as k, Qn as l, ar as m, yr as n, gr as o, rr as p, _r as r, fr as s, vr as t, $n as u, Rn as v, Dn as w, Mn as x, Nn as y };
|
|
4343
4268
|
|
|
4344
|
-
//# sourceMappingURL=analysis-builder-shared-
|
|
4269
|
+
//# sourceMappingURL=analysis-builder-shared-CD0n2Nb8.js.map
|