drizzle-cube 0.9.7 → 0.9.8
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/ActivityGridChart.config-BGndyZtr.cjs +1 -0
- package/dist/adapters/ActivityGridChart.config-ZdvHJAHq.js +2 -0
- package/dist/adapters/AreaChart.config-Cybigwcb.js +2 -0
- package/dist/adapters/AreaChart.config-DWGesxUg.cjs +1 -0
- package/dist/adapters/BarChart.config-Cc04tVQF.js +2 -0
- package/dist/adapters/BarChart.config-DBCu0t_-.cjs +1 -0
- package/dist/adapters/BoxPlotChart.config-C0WK_ipa.cjs +1 -0
- package/dist/adapters/BoxPlotChart.config-DapOUN_R.js +2 -0
- package/dist/adapters/BubbleChart.config-DPmf7sI5.cjs +1 -0
- package/dist/adapters/BubbleChart.config-DROSTwxW.js +2 -0
- package/dist/adapters/CandlestickChart.config-BHoEJ2nY.js +2 -0
- package/dist/adapters/CandlestickChart.config-Cm0PKObO.cjs +1 -0
- package/dist/adapters/DataTable.config-DLvfXXSH.cjs +1 -0
- package/dist/adapters/DataTable.config-DbVrWZIw.js +2 -0
- package/dist/adapters/DotStripChart.config-CKPw82HE.js +2 -0
- package/dist/adapters/DotStripChart.config-DPIrTLb6.cjs +1 -0
- package/dist/adapters/FunnelChart.config-DpiDbOTn.cjs +1 -0
- package/dist/adapters/FunnelChart.config-DtBHVpLB.js +2 -0
- package/dist/adapters/GaugeChart.config-CmuXGRNV.js +2 -0
- package/dist/adapters/GaugeChart.config-DLj1YNsp.cjs +1 -0
- package/dist/adapters/HeatMapChart.config-BvFK2bny.cjs +1 -0
- package/dist/adapters/HeatMapChart.config-DK18zZV8.js +2 -0
- package/dist/adapters/KpiDelta.config-BsaVN5-T.js +2 -0
- package/dist/adapters/KpiDelta.config-DHsMgIdk.cjs +1 -0
- package/dist/adapters/KpiNumber.config-D82-j-8T.js +2 -0
- package/dist/adapters/KpiNumber.config-pFRomJRE.cjs +1 -0
- package/dist/adapters/KpiText.config-CCqeKuFB.js +2 -0
- package/dist/adapters/KpiText.config-CSeCoBuO.cjs +1 -0
- package/dist/adapters/LineChart.config-C2acjFv4.js +2 -0
- package/dist/adapters/LineChart.config-Dr9wmiK0.cjs +1 -0
- package/dist/adapters/MarkdownChart.config-C-tYLLan.js +2 -0
- package/dist/adapters/MarkdownChart.config-Dvyfo0CB.cjs +1 -0
- package/dist/adapters/MeasureProfileChart.config-C5CjPw48.js +2 -0
- package/dist/adapters/MeasureProfileChart.config-Dj-7HqkS.cjs +1 -0
- package/dist/adapters/PieChart.config-CY7nFFQn.cjs +1 -0
- package/dist/adapters/PieChart.config-DQLQMHc_.js +2 -0
- package/dist/adapters/ProportionBarChart.config-BVqtS7wi.cjs +1 -0
- package/dist/adapters/ProportionBarChart.config-BaSgs976.js +2 -0
- package/dist/adapters/RadarChart.config-DxJ5k8L9.cjs +1 -0
- package/dist/adapters/RadarChart.config-DzL7zQUc.js +2 -0
- package/dist/adapters/RadialBarChart.config-Dzl1HiGz.js +2 -0
- package/dist/adapters/RadialBarChart.config-XlGTd9gV.cjs +1 -0
- package/dist/adapters/RecordsTable.config-CS5oIMvv.js +2 -0
- package/dist/adapters/RecordsTable.config-DRQdHghk.cjs +1 -0
- package/dist/adapters/RetentionCombinedChart.config-C0iiKOdf.js +2 -0
- package/dist/adapters/RetentionCombinedChart.config-Dl20GZnb.cjs +1 -0
- package/dist/adapters/RetentionHeatmap.config-Bt42ip_c.js +2 -0
- package/dist/adapters/RetentionHeatmap.config-DyggEvyy.cjs +1 -0
- package/dist/adapters/SankeyChart.config-DYz1nUx9.js +2 -0
- package/dist/adapters/SankeyChart.config-dlNLJMf9.cjs +1 -0
- package/dist/adapters/ScatterChart.config-D72zRviD.js +2 -0
- package/dist/adapters/ScatterChart.config-DRtyuQvV.cjs +1 -0
- package/dist/adapters/SunburstChart.config-C5nHXLcu.cjs +1 -0
- package/dist/adapters/SunburstChart.config-j5ioABeT.js +2 -0
- package/dist/adapters/TreeMapChart.config-CXKcX5CH.js +2 -0
- package/dist/adapters/TreeMapChart.config-DuYbme03.cjs +1 -0
- package/dist/adapters/WaterfallChart.config-BCn4tsBV.cjs +1 -0
- package/dist/adapters/WaterfallChart.config-BPqhdzTP.js +2 -0
- 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/{handler-DtX1YNOn.js → handler-CknKLUQW.js} +30 -30
- package/dist/adapters/{handler-CTSg1daG.cjs → handler-DLWgxPOk.cjs} +2 -2
- 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.js +1 -1
- package/dist/adapters/openai-CDH_AU_Z.cjs +19 -0
- package/dist/adapters/{openai-CWnhWp3I.js → openai-CYTlIdxS.js} +1 -1
- package/dist/adapters/{openai-BwtOIJIk.cjs → openai-KbobaAQj.cjs} +1 -1
- package/dist/adapters/{openai-Dqrs3PGo.js → openai-enh3Hkzr.js} +507 -436
- package/dist/cjs/client/components/shared/dateRangeUtils.d.ts +7 -3
- package/dist/client/chunks/{DashboardEditModal-DfaeSZGf.js → DashboardEditModal-CiN77tQN.js} +652 -530
- package/dist/client/chunks/DashboardEditModal-CiN77tQN.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-fPK8NgJW.js → analysis-builder-DIOnKxJu.js} +36 -36
- package/dist/client/chunks/{analysis-builder-fPK8NgJW.js.map → analysis-builder-DIOnKxJu.js.map} +1 -1
- package/dist/client/chunks/{analysis-builder-shared--4LqPSum.js → analysis-builder-shared-CoX_nmo0.js} +747 -939
- package/dist/client/chunks/analysis-builder-shared-CoX_nmo0.js.map +1 -0
- package/dist/client/chunks/chart-data-table-BdMo3zVh.js.map +1 -1
- package/dist/client/components/shared/dateRangeUtils.d.ts +7 -3
- package/dist/client/components.js +2 -2
- package/dist/client/index.js +7 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/{openai-D346-vmt.cjs → openai-BIHkBS7X.cjs} +1 -1
- package/dist/server/{openai-SILGL2q_.js → openai-CPW5x6kl.js} +1 -1
- package/dist/server/{openai-D0vh48Oi.js → openai-DCC49vC6.js} +507 -436
- package/dist/server/openai-xQRpdAPa.cjs +19 -0
- package/package.json +3 -3
- package/dist/adapters/ActivityGridChart.config-C2kT9qd6.cjs +0 -1
- package/dist/adapters/ActivityGridChart.config-Crkwyx_5.js +0 -2
- package/dist/adapters/AreaChart.config-Cn4fTDQH.js +0 -2
- package/dist/adapters/AreaChart.config-DSBAn4xT.cjs +0 -1
- package/dist/adapters/BarChart.config-2r2_F09O.cjs +0 -1
- package/dist/adapters/BarChart.config-CorT50Sr.js +0 -2
- package/dist/adapters/BoxPlotChart.config-BM4SbL34.cjs +0 -1
- package/dist/adapters/BoxPlotChart.config-Dki3qfhN.js +0 -2
- package/dist/adapters/BubbleChart.config-DA768T1u.cjs +0 -1
- package/dist/adapters/BubbleChart.config-LJ2w0ZAz.js +0 -2
- package/dist/adapters/CandlestickChart.config-C00YG927.cjs +0 -1
- package/dist/adapters/CandlestickChart.config-D-vVDHaQ.js +0 -2
- package/dist/adapters/DataTable.config-Ml6Q3VEP.cjs +0 -1
- package/dist/adapters/DataTable.config-jwBiAUpg.js +0 -2
- package/dist/adapters/DotStripChart.config-C_dgJFje.js +0 -2
- package/dist/adapters/DotStripChart.config-D5M4xxNE.cjs +0 -1
- package/dist/adapters/FunnelChart.config-DBkjp0wh.js +0 -2
- package/dist/adapters/FunnelChart.config-Jc6DVjCx.cjs +0 -1
- package/dist/adapters/GaugeChart.config-BqW6WqXS.cjs +0 -1
- package/dist/adapters/GaugeChart.config-CyD4y_yf.js +0 -2
- package/dist/adapters/HeatMapChart.config-C_TKjH9_.cjs +0 -1
- package/dist/adapters/HeatMapChart.config-Di1KFl9H.js +0 -2
- package/dist/adapters/KpiDelta.config-qlIY4kju.js +0 -2
- package/dist/adapters/KpiDelta.config-zaqkGeS2.cjs +0 -1
- package/dist/adapters/KpiNumber.config-D1hq68b3.cjs +0 -1
- package/dist/adapters/KpiNumber.config-D9LpXMmo.js +0 -2
- package/dist/adapters/KpiText.config-BBBV_4aK.cjs +0 -1
- package/dist/adapters/KpiText.config-pqFid-lb.js +0 -2
- package/dist/adapters/LineChart.config-CFGa_jpk.js +0 -2
- package/dist/adapters/LineChart.config-DRTr24Jl.cjs +0 -1
- package/dist/adapters/MarkdownChart.config--Teyo7aa.cjs +0 -1
- package/dist/adapters/MarkdownChart.config-Cnptz8gx.js +0 -2
- package/dist/adapters/MeasureProfileChart.config-BlAnkNf6.js +0 -2
- package/dist/adapters/MeasureProfileChart.config-c4K6xVET.cjs +0 -1
- package/dist/adapters/PieChart.config-BX5FcoZn.cjs +0 -1
- package/dist/adapters/PieChart.config-DT1TCBFA.js +0 -2
- package/dist/adapters/ProportionBarChart.config-CN5ov6e6.js +0 -2
- package/dist/adapters/ProportionBarChart.config-DdrZQypv.cjs +0 -1
- package/dist/adapters/RadarChart.config-CYpWy1MI.js +0 -2
- package/dist/adapters/RadarChart.config-Cm14F-JW.cjs +0 -1
- package/dist/adapters/RadialBarChart.config-BXEmrEW0.js +0 -2
- package/dist/adapters/RadialBarChart.config-bJL8ZwT5.cjs +0 -1
- package/dist/adapters/RecordsTable.config-BifW_6cA.cjs +0 -1
- package/dist/adapters/RecordsTable.config-DOu5dLR9.js +0 -2
- package/dist/adapters/RetentionCombinedChart.config-BLTS46q4.js +0 -2
- package/dist/adapters/RetentionCombinedChart.config-DkIUp-uU.cjs +0 -1
- package/dist/adapters/RetentionHeatmap.config-Csnntt4P.js +0 -2
- package/dist/adapters/RetentionHeatmap.config-Xljn01Px.cjs +0 -1
- package/dist/adapters/SankeyChart.config-BExGzO93.cjs +0 -1
- package/dist/adapters/SankeyChart.config-DEBF3E7J.js +0 -2
- package/dist/adapters/ScatterChart.config-B9fxyVl8.cjs +0 -1
- package/dist/adapters/ScatterChart.config-CNWNsjv_.js +0 -2
- package/dist/adapters/SunburstChart.config-DyBJr_Ah.js +0 -2
- package/dist/adapters/SunburstChart.config-vXKPV3lF.cjs +0 -1
- package/dist/adapters/TreeMapChart.config-CoXSasFP.js +0 -2
- package/dist/adapters/TreeMapChart.config-iq-fCkIZ.cjs +0 -1
- package/dist/adapters/WaterfallChart.config-Coyj2j_7.cjs +0 -1
- package/dist/adapters/WaterfallChart.config-Dyf-p2Z2.js +0 -2
- package/dist/adapters/openai-ClwjvwzT.cjs +0 -19
- package/dist/client/chunks/DashboardEditModal-DfaeSZGf.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared--4LqPSum.js.map +0 -1
- package/dist/server/openai-C6tdx3yN.cjs +0 -19
|
@@ -1,225 +1,33 @@
|
|
|
1
1
|
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-DeckzF1j.js";
|
|
2
2
|
import { A as s, B as c, d as l, u, y as d } from "./chart-data-table-BdMo3zVh.js";
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { O as
|
|
6
|
-
import { A as
|
|
7
|
-
import { B as
|
|
8
|
-
import { a as
|
|
9
|
-
import { r as
|
|
10
|
-
import { n as
|
|
11
|
-
import B, { createContext as
|
|
12
|
-
import { Fragment as
|
|
13
|
-
//#region src/shared/date-utils.ts
|
|
14
|
-
var xe = (e) => {
|
|
15
|
-
let t = new Date(e);
|
|
16
|
-
return t.setUTCHours(0, 0, 0, 0), t;
|
|
17
|
-
}, J = (e) => {
|
|
18
|
-
let t = new Date(e);
|
|
19
|
-
return t.setUTCHours(23, 59, 59, 999), t;
|
|
20
|
-
}, Se = {
|
|
21
|
-
today: ({ now: e }) => ({
|
|
22
|
-
start: xe(e),
|
|
23
|
-
end: J(e)
|
|
24
|
-
}),
|
|
25
|
-
yesterday: ({ now: e, utcDate: t }) => {
|
|
26
|
-
let n = new Date(e);
|
|
27
|
-
n.setUTCDate(t - 1), n.setUTCHours(0, 0, 0, 0);
|
|
28
|
-
let r = new Date(e);
|
|
29
|
-
return r.setUTCDate(t - 1), r.setUTCHours(23, 59, 59, 999), {
|
|
30
|
-
start: n,
|
|
31
|
-
end: r
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
"this week": ({ now: e, utcDate: t, utcDay: n }) => {
|
|
35
|
-
let r = n === 0 ? -6 : 1 - n, i = new Date(e);
|
|
36
|
-
i.setUTCDate(t + r), i.setUTCHours(0, 0, 0, 0);
|
|
37
|
-
let a = new Date(i);
|
|
38
|
-
return a.setUTCDate(i.getUTCDate() + 6), a.setUTCHours(23, 59, 59, 999), {
|
|
39
|
-
start: i,
|
|
40
|
-
end: a
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
"this month": ({ utcYear: e, utcMonth: t }) => ({
|
|
44
|
-
start: new Date(Date.UTC(e, t, 1, 0, 0, 0, 0)),
|
|
45
|
-
end: new Date(Date.UTC(e, t + 1, 0, 23, 59, 59, 999))
|
|
46
|
-
}),
|
|
47
|
-
"this quarter": ({ utcYear: e, utcMonth: t }) => {
|
|
48
|
-
let n = Math.floor(t / 3);
|
|
49
|
-
return {
|
|
50
|
-
start: new Date(Date.UTC(e, n * 3, 1, 0, 0, 0, 0)),
|
|
51
|
-
end: new Date(Date.UTC(e, n * 3 + 3, 0, 23, 59, 59, 999))
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
"this year": ({ utcYear: e }) => ({
|
|
55
|
-
start: new Date(Date.UTC(e, 0, 1, 0, 0, 0, 0)),
|
|
56
|
-
end: new Date(Date.UTC(e, 11, 31, 23, 59, 59, 999))
|
|
57
|
-
}),
|
|
58
|
-
"last week": ({ now: e, utcDate: t, utcDay: n }) => {
|
|
59
|
-
let r = n === 0 ? -13 : -6 - n, i = new Date(e);
|
|
60
|
-
i.setUTCDate(t + r), i.setUTCHours(0, 0, 0, 0);
|
|
61
|
-
let a = new Date(i);
|
|
62
|
-
return a.setUTCDate(i.getUTCDate() + 6), a.setUTCHours(23, 59, 59, 999), {
|
|
63
|
-
start: i,
|
|
64
|
-
end: a
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
"last month": ({ utcYear: e, utcMonth: t }) => ({
|
|
68
|
-
start: new Date(Date.UTC(e, t - 1, 1, 0, 0, 0, 0)),
|
|
69
|
-
end: new Date(Date.UTC(e, t, 0, 23, 59, 59, 999))
|
|
70
|
-
}),
|
|
71
|
-
"last quarter": ({ utcYear: e, utcMonth: t }) => {
|
|
72
|
-
let n = Math.floor(t / 3), r = n === 0 ? 3 : n - 1, i = n === 0 ? e - 1 : e;
|
|
73
|
-
return {
|
|
74
|
-
start: new Date(Date.UTC(i, r * 3, 1, 0, 0, 0, 0)),
|
|
75
|
-
end: new Date(Date.UTC(i, r * 3 + 3, 0, 23, 59, 59, 999))
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
"last year": ({ utcYear: e }) => ({
|
|
79
|
-
start: new Date(Date.UTC(e - 1, 0, 1, 0, 0, 0, 0)),
|
|
80
|
-
end: new Date(Date.UTC(e - 1, 11, 31, 23, 59, 59, 999))
|
|
81
|
-
}),
|
|
82
|
-
"last 12 months": ({ now: e, utcYear: t, utcMonth: n }) => ({
|
|
83
|
-
start: new Date(Date.UTC(t, n - 11, 1, 0, 0, 0, 0)),
|
|
84
|
-
end: J(e)
|
|
85
|
-
})
|
|
86
|
-
}, Ce = [
|
|
87
|
-
{
|
|
88
|
-
re: /^last\s+(\d+)\s+days?$/,
|
|
89
|
-
build: (e, { now: t, utcDate: n }) => {
|
|
90
|
-
let r = new Date(t);
|
|
91
|
-
return r.setUTCDate(n - e + 1), r.setUTCHours(0, 0, 0, 0), {
|
|
92
|
-
start: r,
|
|
93
|
-
end: J(t)
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
re: /^last\s+(\d+)\s+weeks?$/,
|
|
99
|
-
build: (e, { now: t, utcDate: n }) => {
|
|
100
|
-
let r = new Date(t);
|
|
101
|
-
return r.setUTCDate(n - e * 7 + 1), r.setUTCHours(0, 0, 0, 0), {
|
|
102
|
-
start: r,
|
|
103
|
-
end: J(t)
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
re: /^last\s+(\d+)\s+months?$/,
|
|
109
|
-
build: (e, { now: t, utcYear: n, utcMonth: r }) => ({
|
|
110
|
-
start: new Date(Date.UTC(n, r - e + 1, 1, 0, 0, 0, 0)),
|
|
111
|
-
end: J(t)
|
|
112
|
-
})
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
re: /^last\s+(\d+)\s+quarters?$/,
|
|
116
|
-
build: (e, { now: t, utcYear: n, utcMonth: r }) => ({
|
|
117
|
-
start: new Date(Date.UTC(n, (Math.floor(r / 3) - e + 1) * 3, 1, 0, 0, 0, 0)),
|
|
118
|
-
end: J(t)
|
|
119
|
-
})
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
re: /^last\s+(\d+)\s+years?$/,
|
|
123
|
-
build: (e, { now: t, utcYear: n }) => ({
|
|
124
|
-
start: new Date(Date.UTC(n - e, 0, 1, 0, 0, 0, 0)),
|
|
125
|
-
end: J(t)
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
], we = ({ now: e, utcDate: t, utcDay: n }) => {
|
|
129
|
-
let r = new Date(e);
|
|
130
|
-
return r.setUTCDate(t + (n === 0 ? -6 : 1 - n)), r.setUTCHours(0, 0, 0, 0), r;
|
|
131
|
-
}, Te = {
|
|
132
|
-
tomorrow: ({ now: e, utcDate: t }) => {
|
|
133
|
-
let n = new Date(e);
|
|
134
|
-
n.setUTCDate(t + 1), n.setUTCHours(0, 0, 0, 0);
|
|
135
|
-
let r = new Date(n);
|
|
136
|
-
return r.setUTCHours(23, 59, 59, 999), {
|
|
137
|
-
start: n,
|
|
138
|
-
end: r
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
"next week": (e) => {
|
|
142
|
-
let t = we(e);
|
|
143
|
-
t.setUTCDate(t.getUTCDate() + 7);
|
|
144
|
-
let n = new Date(t);
|
|
145
|
-
return n.setUTCDate(t.getUTCDate() + 6), n.setUTCHours(23, 59, 59, 999), {
|
|
146
|
-
start: t,
|
|
147
|
-
end: n
|
|
148
|
-
};
|
|
149
|
-
},
|
|
150
|
-
"next month": ({ utcYear: e, utcMonth: t }) => ({
|
|
151
|
-
start: new Date(Date.UTC(e, t + 1, 1, 0, 0, 0, 0)),
|
|
152
|
-
end: new Date(Date.UTC(e, t + 2, 0, 23, 59, 59, 999))
|
|
153
|
-
}),
|
|
154
|
-
"next quarter": ({ utcYear: e, utcMonth: t }) => {
|
|
155
|
-
let n = (Math.floor(t / 3) + 1) * 3;
|
|
156
|
-
return {
|
|
157
|
-
start: new Date(Date.UTC(e, n, 1, 0, 0, 0, 0)),
|
|
158
|
-
end: new Date(Date.UTC(e, n + 3, 0, 23, 59, 59, 999))
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
"next year": ({ utcYear: e }) => ({
|
|
162
|
-
start: new Date(Date.UTC(e + 1, 0, 1, 0, 0, 0, 0)),
|
|
163
|
-
end: new Date(Date.UTC(e + 1, 11, 31, 23, 59, 59, 999))
|
|
164
|
-
})
|
|
165
|
-
};
|
|
166
|
-
function Ee(e) {
|
|
167
|
-
let t = /* @__PURE__ */ new Date(), n = e.toLowerCase().trim(), r = {
|
|
168
|
-
now: t,
|
|
169
|
-
utcYear: t.getUTCFullYear(),
|
|
170
|
-
utcMonth: t.getUTCMonth(),
|
|
171
|
-
utcDate: t.getUTCDate(),
|
|
172
|
-
utcDay: t.getUTCDay()
|
|
173
|
-
}, i = Object.prototype.hasOwnProperty.call(Se, n) ? Se[n] : Object.prototype.hasOwnProperty.call(Te, n) ? Te[n] : void 0;
|
|
174
|
-
if (i) return i(r);
|
|
175
|
-
for (let { re: e, build: t } of Ce) {
|
|
176
|
-
let i = n.match(e);
|
|
177
|
-
if (i) return t(parseInt(i[1], 10), r);
|
|
178
|
-
}
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
function De(e) {
|
|
182
|
-
if (Array.isArray(e)) {
|
|
183
|
-
if (e.length < 2) return null;
|
|
184
|
-
let t = new Date(e[0]), n = new Date(e[1]);
|
|
185
|
-
return isNaN(t.getTime()) || isNaN(n.getTime()) ? null : (n.setUTCHours(23, 59, 59, 999), {
|
|
186
|
-
start: t,
|
|
187
|
-
end: n
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
return Ee(e);
|
|
191
|
-
}
|
|
192
|
-
function Oe(e) {
|
|
193
|
-
return e.toISOString().split("T")[0];
|
|
194
|
-
}
|
|
195
|
-
function ke(e, t) {
|
|
196
|
-
let n = t.getTime() - e.getTime(), r = Math.ceil(n / 864e5), i = new Date(e);
|
|
197
|
-
i.setUTCDate(i.getUTCDate() - 1), i.setUTCHours(23, 59, 59, 999);
|
|
198
|
-
let a = new Date(i);
|
|
199
|
-
return a.setUTCDate(a.getUTCDate() - r + 1), a.setUTCHours(0, 0, 0, 0), {
|
|
200
|
-
start: a,
|
|
201
|
-
end: i
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
//#endregion
|
|
3
|
+
import { A as f, C as p, D as m, E as h, F as g, T as _, _ as v, at as y, b, d as x, f as S, ot as C, st as w, u as T, v as E, w as D, x as O, y as k } from "./DashboardEditModal-CiN77tQN.js";
|
|
4
|
+
import { a as ee, s as A, t as te } from "./retention-ChW9jYdy.js";
|
|
5
|
+
import { O as j, k as M } from "./dashboardExport-Db3rmUP1.js";
|
|
6
|
+
import { A as N, D as ne, F as re, I as ie, M as ae, N as P, O as oe, P as se, S as F, T as I, a as L, d as ce, j as le, k as R, l as ue, n as de, r as fe, s as pe } from "./useDirtyStateTracking-BfG1lX_3.js";
|
|
7
|
+
import { B as me, F as z } from "./chart-activity-grid-DGazwi4C.js";
|
|
8
|
+
import { a as he, i as ge } from "./useExplainAI-CDFhgmpE.js";
|
|
9
|
+
import { r as _e, s as ve } from "./chart-funnel-BRyZS6ie.js";
|
|
10
|
+
import { n as ye } from "./charts-core-CKpkoMCa.js";
|
|
11
|
+
import B, { createContext as be, memo as xe, useCallback as V, useContext as Se, useEffect as H, useMemo as U, useRef as W, useState as G } from "react";
|
|
12
|
+
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
205
13
|
//#region src/client/components/AnalysisBuilder/utils/filterUtils.ts
|
|
206
|
-
function
|
|
207
|
-
let n =
|
|
14
|
+
function Ce(e, t) {
|
|
15
|
+
let n = le(t, e);
|
|
208
16
|
if (!n?.dateRange) return;
|
|
209
|
-
let r =
|
|
17
|
+
let r = _(n.dateRange);
|
|
210
18
|
if (!r) return;
|
|
211
|
-
let i =
|
|
212
|
-
return [[
|
|
19
|
+
let i = p(r.start, r.end);
|
|
20
|
+
return [[D(r.start), D(r.end)], [D(i.start), D(i.end)]];
|
|
213
21
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
22
|
+
function we(e, t) {
|
|
23
|
+
return re(e, t, "inDateRange");
|
|
216
24
|
}
|
|
217
25
|
//#endregion
|
|
218
26
|
//#region src/client/components/AnalysisBuilder/utils/queryUtils.ts
|
|
219
|
-
function
|
|
27
|
+
function Te(e, t, n, r, i = !1, a, o = !1) {
|
|
220
28
|
let s = t.filter((e) => e.isTimeDimension && e.enableComparison).map((e) => e.field), c = n;
|
|
221
|
-
if (!i) for (let e of s) c =
|
|
222
|
-
c = c.filter((e) =>
|
|
29
|
+
if (!i) for (let e of s) c = we(c, e);
|
|
30
|
+
c = c.filter((e) => y(e));
|
|
223
31
|
let l = {
|
|
224
32
|
measures: e.map((e) => e.field),
|
|
225
33
|
dimensions: t.filter((e) => !e.isTimeDimension).map((e) => e.field),
|
|
@@ -229,7 +37,7 @@ function Me(e, t, n, r, i = !1, a, o = !1) {
|
|
|
229
37
|
granularity: e.granularity || "day"
|
|
230
38
|
};
|
|
231
39
|
if (e.enableComparison) {
|
|
232
|
-
let r =
|
|
40
|
+
let r = Ce(e.field, n);
|
|
233
41
|
r && (t.compareDateRange = r);
|
|
234
42
|
}
|
|
235
43
|
return t;
|
|
@@ -254,7 +62,7 @@ function Y() {
|
|
|
254
62
|
}
|
|
255
63
|
//#endregion
|
|
256
64
|
//#region src/client/components/AnalysisBuilder/filterConfigModalUtils.ts
|
|
257
|
-
function
|
|
65
|
+
function Ee(e, t, n, r) {
|
|
258
66
|
if (!t || n === 0) return { type: "none" };
|
|
259
67
|
switch (e) {
|
|
260
68
|
case "ArrowDown": return {
|
|
@@ -275,60 +83,60 @@ function Ne(e, t, n, r) {
|
|
|
275
83
|
}
|
|
276
84
|
//#endregion
|
|
277
85
|
//#region src/client/components/AnalysisBuilder/FilterValueInput.tsx
|
|
278
|
-
var
|
|
279
|
-
function
|
|
86
|
+
var De = d("close"), Oe = d("chevronDown");
|
|
87
|
+
function ke({ filter: e, dateRange: t }) {
|
|
280
88
|
let { t: n } = z(), { rangeType: r, numberValue: i, label: a, isOpen: o, onToggle: s, onRangeTypeChange: c, onNumberValueChange: l, onCustomStartDate: u, onCustomEndDate: d, onOpen: f } = t;
|
|
281
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ J("div", {
|
|
282
90
|
className: "dc:space-y-2",
|
|
283
91
|
children: [
|
|
284
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ J("div", {
|
|
285
93
|
className: "dc:relative",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
94
|
+
children: [/* @__PURE__ */ J("button", {
|
|
287
95
|
onClick: () => {
|
|
288
96
|
f(), s(!o);
|
|
289
97
|
},
|
|
290
98
|
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-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
99
|
+
children: [/* @__PURE__ */ q("span", {
|
|
292
100
|
className: "dc:truncate",
|
|
293
101
|
children: a
|
|
294
|
-
}), /* @__PURE__ */
|
|
295
|
-
}), o && /* @__PURE__ */
|
|
102
|
+
}), /* @__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" : ""}` })]
|
|
103
|
+
}), o && /* @__PURE__ */ q("div", {
|
|
296
104
|
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-sm dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
|
|
297
|
-
children:
|
|
105
|
+
children: E.map((e) => /* @__PURE__ */ q("button", {
|
|
298
106
|
onClick: () => c(e.value),
|
|
299
107
|
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"}`,
|
|
300
108
|
children: n(e.label)
|
|
301
109
|
}, e.value))
|
|
302
110
|
})]
|
|
303
111
|
}),
|
|
304
|
-
|
|
112
|
+
ne(r) && /* @__PURE__ */ J("div", {
|
|
305
113
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
306
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ q("input", {
|
|
307
115
|
type: "number",
|
|
308
116
|
min: "1",
|
|
309
117
|
max: "1000",
|
|
310
118
|
value: i,
|
|
311
119
|
onChange: (e) => l(Math.max(1, parseInt(e.target.value) || 1)),
|
|
312
120
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text dc:w-20"
|
|
313
|
-
}), /* @__PURE__ */
|
|
121
|
+
}), /* @__PURE__ */ q("span", {
|
|
314
122
|
className: "dc:text-sm text-dc-text-muted",
|
|
315
123
|
children: r.replace("last_n_", "")
|
|
316
124
|
})]
|
|
317
125
|
}),
|
|
318
|
-
r === "custom" && /* @__PURE__ */
|
|
126
|
+
r === "custom" && /* @__PURE__ */ J("div", {
|
|
319
127
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
320
128
|
children: [
|
|
321
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ q("input", {
|
|
322
130
|
type: "date",
|
|
323
131
|
value: Array.isArray(e.dateRange) ? e.dateRange[0] : "",
|
|
324
132
|
onChange: u,
|
|
325
133
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-2 dc:py-2 bg-dc-surface text-dc-text"
|
|
326
134
|
}),
|
|
327
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ q("span", {
|
|
328
136
|
className: "dc:text-sm text-dc-text-muted",
|
|
329
137
|
children: n("filter.modal.dateTo")
|
|
330
138
|
}),
|
|
331
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ q("input", {
|
|
332
140
|
type: "date",
|
|
333
141
|
value: Array.isArray(e.dateRange) ? e.dateRange[1] : "",
|
|
334
142
|
onChange: d,
|
|
@@ -339,26 +147,26 @@ function Ie({ filter: e, dateRange: t }) {
|
|
|
339
147
|
]
|
|
340
148
|
});
|
|
341
149
|
}
|
|
342
|
-
function
|
|
150
|
+
function Ae({ filter: e, combo: t }) {
|
|
343
151
|
let { t: n } = z(), { options: r, loading: i, error: a, highlightedIndex: o, listRef: s, onSelect: c } = t;
|
|
344
|
-
return i ? /* @__PURE__ */
|
|
152
|
+
return i ? /* @__PURE__ */ q("div", {
|
|
345
153
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
346
154
|
children: n("filter.modal.loading")
|
|
347
|
-
}) : a ? /* @__PURE__ */
|
|
155
|
+
}) : a ? /* @__PURE__ */ J("div", {
|
|
348
156
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-error",
|
|
349
157
|
children: [n("filter.modal.errorPrefix"), String(a)]
|
|
350
|
-
}) : r.length === 0 ? /* @__PURE__ */
|
|
158
|
+
}) : r.length === 0 ? /* @__PURE__ */ q("div", {
|
|
351
159
|
className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
|
|
352
160
|
children: n("filter.modal.noValues")
|
|
353
|
-
}) : /* @__PURE__ */
|
|
161
|
+
}) : /* @__PURE__ */ q("div", {
|
|
354
162
|
ref: s,
|
|
355
163
|
className: "dc:max-h-40 dc:overflow-y-auto",
|
|
356
164
|
children: r.map((t, n) => {
|
|
357
165
|
let r = e.values?.includes(t);
|
|
358
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ J("button", {
|
|
359
167
|
onClick: (e) => c(t, e),
|
|
360
168
|
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"}`,
|
|
361
|
-
children: [String(t), r && /* @__PURE__ */
|
|
169
|
+
children: [String(t), r && /* @__PURE__ */ q("span", {
|
|
362
170
|
className: "dc:float-right",
|
|
363
171
|
children: "✓"
|
|
364
172
|
})]
|
|
@@ -366,41 +174,41 @@ function Le({ filter: e, combo: t }) {
|
|
|
366
174
|
})
|
|
367
175
|
});
|
|
368
176
|
}
|
|
369
|
-
function
|
|
177
|
+
function je({ filter: e, operatorMeta: t, combo: n }) {
|
|
370
178
|
let { t: r } = z(), { isOpen: i, loading: a, searchText: o, onSearchTextChange: s, onHighlightedIndexChange: c, onRemove: l, onKeyDown: u, onOpen: d } = n;
|
|
371
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ J("div", {
|
|
372
180
|
className: "dc:space-y-2",
|
|
373
181
|
children: [
|
|
374
|
-
e.values && e.values.length > 0 && /* @__PURE__ */
|
|
182
|
+
e.values && e.values.length > 0 && /* @__PURE__ */ q("div", {
|
|
375
183
|
className: "dc:flex dc:flex-wrap dc:gap-1.5",
|
|
376
|
-
children: e.values.map((e, t) => /* @__PURE__ */
|
|
184
|
+
children: e.values.map((e, t) => /* @__PURE__ */ J("span", {
|
|
377
185
|
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-sm",
|
|
378
|
-
children: [/* @__PURE__ */
|
|
186
|
+
children: [/* @__PURE__ */ q("span", {
|
|
379
187
|
className: "dc:max-w-[150px] dc:truncate",
|
|
380
188
|
children: String(e)
|
|
381
|
-
}), /* @__PURE__ */
|
|
189
|
+
}), /* @__PURE__ */ q("button", {
|
|
382
190
|
onClick: () => l(e),
|
|
383
191
|
className: "hover:text-dc-danger",
|
|
384
|
-
children: /* @__PURE__ */
|
|
192
|
+
children: /* @__PURE__ */ q(De, { className: "dc:w-3.5 dc:h-3.5" })
|
|
385
193
|
})]
|
|
386
194
|
}, t))
|
|
387
195
|
}),
|
|
388
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ J("div", {
|
|
389
197
|
className: "dc:relative",
|
|
390
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ J("button", {
|
|
391
199
|
onClick: () => {
|
|
392
200
|
d();
|
|
393
201
|
},
|
|
394
202
|
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-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
395
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ q("span", {
|
|
396
204
|
className: "text-dc-text-muted dc:truncate",
|
|
397
205
|
children: r(a ? "filter.modal.loading" : "filter.modal.selectValue")
|
|
398
|
-
}), /* @__PURE__ */
|
|
399
|
-
}), i && /* @__PURE__ */
|
|
206
|
+
}), /* @__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" : ""}` })]
|
|
207
|
+
}), i && /* @__PURE__ */ J("div", {
|
|
400
208
|
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-sm dc:shadow-lg dc:max-h-56 dc:overflow-hidden",
|
|
401
|
-
children: [/* @__PURE__ */
|
|
209
|
+
children: [/* @__PURE__ */ q("div", {
|
|
402
210
|
className: "dc:p-2 dc:border-b border-dc-border",
|
|
403
|
-
children: /* @__PURE__ */
|
|
211
|
+
children: /* @__PURE__ */ q("input", {
|
|
404
212
|
type: "text",
|
|
405
213
|
value: o,
|
|
406
214
|
onChange: (e) => {
|
|
@@ -411,39 +219,39 @@ function Re({ filter: e, operatorMeta: t, combo: n }) {
|
|
|
411
219
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text",
|
|
412
220
|
autoFocus: !0
|
|
413
221
|
})
|
|
414
|
-
}), /* @__PURE__ */
|
|
222
|
+
}), /* @__PURE__ */ q(Ae, {
|
|
415
223
|
filter: e,
|
|
416
224
|
combo: n
|
|
417
225
|
})]
|
|
418
226
|
})]
|
|
419
227
|
}),
|
|
420
|
-
t?.supportsMultipleValues && /* @__PURE__ */
|
|
228
|
+
t?.supportsMultipleValues && /* @__PURE__ */ q("p", {
|
|
421
229
|
className: "dc:text-xs text-dc-text-muted",
|
|
422
230
|
children: r("filter.modal.multiSelectHint")
|
|
423
231
|
})
|
|
424
232
|
]
|
|
425
233
|
});
|
|
426
234
|
}
|
|
427
|
-
function
|
|
235
|
+
function Me({ field: e, dateRange: t, combo: n, inputs: r }) {
|
|
428
236
|
let { t: i } = z(), { filter: a, operatorMeta: o, shouldShowDateRange: s, shouldShowComboBox: c } = e, { onBetweenStart: l, onBetweenEnd: u, onDate: d, onDirect: f } = r;
|
|
429
|
-
return o?.requiresValues ? s ? /* @__PURE__ */
|
|
237
|
+
return o?.requiresValues ? s ? /* @__PURE__ */ q(ke, {
|
|
430
238
|
filter: a,
|
|
431
239
|
dateRange: t
|
|
432
|
-
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */
|
|
240
|
+
}) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */ J("div", {
|
|
433
241
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
434
242
|
children: [
|
|
435
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ q("input", {
|
|
436
244
|
type: "number",
|
|
437
245
|
value: a.values?.[0] ?? "",
|
|
438
246
|
onChange: l,
|
|
439
247
|
placeholder: i("filter.modal.min"),
|
|
440
248
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
441
249
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ q("span", {
|
|
443
251
|
className: "dc:text-sm text-dc-text-muted",
|
|
444
252
|
children: i("filter.modal.to")
|
|
445
253
|
}),
|
|
446
|
-
/* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ q("input", {
|
|
447
255
|
type: "number",
|
|
448
256
|
value: a.values?.[1] ?? "",
|
|
449
257
|
onChange: u,
|
|
@@ -451,37 +259,37 @@ function ze({ field: e, dateRange: t, combo: n, inputs: r }) {
|
|
|
451
259
|
className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
452
260
|
})
|
|
453
261
|
]
|
|
454
|
-
}) : o?.valueType === "date" ? /* @__PURE__ */
|
|
262
|
+
}) : o?.valueType === "date" ? /* @__PURE__ */ q("input", {
|
|
455
263
|
type: "date",
|
|
456
264
|
value: a.values?.[0] || "",
|
|
457
265
|
onChange: d,
|
|
458
266
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
459
|
-
}) : o?.valueType === "number" ? /* @__PURE__ */
|
|
267
|
+
}) : o?.valueType === "number" ? /* @__PURE__ */ q("input", {
|
|
460
268
|
type: "number",
|
|
461
269
|
value: a.values?.[0] ?? "",
|
|
462
270
|
onChange: f,
|
|
463
271
|
placeholder: i("filter.modal.enterNumber"),
|
|
464
272
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
|
|
465
|
-
}) : c ? /* @__PURE__ */
|
|
273
|
+
}) : c ? /* @__PURE__ */ q(je, {
|
|
466
274
|
filter: a,
|
|
467
275
|
operatorMeta: o,
|
|
468
276
|
combo: n
|
|
469
|
-
}) : /* @__PURE__ */
|
|
277
|
+
}) : /* @__PURE__ */ q("input", {
|
|
470
278
|
type: "text",
|
|
471
279
|
value: a.values?.[0] ?? "",
|
|
472
280
|
onChange: f,
|
|
473
281
|
placeholder: i("filter.modal.enterValue"),
|
|
474
282
|
className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text placeholder-dc-text-muted"
|
|
475
|
-
}) : /* @__PURE__ */
|
|
283
|
+
}) : /* @__PURE__ */ q("div", {
|
|
476
284
|
className: "dc:text-sm text-dc-text-muted dc:italic dc:py-2",
|
|
477
285
|
children: i("filter.modal.noValueRequired")
|
|
478
286
|
});
|
|
479
287
|
}
|
|
480
288
|
//#endregion
|
|
481
289
|
//#region src/client/components/AnalysisBuilder/FilterConfigModal.tsx
|
|
482
|
-
var
|
|
483
|
-
function
|
|
484
|
-
let { t: a } = z(), [o, s] = G(e), [c, l] = G(!1), [u, d] = G(!1), [f, p] = G(!1), [m,
|
|
290
|
+
var Ne = d("close"), Pe = d("chevronDown"), Fe = d("dimension"), Ie = d("timeDimension"), Le = d("measure");
|
|
291
|
+
function Re({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i }) {
|
|
292
|
+
let { t: a } = z(), [o, s] = G(e), [c, l] = G(!1), [u, d] = G(!1), [f, p] = G(!1), [m, h] = G("this_month"), [g, _] = G(1), [y, x] = G(""), [S, T] = G(null), [D, k] = G(-1), ee = W(null), A = W(null), te = de(y, 300), j = b(o.member, t), M = j?.field.type || "string", N = M === "time", re = j?.fieldType === "measure", ie = j?.fieldType === "dimension", ae = O(o.member, t), P = C[o.operator], oe = w(M), se = N && o.operator === "inDateRange", F = V(() => [
|
|
485
293
|
"equals",
|
|
486
294
|
"notEquals",
|
|
487
295
|
"in",
|
|
@@ -490,14 +298,14 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
490
298
|
o.operator,
|
|
491
299
|
ie,
|
|
492
300
|
N
|
|
493
|
-
])(), { values: L, loading: ce, error:
|
|
301
|
+
])(), { values: L, loading: ce, error: le, searchValues: R } = fe(o.member, F);
|
|
494
302
|
H(() => {
|
|
495
303
|
if (!i) {
|
|
496
|
-
|
|
304
|
+
T(null);
|
|
497
305
|
return;
|
|
498
306
|
}
|
|
499
307
|
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));
|
|
500
|
-
|
|
308
|
+
T(r ? {
|
|
501
309
|
bottom: window.innerHeight - e.top + 8,
|
|
502
310
|
left: a
|
|
503
311
|
} : {
|
|
@@ -510,29 +318,29 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
510
318
|
};
|
|
511
319
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
512
320
|
}, []), H(() => {
|
|
513
|
-
u &&
|
|
321
|
+
u && F && R && R("", !0), u || k(-1);
|
|
514
322
|
}, [
|
|
515
323
|
u,
|
|
516
|
-
|
|
324
|
+
F,
|
|
517
325
|
R
|
|
518
326
|
]), H(() => {
|
|
519
|
-
if (
|
|
520
|
-
let e = A.current.children[
|
|
327
|
+
if (D >= 0 && A.current) {
|
|
328
|
+
let e = A.current.children[D];
|
|
521
329
|
e && e.scrollIntoView({ block: "nearest" });
|
|
522
330
|
}
|
|
523
|
-
}, [
|
|
524
|
-
u &&
|
|
331
|
+
}, [D]), H(() => {
|
|
332
|
+
u && F && R && te !== void 0 && R(te);
|
|
525
333
|
}, [
|
|
526
334
|
te,
|
|
527
335
|
u,
|
|
528
|
-
|
|
336
|
+
F,
|
|
529
337
|
R
|
|
530
338
|
]), H(() => {
|
|
531
339
|
if (!se) return;
|
|
532
|
-
let e =
|
|
533
|
-
e && (
|
|
340
|
+
let e = v(o.dateRange);
|
|
341
|
+
e && (h(e.rangeType), e.numberValue !== void 0 && _(e.numberValue));
|
|
534
342
|
}, [o.dateRange, se]);
|
|
535
|
-
let
|
|
343
|
+
let ue = V((e) => {
|
|
536
344
|
s({
|
|
537
345
|
member: o.member,
|
|
538
346
|
operator: e,
|
|
@@ -549,7 +357,7 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
549
357
|
}), n || d(!1)) : (s({
|
|
550
358
|
...o,
|
|
551
359
|
values: [e]
|
|
552
|
-
}), d(!1)),
|
|
360
|
+
}), d(!1)), x(""), k(-1);
|
|
553
361
|
}, [o, P?.supportsMultipleValues]), me = V((e) => {
|
|
554
362
|
let t = (o.values || []).filter((t) => t !== e);
|
|
555
363
|
s({
|
|
@@ -557,7 +365,7 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
557
365
|
values: t
|
|
558
366
|
});
|
|
559
367
|
}, [o]), he = V((e) => {
|
|
560
|
-
let t =
|
|
368
|
+
let t = Ee(e.key, u, L.length, D);
|
|
561
369
|
if (t.type !== "none") {
|
|
562
370
|
if (e.preventDefault(), t.type === "highlight") return k(t.index);
|
|
563
371
|
if (t.type === "select") return pe(L[t.index], { shiftKey: e.shiftKey });
|
|
@@ -566,7 +374,7 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
566
374
|
}, [
|
|
567
375
|
u,
|
|
568
376
|
L,
|
|
569
|
-
|
|
377
|
+
D,
|
|
570
378
|
pe
|
|
571
379
|
]), ge = V((e) => {
|
|
572
380
|
let t = e.target.value;
|
|
@@ -583,44 +391,44 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
583
391
|
...o,
|
|
584
392
|
values: t ? [t] : []
|
|
585
393
|
});
|
|
586
|
-
}, [o, P?.valueType]),
|
|
394
|
+
}, [o, P?.valueType]), _e = V((e) => {
|
|
587
395
|
let t = parseFloat(e.target.value), n = [isNaN(t) ? "" : t, (o.values?.length >= 2 ? o.values : ["", ""])[1]].filter((e) => e !== "");
|
|
588
396
|
s({
|
|
589
397
|
...o,
|
|
590
398
|
values: n
|
|
591
399
|
});
|
|
592
|
-
}, [o]),
|
|
400
|
+
}, [o]), ve = V((e) => {
|
|
593
401
|
let t = parseFloat(e.target.value), n = [(o.values?.length >= 2 ? o.values : ["", ""])[0], isNaN(t) ? "" : t].filter((e) => e !== "");
|
|
594
402
|
s({
|
|
595
403
|
...o,
|
|
596
404
|
values: n
|
|
597
405
|
});
|
|
598
|
-
}, [o]),
|
|
406
|
+
}, [o]), ye = V((e) => {
|
|
599
407
|
let t = e.target.value;
|
|
600
408
|
s({
|
|
601
409
|
...o,
|
|
602
410
|
values: t ? [t] : []
|
|
603
411
|
});
|
|
604
|
-
}, [o]),
|
|
605
|
-
|
|
412
|
+
}, [o]), B = V((e) => {
|
|
413
|
+
h(e), p(!1);
|
|
606
414
|
let t;
|
|
607
415
|
if (e === "custom") {
|
|
608
416
|
let e = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
609
417
|
t = [e, e];
|
|
610
|
-
} else t =
|
|
418
|
+
} else t = ne(e) ? I(e, g) : I(e);
|
|
611
419
|
s({
|
|
612
420
|
...o,
|
|
613
421
|
dateRange: t
|
|
614
422
|
});
|
|
615
|
-
}, [o,
|
|
616
|
-
if (
|
|
617
|
-
let t =
|
|
423
|
+
}, [o, g]), be = V((e) => {
|
|
424
|
+
if (_(e), ne(m)) {
|
|
425
|
+
let t = I(m, e);
|
|
618
426
|
s({
|
|
619
427
|
...o,
|
|
620
428
|
dateRange: t
|
|
621
429
|
});
|
|
622
430
|
}
|
|
623
|
-
}, [o, m]),
|
|
431
|
+
}, [o, m]), xe = V((e) => {
|
|
624
432
|
let t = e.target.value, n = (Array.isArray(o.dateRange) ? o.dateRange : [o.dateRange || "", ""])[1] || t;
|
|
625
433
|
s({
|
|
626
434
|
...o,
|
|
@@ -632,20 +440,20 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
632
440
|
...o,
|
|
633
441
|
dateRange: [n, t]
|
|
634
442
|
});
|
|
635
|
-
}, [o]), Ce = a(oe.find((e) => e.operator === o.operator)?.label || o.operator), we = a(
|
|
443
|
+
}, [o]), Ce = a(oe.find((e) => e.operator === o.operator)?.label || o.operator), we = a(E.find((e) => e.value === m)?.label || "filter.modal.selectRange"), Te = {
|
|
636
444
|
filter: o,
|
|
637
445
|
operatorMeta: P,
|
|
638
446
|
shouldShowDateRange: se,
|
|
639
|
-
shouldShowComboBox:
|
|
640
|
-
},
|
|
447
|
+
shouldShowComboBox: F
|
|
448
|
+
}, Y = {
|
|
641
449
|
rangeType: m,
|
|
642
|
-
numberValue:
|
|
450
|
+
numberValue: g,
|
|
643
451
|
label: we,
|
|
644
452
|
isOpen: f,
|
|
645
453
|
onToggle: p,
|
|
646
|
-
onRangeTypeChange:
|
|
647
|
-
onNumberValueChange:
|
|
648
|
-
onCustomStartDate:
|
|
454
|
+
onRangeTypeChange: B,
|
|
455
|
+
onNumberValueChange: be,
|
|
456
|
+
onCustomStartDate: xe,
|
|
649
457
|
onCustomEndDate: Se,
|
|
650
458
|
onOpen: V(() => {
|
|
651
459
|
l(!1), d(!1);
|
|
@@ -654,11 +462,11 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
654
462
|
isOpen: u,
|
|
655
463
|
options: L,
|
|
656
464
|
loading: ce,
|
|
657
|
-
error:
|
|
658
|
-
searchText:
|
|
659
|
-
highlightedIndex:
|
|
465
|
+
error: le,
|
|
466
|
+
searchText: y,
|
|
467
|
+
highlightedIndex: D,
|
|
660
468
|
listRef: A,
|
|
661
|
-
onSearchTextChange:
|
|
469
|
+
onSearchTextChange: x,
|
|
662
470
|
onHighlightedIndexChange: k,
|
|
663
471
|
onSelect: pe,
|
|
664
472
|
onRemove: me,
|
|
@@ -667,26 +475,26 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
667
475
|
l(!1), p(!1), d((e) => !e);
|
|
668
476
|
}, [])
|
|
669
477
|
}, Oe = U(() => ({
|
|
670
|
-
onBetweenStart:
|
|
671
|
-
onBetweenEnd:
|
|
672
|
-
onDate:
|
|
478
|
+
onBetweenStart: _e,
|
|
479
|
+
onBetweenEnd: ve,
|
|
480
|
+
onDate: ye,
|
|
673
481
|
onDirect: ge
|
|
674
482
|
}), [
|
|
675
|
-
B,
|
|
676
483
|
_e,
|
|
677
484
|
ve,
|
|
485
|
+
ye,
|
|
678
486
|
ge
|
|
679
|
-
]), ke = N ?
|
|
680
|
-
return /* @__PURE__ */ K
|
|
681
|
-
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${
|
|
487
|
+
]), ke = N ? Ie : re ? Le : Fe;
|
|
488
|
+
return /* @__PURE__ */ q(K, { children: /* @__PURE__ */ q("div", {
|
|
489
|
+
className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${S ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
|
|
682
490
|
onClick: r,
|
|
683
|
-
children: /* @__PURE__ */
|
|
491
|
+
children: /* @__PURE__ */ J("div", {
|
|
684
492
|
ref: ee,
|
|
685
|
-
className:
|
|
493
|
+
className: S ? "bg-dc-surface dc:rounded-lg dc:border border-dc-border" : "bg-dc-surface dc:rounded-lg dc:border border-dc-border dc:max-w-md dc:w-full",
|
|
686
494
|
style: {
|
|
687
|
-
...
|
|
495
|
+
...S ? {
|
|
688
496
|
position: "fixed",
|
|
689
|
-
...
|
|
497
|
+
...S,
|
|
690
498
|
maxWidth: "400px",
|
|
691
499
|
width: "100%"
|
|
692
500
|
} : {},
|
|
@@ -694,71 +502,71 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
694
502
|
},
|
|
695
503
|
onClick: (e) => e.stopPropagation(),
|
|
696
504
|
children: [
|
|
697
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ J("div", {
|
|
698
506
|
className: "dc:flex dc:items-center dc:justify-between dc:p-4 dc:border-b border-dc-border",
|
|
699
|
-
children: [/* @__PURE__ */
|
|
507
|
+
children: [/* @__PURE__ */ q("h2", {
|
|
700
508
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
701
509
|
children: a("filter.modal.title")
|
|
702
|
-
}), /* @__PURE__ */
|
|
510
|
+
}), /* @__PURE__ */ q("button", {
|
|
703
511
|
onClick: r,
|
|
704
512
|
className: "dc:p-1 text-dc-text-muted hover:text-dc-text dc:transition-colors",
|
|
705
|
-
children: /* @__PURE__ */
|
|
513
|
+
children: /* @__PURE__ */ q(Ne, { className: "dc:w-5 dc:h-5" })
|
|
706
514
|
})]
|
|
707
515
|
}),
|
|
708
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ J("div", {
|
|
709
517
|
className: "dc:p-4 dc:space-y-4",
|
|
710
518
|
children: [
|
|
711
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
|
|
712
520
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
713
521
|
children: a("filter.modal.fieldLabel")
|
|
714
|
-
}), /* @__PURE__ */
|
|
522
|
+
}), /* @__PURE__ */ J("div", {
|
|
715
523
|
className: "dc:flex dc:items-center dc:gap-2 dc:p-3 bg-dc-surface-secondary dc:rounded-sm",
|
|
716
|
-
children: [/* @__PURE__ */
|
|
524
|
+
children: [/* @__PURE__ */ q(ke, { className: "dc:w-5 dc:h-5 text-dc-filter-text" }), /* @__PURE__ */ q("span", {
|
|
717
525
|
className: "dc:text-sm dc:font-medium text-dc-text",
|
|
718
526
|
children: ae
|
|
719
527
|
})]
|
|
720
528
|
})] }),
|
|
721
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
|
|
722
530
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
723
531
|
children: a("filter.modal.operatorLabel")
|
|
724
|
-
}), /* @__PURE__ */
|
|
532
|
+
}), /* @__PURE__ */ J("div", {
|
|
725
533
|
className: "dc:relative",
|
|
726
|
-
children: [/* @__PURE__ */
|
|
534
|
+
children: [/* @__PURE__ */ J("button", {
|
|
727
535
|
onClick: () => {
|
|
728
536
|
d(!1), p(!1), l(!c);
|
|
729
537
|
},
|
|
730
538
|
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-sm dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
|
|
731
|
-
children: [/* @__PURE__ */
|
|
539
|
+
children: [/* @__PURE__ */ q("span", {
|
|
732
540
|
className: "dc:truncate",
|
|
733
541
|
children: Ce
|
|
734
|
-
}), /* @__PURE__ */
|
|
735
|
-
}), c && /* @__PURE__ */
|
|
542
|
+
}), /* @__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" : ""}` })]
|
|
543
|
+
}), c && /* @__PURE__ */ q("div", {
|
|
736
544
|
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-sm dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
|
|
737
|
-
children: oe.map((e) => /* @__PURE__ */
|
|
738
|
-
onClick: () =>
|
|
545
|
+
children: oe.map((e) => /* @__PURE__ */ q("button", {
|
|
546
|
+
onClick: () => ue(e.operator),
|
|
739
547
|
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"}`,
|
|
740
548
|
children: a(e.label)
|
|
741
549
|
}, e.operator))
|
|
742
550
|
})]
|
|
743
551
|
})] }),
|
|
744
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
|
|
745
553
|
className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
|
|
746
554
|
children: a("filter.modal.valueLabel")
|
|
747
|
-
}), /* @__PURE__ */
|
|
555
|
+
}), /* @__PURE__ */ q(Me, {
|
|
748
556
|
field: Te,
|
|
749
|
-
dateRange:
|
|
557
|
+
dateRange: Y,
|
|
750
558
|
combo: De,
|
|
751
559
|
inputs: Oe
|
|
752
560
|
})] })
|
|
753
561
|
]
|
|
754
562
|
}),
|
|
755
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ J("div", {
|
|
756
564
|
className: "dc:flex dc:items-center dc:justify-end dc:gap-2 dc:p-4 dc:border-t border-dc-border",
|
|
757
|
-
children: [/* @__PURE__ */
|
|
565
|
+
children: [/* @__PURE__ */ q("button", {
|
|
758
566
|
onClick: r,
|
|
759
567
|
className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
760
568
|
children: a("common.actions.cancel")
|
|
761
|
-
}), /* @__PURE__ */
|
|
569
|
+
}), /* @__PURE__ */ q("button", {
|
|
762
570
|
onClick: () => n(o),
|
|
763
571
|
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-sm dc:transition-colors",
|
|
764
572
|
children: a("common.actions.save")
|
|
@@ -770,47 +578,47 @@ function Ge({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
|
|
|
770
578
|
}
|
|
771
579
|
//#endregion
|
|
772
580
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterItem.tsx
|
|
773
|
-
var
|
|
774
|
-
function
|
|
775
|
-
let { t: i } = z(), [a, o] = G(!1), s = W(null), c =
|
|
776
|
-
return /* @__PURE__ */
|
|
581
|
+
var ze = d("close"), Be = d("dimension"), Ve = d("timeDimension"), He = d("measure");
|
|
582
|
+
function Ue({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
583
|
+
let { t: i } = z(), [a, o] = G(!1), s = W(null), c = b(e.member, t), l = (c?.field.type || "string") === "time", u = c?.fieldType === "measure", d = O(e.member, t), f = C[e.operator], p = f?.label ? i(f.label) : e.operator, m = We(e, f, i), h = l ? Ve : u ? He : Be;
|
|
584
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("div", {
|
|
777
585
|
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",
|
|
778
586
|
children: [
|
|
779
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ q("span", {
|
|
780
588
|
className: `dc:w-6 dc:h-6 dc:flex dc:items-center dc:justify-center dc:rounded-sm ${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`,
|
|
781
|
-
children: h && /* @__PURE__ */
|
|
589
|
+
children: h && /* @__PURE__ */ q(h, { className: "dc:w-4 dc:h-4" })
|
|
782
590
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ q("button", {
|
|
784
592
|
ref: s,
|
|
785
593
|
onClick: () => o(!0),
|
|
786
594
|
className: "dc:flex-1 dc:min-w-0 dc:text-left",
|
|
787
595
|
title: `${d} ${p} ${m}`,
|
|
788
|
-
children: /* @__PURE__ */
|
|
596
|
+
children: /* @__PURE__ */ J("div", {
|
|
789
597
|
className: "dc:text-sm text-dc-text dc:break-words",
|
|
790
598
|
children: [
|
|
791
|
-
/* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ q("span", {
|
|
792
600
|
className: "dc:font-medium",
|
|
793
601
|
children: d
|
|
794
602
|
}),
|
|
795
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ q("span", {
|
|
796
604
|
className: "text-dc-text-muted dc:mx-1",
|
|
797
605
|
children: p
|
|
798
606
|
}),
|
|
799
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ q("span", {
|
|
800
608
|
className: "text-dc-primary",
|
|
801
609
|
children: m
|
|
802
610
|
})
|
|
803
611
|
]
|
|
804
612
|
})
|
|
805
613
|
}),
|
|
806
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ q("button", {
|
|
807
615
|
onClick: n,
|
|
808
616
|
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",
|
|
809
617
|
title: i("filter.removeButton.title"),
|
|
810
|
-
children:
|
|
618
|
+
children: ze && /* @__PURE__ */ q(ze, { className: "dc:w-4 dc:h-4" })
|
|
811
619
|
})
|
|
812
620
|
]
|
|
813
|
-
}), a && /* @__PURE__ */
|
|
621
|
+
}), a && /* @__PURE__ */ q(Re, {
|
|
814
622
|
filter: e,
|
|
815
623
|
schema: t,
|
|
816
624
|
onSave: (e) => {
|
|
@@ -820,7 +628,7 @@ function Xe({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
|
|
|
820
628
|
anchorElement: s.current
|
|
821
629
|
})] });
|
|
822
630
|
}
|
|
823
|
-
function
|
|
631
|
+
function We(e, t, n) {
|
|
824
632
|
if (!t?.requiresValues) return "";
|
|
825
633
|
if (e.dateRange) return Array.isArray(e.dateRange) ? `${e.dateRange[0]} to ${e.dateRange[1]}` : e.dateRange;
|
|
826
634
|
let r = e.values || [];
|
|
@@ -828,8 +636,8 @@ function Ze(e, t, n) {
|
|
|
828
636
|
}
|
|
829
637
|
//#endregion
|
|
830
638
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterGroup.tsx
|
|
831
|
-
var
|
|
832
|
-
function
|
|
639
|
+
var Ge = d("add"), Ke = d("close");
|
|
640
|
+
function qe({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
|
|
833
641
|
let { t: s } = z(), [c, l] = G(!1), u = W(null);
|
|
834
642
|
H(() => {
|
|
835
643
|
let e = (e) => {
|
|
@@ -838,7 +646,7 @@ function et({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
838
646
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
839
647
|
}, []);
|
|
840
648
|
let d = V(() => {
|
|
841
|
-
n(
|
|
649
|
+
n(ie(e));
|
|
842
650
|
}, [e, n]), f = V((t, r) => {
|
|
843
651
|
let i = [...e.filters];
|
|
844
652
|
i[t] = r, n({
|
|
@@ -870,18 +678,18 @@ function et({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
870
678
|
}, [i]), g = V((e) => (t = []) => {
|
|
871
679
|
i([e, ...t]);
|
|
872
680
|
}, [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");
|
|
873
|
-
return /* @__PURE__ */
|
|
681
|
+
return /* @__PURE__ */ J("div", {
|
|
874
682
|
className: `dc:border ${_()} dc:rounded-lg bg-dc-surface dc:w-full`,
|
|
875
|
-
children: [/* @__PURE__ */
|
|
683
|
+
children: [/* @__PURE__ */ J("div", {
|
|
876
684
|
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()}`,
|
|
877
|
-
children: [/* @__PURE__ */
|
|
685
|
+
children: [/* @__PURE__ */ J("div", {
|
|
878
686
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
879
|
-
children: [/* @__PURE__ */
|
|
687
|
+
children: [/* @__PURE__ */ q("button", {
|
|
880
688
|
onClick: d,
|
|
881
689
|
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-semibold dc:rounded-sm 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"}`,
|
|
882
690
|
title: `Click to switch to ${e.type === "and" ? "OR" : "AND"}`,
|
|
883
691
|
children: e.type.toUpperCase()
|
|
884
|
-
}), /* @__PURE__ */
|
|
692
|
+
}), /* @__PURE__ */ J("span", {
|
|
885
693
|
className: "dc:text-xs text-dc-text-muted",
|
|
886
694
|
children: [
|
|
887
695
|
y,
|
|
@@ -889,61 +697,61 @@ function et({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
889
697
|
b
|
|
890
698
|
]
|
|
891
699
|
})]
|
|
892
|
-
}), /* @__PURE__ */
|
|
700
|
+
}), /* @__PURE__ */ J("div", {
|
|
893
701
|
className: "dc:flex dc:items-center dc:gap-1",
|
|
894
|
-
children: [/* @__PURE__ */
|
|
702
|
+
children: [/* @__PURE__ */ J("div", {
|
|
895
703
|
className: "dc:relative",
|
|
896
704
|
ref: u,
|
|
897
|
-
children: [/* @__PURE__ */
|
|
705
|
+
children: [/* @__PURE__ */ q("button", {
|
|
898
706
|
onClick: () => l(!c),
|
|
899
707
|
className: "dc:p-1 text-dc-text-secondary hover:text-dc-primary hover:bg-dc-surface-hover dc:rounded-sm dc:transition-colors",
|
|
900
708
|
title: "Add condition",
|
|
901
|
-
children: /* @__PURE__ */
|
|
902
|
-
}), c && /* @__PURE__ */
|
|
709
|
+
children: /* @__PURE__ */ q(Ge, { className: "dc:w-4 dc:h-4" })
|
|
710
|
+
}), c && /* @__PURE__ */ J("div", {
|
|
903
711
|
className: "dc:absolute dc:right-0 dc:mt-1 dc:z-40 bg-dc-surface dc:border border-dc-border dc:rounded-sm dc:shadow-lg dc:py-1 dc:min-w-[120px]",
|
|
904
712
|
children: [
|
|
905
|
-
/* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ q("button", {
|
|
906
714
|
onClick: h,
|
|
907
715
|
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",
|
|
908
716
|
children: s("filter.group.addFilter")
|
|
909
717
|
}),
|
|
910
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ q("button", {
|
|
911
719
|
onClick: () => m("and"),
|
|
912
720
|
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",
|
|
913
721
|
children: s("filter.group.addAndGroup")
|
|
914
722
|
}),
|
|
915
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ q("button", {
|
|
916
724
|
onClick: () => m("or"),
|
|
917
725
|
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",
|
|
918
726
|
children: s("filter.group.addOrGroup")
|
|
919
727
|
})
|
|
920
728
|
]
|
|
921
729
|
})]
|
|
922
|
-
}), !o && /* @__PURE__ */
|
|
730
|
+
}), !o && /* @__PURE__ */ q("button", {
|
|
923
731
|
onClick: r,
|
|
924
732
|
className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:transition-colors",
|
|
925
733
|
title: s("filter.group.removeGroup"),
|
|
926
|
-
children: /* @__PURE__ */
|
|
734
|
+
children: /* @__PURE__ */ q(Ke, { className: "dc:w-4 dc:h-4" })
|
|
927
735
|
})]
|
|
928
736
|
})]
|
|
929
|
-
}), /* @__PURE__ */
|
|
737
|
+
}), /* @__PURE__ */ q("div", {
|
|
930
738
|
className: "dc:p-1.5 dc:flex dc:flex-wrap dc:gap-2",
|
|
931
|
-
children: e.filters.length === 0 ? /* @__PURE__ */
|
|
739
|
+
children: e.filters.length === 0 ? /* @__PURE__ */ J("div", {
|
|
932
740
|
className: "dc:text-center dc:py-3",
|
|
933
|
-
children: [/* @__PURE__ */
|
|
741
|
+
children: [/* @__PURE__ */ q("p", {
|
|
934
742
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
935
743
|
children: s("filter.group.empty")
|
|
936
|
-
}), /* @__PURE__ */
|
|
744
|
+
}), /* @__PURE__ */ q("button", {
|
|
937
745
|
onClick: () => i([]),
|
|
938
746
|
className: "dc:text-xs text-dc-primary dc:hover:underline",
|
|
939
747
|
children: s("filter.group.addFilterLink")
|
|
940
748
|
})]
|
|
941
|
-
}) : e.filters.map((e, n) =>
|
|
749
|
+
}) : e.filters.map((e, n) => P(e) ? /* @__PURE__ */ q(Ue, {
|
|
942
750
|
filter: e,
|
|
943
751
|
schema: t,
|
|
944
752
|
onUpdate: (e) => f(n, e),
|
|
945
753
|
onRemove: () => p(n)
|
|
946
|
-
}, `filter-${n}`) :
|
|
754
|
+
}, `filter-${n}`) : ae(e) ? /* @__PURE__ */ q(qe, {
|
|
947
755
|
group: e,
|
|
948
756
|
schema: t,
|
|
949
757
|
onUpdate: (e) => f(n, e),
|
|
@@ -956,9 +764,9 @@ function et({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
|
|
|
956
764
|
}
|
|
957
765
|
//#endregion
|
|
958
766
|
//#region src/client/components/AnalysisBuilder/AnalysisFilterSection.tsx
|
|
959
|
-
var
|
|
960
|
-
function
|
|
961
|
-
let { t: a } = z(), [o, s] = G(!1), [c, l] = G(!1), u = W([]), d =
|
|
767
|
+
var Je = d("add");
|
|
768
|
+
function Ye({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dimensionsOnly: i = !1 }) {
|
|
769
|
+
let { t: a } = z(), [o, s] = G(!1), [c, l] = G(!1), u = W([]), d = R(e), f = V((e) => {
|
|
962
770
|
e.preventDefault(), e.stopPropagation(), l(!0);
|
|
963
771
|
}, []), p = V((e) => {
|
|
964
772
|
e.preventDefault(), e.stopPropagation(), l(!1);
|
|
@@ -968,18 +776,18 @@ function nt({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
968
776
|
let t = JSON.parse(e.dataTransfer.getData("text/plain"));
|
|
969
777
|
t.field && r && r(t.field);
|
|
970
778
|
} catch {}
|
|
971
|
-
}, [r]), h =
|
|
779
|
+
}, [r]), h = N(e), g = V((t, r, i) => {
|
|
972
780
|
let a = t.type === "time", o = a ? "inDateRange" : "equals", c = {
|
|
973
781
|
member: t.name,
|
|
974
782
|
operator: o,
|
|
975
783
|
values: []
|
|
976
784
|
};
|
|
977
|
-
a && o === "inDateRange" && (c.dateRange =
|
|
785
|
+
a && o === "inDateRange" && (c.dateRange = I("this_month")), n(oe(e, u.current, c)), s(!1), u.current = [];
|
|
978
786
|
}, [e, n]), _ = V((t, r) => {
|
|
979
787
|
let i = [...e];
|
|
980
788
|
i[t] = r, n(i);
|
|
981
789
|
}, [e, n]), v = V((t) => {
|
|
982
|
-
n(
|
|
790
|
+
n(se(e, t));
|
|
983
791
|
}, [e, n]), y = V(() => {
|
|
984
792
|
n([]);
|
|
985
793
|
}, [n]), b = V(() => {
|
|
@@ -988,12 +796,12 @@ function nt({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
988
796
|
u.current = [...e, ...t], s(!0);
|
|
989
797
|
}, []), S = (n, r, i = []) => {
|
|
990
798
|
let a = [...i, r];
|
|
991
|
-
return
|
|
799
|
+
return P(n) ? /* @__PURE__ */ q(Ue, {
|
|
992
800
|
filter: n,
|
|
993
801
|
schema: t,
|
|
994
802
|
onUpdate: (e) => _(r, e),
|
|
995
803
|
onRemove: () => v(r)
|
|
996
|
-
}, `filter-${a.join("-")}`) :
|
|
804
|
+
}, `filter-${a.join("-")}`) : ae(n) ? /* @__PURE__ */ q(qe, {
|
|
997
805
|
group: n,
|
|
998
806
|
schema: t,
|
|
999
807
|
onUpdate: (e) => _(r, e),
|
|
@@ -1002,21 +810,21 @@ function nt({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
1002
810
|
hideRemoveButton: e.length === 1
|
|
1003
811
|
}, `group-${a.join("-")}`) : null;
|
|
1004
812
|
};
|
|
1005
|
-
return /* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ J("div", { children: [
|
|
814
|
+
/* @__PURE__ */ J("button", {
|
|
1007
815
|
onClick: b,
|
|
1008
816
|
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",
|
|
1009
817
|
title: "Add filter",
|
|
1010
|
-
children: [/* @__PURE__ */
|
|
818
|
+
children: [/* @__PURE__ */ J(ye, { children: [a("analysis.sections.filters"), d > 0 && /* @__PURE__ */ J("span", {
|
|
1011
819
|
className: "dc:ml-1.5 dc:text-xs dc:font-normal text-dc-text-muted dc:normal-case dc:tracking-normal",
|
|
1012
820
|
children: [
|
|
1013
821
|
"(",
|
|
1014
822
|
d,
|
|
1015
823
|
")"
|
|
1016
824
|
]
|
|
1017
|
-
})] }), /* @__PURE__ */
|
|
825
|
+
})] }), /* @__PURE__ */ J("div", {
|
|
1018
826
|
className: "dc:flex dc:items-center dc:gap-2",
|
|
1019
|
-
children: [d > 0 && /* @__PURE__ */
|
|
827
|
+
children: [d > 0 && /* @__PURE__ */ q("span", {
|
|
1020
828
|
role: "button",
|
|
1021
829
|
tabIndex: 0,
|
|
1022
830
|
onClick: (e) => {
|
|
@@ -1027,23 +835,23 @@ function nt({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
1027
835
|
},
|
|
1028
836
|
className: "dc:text-xs text-dc-text-muted hover:text-dc-error dc:underline dc:cursor-pointer",
|
|
1029
837
|
children: a("filter.section.clearAll")
|
|
1030
|
-
}), /* @__PURE__ */
|
|
838
|
+
}), /* @__PURE__ */ q(Je, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })]
|
|
1031
839
|
})]
|
|
1032
840
|
}),
|
|
1033
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ q("div", {
|
|
1034
842
|
onDragOver: r ? f : void 0,
|
|
1035
843
|
onDragLeave: r ? p : void 0,
|
|
1036
844
|
onDrop: r ? m : void 0,
|
|
1037
845
|
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"}`,
|
|
1038
|
-
children: e.length === 0 ? /* @__PURE__ */
|
|
846
|
+
children: e.length === 0 ? /* @__PURE__ */ q("p", {
|
|
1039
847
|
className: `dc:text-sm ${c ? "text-dc-primary dc:font-medium" : "text-dc-text-muted"}`,
|
|
1040
848
|
children: a(c ? "filter.section.dropHint" : "filter.section.empty")
|
|
1041
|
-
}) : /* @__PURE__ */
|
|
849
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1042
850
|
className: "dc:flex dc:flex-wrap dc:gap-2",
|
|
1043
851
|
children: e.map((e, t) => S(e, t))
|
|
1044
852
|
})
|
|
1045
853
|
}),
|
|
1046
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ q(k, {
|
|
1047
855
|
isOpen: o,
|
|
1048
856
|
onClose: () => {
|
|
1049
857
|
s(!1), u.current = [];
|
|
@@ -1057,33 +865,33 @@ function nt({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dime
|
|
|
1057
865
|
}
|
|
1058
866
|
//#endregion
|
|
1059
867
|
//#region src/client/components/AnalysisBuilder/ExplainAIPanel.tsx
|
|
1060
|
-
function
|
|
868
|
+
function Xe(e) {
|
|
1061
869
|
return typeof e == "string" ? e : typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "");
|
|
1062
870
|
}
|
|
1063
|
-
var
|
|
871
|
+
var Ze = {
|
|
1064
872
|
good: "bg-dc-success-bg text-dc-success border-dc-success",
|
|
1065
873
|
warning: "bg-dc-warning-bg text-dc-warning border-dc-warning",
|
|
1066
874
|
critical: "bg-dc-danger-bg text-dc-error border-dc-error"
|
|
1067
|
-
},
|
|
875
|
+
}, Qe = {
|
|
1068
876
|
critical: "bg-dc-danger-bg text-dc-error",
|
|
1069
877
|
warning: "bg-dc-warning-bg text-dc-warning",
|
|
1070
878
|
suggestion: "bg-dc-accent-bg text-dc-accent"
|
|
1071
|
-
},
|
|
879
|
+
}, $e = {
|
|
1072
880
|
high: "text-dc-error",
|
|
1073
881
|
medium: "text-dc-warning",
|
|
1074
882
|
low: "text-dc-text-muted"
|
|
1075
883
|
};
|
|
1076
|
-
function
|
|
884
|
+
function et({ assessment: e, reason: t }) {
|
|
1077
885
|
let { t: n } = z(), r = {
|
|
1078
886
|
good: n("explainAI.assessment.good"),
|
|
1079
887
|
warning: n("explainAI.assessment.warning"),
|
|
1080
888
|
critical: n("explainAI.assessment.critical")
|
|
1081
889
|
};
|
|
1082
|
-
return /* @__PURE__ */
|
|
1083
|
-
className: `dc:p-4 dc:rounded-lg dc:border ${
|
|
1084
|
-
children: [/* @__PURE__ */
|
|
890
|
+
return /* @__PURE__ */ J("div", {
|
|
891
|
+
className: `dc:p-4 dc:rounded-lg dc:border ${Ze[e]}`,
|
|
892
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1085
893
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-1",
|
|
1086
|
-
children: /* @__PURE__ */
|
|
894
|
+
children: /* @__PURE__ */ J("span", {
|
|
1087
895
|
className: "dc:font-semibold dc:uppercase dc:text-base",
|
|
1088
896
|
children: [
|
|
1089
897
|
e === "good" && "✓ ",
|
|
@@ -1092,33 +900,33 @@ function st({ assessment: e, reason: t }) {
|
|
|
1092
900
|
r[e]
|
|
1093
901
|
]
|
|
1094
902
|
})
|
|
1095
|
-
}), /* @__PURE__ */
|
|
903
|
+
}), /* @__PURE__ */ q("p", {
|
|
1096
904
|
className: "dc:text-sm",
|
|
1097
|
-
children:
|
|
905
|
+
children: Xe(t)
|
|
1098
906
|
})]
|
|
1099
907
|
});
|
|
1100
908
|
}
|
|
1101
|
-
function
|
|
1102
|
-
return /* @__PURE__ */
|
|
909
|
+
function tt({ issue: e }) {
|
|
910
|
+
return /* @__PURE__ */ J("div", {
|
|
1103
911
|
className: "dc:flex dc:items-start dc:gap-2 dc:py-2",
|
|
1104
|
-
children: [/* @__PURE__ */
|
|
1105
|
-
className: `dc:text-sm ${
|
|
912
|
+
children: [/* @__PURE__ */ J("span", {
|
|
913
|
+
className: `dc:text-sm ${$e[e.severity]}`,
|
|
1106
914
|
children: [
|
|
1107
915
|
e.severity === "high" && "●",
|
|
1108
916
|
e.severity === "medium" && "○",
|
|
1109
917
|
e.severity === "low" && "○"
|
|
1110
918
|
]
|
|
1111
|
-
}), /* @__PURE__ */
|
|
919
|
+
}), /* @__PURE__ */ q("span", {
|
|
1112
920
|
className: "dc:text-sm text-dc-text-secondary",
|
|
1113
|
-
children:
|
|
921
|
+
children: Xe(e.description)
|
|
1114
922
|
})]
|
|
1115
923
|
});
|
|
1116
924
|
}
|
|
1117
|
-
function
|
|
925
|
+
function nt({ text: e }) {
|
|
1118
926
|
let { t } = z(), [n, r] = B.useState(!1), i = B.useRef(null);
|
|
1119
927
|
return B.useEffect(() => () => {
|
|
1120
928
|
i.current && clearTimeout(i.current);
|
|
1121
|
-
}, []), /* @__PURE__ */
|
|
929
|
+
}, []), /* @__PURE__ */ q("button", {
|
|
1122
930
|
onClick: async () => {
|
|
1123
931
|
try {
|
|
1124
932
|
await navigator.clipboard.writeText(e), r(!0), i.current && clearTimeout(i.current), i.current = setTimeout(() => r(!1), 2e3);
|
|
@@ -1131,66 +939,66 @@ function lt({ text: e }) {
|
|
|
1131
939
|
children: t(n ? "explainAI.copied" : "explainAI.copy")
|
|
1132
940
|
});
|
|
1133
941
|
}
|
|
1134
|
-
function
|
|
942
|
+
function rt({ rec: e }) {
|
|
1135
943
|
let { t } = z(), n = {
|
|
1136
944
|
index: t("explainAI.type.index"),
|
|
1137
945
|
table: t("explainAI.type.table"),
|
|
1138
946
|
cube: t("explainAI.type.cube"),
|
|
1139
947
|
general: t("explainAI.type.general")
|
|
1140
948
|
};
|
|
1141
|
-
return /* @__PURE__ */
|
|
949
|
+
return /* @__PURE__ */ J("div", {
|
|
1142
950
|
className: "dc:p-4 dc:border border-dc-border dc:rounded-lg bg-dc-surface",
|
|
1143
951
|
children: [
|
|
1144
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ J("div", {
|
|
1145
953
|
className: "dc:flex dc:items-center dc:gap-2 dc:mb-2",
|
|
1146
|
-
children: [/* @__PURE__ */
|
|
1147
|
-
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded-sm ${
|
|
954
|
+
children: [/* @__PURE__ */ q("span", {
|
|
955
|
+
className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded-sm ${Qe[e.severity]}`,
|
|
1148
956
|
children: n[e.type]
|
|
1149
|
-
}), /* @__PURE__ */
|
|
957
|
+
}), /* @__PURE__ */ q("h5", {
|
|
1150
958
|
className: "dc:font-medium text-dc-text",
|
|
1151
|
-
children:
|
|
959
|
+
children: Xe(e.title)
|
|
1152
960
|
})]
|
|
1153
961
|
}),
|
|
1154
|
-
/* @__PURE__ */
|
|
962
|
+
/* @__PURE__ */ q("p", {
|
|
1155
963
|
className: "dc:text-sm text-dc-text-secondary dc:mb-3",
|
|
1156
|
-
children:
|
|
964
|
+
children: Xe(e.description)
|
|
1157
965
|
}),
|
|
1158
|
-
e.sql && /* @__PURE__ */
|
|
966
|
+
e.sql && /* @__PURE__ */ q("div", {
|
|
1159
967
|
className: "dc:mt-2",
|
|
1160
|
-
children: /* @__PURE__ */
|
|
968
|
+
children: /* @__PURE__ */ q(g, {
|
|
1161
969
|
code: e.sql,
|
|
1162
970
|
language: "sql",
|
|
1163
|
-
headerRight: /* @__PURE__ */
|
|
971
|
+
headerRight: /* @__PURE__ */ q(nt, { text: e.sql })
|
|
1164
972
|
})
|
|
1165
973
|
}),
|
|
1166
|
-
e.cubeCode && /* @__PURE__ */
|
|
974
|
+
e.cubeCode && /* @__PURE__ */ J("div", {
|
|
1167
975
|
className: "dc:mt-2",
|
|
1168
|
-
children: [e.cubeName && /* @__PURE__ */
|
|
976
|
+
children: [e.cubeName && /* @__PURE__ */ q("p", {
|
|
1169
977
|
className: "dc:text-xs text-dc-text-muted dc:mb-1",
|
|
1170
978
|
children: t("explainAI.addToCube", { cubeName: e.cubeName })
|
|
1171
|
-
}), /* @__PURE__ */
|
|
979
|
+
}), /* @__PURE__ */ J("div", {
|
|
1172
980
|
className: "dc:relative",
|
|
1173
|
-
children: [/* @__PURE__ */
|
|
981
|
+
children: [/* @__PURE__ */ q("pre", {
|
|
1174
982
|
className: "dc:p-3 dc:text-xs bg-dc-surface-secondary dc:rounded-sm dc:overflow-x-auto dc:font-mono text-dc-text",
|
|
1175
983
|
children: e.cubeCode
|
|
1176
|
-
}), /* @__PURE__ */
|
|
984
|
+
}), /* @__PURE__ */ q("div", {
|
|
1177
985
|
className: "dc:absolute dc:top-1 dc:right-1",
|
|
1178
|
-
children: /* @__PURE__ */
|
|
986
|
+
children: /* @__PURE__ */ q(nt, { text: e.cubeCode })
|
|
1179
987
|
})]
|
|
1180
988
|
})]
|
|
1181
989
|
}),
|
|
1182
|
-
e.estimatedImpact && /* @__PURE__ */
|
|
990
|
+
e.estimatedImpact && /* @__PURE__ */ J("p", {
|
|
1183
991
|
className: "dc:text-xs text-dc-text-muted dc:mt-2",
|
|
1184
992
|
children: [
|
|
1185
|
-
/* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ q("strong", { children: t("explainAI.expectedImpact") }),
|
|
1186
994
|
" ",
|
|
1187
|
-
|
|
995
|
+
Xe(e.estimatedImpact)
|
|
1188
996
|
]
|
|
1189
997
|
})
|
|
1190
998
|
]
|
|
1191
999
|
});
|
|
1192
1000
|
}
|
|
1193
|
-
function
|
|
1001
|
+
function it({ analysis: e, onClose: t, onClear: n }) {
|
|
1194
1002
|
let { t: r } = z(), i = t || n;
|
|
1195
1003
|
return B.useEffect(() => {
|
|
1196
1004
|
let e = (e) => {
|
|
@@ -1199,36 +1007,36 @@ function dt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1199
1007
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
1200
1008
|
}, [i]), B.useEffect(() => (document.body.style.overflow = "hidden", () => {
|
|
1201
1009
|
document.body.style.overflow = "";
|
|
1202
|
-
}), []), /* @__PURE__ */
|
|
1010
|
+
}), []), /* @__PURE__ */ J("div", {
|
|
1203
1011
|
className: "dc:fixed dc:inset-0 dc:z-50 dc:flex dc:items-center dc:justify-center dc:p-4 bg-black/50",
|
|
1204
|
-
children: [/* @__PURE__ */
|
|
1012
|
+
children: [/* @__PURE__ */ q("div", {
|
|
1205
1013
|
className: "dc:absolute dc:inset-0",
|
|
1206
1014
|
onClick: i,
|
|
1207
1015
|
"aria-hidden": "true"
|
|
1208
|
-
}), /* @__PURE__ */
|
|
1016
|
+
}), /* @__PURE__ */ J("div", {
|
|
1209
1017
|
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",
|
|
1210
1018
|
children: [
|
|
1211
|
-
/* @__PURE__ */
|
|
1019
|
+
/* @__PURE__ */ J("div", {
|
|
1212
1020
|
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",
|
|
1213
|
-
children: [/* @__PURE__ */
|
|
1021
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1214
1022
|
className: "dc:flex dc:items-center dc:gap-3",
|
|
1215
|
-
children: [/* @__PURE__ */
|
|
1023
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1216
1024
|
className: "dc:text-lg",
|
|
1217
1025
|
children: "✨"
|
|
1218
|
-
}), /* @__PURE__ */
|
|
1026
|
+
}), /* @__PURE__ */ q("h3", {
|
|
1219
1027
|
className: "dc:text-lg dc:font-semibold text-dc-text",
|
|
1220
1028
|
children: r("explainAI.title")
|
|
1221
1029
|
})]
|
|
1222
|
-
}), /* @__PURE__ */
|
|
1030
|
+
}), /* @__PURE__ */ q("button", {
|
|
1223
1031
|
onClick: i,
|
|
1224
1032
|
className: "dc:p-2 dc:rounded-lg hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors",
|
|
1225
1033
|
"aria-label": "Close",
|
|
1226
|
-
children: /* @__PURE__ */
|
|
1034
|
+
children: /* @__PURE__ */ q("svg", {
|
|
1227
1035
|
className: "dc:w-5 dc:h-5",
|
|
1228
1036
|
fill: "none",
|
|
1229
1037
|
stroke: "currentColor",
|
|
1230
1038
|
viewBox: "0 0 24 24",
|
|
1231
|
-
children: /* @__PURE__ */
|
|
1039
|
+
children: /* @__PURE__ */ q("path", {
|
|
1232
1040
|
strokeLinecap: "round",
|
|
1233
1041
|
strokeLinejoin: "round",
|
|
1234
1042
|
strokeWidth: 2,
|
|
@@ -1237,50 +1045,50 @@ function dt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1237
1045
|
})
|
|
1238
1046
|
})]
|
|
1239
1047
|
}),
|
|
1240
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ J("div", {
|
|
1241
1049
|
className: "dc:flex-1 dc:overflow-y-auto dc:px-6 dc:py-4 dc:space-y-6",
|
|
1242
1050
|
children: [
|
|
1243
|
-
/* @__PURE__ */
|
|
1051
|
+
/* @__PURE__ */ q(et, {
|
|
1244
1052
|
assessment: e.assessment,
|
|
1245
1053
|
reason: e.assessmentReason
|
|
1246
1054
|
}),
|
|
1247
|
-
/* @__PURE__ */
|
|
1055
|
+
/* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1248
1056
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1249
1057
|
children: r("explainAI.summary")
|
|
1250
|
-
}), /* @__PURE__ */
|
|
1058
|
+
}), /* @__PURE__ */ q("p", {
|
|
1251
1059
|
className: "text-dc-text",
|
|
1252
|
-
children:
|
|
1060
|
+
children: Xe(e.summary)
|
|
1253
1061
|
})] }),
|
|
1254
|
-
e.queryUnderstanding && /* @__PURE__ */
|
|
1062
|
+
e.queryUnderstanding && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1255
1063
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1256
1064
|
children: r("explainAI.queryAnalysis")
|
|
1257
|
-
}), /* @__PURE__ */
|
|
1065
|
+
}), /* @__PURE__ */ q("p", {
|
|
1258
1066
|
className: "text-dc-text-secondary",
|
|
1259
|
-
children:
|
|
1067
|
+
children: Xe(e.queryUnderstanding)
|
|
1260
1068
|
})] }),
|
|
1261
|
-
e.issues && e.issues.length > 0 && /* @__PURE__ */
|
|
1069
|
+
e.issues && e.issues.length > 0 && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1262
1070
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
|
|
1263
1071
|
children: r("explainAI.issuesFound", { count: e.issues.length })
|
|
1264
|
-
}), /* @__PURE__ */
|
|
1072
|
+
}), /* @__PURE__ */ q("div", {
|
|
1265
1073
|
className: "dc:space-y-1 bg-dc-surface-secondary dc:rounded-lg dc:p-3",
|
|
1266
|
-
children: e.issues.map((e, t) => /* @__PURE__ */
|
|
1074
|
+
children: e.issues.map((e, t) => /* @__PURE__ */ q(tt, { issue: e }, t))
|
|
1267
1075
|
})] }),
|
|
1268
|
-
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */
|
|
1076
|
+
e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
|
|
1269
1077
|
className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-3",
|
|
1270
1078
|
children: r("explainAI.recommendations", { count: e.recommendations.length })
|
|
1271
|
-
}), /* @__PURE__ */
|
|
1079
|
+
}), /* @__PURE__ */ q("div", {
|
|
1272
1080
|
className: "dc:space-y-4",
|
|
1273
|
-
children: e.recommendations.map((e, t) => /* @__PURE__ */
|
|
1081
|
+
children: e.recommendations.map((e, t) => /* @__PURE__ */ q(rt, { rec: e }, t))
|
|
1274
1082
|
})] }),
|
|
1275
|
-
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */
|
|
1083
|
+
(!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */ q("div", {
|
|
1276
1084
|
className: "text-dc-text-muted dc:italic dc:p-4 bg-dc-surface-secondary dc:rounded-lg",
|
|
1277
1085
|
children: r("explainAI.noRecommendations")
|
|
1278
1086
|
})
|
|
1279
1087
|
]
|
|
1280
1088
|
}),
|
|
1281
|
-
/* @__PURE__ */
|
|
1089
|
+
/* @__PURE__ */ J("div", {
|
|
1282
1090
|
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",
|
|
1283
|
-
children: [e._meta && /* @__PURE__ */
|
|
1091
|
+
children: [e._meta && /* @__PURE__ */ J("div", {
|
|
1284
1092
|
className: "dc:text-xs text-dc-text-muted",
|
|
1285
1093
|
children: [
|
|
1286
1094
|
r("explainAI.modelLabel"),
|
|
@@ -1288,7 +1096,7 @@ function dt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1288
1096
|
e._meta.model,
|
|
1289
1097
|
e._meta.usingUserKey && ` ${r("explainAI.usingUserKey")}`
|
|
1290
1098
|
]
|
|
1291
|
-
}), /* @__PURE__ */
|
|
1099
|
+
}), /* @__PURE__ */ q("button", {
|
|
1292
1100
|
onClick: i,
|
|
1293
1101
|
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",
|
|
1294
1102
|
children: r("common.actions.close")
|
|
@@ -1300,31 +1108,31 @@ function dt({ analysis: e, onClose: t, onClear: n }) {
|
|
|
1300
1108
|
}
|
|
1301
1109
|
//#endregion
|
|
1302
1110
|
//#region src/client/shared/chartConfigBuilders.ts
|
|
1303
|
-
var
|
|
1304
|
-
function
|
|
1111
|
+
var at = (e) => e.map((e) => e.field), ot = (e) => e.length > 0 ? [e[0].field] : [];
|
|
1112
|
+
function st(e) {
|
|
1305
1113
|
let { metrics: t, timeDimension: n, dimension: r, dimensions: i } = e;
|
|
1306
1114
|
return {
|
|
1307
1115
|
xAxis: n ? [n.field] : r ? [r.field] : [],
|
|
1308
|
-
yAxis:
|
|
1116
|
+
yAxis: at(t),
|
|
1309
1117
|
series: i.length > 1 ? [i[1].field] : r && n ? [r.field] : []
|
|
1310
1118
|
};
|
|
1311
1119
|
}
|
|
1312
|
-
function
|
|
1120
|
+
function ct(e) {
|
|
1313
1121
|
let { metrics: t, timeDimension: n, dimension: r, dimensions: i } = e;
|
|
1314
1122
|
return {
|
|
1315
1123
|
xAxis: r ? [r.field] : n ? [n.field] : [],
|
|
1316
|
-
yAxis:
|
|
1124
|
+
yAxis: at(t),
|
|
1317
1125
|
series: i.length > 1 ? [i[1].field] : n && r ? [n.field] : []
|
|
1318
1126
|
};
|
|
1319
1127
|
}
|
|
1320
|
-
function
|
|
1128
|
+
function lt(e) {
|
|
1321
1129
|
let { metrics: t, dimension: n } = e;
|
|
1322
1130
|
return {
|
|
1323
1131
|
xAxis: n ? [n.field] : [],
|
|
1324
|
-
yAxis:
|
|
1132
|
+
yAxis: ot(t)
|
|
1325
1133
|
};
|
|
1326
1134
|
}
|
|
1327
|
-
function
|
|
1135
|
+
function ut(e) {
|
|
1328
1136
|
let { metrics: t, breakdowns: n, dimension: r, dimensions: i } = e;
|
|
1329
1137
|
return t.length >= 2 ? {
|
|
1330
1138
|
xAxis: [t[0].field],
|
|
@@ -1332,11 +1140,11 @@ function _t(e) {
|
|
|
1332
1140
|
series: r ? [r.field] : []
|
|
1333
1141
|
} : {
|
|
1334
1142
|
xAxis: n.length > 0 ? [n[0].field] : [],
|
|
1335
|
-
yAxis:
|
|
1143
|
+
yAxis: ot(t),
|
|
1336
1144
|
series: i.length > 1 ? [i[1].field] : []
|
|
1337
1145
|
};
|
|
1338
1146
|
}
|
|
1339
|
-
function
|
|
1147
|
+
function dt(e) {
|
|
1340
1148
|
let { metrics: t, timeDimension: n, dimension: r } = e;
|
|
1341
1149
|
return {
|
|
1342
1150
|
xAxis: t.length > 0 ? [t[0].field] : [],
|
|
@@ -1345,216 +1153,216 @@ function vt(e) {
|
|
|
1345
1153
|
series: r ? [r.field] : n ? [n.field] : []
|
|
1346
1154
|
};
|
|
1347
1155
|
}
|
|
1348
|
-
function
|
|
1156
|
+
function ft(e) {
|
|
1349
1157
|
let { metrics: t, dimension: n } = e;
|
|
1350
1158
|
return {
|
|
1351
1159
|
xAxis: n ? [n.field] : [],
|
|
1352
|
-
yAxis:
|
|
1160
|
+
yAxis: ot(t)
|
|
1353
1161
|
};
|
|
1354
1162
|
}
|
|
1355
|
-
function
|
|
1163
|
+
function pt(e) {
|
|
1356
1164
|
let { metrics: t, timeDimension: n } = e;
|
|
1357
1165
|
return {
|
|
1358
1166
|
dateField: n ? [n.field] : [],
|
|
1359
|
-
valueField:
|
|
1167
|
+
valueField: ot(t)
|
|
1360
1168
|
};
|
|
1361
1169
|
}
|
|
1362
|
-
function
|
|
1363
|
-
return { yAxis:
|
|
1170
|
+
function mt(e) {
|
|
1171
|
+
return { yAxis: ot(e.metrics) };
|
|
1364
1172
|
}
|
|
1365
|
-
function
|
|
1173
|
+
function ht(e) {
|
|
1366
1174
|
let { metrics: t, breakdowns: n } = e;
|
|
1367
1175
|
return { xAxis: [...n.map((e) => e.field), ...t.map((e) => e.field)] };
|
|
1368
1176
|
}
|
|
1369
|
-
function
|
|
1177
|
+
function gt(e) {
|
|
1370
1178
|
let { metrics: t, breakdowns: n } = e;
|
|
1371
1179
|
return { columns: [...n.map((e) => e.field), ...t.map((e) => e.field)] };
|
|
1372
1180
|
}
|
|
1373
|
-
function
|
|
1181
|
+
function _t() {
|
|
1374
1182
|
return {};
|
|
1375
1183
|
}
|
|
1376
|
-
function
|
|
1184
|
+
function vt(e) {
|
|
1377
1185
|
let { metrics: t, breakdowns: n } = e;
|
|
1378
1186
|
return {
|
|
1379
1187
|
xAxis: n.length > 0 ? [n[0].field] : [],
|
|
1380
|
-
yAxis:
|
|
1188
|
+
yAxis: at(t)
|
|
1381
1189
|
};
|
|
1382
1190
|
}
|
|
1383
|
-
var
|
|
1384
|
-
line:
|
|
1385
|
-
area:
|
|
1386
|
-
bar:
|
|
1387
|
-
pie:
|
|
1388
|
-
scatter:
|
|
1389
|
-
bubble:
|
|
1390
|
-
radar:
|
|
1391
|
-
radialBar:
|
|
1392
|
-
treemap:
|
|
1393
|
-
proportionBar:
|
|
1394
|
-
activityGrid:
|
|
1395
|
-
kpiNumber:
|
|
1396
|
-
kpiDelta:
|
|
1397
|
-
kpiText:
|
|
1398
|
-
table:
|
|
1399
|
-
recordsTable:
|
|
1400
|
-
markdown:
|
|
1191
|
+
var yt = {
|
|
1192
|
+
line: st,
|
|
1193
|
+
area: st,
|
|
1194
|
+
bar: ct,
|
|
1195
|
+
pie: lt,
|
|
1196
|
+
scatter: ut,
|
|
1197
|
+
bubble: dt,
|
|
1198
|
+
radar: ft,
|
|
1199
|
+
radialBar: ft,
|
|
1200
|
+
treemap: ft,
|
|
1201
|
+
proportionBar: lt,
|
|
1202
|
+
activityGrid: pt,
|
|
1203
|
+
kpiNumber: mt,
|
|
1204
|
+
kpiDelta: mt,
|
|
1205
|
+
kpiText: mt,
|
|
1206
|
+
table: ht,
|
|
1207
|
+
recordsTable: gt,
|
|
1208
|
+
markdown: _t
|
|
1401
1209
|
};
|
|
1402
|
-
function
|
|
1403
|
-
return
|
|
1210
|
+
function bt(e) {
|
|
1211
|
+
return yt[e] || vt;
|
|
1404
1212
|
}
|
|
1405
1213
|
//#endregion
|
|
1406
1214
|
//#region src/client/shared/chartDefaults.ts
|
|
1407
|
-
function
|
|
1215
|
+
function xt(e) {
|
|
1408
1216
|
return e.isTimeDimension;
|
|
1409
1217
|
}
|
|
1410
|
-
function
|
|
1411
|
-
return e.find(
|
|
1218
|
+
function St(e) {
|
|
1219
|
+
return e.find(xt);
|
|
1412
1220
|
}
|
|
1413
|
-
function
|
|
1221
|
+
function Ct(e) {
|
|
1414
1222
|
return e.find((e) => !e.isTimeDimension);
|
|
1415
1223
|
}
|
|
1416
|
-
function
|
|
1224
|
+
function wt(e) {
|
|
1417
1225
|
return e.filter((e) => !e.isTimeDimension);
|
|
1418
1226
|
}
|
|
1419
|
-
function
|
|
1420
|
-
return e.filter(
|
|
1227
|
+
function Tt(e) {
|
|
1228
|
+
return e.filter(xt);
|
|
1421
1229
|
}
|
|
1422
|
-
function
|
|
1230
|
+
function Et(e, t) {
|
|
1423
1231
|
return {
|
|
1424
1232
|
measureCount: e.length,
|
|
1425
1233
|
dimensionCount: t.length,
|
|
1426
|
-
timeDimensionCount:
|
|
1234
|
+
timeDimensionCount: Tt(t).length
|
|
1427
1235
|
};
|
|
1428
1236
|
}
|
|
1429
|
-
function
|
|
1237
|
+
function Dt(e, t, n) {
|
|
1430
1238
|
let r = u[e];
|
|
1431
|
-
return !r || !r.isAvailable ? { available: !0 } : r.isAvailable(
|
|
1239
|
+
return !r || !r.isAvailable ? { available: !0 } : r.isAvailable(Et(t, n));
|
|
1432
1240
|
}
|
|
1433
|
-
function
|
|
1241
|
+
function Ot(e, t) {
|
|
1434
1242
|
let n = Object.keys(u), r = {};
|
|
1435
|
-
for (let i of n) r[i] =
|
|
1243
|
+
for (let i of n) r[i] = Dt(i, e, t);
|
|
1436
1244
|
return r;
|
|
1437
1245
|
}
|
|
1438
|
-
function
|
|
1439
|
-
if (
|
|
1440
|
-
let r =
|
|
1246
|
+
function kt(e, t, n) {
|
|
1247
|
+
if (Dt(n, e, t).available || e.length === 0 && t.length === 0) return n;
|
|
1248
|
+
let r = Tt(t).length > 0, i = wt(t).length > 0, a = e.length > 0;
|
|
1441
1249
|
return r && a ? "line" : i && a ? "bar" : a && !i && !r ? "kpiNumber" : "table";
|
|
1442
1250
|
}
|
|
1443
|
-
function
|
|
1444
|
-
let r =
|
|
1251
|
+
function At(e, t, n) {
|
|
1252
|
+
let r = kt(e, t, n);
|
|
1445
1253
|
return {
|
|
1446
1254
|
chartType: r,
|
|
1447
|
-
chartConfig:
|
|
1255
|
+
chartConfig: jt(r, e, t)
|
|
1448
1256
|
};
|
|
1449
1257
|
}
|
|
1450
|
-
function
|
|
1451
|
-
return
|
|
1258
|
+
function jt(e, t, n) {
|
|
1259
|
+
return bt(e)({
|
|
1452
1260
|
metrics: t,
|
|
1453
1261
|
breakdowns: n,
|
|
1454
|
-
timeDimension:
|
|
1455
|
-
dimension:
|
|
1456
|
-
dimensions:
|
|
1262
|
+
timeDimension: St(n),
|
|
1263
|
+
dimension: Ct(n),
|
|
1264
|
+
dimensions: wt(n)
|
|
1457
1265
|
});
|
|
1458
1266
|
}
|
|
1459
|
-
function
|
|
1460
|
-
if (r &&
|
|
1461
|
-
let i =
|
|
1267
|
+
function Mt(e, t, n, r) {
|
|
1268
|
+
if (r && Dt(n, e, t).available) return null;
|
|
1269
|
+
let i = kt(e, t, n);
|
|
1462
1270
|
return i === n ? null : i;
|
|
1463
1271
|
}
|
|
1464
1272
|
//#endregion
|
|
1465
1273
|
//#region src/client/components/AnalysisBuilder/ExecutionPlanPanelParts.tsx
|
|
1466
|
-
function
|
|
1467
|
-
return /* @__PURE__ */
|
|
1274
|
+
function Nt({ title: e, height: t, className: n, children: r }) {
|
|
1275
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("h4", {
|
|
1468
1276
|
className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
|
|
1469
1277
|
children: e
|
|
1470
|
-
}), /* @__PURE__ */
|
|
1278
|
+
}), /* @__PURE__ */ q("div", {
|
|
1471
1279
|
className: n,
|
|
1472
1280
|
style: { height: t },
|
|
1473
1281
|
children: r
|
|
1474
1282
|
})] });
|
|
1475
1283
|
}
|
|
1476
|
-
function
|
|
1284
|
+
function Pt({ sql: e, sqlLoading: t, sqlError: n, sqlPlaceholder: r, formattedSql: i, title: a, height: o, headerRight: s }) {
|
|
1477
1285
|
let { t: c } = z();
|
|
1478
|
-
return t ? /* @__PURE__ */
|
|
1286
|
+
return t ? /* @__PURE__ */ q(Nt, {
|
|
1479
1287
|
title: a,
|
|
1480
1288
|
height: o,
|
|
1481
1289
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded-sm dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
|
|
1482
1290
|
children: c("results.debug.loadingSql")
|
|
1483
|
-
}) : n ? /* @__PURE__ */
|
|
1291
|
+
}) : n ? /* @__PURE__ */ q(Nt, {
|
|
1484
1292
|
title: a,
|
|
1485
1293
|
height: o,
|
|
1486
1294
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded-sm dc:border border-dc-error",
|
|
1487
1295
|
children: n.message
|
|
1488
|
-
}) : e ? /* @__PURE__ */
|
|
1296
|
+
}) : e ? /* @__PURE__ */ q(g, {
|
|
1489
1297
|
code: i,
|
|
1490
1298
|
language: "sql",
|
|
1491
1299
|
title: a,
|
|
1492
1300
|
height: o,
|
|
1493
1301
|
headerRight: s
|
|
1494
|
-
}) : /* @__PURE__ */
|
|
1302
|
+
}) : /* @__PURE__ */ q(Nt, {
|
|
1495
1303
|
title: a,
|
|
1496
1304
|
height: o,
|
|
1497
1305
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded-sm dc:p-3 text-dc-text-muted dc:text-sm",
|
|
1498
1306
|
children: r
|
|
1499
1307
|
});
|
|
1500
1308
|
}
|
|
1501
|
-
function
|
|
1309
|
+
function Ft({ summary: e }) {
|
|
1502
1310
|
let { t } = z();
|
|
1503
|
-
return /* @__PURE__ */
|
|
1311
|
+
return /* @__PURE__ */ J("div", {
|
|
1504
1312
|
className: "dc:flex dc:flex-wrap dc:items-center dc:gap-2",
|
|
1505
1313
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1314
|
+
/* @__PURE__ */ q("span", {
|
|
1507
1315
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-accent text-white dc:rounded-sm",
|
|
1508
1316
|
children: e.database.toUpperCase()
|
|
1509
1317
|
}),
|
|
1510
|
-
e.hasSequentialScans && /* @__PURE__ */
|
|
1318
|
+
e.hasSequentialScans && /* @__PURE__ */ q("span", {
|
|
1511
1319
|
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-sm",
|
|
1512
1320
|
children: t("debug.sequentialScans")
|
|
1513
1321
|
}),
|
|
1514
|
-
e.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1322
|
+
e.usedIndexes.length > 0 && /* @__PURE__ */ q("span", {
|
|
1515
1323
|
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-sm",
|
|
1516
1324
|
children: t(e.usedIndexes.length === 1 ? "debug.indexesUsed" : "debug.indexesUsedPlural", { count: e.usedIndexes.length })
|
|
1517
1325
|
}),
|
|
1518
|
-
e.executionTime !== void 0 && /* @__PURE__ */
|
|
1326
|
+
e.executionTime !== void 0 && /* @__PURE__ */ q("span", {
|
|
1519
1327
|
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-sm",
|
|
1520
1328
|
children: t("debug.executionTime", { time: e.executionTime.toFixed(2) })
|
|
1521
1329
|
}),
|
|
1522
|
-
e.planningTime !== void 0 && /* @__PURE__ */
|
|
1330
|
+
e.planningTime !== void 0 && /* @__PURE__ */ q("span", {
|
|
1523
1331
|
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-sm",
|
|
1524
1332
|
children: t("debug.planningTime", { time: e.planningTime.toFixed(2) })
|
|
1525
1333
|
}),
|
|
1526
|
-
e.totalCost !== void 0 && /* @__PURE__ */
|
|
1334
|
+
e.totalCost !== void 0 && /* @__PURE__ */ q("span", {
|
|
1527
1335
|
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-sm",
|
|
1528
1336
|
children: t("debug.cost", { cost: e.totalCost.toFixed(2) })
|
|
1529
1337
|
})
|
|
1530
1338
|
]
|
|
1531
1339
|
});
|
|
1532
1340
|
}
|
|
1533
|
-
function
|
|
1341
|
+
function It({ explainLoading: e, explainError: t, explainResult: n, useAnalyze: r, aiButton: i }) {
|
|
1534
1342
|
let { t: a } = z();
|
|
1535
|
-
return e ? /* @__PURE__ */
|
|
1343
|
+
return e ? /* @__PURE__ */ q("div", {
|
|
1536
1344
|
className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded-sm dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
|
|
1537
1345
|
children: a(r ? "debug.explainRunningAnalyze" : "debug.explainRunningBasic")
|
|
1538
|
-
}) : t ? /* @__PURE__ */
|
|
1346
|
+
}) : t ? /* @__PURE__ */ J("div", {
|
|
1539
1347
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded-sm dc:border border-dc-error",
|
|
1540
1348
|
children: [
|
|
1541
|
-
/* @__PURE__ */
|
|
1349
|
+
/* @__PURE__ */ q("strong", { children: a("debug.explainError") }),
|
|
1542
1350
|
" ",
|
|
1543
1351
|
t.message
|
|
1544
1352
|
]
|
|
1545
|
-
}) : n ? /* @__PURE__ */
|
|
1353
|
+
}) : n ? /* @__PURE__ */ J("div", {
|
|
1546
1354
|
className: "dc:space-y-3",
|
|
1547
1355
|
children: [
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
n.summary.usedIndexes.length > 0 && /* @__PURE__ */
|
|
1356
|
+
/* @__PURE__ */ q(Ft, { summary: n.summary }),
|
|
1357
|
+
n.summary.usedIndexes.length > 0 && /* @__PURE__ */ J("div", {
|
|
1550
1358
|
className: "dc:text-xs text-dc-text-muted",
|
|
1551
1359
|
children: [
|
|
1552
|
-
/* @__PURE__ */
|
|
1360
|
+
/* @__PURE__ */ q("strong", { children: a("debug.indexes") }),
|
|
1553
1361
|
" ",
|
|
1554
1362
|
n.summary.usedIndexes.join(", ")
|
|
1555
1363
|
]
|
|
1556
1364
|
}),
|
|
1557
|
-
/* @__PURE__ */
|
|
1365
|
+
/* @__PURE__ */ q(g, {
|
|
1558
1366
|
code: n.raw,
|
|
1559
1367
|
language: "sql",
|
|
1560
1368
|
title: a("debug.executionPlanTitle", { database: n.summary.database }),
|
|
@@ -1566,24 +1374,24 @@ function Ut({ explainLoading: e, explainError: t, explainResult: n, useAnalyze:
|
|
|
1566
1374
|
}
|
|
1567
1375
|
//#endregion
|
|
1568
1376
|
//#region src/client/components/AnalysisBuilder/ExecutionPlanPanel.tsx
|
|
1569
|
-
var
|
|
1377
|
+
var Lt = xe(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" }) {
|
|
1570
1378
|
let { t: v } = z(), [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 = () => {
|
|
1571
1379
|
f && i && h && (f(i, h), S(!0));
|
|
1572
1380
|
}, T = () => {
|
|
1573
1381
|
S(!1);
|
|
1574
|
-
}, E = m && i ? /* @__PURE__ */
|
|
1382
|
+
}, E = m && i ? /* @__PURE__ */ q("button", {
|
|
1575
1383
|
onClick: w,
|
|
1576
1384
|
disabled: u,
|
|
1577
1385
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded-sm 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",
|
|
1578
|
-
children: u ? /* @__PURE__ */
|
|
1386
|
+
children: u ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("span", {
|
|
1579
1387
|
className: "dc:animate-spin",
|
|
1580
1388
|
children: "⟳"
|
|
1581
|
-
}), v("debug.aiAnalyzing")] }) : /* @__PURE__ */ K
|
|
1389
|
+
}), v("debug.aiAnalyzing")] }) : /* @__PURE__ */ q(K, { children: `✨ ${v("debug.aiAnalysis")}` })
|
|
1582
1390
|
}) : null;
|
|
1583
|
-
return /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ J("div", {
|
|
1584
1392
|
className: "dc:space-y-3",
|
|
1585
1393
|
children: [
|
|
1586
|
-
/* @__PURE__ */
|
|
1394
|
+
/* @__PURE__ */ q(Pt, {
|
|
1587
1395
|
sql: e,
|
|
1588
1396
|
sqlLoading: t,
|
|
1589
1397
|
sqlError: n,
|
|
@@ -1591,37 +1399,37 @@ var Wt = ve(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder:
|
|
|
1591
1399
|
formattedSql: C,
|
|
1592
1400
|
title: g,
|
|
1593
1401
|
height: _,
|
|
1594
|
-
headerRight: /* @__PURE__ */
|
|
1402
|
+
headerRight: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("label", {
|
|
1595
1403
|
className: "dc:flex dc:items-center dc:gap-1 dc:text-xs text-dc-text-secondary dc:cursor-pointer",
|
|
1596
|
-
children: [/* @__PURE__ */
|
|
1404
|
+
children: [/* @__PURE__ */ q("input", {
|
|
1597
1405
|
type: "checkbox",
|
|
1598
1406
|
checked: y,
|
|
1599
1407
|
onChange: (e) => b(e.target.checked),
|
|
1600
1408
|
className: "dc:w-3 dc:h-3 dc:rounded-sm border-dc-border text-dc-accent focus:ring-dc-accent"
|
|
1601
1409
|
}), v("debug.explainIncludeTiming")]
|
|
1602
|
-
}), /* @__PURE__ */
|
|
1410
|
+
}), /* @__PURE__ */ q("button", {
|
|
1603
1411
|
onClick: () => c({ analyze: y }),
|
|
1604
1412
|
disabled: a,
|
|
1605
1413
|
className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded-sm 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",
|
|
1606
1414
|
children: v(a ? "debug.explainRunning" : "debug.explainPlan")
|
|
1607
1415
|
})] })
|
|
1608
1416
|
}),
|
|
1609
|
-
o && /* @__PURE__ */
|
|
1417
|
+
o && /* @__PURE__ */ q("div", { children: /* @__PURE__ */ q(It, {
|
|
1610
1418
|
explainLoading: a,
|
|
1611
1419
|
explainError: s,
|
|
1612
1420
|
explainResult: i,
|
|
1613
1421
|
useAnalyze: y,
|
|
1614
1422
|
aiButton: E
|
|
1615
1423
|
}) }),
|
|
1616
|
-
d && /* @__PURE__ */
|
|
1424
|
+
d && /* @__PURE__ */ J("div", {
|
|
1617
1425
|
className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded-sm dc:border border-dc-error",
|
|
1618
1426
|
children: [
|
|
1619
|
-
/* @__PURE__ */
|
|
1427
|
+
/* @__PURE__ */ q("strong", { children: v("debug.aiAnalysisError") }),
|
|
1620
1428
|
" ",
|
|
1621
1429
|
d.message
|
|
1622
1430
|
]
|
|
1623
1431
|
}),
|
|
1624
|
-
x && l && /* @__PURE__ */
|
|
1432
|
+
x && l && /* @__PURE__ */ q(it, {
|
|
1625
1433
|
analysis: l,
|
|
1626
1434
|
onClose: T
|
|
1627
1435
|
})
|
|
@@ -1630,7 +1438,7 @@ var Wt = ve(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder:
|
|
|
1630
1438
|
});
|
|
1631
1439
|
//#endregion
|
|
1632
1440
|
//#region src/client/adapters/queryModeAdapter.ts
|
|
1633
|
-
function
|
|
1441
|
+
function Rt() {
|
|
1634
1442
|
return {
|
|
1635
1443
|
metrics: [],
|
|
1636
1444
|
breakdowns: [],
|
|
@@ -1641,10 +1449,10 @@ function Gt() {
|
|
|
1641
1449
|
validationError: null
|
|
1642
1450
|
};
|
|
1643
1451
|
}
|
|
1644
|
-
function
|
|
1452
|
+
function zt(e) {
|
|
1645
1453
|
return e.map((e) => e.field);
|
|
1646
1454
|
}
|
|
1647
|
-
function
|
|
1455
|
+
function Bt(e, t) {
|
|
1648
1456
|
let n = [], r = [];
|
|
1649
1457
|
for (let i of e) if (i.isTimeDimension) {
|
|
1650
1458
|
let e = {
|
|
@@ -1652,7 +1460,7 @@ function qt(e, t) {
|
|
|
1652
1460
|
granularity: i.granularity || "day"
|
|
1653
1461
|
};
|
|
1654
1462
|
if (i.enableComparison) {
|
|
1655
|
-
let n =
|
|
1463
|
+
let n = Ce(i.field, t);
|
|
1656
1464
|
n && (e.compareDateRange = n);
|
|
1657
1465
|
}
|
|
1658
1466
|
r.push(e);
|
|
@@ -1662,31 +1470,31 @@ function qt(e, t) {
|
|
|
1662
1470
|
timeDimensions: r
|
|
1663
1471
|
};
|
|
1664
1472
|
}
|
|
1665
|
-
function
|
|
1666
|
-
let { dimensions: t, timeDimensions: n } =
|
|
1667
|
-
measures:
|
|
1473
|
+
function Vt(e) {
|
|
1474
|
+
let { dimensions: t, timeDimensions: n } = Bt(e.breakdowns, e.filters), r = {
|
|
1475
|
+
measures: zt(e.metrics),
|
|
1668
1476
|
dimensions: t
|
|
1669
1477
|
};
|
|
1670
1478
|
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;
|
|
1671
1479
|
}
|
|
1672
|
-
function
|
|
1480
|
+
function Ht(e) {
|
|
1673
1481
|
return e.map((e, t) => ({
|
|
1674
|
-
id:
|
|
1482
|
+
id: h(),
|
|
1675
1483
|
field: e,
|
|
1676
|
-
label:
|
|
1484
|
+
label: m(t)
|
|
1677
1485
|
}));
|
|
1678
1486
|
}
|
|
1679
|
-
function
|
|
1487
|
+
function Ut(e) {
|
|
1680
1488
|
let t = [];
|
|
1681
1489
|
if (e.dimensions) for (let n of e.dimensions) t.push({
|
|
1682
|
-
id:
|
|
1490
|
+
id: h(),
|
|
1683
1491
|
field: n,
|
|
1684
1492
|
isTimeDimension: !1
|
|
1685
1493
|
});
|
|
1686
1494
|
if (e.timeDimensions) for (let n of e.timeDimensions) {
|
|
1687
1495
|
let e = !!(n.compareDateRange && n.compareDateRange.length > 0);
|
|
1688
1496
|
t.push({
|
|
1689
|
-
id:
|
|
1497
|
+
id: h(),
|
|
1690
1498
|
field: n.dimension,
|
|
1691
1499
|
granularity: n.granularity,
|
|
1692
1500
|
isTimeDimension: !0,
|
|
@@ -1695,10 +1503,10 @@ function Xt(e) {
|
|
|
1695
1503
|
}
|
|
1696
1504
|
return t;
|
|
1697
1505
|
}
|
|
1698
|
-
function
|
|
1506
|
+
function Wt(e) {
|
|
1699
1507
|
return {
|
|
1700
|
-
metrics:
|
|
1701
|
-
breakdowns:
|
|
1508
|
+
metrics: Ht(e.measures || []),
|
|
1509
|
+
breakdowns: Ut(e),
|
|
1702
1510
|
filters: e.filters || [],
|
|
1703
1511
|
order: e.order,
|
|
1704
1512
|
limit: e.limit,
|
|
@@ -1706,14 +1514,14 @@ function Zt(e) {
|
|
|
1706
1514
|
validationError: null
|
|
1707
1515
|
};
|
|
1708
1516
|
}
|
|
1709
|
-
function
|
|
1517
|
+
function Gt(e) {
|
|
1710
1518
|
return typeof e == "object" && !!e && "queries" in e && Array.isArray(e.queries);
|
|
1711
1519
|
}
|
|
1712
1520
|
var X = {
|
|
1713
1521
|
type: "query",
|
|
1714
1522
|
createInitial() {
|
|
1715
1523
|
return {
|
|
1716
|
-
queryStates: [
|
|
1524
|
+
queryStates: [Rt()],
|
|
1717
1525
|
activeQueryIndex: 0,
|
|
1718
1526
|
mergeStrategy: "concat"
|
|
1719
1527
|
};
|
|
@@ -1733,22 +1541,22 @@ var X = {
|
|
|
1733
1541
|
load(e) {
|
|
1734
1542
|
if (e.analysisType !== "query") throw Error(`Cannot load ${e.analysisType} config with query adapter`);
|
|
1735
1543
|
let t = e;
|
|
1736
|
-
if (
|
|
1737
|
-
let e = t.query, n = e.queries.map(
|
|
1738
|
-
return n.length === 0 && n.push(
|
|
1544
|
+
if (Gt(t.query)) {
|
|
1545
|
+
let e = t.query, n = e.queries.map(Wt);
|
|
1546
|
+
return n.length === 0 && n.push(Rt()), {
|
|
1739
1547
|
queryStates: n,
|
|
1740
1548
|
activeQueryIndex: 0,
|
|
1741
1549
|
mergeStrategy: e.mergeStrategy || "concat"
|
|
1742
1550
|
};
|
|
1743
1551
|
}
|
|
1744
1552
|
return {
|
|
1745
|
-
queryStates: [
|
|
1553
|
+
queryStates: [Wt(t.query)],
|
|
1746
1554
|
activeQueryIndex: 0,
|
|
1747
1555
|
mergeStrategy: "concat"
|
|
1748
1556
|
};
|
|
1749
1557
|
},
|
|
1750
1558
|
save(e, t, n) {
|
|
1751
|
-
let r = e.queryStates.map(
|
|
1559
|
+
let r = e.queryStates.map(Vt), i = r.length === 1 && e.mergeStrategy === "concat" ? r[0] : {
|
|
1752
1560
|
queries: r,
|
|
1753
1561
|
mergeStrategy: e.mergeStrategy
|
|
1754
1562
|
};
|
|
@@ -1789,36 +1597,36 @@ var X = {
|
|
|
1789
1597
|
}
|
|
1790
1598
|
};
|
|
1791
1599
|
}
|
|
1792
|
-
}, Z = /* @__PURE__ */ new Map(),
|
|
1793
|
-
function
|
|
1794
|
-
|
|
1600
|
+
}, Z = /* @__PURE__ */ new Map(), Kt = !1;
|
|
1601
|
+
function qt() {
|
|
1602
|
+
Kt ||= (Z.has("query") || Z.set("query", X), Z.has("funnel") || Z.set("funnel", S), Z.has("flow") || Z.set("flow", x), Z.has("retention") || Z.set("retention", T), !0);
|
|
1795
1603
|
}
|
|
1796
1604
|
var Q = {
|
|
1797
1605
|
register(e) {
|
|
1798
1606
|
Z.has(e.type) && console.warn(`[adapterRegistry] Overwriting existing adapter for type: ${e.type}`), Z.set(e.type, e);
|
|
1799
1607
|
},
|
|
1800
1608
|
get(e) {
|
|
1801
|
-
|
|
1609
|
+
qt();
|
|
1802
1610
|
let t = Z.get(e);
|
|
1803
1611
|
if (!t) throw Error(`[adapterRegistry] No adapter registered for type: ${e}. Available types: ${Array.from(Z.keys()).join(", ") || "none"}`);
|
|
1804
1612
|
return t;
|
|
1805
1613
|
},
|
|
1806
1614
|
has(e) {
|
|
1807
|
-
return
|
|
1615
|
+
return qt(), Z.has(e);
|
|
1808
1616
|
},
|
|
1809
1617
|
getRegisteredTypes() {
|
|
1810
|
-
return
|
|
1618
|
+
return qt(), Array.from(Z.keys());
|
|
1811
1619
|
},
|
|
1812
1620
|
clear() {
|
|
1813
|
-
Z.clear(),
|
|
1621
|
+
Z.clear(), Kt = !1;
|
|
1814
1622
|
}
|
|
1815
|
-
},
|
|
1623
|
+
}, Jt = () => ({
|
|
1816
1624
|
analysisType: "query",
|
|
1817
1625
|
charts: {
|
|
1818
1626
|
query: X.getDefaultChartConfig(),
|
|
1819
|
-
funnel:
|
|
1820
|
-
flow:
|
|
1821
|
-
retention:
|
|
1627
|
+
funnel: S.getDefaultChartConfig(),
|
|
1628
|
+
flow: x.getDefaultChartConfig(),
|
|
1629
|
+
retention: T.getDefaultChartConfig()
|
|
1822
1630
|
},
|
|
1823
1631
|
activeViews: {
|
|
1824
1632
|
query: "chart",
|
|
@@ -1828,8 +1636,8 @@ var Q = {
|
|
|
1828
1636
|
},
|
|
1829
1637
|
userManuallySelectedChart: !1,
|
|
1830
1638
|
localPaletteName: "default"
|
|
1831
|
-
}),
|
|
1832
|
-
...
|
|
1639
|
+
}), Yt = (e, t, n) => ({
|
|
1640
|
+
...Jt(),
|
|
1833
1641
|
setAnalysisType: (t) => {
|
|
1834
1642
|
e((e) => {
|
|
1835
1643
|
let n = { ...e.charts };
|
|
@@ -2042,12 +1850,12 @@ var Q = {
|
|
|
2042
1850
|
...u
|
|
2043
1851
|
});
|
|
2044
1852
|
}
|
|
2045
|
-
}),
|
|
1853
|
+
}), Xt = () => ({
|
|
2046
1854
|
queryStates: [Y()],
|
|
2047
1855
|
activeQueryIndex: 0,
|
|
2048
1856
|
mergeStrategy: "concat"
|
|
2049
|
-
}),
|
|
2050
|
-
...
|
|
1857
|
+
}), Zt = (e, t, n) => ({
|
|
1858
|
+
...Xt(),
|
|
2051
1859
|
setQueryStates: (t) => e({ queryStates: t }),
|
|
2052
1860
|
updateQueryState: (t, n) => e((e) => {
|
|
2053
1861
|
let r = [...e.queryStates];
|
|
@@ -2077,9 +1885,9 @@ var Q = {
|
|
|
2077
1885
|
}),
|
|
2078
1886
|
addMetric: (t, n) => e((e) => {
|
|
2079
1887
|
let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = {
|
|
2080
|
-
id:
|
|
1888
|
+
id: h(),
|
|
2081
1889
|
field: t,
|
|
2082
|
-
label: n ||
|
|
1890
|
+
label: n || m(a.metrics.length)
|
|
2083
1891
|
};
|
|
2084
1892
|
return i[r] = {
|
|
2085
1893
|
...a,
|
|
@@ -2102,9 +1910,9 @@ var Q = {
|
|
|
2102
1910
|
};
|
|
2103
1911
|
else {
|
|
2104
1912
|
let e = {
|
|
2105
|
-
id:
|
|
1913
|
+
id: h(),
|
|
2106
1914
|
field: t,
|
|
2107
|
-
label:
|
|
1915
|
+
label: m(i.metrics.length)
|
|
2108
1916
|
};
|
|
2109
1917
|
r[n] = {
|
|
2110
1918
|
...i,
|
|
@@ -2124,7 +1932,7 @@ var Q = {
|
|
|
2124
1932
|
let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || Y();
|
|
2125
1933
|
if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
|
|
2126
1934
|
let s = {
|
|
2127
|
-
id:
|
|
1935
|
+
id: h(),
|
|
2128
1936
|
field: t,
|
|
2129
1937
|
isTimeDimension: n,
|
|
2130
1938
|
granularity: n ? r || "month" : void 0
|
|
@@ -2151,7 +1959,7 @@ var Q = {
|
|
|
2151
1959
|
else {
|
|
2152
1960
|
if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
|
|
2153
1961
|
let s = {
|
|
2154
|
-
id:
|
|
1962
|
+
id: h(),
|
|
2155
1963
|
field: t,
|
|
2156
1964
|
isTimeDimension: n,
|
|
2157
1965
|
granularity: n ? r || "month" : void 0
|
|
@@ -2199,7 +2007,7 @@ var Q = {
|
|
|
2199
2007
|
member: l.field,
|
|
2200
2008
|
operator: "inDateRange",
|
|
2201
2009
|
values: [],
|
|
2202
|
-
dateRange:
|
|
2010
|
+
dateRange: I("last_n_months", 3)
|
|
2203
2011
|
};
|
|
2204
2012
|
s[c] = {
|
|
2205
2013
|
...s[c],
|
|
@@ -2288,11 +2096,11 @@ var Q = {
|
|
|
2288
2096
|
},
|
|
2289
2097
|
buildCurrentQuery: () => {
|
|
2290
2098
|
let e = t(), n = e.queryStates[e.activeQueryIndex] || Y(), r = l(e.charts[e.analysisType]?.chartType ?? "");
|
|
2291
|
-
return
|
|
2099
|
+
return Te(n.metrics, n.breakdowns, n.filters, n.order, !1, n.limit, r);
|
|
2292
2100
|
},
|
|
2293
2101
|
buildAllQueries: () => {
|
|
2294
2102
|
let e = t(), n = e.queryStates[0]?.breakdowns || [], r = l(e.charts[e.analysisType]?.chartType ?? "");
|
|
2295
|
-
return e.queryStates.map((t, i) =>
|
|
2103
|
+
return e.queryStates.map((t, i) => Te(t.metrics, e.mergeStrategy === "merge" && i > 0 ? n : t.breakdowns, t.filters, t.order, !1, t.limit, r));
|
|
2296
2104
|
},
|
|
2297
2105
|
buildMultiQueryConfig: () => {
|
|
2298
2106
|
let e = t();
|
|
@@ -2305,18 +2113,18 @@ var Q = {
|
|
|
2305
2113
|
queryLabels: n.map((e, t) => `Q${t + 1}`)
|
|
2306
2114
|
};
|
|
2307
2115
|
}
|
|
2308
|
-
}),
|
|
2116
|
+
}), Qt = () => ({
|
|
2309
2117
|
funnelCube: null,
|
|
2310
2118
|
funnelSteps: [],
|
|
2311
2119
|
activeFunnelStepIndex: 0,
|
|
2312
2120
|
funnelTimeDimension: null,
|
|
2313
2121
|
funnelBindingKey: null,
|
|
2314
2122
|
stepTimeToConvert: []
|
|
2315
|
-
}),
|
|
2316
|
-
...
|
|
2123
|
+
}), $t = (e, t, n) => ({
|
|
2124
|
+
...Qt(),
|
|
2317
2125
|
addFunnelStep: () => e((e) => {
|
|
2318
2126
|
let t = e.funnelSteps[e.funnelSteps.length - 1], n = {
|
|
2319
|
-
id:
|
|
2127
|
+
id: h(),
|
|
2320
2128
|
name: `Step ${e.funnelSteps.length + 1}`,
|
|
2321
2129
|
cube: e.funnelCube || "",
|
|
2322
2130
|
filters: t?.filters ? JSON.parse(JSON.stringify(t.filters)) : [],
|
|
@@ -2381,7 +2189,7 @@ var Q = {
|
|
|
2381
2189
|
let e = t();
|
|
2382
2190
|
return e.analysisType !== "funnel" || !e.funnelBindingKey || !e.funnelTimeDimension || e.funnelSteps.length < 2 ? !1 : e.funnelSteps.filter((e) => e.cube && e.name).length >= 2;
|
|
2383
2191
|
}
|
|
2384
|
-
}),
|
|
2192
|
+
}), en = () => ({
|
|
2385
2193
|
flowCube: null,
|
|
2386
2194
|
flowBindingKey: null,
|
|
2387
2195
|
flowTimeDimension: null,
|
|
@@ -2393,8 +2201,8 @@ var Q = {
|
|
|
2393
2201
|
stepsAfter: 3,
|
|
2394
2202
|
eventDimension: null,
|
|
2395
2203
|
joinStrategy: "auto"
|
|
2396
|
-
}),
|
|
2397
|
-
...
|
|
2204
|
+
}), tn = (e, t, n) => ({
|
|
2205
|
+
...en(),
|
|
2398
2206
|
setFlowCube: (t) => e(() => ({
|
|
2399
2207
|
flowCube: t,
|
|
2400
2208
|
flowBindingKey: null,
|
|
@@ -2464,8 +2272,8 @@ var Q = {
|
|
|
2464
2272
|
joinStrategy: e.joinStrategy
|
|
2465
2273
|
} };
|
|
2466
2274
|
}
|
|
2467
|
-
}),
|
|
2468
|
-
...
|
|
2275
|
+
}), nn = () => ({ ...ee }), rn = (e, t, n) => ({
|
|
2276
|
+
...nn(),
|
|
2469
2277
|
setRetentionCube: (t) => e(() => ({
|
|
2470
2278
|
retentionCube: t,
|
|
2471
2279
|
retentionTimeDimension: null,
|
|
@@ -2540,22 +2348,22 @@ var Q = {
|
|
|
2540
2348
|
warnings: r
|
|
2541
2349
|
};
|
|
2542
2350
|
}
|
|
2543
|
-
}),
|
|
2351
|
+
}), an = {
|
|
2544
2352
|
isOpen: !1,
|
|
2545
2353
|
userPrompt: "",
|
|
2546
2354
|
isGenerating: !1,
|
|
2547
2355
|
error: null,
|
|
2548
2356
|
hasGeneratedQuery: !1,
|
|
2549
2357
|
previousState: null
|
|
2550
|
-
},
|
|
2358
|
+
}, on = () => ({
|
|
2551
2359
|
activeTab: "query",
|
|
2552
2360
|
activeView: "chart",
|
|
2553
2361
|
displayLimit: 100,
|
|
2554
2362
|
showFieldModal: !1,
|
|
2555
2363
|
fieldModalMode: "metrics",
|
|
2556
|
-
aiState:
|
|
2557
|
-
}),
|
|
2558
|
-
...
|
|
2364
|
+
aiState: an
|
|
2365
|
+
}), sn = (e, t, n) => ({
|
|
2366
|
+
...on(),
|
|
2559
2367
|
setActiveTab: (t) => e({ activeTab: t }),
|
|
2560
2368
|
setActiveView: (t) => e((e) => ({
|
|
2561
2369
|
activeView: t,
|
|
@@ -2639,19 +2447,19 @@ var Q = {
|
|
|
2639
2447
|
displayConfig: t.displayConfig
|
|
2640
2448
|
}
|
|
2641
2449
|
},
|
|
2642
|
-
aiState: { ...
|
|
2450
|
+
aiState: { ...an }
|
|
2643
2451
|
};
|
|
2644
2452
|
})
|
|
2645
2453
|
});
|
|
2646
2454
|
//#endregion
|
|
2647
2455
|
//#region src/client/stores/optionsToAnalysisConfig.ts
|
|
2648
|
-
function
|
|
2456
|
+
function cn(e) {
|
|
2649
2457
|
let t = e.filters ? [...e.filters] : [], n = e.timeDimensions || [], r = [...(e.dimensions || []).map((e) => ({
|
|
2650
|
-
id:
|
|
2458
|
+
id: h(),
|
|
2651
2459
|
field: e,
|
|
2652
2460
|
isTimeDimension: !1
|
|
2653
2461
|
})), ...n.map((e) => ({
|
|
2654
|
-
id:
|
|
2462
|
+
id: h(),
|
|
2655
2463
|
field: e.dimension,
|
|
2656
2464
|
granularity: e.granularity,
|
|
2657
2465
|
isTimeDimension: !0,
|
|
@@ -2679,19 +2487,19 @@ function hn(e) {
|
|
|
2679
2487
|
return {
|
|
2680
2488
|
...Y(),
|
|
2681
2489
|
metrics: (e.measures || []).map((e, t) => ({
|
|
2682
|
-
id:
|
|
2490
|
+
id: h(),
|
|
2683
2491
|
field: e,
|
|
2684
|
-
label:
|
|
2492
|
+
label: m(t)
|
|
2685
2493
|
})),
|
|
2686
2494
|
breakdowns: r,
|
|
2687
2495
|
filters: i,
|
|
2688
2496
|
order: e.order
|
|
2689
2497
|
};
|
|
2690
2498
|
}
|
|
2691
|
-
function
|
|
2499
|
+
function ln(e) {
|
|
2692
2500
|
return "queries" in e && Array.isArray(e.queries);
|
|
2693
2501
|
}
|
|
2694
|
-
function
|
|
2502
|
+
function un(e, t) {
|
|
2695
2503
|
let n = e.getDefaultChartConfig();
|
|
2696
2504
|
return {
|
|
2697
2505
|
chartType: t?.chartType || n.chartType,
|
|
@@ -2699,22 +2507,22 @@ function _n(e, t) {
|
|
|
2699
2507
|
displayConfig: t?.displayConfig || n.displayConfig
|
|
2700
2508
|
};
|
|
2701
2509
|
}
|
|
2702
|
-
function
|
|
2510
|
+
function dn(e) {
|
|
2703
2511
|
return e.initialActiveView || "chart";
|
|
2704
2512
|
}
|
|
2705
|
-
function
|
|
2706
|
-
let t =
|
|
2707
|
-
return
|
|
2513
|
+
function fn(e) {
|
|
2514
|
+
let t = un(S, e.initialChartConfig), n = e.initialFunnelState ?? {};
|
|
2515
|
+
return S.save({
|
|
2708
2516
|
funnelCube: n.funnelCube ?? null,
|
|
2709
2517
|
funnelSteps: n.funnelSteps || [],
|
|
2710
2518
|
activeFunnelStepIndex: 0,
|
|
2711
2519
|
funnelTimeDimension: n.funnelTimeDimension ?? null,
|
|
2712
2520
|
funnelBindingKey: n.funnelBindingKey ?? null
|
|
2713
|
-
}, { funnel: t },
|
|
2521
|
+
}, { funnel: t }, dn(e));
|
|
2714
2522
|
}
|
|
2715
|
-
function
|
|
2716
|
-
let t =
|
|
2717
|
-
return
|
|
2523
|
+
function pn(e) {
|
|
2524
|
+
let t = un(x, e.initialChartConfig), n = e.initialFlowState ?? {};
|
|
2525
|
+
return x.save({
|
|
2718
2526
|
flowCube: n.flowCube ?? null,
|
|
2719
2527
|
flowBindingKey: n.flowBindingKey ?? null,
|
|
2720
2528
|
flowTimeDimension: n.flowTimeDimension ?? null,
|
|
@@ -2726,11 +2534,11 @@ function bn(e) {
|
|
|
2726
2534
|
stepsAfter: n.stepsAfter ?? 3,
|
|
2727
2535
|
eventDimension: n.eventDimension ?? null,
|
|
2728
2536
|
joinStrategy: n.joinStrategy ?? "auto"
|
|
2729
|
-
}, { flow: t },
|
|
2537
|
+
}, { flow: t }, dn(e));
|
|
2730
2538
|
}
|
|
2731
|
-
function
|
|
2732
|
-
let t =
|
|
2733
|
-
return
|
|
2539
|
+
function mn(e) {
|
|
2540
|
+
let t = un(T, e.initialChartConfig), n = e.initialRetentionState ?? {}, r = A(te);
|
|
2541
|
+
return T.save({
|
|
2734
2542
|
retentionCube: n.retentionCube ?? null,
|
|
2735
2543
|
retentionBindingKey: n.retentionBindingKey ?? null,
|
|
2736
2544
|
retentionTimeDimension: n.retentionTimeDimension ?? null,
|
|
@@ -2741,52 +2549,52 @@ function xn(e) {
|
|
|
2741
2549
|
retentionViewGranularity: n.retentionViewGranularity ?? "week",
|
|
2742
2550
|
retentionPeriods: n.retentionPeriods ?? 12,
|
|
2743
2551
|
retentionType: n.retentionType ?? "classic"
|
|
2744
|
-
}, { retention: t },
|
|
2552
|
+
}, { retention: t }, dn(e));
|
|
2745
2553
|
}
|
|
2746
|
-
function
|
|
2554
|
+
function hn(e, t) {
|
|
2747
2555
|
let n, r = "concat";
|
|
2748
|
-
|
|
2749
|
-
let i =
|
|
2556
|
+
ln(t) ? (n = t.queries.map(cn), t.mergeStrategy && (r = t.mergeStrategy)) : n = [cn(t)];
|
|
2557
|
+
let i = un(X, e.initialChartConfig);
|
|
2750
2558
|
return X.save({
|
|
2751
2559
|
queryStates: n,
|
|
2752
2560
|
activeQueryIndex: 0,
|
|
2753
2561
|
mergeStrategy: r
|
|
2754
|
-
}, { query: i },
|
|
2562
|
+
}, { query: i }, dn(e));
|
|
2755
2563
|
}
|
|
2756
|
-
function
|
|
2757
|
-
let t =
|
|
2564
|
+
function gn(e) {
|
|
2565
|
+
let t = un(X, e.initialChartConfig);
|
|
2758
2566
|
return X.save({
|
|
2759
2567
|
queryStates: [Y()],
|
|
2760
2568
|
activeQueryIndex: 0,
|
|
2761
2569
|
mergeStrategy: "concat"
|
|
2762
|
-
}, { query: t },
|
|
2570
|
+
}, { query: t }, dn(e));
|
|
2763
2571
|
}
|
|
2764
|
-
function
|
|
2572
|
+
function _n(e) {
|
|
2765
2573
|
return X.save({
|
|
2766
2574
|
queryStates: [Y()],
|
|
2767
2575
|
activeQueryIndex: 0,
|
|
2768
2576
|
mergeStrategy: "concat"
|
|
2769
2577
|
}, { query: X.getDefaultChartConfig() }, e.initialActiveView);
|
|
2770
2578
|
}
|
|
2771
|
-
function
|
|
2772
|
-
return e.initialAnalysisType === "funnel" && e.initialFunnelState ?
|
|
2579
|
+
function vn(e) {
|
|
2580
|
+
return e.initialAnalysisType === "funnel" && e.initialFunnelState ? fn(e) : e.initialAnalysisType === "flow" && e.initialFlowState ? pn(e) : e.initialAnalysisType === "retention" && e.initialRetentionState ? mn(e) : e.initialQuery ? hn(e, e.initialQuery) : e.initialChartConfig ? gn(e) : e.initialActiveView ? _n(e) : null;
|
|
2773
2581
|
}
|
|
2774
2582
|
//#endregion
|
|
2775
2583
|
//#region src/client/stores/analysisBuilderStore.tsx
|
|
2776
|
-
function
|
|
2584
|
+
function yn(e, t) {
|
|
2777
2585
|
return {
|
|
2778
2586
|
reset: () => {
|
|
2779
2587
|
e({
|
|
2780
|
-
...
|
|
2781
|
-
...
|
|
2782
|
-
...
|
|
2783
|
-
...
|
|
2784
|
-
...
|
|
2588
|
+
...Jt(),
|
|
2589
|
+
...Xt(),
|
|
2590
|
+
...Qt(),
|
|
2591
|
+
...en(),
|
|
2592
|
+
...nn(),
|
|
2785
2593
|
charts: {
|
|
2786
2594
|
query: X.getDefaultChartConfig(),
|
|
2787
|
-
funnel:
|
|
2788
|
-
flow:
|
|
2789
|
-
retention:
|
|
2595
|
+
funnel: S.getDefaultChartConfig(),
|
|
2596
|
+
flow: x.getDefaultChartConfig(),
|
|
2597
|
+
retention: T.getDefaultChartConfig()
|
|
2790
2598
|
},
|
|
2791
2599
|
activeViews: {
|
|
2792
2600
|
query: "chart",
|
|
@@ -2799,28 +2607,28 @@ function En(e, t) {
|
|
|
2799
2607
|
clearCurrentMode: () => e((e) => {
|
|
2800
2608
|
switch (e.analysisType) {
|
|
2801
2609
|
case "funnel": return {
|
|
2802
|
-
...
|
|
2610
|
+
...Qt(),
|
|
2803
2611
|
charts: {
|
|
2804
2612
|
...e.charts,
|
|
2805
|
-
funnel:
|
|
2613
|
+
funnel: S.getDefaultChartConfig()
|
|
2806
2614
|
}
|
|
2807
2615
|
};
|
|
2808
2616
|
case "flow": return {
|
|
2809
|
-
...
|
|
2617
|
+
...en(),
|
|
2810
2618
|
charts: {
|
|
2811
2619
|
...e.charts,
|
|
2812
|
-
flow:
|
|
2620
|
+
flow: x.getDefaultChartConfig()
|
|
2813
2621
|
}
|
|
2814
2622
|
};
|
|
2815
2623
|
case "retention": return {
|
|
2816
|
-
...
|
|
2624
|
+
...nn(),
|
|
2817
2625
|
charts: {
|
|
2818
2626
|
...e.charts,
|
|
2819
|
-
retention:
|
|
2627
|
+
retention: T.getDefaultChartConfig()
|
|
2820
2628
|
}
|
|
2821
2629
|
};
|
|
2822
2630
|
default: return {
|
|
2823
|
-
...
|
|
2631
|
+
...Xt(),
|
|
2824
2632
|
userManuallySelectedChart: !1,
|
|
2825
2633
|
charts: {
|
|
2826
2634
|
...e.charts,
|
|
@@ -2846,15 +2654,15 @@ function En(e, t) {
|
|
|
2846
2654
|
}
|
|
2847
2655
|
};
|
|
2848
2656
|
}
|
|
2849
|
-
function
|
|
2850
|
-
let r =
|
|
2851
|
-
...
|
|
2852
|
-
...
|
|
2657
|
+
function bn(n = {}) {
|
|
2658
|
+
let r = vn(n), o = (e, t, n) => ({
|
|
2659
|
+
...Yt(e, t, n),
|
|
2660
|
+
...Zt(e, t, n),
|
|
2661
|
+
...$t(e, t, n),
|
|
2662
|
+
...tn(e, t, n),
|
|
2663
|
+
...rn(e, t, n),
|
|
2853
2664
|
...sn(e, t, n),
|
|
2854
|
-
...
|
|
2855
|
-
...dn(e, t, n),
|
|
2856
|
-
...mn(e, t, n),
|
|
2857
|
-
...En(e, t)
|
|
2665
|
+
...yn(e, t)
|
|
2858
2666
|
});
|
|
2859
2667
|
if (n.disableLocalStorage) {
|
|
2860
2668
|
let t = a()(i(e(o), { name: "AnalysisBuilderStore (no-persist)" }));
|
|
@@ -2863,10 +2671,10 @@ function Dn(n = {}) {
|
|
|
2863
2671
|
return a()(i(e(t(o, {
|
|
2864
2672
|
name: n.storageKey || "drizzle-cube-analysis-builder-v3",
|
|
2865
2673
|
partialize: (e) => e.saveWorkspace(),
|
|
2866
|
-
merge: (e, t) => e &&
|
|
2674
|
+
merge: (e, t) => e && M(e) ? {
|
|
2867
2675
|
...t,
|
|
2868
2676
|
_persistedWorkspace: e
|
|
2869
|
-
} : e &&
|
|
2677
|
+
} : e && j(e) ? {
|
|
2870
2678
|
...t,
|
|
2871
2679
|
_persistedConfig: e
|
|
2872
2680
|
} : r ? {
|
|
@@ -2889,10 +2697,10 @@ function Dn(n = {}) {
|
|
|
2889
2697
|
}
|
|
2890
2698
|
})), { name: "AnalysisBuilderStore" }));
|
|
2891
2699
|
}
|
|
2892
|
-
var
|
|
2893
|
-
function
|
|
2700
|
+
var xn = be(null);
|
|
2701
|
+
function Sn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalStorage: r, storageKey: i, initialAnalysisType: a, initialFunnelState: o, initialFlowState: s, initialRetentionState: c, initialActiveView: l }) {
|
|
2894
2702
|
let u = W(null);
|
|
2895
|
-
return u.current ||=
|
|
2703
|
+
return u.current ||= bn({
|
|
2896
2704
|
initialQuery: t,
|
|
2897
2705
|
initialChartConfig: n,
|
|
2898
2706
|
disableLocalStorage: r,
|
|
@@ -2902,22 +2710,22 @@ function kn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalS
|
|
|
2902
2710
|
initialFlowState: s,
|
|
2903
2711
|
initialRetentionState: c,
|
|
2904
2712
|
initialActiveView: l
|
|
2905
|
-
}), /* @__PURE__ */
|
|
2713
|
+
}), /* @__PURE__ */ q(xn.Provider, {
|
|
2906
2714
|
value: u.current,
|
|
2907
2715
|
children: e
|
|
2908
2716
|
});
|
|
2909
2717
|
}
|
|
2910
2718
|
function $(e) {
|
|
2911
|
-
let t =
|
|
2719
|
+
let t = Se(xn);
|
|
2912
2720
|
if (!t) throw Error("useAnalysisBuilderStore must be used within AnalysisBuilderStoreProvider");
|
|
2913
2721
|
return r(t, e);
|
|
2914
2722
|
}
|
|
2915
|
-
function
|
|
2916
|
-
let e =
|
|
2723
|
+
function Cn() {
|
|
2724
|
+
let e = Se(xn);
|
|
2917
2725
|
if (!e) throw Error("useAnalysisBuilderStoreApi must be used within AnalysisBuilderStoreProvider");
|
|
2918
2726
|
return e;
|
|
2919
2727
|
}
|
|
2920
|
-
var
|
|
2728
|
+
var wn = (e) => e.queryStates[e.activeQueryIndex] || Y(), Tn = (e) => wn(e).metrics, En = (e) => wn(e).breakdowns, Dn = (e) => wn(e).filters, On = (e) => {
|
|
2921
2729
|
let t = e.charts[e.analysisType];
|
|
2922
2730
|
return t ? {
|
|
2923
2731
|
chartType: t.chartType,
|
|
@@ -2932,18 +2740,18 @@ var jn = (e) => e.queryStates[e.activeQueryIndex] || Y(), Mn = (e) => jn(e).metr
|
|
|
2932
2740
|
showTooltip: !0
|
|
2933
2741
|
}
|
|
2934
2742
|
};
|
|
2935
|
-
},
|
|
2743
|
+
}, kn = (e) => ({
|
|
2936
2744
|
activeTab: e.activeTab,
|
|
2937
2745
|
activeView: e.activeView,
|
|
2938
2746
|
displayLimit: e.displayLimit,
|
|
2939
2747
|
showFieldModal: e.showFieldModal,
|
|
2940
2748
|
fieldModalMode: e.fieldModalMode
|
|
2941
|
-
}),
|
|
2749
|
+
}), An = (e) => ({
|
|
2942
2750
|
queryStates: e.queryStates,
|
|
2943
2751
|
activeQueryIndex: e.activeQueryIndex,
|
|
2944
2752
|
mergeStrategy: e.mergeStrategy,
|
|
2945
2753
|
isMultiQueryMode: e.analysisType === "query" && e.queryStates.length > 1
|
|
2946
|
-
}),
|
|
2754
|
+
}), jn = (e) => ({
|
|
2947
2755
|
funnelCube: e.funnelCube,
|
|
2948
2756
|
funnelSteps: e.funnelSteps,
|
|
2949
2757
|
activeFunnelStepIndex: e.activeFunnelStepIndex,
|
|
@@ -2954,16 +2762,16 @@ var jn = (e) => e.queryStates[e.activeQueryIndex] || Y(), Mn = (e) => jn(e).metr
|
|
|
2954
2762
|
});
|
|
2955
2763
|
//#endregion
|
|
2956
2764
|
//#region src/client/utils/multiQueryValidation.ts
|
|
2957
|
-
function
|
|
2765
|
+
function Mn(e) {
|
|
2958
2766
|
return e.timeDimensions || [];
|
|
2959
2767
|
}
|
|
2960
|
-
function
|
|
2768
|
+
function Nn(e) {
|
|
2961
2769
|
let t = [];
|
|
2962
2770
|
if (e.length < 2) return t;
|
|
2963
|
-
let n =
|
|
2771
|
+
let n = Mn(e[0]);
|
|
2964
2772
|
if (n.length === 0) return t;
|
|
2965
2773
|
for (let r = 1; r < e.length; r++) {
|
|
2966
|
-
let i =
|
|
2774
|
+
let i = Mn(e[r]);
|
|
2967
2775
|
if (i.length === 0 && n.length > 0) {
|
|
2968
2776
|
t.push({
|
|
2969
2777
|
type: "missing_time_dimension",
|
|
@@ -2989,7 +2797,7 @@ function Bn(e) {
|
|
|
2989
2797
|
}
|
|
2990
2798
|
return t;
|
|
2991
2799
|
}
|
|
2992
|
-
function
|
|
2800
|
+
function Pn(e, t) {
|
|
2993
2801
|
let n = [];
|
|
2994
2802
|
if (e.length < 2 || t.length === 0) return n;
|
|
2995
2803
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -3003,7 +2811,7 @@ function Vn(e, t) {
|
|
|
3003
2811
|
}
|
|
3004
2812
|
return n;
|
|
3005
2813
|
}
|
|
3006
|
-
function
|
|
2814
|
+
function Fn(e) {
|
|
3007
2815
|
let t = [];
|
|
3008
2816
|
if (e.length < 2) return t;
|
|
3009
2817
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -3022,7 +2830,7 @@ function Hn(e) {
|
|
|
3022
2830
|
affectedMeasures: r
|
|
3023
2831
|
}), t;
|
|
3024
2832
|
}
|
|
3025
|
-
function
|
|
2833
|
+
function In(e) {
|
|
3026
2834
|
let t = [];
|
|
3027
2835
|
if (e.length < 2) return t;
|
|
3028
2836
|
let n = e.map((e) => e.timeDimensions?.[0]?.dateRange);
|
|
@@ -3032,38 +2840,38 @@ function Un(e) {
|
|
|
3032
2840
|
message: "Queries have different date ranges - some data points may be missing in merged results"
|
|
3033
2841
|
}), t;
|
|
3034
2842
|
}
|
|
3035
|
-
function
|
|
2843
|
+
function Ln(e, t, n = []) {
|
|
3036
2844
|
let r = [], i = [];
|
|
3037
2845
|
return e.length < 2 ? {
|
|
3038
2846
|
isValid: !0,
|
|
3039
2847
|
errors: r,
|
|
3040
2848
|
warnings: i
|
|
3041
|
-
} : (i.push(...
|
|
2849
|
+
} : (i.push(...Fn(e)), i.push(...In(e)), t === "merge" && (r.push(...Nn(e)), n.length > 0 && r.push(...Pn(e, n))), {
|
|
3042
2850
|
isValid: r.length === 0,
|
|
3043
2851
|
errors: r,
|
|
3044
2852
|
warnings: i
|
|
3045
2853
|
});
|
|
3046
2854
|
}
|
|
3047
|
-
function
|
|
2855
|
+
function Rn(e) {
|
|
3048
2856
|
return (e.measures?.length || 0) + (e.dimensions?.length || 0) + (e.timeDimensions?.length || 0);
|
|
3049
2857
|
}
|
|
3050
|
-
function
|
|
3051
|
-
return e.filter((e) =>
|
|
2858
|
+
function zn(e) {
|
|
2859
|
+
return e.filter((e) => Rn(e) > 0).length >= 2;
|
|
3052
2860
|
}
|
|
3053
|
-
function
|
|
2861
|
+
function Bn(e, t) {
|
|
3054
2862
|
return `${e} ${t}${e === 1 ? "" : "s"}`;
|
|
3055
2863
|
}
|
|
3056
|
-
function
|
|
2864
|
+
function Vn(e) {
|
|
3057
2865
|
if (e.isValid && e.warnings.length === 0) return "Configuration is valid";
|
|
3058
2866
|
let t = [];
|
|
3059
|
-
return e.errors.length > 0 && t.push(
|
|
2867
|
+
return e.errors.length > 0 && t.push(Bn(e.errors.length, "error")), e.warnings.length > 0 && t.push(Bn(e.warnings.length, "warning")), t.join(", ");
|
|
3060
2868
|
}
|
|
3061
2869
|
//#endregion
|
|
3062
2870
|
//#region src/client/hooks/useAnalysisState.ts
|
|
3063
|
-
function
|
|
3064
|
-
let { externalColorPalette: t } = e, r =
|
|
2871
|
+
function Hn(e = {}) {
|
|
2872
|
+
let { externalColorPalette: t } = e, r = Cn(), i = $((e) => e.queryStates), a = $((e) => e.activeQueryIndex), o = $((e) => e.mergeStrategy), s = $((e) => e.setActiveQueryIndex), c = $((e) => e.setMergeStrategy), u = $((e) => e.addQuery), d = $((e) => e.removeQuery), p = $((e) => e.getCurrentState), m = $((e) => e.getMergeKeys), h = $((e) => e.isMultiQueryMode), g = p(), _ = h(), v = m(), y = $((e) => l(e.charts[e.analysisType]?.chartType ?? "")), b = U(() => {
|
|
3065
2873
|
let e = i[a] || g;
|
|
3066
|
-
return
|
|
2874
|
+
return Te(e.metrics, e.breakdowns, e.filters, e.order, !1, e.limit, y);
|
|
3067
2875
|
}, [
|
|
3068
2876
|
i,
|
|
3069
2877
|
a,
|
|
@@ -3071,7 +2879,7 @@ function Yn(e = {}) {
|
|
|
3071
2879
|
y
|
|
3072
2880
|
]), x = U(() => {
|
|
3073
2881
|
let e = i[0]?.breakdowns || [];
|
|
3074
|
-
return i.map((t, n) =>
|
|
2882
|
+
return i.map((t, n) => Te(t.metrics, o === "merge" && n > 0 ? e : t.breakdowns, t.filters, t.order, !1, t.limit, y));
|
|
3075
2883
|
}, [
|
|
3076
2884
|
i,
|
|
3077
2885
|
o,
|
|
@@ -3090,7 +2898,7 @@ function Yn(e = {}) {
|
|
|
3090
2898
|
i.length,
|
|
3091
2899
|
o,
|
|
3092
2900
|
v
|
|
3093
|
-
]), C = U(() => _ ?
|
|
2901
|
+
]), C = U(() => _ ? Ln(x, o, v || []) : null, [
|
|
3094
2902
|
_,
|
|
3095
2903
|
x,
|
|
3096
2904
|
o,
|
|
@@ -3132,61 +2940,61 @@ function Yn(e = {}) {
|
|
|
3132
2940
|
k,
|
|
3133
2941
|
j,
|
|
3134
2942
|
A
|
|
3135
|
-
]),
|
|
2943
|
+
]), N = $((e) => e.charts.funnel?.chartType) || "funnel", ne = $((e) => e.charts.funnel?.chartConfig), re = U(() => ne || {}, [ne]), ie = $((e) => e.charts.funnel?.displayConfig), ae = U(() => ie || {
|
|
3136
2944
|
showLegend: !0,
|
|
3137
2945
|
showGrid: !0,
|
|
3138
2946
|
showTooltip: !0
|
|
3139
|
-
}, [ie]), P = $((e) => e.flowCube),
|
|
2947
|
+
}, [ie]), P = $((e) => e.flowCube), oe = $((e) => e.flowBindingKey), se = $((e) => e.flowTimeDimension), F = $((e) => e.eventDimension), I = $((e) => e.startingStep), L = $((e) => e.stepsBefore), ce = $((e) => e.stepsAfter), le = $((e) => e.joinStrategy), R = $((e) => e.charts.flow?.displayConfig), ue = U(() => R || {
|
|
3140
2948
|
showLegend: !0,
|
|
3141
2949
|
showGrid: !0,
|
|
3142
2950
|
showTooltip: !0
|
|
3143
|
-
}, [
|
|
2951
|
+
}, [R]), de = $((e) => e.charts.flow?.chartType) || "sankey", fe = $((e) => e.buildFunnelQueryFromSteps), pe = U(() => O === "funnel" ? fe() : null, [
|
|
3144
2952
|
O,
|
|
3145
|
-
|
|
2953
|
+
fe,
|
|
3146
2954
|
A
|
|
3147
|
-
]),
|
|
2955
|
+
]), me = $((e) => e.buildFlowQuery), z = U(() => O === "flow" ? me() : null, [
|
|
3148
2956
|
O,
|
|
3149
|
-
|
|
2957
|
+
me,
|
|
3150
2958
|
P,
|
|
3151
|
-
F,
|
|
3152
2959
|
oe,
|
|
3153
2960
|
se,
|
|
2961
|
+
F,
|
|
3154
2962
|
I,
|
|
3155
2963
|
L,
|
|
3156
2964
|
ce,
|
|
3157
|
-
|
|
2965
|
+
de,
|
|
3158
2966
|
le
|
|
3159
|
-
]), he = $((e) => e.retentionCube), ge = $((e) => e.retentionBindingKey),
|
|
2967
|
+
]), he = $((e) => e.retentionCube), ge = $((e) => e.retentionBindingKey), _e = $((e) => e.retentionTimeDimension), ve = $((e) => e.retentionDateRange), ye = $((e) => e.retentionCohortFilters), B = $((e) => e.retentionActivityFilters), be = $((e) => e.retentionBreakdowns), xe = $((e) => e.retentionViewGranularity), Se = $((e) => e.retentionPeriods), H = $((e) => e.retentionType), W = $((e) => e.buildRetentionQuery), K = $((e) => e.getRetentionValidation), q = $((e) => e.charts.retention?.displayConfig), J = U(() => O === "retention" ? W() : null, [
|
|
3160
2968
|
O,
|
|
3161
|
-
|
|
2969
|
+
W,
|
|
3162
2970
|
he,
|
|
3163
2971
|
ge,
|
|
3164
|
-
B,
|
|
3165
2972
|
_e,
|
|
3166
|
-
H,
|
|
3167
|
-
W,
|
|
3168
|
-
be,
|
|
3169
|
-
K,
|
|
3170
2973
|
ve,
|
|
3171
|
-
|
|
3172
|
-
]), Ce = U(() => O === "retention" ? xe() : null, [
|
|
3173
|
-
O,
|
|
2974
|
+
be,
|
|
3174
2975
|
xe,
|
|
2976
|
+
Se,
|
|
2977
|
+
H,
|
|
2978
|
+
ye,
|
|
2979
|
+
B
|
|
2980
|
+
]), Ce = U(() => O === "retention" ? K() : null, [
|
|
2981
|
+
O,
|
|
2982
|
+
K,
|
|
3175
2983
|
he,
|
|
3176
2984
|
ge,
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
]), we = U(() => O === "retention" ?
|
|
2985
|
+
_e,
|
|
2986
|
+
ve
|
|
2987
|
+
]), we = U(() => O === "retention" ? J !== null : O === "flow" ? z !== null : O === "funnel" ? pe !== null : w ?? !1, [
|
|
3180
2988
|
O,
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
2989
|
+
J,
|
|
2990
|
+
z,
|
|
2991
|
+
pe,
|
|
3184
2992
|
w
|
|
3185
|
-
]), { chartType:
|
|
2993
|
+
]), { chartType: Y, chartConfig: Ee, displayConfig: De } = $(n(On)), Oe = $((e) => e.userManuallySelectedChart), ke = $((e) => e.localPaletteName), Ae = $((e) => e.setChartTypeManual), je = $((e) => e.setChartConfig), Me = $((e) => e.setDisplayConfig), Ne = $((e) => e.setFunnelChartType), Pe = $((e) => e.setFunnelChartConfig), Fe = $((e) => e.setFunnelDisplayConfig), Ie = $((e) => e.setLocalPaletteName), Le = $((e) => e.setUserManuallySelectedChart), Re = V((e) => {
|
|
3186
2994
|
if (O === "funnel") Ne(e);
|
|
3187
2995
|
else {
|
|
3188
2996
|
Ae(e);
|
|
3189
|
-
let { chartConfig: t } =
|
|
2997
|
+
let { chartConfig: t } = At(T, E, e);
|
|
3190
2998
|
je(t);
|
|
3191
2999
|
}
|
|
3192
3000
|
}, [
|
|
@@ -3203,17 +3011,17 @@ function Yn(e = {}) {
|
|
|
3203
3011
|
Pe,
|
|
3204
3012
|
je
|
|
3205
3013
|
]), Be = V((e) => {
|
|
3206
|
-
O === "funnel" ? Fe(e) :
|
|
3014
|
+
O === "funnel" ? Fe(e) : Me(e);
|
|
3207
3015
|
}, [
|
|
3208
3016
|
O,
|
|
3209
3017
|
Fe,
|
|
3210
|
-
|
|
3211
|
-
]), Ve = U(() =>
|
|
3018
|
+
Me
|
|
3019
|
+
]), Ve = U(() => Ot(T, E), [T, E]), He = U(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
|
|
3212
3020
|
name: "custom",
|
|
3213
3021
|
label: "Custom",
|
|
3214
3022
|
colors: t,
|
|
3215
3023
|
gradient: t
|
|
3216
|
-
} : t :
|
|
3024
|
+
} : t : f(ke), [t, ke]), Ue = V((e) => {
|
|
3217
3025
|
r.setState((t) => ({ charts: {
|
|
3218
3026
|
...t.charts,
|
|
3219
3027
|
flow: {
|
|
@@ -3237,33 +3045,33 @@ function Yn(e = {}) {
|
|
|
3237
3045
|
displayConfig: e
|
|
3238
3046
|
}
|
|
3239
3047
|
} }));
|
|
3240
|
-
}, [r]), Ge = $((e) => e.activeTab), Ke = $((e) => e.activeView), qe = $((e) => e.displayLimit), Je = $((e) => e.showFieldModal), Ye = $((e) => e.fieldModalMode), Xe = $((e) => e.setActiveTab), Ze = $((e) => e.setActiveView), Qe = $((e) => e.setDisplayLimit), $e = $((e) => e.closeFieldModal), [et, tt] = G(0), nt = $((e) => e.openMetricsModal), rt = $((e) => e.addMetric), it = $((e) => e.removeMetric), at = $((e) => e.toggleMetric), ot = $((e) => e.reorderMetrics), st = $((e) => e.openBreakdownsModal), ct = $((e) => e.addBreakdown), lt = $((e) => e.removeBreakdown), ut = $((e) => e.toggleBreakdown), dt = $((e) => e.setBreakdownGranularity), ft = $((e) => e.toggleBreakdownComparison), pt = $((e) => e.reorderBreakdowns), mt = $((e) => e.setFilters), ht = $((e) => e.dropFieldToFilter), gt = $((e) => e.setOrder), _t = $((e) => e.setLimit), vt = $((e) => e.clearQuery), yt = $((e) => e.clearCurrentMode), bt = $((e) => e.setFunnelBindingKey), xt = $((e) => e.setAnalysisType), St = $((e) => e.setFunnelCube), Ct = $((e) => e.addFunnelStep), wt = $((e) => e.removeFunnelStep), Tt = $((e) => e.updateFunnelStep), Et = $((e) => e.setActiveFunnelStepIndex), Dt = $((e) => e.reorderFunnelSteps),
|
|
3241
|
-
|
|
3048
|
+
}, [r]), Ge = $((e) => e.activeTab), Ke = $((e) => e.activeView), qe = $((e) => e.displayLimit), Je = $((e) => e.showFieldModal), Ye = $((e) => e.fieldModalMode), Xe = $((e) => e.setActiveTab), Ze = $((e) => e.setActiveView), Qe = $((e) => e.setDisplayLimit), $e = $((e) => e.closeFieldModal), [et, tt] = G(0), nt = $((e) => e.openMetricsModal), rt = $((e) => e.addMetric), it = $((e) => e.removeMetric), at = $((e) => e.toggleMetric), ot = $((e) => e.reorderMetrics), st = $((e) => e.openBreakdownsModal), ct = $((e) => e.addBreakdown), lt = $((e) => e.removeBreakdown), ut = $((e) => e.toggleBreakdown), dt = $((e) => e.setBreakdownGranularity), ft = $((e) => e.toggleBreakdownComparison), pt = $((e) => e.reorderBreakdowns), mt = $((e) => e.setFilters), ht = $((e) => e.dropFieldToFilter), gt = $((e) => e.setOrder), _t = $((e) => e.setLimit), vt = $((e) => e.clearQuery), yt = $((e) => e.clearCurrentMode), bt = $((e) => e.setFunnelBindingKey), xt = $((e) => e.setAnalysisType), St = $((e) => e.setFunnelCube), Ct = $((e) => e.addFunnelStep), wt = $((e) => e.removeFunnelStep), Tt = $((e) => e.updateFunnelStep), Et = $((e) => e.setActiveFunnelStepIndex), Dt = $((e) => e.reorderFunnelSteps), kt = $((e) => e.setFunnelTimeDimension), jt = $((e) => e.setFlowCube), Mt = $((e) => e.setFlowBindingKey), Nt = $((e) => e.setFlowTimeDimension), Pt = $((e) => e.setEventDimension), Ft = $((e) => e.setStartingStepName), It = $((e) => e.setStartingStepFilters), Lt = $((e) => e.setStepsBefore), Rt = $((e) => e.setStepsAfter), zt = $((e) => e.setJoinStrategy), Bt = $((e) => e.setRetentionCube), Vt = $((e) => e.setRetentionBindingKey), Ht = $((e) => e.setRetentionTimeDimension), Ut = $((e) => e.setRetentionDateRange), Wt = $((e) => e.setRetentionCohortFilters), Gt = $((e) => e.setRetentionActivityFilters), X = $((e) => e.setRetentionBreakdowns), Z = $((e) => e.addRetentionBreakdown), Kt = $((e) => e.removeRetentionBreakdown), qt = $((e) => e.setRetentionViewGranularity), Q = $((e) => e.setRetentionPeriods), Jt = $((e) => e.setRetentionType), Yt = $((e) => e.getValidation), Xt = U(() => Yt(), [
|
|
3049
|
+
Yt,
|
|
3242
3050
|
i,
|
|
3243
3051
|
O,
|
|
3244
3052
|
A,
|
|
3245
3053
|
k,
|
|
3246
3054
|
j,
|
|
3247
3055
|
P,
|
|
3248
|
-
F,
|
|
3249
3056
|
oe,
|
|
3250
3057
|
se,
|
|
3058
|
+
F,
|
|
3251
3059
|
I,
|
|
3252
3060
|
L,
|
|
3253
3061
|
ce,
|
|
3254
3062
|
le
|
|
3255
|
-
]),
|
|
3256
|
-
O === "retention" && t === "dimension" ?
|
|
3063
|
+
]), Zt = V((e, t) => {
|
|
3064
|
+
O === "retention" && t === "dimension" ? Z({ field: e.name }) : ut(e.name, t === "timeDimension");
|
|
3257
3065
|
}, [
|
|
3258
3066
|
O,
|
|
3259
|
-
|
|
3067
|
+
Z,
|
|
3260
3068
|
ut
|
|
3261
|
-
]),
|
|
3262
|
-
Ye === "metrics" && t === "measure" ? at(e.name) : Ye === "breakdown" &&
|
|
3069
|
+
]), Qt = V((e, t, n, r) => {
|
|
3070
|
+
Ye === "metrics" && t === "measure" ? at(e.name) : Ye === "breakdown" && Zt(e, t), r || $e();
|
|
3263
3071
|
}, [
|
|
3264
3072
|
Ye,
|
|
3265
3073
|
at,
|
|
3266
|
-
|
|
3074
|
+
Zt,
|
|
3267
3075
|
$e
|
|
3268
3076
|
]);
|
|
3269
3077
|
return {
|
|
@@ -3290,34 +3098,34 @@ function Yn(e = {}) {
|
|
|
3290
3098
|
funnelSteps: A,
|
|
3291
3099
|
activeFunnelStepIndex: te,
|
|
3292
3100
|
funnelTimeDimension: j,
|
|
3293
|
-
funnelChartType:
|
|
3101
|
+
funnelChartType: N,
|
|
3294
3102
|
funnelChartConfig: re,
|
|
3295
3103
|
funnelDisplayConfig: ae,
|
|
3296
|
-
serverFunnelQuery:
|
|
3104
|
+
serverFunnelQuery: pe,
|
|
3297
3105
|
flowCube: P,
|
|
3298
|
-
flowBindingKey:
|
|
3299
|
-
flowTimeDimension:
|
|
3300
|
-
eventDimension:
|
|
3106
|
+
flowBindingKey: oe,
|
|
3107
|
+
flowTimeDimension: se,
|
|
3108
|
+
eventDimension: F,
|
|
3301
3109
|
startingStep: I,
|
|
3302
3110
|
stepsBefore: L,
|
|
3303
3111
|
stepsAfter: ce,
|
|
3304
3112
|
joinStrategy: le,
|
|
3305
|
-
flowDisplayConfig:
|
|
3306
|
-
serverFlowQuery:
|
|
3113
|
+
flowDisplayConfig: ue,
|
|
3114
|
+
serverFlowQuery: z,
|
|
3307
3115
|
retentionCube: he,
|
|
3308
3116
|
retentionBindingKey: ge,
|
|
3309
|
-
retentionTimeDimension:
|
|
3310
|
-
retentionDateRange:
|
|
3311
|
-
retentionCohortFilters:
|
|
3312
|
-
retentionActivityFilters:
|
|
3313
|
-
retentionBreakdowns:
|
|
3314
|
-
retentionViewGranularity:
|
|
3315
|
-
retentionPeriods:
|
|
3316
|
-
retentionType:
|
|
3317
|
-
retentionDisplayConfig:
|
|
3318
|
-
serverRetentionQuery:
|
|
3117
|
+
retentionTimeDimension: _e,
|
|
3118
|
+
retentionDateRange: ve,
|
|
3119
|
+
retentionCohortFilters: ye,
|
|
3120
|
+
retentionActivityFilters: B,
|
|
3121
|
+
retentionBreakdowns: be,
|
|
3122
|
+
retentionViewGranularity: xe,
|
|
3123
|
+
retentionPeriods: Se,
|
|
3124
|
+
retentionType: H,
|
|
3125
|
+
retentionDisplayConfig: q,
|
|
3126
|
+
serverRetentionQuery: J,
|
|
3319
3127
|
retentionValidation: Ce,
|
|
3320
|
-
chartType:
|
|
3128
|
+
chartType: Y,
|
|
3321
3129
|
chartConfig: Ee,
|
|
3322
3130
|
displayConfig: De,
|
|
3323
3131
|
colorPalette: He,
|
|
@@ -3330,7 +3138,7 @@ function Yn(e = {}) {
|
|
|
3330
3138
|
showFieldModal: Je,
|
|
3331
3139
|
fieldModalMode: Ye,
|
|
3332
3140
|
activeTableIndex: et,
|
|
3333
|
-
adapterValidation:
|
|
3141
|
+
adapterValidation: Xt,
|
|
3334
3142
|
getQueryConfig: V(() => {
|
|
3335
3143
|
let e = r.getState();
|
|
3336
3144
|
return e.analysisType === "funnel" ? e.buildFunnelQueryFromSteps() || e.buildCurrentQuery() : e.queryStates.length > 1 ? {
|
|
@@ -3349,13 +3157,13 @@ function Yn(e = {}) {
|
|
|
3349
3157
|
chartConfig: t.chartConfig,
|
|
3350
3158
|
displayConfig: t.displayConfig
|
|
3351
3159
|
} : {
|
|
3352
|
-
chartType:
|
|
3160
|
+
chartType: Y,
|
|
3353
3161
|
chartConfig: Ee,
|
|
3354
3162
|
displayConfig: De
|
|
3355
3163
|
};
|
|
3356
3164
|
}, [
|
|
3357
3165
|
r,
|
|
3358
|
-
|
|
3166
|
+
Y,
|
|
3359
3167
|
Ee,
|
|
3360
3168
|
De
|
|
3361
3169
|
]),
|
|
@@ -3389,15 +3197,15 @@ function Yn(e = {}) {
|
|
|
3389
3197
|
updateFunnelStep: Tt,
|
|
3390
3198
|
setActiveFunnelStepIndex: Et,
|
|
3391
3199
|
reorderFunnelSteps: Dt,
|
|
3392
|
-
setFunnelTimeDimension:
|
|
3200
|
+
setFunnelTimeDimension: kt,
|
|
3393
3201
|
setFunnelDisplayConfig: Fe,
|
|
3394
|
-
setFlowCube:
|
|
3395
|
-
setFlowBindingKey:
|
|
3396
|
-
setFlowTimeDimension:
|
|
3397
|
-
setEventDimension:
|
|
3398
|
-
setStartingStepName:
|
|
3399
|
-
setStartingStepFilters:
|
|
3400
|
-
setStepsBefore:
|
|
3202
|
+
setFlowCube: jt,
|
|
3203
|
+
setFlowBindingKey: Mt,
|
|
3204
|
+
setFlowTimeDimension: Nt,
|
|
3205
|
+
setEventDimension: Pt,
|
|
3206
|
+
setStartingStepName: Ft,
|
|
3207
|
+
setStartingStepFilters: It,
|
|
3208
|
+
setStepsBefore: Lt,
|
|
3401
3209
|
setStepsAfter: Rt,
|
|
3402
3210
|
setJoinStrategy: zt,
|
|
3403
3211
|
setFlowDisplayConfig: Ue,
|
|
@@ -3407,12 +3215,12 @@ function Yn(e = {}) {
|
|
|
3407
3215
|
setRetentionDateRange: Ut,
|
|
3408
3216
|
setRetentionCohortFilters: Wt,
|
|
3409
3217
|
setRetentionActivityFilters: Gt,
|
|
3410
|
-
setRetentionBreakdowns:
|
|
3411
|
-
addRetentionBreakdown:
|
|
3412
|
-
removeRetentionBreakdown:
|
|
3413
|
-
setRetentionViewGranularity:
|
|
3414
|
-
setRetentionPeriods:
|
|
3415
|
-
setRetentionType:
|
|
3218
|
+
setRetentionBreakdowns: X,
|
|
3219
|
+
addRetentionBreakdown: Z,
|
|
3220
|
+
removeRetentionBreakdown: Kt,
|
|
3221
|
+
setRetentionViewGranularity: qt,
|
|
3222
|
+
setRetentionPeriods: Q,
|
|
3223
|
+
setRetentionType: Jt,
|
|
3416
3224
|
setRetentionDisplayConfig: We,
|
|
3417
3225
|
setChartType: Re,
|
|
3418
3226
|
setChartConfig: ze,
|
|
@@ -3426,19 +3234,19 @@ function Yn(e = {}) {
|
|
|
3426
3234
|
setActiveTableIndex: tt,
|
|
3427
3235
|
clearQuery: vt,
|
|
3428
3236
|
clearCurrentMode: yt,
|
|
3429
|
-
handleFieldSelected:
|
|
3237
|
+
handleFieldSelected: Qt
|
|
3430
3238
|
}
|
|
3431
3239
|
};
|
|
3432
3240
|
}
|
|
3433
3241
|
//#endregion
|
|
3434
3242
|
//#region src/client/hooks/analysisQueryExecutionModes.ts
|
|
3435
|
-
function
|
|
3243
|
+
function Un(e) {
|
|
3436
3244
|
return e.isRetentionMode ? "retention" : e.isFlowMode ? "flow" : e.isFunnelMode ? "funnel" : e.isMultiMode ? "multi" : "single";
|
|
3437
3245
|
}
|
|
3438
|
-
function
|
|
3246
|
+
function Wn(e, t) {
|
|
3439
3247
|
return t[e];
|
|
3440
3248
|
}
|
|
3441
|
-
function
|
|
3249
|
+
function Gn(e) {
|
|
3442
3250
|
return {
|
|
3443
3251
|
funnelExecutedQueries: e.isFunnelMode && e.funnelExecutedQueries && e.funnelExecutedQueries.length > 0 ? e.funnelExecutedQueries : null,
|
|
3444
3252
|
funnelServerQuery: e.isFunnelMode ? e.funnelServerQuery : null,
|
|
@@ -3451,7 +3259,7 @@ function Qn(e) {
|
|
|
3451
3259
|
retentionDebugData: e.isRetentionMode ? e.retentionDebugData : null
|
|
3452
3260
|
};
|
|
3453
3261
|
}
|
|
3454
|
-
function
|
|
3262
|
+
function Kn(e) {
|
|
3455
3263
|
return {
|
|
3456
3264
|
single: !e.isValidQuery || !e.isSingleMode,
|
|
3457
3265
|
multi: !e.hasMultiQueryConfig || !e.isMultiMode,
|
|
@@ -3461,11 +3269,11 @@ function $n(e) {
|
|
|
3461
3269
|
dryRun: !!(!e.isValidQuery || e.isFunnelMode || e.isFlowMode || e.isRetentionMode)
|
|
3462
3270
|
};
|
|
3463
3271
|
}
|
|
3464
|
-
function
|
|
3272
|
+
function qn(e) {
|
|
3465
3273
|
let { hasResults: t, initialData: n, isValidQuery: r, isLoading: i, isFetching: a, error: o } = e;
|
|
3466
3274
|
return n && n.length > 0 && !t ? "success" : r ? i && !t ? "loading" : a && t ? "refreshing" : o ? "error" : t ? "success" : "idle" : "idle";
|
|
3467
3275
|
}
|
|
3468
|
-
function
|
|
3276
|
+
function Jn(e) {
|
|
3469
3277
|
return e.isRetentionMode && e.retentionChartData ? e.retentionChartData.rows.map((e) => ({
|
|
3470
3278
|
"Retention.period": `P${e.period}`,
|
|
3471
3279
|
"Retention.rate": e.retentionRate,
|
|
@@ -3476,18 +3284,18 @@ function tr(e) {
|
|
|
3476
3284
|
}
|
|
3477
3285
|
//#endregion
|
|
3478
3286
|
//#region src/client/hooks/useAnalysisQuery.ts
|
|
3479
|
-
function
|
|
3480
|
-
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 } =
|
|
3287
|
+
function Yn(e) {
|
|
3288
|
+
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 } = me(), g = u === "funnel" || l, _ = u === "flow", v = u === "retention", y = u === "query" && i, b = u === "query" && !i, x = u === "funnel" && !!d, S = Un({
|
|
3481
3289
|
isRetentionMode: v,
|
|
3482
3290
|
isFlowMode: _,
|
|
3483
3291
|
isFunnelMode: g,
|
|
3484
3292
|
isMultiMode: y
|
|
3485
|
-
}), C = U(() => x || !g || !c || n.length < 2 ? null :
|
|
3293
|
+
}), C = U(() => x || !g || !c || n.length < 2 ? null : _e(n, c), [
|
|
3486
3294
|
x,
|
|
3487
3295
|
g,
|
|
3488
3296
|
c,
|
|
3489
3297
|
n
|
|
3490
|
-
]), w =
|
|
3298
|
+
]), w = Kn({
|
|
3491
3299
|
isValidQuery: a,
|
|
3492
3300
|
isSingleMode: b,
|
|
3493
3301
|
isMultiMode: y,
|
|
@@ -3499,40 +3307,40 @@ function nr(e) {
|
|
|
3499
3307
|
hasServerFunnelQuery: !!d,
|
|
3500
3308
|
hasServerFlowQuery: !!f,
|
|
3501
3309
|
hasServerRetentionQuery: !!p
|
|
3502
|
-
}), T =
|
|
3310
|
+
}), T = F(t, {
|
|
3503
3311
|
skip: w.single,
|
|
3504
3312
|
debounceMs: 300
|
|
3505
|
-
}), E =
|
|
3313
|
+
}), E = ce(r, {
|
|
3506
3314
|
skip: w.multi,
|
|
3507
3315
|
debounceMs: 300
|
|
3508
|
-
}), D =
|
|
3316
|
+
}), D = ue(C, {
|
|
3509
3317
|
skip: w.funnel,
|
|
3510
3318
|
debounceMs: 300,
|
|
3511
3319
|
prebuiltServerQuery: x ? d : void 0
|
|
3512
|
-
}), O =
|
|
3320
|
+
}), O = pe(f ?? null, {
|
|
3513
3321
|
skip: w.flow,
|
|
3514
3322
|
debounceMs: 300
|
|
3515
|
-
}), k =
|
|
3323
|
+
}), k = L(p ?? null, {
|
|
3516
3324
|
skip: w.retention,
|
|
3517
3325
|
debounceMs: 300,
|
|
3518
3326
|
getFieldLabel: h
|
|
3519
|
-
}), ee =
|
|
3327
|
+
}), ee = ge({
|
|
3520
3328
|
queries: i ? n : [t],
|
|
3521
3329
|
isMultiQueryMode: i,
|
|
3522
3330
|
skip: w.dryRun
|
|
3523
|
-
}), A =
|
|
3331
|
+
}), A = he(D.serverQuery, { skip: !g || !D.serverQuery }), te = he(O.serverQuery, { skip: !_ || !O.serverQuery }), j = he(p, { skip: !v || !p }), M = Wn(S, {
|
|
3524
3332
|
retention: k.isLoading || k.isDebouncing,
|
|
3525
3333
|
flow: O.isLoading || O.isDebouncing,
|
|
3526
3334
|
funnel: D.isExecuting || D.isDebouncing,
|
|
3527
3335
|
multi: E.isLoading,
|
|
3528
3336
|
single: T.isLoading
|
|
3529
|
-
}),
|
|
3337
|
+
}), N = Wn(S, {
|
|
3530
3338
|
retention: k.isFetching,
|
|
3531
3339
|
flow: O.isFetching,
|
|
3532
3340
|
funnel: D.isExecuting,
|
|
3533
3341
|
multi: E.isFetching,
|
|
3534
3342
|
single: T.isFetching
|
|
3535
|
-
}),
|
|
3343
|
+
}), ne = Wn(S, {
|
|
3536
3344
|
retention: k.error,
|
|
3537
3345
|
flow: O.error,
|
|
3538
3346
|
funnel: D.error,
|
|
@@ -3561,8 +3369,8 @@ function nr(e) {
|
|
|
3561
3369
|
D,
|
|
3562
3370
|
E,
|
|
3563
3371
|
T
|
|
3564
|
-
]), ae = U(() =>
|
|
3565
|
-
hasResults:
|
|
3372
|
+
]), ae = U(() => qn({
|
|
3373
|
+
hasResults: Wn(S, {
|
|
3566
3374
|
retention: k.chartData,
|
|
3567
3375
|
flow: O.data,
|
|
3568
3376
|
funnel: D.chartData,
|
|
@@ -3572,13 +3380,13 @@ function nr(e) {
|
|
|
3572
3380
|
initialData: o,
|
|
3573
3381
|
isValidQuery: a,
|
|
3574
3382
|
isLoading: M,
|
|
3575
|
-
isFetching:
|
|
3576
|
-
error:
|
|
3383
|
+
isFetching: N,
|
|
3384
|
+
error: ne
|
|
3577
3385
|
}), [
|
|
3578
3386
|
a,
|
|
3579
3387
|
M,
|
|
3580
|
-
ne,
|
|
3581
3388
|
N,
|
|
3389
|
+
ne,
|
|
3582
3390
|
T.rawData,
|
|
3583
3391
|
E.data,
|
|
3584
3392
|
D.chartData,
|
|
@@ -3586,7 +3394,7 @@ function nr(e) {
|
|
|
3586
3394
|
k.chartData,
|
|
3587
3395
|
o,
|
|
3588
3396
|
S
|
|
3589
|
-
]),
|
|
3397
|
+
]), P = U(() => Jn({
|
|
3590
3398
|
isRetentionMode: v,
|
|
3591
3399
|
isFlowMode: _,
|
|
3592
3400
|
isFunnelMode: g,
|
|
@@ -3608,12 +3416,12 @@ function nr(e) {
|
|
|
3608
3416
|
g,
|
|
3609
3417
|
_,
|
|
3610
3418
|
v
|
|
3611
|
-
]),
|
|
3419
|
+
]), oe = U(() => g && D.stepResults ? D.stepResults.map((e) => e.data) : !y || !E.perQueryData ? null : E.perQueryData, [
|
|
3612
3420
|
y,
|
|
3613
3421
|
g,
|
|
3614
3422
|
E.perQueryData,
|
|
3615
3423
|
D.stepResults
|
|
3616
|
-
]), { funnelExecutedQueries:
|
|
3424
|
+
]), { funnelExecutedQueries: se, funnelServerQuery: I, funnelDebugData: le, flowServerQuery: R, flowChartData: de, flowDebugData: fe, retentionServerQuery: z, retentionChartData: ve, retentionDebugData: ye } = Gn({
|
|
3617
3425
|
isFunnelMode: g,
|
|
3618
3426
|
isFlowMode: _,
|
|
3619
3427
|
isRetentionMode: v,
|
|
@@ -3626,7 +3434,7 @@ function nr(e) {
|
|
|
3626
3434
|
retentionServerQuery: p ?? null,
|
|
3627
3435
|
retentionChartData: k.chartData,
|
|
3628
3436
|
retentionDebugData: j.debugData
|
|
3629
|
-
}),
|
|
3437
|
+
}), B = U(() => Wn(S, {
|
|
3630
3438
|
retention: k.needsRefresh,
|
|
3631
3439
|
flow: O.needsRefresh,
|
|
3632
3440
|
funnel: D.needsRefresh,
|
|
@@ -3638,72 +3446,72 @@ function nr(e) {
|
|
|
3638
3446
|
O.needsRefresh,
|
|
3639
3447
|
D.needsRefresh,
|
|
3640
3448
|
T.needsRefresh
|
|
3641
|
-
]),
|
|
3449
|
+
]), be = U(() => {
|
|
3642
3450
|
if (b && T.warnings) return T.warnings;
|
|
3643
3451
|
}, [b, T.warnings]);
|
|
3644
3452
|
return {
|
|
3645
3453
|
executionStatus: ae,
|
|
3646
|
-
executionResults:
|
|
3647
|
-
perQueryResults:
|
|
3454
|
+
executionResults: P,
|
|
3455
|
+
perQueryResults: oe,
|
|
3648
3456
|
isLoading: M,
|
|
3649
|
-
isFetching:
|
|
3650
|
-
error:
|
|
3457
|
+
isFetching: N,
|
|
3458
|
+
error: ne,
|
|
3651
3459
|
debugDataPerQuery: ee.debugDataPerQuery,
|
|
3652
3460
|
hasDebounced: re,
|
|
3653
3461
|
refetch: ie,
|
|
3654
|
-
funnelExecutedQueries:
|
|
3655
|
-
funnelServerQuery:
|
|
3656
|
-
funnelDebugData:
|
|
3657
|
-
flowServerQuery:
|
|
3658
|
-
flowChartData:
|
|
3659
|
-
flowDebugData:
|
|
3660
|
-
retentionServerQuery:
|
|
3661
|
-
retentionChartData:
|
|
3662
|
-
retentionDebugData:
|
|
3462
|
+
funnelExecutedQueries: se,
|
|
3463
|
+
funnelServerQuery: I,
|
|
3464
|
+
funnelDebugData: le,
|
|
3465
|
+
flowServerQuery: R,
|
|
3466
|
+
flowChartData: de,
|
|
3467
|
+
flowDebugData: fe,
|
|
3468
|
+
retentionServerQuery: z,
|
|
3469
|
+
retentionChartData: ve,
|
|
3470
|
+
retentionDebugData: ye,
|
|
3663
3471
|
retentionValidation: m ?? null,
|
|
3664
|
-
needsRefresh:
|
|
3665
|
-
warnings:
|
|
3472
|
+
needsRefresh: B,
|
|
3473
|
+
warnings: be
|
|
3666
3474
|
};
|
|
3667
3475
|
}
|
|
3668
3476
|
//#endregion
|
|
3669
3477
|
//#region src/client/utils/shareUtils.ts
|
|
3670
|
-
var
|
|
3671
|
-
function
|
|
3478
|
+
var Xn = o(), Zn = 1800, Qn = "share=";
|
|
3479
|
+
function $n(e) {
|
|
3672
3480
|
let t = JSON.stringify(e);
|
|
3673
|
-
return (0,
|
|
3481
|
+
return (0, Xn.compressToEncodedURIComponent)(t);
|
|
3674
3482
|
}
|
|
3675
|
-
function
|
|
3483
|
+
function er(e) {
|
|
3676
3484
|
try {
|
|
3677
|
-
let t = (0,
|
|
3485
|
+
let t = (0, Xn.decompressFromEncodedURIComponent)(e);
|
|
3678
3486
|
if (!t) return null;
|
|
3679
3487
|
let n = JSON.parse(t);
|
|
3680
|
-
return
|
|
3488
|
+
return j(n) ? n : (console.warn("[shareUtils] Invalid AnalysisConfig in share URL"), null);
|
|
3681
3489
|
} catch {
|
|
3682
3490
|
return null;
|
|
3683
3491
|
}
|
|
3684
3492
|
}
|
|
3685
|
-
function
|
|
3686
|
-
let t =
|
|
3493
|
+
function tr(e) {
|
|
3494
|
+
let t = $n(e);
|
|
3687
3495
|
return {
|
|
3688
|
-
ok: t.length <=
|
|
3496
|
+
ok: t.length <= Zn,
|
|
3689
3497
|
size: t.length,
|
|
3690
|
-
maxSize:
|
|
3498
|
+
maxSize: Zn
|
|
3691
3499
|
};
|
|
3692
3500
|
}
|
|
3693
|
-
function
|
|
3694
|
-
let t =
|
|
3695
|
-
if (t.length <=
|
|
3501
|
+
function nr(e) {
|
|
3502
|
+
let t = $n(e);
|
|
3503
|
+
if (t.length <= Zn) return {
|
|
3696
3504
|
encoded: t,
|
|
3697
3505
|
queryOnly: !1
|
|
3698
3506
|
};
|
|
3699
|
-
let n =
|
|
3507
|
+
let n = $n({
|
|
3700
3508
|
version: e.version,
|
|
3701
3509
|
analysisType: e.analysisType,
|
|
3702
3510
|
activeView: e.activeView,
|
|
3703
3511
|
charts: {},
|
|
3704
3512
|
query: e.query
|
|
3705
3513
|
});
|
|
3706
|
-
return n.length <=
|
|
3514
|
+
return n.length <= Zn ? {
|
|
3707
3515
|
encoded: n,
|
|
3708
3516
|
queryOnly: !0
|
|
3709
3517
|
} : {
|
|
@@ -3711,27 +3519,27 @@ function lr(e) {
|
|
|
3711
3519
|
queryOnly: !0
|
|
3712
3520
|
};
|
|
3713
3521
|
}
|
|
3714
|
-
function
|
|
3715
|
-
let { encoded: t } =
|
|
3716
|
-
return t ? `${window.location.origin}${window.location.pathname}#${
|
|
3522
|
+
function rr(e) {
|
|
3523
|
+
let { encoded: t } = nr(e);
|
|
3524
|
+
return t ? `${window.location.origin}${window.location.pathname}#${Qn}${t}` : null;
|
|
3717
3525
|
}
|
|
3718
|
-
function
|
|
3526
|
+
function ir() {
|
|
3719
3527
|
if (typeof window > "u") return null;
|
|
3720
3528
|
let e = window.location.hash;
|
|
3721
|
-
return !e || !e.startsWith(`#${
|
|
3529
|
+
return !e || !e.startsWith(`#${Qn}`) ? null : e.slice(7);
|
|
3722
3530
|
}
|
|
3723
|
-
function
|
|
3531
|
+
function ar() {
|
|
3724
3532
|
if (typeof window > "u") return;
|
|
3725
3533
|
let e = new URL(window.location.href);
|
|
3726
3534
|
e.hash = "", window.history.replaceState(null, "", e.toString());
|
|
3727
3535
|
}
|
|
3728
|
-
function
|
|
3729
|
-
let e =
|
|
3730
|
-
return e ?
|
|
3536
|
+
function or() {
|
|
3537
|
+
let e = ir();
|
|
3538
|
+
return e ? er(e) : null;
|
|
3731
3539
|
}
|
|
3732
3540
|
//#endregion
|
|
3733
3541
|
//#region src/client/components/AIAssistant/utils.ts
|
|
3734
|
-
async function
|
|
3542
|
+
async function sr(e, t, n = "/api/ai/generate", r) {
|
|
3735
3543
|
let i = { text: t }, a = {
|
|
3736
3544
|
"Content-Type": "application/json",
|
|
3737
3545
|
...r
|
|
@@ -3761,21 +3569,21 @@ async function mr(e, t, n = "/api/ai/generate", r) {
|
|
|
3761
3569
|
let s = await o.json();
|
|
3762
3570
|
return console.log("✅ Client: Successfully generated content"), s;
|
|
3763
3571
|
}
|
|
3764
|
-
function
|
|
3572
|
+
function cr(e) {
|
|
3765
3573
|
return (e.query || "").replace(/```json\s*/g, "").replace(/```\s*/g, "").replace(/^\s*```.*\n/gm, "").trim();
|
|
3766
3574
|
}
|
|
3767
3575
|
//#endregion
|
|
3768
3576
|
//#region src/client/hooks/useAnalysisEffects.ts
|
|
3769
|
-
function
|
|
3577
|
+
function lr(e) {
|
|
3770
3578
|
return typeof e == "object" && !!e && "funnel" in e && typeof e.funnel == "object";
|
|
3771
3579
|
}
|
|
3772
|
-
function
|
|
3580
|
+
function ur(e) {
|
|
3773
3581
|
let { state: t, query: n, aiEndpoint: r = "/api/ai", onQueryChange: i, onChartConfigChange: a } = e, { storeApi: o, actions: s } = t, { apiOptions: l } = c(), u = W(!1);
|
|
3774
3582
|
H(() => {
|
|
3775
3583
|
if (u.current) return;
|
|
3776
3584
|
u.current = !0;
|
|
3777
|
-
let e =
|
|
3778
|
-
e && (o.getState().load(e),
|
|
3585
|
+
let e = or();
|
|
3586
|
+
e && (o.getState().load(e), ar());
|
|
3779
3587
|
}, [o]), H(() => {
|
|
3780
3588
|
i && t.isValidQuery && i(t.currentQuery);
|
|
3781
3589
|
}, [
|
|
@@ -3794,46 +3602,46 @@ function _r(e) {
|
|
|
3794
3602
|
t.displayConfig,
|
|
3795
3603
|
a
|
|
3796
3604
|
]);
|
|
3797
|
-
let { combinedMetrics: d, combinedBreakdowns:
|
|
3605
|
+
let { combinedMetrics: d, combinedBreakdowns: f, chartType: p, chartConfig: g, userManuallySelectedChart: _ } = t, { hasDebounced: v } = n, { setChartType: y, setChartConfig: b } = s, x = W("");
|
|
3798
3606
|
H(() => {
|
|
3799
|
-
if (!
|
|
3607
|
+
if (!v || d.length === 0 && f.length === 0) return;
|
|
3800
3608
|
let e = JSON.stringify({
|
|
3801
3609
|
metrics: d.map((e) => e.field),
|
|
3802
|
-
breakdowns:
|
|
3610
|
+
breakdowns: f.map((e) => ({
|
|
3803
3611
|
field: e.field,
|
|
3804
3612
|
isTime: e.isTimeDimension
|
|
3805
3613
|
}))
|
|
3806
3614
|
});
|
|
3807
|
-
if (e ===
|
|
3808
|
-
|
|
3809
|
-
let t =
|
|
3615
|
+
if (e === x.current) return;
|
|
3616
|
+
x.current = e;
|
|
3617
|
+
let t = Mt(d, f, p, _);
|
|
3810
3618
|
if (t) {
|
|
3811
|
-
let { chartConfig: e } =
|
|
3812
|
-
|
|
3813
|
-
} else if (d.length > 0 ||
|
|
3814
|
-
if (
|
|
3815
|
-
let e =
|
|
3816
|
-
i.length > 0 &&
|
|
3817
|
-
...
|
|
3619
|
+
let { chartConfig: e } = At(d, f, t);
|
|
3620
|
+
y(t), b(e), s.setUserManuallySelectedChart(!1);
|
|
3621
|
+
} else if (d.length > 0 || f.length > 0) {
|
|
3622
|
+
if (p === "table" || p === "recordsTable") {
|
|
3623
|
+
let e = p === "recordsTable" ? "columns" : "xAxis", t = [...f.map((e) => e.field), ...d.map((e) => e.field)], n = Array.isArray(g[e]) ? g[e] : [], r = new Set(g.hiddenColumns ?? []), i = t.filter((e) => !n.includes(e) && !r.has(e));
|
|
3624
|
+
i.length > 0 && b({
|
|
3625
|
+
...g,
|
|
3818
3626
|
[e]: [...n, ...i]
|
|
3819
3627
|
});
|
|
3820
|
-
} else if (!
|
|
3821
|
-
let { chartConfig: e } =
|
|
3822
|
-
|
|
3628
|
+
} else if (!g.xAxis?.length && !g.yAxis?.length && !g.series?.length) {
|
|
3629
|
+
let { chartConfig: e } = At(d, f, p);
|
|
3630
|
+
b(e);
|
|
3823
3631
|
}
|
|
3824
3632
|
}
|
|
3825
3633
|
}, [
|
|
3826
|
-
|
|
3634
|
+
v,
|
|
3827
3635
|
d,
|
|
3636
|
+
f,
|
|
3828
3637
|
p,
|
|
3829
|
-
|
|
3638
|
+
_,
|
|
3830
3639
|
g,
|
|
3831
|
-
h,
|
|
3832
|
-
v,
|
|
3833
3640
|
y,
|
|
3641
|
+
b,
|
|
3834
3642
|
s
|
|
3835
3643
|
]);
|
|
3836
|
-
let [
|
|
3644
|
+
let [S, C] = G({
|
|
3837
3645
|
isOpen: !1,
|
|
3838
3646
|
userPrompt: "",
|
|
3839
3647
|
isGenerating: !1,
|
|
@@ -3841,7 +3649,7 @@ function _r(e) {
|
|
|
3841
3649
|
hasGeneratedQuery: !1,
|
|
3842
3650
|
previousState: null,
|
|
3843
3651
|
previousConfig: null
|
|
3844
|
-
}),
|
|
3652
|
+
}), w = V((e) => {
|
|
3845
3653
|
o.getState().updateQueryState(t.activeQueryIndex, (t) => {
|
|
3846
3654
|
let n = e(t);
|
|
3847
3655
|
return {
|
|
@@ -3868,7 +3676,7 @@ function _r(e) {
|
|
|
3868
3676
|
o.getState().load(t);
|
|
3869
3677
|
}, [o]), E = V(() => {
|
|
3870
3678
|
let e = o.getState().save();
|
|
3871
|
-
|
|
3679
|
+
C({
|
|
3872
3680
|
isOpen: !0,
|
|
3873
3681
|
userPrompt: "",
|
|
3874
3682
|
isGenerating: !1,
|
|
@@ -3895,7 +3703,7 @@ function _r(e) {
|
|
|
3895
3703
|
t.displayConfig,
|
|
3896
3704
|
t.analysisType
|
|
3897
3705
|
]), D = V(() => {
|
|
3898
|
-
|
|
3706
|
+
C((e) => ({
|
|
3899
3707
|
...e,
|
|
3900
3708
|
isOpen: !1,
|
|
3901
3709
|
userPrompt: "",
|
|
@@ -3903,21 +3711,21 @@ function _r(e) {
|
|
|
3903
3711
|
hasGeneratedQuery: !1
|
|
3904
3712
|
}));
|
|
3905
3713
|
}, []), O = V((e) => {
|
|
3906
|
-
|
|
3714
|
+
C((t) => ({
|
|
3907
3715
|
...t,
|
|
3908
3716
|
userPrompt: e
|
|
3909
3717
|
}));
|
|
3910
3718
|
}, []), k = V(async () => {
|
|
3911
|
-
if (
|
|
3912
|
-
|
|
3719
|
+
if (S.userPrompt.trim()) {
|
|
3720
|
+
C((e) => ({
|
|
3913
3721
|
...e,
|
|
3914
3722
|
isGenerating: !0,
|
|
3915
3723
|
error: null
|
|
3916
3724
|
}));
|
|
3917
3725
|
try {
|
|
3918
|
-
let e =
|
|
3919
|
-
if (
|
|
3920
|
-
s.setAnalysisType("funnel"), T(i), s.setChartType("funnel"), o && s.setChartConfig(o), s.setActiveView("chart"),
|
|
3726
|
+
let e = cr(await sr("", S.userPrompt, r, l?.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;
|
|
3727
|
+
if (lr(i)) {
|
|
3728
|
+
s.setAnalysisType("funnel"), T(i), s.setChartType("funnel"), o && s.setChartConfig(o), s.setActiveView("chart"), C((e) => ({
|
|
3921
3729
|
...e,
|
|
3922
3730
|
isGenerating: !1,
|
|
3923
3731
|
hasGeneratedQuery: !0
|
|
@@ -3925,19 +3733,19 @@ function _r(e) {
|
|
|
3925
3733
|
return;
|
|
3926
3734
|
}
|
|
3927
3735
|
let c = i;
|
|
3928
|
-
|
|
3736
|
+
w((e) => ({
|
|
3929
3737
|
...e,
|
|
3930
3738
|
metrics: (c.measures || []).map((e, t) => ({
|
|
3931
|
-
id:
|
|
3739
|
+
id: h(),
|
|
3932
3740
|
field: e,
|
|
3933
|
-
label:
|
|
3741
|
+
label: m(t)
|
|
3934
3742
|
})),
|
|
3935
3743
|
breakdowns: [...(c.dimensions || []).map((e) => ({
|
|
3936
|
-
id:
|
|
3744
|
+
id: h(),
|
|
3937
3745
|
field: e,
|
|
3938
3746
|
isTimeDimension: !1
|
|
3939
3747
|
})), ...(c.timeDimensions || []).map((e) => ({
|
|
3940
|
-
id:
|
|
3748
|
+
id: h(),
|
|
3941
3749
|
field: e.dimension,
|
|
3942
3750
|
granularity: e.granularity,
|
|
3943
3751
|
isTimeDimension: !0
|
|
@@ -3945,13 +3753,13 @@ function _r(e) {
|
|
|
3945
3753
|
filters: c.filters || [],
|
|
3946
3754
|
order: c.order || void 0,
|
|
3947
3755
|
limit: c.limit ?? void 0
|
|
3948
|
-
})), t.analysisType === "funnel" && s.setAnalysisType("query"), a && s.setChartType(a), o && s.setChartConfig(o), s.setActiveView("chart"),
|
|
3756
|
+
})), t.analysisType === "funnel" && s.setAnalysisType("query"), a && s.setChartType(a), o && s.setChartConfig(o), s.setActiveView("chart"), C((e) => ({
|
|
3949
3757
|
...e,
|
|
3950
3758
|
isGenerating: !1,
|
|
3951
3759
|
hasGeneratedQuery: !0
|
|
3952
3760
|
}));
|
|
3953
3761
|
} catch (e) {
|
|
3954
|
-
|
|
3762
|
+
C((t) => ({
|
|
3955
3763
|
...t,
|
|
3956
3764
|
isGenerating: !1,
|
|
3957
3765
|
error: e instanceof Error ? e.message : "Failed to generate query"
|
|
@@ -3959,15 +3767,15 @@ function _r(e) {
|
|
|
3959
3767
|
}
|
|
3960
3768
|
}
|
|
3961
3769
|
}, [
|
|
3962
|
-
|
|
3770
|
+
S.userPrompt,
|
|
3963
3771
|
r,
|
|
3964
3772
|
l?.headers,
|
|
3965
|
-
|
|
3773
|
+
w,
|
|
3966
3774
|
T,
|
|
3967
3775
|
t.analysisType,
|
|
3968
3776
|
s
|
|
3969
3777
|
]), ee = V(() => {
|
|
3970
|
-
|
|
3778
|
+
C({
|
|
3971
3779
|
isOpen: !1,
|
|
3972
3780
|
userPrompt: "",
|
|
3973
3781
|
isGenerating: !1,
|
|
@@ -3977,12 +3785,12 @@ function _r(e) {
|
|
|
3977
3785
|
previousConfig: null
|
|
3978
3786
|
});
|
|
3979
3787
|
}, []), A = V(() => {
|
|
3980
|
-
|
|
3788
|
+
S.previousConfig ? o.getState().load(S.previousConfig) : S.previousState && (w((e) => ({
|
|
3981
3789
|
...e,
|
|
3982
|
-
metrics:
|
|
3983
|
-
breakdowns:
|
|
3984
|
-
filters:
|
|
3985
|
-
})), s.setChartType(
|
|
3790
|
+
metrics: S.previousState.metrics,
|
|
3791
|
+
breakdowns: S.previousState.breakdowns,
|
|
3792
|
+
filters: S.previousState.filters
|
|
3793
|
+
})), s.setChartType(S.previousState.chartType), s.setChartConfig(S.previousState.chartConfig), s.setDisplayConfig(S.previousState.displayConfig), S.previousState.analysisType && s.setAnalysisType(S.previousState.analysisType)), C({
|
|
3986
3794
|
isOpen: !1,
|
|
3987
3795
|
userPrompt: "",
|
|
3988
3796
|
isGenerating: !1,
|
|
@@ -3992,14 +3800,14 @@ function _r(e) {
|
|
|
3992
3800
|
previousConfig: null
|
|
3993
3801
|
});
|
|
3994
3802
|
}, [
|
|
3995
|
-
|
|
3996
|
-
|
|
3803
|
+
S.previousState,
|
|
3804
|
+
S.previousConfig,
|
|
3997
3805
|
o,
|
|
3998
|
-
|
|
3806
|
+
w,
|
|
3999
3807
|
s
|
|
4000
3808
|
]), [te, j] = G("idle"), M = t.effectiveIsValidQuery;
|
|
4001
3809
|
return {
|
|
4002
|
-
aiState:
|
|
3810
|
+
aiState: S,
|
|
4003
3811
|
openAI: E,
|
|
4004
3812
|
closeAI: D,
|
|
4005
3813
|
setAIPrompt: O,
|
|
@@ -4009,7 +3817,7 @@ function _r(e) {
|
|
|
4009
3817
|
shareButtonState: te,
|
|
4010
3818
|
share: V(async () => {
|
|
4011
3819
|
if (!M) return;
|
|
4012
|
-
let { encoded: e, queryOnly: t } =
|
|
3820
|
+
let { encoded: e, queryOnly: t } = nr(o.getState().save());
|
|
4013
3821
|
if (!e) return;
|
|
4014
3822
|
let n = `${window.location.origin}${window.location.pathname}#share=${e}`;
|
|
4015
3823
|
try {
|
|
@@ -4027,8 +3835,8 @@ function _r(e) {
|
|
|
4027
3835
|
}
|
|
4028
3836
|
//#endregion
|
|
4029
3837
|
//#region src/client/hooks/useAnalysisBuilderHook.ts
|
|
4030
|
-
function
|
|
4031
|
-
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o =
|
|
3838
|
+
function dr(e = {}) {
|
|
3839
|
+
let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o = Hn({ externalColorPalette: n }), c = Yn({
|
|
4032
3840
|
currentQuery: o.currentQuery,
|
|
4033
3841
|
allQueries: o.allQueries,
|
|
4034
3842
|
multiQueryConfig: o.multiQueryConfig,
|
|
@@ -4043,7 +3851,7 @@ function vr(e = {}) {
|
|
|
4043
3851
|
serverFlowQuery: o.serverFlowQuery,
|
|
4044
3852
|
serverRetentionQuery: o.serverRetentionQuery,
|
|
4045
3853
|
retentionValidation: o.retentionValidation
|
|
4046
|
-
}), l =
|
|
3854
|
+
}), l = ur({
|
|
4047
3855
|
state: o,
|
|
4048
3856
|
query: c,
|
|
4049
3857
|
aiEndpoint: a?.aiEndpoint,
|
|
@@ -4218,7 +4026,7 @@ function vr(e = {}) {
|
|
|
4218
4026
|
}
|
|
4219
4027
|
//#endregion
|
|
4220
4028
|
//#region src/client/utils/funnelValidation.ts
|
|
4221
|
-
function
|
|
4029
|
+
function fr(e, t) {
|
|
4222
4030
|
let n = [];
|
|
4223
4031
|
if (!t?.cubes) return n;
|
|
4224
4032
|
if (typeof e.dimension == "string") {
|
|
@@ -4242,7 +4050,7 @@ function yr(e, t) {
|
|
|
4242
4050
|
}
|
|
4243
4051
|
return n;
|
|
4244
4052
|
}
|
|
4245
|
-
function
|
|
4053
|
+
function pr(e) {
|
|
4246
4054
|
let t = [];
|
|
4247
4055
|
for (let n = 0; n < e.length; n++) {
|
|
4248
4056
|
let r = e[n], i = r.query;
|
|
@@ -4254,17 +4062,17 @@ function br(e) {
|
|
|
4254
4062
|
}
|
|
4255
4063
|
return t;
|
|
4256
4064
|
}
|
|
4257
|
-
function
|
|
4065
|
+
function mr(e, t) {
|
|
4258
4066
|
if (typeof e.dimension == "string") return !0;
|
|
4259
|
-
let n =
|
|
4067
|
+
let n = ve(t);
|
|
4260
4068
|
return n ? e.dimension.some((e) => e.cube === n) : !1;
|
|
4261
4069
|
}
|
|
4262
|
-
function
|
|
4070
|
+
function hr(e, t) {
|
|
4263
4071
|
let n = [];
|
|
4264
4072
|
for (let r = 0; r < t.length; r++) {
|
|
4265
4073
|
let i = t[r];
|
|
4266
|
-
if (!
|
|
4267
|
-
let e =
|
|
4074
|
+
if (!mr(e, i.query)) {
|
|
4075
|
+
let e = ve(i.query) || "unknown";
|
|
4268
4076
|
n.push({
|
|
4269
4077
|
type: "cross_cube",
|
|
4270
4078
|
message: `Step ${r + 1} uses cube "${e}" but no binding key mapping exists for it`,
|
|
@@ -4274,26 +4082,26 @@ function Sr(e, t) {
|
|
|
4274
4082
|
}
|
|
4275
4083
|
return n;
|
|
4276
4084
|
}
|
|
4277
|
-
function
|
|
4085
|
+
function gr(e) {
|
|
4278
4086
|
return e ? /^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/.test(e) ? null : {
|
|
4279
4087
|
type: "time_window",
|
|
4280
4088
|
message: `Invalid time window format "${e}". Expected ISO 8601 duration (e.g., P7D, PT1H)`
|
|
4281
4089
|
} : null;
|
|
4282
4090
|
}
|
|
4283
|
-
function
|
|
4091
|
+
function _r(e, t) {
|
|
4284
4092
|
let n = [], r = [];
|
|
4285
4093
|
e.steps.length < 2 && n.push({
|
|
4286
4094
|
type: "general",
|
|
4287
4095
|
message: "Funnel requires at least 2 steps"
|
|
4288
|
-
}), e.bindingKey?.dimension ? (n.push(...
|
|
4096
|
+
}), e.bindingKey?.dimension ? (n.push(...fr(e.bindingKey, t)), n.push(...hr(e.bindingKey, e.steps))) : n.push({
|
|
4289
4097
|
type: "binding_key",
|
|
4290
4098
|
message: "Binding key dimension is required"
|
|
4291
|
-
}), n.push(...
|
|
4099
|
+
}), n.push(...pr(e.steps));
|
|
4292
4100
|
for (let t = 0; t < e.steps.length; t++) {
|
|
4293
|
-
let r = e.steps[t], i =
|
|
4101
|
+
let r = e.steps[t], i = gr(r.timeToConvert);
|
|
4294
4102
|
i && (i.stepIndex = t, n.push(i));
|
|
4295
4103
|
}
|
|
4296
|
-
let i =
|
|
4104
|
+
let i = gr(e.globalTimeWindow);
|
|
4297
4105
|
return i && n.push(i), e.steps.length > 5 && r.push({
|
|
4298
4106
|
type: "general",
|
|
4299
4107
|
message: "Funnels with more than 5 steps may have reduced performance"
|
|
@@ -4303,7 +4111,7 @@ function wr(e, t) {
|
|
|
4303
4111
|
warnings: r
|
|
4304
4112
|
};
|
|
4305
4113
|
}
|
|
4306
|
-
function
|
|
4114
|
+
function vr(e, t) {
|
|
4307
4115
|
return t < 2 ? {
|
|
4308
4116
|
isValid: !1,
|
|
4309
4117
|
message: "Add at least 2 steps for funnel"
|
|
@@ -4312,7 +4120,7 @@ function Tr(e, t) {
|
|
|
4312
4120
|
message: "Select a binding key dimension"
|
|
4313
4121
|
} : { isValid: !0 };
|
|
4314
4122
|
}
|
|
4315
|
-
function
|
|
4123
|
+
function yr(e) {
|
|
4316
4124
|
if (!e?.cubes) return [];
|
|
4317
4125
|
let t = [];
|
|
4318
4126
|
for (let n of e.cubes) if (n.dimensions) for (let e of n.dimensions) (e.type === "string" || e.type === "number") && t.push({
|
|
@@ -4322,7 +4130,7 @@ function Er(e) {
|
|
|
4322
4130
|
});
|
|
4323
4131
|
return t;
|
|
4324
4132
|
}
|
|
4325
|
-
function
|
|
4133
|
+
function br(e) {
|
|
4326
4134
|
if (!e?.dimension) return "Select binding key...";
|
|
4327
4135
|
if (typeof e.dimension == "string") return e.dimension.split(".")[1] || e.dimension;
|
|
4328
4136
|
if (e.dimension.length > 0) {
|
|
@@ -4332,6 +4140,6 @@ function Dr(e) {
|
|
|
4332
4140
|
return "Select binding key...";
|
|
4333
4141
|
}
|
|
4334
4142
|
//#endregion
|
|
4335
|
-
export {
|
|
4143
|
+
export { kn as A, En as C, jn as D, Dn as E, Ye as F, Cn as M, Lt as N, Tn as O, it as P, Sn as S, wn as T, Vn as _, hr as a, Ln as b, dr as c, rr as d, tr as f, Fn as g, In as h, fr as i, $ as j, An as k, $n as l, or as m, br as n, _r as o, ir as p, vr as r, pr as s, yr as t, er as u, zn as v, On as w, Nn as x, Pn as y };
|
|
4336
4144
|
|
|
4337
|
-
//# sourceMappingURL=analysis-builder-shared
|
|
4145
|
+
//# sourceMappingURL=analysis-builder-shared-CoX_nmo0.js.map
|